@iyulab/components 1.49.1 → 1.51.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +1 -1
  3. package/dist/components/UFormControlElement.d.ts +29 -2
  4. package/dist/components/UFormControlElement.js +31 -0
  5. package/dist/components/UFormControlElement.styles.js +1 -1
  6. package/dist/components/breadcrumb/UBreadcrumb.d.ts +5 -2
  7. package/dist/components/breadcrumb/UBreadcrumb.js +18 -21
  8. package/dist/components/button/UButton.d.ts +6 -0
  9. package/dist/components/button/UButton.js +16 -5
  10. package/dist/components/button/UButton.styles.js +1 -1
  11. package/dist/components/checkbox/UCheckbox.d.ts +8 -0
  12. package/dist/components/checkbox/UCheckbox.js +10 -2
  13. package/dist/components/checkbox/UCheckbox.styles.js +2 -2
  14. package/dist/components/date-picker/UDatePicker.js +5 -5
  15. package/dist/components/date-picker/UDatePicker.styles.js +4 -4
  16. package/dist/components/file-input/UFileInput.js +5 -5
  17. package/dist/components/input/UInput.js +5 -4
  18. package/dist/components/input/UInput.styles.js +14 -14
  19. package/dist/components/radio/URadio.js +7 -6
  20. package/dist/components/radio/URadio.styles.js +1 -1
  21. package/dist/components/rating/URating.js +7 -7
  22. package/dist/components/rating/URating.styles.js +1 -1
  23. package/dist/components/select/USelect.js +6 -6
  24. package/dist/components/select/USelect.styles.js +15 -15
  25. package/dist/components/slider/USlider.js +6 -6
  26. package/dist/components/switch/USwitch.d.ts +8 -0
  27. package/dist/components/switch/USwitch.js +10 -2
  28. package/dist/components/switch/USwitch.styles.js +2 -2
  29. package/dist/components/textarea/UTextarea.js +2 -2
  30. package/dist/components/textarea/UTextarea.styles.js +15 -15
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +2 -1
  33. package/dist/utilities/Dialog.js +2 -1
  34. package/dist/utilities/OverlayManager.js +2 -1
  35. package/dist/utilities/keyboard.d.ts +20 -0
  36. package/dist/utilities/keyboard.js +25 -0
  37. package/package.json +1 -1
  38. package/skills/iyulab-components/SKILL.md +1 -0
  39. package/skills/iyulab-components/references/usage.md +3 -1
  40. package/skills/iyulab-components/references/utilities/keyboard.md +27 -0
@@ -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.disabled) return;
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.disabled) return;
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.disabled || this.readonly;
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.disabled}
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.disabled ? "true" : void 0)}
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.disabled || this.readonly;
130
+ option.disabled = this.effectivelyDisabled || this.readonly;
130
131
  }
131
132
  }
132
133
  cleanup(options) {
@@ -14,7 +14,7 @@ var styles = css`
14
14
  font-family: var(--u-font-base);
15
15
  color: var(--u-txt-color, #212121);
16
16
  }
17
- :host([disabled]) {
17
+ :host(:disabled) {
18
18
  opacity: 0.6;
19
19
  pointer-events: none;
20
20
  }
@@ -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.disabled || this.readonly) return;
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.disabled || this.readonly) return;
34
+ if (this.effectivelyDisabled || this.readonly) return;
35
35
  this.buffer = -1;
36
36
  };
37
37
  this.handleSymbolClick = (e) => {
38
- if (this.disabled || this.readonly) return;
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.disabled || this.readonly) return;
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.disabled && !this.readonly;
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.disabled}
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.disabled ? "true" : void 0)}
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) => {
@@ -41,7 +41,7 @@ var styles = css`
41
41
  outline: 2px solid var(--u-primary-color-strong, #1565C0);
42
42
  outline-offset: 2px;
43
43
  }
44
- :host(:not([disabled]):not([readonly])) .symbol:hover {
44
+ :host(:not(:disabled):not([readonly])) .symbol:hover {
45
45
  transform: scale(1.2);
46
46
  }
47
47
 
@@ -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.disabled}
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.disabled ? "-1" : "0"}
178
+ <div class="container" part="container" tabindex=${this.effectivelyDisabled ? "-1" : "0"}
179
179
  role="combobox"
