@trackunit/react-table-base-components 0.0.401 → 0.0.403

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
@@ -93,6 +93,21 @@ const LinkCell = ({ link, type, ...rest }) => {
93
93
  return (jsxRuntime.jsx(reactComponents.ExternalLink, { href: `${linkPrefix}${link}`, ...rest, onClick: handleClick, children: link }));
94
94
  };
95
95
 
96
+ const cvaMultiRowTableCellSection = cssClassVarianceUtilities.cvaMerge(["flex", "flex-col", "justify-center", "overflow-hidden"]);
97
+ const cvaMultiRowTableCell = cssClassVarianceUtilities.cvaMerge(["flex", "justify-start", "pl-2"]);
98
+ const cvaMainRowText = cssClassVarianceUtilities.cvaMerge(["overflow-hidden", "text-ellipsis", "font-semibold"]);
99
+ const cvaSecondaryRowText = cssClassVarianceUtilities.cvaMerge(["overflow-hidden", "text-ellipsis", "text-neutral-400"]);
100
+
101
+ /**
102
+ * The MultiRowTableCell component helps to display two rows inside a table cell.
103
+ *
104
+ * @param {MultiRowTableCellProps} props - The props for the MultiRowTableCell component
105
+ * @returns {JSX.Element} MultiRowTableCell component
106
+ */
107
+ const MultiRowTableCell = ({ main, secondary, dataTestId }) => {
108
+ return (jsxRuntime.jsx("div", { className: cvaMultiRowTableCell(), children: jsxRuntime.jsxs("section", { className: cvaMultiRowTableCellSection(), "data-testid": dataTestId, children: [typeof main === "string" ? jsxRuntime.jsx("div", { className: cvaMainRowText(), children: main }) : main, secondary && typeof secondary === "string" ? (jsxRuntime.jsx("div", { className: cvaSecondaryRowText(), children: secondary })) : (secondary)] }) }));
109
+ };
110
+
96
111
  const cvaMultiValueTextCellWrapper = cssClassVarianceUtilities.cvaMerge(["flex", "flex-row", "items-center", "gap-1", "overflow-hidden"]);
97
112
  const cvaMultiValueTextCellTooltip = cssClassVarianceUtilities.cvaMerge(["whitespace-no-wrap", "overflow-hidden", "text-ellipsis"]);
98
113
 
@@ -420,6 +435,7 @@ exports.DateTimeCell = DateTimeCell;
420
435
  exports.ImageCell = ImageCell;
421
436
  exports.IndicatorCell = IndicatorCell;
422
437
  exports.LinkCell = LinkCell;
438
+ exports.MultiRowTableCell = MultiRowTableCell;
423
439
  exports.MultiValueTextCell = MultiValueTextCell;
424
440
  exports.NoticeCell = NoticeCell;
425
441
  exports.NumberCell = NumberCell;
package/index.esm.js CHANGED
@@ -91,6 +91,21 @@ const LinkCell = ({ link, type, ...rest }) => {
91
91
  return (jsx(ExternalLink, { href: `${linkPrefix}${link}`, ...rest, onClick: handleClick, children: link }));
92
92
  };
93
93
 
94
+ const cvaMultiRowTableCellSection = cvaMerge(["flex", "flex-col", "justify-center", "overflow-hidden"]);
95
+ const cvaMultiRowTableCell = cvaMerge(["flex", "justify-start", "pl-2"]);
96
+ const cvaMainRowText = cvaMerge(["overflow-hidden", "text-ellipsis", "font-semibold"]);
97
+ const cvaSecondaryRowText = cvaMerge(["overflow-hidden", "text-ellipsis", "text-neutral-400"]);
98
+
99
+ /**
100
+ * The MultiRowTableCell component helps to display two rows inside a table cell.
101
+ *
102
+ * @param {MultiRowTableCellProps} props - The props for the MultiRowTableCell component
103
+ * @returns {JSX.Element} MultiRowTableCell component
104
+ */
105
+ const MultiRowTableCell = ({ main, secondary, dataTestId }) => {
106
+ return (jsx("div", { className: cvaMultiRowTableCell(), children: jsxs("section", { className: cvaMultiRowTableCellSection(), "data-testid": dataTestId, children: [typeof main === "string" ? jsx("div", { className: cvaMainRowText(), children: main }) : main, secondary && typeof secondary === "string" ? (jsx("div", { className: cvaSecondaryRowText(), children: secondary })) : (secondary)] }) }));
107
+ };
108
+
94
109
  const cvaMultiValueTextCellWrapper = cvaMerge(["flex", "flex-row", "items-center", "gap-1", "overflow-hidden"]);
