@fragments-sdk/ui 0.1.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 (73) hide show
  1. package/package.json +44 -0
  2. package/src/brand.ts +15 -0
  3. package/src/components/Alert/Alert.fragment.tsx +163 -0
  4. package/src/components/Alert/Alert.module.scss +116 -0
  5. package/src/components/Alert/index.tsx +95 -0
  6. package/src/components/Avatar/Avatar.fragment.tsx +147 -0
  7. package/src/components/Avatar/Avatar.module.scss +136 -0
  8. package/src/components/Avatar/index.tsx +177 -0
  9. package/src/components/Badge/Badge.fragment.tsx +151 -0
  10. package/src/components/Badge/Badge.module.scss +87 -0
  11. package/src/components/Badge/index.tsx +55 -0
  12. package/src/components/Button/Button.fragment.tsx +159 -0
  13. package/src/components/Button/Button.module.scss +97 -0
  14. package/src/components/Button/index.tsx +51 -0
  15. package/src/components/Card/Card.fragment.tsx +156 -0
  16. package/src/components/Card/Card.module.scss +86 -0
  17. package/src/components/Card/index.tsx +79 -0
  18. package/src/components/Checkbox/Checkbox.fragment.tsx +166 -0
  19. package/src/components/Checkbox/Checkbox.module.scss +144 -0
  20. package/src/components/Checkbox/index.tsx +166 -0
  21. package/src/components/Dialog/Dialog.fragment.tsx +179 -0
  22. package/src/components/Dialog/Dialog.module.scss +158 -0
  23. package/src/components/Dialog/index.tsx +230 -0
  24. package/src/components/EmptyState/EmptyState.fragment.tsx +222 -0
  25. package/src/components/EmptyState/EmptyState.module.scss +120 -0
  26. package/src/components/EmptyState/index.tsx +80 -0
  27. package/src/components/Input/Input.fragment.tsx +174 -0
  28. package/src/components/Input/Input.module.scss +64 -0
  29. package/src/components/Input/index.tsx +76 -0
  30. package/src/components/Menu/Menu.fragment.tsx +168 -0
  31. package/src/components/Menu/Menu.module.scss +190 -0
  32. package/src/components/Menu/index.tsx +318 -0
  33. package/src/components/Popover/Popover.fragment.tsx +178 -0
  34. package/src/components/Popover/Popover.module.scss +165 -0
  35. package/src/components/Popover/index.tsx +229 -0
  36. package/src/components/Progress/Progress.fragment.tsx +142 -0
  37. package/src/components/Progress/Progress.module.scss +185 -0
  38. package/src/components/Progress/index.tsx +196 -0
  39. package/src/components/RadioGroup/RadioGroup.fragment.tsx +188 -0
  40. package/src/components/RadioGroup/RadioGroup.module.scss +155 -0
  41. package/src/components/RadioGroup/index.tsx +166 -0
  42. package/src/components/Select/Select.fragment.tsx +173 -0
  43. package/src/components/Select/Select.module.scss +187 -0
  44. package/src/components/Select/index.tsx +233 -0
  45. package/src/components/Separator/Separator.fragment.tsx +148 -0
  46. package/src/components/Separator/Separator.module.scss +92 -0
  47. package/src/components/Separator/index.tsx +89 -0
  48. package/src/components/Skeleton/Skeleton.fragment.tsx +147 -0
  49. package/src/components/Skeleton/Skeleton.module.scss +166 -0
  50. package/src/components/Skeleton/index.tsx +185 -0
  51. package/src/components/Table/Table.fragment.tsx +193 -0
  52. package/src/components/Table/Table.module.scss +152 -0
  53. package/src/components/Table/index.tsx +266 -0
  54. package/src/components/Tabs/Tabs.fragment.tsx +155 -0
  55. package/src/components/Tabs/Tabs.module.scss +142 -0
  56. package/src/components/Tabs/index.tsx +142 -0
  57. package/src/components/Textarea/Textarea.fragment.tsx +171 -0
  58. package/src/components/Textarea/Textarea.module.scss +89 -0
  59. package/src/components/Textarea/index.tsx +128 -0
  60. package/src/components/Toast/Toast.fragment.tsx +210 -0
  61. package/src/components/Toast/Toast.module.scss +227 -0
  62. package/src/components/Toast/index.tsx +315 -0
  63. package/src/components/Toggle/Toggle.fragment.tsx +174 -0
  64. package/src/components/Toggle/Toggle.module.scss +103 -0
  65. package/src/components/Toggle/index.tsx +80 -0
  66. package/src/components/Tooltip/Tooltip.fragment.tsx +158 -0
  67. package/src/components/Tooltip/Tooltip.module.scss +82 -0
  68. package/src/components/Tooltip/index.tsx +135 -0
  69. package/src/index.ts +151 -0
  70. package/src/scss.d.ts +4 -0
  71. package/src/styles/globals.scss +17 -0
  72. package/src/tokens/_mixins.scss +93 -0
  73. package/src/tokens/_variables.scss +276 -0
