@brumaombra/ui-vintage 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +78 -0
- package/dist/AlertDialogTitle.vue_vue_type_script_setup_true_lang-CWCr2erD.js +360 -0
- package/dist/AlertDialogTrigger.vue_vue_type_script_setup_true_lang-vNwxOYhM.js +158 -0
- package/dist/BackgroundGrid-Cxvbtefm.js +13 -0
- package/dist/Busy-B65Nd9ec.js +62 -0
- package/dist/BusyIndicator-CnWzSMDb.js +4 -0
- package/dist/BusyIndicator.vue_vue_type_script_setup_true_lang-CYeXMI_V.js +66 -0
- package/dist/CalendarPrevButton.vue_vue_type_script_setup_true_lang-C-WnFnvj.js +3805 -0
- package/dist/Card.vue_vue_type_script_setup_true_lang-6ol3rxy1.js +27 -0
- package/dist/CardTitle.vue_vue_type_script_setup_true_lang-DVAd7AWF.js +112 -0
- package/dist/Collection-CmOoLBo7.js +76 -0
- package/dist/ConfigProvider-D2O0Jles.js +6 -0
- package/dist/ConfirmDialog-DEsvF0b_.js +4 -0
- package/dist/ConfirmDialog.vue_vue_type_script_setup_true_lang-BAd1l1zF.js +230 -0
- package/dist/DashboardShell.vue_vue_type_script_setup_true_lang-CT2SQBXv.js +171 -0
- package/dist/DatePicker.vue_vue_type_script_setup_true_lang-D8mev2ha.js +92 -0
- package/dist/DialogClose-BNlqG4G2.js +36 -0
- package/dist/DialogTitle-DXj0nkXn.js +522 -0
- package/dist/DialogTitle.vue_vue_type_script_setup_true_lang-Bw40D4AK.js +174 -0
- package/dist/DialogTrigger-CpyKnu11.js +52 -0
- package/dist/DialogTrigger.vue_vue_type_script_setup_true_lang-DLrFiCsw.js +141 -0
- package/dist/FocusScope-C3mcVwsf.js +454 -0
- package/dist/Input.vue_vue_type_script_setup_true_lang-U778IWa0.js +37 -0
- package/dist/Label.vue_vue_type_script_setup_true_lang-B_fwvfJ-.js +65 -0
- package/dist/MessageDialog-BrowppID.js +4 -0
- package/dist/MessageDialog.vue_vue_type_script_setup_true_lang-Ddih5Isd.js +242 -0
- package/dist/NativeSelectOption.vue_vue_type_script_setup_true_lang-DS87OTLT.js +73 -0
- package/dist/PopoverAnchor.vue_vue_type_script_setup_true_lang-CsfybvZp.js +61 -0
- package/dist/PopoverTrigger.vue_vue_type_script_setup_true_lang-KTcg6Jnl.js +798 -0
- package/dist/PopperContent-BiM0YLO3.js +2144 -0
- package/dist/Primitive-D3IcFg81.js +61 -0
- package/dist/SelectValue.vue_vue_type_script_setup_true_lang-DGAI4hw5.js +2124 -0
- package/dist/Separator-CFm_M4pb.js +87 -0
- package/dist/Separator.vue_vue_type_script_setup_true_lang-COrZ60NR.js +29 -0
- package/dist/SheetTitle.vue_vue_type_script_setup_true_lang-DLoXGMbx.js +175 -0
- package/dist/SheetTrigger.vue_vue_type_script_setup_true_lang-CE2XJNHy.js +62 -0
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-BSbVyZz7.js +20 -0
- package/dist/Slider.vue_vue_type_script_setup_true_lang-D-cAN-4Q.js +802 -0
- package/dist/SliderFormComponent.vue_vue_type_script_setup_true_lang-KPzC_Lmr.js +59 -0
- package/dist/Switch.vue_vue_type_script_setup_true_lang-BWKCycMm.js +226 -0
- package/dist/SwitchFormComponent.vue_vue_type_script_setup_true_lang-XOBEs3pa.js +39 -0
- package/dist/Teleport-CuUn4UkG.js +493 -0
- package/dist/TooltipProvider.vue_vue_type_script_setup_true_lang-DwIfCQjY.js +28 -0
- package/dist/TooltipTrigger.vue_vue_type_script_setup_true_lang-BRyHTWgw.js +1117 -0
- package/dist/VisuallyHidden-udQT2Fmo.js +60 -0
- package/dist/VisuallyHiddenInput-DLAsRwUw.js +142 -0
- package/dist/_plugin-vue_export-helper-1tPrXgE0.js +10 -0
- package/dist/alert-dialog.d.ts +2 -0
- package/dist/alert-dialog.js +13 -0
- package/dist/alert.d.ts +2 -0
- package/dist/alert.js +76 -0
- package/dist/background-grid.d.ts +6 -0
- package/dist/background-grid.js +5 -0
- package/dist/busy-indicator.d.ts +2 -0
- package/dist/busy-indicator.js +6 -0
- package/dist/busy.d.ts +2 -0
- package/dist/busy.js +4 -0
- package/dist/button.d.ts +2 -0
- package/dist/button.js +63 -0
- package/dist/calendar.d.ts +2 -0
- package/dist/calendar.js +15 -0
- package/dist/card.d.ts +2 -0
- package/dist/card.js +11 -0
- package/dist/check-iejznCzf.js +11 -0
- package/dist/chevron-down-DP-oz-sL.js +13 -0
- package/dist/clamp-D5Ye0kJT.js +6 -0
- package/dist/command.d.ts +2 -0
- package/dist/command.js +1122 -0
- package/dist/components/background-grid/BackgroundGrid.vue.d.ts +2 -0
- package/dist/components/background-grid/index.d.ts +2 -0
- package/dist/components/busy-indicator/BusyIndicator.vue.d.ts +2 -0
- package/dist/components/busy-indicator/busy-indicator-state.d.ts +15 -0
- package/dist/components/busy-indicator/index.d.ts +3 -0
- package/dist/components/confirm-dialog/ConfirmDialog.vue.d.ts +2 -0
- package/dist/components/confirm-dialog/confirm-dialog-state.d.ts +37 -0
- package/dist/components/confirm-dialog/index.d.ts +3 -0
- package/dist/components/dashboard-shell/DashboardShell.vue.d.ts +54 -0
- package/dist/components/dashboard-shell/index.d.ts +2 -0
- package/dist/components/message-dialog/MessageDialog.vue.d.ts +2 -0
- package/dist/components/message-dialog/index.d.ts +3 -0
- package/dist/components/message-dialog/message-dialog-state.d.ts +28 -0
- package/dist/components/slider-form-component/SliderFormComponent.vue.d.ts +23 -0
- package/dist/components/slider-form-component/index.d.ts +2 -0
- package/dist/components/switch-form-component/SwitchFormComponent.vue.d.ts +12 -0
- package/dist/components/switch-form-component/index.d.ts +2 -0
- package/dist/components/ui/alert/Alert.vue.d.ts +23 -0
- package/dist/components/ui/alert/AlertDescription.vue.d.ts +21 -0
- package/dist/components/ui/alert/AlertTitle.vue.d.ts +21 -0
- package/dist/components/ui/alert/index.d.ts +8 -0
- package/dist/components/ui/alert-dialog/AlertDialog.vue.d.ts +25 -0
- package/dist/components/ui/alert-dialog/AlertDialogAction.vue.d.ts +22 -0
- package/dist/components/ui/alert-dialog/AlertDialogCancel.vue.d.ts +22 -0
- package/dist/components/ui/alert-dialog/AlertDialogContent.vue.d.ts +36 -0
- package/dist/components/ui/alert-dialog/AlertDialogDescription.vue.d.ts +22 -0
- package/dist/components/ui/alert-dialog/AlertDialogFooter.vue.d.ts +21 -0
- package/dist/components/ui/alert-dialog/AlertDialogHeader.vue.d.ts +21 -0
- package/dist/components/ui/alert-dialog/AlertDialogTitle.vue.d.ts +22 -0
- package/dist/components/ui/alert-dialog/AlertDialogTrigger.vue.d.ts +18 -0
- package/dist/components/ui/alert-dialog/index.d.ts +9 -0
- package/dist/components/ui/busy/Busy.vue.d.ts +27 -0
- package/dist/components/ui/busy/index.d.ts +1 -0
- package/dist/components/ui/button/Button.vue.d.ts +27 -0
- package/dist/components/ui/button/index.d.ts +7 -0
- package/dist/components/ui/calendar/Calendar.vue.d.ts +44 -0
- package/dist/components/ui/calendar/CalendarCell.vue.d.ts +22 -0
- package/dist/components/ui/calendar/CalendarCellTrigger.vue.d.ts +24 -0
- package/dist/components/ui/calendar/CalendarGrid.vue.d.ts +22 -0
- package/dist/components/ui/calendar/CalendarGridBody.vue.d.ts +18 -0
- package/dist/components/ui/calendar/CalendarGridHead.vue.d.ts +22 -0
- package/dist/components/ui/calendar/CalendarGridRow.vue.d.ts +22 -0
- package/dist/components/ui/calendar/CalendarHeadCell.vue.d.ts +22 -0
- package/dist/components/ui/calendar/CalendarHeader.vue.d.ts +22 -0
- package/dist/components/ui/calendar/CalendarHeading.vue.d.ts +28 -0
- package/dist/components/ui/calendar/CalendarNextButton.vue.d.ts +22 -0
- package/dist/components/ui/calendar/CalendarPrevButton.vue.d.ts +22 -0
- package/dist/components/ui/calendar/index.d.ts +13 -0
- package/dist/components/ui/card/Card.vue.d.ts +21 -0
- package/dist/components/ui/card/CardAction.vue.d.ts +21 -0
- package/dist/components/ui/card/CardContent.vue.d.ts +21 -0
- package/dist/components/ui/card/CardDescription.vue.d.ts +21 -0
- package/dist/components/ui/card/CardFooter.vue.d.ts +21 -0
- package/dist/components/ui/card/CardHeader.vue.d.ts +21 -0
- package/dist/components/ui/card/CardTitle.vue.d.ts +21 -0
- package/dist/components/ui/card/index.d.ts +7 -0
- package/dist/components/ui/command/Command.vue.d.ts +40 -0
- package/dist/components/ui/command/CommandDialog.vue.d.ts +32 -0
- package/dist/components/ui/command/CommandEmpty.vue.d.ts +22 -0
- package/dist/components/ui/command/CommandGroup.vue.d.ts +23 -0
- package/dist/components/ui/command/CommandInput.vue.d.ts +7 -0
- package/dist/components/ui/command/CommandItem.vue.d.ts +30 -0
- package/dist/components/ui/command/CommandList.vue.d.ts +22 -0
- package/dist/components/ui/command/CommandSeparator.vue.d.ts +22 -0
- package/dist/components/ui/command/CommandShortcut.vue.d.ts +21 -0
- package/dist/components/ui/command/index.d.ts +90 -0
- package/dist/components/ui/date-picker/DatePicker.vue.d.ts +19 -0
- package/dist/components/ui/date-picker/index.d.ts +2 -0
- package/dist/components/ui/dialog/Dialog.vue.d.ts +25 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +18 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +39 -0
- package/dist/components/ui/dialog/DialogDescription.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts +24 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts +21 -0
- package/dist/components/ui/dialog/DialogOverlay.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogScrollContent.vue.d.ts +36 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +18 -0
- package/dist/components/ui/dialog/index.d.ts +10 -0
- package/dist/components/ui/field/Field.vue.d.ts +23 -0
- package/dist/components/ui/field/FieldContent.vue.d.ts +21 -0
- package/dist/components/ui/field/FieldDescription.vue.d.ts +21 -0
- package/dist/components/ui/field/FieldError.vue.d.ts +24 -0
- package/dist/components/ui/field/FieldGroup.vue.d.ts +21 -0
- package/dist/components/ui/field/FieldLabel.vue.d.ts +21 -0
- package/dist/components/ui/field/FieldLegend.vue.d.ts +22 -0
- package/dist/components/ui/field/FieldSeparator.vue.d.ts +21 -0
- package/dist/components/ui/field/FieldSet.vue.d.ts +21 -0
- package/dist/components/ui/field/FieldTitle.vue.d.ts +21 -0
- package/dist/components/ui/field/index.d.ts +15 -0
- package/dist/components/ui/input/Input.vue.d.ts +12 -0
- package/dist/components/ui/input/index.d.ts +1 -0
- package/dist/components/ui/label/Label.vue.d.ts +22 -0
- package/dist/components/ui/label/index.d.ts +1 -0
- package/dist/components/ui/native-select/NativeSelect.vue.d.ts +27 -0
- package/dist/components/ui/native-select/NativeSelectOptGroup.vue.d.ts +21 -0
- package/dist/components/ui/native-select/NativeSelectOption.vue.d.ts +21 -0
- package/dist/components/ui/native-select/index.d.ts +3 -0
- package/dist/components/ui/popover/Popover.vue.d.ts +25 -0
- package/dist/components/ui/popover/PopoverAnchor.vue.d.ts +18 -0
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +39 -0
- package/dist/components/ui/popover/PopoverTrigger.vue.d.ts +18 -0
- package/dist/components/ui/popover/index.d.ts +4 -0
- package/dist/components/ui/select/Select.vue.d.ts +28 -0
- package/dist/components/ui/select/SelectContent.vue.d.ts +32 -0
- package/dist/components/ui/select/SelectGroup.vue.d.ts +18 -0
- package/dist/components/ui/select/SelectItem.vue.d.ts +24 -0
- package/dist/components/ui/select/SelectItemText.vue.d.ts +18 -0
- package/dist/components/ui/select/SelectLabel.vue.d.ts +22 -0
- package/dist/components/ui/select/SelectScrollDownButton.vue.d.ts +22 -0
- package/dist/components/ui/select/SelectScrollUpButton.vue.d.ts +22 -0
- package/dist/components/ui/select/SelectSeparator.vue.d.ts +7 -0
- package/dist/components/ui/select/SelectTrigger.vue.d.ts +25 -0
- package/dist/components/ui/select/SelectValue.vue.d.ts +18 -0
- package/dist/components/ui/select/index.d.ts +11 -0
- package/dist/components/ui/separator/Separator.vue.d.ts +10 -0
- package/dist/components/ui/separator/index.d.ts +1 -0
- package/dist/components/ui/sheet/Sheet.vue.d.ts +25 -0
- package/dist/components/ui/sheet/SheetClose.vue.d.ts +18 -0
- package/dist/components/ui/sheet/SheetContent.vue.d.ts +39 -0
- package/dist/components/ui/sheet/SheetDescription.vue.d.ts +22 -0
- package/dist/components/ui/sheet/SheetFooter.vue.d.ts +21 -0
- package/dist/components/ui/sheet/SheetHeader.vue.d.ts +21 -0
- package/dist/components/ui/sheet/SheetOverlay.vue.d.ts +22 -0
- package/dist/components/ui/sheet/SheetTitle.vue.d.ts +22 -0
- package/dist/components/ui/sheet/SheetTrigger.vue.d.ts +18 -0
- package/dist/components/ui/sheet/index.d.ts +8 -0
- package/dist/components/ui/sidebar/Sidebar.vue.d.ts +24 -0
- package/dist/components/ui/sidebar/SidebarContent.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarFooter.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarGroup.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarGroupAction.vue.d.ts +22 -0
- package/dist/components/ui/sidebar/SidebarGroupContent.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarGroupLabel.vue.d.ts +22 -0
- package/dist/components/ui/sidebar/SidebarHeader.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarInput.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarInset.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenu.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuAction.vue.d.ts +25 -0
- package/dist/components/ui/sidebar/SidebarMenuBadge.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuButton.vue.d.ts +27 -0
- package/dist/components/ui/sidebar/SidebarMenuButtonChild.vue.d.ts +30 -0
- package/dist/components/ui/sidebar/SidebarMenuItem.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuSkeleton.vue.d.ts +7 -0
- package/dist/components/ui/sidebar/SidebarMenuSub.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuSubButton.vue.d.ts +27 -0
- package/dist/components/ui/sidebar/SidebarMenuSubItem.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarProvider.vue.d.ts +30 -0
- package/dist/components/ui/sidebar/SidebarRail.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarSeparator.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarTrigger.vue.d.ts +6 -0
- package/dist/components/ui/sidebar/index.d.ts +37 -0
- package/dist/components/ui/sidebar/utils.d.ts +56 -0
- package/dist/components/ui/skeleton/Skeleton.vue.d.ts +6 -0
- package/dist/components/ui/skeleton/index.d.ts +1 -0
- package/dist/components/ui/slider/Slider.vue.d.ts +13 -0
- package/dist/components/ui/slider/index.d.ts +1 -0
- package/dist/components/ui/switch/Switch.vue.d.ts +29 -0
- package/dist/components/ui/switch/index.d.ts +1 -0
- package/dist/components/ui/tooltip/Tooltip.vue.d.ts +24 -0
- package/dist/components/ui/tooltip/TooltipContent.vue.d.ts +30 -0
- package/dist/components/ui/tooltip/TooltipProvider.vue.d.ts +20 -0
- package/dist/components/ui/tooltip/TooltipTrigger.vue.d.ts +18 -0
- package/dist/components/ui/tooltip/index.d.ts +4 -0
- package/dist/confirm-dialog.d.ts +2 -0
- package/dist/confirm-dialog.js +9 -0
- package/dist/createLucideIcon-CCMB2vDW.js +130 -0
- package/dist/dashboard-shell.d.ts +6 -0
- package/dist/dashboard-shell.js +5 -0
- package/dist/date-picker.d.ts +6 -0
- package/dist/date-picker.js +5 -0
- package/dist/dialog.d.ts +2 -0
- package/dist/dialog.js +14 -0
- package/dist/field.d.ts +2 -0
- package/dist/field.js +294 -0
- package/dist/index-C1_fxYhb.js +251 -0
- package/dist/index-Dfi5ESP2.js +299 -0
- package/dist/index-FpH8cK6B.js +44 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +171 -0
- package/dist/info-DZrSmi42.js +15 -0
- package/dist/input.d.ts +2 -0
- package/dist/input.js +4 -0
- package/dist/label.d.ts +2 -0
- package/dist/label.js +4 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/message-dialog.d.ts +2 -0
- package/dist/message-dialog.js +8 -0
- package/dist/native-select.d.ts +2 -0
- package/dist/native-select.js +25 -0
- package/dist/popover.d.ts +2 -0
- package/dist/popover.js +8 -0
- package/dist/select.d.ts +2 -0
- package/dist/select.js +14 -0
- package/dist/separator.d.ts +2 -0
- package/dist/separator.js +4 -0
- package/dist/sheet.d.ts +2 -0
- package/dist/sheet.js +12 -0
- package/dist/sidebar.d.ts +2 -0
- package/dist/sidebar.js +813 -0
- package/dist/skeleton.d.ts +2 -0
- package/dist/skeleton.js +4 -0
- package/dist/slider-form-component.d.ts +6 -0
- package/dist/slider-form-component.js +5 -0
- package/dist/slider.d.ts +2 -0
- package/dist/slider.js +4 -0
- package/dist/style.css +4021 -0
- package/dist/switch-form-component.d.ts +6 -0
- package/dist/switch-form-component.js +5 -0
- package/dist/switch.d.ts +2 -0
- package/dist/switch.js +4 -0
- package/dist/tooltip.d.ts +2 -0
- package/dist/tooltip.js +8 -0
- package/dist/useDirection-SIyEYNxv.js +12 -0
- package/dist/useFocusGuards-tgErlvMF.js +29 -0
- package/dist/useFormControl-7ytzz-r7.js +11 -0
- package/dist/useForwardExpose-CNVHwdF2.js +58 -0
- package/dist/useForwardPropsEmits-DmumnZO5.js +63 -0
- package/dist/useKbd-JjFOu4f7.js +41 -0
- package/dist/usePrimitiveElement-CijaRBgF.js +16 -0
- package/dist/useSize-DO9Z3wC4.js +51 -0
- package/dist/useTypeahead-Dqe1QXq1.js +159 -0
- package/dist/utils-Bz4m9VPB.js +3192 -0
- package/dist/utils-RRmyeqLm.js +16 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +4 -0
- package/dist/x-2_VzbDS9.js +48 -0
- package/package.json +186 -0
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
import { defineComponent, toRefs, ref, computed, openBlock, createBlock, unref, normalizeStyle, withCtx, renderSlot, resolveDynamicComponent, mergeProps, createCommentVNode, toRaw, onMounted, onUnmounted, createVNode, createElementBlock, Fragment, renderList } from "vue";
|
|
2
|
+
import { c as createContext, u as useForwardPropsEmits } from "./useForwardPropsEmits-DmumnZO5.js";
|
|
3
|
+
import { c as clamp } from "./clamp-D5Ye0kJT.js";
|
|
4
|
+
import { u as useDirection } from "./useDirection-SIyEYNxv.js";
|
|
5
|
+
import { u as useFormControl } from "./useFormControl-7ytzz-r7.js";
|
|
6
|
+
import { u as useForwardExpose } from "./useForwardExpose-CNVHwdF2.js";
|
|
7
|
+
import { u as useCollection } from "./Collection-CmOoLBo7.js";
|
|
8
|
+
import { V as VisuallyHiddenInput_default } from "./VisuallyHiddenInput-DLAsRwUw.js";
|
|
9
|
+
import { P as Primitive } from "./Primitive-D3IcFg81.js";
|
|
10
|
+
import { u as useVModel, c as useMounted } from "./index-C1_fxYhb.js";
|
|
11
|
+
import { u as useSize } from "./useSize-DO9Z3wC4.js";
|
|
12
|
+
import { c as cn } from "./utils-Bz4m9VPB.js";
|
|
13
|
+
import { r as reactiveOmit } from "./index-Dfi5ESP2.js";
|
|
14
|
+
function getNextSortedValues(prevValues = [], nextValue, atIndex) {
|
|
15
|
+
const nextValues = [...prevValues];
|
|
16
|
+
nextValues[atIndex] = nextValue;
|
|
17
|
+
return nextValues.sort((a, b) => a - b);
|
|
18
|
+
}
|
|
19
|
+
function convertValueToPercentage(value, min, max) {
|
|
20
|
+
const maxSteps = max - min;
|
|
21
|
+
const percentPerStep = 100 / maxSteps;
|
|
22
|
+
const percentage = percentPerStep * (value - min);
|
|
23
|
+
return clamp(percentage, 0, 100);
|
|
24
|
+
}
|
|
25
|
+
function getLabel(index, totalValues) {
|
|
26
|
+
if (totalValues > 2) return `Value ${index + 1} of ${totalValues}`;
|
|
27
|
+
else if (totalValues === 2) return ["Minimum", "Maximum"][index];
|
|
28
|
+
else return void 0;
|
|
29
|
+
}
|
|
30
|
+
function getClosestValueIndex(values, nextValue) {
|
|
31
|
+
if (values.length === 1) return 0;
|
|
32
|
+
const distances = values.map((value) => Math.abs(value - nextValue));
|
|
33
|
+
const closestDistance = Math.min(...distances);
|
|
34
|
+
return distances.indexOf(closestDistance);
|
|
35
|
+
}
|
|
36
|
+
function getThumbInBoundsOffset(width, left, direction) {
|
|
37
|
+
const halfWidth = width / 2;
|
|
38
|
+
const halfPercent = 50;
|
|
39
|
+
const offset = linearScale([0, halfPercent], [0, halfWidth]);
|
|
40
|
+
return (halfWidth - offset(left) * direction) * direction;
|
|
41
|
+
}
|
|
42
|
+
function getStepsBetweenValues(values) {
|
|
43
|
+
return values.slice(0, -1).map((value, index) => values[index + 1] - value);
|
|
44
|
+
}
|
|
45
|
+
function hasMinStepsBetweenValues(values, minStepsBetweenValues) {
|
|
46
|
+
if (minStepsBetweenValues > 0) {
|
|
47
|
+
const stepsBetweenValues = getStepsBetweenValues(values);
|
|
48
|
+
const actualMinStepsBetweenValues = Math.min(...stepsBetweenValues);
|
|
49
|
+
return actualMinStepsBetweenValues >= minStepsBetweenValues;
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
function linearScale(input, output) {
|
|
54
|
+
return (value) => {
|
|
55
|
+
if (input[0] === input[1] || output[0] === output[1]) return output[0];
|
|
56
|
+
const ratio = (output[1] - output[0]) / (input[1] - input[0]);
|
|
57
|
+
return output[0] + ratio * (value - input[0]);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function getDecimalCount(value) {
|
|
61
|
+
return (String(value).split(".")[1] || "").length;
|
|
62
|
+
}
|
|
63
|
+
function roundValue(value, decimalCount) {
|
|
64
|
+
const rounder = 10 ** decimalCount;
|
|
65
|
+
return Math.round(value * rounder) / rounder;
|
|
66
|
+
}
|
|
67
|
+
const PAGE_KEYS = ["PageUp", "PageDown"];
|
|
68
|
+
const ARROW_KEYS = [
|
|
69
|
+
"ArrowUp",
|
|
70
|
+
"ArrowDown",
|
|
71
|
+
"ArrowLeft",
|
|
72
|
+
"ArrowRight"
|
|
73
|
+
];
|
|
74
|
+
const BACK_KEYS = {
|
|
75
|
+
"from-left": [
|
|
76
|
+
"Home",
|
|
77
|
+
"PageDown",
|
|
78
|
+
"ArrowDown",
|
|
79
|
+
"ArrowLeft"
|
|
80
|
+
],
|
|
81
|
+
"from-right": [
|
|
82
|
+
"Home",
|
|
83
|
+
"PageDown",
|
|
84
|
+
"ArrowDown",
|
|
85
|
+
"ArrowRight"
|
|
86
|
+
],
|
|
87
|
+
"from-bottom": [
|
|
88
|
+
"Home",
|
|
89
|
+
"PageDown",
|
|
90
|
+
"ArrowDown",
|
|
91
|
+
"ArrowLeft"
|
|
92
|
+
],
|
|
93
|
+
"from-top": [
|
|
94
|
+
"Home",
|
|
95
|
+
"PageUp",
|
|
96
|
+
"ArrowUp",
|
|
97
|
+
"ArrowLeft"
|
|
98
|
+
]
|
|
99
|
+
};
|
|
100
|
+
const [injectSliderOrientationContext, provideSliderOrientationContext] = createContext(["SliderVertical", "SliderHorizontal"]);
|
|
101
|
+
var SliderHorizontal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
102
|
+
__name: "SliderHorizontal",
|
|
103
|
+
props: {
|
|
104
|
+
dir: {
|
|
105
|
+
type: String,
|
|
106
|
+
required: false
|
|
107
|
+
},
|
|
108
|
+
min: {
|
|
109
|
+
type: Number,
|
|
110
|
+
required: true
|
|
111
|
+
},
|
|
112
|
+
max: {
|
|
113
|
+
type: Number,
|
|
114
|
+
required: true
|
|
115
|
+
},
|
|
116
|
+
inverted: {
|
|
117
|
+
type: Boolean,
|
|
118
|
+
required: true
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
emits: [
|
|
122
|
+
"slideEnd",
|
|
123
|
+
"slideStart",
|
|
124
|
+
"slideMove",
|
|
125
|
+
"homeKeyDown",
|
|
126
|
+
"endKeyDown",
|
|
127
|
+
"stepKeyDown"
|
|
128
|
+
],
|
|
129
|
+
setup(__props, { emit: __emit }) {
|
|
130
|
+
const props = __props;
|
|
131
|
+
const emits = __emit;
|
|
132
|
+
const { max, min, dir, inverted } = toRefs(props);
|
|
133
|
+
const { forwardRef, currentElement: sliderElement } = useForwardExpose();
|
|
134
|
+
const rootContext = injectSliderRootContext();
|
|
135
|
+
const offsetPosition = ref();
|
|
136
|
+
const rectRef = ref();
|
|
137
|
+
const isSlidingFromLeft = computed(() => (dir == null ? void 0 : dir.value) !== "rtl" && !inverted.value || (dir == null ? void 0 : dir.value) !== "ltr" && inverted.value);
|
|
138
|
+
function getValueFromPointerEvent(event, slideStart) {
|
|
139
|
+
const rect = rectRef.value || sliderElement.value.getBoundingClientRect();
|
|
140
|
+
const thumb = [...rootContext.thumbElements.value][rootContext.valueIndexToChangeRef.value];
|
|
141
|
+
const thumbWidth = rootContext.thumbAlignment.value === "contain" ? thumb.clientWidth : 0;
|
|
142
|
+
if (!offsetPosition.value && !slideStart && rootContext.thumbAlignment.value === "contain") offsetPosition.value = event.clientX - thumb.getBoundingClientRect().left;
|
|
143
|
+
const input = [0, rect.width - thumbWidth];
|
|
144
|
+
const output = isSlidingFromLeft.value ? [min.value, max.value] : [max.value, min.value];
|
|
145
|
+
const value = linearScale(input, output);
|
|
146
|
+
rectRef.value = rect;
|
|
147
|
+
const position = slideStart ? event.clientX - rect.left - thumbWidth / 2 : event.clientX - rect.left - (offsetPosition.value ?? 0);
|
|
148
|
+
return value(position);
|
|
149
|
+
}
|
|
150
|
+
const startEdge = computed(() => isSlidingFromLeft.value ? "left" : "right");
|
|
151
|
+
const endEdge = computed(() => isSlidingFromLeft.value ? "right" : "left");
|
|
152
|
+
const direction = computed(() => isSlidingFromLeft.value ? 1 : -1);
|
|
153
|
+
provideSliderOrientationContext({
|
|
154
|
+
startEdge,
|
|
155
|
+
endEdge,
|
|
156
|
+
direction,
|
|
157
|
+
size: "width"
|
|
158
|
+
});
|
|
159
|
+
return (_ctx, _cache) => {
|
|
160
|
+
return openBlock(), createBlock(SliderImpl_default, {
|
|
161
|
+
ref: unref(forwardRef),
|
|
162
|
+
dir: unref(dir),
|
|
163
|
+
"data-orientation": "horizontal",
|
|
164
|
+
style: normalizeStyle({ ["--reka-slider-thumb-transform"]: !isSlidingFromLeft.value && unref(rootContext).thumbAlignment.value === "overflow" ? "translateX(50%)" : "translateX(-50%)" }),
|
|
165
|
+
onSlideStart: _cache[0] || (_cache[0] = (event) => {
|
|
166
|
+
const value = getValueFromPointerEvent(event, true);
|
|
167
|
+
emits("slideStart", value);
|
|
168
|
+
}),
|
|
169
|
+
onSlideMove: _cache[1] || (_cache[1] = (event) => {
|
|
170
|
+
const value = getValueFromPointerEvent(event);
|
|
171
|
+
emits("slideMove", value);
|
|
172
|
+
}),
|
|
173
|
+
onSlideEnd: _cache[2] || (_cache[2] = () => {
|
|
174
|
+
rectRef.value = void 0;
|
|
175
|
+
offsetPosition.value = void 0;
|
|
176
|
+
emits("slideEnd");
|
|
177
|
+
}),
|
|
178
|
+
onStepKeyDown: _cache[3] || (_cache[3] = (event) => {
|
|
179
|
+
const slideDirection = isSlidingFromLeft.value ? "from-left" : "from-right";
|
|
180
|
+
const isBackKey = unref(BACK_KEYS)[slideDirection].includes(event.key);
|
|
181
|
+
emits("stepKeyDown", event, isBackKey ? -1 : 1);
|
|
182
|
+
}),
|
|
183
|
+
onEndKeyDown: _cache[4] || (_cache[4] = ($event) => emits("endKeyDown", $event)),
|
|
184
|
+
onHomeKeyDown: _cache[5] || (_cache[5] = ($event) => emits("homeKeyDown", $event))
|
|
185
|
+
}, {
|
|
186
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
187
|
+
_: 3
|
|
188
|
+
}, 8, ["dir", "style"]);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
var SliderHorizontal_default = SliderHorizontal_vue_vue_type_script_setup_true_lang_default;
|
|
193
|
+
var SliderVertical_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
194
|
+
__name: "SliderVertical",
|
|
195
|
+
props: {
|
|
196
|
+
min: {
|
|
197
|
+
type: Number,
|
|
198
|
+
required: true
|
|
199
|
+
},
|
|
200
|
+
max: {
|
|
201
|
+
type: Number,
|
|
202
|
+
required: true
|
|
203
|
+
},
|
|
204
|
+
inverted: {
|
|
205
|
+
type: Boolean,
|
|
206
|
+
required: true
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
emits: [
|
|
210
|
+
"slideEnd",
|
|
211
|
+
"slideStart",
|
|
212
|
+
"slideMove",
|
|
213
|
+
"homeKeyDown",
|
|
214
|
+
"endKeyDown",
|
|
215
|
+
"stepKeyDown"
|
|
216
|
+
],
|
|
217
|
+
setup(__props, { emit: __emit }) {
|
|
218
|
+
const props = __props;
|
|
219
|
+
const emits = __emit;
|
|
220
|
+
const { max, min, inverted } = toRefs(props);
|
|
221
|
+
const rootContext = injectSliderRootContext();
|
|
222
|
+
const { forwardRef, currentElement: sliderElement } = useForwardExpose();
|
|
223
|
+
const offsetPosition = ref();
|
|
224
|
+
const rectRef = ref();
|
|
225
|
+
const isSlidingFromBottom = computed(() => !inverted.value);
|
|
226
|
+
function getValueFromPointerEvent(event, slideStart) {
|
|
227
|
+
const rect = rectRef.value || sliderElement.value.getBoundingClientRect();
|
|
228
|
+
const thumb = [...rootContext.thumbElements.value][rootContext.valueIndexToChangeRef.value];
|
|
229
|
+
const thumbHeight = rootContext.thumbAlignment.value === "contain" ? thumb.clientHeight : 0;
|
|
230
|
+
if (!offsetPosition.value && !slideStart && rootContext.thumbAlignment.value === "contain") offsetPosition.value = event.clientY - thumb.getBoundingClientRect().top;
|
|
231
|
+
const input = [0, rect.height - thumbHeight];
|
|
232
|
+
const output = isSlidingFromBottom.value ? [max.value, min.value] : [min.value, max.value];
|
|
233
|
+
const value = linearScale(input, output);
|
|
234
|
+
const position = slideStart ? event.clientY - rect.top - thumbHeight / 2 : event.clientY - rect.top - (offsetPosition.value ?? 0);
|
|
235
|
+
rectRef.value = rect;
|
|
236
|
+
return value(position);
|
|
237
|
+
}
|
|
238
|
+
const startEdge = computed(() => isSlidingFromBottom.value ? "bottom" : "top");
|
|
239
|
+
const endEdge = computed(() => isSlidingFromBottom.value ? "top" : "bottom");
|
|
240
|
+
const direction = computed(() => isSlidingFromBottom.value ? 1 : -1);
|
|
241
|
+
provideSliderOrientationContext({
|
|
242
|
+
startEdge,
|
|
243
|
+
endEdge,
|
|
244
|
+
direction,
|
|
245
|
+
size: "height"
|
|
246
|
+
});
|
|
247
|
+
return (_ctx, _cache) => {
|
|
248
|
+
return openBlock(), createBlock(SliderImpl_default, {
|
|
249
|
+
ref: unref(forwardRef),
|
|
250
|
+
"data-orientation": "vertical",
|
|
251
|
+
style: normalizeStyle({ ["--reka-slider-thumb-transform"]: !isSlidingFromBottom.value && unref(rootContext).thumbAlignment.value === "overflow" ? "translateY(-50%)" : "translateY(50%)" }),
|
|
252
|
+
onSlideStart: _cache[0] || (_cache[0] = (event) => {
|
|
253
|
+
const value = getValueFromPointerEvent(event, true);
|
|
254
|
+
emits("slideStart", value);
|
|
255
|
+
}),
|
|
256
|
+
onSlideMove: _cache[1] || (_cache[1] = (event) => {
|
|
257
|
+
const value = getValueFromPointerEvent(event);
|
|
258
|
+
emits("slideMove", value);
|
|
259
|
+
}),
|
|
260
|
+
onSlideEnd: _cache[2] || (_cache[2] = () => {
|
|
261
|
+
rectRef.value = void 0;
|
|
262
|
+
offsetPosition.value = void 0;
|
|
263
|
+
emits("slideEnd");
|
|
264
|
+
}),
|
|
265
|
+
onStepKeyDown: _cache[3] || (_cache[3] = (event) => {
|
|
266
|
+
const slideDirection = isSlidingFromBottom.value ? "from-bottom" : "from-top";
|
|
267
|
+
const isBackKey = unref(BACK_KEYS)[slideDirection].includes(event.key);
|
|
268
|
+
emits("stepKeyDown", event, isBackKey ? -1 : 1);
|
|
269
|
+
}),
|
|
270
|
+
onEndKeyDown: _cache[4] || (_cache[4] = ($event) => emits("endKeyDown", $event)),
|
|
271
|
+
onHomeKeyDown: _cache[5] || (_cache[5] = ($event) => emits("homeKeyDown", $event))
|
|
272
|
+
}, {
|
|
273
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
274
|
+
_: 3
|
|
275
|
+
}, 8, ["style"]);
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
var SliderVertical_default = SliderVertical_vue_vue_type_script_setup_true_lang_default;
|
|
280
|
+
const [injectSliderRootContext, provideSliderRootContext] = createContext("SliderRoot");
|
|
281
|
+
var SliderRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
282
|
+
inheritAttrs: false,
|
|
283
|
+
__name: "SliderRoot",
|
|
284
|
+
props: {
|
|
285
|
+
defaultValue: {
|
|
286
|
+
type: Array,
|
|
287
|
+
required: false,
|
|
288
|
+
default: () => [0]
|
|
289
|
+
},
|
|
290
|
+
modelValue: {
|
|
291
|
+
type: [Array, null],
|
|
292
|
+
required: false
|
|
293
|
+
},
|
|
294
|
+
disabled: {
|
|
295
|
+
type: Boolean,
|
|
296
|
+
required: false,
|
|
297
|
+
default: false
|
|
298
|
+
},
|
|
299
|
+
orientation: {
|
|
300
|
+
type: String,
|
|
301
|
+
required: false,
|
|
302
|
+
default: "horizontal"
|
|
303
|
+
},
|
|
304
|
+
dir: {
|
|
305
|
+
type: String,
|
|
306
|
+
required: false
|
|
307
|
+
},
|
|
308
|
+
inverted: {
|
|
309
|
+
type: Boolean,
|
|
310
|
+
required: false,
|
|
311
|
+
default: false
|
|
312
|
+
},
|
|
313
|
+
min: {
|
|
314
|
+
type: Number,
|
|
315
|
+
required: false,
|
|
316
|
+
default: 0
|
|
317
|
+
},
|
|
318
|
+
max: {
|
|
319
|
+
type: Number,
|
|
320
|
+
required: false,
|
|
321
|
+
default: 100
|
|
322
|
+
},
|
|
323
|
+
step: {
|
|
324
|
+
type: Number,
|
|
325
|
+
required: false,
|
|
326
|
+
default: 1
|
|
327
|
+
},
|
|
328
|
+
minStepsBetweenThumbs: {
|
|
329
|
+
type: Number,
|
|
330
|
+
required: false,
|
|
331
|
+
default: 0
|
|
332
|
+
},
|
|
333
|
+
thumbAlignment: {
|
|
334
|
+
type: String,
|
|
335
|
+
required: false,
|
|
336
|
+
default: "contain"
|
|
337
|
+
},
|
|
338
|
+
asChild: {
|
|
339
|
+
type: Boolean,
|
|
340
|
+
required: false
|
|
341
|
+
},
|
|
342
|
+
as: {
|
|
343
|
+
type: null,
|
|
344
|
+
required: false,
|
|
345
|
+
default: "span"
|
|
346
|
+
},
|
|
347
|
+
name: {
|
|
348
|
+
type: String,
|
|
349
|
+
required: false
|
|
350
|
+
},
|
|
351
|
+
required: {
|
|
352
|
+
type: Boolean,
|
|
353
|
+
required: false
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
emits: ["update:modelValue", "valueCommit"],
|
|
357
|
+
setup(__props, { emit: __emit }) {
|
|
358
|
+
const props = __props;
|
|
359
|
+
const emits = __emit;
|
|
360
|
+
const { min, max, step, minStepsBetweenThumbs, orientation, disabled, thumbAlignment, dir: propDir } = toRefs(props);
|
|
361
|
+
const dir = useDirection(propDir);
|
|
362
|
+
const { forwardRef, currentElement } = useForwardExpose();
|
|
363
|
+
const isFormControl = useFormControl(currentElement);
|
|
364
|
+
const { CollectionSlot } = useCollection({ isProvider: true });
|
|
365
|
+
const modelValue = useVModel(props, "modelValue", emits, {
|
|
366
|
+
defaultValue: props.defaultValue,
|
|
367
|
+
passive: props.modelValue === void 0
|
|
368
|
+
});
|
|
369
|
+
const currentModelValue = computed(() => Array.isArray(modelValue.value) ? [...modelValue.value] : []);
|
|
370
|
+
const valueIndexToChangeRef = ref(0);
|
|
371
|
+
const valuesBeforeSlideStartRef = ref(currentModelValue.value);
|
|
372
|
+
function handleSlideStart(value) {
|
|
373
|
+
const closestIndex = getClosestValueIndex(currentModelValue.value, value);
|
|
374
|
+
updateValues(value, closestIndex);
|
|
375
|
+
}
|
|
376
|
+
function handleSlideMove(value) {
|
|
377
|
+
updateValues(value, valueIndexToChangeRef.value);
|
|
378
|
+
}
|
|
379
|
+
function handleSlideEnd() {
|
|
380
|
+
const prevValue = valuesBeforeSlideStartRef.value[valueIndexToChangeRef.value];
|
|
381
|
+
const nextValue = currentModelValue.value[valueIndexToChangeRef.value];
|
|
382
|
+
const hasChanged = nextValue !== prevValue;
|
|
383
|
+
if (hasChanged) emits("valueCommit", toRaw(currentModelValue.value));
|
|
384
|
+
}
|
|
385
|
+
function updateValues(value, atIndex, { commit } = { commit: false }) {
|
|
386
|
+
var _a;
|
|
387
|
+
const decimalCount = getDecimalCount(step.value);
|
|
388
|
+
const snapToStep = roundValue(Math.round((value - min.value) / step.value) * step.value + min.value, decimalCount);
|
|
389
|
+
const nextValue = clamp(snapToStep, min.value, max.value);
|
|
390
|
+
const nextValues = getNextSortedValues(currentModelValue.value, nextValue, atIndex);
|
|
391
|
+
if (hasMinStepsBetweenValues(nextValues, minStepsBetweenThumbs.value * step.value)) {
|
|
392
|
+
valueIndexToChangeRef.value = nextValues.indexOf(nextValue);
|
|
393
|
+
const hasChanged = String(nextValues) !== String(modelValue.value);
|
|
394
|
+
if (hasChanged && commit) emits("valueCommit", nextValues);
|
|
395
|
+
if (hasChanged) {
|
|
396
|
+
(_a = thumbElements.value[valueIndexToChangeRef.value]) == null ? void 0 : _a.focus();
|
|
397
|
+
modelValue.value = nextValues;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
const thumbElements = ref([]);
|
|
402
|
+
provideSliderRootContext({
|
|
403
|
+
modelValue,
|
|
404
|
+
currentModelValue,
|
|
405
|
+
valueIndexToChangeRef,
|
|
406
|
+
thumbElements,
|
|
407
|
+
orientation,
|
|
408
|
+
min,
|
|
409
|
+
max,
|
|
410
|
+
disabled,
|
|
411
|
+
thumbAlignment
|
|
412
|
+
});
|
|
413
|
+
return (_ctx, _cache) => {
|
|
414
|
+
return openBlock(), createBlock(unref(CollectionSlot), null, {
|
|
415
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(unref(orientation) === "horizontal" ? SliderHorizontal_default : SliderVertical_default), mergeProps(_ctx.$attrs, {
|
|
416
|
+
ref: unref(forwardRef),
|
|
417
|
+
"as-child": _ctx.asChild,
|
|
418
|
+
as: _ctx.as,
|
|
419
|
+
min: unref(min),
|
|
420
|
+
max: unref(max),
|
|
421
|
+
dir: unref(dir),
|
|
422
|
+
inverted: _ctx.inverted,
|
|
423
|
+
"aria-disabled": unref(disabled),
|
|
424
|
+
"data-disabled": unref(disabled) ? "" : void 0,
|
|
425
|
+
onPointerdown: _cache[0] || (_cache[0] = () => {
|
|
426
|
+
if (!unref(disabled)) valuesBeforeSlideStartRef.value = currentModelValue.value;
|
|
427
|
+
}),
|
|
428
|
+
onSlideStart: _cache[1] || (_cache[1] = ($event) => !unref(disabled) && handleSlideStart($event)),
|
|
429
|
+
onSlideMove: _cache[2] || (_cache[2] = ($event) => !unref(disabled) && handleSlideMove($event)),
|
|
430
|
+
onSlideEnd: _cache[3] || (_cache[3] = ($event) => !unref(disabled) && handleSlideEnd()),
|
|
431
|
+
onHomeKeyDown: _cache[4] || (_cache[4] = ($event) => !unref(disabled) && updateValues(unref(min), 0, { commit: true })),
|
|
432
|
+
onEndKeyDown: _cache[5] || (_cache[5] = ($event) => !unref(disabled) && updateValues(unref(max), currentModelValue.value.length - 1, { commit: true })),
|
|
433
|
+
onStepKeyDown: _cache[6] || (_cache[6] = (event, direction) => {
|
|
434
|
+
if (!unref(disabled)) {
|
|
435
|
+
const isPageKey = unref(PAGE_KEYS).includes(event.key);
|
|
436
|
+
const isSkipKey = isPageKey || event.shiftKey && unref(ARROW_KEYS).includes(event.key);
|
|
437
|
+
const multiplier = isSkipKey ? 10 : 1;
|
|
438
|
+
const atIndex = valueIndexToChangeRef.value;
|
|
439
|
+
const value = currentModelValue.value[atIndex];
|
|
440
|
+
const stepInDirection = unref(step) * multiplier * direction;
|
|
441
|
+
updateValues(value + stepInDirection, atIndex, { commit: true });
|
|
442
|
+
}
|
|
443
|
+
})
|
|
444
|
+
}), {
|
|
445
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default", { modelValue: unref(modelValue) }), unref(isFormControl) && _ctx.name ? (openBlock(), createBlock(unref(VisuallyHiddenInput_default), {
|
|
446
|
+
key: 0,
|
|
447
|
+
type: "number",
|
|
448
|
+
value: unref(modelValue),
|
|
449
|
+
name: _ctx.name,
|
|
450
|
+
required: _ctx.required,
|
|
451
|
+
disabled: unref(disabled),
|
|
452
|
+
step: unref(step)
|
|
453
|
+
}, null, 8, [
|
|
454
|
+
"value",
|
|
455
|
+
"name",
|
|
456
|
+
"required",
|
|
457
|
+
"disabled",
|
|
458
|
+
"step"
|
|
459
|
+
])) : createCommentVNode("v-if", true)]),
|
|
460
|
+
_: 3
|
|
461
|
+
}, 16, [
|
|
462
|
+
"as-child",
|
|
463
|
+
"as",
|
|
464
|
+
"min",
|
|
465
|
+
"max",
|
|
466
|
+
"dir",
|
|
467
|
+
"inverted",
|
|
468
|
+
"aria-disabled",
|
|
469
|
+
"data-disabled"
|
|
470
|
+
]))]),
|
|
471
|
+
_: 3
|
|
472
|
+
});
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
var SliderRoot_default = SliderRoot_vue_vue_type_script_setup_true_lang_default;
|
|
477
|
+
var SliderImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
478
|
+
__name: "SliderImpl",
|
|
479
|
+
props: {
|
|
480
|
+
asChild: {
|
|
481
|
+
type: Boolean,
|
|
482
|
+
required: false
|
|
483
|
+
},
|
|
484
|
+
as: {
|
|
485
|
+
type: null,
|
|
486
|
+
required: false,
|
|
487
|
+
default: "span"
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
emits: [
|
|
491
|
+
"slideStart",
|
|
492
|
+
"slideMove",
|
|
493
|
+
"slideEnd",
|
|
494
|
+
"homeKeyDown",
|
|
495
|
+
"endKeyDown",
|
|
496
|
+
"stepKeyDown"
|
|
497
|
+
],
|
|
498
|
+
setup(__props, { emit: __emit }) {
|
|
499
|
+
const props = __props;
|
|
500
|
+
const emits = __emit;
|
|
501
|
+
const rootContext = injectSliderRootContext();
|
|
502
|
+
return (_ctx, _cache) => {
|
|
503
|
+
return openBlock(), createBlock(unref(Primitive), mergeProps({ "data-slider-impl": "" }, props, {
|
|
504
|
+
onKeydown: _cache[0] || (_cache[0] = (event) => {
|
|
505
|
+
if (event.key === "Home") {
|
|
506
|
+
emits("homeKeyDown", event);
|
|
507
|
+
event.preventDefault();
|
|
508
|
+
} else if (event.key === "End") {
|
|
509
|
+
emits("endKeyDown", event);
|
|
510
|
+
event.preventDefault();
|
|
511
|
+
} else if (unref(PAGE_KEYS).concat(unref(ARROW_KEYS)).includes(event.key)) {
|
|
512
|
+
emits("stepKeyDown", event);
|
|
513
|
+
event.preventDefault();
|
|
514
|
+
}
|
|
515
|
+
}),
|
|
516
|
+
onPointerdown: _cache[1] || (_cache[1] = (event) => {
|
|
517
|
+
const target = event.target;
|
|
518
|
+
target.setPointerCapture(event.pointerId);
|
|
519
|
+
event.preventDefault();
|
|
520
|
+
if (unref(rootContext).thumbElements.value.includes(target)) target.focus();
|
|
521
|
+
else emits("slideStart", event);
|
|
522
|
+
}),
|
|
523
|
+
onPointermove: _cache[2] || (_cache[2] = (event) => {
|
|
524
|
+
const target = event.target;
|
|
525
|
+
if (target.hasPointerCapture(event.pointerId)) emits("slideMove", event);
|
|
526
|
+
}),
|
|
527
|
+
onPointerup: _cache[3] || (_cache[3] = (event) => {
|
|
528
|
+
const target = event.target;
|
|
529
|
+
if (target.hasPointerCapture(event.pointerId)) {
|
|
530
|
+
target.releasePointerCapture(event.pointerId);
|
|
531
|
+
emits("slideEnd", event);
|
|
532
|
+
}
|
|
533
|
+
})
|
|
534
|
+
}), {
|
|
535
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
536
|
+
_: 3
|
|
537
|
+
}, 16);
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
var SliderImpl_default = SliderImpl_vue_vue_type_script_setup_true_lang_default;
|
|
542
|
+
var SliderRange_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
543
|
+
__name: "SliderRange",
|
|
544
|
+
props: {
|
|
545
|
+
asChild: {
|
|
546
|
+
type: Boolean,
|
|
547
|
+
required: false
|
|
548
|
+
},
|
|
549
|
+
as: {
|
|
550
|
+
type: null,
|
|
551
|
+
required: false,
|
|
552
|
+
default: "span"
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
setup(__props) {
|
|
556
|
+
const rootContext = injectSliderRootContext();
|
|
557
|
+
const orientation = injectSliderOrientationContext();
|
|
558
|
+
useForwardExpose();
|
|
559
|
+
const percentages = computed(() => rootContext.currentModelValue.value.map((value) => convertValueToPercentage(value, rootContext.min.value, rootContext.max.value)));
|
|
560
|
+
const offsetStart = computed(() => rootContext.currentModelValue.value.length > 1 ? Math.min(...percentages.value) : 0);
|
|
561
|
+
const offsetEnd = computed(() => 100 - Math.max(...percentages.value, 0));
|
|
562
|
+
return (_ctx, _cache) => {
|
|
563
|
+
return openBlock(), createBlock(unref(Primitive), {
|
|
564
|
+
"data-disabled": unref(rootContext).disabled.value ? "" : void 0,
|
|
565
|
+
"data-orientation": unref(rootContext).orientation.value,
|
|
566
|
+
"as-child": _ctx.asChild,
|
|
567
|
+
as: _ctx.as,
|
|
568
|
+
style: normalizeStyle({
|
|
569
|
+
[unref(orientation).startEdge.value]: `${offsetStart.value}%`,
|
|
570
|
+
[unref(orientation).endEdge.value]: `${offsetEnd.value}%`
|
|
571
|
+
})
|
|
572
|
+
}, {
|
|
573
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
574
|
+
_: 3
|
|
575
|
+
}, 8, [
|
|
576
|
+
"data-disabled",
|
|
577
|
+
"data-orientation",
|
|
578
|
+
"as-child",
|
|
579
|
+
"as",
|
|
580
|
+
"style"
|
|
581
|
+
]);
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
var SliderRange_default = SliderRange_vue_vue_type_script_setup_true_lang_default;
|
|
586
|
+
var SliderThumbImpl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
587
|
+
inheritAttrs: false,
|
|
588
|
+
__name: "SliderThumbImpl",
|
|
589
|
+
props: {
|
|
590
|
+
index: {
|
|
591
|
+
type: Number,
|
|
592
|
+
required: true
|
|
593
|
+
},
|
|
594
|
+
asChild: {
|
|
595
|
+
type: Boolean,
|
|
596
|
+
required: false
|
|
597
|
+
},
|
|
598
|
+
as: {
|
|
599
|
+
type: null,
|
|
600
|
+
required: false
|
|
601
|
+
}
|
|
602
|
+
},
|
|
603
|
+
setup(__props) {
|
|
604
|
+
const props = __props;
|
|
605
|
+
const rootContext = injectSliderRootContext();
|
|
606
|
+
const orientation = injectSliderOrientationContext();
|
|
607
|
+
const { forwardRef, currentElement: thumbElement } = useForwardExpose();
|
|
608
|
+
const { CollectionItem } = useCollection();
|
|
609
|
+
const value = computed(() => {
|
|
610
|
+
var _a, _b;
|
|
611
|
+
return (_b = (_a = rootContext.modelValue) == null ? void 0 : _a.value) == null ? void 0 : _b[props.index];
|
|
612
|
+
});
|
|
613
|
+
const percent = computed(() => value.value === void 0 ? 0 : convertValueToPercentage(value.value, rootContext.min.value ?? 0, rootContext.max.value ?? 100));
|
|
614
|
+
const label = computed(() => {
|
|
615
|
+
var _a, _b;
|
|
616
|
+
return getLabel(props.index, ((_b = (_a = rootContext.modelValue) == null ? void 0 : _a.value) == null ? void 0 : _b.length) ?? 0);
|
|
617
|
+
});
|
|
618
|
+
const size = useSize(thumbElement);
|
|
619
|
+
const orientationSize = computed(() => size[orientation.size].value);
|
|
620
|
+
const thumbInBoundsOffset = computed(() => {
|
|
621
|
+
if (rootContext.thumbAlignment.value === "overflow" || !orientationSize.value) return 0;
|
|
622
|
+
else return getThumbInBoundsOffset(orientationSize.value, percent.value, orientation.direction.value);
|
|
623
|
+
});
|
|
624
|
+
const isMounted = useMounted();
|
|
625
|
+
onMounted(() => {
|
|
626
|
+
rootContext.thumbElements.value.push(thumbElement.value);
|
|
627
|
+
});
|
|
628
|
+
onUnmounted(() => {
|
|
629
|
+
const i = rootContext.thumbElements.value.findIndex((i$1) => i$1 === thumbElement.value) ?? -1;
|
|
630
|
+
rootContext.thumbElements.value.splice(i, 1);
|
|
631
|
+
});
|
|
632
|
+
return (_ctx, _cache) => {
|
|
633
|
+
return openBlock(), createBlock(unref(CollectionItem), null, {
|
|
634
|
+
default: withCtx(() => [createVNode(unref(Primitive), mergeProps(_ctx.$attrs, {
|
|
635
|
+
ref: unref(forwardRef),
|
|
636
|
+
role: "slider",
|
|
637
|
+
tabindex: unref(rootContext).disabled.value ? void 0 : 0,
|
|
638
|
+
"aria-label": _ctx.$attrs["aria-label"] || label.value,
|
|
639
|
+
"data-disabled": unref(rootContext).disabled.value ? "" : void 0,
|
|
640
|
+
"data-orientation": unref(rootContext).orientation.value,
|
|
641
|
+
"aria-valuenow": value.value,
|
|
642
|
+
"aria-valuemin": unref(rootContext).min.value,
|
|
643
|
+
"aria-valuemax": unref(rootContext).max.value,
|
|
644
|
+
"aria-orientation": unref(rootContext).orientation.value,
|
|
645
|
+
"as-child": _ctx.asChild,
|
|
646
|
+
as: _ctx.as,
|
|
647
|
+
style: {
|
|
648
|
+
transform: "var(--reka-slider-thumb-transform)",
|
|
649
|
+
position: "absolute",
|
|
650
|
+
[unref(orientation).startEdge.value]: `calc(${percent.value}% + ${thumbInBoundsOffset.value}px)`,
|
|
651
|
+
display: !unref(isMounted) && value.value === void 0 ? "none" : void 0
|
|
652
|
+
},
|
|
653
|
+
onFocus: _cache[0] || (_cache[0] = () => {
|
|
654
|
+
unref(rootContext).valueIndexToChangeRef.value = _ctx.index;
|
|
655
|
+
})
|
|
656
|
+
}), {
|
|
657
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
658
|
+
_: 3
|
|
659
|
+
}, 16, [
|
|
660
|
+
"tabindex",
|
|
661
|
+
"aria-label",
|
|
662
|
+
"data-disabled",
|
|
663
|
+
"data-orientation",
|
|
664
|
+
"aria-valuenow",
|
|
665
|
+
"aria-valuemin",
|
|
666
|
+
"aria-valuemax",
|
|
667
|
+
"aria-orientation",
|
|
668
|
+
"as-child",
|
|
669
|
+
"as",
|
|
670
|
+
"style"
|
|
671
|
+
])]),
|
|
672
|
+
_: 3
|
|
673
|
+
});
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
var SliderThumbImpl_default = SliderThumbImpl_vue_vue_type_script_setup_true_lang_default;
|
|
678
|
+
var SliderThumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
679
|
+
__name: "SliderThumb",
|
|
680
|
+
props: {
|
|
681
|
+
asChild: {
|
|
682
|
+
type: Boolean,
|
|
683
|
+
required: false
|
|
684
|
+
},
|
|
685
|
+
as: {
|
|
686
|
+
type: null,
|
|
687
|
+
required: false,
|
|
688
|
+
default: "span"
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
setup(__props) {
|
|
692
|
+
const props = __props;
|
|
693
|
+
const { getItems } = useCollection();
|
|
694
|
+
const { forwardRef, currentElement: thumbElement } = useForwardExpose();
|
|
695
|
+
const index = computed(() => thumbElement.value ? getItems(true).findIndex((i) => i.ref === thumbElement.value) : -1);
|
|
696
|
+
return (_ctx, _cache) => {
|
|
697
|
+
return openBlock(), createBlock(SliderThumbImpl_default, mergeProps({ ref: unref(forwardRef) }, props, { index: index.value }), {
|
|
698
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
699
|
+
_: 3
|
|
700
|
+
}, 16, ["index"]);
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
var SliderThumb_default = SliderThumb_vue_vue_type_script_setup_true_lang_default;
|
|
705
|
+
var SliderTrack_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
706
|
+
__name: "SliderTrack",
|
|
707
|
+
props: {
|
|
708
|
+
asChild: {
|
|
709
|
+
type: Boolean,
|
|
710
|
+
required: false
|
|
711
|
+
},
|
|
712
|
+
as: {
|
|
713
|
+
type: null,
|
|
714
|
+
required: false,
|
|
715
|
+
default: "span"
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
setup(__props) {
|
|
719
|
+
const rootContext = injectSliderRootContext();
|
|
720
|
+
useForwardExpose();
|
|
721
|
+
return (_ctx, _cache) => {
|
|
722
|
+
return openBlock(), createBlock(unref(Primitive), {
|
|
723
|
+
"as-child": _ctx.asChild,
|
|
724
|
+
as: _ctx.as,
|
|
725
|
+
"data-disabled": unref(rootContext).disabled.value ? "" : void 0,
|
|
726
|
+
"data-orientation": unref(rootContext).orientation.value
|
|
727
|
+
}, {
|
|
728
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
729
|
+
_: 3
|
|
730
|
+
}, 8, [
|
|
731
|
+
"as-child",
|
|
732
|
+
"as",
|
|
733
|
+
"data-disabled",
|
|
734
|
+
"data-orientation"
|
|
735
|
+
]);
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
var SliderTrack_default = SliderTrack_vue_vue_type_script_setup_true_lang_default;
|
|
740
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
741
|
+
__name: "Slider",
|
|
742
|
+
props: {
|
|
743
|
+
defaultValue: {},
|
|
744
|
+
modelValue: {},
|
|
745
|
+
disabled: { type: Boolean },
|
|
746
|
+
orientation: {},
|
|
747
|
+
dir: {},
|
|
748
|
+
inverted: { type: Boolean },
|
|
749
|
+
min: {},
|
|
750
|
+
max: {},
|
|
751
|
+
step: {},
|
|
752
|
+
minStepsBetweenThumbs: {},
|
|
753
|
+
thumbAlignment: {},
|
|
754
|
+
asChild: { type: Boolean },
|
|
755
|
+
as: {},
|
|
756
|
+
name: {},
|
|
757
|
+
required: { type: Boolean },
|
|
758
|
+
class: {}
|
|
759
|
+
},
|
|
760
|
+
emits: ["update:modelValue", "valueCommit"],
|
|
761
|
+
setup(__props, { emit: __emit }) {
|
|
762
|
+
const props = __props;
|
|
763
|
+
const emits = __emit;
|
|
764
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
765
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
766
|
+
return (_ctx, _cache) => {
|
|
767
|
+
return openBlock(), createBlock(unref(SliderRoot_default), mergeProps({
|
|
768
|
+
"data-slot": "slider",
|
|
769
|
+
class: unref(cn)(
|
|
770
|
+
"relative flex w-full cursor-pointer touch-none items-center select-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
771
|
+
props.class
|
|
772
|
+
)
|
|
773
|
+
}, unref(forwarded)), {
|
|
774
|
+
default: withCtx(({ modelValue }) => [
|
|
775
|
+
createVNode(unref(SliderTrack_default), {
|
|
776
|
+
"data-slot": "slider-track",
|
|
777
|
+
class: "bg-muted relative grow overflow-hidden rounded data-[orientation=horizontal]:h-2 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-2"
|
|
778
|
+
}, {
|
|
779
|
+
default: withCtx(() => [
|
|
780
|
+
createVNode(unref(SliderRange_default), {
|
|
781
|
+
"data-slot": "slider-range",
|
|
782
|
+
class: "bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
783
|
+
})
|
|
784
|
+
]),
|
|
785
|
+
_: 1
|
|
786
|
+
}),
|
|
787
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(modelValue, (_, key) => {
|
|
788
|
+
return openBlock(), createBlock(unref(SliderThumb_default), {
|
|
789
|
+
key,
|
|
790
|
+
"data-slot": "slider-thumb",
|
|
791
|
+
class: "bg-white border-primary ring-ring/50 block size-5 shrink-0 rounded border shadow-sm transition-[color,box-shadow,transform] hover:scale-105 hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
792
|
+
});
|
|
793
|
+
}), 128))
|
|
794
|
+
]),
|
|
795
|
+
_: 1
|
|
796
|
+
}, 16, ["class"]);
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
export {
|
|
801
|
+
_sfc_main as _
|
|
802
|
+
};
|