@dynamic-framework/ui-react 2.0.0-dev.1 → 2.0.0-dev.10

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 (144) hide show
  1. package/dist/css/dynamic-ui-non-root.css +7054 -3736
  2. package/dist/css/dynamic-ui-non-root.min.css +3 -3
  3. package/dist/css/dynamic-ui-root.css +339 -161
  4. package/dist/css/dynamic-ui-root.min.css +3 -3
  5. package/dist/css/dynamic-ui.css +7380 -3884
  6. package/dist/css/dynamic-ui.min.css +3 -3
  7. package/dist/index.esm.js +641 -406
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +685 -433
  10. package/dist/index.js.map +1 -1
  11. package/dist/types/components/DAlert/DAlert.d.ts +3 -3
  12. package/dist/types/components/DAvatar/DAvatar.d.ts +1 -3
  13. package/dist/types/components/DBadge/DBadge.d.ts +4 -3
  14. package/dist/types/components/DBox/DBox.d.ts +5 -0
  15. package/dist/types/components/DBox/index.d.ts +2 -0
  16. package/dist/types/components/DBoxFile/DBoxFile.d.ts +1 -1
  17. package/dist/types/components/DButton/DButton.d.ts +8 -17
  18. package/dist/types/components/DButtonIcon/DButtonIcon.d.ts +3 -3
  19. package/dist/types/components/DChip/DChip.d.ts +3 -3
  20. package/dist/types/components/DCollapse/DCollapse.d.ts +1 -1
  21. package/dist/types/components/DCreditCard/DCreditCard.d.ts +12 -0
  22. package/dist/types/components/DCreditCard/index.d.ts +2 -0
  23. package/dist/types/components/DDatePicker/DDatePicker.d.ts +3 -3
  24. package/dist/types/components/DDatePicker/components/DDatePickerHeaderSelector.d.ts +2 -4
  25. package/dist/types/components/DDropdown/DDropdown.d.ts +20 -0
  26. package/dist/types/components/DDropdown/index.d.ts +2 -0
  27. package/dist/types/components/DIconBase/DIconBase.d.ts +13 -9
  28. package/dist/types/components/DInput/DInput.d.ts +3 -2
  29. package/dist/types/components/DInputCheck/DInputCheck.d.ts +2 -1
  30. package/dist/types/components/DInputCounter/DInputCounter.d.ts +3 -2
  31. package/dist/types/components/DInputCurrency/DInputCurrency.d.ts +4 -3
  32. package/dist/types/components/DInputMask/DInputMask.d.ts +7 -17
  33. package/dist/types/components/DInputPhone/DInputPhone.d.ts +2 -2
  34. package/dist/types/components/DInputPin/DInputPin.d.ts +3 -3
  35. package/dist/types/components/DInputRange/DInputRange.d.ts +2 -2
  36. package/dist/types/components/DInputSelect/DInputSelect.d.ts +3 -3
  37. package/dist/types/components/DInputSwitch/DInputSwitch.d.ts +2 -1
  38. package/dist/types/components/DLayout/DLayout.d.ts +22 -0
  39. package/dist/types/components/DLayout/components/DLayoutPane.d.ts +13 -0
  40. package/dist/types/components/DLayout/index.d.ts +3 -0
  41. package/dist/types/components/DListGroup/components/DListGroupItem.d.ts +4 -4
  42. package/dist/types/components/DModal/DModal.d.ts +3 -1
  43. package/dist/types/components/DOffcanvas/DOffcanvas.d.ts +3 -1
  44. package/dist/types/components/DOtp/DOtp.d.ts +16 -0
  45. package/dist/types/components/DOtp/DOtpspec.d.ts +0 -0
  46. package/dist/types/components/DOtp/components/OtpCountdown.d.ts +7 -0
  47. package/dist/types/components/DOtp/hooks/useCountdown.d.ts +4 -0
  48. package/dist/types/components/DOtp/index.d.ts +2 -0
  49. package/dist/types/components/DPaginator/DPaginator.d.ts +2 -27
  50. package/dist/types/components/DPasswordStrengthMeter/DPasswordStrengthMeter.d.ts +23 -0
  51. package/dist/types/components/DPasswordStrengthMeter/PasswordCheckItem.d.ts +7 -0
  52. package/dist/types/components/DPasswordStrengthMeter/PasswordCheckList.d.ts +14 -0
  53. package/dist/types/components/DPasswordStrengthMeter/PasswordStrength.d.ts +6 -0
  54. package/dist/types/components/DPasswordStrengthMeter/index.d.ts +3 -0
  55. package/dist/types/components/DProgress/DProgress.d.ts +2 -1
  56. package/dist/types/components/DSelect/DSelect.d.ts +3 -3
  57. package/dist/types/components/DTabs/DTabs.d.ts +2 -2
  58. package/dist/types/components/DTimeline/DTimeline.d.ts +15 -0
  59. package/dist/types/components/DTimeline/index.d.ts +2 -0
  60. package/dist/types/components/DToastContainer/useDToast.d.ts +2 -2
  61. package/dist/types/components/DTooltip/DTooltip.d.ts +1 -2
  62. package/dist/types/components/DVoucher/DVoucher.d.ts +14 -0
  63. package/dist/types/components/DVoucher/hooks/useScreenshot.d.ts +5 -0
  64. package/dist/types/components/DVoucher/hooks/useScreenshotDownload.d.ts +5 -0
  65. package/dist/types/components/DVoucher/hooks/useScreenshotWebShare.d.ts +5 -0
  66. package/dist/types/components/DVoucher/index.d.ts +2 -0
  67. package/dist/types/components/config.d.ts +0 -2
  68. package/dist/types/components/index.d.ts +8 -9
  69. package/dist/types/components/interface.d.ts +3 -8
  70. package/dist/types/hooks/useResponsiveProp.d.ts +35 -0
  71. package/jest/setup.js +0 -2
  72. package/package.json +43 -40
  73. package/src/style/_shame.scss +42 -1
  74. package/src/style/abstracts/_mixins.scss +35 -23
  75. package/src/style/abstracts/_utilities.scss +70 -1
  76. package/src/style/abstracts/variables/_+import.scss +3 -2
  77. package/src/style/abstracts/variables/_alerts.scss +2 -0
  78. package/src/style/abstracts/variables/_body.scss +10 -3
  79. package/src/style/abstracts/variables/_border.scss +5 -5
  80. package/src/style/abstracts/variables/_buttons.scss +19 -11
  81. package/src/style/abstracts/variables/_cards.scss +6 -4
  82. package/src/style/abstracts/variables/_chips.scss +2 -2
  83. package/src/style/abstracts/variables/_colors.scss +147 -70
  84. package/src/style/abstracts/variables/_datepicker.scss +10 -9
  85. package/src/style/abstracts/variables/_dropdowns.scss +6 -4
  86. package/src/style/abstracts/variables/_forms.scss +4 -4
  87. package/src/style/abstracts/variables/_list-group.scss +2 -2
  88. package/src/style/abstracts/variables/_modals.scss +4 -3
  89. package/src/style/abstracts/variables/_offcanvas.scss +1 -0
  90. package/src/style/abstracts/variables/_pagination.scss +4 -4
  91. package/src/style/abstracts/variables/_shadow.scss +1 -0
  92. package/src/style/abstracts/variables/_tables.scss +8 -3
  93. package/src/style/abstracts/variables/_tooltip.scss +1 -1
  94. package/src/style/abstracts/variables/_typography.scss +7 -7
  95. package/src/style/base/_+import.scss +1 -0
  96. package/src/style/base/_alert.scss +1 -27
  97. package/src/style/base/_badge.scss +50 -12
  98. package/src/style/base/_buttons.scss +33 -30
  99. package/src/style/base/_dropdown.scss +18 -0
  100. package/src/style/base/_input-group.scss +5 -0
  101. package/src/style/base/_label.scss +0 -4
  102. package/src/style/base/_list-group.scss +6 -0
  103. package/src/style/base/_pagination.scss +2 -0
  104. package/src/style/base/_tables.scss +4 -0
  105. package/src/style/base/_tooltip.scss +1 -10
  106. package/src/style/components/_+import.scss +5 -4
  107. package/src/style/components/_d-avatar.scss +2 -20
  108. package/src/style/components/_d-box-file.scss +1 -1
  109. package/src/style/components/_d-box.scss +13 -0
  110. package/src/style/components/_d-carousel.scss +19 -1
  111. package/src/style/components/_d-credit-card.scss +67 -0
  112. package/src/style/components/_d-datepicker.scss +83 -26
  113. package/src/style/components/_d-icon.scss +10 -3
  114. package/src/style/components/_d-modal.scss +3 -0
  115. package/src/style/components/_d-stepper-desktop.scss +61 -65
  116. package/src/style/components/_d-stepper-mobile.scss +2 -2
  117. package/src/style/components/_d-tabs.scss +37 -0
  118. package/src/style/components/_d-timeline.scss +108 -0
  119. package/src/style/components/_d-voucher.scss +29 -0
  120. package/src/style/helpers/_color-bg.scss +13 -3
  121. package/src/style/root/_root.scss +109 -86
  122. package/dist/types/components/DInputCurrencyBase/DInputCurrencyBase.d.ts +0 -26
  123. package/dist/types/components/DInputCurrencyBase/index.d.ts +0 -2
  124. package/dist/types/components/DInputSearch/DInputSearch.d.ts +0 -17
  125. package/dist/types/components/DInputSearch/index.d.ts +0 -2
  126. package/dist/types/components/DList/DList.d.ts +0 -17
  127. package/dist/types/components/DList/components/DListItem.d.ts +0 -13
  128. package/dist/types/components/DList/index.d.ts +0 -3
  129. package/dist/types/components/DQuickActionButton/DQuickActionButton.d.ts +0 -20
  130. package/dist/types/components/DQuickActionButton/index.d.ts +0 -2
  131. package/dist/types/components/DQuickActionCheck/DQuickActionCheck.d.ts +0 -17
  132. package/dist/types/components/DQuickActionCheck/index.d.ts +0 -2
  133. package/dist/types/components/DQuickActionSelect/DQuickActionSelect.d.ts +0 -13
  134. package/dist/types/components/DQuickActionSelect/index.d.ts +0 -2
  135. package/dist/types/components/DQuickActionSwitch/DQuickActionSwitch.d.ts +0 -15
  136. package/dist/types/components/DQuickActionSwitch/index.d.ts +0 -2
  137. package/dist/types/components/DSkeleton/DSkeleton.d.ts +0 -11
  138. package/dist/types/components/DSkeleton/index.d.ts +0 -2
  139. package/dist/types/components/DTableHead/DTableHead.d.ts +0 -9
  140. package/dist/types/components/DTableHead/index.d.ts +0 -2
  141. package/src/style/components/_d-quick-action-button.scss +0 -121
  142. package/src/style/components/_d-quick-action-check.scss +0 -74
  143. package/src/style/components/_d-quick-action-select.scss +0 -58
  144. package/src/style/components/_d-quick-action-switch.scss +0 -64
package/dist/index.esm.js CHANGED
@@ -1,8 +1,10 @@
1
- import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
2
- import React, { useMemo, useEffect, useState, useCallback, useContext, createContext, Fragment, useLayoutEffect, forwardRef, useId, useRef, useSyncExternalStore } from 'react';
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
2
  import classNames from 'classnames';
3
+ import React, { useEffect, useState, useCallback, useMemo, useContext, createContext, useLayoutEffect, useSyncExternalStore, forwardRef, useId, useRef } from 'react';
4
4
  import { __rest } from 'tslib';
5
+ import * as LucideIcons from 'lucide-react';
5
6
  import { createPortal } from 'react-dom';
7
+ import { AnimatePresence, motion } from 'framer-motion';
6
8
  import { fromEvent } from 'file-selector';
7
9
  import { SplideSlide, Splide } from '@splidejs/react-splide';
8
10
  import currency from 'currency.js';
@@ -12,57 +14,15 @@ import Select, { components } from 'react-select';
12
14
  import { InputMask } from '@react-input/mask';
13
15
  import ResponsivePagination from 'react-responsive-pagination';
