@dynamic-framework/ui-react 2.1.1 → 2.3.0

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 (77) hide show
  1. package/README.md +8 -0
  2. package/dist/css/dynamic-ui.css +15518 -1105
  3. package/dist/css/dynamic-ui.min.css +3 -3
  4. package/dist/index.esm.js +338 -137
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/index.js +345 -135
  7. package/dist/index.js.map +1 -1
  8. package/dist/types/components/DBadge/DBadge.d.ts +3 -2
  9. package/dist/types/components/DButton/DButton.d.ts +7 -3
  10. package/dist/types/components/DButtonIcon/DButtonIcon.d.ts +7 -8
  11. package/dist/types/components/DCollapse/DCollapse.d.ts +1 -2
  12. package/dist/types/components/DCreditCard/DCreditCard.d.ts +2 -1
  13. package/dist/types/components/DDataStateWrapper/DDataStateWrapper.d.ts +14 -0
  14. package/dist/types/components/DDataStateWrapper/components/EmptyState.d.ts +8 -0
  15. package/dist/types/components/DDataStateWrapper/components/ErrorState.d.ts +8 -0
  16. package/dist/types/components/DDataStateWrapper/components/LoadingState.d.ts +6 -0
  17. package/dist/types/components/DDataStateWrapper/index.d.ts +2 -0
  18. package/dist/types/components/DDatePicker/DDatePicker.d.ts +2 -1
  19. package/dist/types/components/DDatePicker/components/DDatePickerTime.d.ts +4 -6
  20. package/dist/types/components/DErrorBoundary/DErrorBoundary.d.ts +11 -0
  21. package/dist/types/components/DErrorBoundary/components/DefaultErrorBoundary.d.ts +6 -0
  22. package/dist/types/components/DErrorBoundary/index.d.ts +3 -0
  23. package/dist/types/components/DInputPin/DInputPin.d.ts +2 -1
  24. package/dist/types/components/DPopover/DPopover.d.ts +2 -7
  25. package/dist/types/components/DSelect/DSelect.d.ts +2 -1
  26. package/dist/types/components/DSelect/components/DSelectOptionCheck.d.ts +1 -1
  27. package/dist/types/components/DTabs/DTabs.d.ts +3 -1
  28. package/dist/types/components/DVoucher/DVoucher.d.ts +5 -4
  29. package/dist/types/components/index.d.ts +2 -0
  30. package/package.json +18 -21
  31. package/src/style/_shame.scss +2 -2
  32. package/src/style/abstracts/_mixins.scss +4 -4
  33. package/src/style/abstracts/_utilities-dark.scss +72 -0
  34. package/src/style/abstracts/_utilities.scss +76 -8
  35. package/src/style/abstracts/variables/_+import.scss +2 -6
  36. package/src/style/abstracts/variables/_alerts.scss +1 -1
  37. package/src/style/abstracts/variables/_border.scss +9 -0
  38. package/src/style/abstracts/variables/_buttons.scss +1 -1
  39. package/src/style/abstracts/variables/_carousel.scss +13 -1
  40. package/src/style/abstracts/variables/_colors.scss +2 -2
  41. package/src/style/abstracts/variables/_input-phone.scss +1 -1
  42. package/src/style/abstracts/variables/_navs.scss +23 -27
  43. package/src/style/abstracts/variables/_tooltip.scss +2 -2
  44. package/src/style/abstracts/variables/_typography.scss +0 -40
  45. package/src/style/base/_+import.scss +1 -0
  46. package/src/style/base/_badge.scss +2 -2
  47. package/src/style/base/_carousel.scss +44 -0
  48. package/src/style/base/_collapse.scss +21 -8
  49. package/src/style/base/_nav.scss +10 -59
  50. package/src/style/base/_type.scss +7 -6
  51. package/src/style/components/_+import.scss +0 -1
  52. package/src/style/components/_d-avatar.scss +2 -2
  53. package/src/style/components/_d-carousel.scss +26 -4
  54. package/src/style/components/_d-chip.scss +13 -3
  55. package/src/style/components/_d-credit-card.scss +22 -12
  56. package/src/style/components/_d-icon.scss +17 -0
  57. package/src/style/components/_d-select.scss +59 -25
  58. package/src/style/components/_d-stepper-desktop.scss +2 -2
  59. package/src/style/components/_d-tabs.scss +7 -18
  60. package/src/style/components/_d-timeline.scss +6 -5
  61. package/src/style/components/_d-voucher.scss +2 -1
  62. package/src/style/dynamic-ui.scss +2 -0
  63. package/src/style/helpers/_+import.scss +1 -0
  64. package/src/style/helpers/_animations.scss +13 -0
  65. package/src/style/helpers/_color-bg.scss +1 -3
  66. package/src/style/root/_root.scss +8 -9
  67. package/dist/css/dynamic-ui-non-root.css +0 -37666
  68. package/dist/css/dynamic-ui-non-root.min.css +0 -6
  69. package/dist/css/dynamic-ui-root.css +0 -1132
  70. package/dist/css/dynamic-ui-root.min.css +0 -6
  71. package/src/style/abstracts/variables/_quick-action-button.scss +0 -31
  72. package/src/style/abstracts/variables/_quick-action-check.scss +0 -22
  73. package/src/style/abstracts/variables/_quick-action-select.scss +0 -16
  74. package/src/style/abstracts/variables/_quick-action-switch.scss +0 -19
  75. package/src/style/components/_d-collapse-icon-text.scss +0 -16
  76. package/src/style/dynamic-ui-non-root.scss +0 -15
  77. package/src/style/dynamic-ui-root.scss +0 -5
package/dist/index.js CHANGED
@@ -13,12 +13,13 @@ 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
24
  var i18n = require('i18next');
24
25
  var reactI18next = require('react-i18next');
