@trackunit/react-components 0.0.89 → 0.0.99

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.
@@ -1,8 +1,9 @@
1
1
  import * as React from "react";
2
+ import { CommonProps } from "../../common";
2
3
  export interface IOptionsType {
3
4
  [key: string]: any;
4
5
  }
5
- export interface ChartProps {
6
+ export interface ChartProps extends CommonProps {
6
7
  /**
7
8
  * Option values for EChart.
8
9
  */
@@ -31,10 +32,6 @@ export interface ChartProps {
31
32
  * Event fired when mouse leaves the chart.
32
33
  */
33
34
  mouseLeaveChart?: () => void;
34
- /**
35
- * Class values to be passed to the component.
36
- */
37
- className?: string;
38
35
  /**
39
36
  * CSS styles for the chart.
40
37
  */
@@ -20,7 +20,7 @@ export interface CollapseProps extends CommonProps {
20
20
  label: React.ReactNode;
21
21
  }
22
22
  /**
23
- * The Collapse component is ued to condense non-important information.
23
+ * The Collapse component is used to condense non-important information.
24
24
  *
25
25
  * @param {CollapseProps} props - The props for the Collapse component
26
26
  * @returns {JSX.Element} Collapse component
@@ -1,17 +1,16 @@
1
1
  /// <reference types="react" />
2
- interface CopyableTextProps {
2
+ import { CommonProps } from "../../common";
3
+ export interface CopyableTextProps extends CommonProps {
3
4
  /**
4
- * The text to be displayed.
5
+ * The text shown in the ui.
6
+ * By default this is also the text that gets copied when component is clicked.
5
7
  */
6
8
  text?: string;
7
9
  /**
8
- * Alternative text to be displayed.
10
+ * Alternative text to get copied to on click.
11
+ * This text is not visible in the ui.
9
12
  */
10
13
  alternativeText?: string;
11
- /**
12
- * ID of the component to be used while testing.
13
- */
14
- dataTestId?: string;
15
14
  }
16
15
  /**
17
16
  * The CopyableText component is used where the user should have easy access to copy some information.
@@ -20,4 +19,3 @@ interface CopyableTextProps {
20
19
  * @returns {JSX.Element} CopyableText component
21
20
  */
22
21
  export declare const CopyableText: ({ text, alternativeText, dataTestId }: CopyableTextProps) => JSX.Element;
23
- export {};
@@ -8,22 +8,17 @@ export interface LabelProps extends CommonProps {
8
8
  /**
9
9
  * Specifies the element to which the label belongs to.
10
10
  */
11
- htmlFor: string | false;
11
+ htmlFor?: string;
12
12
  /**
13
13
  * The label value.
14
14
  */
15
- label?: React.ReactNode;
16
- /**
17
- * Description for the label.
18
- */
19
- description?: React.ReactNode;
15
+ children?: React.ReactNode;
20
16
  }
21
17
  /**
22
18
  * The Label component is used for labels for input fields.
23
- *
24
- * **Have a look at the FormGroup first**
19
+ * This component is **not used directly**, but is part of the FormGroup and Field components.
25
20
  *
26
21
  * @param {LabelProps} props - The props for the Label component
27
22
  * @returns {JSX.Element} Label component
28
23
  */
29
- export declare const Label: ({ id, htmlFor, label, description, className, dataTestId }: LabelProps) => JSX.Element;
24
+ export declare const Label: ({ id, htmlFor, children, className, dataTestId }: LabelProps) => JSX.Element;
@@ -49,7 +49,7 @@ export interface MenuItemProps {
49
49
  disabled?: boolean;
50
50
  }
51
51
  /**
52
- * The MenuItem component should be used to inform the user of important information.
52
+ * The MenuItem component is used to display a menu, primarily meant to be used in a list form.
53
53
  *
54
54
  * @param {MenuItemProps} props - The props for the MenuItem component
55
55
  * @returns {JSX.Element} MenuItem component
@@ -7,7 +7,13 @@ export interface TipProps extends CommonProps {
7
7
  * Child nodes to render inside the tip.
8
8
  */
9
9
  children: React.ReactNode;
10
+ /**
11
+ * The props for setting the icon on this tip.
12
+ */
10
13
  iconProps?: Partial<IconProps>;
14
+ /**
15
+ * The props for setting the tooltip on this tip.
16
+ */
11
17
  tooltipProps?: Partial<TooltipProps>;
12
18
  }
13
19
  /**
@@ -17,7 +17,6 @@ export * from "./Label";
17
17
  export * from "./LegendItem";
18
18
  export * from "./Menu";
19
19
  export * from "./Modal";
20
- export * from "./MultiRowTableCell";
21
20
  export * from "./NumberField/NumberField";
22
21
  export * from "./NumberInput/NumberInput";
23
22
  export * from "./PageHeading";
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { tw, tws } from '@trackunit/tailwind-styled-components';
3
3
  import * as React from 'react';
4
- import { useMemo, useState, forwardRef, useCallback, useRef, Fragment as Fragment$1, createElement, useContext, useEffect, memo } from 'react';
4
+ import { useState, forwardRef, useCallback, useRef, Fragment as Fragment$1, createElement, useContext, useEffect, memo } from 'react';
5
5
  import { HeroIconsArray, heroIconLookup, TrackunitSolidIconsArray, TrackunitOutlineIconsArray, trackunitIconLookup } from '@trackunit/ui-icons';
6
6
  import EChart from 'echarts-for-react';
7
7
  import { v4 } from 'uuid';
@@ -650,7 +650,7 @@ const Alert = ({
650
650
  weight: "bold"
651
651
  }, {
652
652
  children: title !== null && title !== void 0 ? title : children
653
- })), children && jsx(Description$3, Object.assign({
653
+ })), children && jsx(Description$2, Object.assign({
654
654
  weight: !title ? "bold" : "default",
655
655
  "$hasTitle": !!title
656
656
  }, {
@@ -661,7 +661,7 @@ const Alert = ({
661
661
  weight: "bold"
662
662
  }, {
663
663
  children: title !== null && title !== void 0 ? title : children
664
- })), children && jsx(Description$3, Object.assign({
664
+ })), children && jsx(Description$2, Object.assign({
665
665
  weight: !title ? "bold" : "default",
666
666
  "$hasTitle": !!title
667
667
  }, {
@@ -688,7 +688,26 @@ const Alert = ({
688
688
  })), jsxs(Content$1, Object.assign({
689
689
  "$inline": inline
690
690
  }, {
691
- children: [body, (primaryAction || secondaryAction) && jsxs(RightAligned, Object.assign({
691
+ children: [jsxs(ContentDetails, {
692
+ children: [jsx(ContentBody, {
693
+ children: body
694
+ }), onClose && !inline ? jsx(CloseButtonContainer, Object.assign({
695
+ "$inline": inline
696
+ }, {
697
+ children: jsx(IconButton, {
698
+ size: "small",
699
+ variant: "transparent",
700
+ intent: "secondary",
701
+ onClick: onClose,
702
+ icon: jsx(Icon$1, {
703
+ name: "XIcon",
704
+ size: "small"
705
+ }),
706
+ title: "Close Alert",
707
+ circular: true
708
+ })
709
+ })) : null]
710
+ }), (primaryAction || secondaryAction || onClose) && jsxs(RightAligned, Object.assign({
692
711
  "$inline": inline
693
712
  }, {
694
713
  children: [secondaryAction && jsx(Button, Object.assign({
@@ -706,24 +725,24 @@ const Alert = ({
706
725
  loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading
707
726
  }, {
708
727
  children: primaryAction.label
709
- }))]
728
+ })), onClose && inline ? jsx(CloseButtonContainer, Object.assign({
729
+ "$inline": inline
730
+ }, {
731
+ children: jsx(IconButton, {
732
+ size: "small",
733
+ variant: "transparent",
734
+ intent: "secondary",
735
+ onClick: onClose,
736
+ icon: jsx(Icon$1, {
737
+ name: "XIcon",
738
+ size: "small"
739
+ }),
740
+ title: "Close Alert",
741
+ circular: true
742
+ })
743
+ })) : null]
710
744
  }))]
711
- })), onClose ? jsx(CloseButtonContainer, Object.assign({
712
- "$inline": inline
713
- }, {
714
- children: jsx(IconButton, {
715
- size: "small",
716
- variant: "transparent",
717
- intent: "secondary",
718
- onClick: onClose,
719
- icon: jsx(Icon$1, {
720
- name: "XIcon",
721
- size: "small"
722
- }),
723
- title: "Close Alert",
724
- circular: true
725
- })
726
- })) : null]
745
+ }))]
727
746
  }));
728
747
  };
729
748
  const CloseButtonContainer = tw.div`
@@ -750,7 +769,13 @@ const Container$7 = tw.div`
750
769
  const Content$1 = tw.div`
751
770
  ${p => p.$inline ? tws`tu-alert__content--inline` : tws`tu-alert__content`}
752
771
  `;
753
- const Description$3 = tw(Text)`
772
+ const ContentDetails = tw.div`
773
+ tu-alert__content-details
774
+ `;
775
+ const ContentBody = tw.div`
776
+ tu-alert__content-body
777
+ `;
778
+ const Description$2 = tw(Text)`
754
779
  ${p => p.$hasTitle ? tws`tu-alert__description` : null}
755
780
  `;
756
781
  const RightAligned = tw.div`
@@ -1554,7 +1579,7 @@ ${({
1554
1579
  `;
1555
1580
 
1556
1581
  /**
1557
- * The Collapse component is ued to condense non-important information.
1582
+ * The Collapse component is used to condense non-important information.
1558
1583
  *
1559
1584
  * @param {CollapseProps} props - The props for the Collapse component
1560
1585
  * @returns {JSX.Element} Collapse component
@@ -1680,11 +1705,9 @@ const CopyableText = ({
1680
1705
  alternativeText,
1681
1706
  dataTestId
1682
1707
  }) => {
1683
- const value = useMemo(() => {
1684
- var _a;
1708
+ var _a;
1685
1709
 
1686
- return (_a = alternativeText !== null && alternativeText !== void 0 ? alternativeText : text) !== null && _a !== void 0 ? _a : "";
1687
- }, [alternativeText, text]);
1710
+ const value = (_a = alternativeText !== null && alternativeText !== void 0 ? alternativeText : text) !== null && _a !== void 0 ? _a : "";
1688
1711
  const [animating, setAnimating] = useState(false);
1689
1712
  const [, copyToClipboard] = useCopyToClipboard();
1690
1713
 
@@ -1693,16 +1716,17 @@ const CopyableText = ({
1693
1716
  setAnimating(true);
1694
1717
  };
1695
1718
 
1696
- return jsx(CopyableTextContainer, Object.assign({
1719
+ return jsx(StyledCopyableText, Object.assign({
1697
1720
  "data-testid": dataTestId,
1698
1721
  onClick: handleOnClick,
1699
1722
  onAnimationEnd: () => setAnimating(false),
1700
- "$animating": animating
1723
+ "$animating": animating,
1724
+ title: value
1701
1725
  }, {
1702
1726
  children: text
1703
1727
  }));
1704
1728
  };
1705
- const CopyableTextContainer = tw.span`
1729
+ const StyledCopyableText = tw.span`
1706
1730
  py-1
1707
1731
  px-2
1708
1732
  border
@@ -2283,6 +2307,34 @@ const DayRangePicker = ({
2283
2307
  }));
2284
2308
  };
2285
2309
 
2310
+ /**
2311
+ * The Label component is used for labels for input fields.
2312
+ * This component is **not used directly**, but is part of the FormGroup and Field components.
2313
+ *
2314
+ * @param {LabelProps} props - The props for the Label component
2315
+ * @returns {JSX.Element} Label component
2316
+ */
2317
+
2318
+ const Label$5 = ({
2319
+ id,
2320
+ htmlFor,
2321
+ children,
2322
+ className,
2323
+ dataTestId
2324
+ }) => {
2325
+ return jsx(Root$2, Object.assign({
2326
+ className: className,
2327
+ id: id,
2328
+ "data-testid": dataTestId,
2329
+ htmlFor: htmlFor
2330
+ }, {
2331
+ children: children
2332
+ }));
2333
+ };
2334
+ const Root$2 = tw.label`
2335
+ tu-label
2336
+ `;
2337
+
2286
2338
  /**
2287
2339
  * The Tooltip component.
2288
2340
  *
@@ -2381,7 +2433,7 @@ const Tip = _a => {
2381
2433
  label: children,
2382
2434
  dataTestId: `${dataTestId}-tooltip`
2383
2435
  }, tooltipProps, {
2384
- className: `${(_b = tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className) !== null && _b !== void 0 ? _b : ""} ${tws`inline-flex`}`
2436
+ className: `${(_b = tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className) !== null && _b !== void 0 ? _b : ""} tu-tip-tooltip`
2385
2437
  }, {
2386
2438
  children: jsx(Icon$1, Object.assign({
2387
2439
  name: "QuestionMarkCircleIcon",
@@ -2418,7 +2470,7 @@ const FormGroup = ({
2418
2470
  "data-testid": dataTestId
2419
2471
  }, {
2420
2472
  children: [jsxs(ContainerBefore, {
2421
- children: [jsx(StyledTitle, Object.assign({
2473
+ children: [jsx(Label$5, Object.assign({
2422
2474
  "data-testid": `${dataTestId}-label`
2423
2475
  }, {
2424
2476
  children: label
@@ -2444,14 +2496,6 @@ const FormGroup = ({
2444
2496
  };
2445
2497
  const FormGroupRoot = tw.label`
2446
2498
  tu-form-group
2447
- `; // TODO: Update and use Label component instead
2448
-
2449
- const StyledTitle = tw.span`
2450
- block
2451
- text-sm
2452
- text-slate-700
2453
- font-medium
2454
- mb-1
2455
2499
  `;
2456
2500
  const ContainerBefore = tw.div`
2457
2501
  tu-form-group__container-before
@@ -2498,7 +2542,7 @@ const Indicator$1 = _a => {
2498
2542
  "$withBackground": withBackground
2499
2543
  }, {
2500
2544
  children: icon
2501
- })), label !== undefined && jsx(Label$5, Object.assign({
2545
+ })), label !== undefined && jsx(Label$4, Object.assign({
2502
2546
  "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label"
2503
2547
  }, {
2504
2548
  children: label
@@ -2567,52 +2611,10 @@ const IconBackground = tw.div`
2567
2611
  return $withBackground ? "" : "tu-indicator__icon-background--none";
2568
2612
  }}
2569
2613
  `;
2570
- const Label$5 = tw.div`
2614
+ const Label$4 = tw.div`
2571
2615
  tu-indicator__label
2572
2616
  `;
2573
2617
 
2574
- /**
2575
- * The Label component is used for labels for input fields.
2576
- *
2577
- * **Have a look at the FormGroup first**
2578
- *
2579
- * @param {LabelProps} props - The props for the Label component
2580
- * @returns {JSX.Element} Label component
2581
- */
2582
-
2583
- const Label$4 = ({
2584
- id,
2585
- htmlFor,
2586
- label,
2587
- description,
2588
- className,
2589
- dataTestId
2590
- }) => {
2591
- const labelElement = jsx(Text, Object.assign({
2592
- weight: "thick",
2593
- className: className,
2594
- dataTestId: dataTestId
2595
- }, {
2596
- children: label
2597
- }));
2598
-
2599
- return jsxs(Fragment, {
2600
- children: [htmlFor === false ? labelElement : jsx("label", Object.assign({
2601
- id: id,
2602
- htmlFor: htmlFor
2603
- }, {
2604
- children: labelElement
2605
- })), jsx(Description$2, Object.assign({
2606
- subtle: true
2607
- }, {
2608
- children: description
2609
- }))]
2610
- });
2611
- };
2612
- const Description$2 = tw(Text)`
2613
- tu-label
2614
- `;
2615
-
2616
2618
  /**
2617
2619
  * The LegendItem component is used to show form legends.
2618
2620
  *
@@ -2630,7 +2632,7 @@ const LegendItem = ({
2630
2632
  dataTestId
2631
2633
  }) => {
2632
2634
  const handleOnClick = onClick && !disabled ? () => onClick() : undefined;
2633
- return jsxs(Root$2, Object.assign({
2635
+ return jsxs(Root$1, Object.assign({
2634
2636
  "data-testid": dataTestId,
2635
2637
  disabled: disabled,
2636
2638
  className: className,
@@ -2646,7 +2648,7 @@ const LegendItem = ({
2646
2648
  })]
2647
2649
  }));
2648
2650
  };
2649
- const Root$2 = tw.div`
2651
+ const Root$1 = tw.div`
2650
2652
  inline-flex
2651
2653
  items-center
2652
2654
  transition-all
@@ -2703,7 +2705,7 @@ const MobileIconButton = tw(IconButton)`
2703
2705
  `;
2704
2706
 
2705
2707
  /**
2706
- * The MenuItem component should be used to inform the user of important information.
2708
+ * The MenuItem component is used to display a menu, primarily meant to be used in a list form.
2707
2709
  *
2708
2710
  * @param {MenuItemProps} props - The props for the MenuItem component
2709
2711
  * @returns {JSX.Element} MenuItem component
@@ -3005,382 +3007,104 @@ const useModal = ({
3005
3007
  };
3006
3008
 
3007
3009
  /**
3008
- * The MinTopFullContentLayout component.
3010
+ * A thin wrapper around the `BaseInput` component for number input fields.
3009
3011
  *
3010
- * @param {MinTopFullContentLayoutProps} props - The props for the MinTopFullContentLayout component
3011
- * @returns {JSX.Element} MinTopFullContentLayout component
3012
+ * NOTE: If shown with a label, please use the `NumberField` component instead.
3012
3013
  */
3013
3014
 
3014
- const MinTopFullContentLayout = ({
3015
- children,
3016
- className,
3017
- dataTestId
3018
- }) => jsx(Layout$5, Object.assign({
3019
- className: className,
3020
- "data-testid": dataTestId
3021
- }, {
3022
- children: children
3023
- }));
3024
- const Layout$5 = tw.span`
3025
- grid
3026
- h-full
3027
- grid-rows-min-fr
3028
- `;
3015
+ const NumberInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
3016
+ ref: ref,
3017
+ type: "number"
3018
+ }, props)));
3029
3019
 
