@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.
- package/CHANGELOG.md +89 -0
- package/dist/css/checkbox.css +3 -1
- package/dist/css/combobox.css +58 -0
- package/dist/css/combobox.md +75 -0
- package/dist/css/data-type.md +1 -1
- package/dist/css/diag.md +1 -1
- package/dist/css/drag.css +7 -0
- package/dist/css/drag.md +2 -0
- package/dist/css/grid.css +4 -0
- package/dist/css/input.md +6 -1
- package/dist/css/pill.css +7 -0
- package/dist/css/select.css +103 -0
- package/dist/css/select.md +69 -0
- package/dist/css/slider.css +169 -0
- package/dist/css/slider.md +87 -0
- package/dist/css/stacked-bar.css +16 -0
- package/dist/css/switch.css +137 -0
- package/dist/css/switch.md +28 -0
- package/dist/css/tokens.css +3 -3
- package/dist/css-text/checkbox.js +1 -1
- package/dist/css-text/combobox.d.ts +2 -0
- package/dist/css-text/combobox.js +1 -0
- package/dist/css-text/drag.js +1 -1
- package/dist/css-text/grid.js +1 -1
- package/dist/css-text/kit.js +511 -4
- package/dist/css-text/pill.js +1 -1
- package/dist/css-text/select.d.ts +2 -0
- package/dist/css-text/select.js +1 -0
- package/dist/css-text/slider.d.ts +2 -0
- package/dist/css-text/slider.js +1 -0
- package/dist/css-text/stacked-bar.js +1 -1
- package/dist/css-text/switch.d.ts +2 -0
- package/dist/css-text/switch.js +1 -0
- package/dist/css-text/tokens.js +1 -1
- package/dist/dom/combobox.d.ts +47 -0
- package/dist/dom/combobox.js +178 -0
- package/dist/dom/index.d.ts +3 -0
- package/dist/dom/index.js +3 -0
- package/dist/dom/listbox.d.ts +11 -0
- package/dist/dom/listbox.js +9 -3
- package/dist/dom/select.d.ts +39 -0
- package/dist/dom/select.js +221 -0
- package/dist/dom/slider.d.ts +51 -0
- package/dist/dom/slider.js +256 -0
- package/dist/grid.json +1 -1
- package/dist/kit.css +511 -4
- package/dist/react/actions.js +12 -6
- package/dist/react/inputs.d.ts +181 -0
- package/dist/react/inputs.js +291 -15
- package/dist/react/navigation.js +33 -15
- package/dist/tokens/contrast-pairs.js +24 -0
- package/dist/tokens/grid.js +1 -1
- package/dist/tokens.json +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/* Slider and range slider (spec 02 B; F2 draft §4, T134). Usage: slider.md. Behaviour: createSlider,
|
|
2
|
+
which writes each thumb's place (--fs-slider-at) and the fill's ends (--fs-slider-low, --fs-slider-high). */
|
|
3
|
+
@layer fs.components {
|
|
4
|
+
.fs-slider {
|
|
5
|
+
--fs-slider-track-h: 4px;
|
|
6
|
+
--fs-slider-thumb: var(--fs-icon-size);
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: var(--fs-space-3);
|
|
10
|
+
min-width: 0;
|
|
11
|
+
min-height: var(--fs-control-h);
|
|
12
|
+
font-size: var(--fs-text-body-size);
|
|
13
|
+
line-height: var(--fs-text-body-line);
|
|
14
|
+
/* A press starts a drag: the page must not scroll or select under it. */
|
|
15
|
+
touch-action: none;
|
|
16
|
+
user-select: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* The track: 4 px, no fill or label inside it, so --fs-line-control-strong (3:1, D30). Half a thumb
|
|
20
|
+
of room at each end keeps a thumb at the minimum or maximum inside the block. */
|
|
21
|
+
.fs-slider__track {
|
|
22
|
+
position: relative;
|
|
23
|
+
flex: 1 1 auto;
|
|
24
|
+
min-width: 0;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
height: var(--fs-slider-track-h);
|
|
27
|
+
margin-inline: calc(var(--fs-slider-thumb) / 2);
|
|
28
|
+
background: var(--fs-line-control-strong);
|
|
29
|
+
border-radius: var(--fs-radius-sm);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
/* The band from the minimum to the value, or between the two thumbs. */
|
|
33
|
+
.fs-slider__fill {
|
|
34
|
+
position: absolute;
|
|
35
|
+
inset-block: 0;
|
|
36
|
+
inset-inline-start: var(--fs-slider-low, 0%);
|
|
37
|
+
inset-inline-end: calc(100% - var(--fs-slider-high, 0%));
|
|
38
|
+
background: var(--fs-accent);
|
|
39
|
+
border-radius: inherit;
|
|
40
|
+
}
|
|
41
|
+
/* Marks at the steps the product names, under the track. */
|
|
42
|
+
.fs-slider__ticks {
|
|
43
|
+
position: absolute;
|
|
44
|
+
inset: 0;
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
}
|
|
47
|
+
.fs-slider__ticks > * {
|
|
48
|
+
position: absolute;
|
|
49
|
+
top: calc(var(--fs-slider-track-h) + 2px);
|
|
50
|
+
inset-inline-start: var(--fs-slider-at, 0%);
|
|
51
|
+
width: 1px;
|
|
52
|
+
height: 4px;
|
|
53
|
+
margin-inline-start: -0.5px;
|
|
54
|
+
background: var(--fs-line-control-strong);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* A thumb: a circle of the icon size (16 px, 20 at comfortable), a 2 px accent edge on the surface,
|
|
58
|
+
its centre on the value. Its hit area is padded to the 24 px touch target (spec 06 §1). */
|
|
59
|
+
.fs-slider__thumb {
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 50%;
|
|
62
|
+
inset-inline-start: var(--fs-slider-at, 0%);
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
width: var(--fs-slider-thumb);
|
|
65
|
+
height: var(--fs-slider-thumb);
|
|
66
|
+
margin-block-start: calc(var(--fs-slider-thumb) / -2);
|
|
67
|
+
margin-inline-start: calc(var(--fs-slider-thumb) / -2);
|
|
68
|
+
background: var(--fs-bg-surface);
|
|
69
|
+
border: 2px solid var(--fs-accent);
|
|
70
|
+
border-radius: 50%;
|
|
71
|
+
cursor: grab;
|
|
72
|
+
}
|
|
73
|
+
.fs-slider__thumb::before {
|
|
74
|
+
content: '';
|
|
75
|
+
position: absolute;
|
|
76
|
+
inset: calc((var(--fs-slider-thumb) - var(--fs-size-touch)) / 2 - 2px);
|
|
77
|
+
border-radius: 50%;
|
|
78
|
+
}
|
|
79
|
+
/* --range: two thumbs. At one value, the focused one is on top. */
|
|
80
|
+
.fs-slider--range .fs-slider__thumb:focus {
|
|
81
|
+
z-index: 1;
|
|
82
|
+
}
|
|
83
|
+
@media (hover: hover) {
|
|
84
|
+
.fs-slider__thumb:hover {
|
|
85
|
+
border-color: var(--fs-accent-strong);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/* Dragging: the helper sets .fs-is-dragging for the whole drag (pointer capture ends :active early in some engines).
|
|
89
|
+
Two rules, not one list: the gallery clones a rule naming :active into a later sheet, and a list would take
|
|
90
|
+
.fs-is-dragging along, past the forced-colours rule below. */
|
|
91
|
+
.fs-slider__thumb.fs-is-dragging {
|
|
92
|
+
background: var(--fs-bg-selected);
|
|
93
|
+
border-color: var(--fs-accent-strong);
|
|
94
|
+
cursor: grabbing;
|
|
95
|
+
}
|
|
96
|
+
.fs-slider__thumb:active {
|
|
97
|
+
background: var(--fs-bg-selected);
|
|
98
|
+
border-color: var(--fs-accent-strong);
|
|
99
|
+
cursor: grabbing;
|
|
100
|
+
}
|
|
101
|
+
/* The ring recipe (D15). */
|
|
102
|
+
.fs-slider__thumb:focus-visible {
|
|
103
|
+
outline: var(--fs-ring-width) solid var(--fs-ring);
|
|
104
|
+
outline-offset: var(--fs-ring-halo-width);
|
|
105
|
+
box-shadow: 0 0 0 var(--fs-ring-halo-width) var(--fs-ring-halo);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* The value beside it: an <output>, in tabular figures so it doesn't jitter while moving. */
|
|
109
|
+
.fs-slider__value {
|
|
110
|
+
flex: none;
|
|
111
|
+
color: var(--fs-ink);
|
|
112
|
+
font-variant-numeric: tabular-nums;
|
|
113
|
+
white-space: nowrap;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Disabled comes last: by colour, never opacity. The thumbs stay reachable (aria-disabled). */
|
|
117
|
+
.fs-slider:has(.fs-slider__thumb[aria-disabled='true']) {
|
|
118
|
+
color: var(--fs-ink-disabled);
|
|
119
|
+
}
|
|
120
|
+
.fs-slider:has(.fs-slider__thumb[aria-disabled='true']) .fs-slider__track {
|
|
121
|
+
background: var(--fs-line);
|
|
122
|
+
cursor: not-allowed;
|
|
123
|
+
}
|
|
124
|
+
.fs-slider:has(.fs-slider__thumb[aria-disabled='true']) .fs-slider__fill {
|
|
125
|
+
background: var(--fs-ink-disabled);
|
|
126
|
+
}
|
|
127
|
+
.fs-slider__thumb[aria-disabled='true'] {
|
|
128
|
+
background: var(--fs-bg-disabled);
|
|
129
|
+
border-color: var(--fs-ink-disabled);
|
|
130
|
+
cursor: not-allowed;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Forced colours erase the fills: the track becomes a 1 px CanvasText edge, the fill Highlight, the
|
|
134
|
+
thumb a Canvas disc with a CanvasText edge, Highlight while focused or dragged; disabled GrayText.
|
|
135
|
+
The thumb's place carries the value, and __value says it. */
|
|
136
|
+
@media (forced-colors: active) {
|
|
137
|
+
.fs-slider__track {
|
|
138
|
+
background: Canvas;
|
|
139
|
+
border: 1px solid CanvasText;
|
|
140
|
+
}
|
|
141
|
+
.fs-slider__fill {
|
|
142
|
+
background: Highlight;
|
|
143
|
+
}
|
|
144
|
+
.fs-slider__ticks > * {
|
|
145
|
+
background: CanvasText;
|
|
146
|
+
}
|
|
147
|
+
.fs-slider__thumb {
|
|
148
|
+
background: Canvas;
|
|
149
|
+
border-color: CanvasText;
|
|
150
|
+
}
|
|
151
|
+
.fs-slider__thumb:focus-visible,
|
|
152
|
+
.fs-slider__thumb.fs-is-dragging {
|
|
153
|
+
border-color: Highlight;
|
|
154
|
+
}
|
|
155
|
+
.fs-slider:has(.fs-slider__thumb[aria-disabled='true']) {
|
|
156
|
+
color: GrayText;
|
|
157
|
+
}
|
|
158
|
+
.fs-slider:has(.fs-slider__thumb[aria-disabled='true']) .fs-slider__track {
|
|
159
|
+
border-color: GrayText;
|
|
160
|
+
}
|
|
161
|
+
.fs-slider:has(.fs-slider__thumb[aria-disabled='true']) .fs-slider__fill,
|
|
162
|
+
.fs-slider:has(.fs-slider__thumb[aria-disabled='true']) .fs-slider__ticks > * {
|
|
163
|
+
background: GrayText;
|
|
164
|
+
}
|
|
165
|
+
.fs-slider__thumb[aria-disabled='true'] {
|
|
166
|
+
border-color: GrayText;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Slider — `.fs-slider`
|
|
2
|
+
|
|
3
|
+
Spec 02 B (F2 draft §4, T134). CSS: `css/slider.css`. Behaviour: `createSlider(root, { min, max, value, valueText })`.
|
|
4
|
+
React: `Slider`, `RangeSlider`. Gallery: `inputs.html`.
|
|
5
|
+
|
|
6
|
+
A number picked by dragging a thumb along a track, or a range between two thumbs. Horizontal only;
|
|
7
|
+
no vertical sliders, labelled ticks or number box beside it (T134 Q3, F11). For a value typed
|
|
8
|
+
exactly, use `.fs-input` (numeric).
|
|
9
|
+
|
|
10
|
+
```html
|
|
11
|
+
<span class="fs-field__label" id="share-l">Share of revenue</span>
|
|
12
|
+
<div class="fs-slider">
|
|
13
|
+
<div class="fs-slider__track">
|
|
14
|
+
<div class="fs-slider__fill"></div>
|
|
15
|
+
<div class="fs-slider__thumb" role="slider" tabindex="0" aria-labelledby="share-l"></div>
|
|
16
|
+
</div>
|
|
17
|
+
<output class="fs-slider__value"></output>
|
|
18
|
+
<input type="hidden" name="share" />
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<span class="fs-field__label" id="years-l">Years</span>
|
|
22
|
+
<div class="fs-slider fs-slider--range" role="group" aria-labelledby="years-l">
|
|
23
|
+
<div class="fs-slider__track">
|
|
24
|
+
<div class="fs-slider__fill"></div>
|
|
25
|
+
<div class="fs-slider__ticks" aria-hidden="true"><span style="--fs-slider-at: 0%"></span><span style="--fs-slider-at: 50%"></span><span style="--fs-slider-at: 100%"></span></div>
|
|
26
|
+
<div class="fs-slider__thumb" role="slider" tabindex="0"></div>
|
|
27
|
+
<div class="fs-slider__thumb" role="slider" tabindex="0"></div>
|
|
28
|
+
</div>
|
|
29
|
+
<output class="fs-slider__value"></output>
|
|
30
|
+
</div>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import { createSlider } from '@finstack-com-public/design/dom/slider';
|
|
35
|
+
const share = createSlider(shareEl, { min: 0, max: 100, step: 5, value: 40, valueText: (v) => `${v} %` });
|
|
36
|
+
shareEl.addEventListener('fs-input', (e) => preview(e.detail.value)); // while it moves
|
|
37
|
+
shareEl.addEventListener('fs-change', (e) => save(e.detail.value)); // a key press, or the pointer's release
|
|
38
|
+
const years = createSlider(yearsEl, {
|
|
39
|
+
min: 2020, max: 2030, value: [2024, 2027], valueText: String, labels: { start: 'From', end: 'To' },
|
|
40
|
+
});
|
|
41
|
+
share.setValue(60); // no event
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **Parts.** `__track` (4 px, `--fs-slider-track-h`) holds `__fill` (the band from the minimum to the
|
|
45
|
+
value, or between the two thumbs), the optional `__ticks` and one `__thumb`, or two in `--range`.
|
|
46
|
+
`__value` is an optional `<output>` after the track, in tabular figures. A thumb is a circle of
|
|
47
|
+
the icon size (16 px; 20 at comfortable) with a 24 px hit area; the block is `--fs-control-h` high.
|
|
48
|
+
- **The helper writes the values.** It sets each thumb's `role="slider"`, `tabindex`,
|
|
49
|
+
`aria-valuenow`, `aria-valuemin`, `aria-valuemax` and `aria-valuetext` (the product's
|
|
50
|
+
`valueText(v)`: the kit holds no strings), its place `--fs-slider-at`, the fill's ends
|
|
51
|
+
`--fs-slider-low` and `--fs-slider-high` on the root, the `__value` text (a range's two texts
|
|
52
|
+
joined by " – ") and the root's hidden inputs (in thumb order). No `aria-orientation`: horizontal.
|
|
53
|
+
- **Names.** A single thumb is named by its field's label through `aria-labelledby` (a `<label for>`
|
|
54
|
+
can't name a `div`). A range's thumbs are named by `labels.start` and `labels.end` (required);
|
|
55
|
+
give the root `role="group"` named by the field's label, so "From, Years" is read in context.
|
|
56
|
+
- **A range's thumbs depend on each other** (APG Multi-Thumb Slider): the lower's `aria-valuemax` is
|
|
57
|
+
the upper's value and the upper's `aria-valuemin` the lower's, updated on every change; neither
|
|
58
|
+
crosses the other. Each thumb is its own tab stop, lower first, whatever their places.
|
|
59
|
+
- **Keys** (APG Slider). Right or Up one step up, Left or Down one step down; PageUp/PageDown
|
|
60
|
+
`pageStep` (default ten steps); Home/End the thumb's minimum/maximum (in a range, the other thumb).
|
|
61
|
+
In a right-to-left context (the root's computed `direction`) Right and Left swap.
|
|
62
|
+
- **Pointer.** A press on the track moves the nearer thumb there and starts a drag; a press on a
|
|
63
|
+
thumb grabs it where it was pressed. Two thumbs at one value: the first move picks the one free to
|
|
64
|
+
go that way. The drag uses pointer capture and `touch-action: none`; the thumb carries
|
|
65
|
+
`.fs-is-dragging` until the release.
|
|
66
|
+
- **Values** are numbers, snapped to `step` (default 1) from `min` and clamped to `min`/`max`; End
|
|
67
|
+
reaches a `max` off the step grid.
|
|
68
|
+
- **Events** (T134 Q4). `fs-input { value }` while it moves (each key press, each pointer move that
|
|
69
|
+
changes it); `fs-change { value }` when a move ends (each key press, or the pointer's release, if
|
|
70
|
+
the value changed). `value` is a number, or `[low, high]` for a range. `setValue`, `update` and
|
|
71
|
+
`destroy()` fire nothing; `destroy()` ends a drag and removes every listener.
|
|
72
|
+
- **Ticks** are marks the product places under the track: one empty child of `__ticks` each, at
|
|
73
|
+
`style="--fs-slider-at: <percent>"`, `aria-hidden` (the value text says the value).
|
|
74
|
+
- Not form-associated (custom elements are out, D13): the hidden inputs are how a form sees it.
|
|
75
|
+
|
|
76
|
+
| State | Set it with | Look |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| hover | the browser | the thumb's edge `accent-strong` |
|
|
79
|
+
| dragging | `.fs-is-dragging` (the helper sets it), or `:active` | thumb fill `bg-selected`, edge `accent-strong` |
|
|
80
|
+
| focus | the browser | the ring on the thumb (D15) |
|
|
81
|
+
| disabled | `aria-disabled="true"` on each thumb | track `line`, fill `ink-disabled`, thumb `bg-disabled` with an `ink-disabled` edge, never opacity; reachable, not movable |
|
|
82
|
+
|
|
83
|
+
Rest colours: track `line-control-strong` (3:1: no fill or label inside it, as the checkbox box,
|
|
84
|
+
D30), fill `accent`, thumb `bg-surface` with a 2 px `accent` edge. In forced colours the track
|
|
85
|
+
is a 1 px `CanvasText` edge, the fill `Highlight`, the thumb a `Canvas` disc with a `CanvasText`
|
|
86
|
+
edge, `Highlight` while focused or dragged, and disabled `GrayText`. A value is never colour alone:
|
|
87
|
+
the thumb's place and `__value` carry it.
|
package/dist/css/stacked-bar.css
CHANGED
|
@@ -60,4 +60,20 @@
|
|
|
60
60
|
font-variant-numeric: tabular-nums;
|
|
61
61
|
color: var(--fs-ink);
|
|
62
62
|
}
|
|
63
|
+
|
|
64
|
+
/* A fill becomes Canvas here, so the legend dots would vanish (I23). They take the mark dot's shapes:
|
|
65
|
+
exact solid, approximate half filled, not converted a ring; the words and counts still name them. */
|
|
66
|
+
@media (forced-colors: active) {
|
|
67
|
+
.fs-legend__dot {
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
background: CanvasText;
|
|
70
|
+
border: 1.5px solid CanvasText;
|
|
71
|
+
}
|
|
72
|
+
.fs-legend__dot--approximate {
|
|
73
|
+
background: linear-gradient(90deg, CanvasText 50%, transparent 50%);
|
|
74
|
+
}
|
|
75
|
+
.fs-legend__dot--not-converted {
|
|
76
|
+
background: transparent;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
63
79
|
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/* Switch (spec 02 B, T131): a native checkbox with role="switch", drawn as a pill track with a knob.
|
|
2
|
+
Usage: switch.md. */
|
|
3
|
+
@layer fs.components {
|
|
4
|
+
.fs-switch {
|
|
5
|
+
/* W1: 28 × 16 at dense and compact, 36 × 20 at comfortable. The icon size is 16, 16 and 20 px at
|
|
6
|
+
the three densities, so the height follows it and the width is twice it less 4 px. */
|
|
7
|
+
--fs-switch-h: var(--fs-icon-size);
|
|
8
|
+
--fs-switch-w: calc(var(--fs-switch-h) * 2 - 4px);
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: var(--fs-space-2);
|
|
12
|
+
min-height: var(--fs-size-touch);
|
|
13
|
+
font-size: var(--fs-text-body-size);
|
|
14
|
+
line-height: var(--fs-text-body-line);
|
|
15
|
+
color: var(--fs-ink);
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
/* --end: the label first, the switch at the row's end (a settings row). Same markup, so `order`. */
|
|
19
|
+
.fs-switch--end {
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
}
|
|
23
|
+
.fs-switch--end > .fs-switch__input {
|
|
24
|
+
order: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* The track. Its edge is --fs-line-control-strong (3:1): no label sits inside it, as the checkbox box. */
|
|
28
|
+
.fs-switch__input {
|
|
29
|
+
appearance: none;
|
|
30
|
+
position: relative;
|
|
31
|
+
flex: none;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
width: var(--fs-switch-w);
|
|
34
|
+
height: var(--fs-switch-h);
|
|
35
|
+
margin: 0;
|
|
36
|
+
background: var(--fs-bg-sunken);
|
|
37
|
+
border: var(--fs-line-width) solid var(--fs-line-control-strong);
|
|
38
|
+
border-radius: var(--fs-radius-pill);
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
}
|
|
41
|
+
/* The knob: a circle 4 px smaller than the track's height, 2 px in from its outer edge. Its position
|
|
42
|
+
says the state (W2: no glyph). --fs-dur is 0 under reduced motion, so the move is instant there. */
|
|
43
|
+
.fs-switch__input::before {
|
|
44
|
+
content: '';
|
|
45
|
+
position: absolute;
|
|
46
|
+
inset-block: 0;
|
|
47
|
+
inset-inline-start: calc(2px - var(--fs-line-width));
|
|
48
|
+
width: calc(var(--fs-switch-h) - 4px);
|
|
49
|
+
height: calc(var(--fs-switch-h) - 4px);
|
|
50
|
+
margin-block: auto;
|
|
51
|
+
background: var(--fs-line-control-strong);
|
|
52
|
+
border-radius: 50%;
|
|
53
|
+
transition: inset-inline-start var(--fs-dur) var(--fs-ease);
|
|
54
|
+
}
|
|
55
|
+
.fs-switch__input:checked {
|
|
56
|
+
background: var(--fs-accent);
|
|
57
|
+
border-color: var(--fs-accent);
|
|
58
|
+
}
|
|
59
|
+
.fs-switch__input:checked::before {
|
|
60
|
+
inset-inline-start: calc(var(--fs-switch-w) - var(--fs-switch-h) + 2px - var(--fs-line-width));
|
|
61
|
+
background: var(--fs-bg-surface);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@media (hover: hover) {
|
|
65
|
+
.fs-switch:hover > .fs-switch__input:not(:checked, :disabled) {
|
|
66
|
+
border-color: var(--fs-ink-2);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* The ring recipe (D15). */
|
|
71
|
+
.fs-switch__input:focus-visible {
|
|
72
|
+
outline: var(--fs-ring-width) solid var(--fs-ring);
|
|
73
|
+
outline-offset: var(--fs-ring-halo-width);
|
|
74
|
+
box-shadow: 0 0 0 var(--fs-ring-halo-width) var(--fs-ring-halo);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Busy (aria-busy on the row): the change is on its way, so the knob keeps its place without motion. */
|
|
78
|
+
.fs-switch[aria-busy='true'],
|
|
79
|
+
.fs-switch[aria-busy='true'] > .fs-switch__input {
|
|
80
|
+
cursor: progress;
|
|
81
|
+
}
|
|
82
|
+
.fs-switch[aria-busy='true'] > .fs-switch__input::before {
|
|
83
|
+
transition: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Disabled comes last. Never opacity. */
|
|
87
|
+
.fs-switch:has(:disabled) {
|
|
88
|
+
color: var(--fs-ink-disabled);
|
|
89
|
+
cursor: not-allowed;
|
|
90
|
+
}
|
|
91
|
+
.fs-switch__input:disabled {
|
|
92
|
+
background: var(--fs-bg-disabled);
|
|
93
|
+
border-color: var(--fs-line);
|
|
94
|
+
cursor: not-allowed;
|
|
95
|
+
}
|
|
96
|
+
.fs-switch__input:disabled::before {
|
|
97
|
+
background: var(--fs-ink-disabled);
|
|
98
|
+
}
|
|
99
|
+
.fs-switch__input:disabled:checked {
|
|
100
|
+
background: var(--fs-ink-disabled);
|
|
101
|
+
border-color: var(--fs-ink-disabled);
|
|
102
|
+
}
|
|
103
|
+
.fs-switch__input:disabled:checked::before {
|
|
104
|
+
background: var(--fs-bg-disabled);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Forced colours erase the fills, and appearance: auto would draw a checkbox, so the kit keeps its
|
|
108
|
+
drawing in system colours: the knob's place still tells off from on. */
|
|
109
|
+
@media (forced-colors: active) {
|
|
110
|
+
.fs-switch__input {
|
|
111
|
+
background: Canvas;
|
|
112
|
+
border-color: CanvasText;
|
|
113
|
+
}
|
|
114
|
+
.fs-switch__input::before {
|
|
115
|
+
background: CanvasText;
|
|
116
|
+
}
|
|
117
|
+
.fs-switch__input:checked {
|
|
118
|
+
background: Highlight;
|
|
119
|
+
border-color: Highlight;
|
|
120
|
+
}
|
|
121
|
+
.fs-switch__input:checked::before {
|
|
122
|
+
background: HighlightText;
|
|
123
|
+
}
|
|
124
|
+
.fs-switch:has(:disabled) {
|
|
125
|
+
color: GrayText;
|
|
126
|
+
}
|
|
127
|
+
.fs-switch__input:disabled,
|
|
128
|
+
.fs-switch__input:disabled:checked {
|
|
129
|
+
background: Canvas;
|
|
130
|
+
border-color: GrayText;
|
|
131
|
+
}
|
|
132
|
+
.fs-switch__input:disabled::before,
|
|
133
|
+
.fs-switch__input:disabled:checked::before {
|
|
134
|
+
background: GrayText;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Switch — `.fs-switch`
|
|
2
|
+
|
|
3
|
+
Spec 02 B (T131). CSS: `css/switch.css`. Gallery: `inputs.html`. React: `Switch`.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<label class="fs-switch"><input type="checkbox" role="switch" class="fs-switch__input"><span class="fs-switch__label">Show the title</span></label>
|
|
7
|
+
<label class="fs-switch fs-switch--end"><input type="checkbox" role="switch" class="fs-switch__input" checked><span class="fs-switch__label">Show border</span></label>
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
- **A switch acts at once; a checkbox is a choice.** Use a switch when flipping it changes something
|
|
11
|
+
straight away (a style setting, showing a column). Use a checkbox (`.fs-checkbox`) when the choice is
|
|
12
|
+
applied later by a button (Save, Apply, a form's submit).
|
|
13
|
+
- A native `<input type="checkbox" role="switch">`, so Space, the label's click, the checked state and form
|
|
14
|
+
submission are the browser's; `aria-checked` follows `checked`. There is no helper. Enter does nothing, as on
|
|
15
|
+
a checkbox.
|
|
16
|
+
- Drawn by the kit (`appearance: none`): a pill track with a knob. Off is a `--fs-bg-sunken` track with a
|
|
17
|
+
`--fs-line-control-strong` edge and knob (3:1: no label sits inside); on is an `--fs-accent` track with a
|
|
18
|
+
`--fs-bg-surface` knob at the end. The knob's place, not its colour alone, says the state.
|
|
19
|
+
- Size: `--fs-switch-w` × `--fs-switch-h`, 28 × 16 px at dense and compact and 36 × 20 px at comfortable,
|
|
20
|
+
set on `.fs-switch` from the density. The row is at least 24 px high, the touch target of spec 06.
|
|
21
|
+
- `--end` puts the label first and the switch at the row's end (a settings row); the markup stays the same.
|
|
22
|
+
- Hover darkens the off track's edge (`--fs-ink-2`). Focus is the ring (D15). Disabled greys the track, the
|
|
23
|
+
knob and the label, by colour, never opacity.
|
|
24
|
+
- Busy: `aria-busy="true"` on the row while the change is on its way. The knob keeps its place without motion
|
|
25
|
+
and the cursor shows progress; the product decides whether to disable the input meanwhile. React: `busy`.
|
|
26
|
+
- The knob slides in `--fs-dur`, which is 0 under reduced motion.
|
|
27
|
+
- In forced colours the kit keeps its drawing in system colours: a `CanvasText` edge and knob on `Canvas`; on, a
|
|
28
|
+
`Highlight` track and a `HighlightText` knob; disabled, a `GrayText` edge, knob and label.
|
package/dist/css/tokens.css
CHANGED
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
--fs-grid-error-bg: #fdecea;
|
|
164
164
|
--fs-grid-negative-ink: #c62828;
|
|
165
165
|
--fs-grid-stale-ink: #5f5e5a;
|
|
166
|
-
--fs-grid-stale-dot: #
|
|
166
|
+
--fs-grid-stale-dot: #c27c00;
|
|
167
167
|
--fs-grid-dirty-ink: #3d3db4;
|
|
168
168
|
--fs-grid-invalid-ink: #c62828;
|
|
169
169
|
--fs-grid-selected: #3d3db4;
|
|
@@ -703,7 +703,7 @@
|
|
|
703
703
|
--fs-grid-error-bg: #fdecea;
|
|
704
704
|
--fs-grid-negative-ink: #c62828;
|
|
705
705
|
--fs-grid-stale-ink: #5f5e5a;
|
|
706
|
-
--fs-grid-stale-dot: #
|
|
706
|
+
--fs-grid-stale-dot: #c27c00;
|
|
707
707
|
--fs-grid-dirty-ink: #3d3db4;
|
|
708
708
|
--fs-grid-invalid-ink: #c62828;
|
|
709
709
|
--fs-grid-selected: #3d3db4;
|
|
@@ -1078,7 +1078,7 @@
|
|
|
1078
1078
|
--fs-grid-error-bg: #fdecea;
|
|
1079
1079
|
--fs-grid-negative-ink: #c62828;
|
|
1080
1080
|
--fs-grid-stale-ink: #5f5e5a;
|
|
1081
|
-
--fs-grid-stale-dot: #
|
|
1081
|
+
--fs-grid-stale-dot: #c27c00;
|
|
1082
1082
|
--fs-grid-dirty-ink: #3d3db4;
|
|
1083
1083
|
--fs-grid-invalid-ink: #c62828;
|
|
1084
1084
|
--fs-grid-selected: #3d3db4;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default "/* Checkbox and radio (spec 02 B): native inputs, so authored layouts and forced colours work.\n Usage: checkbox.md. */\n@layer fs.components {\n .fs-checkbox,\n .fs-radio {\n display: inline-flex;\n align-items: center;\n gap: var(--fs-space-2);\n min-height: var(--fs-size-touch);\n font-size: var(--fs-text-body-size);\n line-height: var(--fs-text-body-line);\n color: var(--fs-ink);\n cursor: pointer;\n }\n /* Drawn by the kit (T81), still a native input: the browser's own unchecked edge was a mixed olive in dark\n (Chrome blends accent-color into it). The edge is --fs-line-control-strong (3:1: a box has no label inside). */\n .fs-checkbox__input,\n .fs-radio__input {\n appearance: none;\n position: relative;\n flex: none;\n box-sizing: border-box;\n width: 16px;\n height: 16px;\n margin: 0;\n background: var(--fs-bg-sunken);\n border: var(--fs-line-width) solid var(--fs-line-control-strong);\n border-radius: var(--fs-radius-sm);\n cursor: pointer;\n }\n .fs-radio__input {\n border-radius: 50%;\n }\n .fs-checkbox__input::before,\n .fs-radio__input::before {\n content: '';\n position: absolute;\n inset: 0;\n background: var(--fs-
|
|
1
|
+
export default "/* Checkbox and radio (spec 02 B): native inputs, so authored layouts and forced colours work.\n Usage: checkbox.md. */\n@layer fs.components {\n .fs-checkbox,\n .fs-radio {\n display: inline-flex;\n align-items: center;\n gap: var(--fs-space-2);\n min-height: var(--fs-size-touch);\n font-size: var(--fs-text-body-size);\n line-height: var(--fs-text-body-line);\n color: var(--fs-ink);\n cursor: pointer;\n }\n /* Drawn by the kit (T81), still a native input: the browser's own unchecked edge was a mixed olive in dark\n (Chrome blends accent-color into it). The edge is --fs-line-control-strong (3:1: a box has no label inside). */\n .fs-checkbox__input,\n .fs-radio__input {\n appearance: none;\n position: relative;\n flex: none;\n box-sizing: border-box;\n width: 16px;\n height: 16px;\n margin: 0;\n background: var(--fs-bg-sunken);\n border: var(--fs-line-width) solid var(--fs-line-control-strong);\n border-radius: var(--fs-radius-sm);\n cursor: pointer;\n }\n .fs-radio__input {\n border-radius: 50%;\n }\n .fs-checkbox__input::before,\n .fs-radio__input::before {\n content: '';\n position: absolute;\n inset: 0;\n /* The mark is the surface colour on the accent (I21): white in light as before; in dark the navy surface,\n 8.1:1 on the light-blue accent where white was 2.0:1. Not ink-on-accent, which products read for text. */\n background: var(--fs-bg-surface);\n visibility: hidden;\n }\n .fs-checkbox__input::before {\n mask: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.8 2.8L12 5.5' fill='none' stroke='currentColor' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\")\n center / 100% 100% no-repeat;\n }\n .fs-radio__input::before {\n inset: 3px;\n border-radius: 50%;\n }\n .fs-checkbox__input:checked,\n .fs-checkbox__input:indeterminate,\n .fs-radio__input:checked {\n background: var(--fs-accent);\n border-color: var(--fs-accent);\n }\n .fs-checkbox__input:checked::before,\n .fs-checkbox__input:indeterminate::before,\n .fs-radio__input:checked::before {\n visibility: visible;\n }\n .fs-checkbox__input:indeterminate::before {\n mask: linear-gradient(var(--fs-ink) 0 0) center / 8px 2px no-repeat;\n }\n\n /* The ring recipe (D15). */\n .fs-checkbox__input:focus-visible,\n .fs-radio__input:focus-visible {\n outline: var(--fs-ring-width) solid var(--fs-ring);\n outline-offset: var(--fs-ring-halo-width);\n box-shadow: 0 0 0 var(--fs-ring-halo-width) var(--fs-ring-halo);\n }\n\n .fs-checkbox:has(:disabled),\n .fs-radio:has(:disabled) {\n color: var(--fs-ink-disabled);\n cursor: not-allowed;\n }\n .fs-checkbox__input:disabled,\n .fs-radio__input:disabled {\n background: var(--fs-bg-disabled);\n border-color: var(--fs-line);\n cursor: not-allowed;\n }\n .fs-checkbox__input:disabled:checked,\n .fs-checkbox__input:disabled:indeterminate,\n .fs-radio__input:disabled:checked {\n background: var(--fs-ink-disabled);\n border-color: var(--fs-ink-disabled);\n }\n\n /* Forced colours: hand the control back to the system's own drawing. */\n @media (forced-colors: active) {\n .fs-checkbox__input,\n .fs-radio__input {\n appearance: auto;\n }\n .fs-checkbox__input::before,\n .fs-radio__input::before {\n display: none;\n }\n }\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default "/* Editable combobox (spec 02 B; F2 draft §1, T133): a text input with list autocomplete. Usage:\n combobox.md. Behaviour: createCombobox. The input is a plain .fs-input (input.css: height, fill,\n edge, hover, ring, invalid, read-only, disabled); the popup is the completion list's\n .fs-menu--listbox (menu.css), grouped options included. */\n@layer fs.components {\n .fs-combobox {\n position: relative;\n display: block;\n min-width: 0;\n }\n /* Room for the toggle at the input's end. */\n .fs-combobox:has(> .fs-combobox__toggle) > .fs-input {\n padding-right: calc(var(--fs-size-touch) + var(--fs-space-1));\n }\n\n /* The toggle: a row icon button (24 px target) inside the input's end, out of the tab order. Its\n chevron is a mask on currentColor, as the select's, so it follows the system colours. */\n .fs-combobox__toggle {\n position: absolute;\n top: calc((var(--fs-control-h) - var(--fs-size-touch)) / 2);\n right: calc((var(--fs-control-h) - var(--fs-size-touch)) / 2);\n }\n .fs-combobox__toggle::before {\n content: '';\n width: 16px;\n height: 16px;\n background-color: currentColor;\n 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\")\n center / contain no-repeat;\n }\n .fs-combobox__toggle[aria-expanded='true']::before {\n transform: rotate(180deg);\n }\n\n /* Read-only: no toggle (the input already has no edge). */\n .fs-combobox:has(> .fs-input:read-only:not(:disabled)) > .fs-combobox__toggle {\n display: none;\n }\n\n /* Disabled last: by colour, never opacity; the toggle takes no presses. */\n .fs-combobox:has(> .fs-input:disabled) > .fs-combobox__toggle {\n color: var(--fs-ink-disabled);\n background-color: transparent;\n cursor: not-allowed;\n pointer-events: none;\n }\n\n /* Forced colours: the current option keeps a Highlight outline (the input and the chevron are\n drawn by the system already); a disabled toggle is GrayText. */\n @media (forced-colors: active) {\n .fs-combobox .fs-menu__item[aria-selected='true'] {\n outline-color: Highlight;\n }\n .fs-combobox:has(> .fs-input:disabled) > .fs-combobox__toggle {\n color: GrayText;\n }\n }\n}\n";
|
package/dist/css-text/drag.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default "/* Drag markers (spec 02 F): the kit styles them; BI App's own engine runs the drag (BI §9.6).\n Usage: drag.md. */\n@layer fs.components {\n .fs-grip {\n display: inline-grid;\n flex: none;\n place-items: center;\n width: 16px;\n min-height: var(--fs-size-touch);\n padding: 0;\n color: var(--fs-ink-muted);\n background: transparent;\n border: 0;\n border-radius: var(--fs-radius-sm);\n cursor: grab;\n }\n .fs-grip:active {\n cursor: grabbing;\n }\n .fs-grip > .fs-icon {\n width: 16px;\n height: 16px;\n }\n .fs-grip:focus-visible {\n outline: var(--fs-ring-width) solid var(--fs-ring);\n outline-offset: var(--fs-ring-halo-width);\n box-shadow: 0 0 0 var(--fs-ring-halo-width) var(--fs-ring-halo);\n }\n\n /* Where a drop would land: a 4 px accent bar. */\n .fs-drop-bar {\n display: block;\n height: 4px;\n background: var(--fs-accent);\n border-radius: 0;\n }\n .fs-drop-target.fs-is-dragover {\n background-color: var(--fs-accent-wash);\n outline: var(--fs-line-width) solid var(--fs-accent);\n outline-offset: calc(-1 * var(--fs-line-width));\n }\n\n /* Resize handles: an 8 px hit area with a 4 px bar on hover. The parent is position: relative. */\n .fs-resize-handle {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .fs-resize-handle--row {\n right: 0;\n bottom: -4px;\n left: 0;\n height: 8px;\n cursor: row-resize;\n }\n .fs-resize-handle--col {\n top: 0;\n right: -4px;\n bottom: 0;\n width: 8px;\n cursor: col-resize;\n }\n .fs-resize-handle::after {\n content: '';\n border-radius: 0;\n }\n .fs-resize-handle--row::after {\n width: 100%;\n height: 4px;\n }\n .fs-resize-handle--col::after {\n width: 4px;\n height: 100%;\n }\n @media (hover: hover) {\n .fs-resize-handle:hover::after {\n background: var(--fs-accent);\n }\n .fs-add-cell:hover {\n color: var(--fs-accent);\n border-color: var(--fs-accent);\n }\n }\n\n /* The ghost of a moved or resized item: accent, or danger when refused. */\n .fs-drag-ghost {\n background: var(--fs-accent-wash);\n border-radius: var(--fs-radius-sm);\n outline: 2px solid var(--fs-accent);\n outline-offset: -2px;\n }\n .fs-drag-ghost.fs-is-refused {\n background: var(--fs-danger-wash);\n outline-color: var(--fs-danger-fill);\n }\n\n .fs-add-cell {\n display: grid;\n place-items: center;\n box-sizing: border-box;\n min-height: var(--fs-row-h);\n margin: 0;\n padding: 0 var(--fs-space-3);\n font: inherit;\n color: var(--fs-ink-muted);\n background: transparent;\n border: var(--fs-line-width) dashed var(--fs-line-control-strong);\n border-radius: var(--fs-radius-sm);\n cursor: pointer;\n }\n .fs-add-cell:focus-visible {\n outline: var(--fs-ring-width) solid var(--fs-ring);\n outline-offset: var(--fs-ring-halo-width);\n box-shadow: 0 0 0 var(--fs-ring-halo-width) var(--fs-ring-halo);\n }\n\n .fs-palette-pill {\n display: inline-flex;\n align-items: center;\n gap: var(--fs-space-1);\n box-sizing: border-box;\n height: 26px;\n padding: 0 var(--fs-space-2) 0 var(--fs-space-1);\n font-size: var(--fs-text-xs-size);\n color: var(--fs-ink);\n background: var(--fs-bg-surface);\n border: var(--fs-line-width) solid var(--fs-line-control-strong);\n border-radius: var(--fs-radius-md);\n cursor: grab;\n }\n .fs-palette-pill > .fs-icon {\n width: 14px;\n height: 14px;\n color: var(--fs-ink-muted);\n }\n}\n";
|
|
1
|
+
export default "/* Drag markers (spec 02 F): the kit styles them; BI App's own engine runs the drag (BI §9.6).\n Usage: drag.md. */\n@layer fs.components {\n .fs-grip {\n display: inline-grid;\n flex: none;\n place-items: center;\n width: 16px;\n min-height: var(--fs-size-touch);\n padding: 0;\n color: var(--fs-ink-muted);\n background: transparent;\n border: 0;\n border-radius: var(--fs-radius-sm);\n cursor: grab;\n }\n .fs-grip:active {\n cursor: grabbing;\n }\n .fs-grip > .fs-icon {\n width: 16px;\n height: 16px;\n }\n .fs-grip:focus-visible {\n outline: var(--fs-ring-width) solid var(--fs-ring);\n outline-offset: var(--fs-ring-halo-width);\n box-shadow: 0 0 0 var(--fs-ring-halo-width) var(--fs-ring-halo);\n }\n\n /* Where a drop would land: a 4 px accent bar. */\n .fs-drop-bar {\n display: block;\n height: 4px;\n background: var(--fs-accent);\n border-radius: 0;\n }\n .fs-drop-target.fs-is-dragover {\n background-color: var(--fs-accent-wash);\n outline: var(--fs-line-width) solid var(--fs-accent);\n outline-offset: calc(-1 * var(--fs-line-width));\n }\n\n /* Resize handles: an 8 px hit area with a 4 px bar on hover. The parent is position: relative. */\n .fs-resize-handle {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .fs-resize-handle--row {\n right: 0;\n bottom: -4px;\n left: 0;\n height: 8px;\n cursor: row-resize;\n }\n .fs-resize-handle--col {\n top: 0;\n right: -4px;\n bottom: 0;\n width: 8px;\n cursor: col-resize;\n }\n .fs-resize-handle::after {\n content: '';\n border-radius: 0;\n }\n .fs-resize-handle--row::after {\n width: 100%;\n height: 4px;\n }\n .fs-resize-handle--col::after {\n width: 4px;\n height: 100%;\n }\n @media (hover: hover) {\n .fs-resize-handle:hover::after {\n background: var(--fs-accent);\n }\n .fs-add-cell:hover {\n color: var(--fs-accent);\n border-color: var(--fs-accent);\n }\n }\n\n /* The ghost of a moved or resized item: accent, or danger when refused. */\n .fs-drag-ghost {\n background: var(--fs-accent-wash);\n border-radius: var(--fs-radius-sm);\n outline: 2px solid var(--fs-accent);\n outline-offset: -2px;\n }\n .fs-drag-ghost.fs-is-refused {\n background: var(--fs-danger-wash);\n outline-color: var(--fs-danger-fill);\n }\n /* Forced colours drops the wash and paints both outlines in the text colour: refused is a thicker dashed outline. */\n @media (forced-colors: active) {\n .fs-drag-ghost.fs-is-refused {\n outline: 4px dashed CanvasText;\n outline-offset: -4px;\n }\n }\n\n .fs-add-cell {\n display: grid;\n place-items: center;\n box-sizing: border-box;\n min-height: var(--fs-row-h);\n margin: 0;\n padding: 0 var(--fs-space-3);\n font: inherit;\n color: var(--fs-ink-muted);\n background: transparent;\n border: var(--fs-line-width) dashed var(--fs-line-control-strong);\n border-radius: var(--fs-radius-sm);\n cursor: pointer;\n }\n .fs-add-cell:focus-visible {\n outline: var(--fs-ring-width) solid var(--fs-ring);\n outline-offset: var(--fs-ring-halo-width);\n box-shadow: 0 0 0 var(--fs-ring-halo-width) var(--fs-ring-halo);\n }\n\n .fs-palette-pill {\n display: inline-flex;\n align-items: center;\n gap: var(--fs-space-1);\n box-sizing: border-box;\n height: 26px;\n padding: 0 var(--fs-space-2) 0 var(--fs-space-1);\n font-size: var(--fs-text-xs-size);\n color: var(--fs-ink);\n background: var(--fs-bg-surface);\n border: var(--fs-line-width) solid var(--fs-line-control-strong);\n border-radius: var(--fs-radius-md);\n cursor: grab;\n }\n .fs-palette-pill > .fs-icon {\n width: 14px;\n height: 14px;\n color: var(--fs-ink-muted);\n }\n}\n";
|
package/dist/css-text/grid.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default "/* BI App's slice grid (spec 02 F; KEEP, D7): CSS over BI App's own table. Usage: grid.md.\n Every value is a --fs-grid-* token (01-tokens §3.10). Put the grid in a .fs-dense subtree. */\n@layer fs.components {\n .fs-grid {\n table-layout: fixed;\n border-collapse: collapse;\n font-size: var(--fs-text-xs-size);\n line-height: var(--fs-text-xs-line);\n font-weight: var(--fs-weight-regular);\n font-variant-numeric: tabular-nums;\n color: var(--fs-ink);\n background: var(--fs-bg-surface);\n }\n .fs-grid + .fs-grid {\n margin-top: var(--fs-row-h);\n }\n .fs-grid :is(th, td) {\n position: relative;\n box-sizing: border-box;\n width: 96px;\n height: var(--fs-row-h);\n padding: 0 var(--fs-cell-pad-x);\n overflow: hidden;\n text-align: right;\n white-space: nowrap;\n border: var(--fs-line-width) solid var(--fs-grid-line);\n }\n .fs-grid tbody tr:hover > * {\n box-shadow: inset 0 0 0 999px var(--fs-grid-row-hover);\n }\n\n /* A member's title: indented 12 px a level, with a chevron. */\n .fs-grid .fs-grid__member {\n width: 180px;\n min-width: 180px;\n text-align: left;\n }\n .fs-grid .fs-level-1 {\n padding-left: calc(var(--fs-cell-pad-x) + 0px);\n }\n .fs-grid .fs-level-2 {\n padding-left: calc(var(--fs-cell-pad-x) + 12px);\n }\n .fs-grid .fs-level-3 {\n padding-left: calc(var(--fs-cell-pad-x) + 24px);\n }\n .fs-grid .fs-level-4 {\n padding-left: calc(var(--fs-cell-pad-x) + 36px);\n }\n .fs-grid .fs-level-5 {\n padding-left: calc(var(--fs-cell-pad-x) + 48px);\n }\n .fs-grid .fs-level-6 {\n padding-left: calc(var(--fs-cell-pad-x) + 60px);\n }\n .fs-grid .fs-level-7 {\n padding-left: calc(var(--fs-cell-pad-x) + 72px);\n }\n .fs-grid .fs-level-8 {\n padding-left: calc(var(--fs-cell-pad-x) + 84px);\n }\n .fs-grid .fs-level-9 {\n padding-left: calc(var(--fs-cell-pad-x) + 96px);\n }\n .fs-grid .fs-level-10 {\n padding-left: calc(var(--fs-cell-pad-x) + 108px);\n }\n .fs-grid__chevron {\n display: inline-grid;\n place-items: center;\n width: 16px;\n height: 16px;\n margin: 0 2px 0 -2px;\n padding: 0;\n color: var(--fs-grid-chevron);\n vertical-align: -4px;\n background: transparent;\n border: 0;\n transition: transform var(--fs-dur) var(--fs-ease);\n }\n .fs-grid__chevron > .fs-icon {\n width: 16px;\n height: 16px;\n }\n .fs-grid__chevron[aria-expanded='true'] {\n transform: rotate(90deg);\n }\n\n /* The input sits under a cover that shows the formatted value (BI §5.1). */\n .fs-grid__input,\n .fs-grid__cover {\n position: absolute;\n inset: 0;\n box-sizing: border-box;\n padding: 0 var(--fs-cell-pad-x);\n }\n /* Out of editing the input's text is hidden, not covered: a cover with the cell's fill would\n paint a translucent fill twice (T16). */\n .fs-grid__input {\n width: 100%;\n margin: 0;\n font: inherit;\n color: transparent;\n caret-color: transparent;\n text-align: right;\n background: transparent;\n border: 0;\n outline: none;\n }\n .fs-grid__cover {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n pointer-events: none;\n }\n\n /* Roles, in BI App's precedence: when two set the same property, the later one wins. */\n .fs-grid .fs-cell--header {\n font-weight: var(--fs-weight-medium);\n text-align: center;\n background-color: var(--fs-grid-header-bg);\n }\n .fs-grid .fs-cell--member {\n text-align: left;\n }\n .fs-grid .fs-cell--subtotal {\n font-weight: var(--fs-weight-medium);\n background-color: var(--fs-grid-subtotal-bg);\n }\n .fs-grid .fs-cell--input {\n background-color: var(--fs-grid-input-bg);\n }\n .fs-grid .fs-cell--locked {\n color: var(--fs-grid-locked-ink);\n background-color: var(--fs-grid-locked-bg);\n }\n .fs-grid .fs-cell--error {\n color: var(--fs-grid-error-ink);\n background-color: var(--fs-grid-error-bg);\n }\n .fs-grid .fs-cell--stale {\n font-style: italic;\n color: var(--fs-grid-stale-ink);\n }\n /* The top-left corner is the stale dot's; the top-right the note's. Nothing else goes there. */\n .fs-grid .fs-cell--stale::before {\n content: '';\n position: absolute;\n top: 2px;\n left: 2px;\n z-index: 1;\n width: 5px;\n height: 5px;\n background: var(--fs-grid-stale-dot);\n border-radius: 50%;\n }\n .fs-grid .fs-cell--negative {\n color: var(--fs-grid-negative-ink);\n }\n\n /* Editing states. */\n .fs-grid .fs-cell--dirty {\n color: var(--fs-grid-dirty-ink);\n }\n .fs-grid .fs-cell--invalid {\n color: var(--fs-grid-invalid-ink);\n }\n .fs-grid .fs-cell--nodata {\n background-color: var(--fs-grid-nodata-bg);\n }\n .fs-grid .fs-cell--editing {\n background-color: var(--fs-grid-editing-bg);\n }\n /* Red ink on the editing fill: a darker red in light (T108), the same red as before in dark. */\n .fs-grid .fs-cell--editing.fs-cell--negative,\n .fs-grid .fs-cell--editing.fs-cell--error,\n .fs-grid .fs-cell--editing.fs-cell--invalid {\n color: var(--fs-grid-editing-danger-ink);\n }\n .fs-grid .fs-cell--editing .fs-grid__cover {\n visibility: hidden;\n }\n .fs-grid .fs-cell--editing .fs-grid__input {\n color: inherit;\n caret-color: auto;\n }\n /* The selected cell is the grid's cursor and its focus indicator (06-accessibility §3). */\n .fs-grid .fs-is-selected {\n outline: 2px solid var(--fs-grid-selected);\n outline-offset: -2px;\n }\n .fs-grid .fs-is-selected.fs-cell--invalid {\n background-color: var(--fs-grid-selected-invalid-bg);\n }\n .fs-grid__note {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 1;\n width: 0;\n height: 0;\n border-top: 6px solid var(--fs-accent);\n border-left: 6px solid transparent;\n }\n\n /* Forced colours erase the danger ink and the error fill: a wavy underline marks the value (on the\n cover, which is positioned, so the cell's own underline doesn't reach it), as .fs-diag--error\n does, and an error cell also gets a dashed inner edge (T107). */\n @media (forced-colors: active) {\n .fs-grid :is(.fs-cell--invalid, .fs-cell--error) > .fs-grid__cover {\n text-decoration: underline wavy CanvasText;\n text-decoration-skip-ink: none;\n text-underline-offset: 3px;\n }\n .fs-grid .fs-cell--error:not(.fs-is-selected) {\n outline: var(--fs-line-width) dashed CanvasText;\n outline-offset: -3px;\n }\n }\n}\n";
|
|
1
|
+
export default "/* BI App's slice grid (spec 02 F; KEEP, D7): CSS over BI App's own table. Usage: grid.md.\n Every value is a --fs-grid-* token (01-tokens §3.10). Put the grid in a .fs-dense subtree. */\n@layer fs.components {\n .fs-grid {\n table-layout: fixed;\n border-collapse: collapse;\n font-size: var(--fs-text-xs-size);\n line-height: var(--fs-text-xs-line);\n font-weight: var(--fs-weight-regular);\n font-variant-numeric: tabular-nums;\n color: var(--fs-ink);\n background: var(--fs-bg-surface);\n }\n .fs-grid + .fs-grid {\n margin-top: var(--fs-row-h);\n }\n .fs-grid :is(th, td) {\n position: relative;\n box-sizing: border-box;\n width: 96px;\n height: var(--fs-row-h);\n padding: 0 var(--fs-cell-pad-x);\n overflow: hidden;\n text-align: right;\n white-space: nowrap;\n border: var(--fs-line-width) solid var(--fs-grid-line);\n }\n .fs-grid tbody tr:hover > * {\n box-shadow: inset 0 0 0 999px var(--fs-grid-row-hover);\n }\n\n /* A member's title: indented 12 px a level, with a chevron. */\n .fs-grid .fs-grid__member {\n width: 180px;\n min-width: 180px;\n text-align: left;\n }\n .fs-grid .fs-level-1 {\n padding-left: calc(var(--fs-cell-pad-x) + 0px);\n }\n .fs-grid .fs-level-2 {\n padding-left: calc(var(--fs-cell-pad-x) + 12px);\n }\n .fs-grid .fs-level-3 {\n padding-left: calc(var(--fs-cell-pad-x) + 24px);\n }\n .fs-grid .fs-level-4 {\n padding-left: calc(var(--fs-cell-pad-x) + 36px);\n }\n .fs-grid .fs-level-5 {\n padding-left: calc(var(--fs-cell-pad-x) + 48px);\n }\n .fs-grid .fs-level-6 {\n padding-left: calc(var(--fs-cell-pad-x) + 60px);\n }\n .fs-grid .fs-level-7 {\n padding-left: calc(var(--fs-cell-pad-x) + 72px);\n }\n .fs-grid .fs-level-8 {\n padding-left: calc(var(--fs-cell-pad-x) + 84px);\n }\n .fs-grid .fs-level-9 {\n padding-left: calc(var(--fs-cell-pad-x) + 96px);\n }\n .fs-grid .fs-level-10 {\n padding-left: calc(var(--fs-cell-pad-x) + 108px);\n }\n .fs-grid__chevron {\n display: inline-grid;\n place-items: center;\n width: 16px;\n height: 16px;\n margin: 0 2px 0 -2px;\n padding: 0;\n color: var(--fs-grid-chevron);\n vertical-align: -4px;\n background: transparent;\n border: 0;\n transition: transform var(--fs-dur) var(--fs-ease);\n }\n .fs-grid__chevron > .fs-icon {\n width: 16px;\n height: 16px;\n }\n .fs-grid__chevron[aria-expanded='true'] {\n transform: rotate(90deg);\n }\n\n /* The input sits under a cover that shows the formatted value (BI §5.1). */\n .fs-grid__input,\n .fs-grid__cover {\n position: absolute;\n inset: 0;\n box-sizing: border-box;\n padding: 0 var(--fs-cell-pad-x);\n }\n /* Out of editing the input's text is hidden, not covered: a cover with the cell's fill would\n paint a translucent fill twice (T16). */\n .fs-grid__input {\n width: 100%;\n margin: 0;\n font: inherit;\n color: transparent;\n caret-color: transparent;\n text-align: right;\n background: transparent;\n border: 0;\n outline: none;\n }\n .fs-grid__cover {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n pointer-events: none;\n }\n\n /* Roles, in BI App's precedence: when two set the same property, the later one wins. */\n .fs-grid .fs-cell--header {\n font-weight: var(--fs-weight-medium);\n text-align: center;\n background-color: var(--fs-grid-header-bg);\n }\n .fs-grid .fs-cell--member {\n text-align: left;\n }\n .fs-grid .fs-cell--subtotal {\n font-weight: var(--fs-weight-medium);\n background-color: var(--fs-grid-subtotal-bg);\n }\n .fs-grid .fs-cell--input {\n background-color: var(--fs-grid-input-bg);\n }\n .fs-grid .fs-cell--locked {\n color: var(--fs-grid-locked-ink);\n background-color: var(--fs-grid-locked-bg);\n }\n .fs-grid .fs-cell--error {\n color: var(--fs-grid-error-ink);\n background-color: var(--fs-grid-error-bg);\n }\n .fs-grid .fs-cell--stale {\n font-style: italic;\n color: var(--fs-grid-stale-ink);\n }\n /* The top-left corner is the stale dot's; the top-right the note's. Nothing else goes there. */\n .fs-grid .fs-cell--stale::before {\n content: '';\n position: absolute;\n top: 2px;\n left: 2px;\n z-index: 1;\n width: 5px;\n height: 5px;\n background: var(--fs-grid-stale-dot);\n border-radius: 50%;\n }\n .fs-grid .fs-cell--negative {\n color: var(--fs-grid-negative-ink);\n }\n\n /* Editing states. */\n .fs-grid .fs-cell--dirty {\n color: var(--fs-grid-dirty-ink);\n }\n .fs-grid .fs-cell--invalid {\n color: var(--fs-grid-invalid-ink);\n }\n .fs-grid .fs-cell--nodata {\n background-color: var(--fs-grid-nodata-bg);\n }\n .fs-grid .fs-cell--editing {\n background-color: var(--fs-grid-editing-bg);\n }\n /* Red ink on the editing fill: a darker red in light (T108), the same red as before in dark. */\n .fs-grid .fs-cell--editing.fs-cell--negative,\n .fs-grid .fs-cell--editing.fs-cell--error,\n .fs-grid .fs-cell--editing.fs-cell--invalid {\n color: var(--fs-grid-editing-danger-ink);\n }\n .fs-grid .fs-cell--editing .fs-grid__cover {\n visibility: hidden;\n }\n .fs-grid .fs-cell--editing .fs-grid__input {\n color: inherit;\n caret-color: auto;\n }\n /* The selected cell is the grid's cursor and its focus indicator (06-accessibility §3). */\n .fs-grid .fs-is-selected {\n outline: 2px solid var(--fs-grid-selected);\n outline-offset: -2px;\n }\n .fs-grid .fs-is-selected.fs-cell--invalid {\n background-color: var(--fs-grid-selected-invalid-bg);\n }\n .fs-grid__note {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 1;\n width: 0;\n height: 0;\n border-top: 6px solid var(--fs-accent);\n border-left: 6px solid transparent;\n }\n\n /* Forced colours erase the danger ink and the error fill: a wavy underline marks the value (on the\n cover, which is positioned, so the cell's own underline doesn't reach it), as .fs-diag--error\n does, and an error cell also gets a dashed inner edge (T107). */\n @media (forced-colors: active) {\n .fs-grid :is(.fs-cell--invalid, .fs-cell--error) > .fs-grid__cover {\n text-decoration: underline wavy CanvasText;\n text-decoration-skip-ink: none;\n text-underline-offset: 3px;\n }\n .fs-grid .fs-cell--error:not(.fs-is-selected) {\n outline: var(--fs-line-width) dashed CanvasText;\n outline-offset: -3px;\n }\n /* A fill becomes Canvas here, so the stale dot would vanish (I23). */\n .fs-grid .fs-cell--stale::before {\n background: CanvasText;\n }\n }\n}\n";
|