@aleph-alpha/ui-library 2.4.2 → 2.4.4
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 +13 -0
- package/config.js +78 -3
- package/dist/system/components/UiSelect/UiSelectItem.vue.d.ts +4 -1
- package/dist/system/components/core/select/SelectItem.vue.d.ts +1 -0
- package/dist/system/lib.js +1663 -1640
- package/docs/public-docs/quick-start.md +2 -1
- package/package.json +4 -1
- package/src/components/UiDrawer/UiDrawer.stories.ts +8 -8
- package/src/components/UiIcon/__tests__/UiIcon.test.ts +10 -0
- package/src/components/UiSelect/UiSelect.stories.ts +98 -0
- package/src/components/UiSelect/UiSelectContent.vue +1 -1
- package/src/components/UiSelect/UiSelectItem.vue +12 -2
- package/src/components/UiSelect/UiSelectTrigger.vue +2 -2
- package/src/components/UiSelect/__tests__/UiSelectContent.test.ts +31 -0
- package/src/components/UiSelect/__tests__/UiSelectItem.test.ts +110 -0
- package/src/components/UiSelect/__tests__/UiSelectTrigger.test.ts +88 -0
- package/src/components/core/select/SelectItem.vue +6 -2
- package/src/components/core/select/SelectTrigger.vue +1 -1
- package/src/theme/BorderRadius.stories.ts +115 -0
package/config.d.ts
CHANGED
|
@@ -77,6 +77,12 @@ export type UiLibraryPresetOptions = UiLibraryThemeOptions &
|
|
|
77
77
|
*/
|
|
78
78
|
export type UiLibraryTokenColors = Record<string, string>;
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* UnoCSS border-radius record where keys are utility suffixes
|
|
82
|
+
* and values are CSS length values.
|
|
83
|
+
*/
|
|
84
|
+
export type UiLibraryTokenBorderRadius = Record<string, string>;
|
|
85
|
+
|
|
80
86
|
/**
|
|
81
87
|
* Helper function for type-safe theme configuration files.
|
|
82
88
|
* Similar to Tailwind's `defineConfig`.
|
|
@@ -130,6 +136,12 @@ export declare const getUiLibraryTokenVars: () => UiLibraryTheme;
|
|
|
130
136
|
*/
|
|
131
137
|
export declare const getUiLibraryTokenColors: () => UiLibraryTokenColors;
|
|
132
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Get UnoCSS border-radius config from corner-radius design tokens.
|
|
141
|
+
* This allows using classes like rounded-xs, rounded-md, rounded-4xl, rounded-full, etc.
|
|
142
|
+
*/
|
|
143
|
+
export declare const getUiLibraryTokenBorderRadius: () => UiLibraryTokenBorderRadius;
|
|
144
|
+
|
|
133
145
|
/**
|
|
134
146
|
* Creates an UnoCSS preset with custom theme variables.
|
|
135
147
|
* Use this when you want full control over the theme.
|
|
@@ -151,6 +163,7 @@ export declare const presetUiLibraryTheme: (
|
|
|
151
163
|
* This preset bundles everything needed for the UI library:
|
|
152
164
|
* - CSS variables for all design tokens (light/dark mode)
|
|
153
165
|
* - Token-based theme colors (bg-background-surface-secondary, text-content-on-surface-primary, etc.)
|
|
166
|
+
* - Token-based border radius utilities (rounded-xs, rounded-md, rounded-full, etc.)
|
|
154
167
|
* - Semantic color overrides (background, foreground, modal, link, etc.)
|
|
155
168
|
* - Typography classes from design tokens (heading-48-bold, body-14-normal, label-12-medium, etc.)
|
|
156
169
|
* - Custom rules for Tailwind v4 CSS variable syntax (w-(--var), h-(--var), etc.)
|
package/config.js
CHANGED
|
@@ -525,6 +525,74 @@ export const getUiLibraryTokenColors = () => {
|
|
|
525
525
|
return colors;
|
|
526
526
|
};
|
|
527
527
|
|
|
528
|
+
const getCornerRadiusTokenGroup = () => {
|
|
529
|
+
const primitives = getTokens()?.['1-primitives/Default'];
|
|
530
|
+
return (
|
|
531
|
+
primitives?.aa?.['corner-radius'] ??
|
|
532
|
+
primitives?.aa26?.['corner-radius'] ??
|
|
533
|
+
null
|
|
534
|
+
);
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
const borderRadiusKeyFromTokenName = (tokenName) => {
|
|
538
|
+
const key = tokenName.replace(/^rounded-/, '');
|
|
539
|
+
return key === 'md' ? ['DEFAULT', key] : [key];
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Get UnoCSS border-radius config from corner-radius design tokens.
|
|
544
|
+
* This powers classes like rounded-xs, rounded-md, rounded-4xl, and rounded-full.
|
|
545
|
+
*/
|
|
546
|
+
export const getUiLibraryTokenBorderRadius = () => {
|
|
547
|
+
const cornerRadius = getCornerRadiusTokenGroup();
|
|
548
|
+
if (!cornerRadius) return {};
|
|
549
|
+
|
|
550
|
+
const borderRadius = {};
|
|
551
|
+
for (const [tokenName, tokenData] of Object.entries(cornerRadius)) {
|
|
552
|
+
if (
|
|
553
|
+
!tokenData ||
|
|
554
|
+
typeof tokenData !== 'object' ||
|
|
555
|
+
!('value' in tokenData)
|
|
556
|
+
) {
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
const resolved = resolveReferences(tokenData.value, new Set());
|
|
561
|
+
if (typeof resolved !== 'string' || !resolved.trim()) continue;
|
|
562
|
+
|
|
563
|
+
for (const key of borderRadiusKeyFromTokenName(tokenName)) {
|
|
564
|
+
borderRadius[key] = resolved;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
return borderRadius;
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
const getUiLibraryTokenBorderRadiusVars = () =>
|
|
572
|
+
Object.fromEntries(
|
|
573
|
+
Object.entries(getUiLibraryTokenBorderRadius()).map(([key, value]) => [
|
|
574
|
+
`radius-${key}`,
|
|
575
|
+
value,
|
|
576
|
+
]),
|
|
577
|
+
);
|
|
578
|
+
|
|
579
|
+
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
580
|
+
|
|
581
|
+
const entriesToRules = (entries) =>
|
|
582
|
+
entries.map(([className, declarations]) => [
|
|
583
|
+
new RegExp(`^${escapeRegExp(className)}$`),
|
|
584
|
+
() => declarations,
|
|
585
|
+
]);
|
|
586
|
+
|
|
587
|
+
const getBorderRadiusExactUtilityRules = () => {
|
|
588
|
+
const entries = [];
|
|
589
|
+
for (const [key, value] of Object.entries(getUiLibraryTokenBorderRadius())) {
|
|
590
|
+
const className = key === 'DEFAULT' ? 'rounded' : `rounded-${key}`;
|
|
591
|
+
entries.push([className, { 'border-radius': value }]);
|
|
592
|
+
}
|
|
593
|
+
return entriesToRules(entries);
|
|
594
|
+
};
|
|
595
|
+
|
|
528
596
|
export const defineThemeConfig = (config) => config;
|
|
529
597
|
|
|
530
598
|
export const presetUiLibraryTheme = (theme, options = {}) => {
|
|
@@ -572,14 +640,20 @@ export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
|
572
640
|
|
|
573
641
|
// Get base shadcn theme from tokens
|
|
574
642
|
const baseTheme = getUiLibraryThemeFromTokens();
|
|
643
|
+
const tokenBorderRadiusVars = getUiLibraryTokenBorderRadiusVars();
|
|
644
|
+
|
|
645
|
+
// Radius utilities in Wind v4 resolve through --radius-* variables.
|
|
646
|
+
let finalTheme = {
|
|
647
|
+
light: { ...baseTheme.light, ...tokenBorderRadiusVars },
|
|
648
|
+
dark: { ...baseTheme.dark, ...tokenBorderRadiusVars },
|
|
649
|
+
};
|
|
575
650
|
|
|
576
651
|
// Include all token-based variables (default: true)
|
|
577
|
-
let finalTheme = baseTheme;
|
|
578
652
|
if (includeAllTokens) {
|
|
579
653
|
const tokenVars = getUiLibraryTokenVars();
|
|
580
654
|
finalTheme = {
|
|
581
|
-
light: { ...tokenVars.light, ...
|
|
582
|
-
dark: { ...tokenVars.dark, ...
|
|
655
|
+
light: { ...tokenVars.light, ...finalTheme.light },
|
|
656
|
+
dark: { ...tokenVars.dark, ...finalTheme.dark },
|
|
583
657
|
};
|
|
584
658
|
}
|
|
585
659
|
|
|
@@ -642,6 +716,7 @@ export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
|
642
716
|
},
|
|
643
717
|
},
|
|
644
718
|
rules: [
|
|
719
|
+
...getBorderRadiusExactUtilityRules(),
|
|
645
720
|
// Typography classes from design tokens (heading-48-bold, body-14-normal, label-12-medium, etc.)
|
|
646
721
|
...typographyShortcuts.map(([name, css]) => [
|
|
647
722
|
new RegExp(`^${name}$`),
|
|
@@ -2,9 +2,12 @@ import { UiSelectItemProps } from './types';
|
|
|
2
2
|
declare function __VLS_template(): {
|
|
3
3
|
attrs: Partial<{}>;
|
|
4
4
|
slots: {
|
|
5
|
+
'right-icon'?(_: {}): any;
|
|
6
|
+
'right-icon'?(_: {}): any;
|
|
7
|
+
'indicator-icon'?(_: {}): any;
|
|
8
|
+
'indicator-icon'?(_: {}): any;
|
|
5
9
|
default?(_: {}): any;
|
|
6
10
|
default?(_: {}): any;
|
|
7
|
-
'indicator-icon'?(_: {}): any;
|
|
8
11
|
};
|
|
9
12
|
refs: {
|
|
10
13
|
labelEl: HTMLSpanElement;
|