@trackunit/react-components 0.1.402 → 0.1.404

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
@@ -377,16 +377,7 @@ const Text = ({ children, type = "p", size = "medium", align = "left", weight =
377
377
  }, children);
378
378
  };
379
379
 
380
- const cvaSpinner = cssClassVarianceUtilities.cvaMerge([
381
- "bg-transparent",
382
- "rounded-full",
383
- "border-2",
384
- "border-solid",
385
- "inline-block",
386
- "animate-spin",
387
- "cursor-wait",
388
- "text-current",
389
- ], {
380
+ const cvaSpinner = cssClassVarianceUtilities.cvaMerge(["bg-transparent", "rounded-full", "border-2", "border-solid", "inline-block", "animate-spin", "cursor-wait"], {
390
381
  variants: {
391
382
  size: {
392
383
  small: ["w-4", "h-4"],
@@ -403,6 +394,7 @@ const cvaSpinner = cssClassVarianceUtilities.cvaMerge([
403
394
  mode: "light",
404
395
  },
405
396
  });
397
+ const cvaSpinnerContainerInner = cssClassVarianceUtilities.cvaMerge(["gap-responsive-space-sm", "grid", "place-items-center"]);
406
398
  const cvaSpinnerContainer = cssClassVarianceUtilities.cvaMerge(["box-border", "p-0.5", "overflow-hidden"], {
407
399
  variants: {
408
400
  centering: {
@@ -410,11 +402,17 @@ const cvaSpinnerContainer = cssClassVarianceUtilities.cvaMerge(["box-border", "p
410
402
  vertically: ["grid", "h-full", "items-center"],
411
403
  horizontally: ["grid", "w-full", "justify-items-center"],
412
404
  },
405
+ mode: {
406
+ dark: ["text-white/75"],
407
+ light: ["text-slate-900/50"],
408
+ },
413
409
  },
414
410
  defaultVariants: {
415
411
  centering: "centered",
412
+ mode: "light",
416
413
  },
417
414
  });
415
+ const cvaSpinnerLabel = cssClassVarianceUtilities.cvaMerge(["self-center", "text-center", "text-current"]);
418
416
 
419
417
  /**
420
418
  * The spinner component provides visual feedback that data is being processed.
@@ -430,8 +428,8 @@ const cvaSpinnerContainer = cssClassVarianceUtilities.cvaMerge(["box-border", "p
430
428
  * @param {SpinnerProps} props - The props for the Spinner component
431
429
  * @returns {JSX.Element} Spinner component
432
430
  */
433
- const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId = "spinner", }) => {
434
- return (jsxRuntime.jsx("div", { className: cvaSpinnerContainer({ centering, className: containerClassName }), children: jsxRuntime.jsx("div", { className: cvaSpinner({ size, mode, className }), "data-testid": dataTestId, role: "spinbutton" }) }));
431
+ const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId = "spinner", label, }) => {
432
+ return (jsxRuntime.jsx("div", { className: cvaSpinnerContainer({ centering, className: containerClassName }), children: jsxRuntime.jsxs("div", { className: cvaSpinnerContainerInner(), children: [jsxRuntime.jsx("div", { className: cvaSpinner({ size, mode, className }), "data-testid": dataTestId, role: "spinbutton" }), label ? jsxRuntime.jsx("span", { className: cvaSpinnerLabel(), children: label }) : null] }) }));
435
433
  };
436
434
 
437
435
  const cvaButton = cssClassVarianceUtilities.cvaMerge([
@@ -4626,7 +4624,7 @@ const cvaToggleGroup = cssClassVarianceUtilities.cvaMerge(["inline-flex", "divid
4626
4624
  const cvaToggleItem = cssClassVarianceUtilities.cvaMerge(["text-slate-600", "rounded-none", "bg-transparent", "flex", "border-x-0"], {
4627
4625
  variants: {
4628
4626
  selected: {
4629
- true: ["bg-slate-300", "hover:bg-slate-300", "text-slate-700"],
4627
+ true: ["bg-slate-200", "hover:bg-slate-200", "text-slate-800"],
4630
4628
  false: [],
4631
4629
  },
4632
4630
  },
@@ -4657,7 +4655,7 @@ const ToggleGroup = ({ list, selected, setSelected, onClick, disabled = false, s
4657
4655
  }, selected: selected === item.id, size: size, text: item.text, title: item.title, tooltip: item.tooltip }, item.id))) }));
4658
4656
  };
4659
4657
  const ToggleItem = ({ title, onClick, disabled, isIconOnly, iconName, size, className, selected, text, tooltip, dataTestId, }) => {
4660
- return isIconOnly ? (jsxRuntime.jsx(Tooltip, { label: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) || title, placement: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.placement) || "top", children: jsxRuntime.jsx(IconButton, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, icon: iconName ? jsxRuntime.jsx(Icon, { name: iconName, size: "small" }) : null, onClick: onClick, size: size, title: iconName, variant: "secondary" }) })) : (jsxRuntime.jsx(Tooltip, { disabled: !(text === null || text === void 0 ? void 0 : text.truncate) && (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) === undefined, label: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) || title, placement: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.placement) || "top", children: jsxRuntime.jsx(Button, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, onClick: onClick, prefix: iconName ? jsxRuntime.jsx(Icon, { name: iconName, size: "small" }) : null, size: size, variant: "secondary", children: jsxRuntime.jsx("span", { className: cvaToggleItemText({ disabledAndSelected: disabled && selected, maxWidth: text === null || text === void 0 ? void 0 : text.maxWidth }), children: title }) }) }));
4658
+ return isIconOnly ? (jsxRuntime.jsx(Tooltip, { label: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) || title, placement: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.placement) || "top", children: jsxRuntime.jsx(IconButton, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, icon: iconName ? (jsxRuntime.jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, onClick: onClick, size: size, title: iconName, variant: "secondary" }) })) : (jsxRuntime.jsx(Tooltip, { disabled: !(text === null || text === void 0 ? void 0 : text.truncate) && (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) === undefined, label: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) || title, placement: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.placement) || "top", children: jsxRuntime.jsx(Button, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, onClick: onClick, prefix: iconName ? (jsxRuntime.jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, size: size, variant: "secondary", children: jsxRuntime.jsx("span", { className: cvaToggleItemText({ disabledAndSelected: disabled && selected, maxWidth: text === null || text === void 0 ? void 0 : text.maxWidth }), children: title }) }) }));
4661
4659
  };
