@dynamic-framework/ui-react 1.18.0 → 1.19.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 (72) hide show
  1. package/dist/css/dynamic-ui-non-root.css +1634 -1019
  2. package/dist/css/dynamic-ui-non-root.min.css +2 -2
  3. package/dist/css/dynamic-ui-root.css +493 -29
  4. package/dist/css/dynamic-ui-root.min.css +2 -2
  5. package/dist/css/dynamic-ui.css +2126 -1047
  6. package/dist/css/dynamic-ui.min.css +2 -2
  7. package/dist/index.esm.js +290 -318
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +288 -321
  10. package/dist/index.js.map +1 -1
  11. package/dist/types/components/DAvatar/DAvatar.d.ts +9 -0
  12. package/dist/types/components/DAvatar/index.d.ts +2 -0
  13. package/dist/types/components/DCarousel/DCarousel.d.ts +5 -4
  14. package/dist/types/components/DDatePicker/DDatePicker.d.ts +5 -4
  15. package/dist/types/components/DDatePickerHeader/DDatePickerHeader.d.ts +5 -4
  16. package/dist/types/components/DDatePickerInput/DDatePickerInput.d.ts +1 -0
  17. package/dist/types/components/DToastContainer/DToastContainer.d.ts +9 -7
  18. package/dist/types/components/DToastContainer/index.d.ts +1 -1
  19. package/dist/types/components/DToastContainer/{useToast.d.ts → useDToast.d.ts} +7 -4
  20. package/dist/types/components/index.d.ts +1 -1
  21. package/dist/types/components/interface.d.ts +1 -0
  22. package/dist/types/contexts/DContext.d.ts +8 -7
  23. package/dist/types/contexts/DPortalContext.d.ts +29 -0
  24. package/dist/types/contexts/index.d.ts +1 -2
  25. package/dist/types/hooks/useStackState.d.ts +1 -1
  26. package/package.json +3 -3
  27. package/src/style/abstracts/_mixins.scss +110 -94
  28. package/src/style/abstracts/_utilities.scss +46 -1
  29. package/src/style/abstracts/variables/_+import.scss +2 -0
  30. package/src/style/abstracts/variables/_accordion.scss +2 -2
  31. package/src/style/abstracts/variables/_alerts.scss +1 -1
  32. package/src/style/abstracts/variables/_cards.scss +2 -0
  33. package/src/style/abstracts/variables/_collapse-icon-text.scss +2 -2
  34. package/src/style/abstracts/variables/_forms.scss +7 -8
  35. package/src/style/abstracts/variables/_navs.scss +2 -2
  36. package/src/style/abstracts/variables/_pagination.scss +4 -4
  37. package/src/style/abstracts/variables/_progress.scss +2 -2
  38. package/src/style/abstracts/variables/_quick-action-button.scss +4 -4
  39. package/src/style/abstracts/variables/_quick-action-check.scss +4 -4
  40. package/src/style/abstracts/variables/_quick-action-select.scss +3 -3
  41. package/src/style/abstracts/variables/_quick-action-switch.scss +2 -2
  42. package/src/style/abstracts/variables/_tooltip.scss +16 -0
  43. package/src/style/abstracts/variables/_typography.scss +76 -20
  44. package/src/style/abstracts/variables/_z-index.scss +11 -0
  45. package/src/style/base/_+import.scss +7 -2
  46. package/src/style/base/_avatar.scss +61 -0
  47. package/src/style/base/_backdrop.scss +9 -0
  48. package/src/style/base/_button-group.scss +13 -0
  49. package/src/style/base/{_button.scss → _buttons.scss} +14 -48
  50. package/src/style/base/_form-check.scss +2 -1
  51. package/src/style/base/_input-group.scss +11 -6
  52. package/src/style/base/_tooltip.scss +23 -0
  53. package/src/style/base/_type.scss +104 -0
  54. package/src/style/components/_+import.scss +0 -2
  55. package/src/style/components/_d-datepicker.scss +95 -45
  56. package/src/style/components/_d-icon.scss +1 -1
  57. package/src/style/components/_d-input-pin.scss +5 -0
  58. package/src/style/components/_d-quick-action-button.scss +8 -0
  59. package/src/style/components/_d-quick-action-select.scss +2 -0
  60. package/src/style/components/_d-quick-action-switch.scss +4 -4
  61. package/src/style/components/_d-select.scss +1 -1
  62. package/src/style/components/_d-stepper-mobile.scss +3 -3
  63. package/src/style/helpers/_+import.scss +3 -1
  64. package/src/style/helpers/_colored-links.scss +70 -0
  65. package/src/style/helpers/_text-truncate.scss +8 -0
  66. package/src/style/root/_root.scss +98 -21
  67. package/dist/types/components/DMonthPicker/DMonthPicker.d.ts +0 -12
  68. package/dist/types/components/DMonthPicker/index.d.ts +0 -2
  69. package/dist/types/contexts/DModalContext.d.ts +0 -31
  70. package/dist/types/contexts/DOffcanvasContext.d.ts +0 -31
  71. package/src/style/components/_d-monthpicker.scss +0 -98
  72. package/src/style/components/_d-tooltip.scss +0 -35
package/dist/index.js CHANGED
@@ -4,20 +4,20 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var React = require('react');
5
5
  var classNames = require('classnames');
6
6
  var tslib = require('tslib');
7
+ var reactDom = require('react-dom');
7
8
  var reactDropzone = require('react-dropzone');
8
9
  var reactSplide = require('@splidejs/react-splide');
9
10
  var currency = require('currency.js');
10
11
  var DatePicker = require('react-datepicker');
11
12
  var dateFns = require('date-fns');
12
- var mask = require('@react-input/mask');
13
13
  var Select = require('react-select');
14
+ var mask = require('@react-input/mask');
14
15
  var ResponsivePagination = require('react-responsive-pagination');
15
16
  var react = require('@floating-ui/react');
16
17
  var ContentLoader = require('react-content-loader');
17
18
  var reactToastify = require('react-toastify');
18
19
  var i18n = require('i18next');
19
20
  var reactI18next = require('react-i18next');
20
- var reactDom = require('react-dom');
21
21
 
22
22
  const PREFIX_BS = 'bs-';
23
23
 
