@trackunit/react-components 0.0.83-alpha-9c24ee877.0 → 0.0.98

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.
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';
@@ -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,6 +769,12 @@ 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
  `;
772
+ const ContentDetails = tw.div`
773
+ tu-alert__content-details
774
+ `;
775
+ const ContentBody = tw.div`
776
+ tu-alert__content-body
777
+ `;
753
778
  const Description$2 = tw(Text)`
754
779
  ${p => p.$hasTitle ? tws`tu-alert__description` : null}
755
780
  `;
@@ -763,11 +788,7 @@ const IconContainer$1 = tw.div`
763
788
  `;
764
789
 
765
790
  /**
766
- * The Badge component us used to display states or similar short informative text.
767
- *
768
- * _**Do use** badges to show highlighted text based on the state._
769
- *
770
- * _**Do not use** badges for regular text in places where it makes no sense to use highlighted text._
791
+ * The Badge component is used to display a notification badge with an optional number value.
771
792
  *
772
793
  * @param {BadgeProps} props - The props for the Badge component
773
794
  * @returns {JSX.Element} Badge component
@@ -778,30 +799,34 @@ const Badge = _a => {
778
799
  color = "neutral",
779
800
  subtle = false,
780
801
  className,
781
- variant = "pill",
802
+ count,
803
+ max,
804
+ hideZero = false,
782
805
  dataTestId,
783
- children,
784
806
  size = "default"
785
807
  } = _a;
786
- __rest(_a, ["color", "subtle", "className", "variant", "dataTestId", "children", "size"]);
808
+ __rest(_a, ["color", "subtle", "className", "count", "max", "hideZero", "dataTestId", "size"]);
809
+
810
+ if (hideZero && count === 0) {
811
+ return null;
812
+ }
787
813
 
788
- const isPill = variant === "pill";
814
+ const displayedCount = count && max ? count > max ? `${max}+` : count : count;
789
815
  return jsx(StyledText$3, Object.assign({
790
- "$variant": variant,
791
816
  className: className,
792
817
  "$color": color,
793
818
  "$size": size,
794
- "$subtle": subtle ? subtle : isPill,
819
+ "$subtle": subtle,
820
+ "$count": count,
795
821
  "data-testid": dataTestId,
796
822
  "$as": "span"
797
823
  }, {
798
- children: isPill ? children !== undefined && children !== null ? children > 99 ? "99+" : children : "" : children
824
+ children: displayedCount
799
825
  }));
800
826
  };
801
827
 
802
828
  const getSizeModifierClass$1 = () => ({
803
- $size,
804
- $variant
829
+ $size
805
830
  }) => {
806
831
  const sizeModifierClass = {
807
832
  large: tws`tu-badge--large`,
@@ -821,7 +846,7 @@ const getBadgeModifierClass = () => ({
821
846
  danger: $subtle ? tws`tu-badge--danger-subtle` : tws`tu-badge--danger`,
822
847
  warning: $subtle ? tws`tu-badge--warning-subtle` : tws`tu-badge--warning`,
823
848
  info: $subtle ? tws`tu-badge--info-subtle` : tws`tu-badge--info`,
824
- neutral: $subtle ? tws`tu-badge--neutral-subtle` : tws`badge--neutral`,
849
+ neutral: $subtle ? tws`tu-badge--neutral-subtle` : tws`tu-badge--neutral`,
825
850
  good: $subtle ? tws`tu-badge--good-subtle` : tws`tu-badge--good`,
826
851
  low: $subtle ? tws`tu-badge--low-subtle` : tws`tu-badge--low`,
827
852
  critical: $subtle ? tws`tu-badge--critical-subtle` : tws`tu-badge--critical`,
@@ -834,18 +859,10 @@ const getBadgeModifierClass = () => ({
834
859
  };
835
860
 
836
861
  const StyledText$3 = tw.text`
837
- ${p => {
838
- switch (p.$variant) {
839
- case "badge":
840
- return tws`tu-badge`;
841
-
842
- case "pill":
843
- return tws`tu-badge--pill`;
844
-
845
- default:
846
- return tws`tu-badge`;
847
- }
848
- }}
862
+ tu-badge
863
+ ${({
864
+ $count
865
+ }) => ($count === null || $count === undefined) && tws`tu-badge--square`}
849
866
  ${getBadgeModifierClass()}
850
867
  ${getSizeModifierClass$1()}
851
868
  `;
@@ -1154,7 +1171,7 @@ justify-end
1154
1171
  `;
1155
1172
 
