@trackunit/react-table-base-components 0.0.18 → 0.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table-base-components",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,8 +8,10 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@trackunit/css-class-variance-utilities": "0.0.14",
11
+ "@trackunit/date-and-time-utils": "0.0.1",
11
12
  "@trackunit/react-components": "0.1.161",
12
13
  "@trackunit/react-form-components": "0.0.147",
14
+ "@trackunit/ui-design-tokens": "0.0.77",
13
15
  "react": "18.2.0"
14
16
  },
15
17
  "module": "./index.esm.js",
@@ -0,0 +1,42 @@
1
+ import { TemporalFormat } from "@trackunit/date-and-time-utils";
2
+ import { CommonProps } from "@trackunit/react-components";
3
+ export interface DateTimeCellProps extends CommonProps {
4
+ /**
5
+ * The date to render.
6
+ * If not provided, the component will not render.
7
+ */
8
+ date?: Date;
9
+ /**
10
+ * If true, the component will render the time since the date.
11
+ * This is rendered on a separate line.
12
+ *
13
+ * @default true
14
+ */
15
+ withTimeSince?: boolean;
16
+ /**
17
+ * The format to use for the date.
18
+ * If not provided, the component will use the default format.
19
+ * See the formatDateUtil function for more information.
20
+ */
21
+ format?: TemporalFormat;
22
+ /**
23
+ * The time zone to use for the date.
24
+ * See the formatDateUtil function for more information.
25
+ */
26
+ timeZone?: string;
27
+ /**
28
+ * The locale to use for the date.
29
+ * See the formatDateUtil function for more information.
30
+ */
31
+ locale?: string;
32
+ }
33
+ /**
34
+ * DateTimeCell is used for render a date and or time in a table cell.
35
+ *
36
+ * @param {DateTimeCellProps} props - The props for the DateTimeCell component
37
+ * @returns {JSX.Element} DateTimeCell component
38
+ */
39
+ export declare const DateTimeCell: ({ format, timeZone, locale, date, withTimeSince, className, dataTestId, }: DateTimeCellProps) => JSX.Element | null;
40
+ export interface TimeSinceProps extends Pick<DateTimeCellProps, "date" | "timeZone" | "locale"> {
41
+ date: Date;
42
+ }
@@ -0,0 +1,8 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { DateTimeCell } from "./DateTimeCell";
3
+ import "./DateTimeCell.variants";
4
+ type Story = StoryObj<typeof DateTimeCell>;
5
+ declare const meta: Meta<typeof DateTimeCell>;
6
+ export default meta;
7
+ export declare const Default: Story;
8
+ export declare const Variants: () => JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare const cvaDateTimeCell: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
+ export declare const cvaDateTime: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
3
+ export declare const cvaDateTimeSince: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -0,0 +1,21 @@
1
+ import { CommonProps } from "@trackunit/react-components";
2
+ export interface ImageCellProps extends CommonProps {
3
+ imageUrl: string;
4
+ alt?: string;
5
+ width?: number;
6
+ height?: number;
7
+ dataTestId?: string;
8
+ }
9
+ /**
10
+ * The `<ImageCell>` component is used for displaying images in a table cell.
11
+ *
12
+ * @param {object} props - The props for the Image component.
13
+ * @param {string} props.imageUrl - The URL of the image to be displayed.
14
+ * @param {string} [props.alt=""] - The alternative text for the image.
15
+ * @param {number} [props.width=100] - The width of the image in pixels.
16
+ * @param {number} [props.height=100] - The height of the image in pixels.
17
+ * @param {string} [props.dataTestId] - An optional data-testid for testing purposes.
18
+ * @param {...any} [rest] - Additional props that can be applied to the underlying <img> element.
19
+ * @returns {JSX.Element} The Image component.
20
+ */
21
+ export declare const ImageCell: ({ imageUrl, alt, width, height, dataTestId, ...rest }: ImageCellProps) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ type Story = StoryObj<typeof Image>;
3
+ declare const meta: Meta<typeof Image>;
4
+ export default meta;
5
+ export declare const Default: Story;
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ import { IndicatorProps } from "@trackunit/react-components";
3
+ import { ThemeColors } from "@trackunit/ui-design-tokens";
4
+ export interface IndicatorCellProps extends IndicatorProps, React.HTMLAttributes<HTMLTableSectionElement> {
5
+ /**
6
+ * The icon to be rendered inside the indicator component
7
+ */
8
+ icon: JSX.Element;
9
+ /**
10
+ * A color token used to style the icon and the icon background
11
+ */
12
+ color?: ThemeColors;
13
+ /**
14
+ * A text label to be displayed next to the indicator
15
+ */
16
+ label?: string;
17
+ /**
18
+ * A boolean parameter to display or hide icon background, default value is true
19
+ */
20
+ withBackground?: boolean;
21
+ /**
22
+ * A boolean parameter to display or hide label and instead show as html title on hover, default value is true
23
+ */
24
+ withLabel?: boolean;
25
+ /**
26
+ * A boolean parameter to make the indicator ping thus drawing more attention, default value is false
27
+ */
28
+ ping?: boolean;
29
+ }
30
+ /**
31
+ * The IndicatorCell is used for render an indicator in a table cell
32
+ *
33
+ * @param {IndicatorCellProps} props - The props for the LinkCell component
34
+ * @returns {JSX.Element} LinkCell component
35
+ */
36
+ export declare const IndicatorCell: ({ ...rest }: IndicatorCellProps) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { IndicatorCell } from "./IndicatorCell";
3
+ type Story = StoryObj<typeof IndicatorCell>;
4
+ declare const meta: Meta<typeof IndicatorCell>;
5
+ export default meta;
6
+ export declare const Default: Story;
@@ -0,0 +1,16 @@
1
+ import { CommonProps } from "@trackunit/react-components";
2
+ export interface NumberCellProps extends CommonProps {
3
+ value: string | number;
4
+ unit?: string | undefined;
5
+ }
6
+ /**
7
+ * The `<NumberCell>` component is used for displaying numbers with units in a table cell.
8
+ *
9
+ * @param props - The props for the NumberCell component.
10
+ * @param {string} [props.value] - The numeric value to be displayed.
11
+ * @param {string} [props.unit] - The optional unit to be displayed alongside the value.
12
+ * @param {string} [props.className] - Additional CSS classes to apply to the component.
13
+ * @param {string} [props.dataTestId] - The data-testid attribute for testing purposes.
14
+ * @returns {JSX.Element} A React JSX element representing the NumberCell component.
15
+ */
16
+ export declare const NumberCell: ({ value, unit, className, dataTestId }: NumberCellProps) => JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { NumberCell } from "./NumberCell";
3
+ import "./NumberCell.variants";
4
+ type Story = StoryObj<typeof NumberCell>;
5
+ declare const meta: Meta<typeof NumberCell>;
6
+ export default meta;
7
+ export declare const Default: Story;
@@ -0,0 +1 @@
1
+ export declare const cvaNumberCell: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;