@ariakit/react-core 0.1.8 → 0.2.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.
Files changed (151) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/cjs/__chunks/{XFZ3MEQZ.cjs → 27JG67F3.cjs} +3 -3
  3. package/cjs/__chunks/{ASQZCUUA.cjs → 4SZYU2PD.cjs} +2 -2
  4. package/cjs/__chunks/5P6HRGY6.cjs +21 -0
  5. package/cjs/__chunks/{YYKQBWQQ.cjs → A6ZSQXNQ.cjs} +2 -2
  6. package/cjs/__chunks/{OMM6PC3A.cjs → D3EUPD6P.cjs} +15 -4
  7. package/cjs/__chunks/{IRSBF3C5.cjs → GOXUG4RX.cjs} +23 -18
  8. package/cjs/__chunks/{RHO5OVPE.cjs → GRL5KGV3.cjs} +2 -2
  9. package/cjs/__chunks/MHL3EECX.cjs +363 -0
  10. package/cjs/__chunks/{AUDANYMJ.cjs → W2XKIB23.cjs} +1 -20
  11. package/cjs/__chunks/{PFD4TS6B.cjs → WWDX5YPG.cjs} +28 -15
  12. package/cjs/combobox/combobox-item.cjs +1 -1
  13. package/cjs/combobox/combobox-popover.cjs +9 -8
  14. package/cjs/combobox/combobox-store.cjs +3 -3
  15. package/cjs/combobox/combobox-store.d.ts +0 -7
  16. package/cjs/combobox/combobox.cjs +3 -3
  17. package/cjs/composite/composite-item.cjs +1 -1
  18. package/cjs/composite/composite-overflow-disclosure.cjs +5 -5
  19. package/cjs/composite/composite-overflow-store.cjs +3 -3
  20. package/cjs/composite/composite-overflow-store.d.ts +1 -13
  21. package/cjs/composite/composite-overflow.cjs +9 -8
  22. package/cjs/composite/composite.cjs +3 -3
  23. package/cjs/dialog/dialog-backdrop.cjs +3 -2
  24. package/cjs/dialog/dialog-backdrop.d.ts +2 -5
  25. package/cjs/dialog/dialog-dismiss.cjs +1 -1
  26. package/cjs/dialog/dialog.cjs +8 -7
  27. package/cjs/dialog/dialog.d.ts +19 -6
  28. package/cjs/form/form-radio.cjs +1 -1
  29. package/cjs/hovercard/hovercard-dismiss.cjs +1 -1
  30. package/cjs/hovercard/hovercard-store.cjs +3 -3
  31. package/cjs/hovercard/hovercard-store.d.ts +1 -13
  32. package/cjs/hovercard/hovercard.cjs +10 -9
  33. package/cjs/menu/menu-bar.cjs +3 -3
  34. package/cjs/menu/menu-button.cjs +8 -8
  35. package/cjs/menu/menu-dismiss.cjs +1 -1
  36. package/cjs/menu/menu-item-checkbox.cjs +1 -1
  37. package/cjs/menu/menu-item-radio.cjs +1 -1
  38. package/cjs/menu/menu-item.cjs +1 -1
  39. package/cjs/menu/menu-list.cjs +4 -4
  40. package/cjs/menu/menu-store.cjs +7 -7
  41. package/cjs/menu/menu-store.d.ts +0 -7
  42. package/cjs/menu/menu.cjs +18 -17
  43. package/cjs/popover/popover-disclosure.cjs +4 -4
  44. package/cjs/popover/popover-dismiss.cjs +1 -1
  45. package/cjs/popover/popover-store.cjs +2 -2
  46. package/cjs/popover/popover-store.d.ts +1 -13
  47. package/cjs/popover/popover.cjs +9 -8
  48. package/cjs/popover/popover.d.ts +96 -0
  49. package/cjs/portal/portal.cjs +2 -2
  50. package/cjs/radio/radio-group.cjs +3 -3
  51. package/cjs/radio/radio.cjs +1 -1
  52. package/cjs/role/role.cjs +3 -14
  53. package/cjs/select/select-item.cjs +1 -1
  54. package/cjs/select/select-list.cjs +4 -4
  55. package/cjs/select/select-popover.cjs +18 -17
  56. package/cjs/select/select-store.cjs +3 -3
  57. package/cjs/select/select-store.d.ts +0 -7
  58. package/cjs/select/select.cjs +5 -5
  59. package/cjs/tab/tab-list.cjs +3 -3
  60. package/cjs/tab/tab-panel.cjs +3 -3
  61. package/cjs/tab/tab.cjs +1 -1
  62. package/cjs/toolbar/toolbar-container.cjs +1 -1
  63. package/cjs/toolbar/toolbar-input.cjs +1 -1
  64. package/cjs/toolbar/toolbar-item.cjs +1 -1
  65. package/cjs/toolbar/toolbar.cjs +3 -3
  66. package/cjs/tooltip/tooltip-anchor.cjs +58 -28
  67. package/cjs/tooltip/tooltip-anchor.d.ts +2 -18
  68. package/cjs/tooltip/tooltip-store.cjs +4 -3
  69. package/cjs/tooltip/tooltip-store.d.ts +5 -17
  70. package/cjs/tooltip/tooltip.cjs +66 -67
  71. package/cjs/tooltip/tooltip.d.ts +6 -25
  72. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  73. package/esm/__chunks/{USCWE5QL.js → 2CA5JWPW.js} +28 -15
  74. package/esm/__chunks/5PIH3SMS.js +35 -0
  75. package/esm/__chunks/{PZK3B6LX.js → 776K5FXB.js} +1 -1
  76. package/esm/__chunks/{DQSQP4IL.js → GDDVBILZ.js} +1 -1
  77. package/esm/__chunks/{CXDKC5CW.js → HJWYYQGA.js} +1 -1
  78. package/esm/__chunks/{3FKA4P4C.js → K5R24MFH.js} +1 -1
  79. package/esm/__chunks/MLEIJKSM.js +363 -0
  80. package/esm/__chunks/{ZFMAA4DD.js → MR75RQGW.js} +16 -5
  81. package/esm/__chunks/{EMZ4NQG4.js → NAG6UD2X.js} +25 -20
  82. package/esm/__chunks/XIACQCPS.js +21 -0
  83. package/esm/combobox/combobox-item.js +1 -1
  84. package/esm/combobox/combobox-popover.js +8 -7
  85. package/esm/combobox/combobox-store.d.ts +0 -7
  86. package/esm/combobox/combobox-store.js +1 -1
  87. package/esm/combobox/combobox.js +2 -2
  88. package/esm/composite/composite-item.js +1 -1
  89. package/esm/composite/composite-overflow-disclosure.js +4 -4
  90. package/esm/composite/composite-overflow-store.d.ts +1 -13
  91. package/esm/composite/composite-overflow-store.js +1 -1
  92. package/esm/composite/composite-overflow.js +8 -7
  93. package/esm/composite/composite.js +2 -2
  94. package/esm/dialog/dialog-backdrop.d.ts +2 -5
  95. package/esm/dialog/dialog-backdrop.js +2 -1
  96. package/esm/dialog/dialog-dismiss.js +1 -1
  97. package/esm/dialog/dialog.d.ts +19 -6
  98. package/esm/dialog/dialog.js +7 -6
  99. package/esm/form/form-radio.js +1 -1
  100. package/esm/hovercard/hovercard-dismiss.js +1 -1
  101. package/esm/hovercard/hovercard-store.d.ts +1 -13
  102. package/esm/hovercard/hovercard-store.js +2 -2
  103. package/esm/hovercard/hovercard.js +9 -8
  104. package/esm/menu/menu-bar.js +2 -2
  105. package/esm/menu/menu-button.js +7 -7
  106. package/esm/menu/menu-dismiss.js +1 -1
  107. package/esm/menu/menu-item-checkbox.js +1 -1
  108. package/esm/menu/menu-item-radio.js +1 -1
  109. package/esm/menu/menu-item.js +1 -1
  110. package/esm/menu/menu-list.js +3 -3
  111. package/esm/menu/menu-store.d.ts +0 -7
  112. package/esm/menu/menu-store.js +5 -5
  113. package/esm/menu/menu.js +17 -16
  114. package/esm/popover/popover-disclosure.js +3 -3
  115. package/esm/popover/popover-dismiss.js +1 -1
  116. package/esm/popover/popover-store.d.ts +1 -13
  117. package/esm/popover/popover-store.js +1 -1
  118. package/esm/popover/popover.d.ts +96 -0
  119. package/esm/popover/popover.js +8 -7
  120. package/esm/portal/portal.js +1 -1
  121. package/esm/radio/radio-group.js +2 -2
  122. package/esm/radio/radio.js +1 -1
  123. package/esm/role/role.js +4 -15
  124. package/esm/select/select-item.js +1 -1
  125. package/esm/select/select-list.js +3 -3
  126. package/esm/select/select-popover.js +16 -15
  127. package/esm/select/select-store.d.ts +0 -7
  128. package/esm/select/select-store.js +1 -1
  129. package/esm/select/select.js +4 -4
  130. package/esm/tab/tab-list.js +2 -2
  131. package/esm/tab/tab-panel.js +3 -3
  132. package/esm/tab/tab.js +1 -1
  133. package/esm/toolbar/toolbar-container.js +1 -1
  134. package/esm/toolbar/toolbar-input.js +1 -1
  135. package/esm/toolbar/toolbar-item.js +1 -1
  136. package/esm/toolbar/toolbar.js +2 -2
  137. package/esm/tooltip/tooltip-anchor.d.ts +2 -18
  138. package/esm/tooltip/tooltip-anchor.js +59 -29
  139. package/esm/tooltip/tooltip-store.d.ts +5 -17
  140. package/esm/tooltip/tooltip-store.js +6 -5
  141. package/esm/tooltip/tooltip.d.ts +6 -25
  142. package/esm/tooltip/tooltip.js +67 -68
  143. package/esm/tsconfig.build.tsbuildinfo +1 -1
  144. package/package.json +3 -2
  145. package/cjs/__chunks/JZRGYPLK.cjs +0 -125
  146. package/esm/__chunks/JJHXFKMC.js +0 -125
  147. package/esm/__chunks/SHGWT5HV.js +0 -54
  148. package/cjs/__chunks/{OV363CW6.cjs → BDJYHP43.cjs} +2 -2
  149. package/cjs/__chunks/{5I6IQHKQ.cjs → BIPONQXE.cjs} +2 -2
  150. package/esm/__chunks/{OY5YT7OV.js → RTOWJJVI.js} +3 -3
  151. package/esm/__chunks/{6O3TZMB4.js → U2KSDJ3W.js} +3 -3
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  PopoverDisclosure,
3
3
  usePopoverDisclosure
