@iyulab/components 2.10.2 → 2.11.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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.11.0] - 2026-10-07
4
+
5
+ ### Added
6
+
7
+ - **`chars` on `u-select`, `u-date-picker` and `u-date-range-picker`** — the same declaration `u-input` has: an unsized
8
+ field draws at N characters + its suffix buttons + padding, and a sized one uses it as the text floor. These fields
9
+ had only the text floor (`--*-min-text`), so a consumer sized them by copying the clear, arrow and calendar button
10
+ boxes and the padding into a `calc()`. An unsized `u-select` also widened and narrowed with the chosen option; with
11
+ `chars` its width holds and a longer option ends in an ellipsis.
12
+
13
+ ## [2.10.3] - 2026-10-07
14
+
15
+ ### Fixed
16
+
17
+ - `u-input` and `u-select` register the `u-popover` they render with an explicit import. They imported `UPopover` for
18
+ a type only, and the published modules kept the import by accident (decorator metadata) — a build setting away from
19
+ the same undefined-element failure 2.10.2 fixed for `u-select`'s chips.
20
+
3
21
  ## [2.10.2] - 2026-10-07
4
22
 
5
23
  ### Fixed
@@ -64,6 +64,12 @@ export declare class UDatePicker extends UFormControlElement<string> {
64
64
  static styles: import('lit').CSSResultGroup[];
65
65
  /** 크기 — 다른 필드·버튼과 같은 세 단(`sm` 12px · `md` = `--u-density`(14px) · `lg` 16px). */
66
66
  size: FieldSize;
67
+ /**
68
+ * 칸이 담을 글자 수 — 지정하면 폭을 정하지 않은 칸(기본 `inline-block`)이 «N자 + 지우기·달력 버튼 + 패딩» 폭으로 그려지고,
69
+ * 그보다 좁게 주면 넘친다(글자 영역 하한이 N자가 된다). 값의 표시 형식(`format`)이 정하는 길이를 주면 칸이 꼭 그만큼이다. `u-input` 의 `chars` 와 같은 축이다.
70
+ * 폭을 준 칸에서는 하한으로만 쓴다.
71
+ */
72
+ chars?: number;
67
73
  /** `date` (default) selects a calendar day only. `datetime` also captures a time-of-day and
68
74
  * the value becomes a complete ISO-8601 `DateTimeOffset` string. */
69
75
  mode: DatePickerMode;
@@ -9,6 +9,7 @@ import { isDayUnavailable, parseISODate, toISODate } from "../calendar/dates.js"
9
9
  import { UCalendar } from "../calendar/UCalendar.js";
10
10
  import "../field/UField.js";
11
11
  import { UPopover } from "../popover/UPopover.js";
12
+ import { charsWidth } from "../../utilities/chars.js";
12
13
  import { DateTextController } from "../calendar/date-text-controller.js";
13
14
  import { normalizeTime, splitDateTime, toDateTimeOffset } from "../calendar/datetime.js";
14
15
  import { styles } from "../calendar/picker.styles.js";
@@ -171,6 +172,7 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
171
172
  return (this.clearable && this.value ? 1 : 0) + 1;
172
173
  }
