@discourser/design-system 0.1.7 → 0.2.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 (108) hide show
  1. package/README.md +411 -16
  2. package/dist/index.cjs +776 -145
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +21793 -151
  5. package/dist/index.d.ts +21793 -151
  6. package/dist/index.js +753 -142
  7. package/dist/index.js.map +1 -1
  8. package/package.json +22 -8
  9. package/styled-system/css/conditions.mjs +1 -1
  10. package/styled-system/css/css.mjs +1 -1
  11. package/styled-system/css/sva.mjs +9 -4
  12. package/styled-system/helpers.mjs +12 -20
  13. package/styled-system/jsx/create-style-context.d.ts +54 -0
  14. package/styled-system/jsx/create-style-context.mjs +118 -0
  15. package/styled-system/jsx/factory.mjs +14 -5
  16. package/styled-system/jsx/index.d.ts +1 -0
  17. package/styled-system/jsx/index.mjs +1 -0
  18. package/styled-system/jsx/is-valid-prop.mjs +2 -2
  19. package/styled-system/patterns/aspect-ratio.d.ts +0 -1
  20. package/styled-system/patterns/bleed.d.ts +0 -1
  21. package/styled-system/patterns/box.d.ts +0 -1
  22. package/styled-system/patterns/center.d.ts +0 -1
  23. package/styled-system/patterns/circle.d.ts +0 -1
  24. package/styled-system/patterns/container.d.ts +0 -1
  25. package/styled-system/patterns/cq.d.ts +0 -1
  26. package/styled-system/patterns/divider.d.ts +1 -2
  27. package/styled-system/patterns/flex.d.ts +0 -1
  28. package/styled-system/patterns/float.d.ts +1 -2
  29. package/styled-system/patterns/grid-item.d.ts +0 -1
  30. package/styled-system/patterns/grid.d.ts +0 -1
  31. package/styled-system/patterns/grid.mjs +1 -1
  32. package/styled-system/patterns/hstack.d.ts +0 -1
  33. package/styled-system/patterns/hstack.mjs +1 -1
  34. package/styled-system/patterns/link-overlay.d.ts +0 -1
  35. package/styled-system/patterns/spacer.d.ts +0 -1
  36. package/styled-system/patterns/square.d.ts +0 -1
  37. package/styled-system/patterns/stack.d.ts +0 -1
  38. package/styled-system/patterns/stack.mjs +1 -1
  39. package/styled-system/patterns/visually-hidden.d.ts +0 -1
  40. package/styled-system/patterns/vstack.d.ts +0 -1
  41. package/styled-system/patterns/vstack.mjs +1 -1
  42. package/styled-system/patterns/wrap.d.ts +0 -1
  43. package/styled-system/patterns/wrap.mjs +1 -1
  44. package/styled-system/recipes/absolute-center.d.ts +34 -0
  45. package/styled-system/recipes/absolute-center.mjs +32 -0
  46. package/styled-system/recipes/accordion.d.ts +38 -0
  47. package/styled-system/recipes/accordion.mjs +67 -0
  48. package/styled-system/recipes/avatar.d.ts +42 -0
  49. package/styled-system/recipes/avatar.mjs +71 -0
  50. package/styled-system/recipes/badge.d.ts +38 -0
  51. package/styled-system/recipes/badge.mjs +41 -0
  52. package/styled-system/recipes/button.d.ts +6 -7
  53. package/styled-system/recipes/button.mjs +11 -7
  54. package/styled-system/recipes/card.d.ts +6 -11
  55. package/styled-system/recipes/card.mjs +50 -23
  56. package/styled-system/recipes/checkbox.d.ts +38 -0
  57. package/styled-system/recipes/checkbox.mjs +68 -0
  58. package/styled-system/recipes/dialog.d.ts +13 -6
  59. package/styled-system/recipes/dialog.mjs +35 -3
  60. package/styled-system/recipes/drawer.d.ts +38 -0
  61. package/styled-system/recipes/drawer.mjs +90 -0
  62. package/styled-system/recipes/field.d.ts +31 -0
  63. package/styled-system/recipes/field.mjs +61 -0
  64. package/styled-system/recipes/group.d.ts +36 -0
  65. package/styled-system/recipes/group.mjs +72 -0
  66. package/styled-system/recipes/index.d.ts +21 -3
  67. package/styled-system/recipes/index.mjs +21 -3
  68. package/styled-system/recipes/input.d.ts +6 -8
  69. package/styled-system/recipes/input.mjs +12 -9
  70. package/styled-system/recipes/popover.d.ts +31 -0
  71. package/styled-system/recipes/popover.mjs +81 -0
  72. package/styled-system/recipes/progress.d.ts +44 -0
  73. package/styled-system/recipes/progress.mjs +98 -0
  74. package/styled-system/recipes/radio-group.d.ts +38 -0
  75. package/styled-system/recipes/radio-group.mjs +68 -0
  76. package/styled-system/recipes/select.d.ts +38 -0
  77. package/styled-system/recipes/select.mjs +111 -0
  78. package/styled-system/recipes/skeleton.d.ts +39 -0
  79. package/styled-system/recipes/skeleton.mjs +40 -0
  80. package/styled-system/recipes/slider.d.ts +42 -0
  81. package/styled-system/recipes/slider.mjs +94 -0
  82. package/styled-system/recipes/spinner.d.ts +34 -0
  83. package/styled-system/recipes/spinner.mjs +36 -0
  84. package/styled-system/recipes/switch-component.d.ts +38 -0
  85. package/styled-system/recipes/switch-component.mjs +65 -0
  86. package/styled-system/recipes/tabs.d.ts +39 -0
  87. package/styled-system/recipes/tabs.mjs +71 -0
  88. package/styled-system/recipes/textarea.d.ts +38 -0
  89. package/styled-system/recipes/textarea.mjs +41 -0
  90. package/styled-system/recipes/toast.d.ts +31 -0
  91. package/styled-system/recipes/toast.mjs +53 -0
  92. package/styled-system/recipes/tooltip.d.ts +31 -0
  93. package/styled-system/recipes/tooltip.mjs +49 -0
  94. package/styled-system/tokens/index.mjs +3483 -635
  95. package/styled-system/tokens/tokens.d.ts +31 -19
  96. package/styled-system/types/composition.d.ts +83 -23
  97. package/styled-system/types/conditions.d.ts +15 -11
  98. package/styled-system/types/jsx.d.ts +27 -10
  99. package/styled-system/types/pattern.d.ts +4 -4
  100. package/styled-system/types/prop-type.d.ts +30 -3
  101. package/styled-system/types/style-props.d.ts +262 -225
  102. package/styled-system/types/system-types.d.ts +162 -2
  103. package/styled-system/recipes/icon-button.d.ts +0 -39
  104. package/styled-system/recipes/icon-button.mjs +0 -39
  105. package/styled-system/recipes/switch-control.d.ts +0 -35
  106. package/styled-system/recipes/switch-control.mjs +0 -53
  107. package/styled-system/recipes/switch.d.ts +0 -35
  108. package/styled-system/recipes/switch.mjs +0 -53
