@iyulab/components 2.32.0 → 2.34.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/assets/locales/ar.json.js +3 -1
  3. package/dist/assets/locales/de.json.js +3 -1
  4. package/dist/assets/locales/en.json.js +3 -1
  5. package/dist/assets/locales/es.json.js +3 -1
  6. package/dist/assets/locales/fr.json.js +3 -1
  7. package/dist/assets/locales/id.json.js +3 -1
  8. package/dist/assets/locales/ja.json.js +3 -1
  9. package/dist/assets/locales/ko.json.js +3 -1
  10. package/dist/assets/locales/pt-BR.json.js +3 -1
  11. package/dist/assets/locales/ru.json.js +3 -1
  12. package/dist/assets/locales/th.json.js +3 -1
  13. package/dist/assets/locales/vi.json.js +3 -1
  14. package/dist/assets/locales/zh-CN.json.js +3 -1
  15. package/dist/assets/locales/zh-TW.json.js +3 -1
  16. package/dist/components/auto-scroll/UAutoScroll.d.ts +14 -0
  17. package/dist/components/auto-scroll/UAutoScroll.js +25 -2
  18. package/dist/components/badge/UBadge.d.ts +2 -0
  19. package/dist/components/badge/UBadge.js +4 -2
  20. package/dist/components/badge/UBadge.styles.js +11 -2
  21. package/dist/components/breadcrumb-item/UBreadcrumbItem.d.ts +2 -0
  22. package/dist/components/breadcrumb-item/UBreadcrumbItem.js +6 -4
  23. package/dist/components/breadcrumb-item/UBreadcrumbItem.styles.js +11 -2
  24. package/dist/components/button/UButton.d.ts +2 -0
  25. package/dist/components/button/UButton.js +4 -2
  26. package/dist/components/button/UButton.styles.js +11 -2
  27. package/dist/components/card/UCard.d.ts +9 -0
  28. package/dist/components/card/UCard.js +4 -0
  29. package/dist/components/card/UCard.styles.js +29 -0
  30. package/dist/components/carousel/UCarousel.d.ts +23 -1
  31. package/dist/components/carousel/UCarousel.js +64 -5
  32. package/dist/components/dialog/UDialog.d.ts +3 -0
  33. package/dist/components/dialog/UDialog.js +8 -1
  34. package/dist/components/dialog/UDialog.styles.js +10 -3
  35. package/dist/components/drawer/UDrawer.d.ts +3 -0
  36. package/dist/components/drawer/UDrawer.js +8 -1
  37. package/dist/components/drawer/UDrawer.styles.js +10 -3
  38. package/dist/components/input/UInput.d.ts +2 -0
  39. package/dist/components/input/UInput.js +4 -2
  40. package/dist/components/input/UInput.styles.js +11 -2
  41. package/dist/components/menu-item/UMenuItem.d.ts +2 -0
  42. package/dist/components/menu-item/UMenuItem.js +4 -2
  43. package/dist/components/menu-item/UMenuItem.styles.js +11 -2
  44. package/dist/components/option/UOption.d.ts +2 -0
  45. package/dist/components/option/UOption.js +4 -2
  46. package/dist/components/option/UOption.styles.js +16 -2
  47. package/dist/components/radio/URadio.styles.js +5 -2
  48. package/dist/components/select/USelect.d.ts +21 -2
  49. package/dist/components/select/USelect.js +144 -41
  50. package/dist/components/select/USelect.styles.js +60 -22
  51. package/dist/components/steps/USteps.d.ts +11 -2
  52. package/dist/components/steps/USteps.js +16 -4
  53. package/dist/components/steps/USteps.styles.js +57 -0
  54. package/dist/components/tab/UTab.d.ts +2 -0
  55. package/dist/components/tab/UTab.js +4 -2
  56. package/dist/components/tab/UTab.styles.js +16 -2
  57. package/dist/components/tab-panel/UTabPanel.styles.js +14 -14
  58. package/dist/components/tree-item/UTreeItem.d.ts +2 -0
  59. package/dist/components/tree-item/UTreeItem.js +4 -2
  60. package/dist/components/tree-item/UTreeItem.styles.js +11 -2
  61. package/dist/utilities/Locale.d.ts +1 -1
  62. package/dist/utilities/slotPresence.d.ts +21 -0
  63. package/dist/utilities/slotPresence.js +41 -0
  64. package/dist/utilities/unattended.d.ts +5 -0
  65. package/dist/utilities/unattended.js +7 -0
  66. package/package.json +1 -1
  67. package/skills/iyulab-components/references/components/auto-scroll.md +5 -0
  68. package/skills/iyulab-components/references/components/card.md +12 -0
  69. package/skills/iyulab-components/references/components/carousel.md +19 -1
  70. package/skills/iyulab-components/references/components/dialog.md +1 -0
  71. package/skills/iyulab-components/references/components/drawer.md +1 -0
  72. package/skills/iyulab-components/references/components/select.md +16 -11
  73. package/skills/iyulab-components/references/components/steps.md +24 -4
@@ -34,10 +34,19 @@ var styles = css`
34
34
  cursor: inherit;
35
35
  }
36
36
 
37
- ::slotted([slot="prefix"]) {
37
+
38
+ .affix {
39
+ display: inline-flex;
40
+ align-items: center;
41
+ flex: none;
42
+ }
43
+ .affix[hidden] {
44
+ display: none;
45
+ }
46
+ .affix-prefix {
38
47
  margin-right: 0.2em;
39
48
  }
40
- ::slotted([slot="suffix"]) {
49
+ .affix-suffix {
41
50
  margin-left: 0.2em;
42
51
  }
43
52
  `;
@@ -60,6 +60,8 @@ export type ButtonSize = "sm" | "md" | "lg";
60
60
  */
61
61
  export declare class UButton extends UElement {
62
62
  static styles: import('lit').CSSResultGroup[];
63
+ /** 접두 · 접미 슬롯이 찼는가 — 그 옆 간격은 섀도 안 상자가 갖는다(`::slotted` 여백은 문서의 전역 리셋에 진다). */
64
+ private readonly affixes;
63
65
  static formAssociated: boolean;
64
66
  /**
65
67
  * 호스트의 `.focus()` 를 섀도 안의 네이티브 `<button>`/`<a>` 로 위임한다. 호스트는 포커스
@@ -4,6 +4,7 @@ import __decorate from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm
4
4
  import "../spinner/USpinner.js";
5
5
  import { styles } from "./UButton.styles.js";
6
6
  import { FORWARDED_ARIA, readForwardedAria } from "./forwarded-aria.js";
7
+ import { SlotPresence } from "../../utilities/slotPresence.js";
7
8
  import { html } from "lit";
8
9
  import { customElement, property } from "lit/decorators.js";
9
10
  import { ifDefined } from "lit/directives/if-defined.js";
@@ -11,6 +12,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
11
12
  var UButton = class UButton extends UElement {
12
13
  constructor(..._args) {
13
14
  super(..._args);
15
+ this.affixes = new SlotPresence(this, ["prefix", "suffix"]);
14
16
  this.appearance = "solid";
15
17
  this.size = "md";
16
18
  this.rounded = false;
@@ -153,11 +155,11 @@ var UButton = class UButton extends UElement {
153
155
  }
154
156
  renderContent() {
155
157
  return html`
156
- <slot name="prefix"></slot>
158
+ <span class="affix affix-prefix" ?hidden=${!this.affixes.has("prefix")}><slot name="prefix"></slot></span>
157
159
  <div class="content" part="content">
158
160
  <slot></slot>
159
161
  </div>
160
- <slot name="suffix"></slot>
162
+ <span class="affix affix-suffix" ?hidden=${!this.affixes.has("suffix")}><slot name="suffix"></slot></span>
161
163
  `;
162
164
  }
163
165
  renderMask() {
@@ -362,10 +362,19 @@ var styles = css`
362
362
  color: inherit;
363
363
  font-size: inherit;
364
364
  }
365
- ::slotted([slot="prefix"]) {
365
+
366
+ .affix {
367
+ display: inline-flex;
368
+ align-items: center;
369
+ flex: none;
370
+ }
371
+ .affix[hidden] {
372
+ display: none;
373
+ }
374
+ .affix-prefix {
366
375
  margin-right: 0.5em;
367
376
  }
368
- ::slotted([slot="suffix"]) {
377
+ .affix-suffix {
369
378
  margin-left: 0.5em;
370
379
  }
371
380
 
@@ -2,9 +2,16 @@ import { TemplateResult } from 'lit';
2
2
  import { UElement } from '../UElement.js';
3
3
  export type CardOrientation = 'vertical' | 'horizontal';
4
4
  export type CardAppearance = 'outlined' | 'plain';
5
+ /** 카드의 강조 톤. */
6
+ export type CardTone = 'primary' | 'info' | 'success' | 'warning' | 'danger';
5
7
  /**
6
8
  * 콘텐츠를 카드 형태로 표시하는 컴포넌트입니다.
7
9
  *
10
+ * `tone` 은 카드가 이웃보다 먼저 읽혀야 할 때다 — `warning`·`danger`·`success`·`info` 는 그 상태의 옅은 면과 테두리
11
+ * («확인할 것», «막힌 것»), `primary` 는 면은 그대로 두고 주 색 테두리(«다음 할 일» — 화면의 한 곳). 색만으로 전하지
12
+ * 않도록 카드의 제목이 그 뜻을 말해야 한다. 톤은 안쪽 상자에 칠하므로 바깥에서 건 `--card-border-color`(하우스 시트 등)가
13
+ * 덮지 않는다.
14
+ *
8
15
  * @slot - 카드의 본문 콘텐츠
9
16
  * @slot header - 카드 상단 헤더 영역
10
17
  * @slot footer - 카드 하단 푸터 영역
@@ -29,6 +36,8 @@ export declare class UCard extends UElement {
29
36
  appearance: CardAppearance;
30
37
  /** 마우스 오버 효과 적용 여부 */
31
38
  hoverable: boolean;
39
+ /** 강조 — 상태의 면과 테두리(`warning`·`danger`·`success`·`info`) 또는 주 색 테두리(`primary`). 없으면 보통 카드 */
40
+ tone?: CardTone;
32
41
  /**
33
42
  * 카드 전체가 이동하는 링크 URL. 주면 바깥 상자가 `<a>` 로 그려진다 — 테두리가 hover 를 싣고 들어 올리지 않는다.
34
43
  * 링크 안에는 다른 대화형 요소(버튼·링크)를 두지 않는다(HTML 의 `<a>` 내용 모델).
@@ -73,6 +73,10 @@ __decorate([property({
73
73
  type: Boolean,
74
74
  reflect: true
75
75
  }), __decorateMetadata("design:type", Object)], UCard.prototype, "hoverable", void 0);
76
+ __decorate([property({
77
+ type: String,
78
+ reflect: true
79
+ }), __decorateMetadata("design:type", Object)], UCard.prototype, "tone", void 0);
76
80
  __decorate([property({
77
81
  type: String,
78
82
  reflect: true
@@ -37,6 +37,35 @@ var styles = css`
37
37
  --card-border-width: 0;
38
38
  box-shadow: none;
39
39
  }
40
+
41
+ :host([tone]) .base {
42
+ border-width: max(var(--card-border-width), 1px);
43
+ }
44
+ :host([tone="primary"]) .base {
45
+ border-color: var(--u-primary-color, #1976D2);
46
+ box-shadow: inset 0 0 0 1px var(--u-primary-color, #1976D2);
47
+ }
48
+ :host([tone="info"]) .base {
49
+ border-color: var(--u-info-color-weak, #2196F3);
50
+ background-color: var(--u-info-bg-color, #E3F2FD);
51
+ }
52
+ :host([tone="success"]) .base {
53
+ border-color: var(--u-success-color-weak, #4CAF50);
54
+ background-color: var(--u-success-bg-color, #E8F5E9);
55
+ }
56
+ :host([tone="warning"]) .base {
57
+ border-color: var(--u-warning-color-weak, #FFEB3B);
58
+ background-color: var(--u-warning-bg-color, #FFF59D);
59
+ }
60
+ :host([tone="danger"]) .base {
61
+ border-color: var(--u-danger-color-weak, #F44336);
62
+ background-color: var(--u-danger-bg-color, #FFEBEE);
63
+ }
64
+ @media (forced-colors: active) {
65
+ :host([tone]) .base {
66
+ border-color: CanvasText;
67
+ }
68
+ }
40
69
  :host([shadowless]) {
41
70
  box-shadow: none;
42
71
  }
@@ -10,6 +10,10 @@ import { UElement } from '../UElement.js';
10
10
  * (WAI-ARIA APG Carousel · WCAG 2.2.2). 사용자가 동작 줄이기(`prefers-reduced-motion: reduce`)를
11
11
  * 켜 두었으면 정지 상태로 시작하고(시작 버튼으로 켤 수 있다), 보는 중에 그 설정이 켜지면 멈춘다.
12
12
  *
13
+ * `unattended` 는 아무도 앞에서 조작하지 않는 화면(벽걸이 보드 · 로비 · 키오스크)이다 — 전체 화면이면 마우스 커서가 늘 그 위에
14
+ * 있으므로 포인터로는 멈추지 않고, 키보드 초점으로 멈춘 회전은 `resume-delay`(기본 30초) 동안 손대지 않으면 다시 돈다. 정지 버튼으로 멈춘 것은
15
+ * 그대로 멈춰 있다(멈출 수단은 남는다 — 2.2.2).
16
+ *
13
17
  * 보조기기에는 WAI-ARIA APG Carousel 구조로 나간다 — 호스트는 «캐러셀» 역할 설명을 단 영역(`region`), 각 슬라이드는
14
18
  * «슬라이드» 역할 설명과 «n / 전체» 이름을 단 그룹이다. 캐러셀의 이름은 호스트의 `aria-label` 로 준다(영역은 이름이
15
19
  * 있어야 랜드마크다). 슬라이드에 소비자가 이미 단 `role`·`aria-roledescription`·`aria-label` 은 덮지 않는다.
@@ -44,6 +48,13 @@ export declare class UCarousel extends UElement {
44
48
  paginationStyle: 'dots' | 'labels';
45
49
  /** 드래그로 슬라이드 이동 */
46
50
  draggable: boolean;
51
+ /**
52
+ * 아무도 조작하지 않는 화면 — 포인터가 위에 있어도 멈추지 않고, 키보드 초점으로 멈춘 회전은 `resume-delay`(기본 30초) 동안 손대지
53
+ * 않으면 다시 돈다. 정지 버튼으로 멈춘 것은 그대로다. `u-auto-scroll` 의 같은 속성과 짝이다.
54
+ */
55
+ unattended: boolean;
56
+ /** `unattended` 에서 키보드 초점으로 멈춘 회전이 다시 돌기까지 손대지 않은 시간 (ms). */
57
+ resumeDelay: number;
47
58
  /** 한 화면에 표시할 슬라이드 수 */
48
59
  slidesPerView: number;
49
60
  /** 한 번에 이동할 슬라이드 수 */
@@ -57,8 +68,11 @@ export declare class UCarousel extends UElement {
57
68
  private dragOffset;
58
69
  /** 사용자가 회전을 멈췄다(정지 버튼, 또는 키보드 초점 진입). 다시 시작할 때까지 유지된다. */
59
70
  private rotationStopped;
60
- /** 포인터가 캐러셀 위에 있다 — 그동안만 잠시 멈춘다. */
71
+ /** 포인터가 캐러셀 위에 있다 — 그동안만 잠시 멈춘다(`unattended` 가 아닐 때). */
61
72
  private hovered;
73
+ /** 왜 멈췄는가 — `unattended` 에서 초점으로 멈춘 것만 손대지 않으면 다시 돈다. */
74
+ private stopReason?;
75
+ private idleTimer?;
62
76
  private autoplayTimer?;
63
77
  /** 호스트 역할(region · «캐러셀» 역할 설명)을 속성으로 — 소비자의 `role`·`aria-roledescription` 이 있으면 그것이 이긴다. */
64
78
  private readonly aria;
@@ -104,6 +118,14 @@ export declare class UCarousel extends UElement {
104
118
  private handlePointerMove;
105
119
  private handlePointerUp;
106
120
  private toggleRotation;
121
+ /** 자동 넘김을 다시 시작한다 — 정지 버튼 · 초점 · 동작 줄이기로 멈춘 것 모두(`autoplay` 일 때만 돈다). */
122
+ startRotation(): void;
123
+ /** 자동 넘김을 멈춘다 — 정지 버튼과 같다(`unattended` 에서도 저절로 다시 돌지 않는다). */
124
+ stopRotation(): void;
125
+ /** `unattended` 에서 초점으로 멈췄으면, 손대지 않고 `resumeDelay` 가 지나면 다시 돈다 — 키 · 포인터를 누를 때마다 다시 잰다. */
126
+ private scheduleIdleResume;
127
+ private clearIdle;
128
+ private handleActivity;
107
129
  /** 키보드 초점이 들어오면 멈춘다 — 포인터로 누른 초점은 멈추지 않는다(누른 버튼이 정지 버튼이면 그 클릭이 결정한다). */
108
130
  private handleFocusIn;
109
131
  /** 보는 중에 동작 줄이기가 켜지면 멈춘다. 꺼질 때는 다시 시작하지 않는다 — 멈춘 것을 움직이게
@@ -5,6 +5,7 @@ import __decorate from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm
5
5
  import { HostAria } from "../../utilities/hostAria.js";
6
6
  import "../button/UButton.js";
7
7
  import "../icon/UIcon.js";
8
+ import { UNATTENDED_IDLE_MS } from "../../utilities/unattended.js";
8
9
  import { styles } from "./UCarousel.styles.js";
9
10
  import { html, nothing } from "lit";
10
11
  import { customElement, property, state } from "lit/decorators.js";
@@ -21,6 +22,8 @@ var UCarousel = class UCarousel extends UElement {
21
22
  this.pagination = false;
22
23
  this.paginationStyle = "dots";
23
24
  this.draggable = false;
25
+ this.unattended = false;
26
+ this.resumeDelay = UNATTENDED_IDLE_MS;
24
27
  this.slidesPerView = 1;
25
28
  this.slidesPerMove = 1;
26
29
  this.gap = 0;
@@ -91,15 +94,27 @@ var UCarousel = class UCarousel extends UElement {
91
94
  if (this.rotating) this.startAutoplay();
92
95
  };
93
96
  this.toggleRotation = () => {
94
- this.rotationStopped = !this.rotationStopped;
97
+ if (this.rotationStopped) this.startRotation();
98
+ else this.stopRotation();
99
+ };
100
+ this.handleActivity = () => {
101
+ if (this.idleTimer !== void 0) this.scheduleIdleResume();
95
102
  };
96
103
  this.handleFocusIn = (e) => {
97
104
  if (!this.autoplay) return;
98
105
  const origin = e.composedPath()[0];
99
- if (origin instanceof Element && origin.matches(":focus-visible")) this.rotationStopped = true;
106
+ if (origin instanceof Element && origin.matches(":focus-visible") && this.stopReason !== "user") {
107
+ this.rotationStopped = true;
108
+ this.stopReason = "focus";
109
+ this.scheduleIdleResume();
110
+ }
100
111
  };
101
112
  this.handleReducedMotionChange = (e) => {
102
- if (e.matches && this.autoplay) this.rotationStopped = true;
113
+ if (e.matches && this.autoplay) {
114
+ this.clearIdle();
115
+ this.rotationStopped = true;
116
+ this.stopReason = "motion";
117
+ }
103
118
  };
104
119
  this.handlePointerEnter = (e) => {
105
120
  if (e.pointerType === "mouse") this.hovered = true;
@@ -117,7 +132,7 @@ var UCarousel = class UCarousel extends UElement {
117
132
  }
118
133
  /** 지금 자동으로 넘기고 있는가. */
119
134
  get rotating() {
120
- return this.autoplay && !this.rotationStopped && !this.hovered;
135
+ return this.autoplay && !this.rotationStopped && (this.unattended || !this.hovered);
121
136
  }
122
137
  get showDots() {
123
138
  return this.pagination && this.pageCount > 1;
@@ -144,6 +159,8 @@ var UCarousel = class UCarousel extends UElement {
144
159
  this.addEventListener("focusin", this.handleFocusIn);
145
160
  this.addEventListener("pointerenter", this.handlePointerEnter);
146
161
  this.addEventListener("pointerleave", this.handlePointerLeave);
162
+ this.addEventListener("keydown", this.handleActivity);
163
+ this.addEventListener("pointerdown", this.handleActivity);
147
164
  this.reducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)");
148
165
  this.reducedMotion?.addEventListener("change", this.handleReducedMotionChange);
149
166
  if (this.rotating) this.startAutoplay();
@@ -155,11 +172,17 @@ var UCarousel = class UCarousel extends UElement {
155
172
  this.removeEventListener("focusin", this.handleFocusIn);
156
173
  this.removeEventListener("pointerenter", this.handlePointerEnter);
157
174
  this.removeEventListener("pointerleave", this.handlePointerLeave);
175
+ this.removeEventListener("keydown", this.handleActivity);
176
+ this.removeEventListener("pointerdown", this.handleActivity);
177
+ this.clearIdle();
158
178
  super.disconnectedCallback();
159
179
  }
160
180
  willUpdate(changedProperties) {
161
181
  super.willUpdate(changedProperties);
162
- if (changedProperties.has("autoplay") && this.autoplay) this.rotationStopped = !!this.reducedMotion?.matches;
182
+ if (changedProperties.has("autoplay") && this.autoplay) {
183
+ this.rotationStopped = !!this.reducedMotion?.matches;
184
+ this.stopReason = this.rotationStopped ? "motion" : void 0;
185
+ }
163
186
  if (changedProperties.has("slidesPerView")) this.style.setProperty("--slides-per-view", String(this.perView));
164
187
  if (changedProperties.has("gap")) this.style.setProperty("--slide-gap", `${this.gap}px`);
165
188
  }
@@ -298,6 +321,34 @@ var UCarousel = class UCarousel extends UElement {
298
321
  for (const name of this.ownedSlideAttrs.get(slide) ?? []) slide.removeAttribute(name);
299
322
  this.ownedSlideAttrs.delete(slide);
300
323
  }
324
+ /** 자동 넘김을 다시 시작한다 — 정지 버튼 · 초점 · 동작 줄이기로 멈춘 것 모두(`autoplay` 일 때만 돈다). */
325
+ startRotation() {
326
+ this.clearIdle();
327
+ this.stopReason = void 0;
328
+ this.rotationStopped = false;
329
+ }
330
+ /** 자동 넘김을 멈춘다 — 정지 버튼과 같다(`unattended` 에서도 저절로 다시 돌지 않는다). */
331
+ stopRotation() {
332
+ this.clearIdle();
333
+ this.stopReason = "user";
334
+ this.rotationStopped = true;
335
+ }
336
+ /** `unattended` 에서 초점으로 멈췄으면, 손대지 않고 `resumeDelay` 가 지나면 다시 돈다 — 키 · 포인터를 누를 때마다 다시 잰다. */
337
+ scheduleIdleResume() {
338
+ this.clearIdle();
339
+ if (!this.unattended || this.stopReason !== "focus") return;
340
+ this.idleTimer = window.setTimeout(() => {
341
+ this.idleTimer = void 0;
342
+ if (this.unattended && this.stopReason === "focus") {
343
+ this.stopReason = void 0;
344
+ this.rotationStopped = false;
345
+ }
346
+ }, this.resumeDelay);
347
+ }
348
+ clearIdle() {
349
+ if (this.idleTimer !== void 0) window.clearTimeout(this.idleTimer);
350
+ this.idleTimer = void 0;
351
+ }
301
352
  };
302
353
  __decorate([property({
303
354
  type: Boolean,
@@ -328,6 +379,14 @@ __decorate([property({
328
379
  type: Boolean,
329
380
  reflect: true
330
381
  }), __decorateMetadata("design:type", Object)], UCarousel.prototype, "draggable", void 0);
382
+ __decorate([property({
383
+ type: Boolean,
384
+ reflect: true
385
+ }), __decorateMetadata("design:type", Object)], UCarousel.prototype, "unattended", void 0);
386
+ __decorate([property({
387
+ type: Number,
388
+ attribute: "resume-delay"
389
+ }), __decorateMetadata("design:type", Object)], UCarousel.prototype, "resumeDelay", void 0);
331
390
  __decorate([property({
332
391
  type: Number,
333
392
  attribute: "slides-per-view"
@@ -12,6 +12,7 @@ export type DialogPlacement = 'top-start' | 'top' | 'top-end' | 'start' | 'cente
12
12
  * @csspart panel - 다이얼로그의 패널 요소
13
13
  * @csspart header - 다이얼로그의 헤더 요소
14
14
  * @csspart body - 다이얼로그의 본문 요소
15
+ * @csspart footer - 푸터 영역(여백 · 구분선) — 꽂힌 것이 없으면 그리지 않는다
15
16
  * @csspart close-btn - 닫기 버튼 요소
16
17
  */
17
18
  export declare class UDialog extends UOverlayElement {
@@ -23,8 +24,10 @@ export declare class UDialog extends UOverlayElement {
23
24
  /** 가장자리로부터의 간격 (px) */
24
25
  offset: number;
25
26
  private hasHeader;
27
+ private hasFooter;
26
28
  protected updated(changedProperties: PropertyValues): void;
27
29
  render(): import('lit-html').TemplateResult<1>;
30
+ private handleFooterSlotChange;
28
31
  private handleHeaderSlotChange;
29
32
  }
30
33
  declare global {
@@ -15,6 +15,7 @@ var UDialog = class UDialog extends UOverlayElement {
15
15
  this.placement = "center";
16
16
  this.offset = 0;
17
17
  this.hasHeader = false;
18
+ this.hasFooter = false;
18
19
  }
19
20
  static {
20
21
  this.styles = [super.styles, styles];
@@ -42,11 +43,16 @@ var UDialog = class UDialog extends UOverlayElement {
42
43
  <div class="body" part="body">
43
44
  <slot></slot>
44
45
  </div>
45
- <slot name="footer"></slot>
46
+ <div class="footer" part="footer" ?hidden=${!this.hasFooter}>
47
+ <slot name="footer" @slotchange=${this.handleFooterSlotChange}></slot>
48
+ </div>
46
49
  </div>
47
50
  </div>
48
51
  `;
49
52
  }
53
+ handleFooterSlotChange(e) {
54
+ this.hasFooter = e.target.assignedNodes({ flatten: true }).length > 0;
55
+ }
50
56
  handleHeaderSlotChange(e) {
51
57
  const slot = e.target;
52
58
  this.hasHeader = slot.assignedNodes({ flatten: true }).length > 0;
@@ -66,5 +72,6 @@ __decorate([property({
66
72
  reflect: true
67
73
  }), __decorateMetadata("design:type", Object)], UDialog.prototype, "offset", void 0);
68
74
  __decorate([state(), __decorateMetadata("design:type", Object)], UDialog.prototype, "hasHeader", void 0);
75
+ __decorate([state(), __decorateMetadata("design:type", Object)], UDialog.prototype, "hasFooter", void 0);
69
76
  UDialog = __decorate([customElement("u-dialog")], UDialog);
70
77
  export { UDialog };
@@ -109,14 +109,21 @@ var styles = css`
109
109
  overflow: auto;
110
110
  }
111
111
 
112
- ::slotted([slot="footer"]) {
112
+
113
+
114
+ .footer {
113
115
  flex-shrink: 0;
116
+ padding: var(--u-space-md, 12px) var(--u-space-lg, 16px);
117
+ border-top: 1px solid var(--u-border-color, #E0E0E0);
118
+ }
119
+ .footer[hidden] {
120
+ display: none;
121
+ }
122
+ ::slotted([slot="footer"]) {
114
123
  display: flex;
115
124
  align-items: center;
116
125
  justify-content: flex-end;
117
126
  gap: var(--u-space-sm, 8px);
118
- padding: var(--u-space-md, 12px) var(--u-space-lg, 16px);
119
- border-top: 1px solid var(--u-border-color, #E0E0E0);
120
127
  }
121
128
  `;
122
129
  export { styles };
@@ -11,6 +11,7 @@ export type DrawerPlacement = 'left' | 'right' | 'top' | 'bottom';
11
11
  * @csspart panel - 드로어 패널 전체
12
12
  * @csspart header - 헤더 영역
13
13
  * @csspart body - 본문 영역
14
+ * @csspart footer - 푸터 영역(여백 · 구분선) — 꽂힌 것이 없으면 그리지 않는다
14
15
  * @csspart close-btn - 닫기 버튼
15
16
  *
16
17
  * @cssprop --drawer-size - 드로어 패널의 슬라이드 축 방향 크기 (기본값: 좌우 28rem / 상하 16rem).
@@ -24,7 +25,9 @@ export declare class UDrawer extends UOverlayElement {
24
25
  /** 드로어가 열리는 위치 */
25
26
  placement: DrawerPlacement;
26
27
  private hasHeader;
28
+ private hasFooter;
27
29
  render(): import('lit-html').TemplateResult<1>;
30
+ private handleFooterSlotChange;
28
31
  private handleHeaderSlotChange;
29
32
  }
30
33
  declare global {
@@ -14,6 +14,7 @@ var UDrawer = class UDrawer extends UOverlayElement {
14
14
  this.closable = false;
15
15
  this.placement = "left";
16
16
  this.hasHeader = false;
17
+ this.hasFooter = false;
17
18
  }
18
19
  static {
19
20
  this.styles = [super.styles, styles];
@@ -35,10 +36,15 @@ var UDrawer = class UDrawer extends UOverlayElement {
35
36
  <div class="body" part="body">
36
37
  <slot></slot>
37
38
  </div>
38
- <slot name="footer"></slot>
39
+ <div class="footer" part="footer" ?hidden=${!this.hasFooter}>
40
+ <slot name="footer" @slotchange=${this.handleFooterSlotChange}></slot>
41
+ </div>
39
42
  </div>
40
43
  `;
41
44
  }
45
+ handleFooterSlotChange(e) {
46
+ this.hasFooter = e.target.assignedNodes({ flatten: true }).length > 0;
47
+ }
42
48
  handleHeaderSlotChange(e) {
43
49
  const slot = e.target;
44
50
  this.hasHeader = slot.assignedNodes({ flatten: true }).length > 0;
@@ -54,5 +60,6 @@ __decorate([property({
54
60
  reflect: true
55
61
  }), __decorateMetadata("design:type", Object)], UDrawer.prototype, "placement", void 0);
56
62
  __decorate([state(), __decorateMetadata("design:type", Object)], UDrawer.prototype, "hasHeader", void 0);
63
+ __decorate([state(), __decorateMetadata("design:type", Object)], UDrawer.prototype, "hasFooter", void 0);
57
64
  UDrawer = __decorate([customElement("u-drawer")], UDrawer);
58
65
  export { UDrawer };
@@ -97,14 +97,21 @@ var styles = css`
97
97
  overflow: auto;
98
98
  }
99
99
 
100
- ::slotted([slot="footer"]) {
100
+
101
+
102
+ .footer {
101
103
  flex-shrink: 0;
104
+ padding: var(--u-space-md, 12px) var(--u-space-lg, 16px);
105
+ border-top: 1px solid var(--u-border-color, #E0E0E0);
106
+ }
107
+ .footer[hidden] {
108
+ display: none;
109
+ }
110
+ ::slotted([slot="footer"]) {
102
111
  display: flex;
103
112
  align-items: center;
104
113
  justify-content: flex-end;
105
114
  gap: var(--u-space-sm, 8px);
106
- padding: var(--u-space-md, 12px) var(--u-space-lg, 16px);
107
- border-top: 1px solid var(--u-border-color, #E0E0E0);
108
115
  }
109
116
  `;
110
117
  export { styles };
@@ -52,6 +52,8 @@ export type FieldSize = 'sm' | 'md' | 'lg';
52
52
  */
53
53
  export declare class UInput extends UFormControlElement<string> {
54
54
  static styles: import('lit').CSSResultGroup[];
55
+ /** 접두 · 접미 슬롯이 찼는가 — 그 옆 간격은 섀도 안 상자가 갖는다(`::slotted` 여백은 문서의 전역 리셋에 진다). */
56
+ private readonly affixes;
55
57
  /** 외형 정도 */
56
58
  appearance: FieldAppearance;
57
59
  /** 전체 지우기 버튼 표시 여부 */
@@ -4,6 +4,7 @@ import __decorate from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm
4
4
  import { UFormControlElement } from "../UFormControlElement.js";
5
5
  import { isImeComposing } from "../../utilities/keyboard.js";
6
6
  import "../spinner/USpinner.js";
7
+ import { SlotPresence } from "../../utilities/slotPresence.js";
7
8
  import "../icon/UIcon.js";
8
9
  import { parseNumber } from "../../utilities/format.js";
9
10
  import "../field/UField.js";
@@ -19,6 +20,7 @@ import { live } from "lit/directives/live.js";
19
20
  var UInput = class UInput extends UFormControlElement {
20
21
  constructor(..._args) {
21
22
  super(..._args);
23
+ this.affixes = new SlotPresence(this, ["prefix", "suffix"]);
22
24
  this.appearance = "outlined";
23
25
  this.clearable = false;
24
26
  this.type = "text";
@@ -205,7 +207,7 @@ var UInput = class UInput extends UFormControlElement {
205
207
  <div class="container" part="container"
206
208
  style=${`--_icons: ${(showStepper ? 2 : 0) + (showClear ? 1 : 0) + (showToggle ? 1 : 0)}${this.charsWidth.width ? `; --input-min-text: ${this.charsWidth.width}` : ""}`}>
207
209
 
208
- <slot name="prefix"></slot>
210
+ <span class="affix affix-prefix" ?hidden=${!this.affixes.has("prefix")}><slot name="prefix"></slot></span>
209
211
 
210
212
  <input part="input"
211
213
  style=${ifDefined(this.charsWidth.width ? `inline-size: ${this.charsWidth.width}` : void 0)}
@@ -240,7 +242,7 @@ var UInput = class UInput extends UFormControlElement {
240
242
  @compositionend=${this.handleCompositionEnd}
241
243
  />
242
244
 
243
- <slot name="suffix"></slot>
245
+ <span class="affix affix-suffix" ?hidden=${!this.affixes.has("suffix")}><slot name="suffix"></slot></span>
244
246
 
245
247
  <u-icon class="suffix-item"
246
248
  ?hidden=${!showToggle}
@@ -173,10 +173,19 @@ var styles = css`
173
173
  }
174
174
 
175
175
 
176
- ::slotted([slot="prefix"]) {
176
+
177
+ .affix {
178
+ display: inline-flex;
179
+ align-items: center;
180
+ flex: none;
181
+ }
182
+ .affix[hidden] {
183
+ display: none;
184
+ }
185
+ .affix-prefix {
177
186
  margin-right: 0.25em;
178
187
  }
179
- ::slotted([slot="suffix"]) {
188
+ .affix-suffix {
180
189
  margin-left: 0.25em;
181
190
  }
182
191
 
@@ -21,6 +21,8 @@ export type MenuItemAlign = 'left' | 'center' | 'right';
21
21
  */
22
22
  export declare class UMenuItem extends UElement {
23
23
  static styles: import('lit').CSSResultGroup[];
24
+ /** 접두 · 접미 슬롯이 찼는가 — 그 옆 간격은 섀도 안 상자가 갖는다(`::slotted` 여백은 문서의 전역 리셋에 진다). */
25
+ private readonly affixes;
24
26
  /** 서브메뉴 확장 여부 */
25
27
  expanded: boolean;
26
28
  /** 비활성화 여부 */
@@ -2,6 +2,7 @@ import { UElement } from "../UElement.js";
2
2
  import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorateMetadata.js";
3
3
  import __decorate from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
4
4
  import { HostAria } from "../../utilities/hostAria.js";
5
+ import { SlotPresence } from "../../utilities/slotPresence.js";
5
6
  import "../icon/UIcon.js";
6
7
  import "../popover/UPopover.js";
7
8
  import { UDivider } from "../divider/UDivider.js";
@@ -18,6 +19,7 @@ var UMenuItem = class UMenuItem extends UElement {
18
19
  }
19
20
  constructor(..._args) {
20
21
  super(..._args);
22
+ this.affixes = new SlotPresence(this, ["prefix", "suffix"]);
21
23
  this.expanded = false;
22
24
  this.disabled = false;
23
25
  this.selected = false;
@@ -104,11 +106,11 @@ var UMenuItem = class UMenuItem extends UElement {
104
106
  name="check"
105
107
  ></u-icon>
106
108
 
107
- <slot name="prefix"></slot>
109
+ <span class="affix affix-prefix" ?hidden=${!this.affixes.has("prefix")}><slot name="prefix"></slot></span>
108
110
  <div class="content" part="content">
109
111
  <slot @slotchange=${this.handleSlotChange}></slot>
110
112
  </div>
111
- <slot name="suffix"></slot>
113
+ <span class="affix affix-suffix" ?hidden=${!this.affixes.has("suffix")}><slot name="suffix"></slot></span>
112
114
 
113
115
  ${this.inline ? html`
114
116
  <span class="suffix-toggler"
@@ -110,10 +110,19 @@ var styles = css`
110
110
  margin-left: 0.25em;
111
111
  }
112
112
 
113
- ::slotted([slot="prefix"]) {
113
+
114
+ .affix {
115
+ display: inline-flex;
116
+ align-items: center;
117
+ flex: none;
118
+ }
119
+ .affix[hidden] {
120
+ display: none;
121
+ }
122
+ .affix-prefix {
114
123
  margin-right: 0.25em;
115
124
  }
116
- ::slotted([slot="suffix"]) {
125
+ .affix-suffix {
117
126
  margin-left: 0.25em;
118
127
  }
119
128
 
@@ -30,6 +30,8 @@ export type OptionMarker = 'radio' | 'check';
30
30
  */
31
31
  export declare class UOption extends UElement {
32
32
  static styles: import('lit').CSSResultGroup[];
33
+ /** 접두 · 접미 슬롯이 찼는가 — 그 옆 간격은 섀도 안 상자가 갖는다(`::slotted` 여백은 문서의 전역 리셋에 진다). */
34
+ private readonly affixes;
33
35
  /** 비활성화 여부 */
34
36
  disabled: boolean;
35
37
  /** 선택 여부 */