@trackunit/react-components 0.0.50 → 0.0.53

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.
@@ -10,5 +10,12 @@ export interface NumberFieldProps extends NumberInputProps, FormGroupExposedProp
10
10
  */
11
11
  errorMessage?: string;
12
12
  }
13
+ /**
14
+ * The number field component is used for entering numeric values and includes controls for incrementally increasing or decreasing the value.
15
+ *
16
+ * _**Do use**_ the NumberField when the controls to incrementally increase or decrease makes the task easier for the user.
17
+ *
18
+ * _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
19
+ */
13
20
  export declare const NumberField: import("react").ForwardRefExoticComponent<NumberFieldProps & import("react").RefAttributes<HTMLInputElement>>;
14
21
  export {};
@@ -64,7 +64,11 @@ interface BaseBadgeProps extends CommonProps {
64
64
  }
65
65
  export declare type BadgeProps = BaseBadgeProps | TagProps;
66
66
  /**
67
- * The Badge component us used to display states or similar short form information.
67
+ * The Badge component us used to display states or similar short informative text.
68
+ *
69
+ * _**Do use** badges to show highlighted text based on the state._
70
+ *
71
+ * _**Do not use** badges for regular text in places where it makes no sense to use highlighted text._
68
72
  *
69
73
  * @param {BadgeProps} props - The props for the Badge component
70
74
  * @returns {JSX.Element} Badge component
@@ -4,31 +4,29 @@ import { Colors } from "../../constants/colors";
4
4
  export interface IndicatorProps extends CommonProps {
5
5
  /**
6
6
  * The icon to be rendered inside the indicator component
7
- *
8
- * @memberof IndicatorProps
9
7
  */
10
8
  icon: JSX.Element;
11
9
  /**
12
10
  * A color token used to style the icon and the icon background
13
- *
14
- * @memberof IndicatorProps
15
11
  */
16
12
  color?: Colors;
17
13
  /**
18
14
  * A text label to be displayed next to the indicator
19
- *
20
- * @memberof IndicatorProps
21
15
  */
22
16
  label?: string;
23
17
  /**
24
18
  * A boolean parameter to display or hide icon background, default value is true
25
- *
26
- * @memberof IndicatorProps
27
19
  */
28
20
  withBackground?: boolean;
29
21
  }
30
22
  /**
31
- * The Indicator components are non-interactive elements that communicate essential aspects of the state of an asset.
23
+ * Indicators are non-interactive elements that communicate essential aspects of the state of an asset.
24
+ *
25
+ * Whenever an asset is presented, indicators provide the necessary information for a user to comprehend the state of the asset.
26
+ *
27
+ * _**Do use** indicators to communicate essential aspects of the state of an asset._
28
+ *
29
+ * _**Do not use** indicators for non-essential information, or to communicate information unrelated to the state of an asset._
32
30
  *
33
31
  * @param {IndicatorProps} props - The props for the Indicator component
34
32
  * @returns {JSX.Element} Indicator component
@@ -22,7 +22,15 @@ export interface SpinnerProps extends CommonProps {
22
22
  containerClassName?: string;
23
23
  }
24
24
  /**
25
- * The Spinner component should be used st show a loading state.
25
+ * The spinner component provides visual feedback that data is being processed.
26
+ *
27
+ * Spinners are used when performing actions. They notify to the user that their request is being processed. Although they do not provide details about what is occurring on the back-end, they reassure the user that their action is being processed.
28
+ *
29
+ * Common actions that benefit from spinners include any create, update, or delete actions that may have a lot of data to process. It can be used in a table, after a primary or secondary button click, or even in a modal.
30
+ *
31
+ * Use a spinner component for any action that cannot be performed instantly and will only require a short time (between 1 to 5 seconds) to process.
32
+ *
33
+ * Use when retrieving or refreshing small data amounts, such as status.
26
34
  *
27
35
  * @param {SpinnerProps} props - The props for the Spinner component
28
36
  * @returns {JSX.Element} Spinner component
@@ -17,5 +17,12 @@ export interface TextFieldProps extends TextInputProps, FormGroupExposedProps {
17
17
  */
18
18
  errorMessage?: string;
19
19
  }
20
+ /**
21
+ * Text fields enable the user to interact with and input content and data. This component can be used for long and short form entries. Allow the size of the text input box to reflect the length of the content you expect the user to enter.
22
+ *
23
+ * _**Do use** when the user has to input or edit simple text based information, such as metadata._
24
+ *
25
+ * _**Do not use** to confirm user actions, such as deleting. Use a checkbox for such flows._
26
+ */
20
27
  export declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
21
28
  export {};
package/index.js CHANGED
@@ -81,7 +81,15 @@ function __rest(s, e) {
81
81
  }
82
82
 
