cleanplate 0.1.10 → 0.2.0

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 (87) hide show
  1. package/dist/components/accordion/Accordion.d.ts +23 -12
  2. package/dist/components/accordion/Accordion.d.ts.map +1 -1
  3. package/dist/components/accordion/index.d.ts +2 -1
  4. package/dist/components/accordion/index.d.ts.map +1 -1
  5. package/dist/components/animated/Animated.d.ts +18 -16
  6. package/dist/components/animated/Animated.d.ts.map +1 -1
  7. package/dist/components/animated/index.d.ts +2 -2
  8. package/dist/components/animated/index.d.ts.map +1 -1
  9. package/dist/components/app-shell/AppShell.d.ts +35 -3
  10. package/dist/components/app-shell/AppShell.d.ts.map +1 -1
  11. package/dist/components/app-shell/index.d.ts +2 -1
  12. package/dist/components/app-shell/index.d.ts.map +1 -1
  13. package/dist/components/bottom-sheet/BottomSheet.d.ts +17 -16
  14. package/dist/components/bottom-sheet/BottomSheet.d.ts.map +1 -1
  15. package/dist/components/bottom-sheet/index.d.ts +2 -1
  16. package/dist/components/bottom-sheet/index.d.ts.map +1 -1
  17. package/dist/components/breadcrumb/BreadCrumb.d.ts +26 -0
  18. package/dist/components/breadcrumb/BreadCrumb.d.ts.map +1 -0
  19. package/dist/components/breadcrumb/index.d.ts +3 -2
  20. package/dist/components/breadcrumb/index.d.ts.map +1 -1
  21. package/dist/components/footer/Footer.d.ts +21 -16
  22. package/dist/components/footer/Footer.d.ts.map +1 -1
  23. package/dist/components/footer/index.d.ts +2 -1
  24. package/dist/components/footer/index.d.ts.map +1 -1
  25. package/dist/components/form-controls/Checkbox.d.ts +10 -8
  26. package/dist/components/form-controls/Checkbox.d.ts.map +1 -1
  27. package/dist/components/form-controls/Date.d.ts +6 -4
  28. package/dist/components/form-controls/Date.d.ts.map +1 -1
  29. package/dist/components/form-controls/File.d.ts +10 -9
  30. package/dist/components/form-controls/File.d.ts.map +1 -1
  31. package/dist/components/form-controls/Input.d.ts +11 -9
  32. package/dist/components/form-controls/Input.d.ts.map +1 -1
  33. package/dist/components/form-controls/Radio.d.ts +10 -9
  34. package/dist/components/form-controls/Radio.d.ts.map +1 -1
  35. package/dist/components/form-controls/Select.d.ts +12 -6
  36. package/dist/components/form-controls/Select.d.ts.map +1 -1
  37. package/dist/components/form-controls/Stepper.d.ts +10 -8
  38. package/dist/components/form-controls/Stepper.d.ts.map +1 -1
  39. package/dist/components/form-controls/TextArea.d.ts +10 -8
  40. package/dist/components/form-controls/TextArea.d.ts.map +1 -1
  41. package/dist/components/form-controls/Toggle.d.ts +10 -9
  42. package/dist/components/form-controls/Toggle.d.ts.map +1 -1
  43. package/dist/components/form-controls/index.d.ts +30 -20
  44. package/dist/components/form-controls/index.d.ts.map +1 -1
  45. package/dist/components/header/Header.d.ts +32 -28
  46. package/dist/components/header/Header.d.ts.map +1 -1
  47. package/dist/components/header/index.d.ts +2 -1
  48. package/dist/components/header/index.d.ts.map +1 -1
  49. package/dist/components/menu-list/MenuList.d.ts +32 -22
  50. package/dist/components/menu-list/MenuList.d.ts.map +1 -1
  51. package/dist/components/menu-list/index.d.ts +2 -1
  52. package/dist/components/menu-list/index.d.ts.map +1 -1
  53. package/dist/components/page-header/PageHeader.d.ts +22 -3
  54. package/dist/components/page-header/PageHeader.d.ts.map +1 -1
  55. package/dist/components/page-header/index.d.ts +2 -1
  56. package/dist/components/page-header/index.d.ts.map +1 -1
  57. package/dist/components/toast/Toast.d.ts +20 -12
  58. package/dist/components/toast/Toast.d.ts.map +1 -1
  59. package/dist/components/toast/index.d.ts +2 -1
  60. package/dist/components/toast/index.d.ts.map +1 -1
  61. package/dist/index.css +1 -1
  62. package/dist/index.es.css +1 -1
  63. package/dist/index.es.js +3 -3
  64. package/dist/index.js +3 -3
  65. package/package.json +1 -1
  66. package/docs/Alert.md +0 -131
  67. package/docs/Avatar.md +0 -130
  68. package/docs/Badge.md +0 -83
  69. package/docs/Button.md +0 -175
  70. package/docs/ConfirmDialog.md +0 -139
  71. package/docs/Container.md +0 -230
  72. package/docs/Dropdown.md +0 -175
  73. package/docs/Icon.md +0 -225
  74. package/docs/MediaObject.md +0 -303
  75. package/docs/Modal.md +0 -152
  76. package/docs/Pagination.md +0 -142
  77. package/docs/Pills.md +0 -104
  78. package/docs/Spinner.md +0 -115
  79. package/docs/Stepper.md +0 -131
  80. package/docs/Table.md +0 -194
  81. package/docs/Typography.md +0 -226
  82. package/llms.txt +0 -171
  83. package/scripts/generate-icons.js +0 -175
  84. package/templates/README.md +0 -10
  85. package/templates/docs-template-sample.md +0 -67
  86. package/templates/storybook-docs-template.md +0 -236
  87. package/tsconfig.json +0 -26
