@iyulab/components 0.1.0 → 0.1.2

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 (81) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/assets/icons/arrow-clockwise.svg.js +3 -7
  3. package/dist/assets/icons/arrow-down.svg.js +3 -6
  4. package/dist/assets/icons/arrow-up.svg.js +3 -6
  5. package/dist/assets/icons/ban.svg.js +3 -6
  6. package/dist/assets/icons/bell-fill.svg.js +3 -6
  7. package/dist/assets/icons/check-circle-fill.svg.js +3 -6
  8. package/dist/assets/icons/check-lg.svg.js +3 -6
  9. package/dist/assets/icons/chevron-down.svg.js +3 -6
  10. package/dist/assets/icons/chevron-left.svg.js +3 -6
  11. package/dist/assets/icons/chevron-right.svg.js +3 -6
  12. package/dist/assets/icons/chevron-up.svg.js +3 -6
  13. package/dist/assets/icons/copy.svg.js +3 -6
  14. package/dist/assets/icons/dash-lg.svg.js +3 -6
  15. package/dist/assets/icons/exclamation-circle-fill.svg.js +3 -6
  16. package/dist/assets/icons/exclamation-triangle-fill.svg.js +3 -6
  17. package/dist/assets/icons/eye-slash.svg.js +3 -8
  18. package/dist/assets/icons/eye.svg.js +3 -7
  19. package/dist/assets/icons/info-circle-fill.svg.js +3 -6
  20. package/dist/assets/icons/layout-sidebar.svg.js +3 -6
  21. package/dist/assets/icons/lightbulb-fill.svg.js +3 -6
  22. package/dist/assets/icons/lightbulb-off.svg.js +3 -6
  23. package/dist/assets/icons/lightbulb.svg.js +3 -6
  24. package/dist/assets/icons/mic-fill.svg.js +3 -7
  25. package/dist/assets/icons/mic-mute-fill.svg.js +3 -7
  26. package/dist/assets/icons/paperclip.svg.js +3 -6
  27. package/dist/assets/icons/pencil-square.svg.js +3 -7
  28. package/dist/assets/icons/plus-lg.svg.js +3 -6
  29. package/dist/assets/icons/search.svg.js +3 -6
  30. package/dist/assets/icons/speedometer.svg.js +3 -7
  31. package/dist/assets/icons/x-lg.svg.js +3 -6
  32. package/dist/assets/styles/dark.css.js +3 -4
  33. package/dist/assets/styles/light.css.js +3 -4
  34. package/dist/components/BaseElement.js +32 -22
  35. package/dist/components/BaseElement.styles.js +5 -5
  36. package/dist/components/alert/Alert.js +79 -51
  37. package/dist/components/alert/Alert.styles.js +5 -5
  38. package/dist/components/button/Button.js +29 -23
  39. package/dist/components/button/Button.styles.js +5 -5
  40. package/dist/components/context-menu/ContextMenu.js +123 -72
  41. package/dist/components/context-menu/ContextMenu.styles.js +5 -5
  42. package/dist/components/dialog/Dialog.js +73 -40
  43. package/dist/components/dialog/Dialog.styles.js +5 -5
  44. package/dist/components/form/Form.js +51 -32
  45. package/dist/components/form/Form.styles.js +5 -5
  46. package/dist/components/icon/Icon.js +53 -36
  47. package/dist/components/icon/Icon.styles.js +5 -5
  48. package/dist/components/icon-button/IconButton.js +44 -36
  49. package/dist/components/icon-button/IconButton.styles.js +5 -5
  50. package/dist/components/input/Input.js +161 -112
  51. package/dist/components/input/Input.styles.js +5 -5
  52. package/dist/components/menu/Menu.js +108 -58
  53. package/dist/components/menu/Menu.styles.js +5 -5
  54. package/dist/components/menu-item/MenuItem.js +67 -37
  55. package/dist/components/menu-item/MenuItem.styles.js +5 -5
  56. package/dist/components/panel/Panel.js +11 -10
  57. package/dist/components/panel/Panel.styles.js +5 -5
  58. package/dist/components/progress-ring/ProgressRing.js +70 -45
  59. package/dist/components/progress-ring/ProgressRing.styles.js +5 -5
  60. package/dist/components/spinner/Spinner.js +9 -9
  61. package/dist/components/spinner/Spinner.styles.js +5 -5
  62. package/dist/components/split-panel/SplitPanel.js +127 -66
  63. package/dist/components/split-panel/SplitPanel.styles.js +5 -5
  64. package/dist/components/split-panel/Splitter.js +29 -23
  65. package/dist/components/split-panel/Splitter.styles.js +5 -5
  66. package/dist/components/tooltip/Tooltip.js +115 -74
  67. package/dist/components/tooltip/Tooltip.styles.js +5 -5
  68. package/dist/index.js +18 -40
  69. package/dist/internals/attribute-converters.js +10 -8
  70. package/dist/internals/icons.js +41 -66
  71. package/dist/internals/node-helpers.js +16 -17
  72. package/dist/utilities/BrowserStorage.d.ts +43 -0
  73. package/dist/utilities/BrowserStorage.js +87 -0
  74. package/dist/utilities/decorators.js +19 -14
  75. package/dist/utilities/index.d.ts +1 -1
  76. package/dist/utilities/notifier.js +62 -20
  77. package/dist/utilities/theme.d.ts +38 -26
  78. package/dist/utilities/theme.js +110 -85
  79. package/package.json +2 -2
  80. package/dist/utilities/storage.d.ts +0 -60
  81. package/dist/utilities/storage.js +0 -120
