@iyulab/components 2.33.0 → 2.34.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 +39 -0
- package/dist/components/auto-scroll/UAutoScroll.d.ts +14 -0
- package/dist/components/auto-scroll/UAutoScroll.js +25 -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 +23 -1
- package/dist/components/carousel/UCarousel.js +64 -5
- 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 +21 -2
- package/dist/components/select/USelect.js +144 -41
- package/dist/components/select/USelect.styles.js +60 -22
- package/dist/components/tab/UTab.d.ts +2 -0
- package/dist/components/tab/UTab.js +4 -2
- package/dist/components/tab/UTab.styles.js +16 -2
- 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/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/references/components/auto-scroll.md +5 -0
- package/skills/iyulab-components/references/components/carousel.md +19 -1
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.34.0] - 2026-10-23
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **A searchable `u-select` is an editable combobox: its search input lives in the trigger.** Focus lands in it, so
|
|
8
|
+
typing on the closed select opens the list and the typed text — the first syllable of a Korean, Japanese or Chinese
|
|
9
|
+
composition included — is the query. Before, the trigger was not editable: the first keystrokes were dropped (an
|
|
10
|
+
input method cannot compose there) and the list had to be opened with ↓ or a click first. The dropdown no longer
|
|
11
|
+
holds a search field and no longer has `role="dialog"`; the combobox is the input (`aria-autocomplete="list"`),
|
|
12
|
+
`::part(search-input)` is that input, and `focus()` focuses it. Closing the list clears the query (a `search` event
|
|
13
|
+
with an empty query follows), so the trigger shows the value again. `Escape` keeps the focus in the input.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **`u-dialog` and `u-drawer` footers keep their padding and divider under a document-wide reset.** They were set on
|
|
18
|
+
the slotted footer element, and document rules beat `::slotted()` rules whatever their specificity, so Tailwind's
|
|
19
|
+
preflight (`* { padding: 0; border: 0 solid }`) stripped them. A new `footer` part inside the shadow root draws
|
|
20
|
+
them now; the slotted element keeps its flex row and gap. Padding or a border you set on the slotted element now
|
|
21
|
+
adds inside the footer.
|
|
22
|
+
- **Prefix and suffix spacing survives a document-wide reset** on `u-button`, `u-badge`, `u-breadcrumb-item`,
|
|
23
|
+
`u-input`, `u-menu-item`, `u-option`, `u-tab`, `u-tree-item` and `u-select`. The gap beside a `prefix` or `suffix`
|
|
24
|
+
slot was a margin on the slotted element, which a reset like Tailwind's preflight removes, so icons sat against the
|
|
25
|
+
text. The slots now sit in a box inside the shadow root that carries the gap, and that box takes no space while
|
|
26
|
+
its slot is empty.
|
|
27
|
+
- **`u-tab-panel` card and pill tab borders, and the dividers of a button-style `u-radio`, survive a document-wide
|
|
28
|
+
reset.** They were borders on the slotted tabs and options. The container now hands the width and colour down
|
|
29
|
+
through custom properties and each tab or option draws them on its own inner box.
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- **`unattended` on `u-carousel` and `u-auto-scroll`** — for a wall display, lobby or kiosk screen nobody operates. A
|
|
34
|
+
full-screen board always has the cursor over it, and a tap leaves focus in it; without it the carousel stopped on
|
|
35
|
+
that slide and the list stopped scrolling, for good. With `unattended` the pointer and focus from a tap do not stop
|
|
36
|
+
them, and a stop caused by keyboard focus ends after `resume-delay` (30 s by default) without a key press or a click.
|
|
37
|
+
The carousel's stop button still stops it (WCAG 2.2.2). `u-carousel` also gets `startRotation()` / `stopRotation()`.
|
|
38
|
+
- **Type-ahead on a non-searchable `u-select`** — a letter on the closed trigger picks the next option whose text
|
|
39
|
+
starts with it (`change` fires), the same letter again cycles, and letters typed within half a second form a word;
|
|
40
|
+
on an open list the letters move the focus instead. This is what a native `<select>` does.
|
|
41
|
+
|
|
3
42
|
## [2.33.0] - 2026-10-23
|
|
4
43
|
|
|
5
44
|
### Added
|
|
@@ -8,6 +8,9 @@ import { UElement } from '../UElement.js';
|
|
|
8
8
|
* 동작 줄이기(`prefers-reduced-motion: reduce`)를 켠 사용자에게는 움직이지 않는다(WCAG 2.2.2 — 손으로 굴리면 된다).
|
|
9
9
|
* 화면에서 사라졌다가 다시 보이면(캐러셀이 그 장으로 돌아오면) 맨 위부터 다시 시작한다.
|
|
10
10
|
*
|
|
11
|
+
* `unattended` 는 아무도 앞에서 조작하지 않는 화면이다 — 포인터가 위에 있어도 멈추지 않고(전체 화면이면 커서가 늘 위에 있다),
|
|
12
|
+
* 눌러서 들어온 초점으로도 멈추지 않는다. 키보드 초점으로 멈춘 것은 `resume-delay`(기본 30초) 동안 손대지 않으면 다시 움직인다. `paused` 는 그대로다.
|
|
13
|
+
*
|
|
11
14
|
* 넘치는 동안 호스트는 키보드로 닿는 스크롤 영역이다(`tabindex="0"` — 소비자가 단 값은 덮지 않는다).
|
|
12
15
|
*
|
|
13
16
|
* @slot - 굴릴 내용
|
|
@@ -25,6 +28,13 @@ export declare class UAutoScroll extends UElement {
|
|
|
25
28
|
pause: number;
|
|
26
29
|
/** 굴리지 않는다 — 손으로만 굴린다 */
|
|
27
30
|
paused: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 아무도 조작하지 않는 화면 — 포인터가 위에 있거나 눌러서 초점이 들어와도 멈추지 않고, 키보드 초점으로 멈춘 것은 `resume-delay`(기본 30초)
|
|
33
|
+
* 동안 손대지 않으면 다시 움직인다. `u-carousel` 의 같은 속성과 짝이다.
|
|
34
|
+
*/
|
|
35
|
+
unattended: boolean;
|
|
36
|
+
/** `unattended` 에서 키보드 초점으로 멈춘 굴림이 다시 움직이기까지 손대지 않은 시간 (ms). */
|
|
37
|
+
resumeDelay: number;
|
|
28
38
|
private readonly aria;
|
|
29
39
|
private frame?;
|
|
30
40
|
private waitUntil;
|
|
@@ -35,6 +45,8 @@ export declare class UAutoScroll extends UElement {
|
|
|
35
45
|
private legFrom;
|
|
36
46
|
private hovered;
|
|
37
47
|
private focused;
|
|
48
|
+
/** 마지막으로 키 · 포인터를 누른 시각 — `unattended` 의 초점 멈춤이 풀리는 기준. */
|
|
49
|
+
private lastActivity;
|
|
38
50
|
private visible;
|
|
39
51
|
private reducedMotion?;
|
|
40
52
|
private intersection?;
|
|
@@ -52,7 +64,9 @@ export declare class UAutoScroll extends UElement {
|
|
|
52
64
|
private syncTabStop;
|
|
53
65
|
private onPointerEnter;
|
|
54
66
|
private onPointerLeave;
|
|
67
|
+
/** `unattended` 에서는 키보드 초점만 멈춘다 — 줄을 눌러 들어온 초점은 아무도 앞에 없는 화면에 남아 굴림을 영영 세운다. */
|
|
55
68
|
private onFocusIn;
|
|
69
|
+
private onActivity;
|
|
56
70
|
private onFocusOut;
|
|
57
71
|
}
|
|
58
72
|
declare global {
|
|
@@ -3,6 +3,7 @@ import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.155.0/hel
|
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
|
|
4
4
|
import { HostAria } from "../../utilities/hostAria.js";
|
|
5
5
|
import { styles } from "./UAutoScroll.styles.js";
|
|
6
|
+
import { UNATTENDED_IDLE_MS } from "../../utilities/unattended.js";
|
|
6
7
|
import { html } from "lit";
|
|
7
8
|
import { customElement, property } from "lit/decorators.js";
|
|
8
9
|
// src/components/auto-scroll/UAutoScroll.ts
|
|
@@ -13,12 +14,15 @@ var UAutoScroll = class UAutoScroll extends UElement {
|
|
|
13
14
|
this.duration = 0;
|
|
14
15
|
this.pause = 3e3;
|
|
15
16
|
this.paused = false;
|
|
17
|
+
this.unattended = false;
|
|
18
|
+
this.resumeDelay = UNATTENDED_IDLE_MS;
|
|
16
19
|
this.aria = new HostAria(this);
|
|
17
20
|
this.waitUntil = 0;
|
|
18
21
|
this.phase = "top";
|
|
19
22
|
this.legFrom = 0;
|
|
20
23
|
this.hovered = false;
|
|
21
24
|
this.focused = false;
|
|
25
|
+
this.lastActivity = 0;
|
|
22
26
|
this.visible = false;
|
|
23
27
|
this.tick = (time) => {
|
|
24
28
|
this.frame = requestAnimationFrame(this.tick);
|
|
@@ -54,8 +58,14 @@ var UAutoScroll = class UAutoScroll extends UElement {
|
|
|
54
58
|
this.onPointerLeave = () => {
|
|
55
59
|
this.hovered = false;
|
|
56
60
|
};
|
|
57
|
-
this.onFocusIn = () => {
|
|
61
|
+
this.onFocusIn = (e) => {
|
|
62
|
+
const origin = e.composedPath()[0];
|
|
63
|
+
if (this.unattended && !(origin instanceof Element && origin.matches(":focus-visible"))) return;
|
|
58
64
|
this.focused = true;
|
|
65
|
+
this.lastActivity = performance.now();
|
|
66
|
+
};
|
|
67
|
+
this.onActivity = () => {
|
|
68
|
+
this.lastActivity = performance.now();
|
|
59
69
|
};
|
|
60
70
|
this.onFocusOut = (e) => {
|
|
61
71
|
if (!this.contains(e.relatedTarget)) this.focused = false;
|
|
@@ -71,6 +81,8 @@ var UAutoScroll = class UAutoScroll extends UElement {
|
|
|
71
81
|
this.addEventListener("pointerleave", this.onPointerLeave);
|
|
72
82
|
this.addEventListener("focusin", this.onFocusIn);
|
|
73
83
|
this.addEventListener("focusout", this.onFocusOut);
|
|
84
|
+
this.addEventListener("keydown", this.onActivity);
|
|
85
|
+
this.addEventListener("pointerdown", this.onActivity);
|
|
74
86
|
this.intersection = new IntersectionObserver((entries) => {
|
|
75
87
|
const now = entries.some((e) => e.isIntersecting);
|
|
76
88
|
if (now && !this.visible) this.restart();
|
|
@@ -90,6 +102,8 @@ var UAutoScroll = class UAutoScroll extends UElement {
|
|
|
90
102
|
this.removeEventListener("pointerleave", this.onPointerLeave);
|
|
91
103
|
this.removeEventListener("focusin", this.onFocusIn);
|
|
92
104
|
this.removeEventListener("focusout", this.onFocusOut);
|
|
105
|
+
this.removeEventListener("keydown", this.onActivity);
|
|
106
|
+
this.removeEventListener("pointerdown", this.onActivity);
|
|
93
107
|
super.disconnectedCallback();
|
|
94
108
|
}
|
|
95
109
|
/** 맨 위로 돌아가 한 바퀴를 처음부터 시작한다. */
|
|
@@ -106,7 +120,8 @@ var UAutoScroll = class UAutoScroll extends UElement {
|
|
|
106
120
|
return this.scrollHeight - this.clientHeight > 1;
|
|
107
121
|
}
|
|
108
122
|
get moving() {
|
|
109
|
-
|
|
123
|
+
const held = this.unattended ? this.focused && performance.now() - this.lastActivity < this.resumeDelay : this.hovered || this.focused;
|
|
124
|
+
return !this.paused && !held && this.visible && !this.reducedMotion?.matches;
|
|
110
125
|
}
|
|
111
126
|
/** px/초 — `duration` 이 있으면 남은 거리를 그 시간에서 두 번의 멈춤을 뺀 동안에 간다(최소 1초). */
|
|
112
127
|
pace(distance) {
|
|
@@ -122,5 +137,13 @@ __decorate([property({
|
|
|
122
137
|
type: Boolean,
|
|
123
138
|
reflect: true
|
|
124
139
|
}), __decorateMetadata("design:type", Object)], UAutoScroll.prototype, "paused", void 0);
|
|
140
|
+
__decorate([property({
|
|
141
|
+
type: Boolean,
|
|
142
|
+
reflect: true
|
|
143
|
+
}), __decorateMetadata("design:type", Object)], UAutoScroll.prototype, "unattended", void 0);
|
|
144
|
+
__decorate([property({
|
|
145
|
+
type: Number,
|
|
146
|
+
attribute: "resume-delay"
|
|
147
|
+
}), __decorateMetadata("design:type", Object)], UAutoScroll.prototype, "resumeDelay", void 0);
|
|
125
148
|
UAutoScroll = __decorate([customElement("u-auto-scroll")], UAutoScroll);
|
|
126
149
|
export { UAutoScroll };
|
|
@@ -16,6 +16,8 @@ export type BadgeAnchor = "top-right" | "top-left" | "bottom-right" | "bottom-le
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class UBadge extends UElement {
|
|
18
18
|
static styles: import('lit').CSSResultGroup[];
|
|
19
|
+
/** 접두 · 접미 슬롯이 찼는가 — 그 옆 간격은 섀도 안 상자가 갖는다(`::slotted` 여백은 문서의 전역 리셋에 진다). */
|
|
20
|
+
private readonly affixes;
|
|
19
21
|
/** 배지 유형 */
|
|
20
22
|
shape: BadgeShape;
|
|
21
23
|
/** 배지 색상 */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
|
|
4
|
+
import { SlotPresence } from "../../utilities/slotPresence.js";
|
|
4
5
|
import "../icon/UIcon.js";
|
|
5
6
|
import { statusIcon } from "../../utilities/statusIcon.js";
|
|
6
7
|
import { styles } from "./UBadge.styles.js";
|
|
@@ -10,6 +11,7 @@ import { customElement, property } from "lit/decorators.js";
|
|
|
10
11
|
var UBadge = class UBadge extends UElement {
|
|
11
12
|
constructor(..._args) {
|
|
12
13
|
super(..._args);
|
|
14
|
+
this.affixes = new SlotPresence(this, ["prefix", "suffix"]);
|
|
13
15
|
this.shape = "pill";
|
|
14
16
|
this.color = "blue";
|
|
15
17
|
this.icon = false;
|
|
@@ -23,9 +25,9 @@ var UBadge = class UBadge extends UElement {
|
|
|
23
25
|
return html`
|
|
24
26
|
<div class="base" part="base">
|
|
25
27
|
${iconName ? html`<u-icon class="icon" part="icon" lib="internal" name=${iconName}></u-icon>` : nothing}
|
|
26
|
-
<slot name="prefix"></slot>
|
|
28
|
+
<span class="affix affix-prefix" ?hidden=${!this.affixes.has("prefix")}><slot name="prefix"></slot></span>
|
|
27
29
|
<slot></slot>
|
|
28
|
-
<slot name="suffix"></slot>
|
|
30
|
+
<span class="affix affix-suffix" ?hidden=${!this.affixes.has("suffix")}><slot name="suffix"></slot></span>
|
|
29
31
|
</div>
|
|
30
32
|
`;
|
|
31
33
|
}
|
|
@@ -151,10 +151,19 @@ var styles = css`
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
|
|
155
|
+
.affix {
|
|
156
|
+
display: inline-flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
flex: none;
|
|
159
|
+
}
|
|
160
|
+
.affix[hidden] {
|
|
161
|
+
display: none;
|
|
162
|
+
}
|
|
163
|
+
.affix-prefix {
|
|
155
164
|
margin-right: 0.25em;
|
|
156
165
|
}
|
|
157
|
-
|
|
166
|
+
.affix-suffix {
|
|
158
167
|
margin-left: 0.25em;
|
|
159
168
|
}
|
|
160
169
|
`;
|
|
@@ -12,6 +12,8 @@ import { UElement } from '../UElement.js';
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class UBreadcrumbItem extends UElement {
|
|
14
14
|
static styles: import('lit').CSSResultGroup[];
|
|
15
|
+
/** 접두 · 접미 슬롯이 찼는가 — 그 옆 간격은 섀도 안 상자가 갖는다(`::slotted` 여백은 문서의 전역 리셋에 진다). */
|
|
16
|
+
private readonly affixes;
|
|
15
17
|
/** 호스트의 `.focus()` 를 안쪽 컨트롤로 위임한다 — `UButton` 과 같은 계약(호스트는 포커스 가능하지 않다). */
|
|
16
18
|
static shadowRootOptions: ShadowRootInit;
|
|
17
19
|
/** 비활성화 상태 */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
|
|
4
|
+
import { SlotPresence } from "../../utilities/slotPresence.js";
|
|
4
5
|
import { styles } from "./UBreadcrumbItem.styles.js";
|
|
5
6
|
import { html } from "lit";
|
|
6
7
|
import { customElement, property } from "lit/decorators.js";
|
|
@@ -9,6 +10,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|
|
9
10
|
var UBreadcrumbItem = class UBreadcrumbItem extends UElement {
|
|
10
11
|
constructor(..._args) {
|
|
11
12
|
super(..._args);
|
|
13
|
+
this.affixes = new SlotPresence(this, ["prefix", "suffix"]);
|
|
12
14
|
this.disabled = false;
|
|
13
15
|
this.handleAnchorClick = (e) => {
|
|
14
16
|
if (this.disabled) {
|
|
@@ -36,14 +38,14 @@ var UBreadcrumbItem = class UBreadcrumbItem extends UElement {
|
|
|
36
38
|
rel=${ifDefined(this.rel)}
|
|
37
39
|
@click=${this.handleAnchorClick}
|
|
38
40
|
>
|
|
39
|
-
<slot name="prefix"></slot>
|
|
41
|
+
<span class="affix affix-prefix" ?hidden=${!this.affixes.has("prefix")}><slot name="prefix"></slot></span>
|
|
40
42
|
<slot></slot>
|
|
41
|
-
<slot name="suffix"></slot>
|
|
43
|
+
<span class="affix affix-suffix" ?hidden=${!this.affixes.has("suffix")}><slot name="suffix"></slot></span>
|
|
42
44
|
</a>`;
|
|
43
45
|
return html`
|
|
44
|
-
<slot name="prefix"></slot>
|
|
46
|
+
<span class="affix affix-prefix" ?hidden=${!this.affixes.has("prefix")}><slot name="prefix"></slot></span>
|
|
45
47
|
<slot></slot>
|
|
46
|
-
<slot name="suffix"></slot>
|
|
48
|
+
<span class="affix affix-suffix" ?hidden=${!this.affixes.has("suffix")}><slot name="suffix"></slot></span>
|
|
47
49
|
`;
|
|
48
50
|
}
|
|
49
51
|
};
|
|
@@ -34,10 +34,19 @@ var styles = css`
|
|
|
34
34
|
cursor: inherit;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
.affix {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
flex: none;
|
|
42
|
+
}
|
|
43
|
+
.affix[hidden] {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
.affix-prefix {
|
|
38
47
|
margin-right: 0.2em;
|
|
39
48
|
}
|
|
40
|
-
|
|
49
|
+
.affix-suffix {
|
|
41
50
|
margin-left: 0.2em;
|
|
42
51
|
}
|
|
43
52
|
`;
|
|
@@ -60,6 +60,8 @@ export type ButtonSize = "sm" | "md" | "lg";
|
|
|
60
60
|
*/
|
|
61
61
|
export declare class UButton extends UElement {
|
|
62
62
|
static styles: import('lit').CSSResultGroup[];
|
|
63
|
+
/** 접두 · 접미 슬롯이 찼는가 — 그 옆 간격은 섀도 안 상자가 갖는다(`::slotted` 여백은 문서의 전역 리셋에 진다). */
|
|
64
|
+
private readonly affixes;
|
|
63
65
|
static formAssociated: boolean;
|
|
64
66
|
/**
|
|
65
67
|
* 호스트의 `.focus()` 를 섀도 안의 네이티브 `<button>`/`<a>` 로 위임한다. 호스트는 포커스
|
|
@@ -4,6 +4,7 @@ import __decorate from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm
|
|
|
4
4
|
import "../spinner/USpinner.js";
|
|
5
5
|
import { styles } from "./UButton.styles.js";
|
|
6
6
|
import { FORWARDED_ARIA, readForwardedAria } from "./forwarded-aria.js";
|
|
7
|
+
import { SlotPresence } from "../../utilities/slotPresence.js";
|
|
7
8
|
import { html } from "lit";
|
|
8
9
|
import { customElement, property } from "lit/decorators.js";
|
|
9
10
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
@@ -11,6 +12,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|
|
11
12
|
var UButton = class UButton extends UElement {
|
|
12
13
|
constructor(..._args) {
|
|
13
14
|
super(..._args);
|
|
15
|
+
this.affixes = new SlotPresence(this, ["prefix", "suffix"]);
|
|
14
16
|
this.appearance = "solid";
|
|
15
17
|
this.size = "md";
|
|
16
18
|
this.rounded = false;
|
|
@@ -153,11 +155,11 @@ var UButton = class UButton extends UElement {
|
|
|
153
155
|
}
|
|
154
156
|
renderContent() {
|
|
155
157
|
return html`
|
|
156
|
-
<slot name="prefix"></slot>
|
|
158
|
+
<span class="affix affix-prefix" ?hidden=${!this.affixes.has("prefix")}><slot name="prefix"></slot></span>
|
|
157
159
|
<div class="content" part="content">
|
|
158
160
|
<slot></slot>
|
|
159
161
|
</div>
|
|
160
|
-
<slot name="suffix"></slot>
|
|
162
|
+
<span class="affix affix-suffix" ?hidden=${!this.affixes.has("suffix")}><slot name="suffix"></slot></span>
|
|
161
163
|
`;
|
|
162
164
|
}
|
|
163
165
|
renderMask() {
|
|
@@ -362,10 +362,19 @@ var styles = css`
|
|
|
362
362
|
color: inherit;
|
|
363
363
|
font-size: inherit;
|
|
364
364
|
}
|
|
365
|
-
|
|
365
|
+
|
|
366
|
+
.affix {
|
|
367
|
+
display: inline-flex;
|
|
368
|
+
align-items: center;
|
|
369
|
+
flex: none;
|
|
370
|
+
}
|
|
371
|
+
.affix[hidden] {
|
|
372
|
+
display: none;
|
|
373
|
+
}
|
|
374
|
+
.affix-prefix {
|
|
366
375
|
margin-right: 0.5em;
|
|
367
376
|
}
|
|
368
|
-
|
|
377
|
+
.affix-suffix {
|
|
369
378
|
margin-left: 0.5em;
|
|
370
379
|
}
|
|
371
380
|
|
|
@@ -10,6 +10,10 @@ import { UElement } from '../UElement.js';
|
|
|
10
10
|
* (WAI-ARIA APG Carousel · WCAG 2.2.2). 사용자가 동작 줄이기(`prefers-reduced-motion: reduce`)를
|
|
11
11
|
* 켜 두었으면 정지 상태로 시작하고(시작 버튼으로 켤 수 있다), 보는 중에 그 설정이 켜지면 멈춘다.
|
|
12
12
|
*
|
|
13
|
+
* `unattended` 는 아무도 앞에서 조작하지 않는 화면(벽걸이 보드 · 로비 · 키오스크)이다 — 전체 화면이면 마우스 커서가 늘 그 위에
|
|
14
|
+
* 있으므로 포인터로는 멈추지 않고, 키보드 초점으로 멈춘 회전은 `resume-delay`(기본 30초) 동안 손대지 않으면 다시 돈다. 정지 버튼으로 멈춘 것은
|
|
15
|
+
* 그대로 멈춰 있다(멈출 수단은 남는다 — 2.2.2).
|
|
16
|
+
*
|
|
13
17
|
* 보조기기에는 WAI-ARIA APG Carousel 구조로 나간다 — 호스트는 «캐러셀» 역할 설명을 단 영역(`region`), 각 슬라이드는
|
|
14
18
|
* «슬라이드» 역할 설명과 «n / 전체» 이름을 단 그룹이다. 캐러셀의 이름은 호스트의 `aria-label` 로 준다(영역은 이름이
|
|
15
19
|
* 있어야 랜드마크다). 슬라이드에 소비자가 이미 단 `role`·`aria-roledescription`·`aria-label` 은 덮지 않는다.
|
|
@@ -44,6 +48,13 @@ export declare class UCarousel extends UElement {
|
|
|
44
48
|
paginationStyle: 'dots' | 'labels';
|
|
45
49
|
/** 드래그로 슬라이드 이동 */
|
|
46
50
|
draggable: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* 아무도 조작하지 않는 화면 — 포인터가 위에 있어도 멈추지 않고, 키보드 초점으로 멈춘 회전은 `resume-delay`(기본 30초) 동안 손대지
|
|
53
|
+
* 않으면 다시 돈다. 정지 버튼으로 멈춘 것은 그대로다. `u-auto-scroll` 의 같은 속성과 짝이다.
|
|
54
|
+
*/
|
|
55
|
+
unattended: boolean;
|
|
56
|
+
/** `unattended` 에서 키보드 초점으로 멈춘 회전이 다시 돌기까지 손대지 않은 시간 (ms). */
|
|
57
|
+
resumeDelay: number;
|
|
47
58
|
/** 한 화면에 표시할 슬라이드 수 */
|
|
48
59
|
slidesPerView: number;
|
|
49
60
|
/** 한 번에 이동할 슬라이드 수 */
|
|
@@ -57,8 +68,11 @@ export declare class UCarousel extends UElement {
|
|
|
57
68
|
private dragOffset;
|
|
58
69
|
/** 사용자가 회전을 멈췄다(정지 버튼, 또는 키보드 초점 진입). 다시 시작할 때까지 유지된다. */
|
|
59
70
|
private rotationStopped;
|
|
60
|
-
/** 포인터가 캐러셀 위에 있다 — 그동안만 잠시
|
|
71
|
+
/** 포인터가 캐러셀 위에 있다 — 그동안만 잠시 멈춘다(`unattended` 가 아닐 때). */
|
|
61
72
|
private hovered;
|
|
73
|
+
/** 왜 멈췄는가 — `unattended` 에서 초점으로 멈춘 것만 손대지 않으면 다시 돈다. */
|
|
74
|
+
private stopReason?;
|
|
75
|
+
private idleTimer?;
|
|
62
76
|
private autoplayTimer?;
|
|
63
77
|
/** 호스트 역할(region · «캐러셀» 역할 설명)을 속성으로 — 소비자의 `role`·`aria-roledescription` 이 있으면 그것이 이긴다. */
|
|
64
78
|
private readonly aria;
|
|
@@ -104,6 +118,14 @@ export declare class UCarousel extends UElement {
|
|
|
104
118
|
private handlePointerMove;
|
|
105
119
|
private handlePointerUp;
|
|
106
120
|
private toggleRotation;
|
|
121
|
+
/** 자동 넘김을 다시 시작한다 — 정지 버튼 · 초점 · 동작 줄이기로 멈춘 것 모두(`autoplay` 일 때만 돈다). */
|
|
122
|
+
startRotation(): void;
|
|
123
|
+
/** 자동 넘김을 멈춘다 — 정지 버튼과 같다(`unattended` 에서도 저절로 다시 돌지 않는다). */
|
|
124
|
+
stopRotation(): void;
|
|
125
|
+
/** `unattended` 에서 초점으로 멈췄으면, 손대지 않고 `resumeDelay` 가 지나면 다시 돈다 — 키 · 포인터를 누를 때마다 다시 잰다. */
|
|
126
|
+
private scheduleIdleResume;
|
|
127
|
+
private clearIdle;
|
|
128
|
+
private handleActivity;
|
|
107
129
|
/** 키보드 초점이 들어오면 멈춘다 — 포인터로 누른 초점은 멈추지 않는다(누른 버튼이 정지 버튼이면 그 클릭이 결정한다). */
|
|
108
130
|
private handleFocusIn;
|
|
109
131
|
/** 보는 중에 동작 줄이기가 켜지면 멈춘다. 꺼질 때는 다시 시작하지 않는다 — 멈춘 것을 움직이게
|
|
@@ -5,6 +5,7 @@ import __decorate from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm
|
|
|
5
5
|
import { HostAria } from "../../utilities/hostAria.js";
|
|
6
6
|
import "../button/UButton.js";
|
|
7
7
|
import "../icon/UIcon.js";
|
|
8
|
+
import { UNATTENDED_IDLE_MS } from "../../utilities/unattended.js";
|
|
8
9
|
import { styles } from "./UCarousel.styles.js";
|
|
9
10
|
import { html, nothing } from "lit";
|
|
10
11
|
import { customElement, property, state } from "lit/decorators.js";
|
|
@@ -21,6 +22,8 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
21
22
|
this.pagination = false;
|
|
22
23
|
this.paginationStyle = "dots";
|
|
23
24
|
this.draggable = false;
|
|
25
|
+
this.unattended = false;
|
|
26
|
+
this.resumeDelay = UNATTENDED_IDLE_MS;
|
|
24
27
|
this.slidesPerView = 1;
|
|
25
28
|
this.slidesPerMove = 1;
|
|
26
29
|
this.gap = 0;
|
|
@@ -91,15 +94,27 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
91
94
|
if (this.rotating) this.startAutoplay();
|
|
92
95
|
};
|
|
93
96
|
this.toggleRotation = () => {
|
|
94
|
-
this.rotationStopped
|
|
97
|
+
if (this.rotationStopped) this.startRotation();
|
|
98
|
+
else this.stopRotation();
|
|
99
|
+
};
|
|
100
|
+
this.handleActivity = () => {
|
|
101
|
+
if (this.idleTimer !== void 0) this.scheduleIdleResume();
|
|
95
102
|
};
|
|
96
103
|
this.handleFocusIn = (e) => {
|
|
97
104
|
if (!this.autoplay) return;
|
|
98
105
|
const origin = e.composedPath()[0];
|
|
99
|
-
if (origin instanceof Element && origin.matches(":focus-visible")
|
|
106
|
+
if (origin instanceof Element && origin.matches(":focus-visible") && this.stopReason !== "user") {
|
|
107
|
+
this.rotationStopped = true;
|
|
108
|
+
this.stopReason = "focus";
|
|
109
|
+
this.scheduleIdleResume();
|
|
110
|
+
}
|
|
100
111
|
};
|
|
101
112
|
this.handleReducedMotionChange = (e) => {
|
|
102
|
-
if (e.matches && this.autoplay)
|
|
113
|
+
if (e.matches && this.autoplay) {
|
|
114
|
+
this.clearIdle();
|
|
115
|
+
this.rotationStopped = true;
|
|
116
|
+
this.stopReason = "motion";
|
|
117
|
+
}
|
|
103
118
|
};
|
|
104
119
|
this.handlePointerEnter = (e) => {
|
|
105
120
|
if (e.pointerType === "mouse") this.hovered = true;
|
|
@@ -117,7 +132,7 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
117
132
|
}
|
|
118
133
|
/** 지금 자동으로 넘기고 있는가. */
|
|
119
134
|
get rotating() {
|
|
120
|
-
return this.autoplay && !this.rotationStopped && !this.hovered;
|
|
135
|
+
return this.autoplay && !this.rotationStopped && (this.unattended || !this.hovered);
|
|
121
136
|
}
|
|
122
137
|
get showDots() {
|
|
123
138
|
return this.pagination && this.pageCount > 1;
|
|
@@ -144,6 +159,8 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
144
159
|
this.addEventListener("focusin", this.handleFocusIn);
|
|
145
160
|
this.addEventListener("pointerenter", this.handlePointerEnter);
|
|
146
161
|
this.addEventListener("pointerleave", this.handlePointerLeave);
|
|
162
|
+
this.addEventListener("keydown", this.handleActivity);
|
|
163
|
+
this.addEventListener("pointerdown", this.handleActivity);
|
|
147
164
|
this.reducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)");
|
|
148
165
|
this.reducedMotion?.addEventListener("change", this.handleReducedMotionChange);
|
|
149
166
|
if (this.rotating) this.startAutoplay();
|
|
@@ -155,11 +172,17 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
155
172
|
this.removeEventListener("focusin", this.handleFocusIn);
|
|
156
173
|
this.removeEventListener("pointerenter", this.handlePointerEnter);
|
|
157
174
|
this.removeEventListener("pointerleave", this.handlePointerLeave);
|
|
175
|
+
this.removeEventListener("keydown", this.handleActivity);
|
|
176
|
+
this.removeEventListener("pointerdown", this.handleActivity);
|
|
177
|
+
this.clearIdle();
|
|
158
178
|
super.disconnectedCallback();
|
|
159
179
|
}
|
|
160
180
|
willUpdate(changedProperties) {
|
|
161
181
|
super.willUpdate(changedProperties);
|
|
162
|
-
if (changedProperties.has("autoplay") && this.autoplay)
|
|
182
|
+
if (changedProperties.has("autoplay") && this.autoplay) {
|
|
183
|
+
this.rotationStopped = !!this.reducedMotion?.matches;
|
|
184
|
+
this.stopReason = this.rotationStopped ? "motion" : void 0;
|
|
185
|
+
}
|
|
163
186
|
if (changedProperties.has("slidesPerView")) this.style.setProperty("--slides-per-view", String(this.perView));
|
|
164
187
|
if (changedProperties.has("gap")) this.style.setProperty("--slide-gap", `${this.gap}px`);
|
|
165
188
|
}
|
|
@@ -298,6 +321,34 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
298
321
|
for (const name of this.ownedSlideAttrs.get(slide) ?? []) slide.removeAttribute(name);
|
|
299
322
|
this.ownedSlideAttrs.delete(slide);
|
|
300
323
|
}
|
|
324
|
+
/** 자동 넘김을 다시 시작한다 — 정지 버튼 · 초점 · 동작 줄이기로 멈춘 것 모두(`autoplay` 일 때만 돈다). */
|
|
325
|
+
startRotation() {
|
|
326
|
+
this.clearIdle();
|
|
327
|
+
this.stopReason = void 0;
|
|
328
|
+
this.rotationStopped = false;
|
|
329
|
+
}
|
|
330
|
+
/** 자동 넘김을 멈춘다 — 정지 버튼과 같다(`unattended` 에서도 저절로 다시 돌지 않는다). */
|
|
331
|
+
stopRotation() {
|
|
332
|
+
this.clearIdle();
|
|
333
|
+
this.stopReason = "user";
|
|
334
|
+
this.rotationStopped = true;
|
|
335
|
+
}
|
|
336
|
+
/** `unattended` 에서 초점으로 멈췄으면, 손대지 않고 `resumeDelay` 가 지나면 다시 돈다 — 키 · 포인터를 누를 때마다 다시 잰다. */
|
|
337
|
+
scheduleIdleResume() {
|
|
338
|
+
this.clearIdle();
|
|
339
|
+
if (!this.unattended || this.stopReason !== "focus") return;
|
|
340
|
+
this.idleTimer = window.setTimeout(() => {
|
|
341
|
+
this.idleTimer = void 0;
|
|
342
|
+
if (this.unattended && this.stopReason === "focus") {
|
|
343
|
+
this.stopReason = void 0;
|
|
344
|
+
this.rotationStopped = false;
|
|
345
|
+
}
|
|
346
|
+
}, this.resumeDelay);
|
|
347
|
+
}
|
|
348
|
+
clearIdle() {
|
|
349
|
+
if (this.idleTimer !== void 0) window.clearTimeout(this.idleTimer);
|
|
350
|
+
this.idleTimer = void 0;
|
|
351
|
+
}
|
|
301
352
|
};
|
|
302
353
|
__decorate([property({
|
|
303
354
|
type: Boolean,
|
|
@@ -328,6 +379,14 @@ __decorate([property({
|
|
|
328
379
|
type: Boolean,
|
|
329
380
|
reflect: true
|
|
330
381
|
}), __decorateMetadata("design:type", Object)], UCarousel.prototype, "draggable", void 0);
|
|
382
|
+
__decorate([property({
|
|
383
|
+
type: Boolean,
|
|
384
|
+
reflect: true
|
|
385
|
+
}), __decorateMetadata("design:type", Object)], UCarousel.prototype, "unattended", void 0);
|
|
386
|
+
__decorate([property({
|
|
387
|
+
type: Number,
|
|
388
|
+
attribute: "resume-delay"
|
|
389
|
+
}), __decorateMetadata("design:type", Object)], UCarousel.prototype, "resumeDelay", void 0);
|
|
331
390
|
__decorate([property({
|
|
332
391
|
type: Number,
|
|
333
392
|
attribute: "slides-per-view"
|
|
@@ -12,6 +12,7 @@ export type DialogPlacement = 'top-start' | 'top' | 'top-end' | 'start' | 'cente
|
|
|
12
12
|
* @csspart panel - 다이얼로그의 패널 요소
|
|
13
13
|
* @csspart header - 다이얼로그의 헤더 요소
|
|
14
14
|
* @csspart body - 다이얼로그의 본문 요소
|
|
15
|
+
* @csspart footer - 푸터 영역(여백 · 구분선) — 꽂힌 것이 없으면 그리지 않는다
|
|
15
16
|
* @csspart close-btn - 닫기 버튼 요소
|
|
16
17
|
*/
|
|
17
18
|
export declare class UDialog extends UOverlayElement {
|
|
@@ -23,8 +24,10 @@ export declare class UDialog extends UOverlayElement {
|
|
|
23
24
|
/** 가장자리로부터의 간격 (px) */
|
|
24
25
|
offset: number;
|
|
25
26
|
private hasHeader;
|
|
27
|
+
private hasFooter;
|
|
26
28
|
protected updated(changedProperties: PropertyValues): void;
|
|
27
29
|
render(): import('lit-html').TemplateResult<1>;
|
|
30
|
+
private handleFooterSlotChange;
|
|
28
31
|
private handleHeaderSlotChange;
|
|
29
32
|
}
|
|
30
33
|
declare global {
|
|
@@ -15,6 +15,7 @@ var UDialog = class UDialog extends UOverlayElement {
|
|
|
15
15
|
this.placement = "center";
|
|
16
16
|
this.offset = 0;
|
|
17
17
|
this.hasHeader = false;
|
|
18
|
+
this.hasFooter = false;
|
|
18
19
|
}
|
|
19
20
|
static {
|
|
20
21
|
this.styles = [super.styles, styles];
|
|
@@ -42,11 +43,16 @@ var UDialog = class UDialog extends UOverlayElement {
|
|
|
42
43
|
<div class="body" part="body">
|
|
43
44
|
<slot></slot>
|
|
44
45
|
</div>
|
|
45
|
-
<
|
|
46
|
+
<div class="footer" part="footer" ?hidden=${!this.hasFooter}>
|
|
47
|
+
<slot name="footer" @slotchange=${this.handleFooterSlotChange}></slot>
|
|
48
|
+
</div>
|
|
46
49
|
</div>
|
|
47
50
|
</div>
|
|
48
51
|
`;
|
|
49
52
|
}
|
|
53
|
+
handleFooterSlotChange(e) {
|
|
54
|
+
this.hasFooter = e.target.assignedNodes({ flatten: true }).length > 0;
|
|
55
|
+
}
|
|
50
56
|
handleHeaderSlotChange(e) {
|
|
51
57
|
const slot = e.target;
|
|
52
58
|
this.hasHeader = slot.assignedNodes({ flatten: true }).length > 0;
|
|
@@ -66,5 +72,6 @@ __decorate([property({
|
|
|
66
72
|
reflect: true
|
|
67
73
|
}), __decorateMetadata("design:type", Object)], UDialog.prototype, "offset", void 0);
|
|
68
74
|
__decorate([state(), __decorateMetadata("design:type", Object)], UDialog.prototype, "hasHeader", void 0);
|
|
75
|
+
__decorate([state(), __decorateMetadata("design:type", Object)], UDialog.prototype, "hasFooter", void 0);
|
|
69
76
|
UDialog = __decorate([customElement("u-dialog")], UDialog);
|
|
70
77
|
export { UDialog };
|
|
@@ -109,14 +109,21 @@ var styles = css`
|
|
|
109
109
|
overflow: auto;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
.footer {
|
|
113
115
|
flex-shrink: 0;
|
|
116
|
+
padding: var(--u-space-md, 12px) var(--u-space-lg, 16px);
|
|
117
|
+
border-top: 1px solid var(--u-border-color, #E0E0E0);
|
|
118
|
+
}
|
|
119
|
+
.footer[hidden] {
|
|
120
|
+
display: none;
|
|
121
|
+
}
|
|
122
|
+
::slotted([slot="footer"]) {
|
|
114
123
|
display: flex;
|
|
115
124
|
align-items: center;
|
|
116
125
|
justify-content: flex-end;
|
|
117
126
|
gap: var(--u-space-sm, 8px);
|
|
118
|
-
padding: var(--u-space-md, 12px) var(--u-space-lg, 16px);
|
|
119
|
-
border-top: 1px solid var(--u-border-color, #E0E0E0);
|
|
120
127
|
}
|
|
121
128
|
`;
|
|
122
129
|
export { styles };
|
|
@@ -11,6 +11,7 @@ export type DrawerPlacement = 'left' | 'right' | 'top' | 'bottom';
|
|
|
11
11
|
* @csspart panel - 드로어 패널 전체
|
|
12
12
|
* @csspart header - 헤더 영역
|
|
13
13
|
* @csspart body - 본문 영역
|
|
14
|
+
* @csspart footer - 푸터 영역(여백 · 구분선) — 꽂힌 것이 없으면 그리지 않는다
|
|
14
15
|
* @csspart close-btn - 닫기 버튼
|
|
15
16
|
*
|
|
16
17
|
* @cssprop --drawer-size - 드로어 패널의 슬라이드 축 방향 크기 (기본값: 좌우 28rem / 상하 16rem).
|
|
@@ -24,7 +25,9 @@ export declare class UDrawer extends UOverlayElement {
|
|
|
24
25
|
/** 드로어가 열리는 위치 */
|
|
25
26
|
placement: DrawerPlacement;
|
|
26
27
|
private hasHeader;
|
|
28
|
+
private hasFooter;
|
|
27
29
|
render(): import('lit-html').TemplateResult<1>;
|
|
30
|
+
private handleFooterSlotChange;
|
|
28
31
|
private handleHeaderSlotChange;
|
|
29
32
|
}
|
|
30
33
|
declare global {
|