@aleph-alpha/ui-library 2.4.3 → 2.5.1
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 +156 -12
- 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/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/index.d.ts +1 -0
- package/dist/system/lib/activeIndicator.d.ts +1 -0
- package/dist/system/lib.js +6574 -6357
- package/dist/system/patterns/UiSidebar/activeIndicator.d.ts +1 -15
- package/docs/public-docs/quick-start.md +2 -1
- 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 +1 -1
- 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 +134 -0
- package/src/components/UiFileType/UiFileType.vue +116 -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/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/UiNavigationMenu/UiNavigationMenu.stories.ts +4 -4
- package/src/components/UiSelect/__tests__/UiSelectGroup.test.ts +2 -2
- package/src/components/UiTable/__tests__/UiTableRow.test.ts +4 -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/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/skeleton/Skeleton.vue +3 -1
- package/src/components/core/slider/Slider.vue +1 -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/lib/activeIndicator.ts +1 -0
- 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/BorderRadius.stories.ts +115 -0
- /package/dist/system/components/core/{item/ItemActions.vue.d.ts → avatar/AvatarGroup.vue.d.ts} +0 -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
|
@@ -459,6 +459,36 @@ const mergeThemes = (base, extend) => {
|
|
|
459
459
|
};
|
|
460
460
|
};
|
|
461
461
|
|
|
462
|
+
// Static design tokens that exist in Figma Studio but have not been synced
|
|
463
|
+
// into `tokens.json` yet. Adding them here makes the corresponding utility
|
|
464
|
+
// classes (e.g. `bg-background-accent-pink`) resolvable so components don't
|
|
465
|
+
// need to fall back to arbitrary `bg-[var(--…,#hex)]` values. Remove an
|
|
466
|
+
// entry from this map once the matching token lands upstream.
|
|
467
|
+
//
|
|
468
|
+
// TODO Drop these entries once `background.accent.{pink,yellow}` are
|
|
469
|
+
// available in `tokens.json` so they're picked up by
|
|
470
|
+
// `buildAllTokenVarsFromModeSet`.
|
|
471
|
+
const getStaticTokenVars = () => {
|
|
472
|
+
const toOklch = (hex) => {
|
|
473
|
+
const rgba = parseHexColorToRgba(hex);
|
|
474
|
+
if (!rgba) return null;
|
|
475
|
+
return rgbToOklchComponents(rgba.r, rgba.g, rgba.b, rgba.a);
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
// Hex values mirror the Figma `background/accent/{pink,yellow}` tokens;
|
|
479
|
+
// both modes share the same value until the design system supplies a
|
|
480
|
+
// dedicated dark variant.
|
|
481
|
+
const pink = toOklch('#ffa6d7');
|
|
482
|
+
const yellow = toOklch('#ffe1a6');
|
|
483
|
+
|
|
484
|
+
const shared = {
|
|
485
|
+
'background-accent-pink': pink,
|
|
486
|
+
'background-accent-yellow': yellow,
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
return { light: shared, dark: shared };
|
|
490
|
+
};
|
|
491
|
+
|
|
462
492
|
// Exported functions
|
|
463
493
|
export const getUiLibraryContentConfig = () => ({
|
|
464
494
|
content: {
|
|
@@ -484,14 +514,19 @@ export const getUiLibraryThemeFromTokens = () => ({
|
|
|
484
514
|
* - background.surface.secondary -> --background-surface-secondary
|
|
485
515
|
* - content.on-surface.primary -> --content-on-surface-primary
|
|
486
516
|
*/
|
|
487
|
-
export const getUiLibraryTokenVars = () =>
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
517
|
+
export const getUiLibraryTokenVars = () => {
|
|
518
|
+
const staticVars = getStaticTokenVars();
|
|
519
|
+
return {
|
|
520
|
+
light: {
|
|
521
|
+
...buildAllTokenVarsFromModeSet('3-mode/Light'),
|
|
522
|
+
...staticVars.light,
|
|
523
|
+
},
|
|
524
|
+
dark: {
|
|
525
|
+
...buildAllTokenVarsFromModeSet('3-mode/Dark'),
|
|
526
|
+
...staticVars.dark,
|
|
527
|
+
},
|
|
528
|
+
};
|
|
529
|
+
};
|
|
495
530
|
|
|
496
531
|
/**
|
|
497
532
|
* Get UnoCSS theme colors config for all token-based colors.
|
|
@@ -514,6 +549,7 @@ export const getUiLibraryTokenVars = () => ({
|
|
|
514
549
|
export const getUiLibraryTokenColors = () => {
|
|
515
550
|
const lightVars = {
|
|
516
551
|
...buildAllTokenVarsFromModeSet('3-mode/Light'),
|
|
552
|
+
...getStaticTokenVars().light,
|
|
517
553
|
};
|
|
518
554
|
const colors = {};
|
|
519
555
|
|
|
@@ -525,6 +561,74 @@ export const getUiLibraryTokenColors = () => {
|
|
|
525
561
|
return colors;
|
|
526
562
|
};
|
|
527
563
|
|
|
564
|
+
const getCornerRadiusTokenGroup = () => {
|
|
565
|
+
const primitives = getTokens()?.['1-primitives/Default'];
|
|
566
|
+
return (
|
|
567
|
+
primitives?.aa?.['corner-radius'] ??
|
|
568
|
+
primitives?.aa26?.['corner-radius'] ??
|
|
569
|
+
null
|
|
570
|
+
);
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
const borderRadiusKeyFromTokenName = (tokenName) => {
|
|
574
|
+
const key = tokenName.replace(/^rounded-/, '');
|
|
575
|
+
return key === 'md' ? ['DEFAULT', key] : [key];
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Get UnoCSS border-radius config from corner-radius design tokens.
|
|
580
|
+
* This powers classes like rounded-xs, rounded-md, rounded-4xl, and rounded-full.
|
|
581
|
+
*/
|
|
582
|
+
export const getUiLibraryTokenBorderRadius = () => {
|
|
583
|
+
const cornerRadius = getCornerRadiusTokenGroup();
|
|
584
|
+
if (!cornerRadius) return {};
|
|
585
|
+
|
|
586
|
+
const borderRadius = {};
|
|
587
|
+
for (const [tokenName, tokenData] of Object.entries(cornerRadius)) {
|
|
588
|
+
if (
|
|
589
|
+
!tokenData ||
|
|
590
|
+
typeof tokenData !== 'object' ||
|
|
591
|
+
!('value' in tokenData)
|
|
592
|
+
) {
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
const resolved = resolveReferences(tokenData.value, new Set());
|
|
597
|
+
if (typeof resolved !== 'string' || !resolved.trim()) continue;
|
|
598
|
+
|
|
599
|
+
for (const key of borderRadiusKeyFromTokenName(tokenName)) {
|
|
600
|
+
borderRadius[key] = resolved;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return borderRadius;
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
const getUiLibraryTokenBorderRadiusVars = () =>
|
|
608
|
+
Object.fromEntries(
|
|
609
|
+
Object.entries(getUiLibraryTokenBorderRadius()).map(([key, value]) => [
|
|
610
|
+
`radius-${key}`,
|
|
611
|
+
value,
|
|
612
|
+
]),
|
|
613
|
+
);
|
|
614
|
+
|
|
615
|
+
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
616
|
+
|
|
617
|
+
const entriesToRules = (entries) =>
|
|
618
|
+
entries.map(([className, declarations]) => [
|
|
619
|
+
new RegExp(`^${escapeRegExp(className)}$`),
|
|
620
|
+
() => declarations,
|
|
621
|
+
]);
|
|
622
|
+
|
|
623
|
+
const getBorderRadiusExactUtilityRules = () => {
|
|
624
|
+
const entries = [];
|
|
625
|
+
for (const [key, value] of Object.entries(getUiLibraryTokenBorderRadius())) {
|
|
626
|
+
const className = key === 'DEFAULT' ? 'rounded' : `rounded-${key}`;
|
|
627
|
+
entries.push([className, { 'border-radius': value }]);
|
|
628
|
+
}
|
|
629
|
+
return entriesToRules(entries);
|
|
630
|
+
};
|
|
631
|
+
|
|
528
632
|
export const defineThemeConfig = (config) => config;
|
|
529
633
|
|
|
530
634
|
export const presetUiLibraryTheme = (theme, options = {}) => {
|
|
@@ -572,14 +676,20 @@ export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
|
572
676
|
|
|
573
677
|
// Get base shadcn theme from tokens
|
|
574
678
|
const baseTheme = getUiLibraryThemeFromTokens();
|
|
679
|
+
const tokenBorderRadiusVars = getUiLibraryTokenBorderRadiusVars();
|
|
680
|
+
|
|
681
|
+
// Radius utilities in Wind v4 resolve through --radius-* variables.
|
|
682
|
+
let finalTheme = {
|
|
683
|
+
light: { ...baseTheme.light, ...tokenBorderRadiusVars },
|
|
684
|
+
dark: { ...baseTheme.dark, ...tokenBorderRadiusVars },
|
|
685
|
+
};
|
|
575
686
|
|
|
576
687
|
// Include all token-based variables (default: true)
|
|
577
|
-
let finalTheme = baseTheme;
|
|
578
688
|
if (includeAllTokens) {
|
|
579
689
|
const tokenVars = getUiLibraryTokenVars();
|
|
580
690
|
finalTheme = {
|
|
581
|
-
light: { ...tokenVars.light, ...
|
|
582
|
-
dark: { ...tokenVars.dark, ...
|
|
691
|
+
light: { ...tokenVars.light, ...finalTheme.light },
|
|
692
|
+
dark: { ...tokenVars.dark, ...finalTheme.dark },
|
|
583
693
|
};
|
|
584
694
|
}
|
|
585
695
|
|
|
@@ -642,6 +752,7 @@ export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
|
642
752
|
},
|
|
643
753
|
},
|
|
644
754
|
rules: [
|
|
755
|
+
...getBorderRadiusExactUtilityRules(),
|
|
645
756
|
// Typography classes from design tokens (heading-48-bold, body-14-normal, label-12-medium, etc.)
|
|
646
757
|
...typographyShortcuts.map(([name, css]) => [
|
|
647
758
|
new RegExp(`^${name}$`),
|
|
@@ -746,9 +857,42 @@ const vHoverOverlayCSS = `
|
|
|
746
857
|
.hover-layer[data-active="true"]::after {
|
|
747
858
|
opacity: 1;
|
|
748
859
|
}
|
|
860
|
+
.ui-active-indicator {
|
|
861
|
+
position: relative;
|
|
862
|
+
}
|
|
863
|
+
.ui-active-indicator::before {
|
|
864
|
+
content: "";
|
|
865
|
+
position: absolute;
|
|
866
|
+
z-index: 10;
|
|
867
|
+
top: 50%;
|
|
868
|
+
left: 0;
|
|
869
|
+
width: 0.125rem;
|
|
870
|
+
height: 50%;
|
|
871
|
+
pointer-events: none;
|
|
872
|
+
border-radius: 9999px;
|
|
873
|
+
background-color: oklch(var(--background-accent-default));
|
|
874
|
+
opacity: 0;
|
|
875
|
+
transform: translateY(-50%) scaleX(0);
|
|
876
|
+
transform-origin: left;
|
|
877
|
+
transition:
|
|
878
|
+
transform 200ms linear,
|
|
879
|
+
opacity 200ms linear;
|
|
880
|
+
}
|
|
881
|
+
.ui-active-indicator[data-active="true"]::before,
|
|
882
|
+
.ui-active-indicator-active::before {
|
|
883
|
+
opacity: 1;
|
|
884
|
+
transform: translateY(-50%) scaleX(1);
|
|
885
|
+
}
|
|
886
|
+
.hover-layer:disabled::after,
|
|
887
|
+
.hover-layer[aria-disabled="true"]::after,
|
|
888
|
+
.hover-layer[data-disabled]::after {
|
|
889
|
+
opacity: 0;
|
|
890
|
+
transition: none;
|
|
891
|
+
}
|
|
749
892
|
@media (prefers-reduced-motion: reduce) {
|
|
750
893
|
.v-hover-overlay,
|
|
751
|
-
.hover-layer::after
|
|
894
|
+
.hover-layer::after,
|
|
895
|
+
.ui-active-indicator::before {
|
|
752
896
|
transition: none;
|
|
753
897
|
}
|
|
754
898
|
}
|
|
@@ -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';
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Variant types for the UiItem primitive component
|
|
3
3
|
*/
|
|
4
|
-
export type UiItemVariants = 'default' | 'outline' | '
|
|
4
|
+
export type UiItemVariants = 'default' | 'active' | 'outline' | 'hover' | 'hover-action';
|
|
5
5
|
/**
|
|
6
6
|
* Size types for the UiItem primitive component
|
|
7
7
|
*/
|
|
8
|
-
export type UiItemSizes = 'default' | 'sm';
|
|
8
|
+
export type UiItemSizes = 'default' | 'sm' | 'minimal';
|
|
9
9
|
/**
|
|
10
10
|
* Media variant types for the UiItemMedia component
|
|
11
11
|
*/
|
|
12
|
-
export type UiItemMediaVariants = 'default' | 'icon' | 'image';
|
|
12
|
+
export type UiItemMediaVariants = 'default' | 'icon' | 'image' | 'avatar-group';
|
|
13
|
+
/**
|
|
14
|
+
* Action variant types for the UiItemAction component
|
|
15
|
+
*/
|
|
16
|
+
export type UiItemActionVariants = 'default' | 'text' | 'button';
|
|
13
17
|
/**
|
|
14
18
|
* A versatile component that you can use to display any content.
|
|
15
19
|
* The Item component is a straightforward flex container that can house
|
|
@@ -17,15 +21,17 @@ export type UiItemMediaVariants = 'default' | 'icon' | 'image';
|
|
|
17
21
|
* Group it with the ItemGroup component to create a list of items.
|
|
18
22
|
* @category Layout
|
|
19
23
|
* @useCases list item, menu entry, settings row, navigation item, notification, user card
|
|
20
|
-
* @keywords item, list, row, entry, menu, settings, navigation,
|
|
24
|
+
* @keywords item, list, row, entry, menu, settings, navigation, card
|
|
21
25
|
* @related UiCard, UiButton, UiListbox
|
|
22
26
|
*/
|
|
23
27
|
export interface UiItemProps {
|
|
24
28
|
/**
|
|
25
29
|
* Visual variant of the item.
|
|
26
|
-
* - `default`: Standard styling
|
|
30
|
+
* - `default`: Standard styling without interactive affordance
|
|
31
|
+
* - `active`: Active row with a left-edge indicator and active background
|
|
27
32
|
* - `outline`: Outlined style with clear borders and transparent background
|
|
28
|
-
* - `
|
|
33
|
+
* - `hover`: Row with hover feedback
|
|
34
|
+
* - `hover-action`: Actionable row with hover feedback, except while hovering actions
|
|
29
35
|
* @default 'default'
|
|
30
36
|
*/
|
|
31
37
|
variant?: UiItemVariants;
|
|
@@ -33,23 +39,43 @@ export interface UiItemProps {
|
|
|
33
39
|
* Size of the item.
|
|
34
40
|
* - `default`: Standard size with comfortable padding
|
|
35
41
|
* - `sm`: Compact size for dense layouts
|
|
42
|
+
* - `minimal`: Compact size with smaller default action affordance
|
|
36
43
|
* @default 'default'
|
|
37
44
|
*/
|
|
38
45
|
size?: UiItemSizes;
|
|
46
|
+
/**
|
|
47
|
+
* Convenience title rendered with UiItemTitle.
|
|
48
|
+
*/
|
|
49
|
+
title?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Convenience description rendered with UiItemDescription.
|
|
52
|
+
*/
|
|
53
|
+
description?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Alias for `description`.
|
|
56
|
+
*/
|
|
57
|
+
desc?: string;
|
|
39
58
|
/**
|
|
40
59
|
* Whether to render as a child element (using Radix's asChild pattern).
|
|
41
60
|
* Useful for rendering the item as a link or custom component.
|
|
42
|
-
*
|
|
61
|
+
* Variant and focus styles will be applied to the custom component.
|
|
43
62
|
* @default false
|
|
44
63
|
*/
|
|
45
64
|
asChild?: boolean;
|
|
46
65
|
/**
|
|
47
|
-
* When true
|
|
48
|
-
*
|
|
49
|
-
*
|
|
66
|
+
* When true, sets `role="listitem"` for use inside a parent with `role="list"`.
|
|
67
|
+
* Keep false when rendering standalone items or when the parent already
|
|
68
|
+
* provides list item semantics (e.g. an `<li>`).
|
|
69
|
+
* @default false
|
|
50
70
|
*/
|
|
51
71
|
withListSemantics?: boolean;
|
|
52
72
|
}
|
|
73
|
+
export interface UiItemEmits {
|
|
74
|
+
/**
|
|
75
|
+
* Emitted when the built-in default action button is clicked.
|
|
76
|
+
*/
|
|
77
|
+
action: [event: MouseEvent];
|
|
78
|
+
}
|
|
53
79
|
/**
|
|
54
80
|
* Props for the UiItemGroup component.
|
|
55
81
|
* Container that groups related items together with consistent styling.
|
|
@@ -69,7 +95,8 @@ export interface UiItemMediaProps {
|
|
|
69
95
|
* Visual variant of the media container.
|
|
70
96
|
* - `default`: Standard styling, suitable for avatars
|
|
71
97
|
* - `icon`: Styled for icon display with appropriate sizing
|
|
72
|
-
* - `image`: Styled for image
|
|
98
|
+
* - `image`: Styled for a single avatar or image thumbnail
|
|
99
|
+
* - `avatar-group`: Styled for stacked avatar groups
|
|
73
100
|
* @default 'default'
|
|
74
101
|
*/
|
|
75
102
|
variant?: UiItemMediaVariants;
|
|
@@ -90,10 +117,23 @@ export type UiItemTitleProps = Record<string, never>;
|
|
|
90
117
|
*/
|
|
91
118
|
export type UiItemDescriptionProps = Record<string, never>;
|
|
92
119
|
/**
|
|
93
|
-
* Props for the
|
|
120
|
+
* Props for the UiItemAction component.
|
|
94
121
|
* Displays action buttons or other interactive elements.
|
|
95
122
|
*/
|
|
96
|
-
export
|
|
123
|
+
export interface UiItemActionProps {
|
|
124
|
+
/**
|
|
125
|
+
* Visual variant of the action container.
|
|
126
|
+
* - `default`: Standard flex action layout
|
|
127
|
+
* - `text`: Muted label action
|
|
128
|
+
* - `button`: Compact button-like action affordance
|
|
129
|
+
* @default 'default'
|
|
130
|
+
*/
|
|
131
|
+
variant?: UiItemActionVariants;
|
|
132
|
+
/**
|
|
133
|
+
* Optional tooltip shown when hovering or focusing the action container.
|
|
134
|
+
*/
|
|
135
|
+
tooltip?: string;
|
|
136
|
+
}
|
|
97
137
|
/**
|
|
98
138
|
* Props for the UiItemHeader component.
|
|
99
139
|
* Displays a header above the item content.
|
|
@@ -5,7 +5,7 @@ type __VLS_Props = PrimitiveProps & {
|
|
|
5
5
|
class?: HTMLAttributes['class'];
|
|
6
6
|
variant?: ItemVariants['variant'];
|
|
7
7
|
size?: ItemVariants['size'];
|
|
8
|
-
/** When
|
|
8
|
+
/** When true, sets `role="listitem"` for use inside an element with `role="list"`. */
|
|
9
9
|
withListSemantics?: boolean;
|
|
10
10
|
};
|
|
11
11
|
declare function __VLS_template(): {
|