1156
1173
  /**
1157
- * The Heading component should be used for Headings.
1174
+ * The Heading is used for a heading of a section (h1,h2,h3,h4).
1158
1175
  *
1159
1176
  * @param {HeadingProps} props - The props for the Heading component
1160
1177
  * @returns {JSX.Element} Heading component
@@ -1503,7 +1520,7 @@ const Checkbox = React.forwardRef((_a, ref) => {
1503
1520
  onKeyPress: onKeyPress
1504
1521
  }, {
1505
1522
  children: icon
1506
- })), label && jsx(Label$5, Object.assign({
1523
+ })), label && jsx(Label$6, Object.assign({
1507
1524
  ref: internalRef,
1508
1525
  htmlFor: uuid,
1509
1526
  "$disabled": isReadonly,
@@ -1551,7 +1568,7 @@ const HiddenInput$1 = tw.input`
1551
1568
  const CheckboxContainer = tw.label`
1552
1569
  tu-checkbox--container group
1553
1570
  `;
1554
- const Label$5 = tw.label`
1571
+ const Label$6 = tw.label`
1555
1572
  tu-checkbox__label
1556
1573
  ${({
1557
1574
  $disabled
@@ -1562,7 +1579,7 @@ ${({
1562
1579
  `;
1563
1580
 
1564
1581
  /**
1565
- * The Collapse component is ued to condense non-important information.
1582
+ * The Collapse component is used to condense non-important information.
1566
1583
  *
1567
1584
  * @param {CollapseProps} props - The props for the Collapse component
1568
1585
  * @returns {JSX.Element} Collapse component
@@ -1688,11 +1705,9 @@ const CopyableText = ({
1688
1705
  alternativeText,
1689
1706
  dataTestId
1690
1707
  }) => {
1691
- const value = useMemo(() => {
1692
- var _a;
1708
+ var _a;
1693
1709
 
1694
- return (_a = alternativeText !== null && alternativeText !== void 0 ? alternativeText : text) !== null && _a !== void 0 ? _a : "";
1695
- }, [alternativeText, text]);
1710
+ const value = (_a = alternativeText !== null && alternativeText !== void 0 ? alternativeText : text) !== null && _a !== void 0 ? _a : "";
1696
1711
  const [animating, setAnimating] = useState(false);
1697
1712
  const [, copyToClipboard] = useCopyToClipboard();
1698
1713
 
@@ -1701,16 +1716,17 @@ const CopyableText = ({
1701
1716
  setAnimating(true);
1702
1717
  };
1703
1718
 
1704
- return jsx(CopyableTextContainer, Object.assign({
1719
+ return jsx(StyledCopyableText, Object.assign({
1705
1720
  "data-testid": dataTestId,
1706
1721
  onClick: handleOnClick,
1707
1722
  onAnimationEnd: () => setAnimating(false),
1708
- "$animating": animating
1723
+ "$animating": animating,
1724
+ title: value
1709
1725
  }, {
1710
1726
  children: text
1711
1727
  }));
1712
1728
  };
1713
- const CopyableTextContainer = tw.span`
1729
+ const StyledCopyableText = tw.span`
1714
1730
  py-1
1715
1731
  px-2
1716
1732
  border
@@ -2122,7 +2138,7 @@ const StyledText$2 = tw(Text)`
2122
2138
  `;
2123
2139
  const ListItem = tw.li`
2124
2140
  group
2125
- cursor-pointer
2141
+ ${p => !p.disabled ? "cursor-pointer" : "cursor-not-allowed"}
2126
2142
  whitespace-nowrap
2127
2143
  py-1
2128
2144
  px-2
@@ -2291,6 +2307,34 @@ const DayRangePicker = ({
2291
2307
  }));
2292
2308
  };
2293
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
+
2294
2338
  /**
2295
2339
  * The Tooltip component.
2296
2340
  *
@@ -2389,7 +2433,7 @@ const Tip = _a => {
2389
2433
  label: children,
2390
2434
  dataTestId: `${dataTestId}-tooltip`
2391
2435
  }, tooltipProps, {
2392
- 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`
2393
2437
  }, {
2394
2438
  children: jsx(Icon$1, Object.assign({
2395
2439
  name: "QuestionMarkCircleIcon",
@@ -2426,7 +2470,7 @@ const FormGroup = ({
2426
2470
  "data-testid": dataTestId
2427
2471
  }, {
2428
2472
  children: [jsxs(ContainerBefore, {
2429
- children: [jsx(StyledTitle, Object.assign({
2473
+ children: [jsx(Label$5, Object.assign({
2430
2474
  "data-testid": `${dataTestId}-label`
2431
2475
  }, {
2432
2476
  children: label
@@ -2452,14 +2496,6 @@ const FormGroup = ({
2452
2496
  };
2453
2497
  const FormGroupRoot = tw.label`
2454
2498
  tu-form-group
2455
- `; // TODO: Update and use Label component instead
2456
-
2457
- const StyledTitle = tw.span`
2458
- block
2459
- text-sm
2460
- text-slate-700
2461
- font-medium
2462
- mb-1
2463
2499
  `;
2464
2500
  const ContainerBefore = tw.div`
2465
2501
  tu-form-group__container-before
@@ -2579,48 +2615,6 @@ const Label$4 = tw.div`
2579
2615
  tu-indicator__label
2580
2616
  `;
2581
2617
 
2582
- /**
2583
- * The Label component is used for labels for input fields.
2584
- *
2585
- * **Have a look at the FormGroup first**
2586
- *
2587
- * @param {LabelProps} props - The props for the Label component
2588
- * @returns {JSX.Element} Label component
2589
- */
2590
-
2591
- const Label$3 = ({
2592
- id,
2593
- htmlFor,
2594
- label,
2595
- description,
2596
- className,
2597
- dataTestId
2598
- }) => {
2599
- const labelElement = jsx(Text, Object.assign({
2600
- weight: "thick",
2601
- className: className,
2602
- dataTestId: dataTestId
2603
- }, {
2604
- children: label
2605
- }));
2606
-
2607
- return jsxs(Fragment, {
2608
- children: [htmlFor === false ? labelElement : jsx("label", Object.assign({
2609
- id: id,
2610
- htmlFor: htmlFor
2611
- }, {
2612
- children: labelElement
2613
- })), jsx(Description$1, Object.assign({
2614
- subtle: true
2615
- }, {
2616
- children: description
2617
- }))]
2618
- });
2619
- };
2620
- const Description$1 = tw(Text)`
2621
- tu-label
2622
- `;
2623
-
2624
2618
  /**
2625
2619
  * The LegendItem component is used to show form legends.
2626
2620
  *
@@ -2638,7 +2632,7 @@ const LegendItem = ({
2638
2632
  dataTestId
2639
2633
  }) => {
2640
2634
  const handleOnClick = onClick && !disabled ? () => onClick() : undefined;
2641
- return jsxs(Root$2, Object.assign({
2635
+ return jsxs(Root$1, Object.assign({
2642
2636
  "data-testid": dataTestId,
2643
2637
  disabled: disabled,
2644
2638
  className: className,
@@ -2649,12 +2643,12 @@ const LegendItem = ({
2649
2643
  style: {
2650
2644
  backgroundColor: color
2651
2645
  }
2652
- }), jsx(Label$2, {
2646
+ }), jsx(Label$3, {
2653
2647
  children: label
2654
2648
  })]
2655
2649
  }));
2656
2650
  };
2657
- const Root$2 = tw.div`
2651
+ const Root$1 = tw.div`
2658
2652
  inline-flex
2659
2653
  items-center
2660
2654
  transition-all
@@ -2672,7 +2666,7 @@ const Indicator = tw.span`
2672
2666
  rounded-[50%]
2673
2667
  mr-2
2674
2668
  `;
2675
- const Label$2 = tw.span`
2669
+ const Label$3 = tw.span`
2676
2670
  text-sm
2677
2671
  `;
2678
2672
 
@@ -2746,7 +2740,7 @@ const MenuItem = ({
2746
2740
  "$selected": selected
2747
2741
  }, {
2748
2742
  children: prefix
2749
- })), jsx(Label$1, {
2743
+ })), jsx(Label$2, {
2750
2744
  children: label
2751
2745
  }), icon && jsx(Icon, Object.assign({
2752
2746
  "$selected": selected
@@ -2780,7 +2774,7 @@ const Prefix = tw.div`
2780
2774
  $selected
2781
2775
  }) => $selected ? tws`tu-menu-item__prefix--selected ` : ""}
2782
2776
  `;
2783
- const Label$1 = tw.div`
2777
+ const Label$2 = tw.div`
2784
2778
  tu-menu-item__label
2785
2779
  `;
2786
2780
 
@@ -3013,378 +3007,190 @@ const useModal = ({
3013
3007
  };
3014
3008
 
3015
3009
  /**
3016
- * The MinTopFullContentLayout component.
3010
+ * A thin wrapper around the `BaseInput` component for number input fields.
3017
3011
  *
3018
- * @param {MinTopFullContentLayoutProps} props - The props for the MinTopFullContentLayout component
3019
- * @returns {JSX.Element} MinTopFullContentLayout component
3012
+ * NOTE: If shown with a label, please use the `NumberField` component instead.
3020
3013
  */
