storybook-addon-design-system-docs 1.0.0 → 1.0.2

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 (41) hide show
  1. package/README.md +143 -15
  2. package/dist/TypographySection-D8HHJr-s.d.ts +258 -0
  3. package/dist/TypographySection-DsqZs5oA.d.cts +258 -0
  4. package/dist/TypographySection-c6k_4ZVC.d.ts +258 -0
  5. package/dist/TypographySection-lyEjSYKu.d.cts +258 -0
  6. package/dist/assets.cjs +9 -0
  7. package/dist/assets.cjs.map +1 -0
  8. package/dist/assets.d.cts +28 -0
  9. package/dist/assets.d.ts +28 -0
  10. package/dist/assets.js +7 -0
  11. package/dist/assets.js.map +1 -0
  12. package/dist/components/assets/index.cjs +634 -0
  13. package/dist/components/assets/index.cjs.map +1 -0
  14. package/dist/components/assets/index.d.cts +150 -0
  15. package/dist/components/assets/index.d.ts +150 -0
  16. package/dist/components/assets/index.js +604 -0
  17. package/dist/components/assets/index.js.map +1 -0
  18. package/dist/components/primitives/index.cjs +963 -0
  19. package/dist/components/primitives/index.cjs.map +1 -0
  20. package/dist/components/primitives/index.d.cts +194 -0
  21. package/dist/components/primitives/index.d.ts +194 -0
  22. package/dist/components/primitives/index.js +905 -0
  23. package/dist/components/primitives/index.js.map +1 -0
  24. package/dist/index.cjs +8695 -0
  25. package/dist/index.cjs.map +1 -0
  26. package/dist/index.d.cts +136 -0
  27. package/dist/index.d.ts +136 -0
  28. package/dist/index.js +8639 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/jsx-runtime.d-kG9JzmQF.d.cts +15239 -0
  31. package/dist/jsx-runtime.d-kG9JzmQF.d.ts +15239 -0
  32. package/dist/manager.js +2 -2
  33. package/dist/manager.js.map +1 -0
  34. package/dist/preset.cjs +8185 -172
  35. package/dist/preset.cjs.map +1 -0
  36. package/dist/preset.js +8187 -8
  37. package/dist/preset.js.map +1 -0
  38. package/dist/types-BVOYHsBN.d.cts +178 -0
  39. package/dist/types-BVOYHsBN.d.ts +178 -0
  40. package/package.json +141 -143
  41. package/templates/spacing.mdx +1 -1
