@dynamic-framework/ui-react 1.33.0 → 1.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +1 -1
  2. package/dist/css/bootstrap-icons.css +3 -3
  3. package/dist/css/bootstrap-icons.min.css +2 -2
  4. package/dist/css/bootstrap-icons.scss +1 -1
  5. package/dist/css/dynamic-ui-non-root.css +724 -965
  6. package/dist/css/dynamic-ui-non-root.min.css +2 -2
  7. package/dist/css/dynamic-ui-root.css +1 -1
  8. package/dist/css/dynamic-ui-root.min.css +1 -1
  9. package/dist/css/dynamic-ui.css +724 -965
  10. package/dist/css/dynamic-ui.min.css +2 -2
  11. package/dist/css/fonts/bootstrap-icons.woff +0 -0
  12. package/dist/css/fonts/bootstrap-icons.woff2 +0 -0
  13. package/dist/index.esm.js +680 -169
  14. package/dist/index.esm.js.map +1 -1
  15. package/dist/index.js +686 -165
  16. package/dist/index.js.map +1 -1
  17. package/dist/js/bootstrap.bundle.js +19 -18
  18. package/dist/js/bootstrap.bundle.min.js +3 -3
  19. package/dist/js/bootstrap.esm.js +19 -16
  20. package/dist/js/bootstrap.esm.min.js +3 -3
  21. package/dist/js/bootstrap.js +19 -16
  22. package/dist/js/bootstrap.min.js +3 -3
  23. package/dist/types/components/DBoxFile/DBoxFile.d.ts +6 -5
  24. package/dist/types/components/DBoxFile/useDBoxFile.d.ts +37 -0
  25. package/dist/types/components/DBoxFile/utils.d.ts +39 -0
  26. package/dist/types/components/DDatePicker/DDatePicker.d.ts +6 -12
  27. package/dist/types/components/DDatePicker/components/DDatePickerHeaderSelector.d.ts +38 -0
  28. package/dist/types/components/{DDatePickerInput → DDatePicker/components}/DDatePickerInput.d.ts +2 -2
  29. package/dist/types/components/{DDatePickerTime → DDatePicker/components}/DDatePickerTime.d.ts +2 -2
  30. package/dist/types/components/DInput/DInput.d.ts +1 -1
  31. package/dist/types/components/DInputCounter/DInputCounter.d.ts +2 -2
  32. package/dist/types/components/DInputCurrency/DInputCurrency.d.ts +2 -2
  33. package/dist/types/components/DInputCurrencyBase/DInputCurrencyBase.d.ts +2 -2
  34. package/dist/types/components/DInputMask/DInputMask.d.ts +1 -1
  35. package/dist/types/components/DInputRange/DInputRange.d.ts +1 -1
  36. package/dist/types/components/DInputSearch/DInputSearch.d.ts +1 -1
  37. package/dist/types/components/DPopover/DPopover.d.ts +0 -3
  38. package/dist/types/components/DQuickActionButton/DQuickActionButton.d.ts +4 -9
  39. package/dist/types/contexts/DContext.d.ts +9 -0
  40. package/dist/types/hooks/index.d.ts +2 -0
  41. package/dist/types/hooks/useMediaBreakpointUp.d.ts +6 -0
  42. package/dist/types/hooks/useMediaQuery.d.ts +1 -0
  43. package/dist/types/utils/attr-accept.d.ts +11 -0
  44. package/dist/types/utils/getCssVariable.d.ts +1 -0
  45. package/dist/types/utils/getKeyboardFocusableElements.d.ts +1 -0
  46. package/dist/types/utils/index.d.ts +2 -0
  47. package/dist/types/utils/mediaQuery.d.ts +2 -0
  48. package/jest/setup.js +14 -0
  49. package/package.json +13 -14
  50. package/src/style/abstracts/variables/_+import.scss +1 -0
  51. package/src/style/abstracts/variables/_box-file.scss +14 -7
  52. package/src/style/abstracts/variables/_cards.scss +1 -1
  53. package/src/style/abstracts/variables/_datepicker.scss +50 -0
  54. package/src/style/abstracts/variables/_forms.scss +6 -3
  55. package/src/style/base/_form-switch.scss +23 -2
  56. package/src/style/base/_input-group.scss +18 -1
  57. package/src/style/base/_nav.scss +0 -1
  58. package/src/style/base/_toast.scss +2 -0
  59. package/src/style/components/_d-box-file.scss +31 -15
  60. package/src/style/components/_d-button-icon.scss +17 -16
  61. package/src/style/components/_d-datepicker.scss +578 -243
  62. package/src/style/components/_d-input-pin.scss +8 -5
  63. package/src/style/components/_d-quick-action-button.scss +5 -3
  64. package/src/style/components/_d-quick-action-check.scss +1 -1
  65. package/src/style/components/_d-select.scss +35 -6
  66. package/src/style/components/_d-stepper-desktop.scss +1 -1
  67. package/src/style/helpers/_text-truncate.scss +2 -2
  68. package/dist/types/components/DDatePickerHeader/DDatePickerHeader.d.ts +0 -24
  69. package/dist/types/components/DDatePickerHeader/index.d.ts +0 -2
  70. package/dist/types/components/DDatePickerInput/index.d.ts +0 -2
  71. package/dist/types/components/DDatePickerTime/index.d.ts +0 -2
package/dist/index.js CHANGED
@@ -5,11 +5,12 @@ var React = require('react');
5
5
  var classNames = require('classnames');
6
6
  var tslib = require('tslib');
7
7
  var reactDom = require('react-dom');
8
- var reactDropzone = require('react-dropzone');
8
+ var fileSelector = require('file-selector');
9
9
  var reactSplide = require('@splidejs/react-splide');
10
10
  var currency = require('currency.js');
11
11
  var DatePicker = require('react-datepicker');
12
12
  var dateFns = require('date-fns');
13
+ var locale = require('date-fns/locale');
13
14
  var Select = require('react-select');
14
15
  var mask = require('@react-input/mask');
15
16
  var ResponsivePagination = require('react-responsive-pagination');
@@ -21,7 +22,7 @@ var reactI18next = require('react-i18next');
21
22
 
22
23
  const PREFIX_BS = 'bs-';
23
24
 
