akar 2.0.7 → 2.0.8

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.
Files changed (35) hide show
  1. package/dist/Combobox/ComboboxInput.cjs +6 -1
  2. package/dist/Combobox/ComboboxInput.cjs.map +1 -1
  3. package/dist/Combobox/ComboboxInput.js +6 -1
  4. package/dist/Combobox/ComboboxInput.js.map +1 -1
  5. package/dist/Dialog/DialogOverlayImpl.cjs +5 -1
  6. package/dist/Dialog/DialogOverlayImpl.cjs.map +1 -1
  7. package/dist/Dialog/DialogOverlayImpl.js +5 -1
  8. package/dist/Dialog/DialogOverlayImpl.js.map +1 -1
  9. package/dist/NavigationMenu/NavigationMenuRoot.cjs +16 -3
  10. package/dist/NavigationMenu/NavigationMenuRoot.cjs.map +1 -1
  11. package/dist/NavigationMenu/NavigationMenuRoot.js +16 -3
  12. package/dist/NavigationMenu/NavigationMenuRoot.js.map +1 -1
  13. package/dist/ScrollArea/ScrollAreaScrollbarX.cjs +3 -0
  14. package/dist/ScrollArea/ScrollAreaScrollbarX.cjs.map +1 -1
  15. package/dist/ScrollArea/ScrollAreaScrollbarX.js +4 -1
  16. package/dist/ScrollArea/ScrollAreaScrollbarX.js.map +1 -1
  17. package/dist/ScrollArea/ScrollAreaScrollbarY.cjs +3 -0
  18. package/dist/ScrollArea/ScrollAreaScrollbarY.cjs.map +1 -1
  19. package/dist/ScrollArea/ScrollAreaScrollbarY.js +4 -1
  20. package/dist/ScrollArea/ScrollAreaScrollbarY.js.map +1 -1
  21. package/dist/constant.d.cts.map +1 -1
  22. package/dist/index2.d.ts.map +1 -1
  23. package/dist/index4.d.cts +645 -645
  24. package/dist/index4.d.cts.map +1 -1
  25. package/dist/index4.d.ts +631 -631
  26. package/dist/index4.d.ts.map +1 -1
  27. package/dist/internal.d.cts +2 -2
  28. package/dist/internal.d.ts +2 -2
  29. package/package.json +3 -3
  30. package/src/Combobox/ComboboxInput.vue +14 -1
  31. package/src/Dialog/DialogOverlayImpl.vue +1 -1
  32. package/src/NavigationMenu/NavigationMenuRoot.vue +21 -4
  33. package/src/ScrollArea/ScrollAreaScrollbarX.vue +8 -1
  34. package/src/ScrollArea/ScrollAreaScrollbarY.vue +7 -1
  35. package/src/test/utils.ts +0 -2