180
- aria-disabled=${ifDefined(this.disabled ? "true" : void 0)}
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.disabled || this.readonly}
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.disabled) return;
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.disabled;
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([disabled]) .container {
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([disabled]) .container {
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([disabled])) .container:hover {
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([disabled])) .container:focus-within {
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([disabled])) .container {
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"][disabled]) .container {
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([disabled])) .container:hover {
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([disabled])) .container:focus-within {
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([disabled])) .container {
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"][disabled]) .container {
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([disabled])) .container:hover {
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([disabled])) .container:focus-within {
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([disabled])) .container {
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([disabled])) .container:hover,
119
- :host([variant="borderless"]:not([readonly]):not([disabled])) .container:focus-within {
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.disabled || this.readonly) return;
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.disabled || this.readonly) return;
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.disabled}
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.disabled) return;
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.disabled ? "true" : "false"}
239
+ aria-disabled=${this.effectivelyDisabled ? "true" : "false"}
240
240
  ?hidden=${isEnd && !this.range}
241
241
  style="left: ${pct}%"
242
- tabindex=${this.disabled || isEnd && !this.range ? -1 : 0}
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.disabled) return;
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.disabled || this.readonly}
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([disabled]) {
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([disabled]):not([readonly]):hover) .track {
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.disabled}
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.disabled}
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([disabled]) .container {
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([disabled])) .container:hover {
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([disabled])) .container:focus-within {
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([disabled])) .container {
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"][disabled]) .container {
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([disabled])) .container:hover {
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([disabled])) .container:focus-within {
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([disabled])) .container {
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"][disabled]) .container {
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([disabled])) .container:hover {
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([disabled])) .container:focus-within {
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([disabled])) .container {
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([disabled])) .container:hover,
101
- :host([variant="borderless"]:not([readonly]):not([disabled])) .container:focus-within {
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([disabled]) textarea,
152
+ :host(:disabled) textarea,
153
153
  :host([readonly]) textarea {
154
154
  resize: none;
155
155
  }
package/dist/index.d.ts CHANGED
@@ -64,6 +64,7 @@ export * from './utilities/Dialog.js';
64
64
  export * from './utilities/elements.js';
65
65
  export * from './utilities/format.js';
66
66
  export * from './utilities/icons.js';
67
+ export * from './utilities/keyboard.js';
67
68
  export * from './utilities/Locale.js';
68
69
  export * from './utilities/OverlayManager.js';
69
70
  export * from './utilities/Theme.js';
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import { UElement } from "./components/UElement.js";
2
2
  import { getParentElement, isCoarsePointer, isFocusCandidate, querySelectorAllWithin, querySelectorDeep, querySelectorWithin } from "./utilities/elements.js";
3
3
  import { UFloatingElement } from "./components/UFloatingElement.js";
4
4
  import { UFormControlElement } from "./components/UFormControlElement.js";
5
+ import { isImeComposing } from "./utilities/keyboard.js";
5
6
  import { OverlayManager } from "./utilities/OverlayManager.js";
6
7
  import { arrayAttrConverter, booleanAttrConverter, dateAttrConverter, jsonAttrConverter, urlAttrConverter } from "./utilities/converters.js";
7
8
  import { UOverlayElement } from "./components/UOverlayElement.js";
@@ -59,4 +60,4 @@ import { BrowserStorage } from "./utilities/BrowserStorage.js";
59
60
  import { Dialog } from "./utilities/Dialog.js";
60
61
  import { Theme } from "./utilities/Theme.js";
61
62
  import { Toast } from "./utilities/Toast.js";
62
- export { ALERT_STATUSES, BrowserStorage, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCopyButton, UDatePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOverlayElement, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USwitch, UTab, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, arrayAttrConverter, booleanAttrConverter, createDevWarner, dateAttrConverter, devWarnOnce, formatCurrency, formatDate, formatNumber, getDefaultBaseUrl, getParentElement, isCoarsePointer, isFocusCandidate, jsonAttrConverter, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter };
63
+ export { ALERT_STATUSES, BrowserStorage, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCopyButton, UDatePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOverlayElement, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USwitch, UTab, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, arrayAttrConverter, booleanAttrConverter, createDevWarner, dateAttrConverter, devWarnOnce, formatCurrency, formatDate, formatNumber, getDefaultBaseUrl, getParentElement, isCoarsePointer, isFocusCandidate, isImeComposing, jsonAttrConverter, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter };
@@ -1,3 +1,4 @@
1
+ import { isImeComposing } from "./keyboard.js";
1
2
  import "../components/button/UButton.js";
2
3
  import { Locale } from "./Locale.js";
3
4
  import { UDialog } from "../components/dialog/UDialog.js";
@@ -60,7 +61,7 @@ var Dialog = class {
60
61
  inputValue = e.target.value || "";
61
62
  }}
