@dynamic-framework/ui-react 1.7.2 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/css/dynamic-ui-non-root.css +17060 -0
  2. package/dist/css/dynamic-ui-non-root.min.css +1 -0
  3. package/dist/css/{dynamic-root.css → dynamic-ui-root.css} +5 -0
  4. package/dist/css/{dynamic-root.min.css → dynamic-ui-root.min.css} +1 -1
  5. package/dist/css/dynamic-ui.css +132 -60
  6. package/dist/css/dynamic-ui.min.css +1 -1
  7. package/dist/index.esm.js +414 -551
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +572 -725
  10. package/dist/index.js.map +1 -1
  11. package/dist/types/components/{DAlert.d.ts → DAlert/DAlert.d.ts} +3 -5
  12. package/dist/types/components/DAlert/index.d.ts +2 -0
  13. package/dist/types/components/{DBadge.d.ts → DBadge/DBadge.d.ts} +2 -4
  14. package/dist/types/components/DBadge/index.d.ts +2 -0
  15. package/dist/types/components/DBoxFile/DBoxFile.d.ts +9 -0
  16. package/dist/types/components/DBoxFile/index.d.ts +2 -0
  17. package/dist/types/components/{DButton.d.ts → DButton/DButton.d.ts} +3 -5
  18. package/dist/types/components/DButton/index.d.ts +2 -0
  19. package/dist/types/components/DCard/DCard.d.ts +13 -0
  20. package/dist/types/components/DCard/components/DCardBody.d.ts +5 -0
  21. package/dist/types/components/DCard/components/DCardFooter.d.ts +5 -0
  22. package/dist/types/components/DCard/components/DCardHeader.d.ts +5 -0
  23. package/dist/types/components/DCard/index.d.ts +5 -0
  24. package/dist/types/components/DCardAccount/DCardAccount.d.ts +13 -0
  25. package/dist/types/components/DCardAccount/index.d.ts +2 -0
  26. package/dist/types/components/DCarousel/DCarousel.d.ts +10 -0
  27. package/dist/types/components/DCarousel/index.d.ts +3 -0
  28. package/dist/types/components/DChip/DChip.d.ts +10 -0
  29. package/dist/types/components/DChip/index.d.ts +2 -0
  30. package/dist/types/components/DCollapse/DCollapse.d.ts +11 -0
  31. package/dist/types/components/DCollapse/index.d.ts +2 -0
  32. package/dist/types/components/{DCollapseIconText.d.ts → DCollapseIconText/DCollapseIconText.d.ts} +3 -3
  33. package/dist/types/components/DCollapseIconText/index.d.ts +2 -0
  34. package/dist/types/components/DCurrencyText/DCurrencyText.d.ts +7 -0
  35. package/dist/types/components/DCurrencyText/index.d.ts +2 -0
  36. package/dist/types/components/DDatePicker/DDatePicker.d.ts +21 -0
  37. package/dist/types/components/DDatePicker/index.d.ts +2 -0
  38. package/dist/types/components/{DDatePickerHeader.d.ts → DDatePickerHeader/DDatePickerHeader.d.ts} +5 -4
  39. package/dist/types/components/DDatePickerHeader/index.d.ts +2 -0
  40. package/dist/types/components/{DDatePickerInput.d.ts → DDatePickerInput/DDatePickerInput.d.ts} +3 -2
  41. package/dist/types/components/DDatePickerInput/index.d.ts +2 -0
  42. package/dist/types/components/DDatePickerTime/DDatePickerTime.d.ts +9 -0
  43. package/dist/types/components/DDatePickerTime/index.d.ts +2 -0
  44. package/dist/types/components/DIcon/DIcon.d.ts +16 -0
  45. package/dist/types/components/DIcon/index.d.ts +2 -0
  46. package/dist/types/components/DInput/DInput.d.ts +15 -0
  47. package/dist/types/components/DInput/index.d.ts +2 -0
  48. package/dist/types/components/{DInputCheck.d.ts → DInputCheck/DInputCheck.d.ts} +3 -3
  49. package/dist/types/components/DInputCheck/index.d.ts +2 -0
  50. package/dist/types/components/DInputCounter/DInputCounter.d.ts +20 -0
  51. package/dist/types/components/DInputCounter/index.d.ts +2 -0
  52. package/dist/types/components/DInputCurrency/DInputCurrency.d.ts +21 -0
  53. package/dist/types/components/DInputCurrency/index.d.ts +2 -0
  54. package/dist/types/components/DInputCurrencyBase/DInputCurrencyBase.d.ts +23 -0
  55. package/dist/types/components/DInputCurrencyBase/index.d.ts +2 -0
  56. package/dist/types/components/DInputPassword/DInputPassword.d.ts +5 -0
  57. package/dist/types/components/DInputPassword/index.d.ts +2 -0
  58. package/dist/types/components/{DInputPin.d.ts → DInputPin/DInputPin.d.ts} +3 -3
  59. package/dist/types/components/DInputPin/index.d.ts +2 -0
  60. package/dist/types/components/DInputSearch/DInputSearch.d.ts +17 -0
  61. package/dist/types/components/DInputSearch/index.d.ts +2 -0
  62. package/dist/types/components/{DInputSelect.d.ts → DInputSelect/DInputSelect.d.ts} +3 -4
  63. package/dist/types/components/DInputSelect/index.d.ts +3 -0
  64. package/dist/types/components/{DInputSwitch.d.ts → DInputSwitch/DInputSwitch.d.ts} +4 -3
  65. package/dist/types/components/DInputSwitch/index.d.ts +2 -0
  66. package/dist/types/components/DList/DList.d.ts +14 -0
  67. package/dist/types/components/DList/components/DListItem.d.ts +10 -0
  68. package/dist/types/components/DList/index.d.ts +3 -0
  69. package/dist/types/components/DListItemMovement/DListItemMovement.d.ts +10 -0
  70. package/dist/types/components/DListItemMovement/index.d.ts +2 -0
  71. package/dist/types/components/DModal/DModal.d.ts +21 -0
  72. package/dist/types/components/DModal/components/DModalBody.d.ts +7 -0
  73. package/dist/types/components/DModal/components/DModalFooter.d.ts +7 -0
  74. package/dist/types/components/{DModalHeader.d.ts → DModal/components/DModalHeader.d.ts} +3 -2
  75. package/dist/types/components/DModal/index.d.ts +5 -0
  76. package/dist/types/components/DMonthPicker/DMonthPicker.d.ts +9 -0
  77. package/dist/types/components/DMonthPicker/index.d.ts +2 -0
  78. package/dist/types/components/DOffcanvas/DOffcanvas.d.ts +18 -0
  79. package/dist/types/components/DOffcanvas/components/DOffcanvasBody.d.ts +7 -0
  80. package/dist/types/components/{DOffcanvasFooter.d.ts → DOffcanvas/components/DOffcanvasFooter.d.ts} +3 -2
  81. package/dist/types/components/{DOffcanvasHeader.d.ts → DOffcanvas/components/DOffcanvasHeader.d.ts} +3 -2
  82. package/dist/types/components/DOffcanvas/index.d.ts +5 -0
  83. package/dist/types/components/DPaginator/index.d.ts +2 -0
  84. package/dist/types/components/{DPopover.d.ts → DPopover/DPopover.d.ts} +3 -2
  85. package/dist/types/components/DPopover/index.d.ts +2 -0
  86. package/dist/types/components/DProgress/DProgress.d.ts +10 -0
  87. package/dist/types/components/DProgress/index.d.ts +2 -0
  88. package/dist/types/components/{DQuickActionButton.d.ts → DQuickActionButton/DQuickActionButton.d.ts} +2 -4
  89. package/dist/types/components/DQuickActionButton/index.d.ts +2 -0
  90. package/dist/types/components/{DQuickActionCheck.d.ts → DQuickActionCheck/DQuickActionCheck.d.ts} +3 -3
  91. package/dist/types/components/DQuickActionCheck/index.d.ts +2 -0
  92. package/dist/types/components/{DQuickActionSelect.d.ts → DQuickActionSelect/DQuickActionSelect.d.ts} +3 -3
  93. package/dist/types/components/DQuickActionSelect/index.d.ts +2 -0
  94. package/dist/types/components/{DQuickActionSwitch.d.ts → DQuickActionSwitch/DQuickActionSwitch.d.ts} +3 -3
  95. package/dist/types/components/DQuickActionSwitch/index.d.ts +2 -0
  96. package/dist/types/components/DSkeleton/index.d.ts +2 -0
  97. package/dist/types/components/{DStepper.d.ts → DStepper/DStepper.d.ts} +3 -3
  98. package/dist/types/components/DStepper/index.d.ts +2 -0
  99. package/dist/types/components/{DStepperDesktop.d.ts → DStepperDesktop/DStepperDesktop.d.ts} +3 -2
  100. package/dist/types/components/DStepperDesktop/index.d.ts +2 -0
  101. package/dist/types/components/DStepperMobile/DStepperMobile.d.ts +12 -0
  102. package/dist/types/components/DStepperMobile/index.d.ts +2 -0
  103. package/dist/types/components/DTabs/DTabs.d.ts +19 -0
  104. package/dist/types/components/DTabs/TabContext.d.ts +8 -0
  105. package/dist/types/components/DTabs/components/DTabContent.d.ts +7 -0
  106. package/dist/types/components/DTabs/index.d.ts +5 -0
  107. package/dist/types/components/{DToastContainer.d.ts → DToastContainer/DToastContainer.d.ts} +3 -2
  108. package/dist/types/components/DToastContainer/index.d.ts +3 -0
  109. package/dist/types/{hooks → components/DToastContainer}/useToast.d.ts +1 -1
  110. package/dist/types/components/{DTooltip.d.ts → DTooltip/DTooltip.d.ts} +3 -4
  111. package/dist/types/components/DTooltip/index.d.ts +2 -0
  112. package/dist/types/components/index.d.ts +11 -26
  113. package/dist/types/components/interface.d.ts +9 -4
  114. package/dist/types/contexts/DContext.d.ts +13 -0
  115. package/dist/types/contexts/index.d.ts +1 -1
  116. package/dist/types/hooks/index.d.ts +3 -4
  117. package/dist/types/hooks/useInputCurrency.d.ts +16 -0
  118. package/dist/types/hooks/useProvidedRefOrCreate.d.ts +16 -0
  119. package/dist/types/types/index.d.ts +1 -0
  120. package/dist/types/types/polymorphic.d.ts +37 -0
  121. package/dist/types/utils/index.d.ts +0 -1
  122. package/package.json +48 -55
  123. package/src/style/abstracts/variables/_buttons.scss +1 -1
  124. package/src/style/abstracts/variables/_forms.scss +4 -4
  125. package/src/style/abstracts/variables/_toasts.scss +1 -1
  126. package/src/style/abstracts/variables/_typography.scss +1 -1
  127. package/src/style/base/_+import.scss +0 -3
  128. package/src/style/components/_d-input.scss +10 -5
  129. package/src/style/components/_d-monthpicker.scss +8 -0
  130. package/src/style/dynamic-ui-non-root.scss +13 -0
  131. package/src/style/dynamic-ui-root.scss +5 -0
  132. package/src/style/dynamic-ui.scss +2 -0
  133. package/src/style/root/_+import.scss +2 -0
  134. package/src/style/{base → root}/_root.scss +6 -0
  135. package/dist/types/components/DBoxFile.d.ts +0 -9
  136. package/dist/types/components/DCard.d.ts +0 -7
  137. package/dist/types/components/DCardAccount.d.ts +0 -13
  138. package/dist/types/components/DCardBody.d.ts +0 -6
  139. package/dist/types/components/DCardFooter.d.ts +0 -6
  140. package/dist/types/components/DCardHeader.d.ts +0 -6
  141. package/dist/types/components/DCarousel.d.ts +0 -7
  142. package/dist/types/components/DChip.d.ts +0 -10
  143. package/dist/types/components/DCollapse.d.ts +0 -11
  144. package/dist/types/components/DCurrencyText.d.ts +0 -6
  145. package/dist/types/components/DDatePicker.d.ts +0 -20
  146. package/dist/types/components/DDatePickerTime.d.ts +0 -8
  147. package/dist/types/components/DFormikInput.d.ts +0 -7
  148. package/dist/types/components/DFormikInputCurrency.d.ts +0 -7
  149. package/dist/types/components/DFormikInputSelect.d.ts +0 -6
  150. package/dist/types/components/DIcon.d.ts +0 -16
  151. package/dist/types/components/DInput.d.ts +0 -32
  152. package/dist/types/components/DInputCounter.d.ts +0 -22
  153. package/dist/types/components/DInputCurrency.d.ts +0 -5
  154. package/dist/types/components/DInputCurrencyBase.d.ts +0 -24
  155. package/dist/types/components/DInputPassword.d.ts +0 -17
  156. package/dist/types/components/DInputSearch.d.ts +0 -19
  157. package/dist/types/components/DList.d.ts +0 -11
  158. package/dist/types/components/DListItem.d.ts +0 -10
  159. package/dist/types/components/DListItemMovement.d.ts +0 -10
  160. package/dist/types/components/DModal.d.ts +0 -14
  161. package/dist/types/components/DModalBody.d.ts +0 -6
  162. package/dist/types/components/DModalFooter.d.ts +0 -6
  163. package/dist/types/components/DMonthPicker.d.ts +0 -7
  164. package/dist/types/components/DOffcanvas.d.ts +0 -11
  165. package/dist/types/components/DOffcanvasBody.d.ts +0 -6
  166. package/dist/types/components/DProgress.d.ts +0 -9
  167. package/dist/types/components/DStepperMobile.d.ts +0 -11
  168. package/dist/types/components/DTabContent.d.ts +0 -6
  169. package/dist/types/components/DTabs.d.ts +0 -19
  170. package/dist/types/contexts/LiquidContext.d.ts +0 -14
  171. package/dist/types/hooks/useScreenshot.d.ts +0 -5
  172. package/dist/types/hooks/useScreenshotDownload.d.ts +0 -5
  173. package/dist/types/hooks/useScreenshotWebShare.d.ts +0 -5
  174. package/dist/types/stories/components/DBadge.stories.d.ts +0 -8
  175. package/dist/types/stories/components/DBoxFile.stories.d.ts +0 -6
  176. package/dist/types/stories/components/DButton.stories.d.ts +0 -35
  177. package/dist/types/stories/components/DChip.stories.d.ts +0 -9
  178. package/dist/types/stories/components/DCurrencyText.stories.d.ts +0 -6
  179. package/dist/types/stories/components/DDatePicker.stories.d.ts +0 -14
  180. package/dist/types/stories/components/DFormikInput.stories.d.ts +0 -7
  181. package/dist/types/stories/components/DFormikInputCurrency.stories.d.ts +0 -8
  182. package/dist/types/stories/components/DFormikInputSelect.stories.d.ts +0 -7
  183. package/dist/types/stories/components/DIcon.stories.d.ts +0 -7
  184. package/dist/types/stories/components/DInput.stories.d.ts +0 -11
  185. package/dist/types/stories/components/DInputCheck.stories.d.ts +0 -13
  186. package/dist/types/stories/components/DInputCounter.stories.d.ts +0 -9
  187. package/dist/types/stories/components/DInputCurrency.stories.d.ts +0 -11
  188. package/dist/types/stories/components/DInputCurrencyBase.stories.d.ts +0 -11
  189. package/dist/types/stories/components/DInputPassword.stories.d.ts +0 -10
  190. package/dist/types/stories/components/DInputPin.stories.d.ts +0 -10
  191. package/dist/types/stories/components/DInputSearch.stories.d.ts +0 -10
  192. package/dist/types/stories/components/DInputSelect.stories.d.ts +0 -14
  193. package/dist/types/stories/components/DInputSwitch.stories.d.ts +0 -11
  194. package/dist/types/stories/components/DList.stories.d.ts +0 -10
  195. package/dist/types/stories/components/DListItem.stories.d.ts +0 -9
  196. package/dist/types/stories/components/DListItemMovement.stories.d.ts +0 -7
  197. package/dist/types/stories/components/DPaginator.stories.d.ts +0 -10
  198. package/dist/types/stories/components/DProgress.stories.d.ts +0 -12
  199. package/dist/types/stories/components/DQuickActionButton.stories.d.ts +0 -10
  200. package/dist/types/stories/components/DQuickActionCheck.stories.d.ts +0 -8
  201. package/dist/types/stories/components/DQuickActionSelect.stories.d.ts +0 -8
  202. package/dist/types/stories/components/DQuickActionSwitch.stories.d.ts +0 -9
  203. package/dist/types/stories/components/DSkeleton.stories.d.ts +0 -6
  204. package/dist/types/stories/components/DStepper.stories.d.ts +0 -7
  205. package/dist/types/stories/components/DStepperDesktop.stories.d.ts +0 -7
  206. package/dist/types/stories/components/DStepperMobile.stories.d.ts +0 -6
  207. package/dist/types/stories/components/DTooltip.stories.d.ts +0 -18
  208. package/dist/types/stories/config/constants.d.ts +0 -7
  209. package/dist/types/stories/config/liquidConfig.d.ts +0 -1
  210. package/dist/types/stories/hooks/useFormatCurrency.stories.d.ts +0 -6
  211. package/dist/types/stories/hooks/useModalContext.stories.d.ts +0 -6
  212. package/dist/types/stories/hooks/useOffcanvasContext.stories.d.ts +0 -7
  213. package/dist/types/stories/hooks/useToast.stories.d.ts +0 -17
  214. package/dist/types/stories/patterns/DAlert.stories.d.ts +0 -24
  215. package/dist/types/stories/patterns/DCard.stories.d.ts +0 -10
  216. package/dist/types/stories/patterns/DCardAccount.stories.d.ts +0 -6
  217. package/dist/types/stories/patterns/DCarousel.stories.d.ts +0 -9
  218. package/dist/types/stories/patterns/DCollapse.stories.d.ts +0 -8
  219. package/dist/types/stories/patterns/DCollapseIconText.stories.d.ts +0 -6
  220. package/dist/types/stories/patterns/DModal.stories.d.ts +0 -12
  221. package/dist/types/stories/patterns/DOffcanvas.stories.d.ts +0 -12
  222. package/dist/types/stories/patterns/DPopover.stories.d.ts +0 -9
  223. package/dist/types/stories/patterns/DTabs.stories.d.ts +0 -7
  224. package/dist/types/utils/liquid-parser.d.ts +0 -20
  225. package/src/style/dynamic-root.scss +0 -6
  226. /package/dist/types/components/{DCarouselSlide.d.ts → DCarousel/components/DCarouselSlide.d.ts} +0 -0
  227. /package/dist/types/components/{DPaginator.d.ts → DPaginator/DPaginator.d.ts} +0 -0
  228. /package/dist/types/components/{DSkeleton.d.ts → DSkeleton/DSkeleton.d.ts} +0 -0
