FrontPastel/node_modules/@mui/material/node/OutlinedInput/NotchedOutline.js

143 lines
4.6 KiB
JavaScript
Raw Normal View History

2024-04-17 13:55:11 +00:00
"use strict";
'use client';
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = NotchedOutline;
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var React = _interopRequireWildcard(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _styled = _interopRequireWildcard(require("../styles/styled"));
var _jsxRuntime = require("react/jsx-runtime");
var _span;
const _excluded = ["children", "classes", "className", "label", "notched"];
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
const NotchedOutlineRoot = (0, _styled.default)('fieldset', {
shouldForwardProp: _styled.rootShouldForwardProp
})({
textAlign: 'left',
position: 'absolute',
bottom: 0,
right: 0,
top: -5,
left: 0,
margin: 0,
padding: '0 8px',
pointerEvents: 'none',
borderRadius: 'inherit',
borderStyle: 'solid',
borderWidth: 1,
overflow: 'hidden',
minWidth: '0%'
});
const NotchedOutlineLegend = (0, _styled.default)('legend', {
shouldForwardProp: _styled.rootShouldForwardProp
})(({
ownerState,
theme
}) => (0, _extends2.default)({
float: 'unset',
// Fix conflict with bootstrap
width: 'auto',
// Fix conflict with bootstrap
overflow: 'hidden'
}, !ownerState.withLabel && {
padding: 0,
lineHeight: '11px',
// sync with `height` in `legend` styles
transition: theme.transitions.create('width', {
duration: 150,
easing: theme.transitions.easing.easeOut
})
}, ownerState.withLabel && (0, _extends2.default)({
display: 'block',
// Fix conflict with normalize.css and sanitize.css
padding: 0,
height: 11,
// sync with `lineHeight` in `legend` styles
fontSize: '0.75em',
visibility: 'hidden',
maxWidth: 0.01,
transition: theme.transitions.create('max-width', {
duration: 50,
easing: theme.transitions.easing.easeOut
}),
whiteSpace: 'nowrap',
'& > span': {
paddingLeft: 5,
paddingRight: 5,
display: 'inline-block',
opacity: 0,
visibility: 'visible'
}
}, ownerState.notched && {
maxWidth: '100%',
transition: theme.transitions.create('max-width', {
duration: 100,
easing: theme.transitions.easing.easeOut,
delay: 50
})
})));
/**
* @ignore - internal component.
*/
function NotchedOutline(props) {
const {
className,
label,
notched
} = props,
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
const withLabel = label != null && label !== '';
const ownerState = (0, _extends2.default)({}, props, {
notched,
withLabel
});
return /*#__PURE__*/(0, _jsxRuntime.jsx)(NotchedOutlineRoot, (0, _extends2.default)({
"aria-hidden": true,
className: className,
ownerState: ownerState
}, other, {
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(NotchedOutlineLegend, {
ownerState: ownerState,
children: withLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
children: label
}) : // notranslate needed while Google Translate will not fix zero-width space issue
_span || (_span = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
className: "notranslate",
children: "\u200B"
}))
})
}));
}
process.env.NODE_ENV !== "production" ? NotchedOutline.propTypes = {
/**
* The content of the component.
*/
children: _propTypes.default.node,
/**
* Override or extend the styles applied to the component.
*/
classes: _propTypes.default.object,
/**
* @ignore
*/
className: _propTypes.default.string,
/**
* The label.
*/
label: _propTypes.default.node,
/**
* If `true`, the outline is notched to accommodate the label.
*/
notched: _propTypes.default.bool.isRequired,
/**
* @ignore
*/
style: _propTypes.default.object
} : void 0;