@onesy/ui-react
Version:
UI for React
115 lines • 4.17 kB
JavaScript
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
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) { _defineProperty(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; }
import { c as _c } from "react/compiler-runtime";
import React from 'react';
import { classNames, style as styleMethod, useOnesyTheme } from '@onesy/style-react';
import LineElement from '../Line';
import SurfaceElement from '../Surface';
import { staticClassName } from '../utils';
import { jsx as _jsx } from "react/jsx-runtime";
const useStyle = styleMethod(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_ => {
const $ = _c(12);
const theme = useOnesyTheme();
const props = _objectSpread(_objectSpread(_objectSpread({}, theme?.ui?.elements?.all?.props?.default), theme?.ui?.elements?.onesyBottomAppBar?.props?.default), props_);
const Line = theme?.elements?.Line || LineElement;
const Surface = theme?.elements?.Surface || SurfaceElement;
const {
tonal: t0,
color: t1,
size: t2,
fixed: t3,
className,
style,
children
} = props,
other = _objectWithoutProperties(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 = classNames([staticClassName("BottomAppBar", theme) && ["onesy-BottomAppBar-root", `onesy-BottomAppBar-size-${size}`], className, classes.root, classes[`size_${size}`], fixed && classes.fixed]);
const t10 = `clamp(100px, ${(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__*/_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';
export default BottomAppBar;