@trackunit/react-components 0.1.174 → 0.1.175

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.cjs.js CHANGED
@@ -762,7 +762,7 @@ const cvaCardFooterDensityContainer = cssClassVarianceUtilities.cvaMerge(["flex
762
762
  density: "auto",
763
763
  },
764
764
  });
765
- const cvaCardHeader = cssClassVarianceUtilities.cvaMerge(["flex", "justify-between"]);
765
+ const cvaCardHeader = cssClassVarianceUtilities.cvaMerge(["flex", "justify-between", "flex-1"]);
766
766
  const cvaCardHeaderHeadingContainer = cssClassVarianceUtilities.cvaMerge(["flex", "gap-4", "items-center"]);
767
767
  const cvaCardHeaderDensityContainer = cssClassVarianceUtilities.cvaMerge(["flex border-b-2", "border-neutral-200"], {
768
768
  variants: {
@@ -21555,6 +21555,45 @@ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors
21555
21555
  return (jsxRuntime.jsx("svg", { className: cvaValueBar({ size, className }), "data-testid": dataTestId, children: jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("rect", { className: cvaValueBarProgress({ fill: "background" }), width: `${barWidth}%`, rx: "5" }), jsxRuntime.jsx("rect", { className: cvaValueBarProgress(), width: `${score * barWidth}%`, fill: barFillColor, rx: "5" }), showValue && size === "large" && (jsxRuntime.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" && (jsxRuntime.jsxs("text", { className: cvaValueBarText({ size }), x: `${barWidth + 2}%`, y: "11", fill: valueColor !== null && valueColor !== void 0 ? valueColor : uiDesignTokens.color("NEUTRAL", 400, "CSS"), children: [Number(value.toFixed(1)), unit || ""] }))] }) }));
21556
21556
  };
21557
21557
 
21558
+ const cvaWidgetBodyDensityContainer = cssClassVarianceUtilities.cvaMerge(["flex", "flex-grow", "overflow-auto", "w-full", "h-full", "place-items-center", "overflow-hidden"], {
21559
+ variants: {
21560
+ disableGap: {
21561
+ true: "gap-0",
21562
+ false: "",
21563
+ },
21564
+ direction: {
21565
+ row: "flex-row",
21566
+ "row-reverse": "flex-row-reverse",
21567
+ column: "flex-col",
21568
+ "column-reverse": "flex-col-reverse",
21569
+ },
21570
+ density: {
21571
+ none: "",
21572
+ compact: "gap-3 p-3",
21573
+ comfortable: "gap-4 p-4",
21574
+ spacious: "gap-4 p-6",
21575
+ auto: " component-card-spacing sm:component-card-spacing-sm md:component-card-spacing-md",
21576
+ },
21577
+ },
21578
+ defaultVariants: {
21579
+ disableGap: false,
21580
+ direction: "column",
21581
+ density: "auto",
21582
+ },
21583
+ });
21584
+
21585
+ /**
21586
+ * The WidgetBody component should be used to inform the user of important information.
21587
+ *
21588
+ * @summary For applying padding and gap to a Widget.
21589
+ * @description The padding must live here, and not on the Widget itself, as to not inset the scrollbar in case of overflow
21590
+ * @param {WidgetBodyProps} props - The props for the WidgetBody component
21591
+ * @returns {JSX.Element} WidgetBody component
21592
+ */
21593
+ const WidgetBody = ({ density = "auto", children, dataTestId, className, disableGap }) => {
21594
+ return (jsxRuntime.jsx("div", { "data-testid": dataTestId, className: cvaWidgetBodyDensityContainer({ density, disableGap, className }), children: children }));
21595
+ };
21596
+
21558
21597
  const cvaClickable = cssClassVarianceUtilities.cvaMerge([
21559
21598
  "shadow-lg",
21560
21599
  "rounded-lg",
@@ -39271,6 +39310,7 @@ exports.TimelineElement = TimelineElement;
39271
39310
  exports.Tip = Tip;
39272
39311
  exports.Tooltip = Tooltip;
39273
39312
  exports.ValueBar = ValueBar;
39313
+ exports.WidgetBody = WidgetBody;
39274
39314
  exports.cvaButton = cvaButton;
39275
39315
  exports.cvaButtonSpinner = cvaButtonSpinner;
39276
39316
  exports.cvaClickable = cvaClickable;
package/index.esm.js CHANGED
@@ -733,7 +733,7 @@ const cvaCardFooterDensityContainer = cvaMerge(["flex border-t-2", "border-neutr
733
733
  density: "auto",
734
734
  },
735
735
  });
736
- const cvaCardHeader = cvaMerge(["flex", "justify-between"]);
736
+ const cvaCardHeader = cvaMerge(["flex", "justify-between", "flex-1"]);
737
737
  const cvaCardHeaderHeadingContainer = cvaMerge(["flex", "gap-4", "items-center"]);
738
738
  const cvaCardHeaderDensityContainer = cvaMerge(["flex border-b-2", "border-neutral-200"], {
739
739
  variants: {
@@ -21526,6 +21526,45 @@ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors
21526
21526
  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
21527
  };
21528
21528
 
21529
+ const cvaWidgetBodyDensityContainer = cvaMerge(["flex", "flex-grow", "overflow-auto", "w-full", "h-full", "place-items-center", "overflow-hidden"], {
21530
+ variants: {
21531
+ disableGap: {
21532
+ true: "gap-0",
21533
+ false: "",
21534
+ },
21535
+ direction: {
21536
+ row: "flex-row",
21537
+ "row-reverse": "flex-row-reverse",
21538
+ column: "flex-col",
21539
+ "column-reverse": "flex-col-reverse",
21540
+ },
21541
+ density: {
21542
+ none: "",
21543
+ compact: "gap-3 p-3",
21544
+ comfortable: "gap-4 p-4",
21545
+ spacious: "gap-4 p-6",
21546
+ auto: " component-card-spacing sm:component-card-spacing-sm md:component-card-spacing-md",
21547
+ },
21548
+ },
21549
+ defaultVariants: {
21550
+ disableGap: false,
21551
+ direction: "column",
21552
+ density: "auto",
21553
+ },
21554
+ });
21555
+
21556
+ /**
21557
+ * The WidgetBody component should be used to inform the user of important information.
21558
+ *
21559
+ * @summary For applying padding and gap to a Widget.
21560
+ * @description The padding must live here, and not on the Widget itself, as to not inset the scrollbar in case of overflow
21561
+ * @param {WidgetBodyProps} props - The props for the WidgetBody component
21562
+ * @returns {JSX.Element} WidgetBody component
21563
+ */
21564
+ const WidgetBody = ({ density = "auto", children, dataTestId, className, disableGap }) => {
21565
+ return (jsx("div", { "data-testid": dataTestId, className: cvaWidgetBodyDensityContainer({ density, disableGap, className }), children: children }));
21566
+ };
21567
+
21529
21568
  const cvaClickable = cvaMerge([
21530
21569
  "shadow-lg",
21531
21570
  "rounded-lg",
@@ -39197,4 +39236,4 @@ const useVisibilityChange = ({ onChange, targetState }) => {
39197
39236
  }, [onChange, targetState]);
39198
39237
  };
39199
39238
 
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 };
39239
+ 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, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.174",
3
+ "version": "0.1.175",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@floating-ui/react": "0.25.4",
11
11
  "@trackunit/css-class-variance-utilities": "0.0.14",
12
- "@trackunit/css-core": "0.0.96",
12
+ "@trackunit/css-core": "0.0.97",
13
13
  "@trackunit/shared-utils": "0.0.11",
14
14
  "@trackunit/ui-design-tokens": "0.0.78",
15
15
  "@trackunit/ui-icons": "0.0.78",
@@ -0,0 +1,5 @@
1
+ export declare const cvaWidgetBodyDensityContainer: (props?: ({
2
+ disableGap?: boolean | null | undefined;
3
+ direction?: "row" | "row-reverse" | "column" | "column-reverse" | null | undefined;
4
+ density?: "none" | "compact" | "comfortable" | "spacious" | "auto" | null | undefined;
5
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -0,0 +1,25 @@
1
+ import * as React from "react";
2
+ import { CommonProps, Density } from "../../common/CommonProps";
3
+ export interface WidgetBodyProps extends CommonProps {
4
+ /**
5
+ * Sets gap, padding and margin.
6
+ */
7
+ density?: Density;
8
+ /**
9
+ * Set gap to be 0px (not preferable)
10
+ */
11
+ disableGap?: boolean;
12
+ /**
13
+ * Child elements to render in the body
14
+ */
15
+ children: React.ReactNode | null;
16
+ }
17
+ /**
18
+ * The WidgetBody component should be used to inform the user of important information.
19
+ *
20
+ * @summary For applying padding and gap to a Widget.
21
+ * @description The padding must live here, and not on the Widget itself, as to not inset the scrollbar in case of overflow
22
+ * @param {WidgetBodyProps} props - The props for the WidgetBody component
23
+ * @returns {JSX.Element} WidgetBody component
24
+ */
25
+ export declare const WidgetBody: ({ density, children, dataTestId, className, disableGap }: WidgetBodyProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./WidgetBody";
@@ -28,4 +28,5 @@ export * from "./Timeline/Timeline";
28
28
  export * from "./Tip";
29
29
  export * from "./Tooltip";
30
30
  export * from "./ValueBar";
31
+ export * from "./Widget";
31
32
  export * from "./buttons";