base-ui-vue 0.1.0 → 0.2.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/README.md +41 -1
- package/dist/button/Button.cjs +53 -12
- package/dist/button/Button.cjs.map +1 -1
- package/dist/button/Button.js +26 -15
- package/dist/button/Button.js.map +1 -1
- package/dist/button/ToolbarButton.cjs +367 -0
- package/dist/button/ToolbarButton.cjs.map +1 -0
- package/dist/button/ToolbarButton.js +320 -0
- package/dist/button/ToolbarButton.js.map +1 -0
- package/dist/button/ToolbarButtonDataAttributes.cjs +27 -0
- package/dist/button/ToolbarButtonDataAttributes.cjs.map +1 -0
- package/dist/button/ToolbarButtonDataAttributes.js +21 -0
- package/dist/button/ToolbarButtonDataAttributes.js.map +1 -0
- package/dist/checkbox/index.cjs +1173 -0
- package/dist/checkbox/index.cjs.map +1 -0
- package/dist/checkbox/index.js +1048 -0
- package/dist/checkbox/index.js.map +1 -0
- package/dist/checkbox-group/CheckboxGroup.cjs +629 -0
- package/dist/checkbox-group/CheckboxGroup.cjs.map +1 -0
- package/dist/checkbox-group/CheckboxGroup.js +540 -0
- package/dist/checkbox-group/CheckboxGroup.js.map +1 -0
- package/dist/checkbox-group/CheckboxGroupDataAttributes.cjs +18 -0
- package/dist/checkbox-group/CheckboxGroupDataAttributes.cjs.map +1 -0
- package/dist/checkbox-group/CheckboxGroupDataAttributes.js +12 -0
- package/dist/checkbox-group/CheckboxGroupDataAttributes.js.map +1 -0
- package/dist/composite/composite.cjs +167 -0
- package/dist/composite/composite.cjs.map +1 -1
- package/dist/composite/composite.js +96 -1
- package/dist/composite/composite.js.map +1 -1
- package/dist/composite/constants.cjs +12 -0
- package/dist/composite/constants.cjs.map +1 -0
- package/dist/composite/constants.js +6 -0
- package/dist/composite/constants.js.map +1 -0
- package/dist/control/FieldControl.cjs +18 -343
- package/dist/control/FieldControl.cjs.map +1 -1
- package/dist/control/FieldControl.js +14 -285
- package/dist/control/FieldControl.js.map +1 -1
- package/dist/control/SliderControl.cjs +636 -0
- package/dist/control/SliderControl.cjs.map +1 -0
- package/dist/control/SliderControl.js +553 -0
- package/dist/control/SliderControl.js.map +1 -0
- package/dist/control/SliderControlDataAttributes.cjs +47 -0
- package/dist/control/SliderControlDataAttributes.cjs.map +1 -0
- package/dist/control/SliderControlDataAttributes.js +41 -0
- package/dist/control/SliderControlDataAttributes.js.map +1 -0
- package/dist/csp-provider/CSPContext.cjs +32 -0
- package/dist/csp-provider/CSPContext.cjs.map +1 -0
- package/dist/csp-provider/CSPContext.js +21 -0
- package/dist/csp-provider/CSPContext.js.map +1 -0
- package/dist/csp-provider/CSPProvider.cjs +46 -0
- package/dist/csp-provider/CSPProvider.cjs.map +1 -0
- package/dist/csp-provider/CSPProvider.js +41 -0
- package/dist/csp-provider/CSPProvider.js.map +1 -0
- package/dist/description/FieldDescription.cjs +5 -5
- package/dist/description/FieldDescription.cjs.map +1 -1
- package/dist/description/FieldDescription.js +1 -1
- package/dist/direction-provider/DirectionProvider.cjs +2 -2
- package/dist/direction-provider/DirectionProvider.cjs.map +1 -1
- package/dist/direction-provider/DirectionProvider.js +1 -1
- package/dist/error/FieldError.cjs +10 -288
- package/dist/error/FieldError.cjs.map +1 -1
- package/dist/error/FieldError.js +4 -246
- package/dist/error/FieldError.js.map +1 -1
- package/dist/form/Form.cjs +5 -4
- package/dist/form/Form.cjs.map +1 -1
- package/dist/form/Form.js +5 -4
- package/dist/form/Form.js.map +1 -1
- package/dist/group/ToolbarGroup.cjs +92 -0
- package/dist/group/ToolbarGroup.cjs.map +1 -0
- package/dist/group/ToolbarGroup.js +87 -0
- package/dist/group/ToolbarGroup.js.map +1 -0
- package/dist/group/ToolbarGroupDataAttributes.cjs +23 -0
- package/dist/group/ToolbarGroupDataAttributes.cjs.map +1 -0
- package/dist/group/ToolbarGroupDataAttributes.js +17 -0
- package/dist/group/ToolbarGroupDataAttributes.js.map +1 -0
- package/dist/header/AccordionHeader.cjs +2 -2
- package/dist/header/AccordionHeader.js +1 -1
- package/dist/image/AvatarImage.cjs +4 -4
- package/dist/image/AvatarImage.cjs.map +1 -1
- package/dist/image/AvatarImage.js +1 -1
- package/dist/index.cjs +80 -10
- package/dist/index.d.cts +2751 -612
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +2751 -612
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -5
- package/dist/index2.cjs +3651 -370
- package/dist/index2.cjs.map +1 -1
- package/dist/index2.js +3365 -270
- package/dist/index2.js.map +1 -1
- package/package.json +8 -4
- package/src/accordion/root/AccordionRoot.vue +2 -1
- package/src/checkbox/index.ts +23 -0
- package/src/checkbox/indicator/CheckboxIndicator.vue +102 -0
- package/src/checkbox/indicator/CheckboxIndicatorDataAttributes.ts +61 -0
- package/src/checkbox/root/CheckboxRoot.vue +632 -0
- package/src/checkbox/root/CheckboxRootContext.ts +22 -0
- package/src/checkbox/root/CheckboxRootDataAttributes.ts +54 -0
- package/src/checkbox/utils/useStateAttributesMapping.ts +30 -0
- package/src/checkbox-group/CheckboxGroup.vue +241 -0
- package/src/checkbox-group/CheckboxGroupContext.ts +39 -0
- package/src/checkbox-group/CheckboxGroupDataAttributes.ts +6 -0
- package/src/checkbox-group/index.ts +11 -0
- package/src/checkbox-group/useCheckboxGroupParent.ts +173 -0
- package/src/collapsible/panel/useCollapsiblePanel.ts +2 -1
- package/src/collapsible/root/useCollapsibleRoot.ts +3 -1
- package/src/composite/composite.ts +2 -0
- package/src/composite/item/CompositeItem.vue +7 -8
- package/src/composite/root/CompositeRoot.vue +12 -1
- package/src/csp-provider/CSPContext.ts +26 -0
- package/src/csp-provider/CSPProvider.vue +40 -0
- package/src/csp-provider/index.ts +5 -0
- package/src/field/item/FieldItem.vue +6 -1
- package/src/field/label/FieldLabel.vue +10 -51
- package/src/field/root/FieldRoot.vue +16 -3
- package/src/floating-ui-vue/types.ts +1 -4
- package/src/floating-ui-vue/utils/element.ts +12 -0
- package/src/floating-ui-vue/utils/shadowDom.ts +44 -0
- package/src/floating-ui-vue/utils.ts +3 -0
- package/src/form/Form.vue +5 -3
- package/src/index.ts +9 -0
- package/src/labelable-provider/LabelableContext.ts +2 -2
- package/src/labelable-provider/LabelableProvider.vue +21 -4
- package/src/labelable-provider/index.ts +2 -0
- package/src/labelable-provider/useAriaLabelledBy.ts +9 -9
- package/src/labelable-provider/useLabel.ts +115 -0
- package/src/labelable-provider/useLabelableId.ts +12 -10
- package/src/separator/Separator.vue +65 -0
- package/src/separator/SeparatorDataAttributes.ts +7 -0
- package/src/separator/index.ts +3 -0
- package/src/slider/control/SliderControl.vue +497 -0
- package/src/slider/control/SliderControlDataAttributes.ts +35 -0
- package/src/slider/index.ts +35 -0
- package/src/slider/indicator/SliderIndicator.vue +144 -0
- package/src/slider/indicator/SliderIndicatorDataAttributes.ts +35 -0
- package/src/slider/label/SliderLabel.vue +75 -0
- package/src/slider/root/SliderRoot.vue +557 -0
- package/src/slider/root/SliderRootContext.ts +126 -0
- package/src/slider/root/SliderRootDataAttributes.ts +35 -0
- package/src/slider/root/stateAttributesMapping.ts +13 -0
- package/src/slider/thumb/SliderThumb.vue +601 -0
- package/src/slider/thumb/SliderThumbDataAttributes.ts +39 -0
- package/src/slider/thumb/prehydrationScript.min.ts +5 -0
- package/src/slider/thumb/prehydrationScript.template.js +69 -0
- package/src/slider/track/SliderTrack.vue +48 -0
- package/src/slider/track/SliderTrackDataAttributes.ts +10 -0
- package/src/slider/utils/asc.ts +3 -0
- package/src/slider/utils/getMidpoint.ts +9 -0
- package/src/slider/utils/getPushedThumbValues.ts +68 -0
- package/src/slider/utils/getSliderValue.ts +25 -0
- package/src/slider/utils/replaceArrayItemAtIndex.ts +15 -0
- package/src/slider/utils/resolveThumbCollision.ts +177 -0
- package/src/slider/utils/roundValueToStep.ts +19 -0
- package/src/slider/utils/test-utils.ts +25 -0
- package/src/slider/utils/validateMinimumDistance.ts +20 -0
- package/src/slider/utils/valueArrayToPercentages.ts +10 -0
- package/src/slider/value/SliderValue.vue +90 -0
- package/src/slider/value/SliderValueDataAttributes.ts +35 -0
- package/src/switch/index.ts +14 -0
- package/src/switch/root/SwitchRoot.vue +448 -0
- package/src/switch/root/SwitchRootContext.ts +22 -0
- package/src/switch/root/SwitchRootDataAttributes.ts +46 -0
- package/src/switch/stateAttributesMapping.ts +23 -0
- package/src/switch/thumb/SwitchThumb.vue +59 -0
- package/src/switch/thumb/SwitchThumbDataAttributes.ts +46 -0
- package/src/toggle/Toggle.vue +211 -0
- package/src/toggle/ToggleDataAttributes.ts +6 -0
- package/src/toggle/index.ts +3 -0
- package/src/toggle-group/ToggleGroup.vue +224 -0
- package/src/toggle-group/ToggleGroupContext.ts +45 -0
- package/src/toggle-group/ToggleGroupDataAttributes.ts +15 -0
- package/src/toggle-group/index.ts +5 -0
- package/src/toolbar/button/ToolbarButton.vue +99 -0
- package/src/toolbar/button/ToolbarButtonDataAttributes.ts +15 -0
- package/src/toolbar/group/ToolbarGroup.vue +70 -0
- package/src/toolbar/group/ToolbarGroupContext.ts +23 -0
- package/src/toolbar/group/ToolbarGroupDataAttributes.ts +11 -0
- package/src/toolbar/index.ts +27 -0
- package/src/toolbar/input/ToolbarInput.vue +114 -0
- package/src/toolbar/input/ToolbarInputDataAttributes.ts +15 -0
- package/src/toolbar/link/ToolbarLink.vue +54 -0
- package/src/toolbar/link/ToolbarLinkDataAttributes.ts +7 -0
- package/src/toolbar/root/ToolbarRoot.vue +144 -0
- package/src/toolbar/root/ToolbarRootContext.ts +29 -0
- package/src/toolbar/root/ToolbarRootDataAttributes.ts +11 -0
- package/src/toolbar/separator/ToolbarSeparator.vue +41 -0
- package/src/toolbar/separator/ToolbarSeparatorDataAttributes.ts +7 -0
- package/src/use-button/useButton.ts +2 -1
- package/src/utils/areArraysEqual.ts +12 -0
- package/src/utils/clamp.ts +7 -0
- package/src/utils/createBaseUIEventDetails.ts +9 -0
- package/src/utils/formatNumber.ts +7 -0
- package/src/utils/owner.ts +5 -0
- package/src/utils/resolveAriaLabelledBy.ts +10 -0
- package/src/utils/useControllableState.ts +78 -14
- package/src/utils/useFocusableWhenDisabled.ts +6 -1
- package/src/utils/useMergedRefs.ts +26 -2
- package/src/utils/useRegisteredLabelId.ts +21 -0
- package/src/utils/valueToPercent.ts +7 -0
- package/src/utils/visuallyHidden.ts +24 -0
- package/dist/direction-provider/DirectionContext.cjs +0 -26
- package/dist/direction-provider/DirectionContext.cjs.map +0 -1
- package/dist/direction-provider/DirectionContext.js +0 -15
- package/dist/direction-provider/DirectionContext.js.map +0 -1
package/dist/index2.cjs
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
const require_button_Button = require('./button/Button.cjs');
|
|
2
2
|
const require_header_AccordionHeader = require('./header/AccordionHeader.cjs');
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
const require_checkbox_index = require('./checkbox/index.cjs');
|
|
4
|
+
const require_checkbox_group_CheckboxGroup = require('./checkbox-group/CheckboxGroup.cjs');
|
|
5
|
+
const require_button_ToolbarButton = require('./button/ToolbarButton.cjs');
|
|
6
|
+
const require_control_SliderControl = require('./control/SliderControl.cjs');
|
|
6
7
|
const require_composite_composite = require('./composite/composite.cjs');
|
|
7
8
|
const require_fallback_AvatarFallback = require('./fallback/AvatarFallback.cjs');
|
|
9
|
+
const require_csp_provider_CSPContext = require('./csp-provider/CSPContext.cjs');
|
|
10
|
+
const require_control_FieldControl = require('./control/FieldControl.cjs');
|
|
11
|
+
const require_composite_constants = require('./composite/constants.cjs');
|
|
8
12
|
let vue = require("vue");
|
|
13
|
+
let _floating_ui_utils_dom = require("@floating-ui/utils/dom");
|
|
14
|
+
let _floating_ui_utils = require("@floating-ui/utils");
|
|
9
15
|
|
|
10
16
|
//#region src/collapsible/root/CollapsibleRootContext.ts
|
|
11
17
|
const collapsibleRootContextKey = Symbol("CollapsibleRootContext");
|
|
@@ -15,133 +21,6 @@ function useCollapsibleRootContext() {
|
|
|
15
21
|
return context;
|
|
16
22
|
}
|
|
17
23
|
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region src/utils/createBaseUIEventDetails.ts
|
|
20
|
-
/**
|
|
21
|
-
* Creates a Base UI event details object with the given reason and utilities
|
|
22
|
-
* for preventing Base UI's internal event handling.
|
|
23
|
-
*/
|
|
24
|
-
function createChangeEventDetails(reason, event, trigger, customProperties) {
|
|
25
|
-
let canceled = false;
|
|
26
|
-
let propagationAllowed = false;
|
|
27
|
-
const custom = customProperties ?? require_button_Button.EMPTY_OBJECT;
|
|
28
|
-
return {
|
|
29
|
-
reason,
|
|
30
|
-
event: event ?? new Event("base-ui"),
|
|
31
|
-
cancel() {
|
|
32
|
-
canceled = true;
|
|
33
|
-
},
|
|
34
|
-
allowPropagation() {
|
|
35
|
-
propagationAllowed = true;
|
|
36
|
-
},
|
|
37
|
-
get isCanceled() {
|
|
38
|
-
return canceled;
|
|
39
|
-
},
|
|
40
|
-
get isPropagationAllowed() {
|
|
41
|
-
return propagationAllowed;
|
|
42
|
-
},
|
|
43
|
-
trigger,
|
|
44
|
-
...custom
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/utils/reasons.ts
|
|
50
|
-
const none = "none";
|
|
51
|
-
const triggerPress = "trigger-press";
|
|
52
|
-
const triggerHover = "trigger-hover";
|
|
53
|
-
const triggerFocus = "trigger-focus";
|
|
54
|
-
const outsidePress = "outside-press";
|
|
55
|
-
const itemPress = "item-press";
|
|
56
|
-
const closePress = "close-press";
|
|
57
|
-
const linkPress = "link-press";
|
|
58
|
-
const clearPress = "clear-press";
|
|
59
|
-
const chipRemovePress = "chip-remove-press";
|
|
60
|
-
const trackPress = "track-press";
|
|
61
|
-
const incrementPress = "increment-press";
|
|
62
|
-
const decrementPress = "decrement-press";
|
|
63
|
-
const inputChange = "input-change";
|
|
64
|
-
const inputClear = "input-clear";
|
|
65
|
-
const inputBlur = "input-blur";
|
|
66
|
-
const inputPaste = "input-paste";
|
|
67
|
-
const inputPress = "input-press";
|
|
68
|
-
const focusOut = "focus-out";
|
|
69
|
-
const escapeKey = "escape-key";
|
|
70
|
-
const closeWatcher = "close-watcher";
|
|
71
|
-
const listNavigation = "list-navigation";
|
|
72
|
-
const keyboard = "keyboard";
|
|
73
|
-
const pointer = "pointer";
|
|
74
|
-
const drag = "drag";
|
|
75
|
-
const swipe = "swipe";
|
|
76
|
-
const wheel = "wheel";
|
|
77
|
-
const scrub = "scrub";
|
|
78
|
-
const cancelOpen = "cancel-open";
|
|
79
|
-
const siblingOpen = "sibling-open";
|
|
80
|
-
const disabled = "disabled";
|
|
81
|
-
const imperativeAction = "imperative-action";
|
|
82
|
-
const windowResize = "window-resize";
|
|
83
|
-
const REASONS = {
|
|
84
|
-
none,
|
|
85
|
-
triggerPress,
|
|
86
|
-
triggerHover,
|
|
87
|
-
triggerFocus,
|
|
88
|
-
outsidePress,
|
|
89
|
-
itemPress,
|
|
90
|
-
closePress,
|
|
91
|
-
linkPress,
|
|
92
|
-
clearPress,
|
|
93
|
-
chipRemovePress,
|
|
94
|
-
trackPress,
|
|
95
|
-
incrementPress,
|
|
96
|
-
decrementPress,
|
|
97
|
-
inputChange,
|
|
98
|
-
inputClear,
|
|
99
|
-
inputBlur,
|
|
100
|
-
inputPaste,
|
|
101
|
-
inputPress,
|
|
102
|
-
focusOut,
|
|
103
|
-
escapeKey,
|
|
104
|
-
closeWatcher,
|
|
105
|
-
listNavigation,
|
|
106
|
-
keyboard,
|
|
107
|
-
pointer,
|
|
108
|
-
drag,
|
|
109
|
-
swipe,
|
|
110
|
-
wheel,
|
|
111
|
-
scrub,
|
|
112
|
-
cancelOpen,
|
|
113
|
-
siblingOpen,
|
|
114
|
-
disabled,
|
|
115
|
-
imperativeAction,
|
|
116
|
-
windowResize
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region src/utils/useControllableState.ts
|
|
121
|
-
/**
|
|
122
|
-
* Manages controlled / uncontrolled state following the same semantics as
|
|
123
|
-
* React's `useControlled` hook.
|
|
124
|
-
*
|
|
125
|
-
* - When `controlled()` returns a non-`undefined` value the component is
|
|
126
|
-
* considered **controlled** and the internal state is ignored.
|
|
127
|
-
* - When `controlled()` returns `undefined` the component is **uncontrolled**
|
|
128
|
-
* and the internal ref drives the value.
|
|
129
|
-
*/
|
|
130
|
-
function useControllableState(params) {
|
|
131
|
-
const internalValue = (0, vue.ref)(params.default);
|
|
132
|
-
const value = (0, vue.computed)(() => {
|
|
133
|
-
const c = params.controlled();
|
|
134
|
-
return c !== void 0 ? c : internalValue.value;
|
|
135
|
-
});
|
|
136
|
-
function setValue(next) {
|
|
137
|
-
internalValue.value = next;
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
value,
|
|
141
|
-
setValue
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
|
|
145
24
|
//#endregion
|
|
146
25
|
//#region src/collapsible/root/useCollapsibleRoot.ts
|
|
147
26
|
function useCollapsibleRoot(parameters) {
|
|
@@ -150,15 +29,17 @@ function useCollapsibleRoot(parameters) {
|
|
|
150
29
|
if (parameters.isOpenControlled) return parameters.isOpenControlled();
|
|
151
30
|
return openParam?.() !== void 0;
|
|
152
31
|
});
|
|
153
|
-
const { value: open, setValue: setOpen } = useControllableState({
|
|
32
|
+
const { value: open, setValue: setOpen } = require_checkbox_group_CheckboxGroup.useControllableState({
|
|
154
33
|
controlled: () => isControlled.value ? openParam?.() : void 0,
|
|
155
|
-
default: defaultOpen
|
|
34
|
+
default: () => defaultOpen,
|
|
35
|
+
name: "CollapsibleRoot",
|
|
36
|
+
state: "open"
|
|
156
37
|
});
|
|
157
|
-
const { mounted, setMounted, transitionStatus } =
|
|
38
|
+
const { mounted, setMounted, transitionStatus } = require_checkbox_index.useTransitionStatus(open, true, true);
|
|
158
39
|
const visible = (0, vue.ref)(open.value);
|
|
159
40
|
const height = (0, vue.ref)(void 0);
|
|
160
41
|
const width = (0, vue.ref)(void 0);
|
|
161
|
-
const defaultPanelId =
|
|
42
|
+
const defaultPanelId = require_checkbox_group_CheckboxGroup.useBaseUiId();
|
|
162
43
|
const panelIdState = (0, vue.ref)(void 0);
|
|
163
44
|
const panelId = (0, vue.computed)(() => panelIdState.value ?? defaultPanelId);
|
|
164
45
|
const hiddenUntilFound = (0, vue.ref)(false);
|
|
@@ -167,12 +48,12 @@ function useCollapsibleRoot(parameters) {
|
|
|
167
48
|
const animationTypeRef = (0, vue.ref)(null);
|
|
168
49
|
const transitionDimensionRef = (0, vue.ref)(null);
|
|
169
50
|
const panelRef = (0, vue.ref)(null);
|
|
170
|
-
const runOnceAnimationsFinish =
|
|
51
|
+
const runOnceAnimationsFinish = require_checkbox_index.useAnimationsFinished(panelRef, false);
|
|
171
52
|
const disabled = (0, vue.computed)(() => disabledGetter());
|
|
172
53
|
function handleTrigger(event) {
|
|
173
54
|
if (disabled.value) return;
|
|
174
55
|
const nextOpen = !open.value;
|
|
175
|
-
const eventDetails = createChangeEventDetails(REASONS.triggerPress, event);
|
|
56
|
+
const eventDetails = require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.triggerPress, event);
|
|
176
57
|
onOpenChange(nextOpen, eventDetails);
|
|
177
58
|
if (eventDetails.isCanceled) return;
|
|
178
59
|
const panel = panelRef.value;
|
|
@@ -237,83 +118,6 @@ function useCollapsibleRoot(parameters) {
|
|
|
237
118
|
};
|
|
238
119
|
}
|
|
239
120
|
|
|
240
|
-
//#endregion
|
|
241
|
-
//#region src/composite/list/CompositeListContext.ts
|
|
242
|
-
const compositeListContextKey = Symbol("CompositeListContext");
|
|
243
|
-
function useCompositeListContext() {
|
|
244
|
-
return (0, vue.inject)(compositeListContextKey);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
//#endregion
|
|
248
|
-
//#region src/composite/list/useCompositeListItem.ts
|
|
249
|
-
let IndexGuessBehavior = /* @__PURE__ */ function(IndexGuessBehavior) {
|
|
250
|
-
IndexGuessBehavior[IndexGuessBehavior["None"] = 0] = "None";
|
|
251
|
-
IndexGuessBehavior[IndexGuessBehavior["GuessFromOrder"] = 1] = "GuessFromOrder";
|
|
252
|
-
return IndexGuessBehavior;
|
|
253
|
-
}({});
|
|
254
|
-
/**
|
|
255
|
-
* Used to register a list item and its index (DOM position) in the `CompositeList`.
|
|
256
|
-
*/
|
|
257
|
-
function useCompositeListItem(params = {}) {
|
|
258
|
-
const externalIndex = (0, vue.computed)(() => params.index?.());
|
|
259
|
-
const label = (0, vue.computed)(() => params.label?.());
|
|
260
|
-
const metadata = (0, vue.computed)(() => params.metadata?.());
|
|
261
|
-
const textRef = (0, vue.computed)(() => params.textRef?.());
|
|
262
|
-
const indexGuessBehavior = (0, vue.computed)(() => params.indexGuessBehavior?.());
|
|
263
|
-
const { register, unregister, subscribeMapChange, elementsRef, labelsRef, nextIndexRef } = useCompositeListContext();
|
|
264
|
-
const indexRef = (0, vue.ref)(-1);
|
|
265
|
-
function initializeIndex() {
|
|
266
|
-
if (externalIndex.value != null) return externalIndex.value;
|
|
267
|
-
if (indexGuessBehavior.value === IndexGuessBehavior.GuessFromOrder) {
|
|
268
|
-
if (indexRef.value === -1) {
|
|
269
|
-
const newIndex = nextIndexRef.value;
|
|
270
|
-
nextIndexRef.value += 1;
|
|
271
|
-
indexRef.value = newIndex;
|
|
272
|
-
}
|
|
273
|
-
return indexRef.value;
|
|
274
|
-
}
|
|
275
|
-
return -1;
|
|
276
|
-
}
|
|
277
|
-
const internalIndex = (0, vue.ref)(initializeIndex());
|
|
278
|
-
const index = (0, vue.computed)(() => externalIndex.value ?? internalIndex.value);
|
|
279
|
-
const componentRef = (0, vue.ref)(null);
|
|
280
|
-
function setRef(node) {
|
|
281
|
-
const el = node?.$el || node;
|
|
282
|
-
componentRef.value = el;
|
|
283
|
-
if (index.value !== -1 && el !== null) {
|
|
284
|
-
elementsRef.value[index.value] = el;
|
|
285
|
-
if (labelsRef) {
|
|
286
|
-
const isLabelDefined = label.value !== void 0;
|
|
287
|
-
labelsRef.value[index.value] = isLabelDefined ? label.value : textRef.value?.value?.textContent ?? el.textContent;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
(0, vue.watchEffect)((onCleanup) => {
|
|
292
|
-
if (externalIndex.value != null) return;
|
|
293
|
-
const node = componentRef.value;
|
|
294
|
-
if (node) {
|
|
295
|
-
register(node, metadata.value);
|
|
296
|
-
onCleanup(() => {
|
|
297
|
-
unregister(node);
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
}, { flush: "post" });
|
|
301
|
-
(0, vue.watchEffect)((onCleanup) => {
|
|
302
|
-
if (externalIndex.value != null) return;
|
|
303
|
-
const unsubscribe = subscribeMapChange((map) => {
|
|
304
|
-
const i = componentRef.value ? map.get(componentRef.value)?.index : null;
|
|
305
|
-
if (i != null) internalIndex.value = i;
|
|
306
|
-
});
|
|
307
|
-
onCleanup(() => {
|
|
308
|
-
unsubscribe();
|
|
309
|
-
});
|
|
310
|
-
}, { flush: "post" });
|
|
311
|
-
return {
|
|
312
|
-
ref: setRef,
|
|
313
|
-
index
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
|
|
317
121
|
//#endregion
|
|
318
122
|
//#region src/accordion/root/AccordionRootContext.ts
|
|
319
123
|
const accordionRootContextKey = Symbol("AccordionRootContext");
|
|
@@ -368,8 +172,8 @@ var AccordionItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
368
172
|
const emit = __emit;
|
|
369
173
|
const attrs = (0, vue.useAttrs)();
|
|
370
174
|
const rootCtx = useAccordionRootContext();
|
|
371
|
-
const { ref: listItemRef, index } = useCompositeListItem();
|
|
372
|
-
const fallbackValue =
|
|
175
|
+
const { ref: listItemRef, index } = require_button_ToolbarButton.useCompositeListItem();
|
|
176
|
+
const fallbackValue = require_checkbox_group_CheckboxGroup.useBaseUiId();
|
|
373
177
|
const itemValue = (0, vue.computed)(() => props.value ?? fallbackValue);
|
|
374
178
|
const disabled = (0, vue.computed)(() => props.disabled || rootCtx.disabled.value);
|
|
375
179
|
const isOpen = (0, vue.computed)(() => {
|
|
@@ -401,7 +205,7 @@ var AccordionItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
401
205
|
disabled: disabled.value,
|
|
402
206
|
open: isOpen.value
|
|
403
207
|
}));
|
|
404
|
-
const triggerId = (0, vue.ref)(
|
|
208
|
+
const triggerId = (0, vue.ref)(require_checkbox_group_CheckboxGroup.useBaseUiId());
|
|
405
209
|
function setTriggerId(id) {
|
|
406
210
|
triggerId.value = id;
|
|
407
211
|
}
|
|
@@ -446,6 +250,20 @@ var AccordionItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
446
250
|
//#region src/accordion/item/AccordionItem.vue
|
|
447
251
|
var AccordionItem_default = AccordionItem_vue_vue_type_script_setup_true_lang_default;
|
|
448
252
|
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/accordion/root/AccordionRootDataAttributes.ts
|
|
255
|
+
let AccordionRootDataAttributes = /* @__PURE__ */ function(AccordionRootDataAttributes) {
|
|
256
|
+
/**
|
|
257
|
+
* Present when the accordion is disabled.
|
|
258
|
+
*/
|
|
259
|
+
AccordionRootDataAttributes["disabled"] = "data-disabled";
|
|
260
|
+
/**
|
|
261
|
+
* Indicates the orientation of the accordion.
|
|
262
|
+
*/
|
|
263
|
+
AccordionRootDataAttributes["orientation"] = "data-orientation";
|
|
264
|
+
return AccordionRootDataAttributes;
|
|
265
|
+
}({});
|
|
266
|
+
|
|
449
267
|
//#endregion
|
|
450
268
|
//#region src/utils/warn.ts
|
|
451
269
|
let set;
|
|
@@ -468,7 +286,7 @@ function useCollapsiblePanel(parameters) {
|
|
|
468
286
|
const latestAnimationNameRef = (0, vue.ref)(null);
|
|
469
287
|
const shouldCancelInitialOpenAnimationRef = (0, vue.ref)(open.value);
|
|
470
288
|
const shouldCancelInitialOpenTransitionRef = (0, vue.ref)(open.value);
|
|
471
|
-
const endingStyleFrame =
|
|
289
|
+
const endingStyleFrame = require_checkbox_index.useAnimationFrame();
|
|
472
290
|
/**
|
|
473
291
|
* When opening, the `hidden` attribute is removed immediately.
|
|
474
292
|
* When closing, the `hidden` attribute is set after any exit animations runs.
|
|
@@ -501,7 +319,7 @@ function useCollapsiblePanel(parameters) {
|
|
|
501
319
|
* transitions in order to set the value of width/height to `0px` momentarily.
|
|
502
320
|
* Setting both to `0px` will break layout.
|
|
503
321
|
*/
|
|
504
|
-
if (element.getAttribute(
|
|
322
|
+
if (element.getAttribute(AccordionRootDataAttributes.orientation) === "horizontal" || panelStyles.transitionProperty.includes("width")) transitionDimensionRef.value = "width";
|
|
505
323
|
else transitionDimensionRef.value = "height";
|
|
506
324
|
}
|
|
507
325
|
if (animationTypeRef.value !== "css-transition") return;
|
|
@@ -514,9 +332,9 @@ function useCollapsiblePanel(parameters) {
|
|
|
514
332
|
}
|
|
515
333
|
let frame = -1;
|
|
516
334
|
let nextFrame = -1;
|
|
517
|
-
frame =
|
|
335
|
+
frame = require_checkbox_index.AnimationFrame.request(() => {
|
|
518
336
|
shouldCancelInitialOpenTransitionRef.value = false;
|
|
519
|
-
nextFrame =
|
|
337
|
+
nextFrame = require_checkbox_index.AnimationFrame.request(() => {
|
|
520
338
|
/**
|
|
521
339
|
* This is slightly faster than another RAF and is the earliest
|
|
522
340
|
* opportunity to remove the temporary `transition-duration: 0s` that
|
|
@@ -529,8 +347,8 @@ function useCollapsiblePanel(parameters) {
|
|
|
529
347
|
});
|
|
530
348
|
});
|
|
531
349
|
return () => {
|
|
532
|
-
|
|
533
|
-
|
|
350
|
+
require_checkbox_index.AnimationFrame.cancel(frame);
|
|
351
|
+
require_checkbox_index.AnimationFrame.cancel(nextFrame);
|
|
534
352
|
};
|
|
535
353
|
}
|
|
536
354
|
const mergedRef = require_button_Button.useMergedRefs(externalRef ?? null, panelRef, handlePanelRef);
|
|
@@ -564,14 +382,14 @@ function useCollapsiblePanel(parameters) {
|
|
|
564
382
|
height: panel.scrollHeight,
|
|
565
383
|
width: panel.scrollWidth
|
|
566
384
|
});
|
|
567
|
-
const resizeFrame =
|
|
385
|
+
const resizeFrame = require_checkbox_index.AnimationFrame.request(() => {
|
|
568
386
|
Object.entries(originalLayoutStyles).forEach(([key, value]) => {
|
|
569
387
|
if (value === "") panel.style.removeProperty(key);
|
|
570
388
|
else panel.style.setProperty(key, value);
|
|
571
389
|
});
|
|
572
390
|
});
|
|
573
391
|
return () => {
|
|
574
|
-
|
|
392
|
+
require_checkbox_index.AnimationFrame.cancel(resizeFrame);
|
|
575
393
|
};
|
|
576
394
|
} else {
|
|
577
395
|
if (panel.scrollHeight === 0 && panel.scrollWidth === 0) return;
|
|
@@ -641,10 +459,10 @@ function useCollapsiblePanel(parameters) {
|
|
|
641
459
|
}
|
|
642
460
|
}, { flush: "post" });
|
|
643
461
|
(0, vue.onMounted)(() => {
|
|
644
|
-
const frame =
|
|
462
|
+
const frame = require_checkbox_index.AnimationFrame.request(() => {
|
|
645
463
|
shouldCancelInitialOpenAnimationRef.value = false;
|
|
646
464
|
});
|
|
647
|
-
return () =>
|
|
465
|
+
return () => require_checkbox_index.AnimationFrame.cancel(frame);
|
|
648
466
|
});
|
|
649
467
|
(0, vue.watch)([open, () => hiddenUntilFound], ([isOpen]) => {
|
|
650
468
|
if (!hiddenUntilFound) return;
|
|
@@ -657,17 +475,17 @@ function useCollapsiblePanel(parameters) {
|
|
|
657
475
|
width: panel.scrollWidth
|
|
658
476
|
});
|
|
659
477
|
let nextFrame = -1;
|
|
660
|
-
const frame =
|
|
478
|
+
const frame = require_checkbox_index.AnimationFrame.request(() => {
|
|
661
479
|
isBeforeMatchRef.value = false;
|
|
662
|
-
nextFrame =
|
|
480
|
+
nextFrame = require_checkbox_index.AnimationFrame.request(() => {
|
|
663
481
|
setTimeout(() => {
|
|
664
482
|
panel.style.removeProperty("transition-duration");
|
|
665
483
|
});
|
|
666
484
|
});
|
|
667
485
|
});
|
|
668
486
|
return () => {
|
|
669
|
-
|
|
670
|
-
|
|
487
|
+
require_checkbox_index.AnimationFrame.cancel(frame);
|
|
488
|
+
require_checkbox_index.AnimationFrame.cancel(nextFrame);
|
|
671
489
|
};
|
|
672
490
|
}
|
|
673
491
|
}, { flush: "sync" });
|
|
@@ -694,7 +512,7 @@ function useCollapsiblePanel(parameters) {
|
|
|
694
512
|
function handleBeforeMatch(event) {
|
|
695
513
|
isBeforeMatchRef.value = true;
|
|
696
514
|
setOpen(true);
|
|
697
|
-
onOpenChange(true, createChangeEventDetails(REASONS.none, event));
|
|
515
|
+
onOpenChange(true, require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.none, event));
|
|
698
516
|
}
|
|
699
517
|
panel.addEventListener("beforematch", handleBeforeMatch);
|
|
700
518
|
beforeMatchCleanup = () => {
|
|
@@ -793,7 +611,7 @@ var AccordionPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
793
611
|
});
|
|
794
612
|
(0, vue.watch)(hiddenUntilFound, (val) => collapsibleCtx.setHiddenUntilFound(val), { immediate: true });
|
|
795
613
|
(0, vue.watch)(keepMounted, (val) => collapsibleCtx.setKeepMounted(val), { immediate: true });
|
|
796
|
-
|
|
614
|
+
require_checkbox_index.useOpenChangeComplete({
|
|
797
615
|
open: (0, vue.computed)(() => collapsibleCtx.open.value && collapsibleCtx.transitionStatus.value === "idle"),
|
|
798
616
|
ref: collapsibleCtx.panelRef,
|
|
799
617
|
onComplete() {
|
|
@@ -984,7 +802,7 @@ var CompositeList_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
984
802
|
listeners.value.delete(fn);
|
|
985
803
|
};
|
|
986
804
|
}
|
|
987
|
-
(0, vue.provide)(compositeListContextKey, {
|
|
805
|
+
(0, vue.provide)(require_button_ToolbarButton.compositeListContextKey, {
|
|
988
806
|
register,
|
|
989
807
|
unregister,
|
|
990
808
|
subscribeMapChange,
|
|
@@ -1079,7 +897,7 @@ var AccordionRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
1079
897
|
const props = __props;
|
|
1080
898
|
const emit = __emit;
|
|
1081
899
|
const attrs = (0, vue.useAttrs)();
|
|
1082
|
-
const direction =
|
|
900
|
+
const direction = require_control_SliderControl.useDirection();
|
|
1083
901
|
const instance = (0, vue.getCurrentInstance)();
|
|
1084
902
|
if (process.env.NODE_ENV !== "production") (0, vue.watchEffect)(() => {
|
|
1085
903
|
if (props.hiddenUntilFound && props.keepMounted === false) warn("The `:keepMounted=\"false\"` prop on a AccordionRoot will be ignored when using `hiddenUntilFound` since it requires Panels to remain mounted when closed.");
|
|
@@ -1090,12 +908,13 @@ var AccordionRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
1090
908
|
});
|
|
1091
909
|
const _compositeRefs = { elementsRef: (0, vue.ref)([]) };
|
|
1092
910
|
const accordionItemRefs = _compositeRefs.elementsRef;
|
|
1093
|
-
const { value: openValues, setValue: setOpenValues } = useControllableState({
|
|
911
|
+
const { value: openValues, setValue: setOpenValues } = require_checkbox_group_CheckboxGroup.useControllableState({
|
|
1094
912
|
controlled: () => isValueControlled.value ? props.value : void 0,
|
|
1095
|
-
default: props.defaultValue ?? []
|
|
913
|
+
default: () => props.defaultValue ?? [],
|
|
914
|
+
name: "AccordionRoot"
|
|
1096
915
|
});
|
|
1097
916
|
function handleValueChange(newValue, nextOpen) {
|
|
1098
|
-
const details = createChangeEventDetails(REASONS.none);
|
|
917
|
+
const details = require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.none);
|
|
1099
918
|
if (!props.multiple) {
|
|
1100
919
|
const nextValue = openValues.value[0] === newValue ? [] : [newValue];
|
|
1101
920
|
emit("valueChange", nextValue, details);
|
|
@@ -1162,6 +981,13 @@ var AccordionRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
1162
981
|
//#region src/accordion/root/AccordionRoot.vue
|
|
1163
982
|
var AccordionRoot_default = AccordionRoot_vue_vue_type_script_setup_true_lang_default;
|
|
1164
983
|
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region src/floating-ui-vue/utils/constants.ts
|
|
986
|
+
const ARROW_LEFT = "ArrowLeft";
|
|
987
|
+
const ARROW_RIGHT = "ArrowRight";
|
|
988
|
+
const ARROW_UP = "ArrowUp";
|
|
989
|
+
const ARROW_DOWN = "ArrowDown";
|
|
990
|
+
|
|
1165
991
|
//#endregion
|
|
1166
992
|
//#region src/floating-ui-vue/utils/event.ts
|
|
1167
993
|
function stopEvent(event) {
|
|
@@ -1169,6 +995,245 @@ function stopEvent(event) {
|
|
|
1169
995
|
event.stopPropagation();
|
|
1170
996
|
}
|
|
1171
997
|
|
|
998
|
+
//#endregion
|
|
999
|
+
//#region src/floating-ui-vue/utils/composite.ts
|
|
1000
|
+
function isDifferentGridRow(index, cols, prevRow) {
|
|
1001
|
+
return Math.floor(index / cols) !== prevRow;
|
|
1002
|
+
}
|
|
1003
|
+
function isIndexOutOfListBounds(listRef, index) {
|
|
1004
|
+
return index < 0 || index >= listRef.value.length;
|
|
1005
|
+
}
|
|
1006
|
+
function getMinListIndex(listRef, disabledIndices) {
|
|
1007
|
+
return findNonDisabledListIndex(listRef, { disabledIndices });
|
|
1008
|
+
}
|
|
1009
|
+
function getMaxListIndex(listRef, disabledIndices) {
|
|
1010
|
+
return findNonDisabledListIndex(listRef, {
|
|
1011
|
+
decrement: true,
|
|
1012
|
+
startingIndex: listRef.value.length,
|
|
1013
|
+
disabledIndices
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
function findNonDisabledListIndex(listRef, { startingIndex = -1, decrement = false, disabledIndices, amount = 1 } = {}) {
|
|
1017
|
+
let index = startingIndex;
|
|
1018
|
+
do
|
|
1019
|
+
index += decrement ? -amount : amount;
|
|
1020
|
+
while (index >= 0 && index <= listRef.value.length - 1 && isListIndexDisabled(listRef, index, disabledIndices));
|
|
1021
|
+
return index;
|
|
1022
|
+
}
|
|
1023
|
+
function getGridNavigatedIndex(listRef, { event, orientation, loopFocus, rtl, cols, disabledIndices, minIndex, maxIndex, prevIndex, stopEvent: stop = false }) {
|
|
1024
|
+
let nextIndex = prevIndex;
|
|
1025
|
+
const rows = [];
|
|
1026
|
+
const rowIndexMap = {};
|
|
1027
|
+
let hasRoleRow = false;
|
|
1028
|
+
{
|
|
1029
|
+
let currentRowEl = null;
|
|
1030
|
+
let currentRowIndex = -1;
|
|
1031
|
+
listRef.value.forEach((el, idx) => {
|
|
1032
|
+
if (el == null) return;
|
|
1033
|
+
const rowEl = el.closest("[role=\"row\"]");
|
|
1034
|
+
if (rowEl) hasRoleRow = true;
|
|
1035
|
+
if (rowEl !== currentRowEl || currentRowIndex === -1) {
|
|
1036
|
+
currentRowEl = rowEl;
|
|
1037
|
+
currentRowIndex += 1;
|
|
1038
|
+
rows[currentRowIndex] = [];
|
|
1039
|
+
}
|
|
1040
|
+
rows[currentRowIndex].push(idx);
|
|
1041
|
+
rowIndexMap[idx] = currentRowIndex;
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
const hasDomRows = hasRoleRow && rows.length > 0 && rows.some((row) => row.length !== cols);
|
|
1045
|
+
function navigateVertically(direction) {
|
|
1046
|
+
if (!hasDomRows || prevIndex === -1) return;
|
|
1047
|
+
const currentRow = rowIndexMap[prevIndex];
|
|
1048
|
+
if (currentRow == null) return;
|
|
1049
|
+
const colInRow = rows[currentRow].indexOf(prevIndex);
|
|
1050
|
+
let nextRow = direction === "up" ? currentRow - 1 : currentRow + 1;
|
|
1051
|
+
if (loopFocus) {
|
|
1052
|
+
if (nextRow < 0) nextRow = rows.length - 1;
|
|
1053
|
+
else if (nextRow >= rows.length) nextRow = 0;
|
|
1054
|
+
}
|
|
1055
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1056
|
+
const _listRef = listRef;
|
|
1057
|
+
while (nextRow >= 0 && nextRow < rows.length && !visited.has(nextRow)) {
|
|
1058
|
+
visited.add(nextRow);
|
|
1059
|
+
const targetRow = rows[nextRow];
|
|
1060
|
+
if (targetRow.length === 0) {
|
|
1061
|
+
nextRow = direction === "up" ? nextRow - 1 : nextRow + 1;
|
|
1062
|
+
continue;
|
|
1063
|
+
}
|
|
1064
|
+
const clampedCol = Math.min(colInRow, targetRow.length - 1);
|
|
1065
|
+
for (let col = clampedCol; col >= 0; col -= 1) {
|
|
1066
|
+
const candidate = targetRow[col];
|
|
1067
|
+
if (!isListIndexDisabled(_listRef, candidate, disabledIndices)) return candidate;
|
|
1068
|
+
}
|
|
1069
|
+
nextRow = direction === "up" ? nextRow - 1 : nextRow + 1;
|
|
1070
|
+
if (loopFocus) {
|
|
1071
|
+
if (nextRow < 0) nextRow = rows.length - 1;
|
|
1072
|
+
else if (nextRow >= rows.length) nextRow = 0;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
const _listRef = listRef;
|
|
1077
|
+
if (event.key === ARROW_UP) {
|
|
1078
|
+
const domBasedCandidate = navigateVertically("up");
|
|
1079
|
+
if (domBasedCandidate !== void 0) {
|
|
1080
|
+
if (stop) stopEvent(event);
|
|
1081
|
+
nextIndex = domBasedCandidate;
|
|
1082
|
+
} else {
|
|
1083
|
+
if (stop) stopEvent(event);
|
|
1084
|
+
if (prevIndex === -1) nextIndex = maxIndex;
|
|
1085
|
+
else {
|
|
1086
|
+
nextIndex = findNonDisabledListIndex(_listRef, {
|
|
1087
|
+
startingIndex: nextIndex,
|
|
1088
|
+
amount: cols,
|
|
1089
|
+
decrement: true,
|
|
1090
|
+
disabledIndices
|
|
1091
|
+
});
|
|
1092
|
+
if (loopFocus && (prevIndex - cols < minIndex || nextIndex < 0)) {
|
|
1093
|
+
const col = prevIndex % cols;
|
|
1094
|
+
const maxCol = maxIndex % cols;
|
|
1095
|
+
const offset = maxIndex - (maxCol - col);
|
|
1096
|
+
if (maxCol === col) nextIndex = maxIndex;
|
|
1097
|
+
else nextIndex = maxCol > col ? offset : offset - cols;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
if (isIndexOutOfListBounds(listRef, nextIndex)) nextIndex = prevIndex;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
if (event.key === ARROW_DOWN) {
|
|
1104
|
+
const domBasedCandidate = navigateVertically("down");
|
|
1105
|
+
if (domBasedCandidate !== void 0) {
|
|
1106
|
+
if (stop) stopEvent(event);
|
|
1107
|
+
nextIndex = domBasedCandidate;
|
|
1108
|
+
} else {
|
|
1109
|
+
if (stop) stopEvent(event);
|
|
1110
|
+
if (prevIndex === -1) nextIndex = minIndex;
|
|
1111
|
+
else {
|
|
1112
|
+
nextIndex = findNonDisabledListIndex(_listRef, {
|
|
1113
|
+
startingIndex: prevIndex,
|
|
1114
|
+
amount: cols,
|
|
1115
|
+
disabledIndices
|
|
1116
|
+
});
|
|
1117
|
+
if (loopFocus && prevIndex + cols > maxIndex) nextIndex = findNonDisabledListIndex(_listRef, {
|
|
1118
|
+
startingIndex: prevIndex % cols - cols,
|
|
1119
|
+
amount: cols,
|
|
1120
|
+
disabledIndices
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
if (isIndexOutOfListBounds(listRef, nextIndex)) nextIndex = prevIndex;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
if (orientation === "both") {
|
|
1127
|
+
const prevRow = (0, _floating_ui_utils.floor)(prevIndex / cols);
|
|
1128
|
+
if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {
|
|
1129
|
+
if (stop) stopEvent(event);
|
|
1130
|
+
if (prevIndex % cols !== cols - 1) {
|
|
1131
|
+
nextIndex = findNonDisabledListIndex(_listRef, {
|
|
1132
|
+
startingIndex: prevIndex,
|
|
1133
|
+
disabledIndices
|
|
1134
|
+
});
|
|
1135
|
+
if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) nextIndex = findNonDisabledListIndex(_listRef, {
|
|
1136
|
+
startingIndex: prevIndex - prevIndex % cols - 1,
|
|
1137
|
+
disabledIndices
|
|
1138
|
+
});
|
|
1139
|
+
} else if (loopFocus) nextIndex = findNonDisabledListIndex(_listRef, {
|
|
1140
|
+
startingIndex: prevIndex - prevIndex % cols - 1,
|
|
1141
|
+
disabledIndices
|
|
1142
|
+
});
|
|
1143
|
+
if (isDifferentGridRow(nextIndex, cols, prevRow)) nextIndex = prevIndex;
|
|
1144
|
+
}
|
|
1145
|
+
if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {
|
|
1146
|
+
if (stop) stopEvent(event);
|
|
1147
|
+
if (prevIndex % cols !== 0) {
|
|
1148
|
+
nextIndex = findNonDisabledListIndex(_listRef, {
|
|
1149
|
+
startingIndex: prevIndex,
|
|
1150
|
+
decrement: true,
|
|
1151
|
+
disabledIndices
|
|
1152
|
+
});
|
|
1153
|
+
if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) nextIndex = findNonDisabledListIndex(_listRef, {
|
|
1154
|
+
startingIndex: prevIndex + (cols - prevIndex % cols),
|
|
1155
|
+
decrement: true,
|
|
1156
|
+
disabledIndices
|
|
1157
|
+
});
|
|
1158
|
+
} else if (loopFocus) nextIndex = findNonDisabledListIndex(_listRef, {
|
|
1159
|
+
startingIndex: prevIndex + (cols - prevIndex % cols),
|
|
1160
|
+
decrement: true,
|
|
1161
|
+
disabledIndices
|
|
1162
|
+
});
|
|
1163
|
+
if (isDifferentGridRow(nextIndex, cols, prevRow)) nextIndex = prevIndex;
|
|
1164
|
+
}
|
|
1165
|
+
const lastRow = (0, _floating_ui_utils.floor)(maxIndex / cols) === prevRow;
|
|
1166
|
+
if (isIndexOutOfListBounds(listRef, nextIndex)) if (loopFocus && lastRow) nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(_listRef, {
|
|
1167
|
+
startingIndex: prevIndex - prevIndex % cols - 1,
|
|
1168
|
+
disabledIndices
|
|
1169
|
+
});
|
|
1170
|
+
else nextIndex = prevIndex;
|
|
1171
|
+
}
|
|
1172
|
+
return nextIndex;
|
|
1173
|
+
}
|
|
1174
|
+
/** For each cell index, gets the item index that occupies that cell */
|
|
1175
|
+
function createGridCellMap(sizes, cols, dense) {
|
|
1176
|
+
const cellMap = [];
|
|
1177
|
+
let startIndex = 0;
|
|
1178
|
+
sizes.forEach(({ width, height }, index) => {
|
|
1179
|
+
if (width > cols) {
|
|
1180
|
+
if (process.env.NODE_ENV !== "production") throw new Error(`[Base UI Vue]: Invalid grid - item width at index ${index} is greater than grid columns`);
|
|
1181
|
+
}
|
|
1182
|
+
let itemPlaced = false;
|
|
1183
|
+
if (dense) startIndex = 0;
|
|
1184
|
+
while (!itemPlaced) {
|
|
1185
|
+
const targetCells = [];
|
|
1186
|
+
for (let i = 0; i < width; i += 1) for (let j = 0; j < height; j += 1) targetCells.push(startIndex + i + j * cols);
|
|
1187
|
+
if (startIndex % cols + width <= cols && targetCells.every((cell) => cellMap[cell] == null)) {
|
|
1188
|
+
targetCells.forEach((cell) => {
|
|
1189
|
+
cellMap[cell] = index;
|
|
1190
|
+
});
|
|
1191
|
+
itemPlaced = true;
|
|
1192
|
+
} else startIndex += 1;
|
|
1193
|
+
}
|
|
1194
|
+
});
|
|
1195
|
+
return [...cellMap];
|
|
1196
|
+
}
|
|
1197
|
+
/** Gets cell index of an item's corner or -1 when index is -1. */
|
|
1198
|
+
function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {
|
|
1199
|
+
if (index === -1) return -1;
|
|
1200
|
+
const firstCellIndex = cellMap.indexOf(index);
|
|
1201
|
+
const sizeItem = sizes[index];
|
|
1202
|
+
switch (corner) {
|
|
1203
|
+
case "tl": return firstCellIndex;
|
|
1204
|
+
case "tr":
|
|
1205
|
+
if (!sizeItem) return firstCellIndex;
|
|
1206
|
+
return firstCellIndex + sizeItem.width - 1;
|
|
1207
|
+
case "bl":
|
|
1208
|
+
if (!sizeItem) return firstCellIndex;
|
|
1209
|
+
return firstCellIndex + (sizeItem.height - 1) * cols;
|
|
1210
|
+
case "br": return cellMap.lastIndexOf(index);
|
|
1211
|
+
default: return -1;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
/** Gets all cell indices that correspond to the specified indices */
|
|
1215
|
+
function getGridCellIndices(indices, cellMap) {
|
|
1216
|
+
return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);
|
|
1217
|
+
}
|
|
1218
|
+
function isListIndexDisabled(listRef, index, disabledIndices) {
|
|
1219
|
+
if (typeof disabledIndices === "function") return disabledIndices(index);
|
|
1220
|
+
if (disabledIndices) return disabledIndices.includes(index);
|
|
1221
|
+
const element = listRef.value[index];
|
|
1222
|
+
if (!element) return false;
|
|
1223
|
+
return element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true";
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
//#endregion
|
|
1227
|
+
//#region src/floating-ui-vue/utils/element.ts
|
|
1228
|
+
function matchesFocusVisible(element) {
|
|
1229
|
+
if (!element) return true;
|
|
1230
|
+
try {
|
|
1231
|
+
return element.matches(":focus-visible");
|
|
1232
|
+
} catch {
|
|
1233
|
+
return true;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1172
1237
|
//#endregion
|
|
1173
1238
|
//#region src/utils/isElementDisabled.ts
|
|
1174
1239
|
function isElementDisabled(element) {
|
|
@@ -1410,7 +1475,7 @@ var AvatarRoot_default = AvatarRoot_vue_vue_type_script_setup_true_lang_default;
|
|
|
1410
1475
|
//#region src/collapsible/root/stateAttributesMapping.ts
|
|
1411
1476
|
const collapsibleStateAttributesMapping = {
|
|
1412
1477
|
...require_header_AccordionHeader.collapsibleOpenStateMapping,
|
|
1413
|
-
...
|
|
1478
|
+
...require_checkbox_index.transitionStatusMapping
|
|
1414
1479
|
};
|
|
1415
1480
|
|
|
1416
1481
|
//#endregion
|
|
@@ -1506,7 +1571,7 @@ var CollapsiblePanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
1506
1571
|
visible: ctx.visible,
|
|
1507
1572
|
width: ctx.width
|
|
1508
1573
|
});
|
|
1509
|
-
|
|
1574
|
+
require_checkbox_index.useOpenChangeComplete({
|
|
1510
1575
|
open: (0, vue.computed)(() => ctx.open.value && ctx.transitionStatus.value === "idle"),
|
|
1511
1576
|
ref: ctx.panelRef,
|
|
1512
1577
|
onComplete() {
|
|
@@ -1698,7 +1763,7 @@ var CollapsibleTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
|
|
|
1698
1763
|
const props = __props;
|
|
1699
1764
|
const triggerStateAttributesMapping = {
|
|
1700
1765
|
...require_header_AccordionHeader.triggerOpenStateMapping,
|
|
1701
|
-
...
|
|
1766
|
+
...require_checkbox_index.transitionStatusMapping
|
|
1702
1767
|
};
|
|
1703
1768
|
const attrs = (0, vue.useAttrs)();
|
|
1704
1769
|
const ctx = useCollapsibleRootContext();
|
|
@@ -1759,12 +1824,21 @@ var LabelableProvider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
1759
1824
|
},
|
|
1760
1825
|
setup(__props) {
|
|
1761
1826
|
const props = __props;
|
|
1762
|
-
const
|
|
1827
|
+
const defaultId = require_checkbox_group_CheckboxGroup.useBaseUiId();
|
|
1828
|
+
const initialControlId = props.controlId === void 0 ? defaultId : props.controlId;
|
|
1829
|
+
const controlId = (0, vue.ref)(initialControlId);
|
|
1763
1830
|
const labelId = (0, vue.ref)(props.labelId);
|
|
1764
1831
|
const messageIds = (0, vue.ref)([]);
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1767
|
-
|
|
1832
|
+
const registrations = /* @__PURE__ */ new Map();
|
|
1833
|
+
const parent = require_checkbox_group_CheckboxGroup.useLabelableContext();
|
|
1834
|
+
function registerControlId(source, id) {
|
|
1835
|
+
if (id === void 0) registrations.delete(source);
|
|
1836
|
+
else registrations.set(source, id);
|
|
1837
|
+
if (registrations.size === 0) {
|
|
1838
|
+
controlId.value = initialControlId;
|
|
1839
|
+
return;
|
|
1840
|
+
}
|
|
1841
|
+
controlId.value = registrations.values().next().value;
|
|
1768
1842
|
}
|
|
1769
1843
|
function setLabelId(id) {
|
|
1770
1844
|
labelId.value = id;
|
|
@@ -1776,9 +1850,9 @@ var LabelableProvider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
1776
1850
|
const describedBy = parent.messageIds.value.concat(messageIds.value).join(" ") || void 0;
|
|
1777
1851
|
return { "aria-describedby": describedBy };
|
|
1778
1852
|
}
|
|
1779
|
-
(0, vue.provide)(
|
|
1853
|
+
(0, vue.provide)(require_checkbox_group_CheckboxGroup.labelableContextKey, {
|
|
1780
1854
|
controlId,
|
|
1781
|
-
|
|
1855
|
+
registerControlId,
|
|
1782
1856
|
labelId,
|
|
1783
1857
|
setLabelId,
|
|
1784
1858
|
messageIds,
|
|
@@ -1795,14 +1869,6 @@ var LabelableProvider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
1795
1869
|
//#region src/labelable-provider/LabelableProvider.vue
|
|
1796
1870
|
var LabelableProvider_default = LabelableProvider_vue_vue_type_script_setup_true_lang_default;
|
|
1797
1871
|
|
|
1798
|
-
//#endregion
|
|
1799
|
-
//#region src/field/item/FieldItemContext.ts
|
|
1800
|
-
const defaultContext = { disabled: (0, vue.ref)(false) };
|
|
1801
|
-
const fieldItemContextKey = Symbol("FieldItemContext");
|
|
1802
|
-
function useFieldItemContext() {
|
|
1803
|
-
return (0, vue.inject)(fieldItemContextKey, defaultContext);
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
1872
|
//#endregion
|
|
1807
1873
|
//#region src/field/item/FieldItem.vue?vue&type=script&setup=true&lang.ts
|
|
1808
1874
|
var FieldItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -1841,17 +1907,22 @@ var FieldItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
1841
1907
|
setup(__props) {
|
|
1842
1908
|
const props = __props;
|
|
1843
1909
|
const attrs = (0, vue.useAttrs)();
|
|
1844
|
-
const { state, disabled: rootDisabled } =
|
|
1845
|
-
|
|
1910
|
+
const { state, disabled: rootDisabled } = require_checkbox_group_CheckboxGroup.useFieldRootContext(false);
|
|
1911
|
+
const disabled = (0, vue.computed)(() => rootDisabled.value || props.disabled);
|
|
1912
|
+
const checkboxGroupContext = require_checkbox_group_CheckboxGroup.useCheckboxGroupContext(true);
|
|
1913
|
+
const parentId = (0, vue.computed)(() => checkboxGroupContext?.parent.id);
|
|
1914
|
+
const hasParentCheckbox = (0, vue.computed)(() => checkboxGroupContext?.allValues.value !== void 0);
|
|
1915
|
+
const controlId = (0, vue.computed)(() => hasParentCheckbox.value ? parentId.value : void 0);
|
|
1916
|
+
(0, vue.provide)(require_checkbox_index.fieldItemContextKey, { disabled });
|
|
1846
1917
|
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
1847
1918
|
componentProps: props,
|
|
1848
1919
|
state,
|
|
1849
1920
|
props: (0, vue.computed)(() => ({ ...attrs })),
|
|
1850
|
-
stateAttributesMapping:
|
|
1921
|
+
stateAttributesMapping: require_checkbox_group_CheckboxGroup.fieldValidityMapping,
|
|
1851
1922
|
defaultTagName: "div"
|
|
1852
1923
|
});
|
|
1853
1924
|
return (_ctx, _cache) => {
|
|
1854
|
-
return (0, vue.openBlock)(), (0, vue.createBlock)(LabelableProvider_default,
|
|
1925
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(LabelableProvider_default, { "control-id": controlId.value }, {
|
|
1855
1926
|
default: (0, vue.withCtx)(() => [(0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
1856
1927
|
key: 0,
|
|
1857
1928
|
props: (0, vue.unref)(mergedProps),
|
|
@@ -1861,7 +1932,7 @@ var FieldItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
1861
1932
|
_: 3
|
|
1862
1933
|
}, 16))]),
|
|
1863
1934
|
_: 3
|
|
1864
|
-
});
|
|
1935
|
+
}, 8, ["control-id"]);
|
|
1865
1936
|
};
|
|
1866
1937
|
}
|
|
1867
1938
|
});
|
|
@@ -1870,6 +1941,69 @@ var FieldItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
1870
1941
|
//#region src/field/item/FieldItem.vue
|
|
1871
1942
|
var FieldItem_default = FieldItem_vue_vue_type_script_setup_true_lang_default;
|
|
1872
1943
|
|
|
1944
|
+
//#endregion
|
|
1945
|
+
//#region src/utils/useRegisteredLabelId.ts
|
|
1946
|
+
function useRegisteredLabelId(idProp, setLabelId) {
|
|
1947
|
+
const generatedId = require_checkbox_group_CheckboxGroup.useBaseUiId();
|
|
1948
|
+
const id = (0, vue.computed)(() => (0, vue.toValue)(idProp) ?? generatedId);
|
|
1949
|
+
(0, vue.watchSyncEffect)((onCleanup) => {
|
|
1950
|
+
setLabelId(id.value);
|
|
1951
|
+
onCleanup(() => {
|
|
1952
|
+
setLabelId(void 0);
|
|
1953
|
+
});
|
|
1954
|
+
});
|
|
1955
|
+
return id;
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
//#endregion
|
|
1959
|
+
//#region src/labelable-provider/useLabel.ts
|
|
1960
|
+
function useLabel(params = {}) {
|
|
1961
|
+
const { id: idProp, fallbackControlId, native, setLabelId: setLabelIdProp, focusControl: focusControlProp } = params;
|
|
1962
|
+
const { controlId: contextControlId, setLabelId: setContextLabelId } = require_checkbox_group_CheckboxGroup.useLabelableContext();
|
|
1963
|
+
const syncLabelId = (nextLabelId) => {
|
|
1964
|
+
setContextLabelId(nextLabelId);
|
|
1965
|
+
setLabelIdProp?.(nextLabelId);
|
|
1966
|
+
};
|
|
1967
|
+
const labelId = useRegisteredLabelId(idProp, syncLabelId);
|
|
1968
|
+
const resolvedControlId = (0, vue.computed)(() => contextControlId.value ?? (0, vue.toValue)(fallbackControlId));
|
|
1969
|
+
const isNative = (0, vue.computed)(() => (0, vue.toValue)(native) ?? false);
|
|
1970
|
+
function defaultFocusControl(event, controlId) {
|
|
1971
|
+
if (!controlId) return;
|
|
1972
|
+
const controlElement = require_control_SliderControl.ownerDocument(event.currentTarget)?.getElementById(controlId);
|
|
1973
|
+
if ((0, _floating_ui_utils_dom.isHTMLElement)(controlElement)) focusElementWithVisible(controlElement);
|
|
1974
|
+
}
|
|
1975
|
+
function handleInteraction(event) {
|
|
1976
|
+
if (require_control_SliderControl.getTarget(event)?.closest("button,input,select,textarea")) return;
|
|
1977
|
+
if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
|
|
1978
|
+
if (isNative.value) return;
|
|
1979
|
+
if (focusControlProp) {
|
|
1980
|
+
focusControlProp(event, resolvedControlId.value);
|
|
1981
|
+
return;
|
|
1982
|
+
}
|
|
1983
|
+
defaultFocusControl(event, resolvedControlId.value);
|
|
1984
|
+
}
|
|
1985
|
+
return {
|
|
1986
|
+
labelId,
|
|
1987
|
+
props: (0, vue.computed)(() => {
|
|
1988
|
+
if (isNative.value) return {
|
|
1989
|
+
id: labelId.value,
|
|
1990
|
+
for: resolvedControlId.value ?? void 0,
|
|
1991
|
+
onMousedown: handleInteraction
|
|
1992
|
+
};
|
|
1993
|
+
return {
|
|
1994
|
+
id: labelId.value,
|
|
1995
|
+
onClick: handleInteraction,
|
|
1996
|
+
onPointerdown(event) {
|
|
1997
|
+
event.preventDefault();
|
|
1998
|
+
}
|
|
1999
|
+
};
|
|
2000
|
+
})
|
|
2001
|
+
};
|
|
2002
|
+
}
|
|
2003
|
+
function focusElementWithVisible(element) {
|
|
2004
|
+
element.focus({ focusVisible: true });
|
|
2005
|
+
}
|
|
2006
|
+
|
|
1873
2007
|
//#endregion
|
|
1874
2008
|
//#region src/field/label/FieldLabel.vue?vue&type=script&setup=true&lang.ts
|
|
1875
2009
|
var FieldLabel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -1912,42 +2046,20 @@ var FieldLabel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
1912
2046
|
setup(__props) {
|
|
1913
2047
|
const props = __props;
|
|
1914
2048
|
const attrs = (0, vue.useAttrs)();
|
|
1915
|
-
const fieldRootContext =
|
|
1916
|
-
const {
|
|
1917
|
-
const
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
const id = labelId.value;
|
|
1921
|
-
setLabelId(id);
|
|
1922
|
-
onCleanup(() => setLabelId(void 0));
|
|
2049
|
+
const fieldRootContext = require_checkbox_group_CheckboxGroup.useFieldRootContext(false);
|
|
2050
|
+
const { labelId } = require_checkbox_group_CheckboxGroup.useLabelableContext();
|
|
2051
|
+
const label = useLabel({
|
|
2052
|
+
id: (0, vue.computed)(() => labelId.value ?? props.id),
|
|
2053
|
+
native: (0, vue.computed)(() => props.nativeLabel)
|
|
1923
2054
|
});
|
|
1924
|
-
function handleInteraction(event) {
|
|
1925
|
-
if (event.target?.closest("button,input,select,textarea")) return;
|
|
1926
|
-
if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
|
|
1927
|
-
if (props.nativeLabel || !controlId.value) return;
|
|
1928
|
-
const controlElement = document.getElementById(controlId.value);
|
|
1929
|
-
if (controlElement) controlElement.focus();
|
|
1930
|
-
}
|
|
1931
2055
|
const { tag, mergedProps, renderless } = require_button_Button.useRenderElement({
|
|
1932
2056
|
componentProps: props,
|
|
1933
2057
|
state: fieldRootContext.state,
|
|
1934
|
-
props: (0, vue.computed)(() => {
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
onMousedown: handleInteraction
|
|
1940
|
-
};
|
|
1941
|
-
return {
|
|
1942
|
-
...attrs,
|
|
1943
|
-
id: labelId.value,
|
|
1944
|
-
onClick: handleInteraction,
|
|
1945
|
-
onPointerdown: (event) => {
|
|
1946
|
-
event.preventDefault();
|
|
1947
|
-
}
|
|
1948
|
-
};
|
|
1949
|
-
}),
|
|
1950
|
-
stateAttributesMapping: require_control_FieldControl.fieldValidityMapping,
|
|
2058
|
+
props: (0, vue.computed)(() => ({
|
|
2059
|
+
...attrs,
|
|
2060
|
+
...label.props.value
|
|
2061
|
+
})),
|
|
2062
|
+
stateAttributesMapping: require_checkbox_group_CheckboxGroup.fieldValidityMapping,
|
|
1951
2063
|
defaultTagName: "label"
|
|
1952
2064
|
});
|
|
1953
2065
|
return (_ctx, _cache) => {
|
|
@@ -2024,7 +2136,7 @@ function useFieldRootState(params) {
|
|
|
2024
2136
|
|
|
2025
2137
|
//#endregion
|
|
2026
2138
|
//#region src/field/root/useFieldValidation.ts
|
|
2027
|
-
const validityKeys = Object.keys(
|
|
2139
|
+
const validityKeys = Object.keys(require_checkbox_group_CheckboxGroup.DEFAULT_VALIDITY_STATE);
|
|
2028
2140
|
function isOnlyValueMissing(state) {
|
|
2029
2141
|
if (!state || state.valid || !state.valueMissing) return false;
|
|
2030
2142
|
for (const key of validityKeys) {
|
|
@@ -2034,7 +2146,7 @@ function isOnlyValueMissing(state) {
|
|
|
2034
2146
|
return true;
|
|
2035
2147
|
}
|
|
2036
2148
|
function useFieldValidation(params) {
|
|
2037
|
-
const { formRef, clearErrors } =
|
|
2149
|
+
const { formRef, clearErrors } = require_checkbox_group_CheckboxGroup.useFormContext();
|
|
2038
2150
|
const { controlId, getDescriptionProps, setValidityData, validate, validityData, validationDebounceTime, invalid, markedDirtyRef, state, name, shouldValidateOnChange } = params;
|
|
2039
2151
|
const timeout = require_fallback_AvatarFallback.useTimeout();
|
|
2040
2152
|
const inputRef = (0, vue.shallowRef)(null);
|
|
@@ -2051,7 +2163,7 @@ function useFieldValidation(params) {
|
|
|
2051
2163
|
const nextValidityData = {
|
|
2052
2164
|
value,
|
|
2053
2165
|
state: {
|
|
2054
|
-
...
|
|
2166
|
+
...require_checkbox_group_CheckboxGroup.DEFAULT_VALIDITY_STATE,
|
|
2055
2167
|
valid: true
|
|
2056
2168
|
},
|
|
2057
2169
|
error: "",
|
|
@@ -2064,7 +2176,7 @@ function useFieldValidation(params) {
|
|
|
2064
2176
|
const currentFieldData = formRef.value.fields.get(cId);
|
|
2065
2177
|
if (currentFieldData) formRef.value.fields.set(cId, {
|
|
2066
2178
|
...currentFieldData,
|
|
2067
|
-
validityData:
|
|
2179
|
+
validityData: require_checkbox_group_CheckboxGroup.getCombinedFieldValidityData(nextValidityData, false)
|
|
2068
2180
|
});
|
|
2069
2181
|
}
|
|
2070
2182
|
setValidityData(nextValidityData);
|
|
@@ -2140,7 +2252,7 @@ function useFieldValidation(params) {
|
|
|
2140
2252
|
const currentFieldData = formRef.value.fields.get(cId);
|
|
2141
2253
|
if (currentFieldData) formRef.value.fields.set(cId, {
|
|
2142
2254
|
...currentFieldData,
|
|
2143
|
-
validityData:
|
|
2255
|
+
validityData: require_checkbox_group_CheckboxGroup.getCombinedFieldValidityData(nextValidityData, invalid.value)
|
|
2144
2256
|
});
|
|
2145
2257
|
}
|
|
2146
2258
|
setValidityData(nextValidityData);
|
|
@@ -2190,7 +2302,7 @@ function useFieldValidation(params) {
|
|
|
2190
2302
|
function useFieldValidity(params) {
|
|
2191
2303
|
const { invalid } = params;
|
|
2192
2304
|
const validityData = (0, vue.ref)({
|
|
2193
|
-
state: { ...
|
|
2305
|
+
state: { ...require_checkbox_group_CheckboxGroup.DEFAULT_VALIDITY_STATE },
|
|
2194
2306
|
error: "",
|
|
2195
2307
|
errors: [],
|
|
2196
2308
|
value: null,
|
|
@@ -2276,7 +2388,7 @@ var FieldRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
2276
2388
|
setup(__props, { expose: __expose }) {
|
|
2277
2389
|
const props = __props;
|
|
2278
2390
|
const attrs = (0, vue.useAttrs)();
|
|
2279
|
-
const { validationMode: formValidationMode, submitAttempted } =
|
|
2391
|
+
const { validationMode: formValidationMode, submitAttempted } = require_checkbox_group_CheckboxGroup.useFormContext();
|
|
2280
2392
|
const fieldsetContext = useFieldsetRootContext(true);
|
|
2281
2393
|
const disabledFieldset = (0, vue.computed)(() => fieldsetContext?.disabled.value ?? false);
|
|
2282
2394
|
const disabled = (0, vue.computed)(() => disabledFieldset.value || props.disabled);
|
|
@@ -2284,12 +2396,19 @@ var FieldRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
2284
2396
|
const validationModeRef = (0, vue.computed)(() => props.validationMode ?? formValidationMode.value);
|
|
2285
2397
|
const validationDebounceTimeRef = (0, vue.computed)(() => props.validationDebounceTime);
|
|
2286
2398
|
const validateFn = (0, vue.computed)(() => props.validate ?? (() => null));
|
|
2287
|
-
const parentLabelable =
|
|
2399
|
+
const parentLabelable = require_checkbox_group_CheckboxGroup.useLabelableContext();
|
|
2288
2400
|
const controlId = (0, vue.ref)(void 0);
|
|
2289
2401
|
const labelId = (0, vue.ref)(void 0);
|
|
2290
2402
|
const messageIds = (0, vue.ref)([]);
|
|
2291
|
-
|
|
2292
|
-
|
|
2403
|
+
const controlIdRegistrations = /* @__PURE__ */ new Map();
|
|
2404
|
+
function registerControlId(source, id) {
|
|
2405
|
+
if (id === void 0) controlIdRegistrations.delete(source);
|
|
2406
|
+
else controlIdRegistrations.set(source, id);
|
|
2407
|
+
if (controlIdRegistrations.size === 0) {
|
|
2408
|
+
controlId.value = void 0;
|
|
2409
|
+
return;
|
|
2410
|
+
}
|
|
2411
|
+
controlId.value = controlIdRegistrations.values().next().value;
|
|
2293
2412
|
}
|
|
2294
2413
|
function setLabelId(id) {
|
|
2295
2414
|
labelId.value = id;
|
|
@@ -2301,16 +2420,16 @@ var FieldRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
2301
2420
|
const describedBy = parentLabelable.messageIds.value.concat(messageIds.value).join(" ") || void 0;
|
|
2302
2421
|
return { "aria-describedby": describedBy };
|
|
2303
2422
|
}
|
|
2304
|
-
(0, vue.provide)(
|
|
2423
|
+
(0, vue.provide)(require_checkbox_group_CheckboxGroup.labelableContextKey, {
|
|
2305
2424
|
controlId,
|
|
2306
|
-
|
|
2425
|
+
registerControlId,
|
|
2307
2426
|
labelId,
|
|
2308
2427
|
setLabelId,
|
|
2309
2428
|
messageIds,
|
|
2310
2429
|
setMessageIds,
|
|
2311
2430
|
getDescriptionProps
|
|
2312
2431
|
});
|
|
2313
|
-
const { errors: formErrors } =
|
|
2432
|
+
const { errors: formErrors } = require_checkbox_group_CheckboxGroup.useFormContext();
|
|
2314
2433
|
const hasFormError = (0, vue.computed)(() => {
|
|
2315
2434
|
const n = props.name;
|
|
2316
2435
|
return !!n && Object.hasOwn(formErrors.value, n) && formErrors.value[n] !== void 0;
|
|
@@ -2342,7 +2461,7 @@ var FieldRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
2342
2461
|
name: nameRef,
|
|
2343
2462
|
shouldValidateOnChange: () => shouldValidateOnChange.value
|
|
2344
2463
|
});
|
|
2345
|
-
(0, vue.provide)(
|
|
2464
|
+
(0, vue.provide)(require_checkbox_group_CheckboxGroup.fieldRootContextKey, {
|
|
2346
2465
|
invalid,
|
|
2347
2466
|
name: nameRef,
|
|
2348
2467
|
validityData: (0, vue.shallowReadonly)(validityData),
|
|
@@ -2374,7 +2493,7 @@ var FieldRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
2374
2493
|
componentProps: props,
|
|
2375
2494
|
state,
|
|
2376
2495
|
props: (0, vue.computed)(() => ({ ...attrs })),
|
|
2377
|
-
stateAttributesMapping:
|
|
2496
|
+
stateAttributesMapping: require_checkbox_group_CheckboxGroup.fieldValidityMapping,
|
|
2378
2497
|
defaultTagName: "div"
|
|
2379
2498
|
});
|
|
2380
2499
|
return (_ctx, _cache) => {
|
|
@@ -2400,9 +2519,9 @@ var FieldValidity_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
2400
2519
|
name: "FieldValidity",
|
|
2401
2520
|
__name: "FieldValidity",
|
|
2402
2521
|
setup(__props) {
|
|
2403
|
-
const { validityData, invalid } =
|
|
2404
|
-
const combinedFieldValidityData = (0, vue.computed)(() =>
|
|
2405
|
-
const { transitionStatus } =
|
|
2522
|
+
const { validityData, invalid } = require_checkbox_group_CheckboxGroup.useFieldRootContext(false);
|
|
2523
|
+
const combinedFieldValidityData = (0, vue.computed)(() => require_checkbox_group_CheckboxGroup.getCombinedFieldValidityData(validityData.value, invalid.value));
|
|
2524
|
+
const { transitionStatus } = require_checkbox_index.useTransitionStatus((0, vue.computed)(() => combinedFieldValidityData.value.state.valid === false));
|
|
2406
2525
|
const fieldValidityState = (0, vue.computed)(() => ({
|
|
2407
2526
|
...combinedFieldValidityData.value,
|
|
2408
2527
|
validity: combinedFieldValidityData.value.state,
|
|
@@ -2462,7 +2581,7 @@ var FieldsetLegend_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
2462
2581
|
const props = __props;
|
|
2463
2582
|
const attrs = (0, vue.useAttrs)();
|
|
2464
2583
|
const { disabled, legendId, setLegendId } = useFieldsetRootContext();
|
|
2465
|
-
const id =
|
|
2584
|
+
const id = require_checkbox_group_CheckboxGroup.useBaseUiId(props.id);
|
|
2466
2585
|
setLegendId(id);
|
|
2467
2586
|
(0, vue.onBeforeUnmount)(() => {
|
|
2468
2587
|
if (legendId.value === id) setLegendId(void 0);
|
|
@@ -2576,61 +2695,3037 @@ var FieldsetRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (
|
|
|
2576
2695
|
var FieldsetRoot_default = FieldsetRoot_vue_vue_type_script_setup_true_lang_default;
|
|
2577
2696
|
|
|
2578
2697
|
//#endregion
|
|
2579
|
-
//#region src/
|
|
2698
|
+
//#region src/separator/Separator.vue?vue&type=script&setup=true&lang.ts
|
|
2580
2699
|
/**
|
|
2581
|
-
*
|
|
2582
|
-
*
|
|
2583
|
-
* The public composable that collects `attrs` internally via `useAttrs()`,
|
|
2584
|
-
* merges them with explicit props, and delegates to `useRenderElement`.
|
|
2585
|
-
* Returns a readonly state and supports renderless mode via the `Slot` sentinel.
|
|
2700
|
+
* A separator element accessible to screen readers.
|
|
2701
|
+
* Renders a `<div>` element.
|
|
2586
2702
|
*
|
|
2587
|
-
*
|
|
2703
|
+
* Documentation: [Base UI Vue Separator](https://baseui-vue.com/docs/components/separator)
|
|
2588
2704
|
*/
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2705
|
+
var Separator_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2706
|
+
name: "Separator",
|
|
2707
|
+
inheritAttrs: false,
|
|
2708
|
+
__name: "Separator",
|
|
2709
|
+
props: {
|
|
2710
|
+
orientation: {
|
|
2711
|
+
type: String,
|
|
2712
|
+
required: false,
|
|
2713
|
+
default: "horizontal"
|
|
2714
|
+
},
|
|
2715
|
+
as: {
|
|
2716
|
+
type: null,
|
|
2717
|
+
required: false,
|
|
2718
|
+
default: "div"
|
|
2719
|
+
},
|
|
2720
|
+
class: {
|
|
2721
|
+
type: Function,
|
|
2722
|
+
required: false,
|
|
2723
|
+
skipCheck: true
|
|
2724
|
+
},
|
|
2725
|
+
style: {
|
|
2726
|
+
type: [
|
|
2727
|
+
Boolean,
|
|
2728
|
+
null,
|
|
2729
|
+
String,
|
|
2730
|
+
Object,
|
|
2731
|
+
Array,
|
|
2732
|
+
Function
|
|
2733
|
+
],
|
|
2734
|
+
required: false,
|
|
2735
|
+
skipCheck: true
|
|
2736
|
+
}
|
|
2737
|
+
},
|
|
2738
|
+
setup(__props) {
|
|
2739
|
+
const props = __props;
|
|
2740
|
+
const attrs = (0, vue.useAttrs)();
|
|
2741
|
+
const state = (0, vue.computed)(() => ({ orientation: props.orientation }));
|
|
2742
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
2743
|
+
componentProps: props,
|
|
2744
|
+
state,
|
|
2745
|
+
props: (0, vue.computed)(() => ({
|
|
2746
|
+
...attrs,
|
|
2747
|
+
"role": "separator",
|
|
2748
|
+
"aria-orientation": props.orientation
|
|
2749
|
+
})),
|
|
2750
|
+
defaultTagName: "div"
|
|
2751
|
+
});
|
|
2752
|
+
return (_ctx, _cache) => {
|
|
2753
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
2754
|
+
key: 0,
|
|
2755
|
+
ref: (0, vue.unref)(renderRef),
|
|
2756
|
+
props: (0, vue.unref)(mergedProps),
|
|
2757
|
+
state: state.value
|
|
2758
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
2759
|
+
key: 1,
|
|
2760
|
+
ref: (0, vue.unref)(renderRef)
|
|
2761
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
2762
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
2763
|
+
_: 3
|
|
2764
|
+
}, 16));
|
|
2765
|
+
};
|
|
2766
|
+
}
|
|
2767
|
+
});
|
|
2610
2768
|
|
|
2611
2769
|
//#endregion
|
|
2612
|
-
//#region src/
|
|
2613
|
-
|
|
2614
|
-
const version = "0.0.0";
|
|
2770
|
+
//#region src/separator/Separator.vue
|
|
2771
|
+
var Separator_default = Separator_vue_vue_type_script_setup_true_lang_default;
|
|
2615
2772
|
|
|
2616
2773
|
//#endregion
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2774
|
+
//#region src/separator/SeparatorDataAttributes.ts
|
|
2775
|
+
let SeparatorDataAttributes = /* @__PURE__ */ function(SeparatorDataAttributes) {
|
|
2776
|
+
/**
|
|
2777
|
+
* Indicates the orientation of the separator.
|
|
2778
|
+
* @type {'horizontal' | 'vertical'}
|
|
2779
|
+
*/
|
|
2780
|
+
SeparatorDataAttributes["orientation"] = "data-orientation";
|
|
2781
|
+
return SeparatorDataAttributes;
|
|
2782
|
+
}({});
|
|
2783
|
+
|
|
2784
|
+
//#endregion
|
|
2785
|
+
//#region src/utils/valueToPercent.ts
|
|
2786
|
+
function valueToPercent(value, min, max) {
|
|
2787
|
+
if (max === min) return 0;
|
|
2788
|
+
return (value - min) * 100 / (max - min);
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
//#endregion
|
|
2792
|
+
//#region src/slider/indicator/SliderIndicator.vue?vue&type=script&setup=true&lang.ts
|
|
2793
|
+
/**
|
|
2794
|
+
* Visualizes the current value of the slider.
|
|
2795
|
+
* Renders a `<div>` element.
|
|
2796
|
+
*
|
|
2797
|
+
* Documentation: [Base UI Vue Slider](https://baseui-vue.com/docs/components/slider)
|
|
2798
|
+
*/
|
|
2799
|
+
var SliderIndicator_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2800
|
+
name: "SliderIndicator",
|
|
2801
|
+
inheritAttrs: false,
|
|
2802
|
+
__name: "SliderIndicator",
|
|
2803
|
+
props: {
|
|
2804
|
+
as: {
|
|
2805
|
+
type: null,
|
|
2806
|
+
required: false,
|
|
2807
|
+
default: "div"
|
|
2808
|
+
},
|
|
2809
|
+
class: {
|
|
2810
|
+
type: Function,
|
|
2811
|
+
required: false,
|
|
2812
|
+
skipCheck: true
|
|
2813
|
+
},
|
|
2814
|
+
style: {
|
|
2815
|
+
type: [
|
|
2816
|
+
Boolean,
|
|
2817
|
+
null,
|
|
2818
|
+
String,
|
|
2819
|
+
Object,
|
|
2820
|
+
Array,
|
|
2821
|
+
Function
|
|
2822
|
+
],
|
|
2823
|
+
required: false,
|
|
2824
|
+
skipCheck: true
|
|
2825
|
+
}
|
|
2826
|
+
},
|
|
2827
|
+
setup(__props) {
|
|
2828
|
+
const props = __props;
|
|
2829
|
+
function getInsetStyles(vertical, range, start, end, renderBeforeHydration, mounted) {
|
|
2830
|
+
const visibility = start === void 0 || range && end === void 0 ? "hidden" : void 0;
|
|
2831
|
+
const startEdge = vertical ? "bottom" : "insetInlineStart";
|
|
2832
|
+
const mainSide = vertical ? "height" : "width";
|
|
2833
|
+
const styles = {
|
|
2834
|
+
visibility: renderBeforeHydration && !mounted ? "hidden" : visibility,
|
|
2835
|
+
position: vertical ? "absolute" : "relative",
|
|
2836
|
+
[vertical ? "width" : "height"]: "inherit"
|
|
2837
|
+
};
|
|
2838
|
+
styles["--start-position"] = `${start ?? 0}%`;
|
|
2839
|
+
if (!range) {
|
|
2840
|
+
styles[startEdge] = 0;
|
|
2841
|
+
styles[mainSide] = "var(--start-position)";
|
|
2842
|
+
return styles;
|
|
2843
|
+
}
|
|
2844
|
+
styles["--relative-size"] = `${(end ?? 0) - (start ?? 0)}%`;
|
|
2845
|
+
styles[startEdge] = "var(--start-position)";
|
|
2846
|
+
styles[mainSide] = "var(--relative-size)";
|
|
2847
|
+
return styles;
|
|
2848
|
+
}
|
|
2849
|
+
function getCenteredStyles(vertical, range, start, end) {
|
|
2850
|
+
const startEdge = vertical ? "bottom" : "insetInlineStart";
|
|
2851
|
+
const mainSide = vertical ? "height" : "width";
|
|
2852
|
+
const styles = {
|
|
2853
|
+
position: vertical ? "absolute" : "relative",
|
|
2854
|
+
[vertical ? "width" : "height"]: "inherit"
|
|
2855
|
+
};
|
|
2856
|
+
if (!range) {
|
|
2857
|
+
styles[startEdge] = 0;
|
|
2858
|
+
styles[mainSide] = `${start}%`;
|
|
2859
|
+
return styles;
|
|
2860
|
+
}
|
|
2861
|
+
styles[startEdge] = `${start}%`;
|
|
2862
|
+
styles[mainSide] = `${end - start}%`;
|
|
2863
|
+
return styles;
|
|
2864
|
+
}
|
|
2865
|
+
const attrs = (0, vue.useAttrs)();
|
|
2866
|
+
const rootContext = require_control_SliderControl.useSliderRootContext();
|
|
2867
|
+
const isMounted = (0, vue.ref)(false);
|
|
2868
|
+
(0, vue.onMounted)(() => {
|
|
2869
|
+
isMounted.value = true;
|
|
2870
|
+
});
|
|
2871
|
+
const vertical = (0, vue.computed)(() => rootContext.orientation.value === "vertical");
|
|
2872
|
+
const range = (0, vue.computed)(() => rootContext.values.value.length > 1);
|
|
2873
|
+
const style = (0, vue.computed)(() => rootContext.inset.value ? getInsetStyles(vertical.value, range.value, rootContext.indicatorPosition.value[0], rootContext.indicatorPosition.value[1], rootContext.renderBeforeHydration.value, isMounted.value) : getCenteredStyles(vertical.value, range.value, valueToPercent(rootContext.values.value[0], rootContext.min.value, rootContext.max.value), valueToPercent(rootContext.values.value[rootContext.values.value.length - 1], rootContext.min.value, rootContext.max.value)));
|
|
2874
|
+
const indicatorProps = (0, vue.computed)(() => require_button_Button.mergeProps(attrs, {
|
|
2875
|
+
"data-base-ui-slider-indicator": rootContext.renderBeforeHydration.value ? "" : void 0,
|
|
2876
|
+
"style": style.value,
|
|
2877
|
+
"suppressHydrationWarning": rootContext.renderBeforeHydration.value || void 0
|
|
2878
|
+
}));
|
|
2879
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
2880
|
+
componentProps: props,
|
|
2881
|
+
state: rootContext.state,
|
|
2882
|
+
props: indicatorProps,
|
|
2883
|
+
defaultTagName: "div",
|
|
2884
|
+
stateAttributesMapping: require_control_SliderControl.sliderStateAttributesMapping
|
|
2885
|
+
});
|
|
2886
|
+
return (_ctx, _cache) => {
|
|
2887
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
2888
|
+
key: 0,
|
|
2889
|
+
ref: (0, vue.unref)(renderRef),
|
|
2890
|
+
props: (0, vue.unref)(mergedProps),
|
|
2891
|
+
state: (0, vue.unref)(rootContext).state
|
|
2892
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
2893
|
+
key: 1,
|
|
2894
|
+
ref: (0, vue.unref)(renderRef)
|
|
2895
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
2896
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
2897
|
+
_: 3
|
|
2898
|
+
}, 16));
|
|
2899
|
+
};
|
|
2900
|
+
}
|
|
2901
|
+
});
|
|
2902
|
+
|
|
2903
|
+
//#endregion
|
|
2904
|
+
//#region src/slider/indicator/SliderIndicator.vue
|
|
2905
|
+
var SliderIndicator_default = SliderIndicator_vue_vue_type_script_setup_true_lang_default;
|
|
2906
|
+
|
|
2907
|
+
//#endregion
|
|
2908
|
+
//#region src/slider/indicator/SliderIndicatorDataAttributes.ts
|
|
2909
|
+
let SliderIndicatorDataAttributes = /* @__PURE__ */ function(SliderIndicatorDataAttributes) {
|
|
2910
|
+
/**
|
|
2911
|
+
* Present while the user is dragging.
|
|
2912
|
+
*/
|
|
2913
|
+
SliderIndicatorDataAttributes["dragging"] = "data-dragging";
|
|
2914
|
+
/**
|
|
2915
|
+
* Indicates the orientation of the slider.
|
|
2916
|
+
* @type {'horizontal' | 'vertical'}
|
|
2917
|
+
*/
|
|
2918
|
+
SliderIndicatorDataAttributes["orientation"] = "data-orientation";
|
|
2919
|
+
/**
|
|
2920
|
+
* Present when the slider is disabled.
|
|
2921
|
+
*/
|
|
2922
|
+
SliderIndicatorDataAttributes["disabled"] = "data-disabled";
|
|
2923
|
+
/**
|
|
2924
|
+
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
2925
|
+
*/
|
|
2926
|
+
SliderIndicatorDataAttributes["valid"] = "data-valid";
|
|
2927
|
+
/**
|
|
2928
|
+
* Present when the slider is in invalid state (when wrapped in Field.Root).
|
|
2929
|
+
*/
|
|
2930
|
+
SliderIndicatorDataAttributes["invalid"] = "data-invalid";
|
|
2931
|
+
/**
|
|
2932
|
+
* Present when the slider has been touched (when wrapped in Field.Root).
|
|
2933
|
+
*/
|
|
2934
|
+
SliderIndicatorDataAttributes["touched"] = "data-touched";
|
|
2935
|
+
/**
|
|
2936
|
+
* Present when the slider's value has changed (when wrapped in Field.Root).
|
|
2937
|
+
*/
|
|
2938
|
+
SliderIndicatorDataAttributes["dirty"] = "data-dirty";
|
|
2939
|
+
/**
|
|
2940
|
+
* Present when the slider is focused (when wrapped in Field.Root).
|
|
2941
|
+
*/
|
|
2942
|
+
SliderIndicatorDataAttributes["focused"] = "data-focused";
|
|
2943
|
+
return SliderIndicatorDataAttributes;
|
|
2944
|
+
}({});
|
|
2945
|
+
|
|
2946
|
+
//#endregion
|
|
2947
|
+
//#region src/slider/label/SliderLabel.vue?vue&type=script&setup=true&lang.ts
|
|
2948
|
+
/**
|
|
2949
|
+
* An accessible label that is automatically associated with the slider thumbs.
|
|
2950
|
+
* Renders a `<div>` element.
|
|
2951
|
+
*
|
|
2952
|
+
* Documentation: [Base UI Vue Slider](https://baseui-vue.com/docs/components/slider)
|
|
2953
|
+
*/
|
|
2954
|
+
var SliderLabel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2955
|
+
name: "SliderLabel",
|
|
2956
|
+
inheritAttrs: false,
|
|
2957
|
+
__name: "SliderLabel",
|
|
2958
|
+
props: {
|
|
2959
|
+
as: {
|
|
2960
|
+
type: null,
|
|
2961
|
+
required: false,
|
|
2962
|
+
default: "div"
|
|
2963
|
+
},
|
|
2964
|
+
class: {
|
|
2965
|
+
type: Function,
|
|
2966
|
+
required: false,
|
|
2967
|
+
skipCheck: true
|
|
2968
|
+
},
|
|
2969
|
+
style: {
|
|
2970
|
+
type: [
|
|
2971
|
+
Boolean,
|
|
2972
|
+
null,
|
|
2973
|
+
String,
|
|
2974
|
+
Object,
|
|
2975
|
+
Array,
|
|
2976
|
+
Function
|
|
2977
|
+
],
|
|
2978
|
+
required: false,
|
|
2979
|
+
skipCheck: true
|
|
2980
|
+
}
|
|
2981
|
+
},
|
|
2982
|
+
setup(__props) {
|
|
2983
|
+
const props = __props;
|
|
2984
|
+
const attrs = (0, vue.useAttrs)();
|
|
2985
|
+
const rootContext = require_control_SliderControl.useSliderRootContext();
|
|
2986
|
+
const label = useLabel({
|
|
2987
|
+
id: (0, vue.computed)(() => rootContext.rootLabelId.value),
|
|
2988
|
+
fallbackControlId: (0, vue.computed)(() => rootContext.controlRef.value?.id),
|
|
2989
|
+
setLabelId: rootContext.setLabelId,
|
|
2990
|
+
focusControl(_event, controlId) {
|
|
2991
|
+
if (controlId) {
|
|
2992
|
+
const controlElement = rootContext.controlRef.value ? require_control_SliderControl.ownerDocument(rootContext.controlRef.value)?.getElementById(controlId) : null;
|
|
2993
|
+
if ((0, _floating_ui_utils_dom.isHTMLElement)(controlElement)) {
|
|
2994
|
+
focusElementWithVisible(controlElement);
|
|
2995
|
+
return;
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
const fallbackInputs = rootContext.controlRef.value?.querySelectorAll("input[type=\"range\"]");
|
|
2999
|
+
const fallbackInput = fallbackInputs?.length === 1 ? fallbackInputs[0] : null;
|
|
3000
|
+
if ((0, _floating_ui_utils_dom.isHTMLElement)(fallbackInput)) focusElementWithVisible(fallbackInput);
|
|
3001
|
+
}
|
|
3002
|
+
});
|
|
3003
|
+
const labelProps = (0, vue.computed)(() => require_button_Button.mergeProps(attrs, label.props.value));
|
|
3004
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
3005
|
+
componentProps: props,
|
|
3006
|
+
state: rootContext.state,
|
|
3007
|
+
props: labelProps,
|
|
3008
|
+
defaultTagName: "div",
|
|
3009
|
+
stateAttributesMapping: require_control_SliderControl.sliderStateAttributesMapping
|
|
3010
|
+
});
|
|
3011
|
+
return (_ctx, _cache) => {
|
|
3012
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
3013
|
+
key: 0,
|
|
3014
|
+
ref: (0, vue.unref)(renderRef),
|
|
3015
|
+
props: (0, vue.unref)(mergedProps),
|
|
3016
|
+
state: (0, vue.unref)(rootContext).state
|
|
3017
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
3018
|
+
key: 1,
|
|
3019
|
+
ref: (0, vue.unref)(renderRef)
|
|
3020
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
3021
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
3022
|
+
_: 3
|
|
3023
|
+
}, 16));
|
|
3024
|
+
};
|
|
3025
|
+
}
|
|
3026
|
+
});
|
|
3027
|
+
|
|
3028
|
+
//#endregion
|
|
3029
|
+
//#region src/slider/label/SliderLabel.vue
|
|
3030
|
+
var SliderLabel_default = SliderLabel_vue_vue_type_script_setup_true_lang_default;
|
|
3031
|
+
|
|
3032
|
+
//#endregion
|
|
3033
|
+
//#region src/utils/areArraysEqual.ts
|
|
3034
|
+
function areArraysEqual(array1, array2, itemComparer = (a, b) => a === b) {
|
|
3035
|
+
return array1.length === array2.length && array1.every((value, index) => itemComparer(value, array2[index]));
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
//#endregion
|
|
3039
|
+
//#region src/utils/resolveAriaLabelledBy.ts
|
|
3040
|
+
function getDefaultLabelId(id) {
|
|
3041
|
+
return id == null ? void 0 : `${id}-label`;
|
|
3042
|
+
}
|
|
3043
|
+
function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
|
|
3044
|
+
return fieldLabelId ?? localLabelId;
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
//#endregion
|
|
3048
|
+
//#region src/slider/utils/asc.ts
|
|
3049
|
+
function asc(a, b) {
|
|
3050
|
+
return a - b;
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
//#endregion
|
|
3054
|
+
//#region src/slider/utils/replaceArrayItemAtIndex.ts
|
|
3055
|
+
function replaceArrayItemAtIndex(array, index, newValue) {
|
|
3056
|
+
if (!Number.isInteger(index) || index < 0 || index >= array.length) throw new RangeError(`replaceArrayItemAtIndex index out of bounds: ${index}`);
|
|
3057
|
+
const output = array.slice();
|
|
3058
|
+
output[index] = newValue;
|
|
3059
|
+
return output.sort(asc);
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
//#endregion
|
|
3063
|
+
//#region src/slider/utils/getSliderValue.ts
|
|
3064
|
+
function getSliderValue(valueInput, index, min, max, range, values) {
|
|
3065
|
+
let newValue = valueInput;
|
|
3066
|
+
newValue = require_control_SliderControl.clamp(newValue, min, max);
|
|
3067
|
+
if (range) newValue = replaceArrayItemAtIndex(values, index, require_control_SliderControl.clamp(newValue, values[index - 1] ?? -Infinity, values[index + 1] ?? Infinity));
|
|
3068
|
+
return newValue;
|
|
3069
|
+
}
|
|
3070
|
+
|
|
3071
|
+
//#endregion
|
|
3072
|
+
//#region src/slider/root/SliderRoot.vue?vue&type=script&setup=true&lang.ts
|
|
3073
|
+
/**
|
|
3074
|
+
* Groups all parts of the slider.
|
|
3075
|
+
* Renders a `<div>` element.
|
|
3076
|
+
*
|
|
3077
|
+
* Documentation: [Base UI Vue Slider](https://baseui-vue.com/docs/components/slider)
|
|
3078
|
+
*/
|
|
3079
|
+
var SliderRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3080
|
+
name: "SliderRoot",
|
|
3081
|
+
inheritAttrs: false,
|
|
3082
|
+
__name: "SliderRoot",
|
|
3083
|
+
props: {
|
|
3084
|
+
defaultValue: {
|
|
3085
|
+
type: null,
|
|
3086
|
+
required: false
|
|
3087
|
+
},
|
|
3088
|
+
disabled: {
|
|
3089
|
+
type: Boolean,
|
|
3090
|
+
required: false,
|
|
3091
|
+
default: false
|
|
3092
|
+
},
|
|
3093
|
+
format: {
|
|
3094
|
+
type: null,
|
|
3095
|
+
required: false
|
|
3096
|
+
},
|
|
3097
|
+
locale: {
|
|
3098
|
+
type: null,
|
|
3099
|
+
required: false
|
|
3100
|
+
},
|
|
3101
|
+
max: {
|
|
3102
|
+
type: Number,
|
|
3103
|
+
required: false,
|
|
3104
|
+
default: 100
|
|
3105
|
+
},
|
|
3106
|
+
min: {
|
|
3107
|
+
type: Number,
|
|
3108
|
+
required: false,
|
|
3109
|
+
default: 0
|
|
3110
|
+
},
|
|
3111
|
+
minStepsBetweenValues: {
|
|
3112
|
+
type: Number,
|
|
3113
|
+
required: false,
|
|
3114
|
+
default: 0
|
|
3115
|
+
},
|
|
3116
|
+
name: {
|
|
3117
|
+
type: String,
|
|
3118
|
+
required: false
|
|
3119
|
+
},
|
|
3120
|
+
form: {
|
|
3121
|
+
type: String,
|
|
3122
|
+
required: false
|
|
3123
|
+
},
|
|
3124
|
+
orientation: {
|
|
3125
|
+
type: String,
|
|
3126
|
+
required: false,
|
|
3127
|
+
default: "horizontal"
|
|
3128
|
+
},
|
|
3129
|
+
step: {
|
|
3130
|
+
type: Number,
|
|
3131
|
+
required: false,
|
|
3132
|
+
default: 1
|
|
3133
|
+
},
|
|
3134
|
+
largeStep: {
|
|
3135
|
+
type: Number,
|
|
3136
|
+
required: false,
|
|
3137
|
+
default: 10
|
|
3138
|
+
},
|
|
3139
|
+
thumbAlignment: {
|
|
3140
|
+
type: String,
|
|
3141
|
+
required: false,
|
|
3142
|
+
default: "center"
|
|
3143
|
+
},
|
|
3144
|
+
thumbCollisionBehavior: {
|
|
3145
|
+
type: String,
|
|
3146
|
+
required: false,
|
|
3147
|
+
default: "push"
|
|
3148
|
+
},
|
|
3149
|
+
value: {
|
|
3150
|
+
type: null,
|
|
3151
|
+
required: false
|
|
3152
|
+
},
|
|
3153
|
+
id: {
|
|
3154
|
+
type: String,
|
|
3155
|
+
required: false
|
|
3156
|
+
},
|
|
3157
|
+
ariaLabelledby: {
|
|
3158
|
+
type: String,
|
|
3159
|
+
required: false
|
|
3160
|
+
},
|
|
3161
|
+
as: {
|
|
3162
|
+
type: null,
|
|
3163
|
+
required: false,
|
|
3164
|
+
default: "div"
|
|
3165
|
+
},
|
|
3166
|
+
class: {
|
|
3167
|
+
type: Function,
|
|
3168
|
+
required: false,
|
|
3169
|
+
skipCheck: true
|
|
3170
|
+
},
|
|
3171
|
+
style: {
|
|
3172
|
+
type: [
|
|
3173
|
+
Boolean,
|
|
3174
|
+
null,
|
|
3175
|
+
String,
|
|
3176
|
+
Object,
|
|
3177
|
+
Array,
|
|
3178
|
+
Function
|
|
3179
|
+
],
|
|
3180
|
+
required: false,
|
|
3181
|
+
skipCheck: true
|
|
3182
|
+
}
|
|
3183
|
+
},
|
|
3184
|
+
emits: ["valueChange", "valueCommitted"],
|
|
3185
|
+
setup(__props, { emit: __emit }) {
|
|
3186
|
+
const props = __props;
|
|
3187
|
+
const emit = __emit;
|
|
3188
|
+
const attrs = (0, vue.useAttrs)();
|
|
3189
|
+
const attrsObject = attrs;
|
|
3190
|
+
const explicitAriaLabelledBy = (0, vue.computed)(() => props.ariaLabelledby ?? attrs["aria-labelledby"]);
|
|
3191
|
+
const id = require_checkbox_group_CheckboxGroup.useBaseUiId(props.id);
|
|
3192
|
+
const idRef = (0, vue.computed)(() => id);
|
|
3193
|
+
const defaultLabelId = (0, vue.computed)(() => getDefaultLabelId(id));
|
|
3194
|
+
const { clearErrors } = require_checkbox_group_CheckboxGroup.useFormContext();
|
|
3195
|
+
const { state: fieldState, disabled: fieldDisabled, name: fieldName, setTouched, setDirty, validation, validityData, shouldValidateOnChange } = require_checkbox_group_CheckboxGroup.useFieldRootContext();
|
|
3196
|
+
const { labelId: fieldLabelId } = require_checkbox_group_CheckboxGroup.useLabelableContext();
|
|
3197
|
+
const localLabelId = (0, vue.ref)(void 0);
|
|
3198
|
+
const ariaLabelledBy = (0, vue.computed)(() => explicitAriaLabelledBy.value ?? resolveAriaLabelledBy(fieldLabelId.value, localLabelId.value));
|
|
3199
|
+
const disabled = (0, vue.computed)(() => fieldDisabled.value || props.disabled);
|
|
3200
|
+
const name = (0, vue.computed)(() => fieldName.value ?? props.name);
|
|
3201
|
+
const controllableValue = require_checkbox_group_CheckboxGroup.useControllableState({
|
|
3202
|
+
controlled: () => props.value,
|
|
3203
|
+
default: () => props.defaultValue ?? props.min,
|
|
3204
|
+
name: "Slider",
|
|
3205
|
+
state: "value"
|
|
3206
|
+
});
|
|
3207
|
+
const valueUnwrapped = controllableValue.value;
|
|
3208
|
+
const setValueUnwrapped = controllableValue.setValue;
|
|
3209
|
+
const sliderRef = (0, vue.ref)(null);
|
|
3210
|
+
const controlRef = (0, vue.ref)(null);
|
|
3211
|
+
const thumbRefs = (0, vue.ref)([]);
|
|
3212
|
+
const pressedInputRef = (0, vue.ref)(null);
|
|
3213
|
+
const pressedThumbCenterOffsetRef = (0, vue.ref)(null);
|
|
3214
|
+
const pressedThumbIndexRef = (0, vue.ref)(-1);
|
|
3215
|
+
const pressedValuesRef = (0, vue.ref)(null);
|
|
3216
|
+
const lastChangedValueRef = (0, vue.ref)(null);
|
|
3217
|
+
const lastChangeReasonRef = (0, vue.ref)(require_checkbox_index.REASONS.none);
|
|
3218
|
+
const formatOptionsRef = (0, vue.computed)(() => props.format);
|
|
3219
|
+
const active = (0, vue.ref)(-1);
|
|
3220
|
+
const lastUsedThumbIndex = (0, vue.ref)(-1);
|
|
3221
|
+
const dragging = (0, vue.ref)(false);
|
|
3222
|
+
const thumbMap = (0, vue.shallowRef)(/* @__PURE__ */ new Map());
|
|
3223
|
+
const indicatorPosition = (0, vue.ref)([void 0, void 0]);
|
|
3224
|
+
function setActive(value) {
|
|
3225
|
+
active.value = value;
|
|
3226
|
+
if (value !== -1) lastUsedThumbIndex.value = value;
|
|
3227
|
+
}
|
|
3228
|
+
function registerFieldControlRef(element) {
|
|
3229
|
+
if (element) controlRef.value = element;
|
|
3230
|
+
}
|
|
3231
|
+
function setThumbMap(nextMap) {
|
|
3232
|
+
thumbMap.value = nextMap;
|
|
3233
|
+
}
|
|
3234
|
+
const compositeListProps = {
|
|
3235
|
+
elementsRef: thumbRefs,
|
|
3236
|
+
onMapChange: setThumbMap
|
|
3237
|
+
};
|
|
3238
|
+
const range = (0, vue.computed)(() => Array.isArray(valueUnwrapped.value));
|
|
3239
|
+
const values = (0, vue.computed)(() => {
|
|
3240
|
+
if (!range.value) return [require_control_SliderControl.clamp(valueUnwrapped.value, props.min, props.max)];
|
|
3241
|
+
return [...valueUnwrapped.value].sort(asc);
|
|
3242
|
+
});
|
|
3243
|
+
require_checkbox_group_CheckboxGroup.useField({
|
|
3244
|
+
id: idRef,
|
|
3245
|
+
commit: (value) => validation.commit(value),
|
|
3246
|
+
value: (0, vue.computed)(() => valueUnwrapped.value),
|
|
3247
|
+
controlRef,
|
|
3248
|
+
name,
|
|
3249
|
+
getValue: () => valueUnwrapped.value
|
|
3250
|
+
});
|
|
3251
|
+
(0, vue.watch)(() => valueUnwrapped.value, () => {
|
|
3252
|
+
clearErrors(name.value);
|
|
3253
|
+
if (shouldValidateOnChange()) validation.commit(valueUnwrapped.value);
|
|
3254
|
+
else validation.commit(valueUnwrapped.value, true);
|
|
3255
|
+
const initialValue = validityData.value.initialValue;
|
|
3256
|
+
let isDirty;
|
|
3257
|
+
if (Array.isArray(valueUnwrapped.value) && Array.isArray(initialValue)) isDirty = !areArraysEqual(valueUnwrapped.value, initialValue);
|
|
3258
|
+
else isDirty = valueUnwrapped.value !== initialValue;
|
|
3259
|
+
setDirty(isDirty);
|
|
3260
|
+
});
|
|
3261
|
+
function areValuesEqual(newValue, oldValue) {
|
|
3262
|
+
if (typeof newValue === "number" && typeof oldValue === "number") return newValue === oldValue;
|
|
3263
|
+
if (Array.isArray(newValue) && Array.isArray(oldValue)) return areArraysEqual(newValue, oldValue);
|
|
3264
|
+
return false;
|
|
3265
|
+
}
|
|
3266
|
+
function setValue(newValue, details) {
|
|
3267
|
+
if (Number.isNaN(newValue) || areValuesEqual(newValue, valueUnwrapped.value)) return;
|
|
3268
|
+
const changeDetails = details ?? require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.none, void 0, void 0, { activeThumbIndex: -1 });
|
|
3269
|
+
lastChangeReasonRef.value = changeDetails.reason;
|
|
3270
|
+
const nativeEvent = changeDetails.event;
|
|
3271
|
+
const clonedEvent = new (nativeEvent.constructor ?? Event)(nativeEvent.type, nativeEvent);
|
|
3272
|
+
Object.defineProperty(clonedEvent, "target", {
|
|
3273
|
+
writable: true,
|
|
3274
|
+
value: {
|
|
3275
|
+
value: newValue,
|
|
3276
|
+
name: name.value
|
|
3277
|
+
}
|
|
3278
|
+
});
|
|
3279
|
+
changeDetails.event = clonedEvent;
|
|
3280
|
+
lastChangedValueRef.value = newValue;
|
|
3281
|
+
emit("valueChange", newValue, changeDetails);
|
|
3282
|
+
if (changeDetails.isCanceled) return;
|
|
3283
|
+
setValueUnwrapped(newValue);
|
|
3284
|
+
}
|
|
3285
|
+
function getSliderChangeEventReason(event) {
|
|
3286
|
+
return event instanceof KeyboardEvent ? require_checkbox_index.REASONS.keyboard : require_checkbox_index.REASONS.inputChange;
|
|
3287
|
+
}
|
|
3288
|
+
function handleInputChange(valueInput, index, event) {
|
|
3289
|
+
const newValue = getSliderValue(valueInput, index, props.min, props.max, range.value, values.value);
|
|
3290
|
+
if (require_control_SliderControl.validateMinimumDistance(newValue, props.step, props.minStepsBetweenValues)) {
|
|
3291
|
+
const reason = getSliderChangeEventReason(event);
|
|
3292
|
+
setValue(newValue, require_checkbox_index.createChangeEventDetails(reason, event, void 0, { activeThumbIndex: index }));
|
|
3293
|
+
setTouched(true);
|
|
3294
|
+
emit("valueCommitted", lastChangedValueRef.value ?? newValue, require_checkbox_index.createGenericEventDetails(reason, event));
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
if (process.env.NODE_ENV !== "production" && props.min >= props.max) warn("Slider `max` must be greater than `min`.");
|
|
3298
|
+
(0, vue.watch)(() => disabled.value, (nextDisabled) => {
|
|
3299
|
+
const activeEl = sliderRef.value ? require_control_SliderControl.activeElement(require_control_SliderControl.ownerDocument(sliderRef.value)) : null;
|
|
3300
|
+
if (nextDisabled && activeEl instanceof HTMLElement && require_control_SliderControl.contains(sliderRef.value, activeEl)) activeEl.blur();
|
|
3301
|
+
if (nextDisabled && active.value !== -1) setActive(-1);
|
|
3302
|
+
});
|
|
3303
|
+
const state = (0, vue.computed)(() => ({
|
|
3304
|
+
...fieldState.value,
|
|
3305
|
+
activeThumbIndex: active.value,
|
|
3306
|
+
disabled: disabled.value,
|
|
3307
|
+
dragging: dragging.value,
|
|
3308
|
+
orientation: props.orientation,
|
|
3309
|
+
max: props.max,
|
|
3310
|
+
min: props.min,
|
|
3311
|
+
minStepsBetweenValues: props.minStepsBetweenValues,
|
|
3312
|
+
step: props.step,
|
|
3313
|
+
values: values.value
|
|
3314
|
+
}));
|
|
3315
|
+
(0, vue.provide)(require_control_SliderControl.sliderRootContextKey, {
|
|
3316
|
+
active,
|
|
3317
|
+
lastUsedThumbIndex,
|
|
3318
|
+
controlRef,
|
|
3319
|
+
dragging,
|
|
3320
|
+
disabled,
|
|
3321
|
+
validation,
|
|
3322
|
+
formatOptionsRef,
|
|
3323
|
+
handleInputChange,
|
|
3324
|
+
indicatorPosition,
|
|
3325
|
+
inset: (0, vue.computed)(() => props.thumbAlignment !== "center"),
|
|
3326
|
+
labelId: (0, vue.computed)(() => ariaLabelledBy.value),
|
|
3327
|
+
rootLabelId: defaultLabelId,
|
|
3328
|
+
largeStep: (0, vue.computed)(() => props.largeStep),
|
|
3329
|
+
lastChangedValueRef,
|
|
3330
|
+
lastChangeReasonRef,
|
|
3331
|
+
locale: (0, vue.computed)(() => props.locale),
|
|
3332
|
+
max: (0, vue.computed)(() => props.max),
|
|
3333
|
+
min: (0, vue.computed)(() => props.min),
|
|
3334
|
+
minStepsBetweenValues: (0, vue.computed)(() => props.minStepsBetweenValues),
|
|
3335
|
+
form: (0, vue.computed)(() => props.form),
|
|
3336
|
+
name,
|
|
3337
|
+
onValueCommitted(value, details) {
|
|
3338
|
+
emit("valueCommitted", value, details);
|
|
3339
|
+
},
|
|
3340
|
+
orientation: (0, vue.computed)(() => props.orientation),
|
|
3341
|
+
pressedInputRef,
|
|
3342
|
+
pressedThumbCenterOffsetRef,
|
|
3343
|
+
pressedThumbIndexRef,
|
|
3344
|
+
pressedValuesRef,
|
|
3345
|
+
registerFieldControlRef,
|
|
3346
|
+
renderBeforeHydration: (0, vue.computed)(() => props.thumbAlignment === "edge"),
|
|
3347
|
+
setActive,
|
|
3348
|
+
setDragging(value) {
|
|
3349
|
+
dragging.value = value;
|
|
3350
|
+
},
|
|
3351
|
+
setIndicatorPosition(updater) {
|
|
3352
|
+
indicatorPosition.value = updater(indicatorPosition.value);
|
|
3353
|
+
},
|
|
3354
|
+
setLabelId(value) {
|
|
3355
|
+
localLabelId.value = value;
|
|
3356
|
+
},
|
|
3357
|
+
setValue,
|
|
3358
|
+
state,
|
|
3359
|
+
step: (0, vue.computed)(() => props.step),
|
|
3360
|
+
thumbCollisionBehavior: (0, vue.computed)(() => props.thumbCollisionBehavior),
|
|
3361
|
+
thumbMap,
|
|
3362
|
+
thumbRefs,
|
|
3363
|
+
values
|
|
3364
|
+
});
|
|
3365
|
+
const rootProps = (0, vue.computed)(() => require_button_Button.mergeProps(attrsObject, validation.getValidationProps(), {
|
|
3366
|
+
"aria-labelledby": ariaLabelledBy.value,
|
|
3367
|
+
"id": id,
|
|
3368
|
+
"role": "group"
|
|
3369
|
+
}));
|
|
3370
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
3371
|
+
componentProps: props,
|
|
3372
|
+
state,
|
|
3373
|
+
ref: require_button_Button.useMergedRefs(sliderRef),
|
|
3374
|
+
props: rootProps,
|
|
3375
|
+
defaultTagName: "div",
|
|
3376
|
+
stateAttributesMapping: require_control_SliderControl.sliderStateAttributesMapping
|
|
3377
|
+
});
|
|
3378
|
+
return (_ctx, _cache) => {
|
|
3379
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(CompositeList_default, (0, vue.normalizeProps)((0, vue.guardReactiveProps)(compositeListProps)), {
|
|
3380
|
+
default: (0, vue.withCtx)(() => [(0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
3381
|
+
key: 0,
|
|
3382
|
+
ref: (0, vue.unref)(renderRef),
|
|
3383
|
+
props: (0, vue.unref)(mergedProps),
|
|
3384
|
+
state: state.value
|
|
3385
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
3386
|
+
key: 1,
|
|
3387
|
+
ref: (0, vue.unref)(renderRef)
|
|
3388
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
3389
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
3390
|
+
_: 3
|
|
3391
|
+
}, 16))]),
|
|
3392
|
+
_: 3
|
|
3393
|
+
}, 16);
|
|
3394
|
+
};
|
|
3395
|
+
}
|
|
3396
|
+
});
|
|
3397
|
+
|
|
3398
|
+
//#endregion
|
|
3399
|
+
//#region src/slider/root/SliderRoot.vue
|
|
3400
|
+
var SliderRoot_default = SliderRoot_vue_vue_type_script_setup_true_lang_default;
|
|
3401
|
+
|
|
3402
|
+
//#endregion
|
|
3403
|
+
//#region src/slider/root/SliderRootDataAttributes.ts
|
|
3404
|
+
let SliderRootDataAttributes = /* @__PURE__ */ function(SliderRootDataAttributes) {
|
|
3405
|
+
/**
|
|
3406
|
+
* Present while the user is dragging.
|
|
3407
|
+
*/
|
|
3408
|
+
SliderRootDataAttributes["dragging"] = "data-dragging";
|
|
3409
|
+
/**
|
|
3410
|
+
* Indicates the orientation of the slider.
|
|
3411
|
+
* @type {'horizontal' | 'vertical'}
|
|
3412
|
+
*/
|
|
3413
|
+
SliderRootDataAttributes["orientation"] = "data-orientation";
|
|
3414
|
+
/**
|
|
3415
|
+
* Present when the slider is disabled.
|
|
3416
|
+
*/
|
|
3417
|
+
SliderRootDataAttributes["disabled"] = "data-disabled";
|
|
3418
|
+
/**
|
|
3419
|
+
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
3420
|
+
*/
|
|
3421
|
+
SliderRootDataAttributes["valid"] = "data-valid";
|
|
3422
|
+
/**
|
|
3423
|
+
* Present when the slider is in invalid state (when wrapped in Field.Root).
|
|
3424
|
+
*/
|
|
3425
|
+
SliderRootDataAttributes["invalid"] = "data-invalid";
|
|
3426
|
+
/**
|
|
3427
|
+
* Present when the slider has been touched (when wrapped in Field.Root).
|
|
3428
|
+
*/
|
|
3429
|
+
SliderRootDataAttributes["touched"] = "data-touched";
|
|
3430
|
+
/**
|
|
3431
|
+
* Present when the slider's value has changed (when wrapped in Field.Root).
|
|
3432
|
+
*/
|
|
3433
|
+
SliderRootDataAttributes["dirty"] = "data-dirty";
|
|
3434
|
+
/**
|
|
3435
|
+
* Present when the slider is focused (when wrapped in Field.Root).
|
|
3436
|
+
*/
|
|
3437
|
+
SliderRootDataAttributes["focused"] = "data-focused";
|
|
3438
|
+
return SliderRootDataAttributes;
|
|
3439
|
+
}({});
|
|
3440
|
+
|
|
3441
|
+
//#endregion
|
|
3442
|
+
//#region src/utils/formatNumber.ts
|
|
3443
|
+
function formatNumber(value, locale, options) {
|
|
3444
|
+
return new Intl.NumberFormat(locale, options).format(value);
|
|
3445
|
+
}
|
|
3446
|
+
|
|
3447
|
+
//#endregion
|
|
3448
|
+
//#region src/slider/thumb/prehydrationScript.min.ts
|
|
3449
|
+
const script = "(function prehydration() {\n const firstThumb = document.currentScript?.parentElement\n if (!firstThumb) {\n return\n }\n\n const control = firstThumb.closest('[data-base-ui-slider-control]')\n if (!control) {\n return\n }\n\n const indicator = control.querySelector('[data-base-ui-slider-indicator]')\n const controlRect = control.getBoundingClientRect()\n const vertical = control.getAttribute('data-orientation') === 'vertical'\n const side = vertical ? 'height' : 'width'\n const inputElems = control.querySelectorAll('input[type=\"range\"]')\n const range = inputElems.length > 1\n const lastIndex = inputElems.length - 1\n\n let startPosition = null\n let relativeSize = null\n\n for (let i = 0; i < inputElems.length; i += 1) {\n const input = inputElems[i]\n\n const value = Number.parseFloat(input.getAttribute('value') ?? '')\n\n if (Number.isNaN(value)) {\n return\n }\n\n const thumb = input.parentElement\n if (!thumb) {\n return\n }\n\n const max = Number.parseFloat(input.getAttribute('max') ?? '100')\n const min = Number.parseFloat(input.getAttribute('min') ?? '0')\n\n const thumbRect = thumb?.getBoundingClientRect()\n\n const controlSize = controlRect[side] - thumbRect[side]\n const thumbValuePercent = max === min ? 0 : ((value - min) * 100) / (max - min)\n const thumbOffsetFromControlEdge\n = thumbRect[side] / 2 + (controlSize * thumbValuePercent) / 100\n const percent = (thumbOffsetFromControlEdge / controlRect[side]) * 100\n\n if (Number.isFinite(percent)) {\n thumb.style.setProperty(`--position`, `${percent}%`)\n thumb.style.removeProperty('visibility')\n\n if (indicator) {\n if (i === 0) {\n startPosition = percent\n indicator.style.setProperty('--start-position', `${percent}%`)\n if (!range) {\n indicator.style.removeProperty('visibility')\n }\n }\n else if (i === lastIndex) {\n relativeSize = percent - (startPosition ?? 0)\n indicator.style.setProperty('--end-position', `${percent}%`)\n indicator.style.setProperty('--relative-size', `${relativeSize}%`)\n indicator.style.removeProperty('visibility')\n }\n }\n }\n }\n})()";
|
|
3450
|
+
|
|
3451
|
+
//#endregion
|
|
3452
|
+
//#region src/slider/thumb/SliderThumbDataAttributes.ts
|
|
3453
|
+
let SliderThumbDataAttributes = /* @__PURE__ */ function(SliderThumbDataAttributes) {
|
|
3454
|
+
/**
|
|
3455
|
+
* Indicates the index of the thumb in range sliders.
|
|
3456
|
+
*/
|
|
3457
|
+
SliderThumbDataAttributes["index"] = "data-index";
|
|
3458
|
+
/**
|
|
3459
|
+
* Present while the user is dragging.
|
|
3460
|
+
*/
|
|
3461
|
+
SliderThumbDataAttributes["dragging"] = "data-dragging";
|
|
3462
|
+
/**
|
|
3463
|
+
* Indicates the orientation of the slider.
|
|
3464
|
+
* @type {'horizontal' | 'vertical'}
|
|
3465
|
+
*/
|
|
3466
|
+
SliderThumbDataAttributes["orientation"] = "data-orientation";
|
|
3467
|
+
/**
|
|
3468
|
+
* Present when the slider is disabled.
|
|
3469
|
+
*/
|
|
3470
|
+
SliderThumbDataAttributes["disabled"] = "data-disabled";
|
|
3471
|
+
/**
|
|
3472
|
+
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
3473
|
+
*/
|
|
3474
|
+
SliderThumbDataAttributes["valid"] = "data-valid";
|
|
3475
|
+
/**
|
|
3476
|
+
* Present when the slider is in invalid state (when wrapped in Field.Root).
|
|
3477
|
+
*/
|
|
3478
|
+
SliderThumbDataAttributes["invalid"] = "data-invalid";
|
|
3479
|
+
/**
|
|
3480
|
+
* Present when the slider has been touched (when wrapped in Field.Root).
|
|
3481
|
+
*/
|
|
3482
|
+
SliderThumbDataAttributes["touched"] = "data-touched";
|
|
3483
|
+
/**
|
|
3484
|
+
* Present when the slider's value has changed (when wrapped in Field.Root).
|
|
3485
|
+
*/
|
|
3486
|
+
SliderThumbDataAttributes["dirty"] = "data-dirty";
|
|
3487
|
+
/**
|
|
3488
|
+
* Present when the slider is focused (when wrapped in Field.Root).
|
|
3489
|
+
*/
|
|
3490
|
+
SliderThumbDataAttributes["focused"] = "data-focused";
|
|
3491
|
+
return SliderThumbDataAttributes;
|
|
3492
|
+
}({});
|
|
3493
|
+
|
|
3494
|
+
//#endregion
|
|
3495
|
+
//#region src/slider/thumb/SliderThumb.vue?vue&type=script&setup=true&lang.ts
|
|
3496
|
+
var SliderThumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3497
|
+
name: "SliderThumb",
|
|
3498
|
+
inheritAttrs: false,
|
|
3499
|
+
__name: "SliderThumb",
|
|
3500
|
+
props: {
|
|
3501
|
+
disabled: {
|
|
3502
|
+
type: Boolean,
|
|
3503
|
+
required: false,
|
|
3504
|
+
default: false
|
|
3505
|
+
},
|
|
3506
|
+
getAriaLabel: {
|
|
3507
|
+
type: [Function, null],
|
|
3508
|
+
required: false
|
|
3509
|
+
},
|
|
3510
|
+
getAriaValueText: {
|
|
3511
|
+
type: [Function, null],
|
|
3512
|
+
required: false
|
|
3513
|
+
},
|
|
3514
|
+
index: {
|
|
3515
|
+
type: Number,
|
|
3516
|
+
required: false
|
|
3517
|
+
},
|
|
3518
|
+
inputRef: {
|
|
3519
|
+
type: [
|
|
3520
|
+
Function,
|
|
3521
|
+
Object,
|
|
3522
|
+
null
|
|
3523
|
+
],
|
|
3524
|
+
required: false
|
|
3525
|
+
},
|
|
3526
|
+
tabIndex: {
|
|
3527
|
+
type: Number,
|
|
3528
|
+
required: false
|
|
3529
|
+
},
|
|
3530
|
+
id: {
|
|
3531
|
+
type: String,
|
|
3532
|
+
required: false
|
|
3533
|
+
},
|
|
3534
|
+
ariaLabel: {
|
|
3535
|
+
type: String,
|
|
3536
|
+
required: false
|
|
3537
|
+
},
|
|
3538
|
+
ariaLabelledby: {
|
|
3539
|
+
type: String,
|
|
3540
|
+
required: false
|
|
3541
|
+
},
|
|
3542
|
+
ariaDescribedby: {
|
|
3543
|
+
type: String,
|
|
3544
|
+
required: false
|
|
3545
|
+
},
|
|
3546
|
+
style: {
|
|
3547
|
+
type: [Object, Function],
|
|
3548
|
+
required: false
|
|
3549
|
+
},
|
|
3550
|
+
as: {
|
|
3551
|
+
type: null,
|
|
3552
|
+
required: false,
|
|
3553
|
+
default: "div"
|
|
3554
|
+
},
|
|
3555
|
+
class: {
|
|
3556
|
+
type: Function,
|
|
3557
|
+
required: false,
|
|
3558
|
+
skipCheck: true
|
|
3559
|
+
}
|
|
3560
|
+
},
|
|
3561
|
+
setup(__props) {
|
|
3562
|
+
const props = __props;
|
|
3563
|
+
const ALL_KEYS = new Set([
|
|
3564
|
+
require_composite_composite.ARROW_UP,
|
|
3565
|
+
require_composite_composite.ARROW_DOWN,
|
|
3566
|
+
require_composite_composite.ARROW_LEFT,
|
|
3567
|
+
require_composite_composite.ARROW_RIGHT,
|
|
3568
|
+
require_composite_composite.HOME,
|
|
3569
|
+
require_composite_composite.END,
|
|
3570
|
+
require_composite_composite.PAGE_UP,
|
|
3571
|
+
require_composite_composite.PAGE_DOWN
|
|
3572
|
+
]);
|
|
3573
|
+
function getDefaultAriaValueText(values, index, format, locale) {
|
|
3574
|
+
if (index < 0) return;
|
|
3575
|
+
if (values.length === 2) {
|
|
3576
|
+
if (index === 0) return `${formatNumber(values[index], locale, format)} start range`;
|
|
3577
|
+
return `${formatNumber(values[index], locale, format)} end range`;
|
|
3578
|
+
}
|
|
3579
|
+
return format ? formatNumber(values[index], locale, format) : void 0;
|
|
3580
|
+
}
|
|
3581
|
+
function getNewValue(thumbValue, step, direction, min, max) {
|
|
3582
|
+
return direction === 1 ? Math.min(thumbValue + step, max) : Math.max(thumbValue - step, min);
|
|
3583
|
+
}
|
|
3584
|
+
const attrs = (0, vue.useAttrs)();
|
|
3585
|
+
const { nonce } = require_csp_provider_CSPContext.useCSPContext();
|
|
3586
|
+
const direction = require_control_SliderControl.useDirection();
|
|
3587
|
+
const rootContext = require_control_SliderControl.useSliderRootContext();
|
|
3588
|
+
const { setTouched, setFocused, validationMode, validation } = require_checkbox_group_CheckboxGroup.useFieldRootContext();
|
|
3589
|
+
const id = require_checkbox_group_CheckboxGroup.useBaseUiId(props.id);
|
|
3590
|
+
const disabled = (0, vue.computed)(() => props.disabled || rootContext.disabled.value);
|
|
3591
|
+
const range = (0, vue.computed)(() => rootContext.values.value.length > 1);
|
|
3592
|
+
const vertical = (0, vue.computed)(() => rootContext.orientation.value === "vertical");
|
|
3593
|
+
const rtl = (0, vue.computed)(() => direction.value === "rtl");
|
|
3594
|
+
const thumbRef = (0, vue.ref)(null);
|
|
3595
|
+
const inputRef = (0, vue.ref)(null);
|
|
3596
|
+
const restoringFocusVisibleRef = (0, vue.ref)(false);
|
|
3597
|
+
const defaultInputId = require_checkbox_group_CheckboxGroup.useBaseUiId();
|
|
3598
|
+
const labelableId = require_control_FieldControl.useLabelableId();
|
|
3599
|
+
const inputId = (0, vue.computed)(() => range.value ? defaultInputId : labelableId.value);
|
|
3600
|
+
const { ref: listItemRef, index: compositeIndex } = require_button_ToolbarButton.useCompositeListItem({
|
|
3601
|
+
metadata: () => ({ inputId }),
|
|
3602
|
+
index: () => props.index
|
|
3603
|
+
});
|
|
3604
|
+
const index = (0, vue.computed)(() => !range.value ? 0 : props.index ?? compositeIndex.value);
|
|
3605
|
+
const last = (0, vue.computed)(() => index.value === rootContext.values.value.length - 1);
|
|
3606
|
+
const thumbValue = (0, vue.computed)(() => rootContext.values.value[index.value]);
|
|
3607
|
+
const thumbValuePercent = (0, vue.computed)(() => valueToPercent(thumbValue.value, rootContext.min.value, rootContext.max.value));
|
|
3608
|
+
const isMounted = (0, vue.ref)(false);
|
|
3609
|
+
const positionPercent = (0, vue.ref)(void 0);
|
|
3610
|
+
(0, vue.onMounted)(() => {
|
|
3611
|
+
isMounted.value = true;
|
|
3612
|
+
});
|
|
3613
|
+
const safeLastUsedThumbIndex = (0, vue.computed)(() => rootContext.lastUsedThumbIndex.value >= 0 && rootContext.lastUsedThumbIndex.value < rootContext.values.value.length ? rootContext.lastUsedThumbIndex.value : -1);
|
|
3614
|
+
function setIndicatorPositionForIndex(nextInsetPosition) {
|
|
3615
|
+
rootContext.setIndicatorPosition((prevPosition) => {
|
|
3616
|
+
const next = [...prevPosition];
|
|
3617
|
+
if (index.value === 0) next[0] = nextInsetPosition;
|
|
3618
|
+
else if (last.value) next[1] = nextInsetPosition;
|
|
3619
|
+
return next;
|
|
3620
|
+
});
|
|
3621
|
+
}
|
|
3622
|
+
function getInsetPosition() {
|
|
3623
|
+
const control = rootContext.controlRef.value;
|
|
3624
|
+
const thumb = thumbRef.value;
|
|
3625
|
+
if (!control || !thumb) return;
|
|
3626
|
+
const thumbRect = thumb.getBoundingClientRect();
|
|
3627
|
+
const controlRect = control.getBoundingClientRect();
|
|
3628
|
+
const side = vertical.value ? "height" : "width";
|
|
3629
|
+
const controlSize = controlRect[side] - thumbRect[side];
|
|
3630
|
+
const nextPositionPercent = (thumbRect[side] / 2 + controlSize * thumbValuePercent.value / 100) / controlRect[side] * 100;
|
|
3631
|
+
const nextInsetPosition = Number.isFinite(nextPositionPercent) ? nextPositionPercent : void 0;
|
|
3632
|
+
positionPercent.value = nextInsetPosition;
|
|
3633
|
+
setIndicatorPositionForIndex(nextInsetPosition);
|
|
3634
|
+
}
|
|
3635
|
+
(0, vue.watch)(() => [
|
|
3636
|
+
rootContext.inset.value,
|
|
3637
|
+
thumbValuePercent.value,
|
|
3638
|
+
isMounted.value
|
|
3639
|
+
], () => {
|
|
3640
|
+
if (rootContext.inset.value) queueMicrotask(getInsetPosition);
|
|
3641
|
+
}, { immediate: true });
|
|
3642
|
+
(0, vue.watchEffect)((onCleanup) => {
|
|
3643
|
+
if (!rootContext.inset.value || typeof ResizeObserver !== "function") return;
|
|
3644
|
+
const control = rootContext.controlRef.value;
|
|
3645
|
+
const thumb = thumbRef.value;
|
|
3646
|
+
if (!control || !thumb) return;
|
|
3647
|
+
const observer = new ResizeObserver(getInsetPosition);
|
|
3648
|
+
observer.observe(control);
|
|
3649
|
+
observer.observe(thumb);
|
|
3650
|
+
onCleanup(() => {
|
|
3651
|
+
observer.disconnect();
|
|
3652
|
+
});
|
|
3653
|
+
});
|
|
3654
|
+
const thumbStyle = (0, vue.computed)(() => {
|
|
3655
|
+
const startEdge = vertical.value ? "bottom" : "insetInlineStart";
|
|
3656
|
+
const crossOffsetProperty = vertical.value ? "left" : "top";
|
|
3657
|
+
let zIndex;
|
|
3658
|
+
if (range.value) {
|
|
3659
|
+
if (rootContext.active.value === index.value) zIndex = 2;
|
|
3660
|
+
else if (safeLastUsedThumbIndex.value === index.value) zIndex = 1;
|
|
3661
|
+
} else if (rootContext.active.value === index.value) zIndex = 1;
|
|
3662
|
+
if (!rootContext.inset.value) {
|
|
3663
|
+
if (!Number.isFinite(thumbValuePercent.value)) return require_checkbox_index.visuallyHidden;
|
|
3664
|
+
return {
|
|
3665
|
+
position: "absolute",
|
|
3666
|
+
[startEdge]: `${thumbValuePercent.value}%`,
|
|
3667
|
+
[crossOffsetProperty]: "50%",
|
|
3668
|
+
translate: `${(vertical.value || !rtl.value ? -1 : 1) * 50}% ${(vertical.value ? 1 : -1) * 50}%`,
|
|
3669
|
+
zIndex
|
|
3670
|
+
};
|
|
3671
|
+
}
|
|
3672
|
+
return {
|
|
3673
|
+
"--position": `${positionPercent.value ?? 0}%`,
|
|
3674
|
+
"visibility": rootContext.renderBeforeHydration.value && !isMounted.value || positionPercent.value === void 0 ? "hidden" : void 0,
|
|
3675
|
+
"position": "absolute",
|
|
3676
|
+
[startEdge]: "var(--position)",
|
|
3677
|
+
[crossOffsetProperty]: "50%",
|
|
3678
|
+
"translate": `${(vertical.value || !rtl.value ? -1 : 1) * 50}% ${(vertical.value ? 1 : -1) * 50}%`,
|
|
3679
|
+
zIndex
|
|
3680
|
+
};
|
|
3681
|
+
});
|
|
3682
|
+
const cssWritingMode = (0, vue.computed)(() => {
|
|
3683
|
+
if (rootContext.orientation.value === "vertical") return rtl.value ? "vertical-rl" : "vertical-lr";
|
|
3684
|
+
});
|
|
3685
|
+
const ariaLabel = (0, vue.computed)(() => typeof props.getAriaLabel === "function" ? props.getAriaLabel(index.value) : props.ariaLabel);
|
|
3686
|
+
function setInputRef(node) {
|
|
3687
|
+
inputRef.value = node;
|
|
3688
|
+
validation.setInputRef(node);
|
|
3689
|
+
const forwardedInputRef = props.inputRef;
|
|
3690
|
+
if (!forwardedInputRef) return;
|
|
3691
|
+
if (typeof forwardedInputRef === "function") forwardedInputRef(node);
|
|
3692
|
+
else forwardedInputRef.value = node;
|
|
3693
|
+
}
|
|
3694
|
+
function setInputVNodeRef(node) {
|
|
3695
|
+
setInputRef(node instanceof HTMLInputElement ? node : null);
|
|
3696
|
+
}
|
|
3697
|
+
function handleBlur(event) {
|
|
3698
|
+
if (restoringFocusVisibleRef.value) {
|
|
3699
|
+
event.stopPropagation();
|
|
3700
|
+
return;
|
|
3701
|
+
}
|
|
3702
|
+
if (!thumbRef.value) return;
|
|
3703
|
+
rootContext.setActive(-1);
|
|
3704
|
+
setTouched(true);
|
|
3705
|
+
setFocused(false);
|
|
3706
|
+
if (validationMode.value === "onBlur") validation.commit(getSliderValue(thumbValue.value, index.value, rootContext.min.value, rootContext.max.value, range.value, rootContext.values.value));
|
|
3707
|
+
}
|
|
3708
|
+
function handleKeydown(event) {
|
|
3709
|
+
if (!ALL_KEYS.has(event.key)) return;
|
|
3710
|
+
if (require_composite_composite.COMPOSITE_KEYS.has(event.key)) event.stopPropagation();
|
|
3711
|
+
let newValue = null;
|
|
3712
|
+
const roundedValue = require_control_SliderControl.roundValueToStep(thumbValue.value, rootContext.step.value, rootContext.min.value);
|
|
3713
|
+
switch (event.key) {
|
|
3714
|
+
case require_composite_composite.ARROW_UP:
|
|
3715
|
+
newValue = getNewValue(roundedValue, event.shiftKey ? rootContext.largeStep.value : rootContext.step.value, 1, rootContext.min.value, rootContext.max.value);
|
|
3716
|
+
break;
|
|
3717
|
+
case require_composite_composite.ARROW_RIGHT:
|
|
3718
|
+
newValue = getNewValue(roundedValue, event.shiftKey ? rootContext.largeStep.value : rootContext.step.value, rtl.value ? -1 : 1, rootContext.min.value, rootContext.max.value);
|
|
3719
|
+
break;
|
|
3720
|
+
case require_composite_composite.ARROW_DOWN:
|
|
3721
|
+
newValue = getNewValue(roundedValue, event.shiftKey ? rootContext.largeStep.value : rootContext.step.value, -1, rootContext.min.value, rootContext.max.value);
|
|
3722
|
+
break;
|
|
3723
|
+
case require_composite_composite.ARROW_LEFT:
|
|
3724
|
+
newValue = getNewValue(roundedValue, event.shiftKey ? rootContext.largeStep.value : rootContext.step.value, rtl.value ? 1 : -1, rootContext.min.value, rootContext.max.value);
|
|
3725
|
+
break;
|
|
3726
|
+
case require_composite_composite.PAGE_UP:
|
|
3727
|
+
newValue = getNewValue(roundedValue, rootContext.largeStep.value, 1, rootContext.min.value, rootContext.max.value);
|
|
3728
|
+
break;
|
|
3729
|
+
case require_composite_composite.PAGE_DOWN:
|
|
3730
|
+
newValue = getNewValue(roundedValue, rootContext.largeStep.value, -1, rootContext.min.value, rootContext.max.value);
|
|
3731
|
+
break;
|
|
3732
|
+
case require_composite_composite.END:
|
|
3733
|
+
newValue = rootContext.max.value;
|
|
3734
|
+
if (range.value) newValue = Number.isFinite(rootContext.values.value[index.value + 1]) ? rootContext.values.value[index.value + 1] - rootContext.step.value * rootContext.minStepsBetweenValues.value : rootContext.max.value;
|
|
3735
|
+
break;
|
|
3736
|
+
case require_composite_composite.HOME:
|
|
3737
|
+
newValue = rootContext.min.value;
|
|
3738
|
+
if (range.value) newValue = Number.isFinite(rootContext.values.value[index.value - 1]) ? rootContext.values.value[index.value - 1] + rootContext.step.value * rootContext.minStepsBetweenValues.value : rootContext.min.value;
|
|
3739
|
+
break;
|
|
3740
|
+
default: break;
|
|
3741
|
+
}
|
|
3742
|
+
if (newValue !== null) {
|
|
3743
|
+
const input = event.currentTarget;
|
|
3744
|
+
if (!matchesFocusVisible(input)) {
|
|
3745
|
+
restoringFocusVisibleRef.value = true;
|
|
3746
|
+
input.blur();
|
|
3747
|
+
input.focus({
|
|
3748
|
+
preventScroll: true,
|
|
3749
|
+
focusVisible: true
|
|
3750
|
+
});
|
|
3751
|
+
}
|
|
3752
|
+
rootContext.handleInputChange(newValue, index.value, event);
|
|
3753
|
+
rootContext.onValueCommitted(rootContext.lastChangedValueRef.value ?? getSliderValue(newValue, index.value, rootContext.min.value, rootContext.max.value, range.value, rootContext.values.value), require_checkbox_index.createGenericEventDetails(require_checkbox_index.REASONS.keyboard, event));
|
|
3754
|
+
event.preventDefault();
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
const inputStyle = (0, vue.computed)(() => ({
|
|
3758
|
+
...require_checkbox_index.visuallyHidden,
|
|
3759
|
+
width: "100%",
|
|
3760
|
+
height: "100%",
|
|
3761
|
+
writingMode: cssWritingMode.value
|
|
3762
|
+
}));
|
|
3763
|
+
const inputValidationProps = (0, vue.computed)(() => validation.getInputValidationProps());
|
|
3764
|
+
const forwardedInputAttrs = (0, vue.computed)(() => {
|
|
3765
|
+
const attrsObject = attrs;
|
|
3766
|
+
return {
|
|
3767
|
+
onBlur: attrsObject.onBlur,
|
|
3768
|
+
onFocus: attrsObject.onFocus,
|
|
3769
|
+
onKeydown: attrsObject.onKeydown
|
|
3770
|
+
};
|
|
3771
|
+
});
|
|
3772
|
+
const thumbAttrs = (0, vue.computed)(() => {
|
|
3773
|
+
const { onBlur: _onBlur, onFocus: _onFocus, onKeydown: _onKeydown, ...rest } = attrs;
|
|
3774
|
+
return rest;
|
|
3775
|
+
});
|
|
3776
|
+
const inputProps = (0, vue.computed)(() => require_button_Button.mergeProps(inputValidationProps.value, forwardedInputAttrs.value, {
|
|
3777
|
+
"aria-label": ariaLabel.value,
|
|
3778
|
+
"aria-labelledby": props.ariaLabelledby ?? (ariaLabel.value == null ? rootContext.labelId.value : void 0),
|
|
3779
|
+
"aria-describedby": props.ariaDescribedby ?? inputValidationProps.value["aria-describedby"],
|
|
3780
|
+
"aria-orientation": rootContext.orientation.value,
|
|
3781
|
+
"aria-valuenow": thumbValue.value,
|
|
3782
|
+
"aria-valuetext": typeof props.getAriaValueText === "function" ? props.getAriaValueText(formatNumber(thumbValue.value, rootContext.locale.value, rootContext.formatOptionsRef.value), thumbValue.value, index.value) : getDefaultAriaValueText(rootContext.values.value, index.value, rootContext.formatOptionsRef.value, rootContext.locale.value),
|
|
3783
|
+
"disabled": disabled.value,
|
|
3784
|
+
"form": rootContext.form.value,
|
|
3785
|
+
"id": inputId.value,
|
|
3786
|
+
"max": rootContext.max.value,
|
|
3787
|
+
"min": rootContext.min.value,
|
|
3788
|
+
"name": rootContext.name.value,
|
|
3789
|
+
onChange(event) {
|
|
3790
|
+
rootContext.handleInputChange(event.currentTarget.valueAsNumber, index.value, event);
|
|
3791
|
+
},
|
|
3792
|
+
onFocus(event) {
|
|
3793
|
+
const isRestoringFocusVisible = restoringFocusVisibleRef.value;
|
|
3794
|
+
restoringFocusVisibleRef.value = false;
|
|
3795
|
+
rootContext.setActive(index.value);
|
|
3796
|
+
setFocused(true);
|
|
3797
|
+
if (isRestoringFocusVisible) event.stopPropagation();
|
|
3798
|
+
},
|
|
3799
|
+
"onBlur": handleBlur,
|
|
3800
|
+
"onKeydown": handleKeydown,
|
|
3801
|
+
"step": rootContext.step.value,
|
|
3802
|
+
"style": inputStyle.value,
|
|
3803
|
+
"tabIndex": props.tabIndex ?? void 0,
|
|
3804
|
+
"type": "range",
|
|
3805
|
+
"value": thumbValue.value ?? ""
|
|
3806
|
+
}));
|
|
3807
|
+
const mergedRef = require_button_Button.useMergedRefs(listItemRef, thumbRef);
|
|
3808
|
+
const thumbProps = (0, vue.computed)(() => require_button_Button.mergeProps(thumbAttrs.value, {
|
|
3809
|
+
[SliderThumbDataAttributes.index]: index.value,
|
|
3810
|
+
id,
|
|
3811
|
+
onPointerdown(event) {
|
|
3812
|
+
rootContext.pressedThumbIndexRef.value = index.value;
|
|
3813
|
+
if (thumbRef.value != null) {
|
|
3814
|
+
const axis = rootContext.orientation.value === "horizontal" ? "x" : "y";
|
|
3815
|
+
const midpoint = require_control_SliderControl.getMidpoint(thumbRef.value);
|
|
3816
|
+
const offset = (rootContext.orientation.value === "horizontal" ? event.clientX : event.clientY) - midpoint[axis];
|
|
3817
|
+
rootContext.pressedThumbCenterOffsetRef.value = offset;
|
|
3818
|
+
}
|
|
3819
|
+
if (inputRef.value != null && rootContext.pressedInputRef.value !== inputRef.value) rootContext.pressedInputRef.value = inputRef.value;
|
|
3820
|
+
},
|
|
3821
|
+
style: thumbStyle.value,
|
|
3822
|
+
suppressHydrationWarning: rootContext.renderBeforeHydration.value || void 0
|
|
3823
|
+
}));
|
|
3824
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
3825
|
+
componentProps: props,
|
|
3826
|
+
state: rootContext.state,
|
|
3827
|
+
props: thumbProps,
|
|
3828
|
+
defaultTagName: "div",
|
|
3829
|
+
ref: mergedRef,
|
|
3830
|
+
stateAttributesMapping: require_control_SliderControl.sliderStateAttributesMapping
|
|
3831
|
+
});
|
|
3832
|
+
(0, vue.watch)(() => rootContext.active.value, () => {
|
|
3833
|
+
if (disabled.value && rootContext.active.value === index.value) rootContext.setActive(-1);
|
|
3834
|
+
});
|
|
3835
|
+
return (_ctx, _cache) => {
|
|
3836
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
3837
|
+
key: 0,
|
|
3838
|
+
ref: (0, vue.unref)(renderRef),
|
|
3839
|
+
props: (0, vue.unref)(mergedProps),
|
|
3840
|
+
state: (0, vue.unref)(rootContext).state
|
|
3841
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
3842
|
+
key: 1,
|
|
3843
|
+
ref: (0, vue.unref)(renderRef)
|
|
3844
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
3845
|
+
default: (0, vue.withCtx)(() => [
|
|
3846
|
+
(0, vue.renderSlot)(_ctx.$slots, "default"),
|
|
3847
|
+
(0, vue.createElementVNode)("input", (0, vue.mergeProps)({ ref: setInputVNodeRef }, inputProps.value), null, 16),
|
|
3848
|
+
(0, vue.createCommentVNode)(" eslint-disable-next-line vue/require-component-is "),
|
|
3849
|
+
(0, vue.unref)(rootContext).inset.value && !isMounted.value && (0, vue.unref)(rootContext).renderBeforeHydration.value && last.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)("script"), {
|
|
3850
|
+
key: 0,
|
|
3851
|
+
nonce: (0, vue.unref)(nonce),
|
|
3852
|
+
"suppress-hydration-warning": true
|
|
3853
|
+
}, {
|
|
3854
|
+
default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(script)), 1)]),
|
|
3855
|
+
_: 1
|
|
3856
|
+
}, 8, ["nonce"])) : (0, vue.createCommentVNode)("v-if", true)
|
|
3857
|
+
]),
|
|
3858
|
+
_: 3
|
|
3859
|
+
}, 16));
|
|
3860
|
+
};
|
|
3861
|
+
}
|
|
3862
|
+
});
|
|
3863
|
+
|
|
3864
|
+
//#endregion
|
|
3865
|
+
//#region src/slider/thumb/SliderThumb.vue
|
|
3866
|
+
var SliderThumb_default = SliderThumb_vue_vue_type_script_setup_true_lang_default;
|
|
3867
|
+
|
|
3868
|
+
//#endregion
|
|
3869
|
+
//#region src/slider/track/SliderTrack.vue?vue&type=script&setup=true&lang.ts
|
|
3870
|
+
var SliderTrack_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3871
|
+
name: "SliderTrack",
|
|
3872
|
+
inheritAttrs: false,
|
|
3873
|
+
__name: "SliderTrack",
|
|
3874
|
+
props: {
|
|
3875
|
+
as: {
|
|
3876
|
+
type: null,
|
|
3877
|
+
required: false,
|
|
3878
|
+
default: "div"
|
|
3879
|
+
},
|
|
3880
|
+
class: {
|
|
3881
|
+
type: Function,
|
|
3882
|
+
required: false,
|
|
3883
|
+
skipCheck: true
|
|
3884
|
+
},
|
|
3885
|
+
style: {
|
|
3886
|
+
type: [
|
|
3887
|
+
Boolean,
|
|
3888
|
+
null,
|
|
3889
|
+
String,
|
|
3890
|
+
Object,
|
|
3891
|
+
Array,
|
|
3892
|
+
Function
|
|
3893
|
+
],
|
|
3894
|
+
required: false,
|
|
3895
|
+
skipCheck: true
|
|
3896
|
+
}
|
|
3897
|
+
},
|
|
3898
|
+
setup(__props) {
|
|
3899
|
+
const props = __props;
|
|
3900
|
+
const attrs = (0, vue.useAttrs)();
|
|
3901
|
+
const rootContext = require_control_SliderControl.useSliderRootContext();
|
|
3902
|
+
const trackProps = (0, vue.computed)(() => require_button_Button.mergeProps(attrs, { style: { position: "relative" } }));
|
|
3903
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
3904
|
+
componentProps: props,
|
|
3905
|
+
state: rootContext.state,
|
|
3906
|
+
props: trackProps,
|
|
3907
|
+
defaultTagName: "div",
|
|
3908
|
+
stateAttributesMapping: require_control_SliderControl.sliderStateAttributesMapping
|
|
3909
|
+
});
|
|
3910
|
+
return (_ctx, _cache) => {
|
|
3911
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
3912
|
+
key: 0,
|
|
3913
|
+
ref: (0, vue.unref)(renderRef),
|
|
3914
|
+
props: (0, vue.unref)(mergedProps),
|
|
3915
|
+
state: (0, vue.unref)(rootContext).state
|
|
3916
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
3917
|
+
key: 1,
|
|
3918
|
+
ref: (0, vue.unref)(renderRef)
|
|
3919
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
3920
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
3921
|
+
_: 3
|
|
3922
|
+
}, 16));
|
|
3923
|
+
};
|
|
3924
|
+
}
|
|
3925
|
+
});
|
|
3926
|
+
|
|
3927
|
+
//#endregion
|
|
3928
|
+
//#region src/slider/track/SliderTrack.vue
|
|
3929
|
+
var SliderTrack_default = SliderTrack_vue_vue_type_script_setup_true_lang_default;
|
|
3930
|
+
|
|
3931
|
+
//#endregion
|
|
3932
|
+
//#region src/slider/track/SliderTrackDataAttributes.ts
|
|
3933
|
+
let SliderTrackDataAttributes = /* @__PURE__ */ function(SliderTrackDataAttributes) {
|
|
3934
|
+
SliderTrackDataAttributes["dragging"] = "data-dragging";
|
|
3935
|
+
SliderTrackDataAttributes["orientation"] = "data-orientation";
|
|
3936
|
+
SliderTrackDataAttributes["disabled"] = "data-disabled";
|
|
3937
|
+
SliderTrackDataAttributes["valid"] = "data-valid";
|
|
3938
|
+
SliderTrackDataAttributes["invalid"] = "data-invalid";
|
|
3939
|
+
SliderTrackDataAttributes["touched"] = "data-touched";
|
|
3940
|
+
SliderTrackDataAttributes["dirty"] = "data-dirty";
|
|
3941
|
+
SliderTrackDataAttributes["focused"] = "data-focused";
|
|
3942
|
+
return SliderTrackDataAttributes;
|
|
3943
|
+
}({});
|
|
3944
|
+
|
|
3945
|
+
//#endregion
|
|
3946
|
+
//#region src/slider/value/SliderValue.vue?vue&type=script&setup=true&lang.ts
|
|
3947
|
+
/**
|
|
3948
|
+
* Displays the current value of the slider as text.
|
|
3949
|
+
* Renders an `<output>` element.
|
|
3950
|
+
*
|
|
3951
|
+
* Documentation: [Base UI Slider](https://baseui-vue.com/docs/components/slider)
|
|
3952
|
+
*/
|
|
3953
|
+
var SliderValue_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3954
|
+
name: "SliderValue",
|
|
3955
|
+
inheritAttrs: false,
|
|
3956
|
+
__name: "SliderValue",
|
|
3957
|
+
props: {
|
|
3958
|
+
ariaLive: {
|
|
3959
|
+
type: String,
|
|
3960
|
+
required: false,
|
|
3961
|
+
default: "off"
|
|
3962
|
+
},
|
|
3963
|
+
as: {
|
|
3964
|
+
type: null,
|
|
3965
|
+
required: false,
|
|
3966
|
+
default: "output"
|
|
3967
|
+
},
|
|
3968
|
+
class: {
|
|
3969
|
+
type: Function,
|
|
3970
|
+
required: false,
|
|
3971
|
+
skipCheck: true
|
|
3972
|
+
},
|
|
3973
|
+
style: {
|
|
3974
|
+
type: [
|
|
3975
|
+
Boolean,
|
|
3976
|
+
null,
|
|
3977
|
+
String,
|
|
3978
|
+
Object,
|
|
3979
|
+
Array,
|
|
3980
|
+
Function
|
|
3981
|
+
],
|
|
3982
|
+
required: false,
|
|
3983
|
+
skipCheck: true
|
|
3984
|
+
}
|
|
3985
|
+
},
|
|
3986
|
+
setup(__props) {
|
|
3987
|
+
const props = __props;
|
|
3988
|
+
const attrs = (0, vue.useAttrs)();
|
|
3989
|
+
const rootContext = require_control_SliderControl.useSliderRootContext();
|
|
3990
|
+
const outputFor = (0, vue.computed)(() => {
|
|
3991
|
+
let htmlFor = "";
|
|
3992
|
+
for (const thumbMetadata of rootContext.thumbMap.value.values()) if (thumbMetadata?.inputId) htmlFor += `${thumbMetadata.inputId} `;
|
|
3993
|
+
return htmlFor.trim() === "" ? void 0 : htmlFor.trim();
|
|
3994
|
+
});
|
|
3995
|
+
const formattedValues = (0, vue.computed)(() => rootContext.values.value.map((value) => formatNumber(value, rootContext.locale.value, rootContext.formatOptionsRef.value)));
|
|
3996
|
+
const defaultDisplayValue = (0, vue.computed)(() => rootContext.values.value.map((value, index) => formattedValues.value[index] || String(value)).join(" – "));
|
|
3997
|
+
const valueProps = (0, vue.computed)(() => require_button_Button.mergeProps(attrs, {
|
|
3998
|
+
"aria-live": props.ariaLive,
|
|
3999
|
+
"for": outputFor.value
|
|
4000
|
+
}));
|
|
4001
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
4002
|
+
componentProps: props,
|
|
4003
|
+
state: rootContext.state,
|
|
4004
|
+
props: valueProps,
|
|
4005
|
+
defaultTagName: "output",
|
|
4006
|
+
stateAttributesMapping: require_control_SliderControl.sliderStateAttributesMapping
|
|
4007
|
+
});
|
|
4008
|
+
return (_ctx, _cache) => {
|
|
4009
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
4010
|
+
key: 0,
|
|
4011
|
+
ref: (0, vue.unref)(renderRef),
|
|
4012
|
+
props: (0, vue.unref)(mergedProps),
|
|
4013
|
+
state: (0, vue.unref)(rootContext).state,
|
|
4014
|
+
formattedValues: formattedValues.value,
|
|
4015
|
+
values: (0, vue.unref)(rootContext).values.value
|
|
4016
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
4017
|
+
key: 1,
|
|
4018
|
+
ref: (0, vue.unref)(renderRef)
|
|
4019
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
4020
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
4021
|
+
formattedValues: formattedValues.value,
|
|
4022
|
+
values: (0, vue.unref)(rootContext).values.value
|
|
4023
|
+
}, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(defaultDisplayValue.value), 1)])]),
|
|
4024
|
+
_: 3
|
|
4025
|
+
}, 16));
|
|
4026
|
+
};
|
|
4027
|
+
}
|
|
4028
|
+
});
|
|
4029
|
+
|
|
4030
|
+
//#endregion
|
|
4031
|
+
//#region src/slider/value/SliderValue.vue
|
|
4032
|
+
var SliderValue_default = SliderValue_vue_vue_type_script_setup_true_lang_default;
|
|
4033
|
+
|
|
4034
|
+
//#endregion
|
|
4035
|
+
//#region src/slider/value/SliderValueDataAttributes.ts
|
|
4036
|
+
let SliderValueDataAttributes = /* @__PURE__ */ function(SliderValueDataAttributes) {
|
|
4037
|
+
/**
|
|
4038
|
+
* Present while the user is dragging.
|
|
4039
|
+
*/
|
|
4040
|
+
SliderValueDataAttributes["dragging"] = "data-dragging";
|
|
4041
|
+
/**
|
|
4042
|
+
* Indicates the orientation of the slider.
|
|
4043
|
+
* @type {'horizontal' | 'vertical'}
|
|
4044
|
+
*/
|
|
4045
|
+
SliderValueDataAttributes["orientation"] = "data-orientation";
|
|
4046
|
+
/**
|
|
4047
|
+
* Present when the slider is disabled.
|
|
4048
|
+
*/
|
|
4049
|
+
SliderValueDataAttributes["disabled"] = "data-disabled";
|
|
4050
|
+
/**
|
|
4051
|
+
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
4052
|
+
*/
|
|
4053
|
+
SliderValueDataAttributes["valid"] = "data-valid";
|
|
4054
|
+
/**
|
|
4055
|
+
* Present when the slider is in invalid state (when wrapped in Field.Root).
|
|
4056
|
+
*/
|
|
4057
|
+
SliderValueDataAttributes["invalid"] = "data-invalid";
|
|
4058
|
+
/**
|
|
4059
|
+
* Present when the slider has been touched (when wrapped in Field.Root).
|
|
4060
|
+
*/
|
|
4061
|
+
SliderValueDataAttributes["touched"] = "data-touched";
|
|
4062
|
+
/**
|
|
4063
|
+
* Present when the slider's value has changed (when wrapped in Field.Root).
|
|
4064
|
+
*/
|
|
4065
|
+
SliderValueDataAttributes["dirty"] = "data-dirty";
|
|
4066
|
+
/**
|
|
4067
|
+
* Present when the slider is focused (when wrapped in Field.Root).
|
|
4068
|
+
*/
|
|
4069
|
+
SliderValueDataAttributes["focused"] = "data-focused";
|
|
4070
|
+
return SliderValueDataAttributes;
|
|
4071
|
+
}({});
|
|
4072
|
+
|
|
4073
|
+
//#endregion
|
|
4074
|
+
//#region src/switch/root/SwitchRootDataAttributes.ts
|
|
4075
|
+
let SwitchRootDataAttributes = /* @__PURE__ */ function(SwitchRootDataAttributes) {
|
|
4076
|
+
/**
|
|
4077
|
+
* Present when the switch is checked.
|
|
4078
|
+
*/
|
|
4079
|
+
SwitchRootDataAttributes["checked"] = "data-checked";
|
|
4080
|
+
/**
|
|
4081
|
+
* Present when the switch is not checked.
|
|
4082
|
+
*/
|
|
4083
|
+
SwitchRootDataAttributes["unchecked"] = "data-unchecked";
|
|
4084
|
+
/**
|
|
4085
|
+
* Present when the switch is disabled.
|
|
4086
|
+
*/
|
|
4087
|
+
SwitchRootDataAttributes["disabled"] = "data-disabled";
|
|
4088
|
+
/**
|
|
4089
|
+
* Present when the switch is readonly.
|
|
4090
|
+
*/
|
|
4091
|
+
SwitchRootDataAttributes["readonly"] = "data-readonly";
|
|
4092
|
+
/**
|
|
4093
|
+
* Present when the switch is required.
|
|
4094
|
+
*/
|
|
4095
|
+
SwitchRootDataAttributes["required"] = "data-required";
|
|
4096
|
+
/**
|
|
4097
|
+
* Present when the switch is in valid state (when wrapped in FieldRoot).
|
|
4098
|
+
*/
|
|
4099
|
+
SwitchRootDataAttributes["valid"] = "data-valid";
|
|
4100
|
+
/**
|
|
4101
|
+
* Present when the switch is in invalid state (when wrapped in FieldRoot).
|
|
4102
|
+
*/
|
|
4103
|
+
SwitchRootDataAttributes["invalid"] = "data-invalid";
|
|
4104
|
+
/**
|
|
4105
|
+
* Present when the switch has been touched (when wrapped in FieldRoot).
|
|
4106
|
+
*/
|
|
4107
|
+
SwitchRootDataAttributes["touched"] = "data-touched";
|
|
4108
|
+
/**
|
|
4109
|
+
* Present when the switch's value has changed (when wrapped in FieldRoot).
|
|
4110
|
+
*/
|
|
4111
|
+
SwitchRootDataAttributes["dirty"] = "data-dirty";
|
|
4112
|
+
/**
|
|
4113
|
+
* Present when the switch is active (when wrapped in FieldRoot).
|
|
4114
|
+
*/
|
|
4115
|
+
SwitchRootDataAttributes["filled"] = "data-filled";
|
|
4116
|
+
/**
|
|
4117
|
+
* Present when the switch is focused (when wrapped in FieldRoot).
|
|
4118
|
+
*/
|
|
4119
|
+
SwitchRootDataAttributes["focused"] = "data-focused";
|
|
4120
|
+
return SwitchRootDataAttributes;
|
|
4121
|
+
}({});
|
|
4122
|
+
|
|
4123
|
+
//#endregion
|
|
4124
|
+
//#region src/switch/stateAttributesMapping.ts
|
|
4125
|
+
const CHECKED_ATTRS = { [SwitchRootDataAttributes.checked]: "" };
|
|
4126
|
+
const UNCHECKED_ATTRS = { [SwitchRootDataAttributes.unchecked]: "" };
|
|
4127
|
+
const stateAttributesMapping = {
|
|
4128
|
+
...require_checkbox_group_CheckboxGroup.fieldValidityMapping,
|
|
4129
|
+
checked(value) {
|
|
4130
|
+
if (value) return CHECKED_ATTRS;
|
|
4131
|
+
return UNCHECKED_ATTRS;
|
|
4132
|
+
}
|
|
4133
|
+
};
|
|
4134
|
+
|
|
4135
|
+
//#endregion
|
|
4136
|
+
//#region src/switch/root/SwitchRootContext.ts
|
|
4137
|
+
const switchRootContextKey = Symbol("SwitchRootContext");
|
|
4138
|
+
function useSwitchRootContext(optional = false) {
|
|
4139
|
+
const context = (0, vue.inject)(switchRootContextKey, void 0);
|
|
4140
|
+
if (!context && !optional) throw new Error("Base UI Vue: SwitchRootContext is missing. Switch parts must be placed within <SwitchRoot>.");
|
|
4141
|
+
return context;
|
|
4142
|
+
}
|
|
4143
|
+
|
|
4144
|
+
//#endregion
|
|
4145
|
+
//#region src/switch/root/SwitchRoot.vue?vue&type=script&setup=true&lang.ts
|
|
4146
|
+
const _hoisted_1 = [
|
|
4147
|
+
"form",
|
|
4148
|
+
"name",
|
|
4149
|
+
"value"
|
|
4150
|
+
];
|
|
4151
|
+
/**
|
|
4152
|
+
* Represents the switch itself.
|
|
4153
|
+
* Renders a `<span>` element and a hidden `<input>` beside.
|
|
4154
|
+
*
|
|
4155
|
+
* Documentation: [Base UI Vue Switch](https://baseui-vue.com/docs/components/switch)
|
|
4156
|
+
*/
|
|
4157
|
+
var SwitchRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4158
|
+
name: "SwitchRoot",
|
|
4159
|
+
inheritAttrs: false,
|
|
4160
|
+
__name: "SwitchRoot",
|
|
4161
|
+
props: {
|
|
4162
|
+
id: {
|
|
4163
|
+
type: String,
|
|
4164
|
+
required: false
|
|
4165
|
+
},
|
|
4166
|
+
checked: {
|
|
4167
|
+
type: Boolean,
|
|
4168
|
+
required: false
|
|
4169
|
+
},
|
|
4170
|
+
defaultChecked: {
|
|
4171
|
+
type: Boolean,
|
|
4172
|
+
required: false,
|
|
4173
|
+
default: false
|
|
4174
|
+
},
|
|
4175
|
+
disabled: {
|
|
4176
|
+
type: Boolean,
|
|
4177
|
+
required: false,
|
|
4178
|
+
default: false
|
|
4179
|
+
},
|
|
4180
|
+
inputRef: {
|
|
4181
|
+
type: [
|
|
4182
|
+
Object,
|
|
4183
|
+
Function,
|
|
4184
|
+
null
|
|
4185
|
+
],
|
|
4186
|
+
required: false
|
|
4187
|
+
},
|
|
4188
|
+
name: {
|
|
4189
|
+
type: String,
|
|
4190
|
+
required: false
|
|
4191
|
+
},
|
|
4192
|
+
form: {
|
|
4193
|
+
type: String,
|
|
4194
|
+
required: false
|
|
4195
|
+
},
|
|
4196
|
+
readOnly: {
|
|
4197
|
+
type: Boolean,
|
|
4198
|
+
required: false,
|
|
4199
|
+
default: false
|
|
4200
|
+
},
|
|
4201
|
+
required: {
|
|
4202
|
+
type: Boolean,
|
|
4203
|
+
required: false,
|
|
4204
|
+
default: false
|
|
4205
|
+
},
|
|
4206
|
+
value: {
|
|
4207
|
+
type: String,
|
|
4208
|
+
required: false
|
|
4209
|
+
},
|
|
4210
|
+
uncheckedValue: {
|
|
4211
|
+
type: String,
|
|
4212
|
+
required: false
|
|
4213
|
+
},
|
|
4214
|
+
"aria-labelledby": {
|
|
4215
|
+
type: String,
|
|
4216
|
+
required: false
|
|
4217
|
+
},
|
|
4218
|
+
nativeButton: {
|
|
4219
|
+
type: Boolean,
|
|
4220
|
+
required: false,
|
|
4221
|
+
default: false
|
|
4222
|
+
},
|
|
4223
|
+
as: {
|
|
4224
|
+
type: null,
|
|
4225
|
+
required: false,
|
|
4226
|
+
default: "span"
|
|
4227
|
+
},
|
|
4228
|
+
class: {
|
|
4229
|
+
type: Function,
|
|
4230
|
+
required: false,
|
|
4231
|
+
skipCheck: true
|
|
4232
|
+
},
|
|
4233
|
+
style: {
|
|
4234
|
+
type: [
|
|
4235
|
+
Boolean,
|
|
4236
|
+
null,
|
|
4237
|
+
String,
|
|
4238
|
+
Object,
|
|
4239
|
+
Array,
|
|
4240
|
+
Function
|
|
4241
|
+
],
|
|
4242
|
+
required: false,
|
|
4243
|
+
skipCheck: true
|
|
4244
|
+
}
|
|
4245
|
+
},
|
|
4246
|
+
emits: ["checkedChange"],
|
|
4247
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4248
|
+
const props = __props;
|
|
4249
|
+
const emit = __emit;
|
|
4250
|
+
const attrsObject = (0, vue.useAttrs)();
|
|
4251
|
+
const instance = (0, vue.getCurrentInstance)();
|
|
4252
|
+
const { clearErrors } = require_checkbox_group_CheckboxGroup.useFormContext();
|
|
4253
|
+
const { disabled: fieldDisabled, name: fieldName, setDirty, setFilled, setFocused, setTouched, state: fieldState, validationMode, validityData, shouldValidateOnChange, validation } = require_checkbox_group_CheckboxGroup.useFieldRootContext();
|
|
4254
|
+
const labelableContext = require_checkbox_group_CheckboxGroup.useLabelableContext();
|
|
4255
|
+
const disabled = (0, vue.computed)(() => fieldDisabled.value || props.disabled);
|
|
4256
|
+
const name = (0, vue.computed)(() => fieldName.value ?? props.name);
|
|
4257
|
+
const rootElementId = require_checkbox_group_CheckboxGroup.useBaseUiId();
|
|
4258
|
+
const controlId = require_control_FieldControl.useLabelableId({ id: () => props.id });
|
|
4259
|
+
const inputId = (0, vue.computed)(() => props.nativeButton ? void 0 : controlId.value);
|
|
4260
|
+
const { value: checked, setValue: setCheckedState } = require_checkbox_group_CheckboxGroup.useControllableState({
|
|
4261
|
+
controlled: () => instance?.vnode.props && Object.prototype.hasOwnProperty.call(instance.vnode.props, "checked") ? props.checked : void 0,
|
|
4262
|
+
default: () => props.defaultChecked,
|
|
4263
|
+
name: "Switch",
|
|
4264
|
+
state: "checked"
|
|
4265
|
+
});
|
|
4266
|
+
const controlRef = (0, vue.ref)(null);
|
|
4267
|
+
const inputElementRef = (0, vue.ref)(null);
|
|
4268
|
+
const mergedInputRef = require_button_Button.useMergedRefs(inputElementRef, props.inputRef);
|
|
4269
|
+
require_checkbox_group_CheckboxGroup.useField({
|
|
4270
|
+
id: (0, vue.computed)(() => rootElementId),
|
|
4271
|
+
commit: (value) => validation.commit(value),
|
|
4272
|
+
value: checked,
|
|
4273
|
+
controlRef,
|
|
4274
|
+
name,
|
|
4275
|
+
getValue: () => checked.value
|
|
4276
|
+
});
|
|
4277
|
+
const ariaLabelledBy = require_checkbox_index.useAriaLabelledBy({
|
|
4278
|
+
ariaLabelledBy: (0, vue.computed)(() => props["aria-labelledby"]),
|
|
4279
|
+
labelId: labelableContext.labelId,
|
|
4280
|
+
labelSourceRef: inputElementRef,
|
|
4281
|
+
enableFallback: !props.nativeButton,
|
|
4282
|
+
labelSourceId: inputId
|
|
4283
|
+
});
|
|
4284
|
+
(0, vue.watchEffect)(() => {
|
|
4285
|
+
if (checked.value) setFilled(true);
|
|
4286
|
+
});
|
|
4287
|
+
(0, vue.watchEffect)(() => {
|
|
4288
|
+
if (!inputElementRef.value) return;
|
|
4289
|
+
validation.setInputRef(inputElementRef.value);
|
|
4290
|
+
});
|
|
4291
|
+
(0, vue.watch)(() => checked.value, (nextChecked) => {
|
|
4292
|
+
clearErrors(name.value);
|
|
4293
|
+
setFilled(nextChecked);
|
|
4294
|
+
setDirty(nextChecked !== validityData.value.initialValue);
|
|
4295
|
+
if (shouldValidateOnChange()) validation.commit(nextChecked);
|
|
4296
|
+
else validation.commit(nextChecked, true);
|
|
4297
|
+
}, { flush: "sync" });
|
|
4298
|
+
const { getButtonProps, buttonRef } = require_button_Button.useButton({
|
|
4299
|
+
disabled,
|
|
4300
|
+
native: (0, vue.computed)(() => props.nativeButton)
|
|
4301
|
+
});
|
|
4302
|
+
function combineDescriptionProps(localProps, validationProps) {
|
|
4303
|
+
const localDescribedBy = localProps["aria-describedby"];
|
|
4304
|
+
const validationDescribedBy = validationProps["aria-describedby"];
|
|
4305
|
+
const describedBy = Array.from(new Set([localDescribedBy, validationDescribedBy].filter(Boolean).flatMap((value) => String(value).split(/\s+/).filter(Boolean)))).join(" ") || void 0;
|
|
4306
|
+
return {
|
|
4307
|
+
...localProps,
|
|
4308
|
+
...validationProps,
|
|
4309
|
+
"aria-describedby": describedBy
|
|
4310
|
+
};
|
|
4311
|
+
}
|
|
4312
|
+
function applyCheckedChange(nextChecked, event, onApplied) {
|
|
4313
|
+
const details = require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.none, event);
|
|
4314
|
+
emit("checkedChange", nextChecked, details);
|
|
4315
|
+
if (details.isCanceled) return false;
|
|
4316
|
+
onApplied?.();
|
|
4317
|
+
setCheckedState(nextChecked);
|
|
4318
|
+
return true;
|
|
4319
|
+
}
|
|
4320
|
+
function handleInputChange(event) {
|
|
4321
|
+
const target = event.currentTarget;
|
|
4322
|
+
if (props.readOnly || disabled.value) {
|
|
4323
|
+
event.preventDefault();
|
|
4324
|
+
event.stopPropagation();
|
|
4325
|
+
target.checked = checked.value;
|
|
4326
|
+
return;
|
|
4327
|
+
}
|
|
4328
|
+
if (!applyCheckedChange(target.checked, event)) target.checked = checked.value;
|
|
4329
|
+
}
|
|
4330
|
+
function handleRootClick(event) {
|
|
4331
|
+
if (props.readOnly || disabled.value) return;
|
|
4332
|
+
event.preventDefault();
|
|
4333
|
+
const nextChecked = !checked.value;
|
|
4334
|
+
applyCheckedChange(nextChecked, event, () => {
|
|
4335
|
+
if (inputElementRef.value) inputElementRef.value.checked = nextChecked;
|
|
4336
|
+
});
|
|
4337
|
+
}
|
|
4338
|
+
function handleFocus() {
|
|
4339
|
+
if (!disabled.value) setFocused(true);
|
|
4340
|
+
}
|
|
4341
|
+
function handleBlur() {
|
|
4342
|
+
if (disabled.value) return;
|
|
4343
|
+
setTouched(true);
|
|
4344
|
+
setFocused(false);
|
|
4345
|
+
if (validationMode.value === "onBlur") validation.commit(checked.value);
|
|
4346
|
+
}
|
|
4347
|
+
const state = (0, vue.computed)(() => ({
|
|
4348
|
+
...fieldState.value,
|
|
4349
|
+
checked: checked.value,
|
|
4350
|
+
disabled: disabled.value,
|
|
4351
|
+
readOnly: props.readOnly,
|
|
4352
|
+
required: props.required
|
|
4353
|
+
}));
|
|
4354
|
+
(0, vue.provide)(switchRootContextKey, state);
|
|
4355
|
+
__expose({ element: controlRef });
|
|
4356
|
+
const mergedRootRef = require_button_Button.useMergedRefs(buttonRef, controlRef);
|
|
4357
|
+
const buttonInteractionAttrs = (0, vue.computed)(() => ({
|
|
4358
|
+
onClick: attrsObject.onClick,
|
|
4359
|
+
onKeydown: attrsObject.onKeydown,
|
|
4360
|
+
onKeyup: attrsObject.onKeyup,
|
|
4361
|
+
onMousedown: attrsObject.onMousedown,
|
|
4362
|
+
onPointerdown: attrsObject.onPointerdown
|
|
4363
|
+
}));
|
|
4364
|
+
const passthroughAttrs = (0, vue.computed)(() => {
|
|
4365
|
+
const { onClick, onKeydown, onKeyup, onMousedown, onPointerdown, ...rest } = attrsObject;
|
|
4366
|
+
return rest;
|
|
4367
|
+
});
|
|
4368
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
4369
|
+
componentProps: props,
|
|
4370
|
+
state,
|
|
4371
|
+
props: (0, vue.computed)(() => {
|
|
4372
|
+
const localDescriptionProps = labelableContext.getDescriptionProps();
|
|
4373
|
+
const validationProps = validation.getValidationProps();
|
|
4374
|
+
return require_button_Button.mergeProps(getButtonProps(require_button_Button.mergeProps(buttonInteractionAttrs.value, { onClick: handleRootClick })), combineDescriptionProps(localDescriptionProps, validationProps), {
|
|
4375
|
+
"id": props.nativeButton ? controlId.value : rootElementId,
|
|
4376
|
+
"role": "switch",
|
|
4377
|
+
"aria-checked": checked.value,
|
|
4378
|
+
"aria-readonly": props.readOnly || void 0,
|
|
4379
|
+
"aria-required": props.required || void 0,
|
|
4380
|
+
"aria-labelledby": ariaLabelledBy.value,
|
|
4381
|
+
"onFocus": handleFocus,
|
|
4382
|
+
"onBlur": handleBlur
|
|
4383
|
+
}, passthroughAttrs.value);
|
|
4384
|
+
}),
|
|
4385
|
+
stateAttributesMapping,
|
|
4386
|
+
defaultTagName: "span",
|
|
4387
|
+
ref: mergedRootRef
|
|
4388
|
+
});
|
|
4389
|
+
const inputProps = (0, vue.computed)(() => {
|
|
4390
|
+
const localDescriptionProps = labelableContext.getDescriptionProps();
|
|
4391
|
+
const validationProps = validation.getInputValidationProps();
|
|
4392
|
+
return require_button_Button.mergeProps({
|
|
4393
|
+
"checked": checked.value,
|
|
4394
|
+
"disabled": disabled.value,
|
|
4395
|
+
"form": props.form,
|
|
4396
|
+
"id": props.nativeButton ? void 0 : inputId.value,
|
|
4397
|
+
"name": name.value,
|
|
4398
|
+
"required": props.required,
|
|
4399
|
+
"type": "checkbox",
|
|
4400
|
+
"aria-hidden": true,
|
|
4401
|
+
"tabindex": -1,
|
|
4402
|
+
"style": name.value ? require_checkbox_index.visuallyHiddenInput : require_checkbox_index.visuallyHidden,
|
|
4403
|
+
"onChange": handleInputChange,
|
|
4404
|
+
onFocus() {
|
|
4405
|
+
controlRef.value?.focus();
|
|
4406
|
+
}
|
|
4407
|
+
}, props.value !== void 0 ? { value: props.value } : require_button_Button.EMPTY_OBJECT, combineDescriptionProps(localDescriptionProps, validationProps));
|
|
4408
|
+
});
|
|
4409
|
+
return (_ctx, _cache) => {
|
|
4410
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, [
|
|
4411
|
+
(0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
4412
|
+
key: 0,
|
|
4413
|
+
ref: (0, vue.unref)(renderRef),
|
|
4414
|
+
props: (0, vue.unref)(mergedProps),
|
|
4415
|
+
state: state.value
|
|
4416
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
4417
|
+
key: 1,
|
|
4418
|
+
ref: (0, vue.unref)(renderRef)
|
|
4419
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
4420
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
4421
|
+
_: 3
|
|
4422
|
+
}, 16)),
|
|
4423
|
+
!(0, vue.unref)(checked) && !disabled.value && name.value && __props.uncheckedValue !== void 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("input", {
|
|
4424
|
+
key: 2,
|
|
4425
|
+
type: "hidden",
|
|
4426
|
+
form: __props.form,
|
|
4427
|
+
name: name.value,
|
|
4428
|
+
value: __props.uncheckedValue
|
|
4429
|
+
}, null, 8, _hoisted_1)) : (0, vue.createCommentVNode)("v-if", true),
|
|
4430
|
+
(0, vue.createElementVNode)("input", (0, vue.mergeProps)({ ref: (0, vue.unref)(mergedInputRef) }, inputProps.value), null, 16)
|
|
4431
|
+
], 64);
|
|
4432
|
+
};
|
|
4433
|
+
}
|
|
4434
|
+
});
|
|
4435
|
+
|
|
4436
|
+
//#endregion
|
|
4437
|
+
//#region src/switch/root/SwitchRoot.vue
|
|
4438
|
+
var SwitchRoot_default = SwitchRoot_vue_vue_type_script_setup_true_lang_default;
|
|
4439
|
+
|
|
4440
|
+
//#endregion
|
|
4441
|
+
//#region src/switch/thumb/SwitchThumb.vue?vue&type=script&setup=true&lang.ts
|
|
4442
|
+
/**
|
|
4443
|
+
* The movable part of the switch that indicates whether the switch is on or off.
|
|
4444
|
+
* Renders a `<span>`.
|
|
4445
|
+
*
|
|
4446
|
+
* Documentation: [Base UI Vue Switch](https://baseui-vue.com/docs/components/switch)
|
|
4447
|
+
*/
|
|
4448
|
+
var SwitchThumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4449
|
+
name: "SwitchThumb",
|
|
4450
|
+
inheritAttrs: false,
|
|
4451
|
+
__name: "SwitchThumb",
|
|
4452
|
+
props: {
|
|
4453
|
+
as: {
|
|
4454
|
+
type: null,
|
|
4455
|
+
required: false,
|
|
4456
|
+
default: "span"
|
|
4457
|
+
},
|
|
4458
|
+
class: {
|
|
4459
|
+
type: Function,
|
|
4460
|
+
required: false,
|
|
4461
|
+
skipCheck: true
|
|
4462
|
+
},
|
|
4463
|
+
style: {
|
|
4464
|
+
type: [
|
|
4465
|
+
Boolean,
|
|
4466
|
+
null,
|
|
4467
|
+
String,
|
|
4468
|
+
Object,
|
|
4469
|
+
Array,
|
|
4470
|
+
Function
|
|
4471
|
+
],
|
|
4472
|
+
required: false,
|
|
4473
|
+
skipCheck: true
|
|
4474
|
+
}
|
|
4475
|
+
},
|
|
4476
|
+
setup(__props) {
|
|
4477
|
+
const props = __props;
|
|
4478
|
+
const attrsObject = (0, vue.useAttrs)();
|
|
4479
|
+
const { state: fieldState } = require_checkbox_group_CheckboxGroup.useFieldRootContext();
|
|
4480
|
+
const rootState = useSwitchRootContext();
|
|
4481
|
+
const state = (0, vue.computed)(() => ({
|
|
4482
|
+
...fieldState.value,
|
|
4483
|
+
...rootState.value
|
|
4484
|
+
}));
|
|
4485
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
4486
|
+
componentProps: props,
|
|
4487
|
+
state,
|
|
4488
|
+
props: (0, vue.computed)(() => attrsObject),
|
|
4489
|
+
stateAttributesMapping,
|
|
4490
|
+
defaultTagName: "span"
|
|
4491
|
+
});
|
|
4492
|
+
return (_ctx, _cache) => {
|
|
4493
|
+
return (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
4494
|
+
key: 0,
|
|
4495
|
+
ref: (0, vue.unref)(renderRef),
|
|
4496
|
+
props: (0, vue.unref)(mergedProps),
|
|
4497
|
+
state: state.value
|
|
4498
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
4499
|
+
key: 1,
|
|
4500
|
+
ref: (0, vue.unref)(renderRef)
|
|
4501
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
4502
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
4503
|
+
_: 3
|
|
4504
|
+
}, 16));
|
|
4505
|
+
};
|
|
4506
|
+
}
|
|
4507
|
+
});
|
|
4508
|
+
|
|
4509
|
+
//#endregion
|
|
4510
|
+
//#region src/switch/thumb/SwitchThumb.vue
|
|
4511
|
+
var SwitchThumb_default = SwitchThumb_vue_vue_type_script_setup_true_lang_default;
|
|
4512
|
+
|
|
4513
|
+
//#endregion
|
|
4514
|
+
//#region src/switch/thumb/SwitchThumbDataAttributes.ts
|
|
4515
|
+
let SwitchThumbDataAttributes = /* @__PURE__ */ function(SwitchThumbDataAttributes) {
|
|
4516
|
+
/**
|
|
4517
|
+
* Present when the switch is checked.
|
|
4518
|
+
*/
|
|
4519
|
+
SwitchThumbDataAttributes["checked"] = "data-checked";
|
|
4520
|
+
/**
|
|
4521
|
+
* Present when the switch is not checked.
|
|
4522
|
+
*/
|
|
4523
|
+
SwitchThumbDataAttributes["unchecked"] = "data-unchecked";
|
|
4524
|
+
/**
|
|
4525
|
+
* Present when the switch is disabled.
|
|
4526
|
+
*/
|
|
4527
|
+
SwitchThumbDataAttributes["disabled"] = "data-disabled";
|
|
4528
|
+
/**
|
|
4529
|
+
* Present when the switch is readonly.
|
|
4530
|
+
*/
|
|
4531
|
+
SwitchThumbDataAttributes["readonly"] = "data-readonly";
|
|
4532
|
+
/**
|
|
4533
|
+
* Present when the switch is required.
|
|
4534
|
+
*/
|
|
4535
|
+
SwitchThumbDataAttributes["required"] = "data-required";
|
|
4536
|
+
/**
|
|
4537
|
+
* Present when the switch is in valid state (when wrapped in FieldRoot).
|
|
4538
|
+
*/
|
|
4539
|
+
SwitchThumbDataAttributes["valid"] = "data-valid";
|
|
4540
|
+
/**
|
|
4541
|
+
* Present when the switch is in invalid state (when wrapped in FieldRoot).
|
|
4542
|
+
*/
|
|
4543
|
+
SwitchThumbDataAttributes["invalid"] = "data-invalid";
|
|
4544
|
+
/**
|
|
4545
|
+
* Present when the switch has been touched (when wrapped in FieldRoot).
|
|
4546
|
+
*/
|
|
4547
|
+
SwitchThumbDataAttributes["touched"] = "data-touched";
|
|
4548
|
+
/**
|
|
4549
|
+
* Present when the switch's value has changed (when wrapped in FieldRoot).
|
|
4550
|
+
*/
|
|
4551
|
+
SwitchThumbDataAttributes["dirty"] = "data-dirty";
|
|
4552
|
+
/**
|
|
4553
|
+
* Present when the switch is active (when wrapped in FieldRoot).
|
|
4554
|
+
*/
|
|
4555
|
+
SwitchThumbDataAttributes["filled"] = "data-filled";
|
|
4556
|
+
/**
|
|
4557
|
+
* Present when the switch is focused (when wrapped in FieldRoot).
|
|
4558
|
+
*/
|
|
4559
|
+
SwitchThumbDataAttributes["focused"] = "data-focused";
|
|
4560
|
+
return SwitchThumbDataAttributes;
|
|
4561
|
+
}({});
|
|
4562
|
+
|
|
4563
|
+
//#endregion
|
|
4564
|
+
//#region src/toggle-group/ToggleGroupContext.ts
|
|
4565
|
+
const toggleGroupContextKey = Symbol("ToggleGroupContext");
|
|
4566
|
+
function useToggleGroupContext(optional = false) {
|
|
4567
|
+
const context = (0, vue.inject)(toggleGroupContextKey, void 0);
|
|
4568
|
+
if (context === void 0 && !optional) throw new Error("Base UI Vue: ToggleGroupContext is missing. ToggleGroup parts must be placed within <ToggleGroup>.");
|
|
4569
|
+
return context;
|
|
4570
|
+
}
|
|
4571
|
+
|
|
4572
|
+
//#endregion
|
|
4573
|
+
//#region src/toggle/Toggle.vue?vue&type=script&setup=true&lang.ts
|
|
4574
|
+
/**
|
|
4575
|
+
* A two-state button that can be on or off.
|
|
4576
|
+
* Renders a `<button>` element.
|
|
4577
|
+
*
|
|
4578
|
+
* Documentation: [Base UI Vue Toggle](https://baseui-vue.com/docs/components/toggle)
|
|
4579
|
+
*/
|
|
4580
|
+
var Toggle_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4581
|
+
name: "Toggle",
|
|
4582
|
+
inheritAttrs: false,
|
|
4583
|
+
__name: "Toggle",
|
|
4584
|
+
props: {
|
|
4585
|
+
pressed: {
|
|
4586
|
+
type: Boolean,
|
|
4587
|
+
required: false
|
|
4588
|
+
},
|
|
4589
|
+
defaultPressed: {
|
|
4590
|
+
type: Boolean,
|
|
4591
|
+
required: false,
|
|
4592
|
+
default: false
|
|
4593
|
+
},
|
|
4594
|
+
disabled: {
|
|
4595
|
+
type: Boolean,
|
|
4596
|
+
required: false,
|
|
4597
|
+
default: false
|
|
4598
|
+
},
|
|
4599
|
+
value: {
|
|
4600
|
+
type: null,
|
|
4601
|
+
required: false
|
|
4602
|
+
},
|
|
4603
|
+
nativeButton: {
|
|
4604
|
+
type: Boolean,
|
|
4605
|
+
required: false,
|
|
4606
|
+
default: true
|
|
4607
|
+
},
|
|
4608
|
+
as: {
|
|
4609
|
+
type: null,
|
|
4610
|
+
required: false,
|
|
4611
|
+
default: "button"
|
|
4612
|
+
},
|
|
4613
|
+
class: {
|
|
4614
|
+
type: Function,
|
|
4615
|
+
required: false,
|
|
4616
|
+
skipCheck: true
|
|
4617
|
+
},
|
|
4618
|
+
style: {
|
|
4619
|
+
type: [
|
|
4620
|
+
Boolean,
|
|
4621
|
+
null,
|
|
4622
|
+
String,
|
|
4623
|
+
Object,
|
|
4624
|
+
Array,
|
|
4625
|
+
Function
|
|
4626
|
+
],
|
|
4627
|
+
required: false,
|
|
4628
|
+
skipCheck: true
|
|
4629
|
+
}
|
|
4630
|
+
},
|
|
4631
|
+
emits: ["pressedChange"],
|
|
4632
|
+
setup(__props, { emit: __emit }) {
|
|
4633
|
+
const props = __props;
|
|
4634
|
+
const emit = __emit;
|
|
4635
|
+
const attrs = (0, vue.useAttrs)();
|
|
4636
|
+
const instance = (0, vue.getCurrentInstance)();
|
|
4637
|
+
const groupContext = useToggleGroupContext(true);
|
|
4638
|
+
const generatedValue = require_checkbox_group_CheckboxGroup.useBaseUiId();
|
|
4639
|
+
const toggleValue = (0, vue.computed)(() => props.value || generatedValue);
|
|
4640
|
+
const groupValue = (0, vue.computed)(() => groupContext?.value.value ?? []);
|
|
4641
|
+
const disabled = (0, vue.computed)(() => props.disabled || (groupContext?.disabled.value ?? false));
|
|
4642
|
+
if (process.env.NODE_ENV !== "production") (0, vue.watchEffect)(() => {
|
|
4643
|
+
if (groupContext && props.value === void 0 && groupContext.isValueInitialized.value) require_button_Button.error("A `<Toggle>` component rendered in a `<ToggleGroup>` has no explicit `value` prop.", "This will cause issues between the Toggle Group and Toggle values.", "Provide the `<Toggle>` with a `value` prop matching the `<ToggleGroup>` values prop type.");
|
|
4644
|
+
});
|
|
4645
|
+
const hasPressedProp = (0, vue.computed)(() => Boolean(instance?.vnode.props && Object.prototype.hasOwnProperty.call(instance.vnode.props, "pressed")));
|
|
4646
|
+
const { value: pressed, setValue: setPressedState } = require_checkbox_group_CheckboxGroup.useControllableState({
|
|
4647
|
+
controlled: () => {
|
|
4648
|
+
if (groupContext) return toggleValue.value !== void 0 && groupValue.value.includes(toggleValue.value);
|
|
4649
|
+
return hasPressedProp.value ? props.pressed : void 0;
|
|
4650
|
+
},
|
|
4651
|
+
default: () => props.defaultPressed,
|
|
4652
|
+
name: "Toggle",
|
|
4653
|
+
state: "pressed"
|
|
4654
|
+
});
|
|
4655
|
+
function emitPressedChange(nextPressed, eventDetails) {
|
|
4656
|
+
if (toggleValue.value !== void 0) groupContext?.setGroupValue(toggleValue.value, nextPressed, eventDetails);
|
|
4657
|
+
emit("pressedChange", nextPressed, eventDetails);
|
|
4658
|
+
}
|
|
4659
|
+
const { getButtonProps, buttonRef } = require_button_Button.useButton({
|
|
4660
|
+
disabled,
|
|
4661
|
+
native: () => props.nativeButton ?? true
|
|
4662
|
+
});
|
|
4663
|
+
const state = (0, vue.computed)(() => ({
|
|
4664
|
+
disabled: disabled.value,
|
|
4665
|
+
pressed: pressed.value
|
|
4666
|
+
}));
|
|
4667
|
+
const buttonAttrs = (0, vue.computed)(() => {
|
|
4668
|
+
const { form: _form, type: _type, ...rest } = attrs;
|
|
4669
|
+
return rest;
|
|
4670
|
+
});
|
|
4671
|
+
function createToggleButtonProps() {
|
|
4672
|
+
return require_button_Button.mergeProps(getButtonProps(require_button_Button.mergeProps(buttonAttrs.value, {
|
|
4673
|
+
"aria-pressed": pressed.value,
|
|
4674
|
+
onClick(event) {
|
|
4675
|
+
const nextPressed = !pressed.value;
|
|
4676
|
+
const details = require_checkbox_index.createChangeEventDetails(require_checkbox_index.REASONS.none, event);
|
|
4677
|
+
emitPressedChange(nextPressed, details);
|
|
4678
|
+
if (details.isCanceled) return;
|
|
4679
|
+
setPressedState(nextPressed);
|
|
4680
|
+
}
|
|
4681
|
+
})), groupContext ? { "aria-disabled": disabled.value ? "true" : "false" } : void 0);
|
|
4682
|
+
}
|
|
4683
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
4684
|
+
componentProps: props,
|
|
4685
|
+
state,
|
|
4686
|
+
props: (0, vue.computed)(() => createToggleButtonProps()),
|
|
4687
|
+
defaultTagName: "button",
|
|
4688
|
+
ref: buttonRef
|
|
4689
|
+
});
|
|
4690
|
+
const itemRefs = [buttonRef];
|
|
4691
|
+
return (_ctx, _cache) => {
|
|
4692
|
+
return (0, vue.unref)(groupContext) ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_button_ToolbarButton.CompositeItem_default, {
|
|
4693
|
+
key: 0,
|
|
4694
|
+
as: __props.as,
|
|
4695
|
+
class: (0, vue.normalizeClass)(props.class),
|
|
4696
|
+
style: (0, vue.normalizeStyle)(props.style),
|
|
4697
|
+
state: state.value,
|
|
4698
|
+
refs: itemRefs,
|
|
4699
|
+
props: [() => createToggleButtonProps()]
|
|
4700
|
+
}, {
|
|
4701
|
+
default: (0, vue.withCtx)((slotProps) => [(0, vue.renderSlot)(_ctx.$slots, "default", (0, vue.normalizeProps)((0, vue.guardReactiveProps)(slotProps)))]),
|
|
4702
|
+
_: 3
|
|
4703
|
+
}, 8, [
|
|
4704
|
+
"as",
|
|
4705
|
+
"class",
|
|
4706
|
+
"style",
|
|
4707
|
+
"state",
|
|
4708
|
+
"props"
|
|
4709
|
+
])) : (0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
4710
|
+
key: 1,
|
|
4711
|
+
ref: (0, vue.unref)(renderRef),
|
|
4712
|
+
props: (0, vue.unref)(mergedProps),
|
|
4713
|
+
state: state.value
|
|
4714
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
4715
|
+
key: 2,
|
|
4716
|
+
ref: (0, vue.unref)(renderRef)
|
|
4717
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
4718
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
4719
|
+
_: 3
|
|
4720
|
+
}, 16));
|
|
4721
|
+
};
|
|
4722
|
+
}
|
|
4723
|
+
});
|
|
4724
|
+
|
|
4725
|
+
//#endregion
|
|
4726
|
+
//#region src/toggle/Toggle.vue
|
|
4727
|
+
var Toggle_default = Toggle_vue_vue_type_script_setup_true_lang_default;
|
|
4728
|
+
|
|
4729
|
+
//#endregion
|
|
4730
|
+
//#region src/toggle/ToggleDataAttributes.ts
|
|
4731
|
+
let ToggleDataAttributes = /* @__PURE__ */ function(ToggleDataAttributes) {
|
|
4732
|
+
/**
|
|
4733
|
+
* Present when the toggle button is pressed.
|
|
4734
|
+
*/
|
|
4735
|
+
ToggleDataAttributes["pressed"] = "data-pressed";
|
|
4736
|
+
return ToggleDataAttributes;
|
|
4737
|
+
}({});
|
|
4738
|
+
|
|
4739
|
+
//#endregion
|
|
4740
|
+
//#region src/composite/root/useCompositeRoot.ts
|
|
4741
|
+
const EMPTY_ARRAY = [];
|
|
4742
|
+
function useCompositeRoot(params) {
|
|
4743
|
+
const orientation = (0, vue.computed)(() => params.orientation?.() ?? "both");
|
|
4744
|
+
const cols = (0, vue.computed)(() => params.cols?.() ?? 1);
|
|
4745
|
+
const loopFocus = (0, vue.computed)(() => params.loopFocus?.() ?? true);
|
|
4746
|
+
const dense = (0, vue.computed)(() => params.dense?.() ?? false);
|
|
4747
|
+
const itemSizes = (0, vue.computed)(() => params.itemSizes?.());
|
|
4748
|
+
const enableHomeAndEndKeys = (0, vue.computed)(() => params.enableHomeAndEndKeys?.() ?? false);
|
|
4749
|
+
const stopEventPropagation = (0, vue.computed)(() => params.stopEventPropagation?.() ?? false);
|
|
4750
|
+
const disabledIndices = (0, vue.computed)(() => params.disabledIndices?.() ?? EMPTY_ARRAY);
|
|
4751
|
+
const modifierKeys = (0, vue.computed)(() => params.modifierKeys?.() ?? EMPTY_ARRAY);
|
|
4752
|
+
const externalHighlightedIndex = (0, vue.computed)(() => params.highlightedIndex?.());
|
|
4753
|
+
const externalSetHighlightedIndex = params.onHighlightedIndexChange;
|
|
4754
|
+
const internalHighlightedIndex = (0, vue.ref)(params.defaultHighlightedIndex?.() ?? 0);
|
|
4755
|
+
const isGrid = (0, vue.computed)(() => cols.value > 1);
|
|
4756
|
+
const rootRef = (0, vue.ref)(null);
|
|
4757
|
+
const mergedRef = require_button_Button.useMergedRefs(rootRef, params.rootRef);
|
|
4758
|
+
const elementsRef = (0, vue.ref)([]);
|
|
4759
|
+
let hasSetDefaultIndex = false;
|
|
4760
|
+
const highlightedIndex = (0, vue.computed)(() => externalHighlightedIndex.value ?? internalHighlightedIndex.value);
|
|
4761
|
+
function onHighlightedIndexChange(index, shouldScrollIntoView = false) {
|
|
4762
|
+
if (externalHighlightedIndex.value !== void 0) {
|
|
4763
|
+
if (externalSetHighlightedIndex) externalSetHighlightedIndex(index);
|
|
4764
|
+
} else {
|
|
4765
|
+
internalHighlightedIndex.value = index;
|
|
4766
|
+
if (externalSetHighlightedIndex) externalSetHighlightedIndex(index);
|
|
4767
|
+
}
|
|
4768
|
+
if (shouldScrollIntoView) {
|
|
4769
|
+
const newActiveItem = elementsRef.value[index];
|
|
4770
|
+
require_composite_composite.scrollIntoViewIfNeeded(rootRef.value, newActiveItem, params.direction(), orientation.value);
|
|
4771
|
+
}
|
|
4772
|
+
}
|
|
4773
|
+
function onMapChange(map) {
|
|
4774
|
+
if (map.size === 0 || hasSetDefaultIndex) return;
|
|
4775
|
+
hasSetDefaultIndex = true;
|
|
4776
|
+
const sortedElements = Array.from(map.keys());
|
|
4777
|
+
const activeItem = sortedElements.find((compositeElement) => compositeElement?.hasAttribute(require_composite_constants.ACTIVE_COMPOSITE_ITEM)) ?? null;
|
|
4778
|
+
const activeIndex = activeItem ? sortedElements.indexOf(activeItem) : -1;
|
|
4779
|
+
if (activeIndex !== -1) onHighlightedIndexChange(activeIndex);
|
|
4780
|
+
require_composite_composite.scrollIntoViewIfNeeded(rootRef.value, activeItem, params.direction(), orientation.value);
|
|
4781
|
+
}
|
|
4782
|
+
function handleFocus(event) {
|
|
4783
|
+
if (!rootRef.value || !require_composite_composite.isNativeInput(event.target)) return;
|
|
4784
|
+
const target = event.target;
|
|
4785
|
+
target.setSelectionRange(0, target.value.length ?? 0);
|
|
4786
|
+
}
|
|
4787
|
+
function handleKeydown(event) {
|
|
4788
|
+
const RELEVANT_KEYS = enableHomeAndEndKeys.value ? require_composite_composite.ALL_KEYS : require_composite_composite.ARROW_KEYS;
|
|
4789
|
+
if (!RELEVANT_KEYS.has(event.key)) return;
|
|
4790
|
+
if (isModifierKeySet(event, modifierKeys.value)) return;
|
|
4791
|
+
if (!rootRef.value) return;
|
|
4792
|
+
const isRtl = params.direction() === "rtl";
|
|
4793
|
+
const horizontalForwardKey = isRtl ? require_composite_composite.ARROW_LEFT : require_composite_composite.ARROW_RIGHT;
|
|
4794
|
+
const forwardKey = {
|
|
4795
|
+
horizontal: horizontalForwardKey,
|
|
4796
|
+
vertical: require_composite_composite.ARROW_DOWN,
|
|
4797
|
+
both: horizontalForwardKey
|
|
4798
|
+
}[orientation.value];
|
|
4799
|
+
const horizontalBackwardKey = isRtl ? require_composite_composite.ARROW_RIGHT : require_composite_composite.ARROW_LEFT;
|
|
4800
|
+
const backwardKey = {
|
|
4801
|
+
horizontal: horizontalBackwardKey,
|
|
4802
|
+
vertical: require_composite_composite.ARROW_UP,
|
|
4803
|
+
both: horizontalBackwardKey
|
|
4804
|
+
}[orientation.value];
|
|
4805
|
+
if (require_composite_composite.isNativeInput(event.target) && !isElementDisabled(event.target)) {
|
|
4806
|
+
const target = event.target;
|
|
4807
|
+
const selectionStart = target.selectionStart;
|
|
4808
|
+
const selectionEnd = target.selectionEnd;
|
|
4809
|
+
const textContent = target.value ?? "";
|
|
4810
|
+
if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) return;
|
|
4811
|
+
if (event.key !== backwardKey && selectionStart < textContent.length) return;
|
|
4812
|
+
if (event.key !== forwardKey && selectionStart > 0) return;
|
|
4813
|
+
}
|
|
4814
|
+
let nextIndex = highlightedIndex.value;
|
|
4815
|
+
const minIndex = getMinListIndex(elementsRef, disabledIndices.value);
|
|
4816
|
+
const maxIndex = getMaxListIndex(elementsRef, disabledIndices.value);
|
|
4817
|
+
if (isGrid.value) {
|
|
4818
|
+
const sizes = itemSizes.value || Array.from({ length: elementsRef.value.length }, () => ({
|
|
4819
|
+
width: 1,
|
|
4820
|
+
height: 1
|
|
4821
|
+
}));
|
|
4822
|
+
const cellMap = createGridCellMap(sizes, cols.value, dense.value);
|
|
4823
|
+
const minGridIndex = cellMap.findIndex((index) => index != null && !isListIndexDisabled(elementsRef, index, disabledIndices.value));
|
|
4824
|
+
const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !isListIndexDisabled(elementsRef, index, disabledIndices.value) ? cellIndex : foundIndex, -1);
|
|
4825
|
+
nextIndex = cellMap[getGridNavigatedIndex(elementsRef, {
|
|
4826
|
+
event,
|
|
4827
|
+
orientation: orientation.value,
|
|
4828
|
+
loopFocus: loopFocus.value,
|
|
4829
|
+
cols: cols.value,
|
|
4830
|
+
disabledIndices: getGridCellIndices([...(disabledIndices.value.length > 0 ? disabledIndices.value : void 0) || elementsRef.value.map((_, index) => isListIndexDisabled(elementsRef, index) ? index : void 0), void 0], cellMap),
|
|
4831
|
+
minIndex: minGridIndex,
|
|
4832
|
+
maxIndex: maxGridIndex,
|
|
4833
|
+
prevIndex: getGridCellIndexOfCorner(highlightedIndex.value > maxIndex ? minIndex : highlightedIndex.value, sizes, cellMap, cols.value, event.key === require_composite_composite.ARROW_DOWN ? "bl" : event.key === require_composite_composite.ARROW_RIGHT ? "tr" : "tl"),
|
|
4834
|
+
rtl: isRtl
|
|
4835
|
+
})];
|
|
4836
|
+
}
|
|
4837
|
+
const forwardKeys = {
|
|
4838
|
+
horizontal: [horizontalForwardKey],
|
|
4839
|
+
vertical: [require_composite_composite.ARROW_DOWN],
|
|
4840
|
+
both: [horizontalForwardKey, require_composite_composite.ARROW_DOWN]
|
|
4841
|
+
}[orientation.value];
|
|
4842
|
+
const backwardKeys = {
|
|
4843
|
+
horizontal: [horizontalBackwardKey],
|
|
4844
|
+
vertical: [require_composite_composite.ARROW_UP],
|
|
4845
|
+
both: [horizontalBackwardKey, require_composite_composite.ARROW_UP]
|
|
4846
|
+
}[orientation.value];
|
|
4847
|
+
const preventedKeys = isGrid.value ? RELEVANT_KEYS : {
|
|
4848
|
+
horizontal: enableHomeAndEndKeys.value ? require_composite_composite.HORIZONTAL_KEYS_WITH_EXTRA_KEYS : require_composite_composite.HORIZONTAL_KEYS,
|
|
4849
|
+
vertical: enableHomeAndEndKeys.value ? require_composite_composite.VERTICAL_KEYS_WITH_EXTRA_KEYS : require_composite_composite.VERTICAL_KEYS,
|
|
4850
|
+
both: RELEVANT_KEYS
|
|
4851
|
+
}[orientation.value];
|
|
4852
|
+
if (enableHomeAndEndKeys.value) {
|
|
4853
|
+
if (event.key === require_composite_composite.HOME) nextIndex = minIndex;
|
|
4854
|
+
else if (event.key === require_composite_composite.END) nextIndex = maxIndex;
|
|
4855
|
+
}
|
|
4856
|
+
if (nextIndex === highlightedIndex.value && (forwardKeys.includes(event.key) || backwardKeys.includes(event.key))) if (loopFocus.value && nextIndex === maxIndex && forwardKeys.includes(event.key)) nextIndex = minIndex;
|
|
4857
|
+
else if (loopFocus.value && nextIndex === minIndex && backwardKeys.includes(event.key)) nextIndex = maxIndex;
|
|
4858
|
+
else nextIndex = findNonDisabledListIndex(elementsRef, {
|
|
4859
|
+
startingIndex: nextIndex,
|
|
4860
|
+
decrement: backwardKeys.includes(event.key),
|
|
4861
|
+
disabledIndices: disabledIndices.value
|
|
4862
|
+
});
|
|
4863
|
+
if (nextIndex !== highlightedIndex.value && !isIndexOutOfListBounds(elementsRef, nextIndex)) {
|
|
4864
|
+
if (stopEventPropagation.value) event.stopPropagation();
|
|
4865
|
+
if (preventedKeys.has(event.key)) event.preventDefault();
|
|
4866
|
+
onHighlightedIndexChange(nextIndex, true);
|
|
4867
|
+
queueMicrotask(() => {
|
|
4868
|
+
elementsRef.value[nextIndex]?.focus();
|
|
4869
|
+
});
|
|
4870
|
+
}
|
|
4871
|
+
}
|
|
4872
|
+
return {
|
|
4873
|
+
getRootProps: (externalProps = {}) => ({
|
|
4874
|
+
...externalProps,
|
|
4875
|
+
"aria-orientation": orientation.value === "both" ? void 0 : orientation.value,
|
|
4876
|
+
onFocus(event) {
|
|
4877
|
+
externalProps.onFocus?.(event);
|
|
4878
|
+
if (!event.defaultPrevented) handleFocus(event);
|
|
4879
|
+
},
|
|
4880
|
+
onKeydown(event) {
|
|
4881
|
+
externalProps.onKeydown?.(event);
|
|
4882
|
+
if (!event.defaultPrevented) handleKeydown(event);
|
|
4883
|
+
}
|
|
4884
|
+
}),
|
|
4885
|
+
rootRef,
|
|
4886
|
+
mergedRef,
|
|
4887
|
+
highlightedIndex,
|
|
4888
|
+
onHighlightedIndexChange,
|
|
4889
|
+
elementsRef,
|
|
4890
|
+
disabledIndices,
|
|
4891
|
+
onMapChange,
|
|
4892
|
+
relayKeyboardEvent: handleKeydown
|
|
4893
|
+
};
|
|
4894
|
+
}
|
|
4895
|
+
function isModifierKeySet(event, ignoredModifierKeys) {
|
|
4896
|
+
for (const key of require_composite_composite.MODIFIER_KEYS.values()) {
|
|
4897
|
+
if (ignoredModifierKeys.includes(key)) continue;
|
|
4898
|
+
if (event.getModifierState(key)) return true;
|
|
4899
|
+
}
|
|
4900
|
+
return false;
|
|
4901
|
+
}
|
|
4902
|
+
|
|
4903
|
+
//#endregion
|
|
4904
|
+
//#region src/composite/root/CompositeRoot.vue?vue&type=script&setup=true&lang.ts
|
|
4905
|
+
var CompositeRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4906
|
+
name: "BaseUICompositeRoot",
|
|
4907
|
+
inheritAttrs: false,
|
|
4908
|
+
__name: "CompositeRoot",
|
|
4909
|
+
props: {
|
|
4910
|
+
state: {
|
|
4911
|
+
type: Object,
|
|
4912
|
+
required: false
|
|
4913
|
+
},
|
|
4914
|
+
stateAttributesMapping: {
|
|
4915
|
+
type: null,
|
|
4916
|
+
required: false
|
|
4917
|
+
},
|
|
4918
|
+
orientation: {
|
|
4919
|
+
type: String,
|
|
4920
|
+
required: false,
|
|
4921
|
+
default: "both"
|
|
4922
|
+
},
|
|
4923
|
+
cols: {
|
|
4924
|
+
type: Number,
|
|
4925
|
+
required: false,
|
|
4926
|
+
default: 1
|
|
4927
|
+
},
|
|
4928
|
+
loopFocus: {
|
|
4929
|
+
type: Boolean,
|
|
4930
|
+
required: false,
|
|
4931
|
+
default: true
|
|
4932
|
+
},
|
|
4933
|
+
highlightedIndex: {
|
|
4934
|
+
type: Number,
|
|
4935
|
+
required: false
|
|
4936
|
+
},
|
|
4937
|
+
defaultHighlightedIndex: {
|
|
4938
|
+
type: Number,
|
|
4939
|
+
required: false
|
|
4940
|
+
},
|
|
4941
|
+
itemSizes: {
|
|
4942
|
+
type: Array,
|
|
4943
|
+
required: false
|
|
4944
|
+
},
|
|
4945
|
+
dense: {
|
|
4946
|
+
type: Boolean,
|
|
4947
|
+
required: false,
|
|
4948
|
+
default: false
|
|
4949
|
+
},
|
|
4950
|
+
enableHomeAndEndKeys: {
|
|
4951
|
+
type: Boolean,
|
|
4952
|
+
required: false,
|
|
4953
|
+
default: false
|
|
4954
|
+
},
|
|
4955
|
+
stopEventPropagation: {
|
|
4956
|
+
type: Boolean,
|
|
4957
|
+
required: false,
|
|
4958
|
+
default: true
|
|
4959
|
+
},
|
|
4960
|
+
disabledIndices: {
|
|
4961
|
+
type: Array,
|
|
4962
|
+
required: false
|
|
4963
|
+
},
|
|
4964
|
+
modifierKeys: {
|
|
4965
|
+
type: Array,
|
|
4966
|
+
required: false
|
|
4967
|
+
},
|
|
4968
|
+
highlightItemOnHover: {
|
|
4969
|
+
type: Boolean,
|
|
4970
|
+
required: false,
|
|
4971
|
+
default: false
|
|
4972
|
+
},
|
|
4973
|
+
as: {
|
|
4974
|
+
type: null,
|
|
4975
|
+
required: false,
|
|
4976
|
+
default: "div"
|
|
4977
|
+
},
|
|
4978
|
+
class: {
|
|
4979
|
+
type: Function,
|
|
4980
|
+
required: false,
|
|
4981
|
+
skipCheck: true
|
|
4982
|
+
},
|
|
4983
|
+
style: {
|
|
4984
|
+
type: [
|
|
4985
|
+
Boolean,
|
|
4986
|
+
null,
|
|
4987
|
+
String,
|
|
4988
|
+
Object,
|
|
4989
|
+
Array,
|
|
4990
|
+
Function
|
|
4991
|
+
],
|
|
4992
|
+
required: false,
|
|
4993
|
+
skipCheck: true
|
|
4994
|
+
}
|
|
4995
|
+
},
|
|
4996
|
+
emits: ["update:highlightedIndex", "mapChange"],
|
|
4997
|
+
setup(__props, { emit: __emit }) {
|
|
4998
|
+
const props = __props;
|
|
4999
|
+
const emit = __emit;
|
|
5000
|
+
const attrs = (0, vue.useAttrs)();
|
|
5001
|
+
const direction = require_control_SliderControl.useDirection();
|
|
5002
|
+
const root = useCompositeRoot({
|
|
5003
|
+
orientation: () => props.orientation,
|
|
5004
|
+
cols: () => props.cols,
|
|
5005
|
+
loopFocus: () => props.loopFocus,
|
|
5006
|
+
highlightedIndex: () => props.highlightedIndex,
|
|
5007
|
+
defaultHighlightedIndex: () => props.defaultHighlightedIndex,
|
|
5008
|
+
onHighlightedIndexChange: (index) => {
|
|
5009
|
+
emit("update:highlightedIndex", index);
|
|
5010
|
+
},
|
|
5011
|
+
dense: () => props.dense,
|
|
5012
|
+
itemSizes: () => props.itemSizes,
|
|
5013
|
+
enableHomeAndEndKeys: () => props.enableHomeAndEndKeys,
|
|
5014
|
+
stopEventPropagation: () => props.stopEventPropagation,
|
|
5015
|
+
disabledIndices: () => props.disabledIndices,
|
|
5016
|
+
modifierKeys: () => props.modifierKeys,
|
|
5017
|
+
direction: () => direction.value
|
|
5018
|
+
});
|
|
5019
|
+
(0, vue.provide)(require_button_Button.compositeRootContextKey, (0, vue.reactive)({
|
|
5020
|
+
highlightedIndex: root.highlightedIndex,
|
|
5021
|
+
onHighlightedIndexChange: root.onHighlightedIndexChange,
|
|
5022
|
+
highlightItemOnHover: (0, vue.computed)(() => props.highlightItemOnHover),
|
|
5023
|
+
relayKeyboardEvent: root.relayKeyboardEvent
|
|
5024
|
+
}));
|
|
5025
|
+
const state = (0, vue.computed)(() => props.state ?? {});
|
|
5026
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
5027
|
+
componentProps: props,
|
|
5028
|
+
state,
|
|
5029
|
+
props: (0, vue.computed)(() => root.getRootProps(attrs)),
|
|
5030
|
+
stateAttributesMapping: props.stateAttributesMapping,
|
|
5031
|
+
defaultTagName: "div",
|
|
5032
|
+
ref: root.mergedRef
|
|
5033
|
+
});
|
|
5034
|
+
return (_ctx, _cache) => {
|
|
5035
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(CompositeList_default, {
|
|
5036
|
+
"elements-ref": (0, vue.unref)(root).elementsRef,
|
|
5037
|
+
onMapChange: _cache[0] || (_cache[0] = (newMap) => {
|
|
5038
|
+
emit("mapChange", newMap);
|
|
5039
|
+
(0, vue.unref)(root).onMapChange(newMap);
|
|
5040
|
+
})
|
|
5041
|
+
}, {
|
|
5042
|
+
default: (0, vue.withCtx)(() => [(0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5043
|
+
key: 0,
|
|
5044
|
+
ref: (0, vue.unref)(renderRef),
|
|
5045
|
+
props: (0, vue.unref)(mergedProps),
|
|
5046
|
+
state: state.value
|
|
5047
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
5048
|
+
key: 1,
|
|
5049
|
+
ref: (0, vue.unref)(renderRef)
|
|
5050
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
5051
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
5052
|
+
_: 3
|
|
5053
|
+
}, 16))]),
|
|
5054
|
+
_: 3
|
|
5055
|
+
}, 8, ["elements-ref"]);
|
|
5056
|
+
};
|
|
5057
|
+
}
|
|
5058
|
+
});
|
|
5059
|
+
|
|
5060
|
+
//#endregion
|
|
5061
|
+
//#region src/composite/root/CompositeRoot.vue
|
|
5062
|
+
var CompositeRoot_default = CompositeRoot_vue_vue_type_script_setup_true_lang_default;
|
|
5063
|
+
|
|
5064
|
+
//#endregion
|
|
5065
|
+
//#region src/toggle-group/ToggleGroupDataAttributes.ts
|
|
5066
|
+
let ToggleGroupDataAttributes = /* @__PURE__ */ function(ToggleGroupDataAttributes) {
|
|
5067
|
+
/**
|
|
5068
|
+
* Present when the toggle group is disabled.
|
|
5069
|
+
*/
|
|
5070
|
+
ToggleGroupDataAttributes["disabled"] = "data-disabled";
|
|
5071
|
+
/**
|
|
5072
|
+
* Indicates the orientation of the toggle group.
|
|
5073
|
+
* @type {'horizontal' | 'vertical'}
|
|
5074
|
+
*/
|
|
5075
|
+
ToggleGroupDataAttributes["orientation"] = "data-orientation";
|
|
5076
|
+
/**
|
|
5077
|
+
* Present when the toggle group allows multiple buttons to be in the pressed state at the same time.
|
|
5078
|
+
*/
|
|
5079
|
+
ToggleGroupDataAttributes["multiple"] = "data-multiple";
|
|
5080
|
+
return ToggleGroupDataAttributes;
|
|
5081
|
+
}({});
|
|
5082
|
+
|
|
5083
|
+
//#endregion
|
|
5084
|
+
//#region src/toggle-group/ToggleGroup.vue?vue&type=script&setup=true&lang.ts
|
|
5085
|
+
/**
|
|
5086
|
+
* Provides a shared state to a series of toggle buttons.
|
|
5087
|
+
*
|
|
5088
|
+
* Documentation: [Base UI Vue Toggle Group](https://baseui-vue.com/docs/components/toggle-group)
|
|
5089
|
+
*/
|
|
5090
|
+
var ToggleGroup_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5091
|
+
name: "ToggleGroup",
|
|
5092
|
+
inheritAttrs: false,
|
|
5093
|
+
__name: "ToggleGroup",
|
|
5094
|
+
props: {
|
|
5095
|
+
value: {
|
|
5096
|
+
type: Array,
|
|
5097
|
+
required: false
|
|
5098
|
+
},
|
|
5099
|
+
defaultValue: {
|
|
5100
|
+
type: Array,
|
|
5101
|
+
required: false
|
|
5102
|
+
},
|
|
5103
|
+
disabled: {
|
|
5104
|
+
type: Boolean,
|
|
5105
|
+
required: false,
|
|
5106
|
+
default: false
|
|
5107
|
+
},
|
|
5108
|
+
orientation: {
|
|
5109
|
+
type: String,
|
|
5110
|
+
required: false,
|
|
5111
|
+
default: "horizontal"
|
|
5112
|
+
},
|
|
5113
|
+
loopFocus: {
|
|
5114
|
+
type: Boolean,
|
|
5115
|
+
required: false,
|
|
5116
|
+
default: true
|
|
5117
|
+
},
|
|
5118
|
+
multiple: {
|
|
5119
|
+
type: Boolean,
|
|
5120
|
+
required: false,
|
|
5121
|
+
default: false
|
|
5122
|
+
},
|
|
5123
|
+
as: {
|
|
5124
|
+
type: null,
|
|
5125
|
+
required: false,
|
|
5126
|
+
default: "div"
|
|
5127
|
+
},
|
|
5128
|
+
class: {
|
|
5129
|
+
type: Function,
|
|
5130
|
+
required: false,
|
|
5131
|
+
skipCheck: true
|
|
5132
|
+
},
|
|
5133
|
+
style: {
|
|
5134
|
+
type: [
|
|
5135
|
+
Boolean,
|
|
5136
|
+
null,
|
|
5137
|
+
String,
|
|
5138
|
+
Object,
|
|
5139
|
+
Array,
|
|
5140
|
+
Function
|
|
5141
|
+
],
|
|
5142
|
+
required: false,
|
|
5143
|
+
skipCheck: true
|
|
5144
|
+
}
|
|
5145
|
+
},
|
|
5146
|
+
emits: ["valueChange"],
|
|
5147
|
+
setup(__props, { emit: __emit }) {
|
|
5148
|
+
const props = __props;
|
|
5149
|
+
const emit = __emit;
|
|
5150
|
+
const attrsObject = (0, vue.useAttrs)();
|
|
5151
|
+
const toolbarContext = require_button_ToolbarButton.useToolbarRootContext(true);
|
|
5152
|
+
const disabled = (0, vue.computed)(() => (toolbarContext?.disabled.value ?? false) || props.disabled);
|
|
5153
|
+
const isValueInitialized = (0, vue.computed)(() => props.value !== void 0 || props.defaultValue !== void 0);
|
|
5154
|
+
const { value: groupValue, setValue: setValueState } = require_checkbox_group_CheckboxGroup.useControllableState({
|
|
5155
|
+
controlled: () => props.value,
|
|
5156
|
+
default: () => props.value === void 0 ? props.defaultValue ?? [] : [],
|
|
5157
|
+
name: "ToggleGroup"
|
|
5158
|
+
});
|
|
5159
|
+
function setGroupValue(newValue, nextPressed, eventDetails) {
|
|
5160
|
+
let newGroupValue;
|
|
5161
|
+
if (props.multiple) {
|
|
5162
|
+
newGroupValue = groupValue.value.slice();
|
|
5163
|
+
if (nextPressed) newGroupValue.push(newValue);
|
|
5164
|
+
else {
|
|
5165
|
+
const valueIndex = groupValue.value.indexOf(newValue);
|
|
5166
|
+
if (valueIndex >= 0) newGroupValue.splice(valueIndex, 1);
|
|
5167
|
+
}
|
|
5168
|
+
} else newGroupValue = nextPressed ? [newValue] : [];
|
|
5169
|
+
emit("valueChange", newGroupValue, eventDetails);
|
|
5170
|
+
if (eventDetails.isCanceled) return;
|
|
5171
|
+
setValueState(newGroupValue);
|
|
5172
|
+
}
|
|
5173
|
+
(0, vue.provide)(toggleGroupContextKey, {
|
|
5174
|
+
disabled,
|
|
5175
|
+
orientation: (0, vue.computed)(() => props.orientation),
|
|
5176
|
+
setGroupValue,
|
|
5177
|
+
value: groupValue,
|
|
5178
|
+
isValueInitialized
|
|
5179
|
+
});
|
|
5180
|
+
const state = (0, vue.computed)(() => ({
|
|
5181
|
+
disabled: disabled.value,
|
|
5182
|
+
multiple: props.multiple,
|
|
5183
|
+
orientation: props.orientation
|
|
5184
|
+
}));
|
|
5185
|
+
const stateAttributesMapping = { multiple(value) {
|
|
5186
|
+
if (value) return { [ToggleGroupDataAttributes.multiple]: "" };
|
|
5187
|
+
return null;
|
|
5188
|
+
} };
|
|
5189
|
+
const forwardedAttrs = (0, vue.computed)(() => {
|
|
5190
|
+
const { class: _class, style: _style, ...rest } = attrsObject;
|
|
5191
|
+
return rest;
|
|
5192
|
+
});
|
|
5193
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
5194
|
+
componentProps: props,
|
|
5195
|
+
state,
|
|
5196
|
+
props: (0, vue.computed)(() => ({
|
|
5197
|
+
"role": "group",
|
|
5198
|
+
...forwardedAttrs.value,
|
|
5199
|
+
"aria-orientation": props.orientation
|
|
5200
|
+
})),
|
|
5201
|
+
stateAttributesMapping,
|
|
5202
|
+
defaultTagName: "div"
|
|
5203
|
+
});
|
|
5204
|
+
return (_ctx, _cache) => {
|
|
5205
|
+
return (0, vue.unref)(toolbarContext) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [(0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5206
|
+
key: 0,
|
|
5207
|
+
ref: (0, vue.unref)(renderRef),
|
|
5208
|
+
props: (0, vue.unref)(mergedProps),
|
|
5209
|
+
state: state.value
|
|
5210
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
5211
|
+
key: 1,
|
|
5212
|
+
ref: (0, vue.unref)(renderRef)
|
|
5213
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
5214
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
5215
|
+
_: 3
|
|
5216
|
+
}, 16))], 64)) : ((0, vue.openBlock)(), (0, vue.createBlock)(CompositeRoot_default, (0, vue.mergeProps)({
|
|
5217
|
+
key: 1,
|
|
5218
|
+
as: __props.as,
|
|
5219
|
+
class: props.class,
|
|
5220
|
+
style: props.style,
|
|
5221
|
+
orientation: props.orientation,
|
|
5222
|
+
state: state.value,
|
|
5223
|
+
"state-attributes-mapping": stateAttributesMapping,
|
|
5224
|
+
"loop-focus": props.loopFocus,
|
|
5225
|
+
"enable-home-and-end-keys": true,
|
|
5226
|
+
role: "group"
|
|
5227
|
+
}, forwardedAttrs.value), (0, vue.createSlots)({ _: 2 }, [(0, vue.unref)(renderless) ? {
|
|
5228
|
+
name: "default",
|
|
5229
|
+
fn: (0, vue.withCtx)(({ ref, props: compositeProps, state: compositeState }) => [(0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5230
|
+
ref,
|
|
5231
|
+
props: compositeProps,
|
|
5232
|
+
state: compositeState
|
|
5233
|
+
})]),
|
|
5234
|
+
key: "0"
|
|
5235
|
+
} : {
|
|
5236
|
+
name: "default",
|
|
5237
|
+
fn: (0, vue.withCtx)(({ state: compositeState }) => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: compositeState })]),
|
|
5238
|
+
key: "1"
|
|
5239
|
+
}]), 1040, [
|
|
5240
|
+
"as",
|
|
5241
|
+
"class",
|
|
5242
|
+
"style",
|
|
5243
|
+
"orientation",
|
|
5244
|
+
"state",
|
|
5245
|
+
"loop-focus"
|
|
5246
|
+
]));
|
|
5247
|
+
};
|
|
5248
|
+
}
|
|
5249
|
+
});
|
|
5250
|
+
|
|
5251
|
+
//#endregion
|
|
5252
|
+
//#region src/toggle-group/ToggleGroup.vue
|
|
5253
|
+
var ToggleGroup_default = ToggleGroup_vue_vue_type_script_setup_true_lang_default;
|
|
5254
|
+
|
|
5255
|
+
//#endregion
|
|
5256
|
+
//#region src/toolbar/input/ToolbarInput.vue?vue&type=script&setup=true&lang.ts
|
|
5257
|
+
/**
|
|
5258
|
+
* A native input element that integrates with Toolbar keyboard navigation.
|
|
5259
|
+
* Renders an `<input>` element.
|
|
5260
|
+
*
|
|
5261
|
+
* Documentation: [Base UI Vue Toolbar](https://baseui-vue.com/docs/components/toolbar)
|
|
5262
|
+
*/
|
|
5263
|
+
var ToolbarInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5264
|
+
name: "ToolbarInput",
|
|
5265
|
+
inheritAttrs: false,
|
|
5266
|
+
__name: "ToolbarInput",
|
|
5267
|
+
props: {
|
|
5268
|
+
disabled: {
|
|
5269
|
+
type: Boolean,
|
|
5270
|
+
required: false,
|
|
5271
|
+
default: false
|
|
5272
|
+
},
|
|
5273
|
+
focusableWhenDisabled: {
|
|
5274
|
+
type: Boolean,
|
|
5275
|
+
required: false,
|
|
5276
|
+
default: true
|
|
5277
|
+
},
|
|
5278
|
+
defaultValue: {
|
|
5279
|
+
type: [String, Number],
|
|
5280
|
+
required: false
|
|
5281
|
+
},
|
|
5282
|
+
as: {
|
|
5283
|
+
type: null,
|
|
5284
|
+
required: false,
|
|
5285
|
+
default: "input"
|
|
5286
|
+
},
|
|
5287
|
+
class: {
|
|
5288
|
+
type: Function,
|
|
5289
|
+
required: false,
|
|
5290
|
+
skipCheck: true
|
|
5291
|
+
},
|
|
5292
|
+
style: {
|
|
5293
|
+
type: [
|
|
5294
|
+
Boolean,
|
|
5295
|
+
null,
|
|
5296
|
+
String,
|
|
5297
|
+
Object,
|
|
5298
|
+
Array,
|
|
5299
|
+
Function
|
|
5300
|
+
],
|
|
5301
|
+
required: false,
|
|
5302
|
+
skipCheck: true
|
|
5303
|
+
}
|
|
5304
|
+
},
|
|
5305
|
+
setup(__props) {
|
|
5306
|
+
const props = __props;
|
|
5307
|
+
const attrs = (0, vue.useAttrs)();
|
|
5308
|
+
const toolbarRootContext = require_button_ToolbarButton.useToolbarRootContext();
|
|
5309
|
+
const toolbarGroupContext = require_button_ToolbarButton.useToolbarGroupContext(true);
|
|
5310
|
+
const disabled = (0, vue.computed)(() => toolbarRootContext.disabled.value || (toolbarGroupContext?.disabled.value ?? false) || props.disabled);
|
|
5311
|
+
const { props: focusableWhenDisabledProps } = require_button_Button.useFocusableWhenDisabled({
|
|
5312
|
+
composite: true,
|
|
5313
|
+
disabled,
|
|
5314
|
+
focusableWhenDisabled: () => props.focusableWhenDisabled,
|
|
5315
|
+
isNativeButton: false
|
|
5316
|
+
});
|
|
5317
|
+
const state = (0, vue.computed)(() => ({
|
|
5318
|
+
disabled: disabled.value,
|
|
5319
|
+
orientation: toolbarRootContext.orientation.value,
|
|
5320
|
+
focusable: props.focusableWhenDisabled
|
|
5321
|
+
}));
|
|
5322
|
+
const allowedKeysWhenDisabled = (0, vue.computed)(() => toolbarRootContext.orientation.value === "vertical" ? new Set([require_composite_composite.ARROW_UP, require_composite_composite.ARROW_DOWN]) : new Set([require_composite_composite.ARROW_LEFT, require_composite_composite.ARROW_RIGHT]));
|
|
5323
|
+
const defaultProps = (0, vue.computed)(() => ({
|
|
5324
|
+
onClick(event) {
|
|
5325
|
+
if (disabled.value) event.preventDefault();
|
|
5326
|
+
},
|
|
5327
|
+
onKeydown(event) {
|
|
5328
|
+
if (disabled.value && !allowedKeysWhenDisabled.value.has(event.key)) stopEvent(event);
|
|
5329
|
+
},
|
|
5330
|
+
onPointerdown(event) {
|
|
5331
|
+
if (disabled.value) event.preventDefault();
|
|
5332
|
+
}
|
|
5333
|
+
}));
|
|
5334
|
+
return (_ctx, _cache) => {
|
|
5335
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(require_button_ToolbarButton.CompositeItem_default, {
|
|
5336
|
+
as: __props.as,
|
|
5337
|
+
class: (0, vue.normalizeClass)(props.class),
|
|
5338
|
+
style: (0, vue.normalizeStyle)(props.style),
|
|
5339
|
+
metadata: { focusableWhenDisabled: __props.focusableWhenDisabled },
|
|
5340
|
+
state: state.value,
|
|
5341
|
+
props: [
|
|
5342
|
+
defaultProps.value,
|
|
5343
|
+
(0, vue.unref)(attrs),
|
|
5344
|
+
() => (0, vue.unref)(focusableWhenDisabledProps)
|
|
5345
|
+
]
|
|
5346
|
+
}, null, 8, [
|
|
5347
|
+
"as",
|
|
5348
|
+
"class",
|
|
5349
|
+
"style",
|
|
5350
|
+
"metadata",
|
|
5351
|
+
"state",
|
|
5352
|
+
"props"
|
|
5353
|
+
]);
|
|
5354
|
+
};
|
|
5355
|
+
}
|
|
5356
|
+
});
|
|
5357
|
+
|
|
5358
|
+
//#endregion
|
|
5359
|
+
//#region src/toolbar/input/ToolbarInput.vue
|
|
5360
|
+
var ToolbarInput_default = ToolbarInput_vue_vue_type_script_setup_true_lang_default;
|
|
5361
|
+
|
|
5362
|
+
//#endregion
|
|
5363
|
+
//#region src/toolbar/input/ToolbarInputDataAttributes.ts
|
|
5364
|
+
let ToolbarInputDataAttributes = /* @__PURE__ */ function(ToolbarInputDataAttributes) {
|
|
5365
|
+
/**
|
|
5366
|
+
* Present when the input is disabled.
|
|
5367
|
+
*/
|
|
5368
|
+
ToolbarInputDataAttributes["disabled"] = "data-disabled";
|
|
5369
|
+
/**
|
|
5370
|
+
* Indicates the orientation of the toolbar.
|
|
5371
|
+
* @type {'horizontal' | 'vertical'}
|
|
5372
|
+
*/
|
|
5373
|
+
ToolbarInputDataAttributes["orientation"] = "data-orientation";
|
|
5374
|
+
/**
|
|
5375
|
+
* Present when the input remains focusable when disabled.
|
|
5376
|
+
*/
|
|
5377
|
+
ToolbarInputDataAttributes["focusable"] = "data-focusable";
|
|
5378
|
+
return ToolbarInputDataAttributes;
|
|
5379
|
+
}({});
|
|
5380
|
+
|
|
5381
|
+
//#endregion
|
|
5382
|
+
//#region src/toolbar/link/ToolbarLink.vue?vue&type=script&setup=true&lang.ts
|
|
5383
|
+
var ToolbarLink_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5384
|
+
name: "ToolbarLink",
|
|
5385
|
+
inheritAttrs: false,
|
|
5386
|
+
__name: "ToolbarLink",
|
|
5387
|
+
props: {
|
|
5388
|
+
as: {
|
|
5389
|
+
type: null,
|
|
5390
|
+
required: false,
|
|
5391
|
+
default: "a"
|
|
5392
|
+
},
|
|
5393
|
+
class: {
|
|
5394
|
+
type: Function,
|
|
5395
|
+
required: false,
|
|
5396
|
+
skipCheck: true
|
|
5397
|
+
},
|
|
5398
|
+
style: {
|
|
5399
|
+
type: [
|
|
5400
|
+
Boolean,
|
|
5401
|
+
null,
|
|
5402
|
+
String,
|
|
5403
|
+
Object,
|
|
5404
|
+
Array,
|
|
5405
|
+
Function
|
|
5406
|
+
],
|
|
5407
|
+
required: false,
|
|
5408
|
+
skipCheck: true
|
|
5409
|
+
}
|
|
5410
|
+
},
|
|
5411
|
+
setup(__props) {
|
|
5412
|
+
const props = __props;
|
|
5413
|
+
const TOOLBAR_LINK_METADATA = { focusableWhenDisabled: true };
|
|
5414
|
+
const attrs = (0, vue.useAttrs)();
|
|
5415
|
+
const toolbarRootContext = require_button_ToolbarButton.useToolbarRootContext();
|
|
5416
|
+
const state = (0, vue.computed)(() => ({ orientation: toolbarRootContext.orientation.value }));
|
|
5417
|
+
return (_ctx, _cache) => {
|
|
5418
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(require_button_ToolbarButton.CompositeItem_default, {
|
|
5419
|
+
as: __props.as,
|
|
5420
|
+
class: (0, vue.normalizeClass)(props.class),
|
|
5421
|
+
style: (0, vue.normalizeStyle)(props.style),
|
|
5422
|
+
metadata: TOOLBAR_LINK_METADATA,
|
|
5423
|
+
state: state.value,
|
|
5424
|
+
props: [(0, vue.unref)(attrs)]
|
|
5425
|
+
}, {
|
|
5426
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
5427
|
+
_: 3
|
|
5428
|
+
}, 8, [
|
|
5429
|
+
"as",
|
|
5430
|
+
"class",
|
|
5431
|
+
"style",
|
|
5432
|
+
"state",
|
|
5433
|
+
"props"
|
|
5434
|
+
]);
|
|
5435
|
+
};
|
|
5436
|
+
}
|
|
5437
|
+
});
|
|
5438
|
+
|
|
5439
|
+
//#endregion
|
|
5440
|
+
//#region src/toolbar/link/ToolbarLink.vue
|
|
5441
|
+
var ToolbarLink_default = ToolbarLink_vue_vue_type_script_setup_true_lang_default;
|
|
5442
|
+
|
|
5443
|
+
//#endregion
|
|
5444
|
+
//#region src/toolbar/link/ToolbarLinkDataAttributes.ts
|
|
5445
|
+
let ToolbarLinkDataAttributes = /* @__PURE__ */ function(ToolbarLinkDataAttributes) {
|
|
5446
|
+
/**
|
|
5447
|
+
* Indicates the orientation of the toolbar.
|
|
5448
|
+
* @type {'horizontal' | 'vertical'}
|
|
5449
|
+
*/
|
|
5450
|
+
ToolbarLinkDataAttributes["orientation"] = "data-orientation";
|
|
5451
|
+
return ToolbarLinkDataAttributes;
|
|
5452
|
+
}({});
|
|
5453
|
+
|
|
5454
|
+
//#endregion
|
|
5455
|
+
//#region src/toolbar/root/ToolbarRoot.vue?vue&type=script&setup=true&lang.ts
|
|
5456
|
+
/**
|
|
5457
|
+
* A container for grouping a set of controls, such as buttons, toggle groups, or menus.
|
|
5458
|
+
* Renders a `<div>` element.
|
|
5459
|
+
*
|
|
5460
|
+
* Documentation: [Base UI Vue Toolbar](https://baseui-vue.com/docs/components/toolbar)
|
|
5461
|
+
*/
|
|
5462
|
+
var ToolbarRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5463
|
+
name: "ToolbarRoot",
|
|
5464
|
+
inheritAttrs: false,
|
|
5465
|
+
__name: "ToolbarRoot",
|
|
5466
|
+
props: {
|
|
5467
|
+
disabled: {
|
|
5468
|
+
type: Boolean,
|
|
5469
|
+
required: false,
|
|
5470
|
+
default: false
|
|
5471
|
+
},
|
|
5472
|
+
orientation: {
|
|
5473
|
+
type: String,
|
|
5474
|
+
required: false,
|
|
5475
|
+
default: "horizontal"
|
|
5476
|
+
},
|
|
5477
|
+
loopFocus: {
|
|
5478
|
+
type: Boolean,
|
|
5479
|
+
required: false,
|
|
5480
|
+
default: true
|
|
5481
|
+
},
|
|
5482
|
+
as: {
|
|
5483
|
+
type: null,
|
|
5484
|
+
required: false,
|
|
5485
|
+
default: "div"
|
|
5486
|
+
},
|
|
5487
|
+
class: {
|
|
5488
|
+
type: Function,
|
|
5489
|
+
required: false,
|
|
5490
|
+
skipCheck: true
|
|
5491
|
+
},
|
|
5492
|
+
style: {
|
|
5493
|
+
type: [
|
|
5494
|
+
Boolean,
|
|
5495
|
+
null,
|
|
5496
|
+
String,
|
|
5497
|
+
Object,
|
|
5498
|
+
Array,
|
|
5499
|
+
Function
|
|
5500
|
+
],
|
|
5501
|
+
required: false,
|
|
5502
|
+
skipCheck: true
|
|
5503
|
+
}
|
|
5504
|
+
},
|
|
5505
|
+
setup(__props) {
|
|
5506
|
+
const props = __props;
|
|
5507
|
+
const attrs = (0, vue.useAttrs)();
|
|
5508
|
+
const direction = require_control_SliderControl.useDirection();
|
|
5509
|
+
const itemMap = (0, vue.ref)(/* @__PURE__ */ new Map());
|
|
5510
|
+
const disabledIndices = (0, vue.computed)(() => {
|
|
5511
|
+
const output = [];
|
|
5512
|
+
itemMap.value.forEach((itemMetadata, element) => {
|
|
5513
|
+
if (itemMetadata?.index != null && !itemMetadata.focusableWhenDisabled && isElementDisabled(element)) output.push(itemMetadata.index);
|
|
5514
|
+
});
|
|
5515
|
+
return output;
|
|
5516
|
+
});
|
|
5517
|
+
const state = (0, vue.computed)(() => ({
|
|
5518
|
+
disabled: props.disabled,
|
|
5519
|
+
orientation: props.orientation
|
|
5520
|
+
}));
|
|
5521
|
+
const root = useCompositeRoot({
|
|
5522
|
+
orientation: () => props.orientation,
|
|
5523
|
+
loopFocus: () => props.loopFocus,
|
|
5524
|
+
direction: () => direction.value,
|
|
5525
|
+
disabledIndices: () => disabledIndices.value
|
|
5526
|
+
});
|
|
5527
|
+
(0, vue.provide)(require_button_ToolbarButton.toolbarRootContextKey, {
|
|
5528
|
+
disabled: (0, vue.computed)(() => props.disabled),
|
|
5529
|
+
orientation: (0, vue.computed)(() => props.orientation)
|
|
5530
|
+
});
|
|
5531
|
+
(0, vue.provide)(require_button_Button.compositeRootContextKey, (0, vue.reactive)({
|
|
5532
|
+
highlightedIndex: root.highlightedIndex,
|
|
5533
|
+
onHighlightedIndexChange: root.onHighlightedIndexChange,
|
|
5534
|
+
highlightItemOnHover: (0, vue.computed)(() => false),
|
|
5535
|
+
relayKeyboardEvent: root.relayKeyboardEvent
|
|
5536
|
+
}));
|
|
5537
|
+
const { tag, mergedProps, renderless, ref: renderRef } = require_button_Button.useRenderElement({
|
|
5538
|
+
componentProps: props,
|
|
5539
|
+
state,
|
|
5540
|
+
props: (0, vue.computed)(() => ({
|
|
5541
|
+
...root.getRootProps(attrs),
|
|
5542
|
+
"role": "toolbar",
|
|
5543
|
+
"aria-orientation": props.orientation
|
|
5544
|
+
})),
|
|
5545
|
+
defaultTagName: "div",
|
|
5546
|
+
ref: root.mergedRef
|
|
5547
|
+
});
|
|
5548
|
+
function handleMapChange(newMap) {
|
|
5549
|
+
const typedMap = newMap;
|
|
5550
|
+
itemMap.value = typedMap;
|
|
5551
|
+
root.onMapChange(typedMap);
|
|
5552
|
+
}
|
|
5553
|
+
return (_ctx, _cache) => {
|
|
5554
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(CompositeList_default, {
|
|
5555
|
+
"elements-ref": (0, vue.unref)(root).elementsRef,
|
|
5556
|
+
onMapChange: handleMapChange
|
|
5557
|
+
}, {
|
|
5558
|
+
default: (0, vue.withCtx)(() => [(0, vue.unref)(renderless) ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
5559
|
+
key: 0,
|
|
5560
|
+
ref: (0, vue.unref)(renderRef),
|
|
5561
|
+
props: (0, vue.unref)(mergedProps),
|
|
5562
|
+
state: state.value
|
|
5563
|
+
}) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(tag)), (0, vue.mergeProps)({
|
|
5564
|
+
key: 1,
|
|
5565
|
+
ref: (0, vue.unref)(renderRef)
|
|
5566
|
+
}, (0, vue.unref)(mergedProps)), {
|
|
5567
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", { state: state.value })]),
|
|
5568
|
+
_: 3
|
|
5569
|
+
}, 16))]),
|
|
5570
|
+
_: 3
|
|
5571
|
+
}, 8, ["elements-ref"]);
|
|
5572
|
+
};
|
|
5573
|
+
}
|
|
5574
|
+
});
|
|
5575
|
+
|
|
5576
|
+
//#endregion
|
|
5577
|
+
//#region src/toolbar/root/ToolbarRoot.vue
|
|
5578
|
+
var ToolbarRoot_default = ToolbarRoot_vue_vue_type_script_setup_true_lang_default;
|
|
5579
|
+
|
|
5580
|
+
//#endregion
|
|
5581
|
+
//#region src/toolbar/root/ToolbarRootDataAttributes.ts
|
|
5582
|
+
let ToolbarRootDataAttributes = /* @__PURE__ */ function(ToolbarRootDataAttributes) {
|
|
5583
|
+
/**
|
|
5584
|
+
* Present when the toolbar is disabled.
|
|
5585
|
+
*/
|
|
5586
|
+
ToolbarRootDataAttributes["disabled"] = "data-disabled";
|
|
5587
|
+
/**
|
|
5588
|
+
* Indicates the orientation of the toolbar.
|
|
5589
|
+
* @type {'horizontal' | 'vertical'}
|
|
5590
|
+
*/
|
|
5591
|
+
ToolbarRootDataAttributes["orientation"] = "data-orientation";
|
|
5592
|
+
return ToolbarRootDataAttributes;
|
|
5593
|
+
}({});
|
|
5594
|
+
|
|
5595
|
+
//#endregion
|
|
5596
|
+
//#region src/toolbar/separator/ToolbarSeparator.vue?vue&type=script&setup=true&lang.ts
|
|
5597
|
+
/**
|
|
5598
|
+
* A separator element accessible to screen readers.
|
|
5599
|
+
* Renders a `<div>` element.
|
|
5600
|
+
*
|
|
5601
|
+
* Documentation: [Base UI Vue Toolbar](https://baseui-vue.com/docs/components/toolbar)
|
|
5602
|
+
*/
|
|
5603
|
+
var ToolbarSeparator_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5604
|
+
name: "ToolbarSeparator",
|
|
5605
|
+
inheritAttrs: false,
|
|
5606
|
+
__name: "ToolbarSeparator",
|
|
5607
|
+
props: {
|
|
5608
|
+
orientation: {
|
|
5609
|
+
type: String,
|
|
5610
|
+
required: false
|
|
5611
|
+
},
|
|
5612
|
+
as: {
|
|
5613
|
+
type: null,
|
|
5614
|
+
required: false
|
|
5615
|
+
},
|
|
5616
|
+
class: {
|
|
5617
|
+
type: Function,
|
|
5618
|
+
required: false,
|
|
5619
|
+
skipCheck: true
|
|
5620
|
+
},
|
|
5621
|
+
style: {
|
|
5622
|
+
type: [
|
|
5623
|
+
Boolean,
|
|
5624
|
+
null,
|
|
5625
|
+
String,
|
|
5626
|
+
Object,
|
|
5627
|
+
Array,
|
|
5628
|
+
Function
|
|
5629
|
+
],
|
|
5630
|
+
required: false,
|
|
5631
|
+
skipCheck: true
|
|
5632
|
+
}
|
|
5633
|
+
},
|
|
5634
|
+
setup(__props) {
|
|
5635
|
+
const props = __props;
|
|
5636
|
+
const attrs = (0, vue.useAttrs)();
|
|
5637
|
+
const toolbarRootContext = require_button_ToolbarButton.useToolbarRootContext();
|
|
5638
|
+
const orientation = (0, vue.computed)(() => props.orientation ?? (toolbarRootContext.orientation.value === "vertical" ? "horizontal" : "vertical"));
|
|
5639
|
+
return (_ctx, _cache) => {
|
|
5640
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(Separator_default, (0, vue.mergeProps)({
|
|
5641
|
+
as: props.as,
|
|
5642
|
+
class: props.class,
|
|
5643
|
+
style: props.style,
|
|
5644
|
+
orientation: orientation.value
|
|
5645
|
+
}, (0, vue.unref)(attrs)), {
|
|
5646
|
+
default: (0, vue.withCtx)((slotProps) => [(0, vue.renderSlot)(_ctx.$slots, "default", (0, vue.normalizeProps)((0, vue.guardReactiveProps)(slotProps)))]),
|
|
5647
|
+
_: 3
|
|
5648
|
+
}, 16, [
|
|
5649
|
+
"as",
|
|
5650
|
+
"class",
|
|
5651
|
+
"style",
|
|
5652
|
+
"orientation"
|
|
5653
|
+
]);
|
|
5654
|
+
};
|
|
5655
|
+
}
|
|
5656
|
+
});
|
|
5657
|
+
|
|
5658
|
+
//#endregion
|
|
5659
|
+
//#region src/toolbar/separator/ToolbarSeparator.vue
|
|
5660
|
+
var ToolbarSeparator_default = ToolbarSeparator_vue_vue_type_script_setup_true_lang_default;
|
|
5661
|
+
|
|
5662
|
+
//#endregion
|
|
5663
|
+
//#region src/toolbar/separator/ToolbarSeparatorDataAttributes.ts
|
|
5664
|
+
let ToolbarSeparatorDataAttributes = /* @__PURE__ */ function(ToolbarSeparatorDataAttributes) {
|
|
5665
|
+
/**
|
|
5666
|
+
* Indicates the orientation of the toolbar.
|
|
5667
|
+
* @type {'horizontal' | 'vertical'}
|
|
5668
|
+
*/
|
|
5669
|
+
ToolbarSeparatorDataAttributes["orientation"] = "data-orientation";
|
|
5670
|
+
return ToolbarSeparatorDataAttributes;
|
|
5671
|
+
}({});
|
|
5672
|
+
|
|
5673
|
+
//#endregion
|
|
5674
|
+
//#region src/use-render/useRender.ts
|
|
5675
|
+
/**
|
|
5676
|
+
* Renders a Base UI element.
|
|
5677
|
+
*
|
|
5678
|
+
* The public composable that collects `attrs` internally via `useAttrs()`,
|
|
5679
|
+
* merges them with explicit props, and delegates to `useRenderElement`.
|
|
5680
|
+
* Returns a readonly state and supports renderless mode via the `Slot` sentinel.
|
|
5681
|
+
*
|
|
5682
|
+
* @public
|
|
5683
|
+
*/
|
|
5684
|
+
function useRender(params) {
|
|
5685
|
+
const attrs = (0, vue.useAttrs)();
|
|
5686
|
+
const state = (0, vue.computed)(() => {
|
|
5687
|
+
return (0, vue.readonly)((0, vue.toValue)(params.state) ?? require_button_Button.EMPTY_OBJECT);
|
|
5688
|
+
});
|
|
5689
|
+
const mergedComponentProps = require_button_Button.useRenderElement({
|
|
5690
|
+
componentProps: params,
|
|
5691
|
+
state,
|
|
5692
|
+
props: (0, vue.computed)(() => require_button_Button.mergeProps(attrs, (0, vue.toValue)(params.props))),
|
|
5693
|
+
stateAttributesMapping: params.stateAttributesMapping,
|
|
5694
|
+
defaultTagName: params.defaultTagName,
|
|
5695
|
+
ref: params.ref
|
|
5696
|
+
});
|
|
5697
|
+
return {
|
|
5698
|
+
tag: mergedComponentProps.tag,
|
|
5699
|
+
renderProps: mergedComponentProps.mergedProps,
|
|
5700
|
+
renderless: mergedComponentProps.renderless,
|
|
5701
|
+
state,
|
|
5702
|
+
ref: mergedComponentProps.ref
|
|
5703
|
+
};
|
|
5704
|
+
}
|
|
5705
|
+
|
|
5706
|
+
//#endregion
|
|
5707
|
+
//#region src/index.ts
|
|
5708
|
+
const name = "base-ui-vue";
|
|
5709
|
+
const version = "0.0.0";
|
|
5710
|
+
|
|
5711
|
+
//#endregion
|
|
5712
|
+
Object.defineProperty(exports, 'AccordionItem_default', {
|
|
5713
|
+
enumerable: true,
|
|
5714
|
+
get: function () {
|
|
5715
|
+
return AccordionItem_default;
|
|
5716
|
+
}
|
|
5717
|
+
});
|
|
5718
|
+
Object.defineProperty(exports, 'AccordionPanel_default', {
|
|
5719
|
+
enumerable: true,
|
|
5720
|
+
get: function () {
|
|
5721
|
+
return AccordionPanel_default;
|
|
5722
|
+
}
|
|
5723
|
+
});
|
|
5724
|
+
Object.defineProperty(exports, 'AccordionRoot_default', {
|
|
5725
|
+
enumerable: true,
|
|
5726
|
+
get: function () {
|
|
5727
|
+
return AccordionRoot_default;
|
|
5728
|
+
}
|
|
2634
5729
|
});
|
|
2635
5730
|
Object.defineProperty(exports, 'AccordionTrigger_default', {
|
|
2636
5731
|
enumerable: true,
|
|
@@ -2698,22 +5793,190 @@ Object.defineProperty(exports, 'FieldsetRoot_default', {
|
|
|
2698
5793
|
return FieldsetRoot_default;
|
|
2699
5794
|
}
|
|
2700
5795
|
});
|
|
2701
|
-
Object.defineProperty(exports, '
|
|
5796
|
+
Object.defineProperty(exports, 'SeparatorDataAttributes', {
|
|
2702
5797
|
enumerable: true,
|
|
2703
5798
|
get: function () {
|
|
2704
|
-
return
|
|
5799
|
+
return SeparatorDataAttributes;
|
|
2705
5800
|
}
|
|
2706
5801
|
});
|
|
2707
|
-
Object.defineProperty(exports, '
|
|
5802
|
+
Object.defineProperty(exports, 'Separator_default', {
|
|
2708
5803
|
enumerable: true,
|
|
2709
5804
|
get: function () {
|
|
2710
|
-
return
|
|
5805
|
+
return Separator_default;
|
|
5806
|
+
}
|
|
5807
|
+
});
|
|
5808
|
+
Object.defineProperty(exports, 'SliderIndicatorDataAttributes', {
|
|
5809
|
+
enumerable: true,
|
|
5810
|
+
get: function () {
|
|
5811
|
+
return SliderIndicatorDataAttributes;
|
|
5812
|
+
}
|
|
5813
|
+
});
|
|
5814
|
+
Object.defineProperty(exports, 'SliderIndicator_default', {
|
|
5815
|
+
enumerable: true,
|
|
5816
|
+
get: function () {
|
|
5817
|
+
return SliderIndicator_default;
|
|
2711
5818
|
}
|
|
2712
5819
|
});
|
|
2713
|
-
Object.defineProperty(exports, '
|
|
5820
|
+
Object.defineProperty(exports, 'SliderLabel_default', {
|
|
2714
5821
|
enumerable: true,
|
|
2715
5822
|
get: function () {
|
|
2716
|
-
return
|
|
5823
|
+
return SliderLabel_default;
|
|
5824
|
+
}
|
|
5825
|
+
});
|
|
5826
|
+
Object.defineProperty(exports, 'SliderRootDataAttributes', {
|
|
5827
|
+
enumerable: true,
|
|
5828
|
+
get: function () {
|
|
5829
|
+
return SliderRootDataAttributes;
|
|
5830
|
+
}
|
|
5831
|
+
});
|
|
5832
|
+
Object.defineProperty(exports, 'SliderRoot_default', {
|
|
5833
|
+
enumerable: true,
|
|
5834
|
+
get: function () {
|
|
5835
|
+
return SliderRoot_default;
|
|
5836
|
+
}
|
|
5837
|
+
});
|
|
5838
|
+
Object.defineProperty(exports, 'SliderThumbDataAttributes', {
|
|
5839
|
+
enumerable: true,
|
|
5840
|
+
get: function () {
|
|
5841
|
+
return SliderThumbDataAttributes;
|
|
5842
|
+
}
|
|
5843
|
+
});
|
|
5844
|
+
Object.defineProperty(exports, 'SliderThumb_default', {
|
|
5845
|
+
enumerable: true,
|
|
5846
|
+
get: function () {
|
|
5847
|
+
return SliderThumb_default;
|
|
5848
|
+
}
|
|
5849
|
+
});
|
|
5850
|
+
Object.defineProperty(exports, 'SliderTrackDataAttributes', {
|
|
5851
|
+
enumerable: true,
|
|
5852
|
+
get: function () {
|
|
5853
|
+
return SliderTrackDataAttributes;
|
|
5854
|
+
}
|
|
5855
|
+
});
|
|
5856
|
+
Object.defineProperty(exports, 'SliderTrack_default', {
|
|
5857
|
+
enumerable: true,
|
|
5858
|
+
get: function () {
|
|
5859
|
+
return SliderTrack_default;
|
|
5860
|
+
}
|
|
5861
|
+
});
|
|
5862
|
+
Object.defineProperty(exports, 'SliderValueDataAttributes', {
|
|
5863
|
+
enumerable: true,
|
|
5864
|
+
get: function () {
|
|
5865
|
+
return SliderValueDataAttributes;
|
|
5866
|
+
}
|
|
5867
|
+
});
|
|
5868
|
+
Object.defineProperty(exports, 'SliderValue_default', {
|
|
5869
|
+
enumerable: true,
|
|
5870
|
+
get: function () {
|
|
5871
|
+
return SliderValue_default;
|
|
5872
|
+
}
|
|
5873
|
+
});
|
|
5874
|
+
Object.defineProperty(exports, 'SwitchRootDataAttributes', {
|
|
5875
|
+
enumerable: true,
|
|
5876
|
+
get: function () {
|
|
5877
|
+
return SwitchRootDataAttributes;
|
|
5878
|
+
}
|
|
5879
|
+
});
|
|
5880
|
+
Object.defineProperty(exports, 'SwitchRoot_default', {
|
|
5881
|
+
enumerable: true,
|
|
5882
|
+
get: function () {
|
|
5883
|
+
return SwitchRoot_default;
|
|
5884
|
+
}
|
|
5885
|
+
});
|
|
5886
|
+
Object.defineProperty(exports, 'SwitchThumbDataAttributes', {
|
|
5887
|
+
enumerable: true,
|
|
5888
|
+
get: function () {
|
|
5889
|
+
return SwitchThumbDataAttributes;
|
|
5890
|
+
}
|
|
5891
|
+
});
|
|
5892
|
+
Object.defineProperty(exports, 'SwitchThumb_default', {
|
|
5893
|
+
enumerable: true,
|
|
5894
|
+
get: function () {
|
|
5895
|
+
return SwitchThumb_default;
|
|
5896
|
+
}
|
|
5897
|
+
});
|
|
5898
|
+
Object.defineProperty(exports, 'ToggleDataAttributes', {
|
|
5899
|
+
enumerable: true,
|
|
5900
|
+
get: function () {
|
|
5901
|
+
return ToggleDataAttributes;
|
|
5902
|
+
}
|
|
5903
|
+
});
|
|
5904
|
+
Object.defineProperty(exports, 'ToggleGroupDataAttributes', {
|
|
5905
|
+
enumerable: true,
|
|
5906
|
+
get: function () {
|
|
5907
|
+
return ToggleGroupDataAttributes;
|
|
5908
|
+
}
|
|
5909
|
+
});
|
|
5910
|
+
Object.defineProperty(exports, 'ToggleGroup_default', {
|
|
5911
|
+
enumerable: true,
|
|
5912
|
+
get: function () {
|
|
5913
|
+
return ToggleGroup_default;
|
|
5914
|
+
}
|
|
5915
|
+
});
|
|
5916
|
+
Object.defineProperty(exports, 'Toggle_default', {
|
|
5917
|
+
enumerable: true,
|
|
5918
|
+
get: function () {
|
|
5919
|
+
return Toggle_default;
|
|
5920
|
+
}
|
|
5921
|
+
});
|
|
5922
|
+
Object.defineProperty(exports, 'ToolbarInputDataAttributes', {
|
|
5923
|
+
enumerable: true,
|
|
5924
|
+
get: function () {
|
|
5925
|
+
return ToolbarInputDataAttributes;
|
|
5926
|
+
}
|
|
5927
|
+
});
|
|
5928
|
+
Object.defineProperty(exports, 'ToolbarInput_default', {
|
|
5929
|
+
enumerable: true,
|
|
5930
|
+
get: function () {
|
|
5931
|
+
return ToolbarInput_default;
|
|
5932
|
+
}
|
|
5933
|
+
});
|
|
5934
|
+
Object.defineProperty(exports, 'ToolbarLinkDataAttributes', {
|
|
5935
|
+
enumerable: true,
|
|
5936
|
+
get: function () {
|
|
5937
|
+
return ToolbarLinkDataAttributes;
|
|
5938
|
+
}
|
|
5939
|
+
});
|
|
5940
|
+
Object.defineProperty(exports, 'ToolbarLink_default', {
|
|
5941
|
+
enumerable: true,
|
|
5942
|
+
get: function () {
|
|
5943
|
+
return ToolbarLink_default;
|
|
5944
|
+
}
|
|
5945
|
+
});
|
|
5946
|
+
Object.defineProperty(exports, 'ToolbarRootDataAttributes', {
|
|
5947
|
+
enumerable: true,
|
|
5948
|
+
get: function () {
|
|
5949
|
+
return ToolbarRootDataAttributes;
|
|
5950
|
+
}
|
|
5951
|
+
});
|
|
5952
|
+
Object.defineProperty(exports, 'ToolbarRoot_default', {
|
|
5953
|
+
enumerable: true,
|
|
5954
|
+
get: function () {
|
|
5955
|
+
return ToolbarRoot_default;
|
|
5956
|
+
}
|
|
5957
|
+
});
|
|
5958
|
+
Object.defineProperty(exports, 'ToolbarSeparatorDataAttributes', {
|
|
5959
|
+
enumerable: true,
|
|
5960
|
+
get: function () {
|
|
5961
|
+
return ToolbarSeparatorDataAttributes;
|
|
5962
|
+
}
|
|
5963
|
+
});
|
|
5964
|
+
Object.defineProperty(exports, 'ToolbarSeparator_default', {
|
|
5965
|
+
enumerable: true,
|
|
5966
|
+
get: function () {
|
|
5967
|
+
return ToolbarSeparator_default;
|
|
5968
|
+
}
|
|
5969
|
+
});
|
|
5970
|
+
Object.defineProperty(exports, 'accordionRootContextKey', {
|
|
5971
|
+
enumerable: true,
|
|
5972
|
+
get: function () {
|
|
5973
|
+
return accordionRootContextKey;
|
|
5974
|
+
}
|
|
5975
|
+
});
|
|
5976
|
+
Object.defineProperty(exports, 'collapsibleRootContextKey', {
|
|
5977
|
+
enumerable: true,
|
|
5978
|
+
get: function () {
|
|
5979
|
+
return collapsibleRootContextKey;
|
|
2717
5980
|
}
|
|
2718
5981
|
});
|
|
2719
5982
|
Object.defineProperty(exports, 'fieldsetRootContextKey', {
|
|
@@ -2728,22 +5991,28 @@ Object.defineProperty(exports, 'name', {
|
|
|
2728
5991
|
return name;
|
|
2729
5992
|
}
|
|
2730
5993
|
});
|
|
2731
|
-
Object.defineProperty(exports, '
|
|
5994
|
+
Object.defineProperty(exports, 'switchRootContextKey', {
|
|
2732
5995
|
enumerable: true,
|
|
2733
5996
|
get: function () {
|
|
2734
|
-
return
|
|
5997
|
+
return switchRootContextKey;
|
|
2735
5998
|
}
|
|
2736
5999
|
});
|
|
2737
|
-
Object.defineProperty(exports, '
|
|
6000
|
+
Object.defineProperty(exports, 'toggleGroupContextKey', {
|
|
2738
6001
|
enumerable: true,
|
|
2739
6002
|
get: function () {
|
|
2740
|
-
return
|
|
6003
|
+
return toggleGroupContextKey;
|
|
2741
6004
|
}
|
|
2742
6005
|
});
|
|
2743
|
-
Object.defineProperty(exports, '
|
|
6006
|
+
Object.defineProperty(exports, 'useAccordionRootContext', {
|
|
6007
|
+
enumerable: true,
|
|
6008
|
+
get: function () {
|
|
6009
|
+
return useAccordionRootContext;
|
|
6010
|
+
}
|
|
6011
|
+
});
|
|
6012
|
+
Object.defineProperty(exports, 'useCollapsibleRootContext', {
|
|
2744
6013
|
enumerable: true,
|
|
2745
6014
|
get: function () {
|
|
2746
|
-
return
|
|
6015
|
+
return useCollapsibleRootContext;
|
|
2747
6016
|
}
|
|
2748
6017
|
});
|
|
2749
6018
|
Object.defineProperty(exports, 'useFieldsetRootContext', {
|
|
@@ -2758,6 +6027,18 @@ Object.defineProperty(exports, 'useRender', {
|
|
|
2758
6027
|
return useRender;
|
|
2759
6028
|
}
|
|
2760
6029
|
});
|
|
6030
|
+
Object.defineProperty(exports, 'useSwitchRootContext', {
|
|
6031
|
+
enumerable: true,
|
|
6032
|
+
get: function () {
|
|
6033
|
+
return useSwitchRootContext;
|
|
6034
|
+
}
|
|
6035
|
+
});
|
|
6036
|
+
Object.defineProperty(exports, 'useToggleGroupContext', {
|
|
6037
|
+
enumerable: true,
|
|
6038
|
+
get: function () {
|
|
6039
|
+
return useToggleGroupContext;
|
|
6040
|
+
}
|
|
6041
|
+
});
|
|
2761
6042
|
Object.defineProperty(exports, 'version', {
|
|
2762
6043
|
enumerable: true,
|
|
2763
6044
|
get: function () {
|