@@ -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
- if (disable) {
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 = '0';
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
- document.body.style.overflow = 'unset';
55
- document.body.style.paddingRight = 'unset';
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
 
@@ -396,21 +432,6 @@ function DIconBase({ icon, color, style, className, size, useListenerSize = fals
396
432
  const icons = LucideIcons__namespace;
397
433
  return icons[icon] || null;
398
434
  }, [icon, useMaterialIcons]);
399
- const colorStyle = React.useMemo(() => {
400
- if (color) {
401
- return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${color})` };
402
- }
403
- return {};
404
- }, [color]);
405
- const backgroundStyle = React.useMemo(() => {
406
- if (hasCircle) {
407
- if (color) {
408
- return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${color}-rgb), 0.1)` };
409
- }
410
- return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}body-color-rgb), 0.1)` };
411
- }
412
- return {};
413
- }, [hasCircle, color]);
414
435
  const { responsivePropValue } = useResponsiveProp(useListenerSize);
415
436
  const resolvedSize = React.useMemo(() => {
416
437
  if (!size)
@@ -419,8 +440,8 @@ function DIconBase({ icon, color, style, className, size, useListenerSize = fals
419
440
  return size;
420
441
  return responsivePropValue(size);
421
442
  }, [responsivePropValue, size]);
422
- 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]);
423
- 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]);
424
445
  const iconSize = React.useMemo(() => {
425
446
  if (resolvedSize) {
426
447
  const numSize = parseInt(resolvedSize, 10);
@@ -475,14 +496,24 @@ function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, c
475
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 })] })));
476
497
  }
477
498
 
478
- 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]);
479
510
  const generateClasses = React.useMemo(() => ({
480
511
  badge: true,
481
512
  [`badge-${color}`]: !!color && !soft,
482
513
  [`badge-soft-${color}`]: !!color && soft,
483
514
  'rounded-pill': !!rounded,
484
- [`badge-${size}`]: !!size,
485
- }), [rounded, soft, color, size]);
515
+ [`badge-${resolvedSize}`]: !!resolvedSize,
516
+ }), [rounded, soft, color, resolvedSize]);
486
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 }))] })));
487
518
  }
488
519
 
@@ -577,7 +608,7 @@ function DInput(_a, ref) {
577
608
  [`input-group-${size}`]: !!size,
578
609
  'input-group': true,
579
610
  'has-validation': invalid || valid,
580
- }), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputStart`, children: inputStart })), iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading || iconStartDisabled, "aria-label": iconStartAriaLabel, tabIndex: onIconStartClick ? iconStartTabIndex : -1, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })), dynamicComponent, (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading || iconEndDisabled, "aria-label": iconEndAriaLabel, tabIndex: onIconEndClick ? iconEndTabIndex : -1, children: jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}Loading`, children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", "data-testid": "loading-spinner", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })), !!inputEnd && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputEnd`, children: inputEnd }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
611
+ }), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputStart`, children: inputStart })), iconStart && (onIconStartClick ? (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading || iconStartDisabled, "aria-label": iconStartAriaLabel || (typeof iconStart === 'string' ? iconStart : 'start icon'), tabIndex: iconStartTabIndex, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })) : (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}Start`, "aria-hidden": "true", tabIndex: -1, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) }))), dynamicComponent, (iconEnd && !loading) && (onIconEndClick ? (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading || iconEndDisabled, "aria-label": iconEndAriaLabel || (typeof iconEnd === 'string' ? iconEnd : 'end icon'), tabIndex: iconEndTabIndex, children: jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })) : (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}End`, "aria-hidden": "true", tabIndex: -1, children: jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) }))), loading && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}Loading`, children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", "data-testid": "loading-spinner", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })), !!inputEnd && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputEnd`, children: inputEnd }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
581
612
  }
582
613
  const ForwardedDInput = React.forwardRef(DInput);
583
614
  ForwardedDInput.displayName = 'DInput';
@@ -987,7 +1018,16 @@ function DBoxFile(_a) {
987
1018
  }
988
1019
 
989
1020
  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"]);
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, 'aria-label': ariaLabelProp } = 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", 'aria-label']);
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]);
991
1031
  const [buttonWidth, setButtonWidth] = React.useState();
992
1032
  const buttonRef = React.useRef(null);
993
1033
  const isDisabled = React.useMemo(() => disabled || loading, [disabled, loading]);
@@ -999,16 +1039,13 @@ const DButton = React.forwardRef((props, ref) => {
999
1039
  return {
1000
1040
  btn: true,
1001
1041
  [variantClass]: true,
1002
- [`btn-${size}`]: !!size,
1042
+ [`btn-${resolvedSize}`]: !!resolvedSize,
1003
1043
  loading,
1004
1044
  };
1005
- }, [variant, color, size, loading]);
1006
- const ariaLabel = React.useMemo(() => {
1007
- const ariaLabelProp = rest['aria-label'];
1008
- return loading
1009
- ? loadingAriaLabel || ariaLabelProp || text
1010
- : ariaLabelProp || text;
1011
- }, [loading, loadingAriaLabel, rest, text]);
1045
+ }, [variant, color, loading, resolvedSize]);
1046
+ const ariaLabel = React.useMemo(() => (loading
1047
+ ? loadingAriaLabel || ariaLabelProp || text
1048
+ : ariaLabelProp || text), [loading, loadingAriaLabel, text, ariaLabelProp]);
1012
1049
  const handleClick = React.useCallback((event) => {
1013
1050
  if (disabled || loading) {
1014
1051
  event.preventDefault();
@@ -1024,6 +1061,19 @@ const DButton = React.forwardRef((props, ref) => {
1024
1061
  }
1025
1062
  // eslint-disable-next-line react-hooks/exhaustive-deps
1026
1063
  }, [content, iconEnd, iconStart]);
1064
+ if (href) {
1065
+ return (jsxRuntime.jsxs("a", Object.assign({ href: href, target: target, rel: rel, ref: (node) => {
1066
+ buttonRef.current = node;
1067
+ if (typeof ref === 'function')
1068
+ ref(node);
1069
+ // eslint-disable-next-line max-len
1070
+ // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
1071
+ else if (ref)
1072
+ ref.current = node;
1073
+ }, className: classNames(classes, className), style: Object.assign(Object.assign({}, style), (loading && buttonWidth
1074
+ ? { minWidth: `${buttonWidth}px` }
1075
+ : 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 }))] }))] })));
1076
+ }
1027
1077
  return (jsxRuntime.jsxs("button", Object.assign({ ref: (node) => {
1028
1078
  buttonRef.current = node;
1029
1079
  if (typeof ref === 'function')
@@ -1040,24 +1090,34 @@ const DButton = React.forwardRef((props, ref) => {
1040
1090
  });
1041
1091
  DButton.displayName = 'DButton';
1042
1092
 
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, }) {
1093
+ function DButtonIcon(_a) {
1094
+ var { id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, disabled = false, color = 'primary', loading = false, href, target, rel, stopPropagationEnabled = true, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, 'aria-label': ariaLabelProp } = _a, rest = tslib.__rest(_a, ["id", "icon", "size", "className", "variant", "state", "loadingAriaLabel", "iconMaterialStyle", "disabled", "color", "loading", "href", "target", "rel", "stopPropagationEnabled", "style", "iconFamilyClass", "iconFamilyPrefix", "dataAttributes", "onClick", 'aria-label']);
1044
1095
  const generateClasses = React.useMemo(() => {
1045
1096
  const variantClass = variant
1046
1097
  ? `btn-${variant}-${color}`
1047
1098
  : `btn-${color}`;
1048
1099
  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
1100
  }, [variant, color, size, state, loading]);
1101
+ const isDisabled = React.useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
1050
1102
  const clickHandler = React.useCallback((event) => {
1051
1103
  if (stopPropagationEnabled) {
1052
1104
  event.stopPropagation();
1053
1105
  }
1106
+ if (isDisabled) {
1107
+ event.preventDefault();
1108
+ return;
1109
+ }
1054
1110
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
1055
- }, [stopPropagationEnabled, onClick]);
1056
- const isDisabled = React.useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
1057
- const newAriaLabel = React.useMemo(() => (loading
1058
- ? (loadingAriaLabel || ariaLabel)
1059
- : (ariaLabel)), [ariaLabel, loading, loadingAriaLabel]);
1060
- 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
1111
+ }, [stopPropagationEnabled, onClick, isDisabled]);
1112
+ const ariaLabel = React.useMemo(() => (loading
1113
+ ? loadingAriaLabel || ariaLabelProp
1114
+ : ariaLabelProp), [loading, loadingAriaLabel, ariaLabelProp]);
1115
+ if (href) {
1116
+ return (jsxRuntime.jsx("a", Object.assign({ id: id, href: href, target: target, rel: rel, className: classNames(generateClasses, className), style: style, onClick: clickHandler, "aria-label": ariaLabel, "aria-disabled": isDisabled }, dataAttributes, { children: loading
1117
+ ? (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }))
1118
+ : (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })) })));
1119
+ }
1120
+ return (jsxRuntime.jsx("button", Object.assign({ className: classNames(generateClasses, className), style: style, disabled: state === 'disabled' || loading, onClick: clickHandler, "aria-label": ariaLabel }, dataAttributes, rest, { children: loading
1061
1121
  ? (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }))
1062
1122
  : (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })) })));