24
- function DIconBase({ icon, theme, style, className, size = '1.5rem', loading = false, loadingDuration = 1.8, hasCircle = false, circleSize = `calc(var(--${PREFIX_BS}icon-component-size) * 1)`, color, backgroundColor, materialStyle = false, familyClass = 'bi', familyPrefix = 'bi-', dataAttributes, }) {
25
+ 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
26
  const colorStyle = React.useMemo(() => {
26
27
  if (color) {
27
28
  return { [`--${PREFIX_BS}icon-component-color`]: color };
@@ -49,7 +50,7 @@ function DIconBase({ icon, theme, style, className, size = '1.5rem', loading = f
49
50
  }
50
51
  return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
51
52
  }, [circleSize, hasCircle]);
52
- const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign({ [`--${PREFIX_BS}icon-component-size`]: size, [`--${PREFIX_BS}icon-component-loading-duration`]: `${loadingDuration}s` }, colorStyle), backgroundStyle), circleSizeStyle), style)), [size, loadingDuration, colorStyle, backgroundStyle, circleSizeStyle, style]);
53
+ const generateStyleVariables = React.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
54
  const generateClasses = React.useMemo(() => (Object.assign(Object.assign({ 'd-icon': true, [familyClass]: true, 'd-icon-loading': loading }, !materialStyle && {
54
55
  [`${familyPrefix}${icon}`]: true,
55
56
  }), className && { [className]: true })), [
@@ -128,12 +129,22 @@ function useStackState(initialList = []) {
128
129
  return [list, controls];
129
130
  }
130
131
 
132
+ function getKeyboardFocusableElements(container) {
133
+ if (!container) {
134
+ return [];
135
+ }
136
+ return [
137
+ ...container.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'),
138
+ ].filter((element) => !element.hasAttribute('disabled'));
139
+ }
140
+
131
141
  const DPortalContext = React.createContext(undefined);
132
142
  function DPortalContextProvider({ portalName, children, availablePortals, }) {
133
143
  const { created } = usePortal(portalName);
134
144
  const [stack, { push, pop, isEmpty }] = useStackState([]);
135
145
  useDisableBodyScrollEffect(Boolean(stack.length));
136
146
  const openPortal = React.useCallback((name, payload) => {
147
+ var _a;
137
148
  if (!availablePortals) {
138
149
  throw new Error(`there is no component for portal ${name.toString()}`);
139
150
  }
@@ -146,6 +157,7 @@ function DPortalContextProvider({ portalName, children, availablePortals, }) {
146
157
  Component,
147
158
  payload,
148
159
  });
160
+ (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.blur();
149
161
  }, [availablePortals, push]);
150
162
  const closePortal = React.useCallback(() => {
151
163
  if (isEmpty()) {
@@ -175,10 +187,26 @@ function DPortalContextProvider({ portalName, children, availablePortals, }) {
175
187
  }, [closePortal]);
176
188
  React.useEffect(() => {
177
189
  const keyEvent = (event) => {
190
+ const lastPortal = document.querySelector(`#${portalName} > div > div:last-child`);
178
191
  if (event.key === 'Escape') {
179
- const lastPortal = document.querySelector(`#${portalName} > div > div:last-child`);
180
192
  if (lastPortal) {
181
193
  handleClose(lastPortal);
194
+ return;
195
+ }
196
+ }
197
+ if (event.key === 'Tab') {
198
+ const focusableElements = getKeyboardFocusableElements(lastPortal);
199
+ if (focusableElements.length === 0)
200
+ return;
201
+ const firstElement = focusableElements[0];
202
+ const lastElement = focusableElements[focusableElements.length - 1];
203
+ if (event.shiftKey && document.activeElement === firstElement) {
204
+ event.preventDefault();
205
+ lastElement.focus();
206
+ }
207
+ else if (!event.shiftKey && document.activeElement === lastElement) {
208
+ event.preventDefault();
209
+ firstElement.focus();
182
210
  }
183
211
  }
184
212
  };
@@ -202,7 +230,12 @@ function useDPortalContext() {
202
230
  return context;
203
231
  }
204
232
 
205
- const defaultState = {
233
+ function getCssVariable(variable) {
234
+ const computedStyle = getComputedStyle(document.documentElement);
235
+ return computedStyle.getPropertyValue(variable).trim();
236
+ }
237
+
238
+ const DEFAULT_STATE = {
206
239
  language: 'en',
207
240
  currency: {
208
241
  symbol: '$',
@@ -245,18 +278,39 @@ const defaultState = {
245
278
  decrease: 'dash-square',
246
279
  },
247
280
  },
281
+ breakpoints: {
282
+ xs: '',
283
+ sm: '',
284
+ md: '',
285
+ lg: '',
286
+ xl: '',
287
+ xxl: '',
288
+ },
248
289
  setContext: () => { },
249
290
  portalName: 'd-portal',
250
291
  };
251
- const DContext = React.createContext(defaultState);
252
- function DContextProvider({ language = defaultState.language, currency = defaultState.currency, icon = defaultState.icon, iconMap = defaultState.iconMap, portalName = defaultState.portalName, availablePortals, children, }) {
292
+ const DContext = React.createContext(DEFAULT_STATE);
293
+ function DContextProvider({ language = DEFAULT_STATE.language, currency = DEFAULT_STATE.currency, icon = DEFAULT_STATE.icon, iconMap = DEFAULT_STATE.iconMap, portalName = DEFAULT_STATE.portalName, availablePortals, children, }) {
253
294
  const [internalContext, setInternalContext,] = React.useState({
254
295
  language,
255
296
  currency,
256
297
  icon,
257
298
  iconMap,
299
+ breakpoints: DEFAULT_STATE.breakpoints,
258
300
  });
259
301
  const setContext = React.useCallback((newValue) => (setInternalContext((prevInternalContext) => (Object.assign(Object.assign({}, prevInternalContext), newValue)))), []);
302
+ React.useLayoutEffect(() => {
303
+ setContext({
304
+ breakpoints: {
305
+ xs: getCssVariable(`--${PREFIX_BS}breakpoint-xs`),
306
+ sm: getCssVariable(`--${PREFIX_BS}breakpoint-sm`),
307
+ md: getCssVariable(`--${PREFIX_BS}breakpoint-md`),
308
+ lg: getCssVariable(`--${PREFIX_BS}breakpoint-lg`),
309
+ xl: getCssVariable(`--${PREFIX_BS}breakpoint-xl`),
310
+ xxl: getCssVariable(`--${PREFIX_BS}breakpoint-xxl`),
311
+ },
312
+ });
313
+ }, [setContext]);
260
314
  const value = React.useMemo(() => (Object.assign(Object.assign({}, internalContext), { setContext })), [internalContext, setContext]);
261
315
  return (jsxRuntime.jsx(DContext.Provider, { value: value, children: jsxRuntime.jsx(DPortalContextProvider, { portalName: portalName, availablePortals: availablePortals, children: children }) }));
262
316
  }
@@ -315,18 +369,494 @@ function DBadge({ text, soft = false, theme = 'primary', id, rounded, className,
315
369
  return (jsxRuntime.jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, dataAttributes, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsxRuntime.jsx("span", { children: text }), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }))] })));
316
370
  }
317
371
 
372
+ /* eslint-disable */
373
+ /**
374
+ * This file is originally from `@primer/react`
375
+ * The original source for this lived in the URL below.
376
+ *
377
+ * @see https://github.com/primer/react/blob/216d2a9f57b8acb0701ab4e04a23e057fc325c90/src/hooks/useProvidedRefOrCreate.ts
378
+ */
379
+ /**
380
+ * There are some situations where we only want to create a new ref if one is not provided to a component
381
+ * or hook as a prop. However, due to the `rules-of-hooks`, we cannot conditionally make a call to `React.useRef`
382
+ * only in the situations where the ref is not provided as a prop.
383
+ * This hook aims to encapsulate that logic, so the consumer doesn't need to be concerned with violating `rules-of-hooks`.
384
+ * @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
385
+ * @type TRef The type of the RefObject which should be created.
386
+ */
387
+ function useProvidedRefOrCreate(providedRef) {
388
+ const createdRef = React.useRef(null);
389
+ return providedRef !== null && providedRef !== void 0 ? providedRef : createdRef;
390
+ }
391
+
392
+ function DInput(_a, ref) {
393
+ 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 = tslib.__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"]);
394
+ const inputRef = useProvidedRefOrCreate(ref);
395
+ const innerId = React.useId();
396
+ const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
397
+ const handleOnChange = React.useCallback((event) => {
398
+ onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value);
399
+ }, [onChange]);
400
+ const handleOnIconStartClick = React.useCallback(() => {
401
+ onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(value);
402
+ }, [onIconStartClick, value]);
403
+ const handleOnIconEndClick = React.useCallback(() => {
404
+ onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(value);
405
+ }, [onIconEndClick, value]);
406
+ const ariaDescribedby = React.useMemo(() => ([
407
+ !!inputStart && `${id}InputStart`,
408
+ !!iconStart && `${id}Start`,
409
+ (invalid || valid) && !iconEnd && !loading && `${id}State`,
410
+ (iconEnd && !loading) && `${id}End`,
411
+ loading && `${id}Loading`,
412
+ !!inputEnd && `${id}InputEnd`,
413
+ !!hint && `${id}Hint`,
414
+ ]
415
+ .filter(Boolean)
416
+ .join(' ')), [
417
+ id,
418
+ inputStart,
419
+ iconStart,
420
+ invalid,
421
+ valid,
422
+ iconEnd,
423
+ loading,
424
+ inputEnd,
425
+ hint,
426
+ ]);
427
+ const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
428
+ 'is-invalid': invalid,
429
+ 'is-valid': valid,
430
+ }), disabled: disabled || loading, value: value, onChange: handleOnChange }, (floatingLabel || placeholder) && { placeholder: floatingLabel ? '' : placeholder }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
431
+ ariaDescribedby,
432
+ disabled,
433
+ handleOnChange,
434
+ id,
435
+ inputProps,
436
+ inputRef,
437
+ invalid,
438
+ loading,
439
+ placeholder,
440
+ floatingLabel,
441
+ valid,
442
+ value,
443
+ ]);
444
+ const labelComponent = React.useMemo(() => (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix, materialStyle: labelIconMaterialStyle }))] })), [
445
+ id,
446
+ label,
447
+ labelIcon,
448
+ labelIconFamilyClass,
449
+ labelIconFamilyPrefix,
450
+ labelIconMaterialStyle,
451
+ ]);
452
+ const dynamicComponent = React.useMemo(() => {
453
+ if (floatingLabel) {
454
+ return (jsxRuntime.jsxs("div", { className: "form-floating", children: [inputComponent, labelComponent] }));
455
+ }
456
+ return inputComponent;
457
+ }, [floatingLabel, inputComponent, labelComponent]);
458
+ return (jsxRuntime.jsxs("div", Object.assign({ className: className, style: style }, dataAttributes, { children: [label && !floatingLabel && labelComponent, jsxRuntime.jsxs("div", { className: classNames({
459
+ [`input-group-${size}`]: !!size,
460
+ 'input-group': true,
461
+ 'has-validation': invalid || valid,
462
+ }), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputStart`, children: inputStart })), iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading || iconStartDisabled, "aria-label": iconStartAriaLabel, tabIndex: onIconStartClick ? iconStartTabIndex : -1, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })), dynamicComponent, (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading || iconEndDisabled, "aria-label": iconEndAriaLabel, tabIndex: onIconEndClick ? iconEndTabIndex : -1, children: jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}Loading`, children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })), !!inputEnd && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputEnd`, children: inputEnd }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
463
+ }
464
+ const ForwardedDInput = React.forwardRef(DInput);
465
+ ForwardedDInput.displayName = 'DInput';
466
+
467
+ /**
468
+ * Check if the provided file type should be accepted by the input with accept attribute.
469
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#attr-accept
470
+ *
471
+ * Inspired by https://github.com/enyo/dropzone
472
+ *
473
+ * @param file {File} https://developer.mozilla.org/en-US/docs/Web/API/File
474
+ * @param acceptedFiles {string|string[]}
475
+ * @returns {boolean}
476
+ */
477
+ function attrAccept(file, acceptedFiles) {
478
+ if (file && acceptedFiles) {
479
+ const acceptedFilesArray = Array.isArray(acceptedFiles)
480
+ ? acceptedFiles
481
+ : acceptedFiles.split(',');
482
+ if (acceptedFilesArray.length === 0) {
483
+ return true;
484
+ }
485
+ const fileName = file.name || '';
486
+ const mimeType = (file.type || '').toLowerCase();
487
+ const baseMimeType = mimeType.replace(/\/.*$/, '');
488
+ return acceptedFilesArray.some((type) => {
489
+ const validType = type.trim().toLowerCase();
490
+ if (validType.charAt(0) === '.') {
491
+ return fileName.toLowerCase().endsWith(validType);
492
+ }
493
+ if (validType.endsWith('/*')) {
494
+ // This is something like a image/* mime type
495
+ return baseMimeType === validType.replace(/\/.*$/, '');
496
+ }
497
+ return mimeType === validType;
498
+ });
499
+ }
500
+ return true;
501
+ }
502
+
503
+ const isIeOrEdge = (userAgent = window.navigator.userAgent) => ((userAgent.indexOf('MSIE') !== -1 || userAgent.indexOf('Trident/') !== -1)
504
+ || userAgent.indexOf('Edge/') !== -1);
505
+ const ErrorCodes = {
506
+ FileInvalidType: 'file-invalid-type',
507
+ FileTooLarge: 'file-too-large',
508
+ FileTooSmall: 'file-too-small',
509
+ TooManyFiles: 'too-many-files',
510
+ FailedFetch: 'failed-fetch-file',
511
+ };
512
+ // Check if v is a MIME type string.
513
+ function isMIMEType(v) {
514
+ return (v === 'audio/*'
515
+ || v === 'video/*'
516
+ || v === 'image/*'
517
+ || v === 'text/*'
518
+ || v === 'application/*'
519
+ || /\w+\/[-+.\w]+/g.test(v));
520
+ }
521
+ // Check if v is a file extension.
522
+ function isExt(v) {
523
+ return /^.*\.[\w]+$/.test(v);
524
+ }
525
+ function isDefined(value) {
526
+ return value !== undefined && value !== null;
527
+ }
528
+ // Convert the `{accept}` dropzone prop to an array of MIME types/extensions.
529
+ function acceptPropAsAcceptAttr(accept) {
530
+ return (Object.entries(accept)
531
+ .reduce((a, [mimeType, ext]) => [...a, mimeType, ...ext], [])
532
+ .filter((v) => isMIMEType(v) || isExt(v))
533
+ .join(','));
534
+ }
535
+ function fileAccepted(file, accept) {
536
+ const isAcceptable = file.type === 'application/x-moz-file' || attrAccept(file, accept);
537
+ if (!isAcceptable) {
538
+ return [
539
+ false,
540
+ {
541
+ code: ErrorCodes.FileInvalidType,
542
+ message: 'File has an unsupported file type',
543
+ },
544
+ ];
545
+ }
546
+ return [true, null];
547
+ }
548
+ function fileMatchSize(file, minSize, maxSize) {
549
+ if (isDefined(file.size)) {
550
+ if (isDefined(minSize) && file.size < minSize) {
551
+ return [
552
+ false,
553
+ {
554
+ code: ErrorCodes.FileTooSmall,
555
+ message: `File "${file.name}" is too small. Minimum size is ${minSize} bytes.`,
556
+ },
557
+ ];
558
+ }
559
+ if (isDefined(maxSize) && file.size > maxSize) {
560
+ return [
561
+ false, {
562
+ code: ErrorCodes.FileTooLarge,
563
+ message: `File "${file.name}" is too large. Maximum size is ${maxSize} bytes.`,
564
+ },
565
+ ];
566
+ }
567
+ }
568
+ return [true, null];
569
+ }
570
+ async function urlToFile(url) {
571
+ var _a;
572
+ try {
573
+ const res = await fetch(url);
574
+ if (!res.ok) {
575
+ return [
576
+ null,
577
+ {
578
+ code: ErrorCodes.FailedFetch,
579
+ message: `Failed to fetch file from ${url}`,
580
+ },
581
+ ];
582
+ }
583
+ const blob = await res.blob();
584
+ const filename = ((_a = url.split('/').pop()) === null || _a === void 0 ? void 0 : _a.split('?')[0]) || 'file';
585
+ const file = new File([blob], filename, { type: blob.type });
586
+ return [file, null];
587
+ }
588
+ catch (error) {
589
+ return [
590
+ null,
591
+ {
592
+ code: ErrorCodes.FailedFetch,
593
+ message: `Failed to fetch file from ${url}}`,
594
+ },
595
+ ];
596
+ }
597
+ }
598
+ async function urlsToFiles(urls) {
599
+ const results = await Promise.all(urls.map(urlToFile));
600
+ let acceptedFiles = [];
601
+ let errors = [];
602
+ results.forEach(([file, error]) => {
603
+ if (file) {
604
+ acceptedFiles = [...acceptedFiles, file];
605
+ }
606
+ if (error) {
607
+ errors = [...errors, error];
608
+ }
609
+ });
610
+ return [acceptedFiles, errors];
611
+ }
612
+ const DEFAULT_PROPS = {
613
+ disabled: false,
614
+ maxSize: Infinity,
615
+ minSize: 0,
616
+ multiple: false,
617
+ maxFiles: Infinity,
618
+ noClick: false,
619
+ noKeyboard: false,
620
+ noDrag: false,
621
+ autoFocus: false,
622
+ };
623
+
624
+ /* eslint-disable no-param-reassign */
625
+ function useDBoxFile(props) {
626
+ const { accept, autoFocus, disabled, maxSize, minSize, multiple, maxFiles, value: preloadUrls, onDragEnter, onDragLeave, onDrop, onError, noClick, noKeyboard, noDrag, } = Object.assign(Object.assign({}, DEFAULT_PROPS), props);
627
+ const inputRef = React.useRef(null);
628
+ const rootRef = React.useRef(null);
629
+ const dragTargetsRef = React.useRef([]);
630
+ const acceptAttr = React.useMemo(() => acceptPropAsAcceptAttr(accept), [accept]);
631
+ const [files, setFiles] = React.useState([]);
632
+ const [isDragValid, setIsDragValid] = React.useState(false);
633
+ const [isDragInvalid, setIsDragInvalid] = React.useState(false);
634
+ const preventDropOnDocument = React.useCallback((event) => {
635
+ if (rootRef.current && rootRef.current.contains(event.target)) {
636
+ // If we intercepted an event for our instance
637
+ // let it propagate down to the instance's onDrop handler
638
+ return;
639
+ }
640
+ event.preventDefault();
641
+ dragTargetsRef.current = [];
642
+ }, []);
643
+ React.useEffect(() => {
644
+ // Prevent drop over anywhere in the document
645
+ document.addEventListener('dragover', preventDropOnDocument, false);
646
+ document.addEventListener('drop', preventDropOnDocument, false);
647
+ return () => {
648
+ document.removeEventListener('dragover', preventDropOnDocument);
649
+ document.removeEventListener('drop', preventDropOnDocument);
650
+ };
651
+ }, [preventDropOnDocument]);
652
+ // Auto focus the root when autoFocus is true
653
+ React.useEffect(() => {
654
+ if (!disabled && autoFocus && rootRef.current) {
655
+ rootRef.current.focus();
656
+ }
657
+ }, [rootRef, autoFocus, disabled]);
658
+ React.useEffect(() => {
659
+ if (!preloadUrls || !preloadUrls.length)
660
+ return;
661
+ // eslint-disable-next-line no-void
662
+ void (async () => {
663
+ const [accepted, errors] = await urlsToFiles(preloadUrls);
664
+ if (accepted.length) {
665
+ setFiles(accepted);
666
+ }
667
+ if (errors.length) {
668
+ onError === null || onError === void 0 ? void 0 : onError(new Error(errors.map((e) => e.message).join(', ')));
669
+ }
670
+ })();
671
+ }, [preloadUrls, onError]);
672
+ const processFiles = React.useCallback((inputFiles, event) => {
673
+ let acceptedFiles = [];
674
+ let rejectedFiles = [];
675
+ // Handle size and type validation
676
+ inputFiles.forEach((file) => {
677
+ const [isTypeValid, acceptError] = fileAccepted(file, acceptAttr);
678
+ const [isSizeValid, sizeError] = fileMatchSize(file, minSize, maxSize);
679
+ const errors = [acceptError, sizeError].filter((e) => Boolean(e));
680
+ if (isTypeValid && isSizeValid) {
681
+ acceptedFiles = [...acceptedFiles, file];
682
+ }
683
+ else {
684
+ rejectedFiles = [...rejectedFiles, { file, errors }];
685
+ }
686
+ });
687
+ // Handle maxFiles overflow by trimming
688
+ const total = files.length + acceptedFiles.length;
689
+ if (total > maxFiles) {
690
+ const allowed = Math.max(0, maxFiles - files.length);
691
+ const accepted = acceptedFiles.slice(0, allowed);
692
+ const rejected = acceptedFiles.slice(allowed).map((file) => ({
693
+ file,
694
+ errors: [
695
+ {
696
+ code: ErrorCodes.TooManyFiles,
697
+ message: `Exceeds maximum number of files (${maxFiles})`,
698
+ },
699
+ ],
700
+ }));
701
+ acceptedFiles = [...accepted];
702
+ rejectedFiles = [...rejectedFiles, ...rejected];
703
+ }
704
+ if (multiple) {
705
+ setFiles((prev) => [...prev, ...acceptedFiles]);
706
+ }
707
+ else {
708
+ setFiles(acceptedFiles.slice(0, 1));
709
+ }
710
+ if (onDrop) {
711
+ onDrop(acceptedFiles, rejectedFiles, event);
712
+ }
713
+ }, [
714
+ acceptAttr,
715
+ files.length,
716
+ maxFiles,
717
+ maxSize,
718
+ minSize,
719
+ multiple,
720
+ onDrop,
721
+ ]);
722
+ const handleDragEnter = React.useCallback((event) => {
723
+ event.preventDefault();
724
+ event.stopPropagation();
725
+ if (disabled || noDrag)
726
+ return;
727
+ if (event.target instanceof HTMLElement) {
728
+ dragTargetsRef.current = [...dragTargetsRef.current, event.target];
729
+ }
730
+ fileSelector.fromEvent(event).then((eventFiles) => {
731
+ const fileCount = eventFiles.length;
732
+ if (fileCount === 0) {
733
+ setIsDragValid(false);
734
+ setIsDragInvalid(true);
735
+ return;
736
+ }
737
+ const isDragAccepted = eventFiles.every((file) => {
738
+ const [typeValid] = fileAccepted(file, acceptAttr);
739
+ const [sizeValid] = fileMatchSize(file, minSize, maxSize);
740
+ return typeValid && sizeValid;
741
+ });
742
+ setIsDragValid(isDragAccepted);
743
+ setIsDragInvalid(!isDragAccepted);
744
+ onDragEnter === null || onDragEnter === void 0 ? void 0 : onDragEnter(event);
745
+ }).catch((error) => {
746
+ onError === null || onError === void 0 ? void 0 : onError(error);
747
+ });
748
+ }, [
749
+ acceptAttr,
750
+ disabled,
751
+ maxSize,
752
+ minSize,
753
+ noDrag,
754
+ onDragEnter,
755
+ onError,
756
+ ]);
757
+ const handleDrop = React.useCallback((event) => {
758
+ event.preventDefault();
759
+ event.persist();
760
+ event.stopPropagation();
761
+ dragTargetsRef.current = [];
762
+ setIsDragValid(false);
763
+ setIsDragInvalid(false);
764
+ if (disabled || noDrag)
765
+ return;
766
+ const droppedArray = Array.from(event.dataTransfer.files);
767
+ processFiles(droppedArray, event.nativeEvent);
768
+ }, [
769
+ disabled,
770
+ noDrag,
771
+ processFiles,
772
+ ]);
773
+ const handleDragLeave = React.useCallback((event) => {
774
+ event.preventDefault();
775
+ event.stopPropagation();
776
+ if (disabled || noDrag)
777
+ return;
778
+ // Only deactivate once the dropzone and all children have been left
779
+ const targets = dragTargetsRef.current.filter((target) => rootRef.current && rootRef.current.contains(target));
780
+ // Make sure to remove a target present multiple times only once
781
+ // (Firefox may fire dragenter/dragleave multiple times on the same element)
782
+ if (event.target instanceof HTMLElement) {
783
+ const targetIdx = targets.indexOf(event.target);
784
+ if (targetIdx !== -1) {
785
+ targets.splice(targetIdx, 1);
786
+ }
787
+ dragTargetsRef.current = targets;
788
+ }
789
+ if (targets.length === 0) {
790
+ setIsDragValid(false);
791
+ setIsDragInvalid(false);
792
+ onDragLeave === null || onDragLeave === void 0 ? void 0 : onDragLeave(event);
793
+ }
794
+ }, [disabled, noDrag, onDragLeave]);
795
+ const handleFileSelect = React.useCallback((event) => {
796
+ const targetFiles = event.target.files;
797
+ if (!targetFiles)
798
+ return;
799
+ const selectedFiles = Array.from(targetFiles);
800
+ processFiles(selectedFiles, event.nativeEvent);
801
+ event.target.value = '';
802
+ }, [processFiles]);
803
+ const handleRemoveFile = React.useCallback((index) => {
804
+ setFiles((prevFiles) => prevFiles.filter((_, i) => i !== index));
805
+ }, []);
806
+ const openFileDialog = React.useCallback(() => {
807
+ var _a;
808
+ if (disabled)
809
+ return;
810
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
811
+ }, [disabled]);
812
+ const handleClick = React.useCallback(() => {
813
+ if (noClick) {
814
+ return;
815
+ }
816
+ if (isIeOrEdge()) {
817
+ setTimeout(openFileDialog, 0);
818
+ }
819
+ else {
820
+ openFileDialog();
821
+ }
822
+ }, [noClick, openFileDialog]);
823
+ const handleKeyDown = React.useCallback((event) => {
824
+ if (!noKeyboard && (event.key === ' ' || event.key === 'Enter')) {
825
+ event.preventDefault();
826
+ openFileDialog();
827
+ }
828
+ }, [noKeyboard, openFileDialog]);
829
+ return {
830
+ inputRef,
831
+ rootRef,
832
+ files,
833
+ isDragValid,
834
+ isDragInvalid,
835
+ acceptAttr,
836
+ openFileDialog,
837
+ handleFileSelect,
838
+ handleDrop,
839
+ handleDragEnter,
840
+ handleDragLeave,
841
+ handleRemoveFile,
842
+ handleClick,
843
+ handleKeyDown,
844
+ };
845
+ }
846
+
318
847
  function DBoxFile(_a) {
319
- var { icon: iconProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, disabled = false, children, className, style, dataAttributes } = _a, dropzoneOptions = tslib.__rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "disabled", "children", "className", "style", "dataAttributes"]);
320
- const { acceptedFiles, getRootProps, getInputProps, } = reactDropzone.useDropzone(Object.assign({ disabled }, dropzoneOptions));
321
- const { iconMap: { upload, }, } = useDContext();
848
+ var { icon: iconProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, children, className, style, dataAttributes } = _a, props = tslib.__rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "children", "className", "style", "dataAttributes"]);
849
+ const { iconMap: { upload } } = useDContext();
322
850
  const icon = React.useMemo(() => iconProp || upload, [iconProp, upload]);
323
- return (jsxRuntime.jsxs("section", Object.assign({ className: classNames('d-box-file', {
324
- 'd-box-file-selected': !!acceptedFiles.length,
325
- }, className), style: style }, dataAttributes, { children: [jsxRuntime.jsxs("div", Object.assign({}, getRootProps({
326
- className: classNames('d-box-file-dropzone', {
327
- disabled,
328
- }),
329
- }), { children: [jsxRuntime.jsx("input", Object.assign({}, getInputProps())), jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }), jsxRuntime.jsx("div", { className: "d-box-content", children: children })] })), !!acceptedFiles.length && (jsxRuntime.jsx("aside", { className: "d-box-files", children: acceptedFiles.map((file) => (jsxRuntime.jsx("div", { className: "d-box-files-text", children: `${file.name} - ${file.size} bytes` }, file.name))) }))] })));
851
+ const { inputRef, rootRef, isDragValid, isDragInvalid, acceptAttr, files, handleFileSelect, handleDrop, handleDragEnter, handleDragLeave, handleClick, handleKeyDown, handleRemoveFile, openFileDialog, } = useDBoxFile(props);
852
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("section", Object.assign({ className: classNames('d-box-file', {
853
+ 'd-box-file-selected': files.length > 0,
854
+ 'd-box-file-disabled': props.disabled,
855
+ 'd-box-file-valid': isDragValid,
856
+ 'd-box-file-invalid': isDragInvalid,
857
+ }, className), style: style }, dataAttributes, { children: jsxRuntime.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: [jsxRuntime.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 }), jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }), jsxRuntime.jsx("div", { className: "d-box-content", children: typeof children === 'function'
858
+ ? children(openFileDialog)
859
+ : children })] })) })), !!files.length && (jsxRuntime.jsx("ul", { className: "d-box-files", children: files.map((file, index) => (jsxRuntime.jsx(ForwardedDInput, { value: file.name, iconStart: "paperclip", iconEnd: "trash", readOnly: true, onIconEndClick: () => handleRemoveFile(index) }, file.name))) }))] }));
330
860
  }
331
861
 
332
862
  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, }) {
@@ -467,102 +997,6 @@ function DCurrencyText({ value, className, style, dataAttributes, }) {
467
997
  return (jsxRuntime.jsx("span", Object.assign({ className: className, style: style }, dataAttributes, { children: valueFormatted })));
468
998
  }
469
999
 
470
- /* eslint-disable */
471
- /**
472
- * This file is originally from `@primer/react`
473
- * The original source for this lived in the URL below.
474
- *
475
- * @see https://github.com/primer/react/blob/216d2a9f57b8acb0701ab4e04a23e057fc325c90/src/hooks/useProvidedRefOrCreate.ts
476
- */
477
- /**
478
- * There are some situations where we only want to create a new ref if one is not provided to a component
479
- * or hook as a prop. However, due to the `rules-of-hooks`, we cannot conditionally make a call to `React.useRef`
480
- * only in the situations where the ref is not provided as a prop.
481
- * This hook aims to encapsulate that logic, so the consumer doesn't need to be concerned with violating `rules-of-hooks`.
482
- * @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
483
- * @type TRef The type of the RefObject which should be created.
484
- */
485
- function useProvidedRefOrCreate(providedRef) {
486
- const createdRef = React.useRef(null);
487
- return providedRef !== null && providedRef !== void 0 ? providedRef : createdRef;
488
- }
489
-
490
- function DInput(_a, ref) {
491
- 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 = tslib.__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"]);
492
- const inputRef = useProvidedRefOrCreate(ref);
493
- const innerId = React.useId();
494
- const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
495
- const handleOnChange = React.useCallback((event) => {
496
- onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value);
497
- }, [onChange]);
498
- const handleOnIconStartClick = React.useCallback(() => {
499
- onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(value);
500
- }, [onIconStartClick, value]);
501
- const handleOnIconEndClick = React.useCallback(() => {
502
- onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(value);
503
- }, [onIconEndClick, value]);
504
- const ariaDescribedby = React.useMemo(() => ([
505
- !!inputStart && `${id}InputStart`,
506
- !!iconStart && `${id}Start`,
507
- (invalid || valid) && !iconEnd && !loading && `${id}State`,
508
- (iconEnd && !loading) && `${id}End`,
509
- loading && `${id}Loading`,
510
- !!inputEnd && `${id}InputEnd`,
511
- !!hint && `${id}Hint`,
512
- ]
513
- .filter(Boolean)
514
- .join(' ')), [
515
- id,
516
- inputStart,
517
- iconStart,
518
- invalid,
519
- valid,
520
- iconEnd,
521
- loading,
522
- inputEnd,
523
- hint,
524
- ]);
525
- const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
526
- [`form-control-${size}`]: !!size,
527
- 'is-invalid': invalid,
528
- 'is-valid': valid,
529
- }), disabled: disabled || loading, value: value, onChange: handleOnChange }, (floatingLabel || placeholder) && { placeholder: floatingLabel ? '' : placeholder }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
530
- ariaDescribedby,
531
- disabled,
532
- handleOnChange,
533
- id,
534
- inputProps,
535
- inputRef,
536
- invalid,
537
- loading,
538
- placeholder,
539
- floatingLabel,
540
- valid,
541
- value,
542
- size,
543
- ]);
544
- const labelComponent = React.useMemo(() => (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix, materialStyle: labelIconMaterialStyle }))] })), [
545
- id,
546
- label,
547
- labelIcon,
548
- labelIconFamilyClass,
549
- labelIconFamilyPrefix,
550
- labelIconMaterialStyle,
551
- ]);
552
- const dynamicComponent = React.useMemo(() => {
553
- if (floatingLabel) {
554
- return (jsxRuntime.jsxs("div", { className: "form-floating", children: [inputComponent, labelComponent] }));
555
- }
556
- return inputComponent;
557
- }, [floatingLabel, inputComponent, labelComponent]);
558
- return (jsxRuntime.jsxs("div", Object.assign({ className: className, style: style }, dataAttributes, { children: [label && !floatingLabel && labelComponent, jsxRuntime.jsxs("div", { className: classNames({
559
- 'input-group': true,
560
- 'has-validation': invalid || valid,
561
- }), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputStart`, children: inputStart })), iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading || iconStartDisabled, "aria-label": iconStartAriaLabel, tabIndex: onIconStartClick ? iconStartTabIndex : -1, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })), dynamicComponent, (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading || iconEndDisabled, "aria-label": iconEndAriaLabel, tabIndex: onIconEndClick ? iconEndTabIndex : -1, children: jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}Loading`, children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })), !!inputEnd && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputEnd`, children: inputEnd }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
562
- }
563
- const ForwardedDInput = React.forwardRef(DInput);
564
- ForwardedDInput.displayName = 'DInput';
565
-
566
1000
  function DDatePickerTime(_a) {
567
1001
  var { value, onChange, id, label, className, style } = _a, props = tslib.__rest(_a, ["value", "onChange", "id", "label", "className", "style"]);
568
1002
  return (jsxRuntime.jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsxRuntime.jsx("label", { htmlFor: id, className: "d-datepicker-time-label", children: label })), jsxRuntime.jsx(ForwardedDInput, Object.assign({ className: "w-100" }, onChange && {
@@ -572,7 +1006,8 @@ function DDatePickerTime(_a) {
572
1006
 
573
1007
  function DDatePickerInput(_a, ref) {
574
1008
  var { value, onClick, id, iconEnd, className, style, inputLabel, readOnly: ignored } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style", "inputLabel", "readOnly"]);
575
- return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: ref, onClick: onClick, readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style, label: inputLabel }, props)));
1009
+ const { iconMap: { calendar } } = useDContext();
1010
+ return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: ref, onClick: onClick, readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd || calendar, className: className, style: style, label: inputLabel }, props)));
576
1011
  }