14
16
  import { useFloating, autoUpdate, offset, flip, shift, useClick, useDismiss, useRole, useInteractions, useId as useId$1, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
15
- import ContentLoader from 'react-content-loader';
16
17
  import { Toaster, toast } from 'react-hot-toast';
17
18
  import { defaultCountries, parseCountry, usePhoneInput, CountrySelector } from 'react-international-phone';
18
19
  import { PhoneNumberUtil } from 'google-libphonenumber';
20
+ import html2canvas from 'html2canvas';
19
21
  import i18n from 'i18next';
20
22
  import { initReactI18next } from 'react-i18next';
21
23
 
22
24
  const PREFIX_BS = 'bs-';
23
25
 
24
- function DIconBase({ icon, theme, style, className, size, loading = false, loadingDuration = 1.8, hasCircle = false, circleSize = `calc(var(--${PREFIX_BS}icon-size) * 1)`, color, backgroundColor, materialStyle = false, familyClass = 'bi', familyPrefix = 'bi-', dataAttributes, }) {
25
- const colorStyle = useMemo(() => {
26
- if (color) {
27
- return { [`--${PREFIX_BS}icon-component-color`]: color };
28
- }
29
- if (theme) {
30
- return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${theme})` };
31
- }
32
- return {};
33
- }, [color, theme]);
34
- const backgroundStyle = useMemo(() => {
35
- if (backgroundColor) {
36
- return { [`--${PREFIX_BS}icon-component-bg-color`]: backgroundColor };
37
- }
38
- if (hasCircle) {
39
- if (theme) {
40
- return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${theme}-rgb), 0.1)` };
41
- }
42
- return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}body-color-rgb), 0.1)` };
43
- }
44
- return {};
45
- }, [backgroundColor, hasCircle, theme]);
46
- const circleSizeStyle = useMemo(() => {
47
- if (hasCircle) {
48
- return { [`--${PREFIX_BS}icon-component-padding`]: circleSize };
49
- }
50
- return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
51
- }, [circleSize, hasCircle]);
52
- const generateStyleVariables = useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ [`--${PREFIX_BS}icon-component-loading-duration`]: `${loadingDuration}s` }, size && { [`--${PREFIX_BS}icon-component-size`]: size }), colorStyle), backgroundStyle), circleSizeStyle), style)), [size, loadingDuration, colorStyle, backgroundStyle, circleSizeStyle, style]);
53
- const generateClasses = useMemo(() => (Object.assign(Object.assign({ 'd-icon': true, [familyClass]: true, 'd-icon-loading': loading }, !materialStyle && {
54
- [`${familyPrefix}${icon}`]: true,
55
- }), className && { [className]: true })), [
56
- familyClass,
57
- loading,
58
- className,
59
- materialStyle,
60
- familyPrefix,
61
- icon,
62
- ]);
63
- return (jsx("i", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: materialStyle && icon })));
64
- }
65
-
66
26
  function useDisableBodyScrollEffect(disable) {
67
27
  useEffect(() => {
68
28
  if (disable) {
@@ -219,7 +179,10 @@ function DPortalContextProvider({ portalName, children, availablePortals, }) {
219
179
  return (jsxs(DPortalContext.Provider, { value: value, children: [children, created && createPortal(
220
180
  // eslint-disable-next-line max-len
221
181
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
222
- jsx("div", { onClick: ({ target }) => handleClose(target), onKeyDown: () => { }, children: stack.map(({ Component, name, payload, }) => (jsxs(Fragment, { children: [jsx("div", { className: "backdrop fade show" }), jsx(Component, { name: name, payload: payload })] }, name))) }), document.getElementById(portalName))] }));
182
+ jsx("div", { onClick: ({ target }) => handleClose(target), onKeyDown: () => { }, children: jsx(AnimatePresence, { children: stack.flatMap(({ Component, name, payload, }) => [
183
+ jsx(motion.div, { className: "backdrop", initial: { opacity: 0 }, animate: { opacity: 0.5 }, exit: { opacity: 0, transition: { delay: 0.3 } }, transition: { duration: 0.15, ease: 'linear' } }, `${name}-backdrop`),
184
+ jsx(Component, { name: name, payload: payload }, name),
185
+ ]) }) }), document.getElementById(portalName))] }));
223
186
  }
224
187
  function useDPortalContext() {
225
188
  const context = useContext(DPortalContext);
@@ -248,31 +211,27 @@ const DEFAULT_STATE = {
248
211
  materialStyle: false,
249
212
  },
250
213
  iconMap: {
251
- x: 'x',
252
- xLg: 'x-lg',
253
- chevronUp: 'chevron-up',
254
- chevronDown: 'chevron-down',
255
- chevronLeft: 'chevron-left',
256
- chevronRight: 'chevron-right',
257
- upload: 'cloud-upload',
258
- calendar: 'calendar',
259
- check: 'check',
214
+ x: 'X',
215
+ xLg: 'X',
216
+ chevronUp: 'ChevronUp',
217
+ chevronDown: 'ChevronDown',
218
+ chevronLeft: 'ChevronLeft',
219
+ chevronRight: 'ChevronRight',
220
+ upload: 'Upload',
221
+ calendar: 'Calendar',
222
+ check: 'Check',
260
223
  alert: {
261
- warning: 'exclamation-circle',
262
- danger: 'exclamation-triangle',
263
- success: 'check-circle',
264
- info: 'info-circle',
265
- dark: 'info-circle',
266
- light: 'info-circle',
267
- primary: 'info-circle',
268
- secondary: 'info-circle',
224
+ warning: 'AlertCircle',
225
+ danger: 'AlertTriangle',
226
+ success: 'CheckCircle',
227
+ info: 'Info',
269
228
  },
270
229
  input: {
271
- search: 'search',
272
- show: 'eye',
273
- hide: 'eye-slash',
274
- increase: 'plus-square',
275
- decrease: 'dash-square',
230
+ search: 'Search',
231
+ show: 'Eye',
232
+ hide: 'EyeOff',
233
+ increase: 'Plus',
234
+ decrease: 'Minus',
276
235
  },
277
236
  },
278
237
  breakpoints: {
@@ -319,31 +278,170 @@ function useDContext() {
319
278
  return context;
320
279
  }
321
280
 
281
+ function subscribeToMediaQuery(query, callback) {
282
+ const mediaQueryList = window.matchMedia(query);
283
+ mediaQueryList.addEventListener('change', callback);
284
+ return () => {
285
+ mediaQueryList.removeEventListener('change', callback);
286
+ };
287
+ }
288
+ function checkMediaQuery(query) {
289
+ return window.matchMedia(query).matches;
290
+ }
291
+
292
+ function useMediaQuery(mediaQuery, useListener = false) {
293
+ /* eslint-disable-next-line @typescript-eslint/no-unused-vars */
294
+ const noop = (_) => () => { };
295
+ return useSyncExternalStore(useListener ? (cb) => subscribeToMediaQuery(mediaQuery, cb) : noop, () => (mediaQuery ? checkMediaQuery(mediaQuery) : true), () => false);
296
+ }
297
+
298
+ function useMediaBreakpointUp(breakpoint, useListener = false) {
299
+ const { breakpoints } = useDContext();
300
+ const mediaQuery = useMemo(() => (`(min-width: ${breakpoints[breakpoint]})`), [breakpoint, breakpoints]);
301
+ return useMediaQuery(mediaQuery, useListener);
302
+ }
303
+ function useMediaBreakpointUpXs(useListener = false) {
304
+ return useMediaBreakpointUp('xs', useListener);
305
+ }
306
+ function useMediaBreakpointUpSm(useListener = false) {
307
+ return useMediaBreakpointUp('sm', useListener);
308
+ }
309
+ function useMediaBreakpointUpMd(useListener = false) {
310
+ return useMediaBreakpointUp('md', useListener);
311
+ }
312
+ function useMediaBreakpointUpLg(useListener = false) {
313
+ return useMediaBreakpointUp('lg', useListener);
314
+ }
315
+ function useMediaBreakpointUpXl(useListener = false) {
316
+ return useMediaBreakpointUp('xl', useListener);
317
+ }
318
+ function useMediaBreakpointUpXxl(useListener = false) {
319
+ return useMediaBreakpointUp('xxl', useListener);
320
+ }
321
+
322
+ /**
323
+ * React hook to resolve a responsive property value based on the current viewport breakpoint.
324
+ *
325
+ * Given a `ResponsiveProp` object, this hook returns the value for the highest matching breakpoint.
326
+ * If multiple breakpoints match, the value for the largest (highest) breakpoint is used.
327
+ * If no breakpoints match, `undefined` is returned.
328
+ *
329
+ * @param useListener - Whether to listen for breakpoint changes (default: false).
330
+ * @returns An object with a `responsivePropValue` function that takes a
331
+ * `ResponsiveProp` and returns the resolved value.
332
+ *
333
+ * Usage example:
334
+ * ```ts
335
+ * const { responsivePropValue } = useResponsiveProp();
336
+ * const value = responsivePropValue({ xs: "A", md: "B", xl: "C" });
337
+ * // value will be "C" if xl breakpoint is active, "B" if md is active, etc.
338
+ * ```
339
+ */
340
+ function useResponsiveProp(useListener = false) {
341
+ const bpXsUp = useMediaBreakpointUpXs(useListener);
342
+ const bpSmUp = useMediaBreakpointUpSm(useListener);
343
+ const bpMdUp = useMediaBreakpointUpMd(useListener);
344
+ const bpLgUp = useMediaBreakpointUpLg(useListener);
345
+ const bpXlUp = useMediaBreakpointUpXl(useListener);
346
+ const bpXxlUp = useMediaBreakpointUpXxl(useListener);
347
+ const responsivePropValue = useCallback((prop) => {
348
+ // Pick the highest matched breakpoint value that is defined in prop
349
+ if (prop.xxl !== undefined && bpXxlUp)
350
+ return prop.xxl;
351
+ if (prop.xl !== undefined && bpXlUp)
352
+ return prop.xl;
353
+ if (prop.lg !== undefined && bpLgUp)
354
+ return prop.lg;
355
+ if (prop.md !== undefined && bpMdUp)
356
+ return prop.md;
357
+ if (prop.sm !== undefined && bpSmUp)
358
+ return prop.sm;
359
+ if (prop.xs !== undefined && bpXsUp)
360
+ return prop.xs;
361
+ // Fallback: return undefined if no breakpoint matches
362
+ return undefined;
363
+ }, [bpSmUp, bpMdUp, bpLgUp, bpXlUp, bpXxlUp, bpXsUp]);
364
+ return { responsivePropValue };
365
+ }
366
+
367
+ function DIconBase({ icon, color, style, className, size, useListenerSize = false, hasCircle = false, materialStyle = false, familyClass, familyPrefix, strokeWidth = 2, dataAttributes, }) {
368
+ // If materialStyle is true, use Material Design icons (legacy)
369
+ const useMaterialIcons = materialStyle;
370
+ // Get Lucide icon component
371
+ const LucideIcon = useMemo(() => {
372
+ if (useMaterialIcons)
373
+ return null;
374
+ // Try to find the icon in Lucide (expects PascalCase)
375
+ const icons = LucideIcons;
376
+ return icons[icon] || null;
377
+ }, [icon, useMaterialIcons]);
378
+ const colorStyle = useMemo(() => {
379
+ if (color) {
380
+ return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${color})` };
381
+ }
382
+ return {};
383
+ }, [color]);
384
+ const backgroundStyle = useMemo(() => {
385
+ if (hasCircle) {
386
+ if (color) {
387
+ return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${color}-rgb), 0.1)` };
388
+ }
389
+ return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}body-color-rgb), 0.1)` };
390
+ }
391
+ return {};
392
+ }, [hasCircle, color]);
393
+ const { responsivePropValue } = useResponsiveProp(useListenerSize);
394
+ const resolvedSize = useMemo(() => {
395
+ if (!size)
396
+ return undefined;
397
+ if (typeof size === 'string')
398
+ return size;
399
+ return responsivePropValue(size);
400
+ }, [responsivePropValue, size]);
401
+ const generateStyleVariables = useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, resolvedSize && { [`--${PREFIX_BS}icon-component-size`]: resolvedSize }), colorStyle), backgroundStyle), hasCircle && { [`--${PREFIX_BS}icon-component-padding`]: `calc(var(--${PREFIX_BS}icon-component-size, 24px) * 0.4)` }), style)), [resolvedSize, colorStyle, backgroundStyle, hasCircle, style]);
402
+ const generateClasses = useMemo(() => (Object.assign({ 'd-icon': true }, className && { [className]: true })), [className]);
403
+ const iconSize = useMemo(() => {
404
+ if (resolvedSize) {
405
+ const numSize = parseInt(resolvedSize, 10);
406
+ return !Number.isNaN(numSize) ? numSize : resolvedSize;
407
+ }
408
+ return undefined;
409
+ }, [resolvedSize]);
410
+ // Render Material Design icon (legacy support)
411
+ if (useMaterialIcons) {
412
+ return (jsx("i", Object.assign({ className: classNames(generateClasses, familyClass), style: generateStyleVariables }, dataAttributes, { children: icon })));
413
+ }
414
+ // Render Lucide icon
415
+ if (!LucideIcon) {
416
+ if (familyClass && familyPrefix) {
417
+ return (jsx("i", Object.assign({ className: classNames(generateClasses, familyClass, `${familyPrefix}${icon}`), style: generateStyleVariables }, dataAttributes)));
418
+ }
419
+ // eslint-disable-next-line no-console
420
+ console.warn(`Icon "${icon}" not found in Lucide. Make sure to use PascalCase names (e.g., "Home", "User", "Settings")`);
421
+ return (jsx("span", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: "?" })));
422
+ }
423
+ return (jsx("span", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: jsx(LucideIcon, { size: iconSize || 24, strokeWidth: strokeWidth }) })));
424
+ }
425
+
322
426
  function DIcon(_a) {
323
427
  var { familyClass: propFamilyClass, familyPrefix: propFamilyPrefix, materialStyle: propMaterialStyle } = _a, props = __rest(_a, ["familyClass", "familyPrefix", "materialStyle"]);
324
428
  const { icon: { familyClass, familyPrefix, materialStyle, }, } = useDContext();
325
429
  return (jsx(DIconBase, Object.assign({ familyClass: propFamilyClass || familyClass, familyPrefix: propFamilyPrefix || familyPrefix, materialStyle: propMaterialStyle || materialStyle }, props)));
326
430
  }
327
431
 
328
- function DAlert({ theme = 'success', icon: iconProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle = false, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle = false, showClose, onClose, children, id, className, style, dataAttributes, }) {
432
+ function DAlert({ color = 'success', icon: iconProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle = false, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle = false, showClose, onClose, children, id, className, style, dataAttributes, }) {
329
433
  const { iconMap: { alert, xLg, }, } = useDContext();
330
- const icon = useMemo(() => iconProp || alert[theme], [alert, iconProp, theme]);
434
+ const icon = useMemo(() => iconProp || alert[color], [alert, iconProp, color]);
331
435
  const iconClose = useMemo(() => (iconCloseProp || xLg), [iconCloseProp, xLg]);
332
- const generateClasses = useMemo(() => (Object.assign({ alert: true, [`alert-${theme}`]: true, 'fade show': !!showClose }, className && { [className]: true })), [theme, showClose, className]);
436
+ const generateClasses = useMemo(() => (Object.assign({ alert: true, [`alert-${color}`]: true, 'fade show': !!showClose }, className && { [className]: true })), [color, showClose, className]);
333
437
  return (jsxs("div", Object.assign({ className: classNames(generateClasses), style: style, role: "alert", id: id }, dataAttributes, { children: [icon && (jsx(DIcon, { className: "alert-icon", icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsx("div", { className: "alert-text", children: children }), showClose && (jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: iconClose, familyClass: iconCloseFamilyClass, familyPrefix: iconCloseFamilyPrefix, materialStyle: iconCloseMaterialStyle }) }))] })));
334
438
  }
335
439
 
336
- function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, theme = 'secondary', variant, className, style, dataAttributes, }) {
337
- const generateClasses = useMemo(() => {
338
- const variantClass = variant
339
- ? `d-avatar-${variant}-${theme}`
340
- : `d-avatar-${theme}`;
341
- return {
342
- 'd-avatar': true,
343
- [variantClass]: true,
344
- [`d-avatar-${size}`]: !!size,
345
- };
346
- }, [variant, theme, size]);
440
+ function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, className, style, dataAttributes, }) {
441
+ const generateClasses = useMemo(() => ({
442
+ 'd-avatar': true,
443
+ [`d-avatar-${size}`]: !!size,
444
+ }), [size]);
347
445
  const name = useMemo(() => {
348
446
  if (!nameProp) {
349
447
  return undefined;
@@ -356,16 +454,21 @@ function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, t
356
454
  return (jsxs("div", Object.assign({ className: classNames(generateClasses, className), style: style, id: id }, dataAttributes, { children: [image && jsx("img", { src: image, alt: nameProp, className: "d-avatar-img" }), (name && !image) && jsx("span", { className: "d-avatar-name", children: name })] })));
357
455
  }
358
456
 
359
- function DBadge({ text, soft = false, theme = 'primary', id, rounded, className, style, iconStart, iconEnd, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, dataAttributes, }) {
457
+ function DBadge({ text, soft = false, color = 'primary', id, rounded, className, size, style, iconStart, iconEnd, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, dataAttributes, }) {
360
458
  const generateClasses = useMemo(() => ({
361
459
  badge: true,
362
- [`badge-${theme}`]: !!theme && !soft,
363
- [`badge-soft-${theme}`]: !!theme && soft,
460
+ [`badge-${color}`]: !!color && !soft,
461
+ [`badge-soft-${color}`]: !!color && soft,
364
462
  'rounded-pill': !!rounded,
365
- }), [rounded, soft, theme]);
463
+ [`badge-${size}`]: !!size,
464
+ }), [rounded, soft, color, size]);
366
465
  return (jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, dataAttributes, { children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsx("span", { children: text }), iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }))] })));
367
466
  }
368
467
 
