@aleph-alpha/ui-library 2.11.0 → 3.0.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/config.d.ts +8 -2
- package/config.js +85 -73
- package/dist/system/components/UiAutocomplete/types.d.ts +0 -1
- package/dist/system/components/UiDialog/UiDialogDescription.vue.d.ts +2 -1
- package/dist/system/components/UiDialog/UiDialogFooter.vue.d.ts +1 -2
- package/dist/system/components/UiDialog/UiDialogHeader.vue.d.ts +1 -2
- package/dist/system/components/UiDialog/UiDialogTitle.vue.d.ts +2 -1
- package/dist/system/components/UiDialog/types.d.ts +10 -4
- package/dist/system/components/UiDropdownMenu/UiDropdownMenuSub.vue.d.ts +3 -1
- package/dist/system/components/UiField/UiFieldError.vue.d.ts +8 -1
- package/dist/system/components/UiInput/UiInput.vue.d.ts +16 -1
- package/dist/system/components/UiStepper/UiStepperDescription.vue.d.ts +3 -1
- package/dist/system/components/UiStepper/UiStepperIndicator.vue.d.ts +3 -1
- package/dist/system/components/UiStepper/UiStepperItem.vue.d.ts +3 -1
- package/dist/system/components/UiTagsInput/types.d.ts +1 -2
- package/dist/system/components/core/accordion/AccordionItem.vue.d.ts +3 -1
- package/dist/system/components/core/calendar/CalendarHeading.vue.d.ts +2 -2
- package/dist/system/components/core/dropdown-menu/DropdownMenuSub.vue.d.ts +3 -1
- package/dist/system/components/core/range-calendar/RangeCalendarHeading.vue.d.ts +2 -2
- package/dist/system/components/core/stepper/StepperDescription.vue.d.ts +3 -1
- package/dist/system/components/core/stepper/StepperIndicator.vue.d.ts +3 -1
- package/dist/system/components/core/stepper/StepperItem.vue.d.ts +3 -1
- package/dist/system/index.d.ts +2 -1
- package/dist/system/lib/utils.d.ts +6 -0
- package/dist/system/lib.js +15498 -15548
- package/dist/system/patterns/UiSidebar/UiSidebarContent.vue.d.ts +1 -2
- package/dist/system/patterns/UiSidebar/UiSidebarFooter.vue.d.ts +1 -2
- package/dist/system/patterns/UiSidebar/UiSidebarGroupContent.vue.d.ts +1 -2
- package/dist/system/patterns/UiSidebar/UiSidebarInset.vue.d.ts +1 -2
- package/dist/system/patterns/UiSidebar/UiSidebarMenu.vue.d.ts +1 -2
- package/dist/system/patterns/UiSidebar/UiSidebarMenuItem.vue.d.ts +1 -2
- package/dist/system/patterns/UiSidebar/UiSidebarProvider.vue.d.ts +1 -2
- package/dist/system/patterns/UiSidebar/UiSidebarRail.vue.d.ts +1 -2
- package/dist/system/patterns/UiSidebar/__tests__/sidebar-test-helpers.d.ts +9 -9
- package/dist/system/patterns/UiSidebar/types.d.ts +8 -16
- package/dist/system/story-sidebar-icons.json +10 -0
- package/package.json +4 -1
- package/src/@types/shims-vue.d.ts +1 -1
- package/src/__tests__/test-utils.ts +1 -1
- package/src/components/UiAlertDialog/UiAlertDialogAction.vue +1 -1
- package/src/components/UiAlertDialog/UiAlertDialogCancel.vue +1 -1
- package/src/components/UiAlertDialog/UiAlertDialogContent.vue +4 -1
- package/src/components/UiAlertDialog/UiAlertDialogDescription.vue +1 -1
- package/src/components/UiAlertDialog/UiAlertDialogTitle.vue +1 -1
- package/src/components/UiAlertDialog/UiAlertDialogTrigger.vue +1 -1
- package/src/components/UiAutocomplete/types.ts +0 -1
- package/src/components/UiBadge/UiBadge.vue +1 -1
- package/src/components/UiBadge/constants.ts +1 -1
- package/src/components/UiBadge/types.ts +1 -1
- package/src/components/UiButton/UiButton.stories.ts +286 -198
- package/src/components/UiButton/mcp-docs.json +49 -0
- package/src/components/UiCalendar/UiCalendar.vue +2 -5
- package/src/components/UiCalendar/__tests__/UiCalendar.test.ts +4 -2
- package/src/components/UiCheckbox/UiCheckbox.stories.ts +176 -2
- package/src/components/UiCheckbox/mcp-docs.json +36 -0
- package/src/components/UiChip/types.ts +1 -1
- package/src/components/UiDialog/UiDialogFooter.vue +0 -3
- package/src/components/UiDialog/UiDialogHeader.vue +0 -3
- package/src/components/UiDialog/types.ts +10 -4
- package/src/components/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +1 -1
- package/src/components/UiField/UiField.stories.ts +265 -3
- package/src/components/UiField/UiField.vue +9 -2
- package/src/components/UiField/UiFieldError.vue +3 -3
- package/src/components/UiField/mcp-docs.json +72 -0
- package/src/components/UiFileItem/UiFileItem.stories.ts +11 -11
- package/src/components/UiFileUploadBox/UiFileUploadBox.vue +1 -1
- package/src/components/UiIcon/UiIcon.vue +3 -2
- package/src/components/UiInput/UiInput.vue +19 -3
- package/src/components/UiInput/mcp-docs.json +51 -0
- package/src/components/UiItem/UiItem.stories.ts +118 -2
- package/src/components/UiItem/__tests__/UiItem.test.ts +3 -5
- package/src/components/UiItem/mcp-docs.json +25 -0
- package/src/components/UiLabel/UiLabel.vue +1 -1
- package/src/components/UiListbox/UiListbox.vue +3 -6
- package/src/components/UiListbox/UiListboxFilter.vue +1 -1
- package/src/components/UiListbox/UiListboxItem.vue +1 -1
- package/src/components/UiProgress/UiProgress.vue +1 -1
- package/src/components/UiRadioGroup/UiRadioGroup.vue +1 -1
- package/src/components/UiRadioGroup/UiRadioGroupItem.vue +2 -2
- package/src/components/UiRadioGroup/__tests__/UiRadioGroup.test.ts +2 -2
- package/src/components/UiRangeCalendar/UiRangeCalendar.vue +2 -5
- package/src/components/UiRangeCalendar/__tests__/UiRangeCalendar.test.ts +9 -6
- package/src/components/UiSelect/UiSelectContent.vue +2 -4
- package/src/components/UiSwitch/UiSwitch.vue +1 -1
- package/src/components/UiTagsInput/UiTagsInput.vue +1 -1
- package/src/components/UiTagsInput/UiTagsInputInput.vue +1 -1
- package/src/components/UiTagsInput/UiTagsInputItem.vue +1 -1
- package/src/components/UiTagsInput/types.ts +1 -4
- package/src/components/UiTooltip/UiTooltip.stories.ts +0 -8
- package/src/components/core/accordion/AccordionItem.vue +1 -1
- package/src/components/core/alert-dialog/AlertDialogContent.vue +1 -1
- package/src/components/core/badge/Badge.vue +2 -5
- package/src/components/core/calendar/CalendarHeading.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuSub.vue +1 -1
- package/src/components/core/item/index.ts +1 -1
- package/src/components/core/listbox/Listbox.vue +2 -5
- package/src/components/core/listbox/ListboxContent.vue +2 -5
- package/src/components/core/listbox/ListboxFilter.vue +2 -5
- package/src/components/core/listbox/ListboxGroup.vue +2 -5
- package/src/components/core/listbox/ListboxGroupLabel.vue +2 -5
- package/src/components/core/listbox/ListboxItem.vue +2 -5
- package/src/components/core/listbox/ListboxItemIndicator.vue +2 -5
- package/src/components/core/range-calendar/RangeCalendarHeading.vue +1 -1
- package/src/components/core/sidebar/SidebarContent.vue +4 -5
- package/src/components/core/sidebar/SidebarFooter.vue +4 -5
- package/src/components/core/sidebar/SidebarGroup.vue +4 -5
- package/src/components/core/sidebar/SidebarHeader.vue +4 -5
- package/src/components/core/sidebar/SidebarMenu.vue +4 -5
- package/src/components/core/sidebar/SidebarMenuAction.vue +1 -1
- package/src/components/core/sidebar/SidebarMenuButtonChild.vue +1 -1
- package/src/components/core/sidebar/SidebarMenuSkeleton.vue +1 -1
- package/src/components/core/sidebar/SidebarMenuSubButton.vue +1 -1
- package/src/components/core/sidebar/SidebarSeparator.vue +4 -5
- package/src/components/core/stepper/StepperDescription.vue +1 -1
- package/src/components/core/stepper/StepperIndicator.vue +1 -1
- package/src/components/core/stepper/StepperItem.vue +1 -1
- package/src/components/core/tags-input/TagsInput.vue +2 -5
- package/src/components/core/tags-input/TagsInputInput.vue +2 -5
- package/src/components/core/tags-input/TagsInputItem.vue +2 -5
- package/src/components/core/tags-input/TagsInputItemDelete.vue +2 -5
- package/src/components/core/tags-input/TagsInputItemText.vue +2 -5
- package/src/components/core/toggle/Toggle.vue +1 -1
- package/src/index.ts +30 -5
- package/src/lib/useDrag.ts +1 -0
- package/src/lib/utils.ts +12 -0
- package/src/patterns/UiDataTable/UiDataTable.mock.ts +13 -4
- package/src/patterns/UiDataTable/UiDataTable.vue +1 -0
- package/src/patterns/UiDataTable/__tests__/UiDataTable.test.ts +11 -2
- package/src/patterns/UiDatePicker/__tests__/UiDatePicker.test.ts +28 -39
- package/src/patterns/UiSidebar/UiSidebarContent.vue +0 -3
- package/src/patterns/UiSidebar/UiSidebarFooter.vue +0 -3
- package/src/patterns/UiSidebar/UiSidebarGroup.vue +4 -5
- package/src/patterns/UiSidebar/UiSidebarGroupContent.vue +0 -3
- package/src/patterns/UiSidebar/UiSidebarHeader.vue +4 -5
- package/src/patterns/UiSidebar/UiSidebarInset.vue +0 -3
- package/src/patterns/UiSidebar/UiSidebarMenu.vue +0 -3
- package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +4 -5
- package/src/patterns/UiSidebar/UiSidebarMenuItem.vue +0 -3
- package/src/patterns/UiSidebar/UiSidebarMenuSub.vue +4 -5
- package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +4 -5
- package/src/patterns/UiSidebar/UiSidebarPopoverMenu.vue +4 -5
- package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.vue +4 -5
- package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +4 -5
- package/src/patterns/UiSidebar/UiSidebarProvider.vue +0 -3
- package/src/patterns/UiSidebar/UiSidebarRail.vue +0 -3
- package/src/patterns/UiSidebar/UiSidebarSub.vue +4 -5
- package/src/patterns/UiSidebar/__tests__/UiSidebar.test.ts +21 -17
- package/src/patterns/UiSidebar/__tests__/UiSidebarMenuButton.test.ts +12 -10
- package/src/patterns/UiSidebar/types.ts +8 -8
- package/src/theme/Typography.stories.ts +3 -2
package/config.d.ts
CHANGED
|
@@ -202,7 +202,7 @@ export declare const presetUiLibraryTheme: (
|
|
|
202
202
|
* - Token-based theme colors (bg-background-surface-secondary, text-content-on-surface-primary, etc.)
|
|
203
203
|
* - Token-based border radius utilities (rounded-xs, rounded-md, rounded-full, etc.)
|
|
204
204
|
* - Semantic color overrides (background, foreground, modal, link, etc.)
|
|
205
|
-
* - Typography classes from design tokens (heading-
|
|
205
|
+
* - Typography classes from design tokens (heading-s, body-14-normal, label-12-medium, etc.)
|
|
206
206
|
* - Custom rules for Tailwind v4 CSS variable syntax (w-(--var), h-(--var), etc.)
|
|
207
207
|
*
|
|
208
208
|
* @example
|
|
@@ -247,7 +247,7 @@ export type UiLibraryTypographyShortcut = [string, string];
|
|
|
247
247
|
* Get typography shortcuts for UnoCSS rules.
|
|
248
248
|
* Returns an array of [className, cssProperties] tuples that can be used with UnoCSS rules.
|
|
249
249
|
*
|
|
250
|
-
* Scale headings use one utility per
|
|
250
|
+
* Scale headings use one utility per token group: `heading-s`, `heading-m`, … `heading-2xl`.
|
|
251
251
|
* Other groups (labels, body, …) follow `group-variant` from token names.
|
|
252
252
|
*
|
|
253
253
|
* @example
|
|
@@ -267,6 +267,12 @@ export type UiLibraryTypographyShortcut = [string, string];
|
|
|
267
267
|
*/
|
|
268
268
|
export declare const getUiLibraryTypographyShortcuts: () => UiLibraryTypographyShortcut[];
|
|
269
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Spark token preset with typography utilities removed when ui-library owns the
|
|
272
|
+
* same class names.
|
|
273
|
+
*/
|
|
274
|
+
export declare const getSparkTokenPresetWithoutUiLibraryTypography: () => Preset;
|
|
275
|
+
|
|
270
276
|
/**
|
|
271
277
|
* Options for `defineUiLibraryConfig`.
|
|
272
278
|
* Combines theme customization with additional UnoCSS config.
|
package/config.js
CHANGED
|
@@ -181,8 +181,7 @@ const normalizeShadcnVarValue = (input) => {
|
|
|
181
181
|
|
|
182
182
|
// Token resolution — one selected `2-theme/*` set participates in `{...}` lookups;
|
|
183
183
|
// other theme sets are alternate brands/modes and must not override the selected
|
|
184
|
-
// library theme.
|
|
185
|
-
// these refs (see `getHeadingScaleTypographyShortcuts`).
|
|
184
|
+
// library theme.
|
|
186
185
|
const UI_LIBRARY_REFERENCE_THEME_SETS = Object.freeze({
|
|
187
186
|
default: '2-theme/AA Base',
|
|
188
187
|
accessible: '2-theme/WCAG 2.2',
|
|
@@ -534,6 +533,8 @@ export const getUiLibraryThemeFromTokens = (options = {}) => ({
|
|
|
534
533
|
* These map directly to the token structure, e.g.:
|
|
535
534
|
* - background.surface.secondary -> --background-surface-secondary
|
|
536
535
|
* - content.on-surface.primary -> --content-on-surface-primary
|
|
536
|
+
* @param {object} [options] Token resolution options.
|
|
537
|
+
* @returns {{ light: Record<string, string>, dark: Record<string, string> }} Token CSS variables by mode.
|
|
537
538
|
*/
|
|
538
539
|
export const getUiLibraryTokenVars = (options = {}) => {
|
|
539
540
|
const accessibleVars = getAccessibleTokenVarOverrides(options);
|
|
@@ -552,7 +553,6 @@ export const getUiLibraryTokenVars = (options = {}) => {
|
|
|
552
553
|
/**
|
|
553
554
|
* Get UnoCSS theme colors config for all token-based colors.
|
|
554
555
|
* This allows using classes like bg-background-surface-secondary, text-content-on-surface-primary, etc.
|
|
555
|
-
*
|
|
556
556
|
* @example
|
|
557
557
|
* ```ts
|
|
558
558
|
* // uno.config.ts
|
|
@@ -566,6 +566,7 @@ export const getUiLibraryTokenVars = (options = {}) => {
|
|
|
566
566
|
* },
|
|
567
567
|
* });
|
|
568
568
|
* ```
|
|
569
|
+
* @returns {Record<string, string>} UnoCSS color entries keyed by token path.
|
|
569
570
|
*/
|
|
570
571
|
export const getUiLibraryTokenColors = () => {
|
|
571
572
|
const lightVars = buildAllTokenVarsFromModeSet('3-mode/Light');
|
|
@@ -596,6 +597,7 @@ const borderRadiusKeyFromTokenName = (tokenName) => {
|
|
|
596
597
|
/**
|
|
597
598
|
* Get UnoCSS border-radius config from corner-radius design tokens.
|
|
598
599
|
* This powers classes like rounded-xs, rounded-md, rounded-4xl, and rounded-full.
|
|
600
|
+
* @returns {Record<string, string>} UnoCSS border-radius entries keyed by radius name.
|
|
599
601
|
*/
|
|
600
602
|
export const getUiLibraryTokenBorderRadius = () => {
|
|
601
603
|
const cornerRadius = getCornerRadiusTokenGroup();
|
|
@@ -971,6 +973,7 @@ const vHoverOverlayCSS = `
|
|
|
971
973
|
* UnoCSS preset with utility rules required by the UI library's components.
|
|
972
974
|
* Adds Tailwind v4 CSS variable syntax (w-(--var), h-(--var), etc.)
|
|
973
975
|
* that preset-wind4 does not yet support.
|
|
976
|
+
* @returns {import('unocss').Preset} UnoCSS utility preset for ui-library components.
|
|
974
977
|
*/
|
|
975
978
|
export const presetUiLibraryUtils = () =>
|
|
976
979
|
definePreset(() => ({
|
|
@@ -1003,7 +1006,6 @@ export const presetUiLibraryUtils = () =>
|
|
|
1003
1006
|
* Creates a complete UnoCSS config with all required presets, content scanning,
|
|
1004
1007
|
* font loading, and theme from design tokens. Drop-in replacement for manually
|
|
1005
1008
|
* composing presetWind, presetAnimations, presetShadcn, and the ui-library presets.
|
|
1006
|
-
*
|
|
1007
1009
|
* @example
|
|
1008
1010
|
* ```ts
|
|
1009
1011
|
* // uno.config.ts — minimal
|
|
@@ -1018,6 +1020,8 @@ export const presetUiLibraryUtils = () =>
|
|
|
1018
1020
|
* rootFontSize: '100%',
|
|
1019
1021
|
* })
|
|
1020
1022
|
* ```
|
|
1023
|
+
* @param {object} [options] Ui-library config options.
|
|
1024
|
+
* @returns {import('unocss').UserConfig} Complete UnoCSS config.
|
|
1021
1025
|
*/
|
|
1022
1026
|
export const defineUiLibraryConfig = (options = {}) => {
|
|
1023
1027
|
const {
|
|
@@ -1062,13 +1066,11 @@ export const defineUiLibraryConfig = (options = {}) => {
|
|
|
1062
1066
|
color: 'neutral',
|
|
1063
1067
|
darkSelector: darkSelector ?? 'html.dark',
|
|
1064
1068
|
}),
|
|
1069
|
+
// Spark Colors / Spacings / Box-shadow tokens. Typography utilities are
|
|
1070
|
+
// filtered out where ui-library owns the same class names.
|
|
1071
|
+
getSparkTokenPresetWithoutUiLibraryTypography(),
|
|
1065
1072
|
presetUiLibraryThemeFromTokens(themeOptions),
|
|
1066
1073
|
presetUiLibraryUtils(),
|
|
1067
|
-
// Spark Colors / Spacings / Box-shadow tokens. Disjoint namespace from
|
|
1068
|
-
// AA-Base; pulled in for components designed against the Spark layer of
|
|
1069
|
-
// the Figma file (currently UiSnackbar). Consumers of
|
|
1070
|
-
// defineUiLibraryConfig get this transparently.
|
|
1071
|
-
sparkTokenPreset,
|
|
1072
1074
|
...extraPresets,
|
|
1073
1075
|
],
|
|
1074
1076
|
rules: [...extraRules],
|
|
@@ -1077,7 +1079,8 @@ export const defineUiLibraryConfig = (options = {}) => {
|
|
|
1077
1079
|
});
|
|
1078
1080
|
};
|
|
1079
1081
|
|
|
1080
|
-
// Typography utilities —
|
|
1082
|
+
// Typography utilities — font families resolve from `2-theme/AA Base`.
|
|
1083
|
+
// Token variants whose name includes `mono` are omitted (no `label-*-mono-*` utilities).
|
|
1081
1084
|
const fontWeightMap = {
|
|
1082
1085
|
Regular: '400',
|
|
1083
1086
|
Medium: '500',
|
|
@@ -1115,7 +1118,11 @@ const remToPx = (raw) => {
|
|
|
1115
1118
|
return formatPx(n * ROOT_FONT_SIZE_PX);
|
|
1116
1119
|
};
|
|
1117
1120
|
|
|
1118
|
-
/**
|
|
1121
|
+
/**
|
|
1122
|
+
* Token Studio may export dimensions as strings; font-size output is always px.
|
|
1123
|
+
* @param {string | number | null | undefined} value Raw token font-size value.
|
|
1124
|
+
* @returns {string | number | null | undefined} CSS-ready font-size value.
|
|
1125
|
+
*/
|
|
1119
1126
|
const normalizeFontSizeForCss = (value) => {
|
|
1120
1127
|
if (value == null) return value;
|
|
1121
1128
|
if (typeof value === 'number' && Number.isFinite(value))
|
|
@@ -1134,6 +1141,8 @@ const normalizeFontSizeForCss = (value) => {
|
|
|
1134
1141
|
/**
|
|
1135
1142
|
* Line heights: pixel-like values → rem; small integers (0–3) stay unitless multipliers;
|
|
1136
1143
|
* decimals in (0, 3] stay unitless ratios (e.g. "1.5").
|
|
1144
|
+
* @param {string | number | null | undefined} value Raw token line-height value.
|
|
1145
|
+
* @returns {string | number | null | undefined} CSS-ready line-height value.
|
|
1137
1146
|
*/
|
|
1138
1147
|
const normalizeLineHeightForCss = (value) => {
|
|
1139
1148
|
if (value == null) return value;
|
|
@@ -1162,10 +1171,34 @@ const normalizeLineHeightForCss = (value) => {
|
|
|
1162
1171
|
return value;
|
|
1163
1172
|
};
|
|
1164
1173
|
|
|
1165
|
-
const
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
|
|
1174
|
+
const getAaBaseFontFamilyName = (fontFamilyRef) => {
|
|
1175
|
+
const refPath =
|
|
1176
|
+
typeof fontFamilyRef === 'string'
|
|
1177
|
+
? fontFamilyRef.match(/^\{(.+)\}$/)?.[1]?.trim()
|
|
1178
|
+
: null;
|
|
1179
|
+
const tokenKey = refPath?.startsWith('font.font-family.')
|
|
1180
|
+
? refPath.slice('font.font-family.'.length)
|
|
1181
|
+
: 'font-body';
|
|
1182
|
+
const candidateKeys =
|
|
1183
|
+
{
|
|
1184
|
+
body: ['body', 'font-body'],
|
|
1185
|
+
heading: ['heading', 'font-heading'],
|
|
1186
|
+
mono: ['mono', 'font-mono'],
|
|
1187
|
+
'font-body': ['font-body', 'body'],
|
|
1188
|
+
'font-heading': ['font-heading', 'heading'],
|
|
1189
|
+
'font-mono': ['font-mono', 'mono'],
|
|
1190
|
+
}[tokenKey] ?? [tokenKey];
|
|
1191
|
+
|
|
1192
|
+
for (const candidateKey of candidateKeys) {
|
|
1193
|
+
const name = resolveTokenValue(
|
|
1194
|
+
UI_LIBRARY_REFERENCE_THEME_SETS.default,
|
|
1195
|
+
`font.font-family.${candidateKey}`,
|
|
1196
|
+
);
|
|
1197
|
+
const trimmed = name != null ? String(name).trim() : '';
|
|
1198
|
+
if (trimmed) return trimmed;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
return 'Saans';
|
|
1169
1202
|
};
|
|
1170
1203
|
|
|
1171
1204
|
const isTypographyTokenGroup = (group) =>
|
|
@@ -1178,6 +1211,8 @@ const isTypographyTokenGroup = (group) =>
|
|
|
1178
1211
|
|
|
1179
1212
|
/**
|
|
1180
1213
|
* Scale keys named `Heading …` map to `heading-{scale}` (no weight suffix): `heading-s`, `heading-m`, … `heading-2xl`.
|
|
1214
|
+
* @param {string} tokenKey Typography token group name.
|
|
1215
|
+
* @returns {string} Utility class group prefix.
|
|
1181
1216
|
*/
|
|
1182
1217
|
const groupKebabForTypographyKey = (tokenKey) => {
|
|
1183
1218
|
const trimmed = tokenKey.trim();
|
|
@@ -1193,29 +1228,11 @@ const groupKebabForTypographyKey = (tokenKey) => {
|
|
|
1193
1228
|
return trimmed.replace(/\s+/g, '-').toLowerCase();
|
|
1194
1229
|
};
|
|
1195
1230
|
|
|
1196
|
-
/** One class per scale; `2-theme/AA Base` supplies `font.font-size.Heading …` (Solea excluded from `{…}` search). */
|
|
1197
|
-
const HEADING_SCALE_KEYS = [
|
|
1198
|
-
'Heading S',
|
|
1199
|
-
'Heading M',
|
|
1200
|
-
'Heading L',
|
|
1201
|
-
'Heading XL',
|
|
1202
|
-
'Heading 2XL',
|
|
1203
|
-
];
|
|
1204
|
-
|
|
1205
|
-
const HEADING_SCALE_LINE_HEIGHT_REF = {
|
|
1206
|
-
'Heading S': '{font.line-height.28}',
|
|
1207
|
-
'Heading M': '{font.line-height.32}',
|
|
1208
|
-
'Heading L': '{font.line-height.40}',
|
|
1209
|
-
'Heading XL': '{font.line-height.44}',
|
|
1210
|
-
'Heading 2XL': '{font.line-height.108}',
|
|
1211
|
-
};
|
|
1212
|
-
|
|
1213
|
-
/** Canonical heading weight for scale utilities (semibold). */
|
|
1214
|
-
const HEADING_SCALE_FONT_WEIGHT_REF = '{fontWeights.saans-4}';
|
|
1215
|
-
|
|
1216
1231
|
/**
|
|
1217
1232
|
* Resolves composite typography; `{…}` refs use the token search order (AA Base wins over Solea/global).
|
|
1218
|
-
* `fontFamily` output is
|
|
1233
|
+
* `fontFamily` output is resolved from `2-theme/AA Base`.
|
|
1234
|
+
* @param {object} typographyValue Composite typography token value.
|
|
1235
|
+
* @returns {{ fontFamily?: string, fontSize?: string | number, fontWeight?: string | number, lineHeight?: string | number }} Resolved CSS typography properties.
|
|
1219
1236
|
*/
|
|
1220
1237
|
const resolveTypographyToken = (typographyValue) => {
|
|
1221
1238
|
const resolved = {};
|
|
@@ -1235,12 +1252,12 @@ const resolveTypographyToken = (typographyValue) => {
|
|
|
1235
1252
|
resolved.lineHeight = normalizeLineHeightForCss(lineHeight);
|
|
1236
1253
|
}
|
|
1237
1254
|
|
|
1238
|
-
resolved.fontFamily =
|
|
1255
|
+
resolved.fontFamily = getAaBaseFontFamilyName(typographyValue.fontFamily);
|
|
1239
1256
|
|
|
1240
1257
|
return resolved;
|
|
1241
1258
|
};
|
|
1242
1259
|
|
|
1243
|
-
const
|
|
1260
|
+
const setResolvedTypographyShortcut = (shortcuts, className, resolved) => {
|
|
1244
1261
|
const cssProps = [];
|
|
1245
1262
|
if (resolved.fontFamily) cssProps.push(`font-family:${resolved.fontFamily}`);
|
|
1246
1263
|
if (resolved.fontSize) cssProps.push(`font-size:${resolved.fontSize}`);
|
|
@@ -1248,51 +1265,29 @@ const pushResolvedTypographyShortcut = (shortcuts, className, resolved) => {
|
|
|
1248
1265
|
if (resolved.lineHeight) cssProps.push(`line-height:${resolved.lineHeight}`);
|
|
1249
1266
|
if (cssProps.length === 0) return;
|
|
1250
1267
|
const css = cssProps.join(';');
|
|
1251
|
-
shortcuts.
|
|
1252
|
-
};
|
|
1253
|
-
|
|
1254
|
-
/**
|
|
1255
|
-
* Heading utilities: one class per scale (S–2XL), from `font.font-size.Heading …` + line-height + semibold.
|
|
1256
|
-
* Does not use `global` Heading typography variants (semibold/bold/…).
|
|
1257
|
-
*/
|
|
1258
|
-
const getHeadingScaleTypographyShortcuts = () => {
|
|
1259
|
-
const shortcuts = [];
|
|
1260
|
-
for (const scaleKey of HEADING_SCALE_KEYS) {
|
|
1261
|
-
const lineRef = HEADING_SCALE_LINE_HEIGHT_REF[scaleKey];
|
|
1262
|
-
if (!lineRef) continue;
|
|
1263
|
-
|
|
1264
|
-
const typographyValue = {
|
|
1265
|
-
fontSize: `{font.font-size.${scaleKey}}`,
|
|
1266
|
-
lineHeight: lineRef,
|
|
1267
|
-
fontWeight: HEADING_SCALE_FONT_WEIGHT_REF,
|
|
1268
|
-
};
|
|
1269
|
-
const resolved = resolveTypographyToken(typographyValue);
|
|
1270
|
-
const className = groupKebabForTypographyKey(scaleKey);
|
|
1271
|
-
pushResolvedTypographyShortcut(shortcuts, className, resolved);
|
|
1272
|
-
}
|
|
1273
|
-
return shortcuts;
|
|
1268
|
+
shortcuts.set(className, css);
|
|
1274
1269
|
};
|
|
1275
1270
|
|
|
1276
1271
|
/**
|
|
1277
1272
|
* Get typography shortcuts for UnoCSS.
|
|
1278
|
-
* Scans `global` for groups whose children are typography tokens (e.g. `Label 12`, `Body 14`).
|
|
1279
|
-
* Headings
|
|
1280
|
-
* Font family
|
|
1281
|
-
*
|
|
1273
|
+
* Scans `global` for groups whose children are typography tokens (e.g. `Label 12`, `Body 14`, `Heading S`).
|
|
1274
|
+
* Headings use one no-suffix utility per token group (`heading-s` … `heading-2xl`).
|
|
1275
|
+
* Font family resolves from `2-theme/AA Base`.
|
|
1282
1276
|
* @example
|
|
1283
1277
|
* - 'label-12-medium', 'heading-s', 'heading-m', 'heading-2xl'
|
|
1278
|
+
* @returns {Array<[string, string]>} Typography shortcut tuples for UnoCSS rules.
|
|
1284
1279
|
*/
|
|
1285
1280
|
export const getUiLibraryTypographyShortcuts = () => {
|
|
1286
1281
|
const global = getTokens()?.global;
|
|
1287
1282
|
if (!global) return [];
|
|
1288
1283
|
|
|
1289
|
-
const shortcuts =
|
|
1284
|
+
const shortcuts = new Map();
|
|
1290
1285
|
|
|
1291
1286
|
for (const [tokenKey, tokenGroup] of Object.entries(global)) {
|
|
1292
|
-
if (/^Heading\s+/i.test(tokenKey.trim())) continue;
|
|
1293
1287
|
if (!isTypographyTokenGroup(tokenGroup)) continue;
|
|
1294
1288
|
|
|
1295
1289
|
const groupKebab = groupKebabForTypographyKey(tokenKey);
|
|
1290
|
+
const isHeadingGroup = /^Heading\s+/i.test(tokenKey.trim());
|
|
1296
1291
|
|
|
1297
1292
|
for (const [variant, tokenData] of Object.entries(tokenGroup)) {
|
|
1298
1293
|
if (!tokenData?.value || tokenData.type !== 'typography') continue;
|
|
@@ -1301,12 +1296,14 @@ export const getUiLibraryTypographyShortcuts = () => {
|
|
|
1301
1296
|
if (variantKebab.includes('mono')) continue;
|
|
1302
1297
|
|
|
1303
1298
|
const resolved = resolveTypographyToken(tokenData.value);
|
|
1304
|
-
const className =
|
|
1299
|
+
const className = isHeadingGroup
|
|
1300
|
+
? groupKebab
|
|
1301
|
+
: `${groupKebab}-${variantKebab}`;
|
|
1305
1302
|
|
|
1306
|
-
|
|
1303
|
+
setResolvedTypographyShortcut(shortcuts, className, resolved);
|
|
1307
1304
|
// Token name is `regular`; many components use `*-normal` — keep both class names.
|
|
1308
|
-
if (variantKebab === 'regular') {
|
|
1309
|
-
|
|
1305
|
+
if (!isHeadingGroup && variantKebab === 'regular') {
|
|
1306
|
+
setResolvedTypographyShortcut(
|
|
1310
1307
|
shortcuts,
|
|
1311
1308
|
`${groupKebab}-normal`,
|
|
1312
1309
|
resolved,
|
|
@@ -1315,7 +1312,22 @@ export const getUiLibraryTypographyShortcuts = () => {
|
|
|
1315
1312
|
}
|
|
1316
1313
|
}
|
|
1317
1314
|
|
|
1318
|
-
|
|
1315
|
+
return Array.from(shortcuts);
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
export const getSparkTokenPresetWithoutUiLibraryTypography = () => {
|
|
1319
|
+
const uiLibraryTypographyClassNames = new Set(
|
|
1320
|
+
getUiLibraryTypographyShortcuts().map(([className]) => className),
|
|
1321
|
+
);
|
|
1319
1322
|
|
|
1320
|
-
return
|
|
1323
|
+
return {
|
|
1324
|
+
...sparkTokenPreset,
|
|
1325
|
+
rules: (sparkTokenPreset.rules ?? []).filter((rule) => {
|
|
1326
|
+
const matcher = rule?.[0];
|
|
1327
|
+
return (
|
|
1328
|
+
typeof matcher !== 'string' ||
|
|
1329
|
+
!uiLibraryTypographyClassNames.has(matcher)
|
|
1330
|
+
);
|
|
1331
|
+
}),
|
|
1332
|
+
};
|
|
1321
1333
|
};
|
|
@@ -9,7 +9,6 @@ export type UiAutocompleteOption = {
|
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Filterable select input for choosing one or many options.
|
|
12
|
-
*
|
|
13
12
|
* @category Form Inputs
|
|
14
13
|
* @useCases autocomplete, searchable select, multi select, command picker
|
|
15
14
|
* @keywords autocomplete, combobox, select, search, filter, multi-select
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UiDialogDescriptionProps } from './types';
|
|
1
2
|
declare function __VLS_template(): {
|
|
2
3
|
attrs: Partial<{}>;
|
|
3
4
|
slots: {
|
|
@@ -7,7 +8,7 @@ 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<UiDialogDescriptionProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UiDialogDescriptionProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
12
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
12
13
|
export default _default;
|
|
13
14
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UiDialogFooterProps } from './types';
|
|
2
1
|
declare function __VLS_template(): {
|
|
3
2
|
attrs: Partial<{}>;
|
|
4
3
|
slots: {
|
|
@@ -8,7 +7,7 @@ declare function __VLS_template(): {
|
|
|
8
7
|
rootEl: HTMLDivElement;
|
|
9
8
|
};
|
|
10
9
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
-
declare const __VLS_component: import('vue').DefineComponent<
|
|
10
|
+
declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
12
11
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
13
12
|
export default _default;
|
|
14
13
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UiDialogHeaderProps } from './types';
|
|
2
1
|
declare function __VLS_template(): {
|
|
3
2
|
attrs: Partial<{}>;
|
|
4
3
|
slots: {
|
|
@@ -8,7 +7,7 @@ declare function __VLS_template(): {
|
|
|
8
7
|
rootEl: HTMLDivElement;
|
|
9
8
|
};
|
|
10
9
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
-
declare const __VLS_component: import('vue').DefineComponent<
|
|
10
|
+
declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
12
11
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
13
12
|
export default _default;
|
|
14
13
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UiDialogTitleProps } from './types';
|
|
1
2
|
declare function __VLS_template(): {
|
|
2
3
|
attrs: Partial<{}>;
|
|
3
4
|
slots: {
|
|
@@ -7,7 +8,7 @@ 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<UiDialogTitleProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UiDialogTitleProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
12
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
12
13
|
export default _default;
|
|
13
14
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -84,22 +84,28 @@ export type UiDialogContentEmits = DialogContentEmits;
|
|
|
84
84
|
* @category Overlays
|
|
85
85
|
* @useCases grouping title and description in a custom `#header` slot
|
|
86
86
|
*/
|
|
87
|
-
export type UiDialogHeaderProps =
|
|
87
|
+
export type UiDialogHeaderProps = Record<string, never>;
|
|
88
88
|
/**
|
|
89
89
|
* Props for UiDialogFooter.
|
|
90
90
|
* @category Overlays
|
|
91
91
|
* @useCases action button rows in `#actions` or manual footer composition
|
|
92
92
|
*/
|
|
93
|
-
export type UiDialogFooterProps =
|
|
93
|
+
export type UiDialogFooterProps = Record<string, never>;
|
|
94
94
|
/**
|
|
95
95
|
* Props for UiDialogTitle.
|
|
96
96
|
* @category Overlays
|
|
97
97
|
* @useCases accessible dialog titles in custom headers
|
|
98
98
|
*/
|
|
99
|
-
export type UiDialogTitleProps =
|
|
99
|
+
export type UiDialogTitleProps = {
|
|
100
|
+
/** Render as a child element instead of wrapping. */
|
|
101
|
+
asChild?: UiDialogSubComponentCommonProps['asChild'];
|
|
102
|
+
};
|
|
100
103
|
/**
|
|
101
104
|
* Props for UiDialogDescription.
|
|
102
105
|
* @category Overlays
|
|
103
106
|
* @useCases supplementary copy under the title
|
|
104
107
|
*/
|
|
105
|
-
export type UiDialogDescriptionProps =
|
|
108
|
+
export type UiDialogDescriptionProps = {
|
|
109
|
+
/** Render as a child element instead of wrapping. */
|
|
110
|
+
asChild?: UiDialogSubComponentCommonProps['asChild'];
|
|
111
|
+
};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { UiFieldErrorProps } from './types';
|
|
2
|
-
declare function __VLS_template():
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
};
|
|
7
|
+
refs: {};
|
|
8
|
+
rootEl: any;
|
|
9
|
+
};
|
|
3
10
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
4
11
|
declare const __VLS_component: import('vue').DefineComponent<UiFieldErrorProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UiFieldErrorProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
5
12
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
@@ -3,7 +3,16 @@ type __VLS_Props = UiInputProps;
|
|
|
3
3
|
type __VLS_PublicProps = {
|
|
4
4
|
modelValue?: string;
|
|
5
5
|
} & __VLS_Props;
|
|
6
|
-
declare
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
slots: {
|
|
9
|
+
end?(_: {}): any;
|
|
10
|
+
};
|
|
11
|
+
refs: {};
|
|
12
|
+
rootEl: any;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
15
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
16
|
"update:modelValue": (value: string) => any;
|
|
8
17
|
"update:files": (files: File[]) => any;
|
|
9
18
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
@@ -18,4 +27,10 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
18
27
|
accept: string;
|
|
19
28
|
uploadButtonLabel: string;
|
|
20
29
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
21
31
|
export default _default;
|
|
32
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
33
|
+
new (): {
|
|
34
|
+
$slots: S;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -8,8 +8,7 @@ import { TagsInputRootProps } from 'reka-ui';
|
|
|
8
8
|
* @related UiInput, UiBadge
|
|
9
9
|
* @augments TagsInputRootProps
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
12
|
-
}
|
|
11
|
+
export type UiTagsInputProps = Omit<TagsInputRootProps, 'class' | 'modelValue'>;
|
|
13
12
|
/**
|
|
14
13
|
* Props for the UiTagsInputInput component.
|
|
15
14
|
* The text input field for entering new tags.
|
|
@@ -8,11 +8,11 @@ declare function __VLS_template(): {
|
|
|
8
8
|
slots: Readonly<{
|
|
9
9
|
default: (props: {
|
|
10
10
|
headingValue: string;
|
|
11
|
-
}) =>
|
|
11
|
+
}) => unknown;
|
|
12
12
|
}> & {
|
|
13
13
|
default: (props: {
|
|
14
14
|
headingValue: string;
|
|
15
|
-
}) =>
|
|
15
|
+
}) => unknown;
|
|
16
16
|
};
|
|
17
17
|
refs: {};
|
|
18
18
|
rootEl: any;
|
|
@@ -8,11 +8,11 @@ declare function __VLS_template(): {
|
|
|
8
8
|
slots: Readonly<{
|
|
9
9
|
default: (props: {
|
|
10
10
|
headingValue: string;
|
|
11
|
-
}) =>
|
|
11
|
+
}) => unknown;
|
|
12
12
|
}> & {
|
|
13
13
|
default: (props: {
|
|
14
14
|
headingValue: string;
|
|
15
|
-
}) =>
|
|
15
|
+
}) => unknown;
|
|
16
16
|
};
|
|
17
17
|
refs: {};
|
|
18
18
|
rootEl: any;
|
package/dist/system/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
1
2
|
import { PrimitiveProps as RekaPrimitiveProps } from 'reka-ui';
|
|
2
3
|
export * from './components';
|
|
3
4
|
export * from './patterns';
|
|
@@ -6,6 +7,6 @@ export * from './directives';
|
|
|
6
7
|
export { Primitive } from 'reka-ui';
|
|
7
8
|
export type PrimitiveProps = RekaPrimitiveProps;
|
|
8
9
|
declare const _default: {
|
|
9
|
-
install(app:
|
|
10
|
+
install(app: App): void;
|
|
10
11
|
};
|
|
11
12
|
export default _default;
|