577
1012
  const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
578
1013
  ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
@@ -656,8 +1091,8 @@ function DSelectDropdownIndicator(props) {
656
1091
  }
657
1092
 
658
1093
  function DSelectClearIndicator(props) {
659
- const { iconMap: { xLg, }, } = useDContext();
660
- return (jsxRuntime.jsx(Select.components.ClearIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: xLg }) })));
1094
+ const { iconMap: { x, }, } = useDContext();
1095
+ return (jsxRuntime.jsx(Select.components.ClearIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: x }) })));
661
1096
  }
662
1097
 
663
1098
  function DSelectMultiValueRemove(props) {
@@ -741,43 +1176,65 @@ var DSelect$1 = Object.assign(DSelect, {
741
1176
  Placeholder: DSelectPlaceholder,
742
1177
  });
743
1178
 
744
- function DDatePickerHeader({ date, changeYear, changeMonth, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, iconPrevMonth, iconNextMonth, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', iconSize, buttonVariant, buttonTheme, locale, style, className, minYearSelect, maxYearSelect, }) {
1179
+ var PickerType;
1180
+ (function (PickerType) {
1181
+ PickerType["Default"] = "default";
1182
+ PickerType["Quarter"] = "quarter";
1183
+ PickerType["Month"] = "month";
1184
+ PickerType["Year"] = "year";
1185
+ })(PickerType || (PickerType = {}));
1186
+ 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 = 'sm', buttonVariant = 'link', buttonTheme = 'dark', style, className, minYearSelect = 1900, maxYearSelect = 2100, showHeaderSelectors = false, customHeaderCount, }) {
1187
+ const { iconMap: { chevronLeft, chevronRight, }, } = useDContext();
745
1188
  const arrayYears = React.useMemo(() => Array.from({ length: maxYearSelect - minYearSelect + 1 }, (_, index) => minYearSelect + index), [maxYearSelect, minYearSelect]);
746
1189
  const years = React.useMemo(() => arrayYears.map((year) => ({
747
1190
  label: year.toString(),
748
1191
  value: year,
749
1192
  })), [arrayYears]);
750
- const defaultYear = React.useMemo(() => years.find((year) => year.value === dateFns.getYear(date)), [date, years]);
751
- const arrayMonths = React.useMemo(() => Array.from({ length: 12 }, (_, i) => dateFns.format(new Date(2000, i), 'LLLL', { locale })), [locale]);
1193
+ const defaultYear = React.useMemo(() => years.find((year) => year.value === dateFns.getYear(monthDate)), [monthDate, years]);
1194
+ const arrayMonths = React.useMemo(() => Array.from({ length: 12 }, (_, i) => dateFns.format(new Date(2000, i), 'LLLL', { locale: locale.enUS })), []);
752
1195
  const months = React.useMemo(() => arrayMonths.map((month, i) => ({
753
1196
  label: month,
754
1197
  value: i,
755
1198
  })), [arrayMonths]);
756
1199
  const defaultMonth = React.useMemo(() => ({
757
- label: arrayMonths[dateFns.getMonth(date)],
758
- value: dateFns.getMonth(date),
759
- }), [arrayMonths, date]);
760
- return (jsxRuntime.jsxs("div", { className: classNames('d-flex align-items-center d-datepicker-header', className), style: style, children: [jsxRuntime.jsx(DButton, { iconStart: iconPrevMonth, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseMonth, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button" }), jsxRuntime.jsxs("div", { className: "d-flex justify-content-center flex-grow-1", children: [jsxRuntime.jsx(DSelect$1, { options: months, value: defaultMonth, defaultValue: defaultMonth, onChange: (month) => changeMonth((month === null || month === void 0 ? void 0 : month.value) || 0), searchable: false }), jsxRuntime.jsx(DSelect$1, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })] }), jsxRuntime.jsx(DButton, { iconStart: iconNextMonth, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button" })] }));
1200
+ label: arrayMonths[dateFns.getMonth(monthDate)],
1201
+ value: dateFns.getMonth(monthDate),
1202
+ }), [arrayMonths, monthDate]);
1203
+ const getYearRange = React.useCallback(() => {
1204
+ const blockIndex = Math.floor((date.getFullYear() - 1) / 12);
1205
+ const startYear = blockIndex * 12 + 1;
1206
+ const endYear = startYear + 11;
1207
+ return [startYear, endYear];
1208
+ }, [date]);
1209
+ const [startYear, endYear] = getYearRange();
1210
+ if (pickerType === PickerType.Year) {
1211
+ return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsxRuntime.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" }), jsxRuntime.jsx("p", { children: `${startYear} - ${endYear}` }), jsxRuntime.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" })] }));
1212
+ }
1213
+ if (pickerType === PickerType.Quarter || pickerType === PickerType.Month) {
1214
+ return (jsxRuntime.jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsxRuntime.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' } }), jsxRuntime.jsx("div", { className: "d-flex justify-content-center flex-grow-1", children: showHeaderSelectors ? (jsxRuntime.jsx(DSelect$1, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })) : (jsxRuntime.jsx("p", { children: defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label })) }), jsxRuntime.jsx(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' } })] }));
1215
+ }
1216
+ return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [jsxRuntime.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 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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" }), jsxRuntime.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" })] })) : (jsxRuntime.jsx("p", { children: `${defaultMonth.label} ${defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label}` })), jsxRuntime.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' } })] }));
761
1217
  }
