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
|
@@ -5,7 +5,7 @@ import type { PrimitiveProps } from '@/Primitive';
|
|
|
5
5
|
import type { AcceptableValue, FormFieldProps } from '@/shared/types';
|
|
6
6
|
import { isDeepEqual, isNullish } from '@vinicunca/perkakas';
|
|
7
7
|
import { useVModel } from '@vueuse/core';
|
|
8
|
-
import { createContext, isValueEqualOrExist, useFormControl, useForwardExpose } from '@/shared';
|
|
8
|
+
import { createContext, isValueEqualOrExist, useFormControl, useForwardExpose, useForwardScopeId } from '@/shared';
|
|
9
9
|
import { injectCheckboxGroupRootContext } from './CheckboxGroupRoot.vue';
|
|
10
10
|
|
|
11
11
|
export interface CheckboxRootProps<T = boolean> extends PrimitiveProps, FormFieldProps {
|
|
@@ -47,7 +47,7 @@ export const [injectCheckboxRootContext, provideCheckboxRootContext]
|
|
|
47
47
|
</script>
|
|
48
48
|
|
|
49
49
|
<script setup lang="ts" generic="T = boolean">
|
|
50
|
-
import { computed } from 'vue';
|
|
50
|
+
import { computed, useAttrs } from 'vue';
|
|
51
51
|
import { Primitive } from '@/Primitive';
|
|
52
52
|
import { RovingFocusItem } from '@/RovingFocus';
|
|
53
53
|
import { VisuallyHiddenInput } from '@/VisuallyHidden';
|
|
@@ -119,9 +119,22 @@ function handleClick() {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
const isFormControl = useFormControl(currentElement);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
// The hidden form input is rendered as a sibling (not nested) of the interactive
|
|
123
|
+
// control to avoid the `nested-interactive` a11y violation. That makes this a
|
|
124
|
+
// multi-root component, so the parent's scoped-style id must be forwarded manually.
|
|
125
|
+
const scopeIdAttrs = useForwardScopeId();
|
|
126
|
+
|
|
127
|
+
const attrs = useAttrs();
|
|
128
|
+
const ariaLabel = computed(() => {
|
|
129
|
+
// An explicit `aria-label` always wins, so skip the (potentially expensive)
|
|
130
|
+
// label lookup entirely — this matters when rendering many checkboxes at once.
|
|
131
|
+
if (attrs['aria-label']) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
return props.id && currentElement.value
|
|
135
|
+
? (document.querySelector(`[for="${props.id}"]`) as HTMLLabelElement)?.innerText
|
|
136
|
+
: undefined;
|
|
137
|
+
});
|
|
125
138
|
|
|
126
139
|
provideCheckboxRootContext({
|
|
127
140
|
disabled,
|
|
@@ -131,7 +144,7 @@ provideCheckboxRootContext({
|
|
|
131
144
|
|
|
132
145
|
<template>
|
|
133
146
|
<component
|
|
134
|
-
v-bind="
|
|
147
|
+
v-bind="{ ...$attrs, ...scopeIdAttrs }"
|
|
135
148
|
:is="checkboxGroupContext?.rovingFocus.value ? RovingFocusItem : Primitive"
|
|
136
149
|
:id="id"
|
|
137
150
|
:ref="forwardRef"
|
|
@@ -155,15 +168,16 @@ provideCheckboxRootContext({
|
|
|
155
168
|
:model-value="modelValue"
|
|
156
169
|
:state="checkboxState"
|
|
157
170
|
/>
|
|
158
|
-
|
|
159
|
-
<VisuallyHiddenInput
|
|
160
|
-
v-if="isFormControl && name && !checkboxGroupContext"
|
|
161
|
-
type="checkbox"
|
|
162
|
-
:checked="!!checkboxState"
|
|
163
|
-
:name="name"
|
|
164
|
-
:value="value"
|
|
165
|
-
:disabled="disabled"
|
|
166
|
-
:required="required"
|
|
167
|
-
/>
|
|
168
171
|
</component>
|
|
172
|
+
|
|
173
|
+
<VisuallyHiddenInput
|
|
174
|
+
v-if="isFormControl && name && !checkboxGroupContext"
|
|
175
|
+
type="checkbox"
|
|
176
|
+
:checked="!!checkboxState"
|
|
177
|
+
:name="name"
|
|
178
|
+
:value="value"
|
|
179
|
+
:disabled="disabled"
|
|
180
|
+
:required="required"
|
|
181
|
+
v-bind="scopeIdAttrs"
|
|
182
|
+
/>
|
|
169
183
|
</template>
|
|
@@ -36,7 +36,7 @@ onMounted(() => {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
const { isComposing, handleCompositionStart, handleCompositionEnd } = useComposing((event) => {
|
|
39
|
+
const { isComposing, shouldDeferInput, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd } = useComposing((event) => {
|
|
40
40
|
const el = event.target as HTMLInputElement;
|
|
41
41
|
if (el) {
|
|
42
42
|
processInputValue(el.value);
|
|
@@ -70,7 +70,7 @@ function processInputValue(value: string) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
function handleInput(event: InputEvent) {
|
|
73
|
-
if (
|
|
73
|
+
if (shouldDeferInput.value) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -182,6 +182,7 @@ watch(rootContext.filterState, (_newValue, oldValue) => {
|
|
|
182
182
|
@focus="handleFocus"
|
|
183
183
|
@blur="handleBlur"
|
|
184
184
|
@compositionstart="handleCompositionStart"
|
|
185
|
+
@compositionupdate="handleCompositionUpdate"
|
|
185
186
|
@compositionend="handleCompositionEnd"
|
|
186
187
|
>
|
|
187
188
|
<slot />
|
|
@@ -8,6 +8,7 @@ interface ConfigProviderContextValue {
|
|
|
8
8
|
locale?: Ref<string>;
|
|
9
9
|
scrollBody?: Ref<boolean | ScrollBodyOption>;
|
|
10
10
|
nonce?: Ref<string | undefined>;
|
|
11
|
+
teleportTo?: Ref<string | HTMLElement | undefined>;
|
|
11
12
|
useId?: () => string;
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -35,6 +36,13 @@ export interface ConfigProviderProps {
|
|
|
35
36
|
* @type string
|
|
36
37
|
*/
|
|
37
38
|
nonce?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The global default teleport target for all portalled primitives (e.g. `Dialog`, `Popover`, `Tooltip`).
|
|
41
|
+
* Individual `*Portal` components can still override this via their own `to` prop.
|
|
42
|
+
* Useful when rendering inside a custom element / shadow DOM.
|
|
43
|
+
* @type string | HTMLElement
|
|
44
|
+
*/
|
|
45
|
+
teleportTo?: string | HTMLElement;
|
|
38
46
|
/**
|
|
39
47
|
* The global `useId` injection as a workaround for preventing hydration issue.
|
|
40
48
|
*/
|
|
@@ -57,13 +65,14 @@ const props = withDefaults(defineProps<ConfigProviderProps>(), {
|
|
|
57
65
|
useId: undefined,
|
|
58
66
|
});
|
|
59
67
|
|
|
60
|
-
const { dir, locale, scrollBody, nonce } = toRefs(props);
|
|
68
|
+
const { dir, locale, scrollBody, nonce, teleportTo } = toRefs(props);
|
|
61
69
|
|
|
62
70
|
provideConfigProviderContext({
|
|
63
71
|
dir,
|
|
64
72
|
locale,
|
|
65
73
|
scrollBody,
|
|
66
74
|
nonce,
|
|
75
|
+
teleportTo,
|
|
67
76
|
useId: props.useId,
|
|
68
77
|
});
|
|
69
78
|
</script>
|
|
@@ -306,7 +306,10 @@ provideDateFieldRootContext({
|
|
|
306
306
|
elements: segmentElements,
|
|
307
307
|
setFocusedElement,
|
|
308
308
|
focusNext() {
|
|
309
|
-
|
|
309
|
+
// Auto-advance follows the segments' DOM order (the locale's format
|
|
310
|
+
// order) regardless of writing direction; only arrow-key navigation is
|
|
311
|
+
// direction-aware via nextFocusableSegment/prevFocusableSegment.
|
|
312
|
+
Array.from(segmentElements.value)[currentSegmentIndex.value + 1]?.focus();
|
|
310
313
|
},
|
|
311
314
|
});
|
|
312
315
|
|
|
@@ -389,7 +389,10 @@ provideDateRangeFieldRootContext({
|
|
|
389
389
|
elements: segmentElements,
|
|
390
390
|
setFocusedElement,
|
|
391
391
|
focusNext() {
|
|
392
|
-
|
|
392
|
+
// Auto-advance follows the segments' DOM order (the locale's format
|
|
393
|
+
// order) regardless of writing direction; only arrow-key navigation is
|
|
394
|
+
// direction-aware via nextFocusableSegment/prevFocusableSegment.
|
|
395
|
+
Array.from(segmentElements.value)[currentSegmentIndex.value + 1]?.focus();
|
|
393
396
|
},
|
|
394
397
|
});
|
|
395
398
|
|
|
@@ -8,11 +8,11 @@ import { isNullish } from '@vinicunca/perkakas';
|
|
|
8
8
|
import {
|
|
9
9
|
computed,
|
|
10
10
|
nextTick,
|
|
11
|
-
reactive,
|
|
12
11
|
watch,
|
|
13
12
|
watchEffect,
|
|
14
13
|
} from 'vue';
|
|
15
14
|
import { useForwardExpose } from '@/shared';
|
|
15
|
+
import { context } from './context';
|
|
16
16
|
|
|
17
17
|
export interface DismissableLayerProps extends PrimitiveProps {
|
|
18
18
|
/**
|
|
@@ -54,12 +54,7 @@ export type DismissableLayerPrivateEmits = DismissableLayerEmits & {
|
|
|
54
54
|
dismiss: [];
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
export
|
|
58
|
-
layersRoot: new Set<HTMLElement>(),
|
|
59
|
-
layersWithOutsidePointerEventsDisabled: new Set<HTMLElement>(),
|
|
60
|
-
originalBodyPointerEvents: undefined as string | undefined,
|
|
61
|
-
branches: new Set<HTMLElement>(),
|
|
62
|
-
});
|
|
57
|
+
export { context };
|
|
63
58
|
</script>
|
|
64
59
|
|
|
65
60
|
<script setup lang="ts">
|
|
@@ -8,7 +8,7 @@ export interface DismissableLayerBranchProps extends PrimitiveProps {}
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
9
|
import { onMounted, onUnmounted } from 'vue';
|
|
10
10
|
import { Primitive } from '@/Primitive';
|
|
11
|
-
import { context } from './
|
|
11
|
+
import { context } from './context';
|
|
12
12
|
|
|
13
13
|
const props = defineProps<DismissableLayerBranchProps>();
|
|
14
14
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { reactive } from 'vue';
|
|
2
|
+
|
|
3
|
+
export const context = reactive({
|
|
4
|
+
layersRoot: new Set<HTMLElement>(),
|
|
5
|
+
layersWithOutsidePointerEventsDisabled: new Set<HTMLElement>(),
|
|
6
|
+
originalBodyPointerEvents: undefined as string | undefined,
|
|
7
|
+
branches: new Set<HTMLElement>(),
|
|
8
|
+
});
|
|
@@ -190,7 +190,12 @@ export function useSwipeDismiss(options: UseSwipeDismissOptions) {
|
|
|
190
190
|
el.style.setProperty(movementCssVars.y, '0px');
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
/**
|
|
194
|
+
* Clears the per-gesture tracking state. Deliberately leaves the pointer
|
|
195
|
+
* identity and the touch scroll-guard flags alone, so it is safe to call at
|
|
196
|
+
* the start of a gesture as well as at the end of one.
|
|
197
|
+
*/
|
|
198
|
+
function resetGestureState() {
|
|
194
199
|
setSwiping(false);
|
|
195
200
|
swipeDirection.value = undefined;
|
|
196
201
|
dragOffset.value = { x: 0, y: 0 };
|
|
@@ -201,18 +206,27 @@ export function useSwipeDismiss(options: UseSwipeDismissOptions) {
|
|
|
201
206
|
isFirstMove = false;
|
|
202
207
|
pendingSwipe = false;
|
|
203
208
|
pendingSwipeStartPos = null;
|
|
204
|
-
swipeFromScrollable = false;
|
|
205
|
-
scrollableAncestor = null;
|
|
206
209
|
elementSize = { width: 0, height: 0 };
|
|
207
210
|
swipeProgress = 0;
|
|
208
211
|
lastDragSample = null;
|
|
209
212
|
lastVelocity = { x: 0, y: 0 };
|
|
210
213
|
lockedAxis = null;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function reset() {
|
|
217
|
+
resetGestureState();
|
|
218
|
+
swipeFromScrollable = false;
|
|
219
|
+
scrollableAncestor = null;
|
|
211
220
|
activePointerId = null;
|
|
212
221
|
pointerStarted = false;
|
|
213
222
|
}
|
|
214
223
|
|
|
215
224
|
function startSwipe(el: HTMLElement, pos: { x: number; y: number }) {
|
|
225
|
+
// Start from a clean slate (BaseUI parity: `startSwipeAtPosition` resets the
|
|
226
|
+
// gesture refs on every press). A previous gesture whose end we never saw
|
|
227
|
+
// would otherwise leak `isSwiping`, the intended direction and the velocity
|
|
228
|
+
// samples into this one.
|
|
229
|
+
resetGestureState();
|
|
216
230
|
// Capture the element's current transform so we can account for it
|
|
217
231
|
getElementTransform(el);
|
|
218
232
|
dragStartPos = pos;
|
|
@@ -272,24 +286,19 @@ export function useSwipeDismiss(options: UseSwipeDismissOptions) {
|
|
|
272
286
|
const dir: SwipeDirection | undefined = toValue(directions).find((d) => getDisplacement(d, dx, dy) > 0);
|
|
273
287
|
|
|
274
288
|
if (pendingSwipe && pendingSwipeStartPos) {
|
|
275
|
-
//
|
|
276
|
-
//
|
|
277
|
-
//
|
|
278
|
-
//
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
pos.y - pendingSwipeStartPos.y,
|
|
286
|
-
);
|
|
287
|
-
if (Math.abs(pending) < MIN_DRAG_THRESHOLD) {
|
|
289
|
+
// BaseUI parity (`useSwipeDismiss.ts:startSwipeAtPosition`): the drag is
|
|
290
|
+
// tracked from the first movement whatever its direction — the gesture
|
|
291
|
+
// does NOT need to point at a dismissable direction to begin. Movement
|
|
292
|
+
// along a non-dismissable direction still reaches
|
|
293
|
+
// `applyDirectionalDamping` below, which sqrt-damps it; that damped
|
|
294
|
+
// offset is the elastic "pull" feedback you get when dragging a bottom
|
|
295
|
+
// drawer upward. Bailing out on `!dir` instead would leave the drawer
|
|
296
|
+
// completely frozen until the user drags the dismissable way.
|
|
297
|
+
const pending = Math.max(Math.abs(dx), Math.abs(dy));
|
|
298
|
+
if (pending < MIN_DRAG_THRESHOLD) {
|
|
288
299
|
return;
|
|
289
300
|
}
|
|
290
301
|
pendingSwipe = false;
|
|
291
|
-
intendedDirection = dir;
|
|
292
|
-
swipeDirection.value = dir;
|
|
293
302
|
setSwiping(true);
|
|
294
303
|
onSwipeStart?.();
|
|
295
304
|
}
|
|
@@ -298,11 +307,21 @@ export function useSwipeDismiss(options: UseSwipeDismissOptions) {
|
|
|
298
307
|
return;
|
|
299
308
|
}
|
|
300
309
|
|
|
301
|
-
|
|
302
|
-
|
|
310
|
+
// The intended (dismissable) direction is adopted the first time the drag
|
|
311
|
+
// moves in one, which may be many moves after the swipe started — e.g. pull
|
|
312
|
+
// up, then push back down on a `down` drawer. Until then the gesture has no
|
|
313
|
+
// dismiss candidate and only rubber-bands.
|
|
314
|
+
if (!intendedDirection && dir) {
|
|
315
|
+
intendedDirection = dir;
|
|
316
|
+
swipeDirection.value = dir;
|
|
317
|
+
maxDisplacement = getDisplacement(dir, dx, dy);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const currentDir = intendedDirection;
|
|
303
321
|
|
|
304
322
|
// Detect reversal (cancel swipe)
|
|
305
|
-
if (!cancelledSwipe) {
|
|
323
|
+
if (currentDir && !cancelledSwipe) {
|
|
324
|
+
const displacement = getDisplacement(currentDir, dx, dy);
|
|
306
325
|
maxDisplacement = Math.max(maxDisplacement, displacement);
|
|
307
326
|
if (
|
|
308
327
|
maxDisplacement > DEFAULT_SWIPE_THRESHOLD / 2
|
|
@@ -321,14 +340,18 @@ export function useSwipeDismiss(options: UseSwipeDismissOptions) {
|
|
|
321
340
|
setCssVars(el, damped.x, damped.y);
|
|
322
341
|
recordSample({ x: damped.x, y: damped.y }, time);
|
|
323
342
|
|
|
324
|
-
// Progress: 0 = closed/start, 1 = fully dismissed
|
|
343
|
+
// Progress: 0 = closed/start, 1 = fully dismissed. Before a dismissable
|
|
344
|
+
// direction is adopted, measure against the primary one — a pull away from
|
|
345
|
+
// it yields a negative displacement, which clamps to 0 (BaseUI parity:
|
|
346
|
+
// `progressDirection = primaryDirection ?? intendedSwipeDirection`).
|
|
325
347
|
const currentEl = elementRef.value;
|
|
326
|
-
|
|
327
|
-
|
|
348
|
+
const progressDir = currentDir ?? toValue(directions)[0];
|
|
349
|
+
if (currentEl && progressDir) {
|
|
350
|
+
const dim = (progressDir === 'up' || progressDir === 'down')
|
|
328
351
|
? elementSize.height || currentEl.offsetHeight
|
|
329
352
|
: elementSize.width || currentEl.offsetWidth;
|
|
330
|
-
const threshold = getThreshold(currentEl,
|
|
331
|
-
const p = Math.min(1, Math.max(0,
|
|
353
|
+
const threshold = getThreshold(currentEl, progressDir);
|
|
354
|
+
const p = Math.min(1, Math.max(0, getDisplacement(progressDir, dx, dy) / (dim + threshold)));
|
|
332
355
|
if (p !== swipeProgress) {
|
|
333
356
|
swipeProgress = p;
|
|
334
357
|
onProgress?.(p, { deltaX: damped.x, deltaY: damped.y, direction: currentDir });
|
|
@@ -428,6 +451,13 @@ export function useSwipeDismiss(options: UseSwipeDismissOptions) {
|
|
|
428
451
|
return;
|
|
429
452
|
}
|
|
430
453
|
if ((e.buttons & 1) === 0) {
|
|
454
|
+
// The primary button is no longer held, but we never saw the release —
|
|
455
|
+
// it happened outside the window, over another application, or after the
|
|
456
|
+
// browser dropped pointer capture. Treat this move as the missing
|
|
457
|
+
// `pointerup`: without it the gesture stays wedged with `data-swiping`
|
|
458
|
+
// set (which pins the transition to 0ms), leaving the drawer frozen
|
|
459
|
+
// mid-pull and ignoring every subsequent drag.
|
|
460
|
+
finishSwipe(el);
|
|
431
461
|
return;
|
|
432
462
|
}
|
|
433
463
|
processMove(el, { x: e.clientX, y: e.clientY }, e.timeStamp);
|
|
@@ -439,6 +469,25 @@ export function useSwipeDismiss(options: UseSwipeDismissOptions) {
|
|
|
439
469
|
}
|
|
440
470
|
const el = elementRef.value;
|
|
441
471
|
if (!el) {
|
|
472
|
+
reset();
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
finishSwipe(el);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Ends an in-flight pointer drag that can no longer be tracked — pointer
|
|
480
|
+
* capture was lost, or the window lost focus mid-drag (which is what happens
|
|
481
|
+
* when the release lands over another application). The drawer settles from
|
|
482
|
+
* wherever it was last dragged to.
|
|
483
|
+
*/
|
|
484
|
+
function onPointerInterrupted() {
|
|
485
|
+
if (!pointerStarted) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const el = elementRef.value;
|
|
489
|
+
if (!el) {
|
|
490
|
+
reset();
|
|
442
491
|
return;
|
|
443
492
|
}
|
|
444
493
|
finishSwipe(el);
|
|
@@ -556,16 +605,35 @@ export function useSwipeDismiss(options: UseSwipeDismissOptions) {
|
|
|
556
605
|
return;
|
|
557
606
|
}
|
|
558
607
|
|
|
608
|
+
// BaseUI hangs the gesture off `Drawer.Viewport`, a `position: fixed;
|
|
609
|
+
// inset: 0` element, so the pointer can never leave the element that is
|
|
610
|
+
// listening. Here the listeners live on the popup itself, which the
|
|
611
|
+
// pointer leaves as soon as the drag goes past the drawer's bounds.
|
|
612
|
+
// `setPointerCapture` covers that for an ordinary in-window drag, but a
|
|
613
|
+
// release the popup never sees — outside the window, over another app, or
|
|
614
|
+
// after capture is dropped — would otherwise leave the gesture wedged.
|
|
615
|
+
// Mirror the pointer end events on the document and window so the drag
|
|
616
|
+
// can always be finished.
|
|
617
|
+
const doc = el.ownerDocument;
|
|
618
|
+
const win = doc.defaultView;
|
|
619
|
+
|
|
559
620
|
cleanups.push(
|
|
560
621
|
useEventListener(el, 'pointerdown', onPointerDown as EventListener),
|
|
561
622
|
useEventListener(el, 'pointermove', onPointerMove as EventListener),
|
|
562
623
|
useEventListener(el, 'pointerup', onPointerUp as EventListener),
|
|
563
624
|
useEventListener(el, 'pointercancel', onPointerUp as EventListener),
|
|
625
|
+
useEventListener(el, 'lostpointercapture', onPointerInterrupted as EventListener),
|
|
626
|
+
useEventListener(doc, 'pointerup', onPointerUp as EventListener),
|
|
627
|
+
useEventListener(doc, 'pointercancel', onPointerUp as EventListener),
|
|
564
628
|
useEventListener(el, 'touchstart', onTouchStart as EventListener, { passive: true }),
|
|
565
629
|
useEventListener(el, 'touchmove', onTouchMove as EventListener, { passive: false }),
|
|
566
630
|
useEventListener(el, 'touchend', onTouchEnd as EventListener),
|
|
567
631
|
useEventListener(el, 'touchcancel', onTouchEnd as EventListener),
|
|
568
632
|
);
|
|
633
|
+
|
|
634
|
+
if (win) {
|
|
635
|
+
cleanups.push(useEventListener(win, 'blur', onPointerInterrupted));
|
|
636
|
+
}
|
|
569
637
|
},
|
|
570
638
|
{ immediate: true },
|
|
571
639
|
);
|
|
@@ -77,7 +77,7 @@ onUnmounted(() => {
|
|
|
77
77
|
contentContext.searchRef.value = '';
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
const { isComposing, handleCompositionStart, handleCompositionEnd } = useComposing((event) => {
|
|
80
|
+
const { isComposing, shouldDeferInput, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd } = useComposing((event) => {
|
|
81
81
|
const el = event.target as HTMLInputElement;
|
|
82
82
|
if (el) {
|
|
83
83
|
modelValue.value = el.value;
|
|
@@ -90,7 +90,7 @@ function handleInput(event: InputEvent) {
|
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
if (
|
|
93
|
+
if (shouldDeferInput.value) {
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -142,6 +142,7 @@ function handleKeyDown(event: KeyboardEvent) {
|
|
|
142
142
|
@input="handleInput"
|
|
143
143
|
@keydown="handleKeyDown"
|
|
144
144
|
@compositionstart="handleCompositionStart"
|
|
145
|
+
@compositionupdate="handleCompositionUpdate"
|
|
145
146
|
@compositionend="handleCompositionEnd"
|
|
146
147
|
>
|
|
147
148
|
<slot :model-value="modelValue" />
|
|
@@ -58,10 +58,20 @@ import {
|
|
|
58
58
|
getTabbableEdges,
|
|
59
59
|
} from './utils';
|
|
60
60
|
|
|
61
|
-
const props = withDefaults(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
const props = withDefaults(
|
|
62
|
+
defineProps<FocusScopeProps>(),
|
|
63
|
+
{
|
|
64
|
+
loop: false,
|
|
65
|
+
trapped: false,
|
|
66
|
+
// `present` MUST default to `true`. It is typed `boolean`, so Vue's boolean
|
|
67
|
+
// prop casting would otherwise coerce an absent prop to `false` (not
|
|
68
|
+
// `undefined`), and the `props.present !== false` gates below would then skip
|
|
69
|
+
// adding the scope to the stack for every consumer that doesn't pass `present`
|
|
70
|
+
// (e.g. Combobox/Select content). That scope would never pause an ancestor
|
|
71
|
+
// trap, so a Combobox input inside a Dialog could not be focused (#2749).
|
|
72
|
+
present: true,
|
|
73
|
+
},
|
|
74
|
+
);
|
|
65
75
|
const emits = defineEmits<FocusScopeEmits>();
|
|
66
76
|
|
|
67
77
|
const { currentRef, currentElement } = useForwardExpose();
|
|
@@ -247,7 +257,8 @@ watchEffect(async (cleanupFn) => {
|
|
|
247
257
|
// scopes' traps) and the mount auto-focus (which only fires on physical mount).
|
|
248
258
|
// Awaiting `nextTick` lets the consumer's visibility change (e.g. `v-show`)
|
|
249
259
|
// apply first, so the focus targets exist. Consumers that don't pass `present`
|
|
250
|
-
//
|
|
260
|
+
// default it to `true` (see `withDefaults`); since it never changes for them,
|
|
261
|
+
// this watcher never fires and the main effect above owns their stack membership.
|
|
251
262
|
watch(() => props.present, async (present, prevPresent) => {
|
|
252
263
|
if (!isClient) {
|
|
253
264
|
return;
|
|
@@ -65,7 +65,7 @@ onUnmounted(() => {
|
|
|
65
65
|
rootContext.focusable.value = true;
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
const { isComposing, handleCompositionStart, handleCompositionEnd } = useComposing((event) => {
|
|
68
|
+
const { isComposing, shouldDeferInput, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd } = useComposing((event) => {
|
|
69
69
|
modelValue.value = (event.target as HTMLInputElement).value;
|
|
70
70
|
rootContext.onCompositionEnd();
|
|
71
71
|
rootContext.highlightFirstItem();
|
|
@@ -77,7 +77,7 @@ function onCompositionStart() {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
function handleInput(event: InputEvent) {
|
|
80
|
-
if (
|
|
80
|
+
if (shouldDeferInput.value) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
modelValue.value = (event.target as HTMLInputElement).value;
|
|
@@ -117,6 +117,7 @@ function handleKeydownEnter(event: KeyboardEvent) {
|
|
|
117
117
|
@keydown.enter="handleKeydownEnter"
|
|
118
118
|
@input="handleInput"
|
|
119
119
|
@compositionstart="onCompositionStart"
|
|
120
|
+
@compositionupdate="handleCompositionUpdate"
|
|
120
121
|
@compositionend="handleCompositionEnd"
|
|
121
122
|
>
|
|
122
123
|
<slot :model-value="modelValue" />
|
|
@@ -188,6 +188,12 @@ function highlightItem(value: T) {
|
|
|
188
188
|
|
|
189
189
|
function onKeydownEnter(event: KeyboardEvent) {
|
|
190
190
|
if (highlightedElement.value && highlightedElement.value.isConnected) {
|
|
191
|
+
// Modifier combos (e.g. Ctrl+Enter) are not handled here —
|
|
192
|
+
// let them bubble so parent listeners can react (e.g. submit a form).
|
|
193
|
+
if (event.ctrlKey || event.metaKey || event.altKey) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
191
197
|
event.preventDefault();
|
|
192
198
|
event.stopPropagation();
|
|
193
199
|
|
|
@@ -170,6 +170,13 @@ const activeSubmenuContext = ref<{ onOpenChange: (open: boolean) => void; trigge
|
|
|
170
170
|
|
|
171
171
|
watch(highlightedElement, (el) => {
|
|
172
172
|
if (activeSubmenuContext.value && (el === undefined || el !== activeSubmenuContext.value.trigger.value)) {
|
|
173
|
+
// Don't close the submenu when the highlight disappears (pointer left
|
|
174
|
+
// all parent items, likely because the submenu opened on top of the
|
|
175
|
+
// trigger in a constrained viewport). Only close when highlight moves
|
|
176
|
+
// to a different parent item.
|
|
177
|
+
if (el === undefined) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
173
180
|
activeSubmenuContext.value.onOpenChange(false);
|
|
174
181
|
activeSubmenuContext.value = undefined;
|
|
175
182
|
}
|
|
@@ -243,7 +250,7 @@ function handleKeyDown(event: KeyboardEvent) {
|
|
|
243
250
|
|
|
244
251
|
if (isKeyDownInside) {
|
|
245
252
|
// menus should not be navigated using tab key so we prevent it
|
|
246
|
-
if (event.key === 'Tab') {
|
|
253
|
+
if (event.key === 'Tab' && rootContext.modal.value) {
|
|
247
254
|
event.preventDefault();
|
|
248
255
|
}
|
|
249
256
|
if (!isModifierKey && isCharacterKey && !isKeyDownInTextField) {
|
|
@@ -89,6 +89,11 @@ function handleArrowKey(e: KeyboardEvent) {
|
|
|
89
89
|
if (isDisabled.value) {
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
+
// Modifier combos on Enter/Space (e.g. Ctrl+Enter) are not handled by the cell —
|
|
93
|
+
// let them bubble so parent listeners can react (e.g. submit a form).
|
|
94
|
+
if ((e.code === KEY_CODES.ENTER || e.code === KEY_CODES.SPACE) && (e.ctrlKey || e.metaKey || e.altKey)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
92
97
|
e.preventDefault();
|
|
93
98
|
e.stopPropagation();
|
|
94
99
|
const parentElement = rootContext.parentElement.value!;
|
|
@@ -206,7 +211,6 @@ function handleArrowKey(e: KeyboardEvent) {
|
|
|
206
211
|
:tabindex="isFocusedMonth ? 0 : isDisabled ? undefined : -1"
|
|
207
212
|
@click="handleClick"
|
|
208
213
|
@keydown.up.down.left.right.space.enter.page-up.page-down="handleArrowKey"
|
|
209
|
-
@keydown.enter.prevent
|
|
210
214
|
>
|
|
211
215
|
<slot
|
|
212
216
|
:month-value="shortMonthValue"
|
|
@@ -163,6 +163,12 @@ function handleArrowKey(e: KeyboardEvent) {
|
|
|
163
163
|
if (isDisabled.value) {
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
|
+
// Modifier combos on Enter/Space (e.g. Ctrl+Enter) are not handled by the cell —
|
|
167
|
+
// let them bubble so parent listeners can react (e.g. submit a form).
|
|
168
|
+
if ((e.code === KEY_CODES.ENTER || e.code === KEY_CODES.SPACE) && (e.ctrlKey || e.metaKey || e.altKey)) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
166
172
|
e.preventDefault();
|
|
167
173
|
e.stopPropagation();
|
|
168
174
|
const parentElement = rootContext.parentElement.value!;
|
|
@@ -291,7 +297,6 @@ function handleArrowKey(e: KeyboardEvent) {
|
|
|
291
297
|
@focusin="handleFocus"
|
|
292
298
|
@mouseenter="handleFocus"
|
|
293
299
|
@keydown.up.down.left.right.space.enter.page-up.page-down="handleArrowKey"
|
|
294
|
-
@keydown.enter.prevent
|
|
295
300
|
>
|
|
296
301
|
<slot
|
|
297
302
|
:month-value="shortMonthValue"
|
|
@@ -126,6 +126,9 @@ function handleChange() {
|
|
|
126
126
|
@wheel="handleWheelEvent"
|
|
127
127
|
@beforeinput="(event: InputEvent) => {
|
|
128
128
|
if (event.isComposing) return
|
|
129
|
+
// A collapsed deletion carries no data, so nextValue would repeat the current value; undo and redo read the same
|
|
130
|
+
// Every deletion is skipped so they stay consistent, and applyInputValue reformats on blur
|
|
131
|
+
if (event.inputType.startsWith('delete') || event.inputType.startsWith('history')) return
|
|
129
132
|
const target = event.target as HTMLInputElement
|
|
130
133
|
let nextValue
|
|
131
134
|
= target.value.slice(0, target.selectionStart ?? undefined)
|