1063
1123
  }
@@ -1117,7 +1177,7 @@ function DChip({ color = 'primary', text, icon, iconFamilyClass, iconFamilyPrefi
1117
1177
  return (jsxRuntime.jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, dataAttributes, { children: [icon && (jsxRuntime.jsx("div", { className: "d-chip-icon-container", children: jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), jsxRuntime.jsx("span", { children: text }), showClose && (jsxRuntime.jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, "aria-label": closeAriaLabel, children: jsxRuntime.jsx(DIcon, { icon: iconClose, familyClass: iconCloseFamilyClass, familyPrefix: iconCloseFamilyPrefix, materialStyle: iconCloseMaterialStyle }) }))] })));
1118
1178
  }
1119
1179
 
1120
- function DCollapse({ id, className, style, Component, hasSeparator = false, defaultCollapsed = true, onChange, children, iconOpen: iconOpenProp, iconClose: iconCloseProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle = false, dataAttributes, }) {
1180
+ function DCollapse({ id, className, style, Component, defaultCollapsed = true, onChange, children, iconOpen: iconOpenProp, iconClose: iconCloseProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle = false, dataAttributes, }) {
1121
1181
  const [collapsed, setCollapsed] = React.useState(defaultCollapsed);
1122
1182
  const onChangeCollapse = () => {
1123
1183
  setCollapsed((prev) => {
@@ -1134,12 +1194,9 @@ function DCollapse({ id, className, style, Component, hasSeparator = false, defa
1134
1194
  const { iconMap: { chevronDown, chevronUp, }, } = useDContext();
1135
1195
  const iconOpen = React.useMemo(() => iconOpenProp || chevronDown, [chevronDown, iconOpenProp]);
1136
1196
  const iconClose = React.useMemo(() => iconCloseProp || chevronUp, [chevronUp, iconCloseProp]);
1137
- const generateStyles = React.useMemo(() => ({
1138
- [`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
1139
- }), [hasSeparator]);
1140
- return (jsxRuntime.jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { children: [jsxRuntime.jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: Component }), jsxRuntime.jsx(DIcon, { color: "gray", size: "1rem", icon: collapsed ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), !collapsed && (jsxRuntime.jsx("div", { className: classNames({
1141
- 'collapse-body': true,
1142
- }), style: generateStyles, children: children }))] })));
1197
+ return (jsxRuntime.jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { children: [jsxRuntime.jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: Component }), jsxRuntime.jsx(DIcon, { color: "primary", size: "1.25rem", icon: collapsed ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), jsxRuntime.jsx("div", { className: classNames('collapse-body-wrapper', {
1198
+ show: !collapsed,
1199
+ }), children: jsxRuntime.jsx("div", { className: "collapse-body", children: children }) })] })));
1143
1200
  }
1144
1201
 
1145
1202
  function formatCurrency(amount, options) {
@@ -1161,10 +1218,9 @@ function DCurrencyText({ value, className, style, dataAttributes, }) {
1161
1218
  return (jsxRuntime.jsx("span", Object.assign({ className: className, style: style }, dataAttributes, { children: valueFormatted })));
1162
1219
  }
1163
1220
 
1164
- function DDatePickerTime({ value, onChange, id, }) {
1165
- return (jsxRuntime.jsx(ForwardedDInput, { className: "d-datepicker-time", type: "time", value: value, id: id, onChange: (time) => {
1166
- onChange === null || onChange === void 0 ? void 0 : onChange(time);
1167
- } }));
1221
+ function DDatePickerTime(_a) {
1222
+ var rest = tslib.__rest(_a, []);
1223
+ return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ className: "d-datepicker-time", type: "time" }, rest)));
1168
1224
  }
1169
1225
 
1170
1226
  function DDatePickerInput(_a, ref) {
@@ -1175,62 +1231,11 @@ function DDatePickerInput(_a, ref) {
1175
1231
  const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
1176
1232
  ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
1177
1233
 
1178
- function DInputCheck(_a) {
1179
- var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, inputClassName, value, hint, onChange, className, style, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "inputClassName", "value", "hint", "onChange", "className", "style", "dataAttributes"]);
1180
- const innerRef = React.useRef(null);
1181
- const innerId = React.useId();
1182
- const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
1183
- const handleChange = React.useCallback((event) => {
1184
- onChange === null || onChange === void 0 ? void 0 : onChange(event);
1185
- }, [onChange]);
1186
- const ariaDescribedby = React.useMemo(() => ([
1187
- !!hint && `${id}Hint`,
1188
- ]
1189
- .filter(Boolean)
1190
- .join(' ')), [
1191
- id,
1192
- hint,
1193
- ]);
1194
- React.useEffect(() => {
1195
- if (innerRef.current) {
1196
- innerRef.current.indeterminate = Boolean(indeterminate);
1197
- }
1198
- }, [indeterminate]);
1199
- React.useEffect(() => {
1200
- if (innerRef.current) {
1201
- innerRef.current.checked = checked;
1202
- }
1203
- }, [checked]);
1204
- const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
1205
- 'is-invalid': invalid,
1206
- 'is-valid': valid,
1207
- }, inputClassName), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, props))), [
1208
- handleChange,
1209
- invalid,
1210
- valid,
1211
- inputClassName,
1212
- style,
1213
- id,
1214
- disabled,
1215
- type,
1216
- name,
1217
- value,
1218
- ariaLabel,
1219
- ariaDescribedby,
1220
- props,
1221
- ]);
1222
- if (!label) {
1223
- return inputComponent;
1224
- }
1225
- return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('form-check', className) }, dataAttributes, { children: [inputComponent, jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
1226
- }
1227
-
1228
1234
  function DSelectOptionCheck(_a) {
1229
- var { innerProps, children, isSelected } = _a, props = tslib.__rest(_a, ["innerProps", "children", "isSelected"]);
1230
- return (jsxRuntime.jsx(Select.components.Option, Object.assign({ className: classNames({
1231
- 'd-select__option': true,
1232
- 'd-select__option--is-checkbox': true,
1233
- }), isSelected: isSelected, innerProps: innerProps }, props, { children: jsxRuntime.jsxs("label", { htmlFor: `${innerProps.id}Check`, children: [jsxRuntime.jsx(DInputCheck, { type: "checkbox", checked: isSelected, id: `${innerProps.id}Check` }), children] }) })));
1235
+ var { children, isSelected } = _a, props = tslib.__rest(_a, ["children", "isSelected"]);
1236
+ return (jsxRuntime.jsxs(Select.components.Option, Object.assign({}, props, { isSelected: isSelected, className: classNames('d-select__option'), children: [jsxRuntime.jsx("span", { className: classNames('d-select__check', {
1237
+ 'd-select__check--selected': isSelected,
1238
+ }), "aria-hidden": "true" }), jsxRuntime.jsx("span", { className: "d-select__label", children: children })] })));
1234
1239
  }
1235
1240
 
1236
1241
  function DSelectOptionIcon(_a) {
@@ -1301,7 +1306,7 @@ function DSelectPlaceholder(_a) {
1301
1306
  }
1302
1307
 
1303
1308
  function DSelect$1(_a) {
1304
- var { id: idProp, className, style, label, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, floatingLabel = false, rtl, searchable, multi, components, defaultValue, placeholder, onIconStartClick, onIconEndClick, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "className", "style", "label", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "floatingLabel", "rtl", "searchable", "multi", "components", "defaultValue", "placeholder", "onIconStartClick", "onIconEndClick", "dataAttributes"]);
1309
+ var { id: idProp, className, style, label, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, floatingLabel = false, rtl, searchable, multi, components, defaultValue, placeholder, onIconStartClick, onIconEndClick, dataAttributes, ariaLabel = 'Search for an option' } = _a, props = tslib.__rest(_a, ["id", "className", "style", "label", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "floatingLabel", "rtl", "searchable", "multi", "components", "defaultValue", "placeholder", "onIconStartClick", "onIconEndClick", "dataAttributes", "ariaLabel"]);
1305
1310
  const innerId = React.useId();
1306
1311
  const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
1307
1312
  const handleOnIconStartClick = React.useCallback(() => {
@@ -1317,7 +1322,7 @@ function DSelect$1(_a) {
1317
1322
  'input-group': true,
1318
1323
  'has-validation': invalid,
1319
1324
  disabled: disabled || loading,
1320
- }), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsxRuntime.jsx(Select, Object.assign({ id: `${id}Container`, inputId: id, styles: {
1325
+ }), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsxRuntime.jsx(Select, Object.assign({ id: `${id}Container`, inputId: id, "aria-label": ariaLabel, styles: {
1321
1326
  control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
1322
1327
  container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
1323
1328
  menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%', zIndex: 1000 })),
@@ -1372,16 +1377,16 @@ function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMont
1372
1377
  }, [date]);
1373
1378
  const [startYear, endYear] = getYearRange();
1374
1379
  if (pickerType === PickerType.Year) {
1375
- return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevYearButtonDisabled, ariaLabel: prevYearAriaLabel, className: "header-button" }), jsxRuntime.jsx("p", { children: `${startYear} - ${endYear}` }), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextYearButtonDisabled, ariaLabel: nextYearAriaLabel, className: "header-button" })] }));
1380
+ return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevYearButtonDisabled, "aria-label": prevYearAriaLabel, className: "header-button" }), jsxRuntime.jsx("p", { children: `${startYear} - ${endYear}` }), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextYearButtonDisabled, "aria-label": nextYearAriaLabel, className: "header-button" })] }));
1376
1381
  }
1377
1382
  if (pickerType === PickerType.Quarter || pickerType === PickerType.Month) {
1378
- return (jsxRuntime.jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), jsxRuntime.jsx("div", { className: "d-flex justify-content-center flex-grow-1", children: showHeaderSelectors ? (jsxRuntime.jsx(DSelect, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })) : (jsxRuntime.jsx("p", { children: defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label })) }), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] }));
1383
+ return (jsxRuntime.jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevMonthButtonDisabled, "aria-label": prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), jsxRuntime.jsx("div", { className: "d-flex justify-content-center flex-grow-1", children: showHeaderSelectors ? (jsxRuntime.jsx(DSelect, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })) : (jsxRuntime.jsx("p", { children: defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label })) }), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextMonthButtonDisabled, "aria-label": nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] }));
1379
1384
  }
1380
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "datepicker-top-header", children: [showHeaderSelectors && (jsxRuntime.jsx(DSelect, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false, className: "custom-year-selector" })), jsxRuntime.jsx("h4", { className: "mb-0 fw-normal", children: dateFns.format(monthDate, formatHeaderDate, { locale }) })] }), jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseMonth, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), showHeaderSelectors ? (jsxRuntime.jsx(DSelect, { options: months, value: defaultMonth, defaultValue: defaultMonth, onChange: (month) => changeMonth((month === null || month === void 0 ? void 0 : month.value) || 0), searchable: false, className: "custom-month-selector" })) : (jsxRuntime.jsx("p", { children: `${defaultMonth.label} ${defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label}` })), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] })] }));
1385
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "datepicker-top-header", children: [showHeaderSelectors && (jsxRuntime.jsx(DSelect, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false, className: "custom-year-selector" })), jsxRuntime.jsx("h4", { className: "mb-0 fw-normal", children: dateFns.format(monthDate, formatHeaderDate, { locale }) })] }), jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseMonth, disabled: prevMonthButtonDisabled, "aria-label": prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), showHeaderSelectors ? (jsxRuntime.jsx(DSelect, { options: months, value: defaultMonth, defaultValue: defaultMonth, onChange: (month) => changeMonth((month === null || month === void 0 ? void 0 : month.value) || 0), searchable: false, className: "custom-month-selector" })) : (jsxRuntime.jsx("p", { children: `${defaultMonth.label} ${defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label}` })), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseMonth, disabled: nextMonthButtonDisabled, "aria-label": nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] })] }));
1381
1386
  }
1382
1387
 
1383
1388
  function DDatePicker(_a) {
1384
- var { inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeInputLabel, minYearSelect, maxYearSelect, iconHeaderSize, iconMaterialStyle, iconInput, headerPrevMonthAriaLabel, headerNextMonthAriaLabel, invalid = false, valid = false, renderCustomHeader: renderCustomHeaderProp, className, dateFormatCalendar: dateFormatCalendarProp, style, dataAttributes, placeholder, showHeaderSelectors, formatHeaderDate } = _a, props = tslib.__rest(_a, ["inputLabel", "inputHint", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeInputLabel", "minYearSelect", "maxYearSelect", "iconHeaderSize", "iconMaterialStyle", "iconInput", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "invalid", "valid", "renderCustomHeader", "className", "dateFormatCalendar", "style", "dataAttributes", "placeholder", "showHeaderSelectors", "formatHeaderDate"]);
1389
+ var { inputLabel, inputHint, inputAriaLabel, ariaLabelInputTime, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeInputLabel, minYearSelect, maxYearSelect, iconHeaderSize, iconMaterialStyle, iconInput, headerPrevMonthAriaLabel, headerNextMonthAriaLabel, invalid = false, valid = false, renderCustomHeader: renderCustomHeaderProp, className, dateFormatCalendar: dateFormatCalendarProp, style, dataAttributes, placeholder, showHeaderSelectors, formatHeaderDate } = _a, props = tslib.__rest(_a, ["inputLabel", "inputHint", "inputAriaLabel", "ariaLabelInputTime", "inputActionAriaLabel", "inputId", "timeId", "timeInputLabel", "minYearSelect", "maxYearSelect", "iconHeaderSize", "iconMaterialStyle", "iconInput", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "invalid", "valid", "renderCustomHeader", "className", "dateFormatCalendar", "style", "dataAttributes", "placeholder", "showHeaderSelectors", "formatHeaderDate"]);
1385
1390
  const pickerType = React.useMemo(() => {
1386
1391
  if (props.showQuarterYearPicker)
1387
1392
  return PickerType.Quarter;
@@ -1409,7 +1414,7 @@ function DDatePicker(_a) {
1409
1414
  ]);
1410
1415
  const defaultRenderCustomHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps))), [DatePickerHeader]);
1411
1416
  const renderCustomHeader = React.useMemo(() => (renderCustomHeaderProp || defaultRenderCustomHeader), [defaultRenderCustomHeader, renderCustomHeaderProp]);
1412
- return (jsxRuntime.jsx(DatePicker, Object.assign({}, dataAttributes, props, { calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, placeholderText: placeholder, customInput: (jsxRuntime.jsx(ForwardedDDatePickerInput, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyle, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, hint: inputHint })), customTimeInput: (jsxRuntime.jsx(DDatePickerTime, { id: timeId })) })));
1417
+ return (jsxRuntime.jsx(DatePicker, Object.assign({}, dataAttributes, props, { calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, placeholderText: placeholder, customInput: (jsxRuntime.jsx(ForwardedDDatePickerInput, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyle, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, hint: inputHint })), customTimeInput: (jsxRuntime.jsx(DDatePickerTime, { id: timeId, "aria-label": ariaLabelInputTime })) })));
1413
1418
  }
1414
1419
 
1415
1420
  function DLayoutPane({ className, style, children, cols, colsXs, colsSm, colsMd, colsLg, colsXl, colsXxl, dataAttributes, }) {
@@ -1686,7 +1691,57 @@ function DPasswordStrengthMeter({ id, label = 'Password', placeholder, value = '
1686
1691
  return (jsxRuntime.jsxs("div", Object.assign({ className: className, style: style }, dataAttributes, { children: [jsxRuntime.jsx(ForwardedDInputPassword, { id: id, label: label, placeholder: placeholder, value: password, name: name, disabled: disabled, invalid: invalid, onChange: handleChange }), jsxRuntime.jsx(PasswordChecksList, { password: password, validationMessages: validationMessages, enabledChecks: enabledChecks })] })));
1687
1692
  }
1688
1693
 
1689
- function DInputPin({ id: idProp, label = '', placeholder, type = 'text', disabled = false, loading = false, secret = false, characters = 4, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, dataAttributes, onChange, }) {
1694
+ function DInputCheck(_a) {
1695
+ var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, inputClassName, value, hint, onChange, className, style, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "inputClassName", "value", "hint", "onChange", "className", "style", "dataAttributes"]);
1696
+ const innerRef = React.useRef(null);
1697
+ const innerId = React.useId();
1698
+ const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
1699
+ const handleChange = React.useCallback((event) => {
1700
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
1701
+ }, [onChange]);
1702
+ const ariaDescribedby = React.useMemo(() => ([
1703
+ !!hint && `${id}Hint`,
1704
+ ]
1705
+ .filter(Boolean)
1706
+ .join(' ')), [
1707
+ id,
1708
+ hint,
1709
+ ]);
1710
+ React.useEffect(() => {
1711
+ if (innerRef.current) {
1712
+ innerRef.current.indeterminate = Boolean(indeterminate);
1713
+ }
1714
+ }, [indeterminate]);
1715
+ React.useEffect(() => {
1716
+ if (innerRef.current) {
1717
+ innerRef.current.checked = checked;
1718
+ }
1719
+ }, [checked]);
1720
+ const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
1721
+ 'is-invalid': invalid,
1722
+ 'is-valid': valid,
1723
+ }, inputClassName), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, props))), [
1724
+ handleChange,
1725
+ invalid,
1726
+ valid,
1727
+ inputClassName,
1728
+ style,
1729
+ id,
1730
+ disabled,
1731
+ type,
1732
+ name,
1733
+ value,
1734
+ ariaLabel,
1735
+ ariaDescribedby,
1736
+ props,
1737
+ ]);
1738
+ if (!label) {
1739
+ return inputComponent;
1740
+ }
1741
+ return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('form-check', className) }, dataAttributes, { children: [inputComponent, jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
1742
+ }
1743
+
1744
+ function DInputPin({ id: idProp, label = '', placeholder, type = 'text', disabled = false, loading = false, secret = false, characters = 4, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, dataAttributes, onChange, 'aria-label': ariaLabel = 'Pin character number', }) {
1690
1745
  const innerId = React.useId();
1691
1746
  const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
1692
1747
  const [pattern, setPattern] = React.useState('');
@@ -1763,7 +1818,7 @@ function DInputPin({ id: idProp, label = '', placeholder, type = 'text', disable
1763
1818
  'form-control': true,
1764
1819
  'is-invalid': invalid,
1765
1820
  'is-valid': valid,
1766
- }), value: activeInput[index], type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onInput: (event) => nextInput(event, index), onKeyDown: (event) => prevInput(event, index), onFocus: () => focusInput(index), onWheel: wheelInput, onClick: (event) => event.preventDefault(), onPaste: (event) => handlePaste(event), autoComplete: "off", placeholder: placeholder, disabled: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), loading && (jsxRuntime.jsx("div", { className: "input-group-text", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
1821
+ }), value: activeInput[index], type: secret ? 'password' : type, "aria-label": `${ariaLabel} ${index + 1} of ${characters}`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onInput: (event) => nextInput(event, index), onKeyDown: (event) => prevInput(event, index), onFocus: () => focusInput(index), onWheel: wheelInput, onClick: (event) => event.preventDefault(), onPaste: (event) => handlePaste(event), autoComplete: "off", placeholder: placeholder, disabled: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), loading && (jsxRuntime.jsx("div", { className: "input-group-text", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
1767
1822
  }
1768
1823
 
1769
1824
  function DInputSelect({ id: idProp, name, label = '', className, style, options = [], disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, size, floatingLabel = false, invalid = false, valid = false, dataAttributes, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
@@ -2077,9 +2132,7 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
2077
2132
  }, [open]);
2078
2133
  const onOpenChange = React.useCallback((value) => {
2079
2134
  setIsOpen(value);
2080
- if (setOpen) {
2081
- setOpen(value);
2082
- }
2135
+ setOpen === null || setOpen === void 0 ? void 0 : setOpen(value);
2083
2136
  }, [setOpen]);
2084
2137
  const { refs, floatingStyles, context, } = react.useFloating({
2085
2138
  open: isOpen,
@@ -2103,7 +2156,12 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
2103
2156
  const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign({}, style), (adjustContentToRender && {
2104
2157
  [`--${PREFIX_BS}popover-component-min-width`]: 'auto',
2105
2158
  }))), [style, adjustContentToRender]);
2106
- return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('d-popover', className), style: generateStyleVariables }, dataAttributes, { children: [jsxRuntime.jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(isOpen) })), isOpen && (jsxRuntime.jsx(react.FloatingFocusManager, { context: context, modal: false, children: jsxRuntime.jsx("div", Object.assign({ className: classNames('d-popover-content', {
2159
+ const triggerElement = renderComponent(isOpen);
2160
+ if (!React.isValidElement(triggerElement)) {
2161
+ throw new Error('renderComponent must return a valid React element');
2162
+ }
2163
+ const reference = React.cloneElement(triggerElement, Object.assign({ ref: refs.setReference }, getReferenceProps(triggerElement.props)));
2164
+ return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('d-popover', className), style: generateStyleVariables }, dataAttributes, { children: [reference, isOpen && (jsxRuntime.jsx(react.FloatingFocusManager, { context: context, modal: false, children: jsxRuntime.jsx("div", Object.assign({ className: classNames('d-popover-content', {
2107
2165
  'w-100': adjustContentToRender,
2108
2166
  }), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] })));
2109
2167
  }
@@ -2212,7 +2270,7 @@ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT +
2212
2270
  function DTimeline({ className, style, dataAttributes, items, }) {
2213
2271
  return (jsxRuntime.jsx("div", Object.assign({ style: style, className: classNames('d-timeline', className) }, dataAttributes, { children: items.map((item, index) => (jsxRuntime.jsxs("div", { className: classNames('d-timeline-item', {
2214
2272
  [`d-timeline-item-${item.status}`]: item.status,
2215
- }), children: [jsxRuntime.jsx("div", { className: "d-timeline-item-connector" }), jsxRuntime.jsx("div", { className: "d-timeline-item-icon", children: jsxRuntime.jsx("i", { className: `bi bi-${item.icon || 'check'}` }) }), jsxRuntime.jsxs("div", { className: "d-timeline-item-content", children: [jsxRuntime.jsx("div", { className: "d-timeline-item-title", children: item.title }), item.description && jsxRuntime.jsx("div", { className: "d-timeline-item-description", children: item.description }), item.time && jsxRuntime.jsx("div", { className: "d-timeline-item-time", children: item.time }), item.children] })] }, index))) })));
2273
+ }), children: [jsxRuntime.jsx("div", { className: "d-timeline-item-connector" }), jsxRuntime.jsx("div", { className: "d-timeline-item-icon", children: jsxRuntime.jsx(DIcon, { icon: item.icon || 'check', size: "1rem" }) }), jsxRuntime.jsxs("div", { className: "d-timeline-item-content", children: [jsxRuntime.jsx("div", { className: "d-timeline-item-title", children: item.title }), item.description && jsxRuntime.jsx("div", { className: "d-timeline-item-description", children: item.description }), item.time && jsxRuntime.jsx("div", { className: "d-timeline-item-time", children: item.time }), item.children] })] }, index))) })));
2216
2274
  }
2217
2275
 
2218
2276
  const TabContext = React.createContext(undefined);
@@ -2232,7 +2290,7 @@ function DTabContent({ tab, children, className, style, }) {
2232
2290
  return (jsxRuntime.jsx("div", { className: classNames('tab-pane fade show active', className), id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab`, style: style, children: children }));
2233
2291
  }
2234
2292
 
2235
- function DTabs$1({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', dataAttributes, }) {
2293
+ function DTabs$1({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', dataAttributes, ariaLabel, ariaLabelledBy, }) {
2236
2294
  const [selected, setSelected] = React.useState(defaultSelected);
2237
2295
  const onSelect = React.useCallback((option) => {
2238
2296
  if (option.tab) {
@@ -2243,17 +2301,83 @@ function DTabs$1({ children, defaultSelected, onChange, options, className, clas
2243
2301
  React.useEffect(() => {
2244
2302
  setSelected(defaultSelected);
2245
2303
  }, [defaultSelected]);
2304
+ const generateClasses = React.useMemo(() => (Object.assign({ nav: true, 'flex-column align-items-center': vertical && variant !== 'tabs', [`nav-${variant}`]: true }, className && { [className]: true })), [vertical, variant, className]);
2305
+ const tabRefs = React.useRef([]);
2306
+ React.useEffect(() => {
2307
+ tabRefs.current = options.map((_, i) => tabRefs.current[i] || React.createRef());
2308
+ }, [options]);
2309
+ // Ensure selected is never disabled
2310
+ React.useEffect(() => {
2311
+ if (options.length === 0)
2312
+ return;
2313
+ const selectedOption = options.find((opt) => opt.tab === selected);
2314
+ if (selectedOption && selectedOption.disabled) {
2315
+ const firstEnabled = options.find((opt) => !opt.disabled);
2316
+ if (firstEnabled)
2317
+ setSelected(firstEnabled.tab);
2318
+ }
2319
+ }, [options, selected]);
2320
+ // Declarative focus management
2321
+ const focusTab = (idx) => {
2322
+ var _a;
2323
+ if ((_a = tabRefs.current[idx]) === null || _a === void 0 ? void 0 : _a.current) {
2324
+ tabRefs.current[idx].current.focus();
2325
+ }
2326
+ };
2327
+ // Focus selected tab when selected changes
2328
+ React.useEffect(() => {
2329
+ const idx = options.findIndex((opt) => opt.tab === selected && !opt.disabled);
2330
+ if (idx !== -1) {
2331
+ focusTab(idx);
2332
+ }
2333
+ }, [selected, options]);
2334
+ const handleKeyDown = React.useCallback((idx, e) => {
2335
+ const count = options.length;
2336
+ if (count === 0)
2337
+ return;
2338
+ let next = idx;
2339
+ let prev = idx;
2340
+ if (e.key === 'ArrowRight' || (vertical && e.key === 'ArrowDown')) {
2341
+ e.preventDefault();
2342
+ for (let i = 0; i < count; i += 1) {
2343
+ next = (next + 1) % count;
2344
+ if (!options[next].disabled) {
2345
+ focusTab(next);
2346
+ setSelected(options[next].tab);
2347
+ break;
2348
+ }
2349
+ }
2350
+ }
2351
+ if (e.key === 'ArrowLeft' || (vertical && e.key === 'ArrowUp')) {
2352
+ e.preventDefault();
2353
+ for (let i = 0; i < count; i += 1) {
2354
+ prev = (prev - 1 + count) % count;
2355
+ if (!options[prev].disabled) {
2356
+ focusTab(prev);
2357
+ setSelected(options[prev].tab);
2358
+ break;
2359
+ }
2360
+ }
2361
+ }
2362
+ }, [options, vertical]);
2363
+ let tablistProps = {};
2364
+ if (ariaLabelledBy) {
2365
+ tablistProps = { 'aria-labelledby': ariaLabelledBy };
2366
+ }
2367
+ else if (ariaLabel) {
2368
+ tablistProps = { 'aria-label': ariaLabel };
2369
+ }
2246
2370
  const isSelected = React.useCallback((tab) => (selected === tab), [selected]);
2247
2371
  const value = React.useMemo(() => ({
2248
2372
  isSelected,
2249
2373
  }), [isSelected]);
2250
- const generateClasses = React.useMemo(() => (Object.assign({ nav: true, 'flex-column align-items-center': vertical && variant !== 'tabs', [`nav-${variant}`]: true }, className && { [className]: true })), [vertical, variant, className]);
2251
2374
  return (jsxRuntime.jsx(TabContext.Provider, { value: value, children: jsxRuntime.jsxs("div", Object.assign({ className: classNames({
2252
2375
  'd-flex w-100': true,
2253
2376
  'flex-column': !vertical || variant === 'tabs',
2254
- }), style: style }, dataAttributes, { children: [jsxRuntime.jsx("nav", { className: classNames(generateClasses), children: options.map((option) => (jsxRuntime.jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
2255
- active: option.tab === selected,
2256
- }, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.tab))) }), jsxRuntime.jsx("div", { className: "tab-content w-100", children: children })] })) }));
2377
+ }), style: style }, dataAttributes, { children: [jsxRuntime.jsx("ul", Object.assign({ className: classNames(generateClasses), role: "tablist", "aria-orientation": vertical ? 'vertical' : undefined }, tablistProps, { children: options.map((option, idx) => {
2378
+ const isTabSelected = !!option.tab && option.tab === selected;
2379
+ return (jsxRuntime.jsx("li", { role: "presentation", className: "nav-item", children: jsxRuntime.jsx("button", { ref: tabRefs.current[idx], id: `${option.tab}Tab`, className: classNames('nav-link', { active: isTabSelected }, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": isTabSelected, tabIndex: isTabSelected ? 0 : -1, disabled: option.disabled, onClick: () => onSelect(option), onKeyDown: (e) => handleKeyDown(idx, e), children: option.label }) }, option.tab));
2380
+ }) })), jsxRuntime.jsx("div", { className: "tab-content w-100", children: children })] })) }));
2257
2381
  }
2258
2382
  var DTabs = Object.assign(DTabs$1, {
2259
2383
  Tab: DTabContent,
@@ -2438,8 +2562,12 @@ ForwardedDInputPhone.displayName = 'DInputPhone';
2438
2562
 
2439
2563
  const DEFAULT_IMAGE = 'https://cdn.modyo.cloud/uploads/06b434f7-b943-4f54-9543-84a904e189aa/original/Visa_Logo_1_.png';
2440
2564
  const CHIP_IMAGE = 'https://cdn.modyo.cloud/uploads/4660ad00-e5d8-477e-8919-52b53d0a26fb/original/chip-debit-svgrepo-com_1_.png';
2565
+ const BRAND_LOGOS = {
2566
+ visa: DEFAULT_IMAGE,
2567
+ mastercard: 'https://cdn.modyo.cloud/uploads/f686b9aa-65ab-4369-9db3-89ceece84f29/original/mastercard.png',
2568
+ };
2441
2569
  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-none d-lg-flex', isVertical && 'is-vertical', className), children: [jsxRuntime.jsxs("div", { className: "d-credit-card-header", children: [jsxRuntime.jsx("img", { src: logoImage || 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 })] })] }));
2570
+ 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 })] })] }));
2443
2571
  }
2444
2572
 
2445
2573
  const getItemClass = (action) => {
@@ -2461,7 +2589,6 @@ function DDropdown({ actions, dropdownToggle, className, }) {
2461
2589
  document.addEventListener('mousedown', handleClickOutside);
2462
2590
  return () => document.removeEventListener('mousedown', handleClickOutside);
2463
2591
  }, []);
2464
- // 🆕 Calcular posición del menú al abrir
2465
2592
  React.useEffect(() => {
2466
2593
  if (open && dropdownRef.current) {
2467
2594
  const rect = dropdownRef.current.getBoundingClientRect();
@@ -2488,7 +2615,7 @@ function DDropdown({ actions, dropdownToggle, className, }) {
2488
2615
  }
2489
2616
  }
2490
2617
  else {
2491
- ToggleElement = (jsxRuntime.jsx(DButtonIcon, { variant: "link", stopPropagationEnabled: false, onClick: () => setOpen(!open), icon: "MoreVertical" }));
2618
+ ToggleElement = (jsxRuntime.jsx(DButtonIcon, { variant: "link", stopPropagationEnabled: false, "aria-label": "Toggle Dropdown", "aria-haspopup": "menu", "aria-expanded": open, onClick: () => setOpen(!open), icon: "MoreVertical" }));
2492
2619
  }
2493
2620
  return (jsxRuntime.jsxs("div", { className: `dropdown position-relative drop-${position} ${className}`, ref: dropdownRef, children: [ToggleElement, jsxRuntime.jsx("ul", { style: {
2494
2621
  position: 'absolute',
@@ -2581,7 +2708,7 @@ function useScreenshotWebShare() {
2581
2708
  };
2582
2709
  }
2583
2710
 
2584
- function DVoucher({ amount, amountDetails, icon = 'CircleCheckBig', color = 'success', title, onError, message, downloadText = 'Download', shareText = 'Share', children, }) {
2711
+ function DVoucher({ amount, amountDetails, icon, title, onError, message, downloadText = 'Download', shareText = 'Share', className, children, }) {
2585
2712
  const { shareRef, share } = useScreenshotWebShare();
2586
2713
  const { downloadRef, download } = useScreenshotDownload();
2587
2714
  const handleShare = () => {
@@ -2606,10 +2733,25 @@ function DVoucher({ amount, amountDetails, icon = 'CircleCheckBig', color = 'suc
2606
2733
  // Error already handled by onError
2607
2734
  });
2608
2735
  };
2609
- return (jsxRuntime.jsx("div", { className: "d-voucher", ref: (el) => {
2736
+ const defaultIconProps = {
2737
+ icon: 'CircleCheckBig',
2738
+ color: 'success',
2739
+ size: '2rem',
2740
+ hasCircle: true,
2741
+ };
2742
+ const resolvedIconProps = (() => {
2743
+ if (icon === false || icon == null)
2744
+ return null;
2745
+ if (typeof icon === 'string')
2746
+ return Object.assign(Object.assign({}, defaultIconProps), { icon });
2747
+ if (typeof icon === 'object')
2748
+ return Object.assign(Object.assign({}, defaultIconProps), icon);
2749
+ return defaultIconProps;
2750
+ })();
2751
+ return (jsxRuntime.jsx("div", { className: classNames('d-voucher', className), ref: (el) => {
2610
2752
  shareRef.current = el;
2611
2753
  downloadRef.current = el;
2612
- }, children: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "d-voucher-header", children: [jsxRuntime.jsx(DIcon, { icon: icon, color: color }), 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" })] })] }) }));
2754
+ }, 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
2755
  }
2614
2756
 
2615
2757
  function useCountdown(seconds) {
@@ -2648,7 +2790,7 @@ const defaultMessage = (secs) => (secs > 0
2648
2790
  : "Didn't get any code?");
2649
2791
  function OtpCountdown({ seconds, resendText, message, }) {
2650
2792
  const { secondsLeft, restartCountdown } = useCountdown(seconds);
2651
- 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 })] }));
2793
+ 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 })] }));
2652
2794
  }
2653
2795
 
2654
2796
  const TEXT_PROPS = {
@@ -2681,6 +2823,72 @@ function DOtp({ className, action, isLoading, otpSize = 6, texts = TEXT_PROPS, s
2681
2823
  }, loading: isLoading }), jsxRuntime.jsx("p", { className: "small ms-lg-auto mb-0", children: texts.contact })] })] })] }));