762
1218
 
763
- /**
764
- * @deprecated
765
- */
766
1219
  function DDatePicker(_a) {
767
- var { date, selectsRange = false, inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, iconInput: iconInputProp, iconHeaderPrevMonth: iconHeaderPrevMonthProp, iconHeaderNextMonth: iconHeaderNextMonthProp, iconMaterialStyle: iconMaterialStyleProp, iconFamilyClass, iconFamilyPrefix, minYearSelect = 1900, maxYearSelect = 2100, iconHeaderSize = 'sm', headerPrevMonthAriaLabel = 'decrease month', headerNextMonthAriaLabel = 'increase month', headerButtonVariant = 'link', headerButtonTheme = 'dark', invalid = false, valid = false, renderCustomHeader: renderCustomHeaderProp, locale, className, formatWeekDay: formatWeekDayProp, style, dataAttributes, placeholder } = _a, props = tslib.__rest(_a, ["date", "selectsRange", "inputLabel", "inputHint", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeLabel", "iconInput", "iconHeaderPrevMonth", "iconHeaderNextMonth", "iconMaterialStyle", "iconFamilyClass", "iconFamilyPrefix", "minYearSelect", "maxYearSelect", "iconHeaderSize", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "headerButtonVariant", "headerButtonTheme", "invalid", "valid", "renderCustomHeader", "locale", "className", "formatWeekDay", "style", "dataAttributes", "placeholder"]);
768
- const { iconMap: { calendar, chevronLeft, chevronRight, }, } = useDContext();
769
- const selected = React.useMemo(() => (date ? dateFns.parseISO(date) : null), [date]);
770
- const iconInput = React.useMemo(() => iconInputProp || calendar, [calendar, iconInputProp]);
771
- const handleFormatWeekDay = React.useMemo(() => (formatWeekDayProp
772
- ? (day) => formatWeekDayProp(day)
773
- : (day) => day.substring(0, 1)), [formatWeekDayProp]);
774
- const iconPrevMonth = React.useMemo(() => iconHeaderPrevMonthProp || chevronLeft, [chevronLeft, iconHeaderPrevMonthProp]);
775
- const iconNextMonth = React.useMemo(() => iconHeaderNextMonthProp || chevronRight, [chevronRight, iconHeaderNextMonthProp]);
776
- const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, { iconPrevMonth: iconPrevMonth, iconNextMonth: iconNextMonth, iconMaterialStyle: iconMaterialStyleProp, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize: iconHeaderSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, minYearSelect: minYearSelect, maxYearSelect: maxYearSelect }))), [
777
- locale,
778
- iconPrevMonth,
779
- iconNextMonth,
780
- iconMaterialStyleProp,
1220
+ var { inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, 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 = tslib.__rest(_a, ["inputLabel", "inputHint", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeLabel", "iconInput", "iconHeaderPrev", "iconHeaderNext", "iconMaterialStyle", "iconFamilyClass", "iconFamilyPrefix", "minYearSelect", "maxYearSelect", "iconHeaderSize", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "headerButtonVariant", "headerButtonTheme", "invalid", "valid", "renderCustomHeader", "className", "dateFormatCalendar", "style", "dataAttributes", "placeholder", "showHeaderSelectors"]);
1221
+ const pickerType = React.useMemo(() => {
1222
+ if (props.showQuarterYearPicker)
1223
+ return PickerType.Quarter;
1224
+ if (props.showMonthYearPicker)
1225
+ return PickerType.Month;
1226
+ if (props.showYearPicker)
1227
+ return PickerType.Year;
1228
+ return PickerType.Default;
1229
+ }, [
1230
+ props.showQuarterYearPicker,
1231
+ props.showMonthYearPicker,
1232
+ props.showYearPicker,
1233
+ ]);
1234
+ const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.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 }))), [
1235
+ iconHeaderNext,
1236
+ iconHeaderPrev,
1237
+ iconMaterialStyle,
781
1238
  headerPrevMonthAriaLabel,
782
1239
  headerNextMonthAriaLabel,
783
1240
  iconHeaderSize,
@@ -785,10 +1242,13 @@ function DDatePicker(_a) {
785
1242
  headerButtonTheme,
786
1243
  minYearSelect,
787
1244
  maxYearSelect,
1245
+ pickerType,
1246
+ showHeaderSelectors,
1247
+ props.monthsShown,
788
1248
  ]);
