UNPKG

@onesy/ui-react

Version:
55 lines 2.66 kB
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; const _excluded = ["values", "className"]; 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 ChartElement from '../Chart'; import ScatterChartItemElement from '../ScatterChartItem'; import { staticClassName } from '../utils'; import { jsx as _jsx } from "react/jsx-runtime"; const useStyle = styleMethod(theme => ({ root: {} }), { name: 'onesy-ScatterChart' }); const ScatterChart = props_ => { const $ = _c(6); const theme = useOnesyTheme(); const props = _objectSpread(_objectSpread(_objectSpread({}, theme?.ui?.elements?.all?.props?.default), theme?.ui?.elements?.onesyScatterChart?.props?.default), props_); const Chart = theme?.elements?.Chart || ChartElement; const ScatterChartItem = theme?.elements?.ScatterChartItem || ScatterChartItemElement; const { values, className } = props, other = _objectWithoutProperties(props, _excluded); const { classes } = useStyle(); const t0 = classNames([staticClassName("ScatterChart", theme) && ["onesy-ScatterChart-root"], className, classes.root]); const t1 = is("array", values) && values.map((item, index) => /*#__PURE__*/_jsx(ScatterChartItem, _objectSpread({}, item), index)); let t2; if ($[0] !== Chart || $[1] !== other || $[2] !== t0 || $[3] !== t1 || $[4] !== values) { t2 = /*#__PURE__*/_jsx(Chart, _objectSpread(_objectSpread({ values: values, className: t0 }, other), {}, { children: t1 })); $[0] = Chart; $[1] = other; $[2] = t0; $[3] = t1; $[4] = values; $[5] = t2; } else { t2 = $[5]; } return t2; }; ScatterChart.displayName = 'onesy-ScatterChart'; export default ScatterChart;