@finstack-com-public/design 0.10.2 → 0.11.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 (54) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/dist/css/checkbox.css +3 -1
  3. package/dist/css/combobox.css +58 -0
  4. package/dist/css/combobox.md +75 -0
  5. package/dist/css/data-type.md +1 -1
  6. package/dist/css/diag.md +1 -1
  7. package/dist/css/drag.css +7 -0
  8. package/dist/css/drag.md +2 -0
  9. package/dist/css/grid.css +4 -0
  10. package/dist/css/input.md +6 -1
  11. package/dist/css/pill.css +7 -0
  12. package/dist/css/select.css +103 -0
  13. package/dist/css/select.md +69 -0
  14. package/dist/css/slider.css +169 -0
  15. package/dist/css/slider.md +87 -0
  16. package/dist/css/stacked-bar.css +16 -0
  17. package/dist/css/switch.css +137 -0
  18. package/dist/css/switch.md +28 -0
  19. package/dist/css/tokens.css +3 -3
  20. package/dist/css-text/checkbox.js +1 -1
  21. package/dist/css-text/combobox.d.ts +2 -0
  22. package/dist/css-text/combobox.js +1 -0
  23. package/dist/css-text/drag.js +1 -1
  24. package/dist/css-text/grid.js +1 -1
  25. package/dist/css-text/kit.js +511 -4
  26. package/dist/css-text/pill.js +1 -1
  27. package/dist/css-text/select.d.ts +2 -0
  28. package/dist/css-text/select.js +1 -0
  29. package/dist/css-text/slider.d.ts +2 -0
  30. package/dist/css-text/slider.js +1 -0
  31. package/dist/css-text/stacked-bar.js +1 -1
  32. package/dist/css-text/switch.d.ts +2 -0
  33. package/dist/css-text/switch.js +1 -0
  34. package/dist/css-text/tokens.js +1 -1
  35. package/dist/dom/combobox.d.ts +47 -0
  36. package/dist/dom/combobox.js +178 -0
  37. package/dist/dom/index.d.ts +3 -0
  38. package/dist/dom/index.js +3 -0
  39. package/dist/dom/listbox.d.ts +11 -0
  40. package/dist/dom/listbox.js +9 -3
  41. package/dist/dom/select.d.ts +39 -0
  42. package/dist/dom/select.js +221 -0
  43. package/dist/dom/slider.d.ts +51 -0
  44. package/dist/dom/slider.js +256 -0
  45. package/dist/grid.json +1 -1
  46. package/dist/kit.css +511 -4
  47. package/dist/react/actions.js +12 -6
  48. package/dist/react/inputs.d.ts +181 -0
  49. package/dist/react/inputs.js +291 -15
  50. package/dist/react/navigation.js +33 -15
  51. package/dist/tokens/contrast-pairs.js +24 -0
  52. package/dist/tokens/grid.js +1 -1
  53. package/dist/tokens.json +1 -1
  54. package/package.json +2 -1
package/dist/kit.css CHANGED
@@ -165,7 +165,7 @@
165
165
  --fs-grid-error-bg: #fdecea;
166
166
  --fs-grid-negative-ink: #c62828;
167
167
  --fs-grid-stale-ink: #5f5e5a;
168
- --fs-grid-stale-dot: #f9a825;
168
+ --fs-grid-stale-dot: #c27c00;
169
169
  --fs-grid-dirty-ink: #3d3db4;
170
170
  --fs-grid-invalid-ink: #c62828;
171
171
  --fs-grid-selected: #3d3db4;
@@ -705,7 +705,7 @@
705
705
  --fs-grid-error-bg: #fdecea;
706
706
  --fs-grid-negative-ink: #c62828;
707
707
  --fs-grid-stale-ink: #5f5e5a;
708
- --fs-grid-stale-dot: #f9a825;
708
+ --fs-grid-stale-dot: #c27c00;
709
709
  --fs-grid-dirty-ink: #3d3db4;
710
710
  --fs-grid-invalid-ink: #c62828;
711
711
  --fs-grid-selected: #3d3db4;
@@ -1080,7 +1080,7 @@
1080
1080
  --fs-grid-error-bg: #fdecea;
