@scalewing/react 1.30.0 → 1.32.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +23 -5
  3. package/dist/components/ActionMenu.d.ts +10 -1
  4. package/dist/components/ActionMenu.js +7 -2
  5. package/dist/components/AppHeader.d.ts +9 -1
  6. package/dist/components/AppHeader.js +6 -2
  7. package/dist/components/Box.d.ts +10 -2
  8. package/dist/components/Button.d.ts +27 -2
  9. package/dist/components/Button.js +5 -3
  10. package/dist/components/ButtonGroup.d.ts +9 -1
  11. package/dist/components/ButtonGroup.js +8 -2
  12. package/dist/components/Combobox.d.ts +14 -0
  13. package/dist/components/Combobox.js +125 -0
  14. package/dist/components/DateField.d.ts +9 -1
  15. package/dist/components/DateField.js +4 -3
  16. package/dist/components/DenominationGrid.d.ts +5 -3
  17. package/dist/components/DenominationGrid.js +21 -11
  18. package/dist/components/Dialog.d.ts +9 -1
  19. package/dist/components/Dialog.js +8 -4
  20. package/dist/components/Field.d.ts +25 -0
  21. package/dist/components/Field.js +56 -6
  22. package/dist/components/FieldLabelText.d.ts +21 -3
  23. package/dist/components/FieldLabelText.js +16 -4
  24. package/dist/components/FilterChips.d.ts +9 -1
  25. package/dist/components/FilterChips.js +4 -2
  26. package/dist/components/Nav.d.ts +14 -2
  27. package/dist/components/Nav.js +6 -2
  28. package/dist/components/SegmentedControl.d.ts +5 -2
  29. package/dist/components/SegmentedControl.js +2 -1
  30. package/dist/components/Select.d.ts +9 -1
  31. package/dist/components/Select.js +4 -3
  32. package/dist/components/Stepper.d.ts +13 -0
  33. package/dist/components/Stepper.js +8 -2
  34. package/dist/components/combobox/ComboboxPopup.d.ts +25 -0
  35. package/dist/components/combobox/ComboboxPopup.js +68 -0
  36. package/dist/components/combobox/entries.d.ts +18 -0
  37. package/dist/components/combobox/entries.js +34 -0
  38. package/dist/components/combobox/types.d.ts +71 -0
  39. package/dist/components/combobox/types.js +1 -0
  40. package/dist/components/combobox/validate.d.ts +3 -0
  41. package/dist/components/combobox/validate.js +44 -0
  42. package/dist/components/denomination-grid/DenominationStrip.d.ts +4 -2
  43. package/dist/components/denomination-grid/DenominationStrip.js +3 -2
  44. package/dist/components/denomination-grid/DenominationTiles.d.ts +1 -1
  45. package/dist/components/denomination-grid/EntryCell.js +1 -1
  46. package/dist/components/denomination-grid/StripRow.js +5 -2
  47. package/dist/components/denomination-grid/types.d.ts +35 -1
  48. package/dist/components/dialog/DialogTitle.d.ts +5 -3
  49. package/dist/components/dialog/DialogTitle.js +4 -4
  50. package/dist/components/field/SearchFrame.d.ts +16 -0
  51. package/dist/components/field/SearchFrame.js +32 -0
  52. package/dist/css/css-action-menu-trigger.d.ts +11 -0
  53. package/dist/css/css-action-menu-trigger.js +66 -0
  54. package/dist/css/css-action-menu.js +7 -2
  55. package/dist/css/css-app-header-bar.d.ts +10 -0
  56. package/dist/css/css-app-header-bar.js +26 -0
  57. package/dist/css/css-box-border.d.ts +6 -1
  58. package/dist/css/css-box-border.js +8 -4
  59. package/dist/css/css-button-group-attached.js +5 -2
  60. package/dist/css/css-button-group-track.d.ts +11 -0
  61. package/dist/css/css-button-group-track.js +48 -0
  62. package/dist/css/css-button.d.ts +19 -2
  63. package/dist/css/css-button.js +31 -1
  64. package/dist/css/css-chrome.js +14 -1
  65. package/dist/css/css-combobox.d.ts +2 -0
  66. package/dist/css/css-combobox.js +136 -0
  67. package/dist/css/css-components.js +6 -0
  68. package/dist/css/css-data.js +3 -2
  69. package/dist/css/css-date-field.js +2 -1
  70. package/dist/css/css-denomination-appearance.d.ts +21 -0
  71. package/dist/css/css-denomination-appearance.js +114 -0
  72. package/dist/css/css-denomination-cell-tones.d.ts +8 -0
  73. package/dist/css/css-denomination-cell-tones.js +20 -1
  74. package/dist/css/css-denomination-grid.js +4 -0
  75. package/dist/css/css-dialog-banded.d.ts +11 -0
  76. package/dist/css/css-dialog-banded.js +84 -0
  77. package/dist/css/css-field-search.d.ts +2 -0
  78. package/dist/css/css-field-search.js +118 -0
  79. package/dist/css/css-field.js +4 -0
  80. package/dist/css/css-multi-select.js +2 -1
  81. package/dist/css/css-nav-words.d.ts +13 -0
  82. package/dist/css/css-nav-words.js +51 -0
  83. package/dist/css/css-notice.d.ts +4 -11
  84. package/dist/css/css-notice.js +6 -22
  85. package/dist/css/css-segmented-raised.d.ts +3 -0
  86. package/dist/css/css-segmented-raised.js +72 -0
  87. package/dist/css/css-segmented.js +9 -3
  88. package/dist/css/css-select.js +2 -1
  89. package/dist/css/css-split.js +2 -1
  90. package/dist/css/css-stepper.js +7 -0
  91. package/dist/css/quiet-fill.d.ts +7 -0
  92. package/dist/css/quiet-fill.js +7 -0
  93. package/dist/css/stacking.js +6 -2
  94. package/dist/css/stylesheet.js +4 -0
  95. package/dist/css/tone-tint.d.ts +21 -0
  96. package/dist/css/tone-tint.js +23 -0
  97. package/dist/index.d.ts +13 -10
  98. package/dist/index.js +11 -8
  99. package/dist/styles.css +505 -12
  100. package/package.json +1 -1
