@onesy/ui-react
Version:
UI for React
67 lines • 2.76 kB
JavaScript
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
const _excluded = ["divider", "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 { style as styleMethod, classNames, useOnesyTheme } from '@onesy/style-react';
import LineElement from '../Line';
import { staticClassName } from '../utils';
import { jsx as _jsx } from "react/jsx-runtime";
const useStyle = styleMethod(theme => ({
root: {}
}), {
name: 'onesy-Forms'
});
const Forms = props_ => {
const $ = _c(5);
const theme = useOnesyTheme();
const props = _objectSpread(_objectSpread(_objectSpread({}, theme?.ui?.elements?.all?.props?.default), theme?.ui?.elements?.onesyForms?.props?.default), props_);
const Line = theme?.elements?.Line || LineElement;
const {
divider,
Component: t0,
className,
children: children_
} = props,
other = _objectWithoutProperties(props, _excluded);
const Component = t0 === undefined ? Line : t0;
const {
classes
} = useStyle();
const children = React.Children.toArray(children_);
const t1 = 4;
const t2 = "column";
const t3 = "unset";
const t4 = "unset";
const t5 = true;
const t6 = classNames([staticClassName("Forms", theme) && ["onesy-Forms-root"], className, classes.root]);
const t7 = children.map((form, index) => /*#__PURE__*/React.cloneElement(form, {
key: index,
divider: index < children.length - 1
}));
let t8;
if ($[0] !== Component || $[1] !== other || $[2] !== t6 || $[3] !== t7) {
t8 = /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({
gap: t1,
direction: t2,
justify: t3,
align: t4,
fullWidth: t5,
className: t6
}, other), {}, {
children: t7
}));
$[0] = Component;
$[1] = other;
$[2] = t6;
$[3] = t7;
$[4] = t8;
} else {
t8 = $[4];
}
return t8;
};
Forms.displayName = 'onesy-Forms';
export default Forms;