@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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,95 @@
|
|
|
3
3
|
Written by hand for each release. Token names, class names, file paths and exports are the
|
|
4
4
|
public API. While the kit is 0.x, a minor version may break them, and its entry says so.
|
|
5
5
|
|
|
6
|
+
## 0.11.0 — 2026-11-16
|
|
7
|
+
|
|
8
|
+
Nothing breaks. New blocks and React exports, so this is a minor release.
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Switch (T131):** `.fs-switch` (`css/switch.css`), a native `<input type="checkbox" role="switch"
|
|
13
|
+
class="fs-switch__input">` drawn as a pill track with a knob, with a `__label` and an `--end` variant (label first,
|
|
14
|
+
switch at the row's end). Hover, focus, checked, disabled and busy (`aria-busy` on the row); 28 × 16 px at dense and
|
|
15
|
+
compact, 36 × 20 at comfortable (`--fs-switch-w`, `--fs-switch-h`); the knob slides in `--fs-dur` and its place says
|
|
16
|
+
the state; forced colours draw it in system colours. React `Switch` (`label`, `labelPosition`, `busy` and the
|
|
17
|
+
native checkbox props). The usage note says when to use a switch (it acts at once) and when a checkbox (a choice
|
|
18
|
+
applied by a later button).
|
|
19
|
+
- **Custom select (T132):** `.fs-select--listbox` (`css/select.css`), a select-only combobox: a `role="combobox"`
|
|
20
|
+
trigger drawn as the native select, opening a `.fs-menu--listbox`. `createSelect(root, { trigger, list, … })` over
|
|
21
|
+
`createListbox` adds the closed-state keys, Space, typeahead, no wrap and the value mark; it fires `fs-change` when
|
|
22
|
+
the value changes. Read-only and disabled triggers; with a `name`, a hidden input holds the value. React
|
|
23
|
+
`ListboxSelect` (controlled `value`/`open` with `default*` twins). `createListbox` takes a `wrap` option (default
|
|
24
|
+
`true`, so the completion list is unchanged).
|
|
25
|
+
- **Editable combobox (T133):** `.fs-combobox` (`css/combobox.css`), a text input with list autocomplete: an
|
|
26
|
+
`.fs-input` with `role="combobox"`, an optional toggle button and a `.fs-menu--listbox` popup, whose options may sit
|
|
27
|
+
in named groups. `createCombobox(root, { input, list, toggle?, … })` over `createListbox` adds the closed-state keys,
|
|
28
|
+
the toggle, `clearOnEscape`, `strict` and `optionValue`; accepting an option writes its value into the input and
|
|
29
|
+
fires `fs-change { value, option }`. The product filters the options. React `Combobox` (controlled `value`/`open`
|
|
30
|
+
with `default*` twins, `onInputChange` for filtering, items or groups). `createListbox` takes a `homeEnd` option
|
|
31
|
+
(default `'options'`, so the completion list and the custom select are unchanged; the combobox passes `'caret'`).
|
|
32
|
+
- **Slider and range slider (T134):** `.fs-slider` (`css/slider.css`), a `__track` with a `__fill`, optional `__ticks`
|
|
33
|
+
and one `role="slider"` `__thumb`, or two in `--range`, and an optional `__value` output. `createSlider(root, { min,
|
|
34
|
+
max, step?, pageStep?, value, valueText, labels? })` takes a number, or `[low, high]` with `labels.start`/`end` for a
|
|
35
|
+
range: the APG keys (Right and Left swap right to left), step snapping, pointer dragging with pointer capture, two
|
|
36
|
+
dependent thumbs that never cross; it fires the new event `fs-input { value }` while moving and `fs-change { value }`
|
|
37
|
+
when a move ends. With hidden inputs in the root, they hold the values. React `Slider` and `RangeSlider` (controlled
|
|
38
|
+
`value` with a `defaultValue` twin, `onInput`, `onChange`, `showValue`, `ticks`, `name`).
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- **A quick second change kept (I25):** a controlled React `Calendar`, `DateRangeCalendar`, `SegmentedControl`,
|
|
43
|
+
`Tabs`, `TabBar` or `Tree` no longer undoes a second pick or key made before the parent re-rendered: a value the
|
|
44
|
+
parent didn't take is put back after its render, not before.
|
|
45
|
+
|
|
46
|
+
## 0.10.3 — 2026-11-15
|
|
47
|
+
|
|
48
|
+
Nothing breaks. Two colours change: in dark, the checked checkbox and radio mark is navy instead of white; in light,
|
|
49
|
+
the grid's stale dot is a darker amber. Both now meet their contrast floor. In forced colours, the refused drag ghost and
|
|
50
|
+
the pill, legend and stale dots show.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- **The checked checkbox and radio mark is visible in dark (T126, I21):** the check, dash and dot are drawn in
|
|
55
|
+
`--fs-bg-surface` (navy in dark, 8.1:1 on the accent) instead of white (2.0:1). Light is unchanged.
|
|
56
|
+
`--fs-ink-on-accent` keeps its value.
|
|
57
|
+
- **The grid's stale dot reaches 3:1 in light (T128, I22):** `--fs-grid-stale-dot` is `#c27c00` (3.4:1 on the
|
|
58
|
+
surface) instead of `#f9a825` (2.0:1). Dark is unchanged.
|
|
59
|
+
- **The pill, legend and stale dots show in forced colours (T128, I23):** each fills `CanvasText`; the legend dots take
|
|
60
|
+
the mark dot's shapes (solid, half filled, ring).
|
|
61
|
+
- **A refused drag ghost shows in forced colours (T112):** `.fs-drag-ghost.fs-is-refused` draws a 4 px dashed
|
|
62
|
+
`CanvasText` outline inside its edge. Forced colours had dropped its danger wash and painted its outline like an
|
|
63
|
+
accepted ghost's. The mark dot already kept its three kinds there (checked, no change).
|
|
64
|
+
|
|
65
|
+
### Docs
|
|
66
|
+
|
|
67
|
+
- **Upgrading from 0.7 (T110):** `docs/guides/upgrade-0.7-to-0.10.md` lists what changes, what to add and what to adopt
|
|
68
|
+
for an app on kit 0.7.0. It is in the repo, not the package.
|
|
69
|
+
- **Tests (T111):** the browser checks are faster (Firefox and WebKit about 7.5 and 11 minutes, from 18) with the same
|
|
70
|
+
checks. No change to the package.
|
|
71
|
+
- **Recipes for BI App (T119):** `docs/guides/bi-app-recipes.md` shows a picker that opens from a button and gives
|
|
72
|
+
focus back, the editing cell's red ink, forced-colours cues, a tab bar with arrow keys, and a toolbar, each run by a
|
|
73
|
+
test in this repo. It is in the repo, not the package.
|
|
74
|
+
- **Drafts (T113, T114, T118):** `docs/spec/drafts/` holds proposals for the combobox, custom select, switch and slider,
|
|
75
|
+
for a dimmed diagram node that keeps its text readable, and for grid keyboard movement. Nothing in them is built
|
|
76
|
+
or decided.
|
|
77
|
+
- **Spec 06 §7 lists the forced-colours cue of each component and state (T127)**, with its ticket and test; the
|
|
78
|
+
old summary's "selected adds a Highlight outline", "status dots become CanvasText" and its disabled list are corrected.
|
|
79
|
+
|
|
80
|
+
### Tooling
|
|
81
|
+
|
|
82
|
+
- **Tests that guard consumers and docs (T115, T116, T121):** 187 more unit tests; a consumer contract that fails the
|
|
83
|
+
kit's CI when a change would break a class, token, export or prop that BI App or Grizzbi uses; and a check that
|
|
84
|
+
every kit name a usage note or guide shows exists. No change to the package.
|
|
85
|
+
- **`npm run release:check` (T120):** installs the packed package in a scratch folder and imports every export before
|
|
86
|
+
a release. No change to the package.
|
|
87
|
+
- **Contrast-pair coverage (T125):** a test reads the kit CSS and fails on a colour pair that `contrast-pairs.ts`
|
|
88
|
+
doesn't check and no reasoned allow-list entry covers; 14 pairs added, one new known issue (I22).
|
|
89
|
+
- **Forced-colours cases for every row of spec 06 §7 (T129):** the calendar range edges, node frame and rows, diagram
|
|
90
|
+
and xyflow lines, end circles and arrows, the lock chip, parameter badge, data-type badge and glass edges, and the
|
|
91
|
+
invalid textarea and select; green on Chromium, Firefox and WebKit.
|
|
92
|
+
- **Forced-colours grounds (T130):** the diagram's dot grid is gone and the glass ground is plain in forced colours,
|
|
93
|
+
each checked by a case. No change to the package.
|
|
94
|
+
|
|
6
95
|
## 0.10.2 — 2026-11-14
|
|
7
96
|
|
|
8
97
|
Nothing breaks. Upgrading from 0.10.1 needs no change. The normal look is unchanged; only the light grid's editing
|
package/dist/css/checkbox.css
CHANGED
|
@@ -36,7 +36,9 @@
|
|
|
36
36
|
content: '';
|
|
37
37
|
position: absolute;
|
|
38
38
|
inset: 0;
|
|
39
|
-
|
|
39
|
+
/* The mark is the surface colour on the accent (I21): white in light as before; in dark the navy surface,
|
|
40
|
+
8.1:1 on the light-blue accent where white was 2.0:1. Not ink-on-accent, which products read for text. */
|
|
41
|
+
background: var(--fs-bg-surface);
|
|
40
42
|
visibility: hidden;
|
|
41
43
|
}
|
|
42
44
|
.fs-checkbox__input::before {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* Editable combobox (spec 02 B; F2 draft §1, T133): a text input with list autocomplete. Usage:
|
|
2
|
+
combobox.md. Behaviour: createCombobox. The input is a plain .fs-input (input.css: height, fill,
|
|
3
|
+
edge, hover, ring, invalid, read-only, disabled); the popup is the completion list's
|
|
4
|
+
.fs-menu--listbox (menu.css), grouped options included. */
|
|
5
|
+
@layer fs.components {
|
|
6
|
+
.fs-combobox {
|
|
7
|
+
position: relative;
|
|
8
|
+
display: block;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
}
|
|
11
|
+
/* Room for the toggle at the input's end. */
|
|
12
|
+
.fs-combobox:has(> .fs-combobox__toggle) > .fs-input {
|
|
13
|
+
padding-right: calc(var(--fs-size-touch) + var(--fs-space-1));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* The toggle: a row icon button (24 px target) inside the input's end, out of the tab order. Its
|
|
17
|
+
chevron is a mask on currentColor, as the select's, so it follows the system colours. */
|
|
18
|
+
.fs-combobox__toggle {
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: calc((var(--fs-control-h) - var(--fs-size-touch)) / 2);
|
|
21
|
+
right: calc((var(--fs-control-h) - var(--fs-size-touch)) / 2);
|
|
22
|
+
}
|
|
23
|
+
.fs-combobox__toggle::before {
|
|
24
|
+
content: '';
|
|
25
|
+
width: 16px;
|
|
26
|
+
height: 16px;
|
|
27
|
+
background-color: currentColor;
|
|
28
|
+
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")
|
|
29
|
+
center / contain no-repeat;
|
|
30
|
+
}
|
|
31
|
+
.fs-combobox__toggle[aria-expanded='true']::before {
|
|
32
|
+
transform: rotate(180deg);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Read-only: no toggle (the input already has no edge). */
|
|
36
|
+
.fs-combobox:has(> .fs-input:read-only:not(:disabled)) > .fs-combobox__toggle {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Disabled last: by colour, never opacity; the toggle takes no presses. */
|
|
41
|
+
.fs-combobox:has(> .fs-input:disabled) > .fs-combobox__toggle {
|
|
42
|
+
color: var(--fs-ink-disabled);
|
|
43
|
+
background-color: transparent;
|
|
44
|
+
cursor: not-allowed;
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Forced colours: the current option keeps a Highlight outline (the input and the chevron are
|
|
49
|
+
drawn by the system already); a disabled toggle is GrayText. */
|
|
50
|
+
@media (forced-colors: active) {
|
|
51
|
+
.fs-combobox .fs-menu__item[aria-selected='true'] {
|
|
52
|
+
outline-color: Highlight;
|
|
53
|
+
}
|
|
54
|
+
.fs-combobox:has(> .fs-input:disabled) > .fs-combobox__toggle {
|
|
55
|
+
color: GrayText;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Editable combobox — `.fs-combobox`
|
|
2
|
+
|
|
3
|
+
Spec 02 B (F2 draft §1, T133). CSS: `css/combobox.css`, on top of `css/input.css` (the input),
|
|
4
|
+
`css/icon-button.css` (the toggle) and `css/menu.css` (the popup); `kit.css` has all of them.
|
|
5
|
+
Behaviour: `createCombobox(root, { input, list, toggle? })`. React: `Combobox`. Gallery: `inputs.html`.
|
|
6
|
+
|
|
7
|
+
A text input with list autocomplete: the user types, the product filters the options, and an
|
|
8
|
+
option can be picked or the text kept. For a fixed set of options with no typing, use the native
|
|
9
|
+
select or the custom select ([select.md](select.md)).
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<label class="fs-field__label" for="metric">Metric</label>
|
|
13
|
+
<div class="fs-combobox">
|
|
14
|
+
<input class="fs-input" id="metric" role="combobox" autocomplete="off" />
|
|
15
|
+
<button class="fs-icon-button fs-icon-button--row fs-combobox__toggle" type="button" tabindex="-1" aria-label="Show metrics"></button>
|
|
16
|
+
<div class="fs-menu fs-menu--listbox" role="listbox" id="metric-list" aria-label="Metrics" hidden>
|
|
17
|
+
<div role="group" aria-labelledby="metric-g1">
|
|
18
|
+
<div class="fs-menu__group-label" id="metric-g1" role="presentation">Sales</div>
|
|
19
|
+
<div class="fs-menu__item" role="option" id="m-revenue"><span class="fs-menu__label">Revenue</span><span class="fs-menu__detail">EUR</span></div>
|
|
20
|
+
<div class="fs-menu__item" role="option" id="m-margin"><span class="fs-menu__label">Margin</span><span class="fs-menu__detail">%</span></div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<!-- No matches: one <div class="fs-menu__empty" role="option" aria-disabled="true">No matches</div> in the list. -->
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
import { createCombobox } from '@finstack-com-public/design/dom/combobox';
|
|
29
|
+
const combo = createCombobox(rootEl, { input: inputEl, list: listEl, toggle: toggleEl });
|
|
30
|
+
inputEl.addEventListener('input', () => {
|
|
31
|
+
renderOptions(filter(inputEl.value)); // the product filters; the kit never does
|
|
32
|
+
combo.update();
|
|
33
|
+
combo.open();
|
|
34
|
+
});
|
|
35
|
+
rootEl.addEventListener('fs-change', (e) => save(e.detail.value, e.detail.option)); // accepted, or cleared
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- **Parts.** The input is a plain `.fs-input` with `role="combobox"`, named by its field's `<label for>`;
|
|
39
|
+
the helper sets `aria-autocomplete` (`'list'`, or `'none'` when the options don't follow the
|
|
40
|
+
text), `aria-controls`, `aria-expanded` and `aria-activedescendant`. The toggle is optional: an
|
|
41
|
+
empty `.fs-icon-button--row` button whose chevron the CSS draws; give it `tabindex="-1"` (out of
|
|
42
|
+
the tab order, APG) and an `aria-label`. The list sits inside the root; the helper shows it in
|
|
43
|
+
the top layer, at least the input's width.
|
|
44
|
+
- **Groups** (T133 C1). Options may sit in `role="group"` elements named by a
|
|
45
|
+
`.fs-menu__group-label` (`role="presentation"`, as in a menu); the keys move across groups.
|
|
46
|
+
- **Keys** (F2 draft §1, APG list autocomplete). Closed: Down opens on the first option (or one
|
|
47
|
+
marked `aria-selected`), Alt+Down opens with none current, Up opens on the last; Escape clears
|
|
48
|
+
the input with `clearOnEscape`. Open: Up/Down move (wrapping), Enter or a click accepts, Tab
|
|
49
|
+
accepts and moves on, Escape or Alt+Up closes. Home, End, Left and Right always move the caret.
|
|
50
|
+
A press on the toggle opens or closes the list; focus stays in the input.
|
|
51
|
+
- **Typing** is the product's: on the native `input` event it filters the options, calls
|
|
52
|
+
`update()` and opens the list (with the `__empty` line when nothing matches, and its own live
|
|
53
|
+
region if it says how many). Typing fires no `fs-change`.
|
|
54
|
+
- **Accepting** writes `optionValue(option)` into the input (default: its `__label` text) and fires
|
|
55
|
+
`fs-change { value, option }` on the root. The helper fires no native `input` event, so refilter
|
|
56
|
+
on `fs-change` too. createListbox's `fs-select` stays inside.
|
|
57
|
+
- **Free text** is allowed and read from the input. With `strict`, a commit (leaving the input, or
|
|
58
|
+
Enter, after typing) whose text matches an enabled option's value, ignoring case, is accepted as
|
|
59
|
+
that option; other text fires `fs-change` with `option: null`, and the product sets
|
|
60
|
+
`aria-invalid="true"` and says why in the field's message.
|
|
61
|
+
- No `aria-autocomplete="both"` (inline completion) and no multi-select (T133 C2, C3; F10).
|
|
62
|
+
- Not form-associated beyond the input itself: its `name` and text go with the form.
|
|
63
|
+
|
|
64
|
+
| State | Set it with | Look |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| hover, focus | the browser | as `.fs-input`: darker edge; the ring (D15) |
|
|
67
|
+
| expanded | `aria-expanded="true"` (the helper sets it, and mirrors it on the toggle) | the toggle's chevron turns over |
|
|
68
|
+
| invalid | `aria-invalid="true"` on the input | danger edge (pair it with a message) |
|
|
69
|
+
| disabled | `disabled` on the input | disabled fill and ink, never opacity; the toggle greys out and takes no presses |
|
|
70
|
+
| read-only | `readonly` on the input | no edge, no toggle; never opens |
|
|
71
|
+
| current option | `aria-selected="true"` (the helper sets it) | the completion list's tint and inside ring |
|
|
72
|
+
| group | `role="group"` with a `__group-label` | the menu's caps label |
|
|
73
|
+
|
|
74
|
+
In forced colours the input and the toggle are drawn by the system, the chevron follows
|
|
75
|
+
`ButtonText`, the current option keeps a `Highlight` outline, and a disabled toggle is `GrayText`.
|
package/dist/css/data-type.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Data-type badge — `.fs-data-type`
|
|
2
2
|
|
|
3
3
|
Spec 02 F (T93, Phase G). CSS: `css/data-type.css` (the tip is `css/tooltip.css`). Gallery: `diagram.html`. Not the object-type
|
|
4
|
-
icon: that is `.fs-type-icon
|
|
4
|
+
icon: that is `.fs-type-icon--<role>` (`css/type-icon.md`, spec 01 §3.7), which colours an icon by object type. This one marks a
|
|
5
5
|
column's **data** type.
|
|
6
6
|
|
|
7
7
|
```html
|
package/dist/css/diag.md
CHANGED
package/dist/css/drag.css
CHANGED
|
@@ -95,6 +95,13 @@
|
|
|
95
95
|
background: var(--fs-danger-wash);
|
|
96
96
|
outline-color: var(--fs-danger-fill);
|
|
97
97
|
}
|
|
98
|
+
/* Forced colours drops the wash and paints both outlines in the text colour: refused is a thicker dashed outline. */
|
|
99
|
+
@media (forced-colors: active) {
|
|
100
|
+
.fs-drag-ghost.fs-is-refused {
|
|
101
|
+
outline: 4px dashed CanvasText;
|
|
102
|
+
outline-offset: -4px;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
98
105
|
|
|
99
106
|
.fs-add-cell {
|
|
100
107
|
display: grid;
|
package/dist/css/drag.md
CHANGED
|
@@ -15,5 +15,7 @@ Spec 02 F (BI App's page builder, tree and editors). CSS: `css/drag.css`. Galler
|
|
|
15
15
|
- `.fs-add-cell` has `--fs-space-3` of horizontal padding, so a label such as "+ Add" does not touch the dashed edge.
|
|
16
16
|
- The kit styles the markers; the product's own engine runs the drag (BI §9.6) and adds or removes
|
|
17
17
|
`fs-is-dragover` and `fs-is-refused`.
|
|
18
|
+
- The ghost is accent when accepted and danger when refused. Forced colours drops both washes and paints the outline in the
|
|
19
|
+
text colour, so a refused ghost there has a thicker dashed outline (4 px) against the accepted ghost's solid 2 px (T112).
|
|
18
20
|
- Every move a drag does needs a keyboard path too (BI's move buttons: up, down, shrink, grow).
|
|
19
21
|
The grip is a button for that reason.
|
package/dist/css/grid.css
CHANGED
package/dist/css/input.md
CHANGED
|
@@ -10,7 +10,12 @@ Spec 02 B. CSS: `css/input.css`. Gallery: `inputs.html`.
|
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
- **Select:** the native `<select>` sits in a `.fs-select` wrapper, which draws the chevron: a
|
|
13
|
-
`<select>` can't hold a pseudo-element.
|
|
13
|
+
`<select>` can't hold a pseudo-element. For options with an icon, a detail or a long list, the
|
|
14
|
+
custom select `.fs-select--listbox` is in [select.md](select.md).
|
|
15
|
+
- **Combobox:** a text input whose typing filters a list of options to pick from is the editable
|
|
16
|
+
combobox `.fs-combobox`, in [combobox.md](combobox.md).
|
|
17
|
+
- **Slider:** a number picked by dragging along a track, or a range between two thumbs, is the
|
|
18
|
+
slider `.fs-slider`, in [slider.md](slider.md); a value typed exactly stays an `fs-input--num`.
|
|
14
19
|
- `fs-input--num` right-aligns with tabular figures; the number comes formatted from the product.
|
|
15
20
|
- `fs-input--picker` on a `<button>` makes a field that opens a picker (tree, chips, calendar). It
|
|
16
21
|
keeps the input's fill and edge: a button is `:read-only` to CSS, and the read-only look leaves
|
package/dist/css/pill.css
CHANGED
|
@@ -89,4 +89,11 @@
|
|
|
89
89
|
--fs-pill-wash: var(--fs-mark-none-wash);
|
|
90
90
|
--fs-pill-dot: var(--fs-mark-none-fill);
|
|
91
91
|
}
|
|
92
|
+
|
|
93
|
+
/* A fill becomes Canvas here, so the dot would vanish (I23); the word carries the tone. */
|
|
94
|
+
@media (forced-colors: active) {
|
|
95
|
+
.fs-pill--dot::before {
|
|
96
|
+
background: CanvasText;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
92
99
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* Custom select (spec 02 B; F2 draft §2, T132): a select-only combobox. Usage: select.md.
|
|
2
|
+
Behaviour: createSelect. The trigger also carries .fs-select__control (input.css), so it takes the
|
|
3
|
+
native select's height, fill, edge, hover, ring and invalid edge; the popup is the completion
|
|
4
|
+
list's .fs-menu--listbox (menu.css). */
|
|
5
|
+
@layer fs.components {
|
|
6
|
+
.fs-select__trigger {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
text-align: left;
|
|
11
|
+
user-select: none;
|
|
12
|
+
}
|
|
13
|
+
.fs-select__value,
|
|
14
|
+
.fs-select__placeholder {
|
|
15
|
+
flex: 1 1 auto;
|
|
16
|
+
min-width: 0;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
text-overflow: ellipsis;
|
|
19
|
+
white-space: nowrap;
|
|
20
|
+
}
|
|
21
|
+
.fs-select__placeholder {
|
|
22
|
+
color: var(--fs-ink-muted);
|
|
23
|
+
}
|
|
24
|
+
/* The chevron sits in the trigger's row, whatever else the wrapper holds (the list, a hidden input). */
|
|
25
|
+
.fs-select--listbox::after {
|
|
26
|
+
bottom: auto;
|
|
27
|
+
margin: 0;
|
|
28
|
+
top: calc((var(--fs-control-h) - 16px) / 2);
|
|
29
|
+
}
|
|
30
|
+
.fs-select--listbox:has(> [aria-expanded='true'])::after {
|
|
31
|
+
transform: rotate(180deg);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* The value's option: weight 600 and a 16 px check at its end (aria-selected marks only the
|
|
35
|
+
current option while open, APG). Every option keeps the check's column, so rows line up. */
|
|
36
|
+
.fs-select--listbox .fs-menu__item[role='option']::after {
|
|
37
|
+
content: '';
|
|
38
|
+
flex: none;
|
|
39
|
+
width: 16px;
|
|
40
|
+
height: 16px;
|
|
41
|
+
margin-left: var(--fs-space-2);
|
|
42
|
+
}
|
|
43
|
+
.fs-select--listbox .fs-menu__item[role='option']:not(:has(.fs-menu__detail))::after {
|
|
44
|
+
margin-left: auto;
|
|
45
|
+
}
|
|
46
|
+
.fs-select--listbox .fs-menu__item.fs-is-value {
|
|
47
|
+
font-weight: var(--fs-weight-semibold);
|
|
48
|
+
}
|
|
49
|
+
.fs-select--listbox .fs-menu__item.fs-is-value::after {
|
|
50
|
+
background-color: var(--fs-accent);
|
|
51
|
+
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")
|
|
52
|
+
center / contain no-repeat;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Read-only: no edge, no chevron, the value in full ink (as a read-only input). */
|
|
56
|
+
.fs-select__trigger[aria-readonly='true'] {
|
|
57
|
+
background-color: transparent;
|
|
58
|
+
border-color: transparent;
|
|
59
|
+
cursor: default;
|
|
60
|
+
}
|
|
61
|
+
.fs-select--listbox:has(> [aria-readonly='true'])::after {
|
|
62
|
+
content: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Disabled last: by colour, never opacity. It stays focusable (aria-disabled). */
|
|
66
|
+
.fs-select__trigger[aria-disabled='true'] {
|
|
67
|
+
color: var(--fs-ink-disabled);
|
|
68
|
+
background-color: var(--fs-bg-disabled);
|
|
69
|
+
border-color: var(--fs-line);
|
|
70
|
+
cursor: not-allowed;
|
|
71
|
+
}
|
|
72
|
+
.fs-select__trigger[aria-disabled='true'] .fs-select__placeholder {
|
|
73
|
+
color: var(--fs-ink-disabled);
|
|
74
|
+
}
|
|
75
|
+
.fs-select--listbox:has(> [aria-disabled='true']) {
|
|
76
|
+
color: var(--fs-ink-disabled);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Forced colours: the trigger is a div, so the system draws no control edge for it: give it one.
|
|
80
|
+
The check is drawn in a system colour; the current option keeps the Highlight outline. */
|
|
81
|
+
@media (forced-colors: active) {
|
|
82
|
+
.fs-select__trigger {
|
|
83
|
+
border: var(--fs-line-width) solid ButtonText;
|
|
84
|
+
}
|
|
85
|
+
.fs-select__trigger[aria-readonly='true'] {
|
|
86
|
+
border-color: transparent;
|
|
87
|
+
}
|
|
88
|
+
.fs-select--listbox .fs-menu__item.fs-is-value::after {
|
|
89
|
+
background-color: CanvasText;
|
|
90
|
+
}
|
|
91
|
+
.fs-select--listbox .fs-menu__item[aria-selected='true'] {
|
|
92
|
+
outline-color: Highlight;
|
|
93
|
+
}
|
|
94
|
+
.fs-select__trigger[aria-disabled='true'],
|
|
95
|
+
.fs-select__trigger[aria-disabled='true'] .fs-select__placeholder {
|
|
96
|
+
color: GrayText;
|
|
97
|
+
border-color: GrayText;
|
|
98
|
+
}
|
|
99
|
+
.fs-select--listbox:has(> [aria-disabled='true'])::after {
|
|
100
|
+
background-color: GrayText;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Custom select — `.fs-select--listbox`
|
|
2
|
+
|
|
3
|
+
Spec 02 B (F2 draft §2, T132). CSS: `css/select.css`, on top of `css/input.css` (the trigger's look)
|
|
4
|
+
and `css/menu.css` (the popup); `kit.css` has all three. Behaviour: `createSelect(root, { trigger, list })`.
|
|
5
|
+
React: `ListboxSelect`. Gallery: `inputs.html`.
|
|
6
|
+
|
|
7
|
+
The native select (`.fs-select` around a `<select>`, see input.md) stays the default. This one is a
|
|
8
|
+
select-only combobox for options that need an icon, a detail, a disabled reason or a long list.
|
|
9
|
+
|
|
10
|
+
```html
|
|
11
|
+
<span class="fs-field__label" id="scenario-l">Scenario</span>
|
|
12
|
+
<div class="fs-select fs-select--listbox">
|
|
13
|
+
<div class="fs-select__control fs-select__trigger" role="combobox" tabindex="0" id="scenario" aria-labelledby="scenario-l scenario-v">
|
|
14
|
+
<span class="fs-select__value" id="scenario-v">Actual</span>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="fs-menu fs-menu--listbox" role="listbox" id="scenario-list" aria-label="Scenario" hidden>
|
|
17
|
+
<div class="fs-menu__item fs-is-value" role="option" id="sc-actual" data-value="actual"><span class="fs-menu__label">Actual</span></div>
|
|
18
|
+
<div class="fs-menu__item" role="option" id="sc-budget" data-value="budget">
|
|
19
|
+
<svg class="fs-icon" aria-hidden="true" …></svg><span class="fs-menu__label">Budget</span><span class="fs-menu__detail">2027</span>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="fs-menu__item" role="option" id="sc-archive" aria-disabled="true"><span class="fs-menu__label">Archive (read-only)</span></div>
|
|
22
|
+
</div>
|
|
23
|
+
<input type="hidden" name="scenario" value="actual" />
|
|
24
|
+
</div>
|
|
25
|
+
<!-- No value: <span class="fs-select__placeholder" id="scenario-v">Choose a scenario</span> in place of __value. -->
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import { createSelect } from '@finstack-com-public/design/dom/select';
|
|
30
|
+
const select = createSelect(rootEl, { trigger: triggerEl, list: listEl });
|
|
31
|
+
rootEl.addEventListener('fs-change', (e) => save(e.detail.value)); // the option's id
|
|
32
|
+
select.setValue('sc-budget'); // no event
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- **Parts.** The trigger carries both `fs-select__control` (the native select's height, fill, edge,
|
|
36
|
+
hover, ring and invalid edge) and `fs-select__trigger`. It holds one span: `__value` (the option's
|
|
37
|
+
`__label` text, cut with "…") or `__placeholder` (muted). Keep its id: the trigger's
|
|
38
|
+
`aria-labelledby` names the field's label and then it, so the value is read with the name. The
|
|
39
|
+
list sits inside the root; the helper shows it in the top layer, at least the trigger's width.
|
|
40
|
+
- **Value.** The option holding it has `.fs-is-value`: weight 600 and a check at its end, since
|
|
41
|
+
`aria-selected` marks only the current option while open (APG). No `aria-checked` (T132 S3: screen
|
|
42
|
+
readers say it unevenly); the check and the trigger's text carry it. The helper writes the
|
|
43
|
+
mark, the trigger's span and, when the root holds one, the hidden input (`data-value`, else the
|
|
44
|
+
option's id; T132 S4). A framework that renders those itself passes `writeValue: false`.
|
|
45
|
+
- **Keys** (F2 draft §2, APG). Closed: Down, Alt+Down, Enter or Space open on the value; Up or Home
|
|
46
|
+
on the first option, End on the last; a letter opens on the first match. Open: Up/Down (no wrap),
|
|
47
|
+
Home/End, PageUp/PageDown (ten options); Enter, Space, Alt+Up or a click accept and close; Tab
|
|
48
|
+
accepts, closes and moves on; Escape closes with the value unchanged. Typed letters jump
|
|
49
|
+
(`typeaheadTimeout`, default 500 ms); one letter typed again cycles through its matches. A click
|
|
50
|
+
on the trigger toggles the list; a press outside or focus leaving closes it.
|
|
51
|
+
- **Events.** `fs-change { value }` on the root, only when the value changed. `fs-open` and
|
|
52
|
+
`fs-close` come from the list and bubble through the root; createListbox's `fs-select` stays inside.
|
|
53
|
+
- Disabled options (`aria-disabled="true"`) are skipped by the keys and typeahead and never accepted.
|
|
54
|
+
- Not form-associated (custom elements are out, D13): the hidden input is how a form sees it.
|
|
55
|
+
|
|
56
|
+
| State | Set it with | Look |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| hover, focus | the browser | darker edge; the ring (D15) |
|
|
59
|
+
| expanded | `aria-expanded="true"` (the helper sets it) | the chevron turns over |
|
|
60
|
+
| invalid | `aria-invalid="true"` on the trigger | danger edge (pair it with a message) |
|
|
61
|
+
| disabled | `aria-disabled="true"` on the trigger | disabled fill and ink, never opacity; stays focusable, never opens |
|
|
62
|
+
| read-only | `aria-readonly="true"` on the trigger | no edge, no chevron; never opens |
|
|
63
|
+
| placeholder | `__placeholder` in place of `__value` | muted ink |
|
|
64
|
+
| current option | `aria-selected="true"` (the helper sets it) | the completion list's tint and inside ring |
|
|
65
|
+
| value | `.fs-is-value` on its option | weight 600 and the accent check |
|
|
66
|
+
|
|
67
|
+
In forced colours the trigger gets a `ButtonText` edge (a `div` has no system control edge), the
|
|
68
|
+
check is drawn in `CanvasText`, the current option keeps a `Highlight` outline, and disabled is
|
|
69
|
+
`GrayText`.
|