@onesy/ui-react
Version:
UI for React
60 lines • 2.73 kB
JavaScript
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
const _excluded = ["values", "smooth", "smoothRatio", "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 LineChartItemElement from '../LineChartItem';
import { staticClassName } from '../utils';
import { jsx as _jsx } from "react/jsx-runtime";
const useStyle = styleMethod(theme => ({
root: {}
}), {
name: 'onesy-LineChart'
});
const LineChart = props_ => {
const $ = _c(6);
const theme = useOnesyTheme();
const props = _objectSpread(_objectSpread(_objectSpread({}, theme?.ui?.elements?.all?.props?.default), theme?.ui?.elements?.onesyLineChart?.props?.default), props_);
const Chart = theme?.elements?.Chart || ChartElement;
const LineChartItem = theme?.elements?.LineChartItem || LineChartItemElement;
const {
values,
smooth,
smoothRatio,
className
} = props,
other = _objectWithoutProperties(props, _excluded);
const {
classes
} = useStyle();
const t0 = classNames([staticClassName("LineChart", theme) && ["onesy-LineChart-root"], className, classes.root]);
const t1 = is("array", values) && values.map((item, index) => /*#__PURE__*/_jsx(LineChartItem, _objectSpread({
smooth: smooth,
smoothRatio: smoothRatio
}, 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;
};
LineChart.displayName = 'onesy-LineChart';
export default LineChart;