UNPKG

@onesy/ui-react

Version:
147 lines 5.18 kB
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; const _excluded = ["name", "title", "render", "Icon", "IconProps", "IconButtonProps", "TitleProps", "ContainerProps", "TooltipProps", "className", "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 { is } from '@onesy/utils'; import { classNames, style, useOnesyTheme } from '@onesy/style-react'; import IconMaterialInfo from '@onesy/icons-material-rounded-react/IconMaterialInfoW100'; import IconButtonElement from '../IconButton'; import LineElement from '../Line'; import MenuElement from '../Menu'; import TooltipElement from '../Tooltip'; import TypeElement from '../Type'; import { staticClassName } from '../utils'; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; const useStyle = style(theme => ({ root: {}, menu: { width: '100vw', maxWidth: '195px', background: theme.palette.light ? theme.palette.background.default.primary : theme.palette.background.default.quaternary, borderRadius: theme.methods.shape.radius.value(2), boxShadow: theme.shadows.values.default[1], padding: '16px', '& .onesy-Type-root': { whiteSpace: 'normal' } } }), { name: 'onesy-Info' }); const Info = props_ => { const $ = _c(21); const theme = useOnesyTheme(); const l = theme.l; const props = _objectSpread(_objectSpread(_objectSpread({}, theme?.ui?.elements?.all?.props?.default), theme?.ui?.elements?.onesyInfo?.props?.default), props_); const IconButton = theme?.elements?.IconButton || IconButtonElement; const Line = theme?.elements?.Line || LineElement; const Menu = theme?.elements?.Menu || MenuElement; const Tooltip = theme?.elements?.Tooltip || TooltipElement; const Type = theme?.elements?.Type || TypeElement; const { name, title, render, Icon: t0, IconProps, IconButtonProps, TitleProps, ContainerProps, TooltipProps, className, children } = props, other = _objectWithoutProperties(props, _excluded); const Icon = t0 === undefined ? IconMaterialInfo : t0; const { classes } = useStyle(); const t1 = "center"; const t2 = is("function", render) ? render() : /*#__PURE__*/_jsx(Line, { gap: 1, fullWidth: true, className: classNames([staticClassName("Info", theme) && ["onesy-Info-menu"], classes.menu]), children: /*#__PURE__*/_jsxs(Line, _objectSpread(_objectSpread({ gap: 1, fullWidth: true }, ContainerProps), {}, { children: [/*#__PURE__*/_jsx(Type, _objectSpread(_objectSpread({ version: "l2" }, TitleProps), {}, { children: title })), children] })) }); const t3 = classNames([staticClassName("Info", theme) && ["onesy-Info-root"], className, classes.root]); let t4; if ($[0] !== l || $[1] !== name) { t4 = name !== undefined ? name : l("Info"); $[0] = l; $[1] = name; $[2] = t4; } else { t4 = $[2]; } let t5; if ($[3] !== Icon || $[4] !== IconProps) { t5 = /*#__PURE__*/_jsx(Icon, _objectSpread({}, IconProps)); $[3] = Icon; $[4] = IconProps; $[5] = t5; } else { t5 = $[5]; } let t6; if ($[6] !== IconButton || $[7] !== IconButtonProps || $[8] !== t5) { t6 = /*#__PURE__*/_jsx(IconButton, _objectSpread(_objectSpread({}, IconButtonProps), {}, { children: t5 })); $[6] = IconButton; $[7] = IconButtonProps; $[8] = t5; $[9] = t6; } else { t6 = $[9]; } let t7; if ($[10] !== Tooltip || $[11] !== TooltipProps || $[12] !== t4 || $[13] !== t6) { t7 = /*#__PURE__*/_jsx("span", { children: /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({ name: t4 }, TooltipProps), {}, { children: t6 })) }); $[10] = Tooltip; $[11] = TooltipProps; $[12] = t4; $[13] = t6; $[14] = t7; } else { t7 = $[14]; } let t8; if ($[15] !== Menu || $[16] !== other || $[17] !== t2 || $[18] !== t3 || $[19] !== t7) { t8 = /*#__PURE__*/_jsx(Menu, _objectSpread(_objectSpread({ alignment: t1, name: t2, className: t3 }, other), {}, { children: t7 })); $[15] = Menu; $[16] = other; $[17] = t2; $[18] = t3; $[19] = t7; $[20] = t8; } else { t8 = $[20]; } return t8; }; Info.displayName = 'onesy-Info'; export default Info;