789
1249
  const defaultRenderCustomHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps))), [DatePickerHeader]);
790
1250
  const renderCustomHeader = React.useMemo(() => (renderCustomHeaderProp || defaultRenderCustomHeader), [defaultRenderCustomHeader, renderCustomHeaderProp]);
791
- return (jsxRuntime.jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, selectsRange: selectsRange, formatWeekDay: handleFormatWeekDay, customInput: (jsxRuntime.jsx(ForwardedDDatePickerInput, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyleProp, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, hint: inputHint })), customTimeInput: (jsxRuntime.jsx(DDatePickerTime, { id: timeId, label: timeLabel })), placeholderText: placeholder }, locale && { locale }, dataAttributes, props)));
1251
+ return (jsxRuntime.jsx(DatePicker, Object.assign({ calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, customInput: (jsxRuntime.jsx(ForwardedDDatePickerInput, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyle, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, hint: inputHint })), customTimeInput: (jsxRuntime.jsx(DDatePickerTime, { id: timeId, label: timeLabel })), placeholderText: placeholder }, dataAttributes, props)));
792
1252
  }
793
1253
 
794
1254
  function DInputMask(props, ref) {
@@ -895,6 +1355,47 @@ function useItemSelection({ getItemIdentifier: getItemIdentifierProp, previousSe
895
1355
  };
896
1356
  }
897
1357
 
1358
+ function subscribeToMediaQuery(query, callback) {
1359
+ const mediaQueryList = window.matchMedia(query);
1360
+ mediaQueryList.addEventListener('change', callback);
1361
+ return () => {
1362
+ mediaQueryList.removeEventListener('change', callback);
1363
+ };
1364
+ }
1365
+ function checkMediaQuery(query) {
1366
+ return window.matchMedia(query).matches;
1367
+ }
1368
+
1369
+ function useMediaQuery(mediaQuery, useListener = false) {
1370
+ /* eslint-disable-next-line @typescript-eslint/no-unused-vars */
1371
+ const noop = (_) => () => { };
1372
+ return React.useSyncExternalStore(useListener ? (cb) => subscribeToMediaQuery(mediaQuery, cb) : noop, () => (mediaQuery ? checkMediaQuery(mediaQuery) : true), () => false);
1373
+ }
1374
+
1375
+ function useMediaBreakpointUp(breakpoint, useListener = false) {
1376
+ const { breakpoints } = useDContext();
1377
+ const mediaQuery = React.useMemo(() => (`(min-width: ${breakpoints[breakpoint]})`), [breakpoint, breakpoints]);
1378
+ return useMediaQuery(mediaQuery, useListener);
1379
+ }
1380
+ function useMediaBreakpointUpXs(useListener = false) {
1381
+ return useMediaBreakpointUp('xs', useListener);
1382
+ }
1383
+ function useMediaBreakpointUpSm(useListener = false) {
1384
+ return useMediaBreakpointUp('sm', useListener);
1385
+ }
1386
+ function useMediaBreakpointUpMd(useListener = false) {
1387
+ return useMediaBreakpointUp('md', useListener);
1388
+ }
1389
+ function useMediaBreakpointUpLg(useListener = false) {
1390
+ return useMediaBreakpointUp('lg', useListener);
1391
+ }
1392
+ function useMediaBreakpointUpXl(useListener = false) {
1393
+ return useMediaBreakpointUp('xl', useListener);
1394
+ }
1395
+ function useMediaBreakpointUpXxl(useListener = false) {
1396
+ return useMediaBreakpointUp('xxl', useListener);
1397
+ }
1398
+
898
1399
  function DInputCounter(_a, ref) {
899
1400
  var { minValue, maxValue, value = minValue, invalid, iconStart: iconStartProp, iconEnd: iconEndProp, iconStartAriaLabel = 'decrease action', iconEndAriaLabel = 'increase action', style, onChange } = _a, props = tslib.__rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "iconStartAriaLabel", "iconEndAriaLabel", "style", "onChange"]);
