@aleph-alpha/ui-library 5.2.0 → 5.3.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/dist/system/components/UiTooltip/UiTooltip.vue.d.ts +1 -0
- package/dist/system/components/UiTooltip/types.d.ts +8 -0
- package/dist/system/components/core/tooltip/TooltipContent.vue.d.ts +2 -0
- package/dist/system/index.d.ts +1 -0
- package/dist/system/lib/useAnchorFloat.d.ts +143 -0
- package/dist/system/lib.js +18787 -18280
- package/dist/system/patterns/UiFloatActions/UiFloatActionItems.vue.d.ts +35 -0
- package/dist/system/patterns/UiFloatActions/UiFloatActions.vue.d.ts +45 -0
- package/dist/system/patterns/UiFloatActions/floatActionItemContext.d.ts +16 -0
- package/dist/system/patterns/UiFloatActions/index.d.ts +3 -0
- package/dist/system/patterns/UiFloatActions/types.d.ts +127 -0
- package/dist/system/patterns/index.d.ts +1 -0
- package/docs/public-docs/quick-start.md +43 -0
- package/package.json +1 -1
- package/src/components/UiAccordion/UiAccordion.stories.ts +2 -2
- package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +2 -2
- package/src/components/UiAutocomplete/UiAutocomplete.vue +3 -3
- package/src/components/UiBadge/UiBadge.stories.ts +9 -9
- package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +4 -4
- package/src/components/UiField/UiField.stories.ts +6 -6
- package/src/components/UiInput/UiInput.vue +1 -1
- package/src/components/UiKbd/UiKbd.stories.ts +3 -3
- package/src/components/UiKbd/UiKbd.vue +1 -1
- package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +28 -28
- package/src/components/UiPopover/UiPopover.stories.ts +20 -20
- package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +24 -24
- package/src/components/UiResizable/UiResizable.stories.ts +14 -14
- package/src/components/UiSelect/UiSelect.stories.ts +1 -1
- package/src/components/UiSheet/UiSheet.stories.ts +14 -14
- package/src/components/UiSlider/UiSlider.stories.ts +8 -8
- package/src/components/UiSpinner/UiSpinner.stories.ts +8 -8
- package/src/components/UiSwitch/UiSwitch.stories.ts +4 -4
- package/src/components/UiTabs/UiTabs.stories.ts +46 -46
- package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +14 -14
- package/src/components/UiTooltip/UiTooltip.vue +2 -0
- package/src/components/UiTooltip/types.ts +9 -0
- package/src/components/core/accordion/AccordionContent.vue +1 -1
- package/src/components/core/accordion/AccordionTrigger.vue +1 -1
- package/src/components/core/alert/AlertDescription.vue +1 -1
- package/src/components/core/alert/index.ts +1 -1
- package/src/components/core/calendar/Calendar.vue +4 -4
- package/src/components/core/calendar/CalendarCell.vue +1 -1
- package/src/components/core/drawer/DrawerDescription.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuCheckboxItem.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuItem.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuLabel.vue +1 -3
- package/src/components/core/dropdown-menu/DropdownMenuRadioItem.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuShortcut.vue +4 -1
- package/src/components/core/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
- package/src/components/core/field/FieldDescription.vue +1 -1
- package/src/components/core/field/FieldLegend.vue +2 -2
- package/src/components/core/field/FieldSeparator.vue +1 -1
- package/src/components/core/input/Input.vue +1 -1
- package/src/components/core/item/index.ts +1 -1
- package/src/components/core/label/Label.vue +1 -1
- package/src/components/core/listbox/ListboxFilter.vue +1 -1
- package/src/components/core/listbox/ListboxGroupLabel.vue +1 -1
- package/src/components/core/listbox/ListboxItem.vue +1 -1
- package/src/components/core/native-select/NativeSelect.vue +1 -1
- package/src/components/core/navigation-menu/NavigationMenuLink.vue +1 -1
- package/src/components/core/navigation-menu/index.ts +1 -1
- package/src/components/core/range-calendar/RangeCalendarCell.vue +1 -1
- package/src/components/core/select/SelectItem.vue +1 -1
- package/src/components/core/select/SelectLabel.vue +3 -1
- package/src/components/core/select/SelectTrigger.vue +1 -1
- package/src/components/core/sidebar/SidebarGroupContent.vue +1 -1
- package/src/components/core/sidebar/SidebarGroupLabel.vue +1 -1
- package/src/components/core/sidebar/SidebarMenuBadge.vue +1 -1
- package/src/components/core/sidebar/SidebarMenuSubButton.vue +2 -2
- package/src/components/core/sidebar/index.ts +4 -4
- package/src/components/core/slider/Slider.vue +3 -3
- package/src/components/core/stepper/StepperDescription.vue +1 -1
- package/src/components/core/table/Table.vue +1 -1
- package/src/components/core/table/TableEmpty.vue +1 -1
- package/src/components/core/tabs/TabsTrigger.vue +1 -1
- package/src/components/core/tags-input/TagsInput.vue +1 -1
- package/src/components/core/tags-input/TagsInputItem.vue +1 -1
- package/src/components/core/textarea/Textarea.vue +1 -1
- package/src/components/core/toggle/index.ts +1 -1
- package/src/components/core/toggle-group/index.ts +1 -1
- package/src/components/core/tooltip/TooltipContent.vue +10 -4
- package/src/index.ts +1 -0
- package/src/lib/useAnchorFloat.test.ts +166 -0
- package/src/lib/useAnchorFloat.ts +437 -0
- package/src/lib/useDrag.stories.ts +12 -12
- package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +8 -8
- package/src/patterns/UiFloatActions/UiFloatActionItems.vue +327 -0
- package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +900 -0
- package/src/patterns/UiFloatActions/UiFloatActions.vue +224 -0
- package/src/patterns/UiFloatActions/__tests__/UiFloatActionItems.test.ts +104 -0
- package/src/patterns/UiFloatActions/__tests__/UiFloatActions.a11y.test.ts +152 -0
- package/src/patterns/UiFloatActions/__tests__/UiFloatActions.test.ts +86 -0
- package/src/patterns/UiFloatActions/floatActionItemContext.ts +20 -0
- package/src/patterns/UiFloatActions/index.ts +3 -0
- package/src/patterns/UiFloatActions/types.ts +155 -0
- package/src/patterns/UiSidebar/UiSidebarGroupLabel.stories.ts +2 -2
- package/src/patterns/UiSidebar/UiSidebarMenuButton.stories.ts +3 -3
- package/src/patterns/index.ts +1 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { UiFloatActionItemsProps } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
default?(_: {}): any;
|
|
7
|
+
default?(_: {}): any;
|
|
8
|
+
default?(_: {}): any;
|
|
9
|
+
};
|
|
10
|
+
refs: {
|
|
11
|
+
itemRef: HTMLInputElement;
|
|
12
|
+
};
|
|
13
|
+
rootEl: any;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
16
|
+
declare const __VLS_component: import('vue').DefineComponent<UiFloatActionItemsProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
17
|
+
click: (event: MouseEvent) => any;
|
|
18
|
+
}, string, import('vue').PublicProps, Readonly<UiFloatActionItemsProps> & Readonly<{
|
|
19
|
+
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
orientation: import('./types').UiFloatActionItemsOrientation;
|
|
23
|
+
type: import('./types').UiFloatActionItemsType;
|
|
24
|
+
placeholder: string;
|
|
25
|
+
ariaLabel: string;
|
|
26
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
27
|
+
itemRef: HTMLInputElement;
|
|
28
|
+
}, any>;
|
|
29
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { UiFloatActionsProps } from './types';
|
|
2
|
+
type __VLS_Props = UiFloatActionsProps;
|
|
3
|
+
type __VLS_PublicProps = {
|
|
4
|
+
'open'?: boolean;
|
|
5
|
+
} & __VLS_Props;
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
slots: {
|
|
9
|
+
container?(_: {}): any;
|
|
10
|
+
container?(_: {}): any;
|
|
11
|
+
action?(_: {
|
|
12
|
+
panelEl: HTMLElement | null;
|
|
13
|
+
}): any;
|
|
14
|
+
};
|
|
15
|
+
refs: {
|
|
16
|
+
referenceRef: HTMLSpanElement;
|
|
17
|
+
floatingRef: HTMLDivElement;
|
|
18
|
+
};
|
|
19
|
+
rootEl: any;
|
|
20
|
+
};
|
|
21
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
22
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
23
|
+
"update:open": (value: boolean) => any;
|
|
24
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
25
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
26
|
+
}>, {
|
|
27
|
+
ariaLabel: string;
|
|
28
|
+
offset: import('./types').UiFloatActionsOffset;
|
|
29
|
+
placement: import('./types').UiFloatActionsPlacement;
|
|
30
|
+
trigger: import('./types').UiFloatActionsTrigger;
|
|
31
|
+
openDelay: number;
|
|
32
|
+
closeDelay: number;
|
|
33
|
+
dismissOnOutsideClick: boolean;
|
|
34
|
+
dismissOnEscape: boolean;
|
|
35
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
36
|
+
referenceRef: HTMLSpanElement;
|
|
37
|
+
floatingRef: HTMLDivElement;
|
|
38
|
+
}, any>;
|
|
39
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
40
|
+
export default _default;
|
|
41
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
|
+
/** Shared toolbar state used to coordinate roving-tabindex focus across items. */
|
|
3
|
+
export interface FloatActionItemContext {
|
|
4
|
+
/** Registers a focusable item so the toolbar can manage roving tabindex. */
|
|
5
|
+
registerItem: (id: symbol) => void;
|
|
6
|
+
/** Removes an item from roving-tabindex tracking. */
|
|
7
|
+
unregisterItem: (id: symbol) => void;
|
|
8
|
+
/** Marks an item as the active (tabbable) one when it receives focus. */
|
|
9
|
+
onItemFocus: (id: symbol) => void;
|
|
10
|
+
/** Resolves the roving tabindex (0 for active item, -1 otherwise). */
|
|
11
|
+
getTabIndex: (id: symbol) => number;
|
|
12
|
+
/** Keyboard navigation direction for the toolbar. */
|
|
13
|
+
orientation: Ref<'horizontal' | 'vertical'>;
|
|
14
|
+
}
|
|
15
|
+
export declare const FLOAT_ACTION_ITEM_CONTEXT: InjectionKey<FloatActionItemContext>;
|
|
16
|
+
export declare const FLOAT_ACTION_ITEM_SELECTOR = "[data-slot=\"float-item-action\"]";
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Placement } from '@floating-ui/vue';
|
|
2
|
+
import { HTMLAttributes } from 'vue';
|
|
3
|
+
import { AnchorFloatOffset, AnchorFloatTrigger } from '../../lib/useAnchorFloat';
|
|
4
|
+
export type UiFloatActionsTrigger = AnchorFloatTrigger;
|
|
5
|
+
export type UiFloatActionsPlacement = Placement;
|
|
6
|
+
export type UiFloatActionsOffset = number | AnchorFloatOffset;
|
|
7
|
+
/**
|
|
8
|
+
* Anchors floating action content to a trigger element on hover, focus, or click.
|
|
9
|
+
* Use for contextual toolbars, quick actions, and inline controls.
|
|
10
|
+
* For rich panels or forms, prefer `UiPopover`.
|
|
11
|
+
*
|
|
12
|
+
* This component is currently experimental. Its API and behavior may still change
|
|
13
|
+
* before it is considered stable.
|
|
14
|
+
* @category Overlays
|
|
15
|
+
* @useCases contextual toolbar, inline actions, hover controls, keyboard toolbar
|
|
16
|
+
* @keywords float, anchor, floating, toolbar, hover, focus, contextual, experimental
|
|
17
|
+
* @related UiFloatActionItems, UiPopover, UiTooltip, useAnchorFloat
|
|
18
|
+
*/
|
|
19
|
+
export interface UiFloatActionsProps {
|
|
20
|
+
/**
|
|
21
|
+
* How the floating panel opens.
|
|
22
|
+
* - `hover` — pointer hover and keyboard focus on a focusable `button` anchor
|
|
23
|
+
* - `focus` — keyboard focus on the `button` anchor
|
|
24
|
+
* - `click` — click or Enter/Space on the `button` anchor
|
|
25
|
+
* - `manual` — controlled via `v-model:open`
|
|
26
|
+
* @default 'hover'
|
|
27
|
+
*/
|
|
28
|
+
trigger?: UiFloatActionsTrigger;
|
|
29
|
+
/**
|
|
30
|
+
* Preferred placement relative to the anchor element.
|
|
31
|
+
* Auto-flips when there is not enough room.
|
|
32
|
+
* @default 'top'
|
|
33
|
+
*/
|
|
34
|
+
placement?: UiFloatActionsPlacement;
|
|
35
|
+
/**
|
|
36
|
+
* Distance from the anchor element, in pixels.
|
|
37
|
+
* Pass an object to set main-axis and cross-axis offsets independently.
|
|
38
|
+
* @default 8
|
|
39
|
+
*/
|
|
40
|
+
offset?: UiFloatActionsOffset;
|
|
41
|
+
/**
|
|
42
|
+
* The controlled open state of the floating panel.
|
|
43
|
+
* - Omit for uncontrolled mode (component manages state internally)
|
|
44
|
+
* - Use `v-model:open` for controlled mode
|
|
45
|
+
* @example
|
|
46
|
+
* ```vue
|
|
47
|
+
* <UiFloatActions v-model:open="isOpen">…</UiFloatActions>
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
open?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Delay in ms before opening on pointer hover.
|
|
53
|
+
* Keyboard focus opens immediately regardless of this value.
|
|
54
|
+
* @default 150
|
|
55
|
+
*/
|
|
56
|
+
openDelay?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Delay in ms before closing on pointer leave.
|
|
59
|
+
* @default 150
|
|
60
|
+
*/
|
|
61
|
+
closeDelay?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Close when clicking outside the anchor and floating panel.
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
dismissOnOutsideClick?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Close when Escape is pressed and restore focus to the anchor.
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
dismissOnEscape?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Accessible label for the anchor when it has no visible text.
|
|
74
|
+
* **Required** for triggers without readable anchor content when keyboard
|
|
75
|
+
* users need a concise name (e.g. icon-only or non-descriptive anchors).
|
|
76
|
+
*/
|
|
77
|
+
ariaLabel?: string;
|
|
78
|
+
}
|
|
79
|
+
/** Item role within a {@link UiFloatActionItems} toolbar. */
|
|
80
|
+
export type UiFloatActionItemsType = 'toolbar' | 'button' | 'input' | 'text' | 'group' | 'separator';
|
|
81
|
+
/** Arrow-key navigation direction for toolbar roving focus. */
|
|
82
|
+
export type UiFloatActionItemsOrientation = 'horizontal' | 'vertical';
|
|
83
|
+
/**
|
|
84
|
+
* Pill-shaped floating toolbar and its action items.
|
|
85
|
+
*
|
|
86
|
+
* Use the root item (`type="toolbar"`) as the container and nest child items
|
|
87
|
+
* for buttons, inputs, text labels, groups, and separators. Implements the
|
|
88
|
+
* WAI-ARIA APG toolbar pattern with roving tabindex.
|
|
89
|
+
*
|
|
90
|
+
* @category Overlays
|
|
91
|
+
* @useCases contextual toolbar, inline actions, pagination controls, filter bar
|
|
92
|
+
* @keywords float, toolbar, pill, actions, keyboard, roving focus
|
|
93
|
+
* @related UiFloatActions, useAnchorFloat
|
|
94
|
+
*/
|
|
95
|
+
export interface UiFloatActionItemsProps {
|
|
96
|
+
/**
|
|
97
|
+
* Item role within the floating toolbar.
|
|
98
|
+
* Omit or use `toolbar` for the root pill container.
|
|
99
|
+
* @default 'toolbar'
|
|
100
|
+
*/
|
|
101
|
+
type?: UiFloatActionItemsType;
|
|
102
|
+
/**
|
|
103
|
+
* Disables interaction for `button` and `input` items.
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
disabled?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Accessible label for `toolbar`, `button`, and `input` items.
|
|
109
|
+
* **Required** for those types — icon-only buttons have no visible text.
|
|
110
|
+
*/
|
|
111
|
+
ariaLabel?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Keyboard navigation direction for toolbar items (ArrowLeft/Right or Up/Down).
|
|
114
|
+
* @default 'horizontal'
|
|
115
|
+
*/
|
|
116
|
+
orientation?: UiFloatActionItemsOrientation;
|
|
117
|
+
/**
|
|
118
|
+
* Placeholder text for `input` items.
|
|
119
|
+
*/
|
|
120
|
+
placeholder?: string;
|
|
121
|
+
}
|
|
122
|
+
/** Events emitted by {@link UiFloatActionItems} button items. */
|
|
123
|
+
export interface UiFloatActionItemsEmits {
|
|
124
|
+
/** Emitted when a `button` item is activated. */
|
|
125
|
+
click: [event: MouseEvent];
|
|
126
|
+
}
|
|
127
|
+
export type UiFloatActionItemsClass = HTMLAttributes['class'];
|
|
@@ -222,6 +222,49 @@ Run your dev server (e.g. `pnpm dev`) and open the app. The button and badge sho
|
|
|
222
222
|
|
|
223
223
|
---
|
|
224
224
|
|
|
225
|
+
## Typography
|
|
226
|
+
|
|
227
|
+
Style text with the design-system typography utilities — **never** raw UnoCSS/Tailwind font-size classes. Each utility is generated from the typography design tokens and sets `font-family`, `font-size`, `font-weight`, and `line-height` together, so text stays correct when the tokens or root font size change.
|
|
228
|
+
|
|
229
|
+
!!! danger "Do not use raw `text-*` size classes"
|
|
230
|
+
The library intentionally does **not** treat `text-xs`, `text-sm`, `text-base`, `text-lg`, or `text-xl` as design-system typography, and `text-md` is not a real class at all (it silently does nothing). AI assistants and contributors must use the named utilities below instead. This keeps generated code aligned with the design system.
|
|
231
|
+
|
|
232
|
+
### Available utilities
|
|
233
|
+
|
|
234
|
+
| Group | Utilities | Use for |
|
|
235
|
+
|-------|-----------|---------|
|
|
236
|
+
| Labels | `label-12-*`, `label-14-*`, `label-16-*` (`-regular` \| `-medium` \| `-bold`; `-regular` also aliased as `-normal`) | UI / inline element text: buttons, menu items, form labels, badges, table cells |
|
|
237
|
+
| Body | `body-14-*`, `body-16-*` (`-regular` \| `-medium` \| `-bold`) | Paragraphs and prose / descriptions |
|
|
238
|
+
| Headings | `heading-s`, `heading-m`, `heading-l`, `heading-xl`, `heading-2xl` (one class each, no weight suffix) | Section and page headings |
|
|
239
|
+
|
|
240
|
+
### Replace raw sizes with tokens
|
|
241
|
+
|
|
242
|
+
| Raw class (avoid) | Size | Use instead |
|
|
243
|
+
|-------------------|------|-------------|
|
|
244
|
+
| `text-xs` | 12px | `label-12-regular` (or `-medium` / `-bold`) |
|
|
245
|
+
| `text-sm` | 14px | `body-14-regular` for prose, `label-14-*` for UI text |
|
|
246
|
+
| `text-base` / `text-md` | 16px | `body-16-regular` for prose, `label-16-*` for UI text |
|
|
247
|
+
| `text-lg` / `text-xl` | 18–20px | `heading-s` |
|
|
248
|
+
| `text-2xl` | 24px | `heading-m` |
|
|
249
|
+
|
|
250
|
+
When a raw class is paired with a weight (e.g. `text-sm font-medium`), collapse both into a single token that already carries the weight (`label-14-medium`) rather than keeping a separate `font-*` class. For headings, drop the `font-*` class entirely — the `heading-*` utility owns its weight.
|
|
251
|
+
|
|
252
|
+
```html
|
|
253
|
+
<!-- Don't: raw sizes + separate weight -->
|
|
254
|
+
<h3 class="text-lg font-medium">Account</h3>
|
|
255
|
+
<p class="text-sm text-muted-foreground">Manage your settings.</p>
|
|
256
|
+
<label class="text-sm font-medium">Email</label>
|
|
257
|
+
|
|
258
|
+
<!-- Do: design-system typography utilities -->
|
|
259
|
+
<h3 class="heading-s">Account</h3>
|
|
260
|
+
<p class="body-14-regular text-muted-foreground">Manage your settings.</p>
|
|
261
|
+
<label class="label-14-medium">Email</label>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Browse the live examples under **CSS utility → Typography** in [Storybook](https://dev.aleph-alpha.de/ui-library).
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
225
268
|
## Dark mode
|
|
226
269
|
|
|
227
270
|
The library supports dark mode via the `html.dark` class. Toggle it on the document element:
|
package/package.json
CHANGED
|
@@ -440,7 +440,7 @@ function closeAll() {
|
|
|
440
440
|
<template>
|
|
441
441
|
<div class="gap-y-4">
|
|
442
442
|
<div class="flex items-center gap-4">
|
|
443
|
-
<p class="
|
|
443
|
+
<p class="body-14-regular">Current: <strong>{{ activeItem ?? 'none' }}</strong></p>
|
|
444
444
|
<UiButton size="sm" @click="goToDetails">Go to Details</UiButton>
|
|
445
445
|
<UiButton size="sm" variant="secondary" @click="closeAll">Close All</UiButton>
|
|
446
446
|
</div>
|
|
@@ -500,7 +500,7 @@ export const Controlled: Story = {
|
|
|
500
500
|
template: `
|
|
501
501
|
<div class="gap-y-4">
|
|
502
502
|
<div class="flex items-center gap-4">
|
|
503
|
-
<p class="
|
|
503
|
+
<p class="body-14-regular">Current: <strong>{{ activeItem ?? 'none' }}</strong></p>
|
|
504
504
|
<UiButton size="sm" @click="goToDetails">Go to Details</UiButton>
|
|
505
505
|
<UiButton size="sm" variant="secondary" @click="closeAll">Close All</UiButton>
|
|
506
506
|
</div>
|
|
@@ -138,7 +138,7 @@ export const Multiple: Story = {
|
|
|
138
138
|
placeholder="Search fruits"
|
|
139
139
|
class="w-[220px]"
|
|
140
140
|
/>
|
|
141
|
-
<div class="
|
|
141
|
+
<div class="label-12-regular text-content-on-surface-secondary">
|
|
142
142
|
Selected: {{ value.join(', ') || 'None' }}
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
@@ -175,7 +175,7 @@ export const WithSlots: Story = {
|
|
|
175
175
|
<template #item="{ option, selected }">
|
|
176
176
|
<div class="flex min-w-0 flex-1 items-center justify-between gap-2">
|
|
177
177
|
<span class="truncate">{{ option.label }}</span>
|
|
178
|
-
<span v-if="selected" class="
|
|
178
|
+
<span v-if="selected" class="label-12-regular text-muted-foreground">Selected</span>
|
|
179
179
|
</div>
|
|
180
180
|
</template>
|
|
181
181
|
</UiAutocomplete>
|
|
@@ -143,7 +143,7 @@ const inputSlotProps = computed(() => ({
|
|
|
143
143
|
|
|
144
144
|
const shellClasses = computed(() =>
|
|
145
145
|
cn(
|
|
146
|
-
'border-input data-[placeholder]:bg-background-input-default [&:not([data-placeholder])]:border-border-surface-focus-ring focus-within:border-border-surface-focus-ring focus-within:ring-ring/50 focus-within:shadow-xs aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex h-9 w-full min-w-0 items-center gap-2 rounded-md border bg-accent px-3 py-2
|
|
146
|
+
'border-input data-[placeholder]:bg-background-input-default [&:not([data-placeholder])]:border-border-surface-focus-ring focus-within:border-border-surface-focus-ring focus-within:ring-ring/50 focus-within:shadow-xs aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex h-9 w-full min-w-0 items-center gap-2 rounded-md border bg-accent px-3 py-2 label-14-regular transition-[color,box-shadow] outline-none focus-within:ring-[3px]',
|
|
147
147
|
props.disabled && 'pointer-events-none cursor-not-allowed opacity-50',
|
|
148
148
|
),
|
|
149
149
|
);
|
|
@@ -414,7 +414,7 @@ provideUiAutocompleteContext({
|
|
|
414
414
|
"
|
|
415
415
|
:data-state="isSelected(option.value) ? 'checked' : 'unchecked'"
|
|
416
416
|
tabindex="-1"
|
|
417
|
-
class="hover-layer hover-layer-default focus:text-foreground data-[highlighted]:bg-background-surface-muted-subtle data-[highlighted]:text-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pl-2
|
|
417
|
+
class="hover-layer hover-layer-default focus:text-foreground data-[highlighted]:bg-background-surface-muted-subtle data-[highlighted]:text-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pl-2 label-14-regular outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
418
418
|
:class="{
|
|
419
419
|
'pr-12': props.showIndicator,
|
|
420
420
|
'pr-2': !props.showIndicator,
|
|
@@ -453,7 +453,7 @@ provideUiAutocompleteContext({
|
|
|
453
453
|
|
|
454
454
|
<div
|
|
455
455
|
v-if="hasInternalOptions && filteredOptions.length === 0"
|
|
456
|
-
class="text-muted-foreground px-2 py-1.5
|
|
456
|
+
class="text-muted-foreground px-2 py-1.5 label-14-regular"
|
|
457
457
|
>
|
|
458
458
|
{{ props.emptyText }}
|
|
459
459
|
</div>
|
|
@@ -248,17 +248,17 @@ export const Numbers: Story = {
|
|
|
248
248
|
class="grid min-w-[920px] gap-x-4 gap-y-3"
|
|
249
249
|
:style="{ gridTemplateColumns: '120px repeat(' + variants.length + ', minmax(0, 1fr))' }"
|
|
250
250
|
>
|
|
251
|
-
<div class="
|
|
251
|
+
<div class="label-12-medium text-content-on-surface-muted">Variant</div>
|
|
252
252
|
<div
|
|
253
253
|
v-for="variant in variants"
|
|
254
254
|
:key="variant.key"
|
|
255
|
-
class="
|
|
255
|
+
class="label-12-medium text-content-on-surface-muted"
|
|
256
256
|
>
|
|
257
257
|
{{ variant.label }}
|
|
258
258
|
</div>
|
|
259
259
|
|
|
260
260
|
<template v-for="state in states" :key="state.key">
|
|
261
|
-
<div class="
|
|
261
|
+
<div class="label-12-medium text-content-on-surface-muted">
|
|
262
262
|
{{ state.label }}
|
|
263
263
|
</div>
|
|
264
264
|
|
|
@@ -297,17 +297,17 @@ export const Sizes: Story = {
|
|
|
297
297
|
class="grid min-w-[920px] items-center gap-x-4 gap-y-3"
|
|
298
298
|
:style="{ gridTemplateColumns: '120px repeat(' + variants.length + ', minmax(0, 1fr))' }"
|
|
299
299
|
>
|
|
300
|
-
<div class="
|
|
300
|
+
<div class="label-12-medium text-content-on-surface-muted">Size</div>
|
|
301
301
|
<div
|
|
302
302
|
v-for="variant in variants"
|
|
303
303
|
:key="variant.key"
|
|
304
|
-
class="
|
|
304
|
+
class="label-12-medium text-content-on-surface-muted"
|
|
305
305
|
>
|
|
306
306
|
{{ variant.label }}
|
|
307
307
|
</div>
|
|
308
308
|
|
|
309
309
|
<template v-for="size in sizes" :key="size.key">
|
|
310
|
-
<div class="
|
|
310
|
+
<div class="label-12-medium text-content-on-surface-muted">
|
|
311
311
|
{{ size.label }}
|
|
312
312
|
</div>
|
|
313
313
|
|
|
@@ -356,17 +356,17 @@ export const AllVariants: Story = {
|
|
|
356
356
|
class="grid min-w-[920px] items-center gap-x-4 gap-y-3"
|
|
357
357
|
:style="{ gridTemplateColumns: '160px repeat(' + variants.length + ', minmax(0, 1fr))' }"
|
|
358
358
|
>
|
|
359
|
-
<div class="
|
|
359
|
+
<div class="label-12-medium text-content-on-surface-muted">Variant</div>
|
|
360
360
|
<div
|
|
361
361
|
v-for="variant in variants"
|
|
362
362
|
:key="variant.key"
|
|
363
|
-
class="
|
|
363
|
+
class="label-12-medium text-content-on-surface-muted"
|
|
364
364
|
>
|
|
365
365
|
{{ variant.label }}
|
|
366
366
|
</div>
|
|
367
367
|
|
|
368
368
|
<template v-for="row in rows" :key="row.key">
|
|
369
|
-
<div class="
|
|
369
|
+
<div class="label-12-medium text-content-on-surface-muted">
|
|
370
370
|
{{ row.label }}
|
|
371
371
|
</div>
|
|
372
372
|
|
|
@@ -1056,8 +1056,8 @@ const open = ref(false)
|
|
|
1056
1056
|
<UiAvatarFallback>CN</UiAvatarFallback>
|
|
1057
1057
|
</UiAvatar>
|
|
1058
1058
|
<div class="flex flex-col items-start overflow-hidden">
|
|
1059
|
-
<span class="truncate
|
|
1060
|
-
<span class="truncate
|
|
1059
|
+
<span class="truncate label-14-medium">Sofia Davis</span>
|
|
1060
|
+
<span class="truncate label-12-regular text-muted-foreground font-normal">sofia@example.com</span>
|
|
1061
1061
|
</div>
|
|
1062
1062
|
<UiIcon name="chevrons-up-down" :size="16" class="shrink-0 text-muted-foreground" />
|
|
1063
1063
|
</UiButton>
|
|
@@ -1114,8 +1114,8 @@ export const WithAvatarTrigger: Story = {
|
|
|
1114
1114
|
<UiAvatarFallback>CN</UiAvatarFallback>
|
|
1115
1115
|
</UiAvatar>
|
|
1116
1116
|
<div class="flex flex-col items-start overflow-hidden">
|
|
1117
|
-
<span class="truncate
|
|
1118
|
-
<span class="truncate
|
|
1117
|
+
<span class="truncate label-14-medium">Sofia Davis</span>
|
|
1118
|
+
<span class="truncate label-12-regular text-muted-foreground font-normal">sofia@example.com</span>
|
|
1119
1119
|
</div>
|
|
1120
1120
|
<UiIcon name="chevrons-up-down" :size="16" class="shrink-0 text-muted-foreground" />
|
|
1121
1121
|
</UiButton>
|
|
@@ -1331,7 +1331,7 @@ const plan = ref('pro')
|
|
|
1331
1331
|
<UiField orientation="responsive">
|
|
1332
1332
|
<UiRadioGroupItem id="plan-free" value="free" />
|
|
1333
1333
|
<UiFieldContent>
|
|
1334
|
-
<label for="plan-free" class="
|
|
1334
|
+
<label for="plan-free" class="label-14-medium">Free</label>
|
|
1335
1335
|
<UiFieldDescription>Basic features for personal use.</UiFieldDescription>
|
|
1336
1336
|
</UiFieldContent>
|
|
1337
1337
|
</UiField>
|
|
@@ -1339,7 +1339,7 @@ const plan = ref('pro')
|
|
|
1339
1339
|
<UiField orientation="responsive">
|
|
1340
1340
|
<UiRadioGroupItem id="plan-pro" value="pro" />
|
|
1341
1341
|
<UiFieldContent>
|
|
1342
|
-
<label for="plan-pro" class="
|
|
1342
|
+
<label for="plan-pro" class="label-14-medium">Pro</label>
|
|
1343
1343
|
<UiFieldDescription>Everything you need for work.</UiFieldDescription>
|
|
1344
1344
|
</UiFieldContent>
|
|
1345
1345
|
</UiField>
|
|
@@ -1347,7 +1347,7 @@ const plan = ref('pro')
|
|
|
1347
1347
|
<UiField orientation="responsive" data-disabled="true">
|
|
1348
1348
|
<UiRadioGroupItem id="plan-enterprise" value="enterprise" disabled />
|
|
1349
1349
|
<UiFieldContent>
|
|
1350
|
-
<label for="plan-enterprise" class="
|
|
1350
|
+
<label for="plan-enterprise" class="label-14-medium text-muted-foreground">Enterprise</label>
|
|
1351
1351
|
<UiFieldDescription>Contact sales for pricing.</UiFieldDescription>
|
|
1352
1352
|
</UiFieldContent>
|
|
1353
1353
|
</UiField>
|
|
@@ -1386,7 +1386,7 @@ export const RadioGroupInFieldSet: Story = {
|
|
|
1386
1386
|
<UiField orientation="responsive">
|
|
1387
1387
|
<UiRadioGroupItem id="plan-free" value="free" />
|
|
1388
1388
|
<UiFieldContent>
|
|
1389
|
-
<label for="plan-free" class="
|
|
1389
|
+
<label for="plan-free" class="label-14-medium">Free</label>
|
|
1390
1390
|
<UiFieldDescription>Basic features for personal use.</UiFieldDescription>
|
|
1391
1391
|
</UiFieldContent>
|
|
1392
1392
|
</UiField>
|
|
@@ -1394,7 +1394,7 @@ export const RadioGroupInFieldSet: Story = {
|
|
|
1394
1394
|
<UiField orientation="responsive">
|
|
1395
1395
|
<UiRadioGroupItem id="plan-pro" value="pro" />
|
|
1396
1396
|
<UiFieldContent>
|
|
1397
|
-
<label for="plan-pro" class="
|
|
1397
|
+
<label for="plan-pro" class="label-14-medium">Pro</label>
|
|
1398
1398
|
<UiFieldDescription>Everything you need for work.</UiFieldDescription>
|
|
1399
1399
|
</UiFieldContent>
|
|
1400
1400
|
</UiField>
|
|
@@ -1402,7 +1402,7 @@ export const RadioGroupInFieldSet: Story = {
|
|
|
1402
1402
|
<UiField orientation="responsive" data-disabled="true">
|
|
1403
1403
|
<UiRadioGroupItem id="plan-enterprise" value="enterprise" disabled />
|
|
1404
1404
|
<UiFieldContent>
|
|
1405
|
-
<label for="plan-enterprise" class="
|
|
1405
|
+
<label for="plan-enterprise" class="label-14-medium text-muted-foreground">Enterprise</label>
|
|
1406
1406
|
<UiFieldDescription>Contact sales for pricing.</UiFieldDescription>
|
|
1407
1407
|
</UiFieldContent>
|
|
1408
1408
|
</UiField>
|
|
@@ -84,7 +84,7 @@ function handleFilesChange(e: Event) {
|
|
|
84
84
|
</label>
|
|
85
85
|
</UiButton>
|
|
86
86
|
<span
|
|
87
|
-
class="placeholder:text-muted-foreground flex-1 truncate pr-2
|
|
87
|
+
class="placeholder:text-muted-foreground flex-1 truncate pr-2 label-16-regular md:label-14-regular"
|
|
88
88
|
:class="{ 'text-muted-foreground': fileDisplayValue === '' }"
|
|
89
89
|
:aria-controls="fileInputId"
|
|
90
90
|
>
|
|
@@ -528,17 +528,17 @@ export const Sizes: Story = {
|
|
|
528
528
|
template: `
|
|
529
529
|
<div class="flex items-center gap-4">
|
|
530
530
|
<div class="flex items-center gap-1">
|
|
531
|
-
<span class="
|
|
531
|
+
<span class="label-12-regular text-muted-foreground">sm:</span>
|
|
532
532
|
<UiKbd size="sm">Ctrl</UiKbd>
|
|
533
533
|
<UiKbd size="sm">S</UiKbd>
|
|
534
534
|
</div>
|
|
535
535
|
<div class="flex items-center gap-1">
|
|
536
|
-
<span class="
|
|
536
|
+
<span class="label-12-regular text-muted-foreground">default:</span>
|
|
537
537
|
<UiKbd>Ctrl</UiKbd>
|
|
538
538
|
<UiKbd>S</UiKbd>
|
|
539
539
|
</div>
|
|
540
540
|
<div class="flex items-center gap-1">
|
|
541
|
-
<span class="
|
|
541
|
+
<span class="label-12-regular text-muted-foreground">lg:</span>
|
|
542
542
|
<UiKbd size="lg">Ctrl</UiKbd>
|
|
543
543
|
<UiKbd size="lg">S</UiKbd>
|
|
544
544
|
</div>
|