@common-origin/design-system 3.1.0 → 3.2.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/dist/client.js +1017 -713
- package/dist/client.js.map +1 -1
- package/dist/components/atoms/Badge/Badge.d.mts +2 -2
- package/dist/components/atoms/Badge/Badge.d.ts +2 -2
- package/dist/components/atoms/Badge/Badge.mjs +15 -9
- package/dist/components/atoms/Box/Box.d.mts +3 -2
- package/dist/components/atoms/Box/Box.d.ts +3 -2
- package/dist/components/atoms/Button/Button.mjs +1 -1
- package/dist/components/atoms/Chip/shared/ChipBase.mjs +1 -1
- package/dist/components/atoms/IconButton/IconButton.mjs +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.mts +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/atoms/Tag/Tag.d.mts +1 -1
- package/dist/components/atoms/Tag/Tag.d.ts +1 -1
- package/dist/components/atoms/Tooltip/Tooltip.d.mts +7 -1
- package/dist/components/atoms/Tooltip/Tooltip.d.ts +7 -1
- package/dist/components/atoms/Tooltip/Tooltip.mjs +18 -8
- package/dist/components/molecules/ActionSheet/ActionSheet.mjs +2 -2
- package/dist/components/molecules/Alert/Alert.mjs +1 -1
- package/dist/components/molecules/Checkbox/SelectableInputBase.mjs +1 -1
- package/dist/components/molecules/Dropdown/Dropdown.mjs +1 -1
- package/dist/components/molecules/List/ListItem.mjs +3 -3
- package/dist/components/molecules/Menu/Menu.d.mts +8 -1
- package/dist/components/molecules/Menu/Menu.d.ts +8 -1
- package/dist/components/molecules/Menu/Menu.mjs +12 -9
- package/dist/components/molecules/Modal/Modal.mjs +1 -1
- package/dist/components/molecules/NumberInput/NumberInput.mjs +2 -1
- package/dist/components/molecules/PasswordField/PasswordField.mjs +3 -2
- package/dist/components/molecules/SearchField/SearchField.mjs +3 -3
- package/dist/components/molecules/Sheet/Sheet.mjs +3 -3
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.mts +3 -2
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.ts +3 -2
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.mjs +128 -41
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.d.mts +30 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.d.ts +30 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.mjs +69 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.mjs +57 -43
- package/dist/components/molecules/TabBar/TabBar.mjs +3 -3
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.mjs +3 -1
- package/dist/components/organisms/SidebarNav/SidebarNav.mjs +173 -62
- package/dist/data.js +96 -59
- package/dist/data.js.map +1 -1
- package/dist/lib/styleUtils.d.mts +4 -0
- package/dist/lib/styleUtils.d.ts +4 -0
- package/dist/lib/styleUtils.mjs +5 -1
- package/dist/lib/styleUtils.mjs.map +1 -1
- package/dist/lib/tokenAliases.mjs +1 -0
- package/dist/lib/tokenAliases.mjs.map +1 -1
- package/dist/lib/useFloatingLayer.d.mts +8 -1
- package/dist/lib/useFloatingLayer.d.ts +8 -1
- package/dist/lib/useFloatingLayer.mjs +11 -2
- package/dist/lib/useFloatingLayer.mjs.map +1 -1
- package/dist/styles/tokens.d.mts +93 -24
- package/dist/styles/tokens.d.ts +93 -24
- package/dist/styles/tokens.json +96 -59
- package/dist/styles/tokens.json.mjs +96 -59
- package/dist/styles/tokens.json.mjs.map +1 -1
- package/dist/tokens/index.js +96 -59
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/index.mjs +96 -59
- package/dist/tokens/index.mjs.map +1 -1
- package/dist/tokens/styles/tokens.d.mts +93 -24
- package/dist/tokens/styles/tokens.d.ts +93 -24
- package/dist/tokens.css +1105 -74
- package/package.json +3 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useEffect, type RefObject } from 'react';
|
|
2
2
|
import { type FloatingAlign, type FloatingSide } from './floatingPosition';
|
|
3
3
|
export declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
4
|
+
/** The trigger's width in px, set on the floating element when `matchAnchorWidth` is on */
|
|
5
|
+
export declare const ANCHOR_WIDTH_VAR = "--co-floating-anchor-width";
|
|
4
6
|
interface FloatingLayerOptions {
|
|
5
7
|
/** Whether the floating element is rendered */
|
|
6
8
|
isPresent: boolean;
|
|
@@ -10,6 +12,11 @@ interface FloatingLayerOptions {
|
|
|
10
12
|
anchorRef: RefObject<Element | null>;
|
|
11
13
|
side: FloatingSide;
|
|
12
14
|
align: FloatingAlign;
|
|
15
|
+
/**
|
|
16
|
+
* Writes the trigger's width to `ANCHOR_WIDTH_VAR` on the floating element before each placement,
|
|
17
|
+
* so its CSS can be at least as wide as the trigger
|
|
18
|
+
*/
|
|
19
|
+
matchAnchorWidth?: boolean;
|
|
13
20
|
/**
|
|
14
21
|
* Called when the trigger may have moved away from the floating element: the page or a container
|
|
15
22
|
* scrolled (anything but the floating element itself), or the window resized
|
|
@@ -21,5 +28,5 @@ interface FloatingLayerOptions {
|
|
|
21
28
|
* paints, and places it again whenever its size changes. A gap of `space.100` separates it from the
|
|
22
29
|
* trigger, and it keeps `space.200` from the viewport's edges.
|
|
23
30
|
*/
|
|
24
|
-
export declare function useFloatingLayer({ isPresent, floatingRef, anchorRef, side, align, onDetach }: FloatingLayerOptions): void;
|
|
31
|
+
export declare function useFloatingLayer({ isPresent, floatingRef, anchorRef, side, align, matchAnchorWidth, onDetach, }: FloatingLayerOptions): void;
|
|
25
32
|
export {};
|
|
@@ -10,6 +10,8 @@ var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect
|
|
|
10
10
|
var supportsPopover = function supportsPopover() {
|
|
11
11
|
return typeof HTMLElement !== 'undefined' && 'showPopover' in HTMLElement.prototype;
|
|
12
12
|
};
|
|
13
|
+
/** The trigger's width in px, set on the floating element when `matchAnchorWidth` is on */
|
|
14
|
+
var ANCHOR_WIDTH_VAR = '--co-floating-anchor-width';
|
|
13
15
|
var remToPx = function remToPx(value) {
|
|
14
16
|
return parseFloat(value) * (parseFloat(getComputedStyle(document.documentElement).fontSize) || 16);
|
|
15
17
|
};
|
|
@@ -24,6 +26,8 @@ function useFloatingLayer(_a) {
|
|
|
24
26
|
anchorRef = _a.anchorRef,
|
|
25
27
|
side = _a.side,
|
|
26
28
|
align = _a.align,
|
|
29
|
+
_b = _a.matchAnchorWidth,
|
|
30
|
+
matchAnchorWidth = _b === void 0 ? false : _b,
|
|
27
31
|
onDetach = _a.onDetach;
|
|
28
32
|
useIsomorphicLayoutEffect(function () {
|
|
29
33
|
var floating = floatingRef.current;
|
|
@@ -36,6 +40,8 @@ function useFloatingLayer(_a) {
|
|
|
36
40
|
var trigger = laidOutElement(anchorRef.current);
|
|
37
41
|
if (!trigger) return;
|
|
38
42
|
var anchor = trigger.getBoundingClientRect();
|
|
43
|
+
// Before measuring, since it can widen the floating element
|
|
44
|
+
if (matchAnchorWidth) floating.style.setProperty(ANCHOR_WIDTH_VAR, "".concat(anchor.width, "px"));else floating.style.removeProperty(ANCHOR_WIDTH_VAR);
|
|
39
45
|
var _a = floating.getBoundingClientRect(),
|
|
40
46
|
width = _a.width,
|
|
41
47
|
height = _a.height;
|
|
@@ -62,10 +68,13 @@ function useFloatingLayer(_a) {
|
|
|
62
68
|
if (typeof ResizeObserver === 'undefined') return;
|
|
63
69
|
var observer = new ResizeObserver(place);
|
|
64
70
|
observer.observe(floating);
|
|
71
|
+
// Its width follows the trigger's, so a trigger that resizes while it's open places it again
|
|
72
|
+
var trigger = matchAnchorWidth ? laidOutElement(anchorRef.current) : null;
|
|
73
|
+
if (trigger) observer.observe(trigger);
|
|
65
74
|
return function () {
|
|
66
75
|
return observer.disconnect();
|
|
67
76
|
};
|
|
68
|
-
}, [isPresent, side, align, floatingRef, anchorRef]);
|
|
77
|
+
}, [isPresent, side, align, matchAnchorWidth, floatingRef, anchorRef]);
|
|
69
78
|
useEffect(function () {
|
|
70
79
|
if (!isPresent) return;
|
|
71
80
|
var onScroll = function onScroll(event) {
|
|
@@ -82,5 +91,5 @@ function useFloatingLayer(_a) {
|
|
|
82
91
|
}, [isPresent, floatingRef, onDetach]);
|
|
83
92
|
}
|
|
84
93
|
|
|
85
|
-
export { useFloatingLayer, useIsomorphicLayoutEffect };
|
|
94
|
+
export { ANCHOR_WIDTH_VAR, useFloatingLayer, useIsomorphicLayoutEffect };
|
|
86
95
|
//# sourceMappingURL=useFloatingLayer.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFloatingLayer.mjs","sources":["../../src/lib/useFloatingLayer.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, type RefObject } from 'react'\n// Placement needs resolved lengths, not CSS variables (decision 0041)\nimport tokenValues from '../styles/tokens.json'\nimport { laidOutElement, placeFloating, type FloatingAlign, type FloatingSide } from './floatingPosition'\n\nexport const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\n// The Popover API puts a floating element in the top layer: above everything, Modal included,\n// never clipped by a scroll container, with no z-index (#326). It's in every current browser;\n// without it the element is still position: fixed, so it escapes overflow clipping.\nconst supportsPopover = () => typeof HTMLElement !== 'undefined' && 'showPopover' in HTMLElement.prototype\n\nconst remToPx = (value: string) =>\n parseFloat(value) * (parseFloat(getComputedStyle(document.documentElement).fontSize) || 16)\n\ninterface FloatingLayerOptions {\n /** Whether the floating element is rendered */\n isPresent: boolean\n /** The floating element: `position: fixed`, placed with top and left */\n floatingRef: RefObject<HTMLElement | null>\n /** The `display: contents` wrapper around the trigger */\n anchorRef: RefObject<Element | null>\n side: FloatingSide\n align: FloatingAlign\n /**\n * Called when the trigger may have moved away from the floating element: the page or a container\n * scrolled (anything but the floating element itself), or the window resized\n */\n onDetach: () => void\n}\n\n/**\n * Shows a floating element (Tooltip, Menu) in the top layer beside its trigger, before the browser\n * paints, and places it again whenever its size changes. A gap of `space.100` separates it from the\n * trigger, and it keeps `space.200` from the viewport's edges.\n */\nexport function useFloatingLayer({
|
|
1
|
+
{"version":3,"file":"useFloatingLayer.mjs","sources":["../../src/lib/useFloatingLayer.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, type RefObject } from 'react'\n// Placement needs resolved lengths, not CSS variables (decision 0041)\nimport tokenValues from '../styles/tokens.json'\nimport { laidOutElement, placeFloating, type FloatingAlign, type FloatingSide } from './floatingPosition'\n\nexport const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\n// The Popover API puts a floating element in the top layer: above everything, Modal included,\n// never clipped by a scroll container, with no z-index (#326). It's in every current browser;\n// without it the element is still position: fixed, so it escapes overflow clipping.\nconst supportsPopover = () => typeof HTMLElement !== 'undefined' && 'showPopover' in HTMLElement.prototype\n\n/** The trigger's width in px, set on the floating element when `matchAnchorWidth` is on */\nexport const ANCHOR_WIDTH_VAR = '--co-floating-anchor-width'\n\nconst remToPx = (value: string) =>\n parseFloat(value) * (parseFloat(getComputedStyle(document.documentElement).fontSize) || 16)\n\ninterface FloatingLayerOptions {\n /** Whether the floating element is rendered */\n isPresent: boolean\n /** The floating element: `position: fixed`, placed with top and left */\n floatingRef: RefObject<HTMLElement | null>\n /** The `display: contents` wrapper around the trigger */\n anchorRef: RefObject<Element | null>\n side: FloatingSide\n align: FloatingAlign\n /**\n * Writes the trigger's width to `ANCHOR_WIDTH_VAR` on the floating element before each placement,\n * so its CSS can be at least as wide as the trigger\n */\n matchAnchorWidth?: boolean\n /**\n * Called when the trigger may have moved away from the floating element: the page or a container\n * scrolled (anything but the floating element itself), or the window resized\n */\n onDetach: () => void\n}\n\n/**\n * Shows a floating element (Tooltip, Menu) in the top layer beside its trigger, before the browser\n * paints, and places it again whenever its size changes. A gap of `space.100` separates it from the\n * trigger, and it keeps `space.200` from the viewport's edges.\n */\nexport function useFloatingLayer({\n isPresent,\n floatingRef,\n anchorRef,\n side,\n align,\n matchAnchorWidth = false,\n onDetach,\n}: FloatingLayerOptions) {\n useIsomorphicLayoutEffect(() => {\n const floating = floatingRef.current\n if (!isPresent || !floating) return\n if (supportsPopover() && !floating.matches(':popover-open')) {\n floating.setAttribute('popover', 'manual')\n floating.showPopover()\n }\n const place = () => {\n const trigger = laidOutElement(anchorRef.current)\n if (!trigger) return\n const anchor = trigger.getBoundingClientRect()\n // Before measuring, since it can widen the floating element\n if (matchAnchorWidth) floating.style.setProperty(ANCHOR_WIDTH_VAR, `${anchor.width}px`)\n else floating.style.removeProperty(ANCHOR_WIDTH_VAR)\n const { width, height } = floating.getBoundingClientRect()\n const position = placeFloating({\n anchor,\n floating: { width, height },\n side,\n align,\n offset: remToPx(tokenValues.semantic.space[100]),\n viewport: { width: window.innerWidth, height: window.innerHeight },\n margin: remToPx(tokenValues.semantic.space[200]),\n })\n floating.style.top = `${position.top}px`\n floating.style.left = `${position.left}px`\n floating.dataset.side = position.side\n }\n place()\n if (typeof ResizeObserver === 'undefined') return\n const observer = new ResizeObserver(place)\n observer.observe(floating)\n // Its width follows the trigger's, so a trigger that resizes while it's open places it again\n const trigger = matchAnchorWidth ? laidOutElement(anchorRef.current) : null\n if (trigger) observer.observe(trigger)\n return () => observer.disconnect()\n }, [isPresent, side, align, matchAnchorWidth, floatingRef, anchorRef])\n\n useEffect(() => {\n if (!isPresent) return\n const onScroll = (event: Event) => {\n if (event.target instanceof Node && floatingRef.current?.contains(event.target)) return\n onDetach()\n }\n window.addEventListener('scroll', onScroll, true)\n window.addEventListener('resize', onDetach)\n return () => {\n window.removeEventListener('scroll', onScroll, true)\n window.removeEventListener('resize', onDetach)\n }\n }, [isPresent, floatingRef, onDetach])\n}\n"],"names":["useIsomorphicLayoutEffect","window","useLayoutEffect","useEffect","supportsPopover","HTMLElement","prototype","ANCHOR_WIDTH_VAR","remToPx","value","parseFloat","getComputedStyle","document","documentElement","fontSize","useFloatingLayer","_a","isPresent","floatingRef","anchorRef","side","align","_b","matchAnchorWidth","onDetach","floating","current","matches","setAttribute","showPopover","place","trigger","laidOutElement","anchor","getBoundingClientRect","style","setProperty","concat","width","removeProperty","height","position","placeFloating","offset","tokenValues","semantic","space","viewport","innerWidth","innerHeight","margin","top","left","dataset","ResizeObserver","observer","observe","disconnect","onScroll","event","target","Node","contains","addEventListener","removeEventListener"],"mappings":";;;;;AAKO,IAAMA,yBAAyB,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGC,eAAe,GAAGC,UAAS;AAEpG;AACA;AACA;AACA,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,GAAG;EAAM,OAAA,OAAOC,WAAW,KAAK,WAAW,IAAI,aAAa,IAAIA,WAAW,CAACC,SAAS,CAAA;AAA5E,CAA4E,CAAA;AAE1G;AACO,IAAMC,gBAAgB,GAAG,6BAA4B;AAE5D,IAAMC,OAAO,GAAG,SAAVA,OAAOA,CAAIC,KAAa,EAAA;AAC5B,EAAA,OAAAC,UAAU,CAACD,KAAK,CAAC,IAAIC,UAAU,CAACC,gBAAgB,CAACC,QAAQ,CAACC,eAAe,CAAC,CAACC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;AAA3F,CAA2F,CAAA;AAuB7F;;;;AAIG;AACG,SAAUC,gBAAgBA,CAACC,EAQV,EAAA;MAPrBC,SAAS,GAAAD,EAAA,CAAAC,SAAA;IACTC,WAAW,GAAAF,EAAA,CAAAE,WAAA;IACXC,SAAS,GAAAH,EAAA,CAAAG,SAAA;IACTC,IAAI,GAAAJ,EAAA,CAAAI,IAAA;IACJC,KAAK,GAAAL,EAAA,CAAAK,KAAA;IACLC,wBAAwB;IAAxBC,gBAAgB,mBAAG,KAAK,GAAAD,EAAA;IACxBE,QAAQ,GAAAR,EAAA,CAAAQ,QAAA,CAAA;AAERxB,EAAAA,yBAAyB,CAAC,YAAA;AACxB,IAAA,IAAMyB,QAAQ,GAAGP,WAAW,CAACQ,OAAO,CAAA;AACpC,IAAA,IAAI,CAACT,SAAS,IAAI,CAACQ,QA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CAACC,MAAM,YAAYC,IAAI,KAAI,CAAA7C,EAAA,GAAAE,WAAW,CAACQ,OAAO,0CAAEoC,QAAQ,CAACH,KAAK,CAACC,MAAM,CAAC,CAAA,EAAE,OAAA;AACjFpC,MAAAA,QAAQ,EAAE,CAAA;KACX,CAAA;IACDvB,MAAM,CAAC8D,gBAAgB,CAAC,QAAQ,EAAEL,QAAQ,EAAE,IAAI,CAAC,CAAA;AACjDzD,IAAAA,MAAM,CAAC8D,gBAAgB,CAAC,QAAQ,EAAEvC,QAAQ,CAAC,CAAA;AAC3C,IAAA,OAAO,YAAA;MACLvB,MAAM,CAAC+D,mBAAmB,CAAC,QAAQ,EAAEN,QAAQ,EAAE,IAAI,CAAC,CAAA;AACpDzD,MAAAA,MAAM,CAAC+D,mBAAmB,CAAC,QAAQ,EAAExC,QAAQ,CAAC,CAAA;KAC/C,CAAA;GACF,EAAE,CAACP,SAAS,EAAEC,WAAW,EAAEM,QAAQ,CAAC,CAAC,CAAA;AACxC;;;;"}
|
package/dist/styles/tokens.d.mts
CHANGED
|
@@ -43,6 +43,8 @@ export type Tokens = {
|
|
|
43
43
|
'5': string;
|
|
44
44
|
'6': string;
|
|
45
45
|
none: string;
|
|
46
|
+
/** A sunken well or pressed state. A shadow, so the theme scales it with the others (decision 0056). */
|
|
47
|
+
inset: string;
|
|
46
48
|
};
|
|
47
49
|
/** Stacking order: 1–5 are 10–50 for layers within the page, 6–8 are 1000 and up for overlays. */
|
|
48
50
|
zIndex: {
|
|
@@ -75,6 +77,8 @@ export type Tokens = {
|
|
|
75
77
|
'90': string;
|
|
76
78
|
'95': string;
|
|
77
79
|
'100': string;
|
|
80
|
+
/** How strongly the scrim dims the page: a theme parameter, 0.5 in light (decision 0056). */
|
|
81
|
+
scrim: string;
|
|
78
82
|
};
|
|
79
83
|
/** The one dimension scale on the 4px grid; the key is the multiple of 4px (12 is 3rem, 48px). Replaces the parallel base.size and base.spacing scales (#188). */
|
|
80
84
|
dimension: {
|
|
@@ -128,6 +132,22 @@ export type Tokens = {
|
|
|
128
132
|
transparent: string;
|
|
129
133
|
/** Pure white, outside the ramps: raised surfaces (semantic.surface.raised) that sit on the gray.100 page. The ramps' contrast is measured against it (decision 0049). */
|
|
130
134
|
white: string;
|
|
135
|
+
/** Surfaces by elevation, the same rule in every theme: higher is lighter (decision 0056). Raised and overlay are the next neutrals lighter than the page; in light the scale tops out at white, so both are white and shadows separate them. */
|
|
136
|
+
surface: {
|
|
137
|
+
/** The page. */
|
|
138
|
+
page: string;
|
|
139
|
+
/** One level above the page: cards, inputs, code blocks. */
|
|
140
|
+
raised: string;
|
|
141
|
+
/** Two levels above the page: menus, dialogs, sheets. */
|
|
142
|
+
overlay: string;
|
|
143
|
+
};
|
|
144
|
+
/** The light and dark ends of the neutral ramp, by role, in every theme (decision 0056): labels on solid fills use the light ink, and the scrim the dark ink. */
|
|
145
|
+
ink: {
|
|
146
|
+
/** The light end of the neutral ramp. */
|
|
147
|
+
light: string;
|
|
148
|
+
/** The dark end of the neutral ramp. */
|
|
149
|
+
dark: string;
|
|
150
|
+
};
|
|
131
151
|
/** Pure-grey ramp, defined in OKLCH (chroma 0): 100 (lightest) to 1200 (primary text). Each step has one job, and its contrast against white is in its description (decision 0040). */
|
|
132
152
|
gray: {
|
|
133
153
|
/** Page background. oklch(0.991 0 0), 1.03:1 on white. */
|
|
@@ -182,6 +202,33 @@ export type Tokens = {
|
|
|
182
202
|
/** Primary text, and the darkest step. Composites to gray.1200 over white. */
|
|
183
203
|
'1200': string;
|
|
184
204
|
};
|
|
205
|
+
/** Alpha twins of the inverse end of the grey ramp, named by role like text.inverse: gray.100 at gray-alpha's opacity for each step, so a translucent overlay on a dark or coloured fill (issue 354). In the dark theme the inverse end is dark, so this ramp is too (decision 0054). */
|
|
206
|
+
'gray-alpha-inverse': {
|
|
207
|
+
/** Page background. gray.100 at gray-alpha.100's opacity. */
|
|
208
|
+
'100': string;
|
|
209
|
+
/** Subtle background. gray.100 at gray-alpha.200's opacity. */
|
|
210
|
+
'200': string;
|
|
211
|
+
/** Component fill at rest. gray.100 at gray-alpha.300's opacity. */
|
|
212
|
+
'300': string;
|
|
213
|
+
/** Component fill on hover. gray.100 at gray-alpha.400's opacity. */
|
|
214
|
+
'400': string;
|
|
215
|
+
/** Component fill pressed or selected. gray.100 at gray-alpha.500's opacity. */
|
|
216
|
+
'500': string;
|
|
217
|
+
/** Subtle border. gray.100 at gray-alpha.600's opacity. */
|
|
218
|
+
'600': string;
|
|
219
|
+
/** Default border, for dividers and decorative outlines. gray.100 at gray-alpha.700's opacity. */
|
|
220
|
+
'700': string;
|
|
221
|
+
/** Strong border: a control edge, at least 3:1 on 100, 200 and white (decision 0025). gray.100 at gray-alpha.800's opacity. */
|
|
222
|
+
'800': string;
|
|
223
|
+
/** Solid fill. gray.100 at gray-alpha.900's opacity. */
|
|
224
|
+
'900': string;
|
|
225
|
+
/** Solid fill on hover. gray.100 at gray-alpha.1000's opacity. */
|
|
226
|
+
'1000': string;
|
|
227
|
+
/** Secondary text: at least 4.5:1 on 100 to 500 and white. gray.100 at gray-alpha.1100's opacity. */
|
|
228
|
+
'1100': string;
|
|
229
|
+
/** Primary text, and the darkest step. gray.100 at gray-alpha.1200's opacity. */
|
|
230
|
+
'1200': string;
|
|
231
|
+
};
|
|
185
232
|
/** Accent role (decision 0043): links, selected and active states, the accent action, neutral information, in progress. Defined in OKLCH at hue 255°: 100 (lightest) to 1200 (darkest), each step at the gray step's contrast with white, with its contrast in its description (decisions 0040 and 0044). */
|
|
186
233
|
accent: {
|
|
187
234
|
/** Page background. oklch(0.991 0.002 248), 1.03:1 on white. */
|
|
@@ -208,6 +255,8 @@ export type Tokens = {
|
|
|
208
255
|
'1100': string;
|
|
209
256
|
/** Primary text, and the darkest step. oklch(0.252 0.049 252), 15.91:1 on white. */
|
|
210
257
|
'1200': string;
|
|
258
|
+
/** Solid fill that carries a label: where the light ink reads at the contrast secondary text has with the page (decision 0056). In light that is step 1100; the dark theme generates its own. */
|
|
259
|
+
solid: string;
|
|
211
260
|
};
|
|
212
261
|
/** Alpha twins of accent: each is the smallest opacity that composites over white to the solid step (decision 0044). */
|
|
213
262
|
'accent-alpha': {
|
|
@@ -262,6 +311,8 @@ export type Tokens = {
|
|
|
262
311
|
'1100': string;
|
|
263
312
|
/** Primary text, and the darkest step. oklch(0.248 0.034 159), 15.92:1 on white. */
|
|
264
313
|
'1200': string;
|
|
314
|
+
/** Solid fill that carries a label: where the light ink reads at the contrast secondary text has with the page (decision 0056). In light that is step 1100; the dark theme generates its own. */
|
|
315
|
+
solid: string;
|
|
265
316
|
};
|
|
266
317
|
/** Alpha twins of success: each is the smallest opacity that composites over white to the solid step (decision 0044). */
|
|
267
318
|
'success-alpha': {
|
|
@@ -316,6 +367,8 @@ export type Tokens = {
|
|
|
316
367
|
'1100': string;
|
|
317
368
|
/** Primary text, and the darkest step. oklch(0.252 0.030 84), 15.91:1 on white. */
|
|
318
369
|
'1200': string;
|
|
370
|
+
/** Solid fill that carries a label: where the light ink reads at the contrast secondary text has with the page (decision 0056). In light that is step 1100; the dark theme generates its own. */
|
|
371
|
+
solid: string;
|
|
319
372
|
};
|
|
320
373
|
/** Alpha twins of warning: each is the smallest opacity that composites over white to the solid step (decision 0044). */
|
|
321
374
|
'warning-alpha': {
|
|
@@ -370,6 +423,8 @@ export type Tokens = {
|
|
|
370
423
|
'1100': string;
|
|
371
424
|
/** Primary text, and the darkest step. oklch(0.256 0.043 47), 15.91:1 on white. */
|
|
372
425
|
'1200': string;
|
|
426
|
+
/** Solid fill that carries a label: where the light ink reads at the contrast secondary text has with the page (decision 0056). In light that is step 1100; the dark theme generates its own. */
|
|
427
|
+
solid: string;
|
|
373
428
|
};
|
|
374
429
|
/** Alpha twins of serious: each is the smallest opacity that composites over white to the solid step (decision 0044). */
|
|
375
430
|
'serious-alpha': {
|
|
@@ -424,6 +479,8 @@ export type Tokens = {
|
|
|
424
479
|
'1100': string;
|
|
425
480
|
/** Primary text, and the darkest step. oklch(0.259 0.063 29), 15.89:1 on white. */
|
|
426
481
|
'1200': string;
|
|
482
|
+
/** Solid fill that carries a label: where the light ink reads at the contrast secondary text has with the page (decision 0056). In light that is step 1100; the dark theme generates its own. */
|
|
483
|
+
solid: string;
|
|
427
484
|
};
|
|
428
485
|
/** Alpha twins of danger: each is the smallest opacity that composites over white to the solid step (decision 0044). */
|
|
429
486
|
'danger-alpha': {
|
|
@@ -822,7 +879,7 @@ export type Tokens = {
|
|
|
822
879
|
backgroundColor: string;
|
|
823
880
|
/** Text and icon colour on the primary Button. */
|
|
824
881
|
textColor: string;
|
|
825
|
-
/** Corner radius of every Button (visual language: Button uses
|
|
882
|
+
/** Corner radius of every Button (visual language: Button uses md). */
|
|
826
883
|
borderRadius: string;
|
|
827
884
|
/** Button label typography, the same as sizes.large.font. */
|
|
828
885
|
font: string;
|
|
@@ -954,7 +1011,7 @@ export type Tokens = {
|
|
|
954
1011
|
backgroundColor: string;
|
|
955
1012
|
/** Default chip text and icon colour. */
|
|
956
1013
|
textColor: string;
|
|
957
|
-
/** Corner radius of every chip:
|
|
1014
|
+
/** Corner radius of every chip: fully round, so a chip never shares Button's shape and the two read as different jobs (decision 0016). */
|
|
958
1015
|
borderRadius: string;
|
|
959
1016
|
/** Chip label typography, the same as sizes.large.font. */
|
|
960
1017
|
font: string;
|
|
@@ -1056,7 +1113,7 @@ export type Tokens = {
|
|
|
1056
1113
|
textColor: string;
|
|
1057
1114
|
/** Text input, Dropdown and Checkbox border at rest. At least 3:1 on white (decision 0025). */
|
|
1058
1115
|
borderColor: string;
|
|
1059
|
-
/** Corner radius of text inputs and
|
|
1116
|
+
/** Corner radius of text inputs, Dropdown and SearchField, matching Button. */
|
|
1060
1117
|
borderRadius: string;
|
|
1061
1118
|
/** Border width of text inputs and the Checkbox box. */
|
|
1062
1119
|
borderWidth: string;
|
|
@@ -1330,6 +1387,8 @@ export type Tokens = {
|
|
|
1330
1387
|
box: {
|
|
1331
1388
|
/** Width and height of the Checkbox and Radio box. */
|
|
1332
1389
|
size: string;
|
|
1390
|
+
/** Corner radius of the Checkbox box: one step tighter than the control radius, so the small box stays square and never reads as a Radio. */
|
|
1391
|
+
borderRadius: string;
|
|
1333
1392
|
};
|
|
1334
1393
|
row: {
|
|
1335
1394
|
/** Minimum height of a Checkbox or Radio row, so the whole row is easy to hit. */
|
|
@@ -1414,6 +1473,10 @@ export type Tokens = {
|
|
|
1414
1473
|
/** Unfilled track of ProgressBar and Slider: light, so the fill and thumb show the value (decision 0026). The resting fill step, 1.12:1 on white. */
|
|
1415
1474
|
background: string;
|
|
1416
1475
|
};
|
|
1476
|
+
overlay: {
|
|
1477
|
+
/** Corner radius of every overlay that holds controls: Modal, ActionSheet's top corners and the drawer Sheet, so they share one shape that nests around the control radius (decision 0055). */
|
|
1478
|
+
borderRadius: string;
|
|
1479
|
+
};
|
|
1417
1480
|
};
|
|
1418
1481
|
semantic: {
|
|
1419
1482
|
elevation: {
|
|
@@ -1640,8 +1703,10 @@ export type Tokens = {
|
|
|
1640
1703
|
text: {
|
|
1641
1704
|
/** Primary text: body copy, labels and headings. 15.91:1 on white, 15.51:1 on the page. */
|
|
1642
1705
|
default: string;
|
|
1643
|
-
/** Text on
|
|
1706
|
+
/** Text on the emphasis and inverse fills, such as the primary Button, the emphasis Tag and Tooltip. 15.51:1 on fill.emphasis. Text on a coloured fill uses text.on-fill. */
|
|
1644
1707
|
inverse: string;
|
|
1708
|
+
/** Text on solid coloured fills: the accent, danger, success, warning and serious fills (issue 355). The light ink, in every theme; text.inverse is for the emphasis and inverse fills. 6.00:1 on fill.accent. */
|
|
1709
|
+
'on-fill': string;
|
|
1645
1710
|
/** Text of disabled controls, translucent so it stays right on tinted surfaces. 1.53:1 on white: disabled text is exempt from the contrast minimum (WCAG 1.4.3), so never use it for text people need to read, including placeholders. */
|
|
1646
1711
|
disabled: string;
|
|
1647
1712
|
/** Success text, such as InlineAlert success messages. 5.99:1 on white. */
|
|
@@ -1688,8 +1753,10 @@ export type Tokens = {
|
|
|
1688
1753
|
default: string;
|
|
1689
1754
|
/** Icons and other foreground marks in disabled controls, matching text.disabled. 1.53:1 on white. */
|
|
1690
1755
|
disabled: string;
|
|
1691
|
-
/** Icons on
|
|
1756
|
+
/** Icons on the emphasis and inverse fills, matching text.inverse. */
|
|
1692
1757
|
inverse: string;
|
|
1758
|
+
/** Icons on coloured fills, matching text.on-fill. */
|
|
1759
|
+
'on-fill': string;
|
|
1693
1760
|
/** Success icons, such as in Alert and EmptyState. 5.99:1 on white. (InlineAlert’s icon takes the text colour instead.) */
|
|
1694
1761
|
success: string;
|
|
1695
1762
|
/** Warning icons, such as in Alert. 6.01:1 on white. (InlineAlert’s icon takes the text colour instead.) */
|
|
@@ -1754,7 +1821,7 @@ export type Tokens = {
|
|
|
1754
1821
|
muted: string;
|
|
1755
1822
|
/** Dark fill for inverse elements: a checked Checkbox, Modal and Sheet drag handles. */
|
|
1756
1823
|
inverse: string;
|
|
1757
|
-
/** Blue fill for the accent Button and other deliberate highlights (0003), with text.
|
|
1824
|
+
/** Blue fill for the accent Button and other deliberate highlights (0003), with text.on-fill on it at 6.00:1. */
|
|
1758
1825
|
accent: string;
|
|
1759
1826
|
/** Light blue fill for selected items: a selected chip, tab or row (0016). Accent text on it is 5.37:1. */
|
|
1760
1827
|
'accent-muted': string;
|
|
@@ -1762,23 +1829,23 @@ export type Tokens = {
|
|
|
1762
1829
|
'accent-muted-hover': string;
|
|
1763
1830
|
/** Fill of a pressed selected item, such as a selected filter chip. */
|
|
1764
1831
|
'accent-muted-pressed': string;
|
|
1765
|
-
/** Blue fill of a hovered accent control: fill.accent with text.
|
|
1832
|
+
/** Blue fill of a hovered accent control: fill.accent with text.on-fill mixed in at opacity.state.hover (decision 0048). */
|
|
1766
1833
|
'accent-hover': string;
|
|
1767
|
-
/** Blue fill of a pressed accent control: fill.accent with text.
|
|
1834
|
+
/** Blue fill of a pressed accent control: fill.accent with text.on-fill mixed in at opacity.state.pressed (decision 0048). */
|
|
1768
1835
|
'accent-pressed': string;
|
|
1769
|
-
/** Strong red fill for destructive actions, such as the danger Button, with text.
|
|
1836
|
+
/** Strong red fill for destructive actions, such as the danger Button, with text.on-fill on it at 6.03:1. */
|
|
1770
1837
|
danger: string;
|
|
1771
|
-
/** Fill of a hovered destructive control: fill.danger with text.
|
|
1838
|
+
/** Fill of a hovered destructive control: fill.danger with text.on-fill mixed in at opacity.state.hover (decision 0048). */
|
|
1772
1839
|
'danger-hover': string;
|
|
1773
|
-
/** Fill of a pressed destructive control: fill.danger with text.
|
|
1840
|
+
/** Fill of a pressed destructive control: fill.danger with text.on-fill mixed in at opacity.state.pressed (decision 0048). */
|
|
1774
1841
|
'danger-pressed': string;
|
|
1775
1842
|
/** Light red tint behind error messages, such as an error Alert. Danger text on it is 5.39:1. */
|
|
1776
1843
|
'danger-muted': string;
|
|
1777
|
-
/** Strong green fill for success states, such as a success indicator, with text.
|
|
1844
|
+
/** Strong green fill for success states, such as a success indicator, with text.on-fill on it at 5.99:1. */
|
|
1778
1845
|
success: string;
|
|
1779
1846
|
/** Light green tint behind success messages, such as a success Alert. Success text on it is 5.34:1. */
|
|
1780
1847
|
'success-muted': string;
|
|
1781
|
-
/** Strong yellow fill for warning states, such as a warning indicator, with text.
|
|
1848
|
+
/** Strong yellow fill for warning states, such as a warning indicator, with text.on-fill on it at 6.01:1. */
|
|
1782
1849
|
warning: string;
|
|
1783
1850
|
/** Light yellow tint behind warning messages, such as a warning Alert. Warning text on it is 5.37:1. */
|
|
1784
1851
|
'warning-muted': string;
|
|
@@ -1798,7 +1865,7 @@ export type Tokens = {
|
|
|
1798
1865
|
'none-pressed': string;
|
|
1799
1866
|
/** Hover tint for a fill-less element on a dark background, such as a count on a dark tab. */
|
|
1800
1867
|
'inverse-none-hover': string;
|
|
1801
|
-
/** Strong orange fill for serious-warning states, with text.
|
|
1868
|
+
/** Strong orange fill for serious-warning states, with text.on-fill on it at 6.04:1. */
|
|
1802
1869
|
serious: string;
|
|
1803
1870
|
/** Light orange tint behind serious-warning messages. */
|
|
1804
1871
|
'serious-muted': string;
|
|
@@ -1933,21 +2000,21 @@ export type Tokens = {
|
|
|
1933
2000
|
radius: {
|
|
1934
2001
|
/** No rounding: tables, dividers and sharp-edged containers. */
|
|
1935
2002
|
none: string;
|
|
1936
|
-
/** Minimal rounding:
|
|
2003
|
+
/** Minimal rounding for thin bars: ProgressBar and AgentInput's level meter. */
|
|
1937
2004
|
xs: string;
|
|
1938
|
-
/** Subtle rounding:
|
|
2005
|
+
/** Subtle rounding for small elements that aren't controls: Tag, Tooltip, CodeBlock, Slider's value label, small images (CardSmall, Picture) and the Checkbox box. */
|
|
1939
2006
|
sm: string;
|
|
1940
|
-
/**
|
|
2007
|
+
/** The control radius: Button, IconButton, inputs, rows and tabs, and the menus and popovers they open. */
|
|
1941
2008
|
md: string;
|
|
1942
|
-
/** Generous rounding
|
|
2009
|
+
/** Generous rounding for containers that hold controls: Alert and cards. */
|
|
1943
2010
|
lg: string;
|
|
1944
|
-
/** Large rounding:
|
|
2011
|
+
/** Large rounding: large cards such as AccountCard. */
|
|
1945
2012
|
xl: string;
|
|
1946
|
-
/**
|
|
2013
|
+
/** Overlays that hold controls (Modal, ActionSheet and the drawer Sheet), so their corners nest around the control radius, and large image cards (CardLarge, FeatureBlock). */
|
|
1947
2014
|
'2xl': string;
|
|
1948
|
-
/** Maximum rounding short of a circle:
|
|
2015
|
+
/** Maximum rounding short of a circle: AgentInput's input shell, which holds round buttons. */
|
|
1949
2016
|
'3xl': string;
|
|
1950
|
-
/** Fully round: avatars, round icon buttons
|
|
2017
|
+
/** Fully round: avatars, chips, badges, round icon buttons and status dots. */
|
|
1951
2018
|
full: string;
|
|
1952
2019
|
};
|
|
1953
2020
|
space: {
|
|
@@ -2001,9 +2068,11 @@ export type Tokens = {
|
|
|
2001
2068
|
surface: {
|
|
2002
2069
|
/** The page: the off-white background everything else sits on (decision 0006). */
|
|
2003
2070
|
base: string;
|
|
2004
|
-
/** Content raised off the page: cards, inputs,
|
|
2071
|
+
/** Content raised off the page: cards, inputs, code blocks. Floating layers use surface.overlay. */
|
|
2005
2072
|
raised: string;
|
|
2006
|
-
/**
|
|
2073
|
+
/** Floating layers above raised content: Menu, the Dropdown and SearchField lists, ActionSheet, Modal and Sheet (issue 356). White in light, the same as raised; in the dark theme one step lighter than raised, because shadows barely show on a dark page. */
|
|
2074
|
+
overlay: string;
|
|
2075
|
+
/** Backdrop behind a modal surface: Modal, Sheet, ActionSheet. The dark ink at opacity.scrim, so it stays dark in every theme. */
|
|
2007
2076
|
scrim: string;
|
|
2008
2077
|
};
|
|
2009
2078
|
};
|