@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.
Files changed (30) hide show
  1. package/dist/css/dynamic-ui-non-root.css +205 -895
  2. package/dist/css/dynamic-ui-non-root.min.css +2 -2
  3. package/dist/css/dynamic-ui-root.css +1 -17
  4. package/dist/css/dynamic-ui-root.min.css +2 -2
  5. package/dist/css/dynamic-ui.css +205 -911
  6. package/dist/css/dynamic-ui.min.css +2 -2
  7. package/dist/index.esm.js +35 -31
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +34 -30
  10. package/dist/index.js.map +1 -1
  11. package/dist/types/components/DBadge/DBadge.d.ts +3 -2
  12. package/dist/types/components/DButton/DButton.d.ts +3 -2
  13. package/package.json +7 -14
  14. package/src/style/abstracts/_utilities.scss +7 -8
  15. package/src/style/abstracts/variables/_+import.scss +0 -4
  16. package/src/style/abstracts/variables/_alerts.scss +1 -1
  17. package/src/style/abstracts/variables/_input-phone.scss +1 -1
  18. package/src/style/abstracts/variables/_tooltip.scss +2 -2
  19. package/src/style/abstracts/variables/_typography.scss +0 -40
  20. package/src/style/base/_badge.scss +2 -2
  21. package/src/style/base/_type.scss +3 -6
  22. package/src/style/components/_d-credit-card.scss +22 -12
  23. package/src/style/components/_d-icon.scss +17 -0
  24. package/src/style/dynamic-ui.scss +1 -0
  25. package/src/style/helpers/_color-bg.scss +1 -3
  26. package/src/style/root/_root.scss +0 -5
  27. package/src/style/abstracts/variables/_quick-action-button.scss +0 -31
  28. package/src/style/abstracts/variables/_quick-action-check.scss +0 -22
  29. package/src/style/abstracts/variables/_quick-action-select.scss +0 -16
  30. package/src/style/abstracts/variables/_quick-action-switch.scss +0 -19
package/dist/index.js CHANGED
@@ -13,14 +13,14 @@ var currency = require('currency.js');
13
13
  var DatePicker = require('react-datepicker');
14
14
  var dateFns = require('date-fns');
15
15
  var Select = require('react-select');
16
+ var reactErrorBoundary = require('react-error-boundary');
16
17
  var mask = require('@react-input/mask');
18
+ var reactInternationalPhone = require('react-international-phone');
19
+ var googleLibphonenumber = require('google-libphonenumber');
17
20
  var ResponsivePagination = require('react-responsive-pagination');
18
21
  var react = require('@floating-ui/react');
19
22
  var reactHotToast = require('react-hot-toast');
20
- var reactInternationalPhone = require('react-international-phone');
21
- var googleLibphonenumber = require('google-libphonenumber');
22
23
  var html2canvas = require('html2canvas');
23
- var reactErrorBoundary = require('react-error-boundary');
24
24
  var i18n = require('i18next');
25
25
  var reactI18next = require('react-i18next');
26
26
 
@@ -432,21 +432,6 @@ function DIconBase({ icon, color, style, className, size, useListenerSize = fals
432
432
  const icons = LucideIcons__namespace;
433
433
  return icons[icon] || null;
434
434
  }, [icon, useMaterialIcons]);
