@iyulab/components 1.27.1 → 1.27.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.27.3] - 2026-08-11
4
+
5
+ ### Fixed
6
+
7
+ - **`u-textarea`'s form submission value now stays in sync with `value` across every change
8
+ path**, not just on `change`. Previously, `ElementInternals.setFormValue()` was only called
9
+ from the `change` handler, so submitting a form before the field lost focus (an initial
10
+ `value` attribute or a programmatic `.value =` assignment) could send a stale or missing
11
+ value. Sync now happens reactively whenever `value` changes, matching `u-input`'s contract.
12
+ - **`u-checkbox`/`u-switch`'s form submission value now stays in sync with `checked` across
13
+ every change path**, not just on the native `change` event. Previously,
14
+ `ElementInternals.setFormValue()` was only called from the click handler, so submitting a
15
+ form before interaction (an initial `checked` attribute or a programmatic `.checked =`
16
+ assignment) could send a stale or missing value. Sync now happens reactively whenever
17
+ `checked` (or `value`) changes.
18
+
19
+ ## [1.27.2] - 2026-08-11
20
+
21
+ ### Fixed
22
+
23
+ - **`u-input`'s form submission value now stays in sync with `value` across every change
24
+ path**, not just on blur. Previously, `ElementInternals.setFormValue()` was only called from
25
+ the blur handler, so submitting a form before a field lost focus (an initial `value`
26
+ attribute, a programmatic `.value =` assignment, or the clear button from 1.27.1) could send a
27
+ stale or missing value. Sync now happens reactively whenever `value` changes, matching
28
+ `u-select`'s existing contract.
29
+
3
30
  ## [1.27.1] - 2026-08-11
4
31
 
5
32
  ### Fixed