95
110
  const cvaMultiValueTextCellTooltip = cvaMerge(["whitespace-no-wrap", "overflow-hidden", "text-ellipsis"]);
96
111
 
@@ -412,4 +427,4 @@ const cvaTr = cvaMerge(["border-b", "border-neutral-300", "w-full", "h-max"], {
412
427
  },
413
428
  });
414
429
 
415
- export { ButtonCell, CheckboxCell, DateTimeCell, ImageCell, IndicatorCell, LinkCell, MultiValueTextCell, NoticeCell, NumberCell, PlainDateCell, ResizeHandle, SortIndicator, TableRoot, TagsCell, Tbody, Td, TextCell, Tfoot, Th, Thead, Tr };
430
+ export { ButtonCell, CheckboxCell, DateTimeCell, ImageCell, IndicatorCell, LinkCell, MultiRowTableCell, MultiValueTextCell, NoticeCell, NumberCell, PlainDateCell, ResizeHandle, SortIndicator, TableRoot, TagsCell, Tbody, Td, TextCell, Tfoot, Th, Thead, Tr };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table-base-components",
3
- "version": "0.0.401",
3
+ "version": "0.0.403",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -0,0 +1,18 @@
1
+ import { CommonProps } from "@trackunit/react-components";
2
+ export interface MultiRowTableCellProps extends CommonProps {
3
+ /**
4
+ * Main row of the cell.
5
+ */
6
+ main: React.ReactNode;
7
+ /**
8
+ * Secondary row of the cell rendered below the main row.
9
+ */
10
+ secondary: React.ReactNode;
11
+ }
12
+ /**
13
+ * The MultiRowTableCell component helps to display two rows inside a table cell.
14
+ *
15
+ * @param {MultiRowTableCellProps} props - The props for the MultiRowTableCell component
16
+ * @returns {JSX.Element} MultiRowTableCell component
17
+ */
18
+ export declare const MultiRowTableCell: ({ main, secondary, dataTestId }: MultiRowTableCellProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { MultiRowTableCell } from "./MultiRowTableCell";
3
+ type Story = StoryObj<typeof MultiRowTableCell>;
4
+ declare const meta: Meta<typeof MultiRowTableCell>;
5
+ export default meta;
6
+ export declare const packageName: () => import("react/jsx-runtime").JSX.Element;
7
+ export declare const Default: Story;
8
+ export declare const Variants: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare const cvaMultiRowTableCellSection: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
+ export declare const cvaMultiRowTableCell: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
3
+ export declare const cvaMainRowText: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
4
+ export declare const cvaSecondaryRowText: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -0,0 +1 @@
1
+ export * from "./MultiRowTableCell";
package/src/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from "./components/DateTimeCell/DateTimeCell";
4
4
  export * from "./components/ImageCell/ImageCell";
5
5
  export * from "./components/IndicatorCell/IndicatorCell";
6
6
  export * from "./components/LinkCell/LinkCell";
7
+ export * from "./components/MultiRowTableCell/MultiRowTableCell";
7
8
  export * from "./components/MultiValueTextCell/MultiValueTextCell";
8
9
  export * from "./components/NoticeCell/NoticeCell";
9
10
  export * from "./components/NumberCell/NumberCell";