@iyulab/components 1.49.1 → 1.50.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 +28 -0
- package/dist/components/UFormControlElement.d.ts +29 -2
- package/dist/components/UFormControlElement.js +31 -0
- package/dist/components/UFormControlElement.styles.js +1 -1
- package/dist/components/breadcrumb/UBreadcrumb.d.ts +5 -2
- package/dist/components/breadcrumb/UBreadcrumb.js +18 -21
- package/dist/components/button/UButton.d.ts +6 -0
- package/dist/components/button/UButton.js +16 -5
- package/dist/components/button/UButton.styles.js +1 -1
- package/dist/components/checkbox/UCheckbox.d.ts +8 -0
- package/dist/components/checkbox/UCheckbox.js +10 -2
- package/dist/components/checkbox/UCheckbox.styles.js +2 -2
- package/dist/components/date-picker/UDatePicker.js +5 -5
- package/dist/components/date-picker/UDatePicker.styles.js +4 -4
- package/dist/components/file-input/UFileInput.js +5 -5
- package/dist/components/input/UInput.js +3 -3
- package/dist/components/input/UInput.styles.js +14 -14
- package/dist/components/radio/URadio.js +7 -6
- package/dist/components/radio/URadio.styles.js +1 -1
- package/dist/components/rating/URating.js +7 -7
- package/dist/components/rating/URating.styles.js +1 -1
- package/dist/components/select/USelect.js +6 -6
- package/dist/components/select/USelect.styles.js +15 -15
- package/dist/components/slider/USlider.js +6 -6
- package/dist/components/switch/USwitch.d.ts +8 -0
- package/dist/components/switch/USwitch.js +10 -2
- package/dist/components/switch/USwitch.styles.js +2 -2
- package/dist/components/textarea/UTextarea.js +2 -2
- package/dist/components/textarea/UTextarea.styles.js +15 -15
- package/package.json +1 -1
- package/skills/iyulab-components/references/usage.md +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.50.0] - 2026-09-29
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `protected effectivelyDisabled` on the form control base class — `disabled` or disabled by an
|
|
8
|
+
ancestor `<fieldset>`. Subclasses that draw their own controls should read it instead of
|
|
9
|
+
`disabled`.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **`form.reset()` now resets form controls.** A native form reset — including `u-button
|
|
14
|
+
type="reset"` — left every control as it was. Controls now implement the standard
|
|
15
|
+
`formResetCallback` and return to their default: the `value` attribute (`checked` for
|
|
16
|
+
`u-checkbox` and `u-switch`, taken when the control is first connected), or empty when there is
|
|
17
|
+
none, with validation marks cleared. A control's own `reset()` is unchanged: it empties that
|
|
18
|
+
control.
|
|
19
|
+
- **Form controls and `u-button` now follow a disabled `<fieldset>`.** Inside `<fieldset disabled>`
|
|
20
|
+
they were only left out of the submitted data: the inner input stayed enabled and focusable, the
|
|
21
|
+
control did not look disabled, and a `u-button type="submit"` still submitted the form. They now
|
|
22
|
+
implement the standard `formDisabledCallback` and behave exactly as with their own `disabled`
|
|
23
|
+
attribute. The `disabled` property itself is not changed, so a control disabled on its own stays
|
|
24
|
+
disabled when the fieldset is enabled again. Built-in disabled styles now use `:host(:disabled)`,
|
|
25
|
+
which matches both cases.
|
|
26
|
+
- `u-breadcrumb` with a custom `separator` slot rendered no separators at all. Separators are now
|
|
27
|
+
placed between the items whatever the order of the slotted elements, and follow later changes to
|
|
28
|
+
the separator slot. Separators are marked `aria-hidden`, so a text separator such as `/` is no
|
|
29
|
+
longer read out between items.
|
|
30
|
+
|
|
3
31
|
## [1.49.1] - 2026-09-28
|
|
4
32
|
|
|
5
33
|
### Fixed
|
|
@@ -9,6 +9,17 @@ export declare abstract class UFormControlElement<T> extends UElement {
|
|
|
9
9
|
static formAssociated: boolean;
|
|
10
10
|
/** 비활성 상태 */
|
|
11
11
|
disabled: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* UA 가 알려 준 비활성 상태 — 조상 `<fieldset disabled>` 든 자기 `disabled` 속성이든(`formDisabledCallback`).
|
|
14
|
+
* ⚠사용자의 `disabled` 를 **덮어쓰지 않고** 따로 든다: 덮어쓰면 ⑴사용자가 준 값을 잃고 ⑵반영된
|
|
15
|
+
* `disabled` 속성이 스스로를 비활성으로 붙잡아 fieldset 을 다시 켜도 풀리지 않는다.
|
|
16
|
+
*/
|
|
17
|
+
private formDisabled;
|
|
18
|
+
/**
|
|
19
|
+
* 실제로 비활성인가 — 자기 `disabled` **또는** 조상 fieldset. 렌더·상호작용은 이것을 읽는다.
|
|
20
|
+
* 스타일은 같은 뜻의 표준 의사클래스 `:host(:disabled)` 를 쓴다(form-associated 요소는 둘 다에서 매칭된다).
|
|
21
|
+
*/
|
|
22
|
+
protected get effectivelyDisabled(): boolean;
|
|
12
23
|
/** 읽기 전용 상태 */
|
|
13
24
|
readonly: boolean;
|
|
14
25
|
/** 필수 입력 여부 */
|
|
@@ -61,6 +72,8 @@ export declare abstract class UFormControlElement<T> extends UElement {
|
|
|
61
72
|
* 네이티브와 동일하게 그 메시지가 다른 모든 검증 결과보다 우선한다.
|
|
62
73
|
*/
|
|
63
74
|
protected commit(flags: ValidityStateFlags, message: string, anchor?: HTMLElement): void;
|
|
75
|
+
/** form-associated 표준 콜백 — 조상 fieldset 의 비활성 상태가 바뀔 때 UA 가 부른다. */
|
|
76
|
+
formDisabledCallback(disabled: boolean): void;
|
|
64
77
|
connectedCallback(): void;
|
|
65
78
|
/**
|
|
66
79
|
* 호스트에 세팅된 `aria-label`/`aria-description` 은 접근성 트리에 노출되는 노드가 아니다 —
|
|
@@ -120,8 +133,22 @@ export declare abstract class UFormControlElement<T> extends UElement {
|
|
|
120
133
|
*/
|
|
121
134
|
validate(report?: boolean): boolean;
|
|
122
135
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
136
|
+
* **이 컨트롤 하나를** 비우고 검증 상태를 지운다(지우기 버튼이 쓰는 경로). 각 컴포넌트가 구현한다.
|
|
137
|
+
*
|
|
138
|
+
* ⚠«폼 초기화» 와 다르다 — 폼 단위 초기화는 두 경로 모두 **처음 값으로 되돌린다**:
|
|
139
|
+
* 네이티브 `form.reset()` 은 기본값(콘텐츠 속성, 아래 `formResetCallback`)으로,
|
|
140
|
+
* `u-form.reset()` 은 모델 스냅샷으로.
|
|
125
141
|
*/
|
|
126
142
|
abstract reset(): void;
|
|
143
|
+
/**
|
|
144
|
+
* form-associated 표준 콜백 — 소속 `<form>` 이 리셋될 때 UA 가 부른다. 네이티브 입력과 같이
|
|
145
|
+
* **기본값**(콘텐츠 속성)으로 되돌린다: 비운 뒤(`reset()`) 기본값을 다시 얹는다.
|
|
146
|
+
*/
|
|
147
|
+
formResetCallback(): void;
|
|
148
|
+
/**
|
|
149
|
+
* 기본값을 다시 얹는다. 기본은 `value` 콘텐츠 속성 — 속성이 없으면 비운 상태가 곧 기본값이다.
|
|
150
|
+
* 속성값은 그 컨트롤이 선언한 변환기를 거친다(`attributeChangedCallback` 경로 — 숫자·배열 값 컨트롤도 같다).
|
|
151
|
+
* 기본값이 다른 속성에 있는 컨트롤(체크형의 `checked`)은 덮어쓴다.
|
|
152
|
+
*/
|
|
153
|
+
protected restoreDefaults(): void;
|
|
127
154
|
}
|
|
@@ -12,6 +12,7 @@ var UFormControlElement = class extends UElement {
|
|
|
12
12
|
constructor(..._args) {
|
|
13
13
|
super(..._args);
|
|
14
14
|
this.disabled = false;
|
|
15
|
+
this.formDisabled = false;
|
|
15
16
|
this.readonly = false;
|
|
16
17
|
this.required = false;
|
|
17
18
|
this.invalid = false;
|
|
@@ -30,6 +31,13 @@ var UFormControlElement = class extends UElement {
|
|
|
30
31
|
this.formAssociated = true;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
34
|
+
* 실제로 비활성인가 — 자기 `disabled` **또는** 조상 fieldset. 렌더·상호작용은 이것을 읽는다.
|
|
35
|
+
* 스타일은 같은 뜻의 표준 의사클래스 `:host(:disabled)` 를 쓴다(form-associated 요소는 둘 다에서 매칭된다).
|
|
36
|
+
*/
|
|
37
|
+
get effectivelyDisabled() {
|
|
38
|
+
return this.disabled || this.formDisabled;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
33
41
|
* 폼과의 연동을 위해 `form` 속성을 제공합니다. ElementInternals를 지원하는 브라우저에서 폼 요소에 접근할 수 있습니다.
|
|
34
42
|
* 지원하지 않는 브라우저에서는 null을 반환합니다.
|
|
35
43
|
*/
|
|
@@ -69,6 +77,12 @@ var UFormControlElement = class extends UElement {
|
|
|
69
77
|
if (this.customMessage) this.internals?.setValidity({ customError: true }, this.customMessage, anchor);
|
|
70
78
|
else this.internals?.setValidity(flags, message, anchor);
|
|
71
79
|
}
|
|
80
|
+
/** form-associated 표준 콜백 — 조상 fieldset 의 비활성 상태가 바뀔 때 UA 가 부른다. */
|
|
81
|
+
formDisabledCallback(disabled) {
|
|
82
|
+
const old = this.formDisabled;
|
|
83
|
+
this.formDisabled = disabled;
|
|
84
|
+
this.updateComplete.then(() => this.requestUpdate("formDisabled", old));
|
|
85
|
+
}
|
|
72
86
|
connectedCallback() {
|
|
73
87
|
super.connectedCallback();
|
|
74
88
|
if (!this.internals && "attachInternals" in this) this.internals = this.attachInternals();
|
|
@@ -149,6 +163,23 @@ var UFormControlElement = class extends UElement {
|
|
|
149
163
|
if (report) this.invalid = !valid;
|
|
150
164
|
return valid;
|
|
151
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* form-associated 표준 콜백 — 소속 `<form>` 이 리셋될 때 UA 가 부른다. 네이티브 입력과 같이
|
|
168
|
+
* **기본값**(콘텐츠 속성)으로 되돌린다: 비운 뒤(`reset()`) 기본값을 다시 얹는다.
|
|
169
|
+
*/
|
|
170
|
+
formResetCallback() {
|
|
171
|
+
this.reset();
|
|
172
|
+
this.restoreDefaults();
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* 기본값을 다시 얹는다. 기본은 `value` 콘텐츠 속성 — 속성이 없으면 비운 상태가 곧 기본값이다.
|
|
176
|
+
* 속성값은 그 컨트롤이 선언한 변환기를 거친다(`attributeChangedCallback` 경로 — 숫자·배열 값 컨트롤도 같다).
|
|
177
|
+
* 기본값이 다른 속성에 있는 컨트롤(체크형의 `checked`)은 덮어쓴다.
|
|
178
|
+
*/
|
|
179
|
+
restoreDefaults() {
|
|
180
|
+
const value = this.getAttribute("value");
|
|
181
|
+
if (value !== null) this.attributeChangedCallback("value", null, value);
|
|
182
|
+
}
|
|
152
183
|
};
|
|
153
184
|
__decorate([property({
|
|
154
185
|
type: Boolean,
|
|
@@ -12,9 +12,12 @@ export declare class UBreadcrumb extends UElement {
|
|
|
12
12
|
static styles: import('lit').CSSResultGroup[];
|
|
13
13
|
private separator?;
|
|
14
14
|
render(): import('lit-html').TemplateResult<1>;
|
|
15
|
-
private handleSlotChange;
|
|
16
15
|
private handleSeparatorSlotChange;
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* 항목 사이에 구분자를 놓는다. 항목은 **언제나 기본 슬롯의 배정 결과**에서 구한다 —
|
|
18
|
+
* 항목은 슬롯된 라이트 DOM 이라 섀도의 `nav` 자식을 훑으면 `<slot>` 하나만 나온다.
|
|
19
|
+
*/
|
|
20
|
+
private layout;
|
|
18
21
|
private createSeparator;
|
|
19
22
|
}
|
|
20
23
|
declare global {
|
|
@@ -9,16 +9,25 @@ import { customElement } from "lit/decorators.js";
|
|
|
9
9
|
var UBreadcrumb = class UBreadcrumb extends UElement {
|
|
10
10
|
constructor(..._args) {
|
|
11
11
|
super(..._args);
|
|
12
|
-
this.handleSlotChange = (e) => {
|
|
13
|
-
const items = e.target.assignedElements({ flatten: true }).filter((el) => el instanceof HTMLElement);
|
|
14
|
-
this.appendSeparator(items);
|
|
15
|
-
};
|
|
16
12
|
this.handleSeparatorSlotChange = (e) => {
|
|
17
13
|
const slot = e.target;
|
|
18
14
|
this.separator = slot.assignedNodes({ flatten: true }).at(0);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
this.layout();
|
|
16
|
+
};
|
|
17
|
+
this.layout = () => {
|
|
18
|
+
const nav = this.shadowRoot?.querySelector("nav");
|
|
19
|
+
const slot = nav?.querySelector("slot:not([name])");
|
|
20
|
+
if (!nav || !slot) return;
|
|
21
|
+
const items = slot.assignedElements({ flatten: true }).filter((el) => el instanceof HTMLElement);
|
|
22
|
+
nav.querySelectorAll(".separator").forEach((el) => el.remove());
|
|
23
|
+
items.forEach((item) => item.removeAttribute("data-last"));
|
|
24
|
+
items.forEach((item, i) => {
|
|
25
|
+
item.style.order = String(i * 2);
|
|
26
|
+
if (i < items.length - 1) {
|
|
27
|
+
const sep = this.createSeparator(i);
|
|
28
|
+
nav.appendChild(sep);
|
|
29
|
+
} else item.setAttribute("data-last", "");
|
|
30
|
+
});
|
|
22
31
|
};
|
|
23
32
|
}
|
|
24
33
|
static {
|
|
@@ -27,30 +36,18 @@ var UBreadcrumb = class UBreadcrumb extends UElement {
|
|
|
27
36
|
render() {
|
|
28
37
|
return html`
|
|
29
38
|
<nav aria-label=${Locale.getValue("breadcrumb")} part="nav">
|
|
30
|
-
<slot @slotchange=${this.
|
|
39
|
+
<slot @slotchange=${this.layout}></slot>
|
|
31
40
|
</nav>
|
|
32
41
|
<div hidden aria-hidden="true">
|
|
33
42
|
<slot name="separator" @slotchange=${this.handleSeparatorSlotChange}></slot>
|
|
34
43
|
</div>
|
|
35
44
|
`;
|
|
36
45
|
}
|
|
37
|
-
appendSeparator(items) {
|
|
38
|
-
const nav = this.shadowRoot?.querySelector("nav");
|
|
39
|
-
if (!nav) return;
|
|
40
|
-
nav.querySelectorAll(".separator").forEach((el) => el.remove());
|
|
41
|
-
items.forEach((item) => item.removeAttribute("data-last"));
|
|
42
|
-
items.forEach((item, i) => {
|
|
43
|
-
item.style.order = String(i * 2);
|
|
44
|
-
if (i < items.length - 1) {
|
|
45
|
-
const sep = this.createSeparator(i);
|
|
46
|
-
nav.appendChild(sep);
|
|
47
|
-
} else item.setAttribute("data-last", "");
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
46
|
createSeparator(index) {
|
|
51
47
|
const sep = document.createElement("span");
|
|
52
48
|
sep.setAttribute("class", "separator");
|
|
53
49
|
sep.setAttribute("part", "separator");
|
|
50
|
+
sep.setAttribute("aria-hidden", "true");
|
|
54
51
|
sep.style.order = String(index * 2 + 1);
|
|
55
52
|
if (this.separator) sep.appendChild(this.separator.cloneNode(true));
|
|
56
53
|
else {
|
|
@@ -77,6 +77,12 @@ export declare class UButton extends UElement {
|
|
|
77
77
|
rounded: boolean;
|
|
78
78
|
/** 비활성화 여부 */
|
|
79
79
|
disabled: boolean;
|
|
80
|
+
/** UA 가 알려 준 비활성 상태 — 폼 컨트롤 기반 클래스와 같은 계약(사용자 `disabled` 와 따로 든다). */
|
|
81
|
+
private formDisabled;
|
|
82
|
+
/** 자기 `disabled` 또는 조상 fieldset. */
|
|
83
|
+
protected get effectivelyDisabled(): boolean;
|
|
84
|
+
/** form-associated 표준 콜백 — 조상 fieldset 의 비활성 상태가 바뀔 때 UA 가 부른다. */
|
|
85
|
+
formDisabledCallback(disabled: boolean): void;
|
|
80
86
|
/** 로딩 상태 여부 */
|
|
81
87
|
loading: boolean;
|
|
82
88
|
/** 버튼 타입 */
|
|
@@ -15,10 +15,11 @@ var UButton = class UButton extends UElement {
|
|
|
15
15
|
this.size = "md";
|
|
16
16
|
this.rounded = false;
|
|
17
17
|
this.disabled = false;
|
|
18
|
+
this.formDisabled = false;
|
|
18
19
|
this.loading = false;
|
|
19
20
|
this.type = "button";
|
|
20
21
|
this.handleClick = (e) => {
|
|
21
|
-
if (this.
|
|
22
|
+
if (this.effectivelyDisabled || this.loading) {
|
|
22
23
|
e.preventDefault();
|
|
23
24
|
e.stopImmediatePropagation();
|
|
24
25
|
return;
|
|
@@ -43,6 +44,16 @@ var UButton = class UButton extends UElement {
|
|
|
43
44
|
delegatesFocus: true
|
|
44
45
|
};
|
|
45
46
|
}
|
|
47
|
+
/** 자기 `disabled` 또는 조상 fieldset. */
|
|
48
|
+
get effectivelyDisabled() {
|
|
49
|
+
return this.disabled || this.formDisabled;
|
|
50
|
+
}
|
|
51
|
+
/** form-associated 표준 콜백 — 조상 fieldset 의 비활성 상태가 바뀔 때 UA 가 부른다. */
|
|
52
|
+
formDisabledCallback(disabled) {
|
|
53
|
+
const old = this.formDisabled;
|
|
54
|
+
this.formDisabled = disabled;
|
|
55
|
+
this.updateComplete.then(() => this.requestUpdate("formDisabled", old));
|
|
56
|
+
}
|
|
46
57
|
set form(val) {
|
|
47
58
|
if (val) this.setAttribute("form", val);
|
|
48
59
|
else this.removeAttribute("form");
|
|
@@ -82,9 +93,9 @@ var UButton = class UButton extends UElement {
|
|
|
82
93
|
if (this.href) return html`
|
|
83
94
|
<a part="link"
|
|
84
95
|
aria-label=${ifDefined(ariaLabel)}
|
|
85
|
-
?disabled=${this.
|
|
86
|
-
tabindex=${this.
|
|
87
|
-
href=${ifDefined(this.
|
|
96
|
+
?disabled=${this.effectivelyDisabled || this.loading}
|
|
97
|
+
tabindex=${this.effectivelyDisabled || this.loading ? -1 : 0}
|
|
98
|
+
href=${ifDefined(this.effectivelyDisabled || this.loading ? void 0 : this.href)}
|
|
88
99
|
download=${ifDefined(this.download)}
|
|
89
100
|
target=${ifDefined(this.target)}
|
|
90
101
|
rel=${ifDefined(this.rel)}
|
|
@@ -97,7 +108,7 @@ var UButton = class UButton extends UElement {
|
|
|
97
108
|
<button part="button"
|
|
98
109
|
aria-label=${ifDefined(ariaLabel)}
|
|
99
110
|
type=${this.type}
|
|
100
|
-
?disabled=${this.
|
|
111
|
+
?disabled=${this.effectivelyDisabled || this.loading}
|
|
101
112
|
>
|
|
102
113
|
${this.renderContent()}
|
|
103
114
|
</button>
|
|
@@ -33,6 +33,14 @@ export declare class UCheckbox extends UFormControlElement<string> {
|
|
|
33
33
|
indeterminate: boolean;
|
|
34
34
|
/** 체크 여부 */
|
|
35
35
|
checked: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 네이티브 `defaultChecked` 에 해당하는 값 — **처음 연결될 때의 `checked` 속성**.
|
|
38
|
+
* `checked` 는 반영(reflect)되는 속성이라 사용자가 바꾸면 속성도 바뀐다. 그래서 속성을
|
|
39
|
+
* 리셋 시점에 읽으면 «현재» 가 나온다 — 기본값은 그 전에 붙잡아 둔다.
|
|
40
|
+
*/
|
|
41
|
+
private defaultChecked?;
|
|
42
|
+
connectedCallback(): void;
|
|
43
|
+
protected restoreDefaults(): void;
|
|
36
44
|
inputEl?: HTMLInputElement;
|
|
37
45
|
protected shouldValidate(changed: PropertyValues): boolean;
|
|
38
46
|
/** `checked`(또는 그 값을 함께 결정하는 `value`)가 바뀌는 모든 경로(초기 속성 설정 ·
|
|
@@ -18,7 +18,7 @@ var UCheckbox = class UCheckbox extends UFormControlElement {
|
|
|
18
18
|
this.checked = false;
|
|
19
19
|
this.handleInputChange = (e) => {
|
|
20
20
|
e.stopImmediatePropagation();
|
|
21
|
-
if (this.readonly || this.
|
|
21
|
+
if (this.readonly || this.effectivelyDisabled) return;
|
|
22
22
|
const input = e.target;
|
|
23
23
|
this.indeterminate = false;
|
|
24
24
|
this.checked = input.checked;
|
|
@@ -29,6 +29,14 @@ var UCheckbox = class UCheckbox extends UFormControlElement {
|
|
|
29
29
|
static {
|
|
30
30
|
this.styles = [super.styles, styles];
|
|
31
31
|
}
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
this.defaultChecked ??= this.hasAttribute("checked");
|
|
34
|
+
super.connectedCallback();
|
|
35
|
+
}
|
|
36
|
+
restoreDefaults() {
|
|
37
|
+
super.restoreDefaults();
|
|
38
|
+
this.checked = this.defaultChecked ?? false;
|
|
39
|
+
}
|
|
32
40
|
shouldValidate(changed) {
|
|
33
41
|
return super.shouldValidate(changed) || changed.has("checked");
|
|
34
42
|
}
|
|
@@ -45,7 +53,7 @@ var UCheckbox = class UCheckbox extends UFormControlElement {
|
|
|
45
53
|
<input part="input"
|
|
46
54
|
type="checkbox"
|
|
47
55
|
aria-label=${ifDefined(this.contentAriaLabel)}
|
|
48
|
-
?disabled=${this.
|
|
56
|
+
?disabled=${this.effectivelyDisabled || this.readonly}
|
|
49
57
|
?required=${this.required}
|
|
50
58
|
.checked=${live(this.checked)}
|
|
51
59
|
@change=${this.handleInputChange}
|
|
@@ -25,7 +25,7 @@ var styles = css`
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/* === 상태 스타일 === */
|
|
28
|
-
:host(
|
|
28
|
+
:host(:disabled) {
|
|
29
29
|
opacity: 0.6;
|
|
30
30
|
cursor: not-allowed;
|
|
31
31
|
}
|
|
@@ -42,7 +42,7 @@ var styles = css`
|
|
|
42
42
|
:host([indeterminate]) .checkbox u-icon {
|
|
43
43
|
transform: scale(1);
|
|
44
44
|
}
|
|
45
|
-
:host(:not(
|
|
45
|
+
:host(:not(:disabled):not([readonly]):hover) {
|
|
46
46
|
--checkbox-border-color: var(--u-input-border-color-hover, #BDBDBD);
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -192,16 +192,16 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
192
192
|
return html`
|
|
193
193
|
<u-field part="field"
|
|
194
194
|
?required=${this.required}
|
|
195
|
-
?disabled=${this.
|
|
195
|
+
?disabled=${this.effectivelyDisabled}
|
|
196
196
|
?invalid=${this.invalid}
|
|
197
197
|
.label=${this.label}
|
|
198
198
|
.description=${this.description}
|
|
199
199
|
.validationMessage=${this.validationMessage}
|
|
200
200
|
>
|
|
201
201
|
<div class="container" part="container"
|
|
202
|
-
tabindex=${this.
|
|
202
|
+
tabindex=${this.effectivelyDisabled ? "-1" : "0"}
|
|
203
203
|
role="combobox"
|
|
204
|
-
aria-disabled=${ifDefined(this.
|
|
204
|
+
aria-disabled=${ifDefined(this.effectivelyDisabled ? "true" : void 0)}
|
|
205
205
|
aria-haspopup="dialog"
|
|
206
206
|
aria-expanded=${this.open}
|
|
207
207
|
aria-label=${ifDefined(this.resolvedAriaLabel)}
|
|
@@ -210,7 +210,7 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
210
210
|
>
|
|
211
211
|
<span class="text-content ${!displayText ? "placeholder" : ""}">${displayText || this.placeholder || ""}</span>
|
|
212
212
|
<u-icon class="suffix-item"
|
|
213
|
-
?hidden=${!this.clearable || !this.value || this.
|
|
213
|
+
?hidden=${!this.clearable || !this.value || this.effectivelyDisabled || this.readonly}
|
|
214
214
|
role="button"
|
|
215
215
|
tabindex="0"
|
|
216
216
|
aria-label=${Locale.getValue("clear")}
|
|
@@ -388,7 +388,7 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
388
388
|
* Tab 순서에서 빠지고 프로그램적 `.focus()`는 여전히 통과하므로, `UInput.focus()`가
|
|
389
389
|
* 네이티브 `disabled` `<input>`에서 얻는 것과 같은 no-op을 여기서 직접 재현한다. */
|
|
390
390
|
focus(options) {
|
|
391
|
-
if (this.
|
|
391
|
+
if (this.effectivelyDisabled) return;
|
|
392
392
|
this.containerEl?.focus(options);
|
|
393
393
|
}
|
|
394
394
|
blur() {
|
|
@@ -28,18 +28,18 @@ var styles = css`
|
|
|
28
28
|
box-shadow var(--u-duration-normal, 220ms) var(--u-ease-standard, cubic-bezier(0.2, 0, 0, 1));
|
|
29
29
|
}
|
|
30
30
|
:host([readonly]) .container,
|
|
31
|
-
:host(
|
|
31
|
+
:host(:disabled) .container {
|
|
32
32
|
cursor: not-allowed;
|
|
33
33
|
border-color: var(--u-border-color-weak, #EEEEEE);
|
|
34
34
|
background-color: var(--u-bg-color-disabled, #FAFAFA);
|
|
35
35
|
}
|
|
36
|
-
:host(:not([readonly]):not(
|
|
36
|
+
:host(:not([readonly]):not(:disabled)) .container:hover {
|
|
37
37
|
box-shadow: 0 0 0 1px var(--u-input-border-color-hover, #BDBDBD);
|
|
38
38
|
}
|
|
39
|
-
:host(:not([readonly]):not(
|
|
39
|
+
:host(:not([readonly]):not(:disabled)) .container:focus-within {
|
|
40
40
|
box-shadow: 0 0 0 1px var(--u-input-border-color-focus, #1565C0);
|
|
41
41
|
}
|
|
42
|
-
:host([invalid]:not([readonly]):not(
|
|
42
|
+
:host([invalid]:not([readonly]):not(:disabled)) .container {
|
|
43
43
|
box-shadow: 0 0 0 1px var(--u-input-border-color-invalid, #C62828);
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -16,7 +16,7 @@ var UFileInput = class UFileInput extends UFormControlElement {
|
|
|
16
16
|
this.multiple = false;
|
|
17
17
|
this.handleTriggerClick = (e) => {
|
|
18
18
|
e.stopImmediatePropagation();
|
|
19
|
-
if (this.
|
|
19
|
+
if (this.effectivelyDisabled || this.readonly) return;
|
|
20
20
|
this.inputEl?.click();
|
|
21
21
|
};
|
|
22
22
|
this.handleInputChange = (e) => {
|
|
@@ -86,7 +86,7 @@ var UFileInput = class UFileInput extends UFormControlElement {
|
|
|
86
86
|
return html`
|
|
87
87
|
<u-field part="field"
|
|
88
88
|
?required=${this.required}
|
|
89
|
-
?disabled=${this.
|
|
89
|
+
?disabled=${this.effectivelyDisabled}
|
|
90
90
|
?invalid=${this.invalid}
|
|
91
91
|
.label=${this.label}
|
|
92
92
|
.description=${this.description}
|
|
@@ -96,14 +96,14 @@ var UFileInput = class UFileInput extends UFormControlElement {
|
|
|
96
96
|
<button class="trigger" part="trigger"
|
|
97
97
|
type="button"
|
|
98
98
|
aria-label=${ifDefined(this.triggerAriaLabel)}
|
|
99
|
-
?disabled=${this.
|
|
99
|
+
?disabled=${this.effectivelyDisabled || this.readonly}
|
|
100
100
|
@click=${this.handleTriggerClick}
|
|
101
101
|
>${Locale.getValue("chooseFile")}</button>
|
|
102
102
|
|
|
103
103
|
<span class="status" part="status" ?data-empty=${!hasFiles}>${status}</span>
|
|
104
104
|
|
|
105
105
|
<u-icon class="clear-btn" part="clear-button"
|
|
106
|
-
?hidden=${!hasFiles || this.
|
|
106
|
+
?hidden=${!hasFiles || this.effectivelyDisabled || this.readonly}
|
|
107
107
|
role="button"
|
|
108
108
|
tabindex="0"
|
|
109
109
|
aria-label=${Locale.getValue("clear")}
|
|
@@ -119,7 +119,7 @@ var UFileInput = class UFileInput extends UFormControlElement {
|
|
|
119
119
|
name=${ifDefined(this.name)}
|
|
120
120
|
accept=${ifDefined(this.accept)}
|
|
121
121
|
?multiple=${this.multiple}
|
|
122
|
-
?disabled=${this.
|
|
122
|
+
?disabled=${this.effectivelyDisabled || this.readonly}
|
|
123
123
|
@change=${this.handleInputChange}
|
|
124
124
|
/>
|
|
125
125
|
</div>
|
|
@@ -165,14 +165,14 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
165
165
|
super.disconnectedCallback();
|
|
166
166
|
}
|
|
167
167
|
render() {
|
|
168
|
-
const editable = !this.
|
|
168
|
+
const editable = !this.effectivelyDisabled && !this.readonly;
|
|
169
169
|
const showToggle = this.type === "password" && editable;
|
|
170
170
|
const showClear = this.clearable && editable && !!this.value;
|
|
171
171
|
const showStepper = this.type === "number" && editable;
|
|
172
172
|
return html`
|
|
173
173
|
<u-field part="field"
|
|
174
174
|
?required=${this.required}
|
|
175
|
-
?disabled=${this.
|
|
175
|
+
?disabled=${this.effectivelyDisabled}
|
|
176
176
|
?invalid=${this.invalid}
|
|
177
177
|
.label=${this.label}
|
|
178
178
|
.description=${this.description}
|
|
@@ -188,7 +188,7 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
188
188
|
aria-description=${ifDefined(this.resolvedAriaDescription)}
|
|
189
189
|
name=${ifDefined(this.name)}
|
|
190
190
|
?required=${this.required}
|
|
191
|
-
?disabled=${this.
|
|
191
|
+
?disabled=${this.effectivelyDisabled}
|
|
192
192
|
?readonly=${this.readonly}
|
|
193
193
|
minlength=${ifDefined(this.minlength)}
|
|
194
194
|
maxlength=${ifDefined(this.maxlength)}
|
|
@@ -30,17 +30,17 @@ var styles = css`
|
|
|
30
30
|
overflow: hidden;
|
|
31
31
|
}
|
|
32
32
|
:host([readonly]) .container,
|
|
33
|
-
:host(
|
|
33
|
+
:host(:disabled) .container {
|
|
34
34
|
border-color: var(--u-border-color-weak, #EEEEEE);
|
|
35
35
|
background-color: var(--u-bg-color-disabled, #FAFAFA);
|
|
36
36
|
}
|
|
37
|
-
:host(:not([readonly]):not(
|
|
37
|
+
:host(:not([readonly]):not(:disabled)) .container:hover {
|
|
38
38
|
box-shadow: 0 0 0 1px var(--u-input-border-color-hover, #BDBDBD);
|
|
39
39
|
}
|
|
40
|
-
:host(:not([readonly]):not(
|
|
40
|
+
:host(:not([readonly]):not(:disabled)) .container:focus-within {
|
|
41
41
|
box-shadow: 0 0 0 1px var(--u-input-border-color-focus, #1565C0);
|
|
42
42
|
}
|
|
43
|
-
:host([invalid]:not([readonly]):not(
|
|
43
|
+
:host([invalid]:not([readonly]):not(:disabled)) .container {
|
|
44
44
|
box-shadow: 0 0 0 1px var(--u-input-border-color-invalid, #C62828);
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -52,20 +52,20 @@ var styles = css`
|
|
|
52
52
|
background-color: var(--u-neutral-200, #EEEEEE);
|
|
53
53
|
}
|
|
54
54
|
:host([variant="filled"][readonly]) .container,
|
|
55
|
-
:host([variant="filled"]
|
|
55
|
+
:host([variant="filled"]:disabled) .container {
|
|
56
56
|
background-color: var(--u-bg-color-disabled, #FAFAFA);
|
|
57
57
|
border-bottom-color: var(--u-border-color-weak, #EEEEEE);
|
|
58
58
|
}
|
|
59
|
-
:host([variant="filled"]:not([readonly]):not(
|
|
59
|
+
:host([variant="filled"]:not([readonly]):not(:disabled)) .container:hover {
|
|
60
60
|
box-shadow: none;
|
|
61
61
|
background-color: var(--u-neutral-300, #E0E0E0);
|
|
62
62
|
border-bottom-color: var(--u-input-border-color-hover, #BDBDBD);
|
|
63
63
|
}
|
|
64
|
-
:host([variant="filled"]:not([readonly]):not(
|
|
64
|
+
:host([variant="filled"]:not([readonly]):not(:disabled)) .container:focus-within {
|
|
65
65
|
box-shadow: none;
|
|
66
66
|
border-bottom-color: var(--u-input-border-color-focus, #1565C0);
|
|
67
67
|
}
|
|
68
|
-
:host([variant="filled"][invalid]:not([readonly]):not(
|
|
68
|
+
:host([variant="filled"][invalid]:not([readonly]):not(:disabled)) .container {
|
|
69
69
|
box-shadow: none;
|
|
70
70
|
border-bottom-color: var(--u-input-border-color-invalid, #C62828);
|
|
71
71
|
}
|
|
@@ -80,20 +80,20 @@ var styles = css`
|
|
|
80
80
|
background-color: transparent;
|
|
81
81
|
}
|
|
82
82
|
:host([variant="underlined"][readonly]) .container,
|
|
83
|
-
:host([variant="underlined"]
|
|
83
|
+
:host([variant="underlined"]:disabled) .container {
|
|
84
84
|
background-color: transparent;
|
|
85
85
|
border-bottom-color: var(--u-border-color-weak, #EEEEEE);
|
|
86
86
|
}
|
|
87
|
-
:host([variant="underlined"]:not([readonly]):not(
|
|
87
|
+
:host([variant="underlined"]:not([readonly]):not(:disabled)) .container:hover {
|
|
88
88
|
box-shadow: none;
|
|
89
89
|
border-bottom-color: var(--u-input-border-color-hover, #BDBDBD);
|
|
90
90
|
}
|
|
91
|
-
:host([variant="underlined"]:not([readonly]):not(
|
|
91
|
+
:host([variant="underlined"]:not([readonly]):not(:disabled)) .container:focus-within {
|
|
92
92
|
box-shadow: none;
|
|
93
93
|
border-bottom-color: var(--u-input-border-color-focus, #1565C0);
|
|
94
94
|
border-bottom-width: 2px;
|
|
95
95
|
}
|
|
96
|
-
:host([variant="underlined"][invalid]:not([readonly]):not(
|
|
96
|
+
:host([variant="underlined"][invalid]:not([readonly]):not(:disabled)) .container {
|
|
97
97
|
box-shadow: none;
|
|
98
98
|
border-bottom-color: var(--u-input-border-color-invalid, #C62828);
|
|
99
99
|
}
|
|
@@ -106,8 +106,8 @@ var styles = css`
|
|
|
106
106
|
padding: 0;
|
|
107
107
|
box-shadow: none;
|
|
108
108
|
}
|
|
109
|
-
:host([variant="borderless"]:not([readonly]):not(
|
|
110
|
-
:host([variant="borderless"]:not([readonly]):not(
|
|
109
|
+
:host([variant="borderless"]:not([readonly]):not(:disabled)) .container:hover,
|
|
110
|
+
:host([variant="borderless"]:not([readonly]):not(:disabled)) .container:focus-within {
|
|
111
111
|
box-shadow: none;
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -23,7 +23,7 @@ var URadio = class URadio extends UFormControlElement {
|
|
|
23
23
|
this.setup(this.options);
|
|
24
24
|
};
|
|
25
25
|
this.handleOptionClick = (e) => {
|
|
26
|
-
if (this.readonly || this.
|
|
26
|
+
if (this.readonly || this.effectivelyDisabled) return;
|
|
27
27
|
const option = e.currentTarget;
|
|
28
28
|
if (option.disabled) return;
|
|
29
29
|
if (option.value === this.value) return;
|
|
@@ -31,7 +31,7 @@ var URadio = class URadio extends UFormControlElement {
|
|
|
31
31
|
this.emitChange();
|
|
32
32
|
};
|
|
33
33
|
this.handleOptionKeyDown = (e) => {
|
|
34
|
-
if (this.readonly || this.
|
|
34
|
+
if (this.readonly || this.effectivelyDisabled) return;
|
|
35
35
|
const options = this.options.filter((o) => !o.disabled);
|
|
36
36
|
const currentOption = e.currentTarget;
|
|
37
37
|
const currentIndex = options.indexOf(currentOption);
|
|
@@ -74,10 +74,11 @@ var URadio = class URadio extends UFormControlElement {
|
|
|
74
74
|
if ([
|
|
75
75
|
"type",
|
|
76
76
|
"disabled",
|
|
77
|
+
"formDisabled",
|
|
77
78
|
"readonly"
|
|
78
79
|
].some((k) => changedProperties.has(k))) this.options.forEach((option) => {
|
|
79
80
|
option.marker = this.type === "button" ? void 0 : "radio";
|
|
80
|
-
option.disabled = this.
|
|
81
|
+
option.disabled = this.effectivelyDisabled || this.readonly;
|
|
81
82
|
});
|
|
82
83
|
if (["value", "options"].some((k) => changedProperties.has(k))) this.onChangeValue();
|
|
83
84
|
}
|
|
@@ -85,7 +86,7 @@ var URadio = class URadio extends UFormControlElement {
|
|
|
85
86
|
return html`
|
|
86
87
|
<u-field part="field"
|
|
87
88
|
?required=${this.required}
|
|
88
|
-
?disabled=${this.
|
|
89
|
+
?disabled=${this.effectivelyDisabled}
|
|
89
90
|
?invalid=${this.invalid}
|
|
90
91
|
.label=${this.label}
|
|
91
92
|
.description=${this.description}
|
|
@@ -93,7 +94,7 @@ var URadio = class URadio extends UFormControlElement {
|
|
|
93
94
|
>
|
|
94
95
|
<div class="container" part="container"
|
|
95
96
|
role="radiogroup"
|
|
96
|
-
aria-disabled=${ifDefined(this.
|
|
97
|
+
aria-disabled=${ifDefined(this.effectivelyDisabled ? "true" : void 0)}
|
|
97
98
|
aria-label=${ifDefined(this.resolvedAriaLabel)}
|
|
98
99
|
aria-description=${ifDefined(this.resolvedAriaDescription)}>
|
|
99
100
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
@@ -126,7 +127,7 @@ var URadio = class URadio extends UFormControlElement {
|
|
|
126
127
|
option.addEventListener("keydown", this.handleOptionKeyDown);
|
|
127
128
|
option.selected = option.value === this.value;
|
|
128
129
|
option.marker = this.type === "button" ? void 0 : "radio";
|
|
129
|
-
option.disabled = this.
|
|
130
|
+
option.disabled = this.effectivelyDisabled || this.readonly;
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
cleanup(options) {
|
|
@@ -26,16 +26,16 @@ var URating = class URating extends UFormControlElement {
|
|
|
26
26
|
else if (name === "symbol-off") this.symbolOff = node ?? null;
|
|
27
27
|
};
|
|
28
28
|
this.handleSymbolPointerMove = (e) => {
|
|
29
|
-
if (this.
|
|
29
|
+
if (this.effectivelyDisabled || this.readonly) return;
|
|
30
30
|
const score = Number(e.currentTarget.dataset.score);
|
|
31
31
|
this.buffer = this.calibrate(e, score);
|
|
32
32
|
};
|
|
33
33
|
this.handleSymbolPointerLeave = (_) => {
|
|
34
|
-
if (this.
|
|
34
|
+
if (this.effectivelyDisabled || this.readonly) return;
|
|
35
35
|
this.buffer = -1;
|
|
36
36
|
};
|
|
37
37
|
this.handleSymbolClick = (e) => {
|
|
38
|
-
if (this.
|
|
38
|
+
if (this.effectivelyDisabled || this.readonly) return;
|
|
39
39
|
const score = Number(e.currentTarget.dataset.score);
|
|
40
40
|
const val = this.precision < 1 ? this.calibrate(e, score) : score;
|
|
41
41
|
const next = this.value === val ? 0 : val;
|
|
@@ -44,7 +44,7 @@ var URating = class URating extends UFormControlElement {
|
|
|
44
44
|
this.emitChange();
|
|
45
45
|
};
|
|
46
46
|
this.handleSymbolKeydown = (e) => {
|
|
47
|
-
if (this.
|
|
47
|
+
if (this.effectivelyDisabled || this.readonly) return;
|
|
48
48
|
const symbols = Array.from(this.renderRoot.querySelectorAll(".symbol"));
|
|
49
49
|
const currentSymbol = e.currentTarget;
|
|
50
50
|
const currentIndex = symbols.indexOf(currentSymbol);
|
|
@@ -94,7 +94,7 @@ var URating = class URating extends UFormControlElement {
|
|
|
94
94
|
].some((k) => changed.has(k));
|
|
95
95
|
}
|
|
96
96
|
get interactive() {
|
|
97
|
-
return !this.
|
|
97
|
+
return !this.effectivelyDisabled && !this.readonly;
|
|
98
98
|
}
|
|
99
99
|
updated(changedProperties) {
|
|
100
100
|
super.updated(changedProperties);
|
|
@@ -105,14 +105,14 @@ var URating = class URating extends UFormControlElement {
|
|
|
105
105
|
return html`
|
|
106
106
|
<u-field part="field"
|
|
107
107
|
?required=${this.required}
|
|
108
|
-
?disabled=${this.
|
|
108
|
+
?disabled=${this.effectivelyDisabled}
|
|
109
109
|
?invalid=${this.invalid}
|
|
110
110
|
.label=${this.label}
|
|
111
111
|
.description=${this.description}
|
|
112
112
|
.validationMessage=${this.validationMessage}
|
|
113
113
|
>
|
|
114
114
|
<div class="symbols" part="container" role="radiogroup"
|
|
115
|
-
aria-disabled=${ifDefined(this.
|
|
115
|
+
aria-disabled=${ifDefined(this.effectivelyDisabled ? "true" : void 0)}
|
|
116
116
|
aria-label=${ifDefined(this.resolvedAriaLabel)}
|
|
117
117
|
aria-description=${ifDefined(this.resolvedAriaDescription)}>
|
|
118
118
|
${Array.from({ length: this.max }, (_, i) => {
|
|
@@ -165,7 +165,7 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
165
165
|
return html`
|
|
166
166
|
<u-field part="field"
|
|
167
167
|
?required=${this.required}
|
|
168
|
-
?disabled=${this.
|
|
168
|
+
?disabled=${this.effectivelyDisabled}
|
|
169
169
|
?invalid=${this.invalid}
|
|
170
170
|
.label=${this.label}
|
|
171
171
|
.description=${this.description}
|
|
@@ -175,9 +175,9 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
175
175
|
${this.valueAsArray.length} / ${this.maxCount}
|
|
176
176
|
</span>
|
|
177
177
|
|
|
178
|
-
<div class="container" part="container" tabindex=${this.
|
|
178
|
+
<div class="container" part="container" tabindex=${this.effectivelyDisabled ? "-1" : "0"}
|
|
179
179
|
role="combobox"
|
|
180
|
-
aria-disabled=${ifDefined(this.
|
|
180
|
+
aria-disabled=${ifDefined(this.effectivelyDisabled ? "true" : void 0)}
|
|
181
181
|
aria-label=${ifDefined(this.resolvedAriaLabel)}
|
|
182
182
|
aria-description=${ifDefined(this.resolvedAriaDescription)}
|
|
183
183
|
aria-haspopup=${this.searchable ? "dialog" : "listbox"}
|
|
@@ -188,7 +188,7 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
188
188
|
<slot name="suffix"></slot>
|
|
189
189
|
|
|
190
190
|
<u-icon class="suffix-item"
|
|
191
|
-
?hidden=${!this.clearable || !this.hasValue || this.
|
|
191
|
+
?hidden=${!this.clearable || !this.hasValue || this.effectivelyDisabled || this.readonly}
|
|
192
192
|
role="button"
|
|
193
193
|
tabindex="0"
|
|
194
194
|
aria-label=${Locale.getValue("clear")}
|
|
@@ -290,7 +290,7 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
290
290
|
* Tab 순서에서 빠지고 프로그램적 `.focus()`는 여전히 통과하므로, `UInput.focus()`가
|
|
291
291
|
* 네이티브 `disabled` `<input>`에서 얻는 것과 같은 no-op을 여기서 직접 재현한다. */
|
|
292
292
|
focus(options) {
|
|
293
|
-
if (this.
|
|
293
|
+
if (this.effectivelyDisabled) return;
|
|
294
294
|
this.containerEl?.focus(options);
|
|
295
295
|
}
|
|
296
296
|
blur() {
|
|
@@ -303,7 +303,7 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
303
303
|
option.addEventListener("click", this.handleOptionClick);
|
|
304
304
|
option.addEventListener("keydown", this.handleOptionKeydown);
|
|
305
305
|
option.marker = this.multiple ? "check" : void 0;
|
|
306
|
-
option.disabled = this.
|
|
306
|
+
option.disabled = this.effectivelyDisabled;
|
|
307
307
|
option.selected = this.multiple ? this.valueAsArray.includes(option.value) : option.value === this.value;
|
|
308
308
|
}
|
|
309
309
|
}
|
|
@@ -33,23 +33,23 @@ var styles = css`
|
|
|
33
33
|
cursor: pointer;
|
|
34
34
|
}
|
|
35
35
|
:host([readonly]) .container,
|
|
36
|
-
:host(
|
|
36
|
+
:host(:disabled) .container {
|
|
37
37
|
border-color: var(--u-border-color-weak, #EEEEEE);
|
|
38
38
|
background-color: var(--u-bg-color-disabled, #FAFAFA);
|
|
39
39
|
}
|
|
40
|
-
:host(
|
|
40
|
+
:host(:disabled) .container {
|
|
41
41
|
cursor: not-allowed;
|
|
42
42
|
}
|
|
43
43
|
:host([readonly]) .container {
|
|
44
44
|
cursor: default;
|
|
45
45
|
}
|
|
46
|
-
:host(:not([readonly]):not(
|
|
46
|
+
:host(:not([readonly]):not(:disabled)) .container:hover {
|
|
47
47
|
box-shadow: 0 0 0 1px var(--u-input-border-color-hover, #BDBDBD);
|
|
48
48
|
}
|
|
49
|
-
:host(:not([readonly]):not(
|
|
49
|
+
:host(:not([readonly]):not(:disabled)) .container:focus-within {
|
|
50
50
|
box-shadow: 0 0 0 1px var(--u-input-border-color-focus, #1565C0);
|
|
51
51
|
}
|
|
52
|
-
:host([invalid]:not([readonly]):not(
|
|
52
|
+
:host([invalid]:not([readonly]):not(:disabled)) .container {
|
|
53
53
|
box-shadow: 0 0 0 1px var(--u-input-border-color-invalid, #C62828);
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -61,20 +61,20 @@ var styles = css`
|
|
|
61
61
|
background-color: var(--u-neutral-200, #EEEEEE);
|
|
62
62
|
}
|
|
63
63
|
:host([variant="filled"][readonly]) .container,
|
|
64
|
-
:host([variant="filled"]
|
|
64
|
+
:host([variant="filled"]:disabled) .container {
|
|
65
65
|
background-color: var(--u-bg-color-disabled, #FAFAFA);
|
|
66
66
|
border-bottom-color: var(--u-border-color-weak, #EEEEEE);
|
|
67
67
|
}
|
|
68
|
-
:host([variant="filled"]:not([readonly]):not(
|
|
68
|
+
:host([variant="filled"]:not([readonly]):not(:disabled)) .container:hover {
|
|
69
69
|
box-shadow: none;
|
|
70
70
|
background-color: var(--u-neutral-300, #E0E0E0);
|
|
71
71
|
border-bottom-color: var(--u-input-border-color-hover, #BDBDBD);
|
|
72
72
|
}
|
|
73
|
-
:host([variant="filled"]:not([readonly]):not(
|
|
73
|
+
:host([variant="filled"]:not([readonly]):not(:disabled)) .container:focus-within {
|
|
74
74
|
box-shadow: none;
|
|
75
75
|
border-bottom-color: var(--u-input-border-color-focus, #1565C0);
|
|
76
76
|
}
|
|
77
|
-
:host([variant="filled"][invalid]:not([readonly]):not(
|
|
77
|
+
:host([variant="filled"][invalid]:not([readonly]):not(:disabled)) .container {
|
|
78
78
|
box-shadow: none;
|
|
79
79
|
border-bottom-color: var(--u-input-border-color-invalid, #C62828);
|
|
80
80
|
}
|
|
@@ -89,20 +89,20 @@ var styles = css`
|
|
|
89
89
|
border-bottom: 1px solid var(--u-input-border-color, #E0E0E0);
|
|
90
90
|
}
|
|
91
91
|
:host([variant="underlined"][readonly]) .container,
|
|
92
|
-
:host([variant="underlined"]
|
|
92
|
+
:host([variant="underlined"]:disabled) .container {
|
|
93
93
|
background-color: transparent;
|
|
94
94
|
border-bottom-color: var(--u-border-color-weak, #EEEEEE);
|
|
95
95
|
}
|
|
96
|
-
:host([variant="underlined"]:not([readonly]):not(
|
|
96
|
+
:host([variant="underlined"]:not([readonly]):not(:disabled)) .container:hover {
|
|
97
97
|
box-shadow: none;
|
|
98
98
|
border-bottom-color: var(--u-input-border-color-hover, #BDBDBD);
|
|
99
99
|
}
|
|
100
|
-
:host([variant="underlined"]:not([readonly]):not(
|
|
100
|
+
:host([variant="underlined"]:not([readonly]):not(:disabled)) .container:focus-within {
|
|
101
101
|
box-shadow: none;
|
|
102
102
|
border-bottom-color: var(--u-input-border-color-focus, #1565C0);
|
|
103
103
|
border-bottom-width: 2px;
|
|
104
104
|
}
|
|
105
|
-
:host([variant="underlined"][invalid]:not([readonly]):not(
|
|
105
|
+
:host([variant="underlined"][invalid]:not([readonly]):not(:disabled)) .container {
|
|
106
106
|
box-shadow: none;
|
|
107
107
|
border-bottom-color: var(--u-input-border-color-invalid, #C62828);
|
|
108
108
|
}
|
|
@@ -115,8 +115,8 @@ var styles = css`
|
|
|
115
115
|
padding: 0;
|
|
116
116
|
box-shadow: none;
|
|
117
117
|
}
|
|
118
|
-
:host([variant="borderless"]:not([readonly]):not(
|
|
119
|
-
:host([variant="borderless"]:not([readonly]):not(
|
|
118
|
+
:host([variant="borderless"]:not([readonly]):not(:disabled)) .container:hover,
|
|
119
|
+
:host([variant="borderless"]:not([readonly]):not(:disabled)) .container:focus-within {
|
|
120
120
|
box-shadow: none;
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -20,7 +20,7 @@ var USlider = class USlider extends UFormControlElement {
|
|
|
20
20
|
this.step = 1;
|
|
21
21
|
this.dragging = null;
|
|
22
22
|
this.handleContainerPointerDown = (e) => {
|
|
23
|
-
if (this.
|
|
23
|
+
if (this.effectivelyDisabled || this.readonly) return;
|
|
24
24
|
const getPointerValue = (ev) => {
|
|
25
25
|
if (!this.trackEl) return 0;
|
|
26
26
|
const rect = this.trackEl.getBoundingClientRect();
|
|
@@ -56,7 +56,7 @@ var USlider = class USlider extends UFormControlElement {
|
|
|
56
56
|
document.addEventListener("pointerup", handleDocumentUp);
|
|
57
57
|
};
|
|
58
58
|
this.handleThumbKeyDown = (e) => {
|
|
59
|
-
if (this.
|
|
59
|
+
if (this.effectivelyDisabled || this.readonly) return;
|
|
60
60
|
const thumb = e.currentTarget.dataset.thumb;
|
|
61
61
|
const currentVal = this.getThumbValue(thumb);
|
|
62
62
|
const bigStep = (this.max - this.min) / 10;
|
|
@@ -139,7 +139,7 @@ var USlider = class USlider extends UFormControlElement {
|
|
|
139
139
|
return html`
|
|
140
140
|
<u-field part="field"
|
|
141
141
|
?required=${this.required}
|
|
142
|
-
?disabled=${this.
|
|
142
|
+
?disabled=${this.effectivelyDisabled}
|
|
143
143
|
?invalid=${this.invalid}
|
|
144
144
|
.label=${this.label}
|
|
145
145
|
.description=${this.description}
|
|
@@ -204,7 +204,7 @@ var USlider = class USlider extends UFormControlElement {
|
|
|
204
204
|
* 순서에서 빠지고 프로그램적 `.focus()`는 여전히 통과하므로, `UInput.focus()`가
|
|
205
205
|
* 네이티브 `disabled` `<input>`에서 얻는 것과 같은 no-op을 여기서 직접 재현한다. */
|
|
206
206
|
focus(options) {
|
|
207
|
-
if (this.
|
|
207
|
+
if (this.effectivelyDisabled) return;
|
|
208
208
|
this.minThumbEl?.focus(options);
|
|
209
209
|
}
|
|
210
210
|
blur() {
|
|
@@ -236,10 +236,10 @@ var USlider = class USlider extends UFormControlElement {
|
|
|
236
236
|
aria-valuemax=${this.max}
|
|
237
237
|
aria-valuetext=${this.formatValue(val)}
|
|
238
238
|
aria-orientation="horizontal"
|
|
239
|
-
aria-disabled=${this.
|
|
239
|
+
aria-disabled=${this.effectivelyDisabled ? "true" : "false"}
|
|
240
240
|
?hidden=${isEnd && !this.range}
|
|
241
241
|
style="left: ${pct}%"
|
|
242
|
-
tabindex=${this.
|
|
242
|
+
tabindex=${this.effectivelyDisabled || isEnd && !this.range ? -1 : 0}
|
|
243
243
|
data-thumb=${thumb}
|
|
244
244
|
@keydown=${this.handleThumbKeyDown}
|
|
245
245
|
>
|
|
@@ -32,6 +32,14 @@ export declare class USwitch extends UFormControlElement<string> {
|
|
|
32
32
|
static styles: import('lit').CSSResultGroup[];
|
|
33
33
|
/** 체크 여부 */
|
|
34
34
|
checked: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 네이티브 `defaultChecked` 에 해당하는 값 — **처음 연결될 때의 `checked` 속성**.
|
|
37
|
+
* `checked` 는 반영(reflect)되는 속성이라 사용자가 바꾸면 속성도 바뀐다. 그래서 속성을
|
|
38
|
+
* 리셋 시점에 읽으면 «현재» 가 나온다 — 기본값은 그 전에 붙잡아 둔다.
|
|
39
|
+
*/
|
|
40
|
+
private defaultChecked?;
|
|
41
|
+
connectedCallback(): void;
|
|
42
|
+
protected restoreDefaults(): void;
|
|
35
43
|
inputEl?: HTMLInputElement;
|
|
36
44
|
protected shouldValidate(changed: PropertyValues): boolean;
|
|
37
45
|
/** `checked`(또는 그 값을 함께 결정하는 `value`)가 바뀌는 모든 경로(초기 속성 설정 ·
|
|
@@ -14,7 +14,7 @@ var USwitch = class USwitch extends UFormControlElement {
|
|
|
14
14
|
this.checked = false;
|
|
15
15
|
this.handleInputChange = (e) => {
|
|
16
16
|
e.stopImmediatePropagation();
|
|
17
|
-
if (this.readonly || this.
|
|
17
|
+
if (this.readonly || this.effectivelyDisabled) return;
|
|
18
18
|
const input = e.target;
|
|
19
19
|
this.checked = input.checked;
|
|
20
20
|
if (!this.novalidate) this.validate();
|
|
@@ -24,6 +24,14 @@ var USwitch = class USwitch extends UFormControlElement {
|
|
|
24
24
|
static {
|
|
25
25
|
this.styles = [super.styles, styles];
|
|
26
26
|
}
|
|
27
|
+
connectedCallback() {
|
|
28
|
+
this.defaultChecked ??= this.hasAttribute("checked");
|
|
29
|
+
super.connectedCallback();
|
|
30
|
+
}
|
|
31
|
+
restoreDefaults() {
|
|
32
|
+
super.restoreDefaults();
|
|
33
|
+
this.checked = this.defaultChecked ?? false;
|
|
34
|
+
}
|
|
27
35
|
shouldValidate(changed) {
|
|
28
36
|
return super.shouldValidate(changed) || changed.has("checked");
|
|
29
37
|
}
|
|
@@ -40,7 +48,7 @@ var USwitch = class USwitch extends UFormControlElement {
|
|
|
40
48
|
<input
|
|
41
49
|
type="checkbox"
|
|
42
50
|
aria-label=${ifDefined(this.contentAriaLabel)}
|
|
43
|
-
?disabled=${this.
|
|
51
|
+
?disabled=${this.effectivelyDisabled || this.readonly}
|
|
44
52
|
?required=${this.required}
|
|
45
53
|
.checked=${live(this.checked)}
|
|
46
54
|
@change=${this.handleInputChange}
|
|
@@ -34,7 +34,7 @@ var styles = css`
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/* === 상태 스타일 === */
|
|
37
|
-
:host(
|
|
37
|
+
:host(:disabled) {
|
|
38
38
|
opacity: 0.6;
|
|
39
39
|
cursor: not-allowed;
|
|
40
40
|
}
|
|
@@ -45,7 +45,7 @@ var styles = css`
|
|
|
45
45
|
outline: 2px solid var(--u-danger-color, #D32F2F);
|
|
46
46
|
outline-offset: 1px;
|
|
47
47
|
}
|
|
48
|
-
:host(:not(
|
|
48
|
+
:host(:not(:disabled):not([readonly]):hover) .track {
|
|
49
49
|
filter: brightness(0.95);
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -47,7 +47,7 @@ var UTextarea = class UTextarea extends UFormControlElement {
|
|
|
47
47
|
return html`
|
|
48
48
|
<u-field part="field"
|
|
49
49
|
?required=${this.required}
|
|
50
|
-
?disabled=${this.
|
|
50
|
+
?disabled=${this.effectivelyDisabled}
|
|
51
51
|
?invalid=${this.invalid}
|
|
52
52
|
.label=${this.label}
|
|
53
53
|
.description=${this.description}
|
|
@@ -59,7 +59,7 @@ var UTextarea = class UTextarea extends UFormControlElement {
|
|
|
59
59
|
aria-label=${ifDefined(this.resolvedAriaLabel)}
|
|
60
60
|
aria-description=${ifDefined(this.resolvedAriaDescription)}
|
|
61
61
|
?required=${this.required}
|
|
62
|
-
?disabled=${this.
|
|
62
|
+
?disabled=${this.effectivelyDisabled}
|
|
63
63
|
?readonly=${this.readonly}
|
|
64
64
|
rows=${this.minRows || 1}
|
|
65
65
|
minlength=${ifDefined(this.minlength)}
|
|
@@ -21,17 +21,17 @@ var styles = css`
|
|
|
21
21
|
transition: border-color var(--u-duration-normal, 220ms) var(--u-ease-standard, cubic-bezier(0.2, 0, 0, 1)), box-shadow var(--u-duration-normal, 220ms) var(--u-ease-standard, cubic-bezier(0.2, 0, 0, 1)), background-color var(--u-duration-normal, 220ms) var(--u-ease-standard, cubic-bezier(0.2, 0, 0, 1));
|
|
22
22
|
}
|
|
23
23
|
:host([readonly]) .container,
|
|
24
|
-
:host(
|
|
24
|
+
:host(:disabled) .container {
|
|
25
25
|
border-color: var(--u-border-color-weak, #EEEEEE);
|
|
26
26
|
background-color: var(--u-bg-color-disabled, #FAFAFA);
|
|
27
27
|
}
|
|
28
|
-
:host(:not([readonly]):not(
|
|
28
|
+
:host(:not([readonly]):not(:disabled)) .container:hover {
|
|
29
29
|
box-shadow: 0 0 0 1px var(--u-input-border-color-hover, #BDBDBD);
|
|
30
30
|
}
|
|
31
|
-
:host(:not([readonly]):not(
|
|
31
|
+
:host(:not([readonly]):not(:disabled)) .container:focus-within {
|
|
32
32
|
box-shadow: 0 0 0 1px var(--u-input-border-color-focus, #1565C0);
|
|
33
33
|
}
|
|
34
|
-
:host([invalid]:not([readonly]):not(
|
|
34
|
+
:host([invalid]:not([readonly]):not(:disabled)) .container {
|
|
35
35
|
box-shadow: 0 0 0 1px var(--u-input-border-color-invalid, #C62828);
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -43,20 +43,20 @@ var styles = css`
|
|
|
43
43
|
border-bottom: 2px solid var(--u-input-border-color, #E0E0E0);
|
|
44
44
|
}
|
|
45
45
|
:host([variant="filled"][readonly]) .container,
|
|
46
|
-
:host([variant="filled"]
|
|
46
|
+
:host([variant="filled"]:disabled) .container {
|
|
47
47
|
background-color: var(--u-bg-color-disabled, #FAFAFA);
|
|
48
48
|
border-bottom-color: var(--u-border-color-weak, #EEEEEE);
|
|
49
49
|
}
|
|
50
|
-
:host([variant="filled"]:not([readonly]):not(
|
|
50
|
+
:host([variant="filled"]:not([readonly]):not(:disabled)) .container:hover {
|
|
51
51
|
box-shadow: none;
|
|
52
52
|
background-color: var(--u-neutral-300, #E0E0E0);
|
|
53
53
|
border-bottom-color: var(--u-input-border-color-hover, #BDBDBD);
|
|
54
54
|
}
|
|
55
|
-
:host([variant="filled"]:not([readonly]):not(
|
|
55
|
+
:host([variant="filled"]:not([readonly]):not(:disabled)) .container:focus-within {
|
|
56
56
|
box-shadow: none;
|
|
57
57
|
border-bottom-color: var(--u-input-border-color-focus, #1565C0);
|
|
58
58
|
}
|
|
59
|
-
:host([variant="filled"][invalid]:not([readonly]):not(
|
|
59
|
+
:host([variant="filled"][invalid]:not([readonly]):not(:disabled)) .container {
|
|
60
60
|
box-shadow: none;
|
|
61
61
|
border-bottom-color: var(--u-input-border-color-invalid, #C62828);
|
|
62
62
|
}
|
|
@@ -71,20 +71,20 @@ var styles = css`
|
|
|
71
71
|
border-bottom: 1px solid var(--u-input-border-color, #E0E0E0);
|
|
72
72
|
}
|
|
73
73
|
:host([variant="underlined"][readonly]) .container,
|
|
74
|
-
:host([variant="underlined"]
|
|
74
|
+
:host([variant="underlined"]:disabled) .container {
|
|
75
75
|
background-color: transparent;
|
|
76
76
|
border-bottom-color: var(--u-border-color-weak, #EEEEEE);
|
|
77
77
|
}
|
|
78
|
-
:host([variant="underlined"]:not([readonly]):not(
|
|
78
|
+
:host([variant="underlined"]:not([readonly]):not(:disabled)) .container:hover {
|
|
79
79
|
box-shadow: none;
|
|
80
80
|
border-bottom-color: var(--u-input-border-color-hover, #BDBDBD);
|
|
81
81
|
}
|
|
82
|
-
:host([variant="underlined"]:not([readonly]):not(
|
|
82
|
+
:host([variant="underlined"]:not([readonly]):not(:disabled)) .container:focus-within {
|
|
83
83
|
box-shadow: none;
|
|
84
84
|
border-bottom-color: var(--u-input-border-color-focus, #1565C0);
|
|
85
85
|
border-bottom-width: 2px;
|
|
86
86
|
}
|
|
87
|
-
:host([variant="underlined"][invalid]:not([readonly]):not(
|
|
87
|
+
:host([variant="underlined"][invalid]:not([readonly]):not(:disabled)) .container {
|
|
88
88
|
box-shadow: none;
|
|
89
89
|
border-bottom-color: var(--u-input-border-color-invalid, #C62828);
|
|
90
90
|
}
|
|
@@ -97,8 +97,8 @@ var styles = css`
|
|
|
97
97
|
padding: 0;
|
|
98
98
|
box-shadow: none;
|
|
99
99
|
}
|
|
100
|
-
:host([variant="borderless"]:not([readonly]):not(
|
|
101
|
-
:host([variant="borderless"]:not([readonly]):not(
|
|
100
|
+
:host([variant="borderless"]:not([readonly]):not(:disabled)) .container:hover,
|
|
101
|
+
:host([variant="borderless"]:not([readonly]):not(:disabled)) .container:focus-within {
|
|
102
102
|
box-shadow: none;
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -149,7 +149,7 @@ var styles = css`
|
|
|
149
149
|
resize: none;
|
|
150
150
|
overflow: hidden;
|
|
151
151
|
}
|
|
152
|
-
:host(
|
|
152
|
+
:host(:disabled) textarea,
|
|
153
153
|
:host([readonly]) textarea {
|
|
154
154
|
resize: none;
|
|
155
155
|
}
|
package/package.json
CHANGED
|
@@ -256,9 +256,11 @@ All form control components (`u-input`, `u-select`, `u-checkbox`, etc.) use the
|
|
|
256
256
|
```ts
|
|
257
257
|
const input = document.querySelector('u-input');
|
|
258
258
|
input.validate(); // returns boolean, sets `invalid` attribute
|
|
259
|
-
input.reset(); //
|
|
259
|
+
input.reset(); // empties this control and clears its validation state
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
+
A native `form.reset()` (or `u-button type="reset"`) returns each control to its default — the `value` attribute, `checked` for checkbox/switch — not to empty. A disabled `<fieldset>` disables every control inside it (and `u-button`), exactly like the control's own `disabled` attribute. Style disabled controls with `:disabled`, not `[disabled]`.
|
|
263
|
+
|
|
262
264
|
### Using `u-form` for model binding
|
|
263
265
|
|
|
264
266
|
```ts
|