@trackunit/react-components 0.0.49 → 0.0.52

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