@iyulab/components 0.1.4 → 0.1.6

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 (142) hide show
  1. package/CHANGELOG.md +18 -18
  2. package/LICENSE +20 -20
  3. package/README.md +33 -33
  4. package/dist/assets/icons/arrow-clockwise.svg.js +1 -1
  5. package/dist/assets/icons/arrow-down.svg.js +1 -1
  6. package/dist/assets/icons/arrow-up.svg.js +1 -1
  7. package/dist/assets/icons/ban.svg.js +1 -1
  8. package/dist/assets/icons/bell-fill.svg.js +1 -1
  9. package/dist/assets/icons/check-circle-fill.svg.js +1 -1
  10. package/dist/assets/icons/check-lg.svg.js +1 -1
  11. package/dist/assets/icons/chevron-down.svg.js +1 -1
  12. package/dist/assets/icons/chevron-left.svg.js +1 -1
  13. package/dist/assets/icons/chevron-right.svg.js +1 -1
  14. package/dist/assets/icons/chevron-up.svg.js +1 -1
  15. package/dist/assets/icons/copy.svg.js +1 -1
  16. package/dist/assets/icons/dash-lg.svg.js +1 -1
  17. package/dist/assets/icons/exclamation-circle-fill.svg.js +1 -1
  18. package/dist/assets/icons/exclamation-triangle-fill.svg.js +1 -1
  19. package/dist/assets/icons/eye-slash.svg.js +1 -1
  20. package/dist/assets/icons/eye.svg.js +1 -1
  21. package/dist/assets/icons/info-circle-fill.svg.js +1 -1
  22. package/dist/assets/icons/layout-sidebar.svg.js +1 -1
  23. package/dist/assets/icons/lightbulb-fill.svg.js +1 -1
  24. package/dist/assets/icons/lightbulb-off.svg.js +1 -1
  25. package/dist/assets/icons/lightbulb.svg.js +1 -1
  26. package/dist/assets/icons/mic-fill.svg.js +1 -1
  27. package/dist/assets/icons/mic-mute-fill.svg.js +1 -1
  28. package/dist/assets/icons/paperclip.svg.js +1 -1
  29. package/dist/assets/icons/pencil-square.svg.js +1 -1
  30. package/dist/assets/icons/plus-lg.svg.js +1 -1
  31. package/dist/assets/icons/search.svg.js +1 -1
  32. package/dist/assets/icons/speedometer.svg.js +1 -1
  33. package/dist/assets/icons/x-lg.svg.js +1 -1
  34. package/dist/assets/styles/dark.css +129 -125
  35. package/dist/assets/styles/dark.css.js +1 -1
  36. package/dist/assets/styles/light.css +129 -126
  37. package/dist/assets/styles/light.css.js +1 -1
  38. package/dist/components/BaseElement.styles.js +2 -2
  39. package/dist/components/FloatingElement.d.ts +84 -0
  40. package/dist/components/FloatingElement.js +166 -0
  41. package/dist/components/FloatingElement.styles.js +26 -0
  42. package/dist/components/alert/Alert.d.ts +8 -4
  43. package/dist/components/alert/Alert.js +24 -15
  44. package/dist/components/alert/Alert.styles.js +32 -39
  45. package/dist/components/alert/index.js +5 -0
  46. package/dist/components/button/Button.js +4 -2
  47. package/dist/components/button/Button.styles.js +13 -20
  48. package/dist/components/button/index.js +5 -0
  49. package/dist/components/context-menu/ContextMenu.d.ts +20 -39
  50. package/dist/components/context-menu/ContextMenu.js +92 -137
  51. package/dist/components/context-menu/ContextMenu.styles.js +3 -28
  52. package/dist/components/context-menu/index.d.ts +1 -1
  53. package/dist/components/context-menu/index.js +5 -0
  54. package/dist/components/copy-button/CopyButton.d.ts +7 -3
  55. package/dist/components/copy-button/CopyButton.js +69 -0
  56. package/dist/components/copy-button/CopyButton.styles.js +17 -0
  57. package/dist/components/copy-button/index.js +5 -0
  58. package/dist/components/dialog/Dialog.d.ts +14 -7
  59. package/dist/components/dialog/Dialog.js +88 -27
  60. package/dist/components/dialog/Dialog.styles.js +60 -11
  61. package/dist/components/dialog/index.js +5 -0
  62. package/dist/components/divider/Divider.d.ts +10 -10
  63. package/dist/components/divider/Divider.js +32 -32
  64. package/dist/components/divider/Divider.styles.js +10 -10
  65. package/dist/components/divider/index.js +5 -0
  66. package/dist/components/dropdown-menu/DropdownMenu.d.ts +27 -0
  67. package/dist/components/dropdown-menu/DropdownMenu.js +135 -0
  68. package/dist/components/dropdown-menu/DropdownMenu.styles.d.ts +1 -0
  69. package/dist/components/dropdown-menu/DropdownMenu.styles.js +15 -0
  70. package/dist/components/dropdown-menu/index.d.ts +7 -0
  71. package/dist/components/dropdown-menu/index.js +5 -0
  72. package/dist/components/form/Form.d.ts +3 -1
  73. package/dist/components/form/Form.js +3 -1
  74. package/dist/components/form/Form.styles.js +1 -0
  75. package/dist/components/form/index.js +5 -0
  76. package/dist/components/icon/Icon.d.ts +6 -12
  77. package/dist/components/icon/Icon.js +15 -30
  78. package/dist/components/icon/Icon.styles.js +1 -1
  79. package/dist/components/icon/index.js +5 -0
  80. package/dist/components/icon-button/IconButton.d.ts +3 -3
  81. package/dist/components/icon-button/IconButton.js +6 -6
  82. package/dist/components/icon-button/IconButton.styles.js +14 -29
  83. package/dist/components/icon-button/index.js +5 -0
  84. package/dist/components/index.d.ts +3 -1
  85. package/dist/components/input/Input.d.ts +14 -13
  86. package/dist/components/input/Input.js +57 -56
  87. package/dist/components/input/Input.styles.js +54 -56
  88. package/dist/components/input/index.js +5 -0
  89. package/dist/components/menu/Menu.d.ts +4 -15
  90. package/dist/components/menu/Menu.js +43 -28
  91. package/dist/components/menu/Menu.styles.js +7 -19
  92. package/dist/components/menu/index.js +5 -0
  93. package/dist/components/menu-item/MenuItem.d.ts +21 -12
  94. package/dist/components/menu-item/MenuItem.js +184 -15
  95. package/dist/components/menu-item/MenuItem.styles.js +6 -0
  96. package/dist/components/menu-item/index.js +5 -0
  97. package/dist/components/progress-bar/ProgressBar.d.ts +1 -1
  98. package/dist/components/progress-bar/ProgressBar.js +2 -2
  99. package/dist/components/progress-bar/ProgressBar.styles.js +10 -10
  100. package/dist/components/progress-bar/index.js +5 -0
  101. package/dist/components/progress-ring/ProgressRing.d.ts +2 -2
  102. package/dist/components/progress-ring/ProgressRing.js +7 -6
  103. package/dist/components/progress-ring/ProgressRing.styles.js +8 -9
  104. package/dist/components/progress-ring/index.js +5 -0
  105. package/dist/components/spinner/Spinner.styles.js +5 -3
  106. package/dist/components/spinner/index.js +5 -0
  107. package/dist/components/split-panel/SplitPanel.d.ts +11 -3
  108. package/dist/components/split-panel/SplitPanel.js +44 -27
  109. package/dist/components/split-panel/SplitPanel.styles.js +1 -16
  110. package/dist/components/split-panel/index.js +5 -0
  111. package/dist/components/tooltip/Tooltip.d.ts +9 -29
  112. package/dist/components/tooltip/Tooltip.js +27 -149
  113. package/dist/components/tooltip/Tooltip.styles.js +9 -23
  114. package/dist/components/tooltip/index.js +5 -0
  115. package/dist/components/tree/index.js +5 -0
  116. package/dist/components/tree-item/index.js +5 -0
  117. package/dist/index.js +28 -5
  118. package/dist/integrations/react/UDropdownMenu.d.ts +8 -0
  119. package/dist/integrations/react/UDropdownMenu.js +10 -0
  120. package/dist/integrations/react/index.d.ts +1 -1
  121. package/dist/integrations/react/index.js +1 -1
  122. package/dist/internals/index.d.ts +0 -1
  123. package/dist/internals/node-helpers.d.ts +6 -1
  124. package/dist/internals/node-helpers.js +5 -6
  125. package/dist/utilities/decorators.js +2 -0
  126. package/dist/utilities/icons.d.ts +46 -0
  127. package/dist/utilities/icons.js +114 -0
  128. package/dist/utilities/index.d.ts +1 -0
  129. package/dist/utilities/notifier.d.ts +17 -7
  130. package/dist/utilities/notifier.js +51 -41
  131. package/dist/utilities/theme.d.ts +15 -20
  132. package/dist/utilities/theme.js +24 -20
  133. package/package.json +59 -58
  134. package/dist/components/panel/Panel.d.ts +0 -9
  135. package/dist/components/panel/Panel.js +0 -17
  136. package/dist/components/panel/Panel.styles.js +0 -12
  137. package/dist/components/panel/index.d.ts +0 -7
  138. package/dist/integrations/react/UPanel.d.ts +0 -8
  139. package/dist/integrations/react/UPanel.js +0 -10
  140. package/dist/internals/icon-helpers.d.ts +0 -32
  141. package/dist/internals/icon-helpers.js +0 -48
  142. /package/dist/components/{panel/Panel.styles.d.ts → FloatingElement.styles.d.ts} +0 -0
