react-aria-components 3.0.0-nightly-412a51816-250219 → 3.0.0-nightly-a792c1ad5-250222
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Autocomplete.main.js +20 -10
- package/dist/Autocomplete.main.js.map +1 -1
- package/dist/Autocomplete.mjs +20 -10
- package/dist/Autocomplete.module.js +20 -10
- package/dist/Autocomplete.module.js.map +1 -1
- package/dist/GridList.main.js.map +1 -1
- package/dist/GridList.module.js.map +1 -1
- package/dist/Group.main.js.map +1 -1
- package/dist/Group.module.js.map +1 -1
- package/dist/ListBox.main.js +16 -16
- package/dist/ListBox.main.js.map +1 -1
- package/dist/ListBox.mjs +17 -17
- package/dist/ListBox.module.js +17 -17
- package/dist/ListBox.module.js.map +1 -1
- package/dist/Menu.main.js +72 -7
- package/dist/Menu.main.js.map +1 -1
- package/dist/Menu.mjs +72 -8
- package/dist/Menu.module.js +72 -8
- package/dist/Menu.module.js.map +1 -1
- package/dist/Popover.main.js +38 -14
- package/dist/Popover.main.js.map +1 -1
- package/dist/Popover.mjs +39 -15
- package/dist/Popover.module.js +39 -15
- package/dist/Popover.module.js.map +1 -1
- package/dist/SearchField.main.js +3 -1
- package/dist/SearchField.main.js.map +1 -1
- package/dist/SearchField.mjs +4 -2
- package/dist/SearchField.module.js +4 -2
- package/dist/SearchField.module.js.map +1 -1
- package/dist/Table.main.js +10 -38
- package/dist/Table.main.js.map +1 -1
- package/dist/Table.mjs +10 -38
- package/dist/Table.module.js +10 -38
- package/dist/Table.module.js.map +1 -1
- package/dist/TableLayout.main.js.map +1 -1
- package/dist/TableLayout.module.js.map +1 -1
- package/dist/TextField.main.js +3 -1
- package/dist/TextField.main.js.map +1 -1
- package/dist/TextField.mjs +4 -2
- package/dist/TextField.module.js +4 -2
- package/dist/TextField.module.js.map +1 -1
- package/dist/Toast.main.js +150 -0
- package/dist/Toast.main.js.map +1 -0
- package/dist/Toast.mjs +139 -0
- package/dist/Toast.module.js +139 -0
- package/dist/Toast.module.js.map +1 -0
- package/dist/Tree.main.js +26 -25
- package/dist/Tree.main.js.map +1 -1
- package/dist/Tree.mjs +21 -20
- package/dist/Tree.module.js +21 -20
- package/dist/Tree.module.js.map +1 -1
- package/dist/Virtualizer.main.js +4 -1
- package/dist/Virtualizer.main.js.map +1 -1
- package/dist/Virtualizer.mjs +4 -1
- package/dist/Virtualizer.module.js +4 -1
- package/dist/Virtualizer.module.js.map +1 -1
- package/dist/import.mjs +11 -5
- package/dist/main.js +32 -13
- package/dist/main.js.map +1 -1
- package/dist/module.js +11 -5
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +136 -28
- package/dist/types.d.ts.map +1 -1
- package/i18n/index.js +1 -1
- package/i18n/index.mjs +1 -1
- package/package.json +34 -32
- package/src/Autocomplete.tsx +14 -11
- package/src/GridList.tsx +5 -0
- package/src/Group.tsx +1 -0
- package/src/ListBox.tsx +9 -8
- package/src/Menu.tsx +68 -10
- package/src/Popover.tsx +47 -21
- package/src/SearchField.tsx +3 -3
- package/src/Table.tsx +10 -40
- package/src/TableLayout.ts +1 -1
- package/src/TextField.tsx +3 -3
- package/src/Toast.tsx +185 -0
- package/src/Tree.tsx +50 -37
- package/src/Virtualizer.tsx +18 -3
- package/src/index.ts +13 -7
package/dist/Popover.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAsEM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA2C;AAK9E,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,QAAQ,KAAmB,EAAE,GAA8B;IACtI,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAe,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,oDAAyB;IACvD,IAAI,aAAa,CAAA,GAAA,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BAAA,gBAAgB;QACxB,WAAW;IACb,GAAG;IAEH,IAAI,MAAM,MAAM,UAAU;IAC1B,IAAI,aAAa,CAAA,GAAA,uCAAgB,EAAE,KAAK,CAAC,CAAC,cAAc,MAAM,UAAU,IAAI;IAC5E,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;YACN,SAAS,MAAM,OAAO,IAAI;uBAC1B;wBACA;uBACA;QACF;IACF;IAEA,IAAI,QAAQ;QAAC,GAAG,aAAa,KAAK;QAAE,GAAG,YAAY,KAAK;IAAA;IAExD,qBACE,0DAAC,CAAA,GAAA,wBAAM;QAAG,GAAG,KAAK;QAAE,WAAW;QAAW,iBAAiB;OACxD,CAAC,MAAM,UAAU,IAAI,MAAM,MAAM,kBAAI,0DAAC;QAAI,eAAY;QAAY,GAAG,aAAa;QAAE,OAAO;YAAC,UAAU;YAAS,OAAO;QAAC;sBACxH,0DAAC;QACE,GAAG,CAAA,GAAA,gCAAS,EAAE,CAAA,GAAA,oCAAa,EAAE,QAAe,aAAa;QACzD,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,OAAO;QACP,KAAK,MAAM,GAAG;QACd,gBAAc,MAAM,OAAO;QAC3B,kBAAgB;QAChB,iBAAe,cAAc;QAC7B,gBAAc,aAAa;OAC1B,CAAC,MAAM,UAAU,kBAAI,0DAAC,CAAA,GAAA,8BAAY;QAAE,WAAW,MAAM,KAAK;sBAC3D,0DAAC,CAAA,GAAA,6CAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ,iBAEvB,0DAAC,CAAA,GAAA,8BAAY;QAAE,WAAW,MAAM,KAAK;;AAI7C","sources":["packages/react-aria-components/src/Popover.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 {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, useLocale, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction} />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string,\n dir?: 'ltr' | 'rtl'\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n let style = {...popoverProps.style, ...renderProps.style};\n\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAsEM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA2C;AAErF,iFAAiF;AACjF,MAAM,0DAAsB,C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MAAM,KAAK;sBAC3D,0DAAC,CAAA,GAAA,6CAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ,iBAEvB,0DAAC,CAAA,GAAA,8BAAY;QAAE,WAAW,MAAM,KAAK;;IAIzC,yGAAyG;IACzG,IAAI,CAAC,cACH,qBACE,0DAAC,CAAA,GAAA,wBAAM;QAAG,GAAG,KAAK;QAAE,WAAW;QAAW,iBAAiB;OACxD,CAAC,MAAM,UAAU,IAAI,MAAM,MAAM,kBAAI,0DAAC;QAAI,eAAY;QAAY,GAAG,aAAa;QAAE,OAAO;YAAC,UAAU;YAAS,OAAO;QAAC;sBACxH,0DAAC;QAAI,KAAK;QAAc,OAAO;YAAC,SAAS;QAAU;qBACjD,0DAAC,0CAAoB,QAAQ;QAAC,OAAO;OAClC;QASkD;IAF7D,qEAAqE;IACrE,qBACE,0DAAC,CAAA,GAAA,wBAAM;QAAG,GAAG,KAAK;QAAE,WAAW;QAAW,iBAAiB,CAAA,OAAA,qCAAA,sCAAA,2BAA4B,qBAAA,+BAAA,SAAU,OAAO,cAA7C,kBAAA,OAAiD;OACzG;AAGP","sources":["packages/react-aria-components/src/Popover.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 {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, useLocale, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'groupRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\n// Stores a ref for the portal container for a group of popovers (e.g. submenus).\nconst PopoverGroupContext = createContext<RefObject<Element | null> | null>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction} />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string,\n dir?: 'ltr' | 'rtl'\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n let containerRef = useRef<HTMLDivElement | null>(null);\n let groupCtx = useContext(PopoverGroupContext);\n let isSubPopover = groupCtx && (props.trigger === 'SubmenuTrigger' || props.trigger === 'SubDialogTrigger');\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth,\n // If this is a submenu/subdialog, use the root popover's container \n // to detect outside interaction and add aria-hidden.\n groupRef: isSubPopover ? groupCtx! : containerRef\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n let style = {...popoverProps.style, ...renderProps.style};\n let overlay = (\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n );\n\n // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.\n if (!isSubPopover) {\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div ref={containerRef} style={{display: 'contents'}}>\n <PopoverGroupContext.Provider value={containerRef}>\n {overlay}\n </PopoverGroupContext.Provider>\n </div>\n </Overlay>\n );\n }\n\n // Submenus/subdialogs are mounted into the root popover's container.\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer ?? groupCtx?.current ?? undefined}>\n {overlay}\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.main.js.map"}
|
package/dist/Popover.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.mjs";
|
|
2
2
|
import {OverlayArrowContext as $44f671af83e7d9e0$export$2de4954e8ae13b9f} from "./OverlayArrow.mjs";
|
|
3
3
|
import {OverlayTriggerStateContext as $de32f1b87079253c$export$d2f961adcb0afbe} from "./Dialog.mjs";
|
|
4
|
-
import {useLocale as $ehFet$useLocale, usePopover as $ehFet$usePopover,
|
|
4
|
+
import {useLocale as $ehFet$useLocale, usePopover as $ehFet$usePopover, DismissButton as $ehFet$DismissButton, Overlay as $ehFet$Overlay} from "react-aria";
|
|
5
5
|
import {useExitAnimation as $ehFet$useExitAnimation, useLayoutEffect as $ehFet$useLayoutEffect, useEnterAnimation as $ehFet$useEnterAnimation, mergeProps as $ehFet$mergeProps, filterDOMProps as $ehFet$filterDOMProps} from "@react-aria/utils";
|
|
6
6
|
import {useOverlayTriggerState as $ehFet$useOverlayTriggerState} from "react-stately";
|
|
7
7
|
import $ehFet$react, {createContext as $ehFet$createContext, forwardRef as $ehFet$forwardRef, useContext as $ehFet$useContext, useRef as $ehFet$useRef, useState as $ehFet$useState} from "react";
|
|
@@ -26,6 +26,8 @@ import {useIsHidden as $ehFet$useIsHidden} from "@react-aria/collections";
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
const $07b14b47974efb58$export$9b9a0cd73afb7ca4 = /*#__PURE__*/ (0, $ehFet$createContext)(null);
|
|
29
|
+
// Stores a ref for the portal container for a group of popovers (e.g. submenus).
|
|
30
|
+
const $07b14b47974efb58$var$PopoverGroupContext = /*#__PURE__*/ (0, $ehFet$createContext)(null);
|
|
29
31
|
const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwardRef)(function Popover(props, ref) {
|
|
30
32
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $07b14b47974efb58$export$9b9a0cd73afb7ca4);
|
|
31
33
|
let contextState = (0, $ehFet$useContext)((0, $de32f1b87079253c$export$d2f961adcb0afbe));
|
|
@@ -61,6 +63,9 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
61
63
|
// Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx
|
|
62
64
|
let arrowRef = (0, $ehFet$useRef)(null);
|
|
63
65
|
let [arrowWidth, setArrowWidth] = (0, $ehFet$useState)(0);
|
|
66
|
+
let containerRef = (0, $ehFet$useRef)(null);
|
|
67
|
+
let groupCtx = (0, $ehFet$useContext)($07b14b47974efb58$var$PopoverGroupContext);
|
|
68
|
+
let isSubPopover = groupCtx && (props.trigger === 'SubmenuTrigger' || props.trigger === 'SubDialogTrigger');
|
|
64
69
|
(0, $ehFet$useLayoutEffect)(()=>{
|
|
65
70
|
if (arrowRef.current && state.isOpen) setArrowWidth(arrowRef.current.getBoundingClientRect().width);
|
|
66
71
|
}, [
|
|
@@ -71,7 +76,10 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
71
76
|
let { popoverProps: popoverProps, underlayProps: underlayProps, arrowProps: arrowProps, placement: placement } = (0, $ehFet$usePopover)({
|
|
72
77
|
...props,
|
|
73
78
|
offset: (_props_offset = props.offset) !== null && _props_offset !== void 0 ? _props_offset : 8,
|
|
74
|
-
arrowSize: arrowWidth
|
|
79
|
+
arrowSize: arrowWidth,
|
|
80
|
+
// If this is a submenu/subdialog, use the root popover's container
|
|
81
|
+
// to detect outside interaction and add aria-hidden.
|
|
82
|
+
groupRef: isSubPopover ? groupCtx : containerRef
|
|
75
83
|
}, state);
|
|
76
84
|
let ref = props.popoverRef;
|
|
77
85
|
let isEntering = (0, $ehFet$useEnterAnimation)(ref, !!placement) || props.isEntering || false;
|
|
@@ -89,18 +97,7 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
89
97
|
...popoverProps.style,
|
|
90
98
|
...renderProps.style
|
|
91
99
|
};
|
|
92
|
-
|
|
93
|
-
...props,
|
|
94
|
-
isExiting: isExiting,
|
|
95
|
-
portalContainer: UNSTABLE_portalContainer
|
|
96
|
-
}, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
|
97
|
-
"data-testid": "underlay",
|
|
98
|
-
...underlayProps,
|
|
99
|
-
style: {
|
|
100
|
-
position: 'fixed',
|
|
101
|
-
inset: 0
|
|
102
|
-
}
|
|
103
|
-
}), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
|
100
|
+
let overlay = /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
|
104
101
|
...(0, $ehFet$mergeProps)((0, $ehFet$filterDOMProps)(props), popoverProps),
|
|
105
102
|
...renderProps,
|
|
106
103
|
ref: ref,
|
|
@@ -121,7 +118,34 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
121
118
|
}
|
|
122
119
|
}, renderProps.children), /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$DismissButton), {
|
|
123
120
|
onDismiss: state.close
|
|
124
|
-
}))
|
|
121
|
+
}));
|
|
122
|
+
// If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.
|
|
123
|
+
if (!isSubPopover) return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
|
|
124
|
+
...props,
|
|
125
|
+
isExiting: isExiting,
|
|
126
|
+
portalContainer: UNSTABLE_portalContainer
|
|
127
|
+
}, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
|
128
|
+
"data-testid": "underlay",
|
|
129
|
+
...underlayProps,
|
|
130
|
+
style: {
|
|
131
|
+
position: 'fixed',
|
|
132
|
+
inset: 0
|
|
133
|
+
}
|
|
134
|
+
}), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
|
135
|
+
ref: containerRef,
|
|
136
|
+
style: {
|
|
137
|
+
display: 'contents'
|
|
138
|
+
}
|
|
139
|
+
}, /*#__PURE__*/ (0, $ehFet$react).createElement($07b14b47974efb58$var$PopoverGroupContext.Provider, {
|
|
140
|
+
value: containerRef
|
|
141
|
+
}, overlay)));
|
|
142
|
+
var _ref;
|
|
143
|
+
// Submenus/subdialogs are mounted into the root popover's container.
|
|
144
|
+
return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
|
|
145
|
+
...props,
|
|
146
|
+
isExiting: isExiting,
|
|
147
|
+
portalContainer: (_ref = UNSTABLE_portalContainer !== null && UNSTABLE_portalContainer !== void 0 ? UNSTABLE_portalContainer : groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.current) !== null && _ref !== void 0 ? _ref : undefined
|
|
148
|
+
}, overlay);
|
|
125
149
|
}
|
|
126
150
|
|
|
127
151
|
|
package/dist/Popover.module.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.module.js";
|
|
2
2
|
import {OverlayArrowContext as $44f671af83e7d9e0$export$2de4954e8ae13b9f} from "./OverlayArrow.module.js";
|
|
3
3
|
import {OverlayTriggerStateContext as $de32f1b87079253c$export$d2f961adcb0afbe} from "./Dialog.module.js";
|
|
4
|
-
import {useLocale as $ehFet$useLocale, usePopover as $ehFet$usePopover,
|
|
4
|
+
import {useLocale as $ehFet$useLocale, usePopover as $ehFet$usePopover, DismissButton as $ehFet$DismissButton, Overlay as $ehFet$Overlay} from "react-aria";
|
|
5
5
|
import {useExitAnimation as $ehFet$useExitAnimation, useLayoutEffect as $ehFet$useLayoutEffect, useEnterAnimation as $ehFet$useEnterAnimation, mergeProps as $ehFet$mergeProps, filterDOMProps as $ehFet$filterDOMProps} from "@react-aria/utils";
|
|
6
6
|
import {useOverlayTriggerState as $ehFet$useOverlayTriggerState} from "react-stately";
|
|
7
7
|
import $ehFet$react, {createContext as $ehFet$createContext, forwardRef as $ehFet$forwardRef, useContext as $ehFet$useContext, useRef as $ehFet$useRef, useState as $ehFet$useState} from "react";
|
|
@@ -26,6 +26,8 @@ import {useIsHidden as $ehFet$useIsHidden} from "@react-aria/collections";
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
const $07b14b47974efb58$export$9b9a0cd73afb7ca4 = /*#__PURE__*/ (0, $ehFet$createContext)(null);
|
|
29
|
+
// Stores a ref for the portal container for a group of popovers (e.g. submenus).
|
|
30
|
+
const $07b14b47974efb58$var$PopoverGroupContext = /*#__PURE__*/ (0, $ehFet$createContext)(null);
|
|
29
31
|
const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwardRef)(function Popover(props, ref) {
|
|
30
32
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $07b14b47974efb58$export$9b9a0cd73afb7ca4);
|
|
31
33
|
let contextState = (0, $ehFet$useContext)((0, $de32f1b87079253c$export$d2f961adcb0afbe));
|
|
@@ -61,6 +63,9 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
61
63
|
// Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx
|
|
62
64
|
let arrowRef = (0, $ehFet$useRef)(null);
|
|
63
65
|
let [arrowWidth, setArrowWidth] = (0, $ehFet$useState)(0);
|
|
66
|
+
let containerRef = (0, $ehFet$useRef)(null);
|
|
67
|
+
let groupCtx = (0, $ehFet$useContext)($07b14b47974efb58$var$PopoverGroupContext);
|
|
68
|
+
let isSubPopover = groupCtx && (props.trigger === 'SubmenuTrigger' || props.trigger === 'SubDialogTrigger');
|
|
64
69
|
(0, $ehFet$useLayoutEffect)(()=>{
|
|
65
70
|
if (arrowRef.current && state.isOpen) setArrowWidth(arrowRef.current.getBoundingClientRect().width);
|
|
66
71
|
}, [
|
|
@@ -71,7 +76,10 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
71
76
|
let { popoverProps: popoverProps, underlayProps: underlayProps, arrowProps: arrowProps, placement: placement } = (0, $ehFet$usePopover)({
|
|
72
77
|
...props,
|
|
73
78
|
offset: (_props_offset = props.offset) !== null && _props_offset !== void 0 ? _props_offset : 8,
|
|
74
|
-
arrowSize: arrowWidth
|
|
79
|
+
arrowSize: arrowWidth,
|
|
80
|
+
// If this is a submenu/subdialog, use the root popover's container
|
|
81
|
+
// to detect outside interaction and add aria-hidden.
|
|
82
|
+
groupRef: isSubPopover ? groupCtx : containerRef
|
|
75
83
|
}, state);
|
|
76
84
|
let ref = props.popoverRef;
|
|
77
85
|
let isEntering = (0, $ehFet$useEnterAnimation)(ref, !!placement) || props.isEntering || false;
|
|
@@ -89,18 +97,7 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
89
97
|
...popoverProps.style,
|
|
90
98
|
...renderProps.style
|
|
91
99
|
};
|
|
92
|
-
|
|
93
|
-
...props,
|
|
94
|
-
isExiting: isExiting,
|
|
95
|
-
portalContainer: UNSTABLE_portalContainer
|
|
96
|
-
}, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
|
97
|
-
"data-testid": "underlay",
|
|
98
|
-
...underlayProps,
|
|
99
|
-
style: {
|
|
100
|
-
position: 'fixed',
|
|
101
|
-
inset: 0
|
|
102
|
-
}
|
|
103
|
-
}), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
|
100
|
+
let overlay = /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
|
104
101
|
...(0, $ehFet$mergeProps)((0, $ehFet$filterDOMProps)(props), popoverProps),
|
|
105
102
|
...renderProps,
|
|
106
103
|
ref: ref,
|
|
@@ -121,7 +118,34 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
121
118
|
}
|
|
122
119
|
}, renderProps.children), /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$DismissButton), {
|
|
123
120
|
onDismiss: state.close
|
|
124
|
-
}))
|
|
121
|
+
}));
|
|
122
|
+
// If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.
|
|
123
|
+
if (!isSubPopover) return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
|
|
124
|
+
...props,
|
|
125
|
+
isExiting: isExiting,
|
|
126
|
+
portalContainer: UNSTABLE_portalContainer
|
|
127
|
+
}, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
|
128
|
+
"data-testid": "underlay",
|
|
129
|
+
...underlayProps,
|
|
130
|
+
style: {
|
|
131
|
+
position: 'fixed',
|
|
132
|
+
inset: 0
|
|
133
|
+
}
|
|
134
|
+
}), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
|
135
|
+
ref: containerRef,
|
|
136
|
+
style: {
|
|
137
|
+
display: 'contents'
|
|
138
|
+
}
|
|
139
|
+
}, /*#__PURE__*/ (0, $ehFet$react).createElement($07b14b47974efb58$var$PopoverGroupContext.Provider, {
|
|
140
|
+
value: containerRef
|
|
141
|
+
}, overlay)));
|
|
142
|
+
var _ref;
|
|
143
|
+
// Submenus/subdialogs are mounted into the root popover's container.
|
|
144
|
+
return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
|
|
145
|
+
...props,
|
|
146
|
+
isExiting: isExiting,
|
|
147
|
+
portalContainer: (_ref = UNSTABLE_portalContainer !== null && UNSTABLE_portalContainer !== void 0 ? UNSTABLE_portalContainer : groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.current) !== null && _ref !== void 0 ? _ref : undefined
|
|
148
|
+
}, overlay);
|
|
125
149
|
}
|
|
126
150
|
|
|
127
151
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA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A,oBAAY;QAAE,WAAW,MAAM,KAAK;sBAC3D,gCAAC,CAAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ,iBAEvB,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;;AAI7C","sources":["packages/react-aria-components/src/Popover.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 {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, useLocale, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction} />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string,\n dir?: 'ltr' | 'rtl'\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n let style = {...popoverProps.style, ...renderProps.style};\n\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAsEM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA2C;AAErF,iFAAiF;AACjF,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAoC;AAKrE,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,QAAQ,KAAmB,EAAE,GAA8B;IACtI,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAe,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wCAAyB;IACvD,IAAI,aAAa,CAAA,GAAA,6BAAqB,EAAE;IACxC,IAAI,QAAQ,MAAM,MAAM,IAAI,QAAQ,MAAM,WAAW,IAAI,QAAQ,CAAC,eAAe,aAAa;IAC9F,IAAI,YAAY,CAAA,GAAA,uBAAe,EAAE,KAAK,MAAM,MAAM,KAAK,MAAM,SAAS,IAAI;IAC1E,IAAI,WAAW,CAAA,GAAA,kBAAU;IACzB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAE1B,sEAAsE;IACtE,IAAI,UAAU;QACZ,IAAI,WAAW,MAAM,QAAQ;QAC7B,IAAI,OAAO,aAAa,YACtB,WAAW,SAAS;YAClB,SAAS,MAAM,OAAO,IAAI;YAC1B,WAAW;YACX,YAAY;YACZ,WAAW;YACX,iBAAiB;QACnB;QAGF,qBAAO,kEAAG;IACZ;IAEA,IAAI,SAAS,CAAC,MAAM,MAAM,IAAI,CAAC,WAC7B,OAAO;IAGT,qBACE,gCAAC;QACE,GAAG,KAAK;QACT,YAAY,MAAM,UAAU;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QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,qBAAa,EAAE,QAAe,aAAa;QACzD,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,OAAO;QACP,KAAK,MAAM,GAAG;QACd,gBAAc,MAAM,OAAO;QAC3B,kBAAgB;QAChB,iBAAe,cAAc;QAC7B,gBAAc,aAAa;OAC1B,CAAC,MAAM,UAAU,kBAAI,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;sBAC3D,gCAAC,CAAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ,iBAEvB,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;;IAIzC,yGAAyG;IACzG,IAAI,CAAC,cACH,qBACE,gCAAC,CAAA,GAAA,cAAM;QAAG,GAAG,KAAK;QAAE,WAAW;QAAW,iBAAiB;OACxD,CAAC,MAAM,UAAU,IAAI,MAAM,MAAM,kBAAI,gCAAC;QAAI,eAAY;QAAY,GAAG,aAAa;QAAE,OAAO;YAAC,UAAU;YAAS,OAAO;QAAC;sBACxH,gCAAC;QAAI,KAAK;QAAc,OAAO;YAAC,SAAS;QAAU;qBACjD,gCAAC,0CAAoB,QAAQ;QAAC,OAAO;OAClC;QASkD;IAF7D,qEAAqE;IACrE,qBACE,gCAAC,CAAA,GAAA,cAAM;QAAG,GAAG,KAAK;QAAE,WAAW;QAAW,iBAAiB,CAAA,OAAA,qCAAA,sCAAA,2BAA4B,qBAAA,+BAAA,SAAU,OAAO,cAA7C,kBAAA,OAAiD;OACzG;AAGP","sources":["packages/react-aria-components/src/Popover.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 {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, useLocale, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'groupRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\n// Stores a ref for the portal container for a group of popovers (e.g. submenus).\nconst PopoverGroupContext = createContext<RefObject<Element | null> | null>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction} />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string,\n dir?: 'ltr' | 'rtl'\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n let containerRef = useRef<HTMLDivElement | null>(null);\n let groupCtx = useContext(PopoverGroupContext);\n let isSubPopover = groupCtx && (props.trigger === 'SubmenuTrigger' || props.trigger === 'SubDialogTrigger');\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth,\n // If this is a submenu/subdialog, use the root popover's container \n // to detect outside interaction and add aria-hidden.\n groupRef: isSubPopover ? groupCtx! : containerRef\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n let style = {...popoverProps.style, ...renderProps.style};\n let overlay = (\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n );\n\n // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.\n if (!isSubPopover) {\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div ref={containerRef} style={{display: 'contents'}}>\n <PopoverGroupContext.Provider value={containerRef}>\n {overlay}\n </PopoverGroupContext.Provider>\n </div>\n </Overlay>\n );\n }\n\n // Submenus/subdialogs are mounted into the root popover's container.\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer ?? groupCtx?.current ?? undefined}>\n {overlay}\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.module.js.map"}
|
package/dist/SearchField.main.js
CHANGED
|
@@ -7,6 +7,7 @@ var $1bcfcef5af644e13$exports = require("./Input.main.js");
|
|
|
7
7
|
var $84ae0bf5bd8e2a5f$exports = require("./Label.main.js");
|
|
8
8
|
var $a8a589c28affdc40$exports = require("./Text.main.js");
|
|
9
9
|
var $9H0iv$reactaria = require("react-aria");
|
|
10
|
+
var $9H0iv$reactariacollections = require("@react-aria/collections");
|
|
10
11
|
var $9H0iv$reactariautils = require("@react-aria/utils");
|
|
11
12
|
var $9H0iv$react = require("react");
|
|
12
13
|
var $9H0iv$reactstately = require("react-stately");
|
|
@@ -44,8 +45,9 @@ $parcel$export(module.exports, "SearchField", () => $a83c69b310385d53$export$b94
|
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
|
|
48
|
+
|
|
47
49
|
const $a83c69b310385d53$export$d1c4e4c63cb03a11 = /*#__PURE__*/ (0, $9H0iv$react.createContext)(null);
|
|
48
|
-
const $a83c69b310385d53$export$b94867ecbd698f21 = /*#__PURE__*/ (0, $9H0iv$
|
|
50
|
+
const $a83c69b310385d53$export$b94867ecbd698f21 = /*#__PURE__*/ (0, $9H0iv$reactariacollections.createHideableComponent)(function SearchField(props, ref) {
|
|
49
51
|
[props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $a83c69b310385d53$export$d1c4e4c63cb03a11);
|
|
50
52
|
let { validationBehavior: formValidationBehavior } = (0, $c5ccf687772c0422$exports.useSlottedContext)((0, $35157657e549736b$exports.FormContext)) || {};
|
|
51
53
|
var _props_validationBehavior, _ref;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAwCM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAkD;AAKzF,MAAM,4CAAc,WAAW,GAAG,CAAA,GAAA,mDAAsB,EAAE,SAAS,YAAY,KAAuB,EAAE,GAAiC;IAC9I,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE,CAAA,GAAA,qCAAU,MAAM,CAAC;QAC7D,2BAAA;IAAzB,IAAI,qBAAqB,CAAA,OAAA,CAAA,4BAAA,MAAM,kBAAkB,cAAxB,uCAAA,4BAA4B,oCAA5B,kBAAA,OAAsD;IAC/E,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAoB;IACxC,IAAI,CAAC,mBAAmB,eAAe,GAAG,CAAA,GAAA,yCAAc,EAAE,CAAC,GAAG,UAAU,CAAA,GAAA,sCAAW;IACnF,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,iCAAM,EAC5B,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB;IAEnD,IAAI,QAAQ,CAAA,GAAA,uCAAkB,EAAE;QAC9B,GAAG,KAAK;4BACR;IACF;IAEA,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,+BAAa,EAAE;QAClH,GAAG,CAAA,GAAA,8CAAmB,EAAE,MAAM;eAC9B;4BACA;IACF,GAAG,OAAO;IAEV,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,QAAQ;YACN,SAAS,MAAM,KAAK,KAAK;YACzB,YAAY,MAAM,UAAU,IAAI;YAChC,WAAW,WAAW,SAAS,IAAI;mBACnC;QACF;QACA,kBAAkB;IACpB;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE;IAC9B,OAAO,SAAS,EAAE;IAElB,qBACE,0DAAC;QACE,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,cAAY,MAAM,KAAK,KAAK,MAAM;QAClC,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,WAAW,SAAS,IAAI;qBACtC,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,GAAG,UAAU;oBAAE,KAAK;gBAAQ;aAAE;YAC9C;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,GAAG,CAAA,GAAA,gCAAS,EAAE,YAAY,kBAAkB;oBAAE,KAAK;gBAAc;aAAE;YACnF;gBAAC,CAAA,GAAA,uCAAY;gBAAG;aAAiB;YACjC;gBAAC,CAAA,GAAA,qCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,WAAW,WAAW,SAAS;oBAAE,YAAY,MAAM,UAAU,IAAI;gBAAK;aAAE;YACxF;gBAAC,CAAA,GAAA,2CAAgB;gBAAG;aAAW;SAChC;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/SearchField.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 {AriaSearchFieldProps, useSearchField} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {createHideableComponent} from '@react-aria/collections';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, useRef} from 'react';\nimport {SearchFieldState, useSearchFieldState} from 'react-stately';\nimport {TextContext} from './Text';\n\nexport interface SearchFieldRenderProps {\n /**\n * Whether the search field is empty.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the search field is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the search field is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the search field.\n */\n state: SearchFieldState\n}\n\nexport interface SearchFieldProps extends Omit<AriaSearchFieldProps, 'label' | 'placeholder' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<SearchFieldRenderProps>, SlotProps {}\n\nexport const SearchFieldContext = createContext<ContextValue<SearchFieldProps, HTMLDivElement>>(null);\n\n/**\n * A search field allows a user to enter and clear a search query.\n */\nexport const SearchField = /*#__PURE__*/ createHideableComponent(function SearchField(props: SearchFieldProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, SearchFieldContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let inputRef = useRef<HTMLInputElement>(null);\n let [inputContextProps, mergedInputRef] = useContextProps({}, inputRef, InputContext);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let state = useSearchFieldState({\n ...props,\n validationBehavior\n });\n\n let {labelProps, inputProps, clearButtonProps, descriptionProps, errorMessageProps, ...validation} = useSearchField({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, mergedInputRef);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n isEmpty: state.value === '',\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n state\n },\n defaultClassName: 'react-aria-SearchField'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-empty={state.value === '' || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}>\n <Provider\n values={[\n [LabelContext, {...labelProps, ref: labelRef}],\n [InputContext, {...mergeProps(inputProps, inputContextProps), ref: mergedInputRef}],\n [ButtonContext, clearButtonProps],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [GroupContext, {isInvalid: validation.isInvalid, isDisabled: props.isDisabled || false}],\n [FieldErrorContext, validation]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"SearchField.main.js.map"}
|
package/dist/SearchField.mjs
CHANGED
|
@@ -7,8 +7,9 @@ import {InputContext as $3985021b0ad6602f$export$37fb8590cf2c088c} from "./Input
|
|
|
7
7
|
import {LabelContext as $01b77f81d0f07f68$export$75b6ee27786ba447} from "./Label.mjs";
|
|
8
8
|
import {TextContext as $514c0188e459b4c0$export$9afb8bc826b033ea} from "./Text.mjs";
|
|
9
9
|
import {useSearchField as $8iEQ9$useSearchField} from "react-aria";
|
|
10
|
+
import {createHideableComponent as $8iEQ9$createHideableComponent} from "@react-aria/collections";
|
|
10
11
|
import {filterDOMProps as $8iEQ9$filterDOMProps, mergeProps as $8iEQ9$mergeProps} from "@react-aria/utils";
|
|
11
|
-
import $8iEQ9$react, {createContext as $8iEQ9$createContext,
|
|
12
|
+
import $8iEQ9$react, {createContext as $8iEQ9$createContext, useRef as $8iEQ9$useRef} from "react";
|
|
12
13
|
import {useSearchFieldState as $8iEQ9$useSearchFieldState} from "react-stately";
|
|
13
14
|
|
|
14
15
|
/*
|
|
@@ -33,8 +34,9 @@ import {useSearchFieldState as $8iEQ9$useSearchFieldState} from "react-stately";
|
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
|
|
37
|
+
|
|
36
38
|
const $440f4836bcb56932$export$d1c4e4c63cb03a11 = /*#__PURE__*/ (0, $8iEQ9$createContext)(null);
|
|
37
|
-
const $440f4836bcb56932$export$b94867ecbd698f21 = /*#__PURE__*/ (0, $8iEQ9$
|
|
39
|
+
const $440f4836bcb56932$export$b94867ecbd698f21 = /*#__PURE__*/ (0, $8iEQ9$createHideableComponent)(function SearchField(props, ref) {
|
|
38
40
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $440f4836bcb56932$export$d1c4e4c63cb03a11);
|
|
39
41
|
let { validationBehavior: formValidationBehavior } = (0, $64fa3d84918910a7$export$fabf2dc03a41866e)((0, $d3e0e05bdfcf66bd$export$c24727297075ec6a)) || {};
|
|
40
42
|
var _props_validationBehavior, _ref;
|
|
@@ -7,8 +7,9 @@ import {InputContext as $3985021b0ad6602f$export$37fb8590cf2c088c} from "./Input
|
|
|
7
7
|
import {LabelContext as $01b77f81d0f07f68$export$75b6ee27786ba447} from "./Label.module.js";
|
|
8
8
|
import {TextContext as $514c0188e459b4c0$export$9afb8bc826b033ea} from "./Text.module.js";
|
|
9
9
|
import {useSearchField as $8iEQ9$useSearchField} from "react-aria";
|
|
10
|
+
import {createHideableComponent as $8iEQ9$createHideableComponent} from "@react-aria/collections";
|
|
10
11
|
import {filterDOMProps as $8iEQ9$filterDOMProps, mergeProps as $8iEQ9$mergeProps} from "@react-aria/utils";
|
|
11
|
-
import $8iEQ9$react, {createContext as $8iEQ9$createContext,
|
|
12
|
+
import $8iEQ9$react, {createContext as $8iEQ9$createContext, useRef as $8iEQ9$useRef} from "react";
|
|
12
13
|
import {useSearchFieldState as $8iEQ9$useSearchFieldState} from "react-stately";
|
|
13
14
|
|
|
14
15
|
/*
|
|
@@ -33,8 +34,9 @@ import {useSearchFieldState as $8iEQ9$useSearchFieldState} from "react-stately";
|
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
|
|
37
|
+
|
|
36
38
|
const $440f4836bcb56932$export$d1c4e4c63cb03a11 = /*#__PURE__*/ (0, $8iEQ9$createContext)(null);
|
|
37
|
-
const $440f4836bcb56932$export$b94867ecbd698f21 = /*#__PURE__*/ (0, $8iEQ9$
|
|
39
|
+
const $440f4836bcb56932$export$b94867ecbd698f21 = /*#__PURE__*/ (0, $8iEQ9$createHideableComponent)(function SearchField(props, ref) {
|
|
38
40
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $440f4836bcb56932$export$d1c4e4c63cb03a11);
|
|
39
41
|
let { validationBehavior: formValidationBehavior } = (0, $64fa3d84918910a7$export$fabf2dc03a41866e)((0, $d3e0e05bdfcf66bd$export$c24727297075ec6a)) || {};
|
|
40
42
|
var _props_validationBehavior, _ref;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAwCM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAAkD;AAKzF,MAAM,4CAAc,WAAW,GAAG,CAAA,GAAA,8BAAsB,EAAE,SAAS,YAAY,KAAuB,EAAE,GAAiC;IAC9I,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,yCAAgB,EAAE,CAAA,GAAA,yCAAU,MAAM,CAAC;Q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AE,KAAK;gBAAQ;aAAE;YAC9C;gBAAC,CAAA,GAAA,yCAAW;gBAAG;oBAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,kBAAkB;oBAAE,KAAK;gBAAc;aAAE;YACnF;gBAAC,CAAA,GAAA,yCAAY;gBAAG;aAAiB;YACjC;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAW;gBAAG;oBAAC,WAAW,WAAW,SAAS;oBAAE,YAAY,MAAM,UAAU,IAAI;gBAAK;aAAE;YACxF;gBAAC,CAAA,GAAA,yCAAgB;gBAAG;aAAW;SAChC;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/SearchField.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 {AriaSearchFieldProps, useSearchField} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {createHideableComponent} from '@react-aria/collections';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, useRef} from 'react';\nimport {SearchFieldState, useSearchFieldState} from 'react-stately';\nimport {TextContext} from './Text';\n\nexport interface SearchFieldRenderProps {\n /**\n * Whether the search field is empty.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the search field is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the search field is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the search field.\n */\n state: SearchFieldState\n}\n\nexport interface SearchFieldProps extends Omit<AriaSearchFieldProps, 'label' | 'placeholder' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<SearchFieldRenderProps>, SlotProps {}\n\nexport const SearchFieldContext = createContext<ContextValue<SearchFieldProps, HTMLDivElement>>(null);\n\n/**\n * A search field allows a user to enter and clear a search query.\n */\nexport const SearchField = /*#__PURE__*/ createHideableComponent(function SearchField(props: SearchFieldProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, SearchFieldContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let inputRef = useRef<HTMLInputElement>(null);\n let [inputContextProps, mergedInputRef] = useContextProps({}, inputRef, InputContext);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let state = useSearchFieldState({\n ...props,\n validationBehavior\n });\n\n let {labelProps, inputProps, clearButtonProps, descriptionProps, errorMessageProps, ...validation} = useSearchField({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, mergedInputRef);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n isEmpty: state.value === '',\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n state\n },\n defaultClassName: 'react-aria-SearchField'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-empty={state.value === '' || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}>\n <Provider\n values={[\n [LabelContext, {...labelProps, ref: labelRef}],\n [InputContext, {...mergeProps(inputProps, inputContextProps), ref: mergedInputRef}],\n [ButtonContext, clearButtonProps],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [GroupContext, {isInvalid: validation.isInvalid, isDisabled: props.isDisabled || false}],\n [FieldErrorContext, validation]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"SearchField.module.js.map"}
|
package/dist/Table.main.js
CHANGED
|
@@ -56,46 +56,18 @@ class $37b9a5d4bd0d4ded$var$TableCollection extends (0, $5VUTk$reactariacollecti
|
|
|
56
56
|
}
|
|
57
57
|
commit(firstKey, lastKey, isSSR = false) {
|
|
58
58
|
this.updateColumns(isSSR);
|
|
59
|
-
this.updateRows(isSSR);
|
|
60
|
-
super.commit(firstKey, lastKey, isSSR);
|
|
61
|
-
}
|
|
62
|
-
updateRows(isSSR) {
|
|
63
59
|
this.rows = [];
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
let
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
if (rowHasCellWithColSpan) {
|
|
74
|
-
let last = null;
|
|
75
|
-
for (let child of childNodes){
|
|
76
|
-
var _child_props1, _child_props2;
|
|
77
|
-
child.colSpan = (_child_props1 = child.props) === null || _child_props1 === void 0 ? void 0 : _child_props1.colSpan;
|
|
78
|
-
child.colspan = (_child_props2 = child.props) === null || _child_props2 === void 0 ? void 0 : _child_props2.colSpan;
|
|
79
|
-
var _last_colIndex, _last_colSpan;
|
|
80
|
-
child.colIndex = !last ? child.index : ((_last_colIndex = last.colIndex) !== null && _last_colIndex !== void 0 ? _last_colIndex : last.index) + ((_last_colSpan = last.colSpan) !== null && _last_colSpan !== void 0 ? _last_colSpan : 1);
|
|
81
|
-
last = child;
|
|
82
|
-
}
|
|
83
|
-
var _last_colIndex1;
|
|
84
|
-
let lastColIndex = (_last_colIndex1 = last === null || last === void 0 ? void 0 : last.colIndex) !== null && _last_colIndex1 !== void 0 ? _last_colIndex1 : 1; // internally colIndex is 0 based
|
|
85
|
-
var _last_colSpan1;
|
|
86
|
-
let lastColSpan = (_last_colSpan1 = last === null || last === void 0 ? void 0 : last.colSpan) !== null && _last_colSpan1 !== void 0 ? _last_colSpan1 : 1;
|
|
87
|
-
let numberOfCellsInRow = lastColIndex + lastColSpan;
|
|
88
|
-
if (numberOfCellsInRow !== this.columns.length && !isSSR) throw new Error(`Cell count must match column count. Found ${numberOfCellsInRow} cells and ${this.columns.length} columns.`);
|
|
89
|
-
} else {
|
|
90
|
-
let numberOfCellsInRow = [
|
|
91
|
-
...childNodes
|
|
92
|
-
].length;
|
|
93
|
-
if (numberOfCellsInRow !== this.columns.length && !isSSR) throw new Error(`Cell count must match column count. Found ${numberOfCellsInRow} cells and ${this.columns.length} columns.`);
|
|
94
|
-
}
|
|
60
|
+
for (let row of this.getChildren(this.body.key)){
|
|
61
|
+
let lastChildKey = row.lastChildKey;
|
|
62
|
+
if (lastChildKey != null) {
|
|
63
|
+
let lastCell = this.getItem(lastChildKey);
|
|
64
|
+
var _lastCell_colIndex, _lastCell_colSpan;
|
|
65
|
+
let numberOfCellsInRow = ((_lastCell_colIndex = lastCell.colIndex) !== null && _lastCell_colIndex !== void 0 ? _lastCell_colIndex : lastCell.index) + ((_lastCell_colSpan = lastCell.colSpan) !== null && _lastCell_colSpan !== void 0 ? _lastCell_colSpan : 1);
|
|
66
|
+
if (numberOfCellsInRow !== this.columns.length && !isSSR) throw new Error(`Cell count must match column count. Found ${numberOfCellsInRow} cells and ${this.columns.length} columns.`);
|
|
95
67
|
}
|
|
96
|
-
this.rows.push(
|
|
97
|
-
}
|
|
98
|
-
|
|
68
|
+
this.rows.push(row);
|
|
69
|
+
}
|
|
70
|
+
super.commit(firstKey, lastKey, isSSR);
|
|
99
71
|
}
|
|
100
72
|
updateColumns(isSSR) {
|
|
101
73
|
if (!this.columnsDirty) return;
|