@iyulab/components 2.34.0 → 2.35.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 +43 -0
- package/README.md +1 -1
- package/dist/assets/locales/ar.json.js +3 -1
- package/dist/assets/locales/de.json.js +3 -1
- package/dist/assets/locales/en.json.js +3 -1
- package/dist/assets/locales/es.json.js +3 -1
- package/dist/assets/locales/fr.json.js +3 -1
- package/dist/assets/locales/id.json.js +3 -1
- package/dist/assets/locales/ja.json.js +3 -1
- package/dist/assets/locales/ko.json.js +3 -1
- package/dist/assets/locales/pt-BR.json.js +3 -1
- package/dist/assets/locales/ru.json.js +3 -1
- package/dist/assets/locales/th.json.js +3 -1
- package/dist/assets/locales/vi.json.js +3 -1
- package/dist/assets/locales/zh-CN.json.js +3 -1
- package/dist/assets/locales/zh-TW.json.js +3 -1
- package/dist/components/UOverlayElement.d.ts +2 -0
- package/dist/components/UOverlayElement.js +6 -0
- package/dist/components/auto-scroll/UAutoScroll.d.ts +12 -0
- package/dist/components/auto-scroll/UAutoScroll.js +30 -0
- package/dist/components/carousel/UCarousel.d.ts +33 -0
- package/dist/components/carousel/UCarousel.js +33 -3
- package/dist/components/command-palette/UCommandPalette.d.ts +126 -0
- package/dist/components/command-palette/UCommandPalette.js +260 -0
- package/dist/components/command-palette/UCommandPalette.styles.d.ts +1 -0
- package/dist/components/command-palette/UCommandPalette.styles.js +142 -0
- package/dist/components/select/USelect.d.ts +15 -0
- package/dist/components/select/USelect.js +48 -12
- package/dist/components/select/USelect.styles.js +5 -0
- package/dist/components/steps/USteps.d.ts +14 -3
- package/dist/components/steps/USteps.js +12 -2
- package/dist/components/steps/USteps.styles.js +53 -0
- package/dist/components/tab/UTab.d.ts +9 -3
- package/dist/components/tab/UTab.js +8 -3
- package/dist/components/tab/UTab.styles.js +21 -0
- package/dist/components/tab-nav/UTabNav.d.ts +10 -1
- package/dist/components/tab-nav/UTabNav.js +5 -0
- package/dist/components/tab-nav/UTabNav.styles.js +24 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/react/UCarousel.d.ts +3 -1
- package/dist/react/UCarousel.js +3 -1
- package/dist/react/UCommandPalette.d.ts +20 -0
- package/dist/react/UCommandPalette.js +14 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/utilities/Locale.d.ts +1 -1
- package/package.json +1 -1
- package/skills/iyulab-components/SKILL.md +1 -0
- package/skills/iyulab-components/references/components/auto-scroll.md +19 -2
- package/skills/iyulab-components/references/components/carousel.md +21 -0
- package/skills/iyulab-components/references/components/command-palette.md +96 -0
- package/skills/iyulab-components/references/components/select.md +1 -1
- package/skills/iyulab-components/references/components/steps.md +16 -1
- package/skills/iyulab-components/references/components/tab-nav.md +19 -1
- package/skills/iyulab-components/references/components/tab-panel.md +1 -1
|
@@ -45,13 +45,30 @@ Otherwise it scrolls at `speed`.
|
|
|
45
45
|
|------|-------------|
|
|
46
46
|
| *(default)* | The content to scroll |
|
|
47
47
|
|
|
48
|
+
### One item at a time — `mode="item"`
|
|
49
|
+
|
|
50
|
+
On a board read from across the room nothing can be read while it moves, so the time standing still is the reading
|
|
51
|
+
time. `mode="item"` does not flow: it glides to the top of the next item, then waits `pause`, and from the end goes
|
|
52
|
+
back to the top. The items are the slotted elements — when there is only one (a list wrapped in one element), its
|
|
53
|
+
children, and so on down.
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<u-auto-scroll mode="item" pause="3000" unattended style="height: 60vh">
|
|
57
|
+
<ul>${late.map((o) => html`<li>…</li>`)}</ul>
|
|
58
|
+
</u-auto-scroll>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
To show where the list is ("6–12 of 22"), listen for the host's native `scroll` event — `u-auto-scroll` is itself the
|
|
62
|
+
scroll container.
|
|
63
|
+
|
|
48
64
|
## Properties
|
|
49
65
|
|
|
50
66
|
| Property | Type | Default | Reflect | Description |
|
|
51
67
|
|----------|------|---------|---------|-------------|
|
|
52
|
-
| `
|
|
68
|
+
| `mode` | `'continuous' \| 'item'` | `'continuous'` | ✓ | `continuous` flows to the end · `item` steps one item at a time and waits `pause` at each |
|
|
69
|
+
| `speed` | `number` | `30` | — | Scroll speed in px per second — `duration` overrides it. Not used by `item` |
|
|
53
70
|
| `duration` | `number` | `0` | — | Time for one round (wait + scroll + wait), in ms; the speed follows from the distance. `0` uses `speed` |
|
|
54
|
-
| `pause` | `number` | `3000` | — | Wait at the top and at the end, in ms |
|
|
71
|
+
| `pause` | `number` | `3000` | — | Wait at the top and at the end, in ms — with `item`, also at every item |
|
|
55
72
|
| `paused` | `boolean` | `false` | ✓ | Do not scroll by itself — by hand only |
|
|
56
73
|
| `unattended` | `boolean` | `false` | ✓ | A screen nobody operates — the pointer over it and focus that came from a tap do not stop it; keyboard focus does, until `resumeDelay` passes without a key press or a click |
|
|
57
74
|
| `resumeDelay` | `number` | `30000` | — | `resume-delay` — with `unattended`, the idle time in ms before a stop caused by keyboard focus ends |
|
|
@@ -65,6 +65,21 @@ default) without a key press or a click in it. The stop button still stops it, a
|
|
|
65
65
|
<u-carousel autoplay loop unattended pagination pagination-style="labels" autoplay-interval="20000" aria-label="Floor board">…</u-carousel>
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
### Following the shown slide — `change`
|
|
69
|
+
|
|
70
|
+
A heading or legend outside the carousel that names the current slide listens for `change`. It fires when the shown
|
|
71
|
+
slide changes — by a person (buttons, dots, drag, `next()` / `prev()` / `goTo()`) or by autoplay — with
|
|
72
|
+
`detail: { index, previousIndex, cause: 'user' | 'autoplay' }`. Setting `index` does not fire it, and it does not
|
|
73
|
+
bubble (like `u-tab-panel`'s `change`) — listen on the carousel.
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
board.addEventListener('change', (e) => { title.textContent = titles[e.detail.index]; });
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Slides out of view are `inert`: their links and buttons leave the Tab order and assistive technology reads only the
|
|
80
|
+
slides on screen. With `slides-per-view` above 1, only slides outside that range are inert. An `inert` you put on a
|
|
81
|
+
slide yourself is left as it is.
|
|
82
|
+
|
|
68
83
|
---
|
|
69
84
|
|
|
70
85
|
## Slots
|
|
@@ -91,6 +106,12 @@ default) without a key press or a click in it. The stop button still stops it, a
|
|
|
91
106
|
| `gap` | `number` | `0` | Gap between slides in px |
|
|
92
107
|
| `index` | `number` | `0` | Active slide index |
|
|
93
108
|
|
|
109
|
+
## Events
|
|
110
|
+
|
|
111
|
+
| Event | Detail | Description |
|
|
112
|
+
|-------|--------|-------------|
|
|
113
|
+
| `change` | `{ index, previousIndex, cause: 'user' \| 'autoplay' }` | The shown slide changed (not when `index` is set). Does not bubble |
|
|
114
|
+
|
|
94
115
|
## Methods
|
|
95
116
|
|
|
96
117
|
| Method | Description |
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# u-command-palette
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import '@iyulab/components/dist/components/command-palette/UCommandPalette.js';
|
|
5
|
+
import { filterCommands } from '@iyulab/components';
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
**Tag:** `u-command-palette`
|
|
9
|
+
|
|
10
|
+
A find-anything dialog — the Ctrl/⌘ K box: one search field over results grouped by where they come from (screens,
|
|
11
|
+
recent items, records, actions). The field is a WAI-ARIA APG combobox over a listbox; the dialog is modal, traps
|
|
12
|
+
focus, closes on Escape and returns focus to where it was.
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
const palette = document.querySelector('u-command-palette');
|
|
16
|
+
palette.sources = [
|
|
17
|
+
{ id: 'screens', label: 'Screens', search: (q) => filterCommands(SCREENS, q) },
|
|
18
|
+
{
|
|
19
|
+
id: 'orders', label: 'Orders',
|
|
20
|
+
search: async (q, { signal }) => q ? (await fetch(`/api/orders?q=${encodeURIComponent(q)}`, { signal }).then(r => r.json())) : [],
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
palette.addEventListener('command', (e) => {
|
|
24
|
+
e.preventDefault(); // a client-side router: navigate yourself
|
|
25
|
+
router.navigate(e.detail.item.href);
|
|
26
|
+
});
|
|
27
|
+
document.addEventListener('keydown', (e) => {
|
|
28
|
+
if ((e.ctrlKey || e.metaKey) && e.key === 'k') { e.preventDefault(); palette.show(); }
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- **Sources.** Each is `{ id, label, search(query, { signal }) }` returning items or a promise of them. Opening asks
|
|
33
|
+
every source with the empty query (show what belongs there before any typing — recent items, the screen list — or
|
|
34
|
+
return `[]`). Typing asks again `debounce` ms after the last key; the previous request's `signal` is aborted.
|
|
35
|
+
Results are grouped in source order, items in the order the source gave. A source that throws or rejects shows
|
|
36
|
+
«Couldn't search {label}» in its place; the others are unaffected.
|
|
37
|
+
- **Choosing.** ↑/↓ move the candidate (the first result is the candidate after each search; the list wraps), Enter
|
|
38
|
+
or a click chooses. `command` fires with `{ item, source }` — cancelable, does not bubble. Not canceled and the item
|
|
39
|
+
has `href` → the page goes there (`location.assign`). The Enter that commits an IME composition does not choose.
|
|
40
|
+
- **The shortcut is yours.** The palette does not listen for Ctrl/⌘ K — where and when it opens belongs to the app
|
|
41
|
+
(`@iyulab/modern-app`'s shell wires it to the sidebar). Do not take the shortcut inside editors that use it.
|
|
42
|
+
- `filterCommands(items, query)` filters static items by label, description and `keywords` with the locale's search
|
|
43
|
+
match (the rule `u-select` uses — case and accents folded, Korean syllables matched as typed).
|
|
44
|
+
|
|
45
|
+
## Item
|
|
46
|
+
|
|
47
|
+
| Field | Type | Description |
|
|
48
|
+
|-------|------|-------------|
|
|
49
|
+
| `id` | `string` | Unique within its source |
|
|
50
|
+
| `label` | `string` | Shown name |
|
|
51
|
+
| `description` | `string?` | Secondary text beside the name; also the option's accessible description |
|
|
52
|
+
| `icon` / `iconLib` | `string?` | `u-icon` name and library |
|
|
53
|
+
| `href` | `string?` | Followed when chosen, unless `command` is canceled |
|
|
54
|
+
| `keywords` | `string[]?` | Extra words `filterCommands` matches |
|
|
55
|
+
| `data` | `unknown` | Yours — the palette does not read it |
|
|
56
|
+
|
|
57
|
+
## Properties
|
|
58
|
+
|
|
59
|
+
| Property | Attribute | Type | Default | Description |
|
|
60
|
+
|----------|-----------|------|---------|-------------|
|
|
61
|
+
| `sources` | — | `CommandSource[]` | `[]` | Where items come from, in group order (property only) |
|
|
62
|
+
| `placeholder` | `placeholder` | `string` | `''` | Field placeholder |
|
|
63
|
+
| `label` | `label` | `string` | `''` | Accessible name of the field and the dialog — empty uses the locale's `search` |
|
|
64
|
+
| `debounce` | `debounce` | `number` | `150` | ms after the last key before sources are asked |
|
|
65
|
+
| `open` | `open` | `boolean` | `false` | Shown (from the overlay base — also `show()` / `hide()`) |
|
|
66
|
+
|
|
67
|
+
## Events
|
|
68
|
+
|
|
69
|
+
| Event | Detail | Description |
|
|
70
|
+
|-------|--------|-------------|
|
|
71
|
+
| `command` | `{ item, source }` | An item was chosen. Cancelable; does not bubble |
|
|
72
|
+
| `show` / `hide` | — | Before opening / closing (cancelable), from the overlay base |
|
|
73
|
+
|
|
74
|
+
## Methods
|
|
75
|
+
|
|
76
|
+
| Method | Description |
|
|
77
|
+
|--------|-------------|
|
|
78
|
+
| `show()` | Open — focuses the field and asks the sources with the empty query |
|
|
79
|
+
| `hide()` | Close — aborts pending requests; focus returns |
|
|
80
|
+
|
|
81
|
+
## CSS Parts
|
|
82
|
+
|
|
83
|
+
| Part | Description |
|
|
84
|
+
|------|-------------|
|
|
85
|
+
| `panel` | The dialog box |
|
|
86
|
+
| `input` | The search field |
|
|
87
|
+
| `listbox` | The result list |
|
|
88
|
+
| `group-label` | A group heading |
|
|
89
|
+
| `option` | One item |
|
|
90
|
+
| `status` | The searching / no-results / source-error lines |
|
|
91
|
+
|
|
92
|
+
## CSS Custom Properties
|
|
93
|
+
|
|
94
|
+
| Property | Default | Description |
|
|
95
|
+
|----------|---------|-------------|
|
|
96
|
+
| `--command-palette-width` | `40rem` | The dialog's width (capped by the viewport) |
|
|
@@ -100,7 +100,7 @@ again. On an option, arrows, `Home`/`End`, `Enter`/`Space` (select) and `Escape`
|
|
|
100
100
|
| `field` | Outer field wrapper |
|
|
101
101
|
| `container` | Trigger area |
|
|
102
102
|
| `popover` | Dropdown list container |
|
|
103
|
-
| `search-input` | The
|
|
103
|
+
| `search-input` | The edit field inside the trigger (the combobox, when `searchable`) — closed, it holds the chosen option's text (single selection) |
|
|
104
104
|
| `no-matches` | *No matches* status line in the dropdown (empty and hidden otherwise) |
|
|
105
105
|
|
|
106
106
|
## CSS Custom Properties
|
|
@@ -47,6 +47,18 @@ step's name is bold. For a detail page's header, where seven steps each carry a
|
|
|
47
47
|
]}></u-steps>
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
### Compact — `appearance="compact"`
|
|
51
|
+
|
|
52
|
+
One small segment per step and, beside them, the current step's name — for one line of height: a list table's
|
|
53
|
+
progress column, a preview panel, a card header. Travelled segments are filled, the current one takes the primary
|
|
54
|
+
colour, a held one the warning colour, upcoming ones stay empty and a skipped one is dashed. The other step names
|
|
55
|
+
and the track `label` are hidden from view but stay in the list, so assistive technology still reads every step and
|
|
56
|
+
the current one. With no current or held step the name shown is the last step passed.
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<u-steps appearance="compact" label="Order C-271988" current="1" .items=${steps}></u-steps>
|
|
60
|
+
```
|
|
61
|
+
|
|
50
62
|
---
|
|
51
63
|
|
|
52
64
|
## Properties
|
|
@@ -56,7 +68,7 @@ step's name is bold. For a detail page's header, where seven steps each carry a
|
|
|
56
68
|
| `items` | `StepItem[]` | `[]` | — | `{ label, description?, status? }` (property only) |
|
|
57
69
|
| `current` | `number` | — | — | Index of the current step; steps without `status` before it are `complete`, after it `upcoming` |
|
|
58
70
|
| `label` | `string` | — | — | Track name shown at the start; also the list's accessible name |
|
|
59
|
-
| `appearance` | `'line'\|'bars'` | `'line'` | ✓ | `line` markers and connectors · `bars` a bar per step with the text under it |
|
|
71
|
+
| `appearance` | `'line'\|'bars'\|'compact'` | `'line'` | ✓ | `line` markers and connectors · `bars` a bar per step with the text under it · `compact` a segment per step and the current step's name, on one line |
|
|
60
72
|
|
|
61
73
|
`StepStatus` = `'complete' | 'current' | 'hold' | 'upcoming' | 'skipped'`. An item's own `status` wins over
|
|
62
74
|
the inference from `current`.
|
|
@@ -73,6 +85,7 @@ the inference from `current`.
|
|
|
73
85
|
| `title` | Step name |
|
|
74
86
|
| `description` | Step's secondary text |
|
|
75
87
|
| `connector` | Line between steps |
|
|
88
|
+
| `summary` | The current step's name beside the segments with `compact` |
|
|
76
89
|
|
|
77
90
|
## CSS Custom Properties
|
|
78
91
|
|
|
@@ -84,3 +97,5 @@ the inference from `current`.
|
|
|
84
97
|
| `--steps-label-width` | Width of the track name (default 56px) |
|
|
85
98
|
| `--steps-bar-height` | Bar thickness with `bars` (default 6px) |
|
|
86
99
|
| `--steps-bar-color` | Filled bar colour with `bars` (default the primary colour) |
|
|
100
|
+
| `--steps-segment-width` | Segment width with `compact` (default 0.875rem) |
|
|
101
|
+
| `--steps-current-color` | Current segment with `compact` (default `--steps-bar-color`) — set it where the primary colour is ink and would match the travelled segments |
|
|
@@ -23,6 +23,21 @@ Each `u-tab` needs an `href`. Mark the current view with `value` on the strip (t
|
|
|
23
23
|
`active`), or leave `value` empty and put `active` on the current tab yourself. With a router, set `value` from the
|
|
24
24
|
route.
|
|
25
25
|
|
|
26
|
+
### Tiles — `appearance="tiles"`
|
|
27
|
+
|
|
28
|
+
Equal tiles instead of an underlined strip; the current tile is filled with `--tab-nav-color` and its text takes
|
|
29
|
+
`--tab-nav-contrast`. For a shop-floor terminal's stations, where a tile is a finger's width and how much is waiting at
|
|
30
|
+
each is why you pick one — pair it with `count-appearance="figure"` on the tabs, which draws the count as a large
|
|
31
|
+
number under the label. Tiles narrower than `--tab-nav-tile-min` wrap onto another row.
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<u-tab-nav label="Stations" appearance="tiles" value="press-1">
|
|
35
|
+
<u-tab value="press-1" href="?station=press-1" count="383" count-appearance="figure">Press 1</u-tab>
|
|
36
|
+
<u-tab value="press-2" href="?station=press-2" count="125" count-appearance="figure">Press 2</u-tab>
|
|
37
|
+
<u-tab value="foil" href="?station=foil" count="137" count-appearance="figure">Foil</u-tab>
|
|
38
|
+
</u-tab-nav>
|
|
39
|
+
```
|
|
40
|
+
|
|
26
41
|
### Accessibility
|
|
27
42
|
|
|
28
43
|
- The strip is a `<nav>` named by `label` — give it one when the page has other navigation.
|
|
@@ -41,6 +56,7 @@ route.
|
|
|
41
56
|
|----------|------|---------|---------|-------------|
|
|
42
57
|
| `value` | `string` | `''` | ✓ | The current view — the tab with this `value` becomes `active`. Empty leaves `active` to the tabs |
|
|
43
58
|
| `label` | `string` | `''` | | Accessible name of the navigation landmark |
|
|
59
|
+
| `appearance` | `'line' \| 'tiles'` | `'line'` | ✓ | `line` an underlined strip · `tiles` equal tiles, the current one filled |
|
|
44
60
|
|
|
45
61
|
`u-tab` properties for link tabs (`href`, `target`, `rel`, `active`, `count`) are in [tab-panel.md](./tab-panel.md#u-tab).
|
|
46
62
|
|
|
@@ -60,4 +76,6 @@ route.
|
|
|
60
76
|
|
|
61
77
|
| Property | Description |
|
|
62
78
|
|----------|-------------|
|
|
63
|
-
| `--tab-nav-color` | Text and underline colour of the current tab (default: `--u-primary-color`) |
|
|
79
|
+
| `--tab-nav-color` | Text and underline colour of the current tab, and the current tile's fill with `tiles` (default: `--u-primary-color`) |
|
|
80
|
+
| `--tab-nav-contrast` | Text colour of the current tile with `tiles` (default: `--u-primary-txt-color`) |
|
|
81
|
+
| `--tab-nav-tile-min` | Narrowest a tile gets before tiles wrap (default `7rem`) |
|
|
@@ -124,7 +124,7 @@ panel tab or a link tab. It is part of the tab's name.
|
|
|
124
124
|
| `target` | `string` | — | | Link target (with `href`) |
|
|
125
125
|
| `rel` | `string` | — | | Link relationship (with `href`) |
|
|
126
126
|
| `count` | `number` | — | | Quiet count after the label, in the active locale's digits |
|
|
127
|
-
| `countAppearance` | `'badge' \| 'plain'` | — | | Attribute `count-appearance`. `badge` (a pill)
|
|
127
|
+
| `countAppearance` | `'badge' \| 'plain' \| 'figure'` | — | | Attribute `count-appearance`. `badge` (a pill), `plain` (no pill — a smaller, weaker number, for a row of many tabs where pills would read before the labels) or `figure` (a large number under the label — for `u-tab-nav appearance="tiles"`, where the count is why you pick the tab). Empty: the app-wide `UTab.countAppearance` (default `badge`) |
|
|
128
128
|
|
|
129
129
|
### Events
|
|
130
130
|
|