@smwb/ui-styles 2.2.0 → 2.3.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/less/components/chip/chip.less +11 -0
- package/less/components/list/list.less +7 -0
- package/less/components/menu/menu.less +5 -0
- package/less/components/tabGroups/tabGroups.less +28 -2
- package/less/components/tabs/tab/tab.less +5 -0
- package/less/components/tabs/tabs.less +10 -0
- package/less/foundation/sizing.less +25 -0
- package/less/tokens.entry.less +7 -0
- package/less/variables.less +18 -0
- package/package.json +1 -1
|
@@ -134,6 +134,17 @@
|
|
|
134
134
|
min-height: 24px;
|
|
135
135
|
padding: 0 @smui-space-sm;
|
|
136
136
|
font-size: 0.75rem;
|
|
137
|
+
|
|
138
|
+
// On a coarse pointer a small chip that is a button or a link is as tall as the sm step
|
|
139
|
+
// (44px there): its content is the button (the link is the box itself), and the box is
|
|
140
|
+
// what a finger has to hit. A small chip that only labels, or only deletes, stays 24px.
|
|
141
|
+
@media (pointer: coarse) {
|
|
142
|
+
&:is(a[href]),
|
|
143
|
+
&:has(> .smwb-chip__content[role="button"]) {
|
|
144
|
+
height: var(--smui-control-h-sm, @smui-control-h-sm-coarse);
|
|
145
|
+
min-height: var(--smui-control-h-sm, @smui-control-h-sm-coarse);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
137
148
|
}
|
|
138
149
|
|
|
139
150
|
// A color repaints the neutral filled/outlined rules above. The guard mirrors
|
|
@@ -62,6 +62,9 @@
|
|
|
62
62
|
min-height: 36px;
|
|
63
63
|
padding-top: @smui-space-xs;
|
|
64
64
|
padding-bottom: @smui-space-xs;
|
|
65
|
+
@media (pointer: coarse) {
|
|
66
|
+
min-height: max(36px, var(--smui-control-h-sm, @smui-control-h-sm-coarse));
|
|
67
|
+
}
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
&_divider {
|
|
@@ -73,6 +76,10 @@
|
|
|
73
76
|
min-height: 36px;
|
|
74
77
|
padding-top: @smui-space-xs;
|
|
75
78
|
padding-bottom: @smui-space-xs;
|
|
79
|
+
// On a coarse pointer a dense row is the sm step (44px there) at least.
|
|
80
|
+
@media (pointer: coarse) {
|
|
81
|
+
min-height: max(36px, var(--smui-control-h-sm, @smui-control-h-sm-coarse));
|
|
82
|
+
}
|
|
76
83
|
}
|
|
77
84
|
|
|
78
85
|
// A row that is a link: the anchor takes the padding, so the whole row is the link.
|
|
@@ -61,19 +61,45 @@
|
|
|
61
61
|
align-self: center;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
// The group's actions button
|
|
64
|
+
// The group's actions button is an icon-only control: it carries the `smwb-button_icon-only` marker
|
|
65
|
+
// that `Button` writes for `iconOnly`, and its box is a square of the row's control height - the
|
|
66
|
+
// height the tabs beside it are. The side is a component variable, not Tabs' fixed 40px trigger
|
|
67
|
+
// width: that width, stretched over a dense row, drew a 40x36 rectangle where the mockups draw a
|
|
68
|
+
// square. A dense row is `@tabDenseHeight`, off the `--smui-control-h-*` grid, and marks itself.
|
|
69
|
+
// `min-width` and the horizontal padding are gone with it, so the icon sits in the middle.
|
|
65
70
|
&__actions-trigger {
|
|
71
|
+
--smwb-tab-groups-actions-size: var(--smui-control-h-lg, @smui-control-h-lg);
|
|
72
|
+
|
|
66
73
|
display: inline-flex;
|
|
67
74
|
align-items: center;
|
|
68
75
|
justify-content: center;
|
|
76
|
+
box-sizing: border-box;
|
|
69
77
|
flex: 0 0 auto;
|
|
70
|
-
|
|
78
|
+
// Its own height is the square now, not the row's stretch, so a row that grows past it (a tab
|
|
79
|
+
// with a two-line label) still keeps the button in the middle of the row.
|
|
80
|
+
align-self: center;
|
|
81
|
+
min-width: 0;
|
|
82
|
+
width: var(--smwb-tab-groups-actions-size);
|
|
83
|
+
height: var(--smwb-tab-groups-actions-size);
|
|
71
84
|
padding: 0;
|
|
72
85
|
border: none;
|
|
73
86
|
background: none;
|
|
74
87
|
color: var(--smui-onSurfaceVariant);
|
|
75
88
|
cursor: pointer;
|
|
76
89
|
|
|
90
|
+
// Compact tab rows (`TabGroups` `dense`): the square follows the shorter row.
|
|
91
|
+
&--dense {
|
|
92
|
+
--smwb-tab-groups-actions-size: var(--smui-tabDenseHeight, @tabDenseHeight);
|
|
93
|
+
|
|
94
|
+
// The tabs beside it are the sm step (44px) at least on a coarse pointer, so it is too.
|
|
95
|
+
@media (pointer: coarse) {
|
|
96
|
+
--smwb-tab-groups-actions-size: max(
|
|
97
|
+
var(--smui-tabDenseHeight, @tabDenseHeight),
|
|
98
|
+
var(--smui-control-h-sm, @smui-control-h-sm-coarse)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
77
103
|
&:hover:not(:disabled) {
|
|
78
104
|
background-color: var(--smui-onSurfaceHover);
|
|
79
105
|
}
|
|
@@ -211,6 +211,11 @@
|
|
|
211
211
|
font-weight: 500;
|
|
212
212
|
letter-spacing: normal;
|
|
213
213
|
text-transform: none;
|
|
214
|
+
|
|
215
|
+
// On a coarse pointer the row is never shorter than the sm step (44px there).
|
|
216
|
+
@media (pointer: coarse) {
|
|
217
|
+
min-height: max(var(--smui-tabDenseHeight, @tabDenseHeight), var(--smui-control-h-sm, @smui-control-h-sm-coarse));
|
|
218
|
+
}
|
|
214
219
|
}
|
|
215
220
|
|
|
216
221
|
// Content-width tabs (Tabs `fit`): a tab is as wide as what it holds — marker, label, close button —
|
|
@@ -69,6 +69,11 @@
|
|
|
69
69
|
opacity: 0.38;
|
|
70
70
|
cursor: default;
|
|
71
71
|
}
|
|
72
|
+
|
|
73
|
+
// On a coarse pointer the button is at least as wide as the sm step (44px there).
|
|
74
|
+
@media (pointer: coarse) {
|
|
75
|
+
width: max(@tabsScrollButtonWidth, var(--smui-control-h-sm, @smui-control-h-sm-coarse));
|
|
76
|
+
}
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
// The overflow-menu trigger (Tabs `overflowMenu`) renders beside the scroller in the
|
|
@@ -95,6 +100,11 @@
|
|
|
95
100
|
opacity: 0.38;
|
|
96
101
|
cursor: default;
|
|
97
102
|
}
|
|
103
|
+
|
|
104
|
+
// On a coarse pointer the button is at least as wide as the sm step (44px there).
|
|
105
|
+
@media (pointer: coarse) {
|
|
106
|
+
width: max(@tabsOverflowTriggerWidth, var(--smui-control-h-sm, @smui-control-h-sm-coarse));
|
|
107
|
+
}
|
|
98
108
|
}
|
|
99
109
|
|
|
100
110
|
&__indicator {
|
|
@@ -43,6 +43,23 @@
|
|
|
43
43
|
// Button, so they inherit the tokens
|
|
44
44
|
//
|
|
45
45
|
// Override one step from theme.config, e.g. @smui-control-h-md: 44px;
|
|
46
|
+
//
|
|
47
|
+
// Touch density: on a coarse pointer (finger, stylus) the three steps are
|
|
48
|
+
// replaced by @smui-control-h-*-coarse, so every control above is at least
|
|
49
|
+
// @smui-touch-target (44px) tall. variables.less remaps the runtime tokens in
|
|
50
|
+
// an `@media (pointer: coarse)` block, which is why most components need no
|
|
51
|
+
// rule of their own; only what sits off the scale has one (small clickable
|
|
52
|
+
// or link Chip, Tabs dense and its scroll buttons, TabGroups dense actions button,
|
|
53
|
+
// Menu dense items, List dense rows). A mouse keeps the sizes above.
|
|
54
|
+
// Still exempt on touch: the --filled and --inline fields, the compact Toggle
|
|
55
|
+
// (capped at @toggleCompactMaxHeight) and a small Chip that is neither a button
|
|
56
|
+
// nor a link.
|
|
57
|
+
// The -coarse steps never drop below the matching fine step, so a theme that
|
|
58
|
+
// raises a step is not shrunk on touch. Override one from theme.config
|
|
59
|
+
// (@smui-control-h-md-coarse: 48px;) or at runtime (--smui-control-h-md-coarse).
|
|
60
|
+
// A runtime override of --smui-control-h-* on :root, loaded after the library,
|
|
61
|
+
// also applies on a coarse pointer (the token layer always loses to it); set
|
|
62
|
+
// the -coarse token too, or scope the override to @media (pointer: fine).
|
|
46
63
|
//=====================================================================
|
|
47
64
|
|
|
48
65
|
// Control height (form fields, buttons, chips)
|
|
@@ -50,6 +67,14 @@
|
|
|
50
67
|
@smui-control-h-md: 40px;
|
|
51
68
|
@smui-control-h-lg: 48px;
|
|
52
69
|
|
|
70
|
+
// Smallest touch target (Material and WCAG 2.5.5 call for 44-48px)
|
|
71
|
+
@smui-touch-target: 44px;
|
|
72
|
+
|
|
73
|
+
// Control height on a coarse pointer (finger, stylus): the fine step, raised to the touch target
|
|
74
|
+
@smui-control-h-sm-coarse: max(@smui-touch-target, @smui-control-h-sm);
|
|
75
|
+
@smui-control-h-md-coarse: max(@smui-touch-target, @smui-control-h-md);
|
|
76
|
+
@smui-control-h-lg-coarse: max(@smui-touch-target, @smui-control-h-lg);
|
|
77
|
+
|
|
53
78
|
// Horizontal padding inside controls
|
|
54
79
|
@smui-control-px-sm: @smui-space-md; // 12
|
|
55
80
|
@smui-control-px-md: @smui-space-lg; // 16
|
package/less/tokens.entry.less
CHANGED
|
@@ -14,6 +14,13 @@
|
|
|
14
14
|
.smui-tokens-light();
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// A coarse pointer swaps the control heights for the -coarse steps (foundation/sizing.less).
|
|
18
|
+
@media (pointer: coarse) {
|
|
19
|
+
:where(:root) {
|
|
20
|
+
.smui-tokens-coarse();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
:where(:root[data-theme="dark"]) {
|
|
18
25
|
.smui-tokens-dark();
|
|
19
26
|
}
|
package/less/variables.less
CHANGED
|
@@ -153,6 +153,10 @@
|
|
|
153
153
|
--smui-control-h-sm: @smui-control-h-sm;
|
|
154
154
|
--smui-control-h-md: @smui-control-h-md;
|
|
155
155
|
--smui-control-h-lg: @smui-control-h-lg;
|
|
156
|
+
// Their values on a coarse pointer (see .smui-tokens-coarse below)
|
|
157
|
+
--smui-control-h-sm-coarse: @smui-control-h-sm-coarse;
|
|
158
|
+
--smui-control-h-md-coarse: @smui-control-h-md-coarse;
|
|
159
|
+
--smui-control-h-lg-coarse: @smui-control-h-lg-coarse;
|
|
156
160
|
|
|
157
161
|
/* Border-radius scale */
|
|
158
162
|
--smui-radius-xs: @smui-radius-xs;
|
|
@@ -279,10 +283,24 @@
|
|
|
279
283
|
--smui-messageBackground: @messageBgDark;
|
|
280
284
|
}
|
|
281
285
|
|
|
286
|
+
// Touch density: on a coarse pointer the control heights are the -coarse steps. Not part of
|
|
287
|
+
// the light/dark mixins for the same reason the heights are light-only: mode-independent.
|
|
288
|
+
.smui-tokens-coarse() {
|
|
289
|
+
--smui-control-h-sm: var(--smui-control-h-sm-coarse, @smui-control-h-sm-coarse);
|
|
290
|
+
--smui-control-h-md: var(--smui-control-h-md-coarse, @smui-control-h-md-coarse);
|
|
291
|
+
--smui-control-h-lg: var(--smui-control-h-lg-coarse, @smui-control-h-lg-coarse);
|
|
292
|
+
}
|
|
293
|
+
|
|
282
294
|
:root {
|
|
283
295
|
.smui-tokens-light();
|
|
284
296
|
}
|
|
285
297
|
|
|
298
|
+
@media (pointer: coarse) {
|
|
299
|
+
:root {
|
|
300
|
+
.smui-tokens-coarse();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
286
304
|
:root[data-theme="dark"] {
|
|
287
305
|
.smui-tokens-dark();
|
|
288
306
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smwb/ui-styles",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Framework-agnostic LESS design tokens and component styles (smwb-*) shared by the @smwb UI libraries. Prebuilt aggregate CSS lives in @smwb/ui-css.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": [
|