@iyulab/components 2.8.0 → 2.9.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 CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.9.1] - 2026-10-07
4
+
5
+ ### Fixed
6
+
7
+ - **`u-field`'s label names the group when it spans several controls or one that names itself.** It always copied the
8
+ label onto the first slotted control, so "Theme" over two buttons "Light · Dark" made the first button read
9
+ *Theme* — its visible text and its name disagreed (WCAG 2.5.3 Label in Name). With two or more controls, or a single
10
+ button, link, checkbox, switch or radio with its own text, the field is now a `group` named by the label and
11
+ described by `description`; each control keeps its own name. A single input is named by the label as before.
12
+
13
+ ## [2.9.0] - 2026-10-07
14
+
15
+ ### Added
16
+
17
+ - **`u-input` `chars`** — the number of characters the field holds. An unsized field (the default `inline-block`) draws
18
+ at N characters plus its suffix icons and padding, so "a 12-digit number box" no longer needs a `calc()` that copies
19
+ the field's icon boxes and padding (and drifts when the host target floor changes). In a sized field it is the text
20
+ floor. Native `<input size>` / CSS `field-sizing` axis — `size` is already this component's sm/md/lg scale.
21
+ - `AlertDialogOptions.confirmLabel` and the locale key `ok` (en `OK`, ko `확인`, es `Aceptar` …).
22
+
23
+ ### Fixed
24
+
25
+ - **`Dialog.alert` has an OK button**, focused when it opens — like a native `alert()`. It opened with no button at
26
+ all, so it closed only by Esc or a backdrop click (neither visible), and the `alertdialog` had nowhere for focus to
27
+ go (WAI-ARIA APG Alert Dialog).
28
+
3
29
  ## [2.8.0] - 2026-10-07
4
30
 
5
31
  ### Added
@@ -57,6 +57,7 @@ var closeTab = "إغلاق علامة التبويب";
57
57
  var breadcrumb = "مسار التنقل";
58
58
  var confirm = "تأكيد";
59
59
  var cancel = "إلغاء";
60
+ var ok = "حسنًا";
60
61
  var stepComplete = "مكتمل";
61
62
  var stepOnHold = "معلّق";
62
63
  var apply = "تطبيق";
