@trackunit/react-table-base-components 0.0.372 → 0.0.373

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
@@ -3,14 +3,57 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
+ var reactComponents = require('@trackunit/react-components');
6
7
  var reactFormComponents = require('@trackunit/react-form-components');
7
8
  var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
8
9
  var dateAndTimeUtils = require('@trackunit/date-and-time-utils');
9
- var reactComponents = require('@trackunit/react-components');
10
10
  var react = require('react');
11
11
  var polyfill = require('@js-temporal/polyfill');
12
12
  var sharedUtils = require('@trackunit/shared-utils');
13
13
 
14
+ /******************************************************************************
15
+ Copyright (c) Microsoft Corporation.
16
+
17
+ Permission to use, copy, modify, and/or distribute this software for any
18
+ purpose with or without fee is hereby granted.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
21
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
22
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
23
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
24
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26
+ PERFORMANCE OF THIS SOFTWARE.
27
+ ***************************************************************************** */
28
+
29
+ function __rest(s, e) {
30
+ var t = {};
31
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
32
+ t[p] = s[p];
33
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
34
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
35
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
36
+ t[p[i]] = s[p[i]];
37
+ }
38
+ return t;
39
+ }
40
+
41
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
42
+ var e = new Error(message);
43
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
44
+ };
45
+
46
+ /**
47
+ * The ButtonCell is used to render buttons in a table cell
48
+ *
49
+ * @param {ButtonCellProps} props - The props for the ButtonCell component
50
+ * @returns {JSX.Element} ButtonCell component
51
+ */
52
+ const ButtonCell = (_a) => {
53
+ var { dataTestId, children, iconName, iconColor = "primary", variant = "ghost-neutral" } = _a, rest = __rest(_a, ["dataTestId", "children", "iconName", "iconColor", "variant"]);
54
+ return (jsxRuntime.jsx(reactComponents.Button, Object.assign({ prefix: iconName ? jsxRuntime.jsx(reactComponents.Icon, { color: iconColor, name: iconName, size: "small", type: "solid" }) : null }, rest, { dataTestId: `button-cell-${dataTestId}`, variant: variant, children: children })));
55
+ };
56
+
14
57
  const cvaCheckboxCell = cssClassVarianceUtilities.cvaMerge([""]);
15
58
 
16
59
  /**
@@ -51,38 +94,6 @@ const TimeSince = ({ date, timeZone, locale }) => {
51
94
  }
52
95
  };
53
96
 
54
- /******************************************************************************
55
- Copyright (c) Microsoft Corporation.
56
-
57
- Permission to use, copy, modify, and/or distribute this software for any
58
- purpose with or without fee is hereby granted.
59
-
60
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
61
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
62
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
63
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
64
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
65
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
66
- PERFORMANCE OF THIS SOFTWARE.
67
- ***************************************************************************** */
68
-
69
- function __rest(s, e) {
70
- var t = {};
71
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
72
- t[p] = s[p];
73
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
74
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
75
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
76
- t[p[i]] = s[p[i]];
77
- }
78
- return t;
79
- }
80
-
81
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
82
- var e = new Error(message);
83
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
84
- };
85
-
86
97
  /**
87
98
  * The `<ImageCell>` component is used for displaying images in a table cell.
88
99
  *
@@ -451,6 +462,7 @@ const cvaTr = cssClassVarianceUtilities.cvaMerge(["border-b", "border-neutral-30
451
462
  },
452
463
  });
453
464
 
465
+ exports.ButtonCell = ButtonCell;
454
466
  exports.CheckboxCell = CheckboxCell;
455
467
  exports.DateTimeCell = DateTimeCell;
456
468
  exports.ImageCell = ImageCell;
package/index.esm.js CHANGED
@@ -1,12 +1,55 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Button, Icon, Indicator, ExternalLink, Tooltip, Tag, Notice } from '@trackunit/react-components';
2
3
  import { Checkbox } from '@trackunit/react-form-components';
3
4
  import { cvaMerge } from '@trackunit/css-class-variance-utilities';
4
5
  import { formatDateUtil, timeSinceAuto, timeSinceInDays } from '@trackunit/date-and-time-utils';
5
- import { Indicator, ExternalLink, Tooltip, Tag, Notice } from '@trackunit/react-components';
6
6
  import { useState, useEffect } from 'react';
7
7
  import { Temporal } from '@js-temporal/polyfill';
8
8
  import { DateTimeFormat } from '@trackunit/shared-utils';
9
9
 
10
+ /******************************************************************************
11
+ Copyright (c) Microsoft Corporation.
12
+
13
+ Permission to use, copy, modify, and/or distribute this software for any
14
+ purpose with or without fee is hereby granted.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
17
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
19
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
+ PERFORMANCE OF THIS SOFTWARE.
23
+ ***************************************************************************** */
24
+
25
+ function __rest(s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ }
36
+
37
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
38
+ var e = new Error(message);
39
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
40
+ };
41
+
42
+ /**
43
+ * The ButtonCell is used to render buttons in a table cell
44
+ *
45
+ * @param {ButtonCellProps} props - The props for the ButtonCell component
46
+ * @returns {JSX.Element} ButtonCell component
47
+ */
48
+ const ButtonCell = (_a) => {
49
+ var { dataTestId, children, iconName, iconColor = "primary", variant = "ghost-neutral" } = _a, rest = __rest(_a, ["dataTestId", "children", "iconName", "iconColor", "variant"]);
50
+ return (jsx(Button, Object.assign({ prefix: iconName ? jsx(Icon, { color: iconColor, name: iconName, size: "small", type: "solid" }) : null }, rest, { dataTestId: `button-cell-${dataTestId}`, variant: variant, children: children })));
51
+ };
52
+
10
53
  const cvaCheckboxCell = cvaMerge([""]);
