akar 2.0.12 → 2.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlertDialog/AlertDialogContent.cjs +2 -1
- package/dist/AlertDialog/AlertDialogContent.cjs.map +1 -1
- package/dist/AlertDialog/AlertDialogContent.js +2 -1
- package/dist/AlertDialog/AlertDialogContent.js.map +1 -1
- package/dist/Autocomplete/AutocompleteInput.cjs +4 -2
- package/dist/Autocomplete/AutocompleteInput.cjs.map +1 -1
- package/dist/Autocomplete/AutocompleteInput.js +4 -2
- package/dist/Autocomplete/AutocompleteInput.js.map +1 -1
- package/dist/Calendar/CalendarCellTrigger.cjs +3 -2
- package/dist/Calendar/CalendarCellTrigger.cjs.map +1 -1
- package/dist/Calendar/CalendarCellTrigger.js +4 -3
- package/dist/Calendar/CalendarCellTrigger.js.map +1 -1
- package/dist/Checkbox/CheckboxRoot.cjs +27 -18
- package/dist/Checkbox/CheckboxRoot.cjs.map +1 -1
- package/dist/Checkbox/CheckboxRoot.js +28 -19
- package/dist/Checkbox/CheckboxRoot.js.map +1 -1
- package/dist/Combobox/ComboboxInput.cjs +4 -2
- package/dist/Combobox/ComboboxInput.cjs.map +1 -1
- package/dist/Combobox/ComboboxInput.js +4 -2
- package/dist/Combobox/ComboboxInput.js.map +1 -1
- package/dist/ConfigProvider/ConfigProvider.cjs +6 -1
- package/dist/ConfigProvider/ConfigProvider.cjs.map +1 -1
- package/dist/ConfigProvider/ConfigProvider.js +6 -1
- package/dist/ConfigProvider/ConfigProvider.js.map +1 -1
- package/dist/DateField/DateFieldRoot.cjs +1 -1
- package/dist/DateField/DateFieldRoot.cjs.map +1 -1
- package/dist/DateField/DateFieldRoot.js +1 -1
- package/dist/DateField/DateFieldRoot.js.map +1 -1
- package/dist/DateRangeField/DateRangeFieldRoot.cjs +1 -1
- package/dist/DateRangeField/DateRangeFieldRoot.cjs.map +1 -1
- package/dist/DateRangeField/DateRangeFieldRoot.js +1 -1
- package/dist/DateRangeField/DateRangeFieldRoot.js.map +1 -1
- package/dist/DismissableLayer/DismissableLayer.cjs +12 -23
- package/dist/DismissableLayer/DismissableLayer.cjs.map +1 -1
- package/dist/DismissableLayer/DismissableLayer.js +3 -8
- package/dist/DismissableLayer/DismissableLayer.js.map +1 -1
- package/dist/DismissableLayer/DismissableLayerBranch.cjs +3 -3
- package/dist/DismissableLayer/DismissableLayerBranch.cjs.map +1 -1
- package/dist/DismissableLayer/DismissableLayerBranch.js +1 -1
- package/dist/DismissableLayer/context.cjs +19 -0
- package/dist/DismissableLayer/context.cjs.map +1 -0
- package/dist/DismissableLayer/context.js +13 -0
- package/dist/DismissableLayer/context.js.map +1 -0
- package/dist/DropdownMenu/DropdownMenuFilter.cjs +4 -2
- package/dist/DropdownMenu/DropdownMenuFilter.cjs.map +1 -1
- package/dist/DropdownMenu/DropdownMenuFilter.js +4 -2
- package/dist/DropdownMenu/DropdownMenuFilter.js.map +1 -1
- package/dist/FocusScope/FocusScope.cjs +2 -1
- package/dist/FocusScope/FocusScope.cjs.map +1 -1
- package/dist/FocusScope/FocusScope.js +2 -1
- package/dist/FocusScope/FocusScope.js.map +1 -1
- package/dist/Listbox/ListboxFilter.cjs +4 -2
- package/dist/Listbox/ListboxFilter.cjs.map +1 -1
- package/dist/Listbox/ListboxFilter.js +4 -2
- package/dist/Listbox/ListboxFilter.js.map +1 -1
- package/dist/Listbox/ListboxRoot.cjs +1 -0
- package/dist/Listbox/ListboxRoot.cjs.map +1 -1
- package/dist/Listbox/ListboxRoot.js +1 -0
- package/dist/Listbox/ListboxRoot.js.map +1 -1
- package/dist/Menu/MenuContentImpl.cjs +2 -1
- package/dist/Menu/MenuContentImpl.cjs.map +1 -1
- package/dist/Menu/MenuContentImpl.js +2 -1
- package/dist/Menu/MenuContentImpl.js.map +1 -1
- package/dist/MonthPicker/MonthPickerCellTrigger.cjs +3 -2
- package/dist/MonthPicker/MonthPickerCellTrigger.cjs.map +1 -1
- package/dist/MonthPicker/MonthPickerCellTrigger.js +4 -3
- package/dist/MonthPicker/MonthPickerCellTrigger.js.map +1 -1
- package/dist/MonthRangePicker/MonthRangePickerCellTrigger.cjs +3 -2
- package/dist/MonthRangePicker/MonthRangePickerCellTrigger.cjs.map +1 -1
- package/dist/MonthRangePicker/MonthRangePickerCellTrigger.js +4 -3
- package/dist/MonthRangePicker/MonthRangePickerCellTrigger.js.map +1 -1
- package/dist/NumberField/NumberFieldInput.cjs +1 -0
- package/dist/NumberField/NumberFieldInput.cjs.map +1 -1
- package/dist/NumberField/NumberFieldInput.js +1 -0
- package/dist/NumberField/NumberFieldInput.js.map +1 -1
- package/dist/NumberField/NumberFieldRoot.cjs +27 -5
- package/dist/NumberField/NumberFieldRoot.cjs.map +1 -1
- package/dist/NumberField/NumberFieldRoot.js +27 -5
- package/dist/NumberField/NumberFieldRoot.js.map +1 -1
- package/dist/Presence/usePresence.cjs +9 -2
- package/dist/Presence/usePresence.cjs.map +1 -1
- package/dist/Presence/usePresence.js +9 -2
- package/dist/Presence/usePresence.js.map +1 -1
- package/dist/RadioGroup/Radio.cjs +27 -22
- package/dist/RadioGroup/Radio.cjs.map +1 -1
- package/dist/RadioGroup/Radio.js +28 -23
- package/dist/RadioGroup/Radio.js.map +1 -1
- package/dist/RadioGroup/RadioGroupItem.cjs +3 -0
- package/dist/RadioGroup/RadioGroupItem.cjs.map +1 -1
- package/dist/RadioGroup/RadioGroupItem.js +3 -0
- package/dist/RadioGroup/RadioGroupItem.js.map +1 -1
- package/dist/RangeCalendar/RangeCalendarCellTrigger.cjs +1 -0
- package/dist/RangeCalendar/RangeCalendarCellTrigger.cjs.map +1 -1
- package/dist/RangeCalendar/RangeCalendarCellTrigger.js +1 -0
- package/dist/RangeCalendar/RangeCalendarCellTrigger.js.map +1 -1
- package/dist/Rating/RatingRoot.cjs +7 -1
- package/dist/Rating/RatingRoot.cjs.map +1 -1
- package/dist/Rating/RatingRoot.js +7 -1
- package/dist/Rating/RatingRoot.js.map +1 -1
- package/dist/RovingFocus/RovingFocusItem.cjs +5 -0
- package/dist/RovingFocus/RovingFocusItem.cjs.map +1 -1
- package/dist/RovingFocus/RovingFocusItem.js +6 -1
- package/dist/RovingFocus/RovingFocusItem.js.map +1 -1
- package/dist/ScrollArea/ScrollAreaThumb.cjs +2 -2
- package/dist/ScrollArea/ScrollAreaThumb.cjs.map +1 -1
- package/dist/ScrollArea/ScrollAreaThumb.js +2 -2
- package/dist/ScrollArea/ScrollAreaThumb.js.map +1 -1
- package/dist/Splitter/SplitterGroup.cjs +2 -2
- package/dist/Splitter/SplitterGroup.cjs.map +1 -1
- package/dist/Splitter/SplitterGroup.js +2 -2
- package/dist/Splitter/SplitterGroup.js.map +1 -1
- package/dist/Stepper/StepperIndicator.cjs +2 -1
- package/dist/Stepper/StepperIndicator.cjs.map +1 -1
- package/dist/Stepper/StepperIndicator.js +2 -1
- package/dist/Stepper/StepperIndicator.js.map +1 -1
- package/dist/Stepper/StepperTrigger.cjs +7 -2
- package/dist/Stepper/StepperTrigger.cjs.map +1 -1
- package/dist/Stepper/StepperTrigger.js +7 -2
- package/dist/Stepper/StepperTrigger.js.map +1 -1
- package/dist/Switch/SwitchRoot.cjs +25 -18
- package/dist/Switch/SwitchRoot.cjs.map +1 -1
- package/dist/Switch/SwitchRoot.js +26 -19
- package/dist/Switch/SwitchRoot.js.map +1 -1
- package/dist/TagsInput/TagsInputRoot.cjs +5 -3
- package/dist/TagsInput/TagsInputRoot.cjs.map +1 -1
- package/dist/TagsInput/TagsInputRoot.js +6 -4
- package/dist/TagsInput/TagsInputRoot.js.map +1 -1
- package/dist/Teleport/Teleport.cjs +6 -3
- package/dist/Teleport/Teleport.cjs.map +1 -1
- package/dist/Teleport/Teleport.js +7 -4
- package/dist/Teleport/Teleport.js.map +1 -1
- package/dist/TimeField/TimeFieldRoot.cjs +1 -1
- package/dist/TimeField/TimeFieldRoot.cjs.map +1 -1
- package/dist/TimeField/TimeFieldRoot.js +1 -1
- package/dist/TimeField/TimeFieldRoot.js.map +1 -1
- package/dist/TimeRangeField/TimeRangeFieldRoot.cjs +1 -1
- package/dist/TimeRangeField/TimeRangeFieldRoot.cjs.map +1 -1
- package/dist/TimeRangeField/TimeRangeFieldRoot.js +1 -1
- package/dist/TimeRangeField/TimeRangeFieldRoot.js.map +1 -1
- package/dist/Toast/ToastRootImpl.cjs +2 -2
- package/dist/Toast/ToastRootImpl.cjs.map +1 -1
- package/dist/Toast/ToastRootImpl.js +2 -2
- package/dist/Toast/ToastRootImpl.js.map +1 -1
- package/dist/Toggle/Toggle.cjs +21 -16
- package/dist/Toggle/Toggle.cjs.map +1 -1
- package/dist/Toggle/Toggle.js +22 -17
- package/dist/Toggle/Toggle.js.map +1 -1
- package/dist/ToggleGroup/ToggleGroupItem.cjs +6 -1
- package/dist/ToggleGroup/ToggleGroupItem.cjs.map +1 -1
- package/dist/ToggleGroup/ToggleGroupItem.js +6 -1
- package/dist/ToggleGroup/ToggleGroupItem.js.map +1 -1
- package/dist/Toolbar/ToolbarToggleItem.cjs +5 -2
- package/dist/Toolbar/ToolbarToggleItem.cjs.map +1 -1
- package/dist/Toolbar/ToolbarToggleItem.js +5 -2
- package/dist/Toolbar/ToolbarToggleItem.js.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.cjs +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.cjs.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/YearPicker/YearPickerCellTrigger.cjs +3 -2
- package/dist/YearPicker/YearPickerCellTrigger.cjs.map +1 -1
- package/dist/YearPicker/YearPickerCellTrigger.js +4 -3
- package/dist/YearPicker/YearPickerCellTrigger.js.map +1 -1
- package/dist/YearRangePicker/YearRangePickerCellTrigger.cjs +3 -2
- package/dist/YearRangePicker/YearRangePickerCellTrigger.cjs.map +1 -1
- package/dist/YearRangePicker/YearRangePickerCellTrigger.js +4 -3
- package/dist/YearRangePicker/YearRangePickerCellTrigger.js.map +1 -1
- package/dist/composables/useSwipeDismiss.cjs +54 -18
- package/dist/composables/useSwipeDismiss.cjs.map +1 -1
- package/dist/composables/useSwipeDismiss.js +54 -18
- package/dist/composables/useSwipeDismiss.js.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.js +2 -0
- package/dist/index2.d.ts.map +1 -1
- package/dist/index3.d.cts +29 -5
- package/dist/index3.d.cts.map +1 -1
- package/dist/index3.d.ts +29 -5
- package/dist/index3.d.ts.map +1 -1
- package/dist/index4.d.cts +687 -679
- package/dist/index4.d.cts.map +1 -1
- package/dist/index4.d.ts +673 -665
- package/dist/index4.d.ts.map +1 -1
- package/dist/internal.cjs +2 -0
- package/dist/internal.d.cts +2 -2
- package/dist/internal.d.cts.map +1 -1
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +2 -0
- package/dist/shared/useBodyScrollLock.cjs +6 -5
- package/dist/shared/useBodyScrollLock.cjs.map +1 -1
- package/dist/shared/useBodyScrollLock.js +6 -5
- package/dist/shared/useBodyScrollLock.js.map +1 -1
- package/dist/shared/useComposing.cjs +19 -0
- package/dist/shared/useComposing.cjs.map +1 -1
- package/dist/shared/useComposing.js +20 -1
- package/dist/shared/useComposing.js.map +1 -1
- package/dist/shared/useForwardScopeId.cjs +34 -0
- package/dist/shared/useForwardScopeId.cjs.map +1 -0
- package/dist/shared/useForwardScopeId.js +28 -0
- package/dist/shared/useForwardScopeId.js.map +1 -0
- package/dist/shared.cjs +3 -0
- package/dist/shared.d.cts +2 -2
- package/dist/shared.d.ts +2 -2
- package/dist/shared.js +3 -1
- package/dist/utils/validation.cjs +1 -0
- package/dist/utils/validation.cjs.map +1 -1
- package/dist/utils/validation.js +1 -0
- package/dist/utils/validation.js.map +1 -1
- package/package.json +6 -6
- package/src/AlertDialog/AlertDialogContent.vue +9 -1
- package/src/Autocomplete/AutocompleteInput.vue +3 -2
- package/src/Calendar/CalendarCellTrigger.vue +5 -1
- package/src/Checkbox/CheckboxRoot.vue +30 -16
- package/src/Combobox/ComboboxInput.vue +3 -2
- package/src/ConfigProvider/ConfigProvider.vue +10 -1
- package/src/DateField/DateFieldRoot.vue +4 -1
- package/src/DateRangeField/DateRangeFieldRoot.vue +4 -1
- package/src/DismissableLayer/DismissableLayer.vue +2 -7
- package/src/DismissableLayer/DismissableLayerBranch.vue +1 -1
- package/src/DismissableLayer/context.ts +8 -0
- package/src/Drawer/composables/useSwipeDismiss.ts +94 -26
- package/src/DropdownMenu/DropdownMenuFilter.vue +3 -2
- package/src/FocusScope/FocusScope.vue +16 -5
- package/src/Listbox/ListboxFilter.vue +3 -2
- package/src/Listbox/ListboxRoot.vue +6 -0
- package/src/Menu/MenuContentImpl.vue +8 -1
- package/src/MonthPicker/MonthPickerCellTrigger.vue +5 -1
- package/src/MonthRangePicker/MonthRangePickerCellTrigger.vue +6 -1
- package/src/NumberField/NumberFieldInput.vue +3 -0
- package/src/NumberField/NumberFieldRoot.vue +51 -23
- package/src/Presence/usePresence.ts +14 -2
- package/src/RadioGroup/Radio.vue +29 -18
- package/src/RadioGroup/RadioGroupItem.vue +15 -6
- package/src/RangeCalendar/RangeCalendarCellTrigger.vue +6 -0
- package/src/Rating/RatingRoot.vue +7 -0
- package/src/RovingFocus/RovingFocusItem.vue +16 -1
- package/src/ScrollArea/ScrollAreaThumb.vue +2 -2
- package/src/Splitter/SplitterGroup.vue +4 -2
- package/src/Splitter/utils/validation.ts +11 -7
- package/src/Stepper/StepperIndicator.vue +6 -1
- package/src/Stepper/StepperTrigger.vue +11 -2
- package/src/Switch/SwitchRoot.vue +29 -18
- package/src/TagsInput/TagsInputRoot.vue +6 -4
- package/src/Teleport/Teleport.vue +8 -4
- package/src/TimeField/TimeFieldRoot.vue +4 -1
- package/src/TimeRangeField/TimeRangeFieldRoot.vue +4 -1
- package/src/Toast/ToastRootImpl.vue +5 -2
- package/src/Toggle/Toggle.vue +25 -13
- package/src/ToggleGroup/ToggleGroupItem.vue +5 -2
- package/src/Toolbar/ToolbarToggleItem.vue +4 -1
- package/src/VisuallyHidden/VisuallyHidden.vue +1 -1
- package/src/YearPicker/YearPickerCellTrigger.vue +7 -1
- package/src/YearRangePicker/YearRangePickerCellTrigger.vue +5 -1
- package/src/shared/index.ts +1 -0
- package/src/shared/useBodyScrollLock.ts +9 -1
- package/src/shared/useComposing.ts +53 -2
- package/src/shared/useForwardScopeId.ts +26 -0
|
@@ -95,22 +95,51 @@ const locale = useLocale(propLocale);
|
|
|
95
95
|
const isFormControl = useFormControl(currentElement);
|
|
96
96
|
const inputEl = ref<HTMLInputElement>();
|
|
97
97
|
|
|
98
|
-
const isDecreaseDisabled = computed(() =>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
98
|
+
const isDecreaseDisabled = computed(() => {
|
|
99
|
+
if (isNullish(modelValue.value) || isNaN(modelValue.value)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
// Disabled when a decrement can't produce a smaller in-range value.
|
|
103
|
+
return getNextValue('decrease', modelValue.value) >= modelValue.value;
|
|
104
|
+
});
|
|
105
|
+
const isIncreaseDisabled = computed(() => {
|
|
106
|
+
if (isNullish(modelValue.value) || isNaN(modelValue.value)) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
// Disabled when an increment can't produce a larger in-range value.
|
|
110
|
+
return getNextValue('increase', modelValue.value) <= modelValue.value;
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Compute the clamped value a single increment/decrement (or multi-step key) would land on.
|
|
114
|
+
// When snapping is enabled and `from` is off the step grid, a tick snaps to the nearest grid
|
|
115
|
+
// line in the requested direction (HTML stepUp/stepDown semantics), instead of adding a whole
|
|
116
|
+
// step and rounding to nearest — which overshoots (e.g. 18.98 + step 1 -> 19.98 -> 20 not 19).
|
|
117
|
+
function getNextValue(type: 'increase' | 'decrease', from: number, multiplier = 1): number {
|
|
118
|
+
const stepValue = step.value ?? 1;
|
|
119
|
+
const operator = type === 'increase' ? '+' : '-';
|
|
120
|
+
let nextValue: number;
|
|
121
|
+
|
|
122
|
+
if (stepSnapping.value && !isNaN(stepValue)) {
|
|
123
|
+
const snapped = snapValueToStep(from, min.value, max.value, stepValue);
|
|
124
|
+
if (snapped === from) {
|
|
125
|
+
nextValue = handleDecimalOperation(operator, from, stepValue * multiplier);
|
|
126
|
+
} else {
|
|
127
|
+
// Align to the grid line in the requested direction first…
|
|
128
|
+
// eslint-disable-next-line no-nested-ternary
|
|
129
|
+
const aligned = type === 'increase'
|
|
130
|
+
? (snapped > from ? snapped : handleDecimalOperation('+', snapped, stepValue))
|
|
131
|
+
: (snapped < from ? snapped : handleDecimalOperation('-', snapped, stepValue));
|
|
132
|
+
// …then apply any remaining steps for multi-step keys (PageUp/PageDown).
|
|
133
|
+
nextValue = multiplier > 1
|
|
134
|
+
? handleDecimalOperation(operator, aligned, stepValue * (multiplier - 1))
|
|
135
|
+
: aligned;
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
nextValue = handleDecimalOperation(operator, from, stepValue * multiplier);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return clampInputValue(nextValue);
|
|
142
|
+
}
|
|
114
143
|
|
|
115
144
|
function handleChangingValue(type: 'increase' | 'decrease', multiplier = 1) {
|
|
116
145
|
if (props.focusOnChange) {
|
|
@@ -121,14 +150,13 @@ function handleChangingValue(type: 'increase' | 'decrease', multiplier = 1) {
|
|
|
121
150
|
}
|
|
122
151
|
const currentInputValue = numberParser.parse(inputEl.value?.value ?? '');
|
|
123
152
|
if (isNaN(currentInputValue)) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
} else {
|
|
129
|
-
modelValue.value = clampInputValue(currentInputValue - ((step.value ?? 1) * multiplier));
|
|
130
|
-
}
|
|
153
|
+
// Route the fallback through clampInputValue so the min/max contract still holds
|
|
154
|
+
// (e.g. a negative max would otherwise be violated by the bare 0 fallback).
|
|
155
|
+
modelValue.value = clampInputValue(min.value ?? 0);
|
|
156
|
+
return;
|
|
131
157
|
}
|
|
158
|
+
|
|
159
|
+
modelValue.value = getNextValue(type, currentInputValue, multiplier);
|
|
132
160
|
}
|
|
133
161
|
|
|
134
162
|
function handleIncrease(multiplier = 1) {
|
|
@@ -88,12 +88,16 @@ export function usePresence(
|
|
|
88
88
|
* make sure we only trigger ANIMATION_END for the currently active animation.
|
|
89
89
|
*/
|
|
90
90
|
const handleAnimationEnd = (event: AnimationEvent) => {
|
|
91
|
+
if (event.target !== node.value) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
91
95
|
const currentAnimationName = getAnimationName(node.value);
|
|
92
96
|
const isCurrentAnimation = currentAnimationName.includes(
|
|
93
97
|
CSS.escape(event.animationName),
|
|
94
98
|
);
|
|
95
99
|
const directionName = state.value === 'mounted' ? 'enter' : 'leave';
|
|
96
|
-
if (
|
|
100
|
+
if (isCurrentAnimation) {
|
|
97
101
|
dispatchCustomEvent(`after-${directionName}`);
|
|
98
102
|
dispatch('ANIMATION_END');
|
|
99
103
|
|
|
@@ -112,7 +116,7 @@ export function usePresence(
|
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
// if no animation, immediately trigger 'ANIMATION_END'
|
|
115
|
-
if (
|
|
119
|
+
if (currentAnimationName === 'none') {
|
|
116
120
|
dispatch('ANIMATION_END');
|
|
117
121
|
}
|
|
118
122
|
};
|
|
@@ -156,6 +160,14 @@ export function usePresence(
|
|
|
156
160
|
onUnmounted(() => {
|
|
157
161
|
watcher();
|
|
158
162
|
stateWatcher();
|
|
163
|
+
if (node.value) {
|
|
164
|
+
node.value.removeEventListener('animationstart', handleAnimationStart);
|
|
165
|
+
node.value.removeEventListener('animationcancel', handleAnimationEnd);
|
|
166
|
+
node.value.removeEventListener('animationend', handleAnimationEnd);
|
|
167
|
+
}
|
|
168
|
+
if (timeoutId !== undefined) {
|
|
169
|
+
ownerWindow?.clearTimeout(timeoutId);
|
|
170
|
+
}
|
|
159
171
|
});
|
|
160
172
|
|
|
161
173
|
const isPresent = computed(() =>
|
package/src/RadioGroup/Radio.vue
CHANGED
|
@@ -22,15 +22,22 @@ export interface RadioProps extends PrimitiveProps, FormFieldProps {
|
|
|
22
22
|
import { useVModel } from '@vueuse/core';
|
|
23
23
|
import { computed, toRefs } from 'vue';
|
|
24
24
|
import { Primitive } from '@/Primitive';
|
|
25
|
-
import { useFormControl, useForwardExpose } from '@/shared';
|
|
25
|
+
import { useFormControl, useForwardExpose, useForwardScopeId } from '@/shared';
|
|
26
26
|
import { VisuallyHiddenInput } from '@/VisuallyHidden';
|
|
27
27
|
import { handleSelect } from './utils';
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
checked: undefined,
|
|
32
|
-
as: 'button',
|
|
29
|
+
defineOptions({
|
|
30
|
+
inheritAttrs: false,
|
|
33
31
|
});
|
|
32
|
+
|
|
33
|
+
const props = withDefaults(
|
|
34
|
+
defineProps<RadioProps>(),
|
|
35
|
+
{
|
|
36
|
+
disabled: false,
|
|
37
|
+
checked: undefined,
|
|
38
|
+
as: 'button',
|
|
39
|
+
},
|
|
40
|
+
);
|
|
34
41
|
const emits = defineEmits<RadioEmits>();
|
|
35
42
|
|
|
36
43
|
defineSlots<{
|
|
@@ -47,6 +54,9 @@ const checked = useVModel(props, 'checked', emits, {
|
|
|
47
54
|
const { value } = toRefs(props);
|
|
48
55
|
const { forwardRef, currentElement: triggerElement } = useForwardExpose();
|
|
49
56
|
const isFormControl = useFormControl(triggerElement);
|
|
57
|
+
// Hidden form input is a sibling (not nested) of the control to avoid the
|
|
58
|
+
// `nested-interactive` a11y violation; forward the parent scope id for scoped styles.
|
|
59
|
+
const scopeIdAttrs = useForwardScopeId();
|
|
50
60
|
|
|
51
61
|
const ariaLabel = computed(() => props.id && triggerElement.value ? (document.querySelector(`[for="${props.id}"]`) as HTMLLabelElement)?.innerText ?? props.value : undefined);
|
|
52
62
|
|
|
@@ -74,13 +84,12 @@ function handleClick(event: MouseEvent) {
|
|
|
74
84
|
|
|
75
85
|
<template>
|
|
76
86
|
<Primitive
|
|
77
|
-
v-bind="$attrs"
|
|
78
87
|
:id="id"
|
|
79
88
|
:ref="forwardRef"
|
|
80
89
|
role="radio"
|
|
81
90
|
:type="as === 'button' ? 'button' : undefined"
|
|
82
91
|
:as="as"
|
|
83
|
-
:aria-checked="checked"
|
|
92
|
+
:aria-checked="checked ?? false"
|
|
84
93
|
:aria-label="ariaLabel"
|
|
85
94
|
:as-child="asChild"
|
|
86
95
|
:disabled="disabled ? '' : undefined"
|
|
@@ -89,19 +98,21 @@ function handleClick(event: MouseEvent) {
|
|
|
89
98
|
:value="value"
|
|
90
99
|
:required="required"
|
|
91
100
|
:name="name"
|
|
101
|
+
v-bind="{ ...scopeIdAttrs, ...$attrs }"
|
|
92
102
|
@click.stop="handleClick"
|
|
93
103
|
>
|
|
94
104
|
<slot :checked="checked" />
|
|
95
|
-
|
|
96
|
-
<VisuallyHiddenInput
|
|
97
|
-
v-if="isFormControl && name"
|
|
98
|
-
type="radio"
|
|
99
|
-
tabindex="-1"
|
|
100
|
-
:value="value"
|
|
101
|
-
:checked="!!checked"
|
|
102
|
-
:name="name"
|
|
103
|
-
:disabled="disabled"
|
|
104
|
-
:required="required"
|
|
105
|
-
/>
|
|
106
105
|
</Primitive>
|
|
106
|
+
|
|
107
|
+
<VisuallyHiddenInput
|
|
108
|
+
v-if="isFormControl && name"
|
|
109
|
+
type="radio"
|
|
110
|
+
tabindex="-1"
|
|
111
|
+
:value="value"
|
|
112
|
+
:checked="!!checked"
|
|
113
|
+
:name="name"
|
|
114
|
+
:disabled="disabled"
|
|
115
|
+
:required="required"
|
|
116
|
+
v-bind="scopeIdAttrs"
|
|
117
|
+
/>
|
|
107
118
|
</template>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { ComputedRef } from 'vue';
|
|
3
3
|
import type { RadioProps } from './Radio.vue';
|
|
4
4
|
import type { SelectEvent } from './utils';
|
|
5
|
-
import { createContext, useForwardExpose } from '@/shared';
|
|
5
|
+
import { createContext, useForwardExpose, useForwardScopeId } from '@/shared';
|
|
6
6
|
|
|
7
7
|
export interface RadioGroupItemProps extends Omit<RadioProps, 'checked'> {}
|
|
8
8
|
export type RadioGroupItemEmits = {
|
|
@@ -30,10 +30,13 @@ defineOptions({
|
|
|
30
30
|
inheritAttrs: false,
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
const props = withDefaults(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const props = withDefaults(
|
|
34
|
+
defineProps<RadioGroupItemProps>(),
|
|
35
|
+
{
|
|
36
|
+
disabled: false,
|
|
37
|
+
as: 'button',
|
|
38
|
+
},
|
|
39
|
+
);
|
|
37
40
|
|
|
38
41
|
const emits = defineEmits<RadioGroupItemEmits>();
|
|
39
42
|
|
|
@@ -66,6 +69,7 @@ useEventListener('keydown', (event) => {
|
|
|
66
69
|
isArrowKeyPressed.value = true;
|
|
67
70
|
}
|
|
68
71
|
});
|
|
72
|
+
|
|
69
73
|
useEventListener('keyup', () => {
|
|
70
74
|
isArrowKeyPressed.value = false;
|
|
71
75
|
});
|
|
@@ -82,6 +86,11 @@ function handleFocus() {
|
|
|
82
86
|
}
|
|
83
87
|
}, 0);
|
|
84
88
|
}
|
|
89
|
+
|
|
90
|
+
// `RadioGroupItem` sets `inheritAttrs: false` and wraps the multi-root `Radio`, so the
|
|
91
|
+
// parent's scoped-style id is not auto-forwarded; pass it through manually so consumer
|
|
92
|
+
// `<style scoped>` keeps working.
|
|
93
|
+
const scopeIdAttrs = useForwardScopeId();
|
|
85
94
|
</script>
|
|
86
95
|
|
|
87
96
|
<template>
|
|
@@ -93,7 +102,7 @@ function handleFocus() {
|
|
|
93
102
|
:active="checked"
|
|
94
103
|
>
|
|
95
104
|
<Radio
|
|
96
|
-
v-bind="{ ...$attrs, ...props }"
|
|
105
|
+
v-bind="{ ...scopeIdAttrs, ...$attrs, ...props }"
|
|
97
106
|
:ref="forwardRef"
|
|
98
107
|
:checked="checked"
|
|
99
108
|
:required="required"
|
|
@@ -188,6 +188,12 @@ function handleArrowKey(e: KeyboardEvent) {
|
|
|
188
188
|
if (isDisabled.value) {
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
+
// Modifier combos on Enter/Space (e.g. Ctrl+Enter) are not handled by the cell —
|
|
192
|
+
// let them bubble so parent listeners can react (e.g. submit a form).
|
|
193
|
+
if ((e.code === KEY_CODES.ENTER || e.code === KEY_CODES.SPACE) && (e.ctrlKey || e.metaKey || e.altKey)) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
191
197
|
e.preventDefault();
|
|
192
198
|
e.stopPropagation();
|
|
193
199
|
const parentElement = rootContext.parentElement.value!;
|
|
@@ -94,6 +94,12 @@ function changeHoveredRating(rating: number) {
|
|
|
94
94
|
hoveredRating.value = rating;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
// Unconditional, so a preview left over from a `hoverable`/`disabled` toggle
|
|
98
|
+
// mid-hover still clears once the pointer leaves.
|
|
99
|
+
function resetHoveredRating() {
|
|
100
|
+
hoveredRating.value = 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
97
103
|
provideRatingRootContext({
|
|
98
104
|
modelValue,
|
|
99
105
|
items,
|
|
@@ -109,6 +115,7 @@ provideRatingRootContext({
|
|
|
109
115
|
<RadioGroupRoot
|
|
110
116
|
v-bind="reactiveOmit(props, 'length', 'clearable', 'hoverable', 'step')"
|
|
111
117
|
:disabled="disabled"
|
|
118
|
+
@mouseleave="resetHoveredRating"
|
|
112
119
|
>
|
|
113
120
|
<slot
|
|
114
121
|
:items="items"
|
|
@@ -16,7 +16,7 @@ export interface RovingFocusItemProps extends PrimitiveProps {
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<script setup lang="ts">
|
|
19
|
-
import { computed, nextTick, onMounted, onUnmounted } from 'vue';
|
|
19
|
+
import { computed, nextTick, onMounted, onUnmounted, watch } from 'vue';
|
|
20
20
|
import { useCollection } from '@/Collection';
|
|
21
21
|
import { Primitive } from '@/Primitive';
|
|
22
22
|
import { useId } from '@/shared';
|
|
@@ -42,12 +42,27 @@ onMounted(() => {
|
|
|
42
42
|
context.onFocusableItemAdd();
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
+
|
|
45
46
|
onUnmounted(() => {
|
|
46
47
|
if (props.focusable) {
|
|
47
48
|
context.onFocusableItemRemove();
|
|
48
49
|
}
|
|
49
50
|
});
|
|
50
51
|
|
|
52
|
+
watch(
|
|
53
|
+
() => props.focusable,
|
|
54
|
+
(newVal, oldVal) => {
|
|
55
|
+
if (newVal === oldVal) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (newVal) {
|
|
59
|
+
context.onFocusableItemAdd();
|
|
60
|
+
} else {
|
|
61
|
+
context.onFocusableItemRemove();
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
|
|
51
66
|
function handleKeydown(event: KeyboardEvent) {
|
|
52
67
|
if (event.key === 'Tab' && event.shiftKey) {
|
|
53
68
|
context.onItemShiftTab();
|
|
@@ -63,8 +63,8 @@ watchOnce(sizes, () => {
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
onUnmounted(() => {
|
|
66
|
-
viewport.value
|
|
67
|
-
|
|
66
|
+
viewport.value?.removeEventListener('scroll', handleScroll);
|
|
67
|
+
removeUnlinkedScrollListenerRef.value?.();
|
|
68
68
|
});
|
|
69
69
|
</script>
|
|
70
70
|
|
|
@@ -873,7 +873,9 @@ function isPanelCollapsed(panelData: PanelData) {
|
|
|
873
873
|
const constraints = panelConstraintsArray?.[panelIndex] ?? panelData.constraints;
|
|
874
874
|
return constraints.defaultSize === constraints.collapsedSize;
|
|
875
875
|
} else {
|
|
876
|
-
|
|
876
|
+
// Fuzzy compare: px sizeUnit converts constraints px→% and renormalizes the
|
|
877
|
+
// layout, so panelSize drifts from collapsedSize by a float epsilon.
|
|
878
|
+
return fuzzyCompareNumbers(panelSize, collapsedSize) <= 0;
|
|
877
879
|
}
|
|
878
880
|
}
|
|
879
881
|
|
|
@@ -898,7 +900,7 @@ function isPanelExpanded(panelData: PanelData) {
|
|
|
898
900
|
`Panel size not found for panel "${panelData.id}"`,
|
|
899
901
|
);
|
|
900
902
|
|
|
901
|
-
return !collapsible || panelSize >
|
|
903
|
+
return !collapsible || fuzzyCompareNumbers(panelSize, collapsedSize) > 0;
|
|
902
904
|
}
|
|
903
905
|
|
|
904
906
|
providePanelGroupContext({
|
|
@@ -12,6 +12,12 @@ export function validatePanelGroupLayout({
|
|
|
12
12
|
panelConstraints: Array<PanelConstraints>;
|
|
13
13
|
}): Array<number> {
|
|
14
14
|
const nextLayout = [...prevLayout];
|
|
15
|
+
|
|
16
|
+
// An empty group has no sizes to total, so 0 !== 100 here is not a misconfiguration
|
|
17
|
+
if (nextLayout.length === 0 && panelConstraints.length === 0) {
|
|
18
|
+
return nextLayout;
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
const nextLayoutTotalSize = nextLayout.reduce(
|
|
16
22
|
(accumulated, current) => accumulated + current,
|
|
17
23
|
0,
|
|
@@ -27,14 +33,12 @@ export function validatePanelGroupLayout({
|
|
|
27
33
|
} else if (!fuzzyNumbersEqual(nextLayoutTotalSize, 100)) {
|
|
28
34
|
// This is not ideal so we should warn about it, but it may be recoverable in some cases
|
|
29
35
|
// (especially if the amount is small)
|
|
36
|
+
console.warn(
|
|
37
|
+
`WARNING: Invalid layout total size: ${nextLayout
|
|
38
|
+
.map((size) => `${size}%`)
|
|
39
|
+
.join(', ')}. Layout normalization will be applied.`,
|
|
40
|
+
);
|
|
30
41
|
|
|
31
|
-
if (true) {
|
|
32
|
-
console.warn(
|
|
33
|
-
`WARNING: Invalid layout total size: ${nextLayout
|
|
34
|
-
.map((size) => `${size}%`)
|
|
35
|
-
.join(', ')}. Layout normalization will be applied.`,
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
42
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
39
43
|
const unsafeSize = nextLayout[index];
|
|
40
44
|
assert(unsafeSize != null);
|
|
@@ -9,7 +9,12 @@ import { Primitive } from '@/Primitive';
|
|
|
9
9
|
|
|
10
10
|
export interface StepperIndicatorProps extends PrimitiveProps { }
|
|
11
11
|
|
|
12
|
-
const props =
|
|
12
|
+
const props = withDefaults(
|
|
13
|
+
defineProps<StepperIndicatorProps>(),
|
|
14
|
+
{
|
|
15
|
+
as: 'span',
|
|
16
|
+
},
|
|
17
|
+
);
|
|
13
18
|
|
|
14
19
|
defineSlots<{
|
|
15
20
|
default?: (props: {
|
|
@@ -68,12 +68,21 @@ function handleKeyDown(event: KeyboardEvent) {
|
|
|
68
68
|
|
|
69
69
|
const { forwardRef, currentElement } = useForwardExpose();
|
|
70
70
|
|
|
71
|
+
let registeredElement: HTMLElement | null = null;
|
|
72
|
+
|
|
71
73
|
onMounted(() => {
|
|
72
|
-
|
|
74
|
+
registeredElement = currentElement.value;
|
|
75
|
+
|
|
76
|
+
if (registeredElement) {
|
|
77
|
+
rootContext.totalStepperItems.value.add(registeredElement);
|
|
78
|
+
}
|
|
73
79
|
});
|
|
74
80
|
|
|
75
81
|
onUnmounted(() => {
|
|
76
|
-
|
|
82
|
+
if (registeredElement) {
|
|
83
|
+
rootContext.totalStepperItems.value.delete(registeredElement);
|
|
84
|
+
registeredElement = null;
|
|
85
|
+
}
|
|
77
86
|
});
|
|
78
87
|
</script>
|
|
79
88
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { ComputedRef, Ref } from 'vue';
|
|
3
3
|
import type { PrimitiveProps } from '@/Primitive';
|
|
4
4
|
import type { FormFieldProps } from '@/shared/types';
|
|
5
|
-
import { createContext, useFormControl, useForwardExpose } from '@/shared';
|
|
5
|
+
import { createContext, useFormControl, useForwardExpose, useForwardScopeId } from '@/shared';
|
|
6
6
|
|
|
7
7
|
export interface SwitchRootProps<T = boolean> extends PrimitiveProps, FormFieldProps {
|
|
8
8
|
/** The state of the switch when it is initially rendered. Use when you do not need to control its state. */
|
|
@@ -45,13 +45,20 @@ import { computed, toRefs } from 'vue';
|
|
|
45
45
|
import { Primitive } from '@/Primitive';
|
|
46
46
|
import { VisuallyHiddenInput } from '@/VisuallyHidden';
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
modelValue: undefined,
|
|
51
|
-
value: 'on',
|
|
52
|
-
trueValue: (() => true) as unknown as undefined,
|
|
53
|
-
falseValue: (() => false) as unknown as undefined,
|
|
48
|
+
defineOptions({
|
|
49
|
+
inheritAttrs: false,
|
|
54
50
|
});
|
|
51
|
+
|
|
52
|
+
const props = withDefaults(
|
|
53
|
+
defineProps<SwitchRootProps<T>>(),
|
|
54
|
+
{
|
|
55
|
+
as: 'button',
|
|
56
|
+
modelValue: undefined,
|
|
57
|
+
value: 'on',
|
|
58
|
+
trueValue: (() => true) as unknown as undefined,
|
|
59
|
+
falseValue: (() => false) as unknown as undefined,
|
|
60
|
+
},
|
|
61
|
+
);
|
|
55
62
|
const emit = defineEmits<SwitchRootEmits<T>>();
|
|
56
63
|
|
|
57
64
|
defineSlots<{
|
|
@@ -82,6 +89,9 @@ function toggleCheck() {
|
|
|
82
89
|
|
|
83
90
|
const { forwardRef, currentElement } = useForwardExpose();
|
|
84
91
|
const isFormControl = useFormControl(currentElement);
|
|
92
|
+
// Hidden form input is a sibling (not nested) of the control to avoid the
|
|
93
|
+
// `nested-interactive` a11y violation; forward the parent scope id for scoped styles.
|
|
94
|
+
const scopeIdAttrs = useForwardScopeId();
|
|
85
95
|
const ariaLabel = computed(() => props.id && currentElement.value ? (document.querySelector(`[for="${props.id}"]`) as HTMLLabelElement)?.innerText : undefined);
|
|
86
96
|
|
|
87
97
|
provideSwitchRootContext({
|
|
@@ -93,7 +103,6 @@ provideSwitchRootContext({
|
|
|
93
103
|
|
|
94
104
|
<template>
|
|
95
105
|
<Primitive
|
|
96
|
-
v-bind="$attrs"
|
|
97
106
|
:id="id"
|
|
98
107
|
:ref="forwardRef"
|
|
99
108
|
role="switch"
|
|
@@ -107,6 +116,7 @@ provideSwitchRootContext({
|
|
|
107
116
|
:as-child="asChild"
|
|
108
117
|
:as="as"
|
|
109
118
|
:disabled="disabled"
|
|
119
|
+
v-bind="{ ...scopeIdAttrs, ...$attrs }"
|
|
110
120
|
@click="toggleCheck"
|
|
111
121
|
@keydown.enter.prevent="toggleCheck"
|
|
112
122
|
>
|
|
@@ -114,15 +124,16 @@ provideSwitchRootContext({
|
|
|
114
124
|
:model-value="modelValue"
|
|
115
125
|
:checked="checked"
|
|
116
126
|
/>
|
|
117
|
-
|
|
118
|
-
<VisuallyHiddenInput
|
|
119
|
-
v-if="isFormControl && name"
|
|
120
|
-
type="checkbox"
|
|
121
|
-
:name="name"
|
|
122
|
-
:disabled="disabled"
|
|
123
|
-
:required="required"
|
|
124
|
-
:value="value"
|
|
125
|
-
:checked="checked"
|
|
126
|
-
/>
|
|
127
127
|
</Primitive>
|
|
128
|
+
|
|
129
|
+
<VisuallyHiddenInput
|
|
130
|
+
v-if="isFormControl && name"
|
|
131
|
+
type="checkbox"
|
|
132
|
+
:name="name"
|
|
133
|
+
:disabled="disabled"
|
|
134
|
+
:required="required"
|
|
135
|
+
:value="value"
|
|
136
|
+
:checked="checked"
|
|
137
|
+
v-bind="scopeIdAttrs"
|
|
138
|
+
/>
|
|
128
139
|
</template>
|
|
@@ -69,7 +69,7 @@ export const [injectTagsInputRootContext, provideTagsInputRootContext]
|
|
|
69
69
|
</script>
|
|
70
70
|
|
|
71
71
|
<script setup lang="ts" generic="T extends AcceptableInputValue = string">
|
|
72
|
-
import { isFunction } from '@vinicunca/perkakas';
|
|
72
|
+
import { isDeepEqual, isFunction } from '@vinicunca/perkakas';
|
|
73
73
|
import { useFocusWithin, useVModel } from '@vueuse/core';
|
|
74
74
|
import { useCollection } from '@/Collection';
|
|
75
75
|
import { Primitive } from '@/Primitive';
|
|
@@ -112,9 +112,9 @@ const currentModelValue = computed(() => Array.isArray(modelValue.value) ? [...m
|
|
|
112
112
|
|
|
113
113
|
function handleRemoveTag(index: number) {
|
|
114
114
|
if (index !== -1) {
|
|
115
|
-
const
|
|
115
|
+
const removedValue = modelValue.value[index] as T;
|
|
116
116
|
modelValue.value = modelValue.value.filter((_, i) => i !== index);
|
|
117
|
-
emits('removeTag',
|
|
117
|
+
emits('removeTag', removedValue);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -176,7 +176,9 @@ provideTagsInputRootContext({
|
|
|
176
176
|
|
|
177
177
|
if (selectedElement.value) {
|
|
178
178
|
const index = collection.findIndex((i) => i === selectedElement.value);
|
|
179
|
-
|
|
179
|
+
const selectedItem = getItems().find((i) => i.ref === selectedElement.value);
|
|
180
|
+
const modelIndex = selectedItem ? modelValue.value.findIndex((v) => isDeepEqual(v, selectedItem.value)) : -1;
|
|
181
|
+
handleRemoveTag(modelIndex);
|
|
180
182
|
selectedElement.value = selectedElement.value === lastTag ? collection.at(index - 1) : collection.at(index + 1);
|
|
181
183
|
event.preventDefault();
|
|
182
184
|
} else if (event.key === 'Backspace') {
|
|
@@ -29,10 +29,14 @@ export interface TeleportProps {
|
|
|
29
29
|
|
|
30
30
|
<script setup lang="ts">
|
|
31
31
|
import { useMounted } from '@vueuse/core';
|
|
32
|
+
import { computed } from 'vue';
|
|
33
|
+
import { injectConfigProviderContext } from '@/ConfigProvider';
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
35
|
+
const props = defineProps<TeleportProps>();
|
|
36
|
+
|
|
37
|
+
const configContext = injectConfigProviderContext({});
|
|
38
|
+
|
|
39
|
+
const target = computed(() => props.to ?? configContext.teleportTo?.value ?? 'body');
|
|
36
40
|
|
|
37
41
|
const isMounted = useMounted();
|
|
38
42
|
</script>
|
|
@@ -40,7 +44,7 @@ const isMounted = useMounted();
|
|
|
40
44
|
<template>
|
|
41
45
|
<Teleport
|
|
42
46
|
v-if="isMounted || forceMount"
|
|
43
|
-
:to="
|
|
47
|
+
:to="target"
|
|
44
48
|
:disabled="disabled"
|
|
45
49
|
:defer="defer"
|
|
46
50
|
>
|
|
@@ -344,7 +344,10 @@ provideTimeFieldRootContext({
|
|
|
344
344
|
elements: segmentElements,
|
|
345
345
|
setFocusedElement,
|
|
346
346
|
focusNext() {
|
|
347
|
-
|
|
347
|
+
// Auto-advance follows the segments' DOM order (the locale's format
|
|
348
|
+
// order) regardless of writing direction; only arrow-key navigation is
|
|
349
|
+
// direction-aware via nextFocusableSegment/prevFocusableSegment.
|
|
350
|
+
Array.from(segmentElements.value)[currentSegmentIndex.value + 1]?.focus();
|
|
348
351
|
},
|
|
349
352
|
});
|
|
350
353
|
|
|
@@ -453,7 +453,10 @@ provideTimeRangeFieldRootContext({
|
|
|
453
453
|
elements: segmentElements,
|
|
454
454
|
setFocusedElement,
|
|
455
455
|
focusNext() {
|
|
456
|
-
|
|
456
|
+
// Auto-advance follows the segments' DOM order (the locale's format
|
|
457
|
+
// order) regardless of writing direction; only arrow-key navigation is
|
|
458
|
+
// direction-aware via nextFocusableSegment/prevFocusableSegment.
|
|
459
|
+
Array.from(segmentElements.value)[currentSegmentIndex.value + 1]?.focus();
|
|
457
460
|
},
|
|
458
461
|
});
|
|
459
462
|
|
|
@@ -136,6 +136,7 @@ watchEffect((cleanupFn) => {
|
|
|
136
136
|
remainingRaf.resume();
|
|
137
137
|
emits('resume');
|
|
138
138
|
};
|
|
139
|
+
|
|
139
140
|
const handlePause = () => {
|
|
140
141
|
const elapsedTime = Date.now() - closeTimerStartTimeRef.value;
|
|
141
142
|
closeTimerRemainingTimeRef.value = closeTimerRemainingTimeRef.value - elapsedTime;
|
|
@@ -143,12 +144,14 @@ watchEffect((cleanupFn) => {
|
|
|
143
144
|
remainingRaf.pause();
|
|
144
145
|
emits('pause');
|
|
145
146
|
};
|
|
147
|
+
|
|
146
148
|
viewport.addEventListener(VIEWPORT_PAUSE, handlePause);
|
|
147
149
|
viewport.addEventListener(VIEWPORT_RESUME, handleResume);
|
|
148
|
-
|
|
150
|
+
|
|
151
|
+
cleanupFn(() => {
|
|
149
152
|
viewport.removeEventListener(VIEWPORT_PAUSE, handlePause);
|
|
150
153
|
viewport.removeEventListener(VIEWPORT_RESUME, handleResume);
|
|
151
|
-
};
|
|
154
|
+
});
|
|
152
155
|
}
|
|
153
156
|
});
|
|
154
157
|
|