@@ -1,4 +1,12 @@
1
1
  import { type BadgeTone } from './css-data.js';
2
+ export declare const denominationCellToneAppearances: readonly ["text", "pill"];
3
+ /**
4
+ * How a toned count shows its tone: `text` sets the count in the tone;
5
+ * `pill` sets it on a rounded tint of the tone in the tone's ink, the
6
+ * Notice's fill and words, in a strip's read-only counts.
7
+ */
8
+ export type DenominationCellToneAppearance = (typeof denominationCellToneAppearances)[number];
9
+ export declare const denominationCellTonesPillClass = "sw-denomination-cell-tones-pill";
2
10
  /**
3
11
  * The classes that tone one count: a marker that applies the shared rules and
4
12
  * the tone that sets their color. A strip cell (`td`) and a tile (`li`) take
@@ -1,4 +1,7 @@
1
1
  import { badgeTones } from './css-data.js';
2
+ import { toneTintFill, toneTintInk } from './tone-tint.js';
3
+ export const denominationCellToneAppearances = ['text', 'pill'];
4
+ export const denominationCellTonesPillClass = 'sw-denomination-cell-tones-pill';
2
5
  /**
3
6
  * The tones a single count can take. `neutral` is the cell's own look, so it
4
7
  * adds no class: a cell is toned only by a tone that says something.
@@ -21,11 +24,15 @@ export function denominationCellToneClassNames(tone) {
21
24
  * carries meaning alone: the consumer's words say why a count is toned.
22
25
  * Forced colors replace the tone with the system text color, and a toned
23
26
  * zero keeps the zero's GrayText there, so it does not read as a count.
27
+ * Under the `pill` appearance a strip's read-only count sits on a rounded
28
+ * tint of its tone in the tone's ink (the Notice's fill and words); forced
29
+ * colors outline the pill instead, so the mark survives without its fill.
24
30
  */
25
31
  export function cssDenominationCellToneClasses() {
26
32
  const toneRules = cellTones
27
- .map((tone) => `.sw-denomination-cell-tone-${tone} { --sw-denomination-cell-tone: var(--sw-color-${tone}); }`)
33
+ .map((tone) => `.sw-denomination-cell-tone-${tone} { --sw-denomination-cell-tone: var(--sw-color-${tone}); --sw-denomination-cell-fill: ${toneTintFill(tone)}; --sw-denomination-cell-ink: ${toneTintInk(tone)}; }`)
28
34
  .join('\n');
35
+ const pill = `.${denominationCellTonesPillClass} .sw-denomination-cell-toned .sw-denomination-cell-value:not(:empty)`;
29
36
  return `${toneRules}
30
37
 
31
38
  .sw-denomination-grid .sw-denomination-cell.sw-denomination-cell-toned,
@@ -39,13 +46,25 @@ export function cssDenominationCellToneClasses() {
39
46
  box-shadow: inset 0 0 0 1px var(--sw-denomination-cell-tone);
40
47
  }
41
48
 
49
+ /* A pill: the count on its tone's tint, in the tone's ink (a Notice's words: 4.5:1 on the tint unless the palette's own tone is under it). */
50
+ ${pill} {
51
+ background: var(--sw-denomination-cell-fill);
52
+ border-radius: var(--sw-radius-sm);
53
+ color: var(--sw-denomination-cell-ink);
54
+ display: inline-block;
55
+ padding: calc(var(--sw-space-1) / 2) var(--sw-space-2);
56
+ }
57
+
42
58
  @media (forced-colors: active) {
43
59
  .sw-denomination-grid .sw-denomination-cell-zero.sw-denomination-cell-toned,
44
60
  .sw-denomination-grid .sw-denomination-cell-toned .sw-denomination-cell-zero { color: GrayText; }
61
+ ${pill} { color: inherit; outline: 1px solid CanvasText; }
45
62
  }`;
46
63
  }