11
54
 
12
55
  /**
@@ -47,38 +90,6 @@ const TimeSince = ({ date, timeZone, locale }) => {
47
90
  }
48
91
  };
49
92
 
50
- /******************************************************************************
51
- Copyright (c) Microsoft Corporation.
52
-
53
- Permission to use, copy, modify, and/or distribute this software for any
54
- purpose with or without fee is hereby granted.
55
-
56
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
57
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
58
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
59
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
60
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
61
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
62
- PERFORMANCE OF THIS SOFTWARE.
63
- ***************************************************************************** */
64
-
65
- function __rest(s, e) {
66
- var t = {};
67
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
68
- t[p] = s[p];
69
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
70
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
71
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
72
- t[p[i]] = s[p[i]];
73
- }
74
- return t;
75
- }
76
-
77
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
78
- var e = new Error(message);
79
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
80
- };
81
-
82
93
  /**
83
94
  * The `<ImageCell>` component is used for displaying images in a table cell.
84
95
  *
@@ -447,4 +458,4 @@ const cvaTr = cvaMerge(["border-b", "border-neutral-300", "w-full", "h-max"], {
447
458
  },
448
459
  });
449
460
 
450
- export { CheckboxCell, DateTimeCell, ImageCell, IndicatorCell, LinkCell, MultiValueTextCell, NoticeCell, NumberCell, PlainDateCell, ResizeHandle, SortIndicator, TableRoot, TagsCell, Tbody, Td, TextCell, Tfoot, Th, Thead, Tr };
461
+ export { ButtonCell, CheckboxCell, DateTimeCell, ImageCell, IndicatorCell, LinkCell, 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.372",
3
+ "version": "0.0.373",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -12,6 +12,7 @@
12
12
  "@trackunit/css-class-variance-utilities": "*",
13
13
  "@trackunit/date-and-time-utils": "*",
14
14
  "@trackunit/shared-utils": "*",
15
+ "@trackunit/ui-icons": "*",
15
16
  "react": "^18.2.0",
16
17
  "@js-temporal/polyfill": "^0.4.4"
17
18
  },
@@ -0,0 +1,15 @@
1
+ import { ButtonCommonProps, IconColors } from "@trackunit/react-components";
2
+ import { IconName } from "@trackunit/ui-icons";
3
+ import { ReactNode } from "react";
4
+ export interface ButtonCellProps extends ButtonCommonProps {
5
+ children: ReactNode;
6
+ iconName?: IconName;
7
+ iconColor?: IconColors;
8
+ }
9
+ /**
10
+ * The ButtonCell is used to render buttons in a table cell
11
+ *
12
+ * @param {ButtonCellProps} props - The props for the ButtonCell component
13
+ * @returns {JSX.Element} ButtonCell component
14
+ */
15
+ export declare const ButtonCell: ({ dataTestId, children, iconName, iconColor, variant, ...rest }: ButtonCellProps) => JSX.Element;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { Meta, StoryObj } from "@storybook/react";
3
+ import { ButtonCell } from "./ButtonCell";
4
+ type Story = StoryObj<typeof ButtonCell>;
5
+ declare const meta: Meta<typeof ButtonCell>;
6
+ export default meta;
7
+ export declare const packageName: () => JSX.Element;
8
+ export declare const Default: Story;
package/src/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./components/ButtonCell/ButtonCell";
1
2
  export * from "./components/CheckboxCell/CheckboxCell";
2
3
  export * from "./components/DateTimeCell/DateTimeCell";
3
4
  export * from "./components/ImageCell/ImageCell";