@yakad/ui 1.3.121 → 1.3.122
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/dist/Popup/Popup.d.ts +1 -1
- package/dist/Popup/Popup.js +2 -2
- package/dist/WithOverlay/WithOverlay.d.ts +11 -0
- package/dist/WithOverlay/WithOverlay.js +23 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/WithPopup/WithPopup.d.ts +0 -12
- package/dist/WithPopup/WithPopup.js +0 -27
package/dist/Popup/Popup.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CardProps } from "..";
|
|
|
3
3
|
export interface PopupProps extends CardProps {
|
|
4
4
|
align?: "start" | "space" | "center" | "end";
|
|
5
5
|
heading?: string;
|
|
6
|
-
|
|
6
|
+
onClose?: () => void;
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
}
|
|
9
9
|
export declare const Popup: import("react").ForwardRefExoticComponent<PopupProps & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/Popup/Popup.js
CHANGED
|
@@ -16,6 +16,6 @@ import { Symbol } from "@yakad/symbols";
|
|
|
16
16
|
import { Button, Card, Row, Spacer, Stack, Text, WithInteractions, } from "..";
|
|
17
17
|
import styles from "./Popup.module.css";
|
|
18
18
|
export const Popup = forwardRef(function Popup(_a, ref) {
|
|
19
|
-
var { align, heading,
|
|
20
|
-
return (_jsx("div", { className: styles.popupscreen, children: _jsx(WithInteractions, { onOutsideClick:
|
|
19
|
+
var { align, heading, onClose, className, children } = _a, restProps = __rest(_a, ["align", "heading", "onClose", "className", "children"]);
|
|
20
|
+
return (_jsx("div", { className: styles.popupscreen, children: _jsx(WithInteractions, { onOutsideClick: onClose, children: _jsxs(Card, Object.assign({ ref: ref }, restProps, { className: classNames(styles.popup, className), children: [_jsxs(Row, { style: { marginBottom: "2rem" }, children: [_jsx(Text, { variant: "heading4", children: heading }), _jsx(Spacer, {}), _jsx(Button, { title: "Close", icon: _jsx(Symbol, { icon: "close" }), onClick: onClose })] }), _jsx(Stack, { align: align, style: { width: "100%", overflowY: "auto" }, children: children })] })) }) }));
|
|
21
21
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface WithPopupProps {
|
|
3
|
+
trigger?: "onClick" | "onRightClick";
|
|
4
|
+
overlay?: React.ReactElement<{
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
}>;
|
|
7
|
+
children?: React.ReactElement<{
|
|
8
|
+
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export declare function WithOverlay({ trigger, overlay, children, }: WithPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, cloneElement } from "react";
|
|
4
|
+
import { WithInteractions } from "..";
|
|
5
|
+
export function WithOverlay({ trigger = "onClick", overlay, children, }) {
|
|
6
|
+
const [showOverlay, setShowOverlay] = useState(false);
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsx(WithInteractions, { onRightClick: () => trigger === "onRightClick" && setShowOverlay(true), children: children &&
|
|
8
|
+
cloneElement(children, {
|
|
9
|
+
onClick: (e) => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
(_b = (_a = children.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
12
|
+
trigger === "onClick" && setShowOverlay(true);
|
|
13
|
+
},
|
|
14
|
+
}) }), showOverlay &&
|
|
15
|
+
overlay &&
|
|
16
|
+
cloneElement(overlay, {
|
|
17
|
+
onClose: () => {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
(_b = (_a = overlay.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
20
|
+
setShowOverlay(false);
|
|
21
|
+
},
|
|
22
|
+
})] }));
|
|
23
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { PopupProps } from "..";
|
|
3
|
-
export interface WithPopupProps extends Omit<PopupProps, "onCloseButtClick"> {
|
|
4
|
-
align?: "start" | "space" | "center" | "end";
|
|
5
|
-
blur?: boolean;
|
|
6
|
-
trigger?: "onClick" | "onRightClick";
|
|
7
|
-
popupChildren?: React.ReactElement;
|
|
8
|
-
children?: React.ReactElement<{
|
|
9
|
-
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
10
|
-
}>;
|
|
11
|
-
}
|
|
12
|
-
export declare function WithPopup({ trigger, popupChildren, children, ...restProps }: WithPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
};
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { useState, cloneElement } from "react";
|
|
15
|
-
import { Popup, WithInteractions } from "..";
|
|
16
|
-
export function WithPopup(_a) {
|
|
17
|
-
var { trigger = "onClick", popupChildren, children } = _a, restProps = __rest(_a, ["trigger", "popupChildren", "children"]);
|
|
18
|
-
const [showPopup, setShowPopup] = useState(false);
|
|
19
|
-
return (_jsxs("div", { children: [_jsx(WithInteractions, { onRightClick: () => trigger === "onRightClick" && setShowPopup(true), children: children &&
|
|
20
|
-
cloneElement(children, {
|
|
21
|
-
onClick: (e) => {
|
|
22
|
-
var _a, _b;
|
|
23
|
-
(_b = (_a = children.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
24
|
-
trigger === "onClick" && setShowPopup(true);
|
|
25
|
-
},
|
|
26
|
-
}) }), _jsx("div", { children: showPopup && (_jsx(Popup, Object.assign({ onCloseButtClick: () => setShowPopup(false) }, restProps, { children: popupChildren }))) })] }));
|
|
27
|
-
}
|