@depup/react-aria-components 1.19.0-depup.27 → 1.20.0-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PreviewTrigger/package.json +5 -0
- package/README.md +2 -2
- package/TokenField/package.json +5 -0
- package/changes.json +1 -1
- package/dist/exports/GridList.cjs.map +1 -1
- package/dist/exports/GridList.js.map +1 -1
- package/dist/exports/GridList.mjs.map +1 -1
- package/dist/exports/PreviewTrigger.cjs +26 -0
- package/dist/exports/PreviewTrigger.cjs.map +1 -0
- package/dist/exports/PreviewTrigger.js +21 -0
- package/dist/exports/PreviewTrigger.js.map +1 -0
- package/dist/exports/PreviewTrigger.mjs +21 -0
- package/dist/exports/PreviewTrigger.mjs.map +1 -0
- package/dist/exports/TokenField.cjs +31 -0
- package/dist/exports/TokenField.cjs.map +1 -0
- package/dist/exports/TokenField.js +21 -0
- package/dist/exports/TokenField.js.map +1 -0
- package/dist/exports/TokenField.mjs +21 -0
- package/dist/exports/TokenField.mjs.map +1 -0
- package/dist/exports/Tree.cjs.map +1 -1
- package/dist/exports/Tree.js.map +1 -1
- package/dist/exports/Tree.mjs.map +1 -1
- package/dist/exports/index.cjs +12 -0
- package/dist/exports/index.cjs.map +1 -1
- package/dist/exports/index.js +7 -1
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/index.mjs +7 -1
- package/dist/exports/index.mjs.map +1 -1
- package/dist/private/Checkbox.cjs.map +1 -1
- package/dist/private/Checkbox.js.map +1 -1
- package/dist/private/Checkbox.mjs.map +1 -1
- package/dist/private/ComboBox.cjs +21 -2
- package/dist/private/ComboBox.cjs.map +1 -1
- package/dist/private/ComboBox.js +21 -2
- package/dist/private/ComboBox.js.map +1 -1
- package/dist/private/ComboBox.mjs +21 -2
- package/dist/private/ComboBox.mjs.map +1 -1
- package/dist/private/Dialog.cjs +15 -1
- package/dist/private/Dialog.cjs.map +1 -1
- package/dist/private/Dialog.js +15 -1
- package/dist/private/Dialog.js.map +1 -1
- package/dist/private/Dialog.mjs +15 -1
- package/dist/private/Dialog.mjs.map +1 -1
- package/dist/private/DragAndDrop.cjs +1 -0
- package/dist/private/DragAndDrop.cjs.map +1 -1
- package/dist/private/DragAndDrop.js +1 -0
- package/dist/private/DragAndDrop.js.map +1 -1
- package/dist/private/DragAndDrop.mjs +1 -0
- package/dist/private/DragAndDrop.mjs.map +1 -1
- package/dist/private/DropZone.cjs +5 -2
- package/dist/private/DropZone.cjs.map +1 -1
- package/dist/private/DropZone.js +5 -3
- package/dist/private/DropZone.js.map +1 -1
- package/dist/private/DropZone.mjs +5 -2
- package/dist/private/DropZone.mjs.map +1 -1
- package/dist/private/FileTrigger.cjs +1 -0
- package/dist/private/FileTrigger.cjs.map +1 -1
- package/dist/private/FileTrigger.js +1 -0
- package/dist/private/FileTrigger.js.map +1 -1
- package/dist/private/FileTrigger.mjs +1 -0
- package/dist/private/FileTrigger.mjs.map +1 -1
- package/dist/private/GridLayout.cjs +3 -1
- package/dist/private/GridLayout.cjs.map +1 -1
- package/dist/private/GridLayout.js +3 -1
- package/dist/private/GridLayout.js.map +1 -1
- package/dist/private/GridLayout.mjs +3 -1
- package/dist/private/GridLayout.mjs.map +1 -1
- package/dist/private/GridList.cjs +12 -1
- package/dist/private/GridList.cjs.map +1 -1
- package/dist/private/GridList.js +12 -1
- package/dist/private/GridList.js.map +1 -1
- package/dist/private/GridList.mjs +12 -1
- package/dist/private/GridList.mjs.map +1 -1
- package/dist/private/ListBox.cjs +9 -1
- package/dist/private/ListBox.cjs.map +1 -1
- package/dist/private/ListBox.js +9 -1
- package/dist/private/ListBox.js.map +1 -1
- package/dist/private/ListBox.mjs +9 -1
- package/dist/private/ListBox.mjs.map +1 -1
- package/dist/private/Menu.cjs +4 -2
- package/dist/private/Menu.cjs.map +1 -1
- package/dist/private/Menu.js +4 -2
- package/dist/private/Menu.js.map +1 -1
- package/dist/private/Menu.mjs +4 -2
- package/dist/private/Menu.mjs.map +1 -1
- package/dist/private/Meter.cjs +2 -1
- package/dist/private/Meter.cjs.map +1 -1
- package/dist/private/Meter.js +2 -1
- package/dist/private/Meter.js.map +1 -1
- package/dist/private/Meter.mjs +2 -1
- package/dist/private/Meter.mjs.map +1 -1
- package/dist/private/Modal.cjs +2 -0
- package/dist/private/Modal.cjs.map +1 -1
- package/dist/private/Modal.js +2 -0
- package/dist/private/Modal.js.map +1 -1
- package/dist/private/Modal.mjs +2 -0
- package/dist/private/Modal.mjs.map +1 -1
- package/dist/private/Popover.cjs +34 -9
- package/dist/private/Popover.cjs.map +1 -1
- package/dist/private/Popover.js +34 -9
- package/dist/private/Popover.js.map +1 -1
- package/dist/private/Popover.mjs +34 -9
- package/dist/private/Popover.mjs.map +1 -1
- package/dist/private/PreviewTrigger.cjs +88 -0
- package/dist/private/PreviewTrigger.cjs.map +1 -0
- package/dist/private/PreviewTrigger.js +80 -0
- package/dist/private/PreviewTrigger.js.map +1 -0
- package/dist/private/PreviewTrigger.mjs +79 -0
- package/dist/private/PreviewTrigger.mjs.map +1 -0
- package/dist/private/ProgressBar.cjs +6 -1
- package/dist/private/ProgressBar.cjs.map +1 -1
- package/dist/private/ProgressBar.js +6 -1
- package/dist/private/ProgressBar.js.map +1 -1
- package/dist/private/ProgressBar.mjs +6 -1
- package/dist/private/ProgressBar.mjs.map +1 -1
- package/dist/private/Select.cjs.map +1 -1
- package/dist/private/Select.js.map +1 -1
- package/dist/private/Select.mjs.map +1 -1
- package/dist/private/Table.cjs +26 -14
- package/dist/private/Table.cjs.map +1 -1
- package/dist/private/Table.js +26 -14
- package/dist/private/Table.js.map +1 -1
- package/dist/private/Table.mjs +26 -14
- package/dist/private/Table.mjs.map +1 -1
- package/dist/private/TableLayout.cjs +3 -1
- package/dist/private/TableLayout.cjs.map +1 -1
- package/dist/private/TableLayout.js +3 -1
- package/dist/private/TableLayout.js.map +1 -1
- package/dist/private/TableLayout.mjs +3 -1
- package/dist/private/TableLayout.mjs.map +1 -1
- package/dist/private/TagGroup.cjs +1 -0
- package/dist/private/TagGroup.cjs.map +1 -1
- package/dist/private/TagGroup.js +1 -0
- package/dist/private/TagGroup.js.map +1 -1
- package/dist/private/TagGroup.mjs +1 -0
- package/dist/private/TagGroup.mjs.map +1 -1
- package/dist/private/ToggleButton.cjs.map +1 -1
- package/dist/private/ToggleButton.js.map +1 -1
- package/dist/private/ToggleButton.mjs.map +1 -1
- package/dist/private/TokenField.cjs +207 -0
- package/dist/private/TokenField.cjs.map +1 -0
- package/dist/private/TokenField.js +197 -0
- package/dist/private/TokenField.js.map +1 -0
- package/dist/private/TokenField.mjs +195 -0
- package/dist/private/TokenField.mjs.map +1 -0
- package/dist/private/Tooltip.cjs +10 -2
- package/dist/private/Tooltip.cjs.map +1 -1
- package/dist/private/Tooltip.js +10 -2
- package/dist/private/Tooltip.js.map +1 -1
- package/dist/private/Tooltip.mjs +10 -2
- package/dist/private/Tooltip.mjs.map +1 -1
- package/dist/private/Tree.cjs +11 -1
- package/dist/private/Tree.cjs.map +1 -1
- package/dist/private/Tree.js +11 -1
- package/dist/private/Tree.js.map +1 -1
- package/dist/private/Tree.mjs +11 -1
- package/dist/private/Tree.mjs.map +1 -1
- package/dist/private/Virtualizer.cjs +18 -16
- package/dist/private/Virtualizer.cjs.map +1 -1
- package/dist/private/Virtualizer.js +18 -16
- package/dist/private/Virtualizer.js.map +1 -1
- package/dist/private/Virtualizer.mjs +18 -16
- package/dist/private/Virtualizer.mjs.map +1 -1
- package/dist/private/useDragAndDrop.cjs +7 -0
- package/dist/private/useDragAndDrop.cjs.map +1 -1
- package/dist/private/useDragAndDrop.js +7 -0
- package/dist/private/useDragAndDrop.js.map +1 -1
- package/dist/private/useDragAndDrop.mjs +7 -0
- package/dist/private/useDragAndDrop.mjs.map +1 -1
- package/dist/private/utils.cjs.map +1 -1
- package/dist/private/utils.js.map +1 -1
- package/dist/private/utils.mjs.map +1 -1
- package/dist/types/exports/GridList.d.ts +1 -1
- package/dist/types/exports/PreviewTrigger.d.ts +3 -0
- package/dist/types/exports/TokenField.d.ts +5 -0
- package/dist/types/exports/Tree.d.ts +1 -1
- package/dist/types/exports/index.d.ts +7 -2
- package/dist/types/src/ComboBox.d.ts +4 -1
- package/dist/types/src/GridList.d.ts +12 -1
- package/dist/types/src/ListBox.d.ts +1 -1
- package/dist/types/src/Popover.d.ts +7 -0
- package/dist/types/src/PreviewTrigger.d.ts +23 -0
- package/dist/types/src/Select.d.ts +1 -1
- package/dist/types/src/Table.d.ts +24 -0
- package/dist/types/src/TokenField.d.ts +111 -0
- package/dist/types/src/Tree.d.ts +7 -5
- package/dist/types/src/Virtualizer.d.ts +4 -0
- package/dist/types/src/utils.d.ts +19 -5
- 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/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 +32 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA0BM,MAAM,4CAAe,OAAO;AAmG5B,SAAS,0CAA6C,UAC3D,MAAM,YACN,QAAQ,EAC0C;IAClD,KAAK,IAAI,CAAC,SAAS,MAAM,IAAI,OAC3B,aAAa;IACb,yBAAW,gCAAC,QAAQ,QAAQ;QAAC,OAAO;OAAQ;IAG9C,OAAO;AACT;AA0EO,SAAS,wCACd,KAAmC;IAEnC,IAAI,aACF,SAAS,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AY,QAAQ,EAAE,WAAW,OAAO,CAAC,SAAS,CAAC,2DAA2D,CAAC;QAGjM;IACF,GAAG;QAAC;QAAa;KAAO;IAExB,IAAI,WAAgB;QAAC,GAAG,UAAU;aAAE;IAAG;IACvC,IAAI,QACF,OAAO,OAAO,UAAU;IAG1B,qBAAO,gCAAC,aAAgB;AAC1B;AAQA,MAAM,0CAAoB,CAAC;AAGpB,MAAM,4CAAM,IAAI,MACrB,CAAC,GACD;IACE,KAAI,MAAM,EAAE,WAAW;QACrB,IAAI,OAAO,gBAAgB,UACzB,OAAO;QAGT,IAAI,MAAM,uCAAiB,CAAC,YAAY;QACxC,IAAI,CAAC,KAAK;YACR,oBAAM,CAAA,GAAA,iBAAS,EAAE,iCAAW,IAAI,CAAC,MAAM;YACvC,uCAAiB,CAAC,YAAY,GAAG;QACnC;QAEA,OAAO;IACT;AACF","sources":["packages/react-aria-components/src/utils.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, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {\n AllHTMLAttributes,\n AnchorHTMLAttributes,\n Context,\n CSSProperties,\n DetailedHTMLProps,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefCallback,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const DEFAULT_SLOT = Symbol('default');\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\nexport type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;\n\ntype ProviderValue<T> = [Context<T>, T];\ntype ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L> =\n | [ProviderValue<A>]\n | [ProviderValue<A>, ProviderValue<B>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>\n ];\n\ninterface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L> {\n values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L>;\n children: ReactNode;\n}\n\nexport function Provider<A, B, C, D, E, F, G, H, I, J, K, L>({\n values,\n children\n}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L>): JSX.Element {\n for (let [Context, value] of values) {\n // @ts-ignore\n children = <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n return children as JSX.Element;\n}\n\nexport interface StyleProps {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n */\n className?: string;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element.\n */\n style?: CSSProperties;\n}\n\nexport interface DOMProps extends StyleProps, SharedDOMProps {\n /** The children of the component. */\n children?: ReactNode;\n}\n\nexport type ClassNameOrFunction<T> =\n | string\n | ((values: T & {defaultClassName: string | undefined}) => string);\ntype StyleOrFunction<T> =\n | CSSProperties\n | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);\n\nexport interface StyleRenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends DOMRenderProps<E, T> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n */\n className?: ClassNameOrFunction<T>;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element. A function may be provided to compute the style based on component state.\n */\n style?: StyleOrFunction<T>;\n}\n\nexport type ChildrenOrFunction<T> =\n | ReactNode\n | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);\n\nexport interface RenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends StyleRenderProps<T, E> {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children?: ChildrenOrFunction<T>;\n}\n\ninterface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements>\n extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {\n values: T;\n defaultChildren?: ReactNode;\n defaultClassName?: string;\n defaultStyle?: CSSProperties;\n}\n\ninterface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n 'data-rac': string;\n render?: DOMRenderFunction<E, T>;\n}\n\nexport function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(\n props: RenderPropsHookOptions<T, E>\n): RenderPropsHookRetVal<T, E> {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values,\n render\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: React.CSSProperties | undefined;\n let computedChildren: React.ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: computedStyle || defaultStyle ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': '',\n render: render ? props => render(props, values) : undefined\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);\n}\n\n/**\n * A helper function that accepts a user-provided render prop value (either a static value or a\n * function), and combines it with another value to create a final result.\n */\nexport function composeRenderProps<T, U, V extends T>(\n // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage\n value: T extends any ? T | ((renderProps: U) => V) : never,\n wrap: (prevValue: T, renderProps: U) => V\n): (renderProps: U) => V {\n return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);\n}\n\nexport type WithRef<T, E> = T & {ref?: ForwardedRef<E>};\nexport interface SlotProps {\n /**\n * A slot name for the component. Slots allow the component to receive props from a parent\n * component. An explicit `null` value indicates that the local props completely override all\n * props received from a parent.\n */\n slot?: string | null;\n}\n\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null\n): T | null | undefined {\n let ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means don't use context.\n return null;\n }\n if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {\n let slotKey = slot || DEFAULT_SLOT;\n if (!ctx.slots[slotKey]) {\n let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `\"${p}\"`));\n let errorMessage = slot ? `Invalid slot \"${slot}\".` : 'A slot prop is required.';\n\n throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);\n }\n return ctx.slots[slotKey];\n }\n // @ts-ignore\n return ctx;\n}\n\nexport function useContextProps<T, U extends SlotProps, E extends Element>(\n props: T & SlotProps,\n ref: ForwardedRef<E> | undefined,\n context: Context<ContextValue<U, E>>\n): [T, RefObject<E | null>] {\n let ctx = useSlottedContext(context, props.slot) || {};\n let {ref: contextRef, ...contextProps} = ctx as any;\n let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));\n let mergedProps = mergeProps(contextProps, props) as unknown as T;\n\n // mergeProps does not merge `style`. Adding this there might be a breaking change.\n if ('style' in contextProps && contextProps.style && 'style' in props && props.style) {\n if (typeof contextProps.style === 'function' || typeof props.style === 'function') {\n // @ts-ignore\n mergedProps.style = renderProps => {\n let contextStyle =\n typeof contextProps.style === 'function'\n ? contextProps.style(renderProps)\n : contextProps.style;\n let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};\n let style =\n typeof props.style === 'function'\n ? props.style({...renderProps, defaultStyle})\n : props.style;\n return {...defaultStyle, ...style};\n };\n } else {\n // @ts-ignore\n mergedProps.style = {...contextProps.style, ...props.style};\n }\n }\n\n return [mergedProps, mergedRef];\n}\n\nexport function useSlot(\n initialState: boolean | (() => boolean) = true\n): [RefCallback<Element>, boolean] {\n // Initial state is typically based on the parent having an aria-label or aria-labelledby.\n // If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect\n let [hasSlot, setHasSlot] = useState(initialState);\n let hasRun = useRef(false);\n\n // A callback ref which will run when the slotted element mounts.\n // This should happen before the useLayoutEffect below.\n let ref = useCallback(el => {\n hasRun.current = true;\n setHasSlot(!!el);\n }, []);\n\n // If the callback hasn't been called, then reset to false.\n useLayoutEffect(() => {\n if (!hasRun.current) {\n setHasSlot(false);\n }\n }, []);\n\n return [ref, hasSlot];\n}\n\n/**\n * Filters out `data-*` attributes to keep them from being passed down and duplicated.\n *\n * @param props\n */\nexport function removeDataAttributes<T>(props: T): T {\n const prefix = /^(data-.*)$/;\n let filteredProps = {} as T;\n\n for (const prop in props) {\n if (!prefix.test(prop)) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n\n// Override base type to change the default.\nexport interface RACValidation {\n /**\n * Whether to use native HTML form validation to prevent form submission\n * when the value is missing or invalid, or mark the field as required\n * or invalid via ARIA.\n *\n * @default 'native'\n */\n validationBehavior?: 'native' | 'aria';\n}\n\nexport type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (\n props: React.JSX.IntrinsicElements[E],\n renderProps: T\n) => ReactElement;\nexport interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an\n * `<a>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: DOMRenderFunction<E, T>;\n}\n\n// Makes `href` required in AnchorHTMLAttributes\ntype LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> &\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n\n// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.\nexport interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<a>` is expected, you cannot render a\n * `<button>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: (\n props:\n | DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>\n | React.JSX.IntrinsicElements[Fallback],\n renderProps: T\n ) => ReactElement;\n}\n\nfunction DOMElement(\n ElementType: string,\n props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>,\n forwardedRef: ForwardedRef<HTMLElement>\n) {\n let {render, ...otherProps} = props;\n let elementRef = useRef<HTMLElement | null>(null);\n let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);\n\n useLayoutEffect(() => {\n if (process.env.NODE_ENV !== 'production' && render) {\n if (!elementRef.current) {\n console.warn(\n 'Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?'\n );\n } else if (elementRef.current.localName !== ElementType) {\n console.warn(\n `Unexpected DOM element returned by custom \\`render\\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`\n );\n }\n }\n }, [ElementType, render]);\n\n let domProps: any = {...otherProps, ref};\n if (render) {\n return render(domProps, undefined);\n }\n\n return <ElementType {...domProps} />;\n}\n\ntype DOMComponents = {\n [E in keyof React.JSX.IntrinsicElements]: (\n props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]\n ) => ReactElement;\n};\n\nconst domComponentCache = {};\n\n// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).\nexport const dom = new Proxy(\n {},\n {\n get(target, elementType) {\n if (typeof elementType !== 'string') {\n return undefined;\n }\n\n let res = domComponentCache[elementType];\n if (!res) {\n res = forwardRef(DOMElement.bind(null, elementType));\n domComponentCache[elementType] = res;\n }\n\n return res;\n }\n }\n) as DOMComponents;\n"],"names":[],"version":3,"file":"utils.js.map"}
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA0BM,MAAM,4CAAe,OAAO;AAkH5B,SAAS,0CAAgD,UAC9D,MAAM,YACN,QAAQ,EAC6C;IACrD,KAAK,IAAI,CAAC,SAAS,MAAM,IAAI,OAC3B,aAAa;IACb,yBAAW,gCAAC,QAAQ,QAAQ;QAAC,OAAO;OAAQ;IAG9C,OAAO;AACT;AA0EO,SAAS,wCACd,KAAmC;IAEnC,IAAI,aACF,SAAS,SACT,KAAK,YACL,QAAQ,oBACR,gBAAgB,mBAChB,eAAe,gBACf,YAAY,UACZ,MAAM,UACN,MAAM,EACP,GAAG;IAEJ,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,IAAI;QACJ,IAAI;QACJ,IAAI;QAEJ,IAAI,OAAO,cAAc,YACvB,oBAAoB,UAAU;YAAC,GAAG,MAAM;8BAAE;QAAgB;aAE1D,oBAAoB;QAGtB,IAAI,OAAO,UAAU,YACnB,gBAAgB,MAAM;YAAC,GAAG,MAAM;YAAE,cAAc,gBAAgB,CAAC;QAAC;aAElE,gBAAgB;QAGlB,IAAI,OAAO,aAAa,YACtB,mBAAmB,SAAS;YAAC,GAAG,MAAM;6BAAE;QAAe;aAClD,IAAI,YAAY,MACrB,mBAAmB;aAEn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CAAiB,CAAC,YAAY,GAAG;QACnC;QAEA,OAAO;IACT;AACF","sources":["packages/react-aria-components/src/utils.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, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {\n AllHTMLAttributes,\n AnchorHTMLAttributes,\n Context,\n CSSProperties,\n DetailedHTMLProps,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefCallback,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const DEFAULT_SLOT = Symbol('default');\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\nexport type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;\n\ntype ProviderValue<T> = [Context<T>, T];\ntype ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L, M> =\n | [ProviderValue<A>]\n | [ProviderValue<A>, ProviderValue<B>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>,\n ProviderValue<M>\n ];\n\ninterface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L, M> {\n values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L, M>;\n children: ReactNode;\n}\n\nexport function Provider<A, B, C, D, E, F, G, H, I, J, K, L, M>({\n values,\n children\n}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L, M>): JSX.Element {\n for (let [Context, value] of values) {\n // @ts-ignore\n children = <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n return children as JSX.Element;\n}\n\nexport interface StyleProps {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n */\n className?: string;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element.\n */\n style?: CSSProperties;\n}\n\nexport interface DOMProps extends StyleProps, SharedDOMProps {\n /** The children of the component. */\n children?: ReactNode;\n}\n\nexport type ClassNameOrFunction<T> =\n | string\n | ((values: T & {defaultClassName: string | undefined}) => string);\nexport type StyleOrFunction<T> =\n | CSSProperties\n | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);\n\nexport interface StyleRenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends DOMRenderProps<E, T> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n */\n className?: ClassNameOrFunction<T>;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element. A function may be provided to compute the style based on component state.\n */\n style?: StyleOrFunction<T>;\n}\n\nexport type ChildrenOrFunction<T> =\n | ReactNode\n | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);\n\nexport interface RenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends StyleRenderProps<T, E> {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children?: ChildrenOrFunction<T>;\n}\n\ninterface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements>\n extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {\n values: T;\n defaultChildren?: ReactNode;\n defaultClassName?: string;\n defaultStyle?: CSSProperties;\n}\n\ninterface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n 'data-rac': string;\n render?: DOMRenderFunction<E, T>;\n}\n\nexport function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(\n props: RenderPropsHookOptions<T, E>\n): RenderPropsHookRetVal<T, E> {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values,\n render\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: React.CSSProperties | undefined;\n let computedChildren: React.ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: computedStyle || defaultStyle ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': '',\n render: render ? props => render(props, values) : undefined\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);\n}\n\n/**\n * A helper function that accepts a user-provided render prop value (either a static value or a\n * function), and combines it with another value to create a final result.\n */\nexport function composeRenderProps<T, U, V extends T>(\n // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage\n value: T extends any ? T | ((renderProps: U) => V) : never,\n wrap: (prevValue: T, renderProps: U) => V\n): (renderProps: U) => V {\n return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);\n}\n\nexport type WithRef<T, E> = T & {ref?: ForwardedRef<E>};\nexport interface SlotProps {\n /**\n * A slot name for the component. Slots allow the component to receive props from a parent\n * component. An explicit `null` value indicates that the local props completely override all\n * props received from a parent.\n */\n slot?: string | null;\n}\n\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null\n): T | null | undefined {\n let ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means don't use context.\n return null;\n }\n if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {\n let slotKey = slot || DEFAULT_SLOT;\n if (!ctx.slots[slotKey]) {\n let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `\"${p}\"`));\n let errorMessage = slot ? `Invalid slot \"${slot}\".` : 'A slot prop is required.';\n\n throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);\n }\n return ctx.slots[slotKey];\n }\n // @ts-ignore\n return ctx;\n}\n\nexport function useContextProps<T, U extends SlotProps, E extends Element>(\n props: T & SlotProps,\n ref: ForwardedRef<E> | undefined,\n context: Context<ContextValue<U, E>>\n): [T, RefObject<E | null>] {\n let ctx = useSlottedContext(context, props.slot) || {};\n let {ref: contextRef, ...contextProps} = ctx as any;\n let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));\n let mergedProps = mergeProps(contextProps, props) as unknown as T;\n\n // mergeProps does not merge `style`. Adding this there might be a breaking change.\n if ('style' in contextProps && contextProps.style && 'style' in props && props.style) {\n if (typeof contextProps.style === 'function' || typeof props.style === 'function') {\n // @ts-ignore\n mergedProps.style = renderProps => {\n let contextStyle =\n typeof contextProps.style === 'function'\n ? contextProps.style(renderProps)\n : contextProps.style;\n let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};\n let style =\n typeof props.style === 'function'\n ? props.style({...renderProps, defaultStyle})\n : props.style;\n return {...defaultStyle, ...style};\n };\n } else {\n // @ts-ignore\n mergedProps.style = {...contextProps.style, ...props.style};\n }\n }\n\n return [mergedProps, mergedRef];\n}\n\nexport function useSlot(\n initialState: boolean | (() => boolean) = true\n): [RefCallback<Element>, boolean] {\n // Initial state is typically based on the parent having an aria-label or aria-labelledby.\n // If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect\n let [hasSlot, setHasSlot] = useState(initialState);\n let hasRun = useRef(false);\n\n // A callback ref which will run when the slotted element mounts.\n // This should happen before the useLayoutEffect below.\n let ref = useCallback(el => {\n hasRun.current = true;\n setHasSlot(!!el);\n }, []);\n\n // If the callback hasn't been called, then reset to false.\n useLayoutEffect(() => {\n if (!hasRun.current) {\n setHasSlot(false);\n }\n }, []);\n\n return [ref, hasSlot];\n}\n\n/**\n * Filters out `data-*` attributes to keep them from being passed down and duplicated.\n *\n * @param props\n */\nexport function removeDataAttributes<T>(props: T): T {\n const prefix = /^(data-.*)$/;\n let filteredProps = {} as T;\n\n for (const prop in props) {\n if (!prefix.test(prop)) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n\n// Override base type to change the default.\nexport interface RACValidation {\n /**\n * Whether to use native HTML form validation to prevent form submission\n * when the value is missing or invalid, or mark the field as required\n * or invalid via ARIA.\n *\n * @default 'native'\n */\n validationBehavior?: 'native' | 'aria';\n}\n\nexport type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (\n props: React.JSX.IntrinsicElements[E],\n renderProps: T\n) => ReactElement;\nexport interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an\n * `<a>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: DOMRenderFunction<E, T>;\n}\n\n// Makes `href` required in AnchorHTMLAttributes\ntype LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> &\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n\n// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.\nexport interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<a>` is expected, you cannot render a\n * `<button>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: (\n props:\n | DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>\n | React.JSX.IntrinsicElements[Fallback],\n renderProps: T\n ) => ReactElement;\n}\n\nfunction DOMElement(\n ElementType: string,\n props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>,\n forwardedRef: ForwardedRef<HTMLElement>\n) {\n let {render, ...otherProps} = props;\n let elementRef = useRef<HTMLElement | null>(null);\n let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);\n\n useLayoutEffect(() => {\n if (process.env.NODE_ENV !== 'production' && render) {\n if (!elementRef.current) {\n console.warn(\n 'Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?'\n );\n } else if (elementRef.current.localName !== ElementType) {\n console.warn(\n `Unexpected DOM element returned by custom \\`render\\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`\n );\n }\n }\n }, [ElementType, render]);\n\n let domProps: any = {...otherProps, ref};\n if (render) {\n return render(domProps, undefined);\n }\n\n return <ElementType {...domProps} />;\n}\n\ntype DOMComponents = {\n [E in keyof React.JSX.IntrinsicElements]: (\n props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]\n ) => ReactElement;\n};\n\nconst domComponentCache = {};\n\n// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).\nexport const dom = new Proxy(\n {},\n {\n get(target, elementType) {\n if (typeof elementType !== 'string') {\n return undefined;\n }\n\n let res = domComponentCache[elementType];\n if (!res) {\n res = forwardRef(DOMElement.bind(null, elementType));\n domComponentCache[elementType] = res;\n }\n\n return res;\n }\n }\n) as DOMComponents;\n"],"names":[],"version":3,"file":"utils.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA0BM,MAAM,4CAAe,OAAO;AAmG5B,SAAS,0CAA6C,UAC3D,MAAM,YACN,QAAQ,EAC0C;IAClD,KAAK,IAAI,CAAC,SAAS,MAAM,IAAI,OAC3B,aAAa;IACb,yBAAW,gCAAC,QAAQ,QAAQ;QAAC,OAAO;OAAQ;IAG9C,OAAO;AACT;AA0EO,SAAS,wCACd,KAAmC;IAEnC,IAAI,aACF,SAAS,SACT,KAAK,YACL,QAAQ,oBACR,gBAAgB,mBAChB,eAAe,gBACf,YAAY,UACZ,MAAM,UACN,MAAM,EACP,GAAG;IAEJ,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,IAAI;QACJ,IAAI;QACJ,IAAI;QAEJ,IAAI,OAAO,cAAc,YACvB,oBAAoB,UAAU;YAAC,GAAG,MAAM;8BAAE;QAAgB;aAE1D,oBAAoB;QAGtB,IAAI,OAAO,UAAU,YACnB,gBAAgB,MAAM;YAAC,GAAG,MAAM;YAAE,cAAc,gBAAgB,CAAC;QAAC;aAElE,gBAAgB;QAGlB,IAAI,OAAO,aAAa,YACtB,mBAAmB,SAAS;YAAC,GAAG,MAAM;6BAAE;QAAe;aAClD,IAAI,YAAY,MACrB,mBAAmB;aAEnB,mBAAmB;QAGrB,OAAO;YACL,WAAW,qBAAqB;YAChC,OAAO,iBAAiB,eAAe;gBAAC,GAAG,YAAY;gBAAE,GAAG,aAAa;YAAA,IAAI;YAC7E,UAAU,oBAAoB;YAC9B,YAAY;YACZ,QAAQ,SAAS,CAAA,QAAS,OAAO,OAAO,UAAU;QACpD;IACF,GAAG;QAAC;QAAW;QAAO;QAAU;QAAkB;QAA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B,KAAgE,EAChE,YAAuC;IAEvC,IAAI,UAAC,MAAM,EAAE,GAAG,YAAW,GAAG;IAC9B,IAAI,aAAa,CAAA,GAAA,aAAK,EAAsB;IAC5C,IAAI,MAAM,CAAA,GAAA,cAAM,EAAE,IAAM,CAAA,GAAA,gBAAQ,EAAE,cAAc,aAAa;QAAC;QAAc;KAAW;IAEvF,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBAAgB,QAAQ;YACnD,IAAI,CAAC,WAAW,OAAO,EACrB,QAAQ,IAAI,CACV;iBAEG,IAAI,WAAW,OAAO,CAAC,SAAS,KAAK,aAC1C,QAAQ,IAAI,CACV,CAAC,yEAAyE,EAAE,YAAY,QAAQ,EAAE,WAAW,OAAO,CAAC,SAAS,CAAC,2DAA2D,CAAC;QAGjM;IACF,GAAG;QAAC;QAAa;KAAO;IAExB,IAAI,WAAgB;QAAC,GAAG,UAAU;aAAE;IAAG;IACvC,IAAI,QACF,OAAO,OAAO,UAAU;IAG1B,qBAAO,gCAAC,aAAgB;AAC1B;AAQA,MAAM,0CAAoB,CAAC;AAGpB,MAAM,4CAAM,IAAI,MACrB,CAAC,GACD;IACE,KAAI,MAAM,EAAE,WAAW;QACrB,IAAI,OAAO,gBAAgB,UACzB,OAAO;QAGT,IAAI,MAAM,uCAAiB,CAAC,YAAY;QACxC,IAAI,CAAC,KAAK;YACR,oBAAM,CAAA,GAAA,iBAAS,EAAE,iCAAW,IAAI,CAAC,MAAM;YACvC,uCAAiB,CAAC,YAAY,GAAG;QACnC;QAEA,OAAO;IACT;AACF","sources":["packages/react-aria-components/src/utils.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, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {\n AllHTMLAttributes,\n AnchorHTMLAttributes,\n Context,\n CSSProperties,\n DetailedHTMLProps,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefCallback,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const DEFAULT_SLOT = Symbol('default');\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\nexport type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;\n\ntype ProviderValue<T> = [Context<T>, T];\ntype ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L> =\n | [ProviderValue<A>]\n | [ProviderValue<A>, ProviderValue<B>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>\n ];\n\ninterface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L> {\n values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L>;\n children: ReactNode;\n}\n\nexport function Provider<A, B, C, D, E, F, G, H, I, J, K, L>({\n values,\n children\n}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L>): JSX.Element {\n for (let [Context, value] of values) {\n // @ts-ignore\n children = <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n return children as JSX.Element;\n}\n\nexport interface StyleProps {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n */\n className?: string;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element.\n */\n style?: CSSProperties;\n}\n\nexport interface DOMProps extends StyleProps, SharedDOMProps {\n /** The children of the component. */\n children?: ReactNode;\n}\n\nexport type ClassNameOrFunction<T> =\n | string\n | ((values: T & {defaultClassName: string | undefined}) => string);\ntype StyleOrFunction<T> =\n | CSSProperties\n | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);\n\nexport interface StyleRenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends DOMRenderProps<E, T> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n */\n className?: ClassNameOrFunction<T>;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element. A function may be provided to compute the style based on component state.\n */\n style?: StyleOrFunction<T>;\n}\n\nexport type ChildrenOrFunction<T> =\n | ReactNode\n | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);\n\nexport interface RenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends StyleRenderProps<T, E> {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children?: ChildrenOrFunction<T>;\n}\n\ninterface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements>\n extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {\n values: T;\n defaultChildren?: ReactNode;\n defaultClassName?: string;\n defaultStyle?: CSSProperties;\n}\n\ninterface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n 'data-rac': string;\n render?: DOMRenderFunction<E, T>;\n}\n\nexport function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(\n props: RenderPropsHookOptions<T, E>\n): RenderPropsHookRetVal<T, E> {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values,\n render\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: React.CSSProperties | undefined;\n let computedChildren: React.ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: computedStyle || defaultStyle ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': '',\n render: render ? props => render(props, values) : undefined\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);\n}\n\n/**\n * A helper function that accepts a user-provided render prop value (either a static value or a\n * function), and combines it with another value to create a final result.\n */\nexport function composeRenderProps<T, U, V extends T>(\n // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage\n value: T extends any ? T | ((renderProps: U) => V) : never,\n wrap: (prevValue: T, renderProps: U) => V\n): (renderProps: U) => V {\n return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);\n}\n\nexport type WithRef<T, E> = T & {ref?: ForwardedRef<E>};\nexport interface SlotProps {\n /**\n * A slot name for the component. Slots allow the component to receive props from a parent\n * component. An explicit `null` value indicates that the local props completely override all\n * props received from a parent.\n */\n slot?: string | null;\n}\n\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null\n): T | null | undefined {\n let ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means don't use context.\n return null;\n }\n if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {\n let slotKey = slot || DEFAULT_SLOT;\n if (!ctx.slots[slotKey]) {\n let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `\"${p}\"`));\n let errorMessage = slot ? `Invalid slot \"${slot}\".` : 'A slot prop is required.';\n\n throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);\n }\n return ctx.slots[slotKey];\n }\n // @ts-ignore\n return ctx;\n}\n\nexport function useContextProps<T, U extends SlotProps, E extends Element>(\n props: T & SlotProps,\n ref: ForwardedRef<E> | undefined,\n context: Context<ContextValue<U, E>>\n): [T, RefObject<E | null>] {\n let ctx = useSlottedContext(context, props.slot) || {};\n let {ref: contextRef, ...contextProps} = ctx as any;\n let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));\n let mergedProps = mergeProps(contextProps, props) as unknown as T;\n\n // mergeProps does not merge `style`. Adding this there might be a breaking change.\n if ('style' in contextProps && contextProps.style && 'style' in props && props.style) {\n if (typeof contextProps.style === 'function' || typeof props.style === 'function') {\n // @ts-ignore\n mergedProps.style = renderProps => {\n let contextStyle =\n typeof contextProps.style === 'function'\n ? contextProps.style(renderProps)\n : contextProps.style;\n let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};\n let style =\n typeof props.style === 'function'\n ? props.style({...renderProps, defaultStyle})\n : props.style;\n return {...defaultStyle, ...style};\n };\n } else {\n // @ts-ignore\n mergedProps.style = {...contextProps.style, ...props.style};\n }\n }\n\n return [mergedProps, mergedRef];\n}\n\nexport function useSlot(\n initialState: boolean | (() => boolean) = true\n): [RefCallback<Element>, boolean] {\n // Initial state is typically based on the parent having an aria-label or aria-labelledby.\n // If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect\n let [hasSlot, setHasSlot] = useState(initialState);\n let hasRun = useRef(false);\n\n // A callback ref which will run when the slotted element mounts.\n // This should happen before the useLayoutEffect below.\n let ref = useCallback(el => {\n hasRun.current = true;\n setHasSlot(!!el);\n }, []);\n\n // If the callback hasn't been called, then reset to false.\n useLayoutEffect(() => {\n if (!hasRun.current) {\n setHasSlot(false);\n }\n }, []);\n\n return [ref, hasSlot];\n}\n\n/**\n * Filters out `data-*` attributes to keep them from being passed down and duplicated.\n *\n * @param props\n */\nexport function removeDataAttributes<T>(props: T): T {\n const prefix = /^(data-.*)$/;\n let filteredProps = {} as T;\n\n for (const prop in props) {\n if (!prefix.test(prop)) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n\n// Override base type to change the default.\nexport interface RACValidation {\n /**\n * Whether to use native HTML form validation to prevent form submission\n * when the value is missing or invalid, or mark the field as required\n * or invalid via ARIA.\n *\n * @default 'native'\n */\n validationBehavior?: 'native' | 'aria';\n}\n\nexport type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (\n props: React.JSX.IntrinsicElements[E],\n renderProps: T\n) => ReactElement;\nexport interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an\n * `<a>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: DOMRenderFunction<E, T>;\n}\n\n// Makes `href` required in AnchorHTMLAttributes\ntype LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> &\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n\n// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.\nexport interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<a>` is expected, you cannot render a\n * `<button>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: (\n props:\n | DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>\n | React.JSX.IntrinsicElements[Fallback],\n renderProps: T\n ) => ReactElement;\n}\n\nfunction DOMElement(\n ElementType: string,\n props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>,\n forwardedRef: ForwardedRef<HTMLElement>\n) {\n let {render, ...otherProps} = props;\n let elementRef = useRef<HTMLElement | null>(null);\n let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);\n\n useLayoutEffect(() => {\n if (process.env.NODE_ENV !== 'production' && render) {\n if (!elementRef.current) {\n console.warn(\n 'Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?'\n );\n } else if (elementRef.current.localName !== ElementType) {\n console.warn(\n `Unexpected DOM element returned by custom \\`render\\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`\n );\n }\n }\n }, [ElementType, render]);\n\n let domProps: any = {...otherProps, ref};\n if (render) {\n return render(domProps, undefined);\n }\n\n return <ElementType {...domProps} />;\n}\n\ntype DOMComponents = {\n [E in keyof React.JSX.IntrinsicElements]: (\n props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]\n ) => ReactElement;\n};\n\nconst domComponentCache = {};\n\n// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).\nexport const dom = new Proxy(\n {},\n {\n get(target, elementType) {\n if (typeof elementType !== 'string') {\n return undefined;\n }\n\n let res = domComponentCache[elementType];\n if (!res) {\n res = forwardRef(DOMElement.bind(null, elementType));\n domComponentCache[elementType] = res;\n }\n\n return res;\n }\n }\n) as DOMComponents;\n"],"names":[],"version":3,"file":"utils.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA0BM,MAAM,4CAAe,OAAO;AAkH5B,SAAS,0CAAgD,UAC9D,MAAM,YACN,QAAQ,EAC6C;IACrD,KAAK,IAAI,CAAC,SAAS,MAAM,IAAI,OAC3B,aAAa;IACb,yBAAW,gCAAC,QAAQ,QAAQ;QAAC,OAAO;OAAQ;IAG9C,OAAO;AACT;AA0EO,SAAS,wCACd,KAAmC;IAEnC,IAAI,aACF,SAAS,SACT,KAAK,YACL,QAAQ,oB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,CAAC;QAGjM;IACF,GAAG;QAAC;QAAa;KAAO;IAExB,IAAI,WAAgB;QAAC,GAAG,UAAU;aAAE;IAAG;IACvC,IAAI,QACF,OAAO,OAAO,UAAU;IAG1B,qBAAO,gCAAC,aAAgB;AAC1B;AAQA,MAAM,0CAAoB,CAAC;AAGpB,MAAM,4CAAM,IAAI,MACrB,CAAC,GACD;IACE,KAAI,MAAM,EAAE,WAAW;QACrB,IAAI,OAAO,gBAAgB,UACzB,OAAO;QAGT,IAAI,MAAM,uCAAiB,CAAC,YAAY;QACxC,IAAI,CAAC,KAAK;YACR,oBAAM,CAAA,GAAA,iBAAS,EAAE,iCAAW,IAAI,CAAC,MAAM;YACvC,uCAAiB,CAAC,YAAY,GAAG;QACnC;QAEA,OAAO;IACT;AACF","sources":["packages/react-aria-components/src/utils.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, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {\n AllHTMLAttributes,\n AnchorHTMLAttributes,\n Context,\n CSSProperties,\n DetailedHTMLProps,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefCallback,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const DEFAULT_SLOT = Symbol('default');\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\nexport type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;\n\ntype ProviderValue<T> = [Context<T>, T];\ntype ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L, M> =\n | [ProviderValue<A>]\n | [ProviderValue<A>, ProviderValue<B>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>,\n ProviderValue<M>\n ];\n\ninterface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L, M> {\n values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L, M>;\n children: ReactNode;\n}\n\nexport function Provider<A, B, C, D, E, F, G, H, I, J, K, L, M>({\n values,\n children\n}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L, M>): JSX.Element {\n for (let [Context, value] of values) {\n // @ts-ignore\n children = <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n return children as JSX.Element;\n}\n\nexport interface StyleProps {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n */\n className?: string;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element.\n */\n style?: CSSProperties;\n}\n\nexport interface DOMProps extends StyleProps, SharedDOMProps {\n /** The children of the component. */\n children?: ReactNode;\n}\n\nexport type ClassNameOrFunction<T> =\n | string\n | ((values: T & {defaultClassName: string | undefined}) => string);\nexport type StyleOrFunction<T> =\n | CSSProperties\n | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);\n\nexport interface StyleRenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends DOMRenderProps<E, T> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n */\n className?: ClassNameOrFunction<T>;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element. A function may be provided to compute the style based on component state.\n */\n style?: StyleOrFunction<T>;\n}\n\nexport type ChildrenOrFunction<T> =\n | ReactNode\n | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);\n\nexport interface RenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends StyleRenderProps<T, E> {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children?: ChildrenOrFunction<T>;\n}\n\ninterface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements>\n extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {\n values: T;\n defaultChildren?: ReactNode;\n defaultClassName?: string;\n defaultStyle?: CSSProperties;\n}\n\ninterface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n 'data-rac': string;\n render?: DOMRenderFunction<E, T>;\n}\n\nexport function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(\n props: RenderPropsHookOptions<T, E>\n): RenderPropsHookRetVal<T, E> {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values,\n render\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: React.CSSProperties | undefined;\n let computedChildren: React.ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: computedStyle || defaultStyle ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': '',\n render: render ? props => render(props, values) : undefined\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);\n}\n\n/**\n * A helper function that accepts a user-provided render prop value (either a static value or a\n * function), and combines it with another value to create a final result.\n */\nexport function composeRenderProps<T, U, V extends T>(\n // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage\n value: T extends any ? T | ((renderProps: U) => V) : never,\n wrap: (prevValue: T, renderProps: U) => V\n): (renderProps: U) => V {\n return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);\n}\n\nexport type WithRef<T, E> = T & {ref?: ForwardedRef<E>};\nexport interface SlotProps {\n /**\n * A slot name for the component. Slots allow the component to receive props from a parent\n * component. An explicit `null` value indicates that the local props completely override all\n * props received from a parent.\n */\n slot?: string | null;\n}\n\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null\n): T | null | undefined {\n let ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means don't use context.\n return null;\n }\n if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {\n let slotKey = slot || DEFAULT_SLOT;\n if (!ctx.slots[slotKey]) {\n let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `\"${p}\"`));\n let errorMessage = slot ? `Invalid slot \"${slot}\".` : 'A slot prop is required.';\n\n throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);\n }\n return ctx.slots[slotKey];\n }\n // @ts-ignore\n return ctx;\n}\n\nexport function useContextProps<T, U extends SlotProps, E extends Element>(\n props: T & SlotProps,\n ref: ForwardedRef<E> | undefined,\n context: Context<ContextValue<U, E>>\n): [T, RefObject<E | null>] {\n let ctx = useSlottedContext(context, props.slot) || {};\n let {ref: contextRef, ...contextProps} = ctx as any;\n let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));\n let mergedProps = mergeProps(contextProps, props) as unknown as T;\n\n // mergeProps does not merge `style`. Adding this there might be a breaking change.\n if ('style' in contextProps && contextProps.style && 'style' in props && props.style) {\n if (typeof contextProps.style === 'function' || typeof props.style === 'function') {\n // @ts-ignore\n mergedProps.style = renderProps => {\n let contextStyle =\n typeof contextProps.style === 'function'\n ? contextProps.style(renderProps)\n : contextProps.style;\n let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};\n let style =\n typeof props.style === 'function'\n ? props.style({...renderProps, defaultStyle})\n : props.style;\n return {...defaultStyle, ...style};\n };\n } else {\n // @ts-ignore\n mergedProps.style = {...contextProps.style, ...props.style};\n }\n }\n\n return [mergedProps, mergedRef];\n}\n\nexport function useSlot(\n initialState: boolean | (() => boolean) = true\n): [RefCallback<Element>, boolean] {\n // Initial state is typically based on the parent having an aria-label or aria-labelledby.\n // If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect\n let [hasSlot, setHasSlot] = useState(initialState);\n let hasRun = useRef(false);\n\n // A callback ref which will run when the slotted element mounts.\n // This should happen before the useLayoutEffect below.\n let ref = useCallback(el => {\n hasRun.current = true;\n setHasSlot(!!el);\n }, []);\n\n // If the callback hasn't been called, then reset to false.\n useLayoutEffect(() => {\n if (!hasRun.current) {\n setHasSlot(false);\n }\n }, []);\n\n return [ref, hasSlot];\n}\n\n/**\n * Filters out `data-*` attributes to keep them from being passed down and duplicated.\n *\n * @param props\n */\nexport function removeDataAttributes<T>(props: T): T {\n const prefix = /^(data-.*)$/;\n let filteredProps = {} as T;\n\n for (const prop in props) {\n if (!prefix.test(prop)) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n\n// Override base type to change the default.\nexport interface RACValidation {\n /**\n * Whether to use native HTML form validation to prevent form submission\n * when the value is missing or invalid, or mark the field as required\n * or invalid via ARIA.\n *\n * @default 'native'\n */\n validationBehavior?: 'native' | 'aria';\n}\n\nexport type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (\n props: React.JSX.IntrinsicElements[E],\n renderProps: T\n) => ReactElement;\nexport interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an\n * `<a>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: DOMRenderFunction<E, T>;\n}\n\n// Makes `href` required in AnchorHTMLAttributes\ntype LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> &\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n\n// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.\nexport interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<a>` is expected, you cannot render a\n * `<button>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: (\n props:\n | DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>\n | React.JSX.IntrinsicElements[Fallback],\n renderProps: T\n ) => ReactElement;\n}\n\nfunction DOMElement(\n ElementType: string,\n props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>,\n forwardedRef: ForwardedRef<HTMLElement>\n) {\n let {render, ...otherProps} = props;\n let elementRef = useRef<HTMLElement | null>(null);\n let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);\n\n useLayoutEffect(() => {\n if (process.env.NODE_ENV !== 'production' && render) {\n if (!elementRef.current) {\n console.warn(\n 'Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?'\n );\n } else if (elementRef.current.localName !== ElementType) {\n console.warn(\n `Unexpected DOM element returned by custom \\`render\\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`\n );\n }\n }\n }, [ElementType, render]);\n\n let domProps: any = {...otherProps, ref};\n if (render) {\n return render(domProps, undefined);\n }\n\n return <ElementType {...domProps} />;\n}\n\ntype DOMComponents = {\n [E in keyof React.JSX.IntrinsicElements]: (\n props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]\n ) => ReactElement;\n};\n\nconst domComponentCache = {};\n\n// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).\nexport const dom = new Proxy(\n {},\n {\n get(target, elementType) {\n if (typeof elementType !== 'string') {\n return undefined;\n }\n\n let res = domComponentCache[elementType];\n if (!res) {\n res = forwardRef(DOMElement.bind(null, elementType));\n domComponentCache[elementType] = res;\n }\n\n return res;\n }\n }\n) as DOMComponents;\n"],"names":[],"version":3,"file":"utils.mjs.map"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'client-only';
|
|
2
2
|
export { GridListLoadMoreItem, GridList, GridListItem, GridListContext, GridListHeader, GridListHeaderContext, GridListSection } from '../src/GridList';
|
|
3
3
|
export { Collection, type CollectionProps } from 'react-aria/Collection';
|
|
4
|
-
export type { GridListProps, GridListRenderProps, GridListItemProps, GridListItemRenderProps, GridListLoadMoreItemProps, GridListSectionProps } from '../src/GridList';
|
|
4
|
+
export type { GridListHeaderProps, GridListProps, GridListRenderProps, GridListItemProps, GridListItemRenderProps, GridListLoadMoreItemProps, GridListSectionProps } from '../src/GridList';
|
|
5
5
|
export type { Key, Selection, SelectionMode, DirectoryDropItem, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem } from '@react-types/shared';
|
|
6
6
|
export type { ListState } from 'react-stately/useListState';
|
|
7
7
|
export { Button } from '../src/Button';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { TokenField, TokenInput, Token } from '../src/TokenField';
|
|
2
|
+
export type { TokenFieldProps, TokenFieldRenderProps, TokenInputProps, TokenInputRenderProps, TokenProps, TokenRenderProps, TokenFieldContext } from '../src/TokenField';
|
|
3
|
+
export { tokenFieldPositionToDOMRange, setTokenFieldSelection } from 'react-aria/useTokenField';
|
|
4
|
+
export { TokenFieldValue } from 'react-stately/useTokenFieldState';
|
|
5
|
+
export type { TokenFieldSegment, TokenSegment, TextSegment, Position, TokenFieldValueOptions } from 'react-stately/useTokenFieldState';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'client-only';
|
|
2
2
|
export { TreeLoadMoreItem, Tree, TreeItem, TreeContext, TreeItemContent, TreeHeader, TreeSection, TreeStateContext } from '../src/Tree';
|
|
3
|
-
export type { TreeProps, TreeRenderProps, TreeEmptyStateRenderProps, TreeItemProps, TreeItemRenderProps, TreeItemContentProps, TreeItemContentRenderProps, TreeLoadMoreItemProps, TreeLoadMoreItemRenderProps } from '../src/Tree';
|
|
3
|
+
export type { TreeSectionProps, TreeHeaderProps, TreeProps, TreeRenderProps, TreeEmptyStateRenderProps, TreeItemProps, TreeItemRenderProps, TreeItemContentProps, TreeItemContentRenderProps, TreeLoadMoreItemProps, TreeLoadMoreItemRenderProps } from '../src/Tree';
|
|
4
4
|
export type { Key, Selection, SelectionMode, DirectoryDropItem, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem } from '@react-types/shared';
|
|
5
5
|
export type { TreeState } from 'react-stately/useTreeState';
|
|
6
6
|
export { Button } from '../src/Button';
|
|
@@ -33,6 +33,7 @@ export { createLeafComponent, createBranchComponent, CollectionBuilder } from 'r
|
|
|
33
33
|
export { Keyboard, KeyboardContext } from '../src/Keyboard';
|
|
34
34
|
export { Label, LabelContext } from '../src/Label';
|
|
35
35
|
export { Link, LinkContext } from '../src/Link';
|
|
36
|
+
export { PreviewTrigger } from '../src/PreviewTrigger';
|
|
36
37
|
export { ListBoxLoadMoreItem, ListBox, ListBoxItem, ListBoxSection, ListBoxContext, ListStateContext } from '../src/ListBox';
|
|
37
38
|
export { Menu, MenuItem, MenuTrigger, MenuSection, MenuContext, MenuStateContext, RootMenuTriggerStateContext, SubmenuTrigger } from '../src/Menu';
|
|
38
39
|
export { Meter, MeterContext } from '../src/Meter';
|
|
@@ -56,6 +57,8 @@ export { TagGroup, TagGroupContext, TagList, TagListContext, Tag } from '../src/
|
|
|
56
57
|
export { Text, TextContext } from '../src/Text';
|
|
57
58
|
export { TextArea, TextAreaContext } from '../src/TextArea';
|
|
58
59
|
export { TextField, TextFieldContext } from '../src/TextField';
|
|
60
|
+
export { TokenField, TokenInput, Token, TokenFieldContext } from '../src/TokenField';
|
|
61
|
+
export { TokenFieldValue } from 'react-stately/useTokenFieldState';
|
|
59
62
|
export { UNSTABLE_Toast, UNSTABLE_ToastList, UNSTABLE_ToastRegion, UNSTABLE_ToastContent, UNSTABLE_ToastStateContext } from '../src/Toast';
|
|
60
63
|
export { ToggleButton, ToggleButtonContext } from '../src/ToggleButton';
|
|
61
64
|
export { ToggleButtonGroup, ToggleButtonGroupContext, ToggleGroupStateContext } from '../src/ToggleButtonGroup';
|
|
@@ -108,7 +111,7 @@ export type { DropZoneProps, DropZoneRenderProps } from '../src/DropZone';
|
|
|
108
111
|
export type { FieldErrorProps, FieldErrorRenderProps } from '../src/FieldError';
|
|
109
112
|
export type { FileTriggerProps } from '../src/FileTrigger';
|
|
110
113
|
export type { FormProps } from '../src/Form';
|
|
111
|
-
export type { GridListProps, GridListRenderProps, GridListItemProps, GridListItemRenderProps, GridListLoadMoreItemProps, GridListSectionProps } from '../src/GridList';
|
|
114
|
+
export type { GridListHeaderProps, GridListProps, GridListRenderProps, GridListItemProps, GridListItemRenderProps, GridListLoadMoreItemProps, GridListSectionProps } from '../src/GridList';
|
|
112
115
|
export type { GroupProps, GroupRenderProps } from '../src/Group';
|
|
113
116
|
export type { HeaderProps } from '../src/Header';
|
|
114
117
|
export type { HeadingProps } from '../src/Heading';
|
|
@@ -116,6 +119,7 @@ export type { InputProps, InputRenderProps } from '../src/Input';
|
|
|
116
119
|
export type { SectionProps, CollectionRenderer } from '../src/Collection';
|
|
117
120
|
export type { LabelProps } from '../src/Label';
|
|
118
121
|
export type { LinkProps, LinkRenderProps } from '../src/Link';
|
|
122
|
+
export type { PreviewTriggerProps } from '../src/PreviewTrigger';
|
|
119
123
|
export type { ListBoxProps, ListBoxRenderProps, ListBoxItemProps, ListBoxItemRenderProps, ListBoxSectionProps, ListBoxLoadMoreItemProps } from '../src/ListBox';
|
|
120
124
|
export type { MenuProps, MenuItemProps, MenuItemRenderProps, MenuTriggerProps, SubmenuTriggerProps, MenuSectionProps } from '../src/Menu';
|
|
121
125
|
export type { MeterProps, MeterRenderProps } from '../src/Meter';
|
|
@@ -137,6 +141,7 @@ export type { TabListProps, TabListRenderProps, TabPanelsProps, TabPanelProps, T
|
|
|
137
141
|
export type { TagGroupProps, TagListProps, TagListRenderProps, TagProps, TagRenderProps } from '../src/TagGroup';
|
|
138
142
|
export type { TextAreaProps } from '../src/TextArea';
|
|
139
143
|
export type { TextFieldProps, TextFieldRenderProps } from '../src/TextField';
|
|
144
|
+
export type { TokenFieldProps, TokenFieldRenderProps, TokenInputProps, TokenInputRenderProps, TokenProps, TokenRenderProps } from '../src/TokenField';
|
|
140
145
|
export type { TextProps } from '../src/Text';
|
|
141
146
|
export type { ToastRegionProps, ToastListProps, ToastRegionRenderProps, ToastProps, ToastRenderProps } from '../src/Toast';
|
|
142
147
|
export type { ToggleButtonProps, ToggleButtonRenderProps } from '../src/ToggleButton';
|
|
@@ -146,7 +151,7 @@ export type { TooltipProps, TooltipRenderProps, TooltipTriggerComponentProps } f
|
|
|
146
151
|
export type { TreeProps, TreeRenderProps, TreeEmptyStateRenderProps, TreeItemProps, TreeItemRenderProps, TreeItemContentProps, TreeItemContentRenderProps, TreeLoadMoreItemProps, TreeLoadMoreItemRenderProps } from '../src/Tree';
|
|
147
152
|
export type { DragOptions, DragResult } from 'react-aria/useDrag';
|
|
148
153
|
export type { DragAndDropHooks, DragAndDropOptions, DropIndicatorProps, DropIndicatorRenderProps } from '../src/useDragAndDrop';
|
|
149
|
-
export type { ContextValue, RenderProps, SlotProps, StyleRenderProps } from '../src/utils';
|
|
154
|
+
export type { ContextValue, RenderProps, SlotProps, StyleRenderProps, DOMRenderProps, PossibleLinkDOMRenderProps, DOMRenderFunction, ClassNameOrFunction, StyleOrFunction, ChildrenOrFunction } from '../src/utils';
|
|
150
155
|
export type { VirtualizerProps } from '../src/Virtualizer';
|
|
151
156
|
export type { DateValue } from 'react-stately/useDateFieldState';
|
|
152
157
|
export type { DateRange } from 'react-stately/useDateRangePickerState';
|
|
@@ -44,7 +44,10 @@ export interface ComboBoxProps<T, M extends SelectionMode = 'single'> extends Om
|
|
|
44
44
|
* @default 'react-aria-ComboBox'
|
|
45
45
|
*/
|
|
46
46
|
className?: ClassNameOrFunction<ComboBoxRenderProps>;
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* The filter function used to determine if an option should be included in the combo box list.
|
|
49
|
+
* By default, a language-sensitive "contains" filter from `useFilter` is used.
|
|
50
|
+
*/
|
|
48
51
|
defaultFilter?: (textValue: string, inputValue: string) => boolean;
|
|
49
52
|
/**
|
|
50
53
|
* Whether the text or key of the selected item is submitted as part of an HTML form. When
|
|
@@ -141,12 +141,23 @@ export interface GridListItemProps<T = object> extends RenderProps<GridListItemR
|
|
|
141
141
|
* on the collection's `selectionBehavior` prop and the interaction modality.
|
|
142
142
|
*/
|
|
143
143
|
onAction?: () => void;
|
|
144
|
+
/**
|
|
145
|
+
* Whether the row or its first focusable child element should be focused when navigating
|
|
146
|
+
* to the row. Defaults to 'row'.
|
|
147
|
+
*/
|
|
148
|
+
focusMode?: 'child' | 'row';
|
|
149
|
+
/**
|
|
150
|
+
* Whether the row should support arrow key navigation even when the containing collection uses
|
|
151
|
+
* tab keyboard navigation. Allows users to navigate between rows with arrow keys while
|
|
152
|
+
* focus is on an interactive child element within the row.
|
|
153
|
+
*/
|
|
154
|
+
allowsArrowNavigation?: boolean;
|
|
144
155
|
}
|
|
145
156
|
/**
|
|
146
157
|
* A GridListItem represents an individual item in a GridList.
|
|
147
158
|
*/
|
|
148
159
|
export declare const GridListItem: <T>(props: GridListItemProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
149
|
-
export interface GridListLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection'>, StyleProps, DOMRenderProps<'div', undefined>, GlobalDOMAttributes<HTMLDivElement> {
|
|
160
|
+
export interface GridListLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection' | 'direction'>, StyleProps, DOMRenderProps<'div', undefined>, GlobalDOMAttributes<HTMLDivElement> {
|
|
150
161
|
/**
|
|
151
162
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
152
163
|
* element.
|
|
@@ -136,7 +136,7 @@ export interface ListBoxItemProps<T = object> extends Omit<RenderProps<ListBoxIt
|
|
|
136
136
|
* A ListBoxItem represents an individual option in a ListBox.
|
|
137
137
|
*/
|
|
138
138
|
export declare const ListBoxItem: <T>(props: ListBoxItemProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
139
|
-
export interface ListBoxLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection'>, StyleProps, DOMRenderProps<'div', undefined>, GlobalDOMAttributes<HTMLDivElement> {
|
|
139
|
+
export interface ListBoxLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection' | 'direction'>, StyleProps, DOMRenderProps<'div', undefined>, GlobalDOMAttributes<HTMLDivElement> {
|
|
140
140
|
/**
|
|
141
141
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
142
142
|
* element.
|
|
@@ -33,6 +33,12 @@ export interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPo
|
|
|
33
33
|
* Whether the popover is currently performing an exit animation.
|
|
34
34
|
*/
|
|
35
35
|
isExiting?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the popover should appear and disappear without an entry or exit animation. This is
|
|
38
|
+
* used by components such as PreviewTrigger to skip animations when quickly swapping between
|
|
39
|
+
* overlays.
|
|
40
|
+
*/
|
|
41
|
+
shouldSkipAnimation?: boolean;
|
|
36
42
|
/**
|
|
37
43
|
* The container element in which the overlay portal will be placed. This may have unknown
|
|
38
44
|
* behavior depending on where it is portalled to.
|
|
@@ -76,6 +82,7 @@ export interface PopoverRenderProps {
|
|
|
76
82
|
isExiting: boolean;
|
|
77
83
|
}
|
|
78
84
|
interface PopoverContextValue extends PopoverProps {
|
|
85
|
+
id?: string;
|
|
79
86
|
/** Contexts to clear. */
|
|
80
87
|
clearContexts?: Context<any>[];
|
|
81
88
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AriaPreviewTriggerProps } from 'react-aria/usePreviewTrigger';
|
|
2
|
+
import { JSX, ReactNode } from 'react';
|
|
3
|
+
export interface PreviewTriggerProps extends AriaPreviewTriggerProps {
|
|
4
|
+
/** The trigger and Popover that make up the preview trigger. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* The delay time in milliseconds before the preview opens.
|
|
8
|
+
*
|
|
9
|
+
* @default 600
|
|
10
|
+
*/
|
|
11
|
+
delay?: number;
|
|
12
|
+
/**
|
|
13
|
+
* The delay time in milliseconds before the preview closes.
|
|
14
|
+
*
|
|
15
|
+
* @default 200
|
|
16
|
+
*/
|
|
17
|
+
closeDelay?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A PreviewTrigger displays a non-modal popover on hover, focus, or long press. Unlike a tooltip,
|
|
21
|
+
* the popover may contain interactive content.
|
|
22
|
+
*/
|
|
23
|
+
export declare function PreviewTrigger(props: PreviewTriggerProps): JSX.Element;
|
|
@@ -42,7 +42,7 @@ export interface SelectRenderProps {
|
|
|
42
42
|
*/
|
|
43
43
|
isRequired: boolean;
|
|
44
44
|
}
|
|
45
|
-
export interface SelectProps<T, M extends SelectionMode = 'single'> extends Omit<AriaSelectProps<T, M>, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior' | 'items'>, RACValidation, RenderProps<SelectRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
45
|
+
export interface SelectProps<T = {}, M extends SelectionMode = 'single'> extends Omit<AriaSelectProps<T, M>, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior' | 'items'>, RACValidation, RenderProps<SelectRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
46
46
|
/**
|
|
47
47
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
48
48
|
* element. A function may be provided to compute the class based on component state.
|
|
@@ -230,6 +230,18 @@ export interface ColumnProps extends RenderProps<ColumnRenderProps, 'th' | 'div'
|
|
|
230
230
|
* `<ResizableTableContainer>`.
|
|
231
231
|
*/
|
|
232
232
|
maxWidth?: ColumnStaticSize | null;
|
|
233
|
+
/**
|
|
234
|
+
* Whether the column header or its first focusable child element should be focused when the
|
|
235
|
+
* column header is focused. Defaults to 'child' in arrow keyboard navigation mode and 'cell' in
|
|
236
|
+
* tab keyboard navigation mode.
|
|
237
|
+
*/
|
|
238
|
+
focusMode?: 'child' | 'cell';
|
|
239
|
+
/**
|
|
240
|
+
* Whether the column should support arrow key navigation even when the containing table uses tab
|
|
241
|
+
* keyboard navigation. Allows users to navigate between columns and rows with arrow keys while
|
|
242
|
+
* focus is on an interactive child element within the column header.
|
|
243
|
+
*/
|
|
244
|
+
allowsArrowNavigation?: boolean;
|
|
233
245
|
}
|
|
234
246
|
/**
|
|
235
247
|
* A column within a `<Table>`.
|
|
@@ -487,6 +499,18 @@ export interface CellProps extends RenderProps<CellRenderProps, 'td' | 'div'>, G
|
|
|
487
499
|
textValue?: string;
|
|
488
500
|
/** Indicates how many columns the data cell spans. */
|
|
489
501
|
colSpan?: number;
|
|
502
|
+
/**
|
|
503
|
+
* Whether the cell or its first focusable child element should be focused when the cell is
|
|
504
|
+
* focused. Defaults to 'child' in arrow keyboard navigation mode and 'cell' in tab keyboard
|
|
505
|
+
* navigation mode.
|
|
506
|
+
*/
|
|
507
|
+
focusMode?: 'child' | 'cell';
|
|
508
|
+
/**
|
|
509
|
+
* Whether the cell should support arrow key navigation even when the containing table uses
|
|
510
|
+
* tab keyboard navigation. Allows users to navigate between cells and rows with arrow keys while
|
|
511
|
+
* focus is on an interactive child element within the cell.
|
|
512
|
+
*/
|
|
513
|
+
allowsArrowNavigation?: boolean;
|
|
490
514
|
}
|
|
491
515
|
/**
|
|
492
516
|
* A cell within a table row.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { AriaTokenFieldProps } from 'react-aria/useTokenField';
|
|
2
|
+
import { ClassNameOrFunction, ContextValue, RenderProps, SlotProps, StyleRenderProps } from './utils';
|
|
3
|
+
import { GlobalDOMAttributes } from '@react-types/shared';
|
|
4
|
+
import { HoverProps } from 'react-aria/useHover';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { TokenFieldValue, TokenSegment } from 'react-stately/useTokenFieldState';
|
|
7
|
+
export interface TokenFieldRenderProps {
|
|
8
|
+
/**
|
|
9
|
+
* Whether the token field is disabled.
|
|
10
|
+
*
|
|
11
|
+
* @selector [data-disabled]
|
|
12
|
+
*/
|
|
13
|
+
isDisabled: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the token field is read only.
|
|
16
|
+
*
|
|
17
|
+
* @selector [data-readonly]
|
|
18
|
+
*/
|
|
19
|
+
isReadOnly: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface TokenFieldProps<T extends TokenFieldValue = TokenFieldValue> extends AriaTokenFieldProps<T>, RenderProps<TokenFieldRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
22
|
+
/**
|
|
23
|
+
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
24
|
+
* element. A function may be provided to compute the class based on component state.
|
|
25
|
+
*
|
|
26
|
+
* @default 'react-aria-TokenField'
|
|
27
|
+
*/
|
|
28
|
+
className?: ClassNameOrFunction<TokenFieldRenderProps>;
|
|
29
|
+
}
|
|
30
|
+
export interface TokenInputRenderProps {
|
|
31
|
+
/**
|
|
32
|
+
* Whether the token input is currently hovered with a mouse.
|
|
33
|
+
*
|
|
34
|
+
* @selector [data-hovered]
|
|
35
|
+
*/
|
|
36
|
+
isHovered: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the token input is focused, either via a mouse or keyboard.
|
|
39
|
+
*
|
|
40
|
+
* @selector [data-focused]
|
|
41
|
+
*/
|
|
42
|
+
isFocused: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the token input is keyboard focused.
|
|
45
|
+
*
|
|
46
|
+
* @selector [data-focus-visible]
|
|
47
|
+
*/
|
|
48
|
+
isFocusVisible: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the token input is disabled.
|
|
51
|
+
*
|
|
52
|
+
* @selector [data-disabled]
|
|
53
|
+
*/
|
|
54
|
+
isDisabled: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the token input is read only.
|
|
57
|
+
*
|
|
58
|
+
* @selector [data-readonly]
|
|
59
|
+
*/
|
|
60
|
+
isReadOnly: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface TokenInputProps<T extends TokenFieldValue = TokenFieldValue> extends HoverProps, StyleRenderProps<TokenInputRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
63
|
+
/**
|
|
64
|
+
* A function that renders a token for each segment in the token field.
|
|
65
|
+
*/
|
|
66
|
+
children: (segment: TokenSegment<T extends TokenFieldValue<infer V> ? V : never>) => React.ReactElement;
|
|
67
|
+
/**
|
|
68
|
+
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
69
|
+
* element. A function may be provided to compute the class based on component state.
|
|
70
|
+
*
|
|
71
|
+
* @default 'react-aria-TokenInput'
|
|
72
|
+
*/
|
|
73
|
+
className?: ClassNameOrFunction<TokenInputRenderProps>;
|
|
74
|
+
}
|
|
75
|
+
export declare const TokenFieldContext: React.Context<ContextValue<TokenFieldProps<TokenFieldValue<any>>, HTMLDivElement>>;
|
|
76
|
+
/**
|
|
77
|
+
* A token field allows users to enter text with inline tokens. Use it to build AI prompt fields,
|
|
78
|
+
* tag inputs, structured search fields, mention inputs, and multi-select comboboxes.
|
|
79
|
+
*/
|
|
80
|
+
export declare const TokenField: <T extends TokenFieldValue<any> = TokenFieldValue<any>>(props: TokenFieldProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
81
|
+
/**
|
|
82
|
+
* A token input represents the editable area within a token field.
|
|
83
|
+
*/
|
|
84
|
+
export declare const TokenInput: <T extends TokenFieldValue<any> = TokenFieldValue<any>>(props: TokenInputProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
85
|
+
export interface TokenRenderProps {
|
|
86
|
+
/**
|
|
87
|
+
* Whether the token is selected.
|
|
88
|
+
*
|
|
89
|
+
* @selector [data-selected]
|
|
90
|
+
*/
|
|
91
|
+
isSelected: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Whether the token is disabled.
|
|
94
|
+
*
|
|
95
|
+
* @selector [data-disabled]
|
|
96
|
+
*/
|
|
97
|
+
isDisabled: boolean;
|
|
98
|
+
}
|
|
99
|
+
export interface TokenProps extends RenderProps<TokenRenderProps, 'span'>, GlobalDOMAttributes<HTMLSpanElement> {
|
|
100
|
+
/**
|
|
101
|
+
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
102
|
+
* element. A function may be provided to compute the class based on component state.
|
|
103
|
+
*
|
|
104
|
+
* @default 'react-aria-Token'
|
|
105
|
+
*/
|
|
106
|
+
className?: ClassNameOrFunction<TokenRenderProps>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A token represents an inline segment within a token field.
|
|
110
|
+
*/
|
|
111
|
+
export declare const Token: React.ForwardRefExoticComponent<TokenProps & React.RefAttributes<HTMLSpanElement>>;
|
package/dist/types/src/Tree.d.ts
CHANGED
|
@@ -129,7 +129,7 @@ export interface TreeItemContentProps {
|
|
|
129
129
|
}
|
|
130
130
|
export declare const TreeItemContent: (props: TreeItemContentProps & React.RefAttributes<Element>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
131
131
|
export declare const TreeItemContentContext: React.Context<TreeItemContentRenderProps | null>;
|
|
132
|
-
export interface TreeItemProps<T = object> extends StyleRenderProps<TreeItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, Pick<AriaTreeItemOptions, 'hasChildItems'>, Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {
|
|
132
|
+
export interface TreeItemProps<T = object> extends StyleRenderProps<TreeItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, Pick<AriaTreeItemOptions, 'hasChildItems' | 'focusMode' | 'allowsArrowNavigation'>, Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {
|
|
133
133
|
/**
|
|
134
134
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
135
135
|
* element. A function may be provided to compute the class based on component state.
|
|
@@ -173,7 +173,7 @@ export interface TreeLoadMoreItemRenderProps {
|
|
|
173
173
|
*/
|
|
174
174
|
level: number;
|
|
175
175
|
}
|
|
176
|
-
export interface TreeLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection'>, RenderProps<TreeLoadMoreItemRenderProps> {
|
|
176
|
+
export interface TreeLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection' | 'direction'>, RenderProps<TreeLoadMoreItemRenderProps> {
|
|
177
177
|
/**
|
|
178
178
|
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the
|
|
179
179
|
* element. A function may be provided to compute the class based on component state.
|
|
@@ -191,10 +191,12 @@ export interface TreeLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'coll
|
|
|
191
191
|
isLoading?: boolean;
|
|
192
192
|
}
|
|
193
193
|
export declare const TreeLoadMoreItem: <T>(props: TreeLoadMoreItemProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
194
|
-
export interface
|
|
194
|
+
export interface TreeSectionProps<T> extends SectionProps<T>, DOMRenderProps<'div', undefined> {
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
197
197
|
* A TreeSection represents a section within a Tree.
|
|
198
198
|
*/
|
|
199
|
-
export declare const TreeSection: <T extends unknown>(props:
|
|
200
|
-
export
|
|
199
|
+
export declare const TreeSection: <T extends unknown>(props: TreeSectionProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
200
|
+
export interface TreeHeaderProps extends GridListHeaderProps {
|
|
201
|
+
}
|
|
202
|
+
export declare const TreeHeader: (props: TreeHeaderProps) => ReactNode;
|
|
@@ -16,6 +16,10 @@ export interface VirtualizerProps<O> {
|
|
|
16
16
|
layout: LayoutClass<O> | ILayout<O>;
|
|
17
17
|
/** Options for the layout. */
|
|
18
18
|
layoutOptions?: O;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to observe each item's size with a ResizeObserver and re-measure when it changes.
|
|
21
|
+
*/
|
|
22
|
+
shouldObserveItemSize?: boolean;
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* A Virtualizer renders a scrollable collection of data using customizable layouts.
|