akar 2.0.7 → 2.0.9
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/Autocomplete/AutocompleteInput.cjs +12 -16
- package/dist/Autocomplete/AutocompleteInput.cjs.map +1 -1
- package/dist/Autocomplete/AutocompleteInput.js +13 -17
- package/dist/Autocomplete/AutocompleteInput.js.map +1 -1
- package/dist/ColorField/ColorFieldInput.cjs +10 -2
- package/dist/ColorField/ColorFieldInput.cjs.map +1 -1
- package/dist/ColorField/ColorFieldInput.js +10 -2
- package/dist/ColorField/ColorFieldInput.js.map +1 -1
- package/dist/Combobox/ComboboxInput.cjs +27 -9
- package/dist/Combobox/ComboboxInput.cjs.map +1 -1
- package/dist/Combobox/ComboboxInput.js +28 -10
- package/dist/Combobox/ComboboxInput.js.map +1 -1
- package/dist/DateField/DateFieldInput.cjs +4 -1
- package/dist/DateField/DateFieldInput.cjs.map +1 -1
- package/dist/DateField/DateFieldInput.js +4 -1
- package/dist/DateField/DateFieldInput.js.map +1 -1
- package/dist/DateField/DateFieldRoot.cjs +1 -0
- package/dist/DateField/DateFieldRoot.cjs.map +1 -1
- package/dist/DateField/DateFieldRoot.js +1 -0
- package/dist/DateField/DateFieldRoot.js.map +1 -1
- package/dist/DatePicker/DatePickerRoot.cjs +15 -1
- package/dist/DatePicker/DatePickerRoot.cjs.map +1 -1
- package/dist/DatePicker/DatePickerRoot.js +15 -1
- package/dist/DatePicker/DatePickerRoot.js.map +1 -1
- package/dist/DateRangeField/DateRangeFieldInput.cjs +4 -1
- package/dist/DateRangeField/DateRangeFieldInput.cjs.map +1 -1
- package/dist/DateRangeField/DateRangeFieldInput.js +4 -1
- package/dist/DateRangeField/DateRangeFieldInput.js.map +1 -1
- package/dist/DateRangeField/DateRangeFieldRoot.cjs +1 -0
- package/dist/DateRangeField/DateRangeFieldRoot.cjs.map +1 -1
- package/dist/DateRangeField/DateRangeFieldRoot.js +1 -0
- package/dist/DateRangeField/DateRangeFieldRoot.js.map +1 -1
- package/dist/Dialog/DialogOverlayImpl.cjs +5 -1
- package/dist/Dialog/DialogOverlayImpl.cjs.map +1 -1
- package/dist/Dialog/DialogOverlayImpl.js +5 -1
- package/dist/Dialog/DialogOverlayImpl.js.map +1 -1
- package/dist/DropdownMenu/DropdownMenuFilter.cjs +22 -3
- package/dist/DropdownMenu/DropdownMenuFilter.cjs.map +1 -1
- package/dist/DropdownMenu/DropdownMenuFilter.js +22 -3
- package/dist/DropdownMenu/DropdownMenuFilter.js.map +1 -1
- package/dist/Listbox/ListboxFilter.cjs +32 -11
- package/dist/Listbox/ListboxFilter.cjs.map +1 -1
- package/dist/Listbox/ListboxFilter.js +33 -12
- package/dist/Listbox/ListboxFilter.js.map +1 -1
- package/dist/Listbox/ListboxRoot.cjs +12 -6
- package/dist/Listbox/ListboxRoot.cjs.map +1 -1
- package/dist/Listbox/ListboxRoot.js +12 -6
- package/dist/Listbox/ListboxRoot.js.map +1 -1
- package/dist/NavigationMenu/NavigationMenuRoot.cjs +16 -3
- package/dist/NavigationMenu/NavigationMenuRoot.cjs.map +1 -1
- package/dist/NavigationMenu/NavigationMenuRoot.js +16 -3
- package/dist/NavigationMenu/NavigationMenuRoot.js.map +1 -1
- package/dist/NumberField/NumberFieldInput.cjs +44 -13
- package/dist/NumberField/NumberFieldInput.cjs.map +1 -1
- package/dist/NumberField/NumberFieldInput.js +45 -14
- package/dist/NumberField/NumberFieldInput.js.map +1 -1
- package/dist/PinInput/PinInputInput.cjs +37 -2
- package/dist/PinInput/PinInputInput.cjs.map +1 -1
- package/dist/PinInput/PinInputInput.js +37 -2
- package/dist/PinInput/PinInputInput.js.map +1 -1
- package/dist/ScrollArea/ScrollAreaScrollbarX.cjs +3 -0
- package/dist/ScrollArea/ScrollAreaScrollbarX.cjs.map +1 -1
- package/dist/ScrollArea/ScrollAreaScrollbarX.js +4 -1
- package/dist/ScrollArea/ScrollAreaScrollbarX.js.map +1 -1
- package/dist/ScrollArea/ScrollAreaScrollbarY.cjs +3 -0
- package/dist/ScrollArea/ScrollAreaScrollbarY.cjs.map +1 -1
- package/dist/ScrollArea/ScrollAreaScrollbarY.js +4 -1
- package/dist/ScrollArea/ScrollAreaScrollbarY.js.map +1 -1
- package/dist/TagsInput/TagsInputInput.cjs +12 -13
- package/dist/TagsInput/TagsInputInput.cjs.map +1 -1
- package/dist/TagsInput/TagsInputInput.js +13 -14
- package/dist/TagsInput/TagsInputInput.js.map +1 -1
- package/dist/TagsInput/TagsInputRoot.cjs +1 -0
- package/dist/TagsInput/TagsInputRoot.cjs.map +1 -1
- package/dist/TagsInput/TagsInputRoot.js +1 -0
- package/dist/TagsInput/TagsInputRoot.js.map +1 -1
- package/dist/TimeField/TimeFieldInput.cjs +4 -1
- package/dist/TimeField/TimeFieldInput.cjs.map +1 -1
- package/dist/TimeField/TimeFieldInput.js +4 -1
- package/dist/TimeField/TimeFieldInput.js.map +1 -1
- package/dist/TimeField/TimeFieldRoot.cjs +1 -0
- package/dist/TimeField/TimeFieldRoot.cjs.map +1 -1
- package/dist/TimeField/TimeFieldRoot.js +1 -0
- package/dist/TimeField/TimeFieldRoot.js.map +1 -1
- package/dist/TimeRangeField/TimeRangeFieldInput.cjs +4 -1
- package/dist/TimeRangeField/TimeRangeFieldInput.cjs.map +1 -1
- package/dist/TimeRangeField/TimeRangeFieldInput.js +4 -1
- package/dist/TimeRangeField/TimeRangeFieldInput.js.map +1 -1
- package/dist/TimeRangeField/TimeRangeFieldRoot.cjs +1 -0
- package/dist/TimeRangeField/TimeRangeFieldRoot.cjs.map +1 -1
- package/dist/TimeRangeField/TimeRangeFieldRoot.js +1 -0
- package/dist/TimeRangeField/TimeRangeFieldRoot.js.map +1 -1
- package/dist/constant.d.cts.map +1 -1
- package/dist/date/useDateField.cjs +38 -0
- package/dist/date/useDateField.cjs.map +1 -1
- package/dist/date/useDateField.js +38 -0
- package/dist/date/useDateField.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.js +1 -0
- package/dist/index2.d.ts.map +1 -1
- package/dist/index3.d.cts +24 -16
- package/dist/index3.d.cts.map +1 -1
- package/dist/index3.d.ts +9 -1
- package/dist/index3.d.ts.map +1 -1
- package/dist/index4.d.cts +634 -634
- package/dist/index4.d.cts.map +1 -1
- package/dist/index4.d.ts +638 -638
- 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/useComposing.cjs +30 -0
- package/dist/shared/useComposing.cjs.map +1 -0
- package/dist/shared/useComposing.js +24 -0
- package/dist/shared/useComposing.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 +3 -3
- package/src/Autocomplete/AutocompleteInput.vue +14 -18
- package/src/ColorField/ColorFieldInput.vue +16 -1
- package/src/Combobox/ComboboxInput.vue +46 -10
- package/src/DateField/DateFieldInput.vue +6 -0
- package/src/DateField/DateFieldRoot.vue +5 -0
- package/src/DatePicker/DatePickerRoot.vue +18 -2
- package/src/DateRangeField/DateRangeFieldInput.vue +6 -0
- package/src/DateRangeField/DateRangeFieldRoot.vue +5 -0
- package/src/Dialog/DialogOverlayImpl.vue +1 -1
- package/src/DropdownMenu/DropdownMenuFilter.vue +37 -11
- package/src/Listbox/ListboxFilter.vue +51 -14
- package/src/Listbox/ListboxRoot.vue +20 -4
- package/src/NavigationMenu/NavigationMenuRoot.vue +21 -4
- package/src/NumberField/NumberFieldInput.vue +46 -8
- package/src/PinInput/PinInputInput.vue +50 -1
- package/src/ScrollArea/ScrollAreaScrollbarX.vue +8 -1
- package/src/ScrollArea/ScrollAreaScrollbarY.vue +7 -1
- package/src/TagsInput/TagsInputInput.vue +19 -14
- package/src/TagsInput/TagsInputRoot.vue +5 -0
- package/src/TimeField/TimeFieldInput.vue +6 -0
- package/src/TimeField/TimeFieldRoot.vue +5 -0
- package/src/TimeRangeField/TimeRangeFieldInput.vue +6 -0
- package/src/TimeRangeField/TimeRangeFieldRoot.vue +5 -0
- package/src/shared/date/useDateField.ts +81 -1
- package/src/shared/index.ts +1 -0
- package/src/shared/useComposing.ts +18 -0
- package/src/test/utils.ts +0 -2
package/dist/internal.cjs
CHANGED
|
@@ -11,6 +11,7 @@ require('./shared/trap-focus.cjs');
|
|
|
11
11
|
require('./shared/useArrowNavigation.cjs');
|
|
12
12
|
require('./ConfigProvider/ConfigProvider.cjs');
|
|
13
13
|
require('./shared/useBodyScrollLock.cjs');
|
|
14
|
+
require('./shared/useComposing.cjs');
|
|
14
15
|
require('./date/comparators.cjs');
|
|
15
16
|
require('./date/calendar.cjs');
|
|
16
17
|
require('./date/index.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$277 as _default$13, _default$278 as _default$8, _default$279 as _default, _default$280 as _default$6, _default$281 as _default$10, _default$282 as _default$3, _default$283 as _default$14, _default$284 as _default$12, _default$285 as _default$2, _default$286 as _default$1, _default$287 as _default$11, _default$288 as _default$7, _default$290 as _default$9, _default$291 as _default$4, _default$292 as _default$5, injectMenuContext, injectMenuRootContext } from "./index4.cjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as vue5 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: vue5.DefineComponent<MenuAnchorProps, {}, {}, {}, {}, vue5.ComponentOptionsMixin, vue5.ComponentOptionsMixin, {}, string, vue5.PublicProps, Readonly<MenuAnchorProps> & Readonly<{}>, {}, {}, {}, {}, string, vue5.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,IAAA,CAAA,eALM,CAKN,eALM,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAKN,IAAA,CAAA,qBAAA,EAAA,IAAA,CAAA,qBAAA,EALM,CAAA,CAAA,EAAA,MAAA,EAKN,IAAA,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,IAAA,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$277 as _default$13, _default$278 as _default$8, _default$279 as _default, _default$280 as _default$6, _default$281 as _default$10, _default$282 as _default$3, _default$283 as _default$14, _default$284 as _default$12, _default$285 as _default$2, _default$286 as _default$1, _default$287 as _default$11, _default$288 as _default$7, _default$290 as _default$9, _default$291 as _default$4, _default$292 as _default$5, injectMenuContext, injectMenuRootContext } from "./index4.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as vue24 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: vue24.DefineComponent<MenuAnchorProps, {}, {}, {}, {}, vue24.ComponentOptionsMixin, vue24.ComponentOptionsMixin, {}, string, vue24.PublicProps, Readonly<MenuAnchorProps> & Readonly<{}>, {}, {}, {}, {}, string, vue24.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
|
@@ -11,6 +11,7 @@ import "./shared/trap-focus.js";
|
|
|
11
11
|
import "./shared/useArrowNavigation.js";
|
|
12
12
|
import "./ConfigProvider/ConfigProvider.js";
|
|
13
13
|
import "./shared/useBodyScrollLock.js";
|
|
14
|
+
import "./shared/useComposing.js";
|
|
14
15
|
import "./date/comparators.js";
|
|
15
16
|
import "./date/calendar.js";
|
|
16
17
|
import "./date/index.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../rolldown-runtime.cjs');
|
|
2
|
+
const vue = require_rolldown_runtime.__toESM(require("vue"));
|
|
3
|
+
|
|
4
|
+
//#region src/shared/useComposing.ts
|
|
5
|
+
function useComposing(onEnd) {
|
|
6
|
+
const isComposing = (0, vue.ref)(false);
|
|
7
|
+
function handleCompositionStart() {
|
|
8
|
+
isComposing.value = true;
|
|
9
|
+
}
|
|
10
|
+
function handleCompositionEnd(event) {
|
|
11
|
+
(0, vue.nextTick)(() => {
|
|
12
|
+
isComposing.value = false;
|
|
13
|
+
onEnd?.(event);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
isComposing,
|
|
18
|
+
handleCompositionStart,
|
|
19
|
+
handleCompositionEnd
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
Object.defineProperty(exports, 'useComposing', {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return useComposing;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=useComposing.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useComposing.cjs","names":["onEnd?: (event: CompositionEvent) => void","event: CompositionEvent"],"sources":["../../src/shared/useComposing.ts"],"sourcesContent":[],"mappings":";;;;AAEA,SAAgB,aAAaA,OAA2C;CACtE,MAAM,cAAc,aAAI,MAAM;CAE9B,SAAS,yBAAyB;AAChC,cAAY,QAAQ;CACrB;CAED,SAAS,qBAAqBC,OAAyB;AACrD,oBAAS,MAAM;AACb,eAAY,QAAQ;AACpB,WAAQ,MAAM;EACf,EAAC;CACH;AAED,QAAO;EAAE;EAAa;EAAwB;CAAsB;AACrE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { nextTick, ref } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/shared/useComposing.ts
|
|
4
|
+
function useComposing(onEnd) {
|
|
5
|
+
const isComposing = ref(false);
|
|
6
|
+
function handleCompositionStart() {
|
|
7
|
+
isComposing.value = true;
|
|
8
|
+
}
|
|
9
|
+
function handleCompositionEnd(event) {
|
|
10
|
+
nextTick(() => {
|
|
11
|
+
isComposing.value = false;
|
|
12
|
+
onEnd?.(event);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
isComposing,
|
|
17
|
+
handleCompositionStart,
|
|
18
|
+
handleCompositionEnd
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { useComposing };
|
|
24
|
+
//# sourceMappingURL=useComposing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useComposing.js","names":["onEnd?: (event: CompositionEvent) => void","event: CompositionEvent"],"sources":["../../src/shared/useComposing.ts"],"sourcesContent":[],"mappings":";;;AAEA,SAAgB,aAAaA,OAA2C;CACtE,MAAM,cAAc,IAAI,MAAM;CAE9B,SAAS,yBAAyB;AAChC,cAAY,QAAQ;CACrB;CAED,SAAS,qBAAqBC,OAAyB;AACrD,WAAS,MAAM;AACb,eAAY,QAAQ;AACpB,WAAQ,MAAM;EACf,EAAC;CACH;AAED,QAAO;EAAE;EAAa;EAAwB;CAAsB;AACrE"}
|
package/dist/shared.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const require_shared_trap_focus = require('./shared/trap-focus.cjs');
|
|
|
11
11
|
const require_shared_useArrowNavigation = require('./shared/useArrowNavigation.cjs');
|
|
12
12
|
require('./ConfigProvider/ConfigProvider.cjs');
|
|
13
13
|
const require_shared_useBodyScrollLock = require('./shared/useBodyScrollLock.cjs');
|
|
14
|
+
const require_shared_useComposing = require('./shared/useComposing.cjs');
|
|
14
15
|
require('./date/comparators.cjs');
|
|
15
16
|
require('./date/calendar.cjs');
|
|
16
17
|
require('./date/index.cjs');
|
|
@@ -50,6 +51,7 @@ exports.snapValueToStep = require_shared_clamp.snapValueToStep;
|
|
|
50
51
|
exports.trapFocus = require_shared_trap_focus.trapFocus;
|
|
51
52
|
exports.useArrowNavigation = require_shared_useArrowNavigation.useArrowNavigation;
|
|
52
53
|
exports.useBodyScrollLock = require_shared_useBodyScrollLock.useBodyScrollLock;
|
|
54
|
+
exports.useComposing = require_shared_useComposing.useComposing;
|
|
53
55
|
exports.useDateFormatter = require_shared_useDateFormatter.useDateFormatter;
|
|
54
56
|
exports.useDirection = require_shared_useDirection.useDirection;
|
|
55
57
|
exports.useEmitAsProps = require_shared_useEmitAsProps.useEmitAsProps;
|
package/dist/shared.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DateRange, DateStep, DateValue, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, trapFocus, useArrowNavigation, useBodyScrollLock, 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, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, trapFocus, useArrowNavigation, useBodyScrollLock, 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, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, trapFocus, 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, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, trapFocus, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, 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, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, trapFocus, useArrowNavigation, useBodyScrollLock, 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, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, trapFocus, useArrowNavigation, useBodyScrollLock, 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, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, trapFocus, 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, Formatter, SegmentPart, TimeRange, TimeValue, areEqual, createContext, findValuesBetween, getActiveElement, handleAndDispatchCustomEvent, isValidVNodeElement, isValueEqualOrExist, onFocusOutside, renderSlotFragments, roundToStepPrecision, snapValueToStep, trapFocus, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault };
|
package/dist/shared.js
CHANGED
|
@@ -11,6 +11,7 @@ import { trapFocus } from "./shared/trap-focus.js";
|
|
|
11
11
|
import { useArrowNavigation } from "./shared/useArrowNavigation.js";
|
|
12
12
|
import "./ConfigProvider/ConfigProvider.js";
|
|
13
13
|
import { useBodyScrollLock } from "./shared/useBodyScrollLock.js";
|
|
14
|
+
import { useComposing } from "./shared/useComposing.js";
|
|
14
15
|
import "./date/comparators.js";
|
|
15
16
|
import "./date/calendar.js";
|
|
16
17
|
import "./date/index.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, trapFocus, useArrowNavigation, useBodyScrollLock, 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, trapFocus, useArrowNavigation, useBodyScrollLock, useComposing, useDateFormatter, useDirection, useEmitAsProps, useFilter, useFocusGuards, useFormControl, useForwardExpose, useForwardProps, useForwardPropsEmits, useForwardRef, useGraceArea, useHideOthers, useId, useLocale, useSelectionBehavior, useSize, useStateMachine, useTestKbd, useTypeahead, withDefault };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akar",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.9",
|
|
5
5
|
"description": "Vue UI primitives components",
|
|
6
6
|
"author": "Vinicunca Contributors (https://github.com/vinicunca)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -111,14 +111,14 @@
|
|
|
111
111
|
"@tsconfig/node24": "^24.0.0",
|
|
112
112
|
"@types/jsdom": "^28.0.0",
|
|
113
113
|
"@types/node": "^24.0.13",
|
|
114
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
114
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
115
115
|
"@vitest/coverage-istanbul": "^3.2.4",
|
|
116
116
|
"@vue/test-utils": "^2.4.10",
|
|
117
117
|
"@vue/tsconfig": "^0.7.0",
|
|
118
118
|
"jsdom": "^26.1.0",
|
|
119
119
|
"size-limit": "^12.0.1",
|
|
120
120
|
"tsdown": "^0.12.9",
|
|
121
|
-
"vite": "^8.0.
|
|
121
|
+
"vite": "^8.0.14",
|
|
122
122
|
"vitest": "^3.2.4",
|
|
123
123
|
"vitest-axe": "0.1.0",
|
|
124
124
|
"vitest-canvas-mock": "^0.3.3",
|
|
@@ -7,11 +7,12 @@ export interface AutocompleteInputProps extends ListboxFilterProps {}
|
|
|
7
7
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
9
|
import { useVModel } from '@vueuse/core';
|
|
10
|
-
import { nextTick, onMounted,
|
|
10
|
+
import { nextTick, onMounted, watch } from 'vue';
|
|
11
11
|
import { injectComboboxRootContext } from '@/Combobox/ComboboxRoot.vue';
|
|
12
12
|
import { ListboxFilter } from '@/Listbox';
|
|
13
13
|
import { injectListboxRootContext } from '@/Listbox/ListboxRoot.vue';
|
|
14
14
|
import { usePrimitiveElement } from '@/Primitive';
|
|
15
|
+
import { useComposing } from '@/shared';
|
|
15
16
|
import { injectAutocompleteRootContext } from './AutocompleteRoot.vue';
|
|
16
17
|
|
|
17
18
|
const props = withDefaults(defineProps<AutocompleteInputProps>(), {
|
|
@@ -38,24 +39,19 @@ onMounted(() => {
|
|
|
38
39
|
}
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
const isComposing =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
isComposing.value = false;
|
|
48
|
-
const el = currentElement.value as HTMLInputElement;
|
|
49
|
-
if (el) {
|
|
50
|
-
processInputValue(el.value);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
42
|
+
const { isComposing, handleCompositionStart, handleCompositionEnd } = useComposing((event) => {
|
|
43
|
+
const el = event.target as HTMLInputElement;
|
|
44
|
+
if (el) {
|
|
45
|
+
processInputValue(el.value);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
54
48
|
|
|
55
|
-
function handleKeyDown(
|
|
49
|
+
function handleKeyDown(ev: KeyboardEvent) {
|
|
56
50
|
if (isComposing.value) {
|
|
57
51
|
return;
|
|
58
52
|
}
|
|
53
|
+
|
|
54
|
+
ev.preventDefault();
|
|
59
55
|
if (!rootContext.open.value) {
|
|
60
56
|
rootContext.onOpenChange(true);
|
|
61
57
|
}
|
|
@@ -131,10 +127,10 @@ watch(rootContext.filterState, (_newValue, oldValue) => {
|
|
|
131
127
|
autocomplete="off"
|
|
132
128
|
@click="handleClick"
|
|
133
129
|
@input="handleInput"
|
|
134
|
-
@keydown.down.up
|
|
130
|
+
@keydown.down.up="handleKeyDown"
|
|
135
131
|
@focus="handleFocus"
|
|
136
|
-
@compositionstart="
|
|
137
|
-
@compositionend="
|
|
132
|
+
@compositionstart="handleCompositionStart"
|
|
133
|
+
@compositionend="handleCompositionEnd"
|
|
138
134
|
>
|
|
139
135
|
<slot />
|
|
140
136
|
</ListboxFilter>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { PrimitiveProps } from '@/Primitive';
|
|
3
|
-
import { KEY_CODES } from '@vinicunca/perkakas';
|
|
4
3
|
|
|
5
4
|
const ALLOWED_INPUT_RE = /[\d.-]/;
|
|
6
5
|
|
|
@@ -8,8 +7,10 @@ export interface ColorFieldInputProps extends PrimitiveProps {}
|
|
|
8
7
|
</script>
|
|
9
8
|
|
|
10
9
|
<script setup lang="ts">
|
|
10
|
+
import { KEY_CODES } from '@vinicunca/perkakas';
|
|
11
11
|
import { computed, ref } from 'vue';
|
|
12
12
|
import { Primitive } from '@/Primitive';
|
|
13
|
+
import { useComposing } from '@/shared';
|
|
13
14
|
import { injectColorFieldRootContext } from './ColorFieldRoot.vue';
|
|
14
15
|
|
|
15
16
|
const props = withDefaults(defineProps<ColorFieldInputProps>(), {
|
|
@@ -19,6 +20,7 @@ const props = withDefaults(defineProps<ColorFieldInputProps>(), {
|
|
|
19
20
|
const rootContext = injectColorFieldRootContext();
|
|
20
21
|
|
|
21
22
|
const isFocused = ref(false);
|
|
23
|
+
const { isComposing, handleCompositionStart, handleCompositionEnd } = useComposing();
|
|
22
24
|
|
|
23
25
|
const inputType = computed(() => {
|
|
24
26
|
return rootContext.channel.value ? 'text' : 'text';
|
|
@@ -50,6 +52,13 @@ function handleWheel(event: WheelEvent) {
|
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
function handleKeydown(event: KeyboardEvent) {
|
|
55
|
+
// Don't step/commit mid-composition, keys are used for IME candidate navigation and commit.
|
|
56
|
+
// `isComposing` stays true until the tick after `compositionend`, so the commit keydown
|
|
57
|
+
// (which can report `event.isComposing === false`) is still skipped.
|
|
58
|
+
if (isComposing.value || event.isComposing) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
53
62
|
switch (event.key) {
|
|
54
63
|
case KEY_CODES.ARROW_UP:
|
|
55
64
|
event.preventDefault();
|
|
@@ -84,6 +93,10 @@ function handleKeydown(event: KeyboardEvent) {
|
|
|
84
93
|
|
|
85
94
|
// Handle numeric key validation for channel mode
|
|
86
95
|
function handleBeforeInput(event: InputEvent) {
|
|
96
|
+
if (event.isComposing) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
87
100
|
if (!rootContext.channel.value) {
|
|
88
101
|
return;
|
|
89
102
|
} // No validation for hex mode
|
|
@@ -133,6 +146,8 @@ function handleBeforeInput(event: InputEvent) {
|
|
|
133
146
|
@keydown="handleKeydown"
|
|
134
147
|
@wheel="handleWheel"
|
|
135
148
|
@beforeinput="handleBeforeInput"
|
|
149
|
+
@compositionstart="handleCompositionStart"
|
|
150
|
+
@compositionend="handleCompositionEnd"
|
|
136
151
|
>
|
|
137
152
|
<slot />
|
|
138
153
|
</Primitive>
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ListboxFilterEmits, ListboxFilterProps } from '@/Listbox';
|
|
3
|
-
import { useVModel } from '@vueuse/core';
|
|
4
|
-
import { nextTick, onMounted, watch } from 'vue';
|
|
5
|
-
import { usePrimitiveElement } from '@/Primitive';
|
|
6
3
|
|
|
7
4
|
export type ComboboxInputEmits = ListboxFilterEmits;
|
|
8
5
|
export interface ComboboxInputProps extends ListboxFilterProps {
|
|
@@ -12,8 +9,12 @@ export interface ComboboxInputProps extends ListboxFilterProps {
|
|
|
12
9
|
</script>
|
|
13
10
|
|
|
14
11
|
<script setup lang="ts">
|
|
12
|
+
import { useVModel } from '@vueuse/core';
|
|
13
|
+
import { nextTick, onMounted, watch } from 'vue';
|
|
15
14
|
import { ListboxFilter } from '@/Listbox';
|
|
16
15
|
import { injectListboxRootContext } from '@/Listbox/ListboxRoot.vue';
|
|
16
|
+
import { usePrimitiveElement } from '@/Primitive';
|
|
17
|
+
import { useComposing } from '@/shared';
|
|
17
18
|
import { injectComboboxRootContext } from './ComboboxRoot.vue';
|
|
18
19
|
|
|
19
20
|
const props = withDefaults(defineProps<ComboboxInputProps>(), {
|
|
@@ -35,27 +36,47 @@ onMounted(() => {
|
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
|
|
39
|
+
const { isComposing, handleCompositionStart, handleCompositionEnd } = useComposing((event) => {
|
|
40
|
+
const el = event.target as HTMLInputElement;
|
|
41
|
+
if (el) {
|
|
42
|
+
processInputValue(el.value);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
38
46
|
function handleKeyDown(ev: KeyboardEvent) {
|
|
47
|
+
// Don't swallow arrow keys mid-composition, they're used for IME candidate navigation
|
|
48
|
+
if (isComposing.value) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
ev.preventDefault();
|
|
52
|
+
|
|
39
53
|
if (!rootContext.open.value) {
|
|
40
54
|
rootContext.onOpenChange(true);
|
|
41
55
|
}
|
|
42
56
|
}
|
|
43
57
|
|
|
44
|
-
function
|
|
45
|
-
const target = event.target as HTMLInputElement;
|
|
58
|
+
function processInputValue(value: string) {
|
|
46
59
|
if (!rootContext.open.value) {
|
|
47
60
|
rootContext.onOpenChange(true);
|
|
48
61
|
nextTick(() => {
|
|
49
|
-
if (
|
|
50
|
-
rootContext.filterSearch.value =
|
|
62
|
+
if (value) {
|
|
63
|
+
rootContext.filterSearch.value = value;
|
|
51
64
|
listboxContext.highlightFirstItem();
|
|
52
65
|
}
|
|
53
66
|
});
|
|
54
67
|
} else {
|
|
55
|
-
rootContext.filterSearch.value =
|
|
68
|
+
rootContext.filterSearch.value = value;
|
|
56
69
|
}
|
|
57
70
|
}
|
|
58
71
|
|
|
72
|
+
function handleInput(event: InputEvent) {
|
|
73
|
+
if (isComposing.value) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
processInputValue((event.target as HTMLInputElement).value);
|
|
78
|
+
}
|
|
79
|
+
|
|
59
80
|
function handleFocus() {
|
|
60
81
|
if (rootContext.openOnFocus.value && !rootContext.open.value) {
|
|
61
82
|
rootContext.onOpenChange(true);
|
|
@@ -78,7 +99,20 @@ function handleBlur(ev: FocusEvent) {
|
|
|
78
99
|
const isInsideContent = document.getElementById(rootContext.contentId)?.contains(nextFocus);
|
|
79
100
|
|
|
80
101
|
if (!isInsideRoot && !isInsideContent) {
|
|
81
|
-
|
|
102
|
+
// Delay to let FocusScope's focus-restoration (handleFocusOut) run first.
|
|
103
|
+
// Without this, closing fires before FocusScope can pull focus back inside,
|
|
104
|
+
// causing a second combobox to immediately close when switching between two.
|
|
105
|
+
requestAnimationFrame(() => {
|
|
106
|
+
if (!rootContext.open.value) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const active = document.activeElement;
|
|
110
|
+
const isStillOutside = !rootContext.parentElement.value?.contains(active)
|
|
111
|
+
&& !document.getElementById(rootContext.contentId)?.contains(active);
|
|
112
|
+
if (isStillOutside) {
|
|
113
|
+
rootContext.onOpenChange(false);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
82
116
|
}
|
|
83
117
|
}
|
|
84
118
|
|
|
@@ -144,9 +178,11 @@ watch(rootContext.filterState, (_newValue, oldValue) => {
|
|
|
144
178
|
autocomplete="off"
|
|
145
179
|
@click="handleClick"
|
|
146
180
|
@input="handleInput"
|
|
147
|
-
@keydown.down.up
|
|
181
|
+
@keydown.down.up="handleKeyDown"
|
|
148
182
|
@focus="handleFocus"
|
|
149
183
|
@blur="handleBlur"
|
|
184
|
+
@compositionstart="handleCompositionStart"
|
|
185
|
+
@compositionend="handleCompositionEnd"
|
|
150
186
|
>
|
|
151
187
|
<slot />
|
|
152
188
|
</ListboxFilter>
|
|
@@ -24,6 +24,9 @@ const {
|
|
|
24
24
|
handleSegmentClick,
|
|
25
25
|
handleSegmentKeydown,
|
|
26
26
|
attributes,
|
|
27
|
+
handleSegmentBeforeInput,
|
|
28
|
+
handleSegmentCompositionStart,
|
|
29
|
+
handleSegmentCompositionEnd,
|
|
27
30
|
} = useDateField({
|
|
28
31
|
hasLeftFocus,
|
|
29
32
|
lastKeyZero,
|
|
@@ -59,6 +62,9 @@ const isInvalid = computed(() => rootContext.isInvalid.value);
|
|
|
59
62
|
v-on="part !== 'literal' ? {
|
|
60
63
|
mousedown: handleSegmentClick,
|
|
61
64
|
keydown: handleSegmentKeydown,
|
|
65
|
+
beforeinput: handleSegmentBeforeInput,
|
|
66
|
+
compositionstart: handleSegmentCompositionStart,
|
|
67
|
+
compositionend: handleSegmentCompositionEnd,
|
|
62
68
|
focusout: () => { hasLeftFocus = true },
|
|
63
69
|
focusin: (e: FocusEvent) => {
|
|
64
70
|
rootContext.setFocusedElement(e.target as HTMLElement)
|
|
@@ -260,6 +260,11 @@ const inputMaxValue = computed(() => props.maxValue ? normalizeInputValue(props.
|
|
|
260
260
|
const inputMinValue = computed(() => props.minValue ? normalizeInputValue(props.minValue, inferredGranularity.value) : undefined);
|
|
261
261
|
|
|
262
262
|
function handleKeydown(e: KeyboardEvent) {
|
|
263
|
+
// Don't navigate between segments mid-composition, arrow keys are used for IME candidate navigation
|
|
264
|
+
if (e.isComposing) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
|
|
263
268
|
if (!isSegmentNavigationKey(e.key)) {
|
|
264
269
|
return;
|
|
265
270
|
}
|
|
@@ -139,10 +139,24 @@ const open = useVModel(props, 'open', emits, {
|
|
|
139
139
|
|
|
140
140
|
const dateFieldRef = ref<InstanceType<typeof DateFieldRoot> | undefined>();
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Reset time fields on DateValue instances that support time granularity.
|
|
144
|
+
*/
|
|
145
|
+
function resetTime(date: DateValue) {
|
|
146
|
+
if (!('hour' in date)) {
|
|
147
|
+
return date;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return date.set({ hour: 0, minute: 0, second: 0, millisecond: 0 });
|
|
151
|
+
}
|
|
152
|
+
|
|
142
153
|
watch(modelValue, (value) => {
|
|
143
154
|
if (value && value.compare(placeholder.value) !== 0) {
|
|
144
155
|
placeholder.value = value.copy();
|
|
156
|
+
} else if (!value && 'hour' in placeholder.value) {
|
|
157
|
+
placeholder.value = resetTime(placeholder.value);
|
|
145
158
|
}
|
|
159
|
+
|
|
146
160
|
if (closeOnSelect.value) {
|
|
147
161
|
open.value = false;
|
|
148
162
|
}
|
|
@@ -177,8 +191,10 @@ provideDatePickerRootContext({
|
|
|
177
191
|
dir,
|
|
178
192
|
step,
|
|
179
193
|
onDateChange(date: DateValue | undefined) {
|
|
180
|
-
if (!date
|
|
181
|
-
modelValue.value =
|
|
194
|
+
if (!date) {
|
|
195
|
+
modelValue.value = undefined;
|
|
196
|
+
} else if (!modelValue.value) {
|
|
197
|
+
modelValue.value = date.copy();
|
|
182
198
|
} else if (!preventDeselect.value && date && modelValue.value.compare(date) === 0) {
|
|
183
199
|
modelValue.value = undefined;
|
|
184
200
|
} else {
|
|
@@ -27,6 +27,9 @@ const {
|
|
|
27
27
|
handleSegmentClick,
|
|
28
28
|
handleSegmentKeydown,
|
|
29
29
|
attributes,
|
|
30
|
+
handleSegmentBeforeInput,
|
|
31
|
+
handleSegmentCompositionStart,
|
|
32
|
+
handleSegmentCompositionEnd,
|
|
30
33
|
} = useDateField({
|
|
31
34
|
hasLeftFocus,
|
|
32
35
|
lastKeyZero,
|
|
@@ -63,6 +66,9 @@ const isInvalid = computed(() => rootContext.isInvalid.value);
|
|
|
63
66
|
v-on="part !== 'literal' ? {
|
|
64
67
|
mousedown: handleSegmentClick,
|
|
65
68
|
keydown: handleSegmentKeydown,
|
|
69
|
+
beforeinput: handleSegmentBeforeInput,
|
|
70
|
+
compositionstart: handleSegmentCompositionStart,
|
|
71
|
+
compositionend: handleSegmentCompositionEnd,
|
|
66
72
|
focusout: () => { hasLeftFocus = true },
|
|
67
73
|
focusin: (e: FocusEvent) => {
|
|
68
74
|
rootContext.setFocusedElement(e.target as HTMLElement)
|
|
@@ -352,6 +352,11 @@ const prevFocusableSegment = computed(() => {
|
|
|
352
352
|
});
|
|
353
353
|
|
|
354
354
|
function handleKeydown(e: KeyboardEvent) {
|
|
355
|
+
// Don't navigate between segments mid-composition, arrow keys are used for IME candidate navigation
|
|
356
|
+
if (e.isComposing) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
|
|
355
360
|
if (!isSegmentNavigationKey(e.key)) {
|
|
356
361
|
return;
|
|
357
362
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { PrimitiveProps } from '@/Primitive';
|
|
3
|
-
import { useVModel } from '@vueuse/core';
|
|
4
|
-
import { computed, onMounted, onUnmounted, ref, watch, watchSyncEffect } from 'vue';
|
|
5
|
-
import { injectMenuContentContext } from '@/Menu/MenuContentImpl.vue';
|
|
6
|
-
import { injectMenuRootContext } from '@/Menu/MenuRoot.vue';
|
|
7
|
-
import { injectMenuSubContext } from '@/Menu/MenuSub.vue';
|
|
8
|
-
import { Primitive, usePrimitiveElement } from '@/Primitive';
|
|
9
3
|
|
|
10
4
|
export interface DropdownMenuFilterProps extends PrimitiveProps {
|
|
11
5
|
/** The controlled value of the filter. Can be binded with v-model. */
|
|
@@ -22,6 +16,14 @@ export type DropdownMenuFilterEmits = {
|
|
|
22
16
|
</script>
|
|
23
17
|
|
|
24
18
|
<script setup lang="ts">
|
|
19
|
+
import { useVModel } from '@vueuse/core';
|
|
20
|
+
import { computed, onMounted, onUnmounted, ref, watch, watchSyncEffect } from 'vue';
|
|
21
|
+
import { injectMenuContentContext } from '@/Menu/MenuContentImpl.vue';
|
|
22
|
+
import { injectMenuRootContext } from '@/Menu/MenuRoot.vue';
|
|
23
|
+
import { injectMenuSubContext } from '@/Menu/MenuSub.vue';
|
|
24
|
+
import { Primitive, usePrimitiveElement } from '@/Primitive';
|
|
25
|
+
import { useComposing } from '@/shared';
|
|
26
|
+
|
|
25
27
|
const props = withDefaults(defineProps<DropdownMenuFilterProps>(), {
|
|
26
28
|
as: 'input',
|
|
27
29
|
});
|
|
@@ -52,7 +54,9 @@ const { primitiveElement, currentElement } = usePrimitiveElement();
|
|
|
52
54
|
const disabled = computed(() => props.disabled || false);
|
|
53
55
|
|
|
54
56
|
const activedescendant = ref<string | undefined>();
|
|
55
|
-
watchSyncEffect(() =>
|
|
57
|
+
watchSyncEffect(() => {
|
|
58
|
+
activedescendant.value = contentContext.highlightedElement.value?.id;
|
|
59
|
+
});
|
|
56
60
|
|
|
57
61
|
onMounted(() => {
|
|
58
62
|
contentContext.onFilterElementChange(currentElement.value);
|
|
@@ -73,13 +77,25 @@ onUnmounted(() => {
|
|
|
73
77
|
contentContext.searchRef.value = '';
|
|
74
78
|
});
|
|
75
79
|
|
|
80
|
+
const { isComposing, handleCompositionStart, handleCompositionEnd } = useComposing((event) => {
|
|
81
|
+
const el = event.target as HTMLInputElement;
|
|
82
|
+
if (el) {
|
|
83
|
+
modelValue.value = el.value;
|
|
84
|
+
contentContext.searchRef.value = el.value;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
76
88
|
function handleInput(event: InputEvent) {
|
|
77
89
|
if (disabled.value) {
|
|
78
90
|
return;
|
|
79
91
|
}
|
|
92
|
+
|
|
93
|
+
if (isComposing.value) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
80
97
|
const target = event.target as HTMLInputElement;
|
|
81
98
|
modelValue.value = target.value;
|
|
82
|
-
// Update the menu's search ref to help with filtering
|
|
83
99
|
contentContext.searchRef.value = target.value;
|
|
84
100
|
}
|
|
85
101
|
|
|
@@ -87,15 +103,23 @@ function handleKeyDown(event: KeyboardEvent) {
|
|
|
87
103
|
if (disabled.value) {
|
|
88
104
|
return;
|
|
89
105
|
}
|
|
106
|
+
|
|
107
|
+
// During composition the keys belong to the IME (candidate navigation/commit).
|
|
108
|
+
// Stop them from bubbling to the menu content's keydown handler (which would
|
|
109
|
+
// navigate/typeahead) without calling preventDefault, so the IME still works.
|
|
110
|
+
if (isComposing.value) {
|
|
111
|
+
event.stopPropagation();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
90
115
|
if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) {
|
|
91
116
|
event.preventDefault();
|
|
92
117
|
contentContext.onKeydownNavigation(event);
|
|
93
118
|
} else if (event.key === 'Enter') {
|
|
94
119
|
event.preventDefault();
|
|
95
120
|
contentContext.onKeydownEnter(event);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
else if (event.key === 'Escape' && modelValue.value) {
|
|
121
|
+
} else if (event.key === 'Escape' && modelValue.value) {
|
|
122
|
+
// Prevent Escape from bubbling to avoid closing the menu when clearing the filter
|
|
99
123
|
event.stopPropagation();
|
|
100
124
|
modelValue.value = '';
|
|
101
125
|
contentContext.searchRef.value = '';
|
|
@@ -117,6 +141,8 @@ function handleKeyDown(event: KeyboardEvent) {
|
|
|
117
141
|
role="searchbox"
|
|
118
142
|
@input="handleInput"
|
|
119
143
|
@keydown="handleKeyDown"
|
|
144
|
+
@compositionstart="handleCompositionStart"
|
|
145
|
+
@compositionend="handleCompositionEnd"
|
|
120
146
|
>
|
|
121
147
|
<slot :model-value="modelValue" />
|
|
122
148
|
</Primitive>
|