@@ -1,46 +1,85 @@
1
- import { html as o, nothing as u } from "lit";
2
- import { query as c, state as p, property as s } from "lit/decorators.js";
3
- import { ifDefined as r } from "lit/directives/if-defined.js";
4
- import { live as y } from "lit/directives/live.js";
5
- import { BaseElement as v } from "../BaseElement.js";
6
- import { Icon as f } from "../icon/Icon.js";
7
- import { Tooltip as g } from "../tooltip/Tooltip.js";
8
- import { styles as m } from "./Input.styles.js";
9
- var $ = Object.defineProperty, t = (n, i, a, b) => {
10
- for (var l = void 0, h = n.length - 1, d; h >= 0; h--)
11
- (d = n[h]) && (l = d(i, a, l) || l);
12
- return l && $(i, a, l), l;
1
+ import { html, nothing } from 'lit';
2
+ import { query, state, property } from 'lit/decorators.js';
3
+ import { ifDefined } from 'lit/directives/if-defined.js';
4
+ import { live } from 'lit/directives/live.js';
5
+ import { BaseElement } from '../BaseElement.js';
6
+ import { Icon } from '../icon/Icon.js';
7
+ import { Tooltip } from '../tooltip/Tooltip.js';
8
+ import { styles } from './Input.styles.js';
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __decorateClass = (decorators, target, key, kind) => {
12
+ var result = void 0 ;
13
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
14
+ if (decorator = decorators[i])
15
+ result = (decorator(target, key, result) ) || result;
16
+ if (result) __defProp(target, key, result);
17
+ return result;
13
18
  };
14
- class e extends v {
19
+ class Input extends BaseElement {
15
20
  constructor() {
16
- super(...arguments), this.showPassword = !1, this.isInvalid = !1, this.currentValidationMessage = "", this.type = "text", this.required = !1, this.disabled = !1, this.clearable = !1, this.readonly = !1, this.spellcheck = !1, this.value = "", this.handleInput = (i) => {
17
- const a = i.target;
18
- this.value = a.value, this.isInvalid && (this.isInvalid = !1, this.currentValidationMessage = ""), this.emit("u-input", { value: this.value });
19
- }, this.handleChange = (i) => {
20
- const a = i.target;
21
- this.value = a.value, this.emit("u-change", { value: this.value });
22
- }, this.handleBlur = () => {
21
+ super(...arguments);
22
+ this.showPassword = false;
23
+ this.isInvalid = false;
24
+ this.currentValidationMessage = "";
25
+ this.type = "text";
26
+ this.required = false;
27
+ this.disabled = false;
28
+ this.clearable = false;
29
+ this.readonly = false;
30
+ this.spellcheck = false;
31
+ this.value = "";
32
+ /** input 이벤트 핸들러 */
33
+ this.handleInput = (e) => {
34
+ const input = e.target;
35
+ this.value = input.value;
36
+ if (this.isInvalid) {
37
+ this.isInvalid = false;
38
+ this.currentValidationMessage = "";
39
+ }
40
+ this.emit("u-input", { value: this.value });
41
+ };
42
+ /** change 이벤트 핸들러 */
43
+ this.handleChange = (e) => {
44
+ const input = e.target;
45
+ this.value = input.value;
46
+ this.emit("u-change", { value: this.value });
47
+ };
48
+ /** blur 이벤트 핸들러 */
49
+ this.handleBlur = () => {
23
50
  this.validate();
24
- }, this.handleClear = (i) => {
25
- i.stopPropagation(), this.clear();
26
- }, this.handlePasswordToggle = (i) => {
27
- i.stopPropagation(), this.showPassword = !this.showPassword, this.focus();
51
+ };
52
+ /** 클리어 버튼 클릭 핸들러 */
53
+ this.handleClear = (e) => {
54
+ e.stopPropagation();
55
+ this.clear();
56
+ };
57
+ /** 비밀번호 표시/숨김 토글 핸들러 */
58
+ this.handlePasswordToggle = (e) => {
59
+ e.stopPropagation();
60
+ this.showPassword = !this.showPassword;
61
+ this.focus();
28
62
  };
29
63
  }
30
64
  static {
31
- this.styles = [super.styles, m];
65
+ this.styles = [super.styles, styles];
32
66
  }
33
67
  static {
34
68
  this.dependencies = {
35
- "u-icon": f,
36
- "u-tooltip": g
69
+ "u-icon": Icon,
70
+ "u-tooltip": Tooltip
37
71
  };
38
72
  }
39
- updated(i) {
40
- super.updated(i), i.has("value") && this.input && this.input.value !== this.value && (this.input.value = this.value);
73
+ updated(changedProperties) {
74
+ super.updated(changedProperties);
75
+ if (changedProperties.has("value") && this.input) {
76
+ if (this.input.value !== this.value) {
77
+ this.input.value = this.value;
78
+ }
79
+ }
41
80
  }
42
81
  render() {
43
- return o`
82
+ return html`
44
83
  ${this.renderHeader()}
45
84
 
46
85
  <div class="container"
@@ -51,17 +90,17 @@ class e extends v {
51
90
 
52
91
  <input part="input"
53
92
  type=${this.type === "password" && this.showPassword ? "text" : this.type}
54
- name=${r(this.name)}
93
+ name=${ifDefined(this.name)}
55
94
  ?required=${this.required}
56
95
  ?disabled=${this.disabled}
57
96
  ?readonly=${this.readonly}
58
- placeholder=${r(this.placeholder)}
59
- minlength=${r(this.minlength)}
60
- maxlength=${r(this.maxlength)}
97
+ placeholder=${ifDefined(this.placeholder)}
98
+ minlength=${ifDefined(this.minlength)}
99
+ maxlength=${ifDefined(this.maxlength)}
61
100
  spellcheck=${this.spellcheck}
62
- autocomplete=${r(this.autocomplete)}
63
- pattern=${r(this.pattern)}
64
- .value=${y(this.value)}
101
+ autocomplete=${ifDefined(this.autocomplete)}
102
+ pattern=${ifDefined(this.pattern)}
103
+ .value=${live(this.value)}
65
104
  @input=${this.handleInput}
66
105
  @change=${this.handleChange}
67
106
  @blur=${this.handleBlur}
@@ -92,29 +131,40 @@ class e extends v {
92
131
  }
93
132
  /** 라벨 영역을 렌더링합니다. */
94
133
  renderHeader() {
95
- return this.label ? o`
134
+ if (!this.label) return nothing;
135
+ return html`
96
136
  <div class="header">
97
137
  <label class="label" @click=${this.focus}>
98
138
  ${this.label}
99
- ${this.required ? o`<span class="required-mark">*</span>` : ""}
139
+ ${this.required ? html`<span class="required-mark">*</span>` : ""}
100
140
  </label>
101
141
 
102
- ${this.labelhelp ? o`
142
+ ${this.labelhelp ? html`
103
143
  <u-icon class="help-icon" name="info-circle-fill"></u-icon>
104
144
  <u-tooltip trigger-selectors=".help-icon" placement="right-end">${this.labelhelp}</u-tooltip>
105
- ` : u}
145
+ ` : nothing}
106
146
  </div>
107
- ` : u;
147
+ `;
108
148
  }
109
149
  /** 유효성 검사를 수행합니다. */
110
150
  validate() {
111
- if (!this.input) return !0;
112
- const i = this.input.checkValidity();
113
- return this.isInvalid = !i, i ? this.currentValidationMessage = "" : this.currentValidationMessage = this.validationMessage || this.input.validationMessage, i;
151
+ if (!this.input) return true;
152
+ const isValid = this.input.checkValidity();
153
+ this.isInvalid = !isValid;
154
+ if (!isValid) {
155
+ this.currentValidationMessage = this.validationMessage || this.input.validationMessage;
156
+ } else {
157
+ this.currentValidationMessage = "";
158
+ }
159
+ return isValid;
114
160
  }
115
161
  /** 입력값을 초기화합니다. */
116
162
  clear() {
117
- this.value = "", this.isInvalid = !1, this.currentValidationMessage = "", this.focus(), this.emit("u-clear");
163
+ this.value = "";
164
+ this.isInvalid = false;
165
+ this.currentValidationMessage = "";
166
+ this.focus();
167
+ this.emit("u-clear");
118
168
  }
119
169
  /** 입력 필드에 포커스를 설정합니다. */
120
170
  focus() {
@@ -125,69 +175,68 @@ class e extends v {
125
175
  this.input?.blur();
126
176
  }
127
177
  }
128
- t([
129
- c("input")
130
- ], e.prototype, "input");
131
- t([
132
- p()
133
- ], e.prototype, "showPassword");
134
- t([
135
- p()
136
- ], e.prototype, "isInvalid");
137
- t([
138
- p()
139
- ], e.prototype, "currentValidationMessage");
140
- t([
141
- s({ type: String, reflect: !0 })
142
- ], e.prototype, "type");
143
- t([
144
- s({ type: Boolean, reflect: !0 })
145
- ], e.prototype, "required");
146
- t([
147
- s({ type: Boolean, reflect: !0 })
148
- ], e.prototype, "disabled");
149
- t([
150
- s({ type: Boolean, reflect: !0 })
151
- ], e.prototype, "clearable");
152
- t([
153
- s({ type: Boolean, reflect: !0 })
154
- ], e.prototype, "readonly");
155
- t([
156
- s({ type: String })
157
- ], e.prototype, "name");
158
- t([
159
- s({ type: String })
160
- ], e.prototype, "label");
161
- t([
162
- s({ type: String })
163
- ], e.prototype, "labelhelp");
164
- t([
165
- s({ type: String })
166
- ], e.prototype, "placeholder");
167
- t([
168
- s({ type: String })
169
- ], e.prototype, "description");
170
- t([
171
- s({ type: Number })
172
- ], e.prototype, "minlength");
173
- t([
174
- s({ type: Number })
175
- ], e.prototype, "maxlength");
176
- t([
177
- s({ type: Boolean })
178
- ], e.prototype, "spellcheck");
179
- t([
180
- s({ type: String })
181
- ], e.prototype, "autocomplete");
182
- t([
183
- s({ type: String })
184
- ], e.prototype, "value");
185
- t([
186
- s({ type: String })
187
- ], e.prototype, "pattern");
188
- t([
189
- s({ type: String })
190
- ], e.prototype, "validationMessage");
191
- export {
192
- e as Input
193
- };
178
+ __decorateClass([
179
+ query("input")
180
+ ], Input.prototype, "input");
181
+ __decorateClass([
182
+ state()
183
+ ], Input.prototype, "showPassword");
184
+ __decorateClass([
185
+ state()
186
+ ], Input.prototype, "isInvalid");
187
+ __decorateClass([
188
+ state()
189
+ ], Input.prototype, "currentValidationMessage");
190
+ __decorateClass([
191
+ property({ type: String, reflect: true })
192
+ ], Input.prototype, "type");
193
+ __decorateClass([
194
+ property({ type: Boolean, reflect: true })
195
+ ], Input.prototype, "required");
196
+ __decorateClass([
197
+ property({ type: Boolean, reflect: true })
198
+ ], Input.prototype, "disabled");
199
+ __decorateClass([
200
+ property({ type: Boolean, reflect: true })
201
+ ], Input.prototype, "clearable");
202
+ __decorateClass([
203
+ property({ type: Boolean, reflect: true })
204
+ ], Input.prototype, "readonly");
205
+ __decorateClass([
206
+ property({ type: String })
207
+ ], Input.prototype, "name");
208
+ __decorateClass([
209
+ property({ type: String })
210
+ ], Input.prototype, "label");
211
+ __decorateClass([
212
+ property({ type: String })
213
+ ], Input.prototype, "labelhelp");
214
+ __decorateClass([
215
+ property({ type: String })
216
+ ], Input.prototype, "placeholder");
217
+ __decorateClass([
218
+ property({ type: String })
219
+ ], Input.prototype, "description");
220
+ __decorateClass([
221
+ property({ type: Number })
222
+ ], Input.prototype, "minlength");
223
+ __decorateClass([
224
+ property({ type: Number })
225
+ ], Input.prototype, "maxlength");
226
+ __decorateClass([
227
+ property({ type: Boolean })
228
+ ], Input.prototype, "spellcheck");
229
+ __decorateClass([
230
+ property({ type: String })
231
+ ], Input.prototype, "autocomplete");
232
+ __decorateClass([
233
+ property({ type: String })
234
+ ], Input.prototype, "value");
235
+ __decorateClass([
236
+ property({ type: String })
237
+ ], Input.prototype, "pattern");
238
+ __decorateClass([
239
+ property({ type: String })
240
+ ], Input.prototype, "validationMessage");
241
+
242
+ export { Input };
@@ -1,5 +1,6 @@
1
- import { css as o } from "lit";
2
- const r = o`
1
+ import { css } from 'lit';
2
+
3
+ const styles = css`
3
4
  :host {
4
5
  display: inline-block;
5
6
  font-size: inherit;
@@ -144,6 +145,5 @@ const r = o`
144
145
  margin: 0;
145
146
  }
146
147
  `;
147
- export {
148
- r as styles
149
- };
148
+
149
+ export { styles };
@@ -1,103 +1,153 @@
1
- import { html as c } from "lit";
2
- import { queryAssignedElements as u, property as o } from "lit/decorators.js";
3
- import { BaseElement as d } from "../BaseElement.js";
4
- import { MenuItem as p } from "../menu-item/MenuItem.js";
5
- import { styles as m } from "./Menu.styles.js";
6
- var f = Object.defineProperty, i = (r, e, t, n) => {
7
- for (var s = void 0, a = r.length - 1, h; a >= 0; a--)
8
- (h = r[a]) && (s = h(e, t, s) || s);
9
- return s && f(e, t, s), s;
1
+ import { html } from 'lit';
2
+ import { queryAssignedElements, property } from 'lit/decorators.js';
3
+ import { BaseElement } from '../BaseElement.js';
4
+ import { MenuItem } from '../menu-item/MenuItem.js';
5
+ import { styles } from './Menu.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;
10
15
  };
11
- class l extends d {
16
+ class Menu extends BaseElement {
12
17
  constructor() {
13
- super(...arguments), this.open = !1, this.selectable = !1, this.value = "", this.show = async () => {
14
- await this.updateComplete, requestAnimationFrame(() => {
15
- this.open = !0;
18
+ super(...arguments);
19
+ this.open = false;
20
+ this.selectable = false;
21
+ this.value = "";
22
+ /** 메뉴를 표시합니다. */
23
+ this.show = async () => {
24
+ await this.updateComplete;
25
+ requestAnimationFrame(() => {
26
+ this.open = true;
16
27
  });
17
- }, this.hide = async () => {
18
- await this.updateComplete, requestAnimationFrame(() => {
19
- this.open = !1;
28
+ };
29
+ /** 메뉴를 숨깁니다. */
30
+ this.hide = async () => {
31
+ await this.updateComplete;
32
+ requestAnimationFrame(() => {
33
+ this.open = false;
20
34
  });
21
- }, this.handleSlotChange = () => {
22
- this.selectable && this.value && this.updateSelection();
23
- }, this.handleSelect = (e) => {
24
- const t = e, n = e.target;
25
- this.selectable && n && (this.value = n.value || t.detail?.value || "", this.updateSelection());
26
- }, this.handleKeydown = (e) => {
27
- const t = this.items.filter((a) => !a.disabled);
28
- if (t.length === 0) return;
29
- const n = t.findIndex((a) => a === e.target);
30
- let s = n;
35
+ };
36
+ /** 슬롯 변경 이벤트를 처리합니다. */
37
+ this.handleSlotChange = () => {
38
+ if (this.selectable && this.value) {
39
+ this.updateSelection();
40
+ }
41
+ };
42
+ /** 메뉴 항목 선택 이벤트를 처리합니다. */
43
+ this.handleSelect = (e) => {
44
+ const event = e;
45
+ const menuItem = e.target;
46
+ if (this.selectable && menuItem) {
47
+ this.value = menuItem.value || event.detail?.value || "";
48
+ this.updateSelection();
49
+ }
50
+ };
51
+ /** 키보드 네비게이션을 처리합니다. */
52
+ this.handleKeydown = (e) => {
53
+ const items = this.items.filter((item) => !item.disabled);
54
+ if (items.length === 0) return;
55
+ const currentIndex = items.findIndex((item) => item === e.target);
56
+ let nextIndex = currentIndex;
31
57
  switch (e.key) {
32
58
  case "ArrowDown":
33
- e.preventDefault(), s = (n + 1) % t.length, t[s].focus();
59
+ e.preventDefault();
60
+ nextIndex = (currentIndex + 1) % items.length;
61
+ items[nextIndex].focus();
34
62
  break;
35
63
  case "ArrowUp":
36
- e.preventDefault(), s = n - 1 < 0 ? t.length - 1 : n - 1, t[s].focus();
64
+ e.preventDefault();
65
+ nextIndex = currentIndex - 1 < 0 ? items.length - 1 : currentIndex - 1;
66
+ items[nextIndex].focus();
37
67
  break;
38
68
  case "Home":
39
- e.preventDefault(), t[0].focus();
69
+ e.preventDefault();
70
+ items[0].focus();
40
71
  break;
41
72
  case "End":
42
- e.preventDefault(), t[t.length - 1].focus();
73
+ e.preventDefault();
74
+ items[items.length - 1].focus();
43
75
  break;
44
76
  case "Enter":
45
77
  case " ":
46
- e.preventDefault(), n >= 0 && t[n].click();
78
+ e.preventDefault();
79
+ if (currentIndex >= 0) {
80
+ items[currentIndex].click();
81
+ }
47
82
  break;
48
83
  case "Escape":
49
- e.preventDefault(), this.hide();
84
+ e.preventDefault();
85
+ this.hide();
50
86
  break;
51
87
  }
52
88
  };
53
89
  }
54
90
  static {
55
- this.styles = [super.styles, m];
91
+ this.styles = [super.styles, styles];
56
92
  }
57
93
  static {
58
94
  this.dependencies = {
59
- "u-menu-item": p
95
+ "u-menu-item": MenuItem
60
96
  };
61
97
  }
62
98
  connectedCallback() {
63
- super.connectedCallback(), this.setAttribute("role", "menu"), this.addEventListener("u-select", this.handleSelect), this.addEventListener("keydown", this.handleKeydown);
99
+ super.connectedCallback();
100
+ this.setAttribute("role", "menu");
101
+ this.addEventListener("u-select", this.handleSelect);
102
+ this.addEventListener("keydown", this.handleKeydown);
64
103
  }
65
104
  disconnectedCallback() {
66
- this.removeEventListener("u-select", this.handleSelect), this.removeEventListener("keydown", this.handleKeydown), super.disconnectedCallback();
105
+ this.removeEventListener("u-select", this.handleSelect);
106
+ this.removeEventListener("keydown", this.handleKeydown);
107
+ super.disconnectedCallback();
67
108
  }
68
- updated(e) {
69
- super.updated(e), e.has("value") && this.selectable && this.updateSelection(), e.has("open") && this.updateOpenState(this.open);
109
+ updated(changedProperties) {
110
+ super.updated(changedProperties);
111
+ if (changedProperties.has("value") && this.selectable) {
112
+ this.updateSelection();
113
+ }
114
+ if (changedProperties.has("open")) {
115
+ this.updateOpenState(this.open);
116
+ }
70
117
  }
71
118
  render() {
72
- return c`
119
+ return html`
73
120
  <div class="container">
74
121
  <slot @slotchange=${this.handleSlotChange}></slot>
75
122
  </div>
76
123
  `;
77
124
  }
78
125
  /** open 상태가 변경될 때 호출됩니다. */
79
- updateOpenState(e) {
80
- e ? this.emit("u-show") : this.emit("u-hide");
126
+ updateOpenState(open) {
127
+ if (open) {
128
+ this.emit("u-show");
129
+ } else {
130
+ this.emit("u-hide");
131
+ }
81
132
  }
82
133
  /** 선택 상태를 업데이트합니다. */
83
134
  updateSelection() {
84
- this.items.forEach((e) => {
85
- e.selected = e.value === this.value;
135
+ this.items.forEach((item) => {
136
+ item.selected = item.value === this.value;
86
137
  });
87
138
  }
88
139
  }
89
- i([
90
- u({ selector: "u-menu-item" })
91
- ], l.prototype, "items");
92
- i([
93
- o({ type: Boolean, reflect: !0 })
94
- ], l.prototype, "open");
95
- i([
96
- o({ type: Boolean })
97
- ], l.prototype, "selectable");
98
- i([
99
- o({ type: String })
100
- ], l.prototype, "value");
101
- export {
102
- l as Menu
103
- };
140
+ __decorateClass([
141
+ queryAssignedElements({ selector: "u-menu-item" })
142
+ ], Menu.prototype, "items");
143
+ __decorateClass([
144
+ property({ type: Boolean, reflect: true })
145
+ ], Menu.prototype, "open");
146
+ __decorateClass([
147
+ property({ type: Boolean })
148
+ ], Menu.prototype, "selectable");
149
+ __decorateClass([
150
+ property({ type: String })
151
+ ], Menu.prototype, "value");
152
+
153
+ export { Menu };
@@ -1,5 +1,6 @@
1
- import { css as o } from "lit";
2
- const t = o`
1
+ import { css } from 'lit';
2
+
3
+ const styles = css`
3
4
  :host {
4
5
  display: block;
5
6
  width: max-content;
@@ -28,6 +29,5 @@ const t = o`
28
29
  overflow: auto;
29
30
  }
30
31
  `;
31
- export {
32
- t as styles
33
- };
32
+
33
+ export { styles };