3030
3020
  /**
3031
- * Responsive layout component setting up three grid areas
3032
- * one for filtering, (result-)list and (result-map)
3033
- *
3034
- * List needs to handle its own min size - and map takes up the rest.
3035
- *
3036
- * Will be inlined to
3037
- * - filter
3038
- * - list
3039
- * - map
3040
- * on screens < mediaQuery.xxl
3021
+ * The number field component is used for entering numeric values and includes controls for incrementally increasing or decreasing the value.
3041
3022
  *
3023
+ * _**Do use**_ the NumberField when the controls to incrementally increase or decrease makes the task easier for the user.
3042
3024
  *
3043
- * @param {FilterListMapLayoutProps} props - The props for the FilterListMapLayout component
3044
- * @returns {JSX.Element} FilterListMapLayout component
3025
+ * _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
3045
3026
  */
3046
3027
 
3047
- const FilterListMapLayout = ({
3048
- children
3049
- }) => jsx(Layout$4, {
3050
- children: children
3051
- });
3052
- const Layout$4 = tw.span`
3053
- tu-layout-FilterListMap
3054
- `;
3055
-
3056
- /**
3057
- * Layout component with repeating full width areas, default one height fraction each but option to use content height instead
3058
- * Row min height can optionally be set here or managed by children
3059
- * Scrolling happens if/when children's a min-height is reached
3060
- *
3061
- * @param {FullWidthRepeatingLayoutProps} props - The props for the FullWidthRepeatingLayout component
3062
- * @returns {JSX.Element} FullWidthRepeatingLayout component
3063
- */
3028
+ const NumberField = forwardRef((_a, ref) => {
3029
+ var {
3030
+ label,
3031
+ tip,
3032
+ helpText,
3033
+ errorMessage,
3034
+ helpAddon,
3035
+ isInvalid,
3036
+ maxLength,
3037
+ className,
3038
+ value,
3039
+ dataTestId
3040
+ } = _a,
3041
+ rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "maxLength", "className", "value", "dataTestId"]);
3064
3042
 
