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
package/src/Toggle/Toggle.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { PrimitiveProps } from '@/Primitive';
|
|
3
3
|
import type { FormFieldProps } from '@/shared/types';
|
|
4
|
-
import { useFormControl, useForwardExpose } from '@/shared';
|
|
4
|
+
import { useFormControl, useForwardExpose, useForwardScopeId } from '@/shared';
|
|
5
5
|
import { injectToggleGroupRootContext } from '@/ToggleGroup/ToggleGroupRoot.vue';
|
|
6
6
|
import VisuallyHiddenInput from '@/VisuallyHidden/VisuallyHiddenInput.vue';
|
|
7
7
|
|
|
@@ -34,12 +34,19 @@ import { useVModel } from '@vueuse/core';
|
|
|
34
34
|
import { computed } from 'vue';
|
|
35
35
|
import { Primitive } from '@/Primitive';
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
disabled: false,
|
|
40
|
-
as: 'button',
|
|
37
|
+
defineOptions({
|
|
38
|
+
inheritAttrs: false,
|
|
41
39
|
});
|
|
42
40
|
|
|
41
|
+
const props = withDefaults(
|
|
42
|
+
defineProps<ToggleProps>(),
|
|
43
|
+
{
|
|
44
|
+
modelValue: undefined,
|
|
45
|
+
disabled: false,
|
|
46
|
+
as: 'button',
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
43
50
|
const emits = defineEmits<ToggleEmits>();
|
|
44
51
|
|
|
45
52
|
defineSlots<{
|
|
@@ -56,6 +63,9 @@ defineSlots<{
|
|
|
56
63
|
}>();
|
|
57
64
|
|
|
58
65
|
const { forwardRef, currentElement } = useForwardExpose();
|
|
66
|
+
// Hidden form input is a sibling (not nested) of the control to avoid the
|
|
67
|
+
// `nested-interactive` a11y violation; forward the parent scope id for scoped styles.
|
|
68
|
+
const scopeIdAttrs = useForwardScopeId();
|
|
59
69
|
const toggleGroupContext = injectToggleGroupRootContext(null);
|
|
60
70
|
|
|
61
71
|
const modelValue = useVModel(props, 'modelValue', emits, {
|
|
@@ -84,6 +94,7 @@ const isFormControl = useFormControl(currentElement);
|
|
|
84
94
|
:data-state="dataState"
|
|
85
95
|
:data-disabled="disabled ? '' : undefined"
|
|
86
96
|
:disabled="disabled"
|
|
97
|
+
v-bind="{ ...scopeIdAttrs, ...$attrs }"
|
|
87
98
|
@click="togglePressed"
|
|
88
99
|
>
|
|
89
100
|
<slot
|
|
@@ -92,13 +103,14 @@ const isFormControl = useFormControl(currentElement);
|
|
|
92
103
|
:pressed="modelValue"
|
|
93
104
|
:state="dataState"
|
|
94
105
|
/>
|
|
95
|
-
|
|
96
|
-
<VisuallyHiddenInput
|
|
97
|
-
v-if="isFormControl && name && !toggleGroupContext"
|
|
98
|
-
type="checkbox"
|
|
99
|
-
:name="name"
|
|
100
|
-
:value="modelValue"
|
|
101
|
-
:required="required"
|
|
102
|
-
/>
|
|
103
106
|
</Primitive>
|
|
107
|
+
|
|
108
|
+
<VisuallyHiddenInput
|
|
109
|
+
v-if="isFormControl && name && !toggleGroupContext"
|
|
110
|
+
type="checkbox"
|
|
111
|
+
:name="name"
|
|
112
|
+
:value="modelValue"
|
|
113
|
+
:required="required"
|
|
114
|
+
v-bind="scopeIdAttrs"
|
|
115
|
+
/>
|
|
104
116
|
</template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { AcceptableValue } from '@/shared/types';
|
|
3
3
|
import type { ToggleProps } from '@/Toggle';
|
|
4
|
-
import { isValueEqualOrExist, useForwardExpose } from '@/shared';
|
|
4
|
+
import { isValueEqualOrExist, useForwardExpose, useForwardScopeId } from '@/shared';
|
|
5
5
|
|
|
6
6
|
export interface ToggleGroupItemProps extends Omit<ToggleProps, 'name' | 'required' | 'modelValue' | 'defaultValue'> {
|
|
7
7
|
/**
|
|
@@ -27,6 +27,9 @@ const disabled = computed(() => rootContext.disabled?.value || props.disabled);
|
|
|
27
27
|
const pressed = computed(() => isValueEqualOrExist(rootContext.modelValue.value, props.value));
|
|
28
28
|
|
|
29
29
|
const { forwardRef } = useForwardExpose();
|
|
30
|
+
// `ToggleGroupItem` wraps the multi-root `Toggle`, so the parent's scoped-style id
|
|
31
|
+
// is not auto-forwarded; pass it through manually so consumer `<style scoped>` works.
|
|
32
|
+
const scopeIdAttrs = useForwardScopeId();
|
|
30
33
|
</script>
|
|
31
34
|
|
|
32
35
|
<template>
|
|
@@ -36,7 +39,7 @@ const { forwardRef } = useForwardExpose();
|
|
|
36
39
|
v-bind="rootContext.rovingFocus.value ? { focusable: !disabled, active: pressed } : {}"
|
|
37
40
|
>
|
|
38
41
|
<Toggle
|
|
39
|
-
v-bind="props"
|
|
42
|
+
v-bind="{ ...scopeIdAttrs, ...props }"
|
|
40
43
|
:ref="forwardRef"
|
|
41
44
|
v-slot="slotProps"
|
|
42
45
|
:disabled="disabled"
|
|
@@ -16,7 +16,7 @@ withDefaults(defineProps<VisuallyHiddenProps>(), { as: 'span', feature: 'focusab
|
|
|
16
16
|
<Primitive
|
|
17
17
|
:as="as"
|
|
18
18
|
:as-child="asChild"
|
|
19
|
-
:aria-hidden="feature === 'focusable' ? 'true' : undefined"
|
|
19
|
+
:aria-hidden="feature === 'focusable' || feature === 'fully-hidden' ? 'true' : undefined"
|
|
20
20
|
:data-hidden="feature === 'fully-hidden' ? '' : undefined"
|
|
21
21
|
:tabindex="feature === 'fully-hidden' ? '-1' : undefined"
|
|
22
22
|
:style="{
|
|
@@ -88,6 +88,13 @@ function handleArrowKey(e: KeyboardEvent) {
|
|
|
88
88
|
if (isDisabled.value) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
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
|
+
}
|
|
97
|
+
|
|
91
98
|
e.preventDefault();
|
|
92
99
|
e.stopPropagation();
|
|
93
100
|
const parentElement = rootContext.parentElement.value!;
|
|
@@ -211,7 +218,6 @@ function handleArrowKey(e: KeyboardEvent) {
|
|
|
211
218
|
:tabindex="isFocusedYear ? 0 : isDisabled ? undefined : -1"
|
|
212
219
|
@click="handleClick"
|
|
213
220
|
@keydown.up.down.left.right.space.enter.page-up.page-down="handleArrowKey"
|
|
214
|
-
@keydown.enter.prevent
|
|
215
221
|
>
|
|
216
222
|
<slot
|
|
217
223
|
:year-value="yearValue"
|
|
@@ -163,6 +163,11 @@ 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
|
+
}
|
|
166
171
|
e.preventDefault();
|
|
167
172
|
e.stopPropagation();
|
|
168
173
|
const parentElement = rootContext.parentElement.value!;
|
|
@@ -294,7 +299,6 @@ function handleArrowKey(e: KeyboardEvent) {
|
|
|
294
299
|
@focusin="handleFocus"
|
|
295
300
|
@mouseenter="handleFocus"
|
|
296
301
|
@keydown.up.down.left.right.space.enter.page-up.page-down="handleArrowKey"
|
|
297
|
-
@keydown.enter.prevent
|
|
298
302
|
>
|
|
299
303
|
<slot
|
|
300
304
|
:year-value="yearValue"
|
package/src/shared/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { useForwardExpose } from './useForwardExpose';
|
|
|
21
21
|
export { useForwardProps } from './useForwardProps';
|
|
22
22
|
export { useForwardPropsEmits } from './useForwardPropsEmits';
|
|
23
23
|
export { useForwardRef } from './useForwardRef';
|
|
24
|
+
export { useForwardScopeId } from './useForwardScopeId';
|
|
24
25
|
export { useGraceArea } from './useGraceArea';
|
|
25
26
|
export { useHideOthers } from './useHideOthers';
|
|
26
27
|
export { useId } from './useId';
|
|
@@ -8,6 +8,7 @@ import { isClient, isIOS, tryOnBeforeUnmount } from '@vueuse/shared';
|
|
|
8
8
|
import { defu } from 'defu';
|
|
9
9
|
import { computed, nextTick, ref, watch } from 'vue';
|
|
10
10
|
import { injectConfigProviderContext } from '@/ConfigProvider/ConfigProvider.vue';
|
|
11
|
+
import { context as dismissableLayerContext } from '@/DismissableLayer/context';
|
|
11
12
|
|
|
12
13
|
const useBodyLockStackCount = createSharedComposable(() => {
|
|
13
14
|
const map = ref<Map<string, boolean>>(new Map());
|
|
@@ -31,7 +32,14 @@ const useBodyLockStackCount = createSharedComposable(() => {
|
|
|
31
32
|
const resetBodyStyle = () => {
|
|
32
33
|
document.body.style.paddingRight = '';
|
|
33
34
|
document.body.style.marginRight = '';
|
|
34
|
-
|
|
35
|
+
// A mounted `DismissableLayer` with `disableOutsidePointerEvents` may
|
|
36
|
+
// still own the body pointer-events lock (e.g. a modal Dialog rendered
|
|
37
|
+
// without the Overlay that would hold a scroll lock). Clearing it here
|
|
38
|
+
// would make everything behind that layer clickable again; the
|
|
39
|
+
// layer restores it once its last disabling layer is gone.
|
|
40
|
+
if (dismissableLayerContext.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
41
|
+
document.body.style.pointerEvents = '';
|
|
42
|
+
}
|
|
35
43
|
document.documentElement.style.removeProperty('--scrollbar-width');
|
|
36
44
|
document.body.style.overflow = initialOverflow.value ?? '';
|
|
37
45
|
isIOS && stopTouchMoveListener?.();
|
|
@@ -1,10 +1,61 @@
|
|
|
1
|
-
import { nextTick, ref } from 'vue';
|
|
1
|
+
import { computed, nextTick, ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
// Scripts typed through an IME with a candidate/conversion step (Chinese,
|
|
4
|
+
// Japanese, Korean, Bopomofo). When the composing text contains any of these,
|
|
5
|
+
// the value is incomplete until `compositionend` and must not be processed early.
|
|
6
|
+
const imeScriptRE = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u;
|
|
7
|
+
const androidRE = /android/i;
|
|
8
|
+
|
|
9
|
+
function isAndroid() {
|
|
10
|
+
return typeof navigator !== 'undefined' && androidRE.test(navigator.userAgent);
|
|
11
|
+
}
|
|
2
12
|
|
|
3
13
|
export function useComposing(onEnd?: (event: CompositionEvent) => void) {
|
|
4
14
|
const isComposing = ref(false);
|
|
15
|
+
const isImeComposition = ref(true);
|
|
16
|
+
// Sticky for the whole composition session: once IME script has been seen, a
|
|
17
|
+
// later plain-text update cannot downgrade the session back to live.
|
|
18
|
+
const sawImeScript = ref(false);
|
|
19
|
+
|
|
20
|
+
// Whether `input` events should wait for `compositionend` before being
|
|
21
|
+
// processed. Android soft keyboards (Gboard, Samsung Keyboard, …) keep the
|
|
22
|
+
// current Latin word in composition for autocorrect and only commit it on
|
|
23
|
+
// space/Enter/suggestion tap, so deferring there would freeze live filtering
|
|
24
|
+
// until the word is committed. IME composition still defers so
|
|
25
|
+
// incomplete values never leak.
|
|
26
|
+
//
|
|
27
|
+
// Known limitation: on Android, the *leading* plain-text updates of a
|
|
28
|
+
// transliterating IME are indistinguishable from soft-keyboard autocorrect —
|
|
29
|
+
// romaji-mode Japanese ("ka" → "か"), Vietnamese Telex, Thai and Indic
|
|
30
|
+
// transliteration all emit Latin before any IME script appears — so those
|
|
31
|
+
// first keystrokes do filter live. Once IME script shows up the session
|
|
32
|
+
// becomes deferred and stays deferred, and the committed value is always
|
|
33
|
+
// correct; only the transient popup state is wrong.
|
|
34
|
+
const shouldDeferInput = computed(() => isComposing.value && isImeComposition.value);
|
|
5
35
|
|
|
6
36
|
function handleCompositionStart() {
|
|
7
37
|
isComposing.value = true;
|
|
38
|
+
isImeComposition.value = true;
|
|
39
|
+
sawImeScript.value = false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function handleCompositionUpdate(event: CompositionEvent) {
|
|
43
|
+
// Empty data (e.g. backspacing the whole composed word) keeps the previous
|
|
44
|
+
// classification.
|
|
45
|
+
if (!event.data) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (imeScriptRE.test(event.data)) {
|
|
49
|
+
isImeComposition.value = true;
|
|
50
|
+
sawImeScript.value = true;
|
|
51
|
+
} else if (isAndroid() && !sawImeScript.value) {
|
|
52
|
+
// Plain-text composition on Android is the soft keyboard buffering a
|
|
53
|
+
// word for autocorrect — process input live. Desktop IMEs also compose
|
|
54
|
+
// plain Latin before conversion (e.g. Pinyin preedit "xiang" for 香)
|
|
55
|
+
// so everywhere else deferring stays the
|
|
56
|
+
// safe default.
|
|
57
|
+
isImeComposition.value = false;
|
|
58
|
+
}
|
|
8
59
|
}
|
|
9
60
|
|
|
10
61
|
function handleCompositionEnd(event: CompositionEvent) {
|
|
@@ -14,5 +65,5 @@ export function useComposing(onEnd?: (event: CompositionEvent) => void) {
|
|
|
14
65
|
});
|
|
15
66
|
}
|
|
16
67
|
|
|
17
|
-
return { isComposing, handleCompositionStart, handleCompositionEnd };
|
|
68
|
+
return { isComposing, shouldDeferInput, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd };
|
|
18
69
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getCurrentInstance } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns the parent component's `<style scoped>` id (e.g. `data-v-xxxxxxx`) as a
|
|
5
|
+
* bindable attribute object, so it can be manually forwarded onto the chosen root
|
|
6
|
+
* element of a multi-root component.
|
|
7
|
+
*
|
|
8
|
+
* Vue only auto-applies the parent's scope id to a **single-root** component's root.
|
|
9
|
+
* When a component renders multiple root nodes (e.g. an interactive control plus a
|
|
10
|
+
* sibling hidden form input), that fallthrough is dropped and the parent's scoped
|
|
11
|
+
* styles can no longer reach the component. Spread the returned object onto the
|
|
12
|
+
* element that should stay styleable by the parent.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const scopeIdAttrs = useForwardScopeId()
|
|
17
|
+
* // <Primitive v-bind="{ ...$attrs, ...scopeIdAttrs }" />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function useForwardScopeId(): Record<string, string> {
|
|
21
|
+
// `vnode.scopeId` is the scope id the parent set on this component's placeholder
|
|
22
|
+
// vnode for scoped-CSS fallthrough. It is populated during the parent's render,
|
|
23
|
+
// so it is already available by the time `setup()` runs.
|
|
24
|
+
const scopeId = (getCurrentInstance()?.vnode as { scopeId?: string } | undefined)?.scopeId;
|
|
25
|
+
return scopeId ? { [scopeId]: '' } : {};
|
|
26
|
+
}
|