@iyulab/components 2.4.0 → 2.6.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 +41 -0
- 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/alert/UAlert.js +1 -1
- package/dist/components/breadcrumb/UBreadcrumb.js +1 -1
- package/dist/components/carousel/UCarousel.js +1 -1
- package/dist/components/checkbox/UCheckbox.js +1 -1
- package/dist/components/chip/UChip.js +1 -1
- package/dist/components/copy-button/UCopyButton.js +1 -1
- package/dist/components/date-picker/UDatePicker.js +1 -1
- package/dist/components/date-range-picker/UDateRangePicker.js +1 -1
- package/dist/components/dialog/UDialog.js +1 -1
- package/dist/components/drawer/UDrawer.js +1 -1
- package/dist/components/file-input/UFileInput.js +1 -1
- package/dist/components/icon-button/UIconButton.d.ts +3 -0
- package/dist/components/icon-button/UIconButton.js +9 -3
- package/dist/components/input/UInput.js +1 -1
- package/dist/components/progress-bar/UProgressBar.d.ts +3 -0
- package/dist/components/progress-bar/UProgressBar.js +11 -0
- package/dist/components/progress-ring/UProgressRing.d.ts +3 -0
- package/dist/components/progress-ring/UProgressRing.js +11 -0
- package/dist/components/rating/URating.d.ts +5 -0
- package/dist/components/rating/URating.js +24 -11
- package/dist/components/select/USelect.js +1 -1
- package/dist/components/spinner/USpinner.d.ts +7 -0
- package/dist/components/spinner/USpinner.js +12 -1
- package/dist/components/split-panel/USplitPanel.js +1 -1
- package/dist/components/tab/UTab.js +1 -1
- package/dist/components/tree/UTree.d.ts +14 -0
- package/dist/components/tree/UTree.js +34 -0
- package/dist/components/tree-item/UTreeItem.d.ts +10 -0
- package/dist/components/tree-item/UTreeItem.js +41 -4
- package/dist/index.js +1 -1
- package/dist/utilities/Dialog.js +1 -1
- package/dist/utilities/Locale.d.ts +1 -1
- package/dist/utilities/progressAria.d.ts +14 -0
- package/dist/utilities/progressAria.js +22 -0
- package/package.json +1 -1
- package/skills/iyulab-components/references/components/icon-button.md +2 -1
- package/skills/iyulab-components/references/components/progress-bar.md +4 -0
- package/skills/iyulab-components/references/components/progress-ring.md +4 -0
- package/skills/iyulab-components/references/components/rating.md +8 -0
- package/skills/iyulab-components/references/components/spinner.md +4 -0
- package/skills/iyulab-components/references/components/tree.md +11 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
|
+
import { attachProgressbar, syncProgressValue } from "../../utilities/progressAria.js";
|
|
4
5
|
import { styles } from "./UProgressBar.styles.js";
|
|
5
6
|
import { html } from "lit";
|
|
6
7
|
import { customElement, property, state } from "lit/decorators.js";
|
|
@@ -17,6 +18,7 @@ var UProgressBar = class UProgressBar extends UElement {
|
|
|
17
18
|
this.min = 0;
|
|
18
19
|
this.max = 100;
|
|
19
20
|
this.value = 0;
|
|
21
|
+
this.internals = attachProgressbar(this);
|
|
20
22
|
this.progress = 0;
|
|
21
23
|
this.bufferProgress = 0;
|
|
22
24
|
}
|
|
@@ -35,6 +37,15 @@ var UProgressBar = class UProgressBar extends UElement {
|
|
|
35
37
|
this.bufferProgress = this.buffer !== void 0 ? this.calcProgress(this.buffer) : 0;
|
|
36
38
|
}
|
|
37
39
|
}
|
|
40
|
+
updated(changedProperties) {
|
|
41
|
+
super.updated(changedProperties);
|
|
42
|
+
if ([
|
|
43
|
+
"min",
|
|
44
|
+
"max",
|
|
45
|
+
"value",
|
|
46
|
+
"indeterminate"
|
|
47
|
+
].some((k) => changedProperties.has(k))) syncProgressValue(this.internals, this);
|
|
48
|
+
}
|
|
38
49
|
render() {
|
|
39
50
|
const hasBuffer = this.buffer !== void 0 && !this.indeterminate;
|
|
40
51
|
const hasSegments = this.segments > 1;
|
|
@@ -35,11 +35,14 @@ export declare class UProgressRing extends UElement {
|
|
|
35
35
|
buffer?: number;
|
|
36
36
|
/** 현재값 */
|
|
37
37
|
value: number;
|
|
38
|
+
/** 보조기기에 내놓는 역할·값(`progressbar`) — 호스트 속성이 이긴다. */
|
|
39
|
+
private readonly internals;
|
|
38
40
|
private progress;
|
|
39
41
|
private bufferProgress;
|
|
40
42
|
private dasharray;
|
|
41
43
|
private uuid;
|
|
42
44
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
45
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
43
46
|
render(): import('lit-html').TemplateResult<1>;
|
|
44
47
|
private calcProgress;
|
|
45
48
|
private calcDasharray;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
|
+
import { attachProgressbar, syncProgressValue } from "../../utilities/progressAria.js";
|
|
4
5
|
import { styles } from "./UProgressRing.styles.js";
|
|
5
6
|
import { html } from "lit";
|
|
6
7
|
import { customElement, property, state } from "lit/decorators.js";
|
|
@@ -18,6 +19,7 @@ var UProgressRing = class UProgressRing extends UElement {
|
|
|
18
19
|
this.min = 0;
|
|
19
20
|
this.max = 100;
|
|
20
21
|
this.value = 0;
|
|
22
|
+
this.internals = attachProgressbar(this);
|
|
21
23
|
this.progress = 0;
|
|
22
24
|
this.bufferProgress = 0;
|
|
23
25
|
this.dasharray = PATH_LENGTH.toString();
|
|
@@ -39,6 +41,15 @@ var UProgressRing = class UProgressRing extends UElement {
|
|
|
39
41
|
}
|
|
40
42
|
if (["segments", "segmentGap"].some((k) => changedProperties.has(k))) this.dasharray = this.calcDasharray(this.segments, this.segmentGap);
|
|
41
43
|
}
|
|
44
|
+
updated(changedProperties) {
|
|
45
|
+
super.updated(changedProperties);
|
|
46
|
+
if ([
|
|
47
|
+
"min",
|
|
48
|
+
"max",
|
|
49
|
+
"value",
|
|
50
|
+
"indeterminate"
|
|
51
|
+
].some((k) => changedProperties.has(k))) syncProgressValue(this.internals, this);
|
|
52
|
+
}
|
|
42
53
|
render() {
|
|
43
54
|
const hasBuffer = this.buffer !== void 0 && !this.indeterminate;
|
|
44
55
|
const linecap = this.rounded ? "round" : "butt";
|
|
@@ -42,6 +42,11 @@ export declare class URating extends UFormControlElement<number> {
|
|
|
42
42
|
* `<span>`이라 disabled/readonly일 때 `tabindex="-1"`(=`!interactive`)이고,
|
|
43
43
|
* 다른 컴포넌트의 `.container`/thumb와 같은 이유로 프로그램적 focus는 여전히
|
|
44
44
|
* 통과하므로 직접 가드한다. */
|
|
45
|
+
/**
|
|
46
|
+
* 탭 정지는 그룹에 하나 — 고른 별(없으면 첫 별)이다(APG Radio Group · 네이티브 라디오 묶음과 같다). 종전에는 별마다
|
|
47
|
+
* 탭 정지라 Tab 이 별 다섯을 다 지나갔다.
|
|
48
|
+
*/
|
|
49
|
+
private get tabStopScore();
|
|
45
50
|
focus(options?: FocusOptions): void;
|
|
46
51
|
blur(): void;
|
|
47
52
|
private onChangeValue;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
2
2
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
3
3
|
import { UFormControlElement } from "../UFormControlElement.js";
|
|
4
|
-
import "../icon/UIcon.js";
|
|
5
4
|
import { Locale } from "../../utilities/Locale.js";
|
|
5
|
+
import "../icon/UIcon.js";
|
|
6
6
|
import "../field/UField.js";
|
|
7
7
|
import { styles } from "./URating.styles.js";
|
|
8
8
|
import { html } from "lit";
|
|
@@ -49,24 +49,29 @@ var URating = class URating extends UFormControlElement {
|
|
|
49
49
|
const currentSymbol = e.currentTarget;
|
|
50
50
|
const currentIndex = symbols.indexOf(currentSymbol);
|
|
51
51
|
if (currentIndex === -1) return;
|
|
52
|
+
const moveTo = (index) => {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
const score = index + 1;
|
|
55
|
+
if (score !== this.value) {
|
|
56
|
+
this.value = score;
|
|
57
|
+
this.emitChange();
|
|
58
|
+
}
|
|
59
|
+
this.updateComplete.then(() => symbols[index].focus());
|
|
60
|
+
};
|
|
52
61
|
switch (e.key) {
|
|
53
62
|
case "ArrowRight":
|
|
54
63
|
case "ArrowUp":
|
|
55
|
-
|
|
56
|
-
symbols[Math.min(symbols.length - 1, currentIndex + 1)].focus();
|
|
64
|
+
moveTo(Math.min(symbols.length - 1, currentIndex + 1));
|
|
57
65
|
break;
|
|
58
66
|
case "ArrowLeft":
|
|
59
67
|
case "ArrowDown":
|
|
60
|
-
|
|
61
|
-
symbols[Math.max(0, currentIndex - 1)].focus();
|
|
68
|
+
moveTo(Math.max(0, currentIndex - 1));
|
|
62
69
|
break;
|
|
63
70
|
case "Home":
|
|
64
|
-
|
|
65
|
-
symbols[0].focus();
|
|
71
|
+
moveTo(0);
|
|
66
72
|
break;
|
|
67
73
|
case "End":
|
|
68
|
-
|
|
69
|
-
symbols[symbols.length - 1].focus();
|
|
74
|
+
moveTo(symbols.length - 1);
|
|
70
75
|
break;
|
|
71
76
|
case " ":
|
|
72
77
|
case "Enter": {
|
|
@@ -121,9 +126,10 @@ var URating = class URating extends UFormControlElement {
|
|
|
121
126
|
return html`
|
|
122
127
|
<span class="symbol" part="symbol"
|
|
123
128
|
role="radio"
|
|
129
|
+
aria-label=${String(score)}
|
|
124
130
|
aria-checked=${score === Math.round(this.value || 0) ? "true" : "false"}
|
|
125
131
|
aria-disabled=${this.interactive ? "false" : "true"}
|
|
126
|
-
tabindex=${this.interactive ? "0" : "-1"}
|
|
132
|
+
tabindex=${this.interactive && score === this.tabStopScore ? "0" : "-1"}
|
|
127
133
|
data-score=${score}
|
|
128
134
|
@pointermove=${this.handleSymbolPointerMove}
|
|
129
135
|
@pointerleave=${this.handleSymbolPointerLeave}
|
|
@@ -181,9 +187,16 @@ var URating = class URating extends UFormControlElement {
|
|
|
181
187
|
* `<span>`이라 disabled/readonly일 때 `tabindex="-1"`(=`!interactive`)이고,
|
|
182
188
|
* 다른 컴포넌트의 `.container`/thumb와 같은 이유로 프로그램적 focus는 여전히
|
|
183
189
|
* 통과하므로 직접 가드한다. */
|
|
190
|
+
/**
|
|
191
|
+
* 탭 정지는 그룹에 하나 — 고른 별(없으면 첫 별)이다(APG Radio Group · 네이티브 라디오 묶음과 같다). 종전에는 별마다
|
|
192
|
+
* 탭 정지라 Tab 이 별 다섯을 다 지나갔다.
|
|
193
|
+
*/
|
|
194
|
+
get tabStopScore() {
|
|
195
|
+
return Math.min(this.max, Math.max(1, Math.round(this.value || 0) || 1));
|
|
196
|
+
}
|
|
184
197
|
focus(options) {
|
|
185
198
|
if (!this.interactive) return;
|
|
186
|
-
this.renderRoot.querySelector(".
|
|
199
|
+
this.renderRoot.querySelector(`.symbol[data-score="${this.tabStopScore}"]`)?.focus(options);
|
|
187
200
|
}
|
|
188
201
|
blur() {
|
|
189
202
|
(this.shadowRoot?.activeElement)?.blur();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
2
2
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
3
3
|
import { UFormControlElement } from "../UFormControlElement.js";
|
|
4
|
+
import { Locale } from "../../utilities/Locale.js";
|
|
4
5
|
import "../spinner/USpinner.js";
|
|
5
6
|
import "../icon/UIcon.js";
|
|
6
|
-
import { Locale } from "../../utilities/Locale.js";
|
|
7
7
|
import "../field/UField.js";
|
|
8
8
|
import { UPopover } from "../popover/UPopover.js";
|
|
9
9
|
import { UOption } from "../option/UOption.js";
|
|
@@ -19,6 +19,13 @@ export declare class USpinner extends UElement {
|
|
|
19
19
|
/** 인디케이터 색상 */
|
|
20
20
|
color?: SpinnerColor;
|
|
21
21
|
private hasLabel;
|
|
22
|
+
/**
|
|
23
|
+
* 보조기기에는 «양을 모르는 진행»(`progressbar`, 값 없음). 이름은 슬롯 글자, 없으면 로케일의 `loading` — 회전하는
|
|
24
|
+
* 그림만으로는 무엇이 진행 중인지 들리지 않는다. 호스트의 `aria-label` 이 이긴다.
|
|
25
|
+
*/
|
|
26
|
+
private readonly internals;
|
|
27
|
+
connectedCallback(): void;
|
|
28
|
+
private nameFrom;
|
|
22
29
|
render(): import('lit-html').TemplateResult<1>;
|
|
23
30
|
private handleSlotChange;
|
|
24
31
|
}
|
|
@@ -2,6 +2,8 @@ import { UElement } from "../UElement.js";
|
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
4
|
import { styles } from "./USpinner.styles.js";
|
|
5
|
+
import { attachProgressbar } from "../../utilities/progressAria.js";
|
|
6
|
+
import { Locale } from "../../utilities/Locale.js";
|
|
5
7
|
import { html } from "lit";
|
|
6
8
|
import { customElement, property, state } from "lit/decorators.js";
|
|
7
9
|
//#region src/components/spinner/USpinner.ts
|
|
@@ -9,10 +11,18 @@ var USpinner = class USpinner extends UElement {
|
|
|
9
11
|
constructor(..._args) {
|
|
10
12
|
super(..._args);
|
|
11
13
|
this.hasLabel = false;
|
|
14
|
+
this.internals = attachProgressbar(this);
|
|
12
15
|
}
|
|
13
16
|
static {
|
|
14
17
|
this.styles = [super.styles, styles];
|
|
15
18
|
}
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
super.connectedCallback();
|
|
21
|
+
this.nameFrom("");
|
|
22
|
+
}
|
|
23
|
+
nameFrom(text) {
|
|
24
|
+
if (this.internals) this.internals.ariaLabel = text || Locale.getValue("loading");
|
|
25
|
+
}
|
|
16
26
|
render() {
|
|
17
27
|
return html`
|
|
18
28
|
<svg class="spinner" part="svg">
|
|
@@ -20,7 +30,7 @@ var USpinner = class USpinner extends UElement {
|
|
|
20
30
|
<circle class="indicator"></circle>
|
|
21
31
|
</svg>
|
|
22
32
|
|
|
23
|
-
<span class="label" part="label" ?hidden=${!this.hasLabel}>
|
|
33
|
+
<span class="label" part="label" ?hidden=${!this.hasLabel} aria-hidden="true">
|
|
24
34
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
25
35
|
</span>
|
|
26
36
|
`;
|
|
@@ -28,6 +38,7 @@ var USpinner = class USpinner extends UElement {
|
|
|
28
38
|
handleSlotChange(e) {
|
|
29
39
|
const nodes = e.target.assignedNodes({ flatten: true });
|
|
30
40
|
this.hasLabel = nodes.some((node) => node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.TEXT_NODE && node.textContent?.trim() !== "");
|
|
41
|
+
this.nameFrom(nodes.map((n) => n.textContent ?? "").join(" ").replace(/\s+/g, " ").trim());
|
|
31
42
|
}
|
|
32
43
|
};
|
|
33
44
|
__decorate([property({
|
|
@@ -2,8 +2,8 @@ import { UElement } from "../UElement.js";
|
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
4
|
import { arrayAttrConverter } from "../../utilities/converters.js";
|
|
5
|
-
import { devWarnOnce } from "../../utilities/devWarning.js";
|
|
6
5
|
import { Locale } from "../../utilities/Locale.js";
|
|
6
|
+
import { devWarnOnce } from "../../utilities/devWarning.js";
|
|
7
7
|
import { styles } from "./USplitPanel.styles.js";
|
|
8
8
|
import { html } from "lit";
|
|
9
9
|
import { customElement, property, query } from "lit/decorators.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
|
+
import { Locale } from "../../utilities/Locale.js";
|
|
4
5
|
import "../button/UButton.js";
|
|
5
6
|
import "../icon/UIcon.js";
|
|
6
|
-
import { Locale } from "../../utilities/Locale.js";
|
|
7
7
|
import { styles } from "./UTab.styles.js";
|
|
8
8
|
import { html } from "lit";
|
|
9
9
|
import { customElement, property } from "lit/decorators.js";
|
|
@@ -60,6 +60,20 @@ export declare class UTree extends UElement {
|
|
|
60
60
|
mapItems(fn: (item: UTreeItem) => void): void;
|
|
61
61
|
private propagate;
|
|
62
62
|
private handleSlotChange;
|
|
63
|
+
/** 탭 정지 — 트리 전체에 하나(APG Tree View). 마지막으로 포커스된 항목, 처음에는 선택된 항목 또는 첫 항목. */
|
|
64
|
+
private tabStop?;
|
|
65
|
+
/**
|
|
66
|
+
* 정지를 다시 정한다 — `preferred` 가 있으면 그것(포커스를 받으려는 항목), 아니면 지금 정지를 지키되 비활성이 되거나
|
|
67
|
+
* 접힌 부모 밑에 숨으면 보이는 가장 가까운 조상으로 옮긴다(숨은 항목의 tabindex 0 은 Tab 이 건너뛰어 트리에 들어갈
|
|
68
|
+
* 길이 사라진다).
|
|
69
|
+
*
|
|
70
|
+
* ⚠정지가 아닌 항목은 `tabindex` 를 **떼어 낸다**(-1 이 아니다). 항목은 섀도 호스트이고 자식 항목은 그 섀도의 슬롯으로
|
|
71
|
+
* 그려진다 — 음수 tabindex 호스트의 범위는 순차 탐색에서 통째로 빠져, 부모가 -1 이면 그 밑의 정지에 Tab 이 닿지
|
|
72
|
+
* 않았다(실측: Shift+Tab 이 트리를 건너뛰었다). 그래서 항목은 포커스를 받기 직전에 정지가 된다(`UTreeItem.focus`).
|
|
73
|
+
* @internal 항목이 부른다.
|
|
74
|
+
*/
|
|
75
|
+
syncTabStop(preferred?: UTreeItem): void;
|
|
76
|
+
private handleFocusin;
|
|
63
77
|
private handleIconSlotChange;
|
|
64
78
|
private handlePick;
|
|
65
79
|
private selectRange;
|
|
@@ -23,6 +23,13 @@ var UTree = class UTree extends UElement {
|
|
|
23
23
|
const slot = e.target;
|
|
24
24
|
this._items = slot.assignedElements({ flatten: true }).filter((el) => el instanceof UTreeItem);
|
|
25
25
|
this.propagate();
|
|
26
|
+
this.syncTabStop();
|
|
27
|
+
};
|
|
28
|
+
this.handleFocusin = (e) => {
|
|
29
|
+
const item = e.composedPath().find((el) => el instanceof UTreeItem);
|
|
30
|
+
if (!item || item === this.tabStop || item.disabled) return;
|
|
31
|
+
this.tabStop = item;
|
|
32
|
+
this.syncTabStop();
|
|
26
33
|
};
|
|
27
34
|
this.handleIconSlotChange = (e) => {
|
|
28
35
|
const slot = e.target;
|
|
@@ -149,11 +156,13 @@ var UTree = class UTree extends UElement {
|
|
|
149
156
|
this.addEventListener("pick", this.handlePick);
|
|
150
157
|
this.addEventListener("check", this.handleCheck);
|
|
151
158
|
this.addEventListener("keydown", this.handleKeydown);
|
|
159
|
+
this.addEventListener("focusin", this.handleFocusin);
|
|
152
160
|
}
|
|
153
161
|
disconnectedCallback() {
|
|
154
162
|
this.removeEventListener("pick", this.handlePick);
|
|
155
163
|
this.removeEventListener("check", this.handleCheck);
|
|
156
164
|
this.removeEventListener("keydown", this.handleKeydown);
|
|
165
|
+
this.removeEventListener("focusin", this.handleFocusin);
|
|
157
166
|
super.disconnectedCallback();
|
|
158
167
|
}
|
|
159
168
|
willUpdate(changedProperties) {
|
|
@@ -240,6 +249,31 @@ var UTree = class UTree extends UElement {
|
|
|
240
249
|
item.collapseIcon = this.collapseIcon?.cloneNode(true);
|
|
241
250
|
});
|
|
242
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* 정지를 다시 정한다 — `preferred` 가 있으면 그것(포커스를 받으려는 항목), 아니면 지금 정지를 지키되 비활성이 되거나
|
|
254
|
+
* 접힌 부모 밑에 숨으면 보이는 가장 가까운 조상으로 옮긴다(숨은 항목의 tabindex 0 은 Tab 이 건너뛰어 트리에 들어갈
|
|
255
|
+
* 길이 사라진다).
|
|
256
|
+
*
|
|
257
|
+
* ⚠정지가 아닌 항목은 `tabindex` 를 **떼어 낸다**(-1 이 아니다). 항목은 섀도 호스트이고 자식 항목은 그 섀도의 슬롯으로
|
|
258
|
+
* 그려진다 — 음수 tabindex 호스트의 범위는 순차 탐색에서 통째로 빠져, 부모가 -1 이면 그 밑의 정지에 Tab 이 닿지
|
|
259
|
+
* 않았다(실측: Shift+Tab 이 트리를 건너뛰었다). 그래서 항목은 포커스를 받기 직전에 정지가 된다(`UTreeItem.focus`).
|
|
260
|
+
* @internal 항목이 부른다.
|
|
261
|
+
*/
|
|
262
|
+
syncTabStop(preferred) {
|
|
263
|
+
if (preferred && !preferred.disabled) this.tabStop = preferred;
|
|
264
|
+
const shown = (item) => {
|
|
265
|
+
for (let p = item.parentItem; p; p = p.parentItem) if (!p.expanded) return false;
|
|
266
|
+
return true;
|
|
267
|
+
};
|
|
268
|
+
const reachable = this.getItems((item) => !item.disabled && shown(item));
|
|
269
|
+
let stop = this.tabStop;
|
|
270
|
+
while (stop && !reachable.includes(stop)) stop = stop.parentItem ?? void 0;
|
|
271
|
+
this.tabStop = stop ?? reachable.find((item) => item.selected) ?? reachable[0];
|
|
272
|
+
this.mapItems((item) => {
|
|
273
|
+
if (item === this.tabStop) item.setAttribute("tabindex", "0");
|
|
274
|
+
else item.removeAttribute("tabindex");
|
|
275
|
+
});
|
|
276
|
+
}
|
|
243
277
|
selectRange(anchor, target) {
|
|
244
278
|
const visible = this.getItems((item) => !item.disabled && (!item.parentItem || item.parentItem.expanded));
|
|
245
279
|
const from = visible.indexOf(anchor);
|
|
@@ -51,6 +51,11 @@ export declare class UTreeItem extends UElement {
|
|
|
51
51
|
get parentItem(): UTreeItem | null;
|
|
52
52
|
private _childItems;
|
|
53
53
|
get childItems(): readonly UTreeItem[];
|
|
54
|
+
/**
|
|
55
|
+
* 이름 = 자기 라벨(기본 슬롯)의 글자. 역할이 호스트에 있으므로 내용에서 이름을 계산하면 **자식 항목의 글자까지**
|
|
56
|
+
* 들어갔다(실측: 부모 이름 «Root Child»). 호스트의 `aria-label` 이 이긴다.
|
|
57
|
+
*/
|
|
58
|
+
private readonly internals;
|
|
54
59
|
connectedCallback(): void;
|
|
55
60
|
protected updated(changedProperties: PropertyValues): void;
|
|
56
61
|
render(): import('lit-html').TemplateResult<1>;
|
|
@@ -60,6 +65,11 @@ export declare class UTreeItem extends UElement {
|
|
|
60
65
|
private propagate;
|
|
61
66
|
private handleSlotChange;
|
|
62
67
|
private handleChildrenSlotChange;
|
|
68
|
+
private requestTabStopSync;
|
|
69
|
+
/** 포커스를 받기 직전에 탭 정지가 된다 — 정지가 아닌 항목은 tabindex 가 없어 그대로는 포커스를 받지 못한다. */
|
|
70
|
+
focus(options?: FocusOptions): void;
|
|
71
|
+
/** 누르면 포커스가 오도록 — 브라우저가 포커스 대상을 정하기 전(pointerdown)에 정지가 된다. 바깥 항목의 처리는 막는다. */
|
|
72
|
+
private handlePointerdown;
|
|
63
73
|
private handleHeaderClick;
|
|
64
74
|
private handleToggleClick;
|
|
65
75
|
private handleCheckboxClick;
|
|
@@ -30,15 +30,25 @@ var UTreeItem = class UTreeItem extends UElement {
|
|
|
30
30
|
this.indeterminate = false;
|
|
31
31
|
this._parentItem = null;
|
|
32
32
|
this._childItems = [];
|
|
33
|
+
this.internals = "attachInternals" in this ? this.attachInternals() : void 0;
|
|
33
34
|
this.handleSlotChange = (e) => {
|
|
34
|
-
const
|
|
35
|
+
const slot = e.target;
|
|
36
|
+
const elements = slot.assignedElements({ flatten: true });
|
|
35
37
|
for (const el of elements) if (el instanceof _UTreeItem && !el.hasAttribute("slot")) el.setAttribute("slot", "children");
|
|
38
|
+
if (this.internals) {
|
|
39
|
+
const text = slot.assignedNodes({ flatten: true }).filter((n) => !(n instanceof _UTreeItem)).map((n) => n.textContent ?? "").join(" ").replace(/\s+/g, " ").trim();
|
|
40
|
+
this.internals.ariaLabel = text || null;
|
|
41
|
+
}
|
|
36
42
|
};
|
|
37
43
|
this.handleChildrenSlotChange = (e) => {
|
|
38
44
|
const slot = e.target;
|
|
39
45
|
this._childItems = slot.assignedElements({ flatten: true }).filter((el) => el instanceof _UTreeItem);
|
|
40
46
|
this.leaf = this._childItems.length === 0;
|
|
41
47
|
this.propagate();
|
|
48
|
+
this.requestTabStopSync();
|
|
49
|
+
};
|
|
50
|
+
this.handlePointerdown = (e) => {
|
|
51
|
+
if (e.composedPath().find((el) => el instanceof _UTreeItem) === this) this.requestTabStopSync(this);
|
|
42
52
|
};
|
|
43
53
|
this.handleHeaderClick = (e) => {
|
|
44
54
|
if (isFromNestedControl(e, this)) return;
|
|
@@ -76,7 +86,7 @@ var UTreeItem = class UTreeItem extends UElement {
|
|
|
76
86
|
connectedCallback() {
|
|
77
87
|
super.connectedCallback();
|
|
78
88
|
this.setAttribute("role", "treeitem");
|
|
79
|
-
this.
|
|
89
|
+
this.addEventListener("pointerdown", this.handlePointerdown);
|
|
80
90
|
if (this.parentElement instanceof _UTreeItem) {
|
|
81
91
|
this._parentItem = this.parentElement;
|
|
82
92
|
this.depth = this._parentItem.depth + 1;
|
|
@@ -85,12 +95,31 @@ var UTreeItem = class UTreeItem extends UElement {
|
|
|
85
95
|
}
|
|
86
96
|
updated(changedProperties) {
|
|
87
97
|
super.updated(changedProperties);
|
|
98
|
+
if (changedProperties.has("disabled") || changedProperties.has("expanded")) this.requestTabStopSync();
|
|
88
99
|
if (changedProperties.has("disabled")) {
|
|
89
|
-
this.setAttribute("tabindex", this.disabled ? "-1" : "0");
|
|
90
100
|
if (this.disabled) this.setAttribute("aria-disabled", "true");
|
|
91
101
|
else this.removeAttribute("aria-disabled");
|
|
92
102
|
}
|
|
93
|
-
if (changedProperties.has("depth"))
|
|
103
|
+
if (changedProperties.has("depth")) {
|
|
104
|
+
this.style.setProperty("--tree-item-depth", String(this.depth));
|
|
105
|
+
this.setAttribute("aria-level", String(this.depth + 1));
|
|
106
|
+
}
|
|
107
|
+
if (changedProperties.has("expanded") || changedProperties.has("leaf")) {
|
|
108
|
+
if (this.leaf) this.removeAttribute("aria-expanded");
|
|
109
|
+
else this.setAttribute("aria-expanded", this.expanded ? "true" : "false");
|
|
110
|
+
}
|
|
111
|
+
if (changedProperties.has("selected") || changedProperties.has("selectable")) {
|
|
112
|
+
if (this.selectable) this.setAttribute("aria-selected", this.selected ? "true" : "false");
|
|
113
|
+
else this.removeAttribute("aria-selected");
|
|
114
|
+
}
|
|
115
|
+
if ([
|
|
116
|
+
"checked",
|
|
117
|
+
"indeterminate",
|
|
118
|
+
"checkable"
|
|
119
|
+
].some((k) => changedProperties.has(k))) {
|
|
120
|
+
if (this.checkable) this.setAttribute("aria-checked", this.indeterminate ? "mixed" : this.checked ? "true" : "false");
|
|
121
|
+
else this.removeAttribute("aria-checked");
|
|
122
|
+
}
|
|
94
123
|
}
|
|
95
124
|
render() {
|
|
96
125
|
return html`
|
|
@@ -163,6 +192,14 @@ var UTreeItem = class UTreeItem extends UElement {
|
|
|
163
192
|
item.collapseIcon = this.collapseIcon?.cloneNode(true);
|
|
164
193
|
});
|
|
165
194
|
}
|
|
195
|
+
requestTabStopSync(preferred) {
|
|
196
|
+
this.closest("u-tree")?.syncTabStop?.(preferred);
|
|
197
|
+
}
|
|
198
|
+
/** 포커스를 받기 직전에 탭 정지가 된다 — 정지가 아닌 항목은 tabindex 가 없어 그대로는 포커스를 받지 못한다. */
|
|
199
|
+
focus(options) {
|
|
200
|
+
this.requestTabStopSync(this);
|
|
201
|
+
super.focus(options);
|
|
202
|
+
}
|
|
166
203
|
};
|
|
167
204
|
__decorate([property({
|
|
168
205
|
type: Boolean,
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,12 @@ import { isImeComposing } from "./utilities/keyboard.js";
|
|
|
6
6
|
import { OverlayManager } from "./utilities/OverlayManager.js";
|
|
7
7
|
import { arrayAttrConverter, booleanAttrConverter, dateAttrConverter, jsonAttrConverter, urlAttrConverter } from "./utilities/converters.js";
|
|
8
8
|
import { UOverlayElement } from "./components/UOverlayElement.js";
|
|
9
|
+
import { Locale } from "./utilities/Locale.js";
|
|
9
10
|
import { USpinner } from "./components/spinner/USpinner.js";
|
|
10
11
|
import { UButton } from "./components/button/UButton.js";
|
|
11
12
|
import { IconCache, IconRegistry, getDefaultBaseUrl, setDefaultBaseUrl } from "./utilities/icons.js";
|
|
12
13
|
import { createDevWarner, devWarnOnce, resetDevWarnings } from "./utilities/devWarning.js";
|
|
13
14
|
import { UIcon } from "./components/icon/UIcon.js";
|
|
14
|
-
import { Locale } from "./utilities/Locale.js";
|
|
15
15
|
import { ALERT_STATUSES, UAlert } from "./components/alert/UAlert.js";
|
|
16
16
|
import { UAvatar } from "./components/avatar/UAvatar.js";
|
|
17
17
|
import { UBadge } from "./components/badge/UBadge.js";
|
package/dist/utilities/Dialog.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isImeComposing } from "./keyboard.js";
|
|
2
|
-
import "../components/button/UButton.js";
|
|
3
2
|
import { Locale } from "./Locale.js";
|
|
3
|
+
import "../components/button/UButton.js";
|
|
4
4
|
import { UDialog } from "../components/dialog/UDialog.js";
|
|
5
5
|
import "../components/input/UInput.js";
|
|
6
6
|
import { html, nothing, render } from "lit";
|
|
@@ -12,7 +12,7 @@ export type SupportedLocale = 'en' | 'ko' | 'ja' | 'zh-CN' | 'zh-TW' | 'es' | 'f
|
|
|
12
12
|
/** 내장 로케일은 자동완성되지만, 임의의 BCP47 태그도 그대로 받는다. */
|
|
13
13
|
export type LocaleTag = SupportedLocale | (string & {});
|
|
14
14
|
/** 라이브러리가 제공하는 chrome 문자열 키. 지금은 검증 메시지뿐이지만 이후 다른 UI 문구도 추가될 수 있다. */
|
|
15
|
-
export type LocaleMessageKey = 'valueMissing' | 'badInput' | 'typeMismatch' | 'patternMismatch' | 'rangeUnderflow' | 'rangeOverflow' | 'stepMismatch' | 'tooShort' | 'tooLong' | 'increment' | 'decrement' | 'clear' | 'today' | 'time' | 'showPassword' | 'hidePassword' | 'previousSlide' | 'nextSlide' | 'goToSlide' | 'stopSlideRotation' | 'startSlideRotation' | 'chooseDate' | 'chooseDateRange' | 'yesterday' | 'last7Days' | 'last30Days' | 'thisWeek' | 'lastWeek' | 'thisMonth' | 'lastMonth' | 'thisYear' | 'quickRanges' | 'rangeStartChosen' | 'previousMonth' | 'nextMonth' | 'close' | 'copy' | 'copied' | 'chooseFile' | 'noFileChosen' | 'filesSelected' | 'resizePanels' | 'breadcrumb' | 'search' | 'alertError' | 'alertWarning' | 'alertSuccess' | 'alertInfo' | 'alertNotice' | 'alertMessage' | 'remove' | 'closeTab' | 'confirm' | 'cancel' | 'stepComplete' | 'stepOnHold' | 'apply' | 'dateUnavailable' | 'startTime' | 'endTime' | 'timeAm' | 'timePm';
|
|
15
|
+
export type LocaleMessageKey = 'valueMissing' | 'badInput' | 'typeMismatch' | 'patternMismatch' | 'rangeUnderflow' | 'rangeOverflow' | 'stepMismatch' | 'tooShort' | 'tooLong' | 'increment' | 'decrement' | 'clear' | 'today' | 'time' | 'showPassword' | 'hidePassword' | 'previousSlide' | 'nextSlide' | 'goToSlide' | 'stopSlideRotation' | 'startSlideRotation' | 'chooseDate' | 'chooseDateRange' | 'yesterday' | 'last7Days' | 'last30Days' | 'thisWeek' | 'lastWeek' | 'thisMonth' | 'lastMonth' | 'thisYear' | 'quickRanges' | 'rangeStartChosen' | 'previousMonth' | 'nextMonth' | 'close' | 'copy' | 'copied' | 'chooseFile' | 'noFileChosen' | 'filesSelected' | 'resizePanels' | 'loading' | 'breadcrumb' | 'search' | 'alertError' | 'alertWarning' | 'alertSuccess' | 'alertInfo' | 'alertNotice' | 'alertMessage' | 'remove' | 'closeTab' | 'confirm' | 'cancel' | 'stepComplete' | 'stepOnHold' | 'apply' | 'dateUnavailable' | 'startTime' | 'endTime' | 'timeAm' | 'timePm';
|
|
16
16
|
type LocaleTable = Record<LocaleMessageKey, string>;
|
|
17
17
|
/**
|
|
18
18
|
* 한 패키지(또는 앱 영역)의 문자열 묶음.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 진행 표시(`u-progress-bar`·`u-progress-ring`·`u-spinner`)를 보조기기에 `progressbar` 로 내놓는다.
|
|
3
|
+
*
|
|
4
|
+
* 그리는 막대·고리만 있고 역할이 없으면 보조기기에는 아무것도 없다 — 진행 중이라는 사실도, 몇 % 인지도.
|
|
5
|
+
* 역할과 값은 `ElementInternals` 기본값이라 호스트에 단 `role`·`aria-*` 속성이 이긴다. 값이 정해지지 않은
|
|
6
|
+
* 진행(`indeterminate`·스피너)은 `aria-valuenow` 를 두지 않는다 — WAI-ARIA 의 «진행 중, 양은 모름» 표기.
|
|
7
|
+
*/
|
|
8
|
+
export declare function attachProgressbar(host: HTMLElement): ElementInternals | undefined;
|
|
9
|
+
export declare function syncProgressValue(internals: ElementInternals | undefined, state: {
|
|
10
|
+
indeterminate: boolean;
|
|
11
|
+
value: number;
|
|
12
|
+
min: number;
|
|
13
|
+
max: number;
|
|
14
|
+
}): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/utilities/progressAria.ts
|
|
2
|
+
/**
|
|
3
|
+
* 진행 표시(`u-progress-bar`·`u-progress-ring`·`u-spinner`)를 보조기기에 `progressbar` 로 내놓는다.
|
|
4
|
+
*
|
|
5
|
+
* 그리는 막대·고리만 있고 역할이 없으면 보조기기에는 아무것도 없다 — 진행 중이라는 사실도, 몇 % 인지도.
|
|
6
|
+
* 역할과 값은 `ElementInternals` 기본값이라 호스트에 단 `role`·`aria-*` 속성이 이긴다. 값이 정해지지 않은
|
|
7
|
+
* 진행(`indeterminate`·스피너)은 `aria-valuenow` 를 두지 않는다 — WAI-ARIA 의 «진행 중, 양은 모름» 표기.
|
|
8
|
+
*/
|
|
9
|
+
function attachProgressbar(host) {
|
|
10
|
+
if (!("attachInternals" in host)) return void 0;
|
|
11
|
+
const internals = host.attachInternals();
|
|
12
|
+
internals.role = "progressbar";
|
|
13
|
+
return internals;
|
|
14
|
+
}
|
|
15
|
+
function syncProgressValue(internals, state) {
|
|
16
|
+
if (!internals) return;
|
|
17
|
+
internals.ariaValueMin = String(state.min);
|
|
18
|
+
internals.ariaValueMax = String(state.max);
|
|
19
|
+
internals.ariaValueNow = state.indeterminate ? null : String(Math.max(state.min, Math.min(state.max, state.value)));
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { attachProgressbar, syncProgressValue };
|
package/package.json
CHANGED
|
@@ -49,7 +49,8 @@ Square icon-only button with a built-in tooltip (shown from the default slot). R
|
|
|
49
49
|
|
|
50
50
|
## Accessibility
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
The icon has no text, so the button is named by its tooltip text (the default slot) — or by an `aria-label`
|
|
53
|
+
on the host, which wins. One of the two is required. `aria-label` and the button states
|
|
53
54
|
(`aria-pressed`, `aria-expanded`, `aria-controls`, `aria-haspopup`) set on the host reach the
|
|
54
55
|
inner button, as on `u-button`.
|
|
55
56
|
|
|
@@ -21,6 +21,10 @@ Linear progress indicator. Supports buffer, segments, striped effect, and indete
|
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
+
## Accessibility
|
|
25
|
+
|
|
26
|
+
Exposed as a **`progressbar`** with `aria-valuenow`/`min`/`max`; `indeterminate` leaves the value out (in progress, amount unknown). Name it with `aria-label` ("Upload") — the bar has no text of its own.
|
|
27
|
+
|
|
24
28
|
## Slots
|
|
25
29
|
|
|
26
30
|
| Name | Description |
|
|
@@ -20,6 +20,10 @@ Circular progress indicator. Supports buffer, segments, and indeterminate state.
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
+
## Accessibility
|
|
24
|
+
|
|
25
|
+
Exposed as a **`progressbar`** with `aria-valuenow`/`min`/`max`; `indeterminate` leaves the value out. Name it with `aria-label` — slotted content ("50%") is shown, not used as the name.
|
|
26
|
+
|
|
23
27
|
## Slots
|
|
24
28
|
|
|
25
29
|
| Name | Description |
|
|
@@ -23,6 +23,14 @@ Star/custom-symbol rating input. Supports fractional precision and custom symbol
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
+
## Accessibility
|
|
27
|
+
|
|
28
|
+
A `radiogroup` (named by `label`) of radios named `1`…`max` — a screen reader adds the position ("3 of 5").
|
|
29
|
+
|
|
30
|
+
**Keyboard** — like a native radio group: one Tab stop (the chosen star, or the first when there is none);
|
|
31
|
+
`ArrowRight`/`ArrowUp` and `ArrowLeft`/`ArrowDown` move **and choose** (firing `change`), `Home`/`End` choose the
|
|
32
|
+
first/last; `Space`/`Enter` choose the focused star (again on the chosen one clears it). `focus()` goes to the Tab stop.
|
|
33
|
+
|
|
26
34
|
## Slots
|
|
27
35
|
|
|
28
36
|
| Name | Description |
|
|
@@ -18,6 +18,10 @@ Animated circular spinner for loading states. Optional label below the spinner v
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
+
## Accessibility
|
|
22
|
+
|
|
23
|
+
Exposed as a **`progressbar`** with no value (in progress, amount unknown). Its name is the slotted text — read once, as the name — or the locale's `loading` word ("Loading", "로딩 중") when it has none. `aria-label` on the host wins.
|
|
24
|
+
|
|
21
25
|
## Slots
|
|
22
26
|
|
|
23
27
|
| Name | Description |
|
|
@@ -24,6 +24,17 @@ Hierarchical tree with support for selection, checkboxes, cascade check, and dra
|
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
+
## Accessibility
|
|
28
|
+
|
|
29
|
+
Items are `treeitem`s with `aria-level` (depth), `aria-expanded` (items with children), `aria-selected` (in a
|
|
30
|
+
`selectable` tree) and `aria-checked` (`mixed` for a partly checked parent, in a `checkable` tree). An item is
|
|
31
|
+
named by its own label — not by the text of the items under it.
|
|
32
|
+
|
|
33
|
+
**Keyboard** — the tree is **one** Tab stop: the item focused last (at first the selected item, else the first).
|
|
34
|
+
Tab enters on it and the next Tab leaves the tree; arrows move inside (`↑`/`↓` items, `→` expand / first child,
|
|
35
|
+
`←` collapse / parent, `Home`/`End`). If that item is collapsed away or disabled, the stop moves to its nearest visible
|
|
36
|
+
ancestor. Only the stop carries `tabindex`; `item.focus()` and a click make an item the stop.
|
|
37
|
+
|
|
27
38
|
## u-tree
|
|
28
39
|
|
|
29
40
|
### Slots
|