468
+ function DBox({ className, style, children, dataAttributes, }) {
469
+ return (jsx("div", Object.assign({ style: style, className: classNames('d-box', className) }, dataAttributes, { children: children })));
470
+ }
471
+
369
472
  /* eslint-disable */
370
473
  /**
371
474
  * This file is originally from `@primer/react`
@@ -387,7 +490,7 @@ function useProvidedRefOrCreate(providedRef) {
387
490
  }
388
491
 
389
492
  function DInput(_a, ref) {
390
- var { id: idProp, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, labelIconMaterialStyle, disabled = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconStart, iconStartDisabled, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconStartMaterialStyle, iconEnd, iconEndDisabled, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, iconEndMaterialStyle, hint, size, invalid = false, valid = false, floatingLabel = false, inputStart, inputEnd, value, placeholder = '', dataAttributes, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = __rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "labelIconMaterialStyle", "disabled", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "iconStart", "iconStartDisabled", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconStartMaterialStyle", "iconEnd", "iconEndDisabled", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "iconEndMaterialStyle", "hint", "size", "invalid", "valid", "floatingLabel", "inputStart", "inputEnd", "value", "placeholder", "dataAttributes", "onChange", "onIconStartClick", "onIconEndClick"]);
493
+ var { id: idProp, style, className, label = '', disabled = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconStart, iconStartDisabled, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconStartMaterialStyle, iconEnd, iconEndDisabled, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, iconEndMaterialStyle, hint, size, invalid = false, valid = false, floatingLabel = false, inputStart, inputEnd, value, placeholder = '', dataAttributes, readonly, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = __rest(_a, ["id", "style", "className", "label", "disabled", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "iconStart", "iconStartDisabled", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconStartMaterialStyle", "iconEnd", "iconEndDisabled", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "iconEndMaterialStyle", "hint", "size", "invalid", "valid", "floatingLabel", "inputStart", "inputEnd", "value", "placeholder", "dataAttributes", "readonly", "onChange", "onIconStartClick", "onIconEndClick"]);
391
494
  const inputRef = useProvidedRefOrCreate(ref);
392
495
  const innerId = useId();
393
496
  const id = useMemo(() => idProp || innerId, [idProp, innerId]);
@@ -424,7 +527,7 @@ function DInput(_a, ref) {
424
527
  const inputComponent = useMemo(() => (jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
425
528
  'is-invalid': invalid,
426
529
  'is-valid': valid,
427
- }), disabled: disabled || loading, value: value, onChange: handleOnChange }, (floatingLabel || placeholder) && { placeholder: floatingLabel ? '' : placeholder }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
530
+ }), disabled: disabled || loading, readOnly: readonly, value: value, onChange: handleOnChange }, (floatingLabel || placeholder) && { placeholder: floatingLabel ? '' : placeholder }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
428
531
  ariaDescribedby,
429
532
  disabled,
430
533
  handleOnChange,
@@ -437,14 +540,11 @@ function DInput(_a, ref) {
437
540
  floatingLabel,
438
541
  valid,
439
542
  value,
543
+ readonly,
440
544
  ]);
441
- const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix, materialStyle: labelIconMaterialStyle }))] })), [
545
+ const labelComponent = useMemo(() => (jsx("label", { htmlFor: id, children: label })), [
442
546
  id,
443
547
  label,
444
- labelIcon,
445
- labelIconFamilyClass,
446
- labelIconFamilyPrefix,
447
- labelIconMaterialStyle,
448
548
  ]);
449
549
  const dynamicComponent = useMemo(() => {
450
550
  if (floatingLabel) {
@@ -573,7 +673,7 @@ async function urlToFile(url) {
573
673
  null,
574
674
  {
575
675
  code: ErrorCodes.FailedFetch,
576
- message: `Failed to fetch file from ${url}`,
676
+ message: `Failed to fetch file from ${url} (HTTP ${res.status})`,
577
677
  },
578
678
  ];
579
679
  }
@@ -583,11 +683,13 @@ async function urlToFile(url) {
583
683
  return [file, null];
584
684
  }
585
685
  catch (error) {
686
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
687
+ const isCorsError = errorMessage.includes('CORS') || errorMessage.includes('Failed to fetch');
586
688
  return [
587
689
  null,
588
690
  {
589
691
  code: ErrorCodes.FailedFetch,
590
- message: `Failed to fetch file from ${url}}`,
692
+ message: `Failed to fetch file from ${url}${isCorsError ? ' (CORS error - file may not be accessible from this domain)' : ` (${errorMessage})`}`,
591
693
  },
592
694
  ];
593
695
  }
@@ -853,43 +955,77 @@ function DBoxFile(_a) {
853
955
  const { iconMap: { upload } } = useDContext();
854
956
  const icon = useMemo(() => iconProp || upload, [iconProp, upload]);
855
957
  const { inputRef, rootRef, isDragValid, isDragInvalid, acceptAttr, files, handleFileSelect, handleDrop, handleDragEnter, handleDragLeave, handleClick, handleKeyDown, handleRemoveFile, openFileDialog, } = useDBoxFile(props);
856
- return (jsxs(Fragment$1, { children: [jsx("section", Object.assign({ className: classNames('d-box-file', {
958
+ return (jsxs(Fragment, { children: [jsx("section", Object.assign({ className: classNames('d-box-file', {
857
959
  'd-box-file-selected': files.length > 0,
858
960
  'd-box-file-disabled': props.disabled,
859
961
  'd-box-file-valid': isDragValid,
860
962
  'd-box-file-invalid': isDragInvalid,
861
- }, className), style: style }, dataAttributes, { children: jsxs("div", Object.assign({ className: "d-box-file-dropzone", ref: rootRef, onDragEnter: handleDragEnter, onDragOver: (e) => e.preventDefault(), onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: handleClick, onKeyDown: handleKeyDown }, (!props.disabled && !props.noKeyboard ? { tabIndex: 0 } : {}), { role: "presentation", children: [jsx("input", { type: "file", multiple: props.multiple, style: { display: 'none' }, ref: inputRef, disabled: props.disabled, onChange: handleFileSelect, onClick: (e) => e.stopPropagation(), tabIndex: -1, accept: acceptAttr }), jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }), jsx("div", { className: "d-box-content", children: typeof children === 'function'
963
+ }, className), style: style }, dataAttributes, { children: jsxs("div", Object.assign({ className: "d-box-file-dropzone", ref: rootRef, onDragEnter: handleDragEnter, onDragOver: (e) => e.preventDefault(), onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: handleClick, onKeyDown: handleKeyDown }, (!props.disabled && !props.noKeyboard ? { tabIndex: 0 } : {}), { role: "presentation", children: [jsx("input", { type: "file", multiple: props.multiple, style: { display: 'none' }, ref: inputRef, disabled: props.disabled, onChange: handleFileSelect, onClick: (e) => e.stopPropagation(), tabIndex: -1, accept: acceptAttr }), icon && iconProp !== false && (jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsx("div", { className: "d-box-content", children: typeof children === 'function'
862
964
  ? children(openFileDialog)
863
- : children })] })) })), !!files.length && (jsx("ul", { className: "d-box-files", children: files.map((file, index) => (jsx(ForwardedDInput, { value: file.name, iconStart: "paperclip", iconEnd: "trash", readOnly: true, onIconEndClick: () => handleRemoveFile(index) }, `${file.name} ${index}`))) }))] }));
965
+ : children || (jsx("p", { className: "text-center m-0", children: "Drag and drop some files here, or click to select files" })) })] })) })), !!files.length && (jsx("ul", { className: "d-box-files", children: files.map((file, index) => (jsx(ForwardedDInput, { value: file.name, iconStart: "Paperclip", iconEnd: "Trash", readOnly: true, onIconEndClick: () => handleRemoveFile(index) }, `${file.name} ${index}`))) }))] }));
864
966
  }
865
967
 
866
- function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, value, type = 'button', loading = false, loadingAriaLabel, disabled = false, stopPropagationEnabled = true, className, style, form, dataAttributes, onClick, }) {
867
- const generateClasses = useMemo(() => {
968
+ const DButton = forwardRef((props, ref) => {
969
+ const { color = 'primary', size, variant, text, children, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, loading = false, loadingText, loadingAriaLabel, disabled = false, className, style, dataAttributes, onClick, type = 'button' } = props, rest = __rest(props, ["color", "size", "variant", "text", "children", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartMaterialStyle", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndMaterialStyle", "loading", "loadingText", "loadingAriaLabel", "disabled", "className", "style", "dataAttributes", "onClick", "type"]);
970
+ const [buttonWidth, setButtonWidth] = useState();
971
+ const buttonRef = useRef(null);
972
+ const isDisabled = useMemo(() => disabled || loading, [disabled, loading]);
973
+ const content = useMemo(() => children || text, [children, text]);
974
+ const classes = useMemo(() => {
868
975
  const variantClass = variant
869
- ? `btn-${variant}-${theme}`
870
- : `btn-${theme}`;
871
- return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
872
- }, [variant, theme, size, state, loading]);
873
- const clickHandler = useCallback((event) => {
874
- if (stopPropagationEnabled) {
875
- event.stopPropagation();
976
+ ? `btn-${variant}-${color}`
977
+ : `btn-${color}`;
978
+ return {
979
+ btn: true,
980
+ [variantClass]: true,
981
+ [`btn-${size}`]: !!size,
982
+ loading,
983
+ };
984
+ }, [variant, color, size, loading]);
985
+ const ariaLabel = useMemo(() => {
986
+ const ariaLabelProp = rest['aria-label'];
987
+ return loading
988
+ ? loadingAriaLabel || ariaLabelProp || text
989
+ : ariaLabelProp || text;
990
+ }, [loading, loadingAriaLabel, rest, text]);
991
+ const handleClick = useCallback((event) => {
992
+ if (disabled || loading) {
993
+ event.preventDefault();
994
+ return;
876
995
  }
877
996
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
878
- }, [stopPropagationEnabled, onClick]);
879
- const isDisabled = useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
880
- const newAriaLabel = useMemo(() => (loading
881
- ? (loadingAriaLabel || ariaLabel || text)
882
- : (ariaLabel || text)), [loading, loadingAriaLabel, ariaLabel, text]);
883
- return (jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: style, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel, form: form }, dataAttributes, value && { value }, { children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })), (text && !loading) && (jsx("span", { children: text })), loading && (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, materialStyle: iconEndMaterialStyle }))] })));
884
- }
997
+ }, [disabled, loading, onClick]);
998
+ useEffect(() => {
999
+ if (!loading && buttonRef.current) {
1000
+ const width = buttonRef.current.offsetWidth;
1001
+ if (width > 0)
1002
+ setButtonWidth(width);
1003
+ }
1004
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1005
+ }, [content, iconEnd, iconStart]);
1006
+ return (jsxs("button", Object.assign({ ref: (node) => {
1007
+ buttonRef.current = node;
1008
+ if (typeof ref === 'function')
1009
+ ref(node);
1010
+ // eslint-disable-next-line max-len
1011
+ // eslint-disable-next-line no-param-reassign, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
1012
+ else if (ref)
1013
+ ref.current = node;
1014
+ },
1015
+ // eslint-disable-next-line react/button-has-type
1016
+ type: type, className: classNames(classes, className), style: Object.assign(Object.assign({}, style), (loading && buttonWidth
1017
+ ? { minWidth: `${buttonWidth}px` }
1018
+ : undefined)), disabled: isDisabled, "aria-label": ariaLabel, "aria-busy": loading, "aria-disabled": isDisabled, onClick: handleClick }, dataAttributes, rest, { children: [loading && (jsxs("span", { className: "btn-loading", children: [jsx("span", { className: "spinner-border spinner-border-sm", "aria-hidden": "true" }), loadingText && jsx("span", { role: "status", children: loadingText })] })), !loading && (jsxs(Fragment, { children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })), content, iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }))] }))] })));
1019
+ });
1020
+ DButton.displayName = 'DButton';
885
1021
 
886
- function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel, theme = 'primary', type = 'button', loading = false, disabled = false, stopPropagationEnabled = true, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, }) {
1022
+ function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel, color = 'primary', type = 'button', loading = false, disabled = false, stopPropagationEnabled = true, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, }) {
887
1023
  const generateClasses = useMemo(() => {
888
1024
  const variantClass = variant
889
- ? `btn-${variant}-${theme}`
890
- : `btn-${theme}`;
1025
+ ? `btn-${variant}-${color}`
1026
+ : `btn-${color}`;
891
1027
  return Object.assign(Object.assign(Object.assign({ 'btn d-button-icon': true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
892
- }, [variant, theme, size, state, loading]);
1028
+ }, [variant, color, size, state, loading]);
893
1029
  const clickHandler = useCallback((event) => {
894
1030
  if (stopPropagationEnabled) {
895
1031
  event.stopPropagation();
@@ -950,11 +1086,11 @@ var DCarousel$1 = Object.assign(ForwardedDCarousel, {
950
1086
  Slide: DCarouselSlide,
951
1087
  });
952
1088
 
953
- function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle, showClose = false, closeAriaLabel = 'close', className, style, dataAttributes, onClose, }) {
1089
+ function DChip({ color = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle, showClose = false, closeAriaLabel = 'close', className, style, dataAttributes, onClose, }) {
954
1090
  const generateClasses = useMemo(() => ({
955
1091
  'd-chip': true,
956
- [`d-chip-${theme}`]: !!theme,
957
- }), [theme]);
1092
+ [`d-chip-${color}`]: !!color,
1093
+ }), [color]);
958
1094
  const { iconMap: { xLg, }, } = useDContext();
959
1095
  const iconClose = useMemo(() => iconCloseProp || xLg, [iconCloseProp, xLg]);
960
1096
  return (jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, dataAttributes, { children: [icon && (jsx("div", { className: "d-chip-icon-container", children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), jsx("span", { children: text }), showClose && (jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, "aria-label": closeAriaLabel, children: jsx(DIcon, { icon: iconClose, familyClass: iconCloseFamilyClass, familyPrefix: iconCloseFamilyPrefix, materialStyle: iconCloseMaterialStyle }) }))] })));
@@ -977,7 +1113,7 @@ function DCollapse({ id, className, style, Component, hasSeparator = false, defa
977
1113
  const generateStyles = useMemo(() => ({
978
1114
  [`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
979
1115
  }), [hasSeparator]);
980
- return (jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { 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}fs-small)`, icon: collapsed ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), !collapsed && (jsx("div", { className: classNames({
1116
+ return (jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { children: [jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsx("div", { className: "flex-grow-1", children: Component }), jsx(DIcon, { color: "gray", size: "1rem", icon: collapsed ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), !collapsed && (jsx("div", { className: classNames({
981
1117
  'collapse-body': true,
982
1118
  }), style: generateStyles, children: children }))] })));
983
1119
  }
@@ -1016,7 +1152,7 @@ const ForwardedDDatePickerInput = forwardRef(DDatePickerInput);
1016
1152
  ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
1017
1153
 
1018
1154
  function DInputCheck(_a) {
1019
- var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, value, hint, onChange, className, style, dataAttributes } = _a, props = __rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "value", "hint", "onChange", "className", "style", "dataAttributes"]);
1155
+ var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, inputClassName, value, hint, onChange, className, style, dataAttributes } = _a, props = __rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "inputClassName", "value", "hint", "onChange", "className", "style", "dataAttributes"]);
1020
1156
  const innerRef = useRef(null);
1021
1157
  const innerId = useId();
1022
1158
  const id = useMemo(() => idProp || innerId, [idProp, innerId]);
@@ -1044,11 +1180,11 @@ function DInputCheck(_a) {
1044
1180
  const inputComponent = useMemo(() => (jsx("input", Object.assign({ ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
1045
1181
  'is-invalid': invalid,
1046
1182
  'is-valid': valid,
1047
- }, className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, props))), [
1183
+ }, inputClassName), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, props))), [
1048
1184
  handleChange,
1049
1185
  invalid,
1050
1186
  valid,
1051
- className,
1187
+ inputClassName,
1052
1188
  style,
1053
1189
  id,
1054
1190
  disabled,
@@ -1062,7 +1198,7 @@ function DInputCheck(_a) {
1062
1198
  if (!label) {
1063
1199
  return inputComponent;
1064
1200
  }
1065
- return (jsxs("div", Object.assign({ className: "form-check" }, dataAttributes, { children: [inputComponent, jsx("label", { className: "form-check-label", htmlFor: id, children: label }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
1201
+ return (jsxs("div", Object.assign({ className: classNames('form-check', className) }, dataAttributes, { children: [inputComponent, jsx("label", { className: "form-check-label", htmlFor: id, children: label }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
1066
1202
  }
1067
1203
 
1068
1204
  function DSelectOptionCheck(_a) {
@@ -1141,7 +1277,7 @@ function DSelectPlaceholder(_a) {
1141
1277
  }
1142
1278
 
1143
1279
  function DSelect(_a) {
1144
- var { id: idProp, className, style, label, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, floatingLabel = false, rtl, searchable, multi, components, defaultValue, placeholder, onIconStartClick, onIconEndClick, dataAttributes } = _a, props = __rest(_a, ["id", "className", "style", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "floatingLabel", "rtl", "searchable", "multi", "components", "defaultValue", "placeholder", "onIconStartClick", "onIconEndClick", "dataAttributes"]);
1280
+ var { id: idProp, className, style, label, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, floatingLabel = false, rtl, searchable, multi, components, defaultValue, placeholder, onIconStartClick, onIconEndClick, dataAttributes } = _a, props = __rest(_a, ["id", "className", "style", "label", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "floatingLabel", "rtl", "searchable", "multi", "components", "defaultValue", "placeholder", "onIconStartClick", "onIconEndClick", "dataAttributes"]);
1145
1281
  const innerId = useId();
1146
1282
  const id = useMemo(() => idProp || innerId, [idProp, innerId]);
1147
1283
  const handleOnIconStartClick = useCallback(() => {
@@ -1153,7 +1289,7 @@ function DSelect(_a) {
1153
1289
  return (jsxs("div", Object.assign({ className: classNames('d-select', className, {
1154
1290
  'd-select-floating': floatingLabel,
1155
1291
  disabled: disabled || loading,
1156
- }), style: style }, dataAttributes, { children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: classNames({
1292
+ }), style: style }, dataAttributes, { children: [label && (jsx("label", { htmlFor: id, children: label })), jsxs("div", { className: classNames({
1157
1293
  'input-group': true,
1158
1294
  'has-validation': invalid,
1159
1295
  disabled: disabled || loading,
@@ -1187,7 +1323,7 @@ var PickerType;
1187
1323
  PickerType["Month"] = "month";
1188
1324
  PickerType["Year"] = "year";
1189
1325
  })(PickerType || (PickerType = {}));
1190
- function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMonth, increaseMonth, decreaseYear, increaseYear, monthDate, pickerType, prevMonthButtonDisabled, nextMonthButtonDisabled, monthsShown = 1, iconPrev, iconNext, prevYearButtonDisabled, nextYearButtonDisabled, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle = false, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', prevYearAriaLabel = 'decrease year', nextYearAriaLabel = 'increase year', iconSize, buttonVariant = 'link', buttonTheme = 'dark', style, className, minYearSelect = 1900, maxYearSelect = 2100, showHeaderSelectors = false, customHeaderCount, locale, }) {
1326
+ function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMonth, increaseMonth, decreaseYear, increaseYear, monthDate, pickerType, prevMonthButtonDisabled, nextMonthButtonDisabled, monthsShown = 1, iconPrev, iconNext, prevYearButtonDisabled, nextYearButtonDisabled, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', prevYearAriaLabel = 'decrease year', nextYearAriaLabel = 'increase year', iconSize, style, className, minYearSelect = 1900, maxYearSelect = 2100, showHeaderSelectors = false, customHeaderCount, locale, }) {
1191
1327
  const { iconMap: { chevronLeft, chevronRight, }, } = useDContext();
1192
1328
  const arrayYears = useMemo(() => Array.from({ length: maxYearSelect - minYearSelect + 1 }, (_, index) => minYearSelect + index), [maxYearSelect, minYearSelect]);
1193
1329
  const years = useMemo(() => arrayYears.map((year) => ({
@@ -1212,16 +1348,16 @@ function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMont
1212
1348
  }, [date]);
1213
1349
  const [startYear, endYear] = getYearRange();
1214
1350
  if (pickerType === PickerType.Year) {
1215
- return (jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsx(DButton, { iconStart: iconPrev || chevronLeft, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseYear, disabled: prevYearButtonDisabled, ariaLabel: prevYearAriaLabel, className: "header-button" }), jsx("p", { children: `${startYear} - ${endYear}` }), jsx(DButton, { iconStart: iconNext || chevronRight, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseYear, disabled: nextYearButtonDisabled, ariaLabel: nextYearAriaLabel, className: "header-button" })] }));
1351
+ return (jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevYearButtonDisabled, ariaLabel: prevYearAriaLabel, className: "header-button" }), jsx("p", { children: `${startYear} - ${endYear}` }), jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextYearButtonDisabled, ariaLabel: nextYearAriaLabel, className: "header-button" })] }));
1216
1352
  }
1217
1353
  if (pickerType === PickerType.Quarter || pickerType === PickerType.Month) {
1218
- return (jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsx(DButton, { iconStart: iconPrev || chevronLeft, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseYear, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), jsx("div", { className: "d-flex justify-content-center flex-grow-1", children: showHeaderSelectors ? (jsx(DSelect$1, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })) : (jsx("p", { children: defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label })) }), jsx(DButton, { iconStart: iconNext || chevronRight, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseYear, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] }));
1354
+ return (jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), jsx("div", { className: "d-flex justify-content-center flex-grow-1", children: showHeaderSelectors ? (jsx(DSelect$1, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })) : (jsx("p", { children: defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label })) }), jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] }));
1219
1355
  }
1220
- return (jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [jsx(DButton, { iconStart: iconPrev || chevronLeft, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseMonth, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), showHeaderSelectors ? (jsxs(Fragment$1, { children: [jsx(DSelect$1, { options: months, value: defaultMonth, defaultValue: defaultMonth, onChange: (month) => changeMonth((month === null || month === void 0 ? void 0 : month.value) || 0), searchable: false, className: "custom-month-selector" }), jsx(DSelect$1, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false, className: "custom-year-selector" })] })) : (jsx("p", { children: `${defaultMonth.label} ${defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label}` })), jsx(DButton, { iconStart: iconNext || chevronRight, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] }));
1356
+ return (jsxs(Fragment, { children: [jsxs("div", { className: "datepicker-top-header", children: [showHeaderSelectors && (jsx(DSelect$1, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false, className: "custom-year-selector" })), jsx("h4", { className: "mb-0 fw-normal", children: format(monthDate, 'LLLL, dd', { locale }) })] }), jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseMonth, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), showHeaderSelectors ? (jsx(DSelect$1, { options: months, value: defaultMonth, defaultValue: defaultMonth, onChange: (month) => changeMonth((month === null || month === void 0 ? void 0 : month.value) || 0), searchable: false, className: "custom-month-selector" })) : (jsx("p", { children: `${defaultMonth.label} ${defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label}` })), jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] })] }));
1221
1357
  }
1222
1358
 
1223
1359
  function DDatePicker(_a) {
1224
- var { inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeInputLabel, iconInput, iconHeaderPrev, iconHeaderNext, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, minYearSelect, maxYearSelect, iconHeaderSize, headerPrevMonthAriaLabel, headerNextMonthAriaLabel, headerButtonVariant, headerButtonTheme, invalid = false, valid = false, renderCustomHeader: renderCustomHeaderProp, className, dateFormatCalendar: dateFormatCalendarProp, style, dataAttributes, placeholder, showHeaderSelectors } = _a, props = __rest(_a, ["inputLabel", "inputHint", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeInputLabel", "iconInput", "iconHeaderPrev", "iconHeaderNext", "iconMaterialStyle", "iconFamilyClass", "iconFamilyPrefix", "minYearSelect", "maxYearSelect", "iconHeaderSize", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "headerButtonVariant", "headerButtonTheme", "invalid", "valid", "renderCustomHeader", "className", "dateFormatCalendar", "style", "dataAttributes", "placeholder", "showHeaderSelectors"]);
1360
+ var { inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeInputLabel, minYearSelect, maxYearSelect, iconHeaderSize, iconMaterialStyle, iconInput, headerPrevMonthAriaLabel, headerNextMonthAriaLabel, invalid = false, valid = false, renderCustomHeader: renderCustomHeaderProp, className, dateFormatCalendar: dateFormatCalendarProp, style, dataAttributes, placeholder, showHeaderSelectors } = _a, props = __rest(_a, ["inputLabel", "inputHint", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeInputLabel", "minYearSelect", "maxYearSelect", "iconHeaderSize", "iconMaterialStyle", "iconInput", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "invalid", "valid", "renderCustomHeader", "className", "dateFormatCalendar", "style", "dataAttributes", "placeholder", "showHeaderSelectors"]);
1225
1361
  const pickerType = useMemo(() => {
1226
1362
  if (props.showQuarterYearPicker)
1227
1363
  return PickerType.Quarter;
@@ -1235,15 +1371,10 @@ function DDatePicker(_a) {
1235
1371
  props.showMonthYearPicker,
1236
1372
  props.showYearPicker,
1237
1373
  ]);
1238
- const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeaderSelector, Object.assign({}, headerProps, { monthsShown: props.monthsShown, iconPrev: iconHeaderPrev, iconNext: iconHeaderNext, iconMaterialStyle: iconMaterialStyle, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize: iconHeaderSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, minYearSelect: minYearSelect, maxYearSelect: maxYearSelect, pickerType: pickerType, showHeaderSelectors: showHeaderSelectors, locale: props.locale }))), [
1239
- iconHeaderNext,
1240
- iconHeaderPrev,
1241
- iconMaterialStyle,
1374
+ const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeaderSelector, Object.assign({}, headerProps, { monthsShown: props.monthsShown, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize: iconHeaderSize, minYearSelect: minYearSelect, maxYearSelect: maxYearSelect, pickerType: pickerType, showHeaderSelectors: showHeaderSelectors, locale: props.locale }))), [
1242
1375
  headerPrevMonthAriaLabel,
1243
1376
  headerNextMonthAriaLabel,
1244
1377
  iconHeaderSize,
1245
- headerButtonVariant,
1246
- headerButtonTheme,
1247
1378
  minYearSelect,
1248
1379
  maxYearSelect,
1249
1380
  pickerType,
@@ -1256,6 +1387,33 @@ function DDatePicker(_a) {
1256
1387
  return (jsx(DatePicker, Object.assign({}, dataAttributes, props, { calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, placeholderText: placeholder, customInput: (jsx(ForwardedDDatePickerInput, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyle, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, hint: inputHint })), customTimeInput: (jsx(DDatePickerTime, { id: timeId })) })));
1257
1388
  }
1258
1389
 
1390
+ function DLayoutPane({ className, style, children, cols, colsXs, colsSm, colsMd, colsLg, colsXl, colsXxl, dataAttributes, }) {
1391
+ const colsClass = cols ? `g-col-${cols}` : undefined;
1392
+ const colsXsClass = colsXs ? `g-col-${colsXs}` : undefined;
1393
+ const colsSmClass = colsSm ? `g-col-sm-${colsSm}` : undefined;
1394
+ const colsMdClass = colsMd ? `g-col-md-${colsMd}` : undefined;
1395
+ const colsLgClass = colsLg ? `g-col-lg-${colsLg}` : undefined;
1396
+ const colsXlClass = colsXl ? `g-col-xl-${colsXl}` : undefined;
1397
+ const colsXxlClass = colsXxl ? `g-col-xxl-${colsXxl}` : undefined;
1398
+ return (jsx("div", Object.assign({ className: classNames(colsClass, colsXsClass, colsSmClass, colsMdClass, colsLgClass, colsXlClass, colsXxlClass, className), style: style }, dataAttributes, { children: children })));
1399
+ }
1400
+
1401
+ function DLayout({ className, style, children, gap, columns, gapSm, gapMd, gapLg, gapXl, gapXxl, dataAttributes, }) {
1402
+ const gapClasses = classNames({
1403
+ [`gap-${gap}`]: gap !== undefined,
1404
+ [`gap-sm-${gapSm}`]: gapSm !== undefined,
1405
+ [`gap-md-${gapMd}`]: gapMd !== undefined,
1406
+ [`gap-lg-${gapLg}`]: gapLg !== undefined,
1407
+ [`gap-xl-${gapXl}`]: gapXl !== undefined,
1408
+ [`gap-xxl-${gapXxl}`]: gapXxl !== undefined,
1409
+ });
1410
+ const styleWithColumns = Object.assign(Object.assign({}, style), { '--bs-columns': columns });
1411
+ return (jsx("div", Object.assign({ style: styleWithColumns, className: classNames('grid', gapClasses, className) }, dataAttributes, { children: children })));
1412
+ }
1413
+ var DLayout$1 = Object.assign(DLayout, {
1414
+ Pane: DLayoutPane,
1415
+ });
1416
+
1259
1417
  function DInputMask(props, ref) {
1260
1418
  return (jsx(InputMask, Object.assign({ ref: ref, component: ForwardedDInput }, props)));
1261
1419
  }
@@ -1360,47 +1518,6 @@ function useItemSelection({ getItemIdentifier: getItemIdentifierProp, previousSe
1360
1518
  };
1361
1519
  }
1362
1520
 
1363
- function subscribeToMediaQuery(query, callback) {
1364
- const mediaQueryList = window.matchMedia(query);
1365
- mediaQueryList.addEventListener('change', callback);
1366
- return () => {
1367
- mediaQueryList.removeEventListener('change', callback);
1368
- };
1369
- }
1370
- function checkMediaQuery(query) {
1371
- return window.matchMedia(query).matches;
1372
- }
1373
-
1374
- function useMediaQuery(mediaQuery, useListener = false) {
1375
- /* eslint-disable-next-line @typescript-eslint/no-unused-vars */
1376
- const noop = (_) => () => { };
1377
- return useSyncExternalStore(useListener ? (cb) => subscribeToMediaQuery(mediaQuery, cb) : noop, () => (mediaQuery ? checkMediaQuery(mediaQuery) : true), () => false);
1378
- }
1379
-
1380
- function useMediaBreakpointUp(breakpoint, useListener = false) {
1381
- const { breakpoints } = useDContext();
1382
- const mediaQuery = useMemo(() => (`(min-width: ${breakpoints[breakpoint]})`), [breakpoint, breakpoints]);
1383
- return useMediaQuery(mediaQuery, useListener);
1384
- }
1385
- function useMediaBreakpointUpXs(useListener = false) {
1386
- return useMediaBreakpointUp('xs', useListener);
1387
- }
1388
- function useMediaBreakpointUpSm(useListener = false) {
1389
- return useMediaBreakpointUp('sm', useListener);
1390
- }
1391
- function useMediaBreakpointUpMd(useListener = false) {
1392
- return useMediaBreakpointUp('md', useListener);
1393
- }
1394
- function useMediaBreakpointUpLg(useListener = false) {
1395
- return useMediaBreakpointUp('lg', useListener);
1396
- }
1397
- function useMediaBreakpointUpXl(useListener = false) {
1398
- return useMediaBreakpointUp('xl', useListener);
1399
- }
1400
- function useMediaBreakpointUpXxl(useListener = false) {
1401
- return useMediaBreakpointUp('xxl', useListener);
1402
- }
1403
-
1404
1521
  function DInputCounter(_a, ref) {
1405
1522
  var { minValue, maxValue, value = minValue, invalid, iconStart: iconStartProp, iconEnd: iconEndProp, iconStartAriaLabel = 'decrease action', iconEndAriaLabel = 'increase action', style, onChange } = _a, props = __rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "iconStartAriaLabel", "iconEndAriaLabel", "style", "onChange"]);
