@dynamic-framework/ui-react 1.11.0 → 1.12.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 (45) hide show
  1. package/dist/css/dynamic-ui-non-root.css +784 -17
  2. package/dist/css/dynamic-ui-non-root.min.css +1 -1
  3. package/dist/css/dynamic-ui.css +784 -17
  4. package/dist/css/dynamic-ui.min.css +1 -1
  5. package/dist/index.esm.js +83 -159
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.js +92 -166
  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-tooltip.scss +35 -0
  40. package/dist/types/components/DAlertBox/DAlertBox.d.ts +0 -9
  41. package/dist/types/components/DAlertBox/index.d.ts +0 -2
  42. package/dist/types/components/DToast/DToast.d.ts +0 -14
  43. package/dist/types/components/DToast/index.d.ts +0 -2
  44. package/dist/types/contexts/ModalContext.d.ts +0 -44
  45. 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
  }
@@ -510,7 +439,7 @@ function useProvidedRefOrCreate(providedRef) {
510
439
  }
511
440
 
512
441
  function DInput(_a, ref) {
513
- var { id, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, readOnly = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, hint, invalid = false, valid = false, floatingLabel = false, inputStart, value, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = tslib.__rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "disabled", "readOnly", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "hint", "invalid", "valid", "floatingLabel", "inputStart", "value", "onChange", "onIconStartClick", "onIconEndClick"]);
442
+ var { id, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, readOnly = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, hint, invalid = false, valid = false, floatingLabel = false, inputStart, value, placeholder = '', onChange, onIconStartClick, onIconEndClick } = _a, inputProps = tslib.__rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "disabled", "readOnly", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "hint", "invalid", "valid", "floatingLabel", "inputStart", "value", "placeholder", "onChange", "onIconStartClick", "onIconEndClick"]);
514
443
  const inputRef = useProvidedRefOrCreate(ref);
515
444
  const handleOnChange = React.useCallback((event) => {
516
445
  onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value);
@@ -531,7 +460,7 @@ function DInput(_a, ref) {
531
460
  const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
532
461
  'is-invalid': invalid,
533
462
  'is-valid': valid,
534
- }), disabled: disabled || loading, readOnly: readOnly, value: value, onChange: handleOnChange }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
463
+ }), disabled: disabled || loading, readOnly: readOnly, value: value, onChange: handleOnChange }, (floatingLabel || placeholder) && { placeholder: floatingLabel ? '' : placeholder }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
535
464
  ariaDescribedby,
536
465
  disabled,
537
466
  handleOnChange,
@@ -540,6 +469,8 @@ function DInput(_a, ref) {
540
469
  inputRef,
541
470
  invalid,
542
471
  loading,
472
+ placeholder,
473
+ floatingLabel,
543
474
  readOnly,
544
475
  valid,
545
476
  value,
@@ -557,10 +488,7 @@ function DInput(_a, ref) {
557
488
  }
558
489
  return inputComponent;
559
490
  }, [floatingLabel, inputComponent, labelComponent]);
560
- return (jsxRuntime.jsxs("div", { className: classNames({
561
- 'd-input': true,
562
- className: !!className,
563
- }), 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({
564
492
  'input-group': true,
565
493
  'has-validation': invalid,
566
494
  disabled: disabled || loading,
@@ -619,6 +547,13 @@ function DDatePicker(_a) {
619
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)));
620
548
  }
621
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
+
622
557
  function DInputCounter(_a, ref) {
623
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"]);
624
559
  const inputRef = useProvidedRefOrCreate(ref);
@@ -837,7 +772,7 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
837
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 }))] }));
838
773
  }
839
774
 
840
- 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, }) {
841
776
  const internalValueExtractor = React.useCallback((option) => {
842
777
  if (valueExtractor) {
843
778
  return valueExtractor(option);
@@ -961,7 +896,7 @@ function DListItemMovement(_a) {
961
896
  }
962
897
 
963
898
  function DModalHeader({ showCloseButton, onClose, children, className, style, }) {
964
- 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" }) }))] }));
965
900
  }
966
901
 
967
902
  function DModalBody({ children, className, style, }) {
@@ -972,7 +907,7 @@ function DModalFooter({ className, style, actionPlacement = 'fill', children, })
972
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 })] }));
973
908
  }