83
83
  /**
84
- * The Spinner component should be used st show a loading state.
84
+ * The spinner component provides visual feedback that data is being processed.
85
+ *
86
+ * Spinners are used when performing actions. They notify to the user that their request is being processed. Although they do not provide details about what is occurring on the back-end, they reassure the user that their action is being processed.
87
+ *
88
+ * Common actions that benefit from spinners include any create, update, or delete actions that may have a lot of data to process. It can be used in a table, after a primary or secondary button click, or even in a modal.
89
+ *
90
+ * Use a spinner component for any action that cannot be performed instantly and will only require a short time (between 1 to 5 seconds) to process.
91
+ *
92
+ * Use when retrieving or refreshing small data amounts, such as status.
85
93
  *
86
94
  * @param {SpinnerProps} props - The props for the Spinner component
87
95
  * @returns {JSX.Element} Spinner component
@@ -670,7 +678,8 @@ const Alert = ({
670
678
  className: className,
671
679
  "data-testid": dataTestId,
672
680
  "$inline": inline,
673
- ref: ref
681
+ ref: ref,
682
+ role: "alert"
674
683
  }, {
675
684
  children: [jsx(IconContainer, Object.assign({
676
685
  "$inline": inline
@@ -754,7 +763,11 @@ const IconContainer = tw.div`
754
763
  `;
755
764
 
756
765
  /**
757
- * The Badge component us used to display states or similar short form information.
766
+ * The Badge component us used to display states or similar short informative text.
767
+ *
768
+ * _**Do use** badges to show highlighted text based on the state._
769
+ *
770
+ * _**Do not use** badges for regular text in places where it makes no sense to use highlighted text._
758
771
  *
759
772
  * @param {BadgeProps} props - The props for the Badge component
760
773
  * @returns {JSX.Element} Badge component
@@ -1308,6 +1321,8 @@ const Chart = ({
1308
1321
  timezoneLabel,
1309
1322
  renderer = "canvas"
1310
1323
  }) => {
1324
+ var _a, _b;
1325
+
1311
1326
  const echartsRef = React.useRef(null);
1312
1327
  const eventHandlers = React.useMemo(() => {
1313
1328
  const values = {};
@@ -1345,28 +1360,13 @@ const Chart = ({
1345
1360
  }
1346
1361
  };
1347
1362
  }, [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`;
1363
+ return jsx(ChartContainer, Object.assign({
1364
+ style: {
1365
+ height: (_a = style === null || style === void 0 ? void 0 : style.height) !== null && _a !== void 0 ? _a : "300px",
1366
+ width: (_b = style === null || style === void 0 ? void 0 : style.width) !== null && _b !== void 0 ? _b : "100%"
1354
1367
  }
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
- }, {
1368
+ }, {
1369
+ children: showLoading ? jsxs(SpinnerContainer, {
1370
1370
  children: [jsx(Spinner, {
1371
1371
  centered: true
1372
1372
  }), (loadingOption === null || loadingOption === void 0 ? void 0 : loadingOption.text) && jsx(Text, Object.assign({
@@ -1375,7 +1375,7 @@ const Chart = ({
1375
1375
  }, {
1376
1376
  children: loadingOption.text
1377
1377
  }))]
1378
- })) : jsxs(Fragment, {
1378
+ }) : jsxs(Fragment, {
1379
1379
  children: [jsx(EChart, {
1380
1380
  ref: echartsRef,
1381
1381
  option: options,
@@ -1391,11 +1391,10 @@ const Chart = ({
1391
1391
  onChartReady: onChartReady
1392
1392
  }), timezoneLabel]
1393
1393
  })
1394
- });
1394
+ }));
1395
1395
  };
1396
1396
  const SpinnerContainer = tw.div`
1397
1397
  chart-spinner-container
1398
- ${p => `${p.dimensions}`}
1399
1398
  `;
1400
1399
  const ChartContainer = tw.div`
1401
1400
  chart-container
@@ -2472,7 +2471,13 @@ const HelpAddon = tw.span`
2472
2471
  `;
2473
2472
 
2474
2473
  /**
2475
- * The Indicator components are non-interactive elements that communicate essential aspects of the state of an asset.
2474
+ * Indicators are non-interactive elements that communicate essential aspects of the state of an asset.
2475
+ *
2476
+ * Whenever an asset is presented, indicators provide the necessary information for a user to comprehend the state of the asset.
2477
+ *
2478
+ * _**Do use** indicators to communicate essential aspects of the state of an asset._
2479
+ *
2480
+ * _**Do not use** indicators for non-essential information, or to communicate information unrelated to the state of an asset._
2476
2481
  *
2477
2482
  * @param {IndicatorProps} props - The props for the Indicator component
2478
2483
  * @returns {JSX.Element} Indicator component
@@ -2483,7 +2488,7 @@ const Indicator$1 = _a => {
2483
2488
  dataTestId,
2484
2489
  icon,
2485
2490
  label,
2486
- color,
2491
+ color = colors.UNKNOWN,
2487
2492
  withBackground = true
2488
2493
  } = _a,
2489
2494
  rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground"]);
@@ -3255,6 +3260,14 @@ const NumberInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
3255
3260
  }, props)));
3256
3261
  NumberInput.displayName = "NumberInput";
3257
3262
 
3263
+ /**
3264
+ * The number field component is used for entering numeric values and includes controls for incrementally increasing or decreasing the value.
3265
+ *
3266
+ * _**Do use**_ the NumberField when the controls to incrementally increase or decrease makes the task easier for the user.
3267
+ *
3268
+ * _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
3269
+ */
3270
+
3258
3271
  const NumberField = forwardRef((_a, ref) => {
3259
3272
  var {
3260
3273
  label,
@@ -3997,6 +4010,14 @@ const Root = tw.span`
3997
4010
  font-mono
3998
4011
  `;
3999
4012
 
4013
+ /**
4014
+ * Text fields enable the user to interact with and input content and data. This component can be used for long and short form entries. Allow the size of the text input box to reflect the length of the content you expect the user to enter.
4015
+ *
4016
+ * _**Do use** when the user has to input or edit simple text based information, such as metadata._
4017
+ *
4018
+ * _**Do not use** to confirm user actions, such as deleting. Use a checkbox for such flows._
4019
+ */
4020
+
4000
4021
  const TextField = React.forwardRef((_a, ref) => {
4001
4022
  var {
4002
4023
  label,
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.53",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "MIT",
6
6
  "dependencies": {