@kuina-ui/vue 0.5.0 → 0.7.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/dist/blocks/pagination/Pagination.js +4 -0
- package/dist/blocks/pagination/Pagination.vue.d.ts +39 -0
- package/dist/blocks/pagination/Pagination.vue_vue_type_script_setup_true_lang.js +151 -0
- package/dist/blocks/pagination/index.d.ts +2 -0
- package/dist/blocks/pagination/pagination.theme.d.ts +12 -0
- package/dist/blocks/pagination/pagination.theme.js +12 -0
- package/dist/blocks/table/Table.js +4 -0
- package/dist/blocks/table/Table.vue.d.ts +149 -0
- package/dist/blocks/table/Table.vue_vue_type_script_setup_true_lang.js +933 -0
- package/dist/blocks/table/TableCellText.js +4 -0
- package/dist/blocks/table/TableCellText.vue.d.ts +8 -0
- package/dist/blocks/table/TableCellText.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/blocks/table/index.d.ts +2 -0
- package/dist/blocks/table/table.theme.d.ts +286 -0
- package/dist/blocks/table/table.theme.js +391 -0
- package/dist/blocks/table/useLoadMoreTrigger.d.ts +11 -0
- package/dist/blocks/table/useLoadMoreTrigger.js +31 -0
- package/dist/blocks/table/usePinnedColumnOffsets.d.ts +10 -0
- package/dist/blocks/table/usePinnedColumnOffsets.js +63 -0
- package/dist/blocks/table/useRowReorder.d.ts +18 -0
- package/dist/blocks/table/useRowReorder.js +92 -0
- package/dist/blocks/table/useRowVirtualizer.d.ts +17 -0
- package/dist/blocks/table/useRowVirtualizer.js +45 -0
- package/dist/blocks/table/useTableSections.d.ts +46 -0
- package/dist/blocks/table/useTableSections.js +86 -0
- package/dist/components/alert/Alert.js +4 -0
- package/dist/components/alert/Alert.vue.d.ts +2 -2
- package/dist/components/alert/Alert.vue_vue_type_script_setup_true_lang.js +87 -0
- package/dist/components/alert/alert.theme.js +93 -0
- package/dist/components/avatar-group/AvatarGroup.js +4 -0
- package/dist/components/avatar-group/AvatarGroup.vue.d.ts +1 -1
- package/dist/components/avatar-group/AvatarGroup.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/components/avatar-group/avatar-group.theme.js +22 -0
- package/dist/components/date-picker/DateCalendar.js +4 -0
- package/dist/components/date-picker/DateCalendar.vue_vue_type_script_setup_true_lang.js +194 -0
- package/dist/components/date-picker/DateCalendarMonth.js +4 -0
- package/dist/components/date-picker/DateCalendarMonth.vue_vue_type_script_setup_true_lang.js +106 -0
- package/dist/components/date-picker/DateCalendarPopover.js +4 -0
- package/dist/components/date-picker/DateCalendarPopover.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/date-picker/DatePicker.js +4 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +6 -6
- package/dist/components/date-picker/DatePicker.vue_vue_type_script_setup_true_lang.js +224 -0
- package/dist/components/date-picker/DatePickerField.js +4 -0
- package/dist/components/date-picker/DatePickerField.vue.d.ts +6 -6
- package/dist/components/date-picker/DatePickerField.vue_vue_type_script_setup_true_lang.js +241 -0
- package/dist/components/date-picker/DatePickerPanel.js +4 -0
- package/dist/components/date-picker/DatePickerPanel.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/components/date-picker/DateRangePicker.js +4 -0
- package/dist/components/date-picker/DateRangePicker.vue.d.ts +6 -6
- package/dist/components/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.js +212 -0
- package/dist/components/date-picker/DateRangePickerField.js +4 -0
- package/dist/components/date-picker/DateRangePickerField.vue.d.ts +7 -7
- package/dist/components/date-picker/DateRangePickerField.vue_vue_type_script_setup_true_lang.js +228 -0
- package/dist/components/date-picker/date-calendar.theme.js +46 -0
- package/dist/components/date-picker/date-picker.theme.js +16 -0
- package/dist/components/date-picker/useDatePickerControl.js +47 -0
- package/dist/components/date-picker/useDatePickerPopover.js +39 -0
- package/dist/components/date-picker/useDateRangeSelection.js +50 -0
- package/dist/components/date-picker/useDateRangeTyping.js +59 -0
- package/dist/components/date-picker/useDateTypingFocus.js +37 -0
- package/dist/components/date-picker/useSingleDateSelection.js +11 -0
- package/dist/components/date-picker/useSingleDateTyping.js +31 -0
- package/dist/components/date-picker/useTypedDateInput.js +39 -0
- package/dist/components/menu/Menu.js +4 -0
- package/dist/components/menu/Menu.vue.d.ts +3 -2
- package/dist/components/menu/Menu.vue_vue_type_script_setup_true_lang.js +137 -0
- package/dist/components/menu/MenuItemRow.js +4 -0
- package/dist/components/menu/MenuItemRow.vue_vue_type_script_setup_true_lang.js +117 -0
- package/dist/components/menu/MenuPanel.js +4 -0
- package/dist/components/menu/MenuPanel.vue.d.ts +2 -1
- package/dist/components/menu/MenuPanel.vue_vue_type_script_setup_true_lang.js +249 -0
- package/dist/components/menu/menu.theme.d.ts +5 -0
- package/dist/components/menu/menu.theme.js +174 -0
- package/dist/components/menu/menuContext.js +9 -0
- package/dist/components/menu/menuEntries.js +25 -0
- package/dist/components/select/Select.js +4 -0
- package/dist/components/select/Select.vue.d.ts +2 -2
- package/dist/components/select/Select.vue_vue_type_script_setup_true_lang.js +262 -0
- package/dist/components/select/SelectField.js +4 -0
- package/dist/components/select/SelectField.vue.d.ts +2 -2
- package/dist/components/select/SelectField.vue_vue_type_script_setup_true_lang.js +271 -0
- package/dist/components/select/SelectOptionRow.js +4 -0
- package/dist/components/select/SelectOptionRow.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/components/select/SelectPanel.js +4 -0
- package/dist/components/select/SelectPanel.vue_vue_type_script_setup_true_lang.js +169 -0
- package/dist/components/select/select-panel.theme.js +44 -0
- package/dist/components/select/selectOptions.d.ts +0 -2
- package/dist/components/select/selectOptions.js +66 -0
- package/dist/components/select/useSelectControl.d.ts +3 -3
- package/dist/components/select/useSelectControl.js +62 -0
- package/dist/components/select/useSelectListbox.js +169 -0
- package/dist/components/slider/RangeSlider.js +4 -0
- package/dist/components/slider/RangeSlider.vue.d.ts +55 -0
- package/dist/components/slider/RangeSlider.vue_vue_type_script_setup_true_lang.js +214 -0
- package/dist/components/slider/Slider.js +4 -0
- package/dist/components/slider/Slider.vue.d.ts +49 -0
- package/dist/components/slider/Slider.vue_vue_type_script_setup_true_lang.js +151 -0
- package/dist/components/slider/SliderHeader.js +4 -0
- package/dist/components/slider/SliderHeader.vue.d.ts +30 -0
- package/dist/components/slider/SliderHeader.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/components/slider/index.d.ts +5 -0
- package/dist/components/slider/slider.theme.d.ts +33 -0
- package/dist/components/slider/slider.theme.js +34 -0
- package/dist/components/text-field/TextField.js +4 -0
- package/dist/components/text-field/TextField.vue.d.ts +2 -2
- package/dist/components/text-field/TextField.vue_vue_type_script_setup_true_lang.js +122 -0
- package/dist/components/text-field/text-field.theme.js +379 -0
- package/dist/components/textarea/Textarea.js +4 -0
- package/dist/components/textarea/Textarea.vue.d.ts +1 -1
- package/dist/components/textarea/Textarea.vue_vue_type_script_setup_true_lang.js +93 -0
- package/dist/components/textarea/textarea.theme.js +222 -0
- package/dist/elements/avatar/Avatar.js +4 -0
- package/dist/elements/avatar/Avatar.vue.d.ts +3 -3
- package/dist/elements/avatar/Avatar.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/elements/avatar/avatar.theme.js +141 -0
- package/dist/elements/badge/Badge.js +4 -0
- package/dist/elements/badge/Badge.vue.d.ts +2 -2
- package/dist/elements/badge/Badge.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/elements/badge/badge.theme.js +111 -0
- package/dist/elements/button/Button.js +4 -0
- package/dist/elements/button/Button.vue.d.ts +3 -3
- package/dist/elements/button/Button.vue_vue_type_script_setup_true_lang.js +83 -0
- package/dist/elements/button/button.theme.js +424 -0
- package/dist/elements/checkbox/Checkbox.js +4 -0
- package/dist/elements/checkbox/Checkbox.vue.d.ts +3 -1
- package/dist/elements/checkbox/Checkbox.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/elements/checkbox/checkbox.theme.d.ts +1 -0
- package/dist/elements/checkbox/checkbox.theme.js +22 -0
- package/dist/elements/circular-progress/CircularProgress.js +4 -0
- package/dist/elements/circular-progress/CircularProgress.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/elements/circular-progress/circular-progress.theme.js +8 -0
- package/dist/elements/input/Input.js +4 -0
- package/dist/elements/input/Input.vue.d.ts +62 -0
- package/dist/elements/input/Input.vue_vue_type_script_setup_true_lang.js +138 -0
- package/dist/elements/input/focusInputFromContainer.d.ts +2 -0
- package/dist/elements/input/focusInputFromContainer.js +28 -0
- package/dist/elements/input/index.d.ts +2 -0
- package/dist/elements/input/input.theme.d.ts +81 -0
- package/dist/elements/input/input.theme.js +391 -0
- package/dist/elements/loading-dots/LoadingDots.js +4 -0
- package/dist/elements/loading-dots/LoadingDots.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/elements/loading-dots/loading-dots.theme.js +4 -0
- package/dist/elements/loading-indicator/LoadingIndicator.js +4 -0
- package/dist/elements/loading-indicator/LoadingIndicator.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/elements/loading-indicator/loading-indicator.theme.js +4 -0
- package/dist/elements/popover/Popover.js +4 -0
- package/dist/elements/popover/Popover.vue.d.ts +60 -0
- package/dist/elements/popover/Popover.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/elements/popover/index.d.ts +2 -0
- package/dist/elements/popover/popover.theme.d.ts +20 -0
- package/dist/elements/popover/popover.theme.js +17 -0
- package/dist/elements/popover/popoverLayers.d.ts +5 -0
- package/dist/elements/popover/popoverLayers.js +22 -0
- package/dist/elements/radio-group/RadioGroup.js +4 -0
- package/dist/elements/radio-group/RadioGroup.vue.d.ts +1 -1
- package/dist/elements/radio-group/RadioGroup.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/elements/radio-group/radio-group.theme.js +126 -0
- package/dist/elements/segmented-control/SegmentedControl.js +4 -0
- package/dist/elements/segmented-control/SegmentedControl.vue.d.ts +1 -1
- package/dist/elements/segmented-control/SegmentedControl.vue_vue_type_script_setup_true_lang.js +98 -0
- package/dist/elements/segmented-control/segmented-control.theme.js +201 -0
- package/dist/elements/select-control/SelectControl.js +4 -0
- package/dist/elements/select-control/SelectControl.vue.d.ts +1 -1
- package/dist/elements/select-control/SelectControl.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/elements/select-control/select-control.theme.js +360 -0
- package/dist/elements/select-field-control/SelectFieldControl.js +4 -0
- package/dist/elements/select-field-control/SelectFieldControl.vue.d.ts +1 -1
- package/dist/elements/select-field-control/SelectFieldControl.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/elements/select-field-control/select-field-control.theme.js +299 -0
- package/dist/elements/slider-control/SliderControl.js +4 -0
- package/dist/elements/slider-control/SliderControl.vue.d.ts +35 -0
- package/dist/elements/slider-control/SliderControl.vue_vue_type_script_setup_true_lang.js +228 -0
- package/dist/elements/slider-control/index.d.ts +3 -0
- package/dist/elements/slider-control/slider-control.theme.d.ts +38 -0
- package/dist/elements/slider-control/slider-control.theme.js +35 -0
- package/dist/elements/slider-control/useSliderMarksLayout.d.ts +6 -0
- package/dist/elements/slider-control/useSliderMarksLayout.js +25 -0
- package/dist/elements/switch/Switch.js +4 -0
- package/dist/elements/switch/Switch.vue.d.ts +1 -1
- package/dist/elements/switch/Switch.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/elements/switch/switch.theme.js +37 -0
- package/dist/elements/text-link/TextLink.js +4 -0
- package/dist/elements/text-link/TextLink.vue_vue_type_script_setup_true_lang.js +64 -0
- package/dist/elements/text-link/text-link.theme.js +25 -0
- package/dist/elements/tooltip/Tooltip.js +4 -0
- package/dist/elements/tooltip/Tooltip.vue.d.ts +48 -0
- package/dist/elements/tooltip/Tooltip.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/elements/tooltip/index.d.ts +2 -0
- package/dist/elements/tooltip/tooltip.theme.d.ts +29 -0
- package/dist/elements/tooltip/tooltip.theme.js +46 -0
- package/dist/elements/tooltip/useTooltipOpenState.d.ts +17 -0
- package/dist/elements/tooltip/useTooltipOpenState.js +57 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +38 -1
- package/dist/nuxt.js +12 -13
- package/dist/shared/composables/useApplePlatform.js +10 -0
- package/dist/shared/composables/useCalendarLabels.js +13 -0
- package/dist/shared/composables/useCustomColor.js +10 -0
- package/dist/shared/composables/useDismissOnOutsidePointerDown.d.ts +1 -1
- package/dist/shared/composables/useDismissOnOutsidePointerDown.js +14 -0
- package/dist/shared/composables/useFieldDescription.js +16 -0
- package/dist/shared/composables/useFloatingPosition.d.ts +3 -2
- package/dist/shared/composables/useFloatingPosition.js +113 -0
- package/dist/shared/composables/useMask.js +32 -0
- package/dist/shared/composables/useMaskedFieldModel.d.ts +7 -0
- package/dist/shared/composables/useMaskedFieldModel.js +19 -0
- package/dist/shared/composables/useNumberFieldTyping.d.ts +21 -0
- package/dist/shared/composables/useNumberFieldTyping.js +70 -0
- package/dist/shared/composables/usePointerGraceArea.d.ts +11 -0
- package/dist/shared/composables/usePointerGraceArea.js +40 -0
- package/dist/shared/composables/useRowSelection.d.ts +17 -0
- package/dist/shared/composables/useRowSelection.js +40 -0
- package/dist/shared/composables/useShortcuts.js +21 -0
- package/dist/shared/composables/useSlidingThumb.js +65 -0
- package/dist/shared/composables/useTableRows.d.ts +26 -0
- package/dist/shared/composables/useTableRows.js +41 -0
- package/dist/shared/types/floating-position.d.ts +9 -0
- package/dist/shared/types/pointer-grace-area.d.ts +12 -0
- package/dist/shared/types/slider.d.ts +6 -0
- package/dist/shared/types/table.d.ts +59 -0
- package/dist/shared/types/value-path.d.ts +6 -0
- package/dist/shared/utils/calendarMonth.js +23 -0
- package/dist/shared/utils/computeFloatingPosition.js +32 -0
- package/dist/shared/utils/createDateFormatters.js +31 -0
- package/dist/shared/utils/createDateInputMask.js +103 -0
- package/dist/shared/utils/createDebouncedCallback.d.ts +5 -0
- package/dist/shared/utils/createDebouncedCallback.js +17 -0
- package/dist/shared/utils/createMask.js +65 -0
- package/dist/shared/utils/createShortcutHandler.js +60 -0
- package/dist/shared/utils/createTypeaheadSearch.js +16 -0
- package/dist/shared/utils/editableFieldGuard.js +11 -0
- package/dist/shared/utils/findFirstRenderedVNode.d.ts +3 -0
- package/dist/shared/utils/findFirstRenderedVNode.js +14 -0
- package/dist/shared/utils/flipFloatingPosition.js +28 -0
- package/dist/shared/utils/floatingPanelTransition.js +25 -0
- package/dist/shared/utils/formatShortcut.js +86 -0
- package/dist/shared/utils/isApplePlatform.js +5 -0
- package/dist/shared/utils/isExternalUrl.js +5 -0
- package/dist/shared/utils/isoDate.js +50 -0
- package/dist/shared/utils/normalizeSearchText.d.ts +2 -0
- package/dist/shared/utils/normalizeSearchText.js +6 -0
- package/dist/shared/utils/parseShortcut.js +48 -0
- package/dist/shared/utils/pointerGraceArea.d.ts +11 -0
- package/dist/shared/utils/pointerGraceArea.js +92 -0
- package/dist/shared/utils/readValueAtPath.d.ts +2 -0
- package/dist/shared/utils/readValueAtPath.js +7 -0
- package/dist/shared/utils/resolveFloatingAnchor.d.ts +4 -0
- package/dist/shared/utils/resolveFloatingAnchor.js +15 -0
- package/dist/shared/utils/resolvePressScale.js +5 -0
- package/dist/shared/utils/shiftFloatingPosition.d.ts +3 -0
- package/dist/shared/utils/shiftFloatingPosition.js +21 -0
- package/dist/shared/utils/sliderPosition.d.ts +11 -0
- package/dist/shared/utils/sliderPosition.js +27 -0
- package/dist/shared/utils/sliderThumbs.d.ts +13 -0
- package/dist/shared/utils/sliderThumbs.js +16 -0
- package/dist/shared/utils/steppedValue.d.ts +18 -0
- package/dist/shared/utils/steppedValue.js +21 -0
- package/dist/shared/utils/tableColumnTypes.d.ts +21 -0
- package/dist/shared/utils/tableColumnTypes.js +77 -0
- package/dist/shared/utils/tableColumns.d.ts +20 -0
- package/dist/shared/utils/tableColumns.js +77 -0
- package/dist/shared/utils/tableGroups.d.ts +10 -0
- package/dist/shared/utils/tableGroups.js +34 -0
- package/dist/shared/utils/tableRows.d.ts +25 -0
- package/dist/shared/utils/tableRows.js +80 -0
- package/dist/shared/utils/tableTree.d.ts +15 -0
- package/dist/shared/utils/tableTree.js +22 -0
- package/dist/shared/utils/toggleColumnSort.d.ts +5 -0
- package/dist/shared/utils/toggleColumnSort.js +27 -0
- package/dist/shared/utils/tv.js +1 -0
- package/dist/shared/utils/warnInDevelopment.d.ts +3 -0
- package/dist/shared/utils/warnInDevelopment.js +13 -0
- package/package.json +1 -1
- package/src/index.css +2 -0
- package/src/shared/styles/utilities/shake.css +21 -0
- package/src/shared/styles/utilities/slider-mark-position.css +8 -0
- package/dist/src-Bnn36nLV.js +0 -7856
package/dist/elements/select-field-control/SelectFieldControl.vue_vue_type_script_setup_true_lang.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { selectFieldControlTheme as e } from "./select-field-control.theme.js";
|
|
2
|
+
import { Fragment as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, mergeProps as u, normalizeClass as d, openBlock as f, renderSlot as p, resolveDynamicComponent as m, toDisplayString as h, unref as g, useSlots as _, useTemplateRef as v, withModifiers as y } from "vue";
|
|
3
|
+
import { CircleAlert as b, X as x } from "lucide-vue-next";
|
|
4
|
+
// src/elements/select-field-control/SelectFieldControl.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var S = ["id", "aria-hidden"], C = ["aria-label"], w = ["id"], T = ["id"], E = ["id"], D = /*@__PURE__*/ l({
|
|
6
|
+
__name: "SelectFieldControl",
|
|
7
|
+
props: {
|
|
8
|
+
label: {},
|
|
9
|
+
labelId: {},
|
|
10
|
+
valueId: {},
|
|
11
|
+
hintId: {},
|
|
12
|
+
errorMessageId: {},
|
|
13
|
+
placeholder: {},
|
|
14
|
+
hint: {},
|
|
15
|
+
errorMessage: {},
|
|
16
|
+
size: { default: "4xl" },
|
|
17
|
+
variant: { default: "outline" },
|
|
18
|
+
pill: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !0
|
|
21
|
+
},
|
|
22
|
+
floatLabel: { default: "auto" },
|
|
23
|
+
open: { type: Boolean },
|
|
24
|
+
invalid: { type: Boolean },
|
|
25
|
+
disabled: { type: Boolean },
|
|
26
|
+
hasValue: { type: Boolean },
|
|
27
|
+
leadingIcon: {},
|
|
28
|
+
trailingIcon: {},
|
|
29
|
+
showsClearButton: { type: Boolean },
|
|
30
|
+
clearLabel: { default: "Clear current value" },
|
|
31
|
+
spokenValue: {},
|
|
32
|
+
triggerAttributes: {},
|
|
33
|
+
ui: {},
|
|
34
|
+
class: { type: [
|
|
35
|
+
Array,
|
|
36
|
+
String,
|
|
37
|
+
null,
|
|
38
|
+
Number,
|
|
39
|
+
Boolean
|
|
40
|
+
] }
|
|
41
|
+
},
|
|
42
|
+
emits: ["clear"],
|
|
43
|
+
setup(l, { expose: D, emit: O }) {
|
|
44
|
+
let k = l, A = O, j = _(), M = v("containerElement"), N = v("triggerElement");
|
|
45
|
+
D({
|
|
46
|
+
containerElement: M,
|
|
47
|
+
triggerElement: N
|
|
48
|
+
});
|
|
49
|
+
let P = n(() => k.invalid ? "invalid" : k.disabled ? "disabled" : k.open ? "open" : "idle"), F = n(() => e({
|
|
50
|
+
size: k.size,
|
|
51
|
+
variant: k.variant,
|
|
52
|
+
pill: k.pill,
|
|
53
|
+
fieldState: P.value,
|
|
54
|
+
floatLabel: k.floatLabel,
|
|
55
|
+
labelFloating: k.floatLabel === "always" || k.hasValue || k.open,
|
|
56
|
+
hasLeadingIcon: !!k.leadingIcon,
|
|
57
|
+
disabled: k.disabled,
|
|
58
|
+
open: k.open,
|
|
59
|
+
hasTrailingIcon: !!k.trailingIcon
|
|
60
|
+
}));
|
|
61
|
+
return (e, n) => (f(), a("div", { class: d(F.value.root({ class: [l.ui?.root, k.class] })) }, [o("div", {
|
|
62
|
+
ref_key: "containerElement",
|
|
63
|
+
ref: M,
|
|
64
|
+
class: d(F.value.container({ class: l.ui?.container }))
|
|
65
|
+
}, [
|
|
66
|
+
o("div", u({
|
|
67
|
+
ref_key: "triggerElement",
|
|
68
|
+
ref: N
|
|
69
|
+
}, l.triggerAttributes, { class: F.value.base({ class: l.ui?.base }) }), [
|
|
70
|
+
j.leading ? (f(), a("span", {
|
|
71
|
+
key: 0,
|
|
72
|
+
class: d(F.value.leadingAvatar({ class: l.ui?.leadingAvatar }))
|
|
73
|
+
}, [p(e.$slots, "leading")], 2)) : l.leadingIcon ? (f(), r(m(l.leadingIcon), {
|
|
74
|
+
key: 1,
|
|
75
|
+
class: d(F.value.leadingIcon({ class: l.ui?.leadingIcon }))
|
|
76
|
+
}, null, 8, ["class"])) : i("", !0),
|
|
77
|
+
j.input ? p(e.$slots, "input", { inputClass: F.value.input({ class: l.ui?.input }) }, void 0, void 0, 2) : (f(), a(t, { key: 3 }, [o("span", {
|
|
78
|
+
id: l.valueId,
|
|
79
|
+
"aria-hidden": l.spokenValue ? !0 : void 0,
|
|
80
|
+
class: d(F.value.value({ class: l.ui?.value }))
|
|
81
|
+
}, [l.hasValue ? p(e.$slots, "default", {}, void 0, void 0, 0) : l.placeholder ? (f(), a("span", {
|
|
82
|
+
key: 1,
|
|
83
|
+
class: d(F.value.placeholder({ class: l.ui?.placeholder }))
|
|
84
|
+
}, h(l.placeholder), 3)) : i("", !0)], 10, S), l.spokenValue ? (f(), a("span", {
|
|
85
|
+
key: 0,
|
|
86
|
+
class: d(F.value.selectionForScreenReaders({ class: l.ui?.selectionForScreenReaders }))
|
|
87
|
+
}, h(l.spokenValue), 3)) : i("", !0)], 64)),
|
|
88
|
+
l.showsClearButton || j.status || l.trailingIcon ? (f(), a("span", {
|
|
89
|
+
key: 4,
|
|
90
|
+
class: d(F.value.trailing({ class: l.ui?.trailing }))
|
|
91
|
+
}, [
|
|
92
|
+
l.showsClearButton ? (f(), a("button", {
|
|
93
|
+
key: 0,
|
|
94
|
+
type: "button",
|
|
95
|
+
"aria-label": l.clearLabel,
|
|
96
|
+
class: d(F.value.clearButton({ class: l.ui?.clearButton })),
|
|
97
|
+
onClick: n[0] ||= y((e) => A("clear"), ["stop"]),
|
|
98
|
+
onKeydown: n[1] ||= y(() => {}, ["stop"])
|
|
99
|
+
}, [c(g(x), { class: d(F.value.clearIcon({ class: l.ui?.clearIcon })) }, null, 8, ["class"])], 42, C)) : i("", !0),
|
|
100
|
+
p(e.$slots, "status", { statusClass: F.value.loadingIndicator({ class: l.ui?.loadingIndicator }) }),
|
|
101
|
+
l.trailingIcon ? (f(), r(m(l.trailingIcon), {
|
|
102
|
+
key: 1,
|
|
103
|
+
class: d(F.value.trailingIcon({ class: l.ui?.trailingIcon }))
|
|
104
|
+
}, null, 8, ["class"])) : i("", !0)
|
|
105
|
+
], 2)) : i("", !0)
|
|
106
|
+
], 16),
|
|
107
|
+
o("span", {
|
|
108
|
+
id: l.labelId,
|
|
109
|
+
class: d(F.value.label({ class: l.ui?.label }))
|
|
110
|
+
}, h(l.label), 11, w),
|
|
111
|
+
p(e.$slots, "popup")
|
|
112
|
+
], 2), l.errorMessage ? (f(), a("p", {
|
|
113
|
+
key: 0,
|
|
114
|
+
id: l.errorMessageId,
|
|
115
|
+
class: d(F.value.errorMessage({ class: l.ui?.errorMessage }))
|
|
116
|
+
}, [c(g(b), { class: d(F.value.errorIcon({ class: l.ui?.errorIcon })) }, null, 8, ["class"]), s(" " + h(l.errorMessage), 1)], 10, T)) : l.hint ? (f(), a("p", {
|
|
117
|
+
key: 1,
|
|
118
|
+
id: l.hintId,
|
|
119
|
+
class: d(F.value.hint({ class: l.ui?.hint }))
|
|
120
|
+
}, h(l.hint), 11, E)) : i("", !0)], 2));
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
export { D as default };
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { tv as e } from "../../shared/utils/tv.js";
|
|
2
|
+
// src/elements/select-field-control/select-field-control.theme.ts
|
|
3
|
+
var t = {
|
|
4
|
+
md: {
|
|
5
|
+
height: "h-8",
|
|
6
|
+
fontSize: "text-sm",
|
|
7
|
+
leadingIconSize: "size-3",
|
|
8
|
+
trailingIconSize: "size-4",
|
|
9
|
+
loadingIndicatorSize: "text-base",
|
|
10
|
+
clearButtonSize: "size-5.5",
|
|
11
|
+
clearIconSize: "size-3.5",
|
|
12
|
+
floatingLabelFontSize: "text-[11px]",
|
|
13
|
+
restingLabelFontSize: "text-sm peer-focus-within:text-[11px]",
|
|
14
|
+
pillShape: {
|
|
15
|
+
corners: "rounded-full",
|
|
16
|
+
gutter: "px-4",
|
|
17
|
+
labelOffset: "left-3",
|
|
18
|
+
restingLabelOffsetWithLeadingIcon: "left-8 peer-focus-within:left-3"
|
|
19
|
+
},
|
|
20
|
+
roundedShape: {
|
|
21
|
+
corners: "rounded-lg",
|
|
22
|
+
gutter: "px-3",
|
|
23
|
+
labelOffset: "left-2",
|
|
24
|
+
restingLabelOffsetWithLeadingIcon: "left-7 peer-focus-within:left-2"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
lg: {
|
|
28
|
+
height: "h-9",
|
|
29
|
+
fontSize: "text-sm",
|
|
30
|
+
leadingIconSize: "size-3",
|
|
31
|
+
trailingIconSize: "size-4",
|
|
32
|
+
loadingIndicatorSize: "text-base",
|
|
33
|
+
clearButtonSize: "size-5.5",
|
|
34
|
+
clearIconSize: "size-3.5",
|
|
35
|
+
floatingLabelFontSize: "text-[11px]",
|
|
36
|
+
restingLabelFontSize: "text-sm peer-focus-within:text-[11px]",
|
|
37
|
+
pillShape: {
|
|
38
|
+
corners: "rounded-full",
|
|
39
|
+
gutter: "px-4",
|
|
40
|
+
labelOffset: "left-3",
|
|
41
|
+
restingLabelOffsetWithLeadingIcon: "left-8 peer-focus-within:left-3"
|
|
42
|
+
},
|
|
43
|
+
roundedShape: {
|
|
44
|
+
corners: "rounded-lg",
|
|
45
|
+
gutter: "px-3",
|
|
46
|
+
labelOffset: "left-2",
|
|
47
|
+
restingLabelOffsetWithLeadingIcon: "left-7 peer-focus-within:left-2"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
xl: {
|
|
51
|
+
height: "h-10",
|
|
52
|
+
fontSize: "text-base",
|
|
53
|
+
leadingIconSize: "size-3.5",
|
|
54
|
+
trailingIconSize: "size-4",
|
|
55
|
+
loadingIndicatorSize: "text-lg",
|
|
56
|
+
clearButtonSize: "size-6",
|
|
57
|
+
clearIconSize: "size-4",
|
|
58
|
+
floatingLabelFontSize: "text-[11px]",
|
|
59
|
+
restingLabelFontSize: "text-base peer-focus-within:text-[11px]",
|
|
60
|
+
pillShape: {
|
|
61
|
+
corners: "rounded-full",
|
|
62
|
+
gutter: "px-4.75",
|
|
63
|
+
labelOffset: "left-3.75",
|
|
64
|
+
restingLabelOffsetWithLeadingIcon: "left-9.25 peer-focus-within:left-3.75"
|
|
65
|
+
},
|
|
66
|
+
roundedShape: {
|
|
67
|
+
corners: "rounded-[10px]",
|
|
68
|
+
gutter: "px-3.5",
|
|
69
|
+
labelOffset: "left-2.5",
|
|
70
|
+
restingLabelOffsetWithLeadingIcon: "left-8 peer-focus-within:left-2.5"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"2xl": {
|
|
74
|
+
height: "h-11",
|
|
75
|
+
fontSize: "text-base",
|
|
76
|
+
leadingIconSize: "size-4",
|
|
77
|
+
trailingIconSize: "size-4",
|
|
78
|
+
loadingIndicatorSize: "text-lg",
|
|
79
|
+
clearButtonSize: "size-6",
|
|
80
|
+
clearIconSize: "size-4",
|
|
81
|
+
floatingLabelFontSize: "text-xs",
|
|
82
|
+
restingLabelFontSize: "text-base peer-focus-within:text-xs",
|
|
83
|
+
pillShape: {
|
|
84
|
+
corners: "rounded-full",
|
|
85
|
+
gutter: "px-5.25",
|
|
86
|
+
labelOffset: "left-4.25",
|
|
87
|
+
restingLabelOffsetWithLeadingIcon: "left-10.25 peer-focus-within:left-4.25"
|
|
88
|
+
},
|
|
89
|
+
roundedShape: {
|
|
90
|
+
corners: "rounded-xl",
|
|
91
|
+
gutter: "px-4",
|
|
92
|
+
labelOffset: "left-3",
|
|
93
|
+
restingLabelOffsetWithLeadingIcon: "left-9 peer-focus-within:left-3"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"3xl": {
|
|
97
|
+
height: "h-12",
|
|
98
|
+
fontSize: "text-base",
|
|
99
|
+
leadingIconSize: "size-4",
|
|
100
|
+
trailingIconSize: "size-4.5",
|
|
101
|
+
loadingIndicatorSize: "text-xl",
|
|
102
|
+
clearButtonSize: "size-6",
|
|
103
|
+
clearIconSize: "size-4",
|
|
104
|
+
floatingLabelFontSize: "text-xs",
|
|
105
|
+
restingLabelFontSize: "text-base peer-focus-within:text-xs",
|
|
106
|
+
pillShape: {
|
|
107
|
+
corners: "rounded-full",
|
|
108
|
+
gutter: "px-5.25",
|
|
109
|
+
labelOffset: "left-4.25",
|
|
110
|
+
restingLabelOffsetWithLeadingIcon: "left-10.25 peer-focus-within:left-4.25"
|
|
111
|
+
},
|
|
112
|
+
roundedShape: {
|
|
113
|
+
corners: "rounded-xl",
|
|
114
|
+
gutter: "px-4",
|
|
115
|
+
labelOffset: "left-3",
|
|
116
|
+
restingLabelOffsetWithLeadingIcon: "left-9 peer-focus-within:left-3"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"4xl": {
|
|
120
|
+
height: "h-14",
|
|
121
|
+
fontSize: "text-base",
|
|
122
|
+
leadingIconSize: "size-4",
|
|
123
|
+
trailingIconSize: "size-5",
|
|
124
|
+
loadingIndicatorSize: "text-2xl",
|
|
125
|
+
clearButtonSize: "size-7",
|
|
126
|
+
clearIconSize: "size-4.5",
|
|
127
|
+
floatingLabelFontSize: "text-xs",
|
|
128
|
+
restingLabelFontSize: "text-base peer-focus-within:text-xs",
|
|
129
|
+
pillShape: {
|
|
130
|
+
corners: "rounded-full",
|
|
131
|
+
gutter: "px-6",
|
|
132
|
+
labelOffset: "left-5",
|
|
133
|
+
restingLabelOffsetWithLeadingIcon: "left-11 peer-focus-within:left-5"
|
|
134
|
+
},
|
|
135
|
+
roundedShape: {
|
|
136
|
+
corners: "rounded-2xl",
|
|
137
|
+
gutter: "px-4.5",
|
|
138
|
+
labelOffset: "left-3.5",
|
|
139
|
+
restingLabelOffsetWithLeadingIcon: "left-9.5 peer-focus-within:left-3.5"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}, n = Object.keys(t);
|
|
143
|
+
function r(e) {
|
|
144
|
+
return {
|
|
145
|
+
base: [e.height, e.fontSize],
|
|
146
|
+
leadingIcon: e.leadingIconSize,
|
|
147
|
+
trailingIcon: e.trailingIconSize,
|
|
148
|
+
loadingIndicator: e.loadingIndicatorSize,
|
|
149
|
+
clearButton: e.clearButtonSize,
|
|
150
|
+
clearIcon: e.clearIconSize
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function i(e) {
|
|
154
|
+
let n = t[e];
|
|
155
|
+
return [!0, !1].flatMap((t) => {
|
|
156
|
+
let r = t ? n.pillShape : n.roundedShape;
|
|
157
|
+
return [
|
|
158
|
+
{
|
|
159
|
+
size: e,
|
|
160
|
+
pill: t,
|
|
161
|
+
class: { base: [r.corners, r.gutter] }
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
size: e,
|
|
165
|
+
pill: t,
|
|
166
|
+
labelFloating: !0,
|
|
167
|
+
class: { label: [r.labelOffset, n.floatingLabelFontSize] }
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
size: e,
|
|
171
|
+
pill: t,
|
|
172
|
+
labelFloating: !1,
|
|
173
|
+
hasLeadingIcon: !1,
|
|
174
|
+
class: { label: [r.labelOffset, n.restingLabelFontSize] }
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
size: e,
|
|
178
|
+
pill: t,
|
|
179
|
+
labelFloating: !1,
|
|
180
|
+
hasLeadingIcon: !0,
|
|
181
|
+
class: { label: [r.restingLabelOffsetWithLeadingIcon, n.restingLabelFontSize] }
|
|
182
|
+
}
|
|
183
|
+
];
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
var a = Object.fromEntries(n.map((e) => [e, r(t[e])])), o = e({
|
|
187
|
+
slots: {
|
|
188
|
+
root: "",
|
|
189
|
+
container: "relative",
|
|
190
|
+
base: "peer group flex w-full items-center gap-2 border bg-field whitespace-nowrap outline-hidden transition-colors select-none",
|
|
191
|
+
leadingIcon: "shrink-0 text-muted",
|
|
192
|
+
leadingAvatar: "flex shrink-0",
|
|
193
|
+
value: "min-w-0 flex-1 truncate",
|
|
194
|
+
input: "min-w-0 flex-1 truncate bg-transparent outline-hidden placeholder:text-muted placeholder:opacity-0 placeholder:transition-opacity focus:placeholder:opacity-100",
|
|
195
|
+
placeholder: "text-muted opacity-0 transition-opacity group-focus-within:opacity-100",
|
|
196
|
+
selectionForScreenReaders: "sr-only",
|
|
197
|
+
trailing: "flex shrink-0 items-center gap-1",
|
|
198
|
+
clearButton: "flex cursor-pointer items-center justify-center rounded-full outline-primary transition focus-visible:outline-2",
|
|
199
|
+
clearIcon: "",
|
|
200
|
+
loadingIndicator: "",
|
|
201
|
+
trailingIcon: "shrink-0 text-muted transition-opacity group-hover:opacity-100",
|
|
202
|
+
label: "pointer-events-none absolute -translate-y-1/2 from-canvas from-50% to-field to-50% px-1 whitespace-nowrap transition-all",
|
|
203
|
+
hint: "mt-2 text-xs text-muted",
|
|
204
|
+
errorMessage: "mt-2 flex items-start gap-x-1.5 text-xs light:text-red-600 dark:text-red-400",
|
|
205
|
+
errorIcon: "mt-px size-3.5 shrink-0"
|
|
206
|
+
},
|
|
207
|
+
variants: {
|
|
208
|
+
size: a,
|
|
209
|
+
variant: {
|
|
210
|
+
outline: "",
|
|
211
|
+
soft: ""
|
|
212
|
+
},
|
|
213
|
+
pill: {
|
|
214
|
+
true: "",
|
|
215
|
+
false: ""
|
|
216
|
+
},
|
|
217
|
+
fieldState: {
|
|
218
|
+
invalid: {
|
|
219
|
+
base: "light:border-red-600 dark:border-red-500",
|
|
220
|
+
label: "light:text-red-600 dark:text-red-400"
|
|
221
|
+
},
|
|
222
|
+
disabled: { label: "text-muted" },
|
|
223
|
+
open: {
|
|
224
|
+
base: "border-primary",
|
|
225
|
+
label: "text-primary"
|
|
226
|
+
},
|
|
227
|
+
idle: { label: "text-muted peer-focus-within:text-primary" }
|
|
228
|
+
},
|
|
229
|
+
floatLabel: {
|
|
230
|
+
auto: "",
|
|
231
|
+
always: {
|
|
232
|
+
placeholder: "opacity-100",
|
|
233
|
+
input: "placeholder:opacity-100"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
labelFloating: {
|
|
237
|
+
true: { label: "top-0 bg-linear-to-b" },
|
|
238
|
+
false: { label: "top-1/2 peer-focus-within:top-0 peer-focus-within:bg-linear-to-b" }
|
|
239
|
+
},
|
|
240
|
+
hasLeadingIcon: {
|
|
241
|
+
true: "",
|
|
242
|
+
false: ""
|
|
243
|
+
},
|
|
244
|
+
disabled: {
|
|
245
|
+
true: {
|
|
246
|
+
container: "opacity-50",
|
|
247
|
+
base: "cursor-not-allowed"
|
|
248
|
+
},
|
|
249
|
+
false: { base: "cursor-pointer" }
|
|
250
|
+
},
|
|
251
|
+
open: {
|
|
252
|
+
true: {
|
|
253
|
+
trailingIcon: "opacity-100",
|
|
254
|
+
placeholder: "opacity-100"
|
|
255
|
+
},
|
|
256
|
+
false: { trailingIcon: "opacity-75" }
|
|
257
|
+
},
|
|
258
|
+
hasTrailingIcon: {
|
|
259
|
+
true: { clearButton: "text-muted opacity-75 hover:opacity-100 light:hover:bg-stone-950/8 dark:hover:bg-stone-200/12" },
|
|
260
|
+
false: { clearButton: "light:bg-stone-600 light:text-white dark:bg-stone-600 dark:text-white" }
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
compoundVariants: [
|
|
264
|
+
...n.flatMap(i),
|
|
265
|
+
{
|
|
266
|
+
fieldState: "disabled",
|
|
267
|
+
variant: "outline",
|
|
268
|
+
class: { base: "border-line" }
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
fieldState: "disabled",
|
|
272
|
+
variant: "soft",
|
|
273
|
+
class: { base: "border-transparent" }
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
fieldState: "idle",
|
|
277
|
+
variant: "outline",
|
|
278
|
+
class: { base: "border-line light:not-focus-within:hover:border-stone-950/20 dark:not-focus-within:hover:border-white/20 focus-within:border-primary" }
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
fieldState: "idle",
|
|
282
|
+
variant: "soft",
|
|
283
|
+
class: { base: "border-transparent focus-within:border-primary" }
|
|
284
|
+
}
|
|
285
|
+
],
|
|
286
|
+
defaultVariants: {
|
|
287
|
+
size: "4xl",
|
|
288
|
+
variant: "outline",
|
|
289
|
+
pill: !0,
|
|
290
|
+
fieldState: "idle",
|
|
291
|
+
floatLabel: "auto",
|
|
292
|
+
labelFloating: !1,
|
|
293
|
+
hasLeadingIcon: !1,
|
|
294
|
+
disabled: !1,
|
|
295
|
+
open: !1,
|
|
296
|
+
hasTrailingIcon: !0
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
export { o as selectFieldControlTheme };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SliderMark } from '../../shared/types/slider';
|
|
2
|
+
import type { ClassNameValue } from '../../shared/utils/tv';
|
|
3
|
+
import type { SliderControlSlotName } from './slider-control.theme';
|
|
4
|
+
export interface SliderControlProps {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
step: number;
|
|
8
|
+
minRange?: number;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
marks?: SliderMark[];
|
|
12
|
+
trackColor?: string;
|
|
13
|
+
rangeColor?: string;
|
|
14
|
+
thumbLabels?: string[];
|
|
15
|
+
thumbAttributes?: Record<string, unknown>;
|
|
16
|
+
ui?: Partial<Record<SliderControlSlotName, ClassNameValue>>;
|
|
17
|
+
class?: ClassNameValue;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
declare const __VLS_export: import("vue").DefineComponent<SliderControlProps & {
|
|
22
|
+
modelValue: number[];
|
|
23
|
+
}, {
|
|
24
|
+
isPointerPressing: import("vue").Ref<boolean, boolean>;
|
|
25
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
+
"update:modelValue": (value: number[]) => any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<SliderControlProps & {
|
|
28
|
+
modelValue: number[];
|
|
29
|
+
}> & Readonly<{
|
|
30
|
+
"onUpdate:modelValue"?: ((value: number[]) => any) | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
marks: SliderMark[];
|
|
33
|
+
minRange: number;
|
|
34
|
+
thumbLabels: string[];
|
|
35
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { createShortcutHandler as e } from "../../shared/utils/createShortcutHandler.js";
|
|
2
|
+
import { convertPointerToValue as t, convertValueToPercent as n, convertValueToRatio as r, sortSliderMarks as i } from "../../shared/utils/sliderPosition.js";
|
|
3
|
+
import { findClosestThumbIndex as a, isThumbStacked as o, resolveThumbBounds as s } from "../../shared/utils/sliderThumbs.js";
|
|
4
|
+
import { clampToRange as ee, moveByStep as te, snapToStep as c } from "../../shared/utils/steppedValue.js";
|
|
5
|
+
import { sliderControlTheme as ne } from "./slider-control.theme.js";
|
|
6
|
+
import { useSliderMarksLayout as re } from "./useSliderMarksLayout.js";
|
|
7
|
+
import { Fragment as l, computed as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, defineComponent as m, mergeModels as h, mergeProps as ie, nextTick as ae, normalizeClass as g, normalizeStyle as _, onBeforeUnmount as oe, onMounted as se, openBlock as v, ref as y, renderList as b, toDisplayString as ce, unref as x, useModel as le, useTemplateRef as S, watch as ue } from "vue";
|
|
8
|
+
// src/elements/slider-control/SliderControl.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
+
var C = ["data-disabled"], de = ["onFocus"], fe = ["name", "value"], w = /*@__PURE__*/ m({
|
|
10
|
+
__name: "SliderControl",
|
|
11
|
+
props: /*@__PURE__*/ h({
|
|
12
|
+
min: {},
|
|
13
|
+
max: {},
|
|
14
|
+
step: {},
|
|
15
|
+
minRange: { default: 0 },
|
|
16
|
+
disabled: { type: Boolean },
|
|
17
|
+
name: {},
|
|
18
|
+
marks: { default: () => [] },
|
|
19
|
+
trackColor: {},
|
|
20
|
+
rangeColor: {},
|
|
21
|
+
thumbLabels: { default: () => [] },
|
|
22
|
+
thumbAttributes: {},
|
|
23
|
+
ui: {},
|
|
24
|
+
class: { type: [
|
|
25
|
+
Array,
|
|
26
|
+
String,
|
|
27
|
+
null,
|
|
28
|
+
Number,
|
|
29
|
+
Boolean
|
|
30
|
+
] }
|
|
31
|
+
}, {
|
|
32
|
+
modelValue: { required: !0 },
|
|
33
|
+
modelModifiers: {}
|
|
34
|
+
}),
|
|
35
|
+
emits: ["update:modelValue"],
|
|
36
|
+
setup(m, { expose: h }) {
|
|
37
|
+
let w = m, T = le(m, "modelValue"), E = {
|
|
38
|
+
direction: 1,
|
|
39
|
+
stepCount: 1
|
|
40
|
+
}, D = {
|
|
41
|
+
direction: -1,
|
|
42
|
+
stepCount: 1
|
|
43
|
+
}, O = {
|
|
44
|
+
direction: 1,
|
|
45
|
+
stepCount: 10
|
|
46
|
+
}, k = {
|
|
47
|
+
direction: -1,
|
|
48
|
+
stepCount: 10
|
|
49
|
+
}, A = S("rootElement"), j = S("controlElement"), M = S("marksElement"), N = S("formValueInputs"), P = [], F = y(!1), I = y(!1), L = y(), R = y(0), z = y(0), pe = [...T.value], B = !1, V, H = null, U;
|
|
50
|
+
h({ isPointerPressing: F });
|
|
51
|
+
let W = u(() => i(w.marks, w.min, w.max)), me = u(() => W.value.map((e) => `${e.value}:${e.label}`).join("|")), { marksLayout: he } = re(M, [
|
|
52
|
+
me,
|
|
53
|
+
() => w.min,
|
|
54
|
+
() => w.max,
|
|
55
|
+
L
|
|
56
|
+
]), G = u(() => T.value.map((e) => n(e, w.min, w.max)));
|
|
57
|
+
ue(() => T.value.map((e) => r(e, w.min, w.max)), (e, t) => {
|
|
58
|
+
let n = Math.max(...e.map((e, n) => Math.abs(e - (t[n] ?? e))));
|
|
59
|
+
R.value = Math.max(n * 300, 100);
|
|
60
|
+
});
|
|
61
|
+
let ge = u(() => F.value ? 0 : R.value), K = u(() => ne({
|
|
62
|
+
disabled: w.disabled,
|
|
63
|
+
marksLayout: he.value
|
|
64
|
+
})), _e = u(() => L.value === void 0 ? void 0 : { "--slider-thumb-size": `${L.value}px` }), ve = u(() => ({
|
|
65
|
+
"--slider-value-transition-duration": `${ge.value}ms`,
|
|
66
|
+
"--slider-track-color": w.trackColor,
|
|
67
|
+
"--slider-range-color": w.rangeColor
|
|
68
|
+
})), ye = u(() => ({
|
|
69
|
+
left: `${G.value.length > 1 ? Math.min(...G.value) : 0}%`,
|
|
70
|
+
right: `${100 - Math.max(...G.value)}%`
|
|
71
|
+
}));
|
|
72
|
+
function be(e) {
|
|
73
|
+
return { left: `calc(${e}% + var(--slider-thumb-size) * ${.5 - e / 100})` };
|
|
74
|
+
}
|
|
75
|
+
function xe(e) {
|
|
76
|
+
let { lowestValue: t, highestValue: n } = s(T.value, e, w);
|
|
77
|
+
return {
|
|
78
|
+
tabindex: w.disabled ? void 0 : 0,
|
|
79
|
+
"aria-label": w.thumbLabels[e],
|
|
80
|
+
"aria-valuemin": t,
|
|
81
|
+
"aria-valuenow": T.value[e],
|
|
82
|
+
"aria-valuemax": n,
|
|
83
|
+
"aria-disabled": w.disabled || void 0,
|
|
84
|
+
"data-disabled": w.disabled ? "" : void 0
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function Se(e, t) {
|
|
88
|
+
e instanceof HTMLElement && (P[t] = e);
|
|
89
|
+
}
|
|
90
|
+
function q(e) {
|
|
91
|
+
z.value = e;
|
|
92
|
+
}
|
|
93
|
+
function Ce() {
|
|
94
|
+
ae(() => N.value?.[0]?.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
95
|
+
}
|
|
96
|
+
function J(e, t, n) {
|
|
97
|
+
if (w.disabled) return;
|
|
98
|
+
let { lowestValue: r, highestValue: i } = s(T.value, e, w), a = ee(c(t, w), r, i);
|
|
99
|
+
a !== T.value[e] && (T.value = T.value.map((t, n) => n === e ? a : t), q(e), P[e]?.focus({
|
|
100
|
+
preventScroll: !0,
|
|
101
|
+
focusVisible: n
|
|
102
|
+
}), Ce());
|
|
103
|
+
}
|
|
104
|
+
function Y(e) {
|
|
105
|
+
let t = T.value[z.value] ?? w.min;
|
|
106
|
+
J(z.value, te(t, w, e), !0);
|
|
107
|
+
}
|
|
108
|
+
let X = e({
|
|
109
|
+
home: () => J(z.value, w.min, !0),
|
|
110
|
+
end: () => J(z.value, w.max, !0),
|
|
111
|
+
arrowright: () => Y(E),
|
|
112
|
+
arrowup: () => Y(E),
|
|
113
|
+
arrowleft: () => Y(D),
|
|
114
|
+
arrowdown: () => Y(D),
|
|
115
|
+
"shift+arrowright": () => Y(O),
|
|
116
|
+
"shift+arrowup": () => Y(O),
|
|
117
|
+
"shift+arrowleft": () => Y(k),
|
|
118
|
+
"shift+arrowdown": () => Y(k),
|
|
119
|
+
pageup: () => Y(O),
|
|
120
|
+
"shift+pageup": () => Y(O),
|
|
121
|
+
pagedown: () => Y(k),
|
|
122
|
+
"shift+pagedown": () => Y(k)
|
|
123
|
+
});
|
|
124
|
+
function Z(e) {
|
|
125
|
+
return V ??= j.value?.getBoundingClientRect(), V ? t(e.clientX - V.left, V.width, w.min, w.max) : T.value[z.value] ?? w.min;
|
|
126
|
+
}
|
|
127
|
+
function we(e) {
|
|
128
|
+
let t = T.value[z.value];
|
|
129
|
+
B && c(e, w) !== t && (q(a(T.value, e)), B = !1);
|
|
130
|
+
}
|
|
131
|
+
function Te(e) {
|
|
132
|
+
let t = e.target;
|
|
133
|
+
if (e.button !== 0 || !(t instanceof HTMLElement) || (F.value = !0, t.setPointerCapture(e.pointerId), e.preventDefault(), w.disabled)) return;
|
|
134
|
+
let n = P.indexOf(t);
|
|
135
|
+
if (n >= 0) {
|
|
136
|
+
q(n), B = o(T.value, n), t.focus({
|
|
137
|
+
preventScroll: !0,
|
|
138
|
+
focusVisible: !1
|
|
139
|
+
});
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
let r = Z(e), i = a(T.value, r);
|
|
143
|
+
q(i), B = o(T.value, i), J(i, r, !1);
|
|
144
|
+
}
|
|
145
|
+
function Ee(e) {
|
|
146
|
+
let t = e.target;
|
|
147
|
+
if (!(t instanceof HTMLElement) || !t.hasPointerCapture(e.pointerId)) return;
|
|
148
|
+
let n = Z(e);
|
|
149
|
+
we(n), J(z.value, n, !1);
|
|
150
|
+
}
|
|
151
|
+
function Q(e) {
|
|
152
|
+
let t = e.target;
|
|
153
|
+
F.value = !1, B = !1, V = void 0, t instanceof HTMLElement && t.hasPointerCapture(e.pointerId) && t.releasePointerCapture(e.pointerId);
|
|
154
|
+
}
|
|
155
|
+
function $() {
|
|
156
|
+
T.value = [...pe];
|
|
157
|
+
}
|
|
158
|
+
function De([e]) {
|
|
159
|
+
L.value = e?.borderBoxSize[0]?.inlineSize ?? P[0]?.offsetWidth;
|
|
160
|
+
}
|
|
161
|
+
return se(() => {
|
|
162
|
+
H = A.value?.closest("form") ?? null, I.value = !!H, H?.addEventListener("reset", $), P[0] && (U = new ResizeObserver(De), U.observe(P[0]));
|
|
163
|
+
}), oe(() => {
|
|
164
|
+
H?.removeEventListener("reset", $), U?.disconnect();
|
|
165
|
+
}), (e, t) => (v(), f("div", {
|
|
166
|
+
ref_key: "rootElement",
|
|
167
|
+
ref: A,
|
|
168
|
+
style: _(_e.value),
|
|
169
|
+
class: g(K.value.root({ class: [m.ui?.root, w.class] }))
|
|
170
|
+
}, [
|
|
171
|
+
p("span", {
|
|
172
|
+
ref_key: "controlElement",
|
|
173
|
+
ref: j,
|
|
174
|
+
"data-orientation": "horizontal",
|
|
175
|
+
"data-disabled": m.disabled ? "" : void 0,
|
|
176
|
+
style: _(ve.value),
|
|
177
|
+
class: g(K.value.control({ class: m.ui?.control })),
|
|
178
|
+
onPointerdown: Te,
|
|
179
|
+
onPointermove: Ee,
|
|
180
|
+
onPointerup: Q,
|
|
181
|
+
onPointercancel: Q,
|
|
182
|
+
onKeydown: t[0] ||= (...e) => x(X) && x(X)(...e)
|
|
183
|
+
}, [p("span", { class: g(K.value.track({ class: m.ui?.track })) }, [p("span", {
|
|
184
|
+
style: _(ye.value),
|
|
185
|
+
class: g(K.value.range({ class: m.ui?.range }))
|
|
186
|
+
}, null, 6)], 2), (v(!0), f(l, null, b(G.value, (e, t) => (v(), f("span", {
|
|
187
|
+
key: t,
|
|
188
|
+
style: _(be(e)),
|
|
189
|
+
class: g(K.value.thumbAnchor({
|
|
190
|
+
isActiveThumb: t === z.value,
|
|
191
|
+
class: m.ui?.thumbAnchor
|
|
192
|
+
}))
|
|
193
|
+
}, [p("span", ie({
|
|
194
|
+
ref_for: !0,
|
|
195
|
+
ref: (e) => Se(e, t),
|
|
196
|
+
role: "slider",
|
|
197
|
+
"aria-orientation": "horizontal",
|
|
198
|
+
"data-orientation": "horizontal"
|
|
199
|
+
}, { ref_for: !0 }, {
|
|
200
|
+
...xe(t),
|
|
201
|
+
...m.thumbAttributes
|
|
202
|
+
}, {
|
|
203
|
+
class: K.value.thumb({ class: m.ui?.thumb }),
|
|
204
|
+
onFocus: (e) => q(t)
|
|
205
|
+
}), null, 16, de)], 6))), 128))], 46, C),
|
|
206
|
+
m.name || I.value ? (v(!0), f(l, { key: 0 }, b(T.value, (e, t) => (v(), f("input", {
|
|
207
|
+
key: t,
|
|
208
|
+
ref_for: !0,
|
|
209
|
+
ref_key: "formValueInputs",
|
|
210
|
+
ref: N,
|
|
211
|
+
type: "hidden",
|
|
212
|
+
name: m.name && T.value.length > 1 ? `${m.name}[]` : m.name,
|
|
213
|
+
value: e
|
|
214
|
+
}, null, 8, fe))), 128)) : d("", !0),
|
|
215
|
+
W.value.length > 0 ? (v(), f("div", {
|
|
216
|
+
key: 1,
|
|
217
|
+
ref_key: "marksElement",
|
|
218
|
+
ref: M,
|
|
219
|
+
class: g(K.value.marks({ class: m.ui?.marks }))
|
|
220
|
+
}, [(v(!0), f(l, null, b(W.value, (e) => (v(), f("div", {
|
|
221
|
+
key: e.value,
|
|
222
|
+
style: _({ "--slider-mark-ratio": x(r)(e.value, m.min, m.max) }),
|
|
223
|
+
class: g(K.value.mark({ class: m.ui?.mark }))
|
|
224
|
+
}, [p("span", { class: g(K.value.markLabel({ class: m.ui?.markLabel })) }, ce(e.label), 3)], 6))), 128))], 2)) : d("", !0)
|
|
225
|
+
], 6));
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
export { w as default };
|