@depup/react-aria-components 1.20.0-depup.0 → 1.21.0-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NavigationTree/package.json +5 -0
- package/README.md +2 -2
- package/changes.json +1 -1
- package/dist/exports/Menu.cjs +1 -0
- package/dist/exports/Menu.cjs.map +1 -1
- package/dist/exports/Menu.js +2 -2
- package/dist/exports/Menu.js.map +1 -1
- package/dist/exports/Menu.mjs +2 -2
- package/dist/exports/Menu.mjs.map +1 -1
- package/dist/exports/NavigationTree.cjs +37 -0
- package/dist/exports/NavigationTree.cjs.map +1 -0
- package/dist/exports/NavigationTree.js +25 -0
- package/dist/exports/NavigationTree.js.map +1 -0
- package/dist/exports/NavigationTree.mjs +25 -0
- package/dist/exports/NavigationTree.mjs.map +1 -0
- package/dist/exports/index.cjs +13 -0
- package/dist/exports/index.cjs.map +1 -1
- package/dist/exports/index.js +6 -2
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/index.mjs +6 -2
- package/dist/exports/index.mjs.map +1 -1
- package/dist/private/Checkbox.cjs.map +1 -1
- package/dist/private/Checkbox.js.map +1 -1
- package/dist/private/Checkbox.mjs.map +1 -1
- package/dist/private/Dialog.cjs +6 -0
- package/dist/private/Dialog.cjs.map +1 -1
- package/dist/private/Dialog.js +6 -0
- package/dist/private/Dialog.js.map +1 -1
- package/dist/private/Dialog.mjs +6 -0
- package/dist/private/Dialog.mjs.map +1 -1
- package/dist/private/GridList.cjs.map +1 -1
- package/dist/private/GridList.js.map +1 -1
- package/dist/private/GridList.mjs.map +1 -1
- package/dist/private/ListBox.cjs.map +1 -1
- package/dist/private/ListBox.js.map +1 -1
- package/dist/private/ListBox.mjs.map +1 -1
- package/dist/private/Menu.cjs +55 -0
- package/dist/private/Menu.cjs.map +1 -1
- package/dist/private/Menu.js +56 -2
- package/dist/private/Menu.js.map +1 -1
- package/dist/private/Menu.mjs +56 -2
- package/dist/private/Menu.mjs.map +1 -1
- package/dist/private/NavigationTree.cjs +272 -0
- package/dist/private/NavigationTree.cjs.map +1 -0
- package/dist/private/NavigationTree.js +258 -0
- package/dist/private/NavigationTree.js.map +1 -0
- package/dist/private/NavigationTree.mjs +257 -0
- package/dist/private/NavigationTree.mjs.map +1 -0
- package/dist/private/RadioGroup.cjs.map +1 -1
- package/dist/private/RadioGroup.js.map +1 -1
- package/dist/private/RadioGroup.mjs.map +1 -1
- package/dist/private/Switch.cjs +8 -2
- package/dist/private/Switch.cjs.map +1 -1
- package/dist/private/Switch.js +9 -3
- package/dist/private/Switch.js.map +1 -1
- package/dist/private/Switch.mjs +9 -3
- package/dist/private/Switch.mjs.map +1 -1
- package/dist/private/Table.cjs.map +1 -1
- package/dist/private/Table.js.map +1 -1
- package/dist/private/Table.mjs.map +1 -1
- package/dist/private/Text.cjs +3 -1
- package/dist/private/Text.cjs.map +1 -1
- package/dist/private/Text.js +4 -2
- package/dist/private/Text.js.map +1 -1
- package/dist/private/Text.mjs +4 -2
- package/dist/private/Text.mjs.map +1 -1
- package/dist/private/TokenField.cjs +30 -2
- package/dist/private/TokenField.cjs.map +1 -1
- package/dist/private/TokenField.js +30 -2
- package/dist/private/TokenField.js.map +1 -1
- package/dist/private/TokenField.mjs +30 -2
- package/dist/private/TokenField.mjs.map +1 -1
- package/dist/private/Tree.cjs.map +1 -1
- package/dist/private/Tree.js.map +1 -1
- package/dist/private/Tree.mjs.map +1 -1
- package/dist/private/TreeDropTargetDelegate.cjs +11 -6
- package/dist/private/TreeDropTargetDelegate.cjs.map +1 -1
- package/dist/private/TreeDropTargetDelegate.js +11 -6
- package/dist/private/TreeDropTargetDelegate.js.map +1 -1
- package/dist/private/TreeDropTargetDelegate.mjs +11 -6
- package/dist/private/TreeDropTargetDelegate.mjs.map +1 -1
- package/dist/types/exports/Menu.d.ts +2 -2
- package/dist/types/exports/NavigationTree.d.ts +8 -0
- package/dist/types/exports/index.d.ts +7 -3
- package/dist/types/src/Breadcrumbs.d.ts +2 -2
- package/dist/types/src/Button.d.ts +1 -1
- package/dist/types/src/Calendar.d.ts +6 -6
- package/dist/types/src/Checkbox.d.ts +8 -8
- package/dist/types/src/Collection.d.ts +1 -1
- package/dist/types/src/ComboBox.d.ts +2 -2
- package/dist/types/src/DateField.d.ts +4 -4
- package/dist/types/src/DatePicker.d.ts +2 -2
- package/dist/types/src/Dialog.d.ts +2 -2
- package/dist/types/src/Disclosure.d.ts +2 -2
- package/dist/types/src/GridList.d.ts +6 -6
- package/dist/types/src/Group.d.ts +1 -1
- package/dist/types/src/Header.d.ts +1 -1
- package/dist/types/src/Input.d.ts +1 -1
- package/dist/types/src/Label.d.ts +1 -1
- package/dist/types/src/Link.d.ts +1 -1
- package/dist/types/src/ListBox.d.ts +5 -5
- package/dist/types/src/Menu.d.ts +25 -6
- package/dist/types/src/Meter.d.ts +1 -1
- package/dist/types/src/Modal.d.ts +2 -2
- package/dist/types/src/NavigationTree.d.ts +80 -0
- package/dist/types/src/NumberField.d.ts +1 -1
- package/dist/types/src/OverlayArrow.d.ts +1 -1
- package/dist/types/src/Popover.d.ts +1 -1
- package/dist/types/src/RadioGroup.d.ts +8 -8
- package/dist/types/src/SearchField.d.ts +1 -1
- package/dist/types/src/Select.d.ts +2 -2
- package/dist/types/src/Separator.d.ts +1 -1
- package/dist/types/src/Slider.d.ts +5 -5
- package/dist/types/src/Switch.d.ts +7 -7
- package/dist/types/src/Table.d.ts +8 -8
- package/dist/types/src/Tabs.d.ts +5 -5
- package/dist/types/src/TagGroup.d.ts +3 -3
- package/dist/types/src/Text.d.ts +1 -1
- package/dist/types/src/TextField.d.ts +1 -1
- package/dist/types/src/Toast.d.ts +3 -3
- package/dist/types/src/ToggleButton.d.ts +1 -1
- package/dist/types/src/ToggleButtonGroup.d.ts +1 -1
- package/dist/types/src/TokenField.d.ts +2 -2
- package/dist/types/src/Toolbar.d.ts +1 -1
- package/dist/types/src/Tooltip.d.ts +1 -1
- package/dist/types/src/Tree.d.ts +6 -6
- package/package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BAAoB,IAAI;YAEjE,IAAI,qBAAqB,QAAQ;gBAC/B,IAAI,IAAI,CAAC,SAAS,KAAK,OACrB,4DAA4D;gBAC5D;oBAAA,IAAI,qBAAqB,iBAAiB,MAAM,GAAG,GAAG;wBACpD,gBAAgB,oBAAoB,GAAG,qBAAqB;wBAC5D,gBAAgB,WAAW,GAAG;oBAChC;gBAAA,OAEA,2DAA2D;gBAC3D,IAAI,qBAAqB,GAAG;oBAC1B,gBAAgB,oBAAoB,GAAG,qBAAqB;oBAC5D,gBAAgB,WAAW,GAAG;gBAChC;YAEJ,OAAO,IAAI,qBAAqB,SAAS;gBACvC,IAAI,IAAI,CAAC,SAAS,KAAK,OACrB,4DAA4D;gBAC5D;oBAAA,IAAI,qBAAqB,GAAG;wBAC1B,gBAAgB,oBAAoB,GAAG,qBAAqB;wBAC5D,gBAAgB,WAAW,GAAG;oBAChC;gBAAA,OAEA,6DAA6D;gBAC7D,IAAI,qBAAqB,iBAAiB,MAAM,GAAG,GAAG;oBACpD,gBAAgB,oBAAoB,GAAG,qBAAqB;oBAC5D,gBAAgB,WAAW,GAAG;gBAChC;YAEJ;YAEA,uEAAuE;YACvE,SAAS,UAAU,GAAG;QACxB;QAEA,IAAI,cAAc,KAAK,GAAG,CACxB,GACA,KAAK,GAAG,CAAC,gBAAgB,oBAAoB,IAAI,GAAG,iBAAiB,MAAM,GAAG;QAEhF,OAAO,gBAAgB,CAAC,YAAY;IACtC;;aA5TQ,WAAsC;aACtC,QAA6B;aAC7B,YAAuB;aACvB,kBAAmC;YACzC,OAAO;YACP,OAAO;YACP,YAAY;YACZ,YAAY;YACZ,iBAAiB;QACnB;;AAoTF","sources":["packages/react-aria-components/src/TreeDropTargetDelegate.ts"],"sourcesContent":["import {\n Direction,\n DropTarget,\n DropTargetDelegate,\n ItemDropTarget,\n Key,\n Node,\n RootDropTarget\n} from '@react-types/shared';\n\ninterface TreeCollection<T> extends Iterable<Node<T>> {\n getItem(key: Key): Node<T> | null;\n getChildren?(key: Key): Iterable<Node<T>>;\n getKeyAfter(key: Key): Key | null;\n getKeyBefore(key: Key): Key | null;\n}\n\ninterface TreeState<T> {\n collection: TreeCollection<T>;\n expandedKeys: Set<Key>;\n}\n\ninterface PointerTracking {\n lastY: number;\n lastX: number;\n yDirection: 'up' | 'down' | null;\n xDirection: 'left' | 'right' | null;\n boundaryContext: {\n parentKey: Key;\n lastSwitchY: number;\n lastSwitchX: number;\n preferredTargetIndex?: number;\n } | null;\n}\n\nconst X_SWITCH_THRESHOLD = 10;\nconst Y_SWITCH_THRESHOLD = 5;\nexport class TreeDropTargetDelegate<T> {\n private delegate: DropTargetDelegate | null = null;\n private state: TreeState<T> | null = null;\n private direction: Direction = 'ltr';\n private pointerTracking: PointerTracking = {\n lastY: 0,\n lastX: 0,\n yDirection: null,\n xDirection: null,\n boundaryContext: null\n };\n\n setup(delegate: DropTargetDelegate, state: TreeState<T>, direction: Direction): void {\n this.delegate = delegate;\n this.state = state;\n this.direction = direction;\n }\n\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean\n ): DropTarget | null {\n let baseTarget = this.delegate!.getDropTargetFromPoint(x, y, isValidDropTarget);\n if (!baseTarget || baseTarget.type === 'root') {\n return baseTarget;\n }\n\n return this.resolveDropTarget(baseTarget, x, y, isValidDropTarget);\n }\n\n private resolveDropTarget(\n target: ItemDropTarget,\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean\n ): RootDropTarget | ItemDropTarget | null {\n let tracking = this.pointerTracking;\n\n // Calculate movement directions\n let deltaY = y - tracking.lastY;\n let deltaX = x - tracking.lastX;\n let currentYMovement: 'up' | 'down' | null = tracking.yDirection;\n let currentXMovement: 'left' | 'right' | null = tracking.xDirection;\n\n if (Math.abs(deltaY) > Y_SWITCH_THRESHOLD) {\n currentYMovement = deltaY > 0 ? 'down' : 'up';\n tracking.yDirection = currentYMovement;\n tracking.lastY = y;\n }\n\n if (Math.abs(deltaX) > X_SWITCH_THRESHOLD) {\n currentXMovement = deltaX > 0 ? 'right' : 'left';\n tracking.xDirection = currentXMovement;\n tracking.lastX = x;\n }\n\n // Normalize to 'after'\n if (target.dropPosition === 'before') {\n let keyBefore = this.state!.collection.getKeyBefore(target.key);\n\n while (keyBefore != null) {\n let node = this.state!.collection.getItem(keyBefore);\n if (node?.type === 'item') {\n break;\n }\n keyBefore = node?.parentKey ?? null;\n }\n if (keyBefore != null) {\n let convertedTarget = {\n type: 'item',\n key: keyBefore,\n dropPosition: 'after'\n } as const;\n\n if (isValidDropTarget(convertedTarget)) {\n target = convertedTarget;\n }\n }\n }\n\n let potentialTargets = this.getPotentialTargets(target, isValidDropTarget);\n\n if (potentialTargets.length === 0) {\n return {type: 'root'};\n }\n\n let resolvedItemTarget: ItemDropTarget;\n if (potentialTargets.length > 1) {\n resolvedItemTarget = this.selectTarget(\n potentialTargets,\n target,\n x,\n y,\n currentYMovement,\n currentXMovement\n );\n } else {\n resolvedItemTarget = potentialTargets[0];\n // Reset boundary context since we're not in a boundary case\n tracking.boundaryContext = null;\n }\n\n return resolvedItemTarget;\n }\n\n // Returns potential targets for an ambiguous drop position (e.g. after the last child of a parent, or after the parent itself)\n // Ordered by level, from innermost to outermost.\n private getPotentialTargets(\n originalTarget: ItemDropTarget,\n isValidDropTarget: (target: DropTarget) => boolean\n ): ItemDropTarget[] {\n if (originalTarget.dropPosition === 'on') {\n return [originalTarget];\n }\n\n let target = originalTarget;\n let collection = this.state!.collection;\n\n let currentItem = collection.getItem(target.key);\n while (currentItem && currentItem?.type !== 'item' && currentItem.nextKey != null) {\n target.key = currentItem.nextKey;\n currentItem = collection.getItem(currentItem.nextKey);\n }\n\n let potentialTargets = [target];\n\n // If target has children and is expanded, use \"before first child\"\n if (\n currentItem &&\n currentItem.hasChildNodes &&\n this.state!.expandedKeys.has(currentItem.key) &&\n collection.getChildren &&\n target.dropPosition === 'after'\n ) {\n // Find the first item child (traverse keys directly instead of using collection.getChildren, which may only include cells).\n let firstChildItemNode =\n currentItem.firstChildKey != null ? collection.getItem(currentItem.firstChildKey) : null;\n while (firstChildItemNode && firstChildItemNode.type !== 'item') {\n firstChildItemNode =\n firstChildItemNode.nextKey != null\n ? collection.getItem(firstChildItemNode.nextKey)\n : null;\n }\n\n if (firstChildItemNode?.type === 'item') {\n const beforeFirstChildTarget = {\n type: 'item',\n key: firstChildItemNode.key,\n dropPosition: 'before'\n } as const;\n\n if (isValidDropTarget(beforeFirstChildTarget)) {\n return [beforeFirstChildTarget];\n } else {\n return [];\n }\n }\n }\n\n if (currentItem?.nextKey != null) {\n return [originalTarget];\n }\n\n // Walk up the parent chain to find ancestors that are the last child at their level\n let parentKey = currentItem?.parentKey;\n let ancestorTargets: ItemDropTarget[] = [];\n\n while (parentKey != null) {\n let parentItem = collection.getItem(parentKey);\n let nextItem = parentItem?.nextKey != null ? collection.getItem(parentItem.nextKey) : null;\n let isLastChildAtLevel = !nextItem || nextItem.parentKey !== parentKey;\n\n if (isLastChildAtLevel) {\n let afterParentTarget = {\n type: 'item',\n key: parentKey,\n dropPosition: 'after'\n } as const;\n\n if (isValidDropTarget(afterParentTarget)) {\n ancestorTargets.push(afterParentTarget);\n }\n if (nextItem) {\n break;\n }\n }\n\n parentKey = parentItem?.parentKey;\n }\n\n if (ancestorTargets.length > 0) {\n potentialTargets.push(...ancestorTargets);\n }\n\n // Handle converting \"after\" to \"before next\" for non-ambiguous cases\n if (potentialTargets.length === 1) {\n let nextKey = collection.getKeyAfter(target.key);\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (\n nextKey != null &&\n nextNode &&\n currentItem &&\n nextNode.level != null &&\n currentItem.level != null &&\n nextNode.level > currentItem.level\n ) {\n let beforeTarget = {\n type: 'item',\n key: nextKey,\n dropPosition: 'before'\n } as const;\n if (isValidDropTarget(beforeTarget)) {\n return [beforeTarget];\n }\n }\n }\n\n return potentialTargets.filter(isValidDropTarget);\n }\n\n private selectTarget(\n potentialTargets: ItemDropTarget[],\n originalTarget: ItemDropTarget,\n x: number,\n y: number,\n currentYMovement: 'up' | 'down' | null,\n currentXMovement: 'left' | 'right' | null\n ): ItemDropTarget {\n if (potentialTargets.length < 2) {\n return potentialTargets[0];\n }\n\n let tracking = this.pointerTracking;\n let currentItem = this.state!.collection.getItem(originalTarget.key);\n let parentKey = currentItem?.parentKey;\n\n if (parentKey == null) {\n return potentialTargets[0];\n }\n\n // More than 1 potential target - use Y for initial target, then X for switching levels\n // Initialize boundary context if needed\n if (!tracking.boundaryContext || tracking.boundaryContext.parentKey !== parentKey) {\n // If entering from below, start with outer-most\n let initialTargetIndex = tracking.yDirection === 'up' ? potentialTargets.length - 1 : 0;\n tracking.boundaryContext = {\n parentKey,\n preferredTargetIndex: initialTargetIndex,\n lastSwitchY: y,\n lastSwitchX: x\n };\n }\n\n let boundaryContext = tracking.boundaryContext;\n let distanceFromLastXSwitch = Math.abs(x - boundaryContext.lastSwitchX);\n let distanceFromLastYSwitch = Math.abs(y - boundaryContext.lastSwitchY);\n\n // Switch between targets based on Y movement\n if (distanceFromLastYSwitch > Y_SWITCH_THRESHOLD && currentYMovement) {\n let currentIndex = boundaryContext.preferredTargetIndex || 0;\n\n if (currentYMovement === 'down' && currentIndex === 0) {\n // Moving down from inner-most, switch to outer-most\n boundaryContext.preferredTargetIndex = potentialTargets.length - 1;\n } else if (currentYMovement === 'up' && currentIndex === potentialTargets.length - 1) {\n // Moving up from outer-most, switch to inner-most\n boundaryContext.preferredTargetIndex = 0;\n }\n\n // Reset x tracking so that moving diagonally doesn't cause flickering.\n tracking.xDirection = null;\n }\n\n // X movement controls level selection\n if (distanceFromLastXSwitch > X_SWITCH_THRESHOLD && currentXMovement) {\n let currentTargetIndex = boundaryContext.preferredTargetIndex || 0;\n\n if (currentXMovement === 'left') {\n if (this.direction === 'ltr') {\n // LTR: left = move to higher level in tree (increase index)\n if (currentTargetIndex < potentialTargets.length - 1) {\n boundaryContext.preferredTargetIndex = currentTargetIndex + 1;\n boundaryContext.lastSwitchX = x;\n }\n } else {\n // RTL: left = move to lower level in tree (decrease index)\n if (currentTargetIndex > 0) {\n boundaryContext.preferredTargetIndex = currentTargetIndex - 1;\n boundaryContext.lastSwitchX = x;\n }\n }\n } else if (currentXMovement === 'right') {\n if (this.direction === 'ltr') {\n // LTR: right = move to lower level in tree (decrease index)\n if (currentTargetIndex > 0) {\n boundaryContext.preferredTargetIndex = currentTargetIndex - 1;\n boundaryContext.lastSwitchX = x;\n }\n } else {\n // RTL: right = move to higher level in tree (increase index)\n if (currentTargetIndex < potentialTargets.length - 1) {\n boundaryContext.preferredTargetIndex = currentTargetIndex + 1;\n boundaryContext.lastSwitchX = x;\n }\n }\n }\n\n // Reset y tracking so that moving diagonally doesn't cause flickering.\n tracking.yDirection = null;\n }\n\n let targetIndex = Math.max(\n 0,\n Math.min(boundaryContext.preferredTargetIndex || 0, potentialTargets.length - 1)\n );\n return potentialTargets[targetIndex];\n }\n}\n"],"names":[],"version":3,"file":"TreeDropTargetDelegate.mjs.map"}
|
|
1
|
+
{"mappings":"AAmCA,MAAM,2CAAqB;AAC3B,MAAM,2CAAqB;AACpB,MAAM;IAYX,MAAM,QAA4B,EAAE,KAAmB,EAAE,SAAoB,EAAQ;QACnF,IAAI,CAAC,QAAQ,GAAG;QAChB,IAAI,CAAC,KAAK,GAAG;QACb,IAAI,CAAC,SAAS,GAAG;IACnB;IAEA,uBACE,CAAS,EACT,CAAS,EACT,iBAAkD,EAC/B;QACnB,IAAI,aAAa,IAAI,CAAC,QAAQ,CAAE,sBAAsB,CAAC,GAAG,GAAG;QAC7D,IAAI,CAAC,cAAc,WAAW,IAAI,KAAK,QACrC,OAAO;QAGT,OAAO,IAAI,CAAC,iBAAiB,CAAC,YAAY,GAAG,GAAG;IAClD;IAEQ,kBACN,MAAsB,EACtB,CAAS,EACT,CAAS,EACT,iBAAkD,EACV;QACxC,IAAI,WAAW,IAAI,CAAC,eAAe;QAEnC,gCAAgC;QAChC,IAAI,SAAS,IAAI,SAAS,KAAK;Q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AA,OAEA,6DAA6D;gBAC7D,IAAI,qBAAqB,iBAAiB,MAAM,GAAG,GAAG;oBACpD,gBAAgB,oBAAoB,GAAG,qBAAqB;oBAC5D,gBAAgB,WAAW,GAAG;gBAChC;YAEJ;YAEA,uEAAuE;YACvE,SAAS,UAAU,GAAG;QACxB;QAEA,IAAI,cAAc,KAAK,GAAG,CACxB,GACA,KAAK,GAAG,CAAC,gBAAgB,oBAAoB,IAAI,GAAG,iBAAiB,MAAM,GAAG;QAEhF,OAAO,gBAAgB,CAAC,YAAY;IACtC;;aAjUQ,WAAsC;aACtC,QAA6B;aAC7B,YAAuB;aACvB,kBAAmC;YACzC,OAAO;YACP,OAAO;YACP,YAAY;YACZ,YAAY;YACZ,iBAAiB;QACnB;;AAyTF","sources":["packages/react-aria-components/src/TreeDropTargetDelegate.ts"],"sourcesContent":["import {\n Direction,\n DropTarget,\n DropTargetDelegate,\n ItemDropTarget,\n Key,\n Node,\n RootDropTarget\n} from '@react-types/shared';\n\ninterface TreeCollection<T> extends Iterable<Node<T>> {\n getItem(key: Key): Node<T> | null;\n getChildren?(key: Key): Iterable<Node<T>>;\n getKeyAfter(key: Key): Key | null;\n getKeyBefore(key: Key): Key | null;\n}\n\ninterface TreeState<T> {\n collection: TreeCollection<T>;\n expandedKeys: Set<Key>;\n}\n\ninterface PointerTracking {\n lastY: number;\n lastX: number;\n yDirection: 'up' | 'down' | null;\n xDirection: 'left' | 'right' | null;\n boundaryContext: {\n parentKey: Key;\n lastSwitchY: number;\n lastSwitchX: number;\n preferredTargetIndex?: number;\n } | null;\n}\n\nconst X_SWITCH_THRESHOLD = 10;\nconst Y_SWITCH_THRESHOLD = 5;\nexport class TreeDropTargetDelegate<T> {\n private delegate: DropTargetDelegate | null = null;\n private state: TreeState<T> | null = null;\n private direction: Direction = 'ltr';\n private pointerTracking: PointerTracking = {\n lastY: 0,\n lastX: 0,\n yDirection: null,\n xDirection: null,\n boundaryContext: null\n };\n\n setup(delegate: DropTargetDelegate, state: TreeState<T>, direction: Direction): void {\n this.delegate = delegate;\n this.state = state;\n this.direction = direction;\n }\n\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean\n ): DropTarget | null {\n let baseTarget = this.delegate!.getDropTargetFromPoint(x, y, isValidDropTarget);\n if (!baseTarget || baseTarget.type === 'root') {\n return baseTarget;\n }\n\n return this.resolveDropTarget(baseTarget, x, y, isValidDropTarget);\n }\n\n private resolveDropTarget(\n target: ItemDropTarget,\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean\n ): RootDropTarget | ItemDropTarget | null {\n let tracking = this.pointerTracking;\n\n // Calculate movement directions\n let deltaY = y - tracking.lastY;\n let deltaX = x - tracking.lastX;\n let currentYMovement: 'up' | 'down' | null = tracking.yDirection;\n let currentXMovement: 'left' | 'right' | null = tracking.xDirection;\n\n if (Math.abs(deltaY) > Y_SWITCH_THRESHOLD) {\n currentYMovement = deltaY > 0 ? 'down' : 'up';\n tracking.yDirection = currentYMovement;\n tracking.lastY = y;\n }\n\n if (Math.abs(deltaX) > X_SWITCH_THRESHOLD) {\n currentXMovement = deltaX > 0 ? 'right' : 'left';\n tracking.xDirection = currentXMovement;\n tracking.lastX = x;\n }\n\n // Normalize to 'after'\n if (target.dropPosition === 'before') {\n let keyBefore = this.state!.collection.getKeyBefore(target.key);\n\n while (keyBefore != null) {\n let node = this.state!.collection.getItem(keyBefore);\n if (node?.type === 'item') {\n break;\n }\n keyBefore = node?.parentKey ?? null;\n }\n if (keyBefore != null) {\n let convertedTarget = {\n type: 'item',\n key: keyBefore,\n dropPosition: 'after'\n } as const;\n\n if (isValidDropTarget(convertedTarget)) {\n target = convertedTarget;\n }\n }\n }\n\n let potentialTargets = this.getPotentialTargets(target, isValidDropTarget);\n\n if (potentialTargets.length === 0) {\n return {type: 'root'};\n }\n\n let resolvedItemTarget: ItemDropTarget;\n if (potentialTargets.length > 1) {\n resolvedItemTarget = this.selectTarget(\n potentialTargets,\n target,\n x,\n y,\n currentYMovement,\n currentXMovement\n );\n } else {\n resolvedItemTarget = potentialTargets[0];\n // Reset boundary context since we're not in a boundary case\n tracking.boundaryContext = null;\n }\n\n return resolvedItemTarget;\n }\n\n // Returns potential targets for an ambiguous drop position (e.g. after the last child of a parent, or after the parent itself)\n // Ordered by level, from innermost to outermost.\n private getPotentialTargets(\n originalTarget: ItemDropTarget,\n isValidDropTarget: (target: DropTarget) => boolean\n ): ItemDropTarget[] {\n if (originalTarget.dropPosition === 'on') {\n return [originalTarget];\n }\n\n let target = originalTarget;\n let collection = this.state!.collection;\n\n let currentItem = collection.getItem(target.key);\n while (currentItem && currentItem?.type !== 'item' && currentItem.nextKey != null) {\n target.key = currentItem.nextKey;\n currentItem = collection.getItem(currentItem.nextKey);\n }\n\n let potentialTargets = [target];\n\n // If target has children and is expanded, use \"before first child\"\n if (\n currentItem &&\n currentItem.hasChildNodes &&\n this.state!.expandedKeys.has(currentItem.key) &&\n collection.getChildren &&\n target.dropPosition === 'after'\n ) {\n // Find the first item child (traverse keys directly instead of using collection.getChildren, which may only include cells).\n let firstChildItemNode =\n currentItem.firstChildKey != null ? collection.getItem(currentItem.firstChildKey) : null;\n while (firstChildItemNode && firstChildItemNode.type !== 'item') {\n firstChildItemNode =\n firstChildItemNode.nextKey != null\n ? collection.getItem(firstChildItemNode.nextKey)\n : null;\n }\n\n if (firstChildItemNode?.type === 'item') {\n const beforeFirstChildTarget = {\n type: 'item',\n key: firstChildItemNode.key,\n dropPosition: 'before'\n } as const;\n\n if (isValidDropTarget(beforeFirstChildTarget)) {\n return [beforeFirstChildTarget];\n } else {\n return [];\n }\n }\n }\n\n if (currentItem?.nextKey != null) {\n return [originalTarget];\n }\n\n // Walk up the parent chain to find ancestors that are the last child at their level\n let parentKey = currentItem?.parentKey;\n let ancestorTargets: ItemDropTarget[] = [];\n\n while (parentKey != null) {\n let parentItem = collection.getItem(parentKey);\n let nextItem = parentItem?.nextKey != null ? collection.getItem(parentItem.nextKey) : null;\n let isLastChildAtLevel = !nextItem || nextItem.parentKey !== parentKey;\n\n if (isLastChildAtLevel) {\n // Only items can be drop targets. Ancestors such as a Table's <TableBody> or a\n // <TreeSection> are part of the collection, but their keys are generated rather than\n // provided by the user, so dropping \"after\" them is not something the user can handle.\n if (parentItem?.type === 'item') {\n let afterParentTarget = {\n type: 'item',\n key: parentKey,\n dropPosition: 'after'\n } as const;\n\n if (isValidDropTarget(afterParentTarget)) {\n ancestorTargets.push(afterParentTarget);\n }\n }\n if (nextItem) {\n break;\n }\n }\n\n parentKey = parentItem?.parentKey;\n }\n\n if (ancestorTargets.length > 0) {\n potentialTargets.push(...ancestorTargets);\n }\n\n // Handle converting \"after\" to \"before next\" for non-ambiguous cases\n if (potentialTargets.length === 1) {\n let nextKey = collection.getKeyAfter(target.key);\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (\n nextKey != null &&\n nextNode &&\n currentItem &&\n nextNode.level != null &&\n currentItem.level != null &&\n nextNode.level > currentItem.level\n ) {\n let beforeTarget = {\n type: 'item',\n key: nextKey,\n dropPosition: 'before'\n } as const;\n if (isValidDropTarget(beforeTarget)) {\n return [beforeTarget];\n }\n }\n }\n\n return potentialTargets.filter(isValidDropTarget);\n }\n\n private selectTarget(\n potentialTargets: ItemDropTarget[],\n originalTarget: ItemDropTarget,\n x: number,\n y: number,\n currentYMovement: 'up' | 'down' | null,\n currentXMovement: 'left' | 'right' | null\n ): ItemDropTarget {\n if (potentialTargets.length < 2) {\n return potentialTargets[0];\n }\n\n let tracking = this.pointerTracking;\n let currentItem = this.state!.collection.getItem(originalTarget.key);\n let parentKey = currentItem?.parentKey;\n\n if (parentKey == null) {\n return potentialTargets[0];\n }\n\n // More than 1 potential target - use Y for initial target, then X for switching levels\n // Initialize boundary context if needed\n if (!tracking.boundaryContext || tracking.boundaryContext.parentKey !== parentKey) {\n // If entering from below, start with outer-most\n let initialTargetIndex = tracking.yDirection === 'up' ? potentialTargets.length - 1 : 0;\n tracking.boundaryContext = {\n parentKey,\n preferredTargetIndex: initialTargetIndex,\n lastSwitchY: y,\n lastSwitchX: x\n };\n }\n\n let boundaryContext = tracking.boundaryContext;\n let distanceFromLastXSwitch = Math.abs(x - boundaryContext.lastSwitchX);\n let distanceFromLastYSwitch = Math.abs(y - boundaryContext.lastSwitchY);\n\n // Switch between targets based on Y movement\n if (distanceFromLastYSwitch > Y_SWITCH_THRESHOLD && currentYMovement) {\n let currentIndex = boundaryContext.preferredTargetIndex || 0;\n\n if (currentYMovement === 'down' && currentIndex === 0) {\n // Moving down from inner-most, switch to outer-most\n boundaryContext.preferredTargetIndex = potentialTargets.length - 1;\n } else if (currentYMovement === 'up' && currentIndex === potentialTargets.length - 1) {\n // Moving up from outer-most, switch to inner-most\n boundaryContext.preferredTargetIndex = 0;\n }\n\n // Reset x tracking so that moving diagonally doesn't cause flickering.\n tracking.xDirection = null;\n }\n\n // X movement controls level selection\n if (distanceFromLastXSwitch > X_SWITCH_THRESHOLD && currentXMovement) {\n let currentTargetIndex = boundaryContext.preferredTargetIndex || 0;\n\n if (currentXMovement === 'left') {\n if (this.direction === 'ltr') {\n // LTR: left = move to higher level in tree (increase index)\n if (currentTargetIndex < potentialTargets.length - 1) {\n boundaryContext.preferredTargetIndex = currentTargetIndex + 1;\n boundaryContext.lastSwitchX = x;\n }\n } else {\n // RTL: left = move to lower level in tree (decrease index)\n if (currentTargetIndex > 0) {\n boundaryContext.preferredTargetIndex = currentTargetIndex - 1;\n boundaryContext.lastSwitchX = x;\n }\n }\n } else if (currentXMovement === 'right') {\n if (this.direction === 'ltr') {\n // LTR: right = move to lower level in tree (decrease index)\n if (currentTargetIndex > 0) {\n boundaryContext.preferredTargetIndex = currentTargetIndex - 1;\n boundaryContext.lastSwitchX = x;\n }\n } else {\n // RTL: right = move to higher level in tree (increase index)\n if (currentTargetIndex < potentialTargets.length - 1) {\n boundaryContext.preferredTargetIndex = currentTargetIndex + 1;\n boundaryContext.lastSwitchX = x;\n }\n }\n }\n\n // Reset y tracking so that moving diagonally doesn't cause flickering.\n tracking.yDirection = null;\n }\n\n let targetIndex = Math.max(\n 0,\n Math.min(boundaryContext.preferredTargetIndex || 0, potentialTargets.length - 1)\n );\n return potentialTargets[targetIndex];\n }\n}\n"],"names":[],"version":3,"file":"TreeDropTargetDelegate.mjs.map"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'client-only';
|
|
2
|
-
export { Menu, MenuItem, MenuTrigger, MenuSection, MenuContext, MenuStateContext, RootMenuTriggerStateContext, SubmenuTrigger } from '../src/Menu';
|
|
2
|
+
export { Menu, MenuItem, MenuLoadMoreItem, MenuTrigger, MenuSection, MenuContext, MenuStateContext, RootMenuTriggerStateContext, SubmenuTrigger } from '../src/Menu';
|
|
3
3
|
export { Collection, type CollectionProps } from 'react-aria/Collection';
|
|
4
|
-
export type { MenuProps, MenuItemProps, MenuItemRenderProps, MenuTriggerProps, SubmenuTriggerProps, MenuSectionProps } from '../src/Menu';
|
|
4
|
+
export type { MenuProps, MenuItemProps, MenuItemRenderProps, MenuLoadMoreItemProps, MenuTriggerProps, SubmenuTriggerProps, MenuSectionProps } from '../src/Menu';
|
|
5
5
|
export type { Key, Selection, SelectionMode } from '@react-types/shared';
|
|
6
6
|
export type { ListState } from 'react-stately/useListState';
|
|
7
7
|
export type { RootMenuTriggerState } from 'react-stately/useMenuTriggerState';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import 'client-only';
|
|
2
|
+
export { NavigationTree, NavigationTreeItem, NavigationTreeItemContent, NavigationTreeSection, NavigationTreeHeader, NavigationTreeContext } from '../src/NavigationTree';
|
|
3
|
+
export type { NavigationTreeProps, NavigationTreeRenderProps, NavigationTreeItemProps, NavigationTreeItemRenderProps, NavigationTreeItemContentProps, NavigationTreeItemContentRenderProps, NavigationTreeSectionProps, NavigationTreeHeaderProps } from '../src/NavigationTree';
|
|
4
|
+
export type { Key } from '@react-types/shared';
|
|
5
|
+
export { Button } from '../src/Button';
|
|
6
|
+
export type { ButtonProps, ButtonRenderProps } from '../src/Button';
|
|
7
|
+
export { Link } from '../src/Link';
|
|
8
|
+
export type { LinkProps, LinkRenderProps } from '../src/Link';
|
|
@@ -35,7 +35,7 @@ export { Label, LabelContext } from '../src/Label';
|
|
|
35
35
|
export { Link, LinkContext } from '../src/Link';
|
|
36
36
|
export { PreviewTrigger } from '../src/PreviewTrigger';
|
|
37
37
|
export { ListBoxLoadMoreItem, ListBox, ListBoxItem, ListBoxSection, ListBoxContext, ListStateContext } from '../src/ListBox';
|
|
38
|
-
export { Menu, MenuItem, MenuTrigger, MenuSection, MenuContext, MenuStateContext, RootMenuTriggerStateContext, SubmenuTrigger } from '../src/Menu';
|
|
38
|
+
export { Menu, MenuItem, MenuLoadMoreItem, MenuTrigger, MenuSection, MenuContext, MenuStateContext, RootMenuTriggerStateContext, SubmenuTrigger } from '../src/Menu';
|
|
39
39
|
export { Meter, MeterContext } from '../src/Meter';
|
|
40
40
|
export { Modal, ModalOverlay, ModalContext } from '../src/Modal';
|
|
41
41
|
export { NumberField, NumberFieldContext, NumberFieldStateContext } from '../src/NumberField';
|
|
@@ -64,6 +64,7 @@ export { ToggleButton, ToggleButtonContext } from '../src/ToggleButton';
|
|
|
64
64
|
export { ToggleButtonGroup, ToggleButtonGroupContext, ToggleGroupStateContext } from '../src/ToggleButtonGroup';
|
|
65
65
|
export { Toolbar, ToolbarContext } from '../src/Toolbar';
|
|
66
66
|
export { TooltipTrigger, Tooltip, TooltipTriggerStateContext, TooltipContext } from '../src/Tooltip';
|
|
67
|
+
export { NavigationTree, NavigationTreeItem, NavigationTreeItemContent, NavigationTreeSection, NavigationTreeHeader, NavigationTreeContext, NavigationTreeItemStateContext } from '../src/NavigationTree';
|
|
67
68
|
export { TreeLoadMoreItem, Tree, TreeItem, TreeContext, TreeItemContent, TreeHeader, TreeSection, TreeStateContext } from '../src/Tree';
|
|
68
69
|
export { useDrag } from 'react-aria/useDrag';
|
|
69
70
|
export { useDrop, DIRECTORY_DRAG_TYPE, isDirectoryDropItem, isFileDropItem, isTextDropItem } from 'react-aria/useDrop';
|
|
@@ -78,6 +79,7 @@ export { Focusable } from 'react-aria/Focusable';
|
|
|
78
79
|
export { VisuallyHidden } from 'react-aria/VisuallyHidden';
|
|
79
80
|
export { FormValidationContext } from 'react-stately/private/form/useFormValidationState';
|
|
80
81
|
export { parseColor, getColorChannels } from 'react-stately/Color';
|
|
82
|
+
export { setInteractionModality } from 'react-aria/useFocusVisible';
|
|
81
83
|
export { ToastQueue as UNSTABLE_ToastQueue } from 'react-stately/useToastState';
|
|
82
84
|
export { useListData } from 'react-stately/useListData';
|
|
83
85
|
export { useTreeData } from 'react-stately/useTreeData';
|
|
@@ -121,7 +123,7 @@ export type { LabelProps } from '../src/Label';
|
|
|
121
123
|
export type { LinkProps, LinkRenderProps } from '../src/Link';
|
|
122
124
|
export type { PreviewTriggerProps } from '../src/PreviewTrigger';
|
|
123
125
|
export type { ListBoxProps, ListBoxRenderProps, ListBoxItemProps, ListBoxItemRenderProps, ListBoxSectionProps, ListBoxLoadMoreItemProps } from '../src/ListBox';
|
|
124
|
-
export type { MenuProps, MenuItemProps, MenuItemRenderProps, MenuTriggerProps, SubmenuTriggerProps, MenuSectionProps } from '../src/Menu';
|
|
126
|
+
export type { MenuProps, MenuItemProps, MenuItemRenderProps, MenuLoadMoreItemProps, MenuTriggerProps, SubmenuTriggerProps, MenuSectionProps } from '../src/Menu';
|
|
125
127
|
export type { MeterProps, MeterRenderProps } from '../src/Meter';
|
|
126
128
|
export type { ModalOverlayProps, ModalRenderProps } from '../src/Modal';
|
|
127
129
|
export type { NumberFieldProps, NumberFieldRenderProps } from '../src/NumberField';
|
|
@@ -148,6 +150,7 @@ export type { ToggleButtonProps, ToggleButtonRenderProps } from '../src/ToggleBu
|
|
|
148
150
|
export type { ToggleButtonGroupProps, ToggleButtonGroupRenderProps } from '../src/ToggleButtonGroup';
|
|
149
151
|
export type { ToolbarProps, ToolbarRenderProps } from '../src/Toolbar';
|
|
150
152
|
export type { TooltipProps, TooltipRenderProps, TooltipTriggerComponentProps } from '../src/Tooltip';
|
|
153
|
+
export type { NavigationTreeProps, NavigationTreeRenderProps, NavigationTreeItemProps, NavigationTreeItemRenderProps, NavigationTreeItemContentProps, NavigationTreeItemContentRenderProps, NavigationTreeSectionProps, NavigationTreeHeaderProps } from '../src/NavigationTree';
|
|
151
154
|
export type { TreeProps, TreeRenderProps, TreeEmptyStateRenderProps, TreeItemProps, TreeItemRenderProps, TreeItemContentProps, TreeItemContentRenderProps, TreeLoadMoreItemProps, TreeLoadMoreItemRenderProps } from '../src/Tree';
|
|
152
155
|
export type { DragOptions, DragResult } from 'react-aria/useDrag';
|
|
153
156
|
export type { DragAndDropHooks, DragAndDropOptions, DropIndicatorProps, DropIndicatorRenderProps } from '../src/useDragAndDrop';
|
|
@@ -156,7 +159,7 @@ export type { VirtualizerProps } from '../src/Virtualizer';
|
|
|
156
159
|
export type { DateValue } from 'react-stately/useDateFieldState';
|
|
157
160
|
export type { DateRange } from 'react-stately/useDateRangePickerState';
|
|
158
161
|
export type { TimeValue } from 'react-stately/useTimeFieldState';
|
|
159
|
-
export type { Key, Selection, SortDescriptor, SortDirection, SelectionMode, DirectoryDropItem, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem, PressEvent } from '@react-types/shared';
|
|
162
|
+
export type { Key, Selection, SortDescriptor, SortDirection, SelectionMode, DirectoryDropItem, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem, PressEvent, FocusableElement, HoverEvent, KeyboardEvent } from '@react-types/shared';
|
|
160
163
|
export type { CalendarState } from 'react-stately/useCalendarState';
|
|
161
164
|
export type { RangeCalendarState } from 'react-stately/useRangeCalendarState';
|
|
162
165
|
export type { CheckboxGroupState } from 'react-stately/useCheckboxGroupState';
|
|
@@ -173,6 +176,7 @@ export type { DateRangePickerState } from 'react-stately/useDateRangePickerState
|
|
|
173
176
|
export type { DisclosureState } from 'react-stately/useDisclosureState';
|
|
174
177
|
export type { DisclosureGroupState } from 'react-stately/useDisclosureGroupState';
|
|
175
178
|
export type { ListState } from 'react-stately/useListState';
|
|
179
|
+
export type { Modality } from 'react-aria/useFocusVisible';
|
|
176
180
|
export type { NumberFieldState } from 'react-stately/useNumberFieldState';
|
|
177
181
|
export type { OverlayTriggerState } from 'react-stately/useOverlayTriggerState';
|
|
178
182
|
export type { QueuedToast, ToastOptions, ToastState } from 'react-stately/useToastState';
|
|
@@ -20,7 +20,7 @@ export declare const BreadcrumbsContext: React.Context<ContextValue<BreadcrumbsP
|
|
|
20
20
|
/**
|
|
21
21
|
* Breadcrumbs display a hierarchy of links to the current page or resource in an application.
|
|
22
22
|
*/
|
|
23
|
-
export declare const Breadcrumbs: <T>(props: BreadcrumbsProps<T> & React.RefAttributes<HTMLOListElement>) => React.ReactElement
|
|
23
|
+
export declare const Breadcrumbs: <T>(props: BreadcrumbsProps<T> & React.RefAttributes<HTMLOListElement>) => React.ReactElement | null;
|
|
24
24
|
export interface BreadcrumbRenderProps {
|
|
25
25
|
/**
|
|
26
26
|
* Whether the breadcrumb is for the current page.
|
|
@@ -52,4 +52,4 @@ export interface BreadcrumbProps extends RenderProps<BreadcrumbRenderProps, 'li'
|
|
|
52
52
|
/**
|
|
53
53
|
* A Breadcrumb represents an individual item in a `<Breadcrumbs>` list.
|
|
54
54
|
*/
|
|
55
|
-
export declare const Breadcrumb: (props: BreadcrumbProps & React.RefAttributes<HTMLLIElement>) => React.ReactElement
|
|
55
|
+
export declare const Breadcrumb: (props: BreadcrumbProps & React.RefAttributes<HTMLLIElement>) => React.ReactElement | null;
|
|
@@ -62,5 +62,5 @@ export declare const ButtonContext: React.Context<ContextValue<ButtonContextValu
|
|
|
62
62
|
/**
|
|
63
63
|
* A button allows a user to perform an action, with mouse, touch, and keyboard interactions.
|
|
64
64
|
*/
|
|
65
|
-
export declare const Button: (props: ButtonProps & React.RefAttributes<HTMLButtonElement>) => React.ReactElement
|
|
65
|
+
export declare const Button: (props: ButtonProps & React.RefAttributes<HTMLButtonElement>) => React.ReactElement | null;
|
|
66
66
|
export {};
|
|
@@ -83,12 +83,12 @@ export declare const RangeCalendarStateContext: React.Context<RangeCalendarState
|
|
|
83
83
|
/**
|
|
84
84
|
* A calendar displays one or more date grids and allows users to select a single date.
|
|
85
85
|
*/
|
|
86
|
-
export declare const Calendar: <T extends DateValue, M extends CalendarSelectionMode = "single">(props: CalendarProps<T, M> & React.RefAttributes<HTMLDivElement>) => ReactElement
|
|
86
|
+
export declare const Calendar: <T extends DateValue, M extends CalendarSelectionMode = "single">(props: CalendarProps<T, M> & React.RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
87
87
|
/**
|
|
88
88
|
* A range calendar displays one or more date grids and allows users to select a contiguous range of
|
|
89
89
|
* dates.
|
|
90
90
|
*/
|
|
91
|
-
export declare const RangeCalendar: <T extends DateValue>(props: RangeCalendarProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement
|
|
91
|
+
export declare const RangeCalendar: <T extends DateValue>(props: RangeCalendarProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
92
92
|
export interface CalendarCellRenderProps {
|
|
93
93
|
/** The date that the cell represents. */
|
|
94
94
|
date: CalendarDate;
|
|
@@ -214,7 +214,7 @@ export interface CalendarGridProps extends StyleProps, DOMRenderProps<'table', u
|
|
|
214
214
|
* A calendar grid displays a single grid of days within a calendar or range calendar which
|
|
215
215
|
* can be keyboard navigated and selected by the user.
|
|
216
216
|
*/
|
|
217
|
-
export declare const CalendarGrid: (props: CalendarGridProps & React.RefAttributes<HTMLTableElement>) => ReactElement
|
|
217
|
+
export declare const CalendarGrid: (props: CalendarGridProps & React.RefAttributes<HTMLTableElement>) => ReactElement | null;
|
|
218
218
|
export interface CalendarGridHeaderProps extends StyleProps, DOMRenderProps<'thead', undefined>, GlobalDOMAttributes<HTMLTableSectionElement> {
|
|
219
219
|
/**
|
|
220
220
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
@@ -229,7 +229,7 @@ export interface CalendarGridHeaderProps extends StyleProps, DOMRenderProps<'the
|
|
|
229
229
|
/**
|
|
230
230
|
* A calendar grid header displays a row of week day names at the top of a month.
|
|
231
231
|
*/
|
|
232
|
-
declare const CalendarGridHeaderForwardRef: (props: CalendarGridHeaderProps & React.RefAttributes<HTMLTableSectionElement>) => ReactElement
|
|
232
|
+
declare const CalendarGridHeaderForwardRef: (props: CalendarGridHeaderProps & React.RefAttributes<HTMLTableSectionElement>) => ReactElement | null;
|
|
233
233
|
export { CalendarGridHeaderForwardRef as CalendarGridHeader };
|
|
234
234
|
export interface CalendarHeaderCellProps extends DOMProps, DOMRenderProps<'th', undefined>, GlobalDOMAttributes<HTMLTableHeaderCellElement> {
|
|
235
235
|
/**
|
|
@@ -259,7 +259,7 @@ export interface CalendarGridBodyProps extends StyleProps, DOMRenderProps<'tbody
|
|
|
259
259
|
/**
|
|
260
260
|
* A calendar grid body displays a grid of calendar cells within a month.
|
|
261
261
|
*/
|
|
262
|
-
declare const CalendarGridBodyForwardRef: (props: CalendarGridBodyProps & React.RefAttributes<HTMLTableSectionElement>) => ReactElement
|
|
262
|
+
declare const CalendarGridBodyForwardRef: (props: CalendarGridBodyProps & React.RefAttributes<HTMLTableSectionElement>) => ReactElement | null;
|
|
263
263
|
export { CalendarGridBodyForwardRef as CalendarGridBody };
|
|
264
264
|
export interface CalendarCellProps extends RenderProps<CalendarCellRenderProps, 'div'>, HoverEvents, GlobalDOMAttributes<HTMLTableCellElement> {
|
|
265
265
|
/**
|
|
@@ -275,7 +275,7 @@ export interface CalendarCellProps extends RenderProps<CalendarCellRenderProps,
|
|
|
275
275
|
/**
|
|
276
276
|
* A calendar cell displays a date cell within a calendar grid which can be selected by the user.
|
|
277
277
|
*/
|
|
278
|
-
export declare const CalendarCell: (props: CalendarCellProps & React.RefAttributes<HTMLTableCellElement>) => ReactElement
|
|
278
|
+
export declare const CalendarCell: (props: CalendarCellProps & React.RefAttributes<HTMLTableCellElement>) => ReactElement | null;
|
|
279
279
|
export interface CalendarYearPickerProps extends AriaCalendarYearPickerProps {
|
|
280
280
|
/**
|
|
281
281
|
* A function to render the year picker.
|
|
@@ -2,9 +2,9 @@ import { AriaCheckboxGroupProps } from 'react-aria/useCheckboxGroup';
|
|
|
2
2
|
import { AriaCheckboxProps } from 'react-aria/useCheckbox';
|
|
3
3
|
import { CheckboxGroupState } from 'react-stately/useCheckboxGroupState';
|
|
4
4
|
import { ClassNameOrFunction, ContextValue, RACValidation, RenderProps, SlotProps } from './utils';
|
|
5
|
-
import { GlobalDOMAttributes
|
|
5
|
+
import { GlobalDOMAttributes } from '@react-types/shared';
|
|
6
6
|
import { HoverEvents } from '@react-types/shared';
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { Ref } from 'react';
|
|
8
8
|
export interface CheckboxGroupProps extends Omit<AriaCheckboxGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<CheckboxGroupRenderProps, 'div'>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
9
9
|
/**
|
|
10
10
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
@@ -25,7 +25,7 @@ export interface CheckboxProps extends Omit<AriaCheckboxProps, 'children' | 'val
|
|
|
25
25
|
/**
|
|
26
26
|
* A ref for the HTML input element.
|
|
27
27
|
*/
|
|
28
|
-
inputRef?:
|
|
28
|
+
inputRef?: Ref<HTMLInputElement | null>;
|
|
29
29
|
}
|
|
30
30
|
export interface CheckboxFieldProps extends Omit<AriaCheckboxProps, 'children' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<CheckboxFieldRenderProps>, SlotProps, Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {
|
|
31
31
|
/**
|
|
@@ -38,7 +38,7 @@ export interface CheckboxFieldProps extends Omit<AriaCheckboxProps, 'children' |
|
|
|
38
38
|
/**
|
|
39
39
|
* A ref for the HTML input element.
|
|
40
40
|
*/
|
|
41
|
-
inputRef?:
|
|
41
|
+
inputRef?: Ref<HTMLInputElement | null>;
|
|
42
42
|
}
|
|
43
43
|
export interface CheckboxButtonProps extends HoverEvents, RenderProps<CheckboxButtonRenderProps, 'label'>, SlotProps, GlobalDOMAttributes<HTMLLabelElement> {
|
|
44
44
|
/**
|
|
@@ -188,19 +188,19 @@ export declare const CheckboxGroupStateContext: React.Context<CheckboxGroupState
|
|
|
188
188
|
/**
|
|
189
189
|
* A checkbox group allows a user to select multiple items from a list of options.
|
|
190
190
|
*/
|
|
191
|
-
export declare const CheckboxGroup: (props: CheckboxGroupProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
191
|
+
export declare const CheckboxGroup: (props: CheckboxGroupProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
192
192
|
/**
|
|
193
193
|
* A checkbox allows a user to select an item, with support for validation and help text.
|
|
194
194
|
*/
|
|
195
|
-
export declare const CheckboxField: (props: CheckboxFieldProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
195
|
+
export declare const CheckboxField: (props: CheckboxFieldProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
196
196
|
/**
|
|
197
197
|
* A checkbox allows a user to select multiple items from a list of individual items, or
|
|
198
198
|
* to mark one individual item as selected.
|
|
199
199
|
*
|
|
200
200
|
* @deprecated Use CheckboxField + CheckboxButton instead.
|
|
201
201
|
*/
|
|
202
|
-
export declare const Checkbox: (props: CheckboxProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement
|
|
202
|
+
export declare const Checkbox: (props: CheckboxProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
|
|
203
203
|
/**
|
|
204
204
|
* A checkbox button is the clickable area of a checkbox, including the indicator and label.
|
|
205
205
|
*/
|
|
206
|
-
export declare const CheckboxButton: (props: CheckboxButtonProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement
|
|
206
|
+
export declare const CheckboxButton: (props: CheckboxButtonProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
|
|
@@ -95,7 +95,7 @@ interface SectionContextValue {
|
|
|
95
95
|
}
|
|
96
96
|
export declare const SectionContext: React.Context<SectionContextValue | null>;
|
|
97
97
|
/** @deprecated */
|
|
98
|
-
export declare const Section: <T extends unknown>(props: SectionProps<T> & React.RefAttributes<HTMLElement>) => ReactElement
|
|
98
|
+
export declare const Section: <T extends unknown>(props: SectionProps<T> & React.RefAttributes<HTMLElement>) => ReactElement | null;
|
|
99
99
|
export interface CollectionBranchProps {
|
|
100
100
|
/** The collection of items to render. */
|
|
101
101
|
collection: ICollection<Node<unknown>>;
|
|
@@ -65,7 +65,7 @@ export declare const ComboBoxStateContext: React.Context<ComboBoxState<any, Sele
|
|
|
65
65
|
* A combo box combines a text input with a listbox, allowing users to filter a list of options to
|
|
66
66
|
* items matching a query.
|
|
67
67
|
*/
|
|
68
|
-
export declare const ComboBox: <T, M extends SelectionMode = "single">(props: ComboBoxProps<T, M> & React.RefAttributes<HTMLDivElement>) => ReactElement
|
|
68
|
+
export declare const ComboBox: <T, M extends SelectionMode = "single">(props: ComboBoxProps<T, M> & React.RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
69
69
|
export interface ComboBoxValueRenderProps<T> {
|
|
70
70
|
/**
|
|
71
71
|
* Whether the value is a placeholder.
|
|
@@ -97,5 +97,5 @@ export declare const ComboBoxValueContext: React.Context<ContextValue<ComboBoxVa
|
|
|
97
97
|
* selected. By default, the items are rendered as a comma separated list. Use the render function
|
|
98
98
|
* to customize this.
|
|
99
99
|
*/
|
|
100
|
-
export declare const ComboBoxValue: <T>(props: ComboBoxValueProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement
|
|
100
|
+
export declare const ComboBoxValue: <T>(props: ComboBoxValueProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
101
101
|
export {};
|
|
@@ -63,12 +63,12 @@ export declare const TimeFieldStateContext: React.Context<TimeFieldState | null>
|
|
|
63
63
|
* A date field allows users to enter and edit date and time values using a keyboard.
|
|
64
64
|
* Each part of a date value is displayed in an individually editable segment.
|
|
65
65
|
*/
|
|
66
|
-
export declare const DateField: <T extends DateValue>(props: DateFieldProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement
|
|
66
|
+
export declare const DateField: <T extends DateValue>(props: DateFieldProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
67
67
|
/**
|
|
68
68
|
* A time field allows users to enter and edit time values using a keyboard.
|
|
69
69
|
* Each part of a time value is displayed in an individually editable segment.
|
|
70
70
|
*/
|
|
71
|
-
export declare const TimeField: <T extends TimeValue>(props: TimeFieldProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement
|
|
71
|
+
export declare const TimeField: <T extends TimeValue>(props: TimeFieldProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
72
72
|
export interface DateInputRenderProps {
|
|
73
73
|
/**
|
|
74
74
|
* Whether the date input is currently hovered with a mouse.
|
|
@@ -114,7 +114,7 @@ export interface DateInputProps extends SlotProps, StyleRenderProps<DateInputRen
|
|
|
114
114
|
/**
|
|
115
115
|
* A date input groups the editable date segments within a date field.
|
|
116
116
|
*/
|
|
117
|
-
export declare const DateInput: (props: DateInputProps & React.RefAttributes<HTMLDivElement>) => ReactElement
|
|
117
|
+
export declare const DateInput: (props: DateInputProps & React.RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
118
118
|
export interface DateSegmentRenderProps extends Omit<IDateSegment, 'isEditable'> {
|
|
119
119
|
/**
|
|
120
120
|
* Whether the segment is currently hovered with a mouse.
|
|
@@ -179,4 +179,4 @@ export interface DateSegmentProps extends RenderProps<DateSegmentRenderProps, 's
|
|
|
179
179
|
* A date segment displays an individual unit of a date and time, and allows users to edit
|
|
180
180
|
* the value by typing or using the arrow keys to increment and decrement.
|
|
181
181
|
*/
|
|
182
|
-
export declare const DateSegment: (props: DateSegmentProps & React.RefAttributes<HTMLSpanElement>) => ReactElement
|
|
182
|
+
export declare const DateSegment: (props: DateSegmentProps & React.RefAttributes<HTMLSpanElement>) => ReactElement | null;
|
|
@@ -85,9 +85,9 @@ export declare const DateRangePickerStateContext: React.Context<DateRangePickerS
|
|
|
85
85
|
* A date picker combines a DateField and a Calendar popover to allow users to enter or select a
|
|
86
86
|
* date and time value.
|
|
87
87
|
*/
|
|
88
|
-
export declare const DatePicker: <T extends DateValue>(props: DatePickerProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
88
|
+
export declare const DatePicker: <T extends DateValue>(props: DatePickerProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
89
89
|
/**
|
|
90
90
|
* A date range picker combines two DateFields and a RangeCalendar popover to allow
|
|
91
91
|
* users to enter or select a date and time range.
|
|
92
92
|
*/
|
|
93
|
-
export declare const DateRangePicker: <T extends DateValue>(props: DateRangePickerProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
93
|
+
export declare const DateRangePicker: <T extends DateValue>(props: DateRangePickerProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -25,8 +25,8 @@ export declare const OverlayTriggerStateContext: React.Context<OverlayTriggerSta
|
|
|
25
25
|
/**
|
|
26
26
|
* A DialogTrigger opens a dialog when a trigger element is pressed.
|
|
27
27
|
*/
|
|
28
|
-
export declare function DialogTrigger(props: DialogTriggerProps): JSX.Element;
|
|
28
|
+
export declare function DialogTrigger(props: DialogTriggerProps): JSX.Element | null;
|
|
29
29
|
/**
|
|
30
30
|
* A dialog is an overlay shown above other content in an application.
|
|
31
31
|
*/
|
|
32
|
-
export declare const Dialog: (props: DialogProps & React.RefAttributes<HTMLElement>) => React.ReactElement
|
|
32
|
+
export declare const Dialog: (props: DialogProps & React.RefAttributes<HTMLElement>) => React.ReactElement | null;
|
|
@@ -76,7 +76,7 @@ export declare const DisclosureStateContext: React.Context<DisclosureState | nul
|
|
|
76
76
|
* A disclosure is a collapsible section of content. It is composed of a a header with a heading and
|
|
77
77
|
* trigger button, and a panel that contains the content.
|
|
78
78
|
*/
|
|
79
|
-
export declare const Disclosure: (props: DisclosureProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
79
|
+
export declare const Disclosure: (props: DisclosureProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
80
80
|
export interface DisclosurePanelRenderProps {
|
|
81
81
|
/**
|
|
82
82
|
* Whether keyboard focus is within the disclosure panel.
|
|
@@ -107,4 +107,4 @@ export interface DisclosurePanelProps extends RenderProps<DisclosurePanelRenderP
|
|
|
107
107
|
/**
|
|
108
108
|
* A DisclosurePanel provides the content for a disclosure.
|
|
109
109
|
*/
|
|
110
|
-
export declare const DisclosurePanel: (props: DisclosurePanelProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
110
|
+
export declare const DisclosurePanel: (props: DisclosurePanelProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -102,7 +102,7 @@ export declare const GridListContext: React.Context<ContextValue<GridListProps<a
|
|
|
102
102
|
* A grid list displays a list of interactive items, with support for keyboard navigation,
|
|
103
103
|
* single or multiple selection, and row actions.
|
|
104
104
|
*/
|
|
105
|
-
export declare const GridList: <T>(props: GridListProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
105
|
+
export declare const GridList: <T>(props: GridListProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
106
106
|
export interface GridListItemRenderProps extends ItemRenderProps {
|
|
107
107
|
/** The unique id of the item. */
|
|
108
108
|
id?: Key;
|
|
@@ -156,13 +156,13 @@ export interface GridListItemProps<T = object> extends RenderProps<GridListItemR
|
|
|
156
156
|
/**
|
|
157
157
|
* A GridListItem represents an individual item in a GridList.
|
|
158
158
|
*/
|
|
159
|
-
export declare const GridListItem: <T>(props: GridListItemProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
159
|
+
export declare const GridListItem: <T>(props: GridListItemProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
160
160
|
export interface GridListLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection' | 'direction'>, StyleProps, DOMRenderProps<'div', undefined>, GlobalDOMAttributes<HTMLDivElement> {
|
|
161
161
|
/**
|
|
162
162
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
163
163
|
* element.
|
|
164
164
|
*
|
|
165
|
-
* @default 'react-aria-
|
|
165
|
+
* @default 'react-aria-GridListLoadingIndicator'
|
|
166
166
|
*/
|
|
167
167
|
className?: string;
|
|
168
168
|
/**
|
|
@@ -174,7 +174,7 @@ export interface GridListLoadMoreItemProps extends Omit<LoadMoreSentinelProps, '
|
|
|
174
174
|
*/
|
|
175
175
|
isLoading?: boolean;
|
|
176
176
|
}
|
|
177
|
-
export declare const GridListLoadMoreItem: (props: GridListLoadMoreItemProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
177
|
+
export declare const GridListLoadMoreItem: (props: GridListLoadMoreItemProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
178
178
|
export interface GridListSectionProps<T> extends SectionProps<T>, DOMRenderProps<'div', undefined> {
|
|
179
179
|
/**
|
|
180
180
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
@@ -187,9 +187,9 @@ export interface GridListSectionProps<T> extends SectionProps<T>, DOMRenderProps
|
|
|
187
187
|
/**
|
|
188
188
|
* A GridListSection represents a section within a GridList.
|
|
189
189
|
*/
|
|
190
|
-
export declare const GridListSection: <T extends unknown>(props: GridListSectionProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
190
|
+
export declare const GridListSection: <T extends unknown>(props: GridListSectionProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
191
191
|
export interface GridListHeaderProps extends DOMRenderProps<'div', undefined>, DOMProps, GlobalDOMAttributes<HTMLElement> {
|
|
192
192
|
}
|
|
193
193
|
export declare const GridListHeaderContext: React.Context<ContextValue<GridListHeaderProps, HTMLDivElement>>;
|
|
194
194
|
export declare const GridListHeaderInnerContext: React.Context<HTMLAttributes<HTMLElement> | null>;
|
|
195
|
-
export declare const GridListHeader: (props: GridListHeaderProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
195
|
+
export declare const GridListHeader: (props: GridListHeaderProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -62,4 +62,4 @@ export declare const GroupContext: React.Context<ContextValue<GroupProps, HTMLDi
|
|
|
62
62
|
/**
|
|
63
63
|
* A group represents a set of related UI controls, and supports interactive states for styling.
|
|
64
64
|
*/
|
|
65
|
-
export declare const Group: (props: GroupProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
65
|
+
export declare const Group: (props: GroupProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -3,4 +3,4 @@ import React, { HTMLAttributes } from 'react';
|
|
|
3
3
|
export interface HeaderProps extends HTMLAttributes<HTMLElement>, DOMRenderProps<'header', undefined> {
|
|
4
4
|
}
|
|
5
5
|
export declare const HeaderContext: React.Context<ContextValue<HeaderProps, HTMLElement>>;
|
|
6
|
-
export declare const Header: (props: HeaderProps & React.RefAttributes<HTMLElement>) => React.ReactElement
|
|
6
|
+
export declare const Header: (props: HeaderProps & React.RefAttributes<HTMLElement>) => React.ReactElement | null;
|
|
@@ -51,4 +51,4 @@ export declare const InputContext: React.Context<ContextValue<InputProps, HTMLIn
|
|
|
51
51
|
/**
|
|
52
52
|
* An input allows a user to input text.
|
|
53
53
|
*/
|
|
54
|
-
export declare const Input: (props: InputProps & React.RefAttributes<HTMLInputElement>) => React.ReactElement
|
|
54
|
+
export declare const Input: (props: InputProps & React.RefAttributes<HTMLInputElement>) => React.ReactElement | null;
|
|
@@ -4,4 +4,4 @@ export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement>, DOMRe
|
|
|
4
4
|
elementType?: string;
|
|
5
5
|
}
|
|
6
6
|
export declare const LabelContext: React.Context<ContextValue<LabelProps, HTMLLabelElement>>;
|
|
7
|
-
export declare const Label: (props: LabelProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement
|
|
7
|
+
export declare const Label: (props: LabelProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
|
package/dist/types/src/Link.d.ts
CHANGED
|
@@ -55,4 +55,4 @@ export declare const LinkContext: React.Context<ContextValue<LinkProps, HTMLAnch
|
|
|
55
55
|
* A link allows a user to navigate to another page or resource within a web page
|
|
56
56
|
* or application.
|
|
57
57
|
*/
|
|
58
|
-
export declare const Link: (props: LinkProps & React.RefAttributes<HTMLAnchorElement>) => React.ReactElement
|
|
58
|
+
export declare const Link: (props: LinkProps & React.RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;
|
|
@@ -89,7 +89,7 @@ export declare const ListStateContext: React.Context<ListState<any> | null>;
|
|
|
89
89
|
/**
|
|
90
90
|
* A listbox displays a list of options and allows a user to select one or more of them.
|
|
91
91
|
*/
|
|
92
|
-
export declare const ListBox: <T>(props: ListBoxProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
92
|
+
export declare const ListBox: <T>(props: ListBoxProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
93
93
|
export interface ListBoxSectionProps<T> extends SectionProps<T>, DOMRenderProps<'section', undefined> {
|
|
94
94
|
/**
|
|
95
95
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
@@ -102,7 +102,7 @@ export interface ListBoxSectionProps<T> extends SectionProps<T>, DOMRenderProps<
|
|
|
102
102
|
/**
|
|
103
103
|
* A ListBoxSection represents a section within a ListBox.
|
|
104
104
|
*/
|
|
105
|
-
export declare const ListBoxSection: <T>(props: ListBoxSectionProps<T> & React.RefAttributes<HTMLElement>) => React.ReactElement
|
|
105
|
+
export declare const ListBoxSection: <T>(props: ListBoxSectionProps<T> & React.RefAttributes<HTMLElement>) => React.ReactElement | null;
|
|
106
106
|
export interface ListBoxItemRenderProps extends ItemRenderProps {
|
|
107
107
|
}
|
|
108
108
|
export interface ListBoxItemProps<T = object> extends Omit<RenderProps<ListBoxItemRenderProps>, 'render'>, PossibleLinkDOMRenderProps<'div', ListBoxItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, KeyboardEvents, FocusEvents<HTMLDivElement>, Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {
|
|
@@ -135,13 +135,13 @@ export interface ListBoxItemProps<T = object> extends Omit<RenderProps<ListBoxIt
|
|
|
135
135
|
/**
|
|
136
136
|
* A ListBoxItem represents an individual option in a ListBox.
|
|
137
137
|
*/
|
|
138
|
-
export declare const ListBoxItem: <T>(props: ListBoxItemProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
138
|
+
export declare const ListBoxItem: <T>(props: ListBoxItemProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
139
139
|
export interface ListBoxLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection' | 'direction'>, StyleProps, DOMRenderProps<'div', undefined>, GlobalDOMAttributes<HTMLDivElement> {
|
|
140
140
|
/**
|
|
141
141
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
142
142
|
* element.
|
|
143
143
|
*
|
|
144
|
-
* @default 'react-aria-
|
|
144
|
+
* @default 'react-aria-ListBoxLoadingIndicator'
|
|
145
145
|
*/
|
|
146
146
|
className?: string;
|
|
147
147
|
/**
|
|
@@ -153,4 +153,4 @@ export interface ListBoxLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'c
|
|
|
153
153
|
*/
|
|
154
154
|
isLoading?: boolean;
|
|
155
155
|
}
|
|
156
|
-
export declare const ListBoxLoadMoreItem: (props: ListBoxLoadMoreItemProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
156
|
+
export declare const ListBoxLoadMoreItem: (props: ListBoxLoadMoreItemProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
package/dist/types/src/Menu.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AriaMenuProps } from 'react-aria/useMenu';
|
|
2
2
|
import { MenuTriggerProps as BaseMenuTriggerProps, RootMenuTriggerState } from 'react-stately/useMenuTriggerState';
|
|
3
|
-
import { ClassNameOrFunction, ContextValue, DOMRenderProps, PossibleLinkDOMRenderProps, RenderProps, SlotProps, StyleRenderProps } from './utils';
|
|
3
|
+
import { ClassNameOrFunction, ContextValue, DOMRenderProps, PossibleLinkDOMRenderProps, RenderProps, SlotProps, StyleProps, StyleRenderProps } from './utils';
|
|
4
4
|
import { CollectionProps, ItemRenderProps, SectionProps } from './Collection';
|
|
5
5
|
import { FocusEvents, GlobalDOMAttributes, HoverEvents, Key, LinkDOMProps, MultipleSelection, PressEvents } from '@react-types/shared';
|
|
6
|
+
import { LoadMoreSentinelProps } from 'react-aria/private/utils/useLoadMoreSentinel';
|
|
6
7
|
import React, { JSX, ReactElement, ReactNode } from 'react';
|
|
7
8
|
import { TreeState } from 'react-stately/useTreeState';
|
|
8
9
|
export declare const MenuContext: React.Context<ContextValue<MenuProps<any>, HTMLDivElement>>;
|
|
@@ -30,7 +31,7 @@ export interface SubmenuTriggerProps {
|
|
|
30
31
|
*
|
|
31
32
|
* @version alpha
|
|
32
33
|
*/
|
|
33
|
-
export declare const SubmenuTrigger: (props: SubmenuTriggerProps & React.RefAttributes<HTMLDivElement>) => ReactElement
|
|
34
|
+
export declare const SubmenuTrigger: (props: SubmenuTriggerProps & React.RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
34
35
|
export interface MenuRenderProps {
|
|
35
36
|
/**
|
|
36
37
|
* Whether the menu has no items and should display its empty state.
|
|
@@ -47,7 +48,7 @@ export interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children'>, Collec
|
|
|
47
48
|
* @default 'react-aria-Menu'
|
|
48
49
|
*/
|
|
49
50
|
className?: ClassNameOrFunction<MenuRenderProps>;
|
|
50
|
-
/** Provides content to display when there are no items in the
|
|
51
|
+
/** Provides content to display when there are no items in the menu. */
|
|
51
52
|
renderEmptyState?: () => ReactNode;
|
|
52
53
|
/** Whether the menu should close when the menu item is selected. */
|
|
53
54
|
shouldCloseOnSelect?: boolean;
|
|
@@ -55,7 +56,7 @@ export interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children'>, Collec
|
|
|
55
56
|
/**
|
|
56
57
|
* A menu displays a list of actions or options that a user can choose.
|
|
57
58
|
*/
|
|
58
|
-
export declare const Menu: <T>(props: MenuProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement
|
|
59
|
+
export declare const Menu: <T>(props: MenuProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
59
60
|
export interface MenuSectionProps<T> extends SectionProps<T>, Omit<MultipleSelection, 'disabledKeys'>, DOMRenderProps<'section', undefined> {
|
|
60
61
|
/**
|
|
61
62
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
@@ -70,7 +71,7 @@ export interface MenuSectionProps<T> extends SectionProps<T>, Omit<MultipleSelec
|
|
|
70
71
|
/**
|
|
71
72
|
* A MenuSection represents a section within a Menu.
|
|
72
73
|
*/
|
|
73
|
-
export declare const MenuSection: <T>(props: MenuSectionProps<T> & React.RefAttributes<HTMLElement>) => ReactElement
|
|
74
|
+
export declare const MenuSection: <T>(props: MenuSectionProps<T> & React.RefAttributes<HTMLElement>) => ReactElement | null;
|
|
74
75
|
export interface MenuItemRenderProps extends ItemRenderProps {
|
|
75
76
|
/**
|
|
76
77
|
* Whether the item has a submenu.
|
|
@@ -114,4 +115,22 @@ export interface MenuItemProps<T = object> extends Omit<RenderProps<MenuItemRend
|
|
|
114
115
|
/**
|
|
115
116
|
* A MenuItem represents an individual action in a Menu.
|
|
116
117
|
*/
|
|
117
|
-
export declare const MenuItem: <T>(props: MenuItemProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement
|
|
118
|
+
export declare const MenuItem: <T>(props: MenuItemProps<T> & React.RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
119
|
+
export interface MenuLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection' | 'direction'>, StyleProps, DOMRenderProps<'div', undefined>, GlobalDOMAttributes<HTMLDivElement> {
|
|
120
|
+
/**
|
|
121
|
+
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
122
|
+
* element.
|
|
123
|
+
*
|
|
124
|
+
* @default 'react-aria-MenuLoadingIndicator'
|
|
125
|
+
*/
|
|
126
|
+
className?: string;
|
|
127
|
+
/**
|
|
128
|
+
* The load more spinner to render when loading additional items.
|
|
129
|
+
*/
|
|
130
|
+
children?: ReactNode;
|
|
131
|
+
/**
|
|
132
|
+
* Whether or not the loading spinner should be rendered or not.
|
|
133
|
+
*/
|
|
134
|
+
isLoading?: boolean;
|
|
135
|
+
}
|
|
136
|
+
export declare const MenuLoadMoreItem: (props: MenuLoadMoreItemProps & React.RefAttributes<HTMLDivElement>) => ReactElement | null;
|