@trackunit/react-components 0.0.49 → 0.0.50

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 +445 -39
  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,
@@ -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.
1224
+ * Header for Cards and Modals.
1138
1225
  *
1139
- *
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 = ({
@@ -1321,12 +1401,21 @@ const ChartContainer = tw.div`
1321
1401
  chart-container
1322
1402
  `;
1323
1403
 
1404
+ /**
1405
+ * The CheckIcon component is used by the checkbox to display the checked state.
1406
+ *
1407
+ * @param {CheckIconProps} props - The props for the CheckIcon component
1408
+ * @returns {JSX.Element} CheckIcon component
1409
+ */
1410
+
1324
1411
  const CheckIcon = ({
1325
- className
1412
+ className,
1413
+ dataTestId
1326
1414
  }) => {
1327
1415
  return jsx("svg", Object.assign({
1328
1416
  xmlns: "http://www.w3.org/2000/svg",
1329
1417
  className: className,
1418
+ "data-testId": dataTestId,
1330
1419
  fill: "none",
1331
1420
  viewBox: "0 0 10 10",
1332
1421
  stroke: "currentColor",
@@ -1340,6 +1429,13 @@ const CheckIcon = ({
1340
1429
  }));
1341
1430
  };
1342
1431
 
1432
+ /**
1433
+ * The IndeterminateIcon component is used by the checkbox to display the Indeterminate state.
1434
+ *
1435
+ * @param {IndeterminateIconProps} props - The props for the IndeterminateIcon component
1436
+ * @returns {JSX.Element} IndeterminateIcon component
1437
+ */
1438
+
1343
1439
  const IndeterminateIcon = ({
1344
1440
  className
1345
1441
  }) => jsx("svg", Object.assign({
@@ -1476,6 +1572,13 @@ ${({
1476
1572
  }) => $isInvalid ? tws`checkbox--invalid` : null}
1477
1573
  `;
1478
1574
 
1575
+ /**
1576
+ * The Collapse component is ued to condense non-important information.
1577
+ *
1578
+ * @param {CollapseProps} props - The props for the Collapse component
1579
+ * @returns {JSX.Element} Collapse component
1580
+ */
1581
+
1479
1582
  const Collapse = ({
1480
1583
  id,
1481
1584
  initialExpanded = false,
@@ -1584,6 +1687,13 @@ const StyledCollapsible = tw.div`
1584
1687
  collapsible
1585
1688
  `;
1586
1689
 
1690
+ /**
1691
+ * The CopyableText component is used where the user should have easy access to copy some information.
1692
+ *
1693
+ * @param {CopyableTextProps} props - The props for the CopyableText component
1694
+ * @returns {JSX.Element} CopyableText component
1695
+ */
1696
+
1587
1697
  const CopyableText = ({
1588
1698
  text,
1589
1699
  alternativeText,
@@ -1648,10 +1758,24 @@ const localeLookup = {
1648
1758
  ja,
1649
1759
  th
1650
1760
  };
1761
+ /**
1762
+ * A helper function to get the matching Locale object for a given language.
1763
+ *
1764
+ * @param {string} language The language to match
1765
+ * @returns {Locale} The corresponding Locale object
1766
+ */
1767
+
1651
1768
  const useLocale = language => {
1652
1769
  return localeLookup[language] || localeLookup.en;
1653
1770
  };
1654
1771
 
1772
+ /**
1773
+ * The DayPicker component is used when the user needs to select a date.
1774
+ *
1775
+ * @param {DayPickerProps} props - The props for the DayPicker component
1776
+ * @returns {JSX.Element} DayPicker component
1777
+ */
1778
+
1655
1779
  const DayPicker = _a => {
1656
1780
  var {
1657
1781
  onDaySelect,
@@ -1678,6 +1802,13 @@ var PopoverLifecycle;
1678
1802
  PopoverLifecycle["open"] = "open";
1679
1803
  PopoverLifecycle["closing"] = "closing";
1680
1804
  })(PopoverLifecycle || (PopoverLifecycle = {}));
1805
+ /**
1806
+ * The usePopover Hook.
1807
+ *
1808
+ * @param {UsePopoverProps} props - The props for the usePopover hook
1809
+ * @returns {UsePopoverProps} - UsePopoverProps
1810
+ */
1811
+
1681
1812
 
1682
1813
  const usePopover = ({
1683
1814
  targetRef,
@@ -1831,6 +1962,13 @@ const StyledContainer = tw.div`
1831
1962
  z-[21]
1832
1963
  `;
1833
1964
 
1965
+ /**
1966
+ * The PopoverList component.
1967
+ *
1968
+ * @param {PopoverListProps} props - The props for the PopoverList component
1969
+ * @returns {JSX.Element} PopoverList component
1970
+ */
1971
+
1834
1972
  const PopoverList = ({
1835
1973
  className,
1836
1974
  children,
@@ -1925,6 +2063,13 @@ const DateField = forwardRef(({
1925
2063
  });
1926
2064
  });
1927
2065
 
2066
+ /**
2067
+ * The PopoverListItem component.
2068
+ *
2069
+ * @param {PopoverListItemProps} props - The props for the PopoverListItem component
2070
+ * @returns {JSX.Element} PopoverListItem component
2071
+ */
2072
+
1928
2073
  const PopoverListItem = ({
1929
2074
  selected,
1930
2075
  children,
@@ -1985,6 +2130,13 @@ const UnstyledAnchor = tw.a`
1985
2130
  text-inherit
1986
2131
  `;
1987
2132
 
2133
+ /**
2134
+ * The PopoverTitle component.
2135
+ *
2136
+ * @param {PopoverTitleProps} props - The props for the PopoverTitle component
2137
+ * @returns {JSX.Element} PopoverTitle component
2138
+ */
2139
+
1988
2140
  const PopoverTitle = ({
1989
2141
  children,
1990
2142
  action,
@@ -2026,6 +2178,13 @@ const StyledText = tw(Text)`
2026
2178
  text-neutral-500
2027
2179
  `;
2028
2180
 
2181
+ /**
2182
+ * The DayPickerPopover component returns a button which when clicked shows the daypicker.
2183
+ *
2184
+ * @param {DayPickerPopoverProps} props - The props for the DayPickerPopover component
2185
+ * @returns {JSX.Element} DayPickerPopover component
2186
+ */
2187
+
2029
2188
  const DayPickerPopover = ({
2030
2189
  disabledDays,
2031
2190
  className,
@@ -2084,6 +2243,13 @@ const DayPickerPopover = ({
2084
2243
  });
2085
2244
  };
2086
2245
 
2246
+ /**
2247
+ * The DayRangePicker component should be used when the user needs to select a range of dates.
2248
+ *
2249
+ * @param {DayRangePickerProps} props - The props for the DayRangePicker component
2250
+ * @returns {JSX.Element} DayRangePicker component
2251
+ */
2252
+
2087
2253
  const DayRangePicker = ({
2088
2254
  onRangeSelect,
2089
2255
  selectedDays,
@@ -2121,6 +2287,13 @@ const DayRangePicker = ({
2121
2287
  }));
2122
2288
  };
2123
2289
 
2290
+ /**
2291
+ * The Tooltip component.
2292
+ *
2293
+ * @param {TooltipProps} props - The props for the Tooltip component
2294
+ * @returns {JSX.Element} Tooltip component
2295
+ */
2296
+
2124
2297
  const Tooltip = ({
2125
2298
  label,
2126
2299
  placement = "bottom",
@@ -2187,6 +2360,13 @@ const Content$1 = tw.div`
2187
2360
  ${p => p.$mode === "light" ? tws`tooltip--light` : null}
2188
2361
  `;
2189
2362
 
2363
+ /**
2364
+ * The Tip component is used to show helpful tips for users.
2365
+ *
2366
+ * @param {TipProps} props - The props for the Tip component
2367
+ * @returns {JSX.Element} Tip component
2368
+ */
2369
+
2190
2370
  const Tip = _a => {
2191
2371
  var _b;
2192
2372
 
@@ -2220,6 +2400,14 @@ const TipContainer = tw.span`
2220
2400
  `;
2221
2401
  Tip.displayName = "Tip";
2222
2402
 
2403
+ /**
2404
+ * The FormGroup component should be used to wrap any Input element that needs a label.
2405
+ * Besides a label the component supplyes optional Tip, HelpText and HelpAddon support.
2406
+ *
2407
+ * @param {FormGroupProps} props - The props for the FormGroup component
2408
+ * @returns {JSX.Element} FormGroup component
2409
+ */
2410
+
2223
2411
  const FormGroup = ({
2224
2412
  isInvalid,
2225
2413
  helpText,
@@ -2283,6 +2471,13 @@ const HelpAddon = tw.span`
2283
2471
  formGroup-helpAddon
2284
2472
  `;
2285
2473
 
2474
+ /**
2475
+ * The Indicator components are non-interactive elements that communicate essential aspects of the state of an asset.
2476
+ *
2477
+ * @param {IndicatorProps} props - The props for the Indicator component
2478
+ * @returns {JSX.Element} Indicator component
2479
+ */
2480
+
2286
2481
  const Indicator$1 = _a => {
2287
2482
  var {
2288
2483
  dataTestId,
@@ -2375,6 +2570,15 @@ const Label$3 = tw.div`
2375
2570
  indicator__label
2376
2571
  `;
2377
2572
 
2573
+ /**
2574
+ * The Label component is used for labels for input fields.
2575
+ *
2576
+ * **Have a look at the FormGroup first**
2577
+ *
2578
+ * @param {LabelProps} props - The props for the Label component
2579
+ * @returns {JSX.Element} Label component
2580
+ */
2581
+
2378
2582
  const Label$2 = ({
2379
2583
  id,
2380
2584
  htmlFor,
@@ -2383,7 +2587,7 @@ const Label$2 = ({
2383
2587
  className,
2384
2588
  dataTestId
2385
2589
  }) => {
2386
- const labelEl = jsx(Text, Object.assign({
2590
+ const labelElement = jsx(Text, Object.assign({
2387
2591
  weight: "thick",
2388
2592
  className: className,
2389
2593
  dataTestId: dataTestId
@@ -2392,11 +2596,11 @@ const Label$2 = ({
2392
2596
  }));
2393
2597
 
2394
2598
  return jsxs(Fragment, {
2395
- children: [htmlFor === false ? labelEl : jsx("label", Object.assign({
2599
+ children: [htmlFor === false ? labelElement : jsx("label", Object.assign({
2396
2600
  id: id,
2397
2601
  htmlFor: htmlFor
2398
2602
  }, {
2399
- children: labelEl
2603
+ children: labelElement
2400
2604
  })), jsx(Description, Object.assign({
2401
2605
  subtle: true
2402
2606
  }, {
@@ -2408,6 +2612,13 @@ const Description = tw(Text)`
2408
2612
  label
2409
2613
  `;
2410
2614
 
2615
+ /**
2616
+ * The LegendItem component is used to show form legends.
2617
+ *
2618
+ * @param {ILegendItem} props - The props for the LegendItem component
2619
+ * @returns {JSX.Element} LegendItem component
2620
+ */
2621
+
2411
2622
  const LegendItem = ({
2412
2623
  className,
2413
2624
  label,
@@ -2456,6 +2667,13 @@ const Label$1 = tw.span`
2456
2667
  text-sm
2457
2668
  `;
2458
2669
 
2670
+ /**
2671
+ * The MenuButton component.
2672
+ *
2673
+ * @param {IMobileButton} props - The props for the MenuButton component
2674
+ * @returns {JSX.Element} MenuButton component
2675
+ */
2676
+
2459
2677
  const MenuButton = ({
2460
2678
  onClick,
2461
2679
  className
@@ -2483,6 +2701,13 @@ const MobileIconButton = tw(IconButton)`
2483
2701
  !border-gray-300
2484
2702
  `;
2485
2703
 
2704
+ /**
2705
+ * The MenuItem component should be used to inform the user of important information.
2706
+ *
2707
+ * @param {IMenuItemProps} props - The props for the MenuItem component
2708
+ * @returns {JSX.Element} MenuItem component
2709
+ */
2710
+
2486
2711
  const MenuItem = ({
2487
2712
  className,
2488
2713
  dataTestId,
@@ -2519,6 +2744,13 @@ const Label = tw.div`
2519
2744
  menuItem__label
2520
2745
  `;
2521
2746
 
2747
+ /**
2748
+ * The MenuList component is used for menus and selects.
2749
+ *
2750
+ * @param {IMenuListProps} props - The props for the MenuList component
2751
+ * @returns {JSX.Element} MenuList component
2752
+ */
2753
+
2522
2754
  const MenuList = _a => {
2523
2755
  var {
2524
2756
  dataTestId,
@@ -2556,6 +2788,13 @@ const Divider = tw.div`
2556
2788
  menuList__divider
2557
2789
  `;
2558
2790
 
2791
+ /**
2792
+ * The Backdrop for the modal.
2793
+ *
2794
+ * @param {ModalBackdropProps} props - The props for the ModalBackdrop component
2795
+ * @returns {JSX.Element} ModalBackdrop component
2796
+ */
2797
+
2559
2798
  const ModalBackdrop = ({
2560
2799
  children,
2561
2800
  isVisible,
@@ -2674,6 +2913,13 @@ const StyledDiv = tw.div`
2674
2913
  `;
2675
2914
  const AnimatedDiv = animated(StyledDiv);
2676
2915
 
2916
+ /**
2917
+ * The useModal component should be used to inform the user of important information.
2918
+ *
2919
+ * @param {UseModalProps} props - The props for the useModal hook
2920
+ * @returns {*} useModal return
2921
+ */
2922
+
2677
2923
  const useModal = ({
2678
2924
  closeOnOutsideClick
2679
2925
  } = {}) => {
@@ -2719,6 +2965,13 @@ const useModal = ({
2719
2965
  };
2720
2966
  };
2721
2967
 
2968
+ /**
2969
+ * The MinTopFullContentLayout component.
2970
+ *
2971
+ * @param {IMinTopFullContentLayoutProps} props - The props for the MinTopFullContentLayout component
2972
+ * @returns {JSX.Element} MinTopFullContentLayout component
2973
+ */
2974
+
2722
2975
  const MinTopFullContentLayout = ({
2723
2976
  children,
2724
2977
  className,
@@ -2735,6 +2988,23 @@ const Layout$5 = tw.span`
2735
2988
  grid-rows-min-fr
2736
2989
  `;
2737
2990
 
2991
+ /**
2992
+ * Responsive layout component setting up three grid areas
2993
+ * one for filtering, (result-)list and (result-map)
2994
+ *
2995
+ * List needs to handle its own min size - and map takes up the rest.
2996
+ *
2997
+ * Will be inlined to
2998
+ * - filter
2999
+ * - list
3000
+ * - map
3001
+ * on screens < mediaQuery.xxl
3002
+ *
3003
+ *
3004
+ * @param {IProps} props - The props for the FilterListMapLayout component
3005
+ * @returns {JSX.Element} FilterListMapLayout component
3006
+ */
3007
+
2738
3008
  const FilterListMapLayout = ({
2739
3009
  children
2740
3010
  }) => jsx(Layout$4, {
@@ -2744,6 +3014,15 @@ const Layout$4 = tw.span`
2744
3014
  layout-FilterListMap
2745
3015
  `;
2746
3016
 
3017
+ /**
3018
+ * Layout component with repeating full width areas, default one height fraction each but option to use content height instead
3019
+ * Row min height can optionally be set here or managed by children
3020
+ * Scrolling happens if/when children's a min-height is reached
3021
+ *
3022
+ * @param {IFullWidthRepeatingLayoutProps} props - The props for the FullWidthRepeatingLayout component
3023
+ * @returns {JSX.Element} FullWidthRepeatingLayout component
3024
+ */
3025
+
2747
3026
  const FullWidthRepeatingLayout = ({
2748
3027
  children,
2749
3028
  rowSizing = "Unmanaged",
@@ -2780,7 +3059,9 @@ const Layout$3 = tw.span`
2780
3059
 
2781
3060
  /**
2782
3061
  * Simply applies a Grid Area to the element
2783
- * @param {string} area
3062
+ *
3063
+ * @param {GridAreaProps} props - The props for the GridArea component
3064
+ * @returns {JSX.Element} GridArea component
2784
3065
  */
2785
3066
 
2786
3067
  const GridArea = ({
@@ -2802,14 +3083,8 @@ const GridArea = ({
2802
3083
  * A grid container that has a flexible number of columns.
2803
3084
  * Adds more columns if constraints allow it, otherwise wraps to next row
2804
3085
  *
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
-
3086
+ * @param {IIntrinsicallyResponsiveGridProps} props - The props for the IntrinsicallyResponsiveGrid component
3087
+ * @returns {JSX.Element} IntrinsicallyResponsiveGrid component
2813
3088
  */
2814
3089
 
2815
3090
  const IntrinsicallyResponsiveGrid = ({
@@ -2900,6 +3175,13 @@ const Layout$2 = tw.span`
2900
3175
  }};
2901
3176
  `;
2902
3177
 
3178
+ /**
3179
+ * The TitleNavContentLayout.
3180
+ *
3181
+ * @param {TitleNavContentLayoutProps} props - The props for the TitleNavContentLayout component
3182
+ * @returns {JSX.Element} TitleNavContentLayout component
3183
+ */
3184
+
2903
3185
  const TitleNavContentLayout = ({
2904
3186
  children
2905
3187
  }) => jsx(Layout$1, {
@@ -2909,6 +3191,13 @@ const Layout$1 = tw.div`
2909
3191
  layout-TitleNavContentLayout
2910
3192
  `;
2911
3193
 
3194
+ /**
3195
+ * TwoColumnLayout.
3196
+ *
3197
+ * @param {TwoColumnLayoutProps} props - The props for the TwoColumnLayout component
3198
+ * @returns {JSX.Element} TwoColumnLayout component
3199
+ */
3200
+
2912
3201
  const TwoColumnLayout = ({
2913
3202
  children
2914
3203
  }) => jsx(Layout, {
@@ -2919,7 +3208,10 @@ const Layout = tw.div`
2919
3208
  `;
2920
3209
 
2921
3210
  /**
2922
- * Extending Table Cell component formats your content supporting 2 rows.
3211
+ * The MultiRowTableCell component extendins Table Cell component and formats your content supporting 2 rows.
3212
+ *
3213
+ * @param {IMultiRowTableCellProps} props - The props for the MultiRowTableCell component
3214
+ * @returns {JSX.Element} MultiRowTableCell component
2923
3215
  */
2924
3216
 
2925
3217
  const MultiRowTableCell = ({
@@ -2952,9 +3244,9 @@ const Secondary = tw.div`
2952
3244
  `;
2953
3245
 
2954
3246
  /**
2955
- * A thin wrapper arround the `BaseInput` component for number input fields.
3247
+ * A thin wrapper around the `BaseInput` component for number input fields.
2956
3248
  *
2957
- * *NOTE: If shown with a label, please use the `NumberField` component instead.*
3249
+ * NOTE: If shown with a label, please use the `NumberField` component instead.
2958
3250
  */
2959
3251
 
2960
3252
  const NumberInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
@@ -3018,6 +3310,13 @@ const GetSpacerHeight = () => ({
3018
3310
  return "";
3019
3311
  }
3020
3312
  };
3313
+ /**
3314
+ * The Spacer component is used for adding a bit of space.
3315
+ *
3316
+ * @param {SpacerProps} props - The props for the Spacer component
3317
+ * @returns {JSX.Element} Spacer component
3318
+ */
3319
+
3021
3320
 
3022
3321
  const Spacer = ({
3023
3322
  minHeight = "",
@@ -3035,6 +3334,13 @@ ${p => `${p.border ? `spacer--border` : null}`}
3035
3334
  ${GetSpacerHeight()}
3036
3335
  `;
3037
3336
 
3337
+ /**
3338
+ * The PageHeading component used on pages.
3339
+ *
3340
+ * @param {PageHeadingProps} props - The props for the PageHeading component
3341
+ * @returns {JSX.Element} PageHeading component
3342
+ */
3343
+
3038
3344
  const PageHeading = ({
3039
3345
  title,
3040
3346
  subtitle,
@@ -3078,6 +3384,7 @@ function useInRouterContext() {
3078
3384
  return useContext(UNSAFE_LocationContext) !== null;
3079
3385
  } // eslint-disable-next-line @typescript-eslint/no-explicit-any
3080
3386
 
3387
+
3081
3388
  function invariant(cond, message) {
3082
3389
  if (!cond) {
3083
3390
  throw new Error(message);
@@ -3108,6 +3415,15 @@ function useBlocker(blocker, when = true) {
3108
3415
  return unblock;
3109
3416
  }, [navigator, blocker, when]);
3110
3417
  }
3418
+ /**
3419
+ * The usePrompt hook.
3420
+ *
3421
+ * @param {string} message -
3422
+ * @param {boolean} when -
3423
+ * @returns {void} void
3424
+ */
3425
+
3426
+
3111
3427
  function usePrompt(message, when = true) {
3112
3428
  const blocker = useCallback(tx => {
3113
3429
  if (window.confirm(message)) {
@@ -3116,6 +3432,13 @@ function usePrompt(message, when = true) {
3116
3432
  }, [message]);
3117
3433
  useBlocker(blocker, when);
3118
3434
  }
3435
+ /**
3436
+ * The Prompt function.
3437
+ *
3438
+ * @param {IPromptProps} Props -
3439
+ * @returns {void} void
3440
+ */
3441
+
3119
3442
  const Prompt = ({
3120
3443
  when,
3121
3444
  message
@@ -3126,6 +3449,13 @@ const Prompt = ({
3126
3449
 
3127
3450
  const RadioGroupContext = React.createContext(null);
3128
3451
 
3452
+ /**
3453
+ * The RadioGroup component.
3454
+ *
3455
+ * @param {RadioGroupProps} props - The props for the RadioGroup component
3456
+ * @returns {JSX.Element} RadioGroup component
3457
+ */
3458
+
3129
3459
  const RadioGroup = ({
3130
3460
  children,
3131
3461
  id,
@@ -3169,6 +3499,13 @@ const Flex = tw.div`
3169
3499
  }) => $inline ? tws`flex-row items-center` : tws`flex-col items-start`}
3170
3500
  `;
3171
3501
 
3502
+ /**
3503
+ * The RadioItem component.
3504
+ *
3505
+ * @param {RadioItemProps} props - The props for the RadioItem component
3506
+ * @returns {JSX.Element} RadioItem component
3507
+ */
3508
+
3172
3509
  const RadioItem = ({
3173
3510
  label,
3174
3511
  value,
@@ -3206,6 +3543,13 @@ const CustomFlex = tw.div`
3206
3543
  hover:cursor-pointer
3207
3544
  `;
3208
3545
 
3546
+ /**
3547
+ * The SelectContainer component.
3548
+ *
3549
+ * @param {SelectContainerProps} props - The props for the SelectContainer component
3550
+ * @returns {JSX.Element} SelectContainer component
3551
+ */
3552
+
3209
3553
  const SelectContainer = ({
3210
3554
  children,
3211
3555
  label,
@@ -3247,6 +3591,16 @@ const getSelectHeight = size => {
3247
3591
  };
3248
3592
  return tokens[size];
3249
3593
  };
3594
+ /**
3595
+ * The useCustomStyles hook for getting trackunit specific styling on react-select.
3596
+ *
3597
+ * @param {StylesConfig} styles -
3598
+ * @param {boolean} hasError -
3599
+ * @param {boolean} isInvalid -
3600
+ * @param {SelectSize} size -
3601
+ * @returns {{StylesConfig}} useCustomStyles hook return
3602
+ */
3603
+
3250
3604
 
3251
3605
  const useCustomStyles = (styles, hasError, isInvalid, size) => {
3252
3606
  const customStyles = React.useMemo(() => {
@@ -3302,6 +3656,13 @@ const useCustomStyles = (styles, hasError, isInvalid, size) => {
3302
3656
  customStyles
3303
3657
  };
3304
3658
  };
3659
+ /**
3660
+ * The useCustomComponents hook for getting trackunit specific components on react-select.
3661
+ *
3662
+ * @param {SelectComponents} components -
3663
+ * @returns {*}} useCustomComponents hook return
3664
+ */
3665
+
3305
3666
  const useCustomComponents = components => {
3306
3667
  const customComponents = React.useMemo(() => {
3307
3668
  return Object.assign({
@@ -3321,6 +3682,13 @@ const useCustomComponents = components => {
3321
3682
  };
3322
3683
  };
3323
3684
 
3685
+ /**
3686
+ * The CreatableSelect component.
3687
+ *
3688
+ * @param {SelectProps} props - The props for the CreatableSelect component
3689
+ * @returns {JSX.Element} CreatableSelect component
3690
+ */
3691
+
3324
3692
  const CreatableSelect = _a => {
3325
3693
  var {
3326
3694
  dataTestId,
@@ -3371,6 +3739,13 @@ const CreatableSelect = _a => {
3371
3739
  }));
3372
3740
  };
3373
3741
 
3742
+ /**
3743
+ * The Select component.
3744
+ *
3745
+ * @param {SelectProps} props - The props for the Select component
3746
+ * @returns {JSX.Element} Select component
3747
+ */
3748
+
3374
3749
  const Select = _a => {
3375
3750
  var {
3376
3751
  dataTestId,
@@ -3591,9 +3966,9 @@ const InformativeText = tw(Text)`
3591
3966
  `;
3592
3967
 
3593
3968
  /**
3594
- * A thin wrapper arround the `BaseInput` component for text input fields.
3969
+ * A thin wrapper around the `BaseInput` component for text input fields.
3595
3970
  *
3596
- * *NOTE: If shown with a label, please use the `TextField` component instead.*
3971
+ * NOTE: If shown with a label, please use the `TextField` component instead.
3597
3972
  */
3598
3973
 
3599
3974
  const TextInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
@@ -3602,6 +3977,14 @@ const TextInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
3602
3977
  }, props)));
3603
3978
  TextInput.displayName = "TextInput";
3604
3979
 
3980
+ /**
3981
+ * The TextLengthIndicator component shows a `{length}/{maxLength}` label.
3982
+ * Used for TextFields to communicate a maximum allowed input length.
3983
+ *
3984
+ * @param {TextLengthIndicatorProps} props - The props for the TextLengthIndicator component
3985
+ * @returns {JSX.Element} TextLengthIndicator component
3986
+ */
3987
+
3605
3988
  const TextLengthIndicator = ({
3606
3989
  length,
3607
3990
  maxLength
@@ -3744,6 +4127,14 @@ absolute
3744
4127
  -z-10
3745
4128
  `;
3746
4129
 
4130
+ /**
4131
+ * The useDebounce hook works like useState, but adds a delay where previous values will be ignored.
4132
+ *
4133
+ * @param {any} value The value to set
4134
+ * @param {number} delay The debounce time
4135
+ * @returns {any} value The latest values received
4136
+ */
4137
+
3747
4138
  const useDebounce = (value, delay = 500) => {
3748
4139
  const [debouncedValue, setDebouncedValue] = useState(value);
3749
4140
  useEffect(() => {
@@ -3757,6 +4148,14 @@ const useDebounce = (value, delay = 500) => {
3757
4148
  return debouncedValue;
3758
4149
  };
3759
4150
 
4151
+ /**
4152
+ * The useLocalStorage hook works like useState, but saves to localstorage.
4153
+ *
4154
+ * @param {string} key - The key the values is saved under.
4155
+ * @param {string | null | undefined} initialValue - The initial value for the state/local storage item
4156
+ * @returns {string | null | undefined} value
4157
+ */
4158
+
3760
4159
  const useLocalStorage = (key, initialValue) => {
3761
4160
  if (!key) {
3762
4161
  throw new Error("useLocalStorage key may not be falsy");
@@ -3812,6 +4211,13 @@ function tryParse(value) {
3812
4211
  }
3813
4212
  }
3814
4213
 
4214
+ /**
4215
+ * The useTimeout hook.
4216
+ *
4217
+ * @param {UseTimeoutProps} props The props
4218
+ * @returns {{ startTimeout: () => void; stopTimeout: () => void; }} return
4219
+ */
4220
+
3815
4221
  const useTimeout = ({
3816
4222
  onTimeout,
3817
4223
  duration
@@ -3842,4 +4248,4 @@ const useTimeout = ({
3842
4248
  };
3843
4249
  };
3844
4250
 
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 };
4251
+ 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 };