@trackunit/react-components 0.0.50 → 0.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +10 -24
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1308,6 +1308,8 @@ const Chart = ({
1308
1308
  timezoneLabel,
1309
1309
  renderer = "canvas"
1310
1310
  }) => {
1311
+ var _a, _b;
1312
+
1311
1313
  const echartsRef = React.useRef(null);
1312
1314
  const eventHandlers = React.useMemo(() => {
1313
1315
  const values = {};
@@ -1345,28 +1347,13 @@ const Chart = ({
1345
1347
  }
1346
1348
  };
1347
1349
  }, [onClick, echartsRef]);
1348
-
1349
- const getTypesafeDimension = dimension => {
1350
- if (typeof dimension === "string") {
1351
- return dimension;
1352
- } else if (typeof dimension === "number") {
1353
- return `${dimension}px`;
1350
+ return jsx(ChartContainer, Object.assign({
1351
+ style: {
1352
+ height: (_a = style === null || style === void 0 ? void 0 : style.height) !== null && _a !== void 0 ? _a : "300px",
1353
+ width: (_b = style === null || style === void 0 ? void 0 : style.width) !== null && _b !== void 0 ? _b : "100%"
1354
1354
  }
1355
-
1356
- return "auto";
1357
- };
1358
-
1359
- const classDimensions = React.useMemo(() => {
1360
- var _a, _b;
1361
-
1362
- const height = (_a = style === null || style === void 0 ? void 0 : style.height) !== null && _a !== void 0 ? _a : "300px";
1363
- const width = (_b = style === null || style === void 0 ? void 0 : style.width) !== null && _b !== void 0 ? _b : "100%";
1364
- return `h-[${getTypesafeDimension(height)}] w-[${getTypesafeDimension(width)}]`;
1365
- }, [style === null || style === void 0 ? void 0 : style.height, style === null || style === void 0 ? void 0 : style.width]);
1366
- return jsx(ChartContainer, {
1367
- children: showLoading ? jsxs(SpinnerContainer, Object.assign({
1368
- dimensions: classDimensions
1369
- }, {
1355
+ }, {
1356
+ children: showLoading ? jsxs(SpinnerContainer, {
1370
1357
  children: [jsx(Spinner, {
1371
1358
  centered: true
1372
1359
  }), (loadingOption === null || loadingOption === void 0 ? void 0 : loadingOption.text) && jsx(Text, Object.assign({
@@ -1375,7 +1362,7 @@ const Chart = ({
1375
1362
  }, {
1376
1363
  children: loadingOption.text
1377
1364
  }))]
1378
- })) : jsxs(Fragment, {
1365
+ }) : jsxs(Fragment, {
1379
1366
  children: [jsx(EChart, {
1380
1367
  ref: echartsRef,
1381
1368
  option: options,
@@ -1391,11 +1378,10 @@ const Chart = ({
1391
1378
  onChartReady: onChartReady
1392
1379
  }), timezoneLabel]
1393
1380
  })
1394
- });
1381
+ }));
1395
1382
  };
1396
1383
  const SpinnerContainer = tw.div`
1397
1384
  chart-spinner-container
1398
- ${p => `${p.dimensions}`}
1399
1385
  `;
1400
1386
  const ChartContainer = tw.div`
1401
1387
  chart-container
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.50",
3
+ "version": "0.0.51",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "MIT",
6
6
  "dependencies": {