@@ -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 vue18 from "vue";
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: vue18.DefineComponent<MenuAnchorProps, {}, {}, {}, {}, vue18.ComponentOptionsMixin, vue18.ComponentOptionsMixin, {}, string, vue18.PublicProps, Readonly<MenuAnchorProps> & Readonly<{}>, {}, {}, {}, {}, string, vue18.ComponentProvideOptions, false, {}, any>;
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 & {
@@ -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 vue45 from "vue";
4
+ import * as vue88 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: vue45.DefineComponent<MenuAnchorProps, {}, {}, {}, {}, vue45.ComponentOptionsMixin, vue45.ComponentOptionsMixin, {}, string, vue45.PublicProps, Readonly<MenuAnchorProps> & Readonly<{}>, {}, {}, {}, {}, string, vue45.ComponentProvideOptions, false, {}, any>;
12
+ declare const __VLS_base: vue88.DefineComponent<MenuAnchorProps, {}, {}, {}, {}, vue88.ComponentOptionsMixin, vue88.ComponentOptionsMixin, {}, string, vue88.PublicProps, Readonly<MenuAnchorProps> & Readonly<{}>, {}, {}, {}, {}, string, vue88.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "akar",
3
3
  "type": "module",
4
- "version": "2.0.7",
4
+ "version": "2.0.8",
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.6",
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.12",
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",
@@ -78,7 +78,20 @@ function handleBlur(ev: FocusEvent) {
78
78
  const isInsideContent = document.getElementById(rootContext.contentId)?.contains(nextFocus);
79
79
 
80
80
  if (!isInsideRoot && !isInsideContent) {
81
- rootContext.onOpenChange(false);
81
+ // Delay to let FocusScope's focus-restoration (handleFocusOut) run first.
82
+ // Without this, closing fires before FocusScope can pull focus back inside,
83
+ // causing a second combobox to immediately close when switching between two.
84
+ requestAnimationFrame(() => {
85
+ if (!rootContext.open.value) {
86
+ return;
87
+ }
88
+ const active = document.activeElement;
89
+ const isStillOutside = !rootContext.parentElement.value?.contains(active)
90
+ && !document.getElementById(rootContext.contentId)?.contains(active);
91
+ if (isStillOutside) {
92
+ rootContext.onOpenChange(false);
93
+ }
94
+ });
82
95
  }
83
96
  }
84
97
 
@@ -23,7 +23,7 @@ useForwardExpose();
23
23
  :as-child="asChild"
24
24
  :data-state="rootContext.open.value ? 'open' : 'closed'"
25
25
  style="pointer-events: auto"
26
- @pointerdown.left.prevent
26
+ @pointerdown.left.self.prevent
27
27
  >
28
28
  <slot />
29
29
  </Primitive>
@@ -141,12 +141,13 @@ const { delayDuration, skipDelayDuration, dir: propDir, disableClickTrigger, dis
141
141
  const dir = useDirection(propDir);
142
142
 
143
143
  const isDelaySkipped = refAutoReset(false, skipDelayDuration);
144
+ const skipNextClose = ref(false);
144
145
  const computedDelay = computed(() => {
145
146
  const isOpen = modelValue.value !== '';
146
147
  if (isOpen || isDelaySkipped.value) {
147
148
  return 150;
148
- } // 150ms for user to switch trigger or move into content view
149
- else {
149
+ } else {
150
+ // 150ms for user to switch trigger or move into content view
150
151
  return delayDuration.value;
151
152
  }
152
153
  });
@@ -154,8 +155,17 @@ const computedDelay = computed(() => {
154
155
  const debouncedFn = useDebounceFn((val?: string) => {
155
156
  // passing `undefined` meant to reset the debounce timer
156
157
  if (isString(val)) {
158
+ if (val === '' && skipNextClose.value) {
159
+ skipNextClose.value = false;
160
+ return;
161
+ }
162
+
157
163
  previousValue.value = modelValue.value;
158
164
  modelValue.value = val;
165
+
166
+ if (val === '') {
167
+ isDelaySkipped.value = true;
168
+ }
159
169
  }
160
170
  }, computedDelay);
161
171
 
@@ -193,10 +203,16 @@ provideNavigationMenuContext({
193
203
  viewport.value = val;
194
204
  },
195
205
  onTriggerEnter: (val) => {
196
- debouncedFn(val);
206
+ if (modelValue.value !== '') {
207
+ skipNextClose.value = true;
208
+ previousValue.value = modelValue.value;
209
+ modelValue.value = val;
210
+ } else {
211
+ debouncedFn(val);
212
+ }
197
213
  },
198
214
  onTriggerLeave: () => {
199
- isDelaySkipped.value = true;
215
+ skipNextClose.value = false;
200
216
  debouncedFn('');
201
217
  },
202
218
  onContentEnter: () => {
@@ -204,6 +220,7 @@ provideNavigationMenuContext({
204
220
  },
205
221
  onContentLeave: () => {
206
222
  if (!props.disablePointerLeaveClose) {
223
+ skipNextClose.value = false;
207
224
  debouncedFn('');
208
225
  }
209
226
  },
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, onMounted } from 'vue';
2
+ import { computed, onMounted, onUnmounted } from 'vue';
3
3
  import { useForwardExpose } from '@/shared';
4
4
  import { injectScrollAreaRootContext } from './ScrollAreaRoot.vue';
5
5
  import ScrollAreaScrollbarImpl from './ScrollAreaScrollbarImpl.vue';
@@ -16,6 +16,13 @@ onMounted(() => {
16
16
  rootContext.onScrollbarXChange(scrollbarElement.value);
17
17
  }
18
18
  });
19
+
20
+ // Clear the registration on unmount so consumers (e.g. ScrollAreaCorner) don't
21
+ // hold a stale reference once the scrollbar is removed (e.g. between hover cycles).
22
+ onUnmounted(() => {
23
+ rootContext.onScrollbarXChange(null);
24
+ });
25
+
19
26
  const sizes = computed(() => scrollbarVisibleContext.sizes.value);
20
27
  </script>
21
28
 
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, onMounted } from 'vue';
2
+ import { computed, onMounted, onUnmounted } from 'vue';
3
3
  import { useForwardExpose } from '@/shared';
4
4
  import { injectScrollAreaRootContext } from './ScrollAreaRoot.vue';
5
5
  import ScrollAreaScrollbarImpl from './ScrollAreaScrollbarImpl.vue';
@@ -17,6 +17,12 @@ onMounted(() => {
17
17
  }
18
18
  });
19
19
 
20
+ // Clear the registration on unmount so consumers (e.g. ScrollAreaCorner) don't
21
+ // hold a stale reference once the scrollbar is removed (e.g. between hover cycles).
22
+ onUnmounted(() => {
23
+ rootContext.onScrollbarYChange(null);
24
+ });
25
+
20
26
  const sizes = computed(() => scrollbarVisibleContext.sizes.value);
21
27
  </script>
22
28
 
package/src/test/utils.ts CHANGED
@@ -5,5 +5,3 @@ export const handleSubmit = vi.fn((e) => {
5
5
  const formData = new FormData(e.target);
6
6
  return Object.fromEntries(formData as any);
7
7
  });
8
-
9
- export const sleep = (duration: number) => new Promise((resolve) => setTimeout(resolve, duration));