@trackunit/react-components 0.0.101 → 0.0.104

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.
@@ -61,8 +61,11 @@ export interface ChartProps extends CommonProps {
61
61
  }
62
62
  /**
63
63
  * The Chart component is a wrapper component for ECharts.
64
+ *
64
65
  * Handles events and click functionality.
65
66
  *
67
+ * For more information see the [eCharts documentation](https://github.com/hustcc/echarts-for-react).
68
+ *
66
69
  * @param {ChartProps} props - The props for the Chart component
67
70
  * @returns {JSX.Element} Chart component
68
71
  */
@@ -13,7 +13,7 @@ export interface CopyableTextProps extends CommonProps {
13
13
  alternativeText?: string;
14
14
  }
15
15
  /**
16
- * The CopyableText component is used where the user should have easy access to copy some information.
16
+ * The CopyableText component is used where the user should have easy access to copy information.
17
17
  *
18
18
  * @param {CopyableTextProps} props - The props for the CopyableText component
19
19
  * @returns {JSX.Element} CopyableText component
@@ -26,7 +26,7 @@ export interface FormGroupProps extends CommonProps {
26
26
  }
27
27
  /**
28
28
  * The FormGroup component should be used to wrap any Input element that needs a label.
29
- * Besides a label the component supplyes optional Tip, HelpText and HelpAddon support.
29
+ * Besides a label the component supplies an optional Tip, HelpText and HelpAddon support.
30
30
  *
31
31
  * @param {FormGroupProps} props - The props for the FormGroup component
32
32
  * @returns {JSX.Element} FormGroup component
@@ -1,21 +1,20 @@
1
1
  /// <reference types="react" />
2
2
  import { CommonProps } from "../../common";
3
- interface SpacerProps extends CommonProps {
3
+ export interface SpacerProps extends CommonProps {
4
4
  /**
5
5
  * The minimum height of the spacer. Defaults to 1px.
6
6
  * Possible values are "normal"(8px), and "large" (32px).
7
7
  */
8
- minHeight?: string;
8
+ minHeight?: "normal" | "large";
9
9
  /**
10
10
  * The border of the spacer.
11
11
  */
12
12
  border?: boolean;
13
13
  }
14
14
  /**
15
- * The Spacer component is used for adding a bit of space.
15
+ * The Spacer component is used for adding a bit of space in the ui.
16
16
  *
17
17
  * @param {SpacerProps} props - The props for the Spacer component
18
18
  * @returns {JSX.Element} Spacer component
19
19
  */
20
20
  export declare const Spacer: ({ minHeight, border, dataTestId }: SpacerProps) => JSX.Element;
21
- export {};
@@ -25,11 +25,13 @@ export interface TagProps extends CommonProps {
25
25
  size?: TagSize;
26
26
  }
