@iyulab/components 0.1.11 → 0.2.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 (64) hide show
  1. package/CHANGELOG.md +49 -3
  2. package/dist/assets/icons/arrow-repeat.svg.js +3 -0
  3. package/dist/assets/icons/box-arrow-up-right.svg.js +3 -0
  4. package/dist/assets/icons/file-earmark.svg.js +3 -0
  5. package/dist/assets/icons/flag.svg.js +3 -0
  6. package/dist/assets/icons/globe.svg.js +3 -0
  7. package/dist/assets/icons/hand-thumbs-down-fill.svg.js +3 -0
  8. package/dist/assets/icons/hand-thumbs-down.svg.js +3 -0
  9. package/dist/assets/icons/hand-thumbs-up-fill.svg.js +3 -0
  10. package/dist/assets/icons/hand-thumbs-up.svg.js +3 -0
  11. package/dist/assets/icons/share.svg.js +3 -0
  12. package/dist/assets/icons/stop-circle.svg.js +3 -0
  13. package/dist/assets/icons/tools.svg.js +3 -0
  14. package/dist/components/FloatingElement.d.ts +13 -5
  15. package/dist/components/FloatingElement.js +31 -14
  16. package/dist/components/button/UButton.component.d.ts +7 -0
  17. package/dist/components/button/UButton.component.js +20 -1
  18. package/dist/components/button/UButton.styles.js +51 -8
  19. package/dist/components/dialog/UDialog.component.d.ts +2 -0
  20. package/dist/components/dialog/UDialog.component.js +14 -9
  21. package/dist/components/drawer/UDrawer.component.d.ts +2 -0
  22. package/dist/components/drawer/UDrawer.component.js +14 -9
  23. package/dist/components/form/UForm.component.js +3 -3
  24. package/dist/components/icon/UIcon.component.js +2 -2
  25. package/dist/components/menu/UMenu.component.js +53 -41
  26. package/dist/components/menu-item/UMenuItem.component.d.ts +2 -2
  27. package/dist/components/menu-item/UMenuItem.component.js +1 -2
  28. package/dist/components/split-panel/USplitPanel.component.js +4 -4
  29. package/dist/components/tag/UTag.component.d.ts +23 -0
  30. package/dist/components/tag/UTag.component.js +72 -0
  31. package/dist/components/tag/UTag.d.ts +8 -0
  32. package/dist/components/tag/UTag.js +5 -0
  33. package/dist/components/tag/UTag.styles.js +83 -0
  34. package/dist/components/tooltip/UTooltip.component.d.ts +8 -0
  35. package/dist/components/tooltip/UTooltip.component.js +59 -17
  36. package/dist/components/tooltip/UTooltip.styles.js +15 -0
  37. package/dist/index.d.ts +4 -3
  38. package/dist/index.js +5 -4
  39. package/dist/react-components/UTag.d.ts +8 -0
  40. package/dist/react-components/UTag.js +10 -0
  41. package/dist/react-components/index.d.ts +1 -1
  42. package/dist/react-components/index.js +1 -1
  43. package/dist/utilities/{icons.d.ts → IconRegistry.d.ts} +20 -26
  44. package/dist/utilities/{icons.js → IconRegistry.js} +29 -20
  45. package/dist/utilities/{notifier.d.ts → Notifier.d.ts} +8 -13
  46. package/dist/utilities/{notifier.js → Notifier.js} +8 -10
  47. package/dist/utilities/{theme.d.ts → Theme.d.ts} +13 -18
  48. package/dist/utilities/{theme.js → Theme.js} +39 -35
  49. package/dist/{internals/attribute-converters.d.ts → utilities/converters.d.ts} +1 -1
  50. package/dist/{internals/attribute-converters.js → utilities/converters.js} +2 -2
  51. package/dist/{internals/node-helpers.js → utilities/elements.js} +6 -5
  52. package/package.json +6 -6
  53. package/dist/assets/icons/arrow-clockwise.svg.js +0 -3
  54. package/dist/assets/icons/speedometer.svg.js +0 -3
  55. package/dist/components/icon-button/UIconButton.component.d.ts +0 -20
  56. package/dist/components/icon-button/UIconButton.component.js +0 -59
  57. package/dist/components/icon-button/UIconButton.d.ts +0 -7
  58. package/dist/components/icon-button/UIconButton.js +0 -5
  59. package/dist/components/icon-button/UIconButton.styles.js +0 -54
  60. package/dist/internals/react-wrapper.d.ts +0 -21
  61. package/dist/react-components/UIconButton.d.ts +0 -8
  62. package/dist/react-components/UIconButton.js +0 -10
  63. /package/dist/components/{icon-button/UIconButton.styles.d.ts → tag/UTag.styles.d.ts} +0 -0
  64. /package/dist/{internals/node-helpers.d.ts → utilities/elements.d.ts} +0 -0
