@trackunit/react-table-base-components 1.3.39 → 1.3.40

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
@@ -59,6 +59,52 @@ const TimeSince = ({ date, timeZone, locale }) => {
59
59
  }
60
60
  };
61
61
 
62
+ const cvaIdentityCell = cssClassVarianceUtilities.cvaMerge(["grid", "items-center", "text-sm"], {
63
+ variants: {
64
+ hasThumbnail: {
65
+ true: "grid-cols-[min-content_1fr]",
66
+ false: "grid-cols-[1fr]",
67
+ },
68
+ density: {
69
+ default: "gap-2",
70
+ compact: "gap-2",
71
+ },
72
+ },
73
+ defaultVariants: {
74
+ density: "default",
75
+ },
76
+ });
77
+ const cvaIdentityCellLayout = cssClassVarianceUtilities.cvaMerge(["grid", "items-center", "gap-2", "text-sm"], {
78
+ variants: {
79
+ density: {
80
+ default: "grid-rows-[min-content_auto]",
81
+ compact: "grid-cols-[min-content_auto]",
82
+ },
83
+ },
84
+ defaultVariants: {
85
+ density: "default",
86
+ },
87
+ });
88
+ const cvaIdentityCellDetails = cssClassVarianceUtilities.cvaMerge(["flex", "w-full", "min-w-0", "items-center", "truncate", "text-xs", "text-gray-500"], {
89
+ variants: {
90
+ density: {
91
+ default: "pt-0",
92
+ compact: "pt-1",
93
+ },
94
+ },
95
+ });
96
+ const cvaIdentityCellDetailsItem = cssClassVarianceUtilities.cvaMerge(["last:truncate"]);
97
+
98
+ /**
99
+ * The IdentityCell is used for render an identity in a table cell
100
+ *
101
+ * @param {IdentityCellProps} props - The props for the LinkCell component
102
+ * @returns {ReactElement} LinkCell component
103
+ */
104
+ const IdentityCell = ({ className, dataTestId = "identity-cell", density = "default", title, details = [], thumbnail, }) => {
105
+ return (jsxRuntime.jsxs("div", { className: cvaIdentityCell({ className, density, hasThumbnail: !!thumbnail }), "data-testid": dataTestId, children: [thumbnail ? jsxRuntime.jsx("div", { className: "flex h-8 w-8 items-center justify-center pr-2", children: thumbnail }) : null, jsxRuntime.jsxs("div", { className: cvaIdentityCellLayout({ className, density }), children: [jsxRuntime.jsx("div", { className: "flex w-full min-w-0 truncate text-sm", children: jsxRuntime.jsx(reactComponents.Heading, { className: "truncate", dataTestId: `${dataTestId}-name`, variant: "tertiary", children: title }) }), details.length > 0 && (jsxRuntime.jsx("div", { className: cvaIdentityCellDetails({ className, density }), children: details.map((value, index, array) => (jsxRuntime.jsxs(react.Fragment, { children: [jsxRuntime.jsx("span", { className: cvaIdentityCellDetailsItem({ className }), children: value }), index < array.length - 1 && (jsxRuntime.jsx("div", { className: "mx-0.5 flex items-center", children: jsxRuntime.jsx(reactComponents.Icon, { className: "w-4 text-neutral-200", color: "neutral", name: "Slash", size: "small" }) }))] }, index))) }))] })] }));
106
+ };
107
+
62
108
  /**
63
109
  * The `<ImageCell>` component is used for displaying images in a table cell.
64
110
  *
@@ -432,6 +478,7 @@ const cvaTr = cssClassVarianceUtilities.cvaMerge(["border-b", "border-neutral-30
432
478
  exports.ButtonCell = ButtonCell;
433
479
  exports.CheckboxCell = CheckboxCell;
434
480
  exports.DateTimeCell = DateTimeCell;
481
+ exports.IdentityCell = IdentityCell;
435
482
  exports.ImageCell = ImageCell;
436
483
  exports.IndicatorCell = IndicatorCell;
437
484
  exports.LinkCell = LinkCell;
package/index.esm.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Button, Icon, Indicator, ExternalLink, Tooltip, Tag, Notice } from '@trackunit/react-components';
2
+ import { Button, Icon, Heading, Indicator, ExternalLink, Tooltip, Tag, Notice } from '@trackunit/react-components';
3
3
  import { Checkbox } from '@trackunit/react-form-components';
4
4
  import { cvaMerge } from '@trackunit/css-class-variance-utilities';
5
5
  import { formatDateUtil, timeSinceAuto, timeSinceInDays } from '@trackunit/date-and-time-utils';
6
- import { useState, useEffect } from 'react';
6
+ import { Fragment, useState, useEffect } from 'react';
7
7
  import { Temporal } from '@js-temporal/polyfill';
8
8
  import { DateTimeFormat } from '@trackunit/shared-utils';
9
9
 
@@ -57,6 +57,52 @@ const TimeSince = ({ date, timeZone, locale }) => {
57
57
  }
58
58
  };
59
59
 
60
+ const cvaIdentityCell = cvaMerge(["grid", "items-center", "text-sm"], {
61
+ variants: {
62
+ hasThumbnail: {
63
+ true: "grid-cols-[min-content_1fr]",
64
+ false: "grid-cols-[1fr]",
65
+ },
66
+ density: {
67
+ default: "gap-2",
68
+ compact: "gap-2",
69
+ },
70
+ },
71
+ defaultVariants: {
72
+ density: "default",
73
+ },
74
+ });
75
+ const cvaIdentityCellLayout = cvaMerge(["grid", "items-center", "gap-2", "text-sm"], {
76
+ variants: {
77
+ density: {
78
+ default: "grid-rows-[min-content_auto]",
79
+ compact: "grid-cols-[min-content_auto]",
80
+ },
81
+ },
82
+ defaultVariants: {
83
+ density: "default",
84
+ },
85
+ });
86
+ const cvaIdentityCellDetails = cvaMerge(["flex", "w-full", "min-w-0", "items-center", "truncate", "text-xs", "text-gray-500"], {
87
+ variants: {
88
+ density: {
89
+ default: "pt-0",
90
+ compact: "pt-1",
91
+ },
92
+ },
93
+ });
94
+ const cvaIdentityCellDetailsItem = cvaMerge(["last:truncate"]);
95
+
96
+ /**
97
+ * The IdentityCell is used for render an identity in a table cell
98
+ *
99
+ * @param {IdentityCellProps} props - The props for the LinkCell component
100
+ * @returns {ReactElement} LinkCell component
101
+ */
102
+ const IdentityCell = ({ className, dataTestId = "identity-cell", density = "default", title, details = [], thumbnail, }) => {
103
+ return (jsxs("div", { className: cvaIdentityCell({ className, density, hasThumbnail: !!thumbnail }), "data-testid": dataTestId, children: [thumbnail ? jsx("div", { className: "flex h-8 w-8 items-center justify-center pr-2", children: thumbnail }) : null, jsxs("div", { className: cvaIdentityCellLayout({ className, density }), children: [jsx("div", { className: "flex w-full min-w-0 truncate text-sm", children: jsx(Heading, { className: "truncate", dataTestId: `${dataTestId}-name`, variant: "tertiary", children: title }) }), details.length > 0 && (jsx("div", { className: cvaIdentityCellDetails({ className, density }), children: details.map((value, index, array) => (jsxs(Fragment, { children: [jsx("span", { className: cvaIdentityCellDetailsItem({ className }), children: value }), index < array.length - 1 && (jsx("div", { className: "mx-0.5 flex items-center", children: jsx(Icon, { className: "w-4 text-neutral-200", color: "neutral", name: "Slash", size: "small" }) }))] }, index))) }))] })] }));
104
+ };
105
+
60
106
  /**
61
107
  * The `<ImageCell>` component is used for displaying images in a table cell.
62
108
  *
@@ -427,4 +473,4 @@ const cvaTr = cvaMerge(["border-b", "border-neutral-300", "w-full", "h-max"], {
427
473
  },
428
474
  });
429
475
 
430
- export { ButtonCell, CheckboxCell, DateTimeCell, ImageCell, IndicatorCell, LinkCell, MultiRowTableCell, MultiValueTextCell, NoticeCell, NumberCell, PlainDateCell, ResizeHandle, SortIndicator, TableRoot, TagsCell, Tbody, Td, TextCell, Tfoot, Th, Thead, Tr };
476
+ export { ButtonCell, CheckboxCell, DateTimeCell, IdentityCell, 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": "1.3.39",
3
+ "version": "1.3.40",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,12 +9,12 @@
9
9
  "dependencies": {
10
10
  "react": "19.0.0",
11
11
  "@js-temporal/polyfill": "^0.4.4",
12
- "@trackunit/react-components": "1.4.33",
13
- "@trackunit/ui-icons": "1.3.32",
14
- "@trackunit/react-form-components": "1.3.39",
15
- "@trackunit/css-class-variance-utilities": "1.3.32",
16
- "@trackunit/date-and-time-utils": "1.3.32",
17
- "@trackunit/shared-utils": "1.5.32"
12
+ "@trackunit/react-components": "1.4.34",
13
+ "@trackunit/ui-icons": "1.3.33",
14
+ "@trackunit/react-form-components": "1.3.40",
15
+ "@trackunit/css-class-variance-utilities": "1.3.33",
16
+ "@trackunit/date-and-time-utils": "1.3.33",
17
+ "@trackunit/shared-utils": "1.5.33"
18
18
  },
19
19
  "module": "./index.esm.js",
20
20
  "main": "./index.cjs.js",
@@ -0,0 +1,17 @@
1
+ import { CommonProps } from "@trackunit/react-components";
2
+ import { ReactElement, ReactNode } from "react";
3
+ export interface IdentityCellProps extends CommonProps {
4
+ className?: string;
5
+ dataTestId?: string;
6
+ density?: "compact" | "default";
7
+ title?: string;
8
+ details?: string[];
9
+ thumbnail?: ReactNode;
10
+ }
11
+ /**
12
+ * The IdentityCell is used for render an identity in a table cell
13
+ *
14
+ * @param {IdentityCellProps} props - The props for the LinkCell component
15
+ * @returns {ReactElement} LinkCell component
16
+ */
17
+ export declare const IdentityCell: ({ className, dataTestId, density, title, details, thumbnail, }: IdentityCellProps) => ReactElement;
@@ -0,0 +1,7 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { IdentityCell } from "./IdentityCell";
3
+ type Story = StoryObj<typeof IdentityCell>;
4
+ declare const meta: Meta<typeof IdentityCell>;
5
+ export default meta;
6
+ export declare const packageName: () => import("react/jsx-runtime").JSX.Element;
7
+ export declare const Default: Story;
@@ -0,0 +1,11 @@
1
+ export declare const cvaIdentityCell: (props?: ({
2
+ hasThumbnail?: boolean | null | undefined;
3
+ density?: "default" | "compact" | null | undefined;
4
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
5
+ export declare const cvaIdentityCellLayout: (props?: ({
6
+ density?: "default" | "compact" | null | undefined;
7
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
8
+ export declare const cvaIdentityCellDetails: (props?: ({
9
+ density?: "default" | "compact" | null | undefined;
10
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
11
+ export declare const cvaIdentityCellDetailsItem: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
package/src/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./components/ButtonCell/ButtonCell";
2
2
  export * from "./components/CheckboxCell/CheckboxCell";
3
3
  export * from "./components/DateTimeCell/DateTimeCell";
4
+ export * from "./components/IdentityCell/IdentityCell";
4
5
  export * from "./components/ImageCell/ImageCell";
5
6
  export * from "./components/IndicatorCell/IndicatorCell";
6
7
  export * from "./components/LinkCell/LinkCell";