@iyulab/components 2.11.0 → 2.11.1

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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.11.1] - 2026-10-07
4
+
5
+ ### Fixed
6
+
7
+ - **A `chars` field holds N characters as they are drawn** (`u-input`, `u-select`, `u-date-picker`,
8
+ `u-date-range-picker`). The width was `N` CSS `ch`, which is one `0` without font features or letter spacing, so
9
+ with tabular figures (`font-variant-numeric: tabular-nums`, as the house theme sets) or letter spacing the last
10
+ digit was cut — six digits in Pretendard 14px overflowed by 2px. The field now draws N zeros in the text's own
11
+ computed font off-screen and uses that width; it re-measures when the font loads or the size changes.
12
+
3
13
  ## [2.11.0] - 2026-10-07
4
14
 
5
15
  ### Added
@@ -70,6 +70,8 @@ export declare class UDatePicker extends UFormControlElement<string> {
70
70
  * 폭을 준 칸에서는 하한으로만 쓴다.
71
71
  */
72
72
  chars?: number;
73
+ /** `chars` 의 폭 — 그려지는 N자를 잰다(`ch` 는 글꼴 기능·자간을 빼고 잰다). */
74
+ private readonly charsWidth;
73
75
  /** `date` (default) selects a calendar day only. `datetime` also captures a time-of-day and
74
76
  * the value becomes a complete ISO-8601 `DateTimeOffset` string. */
75
77
  mode: DatePickerMode;
@@ -9,7 +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
+ import { CharsWidthController } from "../../utilities/chars.js";
13
13
  import { DateTextController } from "../calendar/date-text-controller.js";
14
14
  import { normalizeTime, splitDateTime, toDateTimeOffset } from "../calendar/datetime.js";
15
15
  import { styles } from "../calendar/picker.styles.js";
@@ -39,6 +39,11 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
39
39
  constructor(..._args) {
40
40
  super(..._args);
41
41
  this.size = "md";
42
+ this.charsWidth = new CharsWidthController(this, {
43
+ chars: () => this.chars,
44
+ text: () => this.renderRoot.querySelector(".text-input"),
45
+ box: () => this.renderRoot.querySelector(".container")
46
+ });
42
47
  this.mode = "date";
43
48
  this.seconds = false;
44
49
  this.clearable = false;
@@ -172,7 +177,7 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
172
177
  return (this.clearable && this.value ? 1 : 0) + 1;
173
178
  }
174
179
  render() {
175
- const chars = charsWidth(this.chars);
180
+ const chars = this.charsWidth.width;
176
181
  const datetime = this.mode === "datetime";
177
182
  return html`
178
183
  <u-field part="field"
@@ -84,6 +84,8 @@ export declare class UDateRangePicker extends UFormControlElement<string> {
84
84
  * 폭을 준 칸에서는 하한으로만 쓴다.
85
85
  */
86
86
  chars?: number;
87
+ /** `chars` 의 폭 — 그려지는 N자를 잰다(`ch` 는 글꼴 기능·자간을 빼고 잰다). */
88
+ private readonly charsWidth;
87
89
  /** Earliest selectable day (ISO `YYYY-MM-DD`), inclusive. */
88
90
  min?: string;
89
91
  /** Latest selectable day (ISO `YYYY-MM-DD`), inclusive. */
@@ -10,7 +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
+ import { CharsWidthController } from "../../utilities/chars.js";
14
14
  import { DateTextController } from "../calendar/date-text-controller.js";
15
15
  import { normalizeTime, splitDateTime, toDateTimeOffset } from "../calendar/datetime.js";
16
16
  import { styles } from "../calendar/picker.styles.js";
@@ -44,6 +44,11 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
44
44
  constructor(..._args) {
45
45
  super(..._args);
46
46
  this.size = "md";
47
+ this.charsWidth = new CharsWidthController(this, {
48
+ chars: () => this.chars,
49
+ text: () => this.renderRoot.querySelector(".text-input"),
50
+ box: () => this.renderRoot.querySelector(".container")
51
+ });
47
52
  this.clearable = false;
48
53
  this.format = "iso";
49
54
  this.presets = [];
@@ -207,7 +212,7 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
207
212
  return (this.clearable && this.value ? 1 : 0) + 1;
208
213
  }
209
214
  render() {
210
- const chars = charsWidth(this.chars);
215
+ const chars = this.charsWidth.width;
211
216
  const pattern = this.mode === "datetime" ? `${dateTextPattern(this.format)} ${this.seconds ? "HH:mm:ss" : "HH:mm"}` : dateTextPattern(this.format);
212
217
  return html`
213
218
  <u-field part="field"
@@ -96,6 +96,8 @@ export declare class UInput extends UFormControlElement<string> {
96
96
  * `size` 는 이 컴포넌트에서 크기 단(sm·md·lg)이라 이름이 다르다. 폭을 준 칸(`width`·`block`)에서는 하한으로만 쓴다.
97
97
  */
98
98
  chars?: number;
99
+ /** `chars` 의 폭 — 그려지는 N자를 잰다(`ch` 는 글꼴 기능·자간을 빼고 잰다). */
100
+ private readonly charsWidth;
99
101
  placeholder?: string;
100
102
  /** 유효성 검사 패턴 (정규식) */
101
103
  pattern?: string;
@@ -121,8 +123,6 @@ export declare class UInput extends UFormControlElement<string> {
121
123
  * `string`이라 `valueAsString` 같은 변환 없이 그대로 넘긴다. */
122
124
  protected willUpdate(changedProperties: PropertyValues): void;
123
125
  protected updated(changedProperties: PropertyValues): void;
124
- /** `chars` 를 CSS 길이로 — 양의 수일 때만(그 밖은 지정 없음과 같다). */
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;
128
128
  /** Canonical `value` → the text shown: the locale's decimal separator, no grouping inserted. */
@@ -8,7 +8,7 @@ import "../icon/UIcon.js";
8
8
  import { parseNumber } from "../../utilities/format.js";
9
9
  import "../field/UField.js";
10
10
  import "../popover/UPopover.js";
11
- import { charsWidth } from "../../utilities/chars.js";
11
+ import { CharsWidthController } from "../../utilities/chars.js";
12
12
  import { UOption } from "../option/UOption.js";
13
13
  import { styles } from "./UInput.styles.js";
14
14
  import { html } from "lit";
@@ -27,6 +27,11 @@ var UInput = class UInput extends UFormControlElement {
27
27
  this.autocorrect = false;
28
28
  this.autocapitalize = "off";
29
29
  this.size = "md";
30
+ this.charsWidth = new CharsWidthController(this, {
31
+ chars: () => this.chars,
32
+ text: () => this.renderRoot.querySelector("input"),
33
+ box: () => this.renderRoot.querySelector(".container")
34
+ });
30
35
  this.showPassword = false;
31
36
  this.numberText = "";
32
37
  this.syncingFromText = false;
@@ -195,12 +200,12 @@ var UInput = class UInput extends UFormControlElement {
195
200
  .validationMessage=${this.validationMessage}
196
201
  >
197
202
  <div class="container" part="container"
198
- style=${`--_icons: ${(showStepper ? 2 : 0) + (showClear ? 1 : 0) + (showToggle ? 1 : 0)}${this.charsWidth ? `; --input-min-text: ${this.charsWidth}` : ""}`}>
203
+ style=${`--_icons: ${(showStepper ? 2 : 0) + (showClear ? 1 : 0) + (showToggle ? 1 : 0)}${this.charsWidth.width ? `; --input-min-text: ${this.charsWidth.width}` : ""}`}>
199
204
 
200
205
  <slot name="prefix"></slot>
201
206
 
202
207
  <input part="input"
203
- style=${ifDefined(this.charsWidth ? `inline-size: ${this.charsWidth}` : void 0)}
208
+ style=${ifDefined(this.charsWidth.width ? `inline-size: ${this.charsWidth.width}` : void 0)}
204
209
  type=${isNumber || this.type === "password" && this.showPassword ? "text" : this.type}
205
210
  aria-label=${ifDefined(this.resolvedAriaLabel)}
206
211
  aria-description=${ifDefined(this.resolvedAriaDescription)}
@@ -307,10 +312,6 @@ var UInput = class UInput extends UFormControlElement {
307
312
  super.updated(changedProperties);
308
313
  if (changedProperties.has("value")) this.internals?.setFormValue(this.value ?? "");
309
314
  }
310
- /** `chars` 를 CSS 길이로 — 양의 수일 때만(그 밖은 지정 없음과 같다). */
311
- get charsWidth() {
312
- return charsWidth(this.chars);
313
- }
314
315
  /** The shown number uses the locale's decimal separator — re-show it in the new locale (unless the user is typing in it). */
315
316
  localeChanged() {
316
317
  if (this.type === "number" && this.shadowRoot?.activeElement !== this.inputEl) this.numberText = this.displayNumber(this.value ?? "");
@@ -55,6 +55,8 @@ export declare class USelect extends UFormControlElement<string | string[]> {
55
55
  * `u-input` 의 `chars` 와 같은 축이다. 폭을 준 칸(`--u-select-width`·`block`)에서는 하한으로만 쓴다.
56
56
  */
57
57
  chars?: number;
58
+ /** `chars` 의 폭 — 그려지는 N자를 잰다(`ch` 는 글꼴 기능·자간을 빼고 잰다). */
59
+ private readonly charsWidth;
58
60
  /** 다중 선택 여부 */
59
61
  multiple: boolean;
60
62
  /** 검색 가능 여부 */
@@ -7,7 +7,7 @@ import "../icon/UIcon.js";
7
7
  import "../chip/UChip.js";
8
8
  import "../field/UField.js";
9
9
  import "../popover/UPopover.js";
10
- import { charsWidth } from "../../utilities/chars.js";
10
+ import { CharsWidthController } from "../../utilities/chars.js";
11
11
  import { UOption } from "../option/UOption.js";
12
12
  import { styles } from "./USelect.styles.js";
13
13
  import { html } from "lit";
@@ -19,6 +19,11 @@ var USelect = class USelect extends UFormControlElement {
19
19
  super(..._args);
20
20
  this.appearance = "outlined";
21
21
  this.size = "md";
22
+ this.charsWidth = new CharsWidthController(this, {
23
+ chars: () => this.chars,
24
+ text: () => this.renderRoot.querySelector(".text-content, .chips-content"),
25
+ box: () => this.renderRoot.querySelector(".container")
26
+ });
22
27
  this.multiple = false;
23
28
  this.searchable = false;
24
29
  this.clearable = false;
@@ -166,7 +171,7 @@ var USelect = class USelect extends UFormControlElement {
166
171
  if (changedProperties.has("open")) this.internals?.states[this.open ? "add" : "delete"]("open");
167
172
  }
168
173
  render() {
169
- const chars = charsWidth(this.chars);
174
+ const chars = this.charsWidth.width;
170
175
  return html`
171
176
  <u-field part="field"
172
177
  ?required=${this.required}
@@ -1,7 +1,36 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ /** `chars` 가 유효한 글자 수인가 — 양의 유한수일 때만(그 밖은 지정 없음과 같다). 소수는 올린다. */
3
+ export declare function charsCount(n: number | undefined | null): number | undefined;
4
+ /** 이 컨트롤러가 측정하는 컨트롤이 내주는 것. */
5
+ export interface CharsWidthOptions {
6
+ /** 칸이 담을 글자 수(`chars` 속성). */
7
+ chars(): number | undefined;
8
+ /** 글자를 그리는 요소 — 그 계산된 글꼴로 잰다. 없으면 `box` 의 글꼴로. */
9
+ text(): HTMLElement | null | undefined;
10
+ /** 측정용 요소를 붙일 자리(글자 영역을 담는 컨테이너). */
11
+ box(): HTMLElement | null | undefined;
12
+ }
1
13
  /**
2
- * `chars`(칸이 담을 글자 수)를 CSS 길이로 — 양의 유한수일 때만(그 밖은 지정 없음과 같다). 소수는 올린다.
14
+ * `chars` 의 폭 — «N자 칸» 을 **그려지는 N자** 로 잰다.
3
15
  *
4
- * 글자를 받는 폼 컨트롤(`u-input`·`u-select`·`u-date-picker`·`u-date-range-picker`)이 같은 규칙을 쓴다 —
5
- * 각자 글자 영역 하한(`--*-min-text`)과 표시 글자 요소의 폭에 이 값을 준다. 한 곳에서 정해 형제가 갈리지 않게 한다.
16
+ * CSS `ch` 는 글꼴 기능을 뺀 `0` 하나의 폭이다. 숫자를 고정폭(`font-variant-numeric: tabular-nums`)으로 그리거나
17
+ * 자간(`letter-spacing`)을 주면 N자가 `Nch` 를 넘어, «N자리 숫자 칸» 이 마지막 숫자를 잘랐다(Pretendard 14px 에서 자당
18
+ * 0.33px — 6자리면 2px). 그래서 글자 요소의 계산된 글꼴을 옮긴 보이지 않는 요소에 `0` N개를 실제로 그리고 그 폭을 쓴다.
19
+ * 크기는 `ResizeObserver` 로 따른다 — 웹 글꼴이 늦게 실리거나 크기 단(`size`)이 바뀌어 폭이 달라지면 다시 읽는다.
20
+ * 재기 전(첫 그림)에는 `Nch` 로 그린다.
6
21
  */
7
- export declare function charsWidth(n: number | undefined | null): string | undefined;
22
+ export declare class CharsWidthController implements ReactiveController {
23
+ private readonly host;
24
+ private readonly options;
25
+ private sizer?;
26
+ private observer?;
27
+ private measured?;
28
+ constructor(host: ReactiveControllerHost & HTMLElement, options: CharsWidthOptions);
29
+ /** 글자 영역의 CSS 길이 — 잰 폭(px), 재기 전에는 `Nch`, `chars` 가 없으면 `undefined`. */
30
+ get width(): string | undefined;
31
+ hostUpdated(): void;
32
+ hostDisconnected(): void;
33
+ private measure;
34
+ private read;
35
+ private release;
36
+ }
@@ -1,12 +1,91 @@
1
1
  //#region src/utilities/chars.ts
2
+ /** `chars` 가 유효한 글자 수인가 — 양의 유한수일 때만(그 밖은 지정 없음과 같다). 소수는 올린다. */
3
+ function charsCount(n) {
4
+ return n != null && Number.isFinite(n) && n > 0 ? Math.ceil(n) : void 0;
5
+ }
6
+ /** 측정용 요소에 옮기는 글꼴 속성 — 그려지는 글자 폭을 바꾸는 것 전부. */
7
+ var FONT_PROPS = [
8
+ "font-family",
9
+ "font-size",
10
+ "font-weight",
11
+ "font-style",
12
+ "font-stretch",
13
+ "font-variant-numeric",
14
+ "font-feature-settings",
15
+ "font-variation-settings",
16
+ "font-kerning",
17
+ "letter-spacing"
18
+ ];
2
19
  /**
3
- * `chars`(칸이 담을 글자 수)를 CSS 길이로 — 양의 유한수일 때만(그 밖은 지정 없음과 같다). 소수는 올린다.
20
+ * `chars` 의 폭 — «N자 칸» 을 **그려지는 N자** 로 잰다.
4
21
  *
5
- * 글자를 받는 폼 컨트롤(`u-input`·`u-select`·`u-date-picker`·`u-date-range-picker`)이 같은 규칙을 쓴다 —
6
- * 각자 글자 영역 하한(`--*-min-text`)과 표시 글자 요소의 폭에 이 값을 준다. 한 곳에서 정해 형제가 갈리지 않게 한다.
22
+ * CSS `ch` 는 글꼴 기능을 뺀 `0` 하나의 폭이다. 숫자를 고정폭(`font-variant-numeric: tabular-nums`)으로 그리거나
23
+ * 자간(`letter-spacing`)을 주면 N자가 `Nch` 를 넘어, «N자리 숫자 칸» 이 마지막 숫자를 잘랐다(Pretendard 14px 에서 자당
24
+ * 0.33px — 6자리면 2px). 그래서 글자 요소의 계산된 글꼴을 옮긴 보이지 않는 요소에 `0` N개를 실제로 그리고 그 폭을 쓴다.
25
+ * 크기는 `ResizeObserver` 로 따른다 — 웹 글꼴이 늦게 실리거나 크기 단(`size`)이 바뀌어 폭이 달라지면 다시 읽는다.
26
+ * 재기 전(첫 그림)에는 `Nch` 로 그린다.
7
27
  */
8
- function charsWidth(n) {
9
- return n != null && Number.isFinite(n) && n > 0 ? `${Math.ceil(n)}ch` : void 0;
10
- }
28
+ var CharsWidthController = class {
29
+ constructor(host, options) {
30
+ this.host = host;
31
+ this.options = options;
32
+ host.addController(this);
33
+ }
34
+ /** 글자 영역의 CSS 길이 — 잰 폭(px), 재기 전에는 `Nch`, `chars` 가 없으면 `undefined`. */
35
+ get width() {
36
+ const n = charsCount(this.options.chars());
37
+ if (!n) return void 0;
38
+ return this.measured != null ? `${this.measured}px` : `${n}ch`;
39
+ }
40
+ hostUpdated() {
41
+ this.measure();
42
+ }
43
+ hostDisconnected() {
44
+ this.release();
45
+ }
46
+ measure() {
47
+ const n = charsCount(this.options.chars());
48
+ const box = this.options.box();
49
+ if (!n || !box) {
50
+ if (this.sizer) {
51
+ this.release();
52
+ this.host.requestUpdate();
53
+ }
54
+ return;
55
+ }
56
+ if (!this.sizer || this.sizer.parentNode?.parentNode !== box) {
57
+ this.release();
58
+ const frame = document.createElement("span");
59
+ frame.setAttribute("aria-hidden", "true");
60
+ frame.style.cssText = "position:absolute;inset-block-start:0;inset-inline-start:0;inline-size:0;block-size:0;overflow:hidden;visibility:hidden;pointer-events:none";
61
+ const sizer = document.createElement("span");
62
+ sizer.style.cssText = "display:inline-block;white-space:pre";
63
+ frame.appendChild(sizer);
64
+ box.appendChild(frame);
65
+ this.sizer = sizer;
66
+ this.observer = new ResizeObserver((entries) => this.read(entries[entries.length - 1].contentRect.width));
67
+ this.observer.observe(sizer);
68
+ }
69
+ const sizer = this.sizer;
70
+ const source = getComputedStyle(this.options.text() ?? box);
71
+ for (const prop of FONT_PROPS) sizer.style.setProperty(prop, source.getPropertyValue(prop));
72
+ const digits = "0".repeat(n);
73
+ if (sizer.textContent !== digits) sizer.textContent = digits;
74
+ }
75
+ read(width) {
76
+ if (!(width > 0)) return;
77
+ const rounded = Math.ceil(width);
78
+ if (rounded === this.measured) return;
79
+ this.measured = rounded;
80
+ this.host.requestUpdate();
81
+ }
82
+ release() {
83
+ this.observer?.disconnect();
84
+ this.observer = void 0;
85
+ this.sizer?.parentElement?.remove();
86
+ this.sizer = void 0;
87
+ this.measured = void 0;
88
+ }
89
+ };
11
90
  //#endregion
12
- export { charsWidth };
91
+ export { CharsWidthController, charsCount };
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.11.0",
4
+ "version": "2.11.1",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",
@@ -82,7 +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
+ | `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`. N characters are measured as drawn — tabular figures and letter spacing count, which CSS `ch` leaves out |
86
86
  | `clearable` | `boolean` | `false` | ✓ | Show clear button |
87
87
  | `isDateDisabled` | `(date: string) => boolean` | — | — | App rule for days that cannot be chosen (ISO in, `true` = disabled). Property only; see «Disabled days» |
88
88
  | `placeholder` | `string` | — | — | Placeholder text (defaults to the pattern to type, e.g. `YYYY-MM-DD` or `YYYY-MM-DD HH:mm`) |
@@ -138,7 +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
+ | `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`. N characters are measured as drawn — tabular figures and letter spacing count, which CSS `ch` leaves out |
142
142
  | `clearable` | `boolean` | `false` | ✓ | Show clear button |
143
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» |
144
144
  | `placeholder` | `string` | — | — | Placeholder text (defaults to the pattern to type) |
@@ -57,7 +57,7 @@ the library does not infer one from field meaning.
57
57
  | `appearance` | `'outlined'\|'soft'\|'underlined'\|'plain'` | `'outlined'` | ✓ | How much chrome: `outlined` · `soft` tinted face · `underlined` bottom line only · `plain` no chrome |
58
58
  | `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 |
59
59
  | `type` | `'text'\|'password'\|'email'\|'tel'\|'url'\|'search'\|'number'\|'date'\|'time'`… | `'text'` | — | Input type |
60
- | `chars` | `number` | — | ✓ | Characters the field holds. An unsized field draws at N characters + its suffix icons + padding; a sized one (`width`, `block`) uses it as the text floor, so a narrower box overflows. Not `size` — that is the sm/md/lg scale |
60
+ | `chars` | `number` | — | ✓ | Characters the field holds. An unsized field draws at N characters + its suffix icons + padding; a sized one (`width`, `block`) uses it as the text floor, so a narrower box overflows. Not `size` — that is the sm/md/lg scale. N characters are measured as drawn — tabular figures and letter spacing count, which CSS `ch` leaves out |
61
61
  | `placeholder` | `string` | — | — | Placeholder text |
62
62
  | `clearable` | `boolean` | `false` | ✓ | Show clear button |
63
63
  | `minlength` | `number` | — | — | Minimum character count |
@@ -39,7 +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
+ | `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`. N characters are measured as drawn — tabular figures and letter spacing count, which CSS `ch` leaves out |
43
43
  | `multiple` | `boolean` | `false` | ✓ | Allow multiple selections |
44
44
  | `searchable` | `boolean` | `false` | ✓ | Filter options by text |
45
45
  | `clearable` | `boolean` | `false` | ✓ | Show clear button |