@iyulab/components 2.35.0 → 2.35.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,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.35.1] - 2026-10-25
4
+
5
+ ### Fixed
6
+
7
+ - **A drawer that fills a phone screen keeps its close button and actions off the notch.** The panel now pads the
8
+ screen edges it touches by `env(safe-area-inset-*)` — top, bottom and its own side for a side drawer — so on a page
9
+ with `viewport-fit=cover` the header and footer no longer sit under a notch or home indicator. Pages without it see
10
+ no change (the insets are 0).
11
+ - **An empty `u-date-range-picker` shows its whole placeholder.** The text box took the input's default width (about
12
+ twenty characters), shorter than the range placeholder, so its end was cut off («YYYY-MM-DD – YYYY-MM-DI»). Without
13
+ `chars` the box is now as wide as the longer of the placeholder and a filled range, measured in the rendered font;
14
+ a width set on the host still decides.
15
+ - **`u-steps` no longer cuts off steps in a narrow box.** The default `line` form kept every step on one row, so in a
16
+ narrow container (seven steps in a 22rem side panel) the steps past the edge were clipped. When the steps do not fit
17
+ the element's width it now folds to one step per row, with the connectors running down from the markers, and
18
+ returns to one row when the width allows. `bars` and `compact` are unchanged.
19
+
3
20
  ## [2.35.0] - 2026-10-24
4
21
 
5
22
  ### Added