27
27
  /**
28
- * Tags allow users to enter information and filter content.
28
+ * The tag component is used to categorize elements in the ui.
29
29
  *
30
- * Multiple or single tags can be used to categorise items.
30
+ * This could be to tell the state of an asset, or label a page as Beta.
31
31
  *
32
- * Use short labels for easy scanning. Use two words only if necessary to describe the status and differentiate it from other tags.
32
+ * The tag is also used in multiselect components to show selected options.
33
+ *
34
+ * **Do:** Use short labels for easy scanning.
33
35
  *
34
36
  * @param {TagProps} props - The props for the tag component
35
37
  * @returns {JSX.Element} tag component
@@ -47,7 +47,11 @@ export interface TextProps extends CommonProps {
47
47
  underline?: boolean;
48
48
  }
49
49
  /**
50
- * The Text component.
50
+ * The Text component is used to apply Trackunit default typography styles to text.
51
+ *
52
+ * ### When to use
53
+ *
54
+ * Use Text when you want to show a text section, use Heading if you want to show a heading.
51
55
  *
52
56
  * @param {TextProps} props - The props for the Text component
53
57
  * @returns {JSX.Element} Text component
package/index.js CHANGED
@@ -17,7 +17,7 @@ import ReactAsyncCreatableSelect from 'react-select/async-creatable';
17
17
  import ReactCreatableSelect from 'react-select/creatable';
18
18
  import ReactSelect from 'react-select';
19
19
  import ReactAsyncSelect from 'react-select/async';
20
- import ReactMoment from 'react-moment';
20
+ import { format, formatDistance } from 'date-fns';
21
21
 
22
22
  const docs = {
23
23
  source: {
@@ -494,7 +494,11 @@ const CustomIcon = tw(Icon$1)`
494
494
  `;
495
495
 
496
496
  /**
497
- * The Text component.
497
+ * The Text component is used to apply Trackunit default typography styles to text.
498
+ *
499
+ * ### When to use
500
+ *
501
+ * Use Text when you want to show a text section, use Heading if you want to show a heading.
498
502
  *
499
503
  * @param {TextProps} props - The props for the Text component
500
504
  * @returns {JSX.Element} Text component
@@ -796,7 +800,7 @@ const IconContainer$1 = tw.div`
796
800
 
797
801
  const Badge = _a => {
798
802
  var {
799
- color = "neutral",
803
+ color = "danger",
800
804
  subtle = false,
801
805
  className,
802
806
  count,
@@ -1288,8 +1292,11 @@ const HeadingContainer = tw.div`
1288
1292
 
1289
1293
  /**
1290
1294
  * The Chart component is a wrapper component for ECharts.
1295
+ *
1291
1296
  * Handles events and click functionality.
1292
1297
  *
1298
+ * For more information see the [eCharts documentation](https://github.com/hustcc/echarts-for-react).
1299
+ *
1293
1300
  * @param {ChartProps} props - The props for the Chart component
1294
1301
  * @returns {JSX.Element} Chart component
1295
1302
  */
@@ -1686,7 +1693,7 @@ const StyledCollapsible = tw.div`
1686
1693
  `;
1687
1694
 
1688
1695
  /**
1689
- * The CopyableText component is used where the user should have easy access to copy some information.
1696
+ * The CopyableText component is used where the user should have easy access to copy information.
1690
1697
  *
1691
1698
  * @param {CopyableTextProps} props - The props for the CopyableText component
1692
1699
  * @returns {JSX.Element} CopyableText component
@@ -1719,19 +1726,8 @@ const CopyableText = ({
1719
1726
  }));
1720
1727
  };
1721
1728
  const StyledCopyableText = tw.span`
1722
- py-1
1723
- px-2
1724
- border
1725
- border-dashed
1726
- border-neutral-600
1727
- rounded
1728
- cursor-pointer
1729
- inline
1730
- transition-all
1731
- ease-in-out
1732
- leading-7
1733
- break-words
1734
- ${p => p.$animating ? tws`animate-copy` : null}`;
1729
+ tu-copyable-text
1730
+ ${p => p.$animating ? tws`tu-copyable-text--animating` : null}`;
1735
1731
 
1736
1732
  const localeLookup = {
1737
1733
  en: enGB,
@@ -2334,7 +2330,7 @@ const TipContainer = tw.span`
2334
2330
 
2335
2331
  /**
2336
2332
  * The FormGroup component should be used to wrap any Input element that needs a label.
2337
- * Besides a label the component supplyes optional Tip, HelpText and HelpAddon support.
2333
+ * Besides a label the component supplies an optional Tip, HelpText and HelpAddon support.
2338
2334
  *
2339
2335
  * @param {FormGroupProps} props - The props for the FormGroup component
2340
2336
  * @returns {JSX.Element} FormGroup component
@@ -3097,34 +3093,15 @@ const NumberField = forwardRef((_a, ref) => {
3097
3093
  }));
3098
3094
  });
3099
3095
 
3100
- const GetSpacerHeight = () => ({
3101
- minHeight
3102
- }) => {
3103
- if (!minHeight) {
3104
- return "";
3105
- }
3106
-
3107
- switch (minHeight) {
3108
- case "normal":
3109
- return tws`min-h-[8px]`;
3110
-
3111
- case "large":
3112
- return tws`min-h-[32px]`;
3113
-
3114
- default:
3115
- return "";
3116
- }
3117
- };
3118
3096
  /**
3119
- * The Spacer component is used for adding a bit of space.
3097
+ * The Spacer component is used for adding a bit of space in the ui.
3120
3098
  *
3121
3099
  * @param {SpacerProps} props - The props for the Spacer component
3122
3100
  * @returns {JSX.Element} Spacer component
3123
3101
  */