974
909
 
975
- 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, }) {
976
911
  const fullScreenClass = React.useMemo(() => {
977
912
  if (fullScreen) {
978
913
  if (fullScreenFrom) {
@@ -983,7 +918,7 @@ function DModal({ name, className, style, staticBackdrop, scrollable, centered,
983
918
  return '';
984
919
  }, [fullScreenFrom, fullScreen]);
985
920
  const generateClasses = React.useMemo(() => (Object.assign({ 'modal fade show': true }, className && { [className]: true })), [className]);
986
- 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]);
987
922
  return (jsxRuntime.jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style }, staticBackdrop && ({
988
923
  [`data-${PREFIX_BS}backdrop`]: 'static',
989
924
  [`data-${PREFIX_BS}keyboard`]: 'false',
@@ -1068,12 +1003,13 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
1068
1003
  }
1069
1004
 
1070
1005
  function DProgress({ className, style, currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, }) {
1071
- const formatProgress = React.useMemo(() => `${currentValue}%`, [currentValue]);
1006
+ const percentage = React.useMemo(() => (Math.round((currentValue * 100) / maxValue)), [currentValue, maxValue]);
1007
+ const formatProgress = React.useMemo(() => `${percentage}%`, [percentage]);
1072
1008
  const generateClasses = React.useMemo(() => ({
1073
1009
  'progress-bar': true,
1074
1010
  'progress-bar-striped progress-bar-animated': enableStripedAnimation,
1075
1011
  }), [enableStripedAnimation]);
1076
- return (jsxRuntime.jsx("div", { className: "progress", children: jsxRuntime.jsx("div", { className: classNames(generateClasses, className), role: "progressbar", "aria-label": "Progress bar", style: Object.assign({ width: `${currentValue}%` }, style), "aria-valuenow": currentValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, children: !hideCurrentValue && formatProgress }) }));
1012
+ return (jsxRuntime.jsx("div", { className: classNames('progress', className), 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 }) }));
1077
1013
  }
1078
1014
 
1079
1015
  function DQuickActionButton({ line1, line2, className, actionLinkText, actionLinkTheme = 'secondary', actionIcon, secondaryActionIcon, secondaryActionAriaLabel, actionIconFamilyClass, actionIconFamilyPrefix, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, onClickSecondary, style, }) {
@@ -1196,22 +1132,11 @@ function DStepper({ options, currentStep, successIcon = 'check', vertical = fals
1196
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 }) })] }));
1197
1133
  }
1198
1134
 
1199
- const TOOLTIP_FONT_SIZE_BY_SIZE = {
1200
- sm: `var(--${PREFIX_BS}ref-fs-small)`,
1201
- default: `var(--${PREFIX_BS}body-font-size)`,
1202
- lg: `var(--${PREFIX_BS}ref-fs-6)`,
1203
- };
1204
1135
  const ARROW_WIDTH = 8;
1205
1136
  const ARROW_HEIGHT = 4;
1206
1137
  const GAP = 2;
