@iyulab/components 2.21.0 → 2.23.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 +70 -0
- package/dist/components/UElement.d.ts +5 -1
- package/dist/components/UElement.js +9 -2
- package/dist/components/UFormControlElement.d.ts +7 -0
- package/dist/components/UFormControlElement.js +11 -0
- package/dist/components/checkbox/UCheckbox.d.ts +3 -0
- package/dist/components/checkbox/UCheckbox.js +7 -0
- package/dist/components/field/UField.d.ts +54 -0
- package/dist/components/field/UField.js +107 -2
- package/dist/components/field/UField.styles.js +20 -0
- package/dist/components/form/UForm.js +2 -2
- package/dist/components/input/UInput.js +2 -2
- package/dist/components/option/UOption.d.ts +5 -0
- package/dist/components/option/UOption.js +5 -0
- package/dist/components/option/UOption.styles.js +7 -3
- package/dist/components/select/USelect.d.ts +34 -5
- package/dist/components/select/USelect.js +56 -11
- package/dist/components/switch/USwitch.d.ts +3 -0
- package/dist/components/switch/USwitch.js +7 -0
- package/dist/components/tooltip/UTooltip.d.ts +1 -1
- package/dist/components/tooltip/UTooltip.js +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/react/USelect.d.ts +2 -1
- package/dist/utilities/Locale.d.ts +21 -9
- package/dist/utilities/Locale.js +26 -0
- package/dist/utilities/composition.d.ts +43 -0
- package/dist/utilities/composition.js +76 -0
- package/dist/utilities/search.d.ts +29 -0
- package/dist/utilities/search.js +151 -0
- package/package.json +1 -1
- package/skills/iyulab-components/SKILL.md +2 -2
- package/skills/iyulab-components/references/components/field.md +20 -1
- package/skills/iyulab-components/references/components/form.md +2 -2
- package/skills/iyulab-components/references/components/option.md +1 -0
- package/skills/iyulab-components/references/components/select.md +5 -2
- package/skills/iyulab-components/references/components/tooltip.md +1 -1
- package/skills/iyulab-components/references/extensions/element.md +1 -1
- package/skills/iyulab-components/references/extensions/form-control.md +6 -0
- package/skills/iyulab-components/references/utilities/keyboard.md +38 -0
- package/skills/iyulab-components/references/utilities/locale.md +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.23.0] - 2026-10-13
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `u-field` can show its `description` as an info icon beside the label, with the text in a tooltip on hover, instead of
|
|
8
|
+
a line under the control: `description-display="hint"` on one field, or `UField.descriptionDisplay = 'hint'` once for
|
|
9
|
+
the whole app (that default also reaches the fields `u-input`, `u-select` and the other controls render internally).
|
|
10
|
+
The control keeps the text as `aria-description`, a validation message still shows under the control, and a field
|
|
11
|
+
without a label keeps the description inline. The hint opens on hovering the icon, on entering the field's control
|
|
12
|
+
from the keyboard (a click into the control does not), and on tapping the icon (touch); Escape or focus leaving the
|
|
13
|
+
field closes it. The icon is not a Tab stop.
|
|
14
|
+
- **`u-select searchable`: Enter in the search field picks the first match.** While there is a query, the first
|
|
15
|
+
visible option is the active candidate — shown like a hovered option (`u-option[active]`) and announced through the
|
|
16
|
+
search field's `aria-activedescendant` — and Enter selects it (and closes the list; with `multiple` it toggles and
|
|
17
|
+
the list stays open). Typing «ap» and pressing Enter used to do nothing; the match took ArrowDown, then Enter. The
|
|
18
|
+
Enter that commits an IME composition does not pick. Options a remote search puts in get a candidate as they arrive.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- An open `u-tooltip` closes on Escape — content shown on hover or focus could only be dismissed by moving the pointer
|
|
23
|
+
or the focus away (WCAG 1.4.13). The tooltip joins the overlay layer stack, so inside a dialog the first Escape
|
|
24
|
+
closes the tooltip and the next one the dialog.
|
|
25
|
+
|
|
26
|
+
## [2.22.0] - 2026-10-13
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- `u-select` `search` carries `detail.composing` — `true` while an IME composition (Korean, Japanese, Chinese) is in
|
|
31
|
+
progress, so `query` ends in a partial syllable (`ㅅ`, `성` on the way to `서울`). When the composition ends the event
|
|
32
|
+
fires again with `composing: false` and the finished text; Chromium sends no plain `input` at that point, so a
|
|
33
|
+
consumer that skipped composing events had no way to see the finished query. A consumer that searches a server can
|
|
34
|
+
now skip composing queries. `search` no longer repeats an unchanged query.
|
|
35
|
+
- **Search matching** — `Locale.matchesSearch(text, query, options?)` and `Locale.registerSearch(locale, matcher)`. The
|
|
36
|
+
default rule folds case and diacritics and compares Hangul syllables whole; with `composing: true` the query's last
|
|
37
|
+
syllable, still being typed, is compared as the jamo in typing order, so it matches the word it is becoming (`성`
|
|
38
|
+
and `서우` match `서울`). A query of consonants only matches initials (`ㅅㅇ` finds `서울`). `defaultSearchMatch`,
|
|
39
|
+
`foldForSearch`, `hangulKeystrokes` and `initialsOf` are exported from `utilities/search`;
|
|
40
|
+
`CompositionTracker.searchQuery(input)` gives the query and the flag together.
|
|
41
|
+
`u-select searchable` filters with it — typing `서울` with a Korean IME narrows to `서울` and `성남` at `성` and to
|
|
42
|
+
`서울` at `서우`, instead of waiting for the syllable to be committed. A language's own rule is registered with
|
|
43
|
+
`registerSearch`.
|
|
44
|
+
- `CompositionTracker` and `replayInput` (`utilities/composition`) — for an input that filters or searches as you type.
|
|
45
|
+
Attach a tracker to the input's `compositionstart`, `compositionupdate` and `compositionend`; `composing` says an IME
|
|
46
|
+
composition is in progress and `settled(input)` gives the text without the syllable still being composed. Filtering
|
|
47
|
+
on the settled text never hides an item the finished text would match. `new CompositionTracker(replayInput)` re-runs
|
|
48
|
+
the input's own `input` handler when the composition ends, for an input that waits until then.
|
|
49
|
+
- `modelValue` on form controls — the value a `u-form` reads into and writes from its `model`. It is `value` by
|
|
50
|
+
default; `u-checkbox` and `u-switch` exchange `checked`. A custom control whose state lives in another property
|
|
51
|
+
overrides it.
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- `u-select searchable` no longer hides options or announces "No matches" for a syllable still being composed. It
|
|
56
|
+
filtered on every composition step, so typing «서울» with a Korean IME showed no options and announced "No matches"
|
|
57
|
+
at «ㅅ», and showed only «성남» at «성». While composing it now filters on the committed part only, which never hides
|
|
58
|
+
an option the finished text would match; "No matches" appears only when the committed part already matches nothing.
|
|
59
|
+
- `u-input` keeps `value` in step with the box during an IME composition. It used to update only when the composition
|
|
60
|
+
ended, so the `input` events an ancestor received during composition read an old value (`undefined` or the previous
|
|
61
|
+
syllable while the box showed «서울»). These events are now re-dispatched from the host and keep `isComposing`.
|
|
62
|
+
- Events re-dispatched from a control's host now bubble and cross shadow roots. `relay()` copied the original event
|
|
63
|
+
with object spread, which does not include `bubbles`, `composed`, `cancelable` or `InputEvent` fields (they are
|
|
64
|
+
prototype getters), so the re-dispatched event reached only listeners on the host itself. Affected: `change` from
|
|
65
|
+
`u-checkbox`, `u-switch`, `u-textarea` and `u-file-input`, and `input` from `u-input` and `u-textarea`. A listener
|
|
66
|
+
on an ancestor — a delegated handler, a dirty-state tracker, `u-form` — now receives each of these once, and
|
|
67
|
+
`InputEvent.data` and `inputType` are kept.
|
|
68
|
+
- `u-form` keeps `model` in step with checkboxes and switches in both directions. It used to read and write their
|
|
69
|
+
`value` (the submitted text), so a checked box put `undefined` in the model and `model.agree = true` did not check
|
|
70
|
+
the box. With the propagation fix above, user edits in a checkbox, switch, textarea or file input now update
|
|
71
|
+
`model` — before, only `u-input` reached it.
|
|
72
|
+
|
|
3
73
|
## [2.21.0] - 2026-10-12
|
|
4
74
|
|
|
5
75
|
### Added
|
|
@@ -33,9 +33,13 @@ export declare class UElement extends LitElement {
|
|
|
33
33
|
protected fire<T>(name: string, options?: CustomEventInit): boolean;
|
|
34
34
|
/**
|
|
35
35
|
* 네이티브 이벤트를 호스트 엘리먼트에서 (재)발행합니다.
|
|
36
|
-
* 기존 이벤트를 전달하면 원본을 중단하고 동일
|
|
36
|
+
* 기존 이벤트를 전달하면 원본을 중단하고 동일 타입·동일 초기값으로 재발행하며,
|
|
37
37
|
* 새 이벤트를 직접 전달할 수도 있습니다.
|
|
38
38
|
*
|
|
39
|
+
* 재발행한 이벤트는 원본의 `bubbles`·`cancelable` 과 타입별 값(`InputEvent` 의 `data`·`inputType`,
|
|
40
|
+
* `CustomEvent` 의 `detail` 등)을 잇고, 호스트가 공개 경계이므로 `composed: true` 로 섀도를 넘는다
|
|
41
|
+
* (`fire()` 와 같은 전파). 네이티브 `change` 처럼 원본이 섀도 안에 머무는 이벤트도 호스트의 조상에 닿는다.
|
|
42
|
+
*
|
|
39
43
|
* @param event - 재발행할 이벤트 또는 새로 생성한 네이티브 이벤트
|
|
40
44
|
* @param options - EventInit 오버라이드
|
|
41
45
|
* @returns preventDefault가 호출되지 않았으면 true
|
|
@@ -90,18 +90,25 @@ var UElement = class extends LitElement {
|
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
92
|
* 네이티브 이벤트를 호스트 엘리먼트에서 (재)발행합니다.
|
|
93
|
-
* 기존 이벤트를 전달하면 원본을 중단하고 동일
|
|
93
|
+
* 기존 이벤트를 전달하면 원본을 중단하고 동일 타입·동일 초기값으로 재발행하며,
|
|
94
94
|
* 새 이벤트를 직접 전달할 수도 있습니다.
|
|
95
95
|
*
|
|
96
|
+
* 재발행한 이벤트는 원본의 `bubbles`·`cancelable` 과 타입별 값(`InputEvent` 의 `data`·`inputType`,
|
|
97
|
+
* `CustomEvent` 의 `detail` 등)을 잇고, 호스트가 공개 경계이므로 `composed: true` 로 섀도를 넘는다
|
|
98
|
+
* (`fire()` 와 같은 전파). 네이티브 `change` 처럼 원본이 섀도 안에 머무는 이벤트도 호스트의 조상에 닿는다.
|
|
99
|
+
*
|
|
96
100
|
* @param event - 재발행할 이벤트 또는 새로 생성한 네이티브 이벤트
|
|
97
101
|
* @param options - EventInit 오버라이드
|
|
98
102
|
* @returns preventDefault가 호출되지 않았으면 true
|
|
99
103
|
*/
|
|
100
104
|
relay(event, options) {
|
|
101
105
|
event.stopImmediatePropagation();
|
|
106
|
+
const init = {};
|
|
107
|
+
for (const key in event) init[key] = event[key];
|
|
102
108
|
const ctor = event.constructor;
|
|
103
109
|
return this.dispatchEvent(new ctor(event.type, {
|
|
104
|
-
...
|
|
110
|
+
...init,
|
|
111
|
+
composed: true,
|
|
105
112
|
...options
|
|
106
113
|
}));
|
|
107
114
|
}
|
|
@@ -38,6 +38,13 @@ export declare abstract class UFormControlElement<T> extends UElement {
|
|
|
38
38
|
* (이전의 type: Object는 JSON.parse 실패로 일반 문자열 attribute가 silently null이 되는 갭이 있었다)
|
|
39
39
|
* string이 아닌 값 타입을 갖는 컨트롤(URating/USlider/USelect multiple)은 자신의 converter로 override한다. */
|
|
40
40
|
value?: T;
|
|
41
|
+
/**
|
|
42
|
+
* `u-form` 의 `model` 과 주고받는 값. 기본은 `value` 다.
|
|
43
|
+
* 상태를 다른 속성에 두는 컨트롤(체크박스 · 스위치의 `checked`)은 그 상태를 돌려주고 받도록 재정의한다 —
|
|
44
|
+
* 제출값(`value`)과 모델이 담을 상태는 다를 수 있다.
|
|
45
|
+
*/
|
|
46
|
+
get modelValue(): unknown;
|
|
47
|
+
set modelValue(value: unknown);
|
|
41
48
|
/**
|
|
42
49
|
* ElementInternals는 폼과의 연동, 유효성 검사 상태 관리 등을 지원하는 네이티브 API입니다.
|
|
43
50
|
*/
|
|
@@ -23,6 +23,17 @@ var UFormControlElement = class extends UElement {
|
|
|
23
23
|
return this.disabled || this.formDisabled;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
+
* `u-form` 의 `model` 과 주고받는 값. 기본은 `value` 다.
|
|
27
|
+
* 상태를 다른 속성에 두는 컨트롤(체크박스 · 스위치의 `checked`)은 그 상태를 돌려주고 받도록 재정의한다 —
|
|
28
|
+
* 제출값(`value`)과 모델이 담을 상태는 다를 수 있다.
|
|
29
|
+
*/
|
|
30
|
+
get modelValue() {
|
|
31
|
+
return this.value;
|
|
32
|
+
}
|
|
33
|
+
set modelValue(value) {
|
|
34
|
+
this.value = value;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
26
37
|
* 폼과의 연동을 위해 `form` 속성을 제공합니다. ElementInternals를 지원하는 브라우저에서 폼 요소에 접근할 수 있습니다.
|
|
27
38
|
* 지원하지 않는 브라우저에서는 null을 반환합니다.
|
|
28
39
|
*/
|
|
@@ -32,6 +32,9 @@ export declare class UCheckbox extends UFormControlElement<string> {
|
|
|
32
32
|
indeterminate: boolean;
|
|
33
33
|
/** 체크 여부 */
|
|
34
34
|
checked: boolean;
|
|
35
|
+
/** `u-form` 의 `model` 에는 제출값(`value`)이 아니라 켬/끔 상태를 싣는다. */
|
|
36
|
+
get modelValue(): unknown;
|
|
37
|
+
set modelValue(value: unknown);
|
|
35
38
|
/**
|
|
36
39
|
* 네이티브 `defaultChecked` 에 해당하는 값 — **처음 연결될 때의 `checked` 속성**.
|
|
37
40
|
* `checked` 는 반영(reflect)되는 속성이라 사용자가 바꾸면 속성도 바뀐다. 그래서 속성을
|
|
@@ -29,6 +29,13 @@ var UCheckbox = class UCheckbox extends UFormControlElement {
|
|
|
29
29
|
static {
|
|
30
30
|
this.styles = [super.styles, styles];
|
|
31
31
|
}
|
|
32
|
+
/** `u-form` 의 `model` 에는 제출값(`value`)이 아니라 켬/끔 상태를 싣는다. */
|
|
33
|
+
get modelValue() {
|
|
34
|
+
return this.checked;
|
|
35
|
+
}
|
|
36
|
+
set modelValue(value) {
|
|
37
|
+
this.checked = Boolean(value);
|
|
38
|
+
}
|
|
32
39
|
connectedCallback() {
|
|
33
40
|
this.defaultChecked ??= this.hasAttribute("checked");
|
|
34
41
|
super.connectedCallback();
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
2
|
import { UElement } from '../UElement.js';
|
|
3
|
+
/**
|
|
4
|
+
* 설명(`description`)을 어디에 보이는가.
|
|
5
|
+
* - `inline` — 컨트롤 아래 한 줄(기본).
|
|
6
|
+
* - `hint` — 라벨 옆 정보 아이콘에 마우스를 올리면 툴팁으로. 컨트롤 아래 공간을 쓰지 않아 폼이 촘촘해진다.
|
|
7
|
+
* 설명은 두 방식 모두 컨트롤의 `aria-description` 으로도 전달된다(보조기기에는 차이가 없다).
|
|
8
|
+
* 유효성 검사 메시지는 방식과 무관하게 언제나 아래에 보인다 — 오류는 숨기지 않는다.
|
|
9
|
+
* 라벨이 없으면 아이콘을 둘 자리가 없어 `inline` 으로 보인다.
|
|
10
|
+
*/
|
|
11
|
+
export type FieldDescriptionDisplay = 'inline' | 'hint';
|
|
3
12
|
/**
|
|
4
13
|
* 폼 컨트롤의 공통 레이아웃을 제공하는 필드 컴포넌트입니다.
|
|
5
14
|
* 라벨, 필수 표시, 설명 텍스트, 유효성 검사 메시지를 포함합니다.
|
|
6
15
|
*
|
|
7
16
|
* @slot - 폼 컨트롤 (input, select, textarea 등)
|
|
8
17
|
* @slot label-aside - 라벨 오른쪽 슬롯 영역 (숫자 표시, 알림 등)
|
|
18
|
+
* @csspart hint - `description-display="hint"` 의 정보 아이콘 감싸개
|
|
19
|
+
* @csspart hint-tooltip - 그 툴팁
|
|
9
20
|
*/
|
|
10
21
|
export declare class UField extends UElement {
|
|
11
22
|
static styles: import('lit').CSSResultGroup[];
|
|
@@ -28,7 +39,50 @@ export declare class UField extends UElement {
|
|
|
28
39
|
* 형제 프로퍼티들도 명시형을 쓴다(`show-delay`·`hide-delay`).
|
|
29
40
|
*/
|
|
30
41
|
validationMessage?: string;
|
|
42
|
+
/**
|
|
43
|
+
* 설명을 보이는 방식 — 비우면 앱 전역 기본값(`UField.descriptionDisplay`)을 따른다.
|
|
44
|
+
* 컨트롤(`u-input` 등)이 안에 두는 필드는 전역 기본값을 따르므로, 앱 전체를 바꿀 때는 전역 기본값을 쓴다.
|
|
45
|
+
*/
|
|
46
|
+
descriptionDisplay?: FieldDescriptionDisplay;
|
|
47
|
+
/**
|
|
48
|
+
* 앱 전역 기본값 — 앱 시작 때 한 번 정한다(예: `UField.descriptionDisplay = 'hint'`). 이미 그려진 필드는 다음 렌더부터 따른다.
|
|
49
|
+
* @default 'inline'
|
|
50
|
+
*/
|
|
51
|
+
static descriptionDisplay: FieldDescriptionDisplay;
|
|
52
|
+
/** 이 필드에서 실제로 쓰는 방식 — 라벨이 없으면 아이콘을 둘 자리가 없어 `inline`. */
|
|
53
|
+
private get effectiveDescriptionDisplay();
|
|
31
54
|
render(): import('lit-html').TemplateResult<1>;
|
|
55
|
+
/**
|
|
56
|
+
* `hint` — 라벨 옆 정보 아이콘 + 툴팁. 설명은 컨트롤의 `aria-description` 으로 이미 전달되므로 아이콘은 보조기기에서 숨긴다.
|
|
57
|
+
* 툴팁은 라벨 «위»(입력 칸을 가리지 않는다) · 아이콘 왼쪽 끝에 맞추고 화면 밖으로 나가면 밀어 넣는다.
|
|
58
|
+
*
|
|
59
|
+
* 여는 길은 셋이다 — 아이콘에 마우스를 올린다 · 필드의 컨트롤에 **키보드로** 들어온다(Tab · 프로그램 `focus()` — 눈으로 보는 키보드
|
|
60
|
+
* 사용자는 마우스가 없다) · 아이콘을 **탭**한다(터치에는 오버가 없다). 아이콘을 포커스 가능한 버튼으로 만들지 않는
|
|
61
|
+
* 이유: 칸이 수십 개인 폼에서 탭 정지가 칸마다 하나씩 늘어난다. 닫는 길은 Escape(툴팁이 층이다) · 포커스가 필드를
|
|
62
|
+
* 떠남 · 바깥 탭.
|
|
63
|
+
*/
|
|
64
|
+
private renderHint;
|
|
65
|
+
private get hintEl();
|
|
66
|
+
private get hintTooltip();
|
|
67
|
+
/** 아이콘을 누른 포인터의 종류 — 터치·펜의 탭만 «고정해서 연다». 마우스는 오버가 이미 열었다. */
|
|
68
|
+
private hintPointerType;
|
|
69
|
+
/** 탭으로 고정해 연 상태 — 오버의 `pointerleave` 가 닫아도 탭이 다시 연다. 바깥 탭 · 두 번째 탭이 푼다. */
|
|
70
|
+
private hintPinned;
|
|
71
|
+
private handleHintPointerDown;
|
|
72
|
+
private handleHintClick;
|
|
73
|
+
private handleOutsidePointerDown;
|
|
74
|
+
private unpinHint;
|
|
75
|
+
/**
|
|
76
|
+
* 필드 안을 포인터로 눌러 생긴 포커스인가. `:focus-visible` 로는 가르지 못한다 — 글자를 받는 입력은 마우스로 눌러도
|
|
77
|
+
* 늘 `:focus-visible` 이다(브라우저 휴리스틱). 그래서 누름을 직접 본다: 필드 안 `pointerdown` 뒤의 첫 포커스가 그것이다.
|
|
78
|
+
*/
|
|
79
|
+
private focusByPointer;
|
|
80
|
+
private handleHostPointerDown;
|
|
81
|
+
/** 컨트롤에 키보드로 들어오면 설명을 보인다 — 포인터로 누른 포커스에는 열지 않는다(마우스에는 오버가 있다). */
|
|
82
|
+
private handleFocusIn;
|
|
83
|
+
private handleFocusOut;
|
|
84
|
+
connectedCallback(): void;
|
|
85
|
+
disconnectedCallback(): void;
|
|
32
86
|
private renderFooter;
|
|
33
87
|
/** 슬롯에 꽂힌 첫 포커스 가능 자식으로 위임한다 — 라벨 클릭과 같은 대상 탐색 로직을
|
|
34
88
|
* 공개 API로도 노출해, 소비자가 임의의 폼 컨트롤(자체 웹 컴포넌트가 아닌 것 포함)을
|
|
@@ -3,11 +3,14 @@ import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.153.0/hel
|
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.js";
|
|
4
4
|
import { HostAria } from "../../utilities/hostAria.js";
|
|
5
5
|
import { devWarnOnce } from "../../utilities/devWarning.js";
|
|
6
|
+
import "../icon/UIcon.js";
|
|
7
|
+
import "../tooltip/UTooltip.js";
|
|
6
8
|
import { styles } from "./UField.styles.js";
|
|
7
9
|
import { html, nothing } from "lit";
|
|
8
10
|
import { customElement, property } from "lit/decorators.js";
|
|
9
11
|
import { isFocusable } from "tabbable";
|
|
10
12
|
//#region src/components/field/UField.ts
|
|
13
|
+
var _UField;
|
|
11
14
|
/** 네이티브로 «폼 컨트롤이거나 포커스를 받도록 저작된» 태그 — 가시성과 무관한 구조 사실이다. */
|
|
12
15
|
var NATIVE_CONTROL_TAGS = /* @__PURE__ */ new Set([
|
|
13
16
|
"INPUT",
|
|
@@ -36,11 +39,58 @@ function isNamedByContent(el) {
|
|
|
36
39
|
return (CONTENT_NAMED.test(el.localName) || !!role && CONTENT_NAMED_ROLES.test(role)) && (el.textContent ?? "").trim() !== "";
|
|
37
40
|
}
|
|
38
41
|
var UField = class UField extends UElement {
|
|
42
|
+
static {
|
|
43
|
+
_UField = this;
|
|
44
|
+
}
|
|
39
45
|
constructor(..._args) {
|
|
40
46
|
super(..._args);
|
|
41
47
|
this.disabled = false;
|
|
42
48
|
this.required = false;
|
|
43
49
|
this.invalid = false;
|
|
50
|
+
this.hintPointerType = "";
|
|
51
|
+
this.hintPinned = false;
|
|
52
|
+
this.handleHintPointerDown = (e) => {
|
|
53
|
+
this.hintPointerType = e.pointerType;
|
|
54
|
+
};
|
|
55
|
+
this.handleHintClick = () => {
|
|
56
|
+
if (this.hintPointerType !== "touch" && this.hintPointerType !== "pen") return;
|
|
57
|
+
if (this.hintPinned) {
|
|
58
|
+
this.unpinHint();
|
|
59
|
+
this.hintTooltip?.hide();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const hint = this.hintEl;
|
|
63
|
+
if (!hint) return;
|
|
64
|
+
this.hintPinned = true;
|
|
65
|
+
document.addEventListener("pointerdown", this.handleOutsidePointerDown, true);
|
|
66
|
+
this.hintTooltip?.show(hint);
|
|
67
|
+
};
|
|
68
|
+
this.handleOutsidePointerDown = (e) => {
|
|
69
|
+
const hint = this.hintEl;
|
|
70
|
+
if (hint && e.composedPath().includes(hint)) return;
|
|
71
|
+
this.unpinHint();
|
|
72
|
+
this.hintTooltip?.hide();
|
|
73
|
+
};
|
|
74
|
+
this.focusByPointer = false;
|
|
75
|
+
this.handleHostPointerDown = () => {
|
|
76
|
+
this.focusByPointer = true;
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
this.focusByPointer = false;
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
this.handleFocusIn = () => {
|
|
82
|
+
const byPointer = this.focusByPointer;
|
|
83
|
+
this.focusByPointer = false;
|
|
84
|
+
const hint = this.hintEl;
|
|
85
|
+
if (!hint || byPointer) return;
|
|
86
|
+
this.hintTooltip?.show(hint);
|
|
87
|
+
};
|
|
88
|
+
this.handleFocusOut = (e) => {
|
|
89
|
+
const next = e.relatedTarget;
|
|
90
|
+
if (next instanceof Node && (this.contains(next) || this.shadowRoot?.contains(next))) return;
|
|
91
|
+
if (this.hintPinned) return;
|
|
92
|
+
this.hintTooltip?.hide();
|
|
93
|
+
};
|
|
44
94
|
this.aria = new HostAria(this);
|
|
45
95
|
this.handleLabelClick = () => {
|
|
46
96
|
this.focus();
|
|
@@ -49,6 +99,13 @@ var UField = class UField extends UElement {
|
|
|
49
99
|
static {
|
|
50
100
|
this.styles = [super.styles, styles];
|
|
51
101
|
}
|
|
102
|
+
static {
|
|
103
|
+
this.descriptionDisplay = "inline";
|
|
104
|
+
}
|
|
105
|
+
/** 이 필드에서 실제로 쓰는 방식 — 라벨이 없으면 아이콘을 둘 자리가 없어 `inline`. */
|
|
106
|
+
get effectiveDescriptionDisplay() {
|
|
107
|
+
return (this.descriptionDisplay ?? _UField.descriptionDisplay) === "hint" && this.label ? "hint" : "inline";
|
|
108
|
+
}
|
|
52
109
|
render() {
|
|
53
110
|
return html`
|
|
54
111
|
<div class="header" ?hidden=${!this.label}>
|
|
@@ -56,6 +113,7 @@ var UField = class UField extends UElement {
|
|
|
56
113
|
<span class="required" ?hidden=${!this.required}>*</span>
|
|
57
114
|
${this.label}
|
|
58
115
|
</label>
|
|
116
|
+
${this.renderHint()}
|
|
59
117
|
<slot name="label-aside"></slot>
|
|
60
118
|
</div>
|
|
61
119
|
|
|
@@ -64,8 +122,51 @@ var UField = class UField extends UElement {
|
|
|
64
122
|
${this.renderFooter()}
|
|
65
123
|
`;
|
|
66
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* `hint` — 라벨 옆 정보 아이콘 + 툴팁. 설명은 컨트롤의 `aria-description` 으로 이미 전달되므로 아이콘은 보조기기에서 숨긴다.
|
|
127
|
+
* 툴팁은 라벨 «위»(입력 칸을 가리지 않는다) · 아이콘 왼쪽 끝에 맞추고 화면 밖으로 나가면 밀어 넣는다.
|
|
128
|
+
*
|
|
129
|
+
* 여는 길은 셋이다 — 아이콘에 마우스를 올린다 · 필드의 컨트롤에 **키보드로** 들어온다(Tab · 프로그램 `focus()` — 눈으로 보는 키보드
|
|
130
|
+
* 사용자는 마우스가 없다) · 아이콘을 **탭**한다(터치에는 오버가 없다). 아이콘을 포커스 가능한 버튼으로 만들지 않는
|
|
131
|
+
* 이유: 칸이 수십 개인 폼에서 탭 정지가 칸마다 하나씩 늘어난다. 닫는 길은 Escape(툴팁이 층이다) · 포커스가 필드를
|
|
132
|
+
* 떠남 · 바깥 탭.
|
|
133
|
+
*/
|
|
134
|
+
renderHint() {
|
|
135
|
+
if (!this.description || this.effectiveDescriptionDisplay !== "hint") return nothing;
|
|
136
|
+
return html`
|
|
137
|
+
<span class="hint" part="hint" aria-hidden="true"
|
|
138
|
+
@pointerdown=${this.handleHintPointerDown}
|
|
139
|
+
@click=${this.handleHintClick}>
|
|
140
|
+
<u-icon lib="internal" name="info-circle-fill"></u-icon>
|
|
141
|
+
<u-tooltip part="hint-tooltip" placement="top-start" shift>${this.description}</u-tooltip>
|
|
142
|
+
</span>
|
|
143
|
+
`;
|
|
144
|
+
}
|
|
145
|
+
get hintEl() {
|
|
146
|
+
return this.shadowRoot?.querySelector(".hint") ?? null;
|
|
147
|
+
}
|
|
148
|
+
get hintTooltip() {
|
|
149
|
+
return this.shadowRoot?.querySelector(".hint u-tooltip") ?? null;
|
|
150
|
+
}
|
|
151
|
+
unpinHint() {
|
|
152
|
+
this.hintPinned = false;
|
|
153
|
+
document.removeEventListener("pointerdown", this.handleOutsidePointerDown, true);
|
|
154
|
+
}
|
|
155
|
+
connectedCallback() {
|
|
156
|
+
super.connectedCallback();
|
|
157
|
+
this.addEventListener("pointerdown", this.handleHostPointerDown, true);
|
|
158
|
+
this.addEventListener("focusin", this.handleFocusIn);
|
|
159
|
+
this.addEventListener("focusout", this.handleFocusOut);
|
|
160
|
+
}
|
|
161
|
+
disconnectedCallback() {
|
|
162
|
+
this.removeEventListener("pointerdown", this.handleHostPointerDown, true);
|
|
163
|
+
this.removeEventListener("focusin", this.handleFocusIn);
|
|
164
|
+
this.removeEventListener("focusout", this.handleFocusOut);
|
|
165
|
+
this.unpinHint();
|
|
166
|
+
super.disconnectedCallback();
|
|
167
|
+
}
|
|
67
168
|
renderFooter() {
|
|
68
|
-
const message = this.invalid && this.validationMessage ? this.validationMessage : this.description;
|
|
169
|
+
const message = this.invalid && this.validationMessage ? this.validationMessage : this.effectiveDescriptionDisplay === "inline" ? this.description : void 0;
|
|
69
170
|
if (!message) return nothing;
|
|
70
171
|
return html`<div class="footer">${message}</div>`;
|
|
71
172
|
}
|
|
@@ -259,6 +360,10 @@ __decorate([property({
|
|
|
259
360
|
type: String,
|
|
260
361
|
attribute: "validation-message"
|
|
261
362
|
}), __decorateMetadata("design:type", String)], UField.prototype, "validationMessage", void 0);
|
|
262
|
-
|
|
363
|
+
__decorate([property({
|
|
364
|
+
type: String,
|
|
365
|
+
attribute: "description-display"
|
|
366
|
+
}), __decorateMetadata("design:type", Object)], UField.prototype, "descriptionDisplay", void 0);
|
|
367
|
+
UField = _UField = __decorate([customElement("u-field")], UField);
|
|
263
368
|
//#endregion
|
|
264
369
|
export { UField };
|
|
@@ -40,6 +40,26 @@ var styles = css`
|
|
|
40
40
|
user-select: none;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
.hint {
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
margin-inline-start: 0.35em;
|
|
47
|
+
margin-inline-end: auto;
|
|
48
|
+
color: var(--u-txt-color-weak, #616161);
|
|
49
|
+
font-size: 1.05em;
|
|
50
|
+
cursor: help;
|
|
51
|
+
}
|
|
52
|
+
.hint:hover {
|
|
53
|
+
color: var(--u-txt-color, #212121);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.hint u-tooltip {
|
|
57
|
+
max-width: min(20rem, calc(100vw - 2rem));
|
|
58
|
+
white-space: normal;
|
|
59
|
+
font-weight: 400;
|
|
60
|
+
line-height: 1.45;
|
|
61
|
+
}
|
|
62
|
+
|
|
43
63
|
.label {
|
|
44
64
|
font-weight: 500;
|
|
45
65
|
line-height: 1.25;
|
|
@@ -20,7 +20,7 @@ var UForm = class UForm extends UElement {
|
|
|
20
20
|
const target = e.target;
|
|
21
21
|
if (!(target instanceof UFormControlElement)) return;
|
|
22
22
|
const name = target.name;
|
|
23
|
-
const value = target.
|
|
23
|
+
const value = target.modelValue;
|
|
24
24
|
if (!name) return;
|
|
25
25
|
if (!this.isIncluded(target)) return;
|
|
26
26
|
if (this.model && typeof this.model === "object") this.model[name] = value;
|
|
@@ -81,7 +81,7 @@ var UForm = class UForm extends UElement {
|
|
|
81
81
|
}
|
|
82
82
|
sync() {
|
|
83
83
|
if (!this.model) return;
|
|
84
|
-
for (const control of this.getControls()) if (control.name && control.name in this.model) control.
|
|
84
|
+
for (const control of this.getControls()) if (control.name && control.name in this.model) control.modelValue = this.model[control.name];
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* 포함된 컨트롤을 문서 순서로 모은다 — 슬롯에 배정된 요소 **와 그 자손**이 대상이다. 감싸개(`u-field` 등) 안의
|
|
@@ -53,8 +53,8 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
53
53
|
this.inputEl?.dispatchEvent(new InputEvent("input", { bubbles: true }));
|
|
54
54
|
};
|
|
55
55
|
this.handleInputInput = (e) => {
|
|
56
|
-
if (this.composing) return;
|
|
57
56
|
if (this.type === "number") {
|
|
57
|
+
if (this.composing) return;
|
|
58
58
|
const text = this.inputEl?.value ?? "";
|
|
59
59
|
if (text === this.numberText) return;
|
|
60
60
|
this.syncNumberFromText(text);
|
|
@@ -62,7 +62,7 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
const next = this.inputEl?.value;
|
|
65
|
-
if (next === this.value) return;
|
|
65
|
+
if (!e.isTrusted && next === this.value) return;
|
|
66
66
|
this.value = next;
|
|
67
67
|
this.relay(e);
|
|
68
68
|
};
|
|
@@ -34,6 +34,11 @@ export declare class UOption extends UElement {
|
|
|
34
34
|
disabled: boolean;
|
|
35
35
|
/** 선택 여부 */
|
|
36
36
|
selected: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The candidate Enter picks from the owning select's search box — shown like a hovered option. Set by `u-select`
|
|
39
|
+
* while its search box has the focus; not meant to be set by hand.
|
|
40
|
+
*/
|
|
41
|
+
active: boolean;
|
|
37
42
|
/** 옵션 마커 유형. 'radio'는 원형, 'check'는 체크 모양의 마커를 표시합니다. */
|
|
38
43
|
marker?: OptionMarker;
|
|
39
44
|
/** 옵션 고유값 */
|
|
@@ -11,6 +11,7 @@ var UOption = class UOption extends UElement {
|
|
|
11
11
|
super(..._args);
|
|
12
12
|
this.disabled = false;
|
|
13
13
|
this.selected = false;
|
|
14
|
+
this.active = false;
|
|
14
15
|
this.value = "";
|
|
15
16
|
}
|
|
16
17
|
static {
|
|
@@ -84,6 +85,10 @@ __decorate([property({
|
|
|
84
85
|
type: Boolean,
|
|
85
86
|
reflect: true
|
|
86
87
|
}), __decorateMetadata("design:type", Boolean)], UOption.prototype, "selected", void 0);
|
|
88
|
+
__decorate([property({
|
|
89
|
+
type: Boolean,
|
|
90
|
+
reflect: true
|
|
91
|
+
}), __decorateMetadata("design:type", Boolean)], UOption.prototype, "active", void 0);
|
|
87
92
|
__decorate([property({
|
|
88
93
|
type: String,
|
|
89
94
|
reflect: true
|
|
@@ -33,7 +33,9 @@ var styles = css`
|
|
|
33
33
|
display: flex;
|
|
34
34
|
flex-direction: row;
|
|
35
35
|
align-items: center;
|
|
36
|
-
padding: var(--option-padding-block) var(--option-padding-inline)
|
|
36
|
+
padding: var(--option-padding-block) var(--option-padding-inline);
|
|
37
|
+
|
|
38
|
+
min-height: var(--u-target-size, 0px);
|
|
37
39
|
border-radius: inherit;
|
|
38
40
|
}
|
|
39
41
|
:host(:focus-visible) {
|
|
@@ -45,7 +47,8 @@ var styles = css`
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
:host(:not([disabled]):hover),
|
|
48
|
-
:host(:not([disabled]):focus-visible)
|
|
50
|
+
:host(:not([disabled]):focus-visible),
|
|
51
|
+
:host([active]:not([disabled])) {
|
|
49
52
|
color: var(--option-color-interactive);
|
|
50
53
|
border-color: var(--option-border-color-interactive);
|
|
51
54
|
background-color: var(--option-background-color-interactive);
|
|
@@ -57,7 +60,8 @@ var styles = css`
|
|
|
57
60
|
background-color: var(--option-background-color-active);
|
|
58
61
|
}
|
|
59
62
|
:host([selected]:hover),
|
|
60
|
-
:host([selected]:focus-visible)
|
|
63
|
+
:host([selected]:focus-visible),
|
|
64
|
+
:host([selected][active]) {
|
|
61
65
|
color: var(--option-color-active-interactive);
|
|
62
66
|
border-color: var(--option-border-color-active-interactive);
|
|
63
67
|
background-color: var(--option-background-color-active-interactive);
|
|
@@ -35,7 +35,7 @@ import { UPopover } from '../popover/UPopover.js';
|
|
|
35
35
|
*
|
|
36
36
|
* @event change - 사용자 상호작용(옵션 클릭·칩 제거·지우기)으로 선택 값이 변경될 때 발생.
|
|
37
37
|
* 네이티브 select와 동일하게 프로그램적 value 세팅·옵션 등록으로는 발화하지 않는다.
|
|
38
|
-
* @event search - `searchable`일 때
|
|
38
|
+
* @event search - `searchable`일 때 검색어가 바뀔 때마다 발생(`detail: { query: string; composing: boolean }` — IME 조합 중이면 `composing: true`, 조합이 끝나면 `false` 로 한 번 더).
|
|
39
39
|
* 로컬 필터링(이미 렌더된 `u-option`의 `hidden` 토글)과 별개로 발행되므로, 서버/원격 검색이
|
|
40
40
|
* 필요한 소비자는 이 이벤트를 구독해 자체적으로 옵션을 갱신할 수 있다.
|
|
41
41
|
*/
|
|
@@ -85,6 +85,13 @@ export declare class USelect extends UFormControlElement<string | string[]> {
|
|
|
85
85
|
private options;
|
|
86
86
|
/** 검색칸의 지금 검색어(소문자 · 앞뒤 공백 없음). */
|
|
87
87
|
private query;
|
|
88
|
+
/** `query` 의 마지막 음절이 아직 조합 중인가 — 검색 일치가 그 음절을 자모 앞부분으로 견준다. */
|
|
89
|
+
private queryComposing;
|
|
90
|
+
/**
|
|
91
|
+
* 검색칸의 활성 후보 — 검색어가 있으면 첫 보이는 옵션. Enter 가 그것을 고른다(APG «list autocomplete with automatic
|
|
92
|
+
* selection»). 포커스는 검색칸에 남고, 보조기기에는 검색칸의 `aria-activedescendant` 로 알린다.
|
|
93
|
+
*/
|
|
94
|
+
private activeOption?;
|
|
88
95
|
/** 검색어가 있는데 보이는 옵션이 없다 — 팝업에 «일치하는 항목 없음» 을 알린다. */
|
|
89
96
|
private noMatches;
|
|
90
97
|
/** aria-expanded 배선용 팝오버 열림 상태 */
|
|
@@ -128,12 +135,25 @@ export declare class USelect extends UFormControlElement<string | string[]> {
|
|
|
128
135
|
private handlePopoverHide;
|
|
129
136
|
private handleOptionClick;
|
|
130
137
|
private handleOptionKeydown;
|
|
138
|
+
/**
|
|
139
|
+
* 검색칸의 IME 조합. 조합 중인 음절(«ㅅ» · «성» → «서울» 의 가는 길)은 «진행 중» 이라 거르기에 쓰지 않는다 — 확정된
|
|
140
|
+
* 부분으로 거르면 사용자가 찾는 옵션을 숨기지 않고 «일치 없음» 도 정말 없을 때만 알린다. Chromium 은 조합의 마지막
|
|
141
|
+
* `input` 을 `isComposing: true` 로 내고 끝내므로, 확정된 질의는 조합 끝에 낸다.
|
|
142
|
+
*/
|
|
143
|
+
private readonly composition;
|
|
144
|
+
/** 마지막으로 낸 `search` — 조합 끝의 `search` 와 그 뒤 브라우저가 내는 `input`(Firefox)이 같은 질의를 두 번 내지 않게. */
|
|
145
|
+
private lastSearch?;
|
|
131
146
|
private handleSearchInput;
|
|
147
|
+
private updateSearch;
|
|
132
148
|
/**
|
|
133
149
|
* 지금 검색어를 지금 옵션에 적용한다 — 입력 때뿐 아니라 옵션이 바뀔 때도(재사용된 `u-option` 이 앞 검색의 `hidden` 을
|
|
134
150
|
* 들고 남지 않게). `filter="none"` 이면 아무것도 숨기지 않는다.
|
|
135
151
|
*/
|
|
136
152
|
private applyFilter;
|
|
153
|
+
/** 검색어가 있으면 첫 보이는(고를 수 있는) 옵션이 활성 후보 — 없으면 후보도 없다(화살표로 목록에 들어간다). */
|
|
154
|
+
private updateActiveOption;
|
|
155
|
+
private setActiveOption;
|
|
156
|
+
private get searchInputEl();
|
|
137
157
|
private handleSearchKeydown;
|
|
138
158
|
private handleClearClick;
|
|
139
159
|
/** suffix `u-icon`은 순수 표시 요소(버튼 아님)라 네이티브 키보드 활성화가 없다 —
|
|
@@ -142,12 +162,21 @@ export declare class USelect extends UFormControlElement<string | string[]> {
|
|
|
142
162
|
private handleClearKeydown;
|
|
143
163
|
private handleChipRemove;
|
|
144
164
|
}
|
|
165
|
+
/** Detail of `<u-select>`'s `search` event. */
|
|
166
|
+
export interface USelectSearchDetail {
|
|
167
|
+
/** The search box text, trimmed and lower-cased — including a syllable still being composed. */
|
|
168
|
+
query: string;
|
|
169
|
+
/**
|
|
170
|
+
* `true` while an IME composition (Korean, Japanese, Chinese) is in progress, so `query` ends in a partial
|
|
171
|
+
* syllable (`ㅅ`, `성` on the way to `서울`). When the composition ends the event fires again with `false`. A consumer
|
|
172
|
+
* that searches a server can skip composing queries.
|
|
173
|
+
*/
|
|
174
|
+
composing: boolean;
|
|
175
|
+
}
|
|
145
176
|
/** Custom events `<u-select>` dispatches (its `change`/`input` are the native form-control events). */
|
|
146
177
|
export interface USelectEventMap {
|
|
147
|
-
/** The search box changed (`searchable`).
|
|
148
|
-
'search': CustomEvent<
|
|
149
|
-
query: string;
|
|
150
|
-
}>;
|
|
178
|
+
/** The search box changed (`searchable`). */
|
|
179
|
+
'search': CustomEvent<USelectSearchDetail>;
|
|
151
180
|
}
|
|
152
181
|
/** Typed listeners for {@link USelectEventMap} — element-scoped, the DOM's own pattern (`HTMLMediaElementEventMap`). */
|
|
153
182
|
export interface USelect {
|