@trackunit/react-components 1.0.12 → 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,
@@ -3938,7 +3937,7 @@ const cvaMenuList = cssClassVarianceUtilities.cvaMerge([
3938
3937
  });
3939
3938
  const cvaMenuListDivider = cssClassVarianceUtilities.cvaMerge(["mx-[-4px]", "my-1", "min-h-px", "bg-slate-300"]);
3940
3939
  const cvaMenuListMultiSelect = cssClassVarianceUtilities.cvaMerge("hover:!bg-blue-200");
3941
- const cvaMenuListItem = cssClassVarianceUtilities.cvaMerge("max-w-[292px]");
3940
+ const cvaMenuListItem = cssClassVarianceUtilities.cvaMerge("max-w-full");
3942
3941
 
3943
3942
  /**
3944
3943
  * The MenuDivider component is used to separate items in a menu list.
@@ -4122,7 +4121,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
4122
4121
  }), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
4123
4122
  stopPropagation && e.stopPropagation();
4124
4123
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
4125
- }, 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] }));
4126
4125
  };
4127
4126
 
4128
4127
  /**
@@ -4157,22 +4156,23 @@ const MenuList = ({ dataTestId, className, children, withStickyHeader = false, i
4157
4156
  }
4158
4157
  }, [isMulti, selectedItems, onSelectionChange]);
4159
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) => {
4160
- var _a;
4159
+ var _a, _b;
4161
4160
  if (React.isValidElement(menuItem)) {
4162
4161
  const isSelected = selectedItems.includes((_a = menuItem.props.id) !== null && _a !== void 0 ? _a : `${index}`) || menuItem.props.selected;
4163
- return (jsxRuntime.jsx("div", { children: React.cloneElement(menuItem, {
4164
- ...menuItem.props,
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: isMulti && isSelected ? jsxRuntime.jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : null,
4175
- }) }, 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
+ });
4176
4176
  }
4177
4177
  return null;
4178
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,
@@ -3918,7 +3917,7 @@ const cvaMenuList = cvaMerge([
3918
3917
  });
3919
3918
  const cvaMenuListDivider = cvaMerge(["mx-[-4px]", "my-1", "min-h-px", "bg-slate-300"]);
3920
3919
  const cvaMenuListMultiSelect = cvaMerge("hover:!bg-blue-200");
3921
- const cvaMenuListItem = cvaMerge("max-w-[292px]");
3920
+ const cvaMenuListItem = cvaMerge("max-w-full");
3922
3921
 
3923
3922
  /**
3924
3923
  * The MenuDivider component is used to separate items in a menu list.
@@ -4102,7 +4101,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
4102
4101
  }), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
4103
4102
  stopPropagation && e.stopPropagation();
4104
4103
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
4105
- }, 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] }));
4106
4105
  };
4107
4106
 
4108
4107
  /**
@@ -4137,22 +4136,23 @@ const MenuList = ({ dataTestId, className, children, withStickyHeader = false, i
4137
4136
  }
4138
4137
  }, [isMulti, selectedItems, onSelectionChange]);
4139
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) => {
4140
- var _a;
4139
+ var _a, _b;
4141
4140
  if (isValidElement(menuItem)) {
4142
4141
  const isSelected = selectedItems.includes((_a = menuItem.props.id) !== null && _a !== void 0 ? _a : `${index}`) || menuItem.props.selected;
4143
- return (jsx("div", { children: cloneElement(menuItem, {
4144
- ...menuItem.props,
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: isMulti && isSelected ? jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : null,
4155
- }) }, 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
+ });
4156
4156
  }
4157
4157
  return null;
4158
4158
  }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.0.12",
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
  */