4
- } from "../__chunks/6O3TZMB4.js";
4
+ } from "../__chunks/U2KSDJ3W.js";
5
5
  import "../__chunks/LSTZ5Q72.js";
6
6
  import "../__chunks/24P2K6AU.js";
7
- import "../__chunks/OQUXG6FE.js";
8
- import "../__chunks/6GS36SYX.js";
9
7
  import "../__chunks/D6NPK2DL.js";
8
+ import "../__chunks/OQUXG6FE.js";
10
9
  import "../__chunks/4QNHBDVS.js";
10
+ import "../__chunks/6GS36SYX.js";
11
11
  import "../__chunks/AGWM73EZ.js";
12
12
  import "../__chunks/BMLNRUFQ.js";
13
13
  import "../__chunks/5ETIGB6O.js";
@@ -4,8 +4,8 @@ import {
4
4
  } from "../__chunks/PIRVQZZN.js";
5
5
  import "../__chunks/TSWOSEC5.js";
6
6
  import "../__chunks/OQUXG6FE.js";
7
- import "../__chunks/LNHZLQEK.js";
8
7
  import "../__chunks/4QNHBDVS.js";
8
+ import "../__chunks/LNHZLQEK.js";
9
9
  import "../__chunks/AGWM73EZ.js";
10
10
  import "../__chunks/BMLNRUFQ.js";
