@trackunit/react-components 1.0.11 → 1.0.13

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
@@ -1138,8 +1138,8 @@ function getDevicePixelRatio(options) {
1138
1138
 
1139
1139
  /**
1140
1140
  * Use this hook if you want to optionally elevate the state of a component.
1141
- * Useful when you want to optionally be able to control the state of a component
1142
- * from a parent componentbut keep the simplicity of not having to.
1141
+ * Useful when you _want_ to be able to control the state of a component
1142
+ * from a parent component but keep the simplicity of not _having_ to.
1143
1143
  *
1144
1144
  * If no custom state is provided, the fallback state will be used and it works like a normal useState hook.
1145
1145
  */
@@ -3316,7 +3316,7 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
3316
3316
  return (jsxRuntime.jsx("a", { className: cvaExternalLink({ className }), "data-testid": dataTestId, href: href, onClick: onClick, rel: rel, target: target, title: title, children: children }));
3317
3317
  };
3318
3318
 
3319
- const PADDING$1 = 16;
3319
+ const PADDING = 12;
3320
3320
  /**
3321
3321
  * Converts a width size value into a CSS dimension value for max constraints
3322
3322
  *
@@ -3332,7 +3332,7 @@ const getMaxWidthValue = ({ value, referenceWidth, availableWidth }) => {
3332
3332
  }
3333
3333
  case undefined:
3334
3334
  case "none": {
3335
- return `${availableWidth - PADDING$1 * 2}px`;
3335
+ return `${availableWidth - PADDING * 2}px`;
3336
3336
  }
3337
3337
  default: {
3338
3338
  if (typeof value === "number") {
@@ -3377,7 +3377,7 @@ const getMaxHeightValue = ({ value, availableHeight }) => {
3377
3377
  switch (value) {
3378
3378
  case undefined:
3379
3379
  case "none": {
3380
- return `${availableHeight - PADDING$1 * 2}px`;
3380
+ return `${availableHeight - PADDING * 2}px`;
3381
3381
  }
3382
3382
  default: {
3383
3383
  if (typeof value === "number") {
@@ -3409,7 +3409,6 @@ const getMinHeightValue = ({ value }) => {
3409
3409
  };
3410
3410
 
3411
3411
  const DEFAULT_ACTIVATION = { click: true, hover: false, keyboardHandlers: true };
3412
- const PADDING = 16;
3413
3412
  const DEFAULT_DISMISSAL = {
3414
3413
  enabled: true,
3415
3414
  outsidePress: true,
@@ -3905,17 +3904,16 @@ const LoadingContent = () => (jsxRuntime.jsx("div", { className: "flex flex-row
3905
3904
  const KPICard = ({ asChild = false, title, value, loading, unit, className, dataTestId, tooltipLabel, isActive, variant = "default", trend, onClick, ...rest }) => {
3906
3905
  const Comp = asChild ? reactSlot.Slot : "div";
3907
3906
  const isSmallVariant = variant === "small";
3908
- const TrendIndicator = () => {
3909
- var _a, _b;
3910
- if (!trend) {
3911
- return null;
3912
- }
3913
- return (jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxRuntime.jsxs(Text, { dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, ((_a = trend.variant) === null || _a === void 0 ? void 0 : _a.icon) ? jsxRuntime.jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxRuntime.jsxs(Text, { className: cvaKPICardTrendPercentage({ color: (_b = trend.variant) === null || _b === void 0 ? void 0 : _b.color }), size: "small", weight: "bold", children: [trend.percentage, "%"] })) : null] }));
3914
- };
3915
- const CardContent = () => (jsxRuntime.jsx(Card, { className: cvaKPICard({ isClickable: Boolean((onClick || asChild) && !loading), isActive, variant }), children: loading ? (jsxRuntime.jsx(LoadingContent, {})) : (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Text, { dataTestId: `${dataTestId}-title`, size: isSmallVariant ? "small" : "medium", subtle: true, weight: isSmallVariant ? "normal" : "bold", children: title }), jsxRuntime.jsx(Text, { className: isSmallVariant ? "mt-0.5" : "", dataTestId: `${dataTestId}-value`, size: isSmallVariant ? "small" : "large", type: "div", weight: isSmallVariant ? "bold" : "thick", children: jsxRuntime.jsxs("div", { className: cvaKPICardValueContainer({
3916
- isDefaultAndHasTrendValue: Boolean((trend === null || trend === void 0 ? void 0 : trend.value) && !isSmallVariant),
3917
- }), children: [jsxRuntime.jsxs("span", { children: [value, " ", unit] }), jsxRuntime.jsx(TrendIndicator, {})] }) })] })) }));
3918
- return (jsxRuntime.jsxs(Comp, { className: cvaKPICardContainer({ className, isClickable: Boolean(asChild || onClick) }), "data-testid": `${dataTestId}-comp`, onClick: onClick, ...rest, children: [tooltipLabel ? (jsxRuntime.jsx(Tooltip, { className: "w-full", label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsx(CardContent, {}) })) : (jsxRuntime.jsx(CardContent, {})), !loading && jsxRuntime.jsx(reactSlot.Slottable, { children: rest.children })] }));
3907
+ return (jsxRuntime.jsxs(Comp, { className: cvaKPICardContainer({ className, isClickable: Boolean(asChild || onClick) }), "data-testid": `${dataTestId}-comp`, onClick: onClick, ...rest, children: [jsxRuntime.jsx(Tooltip, { className: "w-full", disabled: !tooltipLabel, label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsx(Card, { className: cvaKPICard({ isClickable: Boolean((onClick || asChild) && !loading), isActive, variant }), children: loading ? (jsxRuntime.jsx(LoadingContent, {})) : (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Text, { dataTestId: `${dataTestId}-title`, size: isSmallVariant ? "small" : "medium", subtle: true, weight: isSmallVariant ? "normal" : "bold", children: title }), jsxRuntime.jsx(Text, { className: isSmallVariant ? "mt-0.5" : "", dataTestId: `${dataTestId}-value`, size: isSmallVariant ? "small" : "large", type: "div", weight: isSmallVariant ? "bold" : "thick", children: jsxRuntime.jsxs("div", { className: cvaKPICardValueContainer({
3908
+ isDefaultAndHasTrendValue: Boolean((trend === null || trend === void 0 ? void 0 : trend.value) && !isSmallVariant),
3909
+ }), children: [jsxRuntime.jsxs("span", { children: [value, " ", unit] }), jsxRuntime.jsx(TrendIndicator, { isSmallVariant: isSmallVariant, trend: trend, unit: unit })] }) })] })) }) }), !loading && jsxRuntime.jsx(reactSlot.Slottable, { children: rest.children })] }));
3910
+ };
3911
+ const TrendIndicator = ({ trend, unit, isSmallVariant }) => {
3912
+ var _a, _b;
3913
+ if (!trend) {
3914
+ return null;
3915
+ }
3916
+ return (jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxRuntime.jsxs(Text, { dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, ((_a = trend.variant) === null || _a === void 0 ? void 0 : _a.icon) ? jsxRuntime.jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxRuntime.jsxs(Text, { className: cvaKPICardTrendPercentage({ color: (_b = trend.variant) === null || _b === void 0 ? void 0 : _b.color }), size: "small", weight: "bold", children: [trend.percentage, "%"] })) : null] }));
3919
3917
  };
3920
3918
 
3921
3919
  const cvaMenuList = cssClassVarianceUtilities.cvaMerge([
@@ -3939,7 +3937,7 @@ const cvaMenuList = cssClassVarianceUtilities.cvaMerge([
3939
3937
  });
3940
3938
  const cvaMenuListDivider = cssClassVarianceUtilities.cvaMerge(["mx-[-4px]", "my-1", "min-h-px", "bg-slate-300"]);
3941
3939
  const cvaMenuListMultiSelect = cssClassVarianceUtilities.cvaMerge("hover:!bg-blue-200");
3942
- const cvaMenuListItem = cssClassVarianceUtilities.cvaMerge("max-w-[292px]");
3940
+ const cvaMenuListItem = cssClassVarianceUtilities.cvaMerge("max-w-full");
3943
3941
 
3944
3942
  /**
3945
3943
  * The MenuDivider component is used to separate items in a menu list.
@@ -4123,7 +4121,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
4123
4121
  }), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
4124
4122
  stopPropagation && e.stopPropagation();
4125
4123
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
4126
- }, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0, children: [prefix ? (jsxRuntime.jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxRuntime.jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [children !== null && children !== void 0 ? children : label, optionLabelDescription ? jsxRuntime.jsxs("span", { className: "text-secondary-400 ml-1", children: ["(", optionLabelDescription, ")"] }) : null] })), suffix ? (jsxRuntime.jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
4124
+ }, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0), children: [prefix ? (jsxRuntime.jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxRuntime.jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [children !== null && children !== void 0 ? children : label, optionLabelDescription ? jsxRuntime.jsxs("span", { className: "text-secondary-400 ml-1", children: ["(", optionLabelDescription, ")"] }) : null] })), suffix ? (jsxRuntime.jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
4127
4125
  };
4128
4126
 
4129
4127
  /**
@@ -4158,22 +4156,23 @@ const MenuList = ({ dataTestId, className, children, withStickyHeader = false, i
4158
4156
  }
4159
4157
  }, [isMulti, selectedItems, onSelectionChange]);
4160
4158
  return (jsxRuntime.jsx("div", { className: cvaMenuList({ stickyHeader: withStickyHeader, className }), "data-testid": dataTestId ? `${dataTestId}-menu-list` : "menu-list", onClick: args.onClick, role: "list", tabIndex: 0, children: childrenArr.map((menuItem, index) => {
4161
- var _a;
4159
+ var _a, _b;
4162
4160
  if (React.isValidElement(menuItem)) {
4163
4161
  const isSelected = selectedItems.includes((_a = menuItem.props.id) !== null && _a !== void 0 ? _a : `${index}`) || menuItem.props.selected;
4164
- return (jsxRuntime.jsx("div", { children: React.cloneElement(menuItem, {
4165
- ...menuItem.props,
4166
- onClick: (event) => {
4167
- var _a, _b, _c;
4168
- (_b = (_a = menuItem.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
4169
- handleItemClick((_c = menuItem.props.id) !== null && _c !== void 0 ? _c : `${index}`, menuItem.props.disabled);
4170
- },
4171
- className: isMulti && isSelected
4172
- ? cvaMenuListMultiSelect({ className: menuItem.props.className })
4173
- : cvaMenuListItem({ className: menuItem.props.className }),
4174
- selected: isSelected,
4175
- suffix: isMulti && isSelected ? jsxRuntime.jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : null,
4176
- }) }, index));
4162
+ return React.cloneElement(menuItem, {
4163
+ ...menuItem.props,
4164
+ key: index,
4165
+ onClick: (event) => {
4166
+ var _a, _b, _c;
4167
+ (_b = (_a = menuItem.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
4168
+ handleItemClick((_c = menuItem.props.id) !== null && _c !== void 0 ? _c : `${index}`, menuItem.props.disabled);
4169
+ },
4170
+ className: isMulti && isSelected
4171
+ ? cvaMenuListMultiSelect({ className: menuItem.props.className })
4172
+ : cvaMenuListItem({ className: menuItem.props.className }),
4173
+ selected: isSelected,
4174
+ suffix: (_b = menuItem.props.suffix) !== null && _b !== void 0 ? _b : (isMulti && isSelected ? jsxRuntime.jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : null),
4175
+ });
4177
4176
  }
4178
4177
  return null;
4179
4178
  }) }));
package/index.esm.js CHANGED
@@ -1118,8 +1118,8 @@ function getDevicePixelRatio(options) {
1118
1118
 
1119
1119
  /**
1120
1120
  * Use this hook if you want to optionally elevate the state of a component.
1121
- * Useful when you want to optionally be able to control the state of a component
1122
- * from a parent componentbut keep the simplicity of not having to.
1121
+ * Useful when you _want_ to be able to control the state of a component
1122
+ * from a parent component but keep the simplicity of not _having_ to.
1123
1123
  *
1124
1124
  * If no custom state is provided, the fallback state will be used and it works like a normal useState hook.
1125
1125
  */