4662
4660
 
4663
4661
  const cvaValueBar = cssClassVarianceUtilities.cvaMerge(["w-full"], {
package/index.esm.js CHANGED
@@ -357,16 +357,7 @@ const Text = ({ children, type = "p", size = "medium", align = "left", weight =
357
357
  }, children);
358
358
  };
359
359
 
360
- const cvaSpinner = cvaMerge([
361
- "bg-transparent",
362
- "rounded-full",
363
- "border-2",
364
- "border-solid",
365
- "inline-block",
366
- "animate-spin",
367
- "cursor-wait",
368
- "text-current",
369
- ], {
360
+ const cvaSpinner = cvaMerge(["bg-transparent", "rounded-full", "border-2", "border-solid", "inline-block", "animate-spin", "cursor-wait"], {
370
361
  variants: {
371
362
  size: {
372
363
  small: ["w-4", "h-4"],
@@ -383,6 +374,7 @@ const cvaSpinner = cvaMerge([
383
374
  mode: "light",
384
375
  },
385
376
  });
377
+ const cvaSpinnerContainerInner = cvaMerge(["gap-responsive-space-sm", "grid", "place-items-center"]);
386
378
  const cvaSpinnerContainer = cvaMerge(["box-border", "p-0.5", "overflow-hidden"], {
387
379
  variants: {
388
380
  centering: {
@@ -390,11 +382,17 @@ const cvaSpinnerContainer = cvaMerge(["box-border", "p-0.5", "overflow-hidden"],
390
382
  vertically: ["grid", "h-full", "items-center"],
391
383
  horizontally: ["grid", "w-full", "justify-items-center"],
392
384
  },
385
+ mode: {
386
+ dark: ["text-white/75"],
387
+ light: ["text-slate-900/50"],
388
+ },
393
389
  },
394
390
  defaultVariants: {
395
391
  centering: "centered",
392
+ mode: "light",
396
393
  },
397
394
  });
395
+ const cvaSpinnerLabel = cvaMerge(["self-center", "text-center", "text-current"]);
398
396
 
399
397
  /**
400
398
  * The spinner component provides visual feedback that data is being processed.
@@ -410,8 +408,8 @@ const cvaSpinnerContainer = cvaMerge(["box-border", "p-0.5", "overflow-hidden"],
410
408
  * @param {SpinnerProps} props - The props for the Spinner component
411
409
  * @returns {JSX.Element} Spinner component
412
410
  */
413
- const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId = "spinner", }) => {
414
- return (jsx("div", { className: cvaSpinnerContainer({ centering, className: containerClassName }), children: jsx("div", { className: cvaSpinner({ size, mode, className }), "data-testid": dataTestId, role: "spinbutton" }) }));
411
+ const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId = "spinner", label, }) => {
412
+ return (jsx("div", { className: cvaSpinnerContainer({ centering, className: containerClassName }), children: jsxs("div", { className: cvaSpinnerContainerInner(), children: [jsx("div", { className: cvaSpinner({ size, mode, className }), "data-testid": dataTestId, role: "spinbutton" }), label ? jsx("span", { className: cvaSpinnerLabel(), children: label }) : null] }) }));
415
413
  };
416
414
 
417
415
  const cvaButton = cvaMerge([
@@ -4606,7 +4604,7 @@ const cvaToggleGroup = cvaMerge(["inline-flex", "divide-x", "divide-slate-300"])
4606
4604
  const cvaToggleItem = cvaMerge(["text-slate-600", "rounded-none", "bg-transparent", "flex", "border-x-0"], {
4607
4605
  variants: {
4608
4606
  selected: {
4609
- true: ["bg-slate-300", "hover:bg-slate-300", "text-slate-700"],
4607
+ true: ["bg-slate-200", "hover:bg-slate-200", "text-slate-800"],
4610
4608
  false: [],
4611
4609
  },
4612
4610
  },
@@ -4637,7 +4635,7 @@ const ToggleGroup = ({ list, selected, setSelected, onClick, disabled = false, s
4637
4635
  }, selected: selected === item.id, size: size, text: item.text, title: item.title, tooltip: item.tooltip }, item.id))) }));
4638
4636
  };
4639
4637
  const ToggleItem = ({ title, onClick, disabled, isIconOnly, iconName, size, className, selected, text, tooltip, dataTestId, }) => {
4640
- return isIconOnly ? (jsx(Tooltip, { label: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) || title, placement: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.placement) || "top", children: jsx(IconButton, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, icon: iconName ? jsx(Icon, { name: iconName, size: "small" }) : null, onClick: onClick, size: size, title: iconName, variant: "secondary" }) })) : (jsx(Tooltip, { disabled: !(text === null || text === void 0 ? void 0 : text.truncate) && (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) === undefined, label: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) || title, placement: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.placement) || "top", children: jsx(Button, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, onClick: onClick, prefix: iconName ? jsx(Icon, { name: iconName, size: "small" }) : null, size: size, variant: "secondary", children: jsx("span", { className: cvaToggleItemText({ disabledAndSelected: disabled && selected, maxWidth: text === null || text === void 0 ? void 0 : text.maxWidth }), children: title }) }) }));
4638
+ return isIconOnly ? (jsx(Tooltip, { label: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) || title, placement: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.placement) || "top", children: jsx(IconButton, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, icon: iconName ? (jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, onClick: onClick, size: size, title: iconName, variant: "secondary" }) })) : (jsx(Tooltip, { disabled: !(text === null || text === void 0 ? void 0 : text.truncate) && (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) === undefined, label: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) || title, placement: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.placement) || "top", children: jsx(Button, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, onClick: onClick, prefix: iconName ? (jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, size: size, variant: "secondary", children: jsx("span", { className: cvaToggleItemText({ disabledAndSelected: disabled && selected, maxWidth: text === null || text === void 0 ? void 0 : text.maxWidth }), children: title }) }) }));
4641
4639
  };
