@trackunit/react-components 0.1.174 → 0.1.176

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 (51) hide show
  1. package/index.cjs.js +206 -153
  2. package/index.esm.js +205 -154
  3. package/package.json +2 -2
  4. package/src/common/PackageNameStoryComponent.d.ts +12 -0
  5. package/src/components/Alert/Alert.d.ts +1 -1
  6. package/src/components/Badge/Badge.d.ts +1 -1
  7. package/src/components/Card/Card.d.ts +1 -1
  8. package/src/components/Card/CardFooter.d.ts +1 -1
  9. package/src/components/Card/CardHeader.d.ts +1 -1
  10. package/src/components/Collapse/Collapse.d.ts +1 -1
  11. package/src/components/CopyableText/CopyableText.d.ts +1 -1
  12. package/src/components/DayPicker/DayPicker.d.ts +1 -1
  13. package/src/components/DayPicker/DayPickerPopover.d.ts +1 -1
  14. package/src/components/DayPicker/DayRangePicker.d.ts +1 -1
  15. package/src/components/Drawer/Drawer.d.ts +1 -1
  16. package/src/components/EmptyState/EmptyState.d.ts +1 -1
  17. package/src/components/ExternalLink/ExternalLink.d.ts +1 -1
  18. package/src/components/Heading/Heading.d.ts +1 -1
  19. package/src/components/Icon/Icon.d.ts +1 -1
  20. package/src/components/Indicator/Indicator.d.ts +1 -1
  21. package/src/components/Menu/MenuItem/MenuItem.d.ts +1 -1
  22. package/src/components/Menu/MenuList/MenuList.d.ts +1 -1
  23. package/src/components/Modal/Modal.d.ts +1 -0
  24. package/src/components/Modal/ModalBackdrop.d.ts +1 -1
  25. package/src/components/Modal/useModal.d.ts +1 -1
  26. package/src/components/PageHeader/PageHeader.d.ts +1 -1
  27. package/src/components/Pagination/Pagination.d.ts +1 -1
  28. package/src/components/Popover/Popover.d.ts +1 -1
  29. package/src/components/Popover/PopoverTitle.d.ts +1 -1
  30. package/src/components/Prompt/Prompt.d.ts +1 -1
  31. package/src/components/SectionHeader/SectionHeader.d.ts +1 -1
  32. package/src/components/Sidebar/Sidebar.d.ts +1 -1
  33. package/src/components/SkeletonLines/SkeletonLines.d.ts +1 -0
  34. package/src/components/Spacer/Spacer.d.ts +1 -1
  35. package/src/components/Spinner/Spinner.d.ts +1 -1
  36. package/src/components/Tag/Tag.d.ts +1 -1
  37. package/src/components/Text/Text.d.ts +1 -1
  38. package/src/components/Timeline/Timeline.d.ts +1 -1
  39. package/src/components/Tip/Tip.d.ts +1 -1
  40. package/src/components/Tooltip/Tooltip.d.ts +1 -1
  41. package/src/components/ValueBar/ValueBar.d.ts +1 -1
  42. package/src/components/ValueBar/ValueBarHelper.d.ts +4 -4
  43. package/src/components/Widget/Widget.variants.d.ts +5 -0
  44. package/src/components/Widget/WidgetBody.d.ts +25 -0
  45. package/src/components/Widget/index.d.ts +1 -0
  46. package/src/components/buttons/BackToTopButton/BackToTopButton.d.ts +1 -1
  47. package/src/components/buttons/Button/Button.d.ts +1 -1
  48. package/src/components/buttons/IconButton/IconButton.d.ts +3 -0
  49. package/src/components/buttons/StarButton/StarButton.d.ts +1 -1
  50. package/src/components/index.d.ts +1 -0
  51. package/src/index.d.ts +1 -0
package/index.esm.js CHANGED
@@ -36,6 +36,43 @@ const useContainerProps = ({ className, dataTestId }) => {
36
36
  return containerProps;
37
37
  };
38
38
 
39
+ /******************************************************************************
40
+ Copyright (c) Microsoft Corporation.
41
+
42
+ Permission to use, copy, modify, and/or distribute this software for any
43
+ purpose with or without fee is hereby granted.
44
+
45
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
46
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
47
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
48
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
49
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
50
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
51
+ PERFORMANCE OF THIS SOFTWARE.
52
+ ***************************************************************************** */
53
+
54
+ function __rest$1(s, e) {
55
+ var t = {};
56
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
57
+ t[p] = s[p];
58
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
59
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
60
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
61
+ t[p[i]] = s[p[i]];
62
+ }
63
+ return t;
64
+ }
65
+
66
+ function __awaiter(thisArg, _arguments, P, generator) {
67
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
68
+ return new (P || (P = Promise))(function (resolve, reject) {
69
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
70
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
71
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
72
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
73
+ });
74
+ }
75
+
39
76
  const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
40
77
  variants: {
41
78
  color: {
@@ -127,7 +164,7 @@ const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); /
127
164
  * - The Icon component is used to display an Icon.
128
165
  * - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
129
166
  * - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
130
- *
167
+
131
168
  * @param {IconProps} props - The props for the Icon component
132
169
  * @returns {JSX.Element} Icon component
133
170
  */
@@ -144,42 +181,88 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fil
144
181
  return (jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsx("svg", { viewBox: "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style), children: jsx("use", { href: href[correctIconType] }) }) }));
145
182
  };
146
183
 
147
- /******************************************************************************
148
- Copyright (c) Microsoft Corporation.
149
-
150
- Permission to use, copy, modify, and/or distribute this software for any
151
- purpose with or without fee is hereby granted.
152
-
153
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
154
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
155
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
156
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
157
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
158
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
159
- PERFORMANCE OF THIS SOFTWARE.
160
- ***************************************************************************** */
161
-
162
- function __rest$1(s, e) {
163
- var t = {};
164
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
165
- t[p] = s[p];
166
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
167
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
168
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
169
- t[p[i]] = s[p[i]];
170
- }
171
- return t;
172
- }
173
-
174
- function __awaiter(thisArg, _arguments, P, generator) {
175
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
176
- return new (P || (P = Promise))(function (resolve, reject) {
177
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
178
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
179
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
180
- step((generator = generator.apply(thisArg, _arguments || [])).next());
181
- });
182
- }
184
+ const cvaTag = cvaMerge([
185
+ "inline-flex",
186
+ "justify-center",
187
+ "items-center",
188
+ "rounded-full",
189
+ "py-1",
190
+ "px-2",
191
+ "text-center",
192
+ "whitespace-nowrap",
193
+ "h-min",
194
+ "min-w-[1.5rem]",
195
+ "font-medium",
196
+ "truncate",
197
+ "max-w-full",
198
+ "w-min",
199
+ "text-xs",
200
+ ], {
201
+ variants: {
202
+ size: {
203
+ small: "px-2 py-px",
204
+ medium: "",
205
+ },
206
+ layout: {
207
+ withIcon: "gap-2 pr-1",
208
+ default: "",
209
+ },
210
+ color: {
211
+ primary: "bg-primary-100 text-primary-700",
212
+ secondary: "bg-secondary-100 text-secondary-700",
213
+ accent: "bg-accent-100 text-accent-700",
214
+ neutral: "bg-neutral-100 text-neutral-700",
215
+ black: "bg-neutral-100 text-neutral-700",
216
+ white: "bg-white-100 text-white-700",
217
+ info: "bg-info-100 text-info-700",
218
+ success: "bg-success-100 text-success-700",
219
+ warning: "bg-warning-100 text-warning-700",
220
+ danger: "bg-danger-100 text-danger-700",
221
+ good: "bg-good-100 text-good-700",
222
+ low: "bg-low-100 text-low-700",
223
+ critical: "bg-critical-100 text-critical-700",
224
+ working: "bg-working-100 text-working-700",
225
+ stopped: "bg-stopped-100 text-stopped-700",
226
+ idle: "bg-idle-100 text-idle-700",
227
+ unknown: "bg-unknown-100 text-unknown-700",
228
+ moving: "bg-neutral-100 text-neutral-700",
229
+ active: "bg-neutral-100 text-neutral-700",
230
+ },
231
+ },
232
+ defaultVariants: {
233
+ size: "medium",
234
+ layout: "default",
235
+ color: "primary",
236
+ },
237
+ });
238
+ const cvaTagIconContainer = cvaMerge(["inline-flex", "self-center"]);
239
+ const cvaTagIcon = cvaMerge(["cursor-pointer", "transition-opacity", "hover:opacity-70"]);
240
+
241
+ /**
242
+ * The tag component is used to categorize elements in the ui.
243
+ *
244
+ * This could be to tell the state of an asset, or label a page as Beta.
245
+ *
246
+ * The tag is also used in multiselect components to show selected options.
247
+ *
248
+ * **Do:** Use short labels for easy scanning.
249
+
250
+ * @param {TagProps} props - The props for the tag component
251
+ * @returns {JSX.Element} tag component
252
+ */
253
+ const Tag = React.forwardRef((_a, ref) => {
254
+ var { className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false } = _a; __rest$1(_a, ["className", "dataTestId", "children", "size", "onClose", "color", "disabled"]);
255
+ return (jsxs("span", { className: cvaTag({ className, size, color, layout: Boolean(onClose) ? "withIcon" : "default" }), "data-testid": dataTestId && `${dataTestId}-tag`, ref: ref, children: [children, Boolean(onClose) && !disabled && (
256
+ // a fix for multiselect deselecting tags working together with fade out animation
257
+ jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsx(Icon, { name: "XCircle", dataTestId: dataTestId + "Icon", type: "solid", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, className: cvaTagIcon() }) }))] }));
258
+ });
259
+
260
+ /**
261
+ * A component used to display the package name and version in the Storybook docs.
262
+ */
263
+ const PackageNameStoryComponent = ({ packageJSON }) => {
264
+ return (jsxs("div", { className: "flex gap-2", children: [jsx(Tag, { color: "secondary", children: packageJSON === null || packageJSON === void 0 ? void 0 : packageJSON.name }), jsxs(Tag, { color: "secondary", children: ["v", packageJSON === null || packageJSON === void 0 ? void 0 : packageJSON.version] })] }));
265
+ };
183
266
 
