@dynamic-framework/ui-react 1.6.0 → 1.7.1

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 (222) hide show
  1. package/LICENSE +223 -21
  2. package/README.md +3 -15
  3. package/dist/css/dynamic-ui.css +3888 -1310
  4. package/dist/css/dynamic-ui.min.css +1 -1
  5. package/dist/index.esm.js +889 -555
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.js +943 -604
  8. package/dist/index.js.map +1 -1
  9. package/dist/types/components/DAlert.d.ts +16 -0
  10. package/dist/types/components/DBadge.d.ts +11 -0
  11. package/dist/types/components/DBoxFile.d.ts +3 -4
  12. package/dist/types/components/DButton.d.ts +21 -0
  13. package/dist/types/components/DCard.d.ts +2 -2
  14. package/dist/types/components/DCardAccount.d.ts +3 -3
  15. package/dist/types/components/DCardBody.d.ts +2 -2
  16. package/dist/types/components/DCardFooter.d.ts +2 -2
  17. package/dist/types/components/DCardHeader.d.ts +2 -2
  18. package/dist/types/components/DCarousel.d.ts +3 -3
  19. package/dist/types/components/DCarouselSlide.d.ts +1 -1
  20. package/dist/types/components/DChip.d.ts +10 -0
  21. package/dist/types/components/DCollapse.d.ts +4 -4
  22. package/dist/types/components/DCollapseIconText.d.ts +3 -4
  23. package/dist/types/components/DCurrencyText.d.ts +1 -1
  24. package/dist/types/components/DDatePicker.d.ts +5 -5
  25. package/dist/types/components/DDatePickerHeader.d.ts +4 -4
  26. package/dist/types/components/DDatePickerInput.d.ts +7 -7
  27. package/dist/types/components/DDatePickerTime.d.ts +6 -6
  28. package/dist/types/components/DFormikInput.d.ts +2 -2
  29. package/dist/types/components/DFormikInputCurrency.d.ts +1 -1
  30. package/dist/types/components/DFormikInputSelect.d.ts +3 -6
  31. package/dist/types/components/DIcon.d.ts +16 -0
  32. package/dist/types/components/DInput.d.ts +32 -0
  33. package/dist/types/components/DInputCheck.d.ts +15 -0
  34. package/dist/types/components/DInputCounter.d.ts +22 -0
  35. package/dist/types/components/DInputCurrency.d.ts +4 -8
  36. package/dist/types/components/DInputCurrencyBase.d.ts +24 -0
  37. package/dist/types/components/DInputPassword.d.ts +17 -0
  38. package/dist/types/components/DInputPin.d.ts +19 -0
  39. package/dist/types/components/DInputSearch.d.ts +19 -0
  40. package/dist/types/components/DInputSelect.d.ts +24 -0
  41. package/dist/types/components/DInputSwitch.d.ts +11 -0
  42. package/dist/types/components/DList.d.ts +4 -3
  43. package/dist/types/components/DListItem.d.ts +4 -4
  44. package/dist/types/components/DListItemMovement.d.ts +2 -2
  45. package/dist/types/components/DModal.d.ts +14 -0
  46. package/dist/types/components/DModalBody.d.ts +6 -0
  47. package/dist/types/components/DModalFooter.d.ts +6 -0
  48. package/dist/types/components/DModalHeader.d.ts +7 -0
  49. package/dist/types/components/DMonthPicker.d.ts +4 -4
  50. package/dist/types/components/DOffcanvas.d.ts +11 -0
  51. package/dist/types/components/DOffcanvasBody.d.ts +6 -0
  52. package/dist/types/components/DOffcanvasFooter.d.ts +6 -0
  53. package/dist/types/components/DOffcanvasHeader.d.ts +7 -0
  54. package/dist/types/components/DPaginator.d.ts +4 -4
  55. package/dist/types/components/DPopover.d.ts +3 -2
  56. package/dist/types/components/DProgress.d.ts +9 -0
  57. package/dist/types/components/DQuickActionButton.d.ts +22 -0
  58. package/dist/types/components/DQuickActionCheck.d.ts +13 -0
  59. package/dist/types/components/DQuickActionSelect.d.ts +12 -0
  60. package/dist/types/components/DQuickActionSwitch.d.ts +11 -0
  61. package/dist/types/components/DSkeleton.d.ts +2 -2
  62. package/dist/types/components/DStepper.d.ts +3 -3
  63. package/dist/types/components/DStepperDesktop.d.ts +2 -2
  64. package/dist/types/components/DStepperMobile.d.ts +2 -2
  65. package/dist/types/components/DTabContent.d.ts +1 -1
  66. package/dist/types/components/DTabs.d.ts +5 -5
  67. package/dist/types/components/DToastContainer.d.ts +2 -3
  68. package/dist/types/components/DTooltip.d.ts +2 -2
  69. package/dist/types/components/banking/{MPermissionGroup.d.ts → DPermissionGroup.d.ts} +2 -2
  70. package/dist/types/components/banking/DPermissionItem.d.ts +1 -1
  71. package/dist/types/components/banking/{MSummaryCard.d.ts → DSummaryCard.d.ts} +2 -2
  72. package/dist/types/components/banking/index.d.ts +2 -2
  73. package/dist/types/components/banking/interface.d.ts +1 -1
  74. package/dist/types/components/config.d.ts +5 -0
  75. package/dist/types/components/index.d.ts +46 -20
  76. package/dist/types/components/interface.d.ts +44 -0
  77. package/dist/types/contexts/ModalContext.d.ts +12 -12
  78. package/dist/types/contexts/OffcanvasContext.d.ts +12 -12
  79. package/dist/types/hooks/useScreenshot.d.ts +1 -1
  80. package/dist/types/hooks/useToast.d.ts +3 -3
  81. package/dist/types/stories/components/DBadge.stories.d.ts +1 -1
  82. package/dist/types/stories/components/DBoxFile.stories.d.ts +1 -1
  83. package/dist/types/stories/components/DButton.stories.d.ts +1 -1
  84. package/dist/types/stories/components/DChip.stories.d.ts +1 -1
  85. package/dist/types/stories/components/DCurrencyText.stories.d.ts +1 -1
  86. package/dist/types/stories/components/DDatePicker.stories.d.ts +1 -1
  87. package/dist/types/stories/components/DFormikInput.stories.d.ts +1 -1
  88. package/dist/types/stories/components/DFormikInputCurrency.stories.d.ts +1 -1
  89. package/dist/types/stories/components/DFormikInputSelect.stories.d.ts +1 -1
  90. package/dist/types/stories/components/DIcon.stories.d.ts +1 -1
  91. package/dist/types/stories/components/DInput.stories.d.ts +1 -1
  92. package/dist/types/stories/components/DInputCheck.stories.d.ts +1 -1
  93. package/dist/types/stories/components/DInputCounter.stories.d.ts +1 -1
  94. package/dist/types/stories/components/DInputCurrency.stories.d.ts +1 -1
  95. package/dist/types/stories/components/DInputCurrencyBase.stories.d.ts +1 -1
  96. package/dist/types/stories/components/DInputPassword.stories.d.ts +1 -1
  97. package/dist/types/stories/components/DInputPin.stories.d.ts +1 -1
  98. package/dist/types/stories/components/DInputSearch.stories.d.ts +1 -1
  99. package/dist/types/stories/components/DInputSelect.stories.d.ts +7 -3
  100. package/dist/types/stories/components/DInputSwitch.stories.d.ts +1 -1
  101. package/dist/types/stories/components/DList.stories.d.ts +1 -1
  102. package/dist/types/stories/components/DListItem.stories.d.ts +1 -1
  103. package/dist/types/stories/components/DListItemMovement.stories.d.ts +1 -1
  104. package/dist/types/stories/components/DPaginator.stories.d.ts +1 -1
  105. package/dist/types/stories/components/DProgress.stories.d.ts +1 -1
  106. package/dist/types/stories/components/DQuickActionButton.stories.d.ts +1 -1
  107. package/dist/types/stories/components/DQuickActionCheck.stories.d.ts +1 -1
  108. package/dist/types/stories/components/DQuickActionSelect.stories.d.ts +1 -1
  109. package/dist/types/stories/components/DQuickActionSwitch.stories.d.ts +1 -1
  110. package/dist/types/stories/components/DSkeleton.stories.d.ts +1 -1
  111. package/dist/types/stories/components/DStepper.stories.d.ts +1 -1
  112. package/dist/types/stories/components/DStepperDesktop.stories.d.ts +1 -1
  113. package/dist/types/stories/components/DStepperMobile.stories.d.ts +1 -1
  114. package/dist/types/stories/components/DTooltip.stories.d.ts +1 -1
  115. package/dist/types/stories/hooks/useFormatCurrency.stories.d.ts +1 -1
  116. package/dist/types/stories/hooks/useModalContext.stories.d.ts +1 -1
  117. package/dist/types/stories/hooks/useOffcanvasContext.stories.d.ts +1 -1
  118. package/dist/types/stories/hooks/useToast.stories.d.ts +2 -2
  119. package/dist/types/stories/patterns/DAlert.stories.d.ts +1 -1
  120. package/dist/types/stories/{components → patterns}/DCard.stories.d.ts +1 -1
  121. package/dist/types/stories/{components → patterns}/DCardAccount.stories.d.ts +1 -1
  122. package/dist/types/stories/patterns/DCarousel.stories.d.ts +1 -1
  123. package/dist/types/stories/patterns/DCollapse.stories.d.ts +1 -1
  124. package/dist/types/stories/patterns/DCollapseIconText.stories.d.ts +1 -1
  125. package/dist/types/stories/patterns/DModal.stories.d.ts +1 -1
  126. package/dist/types/stories/patterns/DOffcanvas.stories.d.ts +1 -1
  127. package/dist/types/stories/patterns/DPopover.stories.d.ts +2 -1
  128. package/dist/types/stories/patterns/DTabs.stories.d.ts +1 -1
  129. package/dist/types/utils/format-currency.d.ts +2 -0
  130. package/dist/types/utils/index.d.ts +2 -1
  131. package/dist/types/utils/liquid-parser.d.ts +20 -0
  132. package/package.json +62 -49
  133. package/src/style/_shame.scss +4 -0
  134. package/src/style/abstracts/_+import.scss +14 -2
  135. package/src/style/abstracts/_funcions.scss +55 -0
  136. package/src/style/abstracts/_maps.scss +1 -0
  137. package/src/style/abstracts/_mixins.scss +133 -0
  138. package/src/style/abstracts/_utilities.scss +78 -0
  139. package/src/style/abstracts/variables/_+import.scss +159 -0
  140. package/src/style/abstracts/variables/_accordion.scss +35 -0
  141. package/src/style/abstracts/variables/_alerts.scss +27 -0
  142. package/src/style/abstracts/variables/_badges.scss +15 -0
  143. package/src/style/abstracts/variables/_body.scss +52 -0
  144. package/src/style/abstracts/variables/_border.scss +29 -0
  145. package/src/style/abstracts/variables/_box-shadow.scss +6 -0
  146. package/src/style/abstracts/variables/_breadcrumb.scss +15 -0
  147. package/src/style/abstracts/variables/_buttons.scss +55 -0
  148. package/src/style/abstracts/variables/_cards.scss +23 -0
  149. package/src/style/abstracts/variables/_carousel.scss +37 -0
  150. package/src/style/abstracts/variables/_chips.scss +13 -0
  151. package/src/style/abstracts/variables/_close.scss +16 -0
  152. package/src/style/abstracts/variables/_code.scss +16 -0
  153. package/src/style/abstracts/variables/_colors.scss +515 -0
  154. package/src/style/abstracts/variables/_cursors.scss +32 -0
  155. package/src/style/abstracts/variables/_dropdowns.scss +54 -0
  156. package/src/style/abstracts/variables/_figures.scss +6 -0
  157. package/src/style/abstracts/variables/_forms.scss +313 -0
  158. package/src/style/abstracts/variables/_grid.scss +41 -0
  159. package/src/style/abstracts/variables/_list-group.scss +43 -0
  160. package/src/style/abstracts/variables/_modals.scss +58 -0
  161. package/src/style/abstracts/variables/_navbar.scss +43 -0
  162. package/src/style/abstracts/variables/_navs.scss +44 -0
  163. package/src/style/abstracts/variables/_offcanvas.scss +20 -0
  164. package/src/style/abstracts/variables/_options.scss +24 -0
  165. package/src/style/abstracts/variables/_pagination.scss +41 -0
  166. package/src/style/abstracts/variables/_popovers.scss +31 -0
  167. package/src/style/abstracts/variables/_progress.scss +17 -0
  168. package/src/style/abstracts/variables/_quick-action-button.scss +31 -0
  169. package/src/style/abstracts/variables/_quick-action-check.scss +22 -0
  170. package/src/style/abstracts/variables/_quick-action-select.scss +16 -0
  171. package/src/style/abstracts/variables/_quick-action-switch.scss +21 -0
  172. package/src/style/abstracts/variables/_spacers.scss +28 -0
  173. package/src/style/abstracts/variables/_spinners.scss +13 -0
  174. package/src/style/abstracts/variables/_tables.scss +57 -0
  175. package/src/style/abstracts/variables/_thumbnails.scss +10 -0
  176. package/src/style/abstracts/variables/_toasts.scss +19 -0
  177. package/src/style/abstracts/variables/_tooltips.scss +29 -0
  178. package/src/style/abstracts/variables/_typography.scss +122 -0
  179. package/src/style/abstracts/variables/_z-index.scss +28 -0
  180. package/src/style/base/_+import.scss +15 -0
  181. package/src/style/base/_root.scss +248 -0
  182. package/src/style/base/_tables.scss +171 -0
  183. package/src/style/components/_+import.scss +44 -0
  184. package/src/style/components/_d-alert.scss +45 -0
  185. package/src/style/components/_d-badge.scss +26 -0
  186. package/src/style/components/_d-button.scss +191 -0
  187. package/src/style/components/_d-card-account.scss +1 -1
  188. package/src/style/components/_d-chip.scss +52 -0
  189. package/src/style/components/_d-icon.scss +32 -0
  190. package/src/style/components/_d-input-check.scss +20 -0
  191. package/src/style/components/_d-input-pin.scss +121 -0
  192. package/src/style/components/_d-input-select.scss +20 -0
  193. package/src/style/components/_d-input-switch.scss +58 -0
  194. package/src/style/components/_d-input.scss +168 -0
  195. package/src/style/components/_d-modal.scss +55 -0
  196. package/src/style/components/_d-offcanvas.scss +45 -0
  197. package/src/style/components/_d-popover.scss +4 -1
  198. package/src/style/components/_d-progress.scss +9 -0
  199. package/src/style/components/_d-quick-action-button.scss +111 -0
  200. package/src/style/components/_d-quick-action-check.scss +74 -0
  201. package/src/style/components/_d-quick-action-select.scss +56 -0
  202. package/src/style/components/_d-quick-action-switch.scss +71 -0
  203. package/src/style/dynamic-root.scss +5 -1
  204. package/src/style/dynamic-ui.scss +13 -1
  205. package/src/style/helpers/_+import.scss +13 -0
  206. package/src/style/helpers/_color-bg.scss +7 -0
  207. package/dist/css/dynamic-ui-all.css +0 -16620
  208. package/dist/css/dynamic-ui-all.min.css +0 -1
  209. package/dist/css/dynamic-ui-react.css +0 -1919
  210. package/dist/css/dynamic-ui-react.min.css +0 -1
  211. package/dist/types/components/proxies.d.ts +0 -23
  212. package/dist/types/components/react-component-lib/createComponent.d.ts +0 -10
  213. package/dist/types/components/react-component-lib/createOverlayComponent.d.ts +0 -21
  214. package/dist/types/components/react-component-lib/index.d.ts +0 -2
  215. package/dist/types/components/react-component-lib/interfaces.d.ts +0 -29
  216. package/dist/types/components/react-component-lib/utils/attachProps.d.ts +0 -16
  217. package/dist/types/components/react-component-lib/utils/case.d.ts +0 -2
  218. package/dist/types/components/react-component-lib/utils/dev.d.ts +0 -2
  219. package/dist/types/components/react-component-lib/utils/index.d.ts +0 -10
  220. package/src/style/dynamic-ui-all.scss +0 -3
  221. package/src/style/dynamic-ui-react.scss +0 -7
  222. /package/dist/types/stories/{constants.d.ts → config/constants.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -3,298 +3,318 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
- const reactToastify = require('react-toastify');
7
- require('react-toastify/dist/ReactToastify.css');
6
+ const react = require('react');
7
+ const classNames = require('classnames');
8
8
  const tslib = require('tslib');
9
+ const reactDropzone = require('react-dropzone');
10
+ const reactSplide = require('@splidejs/react-splide');
11
+ const currency = require('currency.js');
9
12
  const DatePicker = require('react-datepicker');
10
13
  const luxon = require('luxon');
11
- const React = require('react');
12
- const dAlert_js = require('@dynamic-framework/ui/components/d-alert.js');
13
- const dBadge_js = require('@dynamic-framework/ui/components/d-badge.js');
14
- const dButton_js = require('@dynamic-framework/ui/components/d-button.js');
15
- const dChip_js = require('@dynamic-framework/ui/components/d-chip.js');
16
- const dIcon_js = require('@dynamic-framework/ui/components/d-icon.js');
17
- const dInput_js = require('@dynamic-framework/ui/components/d-input.js');
18
- const dInputCheck_js = require('@dynamic-framework/ui/components/d-input-check.js');
19
- const dInputCounter_js = require('@dynamic-framework/ui/components/d-input-counter.js');
20
- const dInputCurrencyBase_js = require('@dynamic-framework/ui/components/d-input-currency-base.js');
21
- const dInputPassword_js = require('@dynamic-framework/ui/components/d-input-password.js');
22
- const dInputPin_js = require('@dynamic-framework/ui/components/d-input-pin.js');
23
- const dInputSearch_js = require('@dynamic-framework/ui/components/d-input-search.js');
24
- const dInputSelect_js = require('@dynamic-framework/ui/components/d-input-select.js');
25
- const dInputSwitch_js = require('@dynamic-framework/ui/components/d-input-switch.js');
26
- const dModal_js = require('@dynamic-framework/ui/components/d-modal.js');
27
- const dOffcanvas_js = require('@dynamic-framework/ui/components/d-offcanvas.js');
28
- const dProgress_js = require('@dynamic-framework/ui/components/d-progress.js');
29
- const dQuickActionButton_js = require('@dynamic-framework/ui/components/d-quick-action-button.js');
30
- const dQuickActionCheck_js = require('@dynamic-framework/ui/components/d-quick-action-check.js');
31
- const dQuickActionSelect_js = require('@dynamic-framework/ui/components/d-quick-action-select.js');
32
- const dQuickActionSwitch_js = require('@dynamic-framework/ui/components/d-quick-action-switch.js');
33
- const ui = require('@dynamic-framework/ui');
34
- const ContentLoader = require('react-content-loader');
35
- const classNames = require('classnames');
36
- const react = require('@floating-ui/react');
37
14
  const formik = require('formik');
38
- const reactDropzone = require('react-dropzone');
39
- const reactSplide = require('@splidejs/react-splide');
40
15
  const ResponsivePagination = require('react-responsive-pagination');
16
+ const react$1 = require('@floating-ui/react');
17
+ const ContentLoader = require('react-content-loader');
18
+ const reactToastify = require('react-toastify');
41
19
  const i18n = require('i18next');
42
20
  const reactI18next = require('react-i18next');
43
21
  const html2canvas = require('html2canvas');
44
- const ReactDOM = require('react-dom');
22
+ const reactDom = require('react-dom');
45
23
 
46
24
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
47
25
 
48
- const DatePicker__default = /*#__PURE__*/_interopDefaultLegacy(DatePicker);
49
- const React__default = /*#__PURE__*/_interopDefaultLegacy(React);
50
- const ContentLoader__default = /*#__PURE__*/_interopDefaultLegacy(ContentLoader);
51
26
  const classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
27
+ const currency__default = /*#__PURE__*/_interopDefaultLegacy(currency);
28
+ const DatePicker__default = /*#__PURE__*/_interopDefaultLegacy(DatePicker);
52
29
  const ResponsivePagination__default = /*#__PURE__*/_interopDefaultLegacy(ResponsivePagination);
30
+ const ContentLoader__default = /*#__PURE__*/_interopDefaultLegacy(ContentLoader);
53
31
  const i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
54
32
  const html2canvas__default = /*#__PURE__*/_interopDefaultLegacy(html2canvas);
55
33
 
56
- const dashToPascalCase = (str) => str
57
- .toLowerCase()
58
- .split('-')
59
- .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
60
- .join('');
61
- const camelToDashCase = (str) => str.replace(/([A-Z])/g, (m) => `-${m[0].toLowerCase()}`);
62
-
63
- const attachProps = (node, newProps, oldProps = {}) => {
64
- // some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
65
- if (node instanceof Element) {
66
- // add any classes in className to the class list
67
- const className = getClassName(node.classList, newProps, oldProps);
68
- if (className !== '') {
69
- node.className = className;
70
- }
71
- Object.keys(newProps).forEach((name) => {
72
- if (name === 'children' ||
73
- name === 'style' ||
74
- name === 'ref' ||
75
- name === 'class' ||
76
- name === 'className' ||
77
- name === 'forwardedRef') {
78
- return;
79
- }
80
- if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
81
- const eventName = name.substring(2);
82
- const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
83
- if (!isCoveredByReact(eventNameLc)) {
84
- syncEvent(node, eventNameLc, newProps[name]);
85
- }
86
- }
87
- else {
88
- node[name] = newProps[name];
89
- const propType = typeof newProps[name];
90
- if (propType === 'string') {
91
- node.setAttribute(camelToDashCase(name), newProps[name]);
92
- }
93
- }
94
- });
95
- }
34
+ function DBadge({ text, isDot = false, theme = 'primary', id, className, style, }) {
35
+ const generateClasses = react.useMemo(() => ({
36
+ badge: true,
37
+ 'badge-dot': isDot,
38
+ [`badge-${theme}`]: !!theme,
39
+ }), [isDot, theme]);
40
+ return (jsxRuntime.jsx("span", Object.assign({ className: classNames__default["default"](generateClasses, className), style: style }, id && { id }, { children: jsxRuntime.jsx("span", { children: text }) })));
41
+ }
42
+
43
+ function DInputSwitch({ label, id, name, isChecked, isDisabled, isReadonly, onChange, }) {
44
+ const [internalIsChecked, setInternalIsChecked] = react.useState(isChecked);
45
+ react.useEffect(() => {
46
+ setInternalIsChecked(isChecked);
47
+ }, [isChecked]);
48
+ const changeHandler = react.useCallback((event) => {
49
+ const value = event.currentTarget.checked;
50
+ setInternalIsChecked(value);
51
+ onChange === null || onChange === void 0 ? void 0 : onChange(value);
52
+ }, [onChange]);
53
+ return (jsxRuntime.jsxs("div", { className: "form-check form-switch", children: [jsxRuntime.jsx("input", { id: id, name: name, onChange: isReadonly ? () => false : changeHandler, className: "form-check-input", type: "checkbox", role: "switch", checked: internalIsChecked, disabled: isDisabled }), label && (jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
54
+ }
55
+
56
+ function DPermissionItem({ permission, permissionState, onChange, onAction = () => { }, }) {
57
+ return (jsxRuntime.jsxs("div", { role: "button", tabIndex: 0, onKeyDown: () => { }, className: "d-flex permission-item align-items-center", onClick: onAction, children: [jsxRuntime.jsx("span", { className: "flex-grow-1 label", children: permission.label }), permission.type === 'custom' && (jsxRuntime.jsx(DBadge, { theme: "tertiary", text: permissionState })), jsxRuntime.jsx(DInputSwitch, { id: permission.id, isChecked: !!permission.value, isDisabled: !permission.enabled, onChange: (isChecked) => onChange(isChecked) })] }));
58
+ }
59
+
60
+ function DPermissionGroup({ title, description, permissionState, permissionList, onChangePermission, onCustomAction = () => { }, }) {
61
+ return (jsxRuntime.jsxs("div", { className: "row operation-group g-0 mb-3 mb-lg-0", children: [jsxRuntime.jsxs("div", { className: "col-12 col-lg-4 d-flex flex-column justify-content-center", children: [jsxRuntime.jsx("h6", { className: "fw-bold mb-3 mb-lg-2", children: title }), jsxRuntime.jsx("p", { className: "fs-8 d-none d-lg-block m-0", children: description })] }), jsxRuntime.jsx("div", { className: "col-12 offset-lg-1 col-lg-7", children: permissionList.map((permission) => (jsxRuntime.jsx(DPermissionItem, { permission: permission, permissionState: permissionState, onChange: (isChecked) => onChangePermission(permission, isChecked), onAction: () => onCustomAction(permission) }, permission.id))) })] }));
62
+ }
63
+
64
+ const PREFIX_BS = 'bs-';
65
+ const ALERT_TYPE_ICON = {
66
+ warning: 'exclamation-circle',
67
+ danger: 'exclamation-triangle',
68
+ success: 'check-circle',
69
+ info: 'info-circle',
70
+ light: 'info-circle',
71
+ dark: 'info-circle',
96
72
  };
97
- const getClassName = (classList, newProps, oldProps) => {
98
- const newClassProp = newProps.className || newProps.class;
99
- const oldClassProp = oldProps.className || oldProps.class;
100
- // map the classes to Maps for performance
101
- const currentClasses = arrayToMap(classList);
102
- const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
103
- const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
104
- const finalClassNames = [];
105
- // loop through each of the current classes on the component
106
- // to see if it should be a part of the classNames added
107
- currentClasses.forEach((currentClass) => {
108
- if (incomingPropClasses.has(currentClass)) {
109
- // add it as its already included in classnames coming in from newProps
110
- finalClassNames.push(currentClass);
111
- incomingPropClasses.delete(currentClass);
73
+
74
+ function DIcon({ icon, theme, className = '', size = '1.5rem', isLoading = false, loadingDuration = 1.8, hasCircle = false, circleSize = `calc(var(--${PREFIX_BS}icon-component-size) * 1)`, color, backgroundColor, familyClass = 'bi', familyPrefix = 'bi-', }) {
75
+ const getColorStyle = react.useMemo(() => {
76
+ if (color) {
77
+ return { [`--${PREFIX_BS}component-color`]: color };
112
78
  }
113
- else if (!oldPropClasses.has(currentClass)) {
114
- // add it as it has NOT been removed by user
115
- finalClassNames.push(currentClass);
79
+ if (theme) {
80
+ return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${theme})` };
116
81
  }
117
- });
118
- incomingPropClasses.forEach((s) => finalClassNames.push(s));
119
- return finalClassNames.join(' ');
120
- };
121
- /**
122
- * Transforms a React event name to a browser event name.
123
- */
124
- const transformReactEventName = (eventNameSuffix) => {
125
- switch (eventNameSuffix) {
126
- case 'doubleclick':
127
- return 'dblclick';
128
- }
129
- return eventNameSuffix;
130
- };
131
- /**
132
- * Checks if an event is supported in the current execution environment.
133
- * @license Modernizr 3.0.0pre (Custom Build) | MIT
134
- */
135
- const isCoveredByReact = (eventNameSuffix) => {
136
- if (typeof document === 'undefined') {
137
- return true;
138
- }
139
- else {
140
- const eventName = 'on' + transformReactEventName(eventNameSuffix);
141
- let isSupported = eventName in document;
142
- if (!isSupported) {
143
- const element = document.createElement('div');
144
- element.setAttribute(eventName, 'return;');
145
- isSupported = typeof element[eventName] === 'function';
82
+ return {};
83
+ }, [color, theme]);
84
+ const getBackgroundStyle = react.useMemo(() => {
85
+ if (backgroundColor) {
86
+ return { [`--${PREFIX_BS}icon-component-bg-color`]: backgroundColor };
146
87
  }
147
- return isSupported;
148
- }
149
- };
150
- const syncEvent = (node, eventName, newEventHandler) => {
151
- const eventStore = node.__events || (node.__events = {});
152
- const oldEventHandler = eventStore[eventName];
153
- // Remove old listener so they don't double up.
154
- if (oldEventHandler) {
155
- node.removeEventListener(eventName, oldEventHandler);
156
- }
157
- // Bind new listener.
158
- node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
159
- if (newEventHandler) {
160
- newEventHandler.call(this, e);
88
+ if (hasCircle) {
89
+ if (theme) {
90
+ return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${theme}-rgb), 0.1)` };
91
+ }
92
+ return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}body-color-rgb), 0.1)` };
161
93
  }
162
- }));
163
- };
164
- const arrayToMap = (arr) => {
165
- const map = new Map();
166
- arr.forEach((s) => map.set(s, s));
167
- return map;
168
- };
94
+ return {};
95
+ }, [backgroundColor, hasCircle, theme]);
96
+ const getCircleSizeStyle = react.useMemo(() => {
97
+ if (hasCircle) {
98
+ return { [`--${PREFIX_BS}icon-component-padding`]: circleSize };
99
+ }
100
+ return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
101
+ }, [circleSize, hasCircle]);
102
+ const generateStyleVariables = react.useMemo(() => (Object.assign(Object.assign(Object.assign({ [`--${PREFIX_BS}icon-component-size`]: size, [`--${PREFIX_BS}icon-component-loading-duration`]: `${loadingDuration}s` }, getColorStyle), getBackgroundStyle), getCircleSizeStyle)), [size, loadingDuration, getColorStyle, getBackgroundStyle, getCircleSizeStyle]);
103
+ const generateClasses = react.useMemo(() => ({
104
+ 'd-icon': true,
105
+ [className]: !!className,
106
+ [familyClass]: true,
107
+ [`${familyPrefix}${icon}`]: true,
108
+ 'd-icon-loading': isLoading,
109
+ }), [familyClass, familyPrefix, icon, className, isLoading]);
110
+ return (jsxRuntime.jsx("i", { className: classNames__default["default"](generateClasses), style: generateStyleVariables }));
111
+ }
169
112
 
170
- const setRef = (ref, value) => {
171
- if (typeof ref === 'function') {
172
- ref(value);
173
- }
174
- else if (ref != null) {
175
- // Cast as a MutableRef so we can assign current
176
- ref.current = value;
177
- }
178
- };
179
- const mergeRefs = (...refs) => {
180
- return (value) => {
181
- refs.forEach((ref) => {
182
- setRef(ref, value);
183
- });
184
- };
185
- };
186
- const createForwardRef = (ReactComponent, displayName) => {
187
- const forwardRef = (props, ref) => {
188
- return jsxRuntime.jsx(ReactComponent, Object.assign({}, props, { forwardedRef: ref }));
189
- };
190
- forwardRef.displayName = displayName;
191
- const forwardedRef = React__default["default"].forwardRef(forwardRef);
192
- forwardedRef.displayName = displayName;
193
- return forwardedRef;
194
- };
113
+ function DSummaryCard({ title, description, icon, iconSize, iconTheme, Summary, }) {
114
+ return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h6", { className: "fw-bold fs-6", children: title }), jsxRuntime.jsx("p", { className: "fs-8", children: description }), jsxRuntime.jsxs("div", { className: "bg-white rounded p-4 d-flex gap-3 shadow-sm text-gray-700 fs-8", children: [jsxRuntime.jsx(DIcon, { icon: icon, theme: iconTheme, size: iconSize }), Summary] })] }));
115
+ }
195
116
 
196
- const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction, defineCustomElement) => {
197
- if (defineCustomElement !== undefined) {
198
- defineCustomElement();
199
- }
200
- const displayName = dashToPascalCase(tagName);
201
- const ReactComponent = class extends React__default["default"].Component {
202
- constructor(props) {
203
- super(props);
204
- this.setComponentElRef = (element) => {
205
- this.componentEl = element;
117
+ function DAlert({ type = 'light', icon, iconFamilyClass, iconFamilyPrefix, showIcon = false, showClose, onClose, children, id, className, style, }) {
118
+ const generateClasses = react.useMemo(() => ({
119
+ alert: true,
120
+ [`alert-${type}`]: true,
121
+ 'fade show': !!showClose,
122
+ className: !!className,
123
+ }), [type, showClose, className]);
124
+ const getIcon = react.useMemo(() => icon || ALERT_TYPE_ICON[type] || '', [icon, type]);
125
+ const generateStyleVariables = react.useMemo(() => (Object.assign(Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}alert-component-separator-opacity`]: '0.3' }), type === 'light' && {
126
+ [`--${PREFIX_BS}alert-component-icon-color`]: `var(--${PREFIX_BS}secondary)`,
127
+ })), [style, type]);
128
+ return (jsxRuntime.jsxs("div", { className: classNames__default["default"](generateClasses), style: generateStyleVariables, role: "alert", id: id, children: [(showIcon || icon) && (jsxRuntime.jsx(DIcon, Object.assign({ className: "alert-icon", icon: getIcon }, iconFamilyClass && { familyClass: iconFamilyClass }, iconFamilyPrefix && { familyPrefix: iconFamilyPrefix }))), jsxRuntime.jsx("div", { className: "alert-text", children: children }), showClose && (jsxRuntime.jsx("div", { className: "alert-separator" })), showClose && (jsxRuntime.jsx("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { className: "alert-close-icon", icon: "x-lg", familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) }))] }));
129
+ }
130
+
131
+ function DBoxFile(_a) {
132
+ var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, isDisabled = false, children } = _a, dropzoneOptions = tslib.__rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "isDisabled", "children"]);
133
+ const { acceptedFiles, getRootProps, getInputProps, } = reactDropzone.useDropzone(Object.assign({ disabled: isDisabled }, dropzoneOptions));
134
+ return (jsxRuntime.jsxs("section", { className: classNames__default["default"]('d-box-file', {
135
+ 'd-box-file-selected': !!acceptedFiles.length,
136
+ }), children: [jsxRuntime.jsxs("div", Object.assign({}, getRootProps({
137
+ className: classNames__default["default"]('d-box-file-dropzone', {
138
+ disabled: isDisabled,
139
+ }),
140
+ }), { children: [jsxRuntime.jsx("input", Object.assign({}, getInputProps())), jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }), jsxRuntime.jsx("div", { className: "d-box-content", children: children })] })), !!acceptedFiles.length && (jsxRuntime.jsx("aside", { className: "d-box-files", children: acceptedFiles.map((file) => (jsxRuntime.jsx("div", { className: "d-box-files-text", children: `${file.name} - ${file.size} bytes` }, file.name))) }))] }));
141
+ }
142
+
143
+ function DButton({ theme = 'primary', size, variant, state, text = '', iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, value, type = 'button', isPill = false, isLoading = false, isDisabled = false, isStopPropagationEnabled = true, className, onClick, }) {
144
+ const generateClasses = react.useMemo(() => {
145
+ const variantClass = variant
146
+ ? `btn-${variant}-${theme}`
147
+ : `btn-${theme}`;
148
+ return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading: isLoading });
149
+ }, [variant, theme, size, state, isLoading]);
150
+ const generateStyleVariables = react.useMemo(() => {
151
+ if (isPill) {
152
+ return {
153
+ [`--${PREFIX_BS}btn-component-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
154
+ [`--${PREFIX_BS}btn-component-lg-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
155
+ [`--${PREFIX_BS}btn-component-sm-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
206
156
  };
207
157
  }
208
- componentDidMount() {
209
- this.componentDidUpdate(this.props);
210
- }
211
- componentDidUpdate(prevProps) {
212
- attachProps(this.componentEl, this.props, prevProps);
158
+ return {};
159
+ }, [isPill]);
160
+ const clickHandler = react.useCallback((event) => {
161
+ if (isStopPropagationEnabled) {
162
+ event.stopPropagation();
213
163
  }
214
- render() {
215
- const _a = this.props, { children, forwardedRef, style, className, ref } = _a, cProps = tslib.__rest(_a, ["children", "forwardedRef", "style", "className", "ref"]);
216
- let propsToPass = Object.keys(cProps).reduce((acc, name) => {
217
- const value = cProps[name];
218
- if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
219
- const eventName = name.substring(2).toLowerCase();
220
- if (typeof document !== 'undefined' && isCoveredByReact(eventName)) {
221
- acc[name] = value;
222
- }
223
- }
224
- else {
225
- // we should only render strings, booleans, and numbers as attrs in html.
226
- // objects, functions, arrays etc get synced via properties on mount.
227
- const type = typeof value;
228
- if (type === 'string' || type === 'boolean' || type === 'number') {
229
- acc[camelToDashCase(name)] = value;
230
- }
231
- }
232
- return acc;
233
- }, {});
234
- if (manipulatePropsFunction) {
235
- propsToPass = manipulatePropsFunction(this.props, propsToPass);
236
- }
237
- const newProps = Object.assign(Object.assign({}, propsToPass), { ref: mergeRefs(forwardedRef, this.setComponentElRef), style });
238
- /**
239
- * We use createElement here instead of
240
- * React.createElement to work around a
241
- * bug in Vite (https://github.com/vitejs/vite/issues/6104).
242
- * React.createElement causes all elements to be rendered
243
- * as <tagname> instead of the actual Web Component.
244
- */
245
- return React.createElement(tagName, newProps, children);
246
- }
247
- static get displayName() {
248
- return displayName;
249
- }
250
- };
251
- // If context was passed to createReactComponent then conditionally add it to the Component Class
252
- if (ReactComponentContext) {
253
- ReactComponent.contextType = ReactComponentContext;
254
- }
255
- return createForwardRef(ReactComponent, displayName);
256
- };
164
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
165
+ }, [isStopPropagationEnabled, onClick]);
166
+ return (jsxRuntime.jsxs("button", Object.assign({ className: classNames__default["default"](generateClasses, className), style: generateStyleVariables, type: type, disabled: state === 'disabled' || isLoading || isDisabled }, value && { value }, { onClick: clickHandler, children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })), (text && !isLoading) && (jsxRuntime.jsx("span", { children: text })), isLoading && (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) })), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix }))] })));
167
+ }
257
168
 
258
- /* eslint-disable */
259
- const DAlert = /*@__PURE__*/ createReactComponent('d-alert', undefined, undefined, dAlert_js.defineCustomElement);
260
- const DBadge = /*@__PURE__*/ createReactComponent('d-badge', undefined, undefined, dBadge_js.defineCustomElement);
261
- const DButton = /*@__PURE__*/ createReactComponent('d-button', undefined, undefined, dButton_js.defineCustomElement);
262
- const DChip = /*@__PURE__*/ createReactComponent('d-chip', undefined, undefined, dChip_js.defineCustomElement);
263
- const DIcon = /*@__PURE__*/ createReactComponent('d-icon', undefined, undefined, dIcon_js.defineCustomElement);
264
- const DInput = /*@__PURE__*/ createReactComponent('d-input', undefined, undefined, dInput_js.defineCustomElement);
265
- const DInputCheck = /*@__PURE__*/ createReactComponent('d-input-check', undefined, undefined, dInputCheck_js.defineCustomElement);
266
- const DInputCounter = /*@__PURE__*/ createReactComponent('d-input-counter', undefined, undefined, dInputCounter_js.defineCustomElement);
267
- const DInputCurrencyBase = /*@__PURE__*/ createReactComponent('d-input-currency-base', undefined, undefined, dInputCurrencyBase_js.defineCustomElement);
268
- const DInputPassword = /*@__PURE__*/ createReactComponent('d-input-password', undefined, undefined, dInputPassword_js.defineCustomElement);
269
- const DInputPin = /*@__PURE__*/ createReactComponent('d-input-pin', undefined, undefined, dInputPin_js.defineCustomElement);
270
- const DInputSearch = /*@__PURE__*/ createReactComponent('d-input-search', undefined, undefined, dInputSearch_js.defineCustomElement);
271
- const DInputSelect = /*@__PURE__*/ createReactComponent('d-input-select', undefined, undefined, dInputSelect_js.defineCustomElement);
272
- const DInputSwitch = /*@__PURE__*/ createReactComponent('d-input-switch', undefined, undefined, dInputSwitch_js.defineCustomElement);
273
- const DModal = /*@__PURE__*/ createReactComponent('d-modal', undefined, undefined, dModal_js.defineCustomElement);
274
- const DOffcanvas = /*@__PURE__*/ createReactComponent('d-offcanvas', undefined, undefined, dOffcanvas_js.defineCustomElement);
275
- const DProgress = /*@__PURE__*/ createReactComponent('d-progress', undefined, undefined, dProgress_js.defineCustomElement);
276
- const DQuickActionButton = /*@__PURE__*/ createReactComponent('d-quick-action-button', undefined, undefined, dQuickActionButton_js.defineCustomElement);
277
- const DQuickActionCheck = /*@__PURE__*/ createReactComponent('d-quick-action-check', undefined, undefined, dQuickActionCheck_js.defineCustomElement);
278
- const DQuickActionSelect = /*@__PURE__*/ createReactComponent('d-quick-action-select', undefined, undefined, dQuickActionSelect_js.defineCustomElement);
279
- const DQuickActionSwitch = /*@__PURE__*/ createReactComponent('d-quick-action-switch', undefined, undefined, dQuickActionSwitch_js.defineCustomElement);
169
+ function DCard({ className, style, children, }) {
170
+ return (jsxRuntime.jsx("div", { style: style, className: classNames__default["default"]('card', className), children: children }));
171
+ }
280
172
 
281
- function DPermissionItem({ permission, permissionState, onChange, onAction = () => { }, }) {
282
- return (jsxRuntime.jsxs("div", Object.assign({ role: "button", tabIndex: 0, onKeyDown: () => { }, className: "d-flex permission-item align-items-center", onClick: onAction }, { children: [jsxRuntime.jsx("span", Object.assign({ className: "flex-grow-1 label" }, { children: permission.label })), permission.type === 'custom' && (jsxRuntime.jsx(DBadge, { theme: "tertiary", text: permissionState })), jsxRuntime.jsx(DInputSwitch, { innerId: permission.id, isChecked: !!permission.value, isDisabled: !permission.enabled, onEventChange: ({ detail: checked }) => onChange(checked) })] })));
173
+ function DCardBody({ className, children, }) {
174
+ return (jsxRuntime.jsx("div", { className: classNames__default["default"]('card-body', className), children: children }));
175
+ }
176
+
177
+ function DCardFooter({ className, children, }) {
178
+ return (jsxRuntime.jsx("div", { className: classNames__default["default"]('card-footer', className), children: children }));
283
179
  }
284
180
 
285
- function MPermissionGroup({ title, description, permissionState, permissionList, onChangePermission, onCustomAction = () => { }, }) {
286
- return (jsxRuntime.jsxs("div", Object.assign({ className: "row operation-group g-0 mb-3 mb-lg-0" }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: "col-12 col-lg-4 d-flex flex-column justify-content-center" }, { children: [jsxRuntime.jsx("h6", Object.assign({ className: "fw-bold mb-3 mb-lg-2" }, { children: title })), jsxRuntime.jsx("p", Object.assign({ className: "fs-8 d-none d-lg-block m-0" }, { children: description }))] })), jsxRuntime.jsx("div", Object.assign({ className: "col-12 offset-lg-1 col-lg-7" }, { children: permissionList.map((permission) => (jsxRuntime.jsx(DPermissionItem, { permission: permission, permissionState: permissionState, onChange: (isChecked) => onChangePermission(permission, isChecked), onAction: () => onCustomAction(permission) }, permission.id))) }))] })));
181
+ function DCardHeader({ className, children, }) {
182
+ return (jsxRuntime.jsx("div", { className: classNames__default["default"]('card-header', className), children: children }));
287
183
  }
288
184
 
289
- function MSummaryCard({ title, description, icon, iconSize, iconTheme, Summary, }) {
290
- return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h6", Object.assign({ className: "fw-bold fs-6" }, { children: title })), jsxRuntime.jsx("p", Object.assign({ className: "fs-8" }, { children: description })), jsxRuntime.jsxs("div", Object.assign({ className: "bg-white rounded p-4 d-flex gap-3 shadow-sm text-gray-700 fs-8" }, { children: [jsxRuntime.jsx(DIcon, { icon: icon, theme: iconTheme, size: iconSize }), Summary] }))] }));
185
+ function DCardAccount({ className, icon, theme, name, number, balance, balanceText, onClick, actionText, }) {
186
+ return (jsxRuntime.jsx(DCard, { className: classNames__default["default"]('d-card-account', className), children: jsxRuntime.jsxs(DCardBody, { children: [jsxRuntime.jsxs("div", { className: "d-flex gap-3 align-items-center", children: [jsxRuntime.jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxRuntime.jsxs("div", { className: "d-block flex-grow-1", children: [jsxRuntime.jsx("p", { className: "text-gray-700", children: name }), jsxRuntime.jsx("small", { className: "text-gray-500", children: number })] })] }), jsxRuntime.jsxs("div", { className: "d-block", children: [jsxRuntime.jsx("p", { className: "fw-bold fs-6 text-body", children: balance }), jsxRuntime.jsx("small", { className: "text-gray-700", children: balanceText })] }), jsxRuntime.jsx("div", { className: "d-flex justify-content-end", children: jsxRuntime.jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onClick: onClick }) })] }) }));
291
187
  }
292
188
 
293
- function DToastContainer({ style, position = 'top-right', }) {
294
- return (jsxRuntime.jsx(reactToastify.ToastContainer, { toastClassName: () => 'shadow-none p-0 cursor-default', position: position, autoClose: false, hideProgressBar: true, closeOnClick: false, closeButton: false, transition: reactToastify.Slide, style: style }));
189
+ function DCarousel(_a) {
190
+ var { children, className, options } = _a, props = tslib.__rest(_a, ["children", "className", "options"]);
191
+ return (jsxRuntime.jsx(reactSplide.Splide, Object.assign({ className: classNames__default["default"]('d-carousel', className), options: Object.assign(Object.assign({}, options), { classes: {
192
+ // Arrows
193
+ arrows: 'splide__arrows d-carousel-arrows',
194
+ arrow: 'splide__arrow d-carousel-arrow',
195
+ prev: 'splide__arrow--prev d-carousel-arrow-prev',
196
+ next: 'splide__arrow--next d-carousel-arrow-next',
197
+ // Paginator
198
+ pagination: 'splide__pagination d-carousel-pagination',
199
+ page: 'splide__pagination__page d-carousel-pagination-page',
200
+ } }) }, props, { children: children })));
201
+ }
202
+
203
+ function DCarouselSlide(_a) {
204
+ var { className } = _a, props = tslib.__rest(_a, ["className"]);
205
+ return (jsxRuntime.jsx(reactSplide.SplideSlide, Object.assign({ className: classNames__default["default"]('d-carousel-slide', className) }, props)));
206
+ }
207
+
208
+ function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, onClose, }) {
209
+ const generateClasses = react.useMemo(() => ({
210
+ 'd-chip': true,
211
+ [`d-chip-${theme}`]: !!theme,
212
+ }), [theme]);
213
+ return (jsxRuntime.jsxs("span", { className: classNames__default["default"](generateClasses), children: [icon && (jsxRuntime.jsx("div", { className: "d-chip-icon-container", children: jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), jsxRuntime.jsx("span", { children: text }), showClose && (jsxRuntime.jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: "x-lg" }) }))] }));
214
+ }
215
+
216
+ function DCollapse({ id, className, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
217
+ const [toggle, setToggle] = react.useState(defaultCollapsed);
218
+ const onChangeCollapse = () => setToggle((prev) => !prev);
219
+ react.useEffect(() => {
220
+ if (onChange) {
221
+ onChange(toggle);
222
+ }
223
+ }, [toggle, onChange]);
224
+ react.useEffect(() => {
225
+ setToggle(defaultCollapsed);
226
+ }, [defaultCollapsed]);
227
+ const generateStyles = react.useMemo(() => ({
228
+ [`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
229
+ }), [hasSeparator]);
230
+ return (jsxRuntime.jsxs("div", { id: id, className: classNames__default["default"]('collapse-container', className), 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: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}ref-fs-small)`, icon: toggle ? 'chevron-up' : 'chevron-down' })] }), toggle && (jsxRuntime.jsx("div", { className: classNames__default["default"]({
231
+ 'collapse-body': true,
232
+ }), style: generateStyles, children: children }))] }));
295
233
  }
296
234
 
297
- const LiquidContext = React.createContext({
235
+ function DCollapseIconText({ children, icon, iconSize = '1.5rem', iconTheme = 'primary', title, iconFamilyClass, iconFamilyPrefix, }) {
236
+ return (jsxRuntime.jsx(DCollapse, { defaultCollapsed: true, className: "d-collapse-icon-text", Component: (jsxRuntime.jsxs("div", { className: "d-collapse-icon-text-header", children: [jsxRuntime.jsx(DIcon, { icon: icon, size: iconSize, theme: iconTheme, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, hasCircle: true }), jsxRuntime.jsx("span", { className: "d-collapse-icon-text-title", children: title })] })), children: children }));
237
+ }
238
+
239
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
240
+ /* eslint-disable @typescript-eslint/require-await */
241
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
242
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
243
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
244
+ /* eslint-disable @typescript-eslint/no-explicit-any */
245
+ const liquidParser = {
246
+ library: {},
247
+ engine: undefined,
248
+ init(library, Liquid) {
249
+ this.library = library;
250
+ if (Liquid) {
251
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,global-require
252
+ this.engine = new Liquid.Liquid({
253
+ strictFilters: true,
254
+ strictVariables: true,
255
+ });
256
+ }
257
+ },
258
+ /**
259
+ * Parse a liquid string
260
+ * @param liquidString Target Content Space UID
261
+ * @returns a usable object or string
262
+ */
263
+ async parseLiquidAsync(liquidString) {
264
+ try {
265
+ return this.engine.parseAndRender(liquidString, this.library);
266
+ }
267
+ catch (error) {
268
+ return error.message;
269
+ }
270
+ },
271
+ /**
272
+ * Parse a liquid string
273
+ * @param liquidString Target Content Space UID
274
+ * @returns a usable object or string
275
+ */
276
+ parseLiquid(liquidString) {
277
+ try {
278
+ return this.engine.parseAndRenderSync(liquidString, this.library);
279
+ }
280
+ catch (error) {
281
+ return error.message;
282
+ }
283
+ },
284
+ parse(liquidString) {
285
+ if (this.engine) {
286
+ return this.parseLiquid(liquidString);
287
+ }
288
+ return liquidString;
289
+ },
290
+ async parseAsync(liquidString) {
291
+ if (this.engine) {
292
+ return this.parseLiquidAsync(liquidString);
293
+ }
294
+ return liquidString;
295
+ },
296
+ };
297
+
298
+ function formatCurrency(amount, options) {
299
+ return currency__default["default"](amount, options).format();
300
+ }
301
+
302
+ const LANG = liquidParser.parse('{{site.language}}');
303
+ async function configureI8n(resources, _a = {}) {
304
+ var { lng = LANG, fallbackLng = 'es' } = _a, config = tslib.__rest(_a, ["lng", "fallbackLng"]);
305
+ return i18n__default["default"]
306
+ .use(reactI18next.initReactI18next)
307
+ .init(Object.assign({ resources,
308
+ lng, initImmediate: true, fallbackLng, interpolation: {
309
+ escapeValue: false,
310
+ prefix: '{',
311
+ suffix: '}',
312
+ // skipOnVariables: false,
313
+ } }, config))
314
+ .then((t) => t);
315
+ }
316
+
317
+ const LiquidContext = react.createContext({
298
318
  language: 'en',
299
319
  currency: {
300
320
  symbol: '$',
@@ -304,19 +324,19 @@ const LiquidContext = React.createContext({
304
324
  },
305
325
  });
306
326
  function LiquidContextProvider({ children, }) {
307
- const value = React.useMemo(() => ({
308
- language: ui.liquidParser.parse('{{site.language}}'),
327
+ const value = react.useMemo(() => ({
328
+ language: liquidParser.parse('{{site.language}}'),
309
329
  currency: {
310
- symbol: ui.liquidParser.parse('{{vars.currency-symbol}}'),
311
- precision: parseInt(ui.liquidParser.parse('{{vars.currency-precision}}'), 10),
312
- separator: ui.liquidParser.parse('{{vars.currency-separator}}'),
313
- decimal: ui.liquidParser.parse('{{vars.currency-decimal}}'),
330
+ symbol: liquidParser.parse('{{vars.currency-symbol}}'),
331
+ precision: parseInt(liquidParser.parse('{{vars.currency-precision}}'), 10),
332
+ separator: liquidParser.parse('{{vars.currency-separator}}'),
333
+ decimal: liquidParser.parse('{{vars.currency-decimal}}'),
314
334
  },
315
335
  }), []);
316
- return (jsxRuntime.jsx(LiquidContext.Provider, Object.assign({ value: value }, { children: children })));
336
+ return (jsxRuntime.jsx(LiquidContext.Provider, { value: value, children: children }));
317
337
  }
318
338
  function useLiquidContext() {
319
- const context = React.useContext(LiquidContext);
339
+ const context = react.useContext(LiquidContext);
320
340
  if (context === undefined) {
321
341
  throw new Error('useLiquidContext was used outside of LiquidContextProvider');
322
342
  }
@@ -333,15 +353,15 @@ const LiquidContext$1 = LiquidContext;
333
353
  * @see https://react-hooks.org/docs/useStackState
334
354
  */
335
355
  function useStackState(initialList) {
336
- const [list, setList] = React.useState(initialList);
356
+ const [list, setList] = react.useState(initialList);
337
357
  const { length } = list;
338
- const push = React.useCallback((item) => {
358
+ const push = react.useCallback((item) => {
339
359
  setList((prevList) => [
340
360
  ...prevList,
341
361
  item,
342
362
  ]);
343
363
  }, []);
344
- const pop = React.useCallback(() => {
364
+ const pop = react.useCallback(() => {
345
365
  setList((prevList) => {
346
366
  if (prevList.length === 0) {
347
367
  return prevList;
@@ -350,14 +370,14 @@ function useStackState(initialList) {
350
370
  return newList;
351
371
  });
352
372
  }, []);
353
- const peek = React.useCallback(() => {
373
+ const peek = react.useCallback(() => {
354
374
  if (list.length > 0) {
355
375
  return list[list.length - 1];
356
376
  }
357
377
  return undefined;
358
378
  }, [list]);
359
379
  const clear = () => setList([]);
360
- const isEmpty = React.useCallback(() => list.length === 0, [list]);
380
+ const isEmpty = react.useCallback(() => list.length === 0, [list]);
361
381
  const controls = {
362
382
  clear,
363
383
  isEmpty,
@@ -369,11 +389,11 @@ function useStackState(initialList) {
369
389
  return [list, controls];
370
390
  }
371
391
 
372
- const ModalContext = React.createContext(undefined);
392
+ const ModalContext = react.createContext(undefined);
373
393
  function enhanceModal(Modal, callbacks) {
374
394
  return function EnhancedModal(_a) {
375
395
  var { name, payload } = _a, otherProps = tslib.__rest(_a, ["name", "payload"]);
376
- React.useEffect(() => {
396
+ react.useEffect(() => {
377
397
  if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onAfterOpen) {
378
398
  callbacks.onAfterOpen(payload);
379
399
  }
@@ -389,8 +409,8 @@ function enhanceModal(Modal, callbacks) {
389
409
  };
390
410
  }
391
411
  function ModalContextProvider({ portalName, children, availableModals, }) {
392
- const [hasPortal, setHasPortal] = React.useState(false);
393
- React.useEffect(() => {
412
+ const [hasPortal, setHasPortal] = react.useState(false);
413
+ react.useEffect(() => {
394
414
  const previousPortal = document.querySelector(`#${portalName}`);
395
415
  if (previousPortal) {
396
416
  previousPortal.remove();
@@ -401,7 +421,7 @@ function ModalContextProvider({ portalName, children, availableModals, }) {
401
421
  setHasPortal(true);
402
422
  }, [portalName]);
403
423
  const [stack, { push, pop, peek }] = useStackState([]);
404
- React.useEffect(() => {
424
+ react.useEffect(() => {
405
425
  if (stack.length) {
406
426
  document.body.style.overflow = 'hidden';
407
427
  document.body.style.paddingRight = '0';
@@ -411,7 +431,7 @@ function ModalContextProvider({ portalName, children, availableModals, }) {
411
431
  document.body.style.paddingRight = 'unset';
412
432
  }
413
433
  }, [stack.length]);
414
- const openModal = React.useCallback((modalName, { payload, callbacks } = { payload: {} }) => {
434
+ const openModal = react.useCallback((modalName, { payload, callbacks } = { payload: {} }) => {
415
435
  const Component = availableModals[modalName];
416
436
  if (!Component) {
417
437
  throw new Error(`there is no component for modal ${modalName}`);
@@ -427,7 +447,7 @@ function ModalContextProvider({ portalName, children, availableModals, }) {
427
447
  }
428
448
  push(stackItem);
429
449
  }, [availableModals, push]);
430
- const closeModal = React.useCallback((context = { fromModal: false }) => {
450
+ const closeModal = react.useCallback((context = { fromModal: false }) => {
431
451
  var _a;
432
452
  const stackItem = peek();
433
453
  if (!stackItem) {
@@ -438,29 +458,29 @@ function ModalContextProvider({ portalName, children, availableModals, }) {
438
458
  }
439
459
  pop();
440
460
  }, [peek, pop]);
441
- const value = React.useMemo(() => ({
461
+ const value = react.useMemo(() => ({
442
462
  stack,
443
463
  openModal,
444
464
  closeModal,
445
465
  }), [stack, openModal, closeModal]);
446
- return (jsxRuntime.jsxs(ModalContext.Provider, Object.assign({ value: value }, { children: [children, hasPortal && ReactDOM.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [stack.map(({ Component, modalName, callbacks, payload, }) => {
466
+ return (jsxRuntime.jsxs(ModalContext.Provider, { value: value, children: [children, hasPortal && reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [stack.map(({ Component, modalName, callbacks, payload, }) => {
447
467
  const EnhancedComponent = enhanceModal(Component, callbacks);
448
468
  return (jsxRuntime.jsx(EnhancedComponent, { name: modalName, payload: payload, openModal: openModal, closeModal: closeModal }, modalName));
449
- }), !!stack.length && jsxRuntime.jsx("div", { className: "modal-backdrop fade show" })] }), document.getElementById(portalName))] })));
469
+ }), !!stack.length && jsxRuntime.jsx("div", { className: "modal-backdrop fade show" })] }), document.getElementById(portalName))] }));
450
470
  }
451
471
  function useModalContext() {
452
- const context = React.useContext(ModalContext);
472
+ const context = react.useContext(ModalContext);
453
473
  if (context === undefined) {
454
474
  throw new Error('useModalContext was used outside of ModalContextProvider');
455
475
  }
456
476
  return context;
457
477
  }
458
478
 
459
- const OffcanvasContext = React.createContext(undefined);
479
+ const OffcanvasContext = react.createContext(undefined);
460
480
  function enhanceOffcanvas(Offcanvas, callbacks) {
461
481
  return function EnhancedOffcanvas(_a) {
462
482
  var { name, payload } = _a, otherProps = tslib.__rest(_a, ["name", "payload"]);
463
- React.useEffect(() => {
483
+ react.useEffect(() => {
464
484
  if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onAfterOpen) {
465
485
  callbacks.onAfterOpen(payload);
466
486
  }
@@ -476,8 +496,8 @@ function enhanceOffcanvas(Offcanvas, callbacks) {
476
496
  };
477
497
  }
478
498
  function OffcanvasContextProvider({ portalName, children, availableOffcanvas, }) {
479
- const [hasPortal, setHasPortal] = React.useState(false);
480
- React.useEffect(() => {
499
+ const [hasPortal, setHasPortal] = react.useState(false);
500
+ react.useEffect(() => {
481
501
  const previousPortal = document.querySelector(`#${portalName}`);
482
502
  if (previousPortal) {
483
503
  previousPortal.remove();
@@ -488,7 +508,7 @@ function OffcanvasContextProvider({ portalName, children, availableOffcanvas, })
488
508
  setHasPortal(true);
489
509
  }, [portalName]);
490
510
  const [stack, { push, pop, peek }] = useStackState([]);
491
- React.useEffect(() => {
511
+ react.useEffect(() => {
492
512
  if (stack.length) {
493
513
  document.body.style.overflow = 'hidden';
494
514
  document.body.style.paddingRight = '0';
@@ -498,7 +518,7 @@ function OffcanvasContextProvider({ portalName, children, availableOffcanvas, })
498
518
  document.body.style.paddingRight = 'unset';
499
519
  }
500
520
  }, [stack.length]);
501
- const openOffcanvas = React.useCallback((offcanvasName, { payload, callbacks } = { payload: {} }) => {
521
+ const openOffcanvas = react.useCallback((offcanvasName, { payload, callbacks } = { payload: {} }) => {
502
522
  const Component = availableOffcanvas[offcanvasName];
503
523
  if (!Component) {
504
524
  throw new Error(`there is no component for offcanvas ${offcanvasName}`);
@@ -514,7 +534,7 @@ function OffcanvasContextProvider({ portalName, children, availableOffcanvas, })
514
534
  }
515
535
  push(stackItem);
516
536
  }, [availableOffcanvas, push]);
517
- const closeOffcanvas = React.useCallback((context = { fromOffcanvas: false }) => {
537
+ const closeOffcanvas = react.useCallback((context = { fromOffcanvas: false }) => {
518
538
  var _a;
519
539
  const stackItem = peek();
520
540
  if (!stackItem) {
@@ -525,328 +545,417 @@ function OffcanvasContextProvider({ portalName, children, availableOffcanvas, })
525
545
  }
526
546
  pop();
527
547
  }, [peek, pop]);
528
- const value = React.useMemo(() => ({
548
+ const value = react.useMemo(() => ({
529
549
  stack,
530
550
  openOffcanvas,
531
551
  closeOffcanvas,
532
552
  }), [stack, openOffcanvas, closeOffcanvas]);
533
- return (jsxRuntime.jsxs(OffcanvasContext.Provider, Object.assign({ value: value }, { children: [children, hasPortal && ReactDOM.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [stack.map(({ Component, offcanvasName, callbacks, payload, }) => {
553
+ return (jsxRuntime.jsxs(OffcanvasContext.Provider, { value: value, children: [children, hasPortal && reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [stack.map(({ Component, offcanvasName, callbacks, payload, }) => {
534
554
  const EnhancedComponent = enhanceOffcanvas(Component, callbacks);
535
555
  return (jsxRuntime.jsx(EnhancedComponent, { name: offcanvasName, payload: payload, openOffcanvas: openOffcanvas, closeOffcanvas: closeOffcanvas }, offcanvasName));
536
- }), !!stack.length && jsxRuntime.jsx("div", { className: "offcanvas-backdrop fade show" })] }), document.getElementById(portalName))] })));
556
+ }), !!stack.length && jsxRuntime.jsx("div", { className: "offcanvas-backdrop fade show" })] }), document.getElementById(portalName))] }));
537
557
  }
538
558
  function useOffcanvasContext() {
539
- const context = React.useContext(OffcanvasContext);
559
+ const context = react.useContext(OffcanvasContext);
540
560
  if (context === undefined) {
541
561
  throw new Error('useOffcanvasContext was used outside of OffcanvasContextProvider');
542
562
  }
543
563
  return context;
544
564
  }
545
565
 
566
+ function useFormatCurrency(...args) {
567
+ const { currency } = useLiquidContext();
568
+ const format = react.useCallback((value) => formatCurrency(value, currency), [currency]);
569
+ const values = (args || []).map((value) => (formatCurrency(value !== null && value !== void 0 ? value : 0, currency)));
570
+ return {
571
+ format,
572
+ values,
573
+ };
574
+ }
575
+
576
+ function DCurrencyText({ value, className, }) {
577
+ const { values: [valueFormatted] } = useFormatCurrency(value);
578
+ return (jsxRuntime.jsx("span", { className: className, children: valueFormatted }));
579
+ }
580
+
581
+ function DInput({ id, style, className, name, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder = '', type = 'text', value = '', innerInputMode, pattern, isDisabled = false, isReadOnly = false, isLoading = false, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, hint, isInvalid = false, isValid = false, inputStart, onChange, onBlur, onFocus, onWheel, onIconStartClick, onIconEndClick, }, ref) {
582
+ const innerRef = react.useRef(null);
583
+ const [internalValue, setInternalValue] = react.useState(value);
584
+ react.useEffect(() => {
585
+ setInternalValue(value);
586
+ }, [value]);
587
+ react.useImperativeHandle(ref, () => ({
588
+ blur() {
589
+ var _a;
590
+ (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.blur();
591
+ },
592
+ focus() {
593
+ var _a;
594
+ (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
595
+ },
596
+ }), []);
597
+ const handleInputChange = react.useCallback((event) => {
598
+ setInternalValue(event.target.value);
599
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
600
+ }, [onChange]);
601
+ return (jsxRuntime.jsxs("div", { className: classNames__default["default"]({
602
+ 'd-input': true,
603
+ className: !!className,
604
+ }), style: style, children: [label && (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("div", { className: "d-input-control", children: [jsxRuntime.jsxs("div", { className: classNames__default["default"]({
605
+ 'input-group': true,
606
+ 'has-validation': isInvalid,
607
+ disabled: isDisabled || isLoading,
608
+ }), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: onIconStartClick, disabled: isDisabled || isLoading, children: iconStart && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsxRuntime.jsx("input", Object.assign({ ref: innerRef, id: id, name: name, type: type, className: classNames__default["default"]('form-control', {
609
+ 'is-invalid': isInvalid,
610
+ 'is-valid': isValid,
611
+ }), placeholder: placeholder, "aria-label": label, disabled: isDisabled || isLoading, readOnly: isReadOnly, value: internalValue, "aria-describedby": `${id}Add ${id}Hint`, pattern: pattern, onChange: (event) => handleInputChange(event), onBlur: onBlur, onFocus: onFocus, onWheel: onWheel }, innerInputMode && { inputMode: innerInputMode })), ((isInvalid || isValid) && !iconEnd && !isLoading) && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "d-input-validation-icon", icon: isInvalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !isLoading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: onIconEndClick, disabled: isDisabled || isLoading, children: iconEnd && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), isLoading && (jsxRuntime.jsx("div", { className: "input-group-text d-input-icon", 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 }))] })] }));
612
+ }
613
+ const ForwardedDInput = react.forwardRef(DInput);
614
+ ForwardedDInput.displayName = 'DInput';
615
+ const DInput$1 = ForwardedDInput;
616
+
546
617
  function DDatePickerTime(_a) {
547
- var { value, onEventChange, innerId, label } = _a, props = tslib.__rest(_a, ["value", "onEventChange", "innerId", "label"]);
548
- return (jsxRuntime.jsxs("div", Object.assign({ className: "d-flex align-items-center gap-2 flex-column d-datepicker-time" }, { children: [label && (jsxRuntime.jsx("p", Object.assign({ className: "d-datepicker-time-label" }, { children: label }))), jsxRuntime.jsx(DInput, Object.assign({}, onEventChange && {
549
- onEventChange: (time) => onEventChange(time),
550
- }, { type: "time", innerId: innerId, value: value }, props))] })));
618
+ var { value, onChange, id, label } = _a, props = tslib.__rest(_a, ["value", "onChange", "id", "label"]);
619
+ return (jsxRuntime.jsxs("div", { className: "d-flex align-items-center gap-2 flex-column d-datepicker-time", children: [label && (jsxRuntime.jsx("p", { className: "d-datepicker-time-label", children: label })), jsxRuntime.jsx(DInput$1, Object.assign({}, onChange && {
620
+ onChange: (event) => onChange(event.target.value),
621
+ }, { type: "time", id: id, value: value }, props))] }));
551
622
  }
552
623
 
553
624
  function DDatePickerInput(_a, ref) {
554
- var { value, onEventClick, innerId, iconEnd } = _a, props = tslib.__rest(_a, ["value", "onEventClick", "innerId", "iconEnd"]);
555
- React.useImperativeHandle(ref, () => ({}), []);
556
- return (jsxRuntime.jsx("div", Object.assign({ role: "button", onClick: onEventClick, onKeyDown: () => { }, tabIndex: -1 }, { children: jsxRuntime.jsx(DInput, Object.assign({ isReadOnly: true, type: "text", innerId: innerId, value: value, onEventIconEndClick: onEventClick, iconEnd: iconEnd }, props)) })));
625
+ var { value, onClick, id, iconEnd } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd"]);
626
+ react.useImperativeHandle(ref, () => ({}), []);
627
+ return (jsxRuntime.jsx("div", { role: "button", onClick: onClick, onKeyDown: () => { }, tabIndex: -1, children: jsxRuntime.jsx(DInput$1, Object.assign({ isReadOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd }, props)) }));
557
628
  }
558
- const DDatePickerInput$1 = React.forwardRef(DDatePickerInput);
629
+ const ForwardedDDatePickerInput = react.forwardRef(DDatePickerInput);
630
+ ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
631
+ const DDatePickerInput$1 = ForwardedDDatePickerInput;
559
632
 
560
633
  function DMonthPicker(_a) {
561
- var { onEventChangeDate, date } = _a, props = tslib.__rest(_a, ["onEventChangeDate", "date"]);
562
- const dateJS = (value) => luxon.DateTime.fromISO(value).toJSDate();
634
+ var { onChangeDate, date } = _a, props = tslib.__rest(_a, ["onChangeDate", "date"]);
563
635
  const { language } = useLiquidContext();
564
- const lang = language || 'en';
565
- return (jsxRuntime.jsx(DatePicker__default["default"], Object.assign({ showMonthYearPicker: true, selected: dateJS(date), calendarClassName: "d-month-picker", onChange: (value) => {
566
- onEventChangeDate(value);
567
- }, customInput: (jsxRuntime.jsx("p", Object.assign({ className: "fw-bold text-capitalize" }, { children: luxon.DateTime.fromISO(date).setLocale(lang).toFormat('MMMM yyyy') }))), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxRuntime.jsxs("div", Object.assign({ className: "d-flex align-items-center justify-content-between gap-4 fs-6 bg-dark" }, { children: [jsxRuntime.jsx(DButton, { iconStart: "chevron-left", size: "sm", variant: "link", theme: "light", onEventClick: decreaseYear, isDisabled: prevYearButtonDisabled }), jsxRuntime.jsx("p", Object.assign({ className: "fs-6 fw-bold" }, { children: monthDate.getFullYear() })), jsxRuntime.jsx(DButton, { iconStart: "chevron-right", size: "sm", variant: "link", theme: "light", onEventClick: increaseYear, isDisabled: nextYearButtonDisabled })] }))) }, props)));
636
+ const selected = react.useMemo(() => luxon.DateTime.fromISO(date).toJSDate(), [date]);
637
+ const locale = react.useMemo(() => language || 'en', [language]);
638
+ const dateFormatted = react.useMemo(() => (luxon.DateTime.fromISO(date).setLocale(locale).toFormat('MMMM yyyy')), [date, locale]);
639
+ return (jsxRuntime.jsx(DatePicker__default["default"], Object.assign({ showMonthYearPicker: true, selected: selected, calendarClassName: "d-month-picker", onChange: onChangeDate, customInput: (jsxRuntime.jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxRuntime.jsxs("div", { className: "d-flex align-items-center justify-content-between gap-4 fs-6 bg-dark", children: [jsxRuntime.jsx(DButton, { iconStart: "chevron-left", size: "sm", variant: "link", theme: "light", onClick: decreaseYear, isDisabled: prevYearButtonDisabled }), jsxRuntime.jsx("p", { className: "fs-6 fw-bold", children: monthDate.getFullYear() }), jsxRuntime.jsx(DButton, { iconStart: "chevron-right", size: "sm", variant: "link", theme: "light", onClick: increaseYear, isDisabled: nextYearButtonDisabled })] })) }, props)));
568
640
  }
569
641
 
570
642
  function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, decreaseMonthIcon, increaseMonthIcon, iconSize, buttonVariant, buttonTheme, }) {
571
643
  const { language } = useLiquidContext();
572
- const lang = language || 'en';
573
- return (jsxRuntime.jsxs("div", Object.assign({ className: "d-flex align-items-center justify-content-between d-datepicker-header" }, { children: [jsxRuntime.jsx(DButton, { iconStart: decreaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onEventClick: decreaseMonth, isDisabled: prevMonthButtonDisabled }), jsxRuntime.jsx(DMonthPicker, Object.assign({}, !withMonthSelector && { readOnly: true }, { date: monthDate.toISOString(), onEventChangeDate: (value) => {
574
- if (value) {
575
- changeMonth(luxon.DateTime.fromJSDate(value).month - 1);
576
- changeYear(luxon.DateTime.fromJSDate(value).year);
577
- }
578
- } }, lang && { locale: lang })), jsxRuntime.jsx(DButton, { iconStart: increaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onEventClick: increaseMonth, isDisabled: nextMonthButtonDisabled })] })));
644
+ const locale = react.useMemo(() => language || 'en', [language]);
645
+ const onChangeDate = react.useCallback((value) => {
646
+ if (value) {
647
+ changeMonth(luxon.DateTime.fromJSDate(value).month - 1);
648
+ changeYear(luxon.DateTime.fromJSDate(value).year);
649
+ }
650
+ }, [changeMonth, changeYear]);
651
+ return (jsxRuntime.jsxs("div", { className: "d-flex align-items-center justify-content-between d-datepicker-header", children: [jsxRuntime.jsx(DButton, { iconStart: decreaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseMonth, isDisabled: prevMonthButtonDisabled }), jsxRuntime.jsx(DMonthPicker, Object.assign({}, !withMonthSelector && { readOnly: true }, { date: monthDate.toISOString(), onChangeDate: onChangeDate }, locale && { locale })), jsxRuntime.jsx(DButton, { iconStart: increaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, isDisabled: nextMonthButtonDisabled })] }));
579
652
  }
580
653
 
581
654
  function DDatePicker(_a) {
582
- var { onEventChangeDate, date, selectsRange, withMonthSelector, inputLabel, inputIcon = 'calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, headerDecreaseMonthIcon = 'chevron-left', headerIncreaseMonthIcon = 'chevron-right', headerIconSize = 'sm', headerButtonVariant = 'link', headerButtonTheme = 'dark' } = _a, props = tslib.__rest(_a, ["onEventChangeDate", "date", "selectsRange", "withMonthSelector", "inputLabel", "inputIcon", "inputId", "timeId", "timeLabel", "headerDecreaseMonthIcon", "headerIncreaseMonthIcon", "headerIconSize", "headerButtonVariant", "headerButtonTheme"]);
583
- const dateJS = (value) => luxon.DateTime.fromISO(value).toJSDate();
655
+ var { onChangeDate, date, selectsRange, withMonthSelector, inputLabel, inputIcon = 'calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, headerDecreaseMonthIcon = 'chevron-left', headerIncreaseMonthIcon = 'chevron-right', headerIconSize = 'sm', headerButtonVariant = 'link', headerButtonTheme = 'dark' } = _a, props = tslib.__rest(_a, ["onChangeDate", "date", "selectsRange", "withMonthSelector", "inputLabel", "inputIcon", "inputId", "timeId", "timeLabel", "headerDecreaseMonthIcon", "headerIncreaseMonthIcon", "headerIconSize", "headerButtonVariant", "headerButtonTheme"]);
656
+ const selected = react.useMemo(() => luxon.DateTime.fromISO(date).toJSDate(), [date]);
584
657
  const { language } = useLiquidContext();
585
- const lang = language || 'en';
586
- // eslint-disable-next-line react/no-unstable-nested-components
587
- const InputPicker = React.forwardRef(({ value, onClick }, ref) => (jsxRuntime.jsx(DDatePickerInput$1, { label: inputLabel, innerId: inputId, iconEnd: inputIcon, value: value, onEventClick: onClick, ref: ref })));
588
- const TimeInputPicker = React.useCallback(({ value, onChange }) => (jsxRuntime.jsx(DDatePickerTime, { onEventChange: onChange, value: value, label: timeLabel, innerId: timeId })), [timeLabel, timeId]);
589
- const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeader, Object.assign({}, headerProps, { decreaseMonthIcon: headerDecreaseMonthIcon, increaseMonthIcon: headerIncreaseMonthIcon, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [headerButtonTheme,
658
+ const locale = react.useMemo(() => language || 'en', [language]);
659
+ const DatePickerHeader = react.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeader, Object.assign({}, headerProps, { decreaseMonthIcon: headerDecreaseMonthIcon, increaseMonthIcon: headerIncreaseMonthIcon, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [headerButtonTheme,
590
660
  headerButtonVariant,
591
661
  headerDecreaseMonthIcon,
592
662
  headerIconSize,
593
663
  headerIncreaseMonthIcon,
594
664
  withMonthSelector,
595
665
  ]);
596
- return (jsxRuntime.jsx(DatePicker__default["default"], Object.assign({ selected: dateJS(date), calendarClassName: "m-date-picker", onChange: (value) => {
597
- onEventChangeDate(value);
598
- }, renderCustomHeader: (headerProps) => jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: jsxRuntime.jsx(InputPicker, {}), customTimeInput: jsxRuntime.jsx(TimeInputPicker, {}), selectsRange: selectsRange }, lang && { locale: lang }, props)));
666
+ return (jsxRuntime.jsx(DatePicker__default["default"], Object.assign({ selected: selected, calendarClassName: "m-date-picker", onChange: onChangeDate, renderCustomHeader: (headerProps) => jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: jsxRuntime.jsx(DDatePickerInput$1, { id: inputId, iconEnd: inputIcon }), customTimeInput: jsxRuntime.jsx(DDatePickerTime, { id: timeId, label: timeLabel }), selectsRange: selectsRange }, locale && { locale }, props)));
599
667
  }
600
668
 
601
- function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
602
- const innerBackgroundColor = React.useMemo(() => {
603
- if (backgroundColor) {
604
- return backgroundColor;
605
- }
606
- const computedStyle = getComputedStyle(document.documentElement);
607
- return computedStyle.getPropertyValue(`--${ui.PREFIX_BS}secondary-100`);
608
- }, [backgroundColor]);
609
- const innerForegroundColor = React.useMemo(() => {
610
- if (foregroundColor) {
611
- return foregroundColor;
612
- }
613
- const computedStyle = getComputedStyle(document.documentElement);
614
- return computedStyle.getPropertyValue(`--${ui.PREFIX_BS}gray-100`);
615
- }, [foregroundColor]);
616
- return (jsxRuntime.jsx(ContentLoader__default["default"], Object.assign({ speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor }, { children: children })));
669
+ function DFormikInput(_a) {
670
+ var { name, hint } = _a, props = tslib.__rest(_a, ["name", "hint"]);
671
+ const [field, meta, helpers] = formik.useField(name);
672
+ return (jsxRuntime.jsx(DInput$1, Object.assign({}, props, { name: field.name, value: field.value, onChange: ({ target }) => helpers.setValue(target.value), onBlur: ({ target }) => field.onBlur(target.value), isInvalid: !!meta.error, hint: meta.error || hint })));
617
673
  }
618
674
 
619
- const TabContext = React.createContext(undefined);
620
- function DTabs({ children, defaultSelected, onEventChange, options, className, isVertical, }) {
621
- const [selected, setSelected] = React.useState(defaultSelected);
622
- const onSelect = React.useCallback((option) => {
623
- if (option.tab) {
624
- setSelected(option.tab);
675
+ function DInputCurrencyBase(_a) {
676
+ var { id, name, label = '', placeholder = '', value, isDisabled = false, isReadOnly = false, isLoading = false, hint, isInvalid = false, isValid = false, minValue, maxValue, currencyOptions, currencyCode, onChange, onBlur, onFocus } = _a, rest = tslib.__rest(_a, ["id", "name", "label", "placeholder", "value", "isDisabled", "isReadOnly", "isLoading", "hint", "isInvalid", "isValid", "minValue", "maxValue", "currencyOptions", "currencyCode", "onChange", "onBlur", "onFocus"]);
677
+ const [internalValueAsNumber, setInternalValueAsNumber] = react.useState(value);
678
+ const [internalValueAsFormat, setInternalValueAsFormat] = react.useState('');
679
+ const [internalType, setInternalType] = react.useState('text');
680
+ const [internalIsInvalid, setInternalIsInvalid] = react.useState(false);
681
+ const currencyInputRef = react.useRef(null);
682
+ const changeHandler = react.useCallback((event) => {
683
+ event.stopPropagation();
684
+ const eventValue = event.target.value;
685
+ const valueAsNumber = eventValue ? parseFloat(eventValue) : undefined;
686
+ const valueAsFormat = valueAsNumber !== undefined
687
+ ? currency__default["default"](valueAsNumber, Object.assign(Object.assign({}, currencyOptions), { symbol: '' })).format()
688
+ : '';
689
+ setInternalValueAsNumber(valueAsNumber);
690
+ setInternalValueAsFormat(valueAsFormat);
691
+ onChange === null || onChange === void 0 ? void 0 : onChange(valueAsNumber);
692
+ }, [currencyOptions, onChange]);
693
+ const blurHandler = react.useCallback((event) => {
694
+ event.stopPropagation();
695
+ setInternalType('text');
696
+ setInternalValueAsFormat(internalValueAsNumber !== undefined
697
+ ? currency__default["default"](internalValueAsNumber, Object.assign(Object.assign({}, currencyOptions), { symbol: '' })).format()
698
+ : '');
699
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(internalValueAsNumber);
700
+ }, [currencyOptions, internalValueAsNumber, onBlur]);
701
+ const focusHandler = react.useCallback((event) => {
702
+ event.stopPropagation();
703
+ setInternalType('number');
704
+ setInternalValueAsFormat(internalValueAsNumber !== undefined
705
+ ? currency__default["default"](internalValueAsNumber, Object.assign(Object.assign({}, currencyOptions), { symbol: '' })).format()
706
+ : '');
707
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(internalValueAsNumber);
708
+ }, [currencyOptions, internalValueAsNumber, onFocus]);
709
+ const wheelHandler = react.useCallback((event) => {
710
+ var _a;
711
+ event.stopPropagation();
712
+ (_a = currencyInputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
713
+ }, []);
714
+ const isValidValue = react.useCallback((internalValue) => {
715
+ if (internalValue === undefined) {
716
+ return true;
625
717
  }
626
- onEventChange(option);
627
- }, [onEventChange]);
628
- React.useEffect(() => {
629
- setSelected(defaultSelected);
630
- }, [defaultSelected]);
631
- const isSelected = React.useCallback((tab) => (selected === tab), [selected]);
632
- const value = React.useMemo(() => ({
633
- isSelected,
634
- }), [isSelected]);
635
- return (jsxRuntime.jsx(TabContext.Provider, Object.assign({ value: value }, { children: jsxRuntime.jsxs("div", Object.assign({ className: classNames__default["default"]({
636
- 'd-tabs': true,
637
- 'd-tabs-vertical': isVertical,
638
- }) }, { children: [jsxRuntime.jsx("nav", Object.assign({ className: "nav" }, { children: options.map((option) => (jsxRuntime.jsx("button", Object.assign({ id: `${option.tab}Tab`, className: classNames__default["default"]('nav-link', {
639
- active: option.tab === selected,
640
- }, className), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.isDisabled, onClick: () => onSelect(option) }, { children: option.label }), option.label))) })), jsxRuntime.jsx("div", Object.assign({ className: "tab-content" }, { children: children }))] })) })));
641
- }
642
- function useTabContext() {
643
- const context = React.useContext(TabContext);
644
- if (context === undefined) {
645
- throw new Error('useTabContext was used outside of MTab');
646
- }
647
- return context;
648
- }
649
-
650
- function DTabContent({ tab, children }) {
651
- const { isSelected } = useTabContext();
652
- if (!isSelected(tab)) {
653
- return null;
654
- }
655
- return (jsxRuntime.jsx("div", Object.assign({ className: "tab-pane fade show active", id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab` }, { children: children })));
656
- }
657
-
658
- function DPopover({ children, renderComponent, isOpen, setEventIsOpen, }) {
659
- const [innerIsOpen, setInnerIsOpen] = React.useState(false);
660
- React.useEffect(() => {
661
- setInnerIsOpen(isOpen);
662
- }, [isOpen]);
663
- const onOpenChange = React.useCallback((value) => {
664
- setInnerIsOpen(value);
665
- if (setEventIsOpen) {
666
- setEventIsOpen(value);
718
+ if (internalType === 'number') {
719
+ return ((minValue === undefined || internalValue >= minValue)
720
+ && (maxValue === undefined || internalValue <= maxValue));
667
721
  }
668
- }, [setEventIsOpen]);
669
- const { refs, floatingStyles, context } = react.useFloating({
670
- open: innerIsOpen,
671
- onOpenChange,
672
- middleware: [
673
- react.offset(0),
674
- react.flip({ fallbackAxisSideDirection: 'none' }),
675
- react.shift(),
676
- ],
677
- whileElementsMounted: react.autoUpdate,
678
- });
679
- const click = react.useClick(context);
680
- const dismiss = react.useDismiss(context);
681
- const role = react.useRole(context);
682
- const { getReferenceProps, getFloatingProps } = react.useInteractions([
683
- click,
684
- dismiss,
685
- role,
686
- ]);
687
- const headingId = react.useId();
688
- return (jsxRuntime.jsxs("div", Object.assign({ className: "d-popover" }, { children: [jsxRuntime.jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(innerIsOpen) })), innerIsOpen && (jsxRuntime.jsx(react.FloatingFocusManager, Object.assign({ context: context, modal: false }, { children: jsxRuntime.jsx("div", Object.assign({ className: "d-popover-content", ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) })))] })));
722
+ return true;
723
+ }, [internalType, maxValue, minValue]);
724
+ const valueAsType = react.useMemo(() => {
725
+ if (internalType === 'number') {
726
+ return internalValueAsNumber;
727
+ }
728
+ return internalValueAsFormat;
729
+ }, [internalType, internalValueAsFormat, internalValueAsNumber]);
730
+ react.useEffect(() => {
731
+ setInternalIsInvalid(!isValidValue(value));
732
+ }, [isValidValue, value]);
733
+ react.useEffect(() => {
734
+ setInternalValueAsNumber(value);
735
+ }, [value]);
736
+ const generateStyleVariables = react.useMemo(() => ({
737
+ [`--${PREFIX_BS}input-currency-component-symbol-color`]: `var(--${PREFIX_BS}secondary)`,
738
+ [`--${PREFIX_BS}input-currency-symbol-color`]: `var(--${PREFIX_BS}input-currency-component-symbol-color)`,
739
+ }), []);
740
+ const generateSymbolStyleVariables = react.useMemo(() => ({
741
+ color: `var(--${PREFIX_BS}m-input-currency-symbol-color)`,
742
+ }), []);
743
+ return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: currencyInputRef, style: generateStyleVariables, id: id, name: name, label: label, placeholder: placeholder, value: valueAsType, isDisabled: isDisabled, isReadOnly: isReadOnly, isLoading: isLoading, hint: hint, isInvalid: isInvalid || internalIsInvalid, isValid: isValid, type: internalType, innerInputMode: "decimal", pattern: "^[0-9]", onChange: changeHandler, onBlur: blurHandler, onFocus: focusHandler, onWheel: wheelHandler, inputStart: (jsxRuntime.jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, rest)));
689
744
  }
690
745
 
691
- function useFormatCurrency(...args) {
746
+ function DInputCurrency(props) {
692
747
  const { currency } = useLiquidContext();
693
- const format = React.useCallback((value) => ui.formatCurrency(value, currency), [currency]);
694
- const values = (args || []).map((value) => (ui.formatCurrency(value !== null && value !== void 0 ? value : 0, currency)));
695
- return {
696
- format,
697
- values,
698
- };
699
- }
700
-
701
- function DCurrencyText({ value, className, }) {
702
- const { values: [valueFormatted] } = useFormatCurrency(value);
703
- return (jsxRuntime.jsx("span", Object.assign({ className: className }, { children: valueFormatted })));
748
+ return (jsxRuntime.jsx(DInputCurrencyBase, Object.assign({ currencyOptions: currency }, props)));
704
749
  }
705
750
 
706
- function DFormikInput(_a) {
751
+ function DFormikInputCurrency(_a) {
707
752
  var { name, hint } = _a, props = tslib.__rest(_a, ["name", "hint"]);
708
753
  const [field, meta, helpers] = formik.useField(name);
709
- return (jsxRuntime.jsx(DInput, Object.assign({}, props, { name: field.name, value: field.value, onEventChange: ({ detail }) => helpers.setValue(detail), onEventBlur: ({ detail }) => field.onBlur(detail), isInvalid: !!meta.error, hint: meta.error || hint })));
754
+ return (jsxRuntime.jsx(DInputCurrency, Object.assign({}, props, { name: field.name, value: field.value, onChange: (value) => helpers.setValue(value), onBlur: (value) => field.onBlur(value), isInvalid: !!meta.error, hint: (meta === null || meta === void 0 ? void 0 : meta.error) || hint })));
710
755
  }
711
756
 
712
- function DFormikInputSelect(_a) {
713
- var { name, labelExtractor = (item) => item === null || item === void 0 ? void 0 : item.label, valueExtractor = (item) => item === null || item === void 0 ? void 0 : item.value } = _a, props = tslib.__rest(_a, ["name", "labelExtractor", "valueExtractor"]);
714
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
715
- const [field, , helpers] = formik.useField(name);
716
- return (jsxRuntime.jsx(DInputSelect, Object.assign({}, props, { name: field.name, selectedOption: field.value, labelExtractor: labelExtractor, valueExtractor: valueExtractor, onEventChange: ({ detail }) => helpers.setValue(detail), onEventBlur: ({ detail }) => field.onBlur(detail) })));
757
+ function DInputSelect({ id, name, label = '', className, options, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, isDisabled = false, isLoading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, hint, selectedOption, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
758
+ const internalValueExtractor = react.useCallback((option) => {
759
+ if (valueExtractor) {
760
+ return valueExtractor(option);
761
+ }
762
+ if ('value' in option) {
763
+ return option === null || option === void 0 ? void 0 : option.value;
764
+ }
765
+ throw new Error('Must provide a valueExtractor for custom object forms');
766
+ }, [valueExtractor]);
767
+ const internalLabelExtractor = react.useCallback((option) => {
768
+ if (labelExtractor) {
769
+ return labelExtractor(option);
770
+ }
771
+ if ('label' in option) {
772
+ return option === null || option === void 0 ? void 0 : option.label;
773
+ }
774
+ throw new Error('Must provide a labelExtractor for custom object forms');
775
+ }, [labelExtractor]);
776
+ const changeHandler = react.useCallback((event) => {
777
+ const selected = options
778
+ .find((option) => internalValueExtractor(option).toString() === event.currentTarget.value);
779
+ onChange === null || onChange === void 0 ? void 0 : onChange(selected);
780
+ }, [onChange, options, internalValueExtractor]);
781
+ const blurHandler = react.useCallback((event) => {
782
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
783
+ }, [onBlur]);
784
+ const iconStartClickHandler = react.useCallback((event) => {
785
+ onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(event);
786
+ }, [onIconStartClick]);
787
+ const iconEndClickHandler = react.useCallback((event) => {
788
+ onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
789
+ }, [onIconEndClick]);
790
+ return (jsxRuntime.jsxs("div", { className: classNames__default["default"]('d-input', className), children: [label && (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { className: "mdinput-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("div", { className: "d-input-control", children: [jsxRuntime.jsxs("div", { className: classNames__default["default"]({
791
+ 'input-group': true,
792
+ disabled: isDisabled || isLoading,
793
+ }), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: isDisabled || isLoading, children: iconStart && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsxRuntime.jsx("select", Object.assign({ id: id, name: name, className: "form-select", "aria-label": label, disabled: isDisabled || isLoading, "aria-describedby": `${id}Add ${id}Hint`, onChange: changeHandler, onBlur: blurHandler }, selectedOption && { value: internalValueExtractor(selectedOption) }, { children: options.map((option) => (jsxRuntime.jsx("option", { value: internalValueExtractor(option), children: internalLabelExtractor(option) }, internalValueExtractor(option)))) })), iconEnd && !isLoading && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: isDisabled || isLoading, children: iconEnd && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), isLoading && (jsxRuntime.jsx("div", { className: "input-group-text form-control-icon loading", 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 }))] })] }));
717
794
  }
718
795
 
719
- const TOOLTIP_FONT_SIZE_BY_SIZE = {
720
- sm: `var(--${ui.PREFIX_BS}ref-fs-small)`,
721
- default: `var(--${ui.PREFIX_BS}body-font-size)`,
722
- lg: `var(--${ui.PREFIX_BS}ref-fs-6)`,
723
- };
724
- const ARROW_WIDTH = 8;
725
- const ARROW_HEIGHT = 4;
726
- const GAP = 2;
727
- function DTooltip({ classNameContainer, className, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, isOpen = false, placement = 'top', size, Component, children, }) {
728
- const [open, setOpen] = React.useState(isOpen);
729
- const styleVariables = React.useMemo(() => {
730
- const defaultFontSize = size
731
- ? TOOLTIP_FONT_SIZE_BY_SIZE[size]
732
- : TOOLTIP_FONT_SIZE_BY_SIZE.default;
733
- return {
734
- background: `var(--${ui.PREFIX_BS}tooltip-bg, var(--${ui.PREFIX_BS}tooltip-component-bg, var(--${ui.PREFIX_BS}secondary)))`,
735
- borderRadius: `var(--${ui.PREFIX_BS}tooltip-border-radius, var(--${ui.PREFIX_BS}tooltip-component-border-radius, var(--${ui.PREFIX_BS}border-radius)))`,
736
- color: `var(--${ui.PREFIX_BS}tooltip-color, var(--${ui.PREFIX_BS}tooltip-component-color, var(--${ui.PREFIX_BS}white)))`,
737
- fontSize: `var(--${ui.PREFIX_BS}tooltip-font-size, var(--${ui.PREFIX_BS}tooltip-component-font-size, ${defaultFontSize}))`,
738
- padding: `var(--${ui.PREFIX_BS}tooltip-padding, var(--${ui.PREFIX_BS}tooltip-component-padding, var(--${ui.PREFIX_BS}ref-spacer-2)))`,
739
- maxWidth: `var(--${ui.PREFIX_BS}tooltip-max-width, var(--${ui.PREFIX_BS}tooltip-component-max-width, 300px))`,
740
- };
741
- }, [size]);
742
- const arrowRef = React.useRef(null);
743
- const { refs, context, floatingStyles, } = react.useFloating({
744
- open,
745
- onOpenChange: setOpen,
746
- placement,
747
- whileElementsMounted: react.autoUpdate,
748
- middleware: [
749
- react.offset(offSet),
750
- react.flip(),
751
- react.shift({
752
- padding,
753
- }),
754
- react.arrow({
755
- element: arrowRef,
756
- }),
757
- ],
758
- });
759
- const hover = react.useHover(context, { move: false });
760
- const focus = react.useFocus(context);
761
- const dismiss = react.useDismiss(context);
762
- const click = react.useClick(context);
763
- const role = react.useRole(context, { role: 'tooltip' });
764
- const { getReferenceProps, getFloatingProps } = react.useInteractions([
765
- withHover ? hover : undefined,
766
- withClick ? click : undefined,
767
- withFocus ? focus : undefined,
768
- dismiss,
769
- role,
770
- ]);
771
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ className: className, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsxRuntime.jsx(react.FloatingPortal, { children: open && (jsxRuntime.jsxs("div", Object.assign({ className: classNameContainer, ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), styleVariables) }, getFloatingProps(), { children: [jsxRuntime.jsx(react.FloatingArrow, { ref: arrowRef, context: context, style: {
772
- fill: styleVariables.background,
773
- }, width: ARROW_WIDTH, height: ARROW_HEIGHT }), children] }))) })] }));
796
+ function DFormikInputSelect(_a) {
797
+ var { name } = _a, props = tslib.__rest(_a, ["name"]);
798
+ const [field, , helpers] = formik.useField(name);
799
+ return (jsxRuntime.jsx(DInputSelect, Object.assign({}, props, { name: field.name, selectedOption: field.value, onChange: (selected) => helpers.setValue(selected), onBlur: (selected) => field.onBlur(selected) })));
774
800
  }
775
801
 
776
- function DCollapse({ id, className, Component, hasSeparator = false, defaultCollapsed = false, onEventChange, children, }) {
777
- const [toggle, setToggle] = React.useState(defaultCollapsed);
778
- const onChangeCollapse = () => setToggle((prev) => !prev);
779
- React.useEffect(() => {
780
- if (onEventChange) {
781
- onEventChange(toggle);
802
+ function DInputCheck({ type, name, label, isChecked = false, id, isDisabled = false, isIndeterminate, value, onChange, }) {
803
+ const innerRef = react.useRef(null);
804
+ const handleChange = react.useCallback((event) => {
805
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
806
+ }, [onChange]);
807
+ react.useEffect(() => {
808
+ if (innerRef.current) {
809
+ innerRef.current.indeterminate = Boolean(isIndeterminate);
782
810
  }
783
- }, [toggle, onEventChange]);
784
- React.useEffect(() => {
785
- setToggle(defaultCollapsed);
786
- }, [defaultCollapsed]);
787
- return (jsxRuntime.jsxs("div", Object.assign({ id: id, className: classNames__default["default"]('collapse-container', className) }, { children: [jsxRuntime.jsxs("button", Object.assign({ className: "collapse-button", type: "button", onClick: onChangeCollapse }, { children: [jsxRuntime.jsx("div", Object.assign({ className: "flex-grow-1" }, { children: Component })), jsxRuntime.jsx(DIcon, { color: `var(--${ui.PREFIX_BS}gray)`, size: `var(--${ui.PREFIX_BS}ref-fs-small)`, icon: toggle ? 'chevron-up' : 'chevron-down' })] })), toggle && (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]({
788
- 'collapse-body': true,
789
- }), style: {
790
- [`--${ui.PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
791
- } }, { children: children })))] })));
811
+ }, [isIndeterminate]);
812
+ react.useEffect(() => {
813
+ if (innerRef.current) {
814
+ innerRef.current.checked = isChecked;
815
+ }
816
+ }, [isChecked]);
817
+ if (!label) {
818
+ return (jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: "form-check-input", id: id, disabled: isDisabled, type: type, name: name, value: value }));
819
+ }
820
+ return (jsxRuntime.jsxs("div", { className: "form-check", children: [jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: "form-check-input", id: id, disabled: isDisabled, type: type, name: name, value: value }), jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
792
821
  }
793
822
 
794
- function DInputCurrency(_a) {
795
- var { onEventChange, onEventBlur, onEventFocus } = _a, otherProps = tslib.__rest(_a, ["onEventChange", "onEventBlur", "onEventFocus"]);
796
- const { currency } = useLiquidContext();
797
- return (jsxRuntime.jsx(DInputCurrencyBase, Object.assign({ currencyOptions: currency, onEventChange: ({ detail }) => onEventChange(detail) }, onEventBlur && {
798
- onEventBlur: ({ detail }) => onEventBlur(detail),
799
- }, onEventFocus && {
800
- onEventFocus: ({ detail }) => onEventFocus(detail),
801
- }, otherProps)));
823
+ function DInputCounter(_a) {
824
+ var { id, name, label = '', value, isDisabled = false, isReadOnly = false, isLoading = false, iconStart = 'dash-square', iconEnd = 'plus-square', hint, isInvalid = false, isValid = false, minValue, maxValue, style, className, onChange } = _a, rest = tslib.__rest(_a, ["id", "name", "label", "value", "isDisabled", "isReadOnly", "isLoading", "iconStart", "iconEnd", "hint", "isInvalid", "isValid", "minValue", "maxValue", "style", "className", "onChange"]);
825
+ const [internalIsInvalid, setInternalIsInvalid] = react.useState(false);
826
+ const [internalValue, setInternalValue] = react.useState(value);
827
+ react.useEffect(() => {
828
+ setInternalValue(value);
829
+ }, [value]);
830
+ react.useEffect(() => {
831
+ onChange === null || onChange === void 0 ? void 0 : onChange(internalValue);
832
+ }, [internalValue, onChange]);
833
+ const changeHandler = react.useCallback((event) => {
834
+ event.stopPropagation();
835
+ const newValue = parseInt(event.target.value || '0', 10);
836
+ setInternalValue(newValue);
837
+ }, []);
838
+ const clickHandler = react.useCallback((action) => {
839
+ if (action) {
840
+ setInternalValue((prevInternalValue) => {
841
+ const newValue = prevInternalValue + 1;
842
+ return newValue <= maxValue ? newValue : maxValue;
843
+ });
844
+ }
845
+ else {
846
+ setInternalValue((prevInternalValue) => {
847
+ const newValue = prevInternalValue - 1;
848
+ return newValue >= minValue ? newValue : minValue;
849
+ });
850
+ }
851
+ }, [maxValue, minValue]);
852
+ const generateStyleVariables = react.useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}input-component-form-control-text-align`]: 'center' })), [style]);
853
+ react.useEffect(() => {
854
+ setInternalIsInvalid(!(internalValue >= minValue && internalValue <= maxValue));
855
+ }, [internalValue, minValue, maxValue]);
856
+ return (jsxRuntime.jsx(DInput$1, Object.assign({ id: id, style: generateStyleVariables, className: className, name: name, label: label, value: internalValue, isDisabled: isDisabled, isReadOnly: isReadOnly, isLoading: isLoading, hint: hint, iconStart: iconStart, iconEnd: iconEnd, isInvalid: internalIsInvalid || isInvalid, isValid: isValid, type: "number", onChange: changeHandler, onIconStartClick: () => clickHandler(false), onIconEndClick: () => clickHandler(true) }, rest)));
802
857
  }
803
858
 
804
- function DBoxFile(_a) {
805
- var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, isDisabled = false, children } = _a, dropzoneOptions = tslib.__rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "isDisabled", "children"]);
806
- const { acceptedFiles, getRootProps, getInputProps, } = reactDropzone.useDropzone(Object.assign({ disabled: isDisabled }, dropzoneOptions));
807
- return (jsxRuntime.jsxs("section", Object.assign({ className: classNames__default["default"]('d-box-file', {
808
- 'd-box-file-selected': !!acceptedFiles.length,
809
- }) }, { children: [jsxRuntime.jsxs("div", Object.assign({}, getRootProps({
810
- className: classNames__default["default"]('d-box-file-dropzone', {
811
- disabled: isDisabled,
812
- }),
813
- }), { children: [jsxRuntime.jsx("input", Object.assign({}, getInputProps())), jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }), jsxRuntime.jsx("div", Object.assign({ className: "d-box-content" }, { children: children }))] })), !!acceptedFiles.length && (jsxRuntime.jsx("aside", Object.assign({ className: "d-box-files" }, { children: acceptedFiles.map((file) => (jsxRuntime.jsx("div", Object.assign({ className: "d-box-files-text" }, { children: `${file.name} - ${file.size} bytes` }), file.name))) })))] })));
859
+ function DInputPassword(_a) {
860
+ var { id, name, label = '', placeholder = '', value = '', isDisabled = false, isReadOnly = false, isLoading = false, hint, isInvalid = false, isValid = false, onChange } = _a, rest = tslib.__rest(_a, ["id", "name", "label", "placeholder", "value", "isDisabled", "isReadOnly", "isLoading", "hint", "isInvalid", "isValid", "onChange"]);
861
+ const [visible, setVisible] = react.useState(false);
862
+ const changeHandler = react.useCallback((event) => {
863
+ onChange === null || onChange === void 0 ? void 0 : onChange(event.target.value);
864
+ }, [onChange]);
865
+ const visibilityHandler = react.useCallback(() => {
866
+ setVisible((prevVisible) => !prevVisible);
867
+ }, []);
868
+ return (jsxRuntime.jsx(DInput$1, Object.assign({ id: id, name: name, label: label, placeholder: placeholder, value: value, iconEnd: !visible ? 'eye-slash' : 'eye', type: !visible ? 'password' : 'text', isDisabled: isDisabled, isReadOnly: isReadOnly, isLoading: isLoading, hint: hint, isInvalid: isInvalid, isValid: isValid, onChange: changeHandler, onIconEndClick: visibilityHandler }, rest)));
814
869
  }
815
870
 
816
- function DCarousel(_a) {
817
- var { children, className, options } = _a, props = tslib.__rest(_a, ["children", "className", "options"]);
818
- return (jsxRuntime.jsx(reactSplide.Splide, Object.assign({ className: classNames__default["default"]('d-carousel', className), options: Object.assign(Object.assign({}, options), { classes: {
819
- // Arrows
820
- arrows: 'splide__arrows d-carousel-arrows',
821
- arrow: 'splide__arrow d-carousel-arrow',
822
- prev: 'splide__arrow--prev d-carousel-arrow-prev',
823
- next: 'splide__arrow--next d-carousel-arrow-next',
824
- // Paginator
825
- pagination: 'splide__pagination d-carousel-pagination',
826
- page: 'splide__pagination__page d-carousel-pagination-page',
827
- } }) }, props, { children: children })));
871
+ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder = '•', type = 'text', isDisabled = false, isLoading = false, isSecret = false, iconFamilyClass, iconFamilyPrefix, characters = 4, innerInputMode = 'text', hint, isInvalid = false, isValid = false, onChange, }) {
872
+ const [pattern, setPattern] = react.useState('');
873
+ react.useEffect(() => {
874
+ setPattern(type === 'number' ? '[0-9]+' : '^[a-zA-Z0-9]+$');
875
+ }, [type]);
876
+ const nextInput = react.useCallback((event) => {
877
+ var _a;
878
+ const input = event.target;
879
+ const regex = new RegExp(pattern);
880
+ if (!regex.test(input.value)) {
881
+ input.value = '';
882
+ }
883
+ if (input.value !== '') {
884
+ if (input.nextSibling) {
885
+ (_a = input.nextSibling) === null || _a === void 0 ? void 0 : _a.focus();
886
+ }
887
+ else {
888
+ input.blur();
889
+ }
890
+ }
891
+ }, [pattern]);
892
+ const prevInput = react.useCallback((event) => {
893
+ var _a;
894
+ if (event.key === 'Backspace') {
895
+ const { value } = event.currentTarget;
896
+ if (event.currentTarget.previousSibling && value === '') {
897
+ (_a = event.currentTarget.previousSibling) === null || _a === void 0 ? void 0 : _a.focus();
898
+ }
899
+ else {
900
+ event.currentTarget.blur();
901
+ event.currentTarget.focus();
902
+ }
903
+ }
904
+ }, []);
905
+ const focusInput = react.useCallback((event) => {
906
+ // eslint-disable-next-line no-param-reassign
907
+ event.currentTarget.value = '';
908
+ }, []);
909
+ const wheelInput = react.useCallback((event) => {
910
+ event.currentTarget.blur();
911
+ }, []);
912
+ const formChange = react.useCallback((event) => {
913
+ const formData = new FormData(event.currentTarget);
914
+ const values = Array.from(formData.values()).join('');
915
+ onChange === null || onChange === void 0 ? void 0 : onChange(values);
916
+ }, [onChange]);
917
+ const preventDefaultEvent = react.useCallback((event) => {
918
+ event.preventDefault();
919
+ }, []);
920
+ return (jsxRuntime.jsxs("div", { className: "d-input-pin", children: [label && (jsxRuntime.jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { className: "d-input-pin-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("form", { id: id, className: "d-input-pin-controls", onInput: formChange, onSubmit: preventDefaultEvent, children: [Array.from({ length: characters }).map((_, index) => (jsxRuntime.jsx("input", Object.assign({ className: classNames__default["default"]({
921
+ 'form-control': true,
922
+ 'is-invalid': isInvalid,
923
+ 'is-valid': isValid,
924
+ }), type: isSecret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onChange: nextInput, onKeyDown: prevInput, onFocus: focusInput, onWheel: wheelInput, onClick: preventDefaultEvent, autoComplete: "off", placeholder: placeholder, disabled: isDisabled || isLoading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), (isInvalid || isValid) && !isLoading && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "d-input-pin-validation-icon", icon: isInvalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), isLoading && (jsxRuntime.jsx("div", { className: "input-group-text d-input-pin-icon", 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 }))] }));
828
925
  }
829
926
 
830
- function DCarouselSlide(_a) {
831
- var { className } = _a, props = tslib.__rest(_a, ["className"]);
832
- return (jsxRuntime.jsx(reactSplide.SplideSlide, Object.assign({ className: classNames__default["default"]('d-carousel-slide', className) }, props)));
927
+ function DInputSearch(_a) {
928
+ var { id, name, label, placeholder, value, isDisabled, isReadOnly, isLoading, hint, isInvalid, isValid, onChange, onClick } = _a, rest = tslib.__rest(_a, ["id", "name", "label", "placeholder", "value", "isDisabled", "isReadOnly", "isLoading", "hint", "isInvalid", "isValid", "onChange", "onClick"]);
929
+ const [internalValue, setInternalValue] = react.useState(value);
930
+ react.useEffect(() => {
931
+ setInternalValue(value);
932
+ }, [value]);
933
+ const changeHandler = react.useCallback((event) => {
934
+ event.stopPropagation();
935
+ setInternalValue(event.target.value);
936
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
937
+ }, [onChange]);
938
+ const clickHandler = react.useCallback(() => {
939
+ onClick === null || onClick === void 0 ? void 0 : onClick(internalValue);
940
+ }, [internalValue, onClick]);
941
+ return (jsxRuntime.jsx(DInput$1, Object.assign({ id: id, name: name, label: label, placeholder: placeholder, value: internalValue, iconEnd: "search", isDisabled: isDisabled, isReadOnly: isReadOnly, isLoading: isLoading, hint: hint, isInvalid: isInvalid, isValid: isValid, onChange: changeHandler, onIconEndClick: clickHandler }, rest)));
833
942
  }
834
943
 
835
944
  function DList({ children, className, isFlush = false, isNumbered = false, isHorizontal = false, horizontalBreakpoint, }) {
836
945
  if (isFlush && isHorizontal) {
837
946
  throw new Error("Horizontal and Flush props don't work together");
838
947
  }
839
- return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]('list-group', {
948
+ return (jsxRuntime.jsx("div", { className: classNames__default["default"]('list-group', {
840
949
  'list-group-flush': isFlush && !isHorizontal,
841
950
  'list-group-numbered': isNumbered,
842
951
  'list-group-horizontal': isHorizontal && !horizontalBreakpoint,
843
- }, (isHorizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className) }, { children: children })));
952
+ }, (isHorizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className), children: children }));
844
953
  }
845
954
 
846
- function DListItem({ children, className, isActive = false, isDisabled = false, theme, onEventClick, }) {
847
- const Tag = React.useMemo(() => (onEventClick ? 'button' : 'div'), [onEventClick]);
955
+ function DListItem({ children, className, isActive = false, isDisabled = false, theme, onClick, }) {
956
+ const Tag = react.useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
848
957
  return (jsxRuntime.jsx(Tag, Object.assign({}, Tag === 'button' && {
849
- onClick: onEventClick,
958
+ onClick,
850
959
  type: 'button',
851
960
  }, { className: classNames__default["default"]('list-group-item list-group-item-action', theme ? `list-group-item-${theme}` : undefined, className, {
852
961
  active: isActive,
@@ -855,8 +964,8 @@ function DListItem({ children, className, isActive = false, isDisabled = false,
855
964
  }
856
965
 
857
966
  function useToast() {
858
- const toast = React.useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
859
- reactToastify.toast(({ closeToast }) => (jsxRuntime.jsx(DAlert, Object.assign({ type: type, showClose: showClose, onEventClose: closeToast }, { children: message }))), {
967
+ const toast = react.useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
968
+ reactToastify.toast(({ closeToast }) => (jsxRuntime.jsx(DAlert, { type: type, showClose: showClose, onClose: closeToast, id: "alertID", children: message })), {
860
969
  transition: reactToastify.Slide,
861
970
  position,
862
971
  autoClose,
@@ -868,8 +977,8 @@ function useToast() {
868
977
  }
869
978
 
870
979
  function useScreenshot() {
871
- const clipRef = React.useRef(null);
872
- const takeBlob = React.useCallback(async (type) => {
980
+ const clipRef = react.useRef(null);
981
+ const takeBlob = react.useCallback(async (type) => {
873
982
  if (!clipRef.current) {
874
983
  throw new Error('set the clipRef');
875
984
  }
@@ -894,7 +1003,7 @@ function useScreenshot() {
894
1003
 
895
1004
  function useScreenshotDownload() {
896
1005
  const { clipRef, takeBlob } = useScreenshot();
897
- const download = React.useCallback(async () => {
1006
+ const download = react.useCallback(async () => {
898
1007
  const blob = await takeBlob();
899
1008
  const url = window.URL.createObjectURL(blob);
900
1009
  const link = window.document.createElement('a');
@@ -914,7 +1023,7 @@ function useScreenshotDownload() {
914
1023
 
915
1024
  function useScreenshotWebShare() {
916
1025
  const { takeBlob, clipRef } = useScreenshot();
917
- const share = React.useCallback(async () => {
1026
+ const share = react.useCallback(async () => {
918
1027
  const blob = await takeBlob();
919
1028
  const image = new File([blob], 'voucher.jpeg', { type: 'image/jpeg' });
920
1029
  if (!navigator.canShare
@@ -933,7 +1042,7 @@ function useScreenshotWebShare() {
933
1042
  function DListItemMovement(_a) {
934
1043
  var { description, date, amount, classNameMovement } = _a, props = tslib.__rest(_a, ["description", "date", "amount", "classNameMovement"]);
935
1044
  const { format } = useFormatCurrency();
936
- const value = React.useMemo(() => {
1045
+ const value = react.useMemo(() => {
937
1046
  const valueFormatted = format(amount);
938
1047
  if (amount > 0) {
939
1048
  return {
@@ -946,32 +1055,208 @@ function DListItemMovement(_a) {
946
1055
  valueFormatted,
947
1056
  };
948
1057
  }, [format, amount]);
949
- return (jsxRuntime.jsx(DListItem, Object.assign({}, props, { children: jsxRuntime.jsxs("div", Object.assign({ className: classNames__default["default"]('d-flex justify-content-between align-items-center p-3 gap-3', classNameMovement) }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: "d-flex flex-column gap-1" }, { children: [jsxRuntime.jsx("span", Object.assign({ className: "fs-6" }, { children: description })), jsxRuntime.jsx("span", Object.assign({ className: "small text-gray-700" }, { children: date }))] })), jsxRuntime.jsx("span", Object.assign({ className: classNames__default["default"]('fs-6', value.theme) }, { children: value.valueFormatted }))] })) })));
1058
+ return (jsxRuntime.jsx(DListItem, Object.assign({}, props, { children: jsxRuntime.jsxs("div", { className: classNames__default["default"]('d-flex justify-content-between align-items-center p-3 gap-3', classNameMovement), children: [jsxRuntime.jsxs("div", { className: "d-flex flex-column gap-1", children: [jsxRuntime.jsx("span", { className: "fs-6", children: description }), jsxRuntime.jsx("span", { className: "small text-gray-700", children: date })] }), jsxRuntime.jsx("span", { className: classNames__default["default"]('fs-6', value.theme), children: value.valueFormatted })] }) })));
1059
+ }
1060
+
1061
+ function DModal({ name, className = '', isStatic, isScrollable, isCentered, isFullScreen, fullScreenFrom, modalSize, children, }) {
1062
+ const fullScreenClass = react.useMemo(() => {
1063
+ if (isFullScreen) {
1064
+ if (fullScreenFrom) {
1065
+ return `modal-fullscreen-${fullScreenFrom}-down`;
1066
+ }
1067
+ return 'modal-fullscreen';
1068
+ }
1069
+ return '';
1070
+ }, [fullScreenFrom, isFullScreen]);
1071
+ const generateClasses = react.useMemo(() => ({
1072
+ 'modal fade show': true,
1073
+ [`${className}`]: !!className,
1074
+ }), [className]);
1075
+ const generateModalDialogClasses = react.useMemo(() => (Object.assign({ 'modal-dialog': true, 'modal-dialog-centered': !!isCentered, 'modal-dialog-scrollable': !!isScrollable, [fullScreenClass]: !!isFullScreen }, modalSize && { [`modal-${modalSize}`]: true })), [fullScreenClass, isCentered, isFullScreen, isScrollable, modalSize]);
1076
+ return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"](generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, isStatic && ({
1077
+ [`data-${PREFIX_BS}backdrop`]: 'static',
1078
+ [`data-${PREFIX_BS}keyboard`]: 'false',
1079
+ }), { children: jsxRuntime.jsx("div", { className: classNames__default["default"](generateModalDialogClasses), children: jsxRuntime.jsx("div", { className: "modal-content", children: children }) }) })));
1080
+ }
1081
+
1082
+ function DModalBody({ children }) {
1083
+ return (jsxRuntime.jsx("div", { className: "d-modal-slot modal-body", children: children }));
1084
+ }
1085
+
1086
+ function DModalFooter({ actionPlacement = 'fill', children, }) {
1087
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "d-modal-separator" }), jsxRuntime.jsx("div", { className: `d-modal-slot modal-footer d-modal-action-${actionPlacement}`, children: children })] }));
1088
+ }
1089
+
1090
+ function DModalHeader({ showCloseButton, onClose, children, }) {
1091
+ return (jsxRuntime.jsxs("div", { className: "modal-header", children: [showCloseButton && (jsxRuntime.jsx("button", { type: "button", className: "d-modal-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: "x-lg" }) })), children] }));
1092
+ }
1093
+
1094
+ function DOffcanvas({ name, className, isStatic, isScrollable, openFrom = 'end', children, }) {
1095
+ return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]('offcanvas show', {
1096
+ [`offcanvas-${openFrom}`]: openFrom,
1097
+ }, className), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, isStatic && ({
1098
+ [`data-${PREFIX_BS}backdrop`]: 'static',
1099
+ [`data-${PREFIX_BS}keyboard`]: 'false',
1100
+ }), isScrollable && ({
1101
+ [`data-${PREFIX_BS}scroll`]: 'true',
1102
+ [`data-${PREFIX_BS}keyboard`]: 'false',
1103
+ }), { children: children })));
1104
+ }
1105
+
1106
+ function DOffcanvasBody({ children }) {
1107
+ return (jsxRuntime.jsx("div", { className: "d-offcanvas-slot offcanvas-body", children: children }));
1108
+ }
1109
+
1110
+ function DOffcanvasFooter({ footerActionPlacement = 'fill', children, }) {
1111
+ return (jsxRuntime.jsx("div", { className: `d-offcanvas-slot d-offcanvas-footer d-offcanvas-action-${footerActionPlacement}`, children: children }));
1112
+ }
1113
+
1114
+ function DOffcanvasHeader({ showCloseButton, onClose, children, }) {
1115
+ return (jsxRuntime.jsxs("div", { className: "offcanvas-header", children: [jsxRuntime.jsx("div", { className: "d-offcanvas-slot", children: children }), showCloseButton && (jsxRuntime.jsx("button", { type: "button", className: "d-offcanvas-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: "x-lg" }) }))] }));
1116
+ }
1117
+
1118
+ function DPaginator(_a) {
1119
+ var { className, nextLabel, previousLabel, showArrows = true, page, onPageChange } = _a, props = tslib.__rest(_a, ["className", "nextLabel", "previousLabel", "showArrows", "page", "onPageChange"]);
1120
+ return (jsxRuntime.jsx(ResponsivePagination__default["default"], Object.assign({ extraClassName: classNames__default["default"]('pagination', className), nextClassName: classNames__default["default"]('arrow arrow-next', !nextLabel && 'no-label'), nextLabel: nextLabel, previousClassName: classNames__default["default"]('arrow arrow-prev', !previousLabel && 'no-label'), previousLabel: previousLabel, renderNav: showArrows, current: page, onPageChange: onPageChange }, props)));
1121
+ }
1122
+
1123
+ function DPopover({ children, renderComponent, isOpen, setEventIsOpen, adjustContentToRender = false, }) {
1124
+ const [innerIsOpen, setInnerIsOpen] = react.useState(false);
1125
+ react.useEffect(() => {
1126
+ setInnerIsOpen(isOpen);
1127
+ }, [isOpen]);
1128
+ const onOpenChange = react.useCallback((value) => {
1129
+ setInnerIsOpen(value);
1130
+ if (setEventIsOpen) {
1131
+ setEventIsOpen(value);
1132
+ }
1133
+ }, [setEventIsOpen]);
1134
+ const { refs, floatingStyles, context } = react$1.useFloating({
1135
+ open: innerIsOpen,
1136
+ onOpenChange,
1137
+ middleware: [
1138
+ react$1.offset(0),
1139
+ react$1.flip({ fallbackAxisSideDirection: 'none' }),
1140
+ react$1.shift(),
1141
+ ],
1142
+ whileElementsMounted: react$1.autoUpdate,
1143
+ });
1144
+ const click = react$1.useClick(context);
1145
+ const dismiss = react$1.useDismiss(context);
1146
+ const role = react$1.useRole(context);
1147
+ const { getReferenceProps, getFloatingProps } = react$1.useInteractions([
1148
+ click,
1149
+ dismiss,
1150
+ role,
1151
+ ]);
1152
+ const headingId = react$1.useId();
1153
+ return (jsxRuntime.jsxs("div", { className: "d-popover", children: [jsxRuntime.jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(innerIsOpen) })), innerIsOpen && (jsxRuntime.jsx(react$1.FloatingFocusManager, { context: context, modal: false, children: jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]('d-popover-content', {
1154
+ 'w-100': adjustContentToRender,
1155
+ }), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] }));
1156
+ }
1157
+
1158
+ function DProgress({ currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, }) {
1159
+ const formatProgress = react.useMemo(() => `${currentValue}%`, [currentValue]);
1160
+ const generateClasses = react.useMemo(() => ({
1161
+ 'progress-bar': true,
1162
+ 'progress-bar-striped progress-bar-animated': enableStripedAnimation,
1163
+ }), [enableStripedAnimation]);
1164
+ return (jsxRuntime.jsx("div", { className: "progress", children: jsxRuntime.jsx("div", { className: classNames__default["default"](generateClasses), role: "progressbar", "aria-label": "Progress bar", style: { width: `${currentValue}%` }, "aria-valuenow": currentValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, children: !hideCurrentValue && formatProgress }) }));
1165
+ }
1166
+
1167
+ function DQuickActionButton({ line1, line2, actionLinkText, actionLinkTheme = 'secondary', actionIcon, secondaryActionIcon, actionIconFamilyClass, actionIconFamilyPrefix, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, onClickSecondary, style, }) {
1168
+ const globalClickHandler = react.useCallback(() => {
1169
+ if (actionLinkText) {
1170
+ return;
1171
+ }
1172
+ onClick === null || onClick === void 0 ? void 0 : onClick();
1173
+ }, [actionLinkText, onClick]);
1174
+ const actionLinkClickHandler = react.useCallback(() => {
1175
+ if (!actionLinkText) {
1176
+ return;
1177
+ }
1178
+ onClick === null || onClick === void 0 ? void 0 : onClick();
1179
+ }, [actionLinkText, onClick]);
1180
+ const secondaryActionLinkClickHandler = react.useCallback(() => {
1181
+ onClickSecondary === null || onClickSecondary === void 0 ? void 0 : onClickSecondary();
1182
+ }, [onClickSecondary]);
1183
+ const Tag = react.useMemo(() => (actionLinkText ? 'div' : 'button'), [actionLinkText]);
1184
+ return (jsxRuntime.jsxs(Tag, { className: "d-quick-action-button", onClick: !actionLinkText ? globalClickHandler : undefined, style: style, children: [representativeIcon && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-representative-icon", size: representativeIconHasCircle
1185
+ ? `var(--${PREFIX_BS}quick-action-button-representative-icon-size)`
1186
+ : `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsxRuntime.jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsxRuntime.jsx("div", { className: "d-quick-action-button-content", children: jsxRuntime.jsxs("div", { className: "d-quick-action-button-text", children: [jsxRuntime.jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsxRuntime.jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), secondaryActionIcon && (jsxRuntime.jsx(DButton, { className: "d-quick-action-button-secondary-action-link", type: "button", variant: "link", iconStart: secondaryActionIcon, iconStartFamilyClass: actionIconFamilyClass, iconStartFamilyPrefix: actionIconFamilyPrefix, theme: actionLinkTheme, onClick: secondaryActionLinkClickHandler, isStopPropagationEnabled: true })), actionLinkText && !actionIcon && (jsxRuntime.jsx(DButton, { className: "d-quick-action-button-action-link", type: "button", variant: "link", theme: actionLinkTheme, text: actionLinkText, onClick: actionLinkClickHandler, isStopPropagationEnabled: true })), actionIcon && !actionLinkText && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-action-icon", icon: actionIcon, size: `var(--${PREFIX_BS}quick-action-button-action-icon-size)`, familyClass: actionIconFamilyClass, familyPrefix: actionIconFamilyPrefix }))] }));
1187
+ }
1188
+
1189
+ function DQuickActionCheck({ id, name, value, line1, line2, line3, isChecked, onChange, }) {
1190
+ const changeHandler = react.useCallback((event) => {
1191
+ event.stopPropagation();
1192
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
1193
+ }, [onChange]);
1194
+ return (jsxRuntime.jsxs("label", { className: "d-quick-action-check", htmlFor: id, children: [jsxRuntime.jsx(DInputCheck, { id: id, type: "radio", name: name, value: value, isChecked: isChecked, onChange: changeHandler }), jsxRuntime.jsxs("div", { className: "d-quick-action-check-detail", children: [jsxRuntime.jsx("span", { className: "d-quick-action-check-line1", children: line1 }), jsxRuntime.jsx("span", { className: "d-quick-action-check-line2", children: line2 })] }), jsxRuntime.jsx("span", { className: "d-quick-action-check-line3", children: line3 })] }));
1195
+ }
1196
+
1197
+ function DQuickActionSelect({ id, name, value, line1, line2, isSelected = false, onChange, }) {
1198
+ const innerRef = react.useRef(null);
1199
+ const changeHandler = react.useCallback((event) => {
1200
+ event.stopPropagation();
1201
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
1202
+ }, [onChange]);
1203
+ react.useEffect(() => {
1204
+ if (innerRef.current) {
1205
+ innerRef.current.checked = isSelected;
1206
+ }
1207
+ }, [isSelected]);
1208
+ return (jsxRuntime.jsxs("label", { className: "d-quick-action-select", htmlFor: id, children: [jsxRuntime.jsx("input", { ref: innerRef, id: id, type: "radio", name: name, value: value, onChange: changeHandler }), jsxRuntime.jsx("span", { className: "d-quick-action-select-line1", children: line1 }), jsxRuntime.jsx("span", { className: "d-quick-action-select-line2", children: line2 })] }));
1209
+ }
1210
+
1211
+ function DQuickActionSwitch({ id, name, label, hint, isChecked, isDisabled, onClick, }) {
1212
+ const clickHandler = react.useCallback((event) => {
1213
+ event.stopPropagation();
1214
+ onClick === null || onClick === void 0 ? void 0 : onClick(isChecked);
1215
+ }, [isChecked, onClick]);
1216
+ return (jsxRuntime.jsxs("button", { className: "d-quick-action-switch", type: "button", onClick: clickHandler, children: [jsxRuntime.jsxs("div", { className: "d-quick-action-switch-content", children: [jsxRuntime.jsx(DInputSwitch, { id: id, name: name, isDisabled: isDisabled, isChecked: isChecked, isReadonly: true }), jsxRuntime.jsx("label", { className: "d-quick-action-switch-label", htmlFor: id, children: label })] }), jsxRuntime.jsx("div", { className: "d-quick-action-switch-hint", children: hint })] }));
1217
+ }
1218
+
1219
+ function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
1220
+ const innerBackgroundColor = react.useMemo(() => {
1221
+ if (backgroundColor) {
1222
+ return backgroundColor;
1223
+ }
1224
+ const computedStyle = getComputedStyle(document.documentElement);
1225
+ return computedStyle.getPropertyValue(`--${PREFIX_BS}secondary-100`);
1226
+ }, [backgroundColor]);
1227
+ const innerForegroundColor = react.useMemo(() => {
1228
+ if (foregroundColor) {
1229
+ return foregroundColor;
1230
+ }
1231
+ const computedStyle = getComputedStyle(document.documentElement);
1232
+ return computedStyle.getPropertyValue(`--${PREFIX_BS}gray-100`);
1233
+ }, [foregroundColor]);
1234
+ return (jsxRuntime.jsx(ContentLoader__default["default"], { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
950
1235
  }
951
1236
 
952
1237
  function DStepper$2({ options, currentStep, successIcon = 'check', isVertical = false, }) {
953
1238
  if (currentStep < 1 || currentStep > options.length) {
954
- throw new Error('Current step should be in the range from 1 to options lenght');
1239
+ throw new Error('Current step should be in the range from 1 to options length');
955
1240
  }
956
- return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]({
1241
+ return (jsxRuntime.jsx("div", { className: classNames__default["default"]({
957
1242
  'd-stepper-desktop': true,
958
1243
  'is-vertical': isVertical,
959
- }) }, { children: options.map(({ label, value }) => (jsxRuntime.jsxs("div", Object.assign({ className: "d-step" }, { children: [jsxRuntime.jsx("div", Object.assign({ className: "d-step-value" }, { children: jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]({
1244
+ }), children: options.map(({ label, value }) => (jsxRuntime.jsxs("div", { className: "d-step", children: [jsxRuntime.jsx("div", { className: "d-step-value", children: jsxRuntime.jsx("div", { className: classNames__default["default"]({
960
1245
  'd-step-icon-container': true,
961
1246
  'd-step-check': value < currentStep,
962
1247
  'd-step-current': value === currentStep,
963
- }) }, { children: value < currentStep
964
- ? (jsxRuntime.jsx(DIcon, { icon: successIcon, innerClass: "d-step-icon" }))
965
- : value })) })), jsxRuntime.jsx("div", Object.assign({ className: "d-step-label" }, { children: label }))] }), value))) })));
1248
+ }), children: value < currentStep
1249
+ ? (jsxRuntime.jsx(DIcon, { icon: successIcon, className: "d-step-icon" }))
1250
+ : value }) }), jsxRuntime.jsx("div", { className: "d-step-label", children: label })] }, value))) }));
966
1251
  }
967
1252
 
968
1253
  function DStepper$1({ options, currentStep, }) {
969
1254
  if (currentStep < 1 || currentStep > options.length) {
970
- throw new Error('Current step should be in the range from 1 to options lenght');
1255
+ throw new Error('Current step should be in the range from 1 to options length');
971
1256
  }
972
- const currentOption = React.useMemo(() => { var _a; return (_a = options[currentStep - 1]) !== null && _a !== void 0 ? _a : {}; }, [currentStep, options]);
973
- const [currentAngle, setCurrentAngle] = React.useState(0);
974
- React.useEffect(() => {
1257
+ const currentOption = react.useMemo(() => { var _a; return (_a = options[currentStep - 1]) !== null && _a !== void 0 ? _a : {}; }, [currentStep, options]);
1258
+ const [currentAngle, setCurrentAngle] = react.useState(0);
1259
+ react.useEffect(() => {
975
1260
  const targetAngle = (currentStep / options.length) * 360;
976
1261
  const animationInterval = setInterval(() => {
977
1262
  const angleDifference = targetAngle - currentAngle;
@@ -988,71 +1273,117 @@ function DStepper$1({ options, currentStep, }) {
988
1273
  clearInterval(animationInterval);
989
1274
  };
990
1275
  }, [currentAngle, currentStep, options.length]);
991
- const progressStyle = React.useMemo(() => `conic-gradient(
1276
+ const progressStyle = react.useMemo(() => `conic-gradient(
992
1277
  from 180deg,
993
- var(--${ui.PREFIX_BS}step-progress-outter-fill-background-color) ${currentAngle}deg,
994
- var(--${ui.PREFIX_BS}step-progress-outter-background-color) 0deg)`, [currentAngle]);
995
- return (jsxRuntime.jsxs("div", Object.assign({ className: "d-stepper" }, { children: [jsxRuntime.jsx("div", Object.assign({ className: "d-step-bar", style: { background: progressStyle } }, { children: jsxRuntime.jsx("p", Object.assign({ className: "d-step-number" }, { children: `${currentStep}/${options.length}` })) })), jsxRuntime.jsx("div", Object.assign({ className: "d-step-info" }, { children: Object.keys(currentOption).length > 0 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ className: "d-step-label" }, { children: currentOption.label })), jsxRuntime.jsx("div", Object.assign({ className: "d-step-description" }, { children: currentOption.description || '' }))] })) }))] })));
1278
+ var(--${PREFIX_BS}step-progress-outter-fill-background-color) ${currentAngle}deg,
1279
+ var(--${PREFIX_BS}step-progress-outter-background-color) 0deg)`, [currentAngle]);
1280
+ return (jsxRuntime.jsxs("div", { className: "d-stepper", children: [jsxRuntime.jsx("div", { className: "d-step-bar", style: { background: progressStyle }, children: jsxRuntime.jsx("p", { className: "d-step-number", children: `${currentStep}/${options.length}` }) }), jsxRuntime.jsx("div", { className: "d-step-info", children: Object.keys(currentOption).length > 0 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "d-step-label", children: currentOption.label }), jsxRuntime.jsx("div", { className: "d-step-description", children: currentOption.description || '' })] })) })] }));
996
1281
  }
997
1282
 
998
1283
  function DStepper({ options, currentStep, successIcon = 'check', isVertical = false, breakpoint = 'lg', }) {
999
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ className: `d-block d-${breakpoint}-none` }, { children: jsxRuntime.jsx(DStepper$1, { options: options, currentStep: currentStep }) })), jsxRuntime.jsx("div", Object.assign({ className: `d-none d-${breakpoint}-block` }, { children: jsxRuntime.jsx(DStepper$2, { options: options, currentStep: currentStep, successIcon: successIcon, isVertical: isVertical }) }))] }));
1000
- }
1001
-
1002
- function DFormikInputCurrency(_a) {
1003
- var { name, hint } = _a, props = tslib.__rest(_a, ["name", "hint"]);
1004
- const [field, meta, helpers] = formik.useField(name);
1005
- return (jsxRuntime.jsx(DInputCurrency, Object.assign({}, props, { name: field.name, value: field.value, onEventChange: (value) => helpers.setValue(value), onEventBlur: (value) => field.onBlur(value), isInvalid: !!meta.error, hint: (meta === null || meta === void 0 ? void 0 : meta.error) || hint })));
1006
- }
1007
-
1008
- function DCard({ className, style, children, }) {
1009
- return (jsxRuntime.jsx("div", Object.assign({ style: style, className: classNames__default["default"]('card', className) }, { children: children })));
1010
- }
1011
-
1012
- function DCardBody({ className, children, }) {
1013
- return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]('card-body', className) }, { children: children })));
1014
- }
1015
-
1016
- function DCardAccount({ className, icon, theme, name, number, balance, balanceText, onEventClick, actionText, }) {
1017
- return (jsxRuntime.jsx(DCard, Object.assign({ className: classNames__default["default"]('d-card-account', className) }, { children: jsxRuntime.jsxs(DCardBody, { children: [jsxRuntime.jsxs("div", Object.assign({ className: "d-flex gap-3 align-items-center" }, { children: [jsxRuntime.jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxRuntime.jsxs("div", Object.assign({ className: "d-block flex-grow-1" }, { children: [jsxRuntime.jsx("p", Object.assign({ className: "text-gray-700" }, { children: name })), jsxRuntime.jsx("small", Object.assign({ className: "text-gray-500" }, { children: number }))] }))] })), jsxRuntime.jsxs("div", Object.assign({ className: "d-block" }, { children: [jsxRuntime.jsx("p", Object.assign({ className: "fw-bold fs-6 text-body" }, { children: balance })), jsxRuntime.jsx("small", Object.assign({ className: "text-gray-700" }, { children: balanceText }))] })), jsxRuntime.jsx("div", Object.assign({ className: "d-flex justify-content-end" }, { children: jsxRuntime.jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onEventClick: onEventClick }) }))] }) })));
1284
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: `d-block d-${breakpoint}-none`, children: jsxRuntime.jsx(DStepper$1, { options: options, currentStep: currentStep }) }), jsxRuntime.jsx("div", { className: `d-none d-${breakpoint}-block`, children: jsxRuntime.jsx(DStepper$2, { options: options, currentStep: currentStep, successIcon: successIcon, isVertical: isVertical }) })] }));
1018
1285
  }
1019
1286
 
1020
- function DCardHeader({ className, children, }) {
1021
- return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]('card-header', className) }, { children: children })));
1287
+ const TabContext = react.createContext(undefined);
1288
+ function DTabs({ children, defaultSelected, onChange, options, className, isVertical, }) {
1289
+ const [selected, setSelected] = react.useState(defaultSelected);
1290
+ const onSelect = react.useCallback((option) => {
1291
+ if (option.tab) {
1292
+ setSelected(option.tab);
1293
+ }
1294
+ onChange(option);
1295
+ }, [onChange]);
1296
+ react.useEffect(() => {
1297
+ setSelected(defaultSelected);
1298
+ }, [defaultSelected]);
1299
+ const isSelected = react.useCallback((tab) => (selected === tab), [selected]);
1300
+ const value = react.useMemo(() => ({
1301
+ isSelected,
1302
+ }), [isSelected]);
1303
+ return (jsxRuntime.jsx(TabContext.Provider, { value: value, children: jsxRuntime.jsxs("div", { className: classNames__default["default"]({
1304
+ 'd-tabs': true,
1305
+ 'd-tabs-vertical': isVertical,
1306
+ }), children: [jsxRuntime.jsx("nav", { className: "nav", children: options.map((option) => (jsxRuntime.jsx("button", { id: `${option.tab}Tab`, className: classNames__default["default"]('nav-link', {
1307
+ active: option.tab === selected,
1308
+ }, className), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.isDisabled, onClick: () => onSelect(option), children: option.label }, option.label))) }), jsxRuntime.jsx("div", { className: "tab-content", children: children })] }) }));
1022
1309
  }
