@dynamic-framework/ui-react 2.0.0-dev.21 → 2.0.0-dev.23
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/css/dynamic-ui-non-root.css +13222 -2
- package/dist/css/dynamic-ui-non-root.min.css +3 -3
- package/dist/css/dynamic-ui-root.css +2 -2
- package/dist/css/dynamic-ui-root.min.css +2 -2
- package/dist/css/dynamic-ui.css +13222 -2
- package/dist/css/dynamic-ui.min.css +3 -3
- package/dist/index.esm.js +149 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +157 -12
- package/dist/index.js.map +1 -1
- package/dist/types/components/DButton/DButton.d.ts +4 -1
- package/dist/types/components/DButtonIcon/DButtonIcon.d.ts +5 -2
- package/dist/types/components/DCreditCard/DCreditCard.d.ts +2 -1
- package/dist/types/components/DDataStateWrapper/DDataStateWrapper.d.ts +14 -0
- package/dist/types/components/DDataStateWrapper/components/EmptyState.d.ts +8 -0
- package/dist/types/components/DDataStateWrapper/components/ErrorState.d.ts +8 -0
- package/dist/types/components/DDataStateWrapper/components/LoadingState.d.ts +6 -0
- package/dist/types/components/DDataStateWrapper/index.d.ts +2 -0
- package/dist/types/components/DErrorBoundary/DErrorBoundary.d.ts +11 -0
- package/dist/types/components/DErrorBoundary/components/DefaultErrorBoundary.d.ts +6 -0
- package/dist/types/components/DErrorBoundary/index.d.ts +3 -0
- package/dist/types/components/DVoucher/DVoucher.d.ts +5 -4
- package/dist/types/components/index.d.ts +2 -0
- package/package.json +3 -2
- package/src/style/abstracts/_utilities-dark.scss +72 -0
- package/src/style/components/_d-voucher.scss +1 -0
- package/src/style/dynamic-ui-non-root.scss +2 -0
- package/src/style/dynamic-ui.scss +1 -0
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var reactHotToast = require('react-hot-toast');
|
|
|
20
20
|
var reactInternationalPhone = require('react-international-phone');
|
|
21
21
|
var googleLibphonenumber = require('google-libphonenumber');
|
|
22
22
|
var html2canvas = require('html2canvas');
|
|
23
|
+
var reactErrorBoundary = require('react-error-boundary');
|
|
23
24
|
var i18n = require('i18next');
|
|
24
25
|
var reactI18next = require('react-i18next');
|
|
25
26
|
|
|
@@ -44,16 +45,51 @@ var LucideIcons__namespace = /*#__PURE__*/_interopNamespaceDefault(LucideIcons);
|
|
|
44
45
|
|
|
45
46
|
const PREFIX_BS = 'bs-';
|
|
46
47
|
|
|
48
|
+
/* eslint-disable no-lonely-if */
|
|
47
49
|
function useDisableBodyScrollEffect(disable) {
|
|
48
50
|
React.useEffect(() => {
|
|
49
|
-
|
|
51
|
+
let observer;
|
|
52
|
+
let timer;
|
|
53
|
+
const lock = () => {
|
|
54
|
+
const { clientWidth } = document.documentElement;
|
|
55
|
+
const { innerWidth } = window;
|
|
56
|
+
const scrollbarWidth = clientWidth ? innerWidth - clientWidth : 0;
|
|
50
57
|
document.body.style.overflow = 'hidden';
|
|
51
|
-
document.body.style.paddingRight =
|
|
58
|
+
document.body.style.paddingRight = `${Math.max(0, scrollbarWidth)}px`;
|
|
59
|
+
};
|
|
60
|
+
const unlock = () => {
|
|
61
|
+
document.body.style.overflow = 'unset';
|
|
62
|
+
document.body.style.paddingRight = '0px';
|
|
63
|
+
};
|
|
64
|
+
if (disable) {
|
|
65
|
+
lock();
|
|
52
66
|
}
|
|
53
67
|
else {
|
|
54
|
-
|
|
55
|
-
document.
|
|
68
|
+
// Wait until all portal elements are removed (exit animations done)
|
|
69
|
+
if (document.querySelector('.portal')) {
|
|
70
|
+
observer = new MutationObserver(() => {
|
|
71
|
+
if (!document.querySelector('.portal')) {
|
|
72
|
+
unlock();
|
|
73
|
+
observer === null || observer === void 0 ? void 0 : observer.disconnect();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
77
|
+
// Fallback in case observer misses changes
|
|
78
|
+
timer = window.setTimeout(() => {
|
|
79
|
+
unlock();
|
|
80
|
+
observer === null || observer === void 0 ? void 0 : observer.disconnect();
|
|
81
|
+
}, 3000);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
unlock();
|
|
85
|
+
}
|
|
56
86
|
}
|
|
87
|
+
return () => {
|
|
88
|
+
if (observer)
|
|
89
|
+
observer.disconnect();
|
|
90
|
+
if (timer)
|
|
91
|
+
window.clearTimeout(timer);
|
|
92
|
+
};
|
|
57
93
|
}, [disable]);
|
|
58
94
|
}
|
|
59
95
|
|
|
@@ -987,7 +1023,7 @@ function DBoxFile(_a) {
|
|
|
987
1023
|
}
|
|
988
1024
|
|
|
989
1025
|
const DButton = React.forwardRef((props, ref) => {
|
|
990
|
-
const { color = 'primary', size, variant, text, children, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, loading = false, loadingText, loadingAriaLabel, disabled = false, className, style, dataAttributes, onClick, type = 'button' } = props, rest = tslib.__rest(props, ["color", "size", "variant", "text", "children", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartMaterialStyle", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndMaterialStyle", "loading", "loadingText", "loadingAriaLabel", "disabled", "className", "style", "dataAttributes", "onClick", "type"]);
|
|
1026
|
+
const { color = 'primary', size, variant, text, children, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, loading = false, loadingText, loadingAriaLabel, disabled = false, className, style, dataAttributes, onClick, type = 'button', target, rel } = props, rest = tslib.__rest(props, ["color", "size", "variant", "text", "children", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartMaterialStyle", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndMaterialStyle", "loading", "loadingText", "loadingAriaLabel", "disabled", "className", "style", "dataAttributes", "onClick", "type", "target", "rel"]);
|
|
991
1027
|
const [buttonWidth, setButtonWidth] = React.useState();
|
|
992
1028
|
const buttonRef = React.useRef(null);
|
|
993
1029
|
const isDisabled = React.useMemo(() => disabled || loading, [disabled, loading]);
|
|
@@ -1024,6 +1060,19 @@ const DButton = React.forwardRef((props, ref) => {
|
|
|
1024
1060
|
}
|
|
1025
1061
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1026
1062
|
}, [content, iconEnd, iconStart]);
|
|
1063
|
+
if (props.href) {
|
|
1064
|
+
return (jsxRuntime.jsxs("a", Object.assign({ href: props.href, target: target, rel: rel, ref: (node) => {
|
|
1065
|
+
buttonRef.current = node;
|
|
1066
|
+
if (typeof ref === 'function')
|
|
1067
|
+
ref(node);
|
|
1068
|
+
// eslint-disable-next-line max-len
|
|
1069
|
+
// eslint-disable-next-line no-param-reassign, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
1070
|
+
else if (ref)
|
|
1071
|
+
ref.current = node;
|
|
1072
|
+
}, className: classNames(classes, className), style: Object.assign(Object.assign({}, style), (loading && buttonWidth
|
|
1073
|
+
? { minWidth: `${buttonWidth}px` }
|
|
1074
|
+
: undefined)), "aria-label": ariaLabel, "aria-busy": loading, "aria-disabled": isDisabled, onClick: handleClick }, dataAttributes, { children: [loading && (jsxRuntime.jsxs("span", { className: "btn-loading", children: [jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", "aria-hidden": "true" }), loadingText && jsxRuntime.jsx("span", { role: "status", children: loadingText })] })), !loading && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })), content, iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }))] }))] })));
|
|
1075
|
+
}
|
|
1027
1076
|
return (jsxRuntime.jsxs("button", Object.assign({ ref: (node) => {
|
|
1028
1077
|
buttonRef.current = node;
|
|
1029
1078
|
if (typeof ref === 'function')
|
|
@@ -1040,23 +1089,32 @@ const DButton = React.forwardRef((props, ref) => {
|
|
|
1040
1089
|
});
|
|
1041
1090
|
DButton.displayName = 'DButton';
|
|
1042
1091
|
|
|
1043
|
-
function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel, color = 'primary', type = 'button', loading = false, disabled = false, stopPropagationEnabled = true, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, }) {
|
|
1092
|
+
function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel, color = 'primary', type = 'button', loading = false, disabled = false, href, target, rel, stopPropagationEnabled = true, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, }) {
|
|
1044
1093
|
const generateClasses = React.useMemo(() => {
|
|
1045
1094
|
const variantClass = variant
|
|
1046
1095
|
? `btn-${variant}-${color}`
|
|
1047
1096
|
: `btn-${color}`;
|
|
1048
1097
|
return Object.assign(Object.assign(Object.assign({ 'btn d-button-icon': true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
|
|
1049
1098
|
}, [variant, color, size, state, loading]);
|
|
1099
|
+
const isDisabled = React.useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
|
|
1050
1100
|
const clickHandler = React.useCallback((event) => {
|
|
1051
1101
|
if (stopPropagationEnabled) {
|
|
1052
1102
|
event.stopPropagation();
|
|
1053
1103
|
}
|
|
1104
|
+
if (isDisabled) {
|
|
1105
|
+
event.preventDefault();
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1054
1108
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
1055
|
-
}, [stopPropagationEnabled, onClick]);
|
|
1056
|
-
const isDisabled = React.useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
|
|
1109
|
+
}, [stopPropagationEnabled, onClick, isDisabled]);
|
|
1057
1110
|
const newAriaLabel = React.useMemo(() => (loading
|
|
1058
1111
|
? (loadingAriaLabel || ariaLabel)
|
|
1059
1112
|
: (ariaLabel)), [ariaLabel, loading, loadingAriaLabel]);
|
|
1113
|
+
if (href) {
|
|
1114
|
+
return (jsxRuntime.jsx("a", Object.assign({ href: href, target: target, rel: rel, className: classNames(generateClasses, className), style: style, onClick: clickHandler, "aria-label": newAriaLabel, "aria-disabled": isDisabled, id: id }, dataAttributes, { children: loading
|
|
1115
|
+
? (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }))
|
|
1116
|
+
: (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })) })));
|
|
1117
|
+
}
|
|
1060
1118
|
return (jsxRuntime.jsx("button", Object.assign({ className: classNames(generateClasses, className), style: style, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel, id: id }, dataAttributes, { children: loading
|
|
1061
1119
|
? (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }))
|
|
1062
1120
|
: (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })) })));
|
|
@@ -2438,8 +2496,12 @@ ForwardedDInputPhone.displayName = 'DInputPhone';
|
|
|
2438
2496
|
|
|
2439
2497
|
const DEFAULT_IMAGE = 'https://cdn.modyo.cloud/uploads/06b434f7-b943-4f54-9543-84a904e189aa/original/Visa_Logo_1_.png';
|
|
2440
2498
|
const CHIP_IMAGE = 'https://cdn.modyo.cloud/uploads/4660ad00-e5d8-477e-8919-52b53d0a26fb/original/chip-debit-svgrepo-com_1_.png';
|
|
2499
|
+
const BRAND_LOGOS = {
|
|
2500
|
+
visa: DEFAULT_IMAGE,
|
|
2501
|
+
mastercard: 'https://cdn.modyo.cloud/uploads/f686b9aa-65ab-4369-9db3-89ceece84f29/original/mastercard.png',
|
|
2502
|
+
};
|
|
2441
2503
|
function DCreditCard({ brand = 'visa', name, number, holderText = 'Card Holder', logoImage, isChipVisible = true, className, isVertical = false, }) {
|
|
2442
|
-
return (jsxRuntime.jsxs("div", { className: classNames('d-credit-card overflow-hidden text-white', 'position-relative rounded-3', 'd-
|
|
2504
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-credit-card overflow-hidden text-white', 'position-relative rounded-3', 'd-flex', isVertical && 'is-vertical', className), children: [jsxRuntime.jsxs("div", { className: "d-credit-card-header", children: [jsxRuntime.jsx("img", { src: logoImage || BRAND_LOGOS[brand] || DEFAULT_IMAGE, alt: brand, className: "d-credit-card-logo", width: 100 }), isChipVisible && (jsxRuntime.jsx("div", { className: "d-credit-card-chip p-2 rounded-2", children: jsxRuntime.jsx("img", { src: CHIP_IMAGE, alt: "chip", width: 30, className: "d-credit-card-chip-image" }) }))] }), jsxRuntime.jsxs("div", { className: "d-credit-card-details mt-auto d-none d-sm-block", children: [jsxRuntime.jsx("div", { className: "d-credit-card-number d-none d-sm-block mb-4", children: number }), jsxRuntime.jsx("small", { className: "d-block opacity-50", children: holderText }), jsxRuntime.jsx("span", { className: "name", children: name })] })] }));
|
|
2443
2505
|
}
|
|
2444
2506
|
|
|
2445
2507
|
const getItemClass = (action) => {
|
|
@@ -2581,7 +2643,7 @@ function useScreenshotWebShare() {
|
|
|
2581
2643
|
};
|
|
2582
2644
|
}
|
|
2583
2645
|
|
|
2584
|
-
function DVoucher({ amount, amountDetails, icon
|
|
2646
|
+
function DVoucher({ amount, amountDetails, icon, title, onError, message, downloadText = 'Download', shareText = 'Share', className, children, }) {
|
|
2585
2647
|
const { shareRef, share } = useScreenshotWebShare();
|
|
2586
2648
|
const { downloadRef, download } = useScreenshotDownload();
|
|
2587
2649
|
const handleShare = () => {
|
|
@@ -2606,10 +2668,25 @@ function DVoucher({ amount, amountDetails, icon = 'CircleCheckBig', color = 'suc
|
|
|
2606
2668
|
// Error already handled by onError
|
|
2607
2669
|
});
|
|
2608
2670
|
};
|
|
2609
|
-
|
|
2671
|
+
const defaultIconProps = {
|
|
2672
|
+
icon: 'CircleCheckBig',
|
|
2673
|
+
color: 'success',
|
|
2674
|
+
size: '2rem',
|
|
2675
|
+
hasCircle: true,
|
|
2676
|
+
};
|
|
2677
|
+
const resolvedIconProps = (() => {
|
|
2678
|
+
if (icon === false || icon == null)
|
|
2679
|
+
return null;
|
|
2680
|
+
if (typeof icon === 'string')
|
|
2681
|
+
return Object.assign(Object.assign({}, defaultIconProps), { icon });
|
|
2682
|
+
if (typeof icon === 'object')
|
|
2683
|
+
return Object.assign(Object.assign({}, defaultIconProps), icon);
|
|
2684
|
+
return defaultIconProps;
|
|
2685
|
+
})();
|
|
2686
|
+
return (jsxRuntime.jsx("div", { className: classNames('d-voucher', className), ref: (el) => {
|
|
2610
2687
|
shareRef.current = el;
|
|
2611
2688
|
downloadRef.current = el;
|
|
2612
|
-
}, children: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "d-voucher-header", children: [jsxRuntime.jsx(DIcon, {
|
|
2689
|
+
}, children: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "d-voucher-header", children: [resolvedIconProps && (jsxRuntime.jsx(DIcon, Object.assign({}, resolvedIconProps))), jsxRuntime.jsxs("div", { className: "text-center", children: [jsxRuntime.jsx("h3", { className: "mb-2", children: title }), jsxRuntime.jsx("p", { className: "m-0", children: message })] })] }), amount && (jsxRuntime.jsxs("div", { className: "d-voucher-amount", children: [jsxRuntime.jsx("div", { className: classNames('text-center fw-bold fs-3', amountDetails ? 'mb-1' : 'm-0'), children: amount }), amountDetails] })), jsxRuntime.jsx("hr", { className: "my-4" }), children, jsxRuntime.jsx("hr", { className: "my-4" }), jsxRuntime.jsxs("div", { className: "d-voucher-footer", children: [jsxRuntime.jsx(DButton, { onClick: handleShare, iconStart: "Share2", text: shareText, variant: "outline", size: "sm" }), jsxRuntime.jsx(DButton, { onClick: handleDownload, iconStart: "Download", text: downloadText, variant: "outline", size: "sm" })] })] }) }));
|
|
2613
2690
|
}
|
|
2614
2691
|
|
|
2615
2692
|
function useCountdown(seconds) {
|
|
@@ -2681,6 +2758,72 @@ function DOtp({ className, action, isLoading, otpSize = 6, texts = TEXT_PROPS, s
|
|
|
2681
2758
|
}, loading: isLoading }), jsxRuntime.jsx("p", { className: "small ms-lg-auto mb-0", children: texts.contact })] })] })] }));
|
|
2682
2759
|
}
|
|
2683
2760
|
|
|
2761
|
+
function DefaultErrorBoundary({ resetErrorBoundary }) {
|
|
2762
|
+
return (jsxRuntime.jsx(DAlert, { color: "danger", showClose: false, children: jsxRuntime.jsxs("div", { className: "d-flex align-items-center gap-2", children: [jsxRuntime.jsx("span", { children: "An unexpected error occurred." }), jsxRuntime.jsx(DButton, { color: "secondary", variant: "outline", size: "sm", onClick: resetErrorBoundary, children: "Retry" })] }) }));
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
function DErrorBoundary({ name, fallback, resetKeys, onReset, onError, children, }) {
|
|
2766
|
+
const handleError = React.useCallback((error, info) => {
|
|
2767
|
+
// eslint-disable-next-line no-console
|
|
2768
|
+
console.error(`[DErrorBoundary${name ? `:${name}` : ''}]`, reactErrorBoundary.getErrorMessage(error), info);
|
|
2769
|
+
onError === null || onError === void 0 ? void 0 : onError(error, info);
|
|
2770
|
+
}, [name, onError]);
|
|
2771
|
+
const FallbackRender = React.useCallback((props) => {
|
|
2772
|
+
if (fallback)
|
|
2773
|
+
return fallback(props);
|
|
2774
|
+
return (jsxRuntime.jsx(DefaultErrorBoundary, { resetErrorBoundary: props.resetErrorBoundary }));
|
|
2775
|
+
}, [fallback]);
|
|
2776
|
+
return (jsxRuntime.jsx(reactErrorBoundary.ErrorBoundary, { resetKeys: resetKeys, onReset: onReset, onError: handleError, fallbackRender: FallbackRender, children: children }));
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
function ErrorState({ message, onRetry, retryMessage = 'Retry', color = 'danger', }) {
|
|
2780
|
+
return (jsxRuntime.jsxs(DAlert, { color: color, className: "d-flex align-items-center gap-3", children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: jsxRuntime.jsx("p", { className: "mb-0", children: message !== null && message !== void 0 ? message : 'An unexpected error occurred.' }) }), onRetry && (jsxRuntime.jsx(DButton, { onClick: onRetry, text: retryMessage, variant: "outline", iconStart: "RefreshCw" }))] }));
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
function EmptyState({ message, icon = 'FileText', actionText, onAction, }) {
|
|
2784
|
+
return (jsxRuntime.jsxs("div", { className: "d-flex flex-column align-items-center justify-content-center p-5 text-center", children: [jsxRuntime.jsx(DIcon, { icon: icon, size: "3rem", className: "text-secondary mb-3" }), jsxRuntime.jsx("p", { className: "text-secondary mb-3", children: message !== null && message !== void 0 ? message : 'No data available.' }), actionText && onAction && (jsxRuntime.jsx(DButton, { onClick: onAction, text: actionText, variant: "outline" }))] }));
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
function LoadingState({ ariaLabel = 'Loading...', className }) {
|
|
2788
|
+
return (jsxRuntime.jsx("div", { className: `d-flex align-items-center justify-content-center p-4 ${className || ''}`.trim(), "aria-busy": "true", "aria-live": "polite", children: jsxRuntime.jsx("span", { className: "spinner-border", role: "status", "aria-label": ariaLabel }) }));
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
function render(renderable) {
|
|
2792
|
+
if (renderable === undefined)
|
|
2793
|
+
return null;
|
|
2794
|
+
return typeof renderable === 'function' ? renderable() : renderable;
|
|
2795
|
+
}
|
|
2796
|
+
function DDataStateWrapper({ isLoading, isError, data, onRetry, renderLoading, renderEmpty, renderError, children, }) {
|
|
2797
|
+
// 1. Loading
|
|
2798
|
+
if (isLoading) {
|
|
2799
|
+
if (renderLoading)
|
|
2800
|
+
return render(renderLoading);
|
|
2801
|
+
return jsxRuntime.jsx(LoadingState, {});
|
|
2802
|
+
}
|
|
2803
|
+
// 2. Error
|
|
2804
|
+
if (isError) {
|
|
2805
|
+
if (renderError)
|
|
2806
|
+
return render(renderError);
|
|
2807
|
+
return (jsxRuntime.jsx(ErrorState, { onRetry: onRetry }));
|
|
2808
|
+
}
|
|
2809
|
+
// 3. Empty
|
|
2810
|
+
if (!(data === null || data === void 0 ? void 0 : data.length)) {
|
|
2811
|
+
if (renderEmpty)
|
|
2812
|
+
return render(renderEmpty);
|
|
2813
|
+
return (jsxRuntime.jsx(EmptyState, {}));
|
|
2814
|
+
}
|
|
2815
|
+
// 4. Success
|
|
2816
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children(data) });
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
Object.defineProperty(exports, "getErrorMessage", {
|
|
2820
|
+
enumerable: true,
|
|
2821
|
+
get: function () { return reactErrorBoundary.getErrorMessage; }
|
|
2822
|
+
});
|
|
2823
|
+
Object.defineProperty(exports, "useErrorBoundary", {
|
|
2824
|
+
enumerable: true,
|
|
2825
|
+
get: function () { return reactErrorBoundary.useErrorBoundary; }
|
|
2826
|
+
});
|
|
2684
2827
|
exports.DAlert = DAlert;
|
|
2685
2828
|
exports.DAvatar = DAvatar;
|
|
2686
2829
|
exports.DBadge = DBadge;
|
|
@@ -2700,8 +2843,10 @@ exports.DContext = DContext;
|
|
|
2700
2843
|
exports.DContextProvider = DContextProvider;
|
|
2701
2844
|
exports.DCreditCard = DCreditCard;
|
|
2702
2845
|
exports.DCurrencyText = DCurrencyText;
|
|
2846
|
+
exports.DDataStateWrapper = DDataStateWrapper;
|
|
2703
2847
|
exports.DDatePicker = DDatePicker;
|
|
2704
2848
|
exports.DDropdown = DDropdown;
|
|
2849
|
+
exports.DErrorBoundary = DErrorBoundary;
|
|
2705
2850
|
exports.DIcon = DIcon;
|
|
2706
2851
|
exports.DIconBase = DIconBase;
|
|
2707
2852
|
exports.DInput = ForwardedDInput;
|