1406
1523
  const { handleOnWheel, } = useDisableInputWheel(ref);
@@ -1439,18 +1556,6 @@ function DInputCounter(_a, ref) {
1439
1556
  const ForwardedDInputCounter = forwardRef(DInputCounter);
1440
1557
  ForwardedDInputCounter.displayName = 'DInputCounter';
1441
1558
 
1442
- /**
1443
- * @deprecated
1444
- */
1445
- function DInputCurrencyBase(_a, ref) {
1446
- var { value, minValue, maxValue, currencyOptions, currencyCode, onFocus, onBlur, onChange } = _a, inputProps = __rest(_a, ["value", "minValue", "maxValue", "currencyOptions", "currencyCode", "onFocus", "onBlur", "onChange"]);
1447
- const { handleOnWheel, } = useDisableInputWheel(ref);
1448
- const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
1449
- return (jsx(ForwardedDInput, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, inputProps)));
1450
- }
1451
- const ForwardedDInputCurrencyBase$1 = forwardRef(DInputCurrencyBase);
1452
- ForwardedDInputCurrencyBase$1.displayName = 'DInputCurrencyBase';
1453
-
1454
1559
  function DInputCurrency(_a, ref) {
1455
1560
  var { value, minValue, maxValue, currencyCode, onFocus, onBlur, onChange } = _a, props = __rest(_a, ["value", "minValue", "maxValue", "currencyCode", "onFocus", "onBlur", "onChange"]);
1456
1561
  const { currency: currencyOptions } = useDContext();
@@ -1458,19 +1563,8 @@ function DInputCurrency(_a, ref) {
1458
1563
  const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
1459
1564
  return (jsx(ForwardedDInput, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, props)));
1460
1565
  }
