@react-spectrum/utils 3.11.5 → 3.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BreakpointProvider.main.js +75 -0
- package/dist/BreakpointProvider.main.js.map +1 -0
- package/dist/BreakpointProvider.mjs +64 -0
- package/dist/BreakpointProvider.module.js +64 -0
- package/dist/BreakpointProvider.module.js.map +1 -0
- package/dist/Slots.main.js +73 -0
- package/dist/Slots.main.js.map +1 -0
- package/dist/Slots.mjs +61 -0
- package/dist/Slots.module.js +61 -0
- package/dist/Slots.module.js.map +1 -0
- package/dist/classNames.main.js +50 -0
- package/dist/classNames.main.js.map +1 -0
- package/dist/classNames.mjs +39 -0
- package/dist/classNames.module.js +39 -0
- package/dist/classNames.module.js.map +1 -0
- package/dist/getWrappedElement.main.js +32 -0
- package/dist/getWrappedElement.main.js.map +1 -0
- package/dist/getWrappedElement.mjs +23 -0
- package/dist/getWrappedElement.module.js +23 -0
- package/dist/getWrappedElement.module.js.map +1 -0
- package/dist/import.mjs +10 -742
- package/dist/main.js +37 -773
- package/dist/main.js.map +1 -1
- package/dist/module.js +10 -742
- package/dist/module.js.map +1 -1
- package/dist/styleProps.main.js +468 -0
- package/dist/styleProps.main.js.map +1 -0
- package/dist/styleProps.mjs +456 -0
- package/dist/styleProps.module.js +456 -0
- package/dist/styleProps.module.js.map +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/useDOMRef.main.js +64 -0
- package/dist/useDOMRef.main.js.map +1 -0
- package/dist/useDOMRef.mjs +54 -0
- package/dist/useDOMRef.module.js +54 -0
- package/dist/useDOMRef.module.js.map +1 -0
- package/dist/useHasChild.main.js +35 -0
- package/dist/useHasChild.main.js.map +1 -0
- package/dist/useHasChild.mjs +30 -0
- package/dist/useHasChild.module.js +30 -0
- package/dist/useHasChild.module.js.map +1 -0
- package/dist/useIsMobileDevice.main.js +28 -0
- package/dist/useIsMobileDevice.main.js.map +1 -0
- package/dist/useIsMobileDevice.mjs +23 -0
- package/dist/useIsMobileDevice.module.js +23 -0
- package/dist/useIsMobileDevice.module.js.map +1 -0
- package/dist/useMediaQuery.main.js +46 -0
- package/dist/useMediaQuery.main.js.map +1 -0
- package/dist/useMediaQuery.mjs +41 -0
- package/dist/useMediaQuery.module.js +41 -0
- package/dist/useMediaQuery.module.js.map +1 -0
- package/package.json +6 -6
- package/src/styleProps.ts +16 -0
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C;ACZ1C;;;;;;;;;;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,UAAU,EAAE;IAChB,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;;;ACvDA;;;;;;;;;;CAUC;AAIM,SAAS,0CAAkB,QAA2C;IAC3E,IAAI;IACJ,IAAI,OAAO,aA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AAA,eAAO;IACnB,IAAI,SAAS,OAAO,WAAW,aAC7B,OAAO;IAGT,OAAO,OAAO,MAAM,CAAC,KAAK,IAAI;AAChC;;","sources":["packages/@react-spectrum/utils/src/index.ts","packages/@react-spectrum/utils/src/classNames.ts","packages/@react-spectrum/utils/src/getWrappedElement.tsx","packages/@react-spectrum/utils/src/useMediaQuery.ts","packages/@react-spectrum/utils/src/useDOMRef.ts","packages/@react-spectrum/utils/src/styleProps.ts","packages/@react-spectrum/utils/src/BreakpointProvider.tsx","packages/@react-spectrum/utils/src/Slots.tsx","packages/@react-spectrum/utils/src/useHasChild.ts","packages/@react-spectrum/utils/src/useIsMobileDevice.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\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","/*\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 = [];\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","/*\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 React, {JSXElementConstructor, ReactElement, ReactNode} from 'react';\n\nexport function getWrappedElement(children: string | ReactElement | ReactNode): ReactElement<any, JSXElementConstructor<any>> {\n let element;\n if (typeof children === 'string') {\n element = <span>{children}</span>;\n } else {\n element = React.Children.only(children);\n }\n return element;\n}\n","/*\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","/*\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 {DOMRef, DOMRefValue, FocusableElement, FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {RefObject, useImperativeHandle, useMemo, useRef} from 'react';\n\nexport function createDOMRef<T extends HTMLElement = HTMLElement>(ref: RefObject<T>): DOMRefValue<T> {\n return {\n UNSAFE_getDOMNode() {\n return ref.current;\n }\n };\n}\n\nexport function createFocusableRef<T extends HTMLElement = HTMLElement>(domRef: RefObject<T>, focusableRef: RefObject<FocusableElement> = domRef): FocusableRefValue<T> {\n return {\n ...createDOMRef(domRef),\n focus() {\n if (focusableRef.current) {\n focusableRef.current.focus();\n }\n }\n };\n}\n\nexport function useDOMRef<T extends HTMLElement = HTMLElement>(ref: DOMRef<T>): RefObject<T> {\n let domRef = useRef<T>(null);\n useImperativeHandle(ref, () => createDOMRef(domRef));\n return domRef;\n}\n\nexport function useFocusableRef<T extends HTMLElement = HTMLElement>(ref: FocusableRef<T>, focusableRef?: RefObject<FocusableElement>): RefObject<T> {\n let domRef = useRef<T>(null);\n useImperativeHandle(ref, () => createFocusableRef(domRef, focusableRef));\n return domRef;\n}\n\nexport function unwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T>>): RefObject<T> {\n return {\n get current() {\n return ref.current && ref.current.UNSAFE_getDOMNode();\n }\n };\n}\n\nexport function useUnwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T>>) : RefObject<T> {\n return useMemo(() => unwrapDOMRef(ref), [ref]);\n}\n","/*\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;\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 (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 value = getResponsiveProp(value, matchedBreakpoints);\n return dimensionValue(value);\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 return `var(--spectrum-alias-background-color-${value}, ${colorValue(value as ColorValue, 'background', version)})`;\n}\n\nfunction borderColorValue(value: BorderColorValue, version = 5) {\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 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 {\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","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);\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 = [];\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 {\n return useContext(Context);\n}\n","/*\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);\n\nexport function useSlotProps<T>(props: T & {id?: string}, defaultSlot?: string): T {\n let slot = (props as SlotProps).slot || defaultSlot;\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 // eslint-disable-next-line react-hooks/exhaustive-deps\n let parentSlots = useContext(SlotContext) || {};\n let {slots = {}, 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 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={{}}>\n {content}\n </SlotContext.Provider>\n );\n}\n","/*\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, useState} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\n\nexport function useHasChild(query: string, ref: RefObject<HTMLElement>) {\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","/*\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 {useIsSSR} from '@react-aria/ssr';\n\nconst MOBILE_SCREEN_WIDTH = 700;\n\nexport function useIsMobileDevice(): boolean {\n let isSSR = useIsSSR();\n if (isSSR || typeof window === 'undefined') {\n return false;\n }\n\n return window.screen.width <= MOBILE_SCREEN_WIDTH;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/utils/src/index.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\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":"module.js.map"}
|
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
var $893a66ba513f4a66$exports = require("./BreakpointProvider.main.js");
|
|
2
|
+
var $5XTxG$reactariai18n = require("@react-aria/i18n");
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
function $parcel$export(e, n, v, s) {
|
|
6
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
$parcel$export(module.exports, "baseStyleProps", () => $d3b73be57066120b$export$fe9c6e915565b4e8);
|
|
10
|
+
$parcel$export(module.exports, "dimensionValue", () => $d3b73be57066120b$export$abc24f5b99744ea6);
|
|
11
|
+
$parcel$export(module.exports, "passthroughStyle", () => $d3b73be57066120b$export$46b6c81d11d2c30a);
|
|
12
|
+
$parcel$export(module.exports, "viewStyleProps", () => $d3b73be57066120b$export$e0705d1a55f297c);
|
|
13
|
+
$parcel$export(module.exports, "responsiveDimensionValue", () => $d3b73be57066120b$export$f348bec194f2e6b5);
|
|
14
|
+
$parcel$export(module.exports, "getResponsiveProp", () => $d3b73be57066120b$export$52dbfdbe1b2c3541);
|
|
15
|
+
$parcel$export(module.exports, "convertStyleProps", () => $d3b73be57066120b$export$f3c39bb9534218d0);
|
|
16
|
+
$parcel$export(module.exports, "useStyleProps", () => $d3b73be57066120b$export$b8e6fb9d2dff3f41);
|
|
17
|
+
/*
|
|
18
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
19
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
21
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
24
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
25
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
26
|
+
* governing permissions and limitations under the License.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
const $d3b73be57066120b$export$fe9c6e915565b4e8 = {
|
|
30
|
+
margin: [
|
|
31
|
+
"margin",
|
|
32
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
33
|
+
],
|
|
34
|
+
marginStart: [
|
|
35
|
+
$d3b73be57066120b$var$rtl("marginLeft", "marginRight"),
|
|
36
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
37
|
+
],
|
|
38
|
+
marginEnd: [
|
|
39
|
+
$d3b73be57066120b$var$rtl("marginRight", "marginLeft"),
|
|
40
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
41
|
+
],
|
|
42
|
+
// marginLeft: ['marginLeft', dimensionValue],
|
|
43
|
+
// marginRight: ['marginRight', dimensionValue],
|
|
44
|
+
marginTop: [
|
|
45
|
+
"marginTop",
|
|
46
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
47
|
+
],
|
|
48
|
+
marginBottom: [
|
|
49
|
+
"marginBottom",
|
|
50
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
51
|
+
],
|
|
52
|
+
marginX: [
|
|
53
|
+
[
|
|
54
|
+
"marginLeft",
|
|
55
|
+
"marginRight"
|
|
56
|
+
],
|
|
57
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
58
|
+
],
|
|
59
|
+
marginY: [
|
|
60
|
+
[
|
|
61
|
+
"marginTop",
|
|
62
|
+
"marginBottom"
|
|
63
|
+
],
|
|
64
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
65
|
+
],
|
|
66
|
+
width: [
|
|
67
|
+
"width",
|
|
68
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
69
|
+
],
|
|
70
|
+
height: [
|
|
71
|
+
"height",
|
|
72
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
73
|
+
],
|
|
74
|
+
minWidth: [
|
|
75
|
+
"minWidth",
|
|
76
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
77
|
+
],
|
|
78
|
+
minHeight: [
|
|
79
|
+
"minHeight",
|
|
80
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
81
|
+
],
|
|
82
|
+
maxWidth: [
|
|
83
|
+
"maxWidth",
|
|
84
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
85
|
+
],
|
|
86
|
+
maxHeight: [
|
|
87
|
+
"maxHeight",
|
|
88
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
89
|
+
],
|
|
90
|
+
isHidden: [
|
|
91
|
+
"display",
|
|
92
|
+
$d3b73be57066120b$var$hiddenValue
|
|
93
|
+
],
|
|
94
|
+
alignSelf: [
|
|
95
|
+
"alignSelf",
|
|
96
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
97
|
+
],
|
|
98
|
+
justifySelf: [
|
|
99
|
+
"justifySelf",
|
|
100
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
101
|
+
],
|
|
102
|
+
position: [
|
|
103
|
+
"position",
|
|
104
|
+
$d3b73be57066120b$var$anyValue
|
|
105
|
+
],
|
|
106
|
+
zIndex: [
|
|
107
|
+
"zIndex",
|
|
108
|
+
$d3b73be57066120b$var$anyValue
|
|
109
|
+
],
|
|
110
|
+
top: [
|
|
111
|
+
"top",
|
|
112
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
113
|
+
],
|
|
114
|
+
bottom: [
|
|
115
|
+
"bottom",
|
|
116
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
117
|
+
],
|
|
118
|
+
start: [
|
|
119
|
+
$d3b73be57066120b$var$rtl("left", "right"),
|
|
120
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
121
|
+
],
|
|
122
|
+
end: [
|
|
123
|
+
$d3b73be57066120b$var$rtl("right", "left"),
|
|
124
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
125
|
+
],
|
|
126
|
+
left: [
|
|
127
|
+
"left",
|
|
128
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
129
|
+
],
|
|
130
|
+
right: [
|
|
131
|
+
"right",
|
|
132
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
133
|
+
],
|
|
134
|
+
order: [
|
|
135
|
+
"order",
|
|
136
|
+
$d3b73be57066120b$var$anyValue
|
|
137
|
+
],
|
|
138
|
+
flex: [
|
|
139
|
+
"flex",
|
|
140
|
+
$d3b73be57066120b$var$flexValue
|
|
141
|
+
],
|
|
142
|
+
flexGrow: [
|
|
143
|
+
"flexGrow",
|
|
144
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
145
|
+
],
|
|
146
|
+
flexShrink: [
|
|
147
|
+
"flexShrink",
|
|
148
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
149
|
+
],
|
|
150
|
+
flexBasis: [
|
|
151
|
+
"flexBasis",
|
|
152
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
153
|
+
],
|
|
154
|
+
gridArea: [
|
|
155
|
+
"gridArea",
|
|
156
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
157
|
+
],
|
|
158
|
+
gridColumn: [
|
|
159
|
+
"gridColumn",
|
|
160
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
161
|
+
],
|
|
162
|
+
gridColumnEnd: [
|
|
163
|
+
"gridColumnEnd",
|
|
164
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
165
|
+
],
|
|
166
|
+
gridColumnStart: [
|
|
167
|
+
"gridColumnStart",
|
|
168
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
169
|
+
],
|
|
170
|
+
gridRow: [
|
|
171
|
+
"gridRow",
|
|
172
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
173
|
+
],
|
|
174
|
+
gridRowEnd: [
|
|
175
|
+
"gridRowEnd",
|
|
176
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
177
|
+
],
|
|
178
|
+
gridRowStart: [
|
|
179
|
+
"gridRowStart",
|
|
180
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
181
|
+
]
|
|
182
|
+
};
|
|
183
|
+
const $d3b73be57066120b$export$e0705d1a55f297c = {
|
|
184
|
+
...$d3b73be57066120b$export$fe9c6e915565b4e8,
|
|
185
|
+
backgroundColor: [
|
|
186
|
+
"backgroundColor",
|
|
187
|
+
$d3b73be57066120b$var$backgroundColorValue
|
|
188
|
+
],
|
|
189
|
+
borderWidth: [
|
|
190
|
+
"borderWidth",
|
|
191
|
+
$d3b73be57066120b$var$borderSizeValue
|
|
192
|
+
],
|
|
193
|
+
borderStartWidth: [
|
|
194
|
+
$d3b73be57066120b$var$rtl("borderLeftWidth", "borderRightWidth"),
|
|
195
|
+
$d3b73be57066120b$var$borderSizeValue
|
|
196
|
+
],
|
|
197
|
+
borderEndWidth: [
|
|
198
|
+
$d3b73be57066120b$var$rtl("borderRightWidth", "borderLeftWidth"),
|
|
199
|
+
$d3b73be57066120b$var$borderSizeValue
|
|
200
|
+
],
|
|
201
|
+
borderLeftWidth: [
|
|
202
|
+
"borderLeftWidth",
|
|
203
|
+
$d3b73be57066120b$var$borderSizeValue
|
|
204
|
+
],
|
|
205
|
+
borderRightWidth: [
|
|
206
|
+
"borderRightWidth",
|
|
207
|
+
$d3b73be57066120b$var$borderSizeValue
|
|
208
|
+
],
|
|
209
|
+
borderTopWidth: [
|
|
210
|
+
"borderTopWidth",
|
|
211
|
+
$d3b73be57066120b$var$borderSizeValue
|
|
212
|
+
],
|
|
213
|
+
borderBottomWidth: [
|
|
214
|
+
"borderBottomWidth",
|
|
215
|
+
$d3b73be57066120b$var$borderSizeValue
|
|
216
|
+
],
|
|
217
|
+
borderXWidth: [
|
|
218
|
+
[
|
|
219
|
+
"borderLeftWidth",
|
|
220
|
+
"borderRightWidth"
|
|
221
|
+
],
|
|
222
|
+
$d3b73be57066120b$var$borderSizeValue
|
|
223
|
+
],
|
|
224
|
+
borderYWidth: [
|
|
225
|
+
[
|
|
226
|
+
"borderTopWidth",
|
|
227
|
+
"borderBottomWidth"
|
|
228
|
+
],
|
|
229
|
+
$d3b73be57066120b$var$borderSizeValue
|
|
230
|
+
],
|
|
231
|
+
borderColor: [
|
|
232
|
+
"borderColor",
|
|
233
|
+
$d3b73be57066120b$var$borderColorValue
|
|
234
|
+
],
|
|
235
|
+
borderStartColor: [
|
|
236
|
+
$d3b73be57066120b$var$rtl("borderLeftColor", "borderRightColor"),
|
|
237
|
+
$d3b73be57066120b$var$borderColorValue
|
|
238
|
+
],
|
|
239
|
+
borderEndColor: [
|
|
240
|
+
$d3b73be57066120b$var$rtl("borderRightColor", "borderLeftColor"),
|
|
241
|
+
$d3b73be57066120b$var$borderColorValue
|
|
242
|
+
],
|
|
243
|
+
borderLeftColor: [
|
|
244
|
+
"borderLeftColor",
|
|
245
|
+
$d3b73be57066120b$var$borderColorValue
|
|
246
|
+
],
|
|
247
|
+
borderRightColor: [
|
|
248
|
+
"borderRightColor",
|
|
249
|
+
$d3b73be57066120b$var$borderColorValue
|
|
250
|
+
],
|
|
251
|
+
borderTopColor: [
|
|
252
|
+
"borderTopColor",
|
|
253
|
+
$d3b73be57066120b$var$borderColorValue
|
|
254
|
+
],
|
|
255
|
+
borderBottomColor: [
|
|
256
|
+
"borderBottomColor",
|
|
257
|
+
$d3b73be57066120b$var$borderColorValue
|
|
258
|
+
],
|
|
259
|
+
borderXColor: [
|
|
260
|
+
[
|
|
261
|
+
"borderLeftColor",
|
|
262
|
+
"borderRightColor"
|
|
263
|
+
],
|
|
264
|
+
$d3b73be57066120b$var$borderColorValue
|
|
265
|
+
],
|
|
266
|
+
borderYColor: [
|
|
267
|
+
[
|
|
268
|
+
"borderTopColor",
|
|
269
|
+
"borderBottomColor"
|
|
270
|
+
],
|
|
271
|
+
$d3b73be57066120b$var$borderColorValue
|
|
272
|
+
],
|
|
273
|
+
borderRadius: [
|
|
274
|
+
"borderRadius",
|
|
275
|
+
$d3b73be57066120b$var$borderRadiusValue
|
|
276
|
+
],
|
|
277
|
+
borderTopStartRadius: [
|
|
278
|
+
$d3b73be57066120b$var$rtl("borderTopLeftRadius", "borderTopRightRadius"),
|
|
279
|
+
$d3b73be57066120b$var$borderRadiusValue
|
|
280
|
+
],
|
|
281
|
+
borderTopEndRadius: [
|
|
282
|
+
$d3b73be57066120b$var$rtl("borderTopRightRadius", "borderTopLeftRadius"),
|
|
283
|
+
$d3b73be57066120b$var$borderRadiusValue
|
|
284
|
+
],
|
|
285
|
+
borderBottomStartRadius: [
|
|
286
|
+
$d3b73be57066120b$var$rtl("borderBottomLeftRadius", "borderBottomRightRadius"),
|
|
287
|
+
$d3b73be57066120b$var$borderRadiusValue
|
|
288
|
+
],
|
|
289
|
+
borderBottomEndRadius: [
|
|
290
|
+
$d3b73be57066120b$var$rtl("borderBottomRightRadius", "borderBottomLeftRadius"),
|
|
291
|
+
$d3b73be57066120b$var$borderRadiusValue
|
|
292
|
+
],
|
|
293
|
+
borderTopLeftRadius: [
|
|
294
|
+
"borderTopLeftRadius",
|
|
295
|
+
$d3b73be57066120b$var$borderRadiusValue
|
|
296
|
+
],
|
|
297
|
+
borderTopRightRadius: [
|
|
298
|
+
"borderTopRightRadius",
|
|
299
|
+
$d3b73be57066120b$var$borderRadiusValue
|
|
300
|
+
],
|
|
301
|
+
borderBottomLeftRadius: [
|
|
302
|
+
"borderBottomLeftRadius",
|
|
303
|
+
$d3b73be57066120b$var$borderRadiusValue
|
|
304
|
+
],
|
|
305
|
+
borderBottomRightRadius: [
|
|
306
|
+
"borderBottomRightRadius",
|
|
307
|
+
$d3b73be57066120b$var$borderRadiusValue
|
|
308
|
+
],
|
|
309
|
+
padding: [
|
|
310
|
+
"padding",
|
|
311
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
312
|
+
],
|
|
313
|
+
paddingStart: [
|
|
314
|
+
$d3b73be57066120b$var$rtl("paddingLeft", "paddingRight"),
|
|
315
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
316
|
+
],
|
|
317
|
+
paddingEnd: [
|
|
318
|
+
$d3b73be57066120b$var$rtl("paddingRight", "paddingLeft"),
|
|
319
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
320
|
+
],
|
|
321
|
+
paddingLeft: [
|
|
322
|
+
"paddingLeft",
|
|
323
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
324
|
+
],
|
|
325
|
+
paddingRight: [
|
|
326
|
+
"paddingRight",
|
|
327
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
328
|
+
],
|
|
329
|
+
paddingTop: [
|
|
330
|
+
"paddingTop",
|
|
331
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
332
|
+
],
|
|
333
|
+
paddingBottom: [
|
|
334
|
+
"paddingBottom",
|
|
335
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
336
|
+
],
|
|
337
|
+
paddingX: [
|
|
338
|
+
[
|
|
339
|
+
"paddingLeft",
|
|
340
|
+
"paddingRight"
|
|
341
|
+
],
|
|
342
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
343
|
+
],
|
|
344
|
+
paddingY: [
|
|
345
|
+
[
|
|
346
|
+
"paddingTop",
|
|
347
|
+
"paddingBottom"
|
|
348
|
+
],
|
|
349
|
+
$d3b73be57066120b$export$abc24f5b99744ea6
|
|
350
|
+
],
|
|
351
|
+
overflow: [
|
|
352
|
+
"overflow",
|
|
353
|
+
$d3b73be57066120b$export$46b6c81d11d2c30a
|
|
354
|
+
]
|
|
355
|
+
};
|
|
356
|
+
const $d3b73be57066120b$var$borderStyleProps = {
|
|
357
|
+
borderWidth: "borderStyle",
|
|
358
|
+
borderLeftWidth: "borderLeftStyle",
|
|
359
|
+
borderRightWidth: "borderRightStyle",
|
|
360
|
+
borderTopWidth: "borderTopStyle",
|
|
361
|
+
borderBottomWidth: "borderBottomStyle"
|
|
362
|
+
};
|
|
363
|
+
function $d3b73be57066120b$var$rtl(ltr, rtl) {
|
|
364
|
+
return (direction)=>direction === "rtl" ? rtl : ltr;
|
|
365
|
+
}
|
|
366
|
+
const $d3b73be57066120b$var$UNIT_RE = /(%|px|em|rem|vw|vh|auto|cm|mm|in|pt|pc|ex|ch|rem|vmin|vmax|fr)$/;
|
|
367
|
+
const $d3b73be57066120b$var$FUNC_RE = /^\s*\w+\(/;
|
|
368
|
+
const $d3b73be57066120b$var$SPECTRUM_VARIABLE_RE = /(static-)?size-\d+|single-line-(height|width)/g;
|
|
369
|
+
function $d3b73be57066120b$export$abc24f5b99744ea6(value) {
|
|
370
|
+
if (typeof value === "number") return value + "px";
|
|
371
|
+
if (!value) return undefined;
|
|
372
|
+
if ($d3b73be57066120b$var$UNIT_RE.test(value)) return value;
|
|
373
|
+
if ($d3b73be57066120b$var$FUNC_RE.test(value)) return value.replace($d3b73be57066120b$var$SPECTRUM_VARIABLE_RE, "var(--spectrum-global-dimension-$&, var(--spectrum-alias-$&))");
|
|
374
|
+
return `var(--spectrum-global-dimension-${value}, var(--spectrum-alias-${value}))`;
|
|
375
|
+
}
|
|
376
|
+
function $d3b73be57066120b$export$f348bec194f2e6b5(value, matchedBreakpoints) {
|
|
377
|
+
value = $d3b73be57066120b$export$52dbfdbe1b2c3541(value, matchedBreakpoints);
|
|
378
|
+
return $d3b73be57066120b$export$abc24f5b99744ea6(value);
|
|
379
|
+
}
|
|
380
|
+
function $d3b73be57066120b$var$colorValue(value, type = "default", version = 5) {
|
|
381
|
+
if (version > 5) return `var(--spectrum-${value}, var(--spectrum-semantic-${value}-color-${type}))`;
|
|
382
|
+
return `var(--spectrum-legacy-color-${value}, var(--spectrum-global-color-${value}, var(--spectrum-semantic-${value}-color-${type})))`;
|
|
383
|
+
}
|
|
384
|
+
function $d3b73be57066120b$var$backgroundColorValue(value, version = 5) {
|
|
385
|
+
if (!value) return undefined;
|
|
386
|
+
return `var(--spectrum-alias-background-color-${value}, ${$d3b73be57066120b$var$colorValue(value, "background", version)})`;
|
|
387
|
+
}
|
|
388
|
+
function $d3b73be57066120b$var$borderColorValue(value, version = 5) {
|
|
389
|
+
if (!value) return undefined;
|
|
390
|
+
if (value === "default") return "var(--spectrum-alias-border-color)";
|
|
391
|
+
return `var(--spectrum-alias-border-color-${value}, ${$d3b73be57066120b$var$colorValue(value, "border", version)})`;
|
|
392
|
+
}
|
|
393
|
+
function $d3b73be57066120b$var$borderSizeValue(value) {
|
|
394
|
+
return value && value !== "none" ? `var(--spectrum-alias-border-size-${value})` : "0";
|
|
395
|
+
}
|
|
396
|
+
function $d3b73be57066120b$var$borderRadiusValue(value) {
|
|
397
|
+
if (!value) return undefined;
|
|
398
|
+
return `var(--spectrum-alias-border-radius-${value})`;
|
|
399
|
+
}
|
|
400
|
+
function $d3b73be57066120b$var$hiddenValue(value) {
|
|
401
|
+
return value ? "none" : undefined;
|
|
402
|
+
}
|
|
403
|
+
function $d3b73be57066120b$var$anyValue(value) {
|
|
404
|
+
return value;
|
|
405
|
+
}
|
|
406
|
+
function $d3b73be57066120b$var$flexValue(value) {
|
|
407
|
+
if (typeof value === "boolean") return value ? "1" : undefined;
|
|
408
|
+
return "" + value;
|
|
409
|
+
}
|
|
410
|
+
function $d3b73be57066120b$export$f3c39bb9534218d0(props, handlers, direction, matchedBreakpoints) {
|
|
411
|
+
let style = {};
|
|
412
|
+
for(let key in props){
|
|
413
|
+
let styleProp = handlers[key];
|
|
414
|
+
if (!styleProp || props[key] == null) continue;
|
|
415
|
+
let [name, convert] = styleProp;
|
|
416
|
+
if (typeof name === "function") name = name(direction);
|
|
417
|
+
let prop = $d3b73be57066120b$export$52dbfdbe1b2c3541(props[key], matchedBreakpoints);
|
|
418
|
+
let value = convert(prop, props.colorVersion);
|
|
419
|
+
if (Array.isArray(name)) for (let k of name)style[k] = value;
|
|
420
|
+
else style[name] = value;
|
|
421
|
+
}
|
|
422
|
+
for(let prop in $d3b73be57066120b$var$borderStyleProps)if (style[prop]) {
|
|
423
|
+
style[$d3b73be57066120b$var$borderStyleProps[prop]] = "solid";
|
|
424
|
+
style.boxSizing = "border-box";
|
|
425
|
+
}
|
|
426
|
+
return style;
|
|
427
|
+
}
|
|
428
|
+
function $d3b73be57066120b$export$b8e6fb9d2dff3f41(props, handlers = $d3b73be57066120b$export$fe9c6e915565b4e8, options = {}) {
|
|
429
|
+
let { UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style, ...otherProps } = props;
|
|
430
|
+
let breakpointProvider = (0, $893a66ba513f4a66$exports.useBreakpoint)();
|
|
431
|
+
let { direction: direction } = (0, $5XTxG$reactariai18n.useLocale)();
|
|
432
|
+
let { matchedBreakpoints: matchedBreakpoints = (breakpointProvider === null || breakpointProvider === void 0 ? void 0 : breakpointProvider.matchedBreakpoints) || [
|
|
433
|
+
"base"
|
|
434
|
+
] } = options;
|
|
435
|
+
let styles = $d3b73be57066120b$export$f3c39bb9534218d0(props, handlers, direction, matchedBreakpoints);
|
|
436
|
+
let style = {
|
|
437
|
+
...UNSAFE_style,
|
|
438
|
+
...styles
|
|
439
|
+
};
|
|
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.");
|
|
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.");
|
|
444
|
+
let styleProps = {
|
|
445
|
+
style: style,
|
|
446
|
+
className: UNSAFE_className
|
|
447
|
+
};
|
|
448
|
+
if ($d3b73be57066120b$export$52dbfdbe1b2c3541(props.isHidden, matchedBreakpoints)) styleProps.hidden = true;
|
|
449
|
+
return {
|
|
450
|
+
styleProps: styleProps
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function $d3b73be57066120b$export$46b6c81d11d2c30a(value) {
|
|
454
|
+
return value;
|
|
455
|
+
}
|
|
456
|
+
function $d3b73be57066120b$export$52dbfdbe1b2c3541(prop, matchedBreakpoints) {
|
|
457
|
+
if (prop && typeof prop === "object" && !Array.isArray(prop)) {
|
|
458
|
+
for(let i = 0; i < matchedBreakpoints.length; i++){
|
|
459
|
+
let breakpoint = matchedBreakpoints[i];
|
|
460
|
+
if (prop[breakpoint] != null) return prop[breakpoint];
|
|
461
|
+
}
|
|
462
|
+
return prop.base;
|
|
463
|
+
}
|
|
464
|
+
return prop;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
//# sourceMappingURL=styleProps.main.js.map
|
|
@@ -0,0 +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;QA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AC,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;\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 value = getResponsiveProp(value, matchedBreakpoints);\n return dimensionValue(value);\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 {\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"}
|