435
- const colorStyle = React.useMemo(() => {
436
- if (color) {
437
- return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${color})` };
438
- }
439
- return {};
440
- }, [color]);
441
- const backgroundStyle = React.useMemo(() => {
442
- if (hasCircle) {
443
- if (color) {
444
- return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${color}-rgb), 0.1)` };
445
- }
446
- return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}body-color-rgb), 0.1)` };
447
- }
448
- return {};
449
- }, [hasCircle, color]);
450
435
  const { responsivePropValue } = useResponsiveProp(useListenerSize);
451
436
  const resolvedSize = React.useMemo(() => {
452
437
  if (!size)
@@ -455,8 +440,8 @@ function DIconBase({ icon, color, style, className, size, useListenerSize = fals
455
440
  return size;
456
441
  return responsivePropValue(size);
457
442
  }, [responsivePropValue, size]);
458
- const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, resolvedSize && { [`--${PREFIX_BS}icon-component-size`]: resolvedSize }), colorStyle), backgroundStyle), hasCircle && { [`--${PREFIX_BS}icon-component-padding`]: `calc(var(--${PREFIX_BS}icon-component-size, 24px) * 0.4)` }), style)), [resolvedSize, colorStyle, backgroundStyle, hasCircle, style]);
459
- const generateClasses = React.useMemo(() => (Object.assign({ 'd-icon': true }, className && { [className]: true })), [className]);
443
+ const generateStyleVariables = React.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]);
444
+ const generateClasses = React.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]);
460
445
  const iconSize = React.useMemo(() => {
461
446
  if (resolvedSize) {
462
447
  const numSize = parseInt(resolvedSize, 10);
@@ -511,14 +496,24 @@ function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, c
511
496
  return (jsxRuntime.jsxs("div", Object.assign({ className: classNames(generateClasses, className), style: style, id: id }, dataAttributes, { children: [image && jsxRuntime.jsx("img", { src: image, alt: nameProp, className: "d-avatar-img" }), (name && !image) && jsxRuntime.jsx("span", { className: "d-avatar-name", children: name })] })));
512
497
  }
513
498
 
514
- function DBadge({ text, soft = false, color = 'primary', id, rounded, className, size, style, iconStart, iconEnd, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, dataAttributes, }) {
499
+ function DBadge(props) {
500
+ const { text, soft = false, color = 'primary', id, rounded, className, size, style, iconStart, iconEnd, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, dataAttributes, } = props;
501
+ // Responsive size resolution using useResponsiveProp
502
+ const { responsivePropValue } = useResponsiveProp(true);
503
+ const resolvedSize = React.useMemo(() => {
504
+ if (!size)
505
+ return undefined;
506
+ if (typeof size === 'string')
507
+ return size;
508
+ return responsivePropValue(size);
509
+ }, [responsivePropValue, size]);
515
510
  const generateClasses = React.useMemo(() => ({
516
511
  badge: true,
517
512
  [`badge-${color}`]: !!color && !soft,
518
513
  [`badge-soft-${color}`]: !!color && soft,
519
514
  'rounded-pill': !!rounded,
520
- [`badge-${size}`]: !!size,
521
- }), [rounded, soft, color, size]);
515
+ [`badge-${resolvedSize}`]: !!resolvedSize,
516
+ }), [rounded, soft, color, resolvedSize]);
522
517
  return (jsxRuntime.jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, dataAttributes, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsxRuntime.jsx("span", { children: text }), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }))] })));
523
518
  }
524
519
 
@@ -1023,7 +1018,16 @@ function DBoxFile(_a) {
1023
1018
  }
1024
1019
 
1025
1020
  const DButton = React.forwardRef((props, ref) => {
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"]);
1021
+ 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 = 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", "href"]);
1022
+ // Responsive size resolution using useResponsiveProp
1023
+ const { responsivePropValue } = useResponsiveProp(true);
1024
+ const resolvedSize = React.useMemo(() => {
1025
+ if (!size)
1026
+ return undefined;
1027
+ if (typeof size === 'string')
1028
+ return size;
1029
+ return responsivePropValue(size);
1030
+ }, [responsivePropValue, size]);
1027
1031
  const [buttonWidth, setButtonWidth] = React.useState();
1028
1032
  const buttonRef = React.useRef(null);
1029
1033
  const isDisabled = React.useMemo(() => disabled || loading, [disabled, loading]);
@@ -1035,10 +1039,10 @@ const DButton = React.forwardRef((props, ref) => {
1035
1039
  return {
1036
1040
  btn: true,
1037
1041
  [variantClass]: true,
1038
- [`btn-${size}`]: !!size,
1042
+ [`btn-${resolvedSize}`]: !!resolvedSize,
1039
1043
  loading,
1040
1044
  };
1041
- }, [variant, color, size, loading]);
1045
+ }, [variant, color, loading, resolvedSize]);
1042
1046
  const ariaLabel = React.useMemo(() => {
1043
1047
  const ariaLabelProp = rest['aria-label'];
1044
1048
  return loading
@@ -1060,8 +1064,8 @@ const DButton = React.forwardRef((props, ref) => {
1060
1064
  }
1061
1065
  // eslint-disable-next-line react-hooks/exhaustive-deps
1062
1066
  }, [content, iconEnd, iconStart]);
1063
- if (props.href) {
1064
- return (jsxRuntime.jsxs("a", Object.assign({ href: props.href, target: target, rel: rel, ref: (node) => {
1067
+ if (href) {
1068
+ return (jsxRuntime.jsxs("a", Object.assign({ href: href, target: target, rel: rel, ref: (node) => {
1065
1069
  buttonRef.current = node;
1066
1070
  if (typeof ref === 'function')
1067
1071
  ref(node);
@@ -2501,7 +2505,7 @@ const BRAND_LOGOS = {
2501
2505
  mastercard: 'https://cdn.modyo.cloud/uploads/f686b9aa-65ab-4369-9db3-89ceece84f29/original/mastercard.png',
2502
2506
  };
2503
2507
  function DCreditCard({ brand = 'visa', name, number, holderText = 'Card Holder', logoImage, isChipVisible = true, className, isVertical = false, }) {
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 })] })] }));
2508
+ return (jsxRuntime.jsxs("div", { className: classNames('d-credit-card', 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", 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", children: [jsxRuntime.jsx("div", { className: "d-credit-card-number", children: number }), jsxRuntime.jsx("small", { className: "d-credit-card-holder-text", children: holderText }), jsxRuntime.jsx("span", { className: "d-credit-card-name", children: name })] })] }));
2505
2509
  }
2506
2510
 
2507
2511
  const getItemClass = (action) => {
@@ -2725,7 +2729,7 @@ const defaultMessage = (secs) => (secs > 0
2725
2729
  : "Didn't get any code?");
2726
2730
  function OtpCountdown({ seconds, resendText, message, }) {
2727
2731
  const { secondsLeft, restartCountdown } = useCountdown(seconds);
2728
- return (jsxRuntime.jsxs("div", { className: "d-flex gap-2 align-items-center", children: [jsxRuntime.jsx("p", { className: "mb-0", children: message ? message(secondsLeft) : defaultMessage(secondsLeft) }), jsxRuntime.jsx(DButton, { text: resendText, variant: "link", disabled: secondsLeft > 0, onClick: restartCountdown })] }));
2732
+ return (jsxRuntime.jsxs("div", { className: "d-flex gap-2 align-items-center", children: [jsxRuntime.jsx("p", { className: "mb-0 flex-1", children: message ? message(secondsLeft) : defaultMessage(secondsLeft) }), jsxRuntime.jsx(DButton, { text: resendText, variant: "link", className: "text-nowrap", disabled: secondsLeft > 0, onClick: restartCountdown })] }));
2729
2733
  }
2730
2734
 
2731
2735
  const TEXT_PROPS = {