@@ -122,6 +123,7 @@ var ar_default = {
122
123
  breadcrumb,
123
124
  confirm,
124
125
  cancel,
126
+ ok,
125
127
  stepComplete,
126
128
  stepOnHold,
127
129
  apply,
@@ -132,4 +134,4 @@ var ar_default = {
132
134
  timePm: "م"
133
135
  };
134
136
  //#endregion
135
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, ar_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
137
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, ar_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, ok, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -122,6 +122,7 @@ var de_default = {
122
122
  breadcrumb,
123
123
  confirm,
124
124
  cancel,
125
+ ok: "OK",
125
126
  stepComplete,
126
127
  stepOnHold,
127
128
  apply,
@@ -122,6 +122,7 @@ var en_default = {
122
122
  breadcrumb,
123
123
  confirm,
124
124
  cancel,
125
+ ok: "OK",
125
126
  stepComplete,
126
127
  stepOnHold,
127
128
  apply,
@@ -56,6 +56,7 @@ var closeTab = "Cerrar pestaña";
56
56
  var breadcrumb = "Ruta de navegación";
57
57
  var confirm = "Confirmar";
58
58
  var cancel = "Cancelar";
59
+ var ok = "Aceptar";
59
60
  var stepComplete = "Completado";
60
61
  var stepOnHold = "En espera";
61
62
  var apply = "Aplicar";
@@ -123,6 +124,7 @@ var es_default = {
123
124
  breadcrumb,
124
125
  confirm,
125
126
  cancel,
127
+ ok,
126
128
  stepComplete,
127
129
  stepOnHold,
128
130
  apply,
@@ -133,4 +135,4 @@ var es_default = {
133
135
  timePm
134
136
  };
135
137
  //#endregion
136
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, es_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
138
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, es_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, ok, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -122,6 +122,7 @@ var fr_default = {
122
122
  breadcrumb,
123
123
  confirm,
124
124
  cancel,
125
+ ok: "OK",
125
126
  stepComplete,
126
127
  stepOnHold,
127
128
  apply,
@@ -122,6 +122,7 @@ var id_default = {
122
122
  breadcrumb,
123
123
  confirm,
124
124
  cancel,
125
+ ok: "OK",
125
126
  stepComplete,
126
127
  stepOnHold,
127
128
  apply,
@@ -123,6 +123,7 @@ var ja_default = {
123
123
  breadcrumb,
124
124
  confirm: "OK",
125
125
  cancel,
126
+ ok: "OK",
126
127
  stepComplete,
127
128
  stepOnHold,
128
129
  apply,
@@ -57,6 +57,7 @@ var closeTab = "탭 닫기";
57
57
  var breadcrumb = "탐색 경로";
58
58
  var confirm = "확인";
59
59
  var cancel = "취소";
60
+ var ok = "확인";
60
61
  var stepComplete = "완료";
61
62
  var stepOnHold = "보류";
62
63
  var apply = "적용";
@@ -124,6 +125,7 @@ var ko_default = {
124
125
  breadcrumb,
125
126
  confirm,
126
127
  cancel,
128
+ ok,
127
129
  stepComplete,
128
130
  stepOnHold,
129
131
  apply,
@@ -134,4 +136,4 @@ var ko_default = {
134
136
  timePm
135
137
  };
136
138
  //#endregion
137
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, ko_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
139
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, ko_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, ok, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -122,6 +122,7 @@ var pt_BR_default = {
122
122
  breadcrumb,
123
123
  confirm,
124
124
  cancel,
125
+ ok: "OK",
125
126
  stepComplete,
126
127
  stepOnHold,
127
128
  apply,
@@ -57,6 +57,7 @@ var closeTab = "Закрыть вкладку";
57
57
  var breadcrumb = "Навигационная цепочка";
58
58
  var confirm = "Подтвердить";
59
59
  var cancel = "Отмена";
60
+ var ok = "ОК";
60
61
  var stepComplete = "Завершено";
61
62
  var stepOnHold = "Приостановлено";
62
63
  var apply = "Применить";
@@ -122,6 +123,7 @@ var ru_default = {
122
123
  breadcrumb,
123
124
  confirm,
124
125
  cancel,
126
+ ok,
125
127
  stepComplete,
126
128
  stepOnHold,
127
129
  apply,
@@ -132,4 +134,4 @@ var ru_default = {
132
134
  timePm: "PM"
133
135
  };
134
136
  //#endregion
135
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, ru_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
137
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, ru_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, ok, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -57,6 +57,7 @@ var closeTab = "ปิดแท็บ";
57
57
  var breadcrumb = "เส้นทางการนำทาง";
58
58
  var confirm = "ยืนยัน";
59
59
  var cancel = "ยกเลิก";
60
+ var ok = "ตกลง";
60
61
  var stepComplete = "เสร็จสิ้น";
61
62
  var stepOnHold = "พักไว้";
62
63
  var apply = "นำไปใช้";
@@ -124,6 +125,7 @@ var th_default = {
124
125
  breadcrumb,
125
126
  confirm,
126
127
  cancel,
128
+ ok,
127
129
  stepComplete,
128
130
  stepOnHold,
129
131
  apply,
@@ -134,4 +136,4 @@ var th_default = {
134
136
  timePm
135
137
  };
136
138
  //#endregion
137
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, th_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
139
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, th_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, ok, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -122,6 +122,7 @@ var vi_default = {
122
122
  breadcrumb,
123
123
  confirm,
124
124
  cancel,
125
+ ok: "OK",
125
126
  stepComplete,
126
127
  stepOnHold,
127
128
  apply,
@@ -57,6 +57,7 @@ var closeTab = "关闭标签页";
57
57
  var breadcrumb = "面包屑导航";
58
58
  var confirm = "确定";
59
59
  var cancel = "取消";
60
+ var ok = "确定";
60
61
  var stepComplete = "已完成";
61
62
  var stepOnHold = "已暂停";
62
63
  var apply = "应用";
@@ -124,6 +125,7 @@ var zh_CN_default = {
124
125
  breadcrumb,
125
126
  confirm,
126
127
  cancel,
128
+ ok,
127
129
  stepComplete,
128
130
  stepOnHold,
129
131
  apply,
@@ -134,4 +136,4 @@ var zh_CN_default = {
134
136
  timePm
135
137
  };
136
138
  //#endregion
137
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, zh_CN_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
139
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, zh_CN_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, ok, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -57,6 +57,7 @@ var closeTab = "關閉分頁";
57
57
  var breadcrumb = "麵包屑導覽";
58
58
  var confirm = "確定";
59
59
  var cancel = "取消";
60
+ var ok = "確定";
60
61
  var stepComplete = "已完成";
61
62
  var stepOnHold = "已暫停";
62
63
  var apply = "套用";
@@ -124,6 +125,7 @@ var zh_TW_default = {
124
125
  breadcrumb,
125
126
  confirm,
126
127
  cancel,
128
+ ok,
127
129
  stepComplete,
128
130
  stepOnHold,
129
131
  apply,
@@ -134,4 +136,4 @@ var zh_TW_default = {
134
136
  timePm
135
137
  };
136
138
  //#endregion
137
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, zh_TW_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
139
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, carousel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, zh_TW_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, loading, nextMonth, nextSlide, noFileChosen, ok, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, slide, slideOf, startSlideRotation, startTime, stepComplete, stepMismatch, stepOnHold, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -57,6 +57,16 @@ export declare class UField extends UElement {
57
57
  * 다시 렌더하면 우리가 얹은 속성이 지워진다.
58
58
  */
59
59
  private get controlToName();
60
+ /** 라벨이 이름을 줄 수 있는 슬롯 컨트롤 전부 — form-associated 이거나 포커스 가능한 최상위 자식. */
61
+ private get nameCandidates();
62
+ /**
63
+ * 라벨이 «컨트롤 하나의 이름» 이 아니라 **묶음의 이름**이어야 하는가 — 컨트롤이 둘 이상이거나, 자기 글자로 이름을
64
+ * 갖는 컨트롤(버튼·링크·체크박스·스위치·라디오)일 때. 종전에는 언제나 첫 컨트롤에 라벨을 얹어, «밝은 모드 · 어두운 모드»
65
+ * 버튼 둘을 «테마» 로 묶은 필드에서 첫 버튼의 이름이 «테마» 가 됐다 — 보이는 글자와 이름이 어긋난다(WCAG 2.5.3).
66
+ */
67
+ private get labelsAGroup();
68
+ /** 묶음 이름(role=group)을 호스트에 — 섀도 밖 어떤 요소도 건드리지 않는다. */
69
+ private readonly internals;
60
70
  /**
61
71
  * 🔴**«이 필드가 이름 줄 컨트롤을 가졌는가» 는 «지금 포커스 가능한가» 와 다른 질문이다 —
62
72
  * 그 둘을 한 술어로 답한 것이 결함이었다.**
@@ -27,12 +27,20 @@ function isFormControlByStructure(node) {
27
27
  if (node.hasAttribute("contenteditable")) return true;
28
28
  return false;
29
29
  }
30
+ /** 자기 글자로 접근성 이름을 갖는 컨트롤 — 필드 라벨로 덮으면 보이는 글자와 이름이 어긋난다. */
31
+ var CONTENT_NAMED = /^(button|a|u-button|u-checkbox|u-switch|u-radio)$/;
32
+ var CONTENT_NAMED_ROLES = /^(button|link|checkbox|switch|radio)$/;
33
+ function isNamedByContent(el) {
34
+ const role = el.getAttribute("role");
35
+ return (CONTENT_NAMED.test(el.localName) || !!role && CONTENT_NAMED_ROLES.test(role)) && (el.textContent ?? "").trim() !== "";
36
+ }
30
37
  var UField = class UField extends UElement {
31
38
  constructor(..._args) {
32
39
  super(..._args);
33
40
  this.disabled = false;
34
41
  this.required = false;
35
42
  this.invalid = false;
43
+ this.internals = "attachInternals" in this ? this.attachInternals() : void 0;
36
44
  this.handleLabelClick = () => {
37
45
  this.focus();
38
46
  };
@@ -100,8 +108,20 @@ var UField = class UField extends UElement {
100
108
  * 다시 렌더하면 우리가 얹은 속성이 지워진다.
101
109
  */
102
110
  get controlToName() {
103
- for (const node of this.assignedRoots) if (node.constructor.formAssociated === true || isFocusable(node)) return node;
104
- return null;
111
+ return this.nameCandidates[0] ?? null;
112
+ }
113
+ /** 라벨이 이름을 줄 수 있는 슬롯 컨트롤 전부 — form-associated 이거나 포커스 가능한 최상위 자식. */
114
+ get nameCandidates() {
115
+ return this.assignedRoots.filter((node) => node.constructor.formAssociated === true || isFocusable(node));
116
+ }
117
+ /**
118
+ * 라벨이 «컨트롤 하나의 이름» 이 아니라 **묶음의 이름**이어야 하는가 — 컨트롤이 둘 이상이거나, 자기 글자로 이름을
119
+ * 갖는 컨트롤(버튼·링크·체크박스·스위치·라디오)일 때. 종전에는 언제나 첫 컨트롤에 라벨을 얹어, «밝은 모드 · 어두운 모드»
120
+ * 버튼 둘을 «테마» 로 묶은 필드에서 첫 버튼의 이름이 «테마» 가 됐다 — 보이는 글자와 이름이 어긋난다(WCAG 2.5.3).
121
+ */
122
+ get labelsAGroup() {
123
+ const candidates = this.nameCandidates;
124
+ return candidates.length > 1 || candidates.length === 1 && isNamedByContent(candidates[0]);
105
125
  }
106
126
  /**
107
127
  * 🔴**«이 필드가 이름 줄 컨트롤을 가졌는가» 는 «지금 포커스 가능한가» 와 다른 질문이다 —
@@ -162,6 +182,21 @@ var UField = class UField extends UElement {
162
182
  * (메시지 문안은 그대로다 — 키는 중복 제거 단위일 뿐 공개 표면이 아니다.)
163
183
  */
164
184
  nameSlottedControl() {
185
+ const group = !!this.label && this.labelsAGroup;
186
+ if (this.internals) {
187
+ this.internals.role = group ? "group" : null;
188
+ this.internals.ariaLabel = group ? this.label ?? null : null;
189
+ this.internals.ariaDescription = group ? this.description ?? null : null;
190
+ }
191
+ if (group) {
192
+ for (const c of this.nameCandidates) {
193
+ if (this.lastAppliedLabel !== void 0 && c.getAttribute("aria-label") === this.lastAppliedLabel) c.removeAttribute("aria-label");
194
+ if (this.lastAppliedDescription && c.getAttribute("aria-description") === this.lastAppliedDescription) c.removeAttribute("aria-description");
195
+ }
196
+ this.lastAppliedLabel = void 0;
197
+ this.lastAppliedDescription = void 0;
198
+ return;
199
+ }
165
200
  const control = this.controlToName;
166
201
  if (!control) {
167
202
  if (this.label && !this.hasControlInSubtree) devWarnOnce(`field-no-control:${this.label}`, `u-field label="${this.label}" has no form control in its default slot — the label names nothing. Slot a form control, or drop the label.`);
@@ -90,6 +90,12 @@ export declare class UInput extends UFormControlElement<string> {
90
90
  */
91
91
  size: FieldSize;
92
92
  /** placeholder 텍스트 */
93
+ /**
94
+ * 칸이 담을 글자 수 — 지정하면 폭을 정하지 않은 칸(기본 `inline-block`)이 «N자 + 접미 아이콘 + 패딩» 폭으로 그려지고,
95
+ * 그보다 좁게 주면 넘친다(글자 영역 하한이 N자가 된다). 네이티브 `<input size>`·CSS `field-sizing` 과 같은 축이다 —
96
+ * `size` 는 이 컴포넌트에서 크기 단(sm·md·lg)이라 이름이 다르다. 폭을 준 칸(`width`·`block`)에서는 하한으로만 쓴다.
97
+ */
98
+ chars?: number;
93
99
  placeholder?: string;
94
100
  /** 유효성 검사 패턴 (정규식) */
95
101
  pattern?: string;
@@ -115,6 +121,8 @@ export declare class UInput extends UFormControlElement<string> {
115
121
  * `string`이라 `valueAsString` 같은 변환 없이 그대로 넘긴다. */
116
122
  protected willUpdate(changedProperties: PropertyValues): void;
117
123
  protected updated(changedProperties: PropertyValues): void;
124
+ /** `chars` 를 CSS 길이로 — 양의 정수일 때만(그 밖은 지정 없음과 같다). */
125
+ private get charsWidth();
118
126
  /** The shown number uses the locale's decimal separator — re-show it in the new locale (unless the user is typing in it). */
119
127
  protected localeChanged(): void;
120
128
  /** Canonical `value` → the text shown: the locale's decimal separator, no grouping inserted. */
@@ -194,11 +194,12 @@ var UInput = class UInput extends UFormControlElement {
194
194
  .validationMessage=${this.validationMessage}
195
195
  >
196
196
  <div class="container" part="container"
197
- style=${`--_icons: ${(showStepper ? 2 : 0) + (showClear ? 1 : 0) + (showToggle ? 1 : 0)}`}>
197
+ style=${`--_icons: ${(showStepper ? 2 : 0) + (showClear ? 1 : 0) + (showToggle ? 1 : 0)}${this.charsWidth ? `; --input-min-text: ${this.charsWidth}` : ""}`}>
198
198
 
199
199
  <slot name="prefix"></slot>
200
200
 
201
201
  <input part="input"
202
+ style=${ifDefined(this.charsWidth ? `inline-size: ${this.charsWidth}` : void 0)}
202
203
  type=${isNumber || this.type === "password" && this.showPassword ? "text" : this.type}
203
204
  aria-label=${ifDefined(this.resolvedAriaLabel)}
204
205
  aria-description=${ifDefined(this.resolvedAriaDescription)}
@@ -305,6 +306,11 @@ var UInput = class UInput extends UFormControlElement {
305
306
  super.updated(changedProperties);
306
307
  if (changedProperties.has("value")) this.internals?.setFormValue(this.value ?? "");
307
308
  }
309
+ /** `chars` 를 CSS 길이로 — 양의 정수일 때만(그 밖은 지정 없음과 같다). */
310
+ get charsWidth() {
311
+ const n = this.chars;
312
+ return n != null && Number.isFinite(n) && n > 0 ? `${Math.ceil(n)}ch` : void 0;
313
+ }
308
314
  /** The shown number uses the locale's decimal separator — re-show it in the new locale (unless the user is typing in it). */
309
315
  localeChanged() {
310
316
  if (this.type === "number" && this.shadowRoot?.activeElement !== this.inputEl) this.numberText = this.displayNumber(this.value ?? "");
@@ -515,6 +521,10 @@ __decorate([property({
515
521
  type: String,
516
522
  reflect: true
517
523
  }), __decorateMetadata("design:type", Object)], UInput.prototype, "size", void 0);
524
+ __decorate([property({
525
+ type: Number,
526
+ reflect: true
527
+ }), __decorateMetadata("design:type", Number)], UInput.prototype, "chars", void 0);
518
528
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UInput.prototype, "placeholder", void 0);
519
529
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UInput.prototype, "pattern", void 0);
520
530
  __decorate([query(".container", true), __decorateMetadata("design:type", typeof HTMLDivElement === "undefined" ? Object : HTMLDivElement)], UInput.prototype, "containerEl", void 0);
@@ -21,6 +21,10 @@ export interface DialogOptions {
21
21
  backdropClose?: boolean;
22
22
  }
23
23
  /** Confirm Dialog 옵션 */
24
+ export interface AlertDialogOptions extends DialogOptions {
25
+ /** 닫는 버튼의 글자 (기본값: 로케일의 «확인»/`OK`) */
26
+ confirmLabel?: string;
27
+ }
24
28
  export interface ConfirmDialogOptions extends DialogOptions {
25
29
  /** 확인 버튼 텍스트 (기본: 현재 로케일의 `confirm` — 영어는 'Confirm') */
26
30
  confirmLabel?: string;
@@ -71,7 +75,7 @@ export declare class Dialog {
71
75
  * @param message 본문 — **문자열은 글자로** 그린다(사용자 입력을 넣어도 마크업이 되지 않는다). 서식이 필요하면
72
76
  * `TemplateResult`(`html\`…\``)를 넘긴다. HTML 문자열은 그것을 명시한 `show({ content })` 로만.
73
77
  */
74
- static alert(message: string | TemplateResult, options?: DialogOptions): Promise<void>;
78
+ static alert(message: string | TemplateResult, options?: AlertDialogOptions): Promise<void>;
75
79
  /**
76
80
  * 확인 다이얼로그를 표시합니다. (확인/취소 버튼)
77
81
  * @param message 본문 — **문자열은 글자로** 그린다(`alert` 와 같다). 서식은 `TemplateResult` 로.
@@ -44,7 +44,11 @@ var Dialog = class {
44
44
  const messageId = nextMessageId();
45
45
  await this.present({
46
46
  ...options,
47
- content: asText(message, messageId)
47
+ content: asText(message, messageId),
48
+ actions: [{
49
+ label: options?.confirmLabel || Locale.getValue("ok"),
50
+ value: "ok"
51
+ }]
48
52
  }, (dialog) => describe(dialog, messageId, "alertdialog"));
49
53
  }
50
54
  /**
@@ -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' | 'carousel' | 'slide' | 'slideOf' | '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';
15
+ export type LocaleMessageKey = 'valueMissing' | 'badInput' | 'typeMismatch' | 'patternMismatch' | 'rangeUnderflow' | 'rangeOverflow' | 'stepMismatch' | 'tooShort' | 'tooLong' | 'increment' | 'decrement' | 'clear' | 'today' | 'time' | 'showPassword' | 'hidePassword' | 'previousSlide' | 'nextSlide' | 'goToSlide' | 'carousel' | 'slide' | 'slideOf' | 'stopSlideRotation' | 'startSlideRotation' | 'chooseDate' | 'chooseDateRange' | 'yesterday' | 'last7Days' | 'last30Days' | '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' | 'ok' | 'stepComplete' | 'stepOnHold' | 'apply' | 'dateUnavailable' | 'startTime' | 'endTime' | 'timeAm' | 'timePm';
16
16
  type LocaleTable = Record<LocaleMessageKey, string>;
17
17
  /**
18
18
  * 한 패키지(또는 앱 영역)의 문자열 묶음.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/components",
3
3
  "description": "web-components library based on lit-element made by iyulab",
4
- "version": "2.8.0",
4
+ "version": "2.9.1",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",
@@ -35,6 +35,12 @@ is copied onto the slotted element as `aria-label` (and `description` as `aria-d
35
35
  label and the accessible name disagree (WCAG SC 2.5.3 Label in Name). Setting `label` on *both*
36
36
  renders the label twice; a development-mode console warning points at that spot.
37
37
 
38
+ **A label over several controls, or over one that names itself, names the group.** With two or more
39
+ controls slotted (a row of choice buttons), or a single button, link, checkbox, switch or radio that
40
+ has its own text, the field becomes a `group` named by the label (and described by `description`);
41
+ each control keeps its own name — "Theme" over "Light · Dark" reads as the group *Theme* with the
42
+ buttons *Light* and *Dark*, not a first button called *Theme*.
43
+
38
44
  ```html
39
45
  <!-- label on the field -->
40
46
  <u-field label="Email"><u-input type="email" name="email"></u-input></u-field>
@@ -57,6 +57,7 @@ the library does not infer one from field meaning.
57
57
  | `appearance` | `'outlined'\|'soft'\|'underlined'\|'plain'` | `'outlined'` | ✓ | How much chrome: `outlined` · `soft` tinted face · `underlined` bottom line only · `plain` no chrome |
58
58
  | `size` | `'sm'\|'md'\|'lg'` | `'md'` | ✓ | Field size, like a button's: 12px · `--u-density` (14px) · 16px. A field and a button of the same size share a height |
59
59
  | `type` | `'text'\|'password'\|'email'\|'tel'\|'url'\|'search'\|'number'\|'date'\|'time'`… | `'text'` | — | Input type |
60
+ | `chars` | `number` | — | ✓ | Characters the field holds. An unsized field draws at N characters + its suffix icons + padding; a sized one (`width`, `block`) uses it as the text floor, so a narrower box overflows. Not `size` — that is the sm/md/lg scale |
60
61
  | `placeholder` | `string` | — | — | Placeholder text |
61
62
  | `clearable` | `boolean` | `false` | ✓ | Show clear button |
62
63
  | `minlength` | `number` | — | — | Minimum character count |
@@ -40,7 +40,7 @@ const result = await Dialog.show({
40
40
 
41
41
  | Method | Returns | Description |
42
42
  |--------|---------|-------------|
43
- | `Dialog.alert(message, options?)` | `Promise<void>` | Informational alert |
43
+ | `Dialog.alert(message, options?)` | `Promise<void>` | Informational alert with one OK button (focused on open) |
44
44
  | `Dialog.confirm(message, options?)` | `Promise<boolean>` | Confirm / Cancel dialog |
45
45
  | `Dialog.prompt(message, options?)` | `Promise<string \| null>` | Text input dialog |
46
46
  | `Dialog.show(options)` | `Promise<string \| null>` | Custom dialog; resolves with clicked action `value` |
@@ -70,6 +70,10 @@ interface DialogOptions {
70
70
  backdropClose?: boolean; // close on backdrop click — default: true
71
71
  }
72
72
 
73
+ interface AlertDialogOptions extends DialogOptions {
74
+ confirmLabel?: string; // the OK button — default: the active locale's `ok` (en: 'OK', ko: '확인')
75
+ }
76
+
73
77
  interface ConfirmDialogOptions extends DialogOptions {
74
78
  confirmLabel?: string; // default: the active locale's `confirm` (en: 'Confirm')
75
79
  cancelLabel?: string; // default: the active locale's `cancel` (en: 'Cancel')