@@ -94,14 +94,16 @@ class UMenu extends FloatingElement {
94
94
  e.preventDefault();
95
95
  e.stopPropagation();
96
96
  await this.hide();
97
- this.anchor?.focus();
97
+ if (this.target instanceof HTMLElement) {
98
+ this.target.focus();
99
+ }
98
100
  }
99
101
  break;
100
102
  case "ArrowRight":
101
103
  if (item.submenu) {
102
104
  e.preventDefault();
103
105
  e.stopPropagation();
104
- await item.submenu.show();
106
+ await item.submenu.show(item);
105
107
  await item.submenu.focusAt(0);
106
108
  }
107
109
  break;
@@ -125,11 +127,11 @@ class UMenu extends FloatingElement {
125
127
  }
126
128
  await this.hide();
127
129
  } else if (this.type === "dropdown") {
128
- const anchor = this.anchor;
129
- if (!anchor) return;
130
+ const currentTarget = this.target;
131
+ if (!currentTarget || !(currentTarget instanceof HTMLElement)) return;
130
132
  const targets = e.composedPath().filter((v) => v instanceof HTMLElement);
131
133
  for (const target of targets) {
132
- if (this.contains(target) || anchor.contains(target)) return;
134
+ if (this.contains(target) || currentTarget.contains(target)) return;
133
135
  }
134
136
  await this.hide();
135
137
  }
