@trackunit/react-components 0.1.24 → 0.1.26

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.js CHANGED
@@ -705,7 +705,7 @@ const StyledHeading = tw.div `
705
705
  * @returns {JSX.Element} CardHeader component
706
706
  */
707
707
  const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
708
- return (jsx(Root$8, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density }, { children: jsxs(Container$6, { children: [jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxs(HeadingContainer$1, { children: [jsx(Heading$1, Object.assign({ variant: headingVariant }, { children: heading })), accessories] }), subHeading && (jsx(Heading$1, Object.assign({ subtle: true, variant: "subtitle" }, { children: subHeading }))), children] })), onClose && (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XIcon", size: "small" }), className: "self-start" }))] }) })));
708
+ return (jsx(Root$8, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density }, { children: jsxs(Container$6, { children: [jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxs(HeadingContainer$1, { children: [jsx(Heading$1, Object.assign({ className: "self-center", variant: headingVariant }, { children: heading })), accessories] }), subHeading && (jsx(Heading$1, Object.assign({ subtle: true, variant: "subtitle" }, { children: subHeading }))), children] })), onClose && (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XIcon", size: "small" }), className: "!h-min" }))] }) })));
709
709
  };
710
710
  const Root$8 = twx(DensityContainer) `
711
711
  tu-card__header-density-container
@@ -2200,6 +2200,7 @@ tu-select__counter
2200
2200
  * @returns {Partial<SelectComponents<Option, boolean, GroupBase<Option>>> | undefined} components object to override react-select default components
2201
2201
  */
