@apliteni/apliteni-ui 0.178.0 → 0.179.1
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/README.md +1 -1
- package/docs/components.md +1188 -1457
- package/docs/foundations.md +48 -54
- package/guidelines/button-labels.md +4 -4
- package/guidelines/iconography.md +3 -3
- package/package.json +1 -1
- package/react/README.md +2 -2
- package/react/dist/index.css +8 -2
- package/react/dist/index.d.ts +10 -4
- package/react/dist/index.js +41 -2
- package/src/html.js +1 -1
- package/src/index.d.ts +6 -6
- package/src/logic/accents.js +1 -1
- package/src/logic/account-nav.js +1 -1
- package/src/logic/chart.js +1 -1
- package/src/logic/dropdown-placement.js +11 -11
- package/src/logic/filter-bar.js +4 -4
- package/src/styles/back.css +8 -6
- package/src/styles/button.css +2 -2
- package/src/styles/card.css +1 -1
- package/src/styles/chart.css +2 -2
- package/src/styles/command-palette.css +2 -2
- package/src/styles/drawer.css +2 -2
- package/src/styles/dropdown.css +41 -28
- package/src/styles/file-drop.css +1 -1
- package/src/styles/filter-bar.css +8 -7
- package/src/styles/input.css +9 -4
- package/src/styles/layout.css +38 -28
- package/src/styles/loading.css +1 -1
- package/src/styles/nav.css +4 -4
- package/src/styles/pagination.css +1 -1
- package/src/styles/segmented.css +5 -5
- package/src/styles/table.css +3 -3
- package/src/styles/tap-zone.css +7 -0
- package/src/styles/tooltip.css +1 -1
- package/src/styles/topbar.css +7 -7
- package/src/tokens/tokens.css +1 -1
package/docs/foundations.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# Foundations
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Use this page when you write CSS of your own beside the kit, or when you need to know what a
|
|
4
|
+
component keeps on every screen. The kit ships these values, and every component meets these
|
|
5
|
+
minimums. [components.md](components.md) tells you which component to use and how. The design
|
|
6
|
+
rules for a screen are in [the guidelines](../guidelines/overview.md). The issue that settled a
|
|
7
|
+
number explains why it has that value.
|
|
7
8
|
|
|
8
9
|
Everything here is a CSS custom property that you can read and re-point. Take the tokens from
|
|
9
10
|
`@apliteni/apliteni-ui/tokens` and `/accents`, or take the full stylesheet from `/css`.
|
|
@@ -18,9 +19,8 @@ Everything here is a CSS custom property that you can read and re-point. Take th
|
|
|
18
19
|
Use the first value for a box that bounds the page. Use the second for a box that bounds a line
|
|
19
20
|
of text. The kit does not write a page-scale width as a number.
|
|
20
21
|
|
|
21
|
-
`
|
|
22
|
-
default. `wide` removes that limit and fills the track beside the rail.
|
|
23
|
-
limit under either name. If the kit cannot use a value, it drops that value.
|
|
22
|
+
The `width` of `AppShell` sets the content column. `centered` limits and centres it, and is the
|
|
23
|
+
default. `wide` removes that limit and fills the track beside the rail.
|
|
24
24
|
|
|
25
25
|
## Boxes below the page
|
|
26
26
|
|
|
@@ -70,17 +70,21 @@ first label on the page title's edge.
|
|
|
70
70
|
|
|
71
71
|
## Control corners
|
|
72
72
|
|
|
73
|
-
**Every control that a reader presses
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
bar, a wordless button takes the row's height and stays a circle.
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
**Every control that a reader presses is a pill.** This covers each button size, each dropdown
|
|
74
|
+
trigger, also in a form, a filter chip and the filter bar's add control, a select and the back
|
|
75
|
+
link. The corner is `--radius-pill`. A wordless button is square, so the pill makes it a circle.
|
|
76
|
+
The account button in the band is a 40px circle. In a toolbar beside a full field or a filter
|
|
77
|
+
bar, a wordless button takes the row's height and stays a circle. The kit's padding keeps text,
|
|
78
|
+
glyphs, units and the focus ring inside the rounded edge. Give a control of your own the same
|
|
79
|
+
corner.
|
|
80
|
+
|
|
81
|
+
**Every field that a reader types into has the field corner, `--radius-md`.** This covers a text
|
|
82
|
+
field, a search field of each size, the search field in a dropdown panel, the page field of a
|
|
83
|
+
pager and a text area. In a form, a dropdown trigger has the height of the text field beside it,
|
|
84
|
+
but it keeps the pill. Give a field of your own the same corner.
|
|
80
85
|
|
|
81
86
|
These parts keep another corner:
|
|
82
87
|
|
|
83
|
-
- A text area keeps `--radius-md`, because a pill does not fit several lines.
|
|
84
88
|
- A segmented strip keeps its own rounded track.
|
|
85
89
|
- A menu row, a palette row and a date picker's day cell keep their small corner. They are rows
|
|
86
90
|
and cells in a panel, not controls on the page.
|
|
@@ -128,7 +132,7 @@ sentence case and renders as written. A word that is capitalised in itself stays
|
|
|
128
132
|
|
|
129
133
|
| rank | size | weight | line-height | what takes it |
|
|
130
134
|
| ------------ | ------------- | ------------------- | ------------------ | ------------- |
|
|
131
|
-
| `page-title` | `--text-2xl` | `--weight-bold` | `1.1` | the page's `h1` inside `
|
|
135
|
+
| `page-title` | `--text-2xl` | `--weight-bold` | `1.1` | the page's `h1` inside `AppShell` |
|
|
132
136
|
| `card-title` | `--text-lg` | `--weight-semibold` | `--leading-snug` | a card's title |
|
|
133
137
|
| `body` | `--text-base` | `--weight-normal` | `--leading-normal` | running text |
|
|
134
138
|
| `label` | `--text-sm` | `--weight-medium` | inherited | an eyebrow, a table head, a nav or menu caption, a footer column title, a code sample's label |
|
|
@@ -139,8 +143,8 @@ On the kit's scale, these are 30, 18, 14.5, 13, 13 and 12px. When two ranks shar
|
|
|
139
143
|
their weight separates them. `label` and `caption` are both 13px. Words use body ink, including
|
|
140
144
|
labels and captions. See [Text ink](#text-ink).
|
|
141
145
|
|
|
142
|
-
**A card title is a heading, one level under the page's.**
|
|
143
|
-
|
|
146
|
+
**A card title is a heading, one level under the page's.** `<Card>` draws an `h2`. `level`
|
|
147
|
+
moves it to `h3`–`h6`. An eyebrow above a card title is a label, not a heading.
|
|
144
148
|
|
|
145
149
|
## Motion
|
|
146
150
|
|
|
@@ -164,15 +168,12 @@ Every easing is also a token. `--ease` is the default. The other options are `--
|
|
|
164
168
|
- A `transition` always reads a duration token. An `animation` may keep its own number in two
|
|
165
169
|
cases, named at the declaration: **ambient** motion with no interaction origin, and
|
|
166
170
|
**choreographed** sequences timed against each other. There is no third kind.
|
|
167
|
-
- **
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
do nothing for a missing element. None of the three
|
|
172
|
-
|
|
173
|
-
is whatever the engine's style API says about it. A caller sizing a backstop timer for a fade
|
|
174
|
-
can read the stylesheet instead of copying a duration token, and an unmounted ref gets a timer
|
|
175
|
-
that fires immediately instead of an exception.
|
|
171
|
+
- **Use `transitionMs(el)` to time a fallback for a fade.** It returns the transition time
|
|
172
|
+
that the stylesheet gives `el`, in milliseconds: the longest duration plus its delay. Read it
|
|
173
|
+
instead of copying a duration token. It returns `0` for a missing element, for anything that
|
|
174
|
+
is not an element and where there is no window, so a timer for an unmounted ref fires at once.
|
|
175
|
+
`playEntrance()` and `replay()` do nothing for a missing element. None of the three checks
|
|
176
|
+
that the element is still in the document.
|
|
176
177
|
|
|
177
178
|
### Reduced motion travels with the stylesheet
|
|
178
179
|
|
|
@@ -219,10 +220,9 @@ The neutral fill separates from a card by about 1.22:1 in dark and 1.20:1 in lig
|
|
|
219
220
|
|
|
220
221
|
**A status chip's ink and fill form one pair.** Change them together and check the result
|
|
221
222
|
on the page, a card and a floating panel in both themes. Keep text at least 4.5:1.
|
|
222
|
-
Light success has a stronger aim of **7:1** on its fill. It
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
meet 4.5:1 but do not all meet 7:1. Dark danger measures at least 6.30:1 on these three grounds.
|
|
223
|
+
Light success has a stronger aim of **7:1** on its fill. It measures 7.17:1. The other light
|
|
224
|
+
status pairs meet 4.5:1 but do not all meet 7:1. Dark danger measures at least 6.30:1 on these
|
|
225
|
+
three grounds.
|
|
226
226
|
|
|
227
227
|
**A status word has its own ink in light.** A word with no fill stands on a selected row's accent
|
|
228
228
|
wash, so `--status-warn-ink`, `--status-info-ink` and `--status-danger-ink` are deeper than the
|
|
@@ -251,11 +251,11 @@ These fill ratios describe separation, not text contrast.
|
|
|
251
251
|
`--field-bg` and `--disabled-surface` are both `--surface` in both themes. A field is
|
|
252
252
|
therefore drawn by its edge. On the page ground, a disabled field measures 1.12:1. This is
|
|
253
253
|
a white box on a grey page. **Put a form on a card.** A filter bar above a table is the one
|
|
254
|
-
exception. See [Forms](components.md#
|
|
254
|
+
exception. See [Forms](components.md#fields).
|
|
255
255
|
- **The box reports the state, so a field that is off draws the fainter edge of the two.** The
|
|
256
256
|
same two tokens paint a button, so a button that is off drops a rung with the field.
|
|
257
|
-
- **A disabled select carries the kit's own paint and no fade
|
|
258
|
-
|
|
257
|
+
- **A disabled select carries the kit's own paint and no fade**, also in Chromium, which fades
|
|
258
|
+
a disabled select by default.
|
|
259
259
|
- **A dropdown trigger uses the live control edge while it is live.** It uses
|
|
260
260
|
`--control-edge`, as `.ui-btn` does. When it is off, it uses `--disabled-border`,
|
|
261
261
|
`--disabled-ink`, and `cursor: not-allowed`. Hover does not take the accent from an
|
|
@@ -283,8 +283,8 @@ where columns scroll under its frame or its pinned column, in both themes. A ste
|
|
|
283
283
|
| modal | `--level-line`, one line | `--elev-drop` | none, the deep scrim separates it | `--elev-drop` |
|
|
284
284
|
|
|
285
285
|
Each level reads its line from one token in both themes: `--card-edge`, `--rail-edge`,
|
|
286
|
-
`--float-edge`, `--float-edge-inner` and `--modal-edge
|
|
287
|
-
modal draws `--modal-edge` as an inset line
|
|
286
|
+
`--float-edge`, `--float-edge-inner` and `--modal-edge`. Re-point the token to change the line
|
|
287
|
+
of a level. The modal draws `--modal-edge` as an inset line.
|
|
288
288
|
|
|
289
289
|
The ladder, from bottom to top:
|
|
290
290
|
|
|
@@ -300,8 +300,7 @@ The ladder, from bottom to top:
|
|
|
300
300
|
themes, fields, code blocks, navigation labels and segmented controls use those reading
|
|
301
301
|
surfaces. `--surface-2` and `--surface-3` are for non-text fills and tracks. A status chip
|
|
302
302
|
is the named exception. It uses a soft fill, and neutral chip tones use
|
|
303
|
-
`--chip-neutral-fill
|
|
304
|
-
floating panel in dark and vanished on a white card in light.
|
|
303
|
+
`--chip-neutral-fill`, which stays visible on a card and on a floating panel in both themes.
|
|
305
304
|
|
|
306
305
|
**A selected item is the one exception.** Selection is marked by a background highlight. An
|
|
307
306
|
enabled chosen segmented pill takes the primary button's pair, `--accent-strong` with
|
|
@@ -411,7 +410,7 @@ for a focusable that is neither a link nor a kit control — a `div` or `span` y
|
|
|
411
410
|
|
|
412
411
|
**A focused control draws the band and nothing beside it.** A boxed text field keeps its 1px border width during visible focus.
|
|
413
412
|
The same rule applies to a text area, select and search field. Their border becomes transparent during visible focus.
|
|
414
|
-
This applies to
|
|
413
|
+
This applies to every field, including the Dropdown search field. The ring keeps its 2px width and accent ink.
|
|
415
414
|
It also keeps a 1px clear gap. Other edges keep their resting ink.
|
|
416
415
|
If a hover rule would outrank focus, it stands aside with `:not(:focus-visible)`.
|
|
417
416
|
A drop zone still recolours its dashed edge while a file is over it. That edge marks the drop target, not focus.
|
|
@@ -439,10 +438,10 @@ you set it on a painted container of your own, or recomposed `--ring` there, del
|
|
|
439
438
|
iOS Safari zooms the page into a focused field when its text is smaller than 16px. It does not
|
|
440
439
|
zoom back out.
|
|
441
440
|
|
|
442
|
-
- **One net, over elements rather than classes.**
|
|
443
|
-
|
|
444
|
-
with nothing to type into
|
|
445
|
-
|
|
441
|
+
- **One net, over elements rather than classes.** On a touch screen, every `input`, `select`
|
|
442
|
+
and `textarea` is 16px, your own fields too. Both published stylesheets hold the net. Controls
|
|
443
|
+
with nothing to type into keep their size, because they do not zoom. The net uses
|
|
444
|
+
`!important`.
|
|
446
445
|
- **The size is real, never a scaled 16px.** The zoom uses the computed font size. A 16px field
|
|
447
446
|
that is made smaller with a `transform` still zooms.
|
|
448
447
|
- **`font-size` and not the viewport.** `user-scalable=no` also stops the zoom. It removes
|
|
@@ -483,18 +482,13 @@ unless it cannot overflow. Only a row whose marks are each a fixed square, a dra
|
|
|
483
482
|
or a dense table's action cell opens across. Some families get no layer. The Accessibility
|
|
484
483
|
minimums page names all of them. Rows that share an edge have no space outside a row for a
|
|
485
484
|
layer. `input`, `select` and `textarea` generate no pseudo-element and use their own height.
|
|
486
|
-
A back link draws
|
|
485
|
+
A back link draws 32 high, and its layer reaches 6 above and 6 below it to make 44.
|
|
487
486
|
|
|
488
|
-
The whole system
|
|
489
|
-
|
|
490
|
-
**last**, and its openings use `!important` because each one overrides a gap already set by a
|
|
491
|
-
component. `--tap-min` is declared in that sheet rather than the token file because the React
|
|
492
|
-
entry imports these nets without `tokens.css`. It is still a token, and you can move it.
|
|
487
|
+
The whole system applies only below 560px with a coarse pointer, because a coarse pointer has
|
|
488
|
+
no hover. `--tap-min` is a token, and you can move it.
|
|
493
489
|
|
|
494
|
-
**A row that already has the room opens nothing
|
|
495
|
-
|
|
496
|
-
remains 34px square. The existing space lets their targets reach 44px without changing
|
|
497
|
-
those drawn sizes.
|
|
490
|
+
**A row that already has the room opens nothing.** The shell's band stays a 52px row, and its
|
|
491
|
+
controls reach 44px targets in the room that the band already has.
|
|
498
492
|
|
|
499
493
|
On a phone, the product topbar uses two rows with a 44px minimum height per row.
|
|
500
494
|
Brand, theme and account occupy the first row. The view and version switches occupy the
|
|
@@ -530,7 +524,7 @@ a colour keep the shorthand.
|
|
|
530
524
|
glyphs may appear without a word and what each glyph means.
|
|
531
525
|
|
|
532
526
|
**A status glyph is circled.** A circled glyph reports a state. A bare glyph names an action.
|
|
533
|
-
`
|
|
527
|
+
`Toast` and `Callout` use the circled status glyphs for success, danger and warning:
|
|
534
528
|
`circleCheck`, `circleX` and `circleAlert`. Info and neutral callouts use `info`. An explicit
|
|
535
529
|
`icon` still wins. A neutral toast still uses `bolt`, because it reports an event without a
|
|
536
530
|
verdict.
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
|
|
51
51
|
<!-- rule: one-shape -->
|
|
52
52
|
|
|
53
|
-
**Rule:** Draw buttons, dropdowns, filter chips and
|
|
53
|
+
**Rule:** Draw buttons, dropdowns, filter chips and selects as pills, and a wordless button as a circle.
|
|
54
54
|
|
|
55
55
|
**Why:** One shape marks what a reader can use.
|
|
56
56
|
|
|
57
|
-
**Except:** A text
|
|
57
|
+
**Except:** A text field has the field corner, because it is a box for text.
|
|
58
58
|
|
|
59
|
-
**Do:**
|
|
59
|
+
**Do:** A search field with the field corner beside pill buttons.
|
|
60
60
|
|
|
61
|
-
**Don't:**
|
|
61
|
+
**Don't:** Square buttons and a pill search field.
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
**Why:** Without a legend, readers need labels for unfamiliar glyphs.
|
|
10
10
|
|
|
11
|
-
**Except:** New entries require a decision and pass Earn a wordless button on Button labels. Allowed: close, copy, overflow, expand, collapse and export. Theme and sidebar toggles and collapsed-rail links have separate approval. Owner additions: Table beside Chart or Board ([#742](https://github.com/apliteni/apliteni-ui/issues/742), [#832](https://github.com/apliteni/apliteni-ui/issues/832)),
|
|
11
|
+
**Except:** New entries require a decision and pass Earn a wordless button on Button labels. Allowed: close, copy, overflow, expand, collapse and export. Theme and sidebar toggles and collapsed-rail links have separate approval. Owner additions: Table beside Chart or Board ([#742](https://github.com/apliteni/apliteni-ui/issues/742), [#832](https://github.com/apliteni/apliteni-ui/issues/832)), the account avatar ([#834](https://github.com/apliteni/apliteni-ui/issues/834)), an AppShell search trigger below 560px for one light icon row ([#729](https://github.com/apliteni/apliteni-ui/issues/729)), and a notifications bell with its count ([#798](https://github.com/apliteni/apliteni-ui/issues/798)). The last two are named by their sentence: phones show no title.
|
|
12
12
|
|
|
13
|
-
**Do:** A wordless overflow
|
|
13
|
+
**Do:** A wordless overflow and a labelled Settings.
|
|
14
14
|
|
|
15
|
-
**Don't:** A wordless cog, even with
|
|
15
|
+
**Don't:** A wordless cog, even with an `aria-label`.
|
|
16
16
|
|
|
17
17
|
## State and action
|
|
18
18
|
|
package/package.json
CHANGED
package/react/README.md
CHANGED
|
@@ -43,7 +43,7 @@ fill its container, and `appearance="underline"` draws the underline strip inste
|
|
|
43
43
|
of the pill track; omit all three for the standard pill. Options support
|
|
44
44
|
`ariaLabel` and `disabled`; `disabled` on the toolbar disables every choice. What
|
|
45
45
|
each presentation guarantees is in
|
|
46
|
-
docs/components.md#
|
|
46
|
+
docs/components.md#segmented.
|
|
47
47
|
Reach for it when a choice filters or switches a view in place; use `Tabs` when the
|
|
48
48
|
choice owns a panel, and links when it changes the page.
|
|
49
49
|
|
|
@@ -606,7 +606,7 @@ Its accessible name is the label and then the chosen value. Outside a `Field`,
|
|
|
606
606
|
`type="search"` input, and no visible label, so the row keeps the height of the
|
|
607
607
|
unlabelled controls beside it. `ariaLabel` is required and is the control's only
|
|
608
608
|
name. It forwards its ref and the native input props, and `className` joins
|
|
609
|
-
`.ui-input`. There is no clear button — see docs/components.md#
|
|
609
|
+
`.ui-input`. There is no clear button — see docs/components.md#search-field for why.
|
|
610
610
|
|
|
611
611
|
```tsx
|
|
612
612
|
<div className="ui-toolbar">
|
package/react/dist/index.css
CHANGED
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
--tap-clear-y: 0px;
|
|
37
37
|
}
|
|
38
38
|
@media (max-width: 560px) and (pointer: coarse) {
|
|
39
|
-
:where(.ui-seg button, .ui-tabs__tab, .ui-dropdown__trigger, .ui-toast__action, .ui-drawer__close, .ui-snippet__copy, .ui-footer__social, .ui-app__search, .toggle, .ui-datepicker__opt) {
|
|
39
|
+
:where(.ui-seg button, .ui-tabs__tab, .ui-dropdown__trigger, .ui-toast__action, .ui-drawer__close, .ui-snippet__copy, .ui-footer__social, .ui-app__search, .ui-back, .toggle, .ui-datepicker__opt) {
|
|
40
40
|
position: relative;
|
|
41
41
|
}
|
|
42
|
-
:where(.ui-btn, .ui-seg button, .ui-tabs__tab, .ui-dropdown__trigger, .ui-toast__action, .ui-drawer__close, .ui-snippet__copy, .ui-footer__social, .ui-switch, .ui-datepicker__opt, .ui-app__search, .toggle)::after {
|
|
42
|
+
:where(.ui-btn, .ui-seg button, .ui-tabs__tab, .ui-dropdown__trigger, .ui-toast__action, .ui-drawer__close, .ui-snippet__copy, .ui-footer__social, .ui-switch, .ui-datepicker__opt, .ui-app__search, .ui-back, .toggle)::after {
|
|
43
43
|
content: "";
|
|
44
44
|
position: absolute;
|
|
45
45
|
left: 50%;
|
|
@@ -173,6 +173,9 @@
|
|
|
173
173
|
--tap-clear-x: var(--tap-gap);
|
|
174
174
|
--tap-clear-y: var(--tap-gap);
|
|
175
175
|
}
|
|
176
|
+
.ui-back {
|
|
177
|
+
--tap-clear-y: var(--space-3, 12px);
|
|
178
|
+
}
|
|
176
179
|
.ui-app__bar,
|
|
177
180
|
.topbar__in {
|
|
178
181
|
--tap-clear-x: var(--space-3, 12px);
|
|
@@ -676,6 +679,9 @@
|
|
|
676
679
|
outline: var(--ring-scroll);
|
|
677
680
|
outline-offset: var(--ring-scroll-offset);
|
|
678
681
|
}
|
|
682
|
+
.ui-datepicker__body.is-sheet .ui-datepicker__opt {
|
|
683
|
+
scroll-margin-bottom: var(--space-5);
|
|
684
|
+
}
|
|
679
685
|
@media (max-width: 560px) {
|
|
680
686
|
.ui-dropdown__panel.ui-datepicker__panel {
|
|
681
687
|
--ui-dropdown-edge: 8px;
|
package/react/dist/index.d.ts
CHANGED
|
@@ -320,7 +320,7 @@ type Column<T> = {
|
|
|
320
320
|
* "Invoice 1162" with the number linked looks the same to a selector, and filling that
|
|
321
321
|
* one would put the number on a line of its own. The header cell is never marked — it
|
|
322
322
|
* holds a label, or a sort button that keeps its own ring.
|
|
323
|
-
* why: docs/components.md#
|
|
323
|
+
* why: docs/components.md#data-table
|
|
324
324
|
*/
|
|
325
325
|
linked?: boolean;
|
|
326
326
|
/** Renders this column's body cells as row headers (`th scope="row"`), as the kit's compact table does. */
|
|
@@ -506,6 +506,10 @@ type DatePickerProps = {
|
|
|
506
506
|
* With a value, the trigger's own text is already its name.
|
|
507
507
|
*/
|
|
508
508
|
ariaLabel?: string;
|
|
509
|
+
/** Names the elements that describe the trigger, e.g. a field's error and hint. */
|
|
510
|
+
'aria-describedby'?: string;
|
|
511
|
+
/** Marks the trigger invalid. `Field` supplies it while its error shows. */
|
|
512
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
509
513
|
id?: string;
|
|
510
514
|
disabled?: boolean;
|
|
511
515
|
/** The edge the panel hugs. */
|
|
@@ -527,7 +531,7 @@ type DatePickerProps = {
|
|
|
527
531
|
defaultOpen?: boolean;
|
|
528
532
|
onOpenChange?: (open: boolean) => void;
|
|
529
533
|
};
|
|
530
|
-
declare function DatePicker({ mode, value, defaultValue, onChange, range, defaultRange, onRangeChange, min, max, disabledPeriods, presets, placeholder, ariaLabel, id, disabled, align, locale, weekStartsOn, today, sheet, open: openProp, defaultOpen, onOpenChange, }: DatePickerProps): react.JSX.Element;
|
|
534
|
+
declare function DatePicker({ mode, value, defaultValue, onChange, range, defaultRange, onRangeChange, min, max, disabledPeriods, presets, placeholder, ariaLabel, id, disabled, 'aria-describedby': describedBy, 'aria-invalid': invalid, align, locale, weekStartsOn, today, sheet, open: openProp, defaultOpen, onOpenChange, }: DatePickerProps): react.JSX.Element;
|
|
531
535
|
|
|
532
536
|
type DropdownBadge = string | {
|
|
533
537
|
text: string;
|
|
@@ -634,6 +638,8 @@ type DropdownProps = {
|
|
|
634
638
|
/** A field above the rows that filters them as the reader types. */
|
|
635
639
|
search?: boolean | DropdownSearch;
|
|
636
640
|
ariaLabel?: string;
|
|
641
|
+
/** The trigger's hover title. A wordless trigger takes its name here too. */
|
|
642
|
+
title?: string;
|
|
637
643
|
/** Names the elements that describe the trigger, e.g. a field's error and hint. */
|
|
638
644
|
'aria-describedby'?: string;
|
|
639
645
|
/** Marks the trigger invalid. `Field` supplies it while its error shows. */
|
|
@@ -649,7 +655,7 @@ type DropdownProps = {
|
|
|
649
655
|
/** Draw the row yourself. `props` is everything the row needs; spread it. */
|
|
650
656
|
row?: (item: DropdownItem, props: DropdownRowProps) => ReactNode;
|
|
651
657
|
};
|
|
652
|
-
declare function Dropdown({ label, value, selectedValue, placeholder, variant, items, sections, header, footer, triggerContent, triggerClass, disabled, chevron, align, direction, scroll, search, ariaLabel, id, panelClass, 'aria-describedby': describedBy, 'aria-invalid': invalid, open: openProp, defaultOpen, onOpenChange, onSelect, row, }: DropdownProps): react.JSX.Element;
|
|
658
|
+
declare function Dropdown({ label, value, selectedValue, placeholder, variant, items, sections, header, footer, triggerContent, triggerClass, disabled, chevron, align, direction, scroll, search, ariaLabel, title, id, panelClass, 'aria-describedby': describedBy, 'aria-invalid': invalid, open: openProp, defaultOpen, onOpenChange, onSelect, row, }: DropdownProps): react.JSX.Element;
|
|
653
659
|
|
|
654
660
|
type BackLinkOwnProps = {
|
|
655
661
|
/** The address. No address, or a `javascript:` one, and nothing is rendered. */
|
|
@@ -916,7 +922,7 @@ type SearchFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'ar
|
|
|
916
922
|
* No clear button. The browser paints its own near-black on the light field and
|
|
917
923
|
* white on the dark one, beside the kit's `--muted` magnifier — two glyphs, and
|
|
918
924
|
* only one answers to a token — so `input.css` suppresses it.
|
|
919
|
-
* why: docs/components.md#
|
|
925
|
+
* why: docs/components.md#search-field
|
|
920
926
|
*/
|
|
921
927
|
declare const SearchField: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "aria-label"> & {
|
|
922
928
|
/** The control's name. A toolbar search box shows no label, so this is the
|
package/react/dist/index.js
CHANGED
|
@@ -2599,6 +2599,8 @@ function DatePicker({
|
|
|
2599
2599
|
ariaLabel,
|
|
2600
2600
|
id,
|
|
2601
2601
|
disabled = false,
|
|
2602
|
+
"aria-describedby": describedBy,
|
|
2603
|
+
"aria-invalid": invalid,
|
|
2602
2604
|
align = "start",
|
|
2603
2605
|
locale = "en-GB",
|
|
2604
2606
|
weekStartsOn = 1,
|
|
@@ -2661,7 +2663,7 @@ function DatePicker({
|
|
|
2661
2663
|
useIsoLayoutEffect(() => {
|
|
2662
2664
|
close.current = setOpen;
|
|
2663
2665
|
});
|
|
2664
|
-
|
|
2666
|
+
useIsoLayoutEffect(() => {
|
|
2665
2667
|
if (open) setCursor(clamp(anchor, lo, hi));
|
|
2666
2668
|
}, [open]);
|
|
2667
2669
|
useIsoLayoutEffect(() => {
|
|
@@ -2735,6 +2737,38 @@ function DatePicker({
|
|
|
2735
2737
|
land.current = false;
|
|
2736
2738
|
grid.current?.querySelector('[data-dp-cell][tabindex="0"]')?.focus();
|
|
2737
2739
|
});
|
|
2740
|
+
const reveal = useRef14(false);
|
|
2741
|
+
const chosen = useRef14(null);
|
|
2742
|
+
useIsoLayoutEffect(() => {
|
|
2743
|
+
reveal.current = open && asSheet;
|
|
2744
|
+
}, [open, asSheet]);
|
|
2745
|
+
useIsoLayoutEffect(() => {
|
|
2746
|
+
if (!reveal.current || cursor !== clamp(anchor, lo, hi)) return;
|
|
2747
|
+
reveal.current = false;
|
|
2748
|
+
chosen.current = grid.current?.querySelector('[data-dp-cell][tabindex="0"].is-selected') ?? null;
|
|
2749
|
+
const body = grid.current?.closest(".ui-drawer__body");
|
|
2750
|
+
const cell = chosen.current;
|
|
2751
|
+
if (!cell || !body) return;
|
|
2752
|
+
const scrollIn = () => {
|
|
2753
|
+
const below = parseFloat(getComputedStyle(cell).scrollMarginBottom) || 0;
|
|
2754
|
+
const view = body.getBoundingClientRect().top + body.clientTop + body.clientHeight;
|
|
2755
|
+
const over = cell.getBoundingClientRect().bottom + below - view;
|
|
2756
|
+
if (over > 0) body.scrollTop += over;
|
|
2757
|
+
};
|
|
2758
|
+
scrollIn();
|
|
2759
|
+
const { fonts, defaultView: win } = body.ownerDocument;
|
|
2760
|
+
if (!fonts || !win) return;
|
|
2761
|
+
let touched = false;
|
|
2762
|
+
const touch = () => {
|
|
2763
|
+
touched = true;
|
|
2764
|
+
};
|
|
2765
|
+
const inputs = ["wheel", "touchstart", "pointerdown", "keydown"];
|
|
2766
|
+
for (const type of inputs) body.addEventListener(type, touch, { passive: true });
|
|
2767
|
+
void fonts.ready.then(() => win.requestAnimationFrame(() => {
|
|
2768
|
+
for (const type of inputs) body.removeEventListener(type, touch);
|
|
2769
|
+
if (cell.isConnected && !touched) scrollIn();
|
|
2770
|
+
}));
|
|
2771
|
+
});
|
|
2738
2772
|
const columns = grain === "month" ? 3 : 7;
|
|
2739
2773
|
const page = grain === "month" ? Math.floor(cursor / 12) : monthOf(cursor);
|
|
2740
2774
|
const caption = grain === "month" ? String(page) : names.monthYear.format(at(firstDayOf(page)));
|
|
@@ -2999,6 +3033,8 @@ function DatePicker({
|
|
|
2999
3033
|
"aria-haspopup": "dialog",
|
|
3000
3034
|
"aria-expanded": open,
|
|
3001
3035
|
"aria-label": triggerName,
|
|
3036
|
+
"aria-describedby": describedBy,
|
|
3037
|
+
"aria-invalid": invalid,
|
|
3002
3038
|
disabled,
|
|
3003
3039
|
ref: trigger,
|
|
3004
3040
|
onClick: (e) => {
|
|
@@ -3018,7 +3054,7 @@ function DatePicker({
|
|
|
3018
3054
|
// without taking the sheet's affordances left a phone reader with no
|
|
3019
3055
|
// visible way out and a Tab that walked into the live page behind it.
|
|
3020
3056
|
// why: guidelines/drawer.md
|
|
3021
|
-
/* @__PURE__ */ jsx25(Drawer, { open, side: "bottom", size: "md", title: sheetTitle, onClose: () => setOpen(false), children: calendar })
|
|
3057
|
+
/* @__PURE__ */ jsx25(Drawer, { open, side: "bottom", size: "md", title: sheetTitle, onClose: () => setOpen(false), initialFocusRef: chosen, children: calendar })
|
|
3022
3058
|
) : /* @__PURE__ */ jsx25(
|
|
3023
3059
|
"div",
|
|
3024
3060
|
{
|
|
@@ -3118,6 +3154,7 @@ function Dropdown({
|
|
|
3118
3154
|
scroll = false,
|
|
3119
3155
|
search = false,
|
|
3120
3156
|
ariaLabel,
|
|
3157
|
+
title,
|
|
3121
3158
|
id,
|
|
3122
3159
|
panelClass = "",
|
|
3123
3160
|
"aria-describedby": describedBy,
|
|
@@ -3575,6 +3612,7 @@ function Dropdown({
|
|
|
3575
3612
|
"aria-expanded": open,
|
|
3576
3613
|
id: fieldName?.id,
|
|
3577
3614
|
"aria-label": ariaLabel && triggerContent != null ? ariaLabel : void 0,
|
|
3615
|
+
title,
|
|
3578
3616
|
"aria-labelledby": fieldName?.labelledBy,
|
|
3579
3617
|
"aria-describedby": describedBy,
|
|
3580
3618
|
"aria-invalid": invalid,
|
|
@@ -5207,6 +5245,7 @@ function AppShell({
|
|
|
5207
5245
|
align: "end",
|
|
5208
5246
|
chevron: false,
|
|
5209
5247
|
ariaLabel: `Signed in as ${account.name}, ${account.email}`,
|
|
5248
|
+
title: `Signed in as ${account.name}, ${account.email}`,
|
|
5210
5249
|
triggerClass: "ui-app__user-trigger",
|
|
5211
5250
|
panelClass: "ui-app__user-panel",
|
|
5212
5251
|
triggerContent: /* @__PURE__ */ jsx41("span", { className: "ui-app__av", "aria-hidden": "true", children: /* @__PURE__ */ jsx41(Avatar, { personKey: account.email || account.name, name: account.name, size: 32 }) }),
|
package/src/html.js
CHANGED
|
@@ -5,7 +5,7 @@ export const esc = value => String(value == null ? '' : value).replace(/[&<>"]/g
|
|
|
5
5
|
// Legacy topbar/brand slots accept already escaped HTML. Preserve their entities.
|
|
6
6
|
export const trustedAttr = value => String(value ?? '').replace(/[<>"]/g, c => ENTITIES[c]);
|
|
7
7
|
|
|
8
|
-
// why: docs/components.md#escaping-and-
|
|
8
|
+
// why: docs/components.md#escaping-and-urls
|
|
9
9
|
export function safeUrl(value, fallback = '#') {
|
|
10
10
|
const raw = String(value ?? '');
|
|
11
11
|
const scheme = raw.replace(/[\t\n\r]/g, '').replace(/^[\u0000-\u0020]+/, '');
|
package/src/index.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export declare function filterPanelFit(
|
|
|
68
68
|
* a panel changes the width a shift is calculated from. `at` gives the box a
|
|
69
69
|
* caller is about to write instead, which is how the portal's placement asks.
|
|
70
70
|
* `null` when there is nothing to measure, or inside a `.ui-filter-bar`, which
|
|
71
|
-
* bounds its own panels. why: docs/components.md#
|
|
71
|
+
* bounds its own panels. why: docs/components.md#dropdown */
|
|
72
72
|
export declare function dropdownViewportFit(
|
|
73
73
|
panel: Element | null | undefined,
|
|
74
74
|
at?: { left: number; width: number },
|
|
@@ -76,7 +76,7 @@ export declare function dropdownViewportFit(
|
|
|
76
76
|
/** How tall a panel may be: the room between its trigger (inside `dd`) and the
|
|
77
77
|
* viewport edge, from the same dropdownAvail() dropdownViewportFit's `max`
|
|
78
78
|
* shares its calculation with. `null` when there is nothing to measure.
|
|
79
|
-
* why: docs/components.md#
|
|
79
|
+
* why: docs/components.md#dropdown */
|
|
80
80
|
export declare function dropdownHeightFit(
|
|
81
81
|
dd: Element | null | undefined,
|
|
82
82
|
panel: Element | null | undefined,
|
|
@@ -84,7 +84,7 @@ export declare function dropdownHeightFit(
|
|
|
84
84
|
/** Stop an open panel's height where it cuts a row through the middle, so the list
|
|
85
85
|
* reads as going on: the smaller of its cap and its measured room. Call it with the
|
|
86
86
|
* panel laid out and its room written.
|
|
87
|
-
* why: docs/components.md#
|
|
87
|
+
* why: docs/components.md#dropdown */
|
|
88
88
|
export declare function dropdownSnap(
|
|
89
89
|
dd: Element | null | undefined,
|
|
90
90
|
panel: Element | null | undefined,
|
|
@@ -92,21 +92,21 @@ export declare function dropdownSnap(
|
|
|
92
92
|
/** Lift an open panel out of a Modal or Drawer body too short to hold its field and
|
|
93
93
|
* the panel's floor, so it opens over the body the way a portalled panel does, or put a
|
|
94
94
|
* lifted one back. Returns whether the panel is lifted.
|
|
95
|
-
* why: docs/components.md#
|
|
95
|
+
* why: docs/components.md#dropdown */
|
|
96
96
|
export declare function dropdownLift(
|
|
97
97
|
dd: Element | null | undefined,
|
|
98
98
|
panel: Element | null | undefined,
|
|
99
99
|
): boolean;
|
|
100
100
|
/** Scroll the body an open panel sits in the least distance that shows the whole
|
|
101
101
|
* panel and its field's label, with the room under the panel kept. Returns the distance scrolled, 0 when
|
|
102
|
-
* nothing moved. why: docs/components.md#
|
|
102
|
+
* nothing moved. why: docs/components.md#dropdown */
|
|
103
103
|
export declare function dropdownReveal(
|
|
104
104
|
dd: Element | null | undefined,
|
|
105
105
|
panel: Element | null | undefined,
|
|
106
106
|
): number;
|
|
107
107
|
/** Give an open panel its box, and take the box away from a shut one once its fade is
|
|
108
108
|
* over, so a shut panel adds no scroll room. Returns a function that cancels a
|
|
109
|
-
* collapse still waiting. why: docs/components.md#
|
|
109
|
+
* collapse still waiting. why: docs/components.md#dropdown */
|
|
110
110
|
export declare function dropdownRest(
|
|
111
111
|
dd: Element | null | undefined,
|
|
112
112
|
panel: Element | null | undefined,
|
package/src/logic/accents.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// react/src/AccentPicker.tsx call accentSwatchStyle(); site/chrome.mjs and
|
|
6
6
|
// site/index.html still hand-keep the same four gradients. Held by
|
|
7
7
|
// stories/accent-swatch.test.js, which derives both sides out of src/tokens/.
|
|
8
|
-
// why: docs/components.md#
|
|
8
|
+
// why: docs/components.md#choose-a-component. See issues #190 and #429.
|
|
9
9
|
export const ACCENTS = ['default', 'phoenix', 'ocean', 'emerald'];
|
|
10
10
|
|
|
11
11
|
// Per accent, the gradient's two stops — each the value src/tokens/ declares for
|
package/src/logic/account-nav.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// /account page. Labels are raw text, because every nav primitive escapes. `key` means
|
|
3
3
|
// credentials; `plug` means integration. A screen the kit does not ship belongs in the
|
|
4
4
|
// caller's own nav, not here. The vanilla shell and the React AppShell both read it.
|
|
5
|
-
// why: docs/components.md#
|
|
5
|
+
// why: docs/components.md#page-shell
|
|
6
6
|
export const ACCOUNT_NAV = [
|
|
7
7
|
{ id: 'prefs', icon: 'gear', label: 'Preferences' },
|
|
8
8
|
{ id: 'access', icon: 'key', label: 'Access & agents' },
|
package/src/logic/chart.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Chart arithmetic, shared by the React Chart and by anything that draws the
|
|
2
2
|
// same shapes without it. No DOM, no pixels: a scale and a walk, both pure.
|
|
3
|
-
// why: docs/components.md#
|
|
3
|
+
// why: docs/components.md#chart
|
|
4
4
|
|
|
5
5
|
/** The steps a whole-unit axis may take, per decade, smallest first. 2.5 is
|
|
6
6
|
* among them — 25000 is a whole step and the one that turns a four-tick axis
|