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

204
node_modules/@ariakit/core/esm/__chunks/22K762VQ.js generated vendored Normal file
View File

@@ -0,0 +1,204 @@
"use client";
import {
batch,
createStore,
init,
setup,
throwOnConflictingProps
} from "./EAHJFCU4.js";
import {
chain,
defaultValue
} from "./Y3OOHFCN.js";
import {
getDocument
} from "./DLOEKDPY.js";
import {
__spreadProps,
__spreadValues
} from "./4R3V3JGP.js";
// 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 getDocument(parentElement).body;
}
function getPrivateStore(store) {
return store == null ? void 0 : store.__unstablePrivateStore;
}
function createCollectionStore(props = {}) {
var _a;
throwOnConflictingProps(props, props.store);
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const items = defaultValue(
props.items,
syncState == null ? void 0 : syncState.items,
props.defaultItems,
[]
);
const itemsMap = new Map(items.map((item) => [item.id, item]));
const initialState = {
items,
renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
};
const syncPrivateStore = getPrivateStore(props.store);
const privateStore = createStore(
{ items, renderedItems: initialState.renderedItems },
syncPrivateStore
);
const collection = createStore(initialState, props.store);
const sortItems = (renderedItems) => {
const sortedItems = sortBasedOnDOMPosition(renderedItems);
privateStore.setState("renderedItems", sortedItems);
collection.setState("renderedItems", sortedItems);
};
setup(collection, () => init(privateStore));
setup(privateStore, () => {
return batch(privateStore, ["items"], (state) => {
collection.setState("items", state.items);
});
});
setup(privateStore, () => {
return batch(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 = __spreadValues(__spreadValues({}, 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 __spreadProps(__spreadValues({}, collection), {
registerItem,
renderItem: (item) => chain(
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
});
}
export {
createCollectionStore
};

38
node_modules/@ariakit/core/esm/__chunks/4R3V3JGP.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
"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;
};
export {
__spreadValues,
__spreadProps,
__objRest
};

32
node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
"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();
}
export {
toArray,
addItemToArray,
flatten2DArray,
reverseArray
};

64
node_modules/@ariakit/core/esm/__chunks/AF6IUUFN.js generated vendored Normal file
View File

@@ -0,0 +1,64 @@
"use client";
import {
createDialogStore
} from "./SX2XFD6A.js";
import {
createStore,
mergeStore,
omit,
throwOnConflictingProps
} from "./EAHJFCU4.js";
import {
defaultValue
} from "./Y3OOHFCN.js";
import {
__objRest,
__spreadProps,
__spreadValues
} from "./4R3V3JGP.js";
// src/popover/popover-store.ts
function createPopoverStore(_a = {}) {
var _b = _a, {
popover: otherPopover
} = _b, props = __objRest(_b, [
"popover"
]);
const store = mergeStore(
props.store,
omit(otherPopover, [
"arrowElement",
"anchorElement",
"contentElement",
"popoverElement",
"disclosureElement"
])
);
throwOnConflictingProps(props, store);
const syncState = store == null ? void 0 : store.getState();
const dialog = createDialogStore(__spreadProps(__spreadValues({}, props), { store }));
const placement = defaultValue(
props.placement,
syncState == null ? void 0 : syncState.placement,
"bottom"
);
const initialState = __spreadProps(__spreadValues({}, dialog.getState()), {
placement,
currentPlacement: placement,
anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null),
popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null),
arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null),
rendered: Symbol("rendered")
});
const popover = createStore(initialState, dialog, store);
return __spreadProps(__spreadValues(__spreadValues({}, 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"))
});
}
export {
createPopoverStore
};

197
node_modules/@ariakit/core/esm/__chunks/DLOEKDPY.js generated vendored Normal file
View File

@@ -0,0 +1,197 @@
"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);
}
}
export {
canUseDOM,
getDocument,
getWindow,
getActiveElement,
contains,
isFrame,
isButton,
matches,
isVisible,
closest,
isTextField,
getPopupRole,
getPopupItemRole,
getTextboxSelection,
scrollIntoViewIfNeeded,
getScrollingElement,
isPartiallyHidden,
setSelectionRange
};

250
node_modules/@ariakit/core/esm/__chunks/EAHJFCU4.js generated vendored Normal file
View File

