Files
pole-book/server/node_modules/@radix-ui/react-separator/dist/index.mjs

61 lines
2.9 KiB
JavaScript

import $5WXm8$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
import {forwardRef as $5WXm8$forwardRef, createElement as $5WXm8$createElement} from "react";
import {Primitive as $5WXm8$Primitive} from "@radix-ui/react-primitive";
/* -------------------------------------------------------------------------------------------------
* Separator
* -----------------------------------------------------------------------------------------------*/ const $89eedd556c436f6a$var$NAME = 'Separator';
const $89eedd556c436f6a$var$DEFAULT_ORIENTATION = 'horizontal';
const $89eedd556c436f6a$var$ORIENTATIONS = [
'horizontal',
'vertical'
];
const $89eedd556c436f6a$export$1ff3c3f08ae963c0 = /*#__PURE__*/ $5WXm8$forwardRef((props, forwardedRef)=>{
const { decorative: decorative , orientation: orientationProp = $89eedd556c436f6a$var$DEFAULT_ORIENTATION , ...domProps } = props;
const orientation = $89eedd556c436f6a$var$isValidOrientation(orientationProp) ? orientationProp : $89eedd556c436f6a$var$DEFAULT_ORIENTATION; // `aria-orientation` defaults to `horizontal` so we only need it if `orientation` is vertical
const ariaOrientation = orientation === 'vertical' ? orientation : undefined;
const semanticProps = decorative ? {
role: 'none'
} : {
'aria-orientation': ariaOrientation,
role: 'separator'
};
return /*#__PURE__*/ $5WXm8$createElement($5WXm8$Primitive.div, $5WXm8$babelruntimehelpersesmextends({
"data-orientation": orientation
}, semanticProps, domProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($89eedd556c436f6a$export$1ff3c3f08ae963c0, {
displayName: $89eedd556c436f6a$var$NAME
});
$89eedd556c436f6a$export$1ff3c3f08ae963c0.propTypes = {
orientation (props, propName, componentName) {
const propValue = props[propName];
const strVal = String(propValue);
if (propValue && !$89eedd556c436f6a$var$isValidOrientation(propValue)) return new Error($89eedd556c436f6a$var$getInvalidOrientationError(strVal, componentName));
return null;
}
};
/* -----------------------------------------------------------------------------------------------*/ // Split this out for clearer readability of the error message.
function $89eedd556c436f6a$var$getInvalidOrientationError(value, componentName) {
return `Invalid prop \`orientation\` of value \`${value}\` supplied to \`${componentName}\`, expected one of:
- horizontal
- vertical
Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
}
function $89eedd556c436f6a$var$isValidOrientation(orientation) {
return $89eedd556c436f6a$var$ORIENTATIONS.includes(orientation);
}
const $89eedd556c436f6a$export$be92b6f5f03c0fe9 = $89eedd556c436f6a$export$1ff3c3f08ae963c0;
export {$89eedd556c436f6a$export$1ff3c3f08ae963c0 as Separator, $89eedd556c436f6a$export$be92b6f5f03c0fe9 as Root};
//# sourceMappingURL=index.mjs.map