@windstream/react-shared-components 0.0.9 → 0.0.11
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.
- package/README.md +623 -623
- package/dist/contentful/index.d.ts +10 -6
- package/dist/contentful/index.esm.js +1 -1
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +1 -1
- package/dist/contentful/index.js.map +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +159 -159
- package/src/components/accordion/Accordion.stories.tsx +225 -225
- package/src/components/accordion/index.tsx +36 -36
- package/src/components/accordion/types.ts +9 -9
- package/src/components/alert-card/types.ts +9 -9
- package/src/components/brand-button/BrandButton.stories.tsx +221 -221
- package/src/components/brand-button/helpers.ts +35 -35
- package/src/components/brand-button/index.tsx +90 -90
- package/src/components/brand-button/types.ts +26 -26
- package/src/components/button/Button.stories.tsx +108 -108
- package/src/components/button/index.tsx +23 -23
- package/src/components/button/types.ts +14 -14
- package/src/components/call-button/CallButton.stories.tsx +324 -324
- package/src/components/call-button/index.tsx +80 -80
- package/src/components/call-button/types.ts +9 -9
- package/src/components/checkbox/Checkbox.stories.tsx +248 -248
- package/src/components/checkbox/types.ts +23 -23
- package/src/components/checklist/Checklist.stories.tsx +151 -151
- package/src/components/checklist/index.tsx +33 -33
- package/src/components/checklist/types.ts +5 -5
- package/src/components/collapse/Collapse.stories.tsx +256 -256
- package/src/components/collapse/index.tsx +44 -44
- package/src/components/collapse/types.ts +5 -5
- package/src/components/divider/Divider.stories.tsx +206 -206
- package/src/components/divider/index.tsx +23 -23
- package/src/components/divider/type.ts +2 -2
- package/src/components/input/Input.stories.tsx +358 -358
- package/src/components/input/index.tsx +174 -174
- package/src/components/input/types.ts +36 -36
- package/src/components/link/Link.stories.tsx +163 -163
- package/src/components/link/index.tsx +96 -96
- package/src/components/link/types.ts +25 -25
- package/src/components/list/List.stories.tsx +272 -272
- package/src/components/list/index.tsx +86 -86
- package/src/components/list/list-item/index.tsx +36 -36
- package/src/components/list/list-item/types.ts +13 -13
- package/src/components/list/types.ts +29 -29
- package/src/components/material-icon/MaterialIcon.stories.tsx +330 -330
- package/src/components/material-icon/constants.ts +95 -95
- package/src/components/material-icon/index.tsx +44 -44
- package/src/components/material-icon/types.ts +31 -31
- package/src/components/modal/Modal.stories.tsx +171 -171
- package/src/components/modal/index.tsx +168 -168
- package/src/components/modal/types.ts +23 -23
- package/src/components/radio-button/index.tsx +73 -73
- package/src/components/radio-button/types.ts +21 -21
- package/src/components/see-more/SeeMore.stories.tsx +182 -182
- package/src/components/see-more/index.tsx +38 -38
- package/src/components/see-more/types.ts +3 -3
- package/src/components/select/Select.stories.tsx +410 -410
- package/src/components/select/index.tsx +150 -150
- package/src/components/select/types.ts +34 -34
- package/src/components/select-plan-button/SelectPlanButton.stories.tsx +160 -160
- package/src/components/select-plan-button/index.tsx +20 -20
- package/src/components/select-plan-button/types.ts +3 -3
- package/src/components/skeleton/Skeleton.stories.tsx +180 -180
- package/src/components/skeleton/index.tsx +61 -61
- package/src/components/skeleton/types.ts +3 -3
- package/src/components/spinner/Spinner.stories.tsx +335 -335
- package/src/components/spinner/index.tsx +44 -44
- package/src/components/spinner/types.ts +4 -4
- package/src/components/text/Text.stories.tsx +302 -302
- package/src/components/text/index.tsx +26 -26
- package/src/components/text/types.ts +45 -45
- package/src/components/tooltip/Tooltip.stories.tsx +220 -220
- package/src/components/tooltip/index.tsx +78 -78
- package/src/components/tooltip/types.ts +6 -6
- package/src/components/view-cart-button/ViewCartButton.stories.tsx +241 -241
- package/src/components/view-cart-button/index.tsx +38 -38
- package/src/components/view-cart-button/types.ts +4 -4
- package/src/contentful/blocks/accordion/index.tsx +7 -7
- package/src/contentful/blocks/button/index.tsx +5 -5
- package/src/contentful/blocks/callout/index.tsx +7 -7
- package/src/contentful/blocks/cards/index.tsx +7 -7
- package/src/contentful/blocks/carousel/index.tsx +7 -7
- package/src/contentful/blocks/cta-callout/index.tsx +6 -0
- package/src/contentful/blocks/cta-callout/types.ts +1 -0
- package/src/contentful/blocks/floating-banner/index.tsx +7 -7
- package/src/contentful/blocks/footer/index.tsx +7 -7
- package/src/contentful/blocks/image-promo-bar/index.tsx +7 -7
- package/src/contentful/blocks/modal/index.tsx +5 -5
- package/src/contentful/blocks/navigation/index.tsx +7 -7
- package/src/contentful/blocks/primary-hero/index.tsx +7 -7
- package/src/contentful/blocks/shape-background-wrapper/index.tsx +123 -101
- package/src/contentful/blocks/shape-background-wrapper/types.ts +35 -29
- package/src/contentful/blocks/text/index.tsx +6 -6
- package/src/contentful/index.ts +4 -1
- package/src/hooks/use-body-scroll-lock.ts +31 -31
- package/src/index.ts +81 -81
- package/src/setupTests.ts +46 -46
- package/src/styles/globals.css +275 -269
- package/src/types/global.d.ts +9 -9
- package/src/utils/index.ts +49 -49
|
@@ -1,302 +1,302 @@
|
|
|
1
|
-
import { Text } from "./index";
|
|
2
|
-
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
3
|
-
|
|
4
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Text> = {
|
|
7
|
-
title: "Components/Text",
|
|
8
|
-
component: Text,
|
|
9
|
-
tags: ["autodocs"],
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: "centered",
|
|
12
|
-
docs: {
|
|
13
|
-
page: DocsPage,
|
|
14
|
-
description: {
|
|
15
|
-
component:
|
|
16
|
-
"A flexible text component with multiple typography variants and semantic elements.",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
argTypes: {
|
|
21
|
-
as: {
|
|
22
|
-
control: { type: "select" },
|
|
23
|
-
options: [
|
|
24
|
-
"h1",
|
|
25
|
-
"h2",
|
|
26
|
-
"h3",
|
|
27
|
-
"h4",
|
|
28
|
-
"h5",
|
|
29
|
-
"h6",
|
|
30
|
-
"p",
|
|
31
|
-
"span",
|
|
32
|
-
"div",
|
|
33
|
-
"label",
|
|
34
|
-
],
|
|
35
|
-
description: "HTML element to render",
|
|
36
|
-
},
|
|
37
|
-
className: {
|
|
38
|
-
control: { type: "text" },
|
|
39
|
-
description: "Additional CSS classes (use typography classes like body1, heading1, etc.)",
|
|
40
|
-
},
|
|
41
|
-
children: {
|
|
42
|
-
control: { type: "text" },
|
|
43
|
-
description: "Text content",
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
args: {
|
|
47
|
-
children: "Sample text content",
|
|
48
|
-
className: "body1",
|
|
49
|
-
as: "p",
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export default meta;
|
|
54
|
-
type Story = StoryObj<typeof meta>;
|
|
55
|
-
|
|
56
|
-
// Default text
|
|
57
|
-
export const Default: Story = {
|
|
58
|
-
args: {},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// Headings
|
|
62
|
-
export const Headings: Story = {
|
|
63
|
-
render: () => (
|
|
64
|
-
<div className="space-y-4">
|
|
65
|
-
<Text as="h1" className="heading1">
|
|
66
|
-
Heading 1
|
|
67
|
-
</Text>
|
|
68
|
-
<Text as="h2" className="heading2">
|
|
69
|
-
Heading 2
|
|
70
|
-
</Text>
|
|
71
|
-
<Text as="h3" className="heading3">
|
|
72
|
-
Heading 3
|
|
73
|
-
</Text>
|
|
74
|
-
<Text as="h4" className="heading4">
|
|
75
|
-
Heading 4
|
|
76
|
-
</Text>
|
|
77
|
-
<Text as="h5" className="heading5">
|
|
78
|
-
Heading 5
|
|
79
|
-
</Text>
|
|
80
|
-
<Text as="h6" className="heading6">
|
|
81
|
-
Heading 6
|
|
82
|
-
</Text>
|
|
83
|
-
</div>
|
|
84
|
-
),
|
|
85
|
-
parameters: {
|
|
86
|
-
docs: {
|
|
87
|
-
description: {
|
|
88
|
-
story: "All heading variants with appropriate semantic HTML elements.",
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
// Subheadings
|
|
95
|
-
export const Subheadings: Story = {
|
|
96
|
-
render: () => (
|
|
97
|
-
<div className="space-y-4">
|
|
98
|
-
<Text className="subheading1">Subheading 1</Text>
|
|
99
|
-
<Text className="subheading2">Subheading 2</Text>
|
|
100
|
-
<Text className="subheading3">Subheading 3</Text>
|
|
101
|
-
</div>
|
|
102
|
-
),
|
|
103
|
-
parameters: {
|
|
104
|
-
docs: {
|
|
105
|
-
description: {
|
|
106
|
-
story: "All subheading variants.",
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
// Body text
|
|
113
|
-
export const BodyText: Story = {
|
|
114
|
-
render: () => (
|
|
115
|
-
<div className="space-y-4">
|
|
116
|
-
<Text className="body1">
|
|
117
|
-
Body 1 text is used for the main content of your application. It
|
|
118
|
-
provides good readability and is suitable for paragraphs and longer text
|
|
119
|
-
content.
|
|
120
|
-
</Text>
|
|
121
|
-
<Text className="body2">
|
|
122
|
-
Body 2 text is slightly smaller and can be used for secondary content,
|
|
123
|
-
descriptions, or supporting text that doesn't need as much emphasis.
|
|
124
|
-
</Text>
|
|
125
|
-
<Text className="body3">
|
|
126
|
-
Body 3 text is the smallest body variant, perfect for fine print,
|
|
127
|
-
captions, or less important information.
|
|
128
|
-
</Text>
|
|
129
|
-
</div>
|
|
130
|
-
),
|
|
131
|
-
parameters: {
|
|
132
|
-
docs: {
|
|
133
|
-
description: {
|
|
134
|
-
story: "Body text variants for different content hierarchy levels.",
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
// Labels
|
|
141
|
-
export const Labels: Story = {
|
|
142
|
-
render: () => (
|
|
143
|
-
<div className="space-y-4">
|
|
144
|
-
<div>
|
|
145
|
-
<Text as="label" className="mb-2 block body1">
|
|
146
|
-
Label 1
|
|
147
|
-
</Text>
|
|
148
|
-
<input
|
|
149
|
-
type="text"
|
|
150
|
-
className="rounded border px-3 py-2"
|
|
151
|
-
placeholder="Input with label"
|
|
152
|
-
/>
|
|
153
|
-
</div>
|
|
154
|
-
<div>
|
|
155
|
-
<Text as="label" className="mb-2 block body2">
|
|
156
|
-
Label 2
|
|
157
|
-
</Text>
|
|
158
|
-
<input
|
|
159
|
-
type="text"
|
|
160
|
-
className="rounded border px-3 py-2"
|
|
161
|
-
placeholder="Input with label"
|
|
162
|
-
/>
|
|
163
|
-
</div>
|
|
164
|
-
<div>
|
|
165
|
-
<Text as="label" className="mb-2 block body3">
|
|
166
|
-
Label 3
|
|
167
|
-
</Text>
|
|
168
|
-
<input
|
|
169
|
-
type="text"
|
|
170
|
-
className="rounded border px-3 py-2"
|
|
171
|
-
placeholder="Input with label"
|
|
172
|
-
/>
|
|
173
|
-
</div>
|
|
174
|
-
<div>
|
|
175
|
-
<Text as="label" className="mb-2 block footnote">
|
|
176
|
-
Label 4
|
|
177
|
-
</Text>
|
|
178
|
-
<input
|
|
179
|
-
type="text"
|
|
180
|
-
className="rounded border px-3 py-2"
|
|
181
|
-
placeholder="Input with label"
|
|
182
|
-
/>
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
),
|
|
186
|
-
parameters: {
|
|
187
|
-
docs: {
|
|
188
|
-
description: {
|
|
189
|
-
story: "Label variants commonly used with form inputs.",
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
// Utility text
|
|
196
|
-
export const UtilityText: Story = {
|
|
197
|
-
render: () => (
|
|
198
|
-
<div className="space-y-4">
|
|
199
|
-
<Text className="footnote">
|
|
200
|
-
Footnote text is used for additional information, citations, or less
|
|
201
|
-
important details.
|
|
202
|
-
</Text>
|
|
203
|
-
<Text className="micro">
|
|
204
|
-
Micro text is the smallest text variant, perfect for timestamps, version
|
|
205
|
-
numbers, or other very small information.
|
|
206
|
-
</Text>
|
|
207
|
-
<Text className="unstyled">
|
|
208
|
-
Unstyled text inherits all styling from its parent element.
|
|
209
|
-
</Text>
|
|
210
|
-
</div>
|
|
211
|
-
),
|
|
212
|
-
parameters: {
|
|
213
|
-
docs: {
|
|
214
|
-
description: {
|
|
215
|
-
story: "Utility text variants for specific use cases.",
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
// Semantic elements
|
|
222
|
-
export const SemanticElements: Story = {
|
|
223
|
-
render: () => (
|
|
224
|
-
<div className="space-y-4">
|
|
225
|
-
<Text as="h1" className="heading1">
|
|
226
|
-
Main Page Title
|
|
227
|
-
</Text>
|
|
228
|
-
<Text as="h2" className="heading2">
|
|
229
|
-
Page Description
|
|
230
|
-
</Text>
|
|
231
|
-
<Text as="p" className="body1">
|
|
232
|
-
This is a paragraph element that provides the main content of the page.
|
|
233
|
-
It demonstrates how the Text component can be used with semantic HTML
|
|
234
|
-
elements.
|
|
235
|
-
</Text>
|
|
236
|
-
<Text as="label" className="block body1">
|
|
237
|
-
Form Label
|
|
238
|
-
</Text>
|
|
239
|
-
<Text as="span" className="footnote">
|
|
240
|
-
Additional information
|
|
241
|
-
</Text>
|
|
242
|
-
</div>
|
|
243
|
-
),
|
|
244
|
-
parameters: {
|
|
245
|
-
docs: {
|
|
246
|
-
description: {
|
|
247
|
-
story:
|
|
248
|
-
"Examples of using different semantic HTML elements with the Text component.",
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
// All variants showcase
|
|
255
|
-
export const AllVariants: Story = {
|
|
256
|
-
render: () => (
|
|
257
|
-
<div className="max-w-4xl space-y-6">
|
|
258
|
-
<div>
|
|
259
|
-
<h3 className="mb-3 text-lg font-semibold">Headings</h3>
|
|
260
|
-
<div className="space-y-2">
|
|
261
|
-
<Text as="h1" className="heading1">Heading 1</Text>
|
|
262
|
-
<Text as="h2" className="heading2">Heading 2</Text>
|
|
263
|
-
<Text as="h3" className="heading3">Heading 3</Text>
|
|
264
|
-
</div>
|
|
265
|
-
</div>
|
|
266
|
-
|
|
267
|
-
<div>
|
|
268
|
-
<h3 className="mb-3 text-lg font-semibold">Body Text</h3>
|
|
269
|
-
<div className="space-y-2">
|
|
270
|
-
<Text as="p" className="body1">Body 1 - Main content text</Text>
|
|
271
|
-
<Text as="p" className="body2">Body 2 - Secondary content text</Text>
|
|
272
|
-
<Text as="p" className="body3">Body 3 - Smaller content text</Text>
|
|
273
|
-
</div>
|
|
274
|
-
</div>
|
|
275
|
-
|
|
276
|
-
<div>
|
|
277
|
-
<h3 className="mb-3 text-lg font-semibold">Labels</h3>
|
|
278
|
-
<div className="space-y-2">
|
|
279
|
-
<Text as="label" className="body1">Label 1</Text>
|
|
280
|
-
<Text as="label" className="body2">Label 2</Text>
|
|
281
|
-
<Text as="label" className="body3">Label 3</Text>
|
|
282
|
-
<Text className="footnote">Label 4</Text>
|
|
283
|
-
</div>
|
|
284
|
-
</div>
|
|
285
|
-
|
|
286
|
-
<div>
|
|
287
|
-
<h3 className="mb-3 text-lg font-semibold">Utility</h3>
|
|
288
|
-
<div className="space-y-2">
|
|
289
|
-
<Text className="footnote">Footnote text</Text>
|
|
290
|
-
<Text className="micro">Micro text</Text>
|
|
291
|
-
</div>
|
|
292
|
-
</div>
|
|
293
|
-
</div>
|
|
294
|
-
),
|
|
295
|
-
parameters: {
|
|
296
|
-
docs: {
|
|
297
|
-
description: {
|
|
298
|
-
story: "Complete showcase of all text variants in organized sections.",
|
|
299
|
-
},
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
};
|
|
1
|
+
import { Text } from "./index";
|
|
2
|
+
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Text> = {
|
|
7
|
+
title: "Components/Text",
|
|
8
|
+
component: Text,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
docs: {
|
|
13
|
+
page: DocsPage,
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
"A flexible text component with multiple typography variants and semantic elements.",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
argTypes: {
|
|
21
|
+
as: {
|
|
22
|
+
control: { type: "select" },
|
|
23
|
+
options: [
|
|
24
|
+
"h1",
|
|
25
|
+
"h2",
|
|
26
|
+
"h3",
|
|
27
|
+
"h4",
|
|
28
|
+
"h5",
|
|
29
|
+
"h6",
|
|
30
|
+
"p",
|
|
31
|
+
"span",
|
|
32
|
+
"div",
|
|
33
|
+
"label",
|
|
34
|
+
],
|
|
35
|
+
description: "HTML element to render",
|
|
36
|
+
},
|
|
37
|
+
className: {
|
|
38
|
+
control: { type: "text" },
|
|
39
|
+
description: "Additional CSS classes (use typography classes like body1, heading1, etc.)",
|
|
40
|
+
},
|
|
41
|
+
children: {
|
|
42
|
+
control: { type: "text" },
|
|
43
|
+
description: "Text content",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
args: {
|
|
47
|
+
children: "Sample text content",
|
|
48
|
+
className: "body1",
|
|
49
|
+
as: "p",
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default meta;
|
|
54
|
+
type Story = StoryObj<typeof meta>;
|
|
55
|
+
|
|
56
|
+
// Default text
|
|
57
|
+
export const Default: Story = {
|
|
58
|
+
args: {},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Headings
|
|
62
|
+
export const Headings: Story = {
|
|
63
|
+
render: () => (
|
|
64
|
+
<div className="space-y-4">
|
|
65
|
+
<Text as="h1" className="heading1">
|
|
66
|
+
Heading 1
|
|
67
|
+
</Text>
|
|
68
|
+
<Text as="h2" className="heading2">
|
|
69
|
+
Heading 2
|
|
70
|
+
</Text>
|
|
71
|
+
<Text as="h3" className="heading3">
|
|
72
|
+
Heading 3
|
|
73
|
+
</Text>
|
|
74
|
+
<Text as="h4" className="heading4">
|
|
75
|
+
Heading 4
|
|
76
|
+
</Text>
|
|
77
|
+
<Text as="h5" className="heading5">
|
|
78
|
+
Heading 5
|
|
79
|
+
</Text>
|
|
80
|
+
<Text as="h6" className="heading6">
|
|
81
|
+
Heading 6
|
|
82
|
+
</Text>
|
|
83
|
+
</div>
|
|
84
|
+
),
|
|
85
|
+
parameters: {
|
|
86
|
+
docs: {
|
|
87
|
+
description: {
|
|
88
|
+
story: "All heading variants with appropriate semantic HTML elements.",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Subheadings
|
|
95
|
+
export const Subheadings: Story = {
|
|
96
|
+
render: () => (
|
|
97
|
+
<div className="space-y-4">
|
|
98
|
+
<Text className="subheading1">Subheading 1</Text>
|
|
99
|
+
<Text className="subheading2">Subheading 2</Text>
|
|
100
|
+
<Text className="subheading3">Subheading 3</Text>
|
|
101
|
+
</div>
|
|
102
|
+
),
|
|
103
|
+
parameters: {
|
|
104
|
+
docs: {
|
|
105
|
+
description: {
|
|
106
|
+
story: "All subheading variants.",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// Body text
|
|
113
|
+
export const BodyText: Story = {
|
|
114
|
+
render: () => (
|
|
115
|
+
<div className="space-y-4">
|
|
116
|
+
<Text className="body1">
|
|
117
|
+
Body 1 text is used for the main content of your application. It
|
|
118
|
+
provides good readability and is suitable for paragraphs and longer text
|
|
119
|
+
content.
|
|
120
|
+
</Text>
|
|
121
|
+
<Text className="body2">
|
|
122
|
+
Body 2 text is slightly smaller and can be used for secondary content,
|
|
123
|
+
descriptions, or supporting text that doesn't need as much emphasis.
|
|
124
|
+
</Text>
|
|
125
|
+
<Text className="body3">
|
|
126
|
+
Body 3 text is the smallest body variant, perfect for fine print,
|
|
127
|
+
captions, or less important information.
|
|
128
|
+
</Text>
|
|
129
|
+
</div>
|
|
130
|
+
),
|
|
131
|
+
parameters: {
|
|
132
|
+
docs: {
|
|
133
|
+
description: {
|
|
134
|
+
story: "Body text variants for different content hierarchy levels.",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// Labels
|
|
141
|
+
export const Labels: Story = {
|
|
142
|
+
render: () => (
|
|
143
|
+
<div className="space-y-4">
|
|
144
|
+
<div>
|
|
145
|
+
<Text as="label" className="mb-2 block body1">
|
|
146
|
+
Label 1
|
|
147
|
+
</Text>
|
|
148
|
+
<input
|
|
149
|
+
type="text"
|
|
150
|
+
className="rounded border px-3 py-2"
|
|
151
|
+
placeholder="Input with label"
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
<div>
|
|
155
|
+
<Text as="label" className="mb-2 block body2">
|
|
156
|
+
Label 2
|
|
157
|
+
</Text>
|
|
158
|
+
<input
|
|
159
|
+
type="text"
|
|
160
|
+
className="rounded border px-3 py-2"
|
|
161
|
+
placeholder="Input with label"
|
|
162
|
+
/>
|
|
163
|
+
</div>
|
|
164
|
+
<div>
|
|
165
|
+
<Text as="label" className="mb-2 block body3">
|
|
166
|
+
Label 3
|
|
167
|
+
</Text>
|
|
168
|
+
<input
|
|
169
|
+
type="text"
|
|
170
|
+
className="rounded border px-3 py-2"
|
|
171
|
+
placeholder="Input with label"
|
|
172
|
+
/>
|
|
173
|
+
</div>
|
|
174
|
+
<div>
|
|
175
|
+
<Text as="label" className="mb-2 block footnote">
|
|
176
|
+
Label 4
|
|
177
|
+
</Text>
|
|
178
|
+
<input
|
|
179
|
+
type="text"
|
|
180
|
+
className="rounded border px-3 py-2"
|
|
181
|
+
placeholder="Input with label"
|
|
182
|
+
/>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
),
|
|
186
|
+
parameters: {
|
|
187
|
+
docs: {
|
|
188
|
+
description: {
|
|
189
|
+
story: "Label variants commonly used with form inputs.",
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// Utility text
|
|
196
|
+
export const UtilityText: Story = {
|
|
197
|
+
render: () => (
|
|
198
|
+
<div className="space-y-4">
|
|
199
|
+
<Text className="footnote">
|
|
200
|
+
Footnote text is used for additional information, citations, or less
|
|
201
|
+
important details.
|
|
202
|
+
</Text>
|
|
203
|
+
<Text className="micro">
|
|
204
|
+
Micro text is the smallest text variant, perfect for timestamps, version
|
|
205
|
+
numbers, or other very small information.
|
|
206
|
+
</Text>
|
|
207
|
+
<Text className="unstyled">
|
|
208
|
+
Unstyled text inherits all styling from its parent element.
|
|
209
|
+
</Text>
|
|
210
|
+
</div>
|
|
211
|
+
),
|
|
212
|
+
parameters: {
|
|
213
|
+
docs: {
|
|
214
|
+
description: {
|
|
215
|
+
story: "Utility text variants for specific use cases.",
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
// Semantic elements
|
|
222
|
+
export const SemanticElements: Story = {
|
|
223
|
+
render: () => (
|
|
224
|
+
<div className="space-y-4">
|
|
225
|
+
<Text as="h1" className="heading1">
|
|
226
|
+
Main Page Title
|
|
227
|
+
</Text>
|
|
228
|
+
<Text as="h2" className="heading2">
|
|
229
|
+
Page Description
|
|
230
|
+
</Text>
|
|
231
|
+
<Text as="p" className="body1">
|
|
232
|
+
This is a paragraph element that provides the main content of the page.
|
|
233
|
+
It demonstrates how the Text component can be used with semantic HTML
|
|
234
|
+
elements.
|
|
235
|
+
</Text>
|
|
236
|
+
<Text as="label" className="block body1">
|
|
237
|
+
Form Label
|
|
238
|
+
</Text>
|
|
239
|
+
<Text as="span" className="footnote">
|
|
240
|
+
Additional information
|
|
241
|
+
</Text>
|
|
242
|
+
</div>
|
|
243
|
+
),
|
|
244
|
+
parameters: {
|
|
245
|
+
docs: {
|
|
246
|
+
description: {
|
|
247
|
+
story:
|
|
248
|
+
"Examples of using different semantic HTML elements with the Text component.",
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// All variants showcase
|
|
255
|
+
export const AllVariants: Story = {
|
|
256
|
+
render: () => (
|
|
257
|
+
<div className="max-w-4xl space-y-6">
|
|
258
|
+
<div>
|
|
259
|
+
<h3 className="mb-3 text-lg font-semibold">Headings</h3>
|
|
260
|
+
<div className="space-y-2">
|
|
261
|
+
<Text as="h1" className="heading1">Heading 1</Text>
|
|
262
|
+
<Text as="h2" className="heading2">Heading 2</Text>
|
|
263
|
+
<Text as="h3" className="heading3">Heading 3</Text>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<div>
|
|
268
|
+
<h3 className="mb-3 text-lg font-semibold">Body Text</h3>
|
|
269
|
+
<div className="space-y-2">
|
|
270
|
+
<Text as="p" className="body1">Body 1 - Main content text</Text>
|
|
271
|
+
<Text as="p" className="body2">Body 2 - Secondary content text</Text>
|
|
272
|
+
<Text as="p" className="body3">Body 3 - Smaller content text</Text>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
<div>
|
|
277
|
+
<h3 className="mb-3 text-lg font-semibold">Labels</h3>
|
|
278
|
+
<div className="space-y-2">
|
|
279
|
+
<Text as="label" className="body1">Label 1</Text>
|
|
280
|
+
<Text as="label" className="body2">Label 2</Text>
|
|
281
|
+
<Text as="label" className="body3">Label 3</Text>
|
|
282
|
+
<Text className="footnote">Label 4</Text>
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
<div>
|
|
287
|
+
<h3 className="mb-3 text-lg font-semibold">Utility</h3>
|
|
288
|
+
<div className="space-y-2">
|
|
289
|
+
<Text className="footnote">Footnote text</Text>
|
|
290
|
+
<Text className="micro">Micro text</Text>
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
),
|
|
295
|
+
parameters: {
|
|
296
|
+
docs: {
|
|
297
|
+
description: {
|
|
298
|
+
story: "Complete showcase of all text variants in organized sections.",
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
|
-
import { TextProps, TextVariant } from "./types";
|
|
3
|
-
|
|
4
|
-
export const Text = forwardRef<HTMLElement, TextProps>(
|
|
5
|
-
(
|
|
6
|
-
{ children, as, className = "", style, ...props },
|
|
7
|
-
ref
|
|
8
|
-
) => {
|
|
9
|
-
const elementType = as || 'p';
|
|
10
|
-
|
|
11
|
-
return React.createElement(
|
|
12
|
-
elementType,
|
|
13
|
-
{
|
|
14
|
-
ref,
|
|
15
|
-
className,
|
|
16
|
-
style,
|
|
17
|
-
...props,
|
|
18
|
-
},
|
|
19
|
-
children
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
Text.displayName = "Text";
|
|
25
|
-
|
|
26
|
-
export type { TextProps, TextVariant };
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { TextProps, TextVariant } from "./types";
|
|
3
|
+
|
|
4
|
+
export const Text = forwardRef<HTMLElement, TextProps>(
|
|
5
|
+
(
|
|
6
|
+
{ children, as, className = "", style, ...props },
|
|
7
|
+
ref
|
|
8
|
+
) => {
|
|
9
|
+
const elementType = as || 'p';
|
|
10
|
+
|
|
11
|
+
return React.createElement(
|
|
12
|
+
elementType,
|
|
13
|
+
{
|
|
14
|
+
ref,
|
|
15
|
+
className,
|
|
16
|
+
style,
|
|
17
|
+
...props,
|
|
18
|
+
},
|
|
19
|
+
children
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
Text.displayName = "Text";
|
|
25
|
+
|
|
26
|
+
export type { TextProps, TextVariant };
|