3021
3014
 
3022
- const MinTopFullContentLayout = ({
3023
- children,
3024
- className,
3025
- dataTestId
3026
- }) => jsx(Layout$5, Object.assign({
3027
- className: className,
3028
- "data-testid": dataTestId
3029
- }, {
3030
- children: children
3031
- }));
3032
- const Layout$5 = tw.span`
3033
- grid
3034
- h-full
3035
- grid-rows-min-fr
3036
- `;
3015
+ const NumberInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
3016
+ ref: ref,
3017
+ type: "number"
3018
+ }, props)));
3037
3019
 
3038
3020
  /**
3039
- * Responsive layout component setting up three grid areas
3040
- * one for filtering, (result-)list and (result-map)
3041
- *
3042
- * List needs to handle its own min size - and map takes up the rest.
3043
- *
3044
- * Will be inlined to
3045
- * - filter
3046
- * - list
3047
- * - map
3048
- * 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.
3049
3022
  *
3023
+ * _**Do use**_ the NumberField when the controls to incrementally increase or decrease makes the task easier for the user.
3050
3024
  *
3051
- * @param {FilterListMapLayoutProps} props - The props for the FilterListMapLayout component
3052
- * @returns {JSX.Element} FilterListMapLayout component
3025
+ * _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
3053
3026
  */
3054
3027
 
3055
- const FilterListMapLayout = ({
3056
- children
3057
- }) => jsx(Layout$4, {
3058
- children: children
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"]);
3042
+
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
+ }));
3059
3062
  });
3060
- const Layout$4 = tw.span`
3061
- tu-layout-FilterListMap
3062
- `;
3063
3063
 
3064
+ const GetSpacerHeight = () => ({
3065
+ minHeight
3066
+ }) => {
3067
+ if (!minHeight) {
3068
+ return "";
3069
+ }
3070
+
3071
+ switch (minHeight) {
3072
+ case "normal":
3073
+ return tws`min-h-[8px]`;
3074
+
3075
+ case "large":
3076
+ return tws`min-h-[32px]`;
3077
+
3078
+ default:
3079
+ return "";
3080
+ }
3081
+ };
3064
3082
  /**
3065
- * Layout component with repeating full width areas, default one height fraction each but option to use content height instead
3066
- * Row min height can optionally be set here or managed by children
3067
- * Scrolling happens if/when children's a min-height is reached
3083
+ * The Spacer component is used for adding a bit of space.
3068
3084
  *
3069
- * @param {FullWidthRepeatingLayoutProps} props - The props for the FullWidthRepeatingLayout component
3070
- * @returns {JSX.Element} FullWidthRepeatingLayout component
3085
+ * @param {SpacerProps} props - The props for the Spacer component
3086
+ * @returns {JSX.Element} Spacer component
3071
3087
  */
3072
3088
 
