@aleph-alpha/ui-library 4.0.0 → 5.1.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.js +145 -25
- package/dist/system/lib.js +2 -2
- package/package.json +3 -3
- package/src/components/UiSwitch/UiSwitch.stories.ts +4 -4
- package/src/components/core/switch/Switch.vue +2 -2
- package/src/patterns/UiSidebar/UiSidebar.stories.ts +4 -1
- package/src/theme/Shadow.stories.ts +20 -41
- package/tokens.json +147 -13
package/config.js
CHANGED
|
@@ -649,6 +649,123 @@ const getBorderRadiusExactUtilityRules = () => {
|
|
|
649
649
|
return entriesToRules(entries);
|
|
650
650
|
};
|
|
651
651
|
|
|
652
|
+
// Brand-tinted drop shadows resolved from the selected `2-theme/*` shadow group.
|
|
653
|
+
// Only the `sm`/`md`/`lg`/`xl` levels are layered, brand-tinted elevation scales
|
|
654
|
+
// (numbered children `1`, `2`, … combined into one CSS `box-shadow` value); the
|
|
655
|
+
// other token levels are left to preset-wind defaults. Color references (e.g.
|
|
656
|
+
// `{aa.colors.alpha.rose.20}`) resolve against the active theme search order.
|
|
657
|
+
const SHADOW_TOKEN_LEVELS = Object.freeze(['sm', 'md', 'lg', 'xl']);
|
|
658
|
+
|
|
659
|
+
// Each layer property is exposed as its own `--shadow-{level}-{n}-{prop}`
|
|
660
|
+
// variable so consumers can override a single sub-value; the resolved token is
|
|
661
|
+
// used as the inline fallback when the variable is undefined.
|
|
662
|
+
const SHADOW_LAYER_PROPS = Object.freeze([
|
|
663
|
+
'offset-x',
|
|
664
|
+
'offset-y',
|
|
665
|
+
'blur-radius',
|
|
666
|
+
'spread-radius',
|
|
667
|
+
]);
|
|
668
|
+
|
|
669
|
+
const resolveShadowDimension = (leaf, options) => {
|
|
670
|
+
if (!leaf || typeof leaf !== 'object' || !('value' in leaf)) return '0';
|
|
671
|
+
const resolved = resolveReferences(leaf.value, new Set(), options);
|
|
672
|
+
return typeof resolved === 'string' && resolved.trim()
|
|
673
|
+
? resolved.trim()
|
|
674
|
+
: '0';
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
// Shadow colors are emitted as `rgba(...)` so they read as plain colors in the
|
|
678
|
+
// composed `box-shadow` (hex8 would otherwise be normalized to oklch components).
|
|
679
|
+
const formatShadowColor = (raw) => {
|
|
680
|
+
const rgba = parseHexColorToRgba(raw);
|
|
681
|
+
if (!rgba) return raw;
|
|
682
|
+
const alpha = roundTo(rgba.a, 2);
|
|
683
|
+
return `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${alpha})`;
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
const resolveShadowLayer = (level, layerKey, layer, options) => {
|
|
687
|
+
if (!layer || typeof layer !== 'object') return null;
|
|
688
|
+
|
|
689
|
+
const prefix = `--shadow-${level}-${layerKey}`;
|
|
690
|
+
const parts = SHADOW_LAYER_PROPS.map((prop) => {
|
|
691
|
+
const value = resolveShadowDimension(layer[prop], options);
|
|
692
|
+
return `var(${prefix}-${prop}, ${value})`;
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
const colorLeaf = layer.color;
|
|
696
|
+
const rawColor =
|
|
697
|
+
colorLeaf && typeof colorLeaf === 'object' && 'value' in colorLeaf
|
|
698
|
+
? resolveReferences(colorLeaf.value, new Set(), options)
|
|
699
|
+
: null;
|
|
700
|
+
const color = formatShadowColor(
|
|
701
|
+
typeof rawColor === 'string' && rawColor.trim()
|
|
702
|
+
? rawColor.trim()
|
|
703
|
+
: 'rgba(0, 0, 0, 0)',
|
|
704
|
+
);
|
|
705
|
+
parts.push(`var(${prefix}-color, ${color})`);
|
|
706
|
+
|
|
707
|
+
return parts.join(' ');
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
const resolveShadowGroup = (level, group, options) => {
|
|
711
|
+
const layerKeys = Object.keys(group)
|
|
712
|
+
.filter((key) => /^\d+$/.test(key))
|
|
713
|
+
.sort((a, b) => Number(a) - Number(b));
|
|
714
|
+
const layers = layerKeys
|
|
715
|
+
.map((key) => resolveShadowLayer(level, key, group[key], options))
|
|
716
|
+
.filter(Boolean);
|
|
717
|
+
return layers.length ? layers.join(', ') : null;
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Resolve the design-token drop shadows into CSS `box-shadow` values.
|
|
722
|
+
* Reads the `shadow` group from the selected `2-theme/*` set (AA Base by
|
|
723
|
+
* default, WCAG 2.2 in accessible mode) and powers the `shadow-sm` …
|
|
724
|
+
* `shadow-xl` utilities. Each layer sub-property is referenced through a
|
|
725
|
+
* `--shadow-{level}-{n}-{prop}` variable with the token value as fallback.
|
|
726
|
+
* @param {object} [options] Token resolution options.
|
|
727
|
+
* @returns {Record<string, string>} Box-shadow values keyed by level (e.g. `sm`).
|
|
728
|
+
*/
|
|
729
|
+
export const getUiLibraryShadows = (options = {}) => {
|
|
730
|
+
const referenceThemeSet = getUiLibraryThemeMode(options);
|
|
731
|
+
const shadowGroup = getTokens()?.[referenceThemeSet]?.shadow;
|
|
732
|
+
if (!shadowGroup || typeof shadowGroup !== 'object') return {};
|
|
733
|
+
|
|
734
|
+
const shadows = {};
|
|
735
|
+
for (const level of SHADOW_TOKEN_LEVELS) {
|
|
736
|
+
const group = shadowGroup[level];
|
|
737
|
+
if (!group || typeof group !== 'object') continue;
|
|
738
|
+
const value = resolveShadowGroup(level, group, options);
|
|
739
|
+
if (value) shadows[level] = value;
|
|
740
|
+
}
|
|
741
|
+
return shadows;
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
// Token-backed shadows are emitted as `--shadow-*` custom properties — the same
|
|
745
|
+
// public contract the design-system token preset uses (e.g. `--shadow-dropdowns`).
|
|
746
|
+
// Exposing them lets portalled DOM (outside the Uno-scanned tree) and external
|
|
747
|
+
// consumers reference shadows directly instead of hardcoding values, and lets
|
|
748
|
+
// the accessible theme override them via CSS cascade.
|
|
749
|
+
const getUiLibraryShadowVars = (options = {}) =>
|
|
750
|
+
Object.fromEntries(
|
|
751
|
+
Object.entries(getUiLibraryShadows(options)).map(([level, value]) => [
|
|
752
|
+
`shadow-${level}`,
|
|
753
|
+
value,
|
|
754
|
+
]),
|
|
755
|
+
);
|
|
756
|
+
|
|
757
|
+
// UnoCSS `theme.shadow` entries that point each `shadow-*` utility at its
|
|
758
|
+
// `--shadow-*` variable. Routing through the variable (instead of a literal)
|
|
759
|
+
// keeps preset-wind's ring/inset shadow composition intact AND lets theme
|
|
760
|
+
// switching (e.g. accessible variant) cascade without parallel rules.
|
|
761
|
+
const getUiLibraryShadowTheme = (options = {}) =>
|
|
762
|
+
Object.fromEntries(
|
|
763
|
+
Object.keys(getUiLibraryShadows(options)).map((level) => [
|
|
764
|
+
level,
|
|
765
|
+
`var(--shadow-${level})`,
|
|
766
|
+
]),
|
|
767
|
+
);
|
|
768
|
+
|
|
652
769
|
export const defineThemeConfig = (config) => config;
|
|
653
770
|
|
|
654
771
|
export const presetUiLibraryTheme = (theme, options = {}) => {
|
|
@@ -691,6 +808,21 @@ export const presetUiLibraryTheme = (theme, options = {}) => {
|
|
|
691
808
|
}))();
|
|
692
809
|
};
|
|
693
810
|
|
|
811
|
+
const toAccessibleDarkSelector = (selector) =>
|
|
812
|
+
selector
|
|
813
|
+
.split(',')
|
|
814
|
+
.map((part) => {
|
|
815
|
+
const trimmed = part.trim();
|
|
816
|
+
if (trimmed === 'html.accessible-theme') {
|
|
817
|
+
return 'html.dark.accessible-theme';
|
|
818
|
+
}
|
|
819
|
+
if (trimmed === '.accessible-theme') {
|
|
820
|
+
return 'html.dark .accessible-theme';
|
|
821
|
+
}
|
|
822
|
+
return `${trimmed}.dark`;
|
|
823
|
+
})
|
|
824
|
+
.join(', ');
|
|
825
|
+
|
|
694
826
|
export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
695
827
|
const {
|
|
696
828
|
theme,
|
|
@@ -711,9 +843,10 @@ export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
|
711
843
|
const tokenBorderRadiusVars = getUiLibraryTokenBorderRadiusVars();
|
|
712
844
|
const buildTheme = (modeOptions = {}) => {
|
|
713
845
|
const baseTheme = getUiLibraryThemeFromTokens(modeOptions);
|
|
846
|
+
const shadowVars = getUiLibraryShadowVars(modeOptions);
|
|
714
847
|
let resolvedTheme = {
|
|
715
|
-
light: { ...baseTheme.light, ...tokenBorderRadiusVars },
|
|
716
|
-
dark: { ...baseTheme.dark, ...tokenBorderRadiusVars },
|
|
848
|
+
light: { ...baseTheme.light, ...tokenBorderRadiusVars, ...shadowVars },
|
|
849
|
+
dark: { ...baseTheme.dark, ...tokenBorderRadiusVars, ...shadowVars },
|
|
717
850
|
};
|
|
718
851
|
|
|
719
852
|
if (includeAllTokens) {
|
|
@@ -740,7 +873,7 @@ export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
|
740
873
|
? presetUiLibraryTheme(buildTheme({ themeMode: 'accessible' }), {
|
|
741
874
|
...presetOptions,
|
|
742
875
|
rootSelector: accessibleSelector,
|
|
743
|
-
darkSelector:
|
|
876
|
+
darkSelector: toAccessibleDarkSelector(accessibleSelector),
|
|
744
877
|
})
|
|
745
878
|
: null;
|
|
746
879
|
|
|
@@ -796,6 +929,9 @@ export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
|
796
929
|
...tokenColors,
|
|
797
930
|
...semanticColors,
|
|
798
931
|
},
|
|
932
|
+
// Token-backed drop shadows (shadow-sm … shadow-xl) routed through
|
|
933
|
+
// --shadow-* so preset-wind's ring composition and theme switching work.
|
|
934
|
+
shadow: getUiLibraryShadowTheme(modeOptions),
|
|
799
935
|
},
|
|
800
936
|
rules: [
|
|
801
937
|
...getBorderRadiusExactUtilityRules(),
|
|
@@ -1093,17 +1229,6 @@ const fontWeightMap = {
|
|
|
1093
1229
|
/** Design-tool sizes are px; rem token values resolve against a 16px base. */
|
|
1094
1230
|
const ROOT_FONT_SIZE_PX = 16;
|
|
1095
1231
|
|
|
1096
|
-
const formatPx = (value) => {
|
|
1097
|
-
const rounded = Math.round(value * 10000) / 10000;
|
|
1098
|
-
return `${rounded}px`;
|
|
1099
|
-
};
|
|
1100
|
-
|
|
1101
|
-
const numericDesignPxToPx = (raw) => {
|
|
1102
|
-
const n = typeof raw === 'number' ? raw : parseFloat(String(raw).trim());
|
|
1103
|
-
if (!Number.isFinite(n)) return null;
|
|
1104
|
-
return formatPx(n);
|
|
1105
|
-
};
|
|
1106
|
-
|
|
1107
1232
|
const numericDesignPxToRem = (raw) => {
|
|
1108
1233
|
const n = typeof raw === 'number' ? raw : parseFloat(String(raw).trim());
|
|
1109
1234
|
if (!Number.isFinite(n)) return null;
|
|
@@ -1112,28 +1237,23 @@ const numericDesignPxToRem = (raw) => {
|
|
|
1112
1237
|
return `${rounded}rem`;
|
|
1113
1238
|
};
|
|
1114
1239
|
|
|
1115
|
-
const remToPx = (raw) => {
|
|
1116
|
-
const n = parseFloat(String(raw).trim());
|
|
1117
|
-
if (!Number.isFinite(n)) return null;
|
|
1118
|
-
return formatPx(n * ROOT_FONT_SIZE_PX);
|
|
1119
|
-
};
|
|
1120
|
-
|
|
1121
1240
|
/**
|
|
1122
|
-
* Token Studio may export dimensions as strings; font-size output is
|
|
1241
|
+
* Token Studio may export dimensions as strings; font-size output is rem so text
|
|
1242
|
+
* responds to the root font size (`rootFontSize` in ui-library config).
|
|
1123
1243
|
* @param {string | number | null | undefined} value Raw token font-size value.
|
|
1124
1244
|
* @returns {string | number | null | undefined} CSS-ready font-size value.
|
|
1125
1245
|
*/
|
|
1126
1246
|
const normalizeFontSizeForCss = (value) => {
|
|
1127
1247
|
if (value == null) return value;
|
|
1128
1248
|
if (typeof value === 'number' && Number.isFinite(value))
|
|
1129
|
-
return
|
|
1249
|
+
return numericDesignPxToRem(value) ?? value;
|
|
1130
1250
|
if (typeof value === 'string') {
|
|
1131
1251
|
const t = value.trim();
|
|
1132
1252
|
if (/^(calc|var|--)/i.test(t)) return t;
|
|
1133
|
-
if (/^-?\d+(\.\d+)?rem$/i.test(t)) return
|
|
1134
|
-
if (/^-?\d+(\.\d+)?px$/i.test(t)) return t;
|
|
1253
|
+
if (/^-?\d+(\.\d+)?rem$/i.test(t)) return t;
|
|
1254
|
+
if (/^-?\d+(\.\d+)?px$/i.test(t)) return numericDesignPxToRem(t) ?? t;
|
|
1135
1255
|
if (/[a-z%]/i.test(t)) return t;
|
|
1136
|
-
if (/^\d+(\.\d+)?$/.test(t)) return
|
|
1256
|
+
if (/^\d+(\.\d+)?$/.test(t)) return numericDesignPxToRem(t) ?? t;
|
|
1137
1257
|
}
|
|
1138
1258
|
return value;
|
|
1139
1259
|
};
|
package/dist/system/lib.js
CHANGED
|
@@ -54436,7 +54436,7 @@ const PT = /* @__PURE__ */ _({
|
|
|
54436
54436
|
const a = e, o = t, n = he(a, "class"), r = me(n, o);
|
|
54437
54437
|
return (s, d) => (h(), b(l(XZ), q({ "data-slot": "switch" }, l(r), {
|
|
54438
54438
|
class: l(D)(
|
|
54439
|
-
"peer data-[state=checked]:bg-background-accent-default data-[state=unchecked]:bg-
|
|
54439
|
+
"peer data-[state=checked]:bg-background-accent-default data-[state=unchecked]:bg-background-surface-muted-strong focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 p-0.5 h-5 w-9",
|
|
54440
54440
|
a.class
|
|
54441
54441
|
)
|
|
54442
54442
|
}), {
|
|
@@ -54445,7 +54445,7 @@ const PT = /* @__PURE__ */ _({
|
|
|
54445
54445
|
"data-slot": "switch-thumb",
|
|
54446
54446
|
class: F(
|
|
54447
54447
|
l(D)(
|
|
54448
|
-
"data-[state=checked]:bg-background-accent-soft data-[state=unchecked]:bg-background dark:data-[state=unchecked]:bg-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
|
|
54448
|
+
"data-[state=checked]:bg-background-accent-soft data-[state=unchecked]:bg-background-surface-secondary dark:data-[state=unchecked]:bg-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
|
|
54449
54449
|
)
|
|
54450
54450
|
)
|
|
54451
54451
|
}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/ui-library",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/system/lib.js",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"vue-tsc": "^2.2.12",
|
|
83
83
|
"wait-on": "9.0.3",
|
|
84
84
|
"@aleph-alpha/eslint-config-frontend": "0.7.0",
|
|
85
|
-
"@aleph-alpha/
|
|
86
|
-
"@aleph-alpha/
|
|
85
|
+
"@aleph-alpha/prettier-config-frontend": "2.1.0",
|
|
86
|
+
"@aleph-alpha/tsconfig-frontend": "0.7.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"@unocss/preset-wind4": ">=66.0.0",
|
|
@@ -39,7 +39,7 @@ const enabled = ref(false)
|
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
41
|
<template>
|
|
42
|
-
<div class="flex items-center gap-x-
|
|
42
|
+
<div class="flex items-center gap-x-3">
|
|
43
43
|
<UiSwitch id="airplane-mode" v-model="enabled" name="airplane-mode" />
|
|
44
44
|
<label for="airplane-mode" class="text-sm font-medium">Airplane Mode</label>
|
|
45
45
|
</div>
|
|
@@ -62,7 +62,7 @@ export const Default: Story = {
|
|
|
62
62
|
return { args, enabled };
|
|
63
63
|
},
|
|
64
64
|
template: `
|
|
65
|
-
<div class="flex items-center gap-x-
|
|
65
|
+
<div class="flex items-center gap-x-3">
|
|
66
66
|
<UiSwitch id="airplane-mode" v-model="enabled" name="airplane-mode" :disabled="args.disabled" />
|
|
67
67
|
<label for="airplane-mode" class="text-sm font-medium">Airplane Mode</label>
|
|
68
68
|
</div>
|
|
@@ -82,7 +82,7 @@ import { UiSwitch } from '@aleph-alpha/ui-library'
|
|
|
82
82
|
</script>
|
|
83
83
|
|
|
84
84
|
<template>
|
|
85
|
-
<div class="flex items-center gap-x-
|
|
85
|
+
<div class="flex items-center gap-x-3">
|
|
86
86
|
<UiSwitch id="airplane-mode" name="airplane-mode" disabled />
|
|
87
87
|
<label for="airplane-mode" class="text-sm font-medium text-muted-foreground">Airplane Mode</label>
|
|
88
88
|
</div>
|
|
@@ -108,7 +108,7 @@ export const Disabled: Story = {
|
|
|
108
108
|
return { args, enabled };
|
|
109
109
|
},
|
|
110
110
|
template: `
|
|
111
|
-
<div class="flex items-center gap-x-
|
|
111
|
+
<div class="flex items-center gap-x-3">
|
|
112
112
|
<UiSwitch id="airplane-mode" v-model="enabled" name="airplane-mode" :disabled="args.disabled" />
|
|
113
113
|
<label for="airplane-mode" class="text-sm font-medium text-muted-foreground">Airplane Mode</label>
|
|
114
114
|
</div>
|
|
@@ -23,7 +23,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
23
23
|
v-bind="forwarded"
|
|
24
24
|
:class="
|
|
25
25
|
cn(
|
|
26
|
-
'peer data-[state=checked]:bg-background-accent-default data-[state=unchecked]:bg-
|
|
26
|
+
'peer data-[state=checked]:bg-background-accent-default data-[state=unchecked]:bg-background-surface-muted-strong focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 p-0.5 h-5 w-9',
|
|
27
27
|
props.class,
|
|
28
28
|
)
|
|
29
29
|
"
|
|
@@ -32,7 +32,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
32
32
|
data-slot="switch-thumb"
|
|
33
33
|
:class="
|
|
34
34
|
cn(
|
|
35
|
-
'data-[state=checked]:bg-background-accent-soft data-[state=unchecked]:bg-background dark:data-[state=unchecked]:bg-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0',
|
|
35
|
+
'data-[state=checked]:bg-background-accent-soft data-[state=unchecked]:bg-background-surface-secondary dark:data-[state=unchecked]:bg-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0',
|
|
36
36
|
)
|
|
37
37
|
"
|
|
38
38
|
>
|
|
@@ -205,6 +205,7 @@ const renderStory = (args: Story['args']) => ({
|
|
|
205
205
|
<UiSidebarMenuItem v-for="item in primaryItems" :key="item.title">
|
|
206
206
|
<UiSidebarMenuButton
|
|
207
207
|
:tooltip="item.title"
|
|
208
|
+
:aria-label="item.title"
|
|
208
209
|
:is-active="isMenuActive(item.title)"
|
|
209
210
|
@click="selectMenu(item)"
|
|
210
211
|
>
|
|
@@ -230,6 +231,7 @@ const renderStory = (args: Story['args']) => ({
|
|
|
230
231
|
<UiSidebarMenuItem v-for="item in agentItems" :key="item.title">
|
|
231
232
|
<UiSidebarMenuButton
|
|
232
233
|
:tooltip="item.title"
|
|
234
|
+
:aria-label="item.title"
|
|
233
235
|
:is-active="isMenuActive(item.title)"
|
|
234
236
|
@click="selectMenu(item)"
|
|
235
237
|
>
|
|
@@ -257,6 +259,7 @@ const renderStory = (args: Story['args']) => ({
|
|
|
257
259
|
<UiSidebarMenuItem v-for="item in appItems" :key="item.title">
|
|
258
260
|
<UiSidebarMenuButton
|
|
259
261
|
:tooltip="item.title"
|
|
262
|
+
:aria-label="item.title"
|
|
260
263
|
:is-active="isMenuActive(item.title)"
|
|
261
264
|
@click="selectMenu(item)"
|
|
262
265
|
>
|
|
@@ -274,7 +277,7 @@ const renderStory = (args: Story['args']) => ({
|
|
|
274
277
|
<UiSidebarFooter>
|
|
275
278
|
<Popover>
|
|
276
279
|
<PopoverTrigger as-child>
|
|
277
|
-
<UiSidebarMenuButton tooltip="Profile menu">
|
|
280
|
+
<UiSidebarMenuButton tooltip="Profile menu" aria-label="Profile menu">
|
|
278
281
|
<template #start-icon>
|
|
279
282
|
<div
|
|
280
283
|
class="flex size-8 items-center justify-center overflow-hidden rounded-md bg-background-surface-muted body-14-regular text-content-on-surface-primary"
|
|
@@ -9,7 +9,7 @@ const ThemePlaceholder = defineComponent({
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const meta: Meta<typeof ThemePlaceholder> = {
|
|
12
|
-
title: 'CSS utility/
|
|
12
|
+
title: 'CSS utility/Box shadow',
|
|
13
13
|
component: ThemePlaceholder,
|
|
14
14
|
tags: ['autodocs'],
|
|
15
15
|
parameters: {
|
|
@@ -31,11 +31,23 @@ const copyScript = `
|
|
|
31
31
|
}
|
|
32
32
|
`;
|
|
33
33
|
|
|
34
|
+
const SHADOW_LEVELS = ['sm', 'md', 'lg', 'xl'] as const;
|
|
35
|
+
|
|
36
|
+
const shadowSwatch = (level: string) => `
|
|
37
|
+
<div class="flex flex-col items-center gap-2">
|
|
38
|
+
<div class="w-28 h-28 rounded-lg bg-background-surface-secondary border border-border-surface-default shadow-${level}"></div>
|
|
39
|
+
<div class="text-center max-w-[8rem]">
|
|
40
|
+
<span class="label-12-medium text-content-on-surface-primary block">${level}</span>
|
|
41
|
+
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded break-all" onclick="copyToClipboard('shadow-${level}', this)">shadow-${level}</code>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
`;
|
|
45
|
+
|
|
34
46
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
47
|
+
* Box-shadow variants (`shadow-sm` … `shadow-xl`). Each variant is emitted as a
|
|
48
|
+
* `--shadow-*` CSS variable and powers the matching UnoCSS utility.
|
|
37
49
|
*/
|
|
38
|
-
export const
|
|
50
|
+
export const BoxShadow: Story = {
|
|
39
51
|
render: () => ({
|
|
40
52
|
template: `
|
|
41
53
|
<div class="p-8 bg-background-surface-secondary">
|
|
@@ -48,48 +60,15 @@ export const DropShadow: Story = {
|
|
|
48
60
|
<script>${copyScript}</script>
|
|
49
61
|
|
|
50
62
|
<div class="mb-6">
|
|
51
|
-
<h2 class="heading-s text-content-on-surface-primary mb-1">
|
|
63
|
+
<h2 class="heading-s text-content-on-surface-primary mb-1">Box shadow</h2>
|
|
52
64
|
<p class="body-14-regular text-content-on-surface-muted">
|
|
53
|
-
|
|
65
|
+
Shadow variants <code class="label-12-medium">sm</code>–<code class="label-12-medium">xl</code>, emitted as
|
|
66
|
+
<code class="label-12-medium">--shadow-*</code> CSS variables. Click a utility class to copy.
|
|
54
67
|
</p>
|
|
55
68
|
</div>
|
|
56
69
|
|
|
57
70
|
<div class="flex flex-wrap gap-8 items-end">
|
|
58
|
-
|
|
59
|
-
<div class="w-28 h-28 rounded-lg bg-background-surface-primary border border-border-surface-default shadow-sm"></div>
|
|
60
|
-
<div class="text-center max-w-[8rem]">
|
|
61
|
-
<span class="label-12-medium text-content-on-surface-primary block">sm</span>
|
|
62
|
-
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded break-all" onclick="copyToClipboard('shadow-sm', this)">shadow-sm</code>
|
|
63
|
-
<span class="label-12-regular text-content-on-surface-muted block mt-1">shadow-sm</span>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<div class="flex flex-col items-center gap-2">
|
|
68
|
-
<div class="w-28 h-28 rounded-lg bg-background-surface-primary border border-border-surface-default shadow-md"></div>
|
|
69
|
-
<div class="text-center max-w-[8rem]">
|
|
70
|
-
<span class="label-12-medium text-content-on-surface-primary block">md</span>
|
|
71
|
-
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded break-all" onclick="copyToClipboard('shadow-md', this)">shadow-md</code>
|
|
72
|
-
<span class="label-12-regular text-content-on-surface-muted block mt-1">shadow-md</span>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
<div class="flex flex-col items-center gap-2">
|
|
77
|
-
<div class="w-28 h-28 rounded-lg bg-background-surface-primary border border-border-surface-default shadow-lg"></div>
|
|
78
|
-
<div class="text-center max-w-[8rem]">
|
|
79
|
-
<span class="label-12-medium text-content-on-surface-primary block">lg</span>
|
|
80
|
-
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded break-all" onclick="copyToClipboard('shadow-lg', this)">shadow-lg</code>
|
|
81
|
-
<span class="label-12-regular text-content-on-surface-muted block mt-1">shadow-lg</span>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<div class="flex flex-col items-center gap-2">
|
|
86
|
-
<div class="w-28 h-28 rounded-lg bg-background-surface-primary border border-border-surface-default shadow-xl"></div>
|
|
87
|
-
<div class="text-center max-w-[8rem]">
|
|
88
|
-
<span class="label-12-medium text-content-on-surface-primary block">xl</span>
|
|
89
|
-
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded break-all" onclick="copyToClipboard('shadow-xl', this)">shadow-xl</code>
|
|
90
|
-
<span class="label-12-regular text-content-on-surface-muted block mt-1">shadow-xl</span>
|
|
91
|
-
</div>
|
|
92
|
-
</div>
|
|
71
|
+
${SHADOW_LEVELS.map(shadowSwatch).join('')}
|
|
93
72
|
</div>
|
|
94
73
|
</div>
|
|
95
74
|
`,
|
package/tokens.json
CHANGED
|
@@ -2912,6 +2912,28 @@
|
|
|
2912
2912
|
"com.figma.hiddenFromPublishing": true
|
|
2913
2913
|
}
|
|
2914
2914
|
}
|
|
2915
|
+
},
|
|
2916
|
+
"base": {
|
|
2917
|
+
"white": {
|
|
2918
|
+
"value": "#ffffff",
|
|
2919
|
+
"type": "color",
|
|
2920
|
+
"$extensions": {
|
|
2921
|
+
"com.figma.scopes": [
|
|
2922
|
+
"ALL_SCOPES"
|
|
2923
|
+
],
|
|
2924
|
+
"com.figma.hiddenFromPublishing": true
|
|
2925
|
+
}
|
|
2926
|
+
},
|
|
2927
|
+
"black": {
|
|
2928
|
+
"value": "#000000",
|
|
2929
|
+
"type": "color",
|
|
2930
|
+
"$extensions": {
|
|
2931
|
+
"com.figma.scopes": [
|
|
2932
|
+
"ALL_SCOPES"
|
|
2933
|
+
],
|
|
2934
|
+
"com.figma.hiddenFromPublishing": true
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2915
2937
|
}
|
|
2916
2938
|
},
|
|
2917
2939
|
"spacing": {
|
|
@@ -9255,6 +9277,30 @@
|
|
|
9255
9277
|
"description": "Used in UI elements that have background color variable in light mode and input/30 variable in dark mode"
|
|
9256
9278
|
}
|
|
9257
9279
|
}
|
|
9280
|
+
},
|
|
9281
|
+
"base": {
|
|
9282
|
+
"white": {
|
|
9283
|
+
"value": "{colors.base.white-pure}",
|
|
9284
|
+
"type": "color",
|
|
9285
|
+
"$extensions": {
|
|
9286
|
+
"com.figma.scopes": [
|
|
9287
|
+
"ALL_SCOPES"
|
|
9288
|
+
],
|
|
9289
|
+
"com.figma.hiddenFromPublishing": false
|
|
9290
|
+
},
|
|
9291
|
+
"description": "Main application background"
|
|
9292
|
+
},
|
|
9293
|
+
"black": {
|
|
9294
|
+
"value": "{colors.base.black-pure}",
|
|
9295
|
+
"type": "color",
|
|
9296
|
+
"$extensions": {
|
|
9297
|
+
"com.figma.scopes": [
|
|
9298
|
+
"ALL_SCOPES"
|
|
9299
|
+
],
|
|
9300
|
+
"com.figma.hiddenFromPublishing": false
|
|
9301
|
+
},
|
|
9302
|
+
"description": "Main application background"
|
|
9303
|
+
}
|
|
9258
9304
|
}
|
|
9259
9305
|
},
|
|
9260
9306
|
"3-mode/Dark": {
|
|
@@ -10008,6 +10054,30 @@
|
|
|
10008
10054
|
"description": "Used in UI elements that have background color variable in light mode and input/30 variable in dark mode"
|
|
10009
10055
|
}
|
|
10010
10056
|
}
|
|
10057
|
+
},
|
|
10058
|
+
"base": {
|
|
10059
|
+
"white": {
|
|
10060
|
+
"value": "{colors.base.black-pure}",
|
|
10061
|
+
"type": "color",
|
|
10062
|
+
"$extensions": {
|
|
10063
|
+
"com.figma.scopes": [
|
|
10064
|
+
"ALL_SCOPES"
|
|
10065
|
+
],
|
|
10066
|
+
"com.figma.hiddenFromPublishing": false
|
|
10067
|
+
},
|
|
10068
|
+
"description": "Main application background"
|
|
10069
|
+
},
|
|
10070
|
+
"black": {
|
|
10071
|
+
"value": "{colors.base.white-pure}",
|
|
10072
|
+
"type": "color",
|
|
10073
|
+
"$extensions": {
|
|
10074
|
+
"com.figma.scopes": [
|
|
10075
|
+
"ALL_SCOPES"
|
|
10076
|
+
],
|
|
10077
|
+
"com.figma.hiddenFromPublishing": false
|
|
10078
|
+
},
|
|
10079
|
+
"description": "Main application background"
|
|
10080
|
+
}
|
|
10011
10081
|
}
|
|
10012
10082
|
},
|
|
10013
10083
|
"2-theme/AA Base": {
|
|
@@ -10217,7 +10287,7 @@
|
|
|
10217
10287
|
}
|
|
10218
10288
|
},
|
|
10219
10289
|
"inverse-light": {
|
|
10220
|
-
"value": "{aa.colors.rose.
|
|
10290
|
+
"value": "{aa.colors.rose.800}",
|
|
10221
10291
|
"type": "color",
|
|
10222
10292
|
"$extensions": {
|
|
10223
10293
|
"com.figma.scopes": [
|
|
@@ -11359,6 +11429,30 @@
|
|
|
11359
11429
|
}
|
|
11360
11430
|
}
|
|
11361
11431
|
}
|
|
11432
|
+
},
|
|
11433
|
+
"base": {
|
|
11434
|
+
"white-pure": {
|
|
11435
|
+
"value": "{aa.colors.base.white}",
|
|
11436
|
+
"type": "color",
|
|
11437
|
+
"$extensions": {
|
|
11438
|
+
"com.figma.scopes": [
|
|
11439
|
+
"FRAME_FILL",
|
|
11440
|
+
"SHAPE_FILL"
|
|
11441
|
+
],
|
|
11442
|
+
"com.figma.hiddenFromPublishing": true
|
|
11443
|
+
}
|
|
11444
|
+
},
|
|
11445
|
+
"black-pure": {
|
|
11446
|
+
"value": "{aa.colors.base.black}",
|
|
11447
|
+
"type": "color",
|
|
11448
|
+
"$extensions": {
|
|
11449
|
+
"com.figma.scopes": [
|
|
11450
|
+
"FRAME_FILL",
|
|
11451
|
+
"SHAPE_FILL"
|
|
11452
|
+
],
|
|
11453
|
+
"com.figma.hiddenFromPublishing": true
|
|
11454
|
+
}
|
|
11455
|
+
}
|
|
11362
11456
|
}
|
|
11363
11457
|
},
|
|
11364
11458
|
"shadow": {
|
|
@@ -11469,7 +11563,7 @@
|
|
|
11469
11563
|
"sm": {
|
|
11470
11564
|
"1": {
|
|
11471
11565
|
"color": {
|
|
11472
|
-
"value": "
|
|
11566
|
+
"value": "{aa.colors.alpha.rose.20}",
|
|
11473
11567
|
"type": "color",
|
|
11474
11568
|
"$extensions": {
|
|
11475
11569
|
"com.figma.scopes": [
|
|
@@ -11521,7 +11615,7 @@
|
|
|
11521
11615
|
},
|
|
11522
11616
|
"2": {
|
|
11523
11617
|
"color": {
|
|
11524
|
-
"value": "#
|
|
11618
|
+
"value": "#f85e2b0a",
|
|
11525
11619
|
"type": "color",
|
|
11526
11620
|
"$extensions": {
|
|
11527
11621
|
"com.figma.scopes": [
|
|
@@ -11575,7 +11669,7 @@
|
|
|
11575
11669
|
"md": {
|
|
11576
11670
|
"1": {
|
|
11577
11671
|
"color": {
|
|
11578
|
-
"value": "
|
|
11672
|
+
"value": "{aa.colors.alpha.rose.20}",
|
|
11579
11673
|
"type": "color",
|
|
11580
11674
|
"$extensions": {
|
|
11581
11675
|
"com.figma.scopes": [
|
|
@@ -11627,7 +11721,7 @@
|
|
|
11627
11721
|
},
|
|
11628
11722
|
"2": {
|
|
11629
11723
|
"color": {
|
|
11630
|
-
"value": "#
|
|
11724
|
+
"value": "#f85e2b0a",
|
|
11631
11725
|
"type": "color",
|
|
11632
11726
|
"$extensions": {
|
|
11633
11727
|
"com.figma.scopes": [
|
|
@@ -11681,7 +11775,7 @@
|
|
|
11681
11775
|
"lg": {
|
|
11682
11776
|
"1": {
|
|
11683
11777
|
"color": {
|
|
11684
|
-
"value": "
|
|
11778
|
+
"value": "{aa.colors.alpha.rose.10}",
|
|
11685
11779
|
"type": "color",
|
|
11686
11780
|
"$extensions": {
|
|
11687
11781
|
"com.figma.scopes": [
|
|
@@ -11733,7 +11827,7 @@
|
|
|
11733
11827
|
},
|
|
11734
11828
|
"2": {
|
|
11735
11829
|
"color": {
|
|
11736
|
-
"value": "#
|
|
11830
|
+
"value": "#f85e2b0d",
|
|
11737
11831
|
"type": "color",
|
|
11738
11832
|
"$extensions": {
|
|
11739
11833
|
"com.figma.scopes": [
|
|
@@ -11787,7 +11881,7 @@
|
|
|
11787
11881
|
"xl": {
|
|
11788
11882
|
"1": {
|
|
11789
11883
|
"color": {
|
|
11790
|
-
"value": "
|
|
11884
|
+
"value": "{aa.colors.alpha.rose.10}",
|
|
11791
11885
|
"type": "color",
|
|
11792
11886
|
"$extensions": {
|
|
11793
11887
|
"com.figma.scopes": [
|
|
@@ -11839,7 +11933,7 @@
|
|
|
11839
11933
|
},
|
|
11840
11934
|
"2": {
|
|
11841
11935
|
"color": {
|
|
11842
|
-
"value": "#
|
|
11936
|
+
"value": "#f85e2b0d",
|
|
11843
11937
|
"type": "color",
|
|
11844
11938
|
"$extensions": {
|
|
11845
11939
|
"com.figma.scopes": [
|
|
@@ -11859,7 +11953,7 @@
|
|
|
11859
11953
|
}
|
|
11860
11954
|
},
|
|
11861
11955
|
"offset-y": {
|
|
11862
|
-
"value": "
|
|
11956
|
+
"value": "1.25rem",
|
|
11863
11957
|
"type": "dimension",
|
|
11864
11958
|
"$extensions": {
|
|
11865
11959
|
"com.figma.scopes": [
|
|
@@ -11869,7 +11963,7 @@
|
|
|
11869
11963
|
}
|
|
11870
11964
|
},
|
|
11871
11965
|
"blur-radius": {
|
|
11872
|
-
"value": "
|
|
11966
|
+
"value": "2rem",
|
|
11873
11967
|
"type": "dimension",
|
|
11874
11968
|
"$extensions": {
|
|
11875
11969
|
"com.figma.scopes": [
|
|
@@ -16899,7 +16993,7 @@
|
|
|
16899
16993
|
"border": {
|
|
16900
16994
|
"surface": {
|
|
16901
16995
|
"default-light": {
|
|
16902
|
-
"value": "{
|
|
16996
|
+
"value": "{solea.colors.rose.700}",
|
|
16903
16997
|
"type": "color",
|
|
16904
16998
|
"$extensions": {
|
|
16905
16999
|
"com.figma.scopes": [
|
|
@@ -16909,7 +17003,7 @@
|
|
|
16909
17003
|
}
|
|
16910
17004
|
},
|
|
16911
17005
|
"default-dark": {
|
|
16912
|
-
"value": "{aa.colors.
|
|
17006
|
+
"value": "{aa.colors.basalt.200}",
|
|
16913
17007
|
"type": "color",
|
|
16914
17008
|
"$extensions": {
|
|
16915
17009
|
"com.figma.scopes": [
|
|
@@ -17281,6 +17375,30 @@
|
|
|
17281
17375
|
}
|
|
17282
17376
|
}
|
|
17283
17377
|
}
|
|
17378
|
+
},
|
|
17379
|
+
"base": {
|
|
17380
|
+
"white-pure": {
|
|
17381
|
+
"value": "{aa.colors.base.white}",
|
|
17382
|
+
"type": "color",
|
|
17383
|
+
"$extensions": {
|
|
17384
|
+
"com.figma.scopes": [
|
|
17385
|
+
"FRAME_FILL",
|
|
17386
|
+
"SHAPE_FILL"
|
|
17387
|
+
],
|
|
17388
|
+
"com.figma.hiddenFromPublishing": true
|
|
17389
|
+
}
|
|
17390
|
+
},
|
|
17391
|
+
"black-pure": {
|
|
17392
|
+
"value": "{aa.colors.base.black}",
|
|
17393
|
+
"type": "color",
|
|
17394
|
+
"$extensions": {
|
|
17395
|
+
"com.figma.scopes": [
|
|
17396
|
+
"FRAME_FILL",
|
|
17397
|
+
"SHAPE_FILL"
|
|
17398
|
+
],
|
|
17399
|
+
"com.figma.hiddenFromPublishing": true
|
|
17400
|
+
}
|
|
17401
|
+
}
|
|
17284
17402
|
}
|
|
17285
17403
|
},
|
|
17286
17404
|
"shadow": {
|
|
@@ -18746,6 +18864,22 @@
|
|
|
18746
18864
|
"com.figma.hiddenFromPublishing": true
|
|
18747
18865
|
}
|
|
18748
18866
|
}
|
|
18867
|
+
},
|
|
18868
|
+
"Heading 2XL": {
|
|
18869
|
+
"regular": {
|
|
18870
|
+
"value": {
|
|
18871
|
+
"fontFamily": "{font.font-family.body}",
|
|
18872
|
+
"fontWeight": "{fontWeights.saans-0}",
|
|
18873
|
+
"lineHeight": "{font.line-height.60}",
|
|
18874
|
+
"fontSize": "{fontSize.7}",
|
|
18875
|
+
"letterSpacing": "{letterSpacing.0}",
|
|
18876
|
+
"paragraphSpacing": "{paragraphSpacing.0}",
|
|
18877
|
+
"paragraphIndent": "{paragraphIndent.0}",
|
|
18878
|
+
"textCase": "{textCase.none}",
|
|
18879
|
+
"textDecoration": "{textDecoration.none}"
|
|
18880
|
+
},
|
|
18881
|
+
"type": "typography"
|
|
18882
|
+
}
|
|
18749
18883
|
}
|
|
18750
18884
|
},
|
|
18751
18885
|
"$themes": [],
|