react-aria-components 1.13.0 → 1.14.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/dist/Autocomplete.main.js.map +1 -1
- package/dist/Autocomplete.module.js.map +1 -1
- package/dist/Breadcrumbs.main.js +5 -3
- package/dist/Breadcrumbs.main.js.map +1 -1
- package/dist/Breadcrumbs.mjs +5 -3
- package/dist/Breadcrumbs.module.js +5 -3
- package/dist/Breadcrumbs.module.js.map +1 -1
- package/dist/Button.main.js.map +1 -1
- package/dist/Button.module.js.map +1 -1
- package/dist/Calendar.main.js +2 -2
- package/dist/Calendar.main.js.map +1 -1
- package/dist/Calendar.mjs +2 -2
- package/dist/Calendar.module.js +2 -2
- package/dist/Calendar.module.js.map +1 -1
- package/dist/Checkbox.main.js.map +1 -1
- package/dist/Checkbox.module.js.map +1 -1
- package/dist/Collection.main.js +1 -1
- package/dist/Collection.main.js.map +1 -1
- package/dist/Collection.mjs +1 -1
- package/dist/Collection.module.js +1 -1
- package/dist/Collection.module.js.map +1 -1
- package/dist/ColorArea.main.js +1 -1
- package/dist/ColorArea.main.js.map +1 -1
- package/dist/ColorArea.mjs +1 -1
- package/dist/ColorArea.module.js +1 -1
- package/dist/ColorArea.module.js.map +1 -1
- package/dist/ColorField.main.js +1 -1
- package/dist/ColorField.main.js.map +1 -1
- package/dist/ColorField.mjs +1 -1
- package/dist/ColorField.module.js +1 -1
- package/dist/ColorField.module.js.map +1 -1
- package/dist/ColorPicker.main.js +1 -1
- package/dist/ColorPicker.main.js.map +1 -1
- package/dist/ColorPicker.mjs +1 -1
- package/dist/ColorPicker.module.js +1 -1
- package/dist/ColorPicker.module.js.map +1 -1
- package/dist/ColorSlider.main.js +1 -1
- package/dist/ColorSlider.main.js.map +1 -1
- package/dist/ColorSlider.mjs +1 -1
- package/dist/ColorSlider.module.js +1 -1
- package/dist/ColorSlider.module.js.map +1 -1
- package/dist/ColorSwatch.main.js.map +1 -1
- package/dist/ColorSwatch.module.js.map +1 -1
- package/dist/ColorSwatchPicker.main.js +1 -1
- package/dist/ColorSwatchPicker.main.js.map +1 -1
- package/dist/ColorSwatchPicker.mjs +1 -1
- package/dist/ColorSwatchPicker.module.js +1 -1
- package/dist/ColorSwatchPicker.module.js.map +1 -1
- package/dist/ColorThumb.main.js.map +1 -1
- package/dist/ColorThumb.module.js.map +1 -1
- package/dist/ColorWheel.main.js +1 -1
- package/dist/ColorWheel.main.js.map +1 -1
- package/dist/ColorWheel.mjs +1 -1
- package/dist/ColorWheel.module.js +1 -1
- package/dist/ColorWheel.module.js.map +1 -1
- package/dist/ComboBox.main.js.map +1 -1
- package/dist/ComboBox.module.js.map +1 -1
- package/dist/DateField.main.js +3 -1
- package/dist/DateField.main.js.map +1 -1
- package/dist/DateField.mjs +3 -1
- package/dist/DateField.module.js +3 -1
- package/dist/DateField.module.js.map +1 -1
- package/dist/DatePicker.main.js.map +1 -1
- package/dist/DatePicker.module.js.map +1 -1
- package/dist/Dialog.main.js.map +1 -1
- package/dist/Dialog.module.js.map +1 -1
- package/dist/Disclosure.main.js +2 -1
- package/dist/Disclosure.main.js.map +1 -1
- package/dist/Disclosure.mjs +2 -1
- package/dist/Disclosure.module.js +2 -1
- package/dist/Disclosure.module.js.map +1 -1
- package/dist/DragAndDrop.main.js.map +1 -1
- package/dist/DragAndDrop.module.js.map +1 -1
- package/dist/DropZone.main.js.map +1 -1
- package/dist/DropZone.module.js.map +1 -1
- package/dist/FieldError.main.js.map +1 -1
- package/dist/FieldError.module.js.map +1 -1
- package/dist/FileTrigger.main.js +1 -0
- package/dist/FileTrigger.main.js.map +1 -1
- package/dist/FileTrigger.mjs +1 -0
- package/dist/FileTrigger.module.js +1 -0
- package/dist/FileTrigger.module.js.map +1 -1
- package/dist/Form.main.js.map +1 -1
- package/dist/Form.module.js.map +1 -1
- package/dist/GridList.main.js +1 -1
- package/dist/GridList.main.js.map +1 -1
- package/dist/GridList.mjs +1 -1
- package/dist/GridList.module.js +1 -1
- package/dist/GridList.module.js.map +1 -1
- package/dist/Group.main.js +2 -2
- package/dist/Group.main.js.map +1 -1
- package/dist/Group.mjs +2 -2
- package/dist/Group.module.js +2 -2
- package/dist/Group.module.js.map +1 -1
- package/dist/HiddenDateInput.main.js +5 -3
- package/dist/HiddenDateInput.main.js.map +1 -1
- package/dist/HiddenDateInput.mjs +5 -3
- package/dist/HiddenDateInput.module.js +5 -3
- package/dist/HiddenDateInput.module.js.map +1 -1
- package/dist/Input.main.js +4 -1
- package/dist/Input.main.js.map +1 -1
- package/dist/Input.mjs +4 -1
- package/dist/Input.module.js +4 -1
- package/dist/Input.module.js.map +1 -1
- package/dist/Link.main.js.map +1 -1
- package/dist/Link.module.js.map +1 -1
- package/dist/ListBox.main.js +6 -3
- package/dist/ListBox.main.js.map +1 -1
- package/dist/ListBox.mjs +7 -4
- package/dist/ListBox.module.js +7 -4
- package/dist/ListBox.module.js.map +1 -1
- package/dist/Menu.main.js +1 -1
- package/dist/Menu.main.js.map +1 -1
- package/dist/Menu.mjs +1 -1
- package/dist/Menu.module.js +1 -1
- package/dist/Menu.module.js.map +1 -1
- package/dist/Meter.main.js.map +1 -1
- package/dist/Meter.module.js.map +1 -1
- package/dist/Modal.main.js.map +1 -1
- package/dist/Modal.module.js.map +1 -1
- package/dist/NumberField.main.js.map +1 -1
- package/dist/NumberField.module.js.map +1 -1
- package/dist/OverlayArrow.main.js.map +1 -1
- package/dist/OverlayArrow.module.js.map +1 -1
- package/dist/Popover.main.js.map +1 -1
- package/dist/Popover.module.js.map +1 -1
- package/dist/ProgressBar.main.js.map +1 -1
- package/dist/ProgressBar.module.js.map +1 -1
- package/dist/RadioGroup.main.js.map +1 -1
- package/dist/RadioGroup.module.js.map +1 -1
- package/dist/SearchField.main.js +5 -1
- package/dist/SearchField.main.js.map +1 -1
- package/dist/SearchField.mjs +5 -1
- package/dist/SearchField.module.js +5 -1
- package/dist/SearchField.module.js.map +1 -1
- package/dist/Select.main.js.map +1 -1
- package/dist/Select.module.js.map +1 -1
- package/dist/SelectionIndicator.main.js.map +1 -1
- package/dist/SelectionIndicator.module.js.map +1 -1
- package/dist/Separator.main.js.map +1 -1
- package/dist/Separator.module.js.map +1 -1
- package/dist/Slider.main.js.map +1 -1
- package/dist/Slider.module.js.map +1 -1
- package/dist/Switch.main.js.map +1 -1
- package/dist/Switch.module.js.map +1 -1
- package/dist/Table.main.js +126 -42
- package/dist/Table.main.js.map +1 -1
- package/dist/Table.mjs +126 -42
- package/dist/Table.module.js +126 -42
- package/dist/Table.module.js.map +1 -1
- package/dist/Tabs.main.js +75 -6
- package/dist/Tabs.main.js.map +1 -1
- package/dist/Tabs.mjs +77 -9
- package/dist/Tabs.module.js +77 -9
- package/dist/Tabs.module.js.map +1 -1
- package/dist/TagGroup.main.js +1 -1
- package/dist/TagGroup.main.js.map +1 -1
- package/dist/TagGroup.mjs +1 -1
- package/dist/TagGroup.module.js +1 -1
- package/dist/TagGroup.module.js.map +1 -1
- package/dist/TextArea.main.js.map +1 -1
- package/dist/TextArea.module.js.map +1 -1
- package/dist/TextField.main.js.map +1 -1
- package/dist/TextField.module.js.map +1 -1
- package/dist/Toast.main.js.map +1 -1
- package/dist/Toast.module.js.map +1 -1
- package/dist/ToggleButton.main.js.map +1 -1
- package/dist/ToggleButton.module.js.map +1 -1
- package/dist/ToggleButtonGroup.main.js +1 -0
- package/dist/ToggleButtonGroup.main.js.map +1 -1
- package/dist/ToggleButtonGroup.mjs +1 -0
- package/dist/ToggleButtonGroup.module.js +1 -0
- package/dist/ToggleButtonGroup.module.js.map +1 -1
- package/dist/Toolbar.main.js.map +1 -1
- package/dist/Toolbar.module.js.map +1 -1
- package/dist/Tooltip.main.js.map +1 -1
- package/dist/Tooltip.module.js.map +1 -1
- package/dist/Tree.main.js.map +1 -1
- package/dist/Tree.module.js.map +1 -1
- package/dist/import.mjs +4 -4
- package/dist/main.js +5 -0
- package/dist/main.js.map +1 -1
- package/dist/module.js +4 -4
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +565 -35
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.main.js +0 -1
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.mjs +0 -1
- package/dist/utils.module.js +0 -1
- package/dist/utils.module.js.map +1 -1
- package/i18n/ar-AE.js +1 -1
- package/i18n/ar-AE.mjs +1 -1
- package/i18n/bg-BG.js +1 -1
- package/i18n/bg-BG.mjs +1 -1
- package/i18n/cs-CZ.js +1 -1
- package/i18n/cs-CZ.mjs +1 -1
- package/i18n/da-DK.js +1 -1
- package/i18n/da-DK.mjs +1 -1
- package/i18n/de-DE.js +1 -1
- package/i18n/de-DE.mjs +1 -1
- package/i18n/el-GR.js +1 -1
- package/i18n/el-GR.mjs +1 -1
- package/i18n/en-US.js +1 -1
- package/i18n/en-US.mjs +1 -1
- package/i18n/es-ES.js +1 -1
- package/i18n/es-ES.mjs +1 -1
- package/i18n/et-EE.js +1 -1
- package/i18n/et-EE.mjs +1 -1
- package/i18n/fi-FI.js +1 -1
- package/i18n/fi-FI.mjs +1 -1
- package/i18n/fr-FR.js +1 -1
- package/i18n/fr-FR.mjs +1 -1
- package/i18n/he-IL.js +1 -1
- package/i18n/he-IL.mjs +1 -1
- package/i18n/hr-HR.js +1 -1
- package/i18n/hr-HR.mjs +1 -1
- package/i18n/hu-HU.js +1 -1
- package/i18n/hu-HU.mjs +1 -1
- package/i18n/index.js +67 -67
- package/i18n/index.mjs +67 -67
- package/i18n/it-IT.js +1 -1
- package/i18n/it-IT.mjs +1 -1
- package/i18n/ja-JP.js +1 -1
- package/i18n/ja-JP.mjs +1 -1
- package/i18n/ko-KR.js +1 -1
- package/i18n/ko-KR.mjs +1 -1
- package/i18n/lt-LT.js +1 -1
- package/i18n/lt-LT.mjs +1 -1
- package/i18n/lv-LV.js +1 -1
- package/i18n/lv-LV.mjs +1 -1
- package/i18n/nb-NO.js +1 -1
- package/i18n/nb-NO.mjs +1 -1
- package/i18n/nl-NL.js +1 -1
- package/i18n/nl-NL.mjs +1 -1
- package/i18n/pl-PL.js +1 -1
- package/i18n/pl-PL.mjs +1 -1
- package/i18n/pt-BR.js +1 -1
- package/i18n/pt-BR.mjs +1 -1
- package/i18n/pt-PT.js +1 -1
- package/i18n/pt-PT.mjs +1 -1
- package/i18n/ro-RO.js +1 -1
- package/i18n/ro-RO.mjs +1 -1
- package/i18n/ru-RU.js +1 -1
- package/i18n/ru-RU.mjs +1 -1
- package/i18n/sk-SK.js +1 -1
- package/i18n/sk-SK.mjs +1 -1
- package/i18n/sl-SI.js +1 -1
- package/i18n/sl-SI.mjs +1 -1
- package/i18n/sr-SP.js +1 -1
- package/i18n/sr-SP.mjs +1 -1
- package/i18n/sv-SE.js +1 -1
- package/i18n/sv-SE.mjs +1 -1
- package/i18n/tr-TR.js +1 -1
- package/i18n/tr-TR.mjs +1 -1
- package/i18n/uk-UA.js +1 -1
- package/i18n/uk-UA.mjs +1 -1
- package/i18n/zh-CN.js +1 -1
- package/i18n/zh-CN.mjs +1 -1
- package/i18n/zh-TW.js +1 -1
- package/i18n/zh-TW.mjs +1 -1
- package/package.json +20 -20
- package/src/Autocomplete.tsx +1 -1
- package/src/Breadcrumbs.tsx +25 -6
- package/src/Button.tsx +6 -0
- package/src/Calendar.tsx +51 -6
- package/src/Checkbox.tsx +25 -2
- package/src/Collection.tsx +1 -1
- package/src/ColorArea.tsx +15 -2
- package/src/ColorField.tsx +16 -1
- package/src/ColorPicker.tsx +5 -2
- package/src/ColorSlider.tsx +16 -2
- package/src/ColorSwatch.tsx +15 -2
- package/src/ColorSwatchPicker.tsx +18 -1
- package/src/ColorThumb.tsx +8 -2
- package/src/ColorWheel.tsx +24 -3
- package/src/ComboBox.tsx +18 -1
- package/src/DateField.tsx +40 -5
- package/src/DatePicker.tsx +27 -3
- package/src/Dialog.tsx +5 -0
- package/src/Disclosure.tsx +30 -5
- package/src/DragAndDrop.tsx +8 -2
- package/src/DropZone.tsx +16 -2
- package/src/FieldError.tsx +8 -2
- package/src/FileTrigger.tsx +1 -0
- package/src/Form.tsx +5 -0
- package/src/GridList.tsx +34 -2
- package/src/Group.tsx +29 -18
- package/src/HiddenDateInput.tsx +6 -4
- package/src/Input.tsx +21 -7
- package/src/Link.tsx +15 -2
- package/src/ListBox.tsx +46 -7
- package/src/Menu.tsx +30 -2
- package/src/Meter.tsx +16 -2
- package/src/Modal.tsx +19 -1
- package/src/NumberField.tsx +20 -2
- package/src/OverlayArrow.tsx +14 -2
- package/src/Popover.tsx +13 -1
- package/src/ProgressBar.tsx +16 -2
- package/src/RadioGroup.tsx +25 -2
- package/src/SearchField.tsx +35 -3
- package/src/Select.tsx +25 -2
- package/src/SelectionIndicator.tsx +8 -2
- package/src/Separator.tsx +10 -1
- package/src/Slider.tsx +35 -3
- package/src/Switch.tsx +18 -5
- package/src/Table.tsx +187 -67
- package/src/Tabs.tsx +150 -13
- package/src/TagGroup.tsx +29 -2
- package/src/TextArea.tsx +14 -2
- package/src/TextField.tsx +19 -1
- package/src/Toast.tsx +22 -2
- package/src/ToggleButton.tsx +13 -1
- package/src/ToggleButtonGroup.tsx +22 -3
- package/src/Toolbar.tsx +13 -1
- package/src/Tooltip.tsx +13 -1
- package/src/Tree.tsx +62 -33
- package/src/index.ts +7 -7
- package/src/utils.tsx +1 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA6EM,MAAM,0DAA6B,CAAA,GAAA,oBAAY,EAA8B;AAC7E,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA8C;AAOjF,SAAS,0CAAe,KAAmC;IAChE,IAAI,QAAQ,CAAA,GAAA,6BAAqB,EAAE;IACnC,IAAI,MAAM,CAAA,GAAA,aAAK,EAAoB;IACnC,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE,OAAO,OAAO;IAEnE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QAAQ,MAAM,MAAM;QACpB,qBAAqB,MAAM,mBAAmB;QAC9C,YAAY,MAAM,UAAU;QAC5B,kBAAkB,MAAM,gBAAgB;QACxC,SAAS,IAAM,MAAM,KAAK,CAAC;IAC7B;IAEA,IAAI,aAAa,CAAA,GAAA,wBAAgB,EAAE,MAAM,UAAU,EAAE,CAAC,CAAC,cAAc,MAAM,UAAU,IAAI;IACzF,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;uBACN;wBACA;YACA,WAAW,MAAM,SAAS;mBAC1B;QACF;IACF;IAEA,QAAQ,CAAA,GAAA,iBAAS,EAAE,OAAO;IAC1B,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,OAAO;IAEvC,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAElD,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,aAAa;QACnD,KAAK,MAAM,UAAU;QACrB,OAAO;YACL,GAAG,aAAa,KAAK;YACrB,0BAA0B,qBAAqB,GAAG,mBAAmB,CAAC,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,GAAG;YACvG,GAAG,YAAY,KAAK;QACtB;QACA,kBAAgB,sBAAA,uBAAA,YAAa;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,MAAM,SAAS,IAAI;qBACjC,gCAAC,CAAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Tooltip.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, FocusableElement, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {AriaPositionProps, mergeProps, OverlayContainer, Placement, PlacementAxis, PositionProps, useOverlayPosition, useTooltip, useTooltipTrigger} from 'react-aria';\nimport {\n ClassNameOrFunction,\n ContextValue,\n Provider,\n RenderProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {filterDOMProps, useEnterAnimation, useExitAnimation} from '@react-aria/utils';\nimport {FocusableProvider} from '@react-aria/focus';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, TooltipTriggerProps, TooltipTriggerState, useTooltipTriggerState} from 'react-stately';\nimport React, {createContext, CSSProperties, ForwardedRef, forwardRef, JSX, ReactNode, useContext, useRef} from 'react';\n\nexport interface TooltipTriggerComponentProps extends TooltipTriggerProps {\n children: ReactNode\n}\n\nexport interface TooltipProps extends PositionProps, Pick<AriaPositionProps, 'arrowBoundaryOffset'>, OverlayTriggerProps, AriaLabelingProps, RenderProps<TooltipRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-Tooltip'\n */\n className?: ClassNameOrFunction<TooltipRenderProps>,\n /**\n * The ref for the element which the tooltip positions itself with respect to.\n *\n * When used within a TooltipTrigger this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the tooltip is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the tooltip is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The placement of the tooltip with respect to the trigger.\n * @default 'top'\n */\n placement?: Placement\n}\n\nexport interface TooltipRenderProps {\n /**\n * The placement of the tooltip relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the tooltip is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the tooltip is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean,\n /**\n * State of the tooltip.\n */\n state: TooltipTriggerState\n}\n\nexport const TooltipTriggerStateContext = createContext<TooltipTriggerState | null>(null);\nexport const TooltipContext = createContext<ContextValue<TooltipProps, HTMLDivElement>>(null);\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerComponentProps): JSX.Element {\n let state = useTooltipTriggerState(props);\n let ref = useRef<FocusableElement>(null);\n let {triggerProps, tooltipProps} = useTooltipTrigger(props, state, ref);\n\n return (\n <Provider\n values={[\n [TooltipTriggerStateContext, state],\n [TooltipContext, {...tooltipProps, triggerRef: ref}]\n ]}>\n <FocusableProvider {...triggerProps} ref={ref}>\n {props.children}\n </FocusableProvider>\n </Provider>\n );\n}\n\n/**\n * A tooltip displays a description of an element on hover or focus.\n */\nexport const Tooltip = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tooltip({UNSTABLE_portalContainer, ...props}: TooltipProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, TooltipContext);\n let contextState = useContext(TooltipTriggerStateContext);\n let localState = useTooltipTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n if (!state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <OverlayContainer portalContainer={UNSTABLE_portalContainer}>\n <TooltipInner {...props} tooltipRef={ref} isExiting={isExiting} />\n </OverlayContainer>\n );\n});\n\nfunction TooltipInner(props: TooltipProps & {isExiting: boolean, tooltipRef: RefObject<HTMLDivElement | null>}) {\n let state = useContext(TooltipTriggerStateContext)!;\n let arrowRef = useRef<HTMLDivElement>(null);\n\n let {overlayProps, arrowProps, placement, triggerAnchorPoint} = useOverlayPosition({\n placement: props.placement || 'top',\n targetRef: props.triggerRef!,\n overlayRef: props.tooltipRef,\n arrowRef,\n offset: props.offset,\n crossOffset: props.crossOffset,\n isOpen: state.isOpen,\n arrowBoundaryOffset: props.arrowBoundaryOffset,\n shouldFlip: props.shouldFlip,\n containerPadding: props.containerPadding,\n onClose: () => state.close(true)\n });\n\n let isEntering = useEnterAnimation(props.tooltipRef, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Tooltip',\n values: {\n placement,\n isEntering,\n isExiting: props.isExiting,\n state\n }\n });\n\n props = mergeProps(props, overlayProps);\n let {tooltipProps} = useTooltip(props, state);\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <div\n {...mergeProps(DOMProps, renderProps, tooltipProps)}\n ref={props.tooltipRef}\n style={{\n ...overlayProps.style,\n '--trigger-anchor-point': triggerAnchorPoint ? `${triggerAnchorPoint.x}px ${triggerAnchorPoint.y}px` : undefined,\n ...renderProps.style\n } as CSSProperties}\n data-placement={placement ?? undefined}\n data-entering={isEntering || undefined}\n data-exiting={props.isExiting || undefined}>\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Tooltip.module.js.map"}
|
package/dist/Tree.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;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I7B;AAEA,MAAM,kEAA8B,CAAA,GAAA,uBAAS,EAAE;AAE/C,SAAS;IACP,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,4CAAiB;IAChE,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAkB;IACjC,IAAI,sBAAC,kBAAkB,EAAC,GAAG,iBAAkB,gBAAgB,CAAE;QAC7D,QAAQ;YAAC,MAAM;QAAM;IACvB,GAAG,WAAY;IACf,IAAI,eAAe,UAAW,YAAY,CAAC;QAAC,MAAM;IAAM;IACxD,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,kCAAgB;IAE5C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,0DAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;QAAE,OAAO;YAAC,UAAU;QAAU;qBAC1F,0DAAC;QAAI,MAAK;qBACR,0DAAC;QAAI,MAAK;QAAU,GAAG,mBAAmB;QAAG,GAAG,kBAAkB;QAAE,KAAK;;AAIjF","sources":["packages/react-aria-components/src/Tree.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaTreeItemOptions, AriaTreeProps, DraggableItemResult, DropIndicatorAria, DropIndicatorProps, DroppableCollectionResult, FocusScope, ListKeyboardDelegate, mergeProps, useCollator, useFocusRing, useGridListSelectionCheckbox, useHover, useId, useLocale, useTree, useTreeItem, useVisuallyHidden} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {ChildrenOrFunction, ContextValue, DEFAULT_SLOT, Provider, RenderProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {Collection, CollectionBuilder, CollectionNode, createBranchComponent, createLeafComponent, LoaderNode, useCachedChildren} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps} from './Collection';\nimport {DisabledBehavior, DragPreviewRenderer, Expandable, forwardRefType, GlobalDOMAttributes, HoverEvents, Key, LinkDOMProps, MultipleSelection, PressEvents, RefObject, SelectionMode} from '@react-types/shared';\nimport {DragAndDropContext, DropIndicatorContext, useDndPersistedKeys, useRenderDropIndicator} from './DragAndDrop';\nimport {DragAndDropHooks} from './useDragAndDrop';\nimport {DraggableCollectionState, DroppableCollectionState, Collection as ICollection, Node, SelectionBehavior, TreeState, useTreeState} from 'react-stately';\nimport {filterDOMProps, inertValue, LoadMoreSentinelProps, useLoadMoreSentinel, useObjectRef} from '@react-aria/utils';\nimport React, {createContext, ForwardedRef, forwardRef, JSX, ReactNode, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {SelectionIndicatorContext} from './SelectionIndicator';\nimport {SharedElementTransition} from './SharedElementTransition';\nimport {TreeDropTargetDelegate} from './TreeDropTargetDelegate';\nimport {useControlledState} from '@react-stately/utils';\n\nclass TreeCollection<T> implements ICollection<Node<T>> {\n private flattenedRows: Node<T>[];\n private keyMap: Map<Key, CollectionNode<T>> = new Map();\n private itemCount: number = 0;\n\n constructor(opts) {\n let {collection, expandedKeys} = opts;\n let {flattenedRows, keyMap, itemCount} = flattenTree<T>(collection, {expandedKeys});\n this.flattenedRows = flattenedRows;\n // Use generated keyMap because it contains the modified collection nodes (aka it adjusts the indexes so that they ignore the existence of the Content items)\n this.keyMap = keyMap;\n this.itemCount = itemCount;\n }\n\n // TODO: should this collection's getters reflect the flattened structure or the original structure\n // If we respresent the flattened structure, it is easier for the keyboard nav but harder to find all the nodes\n *[Symbol.iterator]() {\n yield* this.flattenedRows;\n }\n\n get size() {\n return this.itemCount;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) || null;\n }\n\n at(idx: number) {\n return this.flattenedRows[idx];\n }\n\n getFirstKey() {\n return this.flattenedRows[0]?.key;\n }\n\n getLastKey() {\n return this.flattenedRows[this.flattenedRows.length - 1]?.key;\n }\n\n getKeyAfter(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index + 1]?.key;\n }\n\n getKeyBefore(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index - 1]?.key;\n }\n\n // Note that this will return Content nodes in addition to nested TreeItems\n getChildren(key: Key): Iterable<Node<T>> {\n let keyMap = this.keyMap;\n return {\n *[Symbol.iterator]() {\n let parent = keyMap.get(key);\n let node = parent?.firstChildKey != null ? keyMap.get(parent.firstChildKey) : null;\n while (node) {\n yield node as Node<T>;\n node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined;\n }\n }\n };\n }\n\n getTextValue(key: Key): string {\n let item = this.getItem(key);\n return item ? item.textValue : '';\n }\n}\n\nexport interface TreeRenderProps {\n /**\n * Whether the tree has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the tree is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the tree is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /**\n * Whether the tree allows dragging.\n * @selector [data-allows-dragging]\n */\n allowsDragging: boolean,\n /**\n * State of the tree.\n */\n state: TreeState<unknown>\n}\n\nexport interface TreeEmptyStateRenderProps extends Omit<TreeRenderProps, 'isEmpty'> {}\n\nexport interface TreeProps<T> extends Omit<AriaTreeProps<T>, 'children'>, MultipleSelection, CollectionProps<T>, StyleRenderProps<TreeRenderProps>, SlotProps, Expandable, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * How multiple selection should behave in the tree.\n * @default \"toggle\"\n */\n selectionBehavior?: SelectionBehavior,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: TreeEmptyStateRenderProps) => ReactNode,\n /**\n * Whether `disabledKeys` applies to all interactions, or only selection.\n * @default 'all'\n */\n disabledBehavior?: DisabledBehavior,\n /** The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the Tree. */\n dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>\n}\n\n\nexport const TreeContext = createContext<ContextValue<TreeProps<any>, HTMLDivElement>>(null);\nexport const TreeStateContext = createContext<TreeState<any> | null>(null);\n\n/**\n * A tree provides users with a way to navigate nested hierarchical information, with support for keyboard navigation\n * and selection.\n */\nexport const Tree = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tree<T extends object>(props: TreeProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, TreeContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TreeInner props={props} collection={collection} treeRef={ref} />}\n </CollectionBuilder>\n );\n});\n\nconst EXPANSION_KEYS = {\n 'expand': {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\ninterface TreeInnerProps<T extends object> {\n props: TreeProps<T>,\n collection: ICollection<unknown>,\n treeRef: RefObject<HTMLDivElement | null>\n}\n\nfunction TreeInner<T extends object>({props, collection, treeRef: ref}: TreeInnerProps<T>) {\n const {dragAndDropHooks} = props;\n let {direction} = useLocale();\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let hasDragHooks = !!dragAndDropHooks?.useDraggableCollectionState;\n let hasDropHooks = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(hasDragHooks);\n let dropHooksProvided = useRef(hasDropHooks);\n\n useEffect(() => {\n if (dragHooksProvided.current !== hasDragHooks) {\n console.warn('Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n if (dropHooksProvided.current !== hasDropHooks) {\n console.warn('Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n }, [hasDragHooks, hasDropHooks]);\n let {\n selectionMode = 'none',\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: propDefaultExpandedKeys,\n onExpandedChange,\n disabledBehavior = 'all'\n } = props;\n let {CollectionRoot, isVirtualized, layoutDelegate, dropTargetDelegate: ctxDropTargetDelegate} = useContext(CollectionRendererContext);\n\n // Kinda annoying that we have to replicate this code here as well as in useTreeState, but don't want to add\n // flattenCollection stuff to useTreeState. Think about this later\n let [expandedKeys, setExpandedKeys] = useControlledState(\n propExpandedKeys ? convertExpanded(propExpandedKeys) : undefined,\n propDefaultExpandedKeys ? convertExpanded(propDefaultExpandedKeys) : new Set(),\n onExpandedChange\n );\n\n let flattenedCollection = useMemo(() => {\n return new TreeCollection<object>({collection, expandedKeys});\n }, [collection, expandedKeys]);\n\n let state = useTreeState({\n ...props,\n selectionMode,\n expandedKeys,\n onExpandedChange: setExpandedKeys,\n collection: flattenedCollection,\n children: undefined,\n disabledBehavior\n });\n\n let {gridProps} = useTree({\n ...props,\n isVirtualized,\n layoutDelegate\n }, state, ref);\n\n let dragState: DraggableCollectionState | undefined = undefined;\n let dropState: DroppableCollectionState | undefined = undefined;\n let droppableCollection: DroppableCollectionResult | undefined = undefined;\n let isRootDropTarget = false;\n let dragPreview: JSX.Element | null = null;\n let preview = useRef<DragPreviewRenderer>(null);\n\n if (hasDragHooks && dragAndDropHooks) {\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection: state.collection,\n selectionManager: state.selectionManager,\n preview: dragAndDropHooks.renderDragPreview ? preview : undefined\n });\n dragAndDropHooks.useDraggableCollection!({}, dragState, ref);\n\n let DragPreview = dragAndDropHooks.DragPreview!;\n dragPreview = dragAndDropHooks.renderDragPreview\n ? <DragPreview ref={preview}>{dragAndDropHooks.renderDragPreview}</DragPreview>\n : null;\n }\n\n let [treeDropTargetDelegate] = useState(() => new TreeDropTargetDelegate());\n if (hasDropHooks && dragAndDropHooks) {\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection: state.collection,\n selectionManager: state.selectionManager\n });\n let dropTargetDelegate = dragAndDropHooks.dropTargetDelegate || ctxDropTargetDelegate || new dragAndDropHooks.ListDropTargetDelegate(state.collection, ref, {direction});\n treeDropTargetDelegate.setup(dropTargetDelegate, state, direction);\n\n let keyboardDelegate =\n new ListKeyboardDelegate({\n collection: state.collection,\n collator,\n ref,\n disabledKeys: state.selectionManager.disabledKeys,\n disabledBehavior: state.selectionManager.disabledBehavior,\n direction,\n layoutDelegate\n });\n droppableCollection = dragAndDropHooks.useDroppableCollection!(\n {\n keyboardDelegate,\n dropTargetDelegate: treeDropTargetDelegate,\n onDropActivate: (e) => {\n // Expand collapsed item when dragging over. For keyboard, allow collapsing.\n if (e.target.type === 'item') {\n let key = e.target.key;\n let item = state.collection.getItem(key);\n let isExpanded = expandedKeys !== 'all' && expandedKeys.has(key);\n if (item && item.hasChildNodes && (!isExpanded || dragAndDropHooks?.isVirtualDragging?.())) {\n state.toggleKey(key);\n }\n }\n },\n onKeyDown: e => {\n let target = dropState?.target;\n if (target && target.type === 'item' && target.dropPosition === 'on') {\n let item = state.collection.getItem(target.key);\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && item?.hasChildNodes && !state.expandedKeys.has(target.key)) {\n state.toggleKey(target.key);\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && item?.hasChildNodes && state.expandedKeys.has(target.key)) {\n state.toggleKey(target.key);\n }\n }\n }\n },\n dropState,\n ref\n );\n\n // Prevent dropping items onto themselves or their descendants\n let originalGetDropOperation = dropState.getDropOperation;\n dropState.getDropOperation = (options) => {\n let {target, isInternal} = options;\n let currentDraggingKeys = dragState?.draggingKeys ?? new Set();\n\n if (isInternal && target.type === 'item' && currentDraggingKeys.size > 0) {\n if (currentDraggingKeys.has(target.key) && target.dropPosition === 'on') {\n return 'cancel';\n }\n\n let currentKey: Key | null = target.key;\n while (currentKey != null) {\n let item = state.collection.getItem(currentKey);\n let parentKey = item?.parentKey;\n if (parentKey != null && currentDraggingKeys.has(parentKey)) {\n return 'cancel';\n }\n currentKey = parentKey ?? null;\n }\n }\n\n return originalGetDropOperation(options);\n };\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let isTreeDraggable = !!(hasDragHooks && !dragState?.isDisabled);\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n isDropTarget: isRootDropTarget,\n selectionMode: state.selectionManager.selectionMode,\n allowsDragging: !!isTreeDraggable,\n state\n };\n\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-Tree',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {isEmpty, ...values} = renderValues;\n let content = props.renderEmptyState({...values});\n let treeGridRowProps = {\n 'aria-level': 1\n };\n\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}} {...treeGridRowProps}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <>\n <FocusScope>\n <div\n {...mergeProps(DOMProps, renderProps, gridProps, focusProps, droppableCollection?.collectionProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-drop-target={isRootDropTarget || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}\n data-allows-dragging={!!isTreeDraggable || undefined}>\n <Provider\n values={[\n [TreeStateContext, state],\n [DragAndDropContext, {dragAndDropHooks, dragState, dropState}],\n [DropIndicatorContext, {render: TreeDropIndicatorWrapper}]\n ]}>\n {hasDropHooks && <RootDropIndicator />}\n <SharedElementTransition>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={useDndPersistedKeys(state.selectionManager, dragAndDropHooks, dropState)}\n scrollRef={ref}\n renderDropIndicator={useRenderDropIndicator(dragAndDropHooks, dropState)} />\n </SharedElementTransition>\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n {dragPreview}\n </>\n );\n}\n\n// TODO: readd the rest of the render props when tree supports them\nexport interface TreeItemRenderProps extends ItemRenderProps {\n /**\n * Whether the tree item is expanded.\n * @selector [data-expanded]\n */\n isExpanded: boolean,\n /**\n * Whether the tree item has child tree items.\n * @selector [data-has-child-items]\n */\n hasChildItems: boolean,\n /**\n * What level the tree item has within the tree.\n * @selector [data-level=\"number\"]\n */\n level: number,\n /**\n * Whether the tree item's children have keyboard focus.\n * @selector [data-focus-visible-within]\n */\n isFocusVisibleWithin: boolean,\n /** The state of the tree. */\n state: TreeState<unknown>,\n /** The unique id of the tree row. */\n id: Key\n}\n\nexport interface TreeItemContentRenderProps extends TreeItemRenderProps {}\n\n// The TreeItemContent is the one that accepts RenderProps because we would get much more complicated logic in TreeItem otherwise since we'd\n// need to do a bunch of check to figure out what is the Content and what are the actual collection elements (aka child rows) of the TreeItem\nexport interface TreeItemContentProps extends Pick<RenderProps<TreeItemContentRenderProps>, 'children'> {}\n\nclass TreeContentNode extends CollectionNode<any> {\n static readonly type = 'content';\n}\n\nexport const TreeItemContent = /*#__PURE__*/ createLeafComponent(TreeContentNode, function TreeItemContent(props: TreeItemContentProps) {\n let values = useContext(TreeItemContentContext)!;\n let renderProps = useRenderProps({\n children: props.children,\n values\n });\n return (\n <CollectionRendererContext.Provider value={DefaultCollectionRenderer}>\n {renderProps.children}\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const TreeItemContentContext = createContext<TreeItemContentRenderProps | null>(null);\n\nexport interface TreeItemProps<T = object> extends StyleRenderProps<TreeItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, Pick<AriaTreeItemOptions, 'hasChildItems'>, Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {\n /** The unique id of the tree row. */\n id?: Key,\n /** The object value that this tree item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the tree item's contents, used for features like typeahead. */\n textValue: string,\n /** An accessibility label for this tree item. */\n 'aria-label'?: string,\n /** The content of the tree item along with any nested children. Supports static nested tree items or use of a Collection to dynamically render nested tree items. */\n children: ReactNode,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on this tree item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\nclass TreeItemNode extends CollectionNode<any> {\n static readonly type = 'item';\n}\n\n/**\n * A TreeItem represents an individual item in a Tree.\n */\nexport const TreeItem = /*#__PURE__*/ createBranchComponent(TreeItemNode, <T extends object>(props: TreeItemProps<T>, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) => {\n let state = useContext(TreeStateContext)!;\n ref = useObjectRef<HTMLDivElement>(ref);\n let {dragAndDropHooks, dragState, dropState} = useContext(DragAndDropContext)!;\n\n // TODO: remove this when we support description in tree row\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {rowProps, gridCellProps, expandButtonProps, descriptionProps, ...states} = useTreeItem({\n node: item,\n shouldSelectOnPressUp: !!dragState\n }, state, ref);\n let isExpanded = rowProps['aria-expanded'] === true;\n let hasChildItems = props.hasChildItems || [...state.collection.getChildren!(item.key)]?.length > 1;\n let level = rowProps['aria-level'] || 1;\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: props.onHoverStart,\n onHoverChange: props.onHoverChange,\n onHoverEnd: props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let draggableItem: DraggableItemResult | null = null;\n if (dragState && dragAndDropHooks) {\n draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasDragButton: true}, dragState);\n }\n\n let dropIndicator: DropIndicatorAria | null = null;\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let dropIndicatorRef = useRef<HTMLDivElement>(null);\n let activateButtonRef = useRef<HTMLDivElement>(null);\n let {visuallyHiddenProps} = useVisuallyHidden();\n if (dropState && dragAndDropHooks) {\n dropIndicator = dragAndDropHooks.useDropIndicator!({\n target: {type: 'item', key: item.key, dropPosition: 'on'},\n activateButtonRef\n }, dropState, dropIndicatorRef);\n }\n\n let isDragging = dragState && dragState.isDragging(item.key);\n let isDropTarget = dropIndicator?.isDropTarget;\n\n let selectionMode = state.selectionManager.selectionMode;\n let selectionBehavior = state.selectionManager.selectionBehavior;\n let renderPropValues = React.useMemo<TreeItemContentRenderProps>(() => ({\n ...states,\n isHovered,\n isFocusVisible,\n isExpanded,\n hasChildItems,\n level,\n selectionMode,\n selectionBehavior,\n isFocusVisibleWithin,\n state,\n id: item.key,\n allowsDragging: !!dragState,\n isDragging,\n isDropTarget\n }), [states, isHovered, isFocusVisible, isExpanded, hasChildItems, level, isFocusVisibleWithin, state, item.key, dragState, isDragging, isDropTarget, selectionBehavior, selectionMode]);\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeItem',\n defaultStyle: {\n // @ts-ignore\n '--tree-item-level': level\n },\n values: renderPropValues\n });\n\n useEffect(() => {\n if (!item.textValue && process.env.NODE_ENV !== 'production') {\n console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n useEffect(() => {\n if (hasChildItems && !expandButtonRef.current && process.env.NODE_ENV !== 'production') {\n console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');\n }\n // eslint-disable-next-line\n }, []);\n\n let dragButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (dragState && !dragButtonRef.current && process.env.NODE_ENV !== 'production') {\n console.warn('Draggable items in a Tree must contain a <Button slot=\"drag\"> element so that keyboard and screen reader users can drag them.');\n }\n // eslint-disable-next-line\n }, []);\n\n let children = useCachedChildren({\n items: state.collection.getChildren!(item.key),\n children: item => {\n switch (item.type) {\n case 'content': {\n return item.render!(item);\n }\n // Skip item since we don't render the nested rows as children of the parent row, the flattened collection\n // will render them each as siblings instead\n case 'loader':\n case 'item':\n return <></>;\n default:\n throw new Error('Unsupported element type in TreeRow: ' + item.type);\n }\n }\n });\n\n let activateButtonId = useId();\n let DOMProps = filterDOMProps(props as any, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <>\n {dropIndicator && !dropIndicator.isHidden && (\n <div\n role=\"row\"\n aria-level={rowProps['aria-level']}\n aria-expanded={rowProps['aria-expanded']}\n aria-label={dropIndicator.dropIndicatorProps['aria-label']}>\n <div role=\"gridcell\" aria-colindex={1} style={{display: 'contents'}}>\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator.dropIndicatorProps} ref={dropIndicatorRef} />\n {rowProps['aria-expanded'] != null ? (\n // Button to allow touch screen reader users to expand the item while dragging.\n <div\n role=\"button\"\n {...visuallyHiddenProps}\n id={activateButtonId}\n aria-label={expandButtonProps['aria-label']}\n aria-labelledby={`${activateButtonId} ${rowProps.id}`}\n tabIndex={-1}\n ref={activateButtonRef} />\n ) : null}\n </div>\n </div>\n )}\n <div\n {...mergeProps(\n DOMProps,\n rowProps,\n focusProps,\n hoverProps,\n focusWithinProps,\n draggableItem?.dragProps\n )}\n {...renderProps}\n ref={ref}\n // TODO: missing selectionBehavior, hasAction and allowsSelection data attribute equivalents (available in renderProps). Do we want those?\n data-expanded={(hasChildItems && isExpanded) || undefined}\n data-has-child-items={hasChildItems || undefined}\n data-level={level}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}\n data-allows-dragging={!!dragState || undefined}\n data-dragging={isDragging || undefined}\n data-drop-target={isDropTarget || undefined}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n selection: checkboxProps\n }\n }],\n // TODO: support description in the tree row\n // TODO: don't think I need to pass isExpanded to the button here since it can be sourced from the renderProps? Might be worthwhile passing it down?\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n chevron: {\n ...expandButtonProps,\n ref: expandButtonRef\n },\n drag: {\n ...draggableItem?.dragButtonProps,\n ref: dragButtonRef,\n style: {\n pointerEvents: 'none'\n }\n }\n }\n }],\n [TreeItemContentContext, {\n ...renderPropValues\n }],\n [SelectionIndicatorContext, {isSelected: states.isSelected}]\n ]}>\n {children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nexport interface TreeLoadMoreItemRenderProps {\n /**\n * What level the tree item has within the tree.\n * @selector [data-level]\n */\n level: number\n}\n\nexport interface TreeLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection'>, RenderProps<TreeLoadMoreItemRenderProps> {\n /**\n * The load more spinner to render when loading additional items.\n */\n children?: ChildrenOrFunction<TreeLoadMoreItemRenderProps>,\n /**\n * Whether or not the loading spinner should be rendered or not.\n */\n isLoading?: boolean\n}\n\nexport const TreeLoadMoreItem = createLeafComponent(LoaderNode, function TreeLoadingSentinel<T extends object>(props: TreeLoadMoreItemProps, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let {isVirtualized} = useContext(CollectionRendererContext);\n let state = useContext(TreeStateContext)!;\n let {isLoading, onLoadMore, scrollOffset, ...otherProps} = props;\n let sentinelRef = useRef(null);\n let memoedLoadMoreProps = useMemo(() => ({\n onLoadMore,\n // this collection will update anytime a row is expanded/collapsed becaused the flattenedRows will change.\n // This means onLoadMore will trigger but that might be ok cause the user should have logic to handle multiple loadMore calls\n collection: state?.collection,\n sentinelRef,\n scrollOffset\n }), [onLoadMore, scrollOffset, state?.collection]);\n useLoadMoreSentinel(memoedLoadMoreProps, sentinelRef);\n\n ref = useObjectRef<HTMLDivElement>(ref);\n let {rowProps, gridCellProps} = useTreeItem({node: item}, state, ref);\n let level = rowProps['aria-level'] || 1;\n\n // For now don't include aria-posinset and aria-setsize on loader since they aren't keyboard focusable\n // Arguably shouldn't include them ever since it might be confusing to the user to include the loaders as part of the\n // item count\n let ariaProps = {\n role: 'row',\n 'aria-level': rowProps['aria-level']\n };\n\n let renderProps = useRenderProps({\n ...otherProps,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeLoader',\n values: {\n level\n }\n });\n let style = {};\n\n if (isVirtualized) {\n style = {display: 'contents'};\n }\n\n return (\n <>\n {/* Alway render the sentinel. For now onus is on the user for styling when using flex + gap (this would introduce a gap even though it doesn't take room) */}\n {/* @ts-ignore - compatibility with React < 19 */}\n <div style={{position: 'relative', width: 0, height: 0}} inert={inertValue(true)} >\n <div data-testid=\"loadMoreSentinel\" ref={sentinelRef} style={{position: 'absolute', height: 1, width: 1}} />\n </div>\n {isLoading && renderProps.children && (\n <div\n ref={ref}\n {...mergeProps(filterDOMProps(props as any), ariaProps)}\n {...renderProps}\n data-level={level}>\n <div {...gridCellProps} style={style}>\n {renderProps.children}\n </div>\n </div>\n )}\n </>\n );\n});\n\nfunction convertExpanded(expanded: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (!expanded) {\n return new Set<Key>();\n }\n\n return expanded === 'all'\n ? 'all'\n : new Set(expanded);\n}\ninterface TreeGridCollectionOptions {\n expandedKeys: Set<Key>\n}\n\ninterface FlattenedTree<T> {\n flattenedRows: Node<T>[],\n keyMap: Map<Key, CollectionNode<T>>,\n itemCount: number\n}\n\nfunction flattenTree<T>(collection: TreeCollection<T>, opts: TreeGridCollectionOptions): FlattenedTree<T> {\n let {\n expandedKeys = new Set()\n } = opts;\n let keyMap: Map<Key, CollectionNode<T>> = new Map();\n let flattenedRows: Node<T>[] = [];\n // Need to count the items here because BaseCollection will return the full item count regardless if items are hidden via collapsed rows\n let itemCount = 0;\n let parentLookup: Map<Key, boolean> = new Map();\n\n let visitNode = (node: Node<T>) => {\n if (node.type === 'item' || node.type === 'loader') {\n let parentKey = node?.parentKey;\n let clone = {...node};\n if (parentKey != null) {\n // TODO: assumes that non item content node (aka TreeItemContent always placed before Collection) will be always placed before the child rows. If we can't make this assumption then we can filter out\n // every non-item per level and assign indicies based off the node's position in said filtered array\n let hasContentNode = [...collection.getChildren(parentKey)][0].type !== 'item';\n if (hasContentNode) {\n clone.index = node?.index != null ? node?.index - 1 : 0;\n }\n\n // For loader nodes that have a parent (aka non-root level loaders), these need their levels incremented by 1 for parity with their sibiling rows\n // (Collection only increments the level if it is a \"item\" type node).\n if (node.type === 'loader') {\n clone.level = node.level + 1;\n }\n\n keyMap.set(clone.key, clone as CollectionNode<T>);\n } else {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n // Grab the modified node from the key map so our flattened list and modified key map point to the same nodes\n let modifiedNode = keyMap.get(node.key) || node;\n if (modifiedNode.level === 0 || (modifiedNode.parentKey != null && expandedKeys.has(modifiedNode.parentKey) && parentLookup.get(modifiedNode.parentKey))) {\n if (modifiedNode.type === 'item') {\n itemCount++;\n }\n\n flattenedRows.push(modifiedNode);\n parentLookup.set(modifiedNode.key, true);\n }\n } else if (node.type !== null) {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n for (let child of collection.getChildren(node.key)) {\n visitNode(child);\n }\n };\n\n for (let node of collection) {\n visitNode(node);\n }\n\n return {\n flattenedRows,\n keyMap,\n itemCount\n };\n}\n\nfunction TreeDropIndicatorWrapper(props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>): JSX.Element | null {\n ref = useObjectRef(ref);\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext)!;\n let buttonRef = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps, isHidden, isDropTarget} = dragAndDropHooks!.useDropIndicator!(\n props,\n dropState!,\n buttonRef\n );\n\n if (isHidden) {\n return null;\n }\n\n let level = dropState && props.target.type === 'item' ? (dropState.collection.getItem(props.target.key)?.level || 0) + 1 : 1;\n return (\n <TreeDropIndicatorForwardRef\n {...props}\n dropIndicatorProps={dropIndicatorProps}\n isDropTarget={isDropTarget}\n ref={ref}\n buttonRef={buttonRef}\n level={level} />\n );\n}\n\ninterface TreeDropIndicatorProps extends DropIndicatorProps {\n dropIndicatorProps: React.HTMLAttributes<HTMLElement>,\n isDropTarget: boolean,\n buttonRef: RefObject<HTMLDivElement | null>,\n level: number\n}\n\nfunction TreeDropIndicator(props: TreeDropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n let {\n dropIndicatorProps,\n isDropTarget,\n buttonRef,\n level,\n ...otherProps\n } = props;\n let {visuallyHiddenProps} = useVisuallyHidden();\n let renderProps = useRenderProps({\n ...otherProps,\n defaultClassName: 'react-aria-DropIndicator',\n defaultStyle: {\n position: 'relative',\n // @ts-ignore\n '--tree-item-level': level\n },\n values: {\n isDropTarget\n }\n });\n\n return (\n <div\n {...renderProps}\n role=\"row\"\n aria-level={level}\n ref={ref as RefObject<HTMLDivElement | null>}\n data-drop-target={isDropTarget || undefined}>\n <div role=\"gridcell\">\n <div {...visuallyHiddenProps} role=\"button\" {...dropIndicatorProps} ref={buttonRef} />\n {renderProps.children}\n </div>\n </div>\n );\n}\n\nconst TreeDropIndicatorForwardRef = forwardRef(TreeDropIndicator);\n\nfunction RootDropIndicator() {\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let ref = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!({\n target: {type: 'root'}\n }, dropState!, ref);\n let isDropTarget = dropState!.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']} style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Tree.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AA8BD,MAAM;IAcJ,mGAAmG;IACnG,+GAA+G;IAC/G,CAAC,CAAC,OAAO,QAAQ,CAAC,GAAG;QACnB,OAAO,IAAI,CAAC,aAAa;IAC3B;IAEA,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,SAAS;IACvB;IAEA,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI;IACzB;IAEA,QAAQ,GAAQ,EAAkB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ;IACjC;IAEA,GAAG,GAAW,EAAE;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI;IAChC;IAEA,cAAc;YACL;QAAP,QAAO,uBAAA,IAAI,CAAC,aAAa,CAAC,EAAE,cAArB,2CAAA,qBAAuB,GAAG;IACnC;IAEA,aAAa;YACJ;QAAP,QAAO,uBAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,EAAE,cAAjD,2CAAA,qBAAmD,GAAG;IAC/D;IAEA,YAAY,GAAQ,EAAE;YAEb;QADP,IAAI,QAAQ,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA,MAAO,IAAI,GAAG,KAAK;QAC5D,Q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,GAAG;IACJ,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,kCAAgB;IAC5C,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,UAAU;QACb,kBAAkB;QAClB,cAAc;YACZ,UAAU;YACV,aAAa;YACb,qBAAqB;QACvB;QACA,QAAQ;0BACN;QACF;IACF;IAEA,qBACE,0DAAC;QACE,GAAG,WAAW;QACf,MAAK;QACL,cAAY;QACZ,KAAK;QACL,oBAAkB,gBAAgB;qBAClC,0DAAC;QAAI,MAAK;qBACR,0DAAC;QAAK,GAAG,mBAAmB;QAAE,MAAK;QAAU,GAAG,kBAAkB;QAAE,KAAK;QACxE,YAAY,QAAQ;AAI7B;AAEA,MAAM,kEAA8B,CAAA,GAAA,uBAAS,EAAE;AAE/C,SAAS;IACP,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,4CAAiB;IAChE,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAkB;IACjC,IAAI,sBAAC,kBAAkB,EAAC,GAAG,iBAAkB,gBAAgB,CAAE;QAC7D,QAAQ;YAAC,MAAM;QAAM;IACvB,GAAG,WAAY;IACf,IAAI,eAAe,UAAW,YAAY,CAAC;QAAC,MAAM;IAAM;IACxD,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,kCAAgB;IAE5C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,0DAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;QAAE,OAAO;YAAC,UAAU;QAAU;qBAC1F,0DAAC;QAAI,MAAK;qBACR,0DAAC;QAAI,MAAK;QAAU,GAAG,mBAAmB;QAAG,GAAG,kBAAkB;QAAE,KAAK;;AAIjF","sources":["packages/react-aria-components/src/Tree.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaTreeItemOptions, AriaTreeProps, DraggableItemResult, DropIndicatorAria, DropIndicatorProps, DroppableCollectionResult, FocusScope, ListKeyboardDelegate, mergeProps, useCollator, useFocusRing, useGridListSelectionCheckbox, useHover, useId, useLocale, useTree, useTreeItem, useVisuallyHidden} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {\n ChildrenOrFunction,\n ClassNameOrFunction,\n ContextValue,\n DEFAULT_SLOT,\n Provider,\n RenderProps,\n SlotProps,\n StyleRenderProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {Collection, CollectionBuilder, CollectionNode, createBranchComponent, createLeafComponent, LoaderNode, useCachedChildren} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps} from './Collection';\nimport {DisabledBehavior, DragPreviewRenderer, Expandable, forwardRefType, GlobalDOMAttributes, HoverEvents, Key, LinkDOMProps, MultipleSelection, PressEvents, RefObject, SelectionMode} from '@react-types/shared';\nimport {DragAndDropContext, DropIndicatorContext, useDndPersistedKeys, useRenderDropIndicator} from './DragAndDrop';\nimport {DragAndDropHooks} from './useDragAndDrop';\nimport {DraggableCollectionState, DroppableCollectionState, Collection as ICollection, Node, SelectionBehavior, TreeState, useTreeState} from 'react-stately';\nimport {filterDOMProps, inertValue, LoadMoreSentinelProps, useLoadMoreSentinel, useObjectRef} from '@react-aria/utils';\nimport React, {createContext, ForwardedRef, forwardRef, JSX, ReactNode, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {SelectionIndicatorContext} from './SelectionIndicator';\nimport {SharedElementTransition} from './SharedElementTransition';\nimport {TreeDropTargetDelegate} from './TreeDropTargetDelegate';\nimport {useControlledState} from '@react-stately/utils';\n\nclass TreeCollection<T> implements ICollection<Node<T>> {\n private flattenedRows: Node<T>[];\n private keyMap: Map<Key, CollectionNode<T>> = new Map();\n private itemCount: number = 0;\n\n constructor(opts) {\n let {collection, expandedKeys} = opts;\n let {flattenedRows, keyMap, itemCount} = flattenTree<T>(collection, {expandedKeys});\n this.flattenedRows = flattenedRows;\n // Use generated keyMap because it contains the modified collection nodes (aka it adjusts the indexes so that they ignore the existence of the Content items)\n this.keyMap = keyMap;\n this.itemCount = itemCount;\n }\n\n // TODO: should this collection's getters reflect the flattened structure or the original structure\n // If we respresent the flattened structure, it is easier for the keyboard nav but harder to find all the nodes\n *[Symbol.iterator]() {\n yield* this.flattenedRows;\n }\n\n get size() {\n return this.itemCount;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) || null;\n }\n\n at(idx: number) {\n return this.flattenedRows[idx];\n }\n\n getFirstKey() {\n return this.flattenedRows[0]?.key;\n }\n\n getLastKey() {\n return this.flattenedRows[this.flattenedRows.length - 1]?.key;\n }\n\n getKeyAfter(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index + 1]?.key;\n }\n\n getKeyBefore(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index - 1]?.key;\n }\n\n // Note that this will return Content nodes in addition to nested TreeItems\n getChildren(key: Key): Iterable<Node<T>> {\n let keyMap = this.keyMap;\n return {\n *[Symbol.iterator]() {\n let parent = keyMap.get(key);\n let node = parent?.firstChildKey != null ? keyMap.get(parent.firstChildKey) : null;\n while (node) {\n yield node as Node<T>;\n node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined;\n }\n }\n };\n }\n\n getTextValue(key: Key): string {\n let item = this.getItem(key);\n return item ? item.textValue : '';\n }\n}\n\nexport interface TreeRenderProps {\n /**\n * Whether the tree has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the tree is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the tree is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /**\n * Whether the tree allows dragging.\n * @selector [data-allows-dragging]\n */\n allowsDragging: boolean,\n /**\n * State of the tree.\n */\n state: TreeState<unknown>\n}\n\nexport interface TreeEmptyStateRenderProps extends Omit<TreeRenderProps, 'isEmpty'> {}\n\nexport interface TreeProps<T> extends Omit<AriaTreeProps<T>, 'children'>, MultipleSelection, CollectionProps<T>, StyleRenderProps<TreeRenderProps>, SlotProps, Expandable, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-Tree'\n */\n className?: ClassNameOrFunction<TreeRenderProps>,\n /**\n * How multiple selection should behave in the tree.\n * @default \"toggle\"\n */\n selectionBehavior?: SelectionBehavior,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: TreeEmptyStateRenderProps) => ReactNode,\n /**\n * Whether `disabledKeys` applies to all interactions, or only selection.\n * @default 'all'\n */\n disabledBehavior?: DisabledBehavior,\n /** The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the Tree. */\n dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>\n}\n\n\nexport const TreeContext = createContext<ContextValue<TreeProps<any>, HTMLDivElement>>(null);\nexport const TreeStateContext = createContext<TreeState<any> | null>(null);\n\n/**\n * A tree provides users with a way to navigate nested hierarchical information, with support for keyboard navigation\n * and selection.\n */\nexport const Tree = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tree<T extends object>(props: TreeProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, TreeContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TreeInner props={props} collection={collection} treeRef={ref} />}\n </CollectionBuilder>\n );\n});\n\nconst EXPANSION_KEYS = {\n 'expand': {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\ninterface TreeInnerProps<T extends object> {\n props: TreeProps<T>,\n collection: ICollection<unknown>,\n treeRef: RefObject<HTMLDivElement | null>\n}\n\nfunction TreeInner<T extends object>({props, collection, treeRef: ref}: TreeInnerProps<T>) {\n const {dragAndDropHooks} = props;\n let {direction} = useLocale();\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let hasDragHooks = !!dragAndDropHooks?.useDraggableCollectionState;\n let hasDropHooks = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(hasDragHooks);\n let dropHooksProvided = useRef(hasDropHooks);\n\n useEffect(() => {\n if (dragHooksProvided.current !== hasDragHooks) {\n console.warn('Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n if (dropHooksProvided.current !== hasDropHooks) {\n console.warn('Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n }, [hasDragHooks, hasDropHooks]);\n let {\n selectionMode = 'none',\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: propDefaultExpandedKeys,\n onExpandedChange,\n disabledBehavior = 'all'\n } = props;\n let {CollectionRoot, isVirtualized, layoutDelegate, dropTargetDelegate: ctxDropTargetDelegate} = useContext(CollectionRendererContext);\n\n // Kinda annoying that we have to replicate this code here as well as in useTreeState, but don't want to add\n // flattenCollection stuff to useTreeState. Think about this later\n let [expandedKeys, setExpandedKeys] = useControlledState(\n propExpandedKeys ? convertExpanded(propExpandedKeys) : undefined,\n propDefaultExpandedKeys ? convertExpanded(propDefaultExpandedKeys) : new Set(),\n onExpandedChange\n );\n\n let flattenedCollection = useMemo(() => {\n return new TreeCollection<object>({collection, expandedKeys});\n }, [collection, expandedKeys]);\n\n let state = useTreeState({\n ...props,\n selectionMode,\n expandedKeys,\n onExpandedChange: setExpandedKeys,\n collection: flattenedCollection,\n children: undefined,\n disabledBehavior\n });\n\n let {gridProps} = useTree({\n ...props,\n isVirtualized,\n layoutDelegate\n }, state, ref);\n\n let dragState: DraggableCollectionState | undefined = undefined;\n let dropState: DroppableCollectionState | undefined = undefined;\n let droppableCollection: DroppableCollectionResult | undefined = undefined;\n let isRootDropTarget = false;\n let dragPreview: JSX.Element | null = null;\n let preview = useRef<DragPreviewRenderer>(null);\n\n if (hasDragHooks && dragAndDropHooks) {\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection: state.collection,\n selectionManager: state.selectionManager,\n preview: dragAndDropHooks.renderDragPreview ? preview : undefined\n });\n dragAndDropHooks.useDraggableCollection!({}, dragState, ref);\n\n let DragPreview = dragAndDropHooks.DragPreview!;\n dragPreview = dragAndDropHooks.renderDragPreview\n ? <DragPreview ref={preview}>{dragAndDropHooks.renderDragPreview}</DragPreview>\n : null;\n }\n\n let [treeDropTargetDelegate] = useState(() => new TreeDropTargetDelegate());\n if (hasDropHooks && dragAndDropHooks) {\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection: state.collection,\n selectionManager: state.selectionManager\n });\n let dropTargetDelegate = dragAndDropHooks.dropTargetDelegate || ctxDropTargetDelegate || new dragAndDropHooks.ListDropTargetDelegate(state.collection, ref, {direction});\n treeDropTargetDelegate.setup(dropTargetDelegate, state, direction);\n\n let keyboardDelegate =\n new ListKeyboardDelegate({\n collection: state.collection,\n collator,\n ref,\n disabledKeys: state.selectionManager.disabledKeys,\n disabledBehavior: state.selectionManager.disabledBehavior,\n direction,\n layoutDelegate\n });\n droppableCollection = dragAndDropHooks.useDroppableCollection!(\n {\n keyboardDelegate,\n dropTargetDelegate: treeDropTargetDelegate,\n onDropActivate: (e) => {\n // Expand collapsed item when dragging over. For keyboard, allow collapsing.\n if (e.target.type === 'item') {\n let key = e.target.key;\n let item = state.collection.getItem(key);\n let isExpanded = expandedKeys !== 'all' && expandedKeys.has(key);\n if (item && item.hasChildNodes && (!isExpanded || dragAndDropHooks?.isVirtualDragging?.())) {\n state.toggleKey(key);\n }\n }\n },\n onKeyDown: e => {\n let target = dropState?.target;\n if (target && target.type === 'item' && target.dropPosition === 'on') {\n let item = state.collection.getItem(target.key);\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && item?.hasChildNodes && !state.expandedKeys.has(target.key)) {\n state.toggleKey(target.key);\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && item?.hasChildNodes && state.expandedKeys.has(target.key)) {\n state.toggleKey(target.key);\n }\n }\n }\n },\n dropState,\n ref\n );\n\n // Prevent dropping items onto themselves or their descendants\n let originalGetDropOperation = dropState.getDropOperation;\n dropState.getDropOperation = (options) => {\n let {target, isInternal} = options;\n let currentDraggingKeys = dragState?.draggingKeys ?? new Set();\n\n if (isInternal && target.type === 'item' && currentDraggingKeys.size > 0) {\n if (currentDraggingKeys.has(target.key) && target.dropPosition === 'on') {\n return 'cancel';\n }\n\n let currentKey: Key | null = target.key;\n while (currentKey != null) {\n let item = state.collection.getItem(currentKey);\n let parentKey = item?.parentKey;\n if (parentKey != null && currentDraggingKeys.has(parentKey)) {\n return 'cancel';\n }\n currentKey = parentKey ?? null;\n }\n }\n\n return originalGetDropOperation(options);\n };\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let isTreeDraggable = !!(hasDragHooks && !dragState?.isDisabled);\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n isDropTarget: isRootDropTarget,\n selectionMode: state.selectionManager.selectionMode,\n allowsDragging: !!isTreeDraggable,\n state\n };\n\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-Tree',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {isEmpty, ...values} = renderValues;\n let content = props.renderEmptyState({...values});\n let treeGridRowProps = {\n 'aria-level': 1\n };\n\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}} {...treeGridRowProps}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <>\n <FocusScope>\n <div\n {...mergeProps(DOMProps, renderProps, gridProps, focusProps, droppableCollection?.collectionProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-drop-target={isRootDropTarget || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}\n data-allows-dragging={!!isTreeDraggable || undefined}>\n <Provider\n values={[\n [TreeStateContext, state],\n [DragAndDropContext, {dragAndDropHooks, dragState, dropState}],\n [DropIndicatorContext, {render: TreeDropIndicatorWrapper}]\n ]}>\n {hasDropHooks && <RootDropIndicator />}\n <SharedElementTransition>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={useDndPersistedKeys(state.selectionManager, dragAndDropHooks, dropState)}\n scrollRef={ref}\n renderDropIndicator={useRenderDropIndicator(dragAndDropHooks, dropState)} />\n </SharedElementTransition>\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n {dragPreview}\n </>\n );\n}\n\n// TODO: readd the rest of the render props when tree supports them\nexport interface TreeItemRenderProps extends ItemRenderProps {\n /**\n * Whether the tree item is expanded.\n * @selector [data-expanded]\n */\n isExpanded: boolean,\n /**\n * Whether the tree item has child tree items.\n * @selector [data-has-child-items]\n */\n hasChildItems: boolean,\n /**\n * What level the tree item has within the tree.\n * @selector [data-level=\"number\"]\n */\n level: number,\n /**\n * Whether the tree item's children have keyboard focus.\n * @selector [data-focus-visible-within]\n */\n isFocusVisibleWithin: boolean,\n /** The state of the tree. */\n state: TreeState<unknown>,\n /** The unique id of the tree row. */\n id: Key\n}\n\nexport interface TreeItemContentRenderProps extends TreeItemRenderProps {}\n\n// The TreeItemContent is the one that accepts RenderProps because we would get much more complicated logic in TreeItem otherwise since we'd\n// need to do a bunch of check to figure out what is the Content and what are the actual collection elements (aka child rows) of the TreeItem\nexport interface TreeItemContentProps {\n /** The children of the component. A function may be provided to alter the children based on component state. */\n children: ChildrenOrFunction<TreeItemContentRenderProps>\n}\n\nclass TreeContentNode extends CollectionNode<any> {\n static readonly type = 'content';\n}\n\nexport const TreeItemContent = /*#__PURE__*/ createLeafComponent(TreeContentNode, function TreeItemContent(props: TreeItemContentProps) {\n let values = useContext(TreeItemContentContext)!;\n let renderProps = useRenderProps({\n children: props.children,\n values\n });\n return (\n <CollectionRendererContext.Provider value={DefaultCollectionRenderer}>\n {renderProps.children}\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const TreeItemContentContext = createContext<TreeItemContentRenderProps | null>(null);\n\nexport interface TreeItemProps<T = object> extends StyleRenderProps<TreeItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, Pick<AriaTreeItemOptions, 'hasChildItems'>, Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-TreeItem'\n */\n className?: ClassNameOrFunction<TreeItemRenderProps>,\n /** The unique id of the tree row. */\n id?: Key,\n /** The object value that this tree item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the tree item's contents, used for features like typeahead. */\n textValue: string,\n /** An accessibility label for this tree item. */\n 'aria-label'?: string,\n /** The content of the tree item along with any nested children. Supports static nested tree items or use of a Collection to dynamically render nested tree items. */\n children: ReactNode,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on this tree item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\nclass TreeItemNode extends CollectionNode<any> {\n static readonly type = 'item';\n}\n\n/**\n * A TreeItem represents an individual item in a Tree.\n */\nexport const TreeItem = /*#__PURE__*/ createBranchComponent(TreeItemNode, <T extends object>(props: TreeItemProps<T>, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) => {\n let state = useContext(TreeStateContext)!;\n ref = useObjectRef<HTMLDivElement>(ref);\n let {dragAndDropHooks, dragState, dropState} = useContext(DragAndDropContext)!;\n\n // TODO: remove this when we support description in tree row\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {rowProps, gridCellProps, expandButtonProps, descriptionProps, ...states} = useTreeItem({\n node: item,\n shouldSelectOnPressUp: !!dragState\n }, state, ref);\n let isExpanded = rowProps['aria-expanded'] === true;\n let hasChildItems = props.hasChildItems || [...state.collection.getChildren!(item.key)]?.length > 1;\n let level = rowProps['aria-level'] || 1;\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: props.onHoverStart,\n onHoverChange: props.onHoverChange,\n onHoverEnd: props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let draggableItem: DraggableItemResult | null = null;\n if (dragState && dragAndDropHooks) {\n draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasDragButton: true}, dragState);\n }\n\n let dropIndicator: DropIndicatorAria | null = null;\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let dropIndicatorRef = useRef<HTMLDivElement>(null);\n let activateButtonRef = useRef<HTMLDivElement>(null);\n let {visuallyHiddenProps} = useVisuallyHidden();\n if (dropState && dragAndDropHooks) {\n dropIndicator = dragAndDropHooks.useDropIndicator!({\n target: {type: 'item', key: item.key, dropPosition: 'on'},\n activateButtonRef\n }, dropState, dropIndicatorRef);\n }\n\n let isDragging = dragState && dragState.isDragging(item.key);\n let isDropTarget = dropIndicator?.isDropTarget;\n\n let selectionMode = state.selectionManager.selectionMode;\n let selectionBehavior = state.selectionManager.selectionBehavior;\n let renderPropValues = React.useMemo<TreeItemContentRenderProps>(() => ({\n ...states,\n isHovered,\n isFocusVisible,\n isExpanded,\n hasChildItems,\n level,\n selectionMode,\n selectionBehavior,\n isFocusVisibleWithin,\n state,\n id: item.key,\n allowsDragging: !!dragState,\n isDragging,\n isDropTarget\n }), [states, isHovered, isFocusVisible, isExpanded, hasChildItems, level, isFocusVisibleWithin, state, item.key, dragState, isDragging, isDropTarget, selectionBehavior, selectionMode]);\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeItem',\n defaultStyle: {\n // @ts-ignore\n '--tree-item-level': level\n },\n values: renderPropValues\n });\n\n useEffect(() => {\n if (!item.textValue && process.env.NODE_ENV !== 'production') {\n console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n useEffect(() => {\n if (hasChildItems && !expandButtonRef.current && process.env.NODE_ENV !== 'production') {\n console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');\n }\n // eslint-disable-next-line\n }, []);\n\n let dragButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (dragState && !dragButtonRef.current && process.env.NODE_ENV !== 'production') {\n console.warn('Draggable items in a Tree must contain a <Button slot=\"drag\"> element so that keyboard and screen reader users can drag them.');\n }\n // eslint-disable-next-line\n }, []);\n\n let children = useCachedChildren({\n items: state.collection.getChildren!(item.key),\n children: item => {\n switch (item.type) {\n case 'content': {\n return item.render!(item);\n }\n // Skip item since we don't render the nested rows as children of the parent row, the flattened collection\n // will render them each as siblings instead\n case 'loader':\n case 'item':\n return <></>;\n default:\n throw new Error('Unsupported element type in TreeRow: ' + item.type);\n }\n }\n });\n\n let activateButtonId = useId();\n let DOMProps = filterDOMProps(props as any, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <>\n {dropIndicator && !dropIndicator.isHidden && (\n <div\n role=\"row\"\n aria-level={rowProps['aria-level']}\n aria-expanded={rowProps['aria-expanded']}\n aria-label={dropIndicator.dropIndicatorProps['aria-label']}>\n <div role=\"gridcell\" aria-colindex={1} style={{display: 'contents'}}>\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator.dropIndicatorProps} ref={dropIndicatorRef} />\n {rowProps['aria-expanded'] != null ? (\n // Button to allow touch screen reader users to expand the item while dragging.\n <div\n role=\"button\"\n {...visuallyHiddenProps}\n id={activateButtonId}\n aria-label={expandButtonProps['aria-label']}\n aria-labelledby={`${activateButtonId} ${rowProps.id}`}\n tabIndex={-1}\n ref={activateButtonRef} />\n ) : null}\n </div>\n </div>\n )}\n <div\n {...mergeProps(\n DOMProps,\n rowProps,\n focusProps,\n hoverProps,\n focusWithinProps,\n draggableItem?.dragProps\n )}\n {...renderProps}\n ref={ref}\n // TODO: missing selectionBehavior, hasAction and allowsSelection data attribute equivalents (available in renderProps). Do we want those?\n data-expanded={(hasChildItems && isExpanded) || undefined}\n data-has-child-items={hasChildItems || undefined}\n data-level={level}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}\n data-allows-dragging={!!dragState || undefined}\n data-dragging={isDragging || undefined}\n data-drop-target={isDropTarget || undefined}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n selection: checkboxProps\n }\n }],\n // TODO: support description in the tree row\n // TODO: don't think I need to pass isExpanded to the button here since it can be sourced from the renderProps? Might be worthwhile passing it down?\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n chevron: {\n ...expandButtonProps,\n ref: expandButtonRef\n },\n drag: {\n ...draggableItem?.dragButtonProps,\n ref: dragButtonRef,\n style: {\n pointerEvents: 'none'\n }\n }\n }\n }],\n [TreeItemContentContext, {\n ...renderPropValues\n }],\n [SelectionIndicatorContext, {isSelected: states.isSelected}]\n ]}>\n {children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nexport interface TreeLoadMoreItemRenderProps {\n /**\n * What level the tree item has within the tree.\n * @selector [data-level]\n */\n level: number\n}\n\nexport interface TreeLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection'>, RenderProps<TreeLoadMoreItemRenderProps> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-TreeLoadMoreItem'\n */\n className?: ClassNameOrFunction<TreeLoadMoreItemRenderProps>,\n /**\n * The load more spinner to render when loading additional items.\n */\n children?: ChildrenOrFunction<TreeLoadMoreItemRenderProps>,\n /**\n * Whether or not the loading spinner should be rendered or not.\n */\n isLoading?: boolean\n}\n\nexport const TreeLoadMoreItem = createLeafComponent(LoaderNode, function TreeLoadingSentinel<T extends object>(props: TreeLoadMoreItemProps, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let {isVirtualized} = useContext(CollectionRendererContext);\n let state = useContext(TreeStateContext)!;\n let {isLoading, onLoadMore, scrollOffset, ...otherProps} = props;\n let sentinelRef = useRef(null);\n let memoedLoadMoreProps = useMemo(() => ({\n onLoadMore,\n // this collection will update anytime a row is expanded/collapsed becaused the flattenedRows will change.\n // This means onLoadMore will trigger but that might be ok cause the user should have logic to handle multiple loadMore calls\n collection: state?.collection,\n sentinelRef,\n scrollOffset\n }), [onLoadMore, scrollOffset, state?.collection]);\n useLoadMoreSentinel(memoedLoadMoreProps, sentinelRef);\n\n ref = useObjectRef<HTMLDivElement>(ref);\n let {rowProps, gridCellProps} = useTreeItem({node: item}, state, ref);\n let level = rowProps['aria-level'] || 1;\n\n // For now don't include aria-posinset and aria-setsize on loader since they aren't keyboard focusable\n // Arguably shouldn't include them ever since it might be confusing to the user to include the loaders as part of the\n // item count\n let ariaProps = {\n role: 'row',\n 'aria-level': rowProps['aria-level']\n };\n\n let renderProps = useRenderProps({\n ...otherProps,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeLoader',\n values: {\n level\n }\n });\n let style = {};\n\n if (isVirtualized) {\n style = {display: 'contents'};\n }\n\n return (\n <>\n {/* Alway render the sentinel. For now onus is on the user for styling when using flex + gap (this would introduce a gap even though it doesn't take room) */}\n {/* @ts-ignore - compatibility with React < 19 */}\n <div style={{position: 'relative', width: 0, height: 0}} inert={inertValue(true)} >\n <div data-testid=\"loadMoreSentinel\" ref={sentinelRef} style={{position: 'absolute', height: 1, width: 1}} />\n </div>\n {isLoading && renderProps.children && (\n <div\n ref={ref}\n {...mergeProps(filterDOMProps(props as any), ariaProps)}\n {...renderProps}\n data-level={level}>\n <div {...gridCellProps} style={style}>\n {renderProps.children}\n </div>\n </div>\n )}\n </>\n );\n});\n\nfunction convertExpanded(expanded: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (!expanded) {\n return new Set<Key>();\n }\n\n return expanded === 'all'\n ? 'all'\n : new Set(expanded);\n}\ninterface TreeGridCollectionOptions {\n expandedKeys: Set<Key>\n}\n\ninterface FlattenedTree<T> {\n flattenedRows: Node<T>[],\n keyMap: Map<Key, CollectionNode<T>>,\n itemCount: number\n}\n\nfunction flattenTree<T>(collection: TreeCollection<T>, opts: TreeGridCollectionOptions): FlattenedTree<T> {\n let {\n expandedKeys = new Set()\n } = opts;\n let keyMap: Map<Key, CollectionNode<T>> = new Map();\n let flattenedRows: Node<T>[] = [];\n // Need to count the items here because BaseCollection will return the full item count regardless if items are hidden via collapsed rows\n let itemCount = 0;\n let parentLookup: Map<Key, boolean> = new Map();\n\n let visitNode = (node: Node<T>) => {\n if (node.type === 'item' || node.type === 'loader') {\n let parentKey = node?.parentKey;\n let clone = {...node};\n if (parentKey != null) {\n // TODO: assumes that non item content node (aka TreeItemContent always placed before Collection) will be always placed before the child rows. If we can't make this assumption then we can filter out\n // every non-item per level and assign indicies based off the node's position in said filtered array\n let hasContentNode = [...collection.getChildren(parentKey)][0].type !== 'item';\n if (hasContentNode) {\n clone.index = node?.index != null ? node?.index - 1 : 0;\n }\n\n // For loader nodes that have a parent (aka non-root level loaders), these need their levels incremented by 1 for parity with their sibiling rows\n // (Collection only increments the level if it is a \"item\" type node).\n if (node.type === 'loader') {\n clone.level = node.level + 1;\n }\n\n keyMap.set(clone.key, clone as CollectionNode<T>);\n } else {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n // Grab the modified node from the key map so our flattened list and modified key map point to the same nodes\n let modifiedNode = keyMap.get(node.key) || node;\n if (modifiedNode.level === 0 || (modifiedNode.parentKey != null && expandedKeys.has(modifiedNode.parentKey) && parentLookup.get(modifiedNode.parentKey))) {\n if (modifiedNode.type === 'item') {\n itemCount++;\n }\n\n flattenedRows.push(modifiedNode);\n parentLookup.set(modifiedNode.key, true);\n }\n } else if (node.type !== null) {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n for (let child of collection.getChildren(node.key)) {\n visitNode(child);\n }\n };\n\n for (let node of collection) {\n visitNode(node);\n }\n\n return {\n flattenedRows,\n keyMap,\n itemCount\n };\n}\n\nfunction TreeDropIndicatorWrapper(props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>): JSX.Element | null {\n ref = useObjectRef(ref);\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext)!;\n let buttonRef = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps, isHidden, isDropTarget} = dragAndDropHooks!.useDropIndicator!(\n props,\n dropState!,\n buttonRef\n );\n\n if (isHidden) {\n return null;\n }\n\n let level = dropState && props.target.type === 'item' ? (dropState.collection.getItem(props.target.key)?.level || 0) + 1 : 1;\n return (\n <TreeDropIndicatorForwardRef\n {...props}\n dropIndicatorProps={dropIndicatorProps}\n isDropTarget={isDropTarget}\n ref={ref}\n buttonRef={buttonRef}\n level={level} />\n );\n}\n\ninterface TreeDropIndicatorProps extends DropIndicatorProps {\n dropIndicatorProps: React.HTMLAttributes<HTMLElement>,\n isDropTarget: boolean,\n buttonRef: RefObject<HTMLDivElement | null>,\n level: number\n}\n\nfunction TreeDropIndicator(props: TreeDropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n let {\n dropIndicatorProps,\n isDropTarget,\n buttonRef,\n level,\n ...otherProps\n } = props;\n let {visuallyHiddenProps} = useVisuallyHidden();\n let renderProps = useRenderProps({\n ...otherProps,\n defaultClassName: 'react-aria-DropIndicator',\n defaultStyle: {\n position: 'relative',\n // @ts-ignore\n '--tree-item-level': level\n },\n values: {\n isDropTarget\n }\n });\n\n return (\n <div\n {...renderProps}\n role=\"row\"\n aria-level={level}\n ref={ref as RefObject<HTMLDivElement | null>}\n data-drop-target={isDropTarget || undefined}>\n <div role=\"gridcell\">\n <div {...visuallyHiddenProps} role=\"button\" {...dropIndicatorProps} ref={buttonRef} />\n {renderProps.children}\n </div>\n </div>\n );\n}\n\nconst TreeDropIndicatorForwardRef = forwardRef(TreeDropIndicator);\n\nfunction RootDropIndicator() {\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let ref = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!({\n target: {type: 'root'}\n }, dropState!, ref);\n let isDropTarget = dropState!.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']} style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...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AK;QACL,oBAAkB,gBAAgB;qBAClC,gCAAC;QAAI,MAAK;qBACR,gCAAC;QAAK,GAAG,mBAAmB;QAAE,MAAK;QAAU,GAAG,kBAAkB;QAAE,KAAK;QACxE,YAAY,QAAQ;AAI7B;AAEA,MAAM,kEAA8B,CAAA,GAAA,iBAAS,EAAE;AAE/C,SAAS;IACP,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAiB;IAChE,IAAI,MAAM,CAAA,GAAA,aAAK,EAAkB;IACjC,IAAI,sBAAC,kBAAkB,EAAC,GAAG,iBAAkB,gBAAgB,CAAE;QAC7D,QAAQ;YAAC,MAAM;QAAM;IACvB,GAAG,WAAY;IACf,IAAI,eAAe,UAAW,YAAY,CAAC;QAAC,MAAM;IAAM;IACxD,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,wBAAgB;IAE5C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,gCAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;QAAE,OAAO;YAAC,UAAU;QAAU;qBAC1F,gCAAC;QAAI,MAAK;qBACR,gCAAC;QAAI,MAAK;QAAU,GAAG,mBAAmB;QAAG,GAAG,kBAAkB;QAAE,KAAK;;AAIjF","sources":["packages/react-aria-components/src/Tree.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaTreeItemOptions, AriaTreeProps, DraggableItemResult, DropIndicatorAria, DropIndicatorProps, DroppableCollectionResult, FocusScope, ListKeyboardDelegate, mergeProps, useCollator, useFocusRing, useGridListSelectionCheckbox, useHover, useId, useLocale, useTree, useTreeItem, useVisuallyHidden} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {ChildrenOrFunction, ContextValue, DEFAULT_SLOT, Provider, RenderProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {Collection, CollectionBuilder, CollectionNode, createBranchComponent, createLeafComponent, LoaderNode, useCachedChildren} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps} from './Collection';\nimport {DisabledBehavior, DragPreviewRenderer, Expandable, forwardRefType, GlobalDOMAttributes, HoverEvents, Key, LinkDOMProps, MultipleSelection, PressEvents, RefObject, SelectionMode} from '@react-types/shared';\nimport {DragAndDropContext, DropIndicatorContext, useDndPersistedKeys, useRenderDropIndicator} from './DragAndDrop';\nimport {DragAndDropHooks} from './useDragAndDrop';\nimport {DraggableCollectionState, DroppableCollectionState, Collection as ICollection, Node, SelectionBehavior, TreeState, useTreeState} from 'react-stately';\nimport {filterDOMProps, inertValue, LoadMoreSentinelProps, useLoadMoreSentinel, useObjectRef} from '@react-aria/utils';\nimport React, {createContext, ForwardedRef, forwardRef, JSX, ReactNode, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {SelectionIndicatorContext} from './SelectionIndicator';\nimport {SharedElementTransition} from './SharedElementTransition';\nimport {TreeDropTargetDelegate} from './TreeDropTargetDelegate';\nimport {useControlledState} from '@react-stately/utils';\n\nclass TreeCollection<T> implements ICollection<Node<T>> {\n private flattenedRows: Node<T>[];\n private keyMap: Map<Key, CollectionNode<T>> = new Map();\n private itemCount: number = 0;\n\n constructor(opts) {\n let {collection, expandedKeys} = opts;\n let {flattenedRows, keyMap, itemCount} = flattenTree<T>(collection, {expandedKeys});\n this.flattenedRows = flattenedRows;\n // Use generated keyMap because it contains the modified collection nodes (aka it adjusts the indexes so that they ignore the existence of the Content items)\n this.keyMap = keyMap;\n this.itemCount = itemCount;\n }\n\n // TODO: should this collection's getters reflect the flattened structure or the original structure\n // If we respresent the flattened structure, it is easier for the keyboard nav but harder to find all the nodes\n *[Symbol.iterator]() {\n yield* this.flattenedRows;\n }\n\n get size() {\n return this.itemCount;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) || null;\n }\n\n at(idx: number) {\n return this.flattenedRows[idx];\n }\n\n getFirstKey() {\n return this.flattenedRows[0]?.key;\n }\n\n getLastKey() {\n return this.flattenedRows[this.flattenedRows.length - 1]?.key;\n }\n\n getKeyAfter(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index + 1]?.key;\n }\n\n getKeyBefore(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index - 1]?.key;\n }\n\n // Note that this will return Content nodes in addition to nested TreeItems\n getChildren(key: Key): Iterable<Node<T>> {\n let keyMap = this.keyMap;\n return {\n *[Symbol.iterator]() {\n let parent = keyMap.get(key);\n let node = parent?.firstChildKey != null ? keyMap.get(parent.firstChildKey) : null;\n while (node) {\n yield node as Node<T>;\n node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined;\n }\n }\n };\n }\n\n getTextValue(key: Key): string {\n let item = this.getItem(key);\n return item ? item.textValue : '';\n }\n}\n\nexport interface TreeRenderProps {\n /**\n * Whether the tree has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the tree is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the tree is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /**\n * Whether the tree allows dragging.\n * @selector [data-allows-dragging]\n */\n allowsDragging: boolean,\n /**\n * State of the tree.\n */\n state: TreeState<unknown>\n}\n\nexport interface TreeEmptyStateRenderProps extends Omit<TreeRenderProps, 'isEmpty'> {}\n\nexport interface TreeProps<T> extends Omit<AriaTreeProps<T>, 'children'>, MultipleSelection, CollectionProps<T>, StyleRenderProps<TreeRenderProps>, SlotProps, Expandable, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * How multiple selection should behave in the tree.\n * @default \"toggle\"\n */\n selectionBehavior?: SelectionBehavior,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: TreeEmptyStateRenderProps) => ReactNode,\n /**\n * Whether `disabledKeys` applies to all interactions, or only selection.\n * @default 'all'\n */\n disabledBehavior?: DisabledBehavior,\n /** The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the Tree. */\n dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>\n}\n\n\nexport const TreeContext = createContext<ContextValue<TreeProps<any>, HTMLDivElement>>(null);\nexport const TreeStateContext = createContext<TreeState<any> | null>(null);\n\n/**\n * A tree provides users with a way to navigate nested hierarchical information, with support for keyboard navigation\n * and selection.\n */\nexport const Tree = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tree<T extends object>(props: TreeProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, TreeContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TreeInner props={props} collection={collection} treeRef={ref} />}\n </CollectionBuilder>\n );\n});\n\nconst EXPANSION_KEYS = {\n 'expand': {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\ninterface TreeInnerProps<T extends object> {\n props: TreeProps<T>,\n collection: ICollection<unknown>,\n treeRef: RefObject<HTMLDivElement | null>\n}\n\nfunction TreeInner<T extends object>({props, collection, treeRef: ref}: TreeInnerProps<T>) {\n const {dragAndDropHooks} = props;\n let {direction} = useLocale();\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let hasDragHooks = !!dragAndDropHooks?.useDraggableCollectionState;\n let hasDropHooks = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(hasDragHooks);\n let dropHooksProvided = useRef(hasDropHooks);\n\n useEffect(() => {\n if (dragHooksProvided.current !== hasDragHooks) {\n console.warn('Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n if (dropHooksProvided.current !== hasDropHooks) {\n console.warn('Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n }, [hasDragHooks, hasDropHooks]);\n let {\n selectionMode = 'none',\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: propDefaultExpandedKeys,\n onExpandedChange,\n disabledBehavior = 'all'\n } = props;\n let {CollectionRoot, isVirtualized, layoutDelegate, dropTargetDelegate: ctxDropTargetDelegate} = useContext(CollectionRendererContext);\n\n // Kinda annoying that we have to replicate this code here as well as in useTreeState, but don't want to add\n // flattenCollection stuff to useTreeState. Think about this later\n let [expandedKeys, setExpandedKeys] = useControlledState(\n propExpandedKeys ? convertExpanded(propExpandedKeys) : undefined,\n propDefaultExpandedKeys ? convertExpanded(propDefaultExpandedKeys) : new Set(),\n onExpandedChange\n );\n\n let flattenedCollection = useMemo(() => {\n return new TreeCollection<object>({collection, expandedKeys});\n }, [collection, expandedKeys]);\n\n let state = useTreeState({\n ...props,\n selectionMode,\n expandedKeys,\n onExpandedChange: setExpandedKeys,\n collection: flattenedCollection,\n children: undefined,\n disabledBehavior\n });\n\n let {gridProps} = useTree({\n ...props,\n isVirtualized,\n layoutDelegate\n }, state, ref);\n\n let dragState: DraggableCollectionState | undefined = undefined;\n let dropState: DroppableCollectionState | undefined = undefined;\n let droppableCollection: DroppableCollectionResult | undefined = undefined;\n let isRootDropTarget = false;\n let dragPreview: JSX.Element | null = null;\n let preview = useRef<DragPreviewRenderer>(null);\n\n if (hasDragHooks && dragAndDropHooks) {\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection: state.collection,\n selectionManager: state.selectionManager,\n preview: dragAndDropHooks.renderDragPreview ? preview : undefined\n });\n dragAndDropHooks.useDraggableCollection!({}, dragState, ref);\n\n let DragPreview = dragAndDropHooks.DragPreview!;\n dragPreview = dragAndDropHooks.renderDragPreview\n ? <DragPreview ref={preview}>{dragAndDropHooks.renderDragPreview}</DragPreview>\n : null;\n }\n\n let [treeDropTargetDelegate] = useState(() => new TreeDropTargetDelegate());\n if (hasDropHooks && dragAndDropHooks) {\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection: state.collection,\n selectionManager: state.selectionManager\n });\n let dropTargetDelegate = dragAndDropHooks.dropTargetDelegate || ctxDropTargetDelegate || new dragAndDropHooks.ListDropTargetDelegate(state.collection, ref, {direction});\n treeDropTargetDelegate.setup(dropTargetDelegate, state, direction);\n\n let keyboardDelegate =\n new ListKeyboardDelegate({\n collection: state.collection,\n collator,\n ref,\n disabledKeys: state.selectionManager.disabledKeys,\n disabledBehavior: state.selectionManager.disabledBehavior,\n direction,\n layoutDelegate\n });\n droppableCollection = dragAndDropHooks.useDroppableCollection!(\n {\n keyboardDelegate,\n dropTargetDelegate: treeDropTargetDelegate,\n onDropActivate: (e) => {\n // Expand collapsed item when dragging over. For keyboard, allow collapsing.\n if (e.target.type === 'item') {\n let key = e.target.key;\n let item = state.collection.getItem(key);\n let isExpanded = expandedKeys !== 'all' && expandedKeys.has(key);\n if (item && item.hasChildNodes && (!isExpanded || dragAndDropHooks?.isVirtualDragging?.())) {\n state.toggleKey(key);\n }\n }\n },\n onKeyDown: e => {\n let target = dropState?.target;\n if (target && target.type === 'item' && target.dropPosition === 'on') {\n let item = state.collection.getItem(target.key);\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && item?.hasChildNodes && !state.expandedKeys.has(target.key)) {\n state.toggleKey(target.key);\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && item?.hasChildNodes && state.expandedKeys.has(target.key)) {\n state.toggleKey(target.key);\n }\n }\n }\n },\n dropState,\n ref\n );\n\n // Prevent dropping items onto themselves or their descendants\n let originalGetDropOperation = dropState.getDropOperation;\n dropState.getDropOperation = (options) => {\n let {target, isInternal} = options;\n let currentDraggingKeys = dragState?.draggingKeys ?? new Set();\n\n if (isInternal && target.type === 'item' && currentDraggingKeys.size > 0) {\n if (currentDraggingKeys.has(target.key) && target.dropPosition === 'on') {\n return 'cancel';\n }\n\n let currentKey: Key | null = target.key;\n while (currentKey != null) {\n let item = state.collection.getItem(currentKey);\n let parentKey = item?.parentKey;\n if (parentKey != null && currentDraggingKeys.has(parentKey)) {\n return 'cancel';\n }\n currentKey = parentKey ?? null;\n }\n }\n\n return originalGetDropOperation(options);\n };\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let isTreeDraggable = !!(hasDragHooks && !dragState?.isDisabled);\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n isDropTarget: isRootDropTarget,\n selectionMode: state.selectionManager.selectionMode,\n allowsDragging: !!isTreeDraggable,\n state\n };\n\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-Tree',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {isEmpty, ...values} = renderValues;\n let content = props.renderEmptyState({...values});\n let treeGridRowProps = {\n 'aria-level': 1\n };\n\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}} {...treeGridRowProps}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <>\n <FocusScope>\n <div\n {...mergeProps(DOMProps, renderProps, gridProps, focusProps, droppableCollection?.collectionProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-drop-target={isRootDropTarget || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}\n data-allows-dragging={!!isTreeDraggable || undefined}>\n <Provider\n values={[\n [TreeStateContext, state],\n [DragAndDropContext, {dragAndDropHooks, dragState, dropState}],\n [DropIndicatorContext, {render: TreeDropIndicatorWrapper}]\n ]}>\n {hasDropHooks && <RootDropIndicator />}\n <SharedElementTransition>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={useDndPersistedKeys(state.selectionManager, dragAndDropHooks, dropState)}\n scrollRef={ref}\n renderDropIndicator={useRenderDropIndicator(dragAndDropHooks, dropState)} />\n </SharedElementTransition>\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n {dragPreview}\n </>\n );\n}\n\n// TODO: readd the rest of the render props when tree supports them\nexport interface TreeItemRenderProps extends ItemRenderProps {\n /**\n * Whether the tree item is expanded.\n * @selector [data-expanded]\n */\n isExpanded: boolean,\n /**\n * Whether the tree item has child tree items.\n * @selector [data-has-child-items]\n */\n hasChildItems: boolean,\n /**\n * What level the tree item has within the tree.\n * @selector [data-level=\"number\"]\n */\n level: number,\n /**\n * Whether the tree item's children have keyboard focus.\n * @selector [data-focus-visible-within]\n */\n isFocusVisibleWithin: boolean,\n /** The state of the tree. */\n state: TreeState<unknown>,\n /** The unique id of the tree row. */\n id: Key\n}\n\nexport interface TreeItemContentRenderProps extends TreeItemRenderProps {}\n\n// The TreeItemContent is the one that accepts RenderProps because we would get much more complicated logic in TreeItem otherwise since we'd\n// need to do a bunch of check to figure out what is the Content and what are the actual collection elements (aka child rows) of the TreeItem\nexport interface TreeItemContentProps extends Pick<RenderProps<TreeItemContentRenderProps>, 'children'> {}\n\nclass TreeContentNode extends CollectionNode<any> {\n static readonly type = 'content';\n}\n\nexport const TreeItemContent = /*#__PURE__*/ createLeafComponent(TreeContentNode, function TreeItemContent(props: TreeItemContentProps) {\n let values = useContext(TreeItemContentContext)!;\n let renderProps = useRenderProps({\n children: props.children,\n values\n });\n return (\n <CollectionRendererContext.Provider value={DefaultCollectionRenderer}>\n {renderProps.children}\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const TreeItemContentContext = createContext<TreeItemContentRenderProps | null>(null);\n\nexport interface TreeItemProps<T = object> extends StyleRenderProps<TreeItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, Pick<AriaTreeItemOptions, 'hasChildItems'>, Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {\n /** The unique id of the tree row. */\n id?: Key,\n /** The object value that this tree item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the tree item's contents, used for features like typeahead. */\n textValue: string,\n /** An accessibility label for this tree item. */\n 'aria-label'?: string,\n /** The content of the tree item along with any nested children. Supports static nested tree items or use of a Collection to dynamically render nested tree items. */\n children: ReactNode,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on this tree item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\nclass TreeItemNode extends CollectionNode<any> {\n static readonly type = 'item';\n}\n\n/**\n * A TreeItem represents an individual item in a Tree.\n */\nexport const TreeItem = /*#__PURE__*/ createBranchComponent(TreeItemNode, <T extends object>(props: TreeItemProps<T>, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) => {\n let state = useContext(TreeStateContext)!;\n ref = useObjectRef<HTMLDivElement>(ref);\n let {dragAndDropHooks, dragState, dropState} = useContext(DragAndDropContext)!;\n\n // TODO: remove this when we support description in tree row\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {rowProps, gridCellProps, expandButtonProps, descriptionProps, ...states} = useTreeItem({\n node: item,\n shouldSelectOnPressUp: !!dragState\n }, state, ref);\n let isExpanded = rowProps['aria-expanded'] === true;\n let hasChildItems = props.hasChildItems || [...state.collection.getChildren!(item.key)]?.length > 1;\n let level = rowProps['aria-level'] || 1;\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: props.onHoverStart,\n onHoverChange: props.onHoverChange,\n onHoverEnd: props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let draggableItem: DraggableItemResult | null = null;\n if (dragState && dragAndDropHooks) {\n draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasDragButton: true}, dragState);\n }\n\n let dropIndicator: DropIndicatorAria | null = null;\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let dropIndicatorRef = useRef<HTMLDivElement>(null);\n let activateButtonRef = useRef<HTMLDivElement>(null);\n let {visuallyHiddenProps} = useVisuallyHidden();\n if (dropState && dragAndDropHooks) {\n dropIndicator = dragAndDropHooks.useDropIndicator!({\n target: {type: 'item', key: item.key, dropPosition: 'on'},\n activateButtonRef\n }, dropState, dropIndicatorRef);\n }\n\n let isDragging = dragState && dragState.isDragging(item.key);\n let isDropTarget = dropIndicator?.isDropTarget;\n\n let selectionMode = state.selectionManager.selectionMode;\n let selectionBehavior = state.selectionManager.selectionBehavior;\n let renderPropValues = React.useMemo<TreeItemContentRenderProps>(() => ({\n ...states,\n isHovered,\n isFocusVisible,\n isExpanded,\n hasChildItems,\n level,\n selectionMode,\n selectionBehavior,\n isFocusVisibleWithin,\n state,\n id: item.key,\n allowsDragging: !!dragState,\n isDragging,\n isDropTarget\n }), [states, isHovered, isFocusVisible, isExpanded, hasChildItems, level, isFocusVisibleWithin, state, item.key, dragState, isDragging, isDropTarget, selectionBehavior, selectionMode]);\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeItem',\n defaultStyle: {\n // @ts-ignore\n '--tree-item-level': level\n },\n values: renderPropValues\n });\n\n useEffect(() => {\n if (!item.textValue && process.env.NODE_ENV !== 'production') {\n console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n useEffect(() => {\n if (hasChildItems && !expandButtonRef.current && process.env.NODE_ENV !== 'production') {\n console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');\n }\n // eslint-disable-next-line\n }, []);\n\n let dragButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (dragState && !dragButtonRef.current && process.env.NODE_ENV !== 'production') {\n console.warn('Draggable items in a Tree must contain a <Button slot=\"drag\"> element so that keyboard and screen reader users can drag them.');\n }\n // eslint-disable-next-line\n }, []);\n\n let children = useCachedChildren({\n items: state.collection.getChildren!(item.key),\n children: item => {\n switch (item.type) {\n case 'content': {\n return item.render!(item);\n }\n // Skip item since we don't render the nested rows as children of the parent row, the flattened collection\n // will render them each as siblings instead\n case 'loader':\n case 'item':\n return <></>;\n default:\n throw new Error('Unsupported element type in TreeRow: ' + item.type);\n }\n }\n });\n\n let activateButtonId = useId();\n let DOMProps = filterDOMProps(props as any, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <>\n {dropIndicator && !dropIndicator.isHidden && (\n <div\n role=\"row\"\n aria-level={rowProps['aria-level']}\n aria-expanded={rowProps['aria-expanded']}\n aria-label={dropIndicator.dropIndicatorProps['aria-label']}>\n <div role=\"gridcell\" aria-colindex={1} style={{display: 'contents'}}>\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator.dropIndicatorProps} ref={dropIndicatorRef} />\n {rowProps['aria-expanded'] != null ? (\n // Button to allow touch screen reader users to expand the item while dragging.\n <div\n role=\"button\"\n {...visuallyHiddenProps}\n id={activateButtonId}\n aria-label={expandButtonProps['aria-label']}\n aria-labelledby={`${activateButtonId} ${rowProps.id}`}\n tabIndex={-1}\n ref={activateButtonRef} />\n ) : null}\n </div>\n </div>\n )}\n <div\n {...mergeProps(\n DOMProps,\n rowProps,\n focusProps,\n hoverProps,\n focusWithinProps,\n draggableItem?.dragProps\n )}\n {...renderProps}\n ref={ref}\n // TODO: missing selectionBehavior, hasAction and allowsSelection data attribute equivalents (available in renderProps). Do we want those?\n data-expanded={(hasChildItems && isExpanded) || undefined}\n data-has-child-items={hasChildItems || undefined}\n data-level={level}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}\n data-allows-dragging={!!dragState || undefined}\n data-dragging={isDragging || undefined}\n data-drop-target={isDropTarget || undefined}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n selection: checkboxProps\n }\n }],\n // TODO: support description in the tree row\n // TODO: don't think I need to pass isExpanded to the button here since it can be sourced from the renderProps? Might be worthwhile passing it down?\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n chevron: {\n ...expandButtonProps,\n ref: expandButtonRef\n },\n drag: {\n ...draggableItem?.dragButtonProps,\n ref: dragButtonRef,\n style: {\n pointerEvents: 'none'\n }\n }\n }\n }],\n [TreeItemContentContext, {\n ...renderPropValues\n }],\n [SelectionIndicatorContext, {isSelected: states.isSelected}]\n ]}>\n {children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nexport interface TreeLoadMoreItemRenderProps {\n /**\n * What level the tree item has within the tree.\n * @selector [data-level]\n */\n level: number\n}\n\nexport interface TreeLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection'>, RenderProps<TreeLoadMoreItemRenderProps> {\n /**\n * The load more spinner to render when loading additional items.\n */\n children?: ChildrenOrFunction<TreeLoadMoreItemRenderProps>,\n /**\n * Whether or not the loading spinner should be rendered or not.\n */\n isLoading?: boolean\n}\n\nexport const TreeLoadMoreItem = createLeafComponent(LoaderNode, function TreeLoadingSentinel<T extends object>(props: TreeLoadMoreItemProps, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let {isVirtualized} = useContext(CollectionRendererContext);\n let state = useContext(TreeStateContext)!;\n let {isLoading, onLoadMore, scrollOffset, ...otherProps} = props;\n let sentinelRef = useRef(null);\n let memoedLoadMoreProps = useMemo(() => ({\n onLoadMore,\n // this collection will update anytime a row is expanded/collapsed becaused the flattenedRows will change.\n // This means onLoadMore will trigger but that might be ok cause the user should have logic to handle multiple loadMore calls\n collection: state?.collection,\n sentinelRef,\n scrollOffset\n }), [onLoadMore, scrollOffset, state?.collection]);\n useLoadMoreSentinel(memoedLoadMoreProps, sentinelRef);\n\n ref = useObjectRef<HTMLDivElement>(ref);\n let {rowProps, gridCellProps} = useTreeItem({node: item}, state, ref);\n let level = rowProps['aria-level'] || 1;\n\n // For now don't include aria-posinset and aria-setsize on loader since they aren't keyboard focusable\n // Arguably shouldn't include them ever since it might be confusing to the user to include the loaders as part of the\n // item count\n let ariaProps = {\n role: 'row',\n 'aria-level': rowProps['aria-level']\n };\n\n let renderProps = useRenderProps({\n ...otherProps,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeLoader',\n values: {\n level\n }\n });\n let style = {};\n\n if (isVirtualized) {\n style = {display: 'contents'};\n }\n\n return (\n <>\n {/* Alway render the sentinel. For now onus is on the user for styling when using flex + gap (this would introduce a gap even though it doesn't take room) */}\n {/* @ts-ignore - compatibility with React < 19 */}\n <div style={{position: 'relative', width: 0, height: 0}} inert={inertValue(true)} >\n <div data-testid=\"loadMoreSentinel\" ref={sentinelRef} style={{position: 'absolute', height: 1, width: 1}} />\n </div>\n {isLoading && renderProps.children && (\n <div\n ref={ref}\n {...mergeProps(filterDOMProps(props as any), ariaProps)}\n {...renderProps}\n data-level={level}>\n <div {...gridCellProps} style={style}>\n {renderProps.children}\n </div>\n </div>\n )}\n </>\n );\n});\n\nfunction convertExpanded(expanded: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (!expanded) {\n return new Set<Key>();\n }\n\n return expanded === 'all'\n ? 'all'\n : new Set(expanded);\n}\ninterface TreeGridCollectionOptions {\n expandedKeys: Set<Key>\n}\n\ninterface FlattenedTree<T> {\n flattenedRows: Node<T>[],\n keyMap: Map<Key, CollectionNode<T>>,\n itemCount: number\n}\n\nfunction flattenTree<T>(collection: TreeCollection<T>, opts: TreeGridCollectionOptions): FlattenedTree<T> {\n let {\n expandedKeys = new Set()\n } = opts;\n let keyMap: Map<Key, CollectionNode<T>> = new Map();\n let flattenedRows: Node<T>[] = [];\n // Need to count the items here because BaseCollection will return the full item count regardless if items are hidden via collapsed rows\n let itemCount = 0;\n let parentLookup: Map<Key, boolean> = new Map();\n\n let visitNode = (node: Node<T>) => {\n if (node.type === 'item' || node.type === 'loader') {\n let parentKey = node?.parentKey;\n let clone = {...node};\n if (parentKey != null) {\n // TODO: assumes that non item content node (aka TreeItemContent always placed before Collection) will be always placed before the child rows. If we can't make this assumption then we can filter out\n // every non-item per level and assign indicies based off the node's position in said filtered array\n let hasContentNode = [...collection.getChildren(parentKey)][0].type !== 'item';\n if (hasContentNode) {\n clone.index = node?.index != null ? node?.index - 1 : 0;\n }\n\n // For loader nodes that have a parent (aka non-root level loaders), these need their levels incremented by 1 for parity with their sibiling rows\n // (Collection only increments the level if it is a \"item\" type node).\n if (node.type === 'loader') {\n clone.level = node.level + 1;\n }\n\n keyMap.set(clone.key, clone as CollectionNode<T>);\n } else {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n // Grab the modified node from the key map so our flattened list and modified key map point to the same nodes\n let modifiedNode = keyMap.get(node.key) || node;\n if (modifiedNode.level === 0 || (modifiedNode.parentKey != null && expandedKeys.has(modifiedNode.parentKey) && parentLookup.get(modifiedNode.parentKey))) {\n if (modifiedNode.type === 'item') {\n itemCount++;\n }\n\n flattenedRows.push(modifiedNode);\n parentLookup.set(modifiedNode.key, true);\n }\n } else if (node.type !== null) {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n for (let child of collection.getChildren(node.key)) {\n visitNode(child);\n }\n };\n\n for (let node of collection) {\n visitNode(node);\n }\n\n return {\n flattenedRows,\n keyMap,\n itemCount\n };\n}\n\nfunction TreeDropIndicatorWrapper(props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>): JSX.Element | null {\n ref = useObjectRef(ref);\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext)!;\n let buttonRef = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps, isHidden, isDropTarget} = dragAndDropHooks!.useDropIndicator!(\n props,\n dropState!,\n buttonRef\n );\n\n if (isHidden) {\n return null;\n }\n\n let level = dropState && props.target.type === 'item' ? (dropState.collection.getItem(props.target.key)?.level || 0) + 1 : 1;\n return (\n <TreeDropIndicatorForwardRef\n {...props}\n dropIndicatorProps={dropIndicatorProps}\n isDropTarget={isDropTarget}\n ref={ref}\n buttonRef={buttonRef}\n level={level} />\n );\n}\n\ninterface TreeDropIndicatorProps extends DropIndicatorProps {\n dropIndicatorProps: React.HTMLAttributes<HTMLElement>,\n isDropTarget: boolean,\n buttonRef: RefObject<HTMLDivElement | null>,\n level: number\n}\n\nfunction TreeDropIndicator(props: TreeDropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n let {\n dropIndicatorProps,\n isDropTarget,\n buttonRef,\n level,\n ...otherProps\n } = props;\n let {visuallyHiddenProps} = useVisuallyHidden();\n let renderProps = useRenderProps({\n ...otherProps,\n defaultClassName: 'react-aria-DropIndicator',\n defaultStyle: {\n position: 'relative',\n // @ts-ignore\n '--tree-item-level': level\n },\n values: {\n isDropTarget\n }\n });\n\n return (\n <div\n {...renderProps}\n role=\"row\"\n aria-level={level}\n ref={ref as RefObject<HTMLDivElement | null>}\n data-drop-target={isDropTarget || undefined}>\n <div role=\"gridcell\">\n <div {...visuallyHiddenProps} role=\"button\" {...dropIndicatorProps} ref={buttonRef} />\n {renderProps.children}\n </div>\n </div>\n );\n}\n\nconst TreeDropIndicatorForwardRef = forwardRef(TreeDropIndicator);\n\nfunction RootDropIndicator() {\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let ref = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!({\n target: {type: 'root'}\n }, dropState!, ref);\n let isDropTarget = dropState!.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']} style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Tree.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AA8BD,MAAM;IAcJ,mGAAmG;IACnG,+GAA+G;IAC/G,CAAC,CAAC,OAAO,QAAQ,CAAC,GAAG;QACnB,OAAO,IAAI,CAAC,aAAa;IAC3B;IAEA,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,SAAS;IACvB;IAEA,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI;IACzB;IAEA,QAAQ,GAAQ,EAAkB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ;IACjC;IAEA,GAAG,GAAW,EAAE;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI;IAChC;IAEA,cAAc;YACL;QAAP,QAAO,uBAAA,IAAI,CAAC,aAAa,CAAC,EAAE,cAArB,2CAAA,qBAAuB,GAAG;IACnC;IAEA,aAAa;YACJ;QAAP,QAAO,uBAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,EAAE,cAAjD,2CAAA,qBAAmD,GAAG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kB;QAAE,KAAK;;AAIjF","sources":["packages/react-aria-components/src/Tree.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaTreeItemOptions, AriaTreeProps, DraggableItemResult, DropIndicatorAria, DropIndicatorProps, DroppableCollectionResult, FocusScope, ListKeyboardDelegate, mergeProps, useCollator, useFocusRing, useGridListSelectionCheckbox, useHover, useId, useLocale, useTree, useTreeItem, useVisuallyHidden} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {\n ChildrenOrFunction,\n ClassNameOrFunction,\n ContextValue,\n DEFAULT_SLOT,\n Provider,\n RenderProps,\n SlotProps,\n StyleRenderProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {Collection, CollectionBuilder, CollectionNode, createBranchComponent, createLeafComponent, LoaderNode, useCachedChildren} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps} from './Collection';\nimport {DisabledBehavior, DragPreviewRenderer, Expandable, forwardRefType, GlobalDOMAttributes, HoverEvents, Key, LinkDOMProps, MultipleSelection, PressEvents, RefObject, SelectionMode} from '@react-types/shared';\nimport {DragAndDropContext, DropIndicatorContext, useDndPersistedKeys, useRenderDropIndicator} from './DragAndDrop';\nimport {DragAndDropHooks} from './useDragAndDrop';\nimport {DraggableCollectionState, DroppableCollectionState, Collection as ICollection, Node, SelectionBehavior, TreeState, useTreeState} from 'react-stately';\nimport {filterDOMProps, inertValue, LoadMoreSentinelProps, useLoadMoreSentinel, useObjectRef} from '@react-aria/utils';\nimport React, {createContext, ForwardedRef, forwardRef, JSX, ReactNode, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {SelectionIndicatorContext} from './SelectionIndicator';\nimport {SharedElementTransition} from './SharedElementTransition';\nimport {TreeDropTargetDelegate} from './TreeDropTargetDelegate';\nimport {useControlledState} from '@react-stately/utils';\n\nclass TreeCollection<T> implements ICollection<Node<T>> {\n private flattenedRows: Node<T>[];\n private keyMap: Map<Key, CollectionNode<T>> = new Map();\n private itemCount: number = 0;\n\n constructor(opts) {\n let {collection, expandedKeys} = opts;\n let {flattenedRows, keyMap, itemCount} = flattenTree<T>(collection, {expandedKeys});\n this.flattenedRows = flattenedRows;\n // Use generated keyMap because it contains the modified collection nodes (aka it adjusts the indexes so that they ignore the existence of the Content items)\n this.keyMap = keyMap;\n this.itemCount = itemCount;\n }\n\n // TODO: should this collection's getters reflect the flattened structure or the original structure\n // If we respresent the flattened structure, it is easier for the keyboard nav but harder to find all the nodes\n *[Symbol.iterator]() {\n yield* this.flattenedRows;\n }\n\n get size() {\n return this.itemCount;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) || null;\n }\n\n at(idx: number) {\n return this.flattenedRows[idx];\n }\n\n getFirstKey() {\n return this.flattenedRows[0]?.key;\n }\n\n getLastKey() {\n return this.flattenedRows[this.flattenedRows.length - 1]?.key;\n }\n\n getKeyAfter(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index + 1]?.key;\n }\n\n getKeyBefore(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index - 1]?.key;\n }\n\n // Note that this will return Content nodes in addition to nested TreeItems\n getChildren(key: Key): Iterable<Node<T>> {\n let keyMap = this.keyMap;\n return {\n *[Symbol.iterator]() {\n let parent = keyMap.get(key);\n let node = parent?.firstChildKey != null ? keyMap.get(parent.firstChildKey) : null;\n while (node) {\n yield node as Node<T>;\n node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined;\n }\n }\n };\n }\n\n getTextValue(key: Key): string {\n let item = this.getItem(key);\n return item ? item.textValue : '';\n }\n}\n\nexport interface TreeRenderProps {\n /**\n * Whether the tree has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the tree is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the tree is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /**\n * Whether the tree allows dragging.\n * @selector [data-allows-dragging]\n */\n allowsDragging: boolean,\n /**\n * State of the tree.\n */\n state: TreeState<unknown>\n}\n\nexport interface TreeEmptyStateRenderProps extends Omit<TreeRenderProps, 'isEmpty'> {}\n\nexport interface TreeProps<T> extends Omit<AriaTreeProps<T>, 'children'>, MultipleSelection, CollectionProps<T>, StyleRenderProps<TreeRenderProps>, SlotProps, Expandable, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-Tree'\n */\n className?: ClassNameOrFunction<TreeRenderProps>,\n /**\n * How multiple selection should behave in the tree.\n * @default \"toggle\"\n */\n selectionBehavior?: SelectionBehavior,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: TreeEmptyStateRenderProps) => ReactNode,\n /**\n * Whether `disabledKeys` applies to all interactions, or only selection.\n * @default 'all'\n */\n disabledBehavior?: DisabledBehavior,\n /** The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the Tree. */\n dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>\n}\n\n\nexport const TreeContext = createContext<ContextValue<TreeProps<any>, HTMLDivElement>>(null);\nexport const TreeStateContext = createContext<TreeState<any> | null>(null);\n\n/**\n * A tree provides users with a way to navigate nested hierarchical information, with support for keyboard navigation\n * and selection.\n */\nexport const Tree = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tree<T extends object>(props: TreeProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, TreeContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TreeInner props={props} collection={collection} treeRef={ref} />}\n </CollectionBuilder>\n );\n});\n\nconst EXPANSION_KEYS = {\n 'expand': {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\ninterface TreeInnerProps<T extends object> {\n props: TreeProps<T>,\n collection: ICollection<unknown>,\n treeRef: RefObject<HTMLDivElement | null>\n}\n\nfunction TreeInner<T extends object>({props, collection, treeRef: ref}: TreeInnerProps<T>) {\n const {dragAndDropHooks} = props;\n let {direction} = useLocale();\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let hasDragHooks = !!dragAndDropHooks?.useDraggableCollectionState;\n let hasDropHooks = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(hasDragHooks);\n let dropHooksProvided = useRef(hasDropHooks);\n\n useEffect(() => {\n if (dragHooksProvided.current !== hasDragHooks) {\n console.warn('Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n if (dropHooksProvided.current !== hasDropHooks) {\n console.warn('Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n }, [hasDragHooks, hasDropHooks]);\n let {\n selectionMode = 'none',\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: propDefaultExpandedKeys,\n onExpandedChange,\n disabledBehavior = 'all'\n } = props;\n let {CollectionRoot, isVirtualized, layoutDelegate, dropTargetDelegate: ctxDropTargetDelegate} = useContext(CollectionRendererContext);\n\n // Kinda annoying that we have to replicate this code here as well as in useTreeState, but don't want to add\n // flattenCollection stuff to useTreeState. Think about this later\n let [expandedKeys, setExpandedKeys] = useControlledState(\n propExpandedKeys ? convertExpanded(propExpandedKeys) : undefined,\n propDefaultExpandedKeys ? convertExpanded(propDefaultExpandedKeys) : new Set(),\n onExpandedChange\n );\n\n let flattenedCollection = useMemo(() => {\n return new TreeCollection<object>({collection, expandedKeys});\n }, [collection, expandedKeys]);\n\n let state = useTreeState({\n ...props,\n selectionMode,\n expandedKeys,\n onExpandedChange: setExpandedKeys,\n collection: flattenedCollection,\n children: undefined,\n disabledBehavior\n });\n\n let {gridProps} = useTree({\n ...props,\n isVirtualized,\n layoutDelegate\n }, state, ref);\n\n let dragState: DraggableCollectionState | undefined = undefined;\n let dropState: DroppableCollectionState | undefined = undefined;\n let droppableCollection: DroppableCollectionResult | undefined = undefined;\n let isRootDropTarget = false;\n let dragPreview: JSX.Element | null = null;\n let preview = useRef<DragPreviewRenderer>(null);\n\n if (hasDragHooks && dragAndDropHooks) {\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection: state.collection,\n selectionManager: state.selectionManager,\n preview: dragAndDropHooks.renderDragPreview ? preview : undefined\n });\n dragAndDropHooks.useDraggableCollection!({}, dragState, ref);\n\n let DragPreview = dragAndDropHooks.DragPreview!;\n dragPreview = dragAndDropHooks.renderDragPreview\n ? <DragPreview ref={preview}>{dragAndDropHooks.renderDragPreview}</DragPreview>\n : null;\n }\n\n let [treeDropTargetDelegate] = useState(() => new TreeDropTargetDelegate());\n if (hasDropHooks && dragAndDropHooks) {\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection: state.collection,\n selectionManager: state.selectionManager\n });\n let dropTargetDelegate = dragAndDropHooks.dropTargetDelegate || ctxDropTargetDelegate || new dragAndDropHooks.ListDropTargetDelegate(state.collection, ref, {direction});\n treeDropTargetDelegate.setup(dropTargetDelegate, state, direction);\n\n let keyboardDelegate =\n new ListKeyboardDelegate({\n collection: state.collection,\n collator,\n ref,\n disabledKeys: state.selectionManager.disabledKeys,\n disabledBehavior: state.selectionManager.disabledBehavior,\n direction,\n layoutDelegate\n });\n droppableCollection = dragAndDropHooks.useDroppableCollection!(\n {\n keyboardDelegate,\n dropTargetDelegate: treeDropTargetDelegate,\n onDropActivate: (e) => {\n // Expand collapsed item when dragging over. For keyboard, allow collapsing.\n if (e.target.type === 'item') {\n let key = e.target.key;\n let item = state.collection.getItem(key);\n let isExpanded = expandedKeys !== 'all' && expandedKeys.has(key);\n if (item && item.hasChildNodes && (!isExpanded || dragAndDropHooks?.isVirtualDragging?.())) {\n state.toggleKey(key);\n }\n }\n },\n onKeyDown: e => {\n let target = dropState?.target;\n if (target && target.type === 'item' && target.dropPosition === 'on') {\n let item = state.collection.getItem(target.key);\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && item?.hasChildNodes && !state.expandedKeys.has(target.key)) {\n state.toggleKey(target.key);\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && item?.hasChildNodes && state.expandedKeys.has(target.key)) {\n state.toggleKey(target.key);\n }\n }\n }\n },\n dropState,\n ref\n );\n\n // Prevent dropping items onto themselves or their descendants\n let originalGetDropOperation = dropState.getDropOperation;\n dropState.getDropOperation = (options) => {\n let {target, isInternal} = options;\n let currentDraggingKeys = dragState?.draggingKeys ?? new Set();\n\n if (isInternal && target.type === 'item' && currentDraggingKeys.size > 0) {\n if (currentDraggingKeys.has(target.key) && target.dropPosition === 'on') {\n return 'cancel';\n }\n\n let currentKey: Key | null = target.key;\n while (currentKey != null) {\n let item = state.collection.getItem(currentKey);\n let parentKey = item?.parentKey;\n if (parentKey != null && currentDraggingKeys.has(parentKey)) {\n return 'cancel';\n }\n currentKey = parentKey ?? null;\n }\n }\n\n return originalGetDropOperation(options);\n };\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let isTreeDraggable = !!(hasDragHooks && !dragState?.isDisabled);\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n isDropTarget: isRootDropTarget,\n selectionMode: state.selectionManager.selectionMode,\n allowsDragging: !!isTreeDraggable,\n state\n };\n\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-Tree',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {isEmpty, ...values} = renderValues;\n let content = props.renderEmptyState({...values});\n let treeGridRowProps = {\n 'aria-level': 1\n };\n\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}} {...treeGridRowProps}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <>\n <FocusScope>\n <div\n {...mergeProps(DOMProps, renderProps, gridProps, focusProps, droppableCollection?.collectionProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-drop-target={isRootDropTarget || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}\n data-allows-dragging={!!isTreeDraggable || undefined}>\n <Provider\n values={[\n [TreeStateContext, state],\n [DragAndDropContext, {dragAndDropHooks, dragState, dropState}],\n [DropIndicatorContext, {render: TreeDropIndicatorWrapper}]\n ]}>\n {hasDropHooks && <RootDropIndicator />}\n <SharedElementTransition>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={useDndPersistedKeys(state.selectionManager, dragAndDropHooks, dropState)}\n scrollRef={ref}\n renderDropIndicator={useRenderDropIndicator(dragAndDropHooks, dropState)} />\n </SharedElementTransition>\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n {dragPreview}\n </>\n );\n}\n\n// TODO: readd the rest of the render props when tree supports them\nexport interface TreeItemRenderProps extends ItemRenderProps {\n /**\n * Whether the tree item is expanded.\n * @selector [data-expanded]\n */\n isExpanded: boolean,\n /**\n * Whether the tree item has child tree items.\n * @selector [data-has-child-items]\n */\n hasChildItems: boolean,\n /**\n * What level the tree item has within the tree.\n * @selector [data-level=\"number\"]\n */\n level: number,\n /**\n * Whether the tree item's children have keyboard focus.\n * @selector [data-focus-visible-within]\n */\n isFocusVisibleWithin: boolean,\n /** The state of the tree. */\n state: TreeState<unknown>,\n /** The unique id of the tree row. */\n id: Key\n}\n\nexport interface TreeItemContentRenderProps extends TreeItemRenderProps {}\n\n// The TreeItemContent is the one that accepts RenderProps because we would get much more complicated logic in TreeItem otherwise since we'd\n// need to do a bunch of check to figure out what is the Content and what are the actual collection elements (aka child rows) of the TreeItem\nexport interface TreeItemContentProps {\n /** The children of the component. A function may be provided to alter the children based on component state. */\n children: ChildrenOrFunction<TreeItemContentRenderProps>\n}\n\nclass TreeContentNode extends CollectionNode<any> {\n static readonly type = 'content';\n}\n\nexport const TreeItemContent = /*#__PURE__*/ createLeafComponent(TreeContentNode, function TreeItemContent(props: TreeItemContentProps) {\n let values = useContext(TreeItemContentContext)!;\n let renderProps = useRenderProps({\n children: props.children,\n values\n });\n return (\n <CollectionRendererContext.Provider value={DefaultCollectionRenderer}>\n {renderProps.children}\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const TreeItemContentContext = createContext<TreeItemContentRenderProps | null>(null);\n\nexport interface TreeItemProps<T = object> extends StyleRenderProps<TreeItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, Pick<AriaTreeItemOptions, 'hasChildItems'>, Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-TreeItem'\n */\n className?: ClassNameOrFunction<TreeItemRenderProps>,\n /** The unique id of the tree row. */\n id?: Key,\n /** The object value that this tree item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the tree item's contents, used for features like typeahead. */\n textValue: string,\n /** An accessibility label for this tree item. */\n 'aria-label'?: string,\n /** The content of the tree item along with any nested children. Supports static nested tree items or use of a Collection to dynamically render nested tree items. */\n children: ReactNode,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on this tree item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\nclass TreeItemNode extends CollectionNode<any> {\n static readonly type = 'item';\n}\n\n/**\n * A TreeItem represents an individual item in a Tree.\n */\nexport const TreeItem = /*#__PURE__*/ createBranchComponent(TreeItemNode, <T extends object>(props: TreeItemProps<T>, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) => {\n let state = useContext(TreeStateContext)!;\n ref = useObjectRef<HTMLDivElement>(ref);\n let {dragAndDropHooks, dragState, dropState} = useContext(DragAndDropContext)!;\n\n // TODO: remove this when we support description in tree row\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {rowProps, gridCellProps, expandButtonProps, descriptionProps, ...states} = useTreeItem({\n node: item,\n shouldSelectOnPressUp: !!dragState\n }, state, ref);\n let isExpanded = rowProps['aria-expanded'] === true;\n let hasChildItems = props.hasChildItems || [...state.collection.getChildren!(item.key)]?.length > 1;\n let level = rowProps['aria-level'] || 1;\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: props.onHoverStart,\n onHoverChange: props.onHoverChange,\n onHoverEnd: props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let draggableItem: DraggableItemResult | null = null;\n if (dragState && dragAndDropHooks) {\n draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasDragButton: true}, dragState);\n }\n\n let dropIndicator: DropIndicatorAria | null = null;\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let dropIndicatorRef = useRef<HTMLDivElement>(null);\n let activateButtonRef = useRef<HTMLDivElement>(null);\n let {visuallyHiddenProps} = useVisuallyHidden();\n if (dropState && dragAndDropHooks) {\n dropIndicator = dragAndDropHooks.useDropIndicator!({\n target: {type: 'item', key: item.key, dropPosition: 'on'},\n activateButtonRef\n }, dropState, dropIndicatorRef);\n }\n\n let isDragging = dragState && dragState.isDragging(item.key);\n let isDropTarget = dropIndicator?.isDropTarget;\n\n let selectionMode = state.selectionManager.selectionMode;\n let selectionBehavior = state.selectionManager.selectionBehavior;\n let renderPropValues = React.useMemo<TreeItemContentRenderProps>(() => ({\n ...states,\n isHovered,\n isFocusVisible,\n isExpanded,\n hasChildItems,\n level,\n selectionMode,\n selectionBehavior,\n isFocusVisibleWithin,\n state,\n id: item.key,\n allowsDragging: !!dragState,\n isDragging,\n isDropTarget\n }), [states, isHovered, isFocusVisible, isExpanded, hasChildItems, level, isFocusVisibleWithin, state, item.key, dragState, isDragging, isDropTarget, selectionBehavior, selectionMode]);\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeItem',\n defaultStyle: {\n // @ts-ignore\n '--tree-item-level': level\n },\n values: renderPropValues\n });\n\n useEffect(() => {\n if (!item.textValue && process.env.NODE_ENV !== 'production') {\n console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n useEffect(() => {\n if (hasChildItems && !expandButtonRef.current && process.env.NODE_ENV !== 'production') {\n console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');\n }\n // eslint-disable-next-line\n }, []);\n\n let dragButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (dragState && !dragButtonRef.current && process.env.NODE_ENV !== 'production') {\n console.warn('Draggable items in a Tree must contain a <Button slot=\"drag\"> element so that keyboard and screen reader users can drag them.');\n }\n // eslint-disable-next-line\n }, []);\n\n let children = useCachedChildren({\n items: state.collection.getChildren!(item.key),\n children: item => {\n switch (item.type) {\n case 'content': {\n return item.render!(item);\n }\n // Skip item since we don't render the nested rows as children of the parent row, the flattened collection\n // will render them each as siblings instead\n case 'loader':\n case 'item':\n return <></>;\n default:\n throw new Error('Unsupported element type in TreeRow: ' + item.type);\n }\n }\n });\n\n let activateButtonId = useId();\n let DOMProps = filterDOMProps(props as any, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <>\n {dropIndicator && !dropIndicator.isHidden && (\n <div\n role=\"row\"\n aria-level={rowProps['aria-level']}\n aria-expanded={rowProps['aria-expanded']}\n aria-label={dropIndicator.dropIndicatorProps['aria-label']}>\n <div role=\"gridcell\" aria-colindex={1} style={{display: 'contents'}}>\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator.dropIndicatorProps} ref={dropIndicatorRef} />\n {rowProps['aria-expanded'] != null ? (\n // Button to allow touch screen reader users to expand the item while dragging.\n <div\n role=\"button\"\n {...visuallyHiddenProps}\n id={activateButtonId}\n aria-label={expandButtonProps['aria-label']}\n aria-labelledby={`${activateButtonId} ${rowProps.id}`}\n tabIndex={-1}\n ref={activateButtonRef} />\n ) : null}\n </div>\n </div>\n )}\n <div\n {...mergeProps(\n DOMProps,\n rowProps,\n focusProps,\n hoverProps,\n focusWithinProps,\n draggableItem?.dragProps\n )}\n {...renderProps}\n ref={ref}\n // TODO: missing selectionBehavior, hasAction and allowsSelection data attribute equivalents (available in renderProps). Do we want those?\n data-expanded={(hasChildItems && isExpanded) || undefined}\n data-has-child-items={hasChildItems || undefined}\n data-level={level}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}\n data-allows-dragging={!!dragState || undefined}\n data-dragging={isDragging || undefined}\n data-drop-target={isDropTarget || undefined}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n selection: checkboxProps\n }\n }],\n // TODO: support description in the tree row\n // TODO: don't think I need to pass isExpanded to the button here since it can be sourced from the renderProps? Might be worthwhile passing it down?\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n chevron: {\n ...expandButtonProps,\n ref: expandButtonRef\n },\n drag: {\n ...draggableItem?.dragButtonProps,\n ref: dragButtonRef,\n style: {\n pointerEvents: 'none'\n }\n }\n }\n }],\n [TreeItemContentContext, {\n ...renderPropValues\n }],\n [SelectionIndicatorContext, {isSelected: states.isSelected}]\n ]}>\n {children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nexport interface TreeLoadMoreItemRenderProps {\n /**\n * What level the tree item has within the tree.\n * @selector [data-level]\n */\n level: number\n}\n\nexport interface TreeLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection'>, RenderProps<TreeLoadMoreItemRenderProps> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-TreeLoadMoreItem'\n */\n className?: ClassNameOrFunction<TreeLoadMoreItemRenderProps>,\n /**\n * The load more spinner to render when loading additional items.\n */\n children?: ChildrenOrFunction<TreeLoadMoreItemRenderProps>,\n /**\n * Whether or not the loading spinner should be rendered or not.\n */\n isLoading?: boolean\n}\n\nexport const TreeLoadMoreItem = createLeafComponent(LoaderNode, function TreeLoadingSentinel<T extends object>(props: TreeLoadMoreItemProps, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let {isVirtualized} = useContext(CollectionRendererContext);\n let state = useContext(TreeStateContext)!;\n let {isLoading, onLoadMore, scrollOffset, ...otherProps} = props;\n let sentinelRef = useRef(null);\n let memoedLoadMoreProps = useMemo(() => ({\n onLoadMore,\n // this collection will update anytime a row is expanded/collapsed becaused the flattenedRows will change.\n // This means onLoadMore will trigger but that might be ok cause the user should have logic to handle multiple loadMore calls\n collection: state?.collection,\n sentinelRef,\n scrollOffset\n }), [onLoadMore, scrollOffset, state?.collection]);\n useLoadMoreSentinel(memoedLoadMoreProps, sentinelRef);\n\n ref = useObjectRef<HTMLDivElement>(ref);\n let {rowProps, gridCellProps} = useTreeItem({node: item}, state, ref);\n let level = rowProps['aria-level'] || 1;\n\n // For now don't include aria-posinset and aria-setsize on loader since they aren't keyboard focusable\n // Arguably shouldn't include them ever since it might be confusing to the user to include the loaders as part of the\n // item count\n let ariaProps = {\n role: 'row',\n 'aria-level': rowProps['aria-level']\n };\n\n let renderProps = useRenderProps({\n ...otherProps,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeLoader',\n values: {\n level\n }\n });\n let style = {};\n\n if (isVirtualized) {\n style = {display: 'contents'};\n }\n\n return (\n <>\n {/* Alway render the sentinel. For now onus is on the user for styling when using flex + gap (this would introduce a gap even though it doesn't take room) */}\n {/* @ts-ignore - compatibility with React < 19 */}\n <div style={{position: 'relative', width: 0, height: 0}} inert={inertValue(true)} >\n <div data-testid=\"loadMoreSentinel\" ref={sentinelRef} style={{position: 'absolute', height: 1, width: 1}} />\n </div>\n {isLoading && renderProps.children && (\n <div\n ref={ref}\n {...mergeProps(filterDOMProps(props as any), ariaProps)}\n {...renderProps}\n data-level={level}>\n <div {...gridCellProps} style={style}>\n {renderProps.children}\n </div>\n </div>\n )}\n </>\n );\n});\n\nfunction convertExpanded(expanded: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (!expanded) {\n return new Set<Key>();\n }\n\n return expanded === 'all'\n ? 'all'\n : new Set(expanded);\n}\ninterface TreeGridCollectionOptions {\n expandedKeys: Set<Key>\n}\n\ninterface FlattenedTree<T> {\n flattenedRows: Node<T>[],\n keyMap: Map<Key, CollectionNode<T>>,\n itemCount: number\n}\n\nfunction flattenTree<T>(collection: TreeCollection<T>, opts: TreeGridCollectionOptions): FlattenedTree<T> {\n let {\n expandedKeys = new Set()\n } = opts;\n let keyMap: Map<Key, CollectionNode<T>> = new Map();\n let flattenedRows: Node<T>[] = [];\n // Need to count the items here because BaseCollection will return the full item count regardless if items are hidden via collapsed rows\n let itemCount = 0;\n let parentLookup: Map<Key, boolean> = new Map();\n\n let visitNode = (node: Node<T>) => {\n if (node.type === 'item' || node.type === 'loader') {\n let parentKey = node?.parentKey;\n let clone = {...node};\n if (parentKey != null) {\n // TODO: assumes that non item content node (aka TreeItemContent always placed before Collection) will be always placed before the child rows. If we can't make this assumption then we can filter out\n // every non-item per level and assign indicies based off the node's position in said filtered array\n let hasContentNode = [...collection.getChildren(parentKey)][0].type !== 'item';\n if (hasContentNode) {\n clone.index = node?.index != null ? node?.index - 1 : 0;\n }\n\n // For loader nodes that have a parent (aka non-root level loaders), these need their levels incremented by 1 for parity with their sibiling rows\n // (Collection only increments the level if it is a \"item\" type node).\n if (node.type === 'loader') {\n clone.level = node.level + 1;\n }\n\n keyMap.set(clone.key, clone as CollectionNode<T>);\n } else {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n // Grab the modified node from the key map so our flattened list and modified key map point to the same nodes\n let modifiedNode = keyMap.get(node.key) || node;\n if (modifiedNode.level === 0 || (modifiedNode.parentKey != null && expandedKeys.has(modifiedNode.parentKey) && parentLookup.get(modifiedNode.parentKey))) {\n if (modifiedNode.type === 'item') {\n itemCount++;\n }\n\n flattenedRows.push(modifiedNode);\n parentLookup.set(modifiedNode.key, true);\n }\n } else if (node.type !== null) {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n for (let child of collection.getChildren(node.key)) {\n visitNode(child);\n }\n };\n\n for (let node of collection) {\n visitNode(node);\n }\n\n return {\n flattenedRows,\n keyMap,\n itemCount\n };\n}\n\nfunction TreeDropIndicatorWrapper(props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>): JSX.Element | null {\n ref = useObjectRef(ref);\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext)!;\n let buttonRef = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps, isHidden, isDropTarget} = dragAndDropHooks!.useDropIndicator!(\n props,\n dropState!,\n buttonRef\n );\n\n if (isHidden) {\n return null;\n }\n\n let level = dropState && props.target.type === 'item' ? (dropState.collection.getItem(props.target.key)?.level || 0) + 1 : 1;\n return (\n <TreeDropIndicatorForwardRef\n {...props}\n dropIndicatorProps={dropIndicatorProps}\n isDropTarget={isDropTarget}\n ref={ref}\n buttonRef={buttonRef}\n level={level} />\n );\n}\n\ninterface TreeDropIndicatorProps extends DropIndicatorProps {\n dropIndicatorProps: React.HTMLAttributes<HTMLElement>,\n isDropTarget: boolean,\n buttonRef: RefObject<HTMLDivElement | null>,\n level: number\n}\n\nfunction TreeDropIndicator(props: TreeDropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n let {\n dropIndicatorProps,\n isDropTarget,\n buttonRef,\n level,\n ...otherProps\n } = props;\n let {visuallyHiddenProps} = useVisuallyHidden();\n let renderProps = useRenderProps({\n ...otherProps,\n defaultClassName: 'react-aria-DropIndicator',\n defaultStyle: {\n position: 'relative',\n // @ts-ignore\n '--tree-item-level': level\n },\n values: {\n isDropTarget\n }\n });\n\n return (\n <div\n {...renderProps}\n role=\"row\"\n aria-level={level}\n ref={ref as RefObject<HTMLDivElement | null>}\n data-drop-target={isDropTarget || undefined}>\n <div role=\"gridcell\">\n <div {...visuallyHiddenProps} role=\"button\" {...dropIndicatorProps} ref={buttonRef} />\n {renderProps.children}\n </div>\n </div>\n );\n}\n\nconst TreeDropIndicatorForwardRef = forwardRef(TreeDropIndicator);\n\nfunction RootDropIndicator() {\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let ref = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!({\n target: {type: 'root'}\n }, dropState!, ref);\n let isDropTarget = dropState!.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']} style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Tree.module.js.map"}
|