184
267
  const cvaText = cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-normal"], {
185
268
  variants: {
@@ -240,7 +323,7 @@ const cvaText = cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-norm
240
323
  * ### When to use
241
324
  *
242
325
  * Use Text when you want to show a text section, use Heading if you want to show a heading.
243
- *
326
+
244
327
  * @param {TextProps} props - The props for the Text component
245
328
  * @returns {JSX.Element} Text component
246
329
  */
@@ -309,7 +392,7 @@ const cvaSpinnerContainer = cvaMerge(["box-border", "p-0.5", "overflow-hidden"],
309
392
  * Use a spinner component for any action that cannot be performed instantly and will only require a short time (between 1 to 5 seconds) to process.
310
393
  *
311
394
  * Use when retrieving or refreshing small data amounts, such as status.
312
- *
395
+
313
396
  * @param {SpinnerProps} props - The props for the Spinner component
314
397
  * @returns {JSX.Element} Spinner component
315
398
  */
@@ -507,7 +590,7 @@ const cvaIconButtonContainer = cvaMerge(["w-5", "h-5", "flex", "justify-center",
507
590
 
508
591
  /**
509
592
  * Buttons allow users to perform an action when triggered.
510
- *
593
+
511
594
  * @param {ButtonProps} props - The props for the Button component
512
595
  * @returns {JSX.Element} Button component
513
596
  */
@@ -521,6 +604,9 @@ const Button$1 = React.forwardRef((_a, ref) => {
521
604
  tabIndex, disabled: disabled || loading, className: cvaButton({ rounded: circular, disabled, size, square, color, variant, fullWidth, className }), "aria-label": title, "data-testid": dataTestId, children: (jsxs(Fragment, { children: [loading && jsx(Spinner, { className: cvaButtonSpinner(), centering: "vertically" }), prefix, children, suffix] })) }, rest));
522
605
  });
523
606
 
607
+ /**
608
+ * The IconButton is used for a button with an icon.
609
+ */
524
610
  const IconButton = React.forwardRef((_a, ref) => {
525
611
  var { icon, size = "small", square = true, loading, disabled } = _a, rest = __rest$1(_a, ["icon", "size", "square", "loading", "disabled"]);
526
612
  return (jsx(Button$1, Object.assign({ size: size, square: square, disabled: disabled || loading, ref: ref }, rest, { children: jsx("div", { className: cvaIconButtonContainer({ size }), children: loading ? jsx(Spinner, { size: size }) : icon }) })));
@@ -528,7 +614,7 @@ const IconButton = React.forwardRef((_a, ref) => {
528
614
 
529
615
  /**
530
616
  * The StarButton component is used for favorite actions or similar.
531
- *
617
+
532
618
  * @param {StarButtonProps} props - The props for the StarButton component
533
619
  * @returns {JSX.Element} StarButton component
534
620
  */
@@ -603,7 +689,7 @@ const cvaAlertIconContainer = cvaMerge(["self-start", "mr-3", "shrink-0", "grid"
603
689
 
604
690
  /**
605
691
  * The Alert component should be used to inform the user of important information.
606
- *
692
+
607
693
  * @param {AlertProps} props - The props for the Alert component
608
694
  * @returns {JSX.Element} Alert component
609
695
  */
@@ -675,7 +761,7 @@ const cvaBadge = cvaMerge([
675
761
 
676
762
  /**
677
763
  * The Badge component is used to display a notification badge with an optional number value.
678
- *
764
+
679
765
  * @param {BadgeProps} props - The props for the Badge component
680
766
  * @returns {JSX.Element} Badge component
681
767
  */
@@ -733,7 +819,7 @@ const cvaCardFooterDensityContainer = cvaMerge(["flex border-t-2", "border-neutr
733
819
  density: "auto",
734
820
  },
735
821
  });
736
- const cvaCardHeader = cvaMerge(["flex", "justify-between"]);
822
+ const cvaCardHeader = cvaMerge(["flex", "justify-between", "flex-1"]);
737
823
  const cvaCardHeaderHeadingContainer = cvaMerge(["flex", "gap-4", "items-center"]);
738
824
  const cvaCardHeaderDensityContainer = cvaMerge(["flex border-b-2", "border-neutral-200"], {
739
825
  variants: {
@@ -785,7 +871,7 @@ const ROLE_CARD = "region";
785
871
  /**
786
872
  * The Card component is a container for UI elements, and is the main component of the modal.
787
873
  * To get the most out of the Card, use it in combination with the CardHeader, CardBody and CardFooter.
788
- *
874
+
789
875
  * @param {CardProps} props - The props for the Card component
790
876
  * @returns {JSX.Element} Card component
791
877
  */
@@ -810,7 +896,7 @@ const CardBody = ({ density = "auto", children, dataTestId, className, disableGa
810
896
  * A simple footer intended to use with Cards and Modals.
811
897
  * Currently only intended to contain Buttons.
812
898
  * The buttons justifies to the right, but if you style a button with "margin-right: auto" it will move to the left
813
- *
899
+
814
900
  * @param {CardFooterProps} props - The props for the CardFooter component
815
901
  * @returns {JSX.Element} CardFooter component
816
902
  */
@@ -855,7 +941,7 @@ const cvaHeading = cvaMerge(["m-0", "leading-normal", "text-black"], {
855
941
 
856
942
  /**
857
943
  * The Heading is used for a heading of a section (h1,h2,h3,h4).
858
- *
944
+
859
945
  * @param {HeadingProps} props - The props for the Heading component
860
946
  * @returns {JSX.Element} Heading component
861
947
  */
@@ -872,7 +958,7 @@ const Heading = (_a) => {
872
958
 
873
959
  /**
874
960
  * Header for Cards and Modals.
875
- *
961
+
876
962
  * @param {CardHeaderProps} props - The props for the CardHeader component
877
963
  * @returns {JSX.Element} CardHeader component
878
964
  */
@@ -1208,7 +1294,7 @@ const cvaCollapseIcon = cvaMerge(["ease-in-out", "duration-200"], {
1208
1294
 
1209
1295
  /**
1210
1296
  * The Collapse component is used to condense non-important information.
1211
- *
1297
+
1212
1298
  * @param {CollapseProps} props - The props for the Collapse component
1213
1299
  * @returns {JSX.Element} Collapse component
1214
1300
  */
@@ -1254,7 +1340,7 @@ const cvaCopyableText = cvaMerge([
1254
1340
 
1255
1341
  /**
1256
1342
  * The CopyableText component is used where the user should have easy access to copy information.
1257
- *
1343
+
1258
1344
  * @param {CopyableTextProps} props - The props for the CopyableText component
1259
1345
  * @returns {JSX.Element} CopyableText component
1260
1346
  */
@@ -14802,7 +14888,7 @@ const useLocale = (language) => {
14802
14888
 
14803
14889
  /**
14804
14890
  * The DayPicker component is used when the user needs to select a date.
14805
- *
14891
+
14806
14892
  * @param {DayPickerProps} props - The props for the DayPicker component
14807
14893
  * @returns {JSX.Element} DayPicker component
14808
14894
  */
@@ -18790,7 +18876,7 @@ const usePopoverContext = () => {
18790
18876
  *
18791
18877
  * To render the content of the popover, use the `<PopoverContent />` component.
18792
18878
  *
18793
- *
18879
+
18794
18880
  * @param {PopoverProps} props The props for the popover
18795
18881
  * @returns {JSX.Element} A Popover Context Provider containing the children
18796
18882
  */
@@ -18821,7 +18907,7 @@ const PopoverContent = React__default.forwardRef(function PopoverContent(_a, pro
18821
18907
 
18822
18908
  /**
18823
18909
  * The PopoverTitle component.
18824
- *
18910
+
18825
18911
  * @param {PopoverTitleProps} props - The props for the PopoverTitle component
18826
18912
  * @returns {JSX.Element} PopoverTitle component
18827
18913
  */
@@ -18845,7 +18931,7 @@ const PopoverTrigger = forwardRef(function PopoverTrigger(_a, propRef) {
18845
18931
 
18846
18932
  /**
18847
18933
  * The DayPickerPopover component returns a button which when clicked shows the daypicker.
18848
- *
18934
+
18849
18935
  * @param {DayPickerPopoverProps} props - The props for the DayPickerPopover component
18850
18936
  * @returns {JSX.Element} DayPickerPopover component
18851
18937
  */
@@ -18855,7 +18941,7 @@ const DayPickerPopover = ({ disabledDays, className, dataTestId, selectedDay, on
18855
18941
 
18856
18942
  /**
18857
18943
  * The DayRangePicker component should be used when the user needs to select a range of dates.
18858
- *
18944
+
18859
18945
  * @param {DayRangePickerProps} props - The props for the DayRangePicker component
18860
18946
  * @returns {JSX.Element} DayRangePicker component
18861
18947
  */
@@ -18899,7 +18985,7 @@ const cvaDrawerCard = cvaMerge(["fixed", "z-toast"], {
18899
18985
 
18900
18986
  /**
18901
18987
  * The drawer provides a slideover which can be used to provide access to different locations in the application.
18902
- *
18988
+
18903
18989
  * @param {DrawerProps} props - The props for the Drawer component
18904
18990
  * @returns {JSX.Element} Drawer component
18905
18991
  */
@@ -18939,6 +19025,7 @@ const cvaSkeletonLine = cvaMerge([
18939
19025
 
18940
19026
  /**
18941
19027
  * Display placeholder lines before the data gets loaded to reduce load-time frustration.
19028
+
18942
19029
  */
18943
19030
  const SkeletonLines = memo(({ margin = "10px 0", lines = 1, height, width = "100%", className, dataTestId }) => {
18944
19031
  const skeletonLines = [];
@@ -18982,7 +19069,7 @@ var WorkerWithSign = "8df3d27593b5fba4.svg";
18982
19069
  * Component representing an empty state.
18983
19070
  * Use this component when there is no data to display or when an error occurs.
18984
19071
  *
18985
- *
19072
+
18986
19073
  * @param {EmptyStateProps} props props
18987
19074
  * @returns {JSX.Element} component
18988
19075
  * @example
@@ -19027,7 +19114,7 @@ const cvaExternalLink = cvaMerge(["underline", "text-primary-600", "hover:text-p
19027
19114
 
19028
19115
  /**
19029
19116
  * The external link component is used to link to an external page outside the Trackunit Manager.
19030
- *
19117
+
19031
19118
  * @param {ExternalLinkProps} props - The props for the external link component
19032
19119
  * @returns {JSX.Element} External Link component
19033
19120
  */
@@ -19052,7 +19139,7 @@ const cvaTooltipContent = cvaMerge("max-w-sm rounded p-2", {
19052
19139
 
19053
19140
  /**
19054
19141
  * The Tooltip component is used to show helpful tips or contextual information to the users.
19055
- *
19142
+
19056
19143
  * @param {TooltipProps} props - The props for the Tooltip component
19057
19144
  * @returns {JSX.Element} Tooltip component
19058
19145
  */
@@ -19160,7 +19247,7 @@ const cvaIndicatorIconBackground = cvaMerge(["rounded-full", "items-center", "ju
19160
19247
  * _**Do use** indicators to communicate essential aspects of the state of an asset._
19161
19248
  *
19162
19249
  * _**Do not use** indicators for non-essential information, or to communicate information unrelated to the state of an asset._
19163
- *
19250
+
19164
19251
  * @param {IndicatorProps} props - The props for the Indicator component
19165
19252
  * @returns {JSX.Element} Indicator component
19166
19253
  */
@@ -19238,7 +19325,7 @@ const cvaMenuItemPrefix = cvaMerge(["self-center", "flex-grow-0", "text-slate-40
19238
19325
 
19239
19326
  /**
19240
19327
  * The MenuItem component is used to display a menu, primarily meant to be used in a list form.
19241
- *
19328
+
19242
19329
  * @param {MenuItemProps} props - The props for the MenuItem component
19243
19330
  * @returns {JSX.Element} MenuItem component
19244
19331
  */
@@ -19273,7 +19360,7 @@ const cvaMenuListDivider = cvaMerge([
19273
19360
 
19274
19361
  /**
19275
19362
  * The MenuList component is used for menus and selects.
19276
- *
19363
+
19277
19364
  * @param {MenuListProps} props - The props for the MenuList component
19278
19365
  * @returns {JSX.Element} MenuList component
19279
19366
  */
@@ -19339,7 +19426,7 @@ const cvaModalBackdrop = cvaMerge([
19339
19426
 
19340
19427
  /**
19341
19428
  * The Backdrop for the modal.
19342
- *
19429
+
19343
19430
  * @param {ModalBackdropProps} props - The props for the ModalBackdrop component
19344
19431
  * @returns {JSX.Element} ModalBackdrop component
19345
19432
  */
@@ -19360,6 +19447,7 @@ const ModalBackdrop = ({ children, isVisible, onClick }) => {
19360
19447
  * - Modals are used to present critical information or request user input needed to complete a user's workflow.
19361
19448
  * - Modals interrupt a user's workflow by design.
19362
19449
  * - The modal component provides a foundation for creating dialogs, lightboxes, etc.
19450
+
19363
19451
  */
19364
19452
  const Modal = React.forwardRef(({ isOpen, children, dataTestId, className, role = "", onDismissClick = () => {
19365
19453
  return;
@@ -19609,7 +19697,7 @@ var usePortal = /*@__PURE__*/getDefaultExportFromCjs(usePortal$1);
19609
19697
 
19610
19698
  /**
19611
19699
  * The useModal component should be used to inform the user of important information.
19612
- *
19700
+
19613
19701
  * @param {UseModalProps} props - The props for the useModal hook
19614
19702
  * @returns {*} useModal return
19615
19703
  */
@@ -19639,82 +19727,6 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
19639
19727
  };
19640
19728
  };
19641
19729
 
19642
- const cvaTag = cvaMerge([
19643
- "inline-flex",
19644
- "justify-center",
19645
- "items-center",
19646
- "rounded-full",
19647
- "py-1",
19648
- "px-2",
19649
- "text-center",
19650
- "whitespace-nowrap",
19651
- "h-min",
19652
- "min-w-[1.5rem]",
19653
- "font-medium",
19654
- "truncate",
19655
- "max-w-full",
19656
- "w-min",
19657
- "text-xs",
19658
- ], {
19659
- variants: {
19660
- size: {
19661
- small: "px-2 py-px",
19662
- medium: "",
19663
- },
19664
- layout: {
19665
- withIcon: "gap-2 pr-1",
19666
- default: "",
19667
- },
19668
- color: {
19669
- primary: "bg-primary-100 text-primary-700",
19670
- secondary: "bg-secondary-100 text-secondary-700",
19671
- accent: "bg-accent-100 text-accent-700",
19672
- neutral: "bg-neutral-100 text-neutral-700",
19673
- black: "bg-neutral-100 text-neutral-700",
19674
- white: "bg-white-100 text-white-700",
19675
- info: "bg-info-100 text-info-700",
19676
- success: "bg-success-100 text-success-700",
19677
- warning: "bg-warning-100 text-warning-700",
19678
- danger: "bg-danger-100 text-danger-700",
19679
- good: "bg-good-100 text-good-700",
19680
- low: "bg-low-100 text-low-700",
19681
- critical: "bg-critical-100 text-critical-700",
19682
- working: "bg-working-100 text-working-700",
19683
- stopped: "bg-stopped-100 text-stopped-700",
19684
- idle: "bg-idle-100 text-idle-700",
19685
- unknown: "bg-unknown-100 text-unknown-700",
19686
- moving: "bg-neutral-100 text-neutral-700",
19687
- active: "bg-neutral-100 text-neutral-700",
19688
- },
19689
- },
19690
- defaultVariants: {
19691
- size: "medium",
19692
- layout: "default",
19693
- color: "primary",
19694
- },
19695
- });
19696
- const cvaTagIconContainer = cvaMerge(["inline-flex", "self-center"]);
19697
- const cvaTagIcon = cvaMerge(["cursor-pointer", "transition-opacity", "hover:opacity-70"]);
19698
-
19699
- /**
19700
- * The tag component is used to categorize elements in the ui.
19701
- *
19702
- * This could be to tell the state of an asset, or label a page as Beta.
19703
- *
19704
- * The tag is also used in multiselect components to show selected options.
19705
- *
19706
- * **Do:** Use short labels for easy scanning.
19707
- *
19708
- * @param {TagProps} props - The props for the tag component
19709
- * @returns {JSX.Element} tag component
19710
- */
19711
- const Tag = React.forwardRef((_a, ref) => {
19712
- var { className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false } = _a; __rest$1(_a, ["className", "dataTestId", "children", "size", "onClose", "color", "disabled"]);
19713
- return (jsxs("span", { className: cvaTag({ className, size, color, layout: Boolean(onClose) ? "withIcon" : "default" }), "data-testid": dataTestId && `${dataTestId}-tag`, ref: ref, children: [children, Boolean(onClose) && !disabled && (
19714
- // a fix for multiselect deselecting tags working together with fade out animation
19715
- jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsx(Icon, { name: "XCircle", dataTestId: dataTestId + "Icon", type: "solid", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, className: cvaTagIcon() }) }))] }));
19716
- });
19717
-
19718
19730
  const cvaTip = cvaMerge("flex text-slate-300 transition hover:text-slate-500");
19719
19731
  const cvaTipContent = cvaMerge("flex max-w-sm items-center gap-2 rounded p-2 text-sm", {
19720
19732
  variants: {
@@ -19731,7 +19743,7 @@ const cvaTipContent = cvaMerge("flex max-w-sm items-center gap-2 rounded p-2 tex
19731
19743
  /**
19732
19744
  * The Tip component is used to show helpful tips or contextual information to the users.
19733
19745
  * The tip can optionally be rendered as an anchor tag, which redirects to users to an external link on click.
19734
- *
19746
+
19735
19747
  * @param {TipProps} props - The props for the Tip component
19736
19748
  * @returns {JSX.Element} Tip component
19737
19749
  */
@@ -19769,7 +19781,7 @@ const cvaPageHeaderChildContainer = cvaMerge(["flex", "flex-wrap", "gap-x-6", "i
19769
19781
  * Pageheader component is used to display a page header.
19770
19782
  *
19771
19783
  * PageHeader can be used to highlight the page topic, display important information about the page, and carry the action items related to the current page.
19772
- *
19784
+
19773
19785
  * @param {PageHeaderProps} props - The props for the PageHeader component
19774
19786
  * @returns {JSX.Element} PageHeader component
19775
19787
  */
@@ -19782,7 +19794,7 @@ const cvaPaginationText = cvaMerge("whitespace-nowrap");
19782
19794
 
19783
19795
  /**
19784
19796
  * Pagination Description. It could be used when you need navigation for your paging feature.
19785
- *
19797
+
19786
19798
  * @param {IPaginationProps} props - The props for the Pagination component
19787
19799
  * @returns {JSX.Element} Pagination component
19788
19800
  */
@@ -19848,7 +19860,7 @@ function useConfirmExit(confirmExit, when = true) {
19848
19860
  }
19849
19861
  /**
19850
19862
  * The usePrompt hook.
19851
- *
19863
+
19852
19864
  * @param {string} message -
19853
19865
  * @param {boolean} when -
19854
19866
  * @returns {void} void
@@ -21244,7 +21256,7 @@ const cvaSpacer = cvaMerge([], {
21244
21256
 
21245
21257
  /**
21246
21258
  * The Spacer component is used for adding a bit of space in the ui.
21247
- *
21259
+
21248
21260
  * @param {SpacerProps} props - The props for the Spacer component
21249
21261
  * @returns {JSX.Element} Spacer component
21250
21262
  */
@@ -21254,7 +21266,7 @@ const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
21254
21266
 
21255
21267
  /**
21256
21268
  * The SectionHeader component is used on sections to set the section title.
21257
- *
21269
+
21258
21270
  * @param {SectionHeaderProps} props - The props for the section header component
21259
21271
  * @returns {JSX.Element} SectionHeader component
21260
21272
  */
@@ -21337,7 +21349,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
21337
21349
  * - **_The sidebar is just a wrapper. You are responsible for styling the children._**
21338
21350
  *
21339
21351
  * When using this component make sure to add `setupIntersectionObserver();` to your jest.setup.ts file.
21340
- *
21352
+
21341
21353
  * @param {SidebarProps} props - The props for the Sidebar component
21342
21354
  * @returns {JSX.Element} Sidebar component
21343
21355
  */
@@ -21393,7 +21405,7 @@ const cvaTimelineDot = cvaMerge(["flex", "space-x-4", "items-start", "ml-[calc(-
21393
21405
  * - with an indicator (dot)
21394
21406
  * - a header (next to the dot)
21395
21407
  * - and a body.
21396
- *
21408
+
21397
21409
  * @param {TimelineProps} props - The props for the Timeline component
21398
21410
  * @returns {JSX.Element} Timeline component
21399
21411
  */
@@ -21452,7 +21464,7 @@ const cvaValueBarText = cvaMerge([], {
21452
21464
 
21453
21465
  /**
21454
21466
  * Helper function to get normalized score in range 0-1 used by the ValueBar
21455
- *
21467
+
21456
21468
  * @param {number} value - value for which score should be returned
21457
21469
  * @param {number} min - min range value
21458
21470
  * @param {number} max - max range value
@@ -21469,7 +21481,7 @@ const getScore = (value, min, max) => {
21469
21481
  };
21470
21482
  /**
21471
21483
  * Helper function to get default color used by the ValueBar
21472
- *
21484
+
21473
21485
  * @param {number} score - score number for which color should be returned
21474
21486
  * @returns {string} color value
21475
21487
  */
@@ -21484,7 +21496,7 @@ const getDefaultFillColor = (score) => {
21484
21496
  };
21485
21497
  /**
21486
21498
  * Helper function to get custom color used by the ValueBar
21487
- *
21499
+
21488
21500
  * @param {number} score - score number for which color should be returned
21489
21501
  * @param {LevelColors} levelColors - custom colors and levels definitions
21490
21502
  * @returns {string} color value
@@ -21501,7 +21513,7 @@ const getFillColor = (score, levelColors) => {
21501
21513
  };
21502
21514
  /**
21503
21515
  * Helper function to get color used by the ValueBar
21504
- *
21516
+
21505
21517
  * @param {number} value - value for which color should be returned
21506
21518
  * @param {number} min - min range value
21507
21519
  * @param {number} max - max range value
@@ -21515,7 +21527,7 @@ const getValueBarColorByValue = (value, min, max, levelColors) => {
21515
21527
 
21516
21528
  /**
21517
21529
  * ValueBar component is used to display value on a colorful bar within provided range.
21518
- *
21530
+
21519
21531
  * @param {ValueBarProps} props - The props for the ValueBar component
21520
21532
  * @returns {JSX.Element} ValueBar component
21521
21533
  */
@@ -21526,6 +21538,45 @@ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors
21526
21538
  return (jsx("svg", { className: cvaValueBar({ size, className }), "data-testid": dataTestId, children: jsxs("g", { children: [jsx("rect", { className: cvaValueBarProgress({ fill: "background" }), width: `${barWidth}%`, rx: "5" }), jsx("rect", { className: cvaValueBarProgress(), width: `${score * barWidth}%`, fill: barFillColor, rx: "5" }), showValue && size === "large" && (jsxs("text", { className: cvaValueBarText({ size }), x: "12", y: "23", fill: valueColor !== null && valueColor !== void 0 ? valueColor : "white", children: [Number(value.toFixed(1)), unit || ""] })), showValue && size === "small" && (jsxs("text", { className: cvaValueBarText({ size }), x: `${barWidth + 2}%`, y: "11", fill: valueColor !== null && valueColor !== void 0 ? valueColor : color("NEUTRAL", 400, "CSS"), children: [Number(value.toFixed(1)), unit || ""] }))] }) }));
21527
21539
  };
21528
21540
 
21541
+ const cvaWidgetBodyDensityContainer = cvaMerge(["flex", "flex-grow", "overflow-auto", "w-full", "h-full", "place-items-center", "overflow-hidden"], {
21542
+ variants: {
21543
+ disableGap: {
21544
+ true: "gap-0",
21545
+ false: "",
21546
+ },
21547
+ direction: {
21548
+ row: "flex-row",
21549
+ "row-reverse": "flex-row-reverse",
21550
+ column: "flex-col",
21551
+ "column-reverse": "flex-col-reverse",
21552
+ },
21553
+ density: {
21554
+ none: "",
21555
+ compact: "gap-3 p-3",
21556
+ comfortable: "gap-4 p-4",
21557
+ spacious: "gap-4 p-6",
21558
+ auto: " component-card-spacing sm:component-card-spacing-sm md:component-card-spacing-md",
21559
+ },
21560
+ },
21561
+ defaultVariants: {
21562
+ disableGap: false,
21563
+ direction: "column",
21564
+ density: "auto",
21565
+ },
21566
+ });
21567
+
21568
+ /**
21569
+ * The WidgetBody component should be used to inform the user of important information.
21570
+ *
21571
+ * @summary For applying padding and gap to a Widget.
21572
+ * @description The padding must live here, and not on the Widget itself, as to not inset the scrollbar in case of overflow
21573
+ * @param {WidgetBodyProps} props - The props for the WidgetBody component
21574
+ * @returns {JSX.Element} WidgetBody component
21575
+ */
21576
+ const WidgetBody = ({ density = "auto", children, dataTestId, className, disableGap }) => {
21577
+ return (jsx("div", { "data-testid": dataTestId, className: cvaWidgetBodyDensityContainer({ density, disableGap, className }), children: children }));
21578
+ };
21579
+
21529
21580
  const cvaClickable = cvaMerge([
21530
21581
  "shadow-lg",
21531
21582
  "rounded-lg",
@@ -39197,4 +39248,4 @@ const useVisibilityChange = ({ onChange, targetState }) => {
39197
39248
  }, [onChange, targetState]);
39198
39249
  };
39199
39250
 
39200
- export { Alert, Badge, Button$1 as Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, Timeline, TimelineElement, Tip, Tooltip, ValueBar, cvaButton, cvaButtonSpinner, cvaClickable, cvaIconButtonContainer, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useHover, useIsFirstRender, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout, useVisibilityChange };
39251
+ export { Alert, Badge, Button$1 as Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PackageNameStoryComponent, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, Timeline, TimelineElement, Tip, Tooltip, ValueBar, WidgetBody, cvaButton, cvaButtonSpinner, cvaClickable, cvaIconButtonContainer, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useHover, useIsFirstRender, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout, useVisibilityChange };