@oods/component-styles 0.3.3 → 0.4.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 CHANGED
@@ -28,4 +28,4 @@ Use matching versions of the OODS packages. These packages are separate from the
28
28
 
29
29
  ## License
30
30
 
31
- Apache License 2.0. See [LICENSE](https://cdn.jsdelivr.net/npm/@oods/component-styles@0.3.3/LICENSE) and [NOTICE](https://cdn.jsdelivr.net/npm/@oods/component-styles@0.3.3/NOTICE). Generated output belongs to its user; installed package dependencies retain their own licenses.
31
+ Apache License 2.0. See [LICENSE](https://cdn.jsdelivr.net/npm/@oods/component-styles@0.4.0/LICENSE) and [NOTICE](https://cdn.jsdelivr.net/npm/@oods/component-styles@0.4.0/NOTICE). Generated output belongs to its user; installed package dependencies retain their own licenses.
@@ -112,7 +112,10 @@ var COMPONENT_STYLE_IDS = [
112
112
  "VizShapeControls",
113
113
  "VizShapeLegend",
114
114
  "VizSizeControls",
115
- "VizSizeSummary"
115
+ "VizSizeSummary",
116
+ // s222-m02 (#2502 ruling 11): styled in components-overlay.css, which components.css imports.
117
+ "Dialog",
118
+ "Switch"
116
119
  ];
117
120
  var SUPPORTED_COMPONENT_THEME_CELLS = Object.freeze(brands.flatMap((brand) => ["light", "dark", "hc"].map((theme) => Object.freeze({ brand, theme }))));
118
121
  var COMPONENT_DATA_ATTRIBUTE = "data-oods-component";
@@ -0,0 +1,270 @@
1
+ /* s222-m02 (#2502 ruling 11): Switch and Dialog. components.css imports this sheet ahead of its own rules and the HTML
2
+ * renderer inlines it in the same place, so the three renderers paint one markup from the same rules. Both controls are
3
+ * buttons inside a component, so the shared focus rule in components.css paints their focus; nothing here does. */
4
+
5
+ /* Switch: a button with role switch beside its label. The track is 36x20 at md and 32x18 at sm, the thumb 16 and 14,
6
+ * held 2px inside the track's edge (its hairline border and a hairline of padding). */
7
+ :where(.oods-switch, [data-oods-component='Switch']) {
8
+ --oods-switch-track-inline: var(--ref-space-ramp-900);
9
+ --oods-switch-track-block: var(--ref-space-ramp-500);
10
+ --oods-switch-thumb-size: var(--ref-space-ramp-400);
11
+ --oods-switch-travel: var(--ref-space-ramp-400);
12
+ }
13
+
14
+ :where(.oods-switch, [data-oods-component='Switch'])[data-size='sm'] {
15
+ --oods-switch-track-inline: var(--ref-space-ramp-800);
16
+ --oods-switch-track-block: calc(var(--ref-space-ramp-500) - var(--ref-space-ramp-050));
17
+ --oods-switch-thumb-size: calc(var(--ref-space-ramp-400) - var(--ref-space-ramp-050));
18
+ --oods-switch-travel: calc(var(--ref-space-ramp-400) - var(--ref-space-ramp-050));
19
+ }
20
+
21
+ /* The off thumb is the raised surface; dark's raised surface is darker than its off track, so there it is the muted
22
+ * text colour. Each theme scope sets it, so a panel themed inside another reads its own. */
23
+ :where([data-theme]) { --oods-switch-thumb-off: var(--sys-surface-raised); }
24
+ :where([data-theme='dark']) { --oods-switch-thumb-off: var(--sys-text-muted); }
25
+
26
+ .oods-switch__row {
27
+ display: flex;
28
+ align-items: center;
29
+ gap: var(--sys-control-gap);
30
+ }
31
+
32
+ .oods-switch__control {
33
+ display: inline-flex;
34
+ flex: none;
35
+ align-items: center;
36
+ box-sizing: border-box;
37
+ inline-size: var(--oods-switch-track-inline);
38
+ block-size: var(--oods-switch-track-block);
39
+ margin: 0;
40
+ padding: 0 var(--ref-border-width-hairline);
41
+ border: 1px solid var(--sys-border-interactive);
42
+ border-radius: var(--sys-radius-pill);
43
+ background: var(--sys-surface-interactive-secondary-hover);
44
+ color: inherit;
45
+ cursor: pointer;
46
+ }
47
+
48
+ .oods-switch__thumb {
49
+ display: block;
50
+ inline-size: var(--oods-switch-thumb-size);
51
+ block-size: var(--oods-switch-thumb-size);
52
+ border-radius: var(--sys-radius-pill);
53
+ background: var(--oods-switch-thumb-off, var(--sys-surface-raised));
54
+ transition: transform var(--oods-motion-duration-fast) var(--oods-motion-easing-standard);
55
+ }
56
+
57
+ /* On: the primary fill, and a thumb in the colour of text on that fill, so it reads in every brand and theme. */
58
+ .oods-switch__control[aria-checked='true'] {
59
+ border-color: var(--sys-surface-interactive-primary-default);
60
+ background: var(--sys-surface-interactive-primary-default);
61
+ }
62
+
63
+ .oods-switch__control[aria-checked='true'] > .oods-switch__thumb {
64
+ background: var(--sys-text-on-interactive);
65
+ transform: translateX(var(--oods-switch-travel));
66
+ }
67
+
68
+ .oods-switch__control[aria-invalid='true'] { border-color: var(--sys-status-critical-icon); }
69
+
70
+ .oods-switch__control:disabled {
71
+ border-color: var(--sys-border-subtle);
72
+ background: var(--sys-surface-disabled);
73
+ cursor: not-allowed;
74
+ }
75
+
76
+ .oods-switch__control:disabled > .oods-switch__thumb { background: var(--sys-text-disabled); }
77
+
78
+ .oods-switch__control:disabled[aria-checked='true'] {
79
+ border-color: var(--sys-text-disabled);
80
+ background: var(--sys-text-disabled);
81
+ }
82
+
83
+ .oods-switch__control:disabled[aria-checked='true'] > .oods-switch__thumb { background: var(--sys-surface-disabled); }
84
+
85
+ .oods-switch__label { cursor: pointer; }
86
+ .oods-switch:has(.oods-switch__control:disabled) .oods-switch__label { color: var(--sys-text-disabled); cursor: not-allowed; }
87
+
88
+ /* Help and error text line up with the label, past the track. */
89
+ .oods-switch > :is(.oods-field-help, .oods-field-error) {
90
+ padding-inline-start: calc(var(--oods-switch-track-inline) + var(--sys-control-gap));
91
+ }
92
+
93
+ @media (prefers-reduced-motion: reduce) {
94
+ .oods-switch__thumb { transition: none; }
95
+ }
96
+
97
+ /* s222-m02 (#2502 ruling 6): in high contrast the off track is Canvas with a 1px CanvasText border and a CanvasText
98
+ * thumb; the on track is Highlight with a HighlightText thumb. */
99
+ [data-theme='hc'] .oods-switch__control:not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
100
+ forced-color-adjust: none;
101
+ border-color: CanvasText;
102
+ background: Canvas;
103
+ }
104
+
105
+ [data-theme='hc'] .oods-switch__control[aria-checked='true']:not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
106
+ border-color: Highlight;
107
+ background: Highlight;
108
+ }
109
+
110
+ [data-theme='hc'] .oods-switch__control:disabled:not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
111
+ border-color: GrayText;
112
+ background: Canvas;
113
+ }
114
+
115
+ [data-theme='hc'] .oods-switch__thumb:not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
116
+ forced-color-adjust: none;
117
+ background: CanvasText;
118
+ }
119
+
120
+ [data-theme='hc'] .oods-switch__control[aria-checked='true'] > .oods-switch__thumb:not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
121
+ background: HighlightText;
122
+ }
123
+
124
+ [data-theme='hc'] .oods-switch__control:disabled > .oods-switch__thumb:not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
125
+ background: GrayText;
126
+ }
127
+
128
+ @media (forced-colors: active) {
129
+ .oods-switch__control,
130
+ .oods-switch__thumb { forced-color-adjust: none; }
131
+ .oods-switch__control { border-color: CanvasText; background: Canvas; }
132
+ .oods-switch__control[aria-checked='true'] { border-color: Highlight; background: Highlight; }
133
+ .oods-switch__control:disabled,
134
+ .oods-switch__control:disabled[aria-checked='true'] { border-color: GrayText; background: Canvas; }
135
+ .oods-switch__thumb { background: CanvasText; }
136
+ .oods-switch__control[aria-checked='true'] > .oods-switch__thumb { background: HighlightText; }
137
+ .oods-switch__control:disabled > .oods-switch__thumb,
138
+ .oods-switch__control:disabled[aria-checked='true'] > .oods-switch__thumb { background: GrayText; }
139
+ }
140
+
141
+ /* Dialog: a native dialog on the raised surface with the card radius, a 1px border and the overlay drop (a ring in dark,
142
+ * where the overlay shadow parts become one), 24px padding and 16px between its header, body and footer; the size sets
143
+ * the largest inline size (sm 400px, md 512px, lg 640px). Shown in place (open, not modal) it sits in the flow, as the
144
+ * gallery and a static page show it; opened modally it is centred over the backdrop at the overlay opacity. */
145
+ :where(.oods-dialog, [data-oods-component='Dialog']) {
146
+ --oods-dialog-max-inline-size: 32rem;
147
+ position: relative;
148
+ inset: auto;
149
+ box-sizing: border-box;
150
+ inline-size: min(100%, var(--oods-dialog-max-inline-size));
151
+ max-inline-size: 100%;
152
+ margin: 0;
153
+ padding: var(--sys-card-padding);
154
+ border: 1px solid var(--sys-border-subtle);
155
+ border-radius: var(--sys-radius-card);
156
+ background: var(--sys-surface-raised);
157
+ color: var(--sys-text-primary);
158
+ box-shadow: var(--cmp-shadow-overlay-offset-x) var(--cmp-shadow-overlay-offset-y) var(--cmp-shadow-overlay-blur) var(--cmp-shadow-overlay-spread) var(--cmp-shadow-overlay-color);
159
+ font-size: var(--sys-text-scale-body-sm-font-size);
160
+ line-height: var(--sys-text-scale-body-sm-line-height);
161
+ }
162
+
163
+ :where(.oods-dialog, [data-oods-component='Dialog'])[data-size='sm'] { --oods-dialog-max-inline-size: 25rem; }
164
+ :where(.oods-dialog, [data-oods-component='Dialog'])[data-size='lg'] { --oods-dialog-max-inline-size: 40rem; }
165
+
166
+ /* Only an open dialog is laid out; a closed one keeps the browser's display: none. */
167
+ :where(.oods-dialog, [data-oods-component='Dialog'])[open] {
168
+ display: grid;
169
+ gap: var(--sys-inset-md);
170
+ }
171
+
172
+ :where(.oods-dialog, [data-oods-component='Dialog']):modal {
173
+ position: fixed;
174
+ inset: 0;
175
+ inline-size: min(100% - 2 * var(--sys-inset-md), var(--oods-dialog-max-inline-size));
176
+ max-block-size: calc(100% - 2 * var(--sys-inset-md));
177
+ margin: auto;
178
+ overflow: auto;
179
+ }
180
+
181
+ :where(.oods-dialog, [data-oods-component='Dialog'])::backdrop {
182
+ background: var(--sys-surface-backdrop, CanvasText);
183
+ opacity: var(--oods-overlay-backdrop-opacity, 0.5);
184
+ }
185
+
186
+ .oods-dialog__header {
187
+ display: flex;
188
+ align-items: flex-start;
189
+ justify-content: space-between;
190
+ gap: var(--sys-inset-md);
191
+ }
192
+
193
+ .oods-dialog__heading {
194
+ display: grid;
195
+ flex: 1 1 auto;
196
+ gap: var(--sys-control-gap-compact);
197
+ min-inline-size: 0;
198
+ }
199
+
200
+ /* The title is the heading-md role (18/24 600); the description is muted body-sm (14/20). */
201
+ .oods-dialog__title {
202
+ margin: 0;
203
+ color: var(--sys-text-primary);
204
+ font-size: var(--sys-text-scale-heading-md-font-size);
205
+ font-weight: var(--sys-text-scale-heading-md-font-weight);
206
+ line-height: var(--sys-text-scale-heading-md-line-height);
207
+ letter-spacing: var(--sys-text-scale-heading-md-letter-spacing);
208
+ }
209
+
210
+ .oods-dialog__description {
211
+ margin: 0;
212
+ color: var(--sys-text-muted);
213
+ }
214
+
215
+ .oods-dialog__body { min-inline-size: 0; }
216
+ .oods-dialog__body > :first-child { margin-block-start: 0; }
217
+ .oods-dialog__body > :last-child { margin-block-end: 0; }
218
+
219
+ .oods-dialog__footer {
220
+ display: flex;
221
+ flex-wrap: wrap;
222
+ align-items: center;
223
+ justify-content: flex-end;
224
+ gap: var(--sys-control-gap);
225
+ }
226
+
227
+ /* The close control is a ghost icon button, square at the small control height and centred on the title's line. */
228
+ .oods-dialog__close {
229
+ display: inline-flex;
230
+ flex: none;
231
+ align-items: center;
232
+ justify-content: center;
233
+ inline-size: var(--sys-control-height-sm);
234
+ block-size: var(--sys-control-height-sm);
235
+ margin-block-start: calc(-1 * var(--ref-space-ramp-050));
236
+ margin-inline-end: calc(-1 * var(--sys-control-gap-compact));
237
+ padding: 0;
238
+ border: 1px solid transparent;
239
+ border-radius: var(--sys-radius-control);
240
+ background: transparent;
241
+ color: var(--sys-text-secondary);
242
+ font: inherit;
243
+ cursor: pointer;
244
+ }
245
+
246
+ .oods-dialog__close:hover {
247
+ background: var(--sys-surface-interactive-secondary-default);
248
+ color: var(--sys-text-primary);
249
+ }
250
+
251
+ .oods-dialog__close > svg {
252
+ display: block;
253
+ inline-size: var(--sys-control-icon-size);
254
+ block-size: var(--sys-control-icon-size);
255
+ }
256
+
257
+ /* s222-m02 (#2502 ruling 6): in high contrast the dialog is Canvas with a CanvasText border and no drop, and its close
258
+ * button is Canvas on CanvasText with a 1px CanvasText border, like every non-primary action. */
259
+ [data-theme='hc'] :where(.oods-dialog, [data-oods-component='Dialog']):not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
260
+ border-color: CanvasText;
261
+ background: Canvas;
262
+ color: CanvasText;
263
+ box-shadow: none;
264
+ }
265
+
266
+ [data-theme='hc'] .oods-dialog__close:not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
267
+ border-color: CanvasText;
268
+ background: Canvas;
269
+ color: CanvasText;
270
+ }
@@ -8,34 +8,35 @@
8
8
  display: inline-flex;