1461
- const ForwardedDInputCurrencyBase = forwardRef(DInputCurrency);
1462
- ForwardedDInputCurrencyBase.displayName = 'DInputCurrency';
1463
-
1464
- /**
1465
- * @deprecated
1466
- */
1467
- function DInputSearch(_a, ref) {
1468
- var { type, iconEnd: iconEndProp, iconEndAriaLabel = 'search' } = _a, props = __rest(_a, ["type", "iconEnd", "iconEndAriaLabel"]);
1469
- const inputRef = useProvidedRefOrCreate(ref);
1470
- return (jsx(ForwardedDInput, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", iconEndAriaLabel: iconEndAriaLabel }, props)));
1471
- }
1472
- const ForwardedDInputSearch = forwardRef(DInputSearch);
1473
- ForwardedDInputSearch.displayName = 'DInputSearch';
1566
+ const ForwardedDInputCurrency = forwardRef(DInputCurrency);
1567
+ ForwardedDInputCurrency.displayName = 'DInputCurrency';
1474
1568
 
1475
1569
  function DInputPassword(_a, ref) {
1476
1570
  var { onIconEndClick, iconEndAriaLabel = 'show/hide password' } = _a, props = __rest(_a, ["onIconEndClick", "iconEndAriaLabel"]);
@@ -1487,7 +1581,87 @@ function DInputPassword(_a, ref) {
1487
1581
  const ForwardedDInputPassword = forwardRef(DInputPassword);
1488
1582
  ForwardedDInputPassword.displayName = 'DInputPassword';
1489
1583
 
1490
- function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder, type = 'text', disabled = false, loading = false, secret = false, characters = 4, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, dataAttributes, onChange, }) {
1584
+ function PasswordCheckItem({ password, regex, text, }) {
1585
+ const isValid = regex.test(password);
1586
+ return (jsxs("li", { className: "d-flex gap-2 align-items-start small text-gray-600", children: [jsx(DIcon, { className: classNames('flex-shrink-0', isValid ? 'text-success' : 'text-gray-300'), icon: isValid ? 'CircleCheck' : 'Circle', size: "16px" }), jsx("span", { className: classNames({ 'text-success': isValid }), children: text })] }));
1587
+ }
1588
+
1589
+ const getColorClass = (strength, total) => {
1590
+ const percentage = total > 0 ? strength / total : 0;
1591
+ if (percentage === 0)
1592
+ return 'bg-gray-200';
1593
+ if (percentage <= 0.25)
1594
+ return 'bg-danger';
1595
+ if (percentage <= 0.5)
1596
+ return 'bg-warning';
1597
+ if (percentage <= 0.75)
1598
+ return 'bg-info';
1599
+ return 'bg-success';
1600
+ };
1601
+ function PasswordStrengthBar({ strength, total }) {
1602
+ const percentage = total > 0 ? (strength / total) * 100 : 0;
1603
+ return (jsx("div", { className: "w-100 rounded-3 overflow-hidden bg-gray-100 mb-2", style: { height: '8px' }, children: jsx("div", { className: `h-100 ${getColorClass(strength, total)}`, style: {
1604
+ width: `${percentage}%`,
1605
+ transition: 'width 0.3s ease-in-out',
1606
+ } }) }));
1607
+ }
1608
+
1609
+ const CHECK_REGEX = {
1610
+ uppercase: /[A-Z]/,
1611
+ lowercase: /[a-z]/,
1612
+ number: /\d/,
1613
+ specialChar: /[~!@#$^*\-_=[\]{}|;,.?]/,
1614
+ };
1615
+ function PasswordChecksList({ password, validationMessages, enabledChecks, }) {
1616
+ const allChecks = [
1617
+ {
1618
+ key: 'uppercase',
1619
+ regex: CHECK_REGEX.uppercase,
1620
+ text: validationMessages.uppercaseLetter,
1621
+ },
1622
+ {
1623
+ key: 'lowercase',
1624
+ regex: CHECK_REGEX.lowercase,
1625
+ text: validationMessages.lowercaseLetter,
1626
+ },
1627
+ {
1628
+ key: 'number',
1629
+ regex: CHECK_REGEX.number,
1630
+ text: validationMessages.number,
1631
+ },
1632
+ {
1633
+ key: 'specialChar',
1634
+ regex: CHECK_REGEX.specialChar,
1635
+ text: validationMessages.especialChar,
1636
+ },
1637
+ ];
1638
+ const passwordChecks = allChecks.filter((check) => enabledChecks.includes(check.key));
1639
+ const passed = passwordChecks.filter((r) => r.regex.test(password)).length;
1640
+ const total = passwordChecks.length;
1641
+ return (jsxs("div", { className: "mt-2", children: [jsx(PasswordStrengthBar, { strength: passed, total: total }), jsx("ul", { className: "list-unstyled m-0 d-flex flex-column gap-2", children: passwordChecks.map(({ key, regex, text }) => (jsx(PasswordCheckItem, { password: password, regex: regex, text: text }, key))) })] }));
1642
+ }
1643
+
1644
+ const DEFAULT_VALIDATION_MESSAGES = {
1645
+ number: 'At least one number',
1646
+ lowercaseLetter: 'At least one lowercase letter',
1647
+ uppercaseLetter: 'At least one uppercase letter',
1648
+ especialChar: 'At least one of these special characters: ~!@#$^*-_=[]{}|;,.?',
1649
+ notMatch: 'The password confirmation and the new password do not match.',
1650
+ };
1651
+ const DEFAULT_ENABLED_CHECKS = ['uppercase', 'lowercase', 'number', 'specialChar'];
1652
+ function DPasswordStrengthMeter({ id, label = 'Password', placeholder, value = '', name, disabled = false, invalid = false, validationMessages = DEFAULT_VALIDATION_MESSAGES, enabledChecks = DEFAULT_ENABLED_CHECKS, className, style, dataAttributes, onChange, }) {
1653
+ const [password, setPassword] = useState(value);
1654
+ useEffect(() => {
1655
+ setPassword(value);
1656
+ }, [value]);
1657
+ const handleChange = (newValue) => {
1658
+ setPassword(newValue);
1659
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
1660
+ };
1661
+ return (jsxs("div", Object.assign({ className: className, style: style }, dataAttributes, { children: [jsx(ForwardedDInputPassword, { id: id, label: label, placeholder: placeholder, value: password, name: name, disabled: disabled, invalid: invalid, onChange: handleChange }), jsx(PasswordChecksList, { password: password, validationMessages: validationMessages, enabledChecks: enabledChecks })] })));
1662
+ }
1663
+
1664
+ function DInputPin({ id: idProp, label = '', placeholder, type = 'text', disabled = false, loading = false, secret = false, characters = 4, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, dataAttributes, onChange, }) {
1491
1665
  const innerId = useId();
1492
1666
  const id = useMemo(() => idProp || innerId, [idProp, innerId]);
1493
1667
  const [pattern, setPattern] = useState('');
@@ -1520,7 +1694,8 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
1520
1694
  }
1521
1695
  if (input.value !== '') {
1522
1696
  setActiveInput((prev) => {
1523
- const newValue = prev.with(index, input.value);
1697
+ const newValue = [...prev];
1698
+ newValue[index] = input.value;
1524
1699
  return newValue;
1525
1700
  });
1526
1701
  if (input.nextSibling) {
@@ -1536,7 +1711,8 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
1536
1711
  if (key === 'Backspace') {
1537
1712
  const { value } = currentTarget;
1538
1713
  setActiveInput((prev) => {
1539
- const newVal = prev.with(index, '');
1714
+ const newVal = [...prev];
1715
+ newVal[index] = '';
1540
1716
  return newVal;
1541
1717
  });
1542
1718
  if (currentTarget.previousSibling && value === '') {
@@ -1549,19 +1725,23 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
1549
1725
  }
1550
1726
  }, []);
1551
1727
  const focusInput = useCallback((index) => {
1552
- setActiveInput((prev) => prev.with(index, ''));
1728
+ setActiveInput((prev) => {
1729
+ const newVal = [...prev];
1730
+ newVal[index] = '';
1731
+ return newVal;
1732
+ });
1553
1733
  }, []);
1554
1734
  const wheelInput = useCallback((event) => {
1555
1735
  event.currentTarget.blur();
1556
1736
  }, []);
1557
- return (jsxs("div", Object.assign({ className: classNames('d-input-pin', className), style: style }, dataAttributes, { children: [label && (jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: "d-input-pin-group", id: id, children: [Array.from({ length: characters }).map((_, index) => (jsx("input", Object.assign({ className: classNames({
1737
+ return (jsxs("div", Object.assign({ className: classNames('d-input-pin', className), style: style }, dataAttributes, { children: [label && (jsx("label", { htmlFor: "pinIndex0", children: label })), jsxs("div", { className: "d-input-pin-group", id: id, children: [Array.from({ length: characters }).map((_, index) => (jsx("input", Object.assign({ className: classNames({
1558
1738
  'form-control': true,
1559
1739
  'is-invalid': invalid,
1560
1740
  'is-valid': valid,
1561
1741
  }), value: activeInput[index], type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onInput: (event) => nextInput(event, index), onKeyDown: (event) => prevInput(event, index), onFocus: () => focusInput(index), onWheel: wheelInput, onClick: (event) => event.preventDefault(), onPaste: (event) => handlePaste(event), autoComplete: "off", placeholder: placeholder, disabled: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), loading && (jsx("div", { className: "input-group-text", 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 }))] })));
1562
1742
  }
1563
1743
 
1564
- function DInputSelect({ id: idProp, name, label = '', className, style, options = [], labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, size, floatingLabel = false, invalid = false, valid = false, dataAttributes, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
1744
+ function DInputSelect({ id: idProp, name, label = '', className, style, options = [], disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, size, floatingLabel = false, invalid = false, valid = false, dataAttributes, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
1565
1745
  const innerId = useId();
1566
1746
  const id = useMemo(() => idProp || innerId, [idProp, innerId]);
1567
1747
  const internalValueExtractor = useCallback((option) => {
@@ -1629,12 +1809,9 @@ function DInputSelect({ id: idProp, name, label = '', className, style, options
1629
1809
  valid,
1630
1810
  size,
1631
1811
  ]);
1632
- const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), [
1812
+ const labelComponent = useMemo(() => (jsx("label", { htmlFor: id, children: label })), [
1633
1813
  id,
1634
1814
  label,
1635
- labelIcon,
1636
- labelIconFamilyClass,
1637
- labelIconFamilyPrefix,
1638
1815
  ]);
1639
1816
  const dynamicComponent = useMemo(() => {
1640
1817
  if (floatingLabel) {
@@ -1647,7 +1824,7 @@ function DInputSelect({ id: idProp, name, label = '', className, style, options
1647
1824
  }), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: disabled || loading, "aria-label": iconStartAriaLabel, children: iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), dynamicComponent, iconEnd && !loading && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: disabled || loading, "aria-label": iconEndAriaLabel, children: iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (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 }))] })));
1648
1825
  }
1649
1826
 
1650
- function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, invalid = false, valid = false, readonly, className, style, dataAttributes, onChange, }) {
1827
+ function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, invalid = false, valid = false, readonly, className, style, dataAttributes, inputClassName, onChange, }) {
1651
1828
  const innerId = useId();
1652
1829
  const id = useMemo(() => idProp || innerId, [idProp, innerId]);
1653
1830
  const [internalIsChecked, setInternalIsChecked] = useState(checked);
@@ -1659,10 +1836,10 @@ function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, i
1659
1836
  setInternalIsChecked(value);
1660
1837
  onChange === null || onChange === void 0 ? void 0 : onChange(value);
1661
1838
  }, [onChange]);
1662
- return (jsxs("div", Object.assign({ className: "form-check form-switch" }, dataAttributes, { children: [jsx("input", { id: id, name: name, onChange: readonly ? () => false : changeHandler, className: classNames('form-check-input', {
1839
+ return (jsxs("div", Object.assign({ className: classNames('form-check', className) }, dataAttributes, { children: [jsx("input", { id: id, name: name, onChange: readonly ? () => false : changeHandler, className: classNames('form-check-input', {
1663
1840
  'is-invalid': invalid,
1664
1841
  'is-valid': valid,
1665
- }, className), style: style, type: "checkbox", role: "switch", checked: internalIsChecked, disabled: disabled, "aria-label": ariaLabel }), label && (jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] })));
1842
+ }, inputClassName), style: style, type: "checkbox", role: "switch", checked: internalIsChecked, disabled: disabled, "aria-label": ariaLabel }), label && (jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] })));
1666
1843
  }
1667
1844
 
1668
1845
  function DInputRange(_a, ref) {
@@ -1697,43 +1874,12 @@ function DInputRange(_a, ref) {
1697
1874
  if (!label) {
1698
1875
  return inputComponent;
1699
1876
  }
1700
- return (jsxs(Fragment$1, { children: [jsx("label", { className: "form-label", htmlFor: id, children: label }), inputComponent] }));
1877
+ return (jsxs(Fragment, { children: [jsx("label", { className: "form-label", htmlFor: id, children: label }), inputComponent] }));
1701
1878
  }
1702
1879
  const ForwardedDInputRange = forwardRef(DInputRange);
1703
1880
  ForwardedDInputRange.displayName = 'DInputRange';
1704
1881
 
1705
- /**
1706
- * @deprecated Please use DListGroup.Item or DListGroupItem instead
1707
- */
1708
- function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
1709
- const Tag = useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
1710
- return (jsx(Tag, Object.assign({}, Tag === 'button' && {
1711
- onClick,
1712
- type: 'button',
1713
- }, { className: classNames('list-group-item list-group-item-action', theme ? `list-group-item-${theme}` : undefined, className, {
1714
- active,
1715
- disabled,
1716
- }), style: style }, active && { 'aria-current': true }, { children: children })));
1717
- }
1718
-
1719
- /**
1720
- * @deprecated Please use DListGroup instead
1721
- */
1722
- function DList({ children, className, style, flush = false, numbered = false, horizontal = false, horizontalBreakpoint, dataAttributes, }) {
1723
- if (flush && horizontal) {
1724
- throw new Error("Horizontal and Flush props don't work together");
1725
- }
1726
- return (jsx("div", Object.assign({ className: classNames('list-group', {
1727
- 'list-group-flush': flush && !horizontal,
1728
- 'list-group-numbered': numbered,
1729
- 'list-group-horizontal': horizontal && !horizontalBreakpoint,
1730
- }, (horizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className), style: style }, dataAttributes, { children: children })));
1731
- }
1732
- var DList$1 = Object.assign(DList, {
1733
- Item: DListItem,
1734
- });
1735
-
1736
- function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href, onClick, theme, children, className, style, dataAttributes, }) {
1882
+ function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href, onClick, color, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, children, className, style, dataAttributes, }) {
1737
1883
  const Tag = useMemo(() => {
1738
1884
  if (href) {
1739
1885
  return 'a';
@@ -1752,17 +1898,17 @@ function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href,
1752
1898
  const generateClasses = useMemo(() => ({
1753
1899
  'list-group-item': true,
1754
1900
  'list-group-item-action': action,
1755
- [`list-group-item-${theme}`]: !!theme,
1901
+ [`list-group-item-${color}`]: !!color,
1756
1902
  active,
1757
1903
  disabled,
1758
- }), [action, active, disabled, theme]);
1904
+ }), [action, active, disabled, color]);
1759
1905
  const ariaAttributes = useMemo(() => {
1760
1906
  if (Tag === 'button') {
1761
1907
  return Object.assign(Object.assign({}, active && { 'aria-current': true }), disabled && { disabled: true });
1762
1908
  }
1763
1909
  return Object.assign(Object.assign({}, active && { 'aria-current': true }), disabled && { 'aria-disabled': true });
1764
1910
  }, [Tag, active, disabled]);
1765
- return (jsx(Tag, Object.assign({ className: classNames(generateClasses, className), style: style }, Tag === 'a' && href && { href }, onClick && { onClick }, ariaAttributes, dataAttributes, Tag === 'button' && { type: 'button' }, { children: children })));
1911
+ return (jsxs(Tag, Object.assign({ className: classNames(generateClasses, className), style: style }, Tag === 'a' && href && { href }, onClick && { onClick }, ariaAttributes, dataAttributes, Tag === 'button' && { type: 'button' }, { children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })), children, iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle, className: "ms-auto" }))] })));
1766
1912
  }
1767
1913
 
1768
1914
  function DListGroup({ as = 'ul', numbered, flush, horizontal, children, className, style, dataAttributes, }) {
@@ -1792,7 +1938,7 @@ var DListGroup$1 = Object.assign(DListGroup, {
1792
1938
  function DModalHeader({ showCloseButton, onClose, children, className, style, iconFamilyClass, iconFamilyPrefix, icon: iconProp, materialStyle = false, }) {
1793
1939
  const { iconMap: { xLg, }, } = useDContext();
1794
1940
  const icon = useMemo(() => iconProp || xLg, [iconProp, xLg]);
1795
- return (jsxs(Fragment$1, { children: [jsxs("div", { className: classNames('modal-header', className), style: style, children: [jsx("div", { children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }), jsx("div", { className: "d-modal-separator" })] }));
1941
+ return (jsxs(Fragment, { children: [jsxs("div", { className: classNames('modal-header', className), style: style, children: [jsx("div", { children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }), jsx("div", { className: "d-modal-separator" })] }));
1796
1942
  }
1797
1943
 
1798
1944
  function DModalBody({ children, className, style, }) {
@@ -1804,10 +1950,14 @@ function DModalFooter({ className, style, actionPlacement, children, }) {
1804
1950
  'modal-footer': true,
1805
1951
  [`d-modal-action-${actionPlacement}`]: !!actionPlacement,
1806
1952
  }), [actionPlacement]);
1807
- return (jsxs(Fragment$1, { children: [jsx("div", { className: "d-modal-separator" }), jsx("div", { className: classNames(generateClasses, className), style: style, children: children })] }));
1953
+ return (jsxs(Fragment, { children: [jsx("div", { className: "d-modal-separator" }), jsx("div", { className: classNames(generateClasses, className), style: style, children: children })] }));
1808
1954
  }
1809
1955
 
1810
- function DModal({ name, className, style, staticBackdrop, scrollable, centered, fullScreen, fullScreenFrom, size, children, dataAttributes, }) {
1956
+ const defaultTransition$1 = {
1957
+ ease: 'easeInOut',
1958
+ duration: 0.3,
1959
+ };
1960
+ function DModal({ name, className, style, staticBackdrop, scrollable, centered, fullScreen, fullScreenFrom, size, transition, children, dataAttributes, }) {
1811
1961
  const fullScreenClass = useMemo(() => {
1812
1962
  if (fullScreen) {
1813
1963
  if (fullScreenFrom) {
@@ -1818,7 +1968,7 @@ function DModal({ name, className, style, staticBackdrop, scrollable, centered,
1818
1968
  return '';
1819
1969
  }, [fullScreenFrom, fullScreen]);
1820
1970
  const generateModalDialogClasses = useMemo(() => (Object.assign({ 'modal-dialog': true, 'modal-dialog-centered': !!centered, 'modal-dialog-scrollable': !!scrollable, [fullScreenClass]: !!fullScreen }, size && { [`modal-${size}`]: true })), [fullScreenClass, centered, fullScreen, scrollable, size]);
1821
- return (jsx("div", Object.assign({ className: classNames('modal portal fade show', className), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style }, staticBackdrop && ({
1971
+ return (jsx(motion.div, Object.assign({ className: classNames('modal portal show', className), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style, initial: { opacity: 0, scale: 0.95 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.95 }, transition: Object.assign(Object.assign({}, (transition !== null && transition !== void 0 ? transition : defaultTransition$1)), { delay: 0.15 }) }, staticBackdrop && ({
1822
1972
  [`data-${PREFIX_BS}backdrop`]: 'static',
1823
1973
  [`data-${PREFIX_BS}keyboard`]: 'false',
1824
1974
  }), dataAttributes, { children: jsx("div", { className: classNames(generateModalDialogClasses), children: jsx("div", { className: "modal-content", children: children }) }) })));
@@ -1832,7 +1982,7 @@ var DModal$1 = Object.assign(DModal, {
1832
1982
  function DOffcanvasHeader({ showCloseButton, onClose, children, className, style, iconFamilyClass, iconFamilyPrefix, icon: iconProp, materialStyle = false, }) {
1833
1983
  const { iconMap: { xLg, }, } = useDContext();
1834
1984
  const icon = useMemo(() => iconProp || xLg, [iconProp, xLg]);
1835
- return (jsxs(Fragment$1, { children: [jsxs("div", { className: classNames('offcanvas-header', className), style: style, children: [jsx("div", { children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }), jsx("div", { className: "d-offcanvas-separator" })] }));
1985
+ return (jsxs(Fragment, { children: [jsxs("div", { className: classNames('offcanvas-header', className), style: style, children: [jsx("div", { children: children }), showCloseButton && (jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: materialStyle }) }))] }), jsx("div", { className: "d-offcanvas-separator" })] }));
1836
1986
  }
1837
1987
 
1838
1988
  function DOffcanvasBody({ children, className, style, }) {
@@ -1844,13 +1994,39 @@ function DOffcanvasFooter({ actionPlacement, children, className, style, }) {
1844
1994
  'd-offcanvas-footer': true,
1845
1995
  [`d-offcanvas-action-${actionPlacement}`]: !!actionPlacement,
1846
1996
  }), [actionPlacement]);
1847
- return (jsxs(Fragment$1, { children: [jsx("div", { className: "d-offcanvas-separator" }), jsx("div", { className: classNames(generateClasses, className), style: style, children: children })] }));
1997
+ return (jsxs(Fragment, { children: [jsx("div", { className: "d-offcanvas-separator" }), jsx("div", { className: classNames(generateClasses, className), style: style, children: children })] }));
1848
1998
  }
1849
1999
 
1850
- function DOffcanvas({ name, className, style, staticBackdrop, scrollable, openFrom = 'end', children, dataAttributes, }) {
1851
- return (jsx("div", Object.assign({ className: classNames('offcanvas portal show', {
2000
+ const variants = {
2001
+ hidden: (openFrom) => {
2002
+ const properties = {};
2003
+ if (openFrom === 'start') {
2004
+ properties.x = '-100%';
2005
+ }
2006
+ if (openFrom === 'end') {
2007
+ properties.x = '100%';
2008
+ }
2009
+ if (openFrom === 'top') {
2010
+ properties.y = '-100%';
2011
+ }
2012
+ if (openFrom === 'bottom') {
2013
+ properties.y = '100%';
2014
+ }
2015
+ return properties;
2016
+ },
2017
+ visible: {
2018
+ x: 0,
2019
+ y: 0,
2020
+ },
2021
+ };
2022
+ const defaultTransition = {
2023
+ ease: 'easeInOut',
2024
+ duration: 0.3,
2025
+ };
2026
+ function DOffcanvas({ name, className, style, staticBackdrop, scrollable, openFrom = 'end', transition, children, dataAttributes, }) {
2027
+ return (jsx(motion.div, Object.assign({ className: classNames('offcanvas portal show', {
1852
2028
  [`offcanvas-${openFrom}`]: openFrom,
1853
- }, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, staticBackdrop && ({
2029
+ }, className), style: Object.assign(Object.assign({}, style), { transition: 'none' }), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", custom: openFrom, variants: variants, initial: "hidden", animate: "visible", exit: "hidden", transition: Object.assign(Object.assign({}, (transition !== null && transition !== void 0 ? transition : defaultTransition)), { delay: 0.15 }) }, staticBackdrop && ({
1854
2030
  [`data-${PREFIX_BS}backdrop`]: 'static',
1855
2031
  [`data-${PREFIX_BS}keyboard`]: 'false',
1856
2032
  }), scrollable && ({
@@ -1865,11 +2041,8 @@ var DOffcanvas$1 = Object.assign(DOffcanvas, {
1865
2041
  });
1866
2042
 
1867
2043
  function DPaginator(_a) {
1868
- var { className, page, current, showArrows, navClassName } = _a, props = __rest(_a, ["className", "page", "current", "showArrows", "navClassName"]);
1869
- const backwardCompatibilityProps = useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign({}, props), { current: Number(page !== undefined ? page : current) }), showArrows !== undefined && { renderNav: showArrows }), props.extraClassName === undefined && className !== undefined && {
1870
- extraClassName: className,
1871
- })), [props, page, current, showArrows, className]);
1872
- return (jsx(ResponsivePagination, Object.assign({ navClassName: classNames('page-item-arrow', navClassName) }, backwardCompatibilityProps)));
2044
+ var { navClassName } = _a, props = __rest(_a, ["navClassName"]);
2045
+ return (jsx(ResponsivePagination, Object.assign({ navClassName: classNames('page-item-arrow', navClassName) }, props)));
1873
2046
  }
1874
2047
 
1875
2048
  function DPopover({ children, renderComponent, open, setOpen, adjustContentToRender = false, className, style, dataAttributes, }) {
@@ -1910,115 +2083,14 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
1910
2083
  }), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] })));
1911
2084
  }
1912
2085
 
1913
- function DProgress({ className, style, currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, dataAttributes, }) {
2086
+ function DProgress({ className, style, currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, height, dataAttributes, }) {
1914
2087
  const percentage = useMemo(() => (Math.round((currentValue * 100) / maxValue)), [currentValue, maxValue]);
1915
2088
  const formatProgress = useMemo(() => `${percentage}%`, [percentage]);
1916
2089
  const generateClasses = useMemo(() => ({
1917
2090
  'progress-bar': true,
1918
2091
  'progress-bar-striped progress-bar-animated': enableStripedAnimation,
1919
2092
  }), [enableStripedAnimation]);
1920
- return (jsx("div", Object.assign({ className: classNames('progress', className) }, dataAttributes, { children: jsx("div", { className: classNames(generateClasses), role: "progressbar", "aria-label": "Progress bar", style: Object.assign({ width: formatProgress }, style), "aria-valuenow": currentValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, children: !hideCurrentValue && formatProgress }) })));
1921
- }
1922
-
1923
- function DQuickActionButton({ line1, line2, className, actionIcon, actionIconFamilyClass, actionIconFamilyPrefix, actionIconTheme, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, href, hrefTarget, style, dataAttributes, }) {
1924
- const Tag = useMemo(() => {
1925
- if (href) {
1926
- return 'a';
1927
- }
1928
- if (onClick) {
1929
- return 'button';
1930
- }
1931
- return 'div';
1932
- }, [href, onClick]);
1933
- const tagProps = useMemo(() => {
1934
- if (href) {
1935
- return {
1936
- className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
1937
- href,
1938
- target: hrefTarget,
1939
- };
1940
- }
1941
- if (onClick) {
1942
- return {
1943
- className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
1944
- onClick,
1945
- };
1946
- }
1947
- return {
1948
- className: classNames('d-quick-action-button', className),
1949
- };
1950
- }, [
1951
- className,
1952
- href,
1953
- hrefTarget,
1954
- onClick,
1955
- ]);
1956
- return (jsxs(Tag, Object.assign({ style: style }, tagProps, dataAttributes, { children: [representativeIcon && (jsx(DIcon, { className: "d-quick-action-button-representative-icon", size: representativeIconHasCircle
1957
- ? `var(--${PREFIX_BS}quick-action-button-representative-icon-size)`
1958
- : `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 })] }) }), actionIcon && (jsx(DIcon, { className: "d-quick-action-button-action-icon", icon: actionIcon, size: `var(--${PREFIX_BS}quick-action-button-action-icon-size)`, theme: actionIconTheme, familyClass: actionIconFamilyClass, familyPrefix: actionIconFamilyPrefix }))] })));
1959
- }
1960
-
1961
- /**
1962
- * @deprecated
1963
- */
1964
- function DQuickActionCheck({ id: idProp, name, value, line1, line2, line3, className, style, checked, dataAttributes, onChange, }) {
1965
- const innerId = useId();
1966
- const id = useMemo(() => idProp || innerId, [idProp, innerId]);
1967
- const changeHandler = useCallback((event) => {
1968
- event.stopPropagation();
1969
- onChange === null || onChange === void 0 ? void 0 : onChange(event);
1970
- }, [onChange]);
1971
- return (jsxs("label", Object.assign({ className: classNames('d-quick-action-check', className), htmlFor: id, style: style }, dataAttributes, { children: [jsx(DInputCheck, { id: id, type: "radio", name: name, value: value, checked: checked, 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 })] })));
1972
- }
1973
-
1974
- function DQuickActionSelect({ id: idProp, name, value, line1, line2, className, style, selected = false, dataAttributes, onChange, }) {
1975
- const innerRef = useRef(null);
1976
- const innerId = useId();
1977
- const id = useMemo(() => idProp || innerId, [idProp, innerId]);
1978
- const changeHandler = useCallback((event) => {
1979
- event.stopPropagation();
1980
- onChange === null || onChange === void 0 ? void 0 : onChange(event);
1981
- }, [onChange]);
1982
- useEffect(() => {
1983
- if (innerRef.current) {
1984
- innerRef.current.checked = selected;
1985
- }
1986
- }, [selected]);
1987
- return (jsxs("label", Object.assign({ className: classNames('d-quick-action-select', className), htmlFor: id, style: style }, dataAttributes, { 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 })] })));
1988
- }
1989
-
1990
- /**
1991
- * @deprecated
1992
- */
1993
- function DQuickActionSwitch({ id: idProp, name, label, hint, checked, disabled, className, style, dataAttributes, onClick, }) {
1994
- const innerId = useId();
1995
- const id = useMemo(() => idProp || innerId, [idProp, innerId]);
1996
- const clickHandler = useCallback((event) => {
1997
- event.stopPropagation();
1998
- onClick === null || onClick === void 0 ? void 0 : onClick(checked);
1999
- }, [checked, onClick]);
2000
- return (jsxs("button", Object.assign({ className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style }, dataAttributes, { children: [jsx("div", { className: "d-quick-action-switch-content", children: jsx(DInputSwitch, { id: id, name: name, disabled: disabled, checked: checked, readonly: true, label: label }) }), jsx("div", { className: "d-quick-action-switch-hint", children: hint })] })));
2001
- }
2002
-
2003
- /**
2004
- * @deprecated Please use https://getbootstrap.com/docs/5.3/components/placeholders/ instead
2005
- */
2006
- function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
2007
- const innerBackgroundColor = useMemo(() => {
2008
- if (backgroundColor) {
2009
- return backgroundColor;
2010
- }
2011
- const computedStyle = getComputedStyle(document.documentElement);
2012
- return computedStyle.getPropertyValue(`--${PREFIX_BS}secondary-100`);
2013
- }, [backgroundColor]);
2014
- const innerForegroundColor = useMemo(() => {
2015
- if (foregroundColor) {
2016
- return foregroundColor;
2017
- }
2018
- const computedStyle = getComputedStyle(document.documentElement);
2019
- return computedStyle.getPropertyValue(`--${PREFIX_BS}gray-100`);
2020
- }, [foregroundColor]);
2021
- return (jsx(ContentLoader, { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
2093
+ return (jsx("div", Object.assign({ className: classNames('progress', className), style: Object.assign({ height }, style) }, dataAttributes, { children: jsx("div", { className: classNames(generateClasses), role: "progressbar", "aria-label": "Progress bar", style: { width: formatProgress }, "aria-valuenow": currentValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, children: !hideCurrentValue && formatProgress }) })));
2022
2094
  }
2023
2095
 
2024
2096
  function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, completed, alignStart = false, className, style, }) {
@@ -2031,13 +2103,13 @@ function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSu
2031
2103
  'd-stepper-desktop': true,
2032
2104
  'is-vertical': vertical,
2033
2105
  'is-align-start': alignStart && !vertical,
2034
- }, className), style: style, children: options.map(({ label, value, description }) => (jsxs("div", { className: "d-step", children: [jsx("div", { className: "d-step-value", children: jsx("div", { className: classNames({
2106
+ }, className), style: style, children: options.map(({ label, value, description }) => (jsxs("div", { className: classNames({
2107
+ 'd-step': true,
2108
+ 'd-step-current': value === currentStep && !completed,
2109
+ }), children: [jsx("div", { className: "d-step-value", children: jsxs("div", { className: classNames({
2035
2110
  'd-step-icon-container': true,
2036
2111
  'd-step-check': value < currentStep || completed,
2037
- 'd-step-current': value === currentStep && !completed,
2038
- }), children: value < currentStep || completed
2039
- ? (jsx(DIcon, { icon: icon, familyClass: iconSuccessFamilyClass, familyPrefix: iconSuccessFamilyPrefix, materialStyle: iconSuccessMaterialStyle, className: "d-step-icon" }))
2040
- : value }) }), jsxs("div", { className: "d-step-text-container", children: [jsx("div", { className: "d-step-label", children: label }), description && (jsx("div", { className: "d-step-description", children: description }))] })] }, value))) }));
2112
+ }), children: [((value < currentStep) || completed) && (jsx(DIcon, { icon: icon, familyClass: iconSuccessFamilyClass, familyPrefix: iconSuccessFamilyPrefix, materialStyle: iconSuccessMaterialStyle, className: "d-step-icon" })), value] }) }), jsxs("div", { className: "d-step-text-container", children: [jsx("div", { className: "d-step-label", children: label }), description && (jsx("div", { className: "d-step-description", children: description }))] })] }, value))) }));
2041
2113
  }
2042
2114
 
2043
2115
  function DStepper$1({ options, currentStep, className, style, }) {
@@ -2067,7 +2139,7 @@ function DStepper$1({ options, currentStep, className, style, }) {
2067
2139
  from 0deg,
2068
2140
  var(--${PREFIX_BS}step-progress-outter-fill-background-color) ${currentAngle}deg,
2069
2141
  var(--${PREFIX_BS}step-progress-outter-background-color) 0deg)`, [currentAngle]);
2070
- 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$1, { children: [jsx("div", { className: "d-step-label", children: currentOption.label }), jsx("div", { className: "d-step-description", children: currentOption.description || '' })] })) })] }));
2142
+ 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 || '' })] })) })] }));
2071
2143
  }
2072
2144
 
2073
2145
  function DStepper({ options, currentStep, iconSuccess, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, breakpoint = 'lg', className, completed = false, style, dataAttributes, }) {
@@ -2077,7 +2149,7 @@ function DStepper({ options, currentStep, iconSuccess, iconSuccessFamilyClass, i
2077
2149
  const ARROW_WIDTH = 8;
2078
2150
  const ARROW_HEIGHT = 4;
2079
2151
  const GAP = 2;
2080
- function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false, theme = 'dark', placement = 'top', size, Component, children, }) {
2152
+ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false, placement = 'top', size, Component, children, }) {
2081
2153
  const [isOpen, setIsOpen] = useState(open);
2082
2154
  const arrowRef = useRef(null);
2083
2155
  const { refs, context, floatingStyles, } = useFloating({
@@ -2108,8 +2180,14 @@ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT +
2108
2180
  dismiss,
2109
2181
  role,
2110
2182
  ]);
2111
- const generateClasses = useMemo(() => (Object.assign({ 'tooltip show': true, [`tooltip-${size}`]: !!size, [`tooltip-${theme}`]: !!theme }, className && { [className]: true })), [size, theme, className]);
2112
- return (jsxs(Fragment$1, { children: [jsx("div", Object.assign({ className: childrenClassName, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsx(FloatingPortal, { children: isOpen && (jsxs("div", Object.assign({ className: classNames(generateClasses), ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), style) }, getFloatingProps(), { children: [jsx(FloatingArrow, { ref: arrowRef, context: context, width: ARROW_WIDTH, height: ARROW_HEIGHT }), jsx("div", { className: "tooltip-inner", children: children })] }))) })] }));
2183
+ const generateClasses = useMemo(() => (Object.assign({ 'tooltip show': true, [`tooltip-${size}`]: !!size }, className && { [className]: true })), [size, className]);
2184
+ return (jsxs(Fragment, { children: [jsx("div", Object.assign({ className: childrenClassName, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsx(FloatingPortal, { children: isOpen && (jsxs("div", Object.assign({ className: classNames(generateClasses), ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), style) }, getFloatingProps(), { children: [jsx(FloatingArrow, { ref: arrowRef, context: context, width: ARROW_WIDTH, height: ARROW_HEIGHT }), jsx("div", { className: "tooltip-inner", children: children })] }))) })] }));
2185
+ }
2186
+
2187
+ function DTimeline({ className, style, dataAttributes, items, }) {
2188
+ return (jsx("div", Object.assign({ style: style, className: classNames('d-timeline', className) }, dataAttributes, { children: items.map((item, index) => (jsxs("div", { className: classNames('d-timeline-item', {
2189
+ [`d-timeline-item-${item.status}`]: item.status,
2190
+ }), children: [jsx("div", { className: "d-timeline-item-connector" }), jsx("div", { className: "d-timeline-item-icon", children: jsx("i", { className: `bi bi-${item.icon || 'check'}` }) }), jsxs("div", { className: "d-timeline-item-content", children: [jsx("div", { className: "d-timeline-item-title", children: item.title }), item.description && jsx("div", { className: "d-timeline-item-description", children: item.description }), item.time && jsx("div", { className: "d-timeline-item-time", children: item.time }), item.children] })] }, index))) })));
2113
2191
  }
2114
2192
 
2115
2193
  const TabContext = createContext(undefined);
@@ -2150,7 +2228,7 @@ function DTabs({ children, defaultSelected, onChange, options, className, classN
2150
2228
  'flex-column': !vertical || variant === 'tabs',
2151
2229
  }), style: style }, dataAttributes, { children: [jsx("nav", { className: classNames(generateClasses), children: options.map((option) => (jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
2152
2230
  active: option.tab === selected,
2153
- }, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.label))) }), jsx("div", { className: "tab-content w-100", children: children })] })) }));
2231
+ }, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.tab))) }), jsx("div", { className: "tab-content w-100", children: children })] })) }));
2154
2232
  }