11
11
  import "../__chunks/5ETIGB6O.js";
@@ -1,19 +1,7 @@
1
1
  import * as Core from "@ariakit/core/popover/popover-store";
2
2
  import type { DialogStoreFunctions, DialogStoreOptions, DialogStoreState } from "../dialog/dialog-store.js";
3
3
  import type { Store } from "../utils/store.js";
4
- export declare function usePopoverStoreOptions(props: PopoverStoreProps): {
5
- getAnchorRect: ((anchor: HTMLElement | null) => {
6
- x?: number | undefined;
7
- y?: number | undefined;
8
- width?: number | undefined;
9
- height?: number | undefined;
10
- } | null) | undefined;
11
- renderCallback: ((props: Core.PopoverStoreRenderCallbackProps) => void | (() => void)) | undefined;
12
- setOpen?: ((open: boolean) => void) | undefined;
13
- defaultOpen?: boolean | undefined;
14
- open?: boolean | undefined;
15
- animated?: number | boolean | undefined;
16
- };
4
+ export declare function usePopoverStoreOptions(props: PopoverStoreProps): Partial<import("../disclosure/disclosure-store.js").DisclosureStoreOptions>;
17
5
  export declare function usePopoverStoreProps<T extends PopoverStore>(store: T, props: PopoverStoreProps): T;
18
6
  /**
19
7
  * Creates a popover store.
@@ -2,7 +2,7 @@ import {
2
2
  usePopoverStore,
3
3
  usePopoverStoreOptions,
4
4
  usePopoverStoreProps
5
- } from "../__chunks/SHGWT5HV.js";
5
+ } from "../__chunks/5PIH3SMS.js";
6
6
  import "../__chunks/OBNQHP6V.js";
7
7
  import "../__chunks/HN4VMOUI.js";
8
8
  import "../__chunks/AV5WE37O.js";
@@ -2,6 +2,12 @@ import type { HTMLAttributes } from "react";
2
2
  import type { DialogOptions } from "../dialog/dialog.js";
3
3
  import type { As, Props } from "../utils/types.js";
4
4
  import type { PopoverStore } from "./popover-store.js";
5
+ type AnchorRect = {
6
+ x?: number;
7
+ y?: number;
8
+ width?: number;
9
+ height?: number;
10
+ };
5
11
  /**
6
12
  * Returns props to create a `Popover` component.
7
13
  * @see https://ariakit.org/components/popover
@@ -27,6 +33,7 @@ export declare const Popover: import("../utils/types.js").Component<PopoverOptio
27
33
  export interface PopoverOptions<T extends As = "div"> extends DialogOptions<T> {
28
34
  /**
29
35
  * Object returned by the `usePopoverStore` hook.
36
+ * @see https://ariakit.org/guide/component-stores
30
37
  */
31
38
  store: PopoverStore;
32
39
  /**
@@ -34,5 +41,94 @@ export interface PopoverOptions<T extends As = "div"> extends DialogOptions<T> {
34
41
  * be used to position the popover.
35
42
  */
36
43
  wrapperProps?: HTMLAttributes<HTMLDivElement>;