@@ -63,71 +63,6 @@ function DIconBase({ icon, theme, style, className, size = '1.5rem', loading = f
63
63
  return (jsxRuntime.jsx("i", { className: classNames(generateClasses), style: generateStyleVariables, children: materialStyle && icon }));
64
64
  }
65
65
 
66
- const defaultState = {
67
- language: 'en',
68
- currency: {
69
- symbol: '$',
70
- precision: 2,
71
- separator: ',',
72
- decimal: '.',
73
- },
74
- icon: {
75
- familyClass: 'bi',
76
- familyPrefix: 'bi-',
77
- materialStyle: false,
78
- },
79
- iconMap: {
80
- x: 'x',
81
- xLg: 'x-lg',
82
- chevronUp: 'chevron-up',
83
- chevronDown: 'chevron-down',
84
- chevronLeft: 'chevron-left',
85
- chevronRight: 'chevron-right',
86
- upload: 'cloud-upload',
87
- calendar: 'calendar',
88
- check: 'check',
89
- alert: {
90
- warning: 'exclamation-circle',
91
- danger: 'exclamation-triangle',
92
- success: 'check-circle',
93
- info: 'info-circle',
94
- dark: 'info-circle',
95
- light: 'info-circle',
96
- primary: 'info-circle',
97
- secondary: 'info-circle',
98
- },
99
- input: {
100
- invalid: 'exclamation-circle',
101
- valid: 'check',
102
- search: 'search',
103
- show: 'eye',
104
- hide: 'eye-slash',
105
- increase: 'plus-square',
106
- decrease: 'dash-square',
107
- },
108
- },
109
- setContext: () => { },
110
- };
111
- const DContext = React.createContext(defaultState);
112
- function DContextProvider({ language = defaultState.language, currency = defaultState.currency, icon = defaultState.icon, iconMap = defaultState.iconMap, children, }) {
113
- const [internalContext, setInternalContext,] = React.useState({
114
- language,
115
- currency,
116
- icon,
117
- iconMap,
118
- });
119
- const setContext = React.useCallback((newValue) => (setInternalContext((prevInternalContext) => (Object.assign(Object.assign({}, prevInternalContext), newValue)))), []);
120
- const value = React.useMemo(() => (Object.assign(Object.assign({}, internalContext), { setContext })), [internalContext, setContext]);
121
- return (jsxRuntime.jsx(DContext.Provider, { value: value, children: children }));
122
- }
123
- function useDContext() {
124
- const context = React.useContext(DContext);
125
- if (context === undefined) {
126
- throw new Error('useDContext was used outside of DContextProvider');
127
- }
128
- return context;
129
- }
130
-
131
66
  function useDisableBodyScrollEffect(disable) {
132
67
  React.useEffect(() => {
133
68
  if (disable) {
@@ -165,115 +100,136 @@ function usePortal(portalName) {
165
100
  * @returns The list and controls to modify the stack
166
101
  * @see https://react-hooks.org/docs/useStackState
167
102
  */
168
- function useStackState(initialList) {
103
+ function useStackState(initialList = []) {
169
104
  const [list, setList] = React.useState(initialList);
170
- const { length } = list;
171
- const push = React.useCallback((item) => {
172
- setList((prevList) => [
173
- ...prevList,
174
- item,
175
- ]);
176
- }, []);
177
- const pop = React.useCallback(() => {
178
- setList((prevList) => {
179
- if (prevList.length === 0) {
180
- return prevList;
181
- }
182
- const [, ...newList] = prevList;
183
- return newList;
184
- });
185
- }, []);
186
- const peek = React.useCallback(() => {
187
- if (list.length > 0) {
188
- return list[list.length - 1];
189
- }
190
- return undefined;
191
- }, [list]);
192
- const clear = () => setList([]);
193
- const isEmpty = React.useCallback(() => list.length === 0, [list]);
194
- const controls = {
105
+ const push = React.useCallback((item) => (setList((prevList) => [
106
+ ...prevList,
107
+ item,
108
+ ])), []);
109
+ const pop = React.useCallback(() => (setList((prevList) => (prevList.slice(0, prevList.length - 1)))), []);
110
+ const peek = React.useCallback(() => list.at(-1), [list]);
111
+ const clear = React.useCallback(() => setList([]), []);
112
+ const isEmpty = React.useCallback(() => list.length === 0, [list.length]);
113
+ const controls = React.useMemo(() => ({
195
114
  clear,
196
115
  isEmpty,
197
- length,
116
+ length: list.length,
198
117
  peek,
199
118
  pop,
200
119
  push,
201
- };
120
+ }), [
121
+ clear,
122
+ isEmpty,
123
+ list.length,
124
+ peek,
125
+ pop,
126
+ push,
127
+ ]);
202
128
  return [list, controls];
203
129
  }
204
130
 
205
- const DModalContext = React.createContext(undefined);
206
- function DModalContextProvider({ portalName, children, availableModals, }) {
131
+ const DPortalContext = React.createContext(undefined);
132
+ function DPortalContextProvider({ portalName, children, availablePortals, }) {
207
133
  const { created } = usePortal(portalName);
208
- const [stack, { push, pop, peek }] = useStackState([]);
134
+ const [stack, { push, pop, isEmpty }] = useStackState([]);
209
135
  useDisableBodyScrollEffect(Boolean(stack.length));
210
- const openModal = React.useCallback((modalName, payload) => {
211
- const Component = availableModals[modalName];
136
+ const openPortal = React.useCallback((name, payload) => {
137
+ if (!availablePortals) {
138
+ throw new Error(`there is no component for portal ${name.toString()}`);
139
+ }
140
+ const Component = availablePortals[name];
212
141
  if (!Component) {
213
- throw new Error(`there is no component for modal ${modalName.toString()}`);
142
+ throw new Error(`there is no component for portal ${name.toString()}`);
214
143
  }
215
144
  push({
216
- modalName,
145
+ name,
217
146
  Component,
218
147
  payload,
219
148
  });
220
- }, [availableModals, push]);
221
- const closeModal = React.useCallback(() => {
222
- const stackItem = peek();
223
- if (!stackItem) {
149
+ }, [availablePortals, push]);
150
+ const closePortal = React.useCallback(() => {
151
+ if (isEmpty()) {
224
152
  return;
225
153
  }
226
154
  pop();
227
- }, [peek, pop]);
155
+ }, [isEmpty, pop]);
228
156
  const value = React.useMemo(() => ({
229
157
  stack,
230
- openModal,
231
- closeModal,
232
- }), [stack, openModal, closeModal]);
233
- 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))] }));
158
+ openPortal,
159
+ closePortal,
160
+ }), [stack, openPortal, closePortal]);
161
+ return (jsxRuntime.jsxs(DPortalContext.Provider, { value: value, children: [children, created && reactDom.createPortal(jsxRuntime.jsx(jsxRuntime.Fragment, { children: stack.map(({ Component, name, payload, }) => (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx("div", { className: "backdrop fade show" }), jsxRuntime.jsx(Component, { name: name, payload: payload })] }, name))) }), document.getElementById(portalName))] }));
234
162
  }