2155
2233
  var DTabs$1 = Object.assign(DTabs, {
2156
2234
  Tab: DTabContent,
@@ -2182,20 +2260,18 @@ function useDToast() {
2182
2260
  if (typeof data === 'function') {
2183
2261
  return toast.custom(data, toastProps);
2184
2262
  }
2185
- const { title, description, icon, closeIcon, timestamp, theme, soft, } = data;
2263
+ const { title, description, icon, closeIcon, timestamp, color, } = data;
2186
2264
  return toast.custom(({ id, visible }) => {
2187
2265
  if (!visible) {
2188
2266
  return null;
2189
2267
  }
2190
2268
  if (!description) {
2191
2269
  return (jsx(DToast$1, { className: classNames({
2192
- [`toast-${theme}`]: !!theme && !soft,
2193
- [`toast-soft-${theme}`]: !!theme && !!soft,
2270
+ [`toast-${color}`]: !!color,
2194
2271
  }, 'show'), children: jsxs(DToast$1.Body, { children: [icon && (jsx(DIcon, { className: "toast-icon", icon: icon })), jsx("p", { className: "toast-title", children: title }), jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: () => toast.dismiss(id), children: jsx(DIcon, { icon: closeIcon || xLg }) })] }) }));
2195
2272
  }
2196
2273
  return (jsxs(DToast$1, { className: classNames({
2197
- [`toast-${theme}`]: !!theme && !soft,
2198
- [`toast-soft-${theme}`]: !!theme && !!soft,
2274
+ [`toast-${color}`]: !!color,
2199
2275
  }, 'show'), children: [jsxs(DToast$1.Header, { children: [icon && (jsx(DIcon, { className: "toast-icon", icon: icon })), jsx("p", { className: "toast-title", children: title }), timestamp && (jsx("small", { className: "toast-timestamp", children: timestamp })), jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: () => toast.dismiss(id), children: jsx(DIcon, { icon: closeIcon || xLg }) })] }), jsx(DToast$1.Body, { children: jsx("span", { children: description }) })] }));
2200
2276
  }, toastProps);
