@aleph-alpha/ui-library 1.13.0 → 1.15.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 +1 -1
- package/config.d.ts +18 -5
- package/config.js +95 -5
- package/dist/system/index.d.ts +1718 -236
- package/dist/system/lib.js +19726 -16529
- package/docs/public-docs/component-directory.md +13 -0
- package/docs/public-docs/contributing.md +11 -0
- package/docs/public-docs/external-links.md +16 -0
- package/docs/public-docs/foundations.md +25 -0
- package/docs/public-docs/getting-started-designers.md +17 -0
- package/docs/public-docs/index.md +5 -0
- package/docs/public-docs/quick-start.md +230 -0
- package/docs/public-docs/standards-guidelines.md +15 -0
- package/package.json +3 -2
- package/src/components/UiCalendar/UiCalendar.stories.ts +1 -4
- package/src/components/UiCalendar/types.ts +1 -1
- package/src/components/UiKbd/UiKbd.stories.ts +1 -1
- package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +1196 -0
- package/src/components/UiNavigationMenu/UiNavigationMenu.vue +39 -0
- package/src/components/UiNavigationMenu/UiNavigationMenuContent.vue +25 -0
- package/src/components/UiNavigationMenu/UiNavigationMenuIndicator.vue +14 -0
- package/src/components/UiNavigationMenu/UiNavigationMenuItem.vue +16 -0
- package/src/components/UiNavigationMenu/UiNavigationMenuLink.vue +27 -0
- package/src/components/UiNavigationMenu/UiNavigationMenuList.vue +16 -0
- package/src/components/UiNavigationMenu/UiNavigationMenuTrigger.vue +16 -0
- package/src/components/UiNavigationMenu/__tests__/UiNavigationMenu.test.ts +428 -0
- package/src/components/UiNavigationMenu/index.ts +11 -0
- package/src/components/UiNavigationMenu/types.ts +185 -0
- package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +2 -4
- package/src/components/UiRangeCalendar/types.ts +1 -1
- package/src/components/UiSheet/UiSheet.stories.ts +715 -0
- package/src/components/UiSheet/__tests__/UiSheet.test.ts +229 -0
- package/src/components/UiSheet/index.ts +12 -0
- package/src/components/UiSheet/types.ts +83 -0
- package/src/components/UiSidebar/UiSidebar.stories.ts +1188 -0
- package/src/components/UiSidebar/UiSidebar.vue +20 -0
- package/src/components/UiSidebar/UiSidebarGroupAction.vue +18 -0
- package/src/components/UiSidebar/UiSidebarGroupLabel.vue +18 -0
- package/src/components/UiSidebar/UiSidebarHeaderTrigger.vue +53 -0
- package/src/components/UiSidebar/UiSidebarInput.vue +14 -0
- package/src/components/UiSidebar/UiSidebarMenuAction.vue +19 -0
- package/src/components/UiSidebar/UiSidebarMenuButton.vue +27 -0
- package/src/components/UiSidebar/UiSidebarMenuSkeleton.vue +16 -0
- package/src/components/UiSidebar/UiSidebarMenuSubButton.vue +24 -0
- package/src/components/UiSidebar/UiSidebarProvider.vue +16 -0
- package/src/components/UiSidebar/UiSidebarSeparator.vue +13 -0
- package/src/components/UiSidebar/__tests__/UiSidebar.test.ts +221 -0
- package/src/components/UiSidebar/index.ts +34 -0
- package/src/components/UiSidebar/types.ts +165 -0
- package/src/components/UiStepper/UiStepper.stories.ts +425 -0
- package/src/components/UiStepper/UiStepper.vue +27 -0
- package/src/components/UiStepper/UiStepperDescription.vue +20 -0
- package/src/components/UiStepper/UiStepperIndicator.vue +13 -0
- package/src/components/UiStepper/UiStepperItem.vue +25 -0
- package/src/components/UiStepper/UiStepperSeparator.vue +17 -0
- package/src/components/UiStepper/UiStepperTitle.vue +19 -0
- package/src/components/UiStepper/UiStepperTrigger.vue +18 -0
- package/src/components/UiStepper/__tests__/UiStepper.test.ts +167 -0
- package/src/components/UiStepper/index.ts +9 -0
- package/src/components/UiStepper/types.ts +65 -0
- package/src/components/core/alert/index.ts +2 -2
- package/src/components/core/alert-dialog/AlertDialogContent.vue +1 -1
- package/src/components/core/calendar/Calendar.vue +1 -1
- package/src/components/core/card/Card.vue +1 -1
- package/src/components/core/drawer/DrawerContent.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuContent.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuSubContent.vue +1 -1
- package/src/components/core/input/Input.vue +1 -1
- package/src/components/core/native-select/NativeSelect.vue +1 -1
- package/src/components/core/native-select/NativeSelectOptGroup.vue +1 -1
- package/src/components/core/native-select/NativeSelectOption.vue +1 -1
- package/src/components/core/navigation-menu/NavigationMenu.vue +40 -0
- package/src/components/core/navigation-menu/NavigationMenuContent.vue +28 -0
- package/src/components/core/navigation-menu/NavigationMenuIndicator.vue +26 -0
- package/src/components/core/navigation-menu/NavigationMenuItem.vue +19 -0
- package/src/components/core/navigation-menu/NavigationMenuLink.vue +27 -0
- package/src/components/core/navigation-menu/NavigationMenuList.vue +21 -0
- package/src/components/core/navigation-menu/NavigationMenuTrigger.vue +27 -0
- package/src/components/core/navigation-menu/NavigationMenuViewport.vue +26 -0
- package/src/components/core/navigation-menu/index.ts +14 -0
- package/src/components/core/popover/PopoverContent.vue +1 -1
- package/src/components/core/range-calendar/RangeCalendar.vue +1 -1
- package/src/components/core/select/SelectContent.vue +1 -1
- package/src/components/core/select/SelectTrigger.vue +1 -1
- package/src/components/core/sheet/Sheet.vue +15 -0
- package/src/components/core/sheet/SheetClose.vue +12 -0
- package/src/components/core/sheet/SheetContent.vue +56 -0
- package/src/components/core/sheet/SheetDescription.vue +19 -0
- package/src/components/core/sheet/SheetFooter.vue +9 -0
- package/src/components/core/sheet/SheetHeader.vue +9 -0
- package/src/components/core/sheet/SheetOverlay.vue +24 -0
- package/src/components/core/sheet/SheetTitle.vue +19 -0
- package/src/components/core/sheet/SheetTrigger.vue +12 -0
- package/src/components/core/sheet/index.ts +8 -0
- package/src/components/core/sidebar/Sidebar.vue +105 -0
- package/src/components/core/sidebar/SidebarContent.vue +21 -0
- package/src/components/core/sidebar/SidebarFooter.vue +16 -0
- package/src/components/core/sidebar/SidebarGroup.vue +16 -0
- package/src/components/core/sidebar/SidebarGroupAction.vue +25 -0
- package/src/components/core/sidebar/SidebarGroupContent.vue +16 -0
- package/src/components/core/sidebar/SidebarGroupLabel.vue +23 -0
- package/src/components/core/sidebar/SidebarHeader.vue +16 -0
- package/src/components/core/sidebar/SidebarInput.vue +17 -0
- package/src/components/core/sidebar/SidebarInset.vue +21 -0
- package/src/components/core/sidebar/SidebarMenu.vue +16 -0
- package/src/components/core/sidebar/SidebarMenuAction.vue +33 -0
- package/src/components/core/sidebar/SidebarMenuBadge.vue +26 -0
- package/src/components/core/sidebar/SidebarMenuButton.vue +49 -0
- package/src/components/core/sidebar/SidebarMenuButtonChild.vue +36 -0
- package/src/components/core/sidebar/SidebarMenuItem.vue +16 -0
- package/src/components/core/sidebar/SidebarMenuSkeleton.vue +32 -0
- package/src/components/core/sidebar/SidebarMenuSub.vue +22 -0
- package/src/components/core/sidebar/SidebarMenuSubButton.vue +38 -0
- package/src/components/core/sidebar/SidebarMenuSubItem.vue +16 -0
- package/src/components/core/sidebar/SidebarProvider.vue +102 -0
- package/src/components/core/sidebar/SidebarRail.vue +33 -0
- package/src/components/core/sidebar/SidebarSeparator.vue +17 -0
- package/src/components/core/sidebar/SidebarTrigger.vue +25 -0
- package/src/components/core/sidebar/index.ts +58 -0
- package/src/components/core/sidebar/utils.ts +19 -0
- package/src/components/core/stepper/Stepper.vue +20 -0
- package/src/components/core/stepper/StepperDescription.vue +23 -0
- package/src/components/core/stepper/StepperIndicator.vue +34 -0
- package/src/components/core/stepper/StepperItem.vue +23 -0
- package/src/components/core/stepper/StepperSeparator.vue +29 -0
- package/src/components/core/stepper/StepperTitle.vue +24 -0
- package/src/components/core/stepper/StepperTrigger.vue +22 -0
- package/src/components/core/stepper/index.ts +7 -0
- package/src/components/core/tabs/TabsTrigger.vue +1 -1
- package/src/components/core/tags-input/TagsInput.vue +1 -1
- package/src/components/core/textarea/Textarea.vue +1 -1
- package/src/components/index.ts +4 -0
- package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +1 -4
- package/src/patterns/UiDatePicker/types.ts +1 -1
- package/src/theme/Background.stories.ts +84 -35
- package/src/theme/Extended.stories.ts +4 -4
- package/tokens.json +145 -8
package/README.md
CHANGED
package/config.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export interface UiLibraryThemeConfig {
|
|
|
60
60
|
/**
|
|
61
61
|
* Include all token-based CSS variables in addition to shadcn variables.
|
|
62
62
|
* This enables classes like bg-background-surface-secondary, text-content-on-surface-primary, etc.
|
|
63
|
-
* @default
|
|
63
|
+
* @default true
|
|
64
64
|
*/
|
|
65
65
|
includeAllTokens?: boolean;
|
|
66
66
|
}
|
|
@@ -145,24 +145,37 @@ export declare const presetUiLibraryTheme: (
|
|
|
145
145
|
*
|
|
146
146
|
* **Important:** Place this preset AFTER `presetShadcn()` to override its CSS variables.
|
|
147
147
|
*
|
|
148
|
+
* This preset bundles everything needed for the UI library:
|
|
149
|
+
* - CSS variables for all design tokens (light/dark mode)
|
|
150
|
+
* - Token-based theme colors (bg-background-surface-secondary, text-content-on-surface-primary, etc.)
|
|
151
|
+
* - Semantic color overrides (background, foreground, modal, link, etc.)
|
|
152
|
+
* - Typography classes from design tokens (heading-48-bold, body-14-normal, label-12-medium, etc.)
|
|
153
|
+
* - Custom rules for Tailwind v4 CSS variable syntax (w-(--var), h-(--var), etc.)
|
|
154
|
+
*
|
|
148
155
|
* @example
|
|
149
156
|
* ```ts
|
|
150
|
-
* // Use defaults
|
|
151
|
-
* presetUiLibraryThemeFromTokens(
|
|
157
|
+
* // Use defaults (recommended — includes everything)
|
|
158
|
+
* presetUiLibraryThemeFromTokens()
|
|
152
159
|
*
|
|
153
160
|
* // Extend defaults
|
|
154
161
|
* presetUiLibraryThemeFromTokens({
|
|
155
|
-
* darkSelector: 'html.dark',
|
|
156
162
|
* extend: { light: { primary: '#ff5500' } },
|
|
157
163
|
* })
|
|
158
164
|
*
|
|
159
165
|
* // With external config file
|
|
160
166
|
* import themeConfig from './tokens.config';
|
|
161
|
-
* presetUiLibraryThemeFromTokens(
|
|
167
|
+
* presetUiLibraryThemeFromTokens(themeConfig)
|
|
162
168
|
* ```
|
|
163
169
|
*/
|
|
164
170
|
export declare const presetUiLibraryThemeFromTokens: (options?: UiLibraryPresetOptions) => Preset;
|
|
165
171
|
|
|
172
|
+
/**
|
|
173
|
+
* UnoCSS preset with utility rules required by the UI library's components.
|
|
174
|
+
* Adds Tailwind v4 CSS variable syntax (w-(--var), h-(--var), etc.)
|
|
175
|
+
* that preset-wind4 does not yet support.
|
|
176
|
+
*/
|
|
177
|
+
export declare const presetUiLibraryUtils: () => Preset;
|
|
178
|
+
|
|
166
179
|
/**
|
|
167
180
|
* Typography shortcut tuple: [className, cssProperties]
|
|
168
181
|
*/
|
package/config.js
CHANGED
|
@@ -204,6 +204,11 @@ const resolveTokenValue = (tokenSetName, path) => {
|
|
|
204
204
|
return typeof resolved === 'string' ? resolved : null;
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
+
const resolveAnyTokenValue = (path) => {
|
|
208
|
+
const resolved = resolveReferences(`{${path}}`, new Set([`any:${path}`]));
|
|
209
|
+
return typeof resolved === 'string' ? resolved : null;
|
|
210
|
+
};
|
|
211
|
+
|
|
207
212
|
// Collect all color token paths from a mode set
|
|
208
213
|
const collectColorTokenPaths = (obj, prefix = '') => {
|
|
209
214
|
const paths = [];
|
|
@@ -278,8 +283,16 @@ const buildShadcnVarsFromModeSet = (modeSetName) => {
|
|
|
278
283
|
const input = resolve('border.input.default') ?? border;
|
|
279
284
|
const ring = resolve('border.surface.focus-ring') ?? resolve('background.accent.default');
|
|
280
285
|
|
|
286
|
+
// Surface tokens
|
|
287
|
+
const modal = resolve('background.surface.modal') ?? background;
|
|
288
|
+
const floating =
|
|
289
|
+
resolve('background.surface.floating') ??
|
|
290
|
+
resolveAnyTokenValue('aa.colors.sand.0') ??
|
|
291
|
+
resolve('background.surface.secondary') ??
|
|
292
|
+
background;
|
|
293
|
+
|
|
281
294
|
// Popover/Card surfaces
|
|
282
|
-
const popover =
|
|
295
|
+
const popover = floating;
|
|
283
296
|
const card = resolve('background.surface.primary') ?? background;
|
|
284
297
|
|
|
285
298
|
// Input background
|
|
@@ -301,9 +314,20 @@ const buildShadcnVarsFromModeSet = (modeSetName) => {
|
|
|
301
314
|
// Secondary content color (for calendar unselected dates)
|
|
302
315
|
const secondaryContent = resolve('content.on-surface.secondary') ?? foreground;
|
|
303
316
|
|
|
317
|
+
// Sidebar tokens (overrides unocss-preset-shadcn defaults with design-system colors)
|
|
318
|
+
const sidebar = resolve('background.surface.primary') ?? background;
|
|
319
|
+
const sidebarForeground = foreground;
|
|
320
|
+
const sidebarPrimary = primary;
|
|
321
|
+
const sidebarPrimaryForeground = primaryForeground;
|
|
322
|
+
const sidebarAccent = muted;
|
|
323
|
+
const sidebarAccentForeground = foreground;
|
|
324
|
+
const sidebarBorder = border;
|
|
325
|
+
const sidebarRing = ring;
|
|
326
|
+
|
|
304
327
|
return {
|
|
305
328
|
background,
|
|
306
329
|
foreground,
|
|
330
|
+
modal,
|
|
307
331
|
card,
|
|
308
332
|
'card-foreground': foreground,
|
|
309
333
|
popover,
|
|
@@ -331,6 +355,15 @@ const buildShadcnVarsFromModeSet = (modeSetName) => {
|
|
|
331
355
|
inverse,
|
|
332
356
|
'inverse-foreground': inverseForeground,
|
|
333
357
|
'secondary-content': secondaryContent,
|
|
358
|
+
sidebar,
|
|
359
|
+
'sidebar-background': sidebar,
|
|
360
|
+
'sidebar-foreground': sidebarForeground,
|
|
361
|
+
'sidebar-primary': sidebarPrimary,
|
|
362
|
+
'sidebar-primary-foreground': sidebarPrimaryForeground,
|
|
363
|
+
'sidebar-accent': sidebarAccent,
|
|
364
|
+
'sidebar-accent-foreground': sidebarAccentForeground,
|
|
365
|
+
'sidebar-border': sidebarBorder,
|
|
366
|
+
'sidebar-ring': sidebarRing,
|
|
334
367
|
};
|
|
335
368
|
};
|
|
336
369
|
|
|
@@ -436,9 +469,9 @@ export const presetUiLibraryTheme = (theme, options = {}) => {
|
|
|
436
469
|
};
|
|
437
470
|
|
|
438
471
|
export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
439
|
-
const { theme, extend, includeAllTokens =
|
|
472
|
+
const { theme, extend, includeAllTokens = true, ...presetOptions } = options;
|
|
440
473
|
|
|
441
|
-
// If full theme override provided, use
|
|
474
|
+
// If full theme override provided, use basic preset (no batteries)
|
|
442
475
|
if (theme) {
|
|
443
476
|
return presetUiLibraryTheme(theme, presetOptions);
|
|
444
477
|
}
|
|
@@ -446,7 +479,7 @@ export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
|
446
479
|
// Get base shadcn theme from tokens
|
|
447
480
|
const baseTheme = getUiLibraryThemeFromTokens();
|
|
448
481
|
|
|
449
|
-
//
|
|
482
|
+
// Include all token-based variables (default: true)
|
|
450
483
|
let finalTheme = baseTheme;
|
|
451
484
|
if (includeAllTokens) {
|
|
452
485
|
const tokenVars = getUiLibraryTokenVars();
|
|
@@ -459,9 +492,66 @@ export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
|
459
492
|
// Merge with extend overrides
|
|
460
493
|
finalTheme = mergeThemes(finalTheme, extend);
|
|
461
494
|
|
|
462
|
-
|
|
495
|
+
// Get base preset with preflights (CSS variables)
|
|
496
|
+
const basePreset = presetUiLibraryTheme(finalTheme, presetOptions);
|
|
497
|
+
|
|
498
|
+
// Token colors for utility classes (bg-background-surface-secondary, etc.)
|
|
499
|
+
const tokenColors = getUiLibraryTokenColors();
|
|
500
|
+
|
|
501
|
+
// Semantic color overrides used by components
|
|
502
|
+
const semanticColors = {
|
|
503
|
+
background: 'oklch(var(--background))',
|
|
504
|
+
foreground: 'oklch(var(--foreground))',
|
|
505
|
+
modal: 'oklch(var(--modal))',
|
|
506
|
+
link: 'oklch(var(--link))',
|
|
507
|
+
'hover-default': 'oklch(var(--hover-default))',
|
|
508
|
+
'modal-overlay': 'oklch(var(--modal-overlay))',
|
|
509
|
+
inverse: 'oklch(var(--inverse))',
|
|
510
|
+
'inverse-foreground': 'oklch(var(--inverse-foreground))',
|
|
511
|
+
'secondary-content': 'oklch(var(--secondary-content))',
|
|
512
|
+
'input-background': 'oklch(var(--input-background))',
|
|
513
|
+
'accent-default': 'oklch(var(--accent-default))',
|
|
514
|
+
'accent-default-foreground': 'oklch(var(--accent-default-foreground))',
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
// Typography shortcuts from design tokens
|
|
518
|
+
const typographyShortcuts = getUiLibraryTypographyShortcuts();
|
|
519
|
+
|
|
520
|
+
// Return preset with token-related config: CSS variables, token colors, semantic overrides, typography
|
|
521
|
+
return {
|
|
522
|
+
...basePreset,
|
|
523
|
+
theme: {
|
|
524
|
+
colors: {
|
|
525
|
+
...tokenColors,
|
|
526
|
+
...semanticColors,
|
|
527
|
+
},
|
|
528
|
+
},
|
|
529
|
+
rules: [
|
|
530
|
+
// Typography classes from design tokens (heading-48-bold, body-14-normal, label-12-medium, etc.)
|
|
531
|
+
...typographyShortcuts.map(([name, css]) => [
|
|
532
|
+
new RegExp(`^${name}$`),
|
|
533
|
+
() => Object.fromEntries(css.split(';').map((p) => p.split(':').map((s) => s.trim()))),
|
|
534
|
+
]),
|
|
535
|
+
],
|
|
536
|
+
};
|
|
463
537
|
};
|
|
464
538
|
|
|
539
|
+
/**
|
|
540
|
+
* UnoCSS preset with utility rules required by the UI library's components.
|
|
541
|
+
* Adds Tailwind v4 CSS variable syntax (w-(--var), h-(--var), etc.)
|
|
542
|
+
* that preset-wind4 does not yet support.
|
|
543
|
+
*/
|
|
544
|
+
export const presetUiLibraryUtils = () =>
|
|
545
|
+
definePreset(() => ({
|
|
546
|
+
name: '@aleph-alpha/ui-library-utils',
|
|
547
|
+
rules: [
|
|
548
|
+
[/^w-\(--(.+)\)$/, ([, name]) => ({ width: `var(--${name})` })],
|
|
549
|
+
[/^max-w-\(--(.+)\)$/, ([, name]) => ({ 'max-width': `var(--${name})` })],
|
|
550
|
+
[/^h-\(--(.+)\)$/, ([, name]) => ({ height: `var(--${name})` })],
|
|
551
|
+
[/^origin-\(--(.+)\)$/, ([, name]) => ({ 'transform-origin': `var(--${name})` })],
|
|
552
|
+
],
|
|
553
|
+
}))();
|
|
554
|
+
|
|
465
555
|
// Typography utilities
|
|
466
556
|
const fontWeightMap = {
|
|
467
557
|
Regular: '400',
|