@fragments-sdk/ui 0.4.0 → 0.5.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 (94) hide show
  1. package/README.md +98 -2
  2. package/fragments.json +1 -1
  3. package/package.json +3 -2
  4. package/src/components/Accordion/Accordion.fragment.tsx +1 -1
  5. package/src/components/Alert/Alert.fragment.tsx +1 -1
  6. package/src/components/AppShell/AppShell.fragment.tsx +4 -4
  7. package/src/components/Avatar/Avatar.fragment.tsx +2 -2
  8. package/src/components/Badge/Badge.fragment.tsx +2 -2
  9. package/src/components/Badge/Badge.module.scss +1 -1
  10. package/src/components/Box/Box.fragment.tsx +1 -1
  11. package/src/components/Button/Button.fragment.tsx +2 -2
  12. package/src/components/ButtonGroup/ButtonGroup.fragment.tsx +153 -0
  13. package/src/components/Card/Card.fragment.tsx +1 -1
  14. package/src/components/Chart/Chart.fragment.tsx +213 -0
  15. package/src/components/Chart/Chart.module.scss +123 -0
  16. package/src/components/Chart/index.tsx +267 -0
  17. package/src/components/Checkbox/Checkbox.fragment.tsx +1 -1
  18. package/src/components/CodeBlock/CodeBlock.fragment.tsx +265 -6
  19. package/src/components/CodeBlock/CodeBlock.module.scss +141 -3
  20. package/src/components/CodeBlock/index.tsx +250 -36
  21. package/src/components/Collapsible/Collapsible.fragment.tsx +199 -0
  22. package/src/components/Collapsible/Collapsible.module.scss +117 -0
  23. package/src/components/Collapsible/index.tsx +219 -0
  24. package/src/components/ColorPicker/ColorPicker.fragment.tsx +196 -0
  25. package/src/components/ColorPicker/ColorPicker.module.scss +33 -23
  26. package/src/components/ColorPicker/index.tsx +34 -12
  27. package/src/components/ConversationList/ConversationList.fragment.tsx +202 -0
  28. package/src/components/ConversationList/ConversationList.module.scss +160 -0
  29. package/src/components/ConversationList/index.tsx +254 -0
  30. package/src/components/Dialog/Dialog.fragment.tsx +3 -3
  31. package/src/components/EmptyState/EmptyState.fragment.tsx +2 -2
  32. package/src/components/Field/Field.fragment.tsx +3 -3
  33. package/src/components/Fieldset/Fieldset.fragment.tsx +7 -7
  34. package/src/components/Form/Form.fragment.tsx +11 -11
  35. package/src/components/Grid/Grid.fragment.tsx +1 -1
  36. package/src/components/Header/Header.fragment.tsx +4 -4
  37. package/src/components/Header/Header.module.scss +9 -10
  38. package/src/components/Icon/Icon.fragment.tsx +2 -2
  39. package/src/components/Image/Image.fragment.tsx +2 -2
  40. package/src/components/Input/Input.fragment.tsx +1 -1
  41. package/src/components/Input/Input.module.scss +2 -2
  42. package/src/components/Link/Link.fragment.tsx +1 -1
  43. package/src/components/List/List.fragment.tsx +2 -2
  44. package/src/components/Listbox/Listbox.fragment.tsx +1 -1
  45. package/src/components/Loading/Loading.fragment.tsx +153 -0
  46. package/src/components/Loading/Loading.module.scss +256 -0
  47. package/src/components/Loading/index.tsx +236 -0
  48. package/src/components/Menu/Menu.fragment.tsx +3 -3
  49. package/src/components/Message/Message.fragment.tsx +200 -0
  50. package/src/components/Message/Message.module.scss +224 -0
  51. package/src/components/Message/index.tsx +278 -0
  52. package/src/components/Popover/Popover.fragment.tsx +4 -4
  53. package/src/components/Progress/Progress.fragment.tsx +1 -1
  54. package/src/components/Prompt/Prompt.fragment.tsx +2 -2
  55. package/src/components/RadioGroup/RadioGroup.fragment.tsx +1 -1
  56. package/src/components/RadioGroup/RadioGroup.module.scss +7 -4
  57. package/src/components/Select/Select.fragment.tsx +1 -1
  58. package/src/components/Select/Select.module.scss +8 -0
  59. package/src/components/Select/index.tsx +85 -5
  60. package/src/components/Separator/Separator.fragment.tsx +1 -1
  61. package/src/components/Sidebar/Sidebar.fragment.tsx +2 -2
  62. package/src/components/Sidebar/Sidebar.module.scss +19 -0
  63. package/src/components/Sidebar/index.tsx +52 -11
  64. package/src/components/Skeleton/Skeleton.fragment.tsx +1 -1
  65. package/src/components/Slider/Slider.fragment.tsx +201 -0
  66. package/src/components/Stack/Stack.fragment.tsx +194 -0
  67. package/src/components/Table/Table.fragment.tsx +3 -3
  68. package/src/components/Tabs/Tabs.fragment.tsx +1 -1
  69. package/src/components/Tabs/Tabs.module.scss +2 -2
  70. package/src/components/Text/Text.fragment.tsx +188 -0
  71. package/src/components/Textarea/Textarea.fragment.tsx +1 -1
  72. package/src/components/Theme/Theme.fragment.tsx +2 -2
  73. package/src/components/Theme/ThemeToggle.module.scss +13 -13
  74. package/src/components/ThinkingIndicator/ThinkingIndicator.fragment.tsx +182 -0
  75. package/src/components/ThinkingIndicator/ThinkingIndicator.module.scss +226 -0
  76. package/src/components/ThinkingIndicator/index.tsx +258 -0
  77. package/src/components/Toast/Toast.fragment.tsx +1 -1
  78. package/src/components/Toggle/Toggle.fragment.tsx +1 -1
  79. package/src/components/ToggleGroup/ToggleGroup.fragment.tsx +207 -0
  80. package/src/components/Tooltip/Tooltip.fragment.tsx +3 -3
  81. package/src/components/VisuallyHidden/VisuallyHidden.fragment.tsx +2 -2
  82. package/src/index.ts +86 -3
  83. package/src/recipes/AIChat.recipe.ts +266 -0
  84. package/src/tokens/_computed.scss +212 -0
  85. package/src/tokens/_density.scss +171 -0
  86. package/src/tokens/_derive.scss +287 -0
  87. package/src/tokens/_index.scss +39 -1
  88. package/src/tokens/_mixins.scss +41 -0
  89. package/src/tokens/_palettes.scss +185 -0
  90. package/src/tokens/_radius.scss +107 -0
  91. package/src/tokens/_seeds.scss +59 -0
  92. package/src/tokens/_variables.scss +171 -130
  93. package/src/components/ColorChip/ColorChip.module.scss +0 -165
  94. package/src/components/ColorChip/index.tsx +0 -157