9
9
  align-items: center;
10
10
  gap: var(--cmp-badge-gap, 0.25rem);
11
- min-block-size: var(--cmp-badge-height, 1.5rem);
11
+ min-block-size: var(--cmp-badge-height, 1.25rem);
12
12
  box-sizing: border-box;
13
13
  padding: var(--cmp-badge-padding-block, 0.125rem) var(--cmp-badge-padding-inline, 0.5rem);
14
- border: 1px solid var(--cmp-badge-border, var(--cmp-border-default, currentColor));
14
+ border: 0;
15
15
  border-radius: var(--cmp-badge-radius, 999px);
16
16
  background: var(--cmp-badge-background, var(--cmp-surface-subtle, transparent));
17
17
  color: var(--cmp-badge-text, var(--cmp-text-body, currentColor));
18
- font-size: var(--cmp-badge-font-size, 0.875rem);
19
- font-weight: var(--cmp-badge-font-weight, 600);
20
- line-height: var(--sys-text-line-height-tight, 1.2);
18
+ font-size: var(--cmp-badge-font-size, 12px);
19
+ font-weight: var(--cmp-badge-font-weight, 500);
20
+ line-height: var(--sys-text-scale-caption-line-height, 16px);
21
+ white-space: nowrap;
21
22
  }
