@ids-group-ltd/ids-design-system 0.11.2 → 0.11.3

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +119 -2
  2. package/components.md +27 -12
  3. package/design-system.md +135 -1
  4. package/docs/agent/INDEX.md +98 -0
  5. package/docs/agent/domain/ds-w3w.md +10 -0
  6. package/docs/agent/feedback/ds-alert.md +9 -0
  7. package/docs/agent/feedback/ds-avatar-group.md +7 -0
  8. package/docs/agent/feedback/ds-avatar.md +6 -0
  9. package/docs/agent/feedback/ds-badge.md +7 -0
  10. package/docs/agent/feedback/ds-banner.md +10 -0
  11. package/docs/agent/feedback/ds-empty-state.md +7 -0
  12. package/docs/agent/feedback/ds-progress.md +7 -0
  13. package/docs/agent/feedback/ds-skeleton.md +6 -0
  14. package/docs/agent/feedback/ds-spinner.md +6 -0
  15. package/docs/agent/feedback/ds-stat.md +7 -0
  16. package/docs/agent/feedback/ds-status-dot.md +6 -0
  17. package/docs/agent/feedback/ds-tag.md +8 -0
  18. package/docs/agent/feedback/ds-toast.md +12 -0
  19. package/docs/agent/forms/ds-autocomplete.md +9 -0
  20. package/docs/agent/forms/ds-button.md +14 -0
  21. package/docs/agent/forms/ds-checkbox.md +6 -0
  22. package/docs/agent/forms/ds-date-picker.md +7 -0
  23. package/docs/agent/forms/ds-dropzone.md +10 -0
  24. package/docs/agent/forms/ds-icon-button.md +10 -0
  25. package/docs/agent/forms/ds-input.md +22 -0
  26. package/docs/agent/forms/ds-multi-select.md +6 -0
  27. package/docs/agent/forms/ds-number-stepper.md +8 -0
  28. package/docs/agent/forms/ds-radio.md +6 -0
  29. package/docs/agent/forms/ds-search.md +10 -0
  30. package/docs/agent/forms/ds-select.md +7 -0
  31. package/docs/agent/forms/ds-switch.md +6 -0
  32. package/docs/agent/forms/ds-textarea.md +9 -0
  33. package/docs/agent/forms/the-picker-family-ds-select-ds-multi-select-ds-autocomplete.md +21 -0
  34. package/docs/agent/foundations/global-helper-classes.md +18 -0
  35. package/docs/agent/foundations/grid.md +35 -0
  36. package/docs/agent/foundations/tokens.md +47 -0
  37. package/docs/agent/navigation/ds-app-layout.md +10 -0
  38. package/docs/agent/navigation/ds-auth-layout.md +9 -0
  39. package/docs/agent/navigation/ds-breadcrumbs.md +7 -0
  40. package/docs/agent/navigation/ds-divider.md +9 -0
  41. package/docs/agent/navigation/ds-page-footer.md +7 -0
  42. package/docs/agent/navigation/ds-page-header.md +8 -0
  43. package/docs/agent/navigation/ds-pagination.md +7 -0
  44. package/docs/agent/navigation/ds-sidenav-group.md +8 -0
  45. package/docs/agent/navigation/ds-sidenav-item.md +9 -0
  46. package/docs/agent/navigation/ds-sidenav.md +9 -0
  47. package/docs/agent/navigation/ds-stepper.md +6 -0
  48. package/docs/agent/navigation/ds-tabs.md +9 -0
  49. package/docs/agent/navigation/ds-topbar.md +8 -0
  50. package/docs/agent/overlays/ds-bottom-sheet.md +9 -0
  51. package/docs/agent/overlays/ds-drawer.md +9 -0
  52. package/docs/agent/overlays/ds-menu.md +8 -0
  53. package/docs/agent/overlays/ds-modal-card.md +6 -0
  54. package/docs/agent/overlays/ds-modal.md +8 -0
  55. package/docs/agent/overlays/ds-popover.md +6 -0
  56. package/docs/agent/overlays/ds-tooltip.md +8 -0
  57. package/docs/agent/platform/breadcrumbs-service.md +30 -0
  58. package/docs/agent/platform/ds-config.md +60 -0
  59. package/docs/agent/platform/ds-icon-registry.md +23 -0
  60. package/docs/agent/platform/toast-service.md +19 -0
  61. package/docs/agent/surfaces/ds-accordion.md +8 -0
  62. package/docs/agent/surfaces/ds-card.md +10 -0
  63. package/docs/agent/tables/ds-table.md +15 -0
  64. package/fesm2022/ids-group-ltd-ids-design-system.mjs +262 -338
  65. package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
  66. package/migrations/0.11.3.json +152 -0
  67. package/package.json +1 -1
  68. package/styles/_dropdown-overlay.scss +25 -32
  69. package/styles/_ds-color.scss +31 -12
  70. package/styles/_tokens-charts.scss +2 -3
  71. package/styles/_tokens.scss +158 -321
  72. package/themes/README.md +32 -1
  73. package/themes/_base-palette.scss +35 -76
  74. package/themes/_semantic.scss +5 -2
  75. package/types/ids-group-ltd-ids-design-system.d.ts +115 -190