package/dist/index.esm.js CHANGED
@@ -1,20 +1,18 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { useMemo, useState, useEffect, useCallback, createContext, useContext, forwardRef, useRef, useImperativeHandle } from 'react';
2
+ import React, { useMemo, useState, useEffect, useCallback, createContext, useContext, forwardRef, useImperativeHandle, useRef } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { __rest } from 'tslib';
5
5
  import { useDropzone } from 'react-dropzone';
6
- import { Splide, SplideSlide } from '@splidejs/react-splide';
6
+ import { SplideSlide, Splide } from '@splidejs/react-splide';
7
7
  import currency from 'currency.js';
8
8
  import DatePicker from 'react-datepicker';
9
- import { DateTime } from 'luxon';
10
- import { useField } from 'formik';
9
+ import { parseISO, format, getMonth, getYear } from 'date-fns';
11
10
  import ResponsivePagination from 'react-responsive-pagination';
12
11
  import { useFloating, offset, flip, shift, autoUpdate, useClick, useDismiss, useRole, useInteractions, useId, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
13
12
  import ContentLoader from 'react-content-loader';
14
- import { toast, Slide, ToastContainer } from 'react-toastify';
13
+ import { ToastContainer, Slide, toast } from 'react-toastify';
15
14
  import i18n from 'i18next';
16
15
  import { initReactI18next } from 'react-i18next';
17
- import html2canvas from 'html2canvas';
18
16
  import { createPortal } from 'react-dom';
19
17
 
20
18
  function DBadge({ text, isDot = false, theme = 'primary', id, className, style, }) {
@@ -26,7 +24,7 @@ function DBadge({ text, isDot = false, theme = 'primary', id, className, style,
26
24
  return (jsx("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, { children: jsx("span", { children: text }) })));
27
25
  }
28
26
 
29
- function DInputSwitch({ label, id, name, isChecked, isDisabled, isReadonly, onChange, }) {
27
+ function DInputSwitch({ label, id, name, isChecked, isDisabled, isReadonly, className, style, onChange, }) {
30
28
  const [internalIsChecked, setInternalIsChecked] = useState(isChecked);
31
29
  useEffect(() => {
32
30
  setInternalIsChecked(isChecked);
@@ -36,7 +34,7 @@ function DInputSwitch({ label, id, name, isChecked, isDisabled, isReadonly, onCh
36
34
  setInternalIsChecked(value);
37
35
  onChange === null || onChange === void 0 ? void 0 : onChange(value);
38
36
  }, [onChange]);
39
- return (jsxs("div", { className: "form-check form-switch", children: [jsx("input", { id: id, name: name, onChange: isReadonly ? () => false : changeHandler, className: "form-check-input", type: "checkbox", role: "switch", checked: internalIsChecked, disabled: isDisabled }), label && (jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
37
+ return (jsxs("div", { className: "form-check form-switch", children: [jsx("input", { id: id, name: name, onChange: isReadonly ? () => false : changeHandler, className: classNames('form-check-input', className), style: style, type: "checkbox", role: "switch", checked: internalIsChecked, disabled: isDisabled }), label && (jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
40
38
  }
41
39
 
42
40
  function DPermissionItem({ permission, permissionState, onChange, onAction = () => { }, }) {
@@ -57,8 +55,8 @@ const ALERT_TYPE_ICON = {
57
55
  dark: 'info-circle',
58
56
  };
59
57
 
60
- 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-', }) {
61
- const getColorStyle = useMemo(() => {
58
+ function DIcon({ icon, theme, style, 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-', }) {
59
+ const colorStyle = useMemo(() => {
62
60
  if (color) {
63
61
  return { [`--${PREFIX_BS}component-color`]: color };
64
62
  }
@@ -67,7 +65,7 @@ function DIcon({ icon, theme, className = '', size = '1.5rem', isLoading = false
67
65
  }
68
66
  return {};
69
67
  }, [color, theme]);
70
- const getBackgroundStyle = useMemo(() => {
68
+ const backgroundStyle = useMemo(() => {
71
69
  if (backgroundColor) {
72
70
  return { [`--${PREFIX_BS}icon-component-bg-color`]: backgroundColor };
73
71
  }
@@ -79,20 +77,14 @@ function DIcon({ icon, theme, className = '', size = '1.5rem', isLoading = false
79
77
  }
80
78
  return {};
81
79
  }, [backgroundColor, hasCircle, theme]);
82
- const getCircleSizeStyle = useMemo(() => {
80
+ const circleSizeStyle = useMemo(() => {
83
81
  if (hasCircle) {
84
82
  return { [`--${PREFIX_BS}icon-component-padding`]: circleSize };
85
83
  }
86
84
  return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
87
85
  }, [circleSize, hasCircle]);
88
- const generateStyleVariables = 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]);
89
- const generateClasses = useMemo(() => ({
90
- 'd-icon': true,
91
- [className]: !!className,
92
- [familyClass]: true,
93
- [`${familyPrefix}${icon}`]: true,
94
- 'd-icon-loading': isLoading,
95
- }), [familyClass, familyPrefix, icon, className, isLoading]);
86
+ const generateStyleVariables = useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign({ [`--${PREFIX_BS}icon-component-size`]: size, [`--${PREFIX_BS}icon-component-loading-duration`]: `${loadingDuration}s` }, colorStyle), backgroundStyle), circleSizeStyle), style)), [size, loadingDuration, colorStyle, backgroundStyle, circleSizeStyle, style]);
87
+ const generateClasses = useMemo(() => (Object.assign({ 'd-icon': true, [familyClass]: true, [`${familyPrefix}${icon}`]: true, 'd-icon-loading': isLoading }, className && { [className]: true })), [familyClass, familyPrefix, icon, className, isLoading]);
96
88
  return (jsx("i", { className: classNames(generateClasses), style: generateStyleVariables }));
97
89
  }
98
90
 
@@ -115,11 +107,11 @@ function DAlert({ type = 'light', icon, iconFamilyClass, iconFamilyPrefix, showI
115
107
  }
116
108
 
117
109
  function DBoxFile(_a) {
118
- var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, isDisabled = false, children } = _a, dropzoneOptions = __rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "isDisabled", "children"]);
110
+ var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, isDisabled = false, children, className, style } = _a, dropzoneOptions = __rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "isDisabled", "children", "className", "style"]);
119
111
  const { acceptedFiles, getRootProps, getInputProps, } = useDropzone(Object.assign({ disabled: isDisabled }, dropzoneOptions));
120
112
  return (jsxs("section", { className: classNames('d-box-file', {
121
113
  'd-box-file-selected': !!acceptedFiles.length,
122
- }), children: [jsxs("div", Object.assign({}, getRootProps({
114
+ }, className), style: style, children: [jsxs("div", Object.assign({}, getRootProps({
123
115
  className: classNames('d-box-file-dropzone', {
124
116
  disabled: isDisabled,
125
117
  }),
@@ -152,29 +144,39 @@ function DButton({ theme = 'primary', size, variant, state, text = '', iconStart
152
144
  return (jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: generateStyleVariables, type: type, disabled: state === 'disabled' || isLoading || isDisabled }, value && { value }, { onClick: clickHandler, children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })), (text && !isLoading) && (jsx("span", { children: text })), isLoading && (jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) })), iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix }))] })));
153
145
  }
154
146
 
155
- function DCard({ className, style, children, }) {
156
- return (jsx("div", { style: style, className: classNames('card', className), children: children }));
147
+ function DCardHeader({ className, style, children, }) {
148
+ return (jsx("div", { className: classNames('card-header', className), style: style, children: children }));
157
149
  }
158
150
 
159
- function DCardBody({ className, children, }) {
160
- return (jsx("div", { className: classNames('card-body', className), children: children }));
151
+ function DCardBody({ className, style, children, }) {
152
+ return (jsx("div", { className: classNames('card-body', className), style: style, children: children }));
161
153
  }
162
154
 
163
- function DCardFooter({ className, children, }) {
164
- return (jsx("div", { className: classNames('card-footer', className), children: children }));
155
+ function DCardFooter({ className, style, children, }) {
156
+ return (jsx("div", { className: classNames('card-footer', className), style: style, children: children }));
157
+ }
158
+
159
+ function DCard({ className, style, children, }) {
160
+ return (jsx("div", { style: style, className: classNames('card', className), children: children }));
165
161
  }
162
+ var DCard$1 = Object.assign(DCard, {
163
+ Header: DCardHeader,
164
+ Body: DCardBody,
165
+ Footer: DCardFooter,
166
+ });
166
167
 
167
- function DCardHeader({ className, children, }) {
168
- return (jsx("div", { className: classNames('card-header', className), children: children }));
168
+ function DCardAccount({ className, style, icon, theme, name, number, balance, balanceText, onClick, actionText, }) {
169
+ return (jsx(DCard$1, { className: classNames('d-card-account', className), style: style, children: jsxs(DCard$1.Body, { children: [jsxs("div", { className: "d-flex gap-3 align-items-center", children: [jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxs("div", { className: "d-block flex-grow-1", children: [jsx("p", { className: "text-gray-700", children: name }), jsx("small", { className: "text-gray-500", children: number })] })] }), jsxs("div", { className: "d-block", children: [jsx("p", { className: "fw-bold fs-6 text-body", children: balance }), jsx("small", { className: "text-gray-700", children: balanceText })] }), jsx("div", { className: "d-flex justify-content-end", children: jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onClick: onClick }) })] }) }));
169
170
  }
170
171
 
171
- function DCardAccount({ className, icon, theme, name, number, balance, balanceText, onClick, actionText, }) {
172
- return (jsx(DCard, { className: classNames('d-card-account', className), children: jsxs(DCardBody, { children: [jsxs("div", { className: "d-flex gap-3 align-items-center", children: [jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxs("div", { className: "d-block flex-grow-1", children: [jsx("p", { className: "text-gray-700", children: name }), jsx("small", { className: "text-gray-500", children: number })] })] }), jsxs("div", { className: "d-block", children: [jsx("p", { className: "fw-bold fs-6 text-body", children: balance }), jsx("small", { className: "text-gray-700", children: balanceText })] }), jsx("div", { className: "d-flex justify-content-end", children: jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onClick: onClick }) })] }) }));
172
+ function DCarouselSlide(_a) {
173
+ var { className } = _a, props = __rest(_a, ["className"]);
174
+ return (jsx(SplideSlide, Object.assign({ className: classNames('d-carousel-slide', className) }, props)));
173
175
  }
174
176
 
175
177
  function DCarousel(_a) {
176
- var { children, className, options } = _a, props = __rest(_a, ["children", "className", "options"]);
177
- return (jsx(Splide, Object.assign({ className: classNames('d-carousel', className), options: Object.assign(Object.assign({}, options), { classes: {
178
+ var { children, className, style, options } = _a, props = __rest(_a, ["children", "className", "style", "options"]);
179
+ return (jsx(Splide, Object.assign({ className: classNames('d-carousel', className), style: style, options: Object.assign(Object.assign({}, options), { classes: {
178
180
  // Arrows
179
181
  arrows: 'splide__arrows d-carousel-arrows',
180
182
  arrow: 'splide__arrow d-carousel-arrow',
@@ -185,21 +187,19 @@ function DCarousel(_a) {
185
187
  page: 'splide__pagination__page d-carousel-pagination-page',
186
188
  } }) }, props, { children: children })));
187
189
  }
190
+ var DCarousel$1 = Object.assign(DCarousel, {
191
+ Slide: DCarouselSlide,
192
+ });
188
193
 
189
- function DCarouselSlide(_a) {
190
- var { className } = _a, props = __rest(_a, ["className"]);
191
- return (jsx(SplideSlide, Object.assign({ className: classNames('d-carousel-slide', className) }, props)));
192
- }
193
-
194
- function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, onClose, }) {
194
+ function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, className, style, onClose, }) {
195
195
  const generateClasses = useMemo(() => ({
196
196
  'd-chip': true,
197
197
  [`d-chip-${theme}`]: !!theme,
198
198
  }), [theme]);
199
- return (jsxs("span", { className: classNames(generateClasses), children: [icon && (jsx("div", { className: "d-chip-icon-container", children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), jsx("span", { children: text }), showClose && (jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, children: jsx(DIcon, { icon: "x-lg" }) }))] }));
199
+ return (jsxs("span", { className: classNames(generateClasses, className), style: style, children: [icon && (jsx("div", { className: "d-chip-icon-container", children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), jsx("span", { children: text }), showClose && (jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, children: jsx(DIcon, { icon: "x-lg" }) }))] }));
200
200
  }
201
201
 
202
- function DCollapse({ id, className, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
202
+ function DCollapse({ id, className, style, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
203
203
  const [toggle, setToggle] = useState(defaultCollapsed);
204
204
  const onChangeCollapse = () => setToggle((prev) => !prev);
205
205
  useEffect(() => {
@@ -213,94 +213,16 @@ function DCollapse({ id, className, Component, hasSeparator = false, defaultColl
213
213
  const generateStyles = useMemo(() => ({
214
214
  [`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
215
215
  }), [hasSeparator]);
216
- return (jsxs("div", { id: id, className: classNames('collapse-container', className), children: [jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsx("div", { className: "flex-grow-1", children: Component }), jsx(DIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}ref-fs-small)`, icon: toggle ? 'chevron-up' : 'chevron-down' })] }), toggle && (jsx("div", { className: classNames({
216
+ return (jsxs("div", { id: id, className: classNames('collapse-container', className), style: style, children: [jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsx("div", { className: "flex-grow-1", children: Component }), jsx(DIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}ref-fs-small)`, icon: toggle ? 'chevron-up' : 'chevron-down' })] }), toggle && (jsx("div", { className: classNames({
217
217
  'collapse-body': true,
218
218
  }), style: generateStyles, children: children }))] }));
219
219
  }
220
220
 
221
- function DCollapseIconText({ children, icon, iconSize = '1.5rem', iconTheme = 'primary', title, iconFamilyClass, iconFamilyPrefix, }) {
222
- return (jsx(DCollapse, { defaultCollapsed: true, className: "d-collapse-icon-text", Component: (jsxs("div", { className: "d-collapse-icon-text-header", children: [jsx(DIcon, { icon: icon, size: iconSize, theme: iconTheme, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, hasCircle: true }), jsx("span", { className: "d-collapse-icon-text-title", children: title })] })), children: children }));
223
- }
224
-
225
- /* eslint-disable @typescript-eslint/no-unsafe-return */
226
- /* eslint-disable @typescript-eslint/require-await */
227
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
228
- /* eslint-disable @typescript-eslint/no-unsafe-call */
229
- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
230
- /* eslint-disable @typescript-eslint/no-explicit-any */
231
- var liquidParser = {
232
- library: {},
233
- engine: undefined,
234
- init(library, Liquid) {
235
- this.library = library;
236
- if (Liquid) {
237
- // eslint-disable-next-line @typescript-eslint/no-var-requires,global-require
238
- this.engine = new Liquid.Liquid({
239
- strictFilters: true,
240
- strictVariables: true,
241
- });
242
- }
243
- },
244
- /**
245
- * Parse a liquid string
246
- * @param liquidString Target Content Space UID
247
- * @returns a usable object or string
248
- */
249
- async parseLiquidAsync(liquidString) {
250
- try {
251
- return this.engine.parseAndRender(liquidString, this.library);
252
- }
253
- catch (error) {
254
- return error.message;
255
- }
256
- },
257
- /**
258
- * Parse a liquid string
259
- * @param liquidString Target Content Space UID
260
- * @returns a usable object or string
261
- */
262
- parseLiquid(liquidString) {
263
- try {
264
- return this.engine.parseAndRenderSync(liquidString, this.library);
265
- }
266
- catch (error) {
267
- return error.message;
268
- }
269
- },
270
- parse(liquidString) {
271
- if (this.engine) {
272
- return this.parseLiquid(liquidString);
273
- }
274
- return liquidString;
275
- },
276
- async parseAsync(liquidString) {
277
- if (this.engine) {
278
- return this.parseLiquidAsync(liquidString);
279
- }
280
- return liquidString;
281
- },
282
- };
283
-
284
- function formatCurrency(amount, options) {
285
- return currency(amount, options).format();
286
- }
287
-
288
- const LANG = liquidParser.parse('{{site.language}}');
289
- async function configureI8n(resources, _a = {}) {
290
- var { lng = LANG, fallbackLng = 'es' } = _a, config = __rest(_a, ["lng", "fallbackLng"]);
291
- return i18n
292
- .use(initReactI18next)
293
- .init(Object.assign({ resources,
294
- lng, initImmediate: true, fallbackLng, interpolation: {
295
- escapeValue: false,
296
- prefix: '{',
297
- suffix: '}',
298
- // skipOnVariables: false,
299
- } }, config))
300
- .then((t) => t);
221
+ function DCollapseIconText({ children, icon, iconSize = '1.5rem', iconTheme = 'primary', title, iconFamilyClass, iconFamilyPrefix, className, style, }) {
222
+ return (jsx(DCollapse, { defaultCollapsed: true, className: classNames('d-collapse-icon-text', className), style: style, Component: (jsxs("div", { className: "d-collapse-icon-text-header", children: [jsx(DIcon, { icon: icon, size: iconSize, theme: iconTheme, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, hasCircle: true }), jsx("span", { className: "d-collapse-icon-text-title", children: title })] })), children: children }));
301
223
  }
302
224
 
303
- const LiquidContext = createContext({
225
+ const defaultState = {
304
226
  language: 'en',
305
227
  currency: {
306
228
  symbol: '$',
@@ -308,27 +230,22 @@ const LiquidContext = createContext({
308
230
  separator: ',',
309
231
  decimal: '.',
310
232
  },
311
- });
312
- function LiquidContextProvider({ children, }) {
233
+ };
234
+ const DContext = createContext(defaultState);
235
+ function DContextProvider({ language = defaultState.language, currency = defaultState.currency, children, }) {
313
236
  const value = useMemo(() => ({
314
- language: liquidParser.parse('{{site.language}}'),
315
- currency: {
316
- symbol: liquidParser.parse('{{vars.currency-symbol}}'),
317
- precision: parseInt(liquidParser.parse('{{vars.currency-precision}}'), 10),
318
- separator: liquidParser.parse('{{vars.currency-separator}}'),
319
- decimal: liquidParser.parse('{{vars.currency-decimal}}'),
320
- },
321
- }), []);
322
- return (jsx(LiquidContext.Provider, { value: value, children: children }));
237
+ language,
238
+ currency,
239
+ }), [language, currency]);
240
+ return (jsx(DContext.Provider, { value: value, children: children }));
323
241
  }
324
- function useLiquidContext() {
325
- const context = useContext(LiquidContext);
242
+ function useDContext() {
243
+ const context = useContext(DContext);
326
244
  if (context === undefined) {
327
- throw new Error('useLiquidContext was used outside of LiquidContextProvider');
245
+ throw new Error('useDContext was used outside of DContextProvider');
328
246
  }
329
247
  return context;
330
248
  }
331
- var LiquidContext$1 = LiquidContext;
332
249
 
333
250
  /**
334
251
  * useStackState inspired from rooks
@@ -549,8 +466,12 @@ function useOffcanvasContext() {
549
466
  return context;
550
467
  }
551
468
 
469
+ function formatCurrency(amount, options) {
470
+ return currency(amount, options).format();
471
+ }
472
+
552
473
  function useFormatCurrency(...args) {
553
- const { currency } = useLiquidContext();
474
+ const { currency } = useDContext();
554
475
  const format = useCallback((value) => formatCurrency(value, currency), [currency]);
555
476
  const values = (args || []).map((value) => (formatCurrency(value !== null && value !== void 0 ? value : 0, currency)));
556
477
  return {
@@ -559,166 +480,173 @@ function useFormatCurrency(...args) {
559
480
  };
560
481
  }
561
482
 
562
- function DCurrencyText({ value, className, }) {
483
+ function DCurrencyText({ value, className, style, }) {
563
484
  const { values: [valueFormatted] } = useFormatCurrency(value);
564
- return (jsx("span", { className: className, children: valueFormatted }));
485
+ return (jsx("span", { className: className, style: style, children: valueFormatted }));
565
486
  }
566
487
 
567
- 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) {
568
- const innerRef = useRef(null);
569
- const [internalValue, setInternalValue] = useState(value);
570
- useEffect(() => {
571
- setInternalValue(value);
572
- }, [value]);
573
- useImperativeHandle(ref, () => ({
574
- blur() {
575
- var _a;
576
- (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.blur();
577
- },
578
- focus() {
579
- var _a;
580
- (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
581
- },
582
- }), []);
583
- const handleInputChange = useCallback((event) => {
584
- setInternalValue(event.target.value);
585
- onChange === null || onChange === void 0 ? void 0 : onChange(event);
586
- }, [onChange]);
488
+ /* eslint-disable */
489
+ /**
490
+ * This file is originally from `@primer/react`
491
+ * The original source for this lived in the URL below.
492
+ *
493
+ * @see https://github.com/primer/react/blob/216d2a9f57b8acb0701ab4e04a23e057fc325c90/src/hooks/useProvidedRefOrCreate.ts
494
+ */
495
+ /**
496
+ * There are some situations where we only want to create a new ref if one is not provided to a component
497
+ * or hook as a prop. However, due to the `rules-of-hooks`, we cannot conditionally make a call to `React.useRef`
498
+ * only in the situations where the ref is not provided as a prop.
499
+ * This hook aims to encapsulate that logic, so the consumer doesn't need to be concerned with violating `rules-of-hooks`.
500
+ * @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
501
+ * @type TRef The type of the RefObject which should be created.
502
+ */
503
+ function useProvidedRefOrCreate(providedRef) {
504
+ const createdRef = React.useRef(null);
505
+ return providedRef !== null && providedRef !== void 0 ? providedRef : createdRef;
506
+ }
507
+
508
+ function DInput(_a, ref) {
509
+ var { id, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, readOnly = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, hint, invalid = false, valid = false, inputStart, value, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = __rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "disabled", "readOnly", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "hint", "invalid", "valid", "inputStart", "value", "onChange", "onIconStartClick", "onIconEndClick"]);
510
+ const inputRef = useProvidedRefOrCreate(ref);
511
+ const handleOnChange = useCallback(() => {
512
+ onChange === null || onChange === void 0 ? void 0 : onChange(value);
513
+ }, [onChange, value]);
514
+ const handleOnIconStartClick = useCallback(() => {
515
+ onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(value);
516
+ }, [onIconStartClick, value]);
517
+ const handleOnIconEndClick = useCallback(() => {
518
+ onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(value);
519
+ }, [onIconEndClick, value]);
587
520
  return (jsxs("div", { className: classNames({
588
521
  'd-input': true,
589
522
  className: !!className,
590
523
  }), style: style, children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { className: "d-input-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: "d-input-control", children: [jsxs("div", { className: classNames({
591
524
  'input-group': true,
592
- 'has-validation': isInvalid,
593
- disabled: isDisabled || isLoading,
594
- }), children: [!!inputStart && (jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: onIconStartClick, disabled: isDisabled || isLoading, children: iconStart && (jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsx("input", Object.assign({ ref: innerRef, id: id, name: name, type: type, className: classNames('form-control', {
595
- 'is-invalid': isInvalid,
596
- 'is-valid': isValid,
597
- }), 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) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "d-input-validation-icon", icon: isInvalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !isLoading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: onIconEndClick, disabled: isDisabled || isLoading, children: iconEnd && (jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), isLoading && (jsx("div", { className: "input-group-text d-input-icon", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
525
+ 'has-validation': invalid,
526
+ disabled: disabled || loading,
527
+ }), children: [!!inputStart && (jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, children: iconStart && (jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
528
+ 'is-invalid': invalid,
529
+ 'is-valid': valid,
530
+ }), "aria-label": label, disabled: disabled || loading, readOnly: readOnly, "aria-describedby": `${id}Add ${id}Hint`, value: value, onChange: handleOnChange }, inputProps)), ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "d-input-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, children: iconEnd && (jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsx("div", { className: "input-group-text d-input-icon", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
598
531
  }
599
532
  const ForwardedDInput = forwardRef(DInput);
600
533
  ForwardedDInput.displayName = 'DInput';
601
534
  var DInput$1 = ForwardedDInput;
602
535
 
603
536
  function DDatePickerTime(_a) {
604
- var { value, onChange, id, label } = _a, props = __rest(_a, ["value", "onChange", "id", "label"]);
605
- return (jsxs("div", { className: "d-flex align-items-center gap-2 flex-column d-datepicker-time", children: [label && (jsx("p", { className: "d-datepicker-time-label", children: label })), jsx(DInput$1, Object.assign({}, onChange && {
606
- onChange: (event) => onChange(event.target.value),
537
+ var { value, onChange, id, label, className, style } = _a, props = __rest(_a, ["value", "onChange", "id", "label", "className", "style"]);
538
+ return (jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsx("p", { className: "d-datepicker-time-label", children: label })), jsx(DInput$1, Object.assign({}, onChange && {
539
+ onChange,
607
540
  }, { type: "time", id: id, value: value }, props))] }));
608
541
  }
609
542
 
610
543
  function DDatePickerInput(_a, ref) {
611
- var { value, onClick, id, iconEnd } = _a, props = __rest(_a, ["value", "onClick", "id", "iconEnd"]);
544
+ var { value, onClick, id, iconEnd, className, style } = _a, props = __rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style"]);
612
545
  useImperativeHandle(ref, () => ({}), []);
613
- return (jsx("div", { role: "button", onClick: onClick, onKeyDown: () => { }, tabIndex: -1, children: jsx(DInput$1, Object.assign({ isReadOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd }, props)) }));
546
+ return (jsx("div", { role: "button", onClick: onClick, onKeyDown: () => { }, tabIndex: -1, children: jsx(DInput$1, Object.assign({ readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style }, props)) }));
614
547
  }
615
548
  const ForwardedDDatePickerInput = forwardRef(DDatePickerInput);
616
549
  ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
617
550
  var DDatePickerInput$1 = ForwardedDDatePickerInput;
618
551
 
619
552
  function DMonthPicker(_a) {
620
- var { onChangeDate, date } = _a, props = __rest(_a, ["onChangeDate", "date"]);
621
- const { language } = useLiquidContext();
622
- const selected = useMemo(() => DateTime.fromISO(date).toJSDate(), [date]);
623
- const locale = useMemo(() => language || 'en', [language]);
624
- const dateFormatted = useMemo(() => (DateTime.fromISO(date).setLocale(locale).toFormat('MMMM yyyy')), [date, locale]);
625
- return (jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: selected, calendarClassName: "d-month-picker", onChange: onChangeDate, customInput: (jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxs("div", { className: "d-flex align-items-center justify-content-between gap-4 fs-6 bg-dark", children: [jsx(DButton, { iconStart: "chevron-left", size: "sm", variant: "link", theme: "light", onClick: decreaseYear, isDisabled: prevYearButtonDisabled }), jsx("p", { className: "fs-6 fw-bold", children: monthDate.getFullYear() }), jsx(DButton, { iconStart: "chevron-right", size: "sm", variant: "link", theme: "light", onClick: increaseYear, isDisabled: nextYearButtonDisabled })] })) }, props)));
553
+ var { onChangeDate, date, locale, className } = _a, props = __rest(_a, ["onChangeDate", "date", "locale", "className"]);
554
+ const selected = useMemo(() => parseISO(date), [date]);
555
+ const dateFormatted = useMemo(() => (format(new Date(date), 'MMMM yyyy', { locale })), [date, locale]);
556
+ return (jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: selected, calendarClassName: classNames('d-month-picker', className), onChange: onChangeDate }, locale && { locale }, { customInput: (jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxs("div", { className: "d-flex align-items-center justify-content-between gap-4 fs-6 bg-dark", children: [jsx(DButton, { iconStart: "chevron-left", size: "sm", variant: "link", theme: "light", onClick: decreaseYear, isDisabled: prevYearButtonDisabled }), jsx("p", { className: "fs-6 fw-bold", children: monthDate.getFullYear() }), jsx(DButton, { iconStart: "chevron-right", size: "sm", variant: "link", theme: "light", onClick: increaseYear, isDisabled: nextYearButtonDisabled })] })) }, props)));
626
557
  }
627
558
 
628
- function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, decreaseMonthIcon, increaseMonthIcon, iconSize, buttonVariant, buttonTheme, }) {
629
- const { language } = useLiquidContext();
630
- const locale = useMemo(() => language || 'en', [language]);
559
+ function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, decreaseMonthIcon, increaseMonthIcon, iconSize, buttonVariant, buttonTheme, locale, style, className, }) {
631
560
  const onChangeDate = useCallback((value) => {
632
561
  if (value) {
633
- changeMonth(DateTime.fromJSDate(value).month - 1);
634
- changeYear(DateTime.fromJSDate(value).year);
562
+ changeMonth(getMonth(value));
563
+ changeYear(getYear(value));
635
564
  }
636
565
  }, [changeMonth, changeYear]);
637
- return (jsxs("div", { className: "d-flex align-items-center justify-content-between d-datepicker-header", children: [jsx(DButton, { iconStart: decreaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseMonth, isDisabled: prevMonthButtonDisabled }), jsx(DMonthPicker, Object.assign({}, !withMonthSelector && { readOnly: true }, { date: monthDate.toISOString(), onChangeDate: onChangeDate }, locale && { locale })), jsx(DButton, { iconStart: increaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, isDisabled: nextMonthButtonDisabled })] }));
566
+ return (jsxs("div", { className: classNames('d-flex align-items-center justify-content-between d-datepicker-header', className), style: style, children: [jsx(DButton, { iconStart: decreaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseMonth, isDisabled: prevMonthButtonDisabled }), jsx(DMonthPicker, Object.assign({}, !withMonthSelector && { readOnly: true }, { date: monthDate.toISOString(), onChangeDate: onChangeDate }, locale && { locale })), jsx(DButton, { iconStart: increaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, isDisabled: nextMonthButtonDisabled })] }));
638
567
  }
639
568
 
640
569
  function DDatePicker(_a) {
641
- 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 = __rest(_a, ["onChangeDate", "date", "selectsRange", "withMonthSelector", "inputLabel", "inputIcon", "inputId", "timeId", "timeLabel", "headerDecreaseMonthIcon", "headerIncreaseMonthIcon", "headerIconSize", "headerButtonVariant", "headerButtonTheme"]);
642
- const selected = useMemo(() => DateTime.fromISO(date).toJSDate(), [date]);
643
- const { language } = useLiquidContext();
644
- const locale = useMemo(() => language || 'en', [language]);
645
- const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeader, Object.assign({}, headerProps, { decreaseMonthIcon: headerDecreaseMonthIcon, increaseMonthIcon: headerIncreaseMonthIcon, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [headerButtonTheme,
570
+ var { date, selectsRange = false, withMonthSelector, inputLabel, inputIcon = 'calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, headerDecreaseMonthIcon = 'chevron-left', headerIncreaseMonthIcon = 'chevron-right', headerIconSize = 'sm', headerButtonVariant = 'link', headerButtonTheme = 'dark', locale, className, style } = _a, props = __rest(_a, ["date", "selectsRange", "withMonthSelector", "inputLabel", "inputIcon", "inputId", "timeId", "timeLabel", "headerDecreaseMonthIcon", "headerIncreaseMonthIcon", "headerIconSize", "headerButtonVariant", "headerButtonTheme", "locale", "className", "style"]);
571
+ const selected = useMemo(() => (date ? parseISO(date) : null), [date]);
572
+ const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, { decreaseMonthIcon: headerDecreaseMonthIcon, increaseMonthIcon: headerIncreaseMonthIcon, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [headerButtonTheme,
646
573
  headerButtonVariant,
647
574
  headerDecreaseMonthIcon,
648
575
  headerIconSize,
649
576
  headerIncreaseMonthIcon,
650
577
  withMonthSelector,
578
+ locale,
651
579
  ]);
652
- return (jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "m-date-picker", onChange: onChangeDate, renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: jsx(DDatePickerInput$1, { id: inputId, iconEnd: inputIcon }), customTimeInput: jsx(DDatePickerTime, { id: timeId, label: timeLabel }), selectsRange: selectsRange }, locale && { locale }, props)));
580
+ return (jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: (jsx(DDatePickerInput$1, { id: inputId, iconEnd: inputIcon, className: className, style: style })), customTimeInput: jsx(DDatePickerTime, { id: timeId, label: timeLabel }), selectsRange: selectsRange }, locale && { locale }, props)));
653
581
  }
654
582
 
655
- function DFormikInput(_a) {
656
- var { name, hint } = _a, props = __rest(_a, ["name", "hint"]);
657
- const [field, meta, helpers] = useField(name);
658
- return (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 })));
583
+ function DInputCounter(_a, ref) {
584
+ var { minValue, maxValue, value = minValue, invalid, iconStart = 'dash-square', iconEnd = 'plus-square', style, onChange } = _a, props = __rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "style", "onChange"]);
585
+ const inputRef = useProvidedRefOrCreate(ref);
586
+ const [internalIsInvalid, setInternalIsInvalid] = useState(false);
587
+ const [internalValue, setInternalValue] = useState(value);
588
+ useEffect(() => {
589
+ setInternalValue(value);
590
+ }, [value]);
591
+ useEffect(() => {
592
+ onChange === null || onChange === void 0 ? void 0 : onChange(Number(internalValue));
593
+ }, [onChange, internalValue]);
594
+ const handleOnChange = useCallback((newValue) => {
595
+ setInternalValue(Number(newValue || '0'));
596
+ }, []);
597
+ const handleOnIconStartClick = useCallback(() => {
598
+ setInternalValue((prevInternalValue) => Math.max(prevInternalValue - 1, minValue));
599
+ }, [minValue]);
600
+ const handleOnIconEndClick = useCallback(() => {
601
+ setInternalValue((prevInternalValue) => Math.min(prevInternalValue + 1, maxValue));
602
+ }, [maxValue]);
603
+ const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}input-component-form-control-text-align`]: 'center' })), [style]);
604
+ const valueString = useMemo(() => (internalValue.toString()), [internalValue]);
605
+ useEffect(() => {
606
+ setInternalIsInvalid(!(internalValue >= minValue && internalValue <= maxValue));
607
+ }, [internalValue, minValue, maxValue]);
608
+ return (jsx(DInput$1, Object.assign({ ref: inputRef, value: valueString, style: generateStyleVariables, iconStart: iconStart, iconEnd: iconEnd, invalid: internalIsInvalid || invalid, type: "number", onChange: handleOnChange, onIconStartClick: handleOnIconStartClick, onIconEndClick: handleOnIconEndClick }, props)));
659
609
  }
610
+ const ForwardedDInputCounter = forwardRef(DInputCounter);
611
+ ForwardedDInputCounter.displayName = 'DInputCounter';
612
+ var DInputCounter$1 = ForwardedDInputCounter;
660
613
 
661
- function DInputCurrencyBase(_a) {
662
- 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 = __rest(_a, ["id", "name", "label", "placeholder", "value", "isDisabled", "isReadOnly", "isLoading", "hint", "isInvalid", "isValid", "minValue", "maxValue", "currencyOptions", "currencyCode", "onChange", "onBlur", "onFocus"]);
663
- const [internalValueAsNumber, setInternalValueAsNumber] = useState(value);
664
- const [internalValueAsFormat, setInternalValueAsFormat] = useState('');
665
- const [internalType, setInternalType] = useState('text');
666
- const [internalIsInvalid, setInternalIsInvalid] = useState(false);
667
- const currencyInputRef = useRef(null);
668
- const changeHandler = useCallback((event) => {
669
- event.stopPropagation();
670
- const eventValue = event.target.value;
671
- const valueAsNumber = eventValue ? parseFloat(eventValue) : undefined;
672
- const valueAsFormat = valueAsNumber !== undefined
673
- ? currency(valueAsNumber, Object.assign(Object.assign({}, currencyOptions), { symbol: '' })).format()
674
- : '';
675
- setInternalValueAsNumber(valueAsNumber);
676
- setInternalValueAsFormat(valueAsFormat);
677
- onChange === null || onChange === void 0 ? void 0 : onChange(valueAsNumber);
678
- }, [currencyOptions, onChange]);
679
- const blurHandler = useCallback((event) => {
614
+ function useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref) {
615
+ const inputRef = useProvidedRefOrCreate(ref);
616
+ const valueFormatted = useMemo(() => {
617
+ if (value === undefined) {
618
+ return '';
619
+ }
620
+ return currency(value, Object.assign(Object.assign({}, currencyOptions), { symbol: '' })).format();
621
+ }, [currencyOptions, value]);
622
+ const [innerValue, setInnerValue] = useState(valueFormatted);
623
+ const [innerType, setInnerType] = useState('text');
624
+ const handleOnFocus = useCallback((event) => {
680
625
  event.stopPropagation();
681
- setInternalType('text');
682
- setInternalValueAsFormat(internalValueAsNumber !== undefined
683
- ? currency(internalValueAsNumber, Object.assign(Object.assign({}, currencyOptions), { symbol: '' })).format()
684
- : '');
685
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(internalValueAsNumber);
686
- }, [currencyOptions, internalValueAsNumber, onBlur]);
687
- const focusHandler = useCallback((event) => {
626
+ if (inputRef.current) {
627
+ if (event.currentTarget.value) {
628
+ const currencyValue = currency(event.currentTarget.value, Object.assign(Object.assign({}, currencyOptions), { symbol: '' }));
629
+ setInnerValue((currencyValue.intValue / 100).toString());
630
+ }
631
+ setInnerType('number');
632
+ }
633
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
634
+ }, [currencyOptions, inputRef, onFocus]);
635
+ const handleOnBlur = useCallback((event) => {
688
636
  event.stopPropagation();
689
- setInternalType('number');
690
- setInternalValueAsFormat(internalValueAsNumber !== undefined
691
- ? currency(internalValueAsNumber, Object.assign(Object.assign({}, currencyOptions), { symbol: '' })).format()
692
- : '');
693
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(internalValueAsNumber);
694
- }, [currencyOptions, internalValueAsNumber, onFocus]);
695
- const wheelHandler = useCallback((event) => {
637
+ if (inputRef.current) {
638
+ setInnerType('text');
639
+ if (event.currentTarget.value) {
640
+ setInnerValue(currency(event.currentTarget.value, Object.assign(Object.assign({}, currencyOptions), { symbol: '' })).format());
641
+ }
642
+ }
643
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
644
+ }, [currencyOptions, inputRef, onBlur]);
645
+ const handleOnWheel = useCallback((event) => {
696
646
  var _a;
697
647
  event.stopPropagation();
698
- (_a = currencyInputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
699
- }, []);
700
- const isValidValue = useCallback((internalValue) => {
701
- if (internalValue === undefined) {
702
- return true;
703
- }
704
- if (internalType === 'number') {
705
- return ((minValue === undefined || internalValue >= minValue)
706
- && (maxValue === undefined || internalValue <= maxValue));
707
- }
708
- return true;
709
- }, [internalType, maxValue, minValue]);
710
- const valueAsType = useMemo(() => {
711
- if (internalType === 'number') {
712
- return internalValueAsNumber;
713
- }
714
- return internalValueAsFormat;
715
- }, [internalType, internalValueAsFormat, internalValueAsNumber]);
716
- useEffect(() => {
717
- setInternalIsInvalid(!isValidValue(value));
718
- }, [isValidValue, value]);
719
- useEffect(() => {
720
- setInternalValueAsNumber(value);
721
- }, [value]);
648
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
649
+ }, [inputRef]);
722
650
  const generateStyleVariables = useMemo(() => ({
723
651
  [`--${PREFIX_BS}input-currency-component-symbol-color`]: `var(--${PREFIX_BS}secondary)`,
724
652
  [`--${PREFIX_BS}input-currency-symbol-color`]: `var(--${PREFIX_BS}input-currency-component-symbol-color)`,
@@ -726,66 +654,69 @@ function DInputCurrencyBase(_a) {
726
654
  const generateSymbolStyleVariables = useMemo(() => ({
727
655
  color: `var(--${PREFIX_BS}m-input-currency-symbol-color)`,
728
656
  }), []);
729
- return (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: (jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, rest)));
657
+ const handleOnChange = useCallback((newValue) => {
658
+ setInnerValue(newValue);
659
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue !== undefined ? Number(newValue) : undefined);
660
+ }, [onChange]);
661
+ useEffect(() => {
662
+ setInnerValue(valueFormatted);
663
+ }, [valueFormatted]);
664
+ return {
665
+ inputRef,
666
+ innerValue,
667
+ innerType,
668
+ handleOnFocus,
669
+ handleOnChange,
670
+ handleOnBlur,
671
+ handleOnWheel,
672
+ generateStyleVariables,
673
+ generateSymbolStyleVariables,
674
+ };
730
675
  }
731
676
 
732
- function DInputCurrency(props) {
733
- const { currency } = useLiquidContext();
734
- return (jsx(DInputCurrencyBase, Object.assign({ currencyOptions: currency }, props)));
677
+ function DInputCurrencyBase(_a, ref) {
678
+ var { value, minValue, maxValue, currencyOptions, currencyCode, invalid, onFocus, onBlur, onChange } = _a, inputProps = __rest(_a, ["value", "minValue", "maxValue", "currencyOptions", "currencyCode", "invalid", "onFocus", "onBlur", "onChange"]);
679
+ const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, handleOnWheel, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
680
+ return (jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", pattern: "^[0-9]", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, inputProps)));
735
681
  }
682
+ const ForwardedDInputCurrencyBase$1 = forwardRef(DInputCurrencyBase);
683
+ ForwardedDInputCurrencyBase$1.displayName = 'DInputCurrencyBase';
684
+ var DInputCurrencyBase$1 = ForwardedDInputCurrencyBase$1;
736
685
 
737
- function DFormikInputCurrency(_a) {
738
- var { name, hint } = _a, props = __rest(_a, ["name", "hint"]);
739
- const [field, meta, helpers] = useField(name);
740
- return (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 })));
686
+ function DInputCurrency(_a, ref) {
687
+ var { value, minValue, maxValue, currencyCode, invalid, onFocus, onBlur, onChange } = _a, props = __rest(_a, ["value", "minValue", "maxValue", "currencyCode", "invalid", "onFocus", "onBlur", "onChange"]);
688
+ const { currency: currencyOptions } = useDContext();
689
+ const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, handleOnWheel, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
690
+ return (jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", pattern: "^[0-9]", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, props)));
741
691
  }
692
+ const ForwardedDInputCurrencyBase = forwardRef(DInputCurrency);
693
+ ForwardedDInputCurrencyBase.displayName = 'DInputCurrency';
694
+ var DInputCurrency$1 = ForwardedDInputCurrencyBase;
742
695
 
743
- 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, }) {
744
- const internalValueExtractor = useCallback((option) => {
745
- if (valueExtractor) {
746
- return valueExtractor(option);
747
- }
748
- if ('value' in option) {
749
- return option === null || option === void 0 ? void 0 : option.value;
750
- }
751
- throw new Error('Must provide a valueExtractor for custom object forms');
752
- }, [valueExtractor]);
753
- const internalLabelExtractor = useCallback((option) => {
754
- if (labelExtractor) {
755
- return labelExtractor(option);
756
- }
757
- if ('label' in option) {
758
- return option === null || option === void 0 ? void 0 : option.label;
759
- }
760
- throw new Error('Must provide a labelExtractor for custom object forms');
761
- }, [labelExtractor]);
762
- const changeHandler = useCallback((event) => {
763
- const selected = options
764
- .find((option) => internalValueExtractor(option).toString() === event.currentTarget.value);
765
- onChange === null || onChange === void 0 ? void 0 : onChange(selected);
766
- }, [onChange, options, internalValueExtractor]);
767
- const blurHandler = useCallback((event) => {
768
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
769
- }, [onBlur]);
770
- const iconStartClickHandler = useCallback((event) => {
771
- onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(event);
772
- }, [onIconStartClick]);
773
- const iconEndClickHandler = useCallback((event) => {
774
- onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
775
- }, [onIconEndClick]);
776
- return (jsxs("div", { className: classNames('d-input', className), children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { className: "mdinput-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: "d-input-control", children: [jsxs("div", { className: classNames({
777
- 'input-group': true,
778
- disabled: isDisabled || isLoading,
779
- }), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: isDisabled || isLoading, children: iconStart && (jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), 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) => (jsx("option", { value: internalValueExtractor(option), children: internalLabelExtractor(option) }, internalValueExtractor(option)))) })), iconEnd && !isLoading && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: isDisabled || isLoading, children: iconEnd && (jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), isLoading && (jsx("div", { className: "input-group-text form-control-icon loading", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
696
+ function DInputSearch(_a, ref) {
697
+ var { onClick, type } = _a, props = __rest(_a, ["onClick", "type"]);
698
+ const inputRef = useProvidedRefOrCreate(ref);
699
+ return (jsx(DInput$1, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", onIconEndClick: onClick }, props)));
780
700
  }
701
+ const ForwardedDInputSearch = forwardRef(DInputSearch);
702
+ ForwardedDInputSearch.displayName = 'DInputSearch';
703
+ var DInputSearch$1 = ForwardedDInputSearch;
781
704
 
782
- function DFormikInputSelect(_a) {
783
- var { name } = _a, props = __rest(_a, ["name"]);
784
- const [field, , helpers] = useField(name);
785
- return (jsx(DInputSelect, Object.assign({}, props, { name: field.name, selectedOption: field.value, onChange: (selected) => helpers.setValue(selected), onBlur: (selected) => field.onBlur(selected) })));
705
+ function DInputPassword(_a, ref) {
706
+ var { onIconEndClick } = _a, props = __rest(_a, ["onIconEndClick"]);
707
+ const inputRef = useProvidedRefOrCreate(ref);
708
+ const [visible, setVisible] = useState(false);
709
+ const handleOnIconEndClick = useCallback(() => {
710
+ setVisible((prevVisible) => !prevVisible);
711
+ onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick();
712
+ }, [onIconEndClick]);
713
+ return (jsx(DInput$1, Object.assign({ ref: inputRef, iconEnd: !visible ? 'eye-slash' : 'eye', type: !visible ? 'password' : 'text', onIconEndClick: handleOnIconEndClick }, props)));
786
714
  }
715
+ const ForwardedDInputPassword = forwardRef(DInputPassword);
716
+ ForwardedDInputPassword.displayName = 'DInputPassword';
717
+ var DInputPassword$1 = ForwardedDInputPassword;
787
718
 
788
- function DInputCheck({ type, name, label, isChecked = false, id, isDisabled = false, isIndeterminate, value, onChange, }) {
719
+ function DInputCheck({ type, name, label, isChecked = false, id, isDisabled = false, isIndeterminate, value, onChange, className, style, }) {
789
720
  const innerRef = useRef(null);
790
721
  const handleChange = useCallback((event) => {
791
722
  onChange === null || onChange === void 0 ? void 0 : onChange(event);
@@ -801,60 +732,12 @@ function DInputCheck({ type, name, label, isChecked = false, id, isDisabled = fa
801
732
  }
802
733
  }, [isChecked]);
803
734
  if (!label) {
804
- return (jsx("input", { ref: innerRef, onChange: handleChange, className: "form-check-input", id: id, disabled: isDisabled, type: type, name: name, value: value }));
735
+ return (jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: isDisabled, type: type, name: name, value: value }));
805
736
  }
806
- return (jsxs("div", { className: "form-check", children: [jsx("input", { ref: innerRef, onChange: handleChange, className: "form-check-input", id: id, disabled: isDisabled, type: type, name: name, value: value }), jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
737
+ return (jsxs("div", { className: "form-check", children: [jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: isDisabled, type: type, name: name, value: value }), jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
807
738
  }
808
739
 
809
- function DInputCounter(_a) {
810
- 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 = __rest(_a, ["id", "name", "label", "value", "isDisabled", "isReadOnly", "isLoading", "iconStart", "iconEnd", "hint", "isInvalid", "isValid", "minValue", "maxValue", "style", "className", "onChange"]);
811
- const [internalIsInvalid, setInternalIsInvalid] = useState(false);
812
- const [internalValue, setInternalValue] = useState(value);
813
- useEffect(() => {
814
- setInternalValue(value);
815
- }, [value]);
816
- useEffect(() => {
817
- onChange === null || onChange === void 0 ? void 0 : onChange(internalValue);
818
- }, [internalValue, onChange]);
819
- const changeHandler = useCallback((event) => {
820
- event.stopPropagation();
821
- const newValue = parseInt(event.target.value || '0', 10);
822
- setInternalValue(newValue);
823
- }, []);
824
- const clickHandler = useCallback((action) => {
825
- if (action) {
826
- setInternalValue((prevInternalValue) => {
827
- const newValue = prevInternalValue + 1;
828
- return newValue <= maxValue ? newValue : maxValue;
829
- });
830
- }
831
- else {
832
- setInternalValue((prevInternalValue) => {
833
- const newValue = prevInternalValue - 1;
834
- return newValue >= minValue ? newValue : minValue;
835
- });
836
- }
837
- }, [maxValue, minValue]);
838
- const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}input-component-form-control-text-align`]: 'center' })), [style]);
839
- useEffect(() => {
840
- setInternalIsInvalid(!(internalValue >= minValue && internalValue <= maxValue));
841
- }, [internalValue, minValue, maxValue]);
842
- return (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)));
843
- }
844
-
845
- function DInputPassword(_a) {
846
- var { id, name, label = '', placeholder = '', value = '', isDisabled = false, isReadOnly = false, isLoading = false, hint, isInvalid = false, isValid = false, onChange } = _a, rest = __rest(_a, ["id", "name", "label", "placeholder", "value", "isDisabled", "isReadOnly", "isLoading", "hint", "isInvalid", "isValid", "onChange"]);
847
- const [visible, setVisible] = useState(false);
848
- const changeHandler = useCallback((event) => {
849
- onChange === null || onChange === void 0 ? void 0 : onChange(event.target.value);
850
- }, [onChange]);
851
- const visibilityHandler = useCallback(() => {
852
- setVisible((prevVisible) => !prevVisible);
853
- }, []);
854
- return (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)));
855
- }
856
-
857
- 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, }) {
740
+ 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, className, style, onChange, }) {
858
741
  const [pattern, setPattern] = useState('');
859
742
  useEffect(() => {
860
743
  setPattern(type === 'number' ? '[0-9]+' : '^[a-zA-Z0-9]+$');
@@ -903,42 +786,53 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
903
786
  const preventDefaultEvent = useCallback((event) => {
904
787
  event.preventDefault();
905
788
  }, []);
906
- return (jsxs("div", { className: "d-input-pin", children: [label && (jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsx(DIcon, { className: "d-input-pin-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("form", { id: id, className: "d-input-pin-controls", onInput: formChange, onSubmit: preventDefaultEvent, children: [Array.from({ length: characters }).map((_, index) => (jsx("input", Object.assign({ className: classNames({
789
+ return (jsxs("div", { className: classNames('d-input-pin', className), style: style, children: [label && (jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsx(DIcon, { className: "d-input-pin-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("form", { id: id, className: "d-input-pin-controls", onInput: formChange, onSubmit: preventDefaultEvent, children: [Array.from({ length: characters }).map((_, index) => (jsx("input", Object.assign({ className: classNames({
907
790
  'form-control': true,
908
791
  'is-invalid': isInvalid,
909
792
  'is-valid': isValid,
910
793
  }), 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 && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "d-input-pin-validation-icon", icon: isInvalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), isLoading && (jsx("div", { className: "input-group-text d-input-pin-icon", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
911
794
  }
912
795
 
913
- function DInputSearch(_a) {
914
- var { id, name, label, placeholder, value, isDisabled, isReadOnly, isLoading, hint, isInvalid, isValid, onChange, onClick } = _a, rest = __rest(_a, ["id", "name", "label", "placeholder", "value", "isDisabled", "isReadOnly", "isLoading", "hint", "isInvalid", "isValid", "onChange", "onClick"]);
915
- const [internalValue, setInternalValue] = useState(value);
916
- useEffect(() => {
917
- setInternalValue(value);
918
- }, [value]);
796
+ function DInputSelect({ id, name, label = '', className, style, options, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, isDisabled = false, isLoading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, hint, selectedOption, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
797
+ const internalValueExtractor = useCallback((option) => {
798
+ if (valueExtractor) {
799
+ return valueExtractor(option);
800
+ }
801
+ if ('value' in option) {
802
+ return option === null || option === void 0 ? void 0 : option.value;
803
+ }
804
+ throw new Error('Must provide a valueExtractor for custom object forms');
805
+ }, [valueExtractor]);
806
+ const internalLabelExtractor = useCallback((option) => {
807
+ if (labelExtractor) {
808
+ return labelExtractor(option);
809
+ }
810
+ if ('label' in option) {
811
+ return option === null || option === void 0 ? void 0 : option.label;
812
+ }
813
+ throw new Error('Must provide a labelExtractor for custom object forms');
814
+ }, [labelExtractor]);
919
815
  const changeHandler = useCallback((event) => {
920
- event.stopPropagation();
921
- setInternalValue(event.target.value);
922
- onChange === null || onChange === void 0 ? void 0 : onChange(event);
923
- }, [onChange]);
924
- const clickHandler = useCallback(() => {
925
- onClick === null || onClick === void 0 ? void 0 : onClick(internalValue);
926
- }, [internalValue, onClick]);
927
- return (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)));
928
- }
929
-
930
- function DList({ children, className, isFlush = false, isNumbered = false, isHorizontal = false, horizontalBreakpoint, }) {
931
- if (isFlush && isHorizontal) {
932
- throw new Error("Horizontal and Flush props don't work together");
933
- }
934
- return (jsx("div", { className: classNames('list-group', {
935
- 'list-group-flush': isFlush && !isHorizontal,
936
- 'list-group-numbered': isNumbered,
937
- 'list-group-horizontal': isHorizontal && !horizontalBreakpoint,
938
- }, (isHorizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className), children: children }));
816
+ const selected = options
817
+ .find((option) => internalValueExtractor(option).toString() === event.currentTarget.value);
818
+ onChange === null || onChange === void 0 ? void 0 : onChange(selected);
819
+ }, [onChange, options, internalValueExtractor]);
820
+ const blurHandler = useCallback((event) => {
821
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
822
+ }, [onBlur]);
823
+ const iconStartClickHandler = useCallback((event) => {
824
+ onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(event);
825
+ }, [onIconStartClick]);
826
+ const iconEndClickHandler = useCallback((event) => {
827
+ onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
828
+ }, [onIconEndClick]);
829
+ return (jsxs("div", { className: classNames('d-input', className), style: style, children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { className: "mdinput-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: "d-input-control", children: [jsxs("div", { className: classNames({
830
+ 'input-group': true,
831
+ disabled: isDisabled || isLoading,
832
+ }), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: isDisabled || isLoading, children: iconStart && (jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), 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) => (jsx("option", { value: internalValueExtractor(option), children: internalLabelExtractor(option) }, internalValueExtractor(option)))) })), iconEnd && !isLoading && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: isDisabled || isLoading, children: iconEnd && (jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), isLoading && (jsx("div", { className: "input-group-text form-control-icon loading", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
939
833
  }
940
834
 
941
- function DListItem({ children, className, isActive = false, isDisabled = false, theme, onClick, }) {
835
+ function DListItem({ children, className, style, isActive = false, isDisabled = false, theme, onClick, }) {
942
836
  const Tag = useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
943
837
  return (jsx(Tag, Object.assign({}, Tag === 'button' && {
944
838
  onClick,
@@ -946,87 +840,25 @@ function DListItem({ children, className, isActive = false, isDisabled = false,
946
840
  }, { className: classNames('list-group-item list-group-item-action', theme ? `list-group-item-${theme}` : undefined, className, {
947
841
  active: isActive,
948
842
  disabled: isDisabled,
949
- }) }, isActive && { 'aria-current': true }, { children: children })));
950
- }
951
-
952
- function useToast() {
953
- const toast$1 = useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
954
- toast(({ closeToast }) => (jsx(DAlert, { type: type, showClose: showClose, onClose: closeToast, id: "alertID", children: message })), {
955
- transition: Slide,
956
- position,
957
- autoClose,
958
- });
959
- }, []);
960
- return {
961
- toast: toast$1,
962
- };
963
- }
964
-
965
- function useScreenshot() {
966
- const clipRef = useRef(null);
967
- const takeBlob = useCallback(async (type) => {
968
- if (!clipRef.current) {
969
- throw new Error('set the clipRef');
970
- }
971
- const canvas = await html2canvas(clipRef === null || clipRef === void 0 ? void 0 : clipRef.current, {
972
- allowTaint: true,
973
- useCORS: true,
974
- });
975
- return (new Promise((resolve, reject) => {
976
- canvas.toBlob((innerBlob) => {
977
- if (!innerBlob) {
978
- return reject();
979
- }
980
- return resolve(innerBlob);
981
- }, type);
982
- }));
983
- }, []);
984
- return {
985
- clipRef,
986
- takeBlob,
987
- };
843
+ }), style: style }, isActive && { 'aria-current': true }, { children: children })));
988
844
  }
989
845
 
990
- function useScreenshotDownload() {
991
- const { clipRef, takeBlob } = useScreenshot();
992
- const download = useCallback(async () => {
993
- const blob = await takeBlob();
994
- const url = window.URL.createObjectURL(blob);
995
- const link = window.document.createElement('a');
996
- link.style.display = 'none';
997
- link.href = url;
998
- link.download = 'voucher.jpg';
999
- document.body.appendChild(link);
1000
- link.click();
1001
- document.body.removeChild(link);
1002
- window.URL.revokeObjectURL(url);
1003
- }, [takeBlob]);
1004
- return {
1005
- download,
1006
- downloadRef: clipRef,
1007
- };
1008
- }
1009
-
1010
- function useScreenshotWebShare() {
1011
- const { takeBlob, clipRef } = useScreenshot();
1012
- const share = useCallback(async () => {
1013
- const blob = await takeBlob();
1014
- const image = new File([blob], 'voucher.jpeg', { type: 'image/jpeg' });
1015
- if (!navigator.canShare
1016
- && (navigator.canShare && !navigator.canShare({ files: [image] }))) {
1017
- window.print();
1018
- return;
1019
- }
1020
- await navigator.share({ files: [image] });
1021
- }, [takeBlob]);
1022
- return {
1023
- share,
1024
- shareRef: clipRef,
1025
- };
846
+ function DList({ children, className, style, isFlush = false, isNumbered = false, isHorizontal = false, horizontalBreakpoint, }) {
847
+ if (isFlush && isHorizontal) {
848
+ throw new Error("Horizontal and Flush props don't work together");
849
+ }
850
+ return (jsx("div", { className: classNames('list-group', {
851
+ 'list-group-flush': isFlush && !isHorizontal,
852
+ 'list-group-numbered': isNumbered,
853
+ 'list-group-horizontal': isHorizontal && !horizontalBreakpoint,
854
+ }, (isHorizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className), style: style, children: children }));
1026
855
  }
856
+ var DList$1 = Object.assign(DList, {
857
+ Item: DListItem,
858
+ });
1027
859
 
1028
860
  function DListItemMovement(_a) {
1029
- var { description, date, amount, classNameMovement } = _a, props = __rest(_a, ["description", "date", "amount", "classNameMovement"]);
861
+ var { description, date, amount, className, style } = _a, props = __rest(_a, ["description", "date", "amount", "className", "style"]);
1030
862
  const { format } = useFormatCurrency();
1031
863
  const value = useMemo(() => {
1032
864
  const valueFormatted = format(amount);
@@ -1041,10 +873,22 @@ function DListItemMovement(_a) {
1041
873
  valueFormatted,
1042
874
  };
1043
875
  }, [format, amount]);
1044
- return (jsx(DListItem, Object.assign({}, props, { children: jsxs("div", { className: classNames('d-flex justify-content-between align-items-center p-3 gap-3', classNameMovement), children: [jsxs("div", { className: "d-flex flex-column gap-1", children: [jsx("span", { className: "fs-6", children: description }), jsx("span", { className: "small text-gray-700", children: date })] }), jsx("span", { className: classNames('fs-6', value.theme), children: value.valueFormatted })] }) })));
876
+ return (jsx(DListItem, Object.assign({}, props, { children: jsxs("div", { className: classNames('d-flex justify-content-between align-items-center p-3 gap-3', className), style: style, children: [jsxs("div", { className: "d-flex flex-column gap-1", children: [jsx("span", { className: "fs-6", children: description }), jsx("span", { className: "small text-gray-700", children: date })] }), jsx("span", { className: classNames('fs-6', value.theme), children: value.valueFormatted })] }) })));
877
+ }
878
+
879
+ function DModalHeader({ showCloseButton, onClose, children, className, style, }) {
880
+ return (jsxs("div", { className: classNames('modal-header', className), style: style, children: [showCloseButton && (jsx("button", { type: "button", className: "d-modal-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: "x-lg" }) })), children] }));
881
+ }
882
+
883
+ function DModalBody({ children, className, style, }) {
884
+ return (jsx("div", { className: classNames('d-modal-slot modal-body', className), style: style, children: children }));
1045
885
  }
1046
886
 
1047
- function DModal({ name, className = '', isStatic, isScrollable, isCentered, isFullScreen, fullScreenFrom, modalSize, children, }) {
887
+ function DModalFooter({ className, style, actionPlacement = 'fill', children, }) {
888
+ return (jsxs(Fragment, { children: [jsx("div", { className: "d-modal-separator" }), jsx("div", { className: classNames(`d-modal-slot modal-footer d-modal-action-${actionPlacement}`, className), style: style, children: children })] }));
889
+ }
890
+
891
+ function DModal({ name, className, style, isStatic, isScrollable, isCentered, isFullScreen, fullScreenFrom, modalSize, children, }) {
1048
892
  const fullScreenClass = useMemo(() => {
1049
893
  if (isFullScreen) {
1050
894
  if (fullScreenFrom) {
@@ -1054,33 +898,35 @@ function DModal({ name, className = '', isStatic, isScrollable, isCentered, isFu
1054
898
  }
1055
899
  return '';
1056
900
  }, [fullScreenFrom, isFullScreen]);
1057
- const generateClasses = useMemo(() => ({
1058
- 'modal fade show': true,
1059
- [`${className}`]: !!className,
1060
- }), [className]);
901
+ const generateClasses = useMemo(() => (Object.assign({ 'modal fade show': true }, className && { [className]: true })), [className]);
1061
902
  const generateModalDialogClasses = 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]);
1062
- return (jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, isStatic && ({
903
+ return (jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style }, isStatic && ({
1063
904
  [`data-${PREFIX_BS}backdrop`]: 'static',
1064
905
  [`data-${PREFIX_BS}keyboard`]: 'false',
1065
906
  }), { children: jsx("div", { className: classNames(generateModalDialogClasses), children: jsx("div", { className: "modal-content", children: children }) }) })));
1066
907
  }
908
+ var DModal$1 = Object.assign(DModal, {
909
+ Header: DModalHeader,
910
+ Body: DModalBody,
911
+ Footer: DModalFooter,
912
+ });
1067
913
 
1068
- function DModalBody({ children }) {
1069
- return (jsx("div", { className: "d-modal-slot modal-body", children: children }));
914
+ function DOffcanvasHeader({ showCloseButton, onClose, children, className, style, }) {
915
+ return (jsxs("div", { className: classNames('offcanvas-header', className), style: style, children: [jsx("div", { className: "d-offcanvas-slot", children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-offcanvas-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: "x-lg" }) }))] }));
1070
916
  }
1071
917
 
1072
- function DModalFooter({ actionPlacement = 'fill', children, }) {
1073
- return (jsxs(Fragment, { children: [jsx("div", { className: "d-modal-separator" }), jsx("div", { className: `d-modal-slot modal-footer d-modal-action-${actionPlacement}`, children: children })] }));
918
+ function DOffcanvasBody({ children, className, style, }) {
919
+ return (jsx("div", { className: classNames('d-offcanvas-slot offcanvas-body', className), style: style, children: children }));
1074
920
  }
1075
921
 
1076
- function DModalHeader({ showCloseButton, onClose, children, }) {
1077
- return (jsxs("div", { className: "modal-header", children: [showCloseButton && (jsx("button", { type: "button", className: "d-modal-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: "x-lg" }) })), children] }));
922
+ function DOffcanvasFooter({ footerActionPlacement = 'fill', children, className, style, }) {
923
+ return (jsx("div", { className: classNames(`d-offcanvas-slot d-offcanvas-footer d-offcanvas-action-${footerActionPlacement}`, className), style: style, children: children }));
1078
924
  }
1079
925
 
1080
- function DOffcanvas({ name, className, isStatic, isScrollable, openFrom = 'end', children, }) {
926
+ function DOffcanvas({ name, className, style, isStatic, isScrollable, openFrom = 'end', children, }) {
1081
927
  return (jsx("div", Object.assign({ className: classNames('offcanvas show', {
1082
928
  [`offcanvas-${openFrom}`]: openFrom,
1083
- }, className), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, isStatic && ({
929
+ }, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, isStatic && ({
1084
930
  [`data-${PREFIX_BS}backdrop`]: 'static',
1085
931
  [`data-${PREFIX_BS}keyboard`]: 'false',
1086
932
  }), isScrollable && ({
@@ -1088,25 +934,18 @@ function DOffcanvas({ name, className, isStatic, isScrollable, openFrom = 'end',
1088
934
  [`data-${PREFIX_BS}keyboard`]: 'false',
1089
935
  }), { children: children })));
1090
936
  }
1091
-
1092
- function DOffcanvasBody({ children }) {
1093
- return (jsx("div", { className: "d-offcanvas-slot offcanvas-body", children: children }));
1094
- }
1095
-
1096
- function DOffcanvasFooter({ footerActionPlacement = 'fill', children, }) {
1097
- return (jsx("div", { className: `d-offcanvas-slot d-offcanvas-footer d-offcanvas-action-${footerActionPlacement}`, children: children }));
1098
- }
1099
-
1100
- function DOffcanvasHeader({ showCloseButton, onClose, children, }) {
1101
- return (jsxs("div", { className: "offcanvas-header", children: [jsx("div", { className: "d-offcanvas-slot", children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-offcanvas-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: "x-lg" }) }))] }));
1102
- }
937
+ var DOffcanvas$1 = Object.assign(DOffcanvas, {
938
+ Header: DOffcanvasHeader,
939
+ Body: DOffcanvasBody,
940
+ Footer: DOffcanvasFooter,
941
+ });
1103
942
 
1104
943
  function DPaginator(_a) {
1105
944
  var { className, nextLabel, previousLabel, showArrows = true, page, onPageChange } = _a, props = __rest(_a, ["className", "nextLabel", "previousLabel", "showArrows", "page", "onPageChange"]);
1106
945
  return (jsx(ResponsivePagination, Object.assign({ extraClassName: classNames('pagination', className), nextClassName: classNames('arrow arrow-next', !nextLabel && 'no-label'), nextLabel: nextLabel, previousClassName: classNames('arrow arrow-prev', !previousLabel && 'no-label'), previousLabel: previousLabel, renderNav: showArrows, current: page, onPageChange: onPageChange }, props)));
1107
946
  }
1108
947
 
1109
- function DPopover({ children, renderComponent, isOpen, setEventIsOpen, adjustContentToRender = false, }) {
948
+ function DPopover({ children, renderComponent, isOpen, setEventIsOpen, adjustContentToRender = false, className, style, }) {
1110
949
  const [innerIsOpen, setInnerIsOpen] = useState(false);
1111
950
  useEffect(() => {
1112
951
  setInnerIsOpen(isOpen);
@@ -1136,18 +975,18 @@ function DPopover({ children, renderComponent, isOpen, setEventIsOpen, adjustCon
1136
975
  role,
1137
976
  ]);
1138
977
  const headingId = useId();
1139
- return (jsxs("div", { className: "d-popover", children: [jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(innerIsOpen) })), innerIsOpen && (jsx(FloatingFocusManager, { context: context, modal: false, children: jsx("div", Object.assign({ className: classNames('d-popover-content', {
978
+ return (jsxs("div", { className: classNames('d-popover', className), style: style, children: [jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(innerIsOpen) })), innerIsOpen && (jsx(FloatingFocusManager, { context: context, modal: false, children: jsx("div", Object.assign({ className: classNames('d-popover-content', {
1140
979
  'w-100': adjustContentToRender,
1141
980
  }), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] }));
1142
981
  }
1143
982
 
1144
- function DProgress({ currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, }) {
983
+ function DProgress({ className, style, currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, }) {
1145
984
  const formatProgress = useMemo(() => `${currentValue}%`, [currentValue]);
1146
985
  const generateClasses = useMemo(() => ({
1147
986
  'progress-bar': true,
1148
987
  'progress-bar-striped progress-bar-animated': enableStripedAnimation,
1149
988
  }), [enableStripedAnimation]);
1150
- return (jsx("div", { className: "progress", children: jsx("div", { className: classNames(generateClasses), role: "progressbar", "aria-label": "Progress bar", style: { width: `${currentValue}%` }, "aria-valuenow": currentValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, children: !hideCurrentValue && formatProgress }) }));
989
+ return (jsx("div", { className: "progress", children: jsx("div", { className: classNames(generateClasses, className), role: "progressbar", "aria-label": "Progress bar", style: Object.assign({ width: `${currentValue}%` }, style), "aria-valuenow": currentValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, children: !hideCurrentValue && formatProgress }) }));
1151
990
  }
1152
991
 
1153
992
  function DQuickActionButton({ line1, line2, className, actionLinkText, actionLinkTheme = 'secondary', actionIcon, secondaryActionIcon, actionIconFamilyClass, actionIconFamilyPrefix, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, onClickSecondary, style, }) {
@@ -1172,15 +1011,15 @@ function DQuickActionButton({ line1, line2, className, actionLinkText, actionLin
1172
1011
  : `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsx("div", { className: "d-quick-action-button-content", children: jsxs("div", { className: "d-quick-action-button-text", children: [jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), secondaryActionIcon && (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 && (jsx(DButton, { className: "d-quick-action-button-action-link", type: "button", variant: "link", theme: actionLinkTheme, text: actionLinkText, onClick: actionLinkClickHandler, isStopPropagationEnabled: true })), actionIcon && !actionLinkText && (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 }))] }));
1173
1012
  }
1174
1013
 
1175
- function DQuickActionCheck({ id, name, value, line1, line2, line3, className, isChecked, onChange, }) {
1014
+ function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style, isChecked, onChange, }) {
1176
1015
  const changeHandler = useCallback((event) => {
1177
1016
  event.stopPropagation();
1178
1017
  onChange === null || onChange === void 0 ? void 0 : onChange(event);
1179
1018
  }, [onChange]);
1180
- return (jsxs("label", { className: classNames('d-quick-action-check', className), htmlFor: id, children: [jsx(DInputCheck, { id: id, type: "radio", name: name, value: value, isChecked: isChecked, onChange: changeHandler }), jsxs("div", { className: "d-quick-action-check-detail", children: [jsx("span", { className: "d-quick-action-check-line1", children: line1 }), jsx("span", { className: "d-quick-action-check-line2", children: line2 })] }), jsx("span", { className: "d-quick-action-check-line3", children: line3 })] }));
1019
+ return (jsxs("label", { className: classNames('d-quick-action-check', className), htmlFor: id, style: style, children: [jsx(DInputCheck, { id: id, type: "radio", name: name, value: value, isChecked: isChecked, onChange: changeHandler }), jsxs("div", { className: "d-quick-action-check-detail", children: [jsx("span", { className: "d-quick-action-check-line1", children: line1 }), jsx("span", { className: "d-quick-action-check-line2", children: line2 })] }), jsx("span", { className: "d-quick-action-check-line3", children: line3 })] }));
1181
1020
  }
1182
1021
 
1183
- function DQuickActionSelect({ id, name, value, line1, line2, className, isSelected = false, onChange, }) {
1022
+ function DQuickActionSelect({ id, name, value, line1, line2, className, style, isSelected = false, onChange, }) {
1184
1023
  const innerRef = useRef(null);
1185
1024
  const changeHandler = useCallback((event) => {
1186
1025
  event.stopPropagation();
@@ -1191,15 +1030,15 @@ function DQuickActionSelect({ id, name, value, line1, line2, className, isSelect
1191
1030
  innerRef.current.checked = isSelected;
1192
1031
  }
1193
1032
  }, [isSelected]);
1194
- return (jsxs("label", { className: classNames('d-quick-action-select', className), htmlFor: id, children: [jsx("input", { ref: innerRef, id: id, type: "radio", name: name, value: value, onChange: changeHandler }), jsx("span", { className: "d-quick-action-select-line1", children: line1 }), jsx("span", { className: "d-quick-action-select-line2", children: line2 })] }));
1033
+ return (jsxs("label", { className: classNames('d-quick-action-select', className), htmlFor: id, style: style, children: [jsx("input", { ref: innerRef, id: id, type: "radio", name: name, value: value, onChange: changeHandler }), jsx("span", { className: "d-quick-action-select-line1", children: line1 }), jsx("span", { className: "d-quick-action-select-line2", children: line2 })] }));
1195
1034
  }
1196
1035
 
1197
- function DQuickActionSwitch({ id, name, label, hint, className, isChecked, isDisabled, onClick, }) {
1036
+ function DQuickActionSwitch({ id, name, label, hint, isChecked, isDisabled, className, style, onClick, }) {
1198
1037
  const clickHandler = useCallback((event) => {
1199
1038
  event.stopPropagation();
1200
1039
  onClick === null || onClick === void 0 ? void 0 : onClick(isChecked);
1201
1040
  }, [isChecked, onClick]);
1202
- return (jsxs("button", { className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, children: [jsxs("div", { className: "d-quick-action-switch-content", children: [jsx(DInputSwitch, { id: id, name: name, isDisabled: isDisabled, isChecked: isChecked, isReadonly: true }), jsx("label", { className: "d-quick-action-switch-label", htmlFor: id, children: label })] }), jsx("div", { className: "d-quick-action-switch-hint", children: hint })] }));
1041
+ return (jsxs("button", { className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style, children: [jsxs("div", { className: "d-quick-action-switch-content", children: [jsx(DInputSwitch, { id: id, name: name, isDisabled: isDisabled, isChecked: isChecked, isReadonly: true }), jsx("label", { className: "d-quick-action-switch-label", htmlFor: id, children: label })] }), jsx("div", { className: "d-quick-action-switch-hint", children: hint })] }));
1203
1042
  }
1204
1043
 
1205
1044
  function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
@@ -1220,14 +1059,14 @@ function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, child
1220
1059
  return (jsx(ContentLoader, { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
1221
1060
  }
1222
1061
 
1223
- function DStepper$2({ options, currentStep, successIcon = 'check', isVertical = false, }) {
1062
+ function DStepper$2({ options, currentStep, successIcon = 'check', isVertical = false, className, style, }) {
1224
1063
  if (currentStep < 1 || currentStep > options.length) {
1225
1064
  throw new Error('Current step should be in the range from 1 to options length');
1226
1065
  }
1227
1066
  return (jsx("div", { className: classNames({
1228
1067
  'd-stepper-desktop': true,
1229
1068
  'is-vertical': isVertical,
1230
- }), children: options.map(({ label, value }) => (jsxs("div", { className: "d-step", children: [jsx("div", { className: "d-step-value", children: jsx("div", { className: classNames({
1069
+ }, className), style: style, children: options.map(({ label, value }) => (jsxs("div", { className: "d-step", children: [jsx("div", { className: "d-step-value", children: jsx("div", { className: classNames({
1231
1070
  'd-step-icon-container': true,
1232
1071
  'd-step-check': value < currentStep,
1233
1072
  'd-step-current': value === currentStep,
@@ -1236,7 +1075,7 @@ function DStepper$2({ options, currentStep, successIcon = 'check', isVertical =
1236
1075
  : value }) }), jsx("div", { className: "d-step-label", children: label })] }, value))) }));
1237
1076
  }
1238
1077
 
1239
- function DStepper$1({ options, currentStep, }) {
1078
+ function DStepper$1({ options, currentStep, className, style, }) {
1240
1079
  if (currentStep < 1 || currentStep > options.length) {
1241
1080
  throw new Error('Current step should be in the range from 1 to options length');
1242
1081
  }
@@ -1263,50 +1102,11 @@ function DStepper$1({ options, currentStep, }) {
1263
1102
  from 180deg,
1264
1103
  var(--${PREFIX_BS}step-progress-outter-fill-background-color) ${currentAngle}deg,
1265
1104
  var(--${PREFIX_BS}step-progress-outter-background-color) 0deg)`, [currentAngle]);
1266
- return (jsxs("div", { className: "d-stepper", children: [jsx("div", { className: "d-step-bar", style: { background: progressStyle }, children: jsx("p", { className: "d-step-number", children: `${currentStep}/${options.length}` }) }), jsx("div", { className: "d-step-info", children: Object.keys(currentOption).length > 0 && (jsxs(Fragment, { children: [jsx("div", { className: "d-step-label", children: currentOption.label }), jsx("div", { className: "d-step-description", children: currentOption.description || '' })] })) })] }));
1105
+ return (jsxs("div", { className: classNames('d-stepper', className), style: style, children: [jsx("div", { className: "d-step-bar", style: { background: progressStyle }, children: jsx("p", { className: "d-step-number", children: `${currentStep}/${options.length}` }) }), jsx("div", { className: "d-step-info", children: Object.keys(currentOption).length > 0 && (jsxs(Fragment, { children: [jsx("div", { className: "d-step-label", children: currentOption.label }), jsx("div", { className: "d-step-description", children: currentOption.description || '' })] })) })] }));
1267
1106
  }
1268
1107
 
1269
- function DStepper({ options, currentStep, successIcon = 'check', isVertical = false, breakpoint = 'lg', }) {
1270
- return (jsxs(Fragment, { children: [jsx("div", { className: `d-block d-${breakpoint}-none`, children: jsx(DStepper$1, { options: options, currentStep: currentStep }) }), jsx("div", { className: `d-none d-${breakpoint}-block`, children: jsx(DStepper$2, { options: options, currentStep: currentStep, successIcon: successIcon, isVertical: isVertical }) })] }));
1271
- }
1272
-
1273
- const TabContext = createContext(undefined);
1274
- function DTabs({ children, defaultSelected, onChange, options, className, isVertical, }) {
1275
- const [selected, setSelected] = useState(defaultSelected);
1276
- const onSelect = useCallback((option) => {
1277
- if (option.tab) {
1278
- setSelected(option.tab);
1279
- }
1280
- onChange(option);
1281
- }, [onChange]);
1282
- useEffect(() => {
1283
- setSelected(defaultSelected);
1284
- }, [defaultSelected]);
1285
- const isSelected = useCallback((tab) => (selected === tab), [selected]);
1286
- const value = useMemo(() => ({
1287
- isSelected,
1288
- }), [isSelected]);
1289
- return (jsx(TabContext.Provider, { value: value, children: jsxs("div", { className: classNames({
1290
- 'd-tabs': true,
1291
- 'd-tabs-vertical': isVertical,
1292
- }), children: [jsx("nav", { className: "nav", children: options.map((option) => (jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
1293
- active: option.tab === selected,
1294
- }, 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))) }), jsx("div", { className: "tab-content", children: children })] }) }));
1295
- }
1296
- function useTabContext() {
1297
- const context = useContext(TabContext);
1298
- if (context === undefined) {
1299
- throw new Error('useTabContext was used outside of MTab');
1300
- }
1301
- return context;
1302
- }
1303
-
1304
- function DTabContent({ tab, children }) {
1305
- const { isSelected } = useTabContext();
1306
- if (!isSelected(tab)) {
1307
- return null;
1308
- }
1309
- return (jsx("div", { className: "tab-pane fade show active", id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab`, children: children }));
1108
+ function DStepper({ options, currentStep, successIcon = 'check', isVertical = false, breakpoint = 'lg', className, style, }) {
1109
+ return (jsxs("div", { className: className, style: style, children: [jsx("div", { className: `d-block d-${breakpoint}-none`, children: jsx(DStepper$1, { options: options, currentStep: currentStep }) }), jsx("div", { className: `d-none d-${breakpoint}-block`, children: jsx(DStepper$2, { options: options, currentStep: currentStep, successIcon: successIcon, isVertical: isVertical }) })] }));
1310
1110
  }
1311
1111
 
1312
1112
  const TOOLTIP_FONT_SIZE_BY_SIZE = {
@@ -1317,21 +1117,14 @@ const TOOLTIP_FONT_SIZE_BY_SIZE = {
1317
1117
  const ARROW_WIDTH = 8;
1318
1118
  const ARROW_HEIGHT = 4;
1319
1119
  const GAP = 2;
1320
- function DTooltip({ classNameContainer, className, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, isOpen = false, placement = 'top', size, Component, children, }) {
1120
+ function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, isOpen = false, placement = 'top', size, Component, children, }) {
1321
1121
  const [open, setOpen] = useState(isOpen);
1322
1122
  const styleVariables = useMemo(() => {
1323
1123
  const defaultFontSize = size
1324
1124
  ? TOOLTIP_FONT_SIZE_BY_SIZE[size]
1325
1125
  : TOOLTIP_FONT_SIZE_BY_SIZE.default;
1326
- return {
1327
- background: `var(--${PREFIX_BS}tooltip-bg, var(--${PREFIX_BS}tooltip-component-bg, var(--${PREFIX_BS}secondary)))`,
1328
- borderRadius: `var(--${PREFIX_BS}tooltip-border-radius, var(--${PREFIX_BS}tooltip-component-border-radius, var(--${PREFIX_BS}border-radius)))`,
1329
- color: `var(--${PREFIX_BS}tooltip-color, var(--${PREFIX_BS}tooltip-component-color, var(--${PREFIX_BS}white)))`,
1330
- fontSize: `var(--${PREFIX_BS}tooltip-font-size, var(--${PREFIX_BS}tooltip-component-font-size, ${defaultFontSize}))`,
1331
- padding: `var(--${PREFIX_BS}tooltip-padding, var(--${PREFIX_BS}tooltip-component-padding, var(--${PREFIX_BS}ref-spacer-2)))`,
1332
- maxWidth: `var(--${PREFIX_BS}tooltip-max-width, var(--${PREFIX_BS}tooltip-component-max-width, 300px))`,
1333
- };
1334
- }, [size]);
1126
+ return Object.assign(Object.assign({}, style), { background: `var(--${PREFIX_BS}tooltip-bg, var(--${PREFIX_BS}tooltip-component-bg, var(--${PREFIX_BS}secondary)))`, borderRadius: `var(--${PREFIX_BS}tooltip-border-radius, var(--${PREFIX_BS}tooltip-component-border-radius, var(--${PREFIX_BS}border-radius)))`, color: `var(--${PREFIX_BS}tooltip-color, var(--${PREFIX_BS}tooltip-component-color, var(--${PREFIX_BS}white)))`, fontSize: `var(--${PREFIX_BS}tooltip-font-size, var(--${PREFIX_BS}tooltip-component-font-size, ${defaultFontSize}))`, padding: `var(--${PREFIX_BS}tooltip-padding, var(--${PREFIX_BS}tooltip-component-padding, var(--${PREFIX_BS}ref-spacer-2)))`, maxWidth: `var(--${PREFIX_BS}tooltip-max-width, var(--${PREFIX_BS}tooltip-component-max-width, 300px))` });
1127
+ }, [size, style]);
1335
1128
  const arrowRef = useRef(null);
1336
1129
  const { refs, context, floatingStyles, } = useFloating({
1337
1130
  open,
@@ -1366,9 +1159,79 @@ function DTooltip({ classNameContainer, className, offSet = ARROW_HEIGHT + GAP,
1366
1159
  }, width: ARROW_WIDTH, height: ARROW_HEIGHT }), children] }))) })] }));
1367
1160
  }
1368
1161
 
1369
- function DToastContainer({ style, position = 'top-right', }) {
1370
- return (jsx(ToastContainer, { toastClassName: () => 'shadow-none p-0 cursor-default', position: position, autoClose: false, hideProgressBar: true, closeOnClick: false, closeButton: false, transition: Slide, style: style }));
1162
+ const TabContext = createContext(undefined);
1163
+ function useTabContext() {
1164
+ const context = useContext(TabContext);
1165
+ if (context === undefined) {
1166
+ throw new Error('useTabContext was used outside of MTab');
1167
+ }
1168
+ return context;
1169
+ }
1170
+
1171
+ function DTabContent({ tab, children, className, style, }) {
1172
+ const { isSelected } = useTabContext();
1173
+ if (!isSelected(tab)) {
1174
+ return null;
1175
+ }
1176
+ return (jsx("div", { className: classNames('tab-pane fade show active', className), id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab`, style: style, children: children }));
1177
+ }
1178
+
1179
+ function DTabs({ children, defaultSelected, onChange, options, className, style, isVertical, }) {
1180
+ const [selected, setSelected] = useState(defaultSelected);
1181
+ const onSelect = useCallback((option) => {
1182
+ if (option.tab) {
1183
+ setSelected(option.tab);
1184
+ }
1185
+ onChange(option);
1186
+ }, [onChange]);
1187
+ useEffect(() => {
1188
+ setSelected(defaultSelected);
1189
+ }, [defaultSelected]);
1190
+ const isSelected = useCallback((tab) => (selected === tab), [selected]);
1191
+ const value = useMemo(() => ({
1192
+ isSelected,
1193
+ }), [isSelected]);
1194
+ return (jsx(TabContext.Provider, { value: value, children: jsxs("div", { className: classNames({
1195
+ 'd-tabs': true,
1196
+ 'd-tabs-vertical': isVertical,
1197
+ }, className), style: style, children: [jsx("nav", { className: "nav", children: options.map((option) => (jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
1198
+ active: option.tab === selected,
1199
+ }, 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))) }), jsx("div", { className: "tab-content", children: children })] }) }));
1200
+ }
1201
+ var DTabs$1 = Object.assign(DTabs, {
1202
+ Tab: DTabContent,
1203
+ });
1204
+
1205
+ function DToastContainer({ style, position = 'top-right', className, }) {
1206
+ return (jsx(ToastContainer, { toastClassName: () => classNames('shadow-none p-0 cursor-default', className), position: position, autoClose: false, hideProgressBar: true, closeOnClick: false, closeButton: false, transition: Slide, style: style }));
1207
+ }
1208
+
1209
+ function useToast() {
1210
+ const toast$1 = useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
1211
+ toast(({ closeToast }) => (jsx(DAlert, { type: type, showClose: showClose, onClose: closeToast, id: "alertID", children: message })), {
1212
+ transition: Slide,
1213
+ position,
1214
+ autoClose,
1215
+ });
1216
+ }, []);
1217
+ return {
1218
+ toast: toast$1,
1219
+ };
1220
+ }
1221
+
1222
+ async function configureI8n(resources, _a = {}) {
1223
+ var { lng = 'en', fallbackLng = 'en' } = _a, config = __rest(_a, ["lng", "fallbackLng"]);
1224
+ return i18n
1225
+ .use(initReactI18next)
1226
+ .init(Object.assign({ resources,
1227
+ lng, initImmediate: true, fallbackLng, interpolation: {
1228
+ escapeValue: false,
1229
+ prefix: '{',
1230
+ suffix: '}',
1231
+ // skipOnVariables: false,
1232
+ } }, config))
1233
+ .then((t) => t);
1371
1234
  }
1372
1235
 
1373
- export { DAlert, DBadge, DBoxFile, DButton, DCard, DCardAccount, DCardBody, DCardFooter, DCardHeader, DCarousel, DCarouselSlide, DChip, DCollapse, DCollapseIconText, DCurrencyText, DDatePicker, DFormikInput, DFormikInputCurrency, DFormikInputSelect, DIcon, DInput$1 as DInput, DInputCheck, DInputCounter, DInputCurrency, DInputCurrencyBase, DInputPassword, DInputPin, DInputSearch, DInputSelect, DInputSwitch, DList, DListItem, DListItemMovement, DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPermissionGroup, DPermissionItem, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DSummaryCard, DTabContent, DTabs, DToastContainer, DTooltip, LiquidContext$1 as LiquidContext, LiquidContextProvider, ModalContext, ModalContextProvider, OffcanvasContext, OffcanvasContextProvider, configureI8n as configureI18n, formatCurrency, liquidParser, useFormatCurrency, useLiquidContext, useModalContext, useOffcanvasContext, useScreenshot, useScreenshotDownload, useScreenshotWebShare, useTabContext, useToast };
1236
+ export { DAlert, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardAccount, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DCollapseIconText, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DListItemMovement, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPermissionGroup, DPermissionItem, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DSummaryCard, DTabContent, DTabs$1 as DTabs, DToastContainer, DTooltip, ModalContext, ModalContextProvider, OffcanvasContext, OffcanvasContextProvider, configureI8n as configureI18n, formatCurrency, useDContext, useFormatCurrency, useInputCurrency, useModalContext, useOffcanvasContext, useProvidedRefOrCreate, useStackState, useTabContext, useToast };
1374
1237
  //# sourceMappingURL=index.esm.js.map