3124
3102
 
3125
-
3126
3103
  const Spacer = ({
3127
- minHeight = "",
3104
+ minHeight,
3128
3105
  border,
3129
3106
  dataTestId
3130
3107
  }) => {
@@ -3134,17 +3111,35 @@ const Spacer = ({
3134
3111
  border: border
3135
3112
  });
3136
3113
  };
3114
+
3115
+ const GetSpacerHeight = () => ({
3116
+ minHeight
3117
+ }) => {
3118
+ switch (minHeight) {
3119
+ case "normal":
3120
+ return tws`tu-spacer--normal`;
3121
+
3122
+ case "large":
3123
+ return tws`tu-spacer--large`;
3124
+
3125
+ default:
3126
+ return "";
3127
+ }
3128
+ };
3129
+
3137
3130
  const Space = tw.div`
3138
- ${p => `${p.border ? `tu-spacer--border` : null}`}
3139
- ${GetSpacerHeight()}
3131
+ ${p => `${p.border ? `tu-spacer--border` : null}`}
3132
+ ${GetSpacerHeight()}
3140
3133
  `;
3141
3134
 
3142
3135
  /**
3143
- * Tags allow users to enter information and filter content.
3136
+ * The tag component is used to categorize elements in the ui.
3144
3137
  *
3145
- * Multiple or single tags can be used to categorise items.
3138
+ * This could be to tell the state of an asset, or label a page as Beta.
3146
3139
  *
3147
- * Use short labels for easy scanning. Use two words only if necessary to describe the status and differentiate it from other tags.
3140
+ * The tag is also used in multiselect components to show selected options.
3141
+ *
3142
+ * **Do:** Use short labels for easy scanning.
3148
3143
  *
3149
3144
  * @param {TagProps} props - The props for the tag component
3150
3145
  * @returns {JSX.Element} tag component
@@ -3773,12 +3768,12 @@ const SkeletonLines = memo(({
3773
3768
  for (let i = 0; i < lines; i++) {
3774
3769
  skeletonLines.push(jsx(SkeletonLine, Object.assign({
3775
3770
  "data-testid": dataTestId,
3776
- margin: margin,
3777
3771
  "data-type": "loading-skeleton-line",
3778
3772
  className: className,
3779
3773
  style: {
3780
3774
  height: getHeight(i),
3781
- width: getWidth(i)
3775
+ width: getWidth(i),
3776
+ margin: margin
3782
3777
  }
3783
3778
  }, {
3784
3779
  children: "\u00A0"
@@ -4054,12 +4049,9 @@ const TimelineElement = ({
4054
4049
  size: "large"
4055
4050
  })
4056
4051
  }),
4057
- header = jsx(ReactMoment, Object.assign({
4058
- format: "LLL",
4059
- fromNow: true
4060
- }, {
4061
- children: date
4062
- }))
4052
+ header = `${format(date, "MMM d, yyyy")} (${formatDistance(date, new Date(), {
4053
+ addSuffix: true
4054
+ })})`
4063
4055
  }) => {
4064
4056
  var _a;
4065
4057
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.101",
3
+ "version": "0.0.104",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "UNLICENSED",
6
6
  "dependencies": {
@@ -20,8 +20,7 @@
20
20
  "@popperjs/core": "^2.11.4",
21
21
  "history": "^5.3.0",
22
22
  "react-router-dom": "^6.2.2",
23
- "react-select": "^5.4.0",
24
- "react-moment": "^1.1.2"
23
+ "react-select": "^5.4.0"
25
24
  },
26
25
  "module": "./index.js",
27
26
  "main": "./index.js",