@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,191 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="splitter"
|
|
4
|
+
:class="additionalClasses"
|
|
5
|
+
:style="containerStyle"
|
|
6
|
+
>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<style src="./Splitter.scss"></style>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import type { SplitterProps, SplitterEmits } from '../../types';
|
|
15
|
+
import { computed, provide, ref, onMounted, onUnmounted } from "vue";
|
|
16
|
+
|
|
17
|
+
defineOptions({ name: 'FtpSplitter' });
|
|
18
|
+
|
|
19
|
+
const props = withDefaults(defineProps<SplitterProps>(), {
|
|
20
|
+
layout: "horizontal",
|
|
21
|
+
gutterSize: 10,
|
|
22
|
+
stateKey: null,
|
|
23
|
+
stateStorage: "session",
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const emit = defineEmits(["resizestart", "resize", "resizeend"]);
|
|
27
|
+
|
|
28
|
+
// Panel management
|
|
29
|
+
const panels = ref<any[]>([]);
|
|
30
|
+
const panelSizes = ref<(number | null)[]>([]);
|
|
31
|
+
const isResizing = ref(false);
|
|
32
|
+
const currentGutterIndex = ref<number | null>(null);
|
|
33
|
+
const startPos = ref(0);
|
|
34
|
+
const startSizes = ref<number[]>([]);
|
|
35
|
+
|
|
36
|
+
const registerPanel = (panel: any) => {
|
|
37
|
+
const index = panels.value.length;
|
|
38
|
+
panels.value.push(panel);
|
|
39
|
+
|
|
40
|
+
// Initialize sizes
|
|
41
|
+
if (panel.size !== undefined) {
|
|
42
|
+
panelSizes.value.push(panel.size);
|
|
43
|
+
} else {
|
|
44
|
+
// Distribute remaining space
|
|
45
|
+
panelSizes.value.push(null);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return index;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const unregisterPanel = (index: any) => {
|
|
52
|
+
panels.value.splice(index, 1);
|
|
53
|
+
panelSizes.value.splice(index, 1);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const getPanelSize = (index: any) => {
|
|
57
|
+
return panelSizes.value[index];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Resize logic
|
|
61
|
+
const onGutterMouseDown = (event: MouseEvent, index: any) => {
|
|
62
|
+
isResizing.value = true;
|
|
63
|
+
currentGutterIndex.value = index;
|
|
64
|
+
startPos.value = props.layout === "horizontal" ? event.pageX : event.pageY;
|
|
65
|
+
startSizes.value = [...panelSizes.value] as number[];
|
|
66
|
+
|
|
67
|
+
emit("resizestart", { originalEvent: event, sizes: panelSizes.value });
|
|
68
|
+
|
|
69
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
70
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
71
|
+
document.body.style.cursor = props.layout === "horizontal" ? "col-resize" : "row-resize";
|
|
72
|
+
document.body.style.userSelect = "none";
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const onMouseMove = (event: MouseEvent) => {
|
|
76
|
+
if (!isResizing.value) return;
|
|
77
|
+
|
|
78
|
+
const splitterElement = (event.target as HTMLElement).closest(".splitter") || document.querySelector(".splitter");
|
|
79
|
+
if (!splitterElement) return;
|
|
80
|
+
|
|
81
|
+
const rect = splitterElement.getBoundingClientRect();
|
|
82
|
+
const totalSize = props.layout === "horizontal" ? rect.width : rect.height;
|
|
83
|
+
const gutterCount = panels.value.length - 1;
|
|
84
|
+
const availableSize = totalSize - (gutterCount * props.gutterSize);
|
|
85
|
+
|
|
86
|
+
const currentPos = props.layout === "horizontal" ? event.pageX : event.pageY;
|
|
87
|
+
const delta = currentPos - startPos.value;
|
|
88
|
+
const deltaPercent = (delta / availableSize) * 100;
|
|
89
|
+
|
|
90
|
+
const prevIndex = currentGutterIndex.value!;
|
|
91
|
+
const nextIndex = currentGutterIndex.value! + 1;
|
|
92
|
+
|
|
93
|
+
let newPrevSize = startSizes.value[prevIndex] + deltaPercent;
|
|
94
|
+
let newNextSize = startSizes.value[nextIndex] - deltaPercent;
|
|
95
|
+
|
|
96
|
+
// Apply min constraints
|
|
97
|
+
const minSize = 5; // 5% minimum
|
|
98
|
+
if (newPrevSize < minSize) {
|
|
99
|
+
newNextSize += (newPrevSize - minSize);
|
|
100
|
+
newPrevSize = minSize;
|
|
101
|
+
}
|
|
102
|
+
if (newNextSize < minSize) {
|
|
103
|
+
newPrevSize += (newNextSize - minSize);
|
|
104
|
+
newNextSize = minSize;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
(panelSizes.value as number[])[prevIndex] = newPrevSize;
|
|
108
|
+
(panelSizes.value as number[])[nextIndex] = newNextSize;
|
|
109
|
+
|
|
110
|
+
emit("resize", { originalEvent: event, sizes: [...panelSizes.value] });
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const onMouseUp = (event: MouseEvent) => {
|
|
114
|
+
isResizing.value = false;
|
|
115
|
+
currentGutterIndex.value = null;
|
|
116
|
+
|
|
117
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
118
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
119
|
+
document.body.style.cursor = "";
|
|
120
|
+
document.body.style.userSelect = "";
|
|
121
|
+
|
|
122
|
+
emit("resizeend", { originalEvent: event, sizes: [...panelSizes.value] });
|
|
123
|
+
|
|
124
|
+
// Save state if stateKey is provided
|
|
125
|
+
if (props.stateKey) {
|
|
126
|
+
saveState();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const saveState = () => {
|
|
131
|
+
const storage = props.stateStorage === "local" ? localStorage : sessionStorage;
|
|
132
|
+
storage.setItem(props.stateKey!, JSON.stringify(panelSizes.value));
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const restoreState = () => {
|
|
136
|
+
if (!props.stateKey) return;
|
|
137
|
+
|
|
138
|
+
const storage = props.stateStorage === "local" ? localStorage : sessionStorage;
|
|
139
|
+
const savedState = storage.getItem(props.stateKey);
|
|
140
|
+
|
|
141
|
+
if (savedState) {
|
|
142
|
+
try {
|
|
143
|
+
panelSizes.value = JSON.parse(savedState);
|
|
144
|
+
} catch (e) {
|
|
145
|
+
// Invalid state, ignore
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// Initialize default sizes once all panels are registered
|
|
151
|
+
const initializeSizes = () => {
|
|
152
|
+
const nullCount = panelSizes.value.filter((s) => s === null).length;
|
|
153
|
+
const usedPercent = panelSizes.value.reduce((sum, s) => (sum ?? 0) + (s || 0), 0)!;
|
|
154
|
+
const remainingPercent = 100 - usedPercent;
|
|
155
|
+
const defaultSize = nullCount > 0 ? remainingPercent / nullCount : 0;
|
|
156
|
+
|
|
157
|
+
panelSizes.value = panelSizes.value.map((s) => (s === null ? defaultSize : s));
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// Provide context to child panels
|
|
161
|
+
provide("splitter", {
|
|
162
|
+
layout: computed(() => props.layout),
|
|
163
|
+
gutterSize: computed(() => props.gutterSize),
|
|
164
|
+
registerPanel,
|
|
165
|
+
unregisterPanel,
|
|
166
|
+
getPanelSize,
|
|
167
|
+
panelSizes,
|
|
168
|
+
onGutterMouseDown,
|
|
169
|
+
isResizing,
|
|
170
|
+
currentGutterIndex,
|
|
171
|
+
initializeSizes,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
onMounted(() => {
|
|
175
|
+
restoreState();
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
onUnmounted(() => {
|
|
179
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
180
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
const additionalClasses = computed(() => [
|
|
184
|
+
`splitter--${props.layout}`,
|
|
185
|
+
isResizing.value && "splitter--resizing",
|
|
186
|
+
].filter(Boolean).join(" "));
|
|
187
|
+
|
|
188
|
+
const containerStyle = computed(() => ({
|
|
189
|
+
"--splitter-gutter-size": `${props.gutterSize}px`,
|
|
190
|
+
}));
|
|
191
|
+
</script>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="splitter__panel"
|
|
4
|
+
:style="panelStyle"
|
|
5
|
+
>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</div>
|
|
8
|
+
<div
|
|
9
|
+
v-if="showGutter"
|
|
10
|
+
class="splitter__gutter"
|
|
11
|
+
:class="gutterClasses"
|
|
12
|
+
role="separator"
|
|
13
|
+
:aria-orientation="splitterContext.layout.value === 'horizontal' ? 'vertical' : 'horizontal'"
|
|
14
|
+
tabindex="0"
|
|
15
|
+
@mousedown="onGutterMouseDown"
|
|
16
|
+
@keydown="onGutterKeyDown"
|
|
17
|
+
>
|
|
18
|
+
<div class="splitter__gutter-handle"></div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import type { SplitterPanelProps } from '../../types';
|
|
24
|
+
import { computed, inject, onMounted, onBeforeUnmount, ref, watch, nextTick } from "vue";
|
|
25
|
+
|
|
26
|
+
defineOptions({ name: 'FtpSplitterPanel' });
|
|
27
|
+
|
|
28
|
+
const props = withDefaults(defineProps<SplitterPanelProps>(), {
|
|
29
|
+
minSize: 5,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const splitterContext = inject("splitter") as any;
|
|
33
|
+
const panelIndex = ref(-1);
|
|
34
|
+
|
|
35
|
+
onMounted(async () => {
|
|
36
|
+
panelIndex.value = splitterContext.registerPanel({
|
|
37
|
+
size: props.size,
|
|
38
|
+
minSize: props.minSize,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Initialize sizes after all panels are registered
|
|
42
|
+
await nextTick();
|
|
43
|
+
splitterContext.initializeSizes();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
onBeforeUnmount(() => {
|
|
47
|
+
if (panelIndex.value !== -1) {
|
|
48
|
+
splitterContext.unregisterPanel(panelIndex.value);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const currentSize = computed(() => {
|
|
53
|
+
return splitterContext.getPanelSize(panelIndex.value);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const showGutter = computed(() => {
|
|
57
|
+
// Show gutter after this panel if it's not the last panel
|
|
58
|
+
const totalPanels = splitterContext.panelSizes.value.length;
|
|
59
|
+
return panelIndex.value >= 0 && panelIndex.value < totalPanels - 1;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const gutterClasses = computed(() => [
|
|
63
|
+
splitterContext.isResizing.value && splitterContext.currentGutterIndex.value === panelIndex.value && "splitter__gutter--active",
|
|
64
|
+
].filter(Boolean).join(" "));
|
|
65
|
+
|
|
66
|
+
const panelStyle = computed(() => {
|
|
67
|
+
const size = currentSize.value;
|
|
68
|
+
if (size === null || size === undefined) return {};
|
|
69
|
+
|
|
70
|
+
const gutterSize = splitterContext.gutterSize.value;
|
|
71
|
+
const gutterCount = splitterContext.panelSizes.value.length - 1;
|
|
72
|
+
const gutterOffset = (gutterSize * gutterCount) / splitterContext.panelSizes.value.length;
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
flexBasis: `calc(${size}% - ${gutterOffset}px)`,
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const onGutterMouseDown = (event: MouseEvent) => {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
splitterContext.onGutterMouseDown(event, panelIndex.value);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const onGutterKeyDown = (event: KeyboardEvent) => {
|
|
85
|
+
const step = 1; // 1% step
|
|
86
|
+
let handled = false;
|
|
87
|
+
|
|
88
|
+
if (splitterContext.layout.value === "horizontal") {
|
|
89
|
+
if (event.key === "ArrowLeft") {
|
|
90
|
+
adjustSize(-step);
|
|
91
|
+
handled = true;
|
|
92
|
+
} else if (event.key === "ArrowRight") {
|
|
93
|
+
adjustSize(step);
|
|
94
|
+
handled = true;
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
if (event.key === "ArrowUp") {
|
|
98
|
+
adjustSize(-step);
|
|
99
|
+
handled = true;
|
|
100
|
+
} else if (event.key === "ArrowDown") {
|
|
101
|
+
adjustSize(step);
|
|
102
|
+
handled = true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (handled) {
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const adjustSize = (delta: any) => {
|
|
112
|
+
const prevIndex = panelIndex.value;
|
|
113
|
+
const nextIndex = panelIndex.value + 1;
|
|
114
|
+
const sizes = splitterContext.panelSizes.value;
|
|
115
|
+
|
|
116
|
+
let newPrevSize = sizes[prevIndex] + delta;
|
|
117
|
+
let newNextSize = sizes[nextIndex] - delta;
|
|
118
|
+
|
|
119
|
+
const minSize = 5;
|
|
120
|
+
if (newPrevSize >= minSize && newNextSize >= minSize) {
|
|
121
|
+
sizes[prevIndex] = newPrevSize;
|
|
122
|
+
sizes[nextIndex] = newNextSize;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
</script>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@use "../../../dist/scss/tokens" as *;
|
|
2
|
+
@use "../../scss/mixins/accent-gradient.scss" as *;
|
|
3
|
+
|
|
4
|
+
$c: stats;
|
|
5
|
+
|
|
6
|
+
.#{$c} {
|
|
7
|
+
display: grid;
|
|
8
|
+
gap: 2rem;
|
|
9
|
+
width: 100%;
|
|
10
|
+
text-align: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.#{$c}--cols-2 { grid-template-columns: repeat(2, 1fr); }
|
|
14
|
+
.#{$c}--cols-3 { grid-template-columns: repeat(3, 1fr); }
|
|
15
|
+
.#{$c}--cols-4 { grid-template-columns: repeat(4, 1fr); }
|
|
16
|
+
|
|
17
|
+
@media (max-width: 768px) {
|
|
18
|
+
.#{$c} { grid-template-columns: repeat(2, 1fr) !important; }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.#{$c}__item {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: 0.5rem;
|
|
26
|
+
padding: 1.5rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.#{$c}__icon {
|
|
30
|
+
font-size: 1.5rem;
|
|
31
|
+
margin-bottom: 0.5rem;
|
|
32
|
+
|
|
33
|
+
i {
|
|
34
|
+
@include accent-gradient-text();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.#{$c}__value {
|
|
39
|
+
font-size: 2.5rem;
|
|
40
|
+
font-weight: 700;
|
|
41
|
+
color: $text-heading;
|
|
42
|
+
line-height: 1.1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.#{$c}__prefix,
|
|
46
|
+
.#{$c}__suffix {
|
|
47
|
+
font-size: 1.5rem;
|
|
48
|
+
font-weight: 600;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.#{$c}__label {
|
|
52
|
+
font-size: 0.9375rem;
|
|
53
|
+
color: $text-secondary;
|
|
54
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="stats" :class="`stats--cols-${columns}`">
|
|
3
|
+
<div v-for="(stat, i) in stats" :key="i" class="stats__item">
|
|
4
|
+
<div v-if="stat.icon" class="stats__icon">
|
|
5
|
+
<i :class="stat.icon" aria-hidden="true" />
|
|
6
|
+
</div>
|
|
7
|
+
<div class="stats__value">
|
|
8
|
+
<span v-if="stat.prefix" class="stats__prefix">{{ stat.prefix }}</span>
|
|
9
|
+
{{ stat.value }}
|
|
10
|
+
<span v-if="stat.suffix" class="stats__suffix">{{ stat.suffix }}</span>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="stats__label">{{ stat.label }}</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<style src="./Stats.scss"></style>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import type { StatsProps } from '../../types';
|
|
21
|
+
|
|
22
|
+
defineOptions({ name: 'FtpStats' });
|
|
23
|
+
|
|
24
|
+
withDefaults(defineProps<StatsProps>(), {
|
|
25
|
+
stats: () => [],
|
|
26
|
+
columns: 4,
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
@use "../../../dist/scss/tokens" as *;
|
|
2
|
+
@use "../../scss/mixins/accent-gradient.scss" as *;
|
|
3
|
+
|
|
4
|
+
$c: steps;
|
|
5
|
+
|
|
6
|
+
.#{$c} {
|
|
7
|
+
width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.#{$c}__list {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
list-style: none;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.#{$c}__item {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
flex: 1;
|
|
22
|
+
position: relative;
|
|
23
|
+
|
|
24
|
+
&:first-child {
|
|
25
|
+
flex: 0 0 auto;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.#{$c}__connector {
|
|
30
|
+
flex: 1;
|
|
31
|
+
height: var(--steps-connector-height, $steps-connector-height);
|
|
32
|
+
background-color: var(--steps-connector-color-incomplete, $steps-connector-color-incomplete);
|
|
33
|
+
margin: 0 var(--steps-gap, $steps-gap);
|
|
34
|
+
transition: background-color 200ms ease;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.#{$c}__connector--complete {
|
|
38
|
+
@include accent-gradient($angle: 90deg);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.#{$c}__marker-wrapper {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: var(--steps-label-gap, $steps-label-gap);
|
|
46
|
+
background: none;
|
|
47
|
+
border: none;
|
|
48
|
+
padding: 0;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
transition: opacity 150ms ease;
|
|
51
|
+
|
|
52
|
+
&:disabled {
|
|
53
|
+
cursor: default;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:focus {
|
|
57
|
+
outline: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:focus-visible .#{$c}__marker {
|
|
61
|
+
outline: var(--steps-focus-ringWidth, $steps-focus-ringWidth) solid var(--steps-focus-ringColor, $steps-focus-ringColor);
|
|
62
|
+
outline-offset: var(--steps-focus-ringOffset, $steps-focus-ringOffset);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.#{$c}__marker {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
width: var(--steps-marker-size, $steps-marker-size);
|
|
71
|
+
height: var(--steps-marker-size, $steps-marker-size);
|
|
72
|
+
border-radius: 50%;
|
|
73
|
+
border: var(--steps-marker-border-width, $steps-marker-border-width) solid;
|
|
74
|
+
transition:
|
|
75
|
+
background-color 200ms ease,
|
|
76
|
+
border-color 200ms ease,
|
|
77
|
+
color 200ms ease;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.#{$c}__number {
|
|
81
|
+
font-size: var(--steps-marker-fontSize, $steps-marker-fontSize);
|
|
82
|
+
font-weight: var(--steps-marker-fontWeight, $steps-marker-fontWeight);
|
|
83
|
+
line-height: 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.#{$c}__check-icon {
|
|
87
|
+
width: 16px;
|
|
88
|
+
height: 16px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.#{$c}__label {
|
|
92
|
+
font-size: var(--steps-label-fontSize, $steps-label-fontSize);
|
|
93
|
+
font-weight: var(--steps-label-fontWeight, $steps-label-fontWeight);
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
transition: color 200ms ease;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Incomplete state
|
|
99
|
+
.#{$c}__item--incomplete {
|
|
100
|
+
.#{$c}__marker {
|
|
101
|
+
background-color: var(--steps-marker-background-incomplete, $steps-marker-background-incomplete);
|
|
102
|
+
border-color: var(--steps-marker-border-color-incomplete, $steps-marker-border-color-incomplete);
|
|
103
|
+
color: var(--steps-marker-text-incomplete, $steps-marker-text-incomplete);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.#{$c}__label {
|
|
107
|
+
color: var(--steps-label-color-incomplete, $steps-label-color-incomplete);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.#{$c}__marker-wrapper:hover:not(:disabled) {
|
|
111
|
+
opacity: 0.8;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Active state
|
|
116
|
+
.#{$c}__item--active {
|
|
117
|
+
.#{$c}__marker {
|
|
118
|
+
@include accent-gradient();
|
|
119
|
+
border-color: var(--accent-gradient-start, $accent-gradient-start);
|
|
120
|
+
color: var(--steps-marker-text-active, $steps-marker-text-active);
|
|
121
|
+
text-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.#{$c}__label {
|
|
125
|
+
color: var(--steps-label-color-active, $steps-label-color-active);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Complete state
|
|
130
|
+
.#{$c}__item--complete {
|
|
131
|
+
.#{$c}__marker {
|
|
132
|
+
@include accent-gradient();
|
|
133
|
+
border-color: var(--accent-gradient-start, $accent-gradient-start);
|
|
134
|
+
color: var(--steps-marker-text-complete, $steps-marker-text-complete);
|
|
135
|
+
text-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.#{$c}__label {
|
|
139
|
+
color: var(--steps-label-color-complete, $steps-label-color-complete);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.#{$c}__marker-wrapper:hover:not(:disabled) {
|
|
143
|
+
opacity: 0.8;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Disabled state
|
|
148
|
+
.#{$c}__item--disabled {
|
|
149
|
+
.#{$c}__marker-wrapper {
|
|
150
|
+
cursor: not-allowed;
|
|
151
|
+
opacity: 0.5;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Readonly mode
|
|
156
|
+
.#{$c}--readonly {
|
|
157
|
+
.#{$c}__marker-wrapper {
|
|
158
|
+
cursor: default;
|
|
159
|
+
|
|
160
|
+
&:hover {
|
|
161
|
+
opacity: 1;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav class="steps" :class="additionalClasses" aria-label="Progress steps">
|
|
3
|
+
<ol class="steps__list">
|
|
4
|
+
<li
|
|
5
|
+
v-for="(step, index) in model"
|
|
6
|
+
:key="index"
|
|
7
|
+
class="steps__item"
|
|
8
|
+
:class="getStepClasses(index)"
|
|
9
|
+
>
|
|
10
|
+
<!-- Connector (before step, except first) -->
|
|
11
|
+
<div
|
|
12
|
+
v-if="index > 0"
|
|
13
|
+
class="steps__connector"
|
|
14
|
+
:class="{ 'steps__connector--complete': index <= activeIndex }"
|
|
15
|
+
></div>
|
|
16
|
+
|
|
17
|
+
<!-- Step content -->
|
|
18
|
+
<button
|
|
19
|
+
type="button"
|
|
20
|
+
class="steps__marker-wrapper"
|
|
21
|
+
:disabled="isReadonly || step.disabled"
|
|
22
|
+
:aria-current="index === activeIndex ? 'step' : undefined"
|
|
23
|
+
:aria-label="`Step ${index + 1}: ${step.label}`"
|
|
24
|
+
@click="onStepClick($event, step, index)"
|
|
25
|
+
>
|
|
26
|
+
<span class="steps__marker">
|
|
27
|
+
<svg
|
|
28
|
+
v-if="index < activeIndex"
|
|
29
|
+
class="steps__check-icon"
|
|
30
|
+
viewBox="0 0 16 16"
|
|
31
|
+
fill="none"
|
|
32
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
>
|
|
35
|
+
<path
|
|
36
|
+
d="M3 8.5L6.5 12L13 4"
|
|
37
|
+
stroke="currentColor"
|
|
38
|
+
stroke-width="2"
|
|
39
|
+
stroke-linecap="round"
|
|
40
|
+
stroke-linejoin="round"
|
|
41
|
+
/>
|
|
42
|
+
</svg>
|
|
43
|
+
<span v-else class="steps__number">{{ index + 1 }}</span>
|
|
44
|
+
</span>
|
|
45
|
+
<span class="steps__label">{{ step.label }}</span>
|
|
46
|
+
</button>
|
|
47
|
+
</li>
|
|
48
|
+
</ol>
|
|
49
|
+
</nav>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style src="./Steps.scss"></style>
|
|
53
|
+
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import type { StepsProps, StepsEmits } from '../../types';
|
|
56
|
+
import { computed } from "vue";
|
|
57
|
+
|
|
58
|
+
defineOptions({ name: 'FtpSteps' });
|
|
59
|
+
|
|
60
|
+
const props = withDefaults(defineProps<StepsProps>(), {
|
|
61
|
+
model: () => [],
|
|
62
|
+
activeIndex: 0,
|
|
63
|
+
isReadonly: false,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const emit = defineEmits(["update:activeIndex", "step-click"]);
|
|
67
|
+
|
|
68
|
+
const additionalClasses = computed(() =>
|
|
69
|
+
[props.isReadonly && "steps--readonly"].filter(Boolean).join(" ")
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const getStepClasses = (index: any) => {
|
|
73
|
+
const classes = [];
|
|
74
|
+
|
|
75
|
+
if (index < props.activeIndex) {
|
|
76
|
+
classes.push("steps__item--complete");
|
|
77
|
+
} else if (index === props.activeIndex) {
|
|
78
|
+
classes.push("steps__item--active");
|
|
79
|
+
} else {
|
|
80
|
+
classes.push("steps__item--incomplete");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (props.model[index]?.disabled) {
|
|
84
|
+
classes.push("steps__item--disabled");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return classes.join(" ");
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const onStepClick = (event: MouseEvent, step: any, index: any) => {
|
|
91
|
+
if (props.isReadonly || step.disabled) return;
|
|
92
|
+
|
|
93
|
+
emit("update:activeIndex", index);
|
|
94
|
+
emit("step-click", {
|
|
95
|
+
originalEvent: event,
|
|
96
|
+
item: step,
|
|
97
|
+
index,
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
</script>
|