235
- function useDModalContext() {
236
- const context = React.useContext(DModalContext);
163
+ function useDPortalContext() {
164
+ const context = React.useContext(DPortalContext);
237
165
  if (context === undefined) {
238
- throw new Error('useModalContext was used outside of ModalContextProvider');
166
+ throw new Error('usePortalContext was used outside of PortalContextProvider');
239
167
  }
240
168
  return context;
241
169
  }
242
170
 
243
- const DOffcanvasContext = React.createContext(undefined);
244
- function DOffcanvasContextProvider({ portalName, children, availableOffcanvas, }) {
245
- const { created } = usePortal(portalName);
246
- const [stack, { push, pop, peek }] = useStackState([]);
247
- useDisableBodyScrollEffect(Boolean(stack.length));
248
- const openOffcanvas = React.useCallback((offcanvasName, payload) => {
249
- const Component = availableOffcanvas[offcanvasName];
250
- if (!Component) {
251
- throw new Error(`there is no component for offcanvas ${offcanvasName}`);
252
- }
253
- push({
254
- offcanvasName,
255
- Component,
256
- payload,
257
- });
258
- }, [availableOffcanvas, push]);
259
- const closeOffcanvas = React.useCallback(() => {
260
- const stackItem = peek();
261
- if (!stackItem) {
262
- return;
263
- }
264
- pop();
265
- }, [peek, pop]);
266
- const value = React.useMemo(() => ({
267
- stack,
268
- openOffcanvas,
269
- closeOffcanvas,
270
- }), [stack, openOffcanvas, closeOffcanvas]);
271
- 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))] }));
171
+ const defaultState = {
172
+ language: 'en',
173
+ currency: {
174
+ symbol: '$',
175
+ precision: 2,
176
+ separator: ',',
177
+ decimal: '.',
178
+ },
179
+ icon: {
180
+ familyClass: 'bi',
181
+ familyPrefix: 'bi-',
182
+ materialStyle: false,
183
+ },
184
+ iconMap: {
185
+ x: 'x',
186
+ xLg: 'x-lg',
187
+ chevronUp: 'chevron-up',
188
+ chevronDown: 'chevron-down',
189
+ chevronLeft: 'chevron-left',
190
+ chevronRight: 'chevron-right',
191
+ upload: 'cloud-upload',
192
+ calendar: 'calendar',
193
+ check: 'check',
194
+ alert: {
195
+ warning: 'exclamation-circle',
196
+ danger: 'exclamation-triangle',
197
+ success: 'check-circle',
198
+ info: 'info-circle',
199
+ dark: 'info-circle',
200
+ light: 'info-circle',
201
+ primary: 'info-circle',
202
+ secondary: 'info-circle',
203
+ },
204
+ input: {
205
+ invalid: 'exclamation-circle',
206
+ valid: 'check',
207
+ search: 'search',
208
+ show: 'eye',
209
+ hide: 'eye-slash',
210
+ increase: 'plus-square',
211
+ decrease: 'dash-square',
212
+ },
213
+ },
214
+ setContext: () => { },
215
+ portalName: 'd-portal',
216
+ };
217
+ const DContext = React.createContext(defaultState);
218
+ function DContextProvider({ language = defaultState.language, currency = defaultState.currency, icon = defaultState.icon, iconMap = defaultState.iconMap, portalName = defaultState.portalName, availablePortals, children, }) {
219
+ const [internalContext, setInternalContext,] = React.useState({
220
+ language,
221
+ currency,
222
+ icon,
223
+ iconMap,
224
+ });
225
+ const setContext = React.useCallback((newValue) => (setInternalContext((prevInternalContext) => (Object.assign(Object.assign({}, prevInternalContext), newValue)))), []);
226
+ const value = React.useMemo(() => (Object.assign(Object.assign({}, internalContext), { setContext })), [internalContext, setContext]);
227
+ return (jsxRuntime.jsx(DContext.Provider, { value: value, children: jsxRuntime.jsx(DPortalContextProvider, { portalName: portalName, availablePortals: availablePortals, children: children }) }));
272
228
  }