@@ -86,6 +86,14 @@ export declare class UDateRangePicker extends UFormControlElement<string> {
86
86
  chars?: number;
87
87
  /** `chars` 의 폭 — 그려지는 N자를 잰다(`ch` 는 글꼴 기능·자간을 빼고 잰다). */
88
88
  private readonly charsWidth;
89
+ /**
90
+ * `chars` 가 없을 때의 자연 폭 — 자리표시와 범위 글(두 날짜 + 구분자) 중 긴 쪽을 그려 잰다. 입력의 기본 폭(`size` 20)은 범위
91
+ * 자리표시보다 짧아 끝이 잘렸다. 치는 동안의 글자로는 늘리지 않는다(칸이 들썩이지 않게).
92
+ */
93
+ private readonly naturalWidth;
94
+ private textPattern;
95
+ /** 자연 폭을 정하는 글 — 자리표시, 또는 같은 꼴의 범위 값(패턴 글자 자리에 숫자) 중 긴 쪽. */
96
+ private naturalSample;
89
97
  /** Earliest selectable day (ISO `YYYY-MM-DD`), inclusive. */
90
98
  min?: string;
91
99
  /** 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 { CharsWidthController } from "../../utilities/chars.js";
13
+ import { CharsWidthController, charsCount } from "../../utilities/chars.js";
14
14
  import { normalizeTime, sameDateTime, splitDateTime, toDateTimeOffset, toLocalDateTime } from "../calendar/datetime.js";
15
15
  import { DateTextController } from "../calendar/date-text-controller.js";
16
16
  import { styles } from "../calendar/picker.styles.js";
@@ -53,6 +53,12 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
53
53
  text: () => this.renderRoot.querySelector(".text-input"),
54
54
  box: () => this.renderRoot.querySelector(".container")
55
55
  });
56
+ this.naturalWidth = new CharsWidthController(this, {
57
+ chars: () => charsCount(this.chars) ? void 0 : this.naturalSample().length,
58
+ sample: () => this.naturalSample(),
59
+ text: () => this.renderRoot.querySelector(".text-input"),
60
+ box: () => this.renderRoot.querySelector(".container")
61
+ });
56
62
  this.clearable = false;
57
63
  this.format = "iso";
58
64
  this.presets = [];
@@ -140,6 +146,16 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
140
146
  styles$1
141
147
  ];
142
148
  }
149
+ textPattern() {
150
+ return this.mode === "datetime" ? `${dateTextPattern(this.format)} ${this.seconds ? "HH:mm:ss" : "HH:mm"}` : dateTextPattern(this.format);
151
+ }
152
+ /** 자연 폭을 정하는 글 — 자리표시, 또는 같은 꼴의 범위 값(패턴 글자 자리에 숫자) 중 긴 쪽. */
153
+ naturalSample() {
154
+ const pattern = this.textPattern();
155
+ const placeholder = this.placeholder ?? `${pattern} – ${pattern}`;
156
+ const valueShape = `${pattern} – ${pattern}`.replace(/[A-Za-z]/g, "0");
157
+ return placeholder.length >= valueShape.length ? placeholder : valueShape;
158
+ }
143
159
  /** Start of the range — the ISO day, or in `mode="datetime"` the ISO date-time; `undefined` when
144
160
  * there is no complete range. */
145
161
  get start() {
@@ -217,7 +233,9 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
217
233
  }
218
234
  render() {
219
235
  const chars = this.charsWidth.width;
220
- const pattern = this.mode === "datetime" ? `${dateTextPattern(this.format)} ${this.seconds ? "HH:mm:ss" : "HH:mm"}` : dateTextPattern(this.format);
236
+ const pattern = this.textPattern();
237
+ const placeholder = this.placeholder ?? `${pattern} – ${pattern}`;
238
+ const width = chars ?? this.naturalWidth.width;
221
239
  return html`
222
240
  <u-field part="field"
223
241
  ?required=${this.required}
@@ -231,7 +249,7 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
231
249
  <div class="container" part="container" @click=${this.textEntry.handleContainerClick}
232
250
  style=${`--_icons: ${this.suffixButtonCount()}${chars ? `; --date-range-picker-min-text: ${chars}` : ""}`}>
233
251
  <input class="text-input" part="input"
234
- style=${ifDefined(chars ? `inline-size: ${chars}` : void 0)}
252
+ style=${ifDefined(width ? `inline-size: ${width}` : void 0)}
235
253
  type="text"
236
254
  autocomplete="off"
237
255
  role="combobox"
@@ -241,7 +259,7 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
241
259
  aria-label=${ifDefined(this.resolvedAriaLabel)}
242
260
  aria-description=${ifDefined(this.resolvedAriaDescription)}
243
261
  aria-invalid=${this.textEntry.badText ? "true" : "false"}
244
- placeholder=${this.placeholder ?? `${pattern} – ${pattern}`}
262
+ placeholder=${placeholder}
245
263
  .value=${this.textEntry.text}
246
264
  ?disabled=${this.effectivelyDisabled}
247
265
  ?readonly=${this.readonly}
@@ -32,6 +32,22 @@ var styles = css`
32
32
 
33
33
 
34
34
 
35
+ :host([placement="left"]) .panel,
36
+ :host([placement="right"]) .panel {
37
+ padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px);
38
+ }
39
+ :host([placement="left"]) .panel { padding-left: env(safe-area-inset-left, 0px); }
40
+ :host([placement="right"]) .panel { padding-right: env(safe-area-inset-right, 0px); }
41
+ :host([placement="top"]) .panel,
42
+ :host([placement="bottom"]) .panel {
43
+ padding-left: env(safe-area-inset-left, 0px);
44
+ padding-right: env(safe-area-inset-right, 0px);
45
+ }
46
+ :host([placement="top"]) .panel { padding-top: env(safe-area-inset-top, 0px); }
47
+ :host([placement="bottom"]) .panel { padding-bottom: env(safe-area-inset-bottom, 0px); }
48
+
49
+
50
+
35
51
 
36
52
 
37
53
 
@@ -1,3 +1,4 @@
1
+ import { PropertyValues } from 'lit';
1
2
  import { UElement } from '../UElement.js';
2
3
  /**
3
4
  * 단계의 상태.
@@ -33,6 +34,8 @@ export interface StepItem {
33
34
  * `appearance="compact"` 면 단계마다 작은 칸만 그리고(지나온 칸은 채우고 지금 칸은 주 색, 보류는 경고 칸) 그 옆에 지금
34
35
  * 단계의 이름 하나를 쓴다 — 나머지 단계 이름은 화면에서 숨지만 목록에는 남아 보조기기가 전부 읽는다. 지금 단계가 없으면
35
36
  * 마지막으로 지나온 단계의 이름을 쓴다.
37
+ * 기본(`line`)은 단계가 자기 폭에 다 들어가지 않으면 세로로 접힌다 — 단계마다 한 줄, 연결선은 표식 아래로. 폭이 다시 넉넉해지면
38
+ * 가로로 돌아온다(단계 수를 CSS 가 알 수 없어 가로 배치의 실제 폭을 재서 가른다).
36
39
  * 보조기기에는 지금 단계를 `aria-current="step"` 으로, 완료·보류를 숨은 글자로 전한다.
37
40
  *
38
41
  * @csspart base - 바깥 상자
@@ -64,6 +67,17 @@ export declare class USteps extends UElement {
64
67
  label?: string;
65
68
  /** 모양 — `line`(기본) · `bars` · `compact` */
66
69
  appearance: StepsAppearance;
70
+ /** `line` 이 자기 폭에 들어가지 않아 세로로 접혔는가 — 배치만 바꾸므로 다시 그리지 않고 목록의 클래스로 건다. */
71
+ private folded;
72
+ /** 가로로 놓였을 때 목록이 필요로 하는 폭 — 접힌 뒤 펼칠지를 이것과 지금 폭으로 가른다. */
73
+ private naturalWidth;
74
+ private resizeObserver?;
75
+ connectedCallback(): void;
76
+ disconnectedCallback(): void;
77
+ protected willUpdate(changed: PropertyValues<this>): void;
78
+ protected updated(): void;
79
+ private measureFold;
80
+ private setFolded;
67
81
  /** 단계의 실효 상태. */
68
82
  statusOf(index: number): StepStatus;
69
83
  /** `compact` 가 칸 옆에 쓰는 이름 — 지금(또는 보류) 단계, 없으면 마지막으로 지나온 단계. */
@@ -12,10 +12,45 @@ var USteps = class USteps extends UElement {
12
12
  super(..._args);
13
13
  this.items = [];
14
14
  this.appearance = "line";
15
+ this.folded = false;
16
+ this.naturalWidth = 0;
15
17
  }
16
18
  static {
17
19
  this.styles = [super.styles, styles];
18
20
  }
21
+ connectedCallback() {
22
+ super.connectedCallback();
23
+ if (typeof ResizeObserver !== "undefined") {
24
+ this.resizeObserver ??= new ResizeObserver(() => this.measureFold());
25
+ this.resizeObserver.observe(this);
26
+ }
27
+ }
28
+ disconnectedCallback() {
29
+ super.disconnectedCallback();
30
+ this.resizeObserver?.disconnect();
31
+ }
32
+ willUpdate(changed) {
33
+ if (changed.has("items") || changed.has("appearance") || changed.has("label")) this.setFolded(false);
34
+ }
35
+ updated() {
36
+ this.measureFold();
37
+ }
38
+ measureFold() {
39
+ const list = this.renderRoot.querySelector(".list");
40
+ if (!list) return;
41
+ if (this.appearance !== "line") return this.setFolded(false);
42
+ if (!this.folded) {
43
+ if (list.scrollWidth > list.clientWidth + 1) {
44
+ this.naturalWidth = list.scrollWidth;
45
+ this.setFolded(true);
46
+ }
47
+ } else if (list.clientWidth >= this.naturalWidth) this.setFolded(false);
48
+ }
49
+ setFolded(folded) {
50
+ this.folded = folded;
51
+ if (!folded) this.naturalWidth = 0;
52
+ this.renderRoot?.querySelector(".list")?.classList.toggle("folded", folded);
53
+ }
19
54
  /** 단계의 실효 상태. */
20
55
  statusOf(index) {
21
56
  const own = this.items[index]?.status;
@@ -98,6 +98,22 @@ var styles = css`
98
98
  }
99
99
 
100
100
 
101
+ .list.folded {
102
+ flex-direction: column;
103
+ align-items: flex-start;
104
+ }
105
+ .list.folded .step {
106
+ white-space: normal;
107
+ }
108
+ .list.folded .connector {
109
+ flex: none;
110
+ min-width: 0;
111
+ width: 1.5px;
112
+ height: var(--u-space-sm, 8px);
113
+ margin: 2px 0 2px calc(var(--steps-marker-size, 18px) / 2 - 0.75px);
114
+ }
115
+
116
+
101
117
  .step[data-status="skipped"] {
102
118
  color: var(--u-txt-color-weaker, #757575);
103
119
  }
@@ -9,6 +9,8 @@ export interface CharsWidthOptions {
9
9
  text(): HTMLElement | null | undefined;
10
10
  /** 측정용 요소를 붙일 자리(글자 영역을 담는 컨테이너). */
11
11
  box(): HTMLElement | null | undefined;
12
+ /** 잴 글 — 주면 `0` N개 대신 이 글을 그려 잰다(자리표시처럼 글자가 정해진 칸). `chars()` 가 없으면 재지 않는다. */
13
+ sample?(): string | undefined;
12
14
  }
13
15
  /**
14
16
  * `chars` 의 폭 — «N자 칸» 을 **그려지는 N자** 로 잰다.
@@ -85,7 +85,7 @@ var CharsWidthController = class {
85
85
  const sizer = this.sizer;
86
86
  const source = getComputedStyle(this.options.text() ?? box);
87
87
  for (const prop of FONT_PROPS) sizer.style.setProperty(prop, source.getPropertyValue(prop));
88
- const digits = "0".repeat(n);
88
+ const digits = this.options.sample?.() || "0".repeat(n);
89
89
  if (sizer.textContent !== digits) sizer.textContent = digits;
90
90
  if (this.watch && this.watch.textContent !== digits) this.watch.textContent = digits;
91
91
  }
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.35.0",
4
+ "version": "2.35.1",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",
@@ -31,6 +31,10 @@ hold = warning tint, upcoming = empty ring, skipped = dashed ring. Assistive tec
31
31
  `stepOnHold`, `stepSkipped` locale keys). `skipped` is a step this record's route does not have — an order with no
32
32
  proof still shows «Proof», passed over.
33
33
 
34
+ When the steps do not fit the element's width, `line` folds to one step per row (connectors run down from the
35
+ markers) and goes back to one row when the width returns — nothing past the edge is cut off. In a fixed narrow place
36
+ (a table cell, a card header) `compact` is still the better shape.
37
+
34
38
  ### Bars — `appearance="bars"`
35
39
 
36
40
  Each step takes an equal column: a bar on top, the step's name and its description (a date) under it. The travelled