47
64
  export function denominationCellToneClassCatalog() {
48
65
  return [
66
+ 'sw-denomination-cell-value',
67
+ denominationCellTonesPillClass,
49
68
  'sw-denomination-cell-toned',
50
69
  ...cellTones.map((tone) => `sw-denomination-cell-tone-${tone}`),
51
70
  ];
@@ -1,6 +1,7 @@
1
1
  import { typographyVariants } from '@scalewing/tokens';
2
2
  import { breakpointQuery } from './breakpoints.js';
3
3
  import { badgeTones } from './css-data.js';
4
+ import { cssDenominationAppearanceClasses, denominationAppearanceClassCatalog, } from './css-denomination-appearance.js';
4
5
  import { cssDenominationLabelClasses, denominationLabelClassCatalog, } from './css-denomination-label.js';
5
6
  import { cssDenominationAlignedClasses, denominationAlignedClassCatalog, } from './css-denomination-aligned.js';
6
7
  import { cssDenominationEntryClasses, denominationEntryClassCatalog, } from './css-denomination-entry.js';
@@ -257,6 +258,8 @@ ${cssDenominationAlignedClasses()}
257
258
 
258
259
  ${cssDenominationLabelClasses()}
259
260
 
261
+ ${cssDenominationAppearanceClasses()}
262
+
260
263
  @media (forced-colors: active) {
261
264
  .sw-denomination-label { border-inline-start-color: CanvasText; color: CanvasText; }
262
265
  .sw-denomination-strip .sw-denomination-label::before { background: CanvasText; forced-color-adjust: none; }
@@ -299,5 +302,6 @@ export function denominationGridClassCatalog() {
299
302
  ...denominationEntryClassCatalog(),
300
303
  ...denominationAlignedClassCatalog(),
301
304
  ...denominationLabelClassCatalog(),
305
+ ...denominationAppearanceClassCatalog(),
302
306
  ];
303
307
  }
@@ -0,0 +1,11 @@
1
+ export declare const dialogAppearances: readonly ["glass", "banded"];
2
+ /**
3
+ * How the dialog's surface reads: `glass` (the default) is one frosted
4
+ * panel; `banded` is a solid surface whose title row and footer are bands
5
+ * across its full width, ruled off from the content by hairlines, with the
6
+ * close button on a quiet round fill.
7
+ */
8
+ export type DialogAppearance = (typeof dialogAppearances)[number];
9
+ export declare const dialogBandedClass = "sw-dialog-banded";
10
+ export declare function cssDialogBandedClasses(): string;
11
+ export declare function dialogBandedClassCatalog(): string[];
@@ -0,0 +1,84 @@
1
+ import { breakpointQuery, breakpoints } from './breakpoints.js';
2
+ import { dialogSheetClass } from './css-dialog.js';
3
+ import { zIndex } from './stacking.js';
4
+ import { quietFill } from './quiet-fill.js';
5
+ export const dialogAppearances = ['glass', 'banded'];
6
+ export const dialogBandedClass = 'sw-dialog-banded';
7
+ const banded = `.${dialogBandedClass}`;
8
+ /* The dialog's own padding, which a band steps past to reach its edges. */
9
+ const bleed = 'calc(-1 * var(--sw-space-5))';
10
+ /* A bottom sheet's side padding, which clears a wide safe area. */
11
+ const sheetSide = (side) => `max(var(--sw-space-5), env(safe-area-inset-${side}, 0px))`;
12
+ /*
13
+ * In a bottom sheet the dialog's side padding clears the safe areas, so
14
+ * the band steps past that padding instead of space-5, and pads itself
15
+ * the same, so its hairline still meets both edges.
16
+ */
17
+ function sheetBandRules() {
18
+ return breakpoints
19
+ .map((breakpoint) => `@media ${breakpointQuery('below', breakpoint)} {
20
+ .${dialogSheetClass(breakpoint)}${banded} .sw-dialog-header {
21
+ margin-left: calc(-1 * ${sheetSide('left')});
22
+ margin-right: calc(-1 * ${sheetSide('right')});
23
+ padding-left: ${sheetSide('left')};
24
+ padding-right: ${sheetSide('right')};
25
+ }
26
+ }`)
27
+ .join('\n\n');
28
+ }
29
+ /*
30
+ * A banded dialog: the solid surface (no blur) with the medium elevation in
31
+ * place of the glass border, so it reads as a sheet over the page. The
32
+ * title row bleeds to the top and side edges as a band, a space-4 step
33
+ * down and the dialog's space-5 across, over a hairline, and stays at the
34
+ * top while the content scrolls under it (the top-chrome layer, under any
35
+ * popup the content opens); the pinned footer is already such a band at
36
+ * the bottom. The close button sits on the muted 16 % fill as a circle
37
+ * inside the band's padding, in the text color, and keeps its square size
38
+ * and touch target; a hover darkens the fill where the pointer can hover.
39
+ * Forced colors keep the hairline and outline the dialog, since its shadow
40
+ * is not drawn there.
41
+ */
42
+ export function cssDialogBandedClasses() {
43
+ return `${banded} {
44
+ backdrop-filter: none;
45
+ -webkit-backdrop-filter: none;
46
+ background: var(--sw-color-surface);
47
+ border-color: transparent;
48
+ box-shadow: var(--sw-elevation-md);
49
+ }
50
+
51
+ ${banded} .sw-dialog-header {
52
+ align-items: center;
53
+ background: var(--sw-color-surface);
54
+ border-bottom: 1px solid var(--sw-color-border);
55
+ margin: ${bleed} ${bleed} 0;
56
+ padding: var(--sw-space-4) var(--sw-space-5);
57
+ position: sticky;
58
+ top: ${bleed};
59
+ ${zIndex('topChrome')}
60
+ }
61
+
62
+ ${sheetBandRules()}
63
+
64
+ ${banded} .sw-button.sw-dialog-close {
65
+ background: ${quietFill};
66
+ border-radius: var(--sw-radius-pill);
67
+ color: var(--sw-color-text);
68
+ margin: 0;
69
+ }
70
+
71
+ @media (hover: hover) {
72
+ ${banded} .sw-button.sw-dialog-close:hover {
73
+ background: color-mix(in srgb, var(--sw-color-muted) 24%, transparent);
74
+ }
75
+ }
76
+
77
+ @media (forced-colors: active) {
78
+ ${banded} { border-color: CanvasText; }
79
+ ${banded} .sw-dialog-header { border-bottom-color: CanvasText; }
80
+ }`;
81
+ }
82
+ export function dialogBandedClassCatalog() {
83
+ return [dialogBandedClass];
84
+ }
@@ -0,0 +1,2 @@
1
+ export declare function cssFieldSearchClasses(): string;
2
+ export declare function fieldSearchClassCatalog(): string[];
@@ -0,0 +1,118 @@
1
+ import { coarsePointerQuery, touchTarget } from './touch-target.js';
2
+ /*
3
+ * A search field is the adorned frame (the control surface, its focus
4
+ * ring, its danger and disabled looks) with the consumer's glyph in the
5
+ * muted colour at its start, a space-2 gap, and a clear button at its end:
6
+ * a muted disc with a cross in the surface colour, centred in an xs control
7
+ * square (the 44 px target on a coarse pointer) that reaches the frame's
8
+ * edge. The browser's own clear button and search glyph are hidden, so the
9
+ * field shows one of each.
10
+ */
11
+ export function cssFieldSearchClasses() {
12
+ return `.sw-field-adorned.sw-field-search {
13
+ gap: var(--sw-space-2);
14
+ padding-inline-end: 0;
15
+ }
16
+
17
+ .sw-field-search-leading {
18
+ color: var(--sw-color-muted);
19
+ display: inline-flex;
20
+ flex: none;
21
+ }
22
+
23
+ [data-theme] .sw-field-search > input[type='search'] {
24
+ appearance: none;
25
+ -webkit-appearance: none;
26
+ }
27
+
28
+ .sw-field-search > input[type='search']::-webkit-search-cancel-button,
29
+ .sw-field-search > input[type='search']::-webkit-search-decoration {
30
+ -webkit-appearance: none;
31
+ appearance: none;
32
+ display: none;
33
+ }
34
+
35
+ .sw-field-search > input:last-child {
36
+ margin-inline-end: var(--sw-control-md-padding-inline);
37
+ }
38
+
39
+ .sw-field-search-clear {
40
+ align-items: center;
41
+ align-self: stretch;
42
+ appearance: none;
43
+ background: transparent;
44
+ border: 0;
45
+ border-radius: var(--sw-radius-sm);
46
+ color: inherit;
47
+ cursor: pointer;
48
+ display: inline-flex;
49
+ flex: none;
50
+ justify-content: center;
51
+ margin: 0;
52
+ min-width: var(--sw-control-xs-min-height);
53
+ padding: 0 var(--sw-space-2);
54
+ }
55
+
56
+ .sw-field-search-clear:focus-visible {
57
+ outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
58
+ outline-offset: calc(-1 * var(--sw-focus-ring-width));
59
+ }
60
+
61
+ /* One ring at a time: the clear button's own while it has focus. */
62
+ .sw-field-search:has(.sw-field-search-clear:focus-visible) {
63
+ outline: none;
64
+ }
65
+
66
+ .sw-field-search-clear:hover .sw-field-search-cross {
67
+ background: var(--sw-color-text);
68
+ }
69
+
70
+ .sw-field-xs .sw-field-search > input:last-child {
71
+ margin-inline-end: var(--sw-control-xs-padding-inline);
72
+ }
73
+
74
+ .sw-field-search-cross {
75
+ background: var(--sw-color-muted);
76
+ border-radius: var(--sw-radius-pill);
77
+ display: inline-block;
78
+ height: var(--sw-space-4);
79
+ position: relative;
80
+ width: var(--sw-space-4);
81
+ }
82
+
83
+ .sw-field-search-cross::before,
84
+ .sw-field-search-cross::after {
85
+ background: var(--sw-color-surface);
86
+ border-radius: 1px;
87
+ content: '';
88
+ height: 2px;
89
+ inset: 0;
90
+ margin: auto;
91
+ position: absolute;
92
+ width: calc(var(--sw-space-2) + 2px);
93
+ }
94
+
95
+ .sw-field-search-cross::before { transform: rotate(45deg); }
96
+ .sw-field-search-cross::after { transform: rotate(-45deg); }
97
+
98
+ @media ${coarsePointerQuery} {
99
+ .sw-field-search-clear { min-width: ${touchTarget}; }
100
+ }
101
+
102
+ @media (forced-colors: active) {
103
+ .sw-field-search-leading { color: FieldText; }
104
+ /* Backgrounds are forced in this mode; the disc keeps its own system colours. */
105
+ .sw-field-search-cross { background: ButtonText; forced-color-adjust: none; }
106
+ .sw-field-search-cross::before,
107
+ .sw-field-search-cross::after { background: ButtonFace; }
108
+ }`;
109
+ }
110
+ export function fieldSearchClassCatalog() {
111
+ return [
112
+ 'sw-field-search-field',
113
+ 'sw-field-search',
114
+ 'sw-field-search-leading',
115
+ 'sw-field-search-clear',
116
+ 'sw-field-search-cross',
117
+ ];
118
+ }
@@ -1,6 +1,7 @@
1
1
  import { typographyVariants } from '@scalewing/tokens';
2
2
  import { controlSurface, disabledControlForcedColors, disabledControlSurface, } from './css-document.js';
3
3
  import { cssFieldChangedClasses } from './css-field-changed.js';
4
+ import { cssFieldSearchClasses, fieldSearchClassCatalog, } from './css-field-search.js';
4
5
  const caption = typographyVariants.caption;
5
6
  /*
6
7
  * A prefix or suffix sits inside the control frame: the wrapper draws the
@@ -83,6 +84,8 @@ export function cssFieldClasses() {
83
84
 
84
85
  ${adornmentRules()}
85
86
 
87
+ ${cssFieldSearchClasses()}
88
+
86
89
  ${cssFieldChangedClasses()}
87
90
 
88
91
  @media (forced-colors: active) {
@@ -106,5 +109,6 @@ export function fieldClassCatalog() {
106
109
  'sw-field-adorned',
107
110
  'sw-field-prefix',
108
111
  'sw-field-suffix',
112
+ ...fieldSearchClassCatalog(),
109
113
  ];
110
114
  }
@@ -1,6 +1,7 @@
1
1
  import { typographyVariants } from '@scalewing/tokens';
2
2
  import { chevronStroke } from './chevron.js';
3
3
  import { zIndex } from './stacking.js';
4
+ import { quietFill } from './quiet-fill.js';
4
5
  const label = typographyVariants.label;
5
6
  const body = typographyVariants.body;
6
7
  /*
@@ -120,7 +121,7 @@ export function cssMultiSelectClasses() {
120
121
  }
121
122
 
122
123
  .sw-multi-select-option:hover {
123
- background: color-mix(in srgb, var(--sw-color-muted) 16%, transparent);
124
+ background: ${quietFill};
124
125
  }
125
126
 
126
127
  .sw-multi-select-icon {
@@ -0,0 +1,13 @@
1
+ export declare const navAppearances: readonly ["default", "words"];
2
+ /**
3
+ * How a Nav draws its destinations: `default` keeps each link or Button's
4
+ * own look; `words` sets every destination as plain words, the others in
5
+ * the muted color at medium weight and the current one (`aria-current`)
6
+ * in the text color at label weight, with no fill, visible border or
7
+ * underline. The words must be visible: a glyph-only destination keeps
8
+ * `default`.
9
+ */
10
+ export type NavAppearance = (typeof navAppearances)[number];
11
+ export declare const navWordsClass = "sw-nav-words";
12
+ export declare function cssNavWordsClasses(): string;
13
+ export declare function navWordsClassCatalog(): string[];
@@ -0,0 +1,51 @@
1
+ import { typographyVariants } from '@scalewing/tokens';
2
+ const label = typographyVariants.label;
3
+ export const navAppearances = ['default', 'words'];
4
+ export const navWordsClass = 'sw-nav-words';
5
+ const words = `.sw-nav.${navWordsClass}`;
6
+ const destinations = `:is(a, .sw-button)`;
7
+ const current = `[aria-current]:not([aria-current='false'])`;
8
+ /*
9
+ * Words-only destinations. A Button keeps its size, padding, touch target
10
+ * and focus ring; only its fill, border color and color go, so a primary
11
+ * or ghost Button in the Nav reads the same. Links lose the canvas's accent
12
+ * and underline, and take a transparent hairline border like a Button's.
13
+ * `:is()` counts as its most specific argument, so the selector is three
14
+ * classes (0,3,0): it outranks a Button's variant and the canvas's link
15
+ * rules. The current destination differs by color and weight, so the
16
+ * words must be visible: a glyph-only destination has no weight to change
17
+ * (keep `default` for those). Hover lifts the color only where the pointer
18
+ * hovers, and never on a disabled destination. Forced colors draw the
19
+ * current one's border in Highlight and underline its words, since color
20
+ * and weight may not show there.
21
+ */
22
+ export function cssNavWordsClasses() {
23
+ return `${words} ${destinations} {
24
+ background: transparent;
25
+ border: 1px solid transparent;
26
+ color: var(--sw-color-muted);
27
+ font-size: ${label.fontSize}px;
28
+ font-weight: 500;
29
+ letter-spacing: ${label.letterSpacing}px;
30
+ line-height: ${label.lineHeight}px;
31
+ text-decoration: none;
32
+ }
33
+
34
+ @media (hover: hover) {
35
+ ${words} ${destinations}:hover:not(:disabled, [aria-disabled='true']) {
36
+ color: var(--sw-color-text);
37
+ }
38
+ }
39
+
40
+ ${words} ${destinations}${current} {
41
+ color: var(--sw-color-text);
42
+ font-weight: ${label.fontWeight};
43
+ }
44
+
45
+ @media (forced-colors: active) {
46
+ ${words} ${destinations}${current} { border-color: Highlight; text-decoration: underline; }
47
+ }`;
48
+ }
49
+ export function navWordsClassCatalog() {
50
+ return [navWordsClass];
51
+ }
@@ -1,22 +1,15 @@
1
+ import { type TintColor } from './tone-tint.js';
1
2
  export declare const noticeTones: readonly ["info", "success", "warning", "danger"];
2
3
  export declare const noticeVariants: readonly ["default", "band"];
3
4
  /** `default` is a rounded note in the flow; `band` a full-width strip of page chrome. */
4
5
  export type NoticeVariant = (typeof noticeVariants)[number];
5
6
  /** The notice's meaning: information, a good outcome, a caution, a refusal. */
6
7
  export type NoticeTone = (typeof noticeTones)[number];
7
- /**
8
- * How much of a tone's color the notice's fill mixes into the surface. Info
9
- * uses the derived accent tint instead (ADR 0011), which already keeps the
10
- * accent readable on every palette.
11
- */
8
+ /** How much of a tone's color the notice's fill mixes into the surface. */
12
9
  export declare const noticeTintShare = 0.1;
13
- /**
14
- * How far the notice's words move from the tone's color toward the text
15
- * color, so they read darker than the tone on a light fill (lighter on a
16
- * dark one) and keep 4.5:1 on the tint (`notice.test.tsx`).
17
- */
10
+ /** How far the notice's words move from the tone's color toward the text color. */
18
11
  export declare const noticeInkTextShare = 0.3;
19
12
  /** The semantic color a tone is drawn from. */
20
- export declare function noticeToneColor(tone: NoticeTone): string;
13
+ export declare function noticeToneColor(tone: NoticeTone): TintColor;
21
14
  export declare function cssNoticeClasses(): string;
22
15
  export declare function noticeClassCatalog(): string[];
@@ -1,34 +1,18 @@
1
1
  import { typographyVariants } from '@scalewing/tokens';
2
+ import { toneInkTextShare, toneTintFill, toneTintInk, toneTintShare, } from './tone-tint.js';
2
3
  export const noticeTones = ['info', 'success', 'warning', 'danger'];
3
4
  export const noticeVariants = ['default', 'band'];
4
- /**
5
- * How much of a tone's color the notice's fill mixes into the surface. Info
6
- * uses the derived accent tint instead (ADR 0011), which already keeps the
7
- * accent readable on every palette.
8
- */
9
- export const noticeTintShare = 0.1;
10
- /**
11
- * How far the notice's words move from the tone's color toward the text
12
- * color, so they read darker than the tone on a light fill (lighter on a
13
- * dark one) and keep 4.5:1 on the tint (`notice.test.tsx`).
14
- */
15
- export const noticeInkTextShare = 0.3;
5
+ /** How much of a tone's color the notice's fill mixes into the surface. */
6
+ export const noticeTintShare = toneTintShare;
7
+ /** How far the notice's words move from the tone's color toward the text color. */
8
+ export const noticeInkTextShare = toneInkTextShare;
16
9
  /** The semantic color a tone is drawn from. */
17
10
  export function noticeToneColor(tone) {
18
11
  return tone === 'info' ? 'accent' : tone;
19
12
  }
20
- function toneFill(tone) {
21
- if (tone === 'info')
22
- return 'var(--sw-color-accentSubtle)';
23
- return `color-mix(in srgb, var(--sw-color-${tone}) ${noticeTintShare * 100}%, var(--sw-color-surface))`;
24
- }
25
- function toneInk(tone) {
26
- const toneShare = Math.round((1 - noticeInkTextShare) * 100);
27
- return `color-mix(in srgb, var(--sw-color-${noticeToneColor(tone)}) ${toneShare}%, var(--sw-color-text))`;
28
- }
29
13
  function toneRules() {
30
14
  return noticeTones
31
- .map((tone) => `.sw-notice-${tone} { --sw-notice-fill: ${toneFill(tone)}; --sw-notice-ink: ${toneInk(tone)}; }`)
15
+ .map((tone) => `.sw-notice-${tone} { --sw-notice-fill: ${toneTintFill(noticeToneColor(tone))}; --sw-notice-ink: ${toneTintInk(noticeToneColor(tone))}; }`)
32
16
  .join('\n');
33
17
  }
34
18
  const label = typographyVariants.label;
@@ -0,0 +1,3 @@
1
+ export declare const segmentedRaisedClass = "sw-segmented-raised";
2
+ export declare function cssSegmentedRaisedClasses(): string;
3
+ export declare function segmentedRaisedClassCatalog(): string[];
@@ -0,0 +1,72 @@
1
+ import { trackInset, typographyVariants } from '@scalewing/tokens';
2
+ import { quietFill } from './quiet-fill.js';
3
+ const label = typographyVariants.label;
4
+ export const segmentedRaisedClass = 'sw-segmented-raised';
5
+ const raised = `.sw-segmented.${segmentedRaisedClass}`;
6
+ /*
7
+ * The raised track: the quiet grey fill (no border) with corners one track
8
+ * inset rounder than the segments' small radius, so the two curves stay
9
+ * concentric, sized to its segments even in a Stack (unlike compact).
10
+ * Every segment is the md control height in label type with its words in
11
+ * the text color at medium weight; with marks, a segment pads a step less
12
+ * before its mark. The selected one is the surface raised by the small
13
+ * elevation, its words at label weight. In the dark scheme a shadow does
14
+ * not show and the surface is about the track's grey, so the selected
15
+ * segment draws a hairline ring in the muted color instead (3:1 or more
16
+ * against the track in every dark palette, on the canvas or a card). Two classes,
17
+ * so these win over the compact track's rules and the reduced-transparency
18
+ * surface; the track's transparent border would also win over the error
19
+ * outline (`.sw-segmented[aria-invalid='true']`, the same specificity,
20
+ * earlier), so the danger border, and Mark in forced colors, is restated
21
+ * last. Forced colors outline the track and the selected segment.
22
+ */
23
+ export function cssSegmentedRaisedClasses() {
24
+ return `${raised} {
25
+ background: ${quietFill};
26
+ border-color: transparent;
27
+ border-radius: calc(var(--sw-radius-sm) + ${trackInset}px);
28
+ }
29
+
30
+ /* Sized to its segments even where the field is stretched (a Stack). */
31
+ .sw-segmented-field > ${raised} {
32
+ align-self: flex-start;
33
+ }
34
+
35
+ ${raised} .sw-segmented-item {
36
+ border-radius: var(--sw-radius-sm);
37
+ color: var(--sw-color-text);
38
+ font-size: ${label.fontSize}px;
39
+ font-weight: 500;
40
+ letter-spacing: ${label.letterSpacing}px;
41
+ line-height: ${label.lineHeight}px;
42
+ min-height: var(--sw-control-md-min-height);
43
+ padding-inline: var(--sw-space-4);
44
+ }
45
+
46
+ ${raised}.sw-segmented-with-icons .sw-segmented-item {
47
+ padding-inline: var(--sw-space-2) var(--sw-space-3);
48
+ }
49
+
50
+ ${raised} .sw-segmented-item-selected {
51
+ background: var(--sw-color-surface);
52
+ box-shadow: var(--sw-elevation-sm);
53
+ font-weight: ${label.fontWeight};
54
+ }
55
+
56
+ [data-theme='dark'] ${raised} .sw-segmented-item-selected {
57
+ box-shadow: inset 0 0 0 1px var(--sw-color-muted);
58
+ }
59
+
60
+ ${raised}[aria-invalid='true'] {
61
+ border-color: var(--sw-color-danger);
62
+ }
63
+
64
+ @media (forced-colors: active) {
65
+ ${raised} { border-color: CanvasText; }
66
+ ${raised} .sw-segmented-item-selected { outline: 2px solid Highlight; }
67
+ ${raised}[aria-invalid='true'] { border-color: Mark; }
68
+ }`;
69
+ }
70
+ export function segmentedRaisedClassCatalog() {
71
+ return [segmentedRaisedClass];
72
+ }
@@ -1,4 +1,5 @@
1
1
  import { trackInset, typographyVariants } from '@scalewing/tokens';
2
+ import { cssSegmentedRaisedClasses, segmentedRaisedClassCatalog, } from './css-segmented-raised.js';
2
3
  const body = typographyVariants.body;
3
4
  const data = typographyVariants.data;
4
5
  const label = typographyVariants.label;
@@ -9,13 +10,15 @@ const label = typographyVariants.label;
9
10
  * the row stays even; the track is the subtle fill (two classes, so
10
11
  * reduced transparency keeps it) and the selected item is the surface
11
12
  * raised by the small elevation, so the choice shows on a white canvas
12
- * too. A filled track keeps its own look and only gains the marks. The
13
- * error outline is restated after these rules so an icon track keeps it.
13
+ * too. A filled or raised track keeps its own look and only gains the
14
+ * marks (one `:not()` of both, so the compact rules keep their
15
+ * specificity). The error outline is restated after these rules so an
16
+ * icon track keeps it.
14
17
  * In forced colours the selected item is outlined in Highlight; a focused
15
18
  * selected item keeps that outline, offset by the focus ring's offset.
16
19
  */
17
20
  function iconRules() {
18
- const compact = '.sw-segmented-with-icons:not(.sw-segmented-filled)';
21
+ const compact = '.sw-segmented-with-icons:not(.sw-segmented-filled, .sw-segmented-raised)';
19
22
  return `.sw-segmented${compact} {
20
23
  background: var(--sw-color-subtle);
21
24
  border-color: transparent;
@@ -162,6 +165,8 @@ export function cssSegmentedClasses() {
162
165
 
163
166
  ${iconRules()}
164
167
 
168
+ ${cssSegmentedRaisedClasses()}
169
+
165
170
  .sw-segmented-disabled {
166
171
  opacity: var(--sw-disabled-opacity);
167
172
  }
@@ -181,5 +186,6 @@ export function segmentedClassCatalog() {
181
186
  'sw-segmented-with-icons',
182
187
  'sw-segmented-item-icon',
183
188
  'sw-segmented-disabled',
189
+ ...segmentedRaisedClassCatalog(),
184
190
  ];
185
191
  }
@@ -1,6 +1,7 @@
1
1
  import { typographyVariants } from '@scalewing/tokens';
2
2
  import { chevronStroke } from './chevron.js';
3
3
  import { zIndex } from './stacking.js';
4
+ import { quietFill } from './quiet-fill.js';
4
5
  const caption = typographyVariants.caption;
5
6
  const label = typographyVariants.label;
6
7
  export function cssSelectClasses() {
@@ -172,7 +173,7 @@ export function cssSelectClasses() {
172
173
  }
173
174
 
174
175
  .sw-select-option[data-active='true'] {
175
- background: color-mix(in srgb, var(--sw-color-muted) 16%, transparent);
176
+ background: ${quietFill};
176
177
  }
177
178
 
178
179
  .sw-select-xs .sw-select-option {
@@ -1,3 +1,4 @@
1
+ import { quietFill } from './quiet-fill.js';
1
2
  export function cssSplitClasses() {
2
3
  return `.sw-split {
3
4
  align-items: stretch;
@@ -39,7 +40,7 @@ export function cssSplitClasses() {
39
40
 
40
41
  .sw-split-handle:hover,
41
42
  .sw-split-handle:focus-visible {
42
- background: color-mix(in srgb, var(--sw-color-muted) 16%, transparent);
43
+ background: ${quietFill};
43
44
  }
44
45
 
45
46
  .sw-split-handle:focus-visible {
@@ -25,6 +25,12 @@ function stateRules() {
25
25
  background-image: ${changedTintLayer};
26
26
  }
27
27
 
28
+ /* A plain limit: − at min and + at max keep their look, still disabled. */
29
+ .sw-stepper-limit-plain .sw-stepper-button:disabled {
30
+ cursor: default;
31
+ opacity: 1;
32
+ }
33
+
28
34
  /* Read-only: the buttons keep their room, so the count lines up with an editable one. */
29
35
  .sw-stepper-readonly .sw-stepper-button { visibility: hidden; }
30
36
 
@@ -122,5 +128,6 @@ export function stepperClassCatalog() {
122
128
  'sw-stepper-invalid',
123
129
  'sw-stepper-changed',
124
130
  'sw-stepper-readonly',
131
+ 'sw-stepper-limit-plain',
125
132
  ];
126
133
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The quiet grey fill: the muted color at 16 % over whatever is beneath
3
+ * (about #E8E8E9 on white). An open menu or list row, a held separator,
4
+ * today's calendar ring fill, a neutral button and a banded dialog's close
5
+ * button all take it, so they read as one grey.
6
+ */
7
+ export declare const quietFill = "color-mix(in srgb, var(--sw-color-muted) 16%, transparent)";