@react-spectrum/s2
Version:
Spectrum 2 UI components in React
106 lines (96 loc) • 4.46 kB
JavaScript
require("./Divider.css");
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
var $98jss$reactjsxruntime = require("react/jsx-runtime");
var $98jss$reactariacomponents = require("react-aria-components");
var $98jss$react = require("react");
var $98jss$reactspectrumutils = require("@react-spectrum/utils");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "DividerContext", () => $2d04acb918636de0$export$30fbfd376abdf190);
$parcel$export(module.exports, "divider", () => $2d04acb918636de0$export$e8c9778bf415dd08);
$parcel$export(module.exports, "Divider", () => $2d04acb918636de0$export$2e0a83ec2e27ecbb);
/*
* 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 $2d04acb918636de0$export$30fbfd376abdf190 = /*#__PURE__*/ (0, $98jss$react.createContext)(null);
const $2d04acb918636de0$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 $2d04acb918636de0$export$2e0a83ec2e27ecbb = /*#__PURE__*/ (0, $98jss$react.forwardRef)(function Divider(props, ref) {
[props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $2d04acb918636de0$export$30fbfd376abdf190);
let domRef = (0, $98jss$reactspectrumutils.useDOMRef)(ref);
return /*#__PURE__*/ (0, $98jss$reactjsxruntime.jsx)((0, $98jss$reactariacomponents.Separator), {
...props,
ref: domRef,
style: props.UNSAFE_style,
className: (props.UNSAFE_className || '') + $2d04acb918636de0$export$e8c9778bf415dd08({
size: props.size || 'M',
orientation: props.orientation || 'horizontal',
staticColor: props.staticColor,
isStaticColor: !!props.staticColor
}, props.styles)
});
});
//# sourceMappingURL=Divider.cjs.map