2682
2824
  }
2683
2825
 
2826
+ function DefaultErrorBoundary({ resetErrorBoundary }) {
2827
+ 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" })] }) }));
2828
+ }
2829
+
2830
+ function DErrorBoundary({ name, fallback, resetKeys, onReset, onError, children, }) {
2831
+ const handleError = React.useCallback((error, info) => {
2832
+ // eslint-disable-next-line no-console
2833
+ console.error(`[DErrorBoundary${name ? `:${name}` : ''}]`, reactErrorBoundary.getErrorMessage(error), info);
2834
+ onError === null || onError === void 0 ? void 0 : onError(error, info);
2835
+ }, [name, onError]);
2836
+ const FallbackRender = React.useCallback((props) => {
2837
+ if (fallback)
2838
+ return fallback(props);
2839
+ return (jsxRuntime.jsx(DefaultErrorBoundary, { resetErrorBoundary: props.resetErrorBoundary }));
2840
+ }, [fallback]);
2841
+ return (jsxRuntime.jsx(reactErrorBoundary.ErrorBoundary, { resetKeys: resetKeys, onReset: onReset, onError: handleError, fallbackRender: FallbackRender, children: children }));
2842
+ }
2843
+
2844
+ function ErrorState({ message, onRetry, retryMessage = 'Retry', color = 'danger', }) {
2845
+ 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" }))] }));
2846
+ }
2847
+
2848
+ function EmptyState({ message, icon = 'FileText', actionText, onAction, }) {
2849
+ 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" }))] }));
2850
+ }
2851
+
2852
+ function LoadingState({ ariaLabel = 'Loading...', className }) {
2853
+ 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 }) }));
2854
+ }
2855
+
2856
+ function render(renderable) {
2857
+ if (renderable === undefined)
2858
+ return null;
2859
+ return typeof renderable === 'function' ? renderable() : renderable;
2860
+ }
2861
+ function DDataStateWrapper({ isLoading, isError, data, onRetry, renderLoading, renderEmpty, renderError, children, }) {
2862
+ // 1. Loading
2863
+ if (isLoading) {
2864
+ if (renderLoading)
2865
+ return render(renderLoading);
2866
+ return jsxRuntime.jsx(LoadingState, {});
2867
+ }
2868
+ // 2. Error
2869
+ if (isError) {
2870
+ if (renderError)
2871
+ return render(renderError);
2872
+ return (jsxRuntime.jsx(ErrorState, { onRetry: onRetry }));
2873
+ }
2874
+ // 3. Empty
2875
+ if (!(data === null || data === void 0 ? void 0 : data.length)) {
2876
+ if (renderEmpty)
2877
+ return render(renderEmpty);
2878
+ return (jsxRuntime.jsx(EmptyState, {}));
2879
+ }
2880
+ // 4. Success
2881
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children(data) });
2882
+ }
2883
+
2884
+ Object.defineProperty(exports, "getErrorMessage", {
2885
+ enumerable: true,
2886
+ get: function () { return reactErrorBoundary.getErrorMessage; }
2887
+ });
2888
+ Object.defineProperty(exports, "useErrorBoundary", {
2889
+ enumerable: true,
2890
+ get: function () { return reactErrorBoundary.useErrorBoundary; }
2891
+ });
2684
2892
  exports.DAlert = DAlert;
2685
2893
  exports.DAvatar = DAvatar;
2686
2894
  exports.DBadge = DBadge;
@@ -2700,8 +2908,10 @@ exports.DContext = DContext;
2700
2908
  exports.DContextProvider = DContextProvider;
2701
2909
  exports.DCreditCard = DCreditCard;
2702
2910
  exports.DCurrencyText = DCurrencyText;
2911
+ exports.DDataStateWrapper = DDataStateWrapper;
2703
2912
  exports.DDatePicker = DDatePicker;
2704
2913
  exports.DDropdown = DDropdown;
2914
+ exports.DErrorBoundary = DErrorBoundary;
2705
2915
  exports.DIcon = DIcon;
2706
2916
  exports.DIconBase = DIconBase;
2707
2917
  exports.DInput = ForwardedDInput;