44
+ /**
45
+ * Whether the popover has `position: fixed` or not.
46
+ * @default false
47
+ */
48
+ fixed?: boolean;
49
+ /**
50
+ * The distance between the popover and the anchor element.
51
+ * @default 0
52
+ */
53
+ gutter?: number;
54
+ /**
55
+ * The skidding of the popover along the anchor element. Can be set to
56
+ * negative values to make the popover shift to the opposite side.
57
+ * @default 0
58
+ */
59
+ shift?: number;
60
+ /**
61
+ * Controls the behavior of the popover when it overflows the viewport:
62
+ * - If a `boolean`, specifies whether the popover should flip to the
63
+ * opposite side when it overflows.
64
+ * - If a `string`, indicates the preferred fallback placements when it
65
+ * overflows. The placements must be spaced-delimited, e.g. "top left".
66
+ * @default true
67
+ */
68
+ flip?: boolean | string;
69
+ /**
70
+ * Whether the popover should slide when it overflows.
71
+ * @default true
72
+ */
73
+ slide?: boolean;
74
+ /**
75
+ * Whether the popover can overlap the anchor element when it overflows.
76
+ * @default false
77
+ */
78
+ overlap?: boolean;
79
+ /**
80
+ * Whether the popover should have the same width as the anchor element. This
81
+ * will be exposed to CSS as
82
+ * [`--popover-anchor-width`](https://ariakit.org/guide/styling#--popover-anchor-width).
83
+ * @default false
84
+ */
85
+ sameWidth?: boolean;
86
+ /**
87
+ * Whether the popover should fit the viewport. If this is set to true, the
88
+ * popover wrapper will have `maxWidth` and `maxHeight` set to the viewport
89
+ * size. This will be exposed to CSS as
90
+ * [`--popover-available-width`](https://ariakit.org/guide/styling#--popover-available-width)
91
+ * and
92
+ * [`--popover-available-height`](https://ariakit.org/guide/styling#--popover-available-height).
93
+ * @default false
94
+ */
95
+ fitViewport?: boolean;
96
+ /**
97
+ * The minimum padding between the arrow and the popover corner.
98
+ * @default 4
99
+ */
100
+ arrowPadding?: number;
101
+ /**
102
+ * The minimum padding between the popover and the viewport edge. This will be
103
+ * exposed to CSS as
104
+ * [`--popover-overflow-padding`](https://ariakit.org/guide/styling#--popover-overflow-padding).
105
+ * @default 8
106
+ */
107
+ overflowPadding?: number;
108
+ /**
109
+ * Function that returns the anchor element's DOMRect. If this is explicitly
110
+ * passed, it will override the anchor `getBoundingClientRect` method.
111
+ *
112
+ * Examples using this prop:
113
+ * - [Textarea with inline combobox](https://ariakit.org/examples/combobox-textarea)
114
+ * - [Standalone Popover](https://ariakit.org/examples/popover-standalone)
115
+ * - [Context menu](https://ariakit.org/examples/menu-context-menu)
116
+ * - [Selection Popover](https://ariakit.org/examples/popover-selection)
117
+ * @param anchor The anchor element.
118
+ */
119
+ getAnchorRect?: (anchor: HTMLElement | null) => AnchorRect | null;
120
+ /**
121
+ * A callback that will be called when the popover needs to calculate its
122
+ * position. This will override the internal `updatePosition` function. The
123
+ * original `updatePosition` function will be passed as an argument, so it can
124
+ * be called inside the callback to apply the default behavior.
125
+ *
126
+ * Example susing this prop:
127
+ * - [Responsive Popover](https://ariakit.org/examples/popover-responsive)
128
+ */
129
+ updatePosition?: (props: {
130
+ updatePosition: () => Promise<void>;
131
+ }) => void;
37
132
  }
38
133
  export type PopoverProps<T extends As = "div"> = Props<PopoverOptions<T>>;
134
+ export {};
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Popover,
3
3
  usePopover
4
- } from "../__chunks/JJHXFKMC.js";
5
- import "../__chunks/EMZ4NQG4.js";
6
- import "../__chunks/ZFMAA4DD.js";
4
+ } from "../__chunks/MLEIJKSM.js";
5
+ import "../__chunks/NAG6UD2X.js";
6
+ import "../__chunks/MR75RQGW.js";
7
7
  import "../__chunks/4H6H5RRM.js";
8
8
  import "../__chunks/7A3SODQV.js";
9
9
  import "../__chunks/RBUEJWRA.js";
@@ -17,15 +17,16 @@ import "../__chunks/6WVG5KFF.js";
17
17
  import "../__chunks/ISPCL6N4.js";
18
18
  import "../__chunks/7JNF6I52.js";
19
19
  import "../__chunks/6OMX4H3W.js";
20
+ import "../__chunks/2CA5JWPW.js";
21
+ import "../__chunks/DIO64N2C.js";
22
+ import "../__chunks/LDDPB3PY.js";
20
23
  import "../__chunks/COQHFAEN.js";
21
24
  import "../__chunks/LNHZLQEK.js";
25
+ import "../__chunks/XIACQCPS.js";
26
+ import "../__chunks/6AJCHLAV.js";
22
27
  import "../__chunks/6GS36SYX.js";
23
28
  import "../__chunks/AGWM73EZ.js";
24
29
  import "../__chunks/BMLNRUFQ.js";
