@aleph-alpha/ui-library 2.4.4 → 2.5.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.
- package/config.d.ts +33 -2
- package/config.js +145 -47
- package/dist/system/components/UiAvatar/UiAvatar.vue.d.ts +4 -1
- package/dist/system/components/UiAvatar/UiAvatarGroup.vue.d.ts +18 -0
- package/dist/system/components/UiAvatar/index.d.ts +1 -0
- package/dist/system/components/UiAvatar/types.d.ts +12 -1
- package/dist/system/components/UiFileItem/UiFileItem.vue.d.ts +6 -1
- package/dist/system/components/UiFileItem/types.d.ts +30 -10
- package/dist/system/components/UiFileType/UiFileType.vue.d.ts +8 -0
- package/dist/system/components/UiFileType/index.d.ts +2 -0
- package/dist/system/components/UiFileType/types.d.ts +33 -0
- package/dist/system/components/UiItem/UiItem.vue.d.ts +8 -1
- package/dist/system/components/UiItem/constants.d.ts +4 -3
- package/dist/system/components/UiItem/index.d.ts +1 -1
- package/dist/system/components/UiItem/types.d.ts +53 -13
- package/dist/system/components/core/avatar/Avatar.vue.d.ts +2 -0
- package/dist/system/components/core/avatar/index.d.ts +1 -0
- package/dist/system/components/core/calendar/Calendar.vue.d.ts +247 -3
- package/dist/system/components/core/item/Item.vue.d.ts +1 -1
- package/dist/system/components/core/item/ItemAction.vue.d.ts +25 -0
- package/dist/system/components/core/item/index.d.ts +8 -4
- package/dist/system/components/core/popover/PopoverContent.vue.d.ts +1 -1
- package/dist/system/components/core/range-calendar/RangeCalendar.vue.d.ts +139 -2
- package/dist/system/components/index.d.ts +1 -0
- package/dist/system/lib/activeIndicator.d.ts +1 -0
- package/dist/system/lib.js +6700 -6448
- package/dist/system/patterns/UiSidebar/activeIndicator.d.ts +1 -15
- package/package.json +1 -1
- package/src/components/UiAvatar/UiAvatar.stories.ts +103 -12
- package/src/components/UiAvatar/UiAvatar.vue +6 -1
- package/src/components/UiAvatar/UiAvatarGroup.vue +16 -0
- package/src/components/UiAvatar/UiAvatarImage.vue +1 -1
- package/src/components/UiAvatar/__tests__/UiAvatar.test.ts +86 -0
- package/src/components/UiAvatar/index.ts +1 -0
- package/src/components/UiAvatar/types.ts +15 -1
- package/src/components/UiButton/UiButton.stories.ts +60 -0
- package/src/components/UiCodeBlock/UiCodeBlock.vue +7 -2
- package/src/components/UiField/UiField.stories.ts +15 -9
- package/src/components/UiFileItem/UiFileItem.stories.ts +344 -185
- package/src/components/UiFileItem/UiFileItem.vue +110 -70
- package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +64 -3
- package/src/components/UiFileItem/types.ts +33 -10
- package/src/components/UiFileType/UiFileType.stories.ts +193 -0
- package/src/components/UiFileType/UiFileType.vue +114 -0
- package/src/components/UiFileType/__tests__/UiFileType.test.ts +41 -0
- package/src/components/UiFileType/index.ts +2 -0
- package/src/components/UiFileType/types.ts +38 -0
- package/src/components/UiFileUploadBox/UiFileUploadBox.vue +58 -56
- package/src/components/UiItem/UiItem.stories.ts +555 -855
- package/src/components/UiItem/UiItem.vue +59 -4
- package/src/components/UiItem/UiItemMedia.vue +1 -1
- package/src/components/UiItem/__tests__/UiItem.test.ts +432 -26
- package/src/components/UiItem/constants.ts +16 -2
- package/src/components/UiItem/index.ts +1 -1
- package/src/components/UiItem/types.ts +64 -13
- package/src/components/UiKbd/UiKbd.stories.ts +1 -1
- package/src/components/UiListbox/UiListbox.stories.ts +1 -1
- package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +4 -4
- package/src/components/UiSelect/UiSelectTrigger.vue +8 -2
- package/src/components/UiSelect/__tests__/UiSelectGroup.test.ts +2 -2
- package/src/components/UiSnackbar/UiSnackbar.stories.ts +1 -0
- package/src/components/UiTable/UiTable.stories.ts +6 -2
- package/src/components/UiTable/__tests__/UiTableRow.test.ts +4 -2
- package/src/components/UiTabs/UiTabs.stories.ts +2 -2
- package/src/components/UiTagsInput/UiTagsInput.stories.ts +12 -2
- package/src/components/core/avatar/Avatar.vue +17 -1
- package/src/components/core/avatar/AvatarFallback.vue +1 -1
- package/src/components/core/{item/ItemActions.vue → avatar/AvatarGroup.vue} +7 -2
- package/src/components/core/avatar/index.ts +1 -0
- package/src/components/core/button/index.ts +1 -1
- package/src/components/core/calendar/Calendar.vue +17 -1
- package/src/components/core/checkbox/Checkbox.vue +1 -0
- package/src/components/core/drawer/DrawerContent.vue +1 -1
- package/src/components/core/item/Item.vue +2 -2
- package/src/components/core/item/ItemAction.vue +30 -0
- package/src/components/core/item/ItemContent.vue +1 -1
- package/src/components/core/item/ItemDescription.vue +1 -1
- package/src/components/core/item/ItemGroup.vue +0 -1
- package/src/components/core/item/index.ts +32 -9
- package/src/components/core/kbd/Kbd.vue +1 -1
- package/src/components/core/listbox/ListboxContent.vue +1 -0
- package/src/components/core/native-select/NativeSelect.vue +6 -0
- package/src/components/core/range-calendar/RangeCalendar.vue +19 -0
- package/src/components/core/skeleton/Skeleton.vue +3 -1
- package/src/components/core/slider/Slider.vue +2 -1
- package/src/components/core/table/TableFooter.vue +4 -1
- package/src/components/core/table/TableRow.vue +1 -1
- package/src/components/index.ts +1 -0
- package/src/directives/vHover.stories.ts +16 -12
- package/src/lib/activeIndicator.ts +1 -0
- package/src/patterns/UiDataTable/UiDataTable.stories.ts +2 -2
- package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +2 -2
- package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +2 -2
- package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.vue +2 -2
- package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +2 -2
- package/src/patterns/UiSidebar/__tests__/UiSidebarMenuButton.test.ts +33 -0
- package/src/patterns/UiSidebar/activeIndicator.ts +1 -16
- package/src/theme/Background.stories.ts +16 -0
- package/src/theme/BorderRadius.stories.ts +12 -12
- package/src/theme/Flex.stories.ts +1 -1
- package/src/theme/Theme.stories.ts +3 -3
- package/tokens.json +4273 -1152
- /package/dist/system/components/core/{item/ItemActions.vue.d.ts → avatar/AvatarGroup.vue.d.ts} +0 -0
package/config.d.ts
CHANGED
|
@@ -63,6 +63,29 @@ export interface UiLibraryThemeConfig {
|
|
|
63
63
|
* @default true
|
|
64
64
|
*/
|
|
65
65
|
includeAllTokens?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Select which token theme set is used for resolving semantic token refs.
|
|
68
|
+
* - `default` reads `2-theme/AA Base`
|
|
69
|
+
* - `accessible` reads `2-theme/WCAG 2.2`
|
|
70
|
+
* @default 'default'
|
|
71
|
+
*/
|
|
72
|
+
themeMode?: 'default' | 'accessible';
|
|
73
|
+
/**
|
|
74
|
+
* Convenience alias for `themeMode: 'accessible'`.
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
accessible?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Emit an additional accessible-theme CSS variable block that can be toggled
|
|
80
|
+
* at runtime by adding `accessibleSelector` to the root element.
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
accessibleTheme?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Selector used for the runtime accessible-theme block.
|
|
86
|
+
* @default 'html.accessible-theme'
|
|
87
|
+
*/
|
|
88
|
+
accessibleSelector?: string;
|
|
66
89
|
}
|
|
67
90
|
|
|
68
91
|
/**
|
|
@@ -106,7 +129,11 @@ export declare const defineThemeConfig: <T extends UiLibraryThemeConfig>(
|
|
|
106
129
|
/**
|
|
107
130
|
* Returns the default theme derived from the library's `tokens.json`.
|
|
108
131
|
*/
|
|
109
|
-
export declare const getUiLibraryThemeFromTokens: (
|
|
132
|
+
export declare const getUiLibraryThemeFromTokens: (
|
|
133
|
+
options?: Pick<UiLibraryThemeConfig, 'themeMode' | 'accessible'> & {
|
|
134
|
+
referenceThemeSet?: string;
|
|
135
|
+
},
|
|
136
|
+
) => UiLibraryTheme;
|
|
110
137
|
|
|
111
138
|
/**
|
|
112
139
|
* Get all token-based CSS variables for light and dark modes.
|
|
@@ -114,7 +141,11 @@ export declare const getUiLibraryThemeFromTokens: () => UiLibraryTheme;
|
|
|
114
141
|
* - background.surface.secondary -> --background-surface-secondary
|
|
115
142
|
* - content.on-surface.primary -> --content-on-surface-primary
|
|
116
143
|
*/
|
|
117
|
-
export declare const getUiLibraryTokenVars: (
|
|
144
|
+
export declare const getUiLibraryTokenVars: (
|
|
145
|
+
options?: Pick<UiLibraryThemeConfig, 'themeMode' | 'accessible'> & {
|
|
146
|
+
referenceThemeSet?: string;
|
|
147
|
+
},
|
|
148
|
+
) => UiLibraryTheme;
|
|
118
149
|
|
|
119
150
|
/**
|
|
120
151
|
* Get UnoCSS theme colors config for all token-based colors.
|
package/config.js
CHANGED
|
@@ -179,20 +179,37 @@ const normalizeShadcnVarValue = (input) => {
|
|
|
179
179
|
return v;
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
// Token resolution —
|
|
183
|
-
//
|
|
184
|
-
// Heading scale utilities resolve `font.font-size.Heading …` via
|
|
185
|
-
|
|
182
|
+
// Token resolution — one selected `2-theme/*` set participates in `{...}` lookups;
|
|
183
|
+
// other theme sets are alternate brands/modes and must not override the selected
|
|
184
|
+
// library theme. Heading scale utilities resolve `font.font-size.Heading …` via
|
|
185
|
+
// these refs (see `getHeadingScaleTypographyShortcuts`).
|
|
186
|
+
const UI_LIBRARY_REFERENCE_THEME_SETS = Object.freeze({
|
|
187
|
+
default: '2-theme/AA Base',
|
|
188
|
+
accessible: '2-theme/WCAG 2.2',
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
const getUiLibraryThemeMode = (options = {}) => {
|
|
192
|
+
if (options.referenceThemeSet) return options.referenceThemeSet;
|
|
193
|
+
if (options.accessible || options.themeMode === 'accessible') {
|
|
194
|
+
return UI_LIBRARY_REFERENCE_THEME_SETS.accessible;
|
|
195
|
+
}
|
|
196
|
+
return UI_LIBRARY_REFERENCE_THEME_SETS.default;
|
|
197
|
+
};
|
|
186
198
|
|
|
187
|
-
const getTokenSetSearchOrder = () => {
|
|
199
|
+
const getTokenSetSearchOrder = (options = {}) => {
|
|
188
200
|
const tokens = getTokens();
|
|
189
201
|
const order = tokens?.$metadata?.tokenSetOrder;
|
|
190
202
|
const raw = Array.isArray(order)
|
|
191
203
|
? order
|
|
192
204
|
: Object.keys(tokens || {}).filter((k) => !k.startsWith('$'));
|
|
205
|
+
const referenceThemeSet = getUiLibraryThemeMode(options);
|
|
206
|
+
const fallbackThemeSet = UI_LIBRARY_REFERENCE_THEME_SETS.default;
|
|
193
207
|
return raw.filter(
|
|
194
208
|
(name) =>
|
|
195
|
-
!name.startsWith('2-theme/') ||
|
|
209
|
+
!name.startsWith('2-theme/') ||
|
|
210
|
+
name === referenceThemeSet ||
|
|
211
|
+
(referenceThemeSet === UI_LIBRARY_REFERENCE_THEME_SETS.accessible &&
|
|
212
|
+
name === fallbackThemeSet),
|
|
196
213
|
);
|
|
197
214
|
};
|
|
198
215
|
|
|
@@ -209,7 +226,7 @@ const getTokenLeaf = (tokenSetName, dotPath) => {
|
|
|
209
226
|
return cur && typeof cur === 'object' && 'value' in cur ? cur : null;
|
|
210
227
|
};
|
|
211
228
|
|
|
212
|
-
const resolveReferences = (value, seen) => {
|
|
229
|
+
const resolveReferences = (value, seen, options = {}) => {
|
|
213
230
|
if (typeof value !== 'string') return value;
|
|
214
231
|
|
|
215
232
|
const refMatch = value.match(/^\{(.+)\}$/);
|
|
@@ -227,7 +244,7 @@ const resolveReferences = (value, seen) => {
|
|
|
227
244
|
seen.add(marker);
|
|
228
245
|
|
|
229
246
|
const parts = refPath.split('.');
|
|
230
|
-
const sets = getTokenSetSearchOrder().slice().reverse();
|
|
247
|
+
const sets = getTokenSetSearchOrder(options).slice().reverse();
|
|
231
248
|
|
|
232
249
|
for (const setName of sets) {
|
|
233
250
|
const set = tokens?.[setName];
|
|
@@ -243,24 +260,29 @@ const resolveReferences = (value, seen) => {
|
|
|
243
260
|
}
|
|
244
261
|
|
|
245
262
|
if (cur && typeof cur === 'object' && 'value' in cur) {
|
|
246
|
-
return resolveReferences(cur.value, seen);
|
|
263
|
+
return resolveReferences(cur.value, seen, options);
|
|
247
264
|
}
|
|
248
265
|
}
|
|
249
266
|
return value;
|
|
250
267
|
};
|
|
251
268
|
|
|
252
|
-
const resolveTokenValue = (tokenSetName, path) => {
|
|
269
|
+
const resolveTokenValue = (tokenSetName, path, options = {}) => {
|
|
253
270
|
const leaf = getTokenLeaf(tokenSetName, path);
|
|
254
271
|
if (!leaf) return null;
|
|
255
272
|
const resolved = resolveReferences(
|
|
256
273
|
leaf.value,
|
|
257
274
|
new Set([`${tokenSetName}:${path}`]),
|
|
275
|
+
options,
|
|
258
276
|
);
|
|
259
277
|
return typeof resolved === 'string' ? resolved : null;
|
|
260
278
|
};
|
|
261
279
|
|
|
262
|
-
const resolveAnyTokenValue = (path) => {
|
|
263
|
-
const resolved = resolveReferences(
|
|
280
|
+
const resolveAnyTokenValue = (path, options = {}) => {
|
|
281
|
+
const resolved = resolveReferences(
|
|
282
|
+
`{${path}}`,
|
|
283
|
+
new Set([`any:${path}`]),
|
|
284
|
+
options,
|
|
285
|
+
);
|
|
264
286
|
return typeof resolved === 'string' ? resolved : null;
|
|
265
287
|
};
|
|
266
288
|
|
|
@@ -284,7 +306,7 @@ const collectColorTokenPaths = (obj, prefix = '') => {
|
|
|
284
306
|
};
|
|
285
307
|
|
|
286
308
|
// Build all token-based CSS variables (e.g., --background-surface-secondary)
|
|
287
|
-
const buildAllTokenVarsFromModeSet = (modeSetName) => {
|
|
309
|
+
const buildAllTokenVarsFromModeSet = (modeSetName, options = {}) => {
|
|
288
310
|
const tokens = getTokens();
|
|
289
311
|
const modeSet = tokens?.[modeSetName];
|
|
290
312
|
if (!modeSet) return {};
|
|
@@ -293,7 +315,7 @@ const buildAllTokenVarsFromModeSet = (modeSetName) => {
|
|
|
293
315
|
const vars = {};
|
|
294
316
|
|
|
295
317
|
for (const path of paths) {
|
|
296
|
-
const value = resolveTokenValue(modeSetName, path);
|
|
318
|
+
const value = resolveTokenValue(modeSetName, path, options);
|
|
297
319
|
if (value) {
|
|
298
320
|
// Convert dot path to kebab-case CSS variable name
|
|
299
321
|
// e.g., "background.surface.secondary" -> "background-surface-secondary"
|
|
@@ -306,8 +328,8 @@ const buildAllTokenVarsFromModeSet = (modeSetName) => {
|
|
|
306
328
|
};
|
|
307
329
|
|
|
308
330
|
// shadcn CSS variable builders
|
|
309
|
-
const buildShadcnVarsFromModeSet = (modeSetName) => {
|
|
310
|
-
const resolve = (path) => resolveTokenValue(modeSetName, path);
|
|
331
|
+
const buildShadcnVarsFromModeSet = (modeSetName, options = {}) => {
|
|
332
|
+
const resolve = (path) => resolveTokenValue(modeSetName, path, options);
|
|
311
333
|
|
|
312
334
|
// Background/Surface tokens
|
|
313
335
|
const background = resolve('background.surface.primary');
|
|
@@ -362,7 +384,7 @@ const buildShadcnVarsFromModeSet = (modeSetName) => {
|
|
|
362
384
|
const modal = resolve('background.surface.modal') ?? background;
|
|
363
385
|
const floating =
|
|
364
386
|
resolve('background.surface.floating') ??
|
|
365
|
-
resolveAnyTokenValue('aa.colors.sand.0') ??
|
|
387
|
+
resolveAnyTokenValue('aa.colors.sand.0', options) ??
|
|
366
388
|
resolve('background.surface.secondary') ??
|
|
367
389
|
background;
|
|
368
390
|
|
|
@@ -459,6 +481,25 @@ const mergeThemes = (base, extend) => {
|
|
|
459
481
|
};
|
|
460
482
|
};
|
|
461
483
|
|
|
484
|
+
const isAccessibleThemeMode = (options = {}) =>
|
|
485
|
+
getUiLibraryThemeMode(options) === UI_LIBRARY_REFERENCE_THEME_SETS.accessible;
|
|
486
|
+
|
|
487
|
+
const getAccessibleTokenVarOverrides = (options = {}) => {
|
|
488
|
+
if (!isAccessibleThemeMode(options)) {
|
|
489
|
+
return { light: {}, dark: {} };
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
return {
|
|
493
|
+
light: {
|
|
494
|
+
'background-status-warning':
|
|
495
|
+
resolveAnyTokenValue('aa.colors.amber.800', options) ?? '#974e00',
|
|
496
|
+
'content-on-surface-tertiary':
|
|
497
|
+
resolveAnyTokenValue('aa.colors.orange.700', options) ?? '#b83e16',
|
|
498
|
+
},
|
|
499
|
+
dark: {},
|
|
500
|
+
};
|
|
501
|
+
};
|
|
502
|
+
|
|
462
503
|
// Exported functions
|
|
463
504
|
export const getUiLibraryContentConfig = () => ({
|
|
464
505
|
content: {
|
|
@@ -473,9 +514,9 @@ export const getUiLibraryContentConfig = () => ({
|
|
|
473
514
|
},
|
|
474
515
|
});
|
|
475
516
|
|
|
476
|
-
export const getUiLibraryThemeFromTokens = () => ({
|
|
477
|
-
light: buildShadcnVarsFromModeSet('3-mode/Light'),
|
|
478
|
-
dark: buildShadcnVarsFromModeSet('3-mode/Dark'),
|
|
517
|
+
export const getUiLibraryThemeFromTokens = (options = {}) => ({
|
|
518
|
+
light: buildShadcnVarsFromModeSet('3-mode/Light', options),
|
|
519
|
+
dark: buildShadcnVarsFromModeSet('3-mode/Dark', options),
|
|
479
520
|
});
|
|
480
521
|
|
|
481
522
|
/**
|
|
@@ -484,14 +525,19 @@ export const getUiLibraryThemeFromTokens = () => ({
|
|
|
484
525
|
* - background.surface.secondary -> --background-surface-secondary
|
|
485
526
|
* - content.on-surface.primary -> --content-on-surface-primary
|
|
486
527
|
*/
|
|
487
|
-
export const getUiLibraryTokenVars = () =>
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
528
|
+
export const getUiLibraryTokenVars = (options = {}) => {
|
|
529
|
+
const accessibleVars = getAccessibleTokenVarOverrides(options);
|
|
530
|
+
return {
|
|
531
|
+
light: {
|
|
532
|
+
...buildAllTokenVarsFromModeSet('3-mode/Light', options),
|
|
533
|
+
...accessibleVars.light,
|
|
534
|
+
},
|
|
535
|
+
dark: {
|
|
536
|
+
...buildAllTokenVarsFromModeSet('3-mode/Dark', options),
|
|
537
|
+
...accessibleVars.dark,
|
|
538
|
+
},
|
|
539
|
+
};
|
|
540
|
+
};
|
|
495
541
|
|
|
496
542
|
/**
|
|
497
543
|
* Get UnoCSS theme colors config for all token-based colors.
|
|
@@ -512,9 +558,7 @@ export const getUiLibraryTokenVars = () => ({
|
|
|
512
558
|
* ```
|
|
513
559
|
*/
|
|
514
560
|
export const getUiLibraryTokenColors = () => {
|
|
515
|
-
const lightVars =
|
|
516
|
-
...buildAllTokenVarsFromModeSet('3-mode/Light'),
|
|
517
|
-
};
|
|
561
|
+
const lightVars = buildAllTokenVarsFromModeSet('3-mode/Light');
|
|
518
562
|
const colors = {};
|
|
519
563
|
|
|
520
564
|
for (const varName of Object.keys(lightVars)) {
|
|
@@ -631,37 +675,57 @@ export const presetUiLibraryTheme = (theme, options = {}) => {
|
|
|
631
675
|
};
|
|
632
676
|
|
|
633
677
|
export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
634
|
-
const {
|
|
678
|
+
const {
|
|
679
|
+
theme,
|
|
680
|
+
extend,
|
|
681
|
+
includeAllTokens = true,
|
|
682
|
+
themeMode = 'default',
|
|
683
|
+
accessible = false,
|
|
684
|
+
accessibleTheme = false,
|
|
685
|
+
accessibleSelector = 'html.accessible-theme',
|
|
686
|
+
...presetOptions
|
|
687
|
+
} = options;
|
|
635
688
|
|
|
636
689
|
// If full theme override provided, use basic preset (no batteries)
|
|
637
690
|
if (theme) {
|
|
638
691
|
return presetUiLibraryTheme(theme, presetOptions);
|
|
639
692
|
}
|
|
640
693
|
|
|
641
|
-
// Get base shadcn theme from tokens
|
|
642
|
-
const baseTheme = getUiLibraryThemeFromTokens();
|
|
643
694
|
const tokenBorderRadiusVars = getUiLibraryTokenBorderRadiusVars();
|
|
695
|
+
const buildTheme = (modeOptions = {}) => {
|
|
696
|
+
const baseTheme = getUiLibraryThemeFromTokens(modeOptions);
|
|
697
|
+
let resolvedTheme = {
|
|
698
|
+
light: { ...baseTheme.light, ...tokenBorderRadiusVars },
|
|
699
|
+
dark: { ...baseTheme.dark, ...tokenBorderRadiusVars },
|
|
700
|
+
};
|
|
644
701
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
702
|
+
if (includeAllTokens) {
|
|
703
|
+
const tokenVars = getUiLibraryTokenVars(modeOptions);
|
|
704
|
+
resolvedTheme = {
|
|
705
|
+
light: { ...tokenVars.light, ...resolvedTheme.light },
|
|
706
|
+
dark: { ...tokenVars.dark, ...resolvedTheme.dark },
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
return resolvedTheme;
|
|
649
711
|
};
|
|
650
712
|
|
|
651
|
-
//
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
finalTheme = {
|
|
655
|
-
light: { ...tokenVars.light, ...finalTheme.light },
|
|
656
|
-
dark: { ...tokenVars.dark, ...finalTheme.dark },
|
|
657
|
-
};
|
|
658
|
-
}
|
|
713
|
+
// Radius utilities in Wind v4 resolve through --radius-* variables.
|
|
714
|
+
const modeOptions = { themeMode, accessible };
|
|
715
|
+
let finalTheme = buildTheme(modeOptions);
|
|
659
716
|
|
|
660
717
|
// Merge with extend overrides
|
|
661
718
|
finalTheme = mergeThemes(finalTheme, extend);
|
|
662
719
|
|
|
663
720
|
// Get base preset with preflights (CSS variables)
|
|
664
721
|
const basePreset = presetUiLibraryTheme(finalTheme, presetOptions);
|
|
722
|
+
const accessiblePreset = accessibleTheme
|
|
723
|
+
? presetUiLibraryTheme(buildTheme({ themeMode: 'accessible' }), {
|
|
724
|
+
...presetOptions,
|
|
725
|
+
rootSelector: accessibleSelector,
|
|
726
|
+
darkSelector: `${accessibleSelector}.dark`,
|
|
727
|
+
})
|
|
728
|
+
: null;
|
|
665
729
|
|
|
666
730
|
// Token colors for utility classes (bg-background-surface-secondary, etc.)
|
|
667
731
|
const tokenColors = getUiLibraryTokenColors();
|
|
@@ -702,6 +766,7 @@ export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
|
702
766
|
...basePreset,
|
|
703
767
|
preflights: [
|
|
704
768
|
...(basePreset.preflights || []),
|
|
769
|
+
...(accessiblePreset?.preflights || []),
|
|
705
770
|
{ getCSS: () => getSaansFontFaceCss() },
|
|
706
771
|
{ getCSS: () => fontVariablesCss },
|
|
707
772
|
],
|
|
@@ -821,9 +886,42 @@ const vHoverOverlayCSS = `
|
|
|
821
886
|
.hover-layer[data-active="true"]::after {
|
|
822
887
|
opacity: 1;
|
|
823
888
|
}
|
|
889
|
+
.ui-active-indicator {
|
|
890
|
+
position: relative;
|
|
891
|
+
}
|
|
892
|
+
.ui-active-indicator::before {
|
|
893
|
+
content: "";
|
|
894
|
+
position: absolute;
|
|
895
|
+
z-index: 10;
|
|
896
|
+
top: 50%;
|
|
897
|
+
left: 0;
|
|
898
|
+
width: 0.125rem;
|
|
899
|
+
height: 50%;
|
|
900
|
+
pointer-events: none;
|
|
901
|
+
border-radius: 9999px;
|
|
902
|
+
background-color: oklch(var(--background-accent-default));
|
|
903
|
+
opacity: 0;
|
|
904
|
+
transform: translateY(-50%) scaleX(0);
|
|
905
|
+
transform-origin: left;
|
|
906
|
+
transition:
|
|
907
|
+
transform 200ms linear,
|
|
908
|
+
opacity 200ms linear;
|
|
909
|
+
}
|
|
910
|
+
.ui-active-indicator[data-active="true"]::before,
|
|
911
|
+
.ui-active-indicator-active::before {
|
|
912
|
+
opacity: 1;
|
|
913
|
+
transform: translateY(-50%) scaleX(1);
|
|
914
|
+
}
|
|
915
|
+
.hover-layer:disabled::after,
|
|
916
|
+
.hover-layer[aria-disabled="true"]::after,
|
|
917
|
+
.hover-layer[data-disabled]::after {
|
|
918
|
+
opacity: 0;
|
|
919
|
+
transition: none;
|
|
920
|
+
}
|
|
824
921
|
@media (prefers-reduced-motion: reduce) {
|
|
825
922
|
.v-hover-overlay,
|
|
826
|
-
.hover-layer::after
|
|
923
|
+
.hover-layer::after,
|
|
924
|
+
.ui-active-indicator::before {
|
|
827
925
|
transition: none;
|
|
828
926
|
}
|
|
829
927
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UiAvatarProps } from './types';
|
|
1
2
|
declare function __VLS_template(): {
|
|
2
3
|
attrs: Partial<{}>;
|
|
3
4
|
slots: {
|
|
@@ -7,7 +8,9 @@ declare function __VLS_template(): {
|
|
|
7
8
|
rootEl: any;
|
|
8
9
|
};
|
|
9
10
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
10
|
-
declare const __VLS_component: import('vue').DefineComponent<
|
|
11
|
+
declare const __VLS_component: import('vue').DefineComponent<UiAvatarProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UiAvatarProps> & Readonly<{}>, {
|
|
12
|
+
size: import('./types').UiAvatarSize;
|
|
13
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
14
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
12
15
|
export default _default;
|
|
13
16
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UiAvatarGroupProps } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
};
|
|
7
|
+
refs: {};
|
|
8
|
+
rootEl: HTMLDivElement;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
+
declare const __VLS_component: import('vue').DefineComponent<UiAvatarGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UiAvatarGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
12
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as UiAvatar } from './UiAvatar.vue';
|
|
2
2
|
export { default as UiAvatarFallback } from './UiAvatarFallback.vue';
|
|
3
|
+
export { default as UiAvatarGroup } from './UiAvatarGroup.vue';
|
|
3
4
|
export { default as UiAvatarImage } from './UiAvatarImage.vue';
|
|
4
5
|
export type * from './types';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ImgHTMLAttributes } from 'vue';
|
|
1
|
+
import { HTMLAttributes, ImgHTMLAttributes } from 'vue';
|
|
2
|
+
export type UiAvatarSize = 5 | 6 | 8 | 10 | 12 | '5' | '6' | '8' | '10' | '12';
|
|
2
3
|
/**
|
|
3
4
|
* A circular image for representing users or entities. Use for
|
|
4
5
|
* profile pictures, user lists, or any person/entity representation.
|
|
@@ -7,6 +8,12 @@ import { ImgHTMLAttributes } from 'vue';
|
|
|
7
8
|
* @keywords avatar, image, profile, picture, user, photo, initials
|
|
8
9
|
* @related UiBadge
|
|
9
10
|
*/
|
|
11
|
+
export type UiAvatarProps = {
|
|
12
|
+
/** Avatar width and height token. Maps to `size-{value}` utilities. */
|
|
13
|
+
size?: UiAvatarSize;
|
|
14
|
+
/** Additional classes for the avatar root. */
|
|
15
|
+
class?: HTMLAttributes['class'];
|
|
16
|
+
};
|
|
10
17
|
export type UiAvatarImageProps = {
|
|
11
18
|
/** The source URL of the avatar image. */
|
|
12
19
|
src: string;
|
|
@@ -17,3 +24,7 @@ export type UiAvatarImageProps = {
|
|
|
17
24
|
/** The CORS setting for the image request. */
|
|
18
25
|
crossOrigin?: ImgHTMLAttributes['crossorigin'];
|
|
19
26
|
};
|
|
27
|
+
export type UiAvatarGroupProps = {
|
|
28
|
+
/** Additional classes for the avatar group container. */
|
|
29
|
+
class?: HTMLAttributes['class'];
|
|
30
|
+
};
|
|
@@ -5,10 +5,15 @@ declare const _default: import('vue').DefineComponent<UiFileItemProps, {}, {}, {
|
|
|
5
5
|
onRemove?: (() => any) | undefined;
|
|
6
6
|
}>, {
|
|
7
7
|
disabled: boolean;
|
|
8
|
+
size: import('./types').UiFileItemSize;
|
|
8
9
|
progress: number | null;
|
|
9
10
|
error: string | null;
|
|
11
|
+
removable: boolean;
|
|
10
12
|
removeLabel: string;
|
|
11
13
|
typeLabel: string;
|
|
12
14
|
sizeLabel: string;
|
|
13
|
-
|
|
15
|
+
progressLabel: string;
|
|
16
|
+
mediaTone: import('./types').UiFileItemMediaTone;
|
|
17
|
+
mediaIcon: string;
|
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
14
19
|
export default _default;
|
|
@@ -1,27 +1,47 @@
|
|
|
1
|
+
import { UiFileTypeTone } from '../UiFileType';
|
|
1
2
|
/**
|
|
2
3
|
* Row showing a selected or uploading file with optional progress and errors.
|
|
3
4
|
* @category Form Inputs
|
|
4
5
|
* @useCases file upload list, attachment row
|
|
5
|
-
* @keywords file, upload, attachment, progress
|
|
6
|
-
* @related UiFileUploadBox, UiItem, UiButton
|
|
6
|
+
* @keywords file, upload, attachment, progress, success, error
|
|
7
|
+
* @related UiFileUploadBox, UiItem, UiButton, UiProgress
|
|
7
8
|
*/
|
|
9
|
+
export type UiFileItemSize = 'default' | 'small';
|
|
10
|
+
/**
|
|
11
|
+
* Media badge tone. Re-exported alias of `UiFileTypeTone` (the file-type
|
|
12
|
+
* badge is rendered via {@link UiFileType}). Auto-derived from the filename
|
|
13
|
+
* extension when omitted; see `UiFileType` for the mapping.
|
|
14
|
+
*/
|
|
15
|
+
export type UiFileItemMediaTone = UiFileTypeTone;
|
|
8
16
|
export interface UiFileItemProps {
|
|
9
|
-
/**
|
|
10
|
-
* Full file name (`file.name`). The title omits the final extension; the full name is still exposed to assistive tech.
|
|
11
|
-
*/
|
|
17
|
+
/** Full file name. The trailing extension is hidden from the title. */
|
|
12
18
|
filename: string;
|
|
13
|
-
/** Short type label, e.g. `PDF`. */
|
|
19
|
+
/** Short type label, e.g. `PDF`. Shown only in the success state. */
|
|
14
20
|
typeLabel?: string;
|
|
15
|
-
/** Size label, e.g. `1.2 MB`. */
|
|
21
|
+
/** Size label, e.g. `1.2 MB`. Shown only in the success state. */
|
|
16
22
|
sizeLabel?: string;
|
|
17
|
-
/** Upload progress 0–100
|
|
23
|
+
/** Upload progress 0–100. Values `< 100` show a progress bar. */
|
|
18
24
|
progress?: number | null;
|
|
19
|
-
/**
|
|
25
|
+
/** Error message. When non-empty, the row enters the error state. */
|
|
20
26
|
error?: string | null;
|
|
21
27
|
/** Accessible label for the remove control. */
|
|
22
28
|
removeLabel?: string;
|
|
29
|
+
/** Accessible label for the progress bar (i18n hook). Defaults to the `filename`. */
|
|
30
|
+
progressLabel?: string;
|
|
23
31
|
/**
|
|
24
|
-
* When true
|
|
32
|
+
* When `true`, renders a close icon that emits `remove`.
|
|
33
|
+
* @default true
|
|
25
34
|
*/
|
|
35
|
+
removable?: boolean;
|
|
36
|
+
/** When `true`, the row is `inert` and visually de-emphasized. */
|
|
26
37
|
disabled?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Visual size preset.
|
|
40
|
+
* @default 'default'
|
|
41
|
+
*/
|
|
42
|
+
size?: UiFileItemSize;
|
|
43
|
+
/** Media badge tone. Auto-derived from the extension when omitted. */
|
|
44
|
+
mediaTone?: UiFileItemMediaTone;
|
|
45
|
+
/** Lucide icon name for the media badge. Auto-derived when omitted. */
|
|
46
|
+
mediaIcon?: string;
|
|
27
47
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UiFileTypeProps, UiFileTypeTone } from './types';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<UiFileTypeProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UiFileTypeProps> & Readonly<{}>, {
|
|
3
|
+
icon: string;
|
|
4
|
+
error: boolean;
|
|
5
|
+
filename: string;
|
|
6
|
+
tone: UiFileTypeTone;
|
|
7
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Round 32×32 badge that visualises a file type with a tone + icon. Mirrors
|
|
3
|
+
* the Figma `Filetype` component (`AA26 / File Upload / Filetype`,
|
|
4
|
+
* node id `26438:42144`):
|
|
5
|
+
*
|
|
6
|
+
* - `Type=Text` (`pdf` / `doc` / `docx` / `txt` / `rtf`) → `accent-pink` + `file`
|
|
7
|
+
* - `Type=Markdown` (`html` / `htm` / `md` / `mdx`) → `accent-soft` + `code-xml`
|
|
8
|
+
* - `Type=Tabular` (`csv` / `tsv` / `xls` / `xlsx`) → `accent-yellow` + `table-2`
|
|
9
|
+
* - everything else → `default` + `file`
|
|
10
|
+
* @see {@link https://www.figma.com/design/SrZQ19QVN1sQkuAMnMC746/AA26--WIP-?node-id=26438-42144}
|
|
11
|
+
* @category Data Display
|
|
12
|
+
* @useCases file-type indicator, attachment badge
|
|
13
|
+
* @keywords file, badge, attachment, filetype, icon
|
|
14
|
+
* @related UiFileItem, UiFileUploadBox
|
|
15
|
+
*/
|
|
16
|
+
export type UiFileTypeTone = 'default' | 'accent-pink' | 'accent-soft' | 'accent-yellow';
|
|
17
|
+
export interface UiFileTypeProps {
|
|
18
|
+
/**
|
|
19
|
+
* File name used to auto-derive the tone + icon from its extension. Pass
|
|
20
|
+
* the original `file.name` (with extension); the badge itself doesn't
|
|
21
|
+
* render any text.
|
|
22
|
+
*/
|
|
23
|
+
filename?: string;
|
|
24
|
+
/** Explicit tone override. Wins over the filename-derived tone. */
|
|
25
|
+
tone?: UiFileTypeTone;
|
|
26
|
+
/** Explicit Lucide icon name. Wins over the filename-derived icon. */
|
|
27
|
+
icon?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Forces the neutral badge + `circle-alert` icon, regardless of any
|
|
30
|
+
* other prop. Use to indicate an upload/validation failure.
|
|
31
|
+
*/
|
|
32
|
+
error?: boolean;
|
|
33
|
+
}
|
|
@@ -3,12 +3,19 @@ declare function __VLS_template(): {
|
|
|
3
3
|
attrs: Partial<{}>;
|
|
4
4
|
slots: {
|
|
5
5
|
default?(_: {}): any;
|
|
6
|
+
icon?(_: {}): any;
|
|
7
|
+
content?(_: {}): any;
|
|
8
|
+
action?(_: {}): any;
|
|
6
9
|
};
|
|
7
10
|
refs: {};
|
|
8
11
|
rootEl: any;
|
|
9
12
|
};
|
|
10
13
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
-
declare const __VLS_component: import('vue').DefineComponent<UiItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
+
declare const __VLS_component: import('vue').DefineComponent<UiItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
15
|
+
action: (event: MouseEvent) => any;
|
|
16
|
+
}, string, import('vue').PublicProps, Readonly<UiItemProps> & Readonly<{
|
|
17
|
+
onAction?: ((event: MouseEvent) => any) | undefined;
|
|
18
|
+
}>, {
|
|
12
19
|
asChild: boolean;
|
|
13
20
|
size: import('./types').UiItemSizes;
|
|
14
21
|
variant: import('./types').UiItemVariants;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export declare const ItemVariants: readonly ["default", "outline", "
|
|
2
|
-
export declare const ItemSizes: readonly ["default", "sm"];
|
|
3
|
-
export declare const ItemMediaVariants: readonly ["default", "icon", "image"];
|
|
1
|
+
export declare const ItemVariants: readonly ["default", "active", "outline", "hover", "hover-action"];
|
|
2
|
+
export declare const ItemSizes: readonly ["default", "sm", "minimal"];
|
|
3
|
+
export declare const ItemMediaVariants: readonly ["default", "icon", "image", "avatar-group"];
|
|
4
|
+
export declare const ItemActionVariants: readonly ["default", "text", "button"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as UiItem } from './UiItem.vue';
|
|
2
2
|
export { default as UiItemMedia } from './UiItemMedia.vue';
|
|
3
|
-
export {
|
|
3
|
+
export { ItemAction as UiItemAction } from '../core/item';
|
|
4
4
|
export { ItemContent as UiItemContent } from '../core/item';
|
|
5
5
|
export { ItemDescription as UiItemDescription } from '../core/item';
|
|
6
6
|
export { ItemFooter as UiItemFooter } from '../core/item';
|