1023
-
1024
- function DCardFooter({ className, children, }) {
1025
- return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]('card-footer', className) }, { children: children })));
1310
+ function useTabContext() {
1311
+ const context = react.useContext(TabContext);
1312
+ if (context === undefined) {
1313
+ throw new Error('useTabContext was used outside of MTab');
1314
+ }
1315
+ return context;
1026
1316
  }
1027
1317
 
1028
- function DCollapseIconText({ children, icon, iconSize = '1.5rem', iconTheme = 'primary', title, iconFamilyClass, iconFamilyPrefix, }) {
1029
- return (jsxRuntime.jsx(DCollapse, Object.assign({ defaultCollapsed: true, className: "d-collapse-icon-text", Component: (jsxRuntime.jsxs("div", Object.assign({ className: "d-collapse-icon-text-header" }, { children: [jsxRuntime.jsx(DIcon, { icon: icon, size: iconSize, theme: iconTheme, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, hasCircle: true }), jsxRuntime.jsx("span", Object.assign({ className: "d-collapse-icon-text-title" }, { children: title }))] }))) }, { children: children })));
1318
+ function DTabContent({ tab, children }) {
1319
+ const { isSelected } = useTabContext();
1320
+ if (!isSelected(tab)) {
1321
+ return null;
1322
+ }
1323
+ return (jsxRuntime.jsx("div", { className: "tab-pane fade show active", id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab`, children: children }));
1030
1324
  }
1031
1325
 
1032
- function DPaginator(_a) {
1033
- var { className, nextLabel, previousLabel, showArrows = true, page, onEventPageChange } = _a, props = tslib.__rest(_a, ["className", "nextLabel", "previousLabel", "showArrows", "page", "onEventPageChange"]);
1034
- return (jsxRuntime.jsx(ResponsivePagination__default["default"], Object.assign({ extraClassName: classNames__default["default"]('pagination', className), nextClassName: classNames__default["default"]('arrow arrow-next', !nextLabel && 'no-label'), nextLabel: nextLabel, previousClassName: classNames__default["default"]('arrow arrow-prev', !previousLabel && 'no-label'), previousLabel: previousLabel, renderNav: showArrows, current: page, onPageChange: onEventPageChange }, props)));
1326
+ const TOOLTIP_FONT_SIZE_BY_SIZE = {
1327
+ sm: `var(--${PREFIX_BS}ref-fs-small)`,
1328
+ default: `var(--${PREFIX_BS}body-font-size)`,
1329
+ lg: `var(--${PREFIX_BS}ref-fs-6)`,
1330
+ };
1331
+ const ARROW_WIDTH = 8;
1332
+ const ARROW_HEIGHT = 4;
1333
+ const GAP = 2;
1334
+ function DTooltip({ classNameContainer, className, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, isOpen = false, placement = 'top', size, Component, children, }) {
1335
+ const [open, setOpen] = react.useState(isOpen);
1336
+ const styleVariables = react.useMemo(() => {
1337
+ const defaultFontSize = size
1338
+ ? TOOLTIP_FONT_SIZE_BY_SIZE[size]
1339
+ : TOOLTIP_FONT_SIZE_BY_SIZE.default;
1340
+ return {
1341
+ background: `var(--${PREFIX_BS}tooltip-bg, var(--${PREFIX_BS}tooltip-component-bg, var(--${PREFIX_BS}secondary)))`,
1342
+ borderRadius: `var(--${PREFIX_BS}tooltip-border-radius, var(--${PREFIX_BS}tooltip-component-border-radius, var(--${PREFIX_BS}border-radius)))`,
1343
+ color: `var(--${PREFIX_BS}tooltip-color, var(--${PREFIX_BS}tooltip-component-color, var(--${PREFIX_BS}white)))`,
1344
+ fontSize: `var(--${PREFIX_BS}tooltip-font-size, var(--${PREFIX_BS}tooltip-component-font-size, ${defaultFontSize}))`,
1345
+ padding: `var(--${PREFIX_BS}tooltip-padding, var(--${PREFIX_BS}tooltip-component-padding, var(--${PREFIX_BS}ref-spacer-2)))`,
1346
+ maxWidth: `var(--${PREFIX_BS}tooltip-max-width, var(--${PREFIX_BS}tooltip-component-max-width, 300px))`,
1347
+ };
1348
+ }, [size]);
1349
+ const arrowRef = react.useRef(null);
1350
+ const { refs, context, floatingStyles, } = react$1.useFloating({
1351
+ open,
1352
+ onOpenChange: setOpen,
1353
+ placement,
1354
+ whileElementsMounted: react$1.autoUpdate,
1355
+ middleware: [
1356
+ react$1.offset(offSet),
1357
+ react$1.flip(),
1358
+ react$1.shift({
1359
+ padding,
1360
+ }),
1361
+ react$1.arrow({
1362
+ element: arrowRef,
1363
+ }),
1364
+ ],
1365
+ });
1366
+ const hover = react$1.useHover(context, { move: false });
1367
+ const focus = react$1.useFocus(context);
1368
+ const dismiss = react$1.useDismiss(context);
1369
+ const click = react$1.useClick(context);
1370
+ const role = react$1.useRole(context, { role: 'tooltip' });
1371
+ const { getReferenceProps, getFloatingProps } = react$1.useInteractions([
1372
+ withHover ? hover : undefined,
1373
+ withClick ? click : undefined,
1374
+ withFocus ? focus : undefined,
1375
+ dismiss,
1376
+ role,
1377
+ ]);
1378
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ className: className, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsxRuntime.jsx(react$1.FloatingPortal, { children: open && (jsxRuntime.jsxs("div", Object.assign({ className: classNameContainer, ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), styleVariables) }, getFloatingProps(), { children: [jsxRuntime.jsx(react$1.FloatingArrow, { ref: arrowRef, context: context, style: {
1379
+ fill: styleVariables.background,
1380
+ }, width: ARROW_WIDTH, height: ARROW_HEIGHT }), children] }))) })] }));
1035
1381
  }
1036
1382
 
1037
- const LANG = ui.liquidParser.parse('{{site.language}}');
1038
- async function configureI8n(resources, _a = {}) {
1039
- var { lng = LANG, fallbackLng = 'es' } = _a, config = tslib.__rest(_a, ["lng", "fallbackLng"]);
1040
- return i18n__default["default"]
1041
- .use(reactI18next.initReactI18next)
1042
- .init(Object.assign({ resources,
1043
- lng, initImmediate: true, fallbackLng, interpolation: {
1044
- escapeValue: false,
1045
- prefix: '{',
1046
- suffix: '}',
1047
- // skipOnVariables: false,
1048
- } }, config))
1049
- .then((t) => t);
1383
+ function DToastContainer({ style, position = 'top-right', }) {
1384
+ return (jsxRuntime.jsx(reactToastify.ToastContainer, { toastClassName: () => 'shadow-none p-0 cursor-default', position: position, autoClose: false, hideProgressBar: true, closeOnClick: false, closeButton: false, transition: reactToastify.Slide, style: style }));
1050
1385
  }
1051
1386
 
1052
- Object.defineProperty(exports, 'liquidParser', {
1053
- enumerable: true,
1054
- get: function () { return ui.liquidParser; }
1055
- });
1056
1387
  exports.DAlert = DAlert;
1057
1388
  exports.DBadge = DBadge;
1058
1389
  exports.DBoxFile = DBoxFile;
@@ -1073,7 +1404,7 @@ exports.DFormikInput = DFormikInput;
1073
1404
  exports.DFormikInputCurrency = DFormikInputCurrency;
1074
1405
  exports.DFormikInputSelect = DFormikInputSelect;
1075
1406
  exports.DIcon = DIcon;
1076
- exports.DInput = DInput;
1407
+ exports.DInput = DInput$1;
1077
1408
  exports.DInputCheck = DInputCheck;
1078
1409
  exports.DInputCounter = DInputCounter;
1079
1410
  exports.DInputCurrency = DInputCurrency;
@@ -1087,8 +1418,15 @@ exports.DList = DList;
1087
1418
  exports.DListItem = DListItem;
1088
1419
  exports.DListItemMovement = DListItemMovement;
1089
1420
  exports.DModal = DModal;
1421
+ exports.DModalBody = DModalBody;
1422
+ exports.DModalFooter = DModalFooter;
1423
+ exports.DModalHeader = DModalHeader;
1090
1424
  exports.DOffcanvas = DOffcanvas;
1425
+ exports.DOffcanvasBody = DOffcanvasBody;
1426
+ exports.DOffcanvasFooter = DOffcanvasFooter;
1427
+ exports.DOffcanvasHeader = DOffcanvasHeader;
1091
1428
  exports.DPaginator = DPaginator;
1429
+ exports.DPermissionGroup = DPermissionGroup;
1092
1430
  exports.DPermissionItem = DPermissionItem;
1093
1431
  exports.DPopover = DPopover;
1094
1432
  exports.DProgress = DProgress;
@@ -1100,19 +1438,20 @@ exports.DSkeleton = DSkeleton;
1100
1438
  exports.DStepper = DStepper;
1101
1439
  exports.DStepperDesktop = DStepper$2;
1102
1440
  exports.DStepperMobile = DStepper$1;
1441
+ exports.DSummaryCard = DSummaryCard;
1103
1442
  exports.DTabContent = DTabContent;
1104
1443
  exports.DTabs = DTabs;
1105
1444
  exports.DToastContainer = DToastContainer;
1106
1445
  exports.DTooltip = DTooltip;
1107
1446
  exports.LiquidContext = LiquidContext$1;
1108
1447
  exports.LiquidContextProvider = LiquidContextProvider;
1109
- exports.MPermissionGroup = MPermissionGroup;
1110
- exports.MSummaryCard = MSummaryCard;
1111
1448
  exports.ModalContext = ModalContext;
1112
1449
  exports.ModalContextProvider = ModalContextProvider;
1113
1450
  exports.OffcanvasContext = OffcanvasContext;
1114
1451
  exports.OffcanvasContextProvider = OffcanvasContextProvider;
1115
1452
  exports.configureI18n = configureI8n;
1453
+ exports.formatCurrency = formatCurrency;
1454
+ exports.liquidParser = liquidParser;
1116
1455
  exports.useFormatCurrency = useFormatCurrency;
1117
1456
  exports.useLiquidContext = useLiquidContext;
1118
1457
  exports.useModalContext = useModalContext;