@react-spectrum/utils 3.12.2 → 3.12.4

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.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAM,8CAAU,CAAA,GAAA,sCAAI,EAAE,aAAa,CAA2B;AAC9D,8BAAQ,WAAW,GAAG;AAOf,SAAS,0CAAmB,KAA8B;IAC/D,IAAI,YACF,QAAQ,sBACR,kBAAkB,EACnB,GAAG;IACJ,qBACE,0DAAC,8BAAQ,QAAQ;QACf,OAAO;gCAAC;QAAkB;OACzB;AAGP;AAEO,SAAS,0CAAsB,WAAwB;IAC5D,IAAI,UAAU,OAAO,OAAO,CAAC,aAAa,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,GAAK,SAAU;IACrF,IAAI,oBAAoB,QAAQ,GAAG,CAAC,CAAC,GAAG,MAAM,GAAK,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC;IAE5E,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,uBAAuB;QACzB,IAAI,UAAoB,EAAE;QAC1B,IAAK,IAAI,KAAK,kBAAmB;YAC/B,IAAI,QAAQ,iBAAiB,CAAC,EAAE;YAChC,IAAI,OAAO,UAAU,CAAC,OAAO,OAAO,EAClC,QAAQ,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QAE9B;QACA,QAAQ,IAAI,CAAC;QACb,OAAO;IACT;IAEA,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,qBAAO,EAAE,IACzC,qBACI,yBACA;YAAC;SAAO;IAGd,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,WAAW;YACb,MAAM,oBAAoB;YAE1B,cAAc,CAAA;gBACZ,IAAI,0BAA0B,MAAM,KAAK,kBAAkB,MAAM,IAC/D,0BAA0B,IAAI,CAAC,CAAC,YAAY,MAAQ,eAAe,iBAAiB,CAAC,IAAI,GACzF,OAAO;uBAAI;iBAAkB,EAAE,2CAA2C;gBAG5E,OAAO;YACT;QACF;QAEA,OAAO,gBAAgB,CAAC,UAAU;QAClC,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU;QACvC;IACF,uDAAuD;IACvD,GAAG;QAAC;KAAmB;IAEvB,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,4BAAO;IACnB,OAAO,QAAQ;QAAC;KAAO,GAAG;AAC5B;AAEO,SAAS;IACd,OAAO,CAAA,GAAA,uBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/utils/src/BreakpointProvider.tsx"],"sourcesContent":["import React, {ReactNode, useContext, useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\ninterface Breakpoints {\n S?: number,\n M?: number,\n L?: number,\n [custom: string]: number | undefined\n}\n\ninterface BreakpointContext {\n matchedBreakpoints: string[]\n}\n\nconst Context = React.createContext<BreakpointContext | null>(null);\nContext.displayName = 'BreakpointContext';\n\ninterface BreakpointProviderProps {\n children?: ReactNode,\n matchedBreakpoints: string[]\n}\n\nexport function BreakpointProvider(props: BreakpointProviderProps) {\n let {\n children,\n matchedBreakpoints\n } = props;\n return (\n <Context.Provider\n value={{matchedBreakpoints}} >\n {children}\n </Context.Provider>\n );\n}\n\nexport function useMatchedBreakpoints(breakpoints: Breakpoints): string[] {\n let entries = Object.entries(breakpoints).sort(([, valueA], [, valueB]) => valueB! - valueA!);\n let breakpointQueries = entries.map(([, value]) => `(min-width: ${value}px)`);\n\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let getBreakpointHandler = () => {\n let matched: string[] = [];\n for (let i in breakpointQueries) {\n let query = breakpointQueries[i];\n if (window.matchMedia(query).matches) {\n matched.push(entries[i][0]);\n }\n }\n matched.push('base');\n return matched;\n };\n\n let [breakpoint, setBreakpoint] = useState(() =>\n supportsMatchMedia\n ? getBreakpointHandler()\n : ['base']\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let onResize = () => {\n const breakpointHandler = getBreakpointHandler();\n\n setBreakpoint(previousBreakpointHandler => {\n if (previousBreakpointHandler.length !== breakpointHandler.length ||\n previousBreakpointHandler.some((breakpoint, idx) => breakpoint !== breakpointHandler[idx])) {\n return [...breakpointHandler]; // Return a new array to force state change\n }\n\n return previousBreakpointHandler;\n });\n };\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [supportsMatchMedia]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? ['base'] : breakpoint;\n}\n\nexport function useBreakpoint() {\n return useContext(Context);\n}\n"],"names":[],"version":3,"file":"BreakpointProvider.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAM,8CAAU,CAAA,GAAA,sCAAI,EAAE,aAAa,CAA2B;AAC9D,8BAAQ,WAAW,GAAG;AAOf,SAAS,0CAAmB,KAA8B;IAC/D,IAAI,YACF,QAAQ,sBACR,kBAAkB,EACnB,GAAG;IACJ,qBACE,0DAAC,8BAAQ,QAAQ;QACf,OAAO;gCAAC;QAAkB;OACzB;AAGP;AAEO,SAAS,0CAAsB,WAAwB;IAC5D,IAAI,UAAU,OAAO,OAAO,CAAC,aAAa,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,GAAK,SAAU;IACrF,IAAI,oBAAoB,QAAQ,GAAG,CAAC,CAAC,GAAG,MAAM,GAAK,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC;IAE5E,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,uBAAuB;QACzB,IAAI,UAAoB,EAAE;QAC1B,IAAK,IAAI,KAAK,kBAAmB;YAC/B,IAAI,QAAQ,iBAAiB,CAAC,EAAE;YAChC,IAAI,OAAO,UAAU,CAAC,OAAO,OAAO,EAClC,QAAQ,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QAE9B;QACA,QAAQ,IAAI,CAAC;QACb,OAAO;IACT;IAEA,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,qBAAO,EAAE,IACzC,qBACI,yBACA;YAAC;SAAO;IAGd,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,WAAW;YACb,MAAM,oBAAoB;YAE1B,cAAc,CAAA;gBACZ,IAAI,0BAA0B,MAAM,KAAK,kBAAkB,MAAM,IAC/D,0BAA0B,IAAI,CAAC,CAAC,YAAY,MAAQ,eAAe,iBAAiB,CAAC,IAAI,GACzF,OAAO;uBAAI;iBAAkB,EAAE,2CAA2C;gBAG5E,OAAO;YACT;QACF;QAEA,OAAO,gBAAgB,CAAC,UAAU;QAClC,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU;QACvC;IACF,uDAAuD;IACvD,GAAG;QAAC;KAAmB;IAEvB,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,4BAAO;IACnB,OAAO,QAAQ;QAAC;KAAO,GAAG;AAC5B;AAEO,SAAS;IACd,OAAO,CAAA,GAAA,uBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/utils/src/BreakpointProvider.tsx"],"sourcesContent":["import React, {ReactNode, useContext, useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\ninterface Breakpoints {\n S?: number,\n M?: number,\n L?: number,\n [custom: string]: number | undefined\n}\n\ninterface BreakpointContext {\n matchedBreakpoints: string[]\n}\n\nconst Context = React.createContext<BreakpointContext | null>(null);\nContext.displayName = 'BreakpointContext';\n\ninterface BreakpointProviderProps {\n children?: ReactNode,\n matchedBreakpoints: string[]\n}\n\nexport function BreakpointProvider(props: BreakpointProviderProps): ReactNode {\n let {\n children,\n matchedBreakpoints\n } = props;\n return (\n <Context.Provider\n value={{matchedBreakpoints}} >\n {children}\n </Context.Provider>\n );\n}\n\nexport function useMatchedBreakpoints(breakpoints: Breakpoints): string[] {\n let entries = Object.entries(breakpoints).sort(([, valueA], [, valueB]) => valueB! - valueA!);\n let breakpointQueries = entries.map(([, value]) => `(min-width: ${value}px)`);\n\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let getBreakpointHandler = () => {\n let matched: string[] = [];\n for (let i in breakpointQueries) {\n let query = breakpointQueries[i];\n if (window.matchMedia(query).matches) {\n matched.push(entries[i][0]);\n }\n }\n matched.push('base');\n return matched;\n };\n\n let [breakpoint, setBreakpoint] = useState(() =>\n supportsMatchMedia\n ? getBreakpointHandler()\n : ['base']\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let onResize = () => {\n const breakpointHandler = getBreakpointHandler();\n\n setBreakpoint(previousBreakpointHandler => {\n if (previousBreakpointHandler.length !== breakpointHandler.length ||\n previousBreakpointHandler.some((breakpoint, idx) => breakpoint !== breakpointHandler[idx])) {\n return [...breakpointHandler]; // Return a new array to force state change\n }\n\n return previousBreakpointHandler;\n });\n };\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [supportsMatchMedia]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? ['base'] : breakpoint;\n}\n\nexport function useBreakpoint(): BreakpointContext | null {\n return useContext(Context);\n}\n"],"names":[],"version":3,"file":"BreakpointProvider.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;AAcA,MAAM,8CAAU,CAAA,GAAA,YAAI,EAAE,aAAa,CAA2B;AAC9D,8BAAQ,WAAW,GAAG;AAOf,SAAS,0CAAmB,KAA8B;IAC/D,IAAI,YACF,QAAQ,sBACR,kBAAkB,EACnB,GAAG;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C;KAAO,GAAG;AAC5B;AAEO,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/utils/src/BreakpointProvider.tsx"],"sourcesContent":["import React, {ReactNode, useContext, useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\ninterface Breakpoints {\n S?: number,\n M?: number,\n L?: number,\n [custom: string]: number | undefined\n}\n\ninterface BreakpointContext {\n matchedBreakpoints: string[]\n}\n\nconst Context = React.createContext<BreakpointContext | null>(null);\nContext.displayName = 'BreakpointContext';\n\ninterface BreakpointProviderProps {\n children?: ReactNode,\n matchedBreakpoints: string[]\n}\n\nexport function BreakpointProvider(props: BreakpointProviderProps) {\n let {\n children,\n matchedBreakpoints\n } = props;\n return (\n <Context.Provider\n value={{matchedBreakpoints}} >\n {children}\n </Context.Provider>\n );\n}\n\nexport function useMatchedBreakpoints(breakpoints: Breakpoints): string[] {\n let entries = Object.entries(breakpoints).sort(([, valueA], [, valueB]) => valueB! - valueA!);\n let breakpointQueries = entries.map(([, value]) => `(min-width: ${value}px)`);\n\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let getBreakpointHandler = () => {\n let matched: string[] = [];\n for (let i in breakpointQueries) {\n let query = breakpointQueries[i];\n if (window.matchMedia(query).matches) {\n matched.push(entries[i][0]);\n }\n }\n matched.push('base');\n return matched;\n };\n\n let [breakpoint, setBreakpoint] = useState(() =>\n supportsMatchMedia\n ? getBreakpointHandler()\n : ['base']\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let onResize = () => {\n const breakpointHandler = getBreakpointHandler();\n\n setBreakpoint(previousBreakpointHandler => {\n if (previousBreakpointHandler.length !== breakpointHandler.length ||\n previousBreakpointHandler.some((breakpoint, idx) => breakpoint !== breakpointHandler[idx])) {\n return [...breakpointHandler]; // Return a new array to force state change\n }\n\n return previousBreakpointHandler;\n });\n };\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [supportsMatchMedia]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? ['base'] : breakpoint;\n}\n\nexport function useBreakpoint() {\n return useContext(Context);\n}\n"],"names":[],"version":3,"file":"BreakpointProvider.module.js.map"}
1
+ {"mappings":";;;;;AAcA,MAAM,8CAAU,CAAA,GAAA,YAAI,EAAE,aAAa,CAA2B;AAC9D,8BAAQ,WAAW,GAAG;AAOf,SAAS,0CAAmB,KAA8B;IAC/D,IAAI,YACF,QAAQ,sBACR,kBAAkB,EACnB,GAAG;IACJ,qBACE,gCAAC,8BAAQ,QAAQ;QACf,OAAO;gCAAC;QAAkB;OACzB;AAGP;AAEO,SAAS,0CAAsB,WAAwB;IAC5D,IAAI,UAAU,OAAO,OAAO,CAAC,aAAa,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,GAAK,SAAU;IACrF,IAAI,oBAAoB,QAAQ,GAAG,CAAC,CAAC,GAAG,MAAM,GAAK,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC;IAE5E,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,uBAAuB;QACzB,IAAI,UAAoB,EAAE;QAC1B,IAAK,IAAI,KAAK,kBAAmB;YAC/B,IAAI,QAAQ,iBAAiB,CAAC,EAAE;YAChC,IAAI,OAAO,UAAU,CAAC,OAAO,OAAO,EAClC,QAAQ,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QAE9B;QACA,QAAQ,IAAI,CAAC;QACb,OAAO;IACT;IAEA,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,eAAO,EAAE,IACzC,qBACI,yBACA;YAAC;SAAO;IAGd,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,WAAW;YACb,MAAM,oBAAoB;YAE1B,cAAc,CAAA;gBACZ,IAAI,0BAA0B,MAAM,KAAK,kBAAkB,MAAM,IAC/D,0BAA0B,IAAI,CAAC,CAAC,YAAY,MAAQ,eAAe,iBAAiB,CAAC,IAAI,GACzF,OAAO;uBAAI;iBAAkB,EAAE,2CAA2C;gBAG5E,OAAO;YACT;QACF;QAEA,OAAO,gBAAgB,CAAC,UAAU;QAClC,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU;QACvC;IACF,uDAAuD;IACvD,GAAG;QAAC;KAAmB;IAEvB,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,eAAO;IACnB,OAAO,QAAQ;QAAC;KAAO,GAAG;AAC5B;AAEO,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/utils/src/BreakpointProvider.tsx"],"sourcesContent":["import React, {ReactNode, useContext, useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\ninterface Breakpoints {\n S?: number,\n M?: number,\n L?: number,\n [custom: string]: number | undefined\n}\n\ninterface BreakpointContext {\n matchedBreakpoints: string[]\n}\n\nconst Context = React.createContext<BreakpointContext | null>(null);\nContext.displayName = 'BreakpointContext';\n\ninterface BreakpointProviderProps {\n children?: ReactNode,\n matchedBreakpoints: string[]\n}\n\nexport function BreakpointProvider(props: BreakpointProviderProps): ReactNode {\n let {\n children,\n matchedBreakpoints\n } = props;\n return (\n <Context.Provider\n value={{matchedBreakpoints}} >\n {children}\n </Context.Provider>\n );\n}\n\nexport function useMatchedBreakpoints(breakpoints: Breakpoints): string[] {\n let entries = Object.entries(breakpoints).sort(([, valueA], [, valueB]) => valueB! - valueA!);\n let breakpointQueries = entries.map(([, value]) => `(min-width: ${value}px)`);\n\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let getBreakpointHandler = () => {\n let matched: string[] = [];\n for (let i in breakpointQueries) {\n let query = breakpointQueries[i];\n if (window.matchMedia(query).matches) {\n matched.push(entries[i][0]);\n }\n }\n matched.push('base');\n return matched;\n };\n\n let [breakpoint, setBreakpoint] = useState(() =>\n supportsMatchMedia\n ? getBreakpointHandler()\n : ['base']\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let onResize = () => {\n const breakpointHandler = getBreakpointHandler();\n\n setBreakpoint(previousBreakpointHandler => {\n if (previousBreakpointHandler.length !== breakpointHandler.length ||\n previousBreakpointHandler.some((breakpoint, idx) => breakpoint !== breakpointHandler[idx])) {\n return [...breakpointHandler]; // Return a new array to force state change\n }\n\n return previousBreakpointHandler;\n });\n };\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [supportsMatchMedia]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? ['base'] : breakpoint;\n}\n\nexport function useBreakpoint(): BreakpointContext | null {\n return useContext(Context);\n}\n"],"names":[],"version":3,"file":"BreakpointProvider.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AASD,IAAI,kDAAc,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAY;AAE1C,SAAS,0CAAgB,KAAwB,EAAE,WAAoB;IAC5E,IAAI,OAAO,AAAC,MAAoB,IAAI,IAAI;IACxC,0EAA0E;IAC1E,IAAI,EAAC,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,sCAAgB,CAAC;IAE3D,OAAO,CAAA,GAAA,gCAAS,EAAE,OAAO,CAAA,GAAA,gCAAS,EAAE,WAAW;QAAC,IAAI,MAAM,EAAE;IAAA;AAC9D;AAEO,SAAS,0CAAiB,SAAS;IACxC,OAAO,OAAO,IAAI,CAAC,WAAW,MAAM,CAAC,CAAC,KAAK;QACzC,G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2020 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 {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useMemo} from 'react';\n\ninterface SlotProps {\n slot?: string\n}\n\nlet SlotContext = React.createContext<{} | null>(null);\n\nexport function useSlotProps<T>(props: T & {id?: string}, defaultSlot?: string): T {\n let slot = (props as SlotProps).slot || defaultSlot;\n // @ts-ignore TODO why is slot an object and not just string or undefined?\n let {[slot]: slotProps = {}} = useContext(SlotContext) || {};\n\n return mergeProps(props, mergeProps(slotProps, {id: props.id}));\n}\n\nexport function cssModuleToSlots(cssModule) {\n return Object.keys(cssModule).reduce((acc, slot) => {\n acc[slot] = {UNSAFE_className: cssModule[slot]};\n return acc;\n }, {});\n}\n\nexport function SlotProvider(props) {\n const emptyObj = useMemo(() => ({}), []);\n \n let parentSlots = useContext(SlotContext) || emptyObj;\n let {slots = emptyObj, children} = props;\n\n // Merge props for each slot from parent context and props\n let value = useMemo(() =>\n Object.keys(parentSlots)\n .concat(Object.keys(slots))\n .reduce((o, p) => ({\n ...o,\n [p]: mergeProps(parentSlots[p] || {}, slots[p] || {})}), {})\n , [parentSlots, slots]);\n\n return (\n <SlotContext.Provider value={value}>\n {children}\n </SlotContext.Provider>\n );\n}\n\nexport function ClearSlots(props) {\n let {children, ...otherProps} = props;\n\n const emptyObj = useMemo(() => ({}), []);\n\n let content = children;\n if (React.Children.toArray(children).length <= 1) {\n if (typeof children === 'function') { // need to know if the node is a string or something else that react can render that doesn't get props\n content = React.cloneElement(React.Children.only(children), otherProps);\n }\n }\n return (\n <SlotContext.Provider value={emptyObj}>\n {content}\n </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;KAAM;IAE1B,qBACE,0DAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;AAEO,SAAS,0CAAW,KAA6B;IACtD,IAAI,YAAC,QAAQ,EAAE,GAAG,YAAW,GAAG;IAEhC,MAAM,WAAW,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA,CAAC,CAAA,GAAI,EAAE;IAEvC,IAAI,UAAU;IACd,IAAI,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,MAAM,IAAI,GAC7C;QAAA,IAAI,OAAO,aAAa,YACtB,wBAAU,CAAA,GAAA,sCAAI,EAAE,YAAY,CAAC,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW;IAC9D;IAEF,qBACE,0DAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP","sources":["packages/@react-spectrum/utils/src/Slots.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {mergeProps} from '@react-aria/utils';\nimport React, {ReactNode, useContext, useMemo} from 'react';\n\ninterface SlotProps {\n slot?: string\n}\n\nlet SlotContext = React.createContext<{} | null>(null);\n\nexport function useSlotProps<T>(props: T & {id?: string}, defaultSlot?: string): T {\n let slot = (props as SlotProps).slot || defaultSlot;\n // @ts-ignore TODO why is slot an object and not just string or undefined?\n let {[slot]: slotProps = {}} = useContext(SlotContext) || {};\n\n return mergeProps(props, mergeProps(slotProps, {id: props.id}));\n}\n\nexport function cssModuleToSlots(cssModule: {[cssmodule: string]: string}): {[slot: string]: {UNSAFE_className: string}} {\n return Object.keys(cssModule).reduce((acc, slot) => {\n acc[slot] = {UNSAFE_className: cssModule[slot]};\n return acc;\n }, {});\n}\n\nexport function SlotProvider(props: {slots?: {[slot: string]: object}, children?: ReactNode}): ReactNode {\n const emptyObj = useMemo(() => ({}), []);\n\n let parentSlots = useContext(SlotContext) || emptyObj;\n let {slots = emptyObj, children} = props;\n\n // Merge props for each slot from parent context and props\n let value = useMemo(() =>\n Object.keys(parentSlots)\n .concat(Object.keys(slots))\n .reduce((o, p) => ({\n ...o,\n [p]: mergeProps(parentSlots[p] || {}, slots[p] || {})}), {})\n , [parentSlots, slots]);\n\n return (\n <SlotContext.Provider value={value}>\n {children}\n </SlotContext.Provider>\n );\n}\n\nexport function ClearSlots(props: {children?: ReactNode}): ReactNode {\n let {children, ...otherProps} = props;\n\n const emptyObj = useMemo(() => ({}), []);\n\n let content = children;\n if (React.Children.toArray(children).length <= 1) {\n if (typeof children === 'function') { // need to know if the node is a string or something else that react can render that doesn't get props\n content = React.cloneElement(React.Children.only(children), otherProps);\n }\n }\n return (\n <SlotContext.Provider value={emptyObj}>\n {content}\n </SlotContext.Provider>\n );\n}\n"],"names":[],"version":3,"file":"Slots.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AASD,IAAI,kDAAc,CAAA,GAAA,YAAI,EAAE,aAAa,CAAY;AAE1C,SAAS,0CAAgB,KAAwB,EAAE,WAAoB;IAC5E,IAAI,OAAO,AAAC,MAAoB,IAAI,IAAI;IACxC,0EAA0E;IAC1E,IAAI,EAAC,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,sCAAgB,CAAC;IAE3D,OAAO,CAAA,GAAA,iBAAS,EAAE,OAAO,CAAA,GAAA,iBAAS,EAAE,WAAW;QAAC,IAAI,MAAM,EAAE;IAAA;AAC9D;AAEO,SAAS,0CAAiB,SAAS;IACxC,OAAO,OAAO,IAAI,CAAC,W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tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useMemo} from 'react';\n\ninterface SlotProps {\n slot?: string\n}\n\nlet SlotContext = React.createContext<{} | null>(null);\n\nexport function useSlotProps<T>(props: T & {id?: string}, defaultSlot?: string): T {\n let slot = (props as SlotProps).slot || defaultSlot;\n // @ts-ignore TODO why is slot an object and not just string or undefined?\n let {[slot]: slotProps = {}} = useContext(SlotContext) || {};\n\n return mergeProps(props, mergeProps(slotProps, {id: props.id}));\n}\n\nexport function cssModuleToSlots(cssModule) {\n return Object.keys(cssModule).reduce((acc, slot) => {\n acc[slot] = {UNSAFE_className: cssModule[slot]};\n return acc;\n }, {});\n}\n\nexport function SlotProvider(props) {\n const emptyObj = useMemo(() => ({}), []);\n \n let parentSlots = useContext(SlotContext) || emptyObj;\n let {slots = emptyObj, children} = props;\n\n // Merge props for each slot from parent context and props\n let value = useMemo(() =>\n Object.keys(parentSlots)\n .concat(Object.keys(slots))\n .reduce((o, p) => ({\n ...o,\n [p]: mergeProps(parentSlots[p] || {}, slots[p] || {})}), {})\n , [parentSlots, slots]);\n\n return (\n <SlotContext.Provider value={value}>\n {children}\n </SlotContext.Provider>\n );\n}\n\nexport function ClearSlots(props) {\n let {children, ...otherProps} = props;\n\n const emptyObj = useMemo(() => ({}), []);\n\n let content = children;\n if (React.Children.toArray(children).length <= 1) {\n if (typeof children === 'function') { // need to know if the node is a string or something else that react can render that doesn't get props\n content = React.cloneElement(React.Children.only(children), otherProps);\n }\n }\n return (\n <Sl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AAC;QAAa;KAAM;IAE1B,qBACE,gCAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;AAEO,SAAS,0CAAW,KAA6B;IACtD,IAAI,YAAC,QAAQ,EAAE,GAAG,YAAW,GAAG;IAEhC,MAAM,WAAW,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA,CAAC,CAAA,GAAI,EAAE;IAEvC,IAAI,UAAU;IACd,IAAI,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,MAAM,IAAI,GAC7C;QAAA,IAAI,OAAO,aAAa,YACtB,wBAAU,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW;IAC9D;IAEF,qBACE,gCAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP","sources":["packages/@react-spectrum/utils/src/Slots.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {mergeProps} from '@react-aria/utils';\nimport React, {ReactNode, useContext, useMemo} from 'react';\n\ninterface SlotProps {\n slot?: string\n}\n\nlet SlotContext = React.createContext<{} | null>(null);\n\nexport function useSlotProps<T>(props: T & {id?: string}, defaultSlot?: string): T {\n let slot = (props as SlotProps).slot || defaultSlot;\n // @ts-ignore TODO why is slot an object and not just string or undefined?\n let {[slot]: slotProps = {}} = useContext(SlotContext) || {};\n\n return mergeProps(props, mergeProps(slotProps, {id: props.id}));\n}\n\nexport function cssModuleToSlots(cssModule: {[cssmodule: string]: string}): {[slot: string]: {UNSAFE_className: string}} {\n return Object.keys(cssModule).reduce((acc, slot) => {\n acc[slot] = {UNSAFE_className: cssModule[slot]};\n return acc;\n }, {});\n}\n\nexport function SlotProvider(props: {slots?: {[slot: string]: object}, children?: ReactNode}): ReactNode {\n const emptyObj = useMemo(() => ({}), []);\n\n let parentSlots = useContext(SlotContext) || emptyObj;\n let {slots = emptyObj, children} = props;\n\n // Merge props for each slot from parent context and props\n let value = useMemo(() =>\n Object.keys(parentSlots)\n .concat(Object.keys(slots))\n .reduce((o, p) => ({\n ...o,\n [p]: mergeProps(parentSlots[p] || {}, slots[p] || {})}), {})\n , [parentSlots, slots]);\n\n return (\n <SlotContext.Provider value={value}>\n {children}\n </SlotContext.Provider>\n );\n}\n\nexport function ClearSlots(props: {children?: ReactNode}): ReactNode {\n let {children, ...otherProps} = props;\n\n const emptyObj = useMemo(() => ({}), []);\n\n let content = children;\n if (React.Children.toArray(children).length <= 1) {\n if (typeof children === 'function') { // need to know if the node is a string or something else that react can render that doesn't get props\n content = React.cloneElement(React.Children.only(children), otherProps);\n }\n }\n return (\n <SlotContext.Provider value={emptyObj}>\n {content}\n </SlotContext.Provider>\n );\n}\n"],"names":[],"version":3,"file":"Slots.module.js.map"}
@@ -26,7 +26,7 @@ $parcel$export(module.exports, "classNames", () => $e720495fead531ee$export$ce4a
26
26
  let $e720495fead531ee$export$46d604dce8bf8724 = false;
27
27
  function $e720495fead531ee$export$f9d3bfd10703eb31() {
28
28
  $e720495fead531ee$export$46d604dce8bf8724 = true;
29
- console.warn("Legacy spectrum-prefixed class names enabled for backward compatibility. We recommend replacing instances of CSS overrides targeting spectrum selectors in your app with custom class names of your own, and disabling this flag.");
29
+ if (process.env.NODE_ENV !== 'production') console.warn("Legacy spectrum-prefixed class names enabled for backward compatibility. We recommend replacing instances of CSS overrides targeting spectrum selectors in your app with custom class names of your own, and disabling this flag.");
30
30
  }
31
31
  function $e720495fead531ee$export$ce4ab0c55987d1ff(cssModule, ...values) {
32
32
  let classes = [];
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAIM,IAAI,4CAA+B;AAEnC,SAAS;IACd,4CAA+B;IAC/B,QAAQ,IAAI,CACV;AAIJ;AAEO,SAAS,0CAAW,SAAkC,EAAE,GAAG,MAA0C;IAC1G,IAAI,UAAiC,EAAE;IACvC,KAAK,IAAI,SAAS,OAAQ;QACxB,IAAI,OAAO,UAAU,YAAY,OAAO;YACtC,IAAI,SAAS,CAAC;YACd,IAAK,IAAI,OAAO,MAAO;gBACrB,IAAI,SAAS,CAAC,IAAI,EAChB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI;gBAGrC,IAAI,6CAAgC,CAAC,SAAS,CAAC,IAAI,EACjD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI;YAE5B;YAEA,QAAQ,IAAI,CAAC;QACf,OAAO,IAAI,OAAO,UAAU,UAAU;YACpC,IAAI,SAAS,CAAC,MAAM,EAClB,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM;YAG/B,IAAI,6CAAgC,CAAC,SAAS,CAAC,MAAM,EACnD,QAAQ,IAAI,CAAC;QAEjB,OACE,QAAQ,IAAI,CAAC;IAEjB;IAEA,OAAO,CAAA,GAAA,qCAAI,KAAK;AAClB","sources":["packages/@react-spectrum/utils/src/classNames.ts"],"sourcesContent":["/*\n * Copyright 2020 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 _clsx from 'clsx';\n\nexport let shouldKeepSpectrumClassNames = false;\n\nexport function keepSpectrumClassNames() {\n shouldKeepSpectrumClassNames = true;\n console.warn(\n 'Legacy spectrum-prefixed class names enabled for backward compatibility. ' +\n 'We recommend replacing instances of CSS overrides targeting spectrum selectors ' +\n 'in your app with custom class names of your own, and disabling this flag.'\n );\n}\n\nexport function classNames(cssModule: {[key: string]: string}, ...values: Array<string | Object | undefined>): string {\n let classes: Array<{} | undefined> = [];\n for (let value of values) {\n if (typeof value === 'object' && value) {\n let mapped = {};\n for (let key in value) {\n if (cssModule[key]) {\n mapped[cssModule[key]] = value[key];\n }\n\n if (shouldKeepSpectrumClassNames || !cssModule[key]) {\n mapped[key] = value[key];\n }\n }\n\n classes.push(mapped);\n } else if (typeof value === 'string') {\n if (cssModule[value]) {\n classes.push(cssModule[value]);\n }\n\n if (shouldKeepSpectrumClassNames || !cssModule[value]) {\n classes.push(value);\n }\n } else {\n classes.push(value);\n }\n }\n\n return _clsx(...classes);\n}\n"],"names":[],"version":3,"file":"classNames.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAIM,IAAI,4CAA+B;AAEnC,SAAS;IACd,4CAA+B;IAC/B,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B,QAAQ,IAAI,CACV;AAKN;AAEO,SAAS,0CAAW,SAAkC,EAAE,GAAG,MAA0C;IAC1G,IAAI,UAAiC,EAAE;IACvC,KAAK,IAAI,SAAS,OAAQ;QACxB,IAAI,OAAO,UAAU,YAAY,OAAO;YACtC,IAAI,SAAS,CAAC;YACd,IAAK,IAAI,OAAO,MAAO;gBACrB,IAAI,SAAS,CAAC,IAAI,EAChB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI;gBAGrC,IAAI,6CAAgC,CAAC,SAAS,CAAC,IAAI,EACjD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI;YAE5B;YAEA,QAAQ,IAAI,CAAC;QACf,OAAO,IAAI,OAAO,UAAU,UAAU;YACpC,IAAI,SAAS,CAAC,MAAM,EAClB,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM;YAG/B,IAAI,6CAAgC,CAAC,SAAS,CAAC,MAAM,EACnD,QAAQ,IAAI,CAAC;QAEjB,OACE,QAAQ,IAAI,CAAC;IAEjB;IAEA,OAAO,CAAA,GAAA,qCAAI,KAAK;AAClB","sources":["packages/@react-spectrum/utils/src/classNames.ts"],"sourcesContent":["/*\n * Copyright 2020 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 _clsx from 'clsx';\n\nexport let shouldKeepSpectrumClassNames = false;\n\nexport function keepSpectrumClassNames(): void {\n shouldKeepSpectrumClassNames = true;\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Legacy spectrum-prefixed class names enabled for backward compatibility. ' +\n 'We recommend replacing instances of CSS overrides targeting spectrum selectors ' +\n 'in your app with custom class names of your own, and disabling this flag.'\n );\n }\n}\n\nexport function classNames(cssModule: {[key: string]: string}, ...values: Array<string | Object | undefined>): string {\n let classes: Array<{} | undefined> = [];\n for (let value of values) {\n if (typeof value === 'object' && value) {\n let mapped = {};\n for (let key in value) {\n if (cssModule[key]) {\n mapped[cssModule[key]] = value[key];\n }\n\n if (shouldKeepSpectrumClassNames || !cssModule[key]) {\n mapped[key] = value[key];\n }\n }\n\n classes.push(mapped);\n } else if (typeof value === 'string') {\n if (cssModule[value]) {\n classes.push(cssModule[value]);\n }\n\n if (shouldKeepSpectrumClassNames || !cssModule[value]) {\n classes.push(value);\n }\n } else {\n classes.push(value);\n }\n }\n\n return _clsx(...classes);\n}\n"],"names":[],"version":3,"file":"classNames.main.js.map"}
@@ -14,7 +14,7 @@ import $jPV9R$clsx from "clsx";
14
14
  let $fd933927dbac1f15$export$46d604dce8bf8724 = false;
15
15
  function $fd933927dbac1f15$export$f9d3bfd10703eb31() {
16
16
  $fd933927dbac1f15$export$46d604dce8bf8724 = true;
17
- console.warn("Legacy spectrum-prefixed class names enabled for backward compatibility. We recommend replacing instances of CSS overrides targeting spectrum selectors in your app with custom class names of your own, and disabling this flag.");
17
+ if (process.env.NODE_ENV !== 'production') console.warn("Legacy spectrum-prefixed class names enabled for backward compatibility. We recommend replacing instances of CSS overrides targeting spectrum selectors in your app with custom class names of your own, and disabling this flag.");
18
18
  }
19
19
  function $fd933927dbac1f15$export$ce4ab0c55987d1ff(cssModule, ...values) {
20
20
  let classes = [];
@@ -14,7 +14,7 @@ import $jPV9R$clsx from "clsx";
14
14
  let $fd933927dbac1f15$export$46d604dce8bf8724 = false;
15
15
  function $fd933927dbac1f15$export$f9d3bfd10703eb31() {
16
16
  $fd933927dbac1f15$export$46d604dce8bf8724 = true;
17
- console.warn("Legacy spectrum-prefixed class names enabled for backward compatibility. We recommend replacing instances of CSS overrides targeting spectrum selectors in your app with custom class names of your own, and disabling this flag.");
17
+ if (process.env.NODE_ENV !== 'production') console.warn("Legacy spectrum-prefixed class names enabled for backward compatibility. We recommend replacing instances of CSS overrides targeting spectrum selectors in your app with custom class names of your own, and disabling this flag.");
18
18
  }
19
19
  function $fd933927dbac1f15$export$ce4ab0c55987d1ff(cssModule, ...values) {
20
20
  let classes = [];
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAIM,IAAI,4CAA+B;AAEnC,SAAS;IACd,4CAA+B;IAC/B,QAAQ,IAAI,CACV;AAIJ;AAEO,SAAS,0CAAW,SAAkC,EAAE,GAAG,MAA0C;IAC1G,IAAI,UAAiC,EAAE;IACvC,KAAK,IAAI,SAAS,OAAQ;QACxB,IAAI,OAAO,UAAU,YAAY,OAAO;YACtC,IAAI,SAAS,CAAC;YACd,IAAK,IAAI,OAAO,MAAO;gBACrB,IAAI,SAAS,CAAC,IAAI,EAChB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI;gBAGrC,IAAI,6CAAgC,CAAC,SAAS,CAAC,IAAI,EACjD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI;YAE5B;YAEA,QAAQ,IAAI,CAAC;QACf,OAAO,IAAI,OAAO,UAAU,UAAU;YACpC,IAAI,SAAS,CAAC,MAAM,EAClB,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM;YAG/B,IAAI,6CAAgC,CAAC,SAAS,CAAC,MAAM,EACnD,QAAQ,IAAI,CAAC;QAEjB,OACE,QAAQ,IAAI,CAAC;IAEjB;IAEA,OAAO,CAAA,GAAA,WAAI,KAAK;AAClB","sources":["packages/@react-spectrum/utils/src/classNames.ts"],"sourcesContent":["/*\n * Copyright 2020 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 _clsx from 'clsx';\n\nexport let shouldKeepSpectrumClassNames = false;\n\nexport function keepSpectrumClassNames() {\n shouldKeepSpectrumClassNames = true;\n console.warn(\n 'Legacy spectrum-prefixed class names enabled for backward compatibility. ' +\n 'We recommend replacing instances of CSS overrides targeting spectrum selectors ' +\n 'in your app with custom class names of your own, and disabling this flag.'\n );\n}\n\nexport function classNames(cssModule: {[key: string]: string}, ...values: Array<string | Object | undefined>): string {\n let classes: Array<{} | undefined> = [];\n for (let value of values) {\n if (typeof value === 'object' && value) {\n let mapped = {};\n for (let key in value) {\n if (cssModule[key]) {\n mapped[cssModule[key]] = value[key];\n }\n\n if (shouldKeepSpectrumClassNames || !cssModule[key]) {\n mapped[key] = value[key];\n }\n }\n\n classes.push(mapped);\n } else if (typeof value === 'string') {\n if (cssModule[value]) {\n classes.push(cssModule[value]);\n }\n\n if (shouldKeepSpectrumClassNames || !cssModule[value]) {\n classes.push(value);\n }\n } else {\n classes.push(value);\n }\n }\n\n return _clsx(...classes);\n}\n"],"names":[],"version":3,"file":"classNames.module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAIM,IAAI,4CAA+B;AAEnC,SAAS;IACd,4CAA+B;IAC/B,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B,QAAQ,IAAI,CACV;AAKN;AAEO,SAAS,0CAAW,SAAkC,EAAE,GAAG,MAA0C;IAC1G,IAAI,UAAiC,EAAE;IACvC,KAAK,IAAI,SAAS,OAAQ;QACxB,IAAI,OAAO,UAAU,YAAY,OAAO;YACtC,IAAI,SAAS,CAAC;YACd,IAAK,IAAI,OAAO,MAAO;gBACrB,IAAI,SAAS,CAAC,IAAI,EAChB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI;gBAGrC,IAAI,6CAAgC,CAAC,SAAS,CAAC,IAAI,EACjD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI;YAE5B;YAEA,QAAQ,IAAI,CAAC;QACf,OAAO,IAAI,OAAO,UAAU,UAAU;YACpC,IAAI,SAAS,CAAC,MAAM,EAClB,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM;YAG/B,IAAI,6CAAgC,CAAC,SAAS,CAAC,MAAM,EACnD,QAAQ,IAAI,CAAC;QAEjB,OACE,QAAQ,IAAI,CAAC;IAEjB;IAEA,OAAO,CAAA,GAAA,WAAI,KAAK;AAClB","sources":["packages/@react-spectrum/utils/src/classNames.ts"],"sourcesContent":["/*\n * Copyright 2020 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 _clsx from 'clsx';\n\nexport let shouldKeepSpectrumClassNames = false;\n\nexport function keepSpectrumClassNames(): void {\n shouldKeepSpectrumClassNames = true;\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Legacy spectrum-prefixed class names enabled for backward compatibility. ' +\n 'We recommend replacing instances of CSS overrides targeting spectrum selectors ' +\n 'in your app with custom class names of your own, and disabling this flag.'\n );\n }\n}\n\nexport function classNames(cssModule: {[key: string]: string}, ...values: Array<string | Object | undefined>): string {\n let classes: Array<{} | undefined> = [];\n for (let value of values) {\n if (typeof value === 'object' && value) {\n let mapped = {};\n for (let key in value) {\n if (cssModule[key]) {\n mapped[cssModule[key]] = value[key];\n }\n\n if (shouldKeepSpectrumClassNames || !cssModule[key]) {\n mapped[key] = value[key];\n }\n }\n\n classes.push(mapped);\n } else if (typeof value === 'string') {\n if (cssModule[value]) {\n classes.push(cssModule[value]);\n }\n\n if (shouldKeepSpectrumClassNames || !cssModule[value]) {\n classes.push(value);\n }\n } else {\n classes.push(value);\n }\n }\n\n return _clsx(...classes);\n}\n"],"names":[],"version":3,"file":"classNames.module.js.map"}
@@ -438,9 +438,9 @@ function $d3b73be57066120b$export$b8e6fb9d2dff3f41(props, handlers = $d3b73be570
438
438
  ...styles
439
439
  };
440
440
  // @ts-ignore
441
- if (otherProps.className) console.warn("The className prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
441
+ if (otherProps.className && process.env.NODE_ENV !== 'production') console.warn("The className prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
442
442
  // @ts-ignore
443
- if (otherProps.style) console.warn("The style prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
443
+ if (otherProps.style && process.env.NODE_ENV !== 'production') console.warn("The style prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
444
444
  let styleProps = {
445
445
  style: style,
446
446
  className: UNSAFE_className
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAcM,MAAM,4CAAgC;IAC3C,QAAQ;QAAC;QAAU;KAAe;IAClC,aAAa;QAAC,0BAAI,cAAc;QAAgB;KAAe;IAC/D,WAAW;QAAC,0BAAI,eAAe;QAAe;KAAe;IAC7D,8CAA8C;IAC9C,gDAAgD;IAChD,WAAW;QAAC;QAAa;KAAe;IACxC,cAAc;QAAC;QAAgB;KAAe;IAC9C,SAAS;QAAC;YAAC;YAAc;SAAc;QAAE;KAAe;IACxD,SAAS;QAAC;YAAC;YAAa;SAAe;QAAE;KAAe;IACxD,OAAO;QAAC;QAAS;KAAe;IAChC,QAAQ;QAAC;QAAU;KAAe;IAClC,UAAU;QAAC;QAAY;KAAe;IACtC,WAAW;QAAC;QAAa;KAAe;IACxC,UAAU;QAAC;QAAY;KAAe;IACtC,WAAW;QAAC;QAAa;KAAe;IACxC,UAAU;QAAC;QAAW;KAAY;IAClC,WAAW;QAAC;QAAa;KAAiB;IAC1C,aAAa;QAAC;QAAe;KAAiB;IAC9C,UAAU;QAAC;QAAY;KAAS;IAChC,QAAQ;QAAC;QAAU;KAAS;IAC5B,KAAK;QAAC;QAAO;KAAe;IAC5B,QAAQ;QAAC;QAAU;KAAe;IAClC,OAAO;QAAC,0BAAI,QAAQ;QAAU;KAAe;IAC7C,KAAK;QAAC,0BAAI,SAAS;QA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IAAI,WAAW,SAAS,EACtB,QAAQ,IAAI,CACV;IAMJ,aAAa;IACb,IAAI,WAAW,KAAK,EAClB,QAAQ,IAAI,CACV;IAMJ,IAAI,aAA0C;eAC5C;QACA,WAAW;IACb;IAEA,IAAI,0CAAkB,MAAM,QAAQ,EAAE,qBACpC,WAAW,MAAM,GAAG;IAGtB,OAAO;oBACL;IACF;AACF;AAEO,SAAS,0CAAiB,KAAK;IACpC,OAAO;AACT;AAEO,SAAS,0CAAqB,IAAmB,EAAE,kBAAgC;IACxF,IAAI,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,OAAO,CAAC,OAAO;QAC5D,IAAK,IAAI,IAAI,GAAG,IAAI,mBAAmB,MAAM,EAAE,IAAK;YAClD,IAAI,aAAa,kBAAkB,CAAC,EAAE;YACtC,IAAI,IAAI,CAAC,WAAW,IAAI,MACtB,OAAO,IAAI,CAAC,WAAW;QAE3B;QACA,OAAO,AAAC,KAA2B,IAAI;IACzC;IACA,OAAO;AACT","sources":["packages/@react-spectrum/utils/src/styleProps.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {BackgroundColorValue, BorderColorValue, BorderRadiusValue, BorderSizeValue, ColorValue, ColorVersion, DimensionValue, Direction, Responsive, ResponsiveProp, StyleProps, ViewStyleProps} from '@react-types/shared';\nimport {CSSProperties, HTMLAttributes} from 'react';\nimport {useBreakpoint} from './BreakpointProvider';\nimport {useLocale} from '@react-aria/i18n';\n\ntype Breakpoint = 'base' | 'S' | 'M' | 'L' | string;\ntype StyleName = string | string[] | ((dir: Direction) => string);\ntype StyleHandler = (value: any, colorVersion?: number) => string | undefined;\nexport interface StyleHandlers {\n [key: string]: [StyleName, StyleHandler]\n}\n\nexport const baseStyleProps: StyleHandlers = {\n margin: ['margin', dimensionValue],\n marginStart: [rtl('marginLeft', 'marginRight'), dimensionValue],\n marginEnd: [rtl('marginRight', 'marginLeft'), dimensionValue],\n // marginLeft: ['marginLeft', dimensionValue],\n // marginRight: ['marginRight', dimensionValue],\n marginTop: ['marginTop', dimensionValue],\n marginBottom: ['marginBottom', dimensionValue],\n marginX: [['marginLeft', 'marginRight'], dimensionValue],\n marginY: [['marginTop', 'marginBottom'], dimensionValue],\n width: ['width', dimensionValue],\n height: ['height', dimensionValue],\n minWidth: ['minWidth', dimensionValue],\n minHeight: ['minHeight', dimensionValue],\n maxWidth: ['maxWidth', dimensionValue],\n maxHeight: ['maxHeight', dimensionValue],\n isHidden: ['display', hiddenValue],\n alignSelf: ['alignSelf', passthroughStyle],\n justifySelf: ['justifySelf', passthroughStyle],\n position: ['position', anyValue],\n zIndex: ['zIndex', anyValue],\n top: ['top', dimensionValue],\n bottom: ['bottom', dimensionValue],\n start: [rtl('left', 'right'), dimensionValue],\n end: [rtl('right', 'left'), dimensionValue],\n left: ['left', dimensionValue],\n right: ['right', dimensionValue],\n order: ['order', anyValue],\n flex: ['flex', flexValue],\n flexGrow: ['flexGrow', passthroughStyle],\n flexShrink: ['flexShrink', passthroughStyle],\n flexBasis: ['flexBasis', passthroughStyle],\n gridArea: ['gridArea', passthroughStyle],\n gridColumn: ['gridColumn', passthroughStyle],\n gridColumnEnd: ['gridColumnEnd', passthroughStyle],\n gridColumnStart: ['gridColumnStart', passthroughStyle],\n gridRow: ['gridRow', passthroughStyle],\n gridRowEnd: ['gridRowEnd', passthroughStyle],\n gridRowStart: ['gridRowStart', passthroughStyle]\n};\n\nexport const viewStyleProps: StyleHandlers = {\n ...baseStyleProps,\n backgroundColor: ['backgroundColor', backgroundColorValue],\n borderWidth: ['borderWidth', borderSizeValue],\n borderStartWidth: [rtl('borderLeftWidth', 'borderRightWidth'), borderSizeValue],\n borderEndWidth: [rtl('borderRightWidth', 'borderLeftWidth'), borderSizeValue],\n borderLeftWidth: ['borderLeftWidth', borderSizeValue],\n borderRightWidth: ['borderRightWidth', borderSizeValue],\n borderTopWidth: ['borderTopWidth', borderSizeValue],\n borderBottomWidth: ['borderBottomWidth', borderSizeValue],\n borderXWidth: [['borderLeftWidth', 'borderRightWidth'], borderSizeValue],\n borderYWidth: [['borderTopWidth', 'borderBottomWidth'], borderSizeValue],\n borderColor: ['borderColor', borderColorValue],\n borderStartColor: [rtl('borderLeftColor', 'borderRightColor'), borderColorValue],\n borderEndColor: [rtl('borderRightColor', 'borderLeftColor'), borderColorValue],\n borderLeftColor: ['borderLeftColor', borderColorValue],\n borderRightColor: ['borderRightColor', borderColorValue],\n borderTopColor: ['borderTopColor', borderColorValue],\n borderBottomColor: ['borderBottomColor', borderColorValue],\n borderXColor: [['borderLeftColor', 'borderRightColor'], borderColorValue],\n borderYColor: [['borderTopColor', 'borderBottomColor'], borderColorValue],\n borderRadius: ['borderRadius', borderRadiusValue],\n borderTopStartRadius: [rtl('borderTopLeftRadius', 'borderTopRightRadius'), borderRadiusValue],\n borderTopEndRadius: [rtl('borderTopRightRadius', 'borderTopLeftRadius'), borderRadiusValue],\n borderBottomStartRadius: [rtl('borderBottomLeftRadius', 'borderBottomRightRadius'), borderRadiusValue],\n borderBottomEndRadius: [rtl('borderBottomRightRadius', 'borderBottomLeftRadius'), borderRadiusValue],\n borderTopLeftRadius: ['borderTopLeftRadius', borderRadiusValue],\n borderTopRightRadius: ['borderTopRightRadius', borderRadiusValue],\n borderBottomLeftRadius: ['borderBottomLeftRadius', borderRadiusValue],\n borderBottomRightRadius: ['borderBottomRightRadius', borderRadiusValue],\n padding: ['padding', dimensionValue],\n paddingStart: [rtl('paddingLeft', 'paddingRight'), dimensionValue],\n paddingEnd: [rtl('paddingRight', 'paddingLeft'), dimensionValue],\n paddingLeft: ['paddingLeft', dimensionValue],\n paddingRight: ['paddingRight', dimensionValue],\n paddingTop: ['paddingTop', dimensionValue],\n paddingBottom: ['paddingBottom', dimensionValue],\n paddingX: [['paddingLeft', 'paddingRight'], dimensionValue],\n paddingY: [['paddingTop', 'paddingBottom'], dimensionValue],\n overflow: ['overflow', passthroughStyle]\n};\n\nconst borderStyleProps = {\n borderWidth: 'borderStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n borderTopWidth: 'borderTopStyle',\n borderBottomWidth: 'borderBottomStyle'\n};\n\nfunction rtl(ltr: string, rtl: string) {\n return (direction: Direction) => (\n direction === 'rtl' ? rtl : ltr\n );\n}\n\nconst UNIT_RE = /(%|px|em|rem|vw|vh|auto|cm|mm|in|pt|pc|ex|ch|rem|vmin|vmax|fr)$/;\nconst FUNC_RE = /^\\s*\\w+\\(/;\nconst SPECTRUM_VARIABLE_RE = /(static-)?size-\\d+|single-line-(height|width)/g;\n\nexport function dimensionValue(value: DimensionValue) {\n if (typeof value === 'number') {\n return value + 'px';\n }\n\n if (!value) {\n return undefined;\n }\n\n if (UNIT_RE.test(value)) {\n return value;\n }\n\n if (FUNC_RE.test(value)) {\n return value.replace(SPECTRUM_VARIABLE_RE, 'var(--spectrum-global-dimension-$&, var(--spectrum-alias-$&))');\n }\n\n return `var(--spectrum-global-dimension-${value}, var(--spectrum-alias-${value}))`;\n}\n\nexport function responsiveDimensionValue(value: Responsive<DimensionValue>, matchedBreakpoints: Breakpoint[]) {\n let responsiveValue = getResponsiveProp(value, matchedBreakpoints);\n if (responsiveValue != null) {\n return dimensionValue(responsiveValue);\n }\n}\n\ntype ColorType = 'default' | 'background' | 'border' | 'icon' | 'status';\nfunction colorValue(value: ColorValue, type: ColorType = 'default', version = 5) {\n if (version > 5) {\n return `var(--spectrum-${value}, var(--spectrum-semantic-${value}-color-${type}))`;\n }\n\n return `var(--spectrum-legacy-color-${value}, var(--spectrum-global-color-${value}, var(--spectrum-semantic-${value}-color-${type})))`;\n}\n\nfunction backgroundColorValue(value: BackgroundColorValue, version = 5) {\n if (!value) {\n return undefined;\n }\n\n return `var(--spectrum-alias-background-color-${value}, ${colorValue(value as ColorValue, 'background', version)})`;\n}\n\nfunction borderColorValue(value: BorderColorValue, version = 5) {\n if (!value) {\n return undefined;\n }\n\n if (value === 'default') {\n return 'var(--spectrum-alias-border-color)';\n }\n\n return `var(--spectrum-alias-border-color-${value}, ${colorValue(value as ColorValue, 'border', version)})`;\n}\n\nfunction borderSizeValue(value?: BorderSizeValue | null) {\n return value && value !== 'none'\n ? `var(--spectrum-alias-border-size-${value})`\n : '0';\n}\n\nfunction borderRadiusValue(value: BorderRadiusValue) {\n if (!value) {\n return undefined;\n }\n\n return `var(--spectrum-alias-border-radius-${value})`;\n}\n\nfunction hiddenValue(value: boolean) {\n return value ? 'none' : undefined;\n}\n\nfunction anyValue(value: any) {\n return value;\n}\n\nfunction flexValue(value: boolean | number | string) {\n if (typeof value === 'boolean') {\n return value ? '1' : undefined;\n }\n\n return '' + value;\n}\n\nexport function convertStyleProps<C extends ColorVersion>(props: ViewStyleProps<C>, handlers: StyleHandlers, direction: Direction, matchedBreakpoints: Breakpoint[]) {\n let style: CSSProperties = {};\n for (let key in props) {\n let styleProp = handlers[key];\n if (!styleProp || props[key] == null) {\n continue;\n }\n\n let [name, convert] = styleProp;\n if (typeof name === 'function') {\n name = name(direction);\n }\n\n let prop = getResponsiveProp(props[key], matchedBreakpoints);\n let value = convert(prop, props.colorVersion);\n if (Array.isArray(name)) {\n for (let k of name) {\n style[k] = value;\n }\n } else {\n style[name] = value;\n }\n }\n\n for (let prop in borderStyleProps) {\n if (style[prop]) {\n style[borderStyleProps[prop]] = 'solid';\n style.boxSizing = 'border-box';\n }\n }\n\n return style;\n}\n\ntype StylePropsOptions = {\n matchedBreakpoints?: Breakpoint[]\n};\n\nexport function useStyleProps<T extends StyleProps>(\n props: T,\n handlers: StyleHandlers = baseStyleProps,\n options: StylePropsOptions = {}\n) {\n let {\n UNSAFE_className,\n UNSAFE_style,\n ...otherProps\n } = props;\n let breakpointProvider = useBreakpoint();\n let {direction} = useLocale();\n let {\n matchedBreakpoints = breakpointProvider?.matchedBreakpoints || ['base']\n } = options;\n let styles = convertStyleProps(props, handlers, direction, matchedBreakpoints);\n let style = {...UNSAFE_style, ...styles};\n\n // @ts-ignore\n if (otherProps.className) {\n console.warn(\n 'The className prop is unsafe and is unsupported in React Spectrum v3. ' +\n 'Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. ' +\n 'Note that this may break in future versions due to DOM structure changes.'\n );\n }\n\n // @ts-ignore\n if (otherProps.style) {\n console.warn(\n 'The style prop is unsafe and is unsupported in React Spectrum v3. ' +\n 'Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. ' +\n 'Note that this may break in future versions due to DOM structure changes.'\n );\n }\n\n let styleProps: HTMLAttributes<HTMLElement> = {\n style,\n className: UNSAFE_className\n };\n\n if (getResponsiveProp(props.isHidden, matchedBreakpoints)) {\n styleProps.hidden = true;\n }\n\n return {\n styleProps\n };\n}\n\nexport function passthroughStyle(value) {\n return value;\n}\n\nexport function getResponsiveProp<T>(prop: Responsive<T>, matchedBreakpoints: Breakpoint[]): T | undefined {\n if (prop && typeof prop === 'object' && !Array.isArray(prop)) {\n for (let i = 0; i < matchedBreakpoints.length; i++) {\n let breakpoint = matchedBreakpoints[i];\n if (prop[breakpoint] != null) {\n return prop[breakpoint];\n }\n }\n return (prop as ResponsiveProp<T>).base;\n }\n return prop as T;\n}\n"],"names":[],"version":3,"file":"styleProps.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAcM,MAAM,4CAAgC;IAC3C,QAAQ;QAAC;QAAU;KAAe;IAClC,aAAa;QAAC,0BAAI,cAAc;QAAgB;KAAe;IAC/D,WAAW;QAAC,0BAAI,eAAe;QAAe;KAAe;IAC7D,8CAA8C;IAC9C,gDAAgD;IAChD,WAAW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AW,IAAI,MACtB,OAAO,IAAI,CAAC,WAAW;QAE3B;QACA,OAAO,AAAC,KAA2B,IAAI;IACzC;IACA,OAAO;AACT","sources":["packages/@react-spectrum/utils/src/styleProps.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {BackgroundColorValue, BorderColorValue, BorderRadiusValue, BorderSizeValue, ColorValue, ColorVersion, DimensionValue, Direction, Responsive, ResponsiveProp, StyleProps, ViewStyleProps} from '@react-types/shared';\nimport {CSSProperties, HTMLAttributes} from 'react';\nimport {useBreakpoint} from './BreakpointProvider';\nimport {useLocale} from '@react-aria/i18n';\n\ntype Breakpoint = 'base' | 'S' | 'M' | 'L' | string;\ntype StyleName = string | string[] | ((dir: Direction) => string);\ntype StyleHandler = (value: any, colorVersion?: number) => string | undefined;\nexport interface StyleHandlers {\n [key: string]: [StyleName, StyleHandler]\n}\n\nexport const baseStyleProps: StyleHandlers = {\n margin: ['margin', dimensionValue],\n marginStart: [rtl('marginLeft', 'marginRight'), dimensionValue],\n marginEnd: [rtl('marginRight', 'marginLeft'), dimensionValue],\n // marginLeft: ['marginLeft', dimensionValue],\n // marginRight: ['marginRight', dimensionValue],\n marginTop: ['marginTop', dimensionValue],\n marginBottom: ['marginBottom', dimensionValue],\n marginX: [['marginLeft', 'marginRight'], dimensionValue],\n marginY: [['marginTop', 'marginBottom'], dimensionValue],\n width: ['width', dimensionValue],\n height: ['height', dimensionValue],\n minWidth: ['minWidth', dimensionValue],\n minHeight: ['minHeight', dimensionValue],\n maxWidth: ['maxWidth', dimensionValue],\n maxHeight: ['maxHeight', dimensionValue],\n isHidden: ['display', hiddenValue],\n alignSelf: ['alignSelf', passthroughStyle],\n justifySelf: ['justifySelf', passthroughStyle],\n position: ['position', anyValue],\n zIndex: ['zIndex', anyValue],\n top: ['top', dimensionValue],\n bottom: ['bottom', dimensionValue],\n start: [rtl('left', 'right'), dimensionValue],\n end: [rtl('right', 'left'), dimensionValue],\n left: ['left', dimensionValue],\n right: ['right', dimensionValue],\n order: ['order', anyValue],\n flex: ['flex', flexValue],\n flexGrow: ['flexGrow', passthroughStyle],\n flexShrink: ['flexShrink', passthroughStyle],\n flexBasis: ['flexBasis', passthroughStyle],\n gridArea: ['gridArea', passthroughStyle],\n gridColumn: ['gridColumn', passthroughStyle],\n gridColumnEnd: ['gridColumnEnd', passthroughStyle],\n gridColumnStart: ['gridColumnStart', passthroughStyle],\n gridRow: ['gridRow', passthroughStyle],\n gridRowEnd: ['gridRowEnd', passthroughStyle],\n gridRowStart: ['gridRowStart', passthroughStyle]\n};\n\nexport const viewStyleProps: StyleHandlers = {\n ...baseStyleProps,\n backgroundColor: ['backgroundColor', backgroundColorValue],\n borderWidth: ['borderWidth', borderSizeValue],\n borderStartWidth: [rtl('borderLeftWidth', 'borderRightWidth'), borderSizeValue],\n borderEndWidth: [rtl('borderRightWidth', 'borderLeftWidth'), borderSizeValue],\n borderLeftWidth: ['borderLeftWidth', borderSizeValue],\n borderRightWidth: ['borderRightWidth', borderSizeValue],\n borderTopWidth: ['borderTopWidth', borderSizeValue],\n borderBottomWidth: ['borderBottomWidth', borderSizeValue],\n borderXWidth: [['borderLeftWidth', 'borderRightWidth'], borderSizeValue],\n borderYWidth: [['borderTopWidth', 'borderBottomWidth'], borderSizeValue],\n borderColor: ['borderColor', borderColorValue],\n borderStartColor: [rtl('borderLeftColor', 'borderRightColor'), borderColorValue],\n borderEndColor: [rtl('borderRightColor', 'borderLeftColor'), borderColorValue],\n borderLeftColor: ['borderLeftColor', borderColorValue],\n borderRightColor: ['borderRightColor', borderColorValue],\n borderTopColor: ['borderTopColor', borderColorValue],\n borderBottomColor: ['borderBottomColor', borderColorValue],\n borderXColor: [['borderLeftColor', 'borderRightColor'], borderColorValue],\n borderYColor: [['borderTopColor', 'borderBottomColor'], borderColorValue],\n borderRadius: ['borderRadius', borderRadiusValue],\n borderTopStartRadius: [rtl('borderTopLeftRadius', 'borderTopRightRadius'), borderRadiusValue],\n borderTopEndRadius: [rtl('borderTopRightRadius', 'borderTopLeftRadius'), borderRadiusValue],\n borderBottomStartRadius: [rtl('borderBottomLeftRadius', 'borderBottomRightRadius'), borderRadiusValue],\n borderBottomEndRadius: [rtl('borderBottomRightRadius', 'borderBottomLeftRadius'), borderRadiusValue],\n borderTopLeftRadius: ['borderTopLeftRadius', borderRadiusValue],\n borderTopRightRadius: ['borderTopRightRadius', borderRadiusValue],\n borderBottomLeftRadius: ['borderBottomLeftRadius', borderRadiusValue],\n borderBottomRightRadius: ['borderBottomRightRadius', borderRadiusValue],\n padding: ['padding', dimensionValue],\n paddingStart: [rtl('paddingLeft', 'paddingRight'), dimensionValue],\n paddingEnd: [rtl('paddingRight', 'paddingLeft'), dimensionValue],\n paddingLeft: ['paddingLeft', dimensionValue],\n paddingRight: ['paddingRight', dimensionValue],\n paddingTop: ['paddingTop', dimensionValue],\n paddingBottom: ['paddingBottom', dimensionValue],\n paddingX: [['paddingLeft', 'paddingRight'], dimensionValue],\n paddingY: [['paddingTop', 'paddingBottom'], dimensionValue],\n overflow: ['overflow', passthroughStyle]\n};\n\nconst borderStyleProps = {\n borderWidth: 'borderStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n borderTopWidth: 'borderTopStyle',\n borderBottomWidth: 'borderBottomStyle'\n};\n\nfunction rtl(ltr: string, rtl: string) {\n return (direction: Direction) => (\n direction === 'rtl' ? rtl : ltr\n );\n}\n\nconst UNIT_RE = /(%|px|em|rem|vw|vh|auto|cm|mm|in|pt|pc|ex|ch|rem|vmin|vmax|fr)$/;\nconst FUNC_RE = /^\\s*\\w+\\(/;\nconst SPECTRUM_VARIABLE_RE = /(static-)?size-\\d+|single-line-(height|width)/g;\n\nexport function dimensionValue(value: DimensionValue): string | undefined {\n if (typeof value === 'number') {\n return value + 'px';\n }\n\n if (!value) {\n return undefined;\n }\n\n if (UNIT_RE.test(value)) {\n return value;\n }\n\n if (FUNC_RE.test(value)) {\n return value.replace(SPECTRUM_VARIABLE_RE, 'var(--spectrum-global-dimension-$&, var(--spectrum-alias-$&))');\n }\n\n return `var(--spectrum-global-dimension-${value}, var(--spectrum-alias-${value}))`;\n}\n\nexport function responsiveDimensionValue(value: Responsive<DimensionValue>, matchedBreakpoints: Breakpoint[]): string | undefined {\n let responsiveValue = getResponsiveProp(value, matchedBreakpoints);\n if (responsiveValue != null) {\n return dimensionValue(responsiveValue);\n }\n}\n\ntype ColorType = 'default' | 'background' | 'border' | 'icon' | 'status';\nfunction colorValue(value: ColorValue, type: ColorType = 'default', version = 5) {\n if (version > 5) {\n return `var(--spectrum-${value}, var(--spectrum-semantic-${value}-color-${type}))`;\n }\n\n return `var(--spectrum-legacy-color-${value}, var(--spectrum-global-color-${value}, var(--spectrum-semantic-${value}-color-${type})))`;\n}\n\nfunction backgroundColorValue(value: BackgroundColorValue, version = 5): string | undefined {\n if (!value) {\n return undefined;\n }\n\n return `var(--spectrum-alias-background-color-${value}, ${colorValue(value as ColorValue, 'background', version)})`;\n}\n\nfunction borderColorValue(value: BorderColorValue, version = 5): string | undefined {\n if (!value) {\n return undefined;\n }\n\n if (value === 'default') {\n return 'var(--spectrum-alias-border-color)';\n }\n\n return `var(--spectrum-alias-border-color-${value}, ${colorValue(value as ColorValue, 'border', version)})`;\n}\n\nfunction borderSizeValue(value?: BorderSizeValue | null): string {\n return value && value !== 'none'\n ? `var(--spectrum-alias-border-size-${value})`\n : '0';\n}\n\nfunction borderRadiusValue(value: BorderRadiusValue): string | undefined {\n if (!value) {\n return undefined;\n }\n\n return `var(--spectrum-alias-border-radius-${value})`;\n}\n\nfunction hiddenValue(value: boolean): string | undefined {\n return value ? 'none' : undefined;\n}\n\nfunction anyValue<T>(value: T): T {\n return value;\n}\n\nfunction flexValue(value: boolean | number | string): string | undefined {\n if (typeof value === 'boolean') {\n return value ? '1' : undefined;\n }\n\n return '' + value;\n}\n\nexport function convertStyleProps<C extends ColorVersion>(props: ViewStyleProps<C>, handlers: StyleHandlers, direction: Direction, matchedBreakpoints: Breakpoint[]): CSSProperties {\n let style: CSSProperties = {};\n for (let key in props) {\n let styleProp = handlers[key];\n if (!styleProp || props[key] == null) {\n continue;\n }\n\n let [name, convert] = styleProp;\n if (typeof name === 'function') {\n name = name(direction);\n }\n\n let prop = getResponsiveProp(props[key], matchedBreakpoints);\n let value = convert(prop, props.colorVersion);\n if (Array.isArray(name)) {\n for (let k of name) {\n style[k] = value;\n }\n } else {\n style[name] = value;\n }\n }\n\n for (let prop in borderStyleProps) {\n if (style[prop]) {\n style[borderStyleProps[prop]] = 'solid';\n style.boxSizing = 'border-box';\n }\n }\n\n return style;\n}\n\ntype StylePropsOptions = {\n matchedBreakpoints?: Breakpoint[]\n};\n\nexport function useStyleProps<T extends StyleProps>(\n props: T,\n handlers: StyleHandlers = baseStyleProps,\n options: StylePropsOptions = {}\n): {styleProps: HTMLAttributes<HTMLElement>} {\n let {\n UNSAFE_className,\n UNSAFE_style,\n ...otherProps\n } = props;\n let breakpointProvider = useBreakpoint();\n let {direction} = useLocale();\n let {\n matchedBreakpoints = breakpointProvider?.matchedBreakpoints || ['base']\n } = options;\n let styles = convertStyleProps(props, handlers, direction, matchedBreakpoints);\n let style = {...UNSAFE_style, ...styles};\n\n // @ts-ignore\n if (otherProps.className && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'The className prop is unsafe and is unsupported in React Spectrum v3. ' +\n 'Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. ' +\n 'Note that this may break in future versions due to DOM structure changes.'\n );\n }\n\n // @ts-ignore\n if (otherProps.style && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'The style prop is unsafe and is unsupported in React Spectrum v3. ' +\n 'Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. ' +\n 'Note that this may break in future versions due to DOM structure changes.'\n );\n }\n\n let styleProps: HTMLAttributes<HTMLElement> = {\n style,\n className: UNSAFE_className\n };\n\n if (getResponsiveProp(props.isHidden, matchedBreakpoints)) {\n styleProps.hidden = true;\n }\n\n return {\n styleProps\n };\n}\n\nexport function passthroughStyle<T>(value: T): T {\n return value;\n}\n\nexport function getResponsiveProp<T>(prop: Responsive<T>, matchedBreakpoints: Breakpoint[]): T | undefined {\n if (prop && typeof prop === 'object' && !Array.isArray(prop)) {\n for (let i = 0; i < matchedBreakpoints.length; i++) {\n let breakpoint = matchedBreakpoints[i];\n if (prop[breakpoint] != null) {\n return prop[breakpoint];\n }\n }\n return (prop as ResponsiveProp<T>).base;\n }\n return prop as T;\n}\n"],"names":[],"version":3,"file":"styleProps.main.js.map"}
@@ -425,9 +425,9 @@ function $380ed8f3903c3931$export$b8e6fb9d2dff3f41(props, handlers = $380ed8f390
425
425
  ...styles
426
426
  };
427
427
  // @ts-ignore
428
- if (otherProps.className) console.warn("The className prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
428
+ if (otherProps.className && process.env.NODE_ENV !== 'production') console.warn("The className prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
429
429
  // @ts-ignore
430
- if (otherProps.style) console.warn("The style prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
430
+ if (otherProps.style && process.env.NODE_ENV !== 'production') console.warn("The style prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
431
431
  let styleProps = {
432
432
  style: style,
433
433
  className: UNSAFE_className
@@ -425,9 +425,9 @@ function $380ed8f3903c3931$export$b8e6fb9d2dff3f41(props, handlers = $380ed8f390
425
425
  ...styles
426
426
  };
427
427
  // @ts-ignore
428
- if (otherProps.className) console.warn("The className prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
428
+ if (otherProps.className && process.env.NODE_ENV !== 'production') console.warn("The className prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
429
429
  // @ts-ignore
430
- if (otherProps.style) console.warn("The style prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
430
+ if (otherProps.style && process.env.NODE_ENV !== 'production') console.warn("The style prop is unsafe and is unsupported in React Spectrum v3. Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. Note that this may break in future versions due to DOM structure changes.");
431
431
  let styleProps = {
432
432
  style: style,
433
433
  className: UNSAFE_className
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAcM,MAAM,4CAAgC;IAC3C,QAAQ;QAAC;QAAU;KAAe;IAClC,aAAa;QAAC,0BAAI,cAAc;QAAgB;KAAe;IAC/D,WAAW;QAAC,0BAAI,eAAe;QAAe;KAAe;IAC7D,8CAA8C;IAC9C,gDAAgD;IAChD,WAAW;QAAC;QAAa;KAAe;IACxC,cAAc;QAAC;QAAgB;KAAe;IAC9C,SAAS;QAAC;YAAC;YAAc;SAAc;QAAE;KAAe;IACxD,SAAS;QAAC;YAAC;YAAa;SAAe;QAAE;KAAe;IACxD,OAAO;QAAC;QAAS;KAAe;IAChC,QAAQ;QAAC;QAAU;KAAe;IAClC,UAAU;QAAC;QAAY;KAAe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AC,CAAC;IAE/B,IAAI,oBACF,gBAAgB,gBAChB,YAAY,EACZ,GAAG,YACJ,GAAG;IACJ,IAAI,qBAAqB,CAAA,GAAA,yCAAY;IACrC,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,sBACF,qBAAqB,CAAA,+BAAA,yCAAA,mBAAoB,kBAAkB,KAAI;QAAC;KAAO,EACxE,GAAG;IACJ,IAAI,SAAS,0CAAkB,OAAO,UAAU,WAAW;IAC3D,IAAI,QAAQ;QAAC,GAAG,YAAY;QAAE,GAAG,MAAM;IAAA;IAEvC,aAAa;IACb,IAAI,WAAW,SAAS,EACtB,QAAQ,IAAI,CACV;IAMJ,aAAa;IACb,IAAI,WAAW,KAAK,EAClB,QAAQ,IAAI,CACV;IAMJ,IAAI,aAA0C;eAC5C;QACA,WAAW;IACb;IAEA,IAAI,0CAAkB,MAAM,QAAQ,EAAE,qBACpC,WAAW,MAAM,GAAG;IAGtB,OAAO;oBACL;IACF;AACF;AAEO,SAAS,0CAAiB,KAAK;IACpC,OAAO;AACT;AAEO,SAAS,0CAAqB,IAAmB,EAAE,kBAAgC;IACxF,IAAI,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,OAAO,CAAC,OAAO;QAC5D,IAAK,IAAI,IAAI,GAAG,IAAI,mBAAmB,MAAM,EAAE,IAAK;YAClD,IAAI,aAAa,kBAAkB,CAAC,EAAE;YACtC,IAAI,IAAI,CAAC,WAAW,IAAI,MACtB,OAAO,IAAI,CAAC,WAAW;QAE3B;QACA,OAAO,AAAC,KAA2B,IAAI;IACzC;IACA,OAAO;AACT","sources":["packages/@react-spectrum/utils/src/styleProps.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {BackgroundColorValue, BorderColorValue, BorderRadiusValue, BorderSizeValue, ColorValue, ColorVersion, DimensionValue, Direction, Responsive, ResponsiveProp, StyleProps, ViewStyleProps} from '@react-types/shared';\nimport {CSSProperties, HTMLAttributes} from 'react';\nimport {useBreakpoint} from './BreakpointProvider';\nimport {useLocale} from '@react-aria/i18n';\n\ntype Breakpoint = 'base' | 'S' | 'M' | 'L' | string;\ntype StyleName = string | string[] | ((dir: Direction) => string);\ntype StyleHandler = (value: any, colorVersion?: number) => string | undefined;\nexport interface StyleHandlers {\n [key: string]: [StyleName, StyleHandler]\n}\n\nexport const baseStyleProps: StyleHandlers = {\n margin: ['margin', dimensionValue],\n marginStart: [rtl('marginLeft', 'marginRight'), dimensionValue],\n marginEnd: [rtl('marginRight', 'marginLeft'), dimensionValue],\n // marginLeft: ['marginLeft', dimensionValue],\n // marginRight: ['marginRight', dimensionValue],\n marginTop: ['marginTop', dimensionValue],\n marginBottom: ['marginBottom', dimensionValue],\n marginX: [['marginLeft', 'marginRight'], dimensionValue],\n marginY: [['marginTop', 'marginBottom'], dimensionValue],\n width: ['width', dimensionValue],\n height: ['height', dimensionValue],\n minWidth: ['minWidth', dimensionValue],\n minHeight: ['minHeight', dimensionValue],\n maxWidth: ['maxWidth', dimensionValue],\n maxHeight: ['maxHeight', dimensionValue],\n isHidden: ['display', hiddenValue],\n alignSelf: ['alignSelf', passthroughStyle],\n justifySelf: ['justifySelf', passthroughStyle],\n position: ['position', anyValue],\n zIndex: ['zIndex', anyValue],\n top: ['top', dimensionValue],\n bottom: ['bottom', dimensionValue],\n start: [rtl('left', 'right'), dimensionValue],\n end: [rtl('right', 'left'), dimensionValue],\n left: ['left', dimensionValue],\n right: ['right', dimensionValue],\n order: ['order', anyValue],\n flex: ['flex', flexValue],\n flexGrow: ['flexGrow', passthroughStyle],\n flexShrink: ['flexShrink', passthroughStyle],\n flexBasis: ['flexBasis', passthroughStyle],\n gridArea: ['gridArea', passthroughStyle],\n gridColumn: ['gridColumn', passthroughStyle],\n gridColumnEnd: ['gridColumnEnd', passthroughStyle],\n gridColumnStart: ['gridColumnStart', passthroughStyle],\n gridRow: ['gridRow', passthroughStyle],\n gridRowEnd: ['gridRowEnd', passthroughStyle],\n gridRowStart: ['gridRowStart', passthroughStyle]\n};\n\nexport const viewStyleProps: StyleHandlers = {\n ...baseStyleProps,\n backgroundColor: ['backgroundColor', backgroundColorValue],\n borderWidth: ['borderWidth', borderSizeValue],\n borderStartWidth: [rtl('borderLeftWidth', 'borderRightWidth'), borderSizeValue],\n borderEndWidth: [rtl('borderRightWidth', 'borderLeftWidth'), borderSizeValue],\n borderLeftWidth: ['borderLeftWidth', borderSizeValue],\n borderRightWidth: ['borderRightWidth', borderSizeValue],\n borderTopWidth: ['borderTopWidth', borderSizeValue],\n borderBottomWidth: ['borderBottomWidth', borderSizeValue],\n borderXWidth: [['borderLeftWidth', 'borderRightWidth'], borderSizeValue],\n borderYWidth: [['borderTopWidth', 'borderBottomWidth'], borderSizeValue],\n borderColor: ['borderColor', borderColorValue],\n borderStartColor: [rtl('borderLeftColor', 'borderRightColor'), borderColorValue],\n borderEndColor: [rtl('borderRightColor', 'borderLeftColor'), borderColorValue],\n borderLeftColor: ['borderLeftColor', borderColorValue],\n borderRightColor: ['borderRightColor', borderColorValue],\n borderTopColor: ['borderTopColor', borderColorValue],\n borderBottomColor: ['borderBottomColor', borderColorValue],\n borderXColor: [['borderLeftColor', 'borderRightColor'], borderColorValue],\n borderYColor: [['borderTopColor', 'borderBottomColor'], borderColorValue],\n borderRadius: ['borderRadius', borderRadiusValue],\n borderTopStartRadius: [rtl('borderTopLeftRadius', 'borderTopRightRadius'), borderRadiusValue],\n borderTopEndRadius: [rtl('borderTopRightRadius', 'borderTopLeftRadius'), borderRadiusValue],\n borderBottomStartRadius: [rtl('borderBottomLeftRadius', 'borderBottomRightRadius'), borderRadiusValue],\n borderBottomEndRadius: [rtl('borderBottomRightRadius', 'borderBottomLeftRadius'), borderRadiusValue],\n borderTopLeftRadius: ['borderTopLeftRadius', borderRadiusValue],\n borderTopRightRadius: ['borderTopRightRadius', borderRadiusValue],\n borderBottomLeftRadius: ['borderBottomLeftRadius', borderRadiusValue],\n borderBottomRightRadius: ['borderBottomRightRadius', borderRadiusValue],\n padding: ['padding', dimensionValue],\n paddingStart: [rtl('paddingLeft', 'paddingRight'), dimensionValue],\n paddingEnd: [rtl('paddingRight', 'paddingLeft'), dimensionValue],\n paddingLeft: ['paddingLeft', dimensionValue],\n paddingRight: ['paddingRight', dimensionValue],\n paddingTop: ['paddingTop', dimensionValue],\n paddingBottom: ['paddingBottom', dimensionValue],\n paddingX: [['paddingLeft', 'paddingRight'], dimensionValue],\n paddingY: [['paddingTop', 'paddingBottom'], dimensionValue],\n overflow: ['overflow', passthroughStyle]\n};\n\nconst borderStyleProps = {\n borderWidth: 'borderStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n borderTopWidth: 'borderTopStyle',\n borderBottomWidth: 'borderBottomStyle'\n};\n\nfunction rtl(ltr: string, rtl: string) {\n return (direction: Direction) => (\n direction === 'rtl' ? rtl : ltr\n );\n}\n\nconst UNIT_RE = /(%|px|em|rem|vw|vh|auto|cm|mm|in|pt|pc|ex|ch|rem|vmin|vmax|fr)$/;\nconst FUNC_RE = /^\\s*\\w+\\(/;\nconst SPECTRUM_VARIABLE_RE = /(static-)?size-\\d+|single-line-(height|width)/g;\n\nexport function dimensionValue(value: DimensionValue) {\n if (typeof value === 'number') {\n return value + 'px';\n }\n\n if (!value) {\n return undefined;\n }\n\n if (UNIT_RE.test(value)) {\n return value;\n }\n\n if (FUNC_RE.test(value)) {\n return value.replace(SPECTRUM_VARIABLE_RE, 'var(--spectrum-global-dimension-$&, var(--spectrum-alias-$&))');\n }\n\n return `var(--spectrum-global-dimension-${value}, var(--spectrum-alias-${value}))`;\n}\n\nexport function responsiveDimensionValue(value: Responsive<DimensionValue>, matchedBreakpoints: Breakpoint[]) {\n let responsiveValue = getResponsiveProp(value, matchedBreakpoints);\n if (responsiveValue != null) {\n return dimensionValue(responsiveValue);\n }\n}\n\ntype ColorType = 'default' | 'background' | 'border' | 'icon' | 'status';\nfunction colorValue(value: ColorValue, type: ColorType = 'default', version = 5) {\n if (version > 5) {\n return `var(--spectrum-${value}, var(--spectrum-semantic-${value}-color-${type}))`;\n }\n\n return `var(--spectrum-legacy-color-${value}, var(--spectrum-global-color-${value}, var(--spectrum-semantic-${value}-color-${type})))`;\n}\n\nfunction backgroundColorValue(value: BackgroundColorValue, version = 5) {\n if (!value) {\n return undefined;\n }\n\n return `var(--spectrum-alias-background-color-${value}, ${colorValue(value as ColorValue, 'background', version)})`;\n}\n\nfunction borderColorValue(value: BorderColorValue, version = 5) {\n if (!value) {\n return undefined;\n }\n\n if (value === 'default') {\n return 'var(--spectrum-alias-border-color)';\n }\n\n return `var(--spectrum-alias-border-color-${value}, ${colorValue(value as ColorValue, 'border', version)})`;\n}\n\nfunction borderSizeValue(value?: BorderSizeValue | null) {\n return value && value !== 'none'\n ? `var(--spectrum-alias-border-size-${value})`\n : '0';\n}\n\nfunction borderRadiusValue(value: BorderRadiusValue) {\n if (!value) {\n return undefined;\n }\n\n return `var(--spectrum-alias-border-radius-${value})`;\n}\n\nfunction hiddenValue(value: boolean) {\n return value ? 'none' : undefined;\n}\n\nfunction anyValue(value: any) {\n return value;\n}\n\nfunction flexValue(value: boolean | number | string) {\n if (typeof value === 'boolean') {\n return value ? '1' : undefined;\n }\n\n return '' + value;\n}\n\nexport function convertStyleProps<C extends ColorVersion>(props: ViewStyleProps<C>, handlers: StyleHandlers, direction: Direction, matchedBreakpoints: Breakpoint[]) {\n let style: CSSProperties = {};\n for (let key in props) {\n let styleProp = handlers[key];\n if (!styleProp || props[key] == null) {\n continue;\n }\n\n let [name, convert] = styleProp;\n if (typeof name === 'function') {\n name = name(direction);\n }\n\n let prop = getResponsiveProp(props[key], matchedBreakpoints);\n let value = convert(prop, props.colorVersion);\n if (Array.isArray(name)) {\n for (let k of name) {\n style[k] = value;\n }\n } else {\n style[name] = value;\n }\n }\n\n for (let prop in borderStyleProps) {\n if (style[prop]) {\n style[borderStyleProps[prop]] = 'solid';\n style.boxSizing = 'border-box';\n }\n }\n\n return style;\n}\n\ntype StylePropsOptions = {\n matchedBreakpoints?: Breakpoint[]\n};\n\nexport function useStyleProps<T extends StyleProps>(\n props: T,\n handlers: StyleHandlers = baseStyleProps,\n options: StylePropsOptions = {}\n) {\n let {\n UNSAFE_className,\n UNSAFE_style,\n ...otherProps\n } = props;\n let breakpointProvider = useBreakpoint();\n let {direction} = useLocale();\n let {\n matchedBreakpoints = breakpointProvider?.matchedBreakpoints || ['base']\n } = options;\n let styles = convertStyleProps(props, handlers, direction, matchedBreakpoints);\n let style = {...UNSAFE_style, ...styles};\n\n // @ts-ignore\n if (otherProps.className) {\n console.warn(\n 'The className prop is unsafe and is unsupported in React Spectrum v3. ' +\n 'Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. ' +\n 'Note that this may break in future versions due to DOM structure changes.'\n );\n }\n\n // @ts-ignore\n if (otherProps.style) {\n console.warn(\n 'The style prop is unsafe and is unsupported in React Spectrum v3. ' +\n 'Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. ' +\n 'Note that this may break in future versions due to DOM structure changes.'\n );\n }\n\n let styleProps: HTMLAttributes<HTMLElement> = {\n style,\n className: UNSAFE_className\n };\n\n if (getResponsiveProp(props.isHidden, matchedBreakpoints)) {\n styleProps.hidden = true;\n }\n\n return {\n styleProps\n };\n}\n\nexport function passthroughStyle(value) {\n return value;\n}\n\nexport function getResponsiveProp<T>(prop: Responsive<T>, matchedBreakpoints: Breakpoint[]): T | undefined {\n if (prop && typeof prop === 'object' && !Array.isArray(prop)) {\n for (let i = 0; i < matchedBreakpoints.length; i++) {\n let breakpoint = matchedBreakpoints[i];\n if (prop[breakpoint] != null) {\n return prop[breakpoint];\n }\n }\n return (prop as ResponsiveProp<T>).base;\n }\n return prop as T;\n}\n"],"names":[],"version":3,"file":"styleProps.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAcM,MAAM,4CAAgC;IAC3C,QAAQ;QAAC;QAAU;KAAe;IAClC,aAAa;QAAC,0BAAI,cAAc;QAAgB;KAAe;IAC/D,WAAW;QAAC,0BAAI,eAAe;QAAe;KAAe;IAC7D,8CAA8C;IAC9C,gDAAgD;IAChD,WAAW;QAAC;QAAa;KAAe;IACxC,cAAc;QAAC;QAAgB;KAAe;IAC9C,SAAS;QAAC;YAAC;YAAc;SAAc;QAAE;KAAe;IACxD,SAAS;QAAC;YAAC;YAAa;SAAe;QAAE;KAAe;IACxD,OAAO;QAAC;QAAS;KAAe;IAChC,QAAQ;QAAC;QAAU;KAAe;IAClC,UAAU;QAAC;QAAY;KAAe;IACtC,WAAW;QAAC;QAAa;KAAe;IACxC,UAAU;QAAC;QAAY;KAAe;IACtC,WAAW;QAAC;QAAa;KAAe;IACxC,UAAU;QAAC;QAAW;KAAY;IAClC,WAAW;QAAC;QAAa;KAAiB;IAC1C,aAAa;QAAC;QAAe;KAAiB;IAC9C,UAAU;QAAC;QAAY;KAAS;IAChC,QAAQ;QAAC;QAAU;KAAS;IAC5B,KAAK;QAAC;QAAO;KAAe;IAC5B,QAAQ;QAAC;QAAU;KAAe;IAClC,OAAO;QAAC,0BAAI,QAAQ;QAAU;KAAe;IAC7C,KAAK;QAAC,0BAAI,SAAS;QAAS;KAAe;IAC3C,MAAM;QAAC;QAAQ;KAAe;IAC9B,OAAO;QAAC;QAAS;KAAe;IAChC,OAAO;QAAC;QAAS;KAAS;IAC1B,MAAM;QAAC;QAAQ;KAAU;IACzB,UAAU;QAAC;QAAY;KAAiB;IACxC,YAAY;QAAC;QAAc;KAAiB;IAC5C,WAAW;QAAC;QAAa;KAA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EA,IAAI,0CAAkB,MAAM,QAAQ,EAAE,qBACpC,WAAW,MAAM,GAAG;IAGtB,OAAO;oBACL;IACF;AACF;AAEO,SAAS,0CAAoB,KAAQ;IAC1C,OAAO;AACT;AAEO,SAAS,0CAAqB,IAAmB,EAAE,kBAAgC;IACxF,IAAI,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,OAAO,CAAC,OAAO;QAC5D,IAAK,IAAI,IAAI,GAAG,IAAI,mBAAmB,MAAM,EAAE,IAAK;YAClD,IAAI,aAAa,kBAAkB,CAAC,EAAE;YACtC,IAAI,IAAI,CAAC,WAAW,IAAI,MACtB,OAAO,IAAI,CAAC,WAAW;QAE3B;QACA,OAAO,AAAC,KAA2B,IAAI;IACzC;IACA,OAAO;AACT","sources":["packages/@react-spectrum/utils/src/styleProps.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {BackgroundColorValue, BorderColorValue, BorderRadiusValue, BorderSizeValue, ColorValue, ColorVersion, DimensionValue, Direction, Responsive, ResponsiveProp, StyleProps, ViewStyleProps} from '@react-types/shared';\nimport {CSSProperties, HTMLAttributes} from 'react';\nimport {useBreakpoint} from './BreakpointProvider';\nimport {useLocale} from '@react-aria/i18n';\n\ntype Breakpoint = 'base' | 'S' | 'M' | 'L' | string;\ntype StyleName = string | string[] | ((dir: Direction) => string);\ntype StyleHandler = (value: any, colorVersion?: number) => string | undefined;\nexport interface StyleHandlers {\n [key: string]: [StyleName, StyleHandler]\n}\n\nexport const baseStyleProps: StyleHandlers = {\n margin: ['margin', dimensionValue],\n marginStart: [rtl('marginLeft', 'marginRight'), dimensionValue],\n marginEnd: [rtl('marginRight', 'marginLeft'), dimensionValue],\n // marginLeft: ['marginLeft', dimensionValue],\n // marginRight: ['marginRight', dimensionValue],\n marginTop: ['marginTop', dimensionValue],\n marginBottom: ['marginBottom', dimensionValue],\n marginX: [['marginLeft', 'marginRight'], dimensionValue],\n marginY: [['marginTop', 'marginBottom'], dimensionValue],\n width: ['width', dimensionValue],\n height: ['height', dimensionValue],\n minWidth: ['minWidth', dimensionValue],\n minHeight: ['minHeight', dimensionValue],\n maxWidth: ['maxWidth', dimensionValue],\n maxHeight: ['maxHeight', dimensionValue],\n isHidden: ['display', hiddenValue],\n alignSelf: ['alignSelf', passthroughStyle],\n justifySelf: ['justifySelf', passthroughStyle],\n position: ['position', anyValue],\n zIndex: ['zIndex', anyValue],\n top: ['top', dimensionValue],\n bottom: ['bottom', dimensionValue],\n start: [rtl('left', 'right'), dimensionValue],\n end: [rtl('right', 'left'), dimensionValue],\n left: ['left', dimensionValue],\n right: ['right', dimensionValue],\n order: ['order', anyValue],\n flex: ['flex', flexValue],\n flexGrow: ['flexGrow', passthroughStyle],\n flexShrink: ['flexShrink', passthroughStyle],\n flexBasis: ['flexBasis', passthroughStyle],\n gridArea: ['gridArea', passthroughStyle],\n gridColumn: ['gridColumn', passthroughStyle],\n gridColumnEnd: ['gridColumnEnd', passthroughStyle],\n gridColumnStart: ['gridColumnStart', passthroughStyle],\n gridRow: ['gridRow', passthroughStyle],\n gridRowEnd: ['gridRowEnd', passthroughStyle],\n gridRowStart: ['gridRowStart', passthroughStyle]\n};\n\nexport const viewStyleProps: StyleHandlers = {\n ...baseStyleProps,\n backgroundColor: ['backgroundColor', backgroundColorValue],\n borderWidth: ['borderWidth', borderSizeValue],\n borderStartWidth: [rtl('borderLeftWidth', 'borderRightWidth'), borderSizeValue],\n borderEndWidth: [rtl('borderRightWidth', 'borderLeftWidth'), borderSizeValue],\n borderLeftWidth: ['borderLeftWidth', borderSizeValue],\n borderRightWidth: ['borderRightWidth', borderSizeValue],\n borderTopWidth: ['borderTopWidth', borderSizeValue],\n borderBottomWidth: ['borderBottomWidth', borderSizeValue],\n borderXWidth: [['borderLeftWidth', 'borderRightWidth'], borderSizeValue],\n borderYWidth: [['borderTopWidth', 'borderBottomWidth'], borderSizeValue],\n borderColor: ['borderColor', borderColorValue],\n borderStartColor: [rtl('borderLeftColor', 'borderRightColor'), borderColorValue],\n borderEndColor: [rtl('borderRightColor', 'borderLeftColor'), borderColorValue],\n borderLeftColor: ['borderLeftColor', borderColorValue],\n borderRightColor: ['borderRightColor', borderColorValue],\n borderTopColor: ['borderTopColor', borderColorValue],\n borderBottomColor: ['borderBottomColor', borderColorValue],\n borderXColor: [['borderLeftColor', 'borderRightColor'], borderColorValue],\n borderYColor: [['borderTopColor', 'borderBottomColor'], borderColorValue],\n borderRadius: ['borderRadius', borderRadiusValue],\n borderTopStartRadius: [rtl('borderTopLeftRadius', 'borderTopRightRadius'), borderRadiusValue],\n borderTopEndRadius: [rtl('borderTopRightRadius', 'borderTopLeftRadius'), borderRadiusValue],\n borderBottomStartRadius: [rtl('borderBottomLeftRadius', 'borderBottomRightRadius'), borderRadiusValue],\n borderBottomEndRadius: [rtl('borderBottomRightRadius', 'borderBottomLeftRadius'), borderRadiusValue],\n borderTopLeftRadius: ['borderTopLeftRadius', borderRadiusValue],\n borderTopRightRadius: ['borderTopRightRadius', borderRadiusValue],\n borderBottomLeftRadius: ['borderBottomLeftRadius', borderRadiusValue],\n borderBottomRightRadius: ['borderBottomRightRadius', borderRadiusValue],\n padding: ['padding', dimensionValue],\n paddingStart: [rtl('paddingLeft', 'paddingRight'), dimensionValue],\n paddingEnd: [rtl('paddingRight', 'paddingLeft'), dimensionValue],\n paddingLeft: ['paddingLeft', dimensionValue],\n paddingRight: ['paddingRight', dimensionValue],\n paddingTop: ['paddingTop', dimensionValue],\n paddingBottom: ['paddingBottom', dimensionValue],\n paddingX: [['paddingLeft', 'paddingRight'], dimensionValue],\n paddingY: [['paddingTop', 'paddingBottom'], dimensionValue],\n overflow: ['overflow', passthroughStyle]\n};\n\nconst borderStyleProps = {\n borderWidth: 'borderStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n borderTopWidth: 'borderTopStyle',\n borderBottomWidth: 'borderBottomStyle'\n};\n\nfunction rtl(ltr: string, rtl: string) {\n return (direction: Direction) => (\n direction === 'rtl' ? rtl : ltr\n );\n}\n\nconst UNIT_RE = /(%|px|em|rem|vw|vh|auto|cm|mm|in|pt|pc|ex|ch|rem|vmin|vmax|fr)$/;\nconst FUNC_RE = /^\\s*\\w+\\(/;\nconst SPECTRUM_VARIABLE_RE = /(static-)?size-\\d+|single-line-(height|width)/g;\n\nexport function dimensionValue(value: DimensionValue): string | undefined {\n if (typeof value === 'number') {\n return value + 'px';\n }\n\n if (!value) {\n return undefined;\n }\n\n if (UNIT_RE.test(value)) {\n return value;\n }\n\n if (FUNC_RE.test(value)) {\n return value.replace(SPECTRUM_VARIABLE_RE, 'var(--spectrum-global-dimension-$&, var(--spectrum-alias-$&))');\n }\n\n return `var(--spectrum-global-dimension-${value}, var(--spectrum-alias-${value}))`;\n}\n\nexport function responsiveDimensionValue(value: Responsive<DimensionValue>, matchedBreakpoints: Breakpoint[]): string | undefined {\n let responsiveValue = getResponsiveProp(value, matchedBreakpoints);\n if (responsiveValue != null) {\n return dimensionValue(responsiveValue);\n }\n}\n\ntype ColorType = 'default' | 'background' | 'border' | 'icon' | 'status';\nfunction colorValue(value: ColorValue, type: ColorType = 'default', version = 5) {\n if (version > 5) {\n return `var(--spectrum-${value}, var(--spectrum-semantic-${value}-color-${type}))`;\n }\n\n return `var(--spectrum-legacy-color-${value}, var(--spectrum-global-color-${value}, var(--spectrum-semantic-${value}-color-${type})))`;\n}\n\nfunction backgroundColorValue(value: BackgroundColorValue, version = 5): string | undefined {\n if (!value) {\n return undefined;\n }\n\n return `var(--spectrum-alias-background-color-${value}, ${colorValue(value as ColorValue, 'background', version)})`;\n}\n\nfunction borderColorValue(value: BorderColorValue, version = 5): string | undefined {\n if (!value) {\n return undefined;\n }\n\n if (value === 'default') {\n return 'var(--spectrum-alias-border-color)';\n }\n\n return `var(--spectrum-alias-border-color-${value}, ${colorValue(value as ColorValue, 'border', version)})`;\n}\n\nfunction borderSizeValue(value?: BorderSizeValue | null): string {\n return value && value !== 'none'\n ? `var(--spectrum-alias-border-size-${value})`\n : '0';\n}\n\nfunction borderRadiusValue(value: BorderRadiusValue): string | undefined {\n if (!value) {\n return undefined;\n }\n\n return `var(--spectrum-alias-border-radius-${value})`;\n}\n\nfunction hiddenValue(value: boolean): string | undefined {\n return value ? 'none' : undefined;\n}\n\nfunction anyValue<T>(value: T): T {\n return value;\n}\n\nfunction flexValue(value: boolean | number | string): string | undefined {\n if (typeof value === 'boolean') {\n return value ? '1' : undefined;\n }\n\n return '' + value;\n}\n\nexport function convertStyleProps<C extends ColorVersion>(props: ViewStyleProps<C>, handlers: StyleHandlers, direction: Direction, matchedBreakpoints: Breakpoint[]): CSSProperties {\n let style: CSSProperties = {};\n for (let key in props) {\n let styleProp = handlers[key];\n if (!styleProp || props[key] == null) {\n continue;\n }\n\n let [name, convert] = styleProp;\n if (typeof name === 'function') {\n name = name(direction);\n }\n\n let prop = getResponsiveProp(props[key], matchedBreakpoints);\n let value = convert(prop, props.colorVersion);\n if (Array.isArray(name)) {\n for (let k of name) {\n style[k] = value;\n }\n } else {\n style[name] = value;\n }\n }\n\n for (let prop in borderStyleProps) {\n if (style[prop]) {\n style[borderStyleProps[prop]] = 'solid';\n style.boxSizing = 'border-box';\n }\n }\n\n return style;\n}\n\ntype StylePropsOptions = {\n matchedBreakpoints?: Breakpoint[]\n};\n\nexport function useStyleProps<T extends StyleProps>(\n props: T,\n handlers: StyleHandlers = baseStyleProps,\n options: StylePropsOptions = {}\n): {styleProps: HTMLAttributes<HTMLElement>} {\n let {\n UNSAFE_className,\n UNSAFE_style,\n ...otherProps\n } = props;\n let breakpointProvider = useBreakpoint();\n let {direction} = useLocale();\n let {\n matchedBreakpoints = breakpointProvider?.matchedBreakpoints || ['base']\n } = options;\n let styles = convertStyleProps(props, handlers, direction, matchedBreakpoints);\n let style = {...UNSAFE_style, ...styles};\n\n // @ts-ignore\n if (otherProps.className && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'The className prop is unsafe and is unsupported in React Spectrum v3. ' +\n 'Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. ' +\n 'Note that this may break in future versions due to DOM structure changes.'\n );\n }\n\n // @ts-ignore\n if (otherProps.style && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'The style prop is unsafe and is unsupported in React Spectrum v3. ' +\n 'Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. ' +\n 'Note that this may break in future versions due to DOM structure changes.'\n );\n }\n\n let styleProps: HTMLAttributes<HTMLElement> = {\n style,\n className: UNSAFE_className\n };\n\n if (getResponsiveProp(props.isHidden, matchedBreakpoints)) {\n styleProps.hidden = true;\n }\n\n return {\n styleProps\n };\n}\n\nexport function passthroughStyle<T>(value: T): T {\n return value;\n}\n\nexport function getResponsiveProp<T>(prop: Responsive<T>, matchedBreakpoints: Breakpoint[]): T | undefined {\n if (prop && typeof prop === 'object' && !Array.isArray(prop)) {\n for (let i = 0; i < matchedBreakpoints.length; i++) {\n let breakpoint = matchedBreakpoints[i];\n if (prop[breakpoint] != null) {\n return prop[breakpoint];\n }\n }\n return (prop as ResponsiveProp<T>).base;\n }\n return prop as T;\n}\n"],"names":[],"version":3,"file":"styleProps.module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React, { ReactNode, CSSProperties, HTMLAttributes, JSXElementConstructor, ReactElement } from "react";
1
+ import { ReactNode, CSSProperties, HTMLAttributes, JSXElementConstructor, ReactElement } from "react";
2
2
  import { ColorVersion, DimensionValue, Direction, Responsive, StyleProps, ViewStyleProps, DOMRef, DOMRefValue, FocusableElement, FocusableRef, FocusableRefValue, RefObject } from "@react-types/shared";
3
3
  interface Breakpoints {
4
4
  S?: number;
@@ -13,7 +13,7 @@ interface BreakpointProviderProps {
13
13
  children?: ReactNode;
14
14
  matchedBreakpoints: string[];
15
15
  }
16
- export function BreakpointProvider(props: BreakpointProviderProps): React.JSX.Element;
16
+ export function BreakpointProvider(props: BreakpointProviderProps): ReactNode;
17
17
  export function useMatchedBreakpoints(breakpoints: Breakpoints): string[];
18
18
  export function useBreakpoint(): BreakpointContext | null;
19
19
  type Breakpoint = 'base' | 'S' | 'M' | 'L' | string;
@@ -33,7 +33,7 @@ type StylePropsOptions = {
33
33
  export function useStyleProps<T extends StyleProps>(props: T, handlers?: StyleHandlers, options?: StylePropsOptions): {
34
34
  styleProps: HTMLAttributes<HTMLElement>;
35
35
  };
36
- export function passthroughStyle(value: any): any;
36
+ export function passthroughStyle<T>(value: T): T;
37
37
  export function getResponsiveProp<T>(prop: Responsive<T>, matchedBreakpoints: Breakpoint[]): T | undefined;
38
38
  export let shouldKeepSpectrumClassNames: boolean;
39
39
  export function keepSpectrumClassNames(): void;
@@ -51,9 +51,22 @@ export function useUnwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValu
51
51
  export function useSlotProps<T>(props: T & {
52
52
  id?: string;
53
53
  }, defaultSlot?: string): T;
54
- export function cssModuleToSlots(cssModule: any): {};
55
- export function SlotProvider(props: any): React.JSX.Element;
56
- export function ClearSlots(props: any): React.JSX.Element;
54
+ export function cssModuleToSlots(cssModule: {
55
+ [cssmodule: string]: string;
56
+ }): {
57
+ [slot: string]: {
58
+ UNSAFE_className: string;
59
+ };
60
+ };
61
+ export function SlotProvider(props: {
62
+ slots?: {
63
+ [slot: string]: object;
64
+ };
65
+ children?: ReactNode;
66
+ }): ReactNode;
67
+ export function ClearSlots(props: {
68
+ children?: ReactNode;
69
+ }): ReactNode;
57
70
  export function useHasChild(query: string, ref: RefObject<HTMLElement | null>): boolean;
58
71
  export function useIsMobileDevice(): boolean;
59
72
  export { useValue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I,CAAC,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,CAIjK;AAED,6BAA6B,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,UAAU,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,CAM9G;AAED,gCAAgC,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,UAAU,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,GAAI,UAAU,CAAC,GAAG,IAAI,CAAC,CAElH;ACnCD,6BAA6B,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,CAMjF;AAED,iCAAiC,SAAS,KAAA,MAKzC;AAED,6BAA6B,KAAK,KAAA,qBAoBjC;AAED,2BAA2B,KAAK,KAAA,qBAgB/B;AC1DD,4BAA4B,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,WAM5E;ACND,qCAAqC,OAAO,CAO3C;ACSD,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/BreakpointProvider.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/styleProps.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/classNames.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/getWrappedElement.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useMediaQuery.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useDOMRef.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/Slots.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useHasChild.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useIsMobileDevice.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/index.ts","packages/@react-spectrum/utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 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\n/// <reference types=\"css-module-types\" />\n\nexport type {StyleHandlers} from './styleProps';\nexport {shouldKeepSpectrumClassNames, keepSpectrumClassNames, classNames} from './classNames';\nexport {getWrappedElement} from './getWrappedElement';\nexport {useMediaQuery} from './useMediaQuery';\nexport {createDOMRef, createFocusableRef, useDOMRef, useFocusableRef, unwrapDOMRef, useUnwrapDOMRef} from './useDOMRef';\nexport {\n baseStyleProps,\n viewStyleProps,\n dimensionValue,\n responsiveDimensionValue,\n convertStyleProps,\n useStyleProps,\n passthroughStyle,\n getResponsiveProp\n} from './styleProps';\nexport {useSlotProps, cssModuleToSlots, SlotProvider, ClearSlots} from './Slots';\nexport {useHasChild} from './useHasChild';\nexport {useIsMobileDevice} from './useIsMobileDevice';\nexport {useValueEffect} from '@react-aria/utils';\nexport {BreakpointProvider, useMatchedBreakpoints, useBreakpoint} from './BreakpointProvider';\nexport {useResizeObserver} from '@react-aria/utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;AAGA;IACE,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CACrC;AAED;IACE,kBAAkB,EAAE,MAAM,E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IjK;AAED,6BAA6B,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,UAAU,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,CAM9G;AAED,gCAAgC,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,UAAU,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,GAAI,UAAU,CAAC,GAAG,IAAI,CAAC,CAElH;ACnCD,6BAA6B,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,CAMjF;AAED,iCAAiC,SAAS,EAAE;IAAC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,GAAG;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAC,CAAA;CAAC,CAKvH;AAED,6BAA6B,KAAK,EAAE;IAAC,KAAK,CAAC,EAAE;QAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAC,GAAG,SAAS,CAoBvG;AAED,2BAA2B,KAAK,EAAE;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAC,GAAG,SAAS,CAgBnE;AC1DD,4BAA4B,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,GAAG,OAAO,CAMtF;ACND,qCAAqC,OAAO,CAO3C;ACSD,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/BreakpointProvider.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/styleProps.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/classNames.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/getWrappedElement.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useMediaQuery.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useDOMRef.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/Slots.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useHasChild.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useIsMobileDevice.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/index.ts","packages/@react-spectrum/utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 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\n/// <reference types=\"css-module-types\" />\n\nexport type {StyleHandlers} from './styleProps';\nexport {shouldKeepSpectrumClassNames, keepSpectrumClassNames, classNames} from './classNames';\nexport {getWrappedElement} from './getWrappedElement';\nexport {useMediaQuery} from './useMediaQuery';\nexport {createDOMRef, createFocusableRef, useDOMRef, useFocusableRef, unwrapDOMRef, useUnwrapDOMRef} from './useDOMRef';\nexport {\n baseStyleProps,\n viewStyleProps,\n dimensionValue,\n responsiveDimensionValue,\n convertStyleProps,\n useStyleProps,\n passthroughStyle,\n getResponsiveProp\n} from './styleProps';\nexport {useSlotProps, cssModuleToSlots, SlotProvider, ClearSlots} from './Slots';\nexport {useHasChild} from './useHasChild';\nexport {useIsMobileDevice} from './useIsMobileDevice';\nexport {useValueEffect} from '@react-aria/utils';\nexport {BreakpointProvider, useMatchedBreakpoints, useBreakpoint} from './BreakpointProvider';\nexport {useResizeObserver} from '@react-aria/utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAY,KAAa,EAAE,GAAkC;IAC3E,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,qBAAO,EAAE;IACvC,CAAA,GAAA,qCAAc,EAAE;QACd,YAAY,CAAC,CAAE,CAAA,IAAI,OAAO,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,MAAK;IAC/D,GAAG;QAAC;QAAa;QAAO;KAAI;IAC5B,OAAO;AACT","sources":["packages/@react-spectrum/utils/src/useHasChild.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useState} from 'react';\n\nexport function useHasChild(query: string, ref: RefObject<HTMLElement | null>) {\n let [hasChild, setHasChild] = useState(true);\n useLayoutEffect(() => {\n setHasChild(!!(ref.current && ref.current.querySelector(query)));\n }, [setHasChild, query, ref]);\n return hasChild;\n}\n"],"names":[],"version":3,"file":"useHasChild.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAY,KAAa,EAAE,GAAkC;IAC3E,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,qBAAO,EAAE;IACvC,CAAA,GAAA,qCAAc,EAAE;QACd,YAAY,CAAC,CAAE,CAAA,IAAI,OAAO,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,MAAK;IAC/D,GAAG;QAAC;QAAa;QAAO;KAAI;IAC5B,OAAO;AACT","sources":["packages/@react-spectrum/utils/src/useHasChild.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useState} from 'react';\n\nexport function useHasChild(query: string, ref: RefObject<HTMLElement | null>): boolean {\n let [hasChild, setHasChild] = useState(true);\n useLayoutEffect(() => {\n setHasChild(!!(ref.current && ref.current.querySelector(query)));\n }, [setHasChild, query, ref]);\n return hasChild;\n}\n"],"names":[],"version":3,"file":"useHasChild.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAY,KAAa,EAAE,GAAkC;IAC3E,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,CAAA,GAAA,sBAAc,EAAE;QACd,YAAY,CAAC,CAAE,CAAA,IAAI,OAAO,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,MAAK;IAC/D,GAAG;QAAC;QAAa;QAAO;KAAI;IAC5B,OAAO;AACT","sources":["packages/@react-spectrum/utils/src/useHasChild.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useState} from 'react';\n\nexport function useHasChild(query: string, ref: RefObject<HTMLElement | null>) {\n let [hasChild, setHasChild] = useState(true);\n useLayoutEffect(() => {\n setHasChild(!!(ref.current && ref.current.querySelector(query)));\n }, [setHasChild, query, ref]);\n return hasChild;\n}\n"],"names":[],"version":3,"file":"useHasChild.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAY,KAAa,EAAE,GAAkC;IAC3E,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,CAAA,GAAA,sBAAc,EAAE;QACd,YAAY,CAAC,CAAE,CAAA,IAAI,OAAO,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,MAAK;IAC/D,GAAG;QAAC;QAAa;QAAO;KAAI;IAC5B,OAAO;AACT","sources":["packages/@react-spectrum/utils/src/useHasChild.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useState} from 'react';\n\nexport function useHasChild(query: string, ref: RefObject<HTMLElement | null>): boolean {\n let [hasChild, setHasChild] = useState(true);\n useLayoutEffect(() => {\n setHasChild(!!(ref.current && ref.current.querySelector(query)));\n }, [setHasChild, query, ref]);\n return hasChild;\n}\n"],"names":[],"version":3,"file":"useHasChild.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAKM,SAAS,yCAAc,KAAa;IACzC,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE,IACnC,qBACI,OAAO,UAAU,CAAC,OAAO,OAAO,GAChC;IAGN,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,KAAK,OAAO,UAAU,CAAC;QAC3B,IAAI,WAAW,CAAC;YACd,WAAW,IAAI,OAAO;QACxB;QAEA,GAAG,WAAW,CAAC;QACf,OAAO;YACL,GAAG,cAAc,CAAC;QACpB;IACF,GAAG;QAAC;QAAoB;KAAM;IAE9B,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,4BAAO;IACnB,OAAO,QAAQ,QAAQ;AACzB","sources":["packages/@react-spectrum/utils/src/useMediaQuery.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport function useMediaQuery(query: string) {\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let [matches, setMatches] = useState(() =>\n supportsMatchMedia\n ? window.matchMedia(query).matches\n : false\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let mq = window.matchMedia(query);\n let onChange = (evt) => {\n setMatches(evt.matches);\n };\n\n mq.addListener(onChange);\n return () => {\n mq.removeListener(onChange);\n };\n }, [supportsMatchMedia, query]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? false : matches;\n}\n"],"names":[],"version":3,"file":"useMediaQuery.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAKM,SAAS,yCAAc,KAAa;IACzC,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE,IACnC,qBACI,OAAO,UAAU,CAAC,OAAO,OAAO,GAChC;IAGN,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,KAAK,OAAO,UAAU,CAAC;QAC3B,IAAI,WAAW,CAAC;YACd,WAAW,IAAI,OAAO;QACxB;QAEA,GAAG,WAAW,CAAC;QACf,OAAO;YACL,GAAG,cAAc,CAAC;QACpB;IACF,GAAG;QAAC;QAAoB;KAAM;IAE9B,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,4BAAO;IACnB,OAAO,QAAQ,QAAQ;AACzB","sources":["packages/@react-spectrum/utils/src/useMediaQuery.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport function useMediaQuery(query: string): boolean {\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let [matches, setMatches] = useState(() =>\n supportsMatchMedia\n ? window.matchMedia(query).matches\n : false\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let mq = window.matchMedia(query);\n let onChange = (evt) => {\n setMatches(evt.matches);\n };\n\n mq.addListener(onChange);\n return () => {\n mq.removeListener(onChange);\n };\n }, [supportsMatchMedia, query]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? false : matches;\n}\n"],"names":[],"version":3,"file":"useMediaQuery.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAKM,SAAS,yCAAc,KAAa;IACzC,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE,IACnC,qBACI,OAAO,UAAU,CAAC,OAAO,OAAO,GAChC;IAGN,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,KAAK,OAAO,UAAU,CAAC;QAC3B,IAAI,WAAW,CAAC;YACd,WAAW,IAAI,OAAO;QACxB;QAEA,GAAG,WAAW,CAAC;QACf,OAAO;YACL,GAAG,cAAc,CAAC;QACpB;IACF,GAAG;QAAC;QAAoB;KAAM;IAE9B,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,eAAO;IACnB,OAAO,QAAQ,QAAQ;AACzB","sources":["packages/@react-spectrum/utils/src/useMediaQuery.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport function useMediaQuery(query: string) {\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let [matches, setMatches] = useState(() =>\n supportsMatchMedia\n ? window.matchMedia(query).matches\n : false\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let mq = window.matchMedia(query);\n let onChange = (evt) => {\n setMatches(evt.matches);\n };\n\n mq.addListener(onChange);\n return () => {\n mq.removeListener(onChange);\n };\n }, [supportsMatchMedia, query]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? false : matches;\n}\n"],"names":[],"version":3,"file":"useMediaQuery.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAKM,SAAS,yCAAc,KAAa;IACzC,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE,IACnC,qBACI,OAAO,UAAU,CAAC,OAAO,OAAO,GAChC;IAGN,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,KAAK,OAAO,UAAU,CAAC;QAC3B,IAAI,WAAW,CAAC;YACd,WAAW,IAAI,OAAO;QACxB;QAEA,GAAG,WAAW,CAAC;QACf,OAAO;YACL,GAAG,cAAc,CAAC;QACpB;IACF,GAAG;QAAC;QAAoB;KAAM;IAE9B,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,eAAO;IACnB,OAAO,QAAQ,QAAQ;AACzB","sources":["packages/@react-spectrum/utils/src/useMediaQuery.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport function useMediaQuery(query: string): boolean {\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let [matches, setMatches] = useState(() =>\n supportsMatchMedia\n ? window.matchMedia(query).matches\n : false\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let mq = window.matchMedia(query);\n let onChange = (evt) => {\n setMatches(evt.matches);\n };\n\n mq.addListener(onChange);\n return () => {\n mq.removeListener(onChange);\n };\n }, [supportsMatchMedia, query]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? false : matches;\n}\n"],"names":[],"version":3,"file":"useMediaQuery.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/utils",
3
- "version": "3.12.2",
3
+ "version": "3.12.4",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -24,10 +24,10 @@
24
24
  "url": "https://github.com/adobe/react-spectrum"
25
25
  },
26
26
  "dependencies": {
27
- "@react-aria/i18n": "^3.12.6",
28
- "@react-aria/ssr": "^3.9.7",
29
- "@react-aria/utils": "^3.28.0",
30
- "@react-types/shared": "^3.28.0",
27
+ "@react-aria/i18n": "^3.12.8",
28
+ "@react-aria/ssr": "^3.9.8",
29
+ "@react-aria/utils": "^3.28.2",
30
+ "@react-types/shared": "^3.29.0",
31
31
  "@swc/helpers": "^0.5.0",
32
32
  "clsx": "^2.0.0"
33
33
  },
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "4d3c72c94eea2d72eb3a0e7d56000c6ef7e39726"
41
+ "gitHead": "9b66d270572f482948afee95622a85cdf68ed408"
42
42
  }
@@ -20,7 +20,7 @@ interface BreakpointProviderProps {
20
20
  matchedBreakpoints: string[]
21
21
  }
22
22
 
23
- export function BreakpointProvider(props: BreakpointProviderProps) {
23
+ export function BreakpointProvider(props: BreakpointProviderProps): ReactNode {
24
24
  let {
25
25
  children,
26
26
  matchedBreakpoints
@@ -87,6 +87,6 @@ export function useMatchedBreakpoints(breakpoints: Breakpoints): string[] {
87
87
  return isSSR ? ['base'] : breakpoint;
88
88
  }
89
89
 
90
- export function useBreakpoint() {
90
+ export function useBreakpoint(): BreakpointContext | null {
91
91
  return useContext(Context);
92
92
  }
package/src/Slots.tsx CHANGED
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import {mergeProps} from '@react-aria/utils';
14
- import React, {useContext, useMemo} from 'react';
14
+ import React, {ReactNode, useContext, useMemo} from 'react';
15
15
 
16
16
  interface SlotProps {
17
17
  slot?: string
@@ -27,16 +27,16 @@ export function useSlotProps<T>(props: T & {id?: string}, defaultSlot?: string):
27
27
  return mergeProps(props, mergeProps(slotProps, {id: props.id}));
28
28
  }
29
29
 
30
- export function cssModuleToSlots(cssModule) {
30
+ export function cssModuleToSlots(cssModule: {[cssmodule: string]: string}): {[slot: string]: {UNSAFE_className: string}} {
31
31
  return Object.keys(cssModule).reduce((acc, slot) => {
32
32
  acc[slot] = {UNSAFE_className: cssModule[slot]};
33
33
  return acc;
34
34
  }, {});
35
35
  }
36
36
 
37
- export function SlotProvider(props) {
37
+ export function SlotProvider(props: {slots?: {[slot: string]: object}, children?: ReactNode}): ReactNode {
38
38
  const emptyObj = useMemo(() => ({}), []);
39
-
39
+
40
40
  let parentSlots = useContext(SlotContext) || emptyObj;
41
41
  let {slots = emptyObj, children} = props;
42
42
 
@@ -56,7 +56,7 @@ export function SlotProvider(props) {
56
56
  );
57
57
  }
58
58
 
59
- export function ClearSlots(props) {
59
+ export function ClearSlots(props: {children?: ReactNode}): ReactNode {
60
60
  let {children, ...otherProps} = props;
61
61
 
62
62
  const emptyObj = useMemo(() => ({}), []);
package/src/classNames.ts CHANGED
@@ -14,13 +14,15 @@ import _clsx from 'clsx';
14
14
 
15
15
  export let shouldKeepSpectrumClassNames = false;
16
16
 
17
- export function keepSpectrumClassNames() {
17
+ export function keepSpectrumClassNames(): void {
18
18
  shouldKeepSpectrumClassNames = true;
19
- console.warn(
20
- 'Legacy spectrum-prefixed class names enabled for backward compatibility. ' +
21
- 'We recommend replacing instances of CSS overrides targeting spectrum selectors ' +
22
- 'in your app with custom class names of your own, and disabling this flag.'
23
- );
19
+ if (process.env.NODE_ENV !== 'production') {
20
+ console.warn(
21
+ 'Legacy spectrum-prefixed class names enabled for backward compatibility. ' +
22
+ 'We recommend replacing instances of CSS overrides targeting spectrum selectors ' +
23
+ 'in your app with custom class names of your own, and disabling this flag.'
24
+ );
25
+ }
24
26
  }
25
27
 
26
28
  export function classNames(cssModule: {[key: string]: string}, ...values: Array<string | Object | undefined>): string {
package/src/styleProps.ts CHANGED
@@ -123,7 +123,7 @@ const UNIT_RE = /(%|px|em|rem|vw|vh|auto|cm|mm|in|pt|pc|ex|ch|rem|vmin|vmax|fr)$
123
123
  const FUNC_RE = /^\s*\w+\(/;
124
124
  const SPECTRUM_VARIABLE_RE = /(static-)?size-\d+|single-line-(height|width)/g;
125
125
 
126
- export function dimensionValue(value: DimensionValue) {
126
+ export function dimensionValue(value: DimensionValue): string | undefined {
127
127
  if (typeof value === 'number') {
128
128
  return value + 'px';
129
129
  }
@@ -143,7 +143,7 @@ export function dimensionValue(value: DimensionValue) {
143
143
  return `var(--spectrum-global-dimension-${value}, var(--spectrum-alias-${value}))`;
144
144
  }
145
145
 
146
- export function responsiveDimensionValue(value: Responsive<DimensionValue>, matchedBreakpoints: Breakpoint[]) {
146
+ export function responsiveDimensionValue(value: Responsive<DimensionValue>, matchedBreakpoints: Breakpoint[]): string | undefined {
147
147
  let responsiveValue = getResponsiveProp(value, matchedBreakpoints);
148
148
  if (responsiveValue != null) {
149
149
  return dimensionValue(responsiveValue);
@@ -159,7 +159,7 @@ function colorValue(value: ColorValue, type: ColorType = 'default', version = 5)
159
159
  return `var(--spectrum-legacy-color-${value}, var(--spectrum-global-color-${value}, var(--spectrum-semantic-${value}-color-${type})))`;
160
160
  }
161
161
 
162
- function backgroundColorValue(value: BackgroundColorValue, version = 5) {
162
+ function backgroundColorValue(value: BackgroundColorValue, version = 5): string | undefined {
163
163
  if (!value) {
164
164
  return undefined;
165
165
  }
@@ -167,7 +167,7 @@ function backgroundColorValue(value: BackgroundColorValue, version = 5) {
167
167
  return `var(--spectrum-alias-background-color-${value}, ${colorValue(value as ColorValue, 'background', version)})`;
168
168
  }
169
169
 
170
- function borderColorValue(value: BorderColorValue, version = 5) {
170
+ function borderColorValue(value: BorderColorValue, version = 5): string | undefined {
171
171
  if (!value) {
172
172
  return undefined;
173
173
  }
@@ -179,13 +179,13 @@ function borderColorValue(value: BorderColorValue, version = 5) {
179
179
  return `var(--spectrum-alias-border-color-${value}, ${colorValue(value as ColorValue, 'border', version)})`;
180
180
  }
181
181
 
182
- function borderSizeValue(value?: BorderSizeValue | null) {
182
+ function borderSizeValue(value?: BorderSizeValue | null): string {
183
183
  return value && value !== 'none'
184
184
  ? `var(--spectrum-alias-border-size-${value})`
185
185
  : '0';
186
186
  }
187
187
 
188
- function borderRadiusValue(value: BorderRadiusValue) {
188
+ function borderRadiusValue(value: BorderRadiusValue): string | undefined {
189
189
  if (!value) {
190
190
  return undefined;
191
191
  }
@@ -193,15 +193,15 @@ function borderRadiusValue(value: BorderRadiusValue) {
193
193
  return `var(--spectrum-alias-border-radius-${value})`;
194
194
  }
195
195
 
196
- function hiddenValue(value: boolean) {
196
+ function hiddenValue(value: boolean): string | undefined {
197
197
  return value ? 'none' : undefined;
198
198
  }
199
199
 
200
- function anyValue(value: any) {
200
+ function anyValue<T>(value: T): T {
201
201
  return value;
202
202
  }
203
203
 
204
- function flexValue(value: boolean | number | string) {
204
+ function flexValue(value: boolean | number | string): string | undefined {
205
205
  if (typeof value === 'boolean') {
206
206
  return value ? '1' : undefined;
207
207
  }
@@ -209,7 +209,7 @@ function flexValue(value: boolean | number | string) {
209
209
  return '' + value;
210
210
  }
211
211
 
212
- export function convertStyleProps<C extends ColorVersion>(props: ViewStyleProps<C>, handlers: StyleHandlers, direction: Direction, matchedBreakpoints: Breakpoint[]) {
212
+ export function convertStyleProps<C extends ColorVersion>(props: ViewStyleProps<C>, handlers: StyleHandlers, direction: Direction, matchedBreakpoints: Breakpoint[]): CSSProperties {
213
213
  let style: CSSProperties = {};
214
214
  for (let key in props) {
215
215
  let styleProp = handlers[key];
@@ -251,7 +251,7 @@ export function useStyleProps<T extends StyleProps>(
251
251
  props: T,
252
252
  handlers: StyleHandlers = baseStyleProps,
253
253
  options: StylePropsOptions = {}
254
- ) {
254
+ ): {styleProps: HTMLAttributes<HTMLElement>} {
255
255
  let {
256
256
  UNSAFE_className,
257
257
  UNSAFE_style,
@@ -266,7 +266,7 @@ export function useStyleProps<T extends StyleProps>(
266
266
  let style = {...UNSAFE_style, ...styles};
267
267
 
268
268
  // @ts-ignore
269
- if (otherProps.className) {
269
+ if (otherProps.className && process.env.NODE_ENV !== 'production') {
270
270
  console.warn(
271
271
  'The className prop is unsafe and is unsupported in React Spectrum v3. ' +
272
272
  'Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. ' +
@@ -275,7 +275,7 @@ export function useStyleProps<T extends StyleProps>(
275
275
  }
276
276
 
277
277
  // @ts-ignore
278
- if (otherProps.style) {
278
+ if (otherProps.style && process.env.NODE_ENV !== 'production') {
279
279
  console.warn(
280
280
  'The style prop is unsafe and is unsupported in React Spectrum v3. ' +
281
281
  'Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. ' +
@@ -297,7 +297,7 @@ export function useStyleProps<T extends StyleProps>(
297
297
  };
298
298
  }
299
299
 
300
- export function passthroughStyle(value) {
300
+ export function passthroughStyle<T>(value: T): T {
301
301
  return value;
302
302
  }
303
303
 
@@ -14,7 +14,7 @@ import {RefObject} from '@react-types/shared';
14
14
  import {useLayoutEffect} from '@react-aria/utils';
15
15
  import {useState} from 'react';
16
16
 
17
- export function useHasChild(query: string, ref: RefObject<HTMLElement | null>) {
17
+ export function useHasChild(query: string, ref: RefObject<HTMLElement | null>): boolean {
18
18
  let [hasChild, setHasChild] = useState(true);
19
19
  useLayoutEffect(() => {
20
20
  setHasChild(!!(ref.current && ref.current.querySelector(query)));
@@ -13,7 +13,7 @@
13
13
  import {useEffect, useState} from 'react';
14
14
  import {useIsSSR} from '@react-aria/ssr';
15
15
 
16
- export function useMediaQuery(query: string) {
16
+ export function useMediaQuery(query: string): boolean {
17
17
  let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';
18
18
  let [matches, setMatches] = useState(() =>
19
19
  supportsMatchMedia