@iyulab/components 2.27.1 → 2.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +1 -1
- package/dist/components/UFloatingElement.d.ts +11 -0
- package/dist/components/UFloatingElement.js +33 -1
- package/dist/components/UFloatingElement.styles.js +5 -0
- package/dist/components/button/UButton.js +6 -6
- package/dist/components/button/forwarded-aria.d.ts +6 -0
- package/dist/components/button/forwarded-aria.js +18 -1
- package/dist/components/copy-button/UCopyButton.js +1 -1
- package/dist/components/icon-button/UIconButton.js +6 -6
- package/dist/components/input/UInput.d.ts +5 -0
- package/dist/components/input/UInput.js +23 -9
- package/dist/components/menu-item/UMenuItem.d.ts +12 -0
- package/dist/components/menu-item/UMenuItem.js +38 -2
- package/dist/components/option-group/UOptionGroup.d.ts +45 -0
- package/dist/components/option-group/UOptionGroup.js +69 -0
- package/dist/components/option-group/UOptionGroup.styles.d.ts +1 -0
- package/dist/components/option-group/UOptionGroup.styles.js +33 -0
- package/dist/components/select/USelect.d.ts +5 -0
- package/dist/components/select/USelect.js +22 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/plugins/dts-globals.d.ts +3 -2
- package/dist/plugins/dts-globals.js +6 -3
- package/dist/react/UOptionGroup.d.ts +14 -0
- package/dist/react/UOptionGroup.js +10 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/utilities/BrowserStorage.js +3 -3
- package/dist/utilities/Dialog.js +1 -1
- package/dist/utilities/Theme.js +1 -1
- package/dist/utilities/converters.js +3 -3
- package/dist/utilities/icons.js +1 -1
- package/package.json +1 -1
- package/skills/iyulab-components/SKILL.md +1 -0
- package/skills/iyulab-components/references/components/button.md +2 -0
- package/skills/iyulab-components/references/components/menu.md +6 -0
- package/skills/iyulab-components/references/components/option-group.md +56 -0
- package/skills/iyulab-components/references/components/select.md +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.28.1] - 2026-10-16
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- `u-button` · `u-icon-button`: an empty state attribute on the host (`aria-pressed` · `aria-expanded` · `aria-haspopup` ·
|
|
8
|
+
`aria-current`) reaches the inner button as `"true"`. React 19 writes a boolean `true` on a custom element as an empty
|
|
9
|
+
attribute, so `<UButton aria-expanded={open}>` gave the focused button `aria-expanded=""` — not valid ARIA, read as
|
|
10
|
+
«not expandable» once opened.
|
|
11
|
+
- `u-tooltip` · `u-popover`: a closed floating element takes no part in layout once its closing fade ends. A hidden
|
|
12
|
+
absolutely positioned box still counted toward its scroll container’s overflow, so a never-opened wide tooltip next
|
|
13
|
+
to an anchor near the right edge gave a vertical list a horizontal scrollbar. It is laid out again before it is
|
|
14
|
+
measured for opening.
|
|
15
|
+
- `u-menu-item` with a submenu is named by its own label only — the children's labels were part of its name
|
|
16
|
+
(«Theme Light Dark»). It now carries `aria-haspopup="menu"` and `aria-expanded`, and the submenu is `role="menu"`.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Console diagnostics begin with `[@iyulab/components]`, so a message in a console shared by several packages says which one wrote it (several also say what to do next).
|
|
21
|
+
|
|
22
|
+
## [2.28.0] - 2026-10-15
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- `u-option-group` — a labelled group of `u-option`s in `u-select` and the `u-input` combobox, the native `<optgroup>`.
|
|
27
|
+
The heading is not an option (no focus, no selection; the arrow keys pass from group to group), the group is
|
|
28
|
+
`role="group"` named by its `label`, and a group whose options a search filtered out is hidden, heading included.
|
|
29
|
+
Options added to a group later are picked up.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- `plugins/dts-globals`: augmentations of a bare module — `declare module 'react' { namespace JSX … }` — are resolved like
|
|
34
|
+
`declare global` blocks. The bundler copies them into every entry the same way, so a JSX props type the entry did not
|
|
35
|
+
reach was left undeclared (`TS2304` with `skipLibCheck: false`).
|
|
36
|
+
|
|
3
37
|
## [2.27.1] - 2026-10-15
|
|
4
38
|
|
|
5
39
|
### Fixed
|
package/README.md
CHANGED
|
@@ -126,7 +126,7 @@ npx skills add ./node_modules/@iyulab/components
|
|
|
126
126
|
|
|
127
127
|
**Buttons & Actions** — `u-button`, `u-button-group`, `u-icon-button`, `u-copy-button`, `u-chip`
|
|
128
128
|
|
|
129
|
-
**Form Controls** — `u-input`, `u-textarea`, `u-select`, `u-date-picker`, `u-date-range-picker`, `u-file-input`, `u-checkbox`, `u-radio`, `u-switch`, `u-slider`, `u-rating`, `u-field`, `u-form`, `u-option`
|
|
129
|
+
**Form Controls** — `u-input`, `u-textarea`, `u-select`, `u-date-picker`, `u-date-range-picker`, `u-file-input`, `u-checkbox`, `u-radio`, `u-switch`, `u-slider`, `u-rating`, `u-field`, `u-form`, `u-option`, `u-option-group`
|
|
130
130
|
|
|
131
131
|
**Overlay & Floating** — `u-dialog`, `u-drawer`, `u-popover`, `u-tooltip`
|
|
132
132
|
|
|
@@ -111,10 +111,21 @@ export declare class UFloatingElement extends UElement {
|
|
|
111
111
|
private trackSeq;
|
|
112
112
|
private showTimer?;
|
|
113
113
|
private hideTimer?;
|
|
114
|
+
/** `:state(parked)` 를 싣는다 — 닫힌 동안 레이아웃에서 빠진다(아래 `park()`). */
|
|
115
|
+
private readonly floatingInternals;
|
|
116
|
+
private parkSeq;
|
|
114
117
|
connectedCallback(): void;
|
|
115
118
|
disconnectedCallback(): void;
|
|
116
119
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
117
120
|
protected updated(changedProperties: PropertyValues): void;
|
|
121
|
+
/**
|
|
122
|
+
* 닫힌 떠 있는 요소는 레이아웃에서 빠진다(`:state(parked)` → `display: none`). `visibility: hidden` 인 절대 위치 상자도
|
|
123
|
+
* 스크롤 컨테이너의 넘침에 들어가, 한 번도 열리지 않은 툴팁(폭 수백 px)이 앵커 옆에 남아 세로 목록에 가로 스크롤바를
|
|
124
|
+
* 만들었다. 닫힘 전환이 끝난 뒤에 빼고(페이드는 그대로), 열거나 재기 전에 꺼낸다.
|
|
125
|
+
*/
|
|
126
|
+
private setParked;
|
|
127
|
+
private unpark;
|
|
128
|
+
private parkWhenSettled;
|
|
118
129
|
/** 자동 위치 추적을 끊고, 계산 중인 track() 이 뒤늦게 추적을 걸지 못하게 한다. */
|
|
119
130
|
private untrack;
|
|
120
131
|
/** 타겟 기준으로 위치를 계산하고, 스크롤·리사이즈를 따라 재배치하도록 추적을 건다. */
|
|
@@ -31,12 +31,15 @@ var UFloatingElement = class extends UElement {
|
|
|
31
31
|
this.hideDelay = 0;
|
|
32
32
|
this.cleanup = null;
|
|
33
33
|
this.trackSeq = 0;
|
|
34
|
+
this.floatingInternals = typeof this.attachInternals === "function" ? this.attachInternals() : void 0;
|
|
35
|
+
this.parkSeq = 0;
|
|
34
36
|
}
|
|
35
37
|
static {
|
|
36
38
|
this.styles = [super.styles, styles];
|
|
37
39
|
}
|
|
38
40
|
connectedCallback() {
|
|
39
41
|
super.connectedCallback();
|
|
42
|
+
if (!this.open) this.setParked(true);
|
|
40
43
|
if (!this.anchors || this.anchors.length === 0) {
|
|
41
44
|
const parent = getParentElement(this);
|
|
42
45
|
this.anchors = parent ? [parent] : [];
|
|
@@ -58,6 +61,8 @@ var UFloatingElement = class extends UElement {
|
|
|
58
61
|
updated(changedProperties) {
|
|
59
62
|
super.updated(changedProperties);
|
|
60
63
|
if (!changedProperties.has("open")) return;
|
|
64
|
+
if (this.open) this.unpark();
|
|
65
|
+
else this.parkWhenSettled();
|
|
61
66
|
if (this.open && this.cleanup === null) {
|
|
62
67
|
const target = this.targetEl ?? this.anchors?.[0];
|
|
63
68
|
if (target) this.track(target);
|
|
@@ -66,6 +71,29 @@ var UFloatingElement = class extends UElement {
|
|
|
66
71
|
this.targetEl = void 0;
|
|
67
72
|
}
|
|
68
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* 닫힌 떠 있는 요소는 레이아웃에서 빠진다(`:state(parked)` → `display: none`). `visibility: hidden` 인 절대 위치 상자도
|
|
76
|
+
* 스크롤 컨테이너의 넘침에 들어가, 한 번도 열리지 않은 툴팁(폭 수백 px)이 앵커 옆에 남아 세로 목록에 가로 스크롤바를
|
|
77
|
+
* 만들었다. 닫힘 전환이 끝난 뒤에 빼고(페이드는 그대로), 열거나 재기 전에 꺼낸다.
|
|
78
|
+
*/
|
|
79
|
+
setParked(parked) {
|
|
80
|
+
const states = this.floatingInternals?.states;
|
|
81
|
+
if (!states) return;
|
|
82
|
+
try {
|
|
83
|
+
if (parked) states.add("parked");
|
|
84
|
+
else states.delete("parked");
|
|
85
|
+
} catch {}
|
|
86
|
+
}
|
|
87
|
+
unpark() {
|
|
88
|
+
this.parkSeq++;
|
|
89
|
+
this.setParked(false);
|
|
90
|
+
}
|
|
91
|
+
async parkWhenSettled() {
|
|
92
|
+
const seq = ++this.parkSeq;
|
|
93
|
+
await Promise.all(this.getAnimations().map((a) => a.finished.catch(() => void 0)));
|
|
94
|
+
if (seq !== this.parkSeq || this.open || this.cleanup !== null || this.showTimer) return;
|
|
95
|
+
this.setParked(true);
|
|
96
|
+
}
|
|
69
97
|
/** 자동 위치 추적을 끊고, 계산 중인 track() 이 뒤늦게 추적을 걸지 못하게 한다. */
|
|
70
98
|
untrack() {
|
|
71
99
|
this.trackSeq++;
|
|
@@ -128,7 +156,10 @@ var UFloatingElement = class extends UElement {
|
|
|
128
156
|
this.untrack();
|
|
129
157
|
await this.updateComplete;
|
|
130
158
|
this.targetEl = void 0;
|
|
131
|
-
if (!this.open)
|
|
159
|
+
if (!this.open) {
|
|
160
|
+
this.parkWhenSettled();
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
132
163
|
if (this.fire("hide", {
|
|
133
164
|
bubbles: false,
|
|
134
165
|
composed: false
|
|
@@ -148,6 +179,7 @@ var UFloatingElement = class extends UElement {
|
|
|
148
179
|
* @param target - 위치 계산에 사용할 타겟 엘리먼트입니다.
|
|
149
180
|
*/
|
|
150
181
|
async reposition(target) {
|
|
182
|
+
this.unpark();
|
|
151
183
|
const targetRect = target.getBoundingClientRect();
|
|
152
184
|
this.style.setProperty("--anchor-width", `${targetRect.width}px`);
|
|
153
185
|
this.style.setProperty("--anchor-height", `${targetRect.height}px`);
|
|
@@ -21,6 +21,11 @@ var styles = css`
|
|
|
21
21
|
pointer-events: none;
|
|
22
22
|
transition: opacity var(--u-duration-normal, 220ms) var(--u-ease-standard, cubic-bezier(0.2, 0, 0, 1)), visibility 0s var(--u-duration-normal, 220ms);
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
:host(:state(parked)) {
|
|
27
|
+
display: none !important;
|
|
28
|
+
}
|
|
24
29
|
:host([open]) {
|
|
25
30
|
opacity: 1;
|
|
26
31
|
visibility: visible;
|
|
@@ -3,7 +3,7 @@ import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.154.0/hel
|
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorate.js";
|
|
4
4
|
import "../spinner/USpinner.js";
|
|
5
5
|
import { styles } from "./UButton.styles.js";
|
|
6
|
-
import { FORWARDED_ARIA } from "./forwarded-aria.js";
|
|
6
|
+
import { FORWARDED_ARIA, readForwardedAria } from "./forwarded-aria.js";
|
|
7
7
|
import { html } from "lit";
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
9
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
@@ -114,11 +114,11 @@ var UButton = class UButton extends UElement {
|
|
|
114
114
|
inner.ariaControlsElements = targets.length ? targets : null;
|
|
115
115
|
}
|
|
116
116
|
render() {
|
|
117
|
-
const ariaLabel = this
|
|
118
|
-
const pressed = this
|
|
119
|
-
const expanded = this
|
|
120
|
-
const haspopup = this
|
|
121
|
-
const current = this
|
|
117
|
+
const ariaLabel = readForwardedAria(this, "aria-label");
|
|
118
|
+
const pressed = readForwardedAria(this, "aria-pressed");
|
|
119
|
+
const expanded = readForwardedAria(this, "aria-expanded");
|
|
120
|
+
const haspopup = readForwardedAria(this, "aria-haspopup");
|
|
121
|
+
const current = readForwardedAria(this, "aria-current");
|
|
122
122
|
if (this.href) return html`
|
|
123
123
|
<a part="link"
|
|
124
124
|
aria-label=${ifDefined(ariaLabel)}
|
|
@@ -4,3 +4,9 @@
|
|
|
4
4
|
* 허용되지 않아 `<button>` 에만 싣는다. `aria-controls` 는 id 참조라 `forwardControls()` 가 따로 옮긴다.
|
|
5
5
|
*/
|
|
6
6
|
export declare const FORWARDED_ARIA: readonly ["aria-label", "aria-pressed", "aria-expanded", "aria-haspopup", "aria-controls", "aria-current"];
|
|
7
|
+
/**
|
|
8
|
+
* 옮길 값을 호스트에서 읽는다. 상태 속성의 빈 값은 `"true"` 로 읽는다 — React 19 는 커스텀 요소의
|
|
9
|
+
* 불리언 `true` 를 빈 속성으로 쓰고(내장 요소에는 `"true"`), 빈 값은 ARIA 에서 유효하지 않아
|
|
10
|
+
* 안쪽 요소에 그대로 옮기면 보조기기가 «설정 안 됨» 으로 읽는다. 이름(`aria-label`)의 빈 값은 그대로다.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readForwardedAria(host: Element, name: (typeof FORWARDED_ARIA)[number]): string | undefined;
|
|
@@ -12,5 +12,22 @@ var FORWARDED_ARIA = [
|
|
|
12
12
|
"aria-controls",
|
|
13
13
|
"aria-current"
|
|
14
14
|
];
|
|
15
|
+
/** 값이 «있다/없다» 로도 쓰이는 상태 속성 — 빈 값은 속성 존재, 곧 `true` 다. */
|
|
16
|
+
var PRESENCE_STATES = /* @__PURE__ */ new Set([
|
|
17
|
+
"aria-pressed",
|
|
18
|
+
"aria-expanded",
|
|
19
|
+
"aria-haspopup",
|
|
20
|
+
"aria-current"
|
|
21
|
+
]);
|
|
22
|
+
/**
|
|
23
|
+
* 옮길 값을 호스트에서 읽는다. 상태 속성의 빈 값은 `"true"` 로 읽는다 — React 19 는 커스텀 요소의
|
|
24
|
+
* 불리언 `true` 를 빈 속성으로 쓰고(내장 요소에는 `"true"`), 빈 값은 ARIA 에서 유효하지 않아
|
|
25
|
+
* 안쪽 요소에 그대로 옮기면 보조기기가 «설정 안 됨» 으로 읽는다. 이름(`aria-label`)의 빈 값은 그대로다.
|
|
26
|
+
*/
|
|
27
|
+
function readForwardedAria(host, name) {
|
|
28
|
+
const value = host.getAttribute(name);
|
|
29
|
+
if (value === null) return void 0;
|
|
30
|
+
return value === "" && PRESENCE_STATES.has(name) ? "true" : value;
|
|
31
|
+
}
|
|
15
32
|
//#endregion
|
|
16
|
-
export { FORWARDED_ARIA };
|
|
33
|
+
export { FORWARDED_ARIA, readForwardedAria };
|
|
@@ -40,7 +40,7 @@ var UCopyButton = class UCopyButton extends UElement {
|
|
|
40
40
|
this.copied = false;
|
|
41
41
|
}, this.delay);
|
|
42
42
|
} catch (error) {
|
|
43
|
-
console.error("
|
|
43
|
+
console.error("[@iyulab/components] u-copy-button: failed to copy text to the clipboard:", error);
|
|
44
44
|
this.copied = false;
|
|
45
45
|
}
|
|
46
46
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorate.js";
|
|
4
|
-
import { FORWARDED_ARIA } from "../button/forwarded-aria.js";
|
|
4
|
+
import { FORWARDED_ARIA, readForwardedAria } from "../button/forwarded-aria.js";
|
|
5
5
|
import "../button/UButton.js";
|
|
6
6
|
import "../icon/UIcon.js";
|
|
7
7
|
import "../tooltip/UTooltip.js";
|
|
@@ -49,11 +49,11 @@ var UIconButton = class UIconButton extends UElement {
|
|
|
49
49
|
if (FORWARDED_ARIA.includes(name)) this.requestUpdate();
|
|
50
50
|
}
|
|
51
51
|
render() {
|
|
52
|
-
const ariaLabel = this
|
|
53
|
-
const pressed = this
|
|
54
|
-
const expanded = this
|
|
55
|
-
const haspopup = this
|
|
56
|
-
const controls = this
|
|
52
|
+
const ariaLabel = readForwardedAria(this, "aria-label") ?? (this.slotText || void 0);
|
|
53
|
+
const pressed = readForwardedAria(this, "aria-pressed");
|
|
54
|
+
const expanded = readForwardedAria(this, "aria-expanded");
|
|
55
|
+
const haspopup = readForwardedAria(this, "aria-haspopup");
|
|
56
|
+
const controls = readForwardedAria(this, "aria-controls");
|
|
57
57
|
return html`
|
|
58
58
|
<u-button part="button"
|
|
59
59
|
aria-label=${ifDefined(ariaLabel)}
|
|
@@ -115,6 +115,9 @@ export declare class UInput extends UFormControlElement<string> {
|
|
|
115
115
|
/** The value as a number — `NaN` when empty or not a number (same as the native input). */
|
|
116
116
|
get valueAsNumber(): number;
|
|
117
117
|
private options;
|
|
118
|
+
/** 묶음(`u-option-group`) 안의 선택지가 바뀌어도 모은다 — 슬롯의 `slotchange` 는 직속 자식의 변화만 알린다. */
|
|
119
|
+
private readonly groupObserver;
|
|
120
|
+
connectedCallback(): void;
|
|
118
121
|
disconnectedCallback(): void;
|
|
119
122
|
render(): import('lit-html').TemplateResult<1>;
|
|
120
123
|
/** `value`가 바뀌는 모든 경로(초기 속성 설정 · 프로그램적 대입 · clear 버튼)에서
|
|
@@ -139,6 +142,8 @@ export declare class UInput extends UFormControlElement<string> {
|
|
|
139
142
|
private setup;
|
|
140
143
|
private cleanup;
|
|
141
144
|
private handleSlotChange;
|
|
145
|
+
/** 슬롯의 선택지를 모은다 — 직속 `u-option` 과 묶음 안의 것(문서 순서). */
|
|
146
|
+
private collectOptions;
|
|
142
147
|
private composing;
|
|
143
148
|
private handleCompositionStart;
|
|
144
149
|
private handleCompositionEnd;
|
|
@@ -9,7 +9,7 @@ import { parseNumber } from "../../utilities/format.js";
|
|
|
9
9
|
import "../field/UField.js";
|
|
10
10
|
import "../popover/UPopover.js";
|
|
11
11
|
import { CharsWidthController } from "../../utilities/chars.js";
|
|
12
|
-
import {
|
|
12
|
+
import { UOptionGroup, collectOptions } from "../option-group/UOptionGroup.js";
|
|
13
13
|
import { styles } from "./UInput.styles.js";
|
|
14
14
|
import { html } from "lit";
|
|
15
15
|
import { customElement, property, query, state } from "lit/decorators.js";
|
|
@@ -36,14 +36,10 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
36
36
|
this.numberText = "";
|
|
37
37
|
this.syncingFromText = false;
|
|
38
38
|
this.options = [];
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.setup(this.options);
|
|
44
|
-
if (this.options.length === 0) this.popoverEl?.hide();
|
|
45
|
-
else if (this.matches(":focus-within")) this.popoverEl?.show(this.containerEl);
|
|
46
|
-
};
|
|
39
|
+
this.groupObserver = new MutationObserver((records) => {
|
|
40
|
+
if (records.some((r) => r.target instanceof UOptionGroup)) this.collectOptions();
|
|
41
|
+
});
|
|
42
|
+
this.handleSlotChange = () => this.collectOptions();
|
|
47
43
|
this.composing = false;
|
|
48
44
|
this.handleCompositionStart = () => {
|
|
49
45
|
this.composing = true;
|
|
@@ -178,7 +174,15 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
178
174
|
if (this.type !== "number" || !this.value) return NaN;
|
|
179
175
|
return parseNumber(this.value, "en") ?? NaN;
|
|
180
176
|
}
|
|
177
|
+
connectedCallback() {
|
|
178
|
+
super.connectedCallback();
|
|
179
|
+
this.groupObserver.observe(this, {
|
|
180
|
+
childList: true,
|
|
181
|
+
subtree: true
|
|
182
|
+
});
|
|
183
|
+
}
|
|
181
184
|
disconnectedCallback() {
|
|
185
|
+
this.groupObserver.disconnect();
|
|
182
186
|
this.cleanup(this.options);
|
|
183
187
|
super.disconnectedCallback();
|
|
184
188
|
}
|
|
@@ -426,6 +430,16 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
426
430
|
option.removeEventListener("keydown", this.handleOptionKeydown);
|
|
427
431
|
}
|
|
428
432
|
}
|
|
433
|
+
/** 슬롯의 선택지를 모은다 — 직속 `u-option` 과 묶음 안의 것(문서 순서). */
|
|
434
|
+
collectOptions() {
|
|
435
|
+
const slot = this.renderRoot.querySelector("u-popover > slot:not([name])");
|
|
436
|
+
if (!slot) return;
|
|
437
|
+
this.cleanup(this.options);
|
|
438
|
+
this.options = collectOptions(slot.assignedElements({ flatten: true }));
|
|
439
|
+
this.setup(this.options);
|
|
440
|
+
if (this.options.length === 0) this.popoverEl?.hide();
|
|
441
|
+
else if (this.matches(":focus-within")) this.popoverEl?.show(this.containerEl);
|
|
442
|
+
}
|
|
429
443
|
/**
|
|
430
444
|
* 네이티브 단일 행 `<input>` 의 **암묵 제출**(HTML «implicit submission»)을 흉내 낸다 — 내부 `<input>` 은 섀도
|
|
431
445
|
* 안에 있어 바깥 `<form>` 의 폼 소유자가 아니므로, 흉내 내지 않으면 Enter 가 아무것도 하지 않는다.
|
|
@@ -38,11 +38,23 @@ export declare class UMenuItem extends UElement {
|
|
|
38
38
|
depth: number;
|
|
39
39
|
private _parentItem;
|
|
40
40
|
get parentItem(): UMenuItem | null;
|
|
41
|
+
private readonly aria;
|
|
42
|
+
/** 하위 메뉴를 가진 동안 라벨 글자가 바뀌는 것을 본다 — 이름을 라벨에서 다시 옮긴다. */
|
|
43
|
+
private labelObserver?;
|
|
41
44
|
private _childItems;
|
|
42
45
|
get childItems(): readonly UMenuItem[];
|
|
43
46
|
connectedCallback(): void;
|
|
47
|
+
disconnectedCallback(): void;
|
|
44
48
|
protected updated(changedProperties: PropertyValues): void;
|
|
45
49
|
render(): import('lit-html').TemplateResult<1>;
|
|
50
|
+
/**
|
|
51
|
+
* 하위 메뉴를 가진 항목의 이름은 자기 라벨뿐이다. 역할이 호스트에 있고 하위 항목은 호스트의 자식이라, 내용에서 짓는
|
|
52
|
+
* 이름이 하위 항목의 글자까지 모은다(«테마 라이트 다크 …»). 라벨(기본 슬롯)의 글자를 이름으로 옮기고, 하위 메뉴가 있음과
|
|
53
|
+
* 열림을 알린다(WAI-ARIA 메뉴 패턴). 작성자가 단 `aria-*` 는 건드리지 않는다(`HostAria`). 잎 항목은 내용이 곧 이름이다.
|
|
54
|
+
*/
|
|
55
|
+
private syncSubmenuAria;
|
|
56
|
+
/** 기본 슬롯(라벨)에 든 글자 — 하위 항목(`slot="children"`)과 앞뒤 슬롯은 빠진다. */
|
|
57
|
+
private labelText;
|
|
46
58
|
private propagate;
|
|
47
59
|
private handleHeaderClick;
|
|
48
60
|
private handleSlotChange;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorate.js";
|
|
4
|
+
import { HostAria } from "../../utilities/hostAria.js";
|
|
4
5
|
import "../icon/UIcon.js";
|
|
5
6
|
import "../popover/UPopover.js";
|
|
6
7
|
import { UDivider } from "../divider/UDivider.js";
|
|
@@ -27,6 +28,7 @@ var UMenuItem = class UMenuItem extends UElement {
|
|
|
27
28
|
this.leaf = true;
|
|
28
29
|
this.depth = 0;
|
|
29
30
|
this._parentItem = null;
|
|
31
|
+
this.aria = new HostAria(this);
|
|
30
32
|
this._childItems = [];
|
|
31
33
|
this.handleHeaderClick = (e) => {
|
|
32
34
|
if (isFromNestedControl(e, this)) return;
|
|
@@ -47,6 +49,7 @@ var UMenuItem = class UMenuItem extends UElement {
|
|
|
47
49
|
this.handleSlotChange = (e) => {
|
|
48
50
|
const elements = e.target.assignedElements({ flatten: true });
|
|
49
51
|
for (const el of elements) if ((el instanceof _UMenuItem || el instanceof UDivider) && !el.hasAttribute("slot")) el.setAttribute("slot", "children");
|
|
52
|
+
if (!this.leaf) this.syncSubmenuAria();
|
|
50
53
|
};
|
|
51
54
|
this.handleChildrenSlotChange = (e) => {
|
|
52
55
|
const slot = e.target;
|
|
@@ -74,8 +77,14 @@ var UMenuItem = class UMenuItem extends UElement {
|
|
|
74
77
|
if (!this.hasAttribute("slot")) this.setAttribute("slot", "children");
|
|
75
78
|
}
|
|
76
79
|
}
|
|
80
|
+
disconnectedCallback() {
|
|
81
|
+
this.labelObserver?.disconnect();
|
|
82
|
+
this.labelObserver = void 0;
|
|
83
|
+
super.disconnectedCallback();
|
|
84
|
+
}
|
|
77
85
|
updated(changedProperties) {
|
|
78
86
|
super.updated(changedProperties);
|
|
87
|
+
if (changedProperties.has("leaf") || changedProperties.has("expanded")) this.syncSubmenuAria();
|
|
79
88
|
if (changedProperties.has("disabled")) {
|
|
80
89
|
this.setAttribute("tabindex", this.disabled ? "-1" : "0");
|
|
81
90
|
if (this.disabled) this.setAttribute("aria-disabled", "true");
|
|
@@ -114,13 +123,13 @@ var UMenuItem = class UMenuItem extends UElement {
|
|
|
114
123
|
</div>
|
|
115
124
|
|
|
116
125
|
${this.inline ? html`
|
|
117
|
-
<div class="submenu" part="submenu"
|
|
126
|
+
<div class="submenu" part="submenu" role="menu"
|
|
118
127
|
?hidden=${this.leaf}
|
|
119
128
|
?open=${this.expanded}
|
|
120
129
|
>
|
|
121
130
|
<slot name="children" @slotchange=${this.handleChildrenSlotChange}></slot>
|
|
122
131
|
</div>` : html`
|
|
123
|
-
<u-popover class="popover" part="popover"
|
|
132
|
+
<u-popover class="popover" part="popover" role="menu"
|
|
124
133
|
?hidden=${this.leaf}
|
|
125
134
|
?open=${live(this.expanded)}
|
|
126
135
|
for=".header"
|
|
@@ -133,6 +142,33 @@ var UMenuItem = class UMenuItem extends UElement {
|
|
|
133
142
|
</u-popover>`}
|
|
134
143
|
`;
|
|
135
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* 하위 메뉴를 가진 항목의 이름은 자기 라벨뿐이다. 역할이 호스트에 있고 하위 항목은 호스트의 자식이라, 내용에서 짓는
|
|
147
|
+
* 이름이 하위 항목의 글자까지 모은다(«테마 라이트 다크 …»). 라벨(기본 슬롯)의 글자를 이름으로 옮기고, 하위 메뉴가 있음과
|
|
148
|
+
* 열림을 알린다(WAI-ARIA 메뉴 패턴). 작성자가 단 `aria-*` 는 건드리지 않는다(`HostAria`). 잎 항목은 내용이 곧 이름이다.
|
|
149
|
+
*/
|
|
150
|
+
syncSubmenuAria() {
|
|
151
|
+
const parent = !this.leaf;
|
|
152
|
+
this.aria.set("aria-label", parent ? this.labelText() || null : null);
|
|
153
|
+
this.aria.set("aria-haspopup", parent ? "menu" : null);
|
|
154
|
+
this.aria.set("aria-expanded", parent ? String(this.expanded) : null);
|
|
155
|
+
if (parent && !this.labelObserver) {
|
|
156
|
+
this.labelObserver = new MutationObserver(() => this.aria.set("aria-label", this.labelText() || null));
|
|
157
|
+
this.labelObserver.observe(this, {
|
|
158
|
+
childList: true,
|
|
159
|
+
characterData: true,
|
|
160
|
+
subtree: true
|
|
161
|
+
});
|
|
162
|
+
} else if (!parent && this.labelObserver) {
|
|
163
|
+
this.labelObserver.disconnect();
|
|
164
|
+
this.labelObserver = void 0;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/** 기본 슬롯(라벨)에 든 글자 — 하위 항목(`slot="children"`)과 앞뒤 슬롯은 빠진다. */
|
|
168
|
+
labelText() {
|
|
169
|
+
const slot = this.shadowRoot?.querySelector(".content slot");
|
|
170
|
+
return (slot ? slot.assignedNodes({ flatten: true }) : []).map((n) => n.textContent ?? "").join("").replace(/s+/g, " ").trim();
|
|
171
|
+
}
|
|
136
172
|
propagate() {
|
|
137
173
|
this._childItems.forEach((child) => {
|
|
138
174
|
child.inline = this.inline;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { UElement } from '../UElement.js';
|
|
2
|
+
import { UOption } from '../option/UOption.js';
|
|
3
|
+
/**
|
|
4
|
+
* A labelled group of `u-option`s inside a `u-select` or a `u-input` combobox — the native `<optgroup>`.
|
|
5
|
+
*
|
|
6
|
+
* The heading is not an option: it takes no focus, cannot be selected, and keyboard movement goes from the last option
|
|
7
|
+
* of one group to the first of the next. For assistive technology the group is `role="group"` named by `label`, the
|
|
8
|
+
* listbox pattern's grouping. While none of its options is visible — a search filtered them all out, or it has none —
|
|
9
|
+
* the whole group, heading included, is hidden (`:state(empty)`).
|
|
10
|
+
*
|
|
11
|
+
* @slot - `u-option` items
|
|
12
|
+
*
|
|
13
|
+
* @csspart label - The heading
|
|
14
|
+
* @csspart options - The box around the options
|
|
15
|
+
*/
|
|
16
|
+
export declare class UOptionGroup extends UElement {
|
|
17
|
+
static styles: import('lit').CSSResultGroup[];
|
|
18
|
+
/** The heading, and the group's accessible name. */
|
|
19
|
+
label: string;
|
|
20
|
+
private readonly aria;
|
|
21
|
+
private readonly internals;
|
|
22
|
+
/** Watches the options: added or removed, hidden or shown by a search. */
|
|
23
|
+
private readonly observer;
|
|
24
|
+
/**
|
|
25
|
+
* The group's options, in order. Matched by tag, not class: a group parsed together with its options is connected
|
|
26
|
+
* before they are upgraded, and the `instanceof` test then saw none — the group hid itself as empty.
|
|
27
|
+
*/
|
|
28
|
+
get options(): UOption[];
|
|
29
|
+
connectedCallback(): void;
|
|
30
|
+
disconnectedCallback(): void;
|
|
31
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
32
|
+
private syncEmpty;
|
|
33
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
34
|
+
}
|
|
35
|
+
declare global {
|
|
36
|
+
interface HTMLElementTagNameMap {
|
|
37
|
+
'u-option-group': UOptionGroup;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The options among a listbox's slotted elements, in order — the elements themselves and the options inside groups.
|
|
42
|
+
* `u-select` and the `u-input` combobox collect through this, so a group is transparent to their keyboard, filter and
|
|
43
|
+
* selection.
|
|
44
|
+
*/
|
|
45
|
+
export declare function collectOptions(elements: Element[]): UOption[];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { UElement } from "../UElement.js";
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorate.js";
|
|
4
|
+
import { HostAria } from "../../utilities/hostAria.js";
|
|
5
|
+
import { UOption } from "../option/UOption.js";
|
|
6
|
+
import { styles } from "./UOptionGroup.styles.js";
|
|
7
|
+
import { html } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
//#region src/components/option-group/UOptionGroup.ts
|
|
10
|
+
var UOptionGroup = class UOptionGroup extends UElement {
|
|
11
|
+
constructor(..._args) {
|
|
12
|
+
super(..._args);
|
|
13
|
+
this.label = "";
|
|
14
|
+
this.aria = new HostAria(this);
|
|
15
|
+
this.internals = this.attachInternals();
|
|
16
|
+
this.observer = new MutationObserver(() => this.syncEmpty());
|
|
17
|
+
}
|
|
18
|
+
static {
|
|
19
|
+
this.styles = [super.styles, styles];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The group's options, in order. Matched by tag, not class: a group parsed together with its options is connected
|
|
23
|
+
* before they are upgraded, and the `instanceof` test then saw none — the group hid itself as empty.
|
|
24
|
+
*/
|
|
25
|
+
get options() {
|
|
26
|
+
return [...this.children].filter((el) => el.localName === "u-option");
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback();
|
|
30
|
+
this.aria.set("role", "group");
|
|
31
|
+
this.observer.observe(this, {
|
|
32
|
+
childList: true,
|
|
33
|
+
subtree: true,
|
|
34
|
+
attributes: true,
|
|
35
|
+
attributeFilter: ["hidden"]
|
|
36
|
+
});
|
|
37
|
+
this.syncEmpty();
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
this.observer.disconnect();
|
|
41
|
+
super.disconnectedCallback();
|
|
42
|
+
}
|
|
43
|
+
updated(changed) {
|
|
44
|
+
super.updated(changed);
|
|
45
|
+
if (changed.has("label")) this.aria.set("aria-label", this.label || null);
|
|
46
|
+
}
|
|
47
|
+
syncEmpty() {
|
|
48
|
+
if (!this.options.some((option) => !option.hidden)) this.internals.states.add("empty");
|
|
49
|
+
else this.internals.states.delete("empty");
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
return html`
|
|
53
|
+
<div class="label" part="label" aria-hidden="true">${this.label}</div>
|
|
54
|
+
<div class="options" part="options"><slot></slot></div>
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UOptionGroup.prototype, "label", void 0);
|
|
59
|
+
UOptionGroup = __decorate([customElement("u-option-group")], UOptionGroup);
|
|
60
|
+
/**
|
|
61
|
+
* The options among a listbox's slotted elements, in order — the elements themselves and the options inside groups.
|
|
62
|
+
* `u-select` and the `u-input` combobox collect through this, so a group is transparent to their keyboard, filter and
|
|
63
|
+
* selection.
|
|
64
|
+
*/
|
|
65
|
+
function collectOptions(elements) {
|
|
66
|
+
return elements.flatMap((el) => el instanceof UOption ? [el] : el instanceof UOptionGroup ? el.options.filter((o) => o instanceof UOption) : []);
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { UOptionGroup, collectOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
//#region src/components/option-group/UOptionGroup.styles.ts
|
|
3
|
+
var styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
:host(:state(empty)) {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
.label {
|
|
15
|
+
padding: 0.5em 0.5em 0.25em;
|
|
16
|
+
font-size: var(--u-text-overline-size, 11px);
|
|
17
|
+
font-weight: var(--u-text-overline-weight, 700);
|
|
18
|
+
line-height: var(--u-text-overline-leading, 1.45);
|
|
19
|
+
letter-spacing: var(--u-text-overline-tracking, 0.06em);
|
|
20
|
+
color: var(--u-txt-color-weak, #616161);
|
|
21
|
+
cursor: default;
|
|
22
|
+
user-select: none;
|
|
23
|
+
}
|
|
24
|
+
.label:empty {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.options {
|
|
29
|
+
display: contents;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { styles };
|
|
@@ -104,6 +104,9 @@ export declare class USelect extends UFormControlElement<string | string[]> {
|
|
|
104
104
|
private get valueAsString();
|
|
105
105
|
private get valueAsArray();
|
|
106
106
|
private get hasValue();
|
|
107
|
+
/** 묶음(`u-option-group`) 안의 선택지가 바뀌어도 모은다 — 슬롯의 `slotchange` 는 직속 자식의 변화만 알린다. */
|
|
108
|
+
private readonly groupObserver;
|
|
109
|
+
connectedCallback(): void;
|
|
107
110
|
disconnectedCallback(): void;
|
|
108
111
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
109
112
|
protected updated(changedProperties: PropertyValues): void;
|
|
@@ -125,6 +128,8 @@ export declare class USelect extends UFormControlElement<string | string[]> {
|
|
|
125
128
|
* updated() 경로는 base의 silent setValidity()만 수행해 Lit 중복 업데이트를 피한다). */
|
|
126
129
|
private emitChange;
|
|
127
130
|
private handleSlotChange;
|
|
131
|
+
/** 슬롯의 선택지를 모은다 — 직속 `u-option` 과 묶음 안의 것(문서 순서). */
|
|
132
|
+
private collectOptions;
|
|
128
133
|
/**
|
|
129
134
|
* 목록이 닫힐 때 포커스가 그 «안»(옵션·검색 입력)에 있었으면 콤보박스로 되돌린다.
|
|
130
135
|
*
|
|
@@ -9,7 +9,7 @@ import "../chip/UChip.js";
|
|
|
9
9
|
import "../field/UField.js";
|
|
10
10
|
import "../popover/UPopover.js";
|
|
11
11
|
import { CharsWidthController } from "../../utilities/chars.js";
|
|
12
|
-
import {
|
|
12
|
+
import { UOptionGroup, collectOptions } from "../option-group/UOptionGroup.js";
|
|
13
13
|
import { CompositionTracker } from "../../utilities/composition.js";
|
|
14
14
|
import { styles } from "./USelect.styles.js";
|
|
15
15
|
import { html } from "lit";
|
|
@@ -39,13 +39,10 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
39
39
|
this.idBase = `u-select-${Math.random().toString(36).slice(2, 8)}`;
|
|
40
40
|
this.listboxId = `${this.idBase}-listbox`;
|
|
41
41
|
this.popupId = `${this.idBase}-popup`;
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this.setup(this.options);
|
|
47
|
-
this.applyFilter();
|
|
48
|
-
};
|
|
42
|
+
this.groupObserver = new MutationObserver((records) => {
|
|
43
|
+
if (records.some((r) => r.target instanceof UOptionGroup)) this.collectOptions();
|
|
44
|
+
});
|
|
45
|
+
this.handleSlotChange = () => this.collectOptions();
|
|
49
46
|
this.handlePopoverHide = () => {
|
|
50
47
|
this.open = false;
|
|
51
48
|
this.setActiveOption(void 0);
|
|
@@ -165,7 +162,15 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
165
162
|
get hasValue() {
|
|
166
163
|
return this.multiple ? this.valueAsArray.length > 0 : !!this.value;
|
|
167
164
|
}
|
|
165
|
+
connectedCallback() {
|
|
166
|
+
super.connectedCallback();
|
|
167
|
+
this.groupObserver.observe(this, {
|
|
168
|
+
childList: true,
|
|
169
|
+
subtree: true
|
|
170
|
+
});
|
|
171
|
+
}
|
|
168
172
|
disconnectedCallback() {
|
|
173
|
+
this.groupObserver.disconnect();
|
|
169
174
|
this.cleanup(this.options);
|
|
170
175
|
super.disconnectedCallback();
|
|
171
176
|
}
|
|
@@ -356,6 +361,15 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
356
361
|
composed: true
|
|
357
362
|
}));
|
|
358
363
|
}
|
|
364
|
+
/** 슬롯의 선택지를 모은다 — 직속 `u-option` 과 묶음 안의 것(문서 순서). */
|
|
365
|
+
collectOptions() {
|
|
366
|
+
const slot = this.renderRoot.querySelector(".listbox slot");
|
|
367
|
+
if (!slot) return;
|
|
368
|
+
this.cleanup(this.options);
|
|
369
|
+
this.options = collectOptions(slot.assignedElements({ flatten: true }));
|
|
370
|
+
this.setup(this.options);
|
|
371
|
+
this.applyFilter();
|
|
372
|
+
}
|
|
359
373
|
updateSearch(input) {
|
|
360
374
|
const { query, composing } = this.composition.searchQuery(input);
|
|
361
375
|
this.query = query.trim();
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * from './components/input/UInput.js';
|
|
|
29
29
|
export * from './components/menu/UMenu.js';
|
|
30
30
|
export * from './components/menu-item/UMenuItem.js';
|
|
31
31
|
export * from './components/option/UOption.js';
|
|
32
|
+
export * from './components/option-group/UOptionGroup.js';
|
|
32
33
|
export * from './components/pagination/UPagination.js';
|
|
33
34
|
export * from './components/panel/UPanel.js';
|
|
34
35
|
export * from './components/popover/UPopover.js';
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ import { UExpander } from "./components/expander/UExpander.js";
|
|
|
40
40
|
import { UFileInput } from "./components/file-input/UFileInput.js";
|
|
41
41
|
import { UForm } from "./components/form/UForm.js";
|
|
42
42
|
import { UOption } from "./components/option/UOption.js";
|
|
43
|
+
import { UOptionGroup, collectOptions } from "./components/option-group/UOptionGroup.js";
|
|
43
44
|
import { UInput } from "./components/input/UInput.js";
|
|
44
45
|
import { UMenuItem } from "./components/menu-item/UMenuItem.js";
|
|
45
46
|
import { UMenu } from "./components/menu/UMenu.js";
|
|
@@ -69,4 +70,4 @@ import { Dialog } from "./utilities/Dialog.js";
|
|
|
69
70
|
import { Theme } from "./utilities/Theme.js";
|
|
70
71
|
import { Toast } from "./utilities/Toast.js";
|
|
71
72
|
import { decodeDelimited, decodeTsv, encodeTsv } from "./utilities/tsv.js";
|
|
72
|
-
export { ALERT_STATUSES, BrowserStorage, CompositionTracker, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCopyButton, UDatePicker, UDateRangePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOverlayElement, UPagination, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USteps, USwitch, UTab, UTabNav, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, arrayAttrConverter, booleanAttrConverter, copyFromKey, createDevWarner, dateAttrConverter, dateTextPattern, decodeDelimited, decodeTsv, defaultSearchMatch, devWarnOnce, encodeTsv, foldForSearch, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeRangeText, formatDateTimeText, formatNumber, getDefaultBaseUrl, getParentElement, hangulKeystrokes, initialsOf, isCoarsePointer, isFocusCandidate, isFromControl, isHangul, isImeComposing, isTextEntry, jsonAttrConverter, localOffset, parseDate, parseDateRange, parseDateTime, parseDateTimeRange, parseNumber, pasteFromKey, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, readDateValue, replayInput, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter, writeInstant, writePlainDate, writePlainDateTime };
|
|
73
|
+
export { ALERT_STATUSES, BrowserStorage, CompositionTracker, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCopyButton, UDatePicker, UDateRangePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOptionGroup, UOverlayElement, UPagination, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USteps, USwitch, UTab, UTabNav, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, arrayAttrConverter, booleanAttrConverter, collectOptions, copyFromKey, createDevWarner, dateAttrConverter, dateTextPattern, decodeDelimited, decodeTsv, defaultSearchMatch, devWarnOnce, encodeTsv, foldForSearch, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeRangeText, formatDateTimeText, formatNumber, getDefaultBaseUrl, getParentElement, hangulKeystrokes, initialsOf, isCoarsePointer, isFocusCandidate, isFromControl, isHangul, isImeComposing, isTextEntry, jsonAttrConverter, localOffset, parseDate, parseDateRange, parseDateTime, parseDateTimeRange, parseNumber, pasteFromKey, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, readDateValue, replayInput, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter, writeInstant, writePlainDate, writePlainDateTime };
|
|
@@ -50,8 +50,9 @@ export declare function localTypeNames(source: string): Set<string>;
|
|
|
50
50
|
*/
|
|
51
51
|
export declare function libGlobalNames(packageRoot: string): Set<string>;
|
|
52
52
|
/**
|
|
53
|
-
* Rewrites the dangling names inside each top-level `declare global { … }` block
|
|
54
|
-
*
|
|
53
|
+
* Rewrites the dangling names inside each top-level `declare global { … }` block — and each
|
|
54
|
+
* augmentation of a bare module specifier, `declare module 'react' { … }` — of one declaration file
|
|
55
|
+
* (see `fixPublishedDtsGlobals`). Everything outside those blocks is untouched.
|
|
55
56
|
*/
|
|
56
57
|
export declare function resolveDanglingGlobals(source: string, exportedFrom: Map<string, string>, globals?: Set<string>): string;
|
|
57
58
|
export {};
|
|
@@ -134,8 +134,9 @@ export function libGlobalNames(packageRoot) {
|
|
|
134
134
|
return names;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
|
-
* Rewrites the dangling names inside each top-level `declare global { … }` block
|
|
138
|
-
*
|
|
137
|
+
* Rewrites the dangling names inside each top-level `declare global { … }` block — and each
|
|
138
|
+
* augmentation of a bare module specifier, `declare module 'react' { … }` — of one declaration file
|
|
139
|
+
* (see `fixPublishedDtsGlobals`). Everything outside those blocks is untouched.
|
|
139
140
|
*/
|
|
140
141
|
export function resolveDanglingGlobals(source, exportedFrom, globals = new Set()) {
|
|
141
142
|
const local = localTypeNames(source);
|
|
@@ -154,7 +155,9 @@ export function resolveDanglingGlobals(source, exportedFrom, globals = new Set()
|
|
|
154
155
|
local.add(name);
|
|
155
156
|
let out = '';
|
|
156
157
|
let cursor = 0;
|
|
157
|
-
|
|
158
|
+
// A module augmentation (`declare module 'react' { namespace JSX … }`) is copied the same way and
|
|
159
|
+
// dangles the same way. Only bare specifiers: an entry file is a module, so these are augmentations.
|
|
160
|
+
const marker = /declare\s+(?:global|module\s+(['"])[^'"./][^'"]*\1)\s*\{/g;
|
|
158
161
|
for (let m = marker.exec(source); m; m = marker.exec(source)) {
|
|
159
162
|
const open = m.index + m[0].length - 1;
|
|
160
163
|
const close = matchingBrace(source, open);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UOptionGroup as UOptionGroupElement } from '@iyulab/components/dist/components/option-group/UOptionGroup.js';
|
|
3
|
+
|
|
4
|
+
type UOptionGroupOwnProps = Omit<UOptionGroupElement, keyof HTMLElement>;
|
|
5
|
+
|
|
6
|
+
export declare const UOptionGroup: React.ForwardRefExoticComponent<
|
|
7
|
+
Partial<Omit<UOptionGroupElement, Exclude<keyof React.HTMLAttributes<UOptionGroupElement>, keyof UOptionGroupOwnProps>>>
|
|
8
|
+
& Omit<React.HTMLAttributes<UOptionGroupElement>, keyof UOptionGroupOwnProps | never>
|
|
9
|
+
& React.RefAttributes<UOptionGroupElement>
|
|
10
|
+
& {
|
|
11
|
+
}
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
export type UOptionGroupProps = React.ComponentProps<typeof UOptionGroup>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createComponent } from '@lit/react';
|
|
3
|
+
import { UOptionGroup as UOptionGroupElement } from '@iyulab/components/dist/components/option-group/UOptionGroup.js';
|
|
4
|
+
|
|
5
|
+
export const UOptionGroup = createComponent({
|
|
6
|
+
react: React,
|
|
7
|
+
tagName: 'u-option-group',
|
|
8
|
+
elementClass: UOptionGroupElement,
|
|
9
|
+
events: {},
|
|
10
|
+
});
|
package/dist/react/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { UProgressBar, UProgressBarProps } from './UProgressBar';
|
|
|
21
21
|
export { UPopover, UPopoverProps } from './UPopover';
|
|
22
22
|
export { UPanel, UPanelProps } from './UPanel';
|
|
23
23
|
export { UPagination, UPaginationProps } from './UPagination';
|
|
24
|
+
export { UOptionGroup, UOptionGroupProps } from './UOptionGroup';
|
|
24
25
|
export { UOption, UOptionProps } from './UOption';
|
|
25
26
|
export { UMenuItem, UMenuItemProps } from './UMenuItem';
|
|
26
27
|
export { UMenu, UMenuProps } from './UMenu';
|
package/dist/react/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { UProgressBar } from './UProgressBar.js';
|
|
|
21
21
|
export { UPopover } from './UPopover.js';
|
|
22
22
|
export { UPanel } from './UPanel.js';
|
|
23
23
|
export { UPagination } from './UPagination.js';
|
|
24
|
+
export { UOptionGroup } from './UOptionGroup.js';
|
|
24
25
|
export { UOption } from './UOption.js';
|
|
25
26
|
export { UMenuItem } from './UMenuItem.js';
|
|
26
27
|
export { UMenu } from './UMenu.js';
|
|
@@ -32,7 +32,7 @@ var BrowserStorage = class {
|
|
|
32
32
|
});
|
|
33
33
|
else throw new Error(`Unsupported storage type: "${this.options.type}" (expected "localStorage" or "cookie")`);
|
|
34
34
|
} catch (e) {
|
|
35
|
-
console.error("[BrowserStorage
|
|
35
|
+
console.error("[@iyulab/components] BrowserStorage: set failed:", e);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -47,7 +47,7 @@ var BrowserStorage = class {
|
|
|
47
47
|
else if (this.options.type === "cookie") return (await window.cookieStore.get({ name: key }))?.value || null;
|
|
48
48
|
else throw new Error(`Unsupported storage type: "${this.options.type}" (expected "localStorage" or "cookie")`);
|
|
49
49
|
} catch (e) {
|
|
50
|
-
console.error("[BrowserStorage
|
|
50
|
+
console.error("[@iyulab/components] BrowserStorage: get failed:", e);
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -62,7 +62,7 @@ var BrowserStorage = class {
|
|
|
62
62
|
else if (this.options.type === "cookie") await window.cookieStore.delete({ name: key });
|
|
63
63
|
else throw new Error(`Unsupported storage type: "${this.options.type}" (expected "localStorage" or "cookie")`);
|
|
64
64
|
} catch (e) {
|
|
65
|
-
console.error("[BrowserStorage
|
|
65
|
+
console.error("[@iyulab/components] BrowserStorage: remove failed:", e);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
};
|
package/dist/utilities/Dialog.js
CHANGED
|
@@ -157,7 +157,7 @@ var Dialog = class {
|
|
|
157
157
|
try {
|
|
158
158
|
await dialog.updateComplete;
|
|
159
159
|
} catch (error) {
|
|
160
|
-
console.error("[
|
|
160
|
+
console.error("[@iyulab/components] Dialog: failed to show the dialog.", error);
|
|
161
161
|
dialog.remove();
|
|
162
162
|
return null;
|
|
163
163
|
}
|
package/dist/utilities/Theme.js
CHANGED
|
@@ -243,7 +243,7 @@ var Theme = class {
|
|
|
243
243
|
}
|
|
244
244
|
/** 디버그 모드시 로그 출력 함수 (인스턴스 스코프) */
|
|
245
245
|
static log(...args) {
|
|
246
|
-
if (this._isDebugMode) console.log("[
|
|
246
|
+
if (this._isDebugMode) console.log("[@iyulab/components] Theme:", ...args);
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
249
|
//#endregion
|
|
@@ -33,7 +33,7 @@ function jsonAttrConverter(parser = JSON.parse) {
|
|
|
33
33
|
try {
|
|
34
34
|
return parser(value);
|
|
35
35
|
} catch {
|
|
36
|
-
console.warn(`
|
|
36
|
+
console.warn(`[@iyulab/components] failed to parse a JSON attribute — pass valid JSON, or set the property instead: ${value}`);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
},
|
|
@@ -42,7 +42,7 @@ function jsonAttrConverter(parser = JSON.parse) {
|
|
|
42
42
|
try {
|
|
43
43
|
return JSON.stringify(value);
|
|
44
44
|
} catch {
|
|
45
|
-
console.warn(`
|
|
45
|
+
console.warn(`[@iyulab/components] failed to write a property back as a JSON attribute:`, value);
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -98,7 +98,7 @@ function urlAttrConverter(parser = (value) => new URL(value)) {
|
|
|
98
98
|
try {
|
|
99
99
|
return parser(value);
|
|
100
100
|
} catch {
|
|
101
|
-
console.warn(`
|
|
101
|
+
console.warn(`[@iyulab/components] failed to parse a URL attribute — pass an absolute URL or one relative to the page: ${value}`);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
},
|
package/dist/utilities/icons.js
CHANGED
|
@@ -213,7 +213,7 @@ var IconRegistry = class {
|
|
|
213
213
|
if ((this.generation.get(lib) ?? 0) === generation) IconCache.set(lib, name, svg);
|
|
214
214
|
return svg;
|
|
215
215
|
} catch (error) {
|
|
216
|
-
console.error(`[
|
|
216
|
+
console.error(`[@iyulab/components] IconRegistry: Failed to resolve icon '${key}' (will retry):`, error);
|
|
217
217
|
return;
|
|
218
218
|
}
|
|
219
219
|
})();
|
package/package.json
CHANGED
|
@@ -78,6 +78,7 @@ import { UButton, UInput } from '@iyulab/components/react';
|
|
|
78
78
|
- [`u-field`](./references/components/field.md) — Layout wrapper providing label, description, and validation message
|
|
79
79
|
- [`u-form`](./references/components/form.md) — Form group with two-way model binding and validation
|
|
80
80
|
- [`u-option`](./references/components/option.md) — Selectable option item for `u-select`, `u-radio`, `u-input`
|
|
81
|
+
- [`u-option-group`](./references/components/option-group.md) — Labelled group of `u-option`s in `u-select` / `u-input` (the native `<optgroup>`)
|
|
81
82
|
|
|
82
83
|
**`disabled` is exposed where assistive technology and test tools look for it** — on the node that
|
|
83
84
|
carries the control's role, not on the host element. Native nodes use native `disabled`
|
|
@@ -73,6 +73,8 @@ inner `<button>`/`<a>` that actually takes focus: `aria-label`, and the button s
|
|
|
73
73
|
(menu button) and `aria-current` (the current page, step or item). `aria-pressed` is dropped on a link (`href`), where it is not allowed.
|
|
74
74
|
`aria-controls` is an id reference, which cannot cross the shadow boundary, so it is carried as an
|
|
75
75
|
element reference (`ariaControlsElements`) resolved when the button renders.
|
|
76
|
+
An empty state attribute counts as `"true"` — React 19 writes a boolean `true` on a custom element
|
|
77
|
+
as an empty attribute (`<UButton aria-expanded={open}>`), and an empty value is not valid ARIA.
|
|
76
78
|
|
|
77
79
|
```html
|
|
78
80
|
<u-button aria-expanded="false" aria-controls="details">Details</u-button>
|
|
@@ -93,6 +93,12 @@ activate the menu item, and the menu item's arrow-key navigation applies only wh
|
|
|
93
93
|
| `indicator` | `'highlight'\|'check'` | `'highlight'` | ✓ | Selection indicator |
|
|
94
94
|
| `align` | `'left'\|'center'\|'right'` | `'left'` | ✓ | Text alignment |
|
|
95
95
|
|
|
96
|
+
### Accessibility
|
|
97
|
+
|
|
98
|
+
An item with a submenu is named by its own label (the default slot) — not by its children's labels — and
|
|
99
|
+
carries `aria-haspopup="menu"` and `aria-expanded`; the submenu is a `role="menu"`. An `aria-label` you set on
|
|
100
|
+
the item wins.
|
|
101
|
+
|
|
96
102
|
### Events
|
|
97
103
|
|
|
98
104
|
| Event | Description |
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# u-option-group
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import '@iyulab/components/dist/components/option-group/UOptionGroup.js';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
**Tag:** `u-option-group`
|
|
8
|
+
|
|
9
|
+
A labelled group of `u-option`s inside `u-select` or a `u-input` combobox — the native `<optgroup>`. Use it when one
|
|
10
|
+
list mixes kinds (regions and zones, projects and monitors) instead of repeating the kind inside every label.
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<u-select label="Context" searchable>
|
|
14
|
+
<u-option value="all">Everything</u-option>
|
|
15
|
+
<u-option-group label="Workspaces">
|
|
16
|
+
<u-option value="w-north">North plant</u-option>
|
|
17
|
+
<u-option value="w-south">South plant</u-option>
|
|
18
|
+
</u-option-group>
|
|
19
|
+
<u-option-group label="Monitors">
|
|
20
|
+
<u-option value="m-press">Press line</u-option>
|
|
21
|
+
</u-option-group>
|
|
22
|
+
</u-select>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- The heading is not an option — it takes no focus, cannot be selected, and the arrow keys go from the last option of
|
|
26
|
+
one group to the first of the next.
|
|
27
|
+
- For assistive technology the group is `role="group"` named by `label` (the listbox pattern's grouping); the heading
|
|
28
|
+
itself is not read a second time.
|
|
29
|
+
- While none of its options is visible — a `searchable` select's local filter hid them all, or it has none — the whole
|
|
30
|
+
group, heading included, is hidden (`:state(empty)`). The heading takes no part in the search.
|
|
31
|
+
- Options added to or removed from a group later are picked up by the owning select or input.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Properties
|
|
36
|
+
|
|
37
|
+
| Property | Type | Default | Reflect | Description |
|
|
38
|
+
|----------|------|---------|---------|-------------|
|
|
39
|
+
| `label` | `string` | `''` | — | The heading, and the group's accessible name |
|
|
40
|
+
|
|
41
|
+
## Slots
|
|
42
|
+
|
|
43
|
+
| Slot | Description |
|
|
44
|
+
|------|-------------|
|
|
45
|
+
| (default) | `u-option` items |
|
|
46
|
+
|
|
47
|
+
## CSS Parts
|
|
48
|
+
|
|
49
|
+
| Part | Description |
|
|
50
|
+
|------|-------------|
|
|
51
|
+
| `label` | The heading |
|
|
52
|
+
| `options` | The box around the options |
|
|
53
|
+
|
|
54
|
+
## CSS Custom Properties
|
|
55
|
+
|
|
56
|
+
None of its own — the heading uses the overline type tokens (`--u-text-overline-*`) and `--u-txt-color-weak`.
|
|
@@ -24,6 +24,8 @@ Dropdown select with single or multiple selection, search, and clear support. Fo
|
|
|
24
24
|
</u-select>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
Options of different kinds can be grouped under headings with [`u-option-group`](./option-group.md) — the native `<optgroup>`; a group whose options a search filtered out is hidden.
|
|
28
|
+
|
|
27
29
|
---
|
|
28
30
|
|
|
29
31
|
## Slots
|