@yakad/ui 1.3.144 → 1.3.146

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.
@@ -15,7 +15,7 @@ import classNames from "classnames";
15
15
  import boxingStyles from "../boxing.module.css";
16
16
  import styles from "./Stack.module.css";
17
17
  export const Stack = forwardRef(function Stack(_a, ref) {
18
- var { align, fullWidth, className, children } = _a, restProps = __rest(_a, ["align", "fullWidth", "className", "children"]);
18
+ var { align, fullWidth = true, className, children } = _a, restProps = __rest(_a, ["align", "fullWidth", "className", "children"]);
19
19
  const joinedClassNames = classNames(boxingStyles.flexColumnBox, { [boxingStyles[align]]: align }, { fullWidth: fullWidth }, styles.stack, className);
20
20
  return (_jsx("div", Object.assign({ ref: ref }, restProps, { className: joinedClassNames, children: children })));
21
21
  });
@@ -21,6 +21,5 @@ export interface WithInteractionsProps extends StackProps {
21
21
  onMouseHoverChange?: (isHover: boolean, e: MouseEvent) => void;
22
22
  onMouseHoverStart?: (e: MouseEvent) => void;
23
23
  onMouseHoverLeave?: (e: MouseEvent) => void;
24
- children?: React.ReactNode;
25
24
  }
26
- export declare const WithInteractions: import("react").ForwardRefExoticComponent<WithInteractionsProps & import("react").RefAttributes<HTMLElement>>;
25
+ export declare const WithInteractions: import("react").ForwardRefExoticComponent<WithInteractionsProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,14 +1,14 @@
1
1
  import { RefObject } from "react";
2
- import { Dropdown, DropdownProps, Popup, PopupProps } from "..";
2
+ import { Dropdown, DropdownProps, Popup, PopupProps, WithInteractionsProps } from "..";
3
3
  export interface OverlayProps {
4
4
  triggerref?: RefObject<HTMLElement | null>;
5
5
  onClose?: () => void;
6
6
  }
7
7
  type AllowedOverlays = React.ReactElement<PopupProps, typeof Popup> | React.ReactElement<DropdownProps, typeof Dropdown>;
8
- export interface WithOverlayProps {
8
+ export interface WithOverlayProps extends WithInteractionsProps {
9
9
  trigger?: "onClick" | "onRightClick";
10
10
  overlay?: AllowedOverlays;
11
11
  children?: React.ReactElement;
12
12
  }
13
- export declare function WithOverlay({ trigger, overlay, children, }: WithOverlayProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare const WithOverlay: import("react").ForwardRefExoticComponent<WithOverlayProps & import("react").RefAttributes<HTMLDivElement>>;
14
14
  export {};
@@ -1,11 +1,25 @@
1
1
  "use client";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
2
13
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState, cloneElement, useEffect, useRef } from "react";
4
- import { WithInteractions, } from "..";
14
+ import { useState, cloneElement, useEffect, useRef, forwardRef, useImperativeHandle, } from "react";
5
15
  import { createPortal } from "react-dom";
6
- export function WithOverlay({ trigger = "onClick", overlay, children, }) {
16
+ import { WithInteractions, } from "..";
17
+ export const WithOverlay = forwardRef(function WithOverlay(_a, forwardedRef) {
18
+ var { trigger = "onClick", overlay, children, onRightClick, onClick } = _a, restProps = __rest(_a, ["trigger", "overlay", "children", "onRightClick", "onClick"]);
7
19
  // Get Triggers ref and send to Overlay
8
20
  const triggerRef = useRef(null);
21
+ // Let the parent access our DOM node
22
+ useImperativeHandle(forwardedRef, () => triggerRef.current);
9
23
  const [showOverlay, setShowOverlay] = useState(false);
10
24
  // Disable Body Scroll on showOverlay
11
25
  useEffect(() => {
@@ -23,6 +37,13 @@ export function WithOverlay({ trigger = "onClick", overlay, children, }) {
23
37
  (_b = (_a = overlay.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
24
38
  setShowOverlay(false);
25
39
  },
26
- }), document.getElementsByClassName("portalRoot")[0] || document.body);
27
- return (_jsxs(_Fragment, { children: [_jsx(WithInteractions, { ref: triggerRef, onRightClick: () => trigger === "onRightClick" && setShowOverlay(true), onClick: () => trigger === "onClick" && setShowOverlay(true), children: children }), showOverlay && teleport] }));
28
- }
40
+ }), document.getElementsByClassName("portalRoot")[0] ||
41
+ document.body);
42
+ return (_jsxs(_Fragment, { children: [_jsx(WithInteractions, Object.assign({ ref: triggerRef }, restProps, { onRightClick: (e) => {
43
+ trigger === "onRightClick" && setShowOverlay(true);
44
+ onRightClick === null || onRightClick === void 0 ? void 0 : onRightClick(e);
45
+ }, onClick: (e) => {
46
+ trigger === "onClick" && setShowOverlay(true);
47
+ onClick === null || onClick === void 0 ? void 0 : onClick(e);
48
+ }, children: children })), showOverlay && teleport] }));
49
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yakad/ui",
3
- "version": "1.3.144",
3
+ "version": "1.3.146",
4
4
  "private": false,
5
5
  "author": "Natiq",
6
6
  "description": "UI components for NextJS/React",