@trackunit/react-components 0.0.48 → 0.0.51

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.
Files changed (77) hide show
  1. package/README.md +12 -30
  2. package/common/CommonProps.d.ts +0 -2
  3. package/common/useContainerProps.d.ts +8 -0
  4. package/components/NumberField/NumberField.d.ts +0 -1
  5. package/components/NumberInput/NumberInput.d.ts +2 -2
  6. package/components/TextInput/TextInput.d.ts +2 -2
  7. package/components/alert/Alert.d.ts +6 -7
  8. package/components/badge/Badge.d.ts +8 -9
  9. package/components/baseInput/BaseInput.d.ts +0 -8
  10. package/components/buttons/button/Button.d.ts +0 -6
  11. package/components/buttons/icon-button/IconButton.d.ts +0 -3
  12. package/components/buttons/shared/ButtonProps.d.ts +0 -7
  13. package/components/buttons/shared/helpers.d.ts +10 -0
  14. package/components/buttons/star-button/StarButton.d.ts +6 -0
  15. package/components/card/Card.d.ts +7 -3
  16. package/components/card/CardBody.d.ts +5 -4
  17. package/components/card/CardFooter.d.ts +2 -2
  18. package/components/card/CardHeader.d.ts +4 -13
  19. package/components/card/DensityContainer.d.ts +10 -11
  20. package/components/chart/Chart.d.ts +5 -10
  21. package/components/checkbox/CheckIcon.d.ts +11 -3
  22. package/components/checkbox/Checkbox.d.ts +0 -6
  23. package/components/checkbox/IndeterminateIcon.d.ts +6 -0
  24. package/components/collapse/Collapse.d.ts +6 -3
  25. package/components/copyableText/CopyableText.d.ts +6 -3
  26. package/components/dateField/DateField.d.ts +2 -6
  27. package/components/dayPicker/DayPicker.d.ts +18 -0
  28. package/components/dayPicker/DayPickerPopover.d.ts +6 -0
  29. package/components/dayPicker/DayRangePicker.d.ts +6 -0
  30. package/components/dayPicker/useLocale.d.ts +6 -0
  31. package/components/formGroup/FormGroup.d.ts +8 -6
  32. package/components/heading/Heading.d.ts +6 -4
  33. package/components/icon/Icon.d.ts +12 -10
  34. package/components/indicator/Indicator.d.ts +7 -5
  35. package/components/label/Label.d.ts +8 -4
  36. package/components/legendItem/LegendItem.d.ts +6 -0
  37. package/components/menu/MenuButton.d.ts +6 -0
  38. package/components/menu/MenuItem.d.ts +6 -4
  39. package/components/menu/MenuList.d.ts +6 -3
  40. package/components/modal/Modal.d.ts +0 -4
  41. package/components/modal/ModalBackdrop.d.ts +6 -0
  42. package/components/modal/useModal.d.ts +6 -0
  43. package/components/multiRowTableCell/MultiRowTableCell.d.ts +4 -4
  44. package/components/pageHeading/PageHeading.d.ts +6 -3
  45. package/components/popover/PopoverList.d.ts +6 -0
  46. package/components/popover/PopoverListItem.d.ts +6 -0
  47. package/components/popover/PopoverTitle.d.ts +6 -0
  48. package/components/popover/usePopover.d.ts +6 -0
  49. package/components/prompt/Prompt.d.ts +13 -3
  50. package/components/radioGroup/RadioGroup.d.ts +6 -8
  51. package/components/radioGroup/RadioItem.d.ts +6 -2
  52. package/components/select/CreatableSelect.d.ts +6 -0
  53. package/components/select/FieldContainer.d.ts +6 -0
  54. package/components/select/Select.d.ts +6 -0
  55. package/components/select/shared.d.ts +15 -9
  56. package/components/skeletonLines/SkeletonLines.d.ts +0 -5
  57. package/components/spacer/Spacer.d.ts +6 -2
  58. package/components/spinner/Spinner.d.ts +6 -0
  59. package/components/text/Text.d.ts +6 -10
  60. package/components/textArea/TextArea.d.ts +0 -54
  61. package/components/textField/TextField.d.ts +0 -2
  62. package/components/textField/TextLenghtIndicator.d.ts +13 -0
  63. package/components/tip/Tip.d.ts +8 -3
  64. package/components/toggle/Toggle.d.ts +0 -26
  65. package/components/tooltip/Tooltip.d.ts +6 -9
  66. package/hooks/useDebounce.d.ts +7 -0
  67. package/hooks/useLocalStorage.d.ts +7 -0
  68. package/hooks/useTimeout.d.ts +6 -0
  69. package/index.js +455 -63
  70. package/layout/helper/MinTopFullContentLayout.d.ts +6 -0
  71. package/layout/responsive/FilterListMapLayout.d.ts +6 -3
  72. package/layout/responsive/FullWidthRepeatingLayout.d.ts +8 -5
  73. package/layout/responsive/GridArea.d.ts +3 -1
  74. package/layout/responsive/IntrinsicallyResponsiveGrid.d.ts +12 -8
  75. package/layout/responsive/TitleNavContentLayout.d.ts +8 -2
  76. package/layout/responsive/TwoColumnLayout.d.ts +8 -2
  77. package/package.json +5 -5
package/index.js CHANGED
@@ -25,6 +25,14 @@ const docs = {
25
25
  }
26
26
  };
27
27
 