2201
2277
  }, [xLg]);
@@ -2204,19 +2280,6 @@ function useDToast() {
2204
2280
  };
2205
2281
  }
2206
2282
 
2207
- function DTableHead({ className, style, field, label, value = '', onChange, }) {
2208
- const handleOnChange = useCallback(() => {
2209
- if (value === field) {
2210
- return onChange(`-${field}`);
2211
- }
2212
- if (value === `-${field}`) {
2213
- return onChange('');
2214
- }
2215
- return onChange(field);
2216
- }, [field, value, onChange]);
2217
- return (jsx("th", { style: style, className: classNames('d-table-head', className), children: jsxs("button", { type: "button", onClick: handleOnChange, children: [label, value && value.includes(field) && (jsx(DIcon, { icon: value === field ? 'arrow-up' : 'arrow-down' }))] }) }));
2218
- }
2219
-
2220
2283
  async function configureI8n(resources, _a = {}) {
2221
2284
  var { lng = 'en', fallbackLng = 'en' } = _a, config = __rest(_a, ["lng", "fallbackLng"]);
2222
2285
  return i18n
@@ -2266,7 +2329,7 @@ function validatePhoneNumber(phone) {
2266
2329
  }
2267
2330
 
2268
2331
  function DInputPhone(_a, ref) {
2269
- var { id: idProp, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, labelIconMaterialStyle, disabled = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconEnd, iconEndDisabled, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, iconEndMaterialStyle, hint, size, invalid = false, valid = false, floatingLabel = false, inputEnd, value, placeholder = '', dataAttributes, onChange, onIconEndClick, countrySelectorProps, filteredCountries, defaultCountry = 'cl' } = _a, inputProps = __rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "labelIconMaterialStyle", "disabled", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "iconEnd", "iconEndDisabled", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "iconEndMaterialStyle", "hint", "size", "invalid", "valid", "floatingLabel", "inputEnd", "value", "placeholder", "dataAttributes", "onChange", "onIconEndClick", "countrySelectorProps", "filteredCountries", "defaultCountry"]);
2332
+ var { id: idProp, style, className, label = '', disabled = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconEnd, iconEndDisabled, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, iconEndMaterialStyle, hint, size, invalid = false, valid = false, floatingLabel = false, inputEnd, value, placeholder = '', dataAttributes, onChange, onIconEndClick, countrySelectorProps, filteredCountries, defaultCountry = 'cl' } = _a, inputProps = __rest(_a, ["id", "style", "className", "label", "disabled", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "iconEnd", "iconEndDisabled", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "iconEndMaterialStyle", "hint", "size", "invalid", "valid", "floatingLabel", "inputEnd", "value", "placeholder", "dataAttributes", "onChange", "onIconEndClick", "countrySelectorProps", "filteredCountries", "defaultCountry"]);
2270
2333
  const innerRef = useProvidedRefOrCreate(ref);