@@ -0,0 +1,84 @@
1
+ import { CSSResultGroup, PropertyValues } from 'lit';
2
+ import { Placement, VirtualElement } from '@floating-ui/dom';
3
+ import { BaseElement } from './BaseElement.js';
4
+ /**
5
+ * FloatingElement는 팝오버, 툴팁 등 화면에 떠 있는 엘리먼트를 구현하기 위한 기본 클래스입니다.
6
+ * 이 클래스를 상속하여 커스텀 팝오버 컴포넌트를 만들 수 있습니다.
7
+ *
8
+ * 1. for, anchor 속성을 통해 연결될 대상 엘리먼트를 지정할 수 있습니다.
9
+ * 2. visible 속성을 통해 엘리먼트의 표시 여부를 제어할 수 있습니다.
10
+ * 3. strategy, placement, distance 속성을 통해 표시 위치 결정 방식을 설정할 수 있습니다.
11
+ * 4. show() 및 hide() 메서드를 통해 프로그래밍적으로 표시하거나 숨길 수 있습니다.
12
+ */
13
+ export declare class FloatingElement extends BaseElement {
14
+ /** 기본 스타일을 정의합니다. */
15
+ static styles: CSSResultGroup;
16
+ /** 종속된 컴포넌트를 정의합니다. */
17
+ static dependencies: Record<string, typeof BaseElement>;
18
+ private rafId;
19
+ private cleanup;
20
+ /**
21
+ * 연결될 대상 엘리먼트 입니다. 지정하지 않으면 부모 엘리먼트를 사용합니다.
22
+ */
23
+ anchor?: HTMLElement;
24
+ /**
25
+ * 현재 엘리먼트가 보여지는지 여부입니다.
26
+ */
27
+ visible: boolean;
28
+ /**
29
+ * 현재 엘리먼트의 위치 결정 전략입니다.
30
+ *
31
+ * @remarks
32
+ * - `absolute`: 엘리먼트가 문서 흐름에 따라 배치됩니다.
33
+ * - `fixed`: 엘리먼트가 뷰포트에 고정되어 스크롤과 무관하게 위치합니다.
34
+ */
35
+ strategy: 'absolute' | 'fixed';
36
+ /**
37
+ * 앵커 엘리먼트를 찾기 위한 CSS 선택자입니다. querySelector를 사용하여 DOM에서 대상을 검색합니다.
38
+ *
39
+ * @example
40
+ * - `id`로 찾기: for="#target-id"
41
+ * - `class`로 찾기: for=".target-class"
42
+ * - `태그명`으로 찾기: for="target-tag-name"
43
+ * - `속성`으로 찾기: for="[data-role='target']"
44
+ */
45
+ for?: string;
46
+ /**
47
+ * 대상 엘리먼트로부터의 배치 위치입니다.
48
+ * 지정하지 않으면 `floating-ui`의 `autoPlacement`가 적용됩니다.
49
+ */
50
+ placement?: Placement;
51
+ /**
52
+ * 대상 엘리먼트로부터의 거리 (px) 입니다.
53
+ *
54
+ * @default 0
55
+ */
56
+ distance: number;
57
+ connectedCallback(): void;
58
+ disconnectedCallback(): void;
59
+ protected willUpdate(changedProperties: PropertyValues): void;
60
+ /**
61
+ * 현재 엘리먼트를 표시합니다.
62
+ *
63
+ * @param anchor - 위치 계산에 사용할 앵커 엘리먼트입니다. 지정하지 않으면 this.anchor 가 사용됩니다.
64
+ */
65
+ show(anchor?: Element | VirtualElement): Promise<void>;
66
+ /**
67
+ * 현재 엘리먼트를 숨깁니다.
68
+ */
69
+ hide(): Promise<void>;
70
+ /**
71
+ * `floating-ui` 를 이용하여 위치를 계산하고 style 을 적용합니다.
72
+ *
73
+ * @param target - 위치 계산에 사용할 앵커 엘리먼트입니다.
74
+ */
75
+ protected reposition(target: Element | VirtualElement): Promise<void>;
76
+ /**
77
+ * 자동 위치 업데이트를 설정하거나 해제합니다.
78
+ *
79
+ * @param enable - 자동 위치 업데이트 활성화 여부
80
+ */
81
+ protected autoPosition(enable: boolean): void;
82
+ /** 애니메이션 프레임을 사용하여 표시 상태를 스케줄링합니다. */
83
+ private scheduleVisible;
84
+ }
@@ -0,0 +1,166 @@
1
+ import { state, property } from 'lit/decorators.js';
2
+ import { offset, shift, flip, autoPlacement, computePosition, autoUpdate } from '@floating-ui/dom';
3
+ import { getParentElement, querySelectorFrom } from '../internals/node-helpers.js';
4
+ import { BaseElement } from './BaseElement.js';
5
+ import { styles } from './FloatingElement.styles.js';
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __decorateClass = (decorators, target, key, kind) => {
9
+ var result = void 0 ;
10
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
+ if (decorator = decorators[i])
12
+ result = (decorator(target, key, result) ) || result;
13
+ if (result) __defProp(target, key, result);
14
+ return result;
15
+ };
16
+ class FloatingElement extends BaseElement {
17
+ constructor() {
18
+ super(...arguments);
19
+ // 애니메이션 프레임 아이디
20
+ this.rafId = null;
21
+ // 자동 위치 업데이트 정리 함수
22
+ this.cleanup = null;
23
+ this.visible = false;
24
+ this.strategy = "absolute";
25
+ this.distance = 0;
26
+ }
27
+ static {
28
+ /** 기본 스타일을 정의합니다. */
29
+ this.styles = [super.styles, styles];
30
+ }
31
+ static {
32
+ /** 종속된 컴포넌트를 정의합니다. */
33
+ this.dependencies = {};
34
+ }
35
+ connectedCallback() {
36
+ super.connectedCallback();
37
+ this.anchor ||= getParentElement(this);
38
+ }
39
+ disconnectedCallback() {
40
+ if (this.rafId !== null) cancelAnimationFrame(this.rafId);
41
+ this.autoPosition(false);
42
+ super.disconnectedCallback();
43
+ }
44
+ willUpdate(changedProperties) {
45
+ super.willUpdate(changedProperties);
46
+ if (changedProperties.has("for")) {
47
+ const founded = this.for ? querySelectorFrom(this, this.for) : void 0;
48
+ this.anchor = founded || void 0;
49
+ }
50
+ }
51
+ /**
52
+ * 현재 엘리먼트를 표시합니다.
53
+ *
54
+ * @param anchor - 위치 계산에 사용할 앵커 엘리먼트입니다. 지정하지 않으면 this.anchor 가 사용됩니다.
55
+ */
56
+ async show(anchor) {
57
+ anchor ||= this.anchor;
58
+ if (!anchor) return;
59
+ await this.updateComplete;
60
+ await this.reposition(anchor);
61
+ this.autoPosition(true);
62
+ this.scheduleVisible(true);
63
+ }
64
+ /**
65
+ * 현재 엘리먼트를 숨깁니다.
66
+ */
67
+ async hide() {
68
+ await this.updateComplete;
69
+ this.autoPosition(false);
70
+ this.scheduleVisible(false);
71
+ }
72
+ /**
73
+ * `floating-ui` 를 이용하여 위치를 계산하고 style 을 적용합니다.
74
+ *
75
+ * @param target - 위치 계산에 사용할 앵커 엘리먼트입니다.
76
+ */
77
+ async reposition(target) {
78
+ const middleware = [
79
+ offset({ mainAxis: this.distance }),
80
+ shift(),
81
+ flip()
82
+ ];
83
+ if (!this.placement) {
84
+ middleware.push(autoPlacement());
85
+ }
86
+ const position = await computePosition(target, this, {
87
+ strategy: this.strategy,
88
+ placement: this.placement,
89
+ middleware
90
+ });
91
+ Object.assign(this.style, {
92
+ left: `${position.x}px`,
93
+ top: `${position.y}px`,
94
+ // placement 에 따라 transform-origin 값을 결정합니다.
95
+ transformOrigin: (() => {
96
+ switch (position.placement) {
97
+ case "top":
98
+ case "top-start":
99
+ case "top-end":
100
+ return "center bottom";
101
+ case "bottom":
102
+ case "bottom-start":
103
+ case "bottom-end":
104
+ return "center top";
105
+ case "left":
106
+ case "left-start":
107
+ case "left-end":
108
+ return "right center";
109
+ case "right":
110
+ case "right-start":
111
+ case "right-end":
112
+ return "left center";
113
+ default:
114
+ return "center";
115
+ }
116
+ })()
117
+ });
118
+ }
119
+ /**
120
+ * 자동 위치 업데이트를 설정하거나 해제합니다.
121
+ *
122
+ * @param enable - 자동 위치 업데이트 활성화 여부
123
+ */
124
+ autoPosition(enable) {
125
+ if (this.cleanup) {
126
+ this.cleanup();
127
+ this.cleanup = null;
128
+ }
129
+ if (enable && this.anchor) {
130
+ this.cleanup = autoUpdate(this.anchor, this, () => {
131
+ this.reposition(this.anchor);
132
+ });
133
+ }
134
+ }
135
+ /** 애니메이션 프레임을 사용하여 표시 상태를 스케줄링합니다. */
136
+ scheduleVisible(visible) {
137
+ if (this.rafId !== null) {
138
+ cancelAnimationFrame(this.rafId);
139
+ this.rafId = null;
140
+ }
141
+ this.rafId = requestAnimationFrame(() => {
142
+ this.visible = visible;
143
+ this.rafId = null;
144
+ });
145
+ }
146
+ }
147
+ __decorateClass([
148
+ state()
149
+ ], FloatingElement.prototype, "anchor");
150
+ __decorateClass([
151
+ property({ type: Boolean, reflect: true })
152
+ ], FloatingElement.prototype, "visible");
153
+ __decorateClass([
154
+ property({ type: String, reflect: true })
155
+ ], FloatingElement.prototype, "strategy");
156
+ __decorateClass([
157
+ property({ type: String })
158
+ ], FloatingElement.prototype, "for");
159
+ __decorateClass([
160
+ property({ type: String })
161
+ ], FloatingElement.prototype, "placement");
162
+ __decorateClass([
163
+ property({ type: Number })
164
+ ], FloatingElement.prototype, "distance");
165
+
166
+ export { FloatingElement };
@@ -0,0 +1,26 @@
1
+ import { css } from 'lit';
2
+
3
+ const styles = css`
4
+ :host {
5
+ position: absolute;
6
+ z-index: 1000;
7
+ top: 0;
8
+ left: 0;
9
+ width: max-content;
10
+
11
+ opacity: 0;
12
+ pointer-events: none;
13
+ }
14
+ :host([strategy="absolute"]) {
15
+ position: absolute;
16
+ }
17
+ :host([strategy="fixed"]) {
18
+ position: fixed;
19
+ }
20
+ :host([visible]) {
21
+ opacity: 0.8;
22
+ pointer-events: auto;
23
+ }
24
+ `;
25
+
26
+ export { styles };
@@ -14,7 +14,7 @@ export declare class Alert extends BaseElement {
14
14
  /** 상태 (warning, error, info, success, notice) */
15
15
  type: AlertType;
16
16
  /** 타이틀 라벨 */
17
- label?: string;
17
+ heading?: string;
18
18
  /** 본문 내용 */
19
19
  content?: string;
20
20
  /** 본문 최소 행 수 */
@@ -25,12 +25,16 @@ export declare class Alert extends BaseElement {
25
25
  duration: number;
26
26
  protected updated(changedProperties: PropertyValues): void;
27
27
  render(): import('lit-html').TemplateResult<1>;
28
- /** Alert를 표시합니다. */
28
+ /**
29
+ * Alert를 표시합니다.
30
+ */
29
31
  show(): Promise<void>;
30
- /** Alert를 숨깁니다. */
32
+ /**
33
+ * Alert를 숨깁니다.
34
+ */
31
35
  hide(): Promise<void>;
32
36
  /** Alert 타입에 따른 아이콘 이름을 반환합니다. */
33
- private getIcon;
37
+ private getIconName;
34
38
  /** open 속성 변경에 따른 상태 업데이트를 처리합니다. */
35
39
  private updateOpenState;
36
40
  }
@@ -3,6 +3,7 @@ import { property } from 'lit/decorators.js';
3
3
  import { BaseElement } from '../BaseElement.js';
4
4
  import { Icon } from '../icon/Icon.js';
5
5
  import { styles } from './Alert.styles.js';
6
+ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
6
7
 
7
8
  var __defProp = Object.defineProperty;
8
9
  var __decorateClass = (decorators, target, key, kind) => {
@@ -44,34 +45,42 @@ class Alert extends BaseElement {
44
45
  }
45
46
  render() {
46
47
  return html`
47
- <div class="container">
48
- <div class="header">
49
- <u-icon class="icon"
50
- name=${this.getIcon(this.type)}
48
+ <div class="container" part="base">
49
+ <div class="header" part="header">
50
+ <u-icon class="icon" part="icon"
51
+ .library=${"internal"}
52
+ .name=${this.getIconName(this.type)}
51
53
  ></u-icon>
52
- <div class="title">
53
- ${this.label || this.type.toUpperCase()}
54
+ <div class="title" part="title">
55
+ ${this.heading || this.type.toUpperCase()}
54
56
  </div>
55
- <u-icon class="close-btn"
56
- name="x-lg"
57
+ <u-icon class="close-btn" part="close-btn"
58
+ .library=${"internal"}
59
+ .name=${"x-lg"}
57
60
  @click=${this.hide}
58
61
  ></u-icon>
59
62
  </div>
60
- <div class="content scrollable">
61
- ${this.content || html`<slot></slot>`}
63
+ <div class="content scrollable" part="content">
64
+ ${this.content ? unsafeHTML(this.content) : html`<slot></slot>`}
65
+ </div>
66
+ <div class="footer" part="footer">
67
+ <slot name="footer"></slot>
62
68
  </div>
63
- <div class="footer"></div>
64
69
  </div>
65
70
  `;
66
71
  }
67
- /** Alert를 표시합니다. */
72
+ /**
73
+ * Alert를 표시합니다.
74
+ */
68
75
  async show() {
69
76
  await this.updateComplete;
70
77
  requestAnimationFrame(() => {
71
78
  this.open = true;
72
79
  });
73
80
  }
74
- /** Alert를 숨깁니다. */
81
+ /**
82
+ * Alert를 숨깁니다.
83
+ */
75
84
  async hide() {
76
85
  await this.updateComplete;
77
86
  requestAnimationFrame(() => {
@@ -79,7 +88,7 @@ class Alert extends BaseElement {
79
88
  });
80
89
  }
81
90
  /** Alert 타입에 따른 아이콘 이름을 반환합니다. */
82
- getIcon(type) {
91
+ getIconName(type) {
83
92
  switch (type) {
84
93
  case "error":
85
94
  return "exclamation-circle-fill";
@@ -118,7 +127,7 @@ __decorateClass([
118
127
  ], Alert.prototype, "type");
119
128
  __decorateClass([
120
129
  property({ type: String })
121
- ], Alert.prototype, "label");
130
+ ], Alert.prototype, "heading");
122
131
  __decorateClass([
123
132
  property({ type: String })
124
133
  ], Alert.prototype, "content");
@@ -1,64 +1,60 @@
1
1
  import { css } from 'lit';
2
2
 
3
3
  const styles = css`
4
+ :host {
5
+ --icon-primary-color: var(--u-neutral-700);
6
+ --min-content-rows: 1;
7
+ --max-content-rows: 3;
8
+ }
9
+
4
10
  :host {
5
11
  display: block;
6
12
  min-width: 300px;
7
13
  max-width: 500px;
8
-
9
- background-color: var(--alert-bg-color);
10
- border: 1px solid var(--alert-border-color);
14
+
11
15
  border-radius: 8px;
12
- box-shadow: 0 4px 12px var(--u-shadow-medium), 0 2px 4px var(--u-shadow-weak);
16
+ box-shadow: 0 4px 12px var(--u-shadow-color-normal);
13
17
 
14
18
  opacity: 0;
15
19
  transform: scale(0.8);
16
20
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
17
21
  pointer-events: none;
18
-
19
- --min-content-rows: 1;
20
- --max-content-rows: 3;
21
-
22
- --alert-icon-color: var(--u-neutral-700);
23
- --alert-bg-color: var(--u-neutral-100);
24
- --alert-border-color: var(--u-neutral-300);
25
22
  }
26
23
  :host([open]) {
27
24
  opacity: 1;
28
25
  transform: scale(1);
29
26
  pointer-events: auto;
30
27
  }
31
-
32
28
  :host([type="error"]) {
33
- --alert-icon-color: var(--u-red-700);
34
- --alert-bg-color: var(--u-red-0);
35
- --alert-border-color: var(--u-red-100);
29
+ --icon-primary-color: var(--u-red-700);
30
+ border-color: var(--u-red-300);
31
+ background-color: var(--u-red-200);
36
32
  }
37
33
  :host([type="warning"]) {
38
- --alert-icon-color: var(--u-yellow-700);
39
- --alert-bg-color: var(--u-yellow-0);
40
- --alert-border-color: var(--u-yellow-100);
34
+ --icon-primary-color: var(--u-yellow-700);
35
+ border-color: var(--u-yellow-300);
36
+ background-color: var(--u-yellow-200);
41
37
  }
42
38
  :host([type="info"]) {
43
- --alert-icon-color: var(--u-blue-700);
44
- --alert-bg-color: var(--u-blue-0);
45
- --alert-border-color: var(--u-blue-100);
39
+ --icon-primary-color: var(--u-blue-700);
40
+ border-color: var(--u-blue-300);
41
+ background-color: var(--u-blue-200);
46
42
  }
47
43
  :host([type="success"]) {
48
- --alert-icon-color: var(--u-green-700);
49
- --alert-bg-color: var(--u-green-0);
50
- --alert-border-color: var(--u-green-100);
44
+ --icon-primary-color: var(--u-green-700);
45
+ border-color: var(--u-green-300);
46
+ background-color: var(--u-green-200);
51
47
  }
52
48
  :host([type="notice"]) {
53
- --alert-icon-color: var(--u-neutral-700);
54
- --alert-bg-color: var(--u-neutral-100);
55
- --alert-border-color: var(--u-neutral-300);
49
+ --icon-primary-color: var(--u-neutral-700);
50
+ border-color: var(--u-neutral-300);
51
+ background-color: var(--u-neutral-200);
56
52
  }
57
53
 
58
54
  .container {
59
55
  display: flex;
60
56
  flex-direction: column;
61
- padding: 8px 12px 8px 12px;
57
+ padding: 8px 12px;
62
58
  overflow: hidden;
63
59
  }
64
60
 
@@ -69,23 +65,21 @@ const styles = css`
69
65
  align-items: center;
70
66
  gap: 12px;
71
67
  margin-bottom: 4px;
68
+ font-size: 16px;
72
69
  user-select: none;
73
70
  }
74
71
  .header .icon {
75
72
  flex-shrink: 0;
76
- font-size: 20px;
77
- color: var(--alert-icon-color);
78
- filter: drop-shadow(0 1px 2px var(--u-shadow-weak));
73
+ color: var(--icon-primary-color);
79
74
  }
80
75
  .header .title {
81
- flex: 1;
82
- font-size: 16px;
76
+ flex-grow: 1;
83
77
  font-weight: 600;
84
- line-height: 1.4;
78
+ line-height: 2;
85
79
  }
86
80
  .header .close-btn {
87
81
  flex-shrink: 0;
88
- font-size: 18px;
82
+ color: var(--u-icon-color);
89
83
  cursor: pointer;
90
84
  }
91
85
  .header .close-btn:hover {
@@ -98,16 +92,15 @@ const styles = css`
98
92
 
99
93
  .content {
100
94
  font-size: 14px;
101
- font-weight: 400;
102
- color: var(--u-soft-text-color);
103
- line-height: 1.6;
95
+ font-weight: 300;
96
+ line-height: 1.5;
104
97
  min-height: calc(1.6em * var(--min-content-rows));
105
98
  max-height: calc(1.6em * var(--max-content-rows));
106
99
  overflow-y: auto;
107
100
  }
108
101
 
109
102
  .footer {
110
- display: none;
103
+ display: inline-block;
111
104
  }
112
105
  `;
113
106
 
@@ -0,0 +1,5 @@
1
+ import { Alert } from './Alert.js';
2
+
3
+ Alert.define("u-alert");
4
+
5
+ export { Alert };
@@ -29,13 +29,15 @@ class Button extends BaseElement {
29
29
  }
30
30
  render() {
31
31
  return html`
32
- <button part="base" ?disabled=${this.disabled || this.loading}>
32
+ <button part="base"
33
+ ?disabled=${this.disabled || this.loading}>
33
34
  <slot name="prefix"></slot>
34
35
  <slot></slot>
35
36
  <slot name="suffix"></slot>
36
37
  </button>
37
38
 
38
- <div class="overlay" ?hidden=${!this.loading}>
39
+ <div class="overlay" part="overlay"
40
+ ?hidden=${!this.loading}>
39
41
  <u-spinner></u-spinner>
40
42
  </div>
41
43
  `;
@@ -9,31 +9,29 @@ const styles = css`
9
9
  font-weight: 500;
10
10
  line-height: 1.5;
11
11
  padding: 0.5em 1em;
12
- background-color: var(--u-bg-color);
13
12
  border: 1px solid var(--u-border-color);
14
13
  border-radius: 6px;
14
+ background-color: var(--u-bg-color);
15
15
 
16
16
  transition: all 0.2s ease;
17
+ overflow: hidden;
17
18
  user-select: none;
18
19
  cursor: pointer;
19
20
  }
20
- :host([loading]),
21
- :host([disabled]) {
22
- pointer-events: none;
23
- }
24
- :host([disabled]) {
25
- color: var(--u-text-color-disabled);
26
- }
27
21
  :host(:hover) {
28
- color: var(--u-text-color-hover);
22
+ color: var(--u-txt-color-hover);
29
23
  background-color: var(--u-bg-color-hover);
30
- border-color: var(--u-border-color-strong);
31
24
  }
32
25
  :host(:active) {
33
- color: var(--u-text-color-active);
26
+ color: var(--u-txt-color-active);
34
27
  background-color: var(--u-bg-color-active);
35
28
  transform: translateY(1px);
36
29
  }
30
+ :host([loading]),
31
+ :host([disabled]) {
32
+ color: var(--u-txt-color-disabled);
33
+ pointer-events: none;
34
+ }
37
35
 
38
36
  button {
39
37
  all: unset;
@@ -49,21 +47,16 @@ const styles = css`
49
47
  }
50
48
 
51
49
  slot {
52
- flex: 1 1 auto;
50
+ flex: 1 0 auto;
53
51
  min-width: 0;
54
52
  display: inline-flex;
55
- align-items: center;
56
53
  justify-content: center;
57
54
  }
58
- slot[name="prefix"],
59
- slot[name="suffix"] {
60
- flex: 0 0 auto;
61
- }
62
- /* 슬롯에 내용이 있을 때만 gap 적용 */
63
- slot[name="prefix"]:not(:empty) {
55
+ /* 슬롯에 내용이 있을 때 gap 적용 */
56
+ ::slotted([slot="prefix"]) {
64
57
  margin-right: 0.5em;
65
58
  }
66
- slot[name="suffix"]:not(:empty) {
59
+ ::slotted([slot="suffix"]) {
67
60
  margin-left: 0.5em;
68
61
  }
69
62
 
@@ -0,0 +1,5 @@
1
+ import { Button } from './Button.js';
2
+
3
+ Button.define("u-button");
4
+
5
+ export { Button };