@dynamic-framework/ui-react 2.0.0-dev.23 → 2.0.0-dev.24
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 +205 -895
- package/dist/css/dynamic-ui-non-root.min.css +2 -2
- package/dist/css/dynamic-ui-root.css +1 -17
- package/dist/css/dynamic-ui-root.min.css +2 -2
- package/dist/css/dynamic-ui.css +205 -911
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +35 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +34 -30
- package/dist/index.js.map +1 -1
- package/dist/types/components/DBadge/DBadge.d.ts +3 -2
- package/dist/types/components/DButton/DButton.d.ts +3 -2
- package/package.json +7 -14
- package/src/style/abstracts/_utilities.scss +7 -8
- package/src/style/abstracts/variables/_+import.scss +0 -4
- package/src/style/abstracts/variables/_alerts.scss +1 -1
- package/src/style/abstracts/variables/_input-phone.scss +1 -1
- package/src/style/abstracts/variables/_tooltip.scss +2 -2
- package/src/style/abstracts/variables/_typography.scss +0 -40
- package/src/style/base/_badge.scss +2 -2
- package/src/style/base/_type.scss +3 -6
- package/src/style/components/_d-credit-card.scss +22 -12
- package/src/style/components/_d-icon.scss +17 -0
- package/src/style/dynamic-ui.scss +1 -0
- package/src/style/helpers/_color-bg.scss +1 -3
- package/src/style/root/_root.scss +0 -5
- package/src/style/abstracts/variables/_quick-action-button.scss +0 -31
- package/src/style/abstracts/variables/_quick-action-check.scss +0 -22
- package/src/style/abstracts/variables/_quick-action-select.scss +0 -16
- package/src/style/abstracts/variables/_quick-action-switch.scss +0 -19
package/dist/index.esm.js
CHANGED
|
@@ -11,15 +11,15 @@ import currency from 'currency.js';
|
|
|
11
11
|
import DatePicker from 'react-datepicker';
|
|
12
12
|
import { getYear, format, getMonth } from 'date-fns';
|
|
13
13
|
import Select, { components } from 'react-select';
|
|
14
|
+
import { getErrorMessage, ErrorBoundary } from 'react-error-boundary';
|
|
15
|
+
export { getErrorMessage, useErrorBoundary } from 'react-error-boundary';
|
|
14
16
|
import { InputMask } from '@react-input/mask';
|
|
17
|
+
import { defaultCountries, parseCountry, usePhoneInput, CountrySelector } from 'react-international-phone';
|
|
18
|
+
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
15
19
|
import ResponsivePagination from 'react-responsive-pagination';
|
|
16
20
|
import { useFloating, autoUpdate, offset, flip, shift, useClick, useDismiss, useRole, useInteractions, useId as useId$1, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
17
21
|
import { Toaster, toast } from 'react-hot-toast';
|
|
18
|
-
import { defaultCountries, parseCountry, usePhoneInput, CountrySelector } from 'react-international-phone';
|
|
19
|
-
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
20
22
|
import html2canvas from 'html2canvas';
|
|
21
|
-
import { getErrorMessage, ErrorBoundary } from 'react-error-boundary';
|
|
22
|
-
export { getErrorMessage, useErrorBoundary } from 'react-error-boundary';
|
|
23
23
|
import i18n from 'i18next';
|
|
24
24
|
import { initReactI18next } from 'react-i18next';
|
|
25
25
|
|
|
@@ -412,21 +412,6 @@ function DIconBase({ icon, color, style, className, size, useListenerSize = fals
|
|
|
412
412
|
const icons = LucideIcons;
|
|
413
413
|
return icons[icon] || null;
|
|
414
414
|
}, [icon, useMaterialIcons]);
|
|
415
|
-
const colorStyle = useMemo(() => {
|
|
416
|
-
if (color) {
|
|
417
|
-
return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${color})` };
|
|
418
|
-
}
|
|
419
|
-
return {};
|
|
420
|
-
}, [color]);
|
|
421
|
-
const backgroundStyle = useMemo(() => {
|
|
422
|
-
if (hasCircle) {
|
|
423
|
-
if (color) {
|
|
424
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${color}-rgb), 0.1)` };
|
|
425
|
-
}
|
|
426
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}body-color-rgb), 0.1)` };
|
|
427
|
-
}
|
|
428
|
-
return {};
|
|
429
|
-
}, [hasCircle, color]);
|
|
430
415
|
const { responsivePropValue } = useResponsiveProp(useListenerSize);
|
|
431
416
|
const resolvedSize = useMemo(() => {
|
|
432
417
|
if (!size)
|
|
@@ -435,8 +420,8 @@ function DIconBase({ icon, color, style, className, size, useListenerSize = fals
|
|
|
435
420
|
return size;
|
|
436
421
|
return responsivePropValue(size);
|
|
437
422
|
}, [responsivePropValue, size]);
|
|
438
|
-
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign(Object.assign(
|
|
439
|
-
const generateClasses = useMemo(() => (Object.assign({ 'd-icon': true }, className && { [className]: true })), [className]);
|
|
423
|
+
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign(Object.assign({}, resolvedSize && { [`--${PREFIX_BS}icon-component-size`]: resolvedSize }), hasCircle && { [`--${PREFIX_BS}icon-component-padding`]: `calc(var(--${PREFIX_BS}icon-component-size, 24px) * 0.4)` }), style)), [resolvedSize, hasCircle, style]);
|
|
424
|
+
const generateClasses = useMemo(() => (Object.assign(Object.assign(Object.assign({ 'd-icon': true }, className && { [className]: true }), { 'd-icon-has-circle': hasCircle }), color && { [`d-icon-color-${color}`]: true })), [className, hasCircle, color]);
|
|
440
425
|
const iconSize = useMemo(() => {
|
|
441
426
|
if (resolvedSize) {
|
|
442
427
|
const numSize = parseInt(resolvedSize, 10);
|
|
@@ -491,14 +476,24 @@ function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, c
|
|
|
491
476
|
return (jsxs("div", Object.assign({ className: classNames(generateClasses, className), style: style, id: id }, dataAttributes, { children: [image && jsx("img", { src: image, alt: nameProp, className: "d-avatar-img" }), (name && !image) && jsx("span", { className: "d-avatar-name", children: name })] })));
|
|
492
477
|
}
|
|
493
478
|
|
|
494
|
-
function DBadge(
|
|
479
|
+
function DBadge(props) {
|
|
480
|
+
const { text, soft = false, color = 'primary', id, rounded, className, size, style, iconStart, iconEnd, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, dataAttributes, } = props;
|
|
481
|
+
// Responsive size resolution using useResponsiveProp
|
|
482
|
+
const { responsivePropValue } = useResponsiveProp(true);
|
|
483
|
+
const resolvedSize = useMemo(() => {
|
|
484
|
+
if (!size)
|
|
485
|
+
return undefined;
|
|
486
|
+
if (typeof size === 'string')
|
|
487
|
+
return size;
|
|
488
|
+
return responsivePropValue(size);
|
|
489
|
+
}, [responsivePropValue, size]);
|
|
495
490
|
const generateClasses = useMemo(() => ({
|
|
496
491
|
badge: true,
|
|
497
492
|
[`badge-${color}`]: !!color && !soft,
|
|
498
493
|
[`badge-soft-${color}`]: !!color && soft,
|
|
499
494
|
'rounded-pill': !!rounded,
|
|
500
|
-
[`badge-${
|
|
501
|
-
}), [rounded, soft, color,
|
|
495
|
+
[`badge-${resolvedSize}`]: !!resolvedSize,
|
|
496
|
+
}), [rounded, soft, color, resolvedSize]);
|
|
502
497
|
return (jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, dataAttributes, { children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsx("span", { children: text }), iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }))] })));
|
|
503
498
|
}
|
|
504
499
|
|
|
@@ -1003,7 +998,16 @@ function DBoxFile(_a) {
|
|
|
1003
998
|
}
|
|
1004
999
|
|
|
1005
1000
|
const DButton = forwardRef((props, ref) => {
|
|
1006
|
-
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 = __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"]);
|
|
1001
|
+
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, href } = props, rest = __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", "href"]);
|
|
1002
|
+
// Responsive size resolution using useResponsiveProp
|
|
1003
|
+
const { responsivePropValue } = useResponsiveProp(true);
|
|
1004
|
+
const resolvedSize = useMemo(() => {
|
|
1005
|
+
if (!size)
|
|
1006
|
+
return undefined;
|
|
1007
|
+
if (typeof size === 'string')
|
|
1008
|
+
return size;
|
|
1009
|
+
return responsivePropValue(size);
|
|
1010
|
+
}, [responsivePropValue, size]);
|
|
1007
1011
|
const [buttonWidth, setButtonWidth] = useState();
|
|
1008
1012
|
const buttonRef = useRef(null);
|
|
1009
1013
|
const isDisabled = useMemo(() => disabled || loading, [disabled, loading]);
|
|
@@ -1015,10 +1019,10 @@ const DButton = forwardRef((props, ref) => {
|
|
|
1015
1019
|
return {
|
|
1016
1020
|
btn: true,
|
|
1017
1021
|
[variantClass]: true,
|
|
1018
|
-
[`btn-${
|
|
1022
|
+
[`btn-${resolvedSize}`]: !!resolvedSize,
|
|
1019
1023
|
loading,
|
|
1020
1024
|
};
|
|
1021
|
-
}, [variant, color,
|
|
1025
|
+
}, [variant, color, loading, resolvedSize]);
|
|
1022
1026
|
const ariaLabel = useMemo(() => {
|
|
1023
1027
|
const ariaLabelProp = rest['aria-label'];
|
|
1024
1028
|
return loading
|
|
@@ -1040,8 +1044,8 @@ const DButton = forwardRef((props, ref) => {
|
|
|
1040
1044
|
}
|
|
1041
1045
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1042
1046
|
}, [content, iconEnd, iconStart]);
|
|
1043
|
-
if (
|
|
1044
|
-
return (jsxs("a", Object.assign({ href:
|
|
1047
|
+
if (href) {
|
|
1048
|
+
return (jsxs("a", Object.assign({ href: href, target: target, rel: rel, ref: (node) => {
|
|
1045
1049
|
buttonRef.current = node;
|
|
1046
1050
|
if (typeof ref === 'function')
|
|
1047
1051
|
ref(node);
|
|
@@ -2481,7 +2485,7 @@ const BRAND_LOGOS = {
|
|
|
2481
2485
|
mastercard: 'https://cdn.modyo.cloud/uploads/f686b9aa-65ab-4369-9db3-89ceece84f29/original/mastercard.png',
|
|
2482
2486
|
};
|
|
2483
2487
|
function DCreditCard({ brand = 'visa', name, number, holderText = 'Card Holder', logoImage, isChipVisible = true, className, isVertical = false, }) {
|
|
2484
|
-
return (jsxs("div", { className: classNames('d-credit-card
|
|
2488
|
+
return (jsxs("div", { className: classNames('d-credit-card', 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", children: jsx("img", { src: CHIP_IMAGE, alt: "chip", width: 30, className: "d-credit-card-chip-image" }) }))] }), jsxs("div", { className: "d-credit-card-details", children: [jsx("div", { className: "d-credit-card-number", children: number }), jsx("small", { className: "d-credit-card-holder-text", children: holderText }), jsx("span", { className: "d-credit-card-name", children: name })] })] }));
|
|
2485
2489
|
}
|
|
2486
2490
|
|
|
2487
2491
|
const getItemClass = (action) => {
|
|
@@ -2705,7 +2709,7 @@ const defaultMessage = (secs) => (secs > 0
|
|
|
2705
2709
|
: "Didn't get any code?");
|
|
2706
2710
|
function OtpCountdown({ seconds, resendText, message, }) {
|
|
2707
2711
|
const { secondsLeft, restartCountdown } = useCountdown(seconds);
|
|
2708
|
-
return (jsxs("div", { className: "d-flex gap-2 align-items-center", children: [jsx("p", { className: "mb-0", children: message ? message(secondsLeft) : defaultMessage(secondsLeft) }), jsx(DButton, { text: resendText, variant: "link", disabled: secondsLeft > 0, onClick: restartCountdown })] }));
|
|
2712
|
+
return (jsxs("div", { className: "d-flex gap-2 align-items-center", children: [jsx("p", { className: "mb-0 flex-1", children: message ? message(secondsLeft) : defaultMessage(secondsLeft) }), jsx(DButton, { text: resendText, variant: "link", className: "text-nowrap", disabled: secondsLeft > 0, onClick: restartCountdown })] }));
|
|
2709
2713
|
}
|
|
2710
2714
|
|
|
2711
2715
|
const TEXT_PROPS = {
|