@oods/component-styles 0.3.3 → 0.4.1
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 +1 -1
- package/dist/{chunk-QTCJ7H3Z.js → chunk-PGAP2D2D.js} +8 -1
- package/dist/components-combobox.css +189 -0
- package/dist/components-overlay.css +270 -0
- package/dist/components-ported.css +43 -21
- package/dist/components-segmented-control.css +130 -0
- package/dist/components.css +741 -235
- package/dist/index.cjs +8 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/ported.cjs +8 -1
- package/dist/ported.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/* s223-m02 (#2527 ruling 10): SegmentedControl, one choice from two to five options shown as joined segments. React, Vue
|
|
2
|
+
* and the HTML renderer write one markup: a radiogroup track of segments, each a label holding its native radio and its
|
|
3
|
+
* text. components.css imports this sheet ahead of its own rules and the HTML renderer inlines it in the same place.
|
|
4
|
+
*
|
|
5
|
+
* The track is the subtle fill at the control height of each size (xs 24, sm 28, md 32, lg 40: the button, input and
|
|
6
|
+
* select heights, #2502 ruling 9), inset 2px around its segments. The checked segment is the raised surface with a
|
|
7
|
+
* hairline ring and its label in the primary text colour; the others are muted. Every label is the control weight (500),
|
|
8
|
+
* so no segment's width moves with the selection. Each radio is transparent over its whole segment: it takes the clicks,
|
|
9
|
+
* and the shared focus rule in components.css draws its ring there, so nothing here paints focus. */
|
|
10
|
+
:where(.oods-segmented-control, [data-oods-component='SegmentedControl']) {
|
|
11
|
+
--oods-segmented-control-block-size: var(--sys-control-height-md);
|
|
12
|
+
--oods-segmented-control-padding-inline: var(--sys-control-padding-inline);
|
|
13
|
+
--oods-segmented-control-font-size: var(--sys-text-scale-label-font-size);
|
|
14
|
+
--oods-segmented-control-line-height: var(--sys-text-scale-label-line-height);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* The button's type and side padding at each size: caption 12/16 and 8px at xs, label 14/20 and 10px at sm, 12px at
|
|
18
|
+
* md, body-md 16/24 and 16px at lg. */
|
|
19
|
+
:where(.oods-segmented-control, [data-oods-component='SegmentedControl'])[data-size='xs'] {
|
|
20
|
+
--oods-segmented-control-block-size: var(--sys-control-height-xs);
|
|
21
|
+
--oods-segmented-control-padding-inline: var(--sys-control-padding-inline-xs);
|
|
22
|
+
--oods-segmented-control-font-size: var(--sys-text-scale-caption-font-size);
|
|
23
|
+
--oods-segmented-control-line-height: var(--sys-text-scale-caption-line-height);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:where(.oods-segmented-control, [data-oods-component='SegmentedControl'])[data-size='sm'] {
|
|
27
|
+
--oods-segmented-control-block-size: var(--sys-control-height-sm);
|
|
28
|
+
--oods-segmented-control-padding-inline: var(--sys-control-padding-inline-sm);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:where(.oods-segmented-control, [data-oods-component='SegmentedControl'])[data-size='lg'] {
|
|
32
|
+
--oods-segmented-control-block-size: var(--sys-control-height-lg);
|
|
33
|
+
--oods-segmented-control-padding-inline: var(--sys-control-padding-inline-lg);
|
|
34
|
+
--oods-segmented-control-font-size: var(--sys-text-scale-body-md-font-size);
|
|
35
|
+
--oods-segmented-control-line-height: var(--sys-text-scale-body-md-line-height);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Equal segments, each as wide as the widest label, while the field has room for that. In a narrower field every segment
|
|
39
|
+
* keeps its whole label and only the shorter ones give up width; a label is never cut. A field too narrow for the labels
|
|
40
|
+
* themselves (five options at lg need about 380px) is outgrown, so on a phone use md or smaller for five. */
|
|
41
|
+
.oods-segmented-control__track {
|
|
42
|
+
display: inline-grid;
|
|
43
|
+
grid-auto-columns: minmax(max-content, 1fr);
|
|
44
|
+
grid-auto-flow: column;
|
|
45
|
+
justify-self: start;
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
block-size: var(--oods-segmented-control-block-size);
|
|
48
|
+
padding: var(--ref-space-ramp-050);
|
|
49
|
+
border-radius: var(--sys-radius-control);
|
|
50
|
+
background: var(--sys-surface-interactive-secondary-default);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.oods-segmented-control__option {
|
|
54
|
+
position: relative;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
box-sizing: border-box;
|
|
59
|
+
padding-inline: var(--oods-segmented-control-padding-inline);
|
|
60
|
+
border: 1px solid transparent;
|
|
61
|
+
border-radius: var(--sys-radius-control-sm);
|
|
62
|
+
color: var(--sys-text-muted);
|
|
63
|
+
font-size: var(--oods-segmented-control-font-size);
|
|
64
|
+
font-weight: var(--sys-text-scale-label-font-weight);
|
|
65
|
+
line-height: var(--oods-segmented-control-line-height);
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* The radio fills its segment and paints nothing of its own, so its focus ring is drawn on the segment. The selector
|
|
71
|
+
* outranks the rule in components.css that sizes every radio in a component at 16px. */
|
|
72
|
+
.oods-segmented-control__option > input.oods-segmented-control__input[type='radio'] {
|
|
73
|
+
position: absolute;
|
|
74
|
+
inset: 0;
|
|
75
|
+
inline-size: 100%;
|
|
76
|
+
block-size: 100%;
|
|
77
|
+
margin: 0;
|
|
78
|
+
border: 0;
|
|
79
|
+
border-radius: inherit;
|
|
80
|
+
background: transparent;
|
|
81
|
+
appearance: none;
|
|
82
|
+
cursor: inherit;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* A hovered unchecked segment reads in the primary text colour; the :where() keeps it below the high-contrast rules. */
|
|
86
|
+
.oods-segmented-control__option:where(:hover:not(:has(> :checked, > :disabled))) { color: var(--sys-text-primary); }
|
|
87
|
+
|
|
88
|
+
.oods-segmented-control__option:has(> .oods-segmented-control__input:checked) {
|
|
89
|
+
border-color: var(--sys-border-subtle);
|
|
90
|
+
background: var(--sys-surface-raised);
|
|
91
|
+
color: var(--sys-text-primary);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.oods-segmented-control__option:has(> .oods-segmented-control__input:disabled) {
|
|
95
|
+
color: var(--sys-text-disabled);
|
|
96
|
+
cursor: not-allowed;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* s223-m02 (#2527 ruling 10, after #2502 ruling 6): in high contrast the checked segment is Highlight with HighlightText,
|
|
100
|
+
* and every other segment is Canvas and CanvasText with a 1px CanvasText border. A disabled segment is GrayText, and a
|
|
101
|
+
* disabled checked one GrayText with Canvas text, so the choice still shows. */
|
|
102
|
+
[data-theme='hc'] .oods-segmented-control__option:not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
|
|
103
|
+
forced-color-adjust: none;
|
|
104
|
+
border-color: CanvasText;
|
|
105
|
+
background: Canvas;
|
|
106
|
+
color: CanvasText;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[data-theme='hc'] .oods-segmented-control__option:has(> .oods-segmented-control__input:checked):not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
|
|
110
|
+
border-color: Highlight;
|
|
111
|
+
background: Highlight;
|
|
112
|
+
color: HighlightText;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
[data-theme='hc'] .oods-segmented-control__option:has(> .oods-segmented-control__input:disabled):not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
|
|
116
|
+
border-color: GrayText;
|
|
117
|
+
color: GrayText;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
[data-theme='hc'] .oods-segmented-control__option:has(> .oods-segmented-control__input:checked:disabled):not(:where([data-theme='hc'] [data-theme]:not([data-theme='hc']) *)) {
|
|
121
|
+
background: GrayText;
|
|
122
|
+
color: Canvas;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@media (forced-colors: active) {
|
|
126
|
+
.oods-segmented-control__option { forced-color-adjust: none; border-color: CanvasText; background: Canvas; color: CanvasText; }
|
|
127
|
+
.oods-segmented-control__option:has(> .oods-segmented-control__input:checked) { border-color: Highlight; background: Highlight; color: HighlightText; }
|
|
128
|
+
.oods-segmented-control__option:has(> .oods-segmented-control__input:disabled) { border-color: GrayText; color: GrayText; }
|
|
129
|
+
.oods-segmented-control__option:has(> .oods-segmented-control__input:checked:disabled) { background: GrayText; color: Canvas; }
|
|
130
|
+
}
|