@@ -3296,7 +3296,7 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
3296
3296
  return (jsx("a", { className: cvaExternalLink({ className }), "data-testid": dataTestId, href: href, onClick: onClick, rel: rel, target: target, title: title, children: children }));
3297
3297
  };
3298
3298
 
3299
- const PADDING$1 = 16;
3299
+ const PADDING = 12;
3300
3300
  /**
3301
3301
  * Converts a width size value into a CSS dimension value for max constraints
3302
3302
  *
@@ -3312,7 +3312,7 @@ const getMaxWidthValue = ({ value, referenceWidth, availableWidth }) => {
3312
3312
  }
3313
3313
  case undefined:
3314
3314
  case "none": {
3315
- return `${availableWidth - PADDING$1 * 2}px`;
3315
+ return `${availableWidth - PADDING * 2}px`;
3316
3316
  }
3317
3317
  default: {
3318
3318
  if (typeof value === "number") {
@@ -3357,7 +3357,7 @@ const getMaxHeightValue = ({ value, availableHeight }) => {
3357
3357
  switch (value) {
3358
3358
  case undefined:
3359
3359
  case "none": {
3360
- return `${availableHeight - PADDING$1 * 2}px`;
3360
+ return `${availableHeight - PADDING * 2}px`;
3361
3361
  }
3362
3362
  default: {
3363
3363
  if (typeof value === "number") {
@@ -3389,7 +3389,6 @@ const getMinHeightValue = ({ value }) => {
3389
3389
  };
3390
3390
 
3391
3391
  const DEFAULT_ACTIVATION = { click: true, hover: false, keyboardHandlers: true };
3392
- const PADDING = 16;
3393
3392
  const DEFAULT_DISMISSAL = {
3394
3393
  enabled: true,
3395
3394
  outsidePress: true,
@@ -3885,17 +3884,16 @@ const LoadingContent = () => (jsx("div", { className: "flex flex-row items-cente
3885
3884
  const KPICard = ({ asChild = false, title, value, loading, unit, className, dataTestId, tooltipLabel, isActive, variant = "default", trend, onClick, ...rest }) => {
3886
3885
  const Comp = asChild ? Slot : "div";
3887
3886
  const isSmallVariant = variant === "small";
3888
- const TrendIndicator = () => {
3889
- var _a, _b;
3890
- if (!trend) {
3891
- return null;
3892
- }
3893
- return (jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxs(Text, { dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, ((_a = trend.variant) === null || _a === void 0 ? void 0 : _a.icon) ? jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxs(Text, { className: cvaKPICardTrendPercentage({ color: (_b = trend.variant) === null || _b === void 0 ? void 0 : _b.color }), size: "small", weight: "bold", children: [trend.percentage, "%"] })) : null] }));
3894
- };
3895
- const CardContent = () => (jsx(Card, { className: cvaKPICard({ isClickable: Boolean((onClick || asChild) && !loading), isActive, variant }), children: loading ? (jsx(LoadingContent, {})) : (jsxs("div", { children: [jsx(Text, { dataTestId: `${dataTestId}-title`, size: isSmallVariant ? "small" : "medium", subtle: true, weight: isSmallVariant ? "normal" : "bold", children: title }), jsx(Text, { className: isSmallVariant ? "mt-0.5" : "", dataTestId: `${dataTestId}-value`, size: isSmallVariant ? "small" : "large", type: "div", weight: isSmallVariant ? "bold" : "thick", children: jsxs("div", { className: cvaKPICardValueContainer({
3896
- isDefaultAndHasTrendValue: Boolean((trend === null || trend === void 0 ? void 0 : trend.value) && !isSmallVariant),
3897
- }), children: [jsxs("span", { children: [value, " ", unit] }), jsx(TrendIndicator, {})] }) })] })) }));
3898
- return (jsxs(Comp, { className: cvaKPICardContainer({ className, isClickable: Boolean(asChild || onClick) }), "data-testid": `${dataTestId}-comp`, onClick: onClick, ...rest, children: [tooltipLabel ? (jsx(Tooltip, { className: "w-full", label: tooltipLabel, placement: "bottom", children: jsx(CardContent, {}) })) : (jsx(CardContent, {})), !loading && jsx(Slottable, { children: rest.children })] }));
3887
+ return (jsxs(Comp, { className: cvaKPICardContainer({ className, isClickable: Boolean(asChild || onClick) }), "data-testid": `${dataTestId}-comp`, onClick: onClick, ...rest, children: [jsx(Tooltip, { className: "w-full", disabled: !tooltipLabel, label: tooltipLabel, placement: "bottom", children: jsx(Card, { className: cvaKPICard({ isClickable: Boolean((onClick || asChild) && !loading), isActive, variant }), children: loading ? (jsx(LoadingContent, {})) : (jsxs("div", { children: [jsx(Text, { dataTestId: `${dataTestId}-title`, size: isSmallVariant ? "small" : "medium", subtle: true, weight: isSmallVariant ? "normal" : "bold", children: title }), jsx(Text, { className: isSmallVariant ? "mt-0.5" : "", dataTestId: `${dataTestId}-value`, size: isSmallVariant ? "small" : "large", type: "div", weight: isSmallVariant ? "bold" : "thick", children: jsxs("div", { className: cvaKPICardValueContainer({
3888
+ isDefaultAndHasTrendValue: Boolean((trend === null || trend === void 0 ? void 0 : trend.value) && !isSmallVariant),
3889
+ }), children: [jsxs("span", { children: [value, " ", unit] }), jsx(TrendIndicator, { isSmallVariant: isSmallVariant, trend: trend, unit: unit })] }) })] })) }) }), !loading && jsx(Slottable, { children: rest.children })] }));
3890
+ };
3891
+ const TrendIndicator = ({ trend, unit, isSmallVariant }) => {
3892
+ var _a, _b;
3893
+ if (!trend) {
3894
+ return null;
3895
+ }
3896
+ return (jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxs(Text, { dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, ((_a = trend.variant) === null || _a === void 0 ? void 0 : _a.icon) ? jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxs(Text, { className: cvaKPICardTrendPercentage({ color: (_b = trend.variant) === null || _b === void 0 ? void 0 : _b.color }), size: "small", weight: "bold", children: [trend.percentage, "%"] })) : null] }));
3899
3897
  };
3900
3898
 
3901
3899
  const cvaMenuList = cvaMerge([
@@ -3919,7 +3917,7 @@ const cvaMenuList = cvaMerge([
3919
3917
  });
3920
3918
  const cvaMenuListDivider = cvaMerge(["mx-[-4px]", "my-1", "min-h-px", "bg-slate-300"]);
3921
3919
  const cvaMenuListMultiSelect = cvaMerge("hover:!bg-blue-200");
3922
- const cvaMenuListItem = cvaMerge("max-w-[292px]");
3920
+ const cvaMenuListItem = cvaMerge("max-w-full");
3923
3921
 
3924
3922
  /**
3925
3923
  * The MenuDivider component is used to separate items in a menu list.
@@ -4103,7 +4101,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
4103
4101
  }), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
4104
4102
  stopPropagation && e.stopPropagation();
4105
4103
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
4106
- }, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0, children: [prefix ? (jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [children !== null && children !== void 0 ? children : label, optionLabelDescription ? jsxs("span", { className: "text-secondary-400 ml-1", children: ["(", optionLabelDescription, ")"] }) : null] })), suffix ? (jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
4104
+ }, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0), children: [prefix ? (jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [children !== null && children !== void 0 ? children : label, optionLabelDescription ? jsxs("span", { className: "text-secondary-400 ml-1", children: ["(", optionLabelDescription, ")"] }) : null] })), suffix ? (jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
4107
4105
  };
4108
4106
 
4109
4107
  /**
@@ -4138,22 +4136,23 @@ const MenuList = ({ dataTestId, className, children, withStickyHeader = false, i
4138
4136
  }
4139
4137
  }, [isMulti, selectedItems, onSelectionChange]);
4140
4138
  return (jsx("div", { className: cvaMenuList({ stickyHeader: withStickyHeader, className }), "data-testid": dataTestId ? `${dataTestId}-menu-list` : "menu-list", onClick: args.onClick, role: "list", tabIndex: 0, children: childrenArr.map((menuItem, index) => {
4141
- var _a;
4139
+ var _a, _b;
4142
4140
  if (isValidElement(menuItem)) {
4143
4141
  const isSelected = selectedItems.includes((_a = menuItem.props.id) !== null && _a !== void 0 ? _a : `${index}`) || menuItem.props.selected;
4144
- return (jsx("div", { children: cloneElement(menuItem, {
4145
- ...menuItem.props,
4146
- onClick: (event) => {
4147
- var _a, _b, _c;
4148
- (_b = (_a = menuItem.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
4149
- handleItemClick((_c = menuItem.props.id) !== null && _c !== void 0 ? _c : `${index}`, menuItem.props.disabled);
4150
- },
4151
- className: isMulti && isSelected
4152
- ? cvaMenuListMultiSelect({ className: menuItem.props.className })
4153
- : cvaMenuListItem({ className: menuItem.props.className }),
4154
- selected: isSelected,
4155
- suffix: isMulti && isSelected ? jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : null,
4156
- }) }, index));
4142
+ return cloneElement(menuItem, {
4143
+ ...menuItem.props,
4144
+ key: index,
4145
+ onClick: (event) => {
4146
+ var _a, _b, _c;
4147
+ (_b = (_a = menuItem.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
4148
+ handleItemClick((_c = menuItem.props.id) !== null && _c !== void 0 ? _c : `${index}`, menuItem.props.disabled);
4149
+ },
4150
+ className: isMulti && isSelected
4151
+ ? cvaMenuListMultiSelect({ className: menuItem.props.className })
4152
+ : cvaMenuListItem({ className: menuItem.props.className }),
4153
+ selected: isSelected,
4154
+ suffix: (_b = menuItem.props.suffix) !== null && _b !== void 0 ? _b : (isMulti && isSelected ? jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : null),
4155
+ });
4157
4156
  }
4158
4157
  return null;
4159
4158
  }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -22,7 +22,7 @@
22
22
  "@trackunit/ui-design-tokens": "^1.0.1",
23
23
  "@trackunit/css-class-variance-utilities": "^1.0.1",
24
24
  "@trackunit/shared-utils": "^1.0.3",
25
- "@trackunit/ui-icons": "^1.0.2",
25
+ "@trackunit/ui-icons": "^1.0.3",
26
26
  "@trackunit/react-table-pagination": "^1.0.1"
27
27
  },
28
28
  "module": "./index.esm.js",
@@ -1,5 +1,5 @@
1
1
  import { HeightSizeLimit, WidthSizeLimit } from "./PopoverTypes";
2
- export declare const PADDING = 16;
2
+ export declare const PADDING = 12;
3
3
  type WidthValueParams = {
4
4
  value: WidthSizeLimit | undefined;
5
5
  referenceWidth: number;
@@ -1,8 +1,8 @@
1
1
  import { Dispatch, SetStateAction } from "react";
2
2
  /**
3
3
  * Use this hook if you want to optionally elevate the state of a component.
4
- * Useful when you want to optionally be able to control the state of a component
5
- * from a parent componentbut keep the simplicity of not having to.
4
+ * Useful when you _want_ to be able to control the state of a component
5
+ * from a parent component but keep the simplicity of not _having_ to.
6
6
  *
7
7
  * If no custom state is provided, the fallback state will be used and it works like a normal useState hook.
8
8
  */