akar 2.0.12 → 2.0.14
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/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/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/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/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/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 +6 -0
- package/dist/Presence/usePresence.cjs.map +1 -1
- package/dist/Presence/usePresence.js +6 -0
- 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/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/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/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/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/constant.d.cts.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.js +1 -0
- package/dist/index3.d.cts +38 -16
- package/dist/index3.d.cts.map +1 -1
- package/dist/index3.d.ts +34 -12
- package/dist/index3.d.ts.map +1 -1
- package/dist/index4.d.cts +689 -681
- package/dist/index4.d.cts.map +1 -1
- package/dist/index4.d.ts +675 -667
- package/dist/index4.d.ts.map +1 -1
- package/dist/internal.cjs +1 -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 +1 -0
- 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 +2 -0
- package/dist/shared.d.cts +2 -2
- package/dist/shared.d.ts +2 -2
- package/dist/shared.js +2 -1
- package/package.json +1 -1
- package/src/AlertDialog/AlertDialogContent.vue +9 -1
- package/src/Calendar/CalendarCellTrigger.vue +5 -1
- package/src/Checkbox/CheckboxRoot.vue +30 -16
- package/src/ConfigProvider/ConfigProvider.vue +10 -1
- package/src/FocusScope/FocusScope.vue +16 -5
- 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/NumberFieldRoot.vue +51 -23
- package/src/Presence/usePresence.ts +8 -0
- package/src/RadioGroup/Radio.vue +29 -18
- package/src/RadioGroup/RadioGroupItem.vue +15 -6
- package/src/RangeCalendar/RangeCalendarCellTrigger.vue +6 -0
- package/src/RovingFocus/RovingFocusItem.vue +16 -1
- package/src/ScrollArea/ScrollAreaThumb.vue +2 -2
- package/src/Splitter/SplitterGroup.vue +4 -2
- package/src/Switch/SwitchRoot.vue +29 -18
- package/src/Teleport/Teleport.vue +8 -4
- 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/useForwardScopeId.ts +26 -0
package/dist/internal.cjs
CHANGED
|
@@ -24,6 +24,7 @@ require('./shared/useForwardExpose.cjs');
|
|
|
24
24
|
require('./shared/useForwardProps.cjs');
|
|
25
25
|
require('./shared/useForwardPropsEmits.cjs');
|
|
26
26
|
require('./shared/useForwardRef.cjs');
|
|
27
|
+
require('./shared/useForwardScopeId.cjs');
|
|
27
28
|
require('./shared/useGraceArea.cjs');
|
|
28
29
|
require('./shared/useHideOthers.cjs');
|
|
29
30
|
require('./shared/useId.cjs');
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./index2.cjs";
|
|
2
2
|
import "./index3.cjs";
|
|
3
3
|
import { MenuArrowProps, MenuCheckboxItemEmits, MenuCheckboxItemProps, MenuContentEmits, MenuContentProps, MenuEmits, MenuGroupProps, MenuItemEmits, MenuItemIndicatorProps, MenuItemProps, MenuLabelProps, MenuPortalProps, MenuProps, MenuRadioGroupEmits, MenuRadioGroupProps, MenuRadioItemEmits, MenuRadioItemProps, MenuSeparatorProps, MenuSubContentEmits, MenuSubContentProps, MenuSubEmits, MenuSubProps, MenuSubTriggerProps, PopperAnchorProps, _default$294 as _default$13, _default$295 as _default$8, _default$296 as _default, _default$297 as _default$6, _default$298 as _default$10, _default$299 as _default$3, _default$300 as _default$14, _default$301 as _default$12, _default$302 as _default$2, _default$303 as _default$1, _default$304 as _default$11, _default$305 as _default$7, _default$307 as _default$9, _default$308 as _default$4, _default$309 as _default$5, injectMenuContext, injectMenuRootContext } from "./index4.cjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as vue18 from "vue";
|
|
5
5
|
|
|
6
6
|
//#region src/Menu/MenuAnchor.vue.d.ts
|
|
7
7
|
interface MenuAnchorProps extends PopperAnchorProps {}
|
|
@@ -9,7 +9,7 @@ declare var __VLS_8: {};
|
|
|
9
9
|
type __VLS_Slots = {} & {
|
|
10
10
|
default?: (props: typeof __VLS_8) => any;
|
|
11
11
|
};
|
|
12
|
-
declare const __VLS_base:
|
|
12
|
+
declare const __VLS_base: vue18.DefineComponent<MenuAnchorProps, {}, {}, {}, {}, vue18.ComponentOptionsMixin, vue18.ComponentOptionsMixin, {}, string, vue18.PublicProps, Readonly<MenuAnchorProps> & Readonly<{}>, {}, {}, {}, {}, string, vue18.ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
14
14
|
declare const _default$15: typeof __VLS_export;
|
|
15
15
|
type __VLS_WithSlots<T, S> = T & {
|
package/dist/internal.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.cts","names":[],"sources":["../src/Menu/MenuAnchor.vue"],"sourcesContent":[],"mappings":";;;;;;UAoBU,eAAA,SAAwB;YAsC9B;KACC,WAAA;2BACwB;AA3CqB,CAAA;AAGC,cA2C7C,UALgB,EAKN,
|
|
1
|
+
{"version":3,"file":"internal.d.cts","names":[],"sources":["../src/Menu/MenuAnchor.vue"],"sourcesContent":[],"mappings":";;;;;;UAoBU,eAAA,SAAwB;YAsC9B;KACC,WAAA;2BACwB;AA3CqB,CAAA;AAGC,cA2C7C,UALgB,EAKN,KAAA,CAAA,eALM,CAKN,eALM,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAKN,KAAA,CAAA,qBAAA,EAAA,KAAA,CAAA,qBAAA,EALM,CAAA,CAAA,EAAA,MAAA,EAKN,KAAA,CAAA,WAAA,EAAA,QALM,CAKN,eALM,CAAA,GAKN,QALM,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,MAAA,EAKN,KAAA,CAAA,uBAAA,EALM,KAAA,EAAA,CAAA,CAAA,EAAA,GAAA,CAAA;AAAA,cAQhB,YAPU,EAOW,eANS,CAAA,OAMc,UANd,EAM0B,WAN1B,CAAA;AAAA,cAMM,WADxC,EAAA,OAE0B,YAF1B;KAGG,eALW,CAAA,CAAA,EAAA,CAAA,CAAA,GAKa,CALb,GAAA;EAAA,MAAA,EAAA;IAAA,MAAA,EAON,CAPM;EAAA,CAAA;CAAA"}
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./index2.js";
|
|
2
2
|
import "./index3.js";
|
|
3
3
|
import { MenuArrowProps, MenuCheckboxItemEmits, MenuCheckboxItemProps, MenuContentEmits, MenuContentProps, MenuEmits, MenuGroupProps, MenuItemEmits, MenuItemIndicatorProps, MenuItemProps, MenuLabelProps, MenuPortalProps, MenuProps, MenuRadioGroupEmits, MenuRadioGroupProps, MenuRadioItemEmits, MenuRadioItemProps, MenuSeparatorProps, MenuSubContentEmits, MenuSubContentProps, MenuSubEmits, MenuSubProps, MenuSubTriggerProps, PopperAnchorProps, _default$294 as _default$13, _default$295 as _default$8, _default$296 as _default, _default$297 as _default$6, _default$298 as _default$10, _default$299 as _default$3, _default$300 as _default$14, _default$301 as _default$12, _default$302 as _default$2, _default$303 as _default$1, _default$304 as _default$11, _default$305 as _default$7, _default$307 as _default$9, _default$308 as _default$4, _default$309 as _default$5, injectMenuContext, injectMenuRootContext } from "./index4.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as vue41 from "vue";
|
|
5
5
|
|
|
6
6
|
//#region src/Menu/MenuAnchor.vue.d.ts
|
|
7
7
|
interface MenuAnchorProps extends PopperAnchorProps {}
|
|
@@ -9,7 +9,7 @@ declare var __VLS_8: {};
|
|
|
9
9
|
type __VLS_Slots = {} & {
|
|
10
10
|
default?: (props: typeof __VLS_8) => any;
|
|
11
11
|
};
|
|
12
|
-
declare const __VLS_base:
|
|
12
|
+
declare const __VLS_base: vue41.DefineComponent<MenuAnchorProps, {}, {}, {}, {}, vue41.ComponentOptionsMixin, vue41.ComponentOptionsMixin, {}, string, vue41.PublicProps, Readonly<MenuAnchorProps> & Readonly<{}>, {}, {}, {}, {}, string, vue41.ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
14
14
|
declare const _default$15: typeof __VLS_export;
|
|
15
15
|
type __VLS_WithSlots<T, S> = T & {
|
package/dist/internal.js
CHANGED
|
@@ -24,6 +24,7 @@ import "./shared/useForwardExpose.js";
|
|
|
24
24
|
import "./shared/useForwardProps.js";
|
|
25
25
|
import "./shared/useForwardPropsEmits.js";
|
|
26
26
|
import "./shared/useForwardRef.js";
|
|
27
|
+
import "./shared/useForwardScopeId.js";
|
|
27
28
|
import "./shared/useGraceArea.js";
|
|
28
29
|
import "./shared/useHideOthers.js";
|
|
29
30
|
import "./shared/useId.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../rolldown-runtime.cjs');
|
|
2
|
+
const vue = require_rolldown_runtime.__toESM(require("vue"));
|
|
3
|
+
|
|
4
|
+
//#region src/shared/useForwardScopeId.ts
|
|
5
|
+
/**
|
|
6
|
+
* Returns the parent component's `<style scoped>` id (e.g. `data-v-xxxxxxx`) as a
|
|
7
|
+
* bindable attribute object, so it can be manually forwarded onto the chosen root
|
|
8
|
+
* element of a multi-root component.
|
|
9
|
+
*
|
|
10
|
+
* Vue only auto-applies the parent's scope id to a **single-root** component's root.
|
|
11
|
+
* When a component renders multiple root nodes (e.g. an interactive control plus a
|
|
12
|
+
* sibling hidden form input), that fallthrough is dropped and the parent's scoped
|
|
13
|
+
* styles can no longer reach the component. Spread the returned object onto the
|
|
14
|
+
* element that should stay styleable by the parent.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const scopeIdAttrs = useForwardScopeId()
|
|
19
|
+
* // <Primitive v-bind="{ ...$attrs, ...scopeIdAttrs }" />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function useForwardScopeId() {
|
|
23
|
+
const scopeId = ((0, vue.getCurrentInstance)()?.vnode)?.scopeId;
|
|
24
|
+
return scopeId ? { [scopeId]: "" } : {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
Object.defineProperty(exports, 'useForwardScopeId', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return useForwardScopeId;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=useForwardScopeId.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForwardScopeId.cjs","names":[],"sources":["../../src/shared/useForwardScopeId.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,oBAA4C;CAI1D,MAAM,WAAW,6BAAoB,EAAE,QAA4C;AACnF,QAAO,UAAU,GAAG,UAAU,GAAI,IAAG,CAAE;AACxC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getCurrentInstance } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/shared/useForwardScopeId.ts
|
|
4
|
+
/**
|
|
5
|
+
* Returns the parent component's `<style scoped>` id (e.g. `data-v-xxxxxxx`) as a
|
|
6
|
+
* bindable attribute object, so it can be manually forwarded onto the chosen root
|
|
7
|
+
* element of a multi-root component.
|
|
8
|
+
*
|
|
9
|
+
* Vue only auto-applies the parent's scope id to a **single-root** component's root.
|
|
10
|
+
* When a component renders multiple root nodes (e.g. an interactive control plus a
|
|
11
|
+
* sibling hidden form input), that fallthrough is dropped and the parent's scoped
|
|
12
|
+
* styles can no longer reach the component. Spread the returned object onto the
|
|
13
|
+
* element that should stay styleable by the parent.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const scopeIdAttrs = useForwardScopeId()
|
|
18
|
+
* // <Primitive v-bind="{ ...$attrs, ...scopeIdAttrs }" />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
function useForwardScopeId() {
|
|
22
|
+
const scopeId = (getCurrentInstance()?.vnode)?.scopeId;
|
|
23
|
+
return scopeId ? { [scopeId]: "" } : {};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useForwardScopeId };
|
|
28
|
+
//# sourceMappingURL=useForwardScopeId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForwardScopeId.js","names":[],"sources":["../../src/shared/useForwardScopeId.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,oBAA4C;CAI1D,MAAM,WAAW,oBAAoB,EAAE,QAA4C;AACnF,QAAO,UAAU,GAAG,UAAU,GAAI,IAAG,CAAE;AACxC"}
|
package/dist/shared.cjs
CHANGED
|
@@ -24,6 +24,7 @@ const require_shared_useForwardExpose = require('./shared/useForwardExpose.cjs')
|
|
|
24
24
|
const require_shared_useForwardProps = require('./shared/useForwardProps.cjs');
|
|
25
25
|
const require_shared_useForwardPropsEmits = require('./shared/useForwardPropsEmits.cjs');
|
|
26
26
|
const require_shared_useForwardRef = require('./shared/useForwardRef.cjs');
|
|
27
|
+
const require_shared_useForwardScopeId = require('./shared/useForwardScopeId.cjs');
|
|
27
28
|
const require_shared_useGraceArea = require('./shared/useGraceArea.cjs');
|
|
28
29
|
const require_shared_useHideOthers = require('./shared/useHideOthers.cjs');
|
|
29
30
|
const require_shared_useId = require('./shared/useId.cjs');
|
|
@@ -60,6 +61,7 @@ exports.useForwardExpose = require_shared_useForwardExpose.useForwardExpose;
|
|
|
60
61
|
exports.useForwardProps = require_shared_useForwardProps.useForwardProps;
|
|
61
62
|
exports.useForwardPropsEmits = require_shared_useForwardPropsEmits.useForwardPropsEmits;
|
|
62
63
|
exports.useForwardRef = require_shared_useForwardRef.useForwardRef;
|
|
64
|
+
exports.useForwardScopeId = require_shared_useForwardScopeId.useForwardScopeId;
|
|
63
65
|
exports.useGraceArea = require_shared_useGraceArea.useGraceArea;
|
|
64
66
|
exports.useHideOthers = require_shared_useHideOthers.useHideOthers;
|
|
65
67
|
exports.useId = require_shared_useId.useId;
|
package/dist/shared.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DateRange, DateStep, DateValue, EmitAsProps, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault } from "./index3.cjs";
|
|
2
|
-
export { DateRange, DateStep, DateValue, EmitAsProps, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault };
|
|
1
|
+
import { DateRange, DateStep, DateValue, EmitAsProps, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useForwardScopeId, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault } from "./index3.cjs";
|
|
2
|
+
export { DateRange, DateStep, DateValue, EmitAsProps, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useForwardScopeId, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault };
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DateRange, DateStep, DateValue, EmitAsProps, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault } from "./index3.js";
|
|
2
|
-
export { DateRange, DateStep, DateValue, EmitAsProps, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault };
|
|
1
|
+
import { DateRange, DateStep, DateValue, EmitAsProps, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useForwardScopeId, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault } from "./index3.js";
|
|
2
|
+
export { DateRange, DateStep, DateValue, EmitAsProps, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useForwardScopeId, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault };
|
package/dist/shared.js
CHANGED
|
@@ -24,6 +24,7 @@ import { useForwardExpose } from "./shared/useForwardExpose.js";
|
|
|
24
24
|
import { useForwardProps } from "./shared/useForwardProps.js";
|
|
25
25
|
import { useForwardPropsEmits } from "./shared/useForwardPropsEmits.js";
|
|
26
26
|
import { useForwardRef } from "./shared/useForwardRef.js";
|
|
27
|
+
import { useForwardScopeId } from "./shared/useForwardScopeId.js";
|
|
27
28
|
import { useGraceArea } from "./shared/useGraceArea.js";
|
|
28
29
|
import { useHideOthers } from "./shared/useHideOthers.js";
|
|
29
30
|
import { useId } from "./shared/useId.js";
|
|
@@ -36,4 +37,4 @@ import { useTypeahead } from "./shared/useTypeahead.js";
|
|
|
36
37
|
import { withDefault } from "./shared/withDefault.js";
|
|
37
38
|
import "./shared/index.js";
|
|
38
39
|
|
|
39
|
-
export { areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault };
|
|
40
|
+
export { areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useForwardScopeId, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault };
|
package/package.json
CHANGED
|
@@ -20,7 +20,15 @@ export interface AlertDialogContentProps extends DialogContentProps {}
|
|
|
20
20
|
import { nextTick, ref } from 'vue';
|
|
21
21
|
import { DialogContent } from '@/Dialog';
|
|
22
22
|
|
|
23
|
-
const props =
|
|
23
|
+
const props = withDefaults(
|
|
24
|
+
defineProps<AlertDialogContentProps>(),
|
|
25
|
+
{
|
|
26
|
+
// Keep `undefined` (instead of Vue's boolean coercion to `false`) so
|
|
27
|
+
// DialogContent can preserve the modal default while still honoring an
|
|
28
|
+
// explicit `:disable-outside-pointer-events="false"`.
|
|
29
|
+
disableOutsidePointerEvents: undefined,
|
|
30
|
+
},
|
|
31
|
+
);
|
|
24
32
|
const emits = defineEmits<AlertDialogContentEmits>();
|
|
25
33
|
|
|
26
34
|
const emitsAsProps = useEmitAsProps(emits);
|
|
@@ -116,6 +116,11 @@ function handleArrowKey(e: KeyboardEvent) {
|
|
|
116
116
|
if (isDisabled.value) {
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
|
+
// Modifier combos on Enter/Space (e.g. Ctrl+Enter) are not handled by the cell —
|
|
120
|
+
// let them bubble so parent listeners can react (e.g. submit a form).
|
|
121
|
+
if ((e.code === KEY_CODES.ENTER || e.code === KEY_CODES.SPACE) && (e.ctrlKey || e.metaKey || e.altKey)) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
119
124
|
e.preventDefault();
|
|
120
125
|
e.stopPropagation();
|
|
121
126
|
const parentElement = rootContext.parentElement.value!;
|
|
@@ -195,7 +200,6 @@ function handleArrowKey(e: KeyboardEvent) {
|
|
|
195
200
|
:tabindex="isFocusedDate ? 0 : isOutsideView || isDisabled ? undefined : -1"
|
|
196
201
|
@click="handleClick"
|
|
197
202
|
@keydown.up.down.left.right.space.enter="handleArrowKey"
|
|
198
|
-
@keydown.enter.prevent
|
|
199
203
|
>
|
|
200
204
|
<slot
|
|
201
205
|
:day-value="dayValue"
|
|
@@ -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>
|
|
@@ -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>
|
|
@@ -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;
|
|
@@ -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"
|
|
@@ -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) {
|
|
@@ -156,6 +156,14 @@ export function usePresence(
|
|
|
156
156
|
onUnmounted(() => {
|
|
157
157
|
watcher();
|
|
158
158
|
stateWatcher();
|
|
159
|
+
if (node.value) {
|
|
160
|
+
node.value.removeEventListener('animationstart', handleAnimationStart);
|
|
161
|
+
node.value.removeEventListener('animationcancel', handleAnimationEnd);
|
|
162
|
+
node.value.removeEventListener('animationend', handleAnimationEnd);
|
|
163
|
+
}
|
|
164
|
+
if (timeoutId !== undefined) {
|
|
165
|
+
ownerWindow?.clearTimeout(timeoutId);
|
|
166
|
+
}
|
|
159
167
|
});
|
|
160
168
|
|
|
161
169
|
const isPresent = computed(() =>
|