@trackunit/react-components 0.5.38 → 0.5.39

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
@@ -458,7 +458,7 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
458
458
  "cursor-pointer",
459
459
  "flex-none",
460
460
  "component-button-border",
461
- "component-button-padding", //TODO: Is overwritten by size which messes with marketing theme
461
+ "component-button-padding",
462
462
  "component-button-height",
463
463
  "disabled:cursor-not-allowed",
464
464
  "font-medium",
@@ -653,11 +653,21 @@ const cvaButtonPrefixSuffix = cssClassVarianceUtilities.cvaMerge(["flex", "items
653
653
  variant: {
654
654
  primary: [],
655
655
  "primary-danger": [],
656
- secondary: ["text-secondary-400", "group-focus:text-secondary-400", "group-hover:text-secondary-500", "group-active:text-secondary-600"],
656
+ secondary: [
657
+ "text-secondary-400",
658
+ "group-focus:text-secondary-400",
659
+ "group-hover:text-secondary-500",
660
+ "group-active:text-secondary-600",
661
+ ],
657
662
  "secondary-danger": [],
658
663
  ghost: [],
659
- "ghost-neutral": ["text-secondary-400", "group-focus:text-secondary-400", "group-hover:text-secondary-500", "group-active:text-secondary-600"],
660
- }
664
+ "ghost-neutral": [
665
+ "text-secondary-400",
666
+ "group-focus:text-secondary-400",
667
+ "group-hover:text-secondary-500",
668
+ "group-active:text-secondary-600",
669
+ ],
670
+ },
661
671
  },
662
672
  defaultVariants: {
663
673
  size: "medium",
@@ -1281,7 +1291,7 @@ const getWindowSize = () => {
1281
1291
  width: window.innerWidth,
1282
1292
  };
1283
1293
  }