package/README.md CHANGED
@@ -60,52 +60,447 @@ function App() {
60
60
 
61
61
  ## 📖 Components
62
62
 
63
- ### Button
63
+ We offer 21 fully-typed, accessible React components built with Ark UI and styled with Panda CSS.
64
+
65
+ ### Core Components
66
+
67
+ #### Button
64
68
 
65
69
  Material Design 3 button with 5 variants and 3 sizes.
66
70
 
67
71
  ```tsx
68
- import { Button } from '@discourser/design-system';
72
+ import * as Button from '@discourser/design-system';
69
73
 
70
- <Button variant="filled" size="md" leftIcon={<Icon />}>
74
+ <Button.Root variant="filled" size="md">
71
75
  Click me
72
- </Button>
76
+ </Button.Root>
73
77
  ```
74
78
 
75
79
  **Variants:** `filled` | `outlined` | `text` | `elevated` | `tonal`
76
80
  **Sizes:** `sm` | `md` | `lg`
77
81
 
78
- ### Card
82
+ #### Card
79
83
 
80
84
  Container component with 3 variants and optional interactive state.
81
85
 
82
86
  ```tsx
83
- import { Card } from '@discourser/design-system';
84
-
85
- <Card variant="elevated" interactive>
86
- <h3>Card Title</h3>
87
- <p>Card content goes here</p>
88
- </Card>
87
+ import * as Card from '@discourser/design-system';
88
+
89
+ <Card.Root variant="elevated">
90
+ <Card.Header>
91
+ <Card.Title>Card Title</Card.Title>
92
+ <Card.Description>Card description</Card.Description>
93
+ </Card.Header>
94
+ <Card.Body>
95
+ <p>Card content goes here</p>
96
+ </Card.Body>
97
+ <Card.Footer>
98
+ <Button.Root>Action</Button.Root>
99
+ </Card.Footer>
100
+ </Card.Root>
89
101
  ```
90
102
 
91
103
  **Variants:** `elevated` | `filled` | `outlined`
92
- **Interactive:** `true` | `false` (adds hover/click states)
93
104
 
94
- ### IconButton
105
+ #### IconButton
95
106
 
96
107
  Icon-only button with 4 variants and 3 sizes. Requires `aria-label` for accessibility.
97
108
 
98
109
  ```tsx
99
- import { IconButton } from '@discourser/design-system';
110
+ import * as IconButton from '@discourser/design-system';
100
111
 
101
- <IconButton variant="filled" size="md" aria-label="Settings">
112
+ <IconButton.Root variant="filled" size="md" aria-label="Settings">
102
113
  <SettingsIcon />
103
- </IconButton>
114
+ </IconButton.Root>
104
115
  ```
105
116
 
106
117
  **Variants:** `standard` | `filled` | `tonal` | `outlined`
107
118
  **Sizes:** `sm` | `md` | `lg`
108
119
 
120
+ #### Input
121
+
122
+ Text input field with multiple variants and sizes.
123
+
124
+ ```tsx
125
+ import * as Input from '@discourser/design-system';
126
+ import * as Field from '@discourser/design-system';
127
+
128
+ <Field.Root>
129
+ <Field.Label>Email</Field.Label>
130
+ <Input.Root variant="outline" size="md" placeholder="you@example.com" />
131
+ <Field.HelperText>We'll never share your email</Field.HelperText>
132
+ </Field.Root>
133
+ ```
134
+
135
+ **Variants:** `outline` | `filled` | `flushed`
136
+ **Sizes:** `xs` | `sm` | `md` | `lg` | `xl`
137
+
138
+ ### Form Components
139
+
140
+ #### Select
141
+
142
+ Dropdown select component for choosing from a list of options.
143
+
144
+ ```tsx
145
+ import * as Select from '@discourser/design-system';
146
+
147
+ const items = [
148
+ { label: 'Chat', value: 'chat' },
149
+ { label: 'Analysis', value: 'analysis' },
150
+ ];
151
+
152
+ <Select.Root items={items} positioning={{ sameWidth: true }}>
153
+ <Select.Label>Select Scenario</Select.Label>
154
+ <Select.Control>
155
+ <Select.Trigger>
156
+ <Select.ValueText placeholder="Select..." />
157
+ <Select.Indicator />
158
+ </Select.Trigger>
159
+ </Select.Control>
160
+ <Select.Positioner>
161
+ <Select.Content>
162
+ <Select.List>
163
+ {items.map((item) => (
164
+ <Select.Item key={item.value} item={item}>
165
+ <Select.ItemText>{item.label}</Select.ItemText>
166
+ <Select.ItemIndicator />
167
+ </Select.Item>
168
+ ))}
169
+ </Select.List>
170
+ </Select.Content>
171
+ </Select.Positioner>
172
+ <Select.HiddenSelect />
173
+ </Select.Root>
174
+ ```
175
+
176
+ **Sizes:** `sm` | `md` | `lg`
177
+
178
+ #### Checkbox
179
+
180
+ Checkbox input with custom styling and checked indicator.
181
+
182
+ ```tsx
183
+ import * as Checkbox from '@discourser/design-system';
184
+
185
+ <Checkbox.Root>
186
+ <Checkbox.Control>
187
+ <Checkbox.Indicator />
188
+ </Checkbox.Control>
189
+ <Checkbox.Label>Accept terms and conditions</Checkbox.Label>
190
+ <Checkbox.HiddenInput />
191
+ </Checkbox.Root>
192
+ ```
193
+
194
+ **Sizes:** `sm` | `md` | `lg`
195
+
196
+ #### RadioGroup
197
+
198
+ Radio button group for mutually exclusive selections.
199
+
200
+ ```tsx
201
+ import * as RadioGroup from '@discourser/design-system';
202
+
203
+ <RadioGroup.Root defaultValue="option1">
204
+ <RadioGroup.Item value="option1">
205
+ <RadioGroup.ItemControl />
206
+ <RadioGroup.ItemText>Option 1</RadioGroup.ItemText>
207
+ <RadioGroup.HiddenInput />
208
+ </RadioGroup.Item>
209
+ <RadioGroup.Item value="option2">
210
+ <RadioGroup.ItemControl />
211
+ <RadioGroup.ItemText>Option 2</RadioGroup.ItemText>
212
+ <RadioGroup.HiddenInput />
213
+ </RadioGroup.Item>
214
+ </RadioGroup.Root>
215
+ ```
216
+
217
+ **Sizes:** `sm` | `md` | `lg`
218
+
219
+ #### Slider
220
+
221
+ Range slider component for numeric input.
222
+
223
+ ```tsx
224
+ import * as Slider from '@discourser/design-system';
225
+
226
+ <Slider.Root defaultValue={[50]} min={0} max={100}>
227
+ <Slider.Label>Volume</Slider.Label>
228
+ <Slider.ValueText />
229
+ <Slider.Control>
230
+ <Slider.Track>
231
+ <Slider.Range />
232
+ </Slider.Track>
233
+ <Slider.Thumb index={0} />
234
+ </Slider.Control>
235
+ <Slider.HiddenInput />
236
+ </Slider.Root>
237
+ ```
238
+
239
+ **Sizes:** `sm` | `md` | `lg`
240
+ **Orientation:** `horizontal` | `vertical`
241
+
242
+ #### Switch
243
+
244
+ Toggle switch for on/off states.
245
+
246
+ ```tsx
247
+ import * as Switch from '@discourser/design-system';
248
+
249
+ <Switch.Root>
250
+ <Switch.Control>
251
+ <Switch.Thumb />
252
+ </Switch.Control>
253
+ <Switch.Label>Enable notifications</Switch.Label>
254
+ <Switch.HiddenInput />
255
+ </Switch.Root>
256
+ ```
257
+
258
+ **Sizes:** `sm` | `md` | `lg`
259
+
260
+ #### Textarea
261
+
262
+ Multi-line text input field.
263
+
264
+ ```tsx
265
+ import * as Textarea from '@discourser/design-system';
266
+
267
+ <Textarea.Root variant="outline" placeholder="Enter your message..." />
268
+ ```
269
+
270
+ **Variants:** `outline` | `filled` | `subtle` | `flushed`
271
+ **Sizes:** `xs` | `sm` | `md` | `lg` | `xl`
272
+
273
+ ### Layout & Navigation
274
+
275
+ #### Tabs
276
+
277
+ Tab navigation for organizing content into separate views.
278
+
279
+ ```tsx
280
+ import * as Tabs from '@discourser/design-system';
281
+
282
+ <Tabs.Root defaultValue="overview">
283
+ <Tabs.List>
284
+ <Tabs.Trigger value="overview">Overview</Tabs.Trigger>
285
+ <Tabs.Trigger value="details">Details</Tabs.Trigger>
286
+ <Tabs.Indicator />
287
+ </Tabs.List>
288
+ <Tabs.Content value="overview">Overview content</Tabs.Content>
289
+ <Tabs.Content value="details">Details content</Tabs.Content>
290
+ </Tabs.Root>
291
+ ```
292
+
293
+ **Variants:** `line` | `enclosed` | `outline`
294
+ **Sizes:** `sm` | `md` | `lg`
295
+
296
+ #### Accordion
297
+
298
+ Collapsible content panels for FAQs and expandable sections.
299
+
300
+ ```tsx
301
+ import * as Accordion from '@discourser/design-system';
302
+
303
+ <Accordion.Root collapsible>
304
+ <Accordion.Item value="item-1">
305
+ <Accordion.ItemTrigger>
306
+ Section 1
307
+ <Accordion.ItemIndicator />
308
+ </Accordion.ItemTrigger>
309
+ <Accordion.ItemContent>
310
+ Content for section 1
311
+ </Accordion.ItemContent>
312
+ </Accordion.Item>
313
+ </Accordion.Root>
314
+ ```
315
+
316
+ **Sizes:** `sm` | `md` | `lg`
317
+
318
+ ### Overlays & Dialogs
319
+
320
+ #### Dialog
321
+
322
+ Modal dialog for focused user interactions.
323
+
324
+ ```tsx
325
+ import * as Dialog from '@discourser/design-system';
326
+
327
+ <Dialog.Root>
328
+ <Dialog.Trigger>Open Dialog</Dialog.Trigger>
329
+ <Dialog.Backdrop />
330
+ <Dialog.Positioner>
331
+ <Dialog.Content>
332
+ <Dialog.Title>Dialog Title</Dialog.Title>
333
+ <Dialog.Description>Dialog description</Dialog.Description>
334
+ <Dialog.CloseTrigger />
335
+ </Dialog.Content>
336
+ </Dialog.Positioner>
337
+ </Dialog.Root>
338
+ ```
339
+
340
+ **Sizes:** `sm` | `md` | `lg` | `xl` | `full`
341
+
342
+ #### Drawer
343
+
344
+ Side panel for navigation or additional content.
345
+
346
+ ```tsx
347
+ import * as Drawer from '@discourser/design-system';
348
+
349
+ <Drawer.Root>
350
+ <Drawer.Trigger>Open Drawer</Drawer.Trigger>
351
+ <Drawer.Backdrop />
352
+ <Drawer.Positioner>
353
+ <Drawer.Content>
354
+ <Drawer.Header>
355
+ <Drawer.Title>Drawer Title</Drawer.Title>
356
+ <Drawer.CloseTrigger />
357
+ </Drawer.Header>
358
+ <Drawer.Body>Drawer content</Drawer.Body>
359
+ <Drawer.Footer>Footer content</Drawer.Footer>
360
+ </Drawer.Content>
361
+ </Drawer.Positioner>
362
+ </Drawer.Root>
363
+ ```
364
+
365
+ **Placement:** `left` | `right` | `top` | `bottom`
366
+
367
+ #### Popover
368
+
369
+ Floating content overlay anchored to a trigger element.
370
+
371
+ ```tsx
372
+ import * as Popover from '@discourser/design-system';
373
+
374
+ <Popover.Root>
375
+ <Popover.Trigger>Open Popover</Popover.Trigger>
376
+ <Popover.Positioner>
377
+ <Popover.Content>
378
+ <Popover.Arrow>
379
+ <Popover.ArrowTip />
380
+ </Popover.Arrow>
381
+ <Popover.Title>Popover Title</Popover.Title>
382
+ <Popover.Description>Popover content</Popover.Description>
383
+ <Popover.CloseTrigger />
384
+ </Popover.Content>
385
+ </Popover.Positioner>
386
+ </Popover.Root>
387
+ ```
388
+
389
+ #### Tooltip
390
+
391
+ Brief informative text shown on hover.
392
+
393
+ ```tsx
394
+ import * as Tooltip from '@discourser/design-system';
395
+
396
+ <Tooltip.Root>
397
+ <Tooltip.Trigger>Hover me</Tooltip.Trigger>
398
+ <Tooltip.Positioner>
399
+ <Tooltip.Content>
400
+ Helpful tooltip text
401
+ <Tooltip.Arrow>
402
+ <Tooltip.ArrowTip />
403
+ </Tooltip.Arrow>
404
+ </Tooltip.Content>
405
+ </Tooltip.Positioner>
406
+ </Tooltip.Root>
407
+ ```
408
+
409
+ ### Feedback & Status
410
+
411
+ #### Toast
412
+
413
+ Temporary notification messages.
414
+
415
+ ```tsx
416
+ import { Toaster, toaster } from '@discourser/design-system';
417
+
418
+ // Add <Toaster /> to your app root
419
+ <Toaster />
420
+
421
+ // Trigger toasts from anywhere
422
+ toaster.success({
423
+ title: 'Success!',
424
+ description: 'Your changes have been saved.',
425
+ });
426
+
427
+ toaster.error({
428
+ title: 'Error',
429
+ description: 'Something went wrong.',
430
+ });
431
+ ```
432
+
433
+ **Types:** `success` | `error` | `warning` | `info` | `loading`
434
+
435
+ #### Progress
436
+
437
+ Linear or circular progress indicator.
438
+
439
+ ```tsx
440
+ import * as Progress from '@discourser/design-system';
441
+
442
+ // Linear progress
443
+ <Progress.Root value={60}>
444
+ <Progress.Label>Upload Progress</Progress.Label>
445
+ <Progress.ValueText />
446
+ <Progress.Track>
447
+ <Progress.Range />
448
+ </Progress.Track>
449
+ </Progress.Root>
450
+
451
+ // Circular progress
452
+ <Progress.Root value={75} type="circular">
453
+ <Progress.Circle>
454
+ <Progress.CircleTrack />
455
+ <Progress.CircleRange />
456
+ </Progress.Circle>
457
+ <Progress.ValueText />
458
+ </Progress.Root>
459
+ ```
460
+
461
+ **Sizes:** `sm` | `md` | `lg`
462
+ **Type:** `linear` | `circular`
463
+
464
+ #### Avatar
465
+
466
+ User avatar with image and fallback to initials.
467
+
468
+ ```tsx
469
+ import * as Avatar from '@discourser/design-system';
470
+
471
+ <Avatar.Root>
472
+ <Avatar.Fallback name="John Doe" />
473
+ <Avatar.Image src="https://i.pravatar.cc/150?img=3" alt="John Doe" />
474
+ </Avatar.Root>
475
+ ```
476
+
477
+ **Sizes:** `xs` | `sm` | `md` | `lg` | `xl` | `2xl`
478
+
479
+ #### Badge
480
+
481
+ Small status or label indicator.
482
+
483
+ ```tsx
484
+ import * as Badge from '@discourser/design-system';
485
+
486
+ <Badge.Root>New</Badge.Root>
487
+ ```
488
+
489
+ **Sizes:** `sm` | `md` | `lg`
490
+
491
+ #### Skeleton
492
+
493
+ Loading placeholder for content.
494
+
495
+ ```tsx
496
+ import * as Skeleton from '@discourser/design-system';
497
+
498
+ <Skeleton.Root>
499
+ <Skeleton.Circle />
500
+ <Skeleton.Text noOfLines={3} />
501
+ </Skeleton.Root>
502
+ ```
503
+
109
504
  ## 🎨 Three-Layer Architecture
110
505
 
111
506
  This design system uses an aesthetic-agnostic architecture: