@ariakit/react-core 0.3.7 → 0.3.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 (117) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/cjs/__chunks/{VEG6PRAG.cjs → 3WCBE6SU.cjs} +3 -1
  3. package/cjs/__chunks/{CILQPSH2.cjs → FA25CV2I.cjs} +2 -2
  4. package/cjs/__chunks/{AYDXWQBF.cjs → L3WS5HGI.cjs} +2 -0
  5. package/cjs/__chunks/{QU2266CJ.cjs → WH4I6OSN.cjs} +12 -4
  6. package/cjs/__chunks/{LVOI2KVN.cjs → XGKLTARH.cjs} +2 -2
  7. package/cjs/checkbox/checkbox-provider.cjs +2 -2
  8. package/cjs/combobox/combobox-cancel.cjs +2 -2
  9. package/cjs/combobox/combobox-context.cjs +4 -2
  10. package/cjs/combobox/combobox-context.d.cts +6 -5
  11. package/cjs/combobox/combobox-context.d.ts +6 -5
  12. package/cjs/combobox/combobox-disclosure.cjs +2 -2
  13. package/cjs/combobox/combobox-item-check.cjs +50 -0
  14. package/cjs/combobox/combobox-item-check.d.cts +60 -0
  15. package/cjs/combobox/combobox-item-check.d.ts +60 -0
  16. package/cjs/combobox/combobox-item-value.cjs +3 -3
  17. package/cjs/combobox/combobox-item.cjs +45 -8
  18. package/cjs/combobox/combobox-item.d.cts +31 -13
  19. package/cjs/combobox/combobox-item.d.ts +31 -13
  20. package/cjs/combobox/combobox-label.cjs +55 -0
  21. package/cjs/combobox/combobox-label.d.cts +42 -0
  22. package/cjs/combobox/combobox-label.d.ts +42 -0
  23. package/cjs/combobox/combobox-list.cjs +3 -3
  24. package/cjs/combobox/combobox-popover.cjs +5 -5
  25. package/cjs/combobox/combobox-provider.cjs +4 -4
  26. package/cjs/combobox/combobox-provider.d.cts +8 -4
  27. package/cjs/combobox/combobox-provider.d.ts +8 -4
  28. package/cjs/combobox/combobox-row.cjs +2 -2
  29. package/cjs/combobox/combobox-separator.cjs +2 -2
  30. package/cjs/combobox/combobox-store.cjs +2 -2
  31. package/cjs/combobox/combobox-store.d.cts +26 -8
  32. package/cjs/combobox/combobox-store.d.ts +26 -8
  33. package/cjs/combobox/combobox.cjs +22 -12
  34. package/cjs/composite/composite-hover.d.cts +3 -0
  35. package/cjs/composite/composite-hover.d.ts +3 -0
  36. package/cjs/composite/composite-item.d.cts +3 -0
  37. package/cjs/composite/composite-item.d.ts +3 -0
  38. package/cjs/disclosure/disclosure-content.d.cts +1 -0
  39. package/cjs/disclosure/disclosure-content.d.ts +1 -0
  40. package/cjs/disclosure/disclosure.d.cts +3 -0
  41. package/cjs/disclosure/disclosure.d.ts +3 -0
  42. package/cjs/focusable/focusable.d.cts +1 -0
  43. package/cjs/focusable/focusable.d.ts +1 -0
  44. package/cjs/form/form-checkbox.cjs +1 -1
  45. package/cjs/hovercard/hovercard-anchor.d.cts +3 -0
  46. package/cjs/hovercard/hovercard-anchor.d.ts +3 -0
  47. package/cjs/menu/menu-item-checkbox.cjs +1 -1
  48. package/cjs/menu/menu-provider.cjs +3 -3
  49. package/cjs/menu/menu-store.cjs +3 -3
  50. package/cjs/menu/menu-store.d.cts +5 -11
  51. package/cjs/menu/menu-store.d.ts +5 -11
  52. package/cjs/popover/popover.d.cts +4 -0
  53. package/cjs/popover/popover.d.ts +4 -0
  54. package/cjs/portal/portal.d.cts +3 -0
  55. package/cjs/portal/portal.d.ts +3 -0
  56. package/cjs/select/select-item.cjs +3 -3
  57. package/cjs/select/select-label.cjs +1 -1
  58. package/cjs/select/select-provider.cjs +3 -3
  59. package/cjs/select/select-store.cjs +3 -3
  60. package/cjs/select/select-store.d.cts +1 -7
  61. package/cjs/select/select-store.d.ts +1 -7
  62. package/combobox/combobox-item-check/package.json +8 -0
  63. package/combobox/combobox-label/package.json +8 -0
  64. package/esm/__chunks/{KFUKDUTY.js → 4AMOOZBQ.js} +10 -2
  65. package/esm/__chunks/{PHTJ3BCW.js → 7HYEBVZE.js} +1 -1
  66. package/esm/__chunks/{NE6JAKK6.js → P3UZS6BC.js} +1 -1
  67. package/esm/__chunks/{MTC2KUZZ.js → W76OTZCC.js} +3 -1
  68. package/esm/__chunks/{24AKC2LC.js → ZETMAOTK.js} +2 -0
  69. package/esm/checkbox/checkbox-provider.js +3 -3
  70. package/esm/combobox/combobox-cancel.js +1 -1
  71. package/esm/combobox/combobox-context.d.ts +6 -5
  72. package/esm/combobox/combobox-context.js +3 -1
  73. package/esm/combobox/combobox-disclosure.js +1 -1
  74. package/esm/combobox/combobox-item-check.d.ts +60 -0
  75. package/esm/combobox/combobox-item-check.js +50 -0
  76. package/esm/combobox/combobox-item-value.js +1 -1
  77. package/esm/combobox/combobox-item.d.ts +31 -13
  78. package/esm/combobox/combobox-item.js +44 -7
  79. package/esm/combobox/combobox-label.d.ts +42 -0
  80. package/esm/combobox/combobox-label.js +55 -0
  81. package/esm/combobox/combobox-list.js +2 -2
  82. package/esm/combobox/combobox-popover.js +2 -2
  83. package/esm/combobox/combobox-provider.d.ts +8 -4
  84. package/esm/combobox/combobox-provider.js +2 -2
  85. package/esm/combobox/combobox-row.js +1 -1
  86. package/esm/combobox/combobox-separator.js +1 -1
  87. package/esm/combobox/combobox-store.d.ts +26 -8
  88. package/esm/combobox/combobox-store.js +1 -1
  89. package/esm/combobox/combobox.js +21 -11
  90. package/esm/composite/composite-hover.d.ts +3 -0
  91. package/esm/composite/composite-item.d.ts +3 -0
  92. package/esm/disclosure/disclosure-content.d.ts +1 -0
  93. package/esm/disclosure/disclosure.d.ts +3 -0
  94. package/esm/focusable/focusable.d.ts +1 -0
  95. package/esm/form/form-checkbox.js +1 -1
  96. package/esm/hovercard/hovercard-anchor.d.ts +3 -0
  97. package/esm/menu/menu-item-checkbox.js +1 -1
  98. package/esm/menu/menu-provider.js +2 -2
  99. package/esm/menu/menu-store.d.ts +5 -11
  100. package/esm/menu/menu-store.js +2 -2
  101. package/esm/popover/popover.d.ts +4 -0
  102. package/esm/portal/portal.d.ts +3 -0
  103. package/esm/select/select-item.js +3 -3
  104. package/esm/select/select-label.js +2 -2
  105. package/esm/select/select-provider.js +2 -2
  106. package/esm/select/select-store.d.ts +1 -7
  107. package/esm/select/select-store.js +2 -2
  108. package/package.json +16 -2
  109. package/cjs/collection/collection-context.d.cts +0 -34
  110. package/cjs/collection/collection-context.d.ts +0 -34
  111. package/cjs/composite/utils.d.cts +0 -69
  112. package/cjs/composite/utils.d.ts +0 -69
  113. package/cjs/tab/tab-store.d.cts +0 -74
  114. package/cjs/tab/tab-store.d.ts +0 -74
  115. package/esm/collection/collection-context.d.ts +0 -34
  116. package/esm/composite/utils.d.ts +0 -69
  117. package/esm/tab/tab-store.d.ts +0 -74
@@ -7,18 +7,12 @@ import type { MenubarStore } from "../menubar/menubar-store.js";
7
7
  import type { Store } from "../utils/store.js";
8
8
  type Values = Core.MenuStoreValues;
9
9
  export declare function useMenuStoreProps<T extends Core.MenuStore>(store: T, update: () => void, props: MenuStoreProps): T & {
10
- combobox: (import("../combobox/combobox-store.js").ComboboxStoreFunctions & import("@ariakit/core/combobox/combobox-store").ComboboxStoreFunctions & import("@ariakit/core/utils/store").Store<import("@ariakit/core/combobox/combobox-store").ComboboxStoreState> & {
11
- useState: {
12
- (): import("@ariakit/core/combobox/combobox-store").ComboboxStoreState;
13
- <K extends keyof import("@ariakit/core/combobox/combobox-store").ComboboxStoreState>(key: K): import("@ariakit/core/combobox/combobox-store").ComboboxStoreState[K];
14
- <V>(selector: (state: import("@ariakit/core/combobox/combobox-store").ComboboxStoreState) => V): V;
15
- };
16
- }) | null | undefined;
10
+ combobox: (ComboboxStore<string | string[]> & import("@ariakit/core/combobox/combobox-store").ComboboxStore<string | string[]>) | null | undefined;
17
11
  parent: (MenuStoreFunctions<Core.MenuStoreValues> & Core.MenuStoreFunctions<Core.MenuStoreValues> & import("@ariakit/core/utils/store").Store<Core.MenuStoreState<Core.MenuStoreValues>> & {
18
12
  useState: {
19
13
  (): Core.MenuStoreState<Core.MenuStoreValues>;
20
- <K_1 extends keyof Core.MenuStoreState<Core.MenuStoreValues>>(key: K_1): Core.MenuStoreState<Core.MenuStoreValues>[K_1];
21
- <V_1>(selector: (state: Core.MenuStoreState<Core.MenuStoreValues>) => V_1): V_1;
14
+ <K extends keyof Core.MenuStoreState<Core.MenuStoreValues>>(key: K): Core.MenuStoreState<Core.MenuStoreValues>[K];
15
+ <V>(selector: (state: Core.MenuStoreState<Core.MenuStoreValues>) => V): V;
22
16
  };
23
17
  } & Core.MenuStoreFunctions<{
24
18
  [x: string]: string | number | boolean | (string | number)[];
@@ -28,8 +22,8 @@ export declare function useMenuStoreProps<T extends Core.MenuStore>(store: T, up
28
22
  menubar: (import("../menubar/menubar-store.js").MenubarStoreFunctions & import("@ariakit/core/menubar/menubar-store").MenubarStore & {
29
23
  useState: {
30
24
  (): import("@ariakit/core/menubar/menubar-store").MenubarStoreState;
31
- <K_2 extends keyof import("@ariakit/core/menubar/menubar-store").MenubarStoreState>(key: K_2): import("@ariakit/core/menubar/menubar-store").MenubarStoreState[K_2];
32
- <V_2>(selector: (state: import("@ariakit/core/menubar/menubar-store").MenubarStoreState) => V_2): V_2;
25
+ <K_1 extends keyof import("@ariakit/core/menubar/menubar-store").MenubarStoreState>(key: K_1): import("@ariakit/core/menubar/menubar-store").MenubarStoreState[K_1];
26
+ <V_1>(selector: (state: import("@ariakit/core/menubar/menubar-store").MenubarStoreState) => V_1): V_1;
33
27
  };
34
28
  }) | null | undefined;
35
29
  };
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  useMenuStore,
4
4
  useMenuStoreProps
5
- } from "../__chunks/PHTJ3BCW.js";
5
+ } from "../__chunks/7HYEBVZE.js";
6
6
  import "../__chunks/YGMEBI3A.js";
7
7
  import "../__chunks/KA4GX64Z.js";
8
- import "../__chunks/MTC2KUZZ.js";
8
+ import "../__chunks/W76OTZCC.js";
9
9
  import "../__chunks/ELWRSPQ7.js";
10
10
  import "../__chunks/5A2VZUUV.js";
11
11
  import "../__chunks/IB7YUKH5.js";
@@ -43,6 +43,9 @@ export interface PopoverOptions<T extends As = "div"> extends DialogOptions<T> {
43
43
  /**
44
44
  * Props that will be passed to the popover wrapper element. This element will
45
45
  * be used to position the popover.
46
+ *
47
+ * Live examples:
48
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
46
49
  */
47
50
  wrapperProps?: HTMLAttributes<HTMLDivElement>;
48
51
  /**
@@ -68,6 +71,7 @@ export interface PopoverOptions<T extends As = "div"> extends DialogOptions<T> {
68
71
  * negative values to make the popover shift to the opposite side.
69
72
  *
70
73
  * Live examples:
74
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
71
75
  * - [Submenu](https://ariakit.org/examples/menu-nested)
72
76
  * - [Menubar](https://ariakit.org/components/menubar)
73
77
  * @default 0
@@ -98,6 +98,9 @@ export interface PortalOptions<T extends As = "div"> extends Options<T> {
98
98
  * An HTML element or a memoized callback function that returns an HTML
99
99
  * element to be used as the portal element. By default, the portal element
100
100
  * will be a `div` element appended to the `document.body`.
101
+ *
102
+ * Live examples:
103
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
101
104
  * @example
102
105
  * ```jsx
103
106
  * const [portal, setPortal] = useState(null);
@@ -45,9 +45,9 @@ import { isDownloading, isOpeningInNewTab } from "@ariakit/core/utils/events";
45
45
  import { disabledFromProps, invariant } from "@ariakit/core/utils/misc";
46
46
  import { jsx } from "react/jsx-runtime";
47
47
  function isSelected(storeValue, itemValue) {
48
- if (storeValue == null)
49
- return false;
50
48
  if (itemValue == null)
49
+ return;
50
+ if (storeValue == null)
51
51
  return false;
52
52
  if (Array.isArray(storeValue)) {
53
53
  return storeValue.includes(itemValue);
@@ -127,7 +127,7 @@ var useSelectItem = createHook(
127
127
  const selected = store.useState((state) => isSelected(state.value, value));
128
128
  props = useWrapElement(
129
129
  props,
130
- (element) => /* @__PURE__ */ jsx(SelectItemCheckedContext.Provider, { value: selected, children: element }),
130
+ (element) => /* @__PURE__ */ jsx(SelectItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }),
131
131
  [selected]
132
132
  );