173
174
  render() {
175
+ const chars = charsWidth(this.chars);
174
176
  const datetime = this.mode === "datetime";
175
177
  return html`
176
178
  <u-field part="field"
@@ -182,8 +184,9 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
182
184
  .validationMessage=${this.validationMessage}
183
185
  >
184
186
  <div class="container" part="container" @click=${this.textEntry.handleContainerClick}
185
- style=${`--_icons: ${this.suffixButtonCount()}`}>
187
+ style=${`--_icons: ${this.suffixButtonCount()}${chars ? `; --date-picker-min-text: ${chars}` : ""}`}>
186
188
  <input class="text-input" part="input"
189
+ style=${ifDefined(chars ? `inline-size: ${chars}` : void 0)}
187
190
  type="text"
188
191
  inputmode=${datetime ? "text" : "numeric"}
189
192
  autocomplete="off"
@@ -390,6 +393,10 @@ __decorate([property({
390
393
  type: String,
391
394
  reflect: true
392
395
  }), __decorateMetadata("design:type", Object)], UDatePicker.prototype, "size", void 0);
396
+ __decorate([property({
397
+ type: Number,
398
+ reflect: true
399
+ }), __decorateMetadata("design:type", Number)], UDatePicker.prototype, "chars", void 0);
393
400
  __decorate([property({
394
401
  type: String,
395
402
  reflect: true
@@ -78,6 +78,12 @@ export declare class UDateRangePicker extends UFormControlElement<string> {
78
78
  static styles: import('lit').CSSResultGroup[];
79
79
  /** 크기 — 다른 필드·버튼과 같은 세 단(`sm` 12px · `md` = `--u-density`(14px) · `lg` 16px). */
80
80
  size: FieldSize;
81
+ /**
82
+ * 칸이 담을 글자 수 — 지정하면 폭을 정하지 않은 칸(기본 `inline-block`)이 «N자 + 지우기·달력 버튼 + 패딩» 폭으로 그려지고,
83
+ * 그보다 좁게 주면 넘친다(글자 영역 하한이 N자가 된다). 두 날짜와 구분자(`a – b`)를 담을 길이를 준다. `u-input` 의 `chars` 와 같은 축이다.
84
+ * 폭을 준 칸에서는 하한으로만 쓴다.
85
+ */
86
+ chars?: number;
81
87
  /** Earliest selectable day (ISO `YYYY-MM-DD`), inclusive. */
82
88
  min?: string;
83
89
  /** Latest selectable day (ISO `YYYY-MM-DD`), inclusive. */
@@ -10,6 +10,7 @@ import { parseISODate } from "../calendar/dates.js";
10
10
  import { UCalendar } from "../calendar/UCalendar.js";
11
11
  import "../field/UField.js";
12
12
  import { UPopover } from "../popover/UPopover.js";
13
+ import { charsWidth } from "../../utilities/chars.js";
13
14
  import { DateTextController } from "../calendar/date-text-controller.js";
14
15
  import { normalizeTime, splitDateTime, toDateTimeOffset } from "../calendar/datetime.js";
15
16
  import { styles } from "../calendar/picker.styles.js";
@@ -206,6 +207,7 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
206
207
  return (this.clearable && this.value ? 1 : 0) + 1;
207
208
  }
208
209
  render() {
210
+ const chars = charsWidth(this.chars);
209
211
  const pattern = this.mode === "datetime" ? `${dateTextPattern(this.format)} ${this.seconds ? "HH:mm:ss" : "HH:mm"}` : dateTextPattern(this.format);
210
212
  return html`
211
213
  <u-field part="field"
@@ -217,8 +219,9 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
217
219
  .validationMessage=${this.validationMessage}
218
220
  >
219
221
  <div class="container" part="container" @click=${this.textEntry.handleContainerClick}
220
- style=${`--_icons: ${this.suffixButtonCount()}`}>
222
+ style=${`--_icons: ${this.suffixButtonCount()}${chars ? `; --date-range-picker-min-text: ${chars}` : ""}`}>
221
223
  <input class="text-input" part="input"
224
+ style=${ifDefined(chars ? `inline-size: ${chars}` : void 0)}
222
225
  type="text"
223
226
  autocomplete="off"
224
227
  role="combobox"
@@ -462,6 +465,10 @@ __decorate([property({
462
465
  type: String,
463
466
  reflect: true
464
467
  }), __decorateMetadata("design:type", Object)], UDateRangePicker.prototype, "size", void 0);
468
+ __decorate([property({
469
+ type: Number,
470
+ reflect: true
471
+ }), __decorateMetadata("design:type", Number)], UDateRangePicker.prototype, "chars", void 0);
465
472
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UDateRangePicker.prototype, "min", void 0);
466
473
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UDateRangePicker.prototype, "max", void 0);
467
474
  __decorate([property({
@@ -121,7 +121,7 @@ export declare class UInput extends UFormControlElement<string> {
121
121
  * `string`이라 `valueAsString` 같은 변환 없이 그대로 넘긴다. */
122
122
  protected willUpdate(changedProperties: PropertyValues): void;
123
123
  protected updated(changedProperties: PropertyValues): void;
124
- /** `chars` 를 CSS 길이로 — 양의 정수일 때만(그 밖은 지정 없음과 같다). */
124
+ /** `chars` 를 CSS 길이로 — 양의 수일 때만(그 밖은 지정 없음과 같다). */
125
125
  private get charsWidth();
126
126
  /** The shown number uses the locale's decimal separator — re-show it in the new locale (unless the user is typing in it). */
127
127
  protected localeChanged(): void;
@@ -7,7 +7,8 @@ import "../spinner/USpinner.js";
7
7
  import "../icon/UIcon.js";
8
8
  import { parseNumber } from "../../utilities/format.js";
9
9
  import "../field/UField.js";
10
- import { UPopover } from "../popover/UPopover.js";
10
+ import "../popover/UPopover.js";
11
+ import { charsWidth } from "../../utilities/chars.js";
11
12
  import { UOption } from "../option/UOption.js";
12
13
  import { styles } from "./UInput.styles.js";
13
14
  import { html } from "lit";
@@ -306,10 +307,9 @@ var UInput = class UInput extends UFormControlElement {
306
307
  super.updated(changedProperties);
307
308
  if (changedProperties.has("value")) this.internals?.setFormValue(this.value ?? "");
308
309
  }
309
- /** `chars` 를 CSS 길이로 — 양의 정수일 때만(그 밖은 지정 없음과 같다). */
310
+ /** `chars` 를 CSS 길이로 — 양의 수일 때만(그 밖은 지정 없음과 같다). */
310
311
  get charsWidth() {
311
- const n = this.chars;
312
- return n != null && Number.isFinite(n) && n > 0 ? `${Math.ceil(n)}ch` : void 0;
312
+ return charsWidth(this.chars);
313
313
  }
314
314
  /** The shown number uses the locale's decimal separator — re-show it in the new locale (unless the user is typing in it). */
315
315
  localeChanged() {
@@ -529,7 +529,7 @@ __decorate([property({ type: String }), __decorateMetadata("design:type", String
529
529
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UInput.prototype, "pattern", void 0);
530
530
  __decorate([query(".container", true), __decorateMetadata("design:type", typeof HTMLDivElement === "undefined" ? Object : HTMLDivElement)], UInput.prototype, "containerEl", void 0);
531
531
  __decorate([query("input", true), __decorateMetadata("design:type", typeof HTMLInputElement === "undefined" ? Object : HTMLInputElement)], UInput.prototype, "inputEl", void 0);
532
- __decorate([query("u-popover", true), __decorateMetadata("design:type", typeof UPopover === "undefined" ? Object : UPopover)], UInput.prototype, "popoverEl", void 0);
532
+ __decorate([query("u-popover", true), __decorateMetadata("design:type", Object)], UInput.prototype, "popoverEl", void 0);
533
533
  __decorate([state(), __decorateMetadata("design:type", Boolean)], UInput.prototype, "showPassword", void 0);
534
534
  __decorate([state(), __decorateMetadata("design:type", String)], UInput.prototype, "numberText", void 0);
535
535
  UInput = __decorate([customElement("u-input")], UInput);
@@ -49,6 +49,12 @@ export declare class USelect extends UFormControlElement<string | string[]> {
49
49
  * 한 줄에 서도록. 테마는 필드 상자 토큰(`--u-field-padding-block`)으로 단마다 높이를 다듬는다.
50
50
  */
51
51
  size: FieldSize;
52
+ /**
53
+ * 칸이 담을 글자 수 — 지정하면 폭을 정하지 않은 칸(기본 `inline-block`)이 «N자 + 지우기·펼침 화살표 + 패딩» 폭으로 그려져
54
+ * 고른 값이 바뀌어도 폭이 흔들리지 않고(더 긴 값은 말줄임), 그보다 좁게 주면 넘친다(표시 글자 하한이 N자가 된다).
55
+ * `u-input` 의 `chars` 와 같은 축이다. 폭을 준 칸(`--u-select-width`·`block`)에서는 하한으로만 쓴다.
56
+ */
57
+ chars?: number;
52
58
  /** 다중 선택 여부 */
53
59
  multiple: boolean;
54
60
  /** 검색 가능 여부 */
@@ -6,7 +6,8 @@ import "../spinner/USpinner.js";
6
6
  import "../icon/UIcon.js";
7
7
  import "../chip/UChip.js";
8
8
  import "../field/UField.js";
9
- import { UPopover } from "../popover/UPopover.js";
9
+ import "../popover/UPopover.js";
10
+ import { charsWidth } from "../../utilities/chars.js";
10
11
  import { UOption } from "../option/UOption.js";
11
12
  import { styles } from "./USelect.styles.js";
12
13
  import { html } from "lit";
@@ -165,6 +166,7 @@ var USelect = class USelect extends UFormControlElement {
165
166
  if (changedProperties.has("open")) this.internals?.states[this.open ? "add" : "delete"]("open");
166
167
  }
167
168
  render() {
169
+ const chars = charsWidth(this.chars);
168
170
  return html`
169
171
  <u-field part="field"
170
172
  ?required=${this.required}
@@ -179,7 +181,7 @@ var USelect = class USelect extends UFormControlElement {
179
181
  </span>
180
182
 
181
183
  <div class="container" part="container" tabindex=${this.effectivelyDisabled ? "-1" : "0"}
182
- style=${`--_clear: ${this.clearable && this.hasValue && !this.effectivelyDisabled && !this.readonly ? 1 : 0}`}
184
+ style=${`--_clear: ${this.clearable && this.hasValue && !this.effectivelyDisabled && !this.readonly ? 1 : 0}${chars ? `; --select-min-text: ${chars}; --_chars: ${chars}` : ""}`}
183
185
  role="combobox"
184
186
  aria-disabled=${ifDefined(this.effectivelyDisabled ? "true" : void 0)}
185
187
  aria-label=${ifDefined(this.resolvedAriaLabel)}
@@ -343,6 +345,10 @@ __decorate([property({
343
345
  type: String,
344
346
  reflect: true
345
347
  }), __decorateMetadata("design:type", Object)], USelect.prototype, "size", void 0);
348
+ __decorate([property({
349
+ type: Number,
350
+ reflect: true
351
+ }), __decorateMetadata("design:type", Number)], USelect.prototype, "chars", void 0);
346
352
  __decorate([property({
347
353
  type: Boolean,
348
354
  reflect: true
@@ -378,7 +384,7 @@ __decorate([property({ converter: { fromAttribute: (value) => {
378
384
  return value;
379
385
  } } }), __decorateMetadata("design:type", Object)], USelect.prototype, "value", void 0);
380
386
  __decorate([query(".container", true), __decorateMetadata("design:type", typeof HTMLElement === "undefined" ? Object : HTMLElement)], USelect.prototype, "containerEl", void 0);
381
- __decorate([query("u-popover", true), __decorateMetadata("design:type", typeof UPopover === "undefined" ? Object : UPopover)], USelect.prototype, "popoverEl", void 0);
387
+ __decorate([query("u-popover", true), __decorateMetadata("design:type", Object)], USelect.prototype, "popoverEl", void 0);
382
388
  __decorate([state(), __decorateMetadata("design:type", Array)], USelect.prototype, "options", void 0);
383
389
  __decorate([state(), __decorateMetadata("design:type", Boolean)], USelect.prototype, "open", void 0);
384
390
  USelect = __decorate([customElement("u-select")], USelect);
@@ -163,6 +163,13 @@ var styles = css`
163
163
  color: var(--u-txt-color-weak, #616161);
164
164
  }
165
165
 
166
+ /* chars — 표시 글자 요소의 폭을 N자로(렌더가 --_chars 를 준다). 고유 폭 계산에서 고른 값의 길이 대신 이 값이 쓰여
167
+ 칸이 값마다 흔들리지 않고, 폭을 받은 칸에서는 flex: 1 이 그대로 채운다. 없으면 종전 auto. */
168
+ .text-content,
169
+ .chips-content {
170
+ inline-size: var(--_chars, auto);
171
+ }
172
+
166
173
  .chips-content {
167
174
  flex: 1;
168
175
  min-width: 0;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `chars`(칸이 담을 글자 수)를 CSS 길이로 — 양의 유한수일 때만(그 밖은 지정 없음과 같다). 소수는 올린다.
3
+ *
4
+ * 글자를 받는 폼 컨트롤(`u-input`·`u-select`·`u-date-picker`·`u-date-range-picker`)이 같은 규칙을 쓴다 —
5
+ * 각자 글자 영역 하한(`--*-min-text`)과 표시 글자 요소의 폭에 이 값을 준다. 한 곳에서 정해 형제가 갈리지 않게 한다.
6
+ */
7
+ export declare function charsWidth(n: number | undefined | null): string | undefined;
@@ -0,0 +1,12 @@
1
+ //#region src/utilities/chars.ts
2
+ /**
3
+ * `chars`(칸이 담을 글자 수)를 CSS 길이로 — 양의 유한수일 때만(그 밖은 지정 없음과 같다). 소수는 올린다.
4
+ *
5
+ * 글자를 받는 폼 컨트롤(`u-input`·`u-select`·`u-date-picker`·`u-date-range-picker`)이 같은 규칙을 쓴다 —
6
+ * 각자 글자 영역 하한(`--*-min-text`)과 표시 글자 요소의 폭에 이 값을 준다. 한 곳에서 정해 형제가 갈리지 않게 한다.
7
+ */
8
+ function charsWidth(n) {
9
+ return n != null && Number.isFinite(n) && n > 0 ? `${Math.ceil(n)}ch` : void 0;
10
+ }
11
+ //#endregion
12
+ export { charsWidth };
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": "2.10.2",
4
+ "version": "2.11.0",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",
@@ -82,6 +82,7 @@ starts from the value. Typing in the text box still commits on Enter or leaving
82
82
  | `min` | `string` | — | — | Minimum selectable date (ISO `YYYY-MM-DD`, date-only in both modes) |
83
83
  | `max` | `string` | — | — | Maximum selectable date (ISO `YYYY-MM-DD`, date-only in both modes) |
84
84
  | `size` | `'sm'\|'md'\|'lg'` | `'md'` | ✓ | Field size, like a button's: 12px · `--u-density` (14px) · 16px. A field and a button of the same size share a height |
85
+ | `chars` | `number` | — | ✓ | Characters the field holds. An unsized field draws at N characters + its clear and calendar buttons + padding; a sized one uses it as the text floor, so a narrower box overflows. Give the length of the `format` pattern for a box that fits it exactly. Same axis as `u-input`'s `chars` |
85
86
  | `clearable` | `boolean` | `false` | ✓ | Show clear button |
86
87
  | `isDateDisabled` | `(date: string) => boolean` | — | — | App rule for days that cannot be chosen (ISO in, `true` = disabled). Property only; see «Disabled days» |
87
88
  | `placeholder` | `string` | — | — | Placeholder text (defaults to the pattern to type, e.g. `YYYY-MM-DD` or `YYYY-MM-DD HH:mm`) |
@@ -138,6 +138,7 @@ picker.addEventListener('change', () => {
138
138
  | `min` | `string` | — | — | Earliest selectable day (ISO `YYYY-MM-DD`), inclusive |
139
139
  | `max` | `string` | — | — | Latest selectable day (ISO `YYYY-MM-DD`), inclusive |
140
140
  | `size` | `'sm'\|'md'\|'lg'` | `'md'` | ✓ | Field size, like a button's: 12px · `--u-density` (14px) · 16px. A field and a button of the same size share a height |
141
+ | `chars` | `number` | — | ✓ | Characters the field holds — both dates and the separator (`a – b`). An unsized field draws at N characters + its clear and calendar buttons + padding; a sized one uses it as the text floor, so a narrower box overflows. Same axis as `u-input`'s `chars` |
141
142
  | `clearable` | `boolean` | `false` | ✓ | Show clear button |
142
143
  | `isDateDisabled` | `(date: string) => boolean` | — | — | App rule for days that cannot start or end a range (ISO in, `true` = disabled). Property only; see «Disabled days» |
143
144
  | `placeholder` | `string` | — | — | Placeholder text (defaults to the pattern to type) |
@@ -39,6 +39,7 @@ Dropdown select with single or multiple selection, search, and clear support. Fo
39
39
  | `value` | `string \| string[]` | — | — | Selected value(s) |
40
40
  | `appearance` | `'outlined'\|'soft'\|'underlined'\|'plain'` | `'outlined'` | ✓ | How much chrome: `outlined` · `soft` tinted face · `underlined` bottom line only · `plain` no chrome |
41
41
  | `size` | `'sm'\|'md'\|'lg'` | `'md'` | ✓ | Field size, like a button's: 12px · `--u-density` (14px) · 16px. A field and a button of the same size share a height |
42
+ | `chars` | `number` | — | ✓ | Characters the field holds. An unsized field draws at N characters + its clear button and arrow + padding, so it no longer widens and narrows with the chosen option (a longer one ends in an ellipsis); a sized one (`--u-select-width`, `block`) uses it as the text floor, so a narrower box overflows. Same axis as `u-input`'s `chars` |
42
43
  | `multiple` | `boolean` | `false` | ✓ | Allow multiple selections |
43
44
  | `searchable` | `boolean` | `false` | ✓ | Filter options by text |
44
45
  | `clearable` | `boolean` | `false` | ✓ | Show clear button |