3065
- const FullWidthRepeatingLayout = ({
3066
- children,
3067
- rowSizing = "Unmanaged",
3068
- rowMinHeight,
3069
- dataTestId,
3070
- className
3071
- }) => jsx(Layout$3, Object.assign({
3072
- "data-testid": dataTestId,
3073
- className: className,
3074
- "$rowSizing": rowSizing,
3075
- "$rowMinHeight": rowMinHeight !== null && rowMinHeight !== void 0 ? rowMinHeight : 0
3076
- }, {
3077
- children: children
3078
- }));
3079
- const Layout$3 = tw.span`
3080
- tu-layout-FullWidthRepeatingLayout
3043
+ const renderAsInvalid = isInvalid || Boolean(errorMessage);
3044
+ return jsx(FormGroup, Object.assign({
3045
+ label: label,
3046
+ tip: tip,
3047
+ isInvalid: renderAsInvalid,
3048
+ helpText: errorMessage || helpText,
3049
+ helpAddon: helpAddon,
3050
+ dataTestId: `${dataTestId}-FormGroup`
3051
+ }, {
3052
+ children: jsx(NumberInput, Object.assign({
3053
+ ref: ref,
3054
+ maxLength: maxLength,
3055
+ value: value,
3056
+ isInvalid: renderAsInvalid
3057
+ }, rest, {
3058
+ className: className,
3059
+ dataTestId: dataTestId
3060
+ }))
3061
+ }));
3062
+ });
3081
3063
 
3082
- ${({
3083
- $rowSizing
3064
+ const GetSpacerHeight = () => ({
3065
+ minHeight
3084
3066
  }) => {
3085
- switch ($rowSizing) {
3086
- case "MinContent":
3087
- return tws` tu-layout-FullWidthRepeatingLayout--MinContent`;
3067
+ if (!minHeight) {
3068
+ return "";
3069
+ }
3088
3070
 
3089
- case "Equal":
3090
- return tws` tu-layout-FullWidthRepeatingLayout--Equal`;
3071
+ switch (minHeight) {
3072
+ case "normal":
3073
+ return tws`min-h-[8px]`;
3074
+
3075
+ case "large":
3076
+ return tws`min-h-[32px]`;
3091
3077
 
3092
- case "Unmanaged":
3093
3078
  default:
3094
- return null;
3079
+ return "";
3095
3080
  }
3096
- }}
3097
- `;
3098
-
3081
+ };
3099
3082
  /**
3100
- * Simply applies a Grid Area to the element
3083
+ * The Spacer component is used for adding a bit of space.
3101
3084
  *
3102
- * @param {GridAreaProps} props - The props for the GridArea component
3103
- * @returns {JSX.Element} GridArea component
3085
+ * @param {SpacerProps} props - The props for the Spacer component
3086
+ * @returns {JSX.Element} Spacer component
3104
3087
  */
