@trackunit/react-components 0.0.134 → 0.0.136

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.
@@ -14,7 +14,7 @@ export interface CardHeaderProps extends CommonProps {
14
14
  */
15
15
  headingVariant?: HeadingVariant;
16
16
  /** Adds an extra heading below the main heading. */
17
- subHeading?: string;
17
+ subHeading?: string | React.ReactNode;
18
18
  /**
19
19
  * Items to render next to the heading
20
20
  */
@@ -18,6 +18,14 @@ export interface IndicatorProps extends CommonProps {
18
18
  * A boolean parameter to display or hide icon background, default value is true
19
19
  */
20
20
  withBackground?: boolean;
21
+ /**
22
+ * A boolean parameter to display or hide label and instead show as html title on hover, default value is true
23
+ */
24
+ withLabel?: boolean;
25
+ /**
26
+ * A boolean parameter to make the indicator ping thus drawing more attention, default value is false
27
+ */
28
+ ping?: boolean;
21
29
  }
22
30
  /**
23
31
  * Indicators are non-interactive elements that communicate essential aspects of the state of an asset.
@@ -31,4 +39,4 @@ export interface IndicatorProps extends CommonProps {
31
39
  * @param {IndicatorProps} props - The props for the Indicator component
32
40
  * @returns {JSX.Element} Indicator component
33
41
  */
34
- export declare const Indicator: ({ dataTestId, icon, label, color, withBackground, ...rest }: IndicatorProps) => JSX.Element;
42
+ export declare const Indicator: ({ dataTestId, icon, label, color, withBackground, withLabel, ping, ...rest }: IndicatorProps) => JSX.Element;
@@ -1,3 +1,2 @@
1
- export * from "./MenuButton";
2
1
  export * from "./MenuItem";
3
2
  export * from "./MenuList";
@@ -43,10 +43,31 @@ export declare const activityColors: {
43
43
  readonly UNKNOWN: "unknown";
44
44
  };
45
45
  export declare type ActivityColors = typeof colors[keyof typeof activityColors];
46
+ /**
47
+ * The Rental status color palette
48
+ * Should be available in any component that could be used to display the rental status of an asset
49
+ */
50
+ export declare const rentalStatusColors: {
51
+ readonly ON_RENT: "ON_RENT";
52
+ readonly RETURNED: "RETURNED";
53
+ readonly AVAILABLE: "AVAILABLE";
54
+ readonly PICKUP_READY: "PICKUP_READY";
55
+ readonly TRANSFER: "TRANSFER";
56
+ readonly IN_REPAIR: "IN_REPAIR";
57
+ readonly OTHER_RENTAL_STATUS: "OTHER_RENTAL_STATUS";
58
+ };
59
+ export declare type RentalStatusColors = typeof colors[keyof typeof rentalStatusColors];
46
60
  /**
47
61
  * The full color palette
48
62
  */
49
63
  export declare const colors: {
64
+ readonly ON_RENT: "ON_RENT";
65
+ readonly RETURNED: "RETURNED";
66
+ readonly AVAILABLE: "AVAILABLE";
67
+ readonly PICKUP_READY: "PICKUP_READY";
68
+ readonly TRANSFER: "TRANSFER";
69
+ readonly IN_REPAIR: "IN_REPAIR";
70
+ readonly OTHER_RENTAL_STATUS: "OTHER_RENTAL_STATUS";
50
71
  readonly WORKING: "working";
51
72
  readonly IDLE: "idle";
52
73
  readonly STOPPED: "stopped";
package/index.js CHANGED
@@ -348,11 +348,25 @@ const activityColors = {
348
348
  STOPPED: "stopped",
349
349
  UNKNOWN: "unknown"
350
350
  };
351
+ /**
352
+ * The Rental status color palette
353
+ * Should be available in any component that could be used to display the rental status of an asset
354
+ */
355
+
356
+ const rentalStatusColors = {
357
+ ON_RENT: "ON_RENT",
358
+ RETURNED: "RETURNED",
359
+ AVAILABLE: "AVAILABLE",
360
+ PICKUP_READY: "PICKUP_READY",
361
+ TRANSFER: "TRANSFER",
362
+ IN_REPAIR: "IN_REPAIR",
363
+ OTHER_RENTAL_STATUS: "OTHER_RENTAL_STATUS"
364
+ };
351
365
  /**
352
366
  * The full color palette
353
367
  */
354
368
 
355
- const colors = Object.assign(Object.assign(Object.assign(Object.assign({}, generalColors), intentColors), criticalityColors), activityColors);
369
+ const colors = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, generalColors), intentColors), criticalityColors), activityColors), rentalStatusColors);
356
370
 
