fix: prevent asset conflicts between React and Grid.js versions

Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

6
node_modules/@ariakit/core/.eslintignore generated vendored Normal file
View File

@@ -0,0 +1,6 @@
cjs
esm
ts
umd
coverage
node_modules

283
node_modules/@ariakit/core/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,283 @@
# @ariakit/core
## 0.3.11
### Improved performance of large collections
Components like [`MenuItem`](https://ariakit.org/reference/menu-item), [`ComboboxItem`](https://ariakit.org/reference/combobox-item), and [`SelectItem`](https://ariakit.org/reference/select-item) should now offer improved performance when rendering large collections.
### Other updates
- Improved JSDocs.
## 0.3.10
- Fixed [`CompositeItem`](https://ariakit.org/reference/composite-item) triggering blur on focus.
- Improved JSDocs.
## 0.3.9
- Fixed `Maximum update depth exceeded` warning when rendering multiple collection items on the page.
- Improved JSDocs.
## 0.3.8
- Fixed [`CollectionItem`](https://ariakit.org/reference/collection-item) elements getting out of order when composing stores.
- Fixed unmounted [`SelectPopover`](https://ariakit.org/reference/select-popover) not re-opening when its [`open`](https://ariakit.org/reference/select-provider#open) state is initially set to `true`.
- Fixed TypeScript build errors.
## 0.3.7
### Multi-selectable Combobox
We've added support for the [Combobox](https://ariakit.org/components/combobox) with multiple selection capabilities using a new [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue) prop, along with [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue) and [`setSelectedValue`](https://ariakit.org/reference/combobox-provider#setselectedvalue).
This works similarly to the [`value`](https://ariakit.org/reference/select-provider#value) prop on [Select](https://ariakit.org/components/select) components. If it receives an array, the combobox will allow multiple selections. By default, it's a string that represents the selected value in a single-select combobox.
Check out the [Multi-selectable Combobox](https://ariakit.org/examples/combobox-multiple) example to see it in action.
### Other updates
- Added [`resetValueOnSelect`](https://ariakit.org/reference/combobox-provider#resetvalueonselect) state to [Combobox](https://ariakit.org/components/combobox) components.
## 0.3.6
- Fixed `setSelectionRange` error when used with [unsupported](https://html.spec.whatwg.org/multipage/input.html#concept-input-apply) input types.
## 0.3.5
- Added new `menubar` module.
## 0.3.4
### Patch Changes
- [`#2935`](https://github.com/ariakit/ariakit/pull/2935) Fixed TypeScript declaration files in CommonJS projects using `NodeNext` for `moduleResolution`.
- [`#2945`](https://github.com/ariakit/ariakit/pull/2945) Added new `disabledFromProps` function to `@ariakit/core/utils/misc`.
- [`#2948`](https://github.com/ariakit/ariakit/pull/2948) Added `"use client"` directive to all modules.
- Improved JSDocs.
## 0.3.3
### Patch Changes
- [`#2909`](https://github.com/ariakit/ariakit/pull/2909) Fixed [Disclosure](https://ariakit.org/components/disclosure) and related components not waiting for the exit animation to complete before hiding the content element.
- Improved JSDocs.
## 0.3.2
### Patch Changes
- Improved JSDocs.
## 0.3.1
### Patch Changes
- [`#2801`](https://github.com/ariakit/ariakit/pull/2801) Fixed `values.slice` error that would occur when clicking on `FormCheckbox` that uses an integer-like field name.
## 0.3.0
### Minor Changes
- [`#2783`](https://github.com/ariakit/ariakit/pull/2783) **BREAKING** _(This should affect very few people)_: The `select` and `menu` props on `useComboboxStore` have been removed. If you need to compose `Combobox` with `Select` or `Menu`, use the `combobox` prop on `useSelectStore` or `useMenuStore` instead.
- [`#2745`](https://github.com/ariakit/ariakit/pull/2745) Component stores will now throw an error if they receive another store prop in conjunction with default prop values.
### Patch Changes
- [`#2782`](https://github.com/ariakit/ariakit/pull/2782) Fixed form store not synchrozining validate and submit callbacks with another form store through the `store` property.
- [`#2783`](https://github.com/ariakit/ariakit/pull/2783) Component store objects now contain properties for the composed stores passed to them as props. For instance, `useSelectStore({ combobox })` will return a `combobox` property if the `combobox` prop is specified.
- [`#2785`](https://github.com/ariakit/ariakit/pull/2785) Added `parent` and `menubar` properties to the menu store. These properties are automatically set when rendering nested menus or menus within a menubar.
Now, it also supports rendering nested menus that aren't nested in the React tree. In this case, you would have to supply the parent menu store manually to the child menu store.
These properties are also included in the returned menu store object, allowing you to verify whether the menu is nested. For instance:
```jsx
const menu = useMenuStore(props);
const isNested = Boolean(menu.parent);
```
- [`#2796`](https://github.com/ariakit/ariakit/pull/2796) Composed store props such as `useSelectStore({ combobox })` now accept `null` as a value.
## 0.2.9
### Patch Changes
- [`#2709`](https://github.com/ariakit/ariakit/pull/2709) Fixed `addGlobalEventListener` function when used in a document with sandbox iframes.
## 0.2.8
### Patch Changes
- Removed private properties from the store object. ([#2706](https://github.com/ariakit/ariakit/pull/2706))
Instead of accessing `store.setup`, `store.sync`, `store.subscribe`, etc. directly, use the equivalent functions exported by the `@ariakit/core/utils/store` module.
## 0.2.7
### Patch Changes
- Added new `EmptyObject` type export to `@ariakit/core/utils/types`. ([#2553](https://github.com/ariakit/ariakit/pull/2553))
## 0.2.6
### Patch Changes
- Fixed `defaultItems` passed to the collection store being overriden when new items are added. ([#2559](https://github.com/ariakit/ariakit/pull/2559))
## 0.2.5
### Patch Changes
- Added new `disclosure` prop to the `Disclosure` store. ([#2518](https://github.com/ariakit/ariakit/pull/2518))
## 0.2.4
### Patch Changes
- Added missing `types` field to proxy package.json files. ([#2489](https://github.com/ariakit/ariakit/pull/2489))
## 0.2.3
### Patch Changes
- Added `.cjs` and `.js` extensions to paths in proxy package.json files to support bundlers that can't automaically resolve them. ([#2487](https://github.com/ariakit/ariakit/pull/2487))
## 0.2.2
### Patch Changes
- Updated the `SelectPopover` component so the `composite` and `typeahead` props are automatically set to `false` when combining it with a `Combobox` component using the `combobox` prop from the select store. ([#2428](https://github.com/ariakit/ariakit/pull/2428))
This means you'll not need to explicitly pass `composite={false}` when building a [Select with Combobox](https://ariakit.org/examples/select-combobox) component.
- Updated `getScrollingElement` function so it also considers horizontal scrolling elements.
- Fixed `StringWithValue` utility type.
- Fixed `activeId` state on `Tab` not updating correctly when setting `selectedId` with the Next.js App Router. ([#2443](https://github.com/ariakit/ariakit/pull/2443))
## 0.2.1
### Patch Changes
- Fixed `useHovercardStore` and `useTooltipStore` not updating the state when the `timeout`, `showTimeout` or `hideTimeout` props changed. ([#2421](https://github.com/ariakit/ariakit/pull/2421))
## 0.2.0
### Minor Changes
- **BREAKING**: Moved props from the `usePopoverStore` hook to the `Popover` component: `fixed`, `gutter`, `shift`, `flip`, `slide`, `overlap`, `sameWidth`, `fitViewport`, `arrowPadding`, `overflowPadding`, `getAnchorRect`, `renderCallback` (renamed to `updatePosition`). ([#2279](https://github.com/ariakit/ariakit/pull/2279))
The exception is the `placement` prop that should still be passed to the store.
**Before**:
```jsx
const popover = usePopoverStore({
placement: "bottom",
fixed: true,
gutter: 8,
shift: 8,
flip: true,
slide: true,
overlap: true,
sameWidth: true,
fitViewport: true,
arrowPadding: 8,
overflowPadding: 8,
getAnchorRect: (anchor) => anchor?.getBoundingClientRect(),
renderCallback: (props) => props.defaultRenderCallback(),
});
<Popover store={popover} />;
```
**After**:
```jsx
const popover = usePopoverStore({ placement: "bottom" });
<Popover
store={popover}
fixed
gutter={8}
shift={8}
flip
slide
overlap
sameWidth
fitViewport
arrowPadding={8}
overflowPadding={8}
getAnchorRect={(anchor) => anchor?.getBoundingClientRect()}
updatePosition={(props) => props.updatePosition()}
/>;
```
This change affects all the hooks and components that use `usePopoverStore` and `Popover` underneath: `useComboboxStore`, `ComboboxPopover`, `useHovercardStore`, `Hovercard`, `useMenuStore`, `Menu`, `useSelectStore`, `SelectPopover`, `useTooltipStore`, `Tooltip`.
With this change, the underlying `@floating-ui/dom` dependency has been also moved to the `Popover` component, which means it can be lazy loaded. See the [Lazy Popover](https://ariakit.org/examples/popover-lazy) example.
## 0.1.5
### Patch Changes
- Updated `isFocusable` function to return `false` when the element is `inert` or is a descendant of an `inert` element. ([#2339](https://github.com/ariakit/ariakit/pull/2339))
- Fixed build target. ([#2355](https://github.com/ariakit/ariakit/pull/2355))
- Updated JSDocs.
## 0.1.4
### Patch Changes
- Updated JSDocs.
## 0.1.3
### Patch Changes
- Added support for native radio buttons within forms, that work with roving tabindex, to all `focus` utilities. ([#2313](https://github.com/ariakit/ariakit/pull/2313))
- Updated validate and submit callbacks on `Form` so they always run in a consistent order. ([#2319](https://github.com/ariakit/ariakit/pull/2319))
- Marked internal store functions as deprecated/experimental. ([#2316](https://github.com/ariakit/ariakit/pull/2316))
## 0.1.2
### Patch Changes
- Added `isFalsyBooleanCallback` method.
## 0.1.1
### Patch Changes
- Added missing `defaultValue` prop back to `useRadioStore`. ([#2265](https://github.com/ariakit/ariakit/pull/2265))
## 0.1.0
### Minor Changes
- Updated package names to include the `@ariakit` scope, providing a more distinct and specific namespace for our packages.
Additionally, we've made a change to the versioning system, moving from `v2.0.0-beta.x` to `v0.x.x`. This alteration means that although the library is still in beta, we can release breaking changes in minor versions without disrupting projects that don't set exact versions in their `package.json`.
```diff
- npm i ariakit
+ npm i @ariakit/react
```
### Patch Changes
- Packages are now ESM by default (commonjs modules are still available with the `.cjs` extension).

View File

@@ -0,0 +1,8 @@
{
"name": "@ariakit/core/checkbox/checkbox-store",
"private": true,
"sideEffects": false,
"main": "../../cjs/checkbox/checkbox-store.cjs",
"module": "../../esm/checkbox/checkbox-store.js",
"types": "../../cjs/checkbox/checkbox-store.d.ts"
}

197
node_modules/@ariakit/core/cjs/__chunks/5F4DVUNS.cjs generated vendored Normal file
View File

@@ -0,0 +1,197 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
// src/utils/dom.ts
var canUseDOM = checkIsBrowser();
function checkIsBrowser() {
var _a;
return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
}
function getDocument(node) {
return node ? node.ownerDocument || node : document;
}
function getWindow(node) {
return getDocument(node).defaultView || window;
}
function getActiveElement(node, activeDescendant = false) {
const { activeElement } = getDocument(node);
if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
return null;
}
if (isFrame(activeElement) && activeElement.contentDocument) {
return getActiveElement(
activeElement.contentDocument.body,
activeDescendant
);
}
if (activeDescendant) {
const id = activeElement.getAttribute("aria-activedescendant");
if (id) {
const element = getDocument(activeElement).getElementById(id);
if (element) {
return element;
}
}
}
return activeElement;
}
function contains(parent, child) {
return parent === child || parent.contains(child);
}
function isFrame(element) {
return element.tagName === "IFRAME";
}
function isButton(element) {
const tagName = element.tagName.toLowerCase();
if (tagName === "button")
return true;
if (tagName === "input" && element.type) {
return buttonInputTypes.indexOf(element.type) !== -1;
}
return false;
}
var buttonInputTypes = [
"button",
"color",
"file",
"image",
"reset",
"submit"
];
function matches(element, selectors) {
if ("matches" in element) {
return element.matches(selectors);
}
if ("msMatchesSelector" in element) {
return element.msMatchesSelector(selectors);
}
return element.webkitMatchesSelector(selectors);
}
function isVisible(element) {
const htmlElement = element;
return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
}
function closest(element, selectors) {
if ("closest" in element)
return element.closest(selectors);
do {
if (matches(element, selectors))
return element;
element = element.parentElement || element.parentNode;
} while (element !== null && element.nodeType === 1);
return null;
}
function isTextField(element) {
try {
const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
const isTextArea = element.tagName === "TEXTAREA";
return isTextInput || isTextArea || false;
} catch (error) {
return false;
}
}
function getPopupRole(element, fallback) {
const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
const role = element == null ? void 0 : element.getAttribute("role");
if (role && allowedPopupRoles.indexOf(role) !== -1) {
return role;
}
return fallback;
}
function getPopupItemRole(element, fallback) {
var _a;
const itemRoleByPopupRole = {
menu: "menuitem",
listbox: "option",
tree: "treeitem",
grid: "gridcell"
};
const popupRole = getPopupRole(element);
if (!popupRole)
return fallback;
const key = popupRole;
return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback;
}
function getTextboxSelection(element) {
let start = 0;
let end = 0;
if (isTextField(element)) {
start = element.selectionStart || 0;
end = element.selectionEnd || 0;
} else if (element.isContentEditable) {
const selection = getDocument(element).getSelection();
if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) {
const range = selection.getRangeAt(0);
const nextRange = range.cloneRange();
nextRange.selectNodeContents(element);
nextRange.setEnd(range.startContainer, range.startOffset);
start = nextRange.toString().length;
nextRange.setEnd(range.endContainer, range.endOffset);
end = nextRange.toString().length;
}
}
return { start, end };
}
function scrollIntoViewIfNeeded(element, arg) {
if (isPartiallyHidden(element) && "scrollIntoView" in element) {
element.scrollIntoView(arg);
}
}
function getScrollingElement(element) {
if (!element)
return null;
if (element.clientHeight && element.scrollHeight > element.clientHeight) {
const { overflowY } = getComputedStyle(element);
const isScrollable = overflowY !== "visible" && overflowY !== "hidden";
if (isScrollable)
return element;
} else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
const { overflowX } = getComputedStyle(element);
const isScrollable = overflowX !== "visible" && overflowX !== "hidden";
if (isScrollable)
return element;
}
return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
}
function isPartiallyHidden(element) {
const elementRect = element.getBoundingClientRect();
const scroller = getScrollingElement(element);
if (!scroller)
return false;
const scrollerRect = scroller.getBoundingClientRect();
const isHTML = scroller.tagName === "HTML";
const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top;
const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom;
const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left;
const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right;
const top = elementRect.top < scrollerTop;
const left = elementRect.left < scrollerLeft;
const bottom = elementRect.bottom > scrollerBottom;
const right = elementRect.right > scrollerRight;
return top || left || bottom || right;
}
function setSelectionRange(element, ...args) {
if (/text|search|password|tel|url/i.test(element.type)) {
element.setSelectionRange(...args);
}
}
exports.canUseDOM = canUseDOM; exports.getDocument = getDocument; exports.getWindow = getWindow; exports.getActiveElement = getActiveElement; exports.contains = contains; exports.isFrame = isFrame; exports.isButton = isButton; exports.matches = matches; exports.isVisible = isVisible; exports.closest = closest; exports.isTextField = isTextField; exports.getPopupRole = getPopupRole; exports.getPopupItemRole = getPopupItemRole; exports.getTextboxSelection = getTextboxSelection; exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded; exports.getScrollingElement = getScrollingElement; exports.isPartiallyHidden = isPartiallyHidden; exports.setSelectionRange = setSelectionRange;

38
node_modules/@ariakit/core/cjs/__chunks/AV6KTKLE.cjs generated vendored Normal file
View File

@@ -0,0 +1,38 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.__objRest = __objRest;

300
node_modules/@ariakit/core/cjs/__chunks/BFE5R4EZ.cjs generated vendored Normal file
View File

@@ -0,0 +1,300 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _MI6NUQYQcjs = require('./MI6NUQYQ.cjs');
var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
var _ULSPM3Y3cjs = require('./ULSPM3Y3.cjs');
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
// src/composite/composite-store.ts
var NULL_ITEM = { id: null };
function findFirstEnabledItem(items, excludeId) {
return items.find((item) => {
if (excludeId) {
return !item.disabled && item.id !== excludeId;
}
return !item.disabled;
});
}
function getEnabledItems(items, excludeId) {
return items.filter((item) => {
if (excludeId) {
return !item.disabled && item.id !== excludeId;
}
return !item.disabled;
});
}
function getOppositeOrientation(orientation) {
if (orientation === "vertical")
return "horizontal";
if (orientation === "horizontal")
return "vertical";
return;
}
function getItemsInRow(items, rowId) {
return items.filter((item) => item.rowId === rowId);
}
function flipItems(items, activeId, shouldInsertNullItem = false) {
const index = items.findIndex((item) => item.id === activeId);
return [
...items.slice(index + 1),
...shouldInsertNullItem ? [NULL_ITEM] : [],
...items.slice(0, index)
];
}
function groupItemsByRows(items) {
const rows = [];
for (const item of items) {
const row = rows.find((currentRow) => {
var _a;
return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
});
if (row) {
row.push(item);
} else {
rows.push([item]);
}
}
return rows;
}
function getMaxRowLength(array) {
let maxLength = 0;
for (const { length } of array) {
if (length > maxLength) {
maxLength = length;
}
}
return maxLength;
}
function createEmptyItem(rowId) {
return {
id: "__EMPTY_ITEM__",
disabled: true,
rowId
};
}
function normalizeRows(rows, activeId, focusShift) {
const maxLength = getMaxRowLength(rows);
for (const row of rows) {
for (let i = 0; i < maxLength; i += 1) {
const item = row[i];
if (!item || focusShift && item.disabled) {
const isFirst = i === 0;
const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1];
row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
}
}
}
return rows;
}
function verticalizeItems(items) {
const rows = groupItemsByRows(items);
const maxLength = getMaxRowLength(rows);
const verticalized = [];
for (let i = 0; i < maxLength; i += 1) {
for (const row of rows) {
const item = row[i];
if (item) {
verticalized.push(_AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, item), {
// If there's no rowId, it means that it's not a grid composite, but
// a single row instead. So, instead of verticalizing it, that is,
// assigning a different rowId based on the column index, we keep it
// undefined so they will be part of the same row. This is useful
// when using up/down on one-dimensional composites.
rowId: item.rowId ? `${i}` : void 0
}));
}
}
}
return verticalized;
}
function createCompositeStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const collection = _MI6NUQYQcjs.createCollectionStore.call(void 0, props);
const activeId = _KBNYGXWIcjs.defaultValue.call(void 0,
props.activeId,
syncState == null ? void 0 : syncState.activeId,
props.defaultActiveId
);
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection.getState()), {
activeId,
baseElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
includesBaseElement: _KBNYGXWIcjs.defaultValue.call(void 0,
props.includesBaseElement,
syncState == null ? void 0 : syncState.includesBaseElement,
activeId === null
),
moves: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
orientation: _KBNYGXWIcjs.defaultValue.call(void 0,
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"both"
),
rtl: _KBNYGXWIcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
virtualFocus: _KBNYGXWIcjs.defaultValue.call(void 0,
props.virtualFocus,
syncState == null ? void 0 : syncState.virtualFocus,
false
),
focusLoop: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
focusWrap: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
focusShift: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
});
const composite = _F6HPKLO2cjs.createStore.call(void 0, initialState, collection, props.store);
_F6HPKLO2cjs.setup.call(void 0,
composite,
() => _F6HPKLO2cjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
composite.setState("activeId", (activeId2) => {
var _a2;
if (activeId2 !== void 0)
return activeId2;
return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
});
})
);
const getNextId = (items, orientation, hasNullItem, skip) => {
var _a2, _b;
const { activeId: activeId2, rtl, focusLoop, focusWrap, includesBaseElement } = composite.getState();
const isHorizontal = orientation !== "vertical";
const isRTL = rtl && isHorizontal;
const allItems = isRTL ? _ULSPM3Y3cjs.reverseArray.call(void 0, items) : items;
if (activeId2 == null) {
return (_a2 = findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
}
const activeItem = allItems.find((item) => item.id === activeId2);
if (!activeItem) {
return (_b = findFirstEnabledItem(allItems)) == null ? void 0 : _b.id;
}
const isGrid = !!activeItem.rowId;
const activeIndex = allItems.indexOf(activeItem);
const nextItems = allItems.slice(activeIndex + 1);
const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
if (skip !== void 0) {
const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
return nextItem2 == null ? void 0 : nextItem2.id;
}
const oppositeOrientation = getOppositeOrientation(
// If it's a grid and orientation is not set, it's a next/previous call,
// which is inherently horizontal. up/down will call next with orientation
// set to vertical by default (see below on up/down methods).
isGrid ? orientation || "horizontal" : orientation
);
const canLoop = focusLoop && focusLoop !== oppositeOrientation;
const canWrap = isGrid && focusWrap && focusWrap !== oppositeOrientation;
hasNullItem = hasNullItem || !isGrid && canLoop && includesBaseElement;
if (canLoop) {
const loopItems = canWrap && !hasNullItem ? allItems : getItemsInRow(allItems, activeItem.rowId);
const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
const nextItem2 = findFirstEnabledItem(sortedItems, activeId2);
return nextItem2 == null ? void 0 : nextItem2.id;
}
if (canWrap) {
const nextItem2 = findFirstEnabledItem(
// We can use nextItems, which contains all the next items, including
// items from other rows, to wrap between rows. However, if there is a
// null item (the composite container), we'll only use the next items in
// the row. So moving next from the last item will focus on the
// composite container. On grid composites, horizontal navigation never
// focuses on the composite container, only vertical.
hasNullItem ? nextItemsInRow : nextItems,
activeId2
);
const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
return nextId;
}
const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2);
if (!nextItem && hasNullItem) {
return null;
}
return nextItem == null ? void 0 : nextItem.id;
};
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection), composite), {
setBaseElement: (element) => composite.setState("baseElement", element),
setActiveId: (id) => composite.setState("activeId", id),
move: (id) => {
if (id === void 0)
return;
composite.setState("activeId", id);
composite.setState("moves", (moves) => moves + 1);
},
first: () => {
var _a2;
return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
},
last: () => {
var _a2;
return (_a2 = findFirstEnabledItem(_ULSPM3Y3cjs.reverseArray.call(void 0, composite.getState().renderedItems))) == null ? void 0 : _a2.id;
},
next: (skip) => {
const { renderedItems, orientation } = composite.getState();
return getNextId(renderedItems, orientation, false, skip);
},
previous: (skip) => {
var _a2;
const { renderedItems, orientation, includesBaseElement } = composite.getState();
const isGrid = !!((_a2 = findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
const hasNullItem = !isGrid && includesBaseElement;
return getNextId(
_ULSPM3Y3cjs.reverseArray.call(void 0, renderedItems),
orientation,
hasNullItem,
skip
);
},
down: (skip) => {
const {
activeId: activeId2,
renderedItems,
focusShift,
focusLoop,
includesBaseElement
} = composite.getState();
const shouldShift = focusShift && !skip;
const verticalItems = verticalizeItems(
_ULSPM3Y3cjs.flatten2DArray.call(void 0,
normalizeRows(groupItemsByRows(renderedItems), activeId2, shouldShift)
)
);
const canLoop = focusLoop && focusLoop !== "horizontal";
const hasNullItem = canLoop && includesBaseElement;
return getNextId(verticalItems, "vertical", hasNullItem, skip);
},
up: (skip) => {
const { activeId: activeId2, renderedItems, focusShift, includesBaseElement } = composite.getState();
const shouldShift = focusShift && !skip;
const verticalItems = verticalizeItems(
_ULSPM3Y3cjs.reverseArray.call(void 0,
_ULSPM3Y3cjs.flatten2DArray.call(void 0,
normalizeRows(
groupItemsByRows(renderedItems),
activeId2,
shouldShift
)
)
)
);
const hasNullItem = includesBaseElement;
return getNextId(verticalItems, "vertical", hasNullItem, skip);
}
});
}
exports.createCompositeStore = createCompositeStore;

64
node_modules/@ariakit/core/cjs/__chunks/E53JW5BD.cjs generated vendored Normal file
View File

@@ -0,0 +1,64 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _I3Y4EXEFcjs = require('./I3Y4EXEF.cjs');
var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
// src/popover/popover-store.ts
function createPopoverStore(_a = {}) {
var _b = _a, {
popover: otherPopover
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
"popover"
]);
const store = _F6HPKLO2cjs.mergeStore.call(void 0,
props.store,
_F6HPKLO2cjs.omit.call(void 0, otherPopover, [
"arrowElement",
"anchorElement",
"contentElement",
"popoverElement",
"disclosureElement"
])
);
_F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, store);
const syncState = store == null ? void 0 : store.getState();
const dialog = _I3Y4EXEFcjs.createDialogStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), { store }));
const placement = _KBNYGXWIcjs.defaultValue.call(void 0,
props.placement,
syncState == null ? void 0 : syncState.placement,
"bottom"
);
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, dialog.getState()), {
placement,
currentPlacement: placement,
anchorElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
popoverElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
arrowElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
rendered: Symbol("rendered")
});
const popover = _F6HPKLO2cjs.createStore.call(void 0, initialState, dialog, store);
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, dialog), popover), {
setAnchorElement: (element) => popover.setState("anchorElement", element),
setPopoverElement: (element) => popover.setState("popoverElement", element),
setArrowElement: (element) => popover.setState("arrowElement", element),
render: () => popover.setState("rendered", Symbol("rendered"))
});
}
exports.createPopoverStore = createPopoverStore;

250
node_modules/@ariakit/core/cjs/__chunks/F6HPKLO2.cjs generated vendored Normal file
View File

@@ -0,0 +1,250 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
// src/utils/store.ts
function getInternal(store, key) {
const internals = store.__unstableInternals;
_KBNYGXWIcjs.invariant.call(void 0, internals, "Invalid store");
return internals[key];
}
function createStore(initialState, ...stores) {
let state = initialState;
let prevStateBatch = state;
let lastUpdate = Symbol();
let destroy = _KBNYGXWIcjs.noop;
const instances = /* @__PURE__ */ new Set();
const updatedKeys = /* @__PURE__ */ new Set();
const setups = /* @__PURE__ */ new Set();
const listeners = /* @__PURE__ */ new Set();
const batchListeners = /* @__PURE__ */ new Set();
const disposables = /* @__PURE__ */ new WeakMap();
const listenerKeys = /* @__PURE__ */ new WeakMap();
const storeSetup = (callback) => {
setups.add(callback);
return () => setups.delete(callback);
};
const storeInit = () => {
const initialized = instances.size;
const instance = Symbol();
instances.add(instance);
const maybeDestroy = () => {
instances.delete(instance);
if (instances.size)
return;
destroy();
};
if (initialized)
return maybeDestroy;
const desyncs = _KBNYGXWIcjs.getKeys.call(void 0, state).map(
(key) => _KBNYGXWIcjs.chain.call(void 0,
...stores.map((store) => {
var _a;
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
if (!storeState)
return;
if (!_KBNYGXWIcjs.hasOwnProperty.call(void 0, storeState, key))
return;
return sync(store, [key], (state2) => {
setState(
key,
state2[key],
// @ts-expect-error - Not public API. This is just to prevent
// infinite loops.
true
);
});
})
)
);
const teardowns = [];
setups.forEach((setup2) => teardowns.push(setup2()));
const cleanups = stores.map(init);
destroy = _KBNYGXWIcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups);
return maybeDestroy;
};
const sub = (keys, listener, set = listeners) => {
set.add(listener);
listenerKeys.set(listener, keys);
return () => {
var _a;
(_a = disposables.get(listener)) == null ? void 0 : _a();
disposables.delete(listener);
listenerKeys.delete(listener);
set.delete(listener);
};
};
const storeSubscribe = (keys, listener) => sub(keys, listener);
const storeSync = (keys, listener) => {
disposables.set(listener, listener(state, state));
return sub(keys, listener);
};
const storeBatch = (keys, listener) => {
disposables.set(listener, listener(state, prevStateBatch));
return sub(keys, listener, batchListeners);
};
const storePick = (keys) => createStore(_KBNYGXWIcjs.pick.call(void 0, state, keys), finalStore);
const storeOmit = (keys) => createStore(_KBNYGXWIcjs.omit.call(void 0, state, keys), finalStore);
const getState = () => state;
const setState = (key, value, fromStores = false) => {
if (!_KBNYGXWIcjs.hasOwnProperty.call(void 0, state, key))
return;
const nextValue = _KBNYGXWIcjs.applyState.call(void 0, value, state[key]);
if (nextValue === state[key])
return;
if (!fromStores) {
stores.forEach((store) => {
var _a;
(_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
});
}
const prevState = state;
state = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, state), { [key]: nextValue });
const thisUpdate = Symbol();
lastUpdate = thisUpdate;
updatedKeys.add(key);
const run = (listener, prev, uKeys) => {
var _a;
const keys = listenerKeys.get(listener);
const updated = (k) => uKeys ? uKeys.has(k) : k === key;
if (!keys || keys.some(updated)) {
(_a = disposables.get(listener)) == null ? void 0 : _a();
disposables.set(listener, listener(state, prev));
}
};
listeners.forEach((listener) => {
run(listener, prevState);
});
queueMicrotask(() => {
if (lastUpdate !== thisUpdate)
return;
const snapshot = state;
batchListeners.forEach((listener) => {
run(listener, prevStateBatch, updatedKeys);
});
prevStateBatch = snapshot;
updatedKeys.clear();
});
};
const finalStore = {
getState,
setState,
__unstableInternals: {
setup: storeSetup,
init: storeInit,
subscribe: storeSubscribe,
sync: storeSync,
batch: storeBatch,
pick: storePick,
omit: storeOmit
}
};
return finalStore;
}
function setup(store, ...args) {
if (!store)
return;
return getInternal(store, "setup")(...args);
}
function init(store, ...args) {
if (!store)
return;
return getInternal(store, "init")(...args);
}
function subscribe(store, ...args) {
if (!store)
return;
return getInternal(store, "subscribe")(...args);
}
function sync(store, ...args) {
if (!store)
return;
return getInternal(store, "sync")(...args);
}
function batch(store, ...args) {
if (!store)
return;
return getInternal(store, "batch")(...args);
}
function omit2(store, ...args) {
if (!store)
return;
return getInternal(store, "omit")(...args);
}
function pick2(store, ...args) {
if (!store)
return;
return getInternal(store, "pick")(...args);
}
function mergeStore(...stores) {
const initialState = stores.reduce((state, store2) => {
var _a;
const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
if (!nextState)
return state;
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, state), nextState);
}, {});
const store = createStore(initialState, ...stores);
return store;
}
function throwOnConflictingProps(props, store) {
if (process.env.NODE_ENV === "production")
return;
if (!store)
return;
const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
var _a;
const stateKey = key.replace("default", "");
return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`;
});
if (!defaultKeys.length)
return;
const storeState = store.getState();
const conflictingProps = defaultKeys.filter(
(key) => _KBNYGXWIcjs.hasOwnProperty.call(void 0, storeState, key)
);
if (!conflictingProps.length)
return;
throw new Error(
`Passing a store prop in conjunction with a default state is not supported.
const store = useSelectStore();
<SelectProvider store={store} defaultValue="Apple" />
^ ^
Instead, pass the default state to the topmost store:
const store = useSelectStore({ defaultValue: "Apple" });
<SelectProvider store={store} />
See https://github.com/ariakit/ariakit/pull/2745 for more details.
If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
`
);
}
exports.createStore = createStore; exports.setup = setup; exports.init = init; exports.subscribe = subscribe; exports.sync = sync; exports.batch = batch; exports.omit = omit2; exports.pick = pick2; exports.mergeStore = mergeStore; exports.throwOnConflictingProps = throwOnConflictingProps;

13
node_modules/@ariakit/core/cjs/__chunks/I3Y4EXEF.cjs generated vendored Normal file
View File

@@ -0,0 +1,13 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _OTVLDMN2cjs = require('./OTVLDMN2.cjs');
// src/dialog/dialog-store.ts
function createDialogStore(props = {}) {
return _OTVLDMN2cjs.createDisclosureStore.call(void 0, props);
}
exports.createDialogStore = createDialogStore;

165
node_modules/@ariakit/core/cjs/__chunks/KBNYGXWI.cjs generated vendored Normal file
View File

@@ -0,0 +1,165 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
// src/utils/misc.ts
function noop(..._) {
}
function shallowEqual(a, b) {
if (a === b)
return true;
if (!a)
return false;
if (!b)
return false;
if (typeof a !== "object")
return false;
if (typeof b !== "object")
return false;
const aKeys = Object.keys(a);
const bKeys = Object.keys(b);
const { length } = aKeys;
if (bKeys.length !== length)
return false;
for (const key of aKeys) {
if (a[key] !== b[key]) {
return false;
}
}
return true;
}
function applyState(argument, currentValue) {
if (isUpdater(argument)) {
const value = isLazyValue(currentValue) ? currentValue() : currentValue;
return argument(value);
}
return argument;
}
function isUpdater(argument) {
return typeof argument === "function";
}
function isLazyValue(value) {
return typeof value === "function";
}
function isObject(arg) {
return typeof arg === "object" && arg != null;
}
function isEmpty(arg) {
if (Array.isArray(arg))
return !arg.length;
if (isObject(arg))
return !Object.keys(arg).length;
if (arg == null)
return true;
if (arg === "")
return true;
return false;
}
function isInteger(arg) {
if (typeof arg === "number") {
return Math.floor(arg) === arg;
}
return String(Math.floor(Number(arg))) === arg;
}
function hasOwnProperty(object, prop) {
if (typeof Object.hasOwn === "function") {
return Object.hasOwn(object, prop);
}
return Object.prototype.hasOwnProperty.call(object, prop);
}
function chain(...fns) {
return (...args) => {
for (const fn of fns) {
if (typeof fn === "function") {
fn(...args);
}
}
};
}
function cx(...args) {
return args.filter(Boolean).join(" ") || void 0;
}
function normalizeString(str) {
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
}
function omit(object, keys) {
const result = _AV6KTKLEcjs.__spreadValues.call(void 0, {}, object);
for (const key of keys) {
if (hasOwnProperty(result, key)) {
delete result[key];
}
}
return result;
}
function pick(object, paths) {
const result = {};
for (const key of paths) {
if (hasOwnProperty(object, key)) {
result[key] = object[key];
}
}
return result;
}
function identity(value) {
return value;
}
function beforePaint(cb = noop) {
const raf = requestAnimationFrame(cb);
return () => cancelAnimationFrame(raf);
}
function afterPaint(cb = noop) {
let raf = requestAnimationFrame(() => {
raf = requestAnimationFrame(cb);
});
return () => cancelAnimationFrame(raf);
}
function invariant(condition, message) {
if (condition)
return;
if (typeof message !== "string")
throw new Error("Invariant failed");
throw new Error(message);
}
function getKeys(obj) {
return Object.keys(obj);
}
function isFalsyBooleanCallback(booleanOrCallback, ...args) {
const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
if (result == null)
return false;
return !result;
}
function disabledFromProps(props) {
return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
}
function defaultValue(...values) {
for (const value of values) {
if (value !== void 0)
return value;
}
return void 0;
}
exports.noop = noop; exports.shallowEqual = shallowEqual; exports.applyState = applyState; exports.isObject = isObject; exports.isEmpty = isEmpty; exports.isInteger = isInteger; exports.hasOwnProperty = hasOwnProperty; exports.chain = chain; exports.cx = cx; exports.normalizeString = normalizeString; exports.omit = omit; exports.pick = pick; exports.identity = identity; exports.beforePaint = beforePaint; exports.afterPaint = afterPaint; exports.invariant = invariant; exports.getKeys = getKeys; exports.isFalsyBooleanCallback = isFalsyBooleanCallback; exports.disabledFromProps = disabledFromProps; exports.defaultValue = defaultValue;

204
node_modules/@ariakit/core/cjs/__chunks/MI6NUQYQ.cjs generated vendored Normal file
View File

@@ -0,0 +1,204 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
var _5F4DVUNScjs = require('./5F4DVUNS.cjs');
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
// src/collection/collection-store.ts
function isElementPreceding(a, b) {
return Boolean(
b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING
);
}
function sortBasedOnDOMPosition(items) {
const pairs = items.map((item, index) => [index, item]);
let isOrderDifferent = false;
pairs.sort(([indexA, a], [indexB, b]) => {
const elementA = a.element;
const elementB = b.element;
if (elementA === elementB)
return 0;
if (!elementA || !elementB)
return 0;
if (isElementPreceding(elementA, elementB)) {
if (indexA > indexB) {
isOrderDifferent = true;
}
return -1;
}
if (indexA < indexB) {
isOrderDifferent = true;
}
return 1;
});
if (isOrderDifferent) {
return pairs.map(([_, item]) => item);
}
return items;
}
function getCommonParent(items) {
var _a;
const firstItem = items.find((item) => !!item.element);
const lastItem = [...items].reverse().find((item) => !!item.element);
let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement;
while (parentElement && (lastItem == null ? void 0 : lastItem.element)) {
const parent = parentElement;
if (lastItem && parent.contains(lastItem.element)) {
return parentElement;
}
parentElement = parentElement.parentElement;
}
return _5F4DVUNScjs.getDocument.call(void 0, parentElement).body;
}
function getPrivateStore(store) {
return store == null ? void 0 : store.__unstablePrivateStore;
}
function createCollectionStore(props = {}) {
var _a;
_F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, props.store);
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const items = _KBNYGXWIcjs.defaultValue.call(void 0,
props.items,
syncState == null ? void 0 : syncState.items,
props.defaultItems,
[]
);
const itemsMap = new Map(items.map((item) => [item.id, item]));
const initialState = {
items,
renderedItems: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
};
const syncPrivateStore = getPrivateStore(props.store);
const privateStore = _F6HPKLO2cjs.createStore.call(void 0,
{ items, renderedItems: initialState.renderedItems },
syncPrivateStore
);
const collection = _F6HPKLO2cjs.createStore.call(void 0, initialState, props.store);
const sortItems = (renderedItems) => {
const sortedItems = sortBasedOnDOMPosition(renderedItems);
privateStore.setState("renderedItems", sortedItems);
collection.setState("renderedItems", sortedItems);
};
_F6HPKLO2cjs.setup.call(void 0, collection, () => _F6HPKLO2cjs.init.call(void 0, privateStore));
_F6HPKLO2cjs.setup.call(void 0, privateStore, () => {
return _F6HPKLO2cjs.batch.call(void 0, privateStore, ["items"], (state) => {
collection.setState("items", state.items);
});
});
_F6HPKLO2cjs.setup.call(void 0, privateStore, () => {
return _F6HPKLO2cjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
let firstRun = true;
let raf = requestAnimationFrame(() => {
const { renderedItems } = collection.getState();
if (state.renderedItems === renderedItems)
return;
sortItems(state.renderedItems);
});
if (typeof IntersectionObserver !== "function") {
return () => cancelAnimationFrame(raf);
}
const ioCallback = () => {
if (firstRun) {
firstRun = false;
return;
}
cancelAnimationFrame(raf);
raf = requestAnimationFrame(() => sortItems(state.renderedItems));
};
const root = getCommonParent(state.renderedItems);
const observer = new IntersectionObserver(ioCallback, { root });
for (const item of state.renderedItems) {
if (!item.element)
continue;
observer.observe(item.element);
}
return () => {
cancelAnimationFrame(raf);
observer.disconnect();
};
});
});
const mergeItem = (item, setItems, canDeleteFromMap = false) => {
let prevItem;
setItems((items2) => {
const index = items2.findIndex(({ id }) => id === item.id);
const nextItems = items2.slice();
if (index !== -1) {
prevItem = items2[index];
const nextItem = _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, prevItem), item);
nextItems[index] = nextItem;
itemsMap.set(item.id, nextItem);
} else {
nextItems.push(item);
itemsMap.set(item.id, item);
}
return nextItems;
});
const unmergeItem = () => {
setItems((items2) => {
if (!prevItem) {
if (canDeleteFromMap) {
itemsMap.delete(item.id);
}
return items2.filter(({ id }) => id !== item.id);
}
const index = items2.findIndex(({ id }) => id === item.id);
if (index === -1)
return items2;
const nextItems = items2.slice();
nextItems[index] = prevItem;
itemsMap.set(item.id, prevItem);
return nextItems;
});
};
return unmergeItem;
};
const registerItem = (item) => mergeItem(
item,
(getItems) => privateStore.setState("items", getItems),
true
);
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection), {
registerItem,
renderItem: (item) => _KBNYGXWIcjs.chain.call(void 0,
registerItem(item),
mergeItem(
item,
(getItems) => privateStore.setState("renderedItems", getItems)
)
),
item: (id) => {
if (!id)
return null;
let item = itemsMap.get(id);
if (!item) {
const { items: items2 } = collection.getState();
item = items2.find((item2) => item2.id === id);
if (item) {
itemsMap.set(id, item);
}
}
return item || null;
},
// @ts-expect-error Internal
__unstablePrivateStore: privateStore
});
}
exports.createCollectionStore = createCollectionStore;

35
node_modules/@ariakit/core/cjs/__chunks/NOFH2BLB.cjs generated vendored Normal file
View File

@@ -0,0 +1,35 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _BFE5R4EZcjs = require('./BFE5R4EZ.cjs');
var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
// src/menubar/menubar-store.ts
function createMenubarStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const composite = _BFE5R4EZcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
orientation: _KBNYGXWIcjs.defaultValue.call(void 0,
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"horizontal"
),
focusLoop: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
}));
const initialState = _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState());
const menubar = _F6HPKLO2cjs.createStore.call(void 0, initialState, composite, props.store);
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), menubar);
}
exports.createMenubarStore = createMenubarStore;

78
node_modules/@ariakit/core/cjs/__chunks/OTVLDMN2.cjs generated vendored Normal file
View File

@@ -0,0 +1,78 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
// src/disclosure/disclosure-store.ts
function createDisclosureStore(props = {}) {
const store = _F6HPKLO2cjs.mergeStore.call(void 0,
props.store,
_F6HPKLO2cjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
);
_F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, store);
const syncState = store == null ? void 0 : store.getState();
const open = _KBNYGXWIcjs.defaultValue.call(void 0,
props.open,
syncState == null ? void 0 : syncState.open,
props.defaultOpen,
false
);
const animated = _KBNYGXWIcjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
const initialState = {
open,
animated,
animating: !!animated && open,
mounted: open,
contentElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
disclosureElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
};
const disclosure = _F6HPKLO2cjs.createStore.call(void 0, initialState, store);
_F6HPKLO2cjs.setup.call(void 0,
disclosure,
() => _F6HPKLO2cjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
if (state.animated)
return;
disclosure.setState("animating", false);
})
);
_F6HPKLO2cjs.setup.call(void 0,
disclosure,
() => _F6HPKLO2cjs.subscribe.call(void 0, disclosure, ["open"], () => {
if (!disclosure.getState().animated)
return;
disclosure.setState("animating", true);
})
);
_F6HPKLO2cjs.setup.call(void 0,
disclosure,
() => _F6HPKLO2cjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
disclosure.setState("mounted", state.open || state.animating);
})
);
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, disclosure), {
setOpen: (value) => disclosure.setState("open", value),
show: () => disclosure.setState("open", true),
hide: () => disclosure.setState("open", false),
toggle: () => disclosure.setState("open", (open2) => !open2),
stopAnimation: () => disclosure.setState("animating", false),
setContentElement: (value) => disclosure.setState("contentElement", value),
setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
});
}
exports.createDisclosureStore = createDisclosureStore;

42
node_modules/@ariakit/core/cjs/__chunks/TQTGWD5K.cjs generated vendored Normal file
View File

@@ -0,0 +1,42 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _E53JW5BDcjs = require('./E53JW5BD.cjs');
var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
// src/hovercard/hovercard-store.ts
function createHovercardStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const popover = _E53JW5BDcjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
placement: _KBNYGXWIcjs.defaultValue.call(void 0,
props.placement,
syncState == null ? void 0 : syncState.placement,
"bottom"
)
}));
const timeout = _KBNYGXWIcjs.defaultValue.call(void 0, props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover.getState()), {
timeout,
showTimeout: _KBNYGXWIcjs.defaultValue.call(void 0, props.showTimeout, syncState == null ? void 0 : syncState.showTimeout),
hideTimeout: _KBNYGXWIcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
autoFocusOnShow: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
});
const hovercard = _F6HPKLO2cjs.createStore.call(void 0, initialState, popover, props.store);
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover), hovercard), {
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
});
}
exports.createHovercardStore = createHovercardStore;

32
node_modules/@ariakit/core/cjs/__chunks/ULSPM3Y3.cjs generated vendored Normal file
View File

@@ -0,0 +1,32 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
// src/utils/array.ts
function toArray(arg) {
if (Array.isArray(arg)) {
return arg;
}
return typeof arg !== "undefined" ? [arg] : [];
}
function addItemToArray(array, item, index = -1) {
if (!(index in array)) {
return [...array, item];
}
return [...array.slice(0, index), item, ...array.slice(index)];
}
function flatten2DArray(array) {
const flattened = [];
for (const row of array) {
flattened.push(...row);
}
return flattened;
}
function reverseArray(array) {
return array.slice().reverse();
}
exports.toArray = toArray; exports.addItemToArray = addItemToArray; exports.flatten2DArray = flatten2DArray; exports.reverseArray = reverseArray;

31
node_modules/@ariakit/core/cjs/__chunks/YIUPKKEK.cjs generated vendored Normal file
View File

@@ -0,0 +1,31 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _5F4DVUNScjs = require('./5F4DVUNS.cjs');
// src/utils/platform.ts
function isTouchDevice() {
return _5F4DVUNScjs.canUseDOM && !!navigator.maxTouchPoints;
}
function isApple() {
if (!_5F4DVUNScjs.canUseDOM)
return false;
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
}
function isSafari() {
return _5F4DVUNScjs.canUseDOM && isApple() && /apple/i.test(navigator.vendor);
}
function isFirefox() {
return _5F4DVUNScjs.canUseDOM && /firefox\//i.test(navigator.userAgent);
}
function isMac() {
return _5F4DVUNScjs.canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
}
exports.isTouchDevice = isTouchDevice; exports.isApple = isApple; exports.isSafari = isSafari; exports.isFirefox = isFirefox; exports.isMac = isMac;

View File

@@ -0,0 +1,34 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _F6HPKLO2cjs = require('../__chunks/F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
// src/checkbox/checkbox-store.ts
function createCheckboxStore(props = {}) {
var _a;
_F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, props.store);
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const initialState = {
value: _KBNYGXWIcjs.defaultValue.call(void 0,
props.value,
syncState == null ? void 0 : syncState.value,
props.defaultValue,
false
)
};
const checkbox = _F6HPKLO2cjs.createStore.call(void 0, initialState, props.store);
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, checkbox), {
setValue: (value) => checkbox.setState("value", value)
});
}
exports.createCheckboxStore = createCheckboxStore;

View File

@@ -0,0 +1,44 @@
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { PickRequired, SetState, ToPrimitive } from "../utils/types.js";
/**
* Creates a checkbox store.
*/
export declare function createCheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue>(props: PickRequired<CheckboxStoreProps<T>, "value" | "defaultValue">): CheckboxStore<T>;
export declare function createCheckboxStore(props?: CheckboxStoreProps): CheckboxStore;
export type CheckboxStoreValue = boolean | string | number | Array<string | number>;
export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStoreValue> {
/**
* The checked state of the checkbox.
*
* Live examples:
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
*/
value: ToPrimitive<T>;
}
export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
/**
* Sets the [`value`](https://ariakit.org/reference/checkbox-provider#value)
* state.
* @example
* store.setValue(true);
* store.setValue((value) => !value);
*/
setValue: SetState<CheckboxStoreState<T>["value"]>;
}
export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
/**
* The default
* [`value`](https://ariakit.org/reference/checkbox-provider#value) state of
* the checkbox.
*
* Live examples:
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
* - [Checkbox group](https://ariakit.org/examples/checkbox-group)
* @default false
*/
defaultValue?: CheckboxStoreState<T>["value"];
}
export interface CheckboxStoreProps<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreOptions<T>, StoreProps<CheckboxStoreState<T>> {
}
export interface CheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreFunctions<T>, Store<CheckboxStoreState<T>> {
}

View File

@@ -0,0 +1,44 @@
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { PickRequired, SetState, ToPrimitive } from "../utils/types.js";
/**
* Creates a checkbox store.
*/
export declare function createCheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue>(props: PickRequired<CheckboxStoreProps<T>, "value" | "defaultValue">): CheckboxStore<T>;
export declare function createCheckboxStore(props?: CheckboxStoreProps): CheckboxStore;
export type CheckboxStoreValue = boolean | string | number | Array<string | number>;
export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStoreValue> {
/**
* The checked state of the checkbox.
*
* Live examples:
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
*/
value: ToPrimitive<T>;
}
export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
/**
* Sets the [`value`](https://ariakit.org/reference/checkbox-provider#value)
* state.
* @example
* store.setValue(true);
* store.setValue((value) => !value);
*/
setValue: SetState<CheckboxStoreState<T>["value"]>;
}
export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
/**
* The default
* [`value`](https://ariakit.org/reference/checkbox-provider#value) state of
* the checkbox.
*
* Live examples:
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
* - [Checkbox group](https://ariakit.org/examples/checkbox-group)
* @default false
*/
defaultValue?: CheckboxStoreState<T>["value"];
}
export interface CheckboxStoreProps<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreOptions<T>, StoreProps<CheckboxStoreState<T>> {
}
export interface CheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreFunctions<T>, Store<CheckboxStoreState<T>> {
}

View File

@@ -0,0 +1,11 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _MI6NUQYQcjs = require('../__chunks/MI6NUQYQ.cjs');
require('../__chunks/F6HPKLO2.cjs');
require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/5F4DVUNS.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.createCollectionStore = _MI6NUQYQcjs.createCollectionStore;

View File

@@ -0,0 +1,71 @@
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { BivariantCallback } from "../utils/types.js";
/**
* Creates a collection store.
*/
export declare function createCollectionStore<T extends CollectionStoreItem = CollectionStoreItem>(props?: CollectionStoreProps<T>): CollectionStore<T>;
export interface CollectionStoreItem {
/**
* The id of the item.
*/
id: string;
/**
* The item HTML element. This is automatically set when the item is rendered.
*/
element?: HTMLElement | null;
}
export interface CollectionStoreState<T extends CollectionStoreItem = CollectionStoreItem> {
/**
* Lists all items along with their metadata. This state is automatically
* updated when an item is registered or unregistered using the
* [`registerItem`](https://ariakit.org/reference/use-collection-store#registeritem)
* function.
*/
items: T[];
/**
* Lists all items, along with their metadata, in the exact order they appear in
* the DOM. This state is automatically updated when an item is rendered or
* unmounted using the
* [`renderItem`](https://ariakit.org/reference/use-collection-store#renderitem)
* function.
*/
renderedItems: T[];
}
export interface CollectionStoreFunctions<T extends CollectionStoreItem = CollectionStoreItem> {
/**
* Registers an item in the collection. This function returns a cleanup
* function that unregisters the item.
* @example
* const unregisterItem = store.registerItem({ id: "item-1" });
* // on cleanup
* unregisterItem();
*/
registerItem: BivariantCallback<(item: T) => () => void>;
/**
* Renders an item in the collection. This function returns a cleanup function
* that unmounts the item.
* @example
* const unrenderItem = store.renderItem({ id: "item-1" });
* // on cleanup
* unrenderItem();
*/
renderItem: BivariantCallback<(item: T) => () => void>;
/**
* Gets an item by its id.
* @example
* const item = store.item("item-1");
*/
item: (id: string | null | undefined) => T | null;
}
export interface CollectionStoreOptions<T extends CollectionStoreItem = CollectionStoreItem> extends StoreOptions<CollectionStoreState<T>, "items"> {
/**
* The defaut value for the
* [`items`](https://ariakit.org/reference/collection-provider#items) state.
* @default []
*/
defaultItems?: CollectionStoreState<T>["items"];
}
export interface CollectionStoreProps<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreOptions<T>, StoreProps<CollectionStoreState<T>> {
}
export interface CollectionStore<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreFunctions<T>, Store<CollectionStoreState<T>> {
}

View File

@@ -0,0 +1,71 @@
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { BivariantCallback } from "../utils/types.js";
/**
* Creates a collection store.
*/
export declare function createCollectionStore<T extends CollectionStoreItem = CollectionStoreItem>(props?: CollectionStoreProps<T>): CollectionStore<T>;
export interface CollectionStoreItem {
/**
* The id of the item.
*/
id: string;
/**
* The item HTML element. This is automatically set when the item is rendered.
*/
element?: HTMLElement | null;
}
export interface CollectionStoreState<T extends CollectionStoreItem = CollectionStoreItem> {
/**
* Lists all items along with their metadata. This state is automatically
* updated when an item is registered or unregistered using the
* [`registerItem`](https://ariakit.org/reference/use-collection-store#registeritem)
* function.
*/
items: T[];
/**
* Lists all items, along with their metadata, in the exact order they appear in
* the DOM. This state is automatically updated when an item is rendered or
* unmounted using the
* [`renderItem`](https://ariakit.org/reference/use-collection-store#renderitem)
* function.
*/
renderedItems: T[];
}
export interface CollectionStoreFunctions<T extends CollectionStoreItem = CollectionStoreItem> {
/**
* Registers an item in the collection. This function returns a cleanup
* function that unregisters the item.
* @example
* const unregisterItem = store.registerItem({ id: "item-1" });
* // on cleanup
* unregisterItem();
*/
registerItem: BivariantCallback<(item: T) => () => void>;
/**
* Renders an item in the collection. This function returns a cleanup function
* that unmounts the item.
* @example
* const unrenderItem = store.renderItem({ id: "item-1" });
* // on cleanup
* unrenderItem();
*/
renderItem: BivariantCallback<(item: T) => () => void>;
/**
* Gets an item by its id.
* @example
* const item = store.item("item-1");
*/
item: (id: string | null | undefined) => T | null;
}
export interface CollectionStoreOptions<T extends CollectionStoreItem = CollectionStoreItem> extends StoreOptions<CollectionStoreState<T>, "items"> {
/**
* The defaut value for the
* [`items`](https://ariakit.org/reference/collection-provider#items) state.
* @default []
*/
defaultItems?: CollectionStoreState<T>["items"];
}
export interface CollectionStoreProps<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreOptions<T>, StoreProps<CollectionStoreState<T>> {
}
export interface CollectionStore<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreFunctions<T>, Store<CollectionStoreState<T>> {
}

View File

@@ -0,0 +1,152 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _E53JW5BDcjs = require('../__chunks/E53JW5BD.cjs');
require('../__chunks/I3Y4EXEF.cjs');
require('../__chunks/OTVLDMN2.cjs');
var _BFE5R4EZcjs = require('../__chunks/BFE5R4EZ.cjs');
require('../__chunks/MI6NUQYQ.cjs');
var _F6HPKLO2cjs = require('../__chunks/F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
var _YIUPKKEKcjs = require('../__chunks/YIUPKKEK.cjs');
require('../__chunks/5F4DVUNS.cjs');
require('../__chunks/ULSPM3Y3.cjs');
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
// src/combobox/combobox-store.ts
var isSafariOnMobile = _YIUPKKEKcjs.isSafari.call(void 0, ) && _YIUPKKEKcjs.isTouchDevice.call(void 0, );
function createComboboxStore(props = {}) {
var _a;
_F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, props.store);
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const activeId = _KBNYGXWIcjs.defaultValue.call(void 0,
props.activeId,
syncState == null ? void 0 : syncState.activeId,
props.defaultActiveId,
null
);
const composite = _BFE5R4EZcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
activeId,
includesBaseElement: _KBNYGXWIcjs.defaultValue.call(void 0,
props.includesBaseElement,
syncState == null ? void 0 : syncState.includesBaseElement,
true
),
orientation: _KBNYGXWIcjs.defaultValue.call(void 0,
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"vertical"
),
focusLoop: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true),
focusWrap: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true),
virtualFocus: _KBNYGXWIcjs.defaultValue.call(void 0,
props.virtualFocus,
syncState == null ? void 0 : syncState.virtualFocus,
!isSafariOnMobile
)
}));
const popover = _E53JW5BDcjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
placement: _KBNYGXWIcjs.defaultValue.call(void 0,
props.placement,
syncState == null ? void 0 : syncState.placement,
"bottom-start"
)
}));
const value = _KBNYGXWIcjs.defaultValue.call(void 0,
props.value,
syncState == null ? void 0 : syncState.value,
props.defaultValue,
""
);
const selectedValue = _KBNYGXWIcjs.defaultValue.call(void 0,
props.selectedValue,
syncState == null ? void 0 : syncState.selectedValue,
props.defaultSelectedValue,
""
);
const multiSelectable = Array.isArray(selectedValue);
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), popover.getState()), {
value,
selectedValue,
resetValueOnSelect: _KBNYGXWIcjs.defaultValue.call(void 0,
props.resetValueOnSelect,
syncState == null ? void 0 : syncState.resetValueOnSelect,
multiSelectable
),
resetValueOnHide: _KBNYGXWIcjs.defaultValue.call(void 0,
props.resetValueOnHide,
syncState == null ? void 0 : syncState.resetValueOnHide,
multiSelectable
),
activeValue: syncState == null ? void 0 : syncState.activeValue
});
const combobox = _F6HPKLO2cjs.createStore.call(void 0, initialState, composite, popover, props.store);
_F6HPKLO2cjs.setup.call(void 0,
combobox,
() => _F6HPKLO2cjs.sync.call(void 0, combobox, ["resetValueOnHide", "mounted"], (state) => {
if (!state.resetValueOnHide)
return;
if (state.mounted)
return;
combobox.setState("value", value);
})
);
_F6HPKLO2cjs.setup.call(void 0,
combobox,
() => _F6HPKLO2cjs.sync.call(void 0, combobox, ["resetValueOnSelect", "selectedValue"], (state) => {
if (!state.resetValueOnSelect)
return;
combobox.setState("value", value);
})
);
_F6HPKLO2cjs.setup.call(void 0,
combobox,
() => _F6HPKLO2cjs.batch.call(void 0, combobox, ["mounted"], (state) => {
if (state.mounted)
return;
combobox.setState("activeId", activeId);
combobox.setState("moves", 0);
})
);
_F6HPKLO2cjs.setup.call(void 0,
combobox,
() => _F6HPKLO2cjs.sync.call(void 0, combobox, ["moves", "activeId"], (state, prevState) => {
if (state.moves === prevState.moves) {
combobox.setState("activeValue", void 0);
}
})
);
_F6HPKLO2cjs.setup.call(void 0,
combobox,
() => _F6HPKLO2cjs.batch.call(void 0, combobox, ["moves", "renderedItems"], (state, prev) => {
if (state.moves === prev.moves)
return;
const { activeId: activeId2 } = combobox.getState();
const activeItem = composite.item(activeId2);
combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value);
})
);
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover), composite), combobox), {
setValue: (value2) => combobox.setState("value", value2),
setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2)
});
}
exports.createComboboxStore = createComboboxStore;

View File

@@ -0,0 +1,127 @@
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { PickRequired, SetState } from "../utils/types.js";
type MutableValue<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> = T extends string ? string : T;
/**
* Creates a combobox store.
*/
export declare function createComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue>(props: PickRequired<ComboboxStoreProps<T>, "selectedValue" | "defaultSelectedValue">): ComboboxStore<T>;
export declare function createComboboxStore(props?: ComboboxStoreProps): ComboboxStore;
export type ComboboxStoreSelectedValue = string | string[];
export interface ComboboxStoreItem extends CompositeStoreItem {
value?: string;
}
export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreState<ComboboxStoreItem>, PopoverStoreState {
/**
* @default true
*/
includesBaseElement: boolean;
/**
* The combobox input value.
*
* Live examples:
* - [Combobox with integrated
* filter](https://ariakit.org/examples/combobox-filtering-integrated)
* - [Combobox with links](https://ariakit.org/examples/combobox-links)
* - [Combobox filtering](https://ariakit.org/examples/combobox-filtering)
* - [Multi-selectable
* Combobox](https://ariakit.org/examples/combobox-multiple)
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
*/
value: string;
/**
* The value of the currently active item. This state automatically updates as
* the user navigates the combobox items either by keyboard or mouse click.
* Note that it doesn't update when the user simply hovers over the items.
*/
activeValue: string | undefined;
/**
* The value(s) of the currently selected item(s). This can be a string or an
* array of strings. If it's an array, the combobox is considered
* [multi-selectable](https://ariakit.org/examples/combobox-multiple).
*
* Live examples:
* - [Multi-selectable
* Combobox](https://ariakit.org/examples/combobox-multiple)
*/
selectedValue: MutableValue<T>;
/**
* Whether to reset the value when the combobox popover closes. This prop is
* automatically set to `true` by default if the combobox supports multiple
* selections. In other words, if the
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
* or
* [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue)
* props are arrays.
*
* Live examples:
* - [Multi-selectable
* Combobox](https://ariakit.org/examples/combobox-multiple)
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
*/
resetValueOnHide: boolean;
/**
* Whether to reset the value when an item is selected. This prop is
* automatically set to `true` by default if the combobox supports multiple
* selections. In other words, if the
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
* or
* [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue)
* props are arrays.
*
* Live examples:
* - [Multi-selectable
* Combobox](https://ariakit.org/examples/combobox-multiple)
*/
resetValueOnSelect: boolean;
}
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
/**
* Sets the [`value`](https://ariakit.org/reference/combobox-provider#value)
* state.
*
* Live examples:
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
* @example
* store.setValue("Hello world");
* store.setValue((value) => value + "!");
*/
setValue: SetState<ComboboxStoreState<T>["value"]>;
/**
* Sets the
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
* state.
*/
setSelectedValue: SetState<ComboboxStoreState<T>["selectedValue"]>;
}
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions, StoreOptions<ComboboxStoreState<T>, "includesBaseElement" | "value" | "selectedValue" | "resetValueOnHide" | "resetValueOnSelect"> {
/**
* @default null
*/
defaultActiveId?: CompositeStoreOptions<ComboboxStoreItem>["activeId"];
/**
* The initial value of the combobox input.
* @default ""
*/
defaultValue?: ComboboxStoreState<T>["value"];
/**
* The initial value of the
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
* state. This can be a string or an array of strings. If it's an array, the
* combobox is considered
* [multi-selectable](https://ariakit.org/examples/combobox-multiple).
* @default ""
*/
defaultSelectedValue?: ComboboxStoreState<T>["selectedValue"];
}
export interface ComboboxStoreProps<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreOptions<T>, StoreProps<ComboboxStoreState<T>> {
}
export interface ComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreFunctions<T>, Store<ComboboxStoreState<T>> {
}
export {};

View File

@@ -0,0 +1,127 @@
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { PickRequired, SetState } from "../utils/types.js";
type MutableValue<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> = T extends string ? string : T;
/**
* Creates a combobox store.
*/
export declare function createComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue>(props: PickRequired<ComboboxStoreProps<T>, "selectedValue" | "defaultSelectedValue">): ComboboxStore<T>;
export declare function createComboboxStore(props?: ComboboxStoreProps): ComboboxStore;
export type ComboboxStoreSelectedValue = string | string[];
export interface ComboboxStoreItem extends CompositeStoreItem {
value?: string;
}
export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreState<ComboboxStoreItem>, PopoverStoreState {
/**
* @default true
*/
includesBaseElement: boolean;
/**
* The combobox input value.
*
* Live examples:
* - [Combobox with integrated
* filter](https://ariakit.org/examples/combobox-filtering-integrated)
* - [Combobox with links](https://ariakit.org/examples/combobox-links)
* - [Combobox filtering](https://ariakit.org/examples/combobox-filtering)
* - [Multi-selectable
* Combobox](https://ariakit.org/examples/combobox-multiple)
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
*/
value: string;
/**
* The value of the currently active item. This state automatically updates as
* the user navigates the combobox items either by keyboard or mouse click.
* Note that it doesn't update when the user simply hovers over the items.
*/
activeValue: string | undefined;
/**
* The value(s) of the currently selected item(s). This can be a string or an
* array of strings. If it's an array, the combobox is considered
* [multi-selectable](https://ariakit.org/examples/combobox-multiple).
*
* Live examples:
* - [Multi-selectable
* Combobox](https://ariakit.org/examples/combobox-multiple)
*/
selectedValue: MutableValue<T>;
/**
* Whether to reset the value when the combobox popover closes. This prop is
* automatically set to `true` by default if the combobox supports multiple
* selections. In other words, if the
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
* or
* [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue)
* props are arrays.
*
* Live examples:
* - [Multi-selectable
* Combobox](https://ariakit.org/examples/combobox-multiple)
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
*/
resetValueOnHide: boolean;
/**
* Whether to reset the value when an item is selected. This prop is
* automatically set to `true` by default if the combobox supports multiple
* selections. In other words, if the
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
* or
* [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue)
* props are arrays.
*
* Live examples:
* - [Multi-selectable
* Combobox](https://ariakit.org/examples/combobox-multiple)
*/
resetValueOnSelect: boolean;
}
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
/**
* Sets the [`value`](https://ariakit.org/reference/combobox-provider#value)
* state.
*
* Live examples:
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
* @example
* store.setValue("Hello world");
* store.setValue((value) => value + "!");
*/
setValue: SetState<ComboboxStoreState<T>["value"]>;
/**
* Sets the
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
* state.
*/
setSelectedValue: SetState<ComboboxStoreState<T>["selectedValue"]>;
}
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions, StoreOptions<ComboboxStoreState<T>, "includesBaseElement" | "value" | "selectedValue" | "resetValueOnHide" | "resetValueOnSelect"> {
/**
* @default null
*/
defaultActiveId?: CompositeStoreOptions<ComboboxStoreItem>["activeId"];
/**
* The initial value of the combobox input.
* @default ""
*/
defaultValue?: ComboboxStoreState<T>["value"];
/**
* The initial value of the
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
* state. This can be a string or an array of strings. If it's an array, the
* combobox is considered
* [multi-selectable](https://ariakit.org/examples/combobox-multiple).
* @default ""
*/
defaultSelectedValue?: ComboboxStoreState<T>["selectedValue"];
}
export interface ComboboxStoreProps<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreOptions<T>, StoreProps<ComboboxStoreState<T>> {
}
export interface ComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreFunctions<T>, Store<ComboboxStoreState<T>> {
}
export {};

View File

@@ -0,0 +1,17 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _E53JW5BDcjs = require('../__chunks/E53JW5BD.cjs');
require('../__chunks/I3Y4EXEF.cjs');
require('../__chunks/OTVLDMN2.cjs');
require('../__chunks/F6HPKLO2.cjs');
require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/AV6KTKLE.cjs');
// src/composite/composite-overflow-store.ts
function createCompositeOverflowStore(props = {}) {
return _E53JW5BDcjs.createPopoverStore.call(void 0, props);
}
exports.createCompositeOverflowStore = createCompositeOverflowStore;

View File

@@ -0,0 +1,16 @@
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
import type { Store, StoreProps } from "../utils/store.js";
/**
* Creates a compositeOverflow store.
*/
export declare function createCompositeOverflowStore(props?: CompositeOverflowStoreProps): CompositeOverflowStore;
export interface CompositeOverflowStoreState extends PopoverStoreState {
}
export interface CompositeOverflowStoreFunctions extends PopoverStoreFunctions {
}
export interface CompositeOverflowStoreOptions extends PopoverStoreOptions {
}
export interface CompositeOverflowStoreProps extends CompositeOverflowStoreOptions, StoreProps<CompositeOverflowStoreState> {
}
export interface CompositeOverflowStore extends CompositeOverflowStoreFunctions, Store<CompositeOverflowStoreState> {
}

View File

@@ -0,0 +1,16 @@
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
import type { Store, StoreProps } from "../utils/store.js";
/**
* Creates a compositeOverflow store.
*/
export declare function createCompositeOverflowStore(props?: CompositeOverflowStoreProps): CompositeOverflowStore;
export interface CompositeOverflowStoreState extends PopoverStoreState {
}
export interface CompositeOverflowStoreFunctions extends PopoverStoreFunctions {
}
export interface CompositeOverflowStoreOptions extends PopoverStoreOptions {
}
export interface CompositeOverflowStoreProps extends CompositeOverflowStoreOptions, StoreProps<CompositeOverflowStoreState> {
}
export interface CompositeOverflowStore extends CompositeOverflowStoreFunctions, Store<CompositeOverflowStoreState> {
}

View File

@@ -0,0 +1,13 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _BFE5R4EZcjs = require('../__chunks/BFE5R4EZ.cjs');
require('../__chunks/MI6NUQYQ.cjs');
require('../__chunks/F6HPKLO2.cjs');
require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/5F4DVUNS.cjs');
require('../__chunks/ULSPM3Y3.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.createCompositeStore = _BFE5R4EZcjs.createCompositeStore;

View File

@@ -0,0 +1,295 @@
import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOptions, CollectionStoreState } from "../collection/collection-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
type Orientation = "horizontal" | "vertical" | "both";
/**
* Creates a composite store.
*/
export declare function createCompositeStore<T extends CompositeStoreItem = CompositeStoreItem>(props?: CompositeStoreProps<T>): CompositeStore<T>;
export type CompositeStoreOrientation = Orientation;
export interface CompositeStoreItem extends CollectionStoreItem {
/**
* The row id of the item. This is only used on two-dimensional composite
* widgets (when using
* [`CompositeRow`](https://ariakit.org/reference/composite-row)).
*/
rowId?: string;
/**
* If enabled, the item will be disabled and users won't be able to focus on
* it using arrow keys.
*/
disabled?: boolean;
/**
* The item children. This can be used for typeahead purposes.
*/
children?: string;
}
export interface CompositeStoreState<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreState<T> {
/**
* The composite element itself. Typically, it's the wrapper element that
* contains composite items. However, in a combobox, it's the input element.
*
* Live examples:
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
*/
baseElement: HTMLElement | null;
/**
* If enabled, the composite element will act as an
* [aria-activedescendant](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_activedescendant)
* container instead of [roving
* tabindex](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex).
* DOM focus will remain on the composite element while its items receive
* virtual focus.
*
* In both scenarios, the item in focus will carry the
* [`data-active-item`](https://ariakit.org/guide/styling#data-active-item)
* attribute.
* @default false
*/
virtualFocus: boolean;
/**
* Defines the orientation of the composite widget. If the composite has a
* single row or column (one-dimensional), the `orientation` value determines
* which arrow keys can be used to move focus:
* - `both`: all arrow keys work.
* - `horizontal`: only left and right arrow keys work.
* - `vertical`: only up and down arrow keys work.
*
* It doesn't have any effect on two-dimensional composites.
* @default "both"
*/
orientation: Orientation;
/**
* Determines how the
* [`next`](https://ariakit.org/reference/use-composite-store#next) and
* [`previous`](https://ariakit.org/reference/use-composite-store#previous)
* functions will behave. If `rtl` is set to `true`, they will be inverted.
*
* This only affects the composite widget behavior. You still need to set
* `dir="rtl"` on HTML/CSS.
* @default false
*/
rtl: boolean;
/**
* Determines how the focus behaves when the user reaches the end of the
* composite widget.
*
* On one-dimensional composite widgets:
* - `true` loops from the last item to the first item and vice-versa.
* - `horizontal` loops only if
* [`orientation`](https://ariakit.org/reference/composite-provider#orientation)
* is `horizontal` or not set.
* - `vertical` loops only if
* [`orientation`](https://ariakit.org/reference/composite-provider#orientation)
* is `vertical` or not set.
* - If
* [`includesBaseElement`](https://ariakit.org/reference/composite-provider#includesbaseelement)
* is set to `true` (or
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* is initially set to `null`), the composite element will be focused in
* between the last and first items.
*
* On two-dimensional composite widgets (when using
* [`CompositeRow`](https://ariakit.org/reference/composite-row) or explicitly
* passing a [`rowId`](https://ariakit.org/reference/composite-item#rowid)
* prop to composite items):
* - `true` loops from the last row/column item to the first item in the same
* row/column and vice-versa. If it's the last item in the last row, it
* moves to the first item in the first row and vice-versa.
* - `horizontal` loops only from the last row item to the first item in the
* same row.
* - `vertical` loops only from the last column item to the first item in the
* column row.
* - If
* [`includesBaseElement`](https://ariakit.org/reference/composite-provider#includesbaseelement)
* is set to `true` (or
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* is initially set to `null`), vertical loop will have no effect as moving
* down from the last row or up from the first row will focus on the
* composite element.
* - If
* [`focusWrap`](https://ariakit.org/reference/composite-provider#focuswrap)
* matches the value of `focusLoop`, it'll wrap between the last item in the
* last row or column and the first item in the first row or column and
* vice-versa.
* @default false
*/
focusLoop: boolean | Orientation;
/**
* **Works only on two-dimensional composite widgets**.
*
* If enabled, moving to the next item from the last one in a row or column
* will focus on the first item in the next row or column and vice-versa.
* - `true` wraps between rows and columns.
* - `horizontal` wraps only between rows.
* - `vertical` wraps only between columns.
* - If
* [`focusLoop`](https://ariakit.org/reference/composite-provider#focusloop)
* matches the value of `focusWrap`, it'll wrap between the last item in the
* last row or column and the first item in the first row or column and
* vice-versa.
* @default false
*/
focusWrap: boolean | Orientation;
/**
* **Works only on two-dimensional composite widgets**.
*
* If enabled, moving up or down when there's no next item or when the next
* item is disabled will shift to the item right before it.
* @default false
*/
focusShift: boolean;
/**
* The number of times the
* [`move`](https://ariakit.org/reference/use-composite-store#move) function
* has been called.
*/
moves: number;
/**
* Indicates if the composite base element (the one with a [composite
* role](https://w3c.github.io/aria/#composite)) should be part of the focus
* order when navigating with arrow keys. In other words, moving to the
* previous element when the first item is in focus will focus on the
* composite element itself. The same applies to the last item when moving to
* the next element.
*
* Live examples:
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
* @default false
*/
includesBaseElement: boolean;
/**
* The current active item `id`. The active item is the element within the
* composite widget that has either DOM or virtual focus (in case
* [`virtualFocus`](https://ariakit.org/reference/composite-provider#virtualfocus)
* is enabled).
* - `null` represents the base composite element (the one with a [composite
* role](https://w3c.github.io/aria/#composite)). Users will be able to
* navigate out of it using arrow keys.
* - If `activeId` is initially set to `null`, the
* [`includesBaseElement`](https://ariakit.org/reference/composite-provider#includesbaseelement)
* prop will also default to `true`, which means the base composite element
* itself will have focus and users will be able to navigate to it using
* arrow keys.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
*/
activeId: string | null | undefined;
}
export interface CompositeStoreFunctions<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreFunctions<T> {
/**
* Sets the `baseElement` state.
*/
setBaseElement: SetState<CompositeStoreState<T>["baseElement"]>;
/**
* Sets the
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* state _without moving focus_. If you want to move focus, use the
* [`move`](https://ariakit.org/reference/use-composite-store#move) function
* instead.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
* @example
* // Sets the composite element as the active item
* store.setActiveId(null);
* // Sets the item with id "item-1" as the active item
* store.setActiveId("item-1");
* // Sets the next item as the active item
* store.setActiveId(store.next());
*/
setActiveId: SetState<CompositeStoreState<T>["activeId"]>;
/**
* Moves focus to a given item id and sets it as the active item.
* - Passing `null` will focus on the composite element itself (the one with a
* [composite role](https://w3c.github.io/aria/#composite)). Users will be
* able to navigate out of it using arrow keys.
* - If you want to set the active item id _without moving focus_, use the
* [`setActiveId`](https://ariakit.org/reference/use-composite-store#setactiveid)
* function instead.
*
* Live examples:
* - [Select Grid](https://ariakit.org/examples/select-grid)
* @example
* // Moves focus to the composite element
* store.move(null);
* // Moves focus to the item with id "item-1"
* store.move("item-1");
* // Moves focus to the next item
* store.move(store.next());
*/
move: (id?: string | null) => void;
/**
* Returns the id of the next enabled item based on the current
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* state.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
* @example
* const nextId = store.next();
* const nextNextId = store.next(2);
*/
next: (skip?: number) => string | null | undefined;
/**
* Returns the id of the previous enabled item based on the current
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* state.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
* @example
* const previousId = store.previous();
* const previousPreviousId = store.previous(2);
*/
previous: (skip?: number) => string | null | undefined;
/**
* Returns the id of the enabled item above based on the current
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* state.
* @example
* const upId = store.up();
* const upUpId = store.up(2);
*/
up: (skip?: number) => string | null | undefined;
/**
* Returns the id of the enabled item below based on the current
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* state.
* @example
* const downId = store.down();
* const downDownId = store.down(2);
*/
down: (skip?: number) => string | null | undefined;
/**
* Returns the id of the first enabled item.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
*/
first: () => string | null | undefined;
/**
* Returns the id of the last enabled item.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
*/
last: () => string | null | undefined;
}
export interface CompositeStoreOptions<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreOptions<T>, StoreOptions<CompositeStoreState<T>, "virtualFocus" | "orientation" | "rtl" | "focusLoop" | "focusWrap" | "focusShift" | "includesBaseElement" | "activeId"> {
/**
* The composite item id that should be active by default when the composite
* widget is rendered. If `null`, the composite element itself will have focus
* and users will be able to navigate to it using arrow keys. If `undefined`,
* the first enabled item will be focused.
*/
defaultActiveId?: CompositeStoreState<T>["activeId"];
}
export interface CompositeStoreProps<T extends CompositeStoreItem = CompositeStoreItem> extends CompositeStoreOptions<T>, StoreProps<CompositeStoreState<T>> {
}
export interface CompositeStore<T extends CompositeStoreItem = CompositeStoreItem> extends CompositeStoreFunctions<T>, Store<CompositeStoreState<T>> {
}
export {};

View File

@@ -0,0 +1,295 @@
import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOptions, CollectionStoreState } from "../collection/collection-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
type Orientation = "horizontal" | "vertical" | "both";
/**
* Creates a composite store.
*/
export declare function createCompositeStore<T extends CompositeStoreItem = CompositeStoreItem>(props?: CompositeStoreProps<T>): CompositeStore<T>;
export type CompositeStoreOrientation = Orientation;
export interface CompositeStoreItem extends CollectionStoreItem {
/**
* The row id of the item. This is only used on two-dimensional composite
* widgets (when using
* [`CompositeRow`](https://ariakit.org/reference/composite-row)).
*/
rowId?: string;
/**
* If enabled, the item will be disabled and users won't be able to focus on
* it using arrow keys.
*/
disabled?: boolean;
/**
* The item children. This can be used for typeahead purposes.
*/
children?: string;
}
export interface CompositeStoreState<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreState<T> {
/**
* The composite element itself. Typically, it's the wrapper element that
* contains composite items. However, in a combobox, it's the input element.
*
* Live examples:
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
*/
baseElement: HTMLElement | null;
/**
* If enabled, the composite element will act as an
* [aria-activedescendant](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_activedescendant)
* container instead of [roving
* tabindex](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex).
* DOM focus will remain on the composite element while its items receive
* virtual focus.
*
* In both scenarios, the item in focus will carry the
* [`data-active-item`](https://ariakit.org/guide/styling#data-active-item)
* attribute.
* @default false
*/
virtualFocus: boolean;
/**
* Defines the orientation of the composite widget. If the composite has a
* single row or column (one-dimensional), the `orientation` value determines
* which arrow keys can be used to move focus:
* - `both`: all arrow keys work.
* - `horizontal`: only left and right arrow keys work.
* - `vertical`: only up and down arrow keys work.
*
* It doesn't have any effect on two-dimensional composites.
* @default "both"
*/
orientation: Orientation;
/**
* Determines how the
* [`next`](https://ariakit.org/reference/use-composite-store#next) and
* [`previous`](https://ariakit.org/reference/use-composite-store#previous)
* functions will behave. If `rtl` is set to `true`, they will be inverted.
*
* This only affects the composite widget behavior. You still need to set
* `dir="rtl"` on HTML/CSS.
* @default false
*/
rtl: boolean;
/**
* Determines how the focus behaves when the user reaches the end of the
* composite widget.
*
* On one-dimensional composite widgets:
* - `true` loops from the last item to the first item and vice-versa.
* - `horizontal` loops only if
* [`orientation`](https://ariakit.org/reference/composite-provider#orientation)
* is `horizontal` or not set.
* - `vertical` loops only if
* [`orientation`](https://ariakit.org/reference/composite-provider#orientation)
* is `vertical` or not set.
* - If
* [`includesBaseElement`](https://ariakit.org/reference/composite-provider#includesbaseelement)
* is set to `true` (or
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* is initially set to `null`), the composite element will be focused in
* between the last and first items.
*
* On two-dimensional composite widgets (when using
* [`CompositeRow`](https://ariakit.org/reference/composite-row) or explicitly
* passing a [`rowId`](https://ariakit.org/reference/composite-item#rowid)
* prop to composite items):
* - `true` loops from the last row/column item to the first item in the same
* row/column and vice-versa. If it's the last item in the last row, it
* moves to the first item in the first row and vice-versa.
* - `horizontal` loops only from the last row item to the first item in the
* same row.
* - `vertical` loops only from the last column item to the first item in the
* column row.
* - If
* [`includesBaseElement`](https://ariakit.org/reference/composite-provider#includesbaseelement)
* is set to `true` (or
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* is initially set to `null`), vertical loop will have no effect as moving
* down from the last row or up from the first row will focus on the
* composite element.
* - If
* [`focusWrap`](https://ariakit.org/reference/composite-provider#focuswrap)
* matches the value of `focusLoop`, it'll wrap between the last item in the
* last row or column and the first item in the first row or column and
* vice-versa.
* @default false
*/
focusLoop: boolean | Orientation;
/**
* **Works only on two-dimensional composite widgets**.
*
* If enabled, moving to the next item from the last one in a row or column
* will focus on the first item in the next row or column and vice-versa.
* - `true` wraps between rows and columns.
* - `horizontal` wraps only between rows.
* - `vertical` wraps only between columns.
* - If
* [`focusLoop`](https://ariakit.org/reference/composite-provider#focusloop)
* matches the value of `focusWrap`, it'll wrap between the last item in the
* last row or column and the first item in the first row or column and
* vice-versa.
* @default false
*/
focusWrap: boolean | Orientation;
/**
* **Works only on two-dimensional composite widgets**.
*
* If enabled, moving up or down when there's no next item or when the next
* item is disabled will shift to the item right before it.
* @default false
*/
focusShift: boolean;
/**
* The number of times the
* [`move`](https://ariakit.org/reference/use-composite-store#move) function
* has been called.
*/
moves: number;
/**
* Indicates if the composite base element (the one with a [composite
* role](https://w3c.github.io/aria/#composite)) should be part of the focus
* order when navigating with arrow keys. In other words, moving to the
* previous element when the first item is in focus will focus on the
* composite element itself. The same applies to the last item when moving to
* the next element.
*
* Live examples:
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
* @default false
*/
includesBaseElement: boolean;
/**
* The current active item `id`. The active item is the element within the
* composite widget that has either DOM or virtual focus (in case
* [`virtualFocus`](https://ariakit.org/reference/composite-provider#virtualfocus)
* is enabled).
* - `null` represents the base composite element (the one with a [composite
* role](https://w3c.github.io/aria/#composite)). Users will be able to
* navigate out of it using arrow keys.
* - If `activeId` is initially set to `null`, the
* [`includesBaseElement`](https://ariakit.org/reference/composite-provider#includesbaseelement)
* prop will also default to `true`, which means the base composite element
* itself will have focus and users will be able to navigate to it using
* arrow keys.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
*/
activeId: string | null | undefined;
}
export interface CompositeStoreFunctions<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreFunctions<T> {
/**
* Sets the `baseElement` state.
*/
setBaseElement: SetState<CompositeStoreState<T>["baseElement"]>;
/**
* Sets the
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* state _without moving focus_. If you want to move focus, use the
* [`move`](https://ariakit.org/reference/use-composite-store#move) function
* instead.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
* @example
* // Sets the composite element as the active item
* store.setActiveId(null);
* // Sets the item with id "item-1" as the active item
* store.setActiveId("item-1");
* // Sets the next item as the active item
* store.setActiveId(store.next());
*/
setActiveId: SetState<CompositeStoreState<T>["activeId"]>;
/**
* Moves focus to a given item id and sets it as the active item.
* - Passing `null` will focus on the composite element itself (the one with a
* [composite role](https://w3c.github.io/aria/#composite)). Users will be
* able to navigate out of it using arrow keys.
* - If you want to set the active item id _without moving focus_, use the
* [`setActiveId`](https://ariakit.org/reference/use-composite-store#setactiveid)
* function instead.
*
* Live examples:
* - [Select Grid](https://ariakit.org/examples/select-grid)
* @example
* // Moves focus to the composite element
* store.move(null);
* // Moves focus to the item with id "item-1"
* store.move("item-1");
* // Moves focus to the next item
* store.move(store.next());
*/
move: (id?: string | null) => void;
/**
* Returns the id of the next enabled item based on the current
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* state.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
* @example
* const nextId = store.next();
* const nextNextId = store.next(2);
*/
next: (skip?: number) => string | null | undefined;
/**
* Returns the id of the previous enabled item based on the current
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* state.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
* @example
* const previousId = store.previous();
* const previousPreviousId = store.previous(2);
*/
previous: (skip?: number) => string | null | undefined;
/**
* Returns the id of the enabled item above based on the current
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* state.
* @example
* const upId = store.up();
* const upUpId = store.up(2);
*/
up: (skip?: number) => string | null | undefined;
/**
* Returns the id of the enabled item below based on the current
* [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
* state.
* @example
* const downId = store.down();
* const downDownId = store.down(2);
*/
down: (skip?: number) => string | null | undefined;
/**
* Returns the id of the first enabled item.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
*/
first: () => string | null | undefined;
/**
* Returns the id of the last enabled item.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
*/
last: () => string | null | undefined;
}
export interface CompositeStoreOptions<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreOptions<T>, StoreOptions<CompositeStoreState<T>, "virtualFocus" | "orientation" | "rtl" | "focusLoop" | "focusWrap" | "focusShift" | "includesBaseElement" | "activeId"> {
/**
* The composite item id that should be active by default when the composite
* widget is rendered. If `null`, the composite element itself will have focus
* and users will be able to navigate to it using arrow keys. If `undefined`,
* the first enabled item will be focused.
*/
defaultActiveId?: CompositeStoreState<T>["activeId"];
}
export interface CompositeStoreProps<T extends CompositeStoreItem = CompositeStoreItem> extends CompositeStoreOptions<T>, StoreProps<CompositeStoreState<T>> {
}
export interface CompositeStore<T extends CompositeStoreItem = CompositeStoreItem> extends CompositeStoreFunctions<T>, Store<CompositeStoreState<T>> {
}
export {};

11
node_modules/@ariakit/core/cjs/dialog/dialog-store.cjs generated vendored Normal file
View File

@@ -0,0 +1,11 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _I3Y4EXEFcjs = require('../__chunks/I3Y4EXEF.cjs');
require('../__chunks/OTVLDMN2.cjs');
require('../__chunks/F6HPKLO2.cjs');
require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.createDialogStore = _I3Y4EXEFcjs.createDialogStore;

View File

@@ -0,0 +1,16 @@
import type { DisclosureStoreFunctions, DisclosureStoreOptions, DisclosureStoreState } from "../disclosure/disclosure-store.js";
import type { Store, StoreProps } from "../utils/store.js";
/**
* Creates a dialog store.
*/
export declare function createDialogStore(props?: DialogStoreProps): DialogStore;
export interface DialogStoreState extends DisclosureStoreState {
}
export interface DialogStoreFunctions extends DisclosureStoreFunctions {
}
export interface DialogStoreOptions extends DisclosureStoreOptions {
}
export interface DialogStoreProps extends DialogStoreOptions, StoreProps<DialogStoreState> {
}
export interface DialogStore extends DialogStoreFunctions, Store<DialogStoreState> {
}

View File

@@ -0,0 +1,16 @@
import type { DisclosureStoreFunctions, DisclosureStoreOptions, DisclosureStoreState } from "../disclosure/disclosure-store.js";
import type { Store, StoreProps } from "../utils/store.js";
/**
* Creates a dialog store.
*/
export declare function createDialogStore(props?: DialogStoreProps): DialogStore;
export interface DialogStoreState extends DisclosureStoreState {
}
export interface DialogStoreFunctions extends DisclosureStoreFunctions {
}
export interface DialogStoreOptions extends DisclosureStoreOptions {
}
export interface DialogStoreProps extends DialogStoreOptions, StoreProps<DialogStoreState> {
}
export interface DialogStore extends DialogStoreFunctions, Store<DialogStoreState> {
}

View File

@@ -0,0 +1,10 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _OTVLDMN2cjs = require('../__chunks/OTVLDMN2.cjs');
require('../__chunks/F6HPKLO2.cjs');
require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.createDisclosureStore = _OTVLDMN2cjs.createDisclosureStore;

View File

@@ -0,0 +1,135 @@
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
/**
* Creates a disclosure store.
*/
export declare function createDisclosureStore(props?: DisclosureStoreProps): DisclosureStore;
export interface DisclosureStoreState {
/**
* Whether the content is visible.
*
* Live examples:
* - [Combobox with links](https://ariakit.org/examples/combobox-links)
* - [Dialog with React
* Router](https://ariakit.org/examples/dialog-react-router)
* - [Menu with Framer
* Motion](https://ariakit.org/examples/menu-framer-motion)
* - [Lazy Popover](https://ariakit.org/examples/popover-lazy)
* @default false
*/
open: boolean;
/**
* The mounted state usually matches the
* [`open`](https://ariakit.org/reference/disclosure-provider#open) value.
* However, if the content element is animated, it waits for the animation to
* finish before turning `false`. This ensures the content element doesn't get
* unmounted during the animation.
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
* - [Responsive Popover](https://ariakit.org/examples/popover-responsive)
*/
mounted: boolean;
/**
* Determines whether the content should animate when it is shown or hidden.
* - If `true`, the `animating` state will be `true` when the content is shown
* or hidden and it will wait for a CSS animation/transition to end before
* becoming `false`.
* - If it's set to a number, the `animating` state will be `true` when the
* content is shown or hidden and it will wait for the number of
* milliseconds to pass before becoming `false`.
* @default false
*/
animated: boolean | number;
/**
* Whether the content is currently animating.
*/
animating: boolean;
/**
* The content element that is being shown or hidden.
*/
contentElement: HTMLElement | null;
/**
* The disclosure button element that toggles the content.
*/
disclosureElement: HTMLElement | null;
}
export interface DisclosureStoreFunctions {
/**
* Sets the [`open`](https://ariakit.org/reference/disclosure-provider#open)
* state.
*
* Live examples:
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
* @example
* store.setOpen(true);
* store.setOpen((open) => !open);
*/
setOpen: SetState<DisclosureStoreState["open"]>;
/**
* Sets the [`open`](https://ariakit.org/reference/disclosure-provider#open)
* state to `true`.
*
* Live examples:
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
* - [Dialog with Framer
* Motion](https://ariakit.org/examples/dialog-framer-motion)
* - [Context Menu](https://ariakit.org/examples/menu-context-menu)
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
*/
show: () => void;
/**
* Sets the [`open`](https://ariakit.org/reference/disclosure-provider#open)
* state to `false`.
*
* Live examples:
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
*/
hide: () => void;
/**
* Toggles the
* [`open`](https://ariakit.org/reference/disclosure-provider#open) state.
*/
toggle: () => void;
/**
* Sets the `animating` state to `false`, which will automatically set the
* `mounted` state to `false` if it was `true`. This means that the content
* element can be safely unmounted.
* @deprecated Use `setState("animating", false)` instead.
*/
stopAnimation: () => void;
/**
* Sets the `contentElement` state.
*/
setContentElement: SetState<DisclosureStoreState["contentElement"]>;
/**
* Sets the `disclosureElement` state.
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
*/
setDisclosureElement: SetState<DisclosureStoreState["disclosureElement"]>;
}
export interface DisclosureStoreOptions extends StoreOptions<DisclosureStoreState, "open" | "animated"> {
/**
* Whether the content should be visible by default.
* @default false
*/
defaultOpen?: DisclosureStoreState["open"];
/**
* A reference to another disclosure store that controls another disclosure
* component to keep them in sync. Element states like `contentElement` and
* `disclosureElement` won't be synced. For that, use the
* [`store`](https://ariakit.org/reference/disclosure-provider#store) prop
* instead.
*/
disclosure?: DisclosureStore | null;
}
export interface DisclosureStoreProps extends DisclosureStoreOptions, StoreProps<DisclosureStoreState> {
}
export interface DisclosureStore extends DisclosureStoreFunctions, Store<DisclosureStoreState> {
}

View File

@@ -0,0 +1,135 @@
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
/**
* Creates a disclosure store.
*/
export declare function createDisclosureStore(props?: DisclosureStoreProps): DisclosureStore;
export interface DisclosureStoreState {
/**
* Whether the content is visible.
*
* Live examples:
* - [Combobox with links](https://ariakit.org/examples/combobox-links)
* - [Dialog with React
* Router](https://ariakit.org/examples/dialog-react-router)
* - [Menu with Framer
* Motion](https://ariakit.org/examples/menu-framer-motion)
* - [Lazy Popover](https://ariakit.org/examples/popover-lazy)
* @default false
*/
open: boolean;
/**
* The mounted state usually matches the
* [`open`](https://ariakit.org/reference/disclosure-provider#open) value.
* However, if the content element is animated, it waits for the animation to
* finish before turning `false`. This ensures the content element doesn't get
* unmounted during the animation.
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
* - [Responsive Popover](https://ariakit.org/examples/popover-responsive)
*/
mounted: boolean;
/**
* Determines whether the content should animate when it is shown or hidden.
* - If `true`, the `animating` state will be `true` when the content is shown
* or hidden and it will wait for a CSS animation/transition to end before
* becoming `false`.
* - If it's set to a number, the `animating` state will be `true` when the
* content is shown or hidden and it will wait for the number of
* milliseconds to pass before becoming `false`.
* @default false
*/
animated: boolean | number;
/**
* Whether the content is currently animating.
*/
animating: boolean;
/**
* The content element that is being shown or hidden.
*/
contentElement: HTMLElement | null;
/**
* The disclosure button element that toggles the content.
*/
disclosureElement: HTMLElement | null;
}
export interface DisclosureStoreFunctions {
/**
* Sets the [`open`](https://ariakit.org/reference/disclosure-provider#open)
* state.
*
* Live examples:
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
* @example
* store.setOpen(true);
* store.setOpen((open) => !open);
*/
setOpen: SetState<DisclosureStoreState["open"]>;
/**
* Sets the [`open`](https://ariakit.org/reference/disclosure-provider#open)
* state to `true`.
*
* Live examples:
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
* - [Dialog with Framer
* Motion](https://ariakit.org/examples/dialog-framer-motion)
* - [Context Menu](https://ariakit.org/examples/menu-context-menu)
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
*/
show: () => void;
/**
* Sets the [`open`](https://ariakit.org/reference/disclosure-provider#open)
* state to `false`.
*
* Live examples:
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
*/
hide: () => void;
/**
* Toggles the
* [`open`](https://ariakit.org/reference/disclosure-provider#open) state.
*/
toggle: () => void;
/**
* Sets the `animating` state to `false`, which will automatically set the
* `mounted` state to `false` if it was `true`. This means that the content
* element can be safely unmounted.
* @deprecated Use `setState("animating", false)` instead.
*/
stopAnimation: () => void;
/**
* Sets the `contentElement` state.
*/
setContentElement: SetState<DisclosureStoreState["contentElement"]>;
/**
* Sets the `disclosureElement` state.
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
*/
setDisclosureElement: SetState<DisclosureStoreState["disclosureElement"]>;
}
export interface DisclosureStoreOptions extends StoreOptions<DisclosureStoreState, "open" | "animated"> {
/**
* Whether the content should be visible by default.
* @default false
*/
defaultOpen?: DisclosureStoreState["open"];
/**
* A reference to another disclosure store that controls another disclosure
* component to keep them in sync. Element states like `contentElement` and
* `disclosureElement` won't be synced. For that, use the
* [`store`](https://ariakit.org/reference/disclosure-provider#store) prop
* instead.
*/
disclosure?: DisclosureStore | null;
}
export interface DisclosureStoreProps extends DisclosureStoreOptions, StoreProps<DisclosureStoreState> {
}
export interface DisclosureStore extends DisclosureStoreFunctions, Store<DisclosureStoreState> {
}

272
node_modules/@ariakit/core/cjs/form/form-store.cjs generated vendored Normal file
View File

@@ -0,0 +1,272 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _MI6NUQYQcjs = require('../__chunks/MI6NUQYQ.cjs');
var _F6HPKLO2cjs = require('../__chunks/F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/5F4DVUNS.cjs');
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
// src/form/form-store.ts
function nextFrame() {
return new Promise((resolve) => requestAnimationFrame(() => resolve()));
}
function hasMessages(object) {
return Object.keys(object).some((key) => {
if (_KBNYGXWIcjs.isObject.call(void 0, object[key])) {
return hasMessages(object[key]);
}
return !!object[key];
});
}
function get(values, path, defaultValue2) {
var _a;
const [key, ...rest] = Array.isArray(path) ? path : `${path}`.split(".");
if (key == null || !values) {
return defaultValue2;
}
if (!rest.length) {
return (_a = values[key]) != null ? _a : defaultValue2;
}
return get(values[key], rest, defaultValue2);
}
function set(values, path, value) {
const [k, ...rest] = Array.isArray(path) ? path : `${path}`.split(".");
if (k == null)
return values;
const key = k;
const isIntegerKey = _KBNYGXWIcjs.isInteger.call(void 0, key);
const nextValues = isIntegerKey ? values || [] : values || {};
const nestedValues = nextValues[key];
const result = rest.length && (Array.isArray(nestedValues) || _KBNYGXWIcjs.isObject.call(void 0, nestedValues)) ? set(nestedValues, rest, value) : value;
if (isIntegerKey) {
const index = Number(key);
if (values && Array.isArray(values)) {
return [
...values.slice(0, index),
result,
...values.slice(index + 1)
];
}
const nextValues2 = [];
nextValues2[index] = result;
return nextValues2;
}
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, values), { [key]: result });
}
function setAll(values, value) {
const result = {};
const keys = Object.keys(values);
for (const key of keys) {
const currentValue = values[key];
if (Array.isArray(currentValue)) {
result[key] = currentValue.map((v) => {
if (_KBNYGXWIcjs.isObject.call(void 0, v)) {
return setAll(v, value);
}
return value;
});
} else if (_KBNYGXWIcjs.isObject.call(void 0, currentValue)) {
result[key] = setAll(currentValue, value);
} else {
result[key] = value;
}
}
return result;
}
function getNameHandler(cache, prevKeys = []) {
const handler = {
get(target, key) {
if (["toString", "valueOf", Symbol.toPrimitive].includes(key)) {
return () => prevKeys.join(".");
}
const nextKeys = [...prevKeys, key];
const nextKey = nextKeys.join(".");
if (cache[nextKey]) {
return cache[nextKey];
}
const nextProxy = new Proxy(target, getNameHandler(cache, nextKeys));
cache[nextKey] = nextProxy;
return nextProxy;
}
};
return handler;
}
function getStoreCallbacks(store) {
return store == null ? void 0 : store.__unstableCallbacks;
}
function createNames() {
const cache = /* @__PURE__ */ Object.create(null);
return new Proxy(/* @__PURE__ */ Object.create(null), getNameHandler(cache));
}
function createFormStore(props = {}) {
var _a;
_F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, props.store);
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const collection = _MI6NUQYQcjs.createCollectionStore.call(void 0, props);
const values = _KBNYGXWIcjs.defaultValue.call(void 0,
props.values,
syncState == null ? void 0 : syncState.values,
props.defaultValues,
{}
);
const errors = _KBNYGXWIcjs.defaultValue.call(void 0,
props.errors,
syncState == null ? void 0 : syncState.errors,
props.defaultErrors,
{}
);
const touched = _KBNYGXWIcjs.defaultValue.call(void 0,
props.touched,
syncState == null ? void 0 : syncState.touched,
props.defaultTouched,
{}
);
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection.getState()), {
values,
errors,
touched,
validating: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.validating, false),
submitting: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitting, false),
submitSucceed: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitSucceed, 0),
submitFailed: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitFailed, 0),
valid: !hasMessages(errors)
});
const form = _F6HPKLO2cjs.createStore.call(void 0, initialState, collection, props.store);
const syncCallbacks = getStoreCallbacks(props.store);
const syncCallbacksState = syncCallbacks == null ? void 0 : syncCallbacks.getState();
const callbacksInitialState = {
validate: (syncCallbacksState == null ? void 0 : syncCallbacksState.validate) || [],
submit: (syncCallbacksState == null ? void 0 : syncCallbacksState.submit) || []
};
const callbacks = _F6HPKLO2cjs.createStore.call(void 0, callbacksInitialState, syncCallbacks);
_F6HPKLO2cjs.setup.call(void 0, form, () => _F6HPKLO2cjs.init.call(void 0, callbacks));
const validate = async () => {
form.setState("validating", true);
form.setState("errors", {});
const validateCallbacks = callbacks.getState().validate;
try {
for (const callback of validateCallbacks) {
await callback(form.getState());
}
await nextFrame();
return !hasMessages(form.getState().errors);
} finally {
form.setState("validating", false);
}
};
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection), form), {
names: createNames(),
setValues: (values2) => form.setState("values", values2),
getValue: (name) => get(form.getState().values, name),
setValue: (name, value) => form.setState("values", (values2) => {
const prevValue = get(values2, name);
const nextValue = _KBNYGXWIcjs.applyState.call(void 0, value, prevValue);
if (nextValue === prevValue)
return values2;
return set(values2, name, nextValue);
}),
pushValue: (name, value) => form.setState("values", (values2) => {
const array = get(values2, name, []);
return set(values2, name, [...array, value]);
}),
removeValue: (name, index) => form.setState("values", (values2) => {
const array = get(values2, name, []);
return set(values2, name, [
...array.slice(0, index),
null,
...array.slice(index + 1)
]);
}),
setErrors: (errors2) => form.setState("errors", errors2),
getError: (name) => get(form.getState().errors, name),
setError: (name, error) => form.setState("errors", (errors2) => {
const prevError = get(errors2, name);
const nextError = _KBNYGXWIcjs.applyState.call(void 0, error, prevError);
if (nextError === prevError)
return errors2;
return set(errors2, name, nextError);
}),
setTouched: (touched2) => form.setState("touched", touched2),
getFieldTouched: (name) => !!get(form.getState().touched, name),
setFieldTouched: (name, value) => form.setState("touched", (touched2) => {
const prevValue = get(touched2, name);
const nextValue = _KBNYGXWIcjs.applyState.call(void 0, value, prevValue);
if (nextValue === prevValue)
return touched2;
return set(touched2, name, nextValue);
}),
onValidate: (callback) => {
callbacks.setState("validate", (callbacks2) => [...callbacks2, callback]);
return () => {
callbacks.setState(
"validate",
(callbacks2) => callbacks2.filter((c) => c !== callback)
);
};
},
validate,
onSubmit: (callback) => {
callbacks.setState("submit", (callbacks2) => [...callbacks2, callback]);
return () => {
callbacks.setState(
"submit",
(callbacks2) => callbacks2.filter((c) => c !== callback)
);
};
},
submit: async () => {
form.setState("submitting", true);
form.setState("touched", setAll(form.getState().values, true));
try {
if (await validate()) {
const submitCallbacks = callbacks.getState().submit;
for (const callback of submitCallbacks) {
await callback(form.getState());
}
await nextFrame();
if (!hasMessages(form.getState().errors)) {
form.setState("submitSucceed", (count) => count + 1);
return true;
}
}
form.setState("submitFailed", (count) => count + 1);
return false;
} catch (error) {
form.setState("submitFailed", (count) => count + 1);
throw error;
} finally {
form.setState("submitting", false);
}
},
reset: () => {
form.setState("values", values);
form.setState("errors", errors);
form.setState("touched", touched);
form.setState("validating", false);
form.setState("submitting", false);
form.setState("submitSucceed", 0);
form.setState("submitFailed", 0);
},
// @ts-expect-error Internal
__unstableCallbacks: callbacks
});
}
exports.createFormStore = createFormStore; exports.get = get; exports.hasMessages = hasMessages;

245
node_modules/@ariakit/core/cjs/form/form-store.d.cts generated vendored Normal file
View File

@@ -0,0 +1,245 @@
import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOptions, CollectionStoreState } from "../collection/collection-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { AnyObject, PickRequired, SetState, SetStateAction } from "../utils/types.js";
import type { DeepMap, DeepPartial, Names, StringLike } from "./types.js";
type ErrorMessage = string | undefined | null;
export declare function hasMessages(object: FormStoreValues): boolean;
export declare function get<T>(values: FormStoreValues, path: StringLike | string[], defaultValue?: T): T;
/**
* Creates a form store.
*/
export declare function createFormStore<T extends FormStoreValues = FormStoreValues>(props: PickRequired<FormStoreProps<T>, "values" | "defaultValues" | "errors" | "defaultErrors" | "touched" | "defaultTouched">): FormStore<T>;
export declare function createFormStore(props: FormStoreProps): FormStore;
export type FormStoreCallback<T extends FormStoreState = FormStoreState> = (state: T) => void | Promise<void>;
export type FormStoreValues = AnyObject;
export interface FormStoreItem extends CollectionStoreItem {
type: "field" | "label" | "description" | "error" | "button";
name: string;
}
export interface FormStoreState<T extends FormStoreValues = FormStoreValues> extends CollectionStoreState<FormStoreItem> {
/**
* Form values.
*
* Live examples:
* - [FormRadio](https://ariakit.org/examples/form-radio)
* - [FormSelect](https://ariakit.org/examples/form-select)
* @default {}
*/
values: T;
/**
* Form errors.
*/
errors: DeepPartial<DeepMap<T, ErrorMessage>>;
/**
* The touched state of the form.
*/
touched: DeepPartial<DeepMap<T, boolean>>;
/**
* Whether the form is valid.
*/
valid: boolean;
/**
* Whether the form is validating.
*/
validating: boolean;
/**
* Whether the form is submitting.
*/
submitting: boolean;
/**
* The number of times
* [`submit`](https://ariakit.org/reference/use-form-store#submit) has been
* called with a successful response.
*/
submitSucceed: number;
/**
* The number of times
* [`submit`](https://ariakit.org/reference/use-form-store#submit) has been
* called with an error response.
*/
submitFailed: number;
}
export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues> extends CollectionStoreFunctions<FormStoreItem> {
/**
* An object containing the names of the form fields for type safety.
*
* Live examples:
* - [FormRadio](https://ariakit.org/examples/form-radio)
* - [FormSelect](https://ariakit.org/examples/form-select)
* @example
* store.names.name; // "name"
* store.names.name.first; // "name.first"
* store.names.name.last; // "name.last"
*/
names: Names<T>;
/**
* Sets the [`values`](https://ariakit.org/reference/form-provider#values)
* state.
* @example
* store.setValues({ name: "John" });
* store.setValues((values) => ({ ...values, name: "John" }));
*/
setValues: SetState<FormStoreState<T>["values"]>;
/**
* Retrieves a field value.
*
* Live examples:
* - [FormRadio](https://ariakit.org/examples/form-radio)
* @example
* const nameValue = store.getValue("name");
* // Can also use store.names for type-safety.
* const emailValue = store.getValue(store.names.email);
*/
getValue: <T = any>(name: StringLike) => T;
/**
* Sets a field value.
*
* Live examples:
* - [FormSelect](https://ariakit.org/examples/form-select)
* @example
* store.setValue("name", "John");
* store.setValue("name", (value) => value + " Doe");
* // Can also use store.names for type-safety.
* store.setValue(store.names.name, "John");
*/
setValue: <T>(name: StringLike, value: SetStateAction<T>) => void;
/**
* Pushes a value to an array field.
* @example
* store.pushValue("tags", "new tag");
* store.pushValue("tags", { id: 1, name: "new tag" });
* // Can also use store.names for type-safety.
* store.pushValue(store.names.tags, "new tag");
*/
pushValue: <T>(name: StringLike, value: T) => void;
/**
* Removes a value from an array field.
* @example
* store.removeValue("tags", 0);
* store.removeValue("tags", 1);
* // Can also use store.names for type-safety.
* store.removeValue(store.names.tags, 0);
*/
removeValue: (name: StringLike, index: number) => void;
/**
* Sets the [`errors`](https://ariakit.org/reference/form-provider#errors)
* state.
* @example
* store.setErrors({ name: "Name is required" });
* store.setErrors((errors) => ({ ...errors, name: "Name is required" }));
*/
setErrors: SetState<FormStoreState<T>["errors"]>;
/**
* Retrieves a field error.
* @example
* const nameError = store.getError("name");
* // Can also use store.names for type-safety.
* const emailError = store.getError(store.names.email);
*/
getError: (name: StringLike) => ErrorMessage;
/**
* Sets a field error.
*
* Live examples:
* - [FormRadio](https://ariakit.org/examples/form-radio)
* @example
* store.setError("name", "Name is required");
* store.setError("name", (error) => error + "!");
* // Can also use store.names for type-safety.
* store.setError(store.names.name, "Name is required");
*/
setError: (name: StringLike, error: SetStateAction<ErrorMessage>) => void;
/**
* Sets the [`touched`](https://ariakit.org/reference/form-provider#touched)
* state.
* @example
* store.setTouched({ name: true });
* store.setTouched((touched) => ({ ...touched, name: true }));
*/
setTouched: SetState<FormStoreState<T>["touched"]>;
/**
* Retrieves a field touched state.
* @example
* const nameTouched = store.getFieldTouched("name");
* // Can also use store.names for type-safety.
* const emailTouched = store.getFieldTouched(store.names.email);
*/
getFieldTouched: (name: StringLike) => boolean;
/**
* Sets a field touched state.
* @example
* store.setFieldTouched("name", true);
* store.setFieldTouched("name", (value) => !value);
* // Can also use store.names for type-safety.
* store.setFieldTouched(store.names.name, true);
*/
setFieldTouched: (name: StringLike, value: SetStateAction<boolean>) => void;
/**
* Function that accepts a callback that will be used to validate the form
* when [`validate`](https://ariakit.org/reference/use-form-store#validate) is
* called. It returns a cleanup function that will remove the callback.
* @example
* const cleanup = store.onValidate(async (state) => {
* const errors = await api.validate(state.values);
* if (errors) {
* store.setErrors(errors);
* }
* });
*/
onValidate: (callback: FormStoreCallback<FormStoreState<T>>) => void;
/**
* Function that accepts a callback that will be used to submit the form when
* [`submit`](https://ariakit.org/reference/use-form-store#submit) is called.
* It returns a cleanup function that will remove the callback.
* @param callback The callback function.
* @example
* const cleanup = store.onSubmit(async (state) => {
* try {
* await api.submit(state.values);
* } catch (errors) {
* store.setErrors(errors);
* }
* });
*/
onSubmit: (callback: FormStoreCallback<FormStoreState<T>>) => void;
/**
* Validates the form.
* @example
* if (await store.validate()) {
* // Form is valid.
* }
*/
validate: () => Promise<boolean>;
/**
* Submits the form. This also triggers validation.
* @example
* if (await form.submit()) {
* // Form is submitted.
* }
*/
submit: () => Promise<boolean>;
/**
* Resets the form to its default values.
*/
reset: () => void;
}
export interface FormStoreOptions<T extends FormStoreValues = FormStoreValues> extends CollectionStoreOptions<FormStoreItem>, StoreOptions<FormStoreState<T>, "values" | "errors" | "touched"> {
/**
* The default values of the form.
* @default {}
*/
defaultValues?: FormStoreState<T>["values"];
/**
* The default errors of the form.
*/
defaultErrors?: FormStoreState<T>["errors"];
/**
* The default touched state of the form.
*/
defaultTouched?: FormStoreState<T>["touched"];
}
export interface FormStoreProps<T extends FormStoreValues = FormStoreValues> extends FormStoreOptions<T>, StoreProps<FormStoreState<T>> {
}
export interface FormStore<T extends FormStoreValues = FormStoreValues> extends FormStoreFunctions<T>, Store<FormStoreState<T>> {
}
export {};

245
node_modules/@ariakit/core/cjs/form/form-store.d.ts generated vendored Normal file
View File

@@ -0,0 +1,245 @@
import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOptions, CollectionStoreState } from "../collection/collection-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { AnyObject, PickRequired, SetState, SetStateAction } from "../utils/types.js";
import type { DeepMap, DeepPartial, Names, StringLike } from "./types.js";
type ErrorMessage = string | undefined | null;
export declare function hasMessages(object: FormStoreValues): boolean;
export declare function get<T>(values: FormStoreValues, path: StringLike | string[], defaultValue?: T): T;
/**
* Creates a form store.
*/
export declare function createFormStore<T extends FormStoreValues = FormStoreValues>(props: PickRequired<FormStoreProps<T>, "values" | "defaultValues" | "errors" | "defaultErrors" | "touched" | "defaultTouched">): FormStore<T>;
export declare function createFormStore(props: FormStoreProps): FormStore;
export type FormStoreCallback<T extends FormStoreState = FormStoreState> = (state: T) => void | Promise<void>;
export type FormStoreValues = AnyObject;
export interface FormStoreItem extends CollectionStoreItem {
type: "field" | "label" | "description" | "error" | "button";
name: string;
}
export interface FormStoreState<T extends FormStoreValues = FormStoreValues> extends CollectionStoreState<FormStoreItem> {
/**
* Form values.
*
* Live examples:
* - [FormRadio](https://ariakit.org/examples/form-radio)
* - [FormSelect](https://ariakit.org/examples/form-select)
* @default {}
*/
values: T;
/**
* Form errors.
*/
errors: DeepPartial<DeepMap<T, ErrorMessage>>;
/**
* The touched state of the form.
*/
touched: DeepPartial<DeepMap<T, boolean>>;
/**
* Whether the form is valid.
*/
valid: boolean;
/**
* Whether the form is validating.
*/
validating: boolean;
/**
* Whether the form is submitting.
*/
submitting: boolean;
/**
* The number of times
* [`submit`](https://ariakit.org/reference/use-form-store#submit) has been
* called with a successful response.
*/
submitSucceed: number;
/**
* The number of times
* [`submit`](https://ariakit.org/reference/use-form-store#submit) has been
* called with an error response.
*/
submitFailed: number;
}
export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues> extends CollectionStoreFunctions<FormStoreItem> {
/**
* An object containing the names of the form fields for type safety.
*
* Live examples:
* - [FormRadio](https://ariakit.org/examples/form-radio)
* - [FormSelect](https://ariakit.org/examples/form-select)
* @example
* store.names.name; // "name"
* store.names.name.first; // "name.first"
* store.names.name.last; // "name.last"
*/
names: Names<T>;
/**
* Sets the [`values`](https://ariakit.org/reference/form-provider#values)
* state.
* @example
* store.setValues({ name: "John" });
* store.setValues((values) => ({ ...values, name: "John" }));
*/
setValues: SetState<FormStoreState<T>["values"]>;
/**
* Retrieves a field value.
*
* Live examples:
* - [FormRadio](https://ariakit.org/examples/form-radio)
* @example
* const nameValue = store.getValue("name");
* // Can also use store.names for type-safety.
* const emailValue = store.getValue(store.names.email);
*/
getValue: <T = any>(name: StringLike) => T;
/**
* Sets a field value.
*
* Live examples:
* - [FormSelect](https://ariakit.org/examples/form-select)
* @example
* store.setValue("name", "John");
* store.setValue("name", (value) => value + " Doe");
* // Can also use store.names for type-safety.
* store.setValue(store.names.name, "John");
*/
setValue: <T>(name: StringLike, value: SetStateAction<T>) => void;
/**
* Pushes a value to an array field.
* @example
* store.pushValue("tags", "new tag");
* store.pushValue("tags", { id: 1, name: "new tag" });
* // Can also use store.names for type-safety.
* store.pushValue(store.names.tags, "new tag");
*/
pushValue: <T>(name: StringLike, value: T) => void;
/**
* Removes a value from an array field.
* @example
* store.removeValue("tags", 0);
* store.removeValue("tags", 1);
* // Can also use store.names for type-safety.
* store.removeValue(store.names.tags, 0);
*/
removeValue: (name: StringLike, index: number) => void;
/**
* Sets the [`errors`](https://ariakit.org/reference/form-provider#errors)
* state.
* @example
* store.setErrors({ name: "Name is required" });
* store.setErrors((errors) => ({ ...errors, name: "Name is required" }));
*/
setErrors: SetState<FormStoreState<T>["errors"]>;
/**
* Retrieves a field error.
* @example
* const nameError = store.getError("name");
* // Can also use store.names for type-safety.
* const emailError = store.getError(store.names.email);
*/
getError: (name: StringLike) => ErrorMessage;
/**
* Sets a field error.
*
* Live examples:
* - [FormRadio](https://ariakit.org/examples/form-radio)
* @example
* store.setError("name", "Name is required");
* store.setError("name", (error) => error + "!");
* // Can also use store.names for type-safety.
* store.setError(store.names.name, "Name is required");
*/
setError: (name: StringLike, error: SetStateAction<ErrorMessage>) => void;
/**
* Sets the [`touched`](https://ariakit.org/reference/form-provider#touched)
* state.
* @example
* store.setTouched({ name: true });
* store.setTouched((touched) => ({ ...touched, name: true }));
*/
setTouched: SetState<FormStoreState<T>["touched"]>;
/**
* Retrieves a field touched state.
* @example
* const nameTouched = store.getFieldTouched("name");
* // Can also use store.names for type-safety.
* const emailTouched = store.getFieldTouched(store.names.email);
*/
getFieldTouched: (name: StringLike) => boolean;
/**
* Sets a field touched state.
* @example
* store.setFieldTouched("name", true);
* store.setFieldTouched("name", (value) => !value);
* // Can also use store.names for type-safety.
* store.setFieldTouched(store.names.name, true);
*/
setFieldTouched: (name: StringLike, value: SetStateAction<boolean>) => void;
/**
* Function that accepts a callback that will be used to validate the form
* when [`validate`](https://ariakit.org/reference/use-form-store#validate) is
* called. It returns a cleanup function that will remove the callback.
* @example
* const cleanup = store.onValidate(async (state) => {
* const errors = await api.validate(state.values);
* if (errors) {
* store.setErrors(errors);
* }
* });
*/
onValidate: (callback: FormStoreCallback<FormStoreState<T>>) => void;
/**
* Function that accepts a callback that will be used to submit the form when
* [`submit`](https://ariakit.org/reference/use-form-store#submit) is called.
* It returns a cleanup function that will remove the callback.
* @param callback The callback function.
* @example
* const cleanup = store.onSubmit(async (state) => {
* try {
* await api.submit(state.values);
* } catch (errors) {
* store.setErrors(errors);
* }
* });
*/
onSubmit: (callback: FormStoreCallback<FormStoreState<T>>) => void;
/**
* Validates the form.
* @example
* if (await store.validate()) {
* // Form is valid.
* }
*/
validate: () => Promise<boolean>;
/**
* Submits the form. This also triggers validation.
* @example
* if (await form.submit()) {
* // Form is submitted.
* }
*/
submit: () => Promise<boolean>;
/**
* Resets the form to its default values.
*/
reset: () => void;
}
export interface FormStoreOptions<T extends FormStoreValues = FormStoreValues> extends CollectionStoreOptions<FormStoreItem>, StoreOptions<FormStoreState<T>, "values" | "errors" | "touched"> {
/**
* The default values of the form.
* @default {}
*/
defaultValues?: FormStoreState<T>["values"];
/**
* The default errors of the form.
*/
defaultErrors?: FormStoreState<T>["errors"];
/**
* The default touched state of the form.
*/
defaultTouched?: FormStoreState<T>["touched"];
}
export interface FormStoreProps<T extends FormStoreValues = FormStoreValues> extends FormStoreOptions<T>, StoreProps<FormStoreState<T>> {
}
export interface FormStore<T extends FormStoreValues = FormStoreValues> extends FormStoreFunctions<T>, Store<FormStoreState<T>> {
}
export {};

1
node_modules/@ariakit/core/cjs/form/types.cjs generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";"use client";

38
node_modules/@ariakit/core/cjs/form/types.d.cts generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import type { AnyObject } from "../utils/types.js";
/**
* An object or primitive value that can be converted to a string.
*/
export type StringLike = {
toString: () => string;
valueOf: () => string;
};
/**
* Maps through an object `T` or array and defines the leaf values to the given
* type `V`.
* @template T Object
* @template V Value
*/
export type DeepMap<T, V> = {
[K in keyof T]: T[K] extends AnyObject ? DeepMap<T[K], V> : V;
};
/**
* Similar to `Partial<T>`, but recursively maps through the object and makes
* nested object properties optional.
* @template T Object
*/
export type DeepPartial<T> = {
[K in keyof T]?: T[K] extends AnyObject ? DeepPartial<T[K]> : T[K];
};
/**
* Maps through the values object `T` and defines all properties into a string
* like type. That is, a type that is an object that can contain other
* properties but can also be converted into a string with the path name.
* @template T Values object
*/
export type Names<T> = {
[K in keyof T]: T[K] extends Array<infer U> ? U extends AnyObject ? {
[key: number]: Names<U>;
} & StringLike : {
[key: number]: U & StringLike;
} & StringLike : T[K] extends AnyObject ? Names<T[K]> : StringLike;
};

38
node_modules/@ariakit/core/cjs/form/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import type { AnyObject } from "../utils/types.js";
/**
* An object or primitive value that can be converted to a string.
*/
export type StringLike = {
toString: () => string;
valueOf: () => string;
};
/**
* Maps through an object `T` or array and defines the leaf values to the given
* type `V`.
* @template T Object
* @template V Value
*/
export type DeepMap<T, V> = {
[K in keyof T]: T[K] extends AnyObject ? DeepMap<T[K], V> : V;
};
/**
* Similar to `Partial<T>`, but recursively maps through the object and makes
* nested object properties optional.
* @template T Object
*/
export type DeepPartial<T> = {
[K in keyof T]?: T[K] extends AnyObject ? DeepPartial<T[K]> : T[K];
};
/**
* Maps through the values object `T` and defines all properties into a string
* like type. That is, a type that is an object that can contain other
* properties but can also be converted into a string with the path name.
* @template T Values object
*/
export type Names<T> = {
[K in keyof T]: T[K] extends Array<infer U> ? U extends AnyObject ? {
[key: number]: Names<U>;
} & StringLike : {
[key: number]: U & StringLike;
} & StringLike : T[K] extends AnyObject ? Names<T[K]> : StringLike;
};

View File

@@ -0,0 +1,13 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _TQTGWD5Kcjs = require('../__chunks/TQTGWD5K.cjs');
require('../__chunks/E53JW5BD.cjs');
require('../__chunks/I3Y4EXEF.cjs');
require('../__chunks/OTVLDMN2.cjs');
require('../__chunks/F6HPKLO2.cjs');
require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.createHovercardStore = _TQTGWD5Kcjs.createHovercardStore;

View File

@@ -0,0 +1,65 @@
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
/**
* Creates a hovercard store.
*/
export declare function createHovercardStore(props?: HovercardStoreProps): HovercardStore;
export interface HovercardStoreState extends PopoverStoreState {
/**
* @default "bottom"
*/
placement: PopoverStoreState["placement"];
/**
* The amount of time in milliseconds to wait before showing and hiding the
* popup. To control the delay for showing and hiding separately, use
* [`showTimeout`](https://ariakit.org/reference/hovercard-provider#showtimeout)
* and
* [`hideTimeout`](https://ariakit.org/reference/hovercard-provider#hidetimeout).
* @default 500
*/
timeout: number;
/**
* The amount of time in milliseconds to wait before _showing_ the popup. It
* defaults to the value passed to
* [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
*/
showTimeout?: number;
/**
* The amount of time in milliseconds to wait before _hiding_ the popup. It
* defaults to the value passed to
* [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
* - [Tooltip with Framer
* Motion](https://ariakit.org/examples/tooltip-framer-motion)
*/
hideTimeout?: number;
/**
* Whether the popup or an element inside it should be focused when it is
* shown.
* @default false
*/
autoFocusOnShow: boolean;
}
export interface HovercardStoreFunctions extends PopoverStoreFunctions {
/**
* Sets the `autoFocusOnShow` state.
*
* Live examples:
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
*/
setAutoFocusOnShow: SetState<HovercardStoreState["autoFocusOnShow"]>;
}
export interface HovercardStoreOptions extends PopoverStoreOptions, StoreOptions<HovercardStoreState, "placement" | "timeout" | "showTimeout" | "hideTimeout"> {
}
export interface HovercardStoreProps extends HovercardStoreOptions, StoreProps<HovercardStoreState> {
}
export interface HovercardStore extends HovercardStoreFunctions, Store<HovercardStoreState> {
}

View File

@@ -0,0 +1,65 @@
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
/**
* Creates a hovercard store.
*/
export declare function createHovercardStore(props?: HovercardStoreProps): HovercardStore;
export interface HovercardStoreState extends PopoverStoreState {
/**
* @default "bottom"
*/
placement: PopoverStoreState["placement"];
/**
* The amount of time in milliseconds to wait before showing and hiding the
* popup. To control the delay for showing and hiding separately, use
* [`showTimeout`](https://ariakit.org/reference/hovercard-provider#showtimeout)
* and
* [`hideTimeout`](https://ariakit.org/reference/hovercard-provider#hidetimeout).
* @default 500
*/
timeout: number;
/**
* The amount of time in milliseconds to wait before _showing_ the popup. It
* defaults to the value passed to
* [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
*/
showTimeout?: number;
/**
* The amount of time in milliseconds to wait before _hiding_ the popup. It
* defaults to the value passed to
* [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
* - [Tooltip with Framer
* Motion](https://ariakit.org/examples/tooltip-framer-motion)
*/
hideTimeout?: number;
/**
* Whether the popup or an element inside it should be focused when it is
* shown.
* @default false
*/
autoFocusOnShow: boolean;
}
export interface HovercardStoreFunctions extends PopoverStoreFunctions {
/**
* Sets the `autoFocusOnShow` state.
*
* Live examples:
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
*/
setAutoFocusOnShow: SetState<HovercardStoreState["autoFocusOnShow"]>;
}
export interface HovercardStoreOptions extends PopoverStoreOptions, StoreOptions<HovercardStoreState, "placement" | "timeout" | "showTimeout" | "hideTimeout"> {
}
export interface HovercardStoreProps extends HovercardStoreOptions, StoreProps<HovercardStoreState> {
}
export interface HovercardStore extends HovercardStoreFunctions, Store<HovercardStoreState> {
}

8
node_modules/@ariakit/core/cjs/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,8 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
require('./__chunks/AV6KTKLE.cjs');
// src/index.ts
var src_default = {};
exports.default = src_default;

2
node_modules/@ariakit/core/cjs/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
declare const _default: {};
export default _default;

2
node_modules/@ariakit/core/cjs/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
declare const _default: {};
export default _default;

19
node_modules/@ariakit/core/cjs/menu/menu-bar-store.cjs generated vendored Normal file
View File

@@ -0,0 +1,19 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _NOFH2BLBcjs = require('../__chunks/NOFH2BLB.cjs');
require('../__chunks/BFE5R4EZ.cjs');
require('../__chunks/MI6NUQYQ.cjs');
require('../__chunks/F6HPKLO2.cjs');
require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/5F4DVUNS.cjs');
require('../__chunks/ULSPM3Y3.cjs');
require('../__chunks/AV6KTKLE.cjs');
// src/menu/menu-bar-store.ts
function createMenuBarStore(props = {}) {
return _NOFH2BLBcjs.createMenubarStore.call(void 0, props);
}
exports.createMenuBarStore = createMenuBarStore;

View File

@@ -0,0 +1,16 @@
import type { MenubarStoreFunctions, MenubarStoreOptions, MenubarStoreState } from "../menubar/menubar-store.js";
import type { Store, StoreProps } from "../utils/store.js";
/**
* Creates a menu bar store.
*/
export declare function createMenuBarStore(props?: MenuBarStoreProps): MenuBarStore;
export interface MenuBarStoreState extends MenubarStoreState {
}
export interface MenuBarStoreFunctions extends MenubarStoreFunctions {
}
export interface MenuBarStoreOptions extends MenubarStoreOptions {
}
export interface MenuBarStoreProps extends MenuBarStoreOptions, StoreProps<MenuBarStoreState> {
}
export interface MenuBarStore extends MenuBarStoreFunctions, Store<MenuBarStoreState> {
}

View File

@@ -0,0 +1,16 @@
import type { MenubarStoreFunctions, MenubarStoreOptions, MenubarStoreState } from "../menubar/menubar-store.js";
import type { Store, StoreProps } from "../utils/store.js";
/**
* Creates a menu bar store.
*/
export declare function createMenuBarStore(props?: MenuBarStoreProps): MenuBarStore;
export interface MenuBarStoreState extends MenubarStoreState {
}
export interface MenuBarStoreFunctions extends MenubarStoreFunctions {
}
export interface MenuBarStoreOptions extends MenubarStoreOptions {
}
export interface MenuBarStoreProps extends MenuBarStoreOptions, StoreProps<MenuBarStoreState> {
}
export interface MenuBarStore extends MenuBarStoreFunctions, Store<MenuBarStoreState> {
}

138
node_modules/@ariakit/core/cjs/menu/menu-store.cjs generated vendored Normal file
View File

@@ -0,0 +1,138 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _TQTGWD5Kcjs = require('../__chunks/TQTGWD5K.cjs');
require('../__chunks/E53JW5BD.cjs');
require('../__chunks/I3Y4EXEF.cjs');
require('../__chunks/OTVLDMN2.cjs');
var _BFE5R4EZcjs = require('../__chunks/BFE5R4EZ.cjs');
require('../__chunks/MI6NUQYQ.cjs');
var _F6HPKLO2cjs = require('../__chunks/F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/5F4DVUNS.cjs');
require('../__chunks/ULSPM3Y3.cjs');
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
// src/menu/menu-store.ts
function createMenuStore(_a = {}) {
var _b = _a, {
combobox,
parent,
menubar
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
"combobox",
"parent",
"menubar"
]);
const parentIsMenubar = !!menubar && !parent;
const store = _F6HPKLO2cjs.mergeStore.call(void 0,
props.store,
_F6HPKLO2cjs.pick.call(void 0, parent, ["values"]),
_F6HPKLO2cjs.omit.call(void 0, combobox, [
"arrowElement",
"anchorElement",
"contentElement",
"popoverElement",
"disclosureElement"
])
);
_F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, store);
const syncState = store.getState();
const composite = _BFE5R4EZcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
store,
orientation: _KBNYGXWIcjs.defaultValue.call(void 0,
props.orientation,
syncState.orientation,
"vertical"
)
}));
const hovercard = _TQTGWD5Kcjs.createHovercardStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
store,
placement: _KBNYGXWIcjs.defaultValue.call(void 0,
props.placement,
syncState.placement,
"bottom-start"
),
timeout: _KBNYGXWIcjs.defaultValue.call(void 0,
props.timeout,
syncState.timeout,
parentIsMenubar ? 0 : 150
),
hideTimeout: _KBNYGXWIcjs.defaultValue.call(void 0, props.hideTimeout, syncState.hideTimeout, 0)
}));
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), hovercard.getState()), {
initialFocus: _KBNYGXWIcjs.defaultValue.call(void 0, syncState.initialFocus, "container"),
values: _KBNYGXWIcjs.defaultValue.call(void 0,
props.values,
syncState.values,
props.defaultValues,
{}
)
});
const menu = _F6HPKLO2cjs.createStore.call(void 0, initialState, composite, hovercard, store);
_F6HPKLO2cjs.setup.call(void 0,
menu,
() => _F6HPKLO2cjs.sync.call(void 0, menu, ["mounted"], (state) => {
if (state.mounted)
return;
menu.setState("activeId", null);
})
);
_F6HPKLO2cjs.setup.call(void 0,
menu,
() => _F6HPKLO2cjs.sync.call(void 0, parent, ["orientation"], (state) => {
menu.setState(
"placement",
state.orientation === "vertical" ? "right-start" : "bottom-start"
);
})
);
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), hovercard), menu), {
combobox,
parent,
menubar,
hideAll: () => {
hovercard.hide();
parent == null ? void 0 : parent.hideAll();
},
setInitialFocus: (value) => menu.setState("initialFocus", value),
setValues: (values) => menu.setState("values", values),
setValue: (name, value) => {
if (name === "__proto__")
return;
if (name === "constructor")
return;
if (Array.isArray(name))
return;
menu.setState("values", (values) => {
const prevValue = values[name];
const nextValue = _KBNYGXWIcjs.applyState.call(void 0, value, prevValue);
if (nextValue === prevValue)
return values;
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, values), {
[name]: nextValue !== void 0 && nextValue
});
});
}
});
}
exports.createMenuStore = createMenuStore;

97
node_modules/@ariakit/core/cjs/menu/menu-store.d.cts generated vendored Normal file
View File

@@ -0,0 +1,97 @@
import type { ComboboxStore } from "../combobox/combobox-store.js";
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { BivariantCallback, PickRequired, SetState, SetStateAction } from "../utils/types.js";
import type { MenuBarStore } from "./menu-bar-store.js";
export declare function createMenuStore<T extends MenuStoreValues = MenuStoreValues>(props: PickRequired<MenuStoreProps<T>, "values" | "defaultValues">): MenuStore<T>;
export declare function createMenuStore(props?: MenuStoreProps): MenuStore;
export type MenuStoreValues = Record<string, string | boolean | number | Array<string | number>>;
export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreState, HovercardStoreState {
/**
* Determines the element that should be focused when the menu is opened.
*/
initialFocus: "container" | "first" | "last";
/**
* A map of names and values that will be used by the
* [`MenuItemCheckbox`](https://ariakit.org/reference/menu-item-checkbox) and
* [`MenuItemRadio`](https://ariakit.org/reference/menu-item-radio)
* components.
*
* Live examples:
* - [MenuItemCheckbox](https://ariakit.org/examples/menu-item-checkbox)
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
*/
values: T;
/** @default "vertical" */
orientation: CompositeStoreState["orientation"];
/** @default "bottom-start" */
placement: HovercardStoreState["placement"];
/** @default 0 */
hideTimeout?: HovercardStoreState["hideTimeout"];
}
export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreFunctions, HovercardStoreFunctions, Pick<MenuStoreOptions, "combobox" | "parent" | "menubar"> {
/**
* Hides the menu and all its parent menus.
*
* Live examples:
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
*/
hideAll: () => void;
/**
* Sets the `initialFocus` state.
*/
setInitialFocus: SetState<MenuStoreState<T>["initialFocus"]>;
/**
* Sets the [`values`](https://ariakit.org/reference/menu-provider#values)
* state.
* @example
* store.setValues({ watching: ["issues"] });
* store.setValues((values) => ({ ...values, watching: ["issues"] }));
*/
setValues: SetState<MenuStoreState<T>["values"]>;
/**
* Sets a specific menu value.
*
* Live examples:
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
* @example
* store.setValue("watching", ["issues"]);
* store.setValue("watching", (value) => [...value, "issues"]);
*/
setValue: BivariantCallback<(name: string, value: SetStateAction<MenuStoreState<T>["values"][string]>) => void>;
}
export interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreOptions, HovercardStoreOptions, StoreOptions<MenuStoreState<T>, "orientation" | "placement" | "hideTimeout" | "values"> {
/**
* A reference to a combobox store. This is used when combining the combobox
* with a menu (e.g., dropdown menu with a search input). The stores will
* share the same state.
*/
combobox?: ComboboxStore | null;
/**
* A reference to a parent menu store. This is used on nested menus.
*/
parent?: MenuStore | null;
/**
* A reference to a menubar store. This is used when rendering menus inside a
* menubar.
*/
menubar?: MenuBarStore | null;
/**
* The default values for the
* [`values`](https://ariakit.org/reference/menu-provider#values) state.
*
* Live examples:
* - [MenuItemCheckbox](https://ariakit.org/examples/menu-item-checkbox)
* - [MenuItemRadio](https://ariakit.org/examples/menu-item-radio)
* @default {}
*/
defaultValues?: MenuStoreState<T>["values"];
}
export interface MenuStoreProps<T extends MenuStoreValues = MenuStoreValues> extends MenuStoreOptions<T>, StoreProps<MenuStoreState<T>> {
}
export interface MenuStore<T extends MenuStoreValues = MenuStoreValues> extends MenuStoreFunctions<T>, Store<MenuStoreState<T>> {
}

97
node_modules/@ariakit/core/cjs/menu/menu-store.d.ts generated vendored Normal file
View File

@@ -0,0 +1,97 @@
import type { ComboboxStore } from "../combobox/combobox-store.js";
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { BivariantCallback, PickRequired, SetState, SetStateAction } from "../utils/types.js";
import type { MenuBarStore } from "./menu-bar-store.js";
export declare function createMenuStore<T extends MenuStoreValues = MenuStoreValues>(props: PickRequired<MenuStoreProps<T>, "values" | "defaultValues">): MenuStore<T>;
export declare function createMenuStore(props?: MenuStoreProps): MenuStore;
export type MenuStoreValues = Record<string, string | boolean | number | Array<string | number>>;
export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreState, HovercardStoreState {
/**
* Determines the element that should be focused when the menu is opened.
*/
initialFocus: "container" | "first" | "last";
/**
* A map of names and values that will be used by the
* [`MenuItemCheckbox`](https://ariakit.org/reference/menu-item-checkbox) and
* [`MenuItemRadio`](https://ariakit.org/reference/menu-item-radio)
* components.
*
* Live examples:
* - [MenuItemCheckbox](https://ariakit.org/examples/menu-item-checkbox)
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
*/
values: T;
/** @default "vertical" */
orientation: CompositeStoreState["orientation"];
/** @default "bottom-start" */
placement: HovercardStoreState["placement"];
/** @default 0 */
hideTimeout?: HovercardStoreState["hideTimeout"];
}
export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreFunctions, HovercardStoreFunctions, Pick<MenuStoreOptions, "combobox" | "parent" | "menubar"> {
/**
* Hides the menu and all its parent menus.
*
* Live examples:
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
*/
hideAll: () => void;
/**
* Sets the `initialFocus` state.
*/
setInitialFocus: SetState<MenuStoreState<T>["initialFocus"]>;
/**
* Sets the [`values`](https://ariakit.org/reference/menu-provider#values)
* state.
* @example
* store.setValues({ watching: ["issues"] });
* store.setValues((values) => ({ ...values, watching: ["issues"] }));
*/
setValues: SetState<MenuStoreState<T>["values"]>;
/**
* Sets a specific menu value.
*
* Live examples:
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
* @example
* store.setValue("watching", ["issues"]);
* store.setValue("watching", (value) => [...value, "issues"]);
*/
setValue: BivariantCallback<(name: string, value: SetStateAction<MenuStoreState<T>["values"][string]>) => void>;
}
export interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreOptions, HovercardStoreOptions, StoreOptions<MenuStoreState<T>, "orientation" | "placement" | "hideTimeout" | "values"> {
/**
* A reference to a combobox store. This is used when combining the combobox
* with a menu (e.g., dropdown menu with a search input). The stores will
* share the same state.
*/
combobox?: ComboboxStore | null;
/**
* A reference to a parent menu store. This is used on nested menus.
*/
parent?: MenuStore | null;
/**
* A reference to a menubar store. This is used when rendering menus inside a
* menubar.
*/
menubar?: MenuBarStore | null;
/**
* The default values for the
* [`values`](https://ariakit.org/reference/menu-provider#values) state.
*
* Live examples:
* - [MenuItemCheckbox](https://ariakit.org/examples/menu-item-checkbox)
* - [MenuItemRadio](https://ariakit.org/examples/menu-item-radio)
* @default {}
*/
defaultValues?: MenuStoreState<T>["values"];
}
export interface MenuStoreProps<T extends MenuStoreValues = MenuStoreValues> extends MenuStoreOptions<T>, StoreProps<MenuStoreState<T>> {
}
export interface MenuStore<T extends MenuStoreValues = MenuStoreValues> extends MenuStoreFunctions<T>, Store<MenuStoreState<T>> {
}

View File

@@ -0,0 +1,14 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _NOFH2BLBcjs = require('../__chunks/NOFH2BLB.cjs');
require('../__chunks/BFE5R4EZ.cjs');
require('../__chunks/MI6NUQYQ.cjs');
require('../__chunks/F6HPKLO2.cjs');
require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/5F4DVUNS.cjs');
require('../__chunks/ULSPM3Y3.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.createMenubarStore = _NOFH2BLBcjs.createMenubarStore;

View File

@@ -0,0 +1,16 @@
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { Store, StoreProps } from "../utils/store.js";
/**
* Creates a menubar store.
*/
export declare function createMenubarStore(props?: MenubarStoreProps): MenubarStore;
export interface MenubarStoreState extends CompositeStoreState {
}
export interface MenubarStoreFunctions extends CompositeStoreFunctions {
}
export interface MenubarStoreOptions extends CompositeStoreOptions {
}
export interface MenubarStoreProps extends MenubarStoreOptions, StoreProps<MenubarStoreState> {
}
export interface MenubarStore extends MenubarStoreFunctions, Store<MenubarStoreState> {
}

View File

@@ -0,0 +1,16 @@
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { Store, StoreProps } from "../utils/store.js";
/**
* Creates a menubar store.
*/
export declare function createMenubarStore(props?: MenubarStoreProps): MenubarStore;
export interface MenubarStoreState extends CompositeStoreState {
}
export interface MenubarStoreFunctions extends CompositeStoreFunctions {
}
export interface MenubarStoreOptions extends CompositeStoreOptions {
}
export interface MenubarStoreProps extends MenubarStoreOptions, StoreProps<MenubarStoreState> {
}
export interface MenubarStore extends MenubarStoreFunctions, Store<MenubarStoreState> {
}

View File

@@ -0,0 +1,12 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _E53JW5BDcjs = require('../__chunks/E53JW5BD.cjs');
require('../__chunks/I3Y4EXEF.cjs');
require('../__chunks/OTVLDMN2.cjs');
require('../__chunks/F6HPKLO2.cjs');
require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.createPopoverStore = _E53JW5BDcjs.createPopoverStore;

View File

@@ -0,0 +1,101 @@
import type { DialogStoreFunctions, DialogStoreOptions, DialogStoreState } from "../dialog/dialog-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
type BasePlacement = "top" | "bottom" | "left" | "right";
type Placement = BasePlacement | `${BasePlacement}-start` | `${BasePlacement}-end`;
/**
* Creates a popover store.
*/
export declare function createPopoverStore({ popover: otherPopover, ...props }?: PopoverStoreProps): PopoverStore;
export interface PopoverStoreState extends DialogStoreState {
/**
* The anchor element.
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
*/
anchorElement: HTMLElement | null;
/**
* The popover element that will render the placement attributes.
*
* Live examples:
* - [Form with Select](https://ariakit.org/examples/form-select)
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
* - [Responsive Popover](https://ariakit.org/examples/popover-responsive)
*/
popoverElement: HTMLElement | null;
/**
* The arrow element.
*/
arrowElement: HTMLElement | null;
/**
* The current temporary position of the popover. This might differ from the
* [`placement`](https://ariakit.org/reference/popover-provider#placement)
* state if the popover has had to adjust its position dynamically.
*
* Live examples:
* - [Tooltip with Framer
* Motion](https://ariakit.org/examples/tooltip-framer-motion)
*/
currentPlacement: Placement;
/**
* The placement of the popover.
*
* Live examples:
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
* - [Selection Popover](https://ariakit.org/examples/popover-selection)
* - [Standalone Popover](https://ariakit.org/examples/popover-standalone)
* - [Select Grid](https://ariakit.org/examples/select-grid)
* @default "bottom"
*/
placement: Placement;
/**
* A symbol that's used to recompute the popover position when the
* [`render`](https://ariakit.org/reference/use-popover-store#render) method
* is called.
*/
rendered: symbol;
}
export interface PopoverStoreFunctions extends DialogStoreFunctions {
/**
* Sets the anchor element.
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
*/
setAnchorElement: SetState<PopoverStoreState["anchorElement"]>;
/**
* Sets the popover element.
*/
setPopoverElement: SetState<PopoverStoreState["popoverElement"]>;
/**
* Sets the arrow element.
*/
setArrowElement: SetState<PopoverStoreState["arrowElement"]>;
/**
* A function that can be used to recompute the popover position. This is
* useful when the popover anchor changes in a way that affects the popover
* position.
*
* Live examples:
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
* - [Selection Popover](https://ariakit.org/examples/popover-selection)
*/
render: () => void;
}
export interface PopoverStoreOptions extends DialogStoreOptions, StoreOptions<PopoverStoreState, "placement"> {
/**
* A reference to another popover store that's controlling another popover to
* keep them in sync.
*/
popover?: PopoverStore | null;
}
export interface PopoverStoreProps extends PopoverStoreOptions, StoreProps<PopoverStoreState> {
}
export interface PopoverStore extends PopoverStoreFunctions, Store<PopoverStoreState> {
}
export {};

View File

@@ -0,0 +1,101 @@
import type { DialogStoreFunctions, DialogStoreOptions, DialogStoreState } from "../dialog/dialog-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
type BasePlacement = "top" | "bottom" | "left" | "right";
type Placement = BasePlacement | `${BasePlacement}-start` | `${BasePlacement}-end`;
/**
* Creates a popover store.
*/
export declare function createPopoverStore({ popover: otherPopover, ...props }?: PopoverStoreProps): PopoverStore;
export interface PopoverStoreState extends DialogStoreState {
/**
* The anchor element.
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
*/
anchorElement: HTMLElement | null;
/**
* The popover element that will render the placement attributes.
*
* Live examples:
* - [Form with Select](https://ariakit.org/examples/form-select)
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
* - [Responsive Popover](https://ariakit.org/examples/popover-responsive)
*/
popoverElement: HTMLElement | null;
/**
* The arrow element.
*/
arrowElement: HTMLElement | null;
/**
* The current temporary position of the popover. This might differ from the
* [`placement`](https://ariakit.org/reference/popover-provider#placement)
* state if the popover has had to adjust its position dynamically.
*
* Live examples:
* - [Tooltip with Framer
* Motion](https://ariakit.org/examples/tooltip-framer-motion)
*/
currentPlacement: Placement;
/**
* The placement of the popover.
*
* Live examples:
* - [Submenu with
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
* - [Selection Popover](https://ariakit.org/examples/popover-selection)
* - [Standalone Popover](https://ariakit.org/examples/popover-standalone)
* - [Select Grid](https://ariakit.org/examples/select-grid)
* @default "bottom"
*/
placement: Placement;
/**
* A symbol that's used to recompute the popover position when the
* [`render`](https://ariakit.org/reference/use-popover-store#render) method
* is called.
*/
rendered: symbol;
}
export interface PopoverStoreFunctions extends DialogStoreFunctions {
/**
* Sets the anchor element.
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
*/
setAnchorElement: SetState<PopoverStoreState["anchorElement"]>;
/**
* Sets the popover element.
*/
setPopoverElement: SetState<PopoverStoreState["popoverElement"]>;
/**
* Sets the arrow element.
*/
setArrowElement: SetState<PopoverStoreState["arrowElement"]>;
/**
* A function that can be used to recompute the popover position. This is
* useful when the popover anchor changes in a way that affects the popover
* position.
*
* Live examples:
* - [Textarea with inline
* Combobox](https://ariakit.org/examples/combobox-textarea)
* - [Selection Popover](https://ariakit.org/examples/popover-selection)
*/
render: () => void;
}
export interface PopoverStoreOptions extends DialogStoreOptions, StoreOptions<PopoverStoreState, "placement"> {
/**
* A reference to another popover store that's controlling another popover to
* keep them in sync.
*/
popover?: PopoverStore | null;
}
export interface PopoverStoreProps extends PopoverStoreOptions, StoreProps<PopoverStoreState> {
}
export interface PopoverStore extends PopoverStoreFunctions, Store<PopoverStoreState> {
}
export {};

43
node_modules/@ariakit/core/cjs/radio/radio-store.cjs generated vendored Normal file
View File

@@ -0,0 +1,43 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _BFE5R4EZcjs = require('../__chunks/BFE5R4EZ.cjs');
require('../__chunks/MI6NUQYQ.cjs');
var _F6HPKLO2cjs = require('../__chunks/F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/5F4DVUNS.cjs');
require('../__chunks/ULSPM3Y3.cjs');
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
// src/radio/radio-store.ts
function createRadioStore(_a = {}) {
var props = _AV6KTKLEcjs.__objRest.call(void 0, _a, []);
var _a2;
const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
const composite = _BFE5R4EZcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
focusLoop: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
}));
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
value: _KBNYGXWIcjs.defaultValue.call(void 0,
props.value,
syncState == null ? void 0 : syncState.value,
props.defaultValue,
null
)
});
const radio = _F6HPKLO2cjs.createStore.call(void 0, initialState, composite, props.store);
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), radio), {
setValue: (value) => radio.setState("value", value)
});
}
exports.createRadioStore = createRadioStore;

39
node_modules/@ariakit/core/cjs/radio/radio-store.d.cts generated vendored Normal file
View File

@@ -0,0 +1,39 @@
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
/**
* Creates a radio store.
*/
export declare function createRadioStore({ ...props }?: RadioStoreProps): RadioStore;
export interface RadioStoreState extends CompositeStoreState {
/**
* @default true
*/
focusLoop: CompositeStoreState["focusLoop"];
/**
* The value of the radio group.
* @default null
*/
value: string | number | null;
}
export interface RadioStoreFunctions extends CompositeStoreFunctions {
/**
* Sets the [`value`](https://ariakit.org/reference/radio-provider#value)
* state.
* @example
* store.setValue("apple");
* store.setValue((value) => value === "apple" ? "orange" : "apple");
*/
setValue: SetState<RadioStoreState["value"]>;
}
export interface RadioStoreOptions extends CompositeStoreOptions, StoreOptions<RadioStoreState, "focusLoop" | "value"> {
/**
* The default value of the radio group.
* @default null
*/
defaultValue?: RadioStoreState["value"];
}
export interface RadioStoreProps extends RadioStoreOptions, StoreProps<RadioStoreState> {
}
export interface RadioStore extends RadioStoreFunctions, Store<RadioStoreState> {
}

39
node_modules/@ariakit/core/cjs/radio/radio-store.d.ts generated vendored Normal file
View File

@@ -0,0 +1,39 @@
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
/**
* Creates a radio store.
*/
export declare function createRadioStore({ ...props }?: RadioStoreProps): RadioStore;
export interface RadioStoreState extends CompositeStoreState {
/**
* @default true
*/
focusLoop: CompositeStoreState["focusLoop"];
/**
* The value of the radio group.
* @default null
*/
value: string | number | null;
}
export interface RadioStoreFunctions extends CompositeStoreFunctions {
/**
* Sets the [`value`](https://ariakit.org/reference/radio-provider#value)
* state.
* @example
* store.setValue("apple");
* store.setValue((value) => value === "apple" ? "orange" : "apple");
*/
setValue: SetState<RadioStoreState["value"]>;
}
export interface RadioStoreOptions extends CompositeStoreOptions, StoreOptions<RadioStoreState, "focusLoop" | "value"> {
/**
* The default value of the radio group.
* @default null
*/
defaultValue?: RadioStoreState["value"];
}
export interface RadioStoreProps extends RadioStoreOptions, StoreProps<RadioStoreState> {
}
export interface RadioStore extends RadioStoreFunctions, Store<RadioStoreState> {
}

166
node_modules/@ariakit/core/cjs/select/select-store.cjs generated vendored Normal file
View File

@@ -0,0 +1,166 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _E53JW5BDcjs = require('../__chunks/E53JW5BD.cjs');
require('../__chunks/I3Y4EXEF.cjs');
require('../__chunks/OTVLDMN2.cjs');
var _BFE5R4EZcjs = require('../__chunks/BFE5R4EZ.cjs');
require('../__chunks/MI6NUQYQ.cjs');
var _F6HPKLO2cjs = require('../__chunks/F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/5F4DVUNS.cjs');
var _ULSPM3Y3cjs = require('../__chunks/ULSPM3Y3.cjs');
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
// src/select/select-store.ts
function createSelectStore(_a = {}) {
var _b = _a, {
combobox
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
"combobox"
]);
const store = _F6HPKLO2cjs.mergeStore.call(void 0,
props.store,
_F6HPKLO2cjs.omit.call(void 0, combobox, [
"value",
"items",
"renderedItems",
"baseElement",
"arrowElement",
"anchorElement",
"contentElement",
"popoverElement",
"disclosureElement"
])
);
_F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, store);
const syncState = store.getState();
const composite = _BFE5R4EZcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
store,
virtualFocus: _KBNYGXWIcjs.defaultValue.call(void 0,
props.virtualFocus,
syncState.virtualFocus,
true
),
includesBaseElement: _KBNYGXWIcjs.defaultValue.call(void 0,
props.includesBaseElement,
syncState.includesBaseElement,
false
),
activeId: _KBNYGXWIcjs.defaultValue.call(void 0,
props.activeId,
syncState.activeId,
props.defaultActiveId,
null
),
orientation: _KBNYGXWIcjs.defaultValue.call(void 0,
props.orientation,
syncState.orientation,
"vertical"
)
}));
const popover = _E53JW5BDcjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
store,
placement: _KBNYGXWIcjs.defaultValue.call(void 0,
props.placement,
syncState.placement,
"bottom-start"
)
}));
const initialValue = new String("");
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), popover.getState()), {
value: _KBNYGXWIcjs.defaultValue.call(void 0,
props.value,
syncState.value,
props.defaultValue,
initialValue
),
setValueOnMove: _KBNYGXWIcjs.defaultValue.call(void 0,
props.setValueOnMove,
syncState.setValueOnMove,
false
),
selectElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState.selectElement, null),
labelElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState.labelElement, null)
});
const select = _F6HPKLO2cjs.createStore.call(void 0, initialState, composite, popover, store);
_F6HPKLO2cjs.setup.call(void 0,
select,
() => _F6HPKLO2cjs.sync.call(void 0, select, ["value", "items"], (state) => {
if (state.value !== initialValue)
return;
if (!state.items.length)
return;
const item = state.items.find(
(item2) => !item2.disabled && item2.value != null
);
if ((item == null ? void 0 : item.value) == null)
return;
select.setState("value", item.value);
})
);
_F6HPKLO2cjs.setup.call(void 0,
select,
() => _F6HPKLO2cjs.sync.call(void 0, select, ["mounted", "items", "value"], (state) => {
if (combobox)
return;
if (state.mounted)
return;
const values = _ULSPM3Y3cjs.toArray.call(void 0, state.value);
const lastValue = values[values.length - 1];
if (lastValue == null)
return;
const item = state.items.find(
(item2) => !item2.disabled && item2.value === lastValue
);
if (!item)
return;
select.setState("activeId", item.id);
})
);
_F6HPKLO2cjs.setup.call(void 0,
select,
() => _F6HPKLO2cjs.batch.call(void 0, select, ["setValueOnMove", "moves"], (state) => {
const { mounted, value, activeId } = select.getState();
if (!state.setValueOnMove && mounted)
return;
if (Array.isArray(value))
return;
if (!state.moves)
return;
if (!activeId)
return;
const item = composite.item(activeId);
if (!item || item.disabled || item.value == null)
return;
select.setState("value", item.value);
})
);
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), popover), select), {
combobox,
setValue: (value) => select.setState("value", value),
setSelectElement: (element) => select.setState("selectElement", element),
setLabelElement: (element) => select.setState("labelElement", element)
});
}
exports.createSelectStore = createSelectStore;

View File

@@ -0,0 +1,102 @@
import type { ComboboxStore } from "../combobox/combobox-store.js";
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { PickRequired, SetState } from "../utils/types.js";
type MutableValue<T extends SelectStoreValue = SelectStoreValue> = T extends string ? string : T;
export declare function createSelectStore<T extends SelectStoreValue = SelectStoreValue>(props: PickRequired<SelectStoreProps<T>, "value" | "defaultValue">): SelectStore<T>;
export declare function createSelectStore(props?: SelectStoreProps): SelectStore;
export type SelectStoreValue = string | string[];
export interface SelectStoreItem extends CompositeStoreItem {
value?: string;
}
export interface SelectStoreState<T extends SelectStoreValue = SelectStoreValue> extends CompositeStoreState<SelectStoreItem>, PopoverStoreState {
/** @default true */
virtualFocus: CompositeStoreState<SelectStoreItem>["virtualFocus"];
/** @default false */
includesBaseElement: CompositeStoreState<SelectStoreItem>["includesBaseElement"];
/** @default null */
activeId: CompositeStoreState<SelectStoreItem>["activeId"];
/** @default "vertical" */
orientation: CompositeStoreState<SelectStoreItem>["orientation"];
/** @default "bottom-start" */
placement: PopoverStoreState["placement"];
/**
* The select value.
*
* Live examples:
* - [Form with Select](https://ariakit.org/examples/form-select)
* - [Select Grid](https://ariakit.org/examples/select-grid)
* - [Select with custom
* items](https://ariakit.org/examples/select-item-custom)
* - [Multi-Select](https://ariakit.org/examples/select-multiple)
* - [Toolbar with Select](https://ariakit.org/examples/toolbar-select)
*/
value: MutableValue<T>;
/**
* Whether the select
* [`value`](https://ariakit.org/reference/select-provider#value) should be
* set when the active item changes by moving (which usually happens when
* moving to an item using the keyboard).
*
* Live examples:
* - [Select Grid](https://ariakit.org/examples/select-grid)
* - [Select with custom
* items](https://ariakit.org/examples/select-item-custom)
* @default false
*/
setValueOnMove: boolean;
/**
* The select button element.
*
* Live examples:
* - [Form with Select](https://ariakit.org/examples/form-select)
*/
selectElement: HTMLElement | null;
/**
* The select label element.
*/
labelElement: HTMLElement | null;
}
export interface SelectStoreFunctions<T extends SelectStoreValue = SelectStoreValue> extends Pick<SelectStoreOptions<T>, "combobox">, CompositeStoreFunctions<SelectStoreItem>, PopoverStoreFunctions {
/**
* Sets the [`value`](https://ariakit.org/reference/select-provider#value)
* state.
* @example
* store.setValue("Apple");
* store.setValue(["Apple", "Banana"]);
* store.setValue((value) => value === "Apple" ? "Banana" : "Apple"));
*/
setValue: SetState<SelectStoreState<T>["value"]>;
/**
* Sets the `selectElement` state.
*/
setSelectElement: SetState<SelectStoreState<T>["selectElement"]>;
/**
* Sets the `labelElement` state.
*/
setLabelElement: SetState<SelectStoreState<T>["labelElement"]>;
}
export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValue> extends CompositeStoreOptions<SelectStoreItem>, PopoverStoreOptions, StoreOptions<SelectStoreState<T>, "virtualFocus" | "includesBaseElement" | "activeId" | "orientation" | "placement" | "value" | "setValueOnMove"> {
/**
* A reference to a combobox store. This is used when combining the combobox
* with a select (e.g., select with a search input). The stores will share the
* same state.
*/
combobox?: ComboboxStore | null;
/**
* The default value. If not set, the first non-disabled item will be used.
*
* Live examples:
* - [Form with Select](https://ariakit.org/examples/form-select)
* - [Animated Select](https://ariakit.org/examples/select-animated)
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
* - [SelectGroup](https://ariakit.org/examples/select-group)
*/
defaultValue?: SelectStoreState<T>["value"];
}
export interface SelectStoreProps<T extends SelectStoreValue = SelectStoreValue> extends SelectStoreOptions<T>, StoreProps<SelectStoreState<T>> {
}
export interface SelectStore<T extends SelectStoreValue = SelectStoreValue> extends SelectStoreFunctions<T>, Store<SelectStoreState<T>> {
}
export {};

102
node_modules/@ariakit/core/cjs/select/select-store.d.ts generated vendored Normal file
View File

@@ -0,0 +1,102 @@
import type { ComboboxStore } from "../combobox/combobox-store.js";
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { PickRequired, SetState } from "../utils/types.js";
type MutableValue<T extends SelectStoreValue = SelectStoreValue> = T extends string ? string : T;
export declare function createSelectStore<T extends SelectStoreValue = SelectStoreValue>(props: PickRequired<SelectStoreProps<T>, "value" | "defaultValue">): SelectStore<T>;
export declare function createSelectStore(props?: SelectStoreProps): SelectStore;
export type SelectStoreValue = string | string[];
export interface SelectStoreItem extends CompositeStoreItem {
value?: string;
}
export interface SelectStoreState<T extends SelectStoreValue = SelectStoreValue> extends CompositeStoreState<SelectStoreItem>, PopoverStoreState {
/** @default true */
virtualFocus: CompositeStoreState<SelectStoreItem>["virtualFocus"];
/** @default false */
includesBaseElement: CompositeStoreState<SelectStoreItem>["includesBaseElement"];
/** @default null */
activeId: CompositeStoreState<SelectStoreItem>["activeId"];
/** @default "vertical" */
orientation: CompositeStoreState<SelectStoreItem>["orientation"];
/** @default "bottom-start" */
placement: PopoverStoreState["placement"];
/**
* The select value.
*
* Live examples:
* - [Form with Select](https://ariakit.org/examples/form-select)
* - [Select Grid](https://ariakit.org/examples/select-grid)
* - [Select with custom
* items](https://ariakit.org/examples/select-item-custom)
* - [Multi-Select](https://ariakit.org/examples/select-multiple)
* - [Toolbar with Select](https://ariakit.org/examples/toolbar-select)
*/
value: MutableValue<T>;
/**
* Whether the select
* [`value`](https://ariakit.org/reference/select-provider#value) should be
* set when the active item changes by moving (which usually happens when
* moving to an item using the keyboard).
*
* Live examples:
* - [Select Grid](https://ariakit.org/examples/select-grid)
* - [Select with custom
* items](https://ariakit.org/examples/select-item-custom)
* @default false
*/
setValueOnMove: boolean;
/**
* The select button element.
*
* Live examples:
* - [Form with Select](https://ariakit.org/examples/form-select)
*/
selectElement: HTMLElement | null;
/**
* The select label element.
*/
labelElement: HTMLElement | null;
}
export interface SelectStoreFunctions<T extends SelectStoreValue = SelectStoreValue> extends Pick<SelectStoreOptions<T>, "combobox">, CompositeStoreFunctions<SelectStoreItem>, PopoverStoreFunctions {
/**
* Sets the [`value`](https://ariakit.org/reference/select-provider#value)
* state.
* @example
* store.setValue("Apple");
* store.setValue(["Apple", "Banana"]);
* store.setValue((value) => value === "Apple" ? "Banana" : "Apple"));
*/
setValue: SetState<SelectStoreState<T>["value"]>;
/**
* Sets the `selectElement` state.
*/
setSelectElement: SetState<SelectStoreState<T>["selectElement"]>;
/**
* Sets the `labelElement` state.
*/
setLabelElement: SetState<SelectStoreState<T>["labelElement"]>;
}
export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValue> extends CompositeStoreOptions<SelectStoreItem>, PopoverStoreOptions, StoreOptions<SelectStoreState<T>, "virtualFocus" | "includesBaseElement" | "activeId" | "orientation" | "placement" | "value" | "setValueOnMove"> {
/**
* A reference to a combobox store. This is used when combining the combobox
* with a select (e.g., select with a search input). The stores will share the
* same state.
*/
combobox?: ComboboxStore | null;
/**
* The default value. If not set, the first non-disabled item will be used.
*
* Live examples:
* - [Form with Select](https://ariakit.org/examples/form-select)
* - [Animated Select](https://ariakit.org/examples/select-animated)
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
* - [SelectGroup](https://ariakit.org/examples/select-group)
*/
defaultValue?: SelectStoreState<T>["value"];
}
export interface SelectStoreProps<T extends SelectStoreValue = SelectStoreValue> extends SelectStoreOptions<T>, StoreProps<SelectStoreState<T>> {
}
export interface SelectStore<T extends SelectStoreValue = SelectStoreValue> extends SelectStoreFunctions<T>, Store<SelectStoreState<T>> {
}
export {};

127
node_modules/@ariakit/core/cjs/tab/tab-store.cjs generated vendored Normal file
View File

@@ -0,0 +1,127 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _BFE5R4EZcjs = require('../__chunks/BFE5R4EZ.cjs');
var _MI6NUQYQcjs = require('../__chunks/MI6NUQYQ.cjs');
var _F6HPKLO2cjs = require('../__chunks/F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/5F4DVUNS.cjs');
require('../__chunks/ULSPM3Y3.cjs');
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
// src/tab/tab-store.ts
function createTabStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const composite = _BFE5R4EZcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
orientation: _KBNYGXWIcjs.defaultValue.call(void 0,
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"horizontal"
),
focusLoop: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
}));
const panels = _MI6NUQYQcjs.createCollectionStore.call(void 0, );
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
selectedId: _KBNYGXWIcjs.defaultValue.call(void 0,
props.selectedId,
syncState == null ? void 0 : syncState.selectedId,
props.defaultSelectedId,
void 0
),
selectOnMove: _KBNYGXWIcjs.defaultValue.call(void 0,
props.selectOnMove,
syncState == null ? void 0 : syncState.selectOnMove,
true
)
});
const tab = _F6HPKLO2cjs.createStore.call(void 0, initialState, composite, props.store);
_F6HPKLO2cjs.setup.call(void 0,
tab,
() => _F6HPKLO2cjs.sync.call(void 0, tab, ["moves"], () => {
const { activeId, selectOnMove } = tab.getState();
if (!selectOnMove)
return;
if (!activeId)
return;
const tabItem = composite.item(activeId);
if (!tabItem)
return;
if (tabItem.dimmed)
return;
if (tabItem.disabled)
return;
tab.setState("selectedId", tabItem.id);
})
);
_F6HPKLO2cjs.setup.call(void 0,
tab,
() => _F6HPKLO2cjs.batch.call(void 0,
tab,
["selectedId"],
(state) => tab.setState("activeId", state.selectedId)
)
);
_F6HPKLO2cjs.setup.call(void 0,
tab,
() => _F6HPKLO2cjs.sync.call(void 0, tab, ["selectedId", "renderedItems"], (state) => {
if (state.selectedId !== void 0)
return;
const { activeId, renderedItems } = tab.getState();
const tabItem = composite.item(activeId);
if (tabItem && !tabItem.disabled && !tabItem.dimmed) {
tab.setState("selectedId", tabItem.id);
} else {
const tabItem2 = renderedItems.find(
(item) => !item.disabled && !item.dimmed
);
tab.setState("selectedId", tabItem2 == null ? void 0 : tabItem2.id);
}
})
);
_F6HPKLO2cjs.setup.call(void 0,
tab,
() => _F6HPKLO2cjs.sync.call(void 0, tab, ["renderedItems"], (state) => {
const tabs = state.renderedItems;
if (!tabs.length)
return;
return _F6HPKLO2cjs.sync.call(void 0, panels, ["renderedItems"], (state2) => {
const items = state2.renderedItems;
const hasOrphanPanels = items.some((panel) => !panel.tabId);
if (!hasOrphanPanels)
return;
items.forEach((panel, i) => {
if (panel.tabId)
return;
const tabItem = tabs[i];
if (!tabItem)
return;
panels.renderItem(_AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, panel), { tabId: tabItem.id }));
});
});
})
);
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), tab), {
panels,
setSelectedId: (id) => tab.setState("selectedId", id),
select: (id) => {
tab.setState("selectedId", id);
composite.move(id);
}
});
}
exports.createTabStore = createTabStore;

91
node_modules/@ariakit/core/cjs/tab/tab-store.d.cts generated vendored Normal file
View File

@@ -0,0 +1,91 @@
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.js";
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
export declare function createTabStore(props?: TabStoreProps): TabStore;
export interface TabStoreItem extends CompositeStoreItem {
dimmed?: boolean;
}
export interface TabStorePanel extends CollectionStoreItem {
tabId?: string | null;
}
export interface TabStoreState extends CompositeStoreState<TabStoreItem> {
/** @default "horizontal" */
orientation: CompositeStoreState<TabStoreItem>["orientation"];
/** @default true */
focusLoop: CompositeStoreState<TabStoreItem>["focusLoop"];
/**
* The id of the tab whose panel is currently visible. If it's `undefined`, it
* will be automatically set to the first enabled tab.
*
* Live examples:
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
*/
selectedId: TabStoreState["activeId"];
/**
* Determines if the tab should be selected when it receives focus. If set to
* `false`, the tab will only be selected upon clicking, not when
* using arrow keys to shift focus.
*
* Live examples:
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
* @default true
*/
selectOnMove?: boolean;
}
export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem> {
/**
* Sets the
* [`selectedId`](https://ariakit.org/reference/tab-provider#selectedid) state
* without moving focus. If you want to move focus, use the
* [`select`](https://ariakit.org/reference/use-tab-store#select) function
* instead.
* @example
* // Selects the tab with id "tab-1"
* store.setSelectedId("tab-1");
* // Toggles between "tab-1" and "tab-2"
* store.setSelectedId((id) => id === "tab-1" ? "tab-2" : "tab-1"));
* // Selects the first tab
* store.setSelectedId(store.first());
* // Selects the next tab
* store.setSelectedId(store.next());
*/
setSelectedId: SetState<TabStoreState["selectedId"]>;
/**
* A collection store containing the tab panels.
*/
panels: CollectionStore<TabStorePanel>;
/**
* Selects the tab for the given id and moves focus to it. If you want to set
* the [`selectedId`](https://ariakit.org/reference/tab-provider#selectedid)
* state without moving focus, use the
* [`setSelectedId`](https://ariakit.org/reference/use-tab-store#setselectedid-1)
* function instead.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
* @example
* // Selects the tab with id "tab-1"
* store.select("tab-1");
* // Selects the first tab
* store.select(store.first());
* // Selects the next tab
* store.select(store.next());
*/
select: TabStore["move"];
}
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<TabStoreItem> {
/**
* The id of the tab whose panel is currently visible. If it's `undefined`, it
* will be automatically set to the first enabled tab.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
*/
defaultSelectedId?: TabStoreState["selectedId"];
}
export interface TabStoreProps extends TabStoreOptions, StoreProps<TabStoreState> {
}
export interface TabStore extends TabStoreFunctions, Store<TabStoreState> {
}

91
node_modules/@ariakit/core/cjs/tab/tab-store.d.ts generated vendored Normal file
View File

@@ -0,0 +1,91 @@
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.js";
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
import type { SetState } from "../utils/types.js";
export declare function createTabStore(props?: TabStoreProps): TabStore;
export interface TabStoreItem extends CompositeStoreItem {
dimmed?: boolean;
}
export interface TabStorePanel extends CollectionStoreItem {
tabId?: string | null;
}
export interface TabStoreState extends CompositeStoreState<TabStoreItem> {
/** @default "horizontal" */
orientation: CompositeStoreState<TabStoreItem>["orientation"];
/** @default true */
focusLoop: CompositeStoreState<TabStoreItem>["focusLoop"];
/**
* The id of the tab whose panel is currently visible. If it's `undefined`, it
* will be automatically set to the first enabled tab.
*
* Live examples:
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
*/
selectedId: TabStoreState["activeId"];
/**
* Determines if the tab should be selected when it receives focus. If set to
* `false`, the tab will only be selected upon clicking, not when
* using arrow keys to shift focus.
*
* Live examples:
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
* @default true
*/
selectOnMove?: boolean;
}
export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem> {
/**
* Sets the
* [`selectedId`](https://ariakit.org/reference/tab-provider#selectedid) state
* without moving focus. If you want to move focus, use the
* [`select`](https://ariakit.org/reference/use-tab-store#select) function
* instead.
* @example
* // Selects the tab with id "tab-1"
* store.setSelectedId("tab-1");
* // Toggles between "tab-1" and "tab-2"
* store.setSelectedId((id) => id === "tab-1" ? "tab-2" : "tab-1"));
* // Selects the first tab
* store.setSelectedId(store.first());
* // Selects the next tab
* store.setSelectedId(store.next());
*/
setSelectedId: SetState<TabStoreState["selectedId"]>;
/**
* A collection store containing the tab panels.
*/
panels: CollectionStore<TabStorePanel>;
/**
* Selects the tab for the given id and moves focus to it. If you want to set
* the [`selectedId`](https://ariakit.org/reference/tab-provider#selectedid)
* state without moving focus, use the
* [`setSelectedId`](https://ariakit.org/reference/use-tab-store#setselectedid-1)
* function instead.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
* @example
* // Selects the tab with id "tab-1"
* store.select("tab-1");
* // Selects the first tab
* store.select(store.first());
* // Selects the next tab
* store.select(store.next());
*/
select: TabStore["move"];
}
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<TabStoreItem> {
/**
* The id of the tab whose panel is currently visible. If it's `undefined`, it
* will be automatically set to the first enabled tab.
*
* Live examples:
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
*/
defaultSelectedId?: TabStoreState["selectedId"];
}
export interface TabStoreProps extends TabStoreOptions, StoreProps<TabStoreState> {
}
export interface TabStore extends TabStoreFunctions, Store<TabStoreState> {
}

View File

@@ -0,0 +1,32 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _BFE5R4EZcjs = require('../__chunks/BFE5R4EZ.cjs');
require('../__chunks/MI6NUQYQ.cjs');
require('../__chunks/F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/5F4DVUNS.cjs');
require('../__chunks/ULSPM3Y3.cjs');
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
// src/toolbar/toolbar-store.ts
function createToolbarStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
return _BFE5R4EZcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
orientation: _KBNYGXWIcjs.defaultValue.call(void 0,
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"horizontal"
),
focusLoop: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
}));
}
exports.createToolbarStore = createToolbarStore;

View File

@@ -0,0 +1,20 @@
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
/**
* Creates a toolbar store.
*/
export declare function createToolbarStore(props?: ToolbarStoreProps): ToolbarStore;
export interface ToolbarStoreState extends CompositeStoreState {
/** @default "horizontal" */
orientation: CompositeStoreState["orientation"];
/** @default true */
focusLoop: CompositeStoreState["focusLoop"];
}
export interface ToolbarStoreFunctions extends CompositeStoreFunctions {
}
export interface ToolbarStoreOptions extends CompositeStoreOptions, StoreOptions<ToolbarStoreState, "orientation" | "focusLoop"> {
}
export interface ToolbarStoreProps extends ToolbarStoreOptions, StoreProps<ToolbarStoreState> {
}
export interface ToolbarStore extends ToolbarStoreFunctions, Store<ToolbarStoreState> {
}

View File

@@ -0,0 +1,20 @@
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
/**
* Creates a toolbar store.
*/
export declare function createToolbarStore(props?: ToolbarStoreProps): ToolbarStore;
export interface ToolbarStoreState extends CompositeStoreState {
/** @default "horizontal" */
orientation: CompositeStoreState["orientation"];
/** @default true */
focusLoop: CompositeStoreState["focusLoop"];
}
export interface ToolbarStoreFunctions extends CompositeStoreFunctions {
}
export interface ToolbarStoreOptions extends CompositeStoreOptions, StoreOptions<ToolbarStoreState, "orientation" | "focusLoop"> {
}
export interface ToolbarStoreProps extends ToolbarStoreOptions, StoreProps<ToolbarStoreState> {
}
export interface ToolbarStore extends ToolbarStoreFunctions, Store<ToolbarStoreState> {
}

View File

@@ -0,0 +1,40 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _TQTGWD5Kcjs = require('../__chunks/TQTGWD5K.cjs');
require('../__chunks/E53JW5BD.cjs');
require('../__chunks/I3Y4EXEF.cjs');
require('../__chunks/OTVLDMN2.cjs');
var _F6HPKLO2cjs = require('../__chunks/F6HPKLO2.cjs');
var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
// src/tooltip/tooltip-store.ts
function createTooltipStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const hovercard = _TQTGWD5Kcjs.createHovercardStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
placement: _KBNYGXWIcjs.defaultValue.call(void 0,
props.placement,
syncState == null ? void 0 : syncState.placement,
"top"
),
hideTimeout: _KBNYGXWIcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout, 0)
}));
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, hovercard.getState()), {
type: _KBNYGXWIcjs.defaultValue.call(void 0, props.type, syncState == null ? void 0 : syncState.type, "description"),
skipTimeout: _KBNYGXWIcjs.defaultValue.call(void 0, props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300)
});
const tooltip = _F6HPKLO2cjs.createStore.call(void 0, initialState, hovercard, props.store);
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, hovercard), tooltip);
}
exports.createTooltipStore = createTooltipStore;

View File

@@ -0,0 +1,33 @@
import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
/**
* Creates a tooltip store.
*/
export declare function createTooltipStore(props?: TooltipStoreProps): TooltipStore;
export interface TooltipStoreState extends HovercardStoreState {
/** @default "top" */
placement: HovercardStoreState["placement"];
/** @default 0 */
hideTimeout?: HovercardStoreState["hideTimeout"];
/**
* Determines whether the tooltip is being used as a label or a description
* for the anchor element.
* @deprecated Render a visually hidden label or use the `aria-label` or
* `aria-labelledby` attributes on the anchor element instead.
* @default "description"
*/
type: "label" | "description";
/**
* The amount of time after a tooltip is hidden while all tooltips on the
* page can be shown immediately, without waiting for the show timeout.
* @default 300
*/
skipTimeout: number;
}
export type TooltipStoreFunctions = HovercardStoreFunctions;
export interface TooltipStoreOptions extends HovercardStoreOptions, StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout"> {
}
export interface TooltipStoreProps extends TooltipStoreOptions, StoreProps<TooltipStoreState> {
}
export interface TooltipStore extends TooltipStoreFunctions, Store<TooltipStoreState> {
}

View File

@@ -0,0 +1,33 @@
import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.js";
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
/**
* Creates a tooltip store.
*/
export declare function createTooltipStore(props?: TooltipStoreProps): TooltipStore;
export interface TooltipStoreState extends HovercardStoreState {
/** @default "top" */
placement: HovercardStoreState["placement"];
/** @default 0 */
hideTimeout?: HovercardStoreState["hideTimeout"];
/**
* Determines whether the tooltip is being used as a label or a description
* for the anchor element.
* @deprecated Render a visually hidden label or use the `aria-label` or
* `aria-labelledby` attributes on the anchor element instead.
* @default "description"
*/
type: "label" | "description";
/**
* The amount of time after a tooltip is hidden while all tooltips on the
* page can be shown immediately, without waiting for the show timeout.
* @default 300
*/
skipTimeout: number;
}
export type TooltipStoreFunctions = HovercardStoreFunctions;
export interface TooltipStoreOptions extends HovercardStoreOptions, StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout"> {
}
export interface TooltipStoreProps extends TooltipStoreOptions, StoreProps<TooltipStoreState> {
}
export interface TooltipStore extends TooltipStoreFunctions, Store<TooltipStoreState> {
}

14
node_modules/@ariakit/core/cjs/utils/array.cjs generated vendored Normal file
View File

@@ -0,0 +1,14 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _ULSPM3Y3cjs = require('../__chunks/ULSPM3Y3.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.addItemToArray = _ULSPM3Y3cjs.addItemToArray; exports.flatten2DArray = _ULSPM3Y3cjs.flatten2DArray; exports.reverseArray = _ULSPM3Y3cjs.reverseArray; exports.toArray = _ULSPM3Y3cjs.toArray;

29
node_modules/@ariakit/core/cjs/utils/array.d.cts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/**
* Transforms `arg` into an array if it's not already.
* @example
* toArray("a"); // ["a"]
* toArray(["a"]); // ["a"]
*/
export declare function toArray<T>(arg: T): T extends readonly any[] ? T : T[];
/**
* Immutably adds an index to an array.
* @example
* addItemToArray(["a", "b", "d"], "c", 2); // ["a", "b", "c", "d"]
* @returns {Array} A new array with the item in the passed array index.
*/
export declare function addItemToArray<T extends any[]>(array: T, item: T[number], index?: number): T;
/**
* Flattens a 2D array into a one-dimensional array.
* @example
* flatten2DArray([["a"], ["b"], ["c"]]); // ["a", "b", "c"]
*
* @returns {Array} A one-dimensional array.
*/
export declare function flatten2DArray<T>(array: T[][]): T[];
/**
* Immutably reverses an array.
* @example
* reverseArray(["a", "b", "c"]); // ["c", "b", "a"]
* @returns {Array} Reversed array.
*/
export declare function reverseArray<T>(array: T[]): T[];

29
node_modules/@ariakit/core/cjs/utils/array.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/**
* Transforms `arg` into an array if it's not already.
* @example
* toArray("a"); // ["a"]
* toArray(["a"]); // ["a"]
*/
export declare function toArray<T>(arg: T): T extends readonly any[] ? T : T[];
/**
* Immutably adds an index to an array.
* @example
* addItemToArray(["a", "b", "d"], "c", 2); // ["a", "b", "c", "d"]
* @returns {Array} A new array with the item in the passed array index.
*/
export declare function addItemToArray<T extends any[]>(array: T, item: T[number], index?: number): T;
/**
* Flattens a 2D array into a one-dimensional array.
* @example
* flatten2DArray([["a"], ["b"], ["c"]]); // ["a", "b", "c"]
*
* @returns {Array} A one-dimensional array.
*/
export declare function flatten2DArray<T>(array: T[][]): T[];
/**
* Immutably reverses an array.
* @example
* reverseArray(["a", "b", "c"]); // ["c", "b", "a"]
* @returns {Array} Reversed array.
*/
export declare function reverseArray<T>(array: T[]): T[];

42
node_modules/@ariakit/core/cjs/utils/dom.cjs generated vendored Normal file
View File

@@ -0,0 +1,42 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _5F4DVUNScjs = require('../__chunks/5F4DVUNS.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.canUseDOM = _5F4DVUNScjs.canUseDOM; exports.closest = _5F4DVUNScjs.closest; exports.contains = _5F4DVUNScjs.contains; exports.getActiveElement = _5F4DVUNScjs.getActiveElement; exports.getDocument = _5F4DVUNScjs.getDocument; exports.getPopupItemRole = _5F4DVUNScjs.getPopupItemRole; exports.getPopupRole = _5F4DVUNScjs.getPopupRole; exports.getScrollingElement = _5F4DVUNScjs.getScrollingElement; exports.getTextboxSelection = _5F4DVUNScjs.getTextboxSelection; exports.getWindow = _5F4DVUNScjs.getWindow; exports.isButton = _5F4DVUNScjs.isButton; exports.isFrame = _5F4DVUNScjs.isFrame; exports.isPartiallyHidden = _5F4DVUNScjs.isPartiallyHidden; exports.isTextField = _5F4DVUNScjs.isTextField; exports.isVisible = _5F4DVUNScjs.isVisible; exports.matches = _5F4DVUNScjs.matches; exports.scrollIntoViewIfNeeded = _5F4DVUNScjs.scrollIntoViewIfNeeded; exports.setSelectionRange = _5F4DVUNScjs.setSelectionRange;

114
node_modules/@ariakit/core/cjs/utils/dom.d.cts generated vendored Normal file
View File

@@ -0,0 +1,114 @@
import type { AriaHasPopup, AriaRole } from "./types.js";
/**
* It's `true` if it is running in a browser environment or `false` if it is not
* (SSR).
* @example
* const title = canUseDOM ? document.title : "";
*/
export declare const canUseDOM: boolean;
/**
* Returns `element.ownerDocument || document`.
*/
export declare function getDocument(node?: Node | null): Document;
/**
* Returns `element.ownerDocument.defaultView || window`.
*/
export declare function getWindow(node?: Node | null): Window;
/**
* Returns `element.ownerDocument.activeElement`.
*/
export declare function getActiveElement(node?: Node | null, activeDescendant?: boolean): HTMLElement | null;
/**
* Similar to `Element.prototype.contains`, but a little bit faster when
* `element` is the same as `child`.
* @example
* contains(
* document.getElementById("parent"),
* document.getElementById("child")
* );
*/
export declare function contains(parent: Node, child: Node): boolean;
/**
* Checks whether `element` is a frame element.
*/
export declare function isFrame(element: Element): element is HTMLIFrameElement;
/**
* Checks whether `element` is a native HTML button element.
* @example
* isButton(document.querySelector("button")); // true
* isButton(document.querySelector("input[type='button']")); // true
* isButton(document.querySelector("div")); // false
* isButton(document.querySelector("input[type='text']")); // false
* isButton(document.querySelector("div[role='button']")); // false
*/
export declare function isButton(element: {
tagName: string;
type?: string;
}): boolean;
/**
* Ponyfill for `Element.prototype.matches`
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
*/
export declare function matches(element: Element, selectors: string): boolean;
/**
* Checks if the element is visible or not.
*/
export declare function isVisible(element: Element): boolean;
/**
* Ponyfill for `Element.prototype.closest`
* @example
* closest(document.getElementById("id"), "div");
* // same as
* document.getElementById("id").closest("div");
*/
export declare function closest<K extends keyof HTMLElementTagNameMap>(element: Element, selectors: K): HTMLElementTagNameMap[K];
export declare function closest<K extends keyof SVGElementTagNameMap>(element: Element, selectors: K): SVGElementTagNameMap[K];
export declare function closest<T extends Element = Element>(element: Element, selectors: string): T | null;
/**
* Check whether the given element is a text field, where text field is defined
* by the ability to select within the input.
* @example
* isTextField(document.querySelector("div")); // false
* isTextField(document.querySelector("input")); // true
* isTextField(document.querySelector("input[type='button']")); // false
* isTextField(document.querySelector("textarea")); // true
*/
export declare function isTextField(element: Element): element is HTMLInputElement | HTMLTextAreaElement;
/**
* Returns the element's role attribute, if it has one.
*/
export declare function getPopupRole(element?: Element | null, fallback?: AriaHasPopup): AriaHasPopup;
/**
* Returns the item role attribute based on the popup's role.
*/
export declare function getPopupItemRole(element?: Element | null, fallback?: AriaRole): string | undefined;
/**
* Returns the start and end offsets of the selection in the element.
*/
export declare function getTextboxSelection(element: HTMLElement): {
start: number;
end: number;
};
/**
* Calls `element.scrollIntoView()` if the element is hidden or partly hidden in
* the viewport.
*/
export declare function scrollIntoViewIfNeeded(element: Element, arg?: boolean | ScrollIntoViewOptions): void;
/**
* Returns the scrolling container element of a given element.
*/
export declare function getScrollingElement(element?: Element | null): HTMLElement | Element | null;
/**
* Determines whether an element is hidden or partially hidden in the viewport.
*/
export declare function isPartiallyHidden(element: Element): boolean;
/**
* SelectionRange only works on a few types of input.
* Calling `setSelectionRange` on a unsupported input type may throw an error on certain browsers.
* To avoid it, we check if its type supports SelectionRange first.
* It will be a noop to non-supported types until we find a workaround.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
*/
export declare function setSelectionRange(element: HTMLInputElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;

114
node_modules/@ariakit/core/cjs/utils/dom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,114 @@
import type { AriaHasPopup, AriaRole } from "./types.js";
/**
* It's `true` if it is running in a browser environment or `false` if it is not
* (SSR).
* @example
* const title = canUseDOM ? document.title : "";
*/
export declare const canUseDOM: boolean;
/**
* Returns `element.ownerDocument || document`.
*/
export declare function getDocument(node?: Node | null): Document;
/**
* Returns `element.ownerDocument.defaultView || window`.
*/
export declare function getWindow(node?: Node | null): Window;
/**
* Returns `element.ownerDocument.activeElement`.
*/
export declare function getActiveElement(node?: Node | null, activeDescendant?: boolean): HTMLElement | null;
/**
* Similar to `Element.prototype.contains`, but a little bit faster when
* `element` is the same as `child`.
* @example
* contains(
* document.getElementById("parent"),
* document.getElementById("child")
* );
*/
export declare function contains(parent: Node, child: Node): boolean;
/**
* Checks whether `element` is a frame element.
*/
export declare function isFrame(element: Element): element is HTMLIFrameElement;
/**
* Checks whether `element` is a native HTML button element.
* @example
* isButton(document.querySelector("button")); // true
* isButton(document.querySelector("input[type='button']")); // true
* isButton(document.querySelector("div")); // false
* isButton(document.querySelector("input[type='text']")); // false
* isButton(document.querySelector("div[role='button']")); // false
*/
export declare function isButton(element: {
tagName: string;
type?: string;
}): boolean;
/**
* Ponyfill for `Element.prototype.matches`
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
*/
export declare function matches(element: Element, selectors: string): boolean;
/**
* Checks if the element is visible or not.
*/
export declare function isVisible(element: Element): boolean;
/**
* Ponyfill for `Element.prototype.closest`
* @example
* closest(document.getElementById("id"), "div");
* // same as
* document.getElementById("id").closest("div");
*/
export declare function closest<K extends keyof HTMLElementTagNameMap>(element: Element, selectors: K): HTMLElementTagNameMap[K];
export declare function closest<K extends keyof SVGElementTagNameMap>(element: Element, selectors: K): SVGElementTagNameMap[K];
export declare function closest<T extends Element = Element>(element: Element, selectors: string): T | null;
/**
* Check whether the given element is a text field, where text field is defined
* by the ability to select within the input.
* @example
* isTextField(document.querySelector("div")); // false
* isTextField(document.querySelector("input")); // true
* isTextField(document.querySelector("input[type='button']")); // false
* isTextField(document.querySelector("textarea")); // true
*/
export declare function isTextField(element: Element): element is HTMLInputElement | HTMLTextAreaElement;
/**
* Returns the element's role attribute, if it has one.
*/
export declare function getPopupRole(element?: Element | null, fallback?: AriaHasPopup): AriaHasPopup;
/**
* Returns the item role attribute based on the popup's role.
*/
export declare function getPopupItemRole(element?: Element | null, fallback?: AriaRole): string | undefined;
/**
* Returns the start and end offsets of the selection in the element.
*/
export declare function getTextboxSelection(element: HTMLElement): {
start: number;
end: number;
};
/**
* Calls `element.scrollIntoView()` if the element is hidden or partly hidden in
* the viewport.
*/
export declare function scrollIntoViewIfNeeded(element: Element, arg?: boolean | ScrollIntoViewOptions): void;
/**
* Returns the scrolling container element of a given element.
*/
export declare function getScrollingElement(element?: Element | null): HTMLElement | Element | null;
/**
* Determines whether an element is hidden or partially hidden in the viewport.
*/
export declare function isPartiallyHidden(element: Element): boolean;
/**
* SelectionRange only works on a few types of input.
* Calling `setSelectionRange` on a unsupported input type may throw an error on certain browsers.
* To avoid it, we check if its type supports SelectionRange first.
* It will be a noop to non-supported types until we find a workaround.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
*/
export declare function setSelectionRange(element: HTMLInputElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;

132
node_modules/@ariakit/core/cjs/utils/events.cjs generated vendored Normal file
View File

@@ -0,0 +1,132 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _YIUPKKEKcjs = require('../__chunks/YIUPKKEK.cjs');
var _5F4DVUNScjs = require('../__chunks/5F4DVUNS.cjs');
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
// src/utils/events.ts
function isPortalEvent(event) {
return Boolean(
event.currentTarget && !_5F4DVUNScjs.contains.call(void 0, event.currentTarget, event.target)
);
}
function isSelfTarget(event) {
return event.target === event.currentTarget;
}
function isOpeningInNewTab(event) {
const element = event.currentTarget;
if (!element)
return false;
const isAppleDevice = _YIUPKKEKcjs.isApple.call(void 0, );
if (isAppleDevice && !event.metaKey)
return false;
if (!isAppleDevice && !event.ctrlKey)
return false;
const tagName = element.tagName.toLowerCase();
if (tagName === "a")
return true;
if (tagName === "button" && element.type === "submit")
return true;
if (tagName === "input" && element.type === "submit")
return true;
return false;
}
function isDownloading(event) {
const element = event.currentTarget;
if (!element)
return false;
const tagName = element.tagName.toLowerCase();
if (!event.altKey)
return false;
if (tagName === "a")
return true;
if (tagName === "button" && element.type === "submit")
return true;
if (tagName === "input" && element.type === "submit")
return true;
return false;
}
function fireEvent(element, type, eventInit) {
const event = new Event(type, eventInit);
return element.dispatchEvent(event);
}
function fireBlurEvent(element, eventInit) {
const event = new FocusEvent("blur", eventInit);
const defaultAllowed = element.dispatchEvent(event);
const bubbleInit = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, eventInit), { bubbles: true });
element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
return defaultAllowed;
}
function fireFocusEvent(element, eventInit) {
const event = new FocusEvent("focus", eventInit);
const defaultAllowed = element.dispatchEvent(event);
const bubbleInit = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, eventInit), { bubbles: true });
element.dispatchEvent(new FocusEvent("focusin", bubbleInit));
return defaultAllowed;
}
function fireKeyboardEvent(element, type, eventInit) {
const event = new KeyboardEvent(type, eventInit);
return element.dispatchEvent(event);
}
function fireClickEvent(element, eventInit) {
const event = new MouseEvent("click", eventInit);
return element.dispatchEvent(event);
}
function isFocusEventOutside(event, container) {
const containerElement = container || event.currentTarget;
const relatedTarget = event.relatedTarget;
return !relatedTarget || !_5F4DVUNScjs.contains.call(void 0, containerElement, relatedTarget);
}
function queueBeforeEvent(element, type, callback) {
const raf = requestAnimationFrame(() => {
element.removeEventListener(type, callImmediately, true);
callback();
});
const callImmediately = () => {
cancelAnimationFrame(raf);
callback();
};
element.addEventListener(type, callImmediately, {
once: true,
capture: true
});
return raf;
}
function addGlobalEventListener(type, listener, options, scope = window) {
const children = [];
try {
scope.document.addEventListener(type, listener, options);
for (const frame of Array.from(scope.frames)) {
children.push(addGlobalEventListener(type, listener, options, frame));
}
} catch (e) {
}
const removeEventListener = () => {
try {
scope.document.removeEventListener(type, listener, options);
} catch (e) {
}
children.forEach((remove) => remove());
};
return removeEventListener;
}
exports.addGlobalEventListener = addGlobalEventListener; exports.fireBlurEvent = fireBlurEvent; exports.fireClickEvent = fireClickEvent; exports.fireEvent = fireEvent; exports.fireFocusEvent = fireFocusEvent; exports.fireKeyboardEvent = fireKeyboardEvent; exports.isDownloading = isDownloading; exports.isFocusEventOutside = isFocusEventOutside; exports.isOpeningInNewTab = isOpeningInNewTab; exports.isPortalEvent = isPortalEvent; exports.isSelfTarget = isSelfTarget; exports.queueBeforeEvent = queueBeforeEvent;

70
node_modules/@ariakit/core/cjs/utils/events.d.cts generated vendored Normal file
View File

@@ -0,0 +1,70 @@
/**
* Returns `true` if `event` has been fired within a React Portal element.
*/
export declare function isPortalEvent(event: Pick<Event, "currentTarget" | "target">): boolean;
/**
* Returns `true` if `event.target` and `event.currentTarget` are the same.
*/
export declare function isSelfTarget(event: Pick<Event, "target" | "currentTarget">): boolean;
/**
* Checks whether the user event is triggering a page navigation in a new tab.
*/
export declare function isOpeningInNewTab(event: Pick<MouseEvent, "currentTarget" | "metaKey" | "ctrlKey">): boolean;
/**
* Checks whether the user event is triggering a download.
*/
export declare function isDownloading(event: Pick<MouseEvent, "altKey" | "currentTarget">): boolean;
/**
* Creates and dispatches an event.
* @example
* fireEvent(document.getElementById("id"), "blur", {
* bubbles: true,
* cancelable: true,
* });
*/
export declare function fireEvent(element: Element, type: string, eventInit?: EventInit): boolean;
/**
* Creates and dispatches a blur event.
* @example
* fireBlurEvent(document.getElementById("id"));
*/
export declare function fireBlurEvent(element: Element, eventInit?: FocusEventInit): boolean;
/**
* Creates and dispatches a focus event.
* @example
* fireFocusEvent(document.getElementById("id"));
*/
export declare function fireFocusEvent(element: Element, eventInit?: FocusEventInit): boolean;
/**
* Creates and dispatches a keyboard event.
* @example
* fireKeyboardEvent(document.getElementById("id"), "keydown", {
* key: "ArrowDown",
* shiftKey: true,
* });
*/
export declare function fireKeyboardEvent(element: Element, type: string, eventInit?: KeyboardEventInit): boolean;
/**
* Creates and dispatches a click event.
* @example
* fireClickEvent(document.getElementById("id"));
*/
export declare function fireClickEvent(element: Element, eventInit?: PointerEventInit): boolean;
/**
* Checks whether the focus/blur event is happening from/to outside of the
* container element.
* @example
* const element = document.getElementById("id");
* element.addEventListener("blur", (event) => {
* if (isFocusEventOutside(event)) {
* // ...
* }
* });
*/
export declare function isFocusEventOutside(event: Pick<FocusEvent, "currentTarget" | "relatedTarget">, container?: Element | null): boolean;
/**
* Runs a callback on the next animation frame, but before a certain event.
*/
export declare function queueBeforeEvent(element: Element, type: string, callback: () => void): number;
export declare function addGlobalEventListener<K extends keyof DocumentEventMap>(type: K, listener: (event: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions, scope?: Window): () => void;
export declare function addGlobalEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions, scope?: Window): () => void;

70
node_modules/@ariakit/core/cjs/utils/events.d.ts generated vendored Normal file
View File

@@ -0,0 +1,70 @@
/**
* Returns `true` if `event` has been fired within a React Portal element.
*/
export declare function isPortalEvent(event: Pick<Event, "currentTarget" | "target">): boolean;
/**
* Returns `true` if `event.target` and `event.currentTarget` are the same.
*/
export declare function isSelfTarget(event: Pick<Event, "target" | "currentTarget">): boolean;
/**
* Checks whether the user event is triggering a page navigation in a new tab.
*/
export declare function isOpeningInNewTab(event: Pick<MouseEvent, "currentTarget" | "metaKey" | "ctrlKey">): boolean;
/**
* Checks whether the user event is triggering a download.
*/
export declare function isDownloading(event: Pick<MouseEvent, "altKey" | "currentTarget">): boolean;
/**
* Creates and dispatches an event.
* @example
* fireEvent(document.getElementById("id"), "blur", {
* bubbles: true,
* cancelable: true,
* });
*/
export declare function fireEvent(element: Element, type: string, eventInit?: EventInit): boolean;
/**
* Creates and dispatches a blur event.
* @example
* fireBlurEvent(document.getElementById("id"));
*/
export declare function fireBlurEvent(element: Element, eventInit?: FocusEventInit): boolean;
/**
* Creates and dispatches a focus event.
* @example
* fireFocusEvent(document.getElementById("id"));
*/
export declare function fireFocusEvent(element: Element, eventInit?: FocusEventInit): boolean;
/**
* Creates and dispatches a keyboard event.
* @example
* fireKeyboardEvent(document.getElementById("id"), "keydown", {
* key: "ArrowDown",
* shiftKey: true,
* });
*/
export declare function fireKeyboardEvent(element: Element, type: string, eventInit?: KeyboardEventInit): boolean;
/**
* Creates and dispatches a click event.
* @example
* fireClickEvent(document.getElementById("id"));
*/
export declare function fireClickEvent(element: Element, eventInit?: PointerEventInit): boolean;
/**
* Checks whether the focus/blur event is happening from/to outside of the
* container element.
* @example
* const element = document.getElementById("id");
* element.addEventListener("blur", (event) => {
* if (isFocusEventOutside(event)) {
* // ...
* }
* });
*/
export declare function isFocusEventOutside(event: Pick<FocusEvent, "currentTarget" | "relatedTarget">, container?: Element | null): boolean;
/**
* Runs a callback on the next animation frame, but before a certain event.
*/
export declare function queueBeforeEvent(element: Element, type: string, callback: () => void): number;
export declare function addGlobalEventListener<K extends keyof DocumentEventMap>(type: K, listener: (event: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions, scope?: Window): () => void;
export declare function addGlobalEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions, scope?: Window): () => void;

261
node_modules/@ariakit/core/cjs/utils/focus.cjs generated vendored Normal file
View File

@@ -0,0 +1,261 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _5F4DVUNScjs = require('../__chunks/5F4DVUNS.cjs');
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
// src/utils/focus.ts
var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
function hasNegativeTabIndex(element) {
const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
return tabIndex < 0;
}
function isFocusable(element) {
if (!_5F4DVUNScjs.matches.call(void 0, element, selector))
return false;
if (!_5F4DVUNScjs.isVisible.call(void 0, element))
return false;
if (_5F4DVUNScjs.closest.call(void 0, element, "[inert]"))
return false;
return true;
}
function isTabbable(element) {
if (!isFocusable(element))
return false;
if (hasNegativeTabIndex(element))
return false;
if (!("form" in element))
return true;
if (!element.form)
return true;
if (element.checked)
return true;
if (element.type !== "radio")
return true;
const radioGroup = element.form.elements.namedItem(element.name);
if (!radioGroup)
return true;
if (!("length" in radioGroup))
return true;
const activeElement = _5F4DVUNScjs.getActiveElement.call(void 0, element);
if (!activeElement)
return true;
if (activeElement === element)
return true;
if (!("form" in activeElement))
return true;
if (activeElement.form !== element.form)
return true;
if (activeElement.name !== element.name)
return true;
return false;
}
function getAllFocusableIn(container, includeContainer) {
const elements = Array.from(
container.querySelectorAll(selector)
);
if (includeContainer) {
elements.unshift(container);
}
const focusableElements = elements.filter(isFocusable);
focusableElements.forEach((element, i) => {
if (_5F4DVUNScjs.isFrame.call(void 0, element) && element.contentDocument) {
const frameBody = element.contentDocument.body;
focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
}
});
return focusableElements;
}
function getAllFocusable(includeBody) {
return getAllFocusableIn(document.body, includeBody);
}
function getFirstFocusableIn(container, includeContainer) {
const [first] = getAllFocusableIn(container, includeContainer);
return first || null;
}
function getFirstFocusable(includeBody) {
return getFirstFocusableIn(document.body, includeBody);
}
function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
const elements = Array.from(
container.querySelectorAll(selector)
);
const tabbableElements = elements.filter(isTabbable);
if (includeContainer && isTabbable(container)) {
tabbableElements.unshift(container);
}
tabbableElements.forEach((element, i) => {
if (_5F4DVUNScjs.isFrame.call(void 0, element) && element.contentDocument) {
const frameBody = element.contentDocument.body;
const allFrameTabbable = getAllTabbableIn(
frameBody,
false,
fallbackToFocusable
);
tabbableElements.splice(i, 1, ...allFrameTabbable);
}
});
if (!tabbableElements.length && fallbackToFocusable) {
return elements;
}
return tabbableElements;
}
function getAllTabbable(fallbackToFocusable) {
return getAllTabbableIn(document.body, false, fallbackToFocusable);
}
function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) {
const [first] = getAllTabbableIn(
container,
includeContainer,
fallbackToFocusable
);
return first || null;
}
function getFirstTabbable(fallbackToFocusable) {
return getFirstTabbableIn(document.body, false, fallbackToFocusable);
}
function getLastTabbableIn(container, includeContainer, fallbackToFocusable) {
const allTabbable = getAllTabbableIn(
container,
includeContainer,
fallbackToFocusable
);
return allTabbable[allTabbable.length - 1] || null;
}
function getLastTabbable(fallbackToFocusable) {
return getLastTabbableIn(document.body, false, fallbackToFocusable);
}
function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
const activeElement = _5F4DVUNScjs.getActiveElement.call(void 0, container);
const allFocusable = getAllFocusableIn(container, includeContainer);
const activeIndex = allFocusable.indexOf(activeElement);
const nextFocusableElements = allFocusable.slice(activeIndex + 1);
return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null;
}
function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
return getNextTabbableIn(
document.body,
false,
fallbackToFirst,
fallbackToFocusable
);
}
function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
const activeElement = _5F4DVUNScjs.getActiveElement.call(void 0, container);
const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
const activeIndex = allFocusable.indexOf(activeElement);
const previousFocusableElements = allFocusable.slice(activeIndex + 1);
return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null;
}
function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
return getPreviousTabbableIn(
document.body,
false,
fallbackToFirst,
fallbackToFocusable
);
}
function getClosestFocusable(element) {
while (element && !isFocusable(element)) {
element = _5F4DVUNScjs.closest.call(void 0, element, selector);
}
return element || null;
}
function hasFocus(element) {
const activeElement = _5F4DVUNScjs.getActiveElement.call(void 0, element);
if (!activeElement)
return false;
if (activeElement === element)
return true;
const activeDescendant = activeElement.getAttribute("aria-activedescendant");
if (!activeDescendant)
return false;
return activeDescendant === element.id;
}
function hasFocusWithin(element) {
const activeElement = _5F4DVUNScjs.getActiveElement.call(void 0, element);
if (!activeElement)
return false;
if (_5F4DVUNScjs.contains.call(void 0, element, activeElement))
return true;
const activeDescendant = activeElement.getAttribute("aria-activedescendant");
if (!activeDescendant)
return false;
if (!("id" in element))
return false;
if (activeDescendant === element.id)
return true;
return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
}
function focusIfNeeded(element) {
if (!hasFocusWithin(element) && isFocusable(element)) {
element.focus();
}
}
function disableFocus(element) {
var _a;
const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : "";
element.setAttribute("data-tabindex", currentTabindex);
element.setAttribute("tabindex", "-1");
}
function disableFocusIn(container, includeContainer) {
const tabbableElements = getAllTabbableIn(container, includeContainer);
tabbableElements.forEach(disableFocus);
}
function restoreFocusIn(container) {
const elements = container.querySelectorAll("[data-tabindex]");
const restoreTabIndex = (element) => {
const tabindex = element.getAttribute("data-tabindex");
element.removeAttribute("data-tabindex");
if (tabindex) {
element.setAttribute("tabindex", tabindex);
} else {
element.removeAttribute("tabindex");
}
};
if (container.hasAttribute("data-tabindex")) {
restoreTabIndex(container);
}
elements.forEach(restoreTabIndex);
}
function focusIntoView(element, options) {
if (!("scrollIntoView" in element)) {
element.focus();
} else {
element.focus({ preventScroll: true });
element.scrollIntoView(_AV6KTKLEcjs.__spreadValues.call(void 0, { block: "nearest", inline: "nearest" }, options));
}
}
exports.disableFocus = disableFocus; exports.disableFocusIn = disableFocusIn; exports.focusIfNeeded = focusIfNeeded; exports.focusIntoView = focusIntoView; exports.getAllFocusable = getAllFocusable; exports.getAllFocusableIn = getAllFocusableIn; exports.getAllTabbable = getAllTabbable; exports.getAllTabbableIn = getAllTabbableIn; exports.getClosestFocusable = getClosestFocusable; exports.getFirstFocusable = getFirstFocusable; exports.getFirstFocusableIn = getFirstFocusableIn; exports.getFirstTabbable = getFirstTabbable; exports.getFirstTabbableIn = getFirstTabbableIn; exports.getLastTabbable = getLastTabbable; exports.getLastTabbableIn = getLastTabbableIn; exports.getNextTabbable = getNextTabbable; exports.getNextTabbableIn = getNextTabbableIn; exports.getPreviousTabbable = getPreviousTabbable; exports.getPreviousTabbableIn = getPreviousTabbableIn; exports.hasFocus = hasFocus; exports.hasFocusWithin = hasFocusWithin; exports.isFocusable = isFocusable; exports.isTabbable = isTabbable; exports.restoreFocusIn = restoreFocusIn;

117
node_modules/@ariakit/core/cjs/utils/focus.d.cts generated vendored Normal file
View File

@@ -0,0 +1,117 @@
/**
* Checks whether `element` is focusable or not.
* @example
* isFocusable(document.querySelector("input")); // true
* isFocusable(document.querySelector("input[tabindex='-1']")); // true
* isFocusable(document.querySelector("input[hidden]")); // false
* isFocusable(document.querySelector("input:disabled")); // false
*/
export declare function isFocusable(element: Element): element is HTMLElement;
/**
* Checks whether `element` is tabbable or not.
* @example
* isTabbable(document.querySelector("input")); // true
* isTabbable(document.querySelector("input[tabindex='-1']")); // false
* isTabbable(document.querySelector("input[hidden]")); // false
* isTabbable(document.querySelector("input:disabled")); // false
*/
export declare function isTabbable(element: Element | HTMLElement | HTMLInputElement): element is HTMLElement;
/**
* Returns all the focusable elements in `container`.
*/
export declare function getAllFocusableIn(container: HTMLElement, includeContainer?: boolean): HTMLElement[];
/**
* Returns all the focusable elements in the document.
*/
export declare function getAllFocusable(includeBody?: boolean): HTMLElement[];
/**
* Returns the first focusable element in `container`.
*/
export declare function getFirstFocusableIn(container: HTMLElement, includeContainer?: boolean): HTMLElement | null;
/**
* Returns the first focusable element in the document.
*/
export declare function getFirstFocusable(includeBody?: boolean): HTMLElement | null;
/**
* Returns all the tabbable elements in `container`, including the container
* itself.
*/
export declare function getAllTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFocusable?: boolean): HTMLElement[];
/**
* Returns all the tabbable elements in the document.
*/
export declare function getAllTabbable(fallbackToFocusable?: boolean): HTMLElement[];
/**
* Returns the first tabbable element in `container`, including the container
* itself if it's tabbable.
*/
export declare function getFirstTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the first tabbable element in the document.
*/
export declare function getFirstTabbable(fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the last tabbable element in `container`, including the container
* itself if it's tabbable.
*/
export declare function getLastTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the last tabbable element in the document.
*/
export declare function getLastTabbable(fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the next tabbable element in `container`.
*/
export declare function getNextTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFirst?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the next tabbable element in the document.
*/
export declare function getNextTabbable(fallbackToFirst?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the previous tabbable element in `container`.
*
*/
export declare function getPreviousTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToLast?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the previous tabbable element in the document.
*/
export declare function getPreviousTabbable(fallbackToFirst?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the closest focusable element.
*/
export declare function getClosestFocusable(element?: HTMLElement | null): HTMLElement | null;
/**
* Checks if `element` has focus. Elements that are referenced by
* `aria-activedescendant` are also considered.
* @example
* hasFocus(document.getElementById("id"));
*/
export declare function hasFocus(element: Element): boolean;
/**
* Checks if `element` has focus within. Elements that are referenced by
* `aria-activedescendant` are also considered.
* @example
* hasFocusWithin(document.getElementById("id"));
*/
export declare function hasFocusWithin(element: Node | Element): boolean;
/**
* Focus on an element only if it's not already focused.
*/
export declare function focusIfNeeded(element: HTMLElement): void;
/**
* Disable focus on `element`.
*/
export declare function disableFocus(element: HTMLElement): void;
/**
* Makes elements inside container not tabbable.
*/
export declare function disableFocusIn(container: HTMLElement, includeContainer?: boolean): void;
/**
* Restores tabbable elements inside container that were affected by
* disableFocusIn.
*/
export declare function restoreFocusIn(container: HTMLElement): void;
/**
* Focus on element and scroll into view.
*/
export declare function focusIntoView(element: HTMLElement, options?: ScrollIntoViewOptions): void;

117
node_modules/@ariakit/core/cjs/utils/focus.d.ts generated vendored Normal file
View File

@@ -0,0 +1,117 @@
/**
* Checks whether `element` is focusable or not.
* @example
* isFocusable(document.querySelector("input")); // true
* isFocusable(document.querySelector("input[tabindex='-1']")); // true
* isFocusable(document.querySelector("input[hidden]")); // false
* isFocusable(document.querySelector("input:disabled")); // false
*/
export declare function isFocusable(element: Element): element is HTMLElement;
/**
* Checks whether `element` is tabbable or not.
* @example
* isTabbable(document.querySelector("input")); // true
* isTabbable(document.querySelector("input[tabindex='-1']")); // false
* isTabbable(document.querySelector("input[hidden]")); // false
* isTabbable(document.querySelector("input:disabled")); // false
*/
export declare function isTabbable(element: Element | HTMLElement | HTMLInputElement): element is HTMLElement;
/**
* Returns all the focusable elements in `container`.
*/
export declare function getAllFocusableIn(container: HTMLElement, includeContainer?: boolean): HTMLElement[];
/**
* Returns all the focusable elements in the document.
*/
export declare function getAllFocusable(includeBody?: boolean): HTMLElement[];
/**
* Returns the first focusable element in `container`.
*/
export declare function getFirstFocusableIn(container: HTMLElement, includeContainer?: boolean): HTMLElement | null;
/**
* Returns the first focusable element in the document.
*/
export declare function getFirstFocusable(includeBody?: boolean): HTMLElement | null;
/**
* Returns all the tabbable elements in `container`, including the container
* itself.
*/
export declare function getAllTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFocusable?: boolean): HTMLElement[];
/**
* Returns all the tabbable elements in the document.
*/
export declare function getAllTabbable(fallbackToFocusable?: boolean): HTMLElement[];
/**
* Returns the first tabbable element in `container`, including the container
* itself if it's tabbable.
*/
export declare function getFirstTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the first tabbable element in the document.
*/
export declare function getFirstTabbable(fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the last tabbable element in `container`, including the container
* itself if it's tabbable.
*/
export declare function getLastTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the last tabbable element in the document.
*/
export declare function getLastTabbable(fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the next tabbable element in `container`.
*/
export declare function getNextTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFirst?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the next tabbable element in the document.
*/
export declare function getNextTabbable(fallbackToFirst?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the previous tabbable element in `container`.
*
*/
export declare function getPreviousTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToLast?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the previous tabbable element in the document.
*/
export declare function getPreviousTabbable(fallbackToFirst?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
/**
* Returns the closest focusable element.
*/
export declare function getClosestFocusable(element?: HTMLElement | null): HTMLElement | null;
/**
* Checks if `element` has focus. Elements that are referenced by
* `aria-activedescendant` are also considered.
* @example
* hasFocus(document.getElementById("id"));
*/
export declare function hasFocus(element: Element): boolean;
/**
* Checks if `element` has focus within. Elements that are referenced by
* `aria-activedescendant` are also considered.
* @example
* hasFocusWithin(document.getElementById("id"));
*/
export declare function hasFocusWithin(element: Node | Element): boolean;
/**
* Focus on an element only if it's not already focused.
*/
export declare function focusIfNeeded(element: HTMLElement): void;
/**
* Disable focus on `element`.
*/
export declare function disableFocus(element: HTMLElement): void;
/**
* Makes elements inside container not tabbable.
*/
export declare function disableFocusIn(container: HTMLElement, includeContainer?: boolean): void;
/**
* Restores tabbable elements inside container that were affected by
* disableFocusIn.
*/
export declare function restoreFocusIn(container: HTMLElement): void;
/**
* Focus on element and scroll into view.
*/
export declare function focusIntoView(element: HTMLElement, options?: ScrollIntoViewOptions): void;

46
node_modules/@ariakit/core/cjs/utils/misc.cjs generated vendored Normal file
View File

@@ -0,0 +1,46 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.afterPaint = _KBNYGXWIcjs.afterPaint; exports.applyState = _KBNYGXWIcjs.applyState; exports.beforePaint = _KBNYGXWIcjs.beforePaint; exports.chain = _KBNYGXWIcjs.chain; exports.cx = _KBNYGXWIcjs.cx; exports.defaultValue = _KBNYGXWIcjs.defaultValue; exports.disabledFromProps = _KBNYGXWIcjs.disabledFromProps; exports.getKeys = _KBNYGXWIcjs.getKeys; exports.hasOwnProperty = _KBNYGXWIcjs.hasOwnProperty; exports.identity = _KBNYGXWIcjs.identity; exports.invariant = _KBNYGXWIcjs.invariant; exports.isEmpty = _KBNYGXWIcjs.isEmpty; exports.isFalsyBooleanCallback = _KBNYGXWIcjs.isFalsyBooleanCallback; exports.isInteger = _KBNYGXWIcjs.isInteger; exports.isObject = _KBNYGXWIcjs.isObject; exports.noop = _KBNYGXWIcjs.noop; exports.normalizeString = _KBNYGXWIcjs.normalizeString; exports.omit = _KBNYGXWIcjs.omit; exports.pick = _KBNYGXWIcjs.pick; exports.shallowEqual = _KBNYGXWIcjs.shallowEqual;

124
node_modules/@ariakit/core/cjs/utils/misc.d.cts generated vendored Normal file
View File

@@ -0,0 +1,124 @@
import type { AnyFunction, AnyObject, SetStateAction } from "./types.js";
/**
* Empty function.
*/
export declare function noop(..._: any[]): any;
/**
* Compares two objects.
* @example
* shallowEqual({ a: "a" }, {}); // false
* shallowEqual({ a: "a" }, { b: "b" }); // false
* shallowEqual({ a: "a" }, { a: "a" }); // true
* shallowEqual({ a: "a" }, { a: "a", b: "b" }); // false
*/
export declare function shallowEqual(a?: AnyObject, b?: AnyObject): boolean;
/**
* Receives a `setState` argument and calls it with `currentValue` if it's a
* function. Otherwise return the argument as the new value.
* @example
* applyState((value) => value + 1, 1); // 2
* applyState(2, 1); // 2
*/
export declare function applyState<T>(argument: SetStateAction<T>, currentValue: T | (() => T)): T;
/**
* Checks whether `arg` is an object or not.
* @returns {boolean}
*/
export declare function isObject(arg: any): arg is Record<any, unknown>;
/**
* Checks whether `arg` is empty or not.
* @example
* isEmpty([]); // true
* isEmpty(["a"]); // false
* isEmpty({}); // true
* isEmpty({ a: "a" }); // false
* isEmpty(); // true
* isEmpty(null); // true
* isEmpty(undefined); // true
* isEmpty(""); // true
*/
export declare function isEmpty(arg: any): boolean;
/**
* Checks whether `arg` is an integer or not.
* @example
* isInteger(1); // true
* isInteger(1.5); // false
* isInteger("1"); // true
* isInteger("1.5"); // false
*/
export declare function isInteger(arg: any): boolean;
/**
* Checks whether `prop` is an own property of `obj` or not.
*/
export declare function hasOwnProperty<T extends AnyObject>(object: T, prop: keyof any): prop is keyof T;
/**
* Receives functions as arguments and returns a new function that calls all.
*/
export declare function chain<T>(...fns: T[]): (...args: T extends AnyFunction ? Parameters<T> : never) => void;
/**
* Returns a string with the truthy values of `args` separated by space.
*/
export declare function cx(...args: Array<string | null | false | 0 | undefined>): string | undefined;
/**
* Removes diatrics from a string.
*/
export declare function normalizeString(str: string): string;
/**
* Omits specific keys from an object.
* @example
* omit({ a: "a", b: "b" }, ["a"]); // { b: "b" }
*/
export declare function omit<T extends AnyObject, K extends keyof T>(object: T, keys: ReadonlyArray<K> | K[]): Omit<T, K>;
/**
* Picks specific keys from an object.
* @example
* pick({ a: "a", b: "b" }, ["a"]); // { a: "a" }
*/
export declare function pick<T extends AnyObject, K extends keyof T>(object: T, paths: ReadonlyArray<K> | K[]): Pick<T, K>;
/**
* Returns the same argument.
*/
export declare function identity<T>(value: T): T;
/**
* Runs right before the next paint.
*/
export declare function beforePaint(cb?: () => void): () => void;
/**
* Runs after the next paint.
*/
export declare function afterPaint(cb?: () => void): () => void;
/**
* Asserts that a condition is true, otherwise throws an error.
* @example
* invariant(
* condition,
* process.env.NODE_ENV !== "production" && "Invariant failed"
* );
*/
export declare function invariant(condition: any, message?: string | boolean): asserts condition;
/**
* Similar to `Object.keys` but returns a type-safe array of keys.
*/
export declare function getKeys<T extends object>(obj: T): (keyof T)[];
/**
* Checks whether a boolean event prop (e.g., hideOnInteractOutside) was
* intentionally set to false, either with a boolean value or a callback that
* returns false.
*/
export declare function isFalsyBooleanCallback<T extends unknown[]>(booleanOrCallback?: boolean | ((...args: T) => boolean), ...args: T): boolean;
/**
* Checks whether something is disabled or not based on its props.
*/
export declare function disabledFromProps(props: {
disabled?: boolean;
"aria-disabled"?: boolean | "true" | "false";
}): boolean;
/**
* Returns the first value that is not `undefined`.
*/
export declare function defaultValue<T extends readonly any[]>(...values: T): DefaultValue<T>;
type DefinedArray<T extends readonly any[]> = {
[K in keyof T as undefined extends T[K] ? never : K]: undefined extends T[K] ? [Exclude<T[K], undefined>, never] : [T[K]];
};
type DefaultValue<T extends readonly any[]> = DefinedArray<T>[keyof DefinedArray<T>] extends [any, never] ? T[number] : DefinedArray<T>[keyof DefinedArray<T>][0];
export {};

124
node_modules/@ariakit/core/cjs/utils/misc.d.ts generated vendored Normal file
View File

@@ -0,0 +1,124 @@
import type { AnyFunction, AnyObject, SetStateAction } from "./types.js";
/**
* Empty function.
*/
export declare function noop(..._: any[]): any;
/**
* Compares two objects.
* @example
* shallowEqual({ a: "a" }, {}); // false
* shallowEqual({ a: "a" }, { b: "b" }); // false
* shallowEqual({ a: "a" }, { a: "a" }); // true
* shallowEqual({ a: "a" }, { a: "a", b: "b" }); // false
*/
export declare function shallowEqual(a?: AnyObject, b?: AnyObject): boolean;
/**
* Receives a `setState` argument and calls it with `currentValue` if it's a
* function. Otherwise return the argument as the new value.
* @example
* applyState((value) => value + 1, 1); // 2
* applyState(2, 1); // 2
*/
export declare function applyState<T>(argument: SetStateAction<T>, currentValue: T | (() => T)): T;
/**
* Checks whether `arg` is an object or not.
* @returns {boolean}
*/
export declare function isObject(arg: any): arg is Record<any, unknown>;
/**
* Checks whether `arg` is empty or not.
* @example
* isEmpty([]); // true
* isEmpty(["a"]); // false
* isEmpty({}); // true
* isEmpty({ a: "a" }); // false
* isEmpty(); // true
* isEmpty(null); // true
* isEmpty(undefined); // true
* isEmpty(""); // true
*/
export declare function isEmpty(arg: any): boolean;
/**
* Checks whether `arg` is an integer or not.
* @example
* isInteger(1); // true
* isInteger(1.5); // false
* isInteger("1"); // true
* isInteger("1.5"); // false
*/
export declare function isInteger(arg: any): boolean;
/**
* Checks whether `prop` is an own property of `obj` or not.
*/
export declare function hasOwnProperty<T extends AnyObject>(object: T, prop: keyof any): prop is keyof T;
/**
* Receives functions as arguments and returns a new function that calls all.
*/
export declare function chain<T>(...fns: T[]): (...args: T extends AnyFunction ? Parameters<T> : never) => void;
/**
* Returns a string with the truthy values of `args` separated by space.
*/
export declare function cx(...args: Array<string | null | false | 0 | undefined>): string | undefined;
/**
* Removes diatrics from a string.
*/
export declare function normalizeString(str: string): string;
/**
* Omits specific keys from an object.
* @example
* omit({ a: "a", b: "b" }, ["a"]); // { b: "b" }
*/
export declare function omit<T extends AnyObject, K extends keyof T>(object: T, keys: ReadonlyArray<K> | K[]): Omit<T, K>;
/**
* Picks specific keys from an object.
* @example
* pick({ a: "a", b: "b" }, ["a"]); // { a: "a" }
*/
export declare function pick<T extends AnyObject, K extends keyof T>(object: T, paths: ReadonlyArray<K> | K[]): Pick<T, K>;
/**
* Returns the same argument.
*/
export declare function identity<T>(value: T): T;
/**
* Runs right before the next paint.
*/
export declare function beforePaint(cb?: () => void): () => void;
/**
* Runs after the next paint.
*/
export declare function afterPaint(cb?: () => void): () => void;
/**
* Asserts that a condition is true, otherwise throws an error.
* @example
* invariant(
* condition,
* process.env.NODE_ENV !== "production" && "Invariant failed"
* );
*/
export declare function invariant(condition: any, message?: string | boolean): asserts condition;
/**
* Similar to `Object.keys` but returns a type-safe array of keys.
*/
export declare function getKeys<T extends object>(obj: T): (keyof T)[];
/**
* Checks whether a boolean event prop (e.g., hideOnInteractOutside) was
* intentionally set to false, either with a boolean value or a callback that
* returns false.
*/
export declare function isFalsyBooleanCallback<T extends unknown[]>(booleanOrCallback?: boolean | ((...args: T) => boolean), ...args: T): boolean;
/**
* Checks whether something is disabled or not based on its props.
*/
export declare function disabledFromProps(props: {
disabled?: boolean;
"aria-disabled"?: boolean | "true" | "false";
}): boolean;
/**
* Returns the first value that is not `undefined`.
*/
export declare function defaultValue<T extends readonly any[]>(...values: T): DefaultValue<T>;
type DefinedArray<T extends readonly any[]> = {
[K in keyof T as undefined extends T[K] ? never : K]: undefined extends T[K] ? [Exclude<T[K], undefined>, never] : [T[K]];
};
type DefaultValue<T extends readonly any[]> = DefinedArray<T>[keyof DefinedArray<T>] extends [any, never] ? T[number] : DefinedArray<T>[keyof DefinedArray<T>][0];
export {};

17
node_modules/@ariakit/core/cjs/utils/platform.cjs generated vendored Normal file
View File

@@ -0,0 +1,17 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _YIUPKKEKcjs = require('../__chunks/YIUPKKEK.cjs');
require('../__chunks/5F4DVUNS.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.isApple = _YIUPKKEKcjs.isApple; exports.isFirefox = _YIUPKKEKcjs.isFirefox; exports.isMac = _YIUPKKEKcjs.isMac; exports.isSafari = _YIUPKKEKcjs.isSafari; exports.isTouchDevice = _YIUPKKEKcjs.isTouchDevice;

20
node_modules/@ariakit/core/cjs/utils/platform.d.cts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/**
* Detects if the device has touch capabilities.
*/
export declare function isTouchDevice(): boolean;
/**
* Detects Apple device.
*/
export declare function isApple(): boolean;
/**
* Detects Safari browser.
*/
export declare function isSafari(): boolean;
/**
* Detects Firefox browser.
*/
export declare function isFirefox(): boolean;
/**
* Detects Mac computer.
*/
export declare function isMac(): boolean;

20
node_modules/@ariakit/core/cjs/utils/platform.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/**
* Detects if the device has touch capabilities.
*/
export declare function isTouchDevice(): boolean;
/**
* Detects Apple device.
*/
export declare function isApple(): boolean;
/**
* Detects Safari browser.
*/
export declare function isSafari(): boolean;
/**
* Detects Firefox browser.
*/
export declare function isFirefox(): boolean;
/**
* Detects Mac computer.
*/
export declare function isMac(): boolean;

27
node_modules/@ariakit/core/cjs/utils/store.cjs generated vendored Normal file
View File

@@ -0,0 +1,27 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
var _F6HPKLO2cjs = require('../__chunks/F6HPKLO2.cjs');
require('../__chunks/KBNYGXWI.cjs');
require('../__chunks/AV6KTKLE.cjs');
exports.batch = _F6HPKLO2cjs.batch; exports.createStore = _F6HPKLO2cjs.createStore; exports.init = _F6HPKLO2cjs.init; exports.mergeStore = _F6HPKLO2cjs.mergeStore; exports.omit = _F6HPKLO2cjs.omit; exports.pick = _F6HPKLO2cjs.pick; exports.setup = _F6HPKLO2cjs.setup; exports.subscribe = _F6HPKLO2cjs.subscribe; exports.sync = _F6HPKLO2cjs.sync; exports.throwOnConflictingProps = _F6HPKLO2cjs.throwOnConflictingProps;

74
node_modules/@ariakit/core/cjs/utils/store.d.cts generated vendored Normal file
View File

@@ -0,0 +1,74 @@
import type { AnyObject, SetStateAction } from "./types.js";
type Listener<S> = (state: S, prevState: S) => void | (() => void);
type Sync<S, K extends keyof S> = (keys: K[] | null, listener: Listener<Pick<S, K>>) => () => void;
type StoreSetup = (callback: () => void | (() => void)) => () => void;
type StoreInit = () => () => void;
type StoreSubscribe<S = State, K extends keyof S = keyof S> = Sync<S, K>;
type StoreSync<S = State, K extends keyof S = keyof S> = Sync<S, K>;
type StoreBatch<S = State, K extends keyof S = keyof S> = Sync<S, K>;
type StorePick<S = State, K extends ReadonlyArray<keyof S> = ReadonlyArray<keyof S>> = (keys: K) => Store<Pick<S, K[number]>>;
type StoreOmit<S = State, K extends ReadonlyArray<keyof S> = ReadonlyArray<keyof S>> = (keys: K) => Store<Omit<S, K[number]>>;
/**
* Creates a store.
* @param initialState Initial state.
* @param stores Stores to extend.
*/
export declare function createStore<S extends State>(initialState: S, ...stores: Array<Store<Partial<S>> | undefined>): Store<S>;
export declare function setup<T extends Store>(store?: T | null, ...args: Parameters<StoreSetup>): T extends Store ? ReturnType<StoreSetup> : void;
export declare function init<T extends Store>(store?: T | null, ...args: Parameters<StoreInit>): T extends Store ? ReturnType<StoreInit> : void;
export declare function subscribe<T extends Store, K extends keyof StoreState<T>>(store?: T | null, ...args: Parameters<StoreSubscribe<StoreState<T>, K>>): T extends Store ? ReturnType<StoreSubscribe<StoreState<T>, K>> : void;
export declare function sync<T extends Store, K extends keyof StoreState<T>>(store?: T | null, ...args: Parameters<StoreSync<StoreState<T>, K>>): T extends Store ? ReturnType<StoreSync<StoreState<T>, K>> : void;
export declare function batch<T extends Store, K extends keyof StoreState<T>>(store?: T | null, ...args: Parameters<StoreBatch<StoreState<T>, K>>): T extends Store ? ReturnType<StoreBatch<StoreState<T>, K>> : void;
export declare function omit<T extends Store, K extends ReadonlyArray<keyof StoreState<T>>>(store?: T | null, ...args: Parameters<StoreOmit<StoreState<T>, K>>): T extends Store ? ReturnType<StoreOmit<StoreState<T>, K>> : void;
export declare function pick<T extends Store, K extends ReadonlyArray<keyof StoreState<T>>>(store?: T | null, ...args: Parameters<StorePick<StoreState<T>, K>>): T extends Store ? ReturnType<StorePick<StoreState<T>, K>> : void;
/**
* Merges multiple stores into a single store.
*/
export declare function mergeStore<S extends State>(...stores: Array<Store<S> | undefined>): Store<S>;
/**
* Throws when a store prop is passed in conjunction with a default state.
*/
export declare function throwOnConflictingProps(props: AnyObject, store?: Store): void;
/**
* Store state type.
*/
export type State = AnyObject;
/**
* Initial state that can be passed to a store creator function.
* @template S State type.
* @template K Key type.
*/
export type StoreOptions<S extends State, K extends keyof S> = Partial<Pick<S, K>>;
/**
* Props that can be passed to a store creator function.
* @template S State type.
*/
export type StoreProps<S extends State = State> = {
/**
* Another store object that will be kept in sync with the original store.
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
*/
store?: Store<Partial<S>>;
};
/**
* Extracts the state type from a store type.
* @template T Store type.
*/
export type StoreState<T> = T extends Store<infer S> ? S : never;
/**
* Store.
* @template S State type.
*/
export interface Store<S = State> {
/**
* Returns the current store state.
*/
getState(): S;
/**
* Sets a state value.
*/
setState<K extends keyof S>(key: K, value: SetStateAction<S[K]>): void;
}
export {};

74
node_modules/@ariakit/core/cjs/utils/store.d.ts generated vendored Normal file
View File

@@ -0,0 +1,74 @@
import type { AnyObject, SetStateAction } from "./types.js";
type Listener<S> = (state: S, prevState: S) => void | (() => void);
type Sync<S, K extends keyof S> = (keys: K[] | null, listener: Listener<Pick<S, K>>) => () => void;
type StoreSetup = (callback: () => void | (() => void)) => () => void;
type StoreInit = () => () => void;
type StoreSubscribe<S = State, K extends keyof S = keyof S> = Sync<S, K>;
type StoreSync<S = State, K extends keyof S = keyof S> = Sync<S, K>;
type StoreBatch<S = State, K extends keyof S = keyof S> = Sync<S, K>;
type StorePick<S = State, K extends ReadonlyArray<keyof S> = ReadonlyArray<keyof S>> = (keys: K) => Store<Pick<S, K[number]>>;
type StoreOmit<S = State, K extends ReadonlyArray<keyof S> = ReadonlyArray<keyof S>> = (keys: K) => Store<Omit<S, K[number]>>;
/**
* Creates a store.
* @param initialState Initial state.
* @param stores Stores to extend.
*/
export declare function createStore<S extends State>(initialState: S, ...stores: Array<Store<Partial<S>> | undefined>): Store<S>;
export declare function setup<T extends Store>(store?: T | null, ...args: Parameters<StoreSetup>): T extends Store ? ReturnType<StoreSetup> : void;
export declare function init<T extends Store>(store?: T | null, ...args: Parameters<StoreInit>): T extends Store ? ReturnType<StoreInit> : void;
export declare function subscribe<T extends Store, K extends keyof StoreState<T>>(store?: T | null, ...args: Parameters<StoreSubscribe<StoreState<T>, K>>): T extends Store ? ReturnType<StoreSubscribe<StoreState<T>, K>> : void;
export declare function sync<T extends Store, K extends keyof StoreState<T>>(store?: T | null, ...args: Parameters<StoreSync<StoreState<T>, K>>): T extends Store ? ReturnType<StoreSync<StoreState<T>, K>> : void;
export declare function batch<T extends Store, K extends keyof StoreState<T>>(store?: T | null, ...args: Parameters<StoreBatch<StoreState<T>, K>>): T extends Store ? ReturnType<StoreBatch<StoreState<T>, K>> : void;
export declare function omit<T extends Store, K extends ReadonlyArray<keyof StoreState<T>>>(store?: T | null, ...args: Parameters<StoreOmit<StoreState<T>, K>>): T extends Store ? ReturnType<StoreOmit<StoreState<T>, K>> : void;
export declare function pick<T extends Store, K extends ReadonlyArray<keyof StoreState<T>>>(store?: T | null, ...args: Parameters<StorePick<StoreState<T>, K>>): T extends Store ? ReturnType<StorePick<StoreState<T>, K>> : void;
/**
* Merges multiple stores into a single store.
*/
export declare function mergeStore<S extends State>(...stores: Array<Store<S> | undefined>): Store<S>;
/**
* Throws when a store prop is passed in conjunction with a default state.
*/
export declare function throwOnConflictingProps(props: AnyObject, store?: Store): void;
/**
* Store state type.
*/
export type State = AnyObject;
/**
* Initial state that can be passed to a store creator function.
* @template S State type.
* @template K Key type.
*/
export type StoreOptions<S extends State, K extends keyof S> = Partial<Pick<S, K>>;
/**
* Props that can be passed to a store creator function.
* @template S State type.
*/
export type StoreProps<S extends State = State> = {
/**
* Another store object that will be kept in sync with the original store.
*
* Live examples:
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
*/
store?: Store<Partial<S>>;
};
/**
* Extracts the state type from a store type.
* @template T Store type.
*/
export type StoreState<T> = T extends Store<infer S> ? S : never;
/**
* Store.
* @template S State type.
*/
export interface Store<S = State> {
/**
* Returns the current store state.
*/
getState(): S;
/**
* Sets a state value.
*/
setState<K extends keyof S>(key: K, value: SetStateAction<S[K]>): void;
}
export {};

1
node_modules/@ariakit/core/cjs/utils/types.cjs generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";"use client";

74
node_modules/@ariakit/core/cjs/utils/types.d.cts generated vendored Normal file
View File

@@ -0,0 +1,74 @@
/**
* Any object.
*/
export type AnyObject = Record<string, any>;
/**
* Empty object.
*/
export type EmptyObject = Record<keyof any, never>;
/**
* Any function.
*/
export type AnyFunction = (...args: any) => any;
/**
* Workaround for variance issues.
* @template T The type of the callback.
*/
export type BivariantCallback<T extends AnyFunction> = {
bivarianceHack(...args: Parameters<T>): ReturnType<T>;
}["bivarianceHack"];
/**
* @template T The state type.
*/
export type SetStateAction<T> = T | BivariantCallback<(prevState: T) => T>;
/**
* The type of the `setState` function in `[state, setState] = useState()`.
* @template T The type of the state.
*/
export type SetState<T> = BivariantCallback<(value: SetStateAction<T>) => void>;
/**
* A boolean value or a callback that returns a boolean value.
* @template T The type of the callback parameter.
*/
export type BooleanOrCallback<T> = boolean | BivariantCallback<(arg: T) => boolean>;
/**
* A string that will provide autocomplete for specific strings.
* @template T The specific strings.
*/
export type StringWithValue<T extends string> = T | (string & Record<never, never>);
/**
* Transforms a type into a primitive type.
* @template T The type to transform.
* @example
* // string
* ToPrimitive<"a">;
* // number
* ToPrimitive<1>;
*/
export type ToPrimitive<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends AnyFunction ? (...args: Parameters<T>) => ReturnType<T> : T;
/**
* Picks only the properties from a type that have a specific value.
* @template T The type to pick from.
* @template Value The value to pick.
*/
export type PickByValue<T, Value> = {
[K in keyof T as [Value] extends [T[K]] ? T[K] extends Value | undefined ? K : never : never]: T[K];
};
/**
* Picks only the required properties from a type.
* @template T The type to pick from.
* @template P The properties to pick.
*/
export type PickRequired<T, P extends keyof T> = T & {
[K in keyof T]: Pick<Required<T>, K>;
}[P];
/**
* Indicates the availability and type of interactive popup element, such as
* menu or dialog, that can be triggered by an element.
*/
export type AriaHasPopup = boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
/**
* All the WAI-ARIA 1.1 role attribute values from
* https://www.w3.org/TR/wai-aria-1.1/#role_definitions
*/
export type AriaRole = "alert" | "alertdialog" | "application" | "article" | "banner" | "button" | "cell" | "checkbox" | "columnheader" | "combobox" | "complementary" | "contentinfo" | "definition" | "dialog" | "directory" | "document" | "feed" | "figure" | "form" | "grid" | "gridcell" | "group" | "heading" | "img" | "link" | "list" | "listbox" | "listitem" | "log" | "main" | "marquee" | "math" | "menu" | "menubar" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "navigation" | "none" | "note" | "option" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "scrollbar" | "search" | "searchbox" | "separator" | "slider" | "spinbutton" | "status" | "switch" | "tab" | "table" | "tablist" | "tabpanel" | "term" | "textbox" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem" | (string & {});

74
node_modules/@ariakit/core/cjs/utils/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,74 @@
/**
* Any object.
*/
export type AnyObject = Record<string, any>;
/**
* Empty object.
*/
export type EmptyObject = Record<keyof any, never>;
/**
* Any function.
*/
export type AnyFunction = (...args: any) => any;
/**
* Workaround for variance issues.
* @template T The type of the callback.
*/
export type BivariantCallback<T extends AnyFunction> = {
bivarianceHack(...args: Parameters<T>): ReturnType<T>;
}["bivarianceHack"];
/**
* @template T The state type.
*/
export type SetStateAction<T> = T | BivariantCallback<(prevState: T) => T>;
/**
* The type of the `setState` function in `[state, setState] = useState()`.
* @template T The type of the state.
*/
export type SetState<T> = BivariantCallback<(value: SetStateAction<T>) => void>;
/**
* A boolean value or a callback that returns a boolean value.
* @template T The type of the callback parameter.
*/
export type BooleanOrCallback<T> = boolean | BivariantCallback<(arg: T) => boolean>;
/**
* A string that will provide autocomplete for specific strings.
* @template T The specific strings.
*/
export type StringWithValue<T extends string> = T | (string & Record<never, never>);
/**
* Transforms a type into a primitive type.
* @template T The type to transform.
* @example
* // string
* ToPrimitive<"a">;
* // number
* ToPrimitive<1>;
*/
export type ToPrimitive<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends AnyFunction ? (...args: Parameters<T>) => ReturnType<T> : T;
/**
* Picks only the properties from a type that have a specific value.
* @template T The type to pick from.
* @template Value The value to pick.
*/
export type PickByValue<T, Value> = {
[K in keyof T as [Value] extends [T[K]] ? T[K] extends Value | undefined ? K : never : never]: T[K];
};
/**
* Picks only the required properties from a type.
* @template T The type to pick from.
* @template P The properties to pick.
*/
export type PickRequired<T, P extends keyof T> = T & {
[K in keyof T]: Pick<Required<T>, K>;
}[P];
/**
* Indicates the availability and type of interactive popup element, such as
* menu or dialog, that can be triggered by an element.
*/
export type AriaHasPopup = boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
/**
* All the WAI-ARIA 1.1 role attribute values from
* https://www.w3.org/TR/wai-aria-1.1/#role_definitions
*/
export type AriaRole = "alert" | "alertdialog" | "application" | "article" | "banner" | "button" | "cell" | "checkbox" | "columnheader" | "combobox" | "complementary" | "contentinfo" | "definition" | "dialog" | "directory" | "document" | "feed" | "figure" | "form" | "grid" | "gridcell" | "group" | "heading" | "img" | "link" | "list" | "listbox" | "listitem" | "log" | "main" | "marquee" | "math" | "menu" | "menubar" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "navigation" | "none" | "note" | "option" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "scrollbar" | "search" | "searchbox" | "separator" | "slider" | "spinbutton" | "status" | "switch" | "tab" | "table" | "tablist" | "tabpanel" | "term" | "textbox" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem" | (string & {});

Some files were not shown because too many files have changed in this diff Show More