package/docs/Spinner.md DELETED
@@ -1,115 +0,0 @@
1
- # Spinner Component
2
-
3
- Purpose: A loading indicator that shows a rotating Material icon. Use it for progress or activity states. Supports six icon options (all animate when rotated), sizes, light/dark variant, and margin spacing.
4
-
5
- ## Props / Inputs
6
-
7
- | Prop | Type | Required | Default | Description |
8
- | --- | --- | --- | --- | --- |
9
- | size | "small" \| "medium" \| "large" | no | "medium" | Size of the spinner. |
10
- | variant | "light" \| "dark" | no | "light" | Visual variant; use dark on dark backgrounds. |
11
- | icon | SpinnerIcon | no | "progress_activity" | Icon to display as the spinner. One of: progress_activity, autorenew, sync, refresh, cached, loop. |
12
- | margin | string \| string[] | no | "0" | Spacing **suffix** for outer margin. The component adds the `m-` prefix (e.g. `"0"` → m-0, `"b-2"` → m-b-2). Use a single string or array. |
13
- | className | string | no | "" | Additional class names for the wrapper. |
14
-
15
- ## Types
16
-
17
- ### SpinnerSize
18
- ```typescript
19
- type SpinnerSize = "small" | "medium" | "large";
20
- ```
21
-
22
- ### SpinnerVariant
23
- ```typescript
24
- type SpinnerVariant = "light" | "dark";
25
- ```
26
-
27
- ### SpinnerIcon
28
- ```typescript
29
- type SpinnerIcon =
30
- | "progress_activity"
31
- | "autorenew"
32
- | "sync"
33
- | "refresh"
34
- | "cached"
35
- | "loop";
36
- ```
37
-
38
- ### SpacingOption
39
- ```typescript
40
- type SpacingOption = (typeof SPACING_OPTIONS)[number];
41
- ```
42
-
43
- ### SpinnerMargin
44
- ```typescript
45
- type SpinnerMargin = string | SpacingOption[];
46
- ```
47
-
48
- ### SpinnerProps
49
- ```typescript
50
- interface SpinnerProps {
51
- size?: SpinnerSize;
52
- variant?: SpinnerVariant;
53
- icon?: SpinnerIcon;
54
- margin?: SpinnerMargin;
55
- className?: string;
56
- }
57
- ```
58
-
59
- ## Usage Examples
60
-
61
- ### Basic
62
-
63
- ```jsx
64
- import { Spinner } from "cleanplate";
65
-
66
- export const Example = () => <Spinner size="medium" variant="light" />;
67
- ```
68
-
69
- ### Icon options
70
-
71
- All of these icons rotate via the same CSS animation.
72
-
73
- ```jsx
74
- import { Spinner } from "cleanplate";
75
-
76
- <Spinner /> // progress_activity (default)
77
- <Spinner icon="autorenew" /> // Circular arrows
78
- <Spinner icon="sync" /> // Sync arrows
79
- <Spinner icon="refresh" /> // Refresh arrows
80
- <Spinner icon="cached" /> // Cache/refresh arrows
81
- <Spinner icon="loop" /> // Circular loop
82
- ```
83
-
84
- ### Sizes and variants
85
-
86
- ```jsx
87
- <Spinner size="small" />
88
- <Spinner size="medium" />
89
- <Spinner size="large" />
90
- <Spinner variant="light" />
91
- <Spinner variant="dark" />
92
- ```
93
-
94
- ### With Container
95
-
96
- ```jsx
97
- import { Spinner, Container } from "cleanplate";
98
-
99
- export const Example = () => (
100
- <Container padding="4">
101
- <Spinner icon="sync" size="medium" margin="b-2" />
102
- </Container>
103
- );
104
- ```
105
-
106
- ## Behavior Notes
107
-
108
- - **Animation:** The icon is rotated continuously via CSS (class `cp-spinner-icon`). All six icon options work with this rotation.
109
- - **Layout:** Spinner renders a Container wrapping an Icon; size and variant classes apply to the wrapper.
110
- - **Spacing:** `margin` accepts the **spacing suffix**; the component adds the `m-` prefix via `getSpacingClass`. Use suffix form (e.g. `"0"`, `"b-2"`) when passing values.
111
-
112
- ## Related Components / Links
113
-
114
- - Container (used internally as the wrapper; use for layout around the spinner)
115
- - Icon (used internally to render the Material icon that rotates)
package/docs/Stepper.md DELETED
@@ -1,131 +0,0 @@
1
- # Stepper Component
2
-
3
- Purpose: Displays a sequence of steps (e.g. for a wizard or checkout). Each step has a label, optional active/completed state, and can be clickable. Use it for multi-step flows and progress indication. Supports horizontal and vertical layout.
4
-
5
- ## Props / Inputs
6
-
7
- | Prop | Type | Required | Default | Description |
8
- | --- | --- | --- | --- | --- |
9
- | variant | "horizontal" \| "vertical" | no | — | Layout direction. |
10
- | margin | string \| string[] | no | "0" | Spacing **suffix** for outer margin. The component adds the `m-` prefix (e.g. `"0"` → m-0, `"b-2"` → m-b-2). Use a single string or array. |
11
- | className | string | no | "" | Additional class names for the root element. |
12
- | config | StepperStepConfig[] | yes | — | Step definitions: each has label, key, and optionally isCompleted, isActive. |
13
- | onClick | (step: StepperStepConfig) => void | no | — | Called when a step is clicked; receives the step config. |
14
-
15
- ## Types
16
-
17
- ### StepperStepConfig
18
- ```typescript
19
- interface StepperStepConfig {
20
- label: string; // Display label
21
- key: string; // Unique key (e.g. href fragment or route path)
22
- isCompleted?: boolean;
23
- isActive?: boolean;
24
- }
25
- ```
26
-
27
- ### StepperVariant
28
- ```typescript
29
- type StepperVariant = "horizontal" | "vertical";
30
- ```
31
-
32
- ### SpacingOption
33
- ```typescript
34
- type SpacingOption = (typeof SPACING_OPTIONS)[number];
35
- ```
36
-
37
- ### StepperMargin
38
- ```typescript
39
- type StepperMargin = string | SpacingOption[];
40
- ```
41
-
42
- ### StepperProps
43
- ```typescript
44
- interface StepperProps {
45
- variant?: StepperVariant;
46
- margin?: StepperMargin;
47
- className?: string;
48
- config: StepperStepConfig[];
49
- onClick?: (step: StepperStepConfig) => void;
50
- }
51
- ```
52
-
53
- ## Usage Examples
54
-
55
- ### Basic
56
-
57
- ```jsx
58
- import { Stepper } from "cleanplate";
59
-
60
- const config = [
61
- { label: "Details", key: "/details", isActive: true },
62
- { label: "Review", key: "/review", isCompleted: true },
63
- { label: "Confirm", key: "/confirm" },
64
- ];
65
-
66
- export const Example = () => (
67
- <Stepper config={config} variant="horizontal" />
68
- );
69
- ```
70
-
71
- ### With onClick
72
-
73
- ```jsx
74
- import { Stepper } from "cleanplate";
75
- import { useState } from "react";
76
-
77
- const Example = () => {
78
- const [active, setActive] = useState("step1");
79
- const config = [
80
- { label: "Step 1", key: "step1", isActive: active === "step1" },
81
- { label: "Step 2", key: "step2", isActive: active === "step2" },
82
- ];
83
- return (
84
- <Stepper config={config} onClick={(step) => setActive(step.key)} />
85
- );
86
- };
87
- ```
88
-
89
- ### Horizontal and vertical
90
-
91
- ```jsx
92
- <Stepper config={config} variant="horizontal" />
93
- <Stepper config={config} variant="vertical" />
94
- ```
95
-
96
- ### With completed steps
97
-
98
- ```jsx
99
- <Stepper
100
- config={[
101
- { label: "Step 1", key: "1", isCompleted: true },
102
- { label: "Step 2", key: "2", isCompleted: true },
103
- { label: "Step 3", key: "3", isActive: true },
104
- { label: "Step 4", key: "4" },
105
- ]}
106
- variant="horizontal"
107
- />
108
- ```
109
-
110
- ### With Container
111
-
112
- ```jsx
113
- import { Stepper, Container } from "cleanplate";
114
-
115
- <Container padding="4">
116
- <Stepper config={config} variant="horizontal" margin="b-2" />
117
- </Container>
118
- ```
119
-
120
- ## Behavior Notes
121
-
122
- - **Links:** Each step label is an `<a href={step.key}>`. The component calls `preventDefault()` on click and invokes `onClick(step)` so you can control navigation (e.g. router) without following the href.
123
- - **Completed:** When `step.isCompleted` is true, the step number is replaced with a done icon.
124
- - **Active:** When `step.isActive` is true, the step gets the active CSS class.
125
- - **Spacing:** `margin` accepts the **spacing suffix**; the component adds the `m-` prefix via `getSpacingClass`.
126
-
127
- ## Related Components / Links
128
-
129
- - Container (layout and spacing around the stepper)
130
- - Typography (headings above or near the stepper)
131
- - Icon (used internally for the done icon on completed steps)
package/docs/Table.md DELETED
@@ -1,194 +0,0 @@
1
- # Table Component
2
-
3
- Purpose: Displays structured data in a table with configurable columns, optional built-in pagination, and a responsive mobile view. Each row is an object; column `id` values match row keys for default cell rendering. Use `customRender` per column for badges, buttons, or custom content. When viewport is under 768px and `mobileColumns` is set, rows are shown as MediaObject cards instead of a table. Optional `onRowClick(rowData)` for clickable rows.
4
-
5
- ## Props / Inputs
6
-
7
- | Prop | Type | Required | Default | Description |
8
- | --- | --- | --- | --- | --- |
9
- | columns | TableColumn[] | yes | — | Column definitions (id, title, textAlign?, widthPercentage?, customRender?). |
10
- | data | TableRow[] | yes | — | Array of row objects; keys should match column `id`s. |
11
- | variant | "default" \| "compact" | no | "default" | Visual variant. |
12
- | margin | string \| SpacingOption[] | no | "0" | Margin spacing. Suffix or array of spacing suffixes; component adds `m-` prefix. |
13
- | className | string | no | "" | Additional class names for the root element. |
14
- | onRowClick | (rowData: TableRow) => void | no | — | Called when a row is clicked; receives the row object. |
15
- | totalItems | number | no | 0 | Total item count for built-in Pagination; 0 or omitted hides pagination. |
16
- | totalLabel | string | no | "Items" | Label for the pagination total (e.g. "Items"). |
17
- | currentPage | number | no | 1 | Current 1-based page (controlled). |
18
- | rowsPerPage | number | no | 10 | Rows per page. |
19
- | rowsPerPageOptions | PaginationRowsPerPageOption[] | no | — | Options for rows-per-page select (same shape as Pagination). |
20
- | onPageChange | (page, rowsPerPage) => void | no | — | Called when page changes; receives (page, rowsPerPage). |
21
- | onRowsPerPageChange | (rowsPerPage: number) => void | no | — | Called when rows per page changes. |
22
- | hidePagination | boolean | no | false | If true, hides the built-in pagination bar even when totalItems > 0. |
23
- | mobileColumns | TableMobileColumns \| null | no | null | When set and viewport < 768px, rows render as MediaObjects; keys map row keys to title, description, media. |
24
-
25
- ## Types
26
-
27
- ### SpacingOption
28
- ```typescript
29
- type SpacingOption = (typeof SPACING_OPTIONS)[number];
30
- ```
31
-
32
- ### TableVariant
33
- ```typescript
34
- type TableVariant = "default" | "compact";
35
- ```
36
-
37
- ### TableMargin
38
- ```typescript
39
- type TableMargin = string | SpacingOption[];
40
- ```
41
-
42
- ### TableColumnTextAlign
43
- ```typescript
44
- type TableColumnTextAlign = "left" | "center" | "right";
45
- ```
46
-
47
- ### TableRow
48
- ```typescript
49
- type TableRow = Record<string, unknown>;
50
- ```
51
-
52
- ### TableColumn
53
- ```typescript
54
- interface TableColumn {
55
- id: string;
56
- title: string;
57
- textAlign?: TableColumnTextAlign;
58
- customRender?: (rowData: TableRow, column: TableColumn) => React.ReactNode;
59
- widthPercentage?: string;
60
- }
61
- ```
62
-
63
- ### TableMobileColumns
64
- ```typescript
65
- interface TableMobileColumns {
66
- title: string; // row key for MediaObject title
67
- description?: string; // row key for description
68
- mediaAvatar?: string; // row key for avatar value
69
- mediaIcon?: string; // static icon name for all rows
70
- mediaImage?: string; // static image URL
71
- className?: string;
72
- margin?: TableMargin;
73
- padding?: string | SpacingOption[];
74
- }
75
- ```
76
-
77
- ### TableProps
78
- ```typescript
79
- interface TableProps {
80
- variant?: TableVariant;
81
- margin?: TableMargin;
82
- className?: string;
83
- columns: TableColumn[];
84
- data: TableRow[];
85
- onRowClick?: (rowData: TableRow) => void;
86
- totalItems?: number;
87
- totalLabel?: string;
88
- currentPage?: number;
89
- rowsPerPage?: number;
90
- rowsPerPageOptions?: PaginationRowsPerPageOption[];
91
- onPageChange?: (page: number, rowsPerPage: number) => void;
92
- onRowsPerPageChange?: (rowsPerPage: number) => void;
93
- hidePagination?: boolean;
94
- mobileColumns?: TableMobileColumns | null;
95
- }
96
- ```
97
-
98
- ## Usage Examples
99
-
100
- ### Basic
101
-
102
- ```jsx
103
- import { Table } from "cleanplate";
104
-
105
- const columns = [
106
- { id: "name", title: "Name" },
107
- { id: "email", title: "Email" },
108
- ];
109
-
110
- const data = [
111
- { name: "John Doe", email: "john@doe.com" },
112
- { name: "Jane Doe", email: "jane@doe.com" },
113
- ];
114
-
115
- <Table columns={columns} data={data} />
116
- ```
117
-
118
- ### With pagination
119
-
120
- ```jsx
121
- import { Table } from "cleanplate";
122
- import { useState } from "react";
123
-
124
- const [currentPage, setCurrentPage] = useState(1);
125
- const [rowsPerPage, setRowsPerPage] = useState(10);
126
-
127
- <Table
128
- columns={columns}
129
- data={data}
130
- totalItems={100}
131
- currentPage={currentPage}
132
- rowsPerPage={rowsPerPage}
133
- onPageChange={(page) => setCurrentPage(page)}
134
- onRowsPerPageChange={(rpp) => {
135
- setRowsPerPage(rpp);
136
- setCurrentPage(1);
137
- }}
138
- />
139
- ```
140
-
141
- ### Custom cell (customRender)
142
-
143
- ```jsx
144
- const columns = [
145
- { id: "name", title: "Name", widthPercentage: "50%" },
146
- {
147
- id: "status",
148
- title: "Status",
149
- textAlign: "right",
150
- customRender: (rowData, column) => (
151
- <Badge label={String(rowData.status)} variant="success" />
152
- ),
153
- },
154
- ];
155
- <Table columns={columns} data={data} />;
156
- ```
157
-
158
- ### Mobile view (mobileColumns)
159
-
160
- ```jsx
161
- <Table
162
- columns={columns}
163
- data={data}
164
- mobileColumns={{
165
- title: "name",
166
- description: "email",
167
- mediaAvatar: "avatarUrl",
168
- }}
169
- />
170
- ```
171
-
172
- ### Row click
173
-
174
- ```jsx
175
- <Table
176
- columns={columns}
177
- data={data}
178
- onRowClick={(rowData) => console.log(rowData)}
179
- />
180
- ```
181
-
182
- ## Behavior Notes
183
-
184
- - **Required:** `columns` and `data` are required. Each column must have `id` and `title`; row keys should match `id` for default cell display.
185
- - **Pagination:** Built-in Pagination is shown when `totalItems` > 0 and `hidePagination` is false. Pass `onPageChange` and optionally `onRowsPerPageChange`; keep `currentPage` and `rowsPerPage` in parent state.
186
- - **Mobile:** When viewport width < 768px and `mobileColumns` is set, the table is replaced by a list of MediaObject items; `title` (and optionally `description`, `mediaAvatar`) are row keys whose values are passed to MediaObject.
187
- - **customRender:** Receives `(rowData, column)` and returns a React node; use for badges, buttons, or any custom cell content.
188
- - **Spacing:** `margin` uses the suffix API; the component adds the `m-` prefix via `getSpacingClass`.
189
-
190
- ## Related Components / Links
191
-
192
- - Pagination (used inside Table when totalItems > 0 and hidePagination is false; same props as standalone Pagination)
193
- - MediaObject (used for mobile view when mobileColumns is set)
194
- - Typography, Container (used for headers and cells; Container often used in customRender with Badge)
@@ -1,226 +0,0 @@
1
- # Typography Component
2
-
3
- Purpose: Provides a consistent set of text styles for headings, paragraphs, and inline elements, ensuring clear hierarchy, readability, and brand-aligned communication across the interface.
4
-
5
- ## Props / Inputs
6
-
7
- | Prop | Type | Required | Default | Description |
8
- | --- | --- | --- | --- | --- |
9
- | children | React.ReactNode | no | — | Text content to display. |
10
- | variant | "h1" \| "h2" \| "h3" \| "h4" \| "h5" \| "h6" \| "p" \| "span" \| "small" | no | "p" | HTML element type to render. Determines the semantic meaning and default styling. |
11
- | margin | string \| string[] | no | "m-0" | Spacing utility token(s), such as `m-0` or `["m-1", "m-b-2"]`. |
12
- | className | string | no | "" | Additional class names for the root element. |
13
- | isBold | boolean | no | false | Applies bold font weight to the text. |
14
- | align | "left" \| "center" \| "right" | no | "left" | Text alignment within its container. |
15
- | wordBreak | "normal" \| "all" \| "wrap" | no | "normal" | Controls how words break when text overflows. |
16
- | ...rest | any | no | — | All other standard HTML attributes are supported and passed through to the rendered element. |
17
-
18
- ## Types
19
-
20
- ### TypographyVariant
21
- ```typescript
22
- type TypographyVariant = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "small";
23
- ```
24
-
25
- ### TypographyAlign
26
- ```typescript
27
- type TypographyAlign = "left" | "right" | "center";
28
- ```
29
-
30
- ### TypographyWordBreak
31
- ```typescript
32
- type TypographyWordBreak = "normal" | "all" | "wrap";
33
- ```
34
-
35
- ### TypographyMargin
36
- ```typescript
37
- type TypographyMargin = string | SpacingOption[];
38
- ```
39
-
40
- ### SpacingOption
41
- ```typescript
42
- type SpacingOption = typeof SPACING_OPTIONS[number];
43
- ```
44
-
45
- ### TypographyProps
46
- ```typescript
47
- interface TypographyProps {
48
- children?: React.ReactNode;
49
- variant?: TypographyVariant;
50
- margin?: TypographyMargin;
51
- className?: string;
52
- isBold?: boolean;
53
- align?: TypographyAlign;
54
- wordBreak?: TypographyWordBreak;
55
- [key: string]: any; // Allow other HTML attributes to be passed through
56
- }
57
- ```
58
-
59
- ## Usage Examples
60
-
61
- ### Headings
62
-
63
- ```jsx
64
- import { Typography } from "cleanplate";
65
-
66
- export const Example = () => (
67
- <>
68
- <Typography variant="h1">Heading 1</Typography>
69
- <Typography variant="h2">Heading 2</Typography>
70
- <Typography variant="h3">Heading 3</Typography>
71
- <Typography variant="h4">Heading 4</Typography>
72
- <Typography variant="h5">Heading 5</Typography>
73
- <Typography variant="h6">Heading 6</Typography>
74
- </>
75
- );
76
- ```
77
-
78
- ### Paragraph (default)
79
-
80
- ```jsx
81
- import { Typography } from "cleanplate";
82
-
83
- export const Example = () => (
84
- <Typography>
85
- This is a paragraph. When no variant is specified, it defaults to a paragraph element.
86
- </Typography>
87
- );
88
- ```
89
-
90
- ### Small text
91
-
92
- ```jsx
93
- import { Typography } from "cleanplate";
94
-
95
- export const Example = () => (
96
- <Typography variant="small">
97
- This is small text, typically used for captions or fine print.
98
- </Typography>
99
- );
100
- ```
101
-
102
- ### Inline span
103
-
104
- ```jsx
105
- import { Typography } from "cleanplate";
106
-
107
- export const Example = () => (
108
- <Typography variant="span">
109
- This text is rendered as an inline span element.
110
- </Typography>
111
- );
112
- ```
113
-
114
- ### Text alignment
115
-
116
- ```jsx
117
- import { Typography } from "cleanplate";
118
-
119
- export const Example = () => (
120
- <>
121
- <Typography align="left">Left aligned text</Typography>
122
- <Typography align="center">Center aligned text</Typography>
123
- <Typography align="right">Right aligned text</Typography>
124
- </>
125
- );
126
- ```
127
-
128
- ### Bold text
129
-
130
- ```jsx
131
- import { Typography } from "cleanplate";
132
-
133
- export const Example = () => (
134
- <>
135
- <Typography>Normal weight text</Typography>
136
- <Typography isBold>Bold text</Typography>
137
- </>
138
- );
139
- ```
140
-
141
- ### Word breaking
142
-
143
- ```jsx
144
- import { Typography } from "cleanplate";
145
-
146
- export const Example = () => (
147
- <>
148
- <Typography wordBreak="normal">
149
- Normal word breaking behavior
150
- </Typography>
151
- <Typography wordBreak="all">
152
- Break words at any point if needed
153
- </Typography>
154
- <Typography wordBreak="wrap">
155
- Wrap text with word breaking
156
- </Typography>
157
- </>
158
- );
159
- ```
160
-
161
- ### With margin spacing
162
-
163
- ```jsx
164
- import { Typography } from "cleanplate";
165
-
166
- export const Example = () => (
167
- <>
168
- <Typography variant="h1" margin="m-2">
169
- Heading with margin
170
- </Typography>
171
- <Typography margin={["m-1", "m-b-3"]}>
172
- Paragraph with multiple margins
173
- </Typography>
174
- </>
175
- );
176
- ```
177
-
178
- ### Combined properties
179
-
180
- ```jsx
181
- import { Typography } from "cleanplate";
182
-
183
- export const Example = () => (
184
- <Typography
185
- variant="h2"
186
- isBold
187
- align="center"
188
- margin="m-4"
189
- >
190
- Centered, bold heading with margin
191
- </Typography>
192
- );
193
- ```
194
-
195
- ### With HTML attributes
196
-
197
- ```jsx
198
- import { Typography } from "cleanplate";
199
-
200
- export const Example = () => (
201
- <Typography
202
- variant="p"
203
- id="description"
204
- data-testid="typography-description"
205
- aria-label="Product description"
206
- >
207
- This paragraph has additional HTML attributes.
208
- </Typography>
209
- );
210
- ```
211
-
212
- ## Behavior Notes
213
-
214
- - When no `variant` is specified, the component defaults to rendering a `<p>` (paragraph) element.
215
- - The `variant` prop determines both the HTML element type (h1, h2, p, etc.) and the default styling applied.
216
- - The component uses semantic HTML elements, which is important for accessibility and SEO.
217
- - All standard HTML attributes can be passed through via the spread operator (`...rest`), allowing for custom `id`, `data-*`, `aria-*`, and other attributes.
218
- - The `align` prop controls text alignment using CSS classes, not inline styles.
219
- - The `wordBreak` prop provides control over how text wraps when it exceeds container width.
220
- - Margin spacing accepts either a single string token (e.g., `"m-2"`) or an array of tokens (e.g., `["m-1", "m-b-3"]`).
221
- - The `isBold` prop applies bold font weight, which can be combined with any variant.
222
-
223
- ## Related Components / Links
224
-
225
- - Container (often used to wrap typography content)
226
- - MediaObject (commonly uses Typography for text content)