@ncds/ui-admin 1.8.22-alpha.0 → 1.8.22-alpha.1
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/cjs/src/components/overlays/modal/Modal.js +41 -46
- package/dist/cjs/src/components/overlays/postcode-search-modal/PostcodeSearchModal.js +2 -2
- package/dist/cjs/src/generated/scoped-css.js +1 -1
- package/dist/esm/src/components/overlays/modal/Modal.js +42 -47
- package/dist/esm/src/components/overlays/postcode-search-modal/PostcodeSearchModal.js +2 -2
- package/dist/esm/src/generated/scoped-css.js +1 -1
- package/dist/temp/src/components/overlays/modal/Modal.d.ts +5 -5
- package/dist/temp/src/components/overlays/modal/Modal.js +14 -11
- package/dist/temp/src/components/overlays/postcode-search-modal/PostcodeSearchModal.js +1 -1
- package/dist/temp/src/generated/scoped-css.js +1 -1
- package/dist/types/src/components/overlays/modal/Modal.d.ts +5 -5
- package/dist/ui-admin/assets/styles/style.css +20 -15
- package/package.json +1 -1
|
@@ -12,12 +12,14 @@ type ModalProps = {
|
|
|
12
12
|
children: ReactNode;
|
|
13
13
|
closeOnBackdropClick?: boolean;
|
|
14
14
|
closeOnEsc?: boolean;
|
|
15
|
+
showHeaderDivider?: boolean;
|
|
16
|
+
showActionsDivider?: boolean;
|
|
15
17
|
className?: string;
|
|
16
18
|
zIndex?: number;
|
|
17
19
|
};
|
|
18
20
|
declare const Modal: {
|
|
19
|
-
({ isOpen, onClose, children, size, closeOnBackdropClick, closeOnEsc, className, zIndex, ...restProps }: ModalProps): import("react").ReactPortal | null;
|
|
20
|
-
Header({ children, onClose, featuredIcon, title, subtitle, align,
|
|
21
|
+
({ isOpen, onClose, children, size, closeOnBackdropClick, closeOnEsc, showHeaderDivider, showActionsDivider, className, zIndex, ...restProps }: ModalProps): import("react").ReactPortal | null;
|
|
22
|
+
Header({ children, onClose, featuredIcon, title, subtitle, align, hideCloseButton, }: ModalHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
Content({ children, className }: ModalContentProps): import("react/jsx-runtime").JSX.Element;
|
|
22
24
|
/**
|
|
23
25
|
* Modal.Actions - The actions area of the modal
|
|
@@ -47,7 +49,7 @@ declare const Modal: {
|
|
|
47
49
|
* <Button size="sm" label="Confirm" onClick={handleConfirm} hierarchy="primary" />
|
|
48
50
|
* </Modal.Actions>
|
|
49
51
|
*/
|
|
50
|
-
Actions({ children, layout,
|
|
52
|
+
Actions({ children, layout, align, checkboxContent, className, }: ModalActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
51
53
|
};
|
|
52
54
|
type ModalHeaderProps = {
|
|
53
55
|
children?: ReactNode;
|
|
@@ -60,7 +62,6 @@ type ModalHeaderProps = {
|
|
|
60
62
|
align?: ModalHeaderAlign;
|
|
61
63
|
title?: string | ReactNode;
|
|
62
64
|
subtitle?: string | ReactNode;
|
|
63
|
-
showDivider?: boolean;
|
|
64
65
|
hideCloseButton?: boolean;
|
|
65
66
|
};
|
|
66
67
|
type ModalContentProps = {
|
|
@@ -71,7 +72,6 @@ type ModalActionsProps = {
|
|
|
71
72
|
className?: string;
|
|
72
73
|
children: ReactNode;
|
|
73
74
|
layout?: ModalActionsLayout;
|
|
74
|
-
showDivider?: boolean;
|
|
75
75
|
align?: ModalActionsAlign;
|
|
76
76
|
checkboxContent?: ReactNode;
|
|
77
77
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { useEffect, useRef } from 'react';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
5
|
import { ButtonCloseX } from '../../action/button/ButtonCloseX';
|
|
6
6
|
import { FeaturedIcon } from '../../image-and-icons/featured-icon';
|
|
7
|
-
const Modal = ({ isOpen, onClose, children, size = 'md', closeOnBackdropClick = false, closeOnEsc = true, className, zIndex, ...restProps }) => {
|
|
7
|
+
const Modal = ({ isOpen, onClose, children, size = 'md', closeOnBackdropClick = false, closeOnEsc = true, showHeaderDivider = false, showActionsDivider = false, className, zIndex, ...restProps }) => {
|
|
8
8
|
const modalRef = useRef(null);
|
|
9
9
|
const handleBackdropClick = (e) => {
|
|
10
10
|
if (closeOnBackdropClick && e.target === e.currentTarget) {
|
|
@@ -28,13 +28,16 @@ const Modal = ({ isOpen, onClose, children, size = 'md', closeOnBackdropClick =
|
|
|
28
28
|
}, [isOpen, closeOnEsc, onClose]);
|
|
29
29
|
if (!isOpen)
|
|
30
30
|
return null;
|
|
31
|
-
const modalContent = (_jsx("div", { className: classnames('ncua-modal-backdrop', className), onClick: handleBackdropClick, ref: modalRef, style: zIndex ? { zIndex } : undefined, ...restProps, children: _jsx("div", { className: classnames('ncua-modal', `ncua-modal--${size}
|
|
31
|
+
const modalContent = (_jsx("div", { className: classnames('ncua-modal-backdrop', className), onClick: handleBackdropClick, ref: modalRef, style: zIndex ? { zIndex } : undefined, ...restProps, children: _jsx("div", { className: classnames('ncua-modal', `ncua-modal--${size}`, {
|
|
32
|
+
'ncua-modal--divider-header': showHeaderDivider,
|
|
33
|
+
'ncua-modal--divider-actions': showActionsDivider,
|
|
34
|
+
}), children: children }) }));
|
|
32
35
|
return ReactDOM.createPortal(modalContent, document.body);
|
|
33
36
|
};
|
|
34
|
-
Modal.Header = ({ children, onClose, featuredIcon, title, subtitle, align = 'left',
|
|
35
|
-
return (_jsxs(
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
Modal.Header = ({ children, onClose, featuredIcon, title, subtitle, align = 'left', hideCloseButton = false, }) => {
|
|
38
|
+
return (_jsxs("header", { className: classnames('ncua-modal__header', `ncua-modal__header--${align}`, {
|
|
39
|
+
'ncua-modal__header--close-button': !hideCloseButton,
|
|
40
|
+
}), children: [featuredIcon && (_jsx(FeaturedIcon, { icon: featuredIcon.icon, color: featuredIcon.color, theme: featuredIcon.theme, size: "sm" })), _jsxs("div", { className: "ncua-modal__title", children: [_jsx("div", { className: "ncua-modal__title-text", children: title }), subtitle && _jsx("div", { className: "ncua-modal__title-subtitle", children: subtitle })] }), children, !hideCloseButton && (_jsx(ButtonCloseX, { className: "ncua-modal__close-button", size: "sm", theme: "light", onClick: onClose }))] }));
|
|
38
41
|
};
|
|
39
42
|
Modal.Content = ({ children, className }) => {
|
|
40
43
|
return _jsx("div", { className: classnames('ncua-modal__content', className), children: children });
|
|
@@ -67,9 +70,9 @@ Modal.Content = ({ children, className }) => {
|
|
|
67
70
|
* <Button size="sm" label="Confirm" onClick={handleConfirm} hierarchy="primary" />
|
|
68
71
|
* </Modal.Actions>
|
|
69
72
|
*/
|
|
70
|
-
Modal.Actions = ({ children, layout = 'vertical',
|
|
71
|
-
return (_jsxs(
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
Modal.Actions = ({ children, layout = 'vertical', align = 'stretch', checkboxContent, className, }) => {
|
|
74
|
+
return (_jsxs("div", { className: classnames('ncua-modal__actions-wrapper', className, {
|
|
75
|
+
'ncua-modal__actions-wrapper--checkbox': layout === 'checkbox',
|
|
76
|
+
}), children: [layout === 'checkbox' && (_jsx("div", { className: "ncua-modal__actions-checkbox", children: _jsx("div", { className: "ncua-modal__actions-checkbox-content", children: checkboxContent }) })), _jsx("div", { className: classnames('ncua-modal__actions', `ncua-modal__actions--${layout}`, `ncua-modal__actions--${align}`), children: children })] }));
|
|
74
77
|
};
|
|
75
78
|
export { Modal };
|
|
@@ -117,7 +117,7 @@ const PostcodeSearchModal = ({ open, onClose, zIndex, className, searchQuery, on
|
|
|
117
117
|
event.preventDefault();
|
|
118
118
|
handleSearch();
|
|
119
119
|
};
|
|
120
|
-
return (_jsxs(Modal, { isOpen: open, onClose: onClose, size: "md", zIndex: zIndex, className: className, children: [_jsx(Modal.Header, { title: MODAL_TITLE, onClose: onClose
|
|
120
|
+
return (_jsxs(Modal, { isOpen: open, onClose: onClose, size: "md", zIndex: zIndex, className: className, showHeaderDivider: true, children: [_jsx(Modal.Header, { title: MODAL_TITLE, onClose: onClose }), _jsx(Modal.Content, { children: _jsxs("div", { className: "ncua-postcode-search-modal", ref: rootRef, children: [_jsxs("div", { className: classnames('ncua-postcode-search-modal__search-area', {
|
|
121
121
|
'is-fixed': hasResults && isContentScrolled,
|
|
122
122
|
}), children: [_jsxs("div", { className: "ncua-postcode-search-modal__search", children: [_jsx(InputBase, { className: "ncua-postcode-search-modal__search-input", size: "sm", fullWidth: true, value: searchQuery, clearText: !!searchQuery, onClearText: () => onSearchQueryChange(''), onChange: handleSearchQueryChange, onKeyDown: handleSearchKeyDown, placeholder: SEARCH_PLACEHOLDER, destructive: hasError, hintText: errorCode ? (ERROR_HINT[errorCode] ?? DEFAULT_ERROR_HINT) : undefined }), _jsx(Button, { className: "ncua-postcode-search-modal__search-button", label: SEARCH_BUTTON_LABEL, size: "sm", hierarchy: "secondary", onClick: handleSearch })] }), showSearchHint && (_jsxs("div", { children: [_jsx("p", { className: "ncua-postcode-search-modal__result-title", children: "\uC544\uB798 \uC870\uD569\uC73C\uB85C \uAC80\uC0C9 \uC2DC \uC8FC\uC18C\uB97C \uB354 \uC27D\uAC8C \uCC3E\uC744 \uC218 \uC788\uC5B4\uC694." }), _jsx("p", { className: "ncua-postcode-search-modal__result-desc", children: "\uB3C4\uB85C\uBA85+\uAC74\uBB3C\uBC88\uD638, \uC9C0\uC5ED\uBA85+\uC9C0\uBC88, \uC9C0\uC5ED\uBA85+\uAC74\uBB3C\uBA85(\uC544\uD30C\uD2B8\uBA85)" })] }))] }), !hasResults && _jsx(PostcodeSearchModal.Tip, {}), hasResults && (_jsxs(_Fragment, { children: [_jsxs("p", { className: "ncua-postcode-search-modal__count", children: ["\uAC80\uC0C9 ", _jsx("b", { children: totalCount }), "\uAC1C"] }), _jsx("ul", { className: "ncua-postcode-search-modal__list", children: results.map((result, index) => (_jsx("li", { className: "ncua-postcode-search-modal__item", children: _jsx(Radio, { name: RESULT_RADIO_NAME, value: result.zipCode, checked: selectedKey === resultKey(result), onChange: () => {
|
|
123
123
|
setSelectedKey(resultKey(result));
|