1207
- 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, }) {
1208
1139
  const [isOpen, setIsOpen] = React.useState(open);
1209
- const styleVariables = React.useMemo(() => {
1210
- const defaultFontSize = size
1211
- ? TOOLTIP_FONT_SIZE_BY_SIZE[size]
1212
- : TOOLTIP_FONT_SIZE_BY_SIZE.default;
1213
- 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))` });
1214
- }, [size, style]);
1215
1140
  const arrowRef = React.useRef(null);
1216
1141
  const { refs, context, floatingStyles, } = react.useFloating({
1217
1142
  open: isOpen,
@@ -1241,9 +1166,8 @@ function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT
1241
1166
  dismiss,
1242
1167
  role,
1243
1168
  ]);
1244
- 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: {
1245
- fill: styleVariables.background,
1246
- }, 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] }))) })] }));
1247
1171
  }
1248
1172
 
1249
1173
  const TabContext = React.createContext(undefined);
@@ -1295,7 +1219,7 @@ function DToastContainer({ style, position = 'top-right', className, }) {
1295
1219
 
1296
1220
  function useToast() {
1297
1221
  const toast = React.useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
1298
- 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 })), {
1299
1223
  transition: reactToastify.Slide,
1300
1224
  position,
1301
1225
  autoClose,
@@ -1320,7 +1244,7 @@ async function configureI8n(resources, _a = {}) {
1320
1244
  .then((t) => t);
1321
1245
  }
1322
1246
 
1323
- exports.DAlertBox = DAlertBox;
1247
+ exports.DAlert = DAlert;
1324
1248
  exports.DBadge = DBadge;
1325
1249
  exports.DBoxFile = DBoxFile;
1326
1250
  exports.DButton = DButton;
@@ -1344,6 +1268,7 @@ exports.DInputCheck = DInputCheck;
1344
1268
  exports.DInputCounter = DInputCounter$1;
1345
1269
  exports.DInputCurrency = DInputCurrency$1;
1346
1270
  exports.DInputCurrencyBase = DInputCurrencyBase$1;
1271
+ exports.DInputMask = DInputMask$1;
1347
1272
  exports.DInputPassword = DInputPassword$1;
1348
1273
  exports.DInputPin = DInputPin;
1349
1274
  exports.DInputSearch = DInputSearch$1;
@@ -1354,10 +1279,14 @@ exports.DListItem = DListItem;
1354
1279
  exports.DListItemMovement = DListItemMovement;
1355
1280
  exports.DModal = DModal$1;
1356
1281
  exports.DModalBody = DModalBody;
1282
+ exports.DModalContext = DModalContext;
1283
+ exports.DModalContextProvider = DModalContextProvider;
1357
1284
  exports.DModalFooter = DModalFooter;
1358
1285
  exports.DModalHeader = DModalHeader;
1359
1286
  exports.DOffcanvas = DOffcanvas$1;
1360
1287
  exports.DOffcanvasBody = DOffcanvasBody;
1288
+ exports.DOffcanvasContext = DOffcanvasContext;
1289
+ exports.DOffcanvasContextProvider = DOffcanvasContextProvider;
1361
1290
  exports.DOffcanvasFooter = DOffcanvasFooter;
1362
1291
  exports.DOffcanvasHeader = DOffcanvasHeader;
1363
1292
  exports.DPaginator = DPaginator;
@@ -1376,20 +1305,17 @@ exports.DStepperMobile = DStepper$1;
1376
1305
  exports.DSummaryCard = DSummaryCard;
1377
1306
  exports.DTabContent = DTabContent;
1378
1307
  exports.DTabs = DTabs$1;
1379
- exports.DToast = DToast;
1380
1308
  exports.DToastContainer = DToastContainer;
1381
1309
  exports.DTooltip = DTooltip;
1382
- exports.ModalContext = ModalContext;
1383
- exports.ModalContextProvider = ModalContextProvider;
1384
- exports.OffcanvasContext = OffcanvasContext;
1385
- exports.OffcanvasContextProvider = OffcanvasContextProvider;
1386
1310
  exports.configureI18n = configureI8n;
1387
1311
  exports.formatCurrency = formatCurrency;
1388
1312
  exports.useDContext = useDContext;
1313
+ exports.useDModalContext = useDModalContext;
1314
+ exports.useDOffcanvasContext = useDOffcanvasContext;
1315
+ exports.useDisableBodyScrollEffect = useDisableBodyScrollEffect;
1389
1316
  exports.useFormatCurrency = useFormatCurrency;
1390
1317
  exports.useInputCurrency = useInputCurrency;
1391
- exports.useModalContext = useModalContext;
1392
- exports.useOffcanvasContext = useOffcanvasContext;
1318
+ exports.usePortal = usePortal;
1393
1319
  exports.useProvidedRefOrCreate = useProvidedRefOrCreate;
1394
1320
  exports.useStackState = useStackState;
1395
1321
  exports.useTabContext = useTabContext;