1081
1081
  --fs-grid-negative-ink: #c62828;
1082
1082
  --fs-grid-stale-ink: #5f5e5a;
1083
- --fs-grid-stale-dot: #f9a825;
1083
+ --fs-grid-stale-dot: #c27c00;
1084
1084
  --fs-grid-dirty-ink: #3d3db4;
1085
1085
  --fs-grid-invalid-ink: #c62828;
1086
1086
  --fs-grid-selected: #3d3db4;
@@ -1849,7 +1849,9 @@
1849
1849
  content: '';
1850
1850
  position: absolute;
1851
1851
  inset: 0;
1852
- background: var(--fs-ink-on-accent);
1852
+ /* The mark is the surface colour on the accent (I21): white in light as before; in dark the navy surface,
1853
+ 8.1:1 on the light-blue accent where white was 2.0:1. Not ink-on-accent, which products read for text. */
1854
+ background: var(--fs-bg-surface);
1853
1855
  visibility: hidden;
1854
1856
  }
1855
1857
  .fs-checkbox__input::before {
@@ -2168,6 +2170,65 @@
2168
2170
  }
2169
2171
  }
2170
2172
 
2173
+ /* Editable combobox (spec 02 B; F2 draft §1, T133): a text input with list autocomplete. Usage:
2174
+ combobox.md. Behaviour: createCombobox. The input is a plain .fs-input (input.css: height, fill,
2175
+ edge, hover, ring, invalid, read-only, disabled); the popup is the completion list's
2176
+ .fs-menu--listbox (menu.css), grouped options included. */
2177
+ @layer fs.components {
2178
+ .fs-combobox {
2179
+ position: relative;
2180
+ display: block;
2181
+ min-width: 0;
2182
+ }
2183
+ /* Room for the toggle at the input's end. */
2184
+ .fs-combobox:has(> .fs-combobox__toggle) > .fs-input {
2185
+ padding-right: calc(var(--fs-size-touch) + var(--fs-space-1));
2186
+ }
2187
+
2188
+ /* The toggle: a row icon button (24 px target) inside the input's end, out of the tab order. Its
2189
+ chevron is a mask on currentColor, as the select's, so it follows the system colours. */
2190
+ .fs-combobox__toggle {
2191
+ position: absolute;
2192
+ top: calc((var(--fs-control-h) - var(--fs-size-touch)) / 2);
2193
+ right: calc((var(--fs-control-h) - var(--fs-size-touch)) / 2);
2194
+ }
2195
+ .fs-combobox__toggle::before {
2196
+ content: '';
2197
+ width: 16px;
2198
+ height: 16px;
2199
+ background-color: currentColor;
2200
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.875' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
2201
+ center / contain no-repeat;
2202
+ }
2203
+ .fs-combobox__toggle[aria-expanded='true']::before {
2204
+ transform: rotate(180deg);
2205
+ }
2206
+
2207
+ /* Read-only: no toggle (the input already has no edge). */
2208
+ .fs-combobox:has(> .fs-input:read-only:not(:disabled)) > .fs-combobox__toggle {
2209
+ display: none;
2210
+ }
2211
+
2212
+ /* Disabled last: by colour, never opacity; the toggle takes no presses. */
2213
+ .fs-combobox:has(> .fs-input:disabled) > .fs-combobox__toggle {
2214
+ color: var(--fs-ink-disabled);
2215
+ background-color: transparent;
2216
+ cursor: not-allowed;
2217
+ pointer-events: none;
2218
+ }
2219
+
2220
+ /* Forced colours: the current option keeps a Highlight outline (the input and the chevron are
2221
+ drawn by the system already); a disabled toggle is GrayText. */
2222
+ @media (forced-colors: active) {
2223
+ .fs-combobox .fs-menu__item[aria-selected='true'] {
2224
+ outline-color: Highlight;
2225
+ }
2226
+ .fs-combobox:has(> .fs-input:disabled) > .fs-combobox__toggle {
2227
+ color: GrayText;
2228
+ }
2229
+ }
2230
+ }
2231
+
2171
2232
  /* Control-row grid: filters, parameters and the property list (spec 02 B, T73). Usage: control-rows.md. */
