akar 1.14.0 → 1.16.0
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/avatar/avatar-image.js +4 -2
- package/dist/avatar/avatar-image.js.map +1 -1
- package/dist/collection/collection.js +6 -2
- package/dist/collection/collection.js.map +1 -1
- package/dist/combobox/combobox-cancel.js +1 -1
- package/dist/combobox/combobox-cancel.js.map +1 -1
- package/dist/combobox/combobox-content-impl.js +50 -35
- package/dist/combobox/combobox-content-impl.js.map +1 -1
- package/dist/combobox/combobox-content.js +4 -0
- package/dist/combobox/combobox-content.js.map +1 -1
- package/dist/context-menu/context-menu-content.js +4 -0
- package/dist/context-menu/context-menu-content.js.map +1 -1
- package/dist/context-menu/context-menu-radio-group.js +1 -1
- package/dist/context-menu/context-menu-radio-item.js +1 -1
- package/dist/context-menu/context-menu-sub-content.js +4 -0
- package/dist/context-menu/context-menu-sub-content.js.map +1 -1
- package/dist/date/calendar.date.js.map +1 -1
- package/dist/date/parser.js +1 -0
- package/dist/date/parser.js.map +1 -1
- package/dist/date-picker/date-picker-content.js +4 -0
- package/dist/date-picker/date-picker-content.js.map +1 -1
- package/dist/date-picker/date-picker-root.js +0 -8
- package/dist/date-picker/date-picker-root.js.map +1 -1
- package/dist/date-range-picker/date-range-picker-content.js +4 -0
- package/dist/date-range-picker/date-range-picker-content.js.map +1 -1
- package/dist/date-range-picker/date-range-picker-root.js +0 -8
- package/dist/date-range-picker/date-range-picker-root.js.map +1 -1
- package/dist/dismissable-layer/dismissable-layer.js +4 -3
- package/dist/dismissable-layer/dismissable-layer.js.map +1 -1
- package/dist/dropdown-menu/dropdown-menu-content.js +4 -0
- package/dist/dropdown-menu/dropdown-menu-content.js.map +1 -1
- package/dist/dropdown-menu/dropdown-menu-radio-group.js +1 -1
- package/dist/dropdown-menu/dropdown-menu-radio-item.js +1 -1
- package/dist/dropdown-menu/dropdown-menu-sub-content.js +4 -0
- package/dist/dropdown-menu/dropdown-menu-sub-content.js.map +1 -1
- package/dist/editable/editable-input.js +1 -1
- package/dist/editable/editable-input.js.map +1 -1
- package/dist/hover-card/hover-card-content-impl.js +4 -0
- package/dist/hover-card/hover-card-content-impl.js.map +1 -1
- package/dist/hover-card/hover-card-content.js +4 -0
- package/dist/hover-card/hover-card-content.js.map +1 -1
- package/dist/index.d.ts +1173 -1361
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index2.d.ts.map +1 -1
- package/dist/menu/menu-content-impl.js +4 -0
- package/dist/menu/menu-content-impl.js.map +1 -1
- package/dist/menu/menu-content.js +4 -0
- package/dist/menu/menu-content.js.map +1 -1
- package/dist/menu/menu-radio-group.js +1 -1
- package/dist/menu/menu-radio-group.js.map +1 -1
- package/dist/menu/menu-radio-item.js +1 -1
- package/dist/menu/menu-radio-item.js.map +1 -1
- package/dist/menu/menu-root-content-modal.js +4 -0
- package/dist/menu/menu-root-content-modal.js.map +1 -1
- package/dist/menu/menu-root-content-non-modal.js +4 -0
- package/dist/menu/menu-root-content-non-modal.js.map +1 -1
- package/dist/menu/menu-sub-content.js +4 -0
- package/dist/menu/menu-sub-content.js.map +1 -1
- package/dist/navigation-menu/navigation-menu-content-impl.js +1 -1
- package/dist/navigation-menu/navigation-menu-content.js +1 -1
- package/dist/navigation-menu/navigation-menu-item.js +1 -1
- package/dist/navigation-menu/navigation-menu-root.js +8 -6
- package/dist/navigation-menu/navigation-menu-root.js.map +1 -1
- package/dist/navigation-menu/navigation-menu-trigger.js +1 -1
- package/dist/navigation-menu/navigation-menu-viewport.js +1 -1
- package/dist/number-field/number-field-root.js +6 -1
- package/dist/number-field/number-field-root.js.map +1 -1
- package/dist/pin-input/pin-input-input.js +17 -11
- package/dist/pin-input/pin-input-input.js.map +1 -1
- package/dist/popover/popover-content-impl.js +4 -0
- package/dist/popover/popover-content-impl.js.map +1 -1
- package/dist/popover/popover-content-modal.js +4 -0
- package/dist/popover/popover-content-modal.js.map +1 -1
- package/dist/popover/popover-content-non-modal.js +4 -0
- package/dist/popover/popover-content-non-modal.js.map +1 -1
- package/dist/popover/popover-content.js +4 -0
- package/dist/popover/popover-content.js.map +1 -1
- package/dist/popper/popper-content.js +10 -2
- package/dist/popper/popper-content.js.map +1 -1
- package/dist/range-calendar/range-calendar-root.js +10 -8
- package/dist/range-calendar/range-calendar-root.js.map +1 -1
- package/dist/scroll-area/scroll-area-root.js.map +1 -1
- package/dist/scroll-area/scroll-area-scrollbar-auto.js +1 -1
- package/dist/scroll-area/scroll-area-scrollbar-glimpse.js +126 -0
- package/dist/scroll-area/scroll-area-scrollbar-glimpse.js.map +1 -0
- package/dist/scroll-area/scroll-area-scrollbar-impl.js +1 -1
- package/dist/scroll-area/scroll-area-scrollbar-scroll.js +1 -1
- package/dist/scroll-area/scroll-area-scrollbar-visible.js +1 -1
- package/dist/scroll-area/scroll-area-scrollbar.js +11 -4
- package/dist/scroll-area/scroll-area-scrollbar.js.map +1 -1
- package/dist/select/select-arrow.js +1 -3
- package/dist/select/select-arrow.js.map +1 -1
- package/dist/select/select-content-impl.js +4 -0
- package/dist/select/select-content-impl.js.map +1 -1
- package/dist/select/select-content.js +4 -0
- package/dist/select/select-content.js.map +1 -1
- package/dist/select/select-popper-position.js +4 -0
- package/dist/select/select-popper-position.js.map +1 -1
- package/dist/shared/use-date-formatter.js +1 -1
- package/dist/shared/use-date-formatter.js.map +1 -1
- package/dist/shared/use-forward-expose.js +10 -1
- package/dist/shared/use-forward-expose.js.map +1 -1
- package/dist/shared/use-grace-area.js +4 -1
- package/dist/shared/use-grace-area.js.map +1 -1
- package/dist/tabs/tabs-content.js +5 -1
- package/dist/tabs/tabs-content.js.map +1 -1
- package/dist/tabs/tabs-indicator.js +18 -12
- package/dist/tabs/tabs-indicator.js.map +1 -1
- package/dist/tabs/tabs-root.js +12 -2
- package/dist/tabs/tabs-root.js.map +1 -1
- package/dist/tabs/tabs-trigger.js +1 -1
- package/dist/tabs/tabs-trigger.js.map +1 -1
- package/package.json +13 -13
- package/src/avatar/avatar-image.vue +1 -0
- package/src/collection/collection.ts +3 -2
- package/src/combobox/combobox-cancel.vue +3 -3
- package/src/combobox/combobox-content-impl.vue +48 -33
- package/src/date/calendar.date.ts +1 -0
- package/src/date-picker/date-picker-root.vue +1 -1
- package/src/date-range-picker/date-range-picker-anchor.vue +2 -2
- package/src/date-range-picker/date-range-picker-arrow.vue +2 -2
- package/src/date-range-picker/date-range-picker-close.vue +2 -2
- package/src/date-range-picker/date-range-picker-root.vue +4 -4
- package/src/date-range-picker/index.ts +4 -0
- package/src/dismissable-layer/dismissable-layer.vue +5 -3
- package/src/editable/editable-input.vue +7 -1
- package/src/index.ts +1 -0
- package/src/menu/menu-radio-group.vue +5 -4
- package/src/menu/menu-radio-item.vue +2 -1
- package/src/navigation-menu/navigation-menu-item.vue +1 -1
- package/src/navigation-menu/navigation-menu-root.vue +14 -6
- package/src/number-field/number-field-root.vue +15 -7
- package/src/pin-input/pin-input-input.vue +26 -19
- package/src/popper/popper-content.vue +15 -5
- package/src/range-calendar/range-calendar-root.vue +11 -25
- package/src/scroll-area/index.ts +4 -0
- package/src/scroll-area/scroll-area-root.vue +1 -0
- package/src/scroll-area/scroll-area-scrollbar-glimpse.vue +145 -0
- package/src/scroll-area/scroll-area-scrollbar.vue +9 -0
- package/src/scroll-area/types.ts +1 -1
- package/src/select/select-arrow.vue +1 -3
- package/src/shared/date/parser.ts +9 -0
- package/src/shared/index.ts +1 -1
- package/src/shared/use-date-formatter.ts +2 -1
- package/src/shared/use-forward-expose.ts +16 -1
- package/src/shared/use-grace-area.ts +8 -1
- package/src/tabs/tabs-content.vue +7 -1
- package/src/tabs/tabs-indicator.vue +29 -13
- package/src/tabs/tabs-root.vue +14 -1
- package/src/tabs/tabs-trigger.vue +5 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useForwardExpose } from "../shared/use-forward-expose.js";
|
|
2
2
|
import { APrimitive } from "../primitive/primitive.js";
|
|
3
3
|
import { injectATabsRootContext } from "./tabs-root.js";
|
|
4
|
-
import { createBlock, createCommentVNode, defineComponent, mergeProps,
|
|
4
|
+
import { computed, createBlock, createCommentVNode, defineComponent, mergeProps, openBlock, ref, renderSlot, unref, watch, watchPostEffect, withCtx } from "vue";
|
|
5
5
|
import { useResizeObserver } from "@vueuse/core";
|
|
6
6
|
|
|
7
7
|
//#region src/tabs/tabs-indicator.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -17,30 +17,36 @@ var tabs_indicator_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
17
17
|
required: false
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
setup(__props) {
|
|
20
|
+
setup(__props, { expose: __expose }) {
|
|
21
21
|
const props = __props;
|
|
22
22
|
const context = injectATabsRootContext();
|
|
23
|
+
__expose({ updateIndicatorStyle });
|
|
23
24
|
useForwardExpose();
|
|
24
|
-
const activeTab = ref();
|
|
25
25
|
const indicatorStyle = ref({
|
|
26
26
|
size: null,
|
|
27
27
|
position: null
|
|
28
28
|
});
|
|
29
|
+
const tabs = ref([]);
|
|
29
30
|
watch(() => [context.modelValue.value, context?.dir.value], async () => {
|
|
30
|
-
await nextTick();
|
|
31
31
|
updateIndicatorStyle();
|
|
32
|
-
}, {
|
|
33
|
-
|
|
32
|
+
}, {
|
|
33
|
+
immediate: true,
|
|
34
|
+
flush: "post"
|
|
35
|
+
});
|
|
36
|
+
watchPostEffect(() => {
|
|
37
|
+
tabs.value = Array.from(context.tabsList.value?.querySelectorAll("[role=\"tab\"]") || []);
|
|
38
|
+
});
|
|
39
|
+
useResizeObserver(computed(() => [context.tabsList.value, ...tabs.value]), updateIndicatorStyle);
|
|
34
40
|
function updateIndicatorStyle() {
|
|
35
|
-
activeTab
|
|
36
|
-
if (!activeTab
|
|
41
|
+
const activeTab = context.tabsList.value?.querySelector("[role=\"tab\"][data-state=\"active\"]");
|
|
42
|
+
if (!activeTab) return;
|
|
37
43
|
if (context.orientation.value === "horizontal") indicatorStyle.value = {
|
|
38
|
-
size: activeTab.
|
|
39
|
-
position: activeTab.
|
|
44
|
+
size: activeTab.offsetWidth,
|
|
45
|
+
position: activeTab.offsetLeft
|
|
40
46
|
};
|
|
41
47
|
else indicatorStyle.value = {
|
|
42
|
-
size: activeTab.
|
|
43
|
-
position: activeTab.
|
|
48
|
+
size: activeTab.offsetHeight,
|
|
49
|
+
position: activeTab.offsetTop
|
|
44
50
|
};
|
|
45
51
|
}
|
|
46
52
|
return (_ctx, _cache) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-indicator.js","names":[],"sources":["../../src/tabs/tabs-indicator.vue","../../src/tabs/tabs-indicator.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;EAaA,MAAM,QAAQ;EACd,MAAM,UAAU,wBAAwB;
|
|
1
|
+
{"version":3,"file":"tabs-indicator.js","names":[],"sources":["../../src/tabs/tabs-indicator.vue","../../src/tabs/tabs-indicator.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;EAaA,MAAM,QAAQ;EACd,MAAM,UAAU,wBAAwB;AAExC,WAAa,EACX,qBACD,EAAC;AAEF,oBAAkB;EAOlB,MAAM,iBAAiB,IAAoB;GACzC,MAAM;GACN,UAAU;EACX,EAAC;EACF,MAAM,OAAO,IAAwB,CAAE,EAAC;AAExC,QACE,MAAM,CAAC,QAAQ,WAAW,OAAO,SAAS,IAAI,KAAM,GACpD,YAAY;AACV,yBAAsB;EACvB,GACD;GAAE,WAAW;GAAM,OAAO;EAAQ,EACnC;AAED,kBAAgB,MAAM;AACpB,QAAK,QAAQ,MAAM,KAAK,QAAQ,SAAS,OAAO,iBAA8B,iBAAe,IAAI,CAAE,EAAC;EACrG,EAAC;AAEF,oBACE,SAAS,MAAM,CAAC,QAAQ,SAAS,OAAO,GAAG,KAAK,KAAM,EAAC,EACvD,qBACD;EAED,SAAS,uBAAuB;GAC9B,MAAM,YAAY,QAAQ,SAAS,OAAO,cAAiC,wCAAoC;AAE/G,QAAK,UACH;AAGF,OAAI,QAAQ,YAAY,UAAU,aAChC,gBAAe,QAAQ;IACrB,MAAM,UAAU;IAChB,UAAU,UAAU;GACrB;OAED,gBAAe,QAAQ;IACrB,MAAM,UAAU;IAChB,UAAU,UAAU;GACrB;EAEL;;iBAKiB,eAAA,MAAe,SAAI,yBADlC,YASa,MAAA,WAAA,EATb,WASa,EAAA,KAAA,EAAA,GAPH,OAAK,EACZ,OAAK;qCAA2C,eAAA,MAAe,KAAI,EAAA,CAAA;yCAAiD,eAAA,MAAe,SAAQ,EAAA,CAAA;;qBAK5I,MAAQ,CAAR,WAAQ,KAAA,QAAA,UAAA"}
|
package/dist/tabs/tabs-root.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useDirection } from "../shared/use-direction.js";
|
|
|
3
3
|
import { useForwardExpose } from "../shared/use-forward-expose.js";
|
|
4
4
|
import { useId } from "../shared/use-id.js";
|
|
5
5
|
import { APrimitive } from "../primitive/primitive.js";
|
|
6
|
-
import { createBlock, defineComponent, openBlock, ref, renderSlot, toRefs, unref, withCtx } from "vue";
|
|
6
|
+
import { createBlock, defineComponent, openBlock, ref, renderSlot, shallowRef, toRefs, unref, withCtx } from "vue";
|
|
7
7
|
import { useVModel } from "@vueuse/core";
|
|
8
8
|
|
|
9
9
|
//#region src/tabs/tabs-root.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -59,6 +59,7 @@ var tabs_root_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
59
59
|
passive: props.modelValue === void 0
|
|
60
60
|
});
|
|
61
61
|
const tabsList = ref();
|
|
62
|
+
const contentIds = shallowRef(/* @__PURE__ */ new Set());
|
|
62
63
|
provideTabsRootContext({
|
|
63
64
|
modelValue,
|
|
64
65
|
changeModelValue: (value) => {
|
|
@@ -69,7 +70,16 @@ var tabs_root_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
69
70
|
unmountOnHide,
|
|
70
71
|
activationMode: props.activationMode,
|
|
71
72
|
baseId: useId(void 0, "akar-tabs"),
|
|
72
|
-
tabsList
|
|
73
|
+
tabsList,
|
|
74
|
+
contentIds,
|
|
75
|
+
registerContent: (value) => {
|
|
76
|
+
contentIds.value = new Set([...contentIds.value, value]);
|
|
77
|
+
},
|
|
78
|
+
unregisterContent: (value) => {
|
|
79
|
+
const newSet = new Set(contentIds.value);
|
|
80
|
+
newSet.delete(value);
|
|
81
|
+
contentIds.value = newSet;
|
|
82
|
+
}
|
|
73
83
|
});
|
|
74
84
|
return (_ctx, _cache) => {
|
|
75
85
|
return openBlock(), createBlock(unref(APrimitive), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-root.js","names":[],"sources":["../../src/tabs/tabs-root.vue","../../src/tabs/tabs-root.vue"],"sourcesContent":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"tabs-root.js","names":[],"sources":["../../src/tabs/tabs-root.vue","../../src/tabs/tabs-root.vue"],"sourcesContent":[],"mappings":";;;;;;;;;AAuDA,MAAa,CAAC,wBAAwB,uBAAsB,GACxD,cAA+B,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO/C,MAAM,QAAQ;EAKd,MAAM,QAAQ;EASd,MAAM,EAAE,aAAa,eAAe,KAAK,SAAS,GAAG,OAAO,MAAM;EAClE,MAAM,MAAM,aAAa,QAAQ;AACjC,oBAAkB;EAElB,MAAM,aAAa,UAAgE,OAAO,cAAc,OAAO;GAC7G,cAAc,MAAM;GACpB,SAAU,MAAM;EACjB,EAAC;EAEF,MAAM,WAAW,KAAkB;EACnC,MAAM,aAAa,2BAAgC,IAAI,MAAM;AAE7D,yBAAuB;GACrB;GACA,kBAAkB,CAAC,UAA0B;AAC3C,eAAW,QAAQ;GACpB;GACD;GACA;GACA;GACA,gBAAgB,MAAM;GACtB,QAAQ,cAAiB,YAAY;GACrC;GACA;GACA,iBAAiB,CAAC,UAA0B;AAC1C,eAAW,QAAQ,IAAI,IAAI,CAAC,GAAG,WAAW,OAAO,KAAM;GACxD;GACD,mBAAmB,CAAC,UAA0B;IAC5C,MAAM,SAAS,IAAI,IAAI,WAAW;AAClC,WAAO,OAAO,MAAM;AACpB,eAAW,QAAQ;GACpB;EACF,EAAC;;uBAIA,YAOa,MAAA,WAAA,EAAA;IANV,KAAK,MAAA,IAAG;IACR,oBAAkB,MAAA,YAAW;IAC7B,YAAU,QAAA;IACV,IAAI,QAAA;;qBAEL,MAAkC,CAAlC,WAAkC,KAAA,QAAA,WAAA,EAA3B,YAAa,MAAA,WAAU,CAAA,EAAA"}
|
|
@@ -33,7 +33,7 @@ var tabs_trigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
33
33
|
const { forwardRef } = useForwardExpose();
|
|
34
34
|
const rootContext = injectATabsRootContext();
|
|
35
35
|
const triggerId = computed(() => makeTriggerId(rootContext.baseId, props.value));
|
|
36
|
-
const contentId = computed(() => makeContentId(rootContext.baseId, props.value));
|
|
36
|
+
const contentId = computed(() => rootContext.contentIds.value.has(props.value) ? makeContentId(rootContext.baseId, props.value) : void 0);
|
|
37
37
|
const isSelected = computed(() => props.value === rootContext.modelValue.value);
|
|
38
38
|
function handleMouseDown(event) {
|
|
39
39
|
if (!props.disabled && event.ctrlKey === false) rootContext.changeModelValue(props.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-trigger.js","names":[],"sources":["../../src/tabs/tabs-trigger.vue","../../src/tabs/tabs-trigger.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBA,MAAM,QAAQ;EAKd,MAAM,EAAE,YAAY,GAAG,kBAAkB;EACzC,MAAM,cAAc,wBAAwB;EAE5C,MAAM,YAAY,SAAS,MAAM,cAAc,YAAY,QAAQ,MAAM,MAAM,CAAC;EAChF,MAAM,YAAY,SAAS,MAAM,cAAc,YAAY,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"tabs-trigger.js","names":[],"sources":["../../src/tabs/tabs-trigger.vue","../../src/tabs/tabs-trigger.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBA,MAAM,QAAQ;EAKd,MAAM,EAAE,YAAY,GAAG,kBAAkB;EACzC,MAAM,cAAc,wBAAwB;EAE5C,MAAM,YAAY,SAAS,MAAM,cAAc,YAAY,QAAQ,MAAM,MAAM,CAAC;EAChF,MAAM,YAAY,SAAS,MACzB,YAAY,WAAW,MAAM,IAAI,MAAM,MAAK,GACxC,cAAc,YAAY,QAAQ,MAAM,MAAK,UAElD;EACD,MAAM,aAAa,SAAS,MAAM,MAAM,UAAU,YAAY,WAAW,MAAM;EAE/E,SAAS,gBAAgB,OAAmB;AAG1C,QAAK,MAAM,YAAY,MAAM,YAAY,MACvC,aAAY,iBAAiB,MAAM,MAAM;OAGzC,OAAM,gBAAgB;EAE1B;;uBAIE,YA+BmB,MAAA,0BAAA,EAAA;IA9BjB,YAAA;IACC,YAAY,QAAA;IACZ,QAAQ,WAAA;;qBAET,MAyBa,CAzBb,YAyBa,MAAA,WAAA,EAAA;KAxBV,IAAI,UAAA;KACJ,KAAK,MAAA,WAAU;KAChB,MAAK;KACJ,MAAM,QAAA,OAAE,WAAA;KACR,IAAI,QAAA;KACJ,YAAU,QAAA;KACV,iBAAe,WAAA,QAAU,SAAA;KACzB,iBAAe,UAAA;KACf,cAAY,WAAA,QAAU,WAAA;KACtB,UAAU,QAAA;KACV,iBAAe,QAAA,WAAQ;KACvB,oBAAkB,MAAA,YAAW,CAAC,YAAY;KAC1C,aAAS,cAAO,iBAAe,CAAA,MAAA,EAAA;KAC/B,WAAO,OAAA,OAAA,OAAA,KAAA,SAAA,CAAA,WAAc,MAAA,YAAW,CAAC,iBAAiB,QAAA,MAAK,EAAA,CAAA,SAAA,OAAA,EAAA;KACvD,SAAK,OAAA,OAAA,OAAA,KAAA,MAAA;YAA0H,wBAAwB,MAAA,YAAW,CAAC,mBAAc;WAA4B,WAAA,UAAe,QAAA,YAAY,sBAAmC,OAAA,YAAW,CAAC,iBAAiB,QAAA,MAAK;;;sBAS9S,MAAQ,CAAR,WAAQ,KAAA,QAAA,UAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akar",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.16.0",
|
|
5
5
|
"description": "Vue UI components",
|
|
6
6
|
"author": "Vinicunca Contributors (https://github.com/vinicunca)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@floating-ui/dom": "^1.7.4",
|
|
72
72
|
"@floating-ui/vue": "^1.1.9",
|
|
73
|
-
"@internationalized/date": "^3.
|
|
73
|
+
"@internationalized/date": "^3.10.1",
|
|
74
74
|
"@internationalized/number": "^3.6.5",
|
|
75
|
-
"@tanstack/vue-virtual": "^3.13.
|
|
76
|
-
"@vinicunca/perkakas": "1.
|
|
75
|
+
"@tanstack/vue-virtual": "^3.13.18",
|
|
76
|
+
"@vinicunca/perkakas": "1.13.2",
|
|
77
77
|
"@vueuse/core": "14.1.0",
|
|
78
78
|
"@vueuse/shared": "14.1.0",
|
|
79
79
|
"aria-hidden": "^1.2.6",
|
|
@@ -82,26 +82,26 @@
|
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@iconify/vue": "^5.0.0",
|
|
84
84
|
"@testing-library/dom": "^10.4.1",
|
|
85
|
-
"@testing-library/jest-dom": "^6.
|
|
85
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
86
86
|
"@testing-library/user-event": "^14.6.1",
|
|
87
87
|
"@testing-library/vue": "^8.1.0",
|
|
88
|
-
"@tsconfig/
|
|
88
|
+
"@tsconfig/node24": "^24.0.0",
|
|
89
89
|
"@types/jsdom": "^27.0.0",
|
|
90
|
-
"@types/node": "^24.
|
|
91
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
90
|
+
"@types/node": "^24.10.9",
|
|
91
|
+
"@vitejs/plugin-vue": "^6.0.3",
|
|
92
92
|
"@vitest/coverage-istanbul": "^3.2.4",
|
|
93
93
|
"@vue/test-utils": "^2.4.6",
|
|
94
94
|
"@vue/tsconfig": "^0.8.1",
|
|
95
95
|
"happy-dom": "^20.0.11",
|
|
96
96
|
"jsdom": "^27.0.0",
|
|
97
|
-
"tsdown": "
|
|
98
|
-
"vite": "^7.
|
|
97
|
+
"tsdown": "0.12.9",
|
|
98
|
+
"vite": "^7.3.1",
|
|
99
99
|
"vitest": "^3.2.4",
|
|
100
100
|
"vitest-axe": "0.1.0",
|
|
101
101
|
"vitest-canvas-mock": "^0.3.3",
|
|
102
|
-
"vue": "3.5.
|
|
103
|
-
"vue-component-type-helpers": "3.
|
|
104
|
-
"vue-tsc": "
|
|
102
|
+
"vue": "3.5.27",
|
|
103
|
+
"vue-component-type-helpers": "3.2.2",
|
|
104
|
+
"vue-tsc": "2.2.12"
|
|
105
105
|
},
|
|
106
106
|
"scripts": {
|
|
107
107
|
"build": "pnpm type-check && pnpm build-only",
|
|
@@ -59,12 +59,13 @@ export function useCollection<ItemData = {}>(options: { key?: string; isProvider
|
|
|
59
59
|
|
|
60
60
|
const ACollectionSlot = defineComponent({
|
|
61
61
|
name: 'ACollectionSlot',
|
|
62
|
-
|
|
62
|
+
inheritAttrs: false,
|
|
63
|
+
setup(_, { slots, attrs }) {
|
|
63
64
|
const { primitiveElement, currentElement } = usePrimitiveElement();
|
|
64
65
|
watch(currentElement, () => {
|
|
65
66
|
context.collectionRef.value = currentElement.value;
|
|
66
67
|
});
|
|
67
|
-
return () => h(APrimitiveSlot, { ref: primitiveElement }, slots);
|
|
68
|
+
return () => h(APrimitiveSlot, { ref: primitiveElement, ...attrs }, slots);
|
|
68
69
|
},
|
|
69
70
|
});
|
|
70
71
|
|
|
@@ -26,10 +26,10 @@ function handleClick() {
|
|
|
26
26
|
if (rootContext.inputElement.value) {
|
|
27
27
|
rootContext.inputElement.value.value = '';
|
|
28
28
|
rootContext.inputElement.value.focus();
|
|
29
|
+
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
31
|
+
if (rootContext.resetModelValueOnClear?.value) {
|
|
32
|
+
rootContext.modelValue.value = rootContext.multiple.value ? [] : null;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
</script>
|
|
@@ -3,7 +3,14 @@ import type { Ref } from 'vue';
|
|
|
3
3
|
import type { DismissableLayerEmits, DismissableLayerProps } from '../dismissable-layer';
|
|
4
4
|
import type { APopperContentProps } from '../popper';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
createContext,
|
|
8
|
+
getActiveElement,
|
|
9
|
+
useFocusGuards,
|
|
10
|
+
useForwardExpose,
|
|
11
|
+
useForwardProps,
|
|
12
|
+
useHideOthers,
|
|
13
|
+
} from '../shared';
|
|
7
14
|
import { useBodyScrollLock } from '../shared/use-body-scroll-lock';
|
|
8
15
|
|
|
9
16
|
export type ComboboxContentImplEmits = DismissableLayerEmits;
|
|
@@ -30,6 +37,7 @@ export const [
|
|
|
30
37
|
<script setup lang="ts">
|
|
31
38
|
import { computed, onMounted, onUnmounted, ref, toRefs } from 'vue';
|
|
32
39
|
import { DismissableLayer } from '../dismissable-layer';
|
|
40
|
+
import { AFocusScope } from '../focus-scope';
|
|
33
41
|
import { AListboxContent } from '../listbox';
|
|
34
42
|
import { APopperContent } from '../popper';
|
|
35
43
|
import { APrimitive } from '../primitive';
|
|
@@ -45,6 +53,7 @@ const rootContext = injectAComboboxRootContext();
|
|
|
45
53
|
|
|
46
54
|
const { forwardRef, currentElement } = useForwardExpose();
|
|
47
55
|
useBodyScrollLock(props.bodyLock);
|
|
56
|
+
useFocusGuards();
|
|
48
57
|
useHideOthers(rootContext.parentElement);
|
|
49
58
|
|
|
50
59
|
const pickedProps = computed(() => {
|
|
@@ -84,7 +93,8 @@ onMounted(() => {
|
|
|
84
93
|
});
|
|
85
94
|
|
|
86
95
|
onUnmounted(() => {
|
|
87
|
-
|
|
96
|
+
const activeElement = getActiveElement();
|
|
97
|
+
if (isInputWithinContent.value && (!activeElement || activeElement === document.body)) {
|
|
88
98
|
rootContext.triggerElement.value?.focus();
|
|
89
99
|
}
|
|
90
100
|
});
|
|
@@ -92,40 +102,45 @@ onUnmounted(() => {
|
|
|
92
102
|
|
|
93
103
|
<template>
|
|
94
104
|
<AListboxContent as-child>
|
|
95
|
-
<
|
|
105
|
+
<AFocusScope
|
|
96
106
|
as-child
|
|
97
|
-
|
|
98
|
-
@dismiss="rootContext.onOpenChange(false)"
|
|
99
|
-
@focus-outside="(event) => {
|
|
100
|
-
// if clicking inside the combobox, prevent dismiss
|
|
101
|
-
if (rootContext.parentElement.value?.contains(event.target as Node)) event.preventDefault()
|
|
102
|
-
emits('focusOutside', event)
|
|
103
|
-
}"
|
|
104
|
-
@interact-outside="emits('interactOutside', $event)"
|
|
105
|
-
@escape-key-down="emits('escapeKeyDown', $event)"
|
|
106
|
-
@pointer-down-outside="(event) => {
|
|
107
|
-
// if clicking inside the combobox, prevent dismiss
|
|
108
|
-
if (rootContext.parentElement.value?.contains(event.target as Node)) event.preventDefault()
|
|
109
|
-
emits('pointerDownOutside', event)
|
|
110
|
-
}"
|
|
107
|
+
@mount-auto-focus.prevent
|
|
111
108
|
>
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
109
|
+
<DismissableLayer
|
|
110
|
+
as-child
|
|
111
|
+
:disable-outside-pointer-events="disableOutsidePointerEvents"
|
|
112
|
+
@dismiss="rootContext.onOpenChange(false)"
|
|
113
|
+
@focus-outside="(event) => {
|
|
114
|
+
// if clicking inside the combobox, prevent dismiss
|
|
115
|
+
if (rootContext.parentElement.value?.contains(event.target as Node)) event.preventDefault()
|
|
116
|
+
emits('focusOutside', event)
|
|
117
|
+
}"
|
|
118
|
+
@interact-outside="emits('interactOutside', $event)"
|
|
119
|
+
@escape-key-down="emits('escapeKeyDown', $event)"
|
|
120
|
+
@pointer-down-outside="(event) => {
|
|
121
|
+
// if clicking inside the combobox, prevent dismiss
|
|
122
|
+
if (rootContext.parentElement.value?.contains(event.target as Node)) event.preventDefault()
|
|
123
|
+
emits('pointerDownOutside', event)
|
|
125
124
|
}"
|
|
126
125
|
>
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
<component
|
|
127
|
+
:is="position === 'popper' ? APopperContent : APrimitive"
|
|
128
|
+
v-bind="{ ...$attrs, ...forwardedProps }"
|
|
129
|
+
:id="rootContext.contentId"
|
|
130
|
+
:ref="forwardRef"
|
|
131
|
+
:data-state="rootContext.open.value ? 'open' : 'closed'"
|
|
132
|
+
:style="{
|
|
133
|
+
// flex layout so we can place the scroll buttons properly
|
|
134
|
+
display: 'flex',
|
|
135
|
+
flexDirection: 'column',
|
|
136
|
+
// reset the outline by default as the content MAY get focused
|
|
137
|
+
outline: 'none',
|
|
138
|
+
...(position === 'popper' ? popperStyle : {}),
|
|
139
|
+
}"
|
|
140
|
+
>
|
|
141
|
+
<slot />
|
|
142
|
+
</component>
|
|
143
|
+
</DismissableLayer>
|
|
144
|
+
</AFocusScope>
|
|
130
145
|
</AListboxContent>
|
|
131
146
|
</template>
|
|
@@ -104,6 +104,7 @@ export function createMonth(props: CreateMonthProps): DateGrid<DateValue> {
|
|
|
104
104
|
|
|
105
105
|
const allDays = lastMonthDays.concat(datesArray, nextMonthDays);
|
|
106
106
|
|
|
107
|
+
// @ts-expect-error FIXME: we need to investigate further for this type.
|
|
107
108
|
const weeks = chunk(allDays, 7);
|
|
108
109
|
|
|
109
110
|
return {
|
|
@@ -41,7 +41,7 @@ type DatePickerRootContext = {
|
|
|
41
41
|
closeOnSelect: Ref<boolean>;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export type ADatePickerRootProps = ADateFieldRootProps & APopoverRootProps & Pick<ACalendarRootProps, 'fixedWeeks' | 'isDateDisabled' | 'numberOfMonths' | 'pagedNavigation' | 'preventDeselect' | 'weekdayFormat' | 'weekStartsOn'> & {
|
|
44
|
+
export type ADatePickerRootProps = Omit<ADateFieldRootProps, 'as' | 'asChild'> & APopoverRootProps & Pick<ACalendarRootProps, 'fixedWeeks' | 'isDateDisabled' | 'numberOfMonths' | 'pagedNavigation' | 'preventDeselect' | 'weekdayFormat' | 'weekStartsOn'> & {
|
|
45
45
|
/** Whether or not to close the popover on date select */
|
|
46
46
|
closeOnSelect?: boolean;
|
|
47
47
|
};
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import type { APopoverAnchorProps } from '..';
|
|
3
3
|
import { APopoverAnchor } from '..';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface ADateRangePickerAnchorProps extends APopoverAnchorProps {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
|
-
const props = defineProps<
|
|
9
|
+
const props = defineProps<ADateRangePickerAnchorProps>();
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<template>
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import type { APopoverArrowProps } from '..';
|
|
3
3
|
import { APopoverArrow } from '..';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface ADateRangePickerArrowProps extends APopoverArrowProps {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
|
-
const props = defineProps<
|
|
9
|
+
const props = defineProps<ADateRangePickerArrowProps>();
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<template>
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import type { APopoverCloseProps } from '..';
|
|
3
3
|
import { APopoverClose } from '..';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface ADateRangePickerCloseProps extends APopoverCloseProps {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
|
-
const props = defineProps<
|
|
9
|
+
const props = defineProps<ADateRangePickerCloseProps>();
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<template>
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import type { DateValue } from '@internationalized/date';
|
|
3
3
|
|
|
4
4
|
import type { Ref } from 'vue';
|
|
5
|
+
import type { ADateRangeFieldRoot, ADateRangeFieldRootProps, APopoverRootEmits, APopoverRootProps, ARangeCalendarRootProps } from '..';
|
|
5
6
|
import type { DateMatcher, WeekDayFormat } from '../date';
|
|
6
7
|
import type { DateRange, DateStep, Granularity, HourCycle } from '../shared/date';
|
|
7
|
-
import type { Direction } from '../shared/types';
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { Direction } from '../shared/types';
|
|
10
|
+
import { APopoverRoot } from '..';
|
|
10
11
|
import { createContext, useDirection } from '../shared';
|
|
11
12
|
import { getDefaultDate } from '../shared/date';
|
|
12
|
-
import { APopoverRoot } from '..';
|
|
13
13
|
|
|
14
14
|
type DateRangePickerRootContext = {
|
|
15
15
|
id: Ref<string | undefined>;
|
|
@@ -49,7 +49,7 @@ type DateRangePickerRootContext = {
|
|
|
49
49
|
closeOnSelect?: Ref<boolean>;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
export type ADateRangePickerRootProps = ADateRangeFieldRootProps & APopoverRootProps & Pick<ARangeCalendarRootProps, 'allowNonContiguousRanges' | 'fixedWeeks' | 'isDateDisabled' | 'isDateUnavailable' | 'numberOfMonths' | 'pagedNavigation' | 'preventDeselect' | 'weekdayFormat' | 'weekStartsOn' | 'isDateHighlightable' | 'fixedDate' | 'maximumDays'> & {
|
|
52
|
+
export type ADateRangePickerRootProps = Omit<ADateRangeFieldRootProps, 'as' | 'asChild'> & APopoverRootProps & Pick<ARangeCalendarRootProps, 'allowNonContiguousRanges' | 'fixedWeeks' | 'isDateDisabled' | 'isDateUnavailable' | 'numberOfMonths' | 'pagedNavigation' | 'preventDeselect' | 'weekdayFormat' | 'weekStartsOn' | 'isDateHighlightable' | 'fixedDate' | 'maximumDays'> & {
|
|
53
53
|
/** Whether or not to close the popover on range select */
|
|
54
54
|
closeOnSelect?: boolean;
|
|
55
55
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export {
|
|
2
2
|
default as ADateRangePickerAnchor,
|
|
3
|
+
type ADateRangePickerAnchorProps,
|
|
3
4
|
} from './date-range-picker-anchor.vue';
|
|
4
5
|
|
|
5
6
|
export {
|
|
6
7
|
default as ADateRangePickerArrow,
|
|
8
|
+
type ADateRangePickerArrowProps,
|
|
7
9
|
} from './date-range-picker-arrow.vue';
|
|
8
10
|
export {
|
|
9
11
|
default as ADateRangePickerCalendar,
|
|
@@ -20,10 +22,12 @@ export {
|
|
|
20
22
|
} from './date-range-picker-cell.vue';
|
|
21
23
|
export {
|
|
22
24
|
default as ADateRangePickerClose,
|
|
25
|
+
type ADateRangePickerCloseProps,
|
|
23
26
|
} from './date-range-picker-close.vue';
|
|
24
27
|
|
|
25
28
|
export {
|
|
26
29
|
default as ADateRangePickerContent,
|
|
30
|
+
type ADateRangePickerContentEmits,
|
|
27
31
|
type ADateRangePickerContentProps,
|
|
28
32
|
} from './date-range-picker-content.vue';
|
|
29
33
|
export {
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
FocusOutsideEvent,
|
|
6
6
|
PointerDownOutsideEvent,
|
|
7
7
|
} from './utils';
|
|
8
|
+
import { isNullish } from '@vinicunca/perkakas';
|
|
8
9
|
import {
|
|
9
10
|
computed,
|
|
10
11
|
nextTick,
|
|
@@ -56,6 +57,7 @@ export type DismissableLayerPrivateEmits = DismissableLayerEmits & {
|
|
|
56
57
|
export const context = reactive({
|
|
57
58
|
layersRoot: new Set<HTMLElement>(),
|
|
58
59
|
layersWithOutsidePointerEventsDisabled: new Set<HTMLElement>(),
|
|
60
|
+
originalBodyPointerEvents: undefined as string | undefined,
|
|
59
61
|
branches: new Set<HTMLElement>(),
|
|
60
62
|
});
|
|
61
63
|
</script>
|
|
@@ -149,14 +151,13 @@ onKeyStroke('Escape', (event) => {
|
|
|
149
151
|
}
|
|
150
152
|
});
|
|
151
153
|
|
|
152
|
-
let originalBodyPointerEvents: string;
|
|
153
154
|
watchEffect((cleanupFn) => {
|
|
154
155
|
if (!layerElement.value) {
|
|
155
156
|
return;
|
|
156
157
|
}
|
|
157
158
|
if (props.disableOutsidePointerEvents) {
|
|
158
159
|
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
159
|
-
originalBodyPointerEvents = ownerDocument.value.body.style.pointerEvents;
|
|
160
|
+
context.originalBodyPointerEvents = ownerDocument.value.body.style.pointerEvents;
|
|
160
161
|
ownerDocument.value.body.style.pointerEvents = 'none';
|
|
161
162
|
}
|
|
162
163
|
context.layersWithOutsidePointerEventsDisabled.add(layerElement.value);
|
|
@@ -167,8 +168,9 @@ watchEffect((cleanupFn) => {
|
|
|
167
168
|
if (
|
|
168
169
|
props.disableOutsidePointerEvents
|
|
169
170
|
&& context.layersWithOutsidePointerEventsDisabled.size === 1
|
|
171
|
+
&& !isNullish(context.originalBodyPointerEvents)
|
|
170
172
|
) {
|
|
171
|
-
ownerDocument.value.body.style.pointerEvents = originalBodyPointerEvents;
|
|
173
|
+
ownerDocument.value.body.style.pointerEvents = context.originalBodyPointerEvents;
|
|
172
174
|
}
|
|
173
175
|
});
|
|
174
176
|
});
|
|
@@ -45,7 +45,13 @@ watch(context.isEditing, (value) => {
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
function handleSubmitKeyDown(event: KeyboardEvent) {
|
|
48
|
-
if (
|
|
48
|
+
if (
|
|
49
|
+
(context.submitMode.value === 'enter' || context.submitMode.value === 'both')
|
|
50
|
+
&& event.key === KEY_CODES.ENTER
|
|
51
|
+
&& !event.shiftKey
|
|
52
|
+
&& !event.metaKey
|
|
53
|
+
&& !event.isComposing
|
|
54
|
+
) {
|
|
49
55
|
context.submit();
|
|
50
56
|
}
|
|
51
57
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Ref } from 'vue';
|
|
3
|
+
import type { AcceptableValue } from '../shared/types';
|
|
3
4
|
import type { AMenuGroupProps } from './menu-group.vue';
|
|
4
5
|
import { createContext } from '../shared';
|
|
5
6
|
|
|
6
7
|
interface MenuRadioGroupContext {
|
|
7
|
-
modelValue: Ref<
|
|
8
|
-
onValueChange: (payload:
|
|
8
|
+
modelValue: Ref<AcceptableValue>;
|
|
9
|
+
onValueChange: (payload: AcceptableValue) => void;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export interface AMenuRadioGroupProps extends AMenuGroupProps {
|
|
12
13
|
/** The value of the selected item in the group. */
|
|
13
|
-
modelValue?:
|
|
14
|
+
modelValue?: AcceptableValue;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export type AMenuRadioGroupEmits = {
|
|
17
18
|
/** Event handler called when the value changes. */
|
|
18
|
-
'update:modelValue': [payload:
|
|
19
|
+
'update:modelValue': [payload: AcceptableValue];
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
export const [injectMenuRadioGroupContext, provideMenuRadioGroupContext]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { AcceptableValue } from '../shared/types';
|
|
2
3
|
import type {
|
|
3
4
|
AMenuItemEmits,
|
|
4
5
|
AMenuItemProps,
|
|
@@ -8,7 +9,7 @@ export type AMenuRadioItemEmits = AMenuItemEmits;
|
|
|
8
9
|
|
|
9
10
|
export interface AMenuRadioItemProps extends AMenuItemProps {
|
|
10
11
|
/** The unique value of the item. */
|
|
11
|
-
value:
|
|
12
|
+
value: AcceptableValue;
|
|
12
13
|
}
|
|
13
14
|
</script>
|
|
14
15
|
|
|
@@ -8,7 +8,7 @@ export interface ANavigationMenuItemProps extends APrimitiveProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* A unique value that associates the item with an active value when the navigation menu is controlled.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* This prop is managed automatically when uncontrolled.
|
|
12
12
|
*/
|
|
13
13
|
value?: string;
|
|
14
14
|
}
|
|
@@ -94,7 +94,7 @@ export const [
|
|
|
94
94
|
|
|
95
95
|
<script setup lang="ts">
|
|
96
96
|
import { isString } from '@vinicunca/perkakas';
|
|
97
|
-
import { refAutoReset, useDebounceFn, useVModel } from '@vueuse/core';
|
|
97
|
+
import { refAutoReset, useDebounceFn, useEventListener, useVModel } from '@vueuse/core';
|
|
98
98
|
import {
|
|
99
99
|
computed,
|
|
100
100
|
ref,
|
|
@@ -106,6 +106,7 @@ import {
|
|
|
106
106
|
APrimitive,
|
|
107
107
|
} from '../primitive';
|
|
108
108
|
import { useDirection, useForwardExpose, useId } from '../shared';
|
|
109
|
+
import { EVENT_ROOT_CONTENT_DISMISS } from './utils';
|
|
109
110
|
|
|
110
111
|
const props = withDefaults(
|
|
111
112
|
defineProps<ANavigationMenuRootProps>(),
|
|
@@ -185,6 +186,17 @@ watchEffect(() => {
|
|
|
185
186
|
);
|
|
186
187
|
});
|
|
187
188
|
|
|
189
|
+
function onItemDismiss() {
|
|
190
|
+
previousValue.value = modelValue.value;
|
|
191
|
+
modelValue.value = '';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
useEventListener(
|
|
195
|
+
rootNavigationMenu,
|
|
196
|
+
EVENT_ROOT_CONTENT_DISMISS,
|
|
197
|
+
onItemDismiss,
|
|
198
|
+
);
|
|
199
|
+
|
|
188
200
|
provideNavigationMenuContext({
|
|
189
201
|
isRootMenu: true,
|
|
190
202
|
modelValue,
|
|
@@ -225,10 +237,7 @@ provideNavigationMenuContext({
|
|
|
225
237
|
previousValue.value = modelValue.value;
|
|
226
238
|
modelValue.value = val;
|
|
227
239
|
},
|
|
228
|
-
onItemDismiss
|
|
229
|
-
previousValue.value = modelValue.value;
|
|
230
|
-
modelValue.value = '';
|
|
231
|
-
},
|
|
240
|
+
onItemDismiss,
|
|
232
241
|
});
|
|
233
242
|
</script>
|
|
234
243
|
|
|
@@ -236,7 +245,6 @@ provideNavigationMenuContext({
|
|
|
236
245
|
<ACollectionSlot>
|
|
237
246
|
<APrimitive
|
|
238
247
|
:ref="forwardRef"
|
|
239
|
-
aria-label="Main"
|
|
240
248
|
:as="as"
|
|
241
249
|
:as-child="asChild"
|
|
242
250
|
:data-orientation="orientation"
|