@trackunit/react-components 0.0.193 → 0.0.195

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.
@@ -7,6 +7,7 @@ export interface StyledButtonProps {
7
7
  $square: boolean;
8
8
  $color: ButtonColor;
9
9
  $fullWidth: boolean;
10
+ $as: keyof JSX.IntrinsicElements | React.ComponentType<unknown>;
10
11
  }
11
12
  export interface ButtonProps extends ButtonCommonProps {
12
13
  onClick?: (event: React.MouseEvent<HTMLElement>) => void;
package/index.css CHANGED
@@ -185,6 +185,20 @@
185
185
  box-border;
186
186
  }
187
187
  }
188
+
189
+ &__disabled {
190
+ @apply cursor-not-allowed
191
+ pointer-events-none
192
+ bg-slate-200
193
+ hover:bg-slate-200
194
+ text-slate-400;
195
+ }
196
+
197
+ &__disabled--transparent {
198
+ @apply cursor-not-allowed
199
+ pointer-events-none
200
+ hover:bg-transparent;
201
+ }
188
202
  }
189
203
 
190
204
  /* CSS related to the LAbel component */
package/index.js CHANGED
@@ -11,6 +11,7 @@ import { useFloating, offset, shift, flip, autoUpdate, useInteractions, useClick
11
11
  import { Link, UNSAFE_NavigationContext } from 'react-router-dom';
12
12
  import { DayPicker as DayPicker$1 } from 'react-day-picker';
13
13
  import { enGB, enUS, da, de, cs, nl, fr, fi, hu, it, nb, pl, pt, ru, ro, es, sv, ja, th } from 'date-fns/locale';
14
+ import { useClickOutside } from 'react-browser-hooks';
14
15
  import usePortal from 'react-useportal';
15
16
  import { Helmet } from 'react-helmet';
16
17
  import ReactSelect, { components } from 'react-select';
@@ -261,8 +262,9 @@ const Button = React.forwardRef((_a, ref) => {
261
262
  });
262
263
  const StyledButton$1 = tw.button`
263
264
  tu-button
264
- ${p => p.$square ? tws`tu-button--square` : null}
265
- ${p => p.$fullWidth ? tws`tu-button--full-width` : null}
265
+ ${p => p.$square && tws`tu-button--square`}
266
+ ${p => p.$fullWidth && tws`tu-button--full-width`}
267
+ ${p => p.disabled && p.$as !== "button" && (p.$variant === "transparent" ? tws`tu-button__disabled--transparent` : tws`tu-button__disabled`)}
266
268
  ${getStyles()}
267
269
  ${getPadding()}
268
270
  `;
@@ -2760,7 +2762,12 @@ const MoreMenu = ({
2760
2762
  }) => {
2761
2763
  const [actionMenuIsOpen, setActionMenuIsOpen] = useState(false);
2762
2764
  const dotsName = dotsDirection === DotsDirection.horizontal ? "DotsHorizontalIcon" : "DotsVerticalIcon";
2765
+ const actionMenuRef = useRef(null);
2766
+ useClickOutside(actionMenuRef, () => {
2767
+ setActionMenuIsOpen(false);
2768
+ });
2763
2769
  return jsxs(Root$3, Object.assign({
2770
+ ref: actionMenuRef,
2764
2771
  className: className,
2765
2772
  "data-testid": dataTestId
2766
2773
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.193",
3
+ "version": "0.0.195",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {
@@ -15,6 +15,7 @@
15
15
  "date-fns": "^2.29.3",
16
16
  "react-day-picker": "^8.3.0",
17
17
  "@trackunit/ui-icons": "0.0.53",
18
+ "react-browser-hooks": "^2.2.4",
18
19
  "react-useportal": "1.0.17",
19
20
  "@floating-ui/react-dom-interactions": "^0.10.1",
20
21
  "react-router-dom": "6.4.1",