3073
- const FullWidthRepeatingLayout = ({
3074
- children,
3075
- rowSizing = "Unmanaged",
3076
- rowMinHeight,
3077
- dataTestId,
3078
- className
3079
- }) => jsx(Layout$3, Object.assign({
3080
- "data-testid": dataTestId,
3081
- className: className,
3082
- "$rowSizing": rowSizing,
3083
- "$rowMinHeight": rowMinHeight !== null && rowMinHeight !== void 0 ? rowMinHeight : 0
3084
- }, {
3085
- children: children
3086
- }));
3087
- const Layout$3 = tw.span`
3088
- tu-layout-FullWidthRepeatingLayout
3089
3089
 
3090
- ${({
3091
- $rowSizing
3090
+ const Spacer = ({
3091
+ minHeight = "",
3092
+ border,
3093
+ dataTestId
3092
3094
  }) => {
3093
- switch ($rowSizing) {
3094
- case "MinContent":
3095
- return tws` tu-layout-FullWidthRepeatingLayout--MinContent`;
3096
-
3097
- case "Equal":
3098
- return tws` tu-layout-FullWidthRepeatingLayout--Equal`;
3099
-
3100
- case "Unmanaged":
3101
- default:
3102
- return null;
3103
- }
3104
- }}
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()}
3105
3104
  `;
3106
3105
 
3107
3106
  /**
3108
- * Simply applies a Grid Area to the element
3107
+ * Tags allow users to enter information and filter content.
3109
3108
  *
3110
- * @param {GridAreaProps} props - The props for the GridArea component
3111
- * @returns {JSX.Element} GridArea component
3109
+ * Multiple or single tags can be used to categorise items.
3110
+ *
3111
+ * Use short labels for easy scanning. Use two words only if necessary to describe the status and differentiate it from other tags.
3112
+ *
3113
+ * @param {TagProps} props - The props for the tag component
3114
+ * @returns {JSX.Element} tag component
3112
3115
  */
3113
3116
 
