@scalewing/react 1.59.0 → 1.59.2
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/CHANGELOG.md +12 -0
- package/dist/css/css-chrome.js +21 -0
- package/dist/css/css-glyph-tile.d.ts +8 -0
- package/dist/css/css-glyph-tile.js +15 -1
- package/dist/css/css-stepper.d.ts +2 -2
- package/dist/css/css-stepper.js +14 -2
- package/dist/styles.css +36 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @scalewing/react
|
|
2
2
|
|
|
3
|
+
## 1.59.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ed35abb: `GlyphTile` letters are readable text: a tile holding letters mixes its categorical fill 25 % toward black, so white letters keep 4.5:1 (WCAG 1.4.3) on every fill in both schemes (neutral 3.26:1 before, 5.35:1 after; orange, the lightest, 5.08:1). A glyph keeps the fill as it is (3:1, WCAG 1.4.11). `Stepper`'s − and + grow to the 44 px touch target both ways on a coarse pointer (32 px wide before). No API change.
|
|
8
|
+
|
|
9
|
+
## 1.59.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 3f78164: An xs `Field`'s own text input (`input` of a typed kind, or `textarea`) now draws at the xs size: the document canvas's `[data-theme]` typed-input rule outranked `.sw-field-xs`, so the control kept the md min-height (44 px) and the inherited font size beside a 28 px xs `Select`. The xs rule now matches it under `[data-theme]` (caption type, xs min-height and padding), and on a coarse pointer the control is the 44 px touch target. Adorned and search inputs keep their frames' rules. No API change.
|
|
14
|
+
|
|
3
15
|
## 1.59.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/css/css-chrome.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { typographyVariants } from '@scalewing/tokens';
|
|
2
2
|
import { appHeaderBarClassCatalog, cssAppHeaderBarClasses, } from './css-app-header-bar.js';
|
|
3
|
+
import { typedInputs } from './css-document.js';
|
|
3
4
|
import { cssNavWordsClasses, navWordsClassCatalog } from './css-nav-words.js';
|
|
4
5
|
import { zIndex } from './stacking.js';
|
|
5
6
|
import { coarsePointerQuery, touchTarget } from './touch-target.js';
|
|
@@ -71,6 +72,26 @@ ${cssNavWordsClasses()}
|
|
|
71
72
|
padding-inline-end: calc(
|
|
72
73
|
var(--sw-control-xs-padding-inline) + var(--sw-space-5)
|
|
73
74
|
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
* The document canvas sizes every typed input under [data-theme] (0,2,1),
|
|
79
|
+
* which outranks the xs rule above, so an xs field's own text control
|
|
80
|
+
* matches it there. Adorned and search inputs sit one level deeper and keep
|
|
81
|
+
* their frames' rules. On a coarse pointer it is the 44 px touch target.
|
|
82
|
+
*/
|
|
83
|
+
[data-theme] .sw-field-xs > :is(${typedInputs}) {
|
|
84
|
+
font-size: ${caption.fontSize}px;
|
|
85
|
+
letter-spacing: ${caption.letterSpacing}px;
|
|
86
|
+
line-height: ${caption.lineHeight}px;
|
|
87
|
+
min-height: var(--sw-control-xs-min-height);
|
|
88
|
+
padding-inline: var(--sw-control-xs-padding-inline);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@media ${coarsePointerQuery} {
|
|
92
|
+
[data-theme] .sw-field-xs > :is(${typedInputs}) {
|
|
93
|
+
min-height: ${touchTarget};
|
|
94
|
+
}
|
|
74
95
|
}`;
|
|
75
96
|
}
|
|
76
97
|
export function chromeClassCatalog() {
|
|
@@ -3,5 +3,13 @@ export declare const glyphTileSizes: readonly ["sm", "md", "lg"];
|
|
|
3
3
|
export type GlyphTileSize = (typeof glyphTileSizes)[number];
|
|
4
4
|
/** The most letters a tile holds, such as a three-letter crest ("NSL"). */
|
|
5
5
|
export declare const glyphTileLetterLimit = 3;
|
|
6
|
+
/**
|
|
7
|
+
* How far a tile holding letters mixes its fill toward black. Letters are
|
|
8
|
+
* text (WCAG 1.4.3, 4.5:1), and the categorical fills keep a white glyph at
|
|
9
|
+
* only 3:1 (neutral 3.26:1, orange 3.06:1): a 25 % mix keeps white letters
|
|
10
|
+
* at 5:1 or more on every fill in both schemes (orange, the lightest after
|
|
11
|
+
* the mix, 5.08:1). A glyph keeps the fill as it is.
|
|
12
|
+
*/
|
|
13
|
+
export declare const glyphTileLetterDarken = 0.25;
|
|
6
14
|
export declare function cssGlyphTileClasses(): string;
|
|
7
15
|
export declare function glyphTileClassCatalog(): string[];
|
|
@@ -2,6 +2,14 @@ import { categoricalColorKeys } from '@scalewing/tokens';
|
|
|
2
2
|
export const glyphTileSizes = ['sm', 'md', 'lg'];
|
|
3
3
|
/** The most letters a tile holds, such as a three-letter crest ("NSL"). */
|
|
4
4
|
export const glyphTileLetterLimit = 3;
|
|
5
|
+
/**
|
|
6
|
+
* How far a tile holding letters mixes its fill toward black. Letters are
|
|
7
|
+
* text (WCAG 1.4.3, 4.5:1), and the categorical fills keep a white glyph at
|
|
8
|
+
* only 3:1 (neutral 3.26:1, orange 3.06:1): a 25 % mix keeps white letters
|
|
9
|
+
* at 5:1 or more on every fill in both schemes (orange, the lightest after
|
|
10
|
+
* the mix, 5.08:1). A glyph keeps the fill as it is.
|
|
11
|
+
*/
|
|
12
|
+
export const glyphTileLetterDarken = 0.25;
|
|
5
13
|
const tileSide = {
|
|
6
14
|
sm: 'var(--sw-space-5)',
|
|
7
15
|
md: 'var(--sw-control-xs-min-height)',
|
|
@@ -20,7 +28,8 @@ function sizeRules() {
|
|
|
20
28
|
/*
|
|
21
29
|
* A rounded square in a categorical fill with the consumer's glyph centred
|
|
22
30
|
* in white, sized to spacing step 4 whatever the glyph's own size. It is
|
|
23
|
-
* decoration: the words beside it carry the meaning.
|
|
31
|
+
* decoration: the words beside it carry the meaning. Letters still have to
|
|
32
|
+
* be readable text, so a tile holding them takes a deeper fill. Forced colors drop the
|
|
24
33
|
* fill, so a border keeps the tile's shape and the glyph takes the text
|
|
25
34
|
* color.
|
|
26
35
|
*/
|
|
@@ -66,6 +75,11 @@ export function cssGlyphTileClasses() {
|
|
|
66
75
|
|
|
67
76
|
${hueRules()}
|
|
68
77
|
|
|
78
|
+
/* Letters are text: the fill darkens just enough for 4.5:1 (glyphTileLetterDarken). */
|
|
79
|
+
.sw-glyph-tile:has(> .sw-glyph-tile-text) {
|
|
80
|
+
background: color-mix(in srgb, var(--sw-glyph-tile-fill), black ${glyphTileLetterDarken * 100}%);
|
|
81
|
+
}
|
|
82
|
+
|
|
69
83
|
${sizeRules()}
|
|
70
84
|
|
|
71
85
|
@media (forced-colors: active) {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* digits wide by default, the track at its own width even under a wider label
|
|
4
4
|
* or message (`5ch` plus its padding, so its width never follows
|
|
5
5
|
* its value), or fills its container with `sw-stepper-full`. The buttons are
|
|
6
|
-
* spacing step 6 wide on the subtle fill
|
|
7
|
-
* height.
|
|
6
|
+
* spacing step 6 wide on the subtle fill (the 44 px touch target on a coarse
|
|
7
|
+
* pointer) and every part is the `md` control height.
|
|
8
8
|
*/
|
|
9
9
|
export declare function cssStepperClasses(): string;
|
|
10
10
|
export declare function stepperClassCatalog(): string[];
|
package/dist/css/css-stepper.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { typographyVariants } from '@scalewing/tokens';
|
|
2
2
|
import { changedTintLayer } from './css-field-changed.js';
|
|
3
|
+
import { coarsePointerQuery, touchTarget } from './touch-target.js';
|
|
3
4
|
import { cssStepperUnitClasses, stepperUnitClassCatalog, } from './css-stepper-unit.js';
|
|
4
5
|
const body = typographyVariants.body;
|
|
5
6
|
const label = typographyVariants.label;
|
|
@@ -47,8 +48,8 @@ function stateRules() {
|
|
|
47
48
|
* digits wide by default, the track at its own width even under a wider label
|
|
48
49
|
* or message (`5ch` plus its padding, so its width never follows
|
|
49
50
|
* its value), or fills its container with `sw-stepper-full`. The buttons are
|
|
50
|
-
* spacing step 6 wide on the subtle fill
|
|
51
|
-
* height.
|
|
51
|
+
* spacing step 6 wide on the subtle fill (the 44 px touch target on a coarse
|
|
52
|
+
* pointer) and every part is the `md` control height.
|
|
52
53
|
*/
|
|
53
54
|
export function cssStepperClasses() {
|
|
54
55
|
return `.sw-stepper {
|
|
@@ -117,6 +118,17 @@ ${input} {
|
|
|
117
118
|
|
|
118
119
|
.sw-stepper-full input.sw-stepper-input { inline-size: 100%; }
|
|
119
120
|
|
|
121
|
+
/* A coarse pointer gets the full touch target: − and + as wide as they are tall. */
|
|
122
|
+
@media ${coarsePointerQuery} {
|
|
123
|
+
.sw-stepper-track {
|
|
124
|
+
grid-template-columns: ${touchTarget} auto ${touchTarget};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.sw-stepper-full .sw-stepper-track {
|
|
128
|
+
grid-template-columns: ${touchTarget} minmax(0, 1fr) ${touchTarget};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
120
132
|
${stateRules()}
|
|
121
133
|
|
|
122
134
|
${cssStepperUnitClasses()}`;
|
package/dist/styles.css
CHANGED
|
@@ -5045,6 +5045,26 @@ button.sw-date-toggle-day[aria-disabled='true'] {
|
|
|
5045
5045
|
);
|
|
5046
5046
|
}
|
|
5047
5047
|
|
|
5048
|
+
/*
|
|
5049
|
+
* The document canvas sizes every typed input under [data-theme] (0,2,1),
|
|
5050
|
+
* which outranks the xs rule above, so an xs field's own text control
|
|
5051
|
+
* matches it there. Adorned and search inputs sit one level deeper and keep
|
|
5052
|
+
* their frames' rules. On a coarse pointer it is the 44 px touch target.
|
|
5053
|
+
*/
|
|
5054
|
+
[data-theme] .sw-field-xs > :is(input[type='text'], input[type='email'], input[type='number'], input[type='search'], input[type='url'], input[type='password'], input:not([type]), textarea) {
|
|
5055
|
+
font-size: 13px;
|
|
5056
|
+
letter-spacing: -0.08px;
|
|
5057
|
+
line-height: 18px;
|
|
5058
|
+
min-height: var(--sw-control-xs-min-height);
|
|
5059
|
+
padding-inline: var(--sw-control-xs-padding-inline);
|
|
5060
|
+
}
|
|
5061
|
+
|
|
5062
|
+
@media (pointer: coarse) {
|
|
5063
|
+
[data-theme] .sw-field-xs > :is(input[type='text'], input[type='email'], input[type='number'], input[type='search'], input[type='url'], input[type='password'], input:not([type]), textarea) {
|
|
5064
|
+
min-height: var(--sw-control-md-min-height);
|
|
5065
|
+
}
|
|
5066
|
+
}
|
|
5067
|
+
|
|
5048
5068
|
.sw-section-nav-list {
|
|
5049
5069
|
border-bottom: 1px solid var(--sw-color-border);
|
|
5050
5070
|
display: flex;
|
|
@@ -8413,6 +8433,11 @@ html:has(.sw-site-header-sticky) {
|
|
|
8413
8433
|
.sw-glyph-tile-rose { --sw-glyph-tile-fill: var(--sw-categorical-rose); }
|
|
8414
8434
|
.sw-glyph-tile-neutral { --sw-glyph-tile-fill: var(--sw-categorical-neutral); }
|
|
8415
8435
|
|
|
8436
|
+
/* Letters are text: the fill darkens just enough for 4.5:1 (glyphTileLetterDarken). */
|
|
8437
|
+
.sw-glyph-tile:has(> .sw-glyph-tile-text) {
|
|
8438
|
+
background: color-mix(in srgb, var(--sw-glyph-tile-fill), black 25%);
|
|
8439
|
+
}
|
|
8440
|
+
|
|
8416
8441
|
.sw-glyph-tile-sm { --sw-glyph-tile-side: var(--sw-space-5); height: var(--sw-space-5); width: var(--sw-space-5); }
|
|
8417
8442
|
.sw-glyph-tile-md { --sw-glyph-tile-side: var(--sw-control-xs-min-height); height: var(--sw-control-xs-min-height); width: var(--sw-control-xs-min-height); }
|
|
8418
8443
|
.sw-glyph-tile-lg { --sw-glyph-tile-side: var(--sw-space-6); height: var(--sw-space-6); width: var(--sw-space-6); }
|
|
@@ -9976,6 +10001,17 @@ html:has(.sw-site-header-sticky) {
|
|
|
9976
10001
|
|
|
9977
10002
|
.sw-stepper-full input.sw-stepper-input { inline-size: 100%; }
|
|
9978
10003
|
|
|
10004
|
+
/* A coarse pointer gets the full touch target: − and + as wide as they are tall. */
|
|
10005
|
+
@media (pointer: coarse) {
|
|
10006
|
+
.sw-stepper-track {
|
|
10007
|
+
grid-template-columns: var(--sw-control-md-min-height) auto var(--sw-control-md-min-height);
|
|
10008
|
+
}
|
|
10009
|
+
|
|
10010
|
+
.sw-stepper-full .sw-stepper-track {
|
|
10011
|
+
grid-template-columns: var(--sw-control-md-min-height) minmax(0, 1fr) var(--sw-control-md-min-height);
|
|
10012
|
+
}
|
|
10013
|
+
}
|
|
10014
|
+
|
|
9979
10015
|
[data-theme] .sw-stepper-invalid input.sw-stepper-input {
|
|
9980
10016
|
border-color: var(--sw-color-danger);
|
|
9981
10017
|
}
|