@onesy/ui-react
Version:
UI for React
123 lines (122 loc) • 5.53 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _compilerRuntime = require("react/compiler-runtime");
var _react = _interopRequireDefault(require("react"));
var _styleReact = require("@onesy/style-react");
var _Line = _interopRequireDefault(require("../Line"));
var _Surface = _interopRequireDefault(require("../Surface"));
var _utils = require("../utils");
var _jsxRuntime = require("react/jsx-runtime");
const _excluded = ["tonal", "color", "size", "fixed", "className", "style", "children"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
const useStyle = (0, _styleReact.style)(theme => ({
root: {
background: theme.methods.palette.color.alpha(theme.palette.color.primary[theme.palette.light ? 100 : 5], 0.94),
boxShadow: '0px 8px 10px 1px rgb(0 0 0 / 1%), 0px 3px 14px 2px rgb(0 0 0 / 1%), 0px 5px 5px -3px rgb(0 0 0 / 4%)',
borderRadius: '500px',
zIndex: theme.z_index.app_bar,
overflow: 'auto hidden',
'&::-webkit-scrollbar': {
width: '0px',
height: '0px'
}
},
size_small: {
padding: '6px 10px'
},
size_regular: {
padding: '12px 20px'
},
size_large: {
padding: '18px 30px'
},
fixed: {
position: 'fixed',
bottom: '12px',
left: '50%',
transform: 'translateX(-50%)'
}
}), {
name: 'onesy-BottomAppBar'
});
const BottomAppBar = props_ => {
var _theme$ui, _theme$ui2, _theme$elements, _theme$elements2;
const $ = (0, _compilerRuntime.c)(12);
const theme = (0, _styleReact.useOnesyTheme)();
const props = _objectSpread(_objectSpread(_objectSpread({}, theme === null || theme === void 0 || (_theme$ui = theme.ui) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.elements) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.all) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.props) === null || _theme$ui === void 0 ? void 0 : _theme$ui.default), theme === null || theme === void 0 || (_theme$ui2 = theme.ui) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.elements) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.onesyBottomAppBar) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.props) === null || _theme$ui2 === void 0 ? void 0 : _theme$ui2.default), props_);
const Line = (theme === null || theme === void 0 || (_theme$elements = theme.elements) === null || _theme$elements === void 0 ? void 0 : _theme$elements.Line) || _Line.default;
const Surface = (theme === null || theme === void 0 || (_theme$elements2 = theme.elements) === null || _theme$elements2 === void 0 ? void 0 : _theme$elements2.Surface) || _Surface.default;
const {
tonal: t0,
color: t1,
size: t2,
fixed: t3,
className,
style,
children
} = props,
other = (0, _objectWithoutProperties2.default)(props, _excluded);
const tonal = t0 === undefined ? true : t0;
const color = t1 === undefined ? "default" : t1;
const size = t2 === undefined ? "regular" : t2;
const fixed = t3 === undefined ? true : t3;
const {
classes
} = useStyle();
const t4 = 0;
const t5 = "row";
const t6 = "unset";
const t7 = "unset";
const t8 = true;
const t9 = (0, _styleReact.classNames)([(0, _utils.staticClassName)("BottomAppBar", theme) && ["onesy-BottomAppBar-root", `onesy-BottomAppBar-size-${size}`], className, classes.root, classes[`size_${size}`], fixed && classes.fixed]);
const t10 = `clamp(100px, ${((children === null || children === void 0 ? void 0 : children.length) || 3) * 110}px, calc(100vw - 24px))`;
let t11;
if ($[0] !== style || $[1] !== t10) {
t11 = _objectSpread({
maxWidth: t10
}, style);
$[0] = style;
$[1] = t10;
$[2] = t11;
} else {
t11 = $[2];
}
let t12;
if ($[3] !== Line || $[4] !== Surface || $[5] !== children || $[6] !== color || $[7] !== other || $[8] !== t11 || $[9] !== t9 || $[10] !== tonal) {
t12 = /*#__PURE__*/(0, _jsxRuntime.jsx)(Surface, _objectSpread(_objectSpread({
color: color,
tonal: tonal,
gap: t4,
direction: t5,
align: t6,
justify: t7,
Component: Line,
fullWidth: t8,
className: t9,
style: t11
}, other), {}, {
children: children
}));
$[3] = Line;
$[4] = Surface;
$[5] = children;
$[6] = color;
$[7] = other;
$[8] = t11;
$[9] = t9;
$[10] = tonal;
$[11] = t12;
} else {
t12 = $[11];
}
return t12;
};
BottomAppBar.displayName = 'onesy-BottomAppBar';
var _default = exports.default = BottomAppBar;