357
371
  const IconSizeClassMap = {
358
372
  small: tws`tu-icon--small`,
@@ -1368,7 +1382,7 @@ const Container$7 = tw.div`
1368
1382
  tu-card__header
1369
1383
  `;
1370
1384
  const HeadingContainer = tw.div`
1371
- tu-card__header-heading-container
1385
+ tu-card__header-heading-container
1372
1386
  `;
1373
1387
 
1374
1388
  /**
@@ -2640,20 +2654,26 @@ const Indicator$1 = _a => {
2640
2654
  icon,
2641
2655
  label,
2642
2656
  color = colors.UNKNOWN,
2643
- withBackground = true
2657
+ withBackground = true,
2658
+ withLabel = true,
2659
+ ping = false
2644
2660
  } = _a,
2645
- rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground"]);
2661
+ rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground", "withLabel", "ping"]);
2646
2662
 
2647
2663
  return jsxs(Container$4, Object.assign({
2648
2664
  "$color": color,
2649
2665
  "data-testid": dataTestId
2650
2666
  }, rest, {
2651
- children: [jsx(IconBackground, Object.assign({
2667
+ title: !withLabel ? label : undefined
2668
+ }, {
2669
+ children: [jsxs(IconBackground, Object.assign({
2652
2670
  "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background",
2653
2671
  "$withBackground": withBackground
2654
2672
  }, {
2655
- children: icon
2656
- })), label !== undefined && jsx(Label$2, Object.assign({
2673
+ children: [ping && jsx(Ping, {
2674
+ "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping"
2675
+ }), icon]
2676
+ })), label !== undefined && withLabel && jsx(Label$2, Object.assign({
2657
2677
  "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label"
2658
2678
  }, {
2659
2679
  children: label
@@ -2725,6 +2745,9 @@ const IconBackground = tw.div`
2725
2745
  const Label$2 = tw.div`
2726
2746
  tu-indicator__label
2727
2747
  `;
2748
+ const Ping = tw.span`
2749
+ tu-indicator__ping
2750
+ `;
2728
2751
 
2729
2752
  /**
2730
2753
  * The LegendItem component is used to show form legends.
@@ -2781,42 +2804,6 @@ const Label$1 = tw.span`
2781
2804
  text-sm
2782
2805
  `;
2783
2806
 
2784
- /**
2785
- * The MenuButton component.
2786
- *
2787
- * @param {IMobileButton} props - The props for the MenuButton component
2788
- * @returns {JSX.Element} MenuButton component
2789
- */
2790
-
2791
- const MenuButton = ({
2792
- onClick,
2793
- className,
2794
- dataTestId
2795
- }) => {
2796
- return jsx(MobileIconButton, {
2797
- icon: jsx(Icon$1, {
2798
- name: "DotsHorizontalIcon",
2799
- size: "small"
2800
- }),
2801
- size: "small",
2802
- circular: true,
2803
- onClick: onClick,
2804
- className: className,
2805
- "data-testid": dataTestId
2806
- });
2807
- };
2808
- const MobileIconButton = tw(IconButton)`
2809
- !text-gray-800
2810
- !bg-white
2811
- active:outline-gray-400
2812
- active:!shadow-none
2813
- focus:!shadow-none
2814
- shadow-lg
2815
- !border
2816
- !border-solid
2817
- !border-gray-300
2818
- `;
2819
-
2820
2807
  /**
2821
2808
  * The MenuItem component is used to display a menu, primarily meant to be used in a list form.
2822
2809
  *
@@ -5385,4 +5372,4 @@ const Layout = tw.div`
5385
5372
  tu-layout-TwoColumnLayout
5386
5373
  `;
5387
5374
 
5388
- 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, MenuButton, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiSelectMenuItem, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, 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, useContainerProps, useCustomComponents, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
5375
+ 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, 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,10 +1,10 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.134",
3
+ "version": "0.0.136",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {
7
- "@trackunit/css-core": "0.0.48",
7
+ "@trackunit/css-core": "0.0.49",
8
8
  "@trackunit/tailwind-styled-components": "0.0.43",
9
9
  "react": "17.0.1",
10
10
  "@trackunit/ui-design-tokens": "0.0.42",
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- interface IMobileButton {
3
- onClick: () => void;
4
- className?: string;
5
- dataTestId?: string;
6
- }
7
- /**
8
- * The MenuButton component.
9
- *
10
- * @param {IMobileButton} props - The props for the MenuButton component
11
- * @returns {JSX.Element} MenuButton component
12
- */
13
- export declare const MenuButton: ({ onClick, className, dataTestId }: IMobileButton) => JSX.Element;
14
- export {};