@@ -0,0 +1,152 @@
1
+ {
2
+ "version": "0.11.3",
3
+ "items": [
4
+ {
5
+ "id": "banner-icon-top-offset-token-removed",
6
+ "kind": "removed-api",
7
+ "old": "--banner-ic-mt",
8
+ "new": null,
9
+ "appliesWhen": "You set --banner-ic-mt anywhere. It is a global geometry token, not a --ds-* component hook, so an app that only overrides --ds-banner-* is unaffected.",
10
+ "pitfall": "Deleting the override is the whole fix, but only because the icon no longer needs nudging: it is now centred on the message block rather than aligned to the first line. If you had raised the value to line the icon up with a taller first line, that adjustment is now working against the new rule and will push the icon off centre.",
11
+ "searchHints": [
12
+ "banner-ic-mt"
13
+ ],
14
+ "surface": "style",
15
+ "detect": [
16
+ "--banner-ic-mt"
17
+ ],
18
+ "verify": "A ds-banner with two or more lines of body text shows its icon vertically centred on the text block, and no rule in your app references --banner-ic-mt.",
19
+ "restore": "There is no one-line restore. `align-self: flex-start` on the icon does not reproduce the old look: it drops the one border-width of nudge the token supplied on a banner (the toast never read it — its own 2px came from a margin, removed with the same change), and a consumer's `ds-banner .icon` is specificity (0,1,1) against the component's own (0,4,0), so it does not win at all. On a `compact` banner it is actively wrong, because that variant was already centred before this change. If you must have the old alignment, fork the component's stylesheet.",
20
+ "note": "The token was one border-width of optical bump, and it existed only to serve the first-line alignment rule. With the icon centred on the block there is nothing left for it to correct.",
21
+ "action": "Delete any --banner-ic-mt declaration. There is no replacement token."
22
+ },
23
+ {
24
+ "id": "toast-region-subclass-members-moved",
25
+ "kind": "behavior",
26
+ "old": "class MyToastRegion extends ToastRegionComponent",
27
+ "new": null,
28
+ "action": "Build after upgrading. Rename or mark `override` every member the compiler reports as colliding, and DELETE any `override startCountdown` - that member no longer exists, so the override is dead code the compiler will not complain about.",
29
+ "appliesWhen": "Only a class that extends ToastRegionComponent. Template users of `<ds-toast-region>` and callers of ToastService need nothing.",
30
+ "pitfall": "`startCountdown` was announced in 0.11.2 as a member the region had just GAINED, so an override written for that release is one release old and now overrides nothing: it compiles clean and silently never runs. And every one of the five new names is `private` or `protected`, which is no protection - a redeclared private fails with TS2415 exactly as a public collision does.",
31
+ "note": "ToastRegionComponent gained `arm`, `pauseAll`, `remaining`, `resumeAll` and `startedAt`, and lost `startCountdown`. A countdown is armed when a toast is promoted to visible, and re-armed from what is left when a hover or focus pause ends - the region owns the timing because only it knows when a toast became visible. None of the five is public API or a signal, and there is no public replacement for `startCountdown`.",
32
+ "searchHints": [
33
+ "extends ToastRegionComponent",
34
+ "ToastRegionComponent",
35
+ "startCountdown",
36
+ "override startCountdown",
37
+ "pauseAll",
38
+ "resumeAll",
39
+ "TS2415",
40
+ "TS4114"
41
+ ],
42
+ "surface": "typescript",
43
+ "detect": [
44
+ "extends ToastRegionComponent",
45
+ "override startCountdown"
46
+ ],
47
+ "verify": "The app builds with no TS4114 / TS2415 / TS2416 naming ToastRegionComponent, and no `override startCountdown` remains in your source.",
48
+ "restore": null
49
+ },
50
+ {
51
+ "id": "banner-dismissed-output-never-existed",
52
+ "kind": "output-rename",
53
+ "old": "ds-banner[dismissed]",
54
+ "new": "closed",
55
+ "action": "On every `<ds-banner>`, rename the binding `(dismissed)` to `(closed)`.",
56
+ "appliesWhen": "Only if you bound `(dismissed)` on a `<ds-banner>`. It was never an output of this component, so the handler has never run.",
57
+ "pitfall": "Nothing errors and nothing logs: an unknown event binding registers a DOM listener for an event no one dispatches, so `(dismissed)` looks wired and is inert. Only checking that the handler runs finds it.",
58
+ "note": "`ds-banner` emits `(closed)`. `(dismissed)` was published in the component catalogue and is not an output of the class.",
59
+ "searchHints": [
60
+ "(dismissed)",
61
+ "<ds-banner",
62
+ "(closed)"
63
+ ],
64
+ "surface": "template",
65
+ "verify": "Every `<ds-banner>` handler you expected to run does run — bind it and confirm the callback fires."
66
+ },
67
+ {
68
+ "id": "toast-dismissed-output-never-existed",
69
+ "kind": "output-rename",
70
+ "old": "ds-toast[dismissed]",
71
+ "new": "closed",
72
+ "action": "On every `<ds-toast>`, rename the binding `(dismissed)` to `(closed)`.",
73
+ "appliesWhen": "Only if you bound `(dismissed)` on a `<ds-toast>`. It was never an output of this component, so the handler has never run.",
74
+ "pitfall": "Nothing errors and nothing logs: an unknown event binding registers a DOM listener for an event no one dispatches, so `(dismissed)` looks wired and is inert. Only checking that the handler runs finds it.",
75
+ "note": "`ds-toast` emits `(closed)`. `(dismissed)` was published in the component catalogue and is not an output of the class.",
76
+ "searchHints": [
77
+ "(dismissed)",
78
+ "<ds-toast",
79
+ "(closed)"
80
+ ],
81
+ "surface": "template",
82
+ "verify": "Every `<ds-toast>` handler you expected to run does run — bind it and confirm the callback fires."
83
+ },
84
+ {
85
+ "id": "pagination-page-change-output-never-existed",
86
+ "kind": "output-rename",
87
+ "old": "ds-pagination[pageChange]",
88
+ "new": "currentPageChange",
89
+ "action": "On every `<ds-pagination>`, rename the binding `(pageChange)` to `(currentPageChange)`.",
90
+ "appliesWhen": "Only if you bound `(pageChange)` on a `<ds-pagination>`. It was never an output of this component, so the handler has never run.",
91
+ "pitfall": "Nothing errors and nothing logs: an unknown event binding registers a DOM listener for an event no one dispatches, so `(pageChange)` looks wired and is inert. Only checking that the handler runs finds it.",
92
+ "note": "`ds-pagination` emits `(currentPageChange)`. `(pageChange)` was published in the component catalogue and is not an output of the class.",
93
+ "searchHints": [
94
+ "(pageChange)",
95
+ "<ds-pagination",
96
+ "(currentPageChange)"
97
+ ],
98
+ "surface": "template",
99
+ "verify": "Every `<ds-pagination>` handler you expected to run does run — bind it and confirm the callback fires."
100
+ },
101
+ {
102
+ "id": "table-row-click-output-never-existed",
103
+ "kind": "output-rename",
104
+ "old": "ds-table[rowClick]",
105
+ "new": "rowClicked",
106
+ "action": "On every `<ds-table>`, rename the binding `(rowClick)` to `(rowClicked)`.",
107
+ "appliesWhen": "Only if you bound `(rowClick)` on a `<ds-table>`. It was never an output of this component, so the handler has never run.",
108
+ "pitfall": "Nothing errors and nothing logs: an unknown event binding registers a DOM listener for an event no one dispatches, so `(rowClick)` looks wired and is inert. Only checking that the handler runs finds it.",
109
+ "note": "`ds-table` emits `(rowClicked)`. `(rowClick)` was published in the component catalogue and is not an output of the class.",
110
+ "searchHints": [
111
+ "(rowClick)",
112
+ "<ds-table",
113
+ "(rowClicked)"
114
+ ],
115
+ "surface": "template",
116
+ "verify": "Every `<ds-table>` handler you expected to run does run — bind it and confirm the callback fires."
117
+ },
118
+ {
119
+ "id": "ds-color-mixin-rejects-unknown-family",
120
+ "kind": "behavior",
121
+ "old": "ds.color(",
122
+ "new": null,
123
+ "action": "Change every `@include ds.color(<name>)` to one of `secondary`, `tertiary`, `error`, `success` or `warning`, or delete the include if the zone was never painting.",
124
+ "appliesWhen": "Only a consumer whose own Sass calls the mixin. The `ds-color=\"…\"` attribute in a template runs no Sass and is unaffected.",
125
+ "pitfall": "This is a hard build failure, not a warning — the `@error` aborts the compile, so a wrong name that used to ship silently now stops the build. That is the point: the eleven pointers it emitted could never resolve, so the zone painted with `unset` and read as a theming problem.",
126
+ "note": "`ds.color($family)` validates its argument against the five families it supports. It previously accepted any name and emitted pointers at guaranteed-invalid values.",
127
+ "searchHints": [
128
+ "ds.color(",
129
+ "@include ds.color",
130
+ "styles/ds-color"
131
+ ],
132
+ "surface": "style",
133
+ "verify": "Your Sass compiles, and every `ds-color` zone shows its family's accent rather than falling back to the default.",
134
+ "restore": null,
135
+ "detect": [
136
+ "ds.color(",
137
+ "@include ds.color"
138
+ ]
139
+ }
140
+ ],
141
+ "informational": [
142
+ "The banner, toast and alert icon now centres on the message block instead of aligning to the first line of text. Nothing to change: it is a visual default, applied by the components themselves. One-line messages look identical either way, which covers most toasts; the difference grows with the text, and was 12px at two lines and 21px at three.",
143
+ "ToastService.promise() and any toast with an `action` changed their dismissal timing. A settled promise toast now counts its 4s/6s from when it becomes visible rather than from when the promise resolved, so one queued behind `maxVisible` is no longer removed before it is shown. A toast with an `action` no longer auto-dismisses at all and is always dismissible, because the region is last in tab order and the button was unreachable within the old five seconds. Hovering or focusing the region pauses every countdown. Nothing to change in consumer code; if you relied on an action toast disappearing on its own, dismiss it from the action handler.",
144
+ "Inside a `ds-color=\"error\"`, `=\"success\"` or `=\"warning\"` zone, anything that reads the scoped accent's strong colour now renders in that status colour instead of falling back to body text — selected list and tree rows, the active sidenav item and its rail, the active tab pill, avatar initials, the active tag, dropzone text and the toast's action label. Nothing to change: those three families simply never defined the role the zone asked for, and the pointer now asks for the name they do define. A zone whose accent looked plain before will now look coloured, which is the intended appearance.",
145
+ "ds-banner's close button gained aria-label=\"Dismiss\", which ds-toast and ds-alert already carried. NO ACTION.",
146
+ "A toast body now wraps an unbroken token instead of overflowing the pill. NO ACTION.",
147
+ "The toast region's hover/focus pause is derived from both sources rather than latched, so tabbing out of a region the pointer still covers does not resume, focus moving inside it is not a leave, and a toast that becomes visible while paused is banked rather than counted. A resumed toast always gets at least 600ms. NO ACTION.",
148
+ "ds-config and the card types moved inside the library. Every symbol still reaches the package root unchanged, and no import path of yours could have named the old location: there is one entry point and no subpath resolves into lib/. NO ACTION.",
149
+ "A disabled ds-accordion-item's chevron asked for a colour token this library does not define, so the declaration was invalid and the chevron inherited the surrounding colour while its label greyed correctly. It reads the disabled text colour now. NO ACTION."
150
+ ],
151
+ "deleteList": []
152
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ids-group-ltd/ids-design-system",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "IDS Group Angular design system: components, tokens, themes",
5
5
  "license": "MIT",
6
6
  "homepage": "https://ids-ds.proto.ids-group.co.uk/",
@@ -1,33 +1,23 @@
1
- // Dropdown panel styles — GLOBAL because the panel is portaled via CDK
2
- // Overlay outside the host component's DOM tree, so emulated encapsulation
3
- // (and any `:host ::ng-deep` selectors) cannot reach it. The component sets
4
- // `panelClass: 'ds-dropdown-panel'` on the overlay config; this partial
5
- // declares the matching rules so the portaled panel renders styled.
1
+ // GLOBAL because the panel is portaled via CDK Overlay outside the host
2
+ // component's DOM tree, so emulated encapsulation (and any `:host ::ng-deep`
3
+ // selector) cannot reach it. The component sets `panelClass: 'ds-dropdown-panel'`
4
+ // on the overlay config; this partial declares the matching rules.
6
5
 
7
6
  @use 'text-clip' as text-clip;
8
7
  @use 'visually-hidden' as visually-hidden;
9
8
 
10
9
  .ds-dropdown-panel {
11
- /* The selected row used to paint straight from the theme roles, so a brand that
12
- wanted a different selected treatment had to RETARGET --primary-* inside this
13
- panel — and then track which other content in it read the same role. Named
14
- hooks instead; the defaults are those roles, so nothing moves and a retuned
15
- palette still flows through. Panel-level, not per-component: one partial
16
- paints the rows for select, autocomplete and multi-select alike. */
10
+ /* Every --_* below resolves through a public --ds-* hook and falls back to a
11
+ semantic role or the panel radius role, so an untouched theme is unchanged.
12
+ Panel-level, not per-component: this one partial paints the rows for select,
13
+ autocomplete and multi-select alike. */
17
14
  --_option-selected-bg-color: var(--ds-option-selected-bg-color, var(--primary-subtitle));
18
15
  --_option-selected-label-color: var(--ds-option-selected-label-color, var(--primary-strong));
19
16
  --_option-selected-bg-color-hover: var(--ds-option-selected-bg-color-hover, var(--primary-muted));
20
17
  --_option-check-color: var(--ds-option-check-color, var(--primary));
21
18
 
22
- /* Panel-level for the same reason as the option hooks above: retuning ONE
23
- picker's corner is not a thing a design system should encourage, but moving
24
- every panel — modal, popover, date picker — to reach the dropdowns is too
25
- blunt. This is the middle lever, and `--ds-radius-panel` stays its default so
26
- an untouched theme is unchanged. */
27
19
  --_dropdown-panel-radius: var(--ds-dropdown-panel-radius, var(--ds-radius-panel));
28
20
 
29
- /* Only bite in `content` width mode, where the pane is auto-sized: in `fill` the
30
- component pins the pane to the trigger and there is nothing left to bound. */
31
21
  --_option-gap: var(--ds-option-gap, var(--space-2));
32
22
  --_option-padding: var(--ds-option-padding, var(--space-2) var(--space-2-5));
33
23
  --_option-radius: var(--ds-option-radius, var(--ds-radius-inner));
@@ -36,6 +26,10 @@
36
26
 
37
27
  --_dropdown-panel-bg-color: var(--ds-dropdown-panel-bg-color, var(--surface-overlay));
38
28
  --_dropdown-panel-maxh: var(--ds-dropdown-panel-maxh, 320px);
29
+
30
+ /* minw/maxw only bite in `content` width mode, where the pane is auto-sized: in
31
+ `fill` the component pins the pane to the trigger width and there is nothing
32
+ left to bound. */
39
33
  --_dropdown-panel-minw: var(--ds-dropdown-panel-minw, 0);
40
34
  --_dropdown-panel-maxw: var(--ds-dropdown-panel-maxw, none);
41
35
 
@@ -52,9 +46,9 @@
52
46
  max-width: var(--_dropdown-panel-maxw);
53
47
  max-height: var(--_dropdown-panel-maxh);
54
48
 
55
- // The panel clips and the LIST scrolls, so a filter row or a select-all row
56
- // stays put while the options move under it. A panel that scrolled itself
57
- // would carry those rows out of view.
49
+ // The panel clips and the LIST scrolls, so a filter or select-all row stays
50
+ // put while the options move under it — a panel that scrolled itself would
51
+ // carry those rows out of view.
58
52
  display: flex;
59
53
  flex-direction: column;
60
54
  overflow: hidden;
@@ -62,6 +56,8 @@
62
56
  }
63
57
 
64
58
  .dropdown-list {
59
+ // A cap of its own, separate from the panel's: the difference between the two
60
+ // is what the panel's non-scrolling rows (filter, select-all) can occupy.
65
61
  max-height: var(--picker-maxh);
66
62
  list-style: none;
67
63
  margin: 0;
@@ -91,7 +87,6 @@
91
87
  text-transform: uppercase;
92
88
  letter-spacing: var(--letter-spacing-wide);
93
89
 
94
- // First group sits flush against the panel padding — no extra top space.
95
90
  &.is-first {
96
91
  padding-top: var(--space-1);
97
92
  }
@@ -150,23 +145,22 @@
150
145
  flex: 0 0 auto;
151
146
  }
152
147
 
153
- // `:not(.is-selected)` is load-bearing: this branch outranks `.is-selected`
154
- // on specificity, so without it a hovered (or keyboard-active) selected row
155
- // repaints to the neutral surface while KEEPING the selected label colour —
156
- // unreadable as soon as a brand gives the selected row a dark fill.
157
148
  &:disabled {
158
149
  color: var(--text-disabled);
159
150
  cursor: not-allowed;
160
151
  }
161
152
 
153
+ // `:not(.is-selected)` is load-bearing: this branch outranks `.is-selected`
154
+ // on specificity, so without it a hovered (or keyboard-active) selected row
155
+ // repaints to the neutral surface while KEEPING the selected label colour —
156
+ // unreadable as soon as a brand gives the selected row a dark fill.
162
157
  &:hover:not(.is-disabled, .is-selected, :disabled),
163
158
  &.is-active:not(.is-disabled, .is-selected, :disabled) {
164
159
  background: var(--_option-bg-color-active);
165
160
  }
166
161
 
167
- // A tap on a phone has no hover, so a pressed state is the only feedback that the
168
- // row was hit. One rule here covers select, autocomplete and multi-select, which
169
- // all render their options through this partial.
162
+ // A tap on a phone has no hover, so the pressed state is the only feedback
163
+ // that the row was hit.
170
164
  &:active:not(.is-disabled, :disabled) {
171
165
  background: var(--surface-muted);
172
166
  }
@@ -187,9 +181,8 @@
187
181
  background: var(--_option-selected-bg-color-hover);
188
182
  }