2271
2334
  const innerId = useId();
2272
2335
  const id = useMemo(() => idProp || innerId, [idProp, innerId]);
@@ -2325,13 +2388,9 @@ function DInputPhone(_a, ref) {
2325
2388
  placeholder,
2326
2389
  valid,
2327
2390
  ]);
2328
- const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix, materialStyle: labelIconMaterialStyle }))] })), [
2391
+ const labelComponent = useMemo(() => (jsx("label", { htmlFor: id, children: label })), [
2329
2392
  id,
2330
2393
  label,
2331
- labelIcon,
2332
- labelIconFamilyClass,
2333
- labelIconFamilyPrefix,
2334
- labelIconMaterialStyle,
2335
2394
  ]);
2336
2395
  const dynamicComponent = useMemo(() => {
2337
2396
  if (floatingLabel) {
@@ -2352,5 +2411,181 @@ function DInputPhone(_a, ref) {
2352
2411
  const ForwardedDInputPhone = forwardRef(DInputPhone);
2353
2412
  ForwardedDInputPhone.displayName = 'DInputPhone';
2354
2413
 
2355
- export { DAlert, DAvatar, DBadge, DBoxFile, DButton, DButtonIcon, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DIconBase, ForwardedDInput as DInput, DInputCheck, ForwardedDInputCounter as DInputCounter, ForwardedDInputCurrencyBase as DInputCurrency, ForwardedDInputCurrencyBase$1 as DInputCurrencyBase, ForwardedDInputMask as DInputMask, ForwardedDInputPassword as DInputPassword, ForwardedDInputPhone as DInputPhone, DInputPin, ForwardedDInputRange as DInputRange, ForwardedDInputSearch as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListGroup$1 as DListGroup, DListGroupItem, DListItem, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSelect$1 as DSelect, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DTabContent, DTableHead, DTabs$1 as DTabs, DToast$1 as DToast, DToastContainer, DTooltip, changeQueryString, checkMediaQuery, configureI8n as configureI18n, formatCurrency, getCssVariable, getQueryString, subscribeToMediaQuery, useDContext, useDPortalContext, useDToast, useDisableBodyScrollEffect, useDisableInputWheel, useFormatCurrency, useInputCurrency, useItemSelection, useMediaBreakpointUpLg, useMediaBreakpointUpMd, useMediaBreakpointUpSm, useMediaBreakpointUpXl, useMediaBreakpointUpXs, useMediaBreakpointUpXxl, useMediaQuery, usePortal, useProvidedRefOrCreate, useStackState, useTabContext, validatePhoneNumber };
2414
+ const DEFAULT_IMAGE = 'https://cdn.modyo.cloud/uploads/06b434f7-b943-4f54-9543-84a904e189aa/original/Visa_Logo_1_.png';
2415
+ const CHIP_IMAGE = 'https://cdn.modyo.cloud/uploads/4660ad00-e5d8-477e-8919-52b53d0a26fb/original/chip-debit-svgrepo-com_1_.png';
2416
+ function DCreditCard({ brand = 'visa', name, number, holderText = 'Card Holder', logoImage, isChipVisible = true, className, isVertical = false, }) {
2417
+ return (jsxs("div", { className: classNames('d-credit-card overflow-hidden text-white', 'position-relative rounded-3', 'd-none d-lg-flex', isVertical && 'is-vertical', className), children: [jsxs("div", { className: "d-credit-card-header", children: [jsx("img", { src: logoImage || DEFAULT_IMAGE, alt: brand, className: "d-credit-card-logo", width: 100 }), isChipVisible && (jsx("div", { className: "d-credit-card-chip p-2 rounded-2", children: jsx("img", { src: CHIP_IMAGE, alt: "chip", width: 30, className: "d-credit-card-chip-image" }) }))] }), jsxs("div", { className: "d-credit-card-details mt-auto d-none d-sm-block", children: [jsx("div", { className: "d-credit-card-number d-none d-sm-block mb-4", children: number }), jsx("small", { className: "d-block opacity-50", children: holderText }), jsx("span", { className: "name", children: name })] })] }));
2418
+ }
2419
+
2420
+ const getItemClass = (action) => {
2421
+ const base = `dropdown-item d-flex align-items-center
2422
+ ${action.color ? `dropdown-item-${action.color}` : ''} ${action.disabled ? 'disabled' : ''}`;
2423
+ return base;
2424
+ };
2425
+ function DDropdown({ actions, dropdownToggle, className, }) {
2426
+ const [open, setOpen] = useState(false);
2427
+ const dropdownRef = useRef(null);
2428
+ const [position, setPosition] = useState('down'); // 🆕
2429
+ // Cerrar al hacer click fuera
2430
+ useEffect(() => {
2431
+ const handleClickOutside = (event) => {
2432
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
2433
+ setOpen(false);
2434
+ }
2435
+ };
2436
+ document.addEventListener('mousedown', handleClickOutside);
2437
+ return () => document.removeEventListener('mousedown', handleClickOutside);
2438
+ }, []);
2439
+ // 🆕 Calcular posición del menú al abrir
2440
+ useEffect(() => {
2441
+ if (open && dropdownRef.current) {
2442
+ const rect = dropdownRef.current.getBoundingClientRect();
2443
+ const spaceBottom = window.innerHeight - rect.bottom;
2444
+ const spaceRight = window.innerWidth - rect.right;
2445
+ if (spaceBottom < 150) {
2446
+ setPosition('up');
2447
+ }
2448
+ else if (spaceRight < 150) {
2449
+ setPosition('start');
2450
+ }
2451
+ else {
2452
+ setPosition('down');
2453
+ }
2454
+ }
2455
+ }, [open]);
2456
+ let ToggleElement;
2457
+ if (dropdownToggle) {
2458
+ if (typeof dropdownToggle === 'function') {
2459
+ ToggleElement = dropdownToggle({ open, toggle: () => setOpen(!open) });
2460
+ }
2461
+ else {
2462
+ ToggleElement = dropdownToggle;
2463
+ }
2464
+ }
2465
+ else {
2466
+ ToggleElement = (jsx(DButtonIcon, { variant: "link", stopPropagationEnabled: false, onClick: () => setOpen(!open), icon: "MoreVertical" }));
2467
+ }
2468
+ return (jsxs("div", { className: `dropdown position-relative drop-${position} ${className}`, ref: dropdownRef, children: [ToggleElement, jsx("ul", { style: {
2469
+ position: 'absolute',
2470
+ top: position === 'up' ? 'auto' : '100%',
2471
+ bottom: position === 'up' ? '100%' : 'auto',
2472
+ left: position === 'start' ? 'auto' : 0,
2473
+ right: position === 'start' ? '0' : 'auto',
2474
+ transform: 'translateY(4px)',
2475
+ }, className: `dropdown-menu p-2 ${open ? 'show' : ''}`, children: actions.map((action, index) => {
2476
+ if (action.isDivider) {
2477
+ return (jsx("hr", { className: "dropdown-divider" }, index));
2478
+ }
2479
+ return (jsx("li", { children: action.href ? (jsxs("a", { className: getItemClass(action), href: action.href, onClick: (e) => {
2480
+ if (action.disabled) {
2481
+ e.preventDefault();
2482
+ }
2483
+ else {
2484
+ setOpen(false);
2485
+ }
2486
+ }, children: [action.icon && (jsx(DIcon, { icon: action.icon, className: "me-2", size: "1rem" })), action.label] })) : (jsxs("button", { className: getItemClass(action), type: "button", onClick: () => {
2487
+ var _a;
2488
+ if (!action.disabled) {
2489
+ (_a = action.onClick) === null || _a === void 0 ? void 0 : _a.call(action);
2490
+ setOpen(false);
2491
+ }
2492
+ }, disabled: action.disabled, children: [action.icon && (jsx(DIcon, { icon: action.icon, className: "me-2", size: "1rem" })), action.label] })) }, index));
2493
+ }) })] }));
2494
+ }
2495
+
2496
+ function useScreenshot() {
2497
+ const clipRef = useRef(null);
2498
+ const takeBlob = useCallback(async (type) => {
2499
+ if (!clipRef.current) {
2500
+ throw new Error('set the clipRef');
2501
+ }
2502
+ const canvas = await html2canvas(clipRef === null || clipRef === void 0 ? void 0 : clipRef.current, {
2503
+ allowTaint: true,
2504
+ useCORS: true,
2505
+ });
2506
+ return (new Promise((resolve, reject) => {
2507
+ canvas.toBlob((innerBlob) => {
2508
+ if (!innerBlob) {
2509
+ return reject();
2510
+ }
2511
+ return resolve(innerBlob);
2512
+ }, type);
2513
+ }));
2514
+ }, []);
2515
+ return {
2516
+ clipRef,
2517
+ takeBlob,
2518
+ };
2519
+ }
2520
+
2521
+ function useScreenshotDownload() {
2522
+ const { clipRef, takeBlob } = useScreenshot();
2523
+ const download = useCallback(async () => {
2524
+ const blob = await takeBlob();
2525
+ const url = window.URL.createObjectURL(blob);
2526
+ const link = window.document.createElement('a');
2527
+ link.style.display = 'none';
2528
+ link.href = url;
2529
+ link.download = 'voucher.jpg';
2530
+ document.body.appendChild(link);
2531
+ link.click();
2532
+ document.body.removeChild(link);
2533
+ window.URL.revokeObjectURL(url);
2534
+ }, [takeBlob]);
2535
+ return {
2536
+ download,
2537
+ downloadRef: clipRef,
2538
+ };
2539
+ }
2540
+
2541
+ function useScreenshotWebShare() {
2542
+ const { takeBlob, clipRef } = useScreenshot();
2543
+ const share = useCallback(async () => {
2544
+ const blob = await takeBlob();
2545
+ const image = new File([blob], 'voucher.jpeg', { type: 'image/jpeg' });
2546
+ if (!navigator.canShare
2547
+ && (navigator.canShare && !navigator.canShare({ files: [image] }))) {
2548
+ window.print();
2549
+ return;
2550
+ }
2551
+ await navigator.share({ files: [image] });
2552
+ }, [takeBlob]);
2553
+ return {
2554
+ share,
2555
+ shareRef: clipRef,
2556
+ };
2557
+ }
2558
+
2559
+ function DVoucher({ amount, amountDetails, icon = 'CircleCheckBig', color = 'success', title, onError, message, downloadText = 'Download', shareText = 'Share', children, }) {
2560
+ const { shareRef, share } = useScreenshotWebShare();
2561
+ const { downloadRef, download } = useScreenshotDownload();
2562
+ const handleShare = () => {
2563
+ share()
2564
+ .catch(async (err) => {
2565
+ if (onError) {
2566
+ await onError(err);
2567
+ }
2568
+ })
2569
+ .catch(() => {
2570
+ // Error already handled by onError
2571
+ });
2572
+ };
2573
+ const handleDownload = () => {
2574
+ download()
2575
+ .catch(async (err) => {
2576
+ if (onError) {
2577
+ await onError(err);
2578
+ }
2579
+ })
2580
+ .catch(() => {
2581
+ // Error already handled by onError
2582
+ });
2583
+ };
2584
+ return (jsx("div", { className: "d-voucher", ref: (el) => {
2585
+ shareRef.current = el;
2586
+ downloadRef.current = el;
2587
+ }, children: jsxs("div", { children: [jsxs("div", { className: "d-voucher-header", children: [jsx(DIcon, { icon: icon, color: color }), jsxs("div", { className: "text-center", children: [jsx("h3", { className: "mb-2", children: title }), jsx("p", { className: "m-0", children: message })] })] }), amount && (jsxs("div", { className: "d-voucher-amount", children: [jsx("div", { className: classNames('text-center fw-bold fs-3', amountDetails ? 'mb-1' : 'm-0'), children: amount }), amountDetails] })), jsx("hr", { className: "my-4" }), children, jsx("hr", { className: "my-4" }), jsxs("div", { className: "d-voucher-footer", children: [jsx(DButton, { onClick: handleShare, iconStart: "Share2", text: shareText, variant: "outline", size: "sm" }), jsx(DButton, { onClick: handleDownload, iconStart: "Download", text: downloadText, variant: "outline", size: "sm" })] })] }) }));
2588
+ }
2589
+
2590
+ export { DAlert, DAvatar, DBadge, DBox, DBoxFile, DButton, DButtonIcon, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCreditCard, DCurrencyText, DDatePicker, DDropdown, DIcon, DIconBase, ForwardedDInput as DInput, DInputCheck, ForwardedDInputCounter as DInputCounter, ForwardedDInputCurrency as DInputCurrency, ForwardedDInputMask as DInputMask, ForwardedDInputPassword as DInputPassword, ForwardedDInputPhone as DInputPhone, DInputPin, ForwardedDInputRange as DInputRange, DInputSelect, DInputSwitch, DLayout$1 as DLayout, DLayoutPane, DListGroup$1 as DListGroup, DListGroupItem, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPasswordStrengthMeter, DPopover, DProgress, DSelect$1 as DSelect, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DTabContent, DTabs$1 as DTabs, DTimeline, DToast$1 as DToast, DToastContainer, DTooltip, DVoucher, changeQueryString, checkMediaQuery, configureI8n as configureI18n, formatCurrency, getCssVariable, getQueryString, subscribeToMediaQuery, useDContext, useDPortalContext, useDToast, useDisableBodyScrollEffect, useDisableInputWheel, useFormatCurrency, useInputCurrency, useItemSelection, useMediaBreakpointUpLg, useMediaBreakpointUpMd, useMediaBreakpointUpSm, useMediaBreakpointUpXl, useMediaBreakpointUpXs, useMediaBreakpointUpXxl, useMediaQuery, usePortal, useProvidedRefOrCreate, useStackState, useTabContext, validatePhoneNumber };
2356
2591
  //# sourceMappingURL=index.esm.js.map