@@ -0,0 +1,250 @@
"use client";
import {
applyState,
chain,
getKeys,
hasOwnProperty,
invariant,
noop,
omit,
pick
} from "./Y3OOHFCN.js";
import {
__spreadProps,
__spreadValues
} from "./4R3V3JGP.js";
// src/utils/store.ts
function getInternal(store, key) {
const internals = store.__unstableInternals;
invariant(internals, "Invalid store");
return internals[key];
}
function createStore(initialState, ...stores) {
let state = initialState;
let prevStateBatch = state;
let lastUpdate = Symbol();
let destroy = 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 = getKeys(state).map(
(key) => chain(
...stores.map((store) => {
var _a;
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
if (!storeState)
return;
if (!hasOwnProperty(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 = chain(...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(pick(state, keys), finalStore);
const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
const getState = () => state;
const setState = (key, value, fromStores = false) => {
if (!hasOwnProperty(state, key))
return;
const nextValue = applyState(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 = __spreadProps(__spreadValues({}, 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 __spreadValues(__spreadValues({}, 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) => hasOwnProperty(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
`
);
}
export {
createStore,
setup,
init,
subscribe,
sync,
batch,
omit2 as omit,
pick2 as pick,
mergeStore,
throwOnConflictingProps
};

300
node_modules/@ariakit/core/esm/__chunks/IERTEJ3A.js generated vendored Normal file
View File

@@ -0,0 +1,300 @@
"use client";
import {
createCollectionStore
} from "./22K762VQ.js";
import {
createStore,
setup,
sync
} from "./EAHJFCU4.js";
import {
defaultValue
} from "./Y3OOHFCN.js";
import {
flatten2DArray,
reverseArray
} from "./7PRQYBBV.js";
import {
__spreadProps,
__spreadValues
} from "./4R3V3JGP.js";
// 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(__spreadProps(__spreadValues({}, 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 = createCollectionStore(props);
const activeId = defaultValue(
props.activeId,
syncState == null ? void 0 : syncState.activeId,
props.defaultActiveId
);
const initialState = __spreadProps(__spreadValues({}, collection.getState()), {
activeId,
baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null),
includesBaseElement: defaultValue(
props.includesBaseElement,
syncState == null ? void 0 : syncState.includesBaseElement,
activeId === null
),
moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0),
orientation: defaultValue(
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"both"
),
rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false),
virtualFocus: defaultValue(
props.virtualFocus,
syncState == null ? void 0 : syncState.virtualFocus,
false
),
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
});
const composite = createStore(initialState, collection, props.store);
setup(
composite,
() => sync(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 ? reverseArray(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 __spreadProps(__spreadValues(__spreadValues({}, 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(reverseArray(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(
reverseArray(renderedItems),
orientation,
hasNullItem,
skip
);
},
down: (skip) => {
const {
activeId: activeId2,
renderedItems,
focusShift,
focusLoop,
includesBaseElement
} = composite.getState();
const shouldShift = focusShift && !skip;
const verticalItems = verticalizeItems(
flatten2DArray(
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(
reverseArray(
flatten2DArray(
normalizeRows(
groupItemsByRows(renderedItems),
activeId2,
shouldShift
)
)
)
);
const hasNullItem = includesBaseElement;
return getNextId(verticalItems, "vertical", hasNullItem, skip);
}
});
}
export {
createCompositeStore
};

31
node_modules/@ariakit/core/esm/__chunks/MHPO2BXA.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
"use client";
import {
canUseDOM
} from "./DLOEKDPY.js";
// src/utils/platform.ts
function isTouchDevice() {
return canUseDOM && !!navigator.maxTouchPoints;
}
function isApple() {
if (!canUseDOM)
return false;
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
}
function isSafari() {
return canUseDOM && isApple() && /apple/i.test(navigator.vendor);
}
function isFirefox() {
return canUseDOM && /firefox\//i.test(navigator.userAgent);
}
function isMac() {
return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
}
export {
isTouchDevice,
isApple,
isSafari,
isFirefox,
isMac
};

42
node_modules/@ariakit/core/esm/__chunks/SOLWE6E5.js generated vendored Normal file
View File

@@ -0,0 +1,42 @@
"use client";
import {
createPopoverStore
} from "./AF6IUUFN.js";
import {
createStore
} from "./EAHJFCU4.js";
import {
defaultValue
} from "./Y3OOHFCN.js";
import {
__spreadProps,
__spreadValues
} from "./4R3V3JGP.js";
// src/hovercard/hovercard-store.ts
function createHovercardStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const popover = createPopoverStore(__spreadProps(__spreadValues({}, props), {
placement: defaultValue(
props.placement,
syncState == null ? void 0 : syncState.placement,
"bottom"
)
}));
const timeout = defaultValue(props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
const initialState = __spreadProps(__spreadValues({}, popover.getState()), {
timeout,
showTimeout: defaultValue(props.showTimeout, syncState == null ? void 0 : syncState.showTimeout),
hideTimeout: defaultValue(props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
autoFocusOnShow: defaultValue(syncState == null ? void 0 : syncState.autoFocusOnShow, false)
});
const hovercard = createStore(initialState, popover, props.store);
return __spreadProps(__spreadValues(__spreadValues({}, popover), hovercard), {
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
});
}
export {
createHovercardStore
};

13
node_modules/@ariakit/core/esm/__chunks/SX2XFD6A.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
"use client";
import {
createDisclosureStore
} from "./Z5IGYIPT.js";
// src/dialog/dialog-store.ts
function createDialogStore(props = {}) {
return createDisclosureStore(props);
}
export {
createDialogStore
};

35
node_modules/@ariakit/core/esm/__chunks/XU3EOSCU.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
"use client";
import {
createCompositeStore
} from "./IERTEJ3A.js";
import {
createStore
} from "./EAHJFCU4.js";
import {
defaultValue
} from "./Y3OOHFCN.js";
import {
__spreadProps,
__spreadValues
} from "./4R3V3JGP.js";
// src/menubar/menubar-store.ts
function createMenubarStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
orientation: defaultValue(
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"horizontal"
),
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
}));
const initialState = __spreadValues({}, composite.getState());
const menubar = createStore(initialState, composite, props.store);
return __spreadValues(__spreadValues({}, composite), menubar);
}
export {
createMenubarStore
};

165
node_modules/@ariakit/core/esm/__chunks/Y3OOHFCN.js generated vendored Normal file
View File

@@ -0,0 +1,165 @@
"use client";
import {
__spreadValues
} from "./4R3V3JGP.js";
// 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 = __spreadValues({}, 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;
}
export {
noop,
shallowEqual,
applyState,
isObject,
isEmpty,
isInteger,
hasOwnProperty,
chain,
cx,
normalizeString,
omit,
pick,
identity,
beforePaint,
afterPaint,
invariant,
getKeys,
isFalsyBooleanCallback,
disabledFromProps,
defaultValue
};

78
node_modules/@ariakit/core/esm/__chunks/Z5IGYIPT.js generated vendored Normal file
View File

@@ -0,0 +1,78 @@
"use client";
import {
createStore,
mergeStore,
omit,
setup,
subscribe,
sync,
throwOnConflictingProps
} from "./EAHJFCU4.js";
import {
defaultValue
} from "./Y3OOHFCN.js";
import {
__spreadProps,
__spreadValues
} from "./4R3V3JGP.js";
// src/disclosure/disclosure-store.ts
function createDisclosureStore(props = {}) {
const store = mergeStore(
props.store,
omit(props.disclosure, ["contentElement", "disclosureElement"])
);
throwOnConflictingProps(props, store);
const syncState = store == null ? void 0 : store.getState();
const open = defaultValue(
props.open,
syncState == null ? void 0 : syncState.open,
props.defaultOpen,
false
);
const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false);
const initialState = {
open,
animated,
animating: !!animated && open,
mounted: open,
contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null),
disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null)
};
const disclosure = createStore(initialState, store);
setup(
disclosure,
() => sync(disclosure, ["animated", "animating"], (state) => {
if (state.animated)
return;
disclosure.setState("animating", false);
})
);
setup(
disclosure,
() => subscribe(disclosure, ["open"], () => {
if (!disclosure.getState().animated)
return;
disclosure.setState("animating", true);
})
);
setup(
disclosure,
() => sync(disclosure, ["open", "animating"], (state) => {
disclosure.setState("mounted", state.open || state.animating);
})
);
return __spreadProps(__spreadValues({}, 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)
});
}
export {
createDisclosureStore
};

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,34 @@
"use client";
import {
createStore,
throwOnConflictingProps
} from "../__chunks/EAHJFCU4.js";
import {
defaultValue
} from "../__chunks/Y3OOHFCN.js";
import {
__spreadProps,
__spreadValues
} from "../__chunks/4R3V3JGP.js";
// src/checkbox/checkbox-store.ts
function createCheckboxStore(props = {}) {
var _a;
throwOnConflictingProps(props, props.store);
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const initialState = {
value: defaultValue(
props.value,
syncState == null ? void 0 : syncState.value,
props.defaultValue,
false
)
};
const checkbox = createStore(initialState, props.store);
return __spreadProps(__spreadValues({}, checkbox), {
setValue: (value) => checkbox.setState("value", value)
});
}
export {
createCheckboxStore
};

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,11 @@
"use client";
import {
createCollectionStore
} from "../__chunks/22K762VQ.js";
import "../__chunks/EAHJFCU4.js";
import "../__chunks/Y3OOHFCN.js";
import "../__chunks/DLOEKDPY.js";
import "../__chunks/4R3V3JGP.js";
export {
createCollectionStore
};

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,152 @@
"use client";
import {
createPopoverStore
} from "../__chunks/AF6IUUFN.js";
import "../__chunks/SX2XFD6A.js";
import "../__chunks/Z5IGYIPT.js";
import {
createCompositeStore
} from "../__chunks/IERTEJ3A.js";
import "../__chunks/22K762VQ.js";
import {
batch,
createStore,
setup,
sync,
throwOnConflictingProps
} from "../__chunks/EAHJFCU4.js";
import {
defaultValue
} from "../__chunks/Y3OOHFCN.js";
import {
isSafari,
isTouchDevice
} from "../__chunks/MHPO2BXA.js";
import "../__chunks/DLOEKDPY.js";
import "../__chunks/7PRQYBBV.js";
import {
__spreadProps,
__spreadValues
} from "../__chunks/4R3V3JGP.js";
// src/combobox/combobox-store.ts
var isSafariOnMobile = isSafari() && isTouchDevice();
function createComboboxStore(props = {}) {
var _a;
throwOnConflictingProps(props, props.store);
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const activeId = defaultValue(
props.activeId,
syncState == null ? void 0 : syncState.activeId,
props.defaultActiveId,
null
);
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
activeId,
includesBaseElement: defaultValue(
props.includesBaseElement,
syncState == null ? void 0 : syncState.includesBaseElement,
true
),
orientation: defaultValue(
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"vertical"
),
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true),
focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true),
virtualFocus: defaultValue(
props.virtualFocus,
syncState == null ? void 0 : syncState.virtualFocus,
!isSafariOnMobile
)
}));
const popover = createPopoverStore(__spreadProps(__spreadValues({}, props), {
placement: defaultValue(
props.placement,
syncState == null ? void 0 : syncState.placement,
"bottom-start"
)
}));
const value = defaultValue(
props.value,
syncState == null ? void 0 : syncState.value,
props.defaultValue,
""
);
const selectedValue = defaultValue(
props.selectedValue,
syncState == null ? void 0 : syncState.selectedValue,
props.defaultSelectedValue,
""
);
const multiSelectable = Array.isArray(selectedValue);
const initialState = __spreadProps(__spreadValues(__spreadValues({}, composite.getState()), popover.getState()), {
value,
selectedValue,
resetValueOnSelect: defaultValue(
props.resetValueOnSelect,
syncState == null ? void 0 : syncState.resetValueOnSelect,
multiSelectable
),
resetValueOnHide: defaultValue(
props.resetValueOnHide,
syncState == null ? void 0 : syncState.resetValueOnHide,
multiSelectable
),
activeValue: syncState == null ? void 0 : syncState.activeValue
});
const combobox = createStore(initialState, composite, popover, props.store);
setup(
combobox,
() => sync(combobox, ["resetValueOnHide", "mounted"], (state) => {
if (!state.resetValueOnHide)
return;
if (state.mounted)
return;
combobox.setState("value", value);
})
);
setup(
combobox,
() => sync(combobox, ["resetValueOnSelect", "selectedValue"], (state) => {
if (!state.resetValueOnSelect)
return;
combobox.setState("value", value);
})
);
setup(
combobox,
() => batch(combobox, ["mounted"], (state) => {
if (state.mounted)
return;
combobox.setState("activeId", activeId);
combobox.setState("moves", 0);
})
);
setup(
combobox,
() => sync(combobox, ["moves", "activeId"], (state, prevState) => {
if (state.moves === prevState.moves) {
combobox.setState("activeValue", void 0);
}
})
);
setup(
combobox,
() => batch(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 __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, popover), composite), combobox), {
setValue: (value2) => combobox.setState("value", value2),
setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2)
});
}
export {
createComboboxStore
};

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,17 @@
"use client";
import {
createPopoverStore
} from "../__chunks/AF6IUUFN.js";
import "../__chunks/SX2XFD6A.js";
import "../__chunks/Z5IGYIPT.js";
import "../__chunks/EAHJFCU4.js";
import "../__chunks/Y3OOHFCN.js";
import "../__chunks/4R3V3JGP.js";
// src/composite/composite-overflow-store.ts
function createCompositeOverflowStore(props = {}) {
return createPopoverStore(props);
}
export {
createCompositeOverflowStore
};

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,13 @@
"use client";
import {
createCompositeStore
} from "../__chunks/IERTEJ3A.js";
import "../__chunks/22K762VQ.js";
import "../__chunks/EAHJFCU4.js";
import "../__chunks/Y3OOHFCN.js";
import "../__chunks/DLOEKDPY.js";
import "../__chunks/7PRQYBBV.js";
import "../__chunks/4R3V3JGP.js";
export {
createCompositeStore
};

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> {
}

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

@@ -0,0 +1,11 @@
"use client";
import {
createDialogStore
} from "../__chunks/SX2XFD6A.js";
import "../__chunks/Z5IGYIPT.js";
import "../__chunks/EAHJFCU4.js";
import "../__chunks/Y3OOHFCN.js";
import "../__chunks/4R3V3JGP.js";
export {
createDialogStore
};

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,10 @@
"use client";
import {
createDisclosureStore
} from "../__chunks/Z5IGYIPT.js";
import "../__chunks/EAHJFCU4.js";
import "../__chunks/Y3OOHFCN.js";
import "../__chunks/4R3V3JGP.js";
export {
createDisclosureStore
};

245
node_modules/@ariakit/core/esm/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 {};

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

@@ -0,0 +1,272 @@
"use client";
import {
createCollectionStore
} from "../__chunks/22K762VQ.js";
import {
createStore,
init,
setup,
throwOnConflictingProps
} from "../__chunks/EAHJFCU4.js";
import {
applyState,
defaultValue,
isInteger,
isObject
} from "../__chunks/Y3OOHFCN.js";
import "../__chunks/DLOEKDPY.js";
import {
__spreadProps,
__spreadValues
} from "../__chunks/4R3V3JGP.js";
// src/form/form-store.ts
function nextFrame() {
return new Promise((resolve) => requestAnimationFrame(() => resolve()));
}
function hasMessages(object) {
return Object.keys(object).some((key) => {
if (isObject(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 = isInteger(key);
const nextValues = isIntegerKey ? values || [] : values || {};
const nestedValues = nextValues[key];
const result = rest.length && (Array.isArray(nestedValues) || isObject(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 __spreadProps(__spreadValues({}, 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 (isObject(v)) {
return setAll(v, value);
}
return value;
});
} else if (isObject(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;
throwOnConflictingProps(props, props.store);
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const collection = createCollectionStore(props);
const values = defaultValue(
props.values,
syncState == null ? void 0 : syncState.values,
props.defaultValues,
{}
);
const errors = defaultValue(
props.errors,
syncState == null ? void 0 : syncState.errors,
props.defaultErrors,
{}
);
const touched = defaultValue(
props.touched,
syncState == null ? void 0 : syncState.touched,
props.defaultTouched,
{}
);
const initialState = __spreadProps(__spreadValues({}, collection.getState()), {
values,
errors,
touched,
validating: defaultValue(syncState == null ? void 0 : syncState.validating, false),
submitting: defaultValue(syncState == null ? void 0 : syncState.submitting, false),
submitSucceed: defaultValue(syncState == null ? void 0 : syncState.submitSucceed, 0),
submitFailed: defaultValue(syncState == null ? void 0 : syncState.submitFailed, 0),
valid: !hasMessages(errors)
});
const form = createStore(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 = createStore(callbacksInitialState, syncCallbacks);
setup(form, () => init(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 __spreadProps(__spreadValues(__spreadValues({}, 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 = applyState(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 = applyState(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 = applyState(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
});
}
export {
createFormStore,
get,
hasMessages
};

38
node_modules/@ariakit/core/esm/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;
};

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

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

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,13 @@
"use client";
import {
createHovercardStore
} from "../__chunks/SOLWE6E5.js";
import "../__chunks/AF6IUUFN.js";
import "../__chunks/SX2XFD6A.js";
import "../__chunks/Z5IGYIPT.js";
import "../__chunks/EAHJFCU4.js";
import "../__chunks/Y3OOHFCN.js";
import "../__chunks/4R3V3JGP.js";
export {
createHovercardStore
};

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

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

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

@@ -0,0 +1,8 @@
"use client";
import "./__chunks/4R3V3JGP.js";
// src/index.ts
var src_default = {};
export {
src_default as default
};

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> {
}

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

@@ -0,0 +1,19 @@
"use client";
import {
createMenubarStore
} from "../__chunks/XU3EOSCU.js";
import "../__chunks/IERTEJ3A.js";
import "../__chunks/22K762VQ.js";
import "../__chunks/EAHJFCU4.js";
import "../__chunks/Y3OOHFCN.js";
import "../__chunks/DLOEKDPY.js";
import "../__chunks/7PRQYBBV.js";
import "../__chunks/4R3V3JGP.js";
// src/menu/menu-bar-store.ts
function createMenuBarStore(props = {}) {
return createMenubarStore(props);
}
export {
createMenuBarStore
};

97
node_modules/@ariakit/core/esm/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>> {
}

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

@@ -0,0 +1,138 @@
"use client";
import {
createHovercardStore
} from "../__chunks/SOLWE6E5.js";
import "../__chunks/AF6IUUFN.js";
import "../__chunks/SX2XFD6A.js";
import "../__chunks/Z5IGYIPT.js";
import {
createCompositeStore
} from "../__chunks/IERTEJ3A.js";
import "../__chunks/22K762VQ.js";
import {
createStore,
mergeStore,
omit,
pick,
setup,
sync,
throwOnConflictingProps
} from "../__chunks/EAHJFCU4.js";
import {
applyState,
defaultValue
} from "../__chunks/Y3OOHFCN.js";
import "../__chunks/DLOEKDPY.js";
import "../__chunks/7PRQYBBV.js";
import {
__objRest,
__spreadProps,
__spreadValues
} from "../__chunks/4R3V3JGP.js";
// src/menu/menu-store.ts
function createMenuStore(_a = {}) {
var _b = _a, {
combobox,
parent,
menubar
} = _b, props = __objRest(_b, [
"combobox",
"parent",
"menubar"
]);
const parentIsMenubar = !!menubar && !parent;
const store = mergeStore(
props.store,
pick(parent, ["values"]),
omit(combobox, [
"arrowElement",
"anchorElement",
"contentElement",
"popoverElement",
"disclosureElement"
])
);
throwOnConflictingProps(props, store);
const syncState = store.getState();
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
store,
orientation: defaultValue(
props.orientation,
syncState.orientation,
"vertical"
)
}));
const hovercard = createHovercardStore(__spreadProps(__spreadValues({}, props), {
store,
placement: defaultValue(
props.placement,
syncState.placement,
"bottom-start"
),
timeout: defaultValue(
props.timeout,
syncState.timeout,
parentIsMenubar ? 0 : 150
),
hideTimeout: defaultValue(props.hideTimeout, syncState.hideTimeout, 0)
}));
const initialState = __spreadProps(__spreadValues(__spreadValues({}, composite.getState()), hovercard.getState()), {
initialFocus: defaultValue(syncState.initialFocus, "container"),
values: defaultValue(
props.values,
syncState.values,
props.defaultValues,
{}
)
});
const menu = createStore(initialState, composite, hovercard, store);
setup(
menu,
() => sync(menu, ["mounted"], (state) => {
if (state.mounted)
return;
menu.setState("activeId", null);
})
);
setup(
menu,
() => sync(parent, ["orientation"], (state) => {
menu.setState(
"placement",
state.orientation === "vertical" ? "right-start" : "bottom-start"
);
})
);
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, 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 = applyState(value, prevValue);
if (nextValue === prevValue)
return values;
return __spreadProps(__spreadValues({}, values), {
[name]: nextValue !== void 0 && nextValue
});
});
}
});
}
export {
createMenuStore
};

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,14 @@
"use client";
import {
createMenubarStore
} from "../__chunks/XU3EOSCU.js";
import "../__chunks/IERTEJ3A.js";
import "../__chunks/22K762VQ.js";
import "../__chunks/EAHJFCU4.js";
import "../__chunks/Y3OOHFCN.js";
import "../__chunks/DLOEKDPY.js";
import "../__chunks/7PRQYBBV.js";
import "../__chunks/4R3V3JGP.js";
export {
createMenubarStore
};

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,12 @@
"use client";
import {
createPopoverStore
} from "../__chunks/AF6IUUFN.js";
import "../__chunks/SX2XFD6A.js";
import "../__chunks/Z5IGYIPT.js";
import "../__chunks/EAHJFCU4.js";
import "../__chunks/Y3OOHFCN.js";
import "../__chunks/4R3V3JGP.js";
export {
createPopoverStore
};

39
node_modules/@ariakit/core/esm/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> {
}

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

@@ -0,0 +1,43 @@
"use client";
import {
createCompositeStore
} from "../__chunks/IERTEJ3A.js";
import "../__chunks/22K762VQ.js";
import {
createStore
} from "../__chunks/EAHJFCU4.js";
import {
defaultValue
} from "../__chunks/Y3OOHFCN.js";
import "../__chunks/DLOEKDPY.js";
import "../__chunks/7PRQYBBV.js";
import {
__objRest,
__spreadProps,
__spreadValues
} from "../__chunks/4R3V3JGP.js";
// src/radio/radio-store.ts
function createRadioStore(_a = {}) {
var props = __objRest(_a, []);
var _a2;
const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
}));
const initialState = __spreadProps(__spreadValues({}, composite.getState()), {
value: defaultValue(
props.value,
syncState == null ? void 0 : syncState.value,
props.defaultValue,
null
)
});
const radio = createStore(initialState, composite, props.store);
return __spreadProps(__spreadValues(__spreadValues({}, composite), radio), {
setValue: (value) => radio.setState("value", value)
});
}
export {
createRadioStore
};

102
node_modules/@ariakit/core/esm/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 {};

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

@@ -0,0 +1,166 @@
"use client";
import {
createPopoverStore
} from "../__chunks/AF6IUUFN.js";
import "../__chunks/SX2XFD6A.js";
import "../__chunks/Z5IGYIPT.js";
import {
createCompositeStore
} from "../__chunks/IERTEJ3A.js";
import "../__chunks/22K762VQ.js";
import {
batch,
createStore,
mergeStore,
omit,
setup,
sync,
throwOnConflictingProps
} from "../__chunks/EAHJFCU4.js";
import {
defaultValue
} from "../__chunks/Y3OOHFCN.js";
import "../__chunks/DLOEKDPY.js";
import {
toArray
} from "../__chunks/7PRQYBBV.js";
import {
__objRest,
__spreadProps,
__spreadValues
} from "../__chunks/4R3V3JGP.js";
// src/select/select-store.ts
function createSelectStore(_a = {}) {
var _b = _a, {
combobox
} = _b, props = __objRest(_b, [
"combobox"
]);
const store = mergeStore(
props.store,
omit(combobox, [
"value",
"items",
"renderedItems",
"baseElement",
"arrowElement",
"anchorElement",
"contentElement",
"popoverElement",
"disclosureElement"
])
);
throwOnConflictingProps(props, store);
const syncState = store.getState();
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
store,
virtualFocus: defaultValue(
props.virtualFocus,
syncState.virtualFocus,
true
),
includesBaseElement: defaultValue(
props.includesBaseElement,
syncState.includesBaseElement,
false
),
activeId: defaultValue(
props.activeId,
syncState.activeId,
props.defaultActiveId,
null
),
orientation: defaultValue(
props.orientation,
syncState.orientation,
"vertical"
)
}));
const popover = createPopoverStore(__spreadProps(__spreadValues({}, props), {
store,
placement: defaultValue(
props.placement,
syncState.placement,
"bottom-start"
)
}));
const initialValue = new String("");
const initialState = __spreadProps(__spreadValues(__spreadValues({}, composite.getState()), popover.getState()), {
value: defaultValue(
props.value,
syncState.value,
props.defaultValue,
initialValue
),
setValueOnMove: defaultValue(
props.setValueOnMove,
syncState.setValueOnMove,
false
),
selectElement: defaultValue(syncState.selectElement, null),
labelElement: defaultValue(syncState.labelElement, null)
});
const select = createStore(initialState, composite, popover, store);
setup(
select,
() => sync(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);
})
);
setup(
select,
() => sync(select, ["mounted", "items", "value"], (state) => {
if (combobox)
return;
if (state.mounted)
return;
const values = toArray(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);
})
);
setup(
select,
() => batch(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 __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, composite), popover), select), {
combobox,
setValue: (value) => select.setState("value", value),
setSelectElement: (element) => select.setState("selectElement", element),
setLabelElement: (element) => select.setState("labelElement", element)
});
}
export {
createSelectStore
};

91
node_modules/@ariakit/core/esm/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> {
}

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

@@ -0,0 +1,127 @@
"use client";
import {
createCompositeStore
} from "../__chunks/IERTEJ3A.js";
import {
createCollectionStore
} from "../__chunks/22K762VQ.js";
import {
batch,
createStore,
setup,
sync
} from "../__chunks/EAHJFCU4.js";
import {
defaultValue
} from "../__chunks/Y3OOHFCN.js";
import "../__chunks/DLOEKDPY.js";
import "../__chunks/7PRQYBBV.js";
import {
__spreadProps,
__spreadValues
} from "../__chunks/4R3V3JGP.js";
// src/tab/tab-store.ts
function createTabStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
orientation: defaultValue(
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"horizontal"
),
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
}));
const panels = createCollectionStore();
const initialState = __spreadProps(__spreadValues({}, composite.getState()), {
selectedId: defaultValue(
props.selectedId,
syncState == null ? void 0 : syncState.selectedId,
props.defaultSelectedId,
void 0
),
selectOnMove: defaultValue(
props.selectOnMove,
syncState == null ? void 0 : syncState.selectOnMove,
true
)
});
const tab = createStore(initialState, composite, props.store);
setup(
tab,
() => sync(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);
})
);
setup(
tab,
() => batch(
tab,
["selectedId"],
(state) => tab.setState("activeId", state.selectedId)
)
);
setup(
tab,
() => sync(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);
}
})
);
setup(
tab,
() => sync(tab, ["renderedItems"], (state) => {
const tabs = state.renderedItems;
if (!tabs.length)
return;
return sync(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(__spreadProps(__spreadValues({}, panel), { tabId: tabItem.id }));
});
});
})
);
return __spreadProps(__spreadValues(__spreadValues({}, composite), tab), {
panels,
setSelectedId: (id) => tab.setState("selectedId", id),
select: (id) => {
tab.setState("selectedId", id);
composite.move(id);
}
});
}
export {
createTabStore
};

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,32 @@
"use client";
import {
createCompositeStore
} from "../__chunks/IERTEJ3A.js";
import "../__chunks/22K762VQ.js";
import "../__chunks/EAHJFCU4.js";
import {
defaultValue
} from "../__chunks/Y3OOHFCN.js";
import "../__chunks/DLOEKDPY.js";
import "../__chunks/7PRQYBBV.js";
import {
__spreadProps,
__spreadValues
} from "../__chunks/4R3V3JGP.js";
// src/toolbar/toolbar-store.ts
function createToolbarStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
return createCompositeStore(__spreadProps(__spreadValues({}, props), {
orientation: defaultValue(
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"horizontal"
),
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
}));
}
export {
createToolbarStore
};

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,40 @@
"use client";
import {
createHovercardStore
} from "../__chunks/SOLWE6E5.js";
import "../__chunks/AF6IUUFN.js";
import "../__chunks/SX2XFD6A.js";
import "../__chunks/Z5IGYIPT.js";
import {
createStore
} from "../__chunks/EAHJFCU4.js";
import {
defaultValue
} from "../__chunks/Y3OOHFCN.js";
import {
__spreadProps,
__spreadValues
} from "../__chunks/4R3V3JGP.js";
// src/tooltip/tooltip-store.ts
function createTooltipStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const hovercard = createHovercardStore(__spreadProps(__spreadValues({}, props), {
placement: defaultValue(
props.placement,
syncState == null ? void 0 : syncState.placement,
"top"
),
hideTimeout: defaultValue(props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout, 0)
}));
const initialState = __spreadProps(__spreadValues({}, hovercard.getState()), {
type: defaultValue(props.type, syncState == null ? void 0 : syncState.type, "description"),
skipTimeout: defaultValue(props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300)
});
const tooltip = createStore(initialState, hovercard, props.store);
return __spreadValues(__spreadValues({}, hovercard), tooltip);
}
export {
createTooltipStore
};

29
node_modules/@ariakit/core/esm/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[];

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

@@ -0,0 +1,14 @@
"use client";
import {
addItemToArray,
flatten2DArray,
reverseArray,
toArray
} from "../__chunks/7PRQYBBV.js";
import "../__chunks/4R3V3JGP.js";
export {
addItemToArray,
flatten2DArray,
reverseArray,
toArray
};

114
node_modules/@ariakit/core/esm/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;

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

@@ -0,0 +1,42 @@
"use client";
import {
canUseDOM,
closest,
contains,
getActiveElement,
getDocument,
getPopupItemRole,
getPopupRole,
getScrollingElement,
getTextboxSelection,
getWindow,
isButton,
isFrame,
isPartiallyHidden,
isTextField,
isVisible,
matches,
scrollIntoViewIfNeeded,
setSelectionRange
} from "../__chunks/DLOEKDPY.js";
import "../__chunks/4R3V3JGP.js";
export {
canUseDOM,
closest,
contains,
getActiveElement,
getDocument,
getPopupItemRole,
getPopupRole,
getScrollingElement,
getTextboxSelection,
getWindow,
isButton,
isFrame,
isPartiallyHidden,
isTextField,
isVisible,
matches,
scrollIntoViewIfNeeded,
setSelectionRange
};

70
node_modules/@ariakit/core/esm/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;

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

@@ -0,0 +1,132 @@
"use client";
import {
isApple
} from "../__chunks/MHPO2BXA.js";
import {
contains
} from "../__chunks/DLOEKDPY.js";
import {
__spreadProps,
__spreadValues
} from "../__chunks/4R3V3JGP.js";
// src/utils/events.ts
function isPortalEvent(event) {
return Boolean(
event.currentTarget && !contains(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 = isApple();
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 = __spreadProps(__spreadValues({}, 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 = __spreadProps(__spreadValues({}, 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 || !contains(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;
}
export {
addGlobalEventListener,
fireBlurEvent,
fireClickEvent,
fireEvent,
fireFocusEvent,
fireKeyboardEvent,
isDownloading,
isFocusEventOutside,
isOpeningInNewTab,
isPortalEvent,
isSelfTarget,
queueBeforeEvent
};

117
node_modules/@ariakit/core/esm/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;

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

@@ -0,0 +1,261 @@
"use client";
import {
closest,
contains,
getActiveElement,
isFrame,
isVisible,
matches
} from "../__chunks/DLOEKDPY.js";
import {
__spreadValues
} from "../__chunks/4R3V3JGP.js";
// 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 (!matches(element, selector))
return false;
if (!isVisible(element))
return false;
if (closest(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 = getActiveElement(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 (isFrame(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 (isFrame(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 = getActiveElement(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 = getActiveElement(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 = closest(element, selector);
}
return element || null;
}
function hasFocus(element) {
const activeElement = getActiveElement(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 = getActiveElement(element);
if (!activeElement)
return false;
if (contains(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(__spreadValues({ block: "nearest", inline: "nearest" }, options));
}
}
export {
disableFocus,
disableFocusIn,
focusIfNeeded,
focusIntoView,
getAllFocusable,
getAllFocusableIn,
getAllTabbable,
getAllTabbableIn,
getClosestFocusable,
getFirstFocusable,
getFirstFocusableIn,
getFirstTabbable,
getFirstTabbableIn,
getLastTabbable,
getLastTabbableIn,
getNextTabbable,
getNextTabbableIn,
getPreviousTabbable,
getPreviousTabbableIn,
hasFocus,
hasFocusWithin,
isFocusable,
isTabbable,
restoreFocusIn
};

124
node_modules/@ariakit/core/esm/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 {};

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

@@ -0,0 +1,46 @@
"use client";
import {
afterPaint,
applyState,
beforePaint,
chain,
cx,
defaultValue,
disabledFromProps,
getKeys,
hasOwnProperty,
identity,
invariant,
isEmpty,
isFalsyBooleanCallback,
isInteger,
isObject,
noop,
normalizeString,
omit,
pick,
shallowEqual
} from "../__chunks/Y3OOHFCN.js";
import "../__chunks/4R3V3JGP.js";
export {
afterPaint,
applyState,
beforePaint,
chain,
cx,
defaultValue,
disabledFromProps,
getKeys,
hasOwnProperty,
identity,
invariant,
isEmpty,
isFalsyBooleanCallback,
isInteger,
isObject,
noop,
normalizeString,
omit,
pick,
shallowEqual
};

20
node_modules/@ariakit/core/esm/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;

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

@@ -0,0 +1,17 @@
"use client";
import {
isApple,
isFirefox,
isMac,
isSafari,
isTouchDevice
} from "../__chunks/MHPO2BXA.js";
import "../__chunks/DLOEKDPY.js";
import "../__chunks/4R3V3JGP.js";
export {
isApple,
isFirefox,
isMac,
isSafari,
isTouchDevice
};

74
node_modules/@ariakit/core/esm/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 {};

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

@@ -0,0 +1,27 @@
"use client";
import {
batch,
createStore,
init,
mergeStore,
omit,
pick,
setup,
subscribe,
sync,
throwOnConflictingProps
} from "../__chunks/EAHJFCU4.js";
import "../__chunks/Y3OOHFCN.js";
import "../__chunks/4R3V3JGP.js";
export {
batch,
createStore,
init,
mergeStore,
omit,
pick,
setup,
subscribe,
sync,
throwOnConflictingProps
};

74
node_modules/@ariakit/core/esm/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 & {});

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

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