@iyulab/components 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -18
- package/LICENSE +20 -20
- package/README.md +33 -33
- package/dist/assets/icons/arrow-clockwise.svg.js +1 -1
- package/dist/assets/icons/arrow-down.svg.js +1 -1
- package/dist/assets/icons/arrow-up.svg.js +1 -1
- package/dist/assets/icons/ban.svg.js +1 -1
- package/dist/assets/icons/bell-fill.svg.js +1 -1
- package/dist/assets/icons/check-circle-fill.svg.js +1 -1
- package/dist/assets/icons/check-lg.svg.js +1 -1
- package/dist/assets/icons/chevron-down.svg.js +1 -1
- package/dist/assets/icons/chevron-left.svg.js +1 -1
- package/dist/assets/icons/chevron-right.svg.js +1 -1
- package/dist/assets/icons/chevron-up.svg.js +1 -1
- package/dist/assets/icons/copy.svg.js +1 -1
- package/dist/assets/icons/dash-lg.svg.js +1 -1
- package/dist/assets/icons/exclamation-circle-fill.svg.js +1 -1
- package/dist/assets/icons/exclamation-triangle-fill.svg.js +1 -1
- package/dist/assets/icons/eye-slash.svg.js +1 -1
- package/dist/assets/icons/eye.svg.js +1 -1
- package/dist/assets/icons/info-circle-fill.svg.js +1 -1
- package/dist/assets/icons/layout-sidebar.svg.js +1 -1
- package/dist/assets/icons/lightbulb-fill.svg.js +1 -1
- package/dist/assets/icons/lightbulb-off.svg.js +1 -1
- package/dist/assets/icons/lightbulb.svg.js +1 -1
- package/dist/assets/icons/mic-fill.svg.js +1 -1
- package/dist/assets/icons/mic-mute-fill.svg.js +1 -1
- package/dist/assets/icons/paperclip.svg.js +1 -1
- package/dist/assets/icons/pencil-square.svg.js +1 -1
- package/dist/assets/icons/plus-lg.svg.js +1 -1
- package/dist/assets/icons/search.svg.js +1 -1
- package/dist/assets/icons/speedometer.svg.js +1 -1
- package/dist/assets/icons/x-lg.svg.js +1 -1
- package/dist/assets/styles/dark.css +129 -129
- package/dist/assets/styles/dark.css.js +1 -1
- package/dist/assets/styles/light.css +129 -129
- package/dist/assets/styles/light.css.js +1 -1
- package/dist/components/BaseElement.styles.js +1 -1
- package/dist/components/FloatingElement.d.ts +31 -19
- package/dist/components/FloatingElement.js +46 -34
- package/dist/components/FloatingElement.styles.js +5 -4
- package/dist/components/ModalElement.d.ts +70 -0
- package/dist/components/ModalElement.js +144 -0
- package/dist/components/ModalElement.styles.js +29 -0
- package/dist/components/alert/{Alert.d.ts → UAlert.component.d.ts} +1 -1
- package/dist/components/alert/{Alert.js → UAlert.component.js} +20 -18
- package/dist/components/alert/UAlert.d.ts +8 -0
- package/dist/components/alert/UAlert.js +5 -0
- package/dist/components/alert/{Alert.styles.js → UAlert.styles.js} +1 -3
- package/dist/components/button/{Button.d.ts → UButton.component.d.ts} +1 -1
- package/dist/components/button/{Button.js → UButton.component.js} +7 -7
- package/dist/components/button/UButton.d.ts +7 -0
- package/dist/components/button/UButton.js +5 -0
- package/dist/components/copy-button/{CopyButton.d.ts → UCopyButton.component.d.ts} +1 -1
- package/dist/components/copy-button/{CopyButton.js → UCopyButton.component.js} +10 -10
- package/dist/components/copy-button/UCopyButton.d.ts +7 -0
- package/dist/components/copy-button/UCopyButton.js +5 -0
- package/dist/components/dialog/UDialog.component.d.ts +15 -0
- package/dist/components/dialog/UDialog.component.js +65 -0
- package/dist/components/dialog/UDialog.d.ts +7 -0
- package/dist/components/dialog/UDialog.js +5 -0
- package/dist/components/dialog/{Dialog.styles.js → UDialog.styles.js} +14 -29
- package/dist/components/divider/{Divider.d.ts → UDivider.component.d.ts} +1 -1
- package/dist/components/divider/{Divider.js → UDivider.component.js} +6 -6
- package/dist/components/divider/UDivider.d.ts +7 -0
- package/dist/components/divider/UDivider.js +5 -0
- package/dist/components/drawer/UDrawer.component.d.ts +16 -0
- package/dist/components/drawer/UDrawer.component.js +59 -0
- package/dist/components/drawer/UDrawer.d.ts +8 -0
- package/dist/components/drawer/UDrawer.js +5 -0
- package/dist/components/drawer/UDrawer.styles.js +82 -0
- package/dist/components/form/{Form.d.ts → UForm.component.d.ts} +2 -2
- package/dist/components/form/{Form.js → UForm.component.js} +14 -12
- package/dist/components/form/UForm.d.ts +7 -0
- package/dist/components/form/UForm.js +5 -0
- package/dist/components/icon/{Icon.d.ts → UIcon.component.d.ts} +5 -4
- package/dist/components/icon/{Icon.js → UIcon.component.js} +9 -10
- package/dist/components/icon/UIcon.d.ts +8 -0
- package/dist/components/icon/UIcon.js +5 -0
- package/dist/components/icon-button/{IconButton.d.ts → UIconButton.component.d.ts} +3 -2
- package/dist/components/icon-button/{IconButton.js → UIconButton.component.js} +15 -15
- package/dist/components/icon-button/UIconButton.d.ts +7 -0
- package/dist/components/icon-button/UIconButton.js +5 -0
- package/dist/components/input/{Input.d.ts → UInput.component.d.ts} +14 -10
- package/dist/components/input/{Input.js → UInput.component.js} +71 -76
- package/dist/components/input/UInput.d.ts +7 -0
- package/dist/components/input/UInput.js +5 -0
- package/dist/components/input/{Input.styles.js → UInput.styles.js} +27 -24
- package/dist/components/menu/UMenu.component.d.ts +70 -0
- package/dist/components/menu/UMenu.component.js +327 -0
- package/dist/components/menu/UMenu.d.ts +8 -0
- package/dist/components/menu/UMenu.js +5 -0
- package/dist/components/menu/UMenu.styles.js +39 -0
- package/dist/components/menu-item/UMenuItem.component.d.ts +19 -0
- package/dist/components/menu-item/UMenuItem.component.js +96 -0
- package/dist/components/menu-item/UMenuItem.d.ts +7 -0
- package/dist/components/menu-item/UMenuItem.js +5 -0
- package/dist/components/menu-item/UMenuItem.styles.js +65 -0
- package/dist/components/progress-bar/{ProgressBar.d.ts → UProgressBar.component.d.ts} +1 -1
- package/dist/components/progress-bar/{ProgressBar.js → UProgressBar.component.js} +10 -10
- package/dist/components/progress-bar/UProgressBar.d.ts +7 -0
- package/dist/components/progress-bar/UProgressBar.js +5 -0
- package/dist/components/progress-ring/{ProgressRing.d.ts → UProgressRing.component.d.ts} +1 -1
- package/dist/components/progress-ring/{ProgressRing.js → UProgressRing.component.js} +9 -9
- package/dist/components/progress-ring/UProgressRing.d.ts +8 -0
- package/dist/components/progress-ring/UProgressRing.js +5 -0
- package/dist/components/skeleton/USkeleton.component.d.ts +22 -0
- package/dist/components/skeleton/USkeleton.component.js +58 -0
- package/dist/components/skeleton/USkeleton.d.ts +8 -0
- package/dist/components/skeleton/USkeleton.js +5 -0
- package/dist/components/skeleton/USkeleton.styles.js +74 -0
- package/dist/components/spinner/{Spinner.d.ts → USpinner.component.d.ts} +1 -1
- package/dist/components/spinner/{Spinner.js → USpinner.component.js} +3 -3
- package/dist/components/spinner/USpinner.d.ts +7 -0
- package/dist/components/spinner/USpinner.js +5 -0
- package/dist/components/split-panel/{SplitPanel.d.ts → USplitPanel.component.d.ts} +1 -1
- package/dist/components/split-panel/{SplitPanel.js → USplitPanel.component.js} +13 -13
- package/dist/components/split-panel/USplitPanel.d.ts +7 -0
- package/dist/components/split-panel/USplitPanel.js +5 -0
- package/dist/components/tooltip/{Tooltip.d.ts → UTooltip.component.d.ts} +6 -7
- package/dist/components/tooltip/{Tooltip.js → UTooltip.component.js} +12 -16
- package/dist/components/tooltip/UTooltip.d.ts +7 -0
- package/dist/components/tooltip/UTooltip.js +5 -0
- package/dist/components/tooltip/{Tooltip.styles.js → UTooltip.styles.js} +1 -0
- package/dist/components/tree/{Tree.d.ts → UTree.component.d.ts} +4 -4
- package/dist/components/tree/{Tree.js → UTree.component.js} +10 -10
- package/dist/components/tree/UTree.d.ts +7 -0
- package/dist/components/tree/UTree.js +5 -0
- package/dist/components/tree/UTree.styles.d.ts +1 -0
- package/dist/components/tree/{Tree.styles.js → UTree.styles.js} +0 -1
- package/dist/components/tree-item/{TreeItem.d.ts → UTreeItem.component.d.ts} +2 -2
- package/dist/components/tree-item/{TreeItem.js → UTreeItem.component.js} +15 -15
- package/dist/components/tree-item/UTreeItem.d.ts +7 -0
- package/dist/components/tree-item/UTreeItem.js +5 -0
- package/dist/index.d.ts +29 -2
- package/dist/index.js +40 -42
- package/dist/internals/attribute-converters.d.ts +5 -3
- package/dist/internals/node-helpers.d.ts +9 -9
- package/dist/internals/node-helpers.js +2 -2
- package/dist/utilities/icons.js +1 -4
- package/dist/utilities/notifier.d.ts +1 -1
- package/dist/utilities/notifier.js +3 -3
- package/package.json +60 -59
- package/dist/components/alert/index.d.ts +0 -7
- package/dist/components/alert/index.js +0 -5
- package/dist/components/button/index.d.ts +0 -7
- package/dist/components/button/index.js +0 -5
- package/dist/components/context-menu/ContextMenu.d.ts +0 -29
- package/dist/components/context-menu/ContextMenu.js +0 -148
- package/dist/components/context-menu/ContextMenu.styles.js +0 -15
- package/dist/components/context-menu/index.d.ts +0 -7
- package/dist/components/context-menu/index.js +0 -5
- package/dist/components/copy-button/index.d.ts +0 -7
- package/dist/components/copy-button/index.js +0 -5
- package/dist/components/dialog/Dialog.d.ts +0 -37
- package/dist/components/dialog/Dialog.js +0 -160
- package/dist/components/dialog/index.d.ts +0 -7
- package/dist/components/dialog/index.js +0 -5
- package/dist/components/divider/index.d.ts +0 -7
- package/dist/components/divider/index.js +0 -5
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +0 -27
- package/dist/components/dropdown-menu/DropdownMenu.js +0 -135
- package/dist/components/dropdown-menu/DropdownMenu.styles.js +0 -15
- package/dist/components/dropdown-menu/index.d.ts +0 -7
- package/dist/components/dropdown-menu/index.js +0 -5
- package/dist/components/form/index.d.ts +0 -7
- package/dist/components/form/index.js +0 -5
- package/dist/components/icon/index.d.ts +0 -7
- package/dist/components/icon/index.js +0 -5
- package/dist/components/icon-button/index.d.ts +0 -7
- package/dist/components/icon-button/index.js +0 -5
- package/dist/components/index.d.ts +0 -20
- package/dist/components/input/index.d.ts +0 -7
- package/dist/components/input/index.js +0 -5
- package/dist/components/menu/Menu.d.ts +0 -25
- package/dist/components/menu/Menu.js +0 -168
- package/dist/components/menu/Menu.styles.js +0 -21
- package/dist/components/menu/index.d.ts +0 -7
- package/dist/components/menu/index.js +0 -5
- package/dist/components/menu-item/MenuItem.d.ts +0 -36
- package/dist/components/menu-item/MenuItem.js +0 -267
- package/dist/components/menu-item/MenuItem.styles.js +0 -70
- package/dist/components/menu-item/index.d.ts +0 -7
- package/dist/components/menu-item/index.js +0 -5
- package/dist/components/progress-bar/index.d.ts +0 -7
- package/dist/components/progress-bar/index.js +0 -5
- package/dist/components/progress-ring/index.d.ts +0 -7
- package/dist/components/progress-ring/index.js +0 -5
- package/dist/components/spinner/index.d.ts +0 -7
- package/dist/components/spinner/index.js +0 -5
- package/dist/components/split-panel/index.d.ts +0 -7
- package/dist/components/split-panel/index.js +0 -5
- package/dist/components/tooltip/index.d.ts +0 -7
- package/dist/components/tooltip/index.js +0 -5
- package/dist/components/tree/index.d.ts +0 -3
- package/dist/components/tree/index.js +0 -5
- package/dist/components/tree-item/index.d.ts +0 -3
- package/dist/components/tree-item/index.js +0 -5
- package/dist/events/index.d.ts +0 -6
- package/dist/integrations/react/UAlert.d.ts +0 -8
- package/dist/integrations/react/UAlert.js +0 -10
- package/dist/integrations/react/UButton.d.ts +0 -8
- package/dist/integrations/react/UButton.js +0 -10
- package/dist/integrations/react/UContextMenu.d.ts +0 -8
- package/dist/integrations/react/UContextMenu.js +0 -10
- package/dist/integrations/react/UCopyButton.d.ts +0 -8
- package/dist/integrations/react/UCopyButton.js +0 -10
- package/dist/integrations/react/UDialog.d.ts +0 -8
- package/dist/integrations/react/UDialog.js +0 -10
- package/dist/integrations/react/UDivider.d.ts +0 -8
- package/dist/integrations/react/UDivider.js +0 -10
- package/dist/integrations/react/UDropdownMenu.d.ts +0 -8
- package/dist/integrations/react/UDropdownMenu.js +0 -10
- package/dist/integrations/react/UForm.d.ts +0 -8
- package/dist/integrations/react/UForm.js +0 -10
- package/dist/integrations/react/UIcon.d.ts +0 -8
- package/dist/integrations/react/UIcon.js +0 -10
- package/dist/integrations/react/UIconButton.d.ts +0 -8
- package/dist/integrations/react/UIconButton.js +0 -10
- package/dist/integrations/react/UInput.d.ts +0 -8
- package/dist/integrations/react/UInput.js +0 -10
- package/dist/integrations/react/UMenu.d.ts +0 -8
- package/dist/integrations/react/UMenu.js +0 -10
- package/dist/integrations/react/UMenuItem.d.ts +0 -8
- package/dist/integrations/react/UMenuItem.js +0 -10
- package/dist/integrations/react/UProgressBar.d.ts +0 -8
- package/dist/integrations/react/UProgressBar.js +0 -10
- package/dist/integrations/react/UProgressRing.d.ts +0 -8
- package/dist/integrations/react/UProgressRing.js +0 -10
- package/dist/integrations/react/USpinner.d.ts +0 -8
- package/dist/integrations/react/USpinner.js +0 -10
- package/dist/integrations/react/USplitPanel.d.ts +0 -8
- package/dist/integrations/react/USplitPanel.js +0 -10
- package/dist/integrations/react/UTooltip.d.ts +0 -8
- package/dist/integrations/react/UTooltip.js +0 -10
- package/dist/integrations/react/UTree.d.ts +0 -8
- package/dist/integrations/react/UTree.js +0 -10
- package/dist/integrations/react/UTreeItem.d.ts +0 -8
- package/dist/integrations/react/UTreeItem.js +0 -10
- package/dist/integrations/react/index.d.ts +0 -27
- package/dist/integrations/react/index.js +0 -20
- package/dist/internals/index.d.ts +0 -3
- package/dist/utilities/decorators.js +0 -28
- package/dist/utilities/index.d.ts +0 -5
- /package/dist/components/{alert/Alert.styles.d.ts → ModalElement.styles.d.ts} +0 -0
- /package/dist/components/{button/Button.styles.d.ts → alert/UAlert.styles.d.ts} +0 -0
- /package/dist/components/{context-menu/ContextMenu.styles.d.ts → button/UButton.styles.d.ts} +0 -0
- /package/dist/components/button/{Button.styles.js → UButton.styles.js} +0 -0
- /package/dist/components/copy-button/{CopyButton.styles.d.ts → UCopyButton.styles.d.ts} +0 -0
- /package/dist/components/copy-button/{CopyButton.styles.js → UCopyButton.styles.js} +0 -0
- /package/dist/components/dialog/{Dialog.styles.d.ts → UDialog.styles.d.ts} +0 -0
- /package/dist/components/divider/{Divider.styles.d.ts → UDivider.styles.d.ts} +0 -0
- /package/dist/components/divider/{Divider.styles.js → UDivider.styles.js} +0 -0
- /package/dist/components/{dropdown-menu/DropdownMenu.styles.d.ts → drawer/UDrawer.styles.d.ts} +0 -0
- /package/dist/components/form/{Form.styles.d.ts → UForm.styles.d.ts} +0 -0
- /package/dist/components/form/{Form.styles.js → UForm.styles.js} +0 -0
- /package/dist/components/icon/{Icon.styles.d.ts → UIcon.styles.d.ts} +0 -0
- /package/dist/components/icon/{Icon.styles.js → UIcon.styles.js} +0 -0
- /package/dist/components/icon-button/{IconButton.styles.d.ts → UIconButton.styles.d.ts} +0 -0
- /package/dist/components/icon-button/{IconButton.styles.js → UIconButton.styles.js} +0 -0
- /package/dist/components/input/{Input.styles.d.ts → UInput.styles.d.ts} +0 -0
- /package/dist/components/menu/{Menu.styles.d.ts → UMenu.styles.d.ts} +0 -0
- /package/dist/components/menu-item/{MenuItem.styles.d.ts → UMenuItem.styles.d.ts} +0 -0
- /package/dist/components/progress-bar/{ProgressBar.styles.d.ts → UProgressBar.styles.d.ts} +0 -0
- /package/dist/components/progress-bar/{ProgressBar.styles.js → UProgressBar.styles.js} +0 -0
- /package/dist/components/progress-ring/{ProgressRing.styles.d.ts → UProgressRing.styles.d.ts} +0 -0
- /package/dist/components/progress-ring/{ProgressRing.styles.js → UProgressRing.styles.js} +0 -0
- /package/dist/components/{spinner/Spinner.styles.d.ts → skeleton/USkeleton.styles.d.ts} +0 -0
- /package/dist/components/{split-panel/SplitPanel.styles.d.ts → spinner/USpinner.styles.d.ts} +0 -0
- /package/dist/components/spinner/{Spinner.styles.js → USpinner.styles.js} +0 -0
- /package/dist/components/{tooltip/Tooltip.styles.d.ts → split-panel/USplitPanel.styles.d.ts} +0 -0
- /package/dist/components/split-panel/{SplitPanel.styles.js → USplitPanel.styles.js} +0 -0
- /package/dist/components/{tree-item/TreeItem.styles.d.ts → tooltip/UTooltip.styles.d.ts} +0 -0
- /package/dist/components/{tree/Tree.styles.d.ts → tree-item/UTreeItem.styles.d.ts} +0 -0
- /package/dist/components/tree-item/{TreeItem.styles.js → UTreeItem.styles.js} +0 -0
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { FloatingElement } from '../FloatingElement.js';
|
|
4
|
-
import { Menu } from '../menu/Menu.js';
|
|
5
|
-
import { MenuItem } from '../menu-item/MenuItem.js';
|
|
6
|
-
import { styles } from './ContextMenu.styles.js';
|
|
7
|
-
|
|
8
|
-
var __defProp = Object.defineProperty;
|
|
9
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
-
var result = void 0 ;
|
|
11
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
-
if (decorator = decorators[i])
|
|
13
|
-
result = (decorator(target, key, result) ) || result;
|
|
14
|
-
if (result) __defProp(target, key, result);
|
|
15
|
-
return result;
|
|
16
|
-
};
|
|
17
|
-
class ContextMenu extends FloatingElement {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.preventNative = true;
|
|
21
|
-
this.closeOnSelect = true;
|
|
22
|
-
this.closeOnCheck = false;
|
|
23
|
-
this.onContextMenu = async (e) => {
|
|
24
|
-
if (this.preventNative) e.preventDefault();
|
|
25
|
-
this.menu && (this.menu.open = true);
|
|
26
|
-
const virtual = {
|
|
27
|
-
getBoundingClientRect: () => ({
|
|
28
|
-
x: e.clientX,
|
|
29
|
-
y: e.clientY,
|
|
30
|
-
top: e.clientY,
|
|
31
|
-
left: e.clientX,
|
|
32
|
-
right: e.clientX,
|
|
33
|
-
bottom: e.clientY,
|
|
34
|
-
width: 0,
|
|
35
|
-
height: 0,
|
|
36
|
-
toJSON() {
|
|
37
|
-
return {};
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
};
|
|
41
|
-
await super.show(virtual);
|
|
42
|
-
await this.menu?.focusFirstItem?.();
|
|
43
|
-
};
|
|
44
|
-
this.hide = async () => {
|
|
45
|
-
await super.hide();
|
|
46
|
-
this.menu && (this.menu.open = false);
|
|
47
|
-
this.querySelectorAll("u-menu-item").forEach((i) => i.closeSubmenu?.());
|
|
48
|
-
};
|
|
49
|
-
this.onDocPointerDown = (e) => {
|
|
50
|
-
if (!this.visible) return;
|
|
51
|
-
const path = e.composedPath();
|
|
52
|
-
if (path.includes(this)) return;
|
|
53
|
-
this.hide();
|
|
54
|
-
};
|
|
55
|
-
this.onWindowBlur = () => {
|
|
56
|
-
if (this.visible) this.hide();
|
|
57
|
-
};
|
|
58
|
-
this.onWindowScrollOrResize = () => {
|
|
59
|
-
if (this.visible) this.hide();
|
|
60
|
-
};
|
|
61
|
-
this.onSelect = async () => {
|
|
62
|
-
if (this.closeOnSelect) await this.hide();
|
|
63
|
-
};
|
|
64
|
-
this.onCheck = async () => {
|
|
65
|
-
if (this.closeOnCheck) await this.hide();
|
|
66
|
-
};
|
|
67
|
-
this.onRequestClose = async () => {
|
|
68
|
-
await this.hide();
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
static {
|
|
72
|
-
this.styles = [super.styles, styles];
|
|
73
|
-
}
|
|
74
|
-
static {
|
|
75
|
-
this.dependencies = {
|
|
76
|
-
"u-menu": Menu,
|
|
77
|
-
"u-menu-item": MenuItem
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
get menu() {
|
|
81
|
-
return this.querySelector("u-menu");
|
|
82
|
-
}
|
|
83
|
-
connectedCallback() {
|
|
84
|
-
super.connectedCallback();
|
|
85
|
-
this.strategy = "fixed";
|
|
86
|
-
this.placement ||= "bottom-start";
|
|
87
|
-
this.distance ||= 4;
|
|
88
|
-
this.addEventListener("u-select", this.onSelect);
|
|
89
|
-
this.addEventListener("u-check", this.onCheck);
|
|
90
|
-
this.addEventListener("u-request-close", this.onRequestClose);
|
|
91
|
-
}
|
|
92
|
-
disconnectedCallback() {
|
|
93
|
-
this.detachAnchor(this.anchor);
|
|
94
|
-
this.detachDismiss();
|
|
95
|
-
this.removeEventListener("u-select", this.onSelect);
|
|
96
|
-
this.removeEventListener("u-check", this.onCheck);
|
|
97
|
-
this.removeEventListener("u-request-close", this.onRequestClose);
|
|
98
|
-
super.disconnectedCallback();
|
|
99
|
-
}
|
|
100
|
-
updated(changed) {
|
|
101
|
-
super.updated(changed);
|
|
102
|
-
if (changed.has("anchor")) {
|
|
103
|
-
this.detachAnchor(changed.get("anchor"));
|
|
104
|
-
this.attachAnchor(this.anchor);
|
|
105
|
-
}
|
|
106
|
-
if (changed.has("visible")) {
|
|
107
|
-
if (this.visible) this.attachDismiss();
|
|
108
|
-
else this.detachDismiss();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
render() {
|
|
112
|
-
return html`<slot></slot>`;
|
|
113
|
-
}
|
|
114
|
-
/** 컨텍스트 메뉴는 Virtual anchor를 쓰므로 autoUpdate는 꺼버림 */
|
|
115
|
-
autoPosition(_enable) {
|
|
116
|
-
}
|
|
117
|
-
attachAnchor(target) {
|
|
118
|
-
if (!target) return;
|
|
119
|
-
target.addEventListener("contextmenu", this.onContextMenu);
|
|
120
|
-
}
|
|
121
|
-
detachAnchor(target) {
|
|
122
|
-
if (!target) return;
|
|
123
|
-
target.removeEventListener("contextmenu", this.onContextMenu);
|
|
124
|
-
}
|
|
125
|
-
attachDismiss() {
|
|
126
|
-
document.addEventListener("pointerdown", this.onDocPointerDown, true);
|
|
127
|
-
window.addEventListener("blur", this.onWindowBlur);
|
|
128
|
-
window.addEventListener("scroll", this.onWindowScrollOrResize, true);
|
|
129
|
-
window.addEventListener("resize", this.onWindowScrollOrResize);
|
|
130
|
-
}
|
|
131
|
-
detachDismiss() {
|
|
132
|
-
document.removeEventListener("pointerdown", this.onDocPointerDown, true);
|
|
133
|
-
window.removeEventListener("blur", this.onWindowBlur);
|
|
134
|
-
window.removeEventListener("scroll", this.onWindowScrollOrResize, true);
|
|
135
|
-
window.removeEventListener("resize", this.onWindowScrollOrResize);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
__decorateClass([
|
|
139
|
-
property({ type: Boolean })
|
|
140
|
-
], ContextMenu.prototype, "preventNative");
|
|
141
|
-
__decorateClass([
|
|
142
|
-
property({ type: Boolean })
|
|
143
|
-
], ContextMenu.prototype, "closeOnSelect");
|
|
144
|
-
__decorateClass([
|
|
145
|
-
property({ type: Boolean })
|
|
146
|
-
], ContextMenu.prototype, "closeOnCheck");
|
|
147
|
-
|
|
148
|
-
export { ContextMenu };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
|
|
3
|
-
const styles = css`
|
|
4
|
-
:host {
|
|
5
|
-
opacity: 0;
|
|
6
|
-
transform: scale(0.98);
|
|
7
|
-
transition: opacity 0.12s ease, transform 0.12s ease;
|
|
8
|
-
}
|
|
9
|
-
:host([visible]) {
|
|
10
|
-
opacity: 1;
|
|
11
|
-
transform: scale(1);
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
export { styles };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { PropertyValues } from 'lit';
|
|
2
|
-
import { BaseElement } from '../BaseElement.js';
|
|
3
|
-
/**
|
|
4
|
-
* Dialog 컴포넌트는 모달 대화상자를 제공합니다.
|
|
5
|
-
* 오버레이와 함께 화면 중앙에 표시되며, 헤더, 본문, 푸터 영역을 슬롯으로 제공합니다.
|
|
6
|
-
*/
|
|
7
|
-
export declare class Dialog extends BaseElement {
|
|
8
|
-
static styles: import('lit').CSSResultGroup[];
|
|
9
|
-
static dependencies: Record<string, typeof BaseElement>;
|
|
10
|
-
dialogEl: HTMLDivElement;
|
|
11
|
-
/** 모달 모드 활성화 (배경 차단 및 포커스 트랩) */
|
|
12
|
-
modal: boolean;
|
|
13
|
-
/** 다이얼로그가 열려있는지 여부 */
|
|
14
|
-
open: boolean;
|
|
15
|
-
/** 이벤트에 의한 다이얼로그 닫기 허용 여부 */
|
|
16
|
-
closable: boolean;
|
|
17
|
-
/** 타이틀 텍스트 */
|
|
18
|
-
heading: string;
|
|
19
|
-
connectedCallback(): void;
|
|
20
|
-
disconnectedCallback(): void;
|
|
21
|
-
protected updated(changedProperties: PropertyValues): void;
|
|
22
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
23
|
-
/** 다이얼로그를 표시합니다 */
|
|
24
|
-
show: () => Promise<void>;
|
|
25
|
-
/** 다이얼로그를 숨깁니다 */
|
|
26
|
-
hide: () => Promise<void>;
|
|
27
|
-
/** 패널을 흔드는 애니메이션을 재생합니다 */
|
|
28
|
-
private shake;
|
|
29
|
-
/** 오버레이 클릭 핸들러 */
|
|
30
|
-
private handleBackdropClick;
|
|
31
|
-
/** 키보드 이벤트 핸들러 */
|
|
32
|
-
private handleKeydown;
|
|
33
|
-
/** 포커스 트랩 핸들러 */
|
|
34
|
-
private handleFocusin;
|
|
35
|
-
private updateOpenState;
|
|
36
|
-
private updateModalState;
|
|
37
|
-
}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { nothing, html } from 'lit';
|
|
2
|
-
import { query, property } from 'lit/decorators.js';
|
|
3
|
-
import { BaseElement } from '../BaseElement.js';
|
|
4
|
-
import { IconButton } from '../icon-button/IconButton.js';
|
|
5
|
-
import { styles } from './Dialog.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 Dialog extends BaseElement {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.modal = true;
|
|
20
|
-
this.open = false;
|
|
21
|
-
this.closable = true;
|
|
22
|
-
this.heading = "";
|
|
23
|
-
/** 다이얼로그를 표시합니다 */
|
|
24
|
-
this.show = async () => {
|
|
25
|
-
await this.updateComplete;
|
|
26
|
-
requestAnimationFrame(() => {
|
|
27
|
-
this.open = true;
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
/** 다이얼로그를 숨깁니다 */
|
|
31
|
-
this.hide = async () => {
|
|
32
|
-
await this.updateComplete;
|
|
33
|
-
requestAnimationFrame(() => {
|
|
34
|
-
this.open = false;
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
/** 오버레이 클릭 핸들러 */
|
|
38
|
-
this.handleBackdropClick = (e) => {
|
|
39
|
-
if (e.target === this) {
|
|
40
|
-
if (this.closable) {
|
|
41
|
-
this.hide();
|
|
42
|
-
} else {
|
|
43
|
-
this.shake();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
/** 키보드 이벤트 핸들러 */
|
|
48
|
-
this.handleKeydown = (e) => {
|
|
49
|
-
if (e.key === "Escape" && this.open) {
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
if (this.closable) {
|
|
52
|
-
this.hide();
|
|
53
|
-
} else {
|
|
54
|
-
this.shake();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
/** 포커스 트랩 핸들러 */
|
|
59
|
-
this.handleFocusin = (e) => {
|
|
60
|
-
if (!this.modal || !this.open) return;
|
|
61
|
-
const target = e.target;
|
|
62
|
-
if (!this.contains(target)) {
|
|
63
|
-
e.preventDefault();
|
|
64
|
-
this.dialogEl.focus();
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
static {
|
|
69
|
-
this.styles = [super.styles, styles];
|
|
70
|
-
}
|
|
71
|
-
static {
|
|
72
|
-
this.dependencies = {
|
|
73
|
-
"u-icon-button": IconButton
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
connectedCallback() {
|
|
77
|
-
super.connectedCallback();
|
|
78
|
-
this.addEventListener("click", this.handleBackdropClick);
|
|
79
|
-
}
|
|
80
|
-
disconnectedCallback() {
|
|
81
|
-
window.removeEventListener("keydown", this.handleKeydown);
|
|
82
|
-
window.removeEventListener("focusin", this.handleFocusin);
|
|
83
|
-
super.disconnectedCallback();
|
|
84
|
-
}
|
|
85
|
-
updated(changedProperties) {
|
|
86
|
-
super.updated(changedProperties);
|
|
87
|
-
if (changedProperties.has("open")) {
|
|
88
|
-
this.updateOpenState(this.open);
|
|
89
|
-
}
|
|
90
|
-
if (changedProperties.has("modal")) {
|
|
91
|
-
this.updateModalState(this.modal);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
render() {
|
|
95
|
-
return html`
|
|
96
|
-
<div class="dialog scrollable" part="base" tabindex="-1">
|
|
97
|
-
|
|
98
|
-
${this.heading ? html`
|
|
99
|
-
<div class="header" part="header">
|
|
100
|
-
<span class="title" part="title">
|
|
101
|
-
${this.heading}
|
|
102
|
-
</span>
|
|
103
|
-
<u-icon-button class="close-btn" part="close-btn"
|
|
104
|
-
lib="internal"
|
|
105
|
-
name="x-lg"
|
|
106
|
-
borderless
|
|
107
|
-
@click=${() => this.hide()}
|
|
108
|
-
></u-icon-button>
|
|
109
|
-
</div>` : nothing}
|
|
110
|
-
|
|
111
|
-
<slot></slot>
|
|
112
|
-
|
|
113
|
-
</div>
|
|
114
|
-
`;
|
|
115
|
-
}
|
|
116
|
-
/** 패널을 흔드는 애니메이션을 재생합니다 */
|
|
117
|
-
shake() {
|
|
118
|
-
this.dialogEl.classList.add("shake");
|
|
119
|
-
setTimeout(() => {
|
|
120
|
-
this.dialogEl.classList.remove("shake");
|
|
121
|
-
}, 500);
|
|
122
|
-
}
|
|
123
|
-
updateOpenState(open) {
|
|
124
|
-
if (open) {
|
|
125
|
-
this.emit("u-show");
|
|
126
|
-
document.body.style.overflow = this.modal ? "hidden" : "";
|
|
127
|
-
} else {
|
|
128
|
-
this.emit("u-hide");
|
|
129
|
-
document.body.style.overflow = "";
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
updateModalState(modal) {
|
|
133
|
-
if (modal) {
|
|
134
|
-
window.addEventListener("keydown", this.handleKeydown);
|
|
135
|
-
window.addEventListener("focusin", this.handleFocusin);
|
|
136
|
-
document.body.style.overflow = this.open ? "hidden" : "";
|
|
137
|
-
} else {
|
|
138
|
-
window.removeEventListener("keydown", this.handleKeydown);
|
|
139
|
-
window.removeEventListener("focusin", this.handleFocusin);
|
|
140
|
-
document.body.style.overflow = "";
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
__decorateClass([
|
|
145
|
-
query(".dialog")
|
|
146
|
-
], Dialog.prototype, "dialogEl");
|
|
147
|
-
__decorateClass([
|
|
148
|
-
property({ type: Boolean, reflect: true })
|
|
149
|
-
], Dialog.prototype, "modal");
|
|
150
|
-
__decorateClass([
|
|
151
|
-
property({ type: Boolean, reflect: true })
|
|
152
|
-
], Dialog.prototype, "open");
|
|
153
|
-
__decorateClass([
|
|
154
|
-
property({ type: Boolean })
|
|
155
|
-
], Dialog.prototype, "closable");
|
|
156
|
-
__decorateClass([
|
|
157
|
-
property({ type: String })
|
|
158
|
-
], Dialog.prototype, "heading");
|
|
159
|
-
|
|
160
|
-
export { Dialog };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { PropertyValues } from 'lit';
|
|
2
|
-
import { BaseElement } from '../BaseElement.js';
|
|
3
|
-
import { FloatingElement } from '../FloatingElement.js';
|
|
4
|
-
export declare class DropdownMenu extends FloatingElement {
|
|
5
|
-
static styles: import('lit').CSSResultGroup[];
|
|
6
|
-
static dependencies: Record<string, typeof BaseElement>;
|
|
7
|
-
closeOnSelect: boolean;
|
|
8
|
-
closeOnCheck: boolean;
|
|
9
|
-
private onDocPointerDown;
|
|
10
|
-
private onWindowBlur;
|
|
11
|
-
private get menu();
|
|
12
|
-
connectedCallback(): void;
|
|
13
|
-
disconnectedCallback(): void;
|
|
14
|
-
protected updated(changed: PropertyValues): void;
|
|
15
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
16
|
-
show: () => Promise<void>;
|
|
17
|
-
hide: () => Promise<void>;
|
|
18
|
-
private attachAnchor;
|
|
19
|
-
private detachAnchor;
|
|
20
|
-
private onTriggerPointerDown;
|
|
21
|
-
private onTriggerKeydown;
|
|
22
|
-
private onSelect;
|
|
23
|
-
private onCheck;
|
|
24
|
-
private onRequestClose;
|
|
25
|
-
private attachDismiss;
|
|
26
|
-
private detachDismiss;
|
|
27
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { FloatingElement } from '../FloatingElement.js';
|
|
4
|
-
import { Menu } from '../menu/Menu.js';
|
|
5
|
-
import { MenuItem } from '../menu-item/MenuItem.js';
|
|
6
|
-
import { styles } from './DropdownMenu.styles.js';
|
|
7
|
-
|
|
8
|
-
var __defProp = Object.defineProperty;
|
|
9
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
-
var result = void 0 ;
|
|
11
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
-
if (decorator = decorators[i])
|
|
13
|
-
result = (decorator(target, key, result) ) || result;
|
|
14
|
-
if (result) __defProp(target, key, result);
|
|
15
|
-
return result;
|
|
16
|
-
};
|
|
17
|
-
class DropdownMenu extends FloatingElement {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.closeOnSelect = true;
|
|
21
|
-
this.closeOnCheck = false;
|
|
22
|
-
this.onDocPointerDown = (e) => {
|
|
23
|
-
if (!this.visible) return;
|
|
24
|
-
const path = e.composedPath();
|
|
25
|
-
if (path.includes(this)) return;
|
|
26
|
-
if (this.anchor && path.includes(this.anchor)) return;
|
|
27
|
-
this.hide();
|
|
28
|
-
};
|
|
29
|
-
this.onWindowBlur = () => {
|
|
30
|
-
if (this.visible) this.hide();
|
|
31
|
-
};
|
|
32
|
-
this.show = async () => {
|
|
33
|
-
this.menu && (this.menu.open = true);
|
|
34
|
-
await super.show();
|
|
35
|
-
await this.menu?.focusFirstItem?.();
|
|
36
|
-
};
|
|
37
|
-
this.hide = async () => {
|
|
38
|
-
await super.hide();
|
|
39
|
-
this.menu && (this.menu.open = false);
|
|
40
|
-
this.querySelectorAll("u-menu-item").forEach((i) => i.closeSubmenu?.());
|
|
41
|
-
};
|
|
42
|
-
this.onTriggerPointerDown = async (e) => {
|
|
43
|
-
if (e.button !== 0) return;
|
|
44
|
-
if (this.visible) await this.hide();
|
|
45
|
-
else await this.show();
|
|
46
|
-
};
|
|
47
|
-
this.onTriggerKeydown = async (e) => {
|
|
48
|
-
if (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") {
|
|
49
|
-
e.preventDefault();
|
|
50
|
-
if (!this.visible) await this.show();
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
this.onSelect = async () => {
|
|
54
|
-
if (this.closeOnSelect) await this.hide();
|
|
55
|
-
};
|
|
56
|
-
this.onCheck = async () => {
|
|
57
|
-
if (this.closeOnCheck) await this.hide();
|
|
58
|
-
};
|
|
59
|
-
this.onRequestClose = async () => {
|
|
60
|
-
await this.hide();
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
static {
|
|
64
|
-
this.styles = [super.styles, styles];
|
|
65
|
-
}
|
|
66
|
-
static {
|
|
67
|
-
this.dependencies = {
|
|
68
|
-
"u-menu": Menu,
|
|
69
|
-
"u-menu-item": MenuItem
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
get menu() {
|
|
73
|
-
return this.querySelector("u-menu");
|
|
74
|
-
}
|
|
75
|
-
connectedCallback() {
|
|
76
|
-
super.connectedCallback();
|
|
77
|
-
this.placement ||= "bottom-start";
|
|
78
|
-
this.distance ||= 6;
|
|
79
|
-
this.addEventListener("u-select", this.onSelect);
|
|
80
|
-
this.addEventListener("u-check", this.onCheck);
|
|
81
|
-
this.addEventListener("u-request-close", this.onRequestClose);
|
|
82
|
-
}
|
|
83
|
-
disconnectedCallback() {
|
|
84
|
-
this.detachAnchor(this.anchor);
|
|
85
|
-
this.detachDismiss();
|
|
86
|
-
this.removeEventListener("u-select", this.onSelect);
|
|
87
|
-
this.removeEventListener("u-check", this.onCheck);
|
|
88
|
-
this.removeEventListener("u-request-close", this.onRequestClose);
|
|
89
|
-
super.disconnectedCallback();
|
|
90
|
-
}
|
|
91
|
-
updated(changed) {
|
|
92
|
-
super.updated(changed);
|
|
93
|
-
if (changed.has("anchor")) {
|
|
94
|
-
this.detachAnchor(changed.get("anchor"));
|
|
95
|
-
this.attachAnchor(this.anchor);
|
|
96
|
-
}
|
|
97
|
-
if (changed.has("visible")) {
|
|
98
|
-
if (this.visible) this.attachDismiss();
|
|
99
|
-
else this.detachDismiss();
|
|
100
|
-
if (this.anchor) {
|
|
101
|
-
this.anchor.setAttribute("aria-expanded", this.visible ? "true" : "false");
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
render() {
|
|
106
|
-
return html`<slot></slot>`;
|
|
107
|
-
}
|
|
108
|
-
attachAnchor(target) {
|
|
109
|
-
if (!target) return;
|
|
110
|
-
target.setAttribute("aria-haspopup", "menu");
|
|
111
|
-
target.addEventListener("pointerdown", this.onTriggerPointerDown);
|
|
112
|
-
target.addEventListener("keydown", this.onTriggerKeydown);
|
|
113
|
-
}
|
|
114
|
-
detachAnchor(target) {
|
|
115
|
-
if (!target) return;
|
|
116
|
-
target.removeEventListener("pointerdown", this.onTriggerPointerDown);
|
|
117
|
-
target.removeEventListener("keydown", this.onTriggerKeydown);
|
|
118
|
-
}
|
|
119
|
-
attachDismiss() {
|
|
120
|
-
document.addEventListener("pointerdown", this.onDocPointerDown, true);
|
|
121
|
-
window.addEventListener("blur", this.onWindowBlur);
|
|
122
|
-
}
|
|
123
|
-
detachDismiss() {
|
|
124
|
-
document.removeEventListener("pointerdown", this.onDocPointerDown, true);
|
|
125
|
-
window.removeEventListener("blur", this.onWindowBlur);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
__decorateClass([
|
|
129
|
-
property({ type: Boolean })
|
|
130
|
-
], DropdownMenu.prototype, "closeOnSelect");
|
|
131
|
-
__decorateClass([
|
|
132
|
-
property({ type: Boolean })
|
|
133
|
-
], DropdownMenu.prototype, "closeOnCheck");
|
|
134
|
-
|
|
135
|
-
export { DropdownMenu };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
|
|
3
|
-
const styles = css`
|
|
4
|
-
:host {
|
|
5
|
-
opacity: 0;
|
|
6
|
-
transform: scale(0.98);
|
|
7
|
-
transition: opacity 0.12s ease, transform 0.12s ease;
|
|
8
|
-
}
|
|
9
|
-
:host([visible]) {
|
|
10
|
-
opacity: 1; /* FloatingElement의 0.8을 덮어씀 */
|
|
11
|
-
transform: scale(1);
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
export { styles };
|