UNPKG

react-aria-components

Version:

A library of styleable components built using React Aria

944 lines (930 loc) • 344 kB
import $e038a7e7a6d81989$exports from "./ar-AE.module.js"; import $0ec14741b0133644$exports from "./bg-BG.module.js"; import $642f7badf2405784$exports from "./cs-CZ.module.js"; import $30cee8d2535734ec$exports from "./da-DK.module.js"; import $c302d0504fca332a$exports from "./de-DE.module.js"; import $0d0703f2bd7e421c$exports from "./el-GR.module.js"; import $cafa55beb2fc5ef3$exports from "./en-US.module.js"; import $18ac2ceede598103$exports from "./es-ES.module.js"; import $718705a15b8a633a$exports from "./et-EE.module.js"; import $bf36dae9ecc81ce0$exports from "./fi-FI.module.js"; import $0b4828edb010b855$exports from "./fr-FR.module.js"; import $0030f210b040e540$exports from "./he-IL.module.js"; import $1f0ebacf5a0c0fa1$exports from "./hr-HR.module.js"; import $3a706ba61f3d6bba$exports from "./hu-HU.module.js"; import $0d17809e74607796$exports from "./it-IT.module.js"; import $65a71f9a56f1398f$exports from "./ja-JP.module.js"; import $e5efad074a74abef$exports from "./ko-KR.module.js"; import $d70c2a849e55c607$exports from "./lt-LT.module.js"; import $009bbbb440d0e907$exports from "./lv-LV.module.js"; import $9366fe642464ee83$exports from "./nb-NO.module.js"; import $62f9bc1f98ea21de$exports from "./nl-NL.module.js"; import $4ec2e5b6623b1b76$exports from "./pl-PL.module.js"; import $e25098e26647cc04$exports from "./pt-BR.module.js"; import $dd39c57d242c8156$exports from "./pt-PT.module.js"; import $3b4c1ba5afd57b35$exports from "./ro-RO.module.js"; import $a455b2cda79eb746$exports from "./ru-RU.module.js"; import $b983ca1383d5b960$exports from "./sk-SK.module.js"; import $32a515ef673b0655$exports from "./sl-SI.module.js"; import $89434176ab35446b$exports from "./sr-SP.module.js"; import $727da781aca847f9$exports from "./sv-SE.module.js"; import $fcd2d84b9a2d489c$exports from "./tr-TR.module.js"; import $2422ac328687ee23$exports from "./uk-UA.module.js"; import $c9a532d1c973af61$exports from "./zh-CN.module.js"; import $34de119f14549a4b$exports from "./zh-TW.module.js"; import "client-only"; import {DIRECTORY_DRAG_TYPE as $67da31f5140672c4$re_export$DIRECTORY_DRAG_TYPE, isDirectoryDropItem as $67da31f5140672c4$re_export$isDirectoryDropItem, isFileDropItem as $67da31f5140672c4$re_export$isFileDropItem, isTextDropItem as $67da31f5140672c4$re_export$isTextDropItem, SSRProvider as $67da31f5140672c4$re_export$SSRProvider, RouterProvider as $67da31f5140672c4$re_export$RouterProvider, I18nProvider as $67da31f5140672c4$re_export$I18nProvider, useLocale as $67da31f5140672c4$re_export$useLocale, useIsSSR as $dGqE5$useIsSSR, mergeProps as $dGqE5$mergeProps, useLink as $dGqE5$useLink, useHover as $dGqE5$useHover, useFocusRing as $dGqE5$useFocusRing, useButton as $dGqE5$useButton, useCalendar as $dGqE5$useCalendar, VisuallyHidden as $dGqE5$VisuallyHidden, useRangeCalendar as $dGqE5$useRangeCalendar, useCalendarGrid as $dGqE5$useCalendarGrid, useCalendarCell as $dGqE5$useCalendarCell, useCheckboxGroup as $dGqE5$useCheckboxGroup, useCheckboxGroupItem as $dGqE5$useCheckboxGroupItem, useCheckbox as $dGqE5$useCheckbox, useFilter as $dGqE5$useFilter, useComboBox as $dGqE5$useComboBox, useCollator as $dGqE5$useCollator, ListKeyboardDelegate as $dGqE5$ListKeyboardDelegate, useListBox as $dGqE5$useListBox, FocusScope as $dGqE5$FocusScope, useListBoxSection as $dGqE5$useListBoxSection, useOption as $dGqE5$useOption, useDraggableCollection as $dGqE5$useDraggableCollection, useDraggableItem as $dGqE5$useDraggableItem, DragPreview as $dGqE5$DragPreview, useDroppableItem as $dGqE5$useDroppableItem, useDroppableCollection as $dGqE5$useDroppableCollection, useDropIndicator as $dGqE5$useDropIndicator, ListDropTargetDelegate as $dGqE5$ListDropTargetDelegate, useSeparator as $dGqE5$useSeparator, useOverlayTrigger as $dGqE5$useOverlayTrigger, useId as $dGqE5$useId, useDialog as $dGqE5$useDialog, usePopover as $dGqE5$usePopover, Overlay as $dGqE5$Overlay, DismissButton as $dGqE5$DismissButton, useDateField as $dGqE5$useDateField, useTimeField as $dGqE5$useTimeField, useDateSegment as $dGqE5$useDateSegment, useDatePicker as $dGqE5$useDatePicker, useDateRangePicker as $dGqE5$useDateRangePicker, useDrop as $dGqE5$useDrop, useLocalizedStringFormatter as $dGqE5$useLocalizedStringFormatter, useClipboard as $dGqE5$useClipboard, useGridList as $dGqE5$useGridList, useGridListItem as $dGqE5$useGridListItem, useGridListSelectionCheckbox as $dGqE5$useGridListSelectionCheckbox, useVisuallyHidden as $dGqE5$useVisuallyHidden, useMenuTrigger as $dGqE5$useMenuTrigger, useMenu as $dGqE5$useMenu, useMenuSection as $dGqE5$useMenuSection, useMenuItem as $dGqE5$useMenuItem, useMeter as $dGqE5$useMeter, useModalOverlay as $dGqE5$useModalOverlay, useNumberField as $dGqE5$useNumberField, useProgressBar as $dGqE5$useProgressBar, useRadioGroup as $dGqE5$useRadioGroup, useRadio as $dGqE5$useRadio, useSearchField as $dGqE5$useSearchField, useSelect as $dGqE5$useSelect, HiddenSelect as $dGqE5$HiddenSelect, useNumberFormatter as $dGqE5$useNumberFormatter, useSlider as $dGqE5$useSlider, useSliderThumb as $dGqE5$useSliderThumb, useSwitch as $dGqE5$useSwitch, useTable as $dGqE5$useTable, useTableRowGroup as $dGqE5$useTableRowGroup, useTableHeaderRow as $dGqE5$useTableHeaderRow, useTableSelectAllCheckbox as $dGqE5$useTableSelectAllCheckbox, useTableColumnHeader as $dGqE5$useTableColumnHeader, useTableColumnResize as $dGqE5$useTableColumnResize, useTableRow as $dGqE5$useTableRow, useTableSelectionCheckbox as $dGqE5$useTableSelectionCheckbox, useTableCell as $dGqE5$useTableCell, useTabList as $dGqE5$useTabList, useTab as $dGqE5$useTab, useTabPanel as $dGqE5$useTabPanel, useTagGroup as $dGqE5$useTagGroup, useTag as $dGqE5$useTag, useTextField as $dGqE5$useTextField, useToggleButton as $dGqE5$useToggleButton, useTooltipTrigger as $dGqE5$useTooltipTrigger, OverlayContainer as $dGqE5$OverlayContainer, useOverlayPosition as $dGqE5$useOverlayPosition, useTooltip as $dGqE5$useTooltip} from "react-aria"; import {FormValidationContext as $67da31f5140672c4$re_export$FormValidationContext, useCalendarState as $dGqE5$useCalendarState, useRangeCalendarState as $dGqE5$useRangeCalendarState, useCheckboxGroupState as $dGqE5$useCheckboxGroupState, useToggleState as $dGqE5$useToggleState, useComboBoxState as $dGqE5$useComboBoxState, useListState as $dGqE5$useListState, useDraggableCollectionState as $dGqE5$useDraggableCollectionState, useDroppableCollectionState as $dGqE5$useDroppableCollectionState, useOverlayTriggerState as $dGqE5$useOverlayTriggerState, useDateFieldState as $dGqE5$useDateFieldState, useTimeFieldState as $dGqE5$useTimeFieldState, useDatePickerState as $dGqE5$useDatePickerState, useDateRangePickerState as $dGqE5$useDateRangePickerState, useMenuTriggerState as $dGqE5$useMenuTriggerState, useTreeState as $dGqE5$useTreeState, useNumberFieldState as $dGqE5$useNumberFieldState, useRadioGroupState as $dGqE5$useRadioGroupState, useSearchFieldState as $dGqE5$useSearchFieldState, useSelectState as $dGqE5$useSelectState, useSliderState as $dGqE5$useSliderState, useTableColumnResizeState as $dGqE5$useTableColumnResizeState, useTableState as $dGqE5$useTableState, useTabListState as $dGqE5$useTabListState, useTooltipTriggerState as $dGqE5$useTooltipTriggerState} from "react-stately"; import {filterDOMProps as $dGqE5$filterDOMProps, useObjectRef as $dGqE5$useObjectRef, mergeRefs as $dGqE5$mergeRefs, mergeProps as $dGqE5$mergeProps1, useLayoutEffect as $dGqE5$useLayoutEffect, useResizeObserver as $dGqE5$useResizeObserver, useSlotId as $dGqE5$useSlotId, useLabels as $dGqE5$useLabels, useViewportSize as $dGqE5$useViewportSize} from "@react-aria/utils"; import $dGqE5$react, {createContext as $dGqE5$createContext, forwardRef as $dGqE5$forwardRef, useMemo as $dGqE5$useMemo, cloneElement as $dGqE5$cloneElement, useRef as $dGqE5$useRef, useCallback as $dGqE5$useCallback, useContext as $dGqE5$useContext, useEffect as $dGqE5$useEffect, useState as $dGqE5$useState} from "react"; import $dGqE5$reactdom, {createPortal as $dGqE5$createPortal} from "react-dom"; import {useSyncExternalStore as $dGqE5$useSyncExternalStore} from "use-sync-external-store/shim/index.js"; import {createCalendar as $dGqE5$createCalendar, endOfMonth as $dGqE5$endOfMonth, getWeeksInMonth as $dGqE5$getWeeksInMonth, isSameMonth as $dGqE5$isSameMonth, isSameDay as $dGqE5$isSameDay} from "@internationalized/date"; import {PressResponder as $dGqE5$PressResponder, useInteractOutside as $dGqE5$useInteractOutside, useHover as $dGqE5$useHover1} from "@react-aria/interactions"; import {UNSTABLE_useSubmenuTriggerState as $dGqE5$UNSTABLE_useSubmenuTriggerState} from "@react-stately/menu"; import {UNSTABLE_useSubmenuTrigger as $dGqE5$UNSTABLE_useSubmenuTrigger} from "@react-aria/menu"; import {clamp as $dGqE5$clamp} from "@react-stately/utils"; import {buildHeaderRows as $dGqE5$buildHeaderRows} from "@react-stately/table"; import {useToolbar as $dGqE5$useToolbar} from "@react-aria/toolbar"; import {FocusableProvider as $dGqE5$FocusableProvider} from "@react-aria/focus"; function $parcel$interopDefault(a) { return a && a.__esModule ? a.default : a; } /* * Copyright 2022 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ // Mark as a client only package. This will cause a build time error if you try // to import it from a React Server Component in a framework like Next.js. /* * Copyright 2022 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ /* * Copyright 2022 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ class $7135fc7d473fd974$export$f5d856d854e74713 { get childNodes() { throw new Error("childNodes is not supported"); } clone() { let node = new $7135fc7d473fd974$export$f5d856d854e74713(this.type, this.key); node.value = this.value; node.level = this.level; node.hasChildNodes = this.hasChildNodes; node.rendered = this.rendered; node.textValue = this.textValue; node["aria-label"] = this["aria-label"]; node.index = this.index; node.parentKey = this.parentKey; node.prevKey = this.prevKey; node.nextKey = this.nextKey; node.firstChildKey = this.firstChildKey; node.lastChildKey = this.lastChildKey; node.props = this.props; return node; } constructor(type, key){ this.value = null; this.level = 0; this.hasChildNodes = false; this.rendered = null; this.textValue = ""; this["aria-label"] = undefined; this.index = 0; this.parentKey = null; this.prevKey = null; this.nextKey = null; this.firstChildKey = null; this.lastChildKey = null; this.props = {}; this.type = type; this.key = key; } } /** * A mutable node in the fake DOM tree. When mutated, it marks itself as dirty * and queues an update with the owner document. */ class $7135fc7d473fd974$var$BaseNode { *[Symbol.iterator]() { let node = this.firstChild; while(node){ yield node; node = node.nextSibling; } } get firstChild() { return this._firstChild; } set firstChild(firstChild) { this._firstChild = firstChild; this.ownerDocument.markDirty(this); } get lastChild() { return this._lastChild; } set lastChild(lastChild) { this._lastChild = lastChild; this.ownerDocument.markDirty(this); } get previousSibling() { return this._previousSibling; } set previousSibling(previousSibling) { this._previousSibling = previousSibling; this.ownerDocument.markDirty(this); } get nextSibling() { return this._nextSibling; } set nextSibling(nextSibling) { this._nextSibling = nextSibling; this.ownerDocument.markDirty(this); } get parentNode() { return this._parentNode; } set parentNode(parentNode) { this._parentNode = parentNode; this.ownerDocument.markDirty(this); } get isConnected() { var _this_parentNode; return ((_this_parentNode = this.parentNode) === null || _this_parentNode === void 0 ? void 0 : _this_parentNode.isConnected) || false; } appendChild(child) { this.ownerDocument.startTransaction(); if (child.parentNode) child.parentNode.removeChild(child); if (this.firstChild == null) this.firstChild = child; if (this.lastChild) { this.lastChild.nextSibling = child; child.index = this.lastChild.index + 1; child.previousSibling = this.lastChild; } else { child.previousSibling = null; child.index = 0; } child.parentNode = this; child.nextSibling = null; this.lastChild = child; this.ownerDocument.markDirty(this); if (child.hasSetProps) // Only add the node to the collection if we already received props for it. // Otherwise wait until then so we have the correct id for the node. this.ownerDocument.addNode(child); this.ownerDocument.endTransaction(); this.ownerDocument.queueUpdate(); } insertBefore(newNode, referenceNode) { if (referenceNode == null) return this.appendChild(newNode); this.ownerDocument.startTransaction(); if (newNode.parentNode) newNode.parentNode.removeChild(newNode); newNode.nextSibling = referenceNode; newNode.previousSibling = referenceNode.previousSibling; newNode.index = referenceNode.index; if (this.firstChild === referenceNode) this.firstChild = newNode; else if (referenceNode.previousSibling) referenceNode.previousSibling.nextSibling = newNode; referenceNode.previousSibling = newNode; newNode.parentNode = referenceNode.parentNode; let node = referenceNode; while(node){ node.index++; node = node.nextSibling; } if (newNode.hasSetProps) this.ownerDocument.addNode(newNode); this.ownerDocument.endTransaction(); this.ownerDocument.queueUpdate(); } removeChild(child) { if (child.parentNode !== this) return; this.ownerDocument.startTransaction(); let node = child.nextSibling; while(node){ node.index--; node = node.nextSibling; } if (child.nextSibling) child.nextSibling.previousSibling = child.previousSibling; if (child.previousSibling) child.previousSibling.nextSibling = child.nextSibling; if (this.firstChild === child) this.firstChild = child.nextSibling; if (this.lastChild === child) this.lastChild = child.previousSibling; child.parentNode = null; child.nextSibling = null; child.previousSibling = null; child.index = 0; this.ownerDocument.removeNode(child); this.ownerDocument.endTransaction(); this.ownerDocument.queueUpdate(); } addEventListener() {} removeEventListener() {} constructor(ownerDocument){ this._firstChild = null; this._lastChild = null; this._previousSibling = null; this._nextSibling = null; this._parentNode = null; this.ownerDocument = ownerDocument; } } class $7135fc7d473fd974$export$dc064fe9e59310fd extends $7135fc7d473fd974$var$BaseNode { get index() { return this._index; } set index(index) { this._index = index; this.ownerDocument.markDirty(this); } get level() { if (this.parentNode instanceof $7135fc7d473fd974$export$dc064fe9e59310fd) return this.parentNode.level + (this.node.type === "item" ? 1 : 0); return 0; } updateNode() { var _this_previousSibling, _this_nextSibling, _this_firstChild, _this_lastChild; let node = this.ownerDocument.getMutableNode(this); node.index = this.index; node.level = this.level; node.parentKey = this.parentNode instanceof $7135fc7d473fd974$export$dc064fe9e59310fd ? this.parentNode.node.key : null; var _this_previousSibling_node_key; node.prevKey = (_this_previousSibling_node_key = (_this_previousSibling = this.previousSibling) === null || _this_previousSibling === void 0 ? void 0 : _this_previousSibling.node.key) !== null && _this_previousSibling_node_key !== void 0 ? _this_previousSibling_node_key : null; var _this_nextSibling_node_key; node.nextKey = (_this_nextSibling_node_key = (_this_nextSibling = this.nextSibling) === null || _this_nextSibling === void 0 ? void 0 : _this_nextSibling.node.key) !== null && _this_nextSibling_node_key !== void 0 ? _this_nextSibling_node_key : null; node.hasChildNodes = !!this.firstChild; var _this_firstChild_node_key; node.firstChildKey = (_this_firstChild_node_key = (_this_firstChild = this.firstChild) === null || _this_firstChild === void 0 ? void 0 : _this_firstChild.node.key) !== null && _this_firstChild_node_key !== void 0 ? _this_firstChild_node_key : null; var _this_lastChild_node_key; node.lastChildKey = (_this_lastChild_node_key = (_this_lastChild = this.lastChild) === null || _this_lastChild === void 0 ? void 0 : _this_lastChild.node.key) !== null && _this_lastChild_node_key !== void 0 ? _this_lastChild_node_key : null; } setProps(obj, ref, rendered) { let node = this.ownerDocument.getMutableNode(this); let { value: value, textValue: textValue, id: id, ...props } = obj; props.ref = ref; node.props = props; node.rendered = rendered; node.value = value; node.textValue = textValue || (typeof rendered === "string" ? rendered : "") || obj["aria-label"] || ""; if (id != null && id !== node.key) { if (this.hasSetProps) throw new Error("Cannot change the id of an item"); node.key = id; } // If this is the first time props have been set, end the transaction started in the constructor // so this node can be emitted. if (!this.hasSetProps) { this.ownerDocument.addNode(this); this.ownerDocument.endTransaction(); this.hasSetProps = true; } this.ownerDocument.queueUpdate(); } get style() { return {}; } hasAttribute() {} setAttribute() {} setAttributeNS() {} removeAttribute() {} constructor(type, ownerDocument){ super(ownerDocument); this.nodeType = 8 // COMMENT_NODE (we'd use ELEMENT_NODE but React DevTools will fail to get its dimensions) ; this._index = 0; this.hasSetProps = false; this.node = new $7135fc7d473fd974$export$f5d856d854e74713(type, `react-aria-${++ownerDocument.nodeId}`); // Start a transaction so that no updates are emitted from the collection // until the props for this node are set. We don't know the real id for the // node until then, so we need to avoid emitting collections in an inconsistent state. this.ownerDocument.startTransaction(); } } class $7135fc7d473fd974$export$408d25a4e12db025 { get size() { return this.keyMap.size; } getKeys() { return this.keyMap.keys(); } *[Symbol.iterator]() { let node = this.firstKey != null ? this.keyMap.get(this.firstKey) : undefined; while(node){ yield node; node = node.nextKey != null ? this.keyMap.get(node.nextKey) : undefined; } } getChildren(key) { let keyMap = this.keyMap; return { *[Symbol.iterator] () { let parent = keyMap.get(key); let node = (parent === null || parent === void 0 ? void 0 : parent.firstChildKey) != null ? keyMap.get(parent.firstChildKey) : null; while(node){ yield node; node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined; } } }; } getKeyBefore(key) { let node = this.keyMap.get(key); if (!node) return null; if (node.prevKey != null) { node = this.keyMap.get(node.prevKey); while(node && node.type !== "item" && node.lastChildKey != null)node = this.keyMap.get(node.lastChildKey); var _node_key; return (_node_key = node === null || node === void 0 ? void 0 : node.key) !== null && _node_key !== void 0 ? _node_key : null; } return node.parentKey; } getKeyAfter(key) { let node = this.keyMap.get(key); if (!node) return null; if (node.type !== "item" && node.firstChildKey != null) return node.firstChildKey; while(node){ if (node.nextKey != null) return node.nextKey; if (node.parentKey != null) node = this.keyMap.get(node.parentKey); else return null; } return null; } getFirstKey() { return this.firstKey; } getLastKey() { let node = this.lastKey != null ? this.keyMap.get(this.lastKey) : null; while((node === null || node === void 0 ? void 0 : node.lastChildKey) != null)node = this.keyMap.get(node.lastChildKey); var _node_key; return (_node_key = node === null || node === void 0 ? void 0 : node.key) !== null && _node_key !== void 0 ? _node_key : null; } getItem(key) { var _this_keyMap_get; return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null; } at() { throw new Error("Not implemented"); } clone() { // We need to clone using this.constructor so that subclasses have the right prototype. // TypeScript isn't happy about this yet. // https://github.com/microsoft/TypeScript/issues/3841 let Constructor = this.constructor; let collection = new Constructor(); collection.keyMap = new Map(this.keyMap); collection.firstKey = this.firstKey; collection.lastKey = this.lastKey; return collection; } addNode(node) { if (this.frozen) throw new Error("Cannot add a node to a frozen collection"); this.keyMap.set(node.key, node); } removeNode(key) { if (this.frozen) throw new Error("Cannot remove a node to a frozen collection"); this.keyMap.delete(key); } commit(firstKey, lastKey, isSSR = false) { if (this.frozen) throw new Error("Cannot commit a frozen collection"); this.firstKey = firstKey; this.lastKey = lastKey; this.frozen = !isSSR; } constructor(){ this.keyMap = new Map(); this.firstKey = null; this.lastKey = null; this.frozen = false; } } class $7135fc7d473fd974$export$b34a105447964f9f extends $7135fc7d473fd974$var$BaseNode { get isConnected() { return true; } createElement(type) { return new $7135fc7d473fd974$export$dc064fe9e59310fd(type, this); } /** * Lazily gets a mutable instance of a Node. If the node has already * been cloned during this update cycle, it just returns the existing one. */ getMutableNode(element) { let node = element.node; if (!this.mutatedNodes.has(element)) { node = element.node.clone(); this.mutatedNodes.add(element); element.node = node; } this.markDirty(element); return node; } getMutableCollection() { if (!this.isSSR && !this.collectionMutated) { this.collection = this.collection.clone(); this.collectionMutated = true; } return this.collection; } markDirty(node) { this.dirtyNodes.add(node); } startTransaction() { this.transactionCount++; } endTransaction() { this.transactionCount--; } addNode(element) { let collection = this.getMutableCollection(); if (!collection.getItem(element.node.key)) { collection.addNode(element.node); for (let child of element)this.addNode(child); } this.markDirty(element); } removeNode(node) { for (let child of node)this.removeNode(child); let collection = this.getMutableCollection(); collection.removeNode(node.node.key); this.markDirty(node); } /** Finalizes the collection update, updating all nodes and freezing the collection. */ getCollection() { if (this.transactionCount > 0) return this.collection; this.updateCollection(); return this.collection; } updateCollection() { for (let element of this.dirtyNodes)if (element instanceof $7135fc7d473fd974$export$dc064fe9e59310fd && element.isConnected) element.updateNode(); this.dirtyNodes.clear(); if (this.mutatedNodes.size || this.collectionMutated) { var _this_firstChild, _this_lastChild; let collection = this.getMutableCollection(); for (let element of this.mutatedNodes)if (element.isConnected) collection.addNode(element.node); var _this_firstChild_node_key, _this_lastChild_node_key; collection.commit((_this_firstChild_node_key = (_this_firstChild = this.firstChild) === null || _this_firstChild === void 0 ? void 0 : _this_firstChild.node.key) !== null && _this_firstChild_node_key !== void 0 ? _this_firstChild_node_key : null, (_this_lastChild_node_key = (_this_lastChild = this.lastChild) === null || _this_lastChild === void 0 ? void 0 : _this_lastChild.node.key) !== null && _this_lastChild_node_key !== void 0 ? _this_lastChild_node_key : null, this.isSSR); this.mutatedNodes.clear(); } this.collectionMutated = false; } queueUpdate() { // Don't emit any updates if there is a transaction in progress. // queueUpdate should be called again after the transaction. if (this.dirtyNodes.size === 0 || this.transactionCount > 0) return; for (let fn of this.subscriptions)fn(); } subscribe(fn) { this.subscriptions.add(fn); return ()=>this.subscriptions.delete(fn); } resetAfterSSR() { if (this.isSSR) { this.isSSR = false; this.firstChild = null; this.lastChild = null; this.nodeId = 0; } } constructor(collection){ // @ts-ignore super(null); this.nodeType = 11 // DOCUMENT_FRAGMENT_NODE ; this.ownerDocument = this; this.dirtyNodes = new Set(); this.isSSR = false; this.nodeId = 0; this.nodesByProps = new WeakMap(); this.mutatedNodes = new Set(); this.subscriptions = new Set(); this.transactionCount = 0; this.collection = collection; this.collectionMutated = true; } } function $7135fc7d473fd974$export$727c8fc270210f13(props) { let { children: children, items: items, idScope: idScope, addIdAndValue: addIdAndValue, dependencies: dependencies = [] } = props; // Invalidate the cache whenever the parent value changes. // eslint-disable-next-line react-hooks/exhaustive-deps let cache = (0, $dGqE5$useMemo)(()=>new WeakMap(), dependencies); return (0, $dGqE5$useMemo)(()=>{ if (items && typeof children === "function") { let res = []; for (let item of items){ let rendered = cache.get(item); if (!rendered) { rendered = children(item); var _rendered_props_id, _ref; // @ts-ignore let key = (_ref = (_rendered_props_id = rendered.props.id) !== null && _rendered_props_id !== void 0 ? _rendered_props_id : item.key) !== null && _ref !== void 0 ? _ref : item.id; // eslint-disable-next-line max-depth if (key == null) throw new Error("Could not determine key for item"); // eslint-disable-next-line max-depth if (idScope) key = idScope + ":" + key; // Note: only works if wrapped Item passes through id... rendered = /*#__PURE__*/ (0, $dGqE5$cloneElement)(rendered, addIdAndValue ? { key: key, id: key, value: item } : { key: key }); cache.set(item, rendered); } res.push(rendered); } return res; } else if (typeof children !== "function") return children; }, [ children, items, cache, idScope, addIdAndValue ]); } function $7135fc7d473fd974$export$901dbff4e54a6dd0(props) { return $7135fc7d473fd974$export$727c8fc270210f13({ ...props, addIdAndValue: true }); } const $7135fc7d473fd974$var$ShallowRenderContext = /*#__PURE__*/ (0, $dGqE5$createContext)(false); function $7135fc7d473fd974$export$6cd28814d92fa9c9(props, initialCollection) { let { collection: collection, document: document } = $7135fc7d473fd974$export$7cd71aa5ddd6dc4e(initialCollection); let portal = $7135fc7d473fd974$export$ad42d5efb4461b31(props, document); return { portal: portal, collection: collection }; } // React 16 and 17 don't support useSyncExternalStore natively, and the shim provided by React does not support getServerSnapshot. // This wrapper uses the shim, but additionally calls getServerSnapshot during SSR (according to SSRProvider). function $7135fc7d473fd974$var$useSyncExternalStoreFallback(subscribe, getSnapshot, getServerSnapshot) { let isSSR = (0, $dGqE5$useIsSSR)(); let isSSRRef = (0, $dGqE5$useRef)(isSSR); // This is read immediately inside the wrapper, which also runs during render. // We just need a ref to avoid invalidating the callback itself, which // would cause React to re-run the callback more than necessary. // eslint-disable-next-line rulesdir/pure-render isSSRRef.current = isSSR; let getSnapshotWrapper = (0, $dGqE5$useCallback)(()=>{ return isSSRRef.current ? getServerSnapshot() : getSnapshot(); }, [ getSnapshot, getServerSnapshot ]); return (0, $dGqE5$useSyncExternalStore)(subscribe, getSnapshotWrapper); } const $7135fc7d473fd974$var$useSyncExternalStore = typeof (0, $dGqE5$react)["useSyncExternalStore"] === "function" ? (0, $dGqE5$react)["useSyncExternalStore"] : $7135fc7d473fd974$var$useSyncExternalStoreFallback; function $7135fc7d473fd974$export$7cd71aa5ddd6dc4e(initialCollection) { // The document instance is mutable, and should never change between renders. // useSyncExternalStore is used to subscribe to updates, which vends immutable Collection objects. let document = (0, $dGqE5$useMemo)(()=>new $7135fc7d473fd974$export$b34a105447964f9f(initialCollection || new $7135fc7d473fd974$export$408d25a4e12db025()), [ initialCollection ]); let subscribe = (0, $dGqE5$useCallback)((fn)=>document.subscribe(fn), [ document ]); let getSnapshot = (0, $dGqE5$useCallback)(()=>{ let collection = document.getCollection(); if (document.isSSR) // After SSR is complete, reset the document to empty so it is ready for React to render the portal into. // We do this _after_ getting the collection above so that the collection still has content in it from SSR // during the current render, before React has finished the client render. document.resetAfterSSR(); return collection; }, [ document ]); let getServerSnapshot = (0, $dGqE5$useCallback)(()=>{ document.isSSR = true; return document.getCollection(); }, [ document ]); let collection = $7135fc7d473fd974$var$useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); return { collection: collection, document: document }; } const $7135fc7d473fd974$var$SSRContext = /*#__PURE__*/ (0, $dGqE5$createContext)(null); const $7135fc7d473fd974$export$8c25dea96356a8b6 = /*#__PURE__*/ (0, $dGqE5$createContext)(null); function $7135fc7d473fd974$export$ad42d5efb4461b31(props, document) { let ctx = (0, $dGqE5$useContext)($7135fc7d473fd974$export$8c25dea96356a8b6); let doc = document !== null && document !== void 0 ? document : ctx; let children = $7135fc7d473fd974$export$901dbff4e54a6dd0(props); let wrappedChildren = (0, $dGqE5$useMemo)(()=>/*#__PURE__*/ (0, $dGqE5$react).createElement($7135fc7d473fd974$var$ShallowRenderContext.Provider, { value: true }, children), [ children ]); // During SSR, we render the content directly, and append nodes to the document during render. // The collection children return null so that nothing is actually rendered into the HTML. return (0, $dGqE5$useIsSSR)() ? /*#__PURE__*/ (0, $dGqE5$react).createElement($7135fc7d473fd974$var$SSRContext.Provider, { value: doc }, wrappedChildren) : /*#__PURE__*/ (0, $dGqE5$createPortal)(wrappedChildren, doc); } function $7135fc7d473fd974$export$813b5978dd974d8(props) { return /*#__PURE__*/ (0, $dGqE5$react).createElement((0, $dGqE5$react).Fragment, null, $7135fc7d473fd974$export$ad42d5efb4461b31(props)); } function $7135fc7d473fd974$export$aeba0b1fb3dcd8b8(type, props, ref) { let isShallow = (0, $dGqE5$useContext)($7135fc7d473fd974$var$ShallowRenderContext); var _useSSRCollectionNode; if (isShallow) // Elements cannot be re-parented, so the context will always be there. // eslint-disable-next-line react-hooks/rules-of-hooks return (_useSSRCollectionNode = $7135fc7d473fd974$export$e7c29ae2353b16ea(type, props, ref, "children" in props ? props.children : null)) !== null && _useSSRCollectionNode !== void 0 ? _useSSRCollectionNode : /*#__PURE__*/ (0, $dGqE5$react).createElement((0, $dGqE5$react).Fragment, null); return null; } function $7135fc7d473fd974$export$636783d3732b5559(props, ref, rendered) { // Return a callback ref that sets the props object on the fake DOM node. return (0, $dGqE5$useCallback)((element)=>{ element === null || element === void 0 ? void 0 : element.setProps(props, ref, rendered); }, [ props, ref, rendered ]); } function $7135fc7d473fd974$export$e7c29ae2353b16ea(Type, props, ref, rendered, children) { // During SSR, portals are not supported, so the collection children will be wrapped in an SSRContext. // Since SSR occurs only once, we assume that the elements are rendered in order and never re-render. // Therefore we can create elements in our collection document during render so that they are in the // collection by the time we need to use the collection to render to the real DOM. // After hydration, we switch to client rendering using the portal. let itemRef = $7135fc7d473fd974$export$636783d3732b5559(props, ref, rendered); let parentNode = (0, $dGqE5$useContext)($7135fc7d473fd974$var$SSRContext); if (parentNode) { // Guard against double rendering in strict mode. let element = parentNode.ownerDocument.nodesByProps.get(props); if (!element) { element = parentNode.ownerDocument.createElement(Type); element.setProps(props, ref, rendered); parentNode.appendChild(element); parentNode.ownerDocument.updateCollection(); parentNode.ownerDocument.nodesByProps.set(props, element); } return children ? /*#__PURE__*/ (0, $dGqE5$react).createElement($7135fc7d473fd974$var$SSRContext.Provider, { value: element }, children) : null; } // @ts-ignore return /*#__PURE__*/ (0, $dGqE5$react).createElement(Type, { ref: itemRef }, children); } function $7135fc7d473fd974$var$Section(props, ref) { let children = $7135fc7d473fd974$export$901dbff4e54a6dd0(props); return $7135fc7d473fd974$export$e7c29ae2353b16ea("section", props, ref, null, children); } const $7135fc7d473fd974$export$6e2c8f0811a474ce = /*#__PURE__*/ (0, $dGqE5$forwardRef)($7135fc7d473fd974$var$Section); const $7135fc7d473fd974$export$db36075d98ba73d3 = /*#__PURE__*/ (0, $dGqE5$createContext)(null); const $7135fc7d473fd974$export$4feb769f8ddf26c5 = /*#__PURE__*/ (0, $dGqE5$createContext)(null); function $7135fc7d473fd974$export$fb8073518f34e6ec(props) { let ctx = (0, $dGqE5$useContext)($7135fc7d473fd974$export$db36075d98ba73d3); props = (0, $dGqE5$mergeProps)(ctx, props); props.dependencies = ((ctx === null || ctx === void 0 ? void 0 : ctx.dependencies) || []).concat(props.dependencies); let renderer = typeof props.children === "function" ? props.children : null; return /*#__PURE__*/ (0, $dGqE5$react).createElement($7135fc7d473fd974$export$4feb769f8ddf26c5.Provider, { value: renderer }, $7135fc7d473fd974$export$901dbff4e54a6dd0(props)); } /* * Copyright 2022 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ const $64fa3d84918910a7$export$91172ebb93c441a2 = Symbol("callback"); const $64fa3d84918910a7$export$8e0ef2c5844bfb6b = Symbol("default"); function $64fa3d84918910a7$export$2881499e37b75b9a({ values: values, children: children }) { for (let [Context, value] of values)// @ts-ignore children = /*#__PURE__*/ (0, $dGqE5$react).createElement(Context.Provider, { value: value }, children); return children; } function $64fa3d84918910a7$export$4d86445c2cf5e3(props) { let { className: className, style: style, children: children, defaultClassName: defaultClassName, defaultChildren: defaultChildren, values: values } = props; return (0, $dGqE5$useMemo)(()=>{ let computedClassName; let computedStyle; let computedChildren; if (typeof className === "function") computedClassName = className(values); else computedClassName = className; if (typeof style === "function") computedStyle = style(values); else computedStyle = style; if (typeof children === "function") computedChildren = children(values); else if (children == null) computedChildren = defaultChildren; else computedChildren = children; return { className: computedClassName !== null && computedClassName !== void 0 ? computedClassName : defaultClassName, style: computedStyle, children: computedChildren, "data-rac": "" }; }, [ className, style, children, defaultClassName, defaultChildren, values ]); } function $64fa3d84918910a7$export$c245e6201fed2f75(// https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage value, wrap) { return (renderProps)=>wrap(typeof value === "function" ? value(renderProps) : value, renderProps); } function $64fa3d84918910a7$export$fabf2dc03a41866e(context, slot) { let ctx = (0, $dGqE5$useContext)(context); if (slot === null) // An explicit `null` slot means don't use context. return null; if (ctx && typeof ctx === "object" && "slots" in ctx && ctx.slots) { let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map((p)=>`"${p}"`)); if (!slot && !ctx.slots[$64fa3d84918910a7$export$8e0ef2c5844bfb6b]) throw new Error(`A slot prop is required. Valid slot names are ${availableSlots}.`); let slotKey = slot || $64fa3d84918910a7$export$8e0ef2c5844bfb6b; if (!ctx.slots[slotKey]) // @ts-ignore throw new Error(`Invalid slot "${slot}". Valid slot names are ${availableSlots}.`); return ctx.slots[slotKey]; } // @ts-ignore return ctx; } function $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, context) { let ctx = $64fa3d84918910a7$export$fabf2dc03a41866e(context, props.slot) || {}; // @ts-ignore - TS says "Type 'unique symbol' cannot be used as an index type." but not sure why. let { ref: contextRef, [$64fa3d84918910a7$export$91172ebb93c441a2]: callback, ...contextProps } = ctx; let mergedRef = (0, $dGqE5$useObjectRef)((0, $dGqE5$useMemo)(()=>(0, $dGqE5$mergeRefs)(ref, contextRef), [ ref, contextRef ])); let mergedProps = (0, $dGqE5$mergeProps1)(contextProps, props); // mergeProps does not merge `style`. Adding this there might be a breaking change. if ("style" in contextProps && contextProps.style && typeof contextProps.style === "object" && "style" in props && props.style && typeof props.style === "object") // @ts-ignore mergedProps.style = { ...contextProps.style, ...props.style }; // A parent component might need the props from a child, so call slot callback if needed. (0, $dGqE5$useEffect)(()=>{ if (callback) callback(props); }, [ callback, props ]); return [ mergedProps, mergedRef ]; } function $64fa3d84918910a7$export$9d4c57ee4c6ffdd8() { // Assume we do have the slot in the initial render. let [hasSlot, setHasSlot] = (0, $dGqE5$useState)(true); let hasRun = (0, $dGqE5$useRef)(false); // A callback ref which will run when the slotted element mounts. // This should happen before the useLayoutEffect below. let ref = (0, $dGqE5$useCallback)((el)=>{ hasRun.current = true; setHasSlot(!!el); }, []); // If the callback hasn't been called, then reset to false. (0, $dGqE5$useLayoutEffect)(()=>{ if (!hasRun.current) setHasSlot(false); }, []); return [ ref, hasSlot ]; } function $64fa3d84918910a7$export$6d3443f2c48bfc20(ref, isReady = true) { let [isEntering, setEntering] = (0, $dGqE5$useState)(true); $64fa3d84918910a7$var$useAnimation(ref, isEntering && isReady, (0, $dGqE5$useCallback)(()=>setEntering(false), [])); return isEntering && isReady; } function $64fa3d84918910a7$export$45fda7c47f93fd48(ref, isOpen) { // State to trigger a re-render after animation is complete, which causes the element to be removed from the DOM. // Ref to track the state we're in, so we don't immediately reset isExiting to true after the animation. let [isExiting, setExiting] = (0, $dGqE5$useState)(false); let [exitState, setExitState] = (0, $dGqE5$useState)("idle"); // If isOpen becomes false, set isExiting to true. if (!isOpen && ref.current && exitState === "idle") { isExiting = true; setExiting(true); setExitState("exiting"); } // If we exited, and the element has been removed, reset exit state to idle. if (!ref.current && exitState === "exited") setExitState("idle"); $64fa3d84918910a7$var$useAnimation(ref, isExiting, (0, $dGqE5$useCallback)(()=>{ setExitState("exited"); setExiting(false); }, [])); return isExiting; } function $64fa3d84918910a7$var$useAnimation(ref, isActive, onEnd) { let prevAnimation = (0, $dGqE5$useRef)(null); if (isActive && ref.current) // This is ok because we only read it in the layout effect below, immediately after the commit phase. // We could move this to another effect that runs every render, but this would be unnecessarily slow. // We only need the computed style right before the animation becomes active. // eslint-disable-next-line rulesdir/pure-render prevAnimation.current = window.getComputedStyle(ref.current).animation; (0, $dGqE5$useLayoutEffect)(()=>{ if (isActive && ref.current) { // Make sure there's actually an animation, and it wasn't there before we triggered the update. let computedStyle = window.getComputedStyle(ref.current); if (computedStyle.animationName && computedStyle.animationName !== "none" && computedStyle.animation !== prevAnimation.current) { let onAnimationEnd = (e)=>{ if (e.target === ref.current) { element.removeEventListener("animationend", onAnimationEnd); (0, $dGqE5$reactdom).flushSync(()=>{ onEnd(); }); } }; let element = ref.current; element.addEventListener("animationend", onAnimationEnd); return ()=>{ element.removeEventListener("animationend", onAnimationEnd); }; } else onEnd(); } }, [ ref, isActive, onEnd ]); } // React doesn't understand the <template> element, which doesn't have children like a normal element. // It will throw an error during hydration when it expects the firstChild to contain content rendered // on the server, when in reality, the browser will have placed this inside the `content` document fragment. // This monkey patches the firstChild property for our special hidden template elements to work around this error. // See https://github.com/facebook/react/issues/19932 if (typeof HTMLTemplateElement !== "undefined") { const getFirstChild = Object.getOwnPropertyDescriptor(Node.prototype, "firstChild").get; Object.defineProperty(HTMLTemplateElement.prototype, "firstChild", { configurable: true, enumerable: true, get: function() { if (this.dataset.reactAriaHidden) return this.content.firstChild; else return getFirstChild.call(this); } }); } const $64fa3d84918910a7$export$94b6d0abf7d33e8c = /*#__PURE__*/ (0, $dGqE5$createContext)(false); // Portal to nowhere const $64fa3d84918910a7$var$hiddenFragment = typeof DocumentFragment !== "undefined" ? new DocumentFragment() : null; function $64fa3d84918910a7$export$8dc98ba7eadeaa56(props) { let isHidden = (0, $dGqE5$useContext)($64fa3d84918910a7$export$94b6d0abf7d33e8c); let isSSR = (0, $dGqE5$useIsSSR)(); if (isHidden) // Don't hide again if we are already hidden. return /*#__PURE__*/ (0, $dGqE5$react).createElement((0, $dGqE5$react).Fragment, null, props.children); let children = /*#__PURE__*/ (0, $dGqE5$react).createElement($64fa3d84918910a7$export$94b6d0abf7d33e8c.Provider, { value: true }, props.children); // In SSR, portals are not supported by React. Instead, render into a <template> // element, which the browser will never display to the user. In addition, the // content is not part of the DOM tree, so it won't affect ids or other accessibility attributes. return isSSR ? /*#__PURE__*/ (0, $dGqE5$react).createElement("template", { "data-react-aria-hidden": true }, children) : /*#__PURE__*/ (0, $dGqE5$reactdom).createPortal(children, $64fa3d84918910a7$var$hiddenFragment); } function $64fa3d84918910a7$export$86427a43e3e48ebb(fn) { let Wrapper = (props, ref)=>{ let isHidden = (0, $dGqE5$useContext)($64fa3d84918910a7$export$94b6d0abf7d33e8c); if (isHidden) return null; return fn(props, ref); }; // @ts-ignore - for react dev tools Wrapper.displayName = fn.displayName || fn.name; return (0, $dGqE5$react).forwardRef(Wrapper); } function $64fa3d84918910a7$export$ef03459518577ad4(props) { const prefix = /^(data-.*)$/; let filteredProps = {}; for(const prop in props)if (!prefix.test(prop)) filteredProps[prop] = props[prop]; return filteredProps; } /* * Copyright 2022 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli