@dynamic-framework/ui-react 1.11.1 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/css/dynamic-ui-non-root.css +785 -18
  2. package/dist/css/dynamic-ui-non-root.min.css +1 -1
  3. package/dist/css/dynamic-ui.css +785 -18
  4. package/dist/css/dynamic-ui.min.css +1 -1
  5. package/dist/index.esm.js +76 -155
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.js +85 -162
  8. package/dist/index.js.map +1 -1
  9. package/dist/types/components/DAlert/DAlert.d.ts +15 -0
  10. package/dist/types/components/DAlert/index.d.ts +2 -0
  11. package/dist/types/components/DButton/DButton.d.ts +2 -1
  12. package/dist/types/components/DInputMask/DInputMask.d.ts +16 -0
  13. package/dist/types/components/DInputMask/index.d.ts +2 -0
  14. package/dist/types/components/DModal/DModal.d.ts +2 -2
  15. package/dist/types/components/DToastContainer/useToast.d.ts +2 -2
  16. package/dist/types/components/DTooltip/DTooltip.d.ts +3 -2
  17. package/dist/types/components/config.d.ts +2 -2
  18. package/dist/types/components/index.d.ts +2 -2
  19. package/dist/types/components/interface.d.ts +3 -4
  20. package/dist/types/contexts/DModalContext.d.ts +31 -0
  21. package/dist/types/contexts/DOffcanvasContext.d.ts +31 -0
  22. package/dist/types/contexts/index.d.ts +2 -2
  23. package/dist/types/hooks/index.d.ts +2 -0
  24. package/dist/types/hooks/useDisableBodyScrollEffect.d.ts +1 -0
  25. package/dist/types/hooks/usePortal.d.ts +3 -0
  26. package/package.json +3 -2
  27. package/src/style/abstracts/_maps.scss +1 -1
  28. package/src/style/abstracts/_utilities.scss +2 -5
  29. package/src/style/abstracts/variables/_box-file.scss +1 -0
  30. package/src/style/abstracts/variables/_modals.scss +4 -0
  31. package/src/style/abstracts/variables/_offcanvas.scss +1 -0
  32. package/src/style/abstracts/variables/_typography.scss +1 -0
  33. package/src/style/components/_+import.scss +2 -1
  34. package/src/style/components/{_d-toast.scss → _d-alert.scss} +12 -11
  35. package/src/style/components/_d-box-file.scss +2 -0
  36. package/src/style/components/_d-button.scss +67 -3
  37. package/src/style/components/_d-modal.scss +16 -4
  38. package/src/style/components/_d-offcanvas.scss +4 -0
  39. package/src/style/components/_d-stepper-desktop.scss +1 -1
  40. package/src/style/components/_d-stepper-mobile.scss +5 -1
  41. package/src/style/components/_d-tooltip.scss +35 -0
  42. package/dist/types/components/DAlertBox/DAlertBox.d.ts +0 -9
  43. package/dist/types/components/DAlertBox/index.d.ts +0 -2
  44. package/dist/types/components/DToast/DToast.d.ts +0 -14
  45. package/dist/types/components/DToast/index.d.ts +0 -2
  46. package/dist/types/contexts/ModalContext.d.ts +0 -44
  47. package/dist/types/contexts/OffcanvasContext.d.ts +0 -44
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ var reactSplide = require('@splidejs/react-splide');
9
9
  var currency = require('currency.js');
10
10
  var DatePicker = require('react-datepicker');
11
11
  var dateFns = require('date-fns');
12
+ var mask = require('@react-input/mask');
12
13
  var ResponsivePagination = require('react-responsive-pagination');
13
14
  var react = require('@floating-ui/react');
14
15
  var ContentLoader = require('react-content-loader');
@@ -55,6 +56,8 @@ const ALERT_TYPE_ICON = {
55
56
  info: 'info-circle',
56
57
  dark: 'info-circle',
57
58
  light: 'info-circle',
59
+ primary: 'info-circle',
60
+ secondary: 'info-circle',
58
61
  };
59
62
 
