@for-the-people-initiative/design-system 1.3.1
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/README.md +80 -0
- package/dist/css/theme-dark.css +7 -0
- package/dist/css/tokens.css +2315 -0
- package/dist/scss/_tokens.scss +2521 -0
- package/dist/ts/tokens.ts +2441 -0
- package/package.json +80 -0
- package/src/components/Accordion/Accordion.scss +118 -0
- package/src/components/Accordion/Accordion.vue +105 -0
- package/src/components/Accordion/AccordionTab.vue +79 -0
- package/src/components/Alert/Alert.scss +109 -0
- package/src/components/Alert/Alert.vue +79 -0
- package/src/components/AppBar/AppBar.scss +73 -0
- package/src/components/AppBar/AppBar.vue +49 -0
- package/src/components/AtmosphericBackground/AtmosphericBackground.vue +198 -0
- package/src/components/AutoComplete/AutoComplete.scss +282 -0
- package/src/components/AutoComplete/AutoComplete.vue +398 -0
- package/src/components/Avatar/Avatar.scss +191 -0
- package/src/components/Avatar/Avatar.vue +44 -0
- package/src/components/Badge/Badge.scss +84 -0
- package/src/components/Badge/Badge.vue +41 -0
- package/src/components/BlockUI/BlockUI.scss +85 -0
- package/src/components/BlockUI/BlockUI.vue +90 -0
- package/src/components/Breadcrumb/Breadcrumb.scss +84 -0
- package/src/components/Breadcrumb/Breadcrumb.vue +141 -0
- package/src/components/Button/Button.scss +254 -0
- package/src/components/Button/Button.vue +68 -0
- package/src/components/CTA/CTA.scss +92 -0
- package/src/components/CTA/CTA.vue +33 -0
- package/src/components/Calendar/Calendar.scss +330 -0
- package/src/components/Calendar/Calendar.vue +455 -0
- package/src/components/Card/Card.scss +66 -0
- package/src/components/Card/Card.vue +48 -0
- package/src/components/Carousel/Carousel.scss +121 -0
- package/src/components/Carousel/Carousel.vue +191 -0
- package/src/components/Chart/Chart.scss +109 -0
- package/src/components/Chart/Chart.vue +209 -0
- package/src/components/Checkbox/Checkbox.scss +148 -0
- package/src/components/Checkbox/Checkbox.vue +75 -0
- package/src/components/Chip/Chip.scss +83 -0
- package/src/components/Chip/Chip.vue +73 -0
- package/src/components/ColorPicker/ColorPicker.scss +244 -0
- package/src/components/ColorPicker/ColorPicker.vue +411 -0
- package/src/components/Column/Column.scss +87 -0
- package/src/components/Column/Column.vue +45 -0
- package/src/components/ColumnGroup/ColumnGroup.scss +41 -0
- package/src/components/ColumnGroup/ColumnGroup.vue +27 -0
- package/src/components/ColumnGroup/ColumnGroupRow.vue +18 -0
- package/src/components/CommandPalette/CommandPalette.scss +143 -0
- package/src/components/CommandPalette/CommandPalette.vue +165 -0
- package/src/components/ConfirmDialog/ConfirmDialog.scss +177 -0
- package/src/components/ConfirmDialog/ConfirmDialog.vue +162 -0
- package/src/components/ConfirmPopup/ConfirmPopup.scss +180 -0
- package/src/components/ConfirmPopup/ConfirmPopup.vue +185 -0
- package/src/components/ContextMenu/ContextMenu.scss +171 -0
- package/src/components/ContextMenu/ContextMenu.vue +383 -0
- package/src/components/DataTable/DataTable.scss +162 -0
- package/src/components/DataTable/DataTable.vue +225 -0
- package/src/components/DataView/DataView.scss +149 -0
- package/src/components/DataView/DataView.vue +172 -0
- package/src/components/DatePicker/DatePicker.scss +71 -0
- package/src/components/DatePicker/DatePicker.vue +121 -0
- package/src/components/Dialog/Dialog.scss +161 -0
- package/src/components/Dialog/Dialog.vue +245 -0
- package/src/components/Divider/Divider.scss +147 -0
- package/src/components/Divider/Divider.vue +49 -0
- package/src/components/Dock/Dock.scss +221 -0
- package/src/components/Dock/Dock.vue +107 -0
- package/src/components/Drawer/Drawer.scss +220 -0
- package/src/components/Drawer/Drawer.vue +137 -0
- package/src/components/Dropdown/Dropdown.scss +218 -0
- package/src/components/Dropdown/Dropdown.vue +313 -0
- package/src/components/Editor/Editor.scss +156 -0
- package/src/components/Editor/Editor.vue +253 -0
- package/src/components/FAQ/FAQ.scss +24 -0
- package/src/components/FAQ/FAQ.vue +28 -0
- package/src/components/FeatureGrid/FeatureGrid.scss +92 -0
- package/src/components/FeatureGrid/FeatureGrid.vue +39 -0
- package/src/components/FieldSet/FieldSet.scss +97 -0
- package/src/components/FieldSet/FieldSet.vue +70 -0
- package/src/components/FileUpload/FileUpload.scss +137 -0
- package/src/components/FileUpload/FileUpload.vue +183 -0
- package/src/components/Footer/Footer.scss +95 -0
- package/src/components/Footer/Footer.vue +59 -0
- package/src/components/Form/Form.scss +72 -0
- package/src/components/Form/Form.vue +30 -0
- package/src/components/Form/FormField.vue +42 -0
- package/src/components/Galleria/Galleria.scss +295 -0
- package/src/components/Galleria/Galleria.vue +274 -0
- package/src/components/Hero/Hero.scss +116 -0
- package/src/components/Hero/Hero.vue +57 -0
- package/src/components/Image/Image.scss +129 -0
- package/src/components/Image/Image.vue +117 -0
- package/src/components/ImageCompare/ImageCompare.scss +97 -0
- package/src/components/ImageCompare/ImageCompare.vue +66 -0
- package/src/components/InPlace/InPlace.scss +97 -0
- package/src/components/InPlace/InPlace.vue +107 -0
- package/src/components/InlineMessage/InlineMessage.scss +69 -0
- package/src/components/InlineMessage/InlineMessage.vue +47 -0
- package/src/components/InputChips/InputChips.scss +165 -0
- package/src/components/InputChips/InputChips.vue +169 -0
- package/src/components/InputGroup/InputGroup.scss +57 -0
- package/src/components/InputGroup/InputGroup.vue +22 -0
- package/src/components/InputGroupAddon/InputGroupAddon.scss +28 -0
- package/src/components/InputGroupAddon/InputGroupAddon.vue +22 -0
- package/src/components/InputIcon/InputIcon.scss +58 -0
- package/src/components/InputIcon/InputIcon.vue +28 -0
- package/src/components/InputMask/InputMask.scss +65 -0
- package/src/components/InputMask/InputMask.vue +268 -0
- package/src/components/InputNumber/InputNumber.scss +122 -0
- package/src/components/InputNumber/InputNumber.vue +150 -0
- package/src/components/InputOtp/InputOtp.scss +88 -0
- package/src/components/InputOtp/InputOtp.vue +230 -0
- package/src/components/InputSwitch/InputSwitch.scss +131 -0
- package/src/components/InputSwitch/InputSwitch.vue +49 -0
- package/src/components/InputText/InputText.scss +61 -0
- package/src/components/InputText/InputText.vue +71 -0
- package/src/components/Knob/Knob.scss +92 -0
- package/src/components/Knob/Knob.vue +252 -0
- package/src/components/ListBox/ListBox.scss +152 -0
- package/src/components/ListBox/ListBox.vue +198 -0
- package/src/components/LogoCloud/LogoCloud.scss +64 -0
- package/src/components/LogoCloud/LogoCloud.vue +35 -0
- package/src/components/MegaMenu/MegaMenu.scss +280 -0
- package/src/components/MegaMenu/MegaMenu.vue +218 -0
- package/src/components/Menu/Menu.scss +102 -0
- package/src/components/Menu/Menu.vue +221 -0
- package/src/components/MenuBar/MenuBar.scss +208 -0
- package/src/components/MenuBar/MenuBar.vue +306 -0
- package/src/components/Message/Message.scss +126 -0
- package/src/components/Message/Message.vue +99 -0
- package/src/components/MeterGroup/MeterGroup.scss +105 -0
- package/src/components/MeterGroup/MeterGroup.vue +73 -0
- package/src/components/MultiSelect/MultiSelect.scss +239 -0
- package/src/components/MultiSelect/MultiSelect.vue +296 -0
- package/src/components/OrderList/OrderList.scss +133 -0
- package/src/components/OrderList/OrderList.vue +267 -0
- package/src/components/OrganizationChart/OrganizationChart.scss +145 -0
- package/src/components/OrganizationChart/OrganizationChart.vue +220 -0
- package/src/components/OverlayPanel/OverlayPanel.scss +69 -0
- package/src/components/OverlayPanel/OverlayPanel.vue +180 -0
- package/src/components/Paginator/Paginator.scss +130 -0
- package/src/components/Paginator/Paginator.vue +212 -0
- package/src/components/Panel/Panel.scss +113 -0
- package/src/components/Panel/Panel.vue +89 -0
- package/src/components/PanelMenu/PanelMenu.scss +211 -0
- package/src/components/PanelMenu/PanelMenu.vue +295 -0
- package/src/components/ParticleBackground/ParticleBackground.vue +310 -0
- package/src/components/PickList/PickList.scss +126 -0
- package/src/components/PickList/PickList.vue +249 -0
- package/src/components/PopOver/PopOver.scss +112 -0
- package/src/components/PopOver/PopOver.vue +254 -0
- package/src/components/PricingTable/PricingCard.vue +33 -0
- package/src/components/PricingTable/PricingTable.scss +133 -0
- package/src/components/PricingTable/PricingTable.vue +21 -0
- package/src/components/ProgressBar/ProgressBar.scss +58 -0
- package/src/components/ProgressBar/ProgressBar.vue +48 -0
- package/src/components/ProgressSpinner/ProgressSpinner.scss +48 -0
- package/src/components/ProgressSpinner/ProgressSpinner.vue +53 -0
- package/src/components/RadioButton/RadioButton.scss +148 -0
- package/src/components/RadioButton/RadioButton.vue +52 -0
- package/src/components/Rating/Rating.scss +109 -0
- package/src/components/Rating/Rating.vue +136 -0
- package/src/components/Row/Row.scss +38 -0
- package/src/components/Row/Row.vue +30 -0
- package/src/components/ScrollPanel/ScrollPanel.scss +90 -0
- package/src/components/ScrollPanel/ScrollPanel.vue +284 -0
- package/src/components/ScrollTop/ScrollTop.scss +59 -0
- package/src/components/ScrollTop/ScrollTop.vue +99 -0
- package/src/components/Section/Section.scss +58 -0
- package/src/components/Section/Section.vue +39 -0
- package/src/components/Select/Select.scss +98 -0
- package/src/components/Select/Select.vue +92 -0
- package/src/components/SelectButton/SelectButton.scss +65 -0
- package/src/components/SelectButton/SelectButton.vue +144 -0
- package/src/components/Sidebar/Sidebar.scss +170 -0
- package/src/components/Sidebar/Sidebar.vue +137 -0
- package/src/components/Skeleton/Skeleton.scss +43 -0
- package/src/components/Skeleton/Skeleton.vue +57 -0
- package/src/components/Slider/Slider.scss +103 -0
- package/src/components/Slider/Slider.vue +65 -0
- package/src/components/SpeedDial/SpeedDial.scss +217 -0
- package/src/components/SpeedDial/SpeedDial.vue +196 -0
- package/src/components/SplitButton/SplitButton.scss +264 -0
- package/src/components/SplitButton/SplitButton.vue +172 -0
- package/src/components/Splitter/Splitter.scss +95 -0
- package/src/components/Splitter/Splitter.vue +191 -0
- package/src/components/Splitter/SplitterPanel.vue +125 -0
- package/src/components/Stats/Stats.scss +54 -0
- package/src/components/Stats/Stats.vue +28 -0
- package/src/components/Steps/Steps.scss +164 -0
- package/src/components/Steps/Steps.vue +100 -0
- package/src/components/TabMenu/TabMenu.scss +106 -0
- package/src/components/TabMenu/TabMenu.vue +174 -0
- package/src/components/Tabs/TabPanel.vue +41 -0
- package/src/components/Tabs/Tabs.scss +82 -0
- package/src/components/Tabs/Tabs.vue +162 -0
- package/src/components/Tag/Tag.scss +73 -0
- package/src/components/Tag/Tag.vue +37 -0
- package/src/components/Terminal/Terminal.scss +80 -0
- package/src/components/Terminal/Terminal.vue +113 -0
- package/src/components/Testimonial/Testimonial.scss +80 -0
- package/src/components/Testimonial/Testimonial.vue +29 -0
- package/src/components/Textarea/Textarea.scss +65 -0
- package/src/components/Textarea/Textarea.vue +101 -0
- package/src/components/TieredMenu/TieredMenu.scss +146 -0
- package/src/components/TieredMenu/TieredMenu.vue +270 -0
- package/src/components/TieredMenu/TieredMenuSub.vue +132 -0
- package/src/components/Timeline/Timeline.scss +190 -0
- package/src/components/Timeline/Timeline.vue +79 -0
- package/src/components/Toast/Toast.scss +284 -0
- package/src/components/Toast/Toast.vue +162 -0
- package/src/components/ToggleButton/ToggleButton.scss +99 -0
- package/src/components/ToggleButton/ToggleButton.vue +65 -0
- package/src/components/ToggleSwitch/ToggleSwitch.scss +68 -0
- package/src/components/ToggleSwitch/ToggleSwitch.vue +44 -0
- package/src/components/Toolbar/Toolbar.scss +37 -0
- package/src/components/Toolbar/Toolbar.vue +23 -0
- package/src/components/Tooltip/Tooltip.scss +114 -0
- package/src/components/Tooltip/Tooltip.vue +169 -0
- package/src/components/Tree/Tree.scss +164 -0
- package/src/components/Tree/Tree.vue +273 -0
- package/src/components/TreeSelect/TreeSelect.scss +238 -0
- package/src/components/TreeSelect/TreeSelect.vue +401 -0
- package/src/components/TreeTable/TreeTable.scss +172 -0
- package/src/components/TreeTable/TreeTable.vue +285 -0
- package/src/components/VirtualScroller/VirtualScroller.scss +107 -0
- package/src/components/VirtualScroller/VirtualScroller.vue +234 -0
- package/src/scss/fonts.scss +63 -0
- package/src/scss/mixins/accent-gradient.scss +43 -0
- package/src/scss/mixins/border.scss +28 -0
- package/src/scss/mixins/breakpoint.scss +80 -0
- package/src/scss/mixins/container.scss +33 -0
- package/src/scss/mixins/elevation.scss +43 -0
- package/src/scss/mixins/grid.scss +23 -0
- package/src/scss/mixins/levitation.scss +15 -0
- package/src/scss/mixins/list.scss +5 -0
- package/src/scss/mixins/surface-atmospheric.scss +93 -0
- package/src/scss/mixins/surface.scss +19 -0
- package/src/scss/mixins/typography.scss +91 -0
- package/src/scss/utility-classes/utility-classes-spacing.scss +34 -0
- package/src/scss/utility-classes/utility-classes-typography.scss +114 -0
- package/tokens/components/accordion.json +127 -0
- package/tokens/components/autocomplete.json +238 -0
- package/tokens/components/avatar.json +220 -0
- package/tokens/components/badge.json +119 -0
- package/tokens/components/block-ui.json +40 -0
- package/tokens/components/breadcrumb.json +57 -0
- package/tokens/components/button.json +395 -0
- package/tokens/components/calendar.json +260 -0
- package/tokens/components/card.json +157 -0
- package/tokens/components/carousel.json +154 -0
- package/tokens/components/chart.json +132 -0
- package/tokens/components/checkbox.json +130 -0
- package/tokens/components/chip.json +100 -0
- package/tokens/components/color-picker.json +196 -0
- package/tokens/components/column-group.json +45 -0
- package/tokens/components/column.json +109 -0
- package/tokens/components/confirm-dialog.json +141 -0
- package/tokens/components/confirm-popup.json +101 -0
- package/tokens/components/context-menu.json +168 -0
- package/tokens/components/data-table.json +157 -0
- package/tokens/components/data-view.json +172 -0
- package/tokens/components/dialog.json +151 -0
- package/tokens/components/divider.json +45 -0
- package/tokens/components/dock.json +173 -0
- package/tokens/components/drawer.json +163 -0
- package/tokens/components/dropdown.json +230 -0
- package/tokens/components/editor.json +170 -0
- package/tokens/components/field-set.json +115 -0
- package/tokens/components/file-upload.json +193 -0
- package/tokens/components/galleria.json +235 -0
- package/tokens/components/image-compare.json +74 -0
- package/tokens/components/image.json +71 -0
- package/tokens/components/in-place.json +100 -0
- package/tokens/components/inline-message.json +107 -0
- package/tokens/components/input-chips.json +187 -0
- package/tokens/components/input-group-addon.json +47 -0
- package/tokens/components/input-group.json +21 -0
- package/tokens/components/input-icon.json +38 -0
- package/tokens/components/input-mask.json +136 -0
- package/tokens/components/input-number.json +144 -0
- package/tokens/components/input-otp.json +138 -0
- package/tokens/components/input-switch.json +108 -0
- package/tokens/components/input-text.json +136 -0
- package/tokens/components/knob.json +119 -0
- package/tokens/components/listbox.json +166 -0
- package/tokens/components/mega-menu.json +283 -0
- package/tokens/components/menu.json +145 -0
- package/tokens/components/menubar.json +152 -0
- package/tokens/components/message.json +151 -0
- package/tokens/components/meter-group.json +108 -0
- package/tokens/components/multi-select.json +244 -0
- package/tokens/components/order-list.json +193 -0
- package/tokens/components/organization-chart.json +188 -0
- package/tokens/components/overlay-panel.json +94 -0
- package/tokens/components/paginator.json +186 -0
- package/tokens/components/panel.json +120 -0
- package/tokens/components/panelmenu.json +190 -0
- package/tokens/components/picklist.json +187 -0
- package/tokens/components/popover.json +65 -0
- package/tokens/components/progress-bar.json +33 -0
- package/tokens/components/progress-spinner.json +38 -0
- package/tokens/components/radio.json +125 -0
- package/tokens/components/rating.json +76 -0
- package/tokens/components/row.json +62 -0
- package/tokens/components/scroll-panel.json +69 -0
- package/tokens/components/scroll-top.json +84 -0
- package/tokens/components/select-button.json +145 -0
- package/tokens/components/select.json +190 -0
- package/tokens/components/sidebar.json +146 -0
- package/tokens/components/skeleton.json +26 -0
- package/tokens/components/slider.json +82 -0
- package/tokens/components/speed-dial.json +144 -0
- package/tokens/components/split-button.json +316 -0
- package/tokens/components/splitter.json +88 -0
- package/tokens/components/steps.json +154 -0
- package/tokens/components/tabmenu.json +103 -0
- package/tokens/components/tabs.json +97 -0
- package/tokens/components/tag.json +122 -0
- package/tokens/components/terminal.json +100 -0
- package/tokens/components/textarea.json +96 -0
- package/tokens/components/tieredmenu.json +142 -0
- package/tokens/components/timeline.json +129 -0
- package/tokens/components/toast.json +281 -0
- package/tokens/components/toggle-button.json +220 -0
- package/tokens/components/toggle-switch.json +95 -0
- package/tokens/components/toolbar.json +41 -0
- package/tokens/components/tooltip.json +60 -0
- package/tokens/components/tree-select.json +224 -0
- package/tokens/components/tree.json +153 -0
- package/tokens/components/treetable.json +155 -0
- package/tokens/components/virtualscroller.json +95 -0
- package/tokens/primitives/color.json +137 -0
- package/tokens/primitives/radius.json +12 -0
- package/tokens/primitives/shadow.json +29 -0
- package/tokens/primitives/spacing.json +15 -0
- package/tokens/semantics/color.json +81 -0
- package/tokens/semantics/radius.json +10 -0
- package/tokens/semantics/shadow.json +9 -0
- package/tokens/semantics/spacing.json +24 -0
- package/tokens/themes/dark.json +7 -0
- package/tokens/themes/light.json +7 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
@use "../../../dist/scss/tokens" as *;
|
|
2
|
+
@use "../../scss/mixins/elevation" as *;
|
|
3
|
+
|
|
4
|
+
$c: command-palette;
|
|
5
|
+
|
|
6
|
+
.#{$c}__overlay {
|
|
7
|
+
position: fixed;
|
|
8
|
+
inset: 0;
|
|
9
|
+
z-index: 9999;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
padding-top: 20vh;
|
|
14
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
15
|
+
backdrop-filter: blur(4px);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.#{$c} {
|
|
19
|
+
@include elevation(4);
|
|
20
|
+
width: 100%;
|
|
21
|
+
max-width: 560px;
|
|
22
|
+
// Component token overrides
|
|
23
|
+
background: var(--surface-overlay, #1e1e2e);
|
|
24
|
+
border-color: var(--surface-border, rgba(255, 255, 255, 0.1));
|
|
25
|
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.#{$c}__search {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
gap: 0.75rem;
|
|
33
|
+
padding: 0.875rem 1rem;
|
|
34
|
+
border-bottom: 1px solid var(--surface-border, rgba(255, 255, 255, 0.1));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.#{$c}__search-icon {
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
width: 1.25rem;
|
|
40
|
+
height: 1.25rem;
|
|
41
|
+
color: var(--text-muted, rgba(255, 255, 255, 0.5));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.#{$c}__input {
|
|
45
|
+
flex: 1;
|
|
46
|
+
border: none;
|
|
47
|
+
outline: none;
|
|
48
|
+
background: transparent;
|
|
49
|
+
color: var(--text-primary, #fff);
|
|
50
|
+
font-size: 1rem;
|
|
51
|
+
|
|
52
|
+
&::placeholder {
|
|
53
|
+
color: var(--text-muted, rgba(255, 255, 255, 0.4));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.#{$c}__kbd {
|
|
58
|
+
flex-shrink: 0;
|
|
59
|
+
padding: 0.125rem 0.375rem;
|
|
60
|
+
border-radius: 0.25rem;
|
|
61
|
+
border: 1px solid var(--surface-border, rgba(255, 255, 255, 0.15));
|
|
62
|
+
background: var(--surface-ground, rgba(255, 255, 255, 0.05));
|
|
63
|
+
color: var(--text-muted, rgba(255, 255, 255, 0.5));
|
|
64
|
+
font-size: 0.75rem;
|
|
65
|
+
font-family: inherit;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.#{$c}__list {
|
|
69
|
+
max-height: 320px;
|
|
70
|
+
overflow-y: auto;
|
|
71
|
+
padding: 0.5rem;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.#{$c}__group-label {
|
|
75
|
+
padding: 0.5rem 0.75rem 0.25rem;
|
|
76
|
+
font-size: 0.75rem;
|
|
77
|
+
font-weight: 600;
|
|
78
|
+
color: var(--text-muted, rgba(255, 255, 255, 0.5));
|
|
79
|
+
text-transform: uppercase;
|
|
80
|
+
letter-spacing: 0.05em;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.#{$c}__item {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
gap: 0.75rem;
|
|
87
|
+
padding: 0.625rem 0.75rem;
|
|
88
|
+
border-radius: 0.5rem;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
color: var(--text-primary, #fff);
|
|
91
|
+
transition: background-color 0.1s ease;
|
|
92
|
+
|
|
93
|
+
&--active {
|
|
94
|
+
background-color: var(--surface-hover, rgba(255, 255, 255, 0.08));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.#{$c}__item-icon {
|
|
99
|
+
flex-shrink: 0;
|
|
100
|
+
font-size: 1.125rem;
|
|
101
|
+
opacity: 0.7;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.#{$c}__item-label {
|
|
105
|
+
flex: 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.#{$c}__item-shortcut {
|
|
109
|
+
flex-shrink: 0;
|
|
110
|
+
padding: 0.125rem 0.375rem;
|
|
111
|
+
border-radius: 0.25rem;
|
|
112
|
+
border: 1px solid var(--surface-border, rgba(255, 255, 255, 0.15));
|
|
113
|
+
background: var(--surface-ground, rgba(255, 255, 255, 0.05));
|
|
114
|
+
color: var(--text-muted, rgba(255, 255, 255, 0.5));
|
|
115
|
+
font-size: 0.75rem;
|
|
116
|
+
font-family: inherit;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.#{$c}__empty {
|
|
120
|
+
padding: 2rem;
|
|
121
|
+
text-align: center;
|
|
122
|
+
color: var(--text-muted, rgba(255, 255, 255, 0.5));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Transitions
|
|
126
|
+
.command-palette-fade-enter-active,
|
|
127
|
+
.command-palette-fade-leave-active {
|
|
128
|
+
transition: opacity 0.15s ease;
|
|
129
|
+
}
|
|
130
|
+
.command-palette-fade-enter-from,
|
|
131
|
+
.command-palette-fade-leave-to {
|
|
132
|
+
opacity: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.command-palette-scale-enter-active,
|
|
136
|
+
.command-palette-scale-leave-active {
|
|
137
|
+
transition: transform 0.15s ease, opacity 0.15s ease;
|
|
138
|
+
}
|
|
139
|
+
.command-palette-scale-enter-from,
|
|
140
|
+
.command-palette-scale-leave-to {
|
|
141
|
+
transform: scale(0.95);
|
|
142
|
+
opacity: 0;
|
|
143
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<Transition name="command-palette-fade">
|
|
4
|
+
<div
|
|
5
|
+
v-if="open"
|
|
6
|
+
class="command-palette__overlay"
|
|
7
|
+
@click="onOverlayClick"
|
|
8
|
+
@keydown.escape.prevent="close"
|
|
9
|
+
>
|
|
10
|
+
<Transition name="command-palette-scale">
|
|
11
|
+
<div
|
|
12
|
+
v-if="open"
|
|
13
|
+
ref="paletteRef"
|
|
14
|
+
class="command-palette"
|
|
15
|
+
role="dialog"
|
|
16
|
+
aria-modal="true"
|
|
17
|
+
aria-label="Command palette"
|
|
18
|
+
@click.stop
|
|
19
|
+
@keydown="onKeyDown"
|
|
20
|
+
>
|
|
21
|
+
<div class="command-palette__search">
|
|
22
|
+
<svg class="command-palette__search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
23
|
+
<circle cx="11" cy="11" r="8" /><line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
24
|
+
</svg>
|
|
25
|
+
<input
|
|
26
|
+
ref="inputRef"
|
|
27
|
+
v-model="query"
|
|
28
|
+
class="command-palette__input"
|
|
29
|
+
type="text"
|
|
30
|
+
:placeholder="placeholder"
|
|
31
|
+
aria-label="Search commands"
|
|
32
|
+
autocomplete="off"
|
|
33
|
+
/>
|
|
34
|
+
<kbd class="command-palette__kbd">ESC</kbd>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div v-if="filteredCommands.length > 0" class="command-palette__list" role="listbox">
|
|
38
|
+
<template v-for="(group, gi) in groupedCommands" :key="group.label ?? gi">
|
|
39
|
+
<div v-if="group.label" class="command-palette__group-label">{{ group.label }}</div>
|
|
40
|
+
<div
|
|
41
|
+
v-for="cmd in group.items"
|
|
42
|
+
:key="cmd.id"
|
|
43
|
+
class="command-palette__item"
|
|
44
|
+
:class="{ 'command-palette__item--active': cmd.id === activeId }"
|
|
45
|
+
role="option"
|
|
46
|
+
:aria-selected="cmd.id === activeId"
|
|
47
|
+
@click="selectCommand(cmd)"
|
|
48
|
+
@mouseenter="activeId = cmd.id"
|
|
49
|
+
>
|
|
50
|
+
<i v-if="cmd.icon" :class="cmd.icon" class="command-palette__item-icon" aria-hidden="true"></i>
|
|
51
|
+
<span class="command-palette__item-label">{{ cmd.label }}</span>
|
|
52
|
+
<kbd v-if="cmd.shortcut" class="command-palette__item-shortcut">{{ cmd.shortcut }}</kbd>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div v-else class="command-palette__empty">
|
|
58
|
+
No results found
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</Transition>
|
|
62
|
+
</div>
|
|
63
|
+
</Transition>
|
|
64
|
+
</Teleport>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<style src="./CommandPalette.scss"></style>
|
|
68
|
+
|
|
69
|
+
<script setup lang="ts">
|
|
70
|
+
import type { CommandPaletteProps, CommandPaletteCommand } from '../../types';
|
|
71
|
+
import { computed, ref, watch, nextTick, onMounted, onUnmounted } from 'vue';
|
|
72
|
+
|
|
73
|
+
defineOptions({ name: 'FtpCommandPalette' });
|
|
74
|
+
|
|
75
|
+
const props = withDefaults(defineProps<CommandPaletteProps>(), {
|
|
76
|
+
placeholder: 'Type a command or search…',
|
|
77
|
+
open: false,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const emit = defineEmits<{
|
|
81
|
+
(e: 'select', command: CommandPaletteCommand): void
|
|
82
|
+
(e: 'close'): void
|
|
83
|
+
(e: 'update:open', value: boolean): void
|
|
84
|
+
}>();
|
|
85
|
+
|
|
86
|
+
const paletteRef = ref<HTMLElement | null>(null);
|
|
87
|
+
const inputRef = ref<HTMLInputElement | null>(null);
|
|
88
|
+
const query = ref('');
|
|
89
|
+
const activeId = ref<string | null>(null);
|
|
90
|
+
|
|
91
|
+
const filteredCommands = computed(() => {
|
|
92
|
+
const q = query.value.toLowerCase().trim();
|
|
93
|
+
if (!q) return props.commands;
|
|
94
|
+
return props.commands.filter(c => c.label.toLowerCase().includes(q));
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const groupedCommands = computed(() => {
|
|
98
|
+
const groups = new Map<string | undefined, CommandPaletteCommand[]>();
|
|
99
|
+
for (const cmd of filteredCommands.value) {
|
|
100
|
+
const key = cmd.group;
|
|
101
|
+
if (!groups.has(key)) groups.set(key, []);
|
|
102
|
+
groups.get(key)!.push(cmd);
|
|
103
|
+
}
|
|
104
|
+
return Array.from(groups.entries()).map(([label, items]) => ({ label, items }));
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const close = () => {
|
|
108
|
+
emit('update:open', false);
|
|
109
|
+
emit('close');
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const selectCommand = (cmd: CommandPaletteCommand) => {
|
|
113
|
+
emit('select', cmd);
|
|
114
|
+
if (cmd.action) cmd.action();
|
|
115
|
+
close();
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const onOverlayClick = () => close();
|
|
119
|
+
|
|
120
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
121
|
+
const cmds = filteredCommands.value;
|
|
122
|
+
if (!cmds.length) return;
|
|
123
|
+
|
|
124
|
+
const currentIndex = cmds.findIndex(c => c.id === activeId.value);
|
|
125
|
+
|
|
126
|
+
if (event.key === 'ArrowDown') {
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
const next = currentIndex < cmds.length - 1 ? currentIndex + 1 : 0;
|
|
129
|
+
activeId.value = cmds[next].id;
|
|
130
|
+
} else if (event.key === 'ArrowUp') {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
const prev = currentIndex > 0 ? currentIndex - 1 : cmds.length - 1;
|
|
133
|
+
activeId.value = cmds[prev].id;
|
|
134
|
+
} else if (event.key === 'Enter') {
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
const cmd = cmds.find(c => c.id === activeId.value);
|
|
137
|
+
if (cmd) selectCommand(cmd);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const onGlobalKeyDown = (event: KeyboardEvent) => {
|
|
142
|
+
if ((event.metaKey || event.ctrlKey) && event.key === 'k') {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
emit('update:open', !props.open);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
watch(() => props.open, async (val) => {
|
|
149
|
+
if (val) {
|
|
150
|
+
query.value = '';
|
|
151
|
+
activeId.value = filteredCommands.value[0]?.id ?? null;
|
|
152
|
+
await nextTick();
|
|
153
|
+
inputRef.value?.focus();
|
|
154
|
+
document.body.style.overflow = 'hidden';
|
|
155
|
+
} else {
|
|
156
|
+
document.body.style.overflow = '';
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
onMounted(() => document.addEventListener('keydown', onGlobalKeyDown));
|
|
161
|
+
onUnmounted(() => {
|
|
162
|
+
document.removeEventListener('keydown', onGlobalKeyDown);
|
|
163
|
+
document.body.style.overflow = '';
|
|
164
|
+
});
|
|
165
|
+
</script>
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
@use "../../../dist/scss/tokens" as *;
|
|
2
|
+
|
|
3
|
+
$c: confirm-dialog;
|
|
4
|
+
|
|
5
|
+
// Overlay backdrop
|
|
6
|
+
.#{$c}__overlay {
|
|
7
|
+
position: fixed;
|
|
8
|
+
inset: 0;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
z-index: var(--confirmDialog-zIndex-overlay, $confirmDialog-zIndex-overlay);
|
|
13
|
+
background-color: var(--confirmDialog-overlay-background, $confirmDialog-overlay-background);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Dialog container
|
|
17
|
+
.#{$c} {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
background-color: var(--confirmDialog-background-default, $confirmDialog-background-default);
|
|
22
|
+
border-radius: var(--confirmDialog-radius, $confirmDialog-radius);
|
|
23
|
+
box-shadow: var(--confirmDialog-shadow, $confirmDialog-shadow);
|
|
24
|
+
border: var(--confirmDialog-border-width, $confirmDialog-border-width) solid var(--confirmDialog-border-color, $confirmDialog-border-color);
|
|
25
|
+
width: var(--confirmDialog-width, $confirmDialog-width);
|
|
26
|
+
max-width: 95vw;
|
|
27
|
+
z-index: var(--confirmDialog-zIndex-dialog, $confirmDialog-zIndex-dialog);
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Header section
|
|
32
|
+
.#{$c}__header {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
padding: var(--confirmDialog-padding-header, $confirmDialog-padding-header);
|
|
36
|
+
background-color: var(--confirmDialog-header-background, $confirmDialog-header-background);
|
|
37
|
+
border-bottom: 1px solid var(--confirmDialog-header-borderColor, $confirmDialog-header-borderColor);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.#{$c}__title {
|
|
41
|
+
font-size: 18px;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
color: var(--confirmDialog-header-title-color, $confirmDialog-header-title-color);
|
|
44
|
+
margin: 0;
|
|
45
|
+
line-height: 1.4;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Content section
|
|
49
|
+
.#{$c}__content {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: var(--confirmDialog-gap-content, $confirmDialog-gap-content);
|
|
54
|
+
padding: var(--confirmDialog-padding-content, $confirmDialog-padding-content);
|
|
55
|
+
text-align: center;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Icon
|
|
59
|
+
.#{$c}__icon {
|
|
60
|
+
width: var(--confirmDialog-icon-size, $confirmDialog-icon-size);
|
|
61
|
+
height: var(--confirmDialog-icon-size, $confirmDialog-icon-size);
|
|
62
|
+
flex-shrink: 0;
|
|
63
|
+
|
|
64
|
+
svg {
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.#{$c}__icon--warning {
|
|
71
|
+
color: var(--confirmDialog-icon-color-warning, $confirmDialog-icon-color-warning);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.#{$c}__icon--danger {
|
|
75
|
+
color: var(--confirmDialog-icon-color-danger, $confirmDialog-icon-color-danger);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.#{$c}__icon--info {
|
|
79
|
+
color: var(--confirmDialog-icon-color-info, $confirmDialog-icon-color-info);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Message
|
|
83
|
+
.#{$c}__message {
|
|
84
|
+
margin: 0;
|
|
85
|
+
color: var(--confirmDialog-message-color, $confirmDialog-message-color);
|
|
86
|
+
font-size: var(--confirmDialog-message-fontSize, $confirmDialog-message-fontSize);
|
|
87
|
+
line-height: 1.5;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Footer section
|
|
91
|
+
.#{$c}__footer {
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
gap: var(--confirmDialog-gap-buttons, $confirmDialog-gap-buttons);
|
|
96
|
+
padding: var(--confirmDialog-padding-footer, $confirmDialog-padding-footer);
|
|
97
|
+
border-top: 1px solid var(--confirmDialog-header-borderColor, $confirmDialog-header-borderColor);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Buttons
|
|
101
|
+
.#{$c}__button {
|
|
102
|
+
display: inline-flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
padding: var(--inset-xs, $inset-xs) var(--inset-m, $inset-m);
|
|
106
|
+
font-size: 14px;
|
|
107
|
+
font-weight: 600;
|
|
108
|
+
border-radius: var(--radius-default, $radius-default);
|
|
109
|
+
border: 1px solid transparent;
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
|
|
112
|
+
min-width: 80px;
|
|
113
|
+
|
|
114
|
+
&:focus-visible {
|
|
115
|
+
outline: 2px solid var(--focus-ring, $focus-ring);
|
|
116
|
+
outline-offset: 2px;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.#{$c}__button--reject {
|
|
121
|
+
background-color: transparent;
|
|
122
|
+
border-color: var(--border-default, $border-default);
|
|
123
|
+
color: var(--text-default, $text-default);
|
|
124
|
+
|
|
125
|
+
&:hover {
|
|
126
|
+
background-color: var(--surface-muted, $surface-muted);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&:active {
|
|
130
|
+
background-color: var(--surface-muted, $surface-muted);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.#{$c}__button--accept {
|
|
135
|
+
background-color: var(--intent-action-default, $intent-action-default);
|
|
136
|
+
border-color: var(--intent-action-default, $intent-action-default);
|
|
137
|
+
color: var(--text-inverse, $text-inverse);
|
|
138
|
+
|
|
139
|
+
&:hover {
|
|
140
|
+
background-color: var(--intent-action-hover, $intent-action-hover);
|
|
141
|
+
border-color: var(--intent-action-hover, $intent-action-hover);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&:active {
|
|
145
|
+
background-color: var(--intent-action-active, $intent-action-active);
|
|
146
|
+
border-color: var(--intent-action-active, $intent-action-active);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Transition animations
|
|
151
|
+
.#{$c}-fade-enter-active,
|
|
152
|
+
.#{$c}-fade-leave-active {
|
|
153
|
+
transition: opacity 0.2s ease;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.#{$c}-fade-enter-from,
|
|
157
|
+
.#{$c}-fade-leave-to {
|
|
158
|
+
opacity: 0;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.#{$c}-scale-enter-active {
|
|
162
|
+
transition: transform 0.2s ease, opacity 0.2s ease;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.#{$c}-scale-leave-active {
|
|
166
|
+
transition: transform 0.15s ease, opacity 0.15s ease;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.#{$c}-scale-enter-from {
|
|
170
|
+
transform: scale(0.95);
|
|
171
|
+
opacity: 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.#{$c}-scale-leave-to {
|
|
175
|
+
transform: scale(0.95);
|
|
176
|
+
opacity: 0;
|
|
177
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<Transition name="confirm-dialog-fade">
|
|
4
|
+
<div
|
|
5
|
+
v-if="visible"
|
|
6
|
+
class="confirm-dialog__overlay"
|
|
7
|
+
@click="onOverlayClick"
|
|
8
|
+
@keydown.escape="onEscapeKey"
|
|
9
|
+
>
|
|
10
|
+
<Transition name="confirm-dialog-scale">
|
|
11
|
+
<div
|
|
12
|
+
v-if="visible"
|
|
13
|
+
ref="dialogRef"
|
|
14
|
+
class="confirm-dialog"
|
|
15
|
+
role="alertdialog"
|
|
16
|
+
aria-modal="true"
|
|
17
|
+
:aria-labelledby="headerId"
|
|
18
|
+
:aria-describedby="messageId"
|
|
19
|
+
@click.stop
|
|
20
|
+
>
|
|
21
|
+
<div v-if="header" class="confirm-dialog__header">
|
|
22
|
+
<span :id="headerId" class="confirm-dialog__title">{{ header }}</span>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div class="confirm-dialog__content">
|
|
26
|
+
<div v-if="icon" class="confirm-dialog__icon" :class="iconClass">
|
|
27
|
+
<svg
|
|
28
|
+
v-if="icon === 'warning'"
|
|
29
|
+
viewBox="0 0 24 24"
|
|
30
|
+
fill="none"
|
|
31
|
+
stroke="currentColor"
|
|
32
|
+
stroke-width="2"
|
|
33
|
+
stroke-linecap="round"
|
|
34
|
+
stroke-linejoin="round"
|
|
35
|
+
>
|
|
36
|
+
<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />
|
|
37
|
+
<line x1="12" y1="9" x2="12" y2="13" />
|
|
38
|
+
<line x1="12" y1="17" x2="12.01" y2="17" />
|
|
39
|
+
</svg>
|
|
40
|
+
<svg
|
|
41
|
+
v-else-if="icon === 'danger'"
|
|
42
|
+
viewBox="0 0 24 24"
|
|
43
|
+
fill="none"
|
|
44
|
+
stroke="currentColor"
|
|
45
|
+
stroke-width="2"
|
|
46
|
+
stroke-linecap="round"
|
|
47
|
+
stroke-linejoin="round"
|
|
48
|
+
>
|
|
49
|
+
<circle cx="12" cy="12" r="10" />
|
|
50
|
+
<line x1="15" y1="9" x2="9" y2="15" />
|
|
51
|
+
<line x1="9" y1="9" x2="15" y2="15" />
|
|
52
|
+
</svg>
|
|
53
|
+
<svg
|
|
54
|
+
v-else-if="icon === 'info'"
|
|
55
|
+
viewBox="0 0 24 24"
|
|
56
|
+
fill="none"
|
|
57
|
+
stroke="currentColor"
|
|
58
|
+
stroke-width="2"
|
|
59
|
+
stroke-linecap="round"
|
|
60
|
+
stroke-linejoin="round"
|
|
61
|
+
>
|
|
62
|
+
<circle cx="12" cy="12" r="10" />
|
|
63
|
+
<line x1="12" y1="16" x2="12" y2="12" />
|
|
64
|
+
<line x1="12" y1="8" x2="12.01" y2="8" />
|
|
65
|
+
</svg>
|
|
66
|
+
</div>
|
|
67
|
+
<p :id="messageId" class="confirm-dialog__message">{{ message }}</p>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div class="confirm-dialog__footer">
|
|
71
|
+
<button
|
|
72
|
+
type="button"
|
|
73
|
+
class="confirm-dialog__button confirm-dialog__button--reject"
|
|
74
|
+
@click="reject"
|
|
75
|
+
>
|
|
76
|
+
{{ rejectLabel }}
|
|
77
|
+
</button>
|
|
78
|
+
<button
|
|
79
|
+
type="button"
|
|
80
|
+
class="confirm-dialog__button confirm-dialog__button--accept"
|
|
81
|
+
@click="accept"
|
|
82
|
+
>
|
|
83
|
+
{{ acceptLabel }}
|
|
84
|
+
</button>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</Transition>
|
|
88
|
+
</div>
|
|
89
|
+
</Transition>
|
|
90
|
+
</Teleport>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<style src="./ConfirmDialog.scss"></style>
|
|
94
|
+
|
|
95
|
+
<script setup lang="ts">
|
|
96
|
+
import type { ConfirmDialogProps, ConfirmDialogEmits } from '../../types';
|
|
97
|
+
import { computed, watch, onUnmounted } from "vue";
|
|
98
|
+
|
|
99
|
+
defineOptions({ name: 'FtpConfirmDialog' });
|
|
100
|
+
|
|
101
|
+
const props = withDefaults(defineProps<ConfirmDialogProps>(), {
|
|
102
|
+
visible: false,
|
|
103
|
+
header: "Confirmation",
|
|
104
|
+
message: "Are you sure you want to proceed?",
|
|
105
|
+
icon: "warning",
|
|
106
|
+
acceptLabel: "Yes",
|
|
107
|
+
rejectLabel: "No",
|
|
108
|
+
dismissableMask: false,
|
|
109
|
+
closeOnEscape: true,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const emit = defineEmits(["update:visible", "accept", "reject"]);
|
|
113
|
+
|
|
114
|
+
const headerId = `confirm-dialog-header-${Math.random().toString(36).substr(2, 9)}`;
|
|
115
|
+
const messageId = `confirm-dialog-message-${Math.random().toString(36).substr(2, 9)}`;
|
|
116
|
+
|
|
117
|
+
const iconClass = computed(() => props.icon ? `confirm-dialog__icon--${props.icon}` : "");
|
|
118
|
+
|
|
119
|
+
const close = () => {
|
|
120
|
+
emit("update:visible", false);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const accept = () => {
|
|
124
|
+
emit("accept");
|
|
125
|
+
close();
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const reject = () => {
|
|
129
|
+
emit("reject");
|
|
130
|
+
close();
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const onOverlayClick = () => {
|
|
134
|
+
if (props.dismissableMask) {
|
|
135
|
+
reject();
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const onEscapeKey = (event: KeyboardEvent) => {
|
|
140
|
+
if (props.closeOnEscape && props.visible) {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
reject();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// Block scroll when dialog is open
|
|
147
|
+
watch(
|
|
148
|
+
() => props.visible,
|
|
149
|
+
(newValue) => {
|
|
150
|
+
if (newValue) {
|
|
151
|
+
document.body.style.overflow = "hidden";
|
|
152
|
+
} else {
|
|
153
|
+
document.body.style.overflow = "";
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// Cleanup on unmount
|
|
159
|
+
onUnmounted(() => {
|
|
160
|
+
document.body.style.overflow = "";
|
|
161
|
+
});
|
|
162
|
+
</script>
|