2202
2202
  const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon) => {
2203
+ // perhaps it should not be wrap in memo (causing some issues with opening and closing on mobiles)
2203
2204
  const customComponents = React.useMemo(() => {
2204
2205
  return Object.assign({ ValueContainer: props => {
2205
2206
  if (props.isMulti) {
@@ -2237,18 +2238,19 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
2237
2238
  }, LoadingIndicator: props => {
2238
2239
  return jsx(Spinner, { size: "small", className: tws `mt-1.5 mr-1` });
2239
2240
  }, DropdownIndicator: props => {
2240
- return props.selectProps.isLoading ? null : (jsx(components.DropdownIndicator, Object.assign({}, props, { children: jsx(StyledIcon, { children: dropdownIcon ? (dropdownIcon) : menuIsOpen ? (jsx(Icon, { name: "ChevronUpIcon", size: "medium" })) : (jsx(Icon, { name: "ChevronDownIcon", size: "medium" })) }) })));
2241
+ const icon = props.selectProps.menuIsOpen ? (jsx(Icon, { name: "ChevronUpIcon", size: "medium" })) : (jsx(Icon, { name: "ChevronDownIcon", size: "medium" }));
2242
+ return props.selectProps.isLoading ? null : (jsx(components.DropdownIndicator, Object.assign({}, props, { children: jsx(StyledIcon, { children: dropdownIcon ? dropdownIcon : icon }) })));
2241
2243
  }, IndicatorSeparator: () => null, ClearIndicator: props => {
2242
2244
  if (disabled) {
2243
2245
  return null;
2244
2246
  }
2245
2247
  return (jsx(components.ClearIndicator, Object.assign({}, props, { children: jsx(XIcon, Object.assign({ onClick: props.clearValue, "data-testid": `${dataTestId}-XIcon` }, { children: jsx(Icon, { name: "XCircleIcon", size: "medium" }) })) })));
2246
2248
  }, Control: props => {
2247
- return (jsx(components.Control, Object.assign({}, props, { innerProps: Object.assign(Object.assign({}, props.innerProps), { onTouchEnd: () => null }), className: props.isDisabled ? tws `tu-select__control--disabled` : "" })));
2249
+ return (jsx(components.Control, Object.assign({}, props, { className: props.isDisabled ? tws `tu-select__control--disabled` : "" })));
2248
2250
  }, SingleValue: props => {
2249
2251
  return (jsx(components.SingleValue, Object.assign({}, props, { className: props.isDisabled ? tws `tu-select__single-value--disabled` : "" }, { children: jsx("div", Object.assign({ "data-testid": dataTestId + "-singleValue" }, { children: props.children })) })));
2250
2252
  }, Menu: props => {
2251
- return (jsx(components.Menu, Object.assign({}, props, { className: menuIsOpen
2253
+ return (jsx(components.Menu, Object.assign({}, props, { className: props.selectProps.menuIsOpen
2252
2254
  ? tws `tu-select__menu-list animate-fade-in-fast`
2253
2255
  : tws `tu-select__menu-list animate-fade-out-fast` })));
2254
2256
  }, Option: props => {
@@ -2261,7 +2263,7 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
2261
2263
  return (jsx(components.Option, Object.assign({}, props, { innerProps: Object.assign(Object.assign({}, props.innerProps), { role: "option", onClick: () => { } }) }, { children: props.isMulti ? (jsx(MultiSelectMenuItem, Object.assign({}, componentProps, { disabled: disabled, dataTestId: props.label }))) : (jsx(SingleSelectMenuItem, Object.assign({}, componentProps, { disabled: disabled || props.isDisabled, dataTestId: props.label }))) })));
2262
2264
  } }, componentsProps);
2263
2265
  // eslint-disable-next-line react-hooks/exhaustive-deps
2264
- }, [componentsProps, disabled, menuIsOpen, refMenuIsEnabled, maxSelectedDisplayCount]); // do not add dropdownIcon (it will cause issue with opening/closing list for selects with custom icon)
2266
+ }, [componentsProps, disabled, maxSelectedDisplayCount]); // do not add dropdownIcon (it will cause issue with opening/closing list for selects with custom icon)
2265
2267
  return customComponents;
2266
2268
  };
2267
2269
  const StyledIcon = tw.div `
@@ -3009,7 +3011,7 @@ const GridArea = ({ area, dataTestId, className, children }) => (jsx("section",
3009
3011
  * @param {IntrinsicallyResponsiveGridProps} props - The props for the IntrinsicallyResponsiveGrid component
3010
3012
  * @returns {JSX.Element} IntrinsicallyResponsiveGrid component
3011
3013
  */
3012
- const IntrinsicallyResponsiveGrid = ({ children, occupation = "auto-fill", minColumnWidth = "md", gap = "auto", dataTestId, className, }) => (jsx(Layout$2, Object.assign({ "$minColumnWidth": minColumnWidth, "data-testid": dataTestId, "$gap": gap, "$occupation": occupation, className: className }, { children: children })));
3014
+ const IntrinsicallyResponsiveGrid = ({ children, occupation = "auto-fill", minColumnWidth = "md", rowHeight = "1fr", gap = "auto", dataTestId, className, }) => (jsx(Layout$2, Object.assign({ "$minColumnWidth": minColumnWidth, "data-testid": dataTestId, "$gap": gap, "$rowHeight": rowHeight, "$occupation": occupation, className: className }, { children: children })));
3013
3015
  const Layout$2 = tw.span `
3014
3016
  tu-layout-IntrinsicallyResponsiveGrid
3015
3017
  ${({ $occupation }) => {
@@ -3063,6 +3065,16 @@ const Layout$2 = tw.span `
3063
3065
  return tws `tu-gap-responsive`;
3064
3066
  }
3065
3067
  }};
3068
+
3069
+ ${({ $rowHeight }) => {
3070
+ switch ($rowHeight) {
3071
+ case "auto":
3072
+ return tws `tu-layout-IntrinsicallyResponsiveGrid--row-auto`;
3073
+ case "1fr":
3074
+ default:
3075
+ return tws `tu-layout-IntrinsicallyResponsiveGrid--row-1fr`;
3076
+ }
3077
+ }};
3066
3078
  `;
3067
3079
 
3068
3080
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { CommonProps } from "../../common/CommonProps";
3
3
  type ColumnWidth = "xs" | "sm" | "md" | "lg" | "xl";
4
+ type RowHeight = "auto" | "1fr";
4
5
  type Space = "inherit" | "auto" | "none" | "tiny" | "mini" | "small" | "medium" | "large" | "giant" | "enormous";
5
6
  type Occupation = "auto-fill" | "auto-fit";
6
7
  interface IntrinsicallyResponsiveGridProps extends CommonProps {
@@ -14,6 +15,7 @@ interface IntrinsicallyResponsiveGridProps extends CommonProps {
14
15
  */
15
16
  occupation?: Occupation;
16
17
  minColumnWidth?: ColumnWidth;
18
+ rowHeight?: RowHeight;
17
19
  /**
18
20
  * The gap size between children
19
21
  */
@@ -26,5 +28,5 @@ interface IntrinsicallyResponsiveGridProps extends CommonProps {
26
28
  * @param {IntrinsicallyResponsiveGridProps} props - The props for the IntrinsicallyResponsiveGrid component
27
29
  * @returns {JSX.Element} IntrinsicallyResponsiveGrid component
28
30
  */
29
- export declare const IntrinsicallyResponsiveGrid: ({ children, occupation, minColumnWidth, gap, dataTestId, className, }: IntrinsicallyResponsiveGridProps) => JSX.Element;
31
+ export declare const IntrinsicallyResponsiveGrid: ({ children, occupation, minColumnWidth, rowHeight, gap, dataTestId, className, }: IntrinsicallyResponsiveGridProps) => JSX.Element;
30
32
  export {};