25
- import "../__chunks/USCWE5QL.js";
26
- import "../__chunks/DIO64N2C.js";
27
- import "../__chunks/LDDPB3PY.js";
28
- import "../__chunks/6AJCHLAV.js";
29
30
  import "../__chunks/JQEVJM46.js";
30
31
  import "../__chunks/5ETIGB6O.js";
31
32
  import "../__chunks/ASYR66PQ.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Portal,
3
3
  usePortal
4
- } from "../__chunks/USCWE5QL.js";
4
+ } from "../__chunks/2CA5JWPW.js";
5
5
  import "../__chunks/DIO64N2C.js";
6
6
  import "../__chunks/LDDPB3PY.js";
7
7
  import "../__chunks/JQEVJM46.js";
@@ -3,11 +3,11 @@ import {
3
3
  } from "../__chunks/6I2PARRP.js";
4
4
  import {
5
5
  useComposite
6
- } from "../__chunks/OY5YT7OV.js";
6
+ } from "../__chunks/RTOWJJVI.js";
7
7
  import "../__chunks/OXPV2NBK.js";
8
+ import "../__chunks/Z3X3QN6P.js";
8
9
  import "../__chunks/AGWM73EZ.js";
9
10
  import "../__chunks/BMLNRUFQ.js";
10
- import "../__chunks/Z3X3QN6P.js";
11
11
  import {
12
12
  createComponent,
13
13
  createElement,
@@ -8,9 +8,9 @@ import "../__chunks/4QNHBDVS.js";
8
8
  import "../__chunks/X7UZWWYG.js";
9
9
  import "../__chunks/T3DJZG63.js";
10
10
  import "../__chunks/OXPV2NBK.js";
11
+ import "../__chunks/Z3X3QN6P.js";
11
12
  import "../__chunks/AGWM73EZ.js";
12
13
  import "../__chunks/BMLNRUFQ.js";
13
- import "../__chunks/Z3X3QN6P.js";
14
14
  import "../__chunks/5ETIGB6O.js";
15
15
  import "../__chunks/AV5WE37O.js";
16
16
  import "../__chunks/ASYR66PQ.js";
package/esm/role/role.js CHANGED
@@ -1,20 +1,9 @@
1
1
  import {
2
- createComponent,
3
- createElement,
4
- createHook
5
- } from "../__chunks/5ETIGB6O.js";
2
+ Role,
3
+ useRole
4
+ } from "../__chunks/XIACQCPS.js";
5
+ import "../__chunks/5ETIGB6O.js";
6
6
  import "../__chunks/4BKCJXBM.js";
7
-
8
- // src/role/role.ts
9
- var useRole = createHook((props) => {
10
- return props;
11
- });
12
- var Role = createComponent((props) => {
13
- return createElement("div", props);
14
- });
15
- if (process.env.NODE_ENV !== "production") {
16
- Role.displayName = "Role";
17
- }
18
7
  export {
19
8
  Role,
20
9
  useRole
@@ -12,9 +12,9 @@ import "../__chunks/4QNHBDVS.js";
12
12
  import "../__chunks/X7UZWWYG.js";
13
13
  import "../__chunks/T3DJZG63.js";
14
14
  import "../__chunks/OXPV2NBK.js";
15
+ import "../__chunks/Z3X3QN6P.js";
15
16
  import "../__chunks/AGWM73EZ.js";
16
17
  import "../__chunks/BMLNRUFQ.js";
17
- import "../__chunks/Z3X3QN6P.js";
18
18
  import {
19
19
  createElement,
20
20
  createHook,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  SelectList,
3
3
  useSelectList
4
- } from "../__chunks/PZK3B6LX.js";
4
+ } from "../__chunks/776K5FXB.js";
5
5
  import "../__chunks/KSVEVAMH.js";
6
6
  import "../__chunks/EEVSGAZW.js";
7
- import "../__chunks/OY5YT7OV.js";
7
+ import "../__chunks/RTOWJJVI.js";
8
8
  import "../__chunks/OXPV2NBK.js";
9
+ import "../__chunks/Z3X3QN6P.js";
9
10
  import "../__chunks/AGWM73EZ.js";
10
11
  import "../__chunks/BMLNRUFQ.js";
11
- import "../__chunks/Z3X3QN6P.js";
12
12
  import "../__chunks/5ETIGB6O.js";
13
13
  import "../__chunks/ASYR66PQ.js";
14
14
  import "../__chunks/SXC6BPOF.js";
@@ -1,8 +1,16 @@
1
+ import {
2
+ useSelectList
3
+ } from "../__chunks/776K5FXB.js";
4
+ import "../__chunks/KSVEVAMH.js";
5
+ import "../__chunks/EEVSGAZW.js";
6
+ import "../__chunks/RTOWJJVI.js";
7
+ import "../__chunks/OXPV2NBK.js";
8
+ import "../__chunks/Z3X3QN6P.js";
1
9
  import {
2
10
  usePopover
3
- } from "../__chunks/JJHXFKMC.js";
4
- import "../__chunks/EMZ4NQG4.js";
5
- import "../__chunks/ZFMAA4DD.js";
11
+ } from "../__chunks/MLEIJKSM.js";
12
+ import "../__chunks/NAG6UD2X.js";
13
+ import "../__chunks/MR75RQGW.js";
6
14
  import "../__chunks/4H6H5RRM.js";