@@ -35,6 +35,10 @@ export declare class UCheckbox extends UFormControlElement<string> {
35
35
  checked: boolean;
36
36
  inputEl?: HTMLInputElement;
37
37
  protected shouldValidate(changed: PropertyValues): boolean;
38
+ /** `checked`(또는 그 값을 함께 결정하는 `value`)가 바뀌는 모든 경로(초기 속성 설정 ·
39
+ * 프로그램적 대입 · 사용자 클릭)에서 폼 제출값을 동기화한다 — `UInput`/`UTextarea`와
40
+ * 같은 경계(`DL-289-1`). */
41
+ protected updated(changedProperties: PropertyValues): void;
38
42
  render(): import('lit-html').TemplateResult<1>;
39
43
  protected setValidity(): void;
40
44
  reset(): void;
@@ -21,7 +21,6 @@ var UCheckbox = class UCheckbox extends UFormControlElement {
21
21
  const input = e.target;
22
22
  this.indeterminate = false;
23
23
  this.checked = input.checked;
24
- this.internals?.setFormValue(this.checked ? this.value || String(this.checked) : String(this.checked));
25
24
  if (!this.novalidate) this.validate();
26
25
  this.relay(e);
27
26
  };
@@ -32,6 +31,13 @@ var UCheckbox = class UCheckbox extends UFormControlElement {
32
31
  shouldValidate(changed) {
33
32
  return super.shouldValidate(changed) || changed.has("checked");
34
33
  }
34
+ /** `checked`(또는 그 값을 함께 결정하는 `value`)가 바뀌는 모든 경로(초기 속성 설정 ·
35
+ * 프로그램적 대입 · 사용자 클릭)에서 폼 제출값을 동기화한다 — `UInput`/`UTextarea`와
36
+ * 같은 경계(`DL-289-1`). */
37
+ updated(changedProperties) {
38
+ super.updated(changedProperties);
39
+ if (changedProperties.has("checked") || changedProperties.has("value")) this.internals?.setFormValue(this.checked ? this.value || String(this.checked) : String(this.checked));
40
+ }
35
41
  render() {
36
42
  return html`
37
43
  <label class="wrapper" part="wrapper">
@@ -1,3 +1,4 @@
1
+ import { PropertyValues } from 'lit';
1
2
  import { UFormControlElement } from '../UFormControlElement.js';
2
3
  import { UPopover } from '../popover/UPopover.js';
3
4
  export type InputType = 'text' | 'password' | 'email' | 'tel' | 'url' | 'search' | 'number' | 'date' | 'time' | 'datetime-local' | 'month' | 'week';
@@ -81,6 +82,12 @@ export declare class UInput extends UFormControlElement<string> {
81
82
  private options;
82
83
  disconnectedCallback(): void;
83
84
  render(): import('lit-html').TemplateResult<1>;
85
+ /** `value`가 바뀌는 모든 경로(초기 속성 설정 · 프로그램적 대입 · clear 버튼)에서
86
+ * 폼 제출값을 동기화한다 — 종전에는 `handleInputBlur`에서만 수동으로 호출해,
87
+ * blur 전에 폼이 제출되면(다른 컨트롤의 Enter 등) `FormData`가 낡은 값을 돌려줬다.
88
+ * 형제 `USelect`의 `updated()`+`onChangeValue()` 패턴과 같은 경계 — `T`가 이미
89
+ * `string`이라 `valueAsString` 같은 변환 없이 그대로 넘긴다. */
90
+ protected updated(changedProperties: PropertyValues): void;
84
91
  protected setValidity(): void;
85
92
  reset(): void;
86
93
  focus(options?: FocusOptions): void;
@@ -53,7 +53,6 @@ var UInput = class UInput extends UFormControlElement {
53
53
  };
54
54
  this.handleInputBlur = (_) => {
55
55
  this.value = this.inputEl?.value || "";
56
- this.internals?.setFormValue(this.value);
57
56
  if (!this.novalidate) this.validate();
58
57
  this.dispatchEvent(new Event("change", {
59
58
  bubbles: true,
@@ -213,6 +212,15 @@ var UInput = class UInput extends UFormControlElement {
213
212
  </u-popover>
214
213
  `;
215
214
  }
215
+ /** `value`가 바뀌는 모든 경로(초기 속성 설정 · 프로그램적 대입 · clear 버튼)에서
216
+ * 폼 제출값을 동기화한다 — 종전에는 `handleInputBlur`에서만 수동으로 호출해,
217
+ * blur 전에 폼이 제출되면(다른 컨트롤의 Enter 등) `FormData`가 낡은 값을 돌려줬다.
218
+ * 형제 `USelect`의 `updated()`+`onChangeValue()` 패턴과 같은 경계 — `T`가 이미
219
+ * `string`이라 `valueAsString` 같은 변환 없이 그대로 넘긴다. */
220
+ updated(changedProperties) {
221
+ super.updated(changedProperties);
222
+ if (changedProperties.has("value")) this.internals?.setFormValue(this.value ?? "");
223
+ }
216
224
  setValidity() {
217
225
  const v = this.inputEl?.validity;
218
226
  let flags = {};
@@ -34,6 +34,10 @@ export declare class USwitch extends UFormControlElement<string> {
34
34
  checked: boolean;
35
35
  inputEl?: HTMLInputElement;
36
36
  protected shouldValidate(changed: PropertyValues): boolean;
37
+ /** `checked`(또는 그 값을 함께 결정하는 `value`)가 바뀌는 모든 경로(초기 속성 설정 ·
38
+ * 프로그램적 대입 · 사용자 클릭)에서 폼 제출값을 동기화한다 — `UInput`/`UTextarea`/
39
+ * `UCheckbox`와 같은 경계(`DL-289-1`). */
40
+ protected updated(changedProperties: PropertyValues): void;
37
41
  render(): import('lit-html').TemplateResult<1>;
38
42
  protected setValidity(): void;
39
43
  reset(): void;
@@ -16,7 +16,6 @@ var USwitch = class USwitch extends UFormControlElement {
16
16
  if (this.readonly || this.disabled) return;
17
17
  const input = e.target;
18
18
  this.checked = input.checked;
19
- this.internals?.setFormValue(this.checked ? this.value || String(this.checked) : String(this.checked));
20
19
  if (!this.novalidate) this.validate();
21
20
  this.relay(e);
22
21
  };
@@ -27,6 +26,13 @@ var USwitch = class USwitch extends UFormControlElement {
27
26
  shouldValidate(changed) {
28
27
  return super.shouldValidate(changed) || changed.has("checked");
29
28
  }
29
+ /** `checked`(또는 그 값을 함께 결정하는 `value`)가 바뀌는 모든 경로(초기 속성 설정 ·
30
+ * 프로그램적 대입 · 사용자 클릭)에서 폼 제출값을 동기화한다 — `UInput`/`UTextarea`/
31
+ * `UCheckbox`와 같은 경계(`DL-289-1`). */
32
+ updated(changedProperties) {
33
+ super.updated(changedProperties);
34
+ if (changedProperties.has("checked") || changedProperties.has("value")) this.internals?.setFormValue(this.checked ? this.value || String(this.checked) : String(this.checked));
35
+ }
30
36
  render() {
31
37
  return html`
32
38
  <label class="wrapper" part="wrapper">
@@ -25,7 +25,6 @@ var UTextarea = class UTextarea extends UFormControlElement {
25
25
  };
26
26
  this.handleTextareaChange = (e) => {
27
27
  this.value = this.textareaEl?.value;
28
- this.internals?.setFormValue(this.value || "");
29
28
  if (!this.novalidate) this.validate();
30
29
  this.relay(e);
31
30
  };
@@ -35,6 +34,7 @@ var UTextarea = class UTextarea extends UFormControlElement {
35
34
  }
36
35
  async updated(changedProperties) {
37
36
  super.updated(changedProperties);
37
+ if (changedProperties.has("value")) this.internals?.setFormValue(this.value ?? "");
38
38
  await this.updateComplete;
39
39
  if (this.resize === "auto" && [
40
40
  "value",
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.27.1",
4
+ "version": "1.27.3",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",