3114
- const GridArea = ({
3115
- area,
3116
- dataTestId,
3117
- className,
3118
- children
3119
- }) => jsx("section", Object.assign({
3120
- className: className,
3121
- "data-testid": dataTestId,
3122
- style: {
3123
- gridArea: area
3124
- }
3125
- }, {
3126
- children: children
3127
- }));
3128
-
3129
- /**
3130
- * A grid container that has a flexible number of columns.
3131
- * Adds more columns if constraints allow it, otherwise wraps to next row
3132
- *
3133
- * @param {IntrinsicallyResponsiveGridProps} props - The props for the IntrinsicallyResponsiveGrid component
3134
- * @returns {JSX.Element} IntrinsicallyResponsiveGrid component
3135
- */
3136
-
3137
- const IntrinsicallyResponsiveGrid = ({
3138
- children,
3139
- occupation = "auto-fill",
3140
- minColumnWidth = "normal",
3141
- gap = "auto",
3142
- dataTestId,
3143
- className
3144
- }) => jsx(Layout$2, Object.assign({
3145
- "$minColumnWidth": minColumnWidth,
3146
- "data-testid": dataTestId,
3147
- "$gap": gap,
3148
- "$occupation": occupation,
3149
- className: className
3150
- }, {
3151
- children: children
3152
- }));
3153
- const Layout$2 = tw.span`
3154
- tu-layout-IntrinsicallyResponsiveGrid
3155
- ${({
3156
- $occupation
3157
- }) => {
3158
- switch ($occupation) {
3159
- case "auto-fit":
3160
- return tws`tu-layout-IntrinsicallyResponsiveGrid--fit`;
3161
-
3162
- case "auto-fill":
3163
- default:
3164
- return tws`tu-layout-IntrinsicallyResponsiveGrid--fill`;
3165
- }
3166
- }}
3167
-
3168
- ${({
3169
- $minColumnWidth
3170
- }) => {
3171
- switch ($minColumnWidth) {
3172
- case "slim":
3173
- return tws`tu-layout-IntrinsicallyResponsiveGrid--slim`;
3174
-
3175
- case "narrow":
3176
- return tws`tu-layout-IntrinsicallyResponsiveGrid--narrow`;
3177
-
3178
- case "wide":
3179
- return tws`tu-layout-IntrinsicallyResponsiveGrid--wide`;
3180
-
3181
- case "normal":
3182
- default:
3183
- return tws`tu-layout-IntrinsicallyResponsiveGrid--normal`;
3184
- }
3185
- }}
3186
-
3187
- ${({
3188
- $gap
3189
- }) => {
3190
- switch ($gap) {
3191
- case "tiny":
3192
- return tws`gap-1`;
3193
-
3194
- case "mini":
3195
- return tws`gap-2`;
3196
-
3197
- case "small":
3198
- return tws`gap-3`;
3199
-
3200
- case "medium":
3201
- return tws`gap-4`;
3202
-
3203
- case "large":
3204
- return tws`gap-6`;
3205
-
3206
- case "giant":
3207
- return tws`gap-8`;
3208
-
3209
- case "enormous":
3210
- return tws`gap-10`;
3211
-
3212
- case "none":
3213
- return tws`gap-0`;
3214
-
3215
- case "inherit":
3216
- return tws`gap-[inherit]`;
3217
-
3218
- case "auto":
3219
- default:
3220
- return tws`gap-3 sm:gap-4 md:gap-6`;
3221
- }
3222
- }};
3223
- `;
3224
-
3225
- /**
3226
- * The TitleNavContentLayout.
3227
- *
3228
- * @param {TitleNavContentLayoutProps} props - The props for the TitleNavContentLayout component
3229
- * @returns {JSX.Element} TitleNavContentLayout component
3230
- */
3231
-
3232
- const TitleNavContentLayout = ({
3233
- children
3234
- }) => jsx(Layout$1, {
3235
- children: children
3236
- });
3237
- const Layout$1 = tw.div`
3238
- tu-layout-TitleNavContentLayout
3239
- `;
3240
-
3241
- /**
3242
- * TwoColumnLayout.
3243
- *
3244
- * @param {TwoColumnLayoutProps} props - The props for the TwoColumnLayout component
3245
- * @returns {JSX.Element} TwoColumnLayout component
3246
- */
3247
-
3248
- const TwoColumnLayout = ({
3249
- children
3250
- }) => jsx(Layout, {
3251
- children: children
3252
- });
3253
- const Layout = tw.div`
3254
- tu-layout-TwoColumnLayout
3255
- `;
3256
-
3257
- /**
3258
- * The MultiRowTableCell component extendins Table Cell component and formats your content supporting 2 rows.
3259
- *
3260
- * @param {MultiRowTableCellProps} props - The props for the MultiRowTableCell component
3261
- * @returns {JSX.Element} MultiRowTableCell component
3262
- */
3263
-
3264
- const MultiRowTableCell = ({
3265
- main,
3266
- secondary,
3267
- area = "none",
3268
- dataTestId
3269
- }) => {
3270
- return jsxs(Root$1, Object.assign({
3271
- area: area,
3272
- dataTestId: dataTestId
3273
- }, {
3274
- children: [jsx(Header, {
3275
- children: main
3276
- }), secondary && jsx(Secondary, {
3277
- children: secondary
3278
- })]
3279
- }));
3280
- };
3281
- const Root$1 = tw(GridArea)`
3282
- tu-multi-row-table-cell-container
3283
- `;
3284
- const Header = tw.div`
3285
- tu-multi-row-table-cell
3286
- tu-multi-row-table-cell__header
3287
- `;
3288
- const Secondary = tw.div`
3289
- tu-multi-row-table-cell
3290
- tu-multi-row-table-cell__secondary
3291
- `;
3292
-
3293
- /**
3294
- * A thin wrapper around the `BaseInput` component for number input fields.
3295
- *
3296
- * NOTE: If shown with a label, please use the `NumberField` component instead.
3297
- */
3298
-
3299
- const NumberInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
3300
- ref: ref,
3301
- type: "number"
3302
- }, props)));
3303
-
3304
- /**
3305
- * The number field component is used for entering numeric values and includes controls for incrementally increasing or decreasing the value.
3306
- *
3307
- * _**Do use**_ the NumberField when the controls to incrementally increase or decrease makes the task easier for the user.
3308
- *
3309
- * _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
3310
- */
3311
-
3312
- const NumberField = forwardRef((_a, ref) => {
3117
+ const Tag = React.forwardRef((_a, ref) => {
3313
3118
  var {
3314
- label,
3315
- tip,
3316
- helpText,
3317
- errorMessage,
3318
- helpAddon,
3319
- isInvalid,
3320
- maxLength,
3321
3119
  className,
3322
- value,
3323
- dataTestId
3324
- } = _a,
3325
- rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "maxLength", "className", "value", "dataTestId"]);
3120
+ dataTestId,
3121
+ children,
3122
+ size = "default",
3123
+ onClose,
3124
+ color = "primary"
3125
+ } = _a;
3126
+ __rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color"]);
3326
3127
 
3327
- const renderAsInvalid = isInvalid || Boolean(errorMessage);
3328
- return jsx(FormGroup, Object.assign({
3329
- label: label,
3330
- tip: tip,
3331
- isInvalid: renderAsInvalid,
3332
- helpText: errorMessage || helpText,
3333
- helpAddon: helpAddon,
3334
- dataTestId: `${dataTestId}-FormGroup`
3128
+ return jsxs(StyledText, Object.assign({
3129
+ className: className,
3130
+ "$size": size,
3131
+ "data-testid": dataTestId,
3132
+ "$as": "span",
3133
+ "$color": color,
3134
+ "$withXIcon": !!onClose,
3135
+ ref: ref
3335
3136
  }, {
3336
- children: jsx(NumberInput, Object.assign({
3337
- ref: ref,
3338
- maxLength: maxLength,
3339
- value: value,
3340
- isInvalid: renderAsInvalid
3341
- }, rest, {
3342
- className: className,
3343
- dataTestId: dataTestId
3344
- }))
3137
+ children: [children, onClose && // a fix for multiselect deselecting tags working together with fade out animation
3138
+ jsx(IconContainer, Object.assign({
3139
+ onMouseDown: onClose
3140
+ }, {
3141
+ children: jsx(Icon$1, {
3142
+ name: "XCircleIcon",
3143
+ dataTestId: dataTestId + "Icon",
3144
+ type: "solid",
3145
+ style: {
3146
+ "-webkit-transition": "-webkit-transform 0.150s"
3147
+ },
3148
+ className: size === "default" ? tws`tu-tag__icon` : tws`tu-tag__icon tu-tag__icon--small`
3149
+ })
3150
+ }))]
3345
3151
  }));
3346
3152
  });
3347
3153
 
3348
- const GetSpacerHeight = () => ({
3349
- minHeight
3154
+ const getSizeModifierClass = () => ({
3155
+ $size,
3156
+ $withXIcon
3350
3157
  }) => {
3351
- if (!minHeight) {
3352
- return "";
3353
- }
3354
-
3355
- switch (minHeight) {
3356
- case "normal":
3357
- return tws`min-h-[8px]`;
3358
-
3359
- case "large":
3360
- return tws`min-h-[32px]`;
3361
-
3362
- default:
3363
- return "";
3364
- }
3158
+ const tagSizeModifierClass = {
3159
+ default: $withXIcon ? tws`tu-tag--with-icon ` : tws` `,
3160
+ small: $withXIcon ? tws`tu-tag--small tu-tag--with-icon` : tws`tu-tag--small`
3161
+ };
3162
+ return tagSizeModifierClass[$size];
3365
3163
  };
3366
- /**
3367
- * The Spacer component is used for adding a bit of space.
3368
- *
3369
- * @param {SpacerProps} props - The props for the Spacer component
3370
- * @returns {JSX.Element} Spacer component
3371
- */
3372
-
3373
3164
 
3374
- const Spacer = ({
3375
- minHeight = "",
3376
- border,
3377
- dataTestId
3165
+ const getColorModifierClass = () => ({
3166
+ $color
3378
3167
  }) => {
3379
- return jsx(Space, {
3380
- "data-testid": dataTestId,
3381
- minHeight: minHeight,
3382
- border: border
3383
- });
3168
+ const colorClasses = {
3169
+ primary: tws`tu-tag--primary`,
3170
+ accent: tws`tu-tag--accent`,
3171
+ success: tws`tu-tag--success`,
3172
+ danger: tws`tu-tag--danger`,
3173
+ warning: tws`tu-tag--warning`,
3174
+ info: tws`tu-tag--info`,
3175
+ neutral: tws`tu-tag--neutral`,
3176
+ good: tws`tu-tag--good`,
3177
+ low: tws`tu-tag--low`,
3178
+ critical: tws`tu-tag--critical`,
3179
+ working: tws`tu-tag--working`,
3180
+ idle: tws`tu-tag--idle`,
3181
+ stopped: tws`tu-tag--stopped`,
3182
+ unknown: tws`tu-tag--unknown`
3183
+ };
3184
+ return colorClasses[$color];
3384
3185
  };
3385
- const Space = tw.div`
3386
- ${p => `${p.border ? `tu-spacer--border` : null}`}
3387
- ${GetSpacerHeight()}
3186
+
3187
+ const StyledText = tw.text`
3188
+ tu-tag
3189
+ ${getSizeModifierClass()}
3190
+ ${getColorModifierClass()}
3191
+ `;
3192
+ const IconContainer = tw.div`
3193
+ tu-tag__icon-container
3388
3194
  `;
3389
3195
 
3390
3196
  /**
@@ -3398,7 +3204,7 @@ const PageHeading = ({
3398
3204
  title,
3399
3205
  subtitle,
3400
3206
  dataTestId,
3401
- badge
3207
+ tag
3402
3208
  }) => {
3403
3209
  return jsxs("div", Object.assign({
3404
3210
  className: "w-full"
@@ -3411,10 +3217,10 @@ const PageHeading = ({
3411
3217
  dataTestId: dataTestId
3412
3218
  }, {
3413
3219
  children: title
3414
- })), badge && jsx(Badge, Object.assign({
3220
+ })), tag && jsx(Tag, Object.assign({
3415
3221
  color: "primary"
3416
3222
  }, {
3417
- children: badge
3223
+ children: tag
3418
3224
  }))]
3419
3225
  }), subtitle && jsx(Heading, Object.assign({
3420
3226
  variant: "subtitle",
@@ -3590,14 +3396,14 @@ const RadioItem = ({
3590
3396
  onChange: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.onChange,
3591
3397
  "data-testid": dataTestId,
3592
3398
  "$checked": isChecked
3593
- }), jsx(Label, Object.assign({
3399
+ }), jsx(Label$1, Object.assign({
3594
3400
  htmlFor: uuid,
3595
3401
  "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
3596
3402
  "$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid
3597
3403
  }, {
3598
3404
  children: label
3599
3405
  }))]
3600
- }), description && jsx(Description, Object.assign({
3406
+ }), description && jsx(Description$1, Object.assign({
3601
3407
  htmlFor: uuid,
3602
3408
  "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
3603
3409
  "$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid
@@ -3624,7 +3430,7 @@ ${({
3624
3430
  $isInvalid
3625
3431
  }) => $isInvalid ? tws`tu-radioitem--invalid` : tws``}
3626
3432
  `;
3627
- const Label = tw.label`
3433
+ const Label$1 = tw.label`
3628
3434
  tu-radioitem__label
3629
3435
  ${({
3630
3436
  $isInvalid
@@ -3633,7 +3439,7 @@ ${({
3633
3439
  $disabled
3634
3440
  }) => $disabled ? tws`tu-radioitem__label--disabled` : tws``}
3635
3441
  `;
3636
- const Description = tw.label`
3442
+ const Description$1 = tw.label`
3637
3443
  tu-radioitem__description
3638
3444
  `;
3639
3445
 
@@ -3658,11 +3464,11 @@ const SelectContainer = ({
3658
3464
  return jsxs(Container, Object.assign({
3659
3465
  "data-testid": dataTestId
3660
3466
  }, {
3661
- children: [label && !hideLabel && jsx(Label$3, {
3662
- label: label,
3663
- htmlFor: id !== null && id !== void 0 ? id : false,
3664
- description: description
3665
- }), 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({
3666
3472
  size: "small",
3667
3473
  "$hasError": hasError !== null && hasError !== void 0 ? hasError : false
3668
3474
  }, {
@@ -3898,6 +3704,10 @@ const Select = _a => {
3898
3704
  }));
3899
3705
  };
3900
3706
 
3707
+ /**
3708
+ * Display placeholder lines before the data gets loaded to reduce load-time frustration.
3709
+ */
3710
+
3901
3711
  const SkeletonLines = memo(({
3902
3712
  margin = "10px 0",
3903
3713
  lines = 1,
@@ -3948,104 +3758,6 @@ const SkeletonLine = tw.div`
3948
3758
  tu-skeleton-line
3949
3759
  `;
3950
3760
 
3951
- /**
3952
- * Tags allow users to enter information and filter content.
3953
- * Multiple or single tags can be used to categorise items.
3954
- * Use short labels for easy scanning. Use two words only if necessary to describe the status and differentiate it from other tags.
3955
- *
3956
- * @param {TagProps} props - The props for the tag component
3957
- * @returns {JSX.Element} tag component
3958
- */
3959
-
3960
- const Tag = _a => {
3961
- var {
3962
- className,
3963
- dataTestId,
3964
- children,
3965
- size = "default",
3966
- onClose,
3967
- color = "primary",
3968
- onWidthKnown
3969
- } = _a;
3970
- __rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color", "onWidthKnown"]);
3971
-
3972
- const ref = React.useRef(null);
3973
- React.useLayoutEffect(() => {
3974
- var _a;
3975
-
3976
- onWidthKnown && onWidthKnown({
3977
- width: ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0
3978
- });
3979
- }, [ref, onWidthKnown]);
3980
- return jsxs(StyledText, Object.assign({
3981
- className: className,
3982
- "$size": size,
3983
- "data-testid": dataTestId,
3984
- "$as": "span",
3985
- "$color": color,
3986
- "$withXIcon": !!onClose,
3987
- ref: ref
3988
- }, {
3989
- children: [children, onClose && // a fix for multiselect deselecting tags working together with fade out animation
3990
- jsx(IconContainer, Object.assign({
3991
- onMouseDown: onClose
3992
- }, {
3993
- children: jsx(Icon$1, {
3994
- name: "XCircleIcon",
3995
- dataTestId: dataTestId + "Icon",
3996
- type: "solid",
3997
- style: {
3998
- "-webkit-transition": "-webkit-transform 0.150s"
3999
- },
4000
- className: size === "default" ? tws`tu-tag__icon` : tws`tu-tag__icon tu-tag__icon--small`
4001
- })
4002
- }))]
4003
- }));
4004
- };
4005
-
4006
- const getSizeModifierClass = () => ({
4007
- $size,
4008
- $withXIcon
4009
- }) => {
4010
- const tagSizeModifierClass = {
4011
- default: $withXIcon ? tws`tu-tag--with-icon ` : tws` `,
4012
- small: $withXIcon ? tws`tu-tag--small tu-tag--with-icon` : tws`tu-tag--small`
4013
- };
4014
- return tagSizeModifierClass[$size];
4015
- };
4016
-
4017
- const getColorModifierClass = () => ({
4018
- $color
4019
- }) => {
4020
- const colorClasses = {
4021
- primary: tws`tu-tag--primary`,
4022
- accent: tws`tu-tag--accent`,
4023
- success: tws`tu-tag--success`,
4024
- danger: tws`tu-tag--danger`,
4025
- warning: tws`tu-tag--warning`,
4026
- info: tws`tu-tag--info`,
4027
- neutral: tws`tu-tag--neutral`,
4028
- good: tws`tu-tag--good`,
4029
- low: tws`tu-tag--low`,
4030
- critical: tws`tu-tag--critical`,
4031
- working: tws`tu-tag--working`,
4032
- idle: tws`tu-tag--idle`,
4033
- stopped: tws`tu-tag--stopped`,
4034
- unknown: tws`tu-tag--unknown`
4035
- };
4036
- return colorClasses[$color];
4037
- };
4038
-
4039
- const StyledText = tw.text`
4040
- tu-tag
4041
- ${getSizeModifierClass()}
4042
- ${getColorModifierClass()}
4043
- `;
4044
- const IconContainer = tw.div`
4045
- flex
4046
- self-center
4047
- `;
4048
-
4049
3761
  const TextArea = React.forwardRef(({
4050
3762
  id,
4051
3763
  name,
@@ -4071,16 +3783,16 @@ const TextArea = React.forwardRef(({
4071
3783
  }, ref) => {
4072
3784
  const hasError = !!error;
4073
3785
  return jsxs(TextAreaContainer, Object.assign({
4074
- className: className,
4075
- "data-testid": dataTestId
3786
+ className: className
4076
3787
  }, {
4077
- children: [jsx(Label$3, {
4078
- htmlFor: id !== null && id !== void 0 ? id : false,
4079
- id: id,
4080
- label: label,
4081
- description: description
4082
- }), jsx(StyledTextArea, {
3788
+ children: [jsx(Label$5, Object.assign({
3789
+ htmlFor: id
3790
+ }, {
3791
+ children: label
3792
+ })), jsx(StyledTextArea, {
4083
3793
  name: name,
3794
+ id: id,
3795
+ "data-testid": dataTestId,
4084
3796
  value: value,
4085
3797
  rows: rows,
4086
3798
  disabled: disabled,
@@ -4314,6 +4026,17 @@ const TimelineElement = ({
4314
4026
  }));
4315
4027
  };
4316
4028
 
4029
+ /**
4030
+ * Use Toggle when you have to only enable/disable a feature.
4031
+ *
4032
+ * _**Do use** Toggle in forms or settings._
4033
+ *
4034
+ * _**Do not use** Toggle if a user can select many option from a list, use checkboxes instead of toggle._
4035
+ *
4036
+ * @param {ToggleProps} props - The props for the Toggle component
4037
+ * @returns {JSX.Element} Toggle component
4038
+ */
4039
+
4317
4040
  const Toggle = React.forwardRef(({
4318
4041
  toggled = false,
4319
4042
  onChange,
@@ -4325,72 +4048,99 @@ const Toggle = React.forwardRef(({
4325
4048
  className,
4326
4049
  dataTestId,
4327
4050
  onBlur,
4328
- name
4051
+ name,
4052
+ description = ""
4329
4053
  }, ref) => {
4330
- return jsxs(React.Fragment, {
4331
- children: [jsx(HiddenInput, {
4332
- name: name,
4333
- type: "checkbox",
4334
- checked: toggled,
4335
- disabled: disabled,
4336
- onChange: e => {
4337
- e.stopPropagation();
4338
- onChange(!toggled, e);
4339
- },
4340
- id: id,
4341
- "aria-checked": toggled,
4342
- role: "checkbox",
4343
- tabIndex: tabIndex,
4344
- required: required,
4345
- ref: ref,
4346
- "data-testid": dataTestId,
4347
- onBlur: onBlur
4348
- }), jsx(SwitchContainer, Object.assign({
4349
- "$toggled": toggled,
4054
+ return jsxs(ToggleWrapper, {
4055
+ children: [jsxs(ToggleContainer, Object.assign({
4350
4056
  htmlFor: id,
4351
- "$disabled": disabled,
4352
- "$size": size,
4353
- className: className
4057
+ "$description": description
4354
4058
  }, {
4355
- children: jsx(Switch, {
4059
+ children: [jsx(HiddenInput, {
4060
+ name: name,
4061
+ type: "checkbox",
4062
+ checked: toggled,
4063
+ disabled: disabled,
4064
+ onChange: e => {
4065
+ e.stopPropagation();
4066
+ onChange(!toggled, e);
4067
+ },
4068
+ id: id,
4069
+ "aria-checked": toggled,
4070
+ role: "checkbox",
4071
+ tabIndex: tabIndex,
4072
+ required: required,
4073
+ ref: ref,
4074
+ "data-testid": `${dataTestId}-Input`,
4075
+ onBlur: onBlur
4076
+ }), jsx(SwitchContainer, Object.assign({
4356
4077
  "$toggled": toggled,
4357
- "$size": size
4358
- })
4359
- }))]
4078
+ htmlFor: id,
4079
+ "$disabled": disabled,
4080
+ "$size": size,
4081
+ className: className
4082
+ }, {
4083
+ children: jsx(Switch, {
4084
+ "$toggled": toggled,
4085
+ htmlFor: id,
4086
+ "data-testid": `${dataTestId}-Switch`
4087
+ })
4088
+ }))]
4089
+ })), jsxs("div", {
4090
+ children: [jsx(Label, Object.assign({
4091
+ "$disabled": disabled,
4092
+ title: name,
4093
+ "$description": description,
4094
+ htmlFor: id,
4095
+ "data-testid": `${dataTestId}-Label`
4096
+ }, {
4097
+ children: name
4098
+ })), jsx("br", {}), description && jsx(Description, Object.assign({
4099
+ "$disabled": disabled,
4100
+ title: description,
4101
+ "data-testid": `${dataTestId}-Description`
4102
+ }, {
4103
+ children: description
4104
+ }))]
4105
+ })]
4360
4106
  });
4361
4107
  });
4362
- const Switch = tw.span`
4363
- rounded-full
4364
- bg-white
4365
- h-full
4366
- aspect-square
4108
+ Toggle.displayName = "Toggle";
4109
+ const ToggleWrapper = tw.div`tu-toggle__wrapper`;
4110
+ const ToggleContainer = tw.label`
4111
+ tu-toggle__container
4112
+ ${({
4113
+ $description
4114
+ }) => $description && tws`tu-toggle--align-bottom`}`;
4115
+ const HiddenInput = tw.input`tu-toggle__input`;
4116
+ const Switch = tw.label`
4367
4117
  ${({
4368
4118
  $toggled
4369
- }) => $toggled ? tws`translate-x-4` : tws`translate-x-0`}
4370
- transition-all
4371
- `;
4119
+ }) => $toggled ? tws`tu-toggle__switch` : tws`tu-toggle`}`;
4372
4120
  const SwitchContainer = tw.label`
4373
- flex
4374
- items-center
4375
- rounded-full
4376
- p-1
4121
+ tu-toggle__switch-container
4377
4122
  ${({
4378
4123
  $disabled
4379
- }) => $disabled ? tws`cursor-not-allowed pointer-events-none` : tws`cursor-pointer`};
4124
+ }) => $disabled && tws`tu-toggle--disabled`};
4380
4125
  ${({
4381
4126
  $size
4382
- }) => $size === "small" ? tws`w-8 h-4` : tws`w-10 h-6`};
4127
+ }) => $size === "small" ? tws`tu-toggle--small` : tws`tu-toggle--default`};
4383
4128
  ${({
4384
- $toggled,
4129
+ $toggled
4130
+ }) => $toggled && tws`tu-toggle--toggled`}`;
4131
+ const Label = tw.label`
4132
+ tu-toggle__label
4133
+ ${({
4385
4134
  $disabled
4386
- }) => $disabled ? tws`bg-neutral-300` : $toggled ? tws`bg-primary-400` : tws`bg-neutral-500`}
4387
- transition-all
4388
- active:shadow
4389
- `;
4390
- const HiddenInput = tw.input`
4391
- absolute
4392
- opacity-0
4393
- -z-10
4135
+ }) => $disabled && tws`tu-toggle__label--disabled`}
4136
+ ${({
4137
+ $description
4138
+ }) => $description && tws`tu-toggle--align-label`}`;
4139
+ const Description = tw.label`
4140
+ tu-toggle__description
4141
+ ${({
4142
+ $disabled
4143
+ }) => $disabled && tws`tu-toggle__description--disabled`}
4394
4144
  `;
4395
4145
 
4396
4146
  /**
@@ -4514,4 +4264,246 @@ const useTimeout = ({
4514
4264
  };
4515
4265
  };
4516
4266
 
4517
- 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$3 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 };