1284
- catch (err) {
1294
+ catch (error) {
1285
1295
  return {
1286
1296
  height: 0,
1287
1297
  width: 0,
@@ -1928,7 +1938,6 @@ const SkeletonLines = React.memo(({ margin = "10px 0", lines = 1, height, width
1928
1938
  for (let i = 0; i < lines; i++) {
1929
1939
  skeletonLines.push(jsxRuntime.jsx("div", { className: cvaSkeletonLine({ className }), "data-testid": dataTestId ? `${dataTestId}-${i}` : `skeleton-lines-${i}`, "data-type": "loading-skeleton-line", style: { height: getHeight(i), width: getWidth(i), margin: lines > 1 && i >= 1 ? margin : "" }, children: lines > 1 && jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u00A0" }) }, i));
1930
1940
  }
1931
- // eslint-disable-next-line react/jsx-no-useless-fragment
1932
1941
  return jsxRuntime.jsx(jsxRuntime.Fragment, { children: skeletonLines });
1933
1942
  });
1934
1943
  SkeletonLines.displayName = "SkeletonLines";
@@ -4296,6 +4305,7 @@ const Polygon = ({ points, size, color = "black", opaque = true, className, data
4296
4305
  const normalize = ({ value, min, max, size }) => ((value - min) / (max - min)) * size;
4297
4306
 
4298
4307
  function useConfirmExit(confirmExit, when = true) {
4308
+ // eslint-disable-next-line sonarjs/deprecation
4299
4309
  reactRouter.useBlocker(confirmExit, when);
4300
4310
  }
4301
4311
  /**
@@ -4398,7 +4408,7 @@ const cvaSidebarChildContainer = cssClassVarianceUtilities.cvaMerge(["apply", "f
4398
4408
  */
4399
4409
  const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id", children, }) => {
4400
4410
  const [itemOverflowMap, setItemOverflowMap] = React.useState({});
4401
- const overflowContainerRef = React.useRef(null); // TODO: Handle other elements than div
4411
+ const overflowContainerRef = React.useRef(null);
4402
4412
  const observerRef = React.useRef(null);
4403
4413
  const handleIntersection = React.useCallback(entries => {
4404
4414
  const updatedEntries = {};
@@ -4608,6 +4618,7 @@ const ToggleGroup = ({ list, selected, setSelected, onChange, disabled = false,
4608
4618
  * Individual ToggleItem to create custom ToggleGroups
4609
4619
  */
4610
4620
  const ToggleItem = ({ title, onClick, disabled = false, isIconOnly = false, iconName, size, className, selected = false, text, tooltip, dataTestId, }) => {
4621
+ // eslint-disable-next-line sonarjs/no-selector-parameter
4611
4622
  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 }) }) }));
4612
4623
  };
4613
4624
 
package/index.esm.js CHANGED
@@ -438,7 +438,7 @@ const cvaButton = cvaMerge([
438
438
  "cursor-pointer",
439
439
  "flex-none",
440
440
  "component-button-border",
441
- "component-button-padding", //TODO: Is overwritten by size which messes with marketing theme
441
+ "component-button-padding",
442
442
  "component-button-height",
443
443
  "disabled:cursor-not-allowed",
444
444
  "font-medium",
@@ -633,11 +633,21 @@ const cvaButtonPrefixSuffix = cvaMerge(["flex", "items-center"], {
633
633
  variant: {
634
634
  primary: [],
635
635
  "primary-danger": [],
636
- secondary: ["text-secondary-400", "group-focus:text-secondary-400", "group-hover:text-secondary-500", "group-active:text-secondary-600"],
636
+ secondary: [
637
+ "text-secondary-400",
638
+ "group-focus:text-secondary-400",
639
+ "group-hover:text-secondary-500",
640
+ "group-active:text-secondary-600",
641
+ ],
637
642
  "secondary-danger": [],
638
643
  ghost: [],
639
- "ghost-neutral": ["text-secondary-400", "group-focus:text-secondary-400", "group-hover:text-secondary-500", "group-active:text-secondary-600"],
640
- }
644
+ "ghost-neutral": [
645
+ "text-secondary-400",
646
+ "group-focus:text-secondary-400",
647
+ "group-hover:text-secondary-500",
648
+ "group-active:text-secondary-600",
649
+ ],
650
+ },
641
651
  },
642
652
  defaultVariants: {
643
653
  size: "medium",
@@ -1261,7 +1271,7 @@ const getWindowSize = () => {
1261
1271
  width: window.innerWidth,
1262
1272
  };
1263
1273
  }
1264
- catch (err) {
1274
+ catch (error) {
1265
1275
  return {
1266
1276
  height: 0,
1267
1277
  width: 0,
@@ -1908,7 +1918,6 @@ const SkeletonLines = memo(({ margin = "10px 0", lines = 1, height, width = "100
1908
1918
  for (let i = 0; i < lines; i++) {
1909
1919
  skeletonLines.push(jsx("div", { className: cvaSkeletonLine({ className }), "data-testid": dataTestId ? `${dataTestId}-${i}` : `skeleton-lines-${i}`, "data-type": "loading-skeleton-line", style: { height: getHeight(i), width: getWidth(i), margin: lines > 1 && i >= 1 ? margin : "" }, children: lines > 1 && jsx(Fragment, { children: "\u00A0" }) }, i));
1910
1920
  }
1911
- // eslint-disable-next-line react/jsx-no-useless-fragment
1912
1921
  return jsx(Fragment, { children: skeletonLines });
1913
1922
  });
1914
1923
  SkeletonLines.displayName = "SkeletonLines";
@@ -4276,6 +4285,7 @@ const Polygon = ({ points, size, color = "black", opaque = true, className, data
4276
4285
  const normalize = ({ value, min, max, size }) => ((value - min) / (max - min)) * size;
4277
4286
 
4278
4287
  function useConfirmExit(confirmExit, when = true) {
4288
+ // eslint-disable-next-line sonarjs/deprecation
4279
4289
  useBlocker(confirmExit, when);
4280
4290
  }
4281
4291
  /**
@@ -4378,7 +4388,7 @@ const cvaSidebarChildContainer = cvaMerge(["apply", "flex", "overflow-hidden", "
4378
4388
  */
4379
4389
  const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id", children, }) => {
4380
4390
  const [itemOverflowMap, setItemOverflowMap] = useState({});
4381
- const overflowContainerRef = useRef(null); // TODO: Handle other elements than div
4391
+ const overflowContainerRef = useRef(null);
4382
4392
  const observerRef = useRef(null);
4383
4393
  const handleIntersection = useCallback(entries => {
4384
4394
  const updatedEntries = {};
@@ -4588,6 +4598,7 @@ const ToggleGroup = ({ list, selected, setSelected, onChange, disabled = false,
4588
4598
  * Individual ToggleItem to create custom ToggleGroups
4589
4599
  */
4590
4600
  const ToggleItem = ({ title, onClick, disabled = false, isIconOnly = false, iconName, size, className, selected = false, text, tooltip, dataTestId, }) => {
4601
+ // eslint-disable-next-line sonarjs/no-selector-parameter
4591
4602
  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 }) }) }));
4592
4603
  };
4593
4604
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.5.38",
3
+ "version": "0.5.39",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -4,7 +4,7 @@ import { cvaInteractableItem } from "../../InteractableItem/InteractableItem.var
4
4
  import { MenuItemVariant } from "./MenuItem";
5
5
  type CvaMenuItemProps = Partial<MappedOmit<VariantProps<typeof cvaInteractableItem>, "cursor">> & {
6
6
  variant?: MenuItemVariant;
7
- selected?: boolean | null | undefined;
7
+ selected: boolean | null | undefined;
8
8
  };
9
9
  /**
10
10
  * Extends the cvaInteractableItem variant in order to set the padding, width, height, cursor, and other styles particular to the MenuItem component.
@@ -0,0 +1,12 @@
1
+ import { RenderHookOptions } from "@testing-library/react";
2
+ /**
3
+ * Custom renderHook function to avoid boilerplate
4
+ *
5
+ * @template T
6
+ * @template K
7
+ * @param {(props: T) => K} callback - callback function
8
+ * @param {RenderHookOptions<T>} [options] - options
9
+ */
10
+ declare const customRenderHook: <TProps, TReturn>(callback: (props: TProps) => TReturn, options?: RenderHookOptions<TProps>) => import("@testing-library/react").RenderHookResult<TReturn, TProps>;
11
+ export * from "@testing-library/react";
12
+ export { customRenderHook as renderHook };
@@ -0,0 +1,12 @@
1
+ import { RenderOptions, RenderResult } from "@testing-library/react";
2
+ import * as React from "react";
3
+ /**
4
+ * Enhanced render with providers
5
+ *
6
+ * @param ui - The UI to render
7
+ * @param options - The options for the render
8
+ * @returns {RenderResult} The rendered UI
9
+ */
10
+ declare const customRender: (ui: React.ReactElement, options?: Omit<RenderOptions, "wrapper">) => RenderResult;
11
+ export * from "@testing-library/react";
12
+ export { customRender as render };