@canonical/react-ds-global 0.37.0 → 0.38.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/README.md +72 -0
- package/dist/esm/lib/_work_in_progress/Announcement/styles.css +51 -47
- package/dist/esm/lib/_work_in_progress/CategoriesSection/common/Category/styles.css +21 -17
- package/dist/esm/lib/_work_in_progress/CategoriesSection/styles.css +16 -12
- package/dist/esm/lib/_work_in_progress/ChatSection/styles.css +22 -18
- package/dist/esm/lib/_work_in_progress/DescriptionSection/styles.css +14 -10
- package/dist/esm/lib/_work_in_progress/IconSection/styles.css +18 -14
- package/dist/esm/lib/_work_in_progress/Label/styles.css +36 -32
- package/dist/esm/lib/_work_in_progress/Link/styles.css +32 -28
- package/dist/esm/lib/_work_in_progress/Rule/styles.css +21 -14
- package/dist/esm/lib/_work_in_progress/Section/styles.css +66 -62
- package/dist/esm/lib/_work_in_progress/SkipLink/styles.css +35 -32
- package/dist/esm/lib/_work_in_progress/TSection/styles.css +26 -22
- package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.js +4 -1
- package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.js.map +1 -1
- package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/styles.css +21 -17
- package/dist/esm/lib/_work_in_progress/grid/GridCard/GridCard.js +4 -1
- package/dist/esm/lib/_work_in_progress/grid/GridCard/GridCard.js.map +1 -1
- package/dist/esm/lib/_work_in_progress/grid/GridCard/styles.css +8 -4
- package/dist/esm/lib/_work_in_progress/grid/InnerGridDemo/styles.css +38 -33
- package/dist/esm/lib/_work_in_progress/grid/SettingsView/SettingsView.js +4 -1
- package/dist/esm/lib/_work_in_progress/grid/SettingsView/SettingsView.js.map +1 -1
- package/dist/esm/lib/_work_in_progress/grid/SettingsView/styles.css +23 -19
- package/dist/esm/lib/component/Accordion/common/Item/styles.css +305 -299
- package/dist/esm/lib/component/Accordion/styles.css +35 -31
- package/dist/esm/lib/component/Badge/hooks/useBadge.js +1 -1
- package/dist/esm/lib/component/Badge/hooks/useBadge.js.map +1 -1
- package/dist/esm/lib/component/Badge/styles.css +45 -41
- package/dist/esm/lib/component/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/esm/lib/component/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/esm/lib/component/Breadcrumbs/common/Item/styles.css +69 -65
- package/dist/esm/lib/component/Breadcrumbs/styles.css +30 -26
- package/dist/esm/lib/component/Button/styles.css +293 -260
- package/dist/esm/lib/component/Card/common/Content/styles.css +27 -23
- package/dist/esm/lib/component/Card/common/Footer/styles.css +30 -26
- package/dist/esm/lib/component/Card/common/Header/styles.css +25 -21
- package/dist/esm/lib/component/Card/common/Image/styles.css +8 -4
- package/dist/esm/lib/component/Card/styles.css +77 -73
- package/dist/esm/lib/component/Chip/Chip.js.map +1 -1
- package/dist/esm/lib/component/Chip/styles.css +105 -101
- package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js +29 -20
- package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js.map +1 -1
- package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js +25 -2
- package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js.map +1 -1
- package/dist/esm/lib/component/ContextualMenu/common/Item/styles.css +116 -106
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js +29 -9
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js.map +1 -1
- package/dist/esm/lib/component/ContextualMenu/styles.css +74 -72
- package/dist/esm/lib/component/Icon/styles.css +24 -20
- package/dist/esm/lib/component/InlineCode/styles.css +19 -15
- package/dist/esm/lib/component/KeyboardKey/styles.css +44 -40
- package/dist/esm/lib/component/Popover/Popover.js.map +1 -1
- package/dist/esm/lib/component/Popover/styles.css +59 -52
- package/dist/esm/lib/component/Tabs/common/Item/styles.css +80 -76
- package/dist/esm/lib/component/Tabs/styles.css +36 -32
- package/dist/esm/lib/component/Tile/common/Content/styles.css +28 -24
- package/dist/esm/lib/component/Tile/common/Header/styles.css +28 -24
- package/dist/esm/lib/component/Tile/styles.css +31 -27
- package/dist/esm/lib/component/Tooltip/styles.css +213 -208
- package/dist/esm/lib/group/Cards/styles.css +26 -22
- package/dist/esm/lib/group/KeyboardKeys/styles.css +14 -10
- package/dist/esm/lib/hooks/useContextualMenu/index.js +1 -0
- package/dist/esm/lib/hooks/useContextualMenu/index.js.map +1 -1
- package/dist/esm/lib/hooks/useContextualMenu/isMenuSeparator.js +11 -0
- package/dist/esm/lib/hooks/useContextualMenu/isMenuSeparator.js.map +1 -0
- package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js +54 -34
- package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js.map +1 -1
- package/dist/esm/lib/hooks/useDisclosure/useDisclosure.js.map +1 -1
- package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js +1 -1
- package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js.map +1 -1
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js +3 -0
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js.map +1 -1
- package/dist/esm/lib/index.css +79 -0
- package/dist/esm/lib/pattern/Modal/Context.js +10 -0
- package/dist/esm/lib/pattern/Modal/Context.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/Provider.js +103 -0
- package/dist/esm/lib/pattern/Modal/Provider.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Content/Content.js +15 -0
- package/dist/esm/lib/pattern/Modal/common/Content/Content.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Content/index.js +3 -0
- package/dist/esm/lib/pattern/Modal/common/Content/index.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Content/styles.css +37 -0
- package/dist/esm/lib/pattern/Modal/common/Content/types.js +2 -0
- package/dist/esm/lib/pattern/Modal/common/Content/types.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js +16 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/index.js +3 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/index.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/styles.css +57 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/types.js +2 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/types.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Header/Header.js +27 -0
- package/dist/esm/lib/pattern/Modal/common/Header/Header.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Header/index.js +3 -0
- package/dist/esm/lib/pattern/Modal/common/Header/index.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Header/styles.css +79 -0
- package/dist/esm/lib/pattern/Modal/common/Header/types.js +2 -0
- package/dist/esm/lib/pattern/Modal/common/Header/types.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/index.js +5 -0
- package/dist/esm/lib/pattern/Modal/common/index.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/hooks/useModalContext.js +11 -0
- package/dist/esm/lib/pattern/Modal/hooks/useModalContext.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/hooks/useModalState.js +15 -0
- package/dist/esm/lib/pattern/Modal/hooks/useModalState.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/index.js +4 -0
- package/dist/esm/lib/pattern/Modal/index.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/styles.css +119 -0
- package/dist/esm/lib/pattern/Modal/types.js +2 -0
- package/dist/esm/lib/pattern/Modal/types.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/withModal.js +102 -0
- package/dist/esm/lib/pattern/Modal/withModal.js.map +1 -0
- package/dist/esm/lib/pattern/Timeline/common/Content/styles.css +16 -12
- package/dist/esm/lib/pattern/Timeline/common/Event/styles.css +116 -112
- package/dist/esm/lib/pattern/Timeline/styles.css +16 -12
- package/dist/esm/lib/pattern/index.js +1 -0
- package/dist/esm/lib/pattern/index.js.map +1 -1
- package/dist/esm/lib/subcomponent/Spinner/styles.css +38 -34
- package/dist/types/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.d.ts.map +1 -1
- package/dist/types/lib/_work_in_progress/grid/GridCard/GridCard.d.ts.map +1 -1
- package/dist/types/lib/_work_in_progress/grid/SettingsView/SettingsView.d.ts.map +1 -1
- package/dist/types/lib/component/Badge/types.d.ts +1 -1
- package/dist/types/lib/component/Badge/types.d.ts.map +1 -1
- package/dist/types/lib/component/Breadcrumbs/types.d.ts +2 -2
- package/dist/types/lib/component/Breadcrumbs/types.d.ts.map +1 -1
- package/dist/types/lib/component/Chip/Chip.d.ts +2 -2
- package/dist/types/lib/component/Chip/Chip.d.ts.map +1 -1
- package/dist/types/lib/component/Chip/types.d.ts +10 -8
- package/dist/types/lib/component/Chip/types.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts +4 -4
- package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/common/Item/Item.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts +1 -1
- package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts +9 -7
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/types.d.ts +14 -6
- package/dist/types/lib/component/ContextualMenu/types.d.ts.map +1 -1
- package/dist/types/lib/component/Tabs/types.d.ts +2 -2
- package/dist/types/lib/component/Tabs/types.d.ts.map +1 -1
- package/dist/types/lib/hooks/useContextualMenu/index.d.ts +1 -0
- package/dist/types/lib/hooks/useContextualMenu/index.d.ts.map +1 -1
- package/dist/types/lib/hooks/useContextualMenu/isMenuSeparator.d.ts +13 -0
- package/dist/types/lib/hooks/useContextualMenu/isMenuSeparator.d.ts.map +1 -0
- package/dist/types/lib/hooks/useContextualMenu/types.d.ts +45 -15
- package/dist/types/lib/hooks/useContextualMenu/types.d.ts.map +1 -1
- package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts +5 -6
- package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts.map +1 -1
- package/dist/types/lib/hooks/useDisclosure/types.d.ts +7 -2
- package/dist/types/lib/hooks/useDisclosure/types.d.ts.map +1 -1
- package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts +1 -1
- package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts.map +1 -1
- package/dist/types/lib/hooks/useWindowFitment/types.d.ts +12 -3
- package/dist/types/lib/hooks/useWindowFitment/types.d.ts.map +1 -1
- package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts +1 -1
- package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts.map +1 -1
- package/dist/types/lib/pattern/Modal/Context.d.ts +10 -0
- package/dist/types/lib/pattern/Modal/Context.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/Provider.d.ts +63 -0
- package/dist/types/lib/pattern/Modal/Provider.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Content/Content.d.ts +17 -0
- package/dist/types/lib/pattern/Modal/common/Content/Content.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Content/index.d.ts +3 -0
- package/dist/types/lib/pattern/Modal/common/Content/index.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Content/types.d.ts +15 -0
- package/dist/types/lib/pattern/Modal/common/Content/types.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Footer/Footer.d.ts +18 -0
- package/dist/types/lib/pattern/Modal/common/Footer/Footer.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Footer/index.d.ts +3 -0
- package/dist/types/lib/pattern/Modal/common/Footer/index.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Footer/types.d.ts +16 -0
- package/dist/types/lib/pattern/Modal/common/Footer/types.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Header/Header.d.ts +24 -0
- package/dist/types/lib/pattern/Modal/common/Header/Header.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Header/index.d.ts +3 -0
- package/dist/types/lib/pattern/Modal/common/Header/index.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Header/types.d.ts +36 -0
- package/dist/types/lib/pattern/Modal/common/Header/types.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/index.d.ts +4 -0
- package/dist/types/lib/pattern/Modal/common/index.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/hooks/useModalContext.d.ts +4 -0
- package/dist/types/lib/pattern/Modal/hooks/useModalContext.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/hooks/useModalState.d.ts +10 -0
- package/dist/types/lib/pattern/Modal/hooks/useModalState.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/index.d.ts +4 -0
- package/dist/types/lib/pattern/Modal/index.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/types.d.ts +122 -0
- package/dist/types/lib/pattern/Modal/types.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/withModal.d.ts +74 -0
- package/dist/types/lib/pattern/Modal/withModal.d.ts.map +1 -0
- package/dist/types/lib/pattern/index.d.ts +1 -0
- package/dist/types/lib/pattern/index.d.ts.map +1 -1
- package/package.json +28 -18
|
@@ -1,294 +1,327 @@
|
|
|
1
|
-
/*
|
|
2
|
-
:root {
|
|
3
|
-
/* Channel fallbacks used when no importance modifier is applied. Primary is
|
|
4
|
-
the default hierarchy, so a bare `<button class="ds button">` reads as the
|
|
5
|
-
filled primary look: the primary foreground fills the background and the
|
|
6
|
-
label takes the on-fill contrast colour. */
|
|
7
|
-
--button-color-background: var(
|
|
8
|
-
--modifier-color-foreground-primary,
|
|
9
|
-
var(--color-foreground-primary)
|
|
10
|
-
);
|
|
11
|
-
--button-color-background-hover: var(--color-foreground-primary-hover);
|
|
12
|
-
--button-color-background-active: var(--color-foreground-primary-active);
|
|
13
|
-
--button-color-background-disabled: var(--color-foreground-primary-disabled);
|
|
14
|
-
/* Neutral text is the normal text colour. The filled default reads as
|
|
15
|
-
contrast on the fill because `.primary` (the default importance, applied by
|
|
16
|
-
the component) overrides text/icon to the on-fill contrast tokens; ghost
|
|
17
|
-
importances keep this normal colour, so they stay visible. */
|
|
18
|
-
--button-color-text: var(--color-text);
|
|
19
|
-
--button-color-border: var(--color-border-highlighted, var(--color-border));
|
|
1
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
20
2
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
),
|
|
44
|
-
var(--baseline-height)
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* ==========================================================================
|
|
49
|
-
Button Component Styles
|
|
50
|
-
========================================================================== */
|
|
51
|
-
|
|
52
|
-
/*
|
|
53
|
-
The button reads the modifier CHANNEL generically — it is not aware of any
|
|
54
|
-
particular importance/anticipation class or combination:
|
|
55
|
-
|
|
56
|
-
--modifier-surface which foreground fills the background (importance:
|
|
57
|
-
filled for primary, ghost for secondary/tertiary).
|
|
58
|
-
--modifier-outline 1 when a border shows, 0 when it does not (importance).
|
|
59
|
-
--modifier-color-* the colour itself (anticipation/emphasis): text, icon,
|
|
60
|
-
border. `.primary` overrides text/icon with the on-fill
|
|
61
|
-
contrast tokens.
|
|
62
|
-
|
|
63
|
-
Interaction states read the per-state surface/text/border channels supplied
|
|
64
|
-
by the states shim (`--modifier-surface-{hover,active,disabled}`,
|
|
65
|
-
`--modifier-color-text-disabled`, `--modifier-color-border-disabled`), which
|
|
66
|
-
resolve to the explicit state tokens and recolour per anticipation.
|
|
67
|
-
*/
|
|
3
|
+
@layer ds.components.global {
|
|
4
|
+
/* Component tokens — sourced from @canonical/design-tokens */
|
|
5
|
+
:root {
|
|
6
|
+
/* Channel fallbacks used when no importance modifier is applied. Primary is
|
|
7
|
+
the default hierarchy, so a bare `<button class="ds button">` reads as the
|
|
8
|
+
filled primary look: the primary foreground fills the background and the
|
|
9
|
+
label takes the on-fill contrast colour. */
|
|
10
|
+
--button-color-background: var(
|
|
11
|
+
--modifier-color-foreground-primary,
|
|
12
|
+
var(--color-foreground-primary)
|
|
13
|
+
);
|
|
14
|
+
--button-color-background-hover: var(--color-foreground-primary-hover);
|
|
15
|
+
--button-color-background-active: var(--color-foreground-primary-active);
|
|
16
|
+
--button-color-background-disabled: var(
|
|
17
|
+
--color-foreground-primary-disabled
|
|
18
|
+
);
|
|
19
|
+
/* Neutral text is the normal text colour. The filled default reads as
|
|
20
|
+
contrast on the fill because `.primary` (the default importance, applied by
|
|
21
|
+
the component) overrides text/icon to the on-fill contrast tokens; ghost
|
|
22
|
+
importances keep this normal colour, so they stay visible. */
|
|
23
|
+
--button-color-text: var(--color-text);
|
|
24
|
+
--button-color-border: var(--color-border-highlighted, var(--color-border));
|
|
68
25
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
26
|
+
/* Inline padding (Figma):
|
|
27
|
+
- end (right): always dimension-200 (16px) — the label always sits 16px
|
|
28
|
+
from the trailing edge.
|
|
29
|
+
- start (left): dimension-200 (16px) with no icon; dimension-100 (8px) when
|
|
30
|
+
an icon leads (the icon then sits closer to the edge), with a
|
|
31
|
+
dimension-100 (8px) gap between the icon and the label. */
|
|
32
|
+
--button-padding-inline-end: var(--dimension-200);
|
|
33
|
+
--button-padding-inline-start: var(--dimension-200);
|
|
34
|
+
--button-gap: var(--dimension-100);
|
|
35
|
+
--button-border-width: var(--dimension-stroke-thickness-medium);
|
|
36
|
+
/* Label weight — the button label is medium, not the `.p` body weight. */
|
|
37
|
+
--button-font-weight: var(--typography-weight-medium);
|
|
38
|
+
/* Label size — the button label is the text-secondary tier (14px), not the
|
|
39
|
+
`.p` text-primary tier (16px). The line-height snaps up to the baseline
|
|
40
|
+
grid exactly as the typography mapper does, so the box stays 32px tall
|
|
41
|
+
(24px line + 8px of baseline nudges) around 14px text. */
|
|
42
|
+
--button-font-size: var(--typography-text-secondary-font-size);
|
|
43
|
+
--button-line-height: round(
|
|
44
|
+
up,
|
|
45
|
+
calc(
|
|
46
|
+
var(--button-font-size) *
|
|
47
|
+
var(--typography-text-secondary-line-height)
|
|
48
|
+
),
|
|
49
|
+
var(--baseline-height)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
76
52
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
border is ALWAYS present at the nominal width (transparent when hidden), so
|
|
81
|
-
a bordered and a borderless importance share byte-identical geometry and
|
|
82
|
-
the density seat below subtracts one constant. (The previous
|
|
83
|
-
width-multiplied toggle left the primary 2px shorter than the secondary
|
|
84
|
-
and seated its label ~1px high.) */
|
|
85
|
-
border-color: color-mix(
|
|
86
|
-
in srgb,
|
|
87
|
-
var(--modifier-color-border, var(--button-color-border))
|
|
88
|
-
calc(var(--modifier-outline, 0) * 100%),
|
|
89
|
-
transparent
|
|
90
|
-
);
|
|
91
|
-
border-style: solid;
|
|
92
|
-
border-width: var(--button-border-width);
|
|
53
|
+
/* ==========================================================================
|
|
54
|
+
Button Component Styles
|
|
55
|
+
========================================================================== */
|
|
93
56
|
|
|
94
|
-
/*
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
don't apply — without the seat the label is flat/unaligned). --font-size /
|
|
98
|
-
--line-height are still exposed for any consumer that reads them. */
|
|
99
|
-
--font-size: var(--button-font-size);
|
|
100
|
-
--line-height: var(--button-line-height);
|
|
101
|
-
font-weight: var(--button-font-weight);
|
|
102
|
-
padding-inline: var(--button-padding-inline-start)
|
|
103
|
-
var(--button-padding-inline-end);
|
|
57
|
+
/*
|
|
58
|
+
The button reads the modifier CHANNEL generically — it is not aware of any
|
|
59
|
+
particular importance/anticipation class or combination:
|
|
104
60
|
|
|
105
|
-
|
|
106
|
-
|
|
61
|
+
--modifier-surface which foreground fills the background (importance:
|
|
62
|
+
filled for primary, ghost for secondary/tertiary).
|
|
63
|
+
--modifier-outline 1 when a border shows, 0 when it does not (importance).
|
|
64
|
+
--modifier-color-* the colour itself (anticipation/emphasis): text, icon,
|
|
65
|
+
border. `.primary` overrides text/icon with the on-fill
|
|
66
|
+
contrast tokens.
|
|
107
67
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
68
|
+
Interaction states read the per-state surface/text/border channels supplied
|
|
69
|
+
by the states shim (`--modifier-surface-{hover,active,disabled}`,
|
|
70
|
+
`--modifier-color-text-disabled`, `--modifier-color-border-disabled`), which
|
|
71
|
+
resolve to the explicit state tokens and recolour per anticipation.
|
|
72
|
+
*/
|
|
113
73
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
74
|
+
.ds.button {
|
|
75
|
+
position: relative;
|
|
76
|
+
display: inline-flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
gap: var(--button-gap);
|
|
80
|
+
cursor: pointer;
|
|
119
81
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
82
|
+
color: var(--modifier-color-text, var(--button-color-text));
|
|
83
|
+
background-color: var(--modifier-surface, var(--button-color-background));
|
|
84
|
+
/* The outline flag (0/1) toggles the border's COLOUR, not its width: the
|
|
85
|
+
border is ALWAYS present at the nominal width (transparent when hidden), so
|
|
86
|
+
a bordered and a borderless importance share byte-identical geometry and
|
|
87
|
+
the density seat below subtracts one constant. (The previous
|
|
88
|
+
width-multiplied toggle left the primary 2px shorter than the secondary
|
|
89
|
+
and seated its label ~1px high.) */
|
|
90
|
+
border-color: color-mix(
|
|
91
|
+
in srgb,
|
|
92
|
+
var(--modifier-color-border, var(--button-color-border))
|
|
93
|
+
calc(var(--modifier-outline, 0) * 100%),
|
|
94
|
+
transparent
|
|
126
95
|
);
|
|
127
|
-
|
|
96
|
+
border-style: solid;
|
|
97
|
+
border-width: var(--button-border-width);
|
|
128
98
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
99
|
+
/* Label typography tokens (text-secondary tier, 14px). The block placement that
|
|
100
|
+
lands the label on the baseline grid comes from the density seat at the end of
|
|
101
|
+
this file (the button no longer carries `.p`, so the engine's on-element nudges
|
|
102
|
+
don't apply — without the seat the label is flat/unaligned). --font-size /
|
|
103
|
+
--line-height are still exposed for any consumer that reads them. */
|
|
104
|
+
--font-size: var(--button-font-size);
|
|
105
|
+
--line-height: var(--button-line-height);
|
|
106
|
+
font-weight: var(--button-font-weight);
|
|
107
|
+
padding-inline: var(--button-padding-inline-start)
|
|
108
|
+
var(--button-padding-inline-end);
|
|
135
109
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
&:focus-visible {
|
|
139
|
-
outline: var(--focus-outline-width, 2px) solid
|
|
140
|
-
var(--modifier-color-focusRing, var(--color-focusRing, currentColor));
|
|
141
|
-
outline-offset: var(--focus-outline-offset, 2px);
|
|
142
|
-
}
|
|
110
|
+
text-align: center;
|
|
111
|
+
text-decoration: none;
|
|
143
112
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
the enabled border and recolours per anticipation. */
|
|
150
|
-
&:disabled {
|
|
151
|
-
cursor: not-allowed;
|
|
152
|
-
color: var(--modifier-color-text-disabled, var(--color-text-disabled));
|
|
153
|
-
background-color: var(
|
|
154
|
-
--modifier-surface-disabled,
|
|
155
|
-
var(--button-color-background-disabled)
|
|
156
|
-
);
|
|
157
|
-
border-color: var(
|
|
158
|
-
--modifier-color-border-disabled,
|
|
159
|
-
var(--color-border-highlighted-disabled)
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
113
|
+
/* Fast colour transition on state change (hover/active/disabled). */
|
|
114
|
+
transition:
|
|
115
|
+
background-color var(--motion-duration-fast) var(--motion-easing-standard),
|
|
116
|
+
color var(--motion-duration-fast) var(--motion-easing-standard),
|
|
117
|
+
border-color var(--motion-duration-fast) var(--motion-easing-standard);
|
|
163
118
|
|
|
164
|
-
/*
|
|
165
|
-
|
|
166
|
-
|
|
119
|
+
/* A leading icon tightens the start padding to dimension-100; the gap between
|
|
120
|
+
the icon and label is already dimension-100. */
|
|
121
|
+
&:has(> .icon) {
|
|
122
|
+
--button-padding-inline-start: var(--dimension-100);
|
|
123
|
+
}
|
|
167
124
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
125
|
+
/* State fallbacks resolve to the default (primary) surface states when no
|
|
126
|
+
importance modifier supplies `--modifier-surface-*`. */
|
|
127
|
+
&:hover:not(:disabled) {
|
|
128
|
+
background-color: var(
|
|
129
|
+
--modifier-surface-hover,
|
|
130
|
+
var(--button-color-background-hover)
|
|
131
|
+
);
|
|
132
|
+
}
|
|
175
133
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
.ds.button:disabled > .icon {
|
|
183
|
-
color: var(--modifier-color-icon-disabled, var(--color-icon-disabled));
|
|
184
|
-
}
|
|
134
|
+
&:active:not(:disabled) {
|
|
135
|
+
background-color: var(
|
|
136
|
+
--modifier-surface-active,
|
|
137
|
+
var(--button-color-background-active)
|
|
138
|
+
);
|
|
139
|
+
}
|
|
185
140
|
|
|
186
|
-
/*
|
|
187
|
-
|
|
188
|
-
|
|
141
|
+
/* Keyboard focus ring — driven by the modifier focus-ring channel so it
|
|
142
|
+
recolours per anticipation; falls back to the base focus ring token. */
|
|
143
|
+
&:focus-visible {
|
|
144
|
+
outline: var(--focus-outline-width, 2px) solid
|
|
145
|
+
var(--modifier-color-focus-ring, var(--color-focus-ring, currentColor));
|
|
146
|
+
outline-offset: var(--focus-outline-offset, 2px);
|
|
147
|
+
}
|
|
189
148
|
|
|
190
|
-
/*
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
149
|
+
/* Disabled — explicit disabled tokens (not the computed deltas): the surface,
|
|
150
|
+
text and border each resolve to their `-disabled` token. Primary supplies
|
|
151
|
+
the on-fill disabled text via `--modifier-color-text-disabled`; ghost
|
|
152
|
+
importances fall back to the plain disabled text colour. The border reads
|
|
153
|
+
the disabled border channel, so it stays on the same highlighted ramp as
|
|
154
|
+
the enabled border and recolours per anticipation. */
|
|
155
|
+
&:disabled {
|
|
156
|
+
cursor: not-allowed;
|
|
157
|
+
color: var(--modifier-color-text-disabled, var(--color-text-disabled));
|
|
158
|
+
background-color: var(
|
|
159
|
+
--modifier-surface-disabled,
|
|
160
|
+
var(--button-color-background-disabled)
|
|
161
|
+
);
|
|
162
|
+
border-color: var(
|
|
163
|
+
--modifier-color-border-disabled,
|
|
164
|
+
var(--color-border-highlighted-disabled)
|
|
165
|
+
);
|
|
166
|
+
}
|
|
204
167
|
}
|
|
205
168
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
169
|
+
/* ==========================================================================
|
|
170
|
+
Icon Slot
|
|
171
|
+
========================================================================== */
|
|
172
|
+
|
|
173
|
+
.ds.button > .icon {
|
|
209
174
|
display: inline-flex;
|
|
210
175
|
align-items: center;
|
|
176
|
+
align-self: center;
|
|
211
177
|
justify-content: center;
|
|
178
|
+
flex-shrink: 0;
|
|
179
|
+
width: var(--icon-size, 1em);
|
|
180
|
+
height: var(--icon-size, 1em);
|
|
181
|
+
|
|
182
|
+
/* The icon has its own colour channel (distinct from the label text): on a
|
|
183
|
+
filled primary it is the on-fill contrast icon, on ghost importances the
|
|
184
|
+
modifier icon colour. Icons drawn with `currentColor` follow this. */
|
|
185
|
+
color: var(--modifier-color-icon, var(--modifier-color-text, currentColor));
|
|
212
186
|
}
|
|
213
|
-
}
|
|
214
187
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
188
|
+
.ds.button:disabled > .icon {
|
|
189
|
+
color: var(--modifier-color-icon-disabled, var(--color-icon-disabled));
|
|
190
|
+
}
|
|
218
191
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
border-width: 0;
|
|
223
|
-
padding-inline: 0;
|
|
224
|
-
color: var(--color-text-link, currentColor);
|
|
225
|
-
text-decoration: underline;
|
|
226
|
-
text-underline-offset: var(--tmp-dimension-underline-offset-link, 0.075em);
|
|
192
|
+
/* ==========================================================================
|
|
193
|
+
Loading State
|
|
194
|
+
========================================================================== */
|
|
227
195
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
196
|
+
/* Loading replaces the label with a Spinner but keeps the button's width: the
|
|
197
|
+
icon and label stay in the DOM (hidden, so their box still reserves space)
|
|
198
|
+
and the Spinner is overlaid centred on top. A loading button is disabled (so
|
|
199
|
+
it can't be re-triggered), but it must not *read* as disabled — it is
|
|
200
|
+
working, not unavailable — so it keeps the enabled surface, text and border
|
|
201
|
+
colours, overriding the :disabled greying above. */
|
|
202
|
+
.ds.button.loading {
|
|
203
|
+
color: var(--modifier-color-text, var(--button-color-text));
|
|
204
|
+
background-color: var(--modifier-surface, var(--button-color-background));
|
|
205
|
+
border-color: var(--modifier-color-border, var(--button-color-border));
|
|
206
|
+
|
|
207
|
+
& > .icon,
|
|
208
|
+
& > .label {
|
|
209
|
+
visibility: hidden;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
& > .loading-spinner {
|
|
213
|
+
position: absolute;
|
|
214
|
+
inset: 0;
|
|
215
|
+
display: inline-flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
justify-content: center;
|
|
218
|
+
}
|
|
235
219
|
}
|
|
236
220
|
|
|
237
|
-
|
|
221
|
+
/* ==========================================================================
|
|
222
|
+
Link Variant
|
|
223
|
+
========================================================================== */
|
|
224
|
+
|
|
225
|
+
.ds.button.link {
|
|
238
226
|
background-color: transparent;
|
|
239
227
|
border-color: transparent;
|
|
228
|
+
border-width: 0;
|
|
229
|
+
padding-inline: 0;
|
|
230
|
+
color: var(--color-text-link, currentColor);
|
|
231
|
+
text-decoration: underline;
|
|
232
|
+
text-underline-offset: var(--tmp-dimension-underline-offset-link, 0.075em);
|
|
233
|
+
|
|
234
|
+
&:hover:not(:disabled) {
|
|
235
|
+
background-color: transparent;
|
|
236
|
+
border-color: transparent;
|
|
237
|
+
text-decoration-thickness: var(
|
|
238
|
+
--tmp-dimension-decoration-thickness-link,
|
|
239
|
+
1px
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
&:active:not(:disabled) {
|
|
244
|
+
background-color: transparent;
|
|
245
|
+
border-color: transparent;
|
|
246
|
+
}
|
|
240
247
|
}
|
|
241
|
-
}
|
|
242
248
|
|
|
243
|
-
/* ── Density seat (apps 32 / sites 36, dense 24 / 28) — intrinsic ────────────
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
249
|
+
/* ── Density seat (apps 32 / sites 36, dense 24 / 28) — intrinsic ────────────
|
|
250
|
+
* The button consumes the SHARED control seat from @canonical/styles
|
|
251
|
+
* (modifiers.density.css): the label's own line box (cell − 2 baselines) is the
|
|
252
|
+
* button interior, `--control-seat-before` puts its baseline on the density
|
|
253
|
+
* target, `--control-seat-after` closes the box to EXACTLY the density cell.
|
|
254
|
+
* The height is INTRINSIC — no block-size: border + pads + line-height add up
|
|
255
|
+
* to the cell, and both outer edges land on grid lines.
|
|
256
|
+
*
|
|
257
|
+
* This lives HERE (ds-global) and not in ds-global-form's density.css, because
|
|
258
|
+
* the Button is a ds-global component: an app that ships ds-global without the
|
|
259
|
+
* form package must still get a seated button. The seat vars come from the
|
|
260
|
+
* shared styles layer, so there is no form dependency.
|
|
261
|
+
*
|
|
262
|
+
* The seat subtracts the NOMINAL --button-border-width for BOTH importances —
|
|
263
|
+
* the border is constant width and transparent when not shown (the
|
|
264
|
+
* --modifier-outline pattern), so a bordered and a borderless button share one
|
|
265
|
+
* geometry; no per-importance branch.
|
|
266
|
+
*
|
|
267
|
+
* ORDER, NOT SPECIFICITY, arbitrates here. The seat selects the component root
|
|
268
|
+
* at the base rule's own specificity — `.ds.button`, (0,2,0) — and is the LAST
|
|
269
|
+
* rule in this sheet, so it beats `.ds.button { align-items: center }` above by
|
|
270
|
+
* source order. Inside one layer, order is the only tie-break left: every
|
|
271
|
+
* GLOBAL-TIER package writes its component sheets into ONE layer,
|
|
272
|
+
* `ds.components.global` (an application tier has its own, `ds.components.app`,
|
|
273
|
+
* which sorts above it). So a selector lengthened purely to out-specify this
|
|
274
|
+
* file's own earlier rule also out-specifies the other global-tier packages'
|
|
275
|
+
* legitimate (0,2,0) rules in that same layer — measured: with the seat at
|
|
276
|
+
* (0,3,0) the form package's `.ds.combobox-reset-button` lost `line-height`,
|
|
277
|
+
* `box-sizing`, `align-items`, `justify-content` and `padding-block-end` to it,
|
|
278
|
+
* and its glyph rose 1.5 to 3px by cell and left-aligned. See
|
|
279
|
+
* `cs:css.selectors.specificity` and `cs:css.layers.components` ("a component
|
|
280
|
+
* never escalates its selector to win against another component").
|
|
281
|
+
*
|
|
282
|
+
* Order is a tie-break, not a guarantee: which of two packages' sheets a
|
|
283
|
+
* bundler emits first is not fixed. So nothing in the global tier should
|
|
284
|
+
* redeclare the seat's properties on a `.ds.button` at all; the tier layers
|
|
285
|
+
* settle everything else.
|
|
286
|
+
*
|
|
287
|
+
* `:where()` keeps what the prefix MEANS while contributing nothing to
|
|
288
|
+
* specificity: the seat's inputs (`--control-seat-basis`, `--control-seat-line`,
|
|
289
|
+
* `--density-line-height-effective`) are declared only on a density or context
|
|
290
|
+
* scope, so outside one the seat has no numbers to work with — measured, an
|
|
291
|
+
* ungated seat left an unscoped button at `align-items: flex-start` with a
|
|
292
|
+
* `normal` line box and no block padding. */
|
|
293
|
+
:where(.comfortable, .dense, .app, .site, .docs) .ds.button {
|
|
294
|
+
/* Fold the button's own border into the shared basis HERE (a var() inside a
|
|
295
|
+
custom property substitutes at its declaring element, so the shared layer
|
|
296
|
+
cannot read this border). `1cap` in the basis resolves against the button's
|
|
297
|
+
own label font. */
|
|
298
|
+
/* Rounded to ¼px so the pad is exactly representable in the browser's 1/64px
|
|
299
|
+
layout units — the fractional 1cap term otherwise leaves ~1/60px residues
|
|
300
|
+
on the box height. */
|
|
301
|
+
--seat-before: round(
|
|
302
|
+
nearest,
|
|
303
|
+
max(
|
|
304
|
+
0px,
|
|
305
|
+
calc(var(--control-seat-basis) - var(--button-border-width, 0px))
|
|
306
|
+
),
|
|
307
|
+
0.25px
|
|
308
|
+
);
|
|
309
|
+
--seat-after: max(
|
|
310
|
+
0px,
|
|
311
|
+
calc(
|
|
312
|
+
var(--density-line-height-effective) -
|
|
313
|
+
var(--control-seat-line) -
|
|
314
|
+
var(--seat-before) -
|
|
315
|
+
2 *
|
|
316
|
+
var(--button-border-width, 0px)
|
|
317
|
+
)
|
|
318
|
+
);
|
|
287
319
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
320
|
+
box-sizing: border-box;
|
|
321
|
+
block-size: auto;
|
|
322
|
+
align-items: flex-start;
|
|
323
|
+
justify-content: flex-start;
|
|
324
|
+
line-height: var(--control-seat-line);
|
|
325
|
+
padding-block: var(--seat-before) var(--seat-after);
|
|
326
|
+
}
|
|
294
327
|
}
|