package/README.md CHANGED
@@ -71,13 +71,82 @@ function App() {
71
71
 
72
72
  ## Design Tokens
73
73
 
74
- Access SCSS variables and mixins for custom styling:
74
+ ### Seed-Based Configuration (Recommended)
75
+
76
+ Configure ~5-10 seeds and everything derives automatically. Set seed variables in your SCSS before importing:
77
+
78
+ ```scss
79
+ // styles/globals.scss
80
+
81
+ // Minimal setup - just your brand color
82
+ $fui-brand: #0066ff;
83
+ @use '@fragments-sdk/ui/globals';
84
+ ```
85
+
86
+ ```scss
87
+ // Full customization
88
+ $fui-brand: #0066ff; // Primary brand color
89
+ $fui-neutral: "steel"; // Palette: "steel" | "sand" | "smoke" | "ash" | "silver"
90
+ $fui-density: "compact"; // Spacing: "compact" | "default" | "relaxed"
91
+ $fui-radius-style: "rounded"; // Corners: "sharp" | "subtle" | "default" | "rounded" | "pill"
92
+
93
+ // Optional semantic color overrides
94
+ $fui-danger: #dc2626;
95
+ $fui-success: #16a34a;
96
+
97
+ @use '@fragments-sdk/ui/globals';
98
+ ```
99
+
100
+ #### Available Seeds
101
+
102
+ | Seed | Type | Default | Description |
103
+ |------|------|---------|-------------|
104
+ | `$fui-brand` | Color | `#18181b` | Primary brand color - derives accent, focus rings, etc. |
105
+ | `$fui-neutral` | String | `"ash"` | Neutral palette for surfaces, text, borders |
106
+ | `$fui-density` | String | `"default"` | Spacing density scale |
107
+ | `$fui-radius-style` | String | `"default"` | Corner radius style |
108
+ | `$fui-danger` | Color | `#ef4444` | Error/danger semantic color |
109
+ | `$fui-success` | Color | `#22c55e` | Success semantic color |
110
+ | `$fui-warning` | Color | `#f59e0b` | Warning semantic color |
111
+ | `$fui-info` | Color | `#3b82f6` | Info semantic color |
112
+
113
+ #### Neutral Palettes
114
+
115
+ | Name | Description |
116
+ |------|-------------|
117
+ | `steel` | Cool blue-tinted grays (professional, tech) |
118
+ | `sand` | Warm brown-tinted grays (organic, approachable) |
119
+ | `smoke` | Pure true grays (minimal, neutral) |
120
+ | `ash` | Muted cool neutrals (subtle, balanced) - default |
121
+ | `silver` | Bright clean grays (light, modern) |
122
+
123
+ #### Density Presets
124
+
125
+ | Name | Base Unit | Feel |
126
+ |------|-----------|------|
127
+ | `compact` | 6px | Tighter spacing, smaller elements |
128
+ | `default` | 7px | Balanced, current visual appearance |
129
+ | `relaxed` | 8px | More spacious layout |
130
+
131
+ #### Radius Styles
132
+
133
+ | Name | Feel |
134
+ |------|------|
135
+ | `sharp` | No rounding (technical, precise) |
136
+ | `subtle` | Minimal rounding (modern minimal) |
137
+ | `default` | Balanced rounding (current) |
138
+ | `rounded` | More prominent (friendly) |
139
+ | `pill` | Maximum rounding (playful, soft) |
140
+
141
+ ### Individual Token Overrides (Backward Compatible)
142
+
143
+ You can still override individual tokens directly:
75
144
 
76
145
  ```scss
77
146
  @use '@fragments-sdk/ui/tokens' as *;
78
147
 
79
148
  .custom {
80
- padding: $fui-spacing-4;
149
+ padding: $fui-space-4;
81
150
  border-radius: $fui-radius-md;
82
151
  color: var(--fui-text-primary);
83
152
  }
@@ -105,6 +174,33 @@ Access SCSS variables and mixins for custom styling:
105
174
  | `$fui-breakpoint-lg` | 1024px |
106
175
  | `$fui-breakpoint-xl` | 1280px |
107
176
 
177
+ ### Migration Guide
178
+
179
+ **Existing code continues to work.** The seed system is fully backward compatible:
180
+
181
+ - Existing `@use '@fragments/ui/tokens'` imports work unchanged
182
+ - Individual variable overrides (`$fui-color-accent: #blue`) still work
183
+ - CSS variable usage (`var(--fui-color-accent)`) works
184
+ - Component APIs remain the same
185
+ - Visual appearance is unchanged with default seeds
186
+
187
+ **To migrate to seeds (optional):**
188
+
189
+ 1. Instead of overriding many individual tokens, set seed values:
190
+ ```scss
191
+ // Before: many individual overrides
192
+ $fui-color-accent: #0066ff;
193
+ $fui-color-accent-hover: #0052cc;
194
+ $fui-bg-secondary: #f1f5f9;
195
+ // ...many more
196
+
197
+ // After: just seeds
198
+ $fui-brand: #0066ff;
199
+ $fui-neutral: "steel";
200
+ ```
201
+
202
+ 2. Dark mode, hover states, and derived colors are computed automatically
203
+
108
204
  ## AI Agent Support
109
205
 
110
206
  This package ships a `fragments.json` file that describes every component's props, usage guidelines, accessibility rules, and code examples. AI agents can access this data through the [`@fragments-sdk/mcp`](https://www.npmjs.com/package/@fragments-sdk/mcp) server.