900
1401
  const { handleOnWheel, } = useDisableInputWheel(ref);
@@ -1256,7 +1757,7 @@ function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href,
1256
1757
  }
1257
1758
  return Object.assign(Object.assign({}, active && { 'aria-current': true }), disabled && { 'aria-disabled': true });
1258
1759
  }, [Tag, active, disabled]);
1259
- return (jsxRuntime.jsx(Tag, Object.assign({ className: classNames(generateClasses, className), style: style }, Tag === 'a' && href && { href }, onClick && { onClick }, ariaAttributes, dataAttributes, { children: children })));
1760
+ return (jsxRuntime.jsx(Tag, Object.assign({ className: classNames(generateClasses, className), style: style }, Tag === 'a' && href && { href }, onClick && { onClick }, ariaAttributes, dataAttributes, Tag === 'button' && { type: 'button' }, { children: children })));
1260
1761
  }
1261
1762
 
1262
1763
  function DListGroup({ as = 'ul', numbered, flush, horizontal, children, className, style, dataAttributes, }) {
@@ -1366,9 +1867,6 @@ function DPaginator(_a) {
1366
1867
  return (jsxRuntime.jsx(ResponsivePagination, Object.assign({ navClassName: classNames('page-item-arrow', navClassName) }, backwardCompatibilityProps)));
1367
1868
  }
1368
1869
 
1369
- /**
1370
- * @deprecated
1371
- */
1372
1870
  function DPopover({ children, renderComponent, open, setOpen, adjustContentToRender = false, className, style, dataAttributes, }) {
1373
1871
  const [isOpen, setIsOpen] = React.useState(false);
1374
1872
  React.useEffect(() => {
@@ -1417,29 +1915,42 @@ function DProgress({ className, style, currentValue, minValue = 0, maxValue = 10
1417
1915
  return (jsxRuntime.jsx("div", Object.assign({ className: classNames('progress', className) }, dataAttributes, { children: jsxRuntime.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 }) })));
1418
1916
  }
1419
1917
 
1420
- /**
1421
- * @deprecated
1422
- */
1423
- function DQuickActionButton({ line1, line2, className, actionLinkText, actionLinkTheme = 'secondary', actionIcon, secondaryActionIcon, secondaryActionAriaLabel, actionIconFamilyClass, actionIconFamilyPrefix, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, onClickSecondary, style, dataAttributes, }) {
1424
- const globalClickHandler = React.useCallback(() => {
1425
- if (actionLinkText) {
1426
- return;
1918
+ function DQuickActionButton({ line1, line2, className, actionIcon, actionIconFamilyClass, actionIconFamilyPrefix, actionIconTheme, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, href, hrefTarget, style, dataAttributes, }) {
1919
+ const Tag = React.useMemo(() => {
1920
+ if (href) {
1921
+ return 'a';
1427
1922
  }
1428
- onClick === null || onClick === void 0 ? void 0 : onClick();
1429
- }, [actionLinkText, onClick]);
1430
- const actionLinkClickHandler = React.useCallback(() => {
1431
- if (!actionLinkText) {
1432
- return;
1923
+ if (onClick) {
1924
+ return 'button';
1925
+ }
1926
+ return 'div';
1927
+ }, [href, onClick]);
1928
+ const tagProps = React.useMemo(() => {
1929
+ if (href) {
1930
+ return {
1931
+ className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
1932
+ href,
1933
+ target: hrefTarget,
1934
+ };
1935
+ }
1936
+ if (onClick) {
1937
+ return {
1938
+ className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
1939
+ onClick,
1940
+ };
1433
1941
  }
1434
- onClick === null || onClick === void 0 ? void 0 : onClick();
1435
- }, [actionLinkText, onClick]);
1436
- const secondaryActionLinkClickHandler = React.useCallback(() => {
1437
- onClickSecondary === null || onClickSecondary === void 0 ? void 0 : onClickSecondary();
1438
- }, [onClickSecondary]);
1439
- const Tag = React.useMemo(() => (actionLinkText ? 'div' : 'button'), [actionLinkText]);
1440
- return (jsxRuntime.jsxs(Tag, Object.assign({ className: classNames('d-quick-action-button', className), onClick: !actionLinkText ? globalClickHandler : undefined, style: style }, dataAttributes, { children: [representativeIcon && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-representative-icon", size: representativeIconHasCircle
1942
+ return {
1943
+ className: classNames('d-quick-action-button', className),
1944
+ };
1945
+ }, [
1946
+ className,
1947
+ href,
1948
+ hrefTarget,
1949
+ onClick,
1950
+ ]);
1951
+ return (jsxRuntime.jsxs(Tag, Object.assign({ style: style }, tagProps, dataAttributes, { children: [representativeIcon && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-representative-icon", size: representativeIconHasCircle
1441
1952
  ? `var(--${PREFIX_BS}quick-action-button-representative-icon-size)`
1442
- : `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsxRuntime.jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsxRuntime.jsx("div", { className: "d-quick-action-button-content", children: jsxRuntime.jsxs("div", { className: "d-quick-action-button-text", children: [jsxRuntime.jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsxRuntime.jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), secondaryActionIcon && (jsxRuntime.jsx(DButton, { className: "d-quick-action-button-secondary-action-link", type: "button", variant: "link", iconStart: secondaryActionIcon, ariaLabel: secondaryActionAriaLabel, iconStartFamilyClass: actionIconFamilyClass, iconStartFamilyPrefix: actionIconFamilyPrefix, theme: actionLinkTheme, onClick: secondaryActionLinkClickHandler, stopPropagationEnabled: true })), actionLinkText && !actionIcon && (jsxRuntime.jsx(DButton, { className: "d-quick-action-button-action-link", type: "button", variant: "link", theme: actionLinkTheme, text: actionLinkText, onClick: actionLinkClickHandler, stopPropagationEnabled: true })), actionIcon && !actionLinkText && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-action-icon", icon: actionIcon, size: `var(--${PREFIX_BS}quick-action-button-action-icon-size)`, familyClass: actionIconFamilyClass, familyPrefix: actionIconFamilyPrefix }))] })));
1953
+ : `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsxRuntime.jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsxRuntime.jsx("div", { className: "d-quick-action-button-content", children: jsxRuntime.jsxs("div", { className: "d-quick-action-button-text", children: [jsxRuntime.jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsxRuntime.jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), actionIcon && (jsxRuntime.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 }))] })));
1443
1954
  }
1444
1955
 
1445
1956
  /**
@@ -1802,9 +2313,12 @@ exports.DToast = DToast$1;
1802
2313
  exports.DToastContainer = DToastContainer;
1803
2314
  exports.DTooltip = DTooltip;
1804
2315
  exports.changeQueryString = changeQueryString;
2316
+ exports.checkMediaQuery = checkMediaQuery;
1805
2317
  exports.configureI18n = configureI8n;
1806
2318
  exports.formatCurrency = formatCurrency;
2319
+ exports.getCssVariable = getCssVariable;
1807
2320
  exports.getQueryString = getQueryString;
2321
+ exports.subscribeToMediaQuery = subscribeToMediaQuery;
1808
2322
  exports.useDContext = useDContext;
1809
2323
  exports.useDPortalContext = useDPortalContext;
1810
2324
  exports.useDToast = useDToast;
@@ -1813,6 +2327,13 @@ exports.useDisableInputWheel = useDisableInputWheel;
1813
2327
  exports.useFormatCurrency = useFormatCurrency;
1814
2328
  exports.useInputCurrency = useInputCurrency;
1815
2329
  exports.useItemSelection = useItemSelection;
2330
+ exports.useMediaBreakpointUpLg = useMediaBreakpointUpLg;
2331
+ exports.useMediaBreakpointUpMd = useMediaBreakpointUpMd;
2332
+ exports.useMediaBreakpointUpSm = useMediaBreakpointUpSm;
2333
+ exports.useMediaBreakpointUpXl = useMediaBreakpointUpXl;
2334
+ exports.useMediaBreakpointUpXs = useMediaBreakpointUpXs;
2335
+ exports.useMediaBreakpointUpXxl = useMediaBreakpointUpXxl;
2336
+ exports.useMediaQuery = useMediaQuery;
1816
2337
  exports.usePortal = usePortal;
1817
2338
  exports.useProvidedRefOrCreate = useProvidedRefOrCreate;
1818
2339
  exports.useStackState = useStackState;