4642
4640
 
4643
4641
  const cvaValueBar = cvaMerge(["w-full"], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.402",
3
+ "version": "0.1.404",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -1,4 +1,5 @@
1
- import { CommonProps, Size } from "../../common";
1
+ import { CommonProps } from "../../common/CommonProps";
2
+ import { Size } from "../../common/Size";
2
3
  type Centering = "horizontally" | "vertically" | "centered";
3
4
  export interface SpinnerProps extends CommonProps {
4
5
  /**
@@ -19,6 +20,10 @@ export interface SpinnerProps extends CommonProps {
19
20
  * Useful for sizing to minimize jumping on load.
20
21
  */
21
22
  containerClassName?: string;
23
+ /**
24
+ * A Label to be displayed under the spinner.
25
+ */
26
+ label?: string;
22
27
  }
23
28
  /**
24
29
  * The spinner component provides visual feedback that data is being processed.
@@ -34,5 +39,5 @@ export interface SpinnerProps extends CommonProps {
34
39
  * @param {SpinnerProps} props - The props for the Spinner component
35
40
  * @returns {JSX.Element} Spinner component
36
41
  */
37
- export declare const Spinner: ({ mode, size, centering, className, containerClassName, dataTestId, }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
42
+ export declare const Spinner: ({ mode, size, centering, className, containerClassName, dataTestId, label, }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
38
43
  export {};
@@ -2,6 +2,9 @@ export declare const cvaSpinner: (props?: ({
2
2
  size?: "small" | "medium" | "large" | null | undefined;
3
3
  mode?: "dark" | "light" | null | undefined;
4
4
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
5
+ export declare const cvaSpinnerContainerInner: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
5
6
  export declare const cvaSpinnerContainer: (props?: ({
6
7
  centering?: "centered" | "vertically" | "horizontally" | null | undefined;
8
+ mode?: "dark" | "light" | null | undefined;
7
9
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
10
+ export declare const cvaSpinnerLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;