@pushwoosh/kit-typography 1.8.1 → 1.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/code/code.component.d.ts +1 -0
  2. package/code/code.component.js +1 -0
  3. package/code/code.styles.d.ts +1 -0
  4. package/code/code.styles.js +1 -0
  5. package/code/code.types.d.ts +1 -0
  6. package/footnote/footnote.component.d.ts +1 -0
  7. package/footnote/footnote.component.js +1 -0
  8. package/footnote/footnote.styles.d.ts +1 -0
  9. package/footnote/footnote.styles.js +1 -0
  10. package/footnote/footnote.types.d.ts +1 -0
  11. package/global-styles/global-styles.component.d.ts +4 -0
  12. package/global-styles/global-styles.component.js +4 -0
  13. package/h1/h1.component.d.ts +1 -0
  14. package/h1/h1.component.js +1 -0
  15. package/h1/h1.styles.d.ts +1 -0
  16. package/h1/h1.styles.js +1 -0
  17. package/h1/h1.types.d.ts +1 -0
  18. package/h2/h2.component.d.ts +1 -0
  19. package/h2/h2.component.js +1 -0
  20. package/h2/h2.styles.d.ts +1 -0
  21. package/h2/h2.styles.js +1 -0
  22. package/h2/h2.types.d.ts +1 -0
  23. package/h3/h3.component.d.ts +1 -0
  24. package/h3/h3.component.js +1 -0
  25. package/h3/h3.styles.d.ts +1 -0
  26. package/h3/h3.styles.js +1 -0
  27. package/h3/h3.types.d.ts +1 -0
  28. package/h4/h4.component.d.ts +1 -0
  29. package/h4/h4.component.js +1 -0
  30. package/h4/h4.styles.d.ts +1 -0
  31. package/h4/h4.styles.js +1 -0
  32. package/h4/h4.types.d.ts +1 -0
  33. package/h5/h5.component.d.ts +1 -0
  34. package/h5/h5.component.js +1 -0
  35. package/h5/h5.styles.d.ts +1 -0
  36. package/h5/h5.styles.js +1 -0
  37. package/h5/h5.types.d.ts +1 -0
  38. package/map.d.ts +19 -1
  39. package/map.js +1 -0
  40. package/package.json +3 -3
  41. package/paragraph/paragraph.component.d.ts +1 -0
  42. package/paragraph/paragraph.component.js +1 -0
  43. package/paragraph/paragraph.styles.d.ts +1 -0
  44. package/paragraph/paragraph.styles.js +1 -0
  45. package/paragraph/paragraph.types.d.ts +1 -0
  46. package/text/Text.d.ts +4 -0
  47. package/text/Text.js +4 -0
  48. package/ai-documentation.md +0 -243
@@ -1,2 +1,3 @@
1
1
  import { type CodeProps } from './code.types';
2
+ /** Monospaced text block — renders `<div>` with the `code` typography variant. */
2
3
  export declare function Code(props: CodeProps): JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { CodeBox } from './code.styles';