2172
2233
  @layer fs.components {
2173
2234
  /* A stack of sections (Szűrők, then Paraméterek), 12 apart. */
@@ -2759,6 +2820,13 @@
2759
2820
  background: var(--fs-danger-wash);
2760
2821
  outline-color: var(--fs-danger-fill);
2761
2822
  }
2823
+ /* Forced colours drops the wash and paints both outlines in the text colour: refused is a thicker dashed outline. */
2824
+ @media (forced-colors: active) {
2825
+ .fs-drag-ghost.fs-is-refused {
2826
+ outline: 4px dashed CanvasText;
2827
+ outline-offset: -4px;
2828
+ }
2829
+ }
2762
2830
 
2763
2831
  .fs-add-cell {
2764
2832
  display: grid;
@@ -3661,6 +3729,10 @@
3661
3729
  outline: var(--fs-line-width) dashed CanvasText;
3662
3730
  outline-offset: -3px;
3663
3731
  }
3732
+ /* A fill becomes Canvas here, so the stale dot would vanish (I23). */
3733
+ .fs-grid .fs-cell--stale::before {
3734
+ background: CanvasText;
3735
+ }
3664
3736
  }
3665
3737
  }
3666
3738
 
@@ -5107,6 +5179,13 @@
5107
5179
  --fs-pill-wash: var(--fs-mark-none-wash);
5108
5180
  --fs-pill-dot: var(--fs-mark-none-fill);
5109
5181
  }
5182
+
5183
+ /* A fill becomes Canvas here, so the dot would vanish (I23); the word carries the tone. */
5184
+ @media (forced-colors: active) {
5185
+ .fs-pill--dot::before {
5186
+ background: CanvasText;
5187
+ }
5188
+ }
5110
5189
  }
5111
5190
 
5112
5191
  /* Popover (spec 02 D). Usage: popover.md. Behaviour: createPopover. */
@@ -5442,6 +5521,110 @@
5442
5521
  }
5443
5522
  }
5444
5523
 
