@dynamic-framework/ui-react 2.0.0-dev.22 → 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 +13220 -1
- package/dist/css/dynamic-ui-non-root.min.css +2 -2
- package/dist/css/dynamic-ui-root.css +1 -1
- package/dist/css/dynamic-ui-root.min.css +1 -1
- package/dist/css/dynamic-ui.css +13220 -1
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +66 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +74 -1
- package/dist/index.js.map +1 -1
- 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/index.d.ts +2 -0
- package/package.json +2 -1
- package/src/style/abstracts/_utilities-dark.scss +72 -0
- package/src/style/dynamic-ui-non-root.scss +2 -0
- package/src/style/dynamic-ui.scss +1 -0
package/dist/index.esm.js
CHANGED
|
@@ -18,6 +18,8 @@ import { Toaster, toast } from 'react-hot-toast';
|
|
|
18
18
|
import { defaultCountries, parseCountry, usePhoneInput, CountrySelector } from 'react-international-phone';
|
|
19
19
|
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
20
20
|
import html2canvas from 'html2canvas';
|
|
21
|
+
import { getErrorMessage, ErrorBoundary } from 'react-error-boundary';
|
|
22
|
+
export { getErrorMessage, useErrorBoundary } from 'react-error-boundary';
|
|
21
23
|
import i18n from 'i18next';
|
|
22
24
|
import { initReactI18next } from 'react-i18next';
|
|
23
25
|
|
|
@@ -2474,8 +2476,12 @@ ForwardedDInputPhone.displayName = 'DInputPhone';
|
|
|
2474
2476
|
|
|
2475
2477
|
const DEFAULT_IMAGE = 'https://cdn.modyo.cloud/uploads/06b434f7-b943-4f54-9543-84a904e189aa/original/Visa_Logo_1_.png';
|
|
2476
2478
|
const CHIP_IMAGE = 'https://cdn.modyo.cloud/uploads/4660ad00-e5d8-477e-8919-52b53d0a26fb/original/chip-debit-svgrepo-com_1_.png';
|
|
2479
|
+
const BRAND_LOGOS = {
|
|
2480
|
+
visa: DEFAULT_IMAGE,
|
|
2481
|
+
mastercard: 'https://cdn.modyo.cloud/uploads/f686b9aa-65ab-4369-9db3-89ceece84f29/original/mastercard.png',
|
|
2482
|
+
};
|
|
2477
2483
|
function DCreditCard({ brand = 'visa', name, number, holderText = 'Card Holder', logoImage, isChipVisible = true, className, isVertical = false, }) {
|
|
2478
|
-
return (jsxs("div", { className: classNames('d-credit-card overflow-hidden text-white', 'position-relative rounded-3', 'd-flex', isVertical && 'is-vertical', className), children: [jsxs("div", { className: "d-credit-card-header", children: [jsx("img", { src: logoImage || DEFAULT_IMAGE, alt: brand, className: "d-credit-card-logo", width: 100 }), isChipVisible && (jsx("div", { className: "d-credit-card-chip p-2 rounded-2", children: jsx("img", { src: CHIP_IMAGE, alt: "chip", width: 30, className: "d-credit-card-chip-image" }) }))] }), jsxs("div", { className: "d-credit-card-details mt-auto d-none d-sm-block", children: [jsx("div", { className: "d-credit-card-number d-none d-sm-block mb-4", children: number }), jsx("small", { className: "d-block opacity-50", children: holderText }), jsx("span", { className: "name", children: name })] })] }));
|
|
2484
|
+
return (jsxs("div", { className: classNames('d-credit-card overflow-hidden text-white', 'position-relative rounded-3', 'd-flex', isVertical && 'is-vertical', className), children: [jsxs("div", { className: "d-credit-card-header", children: [jsx("img", { src: logoImage || BRAND_LOGOS[brand] || DEFAULT_IMAGE, alt: brand, className: "d-credit-card-logo", width: 100 }), isChipVisible && (jsx("div", { className: "d-credit-card-chip p-2 rounded-2", children: jsx("img", { src: CHIP_IMAGE, alt: "chip", width: 30, className: "d-credit-card-chip-image" }) }))] }), jsxs("div", { className: "d-credit-card-details mt-auto d-none d-sm-block", children: [jsx("div", { className: "d-credit-card-number d-none d-sm-block mb-4", children: number }), jsx("small", { className: "d-block opacity-50", children: holderText }), jsx("span", { className: "name", children: name })] })] }));
|
|
2479
2485
|
}
|
|
2480
2486
|
|
|
2481
2487
|
const getItemClass = (action) => {
|
|
@@ -2732,5 +2738,63 @@ function DOtp({ className, action, isLoading, otpSize = 6, texts = TEXT_PROPS, s
|
|
|
2732
2738
|
}, loading: isLoading }), jsx("p", { className: "small ms-lg-auto mb-0", children: texts.contact })] })] })] }));
|
|
2733
2739
|
}
|
|
2734
2740
|
|
|
2735
|
-
|
|
2741
|
+
function DefaultErrorBoundary({ resetErrorBoundary }) {
|
|
2742
|
+
return (jsx(DAlert, { color: "danger", showClose: false, children: jsxs("div", { className: "d-flex align-items-center gap-2", children: [jsx("span", { children: "An unexpected error occurred." }), jsx(DButton, { color: "secondary", variant: "outline", size: "sm", onClick: resetErrorBoundary, children: "Retry" })] }) }));
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
function DErrorBoundary({ name, fallback, resetKeys, onReset, onError, children, }) {
|
|
2746
|
+
const handleError = useCallback((error, info) => {
|
|
2747
|
+
// eslint-disable-next-line no-console
|
|
2748
|
+
console.error(`[DErrorBoundary${name ? `:${name}` : ''}]`, getErrorMessage(error), info);
|
|
2749
|
+
onError === null || onError === void 0 ? void 0 : onError(error, info);
|
|
2750
|
+
}, [name, onError]);
|
|
2751
|
+
const FallbackRender = useCallback((props) => {
|
|
2752
|
+
if (fallback)
|
|
2753
|
+
return fallback(props);
|
|
2754
|
+
return (jsx(DefaultErrorBoundary, { resetErrorBoundary: props.resetErrorBoundary }));
|
|
2755
|
+
}, [fallback]);
|
|
2756
|
+
return (jsx(ErrorBoundary, { resetKeys: resetKeys, onReset: onReset, onError: handleError, fallbackRender: FallbackRender, children: children }));
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
function ErrorState({ message, onRetry, retryMessage = 'Retry', color = 'danger', }) {
|
|
2760
|
+
return (jsxs(DAlert, { color: color, className: "d-flex align-items-center gap-3", children: [jsx("div", { className: "flex-grow-1", children: jsx("p", { className: "mb-0", children: message !== null && message !== void 0 ? message : 'An unexpected error occurred.' }) }), onRetry && (jsx(DButton, { onClick: onRetry, text: retryMessage, variant: "outline", iconStart: "RefreshCw" }))] }));
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
function EmptyState({ message, icon = 'FileText', actionText, onAction, }) {
|
|
2764
|
+
return (jsxs("div", { className: "d-flex flex-column align-items-center justify-content-center p-5 text-center", children: [jsx(DIcon, { icon: icon, size: "3rem", className: "text-secondary mb-3" }), jsx("p", { className: "text-secondary mb-3", children: message !== null && message !== void 0 ? message : 'No data available.' }), actionText && onAction && (jsx(DButton, { onClick: onAction, text: actionText, variant: "outline" }))] }));
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
function LoadingState({ ariaLabel = 'Loading...', className }) {
|
|
2768
|
+
return (jsx("div", { className: `d-flex align-items-center justify-content-center p-4 ${className || ''}`.trim(), "aria-busy": "true", "aria-live": "polite", children: jsx("span", { className: "spinner-border", role: "status", "aria-label": ariaLabel }) }));
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
function render(renderable) {
|
|
2772
|
+
if (renderable === undefined)
|
|
2773
|
+
return null;
|
|
2774
|
+
return typeof renderable === 'function' ? renderable() : renderable;
|
|
2775
|
+
}
|
|
2776
|
+
function DDataStateWrapper({ isLoading, isError, data, onRetry, renderLoading, renderEmpty, renderError, children, }) {
|
|
2777
|
+
// 1. Loading
|
|
2778
|
+
if (isLoading) {
|
|
2779
|
+
if (renderLoading)
|
|
2780
|
+
return render(renderLoading);
|
|
2781
|
+
return jsx(LoadingState, {});
|
|
2782
|
+
}
|
|
2783
|
+
// 2. Error
|
|
2784
|
+
if (isError) {
|
|
2785
|
+
if (renderError)
|
|
2786
|
+
return render(renderError);
|
|
2787
|
+
return (jsx(ErrorState, { onRetry: onRetry }));
|
|
2788
|
+
}
|
|
2789
|
+
// 3. Empty
|
|
2790
|
+
if (!(data === null || data === void 0 ? void 0 : data.length)) {
|
|
2791
|
+
if (renderEmpty)
|
|
2792
|
+
return render(renderEmpty);
|
|
2793
|
+
return (jsx(EmptyState, {}));
|
|
2794
|
+
}
|
|
2795
|
+
// 4. Success
|
|
2796
|
+
return jsx(Fragment, { children: children(data) });
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2799
|
+
export { DAlert, DAvatar, DBadge, DBox, DBoxFile, DButton, DButtonIcon, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCreditCard, DCurrencyText, DDataStateWrapper, DDatePicker, DDropdown, DErrorBoundary, DIcon, DIconBase, ForwardedDInput as DInput, DInputCheck, ForwardedDInputCounter as DInputCounter, ForwardedDInputCurrency as DInputCurrency, ForwardedDInputMask as DInputMask, ForwardedDInputPassword as DInputPassword, ForwardedDInputPhone as DInputPhone, DInputPin, ForwardedDInputRange as DInputRange, DInputSelect, DInputSwitch, DLayout$1 as DLayout, DLayoutPane, DListGroup$1 as DListGroup, DListGroupItem, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DOtp, DPaginator, DPasswordStrengthMeter, DPopover, DProgress, DSelect$1 as DSelect, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DTabContent, DTabs$1 as DTabs, DTimeline, DToast$1 as DToast, DToastContainer, DTooltip, DVoucher, changeQueryString, checkMediaQuery, configureI8n as configureI18n, formatCurrency, getCssVariable, getQueryString, subscribeToMediaQuery, useDContext, useDPortalContext, useDToast, useDisableBodyScrollEffect, useDisableInputWheel, useFormatCurrency, useInputCurrency, useItemSelection, useMediaBreakpointUpLg, useMediaBreakpointUpMd, useMediaBreakpointUpSm, useMediaBreakpointUpXl, useMediaBreakpointUpXs, useMediaBreakpointUpXxl, useMediaQuery, usePortal, useProvidedRefOrCreate, useStackState, useTabContext, validatePhoneNumber };
|
|
2736
2800
|
//# sourceMappingURL=index.esm.js.map
|