3
+ /** Monospaced text block — renders `<div>` with the `code` typography variant. */
3
4
  export function Code(props) {
4
5
  const {
5
6
  boxRef,
@@ -1 +1,2 @@
1
+ /** Styled `<div>` behind {@link Code}; use it when you need to extend the styles. */
1
2
  export declare const CodeBox: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,5 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  import { variants } from '../map';
3
+ /** Styled `<div>` behind {@link Code}; use it when you need to extend the styles. */
3
4
  export const CodeBox = styled.div.withConfig({
4
5
  displayName: "CodeBox",
5
6
  componentId: "sc-15hd43f-0"
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ /** Props of {@link Code}: every `<div>` attribute plus `boxRef` — `ref` is taken by the wrapper. */
2
3
  export type CodeProps = Omit<JSX.IntrinsicElements['div'], 'ref'> & {
3
4
  readonly boxRef?: React.Ref<HTMLDivElement>;
4
5
  readonly children: React.ReactNode;
@@ -1,2 +1,3 @@
1
1
  import { type FootnoteProps } from './footnote.types';
2
+ /** Small secondary text — renders `<div>` with the `footnote` typography variant. */
2
3
  export declare function Footnote(props: FootnoteProps): JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { FootnoteBox } from './footnote.styles';
3
+ /** Small secondary text — renders `<div>` with the `footnote` typography variant. */
3
4
  export function Footnote(props) {
4
5
  const {
5
6
  boxRef,
@@ -1 +1,2 @@
1
+ /** Styled `<div>` behind {@link Footnote}; use it when you need to extend the styles. */
1
2
  export declare const FootnoteBox: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,5 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  import { variants } from '../map';
3
+ /** Styled `<div>` behind {@link Footnote}; use it when you need to extend the styles. */
3
4
  export const FootnoteBox = styled.div.withConfig({
4
5
  displayName: "FootnoteBox",
5
6
  componentId: "sc-1yebxfg-0"
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ /** Props of {@link Footnote}: every `<div>` attribute plus `boxRef` — `ref` is taken by the wrapper. */
2
3
  export type FootnoteProps = Omit<JSX.IntrinsicElements['div'], 'ref'> & {
3
4
  readonly boxRef?: React.Ref<HTMLDivElement>;
4
5
  readonly children: React.ReactNode;
@@ -1 +1,5 @@
1
+ /**
2
+ * App-wide baseline, mounted once at the app root: border-box sizing, body typography and link colours
3
+ * from the kit tokens, antialiased smoothing, and a cleared focus outline on `button` and `a`.
4
+ */
1
5
  export declare const GlobalStyles: import("styled-components").GlobalStyleComponent<{}, import("styled-components").DefaultTheme>;
@@ -1,4 +1,8 @@
1
1
  import { createGlobalStyle } from 'styled-components';
2
2
  import { Color, FontFamily, FontSize, FontWeight, LineHeight } from '@pushwoosh/kit-constants';
3
+ /**
4
+ * App-wide baseline, mounted once at the app root: border-box sizing, body typography and link colours
5
+ * from the kit tokens, antialiased smoothing, and a cleared focus outline on `button` and `a`.
6
+ */
3
7
  export const GlobalStyles = createGlobalStyle(["*,*::before,*::after{box-sizing:border-box;}body{color:", ";font-family:", ";font-size:", ";font-weight:", ";line-height:", ";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}a{color:", ";text-decoration:none;&:hover{color:", ";text-decoration:underline;}}button,a{&:focus{outline:none;}}"], Color.MAIN, FontFamily.MAIN, FontSize.REGULAR, FontWeight.REGULAR, LineHeight.REGULAR, Color.PRIMARY, Color.PRIMARY_HOVER);
4
8
  GlobalStyles.displayName = 'GlobalStyles';
@@ -1,2 +1,3 @@
1
1
  import { type H1Props } from './h1.types';
2
+ /** Page title — renders `<h1>` with the `h1` typography variant. */
2
3
  export declare function H1(props: H1Props): JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { H1Box } from './h1.styles';
3
+ /** Page title — renders `<h1>` with the `h1` typography variant. */
3
4
  export function H1(props) {
4
5
  const {
5
6
  boxRef,
package/h1/h1.styles.d.ts CHANGED
@@ -1 +1,2 @@
1
+ /** Styled `<h1>` behind {@link H1}; use it when you need to extend the styles. */
1
2
  export declare const H1Box: import("styled-components").StyledComponent<"h1", any, {}, never>;
package/h1/h1.styles.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  import { variants } from '../map';
3
+ /** Styled `<h1>` behind {@link H1}; use it when you need to extend the styles. */
3
4
  export const H1Box = styled.h1.withConfig({
4
5
  displayName: "H1Box",
5
6
  componentId: "sc-nenzzw-0"
package/h1/h1.types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ /** Props of {@link H1}: every `<h1>` attribute plus `boxRef` — `ref` is taken by the wrapper. */
2
3
  export type H1Props = Omit<JSX.IntrinsicElements['h1'], 'ref'> & {
3
4
  readonly boxRef?: React.Ref<HTMLHeadingElement>;
4
5
  readonly children: React.ReactNode;
@@ -1,2 +1,3 @@
1
1
  import { type H2Props } from './h2.types';
2
+ /** Section heading — renders `<h2>` with the `h2` typography variant. */
2
3
  export declare function H2(props: H2Props): JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { H2Box } from './h2.styles';
3
+ /** Section heading — renders `<h2>` with the `h2` typography variant. */
3
4
  export function H2(props) {
4
5
  const {
5
6
  boxRef,
package/h2/h2.styles.d.ts CHANGED
@@ -1 +1,2 @@
1
+ /** Styled `<h2>` behind {@link H2}; use it when you need to extend the styles. */
1
2
  export declare const H2Box: import("styled-components").StyledComponent<"h2", any, {}, never>;
package/h2/h2.styles.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  import { variants } from '../map';
3
+ /** Styled `<h2>` behind {@link H2}; use it when you need to extend the styles. */
3
4
  export const H2Box = styled.h2.withConfig({
4
5
  displayName: "H2Box",
5
6
  componentId: "sc-ev7pmn-0"
package/h2/h2.types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ /** Props of {@link H2}: every `<h2>` attribute plus `boxRef` — `ref` is taken by the wrapper. */
2
3
  export type H2Props = Omit<JSX.IntrinsicElements['h2'], 'ref'> & {
3
4
  readonly boxRef?: React.Ref<HTMLHeadingElement>;
4
5
  readonly children: React.ReactNode;
@@ -1,2 +1,3 @@
1
1
  import { type H3Props } from './h3.types';
2
+ /** Sub-section heading — renders `<h3>` with the `h3` typography variant. */
2
3
  export declare function H3(props: H3Props): JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { H3Box } from './h3.styles';
3
+ /** Sub-section heading — renders `<h3>` with the `h3` typography variant. */
3
4
  export function H3(props) {
4
5
  const {
5
6
  boxRef,
package/h3/h3.styles.d.ts CHANGED
@@ -1 +1,2 @@
1
+ /** Styled `<h3>` behind {@link H3}; use it when you need to extend the styles. */
1
2
  export declare const H3Box: import("styled-components").StyledComponent<"h3", any, {}, never>;
package/h3/h3.styles.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  import { variants } from '../map';
3
+ /** Styled `<h3>` behind {@link H3}; use it when you need to extend the styles. */
3
4
  export const H3Box = styled.h3.withConfig({
4
5
  displayName: "H3Box",
5
6
  componentId: "sc-mhts3r-0"
package/h3/h3.types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ /** Props of {@link H3}: every `<h3>` attribute plus `boxRef` — `ref` is taken by the wrapper. */
2
3
  export type H3Props = Omit<JSX.IntrinsicElements['h3'], 'ref'> & {
3
4
  readonly boxRef?: React.Ref<HTMLHeadingElement>;
4
5
  readonly children: React.ReactNode;
@@ -1,2 +1,3 @@
1
1
  import { type H4Props } from './h4.types';
2
+ /** Small heading — renders `<h4>` with the `h4` typography variant. */
2
3
  export declare function H4(props: H4Props): JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { H4Box } from './h4.styles';
3
+ /** Small heading — renders `<h4>` with the `h4` typography variant. */
3
4
  export function H4(props) {
4
5
  const {
5
6
  boxRef,
package/h4/h4.styles.d.ts CHANGED
@@ -1 +1,2 @@
1
+ /** Styled `<h4>` behind {@link H4}; use it when you need to extend the styles. */
1
2
  export declare const H4Box: import("styled-components").StyledComponent<"h4", any, {}, never>;
package/h4/h4.styles.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  import { variants } from '../map';
3
+ /** Styled `<h4>` behind {@link H4}; use it when you need to extend the styles. */
3
4
  export const H4Box = styled.h4.withConfig({
4
5
  displayName: "H4Box",
5
6
  componentId: "sc-1178dfn-0"
package/h4/h4.types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ /** Props of {@link H4}: every `<h4>` attribute plus `boxRef` — `ref` is taken by the wrapper. */
2
3
  export type H4Props = Omit<JSX.IntrinsicElements['h4'], 'ref'> & {
3
4
  readonly boxRef?: React.Ref<HTMLHeadingElement>;
4
5
  readonly children: React.ReactNode;
@@ -1,2 +1,3 @@
1
1
  import { type H5Props } from './h5.types';
2
+ /** Smallest heading, rendered uppercase — renders `<h5>` with the `h5` typography variant. */
2
3
  export declare function H5(props: H5Props): JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { H5Box } from './h5.styles';
3
+ /** Smallest heading, rendered uppercase — renders `<h5>` with the `h5` typography variant. */
3
4
  export function H5(props) {
4
5
  const {
5
6
  boxRef,
package/h5/h5.styles.d.ts CHANGED
@@ -1 +1,2 @@
1
+ /** Styled `<h5>` behind {@link H5}; use it when you need to extend the styles. */
1
2
  export declare const H5Box: import("styled-components").StyledComponent<"h5", any, {}, never>;
package/h5/h5.styles.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  import { variants } from '../map';
3
+ /** Styled `<h5>` behind {@link H5}; use it when you need to extend the styles. */
3
4
  export const H5Box = styled.h5.withConfig({
4
5
  displayName: "H5Box",
5
6
  componentId: "sc-1nc3vby-0"
package/h5/h5.types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ /** Props of {@link H5}: every `<h5>` attribute plus `boxRef` — `ref` is taken by the wrapper. */
2
3
  export type H5Props = Omit<JSX.IntrinsicElements['h5'], 'ref'> & {
3
4
  readonly boxRef?: React.Ref<HTMLHeadingElement>;
4
5
  readonly children: React.ReactNode;
package/map.d.ts CHANGED
@@ -1,3 +1,21 @@
1
1
  import { type FlattenSimpleInterpolation } from 'styled-components';
2
- export type TypographyVariant = 'standard' | 'footnote' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'code';
2
+ /** Name of a typography variant — the `$variant` prop of {@link Text} and the keys of {@link variants}. */
3
+ export type TypographyVariant =
4
+ /** Body text. */
5
+ 'standard'
6
+ /** Small secondary text: captions, hints, legends. */
7
+ | 'footnote'
8
+ /** Page title. */
9
+ | 'h1'
10
+ /** Section heading. */
11
+ | 'h2'
12
+ /** Sub-section heading. */
13
+ | 'h3'
14
+ /** Small heading. */
15
+ | 'h4'
16
+ /** Smallest heading; `H5` also uppercases it, the variant alone does not. */
17
+ | 'h5'
18
+ /** Monospaced text: code, ids, tokens. */
19
+ | 'code';
20
+ /** Font family/size/weight/line-height per variant, as a styled-components interpolation; values come from `@pushwoosh/kit-constants`. */
3
21
  export declare const variants: Record<TypographyVariant, FlattenSimpleInterpolation>;
package/map.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { css } from 'styled-components';
2
2
  import { FontFamily, FontSize, LineHeight, FontWeight } from '@pushwoosh/kit-constants';
3
+ /** Font family/size/weight/line-height per variant, as a styled-components interpolation; values come from `@pushwoosh/kit-constants`. */
3
4
  export const variants = {
4
5
  standard: css(["font-family:", ";font-size:", ";font-weight:", ";line-height:", ";"], FontFamily.MAIN, FontSize.REGULAR, FontWeight.REGULAR, LineHeight.REGULAR),
5
6
  footnote: css(["font-family:", ";font-size:", ";font-weight:", ";line-height:", ";"], FontFamily.MAIN, FontSize.SMALL, FontWeight.REGULAR, LineHeight.SMALL),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/kit-typography",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "React component for build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "scripts": {
13
13
  "start": "npm run playground",
14
- "build": "pushwoosh-engine lib:build && cp ai-documentation.md dist/ai-documentation.md",
14
+ "build": "pushwoosh-engine lib:build",
15
15
  "playground": "pushwoosh-engine lib:playground",
16
16
  "check": "npm run check:lint && npm run check:types",
17
17
  "check:lint": "echo \"Run check:lint\" && NODE_ENV=production eslint ./src",
@@ -23,7 +23,7 @@
23
23
  "@pushwoosh/kit-constants": "^1.6.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@pushwoosh/frontend-builder-engine": "^3.0.0",
26
+ "@pushwoosh/frontend-builder-engine": "^3.1.0",
27
27
  "@types/react": "^18.3.2",
28
28
  "@types/react-dom": "^18.3.0",
29
29
  "@types/styled-components": "^5.1.34",
@@ -1,2 +1,3 @@
1
1
  import { type ParagraphProps } from './paragraph.types';
2
+ /** Body text — renders `<p>` with the `standard` variant; consecutive paragraphs get a top margin. */
2
3
  export declare function Paragraph(props: ParagraphProps): JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ParagraphBox } from './paragraph.styles';
3
+ /** Body text — renders `<p>` with the `standard` variant; consecutive paragraphs get a top margin. */
3
4
  export function Paragraph(props) {
4
5
  const {
5
6
  boxRef,
@@ -1 +1,2 @@
1
+ /** Styled `<p>` behind {@link Paragraph}; use it when you need to extend the styles. */
1
2
  export declare const ParagraphBox: import("styled-components").StyledComponent<"p", any, {}, never>;
@@ -1,5 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  import { variants } from '../map';
3
+ /** Styled `<p>` behind {@link Paragraph}; use it when you need to extend the styles. */
3
4
  export const ParagraphBox = styled.p.withConfig({
4
5
  displayName: "ParagraphBox",
5
6
  componentId: "sc-1o1vp14-0"
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ /** Props of {@link Paragraph}: every `<p>` attribute plus `boxRef` — `ref` is taken by the wrapper. */
2
3
  export type ParagraphProps = Omit<JSX.IntrinsicElements['p'], 'ref'> & {
3
4
  readonly boxRef?: React.Ref<HTMLParagraphElement>;
4
5
  readonly children: React.ReactNode;
package/text/Text.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  import { type TypographyVariant } from '../map';
2
+ /**
3
+ * Inline text in any typography variant: `$variant`, plus `$color`, `$uppercase` and `$ellipsis`.
4
+ * `$ellipsis` needs a bounded width — it makes the span `inline-block` at `max-width: 100%`.
5
+ */
2
6
  export declare const Text: import("styled-components").StyledComponent<"span", any, {
3
7
  $color?: string;
4
8
  $uppercase?: boolean;
package/text/Text.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import styled from 'styled-components';
2
2
  import { variants } from '../map';
3
+ /**
4
+ * Inline text in any typography variant: `$variant`, plus `$color`, `$uppercase` and `$ellipsis`.
5
+ * `$ellipsis` needs a bounded width — it makes the span `inline-block` at `max-width: 100%`.
6
+ */
3
7
  export const Text = styled.span.withConfig({
4
8
  displayName: "Text",
5
9
  componentId: "sc-s3ssy9-0"
@@ -1,243 +0,0 @@
1
- # @pushwoosh/kit-typography - AI Agent Documentation
2
-
3
- ## Overview
4
- React typography component library for Pushwoosh products. Provides styled-components based typography components with consistent design system.
5
-
6
- ## Installation
7
- ```bash
8
- npm install @pushwoosh/kit-typography
9
- ```
10
-
11
- ## Core Dependencies
12
- - **react**: >= 18.0.0 (peer dependency)
13
- - **styled-components**: >= 5.3.3 (peer dependency)
14
- - **@pushwoosh/kit-constants**: Typography constants (fonts, sizes, weights, line-heights, colors)
15
-
16
- ## Available Components
17
-
18
- ### Heading Components
19
- - **H1**: Main page heading (`<h1>`)
20
- - **H2**: Section heading (`<h2>`)
21
- - **H3**: Subsection heading (`<h3>`)
22
- - **H4**: Small heading (`<h4>`)
23
- - **H5**: Smallest heading (`<h5>`)
24
-
25
- All heading components accept:
26
- - `boxRef`: React ref for the HTML element
27
- - `children`: React.ReactNode
28
- - All standard HTML heading attributes
29
-
30
- ### Text Components
31
-
32
- #### Paragraph
33
- Standard paragraph component (`<p>`)
34
- ```tsx
35
- import { Paragraph } from '@pushwoosh/kit-typography';
36
- <Paragraph>Your text content</Paragraph>
37
- ```
38
-
39
- #### Footnote
40
- Small text for footnotes/captions
41
- ```tsx
42
- import { Footnote } from '@pushwoosh/kit-typography';
43
- <Footnote>Small text content</Footnote>
44
- ```
45
-
46
- #### Code
47
- Monospace text for code snippets (`<code>`)
48
- ```tsx
49
- import { Code } from '@pushwoosh/kit-typography';
50
- <Code>console.log('Hello')</Code>
51
- ```
52
-
53
- ### Universal Text Component
54
-
55
- #### Text
56
- Flexible styled span component with variant support
57
- ```tsx
58
- import { Text } from '@pushwoosh/kit-typography';
59
-
60
- // Basic usage
61
- <Text>Default text</Text>
62
-
63
- // With variant
64
- <Text $variant="h1">Large heading text</Text>
65
- <Text $variant="footnote">Small text</Text>
66
- <Text $variant="code">Monospace text</Text>
67
-
68
- // With props
69
- <Text $color="#FF0000">Red text</Text>
70
- <Text $uppercase>UPPERCASE TEXT</Text>
71
- <Text $ellipsis>Long text with ellipsis...</Text>
72
-
73
- // Combined
74
- <Text $variant="h2" $color="#0066CC" $uppercase>BLUE HEADING</Text>
75
- ```
76
-
77
- **Props:**
78
- - `$variant`: TypographyVariant - style preset ('standard' | 'footnote' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'code')
79
- - `$color`: string - custom text color
80
- - `$uppercase`: boolean - transform text to uppercase
81
- - `$ellipsis`: boolean - add text overflow ellipsis
82
-
83
- ### Global Styles
84
-
85
- Apply consistent typography and base styles across the application:
86
- ```tsx
87
- import { GlobalStyles } from '@pushwoosh/kit-typography';
88
-
89
- // In your app root
90
- function App() {
91
- return (
92
- <>
93
- <GlobalStyles />
94
- {/* Your app components */}
95
- </>
96
- );
97
- }
98
- ```
99
-
100
- Sets:
101
- - Box-sizing: border-box for all elements
102
- - Body typography: main font, regular size/weight
103
- - Link styles: primary color with hover effects
104
- - Focus outline removal on buttons/links
105
- - Font smoothing for better rendering
106
-
107
- ## Typography Variants
108
-
109
- Available through `TypographyVariant` type and used in Text component:
110
-
111
- | Variant | Font Family | Size | Weight | Line Height |
112
- |---------|------------|------|--------|-------------|
113
- | standard | MAIN | REGULAR | REGULAR | REGULAR |
114
- | footnote | MAIN | SMALL | REGULAR | SMALL |
115
- | h1 | MAIN | HEADING1 | BOLD | HEADING1 |
116
- | h2 | MAIN | HEADING2 | BOLD | HEADING2 |
117
- | h3 | MAIN | HEADING3 | BOLD | HEADING3 |
118
- | h4 | MAIN | HEADING4 | MEDIUM | HEADING4 |
119
- | h5 | MAIN | HEADING5 | MEDIUM | HEADING5 |
120
- | code | MONO | REGULAR | REGULAR | REGULAR |
121
-
122
- ## Usage Examples
123
-
124
- ### Complete page structure
125
- ```tsx
126
- import {
127
- GlobalStyles,
128
- H1,
129
- H2,
130
- Paragraph,
131
- Text,
132
- Code,
133
- Footnote
134
- } from '@pushwoosh/kit-typography';
135
-
136
- function Page() {
137
- return (
138
- <>
139
- <GlobalStyles />
140
- <H1>Page Title</H1>
141
- <Paragraph>
142
- Introduction paragraph with <Text $color="#0066CC">highlighted</Text> text.
143
- </Paragraph>
144
-
145
- <H2>Section Title</H2>
146
- <Paragraph>
147
- Section content with <Code>inline code</Code> example.
148
- </Paragraph>
149
-
150
- <Text $variant="h3" $uppercase>SUBSECTION</Text>
151
- <Footnote>Note: Additional information</Footnote>
152
- </>
153
- );
154
- }
155
- ```
156
-
157
- ### Dynamic text styling
158
- ```tsx
159
- import { Text } from '@pushwoosh/kit-typography';
160
-
161
- function StatusText({ status, message }) {
162
- const color = status === 'error' ? '#FF0000' : '#00AA00';
163
- return (
164
- <Text
165
- $color={color}
166
- $variant={status === 'error' ? 'h4' : 'standard'}
167
- $uppercase={status === 'error'}
168
- >
169
- {message}
170
- </Text>
171
- );
172
- }
173
- ```
174
-
175
- ### Text truncation
176
- ```tsx
177
- import { Text } from '@pushwoosh/kit-typography';
178
-
179
- function UserCard({ userName, userEmail }) {
180
- return (
181
- <div style={{ width: '200px' }}>
182
- <Text $variant="h5">{userName}</Text>
183
- <Text $ellipsis $color="#666">{userEmail}</Text>
184
- </div>
185
- );
186
- }
187
- ```
188
-
189
- ## Development Scripts
190
-
191
- - `npm start` / `npm run playground`: Start development playground
192
- - `npm run build`: Build the library
193
- - `npm run check`: Run linting and type checking
194
- - `npm run check:lint`: Run ESLint
195
- - `npm run check:types`: Check TypeScript types
196
-
197
- ## File Structure
198
-
199
- ```
200
- src/
201
- ├── index.tsx # Main exports
202
- ├── map.ts # Typography variants configuration
203
- ├── text/
204
- │ └── Text.ts # Universal Text component
205
- ├── global-styles/ # Global CSS styles
206
- ├── h1-h5/ # Heading components
207
- ├── paragraph/ # Paragraph component
208
- ├── footnote/ # Footnote component
209
- └── code/ # Code component
210
- ```
211
-
212
- Each component folder contains:
213
- - `index.tsx`: Component export
214
- - `[name].component.tsx`: React component
215
- - `[name].styles.tsx`: Styled-components styles
216
- - `[name].types.tsx`: TypeScript types
217
-
218
- ## Best Practices
219
-
220
- 1. **Always include GlobalStyles** in your app root for consistent base styling
221
- 2. **Use semantic components** (H1, Paragraph) for better HTML structure
222
- 3. **Use Text component** for inline styling needs and dynamic variants
223
- 4. **Leverage $ellipsis** for text truncation in constrained layouts
224
- 5. **Import from package root**: `import { H1, Text } from '@pushwoosh/kit-typography'`
225
- 6. **Maintain hierarchy**: Use heading levels (H1→H2→H3) in proper order
226
-
227
- ## TypeScript Support
228
-
229
- Full TypeScript support with exported types:
230
- - Component props types for all components
231
- - `TypographyVariant` type for Text component variants
232
- - Proper HTML element attribute inheritance
233
-
234
- ## Integration with Pushwoosh Design System
235
-
236
- This library uses `@pushwoosh/kit-constants` for all design tokens:
237
- - **FontFamily**: MAIN, MONO
238
- - **FontSize**: SMALL, REGULAR, HEADING1-5
239
- - **FontWeight**: REGULAR, MEDIUM, BOLD
240
- - **LineHeight**: SMALL, REGULAR, HEADING1-5
241
- - **Color**: MAIN, PRIMARY, PRIMARY_HOVER
242
-
243
- Ensures consistency across all Pushwoosh products.