3105
3088
 
3106
- const GridArea = ({
3107
- area,
3108
- dataTestId,
3109
- className,
3110
- children
3111
- }) => jsx("section", Object.assign({
3112
- className: className,
3113
- "data-testid": dataTestId,
3114
- style: {
3115
- gridArea: area
3116
- }
3117
- }, {
3118
- children: children
3119
- }));
3089
+
3090
+ const Spacer = ({
3091
+ minHeight = "",
3092
+ border,
3093
+ dataTestId
3094
+ }) => {
3095
+ return jsx(Space, {
3096
+ "data-testid": dataTestId,
3097
+ minHeight: minHeight,
3098
+ border: border
3099
+ });
3100
+ };
3101
+ const Space = tw.div`
3102
+ ${p => `${p.border ? `tu-spacer--border` : null}`}
3103
+ ${GetSpacerHeight()}
3104
+ `;
3120
3105
 
3121
3106
  /**
3122
- * A grid container that has a flexible number of columns.
3123
- * Adds more columns if constraints allow it, otherwise wraps to next row
3124
- *
3125
- * @param {IntrinsicallyResponsiveGridProps} props - The props for the IntrinsicallyResponsiveGrid component
3126
- * @returns {JSX.Element} IntrinsicallyResponsiveGrid component
3127
- */
3128
-
3129
- const IntrinsicallyResponsiveGrid = ({
3130
- children,
3131
- occupation = "auto-fill",
3132
- minColumnWidth = "normal",
3133
- gap = "auto",
3134
- dataTestId,
3135
- className
3136
- }) => jsx(Layout$2, Object.assign({
3137
- "$minColumnWidth": minColumnWidth,
3138
- "data-testid": dataTestId,
3139
- "$gap": gap,
3140
- "$occupation": occupation,
3141
- className: className
3142
- }, {
3143
- children: children
3144
- }));
3145
- const Layout$2 = tw.span`
3146
- tu-layout-IntrinsicallyResponsiveGrid
3147
- ${({
3148
- $occupation
3149
- }) => {
3150
- switch ($occupation) {
3151
- case "auto-fit":
3152
- return tws`tu-layout-IntrinsicallyResponsiveGrid--fit`;
3153
-
3154
- case "auto-fill":
3155
- default:
3156
- return tws`tu-layout-IntrinsicallyResponsiveGrid--fill`;
3157
- }
3158
- }}
3159
-
3160
- ${({
3161
- $minColumnWidth
3162
- }) => {
3163
- switch ($minColumnWidth) {
3164
- case "slim":
3165
- return tws`tu-layout-IntrinsicallyResponsiveGrid--slim`;
3166
-
3167
- case "narrow":
3168
- return tws`tu-layout-IntrinsicallyResponsiveGrid--narrow`;
3169
-
3170
- case "wide":
3171
- return tws`tu-layout-IntrinsicallyResponsiveGrid--wide`;
3172
-
3173
- case "normal":
3174
- default:
3175
- return tws`tu-layout-IntrinsicallyResponsiveGrid--normal`;
3176
- }
3177
- }}
3178
-
3179
- ${({
3180
- $gap
3181
- }) => {
3182
- switch ($gap) {
3183
- case "tiny":
3184
- return tws`gap-1`;
3185
-
3186
- case "mini":
3187
- return tws`gap-2`;
3188
-
3189
- case "small":
3190
- return tws`gap-3`;
3191
-
3192
- case "medium":
3193
- return tws`gap-4`;
3194
-
3195
- case "large":
3196
- return tws`gap-6`;
3197
-
3198
- case "giant":
3199
- return tws`gap-8`;
3200
-
3201
- case "enormous":
3202
- return tws`gap-10`;
3203
-
3204
- case "none":
3205
- return tws`gap-0`;
3206
-
3207
- case "inherit":
3208
- return tws`gap-[inherit]`;
3209
-
3210
- case "auto":
3211
- default:
3212
- return tws`gap-3 sm:gap-4 md:gap-6`;
3213
- }
3214
- }};
3215
- `;
3216
-
3217
- /**
3218
- * The TitleNavContentLayout.
3219
- *
3220
- * @param {TitleNavContentLayoutProps} props - The props for the TitleNavContentLayout component
3221
- * @returns {JSX.Element} TitleNavContentLayout component
3222
- */
3223
-
3224
- const TitleNavContentLayout = ({
3225
- children
3226
- }) => jsx(Layout$1, {
3227
- children: children
3228
- });
3229
- const Layout$1 = tw.div`
3230
- tu-layout-TitleNavContentLayout
3231
- `;
3232
-
3233
- /**
3234
- * TwoColumnLayout.
3235
- *
3236
- * @param {TwoColumnLayoutProps} props - The props for the TwoColumnLayout component
3237
- * @returns {JSX.Element} TwoColumnLayout component
3238
- */
3239
-
3240
- const TwoColumnLayout = ({
3241
- children
3242
- }) => jsx(Layout, {
3243
- children: children
3244
- });
3245
- const Layout = tw.div`
3246
- tu-layout-TwoColumnLayout
3247
- `;
3248
-
3249
- /**
3250
- * The MultiRowTableCell component extendins Table Cell component and formats your content supporting 2 rows.
3251
- *
3252
- * @param {MultiRowTableCellProps} props - The props for the MultiRowTableCell component
3253
- * @returns {JSX.Element} MultiRowTableCell component
3254
- */
3255
-
3256
- const MultiRowTableCell = ({
3257
- main,
3258
- secondary,
3259
- area = "none",
3260
- dataTestId
3261
- }) => {
3262
- return jsxs(Root$1, Object.assign({
3263
- area: area,
3264
- dataTestId: dataTestId
3265
- }, {
3266
- children: [jsx(Header, {
3267
- children: main
3268
- }), secondary && jsx(Secondary, {
3269
- children: secondary
3270
- })]
3271
- }));
3272
- };
3273
- const Root$1 = tw(GridArea)`
3274
- tu-multi-row-table-cell-container
3275
- `;
3276
- const Header = tw.div`
3277
- tu-multi-row-table-cell
3278
- tu-multi-row-table-cell__header
3279
- `;
3280
- const Secondary = tw.div`
3281
- tu-multi-row-table-cell
3282
- tu-multi-row-table-cell__secondary
3283
- `;
3284
-
3285
- /**
3286
- * A thin wrapper around the `BaseInput` component for number input fields.
3287
- *
3288
- * NOTE: If shown with a label, please use the `NumberField` component instead.
3289
- */
3290
-
3291
- const NumberInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
3292
- ref: ref,
3293
- type: "number"
3294
- }, props)));
3295
-
3296
- /**
3297
- * The number field component is used for entering numeric values and includes controls for incrementally increasing or decreasing the value.
3298
- *
3299
- * _**Do use**_ the NumberField when the controls to incrementally increase or decrease makes the task easier for the user.
3300
- *
3301
- * _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
3302
- */
3303
-
3304
- const NumberField = forwardRef((_a, ref) => {
3305
- var {
3306
- label,
3307
- tip,
3308
- helpText,
3309
- errorMessage,
3310
- helpAddon,
3311
- isInvalid,
3312
- maxLength,
3313
- className,
3314
- value,
3315
- dataTestId
3316
- } = _a,
3317
- rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "maxLength", "className", "value", "dataTestId"]);
3318
-
3319
- const renderAsInvalid = isInvalid || Boolean(errorMessage);
3320
- return jsx(FormGroup, Object.assign({
3321
- label: label,
3322
- tip: tip,
3323
- isInvalid: renderAsInvalid,
3324
- helpText: errorMessage || helpText,
3325
- helpAddon: helpAddon,
3326
- dataTestId: `${dataTestId}-FormGroup`
3327
- }, {
3328
- children: jsx(NumberInput, Object.assign({
3329
- ref: ref,
3330
- maxLength: maxLength,
3331
- value: value,
3332
- isInvalid: renderAsInvalid
3333
- }, rest, {
3334
- className: className,
3335
- dataTestId: dataTestId
3336
- }))
3337
- }));
3338
- });
3339
-
3340
- const GetSpacerHeight = () => ({
3341
- minHeight
3342
- }) => {
3343
- if (!minHeight) {
3344
- return "";
3345
- }
3346
-
3347
- switch (minHeight) {
3348
- case "normal":
3349
- return tws`min-h-[8px]`;
3350
-
3351
- case "large":
3352
- return tws`min-h-[32px]`;
3353
-
3354
- default:
3355
- return "";
3356
- }
3357
- };
3358
- /**
3359
- * The Spacer component is used for adding a bit of space.
3360
- *
3361
- * @param {SpacerProps} props - The props for the Spacer component
3362
- * @returns {JSX.Element} Spacer component
3363
- */
3364
-
3365
-
3366
- const Spacer = ({
3367
- minHeight = "",
3368
- border,
3369
- dataTestId
3370
- }) => {
3371
- return jsx(Space, {
3372
- "data-testid": dataTestId,
3373
- minHeight: minHeight,
3374
- border: border
3375
- });
3376
- };
3377
- const Space = tw.div`
3378
- ${p => `${p.border ? `tu-spacer--border` : null}`}
3379
- ${GetSpacerHeight()}
3380
- `;
3381
-
3382
- /**
3383
- * Tags allow users to enter information and filter content.
3107
+ * Tags allow users to enter information and filter content.
3384
3108
  *
3385
3109
  * Multiple or single tags can be used to categorise items.
3386
3110
  *
@@ -3740,11 +3464,11 @@ const SelectContainer = ({
3740
3464
  return jsxs(Container, Object.assign({
3741
3465
  "data-testid": dataTestId
3742
3466
  }, {
3743
- children: [label && !hideLabel && jsx(Label$4, {
3744
- label: label,
3745
- htmlFor: id !== null && id !== void 0 ? id : false,
3746
- description: description
3747
- }), children, (hasError || info) && jsx(InformativeText$1, Object.assign({
3467
+ children: [label && !hideLabel && jsx(Label$5, Object.assign({
3468
+ htmlFor: id
3469
+ }, {
3470
+ children: label
3471
+ })), children, (hasError || info) && jsx(InformativeText$1, Object.assign({
3748
3472
  size: "small",
3749
3473
  "$hasError": hasError !== null && hasError !== void 0 ? hasError : false
3750
3474
  }, {
@@ -4059,16 +3783,16 @@ const TextArea = React.forwardRef(({
4059
3783
  }, ref) => {
4060
3784
  const hasError = !!error;
4061
3785
  return jsxs(TextAreaContainer, Object.assign({
4062
- className: className,
4063
- "data-testid": dataTestId
3786
+ className: className
4064
3787
  }, {
4065
- children: [jsx(Label$4, {
4066
- htmlFor: id !== null && id !== void 0 ? id : false,
4067
- id: id,
4068
- label: label,
4069
- description: description
4070
- }), jsx(StyledTextArea, {
3788
+ children: [jsx(Label$5, Object.assign({
3789
+ htmlFor: id
3790
+ }, {
3791
+ children: label
3792
+ })), jsx(StyledTextArea, {
4071
3793
  name: name,
3794
+ id: id,
3795
+ "data-testid": dataTestId,
4072
3796
  value: value,
4073
3797
  rows: rows,
4074
3798
  disabled: disabled,
@@ -4540,4 +4264,246 @@ const useTimeout = ({
4540
4264
  };
4541
4265
  };
4542
4266
 
4543
- 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$4 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, Tag, Text, TextArea, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, activityColors, colors, criticalityColors, docs, generalColors, intentColors, useContainerProps, useCustomComponents, useCustomStyles, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
4267
+ /**
4268
+ * The MinTopFullContentLayout component.
4269
+ *
4270
+ * @param {MinTopFullContentLayoutProps} props - The props for the MinTopFullContentLayout component
4271
+ * @returns {JSX.Element} MinTopFullContentLayout component
4272
+ */
4273
+
4274
+ const MinTopFullContentLayout = ({
4275
+ children,
4276
+ className,
4277
+ dataTestId
4278
+ }) => jsx(Layout$5, Object.assign({
4279
+ className: className,
4280
+ "data-testid": dataTestId
4281
+ }, {
4282
+ children: children
4283
+ }));
4284
+ const Layout$5 = tw.span`
4285
+ grid
4286
+ h-full
4287
+ grid-rows-min-fr
4288
+ `;
4289
+
4290
+ /**
4291
+ * Responsive layout component setting up three grid areas
4292
+ * one for filtering, (result-)list and (result-map)
4293
+ *
4294
+ * List needs to handle its own min size - and map takes up the rest.
4295
+ *
4296
+ * Will be inlined to
4297
+ * - filter
4298
+ * - list
4299
+ * - map
4300
+ * on screens < mediaQuery.xxl
4301
+ *
4302
+ *
4303
+ * @param {FilterListMapLayoutProps} props - The props for the FilterListMapLayout component
4304
+ * @returns {JSX.Element} FilterListMapLayout component
4305
+ */
4306
+
4307
+ const FilterListMapLayout = ({
4308
+ children
4309
+ }) => jsx(Layout$4, {
4310
+ children: children
4311
+ });
4312
+ const Layout$4 = tw.span`
4313
+ tu-layout-FilterListMap
4314
+ `;
4315
+
4316
+ /**
4317
+ * Layout component with repeating full width areas, default one height fraction each but option to use content height instead
4318
+ * Row min height can optionally be set here or managed by children
4319
+ * Scrolling happens if/when children's a min-height is reached
4320
+ *
4321
+ * @param {FullWidthRepeatingLayoutProps} props - The props for the FullWidthRepeatingLayout component
4322
+ * @returns {JSX.Element} FullWidthRepeatingLayout component
4323
+ */
4324
+
4325
+ const FullWidthRepeatingLayout = ({
4326
+ children,
4327
+ rowSizing = "Unmanaged",
4328
+ rowMinHeight,
4329
+ dataTestId,
4330
+ className
4331
+ }) => jsx(Layout$3, Object.assign({
4332
+ "data-testid": dataTestId,
4333
+ className: className,
4334
+ "$rowSizing": rowSizing,
4335
+ "$rowMinHeight": rowMinHeight !== null && rowMinHeight !== void 0 ? rowMinHeight : 0
4336
+ }, {
4337
+ children: children
4338
+ }));
4339
+ const Layout$3 = tw.span`
4340
+ tu-layout-FullWidthRepeatingLayout
4341
+
4342
+ ${({
4343
+ $rowSizing
4344
+ }) => {
4345
+ switch ($rowSizing) {
4346
+ case "MinContent":
4347
+ return tws` tu-layout-FullWidthRepeatingLayout--MinContent`;
4348
+
4349
+ case "Equal":
4350
+ return tws` tu-layout-FullWidthRepeatingLayout--Equal`;
4351
+
4352
+ case "Unmanaged":
4353
+ default:
4354
+ return null;
4355
+ }
4356
+ }}
4357
+ `;
4358
+
4359
+ /**
4360
+ * Simply applies a Grid Area to the element
4361
+ *
4362
+ * @param {GridAreaProps} props - The props for the GridArea component
4363
+ * @returns {JSX.Element} GridArea component
4364
+ */
4365
+
4366
+ const GridArea = ({
4367
+ area,
4368
+ dataTestId,
4369
+ className,
4370
+ children
4371
+ }) => jsx("section", Object.assign({
4372
+ className: className,
4373
+ "data-testid": dataTestId,
4374
+ style: {
4375
+ gridArea: area
4376
+ }
4377
+ }, {
4378
+ children: children
4379
+ }));
4380
+
4381
+ /**
4382
+ * A grid container that has a flexible number of columns.
4383
+ * Adds more columns if constraints allow it, otherwise wraps to next row
4384
+ *
4385
+ * @param {IntrinsicallyResponsiveGridProps} props - The props for the IntrinsicallyResponsiveGrid component
4386
+ * @returns {JSX.Element} IntrinsicallyResponsiveGrid component
4387
+ */
4388
+
4389
+ const IntrinsicallyResponsiveGrid = ({
4390
+ children,
4391
+ occupation = "auto-fill",
4392
+ minColumnWidth = "normal",
4393
+ gap = "auto",
4394
+ dataTestId,
4395
+ className
4396
+ }) => jsx(Layout$2, Object.assign({
4397
+ "$minColumnWidth": minColumnWidth,
4398
+ "data-testid": dataTestId,
4399
+ "$gap": gap,
4400
+ "$occupation": occupation,
4401
+ className: className
4402
+ }, {
4403
+ children: children
4404
+ }));
4405
+ const Layout$2 = tw.span`
4406
+ tu-layout-IntrinsicallyResponsiveGrid
4407
+ ${({
4408
+ $occupation
4409
+ }) => {
4410
+ switch ($occupation) {
4411
+ case "auto-fit":
4412
+ return tws`tu-layout-IntrinsicallyResponsiveGrid--fit`;
4413
+
4414
+ case "auto-fill":
4415
+ default:
4416
+ return tws`tu-layout-IntrinsicallyResponsiveGrid--fill`;
4417
+ }
4418
+ }}
4419
+
4420
+ ${({
4421
+ $minColumnWidth
4422
+ }) => {
4423
+ switch ($minColumnWidth) {
4424
+ case "slim":
4425
+ return tws`tu-layout-IntrinsicallyResponsiveGrid--slim`;
4426
+
4427
+ case "narrow":
4428
+ return tws`tu-layout-IntrinsicallyResponsiveGrid--narrow`;
4429
+
4430
+ case "wide":
4431
+ return tws`tu-layout-IntrinsicallyResponsiveGrid--wide`;
4432
+
4433
+ case "normal":
4434
+ default:
4435
+ return tws`tu-layout-IntrinsicallyResponsiveGrid--normal`;
4436
+ }
4437
+ }}
4438
+
4439
+ ${({
4440
+ $gap
4441
+ }) => {
4442
+ switch ($gap) {
4443
+ case "tiny":
4444
+ return tws`gap-1`;
4445
+
4446
+ case "mini":
4447
+ return tws`gap-2`;
4448
+
4449
+ case "small":
4450
+ return tws`gap-3`;
4451
+
4452
+ case "medium":
4453
+ return tws`gap-4`;
4454
+
4455
+ case "large":
4456
+ return tws`gap-6`;
4457
+
4458
+ case "giant":
4459
+ return tws`gap-8`;
4460
+
4461
+ case "enormous":
4462
+ return tws`gap-10`;
4463
+
4464
+ case "none":
4465
+ return tws`gap-0`;
4466
+
4467
+ case "inherit":
4468
+ return tws`gap-[inherit]`;
4469
+
4470
+ case "auto":
4471
+ default:
4472
+ return tws`gap-3 sm:gap-4 md:gap-6`;
4473
+ }
4474
+ }};
4475
+ `;
4476
+
4477
+ /**
4478
+ * The TitleNavContentLayout.
4479
+ *
4480
+ * @param {TitleNavContentLayoutProps} props - The props for the TitleNavContentLayout component
4481
+ * @returns {JSX.Element} TitleNavContentLayout component
4482
+ */
4483
+
4484
+ const TitleNavContentLayout = ({
4485
+ children
4486
+ }) => jsx(Layout$1, {
4487
+ children: children
4488
+ });
4489
+ const Layout$1 = tw.div`
4490
+ tu-layout-TitleNavContentLayout
4491
+ `;
4492
+
4493
+ /**
4494
+ * TwoColumnLayout.
4495
+ *
4496
+ * @param {TwoColumnLayoutProps} props - The props for the TwoColumnLayout component
4497
+ * @returns {JSX.Element} TwoColumnLayout component
4498
+ */
4499
+
4500
+ const TwoColumnLayout = ({
4501
+ children
4502
+ }) => jsx(Layout, {
4503
+ children: children
4504
+ });
4505
+ const Layout = tw.div`
4506
+ tu-layout-TwoColumnLayout
4507
+ `;
4508
+
4509
+ 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$5 as Label, LegendItem, MenuButton, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, TextArea, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, activityColors, colors, criticalityColors, docs, generalColors, intentColors, useContainerProps, useCustomComponents, useCustomStyles, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.89",
3
+ "version": "0.0.99",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "UNLICENSED",
6
6
  "dependencies": {
@@ -1,24 +0,0 @@
1
- /// <reference types="react" />
2
- import { CommonProps } from "../../common/CommonProps";
3
- interface MultiRowTableCellProps extends CommonProps {
4
- /**
5
- * Main header.
6
- */
7
- main: string;
8
- /**
9
- * Secondary string.
10
- */
11
- secondary?: string;
12
- /**
13
- * Grid area.
14
- */
15
- area?: string;
16
- }
17
- /**
18
- * The MultiRowTableCell component extendins Table Cell component and formats your content supporting 2 rows.
19
- *
20
- * @param {MultiRowTableCellProps} props - The props for the MultiRowTableCell component
21
- * @returns {JSX.Element} MultiRowTableCell component
22
- */
23
- export declare const MultiRowTableCell: ({ main, secondary, area, dataTestId }: MultiRowTableCellProps) => JSX.Element;
24
- export {};
@@ -1 +0,0 @@
1
- export * from "./MultiRowTableCell";