@@ -0,0 +1,17 @@
1
+ // ============================================
2
+ // @fragments/ui Global Styles
3
+ // ============================================
4
+ // Import this file once in your app to set up CSS custom properties
5
+ // for theming. This enables automatic dark mode support.
6
+ //
7
+ // Usage in your app:
8
+ // import '@fragments/ui/styles/globals.scss';
9
+ //
10
+ // Or in SCSS:
11
+ // @use '@fragments/ui/styles/globals';
12
+ // ============================================
13
+
14
+ @use '../tokens/variables' as *;
15
+
16
+ // Output all CSS custom properties
17
+ @include fui-css-variables;
@@ -0,0 +1,93 @@
1
+ // ============================================
2
+ // @fragments/ui Shared Mixins
3
+ // ============================================
4
+
5
+ @use 'variables' as *;
6
+
7
+ // Focus ring for keyboard accessibility
8
+ @mixin focus-ring {
9
+ outline: none;
10
+ box-shadow:
11
+ 0 0 0 var(--fui-focus-ring-offset, #{$fui-focus-ring-offset}) var(--fui-bg-primary, #{$fui-bg-primary}),
12
+ 0 0 0 calc(var(--fui-focus-ring-offset, #{$fui-focus-ring-offset}) + var(--fui-focus-ring-width, #{$fui-focus-ring-width})) var(--fui-focus-ring-color, #{$fui-focus-ring-color});
13
+ }
14
+
15
+ // Reset button styles
16
+ @mixin button-reset {
17
+ appearance: none;
18
+ background: transparent;
19
+ border: none;
20
+ padding: 0;
21
+ margin: 0;
22
+ font: inherit;
23
+ color: inherit;
24
+ cursor: pointer;
25
+
26
+ &:disabled {
27
+ cursor: not-allowed;
28
+ }
29
+ }
30
+
31
+ // Base interactive element
32
+ @mixin interactive-base {
33
+ transition:
34
+ background-color var(--fui-transition-fast, #{$fui-transition-fast}),
35
+ border-color var(--fui-transition-fast, #{$fui-transition-fast}),
36
+ box-shadow var(--fui-transition-fast, #{$fui-transition-fast}),
37
+ opacity var(--fui-transition-fast, #{$fui-transition-fast});
38
+
39
+ &:focus-visible {
40
+ @include focus-ring;
41
+ }
42
+
43
+ &:disabled,
44
+ &[data-disabled] {
45
+ opacity: 0.5;
46
+ pointer-events: none;
47
+ }
48
+ }
49
+
50
+ // Typography base
51
+ @mixin text-base {
52
+ font-family: var(--fui-font-sans, #{$fui-font-sans});
53
+ font-size: var(--fui-font-size-sm, #{$fui-font-size-sm});
54
+ line-height: var(--fui-line-height-normal, #{$fui-line-height-normal});
55
+ color: var(--fui-text-primary, #{$fui-text-primary});
56
+ -webkit-font-smoothing: antialiased;
57
+ -moz-osx-font-smoothing: grayscale;
58
+ }
59
+
60
+ // Label text
61
+ @mixin label-text {
62
+ font-family: var(--fui-font-sans, #{$fui-font-sans});
63
+ font-size: var(--fui-font-size-sm, #{$fui-font-size-sm});
64
+ font-weight: var(--fui-font-weight-medium, #{$fui-font-weight-medium});
65
+ color: var(--fui-text-primary, #{$fui-text-primary});
66
+ }
67
+
68
+ // Helper/caption text
69
+ @mixin helper-text {
70
+ font-family: var(--fui-font-sans, #{$fui-font-sans});
71
+ font-size: var(--fui-font-size-xs, #{$fui-font-size-xs});
72
+ color: var(--fui-text-secondary, #{$fui-text-secondary});
73
+ }
74
+
75
+ // Card surface
76
+ @mixin surface-elevated {
77
+ background-color: var(--fui-bg-elevated, #{$fui-bg-elevated});
78
+ border: 1px solid var(--fui-border, #{$fui-border});
79
+ border-radius: var(--fui-radius-lg, #{$fui-radius-lg});
80
+ }
81
+
82
+ // Visually hidden (for screen readers)
83
+ @mixin visually-hidden {
84
+ position: absolute;
85
+ width: 1px;
86
+ height: 1px;
87
+ padding: 0;
88
+ margin: -1px;
89
+ overflow: hidden;
90
+ clip: rect(0, 0, 0, 0);
91
+ white-space: nowrap;
92
+ border: 0;
93
+ }
@@ -0,0 +1,276 @@
1
+ // ============================================
2
+ // @fragments/ui Design Tokens
3
+ // ============================================
4
+ //
5
+ // Override these variables in your own SCSS before importing components.
6
+ // Example:
7
+ // $fui-color-accent: #0066ff;
8
+ // @use '@fragments/ui/tokens';
9
+ //
10
+ // Or use CSS custom properties for runtime theming.
11
+ // ============================================
12
+
13
+ // --------------------------------------------
14
+ // Typography
15
+ // --------------------------------------------
16
+ $fui-font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !default;
17
+ $fui-font-mono: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace !default;
18
+
19
+ $fui-font-size-2xs: 0.6875rem !default; // 11px
20
+ $fui-font-size-xs: 0.75rem !default; // 12px
21
+ $fui-font-size-sm: 0.875rem !default; // 14px
22
+ $fui-font-size-base: 1rem !default; // 16px
23
+ $fui-font-size-lg: 1.125rem !default; // 18px
24
+ $fui-font-size-xl: 1.5rem !default; // 24px
25
+
26
+ $fui-font-weight-normal: 400 !default;
27
+ $fui-font-weight-medium: 500 !default;
28
+ $fui-font-weight-semibold: 600 !default;
29
+
30
+ $fui-line-height-tight: 1.25 !default;
31
+ $fui-line-height-normal: 1.5 !default;
32
+
33
+ // --------------------------------------------
34
+ // Spacing (4px base unit)
35
+ // --------------------------------------------
36
+ $fui-space-1: 0.25rem !default; // 4px
37
+ $fui-space-2: 0.5rem !default; // 8px
38
+ $fui-space-3: 0.75rem !default; // 12px
39
+ $fui-space-4: 1rem !default; // 16px
40
+ $fui-space-5: 1.25rem !default; // 20px
41
+ $fui-space-6: 1.5rem !default; // 24px
42
+ $fui-space-8: 2rem !default; // 32px
43
+ $fui-space-10: 2.5rem !default; // 40px
44
+ $fui-space-12: 3rem !default; // 48px
45
+
46
+ // --------------------------------------------
47
+ // Border Radius
48
+ // --------------------------------------------
49
+ $fui-radius-sm: 0.25rem !default; // 4px
50
+ $fui-radius-md: 0.375rem !default; // 6px
51
+ $fui-radius-lg: 0.5rem !default; // 8px
52
+ $fui-radius-full: 9999px !default;
53
+
54
+ // --------------------------------------------
55
+ // Transitions
56
+ // --------------------------------------------
57
+ $fui-transition-fast: 150ms ease !default;
58
+ $fui-transition-normal: 200ms ease !default;
59
+
60
+ // --------------------------------------------
61
+ // Colors - Light Mode
62
+ // --------------------------------------------
63
+ $fui-color-accent: #6366f1 !default;
64
+ $fui-color-accent-hover: #4f46e5 !default;
65
+ $fui-color-accent-active: #4338ca !default;
66
+
67
+ $fui-color-danger: #ef4444 !default;
68
+ $fui-color-danger-hover: #dc2626 !default;
69
+ $fui-color-success: #22c55e !default;
70
+ $fui-color-warning: #f59e0b !default;
71
+ $fui-color-info: #3b82f6 !default;
72
+
73
+ // Semantic backgrounds (light)
74
+ $fui-color-danger-bg: rgba(239, 68, 68, 0.1) !default;
75
+ $fui-color-success-bg: rgba(34, 197, 94, 0.1) !default;
76
+ $fui-color-warning-bg: rgba(245, 158, 11, 0.1) !default;
77
+ $fui-color-info-bg: rgba(59, 130, 246, 0.1) !default;
78
+
79
+ // Surface colors (light)
80
+ $fui-bg-primary: #ffffff !default;
81
+ $fui-bg-secondary: #f8fafc !default;
82
+ $fui-bg-tertiary: #f1f5f9 !default;
83
+ $fui-bg-elevated: #ffffff !default;
84
+ $fui-bg-hover: rgba(0, 0, 0, 0.04) !default;
85
+ $fui-bg-active: rgba(0, 0, 0, 0.06) !default;
86
+
87
+ // Text colors (light)
88
+ $fui-text-primary: #0f172a !default;
89
+ $fui-text-secondary: #64748b !default;
90
+ $fui-text-tertiary: #94a3b8 !default;
91
+ $fui-text-inverse: #ffffff !default;
92
+
93
+ // Border colors (light)
94
+ $fui-border: #e2e8f0 !default;
95
+ $fui-border-strong: #cbd5e1 !default;
96
+
97
+ // Shadows (light)
98
+ $fui-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !default;
99
+ $fui-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1) !default;
100
+
101
+ // Focus ring
102
+ $fui-focus-ring-color: $fui-color-accent !default;
103
+ $fui-focus-ring-offset: 2px !default;
104
+ $fui-focus-ring-width: 2px !default;
105
+
106
+ // --------------------------------------------
107
+ // Colors - Dark Mode
108
+ // --------------------------------------------
109
+ $fui-dark-bg-primary: #0f172a !default;
110
+ $fui-dark-bg-secondary: #1e293b !default;
111
+ $fui-dark-bg-tertiary: #334155 !default;
112
+ $fui-dark-bg-elevated: #1e293b !default;
113
+ $fui-dark-bg-hover: rgba(255, 255, 255, 0.06) !default;
114
+ $fui-dark-bg-active: rgba(255, 255, 255, 0.08) !default;
115
+
116
+ $fui-dark-text-primary: #f8fafc !default;
117
+ $fui-dark-text-secondary: #94a3b8 !default;
118
+ $fui-dark-text-tertiary: #64748b !default;
119
+ $fui-dark-text-inverse: #0f172a !default;
120
+
121
+ $fui-dark-border: #334155 !default;
122
+ $fui-dark-border-strong: #475569 !default;
123
+
124
+ $fui-dark-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3) !default;
125
+ $fui-dark-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3) !default;
126
+
127
+ // Semantic backgrounds (dark) - increased opacity for visibility
128
+ $fui-dark-color-danger-bg: rgba(239, 68, 68, 0.15) !default;
129
+ $fui-dark-color-success-bg: rgba(34, 197, 94, 0.15) !default;
130
+ $fui-dark-color-warning-bg: rgba(245, 158, 11, 0.15) !default;
131
+ $fui-dark-color-info-bg: rgba(59, 130, 246, 0.15) !default;
132
+
133
+ // Overlay/backdrop
134
+ $fui-backdrop: rgba(0, 0, 0, 0.5) !default;
135
+ $fui-dark-backdrop: rgba(0, 0, 0, 0.7) !default;
136
+
137
+ // --------------------------------------------
138
+ // Component-specific tokens
139
+ // --------------------------------------------
140
+
141
+ // Button
142
+ $fui-button-height-sm: 2rem !default; // 32px
143
+ $fui-button-height-md: 2.25rem !default; // 36px
144
+ $fui-button-height-lg: 2.75rem !default; // 44px
145
+
146
+ // Input
147
+ $fui-input-height: 2.5rem !default; // 40px
148
+
149
+ // Toggle/Switch
150
+ $fui-toggle-width-sm: 2rem !default; // 32px
151
+ $fui-toggle-width-md: 2.5rem !default; // 40px
152
+ $fui-toggle-height-sm: 1.125rem !default; // 18px
153
+ $fui-toggle-height-md: 1.375rem !default; // 22px
154
+
155
+ // --------------------------------------------
156
+ // CSS Custom Properties Export
157
+ // --------------------------------------------
158
+ // This mixin outputs CSS custom properties for runtime theming.
159
+ // Call it in your root styles: @include fui-css-variables;
160
+
161
+ @mixin fui-css-variables {
162
+ :root {
163
+ // Typography
164
+ --fui-font-sans: #{$fui-font-sans};
165
+ --fui-font-mono: #{$fui-font-mono};
166
+ --fui-font-size-2xs: #{$fui-font-size-2xs};
167
+ --fui-font-size-xs: #{$fui-font-size-xs};
168
+ --fui-font-size-sm: #{$fui-font-size-sm};
169
+ --fui-font-size-base: #{$fui-font-size-base};
170
+ --fui-font-size-lg: #{$fui-font-size-lg};
171
+ --fui-font-size-xl: #{$fui-font-size-xl};
172
+ --fui-font-weight-normal: #{$fui-font-weight-normal};
173
+ --fui-font-weight-medium: #{$fui-font-weight-medium};
174
+ --fui-font-weight-semibold: #{$fui-font-weight-semibold};
175
+ --fui-line-height-tight: #{$fui-line-height-tight};
176
+ --fui-line-height-normal: #{$fui-line-height-normal};
177
+
178
+ // Spacing
179
+ --fui-space-1: #{$fui-space-1};
180
+ --fui-space-2: #{$fui-space-2};
181
+ --fui-space-3: #{$fui-space-3};
182
+ --fui-space-4: #{$fui-space-4};
183
+ --fui-space-5: #{$fui-space-5};
184
+ --fui-space-6: #{$fui-space-6};
185
+ --fui-space-8: #{$fui-space-8};
186
+ --fui-space-10: #{$fui-space-10};
187
+ --fui-space-12: #{$fui-space-12};
188
+
189
+ // Border radius
190
+ --fui-radius-sm: #{$fui-radius-sm};
191
+ --fui-radius-md: #{$fui-radius-md};
192
+ --fui-radius-lg: #{$fui-radius-lg};
193
+ --fui-radius-full: #{$fui-radius-full};
194
+
195
+ // Transitions
196
+ --fui-transition-fast: #{$fui-transition-fast};
197
+ --fui-transition-normal: #{$fui-transition-normal};
198
+
199
+ // Colors
200
+ --fui-color-accent: #{$fui-color-accent};
201
+ --fui-color-accent-hover: #{$fui-color-accent-hover};
202
+ --fui-color-accent-active: #{$fui-color-accent-active};
203
+ --fui-color-danger: #{$fui-color-danger};
204
+ --fui-color-danger-hover: #{$fui-color-danger-hover};
205
+ --fui-color-success: #{$fui-color-success};
206
+ --fui-color-warning: #{$fui-color-warning};
207
+ --fui-color-info: #{$fui-color-info};
208
+ --fui-color-danger-bg: #{$fui-color-danger-bg};
209
+ --fui-color-success-bg: #{$fui-color-success-bg};
210
+ --fui-color-warning-bg: #{$fui-color-warning-bg};
211
+ --fui-color-info-bg: #{$fui-color-info-bg};
212
+ --fui-backdrop: #{$fui-backdrop};
213
+
214
+ // Surfaces
215
+ --fui-bg-primary: #{$fui-bg-primary};
216
+ --fui-bg-secondary: #{$fui-bg-secondary};
217
+ --fui-bg-tertiary: #{$fui-bg-tertiary};
218
+ --fui-bg-elevated: #{$fui-bg-elevated};
219
+ --fui-bg-hover: #{$fui-bg-hover};
220
+ --fui-bg-active: #{$fui-bg-active};
221
+
222
+ // Text
223
+ --fui-text-primary: #{$fui-text-primary};
224
+ --fui-text-secondary: #{$fui-text-secondary};
225
+ --fui-text-tertiary: #{$fui-text-tertiary};
226
+ --fui-text-inverse: #{$fui-text-inverse};
227
+
228
+ // Borders
229
+ --fui-border: #{$fui-border};
230
+ --fui-border-strong: #{$fui-border-strong};
231
+
232
+ // Shadows
233
+ --fui-shadow-sm: #{$fui-shadow-sm};
234
+ --fui-shadow-md: #{$fui-shadow-md};
235
+
236
+ // Focus
237
+ --fui-focus-ring-color: #{$fui-focus-ring-color};
238
+ --fui-focus-ring-offset: #{$fui-focus-ring-offset};
239
+ --fui-focus-ring-width: #{$fui-focus-ring-width};
240
+ }
241
+
242
+ // Dark mode via data-theme attribute (manual toggle)
243
+ :root[data-theme="dark"] {
244
+ @include _fui-dark-tokens;
245
+ }
246
+
247
+ // Dark mode via .dark class on html (used by viewer and many frameworks)
248
+ // This is the primary method - applications handle system preference detection
249
+ // and apply .dark class accordingly
250
+ :root.dark {
251
+ @include _fui-dark-tokens;
252
+ }
253
+ }
254
+
255
+ // Private mixin for dark mode token values
256
+ @mixin _fui-dark-tokens {
257
+ --fui-bg-primary: #{$fui-dark-bg-primary};
258
+ --fui-bg-secondary: #{$fui-dark-bg-secondary};
259
+ --fui-bg-tertiary: #{$fui-dark-bg-tertiary};
260
+ --fui-bg-elevated: #{$fui-dark-bg-elevated};
261
+ --fui-bg-hover: #{$fui-dark-bg-hover};
262
+ --fui-bg-active: #{$fui-dark-bg-active};
263
+ --fui-text-primary: #{$fui-dark-text-primary};
264
+ --fui-text-secondary: #{$fui-dark-text-secondary};
265
+ --fui-text-tertiary: #{$fui-dark-text-tertiary};
266
+ --fui-text-inverse: #{$fui-dark-text-inverse};
267
+ --fui-border: #{$fui-dark-border};
268
+ --fui-border-strong: #{$fui-dark-border-strong};
269
+ --fui-shadow-sm: #{$fui-dark-shadow-sm};
270
+ --fui-shadow-md: #{$fui-dark-shadow-md};
271
+ --fui-color-danger-bg: #{$fui-dark-color-danger-bg};
272
+ --fui-color-success-bg: #{$fui-dark-color-success-bg};
273
+ --fui-color-warning-bg: #{$fui-dark-color-warning-bg};
274
+ --fui-color-info-bg: #{$fui-dark-color-info-bg};
275
+ --fui-backdrop: #{$fui-dark-backdrop};
276
+ }