5524
+ /* Custom select (spec 02 B; F2 draft §2, T132): a select-only combobox. Usage: select.md.
5525
+ Behaviour: createSelect. The trigger also carries .fs-select__control (input.css), so it takes the
5526
+ native select's height, fill, edge, hover, ring and invalid edge; the popup is the completion
5527
+ list's .fs-menu--listbox (menu.css). */
5528
+ @layer fs.components {
5529
+ .fs-select__trigger {
5530
+ display: flex;
5531
+ align-items: center;
5532
+ min-width: 0;
5533
+ text-align: left;
5534
+ user-select: none;
5535
+ }
5536
+ .fs-select__value,
5537
+ .fs-select__placeholder {
5538
+ flex: 1 1 auto;
5539
+ min-width: 0;
5540
+ overflow: hidden;
5541
+ text-overflow: ellipsis;
5542
+ white-space: nowrap;
5543
+ }
5544
+ .fs-select__placeholder {
5545
+ color: var(--fs-ink-muted);
5546
+ }
5547
+ /* The chevron sits in the trigger's row, whatever else the wrapper holds (the list, a hidden input). */
5548
+ .fs-select--listbox::after {
5549
+ bottom: auto;
5550
+ margin: 0;
5551
+ top: calc((var(--fs-control-h) - 16px) / 2);
5552
+ }
5553
+ .fs-select--listbox:has(> [aria-expanded='true'])::after {
5554
+ transform: rotate(180deg);
5555
+ }
5556
+
5557
+ /* The value's option: weight 600 and a 16 px check at its end (aria-selected marks only the
5558
+ current option while open, APG). Every option keeps the check's column, so rows line up. */
5559
+ .fs-select--listbox .fs-menu__item[role='option']::after {
5560
+ content: '';
5561
+ flex: none;
5562
+ width: 16px;
5563
+ height: 16px;
5564
+ margin-left: var(--fs-space-2);
5565
+ }
5566
+ .fs-select--listbox .fs-menu__item[role='option']:not(:has(.fs-menu__detail))::after {
5567
+ margin-left: auto;
5568
+ }
5569
+ .fs-select--listbox .fs-menu__item.fs-is-value {
5570
+ font-weight: var(--fs-weight-semibold);
5571
+ }
5572
+ .fs-select--listbox .fs-menu__item.fs-is-value::after {
5573
+ background-color: var(--fs-accent);
5574
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
5575
+ center / contain no-repeat;
5576
+ }
5577
+
5578
+ /* Read-only: no edge, no chevron, the value in full ink (as a read-only input). */
5579
+ .fs-select__trigger[aria-readonly='true'] {
5580
+ background-color: transparent;
5581
+ border-color: transparent;
5582
+ cursor: default;
5583
+ }
5584
+ .fs-select--listbox:has(> [aria-readonly='true'])::after {
5585
+ content: none;
5586
+ }
5587
+
5588
+ /* Disabled last: by colour, never opacity. It stays focusable (aria-disabled). */
5589
+ .fs-select__trigger[aria-disabled='true'] {
5590
+ color: var(--fs-ink-disabled);
5591
+ background-color: var(--fs-bg-disabled);
5592
+ border-color: var(--fs-line);
5593
+ cursor: not-allowed;
5594
+ }
5595
+ .fs-select__trigger[aria-disabled='true'] .fs-select__placeholder {
5596
+ color: var(--fs-ink-disabled);
5597
+ }
5598
+ .fs-select--listbox:has(> [aria-disabled='true']) {
5599
+ color: var(--fs-ink-disabled);
5600
+ }
5601
+
5602
+ /* Forced colours: the trigger is a div, so the system draws no control edge for it: give it one.
5603
+ The check is drawn in a system colour; the current option keeps the Highlight outline. */
5604
+ @media (forced-colors: active) {
5605
+ .fs-select__trigger {
5606
+ border: var(--fs-line-width) solid ButtonText;
5607
+ }
5608
+ .fs-select__trigger[aria-readonly='true'] {
5609
+ border-color: transparent;
5610
+ }
5611
+ .fs-select--listbox .fs-menu__item.fs-is-value::after {
5612
+ background-color: CanvasText;
5613
+ }
5614
+ .fs-select--listbox .fs-menu__item[aria-selected='true'] {
5615
+ outline-color: Highlight;
5616
+ }
5617
+ .fs-select__trigger[aria-disabled='true'],
5618
+ .fs-select__trigger[aria-disabled='true'] .fs-select__placeholder {
5619
+ color: GrayText;
5620
+ border-color: GrayText;
5621
+ }
5622
+ .fs-select--listbox:has(> [aria-disabled='true'])::after {
5623
+ background-color: GrayText;
5624
+ }
5625
+ }
5626
+ }
5627
+
5445
5628
  /* Side sheet: modal on <dialog>, or docked as a pane (spec 02 D). Usage: sheet.md. Behaviour: createSheet. */
5446
5629
  @layer fs.components {
5447
5630
  .fs-sheet {
@@ -5642,6 +5825,176 @@
5642
5825
  }
5643
5826
  }
5644
5827
 
