@geneui/components 3.0.0-next-76e593d-29072025 → 3.0.0-next-e06ec94-05082025
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/Modal.js +100 -0
- package/Notification.js +3 -11
- package/Text.js +2 -2
- package/Tooltip.js +1 -1
- package/components/atoms/Text/Text.d.ts +5 -0
- package/components/molecules/Modal/Modal.d.ts +89 -0
- package/components/molecules/Modal/index.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
package/Modal.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React__default, { useContext, useRef, useEffect } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { c as classNames } from './index-ce02421b.js';
|
|
4
|
+
import { S as SvgErrorFilled } from './ErrorFilled-f4226310.js';
|
|
5
|
+
import { S as SvgInfo } from './Info-0f0741e0.js';
|
|
6
|
+
import { S as SvgTriangleAlert } from './TriangleAlert-ba250f4c.js';
|
|
7
|
+
import { S as SvgX } from './X-20da3b4a.js';
|
|
8
|
+
import Button from './Button.js';
|
|
9
|
+
import Scrollbar from './Scrollbar.js';
|
|
10
|
+
import Text from './Text.js';
|
|
11
|
+
import ButtonGroup from './ButtonGroup.js';
|
|
12
|
+
import Tooltip from './Tooltip.js';
|
|
13
|
+
import { a as GeneUIDesignSystemContext } from './index-d9a2e208.js';
|
|
14
|
+
import { u as useEllipsisDetection } from './useEllipsisDetection-36ecf9df.js';
|
|
15
|
+
import { s as styleInject } from './style-inject.es-746bb8ed.js';
|
|
16
|
+
import './ActivityRecent-b88e2ba8.js';
|
|
17
|
+
import './Loader.js';
|
|
18
|
+
import 'prop-types';
|
|
19
|
+
import './useDebounceCallback-999deae7.js';
|
|
20
|
+
import './ThreeDotsHorizontal-479c2b4b.js';
|
|
21
|
+
import './Menu.js';
|
|
22
|
+
import './PopoverBody-7437f3ac.js';
|
|
23
|
+
import './floating-ui.react-a6c3b969.js';
|
|
24
|
+
import './index-b29adba3.js';
|
|
25
|
+
import './index-a2688a52.js';
|
|
26
|
+
import './CheckMark-34798545.js';
|
|
27
|
+
import './ChevronRight-8074ab2e.js';
|
|
28
|
+
import './Divider.js';
|
|
29
|
+
|
|
30
|
+
var css_248z = ".modal{background-color:var(--guit-sem-color-background-transparent-overlay-notheme-1);display:flex;height:100%;justify-content:center;left:0;overflow:hidden;position:fixed;top:0;width:100%;z-index:1}.modal:not(.modal_position_top){align-items:center}.modal:not(.modal_position_top).modal_device_desktop{padding:var(--guit-ref-spacing-8xlarge)}.modal:not(.modal_position_top).modal_device_mobile:not(.modal_size_xxLarge){padding:var(--guit-ref-spacing-large)}.modal:not(.modal_position_top) .modal__wrapper{border-color:var(--guit-sem-color-border-neutral-2);border-radius:var(--guit-ref-radius-2xsmall);border-style:var(--guit-ref-border-style-solid);border-width:var(--guit-ref-border-width-thin)}.modal__header{background-color:var(--guit-sem-color-background-neutral-1-nudge);border-bottom:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);height:var(--guit-sem-dimension-height-2xlarge);justify-content:space-between;padding:var(--guit-ref-spacing-large);width:100%}.modal__header,.modal__headerContent{align-items:center;display:flex;gap:var(--guit-ref-spacing-xsmall);min-width:1rem}.modal__icon{flex:0 0 auto}.modal__body{background-color:var(--guit-sem-color-background-neutral-1-nudge);height:100%;min-height:0;min-width:0;width:100%}.modal__content{height:100%;max-height:68.8rem;width:100%}.modal__footer{align-items:center;background-color:var(--guit-sem-color-background-neutral-1-nudge);border-top:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);display:flex;gap:var(--guit-ref-spacing-medium);height:var(--guit-sem-dimension-height-2xlarge);padding:var(--guit-ref-spacing-medium) var(--guit-ref-spacing-large);width:100%}.modal__footer:has(.modal__buttonGroup:only-child){justify-content:flex-end}.modal__footer:not(:has(.modal__buttonGroup:only-child)){justify-content:space-between}.modal__title{text-transform:capitalize}.modal__paragraph,.modal__title{color:var(--guit-sem-color-foreground-neutral-2)}.modal__paragraph:not(:last-of-type){margin-bottom:var(--guit-sem-font-body-large-default-medium-paragraph-spacing)}.modal_device_desktop.modal_size_xxLarge .modal__wrapper{max-width:144rem}.modal_device_desktop.modal_size_xLarge .modal__wrapper{max-width:108rem}.modal_device_desktop.modal_size_large .modal__wrapper{max-width:72rem}.modal_device_desktop.modal_size_medium .modal__wrapper{max-width:48rem}.modal_device_desktop.modal_size_small .modal__wrapper{max-width:36rem}.modal_device_mobile.modal_size_xxLarge .modal__wrapper{border:none;border-radius:0;height:100%}.modal_device_mobile.modal_size_xxLarge .modal__content{max-height:100%}.modal_device_mobile.modal_size_small .modal__wrapper{max-width:32.8rem}.modal_position_top{align-items:flex-start}.modal_position_top.modal_device_desktop{padding:0 var(--guit-ref-spacing-8xlarge) var(--guit-ref-spacing-8xlarge) var(--guit-ref-spacing-8xlarge)}.modal_position_top.modal_device_mobile{padding:0 var(--guit-ref-spacing-large) var(--guit-ref-spacing-large) var(--guit-ref-spacing-large)}.modal_position_top .modal__wrapper{border-end-end-radius:var(--guit-ref-radius-2xsmall);border-end-start-radius:var(--guit-ref-radius-2xsmall);border-top-width:0}.modal_withPadding .modal__content{padding:var(--guit-ref-spacing-large)}.modal__wrapper{box-shadow:var(--guit-sem-shadow-floating-3-position-x-1) var(--guit-sem-shadow-floating-3-position-y-1) var(--guit-sem-shadow-floating-3-blur-1) var(--guit-sem-shadow-floating-3-spread-1) var(--guit-sem-color-floating-3-rgba-1),var(--guit-sem-shadow-floating-3-position-x-2) var(--guit-sem-shadow-floating-3-position-y-2) var(--guit-sem-shadow-floating-3-position-y-1) var(--guit-sem-shadow-floating-3-spread-2) var(--guit-sem-color-floating-3-rgba-2);display:grid;grid-template-columns:12fr;grid-template-rows:auto 10fr auto;max-height:100%;overflow:hidden;width:100%}.modal_status_informative{color:var(--guit-sem-color-foreground-neutral-2)}.modal_status_warning{color:var(--guit-sem-color-foreground-warning)}.modal_status_error{color:var(--guit-sem-color-foreground-error)}";
|
|
31
|
+
styleInject(css_248z);
|
|
32
|
+
|
|
33
|
+
const STATUS_ICONS = {
|
|
34
|
+
informative: SvgInfo,
|
|
35
|
+
warning: SvgTriangleAlert,
|
|
36
|
+
error: SvgErrorFilled
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Modal component displays content in a layer above the main application, effectively focusing the user's attention on a specific task or information. It is often used for actions that require user input, such as confirmation dialogs, forms, or important notifications.
|
|
40
|
+
*/
|
|
41
|
+
const Modal = ({ className, open, title, hasCloseButton, shouldCloseOnEscapePress = false, shouldCloseOnOverlayClick = false, onClose, status, children, size = "medium", withPadding = true, position = "center", footerContent, actions, lockBodyScroll }) => {
|
|
42
|
+
const { geneUIProviderRef, breakpoint } = useContext(GeneUIDesignSystemContext);
|
|
43
|
+
const providerCurrent = geneUIProviderRef.current;
|
|
44
|
+
const titleRef = useRef(null);
|
|
45
|
+
const isMobileBreakpoint = breakpoint === null || breakpoint === void 0 ? void 0 : breakpoint.isMobileBreakpoint;
|
|
46
|
+
const isTruncated = useEllipsisDetection(titleRef);
|
|
47
|
+
const sizeMap = {
|
|
48
|
+
xxLarge: "xxLarge",
|
|
49
|
+
xLarge: isMobileBreakpoint ? "xxLarge" : "xLarge",
|
|
50
|
+
large: isMobileBreakpoint ? "small" : "large",
|
|
51
|
+
medium: isMobileBreakpoint ? "small" : "medium",
|
|
52
|
+
small: "small"
|
|
53
|
+
};
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
const handleKeyDown = (event) => {
|
|
56
|
+
if (shouldCloseOnEscapePress && event.key === "Escape") {
|
|
57
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
if (open) {
|
|
61
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
62
|
+
if (lockBodyScroll) {
|
|
63
|
+
document.body.style.overflow = "hidden";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return () => {
|
|
67
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
68
|
+
if (lockBodyScroll) {
|
|
69
|
+
document.body.style.overflow = "unset";
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}, [open, shouldCloseOnEscapePress, onClose]);
|
|
73
|
+
const handleOverlayClick = (event) => {
|
|
74
|
+
if (shouldCloseOnOverlayClick && event.target === event.currentTarget) {
|
|
75
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const IconComponent = status ? STATUS_ICONS[status] : null;
|
|
79
|
+
const modalContent = (React__default.createElement("div", { className: classNames(`modal modal_device_${isMobileBreakpoint ? "mobile" : "desktop"} modal_size_${sizeMap[size]} `, `modal_position_${isMobileBreakpoint && (size === "xxLarge" || size === "xLarge") ? "center" : position}`, className), onClick: handleOverlayClick, role: "presentation" },
|
|
80
|
+
React__default.createElement("div", { className: classNames("modal__wrapper", { modal_withPadding: withPadding }), role: "dialog", "aria-modal": "true", "aria-labelledby": title ? "modal-title" : undefined },
|
|
81
|
+
(hasCloseButton || title) && (React__default.createElement("div", { className: "modal__header" },
|
|
82
|
+
React__default.createElement("div", { className: "modal__headerContent" }, title && (React__default.createElement(React__default.Fragment, null,
|
|
83
|
+
IconComponent && (React__default.createElement(IconComponent, { className: `modal_status_${status} modal__icon`, size: 20 })),
|
|
84
|
+
React__default.createElement(Tooltip, { text: title, isVisible: isTruncated },
|
|
85
|
+
React__default.createElement(Text, { id: "modal-title", variant: "labelLargeSemibold", className: "modal__title ellipsis-text", as: "h1", ref: titleRef }, title))))),
|
|
86
|
+
hasCloseButton && (React__default.createElement(Button, { size: "small", Icon: SvgX, type: "button", layout: "text", appearance: "secondary", onClick: onClose })))),
|
|
87
|
+
React__default.createElement("div", { className: "modal__body" },
|
|
88
|
+
React__default.createElement(Scrollbar, null,
|
|
89
|
+
React__default.createElement("div", { className: "modal__content" }, typeof children === "string" ? (React__default.createElement(Text, { variant: "bodyLargeMedium", className: "modal__paragraph", as: "p" }, children)) : (children)))),
|
|
90
|
+
(actions || footerContent) && (React__default.createElement("div", { className: "modal__footer" },
|
|
91
|
+
footerContent && React__default.createElement("div", { className: "modal__footerContent" }, footerContent),
|
|
92
|
+
actions && actions.length > 0 && (React__default.createElement(ButtonGroup, { className: "modal__buttonGroup", size: "medium" }, actions.map((action) => {
|
|
93
|
+
const { children: buttonChildren } = action;
|
|
94
|
+
const key = `action-${buttonChildren}`;
|
|
95
|
+
return buttonChildren ? (React__default.createElement(Button, Object.assign({ key: key }, action), buttonChildren)) : null;
|
|
96
|
+
}))))))));
|
|
97
|
+
return React__default.createElement(React__default.Fragment, null, providerCurrent && open ? createPortal(modalContent, providerCurrent) : null);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export { Modal as default };
|
package/Notification.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default, {
|
|
1
|
+
import React__default, { useContext } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import { c as classNames } from './index-ce02421b.js';
|
|
4
4
|
import { _ as _objectWithoutProperties, a as _extends } from './ActivityRecent-b88e2ba8.js';
|
|
@@ -99,15 +99,7 @@ const STATUS_ICONS = {
|
|
|
99
99
|
* Notification component encompasses various types of messages, including toast notifications and section messages, to provide feedback to users in a clear and structured manner. Notifications inform users about system events, updates, or the status of their actions, ensuring that important information is communicated effectively.
|
|
100
100
|
*/
|
|
101
101
|
const Notification = ({ className, open, variant = "toast", onClose, status = "informative", title, description, primaryActionText, secondaryActionText, onPrimaryActionClick, onSecondaryActionClick, actionsButtonsSize }) => {
|
|
102
|
-
const [show, setShow] = useState(false);
|
|
103
102
|
const { geneUIProviderRef } = useContext(GeneUIDesignSystemContext);
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
setShow(!!open);
|
|
106
|
-
}, [open]);
|
|
107
|
-
const onCloseHandler = () => {
|
|
108
|
-
setShow(false);
|
|
109
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
110
|
-
};
|
|
111
103
|
const finalStatus = variant === "toast" && status === "insight" ? "informative" : status;
|
|
112
104
|
const IconComponent = STATUS_ICONS[finalStatus];
|
|
113
105
|
const notificationContent = (React__default.createElement("div", { role: "alert", "aria-live": "assertive", className: classNames(`notification notification_variant_${variant} notification_status_${finalStatus}`, className) },
|
|
@@ -117,11 +109,11 @@ const Notification = ({ className, open, variant = "toast", onClose, status = "i
|
|
|
117
109
|
React__default.createElement("div", { className: "notification__textGroup" },
|
|
118
110
|
title && (React__default.createElement(Text, { as: "h6", variant: "labelMediumSemibold", className: "notification__title" }, title)),
|
|
119
111
|
description && (React__default.createElement(Text, { as: "p", variant: "bodyMediumMedium", className: "notification__description" }, description)))),
|
|
120
|
-
React__default.createElement(Button, { appearance: "secondary", layout: "text", size: "small", className: "notification__button", onClick:
|
|
112
|
+
React__default.createElement(Button, { appearance: "secondary", layout: "text", size: "small", className: "notification__button", onClick: onClose, Icon: SvgX })),
|
|
121
113
|
React__default.createElement(ButtonGroup, { className: "notification__actions", size: actionsButtonsSize },
|
|
122
114
|
!!secondaryActionText && (React__default.createElement(Button, { appearance: "secondary", className: "notification__button", onClick: onSecondaryActionClick, layout: "text" }, secondaryActionText)),
|
|
123
115
|
!!primaryActionText && (React__default.createElement(Button, { appearance: "primary", className: "notification__button", onClick: onPrimaryActionClick }, primaryActionText)))));
|
|
124
|
-
if (!
|
|
116
|
+
if (!open)
|
|
125
117
|
return null;
|
|
126
118
|
if (variant === "toast") {
|
|
127
119
|
const providerCurrent = geneUIProviderRef.current;
|
package/Text.js
CHANGED
|
@@ -8,13 +8,13 @@ styleInject(css_248z);
|
|
|
8
8
|
/**
|
|
9
9
|
* Text component which has predefined tokens
|
|
10
10
|
*/
|
|
11
|
-
const Text = forwardRef(({ className, variant = "bodyMediumMedium", children, as, alignment = "start" }, ref) => {
|
|
11
|
+
const Text = forwardRef(({ className, variant = "bodyMediumMedium", children, as, alignment = "start", id }, ref) => {
|
|
12
12
|
const Component = as;
|
|
13
13
|
const computedClassNames = classNames("text", {
|
|
14
14
|
[`text_variant_${variant}`]: variant,
|
|
15
15
|
[`text_alignment_${alignment}`]: alignment
|
|
16
16
|
}, className);
|
|
17
|
-
return (React__default.createElement(Component, { className: computedClassNames, ref: ref }, children));
|
|
17
|
+
return (React__default.createElement(Component, { className: computedClassNames, ref: ref, id: id }, children));
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
export { Text as default };
|
package/Tooltip.js
CHANGED
|
@@ -6,7 +6,7 @@ import { a as GeneUIDesignSystemContext } from './index-d9a2e208.js';
|
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import './useDebounceCallback-999deae7.js';
|
|
8
8
|
|
|
9
|
-
var css_248z = ".tooltip{align-items:flex-start;border-radius:var(--guit-ref-radius-3xsmall);box-shadow:var(--guit-sem-shadow-floating-2-position-x-1) var(--guit-sem-shadow-floating-2-position-y-1) var(--guit-sem-shadow-floating-2-blur-1) var(--guit-sem-shadow-floating-2-spread-1) var(--guit-sem-color-floating-2-rgba-1),var(--guit-sem-shadow-floating-2-position-x-2) var(--guit-sem-shadow-floating-2-position-y-2) var(--guit-sem-shadow-floating-2-blur-2) var(--guit-sem-shadow-floating-2-spread-2) var(--guit-sem-color-floating-2-rgba-2);display:flex;font-family:var(--guit-sem-font-caption-large-medium-font-family),sans-serif;font-size:var(--guit-sem-font-caption-large-medium-font-size);font-weight:var(--guit-sem-font-caption-large-medium-font-weight);gap:var(--guit-ref-spacing-3xsmall);justify-content:space-between;letter-spacing:var(--guit-sem-font-caption-large-medium-letter-spacing);line-height:var(--guit-sem-font-caption-large-medium-line-height);max-width:24rem;min-width:var(--guit-sem-dimension-width-3xlarge);padding:var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-medium)}.tooltip_position_top .tooltip__arrow{transform:rotate(0deg)}.tooltip_position_bottom .tooltip__arrow{transform:rotate(180deg)}.tooltip_position_left .tooltip__arrow{transform:rotate(-90deg)}.tooltip_position_right .tooltip__arrow{transform:rotate(90deg)}.tooltip_color_default{background-color:var(--guit-sem-color-background-neutral-5)}.tooltip_color_default .tooltip__arrowPath{fill:var(--guit-sem-color-background-neutral-5)}.tooltip_color_default .tooltip__icon,.tooltip_color_default .tooltip__text{color:var(--guit-sem-color-foreground-inverse-notheme)}.tooltip_color_inverse{background-color:var(--guit-sem-color-background-neutral-1-nudge)}.tooltip_color_inverse .tooltip__arrowPath{fill:var(--guit-sem-color-background-neutral-1-nudge)}.tooltip_color_inverse .tooltip__icon,.tooltip_color_inverse .tooltip__text{color:var(--guit-sem-color-foreground-neutral-2)}.tooltip__arrow{align-items:center;display:flex;height:.4rem;justify-content:center;position:absolute;width:1.2rem}.tooltip__textWrapper{display:flex;flex-direction:column;gap:var(--guit-sem-font-caption-large-medium-paragraph-spacing)}.tooltip__text{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;font-family:inherit;font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;overflow:hidden;word-break:break-word}.tooltip__icon{flex:0 0 auto}";
|
|
9
|
+
var css_248z = ".tooltip{align-items:flex-start;border-radius:var(--guit-ref-radius-3xsmall);box-shadow:var(--guit-sem-shadow-floating-2-position-x-1) var(--guit-sem-shadow-floating-2-position-y-1) var(--guit-sem-shadow-floating-2-blur-1) var(--guit-sem-shadow-floating-2-spread-1) var(--guit-sem-color-floating-2-rgba-1),var(--guit-sem-shadow-floating-2-position-x-2) var(--guit-sem-shadow-floating-2-position-y-2) var(--guit-sem-shadow-floating-2-blur-2) var(--guit-sem-shadow-floating-2-spread-2) var(--guit-sem-color-floating-2-rgba-2);display:flex;font-family:var(--guit-sem-font-caption-large-medium-font-family),sans-serif;font-size:var(--guit-sem-font-caption-large-medium-font-size);font-weight:var(--guit-sem-font-caption-large-medium-font-weight);gap:var(--guit-ref-spacing-3xsmall);justify-content:space-between;letter-spacing:var(--guit-sem-font-caption-large-medium-letter-spacing);line-height:var(--guit-sem-font-caption-large-medium-line-height);max-width:24rem;min-width:var(--guit-sem-dimension-width-3xlarge);padding:var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-medium);z-index:1}.tooltip_position_top .tooltip__arrow{transform:rotate(0deg)}.tooltip_position_bottom .tooltip__arrow{transform:rotate(180deg)}.tooltip_position_left .tooltip__arrow{transform:rotate(-90deg)}.tooltip_position_right .tooltip__arrow{transform:rotate(90deg)}.tooltip_color_default{background-color:var(--guit-sem-color-background-neutral-5)}.tooltip_color_default .tooltip__arrowPath{fill:var(--guit-sem-color-background-neutral-5)}.tooltip_color_default .tooltip__icon,.tooltip_color_default .tooltip__text{color:var(--guit-sem-color-foreground-inverse-notheme)}.tooltip_color_inverse{background-color:var(--guit-sem-color-background-neutral-1-nudge)}.tooltip_color_inverse .tooltip__arrowPath{fill:var(--guit-sem-color-background-neutral-1-nudge)}.tooltip_color_inverse .tooltip__icon,.tooltip_color_inverse .tooltip__text{color:var(--guit-sem-color-foreground-neutral-2)}.tooltip__arrow{align-items:center;display:flex;height:.4rem;justify-content:center;position:absolute;width:1.2rem}.tooltip__textWrapper{display:flex;flex-direction:column;gap:var(--guit-sem-font-caption-large-medium-paragraph-spacing)}.tooltip__text{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;font-family:inherit;font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;overflow:hidden;word-break:break-word}.tooltip__icon{flex:0 0 auto}";
|
|
10
10
|
styleInject(css_248z);
|
|
11
11
|
|
|
12
12
|
const positions = [
|
|
@@ -49,6 +49,11 @@ interface ITextProps {
|
|
|
49
49
|
* Text content
|
|
50
50
|
*/
|
|
51
51
|
children: string;
|
|
52
|
+
/**
|
|
53
|
+
* A unique identifier for the text element.
|
|
54
|
+
* Useful for accessibility purposes, like `aria-labelledby`.
|
|
55
|
+
*/
|
|
56
|
+
id?: string;
|
|
52
57
|
}
|
|
53
58
|
/**
|
|
54
59
|
* Text component which has predefined tokens
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { IButtonProps } from "@components/atoms/Button";
|
|
3
|
+
import "./Modal.scss";
|
|
4
|
+
interface IModalProps {
|
|
5
|
+
/**
|
|
6
|
+
* Additional class for the parent element.
|
|
7
|
+
* This prop should be used to set placement properties for the element relative to its parent using BEM conventions.
|
|
8
|
+
*/
|
|
9
|
+
className?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Controls the visibility of the modal. Set to `true` to show and `false` to hide.
|
|
12
|
+
*/
|
|
13
|
+
open?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Determines whether the close (X) button is displayed in the modal's header.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
hasCloseButton?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Callback function triggered when the modal is requested to be closed (e.g., via the close button, Escape key, or overlay click).
|
|
21
|
+
*/
|
|
22
|
+
onClose?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* When `true`, allows the modal to be closed by pressing the Escape key.
|
|
25
|
+
* Calls `onClose`.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
shouldCloseOnEscapePress?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* When `true`, allows the modal to be closed by clicking on the semi-transparent background overlay.
|
|
31
|
+
* Calls `onClose`.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
shouldCloseOnOverlayClick?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The title text displayed in the modal's header.
|
|
37
|
+
*/
|
|
38
|
+
title?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Adds a corresponding status icon next to the title.
|
|
41
|
+
*/
|
|
42
|
+
status?: "informative" | "warning" | "error";
|
|
43
|
+
/**
|
|
44
|
+
* The main content of the modal, displayed between the header and footer.
|
|
45
|
+
*/
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Defines the width of the modal. The effective size adapts for mobile viewports:
|
|
49
|
+
* - 'large' and 'medium' sizes become 'small' on mobile.
|
|
50
|
+
* - 'xLarge' becomes 'xxLarge' on mobile.
|
|
51
|
+
* @default "medium"
|
|
52
|
+
*/
|
|
53
|
+
size?: "xxLarge" | "xLarge" | "large" | "medium" | "small";
|
|
54
|
+
/**
|
|
55
|
+
* Toggles the padding around the modal's content area.
|
|
56
|
+
* @default true
|
|
57
|
+
*/
|
|
58
|
+
withPadding?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Sets the vertical alignment of the modal in the viewport.
|
|
61
|
+
* @default "center"
|
|
62
|
+
*/
|
|
63
|
+
position?: "top" | "center";
|
|
64
|
+
/**
|
|
65
|
+
* Custom content or component to be displayed in the footer, typically to the left of the action buttons.
|
|
66
|
+
*/
|
|
67
|
+
footerContent?: ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* An array of action button objects to display in the modal's footer.
|
|
70
|
+
* The rendered buttons are automatically wrapped in a `ButtonGroup` component to ensure proper spacing and alignment.
|
|
71
|
+
* Each object conforms to the `IButtonProps` interface, allowing full customization of each button.
|
|
72
|
+
* @example
|
|
73
|
+
* actions={[
|
|
74
|
+
* { children: 'Cancel', appearance: 'secondary', onClick: handleCancel },
|
|
75
|
+
* { children: 'Submit', appearance: 'primary', onClick: handleSubmit }
|
|
76
|
+
* ]}
|
|
77
|
+
*/
|
|
78
|
+
actions?: IButtonProps[];
|
|
79
|
+
/**
|
|
80
|
+
* If `true`, disables scrolling on the `body` element when the modal is open.
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
83
|
+
lockBodyScroll?: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Modal component displays content in a layer above the main application, effectively focusing the user's attention on a specific task or information. It is often used for actions that require user input, such as confirmation dialogs, forms, or important notifications.
|
|
87
|
+
*/
|
|
88
|
+
declare const Modal: FC<IModalProps>;
|
|
89
|
+
export { IModalProps, Modal as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IModalProps, default } from "./Modal";
|
package/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export { default as Pagination } from "./components/molecules/Pagination";
|
|
|
34
34
|
export { default as TextField } from "./components/molecules/TextField";
|
|
35
35
|
export { default as ButtonGroup } from "./components/molecules/ButtonGroup";
|
|
36
36
|
export { default as Notification } from "./components/molecules/Notification";
|
|
37
|
+
export { default as Modal } from "./components/molecules/Modal";
|
|
37
38
|
export { default as GlobalHeader, IGlobalHeaderProps, IAction, IProducts } from "./components/organisms/GlobalHeader";
|
|
38
39
|
export { default as GeneUIProvider, GeneUIDesignSystemContext, IGeneUIDesignSystemContext, IGeneUIProviderProps } from "./components/providers/GeneUIProvider";
|
|
39
40
|
export { default as useDebounce } from "./hooks/useDebounceCallback";
|
package/index.js
CHANGED
|
@@ -35,6 +35,7 @@ export { default as Pagination } from './Pagination.js';
|
|
|
35
35
|
export { default as TextField } from './TextField.js';
|
|
36
36
|
export { default as ButtonGroup } from './ButtonGroup.js';
|
|
37
37
|
export { default as Notification } from './Notification.js';
|
|
38
|
+
export { default as Modal } from './Modal.js';
|
|
38
39
|
export { default as GlobalHeader } from './GlobalHeader.js';
|
|
39
40
|
export { a as GeneUIDesignSystemContext, G as GeneUIProvider, c as useBreakpoint, b as useDeviceInfo, u as useWindowSize } from './index-d9a2e208.js';
|
|
40
41
|
export { u as useDebounce } from './useDebounceCallback-999deae7.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geneui/components",
|
|
3
3
|
"description": "The Gene UI components library designed for BI tools",
|
|
4
|
-
"version": "3.0.0-next-
|
|
4
|
+
"version": "3.0.0-next-e06ec94-05082025",
|
|
5
5
|
"author": "SoftConstruct",
|
|
6
6
|
"homepage": "https://github.com/softconstruct/gene-ui-components#readme",
|
|
7
7
|
"repository": {
|