@iyulab/components 1.27.2 → 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,21 @@
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
+
3
19
  ## [1.27.2] - 2026-08-11
4
20
 
5
21
  ### 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">
@@ -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.2",
4
+ "version": "1.27.3",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",