5828
+ /* Slider and range slider (spec 02 B; F2 draft §4, T134). Usage: slider.md. Behaviour: createSlider,
5829
+ which writes each thumb's place (--fs-slider-at) and the fill's ends (--fs-slider-low, --fs-slider-high). */
5830
+ @layer fs.components {
5831
+ .fs-slider {
5832
+ --fs-slider-track-h: 4px;
5833
+ --fs-slider-thumb: var(--fs-icon-size);
5834
+ display: flex;
5835
+ align-items: center;
5836
+ gap: var(--fs-space-3);
5837
+ min-width: 0;
5838
+ min-height: var(--fs-control-h);
5839
+ font-size: var(--fs-text-body-size);
5840
+ line-height: var(--fs-text-body-line);
5841
+ /* A press starts a drag: the page must not scroll or select under it. */
5842
+ touch-action: none;
5843
+ user-select: none;
5844
+ }
5845
+
5846
+ /* The track: 4 px, no fill or label inside it, so --fs-line-control-strong (3:1, D30). Half a thumb
5847
+ of room at each end keeps a thumb at the minimum or maximum inside the block. */
5848
+ .fs-slider__track {
5849
+ position: relative;
5850
+ flex: 1 1 auto;
5851
+ min-width: 0;
5852
+ box-sizing: border-box;
5853
+ height: var(--fs-slider-track-h);
5854
+ margin-inline: calc(var(--fs-slider-thumb) / 2);
5855
+ background: var(--fs-line-control-strong);
5856
+ border-radius: var(--fs-radius-sm);
5857
+ cursor: pointer;
5858
+ }
5859
+ /* The band from the minimum to the value, or between the two thumbs. */
5860
+ .fs-slider__fill {
5861
+ position: absolute;
5862
+ inset-block: 0;
5863
+ inset-inline-start: var(--fs-slider-low, 0%);
5864
+ inset-inline-end: calc(100% - var(--fs-slider-high, 0%));
5865
+ background: var(--fs-accent);
5866
+ border-radius: inherit;
5867
+ }
5868
+ /* Marks at the steps the product names, under the track. */
5869
+ .fs-slider__ticks {
5870
+ position: absolute;
5871
+ inset: 0;
5872
+ pointer-events: none;
5873
+ }
5874
+ .fs-slider__ticks > * {
5875
+ position: absolute;
5876
+ top: calc(var(--fs-slider-track-h) + 2px);
5877
+ inset-inline-start: var(--fs-slider-at, 0%);
5878
+ width: 1px;
5879
+ height: 4px;
5880
+ margin-inline-start: -0.5px;
5881
+ background: var(--fs-line-control-strong);
5882
+ }
5883
+
5884
+ /* A thumb: a circle of the icon size (16 px, 20 at comfortable), a 2 px accent edge on the surface,
5885
+ its centre on the value. Its hit area is padded to the 24 px touch target (spec 06 §1). */
5886
+ .fs-slider__thumb {
5887
+ position: absolute;
5888
+ top: 50%;
5889
+ inset-inline-start: var(--fs-slider-at, 0%);
5890
+ box-sizing: border-box;
5891
+ width: var(--fs-slider-thumb);
5892
+ height: var(--fs-slider-thumb);
5893
+ margin-block-start: calc(var(--fs-slider-thumb) / -2);
5894
+ margin-inline-start: calc(var(--fs-slider-thumb) / -2);
5895
+ background: var(--fs-bg-surface);
5896
+ border: 2px solid var(--fs-accent);
5897
+ border-radius: 50%;
5898
+ cursor: grab;
5899
+ }
5900
+ .fs-slider__thumb::before {
5901
+ content: '';
5902
+ position: absolute;
5903
+ inset: calc((var(--fs-slider-thumb) - var(--fs-size-touch)) / 2 - 2px);
5904
+ border-radius: 50%;
5905
+ }
5906
+ /* --range: two thumbs. At one value, the focused one is on top. */
5907
+ .fs-slider--range .fs-slider__thumb:focus {
5908
+ z-index: 1;
5909
+ }
5910
+ @media (hover: hover) {
5911
+ .fs-slider__thumb:hover {
5912
+ border-color: var(--fs-accent-strong);
5913
+ }
5914
+ }
5915
+ /* Dragging: the helper sets .fs-is-dragging for the whole drag (pointer capture ends :active early in some engines).
5916
+ Two rules, not one list: the gallery clones a rule naming :active into a later sheet, and a list would take
5917
+ .fs-is-dragging along, past the forced-colours rule below. */
5918
+ .fs-slider__thumb.fs-is-dragging {
5919
+ background: var(--fs-bg-selected);
5920
+ border-color: var(--fs-accent-strong);
5921
+ cursor: grabbing;
5922
+ }
5923
+ .fs-slider__thumb:active {
5924
+ background: var(--fs-bg-selected);
5925
+ border-color: var(--fs-accent-strong);
5926
+ cursor: grabbing;
5927
+ }
5928
+ /* The ring recipe (D15). */
5929
+ .fs-slider__thumb:focus-visible {
5930
+ outline: var(--fs-ring-width) solid var(--fs-ring);
5931
+ outline-offset: var(--fs-ring-halo-width);
5932
+ box-shadow: 0 0 0 var(--fs-ring-halo-width) var(--fs-ring-halo);
5933
+ }
5934
+
5935
+ /* The value beside it: an <output>, in tabular figures so it doesn't jitter while moving. */
5936
+ .fs-slider__value {
5937
+ flex: none;
5938
+ color: var(--fs-ink);
5939
+ font-variant-numeric: tabular-nums;
5940
+ white-space: nowrap;
5941
+ }
5942
+
5943
+ /* Disabled comes last: by colour, never opacity. The thumbs stay reachable (aria-disabled). */
5944
+ .fs-slider:has(.fs-slider__thumb[aria-disabled='true']) {
5945
+ color: var(--fs-ink-disabled);
5946
+ }
5947
+ .fs-slider:has(.fs-slider__thumb[aria-disabled='true']) .fs-slider__track {
5948
+ background: var(--fs-line);
5949
+ cursor: not-allowed;
5950
+ }
5951
+ .fs-slider:has(.fs-slider__thumb[aria-disabled='true']) .fs-slider__fill {
5952
+ background: var(--fs-ink-disabled);
5953
+ }
5954
+ .fs-slider__thumb[aria-disabled='true'] {
5955
+ background: var(--fs-bg-disabled);
5956
+ border-color: var(--fs-ink-disabled);
5957
+ cursor: not-allowed;
5958
+ }
5959
+
5960
+ /* Forced colours erase the fills: the track becomes a 1 px CanvasText edge, the fill Highlight, the
5961
+ thumb a Canvas disc with a CanvasText edge, Highlight while focused or dragged; disabled GrayText.
5962
+ The thumb's place carries the value, and __value says it. */
5963
+ @media (forced-colors: active) {
5964
+ .fs-slider__track {
5965
+ background: Canvas;
5966
+ border: 1px solid CanvasText;
5967
+ }
5968
+ .fs-slider__fill {
5969
+ background: Highlight;
5970
+ }
5971
+ .fs-slider__ticks > * {
5972
+ background: CanvasText;
5973
+ }
5974
+ .fs-slider__thumb {
5975
+ background: Canvas;
5976
+ border-color: CanvasText;
5977
+ }
5978
+ .fs-slider__thumb:focus-visible,
5979
+ .fs-slider__thumb.fs-is-dragging {
5980
+ border-color: Highlight;
5981
+ }
5982
+ .fs-slider:has(.fs-slider__thumb[aria-disabled='true']) {
5983
+ color: GrayText;
5984
+ }
5985
+ .fs-slider:has(.fs-slider__thumb[aria-disabled='true']) .fs-slider__track {
5986
+ border-color: GrayText;
5987
+ }
5988
+ .fs-slider:has(.fs-slider__thumb[aria-disabled='true']) .fs-slider__fill,
5989
+ .fs-slider:has(.fs-slider__thumb[aria-disabled='true']) .fs-slider__ticks > * {
5990
+ background: GrayText;
5991
+ }
5992
+ .fs-slider__thumb[aria-disabled='true'] {
5993
+ border-color: GrayText;
5994
+ }
5995
+ }
5996
+ }
5997
+
5645
5998
  /* Spinner: for busy steps and buttons only (spec 02 E). Usage: spinner.md. */