28
+ /**
29
+ * Utility for common props on containers.
30
+ *
31
+ * @param {IUseContainerProps} ContainerProps - Props for the utility
32
+ * @param {string} ContainerProps.className - Optional custom className
33
+ * @param {string} ContainerProps.dataTestId - Optional custom data-TestId
34
+ * @returns {IUseContainerProps} - Object with undefined values removed
35
+ */
28
36
  const useContainerProps = ({
29
37
  className,
30
38
  dataTestId
@@ -72,6 +80,13 @@ function __rest(s, e) {
72
80
  return t;
73
81
  }
74
82
 
83
+ /**
84
+ * The Spinner component should be used st show a loading state.
85
+ *
86
+ * @param {SpinnerProps} props - The props for the Spinner component
87
+ * @returns {JSX.Element} Spinner component
88
+ */
89
+
75
90
  const Spinner = ({
76
91
  mode = "light",
77
92
  size = "regular",
@@ -121,6 +136,12 @@ const Container$8 = tw.div`
121
136
  ${p => p.$centered ? tws`spinner--container-centered` : null}
122
137
  `;
123
138
 
139
+ /**
140
+ * Helper to get the needed classname from buttonProps.
141
+ *
142
+ * @returns {string} - Classnames for the button
143
+ */
144
+
124
145
  const getStyles = () => ({
125
146
  $intent,
126
147
  $variant
@@ -143,6 +164,12 @@ const getStyles = () => ({
143
164
  };
144
165
  return styles[$variant][$intent];
145
166
  };
167
+ /**
168
+ * Helper to get the needed classname for padding.
169
+ *
170
+ * @returns {string} - The correct class for setting padding.
171
+ */
172
+
146
173
  const getPadding = () => ({
147
174
  $size
148
175
  }) => {
@@ -299,6 +326,13 @@ const IconSizeClassMap = {
299
326
  large: tws`w-6` // 24x24px
300
327
 
301
328
  };
329
+ /**
330
+ * The Icon component is ued to display an Icon.
331
+ *
332
+ * @param {IconProps} props - The props for the Icon component
333
+ * @returns {JSX.Element} Icon component
334
+ */
335
+
302
336
  const Icon$1 = ({
303
337
  name,
304
338
  size = "large",
@@ -417,6 +451,13 @@ const Root$3 = tw.span`
417
451
  }}
418
452
  `;
419
453
 
454
+ /**
455
+ * The StarButton component is used for favorite actions or similar.
456
+ *
457
+ * @param {StarButtonProps} props - The props for the StarButton component
458
+ * @returns {JSX.Element} StarButton component
459
+ */
460
+
420
461
  const StarButton = ({
421
462
  starred,
422
463
  onClick
@@ -444,6 +485,13 @@ const CustomIcon = tw(Icon$1)`
444
485
  ${p => p.$starred ? tws`!fill-primary-600 !stroke-transparent` : tws`!fill-transparent !stroke-neutral-800`}
445
486
  `;
446
487
 
488
+ /**
489
+ * The Text component.
490
+ *
491
+ * @param {TextProps} props - The props for the Text component
492
+ * @returns {JSX.Element} Text component
493
+ */
494
+
447
495
  const Text = ({
448
496
  children,
449
497
  type = "p",
@@ -528,6 +576,13 @@ const StyledText$3 = tw.text`
528
576
  ${getTextWeight()}
529
577
  `;
530
578
 
579
+ /**
580
+ * The Alert component should be used to inform the user of important information.
581
+ *
582
+ * @param {AlertProps} props - The props for the Alert component
583
+ * @returns {JSX.Element} Alert component
584
+ */
585
+
531
586
  const Alert = ({
532
587
  intent = "info",
533
588
  title,
@@ -698,6 +753,13 @@ const IconContainer = tw.div`
698
753
  ${p => p.$inline ? tws`alert__icon-container--inline` : null}
699
754
  `;
700
755
 
756
+ /**
757
+ * The Badge component us used to display states or similar short form information.
758
+ *
759
+ * @param {BadgeProps} props - The props for the Badge component
760
+ * @returns {JSX.Element} Badge component
761
+ */
762
+
701
763
  const Badge = _a => {
702
764
  var {
703
765
  color = "neutral",
@@ -874,6 +936,14 @@ const InputContainer = tw.div`
874
936
  BaseInput.displayName = "BaseInput";
875
937
 
876
938
  const ROLE_CARD = "region";
939
+ /**
940
+ * The Card component is a container for ui elements.
941
+ * Is also used for modals etc.
942
+ *
943
+ * @param {CardProps} props - The props for the Card component
944
+ * @returns {JSX.Element} Card component
945
+ */
946
+
877
947
  const Card = ({
878
948
  children,
879
949
  onClick,
@@ -926,6 +996,15 @@ const StyledCard$1 = tw.div`
926
996
  ${getOverflow$1()}
927
997
  `;
928
998
 
999
+ /**
1000
+ * The DensityContainer component applies gap and padding.
1001
+ * The padding should live here, and not on the Card itself, as to not inset the scrollbar in case of overflow.
1002
+ *
1003
+ * @summary For applying auto padding and gap to a Card or Modal or whatever.
1004
+ * @param {ContainerProps} props - The props for the DensityContainer component
1005
+ * @returns {JSX.Element} DensityContainer component
1006
+ */
1007
+
929
1008
  const DensityContainer = ({
930
1009
  children,
931
1010
  className,
@@ -997,11 +1076,12 @@ ${DensityFinder}
997
1076
  `;
998
1077
 
999
1078
  /**
1000
- * @summary
1001
- * For applying padding and gap to a Card.
1079
+ * The CardBody component should be used to inform the user of important information.
1002
1080
  *
1003
- * @description
1004
- * The padding must live here, and not on the Card itself, as to not inset the scrollbar in case of overflow
1081
+ * @summary For applying padding and gap to a Card.
1082
+ * @description The padding must live here, and not on the Card itself, as to not inset the scrollbar in case of overflow
1083
+ * @param {CardContentProps} props - The props for the CardBody component
1084
+ * @returns {JSX.Element} CardBody component
1005
1085
  */
1006
1086
 
1007
1087
  const CardBody = ({
@@ -1049,8 +1129,8 @@ const StyledDensityContainer = tw(DensityContainer)`
1049
1129
  * Currently only intended to contain Buttons.
1050
1130
  * The buttons justifies to the right, but if you style a button with "margin-right: auto" it will move to the left
1051
1131
  *
1052
- * @param {CardFooterProps} { dataTestId, className, children, density }
1053
- * @return {*}
1132
+ * @param {CardFooterProps} props - The props for the CardFooter component
1133
+ * @returns {JSX.Element} CardFooter component
1054
1134
  */
1055
1135
 
1056
1136
  const CardFooter = ({
@@ -1080,6 +1160,13 @@ flex-wrap
1080
1160
  justify-end
1081
1161
  `;
1082
1162
 
1163
+ /**
1164
+ * The Heading component should be used for Headings.
1165
+ *
1166
+ * @param {HeadingProps} props - The props for the Heading component
1167
+ * @returns {JSX.Element} Heading component
1168
+ */
1169
+
1083
1170
  const Heading = ({
1084
1171
  children,
1085
1172
  variant = "primary",
@@ -1134,20 +1221,10 @@ const StyledHeading = tw.div`
1134
1221
  `;
1135
1222
 
1136
1223
  /**
1137
- * Header for Cards and Models.
1138
- *
1224
+ * Header for Cards and Modals.
1139
1225
  *
1140
- * @param {CardHeaderProps} {
1141
- * heading,
1142
- * headingVariant = "primary",
1143
- * subHeading,
1144
- * onClose,
1145
- * dataTestId,
1146
- * className,
1147
- * children,
1148
- * density,
1149
- * }
1150
- * @return {*}
1226
+ * @param {CardHeaderProps} props - The props for the CardHeader component
1227
+ * @returns {JSX.Element} CardHeader component
1151
1228
  */
1152
1229
 
1153
1230
  const CardHeader = ({
@@ -1208,8 +1285,11 @@ gap-4
1208
1285
  `;
1209
1286
 
1210
1287
  /**
1211
- * A wrapper component for Echarts.
1288
+ * The Chart component is a wrapper component for ECharts.
1212
1289
  * Handles events and click functionality.
1290
+ *
1291
+ * @param {IChartProps} props - The props for the Chart component
1292
+ * @returns {JSX.Element} Chart component
1213
1293
  */
1214
1294
 
1215
1295
  const Chart = ({
@@ -1228,6 +1308,8 @@ const Chart = ({
1228
1308
  timezoneLabel,
1229
1309
  renderer = "canvas"
1230
1310
  }) => {
1311
+ var _a, _b;
1312
+
1231
1313
  const echartsRef = React.useRef(null);
1232
1314
  const eventHandlers = React.useMemo(() => {
1233
1315
  const values = {};
@@ -1265,28 +1347,13 @@ const Chart = ({
1265
1347
  }
1266
1348
  };
1267
1349
  }, [onClick, echartsRef]);
1268
-
1269
- const getTypesafeDimension = dimension => {
1270
- if (typeof dimension === "string") {
1271
- return dimension;
1272
- } else if (typeof dimension === "number") {
1273
- return `${dimension}px`;
1350
+ return jsx(ChartContainer, Object.assign({
1351
+ style: {
1352
+ height: (_a = style === null || style === void 0 ? void 0 : style.height) !== null && _a !== void 0 ? _a : "300px",
1353
+ width: (_b = style === null || style === void 0 ? void 0 : style.width) !== null && _b !== void 0 ? _b : "100%"
1274
1354
  }
1275
-
1276
- return "auto";
1277
- };
1278
-
1279
- const classDimensions = React.useMemo(() => {
1280
- var _a, _b;
1281
-
1282
- const height = (_a = style === null || style === void 0 ? void 0 : style.height) !== null && _a !== void 0 ? _a : "300px";
1283
- const width = (_b = style === null || style === void 0 ? void 0 : style.width) !== null && _b !== void 0 ? _b : "100%";
1284
- return `h-[${getTypesafeDimension(height)}] w-[${getTypesafeDimension(width)}]`;
1285
- }, [style === null || style === void 0 ? void 0 : style.height, style === null || style === void 0 ? void 0 : style.width]);
1286
- return jsx(ChartContainer, {
1287
- children: showLoading ? jsxs(SpinnerContainer, Object.assign({
1288
- dimensions: classDimensions
1289
- }, {
1355
+ }, {
1356
+ children: showLoading ? jsxs(SpinnerContainer, {
1290
1357
  children: [jsx(Spinner, {
1291
1358
  centered: true
1292
1359
  }), (loadingOption === null || loadingOption === void 0 ? void 0 : loadingOption.text) && jsx(Text, Object.assign({
@@ -1295,7 +1362,7 @@ const Chart = ({
1295
1362
  }, {
1296
1363
  children: loadingOption.text
1297
1364
  }))]
1298
- })) : jsxs(Fragment, {
1365
+ }) : jsxs(Fragment, {
1299
1366
  children: [jsx(EChart, {
1300
1367
  ref: echartsRef,
1301
1368
  option: options,
@@ -1311,22 +1378,30 @@ const Chart = ({
1311
1378
  onChartReady: onChartReady
1312
1379
  }), timezoneLabel]
1313
1380
  })
1314
- });
1381
+ }));
1315
1382
  };
1316
1383
  const SpinnerContainer = tw.div`
1317
1384
  chart-spinner-container
1318
- ${p => `${p.dimensions}`}
1319
1385
  `;
1320
1386
  const ChartContainer = tw.div`
1321
1387
  chart-container
1322
1388
  `;
1323
1389
 
1390
+ /**
1391
+ * The CheckIcon component is used by the checkbox to display the checked state.
1392
+ *
1393
+ * @param {CheckIconProps} props - The props for the CheckIcon component
1394
+ * @returns {JSX.Element} CheckIcon component
1395
+ */
1396
+
1324
1397
  const CheckIcon = ({
1325
- className
1398
+ className,
1399
+ dataTestId
1326
1400
  }) => {
1327
1401
  return jsx("svg", Object.assign({
1328
1402
  xmlns: "http://www.w3.org/2000/svg",
1329
1403
  className: className,
1404
+ "data-testId": dataTestId,
1330
1405
  fill: "none",
1331
1406
  viewBox: "0 0 10 10",
1332
1407
  stroke: "currentColor",
@@ -1340,6 +1415,13 @@ const CheckIcon = ({
1340
1415
  }));
1341
1416
  };
1342
1417
 
1418
+ /**
1419
+ * The IndeterminateIcon component is used by the checkbox to display the Indeterminate state.
1420
+ *
1421
+ * @param {IndeterminateIconProps} props - The props for the IndeterminateIcon component
1422
+ * @returns {JSX.Element} IndeterminateIcon component
1423
+ */
1424
+
1343
1425
  const IndeterminateIcon = ({
1344
1426
  className
1345
1427
  }) => jsx("svg", Object.assign({
@@ -1476,6 +1558,13 @@ ${({
1476
1558
  }) => $isInvalid ? tws`checkbox--invalid` : null}
1477
1559
  `;
1478
1560
 
1561
+ /**
1562
+ * The Collapse component is ued to condense non-important information.
1563
+ *
1564
+ * @param {CollapseProps} props - The props for the Collapse component
1565
+ * @returns {JSX.Element} Collapse component
1566
+ */
1567
+
1479
1568
  const Collapse = ({
1480
1569
  id,
1481
1570
  initialExpanded = false,
@@ -1584,6 +1673,13 @@ const StyledCollapsible = tw.div`
1584
1673
  collapsible
1585
1674
  `;
1586
1675
 
1676
+ /**
1677
+ * The CopyableText component is used where the user should have easy access to copy some information.
1678
+ *
1679
+ * @param {CopyableTextProps} props - The props for the CopyableText component
1680
+ * @returns {JSX.Element} CopyableText component
1681
+ */
1682
+
1587
1683
  const CopyableText = ({
1588
1684
  text,
1589
1685
  alternativeText,
@@ -1648,10 +1744,24 @@ const localeLookup = {
1648
1744
  ja,
1649
1745
  th
1650
1746
  };
1747
+ /**
1748
+ * A helper function to get the matching Locale object for a given language.
1749
+ *
1750
+ * @param {string} language The language to match
1751
+ * @returns {Locale} The corresponding Locale object
1752
+ */
1753
+
1651
1754
  const useLocale = language => {
1652
1755
  return localeLookup[language] || localeLookup.en;
1653
1756
  };
1654
1757
 
1758
+ /**
1759
+ * The DayPicker component is used when the user needs to select a date.
1760
+ *
1761
+ * @param {DayPickerProps} props - The props for the DayPicker component
1762
+ * @returns {JSX.Element} DayPicker component
1763
+ */
1764
+
1655
1765
  const DayPicker = _a => {
1656
1766
  var {
1657
1767
  onDaySelect,
@@ -1678,6 +1788,13 @@ var PopoverLifecycle;
1678
1788
  PopoverLifecycle["open"] = "open";
1679
1789
  PopoverLifecycle["closing"] = "closing";
1680
1790
  })(PopoverLifecycle || (PopoverLifecycle = {}));
1791
+ /**
1792
+ * The usePopover Hook.
1793
+ *
1794
+ * @param {UsePopoverProps} props - The props for the usePopover hook
1795
+ * @returns {UsePopoverProps} - UsePopoverProps
1796
+ */
1797
+
1681
1798
 
1682
1799
  const usePopover = ({
1683
1800
  targetRef,
@@ -1831,6 +1948,13 @@ const StyledContainer = tw.div`
1831
1948
  z-[21]
1832
1949
  `;
1833
1950
 
1951
+ /**
1952
+ * The PopoverList component.
1953
+ *
1954
+ * @param {PopoverListProps} props - The props for the PopoverList component
1955
+ * @returns {JSX.Element} PopoverList component
1956
+ */
1957
+
1834
1958
  const PopoverList = ({
1835
1959
  className,
1836
1960
  children,
@@ -1925,6 +2049,13 @@ const DateField = forwardRef(({
1925
2049
  });
1926
2050
  });
1927
2051
 
2052
+ /**
2053
+ * The PopoverListItem component.
2054
+ *
2055
+ * @param {PopoverListItemProps} props - The props for the PopoverListItem component
2056
+ * @returns {JSX.Element} PopoverListItem component
2057
+ */
2058
+
1928
2059
  const PopoverListItem = ({
1929
2060
  selected,
1930
2061
  children,
@@ -1985,6 +2116,13 @@ const UnstyledAnchor = tw.a`
1985
2116
  text-inherit
1986
2117
  `;
1987
2118
 
2119
+ /**
2120
+ * The PopoverTitle component.
2121
+ *
2122
+ * @param {PopoverTitleProps} props - The props for the PopoverTitle component
2123
+ * @returns {JSX.Element} PopoverTitle component
2124
+ */
2125
+
1988
2126
  const PopoverTitle = ({
1989
2127
  children,
1990
2128
  action,
@@ -2026,6 +2164,13 @@ const StyledText = tw(Text)`
2026
2164
  text-neutral-500
2027
2165
  `;
2028
2166
 
2167
+ /**
2168
+ * The DayPickerPopover component returns a button which when clicked shows the daypicker.
2169
+ *
2170
+ * @param {DayPickerPopoverProps} props - The props for the DayPickerPopover component
2171
+ * @returns {JSX.Element} DayPickerPopover component
2172
+ */
2173
+
2029
2174
  const DayPickerPopover = ({
2030
2175
  disabledDays,
2031
2176
  className,
@@ -2084,6 +2229,13 @@ const DayPickerPopover = ({
2084
2229
  });
2085
2230
  };
2086
2231
 
2232
+ /**
2233
+ * The DayRangePicker component should be used when the user needs to select a range of dates.
2234
+ *
2235
+ * @param {DayRangePickerProps} props - The props for the DayRangePicker component
2236
+ * @returns {JSX.Element} DayRangePicker component
2237
+ */
2238
+
2087
2239
  const DayRangePicker = ({
2088
2240
  onRangeSelect,
2089
2241
  selectedDays,
@@ -2121,6 +2273,13 @@ const DayRangePicker = ({
2121
2273
  }));
2122
2274
  };
2123
2275
 
2276
+ /**
2277
+ * The Tooltip component.
2278
+ *
2279
+ * @param {TooltipProps} props - The props for the Tooltip component
2280
+ * @returns {JSX.Element} Tooltip component
2281
+ */
2282
+
2124
2283
  const Tooltip = ({
2125
2284
  label,
2126
2285
  placement = "bottom",
@@ -2187,6 +2346,13 @@ const Content$1 = tw.div`
2187
2346
  ${p => p.$mode === "light" ? tws`tooltip--light` : null}
2188
2347
  `;
2189
2348
 
2349
+ /**
2350
+ * The Tip component is used to show helpful tips for users.
2351
+ *
2352
+ * @param {TipProps} props - The props for the Tip component
2353
+ * @returns {JSX.Element} Tip component
2354
+ */
2355
+
2190
2356
  const Tip = _a => {
2191
2357
  var _b;
2192
2358
 
@@ -2220,6 +2386,14 @@ const TipContainer = tw.span`
2220
2386
  `;
2221
2387
  Tip.displayName = "Tip";
2222
2388
 
2389
+ /**
2390
+ * The FormGroup component should be used to wrap any Input element that needs a label.
2391
+ * Besides a label the component supplyes optional Tip, HelpText and HelpAddon support.
2392
+ *
2393
+ * @param {FormGroupProps} props - The props for the FormGroup component
2394
+ * @returns {JSX.Element} FormGroup component
2395
+ */
2396
+
2223
2397
  const FormGroup = ({
2224
2398
  isInvalid,
2225
2399
  helpText,
@@ -2283,6 +2457,13 @@ const HelpAddon = tw.span`
2283
2457
  formGroup-helpAddon
2284
2458
  `;
2285
2459
 
2460
+ /**
2461
+ * The Indicator components are non-interactive elements that communicate essential aspects of the state of an asset.
2462
+ *
2463
+ * @param {IndicatorProps} props - The props for the Indicator component
2464
+ * @returns {JSX.Element} Indicator component
2465
+ */
2466
+
2286
2467
  const Indicator$1 = _a => {
2287
2468
  var {
2288
2469
  dataTestId,
@@ -2375,6 +2556,15 @@ const Label$3 = tw.div`
2375
2556
  indicator__label
2376
2557
  `;
2377
2558
 
2559
+ /**
2560
+ * The Label component is used for labels for input fields.
2561
+ *
2562
+ * **Have a look at the FormGroup first**
2563
+ *
2564
+ * @param {LabelProps} props - The props for the Label component
2565
+ * @returns {JSX.Element} Label component
2566
+ */
2567
+
2378
2568
  const Label$2 = ({
2379
2569
  id,
2380
2570
  htmlFor,
@@ -2383,7 +2573,7 @@ const Label$2 = ({
2383
2573
  className,
2384
2574
  dataTestId
2385
2575
  }) => {
2386
- const labelEl = jsx(Text, Object.assign({
2576
+ const labelElement = jsx(Text, Object.assign({
2387
2577
  weight: "thick",
2388
2578
  className: className,
2389
2579
  dataTestId: dataTestId
@@ -2392,11 +2582,11 @@ const Label$2 = ({
2392
2582
  }));
2393
2583
 
2394
2584
  return jsxs(Fragment, {
2395
- children: [htmlFor === false ? labelEl : jsx("label", Object.assign({
2585
+ children: [htmlFor === false ? labelElement : jsx("label", Object.assign({
2396
2586
  id: id,
2397
2587
  htmlFor: htmlFor
2398
2588
  }, {
2399
- children: labelEl
2589
+ children: labelElement
2400
2590
  })), jsx(Description, Object.assign({
2401
2591
  subtle: true
2402
2592
  }, {
@@ -2408,6 +2598,13 @@ const Description = tw(Text)`
2408
2598
  label
2409
2599
  `;
2410
2600
 
2601
+ /**
2602
+ * The LegendItem component is used to show form legends.
2603
+ *
2604
+ * @param {ILegendItem} props - The props for the LegendItem component
2605
+ * @returns {JSX.Element} LegendItem component
2606
+ */
2607
+
2411
2608
  const LegendItem = ({
2412
2609
  className,
2413
2610
  label,
@@ -2456,6 +2653,13 @@ const Label$1 = tw.span`
2456
2653
  text-sm
2457
2654
  `;
2458
2655
 
2656
+ /**
2657
+ * The MenuButton component.
2658
+ *
2659
+ * @param {IMobileButton} props - The props for the MenuButton component
2660
+ * @returns {JSX.Element} MenuButton component
2661
+ */
2662
+
2459
2663
  const MenuButton = ({
2460
2664
  onClick,
2461
2665
  className
@@ -2483,6 +2687,13 @@ const MobileIconButton = tw(IconButton)`
2483
2687
  !border-gray-300
2484
2688
  `;
2485
2689
 
2690
+ /**
2691
+ * The MenuItem component should be used to inform the user of important information.
2692
+ *
2693
+ * @param {IMenuItemProps} props - The props for the MenuItem component
2694
+ * @returns {JSX.Element} MenuItem component
2695
+ */
2696
+
2486
2697
  const MenuItem = ({
2487
2698
  className,
2488
2699
  dataTestId,
@@ -2519,6 +2730,13 @@ const Label = tw.div`
2519
2730
  menuItem__label
2520
2731
  `;
2521
2732
 
2733
+ /**
2734
+ * The MenuList component is used for menus and selects.
2735
+ *
2736
+ * @param {IMenuListProps} props - The props for the MenuList component
2737
+ * @returns {JSX.Element} MenuList component
2738
+ */
2739
+
2522
2740
  const MenuList = _a => {
2523
2741
  var {
2524
2742
  dataTestId,
@@ -2556,6 +2774,13 @@ const Divider = tw.div`
2556
2774
  menuList__divider
2557
2775
  `;
2558
2776
 
2777
+ /**
2778
+ * The Backdrop for the modal.
2779
+ *
2780
+ * @param {ModalBackdropProps} props - The props for the ModalBackdrop component
2781
+ * @returns {JSX.Element} ModalBackdrop component
2782
+ */
2783
+
2559
2784
  const ModalBackdrop = ({
2560
2785
  children,
2561
2786
  isVisible,
@@ -2674,6 +2899,13 @@ const StyledDiv = tw.div`
2674
2899
  `;
2675
2900
  const AnimatedDiv = animated(StyledDiv);
2676
2901
 
2902
+ /**
2903
+ * The useModal component should be used to inform the user of important information.
2904
+ *
2905
+ * @param {UseModalProps} props - The props for the useModal hook
2906
+ * @returns {*} useModal return
2907
+ */
2908
+
2677
2909
  const useModal = ({
2678
2910
  closeOnOutsideClick
2679
2911
  } = {}) => {
@@ -2719,6 +2951,13 @@ const useModal = ({
2719
2951
  };
2720
2952
  };
2721
2953
 
2954
+ /**
2955
+ * The MinTopFullContentLayout component.
2956
+ *
2957
+ * @param {IMinTopFullContentLayoutProps} props - The props for the MinTopFullContentLayout component
2958
+ * @returns {JSX.Element} MinTopFullContentLayout component
2959
+ */
2960
+
2722
2961
  const MinTopFullContentLayout = ({
2723
2962
  children,
2724
2963
  className,
@@ -2735,6 +2974,23 @@ const Layout$5 = tw.span`
2735
2974
  grid-rows-min-fr
2736
2975
  `;
2737
2976
 
2977
+ /**
2978
+ * Responsive layout component setting up three grid areas
2979
+ * one for filtering, (result-)list and (result-map)
2980
+ *
2981
+ * List needs to handle its own min size - and map takes up the rest.
2982
+ *
2983
+ * Will be inlined to
2984
+ * - filter
2985
+ * - list
2986
+ * - map
2987
+ * on screens < mediaQuery.xxl
2988
+ *
2989
+ *
2990
+ * @param {IProps} props - The props for the FilterListMapLayout component
2991
+ * @returns {JSX.Element} FilterListMapLayout component
2992
+ */
2993
+
2738
2994
  const FilterListMapLayout = ({
2739
2995
  children
2740
2996
  }) => jsx(Layout$4, {
@@ -2744,6 +3000,15 @@ const Layout$4 = tw.span`
2744
3000
  layout-FilterListMap
2745
3001
  `;
2746
3002
 
3003
+ /**
3004
+ * Layout component with repeating full width areas, default one height fraction each but option to use content height instead
3005
+ * Row min height can optionally be set here or managed by children
3006
+ * Scrolling happens if/when children's a min-height is reached
3007
+ *
3008
+ * @param {IFullWidthRepeatingLayoutProps} props - The props for the FullWidthRepeatingLayout component
3009
+ * @returns {JSX.Element} FullWidthRepeatingLayout component
3010
+ */
3011
+
2747
3012
  const FullWidthRepeatingLayout = ({
2748
3013
  children,
2749
3014
  rowSizing = "Unmanaged",
@@ -2780,7 +3045,9 @@ const Layout$3 = tw.span`
2780
3045
 
2781
3046
  /**
2782
3047
  * Simply applies a Grid Area to the element
2783
- * @param {string} area
3048
+ *
3049
+ * @param {GridAreaProps} props - The props for the GridArea component
3050
+ * @returns {JSX.Element} GridArea component
2784
3051
  */
2785
3052
 
2786
3053
  const GridArea = ({
@@ -2802,14 +3069,8 @@ const GridArea = ({
2802
3069
  * A grid container that has a flexible number of columns.
2803
3070
  * Adds more columns if constraints allow it, otherwise wraps to next row
2804
3071
  *
2805
- * @component
2806
- * @prop children - the children to be laid out,
2807
- * @prop occupation = "auto-fill" - stretch a little, till there's room for another column. Optionally set "auto-fit" to stretch children to fit entire container width,
2808
- * @prop minColumnWidth = "normal" - "small" | "normal" | "large"
2809
- * @prop gap = "auto" - the gap size between children,
2810
- * @prop dataTestId,
2811
- * @prop className ,
2812
-
3072
+ * @param {IIntrinsicallyResponsiveGridProps} props - The props for the IntrinsicallyResponsiveGrid component
3073
+ * @returns {JSX.Element} IntrinsicallyResponsiveGrid component
2813
3074
  */
2814
3075
 
2815
3076
  const IntrinsicallyResponsiveGrid = ({
@@ -2900,6 +3161,13 @@ const Layout$2 = tw.span`
2900
3161
  }};
2901
3162
  `;
2902
3163
 
3164
+ /**
3165
+ * The TitleNavContentLayout.
3166
+ *
3167
+ * @param {TitleNavContentLayoutProps} props - The props for the TitleNavContentLayout component
3168
+ * @returns {JSX.Element} TitleNavContentLayout component
3169
+ */
3170
+
2903
3171
  const TitleNavContentLayout = ({
2904
3172
  children
2905
3173
  }) => jsx(Layout$1, {
@@ -2909,6 +3177,13 @@ const Layout$1 = tw.div`
2909
3177
  layout-TitleNavContentLayout
2910
3178
  `;
2911
3179
 
3180
+ /**
3181
+ * TwoColumnLayout.
3182
+ *
3183
+ * @param {TwoColumnLayoutProps} props - The props for the TwoColumnLayout component
3184
+ * @returns {JSX.Element} TwoColumnLayout component
3185
+ */
3186
+
2912
3187
  const TwoColumnLayout = ({
2913
3188
  children
2914
3189
  }) => jsx(Layout, {
@@ -2919,7 +3194,10 @@ const Layout = tw.div`
2919
3194
  `;
2920
3195
 
2921
3196
  /**
2922
- * Extending Table Cell component formats your content supporting 2 rows.
3197
+ * The MultiRowTableCell component extendins Table Cell component and formats your content supporting 2 rows.
3198
+ *
3199
+ * @param {IMultiRowTableCellProps} props - The props for the MultiRowTableCell component
3200
+ * @returns {JSX.Element} MultiRowTableCell component
2923
3201
  */
2924
3202
 
2925
3203
  const MultiRowTableCell = ({
@@ -2952,9 +3230,9 @@ const Secondary = tw.div`
2952
3230
  `;
2953
3231
 
2954
3232
  /**
2955
- * A thin wrapper arround the `BaseInput` component for number input fields.
3233
+ * A thin wrapper around the `BaseInput` component for number input fields.
2956
3234
  *
2957
- * *NOTE: If shown with a label, please use the `NumberField` component instead.*
3235
+ * NOTE: If shown with a label, please use the `NumberField` component instead.
2958
3236
  */
2959
3237
 
2960
3238
  const NumberInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
@@ -3018,6 +3296,13 @@ const GetSpacerHeight = () => ({
3018
3296
  return "";
3019
3297
  }
3020
3298
  };
3299
+ /**
3300
+ * The Spacer component is used for adding a bit of space.
3301
+ *
3302
+ * @param {SpacerProps} props - The props for the Spacer component
3303
+ * @returns {JSX.Element} Spacer component
3304
+ */
3305
+
3021
3306
 
3022
3307
  const Spacer = ({
3023
3308
  minHeight = "",
@@ -3035,6 +3320,13 @@ ${p => `${p.border ? `spacer--border` : null}`}
3035
3320
  ${GetSpacerHeight()}
3036
3321
  `;
3037
3322
 
3323
+ /**
3324
+ * The PageHeading component used on pages.
3325
+ *
3326
+ * @param {PageHeadingProps} props - The props for the PageHeading component
3327
+ * @returns {JSX.Element} PageHeading component
3328
+ */
3329
+
3038
3330
  const PageHeading = ({
3039
3331
  title,
3040
3332
  subtitle,
@@ -3078,6 +3370,7 @@ function useInRouterContext() {
3078
3370
  return useContext(UNSAFE_LocationContext) !== null;
3079
3371
  } // eslint-disable-next-line @typescript-eslint/no-explicit-any
3080
3372
 
3373
+
3081
3374
  function invariant(cond, message) {
3082
3375
  if (!cond) {
3083
3376
  throw new Error(message);
@@ -3108,6 +3401,15 @@ function useBlocker(blocker, when = true) {
3108
3401
  return unblock;
3109
3402
  }, [navigator, blocker, when]);
3110
3403
  }
3404
+ /**
3405
+ * The usePrompt hook.
3406
+ *
3407
+ * @param {string} message -
3408
+ * @param {boolean} when -
3409
+ * @returns {void} void
3410
+ */
3411
+
3412
+
3111
3413
  function usePrompt(message, when = true) {
3112
3414
  const blocker = useCallback(tx => {
3113
3415
  if (window.confirm(message)) {
@@ -3116,6 +3418,13 @@ function usePrompt(message, when = true) {
3116
3418
  }, [message]);
3117
3419
  useBlocker(blocker, when);
3118
3420
  }
3421
+ /**
3422
+ * The Prompt function.
3423
+ *
3424
+ * @param {IPromptProps} Props -
3425
+ * @returns {void} void
3426
+ */
3427
+
3119
3428
  const Prompt = ({
3120
3429
  when,
3121
3430
  message
@@ -3126,6 +3435,13 @@ const Prompt = ({
3126
3435
 
3127
3436
  const RadioGroupContext = React.createContext(null);
3128
3437
 
3438
+ /**
3439
+ * The RadioGroup component.
3440
+ *
3441
+ * @param {RadioGroupProps} props - The props for the RadioGroup component
3442
+ * @returns {JSX.Element} RadioGroup component
3443
+ */
3444
+
3129
3445
  const RadioGroup = ({
3130
3446
  children,
3131
3447
  id,
@@ -3169,6 +3485,13 @@ const Flex = tw.div`
3169
3485
  }) => $inline ? tws`flex-row items-center` : tws`flex-col items-start`}
3170
3486
  `;
3171
3487
 
3488
+ /**
3489
+ * The RadioItem component.
3490
+ *
3491
+ * @param {RadioItemProps} props - The props for the RadioItem component
3492
+ * @returns {JSX.Element} RadioItem component
3493
+ */
3494
+
3172
3495
  const RadioItem = ({
3173
3496
  label,
3174
3497
  value,
@@ -3206,6 +3529,13 @@ const CustomFlex = tw.div`
3206
3529
  hover:cursor-pointer
3207
3530
  `;
3208
3531
 
3532
+ /**
3533
+ * The SelectContainer component.
3534
+ *
3535
+ * @param {SelectContainerProps} props - The props for the SelectContainer component
3536
+ * @returns {JSX.Element} SelectContainer component
3537
+ */
3538
+
3209
3539
  const SelectContainer = ({
3210
3540
  children,
3211
3541
  label,
@@ -3247,6 +3577,16 @@ const getSelectHeight = size => {
3247
3577
  };
3248
3578
  return tokens[size];
3249
3579
  };
3580
+ /**
3581
+ * The useCustomStyles hook for getting trackunit specific styling on react-select.
3582
+ *
3583
+ * @param {StylesConfig} styles -
3584
+ * @param {boolean} hasError -
3585
+ * @param {boolean} isInvalid -
3586
+ * @param {SelectSize} size -
3587
+ * @returns {{StylesConfig}} useCustomStyles hook return
3588
+ */
3589
+
3250
3590
 
3251
3591
  const useCustomStyles = (styles, hasError, isInvalid, size) => {
3252
3592
  const customStyles = React.useMemo(() => {
@@ -3302,6 +3642,13 @@ const useCustomStyles = (styles, hasError, isInvalid, size) => {
3302
3642
  customStyles
3303
3643
  };
3304
3644
  };
3645
+ /**
3646
+ * The useCustomComponents hook for getting trackunit specific components on react-select.
3647
+ *
3648
+ * @param {SelectComponents} components -
3649
+ * @returns {*}} useCustomComponents hook return
3650
+ */
3651
+
3305
3652
  const useCustomComponents = components => {
3306
3653
  const customComponents = React.useMemo(() => {
3307
3654
  return Object.assign({
@@ -3321,6 +3668,13 @@ const useCustomComponents = components => {
3321
3668
  };
3322
3669
  };
3323
3670
 
3671
+ /**
3672
+ * The CreatableSelect component.
3673
+ *
3674
+ * @param {SelectProps} props - The props for the CreatableSelect component
3675
+ * @returns {JSX.Element} CreatableSelect component
3676
+ */
3677
+
3324
3678
  const CreatableSelect = _a => {
3325
3679
  var {
3326
3680
  dataTestId,
@@ -3371,6 +3725,13 @@ const CreatableSelect = _a => {
3371
3725
  }));
3372
3726
  };
3373
3727
 
3728
+ /**
3729
+ * The Select component.
3730
+ *
3731
+ * @param {SelectProps} props - The props for the Select component
3732
+ * @returns {JSX.Element} Select component
3733
+ */
3734
+
3374
3735
  const Select = _a => {
3375
3736
  var {
3376
3737
  dataTestId,
@@ -3591,9 +3952,9 @@ const InformativeText = tw(Text)`
3591
3952
  `;
3592
3953
 
3593
3954
  /**
3594
- * A thin wrapper arround the `BaseInput` component for text input fields.
3955
+ * A thin wrapper around the `BaseInput` component for text input fields.
3595
3956
  *
3596
- * *NOTE: If shown with a label, please use the `TextField` component instead.*
3957
+ * NOTE: If shown with a label, please use the `TextField` component instead.
3597
3958
  */
3598
3959
 
3599
3960
  const TextInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
@@ -3602,6 +3963,14 @@ const TextInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
3602
3963
  }, props)));
3603
3964
  TextInput.displayName = "TextInput";
3604
3965
 
3966
+ /**
3967
+ * The TextLengthIndicator component shows a `{length}/{maxLength}` label.
3968
+ * Used for TextFields to communicate a maximum allowed input length.
3969
+ *
3970
+ * @param {TextLengthIndicatorProps} props - The props for the TextLengthIndicator component
3971
+ * @returns {JSX.Element} TextLengthIndicator component
3972
+ */
3973
+
3605
3974
  const TextLengthIndicator = ({
3606
3975
  length,
3607
3976
  maxLength
@@ -3744,6 +4113,14 @@ absolute
3744
4113
  -z-10
3745
4114
  `;
3746
4115
 
4116
+ /**
4117
+ * The useDebounce hook works like useState, but adds a delay where previous values will be ignored.
4118
+ *
4119
+ * @param {any} value The value to set
4120
+ * @param {number} delay The debounce time
4121
+ * @returns {any} value The latest values received
4122
+ */
4123
+
3747
4124
  const useDebounce = (value, delay = 500) => {
3748
4125
  const [debouncedValue, setDebouncedValue] = useState(value);
3749
4126
  useEffect(() => {
@@ -3757,6 +4134,14 @@ const useDebounce = (value, delay = 500) => {
3757
4134
  return debouncedValue;
3758
4135
  };
3759
4136
 
4137
+ /**
4138
+ * The useLocalStorage hook works like useState, but saves to localstorage.
4139
+ *
4140
+ * @param {string} key - The key the values is saved under.
4141
+ * @param {string | null | undefined} initialValue - The initial value for the state/local storage item
4142
+ * @returns {string | null | undefined} value
4143
+ */
4144
+
3760
4145
  const useLocalStorage = (key, initialValue) => {
3761
4146
  if (!key) {
3762
4147
  throw new Error("useLocalStorage key may not be falsy");
@@ -3812,6 +4197,13 @@ function tryParse(value) {
3812
4197
  }
3813
4198
  }
3814
4199
 
4200
+ /**
4201
+ * The useTimeout hook.
4202
+ *
4203
+ * @param {UseTimeoutProps} props The props
4204
+ * @returns {{ startTimeout: () => void; stopTimeout: () => void; }} return
4205
+ */
4206
+
3815
4207
  const useTimeout = ({
3816
4208
  onTimeout,
3817
4209
  duration
@@ -3842,4 +4234,4 @@ const useTimeout = ({
3842
4234
  };
3843
4235
  };
3844
4236
 
3845
- export { Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, LegendItem, MenuButton, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiRowTableCell, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SkeletonLines, Spacer, Spinner, StarButton, Text, TextArea, TextField, TextInput, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, activityColors, colors, criticalityColors, docs, generalColors, intentColors, useBlocker, useContainerProps, useCustomComponents, useCustomStyles, useDebounce, useInRouterContext, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
4237
+ export { Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, LegendItem, MenuButton, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiRowTableCell, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SkeletonLines, Spacer, Spinner, StarButton, Text, TextArea, TextField, TextInput, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, activityColors, colors, criticalityColors, docs, generalColors, intentColors, useContainerProps, useCustomComponents, useCustomStyles, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };