@iyulab/components 2.33.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 +82 -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 +26 -0
- package/dist/components/auto-scroll/UAutoScroll.js +55 -2
- package/dist/components/badge/UBadge.d.ts +2 -0
- package/dist/components/badge/UBadge.js +4 -2
- package/dist/components/badge/UBadge.styles.js +11 -2
- package/dist/components/breadcrumb-item/UBreadcrumbItem.d.ts +2 -0
- package/dist/components/breadcrumb-item/UBreadcrumbItem.js +6 -4
- package/dist/components/breadcrumb-item/UBreadcrumbItem.styles.js +11 -2
- package/dist/components/button/UButton.d.ts +2 -0
- package/dist/components/button/UButton.js +4 -2
- package/dist/components/button/UButton.styles.js +11 -2
- package/dist/components/carousel/UCarousel.d.ts +56 -1
- package/dist/components/carousel/UCarousel.js +97 -8
- 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/dialog/UDialog.d.ts +3 -0
- package/dist/components/dialog/UDialog.js +8 -1
- package/dist/components/dialog/UDialog.styles.js +10 -3
- package/dist/components/drawer/UDrawer.d.ts +3 -0
- package/dist/components/drawer/UDrawer.js +8 -1
- package/dist/components/drawer/UDrawer.styles.js +10 -3
- package/dist/components/input/UInput.d.ts +2 -0
- package/dist/components/input/UInput.js +4 -2
- package/dist/components/input/UInput.styles.js +11 -2
- package/dist/components/menu-item/UMenuItem.d.ts +2 -0
- package/dist/components/menu-item/UMenuItem.js +4 -2
- package/dist/components/menu-item/UMenuItem.styles.js +11 -2
- package/dist/components/option/UOption.d.ts +2 -0
- package/dist/components/option/UOption.js +4 -2
- package/dist/components/option/UOption.styles.js +16 -2
- package/dist/components/radio/URadio.styles.js +5 -2
- package/dist/components/select/USelect.d.ts +36 -2
- package/dist/components/select/USelect.js +184 -45
- package/dist/components/select/USelect.styles.js +65 -22
- 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 +11 -3
- package/dist/components/tab/UTab.js +12 -5
- package/dist/components/tab/UTab.styles.js +37 -2
- 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/components/tab-panel/UTabPanel.styles.js +14 -14
- package/dist/components/tree-item/UTreeItem.d.ts +2 -0
- package/dist/components/tree-item/UTreeItem.js +4 -2
- package/dist/components/tree-item/UTreeItem.styles.js +11 -2
- 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/dist/utilities/slotPresence.d.ts +21 -0
- package/dist/utilities/slotPresence.js +41 -0
- package/dist/utilities/unattended.d.ts +5 -0
- package/dist/utilities/unattended.js +7 -0
- package/package.json +1 -1
- package/skills/iyulab-components/SKILL.md +1 -0
- package/skills/iyulab-components/references/components/auto-scroll.md +24 -2
- package/skills/iyulab-components/references/components/carousel.md +40 -1
- package/skills/iyulab-components/references/components/command-palette.md +96 -0
- package/skills/iyulab-components/references/components/dialog.md +1 -0
- package/skills/iyulab-components/references/components/drawer.md +1 -0
- package/skills/iyulab-components/references/components/select.md +16 -11
- 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
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { UCarousel as UCarouselElement } from '@iyulab/components/dist/components/carousel/UCarousel.js';
|
|
3
|
+
import { type UCarouselChangeDetail } from '@iyulab/components/dist/components/carousel/UCarousel.js';
|
|
3
4
|
|
|
4
5
|
type UCarouselOwnProps = Omit<UCarouselElement, keyof HTMLElement>;
|
|
5
6
|
|
|
6
7
|
export declare const UCarousel: React.ForwardRefExoticComponent<
|
|
7
8
|
Partial<Omit<UCarouselElement, Exclude<keyof React.HTMLAttributes<UCarouselElement>, keyof UCarouselOwnProps>>>
|
|
8
|
-
& Omit<React.HTMLAttributes<UCarouselElement>, keyof UCarouselOwnProps |
|
|
9
|
+
& Omit<React.HTMLAttributes<UCarouselElement>, keyof UCarouselOwnProps | 'onChange'>
|
|
9
10
|
& React.RefAttributes<UCarouselElement>
|
|
10
11
|
& {
|
|
12
|
+
onChange?: (event: CustomEvent<UCarouselChangeDetail>) => void;
|
|
11
13
|
}
|
|
12
14
|
>;
|
|
13
15
|
|
package/dist/react/UCarousel.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UCommandPalette as UCommandPaletteElement } from '@iyulab/components/dist/components/command-palette/UCommandPalette.js';
|
|
3
|
+
import { type ShowEventDetail } from '@iyulab/components/dist/events/ShowEvent.js';
|
|
4
|
+
import { type HideEventDetail } from '@iyulab/components/dist/events/HideEvent.js';
|
|
5
|
+
import { type UCommandPaletteCommandDetail } from '@iyulab/components/dist/components/command-palette/UCommandPalette.js';
|
|
6
|
+
|
|
7
|
+
type UCommandPaletteOwnProps = Omit<UCommandPaletteElement, keyof HTMLElement>;
|
|
8
|
+
|
|
9
|
+
export declare const UCommandPalette: React.ForwardRefExoticComponent<
|
|
10
|
+
Partial<Omit<UCommandPaletteElement, Exclude<keyof React.HTMLAttributes<UCommandPaletteElement>, keyof UCommandPaletteOwnProps>>>
|
|
11
|
+
& Omit<React.HTMLAttributes<UCommandPaletteElement>, keyof UCommandPaletteOwnProps | 'onShow' | 'onHide' | 'onCommand'>
|
|
12
|
+
& React.RefAttributes<UCommandPaletteElement>
|
|
13
|
+
& {
|
|
14
|
+
onShow?: (event: CustomEvent<ShowEventDetail>) => void;
|
|
15
|
+
onHide?: (event: CustomEvent<HideEventDetail>) => void;
|
|
16
|
+
onCommand?: (event: CustomEvent<UCommandPaletteCommandDetail>) => void;
|
|
17
|
+
}
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
export type UCommandPaletteProps = React.ComponentProps<typeof UCommandPalette>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createComponent } from '@lit/react';
|
|
3
|
+
import { UCommandPalette as UCommandPaletteElement } from '@iyulab/components/dist/components/command-palette/UCommandPalette.js';
|
|
4
|
+
|
|
5
|
+
export const UCommandPalette = createComponent({
|
|
6
|
+
react: React,
|
|
7
|
+
tagName: 'u-command-palette',
|
|
8
|
+
elementClass: UCommandPaletteElement,
|
|
9
|
+
events: {
|
|
10
|
+
onShow: 'show',
|
|
11
|
+
onHide: 'hide',
|
|
12
|
+
onCommand: 'command',
|
|
13
|
+
},
|
|
14
|
+
});
|
package/dist/react/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export { UDialog, UDialogProps } from './UDialog';
|
|
|
38
38
|
export { UDateRangePicker, UDateRangePickerProps } from './UDateRangePicker';
|
|
39
39
|
export { UDatePicker, UDatePickerProps } from './UDatePicker';
|
|
40
40
|
export { UCopyButton, UCopyButtonProps } from './UCopyButton';
|
|
41
|
+
export { UCommandPalette, UCommandPaletteProps } from './UCommandPalette';
|
|
41
42
|
export { UChip, UChipProps } from './UChip';
|
|
42
43
|
export { UCheckbox, UCheckboxProps } from './UCheckbox';
|
|
43
44
|
export { UCarousel, UCarouselProps } from './UCarousel';
|
package/dist/react/index.js
CHANGED
|
@@ -38,6 +38,7 @@ export { UDialog } from './UDialog.js';
|
|
|
38
38
|
export { UDateRangePicker } from './UDateRangePicker.js';
|
|
39
39
|
export { UDatePicker } from './UDatePicker.js';
|
|
40
40
|
export { UCopyButton } from './UCopyButton.js';
|
|
41
|
+
export { UCommandPalette } from './UCommandPalette.js';
|
|
41
42
|
export { UChip } from './UChip.js';
|
|
42
43
|
export { UCheckbox } from './UCheckbox.js';
|
|
43
44
|
export { UCarousel } from './UCarousel.js';
|
|
@@ -4,7 +4,7 @@ export type SupportedLocale = 'en' | 'ko' | 'ja' | 'zh-CN' | 'zh-TW' | 'es' | 'f
|
|
|
4
4
|
/** 내장 로케일은 자동완성되지만, 임의의 BCP47 태그도 그대로 받는다. */
|
|
5
5
|
export type LocaleTag = SupportedLocale | (string & {});
|
|
6
6
|
/** 라이브러리가 제공하는 chrome 문자열 키. 지금은 검증 메시지뿐이지만 이후 다른 UI 문구도 추가될 수 있다. */
|
|
7
|
-
export type LocaleMessageKey = 'valueMissing' | 'badInput' | 'typeMismatch' | 'patternMismatch' | 'rangeUnderflow' | 'rangeOverflow' | 'stepMismatch' | 'tooShort' | 'tooLong' | 'increment' | 'decrement' | 'clear' | 'today' | 'time' | 'showPassword' | 'hidePassword' | 'previousSlide' | 'nextSlide' | 'goToSlide' | 'carousel' | 'slide' | 'slideOf' | 'stopSlideRotation' | 'startSlideRotation' | 'chooseDate' | 'chooseDateRange' | 'yesterday' | 'last7Days' | 'last30Days' | 'last3Months' | 'last6Months' | 'thisWeek' | 'lastWeek' | 'thisMonth' | 'lastMonth' | 'thisYear' | 'quickRanges' | 'rangeStartChosen' | 'previousMonth' | 'nextMonth' | 'close' | 'copy' | 'copied' | 'chooseFile' | 'noFileChosen' | 'filesSelected' | 'resizePanels' | 'loading' | 'breadcrumb' | 'search' | 'noMatches' | 'alertError' | 'alertWarning' | 'alertSuccess' | 'alertInfo' | 'alertNotice' | 'alertMessage' | 'remove' | 'closeTab' | 'confirm' | 'cancel' | 'ok' | 'stepComplete' | 'stepOnHold' | 'stepSkipped' | 'apply' | 'dateUnavailable' | 'startTime' | 'endTime' | 'timeAm' | 'timePm' | 'pagination' | 'previousPage' | 'nextPage' | 'pageN' | 'rowsPerPage' | 'rangeOfTotal';
|
|
7
|
+
export type LocaleMessageKey = 'valueMissing' | 'badInput' | 'typeMismatch' | 'patternMismatch' | 'rangeUnderflow' | 'rangeOverflow' | 'stepMismatch' | 'tooShort' | 'tooLong' | 'increment' | 'decrement' | 'clear' | 'today' | 'time' | 'showPassword' | 'hidePassword' | 'previousSlide' | 'nextSlide' | 'goToSlide' | 'carousel' | 'slide' | 'slideOf' | 'stopSlideRotation' | 'startSlideRotation' | 'chooseDate' | 'chooseDateRange' | 'yesterday' | 'last7Days' | 'last30Days' | 'last3Months' | 'last6Months' | 'thisWeek' | 'lastWeek' | 'thisMonth' | 'lastMonth' | 'thisYear' | 'quickRanges' | 'rangeStartChosen' | 'previousMonth' | 'nextMonth' | 'close' | 'copy' | 'copied' | 'chooseFile' | 'noFileChosen' | 'filesSelected' | 'resizePanels' | 'loading' | 'breadcrumb' | 'search' | 'noMatches' | 'searchFailed' | 'alertError' | 'alertWarning' | 'alertSuccess' | 'alertInfo' | 'alertNotice' | 'alertMessage' | 'remove' | 'closeTab' | 'confirm' | 'cancel' | 'ok' | 'stepComplete' | 'stepOnHold' | 'stepSkipped' | 'apply' | 'dateUnavailable' | 'startTime' | 'endTime' | 'timeAm' | 'timePm' | 'pagination' | 'previousPage' | 'nextPage' | 'pageN' | 'rowsPerPage' | 'rangeOfTotal';
|
|
8
8
|
type LocaleTable = Record<LocaleMessageKey, string>;
|
|
9
9
|
/**
|
|
10
10
|
* 글자가 검색어를 담는가 — 사람이 «찾았다» 고 여기는 일치. 글자마다 거르는 칸(`u-select` 의 검색 등)이 쓴다.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* 이름 붙은 슬롯(`prefix` · `suffix` 등)에 라이트 DOM 자식이 꽂혀 있는가 — 슬롯을 감싼 섀도 안 상자를 비었을 때 그리지 않으려고 쓴다.
|
|
4
|
+
*
|
|
5
|
+
* 슬롯 옆 간격을 `::slotted()` 의 여백으로 주면 문서의 전역 리셋(Tailwind preflight 류 `* { margin: 0 }`)에 진다 — 캡슐화 문맥이
|
|
6
|
+
* 다르면 문서 쪽 normal 선언이 이긴다. 간격은 섀도 안 상자가 갖고, 그 상자는 꽂힌 것이 있을 때만 선다.
|
|
7
|
+
*
|
|
8
|
+
* 첫 렌더 전에도 답하도록 `slotchange` 가 아니라 자식 목록을 본다(직속 자식의 `slot` 속성).
|
|
9
|
+
*/
|
|
10
|
+
export declare class SlotPresence implements ReactiveController {
|
|
11
|
+
private readonly host;
|
|
12
|
+
private readonly names;
|
|
13
|
+
private present;
|
|
14
|
+
private readonly observer;
|
|
15
|
+
constructor(host: ReactiveControllerHost & HTMLElement, names: readonly string[]);
|
|
16
|
+
/** 그 이름의 슬롯에 꽂힌 자식이 있는가. */
|
|
17
|
+
has(name: string): boolean;
|
|
18
|
+
hostConnected(): void;
|
|
19
|
+
hostDisconnected(): void;
|
|
20
|
+
private sync;
|
|
21
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/utilities/slotPresence.ts
|
|
2
|
+
/**
|
|
3
|
+
* 이름 붙은 슬롯(`prefix` · `suffix` 등)에 라이트 DOM 자식이 꽂혀 있는가 — 슬롯을 감싼 섀도 안 상자를 비었을 때 그리지 않으려고 쓴다.
|
|
4
|
+
*
|
|
5
|
+
* 슬롯 옆 간격을 `::slotted()` 의 여백으로 주면 문서의 전역 리셋(Tailwind preflight 류 `* { margin: 0 }`)에 진다 — 캡슐화 문맥이
|
|
6
|
+
* 다르면 문서 쪽 normal 선언이 이긴다. 간격은 섀도 안 상자가 갖고, 그 상자는 꽂힌 것이 있을 때만 선다.
|
|
7
|
+
*
|
|
8
|
+
* 첫 렌더 전에도 답하도록 `slotchange` 가 아니라 자식 목록을 본다(직속 자식의 `slot` 속성).
|
|
9
|
+
*/
|
|
10
|
+
var SlotPresence = class {
|
|
11
|
+
constructor(host, names) {
|
|
12
|
+
this.host = host;
|
|
13
|
+
this.names = names;
|
|
14
|
+
this.present = /* @__PURE__ */ new Set();
|
|
15
|
+
this.observer = new MutationObserver(() => this.sync());
|
|
16
|
+
host.addController(this);
|
|
17
|
+
}
|
|
18
|
+
/** 그 이름의 슬롯에 꽂힌 자식이 있는가. */
|
|
19
|
+
has(name) {
|
|
20
|
+
return this.present.has(name);
|
|
21
|
+
}
|
|
22
|
+
hostConnected() {
|
|
23
|
+
this.sync();
|
|
24
|
+
this.observer.observe(this.host, {
|
|
25
|
+
childList: true,
|
|
26
|
+
attributes: true,
|
|
27
|
+
attributeFilter: ["slot"],
|
|
28
|
+
subtree: true
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
hostDisconnected() {
|
|
32
|
+
this.observer.disconnect();
|
|
33
|
+
}
|
|
34
|
+
sync() {
|
|
35
|
+
const next = new Set(this.names.filter((name) => Array.from(this.host.children).some((c) => c.slot === name)));
|
|
36
|
+
if (next.size === this.present.size && [...next].every((n) => this.present.has(n))) return;
|
|
37
|
+
this.present = next;
|
|
38
|
+
this.host.requestUpdate();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export { SlotPresence };
|
package/package.json
CHANGED
|
@@ -99,6 +99,7 @@ set on the host yourself always wins and is never overwritten.
|
|
|
99
99
|
|
|
100
100
|
- [`u-dialog`](./references/components/dialog.md) — Modal/non-modal dialog with configurable placement
|
|
101
101
|
- [`u-drawer`](./references/components/drawer.md) — Side-panel that slides in from any edge
|
|
102
|
+
- [`u-command-palette`](./references/components/command-palette.md) — Find-anything dialog (Ctrl/⌘ K style): a search field over results grouped by source, async sources with cancellation
|
|
102
103
|
- [`u-popover`](./references/components/popover.md) — Anchored floating panel with flexible trigger/dismiss policies
|
|
103
104
|
- [`u-tooltip`](./references/components/tooltip.md) — Hover/focus tooltip anchored to a target element
|
|
104
105
|
|
|
@@ -12,6 +12,9 @@ production floor, a kiosk, a lobby screen — so a list longer than the screen i
|
|
|
12
12
|
One round: it waits `pause` at the top, scrolls to the end at `speed` (px per second), waits `pause` at the end and
|
|
13
13
|
returns to the top. Content that fits does not move. It steps aside for a person: it stands still while the mouse is
|
|
14
14
|
over it or focus is inside it, and scrolling by hand always works (it carries on from where the person left it).
|
|
15
|
+
On a full-screen wall display the cursor is always over it and a tap leaves focus in it, so set `unattended` there:
|
|
16
|
+
the pointer and focus from a tap no longer stop it, and keyboard focus stops it only until `resume-delay` (30 seconds)
|
|
17
|
+
passes untouched — the pair of `u-carousel`'s `unattended`. `paused` still stops it.
|
|
15
18
|
For a user who asked for reduced motion (`prefers-reduced-motion: reduce`) it does not move at all. When it leaves the
|
|
16
19
|
screen and comes back — a carousel returning to its slide — it starts over from the top.
|
|
17
20
|
|
|
@@ -42,14 +45,33 @@ Otherwise it scrolls at `speed`.
|
|
|
42
45
|
|------|-------------|
|
|
43
46
|
| *(default)* | The content to scroll |
|
|
44
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
|
+
|
|
45
64
|
## Properties
|
|
46
65
|
|
|
47
66
|
| Property | Type | Default | Reflect | Description |
|
|
48
67
|
|----------|------|---------|---------|-------------|
|
|
49
|
-
| `
|
|
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` |
|
|
50
70
|
| `duration` | `number` | `0` | — | Time for one round (wait + scroll + wait), in ms; the speed follows from the distance. `0` uses `speed` |
|
|
51
|
-
| `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 |
|
|
52
72
|
| `paused` | `boolean` | `false` | ✓ | Do not scroll by itself — by hand only |
|
|
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 |
|
|
74
|
+
| `resumeDelay` | `number` | `30000` | — | `resume-delay` — with `unattended`, the idle time in ms before a stop caused by keyboard focus ends |
|
|
53
75
|
|
|
54
76
|
## Methods
|
|
55
77
|
|
|
@@ -23,7 +23,8 @@ Slide carousel. Each direct child element becomes one slide.
|
|
|
23
23
|
|
|
24
24
|
With `autoplay`, the carousel renders a stop/start button as the first control of its indicator
|
|
25
25
|
row (WCAG 2.2.2). Rotation pauses while the mouse is over the carousel and stops when keyboard focus
|
|
26
|
-
moves into it, until the user presses start (WAI-ARIA APG carousel pattern)
|
|
26
|
+
moves into it, until the user presses start (WAI-ARIA APG carousel pattern) — on a screen nobody operates, see
|
|
27
|
+
`unattended` below. Slides are
|
|
27
28
|
`aria-live="off"` while rotating and `polite` when stopped. For a user who has asked for reduced
|
|
28
29
|
motion (`prefers-reduced-motion: reduce`) the carousel starts stopped — the start button turns
|
|
29
30
|
rotation on — and it stops if that setting is turned on while the page is open.
|
|
@@ -51,6 +52,34 @@ the current tab fills over `autoplay-interval` while the carousel rotates. When
|
|
|
51
52
|
|
|
52
53
|
Give the carousel a height (`flex: 1` in a full-screen column, or a fixed height) — the row takes its share of it.
|
|
53
54
|
|
|
55
|
+
### Nobody at the screen — `unattended`
|
|
56
|
+
|
|
57
|
+
A full-screen wall display always has the mouse cursor over it, and someone who tapped a slide once leaves focus in it —
|
|
58
|
+
under the rules for a carousel a person is using, the board would stop on that slide for good, and the people reading
|
|
59
|
+
it from across the room would take a stopped board for a current one. `unattended` changes two of those rules: the
|
|
60
|
+
pointer never pauses rotation, and rotation stopped by keyboard focus starts again after `resume-delay` (30 seconds by
|
|
61
|
+
default) without a key press or a click in it. The stop button still stops it, and that stop stays (WCAG 2.2.2).
|
|
62
|
+
`startRotation()` / `stopRotation()` do what the button does, from code.
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<u-carousel autoplay loop unattended pagination pagination-style="labels" autoplay-interval="20000" aria-label="Floor board">…</u-carousel>
|
|
66
|
+
```
|
|
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
|
+
|
|
54
83
|
---
|
|
55
84
|
|
|
56
85
|
## Slots
|
|
@@ -70,11 +99,19 @@ Give the carousel a height (`flex: 1` in a full-screen column, or a fixed height
|
|
|
70
99
|
| `pagination` | `boolean` | `false` | Show dot pagination |
|
|
71
100
|
| `paginationStyle` | `'dots'\|'labels'` | `'dots'` | `pagination-style` — `labels` puts a row under the slides: each slide's name and a progress bar (see below) |
|
|
72
101
|
| `draggable` | `boolean` | `false` | Drag to navigate |
|
|
102
|
+
| `unattended` | `boolean` | `false` | A screen nobody operates — the pointer does not pause rotation, and a stop caused by keyboard focus ends after `resumeDelay` (see above) |
|
|
103
|
+
| `resumeDelay` | `number` | `30000` | `resume-delay` — with `unattended`, the idle time in ms before rotation stopped by keyboard focus starts again |
|
|
73
104
|
| `slidesPerView` | `number` | `1` | Visible slides at once |
|
|
74
105
|
| `slidesPerMove` | `number` | `1` | Slides to advance per step |
|
|
75
106
|
| `gap` | `number` | `0` | Gap between slides in px |
|
|
76
107
|
| `index` | `number` | `0` | Active slide index |
|
|
77
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
|
+
|
|
78
115
|
## Methods
|
|
79
116
|
|
|
80
117
|
| Method | Description |
|
|
@@ -82,6 +119,8 @@ Give the carousel a height (`flex: 1` in a full-screen column, or a fixed height
|
|
|
82
119
|
| `prev()` | Go to previous slide |
|
|
83
120
|
| `next()` | Go to next slide |
|
|
84
121
|
| `goTo(index)` | Jump to a specific slide index |
|
|
122
|
+
| `startRotation()` | Start automatic rotation again — whatever stopped it (the stop button, keyboard focus, reduced motion) |
|
|
123
|
+
| `stopRotation()` | Stop automatic rotation, as the stop button does |
|
|
85
124
|
|
|
86
125
|
## CSS Parts
|
|
87
126
|
|
|
@@ -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) |
|
|
@@ -94,4 +94,5 @@ message that needs a response.
|
|
|
94
94
|
| `panel` | The dialog panel |
|
|
95
95
|
| `header` | Header area |
|
|
96
96
|
| `body` | Body area |
|
|
97
|
+
| `footer` | Footer area around the `footer` slot — its padding and top divider (not drawn when the slot is empty). They live here, not on the slotted element, so a document-wide reset such as Tailwind's preflight cannot strip them |
|
|
97
98
|
| `close-btn` | Close button |
|
|
@@ -65,6 +65,7 @@ Same as `u-dialog`: exposed as a **`dialog`** (`aria-modal` when modal), named b
|
|
|
65
65
|
| `panel` | Drawer panel |
|
|
66
66
|
| `header` | Header area |
|
|
67
67
|
| `body` | Body area |
|
|
68
|
+
| `footer` | Footer area around the `footer` slot — its padding and top divider (not drawn when the slot is empty). They live here, not on the slotted element, so a document-wide reset such as Tailwind's preflight cannot strip them |
|
|
68
69
|
| `close-btn` | Close button |
|
|
69
70
|
|
|
70
71
|
## CSS Custom Properties
|
|
@@ -73,20 +73,25 @@ Options of different kinds can be grouped under headings with [`u-option-group`]
|
|
|
73
73
|
|--------|-------------|
|
|
74
74
|
| `validate()` | Validate; sets `invalid` |
|
|
75
75
|
| `reset()` | Reset value |
|
|
76
|
-
| `focus(options?)` | Focus the trigger |
|
|
76
|
+
| `focus(options?)` | Focus the trigger (its search input, when `searchable`) |
|
|
77
77
|
| `blur()` | Blur the trigger |
|
|
78
78
|
|
|
79
79
|
## Keyboard & accessibility
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
`
|
|
87
|
-
`
|
|
88
|
-
the
|
|
89
|
-
`
|
|
81
|
+
Without `searchable` the trigger is a `role="combobox"` (APG *select-only combobox*) whose dropdown holds a
|
|
82
|
+
`role="listbox"`; opening it focuses the first option. Typing on the closed trigger is **type-ahead**: a letter picks
|
|
83
|
+
the next option whose text starts with it (repeat the letter to cycle), and letters typed within half a second form a
|
|
84
|
+
word (`ch` → *cherry*); on an open list the same keys move the focus instead of picking.
|
|
85
|
+
|
|
86
|
+
With `searchable` the combobox is an **editable input inside the trigger** (APG *editable combobox with list
|
|
87
|
+
autocomplete*): `Tab` lands in it, and typing — including the first syllable of an IME composition — opens the list and
|
|
88
|
+
becomes the query at once, so nothing typed is lost. While there is a query the selected value is hidden behind it
|
|
89
|
+
(`multiple` keeps its chips and types after them). The first visible option is the **active candidate** — shown like a
|
|
90
|
+
hovered option and announced through the input's `aria-activedescendant` — and `Enter` picks it (closing the list, or
|
|
91
|
+
toggling it with `multiple`); the `Enter` that commits an IME composition does not. `ArrowDown`/`ArrowUp` open a closed
|
|
92
|
+
list and, on an open one, move to the first/last visible option; letters typed on an option go back to the input.
|
|
93
|
+
`Escape` closes the list (the focus stays in the input) and closing clears the query, so the trigger shows the value
|
|
94
|
+
again. On an option, arrows, `Home`/`End`, `Enter`/`Space` (select) and `Escape` (close) work as usual.
|
|
90
95
|
|
|
91
96
|
## CSS Parts
|
|
92
97
|
|
|
@@ -95,7 +100,7 @@ the first/last visible option; on an option, arrows, `Home`/`End`, `Enter`/`Spac
|
|
|
95
100
|
| `field` | Outer field wrapper |
|
|
96
101
|
| `container` | Trigger area |
|
|
97
102
|
| `popover` | Dropdown list container |
|
|
98
|
-
| `search-input` |
|
|
103
|
+
| `search-input` | The edit field inside the trigger (the combobox, when `searchable`) — closed, it holds the chosen option's text (single selection) |
|
|
99
104
|
| `no-matches` | *No matches* status line in the dropdown (empty and hidden otherwise) |
|
|
100
105
|
|
|
101
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
|
|