5646
5999
  @layer fs.components {
5647
6000
  .fs-spinner {
@@ -5736,6 +6089,22 @@
5736
6089
  font-variant-numeric: tabular-nums;
5737
6090
  color: var(--fs-ink);
5738
6091
  }
6092
+
6093
+ /* A fill becomes Canvas here, so the legend dots would vanish (I23). They take the mark dot's shapes:
6094
+ exact solid, approximate half filled, not converted a ring; the words and counts still name them. */
6095
+ @media (forced-colors: active) {
6096
+ .fs-legend__dot {
6097
+ box-sizing: border-box;
6098
+ background: CanvasText;
6099
+ border: 1.5px solid CanvasText;
6100
+ }
6101
+ .fs-legend__dot--approximate {
6102
+ background: linear-gradient(90deg, CanvasText 50%, transparent 50%);
6103
+ }
6104
+ .fs-legend__dot--not-converted {
6105
+ background: transparent;
6106
+ }
6107
+ }
5739
6108
  }
5740
6109
 
5741
6110
  /* Steps: a numbered how-to, or lifecycle steps with status marks (spec 02 E). Usage: steps.md. */
@@ -5800,6 +6169,144 @@
5800
6169
  }
5801
6170
  }
5802
6171
 
6172
+ /* Switch (spec 02 B, T131): a native checkbox with role="switch", drawn as a pill track with a knob.
6173
+ Usage: switch.md. */
6174
+ @layer fs.components {
6175
+ .fs-switch {
6176
+ /* W1: 28 × 16 at dense and compact, 36 × 20 at comfortable. The icon size is 16, 16 and 20 px at
6177
+ the three densities, so the height follows it and the width is twice it less 4 px. */
6178
+ --fs-switch-h: var(--fs-icon-size);
6179
+ --fs-switch-w: calc(var(--fs-switch-h) * 2 - 4px);
6180
+ display: inline-flex;
6181
+ align-items: center;
6182
+ gap: var(--fs-space-2);
6183
+ min-height: var(--fs-size-touch);
6184
+ font-size: var(--fs-text-body-size);
6185
+ line-height: var(--fs-text-body-line);
6186
+ color: var(--fs-ink);
6187
+ cursor: pointer;
6188
+ }
6189
+ /* --end: the label first, the switch at the row's end (a settings row). Same markup, so `order`. */
6190
+ .fs-switch--end {
6191
+ display: flex;
6192
+ justify-content: space-between;
6193
+ }
6194
+ .fs-switch--end > .fs-switch__input {
6195
+ order: 1;
6196
+ }
6197
+
6198
+ /* The track. Its edge is --fs-line-control-strong (3:1): no label sits inside it, as the checkbox box. */
6199
+ .fs-switch__input {
6200
+ appearance: none;
6201
+ position: relative;
6202
+ flex: none;
6203
+ box-sizing: border-box;
6204
+ width: var(--fs-switch-w);
6205
+ height: var(--fs-switch-h);
6206
+ margin: 0;
6207
+ background: var(--fs-bg-sunken);
6208
+ border: var(--fs-line-width) solid var(--fs-line-control-strong);
6209
+ border-radius: var(--fs-radius-pill);
6210
+ cursor: pointer;
6211
+ }
6212
+ /* The knob: a circle 4 px smaller than the track's height, 2 px in from its outer edge. Its position
6213
+ says the state (W2: no glyph). --fs-dur is 0 under reduced motion, so the move is instant there. */
6214
+ .fs-switch__input::before {
6215
+ content: '';
6216
+ position: absolute;
6217
+ inset-block: 0;
6218
+ inset-inline-start: calc(2px - var(--fs-line-width));
6219
+ width: calc(var(--fs-switch-h) - 4px);
6220
+ height: calc(var(--fs-switch-h) - 4px);
6221
+ margin-block: auto;
6222
+ background: var(--fs-line-control-strong);
6223
+ border-radius: 50%;
6224
+ transition: inset-inline-start var(--fs-dur) var(--fs-ease);
6225
+ }
6226
+ .fs-switch__input:checked {
6227
+ background: var(--fs-accent);
6228
+ border-color: var(--fs-accent);
6229
+ }
6230
+ .fs-switch__input:checked::before {
6231
+ inset-inline-start: calc(var(--fs-switch-w) - var(--fs-switch-h) + 2px - var(--fs-line-width));
6232
+ background: var(--fs-bg-surface);
6233
+ }
6234
+
6235
+ @media (hover: hover) {
6236
+ .fs-switch:hover > .fs-switch__input:not(:checked, :disabled) {
6237
+ border-color: var(--fs-ink-2);
6238
+ }
6239
+ }
6240
+
6241
+ /* The ring recipe (D15). */
6242
+ .fs-switch__input:focus-visible {
6243
+ outline: var(--fs-ring-width) solid var(--fs-ring);
6244
+ outline-offset: var(--fs-ring-halo-width);
6245
+ box-shadow: 0 0 0 var(--fs-ring-halo-width) var(--fs-ring-halo);
6246
+ }
6247
+
6248
+ /* Busy (aria-busy on the row): the change is on its way, so the knob keeps its place without motion. */
6249
+ .fs-switch[aria-busy='true'],
6250
+ .fs-switch[aria-busy='true'] > .fs-switch__input {
6251
+ cursor: progress;
6252
+ }
6253
+ .fs-switch[aria-busy='true'] > .fs-switch__input::before {
6254
+ transition: none;
6255
+ }
6256
+
6257
+ /* Disabled comes last. Never opacity. */
6258
+ .fs-switch:has(:disabled) {
6259
+ color: var(--fs-ink-disabled);
6260
+ cursor: not-allowed;
6261
+ }
6262
+ .fs-switch__input:disabled {
6263
+ background: var(--fs-bg-disabled);
6264
+ border-color: var(--fs-line);
6265
+ cursor: not-allowed;
6266
+ }
6267
+ .fs-switch__input:disabled::before {
6268
+ background: var(--fs-ink-disabled);
6269
+ }
6270
+ .fs-switch__input:disabled:checked {
6271
+ background: var(--fs-ink-disabled);
6272
+ border-color: var(--fs-ink-disabled);
6273
+ }
6274
+ .fs-switch__input:disabled:checked::before {
6275
+ background: var(--fs-bg-disabled);
6276
+ }
6277
+
6278
+ /* Forced colours erase the fills, and appearance: auto would draw a checkbox, so the kit keeps its
6279
+ drawing in system colours: the knob's place still tells off from on. */
6280
+ @media (forced-colors: active) {
6281
+ .fs-switch__input {
6282
+ background: Canvas;
6283
+ border-color: CanvasText;
6284
+ }
6285
+ .fs-switch__input::before {
6286
+ background: CanvasText;
6287
+ }
6288
+ .fs-switch__input:checked {
6289
+ background: Highlight;
6290
+ border-color: Highlight;
6291
+ }
6292
+ .fs-switch__input:checked::before {
6293
+ background: HighlightText;
6294
+ }
6295
+ .fs-switch:has(:disabled) {
6296
+ color: GrayText;
6297
+ }
6298
+ .fs-switch__input:disabled,
6299
+ .fs-switch__input:disabled:checked {
6300
+ background: Canvas;
6301
+ border-color: GrayText;
6302
+ }
6303
+ .fs-switch__input:disabled::before,
6304
+ .fs-switch__input:disabled:checked::before {
6305
+ background: GrayText;
6306
+ }
6307
+ }
6308
+ }
6309
+
5803
6310
  /* Tab bar of open objects (spec 02 C, BI App). Usage: tabbar.md. Behaviour: createTabs, closable. */
