@finstack-com-public/design 0.7.1 → 0.9.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 CHANGED
@@ -3,6 +3,57 @@
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.9.0 — unreleased
7
+
8
+ Nothing breaks. Upgrading from 0.8.0 needs no change.
9
+
10
+ ### Added
11
+
12
+ - **Date range (T85, D42):** `createCalendar(root, { mode: 'range', value: { start, end }, … })`, at month or day
13
+ granularity. The first pick sets the start, the second the end (swapped if earlier); the cells between preview on
14
+ hover and on keyboard focus; `fs-change` fires with `{ start, end }` only when both are set. Start and end are
15
+ filled like a selected cell, the cells between sit on an accent-wash band, and every cell in the range is
16
+ `aria-selected`. Range mode requires `labels.rangeStart` and `labels.rangeEnd`, which the kit says after the cell's
17
+ name, so the ends are never told by colour alone. See `css/calendar.md`.
18
+ - **Two pages (T85):** `months: 2` shows two months (or two years in a month calendar) side by side, paging together.
19
+ Works in single mode too.
20
+ - **React `DateRangeCalendar` (T85):** `value`/`defaultValue` as `{ start, end }`, `onChange({ start, end })`;
21
+ `Calendar` also takes `months`.
22
+ - **Date-range picker recipe (T85):** one `.fs-input--picker` button showing both ends ("2026. jan. – 2026. márc."),
23
+ the range calendar in a `.fs-popover--fit`. In `css/calendar.md`.
24
+
25
+ ### Fixed
26
+
27
+ - **Calendar in forced colours (I15):** the selected cell no longer sets `Highlight` behind `HighlightText`, which
28
+ Firefox and WebKit painted with the old ink (axe `color-contrast` failed). It is now `CanvasText` on `Canvas`,
29
+ marked by a 2 px `Highlight` edge inside the cell, as the segmented control does.
30
+
31
+ ## 0.8.0 — 2026-11-09
32
+
33
+ Nothing breaks: everything here is new. Upgrading from 0.7.1 needs no change.
34
+
35
+ ### Added
36
+
37
+ - **Calendar (T83, D42):** `.fs-calendar` with year, month and day views, and `createCalendar(root, options)` in
38
+ `dom`, which builds the grid into an empty root. `granularity: 'month'` stops at the month view (a monthly period
39
+ picker) and `'day'` goes down to days. Values, `min`, `max` and `today` are ISO strings (`YYYY-MM`, `YYYY-MM-DD`),
40
+ never `Date`s. The kit holds no words: you pass the month and weekday names, the `heading` and the day cells'
41
+ `cellLabel` formatters, and the previous/next labels. `weekStart` defaults to Monday. Keyboard: arrows, Home/End,
42
+ PageUp/PageDown (Shift for a year), Enter/Space. Emits `fs-change` with `{ value }`. See `css/calendar.md`.
43
+ The date maths is importable as `dom/calendar-dates`.
44
+ - **React `Calendar` (T84):** controlled (`value`) or uncontrolled (`defaultValue`), `onChange(value)`, `autoFocus`.
45
+ Server rendering outputs the empty root; the grid appears on mount.
46
+ - **Date-picker recipe (T84):** a `.fs-input--picker` button, a `.fs-popover` with the calendar in it, and
47
+ `createPopover` with `focus: 'none'` (focus goes to the value cell). Picking closes it and returns focus to the
48
+ button. In `css/calendar.md`, for plain DOM and React.
49
+ - **`.fs-popover--fit` (T84):** a popover as wide as its content, with no padding, for the calendar.
50
+
51
+ ### Fixed
52
+
53
+ - **Picker buttons keep their box (T84):** `.fs-input--picker` drew no fill and no edge, because `.fs-input:read-only`
54
+ matched the `<button>` (CSS `:read-only` matches anything not editable). Inline fields and control rows looked right
55
+ because they strip the box anyway; a picker in a stacked field now shows its box like any input.
56
+
6
57
  ## 0.7.1 — 2026-11-08
7
58
 
8
59
  ### Fixed
