@trackunit/react-table 2.7.4 → 2.7.6

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,10 +3,10 @@
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
5
5
  var reactComponents = require('@trackunit/react-components');
6
+ var reactRouter = require('@tanstack/react-router');
6
7
  var sharedUtils = require('@trackunit/shared-utils');
7
8
  var react = require('react');
8
9
  var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
9
- var reactRouter = require('@tanstack/react-router');
10
10
  var reactCoreHooks = require('@trackunit/react-core-hooks');
11
11
  var zod = require('zod');
12
12
  var reactFormComponents = require('@trackunit/react-form-components');
@@ -102,6 +102,58 @@ const ActionIcon = ({ action }) => {
102
102
  return action.icon ? (jsxRuntime.jsx(reactComponents.Icon, { color: "white", "data-testid": "action-icon", name: action.icon, ref: action.ref, size: "small", style: action.style })) : null;
103
103
  };
104
104
 
105
+ /**
106
+ * The button to show in the ActionSheet.
107
+ * Should not be used outside the ActionSheet component.
108
+ *
109
+ * @param {ActionButtonProps} props - The properties for the action button.
110
+ * @param {ActionModel} props.action - The action model defining what action to perform.
111
+ * @param {string} [props.id] - The optional ID for the button.
112
+ * @param {...any} [props.rest] - Any additional button properties.
113
+ * @returns {ReactElement} - The action button component.
114
+ */
115
+ const ActionButton = ({ action, id, ...rest }) => {
116
+ if (action.type === "route") {
117
+ return (jsxRuntime.jsx(reactComponents.Button, { asChild: true, id: id, loading: action.loading, prefix: jsxRuntime.jsx(ActionIcon, { action: action }), ...rest, children: jsxRuntime.jsx(reactRouter.Link, { to: action.url, children: action.label }) }));
118
+ }
119
+ const content = (jsxRuntime.jsx(reactComponents.Button, { id: id, loading: action.loading, onClick: e => action.method(e), prefix: jsxRuntime.jsx(ActionIcon, { action: action }), ...rest, children: action.label }));
120
+ return action.tip ? jsxRuntime.jsx(reactComponents.Tooltip, { label: action.tip, children: content }) : content;
121
+ };
122
+ /**
123
+ * Converts an action model to a MenuItem component.
124
+ * These should be shown in the more menu.
125
+ * Should not be used outside the ActionSheet component.
126
+ *
127
+ * @param {ActionModel} action - The action model to convert.
128
+ * @param {string} [dataTestId] - Optional data test ID.
129
+ * @returns {ReactElement} - The MenuItem component for the given action.
130
+ */
131
+ const actionDataToMenuItem = (action, dataTestId) => {
132
+ const props = "url" in action
133
+ ? {
134
+ "data-testid": dataTestId,
135
+ }
136
+ : {
137
+ id: action.id,
138
+ key: action.label,
139
+ "data-testid": dataTestId,
140
+ };
141
+ const item = (jsxRuntime.jsx(reactComponents.MenuItem, { props, className: "flex justify-center", "data-testid": `${dataTestId}-action-menu-item`, label: action.label, onClick: "method" in action ? action.method : undefined, prefix: action.icon ? (jsxRuntime.jsx(reactComponents.Icon, { "data-testid": "action-icon", name: action.icon, ref: action.ref, size: "medium", style: action.style })) : null, stopPropagation: false }, action.label));
142
+ if ("url" in action) {
143
+ return (jsxRuntime.jsx(reactRouter.Link, { id: action.id, to: action.url, children: item }, action.label));
144
+ }
145
+ return item;
146
+ };
147
+ /**
148
+ * Converts an action model to an ActionButton component.
149
+ * These should be shown in the ActionSheet.
150
+ * Should not be used outside the ActionSheet component.
151
+ *
152
+ * @param action - The action model to convert.
153
+ * @returns {*} The ActionButton component for the given action.
154
+ */
155
+ const actionDataToActionButton = (action) => (jsxRuntime.jsx(ActionButton, { action: action, className: "max-w-max flex-shrink-0", "data-testid": action["data-testid"] || action.id, disabled: action.loading || action.disabled, id: action.id, variant: action.disabled ? "ghost" : undefined }, action.id));
156
+
105
157
  const cvaActionSheet = cssClassVarianceUtilities.cvaMerge([
106
158
  "w-[760px]",
107
159
  "max-w-[80%]",
@@ -159,58 +211,6 @@ const cvaMoreContainer = cssClassVarianceUtilities.cvaMerge([
159
211
  },
160
212
  });
161
213
 
162
- /**
163
- * The button to show in the ActionSheet.
164
- * Should not be used outside the ActionSheet component.
165
- *
166
- * @param {ActionButtonProps} props - The properties for the action button.
167
- * @param {ActionModel} props.action - The action model defining what action to perform.
168
- * @param {string} [props.id] - The optional ID for the button.
169
- * @param {...any} [props.rest] - Any additional button properties.
170
- * @returns {ReactElement} - The action button component.
171
- */
172
- const ActionButton = ({ action, id, ...rest }) => {
173
- if (action.type === "route") {
174
- return (jsxRuntime.jsx(reactComponents.Button, { asChild: true, id: id, loading: action.loading, prefix: jsxRuntime.jsx(ActionIcon, { action: action }), ...rest, children: jsxRuntime.jsx(reactRouter.Link, { to: action.url, children: action.label }) }));
175
- }
176
- const content = (jsxRuntime.jsx(reactComponents.Button, { id: id, loading: action.loading, onClick: e => action.method(e), prefix: jsxRuntime.jsx(ActionIcon, { action: action }), ...rest, children: action.label }));
177
- return action.tip ? jsxRuntime.jsx(reactComponents.Tooltip, { label: action.tip, children: content }) : content;
178
- };
179
- /**
180
- * Converts an action model to a MenuItem component.
181
- * These should be shown in the more menu.
182
- * Should not be used outside the ActionSheet component.
183
- *
184
- * @param {ActionModel} action - The action model to convert.
185
- * @param {string} [dataTestId] - Optional data test ID.
186
- * @returns {ReactElement} - The MenuItem component for the given action.
187
- */
188
- const actionDataToMenuItem = (action, dataTestId) => {
189
- const props = "url" in action
190
- ? {
191
- "data-testid": dataTestId,
192
- }
193
- : {
194
- id: action.id,
195
- key: action.label,
196
- "data-testid": dataTestId,
197
- };
198
- const item = (jsxRuntime.jsx(reactComponents.MenuItem, { props, className: "flex justify-center", "data-testid": `${dataTestId}-action-menu-item`, label: action.label, onClick: "method" in action ? action.method : undefined, prefix: action.icon ? (jsxRuntime.jsx(reactComponents.Icon, { "data-testid": "action-icon", name: action.icon, ref: action.ref, size: "medium", style: action.style })) : null, stopPropagation: false }, action.label));
199
- if ("url" in action) {
200
- return (jsxRuntime.jsx(reactRouter.Link, { id: action.id, to: action.url, children: item }, action.label));
201
- }
202
- return item;
203
- };
204
- /**
205
- * Converts an action model to an ActionButton component.
206
- * These should be shown in the ActionSheet.
207
- * Should not be used outside the ActionSheet component.
208
- *
209
- * @param action - The action model to convert.
210
- * @returns {*} The ActionButton component for the given action.
211
- */
212
- const actionDataToActionButton = (action) => (jsxRuntime.jsx(ActionButton, { action: action, className: "max-w-max flex-shrink-0", "data-testid": action["data-testid"] || action.id, disabled: action.loading || action.disabled, id: action.id, variant: action.disabled ? "ghost" : undefined }, action.id));
213
-
214
214
  /**
215
215
  * `ActionContainerAndOverflow` renders a set of actions and a MoreMenu for overflow.
216
216
  * It makes use of the `useOverflowItems` hook to determine which items should go into the overflow menu.
package/index.esm.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { registerTranslations, useNamespaceTranslation, NamespaceTrans } from '@trackunit/i18n-library-translation';
3
3
  import { Icon, MenuItem, Button, Tooltip, useOverflowItems, MoreMenu, MenuContent, Spacer, usePersistedState, useDebounce, Text, cvaInteractableItem, Popover, PopoverTrigger, IconButton, PopoverContent, cvaMenuList, cvaMenu, useBidirectionalScroll, noPagination, Card, Spinner, EmptyState } from '@trackunit/react-components';
4
+ import { Link } from '@tanstack/react-router';
4
5
  import { objectValues, VISIBLE_ONLY_COLUMN_VISIBILITY_KEY, objectKeys, nonNullable, objectEntries } from '@trackunit/shared-utils';
5
6
  import { useMemo, Children, cloneElement, useCallback, useState, useEffect, useRef, createElement } from 'react';
6
7
  import { cvaMerge } from '@trackunit/css-class-variance-utilities';
7
- import { Link } from '@tanstack/react-router';
8
8
  import { useCurrentUser } from '@trackunit/react-core-hooks';
9
9
  import { z } from 'zod';
10
10
  import { cvaLabel, ToggleSwitch, Search, RadioGroup, RadioItem, Checkbox } from '@trackunit/react-form-components';
@@ -101,6 +101,58 @@ const ActionIcon = ({ action }) => {
101
101
  return action.icon ? (jsx(Icon, { color: "white", "data-testid": "action-icon", name: action.icon, ref: action.ref, size: "small", style: action.style })) : null;
102
102
  };
103
103
 
104
+ /**
105
+ * The button to show in the ActionSheet.
106
+ * Should not be used outside the ActionSheet component.
107
+ *
108
+ * @param {ActionButtonProps} props - The properties for the action button.
109
+ * @param {ActionModel} props.action - The action model defining what action to perform.
110
+ * @param {string} [props.id] - The optional ID for the button.
111
+ * @param {...any} [props.rest] - Any additional button properties.
112
+ * @returns {ReactElement} - The action button component.
113
+ */
114
+ const ActionButton = ({ action, id, ...rest }) => {
115
+ if (action.type === "route") {
116
+ return (jsx(Button, { asChild: true, id: id, loading: action.loading, prefix: jsx(ActionIcon, { action: action }), ...rest, children: jsx(Link, { to: action.url, children: action.label }) }));
117
+ }
118
+ const content = (jsx(Button, { id: id, loading: action.loading, onClick: e => action.method(e), prefix: jsx(ActionIcon, { action: action }), ...rest, children: action.label }));
119
+ return action.tip ? jsx(Tooltip, { label: action.tip, children: content }) : content;
120
+ };
121
+ /**
122
+ * Converts an action model to a MenuItem component.
123
+ * These should be shown in the more menu.
124
+ * Should not be used outside the ActionSheet component.
125
+ *
126
+ * @param {ActionModel} action - The action model to convert.
127
+ * @param {string} [dataTestId] - Optional data test ID.
128
+ * @returns {ReactElement} - The MenuItem component for the given action.
129
+ */
130
+ const actionDataToMenuItem = (action, dataTestId) => {
131
+ const props = "url" in action
132
+ ? {
133
+ "data-testid": dataTestId,
134
+ }
135
+ : {
136
+ id: action.id,
137
+ key: action.label,
138
+ "data-testid": dataTestId,
139
+ };
140
+ const item = (jsx(MenuItem, { props, className: "flex justify-center", "data-testid": `${dataTestId}-action-menu-item`, label: action.label, onClick: "method" in action ? action.method : undefined, prefix: action.icon ? (jsx(Icon, { "data-testid": "action-icon", name: action.icon, ref: action.ref, size: "medium", style: action.style })) : null, stopPropagation: false }, action.label));
141
+ if ("url" in action) {
142
+ return (jsx(Link, { id: action.id, to: action.url, children: item }, action.label));
143
+ }
144
+ return item;
145
+ };
146
+ /**
147
+ * Converts an action model to an ActionButton component.
148
+ * These should be shown in the ActionSheet.
149
+ * Should not be used outside the ActionSheet component.
150
+ *
151
+ * @param action - The action model to convert.
152
+ * @returns {*} The ActionButton component for the given action.
153
+ */
154
+ const actionDataToActionButton = (action) => (jsx(ActionButton, { action: action, className: "max-w-max flex-shrink-0", "data-testid": action["data-testid"] || action.id, disabled: action.loading || action.disabled, id: action.id, variant: action.disabled ? "ghost" : undefined }, action.id));
155
+
104
156
  const cvaActionSheet = cvaMerge([
105
157
  "w-[760px]",
106
158
  "max-w-[80%]",
@@ -158,58 +210,6 @@ const cvaMoreContainer = cvaMerge([
158
210
  },
159
211
  });
160
212
 
161
- /**
162
- * The button to show in the ActionSheet.
163
- * Should not be used outside the ActionSheet component.
164
- *
165
- * @param {ActionButtonProps} props - The properties for the action button.
166
- * @param {ActionModel} props.action - The action model defining what action to perform.
167
- * @param {string} [props.id] - The optional ID for the button.
168
- * @param {...any} [props.rest] - Any additional button properties.
169
- * @returns {ReactElement} - The action button component.
170
- */
171
- const ActionButton = ({ action, id, ...rest }) => {
172
- if (action.type === "route") {
173
- return (jsx(Button, { asChild: true, id: id, loading: action.loading, prefix: jsx(ActionIcon, { action: action }), ...rest, children: jsx(Link, { to: action.url, children: action.label }) }));
174
- }
175
- const content = (jsx(Button, { id: id, loading: action.loading, onClick: e => action.method(e), prefix: jsx(ActionIcon, { action: action }), ...rest, children: action.label }));
176
- return action.tip ? jsx(Tooltip, { label: action.tip, children: content }) : content;
177
- };
178
- /**
179
- * Converts an action model to a MenuItem component.
180
- * These should be shown in the more menu.
181
- * Should not be used outside the ActionSheet component.
182
- *
183
- * @param {ActionModel} action - The action model to convert.
184
- * @param {string} [dataTestId] - Optional data test ID.
185
- * @returns {ReactElement} - The MenuItem component for the given action.
186
- */
187
- const actionDataToMenuItem = (action, dataTestId) => {
188
- const props = "url" in action
189
- ? {
190
- "data-testid": dataTestId,
191
- }
192
- : {
193
- id: action.id,
194
- key: action.label,
195
- "data-testid": dataTestId,
196
- };
197
- const item = (jsx(MenuItem, { props, className: "flex justify-center", "data-testid": `${dataTestId}-action-menu-item`, label: action.label, onClick: "method" in action ? action.method : undefined, prefix: action.icon ? (jsx(Icon, { "data-testid": "action-icon", name: action.icon, ref: action.ref, size: "medium", style: action.style })) : null, stopPropagation: false }, action.label));
198
- if ("url" in action) {
199
- return (jsx(Link, { id: action.id, to: action.url, children: item }, action.label));
200
- }
201
- return item;
202
- };
203
- /**
204
- * Converts an action model to an ActionButton component.
205
- * These should be shown in the ActionSheet.
206
- * Should not be used outside the ActionSheet component.
207
- *
208
- * @param action - The action model to convert.
209
- * @returns {*} The ActionButton component for the given action.
210
- */
211
- const actionDataToActionButton = (action) => (jsx(ActionButton, { action: action, className: "max-w-max flex-shrink-0", "data-testid": action["data-testid"] || action.id, disabled: action.loading || action.disabled, id: action.id, variant: action.disabled ? "ghost" : undefined }, action.id));
212
-
213
213
  /**
214
214
  * `ActionContainerAndOverflow` renders a set of actions and a MoreMenu for overflow.
215
215
  * It makes use of the `useOverflowItems` hook to determine which items should go into the overflow menu.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "2.7.4",
3
+ "version": "2.7.6",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -11,15 +11,15 @@
11
11
  "react-dnd": "16.0.1",
12
12
  "react-dnd-html5-backend": "16.0.1",
13
13
  "tailwind-merge": "^2.0.0",
14
- "@trackunit/react-components": "2.9.4",
15
- "@trackunit/react-core-hooks": "1.21.10",
16
- "@trackunit/shared-utils": "1.16.17",
17
- "@trackunit/css-class-variance-utilities": "1.14.14",
18
- "@trackunit/ui-icons": "1.14.13",
19
- "@trackunit/react-table-base-components": "2.6.4",
20
- "@trackunit/react-form-components": "2.6.4",
21
- "@trackunit/i18n-library-translation": "2.4.10",
22
- "@trackunit/iris-app-runtime-core-api": "1.17.17",
14
+ "@trackunit/react-components": "2.10.1",
15
+ "@trackunit/react-core-hooks": "1.21.11",
16
+ "@trackunit/shared-utils": "1.16.18",
17
+ "@trackunit/css-class-variance-utilities": "1.14.15",
18
+ "@trackunit/ui-icons": "1.14.14",
19
+ "@trackunit/react-table-base-components": "2.6.6",
20
+ "@trackunit/react-form-components": "2.6.6",
21
+ "@trackunit/i18n-library-translation": "2.4.11",
22
+ "@trackunit/iris-app-runtime-core-api": "1.17.18",
23
23
  "zod": "^3.25.76"
24
24
  },
25
25
  "peerDependencies": {