189
183
 
190
- // Selected rows keep the brand family when pressed, for the same reason
191
- // the hover above exists: falling back to the neutral pressed fill would
192
- // strand the selected label colour on it.
184
+ // Same reason as the hover above: falling back to the neutral pressed fill
185
+ // would strand the selected label colour on it.
193
186
  &:active:not(.is-disabled) {
194
187
  background: var(--_option-selected-bg-color);
195
188
  }
@@ -1,3 +1,7 @@
1
+ @use 'sass:list';
2
+
3
+ $families: secondary, tertiary, error, success, warning;
4
+
1
5
  // Scoped accent recolour. A `ds-color="<family>"` attribute — on a zone
2
6
  // container, on a component host, or applied via the ds.color() mixin in
3
7
  // consumer config — flips the --accent-* pointer family to another brand/status
@@ -7,28 +11,43 @@
7
11
  // per instance. With no attribute, --accent-* stays the primary family (see
8
12
  // themes/_semantic.scss), so the default theme is unchanged.
9
13
 
14
+ // Each pointer ends in a fallback, because a role a family does not define is not a wrong
15
+ // colour: it is a GUARANTEED-INVALID value, so every declaration reading the pointer becomes
16
+ // invalid at computed-value time and resets to `unset` — a label rendered as body text, a fill
17
+ // rendered transparent, and nothing in the console either way. Where the fallback leads differs
18
+ // by pointer and is deliberate: -hover, -pressed and -strong fall back to the family's own base
19
+ // colour, the tint pointers to the family's -muted, and -on and the two focus pointers to the
20
+ // theme-wide role, since no family-shaped answer exists for them.
10
21
  @mixin family-vars($family) {
11
22
  --accent: var(--#{$family});
12
- --accent-hover: var(--#{$family}-hover);
13
- --accent-pressed: var(--#{$family}-pressed);
14
- --accent-strong: var(--#{$family}-strong);
15
- --accent-subtitle: var(--#{$family}-subtitle);
16
- --accent-muted: var(--#{$family}-muted);
17
- --accent-muted-strong: var(--#{$family}-muted-strong);
18
- --accent-on: var(--#{$family}-on);
19
- --accent-focus-ring: var(--focus-ring-#{$family});
20
- --accent-focus-field: var(--focus-field-#{$family});
21
- --accent-surface-tint: var(--#{$family}-subtitle);
23
+ --accent-hover: var(--#{$family}-hover, var(--#{$family}));
24
+ --accent-pressed: var(--#{$family}-pressed, var(--#{$family}));
25
+ --accent-strong: var(--#{$family}-strong, var(--#{$family}-text, var(--#{$family})));
26
+ --accent-subtitle: var(--#{$family}-subtitle, var(--#{$family}-muted));
27
+ --accent-muted: var(--#{$family}-muted, var(--surface-muted));
28
+ --accent-muted-strong: var(--#{$family}-muted-strong, var(--#{$family}-muted));
29
+ --accent-on: var(--#{$family}-on, var(--text-on-primary));
30
+ --accent-focus-ring: var(--focus-ring-#{$family}, var(--focus-ring));
31
+ --accent-focus-field: var(--focus-field-#{$family}, var(--focus-field));
32
+ --accent-surface-tint: var(--#{$family}-subtitle, var(--#{$family}-muted));
22
33
  }
23
34
 
24
35
  /// Recolour the DS accent for a type or scope from consumer SCSS, e.g.
25
36
  /// `ds-switch { @include ds.color(secondary); }`.
37
+ ///
38
+ /// A name outside $families is refused rather than emitted. Without this the mixin accepts any
39
+ /// string and writes `--accent: var(--<whatever>)`, which is guaranteed-invalid — so every rule
40
+ /// reading the accent resets to `unset` and the subtree renders as body text, with nothing in the
41
+ /// console. That is the failure `check-color-families.mjs` exists to prevent, and it is the one
42
+ /// form of it no CSS-side check can see: a consumer's `@include` never reaches our compiled output.
26
43
  @mixin color($family) {
44
+ @if not list.index($families, $family) {
45
+ @error 'ds.color(): unknown family "#{$family}". Available: #{$families}.';
46
+ }
47
+
27
48
  @include family-vars($family);
28
49
  }
29
50
 
30
- $families: secondary, tertiary, error, success, warning;
31
-
32
51
  @each $family in $families {
33
52
  [ds-color='#{$family}'] {
34
53
  @include family-vars($family);
@@ -1,6 +1,5 @@
1
- /* ============================================================
2
- Boilerplate — Chart / dataviz tokens
3
- ------------------------------------------------------------
1
+ /* Chart and dataviz tokens.
2
+
4
3
  Categorical: 8 hues, ordered by perceptual distance not
5
4
  ramp position. First six are AA against both light and
6
5
  dark surface-default; the last two are reserved for