@@ -0,0 +1,905 @@
1
+ import { useState, useMemo } from 'react';
2
+ import { styled, ThemeProvider, ensure, themes } from 'storybook/theming';
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+
5
+ // src/addon/components/primitives/ColorSection.tsx
6
+ var Wrapper = styled.div(({ theme }) => ({
7
+ background: theme.background.content,
8
+ display: "flex",
9
+ flexDirection: "row-reverse",
10
+ justifyContent: "center",
11
+ padding: "4rem 20px",
12
+ minHeight: "100vh",
13
+ boxSizing: "border-box",
14
+ gap: "3rem",
15
+ "@media (min-width: 600px)": {}
16
+ }));
17
+ var Container = styled.div(() => ({
18
+ maxWidth: "1000px",
19
+ width: "100%",
20
+ minWidth: "0px"
21
+ }));
22
+ var Title = styled.h1(({ theme }) => ({
23
+ fontFamily: theme.typography.fonts.base,
24
+ WebkitFontSmoothing: "antialiased",
25
+ MozOsxFontSmoothing: "grayscale",
26
+ WebkitTapHighlightColor: "rgba(0, 0, 0, 0)",
27
+ WebkitOverflowScrolling: "touch",
28
+ margin: "20px 0 8px",
29
+ padding: 0,
30
+ cursor: "text",
31
+ position: "relative",
32
+ color: theme.textColor,
33
+ "&:first-of-type": {
34
+ marginTop: 0,
35
+ paddingTop: 0
36
+ },
37
+ "&:hover a.anchor": {
38
+ textDecoration: "none"
39
+ },
40
+ "& code": {
41
+ fontSize: "inherit"
42
+ },
43
+ fontSize: `${theme.typography.size.l1}px`,
44
+ fontWeight: theme.typography.weight.bold
45
+ }));
46
+ var SectionHeader = styled.h2(() => ({
47
+ fontFamily: "inherit",
48
+ fontSize: "1.25rem",
49
+ fontWeight: 600,
50
+ marginTop: "0",
51
+ marginBottom: "1rem"
52
+ }));
53
+ var NoneDetectedText = styled.div(({ theme }) => ({
54
+ color: theme.textColor,
55
+ fontStyle: "italic",
56
+ fontFamily: theme.typography.fonts.base,
57
+ fontSize: theme.typography.size.s2,
58
+ lineHeight: "24px",
59
+ margin: "0",
60
+ WebkitFontSmoothing: "antialiased",
61
+ MozOsxFontSmoothing: "grayscale",
62
+ WebkitTapHighlightColor: "rgba(0, 0, 0, 0)",
63
+ WebkitOverflowScrolling: "touch"
64
+ }));
65
+ var HorizontalRule = styled.div(({ theme }) => ({
66
+ border: "0 none",
67
+ borderTop: `1px solid ${theme.appBorderColor}`,
68
+ height: 4,
69
+ paddingBottom: "30px",
70
+ marginTop: "30px"
71
+ }));
72
+ var FontHeaderSection = styled.div(({ theme }) => ({
73
+ fontFamily: theme.typography.fonts.base,
74
+ fontSize: `${theme.typography.size.s3}px`,
75
+ color: theme.textColor,
76
+ margin: 0,
77
+ padding: 0,
78
+ WebkitFontSmoothing: "antialiased",
79
+ MozOsxFontSmoothing: "grayscale",
80
+ WebkitTapHighlightColor: "rgba(0, 0, 0, 0)",
81
+ WebkitOverflowScrolling: "touch",
82
+ marginBottom: "20px"
83
+ }));
84
+ var TypefaceWrapper = styled.div({
85
+ display: "grid",
86
+ gridTemplateColumns: "minmax(200px, 1fr) 2fr",
87
+ gap: "40px",
88
+ marginBottom: "40px",
89
+ "@media (max-width: 600px)": {
90
+ gridTemplateColumns: "1fr"
91
+ }
92
+ });
93
+ var ControlsBar = styled.div({
94
+ display: "flex",
95
+ gap: "16px",
96
+ marginBottom: "32px",
97
+ flexWrap: "wrap",
98
+ alignItems: "center"
99
+ });
100
+ var FiltersWrapper = styled.div({
101
+ display: "flex",
102
+ gap: "8px",
103
+ alignItems: "center",
104
+ flexWrap: "nowrap"
105
+ });
106
+ var SearchInput = styled.input(({ theme }) => ({
107
+ flex: "1 1",
108
+ width: "300px",
109
+ padding: "10px 14px",
110
+ fontSize: "14px",
111
+ border: `1px solid ${theme.appBorderColor}`,
112
+ borderRadius: "6px",
113
+ color: theme.textColor,
114
+ background: theme.background.content,
115
+ outline: "none",
116
+ transition: "border-color 0.2s, box-shadow 0.2s",
117
+ "&:focus": {
118
+ borderColor: theme.color.secondary,
119
+ boxShadow: `0 0 0 2px ${theme.color.secondary}22`
120
+ },
121
+ "&::placeholder": {
122
+ color: theme.textColor,
123
+ opacity: 0.5
124
+ }
125
+ }));
126
+ var FilterGroup = styled.div(({ theme }) => ({
127
+ display: "flex",
128
+ alignItems: "center",
129
+ gap: "6px",
130
+ padding: "6px 10px",
131
+ border: `1px solid ${theme.appBorderColor}`,
132
+ borderRadius: "6px",
133
+ background: theme.background.content
134
+ }));
135
+ var FilterLabel = styled.label(({ theme }) => ({
136
+ fontFamily: theme.typography.fonts.base,
137
+ fontSize: "12px",
138
+ color: theme.textColor,
139
+ opacity: 0.6,
140
+ textTransform: "uppercase",
141
+ letterSpacing: "0.5px",
142
+ marginRight: "4px"
143
+ }));
144
+ var FilterChip = styled.button(({ theme }) => ({
145
+ display: "inline-flex",
146
+ alignItems: "center",
147
+ padding: "4px 10px",
148
+ fontSize: "12px",
149
+ fontWeight: 500,
150
+ border: "none",
151
+ borderRadius: "4px",
152
+ cursor: "pointer",
153
+ background: "transparent",
154
+ color: theme.textColor,
155
+ opacity: 0.6,
156
+ transition: "all 0.15s",
157
+ '&[data-active="true"]': {
158
+ background: theme.color.secondary,
159
+ color: "#fff",
160
+ opacity: 1
161
+ },
162
+ '&:hover:not([data-active="true"])': {
163
+ opacity: 0.9,
164
+ background: theme.background.hoverable
165
+ }
166
+ }));
167
+ var SampleTextInput = styled.input(({ theme }) => ({
168
+ flex: "1 1 250px",
169
+ width: "500px",
170
+ minWidth: "250px",
171
+ padding: "10px 14px",
172
+ fontSize: "14px",
173
+ border: `1px solid ${theme.appBorderColor}`,
174
+ borderRadius: "6px",
175
+ color: theme.textColor,
176
+ background: theme.background.content,
177
+ outline: "none",
178
+ transition: "border-color 0.2s, box-shadow 0.2s",
179
+ "&:focus": {
180
+ borderColor: theme.color.secondary,
181
+ boxShadow: `0 0 0 2px ${theme.color.secondary}22`
182
+ },
183
+ "&::placeholder": {
184
+ color: theme.textColor,
185
+ opacity: 0.5
186
+ }
187
+ }));
188
+ var WeightColumn = styled.div({
189
+ display: "flex",
190
+ flexDirection: "column",
191
+ gap: "10px"
192
+ });
193
+ var SizeColumn = styled.div({
194
+ display: "flex",
195
+ flexDirection: "column",
196
+ gap: "15px"
197
+ });
198
+ var SizeRow = styled.div({
199
+ display: "flex",
200
+ flexDirection: "column",
201
+ gap: "5px"
202
+ });
203
+ var SizeInfo = styled.div(({ theme }) => ({
204
+ fontSize: "12px",
205
+ color: theme.textColor,
206
+ opacity: 0.7,
207
+ fontFamily: theme.typography.fonts.base
208
+ }));
209
+ var SpacingGrid = styled.div({
210
+ display: "flex",
211
+ flexDirection: "column",
212
+ gap: "8px"
213
+ });
214
+ var SpacingRow = styled.div(({ theme }) => ({
215
+ display: "grid",
216
+ gridTemplateColumns: "80px 80px 1fr 120px",
217
+ alignItems: "center",
218
+ gap: "16px",
219
+ padding: "8px 0",
220
+ borderBottom: `1px solid ${theme.appBorderColor}`,
221
+ fontFamily: theme.typography.fonts.base,
222
+ fontSize: "14px"
223
+ }));
224
+ var SpacingBar = styled.div(({ theme }) => ({
225
+ height: "16px",
226
+ background: theme.color.secondary,
227
+ borderRadius: "2px",
228
+ transition: "width 0.2s ease"
229
+ }));
230
+ var SpacingLabel = styled.span(({ theme }) => ({
231
+ fontWeight: 600,
232
+ color: theme.textColor
233
+ }));
234
+ var SpacingValue = styled.span(({ theme }) => ({
235
+ color: theme.textColor,
236
+ opacity: 0.7,
237
+ fontFamily: theme.typography.fonts.mono,
238
+ fontSize: "12px"
239
+ }));
240
+ var ShadowsGrid = styled.div({
241
+ display: "grid",
242
+ gridTemplateColumns: "repeat(auto-fill, minmax(200px, 1fr))",
243
+ gap: "24px"
244
+ });
245
+ var ShadowCard = styled.div(({ theme }) => ({
246
+ background: theme.background.content,
247
+ borderRadius: "8px",
248
+ padding: "24px",
249
+ display: "flex",
250
+ flexDirection: "column",
251
+ alignItems: "center",
252
+ gap: "16px"
253
+ }));
254
+ var ShadowPreview = styled.div(({ theme }) => ({
255
+ width: "100px",
256
+ height: "100px",
257
+ background: theme.background.app,
258
+ borderRadius: "8px"
259
+ }));
260
+ var ShadowLabel = styled.div(({ theme }) => ({
261
+ fontFamily: theme.typography.fonts.base,
262
+ fontWeight: 600,
263
+ color: theme.textColor,
264
+ fontSize: "14px"
265
+ }));
266
+ var ShadowValue = styled.div(({ theme }) => ({
267
+ fontFamily: theme.typography.fonts.mono,
268
+ fontSize: "11px",
269
+ color: theme.textColor,
270
+ opacity: 0.7,
271
+ textAlign: "center",
272
+ wordBreak: "break-word",
273
+ maxWidth: "180px"
274
+ }));
275
+ var RadiusGrid = styled.div({
276
+ display: "grid",
277
+ gridTemplateColumns: "repeat(auto-fill, minmax(140px, 1fr))",
278
+ gap: "24px"
279
+ });
280
+ var RadiusCard = styled.div(() => ({
281
+ display: "flex",
282
+ flexDirection: "column",
283
+ alignItems: "center",
284
+ gap: "12px"
285
+ }));
286
+ var RadiusPreview = styled.div(({ theme }) => ({
287
+ width: "80px",
288
+ height: "80px",
289
+ background: theme.color.secondary
290
+ }));
291
+ var RadiusLabel = styled.div(({ theme }) => ({
292
+ fontFamily: theme.typography.fonts.base,
293
+ fontWeight: 600,
294
+ color: theme.textColor,
295
+ fontSize: "14px"
296
+ }));
297
+ var RadiusValue = styled.div(({ theme }) => ({
298
+ fontFamily: theme.typography.fonts.mono,
299
+ fontSize: "12px",
300
+ opacity: 0.7
301
+ }));
302
+ var PaletteGrid = styled.div({
303
+ display: "flex",
304
+ flexDirection: "column",
305
+ gap: "32px"
306
+ });
307
+ var PaletteCard = styled.div({
308
+ display: "flex",
309
+ flexDirection: "column",
310
+ gap: "12px",
311
+ width: "100%"
312
+ });
313
+ var PaletteHeader = styled.div({
314
+ display: "flex",
315
+ flexDirection: "column",
316
+ marginBottom: "8px"
317
+ });
318
+ var PaletteTitle = styled.div(({ theme }) => ({
319
+ fontFamily: theme.typography.fonts.base,
320
+ fontSize: "16px",
321
+ fontWeight: 700,
322
+ color: theme.textColor
323
+ }));
324
+ var PaletteSubtitle = styled.div(({ theme }) => ({
325
+ fontFamily: theme.typography.fonts.base,
326
+ fontSize: "13px",
327
+ color: theme.textColor,
328
+ opacity: 0.7,
329
+ marginTop: "4px"
330
+ }));
331
+ var SwatchGrid = styled.div({
332
+ display: "flex",
333
+ flexWrap: "wrap",
334
+ gap: "0",
335
+ borderRadius: "8px",
336
+ overflow: "hidden",
337
+ boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)"
338
+ });
339
+ var SwatchWrapper = styled.div({
340
+ display: "flex",
341
+ flexDirection: "column",
342
+ flex: "1 1 0px",
343
+ minWidth: "80px"
344
+ });
345
+ var SwatchColor = styled.div(({ color }) => ({
346
+ height: "64px",
347
+ width: "100%",
348
+ backgroundColor: color,
349
+ position: "relative"
350
+ }));
351
+ var SwatchInfo = styled.div(({ theme }) => ({
352
+ padding: "8px 12px",
353
+ backgroundColor: theme.background.content,
354
+ borderTop: "none",
355
+ display: "flex",
356
+ flexDirection: "column",
357
+ gap: "2px"
358
+ }));
359
+ var SwatchLabel = styled.div(({ theme }) => ({
360
+ fontFamily: theme.typography.fonts.base,
361
+ fontSize: "12px",
362
+ fontWeight: 600,
363
+ color: theme.textColor,
364
+ whiteSpace: "nowrap",
365
+ overflow: "hidden",
366
+ textOverflow: "ellipsis"
367
+ }));
368
+ var SwatchValue = styled.div(({ theme }) => ({
369
+ fontFamily: theme.typography.fonts.mono,
370
+ fontSize: "11px",
371
+ color: theme.textColor,
372
+ opacity: 0.6,
373
+ whiteSpace: "nowrap",
374
+ overflow: "hidden",
375
+ textOverflow: "ellipsis",
376
+ textTransform: "uppercase"
377
+ }));
378
+ function ColorSection({
379
+ customColors,
380
+ builtInColors,
381
+ showOnlyCustom
382
+ }) {
383
+ const [searchTerm, setSearchTerm] = useState("");
384
+ const hasColors = customColors.length > 0 || builtInColors.length > 0;
385
+ const filteredCustomColors = useMemo(() => {
386
+ if (!searchTerm) {
387
+ return customColors;
388
+ }
389
+ const lowerCaseSearchTerm = searchTerm.toLowerCase();
390
+ return customColors.filter(
391
+ (color) => color.baseName.toLowerCase().includes(lowerCaseSearchTerm) || color.subtitle.toLowerCase().includes(lowerCaseSearchTerm)
392
+ );
393
+ }, [customColors, searchTerm]);
394
+ const filteredBuiltInColors = useMemo(() => {
395
+ if (!searchTerm) {
396
+ return builtInColors;
397
+ }
398
+ const lowerCaseSearchTerm = searchTerm.toLowerCase();
399
+ return builtInColors.filter(
400
+ (color) => color.baseName.toLowerCase().includes(lowerCaseSearchTerm) || color.subtitle.toLowerCase().includes(lowerCaseSearchTerm)
401
+ );
402
+ }, [builtInColors, searchTerm]);
403
+ if (!hasColors) {
404
+ return /* @__PURE__ */ jsx(NoneDetectedText, { children: "No colors detected. To see a color, add it to your Tailwind configuration, or ensure Tailwind's defaults are not being overridden." });
405
+ }
406
+ if (showOnlyCustom) {
407
+ if (customColors.length === 0) {
408
+ return /* @__PURE__ */ jsx(NoneDetectedText, { children: "No custom colors detected. Define custom colors in your Tailwind configuration to see them here." });
409
+ }
410
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
411
+ /* @__PURE__ */ jsx(ControlsBar, { children: /* @__PURE__ */ jsx(
412
+ SearchInput,
413
+ {
414
+ value: searchTerm,
415
+ onChange: (e) => setSearchTerm(e.target.value),
416
+ placeholder: "Search colors..."
417
+ }
418
+ ) }),
419
+ /* @__PURE__ */ jsx(PaletteGrid, { children: filteredCustomColors.map((color) => /* @__PURE__ */ jsxs(PaletteCard, { children: [
420
+ /* @__PURE__ */ jsxs(PaletteHeader, { children: [
421
+ /* @__PURE__ */ jsx(PaletteTitle, { children: color.baseName }),
422
+ color.subtitle && /* @__PURE__ */ jsx(PaletteSubtitle, { children: color.subtitle })
423
+ ] }),
424
+ /* @__PURE__ */ jsx(SwatchGrid, { children: Object.entries(color.shades).map(([shade, value]) => /* @__PURE__ */ jsxs(SwatchWrapper, { children: [
425
+ /* @__PURE__ */ jsx(SwatchColor, { color: value }),
426
+ /* @__PURE__ */ jsxs(SwatchInfo, { children: [
427
+ /* @__PURE__ */ jsx(SwatchLabel, { children: shade }),
428
+ /* @__PURE__ */ jsx(SwatchValue, { children: value })
429
+ ] })
430
+ ] }, shade)) })
431
+ ] }, color.baseName)) })
432
+ ] });
433
+ }
434
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
435
+ /* @__PURE__ */ jsx(ControlsBar, { children: /* @__PURE__ */ jsx(
436
+ SearchInput,
437
+ {
438
+ value: searchTerm,
439
+ onChange: (e) => setSearchTerm(e.target.value),
440
+ placeholder: "Search colors..."
441
+ }
442
+ ) }),
443
+ customColors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
444
+ /* @__PURE__ */ jsx(SectionHeader, { children: "Design System" }),
445
+ /* @__PURE__ */ jsx(PaletteGrid, { children: filteredCustomColors.map((color) => /* @__PURE__ */ jsxs(PaletteCard, { children: [
446
+ /* @__PURE__ */ jsxs(PaletteHeader, { children: [
447
+ /* @__PURE__ */ jsx(PaletteTitle, { children: color.baseName }),
448
+ color.subtitle && /* @__PURE__ */ jsx(PaletteSubtitle, { children: color.subtitle })
449
+ ] }),
450
+ /* @__PURE__ */ jsx(SwatchGrid, { children: Object.entries(color.shades).map(([shade, value]) => /* @__PURE__ */ jsxs(SwatchWrapper, { children: [
451
+ /* @__PURE__ */ jsx(SwatchColor, { color: value }),
452
+ /* @__PURE__ */ jsxs(SwatchInfo, { children: [
453
+ /* @__PURE__ */ jsx(SwatchLabel, { children: shade }),
454
+ /* @__PURE__ */ jsx(SwatchValue, { children: value })
455
+ ] })
456
+ ] }, shade)) })
457
+ ] }, color.baseName)) }),
458
+ builtInColors.length > 0 && /* @__PURE__ */ jsx(HorizontalRule, {})
459
+ ] }),
460
+ builtInColors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
461
+ /* @__PURE__ */ jsx(
462
+ SectionHeader,
463
+ {
464
+ style: {
465
+ marginTop: customColors.length > 0 ? "2rem" : "0"
466
+ },
467
+ children: "Tailwind Built-ins"
468
+ }
469
+ ),
470
+ /* @__PURE__ */ jsx(PaletteGrid, { children: filteredBuiltInColors.map((color) => /* @__PURE__ */ jsxs(PaletteCard, { children: [
471
+ /* @__PURE__ */ jsxs(PaletteHeader, { children: [
472
+ /* @__PURE__ */ jsx(PaletteTitle, { children: color.baseName }),
473
+ color.subtitle && /* @__PURE__ */ jsx(PaletteSubtitle, { children: color.subtitle })
474
+ ] }),
475
+ /* @__PURE__ */ jsx(SwatchGrid, { children: Object.entries(color.shades).map(([shade, value]) => /* @__PURE__ */ jsxs(SwatchWrapper, { children: [
476
+ /* @__PURE__ */ jsx(SwatchColor, { color: value }),
477
+ /* @__PURE__ */ jsxs(SwatchInfo, { children: [
478
+ /* @__PURE__ */ jsx(SwatchLabel, { children: shade }),
479
+ /* @__PURE__ */ jsx(SwatchValue, { children: value })
480
+ ] })
481
+ ] }, shade)) })
482
+ ] }, color.baseName)) })
483
+ ] })
484
+ ] });
485
+ }
486
+ function ColorsPage(props) {
487
+ return /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsxs(Container, { children: [
488
+ /* @__PURE__ */ jsx(Title, { children: "Colors" }),
489
+ /* @__PURE__ */ jsx(ColorSection, { ...props })
490
+ ] }) });
491
+ }
492
+ function RadiusSection({ entries }) {
493
+ if (entries.length === 0) {
494
+ return /* @__PURE__ */ jsx(NoneDetectedText, { children: "No border radius values detected. Add borderRadius values to your Tailwind configuration to see them here." });
495
+ }
496
+ return /* @__PURE__ */ jsx(RadiusGrid, { children: entries.map(([label, value]) => /* @__PURE__ */ jsxs(RadiusCard, { children: [
497
+ /* @__PURE__ */ jsx(
498
+ RadiusPreview,
499
+ {
500
+ style: { borderRadius: value },
501
+ title: `Border radius: ${label}`
502
+ }
503
+ ),
504
+ /* @__PURE__ */ jsx(RadiusLabel, { children: label === "DEFAULT" ? "rounded" : `rounded-${label}` }),
505
+ /* @__PURE__ */ jsx(RadiusValue, { children: value })
506
+ ] }, label)) });
507
+ }
508
+ function RadiusPage(props) {
509
+ return /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsxs(Container, { children: [
510
+ /* @__PURE__ */ jsx(Title, { children: "Border Radius" }),
511
+ /* @__PURE__ */ jsx("br", {}),
512
+ /* @__PURE__ */ jsx(RadiusSection, { ...props })
513
+ ] }) });
514
+ }
515
+ function ShadowsSection({ entries }) {
516
+ if (entries.length === 0) {
517
+ return /* @__PURE__ */ jsx(NoneDetectedText, { children: "No shadow values detected. Add boxShadow values to your Tailwind configuration to see them here." });
518
+ }
519
+ return /* @__PURE__ */ jsx(ShadowsGrid, { children: entries.map(([label, value]) => /* @__PURE__ */ jsxs(ShadowCard, { children: [
520
+ /* @__PURE__ */ jsx(
521
+ ShadowPreview,
522
+ {
523
+ style: { boxShadow: value },
524
+ title: `Shadow: ${label}`
525
+ }
526
+ ),
527
+ /* @__PURE__ */ jsx(ShadowLabel, { children: label === "DEFAULT" ? "shadow" : `shadow-${label}` }),
528
+ /* @__PURE__ */ jsx(ShadowValue, { title: value, children: value === "none" ? "none" : value.length > 50 ? `${value.substring(0, 47)}...` : value })
529
+ ] }, label)) });
530
+ }
531
+ function ShadowsPage(props) {
532
+ return /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsxs(Container, { children: [
533
+ /* @__PURE__ */ jsx(Title, { children: "Shadows" }),
534
+ /* @__PURE__ */ jsx("br", {}),
535
+ /* @__PURE__ */ jsx(ShadowsSection, { ...props })
536
+ ] }) });
537
+ }
538
+ function SpacingSection({ entries }) {
539
+ if (entries.length === 0) {
540
+ return /* @__PURE__ */ jsx(NoneDetectedText, { children: "No spacing values detected. Add spacing values to your Tailwind configuration to see them here." });
541
+ }
542
+ return /* @__PURE__ */ jsx(SpacingGrid, { children: entries.map(([label, value]) => {
543
+ return /* @__PURE__ */ jsxs(SpacingRow, { children: [
544
+ /* @__PURE__ */ jsx(SpacingLabel, { children: label }),
545
+ /* @__PURE__ */ jsx(SpacingValue, { children: value }),
546
+ /* @__PURE__ */ jsx("div", { style: { width: "100%", overflow: "hidden" }, children: /* @__PURE__ */ jsx(
547
+ SpacingBar,
548
+ {
549
+ style: { width: value },
550
+ title: `${label}: ${value}`
551
+ }
552
+ ) }),
553
+ /* @__PURE__ */ jsxs(SpacingValue, { children: [
554
+ "--spacing-",
555
+ label
556
+ ] })
557
+ ] }, label);
558
+ }) });
559
+ }
560
+ function SpacingPage(props) {
561
+ return /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsxs(Container, { children: [
562
+ /* @__PURE__ */ jsx(Title, { children: "Spacing" }),
563
+ /* @__PURE__ */ jsx("br", {}),
564
+ /* @__PURE__ */ jsx(SpacingSection, { ...props })
565
+ ] }) });
566
+ }
567
+ var getTheme = () => {
568
+ const base = ensure(themes.light);
569
+ return {
570
+ ...base,
571
+ typography: {
572
+ ...base.typography || {},
573
+ fonts: {
574
+ base: '"Nunito Sans", -apple-system, ".SFNSText-Regular", "San Francisco", BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif',
575
+ mono: 'ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace',
576
+ ...base.typography?.fonts || {}
577
+ },
578
+ weight: {
579
+ regular: 400,
580
+ bold: 700,
581
+ ...base.typography?.weight || {}
582
+ },
583
+ size: {
584
+ s1: 12,
585
+ s2: 14,
586
+ s3: 16,
587
+ m1: 20,
588
+ m2: 24,
589
+ m3: 28,
590
+ l1: 32,
591
+ l2: 40,
592
+ l3: 48,
593
+ ...base.typography?.size || {}
594
+ }
595
+ },
596
+ background: {
597
+ content: "#ffffff",
598
+ app: "#f6f9fc",
599
+ hoverable: "rgba(0,0,0,0.05)",
600
+ ...base.background || {}
601
+ },
602
+ color: {
603
+ secondary: "#029CFD",
604
+ ...base.color || {},
605
+ defaultText: base.textColor || "#333333"
606
+ },
607
+ textColor: base.textColor || "#333333",
608
+ appBorderColor: base.appBorderColor || "rgba(0,0,0,0.1)"
609
+ };
610
+ };
611
+ function ThemeLayout({ title, children }) {
612
+ console.log("ThemeLayout: mounting", { title });
613
+ try {
614
+ const theme = getTheme();
615
+ console.log("ThemeLayout: generated theme", {
616
+ hasTypography: !!theme.typography,
617
+ hasFonts: !!theme.typography?.fonts,
618
+ fonts: theme.typography?.fonts
619
+ });
620
+ return /* @__PURE__ */ jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsxs(Container, { children: [
621
+ /* @__PURE__ */ jsx("h1", { style: { fontSize: "32px", marginTop: 0, marginBottom: "8px" }, children: title }),
622
+ children
623
+ ] }) }) });
624
+ } catch (e) {
625
+ console.error("ThemeLayout: error generating theme", e);
626
+ return /* @__PURE__ */ jsxs("div", { children: [
627
+ "Error loading theme: ",
628
+ e.message
629
+ ] });
630
+ }
631
+ }
632
+ function themeDecorator(Story) {
633
+ const theme = getTheme();
634
+ return /* @__PURE__ */ jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsx(Story, {}) });
635
+ }
636
+ function FontFamilyPreview({
637
+ families,
638
+ fontWeights,
639
+ fontSizes,
640
+ selectedWeights,
641
+ selectedSizes,
642
+ sampleText,
643
+ searchTerm,
644
+ showDivider = false
645
+ }) {
646
+ const filteredWeights = fontWeights.filter(
647
+ ([w]) => selectedWeights.includes(w)
648
+ );
649
+ const filteredSizes = fontSizes.filter(([s]) => selectedSizes.includes(s));
650
+ const filteredFamilies = useMemo(() => {
651
+ if (!searchTerm.trim()) return families;
652
+ const term = searchTerm.toLowerCase();
653
+ return families.filter(
654
+ ([label, fontFamily]) => label.toLowerCase().includes(term) || fontFamily.toLowerCase().includes(term)
655
+ );
656
+ }, [families, searchTerm]);
657
+ return /* @__PURE__ */ jsx(Fragment, { children: filteredFamilies.map(([label, fontFamily], familyIndex) => /* @__PURE__ */ jsxs("div", { style: { marginBottom: "60px" }, children: [
658
+ /* @__PURE__ */ jsxs(FontHeaderSection, { children: [
659
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: "20px", marginBottom: "8px" }, children: [
660
+ /* @__PURE__ */ jsx("b", { children: "Class name: " }),
661
+ label
662
+ ] }),
663
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: "20px", opacity: 0.8 }, children: [
664
+ /* @__PURE__ */ jsx("b", { children: "Font Family: " }),
665
+ fontFamily
666
+ ] })
667
+ ] }),
668
+ /* @__PURE__ */ jsxs(TypefaceWrapper, { children: [
669
+ /* @__PURE__ */ jsx(WeightColumn, { children: filteredWeights.map(([weightLabel, weightValue]) => /* @__PURE__ */ jsxs("div", { style: { marginBottom: "20px" }, children: [
670
+ /* @__PURE__ */ jsx(
671
+ "div",
672
+ {
673
+ style: {
674
+ fontFamily,
675
+ fontWeight: weightValue,
676
+ fontSize: "36px",
677
+ marginBottom: "4px"
678
+ },
679
+ children: sampleText
680
+ }
681
+ ),
682
+ /* @__PURE__ */ jsxs(SizeInfo, { children: [
683
+ weightValue,
684
+ " (",
685
+ weightLabel,
686
+ ")"
687
+ ] })
688
+ ] }, weightLabel)) }),
689
+ /* @__PURE__ */ jsx(SizeColumn, { children: filteredSizes.map(([sizeLabel, sizeValue]) => /* @__PURE__ */ jsxs(SizeRow, { children: [
690
+ /* @__PURE__ */ jsxs(SizeInfo, { children: [
691
+ "text-",
692
+ sizeLabel,
693
+ " - ",
694
+ sizeValue
695
+ ] }),
696
+ /* @__PURE__ */ jsx(
697
+ "div",
698
+ {
699
+ style: {
700
+ fontFamily,
701
+ fontSize: sizeValue,
702
+ lineHeight: 1.2
703
+ },
704
+ children: sampleText
705
+ }
706
+ )
707
+ ] }, sizeLabel)) })
708
+ ] }),
709
+ showDivider && familyIndex < filteredFamilies.length - 1 && /* @__PURE__ */ jsx(HorizontalRule, {})
710
+ ] }, label)) });
711
+ }
712
+ function TypographySection({
713
+ customFamilies,
714
+ builtInFamilies,
715
+ fontWeights,
716
+ fontSizes,
717
+ allWeightKeys,
718
+ allSizeKeys,
719
+ defaultSampleText,
720
+ showOnlyCustom
721
+ }) {
722
+ const [sampleText, setSampleText] = useState(defaultSampleText);
723
+ const [searchTerm, setSearchTerm] = useState("");
724
+ const [selectedWeights, setSelectedWeights] = useState(allWeightKeys);
725
+ const [selectedSizes, setSelectedSizes] = useState(allSizeKeys);
726
+ const hasFontFamily = customFamilies.length > 0 || builtInFamilies.length > 0;
727
+ const toggleWeight = (w) => {
728
+ if (selectedWeights.includes(w)) {
729
+ setSelectedWeights(selectedWeights.filter((i) => i !== w));
730
+ } else {
731
+ setSelectedWeights([...selectedWeights, w]);
732
+ }
733
+ };
734
+ const toggleSize = (s) => {
735
+ if (selectedSizes.includes(s)) {
736
+ setSelectedSizes(selectedSizes.filter((i) => i !== s));
737
+ } else {
738
+ setSelectedSizes([...selectedSizes, s]);
739
+ }
740
+ };
741
+ if (!hasFontFamily) {
742
+ return /* @__PURE__ */ jsx(NoneDetectedText, { children: "No font families detected. To see typography, add a font family to your Tailwind configuration, or ensure Tailwind's defaults are not being overridden." });
743
+ }
744
+ if (showOnlyCustom) {
745
+ if (customFamilies.length === 0) {
746
+ return /* @__PURE__ */ jsx(NoneDetectedText, { children: "No custom font families detected. Define custom fonts in your Tailwind configuration to see them here." });
747
+ }
748
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
749
+ /* @__PURE__ */ jsxs(ControlsBar, { children: [
750
+ /* @__PURE__ */ jsx(FilterLabel, { htmlFor: "sample-text", children: "Sample Text" }),
751
+ /* @__PURE__ */ jsx(
752
+ SampleTextInput,
753
+ {
754
+ id: "sample-text",
755
+ value: sampleText,
756
+ onChange: (e) => setSampleText(e.target.value),
757
+ placeholder: "Type to preview..."
758
+ }
759
+ ),
760
+ /* @__PURE__ */ jsx(FilterLabel, { htmlFor: "search-fonts", children: "Search" }),
761
+ /* @__PURE__ */ jsx(
762
+ SearchInput,
763
+ {
764
+ id: "search-fonts",
765
+ value: searchTerm,
766
+ onChange: (e) => setSearchTerm(e.target.value),
767
+ placeholder: "Search fonts..."
768
+ }
769
+ ),
770
+ /* @__PURE__ */ jsxs(FiltersWrapper, { children: [
771
+ /* @__PURE__ */ jsxs(FilterGroup, { children: [
772
+ /* @__PURE__ */ jsx(FilterLabel, { children: "Weights" }),
773
+ allWeightKeys.map((w) => /* @__PURE__ */ jsx(
774
+ FilterChip,
775
+ {
776
+ "data-active": selectedWeights.includes(w),
777
+ onClick: () => toggleWeight(w),
778
+ children: w
779
+ },
780
+ w
781
+ ))
782
+ ] }),
783
+ /* @__PURE__ */ jsxs(FilterGroup, { children: [
784
+ /* @__PURE__ */ jsx(FilterLabel, { children: "Sizes" }),
785
+ allSizeKeys.map((s) => /* @__PURE__ */ jsx(
786
+ FilterChip,
787
+ {
788
+ "data-active": selectedSizes.includes(s),
789
+ onClick: () => toggleSize(s),
790
+ children: s
791
+ },
792
+ s
793
+ ))
794
+ ] })
795
+ ] })
796
+ ] }),
797
+ /* @__PURE__ */ jsx(
798
+ FontFamilyPreview,
799
+ {
800
+ families: customFamilies,
801
+ fontWeights,
802
+ fontSizes,
803
+ selectedWeights,
804
+ selectedSizes,
805
+ sampleText,
806
+ searchTerm,
807
+ showDivider: true
808
+ }
809
+ )
810
+ ] });
811
+ }
812
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
813
+ /* @__PURE__ */ jsxs(ControlsBar, { style: { marginTop: "2rem" }, children: [
814
+ /* @__PURE__ */ jsx(FilterLabel, { htmlFor: "sample-text", children: "Sample Text" }),
815
+ /* @__PURE__ */ jsx(
816
+ SampleTextInput,
817
+ {
818
+ id: "sample-text",
819
+ value: sampleText,
820
+ onChange: (e) => setSampleText(e.target.value),
821
+ placeholder: "Type to preview..."
822
+ }
823
+ ),
824
+ /* @__PURE__ */ jsx(FilterLabel, { htmlFor: "search-fonts", children: "Search" }),
825
+ /* @__PURE__ */ jsx(
826
+ SearchInput,
827
+ {
828
+ id: "search-fonts",
829
+ value: searchTerm,
830
+ onChange: (e) => setSearchTerm(e.target.value),
831
+ placeholder: "Search fonts..."
832
+ }
833
+ ),
834
+ /* @__PURE__ */ jsxs(FiltersWrapper, { children: [
835
+ /* @__PURE__ */ jsxs(FilterGroup, { children: [
836
+ /* @__PURE__ */ jsx(FilterLabel, { children: "Weights" }),
837
+ allWeightKeys.map((w) => /* @__PURE__ */ jsx(
838
+ FilterChip,
839
+ {
840
+ "data-active": selectedWeights.includes(w),
841
+ onClick: () => toggleWeight(w),
842
+ children: w
843
+ },
844
+ w
845
+ ))
846
+ ] }),
847
+ /* @__PURE__ */ jsxs(FilterGroup, { children: [
848
+ /* @__PURE__ */ jsx(FilterLabel, { children: "Sizes" }),
849
+ allSizeKeys.map((s) => /* @__PURE__ */ jsx(
850
+ FilterChip,
851
+ {
852
+ "data-active": selectedSizes.includes(s),
853
+ onClick: () => toggleSize(s),
854
+ children: s
855
+ },
856
+ s
857
+ ))
858
+ ] })
859
+ ] })
860
+ ] }),
861
+ customFamilies.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
862
+ /* @__PURE__ */ jsx(SectionHeader, { children: "Design System" }),
863
+ /* @__PURE__ */ jsx(
864
+ FontFamilyPreview,
865
+ {
866
+ families: customFamilies,
867
+ fontWeights,
868
+ fontSizes,
869
+ selectedWeights,
870
+ selectedSizes,
871
+ sampleText,
872
+ searchTerm,
873
+ showDivider: true
874
+ }
875
+ ),
876
+ builtInFamilies.length > 0 && /* @__PURE__ */ jsx(HorizontalRule, {})
877
+ ] }),
878
+ builtInFamilies.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
879
+ /* @__PURE__ */ jsx(SectionHeader, { children: "Tailwind Built-ins" }),
880
+ /* @__PURE__ */ jsx(
881
+ FontFamilyPreview,
882
+ {
883
+ families: builtInFamilies,
884
+ fontWeights,
885
+ fontSizes,
886
+ selectedWeights,
887
+ selectedSizes,
888
+ sampleText,
889
+ searchTerm,
890
+ showDivider: true
891
+ }
892
+ )
893
+ ] })
894
+ ] });
895
+ }
896
+ function TypographyPage(props) {
897
+ return /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsxs(Container, { children: [
898
+ /* @__PURE__ */ jsx(Title, { children: "Typography" }),
899
+ /* @__PURE__ */ jsx(TypographySection, { ...props })
900
+ ] }) });
901
+ }
902
+
903
+ export { ColorSection, ColorsPage, Container, ControlsBar, FilterChip, FilterGroup, FilterLabel, FiltersWrapper, FontHeaderSection, HorizontalRule, NoneDetectedText, PaletteCard, PaletteGrid, PaletteHeader, PaletteSubtitle, PaletteTitle, RadiusCard, RadiusGrid, RadiusLabel, RadiusPage, RadiusPreview, RadiusSection, RadiusValue, SampleTextInput, SearchInput, SectionHeader, ShadowCard, ShadowLabel, ShadowPreview, ShadowValue, ShadowsGrid, ShadowsPage, ShadowsSection, SizeColumn, SizeInfo, SizeRow, SpacingBar, SpacingGrid, SpacingLabel, SpacingPage, SpacingRow, SpacingSection, SpacingValue, SwatchColor, SwatchGrid, SwatchInfo, SwatchLabel, SwatchValue, SwatchWrapper, ThemeLayout, Title, TypefaceWrapper, TypographyPage, TypographySection, WeightColumn, Wrapper, themeDecorator };
904
+ //# sourceMappingURL=index.js.map
905
+ //# sourceMappingURL=index.js.map