@canonical/react-ds-global 0.48.0 → 0.50.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/esm/lib/_work_in_progress/Announcement/styles.css +4 -4
- package/dist/esm/lib/_work_in_progress/Label/styles.css +1 -7
- package/dist/esm/lib/component/Accordion/common/Item/styles.css +5 -6
- package/dist/esm/lib/component/Accordion/styles.css +3 -9
- package/dist/esm/lib/component/Breadcrumbs/common/Item/styles.css +6 -14
- package/dist/esm/lib/component/Breadcrumbs/styles.css +2 -9
- package/dist/esm/lib/component/Button/Button.js +28 -12
- package/dist/esm/lib/component/Button/Button.js.map +1 -1
- package/dist/esm/lib/component/Button/styles.css +48 -18
- package/dist/esm/lib/component/Card/common/Content/styles.css +4 -5
- package/dist/esm/lib/component/Card/common/Header/styles.css +1 -2
- package/dist/esm/lib/component/Card/styles.css +1 -2
- package/dist/esm/lib/component/ContextualMenu/common/Item/styles.css +6 -9
- package/dist/esm/lib/component/ContextualMenu/styles.css +6 -7
- package/dist/esm/lib/component/Icon/styles.css +3 -7
- package/dist/esm/lib/component/InlineCode/styles.css +2 -3
- package/dist/esm/lib/component/KeyboardKey/styles.css +6 -8
- package/dist/esm/lib/component/Tabs/common/Item/styles.css +1 -1
- package/dist/esm/lib/component/Tabs/styles.css +4 -8
- package/dist/esm/lib/component/Tile/common/Content/styles.css +2 -5
- package/dist/esm/lib/component/Tile/common/Header/styles.css +3 -6
- package/dist/esm/lib/component/Tile/styles.css +1 -5
- package/dist/esm/lib/component/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/lib/component/Tooltip/TooltipEngine.js +91 -15
- package/dist/esm/lib/component/Tooltip/TooltipEngine.js.map +1 -1
- package/dist/esm/lib/component/Tooltip/hooks/useTooltipState.js +89 -0
- package/dist/esm/lib/component/Tooltip/hooks/useTooltipState.js.map +1 -0
- package/dist/esm/lib/component/Tooltip/styles.css +151 -80
- package/dist/esm/lib/component/Tooltip/withTooltip.js +3 -3
- package/dist/esm/lib/group/KeyboardKeys/styles.css +1 -1
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js +172 -173
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js.map +1 -1
- package/dist/esm/lib/pattern/Modal/common/Content/styles.css +3 -6
- package/dist/esm/lib/pattern/Modal/common/Footer/styles.css +1 -1
- package/dist/esm/lib/pattern/Modal/common/Header/styles.css +3 -9
- package/dist/esm/lib/pattern/Modal/styles.css +14 -20
- package/dist/esm/lib/pattern/Timeline/common/Content/styles.css +1 -4
- package/dist/esm/lib/pattern/Timeline/common/Event/styles.css +6 -13
- package/dist/esm/lib/pattern/Timeline/styles.css +1 -4
- package/dist/types/lib/component/Button/Button.d.ts +4 -1
- package/dist/types/lib/component/Button/Button.d.ts.map +1 -1
- package/dist/types/lib/component/Button/types.d.ts +15 -4
- package/dist/types/lib/component/Button/types.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/TooltipEngine.d.ts +6 -4
- package/dist/types/lib/component/Tooltip/TooltipEngine.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/hooks/useTooltipState.d.ts +17 -0
- package/dist/types/lib/component/Tooltip/hooks/useTooltipState.d.ts.map +1 -0
- package/dist/types/lib/component/Tooltip/types.d.ts +27 -2
- package/dist/types/lib/component/Tooltip/types.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/withTooltip.d.ts +3 -3
- package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts +22 -1
- package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts.map +1 -1
- package/package.json +23 -14
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* modifier family (@canonical/design-tokens → modifiers.criticality.css), which
|
|
8
8
|
* remaps the --modifier-color-* channels. The criticality tints the SURFACE —
|
|
9
9
|
* background, side bar, and icon — via those channels; the text stays the
|
|
10
|
-
* neutral root colour (`--color-text`) on every criticality
|
|
10
|
+
* neutral root colour (`--color-text`) on every criticality. The
|
|
11
11
|
* component restates no criticality token; it only reads channels. The default
|
|
12
12
|
* look comes from the `criticality="information"` prop default, which applies
|
|
13
13
|
* `.information` and supplies the channel values; no class ⇒ no tint, by design.
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
align-items: flex-start;
|
|
30
30
|
gap: var(--dimension-100);
|
|
31
31
|
|
|
32
|
-
/* Side bar
|
|
32
|
+
/* Side bar: leading rule carrying the criticality colour. */
|
|
33
33
|
border-inline-start-style: solid;
|
|
34
34
|
border-inline-start-width: var(--dimension-stroke-thickness-large);
|
|
35
35
|
border-inline-start-color: var(--modifier-color-border);
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
padding: var(--dimension-100);
|
|
38
38
|
|
|
39
39
|
/* Text is always the root text colour — the criticality tints the icon,
|
|
40
|
-
side bar and background, but the copy stays neutral
|
|
41
|
-
|
|
40
|
+
side bar and background, but the copy stays neutral on every
|
|
41
|
+
criticality. Only the icon reads the criticality colour channel. */
|
|
42
42
|
color: var(--color-text);
|
|
43
43
|
background-color: var(--modifier-color-foreground-secondary);
|
|
44
44
|
|
|
@@ -5,19 +5,13 @@
|
|
|
5
5
|
* Label styles
|
|
6
6
|
* @implements ds:global.component.label
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* - layout.display: inline -> display: inline
|
|
10
|
-
* - typography.size: font/size/label -> font-size: var(--font-size-label)
|
|
11
|
-
* - typography.weight: font/weight/medium -> font-weight: var(--font-weight-medium)
|
|
8
|
+
* Inline text at the label font size and the medium font weight.
|
|
12
9
|
*/
|
|
13
10
|
.ds.label {
|
|
14
|
-
/* layout.display: inline */
|
|
15
11
|
display: inline;
|
|
16
12
|
|
|
17
|
-
/* typography.size: font/size/label */
|
|
18
13
|
font-size: var(--label-font-size, var(--font-size-label, 0.75rem));
|
|
19
14
|
|
|
20
|
-
/* typography.weight: font/weight/medium */
|
|
21
15
|
font-weight: var(--label-font-weight, var(--font-weight-medium, 500));
|
|
22
16
|
|
|
23
17
|
/* Additional styling */
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @implements ds:global.subcomponent.accordion-item
|
|
7
7
|
*
|
|
8
8
|
* Rendered with native <details>/<summary>. Typography and baseline alignment
|
|
9
|
-
* come from the `.p` class on the heading and content.
|
|
10
|
-
*
|
|
9
|
+
* come from the `.p` class on the heading and content. The header's
|
|
10
|
+
* interactive background uses the ghost surface channel (which
|
|
11
11
|
* auto-steps on nested .surface contexts to layer2/layer3), text uses
|
|
12
12
|
* color-text, the chevron uses color-icon, and dividers use color-border-muted.
|
|
13
13
|
* Vertical padding is expressed in baseline multiples.
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
/* Vertical content padding in baseline multiples (dimension-100 = 1 bU). */
|
|
57
57
|
--accordion-item-content-padding-block: var(--dimension-100);
|
|
58
58
|
|
|
59
|
-
/* Fixed chevron size
|
|
59
|
+
/* Fixed chevron size so every item reserves the same chevron
|
|
60
60
|
column width and all headings start at the same x-position, regardless of
|
|
61
61
|
heading level — no horizontal drift. */
|
|
62
62
|
--accordion-item-chevron-size: var(--dimension-200);
|
|
@@ -76,8 +76,7 @@
|
|
|
76
76
|
/* Inline (side) borders — off by default, see the token above. */
|
|
77
77
|
border-inline: var(--accordion-item-border-inline);
|
|
78
78
|
|
|
79
|
-
/*
|
|
80
|
-
of an accordion item indicates the end of an accordion item"). */
|
|
79
|
+
/* The divider at the end of each item marks where the item ends. */
|
|
81
80
|
border-block-end: var(--dimension-stroke-thickness-medium) solid
|
|
82
81
|
var(--accordion-item-color-border);
|
|
83
82
|
}
|
|
@@ -220,7 +219,7 @@
|
|
|
220
219
|
}
|
|
221
220
|
}
|
|
222
221
|
|
|
223
|
-
/* Open: chevron points down (
|
|
222
|
+
/* Open: the chevron points down (it points right when closed). */
|
|
224
223
|
.ds.accordion-item[open] > .header > .chevron {
|
|
225
224
|
transform: rotate(0deg);
|
|
226
225
|
}
|
|
@@ -5,19 +5,13 @@
|
|
|
5
5
|
* Accordion styles
|
|
6
6
|
* @implements ds:global.component.accordion
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* - layout.type: stack -> display: flex; flex-direction: column
|
|
10
|
-
* - layout.direction: vertical -> flex-direction: column
|
|
11
|
-
* - appearance.border: color-border-$root
|
|
12
|
-
*
|
|
13
|
-
* Tokens follow the Figma spec.
|
|
8
|
+
* A vertical stack of items.
|
|
14
9
|
*/
|
|
15
10
|
:root {
|
|
16
11
|
--accordion-border-radius: var(--dimension-radius-small);
|
|
17
12
|
}
|
|
18
13
|
|
|
19
14
|
.ds.accordion {
|
|
20
|
-
/* layout.type: stack, layout.direction: vertical */
|
|
21
15
|
display: flex;
|
|
22
16
|
flex-direction: column;
|
|
23
17
|
|
|
@@ -31,8 +25,8 @@
|
|
|
31
25
|
.surface context; outside any .surface it defaults to the base background. */
|
|
32
26
|
background: var(--surface-color-background, var(--color-background));
|
|
33
27
|
|
|
34
|
-
/*
|
|
35
|
-
|
|
28
|
+
/* The accordion has no outer border or frame, only the per-item dividers
|
|
29
|
+
(see Accordion.Item). */
|
|
36
30
|
border-radius: var(--accordion-border-radius);
|
|
37
31
|
|
|
38
32
|
/* Clip item corners to the accordion radius */
|
|
@@ -5,15 +5,9 @@
|
|
|
5
5
|
* Breadcrumbs.Item styles
|
|
6
6
|
* @implements ds:global.subcomponent.breadcrumbs-item
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* - layout.align: center -> align-items: center
|
|
12
|
-
*
|
|
13
|
-
* Tokens follow the Figma spec: links use color-text-link, the current item
|
|
14
|
-
* and the separator use color-text, and the spacing around the separator
|
|
15
|
-
* uses the dimension scale (Figma specs 6px, which is not on the scale; the
|
|
16
|
-
* nearest token is dimension-100 = 8px).
|
|
8
|
+
* A centred row. Links use color-text-link, the current item and the
|
|
9
|
+
* separator use color-text, and the spacing around the separator is
|
|
10
|
+
* dimension-100 (8px), the nearest step of the dimension scale to 6px.
|
|
17
11
|
*/
|
|
18
12
|
.ds.breadcrumbs-item {
|
|
19
13
|
/* Component tokens — pure aliases to semantic tokens, component-scoped
|
|
@@ -26,25 +20,23 @@
|
|
|
26
20
|
--breadcrumbs-item-separator-color: var(--color-text);
|
|
27
21
|
--breadcrumbs-item-focus-color: var(--color-text-link);
|
|
28
22
|
|
|
29
|
-
/* layout.type: flow, layout.direction: horizontal */
|
|
30
23
|
display: flex;
|
|
31
24
|
flex-direction: row;
|
|
32
25
|
|
|
33
26
|
/* Distance between the separator and the link. */
|
|
34
27
|
column-gap: var(--breadcrumbs-item-separator-margin);
|
|
35
28
|
|
|
36
|
-
/* layout.align: center */
|
|
37
29
|
align-items: center;
|
|
38
30
|
|
|
39
31
|
/* Remove list styling */
|
|
40
32
|
list-style: none;
|
|
41
33
|
|
|
42
|
-
/* Link element
|
|
34
|
+
/* Link element. */
|
|
43
35
|
& > .link {
|
|
44
36
|
color: var(--breadcrumbs-item-link-color);
|
|
45
37
|
text-decoration: none;
|
|
46
38
|
|
|
47
|
-
/*
|
|
39
|
+
/* Underlined on interaction. */
|
|
48
40
|
&:hover {
|
|
49
41
|
text-decoration: underline;
|
|
50
42
|
}
|
|
@@ -56,7 +48,7 @@
|
|
|
56
48
|
}
|
|
57
49
|
}
|
|
58
50
|
|
|
59
|
-
/* Separator element
|
|
51
|
+
/* Separator element. Rendered before the link so a
|
|
60
52
|
wrapped row starts with the slash; hidden on the first item. Spacing
|
|
61
53
|
around it is gap-based (the list column-gap before, the item
|
|
62
54
|
column-gap after) rather than separator margins, so a separator that
|
|
@@ -5,13 +5,8 @@
|
|
|
5
5
|
* Breadcrumbs styles
|
|
6
6
|
* @implements ds:global.component.breadcrumbs
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* - layout.direction: horizontal -> flex-direction: row
|
|
11
|
-
* - layout.align: center -> align-items: center
|
|
12
|
-
*
|
|
13
|
-
* Typography and baseline alignment come from the `.p` class on the list
|
|
14
|
-
* (the typography-text-primary tier, per the Figma spec).
|
|
8
|
+
* A centred row that wraps. Typography and baseline alignment come from the
|
|
9
|
+
* `.p` class on the list (the typography-text-primary tier).
|
|
15
10
|
*/
|
|
16
11
|
.ds.breadcrumbs {
|
|
17
12
|
/* Component token — a pure alias to a semantic token, component-scoped
|
|
@@ -20,7 +15,6 @@
|
|
|
20
15
|
--breadcrumbs-item-separator-margin: var(--dimension-100);
|
|
21
16
|
|
|
22
17
|
& > .list {
|
|
23
|
-
/* layout.type: flow, layout.direction: horizontal */
|
|
24
18
|
display: flex;
|
|
25
19
|
flex-direction: row;
|
|
26
20
|
flex-wrap: wrap;
|
|
@@ -33,7 +27,6 @@
|
|
|
33
27
|
opens a wrapped row aligns flush with the container edge. */
|
|
34
28
|
column-gap: var(--breadcrumbs-item-separator-margin);
|
|
35
29
|
|
|
36
|
-
/* layout.align: center */
|
|
37
30
|
align-items: center;
|
|
38
31
|
|
|
39
32
|
/* Reset list styles */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Spinner } from "../../subcomponent/Spinner/index.js";
|
|
3
3
|
import { Icon } from "../Icon/index.js";
|
|
4
4
|
import "./styles.css";
|
|
@@ -10,9 +10,12 @@ const componentCssClassName = "ds button";
|
|
|
10
10
|
*
|
|
11
11
|
* `import { Button } from "@canonical/react-ds-global";`
|
|
12
12
|
*
|
|
13
|
+
* Fragments: renders the button plus, when `loading` is controlled, a sibling
|
|
14
|
+
* status region, so the component has no single root element.
|
|
15
|
+
*
|
|
13
16
|
* @implements ds:global.component.button
|
|
14
17
|
*/
|
|
15
|
-
const Button = ({ id, className, children, style, importance = "primary", anticipation, variant, icon, loading =
|
|
18
|
+
const Button = ({ id, className, children, style, importance = "primary", anticipation, variant, icon, loading, loadingLabel = "Loading", disabled, onClick, ...props }) => {
|
|
16
19
|
// Booleans and nullish children render nothing; everything else (including
|
|
17
20
|
// the number 0) produces visible text that names the button.
|
|
18
21
|
const hasVisibleChildren = children != null && typeof children !== "boolean" && children !== "";
|
|
@@ -27,16 +30,29 @@ const Button = ({ id, className, children, style, importance = "primary", antici
|
|
|
27
30
|
// The icon slot only accepts a design-system icon name; the Icon component
|
|
28
31
|
// maps it to the @canonical/ds-assets sprite (decorative by default).
|
|
29
32
|
const iconElement = icon && (_jsx("span", { className: "icon", children: _jsx(Icon, { icon: icon }) }));
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
|
|
33
|
+
// A loading button stays focusable (a natively disabled button would drop
|
|
34
|
+
// keyboard focus to the document) and is instead marked aria-disabled, with
|
|
35
|
+
// activation blocked here.
|
|
36
|
+
const isBlocked = loading === true && !disabled;
|
|
37
|
+
// Blocks activation while loading: preventDefault stops a form submission
|
|
38
|
+
// and the consumer's handler is not invoked.
|
|
39
|
+
const handleClick = (event) => {
|
|
40
|
+
if (loading) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
onClick?.(event);
|
|
45
|
+
};
|
|
46
|
+
return (_jsxs(_Fragment, { children: [_jsxs("button", { id: id, className: [
|
|
47
|
+
componentCssClassName,
|
|
48
|
+
importance,
|
|
49
|
+
anticipation,
|
|
50
|
+
variant,
|
|
51
|
+
loading && "loading",
|
|
52
|
+
className,
|
|
53
|
+
]
|
|
54
|
+
.filter(Boolean)
|
|
55
|
+
.join(" "), style: style, "aria-busy": loading || undefined, "aria-disabled": isBlocked || undefined, disabled: disabled, ...props, onClick: handleClick, children: [iconElement, hasVisibleChildren && _jsx("span", { className: "label", children: children }), loading && (_jsx("span", { className: "loading-spinner", "aria-hidden": "true", children: _jsx(Spinner, {}) }))] }), loading !== undefined && (_jsx("span", { className: "ds button-loading-status", role: "status", children: loading ? loadingLabel : "" }))] }));
|
|
40
56
|
};
|
|
41
57
|
export default Button;
|
|
42
58
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/lib/component/Button/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/lib/component/Button/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAE1C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,GAAG,CAAC,EACd,EAAE,EACF,SAAS,EACT,QAAQ,EACR,KAAK,EACL,UAAU,GAAG,SAAS,EACtB,YAAY,EACZ,OAAO,EACP,IAAI,EACJ,OAAO,EACP,YAAY,GAAG,SAAS,EACxB,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACF,EAAsB,EAAE;IAC9B,2EAA2E;IAC3E,6DAA6D;IAC7D,MAAM,kBAAkB,GACtB,QAAQ,IAAI,IAAI,IAAI,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,EAAE,CAAC;IAEvE,IACE,OAAO,OAAO,KAAK,WAAW;QAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;QACrC,CAAC,IAAI,IAAI,OAAO,CAAC;QACjB,CAAC,kBAAkB;QACnB,CAAC,KAAK,CAAC,YAAY,CAAC;QACpB,CAAC,KAAK,CAAC,iBAAiB,CAAC,EACzB,CAAC;QACD,OAAO,CAAC,IAAI,CACV,gGAAgG,CACjG,CAAC;IACJ,CAAC;IAED,2EAA2E;IAC3E,sEAAsE;IACtE,MAAM,WAAW,GAAG,IAAI,IAAI,CAC1B,eAAM,SAAS,EAAC,MAAM,YACpB,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,GACf,CACR,CAAC;IAEF,0EAA0E;IAC1E,4EAA4E;IAC5E,2BAA2B;IAC3B,MAAM,SAAS,GAAG,OAAO,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC;IAEhD,0EAA0E;IAC1E,6CAA6C;IAC7C,MAAM,WAAW,GAA+C,CAAC,KAAK,EAAE,EAAE;QACxE,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QACD,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,CACL,8BACE,kBACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAE;oBACT,qBAAqB;oBACrB,UAAU;oBACV,YAAY;oBACZ,OAAO;oBACP,OAAO,IAAI,SAAS;oBACpB,SAAS;iBACV;qBACE,MAAM,CAAC,OAAO,CAAC;qBACf,IAAI,CAAC,GAAG,CAAC,EACZ,KAAK,EAAE,KAAK,eACD,OAAO,IAAI,SAAS,mBAChB,SAAS,IAAI,SAAS,EACrC,QAAQ,EAAE,QAAQ,KACd,KAAK,EACT,OAAO,EAAE,WAAW,aAInB,WAAW,EACX,kBAAkB,IAAI,eAAM,SAAS,EAAC,OAAO,YAAE,QAAQ,GAAQ,EAC/D,OAAO,IAAI,CACV,eAAM,SAAS,EAAC,iBAAiB,iBAAa,MAAM,YAClD,KAAC,OAAO,KAAG,GACN,CACR,IACM,EAMR,OAAO,KAAK,SAAS,IAAI,CACxB,eAAM,SAAS,EAAC,0BAA0B,EAAC,IAAI,EAAC,QAAQ,YACrD,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GACvB,CACR,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
--button-color-text: var(--color-text);
|
|
24
24
|
--button-color-border: var(--color-border-highlighted, var(--color-border));
|
|
25
25
|
|
|
26
|
-
/* Inline padding
|
|
26
|
+
/* Inline padding:
|
|
27
27
|
- end (right): always dimension-200 (16px) — the label always sits 16px
|
|
28
28
|
from the trailing edge.
|
|
29
29
|
- start (left): dimension-200 (16px) with no icon; dimension-100 (8px) when
|
|
@@ -73,10 +73,14 @@
|
|
|
73
73
|
the density seat below subtracts one constant. (The previous
|
|
74
74
|
width-multiplied toggle left the primary 2px shorter than the secondary
|
|
75
75
|
and seated its label ~1px high.) */
|
|
76
|
+
/* 100% when the importance shows a border, 0% when it does not. Every
|
|
77
|
+
border colour (enabled, disabled, loading) is mixed with transparent by
|
|
78
|
+
this amount, so a borderless importance stays borderless in all states. */
|
|
79
|
+
--button-outline-mix: calc(var(--modifier-outline, 0) * 100%);
|
|
76
80
|
border-color: color-mix(
|
|
77
81
|
in srgb,
|
|
78
82
|
var(--modifier-color-border, var(--button-color-border))
|
|
79
|
-
|
|
83
|
+
var(--button-outline-mix),
|
|
80
84
|
transparent
|
|
81
85
|
);
|
|
82
86
|
border-style: solid;
|
|
@@ -128,14 +132,14 @@
|
|
|
128
132
|
|
|
129
133
|
/* State fallbacks resolve to the default (primary) surface states when no
|
|
130
134
|
importance modifier supplies `--modifier-surface-*`. */
|
|
131
|
-
&:hover:not(:disabled) {
|
|
135
|
+
&:hover:not(:disabled, .loading) {
|
|
132
136
|
background-color: var(
|
|
133
137
|
--modifier-surface-hover,
|
|
134
138
|
var(--button-color-background-hover)
|
|
135
139
|
);
|
|
136
140
|
}
|
|
137
141
|
|
|
138
|
-
&:active:not(:disabled) {
|
|
142
|
+
&:active:not(:disabled, .loading) {
|
|
139
143
|
background-color: var(
|
|
140
144
|
--modifier-surface-active,
|
|
141
145
|
var(--button-color-background-active)
|
|
@@ -163,9 +167,14 @@
|
|
|
163
167
|
--modifier-surface-disabled,
|
|
164
168
|
var(--button-color-background-disabled)
|
|
165
169
|
);
|
|
166
|
-
border-color:
|
|
167
|
-
|
|
168
|
-
var(
|
|
170
|
+
border-color: color-mix(
|
|
171
|
+
in srgb,
|
|
172
|
+
var(
|
|
173
|
+
--modifier-color-border-disabled,
|
|
174
|
+
var(--color-border-highlighted-disabled)
|
|
175
|
+
)
|
|
176
|
+
var(--button-outline-mix),
|
|
177
|
+
transparent
|
|
169
178
|
);
|
|
170
179
|
}
|
|
171
180
|
}
|
|
@@ -201,20 +210,28 @@
|
|
|
201
210
|
Loading State
|
|
202
211
|
========================================================================== */
|
|
203
212
|
|
|
204
|
-
/* Loading
|
|
205
|
-
icon and label stay in the DOM (
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
213
|
+
/* Loading overlays a Spinner on the icon and label but keeps the button's
|
|
214
|
+
width: the icon and label stay in the DOM (transparent, so their box
|
|
215
|
+
still reserves space and the label still names the button;
|
|
216
|
+
`visibility: hidden` would remove it from the accessible name) and the
|
|
217
|
+
Spinner is centred on top. A loading button blocks activation, but it
|
|
218
|
+
must not *read* as disabled — it is working, not unavailable — so it
|
|
219
|
+
keeps the enabled surface, text and border colours, overriding the
|
|
220
|
+
:disabled greying above when both apply. */
|
|
210
221
|
.ds.button.loading {
|
|
222
|
+
cursor: progress;
|
|
211
223
|
color: var(--modifier-color-text, var(--button-color-text));
|
|
212
224
|
background-color: var(--modifier-surface, var(--button-color-background));
|
|
213
|
-
border-color:
|
|
225
|
+
border-color: color-mix(
|
|
226
|
+
in srgb,
|
|
227
|
+
var(--modifier-color-border, var(--button-color-border))
|
|
228
|
+
var(--button-outline-mix),
|
|
229
|
+
transparent
|
|
230
|
+
);
|
|
214
231
|
|
|
215
232
|
& > .icon,
|
|
216
233
|
& > .label {
|
|
217
|
-
|
|
234
|
+
opacity: 0;
|
|
218
235
|
}
|
|
219
236
|
|
|
220
237
|
& > .loading-spinner {
|
|
@@ -226,6 +243,20 @@
|
|
|
226
243
|
}
|
|
227
244
|
}
|
|
228
245
|
|
|
246
|
+
/* The status region announcing the loading label is visually hidden but
|
|
247
|
+
stays in the accessibility tree. */
|
|
248
|
+
.ds.button-loading-status {
|
|
249
|
+
position: absolute;
|
|
250
|
+
width: 1px;
|
|
251
|
+
height: 1px;
|
|
252
|
+
margin: -1px;
|
|
253
|
+
padding: 0;
|
|
254
|
+
overflow: hidden;
|
|
255
|
+
clip-path: inset(50%);
|
|
256
|
+
white-space: nowrap;
|
|
257
|
+
border: 0;
|
|
258
|
+
}
|
|
259
|
+
|
|
229
260
|
/* ==========================================================================
|
|
230
261
|
Link Variant
|
|
231
262
|
========================================================================== */
|
|
@@ -239,7 +270,7 @@
|
|
|
239
270
|
text-decoration: underline;
|
|
240
271
|
text-underline-offset: var(--tmp-dimension-underline-offset-link, 0.075em);
|
|
241
272
|
|
|
242
|
-
&:hover:not(:disabled) {
|
|
273
|
+
&:hover:not(:disabled, .loading) {
|
|
243
274
|
background-color: transparent;
|
|
244
275
|
border-color: transparent;
|
|
245
276
|
text-decoration-thickness: var(
|
|
@@ -248,7 +279,7 @@
|
|
|
248
279
|
);
|
|
249
280
|
}
|
|
250
281
|
|
|
251
|
-
&:active:not(:disabled) {
|
|
282
|
+
&:active:not(:disabled, .loading) {
|
|
252
283
|
background-color: transparent;
|
|
253
284
|
border-color: transparent;
|
|
254
285
|
}
|
|
@@ -328,7 +359,6 @@
|
|
|
328
359
|
box-sizing: border-box;
|
|
329
360
|
block-size: auto;
|
|
330
361
|
align-items: flex-start;
|
|
331
|
-
justify-content: flex-start;
|
|
332
362
|
line-height: var(--control-seat-line);
|
|
333
363
|
padding-block: var(--seat-before) var(--seat-after);
|
|
334
364
|
}
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
* Card.Content styles
|
|
6
6
|
* @implements ds:global.subcomponent.card-content
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* sides 200).
|
|
8
|
+
* A vertical stack and a content-bearing section: it pads itself (the card
|
|
9
|
+
* frame applies no general padding). Vertical padding is in baseline
|
|
10
|
+
* multiples and asymmetric: one baseline on top, two below (top 100 /
|
|
11
|
+
* bottom 200 / sides 200).
|
|
13
12
|
*/
|
|
14
13
|
:root {
|
|
15
14
|
--card-content-gap: var(--dimension-100);
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* Card.Header styles
|
|
6
6
|
* @implements ds:global.subcomponent.card-header
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* A content-bearing section: it pads itself (the card frame applies no general
|
|
8
|
+
* A row with its items spread to both ends, and a content-bearing section: it pads itself (the card frame applies no general
|
|
10
9
|
* padding). Vertical padding is in baseline multiples.
|
|
11
10
|
*/
|
|
12
11
|
:root {
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
* The Card is NOT a surface: it establishes no `.surface` context and sets no
|
|
9
9
|
* background of its own, so on a surface it takes the same background as its
|
|
10
10
|
* container (no step) and reads as flush. It stays delimited by its border,
|
|
11
|
-
* radius, and the dividers between its sections.
|
|
12
|
-
* spec.
|
|
11
|
+
* radius, and the dividers between its sections.
|
|
13
12
|
*
|
|
14
13
|
* ── A Card is a grid participant ────────────────────────────────────────────
|
|
15
14
|
* A Card always lives inside a grid (standalone: wrap it in a `.grid`; in bulk:
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
2
2
|
|
|
3
3
|
@layer ds.components.global {
|
|
4
|
-
/* Component tokens — sourced from @canonical/design-tokens
|
|
5
|
-
Mapped strictly to the Figma "Contextual menu item" frame:
|
|
4
|
+
/* Component tokens — sourced from @canonical/design-tokens:
|
|
6
5
|
px = dimension-200 (16px), py = dimension-050 (4px), gap = dimension-050 (4px)
|
|
7
6
|
between icon<->text and text<->caret, text = color-text (black),
|
|
8
7
|
fills = color-foreground-ghost/-active, line-height 24px.
|
|
@@ -19,7 +18,7 @@
|
|
|
19
18
|
);
|
|
20
19
|
--contextual-menu-item-padding-block: var(--dimension-050);
|
|
21
20
|
--contextual-menu-item-padding-inline: var(--dimension-200);
|
|
22
|
-
/* 4px gap: icon<->text and text<->caret
|
|
21
|
+
/* 4px gap: icon<->text and text<->caret. */
|
|
23
22
|
--contextual-menu-item-gap: var(--dimension-050);
|
|
24
23
|
/* De-emphasised slot text (badge / shortcut) — muted, matching
|
|
25
24
|
KeyboardKey / Tabs. */
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
|
|
38
37
|
.ds.contextual-menu-item {
|
|
39
38
|
display: flex;
|
|
40
|
-
/* Icon and first line of text are centre-aligned
|
|
39
|
+
/* Icon and first line of text are centre-aligned. */
|
|
41
40
|
align-items: center;
|
|
42
41
|
gap: var(--contextual-menu-item-gap);
|
|
43
42
|
padding-block: var(--contextual-menu-item-padding-block);
|
|
@@ -57,8 +56,7 @@
|
|
|
57
56
|
background-color: var(--contextual-menu-item-color-background-hover);
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
/* The highlighted (roving) item shows the active fill
|
|
61
|
-
"Active" state. */
|
|
59
|
+
/* The highlighted (roving) item shows the active fill. */
|
|
62
60
|
&:focus-visible,
|
|
63
61
|
&[tabindex="0"] {
|
|
64
62
|
background-color: var(--contextual-menu-item-color-background-active);
|
|
@@ -69,8 +67,7 @@
|
|
|
69
67
|
non-text minimum — so keyboard focus additionally draws a ring (WCAG
|
|
70
68
|
1.4.11 / 2.4.13). Inset (negative offset) so the popup surface's
|
|
71
69
|
`overflow-y: auto` never clips it; :focus-visible only, so pointer users
|
|
72
|
-
keep the quiet
|
|
73
|
-
state, which fails WCAG. */
|
|
70
|
+
keep the quiet look. The active fill alone fails WCAG. */
|
|
74
71
|
&:focus-visible {
|
|
75
72
|
outline: var(--contextual-menu-item-focus-ring-width) solid
|
|
76
73
|
var(--contextual-menu-item-focus-ring-color);
|
|
@@ -88,7 +85,7 @@
|
|
|
88
85
|
color: var(--contextual-menu-item-slot-color);
|
|
89
86
|
}
|
|
90
87
|
|
|
91
|
-
/* The submenu caret sits on the trailing edge in a fixed icon box (
|
|
88
|
+
/* The submenu caret sits on the trailing edge in a fixed icon box (a
|
|
92
89
|
16px chevron in a 24px-tall wrapper). It always follows the reading
|
|
93
90
|
direction — chevron-right in LTR, mirrored to point left in RTL — rather
|
|
94
91
|
than flipping per-item with the side the submenu opens on, so sibling carets
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
2
2
|
|
|
3
3
|
@layer ds.components.global {
|
|
4
|
-
/* Component tokens — sourced from @canonical/design-tokens
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
muted 1px divider between sections. */
|
|
4
|
+
/* Component tokens — sourced from @canonical/design-tokens: a white
|
|
5
|
+
background (color-background), a drop shadow (no border), and a muted 1px
|
|
6
|
+
divider between sections. */
|
|
8
7
|
:root {
|
|
9
8
|
--contextual-menu-color-divider: var(--color-border-muted);
|
|
10
9
|
--contextual-menu-divider-width: var(--dimension-stroke-thickness-medium);
|
|
11
10
|
--contextual-menu-min-width: 12rem;
|
|
12
11
|
--contextual-menu-max-width: 20rem;
|
|
13
|
-
/*
|
|
12
|
+
/* A three-layer drop shadow. */
|
|
14
13
|
--contextual-menu-shadow:
|
|
15
14
|
0 1px 1px 0 rgba(0, 0, 0, 0.15), 0 2px 2px -1px rgba(0, 0, 0, 0.15),
|
|
16
15
|
0 0 3px 0 rgba(0, 0, 0, 0.2);
|
|
@@ -68,8 +67,8 @@
|
|
|
68
67
|
transition: none;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
/* A separator entry draws the muted divider between sections
|
|
72
|
-
color-border-muted, stroke-thickness-medium). Reset the UA's <hr> box —
|
|
70
|
+
/* A separator entry draws the muted divider between sections
|
|
71
|
+
(color-border-muted, stroke-thickness-medium). Reset the UA's <hr> box —
|
|
73
72
|
the divider is a coloured border, not a margin-bearing rule. */
|
|
74
73
|
.separator {
|
|
75
74
|
margin: 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
2
2
|
|
|
3
3
|
@layer ds.components.global {
|
|
4
|
-
/* Component tokens
|
|
4
|
+
/* Component tokens */
|
|
5
5
|
:root {
|
|
6
6
|
--icon-size: 1em;
|
|
7
7
|
}
|
|
@@ -10,17 +10,13 @@
|
|
|
10
10
|
* Icon styles
|
|
11
11
|
* @implements ds:global.component.icon
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* - size.width: size/icon/default -> width: var(--size-icon-default)
|
|
16
|
-
* - size.height: size/icon/default -> height: var(--size-icon-default)
|
|
13
|
+
* An inline box sized by `--icon-size`, falling back to the icon size
|
|
14
|
+
* token.
|
|
17
15
|
*/
|
|
18
16
|
.ds.icon {
|
|
19
|
-
/* layout.display: inline-block */
|
|
20
17
|
display: inline-block;
|
|
21
18
|
vertical-align: middle;
|
|
22
19
|
|
|
23
|
-
/* size.width: size/icon/default, size.height: size/icon/default */
|
|
24
20
|
width: var(--icon-size, var(--size-icon-default, 1rem));
|
|
25
21
|
height: var(--icon-size, var(--size-icon-default, 1rem));
|
|
26
22
|
}
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
/* The `.code` baseline utility (from @canonical/styles) supplies the
|
|
13
13
|
monospace typography tier; inline `.code` gets no vertical padding of its
|
|
14
|
-
own, so the chip adds it
|
|
15
|
-
|
|
16
|
-
mode-aware). */
|
|
14
|
+
own, so the chip adds it (2px top and bottom), plus the horizontal padding
|
|
15
|
+
and the code colour and background (both mode-aware). */
|
|
17
16
|
.ds.inline-code {
|
|
18
17
|
color: var(--inline-code-color-text);
|
|
19
18
|
background-color: var(--inline-code-color-background);
|
|
@@ -10,12 +10,11 @@
|
|
|
10
10
|
below, where the key's own `.surface` scope is in effect. */
|
|
11
11
|
--keyboard-key-color-border: var(--color-border-muted);
|
|
12
12
|
|
|
13
|
-
/*
|
|
14
|
-
|
|
15
|
-
(currently 0). Revisit once a 2px radius token lands. */
|
|
13
|
+
/* The corner radius is meant to be 2px, but no 2px radius token exists yet,
|
|
14
|
+
so this stays on radius-small (currently 0). Revisit once one lands. */
|
|
16
15
|
--keyboard-key-border-radius: var(--dimension-radius-small);
|
|
17
16
|
--keyboard-key-border-width: var(--dimension-stroke-thickness-medium);
|
|
18
|
-
/* 4px inline padding
|
|
17
|
+
/* 4px inline padding. */
|
|
19
18
|
--keyboard-key-padding-inline: var(--dimension-050);
|
|
20
19
|
}
|
|
21
20
|
|
|
@@ -28,15 +27,14 @@
|
|
|
28
27
|
.ds.keyboard-key {
|
|
29
28
|
display: inline-block;
|
|
30
29
|
|
|
31
|
-
/*
|
|
32
|
-
"like an input", with a muted border and the surface's text colour.
|
|
30
|
+
/* A key-cap sits on a surface+1 fill, like an input, with a muted border and the surface's text colour.
|
|
33
31
|
|
|
34
32
|
The key establishes its own `.surface` (see KeyboardKey.tsx), so it IS the
|
|
35
33
|
next surface layer and paints ITSELF with that layer's background — exactly
|
|
36
34
|
like the Tile. These reads MUST be here on the class (not `:root`) so
|
|
37
35
|
`--surface-color-*` resolves against the key's own surface depth: nested in
|
|
38
|
-
the ambient surface the background steps to the next layer (
|
|
39
|
-
like inputs
|
|
36
|
+
the ambient surface the background steps to the next layer (surface+1,
|
|
37
|
+
like inputs), and on a `.contrasted` surface it inverts
|
|
40
38
|
for free. The fallbacks keep it sane when placed outside any surface. */
|
|
41
39
|
background-color: var(--surface-color-background, var(--color-background));
|
|
42
40
|
color: var(--surface-color-text, var(--color-text));
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Tabs Item styles (internal renderer)
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Each tab is text with `--dimension-200` (16px)
|
|
8
8
|
* horizontal padding, no gap to its neighbours. The tab shows a bottom border
|
|
9
9
|
* on hover (muted) and when active (highlighted), and a focus border on
|
|
10
10
|
* every side when keyboard-focused; an inert tab (no url) is muted with no
|