@yakad/ui 1.3.163 → 1.3.165
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/ActiveOnVisible/ActiveOnVisible.js +2 -1
- package/dist/AppBar/AppBar.d.ts +1 -1
- package/dist/AppBar/AppBar.js +2 -2
- package/dist/Avatar/Avatar.d.ts +1 -1
- package/dist/Avatar/Avatar.js +2 -2
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/Button.js +2 -2
- package/dist/Card/Card.d.ts +1 -1
- package/dist/Card/Card.js +2 -2
- package/dist/CheckBox/CheckBox.d.ts +1 -1
- package/dist/CheckBox/CheckBox.js +2 -2
- package/dist/CodeBox/CodeBox.d.ts +2 -3
- package/dist/CodeBox/CodeBox.js +2 -2
- package/dist/CodeField/CodeField.d.ts +1 -1
- package/dist/CodeField/CodeField.js +2 -2
- package/dist/Container/Container.d.ts +1 -1
- package/dist/Container/Container.js +2 -2
- package/dist/Display/Display.d.ts +1 -1
- package/dist/Display/Display.js +2 -2
- package/dist/Dropdown/Dropdown.d.ts +2 -1
- package/dist/Dropdown/Dropdown.js +18 -4
- package/dist/Footer/Footer.d.ts +1 -1
- package/dist/Footer/Footer.js +2 -2
- package/dist/Form/Form.d.ts +1 -1
- package/dist/Form/Form.js +2 -2
- package/dist/GridContainer/GridContainer.d.ts +1 -1
- package/dist/GridContainer/GridContainer.js +2 -2
- package/dist/GridItem/GridItem.d.ts +1 -1
- package/dist/GridItem/GridItem.js +2 -2
- package/dist/Hr/Hr.d.ts +2 -3
- package/dist/Hr/Hr.js +2 -2
- package/dist/InputField/InputField.d.ts +1 -1
- package/dist/InputField/InputField.js +2 -2
- package/dist/List/List.d.ts +2 -3
- package/dist/List/List.js +2 -2
- package/dist/ListItem/ListItem.d.ts +2 -3
- package/dist/ListItem/ListItem.js +2 -2
- package/dist/LoadingIcon/LoadingIcon.d.ts +2 -3
- package/dist/LoadingIcon/LoadingIcon.js +2 -2
- package/dist/Main/Main.d.ts +2 -3
- package/dist/Main/Main.js +2 -2
- package/dist/Navigation/Navigation.d.ts +2 -3
- package/dist/Navigation/Navigation.js +2 -2
- package/dist/Popup/Popup.d.ts +2 -1
- package/dist/Popup/Popup.js +18 -4
- package/dist/RadioButton/RadioButton.d.ts +1 -1
- package/dist/RadioButton/RadioButton.js +2 -2
- package/dist/RadioGroup/RadioGroup.d.ts +2 -3
- package/dist/RadioGroup/RadioGroup.js +2 -2
- package/dist/RenderByScroll/RenderByScroll.d.ts +1 -1
- package/dist/RenderByScroll/RenderByScroll.js +4 -3
- package/dist/Row/Row.d.ts +2 -3
- package/dist/Row/Row.js +2 -2
- package/dist/Screen/Screen.d.ts +2 -3
- package/dist/Screen/Screen.js +2 -2
- package/dist/Select/Select.d.ts +2 -3
- package/dist/Select/Select.js +2 -2
- package/dist/Spacer/Spacer.d.ts +2 -3
- package/dist/Spacer/Spacer.js +2 -2
- package/dist/Stack/Stack.d.ts +1 -1
- package/dist/Stack/Stack.js +2 -2
- package/dist/SvgIcon/SvgIcon.d.ts +2 -3
- package/dist/SvgIcon/SvgIcon.js +2 -2
- package/dist/Table/Table.d.ts +14 -21
- package/dist/Table/Table.js +14 -14
- package/dist/Text/Text.d.ts +9 -9
- package/dist/Text/Text.js +18 -18
- package/dist/Theme/Theme.d.ts +1 -1
- package/dist/Theme/Theme.js +2 -2
- package/dist/WithOverlay/WithOverlay.js +12 -23
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -10
- package/package.json +2 -1
- package/dist/interactionHooks/useOnDoubleTap.d.ts +0 -2
- package/dist/interactionHooks/useOnDoubleTap.js +0 -23
- package/dist/interactionHooks/useOnHoverChange.d.ts +0 -2
- package/dist/interactionHooks/useOnHoverChange.js +0 -23
- package/dist/interactionHooks/useOnOutsideClick.d.ts +0 -2
- package/dist/interactionHooks/useOnOutsideClick.js +0 -21
- package/dist/interactionHooks/useOnPinch.d.ts +0 -2
- package/dist/interactionHooks/useOnPinch.js +0 -35
- package/dist/interactionHooks/useOnResizeChange.d.ts +0 -2
- package/dist/interactionHooks/useOnResizeChange.js +0 -23
- package/dist/interactionHooks/useOnRightClick.d.ts +0 -2
- package/dist/interactionHooks/useOnRightClick.js +0 -19
- package/dist/interactionHooks/useOnRotate.d.ts +0 -2
- package/dist/interactionHooks/useOnRotate.js +0 -36
- package/dist/interactionHooks/useOnScroll.d.ts +0 -2
- package/dist/interactionHooks/useOnScroll.js +0 -29
- package/dist/interactionHooks/useOnSwipe.d.ts +0 -2
- package/dist/interactionHooks/useOnSwipe.js +0 -53
- package/dist/interactionHooks/useOnVisibilityChange.d.ts +0 -2
- package/dist/interactionHooks/useOnVisibilityChange.js +0 -21
|
@@ -12,7 +12,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { useImperativeHandle, useRef, useState } from "react";
|
|
15
|
-
import { Stack
|
|
15
|
+
import { Stack } from "..";
|
|
16
|
+
import { useOnVisibilityChange } from "@yakad/use-interactions";
|
|
16
17
|
export function ActiveOnVisible(_a) {
|
|
17
18
|
var { onVisibilityChange, style, children, ref } = _a, restProps = __rest(_a, ["onVisibilityChange", "style", "children", "ref"]);
|
|
18
19
|
const localRef = useRef(null);
|
package/dist/AppBar/AppBar.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export interface AppBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
ref?: React.Ref<HTMLDivElement>;
|
|
10
10
|
}
|
|
11
|
-
export declare function AppBar({ align, overflow, position, size, blur, className, children,
|
|
11
|
+
export declare function AppBar({ align, overflow, position, size, blur, className, children, ...restProps }: AppBarProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/AppBar/AppBar.js
CHANGED
|
@@ -16,7 +16,7 @@ import classNames from "classnames";
|
|
|
16
16
|
import boxingStyles from "../boxing.module.css";
|
|
17
17
|
import styles from "./AppBar.module.css";
|
|
18
18
|
export function AppBar(_a) {
|
|
19
|
-
var { align, overflow = "shrink", position = "initial", size, blur, className, children
|
|
19
|
+
var { align, overflow = "shrink", position = "initial", size, blur, className, children } = _a, restProps = __rest(_a, ["align", "overflow", "position", "size", "blur", "className", "children"]);
|
|
20
20
|
const [show, setShow] = useState(true);
|
|
21
21
|
const [lastScrollY, setLastScrollY] = useState(0);
|
|
22
22
|
useEffect(() => {
|
|
@@ -40,5 +40,5 @@ export function AppBar(_a) {
|
|
|
40
40
|
const joinedClassNames = classNames(boxingStyles.flexRowBox, { [boxingStyles[align]]: align }, boxingStyles[overflow], styles.header, {
|
|
41
41
|
[styles.sticky]: position === "sticky" || position === "scroll",
|
|
42
42
|
}, { [styles.hidden]: position === "scroll" && !show }, { [styles[size]]: size }, { [styles.blur]: blur }, className);
|
|
43
|
-
return (_jsx("header", Object.assign({
|
|
43
|
+
return (_jsx("header", Object.assign({}, restProps, { className: joinedClassNames, children: children })));
|
|
44
44
|
}
|
package/dist/Avatar/Avatar.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
3
3
|
src?: string;
|
|
4
4
|
ref?: React.Ref<HTMLDivElement>;
|
|
5
5
|
}
|
|
6
|
-
export declare function Avatar({ src, className,
|
|
6
|
+
export declare function Avatar({ src, className, ...restProps }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/Avatar/Avatar.js
CHANGED
|
@@ -14,7 +14,7 @@ import classNames from "classnames";
|
|
|
14
14
|
import styles from "./Avatar.module.css";
|
|
15
15
|
import { Symbol } from "@yakad/symbols";
|
|
16
16
|
export function Avatar(_a) {
|
|
17
|
-
var { src, className
|
|
17
|
+
var { src, className } = _a, restProps = __rest(_a, ["src", "className"]);
|
|
18
18
|
const joinedClassNames = classNames(styles.profileContainer, className);
|
|
19
|
-
return (_jsx("div", Object.assign({
|
|
19
|
+
return (_jsx("div", Object.assign({}, restProps, { className: joinedClassNames, style: src ? { backgroundImage: `url(${src})` } : {}, children: _jsx("div", { className: styles.editOverlay, children: _jsx(Symbol, { icon: "edit" }) }) })));
|
|
20
20
|
}
|
package/dist/Button/Button.d.ts
CHANGED
|
@@ -11,4 +11,4 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
11
11
|
children?: React.ReactNode;
|
|
12
12
|
ref?: React.Ref<HTMLButtonElement>;
|
|
13
13
|
}
|
|
14
|
-
export declare function Button({ fullWidthOnParentDemand, size, variant, borderStyle, icon, iconPosition, loadingPosition, loadingVariant, className, children,
|
|
14
|
+
export declare function Button({ fullWidthOnParentDemand, size, variant, borderStyle, icon, iconPosition, loadingPosition, loadingVariant, className, children, ...restProps }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/Button/Button.js
CHANGED
|
@@ -15,11 +15,11 @@ import { LoadingIcon } from "..";
|
|
|
15
15
|
import boxingStyles from "../boxing.module.css";
|
|
16
16
|
import styles from "./Button.module.css";
|
|
17
17
|
export function Button(_a) {
|
|
18
|
-
var { fullWidthOnParentDemand = false, size = "medium", variant = "text", borderStyle = "rounded", icon, iconPosition = "start", loadingPosition = "auto", loadingVariant, className, children
|
|
18
|
+
var { fullWidthOnParentDemand = false, size = "medium", variant = "text", borderStyle = "rounded", icon, iconPosition = "start", loadingPosition = "auto", loadingVariant, className, children } = _a, restProps = __rest(_a, ["fullWidthOnParentDemand", "size", "variant", "borderStyle", "icon", "iconPosition", "loadingPosition", "loadingVariant", "className", "children"]);
|
|
19
19
|
const childrenFirst = iconPosition === "end";
|
|
20
20
|
const isloadingPositionCenter = !icon || loadingPosition === "center";
|
|
21
21
|
const joinedClassNames = classNames({ [boxingStyles.fullWidthOnParentDemand]: fullWidthOnParentDemand }, styles.button, styles[variant], { [styles.loading]: loadingVariant }, { [styles.loadingPositionCenter]: isloadingPositionCenter }, styles[size], styles[borderStyle], { [styles.iconButton]: !children && icon }, className);
|
|
22
|
-
return (_jsxs("button", Object.assign({
|
|
22
|
+
return (_jsxs("button", Object.assign({ className: joinedClassNames }, restProps, { children: [childrenFirst && children, loadingVariant && (_jsx("div", { className: classNames(styles.displayOnDisabled, {
|
|
23
23
|
[styles.positionCenter]: isloadingPositionCenter,
|
|
24
24
|
}), children: _jsx(LoadingIcon, { size: size, variant: loadingVariant }) })), icon, !childrenFirst && children] })));
|
|
25
25
|
}
|
package/dist/Card/Card.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export interface CardProps extends StackProps {
|
|
|
6
6
|
hoverEffect?: boolean;
|
|
7
7
|
ref?: React.Ref<HTMLDivElement>;
|
|
8
8
|
}
|
|
9
|
-
export declare function Card({ blur, level, hoverEffect, className, children,
|
|
9
|
+
export declare function Card({ blur, level, hoverEffect, className, children, ...restProps }: CardProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/Card/Card.js
CHANGED
|
@@ -14,7 +14,7 @@ import classNames from "classnames";
|
|
|
14
14
|
import { Stack } from "..";
|
|
15
15
|
import styles from "./Card.module.css";
|
|
16
16
|
export function Card(_a) {
|
|
17
|
-
var { blur, level, hoverEffect, className, children
|
|
17
|
+
var { blur, level, hoverEffect, className, children } = _a, restProps = __rest(_a, ["blur", "level", "hoverEffect", "className", "children"]);
|
|
18
18
|
const joinedClassNames = classNames(styles.card, { [styles.blur]: blur }, { [styles.elevated]: level !== "transparent" }, { [styles.hoverEffect]: hoverEffect }, { [styles.yakadCardAutoLevel]: !level || level === "transparent" }, { [styles.yakadCardLowLevel]: level === "low" }, { [styles.yakadCardMidLevel]: level === "mid" }, { [styles.yakadCardHighLevel]: level === "high" }, className);
|
|
19
|
-
return (_jsx(Stack, Object.assign({
|
|
19
|
+
return (_jsx(Stack, Object.assign({}, restProps, { className: joinedClassNames, children: children })));
|
|
20
20
|
}
|
|
@@ -4,5 +4,5 @@ export interface CheckBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
4
4
|
label?: string;
|
|
5
5
|
ref?: React.Ref<HTMLInputElement>;
|
|
6
6
|
}
|
|
7
|
-
export declare function CheckBox({ label, className, style,
|
|
7
|
+
export declare function CheckBox({ label, className, style, ...restProps }: CheckBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -15,7 +15,7 @@ import { Symbol } from "@yakad/symbols";
|
|
|
15
15
|
import boxingStyles from "../boxing.module.css";
|
|
16
16
|
import styles from "./CheckBox.module.css";
|
|
17
17
|
export function CheckBox(_a) {
|
|
18
|
-
var { label, className, style
|
|
18
|
+
var { label, className, style } = _a, restProps = __rest(_a, ["label", "className", "style"]);
|
|
19
19
|
const joinedClassNames = classNames({ [boxingStyles.fullWidthOnParentDemand]: label }, styles.label, { [styles.labeled]: label }, { [styles.disabled]: restProps.disabled }, className);
|
|
20
|
-
return (_jsxs("label", { className: joinedClassNames, style: style, children: [label, _jsx("input", Object.assign({
|
|
20
|
+
return (_jsxs("label", { className: joinedClassNames, style: style, children: [label, _jsx("input", Object.assign({}, restProps, { className: styles.input, type: "checkbox" })), _jsxs("div", { className: styles.symbolContainer, children: [_jsx(Symbol, { className: styles.symbolChecked, icon: "check_box" }), _jsx(Symbol, { className: styles.symbolUnChecked, icon: "check_box_outline_blank" })] })] }));
|
|
21
21
|
}
|
|
@@ -2,7 +2,6 @@ import React from "react";
|
|
|
2
2
|
export interface CodeBoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
copyButton?: boolean;
|
|
4
4
|
children?: React.ReactNode;
|
|
5
|
-
}
|
|
6
|
-
export declare function CodeBox({ copyButton, className, children, ref, ...restProps }: CodeBoxProps & {
|
|
7
5
|
ref?: React.Ref<HTMLDivElement>;
|
|
8
|
-
}
|
|
6
|
+
}
|
|
7
|
+
export declare function CodeBox({ copyButton, className, children, ...restProps }: CodeBoxProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/CodeBox/CodeBox.js
CHANGED
|
@@ -16,7 +16,7 @@ import { Button, Card } from "..";
|
|
|
16
16
|
import boxingStyles from "../boxing.module.css";
|
|
17
17
|
import styles from "./CodeBox.module.css";
|
|
18
18
|
export function CodeBox(_a) {
|
|
19
|
-
var { copyButton, className, children
|
|
19
|
+
var { copyButton, className, children } = _a, restProps = __rest(_a, ["copyButton", "className", "children"]);
|
|
20
20
|
const joinedClassNames = classNames({ [boxingStyles.fullWidthOnParentDemand]: true }, styles.ZZZZZZZZZZ, className);
|
|
21
|
-
return (_jsxs(Card, Object.assign({
|
|
21
|
+
return (_jsxs(Card, Object.assign({}, restProps, { className: joinedClassNames, children: [_jsx("pre", { children: children }), copyButton && _jsx(Button, { icon: _jsx(Symbol, { icon: "copy_all" }) })] })));
|
|
22
22
|
}
|
|
@@ -6,5 +6,5 @@ export interface CodeFieldsProps extends Omit<React.InputHTMLAttributes<HTMLInpu
|
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
ref?: React.Ref<HTMLInputElement>;
|
|
8
8
|
}
|
|
9
|
-
export declare function CodeField({ length, onFilled, autoComplete, pattern, onInput, className, style,
|
|
9
|
+
export declare function CodeField({ length, onFilled, autoComplete, pattern, onInput, className, style, ...restProps }: CodeFieldsProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -31,10 +31,10 @@ function removeUnNumberChars(inputElement) {
|
|
|
31
31
|
inputElement.value = inputElement.value.replace(/[^0-9]+/, "");
|
|
32
32
|
}
|
|
33
33
|
export function CodeField(_a) {
|
|
34
|
-
var { length = 6, onFilled, autoComplete, pattern, onInput, className, style
|
|
34
|
+
var { length = 6, onFilled, autoComplete, pattern, onInput, className, style } = _a, restProps = __rest(_a, ["length", "onFilled", "autoComplete", "pattern", "onInput", "className", "style"]);
|
|
35
35
|
const joinedClassNames = classNames({ [boxingStyles.fullWidthOnParentDemand]: true }, styles.input, className);
|
|
36
36
|
const joinedStyles = Object.assign(Object.assign({}, style), { width: `calc(1.5ch * ${length})` });
|
|
37
|
-
return (_jsx("input", Object.assign({
|
|
37
|
+
return (_jsx("input", Object.assign({}, restProps, { className: joinedClassNames, style: joinedStyles, type: "number", minLength: length, maxLength: length, autoComplete: autoComplete || "off", pattern: pattern || "[0-9]", onInput: (event) => {
|
|
38
38
|
if (isInputFilled(event, length)) {
|
|
39
39
|
onFilled === null || onFilled === void 0 ? void 0 : onFilled();
|
|
40
40
|
}
|
|
@@ -5,4 +5,4 @@ export interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
ref?: React.Ref<HTMLDivElement>;
|
|
7
7
|
}
|
|
8
|
-
export declare function Container({ size, align, className, children,
|
|
8
|
+
export declare function Container({ size, align, className, children, ...restProps }: ContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,7 +14,7 @@ import classNames from "classnames";
|
|
|
14
14
|
import boxingStyles from "../boxing.module.css";
|
|
15
15
|
import styles from "./Container.module.css";
|
|
16
16
|
export function Container(_a) {
|
|
17
|
-
var { size = "xl", align, className, children
|
|
17
|
+
var { size = "xl", align, className, children } = _a, restProps = __rest(_a, ["size", "align", "className", "children"]);
|
|
18
18
|
const joinedClassNames = classNames(boxingStyles.flexColumnBox, { [boxingStyles[align]]: align }, { [boxingStyles.demandChildsToBeFullWidth]: true }, styles.container, styles[size], className);
|
|
19
|
-
return (_jsx("div", Object.assign({
|
|
19
|
+
return (_jsx("div", Object.assign({}, restProps, { className: joinedClassNames, children: children })));
|
|
20
20
|
}
|
|
@@ -6,6 +6,6 @@ export interface DisplayProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
6
6
|
maxWidth?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
}
|
|
9
|
-
export declare function Display({ align, fullWidthOnParentDemand, minWidth, maxWidth, className, children,
|
|
9
|
+
export declare function Display({ align, fullWidthOnParentDemand, minWidth, maxWidth, className, children, ...restProps }: DisplayProps & {
|
|
10
10
|
ref?: React.Ref<HTMLDivElement>;
|
|
11
11
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/Display/Display.js
CHANGED
|
@@ -14,7 +14,7 @@ import classNames from "classnames";
|
|
|
14
14
|
import boxingStyles from "../boxing.module.css";
|
|
15
15
|
import styles from "./Display.module.css";
|
|
16
16
|
export function Display(_a) {
|
|
17
|
-
var { align, fullWidthOnParentDemand = true, minWidth, maxWidth, className, children
|
|
17
|
+
var { align, fullWidthOnParentDemand = true, minWidth, maxWidth, className, children } = _a, restProps = __rest(_a, ["align", "fullWidthOnParentDemand", "minWidth", "maxWidth", "className", "children"]);
|
|
18
18
|
const joinedClassNames = classNames(boxingStyles.flexColumnBox, { [boxingStyles[align]]: align }, { [boxingStyles.demandChildsToBeFullWidth]: true }, { [boxingStyles.fullWidthOnParentDemand]: fullWidthOnParentDemand }, { [styles[`${minWidth}MinWidth`]]: minWidth }, { [styles[`${maxWidth}MaxWidth`]]: maxWidth }, className);
|
|
19
|
-
return (_jsx("div", Object.assign({
|
|
19
|
+
return (_jsx("div", Object.assign({}, restProps, { className: joinedClassNames, children: children })));
|
|
20
20
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CardProps, OverlayProps } from "..";
|
|
3
3
|
export interface DropdownProps extends CardProps, OverlayProps {
|
|
4
|
+
teleport?: boolean;
|
|
4
5
|
ref?: React.Ref<HTMLDivElement>;
|
|
5
6
|
}
|
|
6
7
|
export declare function Dropdown({ fullWidthOnParentDemand, // Def in Card is True
|
|
7
|
-
blur, level, triggerref, onClose, className, style, children, ref, ...restProps }: DropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
blur, level, triggerref, onClose, className, style, children, teleport, ref, ...restProps }: DropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,13 +11,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { useRef, useState, useEffect, useImperativeHandle
|
|
14
|
+
import { useRef, useState, useEffect, useImperativeHandle } from "react";
|
|
15
15
|
import classNames from "classnames";
|
|
16
|
-
import { Card
|
|
16
|
+
import { Card } from "..";
|
|
17
17
|
import styles from "./Dropdown.module.css";
|
|
18
|
+
import { createPortal } from "react-dom";
|
|
19
|
+
import { useOnOutsideClick } from "@yakad/use-interactions";
|
|
18
20
|
export function Dropdown(_a) {
|
|
19
21
|
var { fullWidthOnParentDemand = false, // Def in Card is True
|
|
20
|
-
blur, level = "high", triggerref, onClose, className, style, children, ref } = _a, restProps = __rest(_a, ["fullWidthOnParentDemand", "blur", "level", "triggerref", "onClose", "className", "style", "children", "ref"]);
|
|
22
|
+
blur, level = "high", triggerref, onClose, className, style, children, teleport = false, ref } = _a, restProps = __rest(_a, ["fullWidthOnParentDemand", "blur", "level", "triggerref", "onClose", "className", "style", "children", "teleport", "ref"]);
|
|
21
23
|
const fallbackTriggerRef = useRef(null);
|
|
22
24
|
const dropdownRef = useRef(null);
|
|
23
25
|
const placementTargetRef = triggerref || fallbackTriggerRef;
|
|
@@ -33,6 +35,17 @@ export function Dropdown(_a) {
|
|
|
33
35
|
});
|
|
34
36
|
const [isPlacedAbove, setIsPlacedAbove] = useState(false);
|
|
35
37
|
const [isPlaced, setIsPlaced] = useState(false);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
document.body.style.overflow = "hidden";
|
|
40
|
+
return () => {
|
|
41
|
+
document.body.style.overflow = "initial";
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
const doTeleport = () => {
|
|
45
|
+
const portalRoot = document.getElementsByClassName("portalRoot")[0] || document;
|
|
46
|
+
const t = portalRoot && createPortal(dropdown(), portalRoot);
|
|
47
|
+
return t;
|
|
48
|
+
};
|
|
36
49
|
useEffect(() => {
|
|
37
50
|
if ((placementTargetRef === null || placementTargetRef === void 0 ? void 0 : placementTargetRef.current) && dropdownRef.current) {
|
|
38
51
|
const placementTarget = placementTargetRef.current.getBoundingClientRect();
|
|
@@ -75,11 +88,12 @@ export function Dropdown(_a) {
|
|
|
75
88
|
useOnOutsideClick(() => {
|
|
76
89
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
77
90
|
}, dropdownRef);
|
|
78
|
-
|
|
91
|
+
const dropdown = () => (_jsxs(_Fragment, { children: [!triggerref && _jsx("div", { ref: fallbackTriggerRef }), _jsx(Card, Object.assign({ ref: dropdownRef, fullWidthOnParentDemand: fullWidthOnParentDemand, blur: blur, level: level }, restProps, { className: classNames(styles.dropdownCard, { [styles.isPlacedAbove]: isPlacedAbove }, className), style: Object.assign({ top: dropdownPosition.top, left: dropdownPosition.left, visibility: isPlaced ? "visible" : "hidden" }, style), children: children })), _jsx("span", { className: classNames(styles.arrow, {
|
|
79
92
|
[styles.isPlacedAbove]: isPlacedAbove,
|
|
80
93
|
}, { [styles.blur]: blur }), style: {
|
|
81
94
|
top: arrowPosition.top,
|
|
82
95
|
left: arrowPosition.left,
|
|
83
96
|
visibility: isPlaced ? "visible" : "hidden",
|
|
84
97
|
} })] }));
|
|
98
|
+
return teleport ? doTeleport() : dropdown();
|
|
85
99
|
}
|
package/dist/Footer/Footer.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export interface FooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
blur?: boolean;
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export declare function Footer({ align, overflow, position, size, blur, className, children,
|
|
10
|
+
export declare function Footer({ align, overflow, position, size, blur, className, children, ...restProps }: FooterProps & {
|
|
11
11
|
ref?: React.Ref<HTMLDivElement>;
|
|
12
12
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/Footer/Footer.js
CHANGED
|
@@ -16,7 +16,7 @@ import classNames from "classnames";
|
|
|
16
16
|
import boxingStyles from "../boxing.module.css";
|
|
17
17
|
import styles from "./Footer.module.css";
|
|
18
18
|
export function Footer(_a) {
|
|
19
|
-
var { align, overflow = "shrink", position = "initial", size, blur, className, children
|
|
19
|
+
var { align, overflow = "shrink", position = "initial", size, blur, className, children } = _a, restProps = __rest(_a, ["align", "overflow", "position", "size", "blur", "className", "children"]);
|
|
20
20
|
const [show, setShow] = useState(true);
|
|
21
21
|
const [lastScrollY, setLastScrollY] = useState(0);
|
|
22
22
|
useEffect(() => {
|
|
@@ -38,5 +38,5 @@ export function Footer(_a) {
|
|
|
38
38
|
return () => window.removeEventListener("scroll", handleScroll);
|
|
39
39
|
}, [lastScrollY, position]);
|
|
40
40
|
const joinedClassNames = classNames(boxingStyles.flexRowBox, { [boxingStyles[align]]: align }, boxingStyles[overflow], styles.footer, { [styles.sticky]: position === "sticky" || position === "scroll" }, { [styles.hidden]: position === "scroll" && !show }, { [styles[size]]: size }, { [styles.blur]: blur }, className);
|
|
41
|
-
return (_jsx("footer", Object.assign({
|
|
41
|
+
return (_jsx("footer", Object.assign({}, restProps, { className: joinedClassNames, children: children })));
|
|
42
42
|
}
|
package/dist/Form/Form.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export interface FormProps extends React.HTMLAttributes<HTMLFormElement> {
|
|
|
4
4
|
fullWidthOnParentDemand?: boolean;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
}
|
|
7
|
-
export declare function Form({ align, fullWidthOnParentDemand, className, children,
|
|
7
|
+
export declare function Form({ align, fullWidthOnParentDemand, className, children, ...restProps }: FormProps & {
|
|
8
8
|
ref?: React.Ref<HTMLFormElement>;
|
|
9
9
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/Form/Form.js
CHANGED
|
@@ -14,7 +14,7 @@ import classNames from "classnames";
|
|
|
14
14
|
import styles from "./Form.module.css";
|
|
15
15
|
import boxingStyles from "../boxing.module.css";
|
|
16
16
|
export function Form(_a) {
|
|
17
|
-
var { align, fullWidthOnParentDemand = true, className, children
|
|
17
|
+
var { align, fullWidthOnParentDemand = true, className, children } = _a, restProps = __rest(_a, ["align", "fullWidthOnParentDemand", "className", "children"]);
|
|
18
18
|
const joinedClassNames = classNames(boxingStyles.flexColumnBox, { [boxingStyles[align]]: align }, { [boxingStyles.demandChildsToBeFullWidth]: true }, { [boxingStyles.fullWidthOnParentDemand]: fullWidthOnParentDemand }, styles.form, className);
|
|
19
|
-
return (_jsx("form", Object.assign({
|
|
19
|
+
return (_jsx("form", Object.assign({}, restProps, { className: joinedClassNames, children: children })));
|
|
20
20
|
}
|
|
@@ -4,6 +4,6 @@ export interface GridContainerProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
4
4
|
columns?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
}
|
|
7
|
-
export declare function GridContainer({ gap, columns, className, style, children,
|
|
7
|
+
export declare function GridContainer({ gap, columns, className, style, children, ...restProps }: GridContainerProps & {
|
|
8
8
|
ref?: React.Ref<HTMLDivElement>;
|
|
9
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,8 +13,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import classNames from "classnames";
|
|
14
14
|
import styles from "./GridContainer.module.css";
|
|
15
15
|
export function GridContainer(_a) {
|
|
16
|
-
var { gap = 1.5, columns = 12, className, style, children
|
|
16
|
+
var { gap = 1.5, columns = 12, className, style, children } = _a, restProps = __rest(_a, ["gap", "columns", "className", "style", "children"]);
|
|
17
17
|
const joinedClassNames = classNames(styles.gridcontainer, styles[`gridColumns${columns}`], className);
|
|
18
18
|
const joinedStyles = Object.assign(Object.assign({}, style), { columnGap: (style === null || style === void 0 ? void 0 : style.columnGap) || `${gap}rem`, rowGap: (style === null || style === void 0 ? void 0 : style.rowGap) || `${gap}rem` });
|
|
19
|
-
return (_jsx("div", Object.assign({
|
|
19
|
+
return (_jsx("div", Object.assign({}, restProps, { className: joinedClassNames, style: joinedStyles, children: children })));
|
|
20
20
|
}
|
|
@@ -9,7 +9,7 @@ export interface GridItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
9
9
|
xl?: GridColumn;
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
}
|
|
12
|
-
export declare function GridItem({ align, xs, sm, md, lg, xl, className, children,
|
|
12
|
+
export declare function GridItem({ align, xs, sm, md, lg, xl, className, children, ...restProps }: GridItemProps & {
|
|
13
13
|
ref?: React.Ref<HTMLDivElement>;
|
|
14
14
|
}): import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -14,7 +14,7 @@ import classNames from "classnames";
|
|
|
14
14
|
import boxingStyles from "../boxing.module.css";
|
|
15
15
|
import styles from "./GridItem.module.css";
|
|
16
16
|
export function GridItem(_a) {
|
|
17
|
-
var { align, xs, sm, md, lg, xl, className, children
|
|
17
|
+
var { align, xs, sm, md, lg, xl, className, children } = _a, restProps = __rest(_a, ["align", "xs", "sm", "md", "lg", "xl", "className", "children"]);
|
|
18
18
|
const joinedClassNames = classNames(boxingStyles.flexColumnBox, { [boxingStyles[align]]: align }, { [boxingStyles.demandChildsToBeFullWidth]: true }, styles.gridItem, { [styles[`xs${xs}`]]: xs }, { [styles[`sm${sm}`]]: sm }, { [styles[`md${md}`]]: md }, { [styles[`lg${lg}`]]: lg }, { [styles[`xl${xl}`]]: xl }, className);
|
|
19
|
-
return (_jsx("div", Object.assign({
|
|
19
|
+
return (_jsx("div", Object.assign({}, restProps, { className: joinedClassNames, children: children })));
|
|
20
20
|
}
|
package/dist/Hr/Hr.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export interface HrProps extends React.HTMLAttributes<HTMLHRElement> {
|
|
|
3
3
|
variant?: "dotted" | "dashed" | "shortLine";
|
|
4
4
|
height?: number;
|
|
5
5
|
marginx?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare function Hr({ variant, height, marginx, className, style, ref, ...restProps }: HrProps & {
|
|
8
6
|
ref?: React.Ref<HTMLHRElement>;
|
|
9
|
-
}
|
|
7
|
+
}
|
|
8
|
+
export declare function Hr({ variant, height, marginx, className, style, ...restProps }: HrProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/Hr/Hr.js
CHANGED
|
@@ -13,8 +13,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import classNames from "classnames";
|
|
14
14
|
import styles from "./Hr.module.css";
|
|
15
15
|
export function Hr(_a) {
|
|
16
|
-
var { variant, height, marginx, className, style
|
|
16
|
+
var { variant, height, marginx, className, style } = _a, restProps = __rest(_a, ["variant", "height", "marginx", "className", "style"]);
|
|
17
17
|
const joinedClassNames = classNames(styles.hr, variant && styles[variant], className);
|
|
18
18
|
const joinedStyles = Object.assign(Object.assign({}, style), { borderTopWidth: height ? `${height}rem` : style === null || style === void 0 ? void 0 : style.borderTopWidth, marginTop: marginx ? `${marginx}rem` : style === null || style === void 0 ? void 0 : style.marginTop, marginBottom: marginx ? `${marginx}rem` : style === null || style === void 0 ? void 0 : style.marginBottom });
|
|
19
|
-
return (_jsx("hr", Object.assign({
|
|
19
|
+
return (_jsx("hr", Object.assign({}, restProps, { className: joinedClassNames, style: joinedStyles })));
|
|
20
20
|
}
|
|
@@ -4,4 +4,4 @@ export interface InputFieldProps extends React.InputHTMLAttributes<HTMLInputElem
|
|
|
4
4
|
boxSize?: "small" | "normal";
|
|
5
5
|
ref?: React.Ref<HTMLInputElement>;
|
|
6
6
|
}
|
|
7
|
-
export declare function InputField({ variant, boxSize, placeholder, className,
|
|
7
|
+
export declare function InputField({ variant, boxSize, placeholder, className, ...restProps }: InputFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,7 +14,7 @@ import classNames from "classnames";
|
|
|
14
14
|
import boxingStyles from "../boxing.module.css";
|
|
15
15
|
import styles from "./InputField.module.css";
|
|
16
16
|
export function InputField(_a) {
|
|
17
|
-
var { variant = "outlined", boxSize = "normal", placeholder, className
|
|
17
|
+
var { variant = "outlined", boxSize = "normal", placeholder, className } = _a, restProps = __rest(_a, ["variant", "boxSize", "placeholder", "className"]);
|
|
18
18
|
const joinedClassNames = classNames(styles.input, styles[variant], styles[boxSize], placeholder && styles.havePlaceHolder, className);
|
|
19
|
-
return (_jsxs("div", { className: classNames({ [boxingStyles.fullWidthOnParentDemand]: true }, styles.div), children: [_jsx("input", Object.assign({
|
|
19
|
+
return (_jsxs("div", { className: classNames({ [boxingStyles.fullWidthOnParentDemand]: true }, styles.div), children: [_jsx("input", Object.assign({}, restProps, { className: joinedClassNames, placeholder: " " })), placeholder && (_jsx("label", { className: styles.label, children: placeholder }))] }));
|
|
20
20
|
}
|
package/dist/List/List.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
|
3
3
|
direction?: "row" | "column";
|
|
4
4
|
collapsed?: boolean;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export declare function List({ direction, collapsed, className, children, ref, ...restProps }: ListProps & {
|
|
8
6
|
ref?: React.Ref<HTMLUListElement>;
|
|
9
|
-
}
|
|
7
|
+
}
|
|
8
|
+
export declare function List({ direction, collapsed, className, children, ...restProps }: ListProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/List/List.js
CHANGED
|
@@ -14,7 +14,7 @@ import classNames from "classnames";
|
|
|
14
14
|
import boxingStyles from "../boxing.module.css";
|
|
15
15
|
import styles from "./List.module.css";
|
|
16
16
|
export function List(_a) {
|
|
17
|
-
var { direction = "row", collapsed, className, children
|
|
17
|
+
var { direction = "row", collapsed, className, children } = _a, restProps = __rest(_a, ["direction", "collapsed", "className", "children"]);
|
|
18
18
|
const joinedClassNames = classNames({ [boxingStyles.fullWidthOnParentDemand]: true }, styles.list, styles[direction], { [styles.collapsed]: collapsed }, className);
|
|
19
|
-
return (_jsx("ul", Object.assign({
|
|
19
|
+
return (_jsx("ul", Object.assign({}, restProps, { className: joinedClassNames, children: children })));
|
|
20
20
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface ListItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
3
3
|
align?: "start" | "space" | "center" | "end";
|
|
4
|
-
}
|
|
5
|
-
export declare function ListItem({ align, className, children, ref, ...restProps }: ListItemProps & {
|
|
6
4
|
ref?: React.Ref<HTMLLIElement>;
|
|
7
|
-
}
|
|
5
|
+
}
|
|
6
|
+
export declare function ListItem({ align, className, children, ...restProps }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,6 +14,6 @@ import classNames from "classnames";
|
|
|
14
14
|
import boxingStyles from "../boxing.module.css";
|
|
15
15
|
import styles from "./ListItem.module.css";
|
|
16
16
|
export function ListItem(_a) {
|
|
17
|
-
var { align, className, children
|
|
18
|
-
return (_jsx("li", Object.assign({
|
|
17
|
+
var { align, className, children } = _a, restProps = __rest(_a, ["align", "className", "children"]);
|
|
18
|
+
return (_jsx("li", Object.assign({}, restProps, { className: classNames(boxingStyles.flexColumnBox, { [boxingStyles[align]]: align }, { [boxingStyles.demandChildsToBeFullWidth]: true }, styles.listItem, className), children: children })));
|
|
19
19
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
export interface LoadingIconProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
size?: "extraSmall" | "small" | "medium" | "large" | "extraLarge";
|
|
4
4
|
variant?: "scaleOut" | "dots" | "spinner";
|
|
5
|
-
}
|
|
6
|
-
export declare function LoadingIcon({ size, variant, className, ref, ...restProps }: LoadingIconProps & {
|
|
7
5
|
ref?: React.Ref<HTMLDivElement>;
|
|
8
|
-
}
|
|
6
|
+
}
|
|
7
|
+
export declare function LoadingIcon({ size, variant, className, ...restProps }: LoadingIconProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import classNames from "classnames";
|
|
14
14
|
import styles from "./LoadingIcon.module.css";
|
|
15
15
|
export function LoadingIcon(_a) {
|
|
16
|
-
var { size = "medium", variant = "dots", className
|
|
16
|
+
var { size = "medium", variant = "dots", className } = _a, restProps = __rest(_a, ["size", "variant", "className"]);
|
|
17
17
|
const joinedClassNames = classNames(styles.loadingIcon, styles[size], styles[variant], className);
|
|
18
|
-
return (_jsx("div", Object.assign({
|
|
18
|
+
return (_jsx("div", Object.assign({}, restProps, { className: joinedClassNames, children: _jsx("div", {}) })));
|
|
19
19
|
}
|
package/dist/Main/Main.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export interface MainProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
3
3
|
align?: "start" | "space" | "center" | "end";
|
|
4
4
|
navOpen?: boolean;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export declare function Main({ align, navOpen, className, children, ref, ...restProps }: MainProps & {
|
|
8
6
|
ref?: React.Ref<HTMLDivElement>;
|
|
9
|
-
}
|
|
7
|
+
}
|
|
8
|
+
export declare function Main({ align, navOpen, className, children, ...restProps }: MainProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/Main/Main.js
CHANGED
|
@@ -14,7 +14,7 @@ import classNames from "classnames";
|
|
|
14
14
|
import boxingStyles from "../boxing.module.css";
|
|
15
15
|
import styles from "./Main.module.css";
|
|
16
16
|
export function Main(_a) {
|
|
17
|
-
var { align, navOpen = false, className, children
|
|
17
|
+
var { align, navOpen = false, className, children } = _a, restProps = __rest(_a, ["align", "navOpen", "className", "children"]);
|
|
18
18
|
const joinedClassNames = classNames(boxingStyles.flexColumnBox, { [boxingStyles[align]]: align }, { [boxingStyles.demandChildsToBeFullWidth]: true }, styles.main, { [styles.navOpen]: navOpen }, className);
|
|
19
|
-
return (_jsx("main", Object.assign({
|
|
19
|
+
return (_jsx("main", Object.assign({}, restProps, { className: joinedClassNames, children: children })));
|
|
20
20
|
}
|
|
@@ -4,7 +4,6 @@ export interface NavigationProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
4
4
|
anchor?: "left" | "right" | "top" | "bottom" | "auto";
|
|
5
5
|
open: boolean;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export declare function Navigation({ align, anchor, open, className, children, ref, ...restProps }: NavigationProps & {
|
|
9
7
|
ref?: React.Ref<HTMLDivElement>;
|
|
10
|
-
}
|
|
8
|
+
}
|
|
9
|
+
export declare function Navigation({ align, anchor, open, className, children, ...restProps }: NavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,9 +14,9 @@ import classNames from "classnames";
|
|
|
14
14
|
import boxingStyles from "../boxing.module.css";
|
|
15
15
|
import styles from "./Navigation.module.css";
|
|
16
16
|
export function Navigation(_a) {
|
|
17
|
-
var { align, anchor = "auto", open = false, className, children
|
|
17
|
+
var { align, anchor = "auto", open = false, className, children } = _a, restProps = __rest(_a, ["align", "anchor", "open", "className", "children"]);
|
|
18
18
|
const joinedClassNames = classNames(boxingStyles.flexColumnBox, { [boxingStyles[align]]: align }, { [boxingStyles.demandChildsToBeFullWidth]: true }, styles.navigation, styles[anchor], {
|
|
19
19
|
[styles.open]: open,
|
|
20
20
|
}, className);
|
|
21
|
-
return (_jsx("nav", Object.assign({
|
|
21
|
+
return (_jsx("nav", Object.assign({}, restProps, { className: joinedClassNames, children: children })));
|
|
22
22
|
}
|
package/dist/Popup/Popup.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { CardProps, OverlayProps } from "..";
|
|
3
3
|
export interface PopupProps extends CardProps, OverlayProps {
|
|
4
4
|
heading?: string;
|
|
5
|
+
teleport?: boolean;
|
|
5
6
|
ref?: React.Ref<HTMLDivElement>;
|
|
6
7
|
}
|
|
7
|
-
export declare function Popup({ align, onClose, heading, className, children, ref, ...restProps }: PopupProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function Popup({ align, onClose, heading, className, children, teleport, ref, ...restProps }: PopupProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/Popup/Popup.js
CHANGED
|
@@ -11,16 +11,30 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { useImperativeHandle } from "react";
|
|
14
|
+
import { useEffect, useImperativeHandle } from "react";
|
|
15
15
|
import classNames from "classnames";
|
|
16
16
|
import { Symbol } from "@yakad/symbols";
|
|
17
|
-
import { Button, Card, Row, Screen, Spacer, Stack, Text,
|
|
17
|
+
import { Button, Card, Row, Screen, Spacer, Stack, Text, } from "..";
|
|
18
18
|
import styles from "./Popup.module.css";
|
|
19
|
+
import { createPortal } from "react-dom";
|
|
20
|
+
import { useOnOutsideClick } from "@yakad/use-interactions";
|
|
19
21
|
export function Popup(_a) {
|
|
20
|
-
var { align, onClose, heading, className, children, ref } = _a, restProps = __rest(_a, ["align", "onClose", "heading", "className", "children", "ref"]);
|
|
22
|
+
var { align, onClose, heading, className, children, teleport = false, ref } = _a, restProps = __rest(_a, ["align", "onClose", "heading", "className", "children", "teleport", "ref"]);
|
|
21
23
|
const localRef = useOnOutsideClick(() => {
|
|
22
24
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
23
25
|
});
|
|
26
|
+
const doTeleport = () => {
|
|
27
|
+
const portalRoot = document.getElementsByClassName("portalRoot")[0] || document;
|
|
28
|
+
const t = portalRoot && createPortal(popup(), portalRoot);
|
|
29
|
+
return t;
|
|
30
|
+
};
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
document.body.style.overflow = "hidden";
|
|
33
|
+
return () => {
|
|
34
|
+
document.body.style.overflow = "initial";
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
24
37
|
useImperativeHandle(ref, () => localRef.current);
|
|
25
|
-
|
|
38
|
+
const popup = () => (_jsx(Screen, { align: "center", className: styles.popupscreen, children: _jsxs(Card, Object.assign({ ref: localRef }, 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 })] })) }));
|
|
39
|
+
return teleport ? doTeleport() : popup();
|
|
26
40
|
}
|
|
@@ -10,5 +10,5 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
10
10
|
};
|
|
11
11
|
ref?: React.Ref<HTMLInputElement>;
|
|
12
12
|
}
|
|
13
|
-
export declare function RadioButton({ dataFromRadioGroup, label, onClick, className,
|
|
13
|
+
export declare function RadioButton({ dataFromRadioGroup, label, onClick, className, ...restProps }: RadioButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export {};
|