@@ -0,0 +1,266 @@
1
+ /* Calendar (spec 02 B): year, month and day views; one value or a range (T85), one page or two.
2
+ Usage: calendar.md. Behaviour: createCalendar, which renders the header and the grid into an empty
3
+ .fs-calendar (D42). */
4
+ @layer fs.components {
5
+ .fs-calendar {
6
+ /* One cell's width: seven make the calendar, so it follows the density. */
7
+ --fs-calendar-cell: var(--fs-control-h);
8
+ /* Between two pages side by side (months: 2). */
9
+ --fs-calendar-gap: var(--fs-space-4);
10
+ display: inline-flex;
11
+ flex-direction: column;
12
+ gap: var(--fs-space-1);
13
+ box-sizing: content-box;
14
+ width: calc(7 * var(--fs-calendar-cell));
15
+ padding: var(--fs-space-2);
16
+ font-size: var(--fs-text-body-size);
17
+ line-height: var(--fs-text-body-line);
18
+ color: var(--fs-ink);
19
+ }
20
+
21
+ .fs-calendar__header {
22
+ position: relative;
23
+ display: flex;
24
+ align-items: center;
25
+ gap: var(--fs-space-1);
26
+ height: var(--fs-control-h);
27
+ }
28
+
29
+ /* Two pages side by side (months: 2): twice as wide in every view, so a popover never resizes. The
30
+ higher views' one grid spans both columns. */
31
+ .fs-calendar:has(> .fs-calendar__months) {
32
+ width: calc(14 * var(--fs-calendar-cell) + var(--fs-calendar-gap));
33
+ }
34
+ .fs-calendar__months {
35
+ display: grid;
36
+ grid-template-columns: repeat(2, 1fr);
37
+ column-gap: var(--fs-calendar-gap);
38
+ }
39
+ .fs-calendar__months > .fs-calendar__grid:only-child {
40
+ grid-column: 1 / -1;
41
+ }
42
+
43
+ /* The second page's heading, over its grid; the view button names the first. Not a control. */
44
+ .fs-calendar__caption {
45
+ position: absolute;
46
+ inset-block: 0;
47
+ inset-inline-start: calc(7 * var(--fs-calendar-cell) + var(--fs-calendar-gap));
48
+ display: flex;
49
+ align-items: center;
50
+ padding: 0 var(--fs-pad-x);
51
+ font-weight: var(--fs-weight-semibold);
52
+ white-space: nowrap;
53
+ }
54
+
55
+ /* Shows the page's heading; steps up a view. In the top view it is the heading alone. */
56
+ .fs-calendar__view {
57
+ display: inline-flex;
58
+ align-items: center;
59
+ gap: var(--fs-space-1);
60
+ box-sizing: border-box;
61
+ min-width: 0;
62
+ height: var(--fs-control-h);
63
+ margin: 0 auto 0 0;
64
+ padding: 0 var(--fs-pad-x);
65
+ font: inherit;
66
+ font-weight: var(--fs-weight-semibold);
67
+ color: var(--fs-ink);
68
+ white-space: nowrap;
69
+ background: transparent;
70
+ border: 0;
71
+ border-radius: var(--fs-radius-sm);
72
+ cursor: pointer;
73
+ }
74
+ .fs-calendar__view-icon {
75
+ width: var(--fs-icon-size);
76
+ height: var(--fs-icon-size);
77
+ color: var(--fs-ink-2);
78
+ }
79
+
80
+ .fs-calendar__grid {
81
+ display: grid;
82
+ align-content: start;
83
+ /* A six-week month and the 4 × 3 month and year pages are the same height. */
84
+ min-height: calc(7 * var(--fs-calendar-cell));
85
+ }
86
+ .fs-calendar__row {
87
+ display: grid;
88
+ grid-template-columns: repeat(3, 1fr);
89
+ }
90
+ .fs-calendar__grid--day .fs-calendar__row {
91
+ grid-template-columns: repeat(7, 1fr);
92
+ }
93
+
94
+ .fs-calendar__weekday {
95
+ display: grid;
96
+ place-items: center;
97
+ height: var(--fs-calendar-cell);
98
+ font-size: var(--fs-text-xs-size);
99
+ line-height: var(--fs-text-xs-line);
100
+ color: var(--fs-ink-muted);
101
+ }
102
+
103
+ .fs-calendar__cell {
104
+ position: relative;
105
+ display: grid;
106
+ place-items: center;
107
+ box-sizing: border-box;
108
+ min-width: 0;
109
+ height: var(--fs-calendar-cell);
110
+ margin: 0;
111
+ padding: 0 2px;
112
+ font: inherit;
113
+ font-variant-numeric: tabular-nums;
114
+ color: var(--fs-ink);
115
+ white-space: nowrap;
116
+ background: transparent;
117
+ border: 0;
118
+ border-radius: var(--fs-radius-sm);
119
+ cursor: pointer;
120
+ }
121
+ .fs-calendar__grid--month .fs-calendar__cell,
122
+ .fs-calendar__grid--year .fs-calendar__cell {
123
+ height: calc(1.75 * var(--fs-calendar-cell));
124
+ }
125
+
126
+ @media (hover: hover) {
127
+ .fs-calendar__view:not([aria-disabled='true']):hover,
128
+ .fs-calendar__cell:hover {
129
+ background-color: var(--fs-bg-hover);
130
+ }
131
+ .fs-calendar__cell[aria-selected='true']:not([aria-disabled='true']):hover {
132
+ background-color: var(--fs-primary-bg-hover);
133
+ }
134
+ .fs-calendar__cell--range[aria-selected='true']:not([aria-disabled='true']):hover {
135
+ background-color: var(--fs-bg-hover);
136
+ }
137
+ }
138
+ .fs-calendar__view:not([aria-disabled='true']):active,
139
+ .fs-calendar__cell:active {
140
+ background-color: var(--fs-bg-active);
141
+ }
142
+
143
+ /* Today: an edge, not a fill, drawn inside so it never meets a neighbour's. */
144
+ .fs-calendar__cell[aria-current='date']::after {
145
+ content: '';
146
+ position: absolute;
147
+ inset: 2px;
148
+ border: var(--fs-line-width) solid var(--fs-accent);
149
+ border-radius: var(--fs-radius-sm);
150
+ pointer-events: none;
151
+ }
152
+
153
+ /* Selected: the accent fill and weight 600, so it never rests on colour alone. */
154
+ .fs-calendar__cell[aria-selected='true'] {
155
+ font-weight: var(--fs-weight-semibold);
156
+ color: var(--fs-primary-ink);
157
+ background-color: var(--fs-primary-bg);
158
+ }
159
+ .fs-calendar__cell[aria-selected='true'][aria-current='date']::after {
160
+ border-color: var(--fs-primary-ink);
161
+ }
162
+
163
+ /* A range (T85): start and end are filled as selected; the cells between are a band on the accent
164
+ wash. Each end squares off where it meets the band, and the band's cells are square, so the band
165
+ runs unbroken across a row. Start and end are also in the cells' names (cellLabel's range role). */
166
+ .fs-calendar__cell--range-start {
167
+ border-start-end-radius: 0;
168
+ border-end-end-radius: 0;
169
+ }
170
+ .fs-calendar__cell--range-end {
171
+ border-start-start-radius: 0;
172
+ border-end-start-radius: 0;
173
+ }
174
+ .fs-calendar__cell--range[aria-selected='true'] {
175
+ font-weight: inherit;
176
+ color: var(--fs-ink);
177
+ background-color: var(--fs-accent-wash);
178
+ border-radius: 0;
179
+ }
180
+ .fs-calendar__cell--range[aria-selected='true'][aria-current='date']::after {
181
+ border-color: var(--fs-accent);
182
+ }
183
+
184
+ /* The preview, while only the start is picked: from the start to the hovered or focused cell, a
185
+ dashed edge above and below, joined across the row. Not a fill: nothing is picked yet. */
186
+ .fs-calendar__cell--preview::before {
187
+ content: '';
188
+ position: absolute;
189
+ inset: 3px 0;
190
+ border-block: var(--fs-line-width) dashed var(--fs-accent);
191
+ pointer-events: none;
192
+ }
193
+
194
+ /* The ring recipe (D15). The header's own button rings outside; cells touch, so theirs is inside. */
195
+ .fs-calendar__view:focus-visible {
196
+ outline: var(--fs-ring-width) solid var(--fs-ring);
197
+ outline-offset: var(--fs-ring-halo-width);
198
+ box-shadow: 0 0 0 var(--fs-ring-halo-width) var(--fs-ring-halo);
199
+ }
200
+ .fs-calendar__cell:focus-visible {
201
+ z-index: 1;
202
+ outline: var(--fs-ring-width) solid var(--fs-ring);
203
+ outline-offset: calc(-1 * var(--fs-ring-width));
204
+ box-shadow: inset 0 0 0 calc(var(--fs-ring-width) + var(--fs-ring-halo-width)) var(--fs-ring-halo);
205
+ }
206
+
207
+ /* The top view's heading is not a control. */
208
+ .fs-calendar__view[aria-disabled='true'] {
209
+ cursor: default;
210
+ }
211
+
212
+ /* Outside min and max: reachable, never pickable. Last, so it beats hover, press and selected. */
213
+ .fs-calendar__cell[aria-disabled='true'] {
214
+ color: var(--fs-ink-disabled);
215
+ background-color: transparent;
216
+ cursor: not-allowed;
217
+ }
218
+
219
+ /* Forced colours: washes and fills are erased, so the selected cell keeps CanvasText on Canvas (Firefox
220
+ and WebKit repaint the background but keep the ink, so a Highlight pair fails contrast: I15) and is
221
+ marked by a 2px Highlight edge inside the cell, as the segmented control does. Today keeps its edge
222
+ (borders survive, in the system's colour), inset further when the cell is selected too. Disabled is
223
+ GrayText. */
224
+ @media (forced-colors: active) {
225
+ .fs-calendar__cell[aria-selected='true'] {
226
+ color: CanvasText;
227
+ background-color: Canvas;
228
+ }
229
+ .fs-calendar__cell[aria-selected='true']:not(.fs-calendar__cell--range)::before {
230
+ content: '';
231
+ position: absolute;
232
+ inset: 0;
233
+ border: 2px solid Highlight;
234
+ border-radius: var(--fs-radius-sm);
235
+ pointer-events: none;
236
+ }
237
+ .fs-calendar__cell[aria-current='date']::after {
238
+ border-color: CanvasText;
239
+ }
240
+ .fs-calendar__cell[aria-selected='true'][aria-current='date']:not(.fs-calendar__cell--range)::after {
241
+ inset: 4px;
242
+ border-color: CanvasText;
243
+ }
244
+ .fs-calendar__cell[aria-disabled='true'] {
245
+ color: GrayText;
246
+ }
247
+ /* The band keeps its shape as a Highlight edge above and below; start and end take the edge above. */
248
+ .fs-calendar__cell--range[aria-selected='true'] {
249
+ color: CanvasText;
250
+ background-color: Canvas;
251
+ }
252
+ .fs-calendar__cell--range[aria-selected='true']::before {
253
+ content: '';
254
+ position: absolute;
255
+ inset: 2px 0;
256
+ border-block: var(--fs-line-width) solid Highlight;
257
+ pointer-events: none;
258
+ }
259
+ .fs-calendar__cell--range[aria-selected='true'][aria-current='date']::after {
260
+ border-color: CanvasText;
261
+ }
262
+ .fs-calendar__cell--preview::before {
263
+ border-color: Highlight;
264
+ }
265
+ }
266
+ }
@@ -0,0 +1,301 @@
1
+ # Calendar — `.fs-calendar`
2
+
3
+ Spec 02 B. CSS: `css/calendar.css` (the header's previous and next buttons also use
4
+ `css/icon-button.css`, and its live region `.fs-visually-hidden` from `css/utilities.css`). Behaviour: `createCalendar(el, options)`, which renders the content (D42).
5
+ Gallery: `inputs.html` (and `react.html` for the React `Calendar`, `DateRangeCalendar` and pickers).
6
+ One value, or a range with `mode: 'range'` (below); one page, or two side by side with `months: 2`.
7
+
8
+ You write only the empty root; the helper renders the header and the grid into it, and re-renders
9
+ the grid on every page and view.
10
+
11
+ ```html
12
+ <div class="fs-calendar" id="period-calendar"></div>
13
+ ```
14
+
15
+ ```js
16
+ import { createCalendar } from '@finstack-com-public/design/dom/calendar';
17
+ const HU_MONTHS = ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus',
18
+ 'szeptember', 'október', 'november', 'december'];
19
+ const HU_DAYS = ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'];
20
+ const calendar = createCalendar(el, {
21
+ value: '2026-11-20', min: '2020-01-01', max: '2027-12-31', // ISO strings; today defaults to the local date
22
+ granularity: 'day', // 'month' for a monthly filter: the value is then 'YYYY-MM'
23
+ weekStart: 1, // Monday (the default); 0 = Sunday
24
+ monthNames: ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'],
25
+ weekdayNames: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'], // Sunday first, whatever the week start
26
+ heading: (p) => (p.view === 'day' ? `${p.year}. ${HU_MONTHS[p.month - 1]}` : p.view === 'month' ? `${p.year}` : `${p.from}–${p.to}`),
27
+ cellLabel: (d) => `${d.year}. ${HU_MONTHS[d.month - 1]} ${d.day}., ${HU_DAYS[d.weekday]}`, // day cells only
28
+ labels: {
29
+ prev: { day: 'Előző hónap', month: 'Előző év', year: 'Előző 12 év' },
30
+ next: { day: 'Következő hónap', month: 'Következő év', year: 'Következő 12 év' },
31
+ up: { day: 'hónap választása', month: 'év választása' }, // optional
32
+ },
33
+ });
34
+ el.addEventListener('fs-change', (e) => setPeriod(e.detail.value));
35
+ ```
36
+
37
+ What it renders (the day view):
38
+
39
+ ```html
40
+ <div class="fs-calendar__header">
41
+ <button type="button" class="fs-calendar__view"><span class="fs-calendar__heading" id="…-heading">2026. november</span><svg class="fs-icon fs-calendar__view-icon">…</svg></button>
42
+ <button type="button" class="fs-icon-button fs-calendar__prev" aria-label="Előző hónap"><svg class="fs-icon">…</svg></button>
43
+ <button type="button" class="fs-icon-button fs-calendar__next" aria-label="Következő hónap"><svg class="fs-icon">…</svg></button>
44
+ </div>
45
+ <div role="grid" class="fs-calendar__grid fs-calendar__grid--day" aria-labelledby="…-heading">
46
+ <div role="row" class="fs-calendar__row"><span role="columnheader" class="fs-calendar__weekday">H</span>…</div>
47
+ <div role="row" class="fs-calendar__row"><span role="gridcell" class="fs-calendar__blank"></span>…
48
+ <button type="button" role="gridcell" class="fs-calendar__cell" tabindex="-1" aria-label="2026. november 1., vasárnap">1</button></div>
49
+ …
50
+ </div>
51
+ <span class="fs-visually-hidden fs-calendar__live" aria-live="polite"></span>
52
+ ```
53
+
54
+ | View | Grid | Cells show | Paging (buttons, PageUp/PageDown) |
55
+ |---|---|---|---|
56
+ | `day` (`granularity: 'day'` only) | `--day`: 7 columns under the weekday row | the day number | a month; Shift+Page a year |
57
+ | `month` | `--month`: 12 months in 3 columns | `monthNames` | a year |
58
+ | `year` | `--year`: 12 years in 3 columns, pages start at multiples of 12 (2016–2027) | the year | 12 years |
59
+
60
+ | State | Set by the helper with | Look |
61
+ |---|---|---|
62
+ | hover, press | — | hover and press washes |
63
+ | focus | the grid's one tab stop (`tabindex="0"`) | the ring, drawn inside: cells touch |
64
+ | selected | `aria-selected="true"` | accent fill, weight 600; forced colours: `CanvasText` on `Canvas` with a 2 px `Highlight` edge inside the cell (I15) |
65
+ | today | `aria-current="date"` | an accent edge inside the cell, not a fill; on the selected cell the edge is white |
66
+ | outside `min`/`max` | `aria-disabled="true"` | disabled ink; reachable by the keyboard, never picked; no opacity |
67
+ | neighbouring months' days | `.fs-calendar__blank` | blank |
68
+ | top view's heading | `aria-disabled="true"` on `__view` | the heading, no chevron, no hover |
69
+ | range start, end (T85) | `aria-selected="true"` + `__cell--range-start` / `__cell--range-end` | filled as selected, square where it meets the band; a one-cell range or a pending start has neither class: a plain selected cell |
70
+ | inside a range | `aria-selected="true"` + `__cell--range` | the band: accent wash, square cells joined across the row, normal weight; forced colours: a `Highlight` edge above and below |
71
+ | preview (start picked, end not yet) | `__cell--preview`, from the start to the hovered cell, else the focused one | a dashed accent edge above and below, no fill; not selected |
72
+
73
+ - **The views:** it opens on the lowest view (`granularity`), on the page of the value, else
74
+ today, held inside `min` and `max`. The view button steps up (day → month → year); picking a
75
+ year or month steps down and focuses the same position there. Picking in the lowest view emits
76
+ `fs-change` with `{ value }` (`YYYY-MM-DD`, or `YYYY-MM` for a month calendar), every time, even
77
+ for the current value, so a popover can close on it.
78
+ - **Keyboard:** one tab stop in the grid; the arrows move (by a week up and down in the day view,
79
+ by a row of three in the others); Home and End go to the row's ends, inside the month; PageUp
80
+ and PageDown page, keeping the position, clamped (31 January → 28 February); Enter and Space
81
+ pick, as on any button. A move that would land on a page with nothing pickable stops at `min`
82
+ or `max`. The header's three buttons are ordinary tab stops; previous and next turn
83
+ `aria-disabled` past `min` and `max`.
84
+ - **Names are yours (D42):** the kit holds no month, weekday or heading text. `monthNames` is what
85
+ the month cells show (short forms fit), `weekdayNames` is the column headers, `heading` makes
86
+ the page heading (which names the grid), `cellLabel` each **day** cell's full accessible name (it
87
+ must contain the day number: "2026. november 9., hétfő"), and `labels` names the
88
+ previous and next buttons per view. `labels.up` is optional: said after the heading in the view
89
+ button's name.
90
+ - **Month and year cells have no `aria-label`:** their name is their visible text ("jan.",
91
+ "2026"), and the grid is labelled by the heading, which carries the year. A full name such as
92
+ "2026. január" behind a visible "jan." fails WCAG 2.5.3 (label in name; axe's
93
+ `label-content-name-mismatch`).
94
+ - **Dates are ISO strings,** never `Date`s: no time zone can move one by a day. `min` and `max`
95
+ may be a month in a day calendar (its first and last day) or a day in a month calendar.
96
+ - **Announcing:** when paging or stepping changes the heading (never on the first render), the new
97
+ heading is written to the host's live region if you pass one as `announcer`; without one the
98
+ calendar keeps its own polite region, a visually hidden `.fs-calendar__live` after the grid. Never
99
+ inside the view button: a live region in a focused button whose name changes is read twice. The
100
+ view button's name stays the heading (plus `labels.up`).
101
+ - Controller: `setValue(iso | null)` (no event), `setView(view)`, `focus()`, `update(options)`,
102
+ `destroy()` (empties the root). The calendar draws no surface or edge of its own: for a picker,
103
+ put it in a popover (below).
104
+ - Don't write the header or the grid yourself, style cells by position, or dim a state with
105
+ opacity.
106
+
107
+ ## Date range — `mode: 'range'` (T85)
108
+
109
+ The same helper (D42), with a start and an end. The first pick sets the start, the second the end
110
+ (swapped if it is earlier); `fs-change` fires with `{ start, end }` only then, never on the first
111
+ pick. A third pick starts a new range.
112
+
113
+ ```js
114
+ const range = createCalendar(el, {
115
+ ...HU_NAMES, // as above
116
+ labels: { ...HU_NAMES.labels, rangeStart: 'kezdete', rangeEnd: 'vége' }, // required in range mode
117
+ mode: 'range', // fixed at creation
118
+ value: { start: '2026-11-04', end: '2026-11-19' }, // or null; YYYY-MM ends with granularity 'month'
119
+ months: 2, // two months side by side (two years in a month calendar)
120
+ min: '2025-01-01', max: '2027-06-30',
121
+ });
122
+ el.addEventListener('fs-change', (e) => setPeriod(e.detail.start, e.detail.end));
123
+ ```
124
+
125
+ - **Never colour alone:** the start's and end's names end with `labels.rangeStart` and
126
+ `labels.rangeEnd` (required in range mode; the kit holds no words), after ", ": a one-cell range
127
+ says both. One rule in every view, by where the name lives: a **day**'s `aria-label`
128
+ (`cellLabel`'s text, then the word: "2026. november 4., szerda, kezdete"); a **month** or
129
+ **year** cell, named by its visible text, gets a visually hidden span after the text
130
+ (`jan.<span class="fs-visually-hidden">, kezdete</span>`), so its name still holds the text as whole
131
+ words (WCAG 2.5.3, axe's `label-content-name-mismatch`). `cellLabel` itself never sees the range.
132
+ Every cell in the range is `aria-selected="true"` (the cells inside say nothing more). In the higher
133
+ views the months (and years) the range touches are marked the same way.
134
+ - **Preview:** while only the start is picked, the cells from it to the hovered cell, else to the
135
+ focused cell while the grid has focus, take `__cell--preview` (a class, not a selection; a
136
+ disabled cell previews nothing). The keyboard leads once it moves.
137
+ - **Value in, value out:** `value` is read leniently: ends in either order, a month as a day
138
+ calendar's `end` means its last day, a missing or malformed start means no range. `calendar.value`
139
+ is `{ start, end }` with `end: null` while the second pick is pending, or null. `setValue(range)`
140
+ (no event) drops a pending start, so a picker calls it on each open.
141
+ - `min`/`max` work as for one value: a disabled cell is never a start or an end.
142
+
143
+ **Two pages (`months: 2`, either mode):** the lowest view shows two pages side by side, in a
144
+ `__months` grid; the first is named by the view button's heading, the second by a `__caption`
145
+ heading in the header (not a control), each grid `aria-labelledby` its own. Arrows cross from one
146
+ page to the other without paging; a move past the second page pages both by one. PageUp/PageDown
147
+ and the previous and next buttons page both together, keeping the focus's column; previous and
148
+ next turn off when the page before the first, or after the second, has nothing pickable. The new
149
+ pair is announced as "2026. december – 2027. január". The higher views are one grid, as wide, so a
150
+ popover never resizes; stepping down puts the picked month on the left.
151
+
152
+ ```html
153
+ <div class="fs-calendar__header">
154
+ <button type="button" class="fs-calendar__view"><span class="fs-calendar__heading" id="…-heading">2026. november</span>…</button>
155
+ <span class="fs-calendar__caption" id="…-caption">2026. december</span>
156
+ <button type="button" class="fs-icon-button fs-calendar__prev" aria-label="Előző hónap">…</button>
157
+ <button type="button" class="fs-icon-button fs-calendar__next" aria-label="Következő hónap">…</button>
158
+ </div>
159
+ <div class="fs-calendar__months">
160
+ <div role="grid" class="fs-calendar__grid fs-calendar__grid--day" aria-labelledby="…-heading">…</div>
161
+ <div role="grid" class="fs-calendar__grid fs-calendar__grid--day" aria-labelledby="…-caption">…</div>
162
+ </div>
163
+ ```
164
+
165
+ `--fs-calendar-gap` (`--fs-space-4`) is the gap between the pages.
166
+
167
+ ## Date picker — a picker button and a popover (T84)
168
+
169
+ The recipe for a period field (BI App's monthly and daily filters): a `.fs-input--picker` button
170
+ shows the value; a `.fs-popover.fs-popover--fit` holds the calendar. Picking closes it and focus
171
+ returns to the button; Escape closes it the same way; a click outside closes it.
172
+
173
+ ```html
174
+ <div class="fs-field">
175
+ <label class="fs-field__label" for="period">Időszak</label>
176
+ <button class="fs-input fs-input--picker" id="period" type="button" aria-haspopup="dialog">2026. 11. 20.</button>
177
+ </div>
178
+ <div class="fs-popover fs-popover--fit" id="period-pop" role="dialog" aria-label="Időszak választása" hidden>
179
+ <div class="fs-calendar" id="period-cal"></div>
180
+ </div>
181
+ ```
182
+
183
+ ```js
184
+ let value = '2026-11-20';
185
+ const calendar = createCalendar(calEl, { ...HU_NAMES, value, min, max }); // the names as above
186
+ const pop = createPopover(popEl, { anchor: button, focus: 'none' });
187
+ // Each open starts on the value's page with focus on the value, as WAI-ARIA's date-picker dialog does.
188
+ popEl.addEventListener('fs-open', (e) => {
189
+ if (e.target !== popEl) return;
190
+ calendar.setValue(value);
191
+ calendar.focus();
192
+ });
193
+ calEl.addEventListener('fs-change', (e) => {
194
+ value = e.detail.value;
195
+ button.textContent = formatHu(value); // "2026. 11. 20."; a month: "2026. március"
196
+ pop.close(); // focus returns to the button
197
+ });
198
+ ```
199
+
200
+ ```tsx
201
+ import { Calendar, Field, PickerButton, Popover } from '@finstack-com-public/design/react';
202
+
203
+ function PeriodPicker({ value, onChange, min, max }: Props) {
204
+ const button = useRef<HTMLButtonElement>(null);
205
+ const [open, setOpen] = useState(false);
206
+ const [opened, setOpened] = useState(0); // a new key each open: the calendar starts on the value
207
+ return (
208
+ <>
209
+ <Field label="Időszak">
210
+ {(c) => <PickerButton {...c} ref={button} aria-haspopup="dialog">{formatHu(value)}</PickerButton>}
211
+ </Field>
212
+ <Popover anchor={button} label="Időszak választása" className="fs-popover--fit" focus="none" open={open}
213
+ onOpenChange={(o) => { if (o) setOpened((n) => n + 1); setOpen(o); }}>
214
+ <Calendar key={opened} autoFocus={open} {...HU_NAMES} value={value} min={min} max={max}
215
+ onChange={(v) => { onChange(v); setOpen(false); }} />
216
+ </Popover>
217
+ </>
218
+ );
219
+ }
220
+ ```
221
+
222
+ - **`focus: 'none'`, then the grid:** the popover's own `'first'` would land on the view button;
223
+ the recipe moves focus to the value instead (`calendar.focus()`, or `autoFocus` on a fresh
224
+ `Calendar`). The header's next, previous and view buttons are Shift+Tab away.
225
+ - **Keyboard alone:** Enter or Space on the button opens it on the value; in a day calendar three
226
+ Shift+Tabs reach the view button, Enter steps up to the months, three Tabs come back to the grid,
227
+ arrows and Enter pick a month, then arrows and Enter pick the day; the popover closes and focus
228
+ is back on the button. Escape closes it from anywhere inside, back on the button too.
229
+ - **No backdrop.** A popover is non-modal: the page stays visible and live, and an outside click
230
+ closes it. Don't add a dimmed backdrop (BI App's period picker had one); use a dialog if the page
231
+ must be blocked.
232
+ - The popover needs a name (`aria-label`, or a title); the button says the value, its label says
233
+ what it is.
234
+
235
+ ## Date-range picker — two values on one button (T85)
236
+
237
+ The date-picker recipe with the range calendar: the button shows both ends ("2026. jan. – 2026.
238
+ márc.", "2026. 11. 04. – 2026. 11. 19."); the first pick sets the start and the popover stays open;
239
+ the second pick fires `fs-change` and closes it, focus back on the button. Escape after a first pick
240
+ closes it with the range unchanged; the next open shows that range again (`setValue` drops the
241
+ pending start).
242
+
243
+ ```html
244
+ <div class="fs-field">
245
+ <label class="fs-field__label" for="span">Időszak</label>
246
+ <button class="fs-input fs-input--picker" id="span" type="button" aria-haspopup="dialog">2026. 11. 04. – 2026. 11. 19.</button>
247
+ </div>
248
+ <div class="fs-popover fs-popover--fit" id="span-pop" role="dialog" aria-label="Időszak választása" hidden>
249
+ <div class="fs-calendar" id="span-cal"></div>
250
+ </div>
251
+ ```
252
+
253
+ ```js
254
+ let value = { start: '2026-11-04', end: '2026-11-19' };
255
+ const labels = { ...HU_NAMES.labels, rangeStart: 'kezdete', rangeEnd: 'vége' };
256
+ const calendar = createCalendar(calEl, { ...HU_NAMES, labels, mode: 'range', months: 2, value, min, max });
257
+ const pop = createPopover(popEl, { anchor: button, focus: 'none' });
258
+ popEl.addEventListener('fs-open', (e) => {
259
+ if (e.target !== popEl) return;
260
+ calendar.setValue(value); // back to the range, dropping a start left pending by Escape
261
+ calendar.focus(); // on the start
262
+ });
263
+ calEl.addEventListener('fs-change', (e) => {
264
+ value = e.detail; // { start, end }, both set
265
+ button.textContent = `${formatHu(value.start)} – ${formatHu(value.end)}`;
266
+ pop.close();
267
+ });
268
+ ```
269
+
270
+ ```tsx
271
+ import { DateRangeCalendar, Field, PickerButton, Popover } from '@finstack-com-public/design/react';
272
+
273
+ function SpanPicker({ value, onChange, min, max }: Props) {
274
+ const button = useRef<HTMLButtonElement>(null);
275
+ const [open, setOpen] = useState(false);
276
+ const [opened, setOpened] = useState(0);
277
+ return (
278
+ <>
279
+ <Field label="Időszak">
280
+ {(c) => <PickerButton {...c} ref={button} aria-haspopup="dialog">{formatHu(value.start)} – {formatHu(value.end)}</PickerButton>}
281
+ </Field>
282
+ <Popover anchor={button} label="Időszak választása" className="fs-popover--fit" focus="none" open={open}
283
+ onOpenChange={(o) => { if (o) setOpened((n) => n + 1); setOpen(o); }}>
284
+ <DateRangeCalendar key={opened} autoFocus={open} months={2} {...HU_NAMES} labels={labels} value={value} min={min} max={max}
285
+ onChange={(range) => { onChange(range); setOpen(false); }} />
286
+ </Popover>
287
+ </>
288
+ );
289
+ }
290
+ ```
291
+
292
+ - **`DateRangeCalendar`** is the React wrapper for `mode: 'range'` (the same helper; its `labels`
293
+ must carry `rangeStart` and `rangeEnd`): `value` / `defaultValue` are `{ start, end }`,
294
+ `onChange({ start, end })` comes only with both ends. A pending
295
+ start lives in the helper: a parent re-rendering an equal range keeps it; a range the parent
296
+ refuses is put back. `Calendar` takes `months` too.
297
+ - **Presets** ("last 3 months") are not part of the kit: put the product's own buttons in the
298
+ popover (a `.fs-popover__actions` row under the calendar) and call `setValue`, or set the React `value`.
299
+ - One day calendar with two months is 14 cells wide (about 410 px compact): on a narrow screen use
300
+ `months: 1`.
301
+
@@ -65,8 +65,10 @@
65
65
  border-color: var(--fs-danger-fill);
66
66
  }
67
67
 
68
- /* Read-only: no control edge, the value in full ink. */
69
- .fs-input:read-only,
68
+ /* Read-only: no control edge, the value in full ink. `:read-only` matches anything not editable, a
69
+ <button> too, so the picker button is left out (T84); `:where` keeps the specificity at (0,2,0), so
70
+ disabled still wins. */
71
+ .fs-input:where(:not(.fs-input--picker)):read-only,
70
72
  .fs-textarea:read-only {
71
73
  background-color: transparent;
72
74
  border-color: transparent;
package/dist/css/input.md CHANGED
@@ -12,7 +12,9 @@ Spec 02 B. CSS: `css/input.css`. Gallery: `inputs.html`.
12
12
  - **Select:** the native `<select>` sits in a `.fs-select` wrapper, which draws the chevron: a
13
13
  `<select>` can't hold a pseudo-element. A custom listbox is later (spec 02).
14
14
  - `fs-input--num` right-aligns with tabular figures; the number comes formatted from the product.
15
- - `fs-input--picker` on a `<button>` makes a field that opens a picker (tree, chips, calendar).
15
+ - `fs-input--picker` on a `<button>` makes a field that opens a picker (tree, chips, calendar). It
16
+ keeps the input's fill and edge: a button is `:read-only` to CSS, and the read-only look leaves
17
+ the picker out (T84).
16
18
  - An input fills its container. A short inline one (a rename field) takes
17
19
  `width: var(--fs-size-input-sm)`: 10em, about 16 characters at any density (utilities.md,
18
20
  "Layout widths").
@@ -46,6 +46,13 @@
46
46
  margin-top: var(--fs-space-3);
47
47
  }
48
48
 
49
+ /* Fits its content and leaves the padding to it: a picker's calendar (T84). */
50
+ .fs-popover--fit {
51
+ width: max-content;
52
+ max-width: calc(100vw - 16px);
53
+ padding: 0;
54
+ }
55
+
49
56
  /* The ring recipe (D15), when the panel itself takes focus. */
50
57
  .fs-popover:focus-visible {
51
58
  outline: var(--fs-ring-width) solid var(--fs-ring);