@trackunit/react-widgets 2.2.8 → 2.2.10

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
@@ -99,95 +99,41 @@ const WidgetNoData = ({ type = "Neutral", description }) => {
99
99
  return (jsxRuntime.jsx("div", { className: "flex h-full w-full flex-col items-center justify-center", children: jsxRuntime.jsx(reactComponents.EmptyState, { customImageSrc: type === "Good" ? widgetNoDataGood : widgetNoDataNeutral, description: description }) }));
100
100
  };
101
101
 
102
- const cvaHorizontalWidgetLayoutContainer = cssClassVarianceUtilities.cvaMerge(["flex", "h-dvh", "flex-col", "overflow-auto"], {
102
+ const cvaWidgetContent = cssClassVarianceUtilities.cvaMerge(["@container", "overflow-hidden", "h-full", "w-full", "bg-white", "grid"], {
103
103
  variants: {
104
- isScrolled: {
105
- true: ["border-t"],
104
+ layout: {
105
+ none: "",
106
+ centered: "place-items-center",
107
+ "top-fill": ["grid-rows-min-fr"],
108
+ "fill-bottom": ["grid-rows-fr-min"],
109
+ "top-fill-bottom": ["grid-rows-min-fr-min"],
106
110
  },
107
- },
108
- });
109
- const cvaHorizontalChildFragment = cssClassVarianceUtilities.cvaMerge(["h-px", "w-full", "min-w-px", "bg-slate-200"]);
110
-
111
- /**
112
- * Widget layout with a horizontal orientation with a border in the top when scrolling.
113
- *
114
- * @param { HorizontalWidgetLayoutProps} props - The props for the component
115
- * @returns {Element} HorizontalWidgetLayout component
116
- */
117
- const HorizontalWidgetLayout = ({ className, dataTestId, children, ref }) => {
118
- const childrenArray = React.Children.toArray(children);
119
- const { isAtTop } = reactComponents.useScrollDetection(ref);
120
- return (jsxRuntime.jsx("div", { className: cvaHorizontalWidgetLayoutContainer({ className, isScrolled: !isAtTop }), "data-testid": dataTestId, ref: ref, children: childrenArray.map((child, index) => (jsxRuntime.jsxs(React.Fragment, { children: [child, index < childrenArray.length - 1 && jsxRuntime.jsx("div", { className: cvaHorizontalChildFragment() })] }, index))) }));
121
- };
122
-
123
- const cvaVerticalSplitWidgetLayoutContainer = cssClassVarianceUtilities.cvaMerge([
124
- "flex",
125
- "w-full",
126
- "flex-row",
127
- "overflow-hidden",
128
- "no-scrollbar",
129
- "h-20",
130
- "gap-2",
131
- "overflow-x-scroll",
132
- "px-2",
133
- "py-4"
134
- ]);
135
- cssClassVarianceUtilities.cvaMerge(["h-full", "w-px", "min-h-px", "bg-slate-200"]);
136
-
137
- /**
138
- * Widget layout with a vertical split
139
- *
140
- * @param { VerticalSplitWidgetLayoutProps} props - The props for the component
141
- * @returns {Element} VerticalSplitWidgetLayout component
142
- */
143
- const VerticalSplitWidgetLayout = ({ className, dataTestId, children }) => {
144
- const childrenArray = React.Children.toArray(children);
145
- return (jsxRuntime.jsx("div", { className: cvaVerticalSplitWidgetLayoutContainer({ className }), "data-testid": dataTestId, children: childrenArray.map((child, index) => (jsxRuntime.jsx(React.Fragment, { children: child }, index))) }));
146
- };
147
-
148
- const cvaWidgetBodyDensityContainer = cssClassVarianceUtilities.cvaMerge([
149
- "@container",
150
- "flex",
151
- "flex-grow",
152
- "overflow-auto",
153
- "w-full",
154
- "h-dvh",
155
- "place-items-center",
156
- "bg-white",
157
- "overflow-hidden",
158
- ], {
159
- variants: {
160
- direction: {
161
- row: "flex-row",
162
- "row-reverse": "flex-row-reverse",
163
- column: "flex-col",
164
- "column-reverse": "flex-col-reverse",
111
+ gap: {
112
+ responsive: "gap-responsive-space",
113
+ none: "",
165
114
  },
166
- density: {
115
+ padding: {
116
+ responsive: "p-responsive-space",
167
117
  none: "",
168
- dense: "gap-1 p-2",
169
- compact: "gap-3 p-3",
170
- comfortable: "gap-4 p-4",
171
- spacious: "gap-4 p-6",
172
- auto: "gap-2 p-4 pt-2",
173
118
  },
174
119
  },
175
120
  defaultVariants: {
176
- direction: "column",
177
- density: "auto",
121
+ layout: "none",
122
+ gap: "none",
123
+ padding: "none",
178
124
  },
179
125
  });
180
126
 
181
127
  /**
182
- * The WidgetBody component should be used to inform the user of important information.
128
+ * The WidgetContent component should be used to inform the user of important information.
183
129
  *
184
130
  * @summary For applying padding and gap to a Widget.
185
131
  * @description The padding must live here, and not on the Widget itself, as to not inset the scrollbar in case of overflow
186
- * @param {WidgetBodyProps} props - The props for the WidgetBody component
187
- * @returns {ReactNode} WidgetBody component
132
+ * @param {WidgetContentProps} props - The props for the WidgetContent component
133
+ * @returns {ReactNode} WidgetContent component
188
134
  */
189
- const WidgetBody = ({ density = "auto", children, dataTestId, className, direction = "column", }) => {
190
- return (jsxRuntime.jsx("div", { className: cvaWidgetBodyDensityContainer({ density, className, direction }), "data-testid": dataTestId, children: children }));
135
+ const WidgetContent = ({ children, dataTestId, layout = "none", padding = "none", gap = "none", className, }) => {
136
+ return (jsxRuntime.jsx("div", { className: cvaWidgetContent({ layout, padding, gap, className }), "data-testid": dataTestId, children: children }));
191
137
  };
192
138
 
193
139
  const cvaWidgetEditBodyDensityContainer = cssClassVarianceUtilities.cvaMerge(["absolute", "left-1/2", "top-1/2", "flex", "origin-center", "-translate-x-1/2", "-translate-y-1/2", "w-96"], {
@@ -219,9 +165,9 @@ const cvaWidgetEditBodyDensityContainer = cssClassVarianceUtilities.cvaMerge(["a
219
165
  *
220
166
  * @summary For editing a Widget.
221
167
  * @param {WidgetEditBodyProps} props - The props for the WidgetEditBody component
222
- * @returns {ReactNode} WidgetBody component
168
+ * @returns {ReactNode} WidgetEditBody component
223
169
  */
224
- const WidgetEditBody = ({ children, dataTestId, className, onCancel, onSave, saveEditModeDisabled, title, }) => {
170
+ const WidgetEditBody = ({ children, dataTestId, className, onCancel, onSave, saveEditModeDisabled = false, title, }) => {
225
171
  const [t] = useTranslation();
226
172
  const [saving, setSaving] = React.useState(false);
227
173
  return (jsxRuntime.jsxs(reactComponents.Card, { className: cvaWidgetEditBodyDensityContainer({ density: "none", className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(reactComponents.CardHeader, { density: "comfortable", heading: title || t("widget.edit.title"), onClose: onCancel }), jsxRuntime.jsx(reactComponents.CardBody, { density: "comfortable", children: children }), jsxRuntime.jsxs(reactComponents.CardFooter, { density: "comfortable", children: [jsxRuntime.jsx(reactComponents.Button, { onClick: onCancel, variant: "ghost-neutral", children: t("widget.edit.cancel") }), jsxRuntime.jsx(reactComponents.Button, { disabled: saveEditModeDisabled || saving, loading: saving, onClick: () => {
@@ -315,21 +261,6 @@ const TrendIndicator = ({ trend, unit, isSmallVariant }) => {
315
261
  return (jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-0.5 overflow-hidden", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxRuntime.jsxs(reactComponents.Text, { className: cvaWidgetKPITrendValueText(), dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, trend.variant?.icon ? jsxRuntime.jsx(reactComponents.Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxRuntime.jsxs(reactComponents.Text, { className: cvaWidgetKPITrendPercentage({ color: trend.variant?.color }), children: [trend.percentage, "%"] })) : null] }));
316
262
  };
317
263
 
318
- const cvaWidgetList = cssClassVarianceUtilities.cvaMerge(["min-h-0"]);
319
- const cvaWidgetListList = cssClassVarianceUtilities.cvaMerge(["w-full"]);
320
-
321
- /**
322
- * WidgetList used for rendering a list of in a widget. It is a wrapper component for the ListItem components.
323
- *
324
- * @param { WidgetListProps} props - The props for the WidgetList component
325
- * @returns {Element} WidgetList component
326
- */
327
- const WidgetList = ({ dataTestId, pagination, count, children, className, rowHeight = 56, scrollRef, }) => {
328
- return (jsxRuntime.jsx("div", { className: cvaWidgetList({ className }), children: jsxRuntime.jsx(reactComponents.List, { className: cvaWidgetListList(), count: count, dataTestId: dataTestId, loadingIndicator: "skeletonLines", pagination: pagination, rowHeight: rowHeight, scrollRef: scrollRef, separator: "line", skeletonLinesHeight: `${rowHeight / 3}px`, children: index => {
329
- return children(index);
330
- } }) }));
331
- };
332
-
333
264
  /*
334
265
  * ----------------------------
335
266
  * | SETUP TRANSLATIONS START |
@@ -339,12 +270,9 @@ const WidgetList = ({ dataTestId, pagination, count, children, className, rowHei
339
270
  */
340
271
  setupLibraryTranslations();
341
272
 
342
- exports.HorizontalWidgetLayout = HorizontalWidgetLayout;
343
- exports.VerticalSplitWidgetLayout = VerticalSplitWidgetLayout;
344
- exports.WidgetBody = WidgetBody;
273
+ exports.WidgetContent = WidgetContent;
345
274
  exports.WidgetEditBody = WidgetEditBody;
346
275
  exports.WidgetError = WidgetError;
347
276
  exports.WidgetKPI = WidgetKPI;
348
- exports.WidgetList = WidgetList;
349
277
  exports.WidgetMissingConfiguration = WidgetMissingConfiguration;
350
278
  exports.WidgetNoData = WidgetNoData;
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { registerTranslations, useNamespaceTranslation } from '@trackunit/i18n-library-translation';
3
- import { EmptyState, useScrollDetection, Card, CardHeader, CardBody, CardFooter, Button, SkeletonLines, Icon, Tooltip, Text, List } from '@trackunit/react-components';
4
- import { Children, Fragment, useState } from 'react';
3
+ import { EmptyState, Card, CardHeader, CardBody, CardFooter, Button, SkeletonLines, Icon, Tooltip, Text } from '@trackunit/react-components';
4
+ import { useState } from 'react';
5
5
  import { WidgetConfigRuntime } from '@trackunit/iris-app-runtime-core';
6
6
  import { cvaMerge } from '@trackunit/css-class-variance-utilities';
7
7
 
@@ -97,95 +97,41 @@ const WidgetNoData = ({ type = "Neutral", description }) => {
97
97
  return (jsx("div", { className: "flex h-full w-full flex-col items-center justify-center", children: jsx(EmptyState, { customImageSrc: type === "Good" ? widgetNoDataGood : widgetNoDataNeutral, description: description }) }));
98
98
  };
99
99
 
100
- const cvaHorizontalWidgetLayoutContainer = cvaMerge(["flex", "h-dvh", "flex-col", "overflow-auto"], {
100
+ const cvaWidgetContent = cvaMerge(["@container", "overflow-hidden", "h-full", "w-full", "bg-white", "grid"], {
101
101
  variants: {
102
- isScrolled: {
103
- true: ["border-t"],
102
+ layout: {
103
+ none: "",
104
+ centered: "place-items-center",
105
+ "top-fill": ["grid-rows-min-fr"],
106
+ "fill-bottom": ["grid-rows-fr-min"],
107
+ "top-fill-bottom": ["grid-rows-min-fr-min"],
104
108
  },
105
- },
106
- });
107
- const cvaHorizontalChildFragment = cvaMerge(["h-px", "w-full", "min-w-px", "bg-slate-200"]);
108
-
109
- /**
110
- * Widget layout with a horizontal orientation with a border in the top when scrolling.
111
- *
112
- * @param { HorizontalWidgetLayoutProps} props - The props for the component
113
- * @returns {Element} HorizontalWidgetLayout component
114
- */
115
- const HorizontalWidgetLayout = ({ className, dataTestId, children, ref }) => {
116
- const childrenArray = Children.toArray(children);
117
- const { isAtTop } = useScrollDetection(ref);
118
- return (jsx("div", { className: cvaHorizontalWidgetLayoutContainer({ className, isScrolled: !isAtTop }), "data-testid": dataTestId, ref: ref, children: childrenArray.map((child, index) => (jsxs(Fragment, { children: [child, index < childrenArray.length - 1 && jsx("div", { className: cvaHorizontalChildFragment() })] }, index))) }));
119
- };
120
-
121
- const cvaVerticalSplitWidgetLayoutContainer = cvaMerge([
122
- "flex",
123
- "w-full",
124
- "flex-row",
125
- "overflow-hidden",
126
- "no-scrollbar",
127
- "h-20",
128
- "gap-2",
129
- "overflow-x-scroll",
130
- "px-2",
131
- "py-4"
132
- ]);
133
- cvaMerge(["h-full", "w-px", "min-h-px", "bg-slate-200"]);
134
-
135
- /**
136
- * Widget layout with a vertical split
137
- *
138
- * @param { VerticalSplitWidgetLayoutProps} props - The props for the component
139
- * @returns {Element} VerticalSplitWidgetLayout component
140
- */
141
- const VerticalSplitWidgetLayout = ({ className, dataTestId, children }) => {
142
- const childrenArray = Children.toArray(children);
143
- return (jsx("div", { className: cvaVerticalSplitWidgetLayoutContainer({ className }), "data-testid": dataTestId, children: childrenArray.map((child, index) => (jsx(Fragment, { children: child }, index))) }));
144
- };
145
-
146
- const cvaWidgetBodyDensityContainer = cvaMerge([
147
- "@container",
148
- "flex",
149
- "flex-grow",
150
- "overflow-auto",
151
- "w-full",
152
- "h-dvh",
153
- "place-items-center",
154
- "bg-white",
155
- "overflow-hidden",
156
- ], {
157
- variants: {
158
- direction: {
159
- row: "flex-row",
160
- "row-reverse": "flex-row-reverse",
161
- column: "flex-col",
162
- "column-reverse": "flex-col-reverse",
109
+ gap: {
110
+ responsive: "gap-responsive-space",
111
+ none: "",
163
112
  },
164
- density: {
113
+ padding: {
114
+ responsive: "p-responsive-space",
165
115
  none: "",
166
- dense: "gap-1 p-2",
167
- compact: "gap-3 p-3",
168
- comfortable: "gap-4 p-4",
169
- spacious: "gap-4 p-6",
170
- auto: "gap-2 p-4 pt-2",
171
116
  },
172
117
  },
173
118
  defaultVariants: {
174
- direction: "column",
175
- density: "auto",
119
+ layout: "none",
120
+ gap: "none",
121
+ padding: "none",
176
122
  },
177
123
  });
178
124
 
179
125
  /**
180
- * The WidgetBody component should be used to inform the user of important information.
126
+ * The WidgetContent component should be used to inform the user of important information.
181
127
  *
182
128
  * @summary For applying padding and gap to a Widget.
183
129
  * @description The padding must live here, and not on the Widget itself, as to not inset the scrollbar in case of overflow
184
- * @param {WidgetBodyProps} props - The props for the WidgetBody component
185
- * @returns {ReactNode} WidgetBody component
130
+ * @param {WidgetContentProps} props - The props for the WidgetContent component
131
+ * @returns {ReactNode} WidgetContent component
186
132
  */
187
- const WidgetBody = ({ density = "auto", children, dataTestId, className, direction = "column", }) => {
188
- return (jsx("div", { className: cvaWidgetBodyDensityContainer({ density, className, direction }), "data-testid": dataTestId, children: children }));
133
+ const WidgetContent = ({ children, dataTestId, layout = "none", padding = "none", gap = "none", className, }) => {
134
+ return (jsx("div", { className: cvaWidgetContent({ layout, padding, gap, className }), "data-testid": dataTestId, children: children }));
189
135
  };
190
136
 
191
137
  const cvaWidgetEditBodyDensityContainer = cvaMerge(["absolute", "left-1/2", "top-1/2", "flex", "origin-center", "-translate-x-1/2", "-translate-y-1/2", "w-96"], {
@@ -217,9 +163,9 @@ const cvaWidgetEditBodyDensityContainer = cvaMerge(["absolute", "left-1/2", "top
217
163
  *
218
164
  * @summary For editing a Widget.
219
165
  * @param {WidgetEditBodyProps} props - The props for the WidgetEditBody component
220
- * @returns {ReactNode} WidgetBody component
166
+ * @returns {ReactNode} WidgetEditBody component
221
167
  */
222
- const WidgetEditBody = ({ children, dataTestId, className, onCancel, onSave, saveEditModeDisabled, title, }) => {
168
+ const WidgetEditBody = ({ children, dataTestId, className, onCancel, onSave, saveEditModeDisabled = false, title, }) => {
223
169
  const [t] = useTranslation();
224
170
  const [saving, setSaving] = useState(false);
225
171
  return (jsxs(Card, { className: cvaWidgetEditBodyDensityContainer({ density: "none", className }), "data-testid": dataTestId, children: [jsx(CardHeader, { density: "comfortable", heading: title || t("widget.edit.title"), onClose: onCancel }), jsx(CardBody, { density: "comfortable", children: children }), jsxs(CardFooter, { density: "comfortable", children: [jsx(Button, { onClick: onCancel, variant: "ghost-neutral", children: t("widget.edit.cancel") }), jsx(Button, { disabled: saveEditModeDisabled || saving, loading: saving, onClick: () => {
@@ -313,21 +259,6 @@ const TrendIndicator = ({ trend, unit, isSmallVariant }) => {
313
259
  return (jsxs("div", { className: "flex flex-row items-center gap-0.5 overflow-hidden", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxs(Text, { className: cvaWidgetKPITrendValueText(), dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, trend.variant?.icon ? jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxs(Text, { className: cvaWidgetKPITrendPercentage({ color: trend.variant?.color }), children: [trend.percentage, "%"] })) : null] }));
314
260
  };
315
261
 
316
- const cvaWidgetList = cvaMerge(["min-h-0"]);
317
- const cvaWidgetListList = cvaMerge(["w-full"]);
318
-
319
- /**
320
- * WidgetList used for rendering a list of in a widget. It is a wrapper component for the ListItem components.
321
- *
322
- * @param { WidgetListProps} props - The props for the WidgetList component
323
- * @returns {Element} WidgetList component
324
- */
325
- const WidgetList = ({ dataTestId, pagination, count, children, className, rowHeight = 56, scrollRef, }) => {
326
- return (jsx("div", { className: cvaWidgetList({ className }), children: jsx(List, { className: cvaWidgetListList(), count: count, dataTestId: dataTestId, loadingIndicator: "skeletonLines", pagination: pagination, rowHeight: rowHeight, scrollRef: scrollRef, separator: "line", skeletonLinesHeight: `${rowHeight / 3}px`, children: index => {
327
- return children(index);
328
- } }) }));
329
- };
330
-
331
262
  /*
332
263
  * ----------------------------
333
264
  * | SETUP TRANSLATIONS START |
@@ -337,4 +268,4 @@ const WidgetList = ({ dataTestId, pagination, count, children, className, rowHei
337
268
  */
338
269
  setupLibraryTranslations();
339
270
 
340
- export { HorizontalWidgetLayout, VerticalSplitWidgetLayout, WidgetBody, WidgetEditBody, WidgetError, WidgetKPI, WidgetList, WidgetMissingConfiguration, WidgetNoData };
271
+ export { WidgetContent, WidgetEditBody, WidgetError, WidgetKPI, WidgetMissingConfiguration, WidgetNoData };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-widgets",
3
- "version": "2.2.8",
3
+ "version": "2.2.10",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,15 +8,14 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "react": "19.0.0",
11
- "@trackunit/react-components": "1.9.8",
12
- "@trackunit/iris-app-runtime-core": "1.8.6",
13
- "@trackunit/css-class-variance-utilities": "1.7.5",
14
- "@trackunit/ui-design-tokens": "1.7.5",
15
- "@trackunit/ui-icons": "1.7.7",
16
- "@trackunit/react-table-pagination": "1.7.5",
17
- "@trackunit/shared-utils": "1.9.5",
18
- "@trackunit/i18n-library-translation": "1.7.7",
19
- "@trackunit/react-test-setup": "1.4.5"
11
+ "@trackunit/react-components": "1.9.9",
12
+ "@trackunit/iris-app-runtime-core": "1.8.7",
13
+ "@trackunit/css-class-variance-utilities": "1.7.6",
14
+ "@trackunit/ui-design-tokens": "1.7.6",
15
+ "@trackunit/ui-icons": "1.7.8",
16
+ "@trackunit/shared-utils": "1.9.6",
17
+ "@trackunit/i18n-library-translation": "1.7.8",
18
+ "@trackunit/react-test-setup": "1.4.6"
20
19
  },
21
20
  "module": "./index.esm.js",
22
21
  "main": "./index.cjs.js",
@@ -0,0 +1,20 @@
1
+ import { VariantProps } from "@trackunit/css-class-variance-utilities";
2
+ import { CommonProps } from "@trackunit/react-components";
3
+ import { MappedOmit } from "@trackunit/shared-utils";
4
+ import { ReactElement, ReactNode } from "react";
5
+ import { cvaWidgetContent } from "./WidgetContent.variants";
6
+ export interface WidgetContentProps extends CommonProps, MappedOmit<NonNullable<VariantProps<typeof cvaWidgetContent>>, "className"> {
7
+ /**
8
+ * Child elements to render in the body
9
+ */
10
+ children: ReactNode | null;
11
+ }
12
+ /**
13
+ * The WidgetContent component should be used to inform the user of important information.
14
+ *
15
+ * @summary For applying padding and gap to a Widget.
16
+ * @description The padding must live here, and not on the Widget itself, as to not inset the scrollbar in case of overflow
17
+ * @param {WidgetContentProps} props - The props for the WidgetContent component
18
+ * @returns {ReactNode} WidgetContent component
19
+ */
20
+ export declare const WidgetContent: ({ children, dataTestId, layout, padding, gap, className, }: WidgetContentProps) => ReactElement;
@@ -0,0 +1,5 @@
1
+ export declare const cvaWidgetContent: (props?: ({
2
+ layout?: "none" | "centered" | "top-fill" | "fill-bottom" | "top-fill-bottom" | null | undefined;
3
+ gap?: "none" | "responsive" | null | undefined;
4
+ padding?: "none" | "responsive" | null | undefined;
5
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1,5 +1,5 @@
1
1
  import { CommonProps } from "@trackunit/react-components";
2
- import { ReactNode } from "react";
2
+ import { ReactElement, ReactNode } from "react";
3
3
  export interface WidgetEditBodyProps extends CommonProps {
4
4
  /**
5
5
  * Child elements to render in the body
@@ -28,6 +28,6 @@ export interface WidgetEditBodyProps extends CommonProps {
28
28
  *
29
29
  * @summary For editing a Widget.
30
30
  * @param {WidgetEditBodyProps} props - The props for the WidgetEditBody component
31
- * @returns {ReactNode} WidgetBody component
31
+ * @returns {ReactNode} WidgetEditBody component
32
32
  */
33
- export declare const WidgetEditBody: ({ children, dataTestId, className, onCancel, onSave, saveEditModeDisabled, title, }: WidgetEditBodyProps) => import("react/jsx-runtime").JSX.Element;
33
+ export declare const WidgetEditBody: ({ children, dataTestId, className, onCancel, onSave, saveEditModeDisabled, title, }: WidgetEditBodyProps) => ReactElement;
package/src/index.d.ts CHANGED
@@ -1,9 +1,6 @@
1
1
  export * from "./EmptyStates/Error/WidgetError";
2
2
  export * from "./EmptyStates/MissingConfiguration/WidgetMissingConfiguration";
3
3
  export * from "./EmptyStates/NoData/WidgetNoData";
4
- export * from "./HorizontalWidgetLayout/HorizontalWidgetLayout";
5
- export * from "./VerticalSplitWidgetLayout/VerticalSplitWidgetLayout";
6
- export * from "./Widget/WidgetBody";
4
+ export * from "./Widget/WidgetContent";
7
5
  export * from "./Widget/WidgetEditBody";
8
6
  export * from "./WidgetKPI/WidgetKPI";
9
- export * from "./WidgetList/WidgetList";
@@ -1,13 +0,0 @@
1
- import { CommonProps } from "@trackunit/react-components";
2
- import { ReactNode, RefObject } from "react";
3
- export interface HorizontalWidgetLayoutProps extends CommonProps {
4
- children: ReactNode;
5
- ref?: RefObject<HTMLDivElement | null>;
6
- }
7
- /**
8
- * Widget layout with a horizontal orientation with a border in the top when scrolling.
9
- *
10
- * @param { HorizontalWidgetLayoutProps} props - The props for the component
11
- * @returns {Element} HorizontalWidgetLayout component
12
- */
13
- export declare const HorizontalWidgetLayout: ({ className, dataTestId, children, ref }: HorizontalWidgetLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +0,0 @@
1
- export declare const cvaHorizontalWidgetLayoutContainer: (props?: ({
2
- isScrolled?: boolean | null | undefined;
3
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
4
- export declare const cvaHorizontalChildFragment: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -1,12 +0,0 @@
1
- import { CommonProps } from "@trackunit/react-components";
2
- import { ReactNode } from "react";
3
- export interface VerticalSplitWidgetLayoutProps extends CommonProps {
4
- children: ReactNode;
5
- }
6
- /**
7
- * Widget layout with a vertical split
8
- *
9
- * @param { VerticalSplitWidgetLayoutProps} props - The props for the component
10
- * @returns {Element} VerticalSplitWidgetLayout component
11
- */
12
- export declare const VerticalSplitWidgetLayout: ({ className, dataTestId, children }: VerticalSplitWidgetLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- export declare const cvaVerticalSplitWidgetLayoutContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
- export declare const cvaVerticalSplitChildFragment: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -1,25 +0,0 @@
1
- import { CommonProps, Density } from "@trackunit/react-components";
2
- import { ReactNode } from "react";
3
- export interface WidgetBodyProps extends CommonProps {
4
- /**
5
- * Sets gap, padding and margin.
6
- */
7
- density?: Density;
8
- /**
9
- * Child elements to render in the body
10
- */
11
- children: ReactNode | null;
12
- /**
13
- * Direction of the body
14
- */
15
- direction?: "row" | "column";
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 {ReactNode} WidgetBody component
24
- */
25
- export declare const WidgetBody: ({ density, children, dataTestId, className, direction, }: WidgetBodyProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +0,0 @@
1
- export declare const cvaWidgetBodyDensityContainer: (props?: ({
2
- direction?: "row" | "row-reverse" | "column" | "column-reverse" | null | undefined;
3
- density?: "none" | "dense" | "compact" | "comfortable" | "spacious" | "auto" | null | undefined;
4
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1,35 +0,0 @@
1
- import { VariantProps } from "@trackunit/css-class-variance-utilities";
2
- import { CommonProps } from "@trackunit/react-components";
3
- import { RelayPagination } from "@trackunit/react-table-pagination";
4
- import { MappedOmit } from "@trackunit/shared-utils";
5
- import { ReactElement, RefObject } from "react";
6
- import { cvaWidgetList } from "./WidgetList.variants";
7
- export interface WidgetListProps extends CommonProps, MappedOmit<VariantProps<typeof cvaWidgetList>, "className"> {
8
- /**
9
- * The number of items in the list.
10
- */
11
- count: number;
12
- /**
13
- * The pagination configuration for the list.
14
- */
15
- pagination: RelayPagination;
16
- /**
17
- * The height of each row in the list, default is 56px.
18
- */
19
- rowHeight?: number;
20
- /**
21
- * The children are used to render the ListItem component for each item in the list.
22
- */
23
- children: (index: number) => ReactElement | null;
24
- /**
25
- * The ref for the scroll container.
26
- */
27
- scrollRef?: RefObject<HTMLDivElement | null>;
28
- }
29
- /**
30
- * WidgetList used for rendering a list of in a widget. It is a wrapper component for the ListItem components.
31
- *
32
- * @param { WidgetListProps} props - The props for the WidgetList component
33
- * @returns {Element} WidgetList component
34
- */
35
- export declare const WidgetList: ({ dataTestId, pagination, count, children, className, rowHeight, scrollRef, }: WidgetListProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- export declare const cvaWidgetList: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
- export declare const cvaWidgetListList: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;