@trackunit/react-table 0.0.488 → 0.0.489

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
@@ -142,6 +142,22 @@ const cvaActionContainerAndOverflow = cssClassVarianceUtilities.cvaMerge([
142
142
  "sm:col-span-1",
143
143
  "sm:flex-row",
144
144
  ]);
145
+ const cvaActionSpinnerContainer = cssClassVarianceUtilities.cvaMerge(["p-0", "h-auto"]);
146
+ const cvaActionSpinner = cssClassVarianceUtilities.cvaMerge([], {
147
+ variants: {
148
+ variant: {
149
+ primary: ["border-white/[0.32]", "border-b-white"],
150
+ "primary-danger": ["border-white/[0.32]", "border-b-white"],
151
+ secondary: ["h-3.5", "w-3.5"],
152
+ "secondary-danger": ["h-3.5", "w-3.5"],
153
+ ghost: [],
154
+ "ghost-neutral": [],
155
+ },
156
+ },
157
+ defaultVariants: {
158
+ variant: "primary",
159
+ },
160
+ });
145
161
 
146
162
  /**
147
163
  * The button to show in the ActionSheet.
@@ -194,7 +210,7 @@ const actionDataToMenuItem = (action, dataTestId) => {
194
210
  * @param {string} [dataTestId] - Optional data test ID.
195
211
  * @returns {JSX.Element} - The ActionButton component for the given action.
196
212
  */
197
- const actionDataToActionButton = (action, dataTestId) => (jsxRuntime.jsxs(ActionButton, { action: action, className: "max-w-max flex-shrink-0", dataTestId: action.label, id: action.id, children: [jsxRuntime.jsx(reactComponents.Icon, { color: "white", "data-testid": "action-icon", forwardedRef: action.forwardedRef, name: action.icon, size: action.size, style: action.style }), jsxRuntime.jsx(reactComponents.Text, { className: "!text-base text-white", dataTestId: `${dataTestId}-action-label`, children: action.label })] }, action.id));
213
+ const actionDataToActionButton = (action, dataTestId) => (jsxRuntime.jsxs(ActionButton, { action: action, className: "max-w-max flex-shrink-0", dataTestId: action.label, disabled: action.loading, id: action.id, loading: action.loading, children: [action.loading ? (jsxRuntime.jsx(reactComponents.Spinner, { centering: "vertically", className: cvaActionSpinner({ variant: "primary" }), containerClassName: cvaActionSpinnerContainer(), size: "small" })) : (jsxRuntime.jsx(reactComponents.Icon, { color: "white", "data-testid": "action-icon", forwardedRef: action.forwardedRef, name: action.icon, size: action.size, style: action.style })), jsxRuntime.jsx(reactComponents.Text, { className: "!text-base text-white", dataTestId: `${dataTestId}-action-label`, children: action.label })] }, action.id));
198
214
 
199
215
  /**
200
216
  * `ActionContainerAndOverflow` renders a set of actions and a MoreMenu for overflow.
package/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { registerTranslations, useNamespaceTranslation } from '@trackunit/i18n-library-translation';
3
- import { MenuItem, Icon, Text, Button, useOverflowItems, MoreMenu, MenuList, IconButton, Card, cvaInteractableItem, Spinner, EmptyState, Tooltip, Popover, PopoverTrigger, PopoverContent } from '@trackunit/react-components';
3
+ import { MenuItem, Icon, Spinner, Text, Button, useOverflowItems, MoreMenu, MenuList, IconButton, Card, cvaInteractableItem, EmptyState, Tooltip, Popover, PopoverTrigger, PopoverContent } from '@trackunit/react-components';
4
4
  import { objectValues, truthy, objectKeys, objectEntries } from '@trackunit/shared-utils';
5
5
  import * as React from 'react';
6
6
  import { useMemo, Children, cloneElement, useRef, useEffect, useState, useCallback } from 'react';
@@ -123,6 +123,22 @@ const cvaActionContainerAndOverflow = cvaMerge([
123
123
  "sm:col-span-1",
124
124
  "sm:flex-row",
125
125
  ]);
126
+ const cvaActionSpinnerContainer = cvaMerge(["p-0", "h-auto"]);
127
+ const cvaActionSpinner = cvaMerge([], {
128
+ variants: {
129
+ variant: {
130
+ primary: ["border-white/[0.32]", "border-b-white"],
131
+ "primary-danger": ["border-white/[0.32]", "border-b-white"],
132
+ secondary: ["h-3.5", "w-3.5"],
133
+ "secondary-danger": ["h-3.5", "w-3.5"],
134
+ ghost: [],
135
+ "ghost-neutral": [],
136
+ },
137
+ },
138
+ defaultVariants: {
139
+ variant: "primary",
140
+ },
141
+ });
126
142
 
127
143
  /**
128
144
  * The button to show in the ActionSheet.
@@ -175,7 +191,7 @@ const actionDataToMenuItem = (action, dataTestId) => {
175
191
  * @param {string} [dataTestId] - Optional data test ID.
176
192
  * @returns {JSX.Element} - The ActionButton component for the given action.
177
193
  */
178
- const actionDataToActionButton = (action, dataTestId) => (jsxs(ActionButton, { action: action, className: "max-w-max flex-shrink-0", dataTestId: action.label, id: action.id, children: [jsx(Icon, { color: "white", "data-testid": "action-icon", forwardedRef: action.forwardedRef, name: action.icon, size: action.size, style: action.style }), jsx(Text, { className: "!text-base text-white", dataTestId: `${dataTestId}-action-label`, children: action.label })] }, action.id));
194
+ const actionDataToActionButton = (action, dataTestId) => (jsxs(ActionButton, { action: action, className: "max-w-max flex-shrink-0", dataTestId: action.label, disabled: action.loading, id: action.id, loading: action.loading, children: [action.loading ? (jsx(Spinner, { centering: "vertically", className: cvaActionSpinner({ variant: "primary" }), containerClassName: cvaActionSpinnerContainer(), size: "small" })) : (jsx(Icon, { color: "white", "data-testid": "action-icon", forwardedRef: action.forwardedRef, name: action.icon, size: action.size, style: action.style })), jsx(Text, { className: "!text-base text-white", dataTestId: `${dataTestId}-action-label`, children: action.label })] }, action.id));
179
195
 
180
196
  /**
181
197
  * `ActionContainerAndOverflow` renders a set of actions and a MoreMenu for overflow.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "0.0.488",
3
+ "version": "0.0.489",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -1,2 +1,6 @@
1
1
  export declare const cvaActionSheet: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
2
  export declare const cvaActionContainerAndOverflow: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
3
+ export declare const cvaActionSpinnerContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
4
+ export declare const cvaActionSpinner: (props?: ({
5
+ variant?: "primary" | "primary-danger" | "secondary" | "secondary-danger" | "ghost" | "ghost-neutral" | null | undefined;
6
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -18,5 +18,6 @@ export interface CommonAction extends IconExposedProp {
18
18
  size?: Size;
19
19
  forwardedRef?: React.RefObject<HTMLSpanElement>;
20
20
  style?: Record<string, string>;
21
+ loading?: boolean;
21
22
  }
22
23
  export {};