133
133
  const contentElement = store.useState("contentElement");
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import {
3
- useSelectScopedContext
3
+ useSelectProviderContext
4
4
  } from "../__chunks/5HVNGX6D.js";
5
5
  import "../__chunks/IB7YUKH5.js";
6
6
  import "../__chunks/4UUKJZ4V.js";
@@ -29,7 +29,7 @@ import { invariant } from "@ariakit/core/utils/misc";
29
29
  var useSelectLabel = createHook(
30
30
  (_a) => {
31
31
  var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
32
- const context = useSelectScopedContext();
32
+ const context = useSelectProviderContext();
33
33
  store = store || context;
34
34
  invariant(
35
35
  store,
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  useSelectStore
4
- } from "../__chunks/NE6JAKK6.js";
5
- import "../__chunks/MTC2KUZZ.js";
4
+ } from "../__chunks/P3UZS6BC.js";
5
+ import "../__chunks/W76OTZCC.js";
6
6
  import {
7
7
  SelectContextProvider
8
8
  } from "../__chunks/5HVNGX6D.js";
@@ -7,13 +7,7 @@ import type { Store } from "../utils/store.js";
7
7
  type Item = Core.SelectStoreItem;
8
8
  type Value = Core.SelectStoreValue;
9
9
  export declare function useSelectStoreProps<T extends Core.SelectStore>(store: T, update: () => void, props: SelectStoreProps): T & {
10
- combobox: (import("../combobox/combobox-store.js").ComboboxStoreFunctions & import("@ariakit/core/combobox/combobox-store").ComboboxStoreFunctions & import("@ariakit/core/utils/store").Store<import("@ariakit/core/combobox/combobox-store").ComboboxStoreState> & {
11
- useState: {
12
- (): import("@ariakit/core/combobox/combobox-store").ComboboxStoreState;
13
- <K extends keyof import("@ariakit/core/combobox/combobox-store").ComboboxStoreState>(key: K): import("@ariakit/core/combobox/combobox-store").ComboboxStoreState[K];
14
- <V>(selector: (state: import("@ariakit/core/combobox/combobox-store").ComboboxStoreState) => V): V;
15
- };
16
- }) | null | undefined;
10
+ combobox: (ComboboxStore<string | string[]> & import("@ariakit/core/combobox/combobox-store").ComboboxStore<string | string[]>) | null | undefined;
17
11
  };
18
12
  /**
19
13
  * Creates a select store.
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  useSelectStore,
4
4
  useSelectStoreProps
5
- } from "../__chunks/NE6JAKK6.js";
6
- import "../__chunks/MTC2KUZZ.js";
5
+ } from "../__chunks/P3UZS6BC.js";
6
+ import "../__chunks/W76OTZCC.js";
7
7
  import "../__chunks/ELWRSPQ7.js";
8
8
  import "../__chunks/5A2VZUUV.js";
9
9
  import "../__chunks/IB7YUKH5.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariakit/react-core",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "Ariakit React core",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "core"
31
31
  ],
32
32
  "dependencies": {
33
- "@ariakit/core": "0.3.6",
33
+ "@ariakit/core": "0.3.7",
34
34
  "@floating-ui/dom": "^1.0.0",
35
35
  "use-sync-external-store": "^1.2.0"
36
36
  },
@@ -1320,6 +1320,13 @@
1320
1320
  "default": "./cjs/combobox/combobox-list.cjs"
1321
1321
  }
1322
1322
  },
1323
+ "./combobox/combobox-label": {
1324
+ "import": "./esm/combobox/combobox-label.js",
1325
+ "require": {
1326
+ "types": "./cjs/combobox/combobox-label.d.cts",
1327
+ "default": "./cjs/combobox/combobox-label.cjs"
1328
+ }
1329
+ },
1323
1330
  "./combobox/combobox-item": {
1324
1331
  "import": "./esm/combobox/combobox-item.js",
1325
1332
  "require": {
@@ -1334,6 +1341,13 @@
1334
1341
  "default": "./cjs/combobox/combobox-item-value.cjs"
1335
1342
  }
1336
1343
  },
1344
+ "./combobox/combobox-item-check": {
1345
+ "import": "./esm/combobox/combobox-item-check.js",
1346
+ "require": {
1347
+ "types": "./cjs/combobox/combobox-item-check.d.cts",
1348
+ "default": "./cjs/combobox/combobox-item-check.cjs"
1349
+ }
1350
+ },
1337
1351
  "./combobox/combobox-group": {
1338
1352
  "import": "./esm/combobox/combobox-group.js",
1339
1353
  "require": {
@@ -1,34 +0,0 @@
1
- import type { CollectionStore } from "./collection-store.js";
2
- /**
3
- * Returns the collection store from the nearest collection container.
4
- * @example
5
- * function CollectionItem() {
6
- * const store = useCollectionContext();
7
- *
8
- * if (!store) {
9
- * throw new Error("CollectionItem must be wrapped in CollectionProvider");
10
- * }
11
- *
12
- * // Use the store...
13
- * }
14
- */
15
- export declare const useCollectionContext: () => CollectionStore<{
16
- id: string;
17
- element?: HTMLElement | null | undefined;
18
- }> | undefined;
19
- export declare const useCollectionScopedContext: (onlyScoped?: boolean) => CollectionStore<{
20
- id: string;
21
- element?: HTMLElement | null | undefined;
22
- }> | undefined;
23
- export declare const useCollectionProviderContext: () => CollectionStore<{
24
- id: string;
25
- element?: HTMLElement | null | undefined;
26
- }> | undefined;
27
- export declare const CollectionContextProvider: (props: import("react").ProviderProps<CollectionStore<{
28
- id: string;
29
- element?: HTMLElement | null | undefined;
30
- }> | undefined>) => import("react/jsx-runtime").JSX.Element;
31
- export declare const CollectionScopedContextProvider: (props: import("react").ProviderProps<CollectionStore<{
32
- id: string;
33
- element?: HTMLElement | null | undefined;
34
- }> | undefined>) => import("react/jsx-runtime").JSX.Element;
@@ -1,34 +0,0 @@
1
- import type { CollectionStore } from "./collection-store.js";
2
- /**
3
- * Returns the collection store from the nearest collection container.
4
- * @example
5
- * function CollectionItem() {
6
- * const store = useCollectionContext();
7
- *
8
- * if (!store) {
9
- * throw new Error("CollectionItem must be wrapped in CollectionProvider");
10
- * }
11
- *
12
- * // Use the store...
13
- * }
14
- */
15
- export declare const useCollectionContext: () => CollectionStore<{
16
- id: string;
17
- element?: HTMLElement | null | undefined;
18
- }> | undefined;
19
- export declare const useCollectionScopedContext: (onlyScoped?: boolean) => CollectionStore<{
20
- id: string;
21
- element?: HTMLElement | null | undefined;
22
- }> | undefined;
23
- export declare const useCollectionProviderContext: () => CollectionStore<{
24
- id: string;
25
- element?: HTMLElement | null | undefined;
26
- }> | undefined;
27
- export declare const CollectionContextProvider: (props: import("react").ProviderProps<CollectionStore<{
28
- id: string;
29
- element?: HTMLElement | null | undefined;
30
- }> | undefined>) => import("react/jsx-runtime").JSX.Element;
31
- export declare const CollectionScopedContextProvider: (props: import("react").ProviderProps<CollectionStore<{
32
- id: string;
33
- element?: HTMLElement | null | undefined;
34
- }> | undefined>) => import("react/jsx-runtime").JSX.Element;
@@ -1,69 +0,0 @@
1
- import type { CompositeStore, CompositeStoreItem } from "./composite-store.js";
2
- /**
3
- * Moves all the items before the passed `id` to the end of the array. This is
4
- * useful when we want to loop through the items in the same row or column as
5
- * the first items will be placed after the last items.
6
- *
7
- * The null item that's inserted when `shouldInsertNullItem` is set to `true`
8
- * represents the composite container itself. When the active item is null, the
9
- * composite container has focus.
10
- */
11
- export declare function flipItems(items: CompositeStoreItem[], activeId: string, shouldInsertNullItem?: boolean): {
12
- id: string;
13
- }[];
14
- /**
15
- * Finds the first enabled item.
16
- */
17
- export declare function findFirstEnabledItem(items: CompositeStoreItem[], excludeId?: string): ({
18
- id: string;
19
- element?: HTMLElement | null | undefined;
20
- } & {
21
- rowId?: string | undefined;
22
- disabled?: boolean | undefined;
23
- children?: string | undefined;
24
- }) | undefined;
25
- /**
26
- * Finds the first enabled item by its id.
27
- */
28
- export declare function getEnabledItem(store: CompositeStore, id?: string | null): ({
29
- id: string;
30
- element?: HTMLElement | null | undefined;
31
- } & {
32
- rowId?: string | undefined;
33
- disabled?: boolean | undefined;
34
- children?: string | undefined;
35
- }) | null;
36
- /**
37
- * Creates a two-dimensional array with items grouped by their rowId's.
38
- */
39
- export declare function groupItemsByRows(items: CompositeStoreItem[]): ({
40
- id: string;
41
- element?: HTMLElement | null | undefined;
42
- } & {
43
- rowId?: string | undefined;
44
- disabled?: boolean | undefined;
45
- children?: string | undefined;
46
- })[][];
47
- /**
48
- * Selects text field contents even if it's a content editable element.
49
- */
50
- export declare function selectTextField(element: HTMLElement, collapseToEnd?: boolean): void;
51
- declare const FOCUS_SILENTLY: unique symbol;
52
- type FocusSilentlyElement = HTMLElement & {
53
- [FOCUS_SILENTLY]?: boolean;
54
- };
55
- /**
56
- * Focus an element with a flag. The `silentlyFocused` function needs to be
57
- * called later to check if the focus was silenced and to reset this state.
58
- */
59
- export declare function focusSilently(element: FocusSilentlyElement): void;
60
- /**
61
- * Checks whether the element has been focused with the `focusSilently` function
62
- * and resets the state.
63
- */
64
- export declare function silentlyFocused(element: FocusSilentlyElement): boolean | undefined;
65
- /**
66
- * Determines whether the element is a composite item.
67
- */
68
- export declare function isItem(store: CompositeStore, element?: Element | null, exclude?: Element): boolean;
69
- export {};
@@ -1,69 +0,0 @@
1
- import type { CompositeStore, CompositeStoreItem } from "./composite-store.js";
2
- /**
3
- * Moves all the items before the passed `id` to the end of the array. This is
4
- * useful when we want to loop through the items in the same row or column as
5
- * the first items will be placed after the last items.
6
- *
7
- * The null item that's inserted when `shouldInsertNullItem` is set to `true`
8
- * represents the composite container itself. When the active item is null, the
9
- * composite container has focus.
10
- */
11
- export declare function flipItems(items: CompositeStoreItem[], activeId: string, shouldInsertNullItem?: boolean): {
12
- id: string;
13
- }[];
14
- /**
15
- * Finds the first enabled item.
16
- */
17
- export declare function findFirstEnabledItem(items: CompositeStoreItem[], excludeId?: string): ({
18
- id: string;
19
- element?: HTMLElement | null | undefined;
20
- } & {
21
- rowId?: string | undefined;
22
- disabled?: boolean | undefined;
23
- children?: string | undefined;
24
- }) | undefined;
25
- /**
26
- * Finds the first enabled item by its id.
27
- */
28
- export declare function getEnabledItem(store: CompositeStore, id?: string | null): ({
29
- id: string;
30
- element?: HTMLElement | null | undefined;
31
- } & {
32
- rowId?: string | undefined;
33
- disabled?: boolean | undefined;
34
- children?: string | undefined;
35
- }) | null;
36
- /**
37
- * Creates a two-dimensional array with items grouped by their rowId's.
38
- */
39
- export declare function groupItemsByRows(items: CompositeStoreItem[]): ({
40
- id: string;
41
- element?: HTMLElement | null | undefined;
42
- } & {
43
- rowId?: string | undefined;
44
- disabled?: boolean | undefined;
45
- children?: string | undefined;
46
- })[][];
47
- /**
48
- * Selects text field contents even if it's a content editable element.
49
- */
50
- export declare function selectTextField(element: HTMLElement, collapseToEnd?: boolean): void;
51
- declare const FOCUS_SILENTLY: unique symbol;
52
- type FocusSilentlyElement = HTMLElement & {
53
- [FOCUS_SILENTLY]?: boolean;
54
- };
55
- /**
56
- * Focus an element with a flag. The `silentlyFocused` function needs to be
57
- * called later to check if the focus was silenced and to reset this state.
58
- */
59
- export declare function focusSilently(element: FocusSilentlyElement): void;
60
- /**
61
- * Checks whether the element has been focused with the `focusSilently` function
62
- * and resets the state.
63
- */
64
- export declare function silentlyFocused(element: FocusSilentlyElement): boolean | undefined;
65
- /**
66
- * Determines whether the element is a composite item.
67
- */
68
- export declare function isItem(store: CompositeStore, element?: Element | null, exclude?: Element): boolean;
69
- export {};
@@ -1,74 +0,0 @@
1
- import * as Core from "@ariakit/core/tab/tab-store";
2
- import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
3
- import type { Store } from "../utils/store.js";
4
- type Item = Core.TabStoreItem;
5
- export declare function useTabStoreProps<T extends Core.TabStore>(store: T, update: () => void, props: TabStoreProps): T & {
6
- panels: import("@ariakit/core/collection/collection-store").CollectionStoreFunctions<{
7
- id: string;
8
- element?: HTMLElement | null | undefined;
9
- } & {
10
- tabId?: string | null | undefined;
11
- }> & import("@ariakit/core/utils/store").Store<import("@ariakit/core/collection/collection-store").CollectionStoreState<{
12
- id: string;
13
- element?: HTMLElement | null | undefined;
14
- } & {
15
- tabId?: string | null | undefined;
16
- }>> & {
17
- useState: {
18
- (): import("@ariakit/core/collection/collection-store").CollectionStoreState<{
19
- id: string;
20
- element?: HTMLElement | null | undefined;
21
- } & {
22
- tabId?: string | null | undefined;
23
- }>;
24
- <K extends keyof import("@ariakit/core/collection/collection-store").CollectionStoreState<{
25
- id: string;
26
- element?: HTMLElement | null | undefined;
27
- } & {
28
- tabId?: string | null | undefined;
29
- }>>(key: K): import("@ariakit/core/collection/collection-store").CollectionStoreState<{
30
- id: string;
31
- element?: HTMLElement | null | undefined;
32
- } & {
33
- tabId?: string | null | undefined;
34
- }>[K];
35
- <V>(selector: (state: import("@ariakit/core/collection/collection-store").CollectionStoreState<{
36
- id: string;
37
- element?: HTMLElement | null | undefined;
38
- } & {
39
- tabId?: string | null | undefined;
40
- }>) => V): V;
41
- };
42
- };
43
- };
44
- /**
45
- * Creates a tab store.
46
- * @see https://ariakit.org/components/tab
47
- * @example
48
- * ```jsx
49
- * const tab = useTabStore();
50
- * <TabList store={tab}>
51
- * <Tab>Tab 1</Tab>
52
- * <Tab>Tab 2</Tab>
53
- * </TabList>
54
- * <TabPanel store={tab}>Panel 1</TabPanel>
55
- * <TabPanel store={tab}>Panel 2</TabPanel>
56
- * ```
57
- */
58
- export declare function useTabStore(props?: TabStoreProps): TabStore;
59
- export type TabStoreItem = Item;
60
- export interface TabStoreState extends Core.TabStoreState, CompositeStoreState<Item> {
61
- }
62
- export interface TabStoreFunctions extends Core.TabStoreFunctions, CompositeStoreFunctions<Item> {
63
- panels: Store<Core.TabStoreFunctions["panels"]>;
64
- }
65
- export interface TabStoreOptions extends Core.TabStoreOptions, CompositeStoreOptions<Item> {
66
- /**
67
- * Function that will be called when the `selectedId` state changes.
68
- * @param selectedId The new selected id.
69
- */
70
- setSelectedId?: (selectedId: TabStoreState["selectedId"]) => void;
71
- }
72
- export type TabStoreProps = TabStoreOptions & Core.TabStoreProps;
73
- export type TabStore = TabStoreFunctions & Store<Core.TabStore>;
74
- export {};
@@ -1,74 +0,0 @@
1
- import * as Core from "@ariakit/core/tab/tab-store";
2
- import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
3
- import type { Store } from "../utils/store.js";
4
- type Item = Core.TabStoreItem;
5
- export declare function useTabStoreProps<T extends Core.TabStore>(store: T, update: () => void, props: TabStoreProps): T & {
6
- panels: import("@ariakit/core/collection/collection-store").CollectionStoreFunctions<{
7
- id: string;
8
- element?: HTMLElement | null | undefined;
9
- } & {
10
- tabId?: string | null | undefined;
11
- }> & import("@ariakit/core/utils/store").Store<import("@ariakit/core/collection/collection-store").CollectionStoreState<{
12
- id: string;
13
- element?: HTMLElement | null | undefined;
14
- } & {
15
- tabId?: string | null | undefined;
16
- }>> & {
17
- useState: {
18
- (): import("@ariakit/core/collection/collection-store").CollectionStoreState<{
19
- id: string;
20
- element?: HTMLElement | null | undefined;
21
- } & {
22
- tabId?: string | null | undefined;
23
- }>;
24
- <K extends keyof import("@ariakit/core/collection/collection-store").CollectionStoreState<{
25
- id: string;
26
- element?: HTMLElement | null | undefined;
27
- } & {
28
- tabId?: string | null | undefined;
29
- }>>(key: K): import("@ariakit/core/collection/collection-store").CollectionStoreState<{
30
- id: string;
31
- element?: HTMLElement | null | undefined;
32
- } & {
33
- tabId?: string | null | undefined;
34
- }>[K];
35
- <V>(selector: (state: import("@ariakit/core/collection/collection-store").CollectionStoreState<{
36
- id: string;
37
- element?: HTMLElement | null | undefined;
38
- } & {
39
- tabId?: string | null | undefined;
40
- }>) => V): V;
41
- };
42
- };
43
- };
44
- /**
45
- * Creates a tab store.
46
- * @see https://ariakit.org/components/tab
47
- * @example
48
- * ```jsx
49
- * const tab = useTabStore();
50
- * <TabList store={tab}>
51
- * <Tab>Tab 1</Tab>
52
- * <Tab>Tab 2</Tab>
53
- * </TabList>
54
- * <TabPanel store={tab}>Panel 1</TabPanel>
55
- * <TabPanel store={tab}>Panel 2</TabPanel>
56
- * ```
57
- */
58
- export declare function useTabStore(props?: TabStoreProps): TabStore;
59
- export type TabStoreItem = Item;
60
- export interface TabStoreState extends Core.TabStoreState, CompositeStoreState<Item> {
61
- }
62
- export interface TabStoreFunctions extends Core.TabStoreFunctions, CompositeStoreFunctions<Item> {
63
- panels: Store<Core.TabStoreFunctions["panels"]>;
64
- }
65
- export interface TabStoreOptions extends Core.TabStoreOptions, CompositeStoreOptions<Item> {
66
- /**
67
- * Function that will be called when the `selectedId` state changes.
68
- * @param selectedId The new selected id.
69
- */
70
- setSelectedId?: (selectedId: TabStoreState["selectedId"]) => void;
71
- }
72
- export type TabStoreProps = TabStoreOptions & Core.TabStoreProps;
73
- export type TabStore = TabStoreFunctions & Store<Core.TabStore>;
74
- export {};
@@ -1,34 +0,0 @@
1
- import type { CollectionStore } from "./collection-store.js";
2
- /**
3
- * Returns the collection store from the nearest collection container.
4
- * @example
5
- * function CollectionItem() {
6
- * const store = useCollectionContext();
7
- *
8
- * if (!store) {
9
- * throw new Error("CollectionItem must be wrapped in CollectionProvider");
10
- * }
11
- *
12
- * // Use the store...
13
- * }
14
- */
15
- export declare const useCollectionContext: () => CollectionStore<{
16
- id: string;
17
- element?: HTMLElement | null | undefined;
18
- }> | undefined;
19
- export declare const useCollectionScopedContext: (onlyScoped?: boolean) => CollectionStore<{
20
- id: string;
21
- element?: HTMLElement | null | undefined;
22
- }> | undefined;
23
- export declare const useCollectionProviderContext: () => CollectionStore<{
24
- id: string;
25
- element?: HTMLElement | null | undefined;
26
- }> | undefined;
27
- export declare const CollectionContextProvider: (props: import("react").ProviderProps<CollectionStore<{
28
- id: string;
29
- element?: HTMLElement | null | undefined;
30
- }> | undefined>) => import("react/jsx-runtime").JSX.Element;
31
- export declare const CollectionScopedContextProvider: (props: import("react").ProviderProps<CollectionStore<{
32
- id: string;
33
- element?: HTMLElement | null | undefined;
34
- }> | undefined>) => import("react/jsx-runtime").JSX.Element;
@@ -1,69 +0,0 @@
1
- import type { CompositeStore, CompositeStoreItem } from "./composite-store.js";
2
- /**
3
- * Moves all the items before the passed `id` to the end of the array. This is
4
- * useful when we want to loop through the items in the same row or column as
5
- * the first items will be placed after the last items.
6
- *
7
- * The null item that's inserted when `shouldInsertNullItem` is set to `true`
8
- * represents the composite container itself. When the active item is null, the
9
- * composite container has focus.
10
- */
11
- export declare function flipItems(items: CompositeStoreItem[], activeId: string, shouldInsertNullItem?: boolean): {
12
- id: string;
13
- }[];
14
- /**
15
- * Finds the first enabled item.
16
- */
17
- export declare function findFirstEnabledItem(items: CompositeStoreItem[], excludeId?: string): ({
18
- id: string;
19
- element?: HTMLElement | null | undefined;
20
- } & {
21
- rowId?: string | undefined;
22
- disabled?: boolean | undefined;
23
- children?: string | undefined;
24
- }) | undefined;
25
- /**
26
- * Finds the first enabled item by its id.
27
- */
28
- export declare function getEnabledItem(store: CompositeStore, id?: string | null): ({
29
- id: string;
30
- element?: HTMLElement | null | undefined;
31
- } & {
32
- rowId?: string | undefined;
33
- disabled?: boolean | undefined;
34
- children?: string | undefined;
35
- }) | null;
36
- /**
37
- * Creates a two-dimensional array with items grouped by their rowId's.
38
- */
39
- export declare function groupItemsByRows(items: CompositeStoreItem[]): ({
40
- id: string;
41
- element?: HTMLElement | null | undefined;
42
- } & {
43
- rowId?: string | undefined;
44
- disabled?: boolean | undefined;
45
- children?: string | undefined;
46
- })[][];
47
- /**
48
- * Selects text field contents even if it's a content editable element.
49
- */
50
- export declare function selectTextField(element: HTMLElement, collapseToEnd?: boolean): void;
51
- declare const FOCUS_SILENTLY: unique symbol;
52
- type FocusSilentlyElement = HTMLElement & {
53
- [FOCUS_SILENTLY]?: boolean;
54
- };
55
- /**
56
- * Focus an element with a flag. The `silentlyFocused` function needs to be
57
- * called later to check if the focus was silenced and to reset this state.
58
- */
59
- export declare function focusSilently(element: FocusSilentlyElement): void;
60
- /**
61
- * Checks whether the element has been focused with the `focusSilently` function
62
- * and resets the state.
63
- */
64
- export declare function silentlyFocused(element: FocusSilentlyElement): boolean | undefined;
65
- /**
66
- * Determines whether the element is a composite item.
67
- */
68
- export declare function isItem(store: CompositeStore, element?: Element | null, exclude?: Element): boolean;
69
- export {};