@trackunit/react-components 0.0.135 → 0.0.138

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.
@@ -4,31 +4,31 @@ declare type FilteredInputProps = Omit<React.InputHTMLAttributes<HTMLInputElemen
4
4
  declare type FieldSize = "small" | "medium";
5
5
  export interface BaseInputProps extends FilteredInputProps, CommonProps {
6
6
  /**
7
- * An React element to render before the text in the input.
7
+ * A React element to render before the text in the input.
8
8
  * This is typically used to render an icon.
9
- * For other elements than icons, please concider using the addonBefore prop.
9
+ * For elements other than icons, please consider using the addonBefore prop.
10
10
  */
11
11
  prefix?: React.ReactNode;
12
12
  /**
13
- * An React element to render after the text in the input.
13
+ * A React element to render after the text in the input.
14
14
  * This is typically used to render an icon.
15
- * For other elements than icons, please concider using the addonAfter prop.
15
+ * For other elements than icons, please consider using the addonAfter prop.
16
16
  */
17
17
  suffix?: React.ReactNode;
18
18
  /**
19
- * An React element to render in a separate container before the text in the input.
19
+ * A React element to render in a separate container before the text in the input.
20
20
  * This is typically used to render text.
21
- * For icons, please concider using the prefix prop.
21
+ * For icons, please consider using the prefix prop.
22
22
  */
23
23
  addonBefore?: React.ReactNode;
24
24
  /**
25
- * An React element to render in a separate container after the text in the input.
25
+ * A React element to render in a separate container after the text in the input.
26
26
  * This is typically used to render text.
27
- * For icons, please concider using the suffix prop.
27
+ * For icons, please consider using the suffix prop.
28
28
  */
29
29
  addonAfter?: React.ReactNode;
30
30
  /**
31
- * An ReactNode to render at the end of the input field before the addonAfter.
31
+ * A ReactNode to render at the end of the input field before the addonAfter.
32
32
  * Mainly meant for the icon button actions for special input types.
33
33
  */
34
34
  actions?: React.ReactNode;
@@ -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;
@@ -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`,
@@ -998,7 +1012,7 @@ const BaseInput = React.forwardRef((_a, ref) => {
998
1012
  "data-testid": `${dataTestId}-suffix`
999
1013
  }, {
1000
1014
  children: suffix
1001
- })) : null, actions !== null && addonBefore !== actions ? actions : null, addonAfter !== null && addonBefore !== addonAfter ? jsx(AddonAfter, Object.assign({
1015
+ })) : null, actions !== null && addonBefore !== actions ? actions : null, addonAfter !== null && addonAfter !== undefined && addonBefore !== addonAfter ? jsx(AddonAfter, Object.assign({
1002
1016
  "data-testid": `${dataTestId}-addonAfter`
1003
1017
  }, {
1004
1018
  children: addonAfter
@@ -1641,6 +1655,7 @@ const Checkbox = React.forwardRef((_a, ref) => {
1641
1655
  }, {
1642
1656
  children: icon
1643
1657
  })), label && jsx(Label$3, Object.assign({
1658
+ className: tws`cursor-pointer`,
1644
1659
  htmlFor: uuid,
1645
1660
  disabled: isReadonly,
1646
1661
  isInvalid: isReadonly ? false : isInvalid,
@@ -2640,20 +2655,26 @@ const Indicator$1 = _a => {
2640
2655
  icon,
2641
2656
  label,
2642
2657
  color = colors.UNKNOWN,
2643
- withBackground = true
2658
+ withBackground = true,
2659
+ withLabel = true,
2660
+ ping = false
2644
2661
  } = _a,
2645
- rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground"]);
2662
+ rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground", "withLabel", "ping"]);
2646
2663
 
2647
2664
  return jsxs(Container$4, Object.assign({
2648
2665
  "$color": color,
2649
2666
  "data-testid": dataTestId
2650
2667
  }, rest, {
2651
- children: [jsx(IconBackground, Object.assign({
2668
+ title: !withLabel ? label : undefined
2669
+ }, {
2670
+ children: [jsxs(IconBackground, Object.assign({
2652
2671
  "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background",
2653
2672
  "$withBackground": withBackground
2654
2673
  }, {
2655
- children: icon
2656
- })), label !== undefined && jsx(Label$2, Object.assign({
2674
+ children: [ping && jsx(Ping, {
2675
+ "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping"
2676
+ }), icon]
2677
+ })), label !== undefined && withLabel && jsx(Label$2, Object.assign({
2657
2678
  "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label"
2658
2679
  }, {
2659
2680
  children: label
@@ -2725,6 +2746,9 @@ const IconBackground = tw.div`
2725
2746
  const Label$2 = tw.div`
2726
2747
  tu-indicator__label
2727
2748
  `;
2749
+ const Ping = tw.span`
2750
+ tu-indicator__ping
2751
+ `;
2728
2752
 
2729
2753
  /**
2730
2754
  * The LegendItem component is used to show form legends.
@@ -5349,4 +5373,4 @@ const Layout = tw.div`
5349
5373
  tu-layout-TwoColumnLayout
5350
5374
  `;
5351
5375
 
5352
- 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, useContainerProps, useCustomComponents, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
5376
+ 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.135",
3
+ "version": "0.0.138",
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",