273
- function useDOffcanvasContext() {
274
- const context = React.useContext(DOffcanvasContext);
229
+ function useDContext() {
230
+ const context = React.useContext(DContext);
275
231
  if (context === undefined) {
276
- throw new Error('useOffcanvasContext was used outside of OffcanvasContextProvider');
232
+ throw new Error('useDContext was used outside of DContextProvider');
277
233
  }
278
234
  return context;
279
235
  }
@@ -363,9 +319,9 @@ function DCarouselSlide(_a) {
363
319
  return (jsxRuntime.jsx(reactSplide.SplideSlide, Object.assign({ className: classNames('d-carousel-slide', className) }, props)));
364
320
  }
365
321
 
366
- function DCarousel(_a) {
322
+ function DCarousel(_a, ref) {
367
323
  var { children, className, style, options } = _a, props = tslib.__rest(_a, ["children", "className", "style", "options"]);
368
- return (jsxRuntime.jsx(reactSplide.Splide, Object.assign({ className: classNames('d-carousel', className), style: style, options: Object.assign(Object.assign({}, options), { classes: {
324
+ return (jsxRuntime.jsx(reactSplide.Splide, Object.assign({ className: classNames('d-carousel', className), style: style, ref: ref, options: Object.assign(Object.assign({}, options), { classes: {
369
325
  // Arrows
370
326
  arrows: 'splide__arrows d-carousel-arrows',
371
327
  arrow: 'splide__arrow d-carousel-arrow',
@@ -376,7 +332,9 @@ function DCarousel(_a) {
376
332
  page: 'splide__pagination__page d-carousel-pagination-page',
377
333
  } }) }, props, { children: children })));
378
334
  }
379
- var DCarousel$1 = Object.assign(DCarousel, {
335
+ const ForwardedDCarousel = React.forwardRef(DCarousel);
336
+ ForwardedDCarousel.displayName = 'DCarousel';
337
+ var DCarousel$1 = Object.assign(ForwardedDCarousel, {
380
338
  Slide: DCarouselSlide,
381
339
  });
382
340
 
@@ -407,7 +365,7 @@ function DCollapse({ id, className, style, Component, hasSeparator = false, defa
407
365
  const generateStyles = React.useMemo(() => ({
408
366
  [`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
409
367
  }), [hasSeparator]);
410
- return (jsxRuntime.jsxs("div", { id: id, className: classNames('collapse-container', className), style: style, children: [jsxRuntime.jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: Component }), jsxRuntime.jsx(DIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}ref-fs-small)`, icon: toggle ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), toggle && (jsxRuntime.jsx("div", { className: classNames({
368
+ return (jsxRuntime.jsxs("div", { id: id, className: classNames('collapse-container', className), style: style, children: [jsxRuntime.jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: Component }), jsxRuntime.jsx(DIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}fs-small)`, icon: toggle ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), toggle && (jsxRuntime.jsx("div", { className: classNames({
411
369
  'collapse-body': true,
412
370
  }), style: generateStyles, children: children }))] }));
413
371
  }
@@ -515,58 +473,187 @@ var DInput$1 = ForwardedDInput;
515
473
 
516
474
  function DDatePickerTime(_a) {
517
475
  var { value, onChange, id, label, className, style } = _a, props = tslib.__rest(_a, ["value", "onChange", "id", "label", "className", "style"]);
518
- 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(DInput$1, Object.assign({}, onChange && {
476
+ 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(DInput$1, Object.assign({ className: "w-100" }, onChange && {
519
477
  onChange,
520
478
  }, { type: "time", id: id, value: value }, props))] }));
521
479
  }
522
480
 
523
481
  function DDatePickerInput(_a, ref) {
524
- var { value, onClick, id, iconEnd, className, style } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style"]);
525
- return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: ref, onClick: onClick, readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style }, props)));
482
+ var { value, onClick, id, iconEnd, className, style, inputLabel } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style", "inputLabel"]);
483
+ return (jsxRuntime.jsx(DInput$1, 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)));
526
484
  }
527
485
  const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
528
486
  ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
529
487
  var DDatePickerInput$1 = ForwardedDDatePickerInput;
530
488
 
531
- function DMonthPicker(_a) {
532
- var { onChange, date, locale, className, calendarClassName, headerPrevYearAriaLabel = 'decrease year', headerNextYearAriaLabel = 'increase year', iconFamilyClass, iconFamilyPrefix, iconPrevMonth: iconPrevMonthProp, iconNextMonth: iconNextMonthProp } = _a, props = tslib.__rest(_a, ["onChange", "date", "locale", "className", "calendarClassName", "headerPrevYearAriaLabel", "headerNextYearAriaLabel", "iconFamilyClass", "iconFamilyPrefix", "iconPrevMonth", "iconNextMonth"]);
533
- const selected = React.useMemo(() => dateFns.parseISO(date), [date]);
534
- const { iconMap: { chevronLeft, chevronRight, }, } = useDContext();
535
- const iconPrevMonth = React.useMemo(() => iconPrevMonthProp || chevronLeft, [chevronLeft, iconPrevMonthProp]);
536
- const iconNextMonth = React.useMemo(() => iconNextMonthProp || chevronRight, [chevronRight, iconNextMonthProp]);
537
- const dateFormatted = React.useMemo(() => (dateFns.format(new Date(date), 'MMMM yyyy', { locale })), [date, locale]);
538
- return (jsxRuntime.jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: selected, className: className, calendarClassName: classNames('d-month-picker', calendarClassName), onChange: onChange }, locale && { locale }, { customInput: (jsxRuntime.jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxRuntime.jsxs("div", { className: "d-flex align-items-center justify-content-between gap-6 fs-6 bg-dark", children: [jsxRuntime.jsx(DButton, { iconStart: iconPrevMonth, size: "sm", variant: "link", theme: "light", onClick: decreaseYear, disabled: prevYearButtonDisabled, ariaLabel: headerPrevYearAriaLabel, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix }), jsxRuntime.jsx("p", { className: "fs-6 fw-bold", children: monthDate.getFullYear() }), jsxRuntime.jsx(DButton, { iconStart: iconNextMonth, size: "sm", variant: "link", theme: "light", onClick: increaseYear, disabled: nextYearButtonDisabled, ariaLabel: headerNextYearAriaLabel, iconEndFamilyClass: iconFamilyPrefix, iconEndFamilyPrefix: iconFamilyPrefix })] })) }, props)));
539
- }
540
-
541
- function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, iconPrevMonth, iconNextMonth, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', iconSize, buttonVariant, buttonTheme, locale, style, className, }) {
542
- const onChangeDate = React.useCallback((value) => {
543
- if (value) {
544
- changeMonth(dateFns.getMonth(value));
545
- changeYear(dateFns.getYear(value));
489
+ function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabled = false, indeterminate, value, onChange, className, style, }) {
490
+ const innerRef = React.useRef(null);
491
+ const handleChange = React.useCallback((event) => {
492
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
493
+ }, [onChange]);
494
+ React.useEffect(() => {
495
+ if (innerRef.current) {
496
+ innerRef.current.indeterminate = Boolean(indeterminate);
546
497
  }
547
- }, [changeMonth, changeYear]);
548
- return (jsxRuntime.jsxs("div", { className: classNames('d-flex align-items-center justify-content-between 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 }), jsxRuntime.jsx(DMonthPicker, Object.assign({}, !withMonthSelector && { readOnly: true }, withMonthSelector && { className: 'cursor-pointer' }, { date: monthDate.toISOString(), onChange: onChangeDate, iconPrevMonth: iconPrevMonth, iconNextMonth: iconNextMonth }, locale && { locale })), jsxRuntime.jsx(DButton, { iconStart: iconNextMonth, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix, iconStartMaterialStyle: iconMaterialStyle, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel })] }));
498
+ }, [indeterminate]);
499
+ React.useEffect(() => {
500
+ if (innerRef.current) {
501
+ innerRef.current.checked = checked;
502
+ }
503
+ }, [checked]);
504
+ if (!label) {
505
+ return (jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }));
506
+ }
507
+ return (jsxRuntime.jsxs("div", { className: "form-check", children: [jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value }), jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
508
+ }
509
+
510
+ function DSelectOptionCheck(_a) {
511
+ var { innerProps, children, isSelected } = _a, props = tslib.__rest(_a, ["innerProps", "children", "isSelected"]);
512
+ return (jsxRuntime.jsx(Select.components.Option, Object.assign({ className: classNames({
513
+ 'd-select__option': true,
514
+ 'd-select__option--is-checkbox': true,
515
+ }), isSelected: isSelected, innerProps: innerProps }, props, { children: jsxRuntime.jsxs("label", { htmlFor: `${innerProps.id}Check`, children: [jsxRuntime.jsx(DInputCheck, { type: "checkbox", checked: isSelected, id: `${innerProps.id}Check` }), children] }) })));
516
+ }
517
+
518
+ function DSelectOptionIcon(_a) {
519
+ var { children, data } = _a, props = tslib.__rest(_a, ["children", "data"]);
520
+ return (jsxRuntime.jsxs(Select.components.Option, Object.assign({ className: classNames({
521
+ 'd-select__option--has-icon': true,
522
+ }), data: data }, props, { children: [jsxRuntime.jsx(DIcon, { icon: data.icon }), children] })));
523
+ }
524
+
525
+ function DSelectSingleValueIconText(_a) {
526
+ var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
527
+ const [value] = getValue();
528
+ return (jsxRuntime.jsxs(Select.components.SingleValue, Object.assign({ className: classNames({
529
+ 'd-select__control--has-icon': true,
530
+ }), getValue: getValue }, props, { children: [jsxRuntime.jsx(DIcon, { icon: value.icon }), children] })));
531
+ }
532
+
533
+ function DSelectDropdownIndicator(props) {
534
+ const { iconMap: { chevronDown, }, } = useDContext();
535
+ return (jsxRuntime.jsx(Select.components.DropdownIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: chevronDown }) })));
536
+ }
537
+
538
+ function DSelectClearIndicator(props) {
539
+ const { iconMap: { xLg, }, } = useDContext();
540
+ return (jsxRuntime.jsx(Select.components.ClearIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: xLg }) })));
541
+ }
542
+
543
+ function DSelectMultiValueRemove(props) {
544
+ const { iconMap: { x, }, } = useDContext();
545
+ return (jsxRuntime.jsx(Select.components.MultiValueRemove, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: x }) })));
546
+ }
547
+
548
+ function DSelectLoadingIndicator({ innerProps, }) {
549
+ return (jsxRuntime.jsx("div", Object.assign({ className: classNames({
550
+ 'd-select__indicator': true,
551
+ 'd-select__loading-indicator': true,
552
+ }) }, innerProps, { children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })));
553
+ }
554
+
555
+ function DSelectOptionEmoji(_a) {
556
+ var { children, data } = _a, props = tslib.__rest(_a, ["children", "data"]);
557
+ return (jsxRuntime.jsxs(Select.components.Option, Object.assign({ className: classNames({
558
+ 'd-select__option--has-icon': true,
559
+ }), data: data }, props, { children: [jsxRuntime.jsx("span", { children: data.emoji }), jsxRuntime.jsx("span", { children: children })] })));
560
+ }
561
+
562
+ function DSelectSingleValueEmoji(_a) {
563
+ var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
564
+ const [value] = getValue();
565
+ return (jsxRuntime.jsx(Select.components.SingleValue, Object.assign({ className: classNames({
566
+ 'd-select__control--has-icon': true,
567
+ }), getValue: getValue }, props, { children: value.emoji })));
568
+ }
569
+
570
+ function DSelectSingleValueEmojiText(_a) {
571
+ var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
572
+ const [value] = getValue();
573
+ return (jsxRuntime.jsxs(Select.components.SingleValue, Object.assign({ className: classNames({
574
+ 'd-select__control--has-icon': true,
575
+ }), getValue: getValue }, props, { children: [jsxRuntime.jsx("span", { children: value.emoji }), jsxRuntime.jsx("span", { children: children })] })));
576
+ }
577
+
578
+ function DSelect(_a) {
579
+ var { id, className, style, label, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, rtl, searchable, multi, components, defaultValue, onIconStartClick, onIconEndClick } = _a, props = tslib.__rest(_a, ["id", "className", "style", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "rtl", "searchable", "multi", "components", "defaultValue", "onIconStartClick", "onIconEndClick"]);
580
+ const handleOnIconStartClick = React.useCallback(() => {
581
+ onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(defaultValue);
582
+ }, [onIconStartClick, defaultValue]);
583
+ const handleOnIconEndClick = React.useCallback(() => {
584
+ onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(defaultValue);
585
+ }, [onIconEndClick, defaultValue]);
586
+ return (jsxRuntime.jsxs("div", { className: classNames('d-select', className, {
587
+ disabled: disabled || loading,
588
+ }), style: style, children: [label && (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("div", { className: classNames({
589
+ 'input-group': true,
590
+ 'has-validation': invalid,
591
+ disabled: disabled || loading,
592
+ }), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsxRuntime.jsx(Select, Object.assign({ styles: {
593
+ control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
594
+ container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
595
+ menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%' })),
596
+ }, className: classNames('d-select-component', {
597
+ 'is-invalid': invalid,
598
+ 'is-valid': valid,
599
+ }), classNamePrefix: "d-select", isDisabled: disabled || loading, isClearable: clearable, isLoading: loading, isRtl: rtl, isSearchable: searchable, isMulti: multi, defaultValue: defaultValue, unstyled: true, components: Object.assign({ DropdownIndicator: DSelectDropdownIndicator, ClearIndicator: DSelectClearIndicator, MultiValueRemove: DSelectMultiValueRemove, LoadingIndicator: DSelectLoadingIndicator }, components) }, props)), ((invalid || valid) && !iconEnd && !loading) && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
600
+ }
601
+ var DSelect$1 = Object.assign(DSelect, {
602
+ OptionCheck: DSelectOptionCheck,
603
+ OptionIcon: DSelectOptionIcon,
604
+ SingleValueIconText: DSelectSingleValueIconText,
605
+ DropdownIndicator: DSelectDropdownIndicator,
606
+ ClearIndicator: DSelectClearIndicator,
607
+ MultiValueRemove: DSelectMultiValueRemove,
608
+ LoadingIndicator: DSelectLoadingIndicator,
609
+ OptionEmoji: DSelectOptionEmoji,
610
+ SingleValueEmoji: DSelectSingleValueEmoji,
611
+ SingleValueEmojiText: DSelectSingleValueEmojiText,
612
+ });
613
+
614
+ 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, }) {
615
+ const arrayYears = React.useMemo(() => Array.from({ length: maxYearSelect - minYearSelect + 1 }, (_, index) => minYearSelect + index), [maxYearSelect, minYearSelect]);
616
+ const years = React.useMemo(() => arrayYears.map((year) => ({
617
+ label: year.toString(),
618
+ value: year,
619
+ })), [arrayYears]);
620
+ const defaultYear = React.useMemo(() => years.find((year) => year.value === dateFns.getYear(date)), [date, years]);
621
+ const arrayMonths = React.useMemo(() => Array.from({ length: 12 }, (_, i) => dateFns.format(new Date(2000, i), 'LLLL', { locale })), [locale]);
622
+ const months = React.useMemo(() => arrayMonths.map((month, i) => ({
623
+ label: month,
624
+ value: i,
625
+ })), [arrayMonths]);
626
+ const defaultMonth = React.useMemo(() => ({
627
+ label: arrayMonths[dateFns.getMonth(date)],
628
+ value: dateFns.getMonth(date),
629
+ }), [arrayMonths, date]);
630
+ 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" })] }));
549
631
  }
550
632
 
551
633
  function DDatePicker(_a) {
552
- var { date, selectsRange = false, withMonthSelector, inputLabel, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, iconInput: iconInputProp, iconHeaderPrevMonth: iconHeaderPrevMonthProp, iconHeaderNextMonth: iconHeaderNextMonthProp, iconMaterialStyle: iconMaterialStyleProp, iconFamilyClass, iconFamilyPrefix, headerPrevMonthAriaLabel = 'decrease month', headerNextMonthAriaLabel = 'increase month', headerIconSize = 'sm', headerButtonVariant = 'link', headerButtonTheme = 'dark', locale, className, style } = _a, props = tslib.__rest(_a, ["date", "selectsRange", "withMonthSelector", "inputLabel", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeLabel", "iconInput", "iconHeaderPrevMonth", "iconHeaderNextMonth", "iconMaterialStyle", "iconFamilyClass", "iconFamilyPrefix", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "headerIconSize", "headerButtonVariant", "headerButtonTheme", "locale", "className", "style"]);
634
+ var { date, selectsRange = false, inputLabel, 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', locale, className, formatWeekDay: formatWeekDayProp, style } = _a, props = tslib.__rest(_a, ["date", "selectsRange", "inputLabel", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeLabel", "iconInput", "iconHeaderPrevMonth", "iconHeaderNextMonth", "iconMaterialStyle", "iconFamilyClass", "iconFamilyPrefix", "minYearSelect", "maxYearSelect", "iconHeaderSize", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "headerButtonVariant", "headerButtonTheme", "locale", "className", "formatWeekDay", "style"]);
553
635
  const { iconMap: { calendar, chevronLeft, chevronRight, }, } = useDContext();
554
636
  const selected = React.useMemo(() => (date ? dateFns.parseISO(date) : null), [date]);
555
637
  const iconInput = React.useMemo(() => iconInputProp || calendar, [calendar, iconInputProp]);
638
+ const handleFormatWeekDay = React.useMemo(() => (formatWeekDayProp
639
+ ? (day) => formatWeekDayProp(day)
640
+ : (day) => day.substring(0, 1)), [formatWeekDayProp]);
556
641
  const iconPrevMonth = React.useMemo(() => iconHeaderPrevMonthProp || chevronLeft, [chevronLeft, iconHeaderPrevMonthProp]);
557
642
  const iconNextMonth = React.useMemo(() => iconHeaderNextMonthProp || chevronRight, [chevronRight, iconHeaderNextMonthProp]);
558
- const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, { iconPrevMonth: iconPrevMonth, iconNextMonth: iconNextMonth, iconMaterialStyle: iconMaterialStyleProp, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [locale,
643
+ 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 }))), [
644
+ locale,
559
645
  iconPrevMonth,
560
646
  iconNextMonth,
561
647
  iconMaterialStyleProp,
562
648
  headerPrevMonthAriaLabel,
563
649
  headerNextMonthAriaLabel,
564
- headerIconSize,
650
+ iconHeaderSize,
565
651
  headerButtonVariant,
566
652
  headerButtonTheme,
567
- withMonthSelector,
653
+ minYearSelect,
654
+ maxYearSelect,
568
655
  ]);
569
- 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, iconMaterialStyle: iconMaterialStyleProp, iconEnd: iconInput, className: className, style: style })), customTimeInput: jsxRuntime.jsx(DDatePickerTime, { id: timeId, label: timeLabel }), selectsRange: selectsRange }, locale && { locale }, props)));
656
+ return (jsxRuntime.jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps)), selectsRange: selectsRange, formatWeekDay: handleFormatWeekDay, customInput: (jsxRuntime.jsx(DDatePickerInput$1, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyleProp, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style })), customTimeInput: (jsxRuntime.jsx(DDatePickerTime, { id: timeId, label: timeLabel })) }, locale && { locale }, props)));
570
657
  }
571
658
 
572
659
  function DInputMask(props, ref) {
@@ -735,27 +822,6 @@ const ForwardedDInputPassword = React.forwardRef(DInputPassword);
735
822
  ForwardedDInputPassword.displayName = 'DInputPassword';
736
823
  var DInputPassword$1 = ForwardedDInputPassword;
737
824
 
738
- function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabled = false, indeterminate, value, onChange, className, style, }) {
739
- const innerRef = React.useRef(null);
740
- const handleChange = React.useCallback((event) => {
741
- onChange === null || onChange === void 0 ? void 0 : onChange(event);
742
- }, [onChange]);
743
- React.useEffect(() => {
744
- if (innerRef.current) {
745
- innerRef.current.indeterminate = Boolean(indeterminate);
746
- }
747
- }, [indeterminate]);
748
- React.useEffect(() => {
749
- if (innerRef.current) {
750
- innerRef.current.checked = checked;
751
- }
752
- }, [checked]);
753
- if (!label) {
754
- return (jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }));
755
- }
756
- return (jsxRuntime.jsxs("div", { className: "form-check", children: [jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value }), jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
757
- }
758
-
759
825
  function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder, type = 'text', disabled = false, loading = false, secret = false, iconFamilyClass, iconFamilyPrefix, characters = 4, invalidIcon: invalidIconProp, validIcon: validIconProp, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, onChange, }) {
760
826
  const [pattern, setPattern] = React.useState('');
761
827
  React.useEffect(() => {
@@ -906,110 +972,6 @@ function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly,
906
972
  return (jsxRuntime.jsxs("div", { className: "form-check form-switch", children: [jsxRuntime.jsx("input", { id: id, name: name, onChange: readonly ? () => false : changeHandler, className: classNames('form-check-input', className), style: style, type: "checkbox", role: "switch", checked: internalIsChecked, disabled: disabled, "aria-label": ariaLabel }), label && (jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
907
973
  }
908
974
 
909
- function DSelectOptionCheck(_a) {
910
- var { innerProps, children, isSelected } = _a, props = tslib.__rest(_a, ["innerProps", "children", "isSelected"]);
911
- return (jsxRuntime.jsx(Select.components.Option, Object.assign({ className: classNames({
912
- 'd-select__option': true,
913
- 'd-select__option--is-checkbox': true,
914
- }), isSelected: isSelected, innerProps: innerProps }, props, { children: jsxRuntime.jsxs("label", { htmlFor: `${innerProps.id}Check`, children: [jsxRuntime.jsx(DInputCheck, { type: "checkbox", checked: isSelected, id: `${innerProps.id}Check` }), children] }) })));
915
- }
916
-
917
- function DSelectOptionIcon(_a) {
918
- var { children, data } = _a, props = tslib.__rest(_a, ["children", "data"]);
919
- return (jsxRuntime.jsxs(Select.components.Option, Object.assign({ className: classNames({
920
- 'd-select__option--has-icon': true,
921
- }), data: data }, props, { children: [jsxRuntime.jsx(DIcon, { icon: data.icon }), children] })));
922
- }
923
-
924
- function DSelectSingleValueIconText(_a) {
925
- var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
926
- const [value] = getValue();
927
- return (jsxRuntime.jsxs(Select.components.SingleValue, Object.assign({ className: classNames({
928
- 'd-select__control--has-icon': true,
929
- }), getValue: getValue }, props, { children: [jsxRuntime.jsx(DIcon, { icon: value.icon }), children] })));
930
- }
931
-
932
- function DSelectDropdownIndicator(props) {
933
- const { iconMap: { chevronDown, }, } = useDContext();
934
- return (jsxRuntime.jsx(Select.components.DropdownIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: chevronDown }) })));
935
- }
936
-
937
- function DSelectClearIndicator(props) {
938
- const { iconMap: { xLg, }, } = useDContext();
939
- return (jsxRuntime.jsx(Select.components.ClearIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: xLg }) })));
940
- }
941
-
942
- function DSelectMultiValueRemove(props) {
943
- const { iconMap: { x, }, } = useDContext();
944
- return (jsxRuntime.jsx(Select.components.MultiValueRemove, Object.assign({}, props, { children: jsxRuntime.jsx(DIcon, { icon: x }) })));
945
- }
946
-
947
- function DSelectLoadingIndicator({ innerProps, }) {
948
- return (jsxRuntime.jsx("div", Object.assign({ className: classNames({
949
- 'd-select__indicator': true,
950
- 'd-select__loading-indicator': true,
951
- }) }, innerProps, { children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })));
952
- }
953
-
954
- function DSelectOptionEmoji(_a) {
955
- var { children, data } = _a, props = tslib.__rest(_a, ["children", "data"]);
956
- return (jsxRuntime.jsxs(Select.components.Option, Object.assign({ className: classNames({
957
- 'd-select__option--has-icon': true,
958
- }), data: data }, props, { children: [jsxRuntime.jsx("span", { children: data.emoji }), jsxRuntime.jsx("span", { children: children })] })));
959
- }
960
-
961
- function DSelectSingleValueEmoji(_a) {
962
- var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
963
- const [value] = getValue();
964
- return (jsxRuntime.jsx(Select.components.SingleValue, Object.assign({ className: classNames({
965
- 'd-select__control--has-icon': true,
966
- }), getValue: getValue }, props, { children: value.emoji })));
967
- }
968
-
969
- function DSelectSingleValueEmojiText(_a) {
970
- var { children, getValue } = _a, props = tslib.__rest(_a, ["children", "getValue"]);
971
- const [value] = getValue();
972
- return (jsxRuntime.jsxs(Select.components.SingleValue, Object.assign({ className: classNames({
973
- 'd-select__control--has-icon': true,
974
- }), getValue: getValue }, props, { children: [jsxRuntime.jsx("span", { children: value.emoji }), jsxRuntime.jsx("span", { children: children })] })));
975
- }
976
-
977
- function DSelect(_a) {
978
- var { id, className, style, label, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, rtl, searchable, multi, components, defaultValue, onIconStartClick, onIconEndClick } = _a, props = tslib.__rest(_a, ["id", "className", "style", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "rtl", "searchable", "multi", "components", "defaultValue", "onIconStartClick", "onIconEndClick"]);
979
- const handleOnIconStartClick = React.useCallback(() => {
980
- onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(defaultValue);
981
- }, [onIconStartClick, defaultValue]);
982
- const handleOnIconEndClick = React.useCallback(() => {
983
- onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(defaultValue);
984
- }, [onIconEndClick, defaultValue]);
985
- return (jsxRuntime.jsxs("div", { className: classNames('d-select', className, {
986
- disabled: disabled || loading,
987
- }), style: style, children: [label && (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("div", { className: classNames({
988
- 'input-group': true,
989
- 'has-validation': invalid,
990
- disabled: disabled || loading,
991
- }), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsxRuntime.jsx(Select, Object.assign({ styles: {
992
- control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
993
- container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
994
- menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%' })),
995
- }, className: classNames('d-select-component', {
996
- 'is-invalid': invalid,
997
- 'is-valid': valid,
998
- }), classNamePrefix: "d-select", isDisabled: disabled || loading, isClearable: clearable, isLoading: loading, isRtl: rtl, isSearchable: searchable, isMulti: multi, defaultValue: defaultValue, unstyled: true, components: Object.assign({ DropdownIndicator: DSelectDropdownIndicator, ClearIndicator: DSelectClearIndicator, MultiValueRemove: DSelectMultiValueRemove, LoadingIndicator: DSelectLoadingIndicator }, components) }, props)), ((invalid || valid) && !iconEnd && !loading) && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
999
- }
1000
- var DSelect$1 = Object.assign(DSelect, {
1001
- OptionCheck: DSelectOptionCheck,
1002
- OptionIcon: DSelectOptionIcon,
1003
- SingleValueIconText: DSelectSingleValueIconText,
1004
- DropdownIndicator: DSelectDropdownIndicator,
1005
- ClearIndicator: DSelectClearIndicator,
1006
- MultiValueRemove: DSelectMultiValueRemove,
1007
- LoadingIndicator: DSelectLoadingIndicator,
1008
- OptionEmoji: DSelectOptionEmoji,
1009
- SingleValueEmoji: DSelectSingleValueEmoji,
1010
- SingleValueEmojiText: DSelectSingleValueEmojiText,
1011
- });
1012
-
1013
975
  function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
1014
976
  const Tag = React.useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
1015
977
  return (jsxRuntime.jsx(Tag, Object.assign({}, Tag === 'button' && {
@@ -1059,7 +1021,7 @@ function DModal({ name, className, style, staticBackdrop, scrollable, centered,
1059
1021
  }
1060
1022
  return '';
1061
1023
  }, [fullScreenFrom, fullScreen]);
1062
- const generateClasses = React.useMemo(() => (Object.assign({ 'modal fade show': true }, className && { [className]: true })), [className]);
1024
+ const generateClasses = React.useMemo(() => (Object.assign({ 'modal portal fade show': true }, className && { [className]: true })), [className]);
1063
1025
  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]);
1064
1026
  return (jsxRuntime.jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style }, staticBackdrop && ({
1065
1027
  [`data-${PREFIX_BS}backdrop`]: 'static',
@@ -1087,7 +1049,7 @@ function DOffcanvasFooter({ footerActionPlacement = 'fill', children, className,
1087
1049
  }
1088
1050
 
1089
1051
  function DOffcanvas({ name, className, style, staticBackdrop, scrollable, openFrom = 'end', children, }) {
1090
- return (jsxRuntime.jsx("div", Object.assign({ className: classNames('offcanvas show', {
1052
+ return (jsxRuntime.jsx("div", Object.assign({ className: classNames('offcanvas portal show', {
1091
1053
  [`offcanvas-${openFrom}`]: openFrom,
1092
1054
  }, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, staticBackdrop && ({
1093
1055
  [`data-${PREFIX_BS}backdrop`]: 'static',
@@ -1205,7 +1167,7 @@ function DQuickActionSwitch({ id, name, label, hint, checked, disabled, classNam
1205
1167
  event.stopPropagation();
1206
1168
  onClick === null || onClick === void 0 ? void 0 : onClick(checked);
1207
1169
  }, [checked, onClick]);
1208
- return (jsxRuntime.jsxs("button", { className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style, children: [jsxRuntime.jsxs("div", { className: "d-quick-action-switch-content", children: [jsxRuntime.jsx(DInputSwitch, { id: id, name: name, disabled: disabled, checked: checked, readonly: true }), jsxRuntime.jsx("label", { className: "d-quick-action-switch-label", htmlFor: id, children: label })] }), jsxRuntime.jsx("div", { className: "d-quick-action-switch-hint", children: hint })] }));
1170
+ return (jsxRuntime.jsxs("button", { className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style, children: [jsxRuntime.jsx("div", { className: "d-quick-action-switch-content", children: jsxRuntime.jsx(DInputSwitch, { id: id, name: name, disabled: disabled, checked: checked, readonly: true, label: label }) }), jsxRuntime.jsx("div", { className: "d-quick-action-switch-hint", children: hint })] }));
1209
1171
  }
1210
1172
 
1211
1173
  function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
@@ -1312,8 +1274,8 @@ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT +
1312
1274
  dismiss,
1313
1275
  role,
1314
1276
  ]);
1315
- const generateClasses = React.useMemo(() => (Object.assign({ 'd-tooltip': true, [`d-tooltip-${size}`]: !!size, [`d-tooltip-${theme}`]: !!theme }, className && { [className]: true })), [size, theme, className]);
1316
- 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] }))) })] }));
1277
+ const generateClasses = React.useMemo(() => (Object.assign({ 'tooltip show': true, [`tooltip-${size}`]: !!size, [`tooltip-${theme}`]: !!theme }, className && { [className]: true })), [size, theme, className]);
1278
+ 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 }), jsxRuntime.jsx("div", { className: "tooltip-inner", children: children })] }))) })] }));
1317
1279
  }
1318
1280
 
1319
1281
  const TabContext = React.createContext(undefined);
@@ -1360,17 +1322,27 @@ var DTabs$1 = Object.assign(DTabs, {
1360
1322
  Tab: DTabContent,
1361
1323
  });
1362
1324
 
1363
- function DToastContainer({ style, position = 'top-right', className, }) {
1364
- return (jsxRuntime.jsx(reactToastify.ToastContainer, { toastClassName: () => classNames('shadow-none p-0 cursor-default', className), position: position, autoClose: false, hideProgressBar: true, closeOnClick: false, closeButton: false, transition: reactToastify.Slide, style: style }));
1325
+ const TOAST_TRANSITIONS$1 = {
1326
+ bounce: reactToastify.Bounce,
1327
+ flip: reactToastify.Flip,
1328
+ slide: reactToastify.Slide,
1329
+ zoom: reactToastify.Zoom,
1330
+ };
1331
+ function DToastContainer({ style, className, closeOnClick, position = 'bottom-center', autoClose = false, stacked = false, transition = 'slide', containerId, }) {
1332
+ const selectedTransition = React.useMemo(() => TOAST_TRANSITIONS$1[transition], [transition]);
1333
+ return (jsxRuntime.jsx(reactToastify.ToastContainer, { toastClassName: () => classNames('shadow-none p-0 cursor-default', className), position: position, autoClose: autoClose, closeOnClick: closeOnClick, transition: selectedTransition, closeButton: false, style: style, hideProgressBar: true, stacked: stacked, containerId: containerId }));
1365
1334
  }
1366
1335
 
1367
- function useToast() {
1368
- const toast = React.useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, icon, iconClose, } = {}) => {
1369
- reactToastify.toast(({ closeToast }) => (jsxRuntime.jsx(DAlert, { type: type, showClose: showClose, onClose: closeToast, id: "alertID", icon: icon, iconClose: iconClose, children: message })), {
1370
- transition: reactToastify.Slide,
1371
- position,
1372
- autoClose,
1373
- });
1336
+ const TOAST_TRANSITIONS = {
1337
+ bounce: reactToastify.Bounce,
1338
+ flip: reactToastify.Flip,
1339
+ slide: reactToastify.Slide,
1340
+ zoom: reactToastify.Zoom,
1341
+ };
1342
+ function useDToast() {
1343
+ const toast = React.useCallback((message, _a) => {
1344
+ var { icon, iconClose, type = 'info', showClose = true, transition } = _a, rest = tslib.__rest(_a, ["icon", "iconClose", "type", "showClose", "transition"]);
1345
+ reactToastify.toast(({ closeToast }) => (jsxRuntime.jsx(DAlert, { onClose: closeToast, id: "alertID", type: type, icon: icon, iconClose: iconClose, showClose: showClose, children: message })), Object.assign({ transition: transition && TOAST_TRANSITIONS[transition] }, rest));
1374
1346
  }, []);
1375
1347
  return {
1376
1348
  toast,
@@ -1424,14 +1396,10 @@ exports.DList = DList$1;
1424
1396
  exports.DListItem = DListItem;
1425
1397
  exports.DModal = DModal$1;
1426
1398
  exports.DModalBody = DModalBody;
1427
- exports.DModalContext = DModalContext;
1428
- exports.DModalContextProvider = DModalContextProvider;
1429
1399
  exports.DModalFooter = DModalFooter;
1430
1400
  exports.DModalHeader = DModalHeader;
1431
1401
  exports.DOffcanvas = DOffcanvas$1;
1432
1402
  exports.DOffcanvasBody = DOffcanvasBody;
1433
- exports.DOffcanvasContext = DOffcanvasContext;
1434
- exports.DOffcanvasContextProvider = DOffcanvasContextProvider;
1435
1403
  exports.DOffcanvasFooter = DOffcanvasFooter;
1436
1404
  exports.DOffcanvasHeader = DOffcanvasHeader;
1437
1405
  exports.DPaginator = DPaginator;
@@ -1453,8 +1421,8 @@ exports.DTooltip = DTooltip;
1453
1421
  exports.configureI18n = configureI8n;
1454
1422
  exports.formatCurrency = formatCurrency;
1455
1423
  exports.useDContext = useDContext;
1456
- exports.useDModalContext = useDModalContext;
1457
- exports.useDOffcanvasContext = useDOffcanvasContext;
1424
+ exports.useDPortalContext = useDPortalContext;
1425
+ exports.useDToast = useDToast;
1458
1426
  exports.useDisableBodyScrollEffect = useDisableBodyScrollEffect;
1459
1427
  exports.useDisableInputWheel = useDisableInputWheel;
1460
1428
  exports.useFormatCurrency = useFormatCurrency;
@@ -1463,5 +1431,4 @@ exports.usePortal = usePortal;
1463
1431
  exports.useProvidedRefOrCreate = useProvidedRefOrCreate;
1464
1432
  exports.useStackState = useStackState;
1465
1433
  exports.useTabContext = useTabContext;
1466
- exports.useToast = useToast;
1467
1434
  //# sourceMappingURL=index.js.map