@trackunit/react-components 0.0.147 → 0.0.151

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.
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps } from "../../common";
3
+ import { EChartsType } from "echarts";
3
4
  export interface IOptionsType {
4
5
  [key: string]: any;
5
6
  }
@@ -32,6 +33,10 @@ export interface ChartProps extends CommonProps {
32
33
  * Event fired when mouse leaves the chart.
33
34
  */
34
35
  mouseLeaveChart?: () => void;
36
+ /**
37
+ * Event fired when mouse is moving over the chart.
38
+ */
39
+ mouseMoveChart?: (event: any, chart: EChartsType | undefined) => void;
35
40
  /**
36
41
  * CSS styles for the chart.
37
42
  */
@@ -73,4 +78,4 @@ export interface ChartProps extends CommonProps {
73
78
  * @param {ChartProps} props - The props for the Chart component
74
79
  * @returns {JSX.Element} Chart component
75
80
  */
76
- export declare const Chart: ({ options, showLoading, className, style, onChartReady, onClick, onDataZoom, onBrush, onBrushSelected, mouseLeaveChart, merge, loadingOption, timezoneLabel, renderer, dataTestId, }: ChartProps) => JSX.Element;
81
+ export declare const Chart: ({ options, showLoading, className, style, onChartReady, onClick, onDataZoom, onBrush, onBrushSelected, mouseLeaveChart, mouseMoveChart, merge, loadingOption, timezoneLabel, renderer, dataTestId, }: ChartProps) => JSX.Element;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export interface ILegendItem {
3
- label: string;
3
+ label?: string;
4
4
  selected?: boolean;
5
5
  disabled?: boolean;
6
6
  onClick?: () => void;
package/index.js CHANGED
@@ -1412,6 +1412,7 @@ const Chart = ({
1412
1412
  onBrush,
1413
1413
  onBrushSelected,
1414
1414
  mouseLeaveChart,
1415
+ mouseMoveChart,
1415
1416
  merge = true,
1416
1417
  loadingOption,
1417
1418
  timezoneLabel,
@@ -1440,8 +1441,16 @@ const Chart = ({
1440
1441
  values.globalout = mouseLeaveChart;
1441
1442
  }
1442
1443
 
1444
+ if (mouseMoveChart !== undefined) {
1445
+ values.mouseMove = event => {
1446
+ var _a;
1447
+
1448
+ mouseMoveChart(event, (_a = echartsRef === null || echartsRef === void 0 ? void 0 : echartsRef.current) === null || _a === void 0 ? void 0 : _a.getEchartsInstance());
1449
+ };
1450
+ }
1451
+
1443
1452
  return values;
1444
- }, [onDataZoom, onBrush, onBrushSelected, mouseLeaveChart]);
1453
+ }, [onDataZoom, onBrush, onBrushSelected, mouseLeaveChart, mouseMoveChart]);
1445
1454
  React.useEffect(() => {
1446
1455
  var _a;
1447
1456
 
@@ -1506,7 +1515,7 @@ const ChartContainer = tw.div`
1506
1515
  * @returns {JSX.Element} Label component
1507
1516
  */
1508
1517
 
1509
- const Label$3 = ({
1518
+ const Label$2 = ({
1510
1519
  id,
1511
1520
  htmlFor,
1512
1521
  children,
@@ -1659,7 +1668,7 @@ const Checkbox = React.forwardRef((_a, ref) => {
1659
1668
  onKeyPress: onKeyPress
1660
1669
  }, {
1661
1670
  children: icon
1662
- })), label && jsx(Label$3, Object.assign({
1671
+ })), label && jsx(Label$2, Object.assign({
1663
1672
  className: tws`cursor-pointer`,
1664
1673
  htmlFor: uuid,
1665
1674
  disabled: isReadonly,
@@ -2314,7 +2323,7 @@ const FormGroup = ({
2314
2323
  "$disabled": disabled
2315
2324
  }, {
2316
2325
  children: [jsxs(ContainerBefore, {
2317
- children: [jsx(Label$3, Object.assign({
2326
+ children: [jsx(Label$2, Object.assign({
2318
2327
  "data-testid": `${dataTestId}-label`
2319
2328
  }, {
2320
2329
  children: label
@@ -2610,7 +2619,7 @@ const Indicator$1 = _a => {
2610
2619
  children: [ping && jsx(Ping, {
2611
2620
  "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping"
2612
2621
  }), icon]
2613
- })), label !== undefined && withLabel && jsx(Label$2, Object.assign({
2622
+ })), label !== undefined && withLabel && jsx(Label$1, Object.assign({
2614
2623
  "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label"
2615
2624
  }, {
2616
2625
  children: label
@@ -2668,6 +2677,24 @@ const Container$4 = tw.div`
2668
2677
  case colors.UNKNOWN:
2669
2678
  return tws`tu-indicator--unknown`;
2670
2679
 
2680
+ case colors.ON_RENT:
2681
+ return tws`tu-indicator--on-rent`;
2682
+
2683
+ case colors.AVAILABLE:
2684
+ return tws`tu-indicator--available`;
2685
+
2686
+ case colors.PICKUP_READY:
2687
+ return tws`tu-indicator--pickup-ready`;
2688
+
2689
+ case colors.TRANSFER:
2690
+ return tws`tu-indicator--transfer`;
2691
+
2692
+ case colors.IN_REPAIR:
2693
+ return tws`tu-indicator--in-repair`;
2694
+
2695
+ case colors.OTHER_RENTAL_STATUS:
2696
+ return tws`tu-indicator--other-rental-status`;
2697
+
2671
2698
  default:
2672
2699
  return "";
2673
2700
  }
@@ -2682,7 +2709,7 @@ const IconBackground = tw.div`
2682
2709
  return $withBackground ? "" : "tu-indicator__icon-background--none";
2683
2710
  }}
2684
2711
  `;
2685
- const Label$2 = tw.div`
2712
+ const Label$1 = tw.div`
2686
2713
  tu-indicator__label
2687
2714
  `;
2688
2715
  const Ping = tw.span`
@@ -2708,16 +2735,17 @@ const LegendItem = ({
2708
2735
  const handleOnClick = onClick && !disabled ? () => onClick() : undefined;
2709
2736
  return jsxs(Root$2, Object.assign({
2710
2737
  "data-testid": dataTestId,
2711
- disabled: disabled,
2738
+ "$disabled": disabled,
2712
2739
  className: className,
2713
- selected: selected,
2740
+ "$selected": selected,
2714
2741
  onClick: handleOnClick
2715
2742
  }, {
2716
2743
  children: [jsx(Indicator, {
2717
2744
  style: {
2718
2745
  backgroundColor: color
2719
- }
2720
- }), jsx(Label$1, {
2746
+ },
2747
+ "$selected": selected
2748
+ }), label && jsx("p", {
2721
2749
  children: label
2722
2750
  })]
2723
2751
  }));
@@ -2729,19 +2757,18 @@ const Root$2 = tw.div`
2729
2757
  ease-in-out
2730
2758
  duration-200
2731
2759
  text-neutral-500
2732
- ${p => p.disabled ? tws`text-neutral-300` : p.selected ? tws`text-black` : tws`text-neutral-500`}
2733
- ${p => p.selected ? tws`font-medium` : null}
2760
+ hover:text-neutral-700
2761
+ text-sm
2762
+ gap-2
2763
+ ${p => p.$disabled ? tws`text-neutral-300` : p.$selected ? tws`text-black` : ""}
2764
+ ${p => p.$selected ? tws`font-medium` : null}
2734
2765
  ${p => p.onClick ? tws`cursor-pointer` : tws`cursor-default`}
2735
2766
  `;
2736
- const Indicator = tw.span`
2737
- block
2767
+ const Indicator = tw.div`
2738
2768
  w-3
2739
2769
  h-3
2740
2770
  rounded-[50%]
2741
- mr-2
2742
- `;
2743
- const Label$1 = tw.span`
2744
- text-sm
2771
+ ${p => p.$selected ? tws`border border-black border-opacity-50` : null}
2745
2772
  `;
2746
2773
 
2747
2774
  /**
@@ -3308,7 +3335,7 @@ const RadioItem = ({
3308
3335
  "data-testid": dataTestId,
3309
3336
  "$checked": isChecked
3310
3337
  }), jsxs(LabelContainer$1, {
3311
- children: [jsx(Label$3, Object.assign({
3338
+ children: [jsx(Label$2, Object.assign({
3312
3339
  htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id} ${uuid}`,
3313
3340
  dataTestId: `${dataTestId}-Label`,
3314
3341
  disabled: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
@@ -3370,7 +3397,7 @@ const SelectContainer$1 = ({
3370
3397
  "$hasError": hasError,
3371
3398
  "$isDisabled": isDisabled
3372
3399
  }, {
3373
- children: [label && !hideLabel && jsx(Label$3, Object.assign({
3400
+ children: [label && !hideLabel && jsx(Label$2, Object.assign({
3374
3401
  htmlFor: id
3375
3402
  }, {
3376
3403
  children: label
@@ -4732,7 +4759,7 @@ const Toggle = React.forwardRef(({
4732
4759
  })
4733
4760
  }))]
4734
4761
  })), jsxs(LabelContainer, {
4735
- children: [jsx(Label$3, Object.assign({
4762
+ children: [jsx(Label$2, Object.assign({
4736
4763
  htmlFor: id,
4737
4764
  dataTestId: `${dataTestId}-Label`,
4738
4765
  disabled: disabled
@@ -5298,4 +5325,4 @@ const Layout = tw.div`
5298
5325
  tu-layout-TwoColumnLayout
5299
5326
  `;
5300
5327
 
5301
- export { ActionButton, Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$3 as Label, LegendItem, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiSelectMenuItem, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SelectPrefix, SingleSelectMenuItem, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, ValueBar, activityColors, colors, criticalityColors, docs, generalColors, getOrderedOptions, getValueBarColorByValue, intentColors, isMultiValue, rentalStatusColors, useContainerProps, useCustomComponents, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
5328
+ export { ActionButton, Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, LegendItem, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiSelectMenuItem, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SelectPrefix, SingleSelectMenuItem, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, ValueBar, activityColors, colors, criticalityColors, docs, generalColors, getOrderedOptions, getValueBarColorByValue, intentColors, isMultiValue, rentalStatusColors, useContainerProps, useCustomComponents, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.147",
3
+ "version": "0.0.151",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {
@@ -9,6 +9,7 @@
9
9
  "react": "17.0.2",
10
10
  "@trackunit/ui-design-tokens": "0.0.43",
11
11
  "echarts-for-react": "^3.0.2",
12
+ "echarts": "^5.4.0",
12
13
  "uuid": "^8.3.2",
13
14
  "react-use": "^17.4.0",
14
15
  "date-fns": "^2.29.3",