UNPKG

@react-spectrum/s2

Version:
99 lines (91 loc) 4.25 kB
import "./Divider.css"; import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs"; import {jsx as $5nGzy$jsx} from "react/jsx-runtime"; import {Separator as $5nGzy$Separator} from "react-aria-components"; import {createContext as $5nGzy$createContext, forwardRef as $5nGzy$forwardRef} from "react"; import {useDOMRef as $5nGzy$useDOMRef} from "@react-spectrum/utils"; /* * Copyright 2024 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ const $bdf52657dac0f070$export$30fbfd376abdf190 = /*#__PURE__*/ (0, $5nGzy$createContext)(null); const $bdf52657dac0f070$export$e8c9778bf415dd08 = function anonymous(props, overrides) { let rules = " "; let alignSelf = false; let marginTop = false; let marginBottom = false; let marginInlineStart = false; let marginInlineEnd = false; let flexGrow = false; let flexShrink = false; let width = false; let matches = (overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|Z|N|L)[^\s]+/g); for (let p of matches){ if (p[1] === "_d") alignSelf = true; if (p[1] === "J") marginTop = true; if (p[1] === "G") marginBottom = true; if (p[1] === "I") marginInlineStart = true; if (p[1] === "H") marginInlineEnd = true; if (p[1] === "_u") flexGrow = true; if (p[1] === "_v") flexShrink = true; if (p[1] === "Z") width = true; rules += p[0]; } if (props.staticColor === "white") rules += ' -Ovbhqd-gcwrnr91'; else if (props.staticColor === "black") rules += ' -Ovbhqd-g4hn3s91'; if (!alignSelf) rules += ' _df91'; if (props.isStaticColor) { if (props.size === "L") rules += ' gi91'; else rules += ' gg91'; } else if (props.size === "L") rules += ' g091'; else rules += ' gF91'; rules += ' gl_a91'; rules += ' _je91'; rules += ' og91'; rules += ' ng91'; rules += ' kg91'; rules += ' jg91'; if (!marginTop) rules += ' Jy91'; if (!marginBottom) rules += ' Gy91'; if (!marginInlineStart) rules += ' Iy91'; if (!marginInlineEnd) rules += ' Hy91'; if (!flexGrow) rules += ' _ua91'; if (!flexShrink) rules += ' _va91'; if (props.orientation === "horizontal") { if (props.size === "L") rules += ' FT4Nfn91'; else if (props.size === "S") rules += ' FceNfn91'; else rules += ' FLvNfn91'; } if (props.orientation === "vertical") { if (props.size === "L") { if (!width) rules += ' ZT4Nfn91'; } else if (props.size === "S") { if (!width) rules += ' ZceNfn91'; } else if (!width) rules += ' ZLvNfn91'; } return rules; }; const $bdf52657dac0f070$export$2e0a83ec2e27ecbb = /*#__PURE__*/ (0, $5nGzy$forwardRef)(function Divider(props, ref) { [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $bdf52657dac0f070$export$30fbfd376abdf190); let domRef = (0, $5nGzy$useDOMRef)(ref); return /*#__PURE__*/ (0, $5nGzy$jsx)((0, $5nGzy$Separator), { ...props, ref: domRef, style: props.UNSAFE_style, className: (props.UNSAFE_className || '') + $bdf52657dac0f070$export$e8c9778bf415dd08({ size: props.size || 'M', orientation: props.orientation || 'horizontal', staticColor: props.staticColor, isStaticColor: !!props.staticColor }, props.styles) }); }); export {$bdf52657dac0f070$export$30fbfd376abdf190 as DividerContext, $bdf52657dac0f070$export$e8c9778bf415dd08 as divider, $bdf52657dac0f070$export$2e0a83ec2e27ecbb as Divider}; //# sourceMappingURL=Divider.mjs.map