7
15
  import "../__chunks/7A3SODQV.js";
8
16
  import "../__chunks/RBUEJWRA.js";
@@ -16,23 +24,16 @@ import "../__chunks/6WVG5KFF.js";
16
24
  import "../__chunks/ISPCL6N4.js";
17
25
  import "../__chunks/7JNF6I52.js";
18
26
  import "../__chunks/6OMX4H3W.js";
27
+ import "../__chunks/2CA5JWPW.js";
28
+ import "../__chunks/DIO64N2C.js";
29
+ import "../__chunks/LDDPB3PY.js";
19
30
  import "../__chunks/COQHFAEN.js";
20
31
  import "../__chunks/LNHZLQEK.js";
21
- import {
22
- useSelectList
23
- } from "../__chunks/PZK3B6LX.js";
24
- import "../__chunks/KSVEVAMH.js";
25
- import "../__chunks/EEVSGAZW.js";
32
+ import "../__chunks/XIACQCPS.js";
33
+ import "../__chunks/6AJCHLAV.js";
26
34
  import "../__chunks/6GS36SYX.js";
27
- import "../__chunks/OY5YT7OV.js";
28
- import "../__chunks/OXPV2NBK.js";
29
35
  import "../__chunks/AGWM73EZ.js";
30
36
  import "../__chunks/BMLNRUFQ.js";
31
- import "../__chunks/Z3X3QN6P.js";
32
- import "../__chunks/USCWE5QL.js";
33
- import "../__chunks/DIO64N2C.js";
34
- import "../__chunks/LDDPB3PY.js";
35
- import "../__chunks/6AJCHLAV.js";
36
37
  import "../__chunks/JQEVJM46.js";
37
38
  import {
38
39
  createComponent,
@@ -6,13 +6,6 @@ import type { Store } from "../utils/store.js";
6
6
  type Item = Core.SelectStoreItem;
7
7
  type Value = Core.SelectStoreValue;
8
8
  export declare function useSelectStoreOptions<T extends Value = Value>(props: SelectStoreProps<T>): {
9
- getAnchorRect: ((anchor: HTMLElement | null) => {
10
- x?: number | undefined;
11
- y?: number | undefined;
12
- width?: number | undefined;
13
- height?: number | undefined;
14
- } | null) | undefined;
15
- renderCallback: ((props: import("@ariakit/core/popover/popover-store").PopoverStoreRenderCallbackProps) => void | (() => void)) | undefined;
16
9
  setOpen?: ((open: boolean) => void) | undefined;
17
10
  defaultOpen?: boolean | undefined;
18
11
  open?: boolean | undefined;
@@ -6,7 +6,7 @@ import "../__chunks/MEYEPL2D.js";
6
6
  import {
7
7
  usePopoverStoreOptions,
8
8
  usePopoverStoreProps
9
- } from "../__chunks/SHGWT5HV.js";
9
+ } from "../__chunks/5PIH3SMS.js";
10
10
  import "../__chunks/OBNQHP6V.js";
11
11
  import "../__chunks/HN4VMOUI.js";
12
12
  import {
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  usePopoverDisclosure
3
- } from "../__chunks/6O3TZMB4.js";
3
+ } from "../__chunks/U2KSDJ3W.js";
4
4
  import "../__chunks/LSTZ5Q72.js";
5
5
  import "../__chunks/24P2K6AU.js";
6
+ import "../__chunks/D6NPK2DL.js";
6
7
  import "../__chunks/OQUXG6FE.js";