@@ -138,16 +140,18 @@ class UMenu extends FloatingElement {
138
140
  //#region 'dropdown' 이벤트 핸들러
139
141
  this.handleAnchorPointerDown = async (e) => {
140
142
  if (e.button !== 0) return;
141
- if (this.visible)
143
+ const target = e.currentTarget;
144
+ if (this.visible && this.target === target)
142
145
  await this.hide();
143
146
  else
144
- await this.show();
147
+ await this.show(target);
145
148
  };
146
149
  this.handleAnchorKeydown = async (e) => {
147
150
  if (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") {
148
151
  e.preventDefault();
152
+ const target = e.currentTarget;
149
153
  if (this.visible) return;
150
- await this.show();
154
+ await this.show(target);
151
155
  }
152
156
  };
153
157
  //#endregion
@@ -171,29 +175,29 @@ class UMenu extends FloatingElement {
171
175
  };
172
176
  //#endregion
173
177
  //#region 'submenu' 이벤트 핸들러
174
- this.handleSubmenuAnchorPointerEnter = () => {
175
- const anchor = this.anchor;
176
- if (anchor?.disabled) return;
177
- this.show();
178
+ this.handleSubmenuAnchorPointerEnter = (e) => {
179
+ const target = e.currentTarget;
180
+ if (target?.disabled) return;
181
+ this.show(target);
178
182
  };
179
183
  this.handleSubmenuAnchorPointerLeave = (e) => {
180
184
  const related = e.relatedTarget;
181
185
  if (related) {
182
- const anchor = this.anchor;
183
- if (anchor?.contains(related) || this.contains(related)) return;
186
+ const target = this.target;
187
+ if (target?.contains(related) || this.contains(related)) return;
184
188
  }
185
189
  this.hide();
186
190
  };
187
- this.handleSubmenuAnchorFocusIn = () => {
188
- const anchor = this.anchor;
189
- if (anchor?.disabled) return;
190
- this.show();
191
+ this.handleSubmenuAnchorFocusIn = (e) => {
192
+ const target = e.currentTarget;
193
+ if (target?.disabled) return;
194
+ this.show(target);
191
195
  };
192
196
  this.handleSubmenuAnchorFocusOut = (e) => {
193
197
  const related = e.relatedTarget;
194
198
  if (related) {
195
- const anchor = this.anchor;
196
- if (anchor?.contains(related) || this.contains(related)) return;
199
+ const target = this.target;
200
+ if (target?.contains(related) || this.contains(related)) return;
197
201
  }
198
202
  this.hide();
199
203
  };
@@ -216,13 +220,13 @@ class UMenu extends FloatingElement {
216
220
  }
217
221
  willUpdate(changedProperties) {
218
222
  super.willUpdate(changedProperties);
219
- if (changedProperties.has("anchor") || changedProperties.has("type")) {
223
+ if (changedProperties.has("anchors") || changedProperties.has("type")) {
220
224
  const oldType = changedProperties.get("type") || "default";
221
225
  const newType = this.type || "default";
222
- const oldAnchor = changedProperties.get("anchor");
223
- const newAnchor = this.anchor;
224
- if (oldAnchor) this.unbind(oldType, oldAnchor);
225
- if (newAnchor) this.bind(newType, newAnchor);
226
+ const oldAnchors = changedProperties.get("anchors");
227
+ const newAnchors = this.anchors;
228
+ if (oldAnchors) this.unbind(oldType, oldAnchors);
229
+ if (newAnchors) this.bind(newType, newAnchors);
226
230
  }
227
231
  if (changedProperties.has("mode")) {
228
232
  this.clearAll();
@@ -273,23 +277,29 @@ class UMenu extends FloatingElement {
273
277
  }
274
278
  }
275
279
  /** 앵커에 이벤트 바인딩 */
276
- bind(type, target) {
280
+ bind(type, anchors) {
277
281
  if (type === "dropdown") {
278
282
  this.visible = false;
279
283
  this.placement ||= "bottom-start";
280
- target.addEventListener("pointerdown", this.handleAnchorPointerDown);
281
- target.addEventListener("keydown", this.handleAnchorKeydown);
284
+ for (const anchor of anchors) {
285
+ anchor.addEventListener("pointerdown", this.handleAnchorPointerDown);
286
+ anchor.addEventListener("keydown", this.handleAnchorKeydown);
287
+ }
282
288
  } else if (type === "contextmenu") {
283
289
  this.visible = false;
284
290
  this.placement ||= "bottom-start";
285
- target.addEventListener("contextmenu", this.handleAnchorContextMenu);
291
+ for (const anchor of anchors) {
292
+ anchor.addEventListener("contextmenu", this.handleAnchorContextMenu);
293
+ }
286
294
  } else if (type === "submenu") {
287
295
  this.visible = false;
288
296
  this.placement ||= "right-start";
289
- target.addEventListener("pointerenter", this.handleSubmenuAnchorPointerEnter);
290
- target.addEventListener("pointerleave", this.handleSubmenuAnchorPointerLeave);
291
- target.addEventListener("focusin", this.handleSubmenuAnchorFocusIn);
292
- target.addEventListener("focusout", this.handleSubmenuAnchorFocusOut);
297
+ for (const anchor of anchors) {
298
+ anchor.addEventListener("pointerenter", this.handleSubmenuAnchorPointerEnter);
299
+ anchor.addEventListener("pointerleave", this.handleSubmenuAnchorPointerLeave);
300
+ anchor.addEventListener("focusin", this.handleSubmenuAnchorFocusIn);
301
+ anchor.addEventListener("focusout", this.handleSubmenuAnchorFocusOut);
302
+ }
293
303
  } else {
294
304
  this.visible = true;
295
305
  return;
@@ -299,17 +309,19 @@ class UMenu extends FloatingElement {
299
309
  window.addEventListener("pointerdown", this.handleWindowPointerDown);
300
310
  }
301
311
  /** 앵커에서 이벤트 바인딩 해제 */
302
- unbind(_, target) {
312
+ unbind(_, anchors) {
303
313
  window.removeEventListener("focusout", this.handleWindowFocusOut);
304
314
  window.removeEventListener("keydown", this.handleWindowKeydown);
305
315
  window.removeEventListener("pointerdown", this.handleWindowPointerDown);
306
- target.removeEventListener("pointerdown", this.handleAnchorPointerDown);
307
- target.removeEventListener("keydown", this.handleAnchorKeydown);
308
- target.removeEventListener("contextmenu", this.handleAnchorContextMenu);
309
- target.removeEventListener("pointerenter", this.handleSubmenuAnchorPointerEnter);
310
- target.removeEventListener("pointerleave", this.handleSubmenuAnchorPointerLeave);
311
- target.removeEventListener("focusin", this.handleSubmenuAnchorFocusIn);
312
- target.removeEventListener("focusout", this.handleSubmenuAnchorFocusOut);
316
+ for (const anchor of anchors) {
317
+ anchor.removeEventListener("pointerdown", this.handleAnchorPointerDown);
318
+ anchor.removeEventListener("keydown", this.handleAnchorKeydown);
319
+ anchor.removeEventListener("contextmenu", this.handleAnchorContextMenu);
320
+ anchor.removeEventListener("pointerenter", this.handleSubmenuAnchorPointerEnter);
321
+ anchor.removeEventListener("pointerleave", this.handleSubmenuAnchorPointerLeave);
322
+ anchor.removeEventListener("focusin", this.handleSubmenuAnchorFocusIn);
323
+ anchor.removeEventListener("focusout", this.handleSubmenuAnchorFocusOut);
324
+ }
313
325
  }
314
326
  //#endregion
315
327
  }
@@ -14,8 +14,8 @@ export declare class UMenuItem extends BaseElement {
14
14
  checked: boolean;
15
15
  /** 선택 여부(single mode) @default false */
16
16
  selected: boolean;
17
- /** 값 */
18
- value: string;
17
+ /** 메뉴 아이템 값 */
18
+ value?: string;
19
19
  protected updated(changedProperties: PropertyValues): void;
20
20
  render(): import('lit-html').TemplateResult<1>;
21
21
  /** 기본 슬롯 변경 감지 */
@@ -23,7 +23,6 @@ class UMenuItem extends BaseElement {
23
23
  this.loading = false;
24
24
  this.checked = false;
25
25
  this.selected = false;
26
- this.value = "";
27
26
  /** 기본 슬롯 변경 감지 */
28
27
  this.handleSlotChange = (e) => {
29
28
  const slot = e.target;
@@ -38,7 +37,7 @@ class UMenuItem extends BaseElement {
38
37
  const menu = elements.find((el) => el instanceof UMenu);
39
38
  if (menu) {
40
39
  menu.type = "submenu";
41
- menu.anchor = this;
40
+ menu.anchors = [this];
42
41
  this.submenu = menu;
43
42
  } else {
44
43
  this.submenu = null;
@@ -1,6 +1,6 @@
1
1
  import { html } from 'lit';
2
2
  import { queryAssignedElements, state, property } from 'lit/decorators.js';
3
- import { arrayAttributeConverter } from '../../internals/attribute-converters.js';
3
+ import { arrayAttrConverter } from '../../utilities/converters.js';
4
4
  import { BaseElement } from '../BaseElement.js';
5
5
  import { styles } from './USplitPanel.styles.js';
6
6
 
@@ -173,13 +173,13 @@ __decorateClass([
173
173
  property({ type: String, reflect: true })
174
174
  ], USplitPanel.prototype, "orientation");
175
175
  __decorateClass([
176
- property({ type: Array, attribute: "init-ratio", converter: arrayAttributeConverter(parseFloat) })
176
+ property({ type: Array, attribute: "init-ratio", converter: arrayAttrConverter(parseFloat) })
177
177
  ], USplitPanel.prototype, "initRatio");
178
178
  __decorateClass([
179
- property({ type: Array, attribute: "min-sizes", converter: arrayAttributeConverter(parseFloat) })
179
+ property({ type: Array, attribute: "min-sizes", converter: arrayAttrConverter(parseFloat) })
180
180
  ], USplitPanel.prototype, "minSizes");
181
181
  __decorateClass([
182
- property({ type: Array, attribute: "max-sizes", converter: arrayAttributeConverter(parseFloat) })
182
+ property({ type: Array, attribute: "max-sizes", converter: arrayAttrConverter(parseFloat) })
183
183
  ], USplitPanel.prototype, "maxSizes");
184
184
 
185
185
  export { USplitPanel };
@@ -0,0 +1,23 @@
1
+ import { BaseElement } from '../BaseElement.js';
2
+ export type TagVariant = "default" | "info" | "success" | "warning" | "danger";
3
+ /**
4
+ * Tag 컴포넌트는 레이블, 카테고리, 상태 등을 표시하는데 사용됩니다.
5
+ * @slot - 태그 내부에 표시할 콘텐츠를 삽입합니다.
6
+ * @slot prefix - 태그의 접두사로 표시할 콘텐츠를 삽입합니다.
7
+ * @slot suffix - 태그의 접미사로 표시할 콘텐츠를 삽입합니다.
8
+ */
9
+ export declare class UTag extends BaseElement {
10
+ static styles: import('lit').CSSResultGroup[];
11
+ static dependencies: Record<string, typeof BaseElement>;
12
+ /** 태그의 스타일 변형을 설정합니다. */
13
+ variant: TagVariant;
14
+ /** 태그를 둥글게 표시합니다. */
15
+ rounded: boolean;
16
+ /** 태그를 제거 가능하게 설정합니다. */
17
+ removable: boolean;
18
+ connectedCallback(): void;
19
+ disconnectedCallback(): void;
20
+ render(): import('lit-html').TemplateResult<1>;
21
+ private handleRemoveButtonClick;
22
+ private handleTransitionEnd;
23
+ }
@@ -0,0 +1,72 @@
1
+ import { html } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { BaseElement } from '../BaseElement.js';
4
+ import { styles } from './UTag.styles.js';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = void 0 ;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = (decorator(target, key, result) ) || result;
12
+ if (result) __defProp(target, key, result);
13
+ return result;
14
+ };
15
+ class UTag extends BaseElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.variant = "default";
19
+ this.rounded = false;
20
+ this.removable = false;
21
+ this.handleRemoveButtonClick = (e) => {
22
+ e.stopPropagation();
23
+ this.emit("u-remove");
24
+ requestAnimationFrame(() => {
25
+ this.style.transform = "scale(0.8)";
26
+ this.style.opacity = "0";
27
+ });
28
+ };
29
+ this.handleTransitionEnd = (e) => {
30
+ if (e.propertyName === "opacity" && this.style.opacity === "0") {
31
+ this.remove();
32
+ }
33
+ };
34
+ }
35
+ static {
36
+ this.styles = [super.styles, styles];
37
+ }
38
+ static {
39
+ this.dependencies = {};
40
+ }
41
+ connectedCallback() {
42
+ super.connectedCallback();
43
+ this.addEventListener("transitionend", this.handleTransitionEnd);
44
+ }
45
+ disconnectedCallback() {
46
+ this.removeEventListener("transitionend", this.handleTransitionEnd);
47
+ super.disconnectedCallback();
48
+ }
49
+ render() {
50
+ return html`
51
+ <slot name="prefix"></slot>
52
+ <slot></slot>
53
+ <slot name="suffix"></slot>
54
+ <button class="remove-btn" part="remove-btn"
55
+ ?hidden=${!this.removable}
56
+ @click=${this.handleRemoveButtonClick}>
57
+ &times;
58
+ </button>
59
+ `;
60
+ }
61
+ }
62
+ __decorateClass([
63
+ property({ type: String, reflect: true })
64
+ ], UTag.prototype, "variant");
65
+ __decorateClass([
66
+ property({ type: Boolean, reflect: true })
67
+ ], UTag.prototype, "rounded");
68
+ __decorateClass([
69
+ property({ type: Boolean, reflect: true })
70
+ ], UTag.prototype, "removable");
71
+
72
+ export { UTag };
@@ -0,0 +1,8 @@
1
+ import { UTag } from './UTag.component.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'u-tag': UTag;
5
+ }
6
+ }
7
+ export { UTag };
8
+ export type { TagVariant } from './UTag.component.js';
@@ -0,0 +1,5 @@
1
+ import { UTag } from './UTag.component.js';
2
+
3
+ UTag.define("u-tag");
4
+
5
+ export { UTag };
@@ -0,0 +1,83 @@
1
+ import { css } from 'lit';
2
+
3
+ const styles = css`
4
+ :host {
5
+ display: inline-flex;
6
+ align-items: center;
7
+ gap: 4px;
8
+ font-size: 12px;
9
+ padding: 0.25em 0.5em;
10
+ border-radius: 4px;
11
+ font-weight: 500;
12
+ line-height: 1.5em;
13
+ white-space: nowrap;
14
+ user-select: none;
15
+ opacity: 1;
16
+ transform: scale(1);
17
+ transition: opacity 0.2s ease, transform 0.2s ease;
18
+ }
19
+ /* Style variants */
20
+ :host([variant="default"]) {
21
+ color: var(--u-neutral-800);
22
+ border: 1px solid var(--u-neutral-300);
23
+ background-color: var(--u-neutral-100);
24
+ }
25
+ :host([variant="info"]) {
26
+ color: var(--u-blue-800);
27
+ border: 1px solid var(--u-blue-300);
28
+ background-color: var(--u-blue-100);
29
+ }
30
+ :host([variant="success"]) {
31
+ color: var(--u-green-800);
32
+ border: 1px solid var(--u-green-300);
33
+ background-color: var(--u-green-100);
34
+ }
35
+ :host([variant="warning"]) {
36
+ color: var(--u-yellow-800);
37
+ border: 1px solid var(--u-yellow-300);
38
+ background-color: var(--u-yellow-100);
39
+ }
40
+ :host([variant="danger"]) {
41
+ color: var(--u-red-800);
42
+ border: 1px solid var(--u-red-300);
43
+ background-color: var(--u-red-100);
44
+ }
45
+ /* Rounded variant */
46
+ :host([rounded]) {
47
+ border-radius: 999px;
48
+ }
49
+
50
+ /* Slot styles */
51
+ ::slotted([slot="prefix"]) {
52
+ margin-right: 0.2em;
53
+ }
54
+ ::slotted([slot="suffix"]) {
55
+ margin-left: 0.2em;
56
+ }
57
+
58
+ /* Remove button */
59
+ .remove-btn {
60
+ display: inline-flex;
61
+ align-items: center;
62
+ justify-content: center;
63
+ font-size: 1.5em;
64
+ width: 1em;
65
+ height: 1em;
66
+ line-height: 1.2em;
67
+ padding: 0;
68
+ border: none;
69
+ border-radius: 50%;
70
+ color: currentColor;
71
+ background-color: transparent;
72
+ transition: background-color 0.2s ease;
73
+ cursor: pointer;
74
+ }
75
+ .remove-btn:hover {
76
+ background-color: rgba(0, 0, 0, 0.1);
77
+ }
78
+ .remove-btn:active {
79
+ background-color: rgba(0, 0, 0, 0.2);
80
+ }
81
+ `;
82
+
83
+ export { styles };
@@ -7,10 +7,18 @@ import { FloatingElement } from '../FloatingElement.js';
7
7
  export declare class UTooltip extends FloatingElement {
8
8
  static styles: import('lit').CSSResultGroup[];
9
9
  static dependencies: Record<string, typeof BaseElement>;
10
+ /**
11
+ * 툴팁 내부로 마우스를 이동해도 툴팁이 유지되는지 여부입니다.
12
+ * true일 경우 툴팁 위에 마우스를 올려놓을 수 있습니다.
13
+ *
14
+ * @default false
15
+ */
16
+ interactive: boolean;
10
17
  protected updated(changedProperties: PropertyValues): void;
11
18
  render(): import('lit-html').TemplateResult<1>;
12
19
  /** this 바인딩 이벤트 핸들러 */
13
20
  private _show;
21
+ /** this 바인딩 이벤트 핸들러 */
14
22
  private _hide;
15
23
  /** 바인딩 이벤트 핸들러 */
16
24
  private bind;
@@ -1,13 +1,37 @@
1
1
  import { html } from 'lit';
2
+ import { property } from 'lit/decorators.js';
2
3
  import { FloatingElement } from '../FloatingElement.js';
3
4
  import { styles } from './UTooltip.styles.js';
4
5
 
6
+ var __defProp = Object.defineProperty;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = void 0 ;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = (decorator(target, key, result) ) || result;
12
+ if (result) __defProp(target, key, result);
13
+ return result;
14
+ };
5
15
  class UTooltip extends FloatingElement {
6
16
  constructor() {
7
17
  super(...arguments);
18
+ this.interactive = false;
8
19
  /** this 바인딩 이벤트 핸들러 */
9
- this._show = () => this.show();
10
- this._hide = () => this.hide();
20
+ this._show = (event) => {
21
+ const target = event.currentTarget;
22
+ if (!target) return;
23
+ this.show(target);
24
+ };
25
+ /** this 바인딩 이벤트 핸들러 */
26
+ this._hide = (event) => {
27
+ if (this.interactive) {
28
+ const target = this.target;
29
+ const related = event.relatedTarget;
30
+ if (!target || !related) return;
31
+ if (this.contains(related) || target.contains(related)) return;
32
+ }
33
+ this.hide();
34
+ };
11
35
  }
12
36
  static {
13
37
  this.styles = [super.styles, styles];
@@ -17,30 +41,48 @@ class UTooltip extends FloatingElement {
17
41
  }
18
42
  updated(changedProperties) {
19
43
  super.updated(changedProperties);
20
- if (changedProperties.has("anchor")) {
21
- const oldAnchor = changedProperties.get("anchor");
22
- const newAnchor = this.anchor;
23
- if (oldAnchor) this.unbind(oldAnchor);
24
- if (newAnchor) this.bind(newAnchor);
44
+ if (changedProperties.has("anchors")) {
45
+ const oldAnchors = changedProperties.get("anchors");
46
+ const newAnchors = this.anchors;
47
+ if (oldAnchors) this.unbind(oldAnchors);
48
+ if (newAnchors) this.bind(newAnchors);
49
+ }
50
+ if (changedProperties.has("distance")) {
51
+ if (this.distance > 0) {
52
+ this.style.setProperty("--interactive-area", `${this.distance}px`);
53
+ } else {
54
+ this.style.removeProperty("--interactive-area");
55
+ }
25
56
  }
26
57
  }
27
58
  render() {
28
59
  return html`<slot></slot>`;
29
60
  }
30
61
  /** 바인딩 이벤트 핸들러 */
31
- bind(target) {
32
- target.addEventListener("pointerenter", this._show);
33
- target.addEventListener("pointerleave", this._hide);
34
- target.addEventListener("focusin", this._show);
35
- target.addEventListener("focusout", this._hide);
62
+ bind(anchors) {
63
+ for (const anchor of anchors) {
64
+ anchor.addEventListener("pointerenter", this._show);
65
+ anchor.addEventListener("pointerleave", this._hide);
66
+ anchor.addEventListener("focusin", this._show);
67
+ anchor.addEventListener("focusout", this._hide);
68
+ }
69
+ this.addEventListener("pointerleave", this._hide);
70
+ this.addEventListener("focusout", this._hide);
36
71
  }
37
72
  /** 바인딩 해제 이벤트 핸들러 */
38
- unbind(target) {
39
- target.removeEventListener("pointerenter", this._show);
40
- target.removeEventListener("pointerleave", this._hide);
41
- target.removeEventListener("focusin", this._show);
42
- target.removeEventListener("focusout", this._hide);
73
+ unbind(anchors) {
74
+ for (const anchor of anchors) {
75
+ anchor.removeEventListener("pointerenter", this._show);
76
+ anchor.removeEventListener("pointerleave", this._hide);
77
+ anchor.removeEventListener("focusin", this._show);
78
+ anchor.removeEventListener("focusout", this._hide);
79
+ }
80
+ this.addEventListener("pointerleave", this._hide);
81
+ this.addEventListener("focusout", this._hide);
43
82
  }
44
83
  }
84
+ __decorateClass([
85
+ property({ type: Boolean, reflect: true })
86
+ ], UTooltip.prototype, "interactive");
45
87
 
46
88
  export { UTooltip };
@@ -1,6 +1,10 @@
1
1
  import { css } from 'lit';
2
2
 
3
3
  const styles = css`
4
+ :host {
5
+ --interactive-area: 0px;
6
+ }
7
+
4
8
  :host {
5
9
  padding: 6px 8px;
6
10
  color: var(--u-tooltip-txt-color);
@@ -18,6 +22,17 @@ const styles = css`
18
22
  opacity: 0.8;
19
23
  transform: scale(1);
20
24
  }
25
+
26
+ /* 툴팁을 distance만큼 감싸는 보이지 않는 영역 */
27
+ :host([interactive])::before {
28
+ content: '';
29
+ position: absolute;
30
+ /* 툴팁을 distance만큼 모든 방향으로 확장 */
31
+ inset: calc(var(--interactive-area) * -1);
32
+ background: transparent;
33
+ pointer-events: auto;
34
+ z-index: -1;
35
+ }
21
36
  `;
22
37
 
23
38
  export { styles };
package/dist/index.d.ts CHANGED
@@ -5,7 +5,6 @@ export * from './components/divider/UDivider.js';
5
5
  export * from './components/drawer/UDrawer.js';
6
6
  export * from './components/form/UForm.js';
7
7
  export * from './components/icon/UIcon.js';
8
- export * from './components/icon-button/UIconButton.js';
9
8
  export * from './components/input/UInput.js';
10
9
  export * from './components/menu/UMenu.js';
11
10
  export * from './components/menu-item/UMenuItem.js';
@@ -14,6 +13,7 @@ export * from './components/progress-ring/UProgressRing.js';
14
13
  export * from './components/skeleton/USkeleton.js';
15
14
  export * from './components/spinner/USpinner.js';
16
15
  export * from './components/split-panel/USplitPanel.js';
16
+ export * from './components/tag/UTag.js';
17
17
  export * from './components/tooltip/UTooltip.js';
18
18
  export * from './components/tree/UTree.js';
19
19
  export * from './components/tree-item/UTreeItem.js';
@@ -24,5 +24,6 @@ export * from './events/UResizeEvent';
24
24
  export * from './events/USelectEvent';
25
25
  export * from './events/UShowEvent';
26
26
  export * from './utilities/BrowserStorage.js';
27
- export * from './utilities/notifier.js';
28
- export * from './utilities/theme.js';
27
+ export * from './utilities/IconRegistry.js';
28
+ export * from './utilities/Notifier.js';
29
+ export * from './utilities/Theme.js';
package/dist/index.js CHANGED
@@ -5,7 +5,6 @@ import './components/divider/UDivider.js';
5
5
  import './components/drawer/UDrawer.js';
6
6
  import './components/form/UForm.js';
7
7
  import './components/icon/UIcon.js';
8
- import './components/icon-button/UIconButton.js';
9
8
  import './components/input/UInput.js';
10
9
  import './components/menu/UMenu.js';
11
10
  import './components/menu-item/UMenuItem.js';
@@ -14,12 +13,14 @@ import './components/progress-ring/UProgressRing.js';
14
13
  import './components/skeleton/USkeleton.js';
15
14
  import './components/spinner/USpinner.js';
16
15
  import './components/split-panel/USplitPanel.js';
16
+ import './components/tag/UTag.js';
17
17
  import './components/tooltip/UTooltip.js';
18
18
  import './components/tree/UTree.js';
19
19
  import './components/tree-item/UTreeItem.js';
20
20
  export { BrowserStorage } from './utilities/BrowserStorage.js';
21
- export { notifier } from './utilities/notifier.js';
22
- export { Theme, theme } from './utilities/theme.js';
21
+ export { IconRegistry, getDefaultBaseUrl, setDefaultBaseUrl } from './utilities/IconRegistry.js';
22
+ export { Notifier } from './utilities/Notifier.js';
23
+ export { Theme } from './utilities/Theme.js';
23
24
  export { UAlert } from './components/alert/UAlert.component.js';
24
25
  export { UButton } from './components/button/UButton.component.js';
25
26
  export { UDialog } from './components/dialog/UDialog.component.js';
@@ -27,7 +28,6 @@ export { UDivider } from './components/divider/UDivider.component.js';
27
28
  export { UDrawer } from './components/drawer/UDrawer.component.js';
28
29
  export { UForm } from './components/form/UForm.component.js';
29
30
  export { UIcon } from './components/icon/UIcon.component.js';
30
- export { UIconButton } from './components/icon-button/UIconButton.component.js';
31
31
  export { UInput } from './components/input/UInput.component.js';
32
32
  export { UMenu } from './components/menu/UMenu.component.js';
33
33
  export { UMenuItem } from './components/menu-item/UMenuItem.component.js';
@@ -36,6 +36,7 @@ export { UProgressRing } from './components/progress-ring/UProgressRing.componen
36
36
  export { USkeleton } from './components/skeleton/USkeleton.component.js';
37
37
  export { USpinner } from './components/spinner/USpinner.component.js';
38
38
  export { USplitPanel } from './components/split-panel/USplitPanel.component.js';
39
+ export { UTag } from './components/tag/UTag.component.js';
39
40
  export { UTooltip } from './components/tooltip/UTooltip.component.js';
40
41
  export { UTree } from './components/tree/UTree.component.js';
41
42
  export { UTreeItem } from './components/tree-item/UTreeItem.component.js';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { UTag } from '../components/tag/UTag';
3
+
4
+ export declare const UTag: React.ForwardRefExoticComponent<
5
+ Partial<UTag> & React.HTMLAttributes<UTag>
6
+ >;
7
+
8
+ export type UTagProps = React.ComponentProps<typeof UTag>;