5804
6311
  @layer fs.components {
5805
6312
  .fs-tabbar {
@@ -22,19 +22,25 @@ export const SegmentedControl = forwardRef(function SegmentedControl({ label, it
22
22
  return () => group.current?.destroy();
23
23
  }, []);
24
24
  useIsoLayoutEffect(() => group.current?.update(), [items]);
25
+ // As Slider's: a re-render after each fs-change, in the parent's batch, puts back a controlled value
26
+ // the parent didn't take. Not a microtask, which could run before the parent's render (I25).
27
+ const [settled, settle] = useState(0);
28
+ useIsoLayoutEffect(() => {
29
+ if (!settled)
30
+ return;
31
+ const i = items.findIndex((it) => it.value === current);
32
+ if (i >= 0)
33
+ group.current?.select(i);
34
+ }, [settled]);
25
35
  useFsEvent(own, 'fs-change', ({ index }) => {
26
36
  const next = latest.current.items[index]?.value;
27
37
  if (next === undefined)
28
38
  return;
29
39
  if (value === undefined)
30
40
  setInner(next);
41
+ else
42
+ settle((n) => n + 1);
31
43
  onValueChange?.(next);
32
- // A controlled value the parent didn't take is put back.
33
- queueMicrotask(() => {
34
- const i = latest.current.items.findIndex((it) => it.value === latest.current.current);
35
- if (i >= 0)
36
- group.current?.select(i);
37
- });
38
44
  });
39
45
  return (_jsx("div", { ref: useMergedRef(own, ref), className: cx('fs-segmented', className), role: "radiogroup", "aria-label": label, ...rest, children: items.map((item) => (_jsx("button", { type: "button", className: "fs-segmented__item", role: "radio", "aria-checked": item.value === current, disabled: item.disabled, children: item.label }, item.value))) }));
40
46
  });