7
8
  import {
8
9
  SelectArrow
@@ -14,13 +15,12 @@ import {
14
15
  import {
15
16
  SelectContext
16
17
  } from "../__chunks/EEVSGAZW.js";
17
- import "../__chunks/6GS36SYX.js";
18
- import "../__chunks/D6NPK2DL.js";
19
18
  import "../__chunks/4QNHBDVS.js";
20
19
  import "../__chunks/OXPV2NBK.js";
20
+ import "../__chunks/Z3X3QN6P.js";
21
+ import "../__chunks/6GS36SYX.js";
21
22
  import "../__chunks/AGWM73EZ.js";
22
23
  import "../__chunks/BMLNRUFQ.js";
23
- import "../__chunks/Z3X3QN6P.js";
24
24
  import {
25
25
  VisuallyHidden
26
26
  } from "../__chunks/JQEVJM46.js";
@@ -3,11 +3,11 @@ import {
3
3
  } from "../__chunks/UZKBEGMB.js";
4
4
  import {
5
5
  useComposite
6
- } from "../__chunks/OY5YT7OV.js";
6
+ } from "../__chunks/RTOWJJVI.js";
7
7
  import "../__chunks/OXPV2NBK.js";
8
+ import "../__chunks/Z3X3QN6P.js";
8
9
  import "../__chunks/AGWM73EZ.js";
9
10
  import "../__chunks/BMLNRUFQ.js";
10
- import "../__chunks/Z3X3QN6P.js";
11
11
  import {
12
12
  createComponent,
13
13
  createElement,
@@ -2,13 +2,13 @@ import {
2
2
  useCollectionItem
3
3
  } from "../__chunks/X7UZWWYG.js";
4
4
  import "../__chunks/T3DJZG63.js";
5
+ import {
6
+ useDisclosureContent
7
+ } from "../__chunks/6AJCHLAV.js";
5
8
  import {
6
9
  useFocusable
7
10
  } from "../__chunks/AGWM73EZ.js";
8
11
  import "../__chunks/BMLNRUFQ.js";
9
- import {
10
- useDisclosureContent
11
- } from "../__chunks/6AJCHLAV.js";
12
12
  import {
13
13
  createComponent,
14
14
  createElement,
package/esm/tab/tab.js CHANGED
@@ -8,9 +8,9 @@ import "../__chunks/4QNHBDVS.js";
8
8
  import "../__chunks/X7UZWWYG.js";
9
9
  import "../__chunks/T3DJZG63.js";
10
10
  import "../__chunks/OXPV2NBK.js";
11
+ import "../__chunks/Z3X3QN6P.js";
11
12
  import "../__chunks/AGWM73EZ.js";
12
13
  import "../__chunks/BMLNRUFQ.js";
13
- import "../__chunks/Z3X3QN6P.js";
14
14
  import {
15
15
  createElement,
16
16
  createHook,
@@ -9,9 +9,9 @@ import "../__chunks/4QNHBDVS.js";
9
9
  import "../__chunks/X7UZWWYG.js";
10
10
  import "../__chunks/T3DJZG63.js";
11
11
  import "../__chunks/OXPV2NBK.js";
12
+ import "../__chunks/Z3X3QN6P.js";
12
13
  import "../__chunks/AGWM73EZ.js";
13
14
  import "../__chunks/BMLNRUFQ.js";
14
- import "../__chunks/Z3X3QN6P.js";
15
15
  import {
16
16
  createElement,
17
17
  createHook,
@@ -9,9 +9,9 @@ import "../__chunks/4QNHBDVS.js";
9
9
  import "../__chunks/X7UZWWYG.js";
10
10
  import "../__chunks/T3DJZG63.js";
11
11
  import "../__chunks/OXPV2NBK.js";
12
+ import "../__chunks/Z3X3QN6P.js";
12
13
  import "../__chunks/AGWM73EZ.js";
13
14
  import "../__chunks/BMLNRUFQ.js";
14
- import "../__chunks/Z3X3QN6P.js";
15
15
  import {
16
16
  createElement,
17
17
  createHook,
@@ -7,9 +7,9 @@ import "../__chunks/4QNHBDVS.js";
7
7
  import "../__chunks/X7UZWWYG.js";
8
8
  import "../__chunks/T3DJZG63.js";
9
9
  import "../__chunks/OXPV2NBK.js";
10
+ import "../__chunks/Z3X3QN6P.js";
10
11
  import "../__chunks/AGWM73EZ.js";
11
12
  import "../__chunks/BMLNRUFQ.js";
12
- import "../__chunks/Z3X3QN6P.js";
13
13
  import "../__chunks/5ETIGB6O.js";
14
14
  import "../__chunks/AV5WE37O.js";
15
15
  import "../__chunks/ASYR66PQ.js";
@@ -3,11 +3,11 @@ import {
3
3
  } from "../__chunks/DFUIIKXE.js";
4
4
  import {
5
5
  useComposite
6
- } from "../__chunks/OY5YT7OV.js";
6
+ } from "../__chunks/RTOWJJVI.js";
7
7
  import "../__chunks/OXPV2NBK.js";
8
+ import "../__chunks/Z3X3QN6P.js";
8
9
  import "../__chunks/AGWM73EZ.js";
9
10
  import "../__chunks/BMLNRUFQ.js";
10
- import "../__chunks/Z3X3QN6P.js";
11
11
  import {
12
12
  createComponent,
13
13
  createElement,
@@ -1,4 +1,4 @@
1
- import type { PopoverAnchorOptions } from "../popover/popover-anchor.js";
1
+ import type { HovercardAnchorOptions } from "../hovercard/hovercard-anchor.js";
2
2
  import type { As, Props } from "../utils/types.js";
3
3
  import type { TooltipStore } from "./tooltip-store.js";
4
4
  /**
@@ -26,26 +26,10 @@ export declare const useTooltipAnchor: import("../utils/types.js").Hook<TooltipA
26
26
  * ```
27
27
  */
28
28
  export declare const TooltipAnchor: import("../utils/types.js").Component<TooltipAnchorOptions<"div">>;
29
- export interface TooltipAnchorOptions<T extends As = "div"> extends PopoverAnchorOptions<T> {
29
+ export interface TooltipAnchorOptions<T extends As = "div"> extends HovercardAnchorOptions<T> {
30
30
  /**
31
31
  * Object returned by the `useTooltipStore` hook.
32
32
  */
33
33
  store: TooltipStore;
34
- /**
35
- * Determines wether the tooltip anchor is described or labelled by the
36
- * tooltip. If `true`, the tooltip id will be set as the `aria-describedby`
37
- * attribute on the anchor element, and not as the `aria-labelledby`
38
- * attribute.
39
- * @default false
40
- * @example
41
- * ```jsx
42
- * const tooltip = useTooltipStore();
43
- * <TooltipAnchor store={tooltip} described>
44
- * This is an element with a visible label.
45
- * </TooltipAnchor>
46
- * <Tooltip store={tooltip}>Description</Tooltip>
47
- * ```
48
- */
49
- described?: boolean;
50
34
  }
51
35
  export type TooltipAnchorProps<T extends As = "div"> = Props<TooltipAnchorOptions<T>>;
@@ -1,6 +1,8 @@
1
1
  import {
2
- usePopoverAnchor
3
- } from "../__chunks/D6NPK2DL.js";
2
+ useHovercardAnchor
3
+ } from "../__chunks/65MJJ4BW.js";
4
+ import "../__chunks/AGWM73EZ.js";
5
+ import "../__chunks/BMLNRUFQ.js";
4
6
  import {
5
7
  createComponent,
6
8
  createElement,
@@ -17,12 +19,39 @@ import {
17
19
  } from "../__chunks/4BKCJXBM.js";
18
20
 
19
21
  // src/tooltip/tooltip-anchor.ts
22
+ import { useEffect } from "react";
23
+ import { isFalsyBooleanCallback } from "@ariakit/core/utils/misc";
24
+ import { createStore } from "@ariakit/core/utils/store";
25
+ var globalStore = createStore({
26
+ activeStore: null
27
+ });
20
28
  var useTooltipAnchor = createHook(
21
29
  (_a) => {
22
- var _b = _a, { store, described } = _b, props = __objRest(_b, ["store", "described"]);
23
- const onFocusProp = props.onFocus;
24
- const onFocus = useEvent((event) => {
25
- onFocusProp == null ? void 0 : onFocusProp(event);
30
+ var _b = _a, { store, showOnHover = true } = _b, props = __objRest(_b, ["store", "showOnHover"]);
31
+ useEffect(() => {
32
+ return store.sync(
33
+ (state) => {
34
+ if (state.mounted) {
35
+ const { activeStore } = globalStore.getState();
36
+ if (activeStore !== store) {
37
+ activeStore == null ? void 0 : activeStore.hide();
38
+ }
39
+ return globalStore.setState("activeStore", store);
40
+ }
41
+ const id = setTimeout(() => {
42
+ const { activeStore } = globalStore.getState();
43
+ if (activeStore !== store)
44
+ return;
45
+ globalStore.setState("activeStore", null);
46
+ }, state.skipTimeout);
47
+ return () => clearTimeout(id);
48
+ },
49
+ ["mounted", "skipTimeout"]
50
+ );
51
+ }, [store]);
52
+ const onFocusVisibleProp = props.onFocusVisible;
53
+ const onFocusVisible = useEvent((event) => {
54
+ onFocusVisibleProp == null ? void 0 : onFocusVisibleProp(event);
26
55
  if (event.defaultPrevented)
27
56
  return;
28
57
  store.setAnchorElement(event.currentTarget);
@@ -33,35 +62,36 @@ var useTooltipAnchor = createHook(
33
62
  onBlurProp == null ? void 0 : onBlurProp(event);
34
63
  if (event.defaultPrevented)
35
64
  return;
36
- store.hide();
37
- });
38
- const onMouseEnterProp = props.onMouseEnter;
39
- const onMouseEnter = useEvent((event) => {
40
- onMouseEnterProp == null ? void 0 : onMouseEnterProp(event);
41
- if (event.defaultPrevented)
42
- return;
43
- store.setAnchorElement(event.currentTarget);
44
- store.show();
65
+ const { activeStore } = globalStore.getState();
66
+ if (activeStore === store) {
67
+ globalStore.setState("activeStore", null);
68
+ }
45
69
  });
46
- const onMouseLeaveProp = props.onMouseLeave;
47
- const onMouseLeave = useEvent((event) => {
48
- onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event);
49
- if (event.defaultPrevented)
50
- return;
51
- store.hide();
70
+ const type = store.useState("type");
71
+ const contentId = store.useState((state) => {
72
+ var _a2;
73
+ return (_a2 = state.contentElement) == null ? void 0 : _a2.id;
52
74
  });
53
- const contentElement = store.useState("contentElement");
54
75
  props = __spreadProps(__spreadValues({
55
76
  tabIndex: 0,
56
- "aria-labelledby": !described ? contentElement == null ? void 0 : contentElement.id : void 0,
57
- "aria-describedby": described ? contentElement == null ? void 0 : contentElement.id : void 0
77
+ "aria-labelledby": type === "label" ? contentId : void 0,
78
+ "aria-describedby": type === "description" ? contentId : void 0
58
79
  }, props), {
59
- onFocus,
60
- onBlur,
61
- onMouseEnter,
62
- onMouseLeave
80
+ onFocusVisible,
81
+ onBlur
63
82
  });
64
- props = usePopoverAnchor(__spreadValues({ store }, props));
83
+ props = useHovercardAnchor(__spreadValues({
84
+ store,
85
+ showOnHover: (event) => {
86
+ if (isFalsyBooleanCallback(showOnHover, event))
87
+ return false;
88
+ const { activeStore } = globalStore.getState();
89
+ if (!activeStore)
90
+ return true;
91
+ store.show();
92
+ return false;
93
+ }
94
+ }, props));
65
95
  return props;
66
96
  }
67
97
  );