62
63
  @keydown=${(e) => {
63
- if (e.key === "Enter") {
64
+ if (e.key === "Enter" && !isImeComposing(e)) {
64
65
  const input = e.target;
65
66
  inputValue = input.value || "";
66
67
  const buttons = input.closest("u-dialog").querySelectorAll("u-button");
@@ -1,3 +1,4 @@
1
+ import { isImeComposing } from "./keyboard.js";
1
2
  //#region src/utilities/OverlayManager.ts
2
3
  /**
3
4
  * OverlayManager는 **겹치는 표면 전체의 층(layer)을 소유**합니다.
@@ -86,7 +87,7 @@ var OverlayManager = class OverlayManager {
86
87
  }
87
88
  static {
88
89
  this.handleLayerKeydown = (e) => {
89
- if (e.key !== "Escape" || e.isComposing || e.defaultPrevented) return;
90
+ if (e.key !== "Escape" || isImeComposing(e) || e.defaultPrevented) return;
90
91
  const top = OverlayManager.layers[OverlayManager.layers.length - 1];
91
92
  if (!top) return;
92
93
  if (top.onEscape(e) === false) return;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Whether a key event belongs to an IME composition — typing Korean, Japanese, Chinese and other
3
+ * languages that build a character from several keystrokes.
4
+ *
5
+ * The Enter (or Escape) that confirms a composition is not a command: a handler that submits,
6
+ * commits a cell or closes a layer on Enter should ignore it, or the last syllable is sent twice
7
+ * or the action fires in the middle of a word.
8
+ *
9
+ * `isComposing` alone is not enough — Safari delivers the confirming key after `compositionend`,
10
+ * with `isComposing` false and `keyCode` 229 ("IME is processing").
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * onKeydown(e: KeyboardEvent) {
15
+ * if (e.key !== 'Enter' || isImeComposing(e)) return;
16
+ * this.submit();
17
+ * }
18
+ * ```
19
+ */
20
+ export declare function isImeComposing(e: KeyboardEvent): boolean;
@@ -0,0 +1,25 @@
1
+ //#region src/utilities/keyboard.ts
2
+ /**
3
+ * Whether a key event belongs to an IME composition — typing Korean, Japanese, Chinese and other
4
+ * languages that build a character from several keystrokes.
5
+ *
6
+ * The Enter (or Escape) that confirms a composition is not a command: a handler that submits,
7
+ * commits a cell or closes a layer on Enter should ignore it, or the last syllable is sent twice
8
+ * or the action fires in the middle of a word.
9
+ *
10
+ * `isComposing` alone is not enough — Safari delivers the confirming key after `compositionend`,
11
+ * with `isComposing` false and `keyCode` 229 ("IME is processing").
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * onKeydown(e: KeyboardEvent) {
16
+ * if (e.key !== 'Enter' || isImeComposing(e)) return;
17
+ * this.submit();
18
+ * }
19
+ * ```
20
+ */
21
+ function isImeComposing(e) {
22
+ return e.isComposing || e.keyCode === 229;
23
+ }
24
+ //#endregion
25
+ export { isImeComposing };
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": "1.49.1",
4
+ "version": "1.51.0",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",
@@ -134,6 +134,7 @@ carries the control's role, not on the host element. Native nodes use native `di
134
134
  - [`Locale`](./references/utilities/locale.md) — Validation-message locale registry and lookup utility
135
135
  - [`elements`](./references/utilities/elements.md) — Shadow-DOM-aware DOM query helpers
136
136
  - [`format`](./references/utilities/format.md) — Locale-aware number, currency and date formatting
137
+ - [`keyboard`](./references/utilities/keyboard.md) — `isImeComposing` for Enter handlers that must not fire mid-composition (Korean/Japanese/Chinese input)
137
138
  - [`OverlayManager`](./references/utilities/overlay-manager.md) — Internal overlay stack and z-index manager
138
139
 
139
140
  ---
@@ -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(); // clears value and validation state
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