22
23
 
23
- :where([data-oods-component='StatusBadge'])[data-status='active'],
24
- :where([data-oods-component='StatusBadge'])[data-status='success'] {
24
+ :where([data-oods-component='StatusBadge'])[data-status='active']:not([data-tone]),
25
+ :where([data-oods-component='StatusBadge'])[data-status='success']:not([data-tone]) {
25
26
  --cmp-badge-background: var(--sys-status-success-surface, Canvas);
26
27
  --cmp-badge-border: var(--sys-status-success-border, currentColor);
27
28
  --cmp-badge-text: var(--sys-status-success-text, CanvasText);
28
29
  }
29
30
 
30
- :where([data-oods-component='StatusBadge'])[data-status='past_due'],
31
- :where([data-oods-component='StatusBadge'])[data-status='warning'] {
31
+ :where([data-oods-component='StatusBadge'])[data-status='past_due']:not([data-tone]),
32
+ :where([data-oods-component='StatusBadge'])[data-status='warning']:not([data-tone]) {
32
33
  --cmp-badge-background: var(--sys-status-warning-surface, Canvas);
33
34
  --cmp-badge-border: var(--sys-status-warning-border, currentColor);
34
35
  --cmp-badge-text: var(--sys-status-warning-text, CanvasText);
35
36
  }
36
37
 
37
- :where([data-oods-component='StatusBadge'])[data-status='cancelled'],
38
- :where([data-oods-component='StatusBadge'])[data-status='error'] {
38
+ :where([data-oods-component='StatusBadge'])[data-status='cancelled']:not([data-tone]),
39
+ :where([data-oods-component='StatusBadge'])[data-status='error']:not([data-tone]) {
39
40
  --cmp-badge-background: var(--sys-status-critical-surface, Canvas);
40
41
  --cmp-badge-border: var(--sys-status-critical-border, currentColor);
41
42
  --cmp-badge-text: var(--sys-status-critical-text, CanvasText);
@@ -71,9 +72,9 @@
71
72
  :where([data-oods-component='CancellationSummary']) {
72
73
  display: grid;
73
74
  gap: var(--cmp-spacing-stack-sm, 0.75rem);
74
- padding: var(--cmp-spacing-inset-default, 1rem);
75
+ padding: var(--sys-card-padding, 1.5rem);
75
76
  border: 1px solid var(--cmp-border-default, currentColor);
76
- border-radius: var(--cmp-input-radius, 0.5rem);
77
+ border-radius: var(--cmp-card-radius, 0.75rem);
77
78
  background: var(--cmp-surface-panel, Canvas);
78
79
  color: var(--cmp-text-body, CanvasText);
79
80
  }
@@ -102,26 +103,45 @@
102
103
  :where([data-oods-component='SearchInput']) input[type='search'] {
103
104
  inline-size: 100%;
104
105
  box-sizing: border-box;
105
- padding: var(--cmp-input-padding-block, 0.625rem) var(--cmp-input-padding-inline, 0.75rem);
106
+ min-block-size: var(--sys-control-height-md, 2rem);
107
+ padding: 0 var(--cmp-input-padding-inline, 0.75rem);
106
108
  border: 1px solid var(--cmp-input-border, var(--cmp-border-default, currentColor));
107
- border-radius: var(--cmp-input-radius, 0.5rem);
109
+ border-radius: var(--cmp-input-radius, 6px);
108
110
  background: var(--cmp-input-background, Canvas);
109
111
  color: var(--cmp-input-text, CanvasText);
110
112
  font: inherit;
113
+ font-size: var(--sys-text-scale-body-sm-font-size, 14px);
114
+ line-height: var(--sys-text-scale-body-sm-line-height, 20px);
111
115
  }
112
116
 
117
+ /* s222-m02 (#2502 ruling 11): search and pagination buttons are the outline button at the control height; a page
118
+ * number is square. */
113
119
  :where([data-oods-component='SearchInput']) button,
114
120
  :where([data-oods-component='PaginationBar']) button {
115
121
  display: inline-flex;
116
- min-inline-size: var(--cmp-button-height, 2.5rem);
117
- min-block-size: var(--cmp-button-height, 2.5rem);
122
+ box-sizing: border-box;
123
+ min-inline-size: var(--cmp-button-height, 2rem);
124
+ min-block-size: var(--cmp-button-height, 2rem);
118
125
  align-items: center;
119
126
  justify-content: center;
120
- border: 1px solid var(--cmp-button-border, var(--cmp-border-default, currentColor));
121
- border-radius: var(--cmp-button-radius, 0.5rem);
122
- background: var(--cmp-button-background, Canvas);
123
- color: var(--cmp-button-text, CanvasText);
127
+ padding: 0 var(--cmp-button-padding-inline-sm, 0.625rem);
128
+ border: 1px solid var(--sys-border-strong, CanvasText);
129
+ border-radius: var(--cmp-button-radius, 6px);
130
+ background: var(--sys-surface-raised, Canvas);
131
+ color: var(--sys-text-primary, CanvasText);
124
132
  font: inherit;
133
+ font-size: var(--sys-text-scale-label-font-size, 14px);
134
+ font-weight: var(--sys-text-scale-label-font-weight, 500);
135
+ line-height: var(--sys-text-scale-label-line-height, 20px);
136
+ cursor: pointer;
137
+ }
138
+
139
+ :where([data-oods-component='SearchInput'], [data-oods-component='PaginationBar']) button:hover:not(:disabled) { background: var(--sys-surface-interactive-secondary-default, Canvas); }
140
+ :where([data-oods-component='SearchInput'], [data-oods-component='PaginationBar']) button > svg { flex: none; inline-size: var(--sys-control-icon-size, 1rem); block-size: var(--sys-control-icon-size, 1rem); }
141
+ :where([data-oods-component='PaginationBar']) button[aria-current='page'] {
142
+ border-color: transparent;
143
+ background: var(--sys-surface-interactive-primary-default, Highlight);
144
+ color: var(--sys-text-on-interactive, HighlightText);
125
145
  }
126
146
 
127
147
  :where([data-oods-component='PaginationBar']) {
@@ -133,6 +153,8 @@
133
153
  }
134
154
 
135
155
  :where([data-oods-component='PaginationBar']) button:disabled {
156
+ border-color: var(--sys-border-subtle, GrayText);
157
+ background: var(--sys-surface-disabled, Canvas);
136
158
  color: var(--cmp-button-text-disabled, GrayText);
137
159
  cursor: not-allowed;
138
160
  }