@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.
- package/README.md +98 -2
- package/fragments.json +1 -1
- package/package.json +3 -2
- package/src/components/Accordion/Accordion.fragment.tsx +1 -1
- package/src/components/Alert/Alert.fragment.tsx +1 -1
- package/src/components/AppShell/AppShell.fragment.tsx +4 -4
- package/src/components/Avatar/Avatar.fragment.tsx +2 -2
- package/src/components/Badge/Badge.fragment.tsx +2 -2
- package/src/components/Badge/Badge.module.scss +1 -1
- package/src/components/Box/Box.fragment.tsx +1 -1
- package/src/components/Button/Button.fragment.tsx +2 -2
- package/src/components/ButtonGroup/ButtonGroup.fragment.tsx +153 -0
- package/src/components/Card/Card.fragment.tsx +1 -1
- package/src/components/Chart/Chart.fragment.tsx +213 -0
- package/src/components/Chart/Chart.module.scss +123 -0
- package/src/components/Chart/index.tsx +267 -0
- package/src/components/Checkbox/Checkbox.fragment.tsx +1 -1
- package/src/components/CodeBlock/CodeBlock.fragment.tsx +265 -6
- package/src/components/CodeBlock/CodeBlock.module.scss +141 -3
- package/src/components/CodeBlock/index.tsx +250 -36
- package/src/components/Collapsible/Collapsible.fragment.tsx +199 -0
- package/src/components/Collapsible/Collapsible.module.scss +117 -0
- package/src/components/Collapsible/index.tsx +219 -0
- package/src/components/ColorPicker/ColorPicker.fragment.tsx +196 -0
- package/src/components/ColorPicker/ColorPicker.module.scss +33 -23
- package/src/components/ColorPicker/index.tsx +34 -12
- package/src/components/ConversationList/ConversationList.fragment.tsx +202 -0
- package/src/components/ConversationList/ConversationList.module.scss +160 -0
- package/src/components/ConversationList/index.tsx +254 -0
- package/src/components/Dialog/Dialog.fragment.tsx +3 -3
- package/src/components/EmptyState/EmptyState.fragment.tsx +2 -2
- package/src/components/Field/Field.fragment.tsx +3 -3
- package/src/components/Fieldset/Fieldset.fragment.tsx +7 -7
- package/src/components/Form/Form.fragment.tsx +11 -11
- package/src/components/Grid/Grid.fragment.tsx +1 -1
- package/src/components/Header/Header.fragment.tsx +4 -4
- package/src/components/Header/Header.module.scss +9 -10
- package/src/components/Icon/Icon.fragment.tsx +2 -2
- package/src/components/Image/Image.fragment.tsx +2 -2
- package/src/components/Input/Input.fragment.tsx +1 -1
- package/src/components/Input/Input.module.scss +2 -2
- package/src/components/Link/Link.fragment.tsx +1 -1
- package/src/components/List/List.fragment.tsx +2 -2
- package/src/components/Listbox/Listbox.fragment.tsx +1 -1
- package/src/components/Loading/Loading.fragment.tsx +153 -0
- package/src/components/Loading/Loading.module.scss +256 -0
- package/src/components/Loading/index.tsx +236 -0
- package/src/components/Menu/Menu.fragment.tsx +3 -3
- package/src/components/Message/Message.fragment.tsx +200 -0
- package/src/components/Message/Message.module.scss +224 -0
- package/src/components/Message/index.tsx +278 -0
- package/src/components/Popover/Popover.fragment.tsx +4 -4
- package/src/components/Progress/Progress.fragment.tsx +1 -1
- package/src/components/Prompt/Prompt.fragment.tsx +2 -2
- package/src/components/RadioGroup/RadioGroup.fragment.tsx +1 -1
- package/src/components/RadioGroup/RadioGroup.module.scss +7 -4
- package/src/components/Select/Select.fragment.tsx +1 -1
- package/src/components/Select/Select.module.scss +8 -0
- package/src/components/Select/index.tsx +85 -5
- package/src/components/Separator/Separator.fragment.tsx +1 -1
- package/src/components/Sidebar/Sidebar.fragment.tsx +2 -2
- package/src/components/Sidebar/Sidebar.module.scss +19 -0
- package/src/components/Sidebar/index.tsx +52 -11
- package/src/components/Skeleton/Skeleton.fragment.tsx +1 -1
- package/src/components/Slider/Slider.fragment.tsx +201 -0
- package/src/components/Stack/Stack.fragment.tsx +194 -0
- package/src/components/Table/Table.fragment.tsx +3 -3
- package/src/components/Tabs/Tabs.fragment.tsx +1 -1
- package/src/components/Tabs/Tabs.module.scss +2 -2
- package/src/components/Text/Text.fragment.tsx +188 -0
- package/src/components/Textarea/Textarea.fragment.tsx +1 -1
- package/src/components/Theme/Theme.fragment.tsx +2 -2
- package/src/components/Theme/ThemeToggle.module.scss +13 -13
- package/src/components/ThinkingIndicator/ThinkingIndicator.fragment.tsx +182 -0
- package/src/components/ThinkingIndicator/ThinkingIndicator.module.scss +226 -0
- package/src/components/ThinkingIndicator/index.tsx +258 -0
- package/src/components/Toast/Toast.fragment.tsx +1 -1
- package/src/components/Toggle/Toggle.fragment.tsx +1 -1
- package/src/components/ToggleGroup/ToggleGroup.fragment.tsx +207 -0
- package/src/components/Tooltip/Tooltip.fragment.tsx +3 -3
- package/src/components/VisuallyHidden/VisuallyHidden.fragment.tsx +2 -2
- package/src/index.ts +86 -3
- package/src/recipes/AIChat.recipe.ts +266 -0
- package/src/tokens/_computed.scss +212 -0
- package/src/tokens/_density.scss +171 -0
- package/src/tokens/_derive.scss +287 -0
- package/src/tokens/_index.scss +39 -1
- package/src/tokens/_mixins.scss +41 -0
- package/src/tokens/_palettes.scss +185 -0
- package/src/tokens/_radius.scss +107 -0
- package/src/tokens/_seeds.scss +59 -0
- package/src/tokens/_variables.scss +171 -130
- package/src/components/ColorChip/ColorChip.module.scss +0 -165
- package/src/components/ColorChip/index.tsx +0 -157
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// @fragments/ui Elemental Palettes
|
|
3
|
+
// ============================================
|
|
4
|
+
//
|
|
5
|
+
// Defines 5 elemental palettes with 11 shades (50-950).
|
|
6
|
+
// Each palette has a distinct tonal character.
|
|
7
|
+
//
|
|
8
|
+
// ============================================
|
|
9
|
+
|
|
10
|
+
@use 'sass:color';
|
|
11
|
+
@use 'sass:map';
|
|
12
|
+
@use 'sass:math';
|
|
13
|
+
|
|
14
|
+
// --------------------------------------------
|
|
15
|
+
// Wind - Muted cool neutrals (Default)
|
|
16
|
+
// Subtle, balanced feel - matches current zinc-like palette
|
|
17
|
+
// --------------------------------------------
|
|
18
|
+
$palette-wind: (
|
|
19
|
+
50: #fafafa,
|
|
20
|
+
100: #f4f4f5,
|
|
21
|
+
200: #e4e4e7,
|
|
22
|
+
300: #d4d4d8,
|
|
23
|
+
400: #a1a1aa,
|
|
24
|
+
500: #71717a,
|
|
25
|
+
600: #52525b,
|
|
26
|
+
700: #3f3f46,
|
|
27
|
+
800: #27272a,
|
|
28
|
+
900: #18181b,
|
|
29
|
+
950: #09090b
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
// --------------------------------------------
|
|
33
|
+
// Ice - Cool blue tones
|
|
34
|
+
// Professional, tech feel
|
|
35
|
+
// --------------------------------------------
|
|
36
|
+
$palette-ice: (
|
|
37
|
+
50: #f0f9ff,
|
|
38
|
+
100: #e0f2fe,
|
|
39
|
+
200: #bae6fd,
|
|
40
|
+
300: #7dd3fc,
|
|
41
|
+
400: #38bdf8,
|
|
42
|
+
500: #0ea5e9,
|
|
43
|
+
600: #0284c7,
|
|
44
|
+
700: #0369a1,
|
|
45
|
+
800: #075985,
|
|
46
|
+
900: #0c4a6e,
|
|
47
|
+
950: #082f49
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// --------------------------------------------
|
|
51
|
+
// Sand - Warm brown/terracotta tones
|
|
52
|
+
// Organic, earthy feel
|
|
53
|
+
// --------------------------------------------
|
|
54
|
+
$palette-sand: (
|
|
55
|
+
50: #fdf8f3,
|
|
56
|
+
100: #f5ebe0,
|
|
57
|
+
200: #e8d5c4,
|
|
58
|
+
300: #d4b89c,
|
|
59
|
+
400: #c19a6b,
|
|
60
|
+
500: #a67c52,
|
|
61
|
+
600: #8b5e34,
|
|
62
|
+
700: #6f4518,
|
|
63
|
+
800: #553311,
|
|
64
|
+
900: #3d240c,
|
|
65
|
+
950: #261607
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// --------------------------------------------
|
|
69
|
+
// Earth - Green/olive tones
|
|
70
|
+
// Natural, growth feel
|
|
71
|
+
// --------------------------------------------
|
|
72
|
+
$palette-earth: (
|
|
73
|
+
50: #f5f7f2,
|
|
74
|
+
100: #e8ede3,
|
|
75
|
+
200: #d1dbc6,
|
|
76
|
+
300: #b3c4a0,
|
|
77
|
+
400: #8fa872,
|
|
78
|
+
500: #6b8c4e,
|
|
79
|
+
600: #517035,
|
|
80
|
+
700: #3d5527,
|
|
81
|
+
800: #2b3d1c,
|
|
82
|
+
900: #1c2912,
|
|
83
|
+
950: #0f170a
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
// --------------------------------------------
|
|
87
|
+
// Fire - Warm red/orange tones
|
|
88
|
+
// Energy, passion feel
|
|
89
|
+
// --------------------------------------------
|
|
90
|
+
$palette-fire: (
|
|
91
|
+
50: #fff7ed,
|
|
92
|
+
100: #ffedd5,
|
|
93
|
+
200: #fed7aa,
|
|
94
|
+
300: #fdba74,
|
|
95
|
+
400: #fb923c,
|
|
96
|
+
500: #f97316,
|
|
97
|
+
600: #ea580c,
|
|
98
|
+
700: #c2410c,
|
|
99
|
+
800: #9a3412,
|
|
100
|
+
900: #7c2d12,
|
|
101
|
+
950: #431407
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
// --------------------------------------------
|
|
105
|
+
// Palette Map for Dynamic Access
|
|
106
|
+
// --------------------------------------------
|
|
107
|
+
$palettes: (
|
|
108
|
+
"wind": $palette-wind,
|
|
109
|
+
"ice": $palette-ice,
|
|
110
|
+
"sand": $palette-sand,
|
|
111
|
+
"earth": $palette-earth,
|
|
112
|
+
"fire": $palette-fire
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
// --------------------------------------------
|
|
116
|
+
// Helper Functions
|
|
117
|
+
// --------------------------------------------
|
|
118
|
+
|
|
119
|
+
/// Get a palette map by name
|
|
120
|
+
/// @param {String} $name - Palette name (wind, ice, sand, earth, fire)
|
|
121
|
+
/// @return {Map} The palette map with shades 50-950
|
|
122
|
+
@function get-palette($name) {
|
|
123
|
+
@if not map.has-key($palettes, $name) {
|
|
124
|
+
@warn "Unknown palette '#{$name}'. Using 'wind' as fallback.";
|
|
125
|
+
@return $palette-wind;
|
|
126
|
+
}
|
|
127
|
+
@return map.get($palettes, $name);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/// Get a specific shade from a palette
|
|
131
|
+
/// @param {Map} $palette - A palette map
|
|
132
|
+
/// @param {Number} $level - Shade level (50, 100, 200, ..., 950)
|
|
133
|
+
/// @return {Color} The color at that shade level
|
|
134
|
+
@function get-shade($palette, $level) {
|
|
135
|
+
@if not map.has-key($palette, $level) {
|
|
136
|
+
@warn "Unknown shade level '#{$level}'. Using 500 as fallback.";
|
|
137
|
+
@return map.get($palette, 500);
|
|
138
|
+
}
|
|
139
|
+
@return map.get($palette, $level);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/// Interpolate between two shade levels for half-steps (e.g., 925)
|
|
143
|
+
/// @param {Map} $palette - A palette map
|
|
144
|
+
/// @param {Number} $level - Target shade level (can be non-standard like 925)
|
|
145
|
+
/// @return {Color} The interpolated color
|
|
146
|
+
@function interpolate-shade($palette, $level) {
|
|
147
|
+
// Handle standard levels
|
|
148
|
+
@if map.has-key($palette, $level) {
|
|
149
|
+
@return map.get($palette, $level);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Find surrounding levels for interpolation
|
|
153
|
+
$levels: (50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950);
|
|
154
|
+
$lower: null;
|
|
155
|
+
$upper: null;
|
|
156
|
+
|
|
157
|
+
@each $l in $levels {
|
|
158
|
+
@if $l < $level {
|
|
159
|
+
$lower: $l;
|
|
160
|
+
}
|
|
161
|
+
@if $l > $level and $upper == null {
|
|
162
|
+
$upper: $l;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@if $lower == null or $upper == null {
|
|
167
|
+
@warn "Cannot interpolate shade '#{$level}'. Using 500 as fallback.";
|
|
168
|
+
@return map.get($palette, 500);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
$lower-color: map.get($palette, $lower);
|
|
172
|
+
$upper-color: map.get($palette, $upper);
|
|
173
|
+
$ratio: math.div($level - $lower, $upper - $lower);
|
|
174
|
+
|
|
175
|
+
@return color.mix($upper-color, $lower-color, $ratio * 100%);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/// Get a palette by name and return a specific shade
|
|
179
|
+
/// @param {String} $name - Palette name
|
|
180
|
+
/// @param {Number} $level - Shade level
|
|
181
|
+
/// @return {Color} The color
|
|
182
|
+
@function palette-shade($name, $level) {
|
|
183
|
+
$palette: get-palette($name);
|
|
184
|
+
@return get-shade($palette, $level);
|
|
185
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// @fragments/ui Radius Styles
|
|
3
|
+
// ============================================
|
|
4
|
+
//
|
|
5
|
+
// Defines 5 radius style presets that control corner rounding.
|
|
6
|
+
// Each style maps to sm, md, lg, xl values.
|
|
7
|
+
//
|
|
8
|
+
// ============================================
|
|
9
|
+
|
|
10
|
+
@use 'sass:map';
|
|
11
|
+
|
|
12
|
+
// --------------------------------------------
|
|
13
|
+
// Radius Style Definitions
|
|
14
|
+
// --------------------------------------------
|
|
15
|
+
|
|
16
|
+
// Sharp - No visible rounding (technical, precise)
|
|
17
|
+
$radius-sharp: (
|
|
18
|
+
sm: 0,
|
|
19
|
+
md: 0,
|
|
20
|
+
lg: 0,
|
|
21
|
+
xl: 0
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
// Subtle - Minimal rounding (modern minimal)
|
|
25
|
+
$radius-subtle: (
|
|
26
|
+
sm: 0.125rem, // 2px
|
|
27
|
+
md: 0.25rem, // 4px
|
|
28
|
+
lg: 0.375rem, // 6px
|
|
29
|
+
xl: 0.5rem // 8px
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
// Default - Balanced rounding (current values)
|
|
33
|
+
$radius-default: (
|
|
34
|
+
sm: 0.25rem, // 3.5px -> 4px
|
|
35
|
+
md: 0.429rem, // 6px
|
|
36
|
+
lg: 0.571rem, // 8px
|
|
37
|
+
xl: 0.857rem // 12px
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// Rounded - More prominent rounding (friendly)
|
|
41
|
+
$radius-rounded: (
|
|
42
|
+
sm: 0.375rem, // 6px
|
|
43
|
+
md: 0.5rem, // 8px
|
|
44
|
+
lg: 0.75rem, // 12px
|
|
45
|
+
xl: 1rem // 16px
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// Pill - Maximum rounding (playful, soft)
|
|
49
|
+
$radius-pill: (
|
|
50
|
+
sm: 0.5rem, // 8px
|
|
51
|
+
md: 0.75rem, // 12px
|
|
52
|
+
lg: 1rem, // 16px
|
|
53
|
+
xl: 1.5rem // 24px
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// --------------------------------------------
|
|
57
|
+
// Radius Map for Dynamic Access
|
|
58
|
+
// --------------------------------------------
|
|
59
|
+
$radius-styles: (
|
|
60
|
+
"sharp": $radius-sharp,
|
|
61
|
+
"subtle": $radius-subtle,
|
|
62
|
+
"default": $radius-default,
|
|
63
|
+
"rounded": $radius-rounded,
|
|
64
|
+
"pill": $radius-pill
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
// --------------------------------------------
|
|
68
|
+
// Helper Functions
|
|
69
|
+
// --------------------------------------------
|
|
70
|
+
|
|
71
|
+
/// Get a radius style configuration by name
|
|
72
|
+
/// @param {String} $name - Radius style name (sharp, subtle, default, rounded, pill)
|
|
73
|
+
/// @return {Map} The radius configuration map
|
|
74
|
+
@function get-radius-style($name) {
|
|
75
|
+
@if not map.has-key($radius-styles, $name) {
|
|
76
|
+
@warn "Unknown radius style '#{$name}'. Using 'default' as fallback.";
|
|
77
|
+
@return $radius-default;
|
|
78
|
+
}
|
|
79
|
+
@return map.get($radius-styles, $name);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/// Get a specific radius value from a style
|
|
83
|
+
/// @param {Map} $style - A radius style map
|
|
84
|
+
/// @param {String} $size - Size key (sm, md, lg, xl)
|
|
85
|
+
/// @return {Number} The radius value
|
|
86
|
+
@function radius-value($style, $size) {
|
|
87
|
+
@if not map.has-key($style, $size) {
|
|
88
|
+
@warn "Unknown radius size '#{$size}'.";
|
|
89
|
+
@return map.get($style, md);
|
|
90
|
+
}
|
|
91
|
+
@return map.get($style, $size);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/// Get radius by style name and size
|
|
95
|
+
/// @param {String} $style-name - Radius style name
|
|
96
|
+
/// @param {String} $size - Size key (sm, md, lg, xl)
|
|
97
|
+
/// @return {Number} The radius value
|
|
98
|
+
@function radius($style-name, $size) {
|
|
99
|
+
$style: get-radius-style($style-name);
|
|
100
|
+
@return radius-value($style, $size);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// Full/circular radius (always the same)
|
|
104
|
+
/// @return {Number} The full radius value
|
|
105
|
+
@function radius-full() {
|
|
106
|
+
@return 9999px;
|
|
107
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// @fragments/ui Design Token Seeds
|
|
3
|
+
// ============================================
|
|
4
|
+
//
|
|
5
|
+
// User-configurable seed tokens for the design system.
|
|
6
|
+
// Override these before importing to customize your theme.
|
|
7
|
+
//
|
|
8
|
+
// Example:
|
|
9
|
+
// $fui-brand: #0066ff;
|
|
10
|
+
// $fui-neutral: "steel";
|
|
11
|
+
// $fui-density: "compact";
|
|
12
|
+
// @use '@fragments-sdk/ui/globals';
|
|
13
|
+
//
|
|
14
|
+
// ============================================
|
|
15
|
+
|
|
16
|
+
// --------------------------------------------
|
|
17
|
+
// Core Seeds
|
|
18
|
+
// --------------------------------------------
|
|
19
|
+
|
|
20
|
+
/// Primary brand color - derives accent colors, focus rings, etc.
|
|
21
|
+
/// @type Color
|
|
22
|
+
$fui-brand: #18181b !default;
|
|
23
|
+
|
|
24
|
+
/// Neutral palette name for surfaces, text, and borders
|
|
25
|
+
/// Options: "wind" | "ice" | "earth" | "sand" | "fire"
|
|
26
|
+
/// @type String
|
|
27
|
+
$fui-neutral: "wind" !default;
|
|
28
|
+
|
|
29
|
+
/// Density preset controlling spacing scale
|
|
30
|
+
/// Options: "compact" | "default" | "relaxed"
|
|
31
|
+
/// @type String
|
|
32
|
+
$fui-density: "default" !default;
|
|
33
|
+
|
|
34
|
+
/// Radius style for borders and corners
|
|
35
|
+
/// Options: "sharp" | "subtle" | "default" | "rounded" | "pill"
|
|
36
|
+
/// @type String
|
|
37
|
+
$fui-radius-style: "default" !default;
|
|
38
|
+
|
|
39
|
+
// --------------------------------------------
|
|
40
|
+
// Semantic Color Overrides (Optional)
|
|
41
|
+
// --------------------------------------------
|
|
42
|
+
// Override these to customize semantic colors.
|
|
43
|
+
// If not overridden, they use sensible defaults.
|
|
44
|
+
|
|
45
|
+
/// Danger/error color (defaults to red-500)
|
|
46
|
+
/// @type Color
|
|
47
|
+
$fui-danger: #ef4444 !default;
|
|
48
|
+
|
|
49
|
+
/// Success color (defaults to green-500)
|
|
50
|
+
/// @type Color
|
|
51
|
+
$fui-success: #22c55e !default;
|
|
52
|
+
|
|
53
|
+
/// Warning color (defaults to amber-500)
|
|
54
|
+
/// @type Color
|
|
55
|
+
$fui-warning: #f59e0b !default;
|
|
56
|
+
|
|
57
|
+
/// Info color (defaults to blue-500)
|
|
58
|
+
/// @type Color
|
|
59
|
+
$fui-info: #3b82f6 !default;
|