UNPKG

@onesy/ui-react

Version:
75 lines 3.25 kB
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; const _excluded = ["tonal", "color", "size", "Component", "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 { 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: {}, size_small: { padding: theme.methods.space.value(2, 'px') }, size_regular: { padding: `${theme.methods.space.value(3, 'px')} ${theme.methods.space.value(2, 'px')}` }, size_large: { padding: `${theme.methods.space.value(4, 'px')} ${theme.methods.space.value(3, 'px')}` } }), { name: 'onesy-TableHeader' }); const TableHeader = props_ => { const $ = _c(8); const theme = useOnesyTheme(); const props = _objectSpread(_objectSpread(_objectSpread({}, theme?.ui?.elements?.all?.props?.default), theme?.ui?.elements?.onesyTableHeader?.props?.default), props_); const Line = theme?.elements?.Line || LineElement; const Surface = theme?.elements?.Surface || SurfaceElement; const { tonal: t0, color: t1, size: t2, Component: t3, className, children } = props, other = _objectWithoutProperties(props, _excluded); const tonal = t0 === undefined ? true : t0; const color = t1 === undefined ? "themed" : t1; const size = t2 === undefined ? "regular" : t2; const Component = t3 === undefined ? Line : t3; const { classes } = useStyle(); const t4 = Surface; const t5 = classNames([staticClassName("TableHeader", theme) && ["onesy-TableHeader-root", `onesy-TableHeader-size-${size}`], className, classes.root, classes[`size_${size}`]]); let t6; if ($[0] !== Component || $[1] !== children || $[2] !== color || $[3] !== other || $[4] !== t4 || $[5] !== t5 || $[6] !== tonal) { t6 = /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({ tonal: tonal, color: color, Component: t4, className: t5 }, other), {}, { children: children })); $[0] = Component; $[1] = children; $[2] = color; $[3] = other; $[4] = t4; $[5] = t5; $[6] = tonal; $[7] = t6; } else { t6 = $[7]; } return t6; }; TableHeader.displayName = 'onesy-TableHeader'; export default TableHeader;