60
63
  function DIcon({ 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, familyClass = 'bi', familyPrefix = 'bi-', }) {
@@ -94,18 +97,13 @@ function DSummaryCard({ title, description, icon, iconSize, iconTheme, Summary,
94
97
  return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h6", { className: "fw-bold fs-6", children: title }), jsxRuntime.jsx("p", { className: "fs-8", children: description }), jsxRuntime.jsxs("div", { className: "bg-white rounded p-4 d-flex gap-3 shadow-sm text-gray-700 fs-8", children: [jsxRuntime.jsx(DIcon, { icon: icon, theme: iconTheme, size: iconSize }), Summary] })] }));
95
98
  }
96
99
 
97
- function DToast({ type = 'success', icon, iconFamilyClass, iconFamilyPrefix, showIcon = false, showClose, onClose, children, id, className, style, }) {
98
- const generateClasses = React.useMemo(() => (Object.assign({ alert: true, [`alert-${type}`]: true, 'fade show': !!showClose }, className && { [className]: true })), [type, showClose, className]);
100
+ function DAlert({ type = 'success', icon, iconFamilyClass, iconFamilyPrefix, showIcon = true, soft = false, showClose, onClose, children, id, className, style, }) {
101
+ const generateClasses = React.useMemo(() => (Object.assign({ alert: true, [`alert-${type}`]: true, 'fade show': !!showClose, 'alert-soft': soft }, className && { [className]: true })), [type, showClose, soft, className]);
99
102
  const getIcon = React.useMemo(() => icon || ALERT_TYPE_ICON[type] || '', [icon, type]);
100
103
  const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}alert-component-separator-opacity`]: '0.3' })), [style]);
101
104
  return (jsxRuntime.jsxs("div", { className: classNames(generateClasses), style: generateStyleVariables, role: "alert", id: id, children: [(showIcon || icon) && (jsxRuntime.jsx(DIcon, Object.assign({ className: "alert-icon", icon: getIcon }, iconFamilyClass && { familyClass: iconFamilyClass }, iconFamilyPrefix && { familyPrefix: iconFamilyPrefix }))), jsxRuntime.jsx("div", { className: "alert-text", children: children }), showClose && (jsxRuntime.jsx("div", { className: "alert-separator" })), showClose && (jsxRuntime.jsx("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { className: "alert-close-icon", icon: "x-lg", familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) }))] }));
102
105
  }
103
106
 
104
- function DAlertBox({ theme = 'box-secondary', icon = 'info-circle', iconFamilyClass, iconFamilyPrefix, children, id, className, style, }) {
105
- const generateClasses = React.useMemo(() => (Object.assign({ 'alert alert-box': true, [`alert-${theme}`]: true }, className && { [className]: true })), [theme, className]);
106
- return (jsxRuntime.jsxs("div", { className: classNames(generateClasses), style: style, role: "alert", id: id, children: [jsxRuntime.jsx(DIcon, Object.assign({ className: "alert-icon", icon: icon }, iconFamilyClass && { familyClass: iconFamilyClass }, iconFamilyPrefix && { familyPrefix: iconFamilyPrefix })), jsxRuntime.jsx("div", { className: "alert-text", children: children })] }));
107
- }
108
-
109
107
  function DBoxFile(_a) {
110
108
  var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, disabled = false, children, className, style } = _a, dropzoneOptions = tslib.__rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "disabled", "children", "className", "style"]);
111
109
  const { acceptedFiles, getRootProps, getInputProps, } = reactDropzone.useDropzone(Object.assign({ disabled }, dropzoneOptions));
@@ -118,7 +116,7 @@ function DBoxFile(_a) {
118
116
  }), { children: [jsxRuntime.jsx("input", Object.assign({}, getInputProps())), jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }), jsxRuntime.jsx("div", { className: "d-box-content", children: children })] })), !!acceptedFiles.length && (jsxRuntime.jsx("aside", { className: "d-box-files", children: acceptedFiles.map((file) => (jsxRuntime.jsx("div", { className: "d-box-files-text", children: `${file.name} - ${file.size} bytes` }, file.name))) }))] }));
119
117
  }
120
118
 
121
- function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, value, type = 'button', pill = false, loading = false, loadingAriaLabel, disabled = false, stopPropagationEnabled = true, className, onClick, }) {
119
+ function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, value, type = 'button', pill = false, loading = false, loadingAriaLabel, disabled = false, stopPropagationEnabled = true, className, form, onClick, }) {
122
120
  const generateClasses = React.useMemo(() => {
123
121
  const variantClass = variant
124
122
  ? `btn-${variant}-${theme}`
@@ -145,7 +143,7 @@ function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel
145
143
  const newAriaLabel = React.useMemo(() => (loading
146
144
  ? (loadingAriaLabel || ariaLabel || text)
147
145
  : (ariaLabel || text)), [loading, loadingAriaLabel, ariaLabel, text]);
148
- return (jsxRuntime.jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: generateStyleVariables, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel }, value && { value }, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })), (text && !loading) && (jsxRuntime.jsx("span", { children: text })), loading && (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) })), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix }))] })));
146
+ return (jsxRuntime.jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: generateStyleVariables, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel, form: form }, value && { value }, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })), (text && !loading) && (jsxRuntime.jsx("span", { children: text })), loading && (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) })), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix }))] })));
149
147
  }
150
148
 
151
149
  function DCardHeader({ className, style, children, }) {
@@ -251,6 +249,35 @@ function useDContext() {
251
249
  return context;
252
250
  }
253
251
 
252
+ function useDisableBodyScrollEffect(disable) {
253
+ React.useEffect(() => {
254
+ if (disable) {
255
+ document.body.style.overflow = 'hidden';
256
+ document.body.style.paddingRight = '0';
257
+ }
258
+ else {
259
+ document.body.style.overflow = 'unset';
260
+ document.body.style.paddingRight = 'unset';
261
+ }
262
+ }, [disable]);
263
+ }
264
+
265
+ function usePortal(portalName) {
266
+ const [hasPortal, setHasPortal] = React.useState(false);
267
+ React.useEffect(() => {
268
+ const previousPortal = document.querySelector(`#${portalName}`);
269
+ if (previousPortal) {
270
+ previousPortal.remove();
271
+ }
272
+ const portal = document.createElement('div');
273
+ portal.id = portalName;
274
+ portal.className = 'd-portal';
275
+ document.body.appendChild(portal);
276
+ setHasPortal(true);
277
+ }, [portalName]);
278
+ return { created: hasPortal };
279
+ }
280
+
254
281
  /**
255
282
  * useStackState inspired from rooks
256
283
  * @see https://github.com/imbhargav5/rooks/blob/main/packages/rooks/src/hooks/useStackState.ts
@@ -296,73 +323,27 @@ function useStackState(initialList) {
296
323
  return [list, controls];
297
324
  }
298
325
 
299
- const ModalContext = React.createContext(undefined);
300
- function enhanceModal(Modal, callbacks) {
301
- return function EnhancedModal(_a) {
302
- var { name, payload } = _a, otherProps = tslib.__rest(_a, ["name", "payload"]);
303
- React.useEffect(() => {
304
- if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onAfterOpen) {
305
- callbacks.onAfterOpen(payload);
306
- }
307
- return () => {
308
- if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onAfterClose) {
309
- callbacks.onAfterClose({ fromModal: false }, payload);
310
- }
311
- };
312
- }, [payload]);
313
- return (
314
- // eslint-disable-next-line react/jsx-props-no-spreading
315
- jsxRuntime.jsx(Modal, Object.assign({ name: name, payload: payload }, otherProps)));
316
- };
317
- }
318
- function ModalContextProvider({ portalName, children, availableModals, }) {
319
- const [hasPortal, setHasPortal] = React.useState(false);
320
- React.useEffect(() => {
321
- const previousPortal = document.querySelector(`#${portalName}`);
322
- if (previousPortal) {
323
- previousPortal.remove();
324
- }
325
- const portal = document.createElement('div');
326
- portal.id = portalName;
327
- document.body.appendChild(portal);
328
- setHasPortal(true);
329
- }, [portalName]);
326
+ const DModalContext = React.createContext(undefined);
327
+ function DModalContextProvider({ portalName, children, availableModals, }) {
328
+ const { created } = usePortal(portalName);
330
329
  const [stack, { push, pop, peek }] = useStackState([]);
331
- React.useEffect(() => {
332
- if (stack.length) {
333
- document.body.style.overflow = 'hidden';
334
- document.body.style.paddingRight = '0';
335
- }
336
- else {
337
- document.body.style.overflow = 'unset';
338
- document.body.style.paddingRight = 'unset';
339
- }
340
- }, [stack.length]);
341
- const openModal = React.useCallback((modalName, { payload, callbacks } = { payload: {} }) => {
330
+ useDisableBodyScrollEffect(Boolean(stack.length));
331
+ const openModal = React.useCallback((modalName, payload) => {
342
332
  const Component = availableModals[modalName];
343
333
  if (!Component) {
344
- throw new Error(`there is no component for modal ${modalName}`);
334
+ throw new Error(`there is no component for modal ${modalName.toString()}`);
345
335
  }
346
- const stackItem = {
336
+ push({
347
337
  modalName,
348
338
  Component,
349
339
  payload,
350
- callbacks,
351
- };
352
- if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onBeforeOpen) {
353
- callbacks.onBeforeOpen(payload);
354
- }
355
- push(stackItem);
340
+ });
356
341
  }, [availableModals, push]);
357
- const closeModal = React.useCallback((context = { fromModal: false }) => {
358
- var _a;
342
+ const closeModal = React.useCallback(() => {
359
343
  const stackItem = peek();
360
344
  if (!stackItem) {
361
345
  return;
362
346
  }
363
- if ((_a = stackItem.callbacks) === null || _a === void 0 ? void 0 : _a.onBeforeClose) {
364
- stackItem.callbacks.onBeforeClose(context, stackItem.payload);
365
- }
366
347
  pop();
367
348
  }, [peek, pop]);
368
349
  const value = React.useMemo(() => ({
@@ -370,86 +351,37 @@ function ModalContextProvider({ portalName, children, availableModals, }) {
370
351
  openModal,
371
352
  closeModal,
372
353
  }), [stack, openModal, closeModal]);
373
- return (jsxRuntime.jsxs(ModalContext.Provider, { value: value, children: [children, hasPortal && reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [stack.map(({ Component, modalName, callbacks, payload, }) => {
374
- const EnhancedComponent = enhanceModal(Component, callbacks);
375
- return (jsxRuntime.jsx(EnhancedComponent, { name: modalName, payload: payload, openModal: openModal, closeModal: closeModal }, modalName));
376
- }), !!stack.length && jsxRuntime.jsx("div", { className: "modal-backdrop fade show" })] }), document.getElementById(portalName))] }));
354
+ return (jsxRuntime.jsxs(DModalContext.Provider, { value: value, children: [children, created && reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [stack.map(({ Component, modalName, payload, }) => (jsxRuntime.jsx(Component, { name: modalName, payload: payload, openModal: openModal, closeModal: closeModal }, modalName))), !!stack.length && jsxRuntime.jsx("div", { className: "modal-backdrop fade show" })] }), document.getElementById(portalName))] }));
377
355
  }
378
- function useModalContext() {
379
- const context = React.useContext(ModalContext);
356
+ function useDModalContext() {
357
+ const context = React.useContext(DModalContext);
380
358
  if (context === undefined) {
381
359
  throw new Error('useModalContext was used outside of ModalContextProvider');
382
360
  }
383
361
  return context;
384
362
  }
385
363
 
386
- const OffcanvasContext = React.createContext(undefined);
387
- function enhanceOffcanvas(Offcanvas, callbacks) {
388
- return function EnhancedOffcanvas(_a) {
389
- var { name, payload } = _a, otherProps = tslib.__rest(_a, ["name", "payload"]);
390
- React.useEffect(() => {
391
- if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onAfterOpen) {
392
- callbacks.onAfterOpen(payload);
393
- }
394
- return () => {
395
- if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onAfterClose) {
396
- callbacks.onAfterClose({ fromOffcanvas: false }, payload);
397
- }
398
- };
399
- }, [payload]);
400
- return (
401
- // eslint-disable-next-line react/jsx-props-no-spreading
402
- jsxRuntime.jsx(Offcanvas, Object.assign({ name: name, payload: payload }, otherProps)));
403
- };
404
- }
405
- function OffcanvasContextProvider({ portalName, children, availableOffcanvas, }) {
406
- const [hasPortal, setHasPortal] = React.useState(false);
407
- React.useEffect(() => {
408
- const previousPortal = document.querySelector(`#${portalName}`);
409
- if (previousPortal) {
410
- previousPortal.remove();
411
- }
412
- const portal = document.createElement('div');
413
- portal.id = portalName;
414
- document.body.appendChild(portal);
415
- setHasPortal(true);
416
- }, [portalName]);
364
+ const DOffcanvasContext = React.createContext(undefined);
365
+ function DOffcanvasContextProvider({ portalName, children, availableOffcanvas, }) {
366
+ const { created } = usePortal(portalName);
417
367
  const [stack, { push, pop, peek }] = useStackState([]);
418
- React.useEffect(() => {
419
- if (stack.length) {
420
- document.body.style.overflow = 'hidden';
421
- document.body.style.paddingRight = '0';
422
- }
423
- else {
424
- document.body.style.overflow = 'unset';
425
- document.body.style.paddingRight = 'unset';
426
- }
427
- }, [stack.length]);
428
- const openOffcanvas = React.useCallback((offcanvasName, { payload, callbacks } = { payload: {} }) => {
368
+ useDisableBodyScrollEffect(Boolean(stack.length));
369
+ const openOffcanvas = React.useCallback((offcanvasName, payload) => {
429
370
  const Component = availableOffcanvas[offcanvasName];
430
371
  if (!Component) {
431
372
  throw new Error(`there is no component for offcanvas ${offcanvasName}`);
432
373
  }
433
- const stackItem = {
374
+ push({
434
375
  offcanvasName,
435
376
  Component,
436
377
  payload,
437
- callbacks,
438
- };
439
- if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onBeforeOpen) {
440
- callbacks.onBeforeOpen(payload);
441
- }
442
- push(stackItem);
378
+ });
443
379
  }, [availableOffcanvas, push]);
444
- const closeOffcanvas = React.useCallback((context = { fromOffcanvas: false }) => {
445
- var _a;
380
+ const closeOffcanvas = React.useCallback(() => {
446
381
  const stackItem = peek();
447
382
  if (!stackItem) {
448
383
  return;
449
384
  }
450
- if ((_a = stackItem.callbacks) === null || _a === void 0 ? void 0 : _a.onBeforeClose) {
451
- stackItem.callbacks.onBeforeClose(context, stackItem.payload);
452
- }
453
385
  pop();
454
386
  }, [peek, pop]);
455
387
  const value = React.useMemo(() => ({
@@ -457,13 +389,10 @@ function OffcanvasContextProvider({ portalName, children, availableOffcanvas, })
457
389
  openOffcanvas,
458
390
  closeOffcanvas,
459
391
  }), [stack, openOffcanvas, closeOffcanvas]);
460
- return (jsxRuntime.jsxs(OffcanvasContext.Provider, { value: value, children: [children, hasPortal && reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [stack.map(({ Component, offcanvasName, callbacks, payload, }) => {
461
- const EnhancedComponent = enhanceOffcanvas(Component, callbacks);
462
- return (jsxRuntime.jsx(EnhancedComponent, { name: offcanvasName, payload: payload, openOffcanvas: openOffcanvas, closeOffcanvas: closeOffcanvas }, offcanvasName));
463
- }), !!stack.length && jsxRuntime.jsx("div", { className: "offcanvas-backdrop fade show" })] }), document.getElementById(portalName))] }));
392
+ return (jsxRuntime.jsxs(DOffcanvasContext.Provider, { value: value, children: [children, created && reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [stack.map(({ Component, offcanvasName, payload, }) => (jsxRuntime.jsx(Component, { name: offcanvasName, payload: payload, openOffcanvas: openOffcanvas, closeOffcanvas: closeOffcanvas }, offcanvasName))), !!stack.length && jsxRuntime.jsx("div", { className: "offcanvas-backdrop fade show" })] }), document.getElementById(portalName))] }));
464
393
  }
465
- function useOffcanvasContext() {
466
- const context = React.useContext(OffcanvasContext);
394
+ function useDOffcanvasContext() {
395
+ const context = React.useContext(DOffcanvasContext);
467
396
  if (context === undefined) {
468
397
  throw new Error('useOffcanvasContext was used outside of OffcanvasContextProvider');
469
398
  }
@@ -559,10 +488,7 @@ function DInput(_a, ref) {
559
488
  }
560
489
  return inputComponent;
561
490
  }, [floatingLabel, inputComponent, labelComponent]);
562
- return (jsxRuntime.jsxs("div", { className: classNames({
563
- 'd-input': true,
564
- className: !!className,
565
- }), style: style, children: [label && !floatingLabel && (labelComponent), jsxRuntime.jsxs("div", { className: "d-input-control", children: [jsxRuntime.jsxs("div", { className: classNames({
491
+ return (jsxRuntime.jsxs("div", { className: classNames(Object.assign({ 'd-input': true }, className && { [className]: true })), style: style, children: [label && !floatingLabel && (labelComponent), jsxRuntime.jsxs("div", { className: "d-input-control", children: [jsxRuntime.jsxs("div", { className: classNames({
566
492
  'input-group': true,
567
493
  'has-validation': invalid,
568
494
  disabled: disabled || loading,
@@ -621,6 +547,13 @@ function DDatePicker(_a) {
621
547
  return (jsxRuntime.jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: (jsxRuntime.jsx(DDatePickerInput$1, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconEnd: inputIcon, className: className, style: style })), customTimeInput: jsxRuntime.jsx(DDatePickerTime, { id: timeId, label: timeLabel }), selectsRange: selectsRange }, locale && { locale }, props)));
622
548
  }
623
549
 
550
+ function DInputMask(props, ref) {
551
+ return (jsxRuntime.jsx(mask.InputMask, Object.assign({ ref: ref, component: DInput$1 }, props)));
552
+ }
553
+ const ForwardedDInputMask = React.forwardRef(DInputMask);
554
+ ForwardedDInputMask.displayName = 'DInputMask';
555
+ var DInputMask$1 = ForwardedDInputMask;
556
+
624
557
  function DInputCounter(_a, ref) {
625
558
  var { minValue, maxValue, value = minValue, invalid, iconStart = 'dash-square', iconEnd = 'plus-square', iconStartAriaLabel = 'decrease action', iconEndAriaLabel = 'increase action', style, onChange } = _a, props = tslib.__rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "iconStartAriaLabel", "iconEndAriaLabel", "style", "onChange"]);
626
559
  const inputRef = useProvidedRefOrCreate(ref);
@@ -839,7 +772,7 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
839
772
  }), type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onChange: nextInput, onKeyDown: prevInput, onFocus: focusInput, onWheel: wheelInput, onClick: preventDefaultEvent, autoComplete: "off", placeholder: placeholder, disabled: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), (invalid || valid) && !loading && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "d-input-pin-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text d-input-pin-icon", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
840
773
  }
841
774
 
842
- function DInputSelect({ id, name, label = '', className, style, options, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, floatingLabel = false, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
775
+ function DInputSelect({ id, name, label = '', className, style, options = [], labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, floatingLabel = false, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
843
776
  const internalValueExtractor = React.useCallback((option) => {
844
777
  if (valueExtractor) {
845
778
  return valueExtractor(option);
@@ -963,7 +896,7 @@ function DListItemMovement(_a) {
963
896
  }
964
897
 
965
898
  function DModalHeader({ showCloseButton, onClose, children, className, style, }) {
966
- return (jsxRuntime.jsxs("div", { className: classNames('modal-header', className), style: style, children: [showCloseButton && (jsxRuntime.jsx("button", { type: "button", className: "d-modal-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: "x-lg" }) })), children] }));
899
+ return (jsxRuntime.jsxs("div", { className: classNames('modal-header', className), style: style, children: [jsxRuntime.jsx("div", { className: "d-modal-slot", children: children }), showCloseButton && (jsxRuntime.jsx("button", { type: "button", className: "d-modal-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: "x-lg" }) }))] }));
967
900
  }
968
901
 
969
902
  function DModalBody({ children, className, style, }) {
@@ -974,7 +907,7 @@ function DModalFooter({ className, style, actionPlacement = 'fill', children, })
974
907
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "d-modal-separator" }), jsxRuntime.jsx("div", { className: classNames(`d-modal-slot modal-footer d-modal-action-${actionPlacement}`, className), style: style, children: children })] }));
975
908
  }
976
909
 
977
- function DModal({ name, className, style, staticBackdrop, scrollable, centered, fullScreen, fullScreenFrom, modalSize, children, }) {
910
+ function DModal({ name, className, style, staticBackdrop, scrollable, centered, fullScreen, fullScreenFrom, size, children, }) {
978
911
  const fullScreenClass = React.useMemo(() => {
979
912
  if (fullScreen) {
980
913
  if (fullScreenFrom) {
@@ -985,7 +918,7 @@ function DModal({ name, className, style, staticBackdrop, scrollable, centered,
985
918
  return '';
986
919
  }, [fullScreenFrom, fullScreen]);
987
920
  const generateClasses = React.useMemo(() => (Object.assign({ 'modal fade show': true }, className && { [className]: true })), [className]);
988
- const generateModalDialogClasses = React.useMemo(() => (Object.assign({ 'modal-dialog': true, 'modal-dialog-centered': !!centered, 'modal-dialog-scrollable': !!scrollable, [fullScreenClass]: !!fullScreen }, modalSize && { [`modal-${modalSize}`]: true })), [fullScreenClass, centered, fullScreen, scrollable, modalSize]);
921
+ const generateModalDialogClasses = React.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]);
989
922
  return (jsxRuntime.jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style }, staticBackdrop && ({
990
923
  [`data-${PREFIX_BS}backdrop`]: 'static',
991
924
  [`data-${PREFIX_BS}keyboard`]: 'false',
@@ -1199,22 +1132,11 @@ function DStepper({ options, currentStep, successIcon = 'check', vertical = fals
1199
1132
  return (jsxRuntime.jsxs("div", { className: className, style: style, children: [jsxRuntime.jsx("div", { className: `d-block d-${breakpoint}-none`, children: jsxRuntime.jsx(DStepper$1, { options: options, currentStep: currentStep }) }), jsxRuntime.jsx("div", { className: `d-none d-${breakpoint}-block`, children: jsxRuntime.jsx(DStepper$2, { options: options, currentStep: currentStep, successIcon: successIcon, vertical: vertical }) })] }));
1200
1133
  }
1201
1134
 
1202
- const TOOLTIP_FONT_SIZE_BY_SIZE = {
1203
- sm: `var(--${PREFIX_BS}ref-fs-small)`,
1204
- default: `var(--${PREFIX_BS}body-font-size)`,
1205
- lg: `var(--${PREFIX_BS}ref-fs-6)`,
1206
- };
1207
1135
  const ARROW_WIDTH = 8;
1208
1136
  const ARROW_HEIGHT = 4;
1209
1137
  const GAP = 2;
1210
- function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false, placement = 'top', size, Component, children, }) {
1138
+ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false, theme = 'primary', placement = 'top', size, Component, children, }) {
1211
1139
  const [isOpen, setIsOpen] = React.useState(open);
1212
- const styleVariables = React.useMemo(() => {
1213
- const defaultFontSize = size
1214
- ? TOOLTIP_FONT_SIZE_BY_SIZE[size]
1215
- : TOOLTIP_FONT_SIZE_BY_SIZE.default;
1216
- return Object.assign(Object.assign({}, style), { background: `var(--${PREFIX_BS}tooltip-bg, var(--${PREFIX_BS}tooltip-component-bg, var(--${PREFIX_BS}secondary)))`, borderRadius: `var(--${PREFIX_BS}tooltip-border-radius, var(--${PREFIX_BS}tooltip-component-border-radius, var(--${PREFIX_BS}border-radius)))`, color: `var(--${PREFIX_BS}tooltip-color, var(--${PREFIX_BS}tooltip-component-color, var(--${PREFIX_BS}white)))`, fontSize: `var(--${PREFIX_BS}tooltip-font-size, var(--${PREFIX_BS}tooltip-component-font-size, ${defaultFontSize}))`, padding: `var(--${PREFIX_BS}tooltip-padding, var(--${PREFIX_BS}tooltip-component-padding, var(--${PREFIX_BS}ref-spacer-2)))`, maxWidth: `var(--${PREFIX_BS}tooltip-max-width, var(--${PREFIX_BS}tooltip-component-max-width, 300px))` });
1217
- }, [size, style]);
1218
1140
  const arrowRef = React.useRef(null);
1219
1141
  const { refs, context, floatingStyles, } = react.useFloating({
1220
1142
  open: isOpen,
@@ -1244,9 +1166,8 @@ function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT
1244
1166
  dismiss,
1245
1167
  role,
1246
1168
  ]);
1247
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ className: className, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsxRuntime.jsx(react.FloatingPortal, { children: isOpen && (jsxRuntime.jsxs("div", Object.assign({ className: classNameContainer, ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), styleVariables) }, getFloatingProps(), { children: [jsxRuntime.jsx(react.FloatingArrow, { ref: arrowRef, context: context, style: {
1248
- fill: styleVariables.background,
1249
- }, width: ARROW_WIDTH, height: ARROW_HEIGHT }), children] }))) })] }));
1169
+ const generateClasses = React.useMemo(() => (Object.assign({ 'd-tooltip': true, [`d-tooltip-${size}`]: !!size, [`d-tooltip-${theme}`]: !!theme }, className && { [className]: true })), [size, theme, className]);
1170
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ className: childrenClassName, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsxRuntime.jsx(react.FloatingPortal, { children: isOpen && (jsxRuntime.jsxs("div", Object.assign({ className: classNames(generateClasses), ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), style) }, getFloatingProps(), { children: [jsxRuntime.jsx(react.FloatingArrow, { ref: arrowRef, context: context, width: ARROW_WIDTH, height: ARROW_HEIGHT }), children] }))) })] }));
1250
1171
  }
1251
1172
 
1252
1173
  const TabContext = React.createContext(undefined);
@@ -1298,7 +1219,7 @@ function DToastContainer({ style, position = 'top-right', className, }) {
1298
1219
 
1299
1220
  function useToast() {
1300
1221
  const toast = React.useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
1301
- reactToastify.toast(({ closeToast }) => (jsxRuntime.jsx(DToast, { type: type, showClose: showClose, onClose: closeToast, id: "alertID", children: message })), {
1222
+ reactToastify.toast(({ closeToast }) => (jsxRuntime.jsx(DAlert, { type: type, showClose: showClose, onClose: closeToast, id: "alertID", children: message })), {
1302
1223
  transition: reactToastify.Slide,
1303
1224
  position,
1304
1225
  autoClose,
@@ -1323,7 +1244,7 @@ async function configureI8n(resources, _a = {}) {
1323
1244
  .then((t) => t);
1324
1245
  }
1325
1246
 
1326
- exports.DAlertBox = DAlertBox;
1247
+ exports.DAlert = DAlert;
1327
1248
  exports.DBadge = DBadge;
1328
1249
  exports.DBoxFile = DBoxFile;
1329
1250
  exports.DButton = DButton;
@@ -1347,6 +1268,7 @@ exports.DInputCheck = DInputCheck;
1347
1268
  exports.DInputCounter = DInputCounter$1;
1348
1269
  exports.DInputCurrency = DInputCurrency$1;
1349
1270
  exports.DInputCurrencyBase = DInputCurrencyBase$1;
1271
+ exports.DInputMask = DInputMask$1;
1350
1272
  exports.DInputPassword = DInputPassword$1;
1351
1273
  exports.DInputPin = DInputPin;
1352
1274
  exports.DInputSearch = DInputSearch$1;
@@ -1357,10 +1279,14 @@ exports.DListItem = DListItem;
1357
1279
  exports.DListItemMovement = DListItemMovement;
1358
1280
  exports.DModal = DModal$1;
1359
1281
  exports.DModalBody = DModalBody;
1282
+ exports.DModalContext = DModalContext;
1283
+ exports.DModalContextProvider = DModalContextProvider;
1360
1284
  exports.DModalFooter = DModalFooter;
1361
1285
  exports.DModalHeader = DModalHeader;
1362
1286
  exports.DOffcanvas = DOffcanvas$1;
1363
1287
  exports.DOffcanvasBody = DOffcanvasBody;
1288
+ exports.DOffcanvasContext = DOffcanvasContext;
1289
+ exports.DOffcanvasContextProvider = DOffcanvasContextProvider;
1364
1290
  exports.DOffcanvasFooter = DOffcanvasFooter;
1365
1291
  exports.DOffcanvasHeader = DOffcanvasHeader;
1366
1292
  exports.DPaginator = DPaginator;
@@ -1379,20 +1305,17 @@ exports.DStepperMobile = DStepper$1;
1379
1305
  exports.DSummaryCard = DSummaryCard;
1380
1306
  exports.DTabContent = DTabContent;
1381
1307
  exports.DTabs = DTabs$1;
1382
- exports.DToast = DToast;
1383
1308
  exports.DToastContainer = DToastContainer;
1384
1309
  exports.DTooltip = DTooltip;
1385
- exports.ModalContext = ModalContext;
1386
- exports.ModalContextProvider = ModalContextProvider;
1387
- exports.OffcanvasContext = OffcanvasContext;
1388
- exports.OffcanvasContextProvider = OffcanvasContextProvider;
1389
1310
  exports.configureI18n = configureI8n;
1390
1311
  exports.formatCurrency = formatCurrency;
1391
1312
  exports.useDContext = useDContext;
1313
+ exports.useDModalContext = useDModalContext;
1314
+ exports.useDOffcanvasContext = useDOffcanvasContext;
1315
+ exports.useDisableBodyScrollEffect = useDisableBodyScrollEffect;
1392
1316
  exports.useFormatCurrency = useFormatCurrency;
1393
1317
  exports.useInputCurrency = useInputCurrency;
1394
- exports.useModalContext = useModalContext;
1395
- exports.useOffcanvasContext = useOffcanvasContext;
1318
+ exports.usePortal = usePortal;
1396
1319
  exports.useProvidedRefOrCreate = useProvidedRefOrCreate;
1397
1320
  exports.useStackState = useStackState;
1398
1321
  exports.useTabContext = useTabContext;