UNPKG

@onesy/ui-react

Version:
98 lines 3.6 kB
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; const _excluded = ["values", "separator", "ItemProps", "SeparatorProps", "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 as styleMethod, useOnesyTheme } from '@onesy/style-react'; import TypeElement from '../Type'; import LineElement from '../Line'; import { staticClassName } from '../utils'; import { jsx as _jsx } from "react/jsx-runtime"; const useStyle = styleMethod(theme => ({ root: { overflow: 'auto hidden', '& > *': { flex: '0 0 auto' } } }), { name: 'onesy-Meta' }); const Meta = props_ => { const $ = _c(7); const theme = useOnesyTheme(); const props = _objectSpread(_objectSpread(_objectSpread({}, theme?.ui?.elements?.all?.props?.default), theme?.ui?.elements?.onesyMeta?.props?.default), props_); const Line = theme?.elements?.Line || LineElement; const Type = theme?.elements?.Type || TypeElement; const { values: t0, separator: t1, ItemProps, SeparatorProps, className, children } = props, other = _objectWithoutProperties(props, _excluded); const values_ = t0 === undefined ? [] : t0; const separator_ = t1 === undefined ? "\u2022" : t1; const { classes } = useStyle(); const separator = is("string", separator_) ? /*#__PURE__*/_jsx(Type, _objectSpread(_objectSpread({ version: "b3", priority: "secondary" }, SeparatorProps), {}, { children: separator_ })) : separator_; let t2; if ($[0] !== Type) { t2 = (item, index) => { if (is("simple", item)) { return /*#__PURE__*/_jsx(Type, { version: "b3", priority: "secondary", children: item }, index); } return /*#__PURE__*/React.cloneElement(item, { key: index }); }; $[0] = Type; $[1] = t2; } else { t2 = $[1]; } const getItem = t2; const values = values_?.filter(Boolean)?.flatMap((item_0, index_0) => !index_0 ? getItem(item_0, index_0) : [separator, getItem(item_0, index_0)]); const t3 = 1; const t4 = "row"; const t5 = "center"; const t6 = "flex-start"; const t7 = classNames([staticClassName("Meta", theme) && ["onesy-Meta-root"], className, classes.root]); let t8; if ($[2] !== Line || $[3] !== other || $[4] !== t7 || $[5] !== values) { t8 = /*#__PURE__*/_jsx(Line, _objectSpread(_objectSpread({ gap: t3, direction: t4, align: t5, justify: t6, className: t7 }, other), {}, { children: values })); $[2] = Line; $[3] = other; $[4] = t7; $[5] = values; $[6] = t8; } else { t8 = $[6]; } return t8; }; Meta.displayName = 'onesy-Meta'; export default Meta;