@dynamic-framework/ui-react 2.0.0-dev.1 → 2.0.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/dynamic-ui-non-root.css +7054 -3736
- package/dist/css/dynamic-ui-non-root.min.css +3 -3
- package/dist/css/dynamic-ui-root.css +339 -161
- package/dist/css/dynamic-ui-root.min.css +3 -3
- package/dist/css/dynamic-ui.css +7380 -3884
- package/dist/css/dynamic-ui.min.css +3 -3
- package/dist/index.esm.js +641 -406
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +685 -433
- package/dist/index.js.map +1 -1
- package/dist/types/components/DAlert/DAlert.d.ts +3 -3
- package/dist/types/components/DAvatar/DAvatar.d.ts +1 -3
- package/dist/types/components/DBadge/DBadge.d.ts +4 -3
- package/dist/types/components/DBox/DBox.d.ts +5 -0
- package/dist/types/components/DBox/index.d.ts +2 -0
- package/dist/types/components/DBoxFile/DBoxFile.d.ts +1 -1
- package/dist/types/components/DButton/DButton.d.ts +8 -17
- package/dist/types/components/DButtonIcon/DButtonIcon.d.ts +3 -3
- package/dist/types/components/DChip/DChip.d.ts +3 -3
- package/dist/types/components/DCollapse/DCollapse.d.ts +1 -1
- package/dist/types/components/DCreditCard/DCreditCard.d.ts +12 -0
- package/dist/types/components/DCreditCard/index.d.ts +2 -0
- package/dist/types/components/DDatePicker/DDatePicker.d.ts +3 -3
- package/dist/types/components/DDatePicker/components/DDatePickerHeaderSelector.d.ts +2 -4
- package/dist/types/components/DDropdown/DDropdown.d.ts +20 -0
- package/dist/types/components/DDropdown/index.d.ts +2 -0
- package/dist/types/components/DIconBase/DIconBase.d.ts +13 -9
- package/dist/types/components/DInput/DInput.d.ts +3 -2
- package/dist/types/components/DInputCheck/DInputCheck.d.ts +2 -1
- package/dist/types/components/DInputCounter/DInputCounter.d.ts +3 -2
- package/dist/types/components/DInputCurrency/DInputCurrency.d.ts +4 -3
- package/dist/types/components/DInputMask/DInputMask.d.ts +7 -17
- package/dist/types/components/DInputPhone/DInputPhone.d.ts +2 -2
- package/dist/types/components/DInputPin/DInputPin.d.ts +3 -3
- package/dist/types/components/DInputRange/DInputRange.d.ts +2 -2
- package/dist/types/components/DInputSelect/DInputSelect.d.ts +3 -3
- package/dist/types/components/DInputSwitch/DInputSwitch.d.ts +2 -1
- package/dist/types/components/DLayout/DLayout.d.ts +22 -0
- package/dist/types/components/DLayout/components/DLayoutPane.d.ts +13 -0
- package/dist/types/components/DLayout/index.d.ts +3 -0
- package/dist/types/components/DListGroup/components/DListGroupItem.d.ts +4 -4
- package/dist/types/components/DModal/DModal.d.ts +3 -1
- package/dist/types/components/DOffcanvas/DOffcanvas.d.ts +3 -1
- package/dist/types/components/DOtp/DOtp.d.ts +16 -0
- package/dist/types/components/DOtp/DOtpspec.d.ts +0 -0
- package/dist/types/components/DOtp/components/OtpCountdown.d.ts +7 -0
- package/dist/types/components/DOtp/hooks/useCountdown.d.ts +4 -0
- package/dist/types/components/DOtp/index.d.ts +2 -0
- package/dist/types/components/DPaginator/DPaginator.d.ts +2 -27
- package/dist/types/components/DPasswordStrengthMeter/DPasswordStrengthMeter.d.ts +23 -0
- package/dist/types/components/DPasswordStrengthMeter/PasswordCheckItem.d.ts +7 -0
- package/dist/types/components/DPasswordStrengthMeter/PasswordCheckList.d.ts +14 -0
- package/dist/types/components/DPasswordStrengthMeter/PasswordStrength.d.ts +6 -0
- package/dist/types/components/DPasswordStrengthMeter/index.d.ts +3 -0
- package/dist/types/components/DProgress/DProgress.d.ts +2 -1
- package/dist/types/components/DSelect/DSelect.d.ts +3 -3
- package/dist/types/components/DTabs/DTabs.d.ts +2 -2
- package/dist/types/components/DTimeline/DTimeline.d.ts +15 -0
- package/dist/types/components/DTimeline/index.d.ts +2 -0
- package/dist/types/components/DToastContainer/useDToast.d.ts +2 -2
- package/dist/types/components/DTooltip/DTooltip.d.ts +1 -2
- package/dist/types/components/DVoucher/DVoucher.d.ts +14 -0
- package/dist/types/components/DVoucher/hooks/useScreenshot.d.ts +5 -0
- package/dist/types/components/DVoucher/hooks/useScreenshotDownload.d.ts +5 -0
- package/dist/types/components/DVoucher/hooks/useScreenshotWebShare.d.ts +5 -0
- package/dist/types/components/DVoucher/index.d.ts +2 -0
- package/dist/types/components/config.d.ts +0 -2
- package/dist/types/components/index.d.ts +8 -9
- package/dist/types/components/interface.d.ts +3 -8
- package/dist/types/hooks/useResponsiveProp.d.ts +35 -0
- package/jest/setup.js +0 -2
- package/package.json +43 -40
- package/src/style/_shame.scss +42 -1
- package/src/style/abstracts/_mixins.scss +35 -23
- package/src/style/abstracts/_utilities.scss +70 -1
- package/src/style/abstracts/variables/_+import.scss +3 -2
- package/src/style/abstracts/variables/_alerts.scss +2 -0
- package/src/style/abstracts/variables/_body.scss +10 -3
- package/src/style/abstracts/variables/_border.scss +5 -5
- package/src/style/abstracts/variables/_buttons.scss +19 -11
- package/src/style/abstracts/variables/_cards.scss +6 -4
- package/src/style/abstracts/variables/_chips.scss +2 -2
- package/src/style/abstracts/variables/_colors.scss +147 -70
- package/src/style/abstracts/variables/_datepicker.scss +10 -9
- package/src/style/abstracts/variables/_dropdowns.scss +6 -4
- package/src/style/abstracts/variables/_forms.scss +4 -4
- package/src/style/abstracts/variables/_list-group.scss +2 -2
- package/src/style/abstracts/variables/_modals.scss +4 -3
- package/src/style/abstracts/variables/_offcanvas.scss +1 -0
- package/src/style/abstracts/variables/_pagination.scss +4 -4
- package/src/style/abstracts/variables/_shadow.scss +1 -0
- package/src/style/abstracts/variables/_tables.scss +8 -3
- package/src/style/abstracts/variables/_tooltip.scss +1 -1
- package/src/style/abstracts/variables/_typography.scss +7 -7
- package/src/style/base/_+import.scss +1 -0
- package/src/style/base/_alert.scss +1 -27
- package/src/style/base/_badge.scss +50 -12
- package/src/style/base/_buttons.scss +33 -30
- package/src/style/base/_dropdown.scss +18 -0
- package/src/style/base/_input-group.scss +5 -0
- package/src/style/base/_label.scss +0 -4
- package/src/style/base/_list-group.scss +6 -0
- package/src/style/base/_pagination.scss +2 -0
- package/src/style/base/_tables.scss +4 -0
- package/src/style/base/_tooltip.scss +1 -10
- package/src/style/components/_+import.scss +5 -4
- package/src/style/components/_d-avatar.scss +2 -20
- package/src/style/components/_d-box-file.scss +1 -1
- package/src/style/components/_d-box.scss +13 -0
- package/src/style/components/_d-carousel.scss +19 -1
- package/src/style/components/_d-credit-card.scss +67 -0
- package/src/style/components/_d-datepicker.scss +83 -26
- package/src/style/components/_d-icon.scss +10 -3
- package/src/style/components/_d-modal.scss +3 -0
- package/src/style/components/_d-stepper-desktop.scss +61 -65
- package/src/style/components/_d-stepper-mobile.scss +2 -2
- package/src/style/components/_d-tabs.scss +37 -0
- package/src/style/components/_d-timeline.scss +108 -0
- package/src/style/components/_d-voucher.scss +29 -0
- package/src/style/helpers/_color-bg.scss +13 -3
- package/src/style/root/_root.scss +109 -86
- package/dist/types/components/DInputCurrencyBase/DInputCurrencyBase.d.ts +0 -26
- package/dist/types/components/DInputCurrencyBase/index.d.ts +0 -2
- package/dist/types/components/DInputSearch/DInputSearch.d.ts +0 -17
- package/dist/types/components/DInputSearch/index.d.ts +0 -2
- package/dist/types/components/DList/DList.d.ts +0 -17
- package/dist/types/components/DList/components/DListItem.d.ts +0 -13
- package/dist/types/components/DList/index.d.ts +0 -3
- package/dist/types/components/DQuickActionButton/DQuickActionButton.d.ts +0 -20
- package/dist/types/components/DQuickActionButton/index.d.ts +0 -2
- package/dist/types/components/DQuickActionCheck/DQuickActionCheck.d.ts +0 -17
- package/dist/types/components/DQuickActionCheck/index.d.ts +0 -2
- package/dist/types/components/DQuickActionSelect/DQuickActionSelect.d.ts +0 -13
- package/dist/types/components/DQuickActionSelect/index.d.ts +0 -2
- package/dist/types/components/DQuickActionSwitch/DQuickActionSwitch.d.ts +0 -15
- package/dist/types/components/DQuickActionSwitch/index.d.ts +0 -2
- package/dist/types/components/DSkeleton/DSkeleton.d.ts +0 -11
- package/dist/types/components/DSkeleton/index.d.ts +0 -2
- package/dist/types/components/DTableHead/DTableHead.d.ts +0 -9
- package/dist/types/components/DTableHead/index.d.ts +0 -2
- package/src/style/components/_d-quick-action-button.scss +0 -121
- package/src/style/components/_d-quick-action-check.scss +0 -74
- package/src/style/components/_d-quick-action-select.scss +0 -58
- package/src/style/components/_d-quick-action-switch.scss +0 -64
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var React = require('react');
|
|
5
4
|
var classNames = require('classnames');
|
|
5
|
+
var React = require('react');
|
|
6
6
|
var tslib = require('tslib');
|
|
7
|
+
var LucideIcons = require('lucide-react');
|
|
7
8
|
var reactDom = require('react-dom');
|
|
9
|
+
var framerMotion = require('framer-motion');
|
|
8
10
|
var fileSelector = require('file-selector');
|
|
9
11
|
var reactSplide = require('@splidejs/react-splide');
|
|
10
12
|
var currency = require('currency.js');
|
|
@@ -14,57 +16,34 @@ var Select = require('react-select');
|
|
|
14
16
|
var mask = require('@react-input/mask');
|
|
15
17
|
var ResponsivePagination = require('react-responsive-pagination');
|
|
16
18
|
var react = require('@floating-ui/react');
|
|
17
|
-
var ContentLoader = require('react-content-loader');
|
|
18
19
|
var reactHotToast = require('react-hot-toast');
|
|
19
20
|
var reactInternationalPhone = require('react-international-phone');
|
|
20
21
|
var googleLibphonenumber = require('google-libphonenumber');
|
|
22
|
+
var html2canvas = require('html2canvas');
|
|
21
23
|
var i18n = require('i18next');
|
|
22
24
|
var reactI18next = require('react-i18next');
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return {};
|
|
35
|
-
}, [color, theme]);
|
|
36
|
-
const backgroundStyle = React.useMemo(() => {
|
|
37
|
-
if (backgroundColor) {
|
|
38
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: backgroundColor };
|
|
39
|
-
}
|
|
40
|
-
if (hasCircle) {
|
|
41
|
-
if (theme) {
|
|
42
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${theme}-rgb), 0.1)` };
|
|
26
|
+
function _interopNamespaceDefault(e) {
|
|
27
|
+
var n = Object.create(null);
|
|
28
|
+
if (e) {
|
|
29
|
+
Object.keys(e).forEach(function (k) {
|
|
30
|
+
if (k !== 'default') {
|
|
31
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
32
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return e[k]; }
|
|
35
|
+
});
|
|
43
36
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const circleSizeStyle = React.useMemo(() => {
|
|
49
|
-
if (hasCircle) {
|
|
50
|
-
return { [`--${PREFIX_BS}icon-component-padding`]: circleSize };
|
|
51
|
-
}
|
|
52
|
-
return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
|
|
53
|
-
}, [circleSize, hasCircle]);
|
|
54
|
-
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ [`--${PREFIX_BS}icon-component-loading-duration`]: `${loadingDuration}s` }, size && { [`--${PREFIX_BS}icon-component-size`]: size }), colorStyle), backgroundStyle), circleSizeStyle), style)), [size, loadingDuration, colorStyle, backgroundStyle, circleSizeStyle, style]);
|
|
55
|
-
const generateClasses = React.useMemo(() => (Object.assign(Object.assign({ 'd-icon': true, [familyClass]: true, 'd-icon-loading': loading }, !materialStyle && {
|
|
56
|
-
[`${familyPrefix}${icon}`]: true,
|
|
57
|
-
}), className && { [className]: true })), [
|
|
58
|
-
familyClass,
|
|
59
|
-
loading,
|
|
60
|
-
className,
|
|
61
|
-
materialStyle,
|
|
62
|
-
familyPrefix,
|
|
63
|
-
icon,
|
|
64
|
-
]);
|
|
65
|
-
return (jsxRuntime.jsx("i", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: materialStyle && icon })));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
n.default = e;
|
|
40
|
+
return Object.freeze(n);
|
|
66
41
|
}
|
|
67
42
|
|
|
43
|
+
var LucideIcons__namespace = /*#__PURE__*/_interopNamespaceDefault(LucideIcons);
|
|
44
|
+
|
|
45
|
+
const PREFIX_BS = 'bs-';
|
|
46
|
+
|
|
68
47
|
function useDisableBodyScrollEffect(disable) {
|
|
69
48
|
React.useEffect(() => {
|
|
70
49
|
if (disable) {
|
|
@@ -221,7 +200,10 @@ function DPortalContextProvider({ portalName, children, availablePortals, }) {
|
|
|
221
200
|
return (jsxRuntime.jsxs(DPortalContext.Provider, { value: value, children: [children, created && reactDom.createPortal(
|
|
222
201
|
// eslint-disable-next-line max-len
|
|
223
202
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
224
|
-
jsxRuntime.jsx("div", { onClick: ({ target }) => handleClose(target), onKeyDown: () => { }, children:
|
|
203
|
+
jsxRuntime.jsx("div", { onClick: ({ target }) => handleClose(target), onKeyDown: () => { }, children: jsxRuntime.jsx(framerMotion.AnimatePresence, { children: stack.flatMap(({ Component, name, payload, }) => [
|
|
204
|
+
jsxRuntime.jsx(framerMotion.motion.div, { className: "backdrop", initial: { opacity: 0 }, animate: { opacity: 0.5 }, exit: { opacity: 0, transition: { delay: 0.3 } }, transition: { duration: 0.15, ease: 'linear' } }, `${name}-backdrop`),
|
|
205
|
+
jsxRuntime.jsx(Component, { name: name, payload: payload }, name),
|
|
206
|
+
]) }) }), document.getElementById(portalName))] }));
|
|
225
207
|
}
|
|
226
208
|
function useDPortalContext() {
|
|
227
209
|
const context = React.useContext(DPortalContext);
|
|
@@ -250,31 +232,27 @@ const DEFAULT_STATE = {
|
|
|
250
232
|
materialStyle: false,
|
|
251
233
|
},
|
|
252
234
|
iconMap: {
|
|
253
|
-
x: '
|
|
254
|
-
xLg: '
|
|
255
|
-
chevronUp: '
|
|
256
|
-
chevronDown: '
|
|
257
|
-
chevronLeft: '
|
|
258
|
-
chevronRight: '
|
|
259
|
-
upload: '
|
|
260
|
-
calendar: '
|
|
261
|
-
check: '
|
|
235
|
+
x: 'X',
|
|
236
|
+
xLg: 'X',
|
|
237
|
+
chevronUp: 'ChevronUp',
|
|
238
|
+
chevronDown: 'ChevronDown',
|
|
239
|
+
chevronLeft: 'ChevronLeft',
|
|
240
|
+
chevronRight: 'ChevronRight',
|
|
241
|
+
upload: 'Upload',
|
|
242
|
+
calendar: 'Calendar',
|
|
243
|
+
check: 'Check',
|
|
262
244
|
alert: {
|
|
263
|
-
warning: '
|
|
264
|
-
danger: '
|
|
265
|
-
success: '
|
|
266
|
-
info: '
|
|
267
|
-
dark: 'info-circle',
|
|
268
|
-
light: 'info-circle',
|
|
269
|
-
primary: 'info-circle',
|
|
270
|
-
secondary: 'info-circle',
|
|
245
|
+
warning: 'AlertCircle',
|
|
246
|
+
danger: 'AlertTriangle',
|
|
247
|
+
success: 'CheckCircle',
|
|
248
|
+
info: 'Info',
|
|
271
249
|
},
|
|
272
250
|
input: {
|
|
273
|
-
search: '
|
|
274
|
-
show: '
|
|
275
|
-
hide: '
|
|
276
|
-
increase: '
|
|
277
|
-
decrease: '
|
|
251
|
+
search: 'Search',
|
|
252
|
+
show: 'Eye',
|
|
253
|
+
hide: 'EyeOff',
|
|
254
|
+
increase: 'Plus',
|
|
255
|
+
decrease: 'Minus',
|
|
278
256
|
},
|
|
279
257
|
},
|
|
280
258
|
breakpoints: {
|
|
@@ -321,31 +299,170 @@ function useDContext() {
|
|
|
321
299
|
return context;
|
|
322
300
|
}
|
|
323
301
|
|
|
302
|
+
function subscribeToMediaQuery(query, callback) {
|
|
303
|
+
const mediaQueryList = window.matchMedia(query);
|
|
304
|
+
mediaQueryList.addEventListener('change', callback);
|
|
305
|
+
return () => {
|
|
306
|
+
mediaQueryList.removeEventListener('change', callback);
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function checkMediaQuery(query) {
|
|
310
|
+
return window.matchMedia(query).matches;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function useMediaQuery(mediaQuery, useListener = false) {
|
|
314
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
315
|
+
const noop = (_) => () => { };
|
|
316
|
+
return React.useSyncExternalStore(useListener ? (cb) => subscribeToMediaQuery(mediaQuery, cb) : noop, () => (mediaQuery ? checkMediaQuery(mediaQuery) : true), () => false);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function useMediaBreakpointUp(breakpoint, useListener = false) {
|
|
320
|
+
const { breakpoints } = useDContext();
|
|
321
|
+
const mediaQuery = React.useMemo(() => (`(min-width: ${breakpoints[breakpoint]})`), [breakpoint, breakpoints]);
|
|
322
|
+
return useMediaQuery(mediaQuery, useListener);
|
|
323
|
+
}
|
|
324
|
+
function useMediaBreakpointUpXs(useListener = false) {
|
|
325
|
+
return useMediaBreakpointUp('xs', useListener);
|
|
326
|
+
}
|
|
327
|
+
function useMediaBreakpointUpSm(useListener = false) {
|
|
328
|
+
return useMediaBreakpointUp('sm', useListener);
|
|
329
|
+
}
|
|
330
|
+
function useMediaBreakpointUpMd(useListener = false) {
|
|
331
|
+
return useMediaBreakpointUp('md', useListener);
|
|
332
|
+
}
|
|
333
|
+
function useMediaBreakpointUpLg(useListener = false) {
|
|
334
|
+
return useMediaBreakpointUp('lg', useListener);
|
|
335
|
+
}
|
|
336
|
+
function useMediaBreakpointUpXl(useListener = false) {
|
|
337
|
+
return useMediaBreakpointUp('xl', useListener);
|
|
338
|
+
}
|
|
339
|
+
function useMediaBreakpointUpXxl(useListener = false) {
|
|
340
|
+
return useMediaBreakpointUp('xxl', useListener);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* React hook to resolve a responsive property value based on the current viewport breakpoint.
|
|
345
|
+
*
|
|
346
|
+
* Given a `ResponsiveProp` object, this hook returns the value for the highest matching breakpoint.
|
|
347
|
+
* If multiple breakpoints match, the value for the largest (highest) breakpoint is used.
|
|
348
|
+
* If no breakpoints match, `undefined` is returned.
|
|
349
|
+
*
|
|
350
|
+
* @param useListener - Whether to listen for breakpoint changes (default: false).
|
|
351
|
+
* @returns An object with a `responsivePropValue` function that takes a
|
|
352
|
+
* `ResponsiveProp` and returns the resolved value.
|
|
353
|
+
*
|
|
354
|
+
* Usage example:
|
|
355
|
+
* ```ts
|
|
356
|
+
* const { responsivePropValue } = useResponsiveProp();
|
|
357
|
+
* const value = responsivePropValue({ xs: "A", md: "B", xl: "C" });
|
|
358
|
+
* // value will be "C" if xl breakpoint is active, "B" if md is active, etc.
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
function useResponsiveProp(useListener = false) {
|
|
362
|
+
const bpXsUp = useMediaBreakpointUpXs(useListener);
|
|
363
|
+
const bpSmUp = useMediaBreakpointUpSm(useListener);
|
|
364
|
+
const bpMdUp = useMediaBreakpointUpMd(useListener);
|
|
365
|
+
const bpLgUp = useMediaBreakpointUpLg(useListener);
|
|
366
|
+
const bpXlUp = useMediaBreakpointUpXl(useListener);
|
|
367
|
+
const bpXxlUp = useMediaBreakpointUpXxl(useListener);
|
|
368
|
+
const responsivePropValue = React.useCallback((prop) => {
|
|
369
|
+
// Pick the highest matched breakpoint value that is defined in prop
|
|
370
|
+
if (prop.xxl !== undefined && bpXxlUp)
|
|
371
|
+
return prop.xxl;
|
|
372
|
+
if (prop.xl !== undefined && bpXlUp)
|
|
373
|
+
return prop.xl;
|
|
374
|
+
if (prop.lg !== undefined && bpLgUp)
|
|
375
|
+
return prop.lg;
|
|
376
|
+
if (prop.md !== undefined && bpMdUp)
|
|
377
|
+
return prop.md;
|
|
378
|
+
if (prop.sm !== undefined && bpSmUp)
|
|
379
|
+
return prop.sm;
|
|
380
|
+
if (prop.xs !== undefined && bpXsUp)
|
|
381
|
+
return prop.xs;
|
|
382
|
+
// Fallback: return undefined if no breakpoint matches
|
|
383
|
+
return undefined;
|
|
384
|
+
}, [bpSmUp, bpMdUp, bpLgUp, bpXlUp, bpXxlUp, bpXsUp]);
|
|
385
|
+
return { responsivePropValue };
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function DIconBase({ icon, color, style, className, size, useListenerSize = false, hasCircle = false, materialStyle = false, familyClass, familyPrefix, strokeWidth = 2, dataAttributes, }) {
|
|
389
|
+
// If materialStyle is true, use Material Design icons (legacy)
|
|
390
|
+
const useMaterialIcons = materialStyle;
|
|
391
|
+
// Get Lucide icon component
|
|
392
|
+
const LucideIcon = React.useMemo(() => {
|
|
393
|
+
if (useMaterialIcons)
|
|
394
|
+
return null;
|
|
395
|
+
// Try to find the icon in Lucide (expects PascalCase)
|
|
396
|
+
const icons = LucideIcons__namespace;
|
|
397
|
+
return icons[icon] || null;
|
|
398
|
+
}, [icon, useMaterialIcons]);
|
|
399
|
+
const colorStyle = React.useMemo(() => {
|
|
400
|
+
if (color) {
|
|
401
|
+
return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${color})` };
|
|
402
|
+
}
|
|
403
|
+
return {};
|
|
404
|
+
}, [color]);
|
|
405
|
+
const backgroundStyle = React.useMemo(() => {
|
|
406
|
+
if (hasCircle) {
|
|
407
|
+
if (color) {
|
|
408
|
+
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${color}-rgb), 0.1)` };
|
|
409
|
+
}
|
|
410
|
+
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}body-color-rgb), 0.1)` };
|
|
411
|
+
}
|
|
412
|
+
return {};
|
|
413
|
+
}, [hasCircle, color]);
|
|
414
|
+
const { responsivePropValue } = useResponsiveProp(useListenerSize);
|
|
415
|
+
const resolvedSize = React.useMemo(() => {
|
|
416
|
+
if (!size)
|
|
417
|
+
return undefined;
|
|
418
|
+
if (typeof size === 'string')
|
|
419
|
+
return size;
|
|
420
|
+
return responsivePropValue(size);
|
|
421
|
+
}, [responsivePropValue, size]);
|
|
422
|
+
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, resolvedSize && { [`--${PREFIX_BS}icon-component-size`]: resolvedSize }), colorStyle), backgroundStyle), hasCircle && { [`--${PREFIX_BS}icon-component-padding`]: `calc(var(--${PREFIX_BS}icon-component-size, 24px) * 0.4)` }), style)), [resolvedSize, colorStyle, backgroundStyle, hasCircle, style]);
|
|
423
|
+
const generateClasses = React.useMemo(() => (Object.assign({ 'd-icon': true }, className && { [className]: true })), [className]);
|
|
424
|
+
const iconSize = React.useMemo(() => {
|
|
425
|
+
if (resolvedSize) {
|
|
426
|
+
const numSize = parseInt(resolvedSize, 10);
|
|
427
|
+
return !Number.isNaN(numSize) ? numSize : resolvedSize;
|
|
428
|
+
}
|
|
429
|
+
return undefined;
|
|
430
|
+
}, [resolvedSize]);
|
|
431
|
+
// Render Material Design icon (legacy support)
|
|
432
|
+
if (useMaterialIcons) {
|
|
433
|
+
return (jsxRuntime.jsx("i", Object.assign({ className: classNames(generateClasses, familyClass), style: generateStyleVariables }, dataAttributes, { children: icon })));
|
|
434
|
+
}
|
|
435
|
+
// Render Lucide icon
|
|
436
|
+
if (!LucideIcon) {
|
|
437
|
+
if (familyClass && familyPrefix) {
|
|
438
|
+
return (jsxRuntime.jsx("i", Object.assign({ className: classNames(generateClasses, familyClass, `${familyPrefix}${icon}`), style: generateStyleVariables }, dataAttributes)));
|
|
439
|
+
}
|
|
440
|
+
// eslint-disable-next-line no-console
|
|
441
|
+
console.warn(`Icon "${icon}" not found in Lucide. Make sure to use PascalCase names (e.g., "Home", "User", "Settings")`);
|
|
442
|
+
return (jsxRuntime.jsx("span", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: "?" })));
|
|
443
|
+
}
|
|
444
|
+
return (jsxRuntime.jsx("span", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: jsxRuntime.jsx(LucideIcon, { size: iconSize || 24, strokeWidth: strokeWidth }) })));
|
|
445
|
+
}
|
|
446
|
+
|
|
324
447
|
function DIcon(_a) {
|
|
325
448
|
var { familyClass: propFamilyClass, familyPrefix: propFamilyPrefix, materialStyle: propMaterialStyle } = _a, props = tslib.__rest(_a, ["familyClass", "familyPrefix", "materialStyle"]);
|
|
326
449
|
const { icon: { familyClass, familyPrefix, materialStyle, }, } = useDContext();
|
|
327
450
|
return (jsxRuntime.jsx(DIconBase, Object.assign({ familyClass: propFamilyClass || familyClass, familyPrefix: propFamilyPrefix || familyPrefix, materialStyle: propMaterialStyle || materialStyle }, props)));
|
|
328
451
|
}
|
|
329
452
|
|
|
330
|
-
function DAlert({
|
|
453
|
+
function DAlert({ color = 'success', icon: iconProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle = false, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle = false, showClose, onClose, children, id, className, style, dataAttributes, }) {
|
|
331
454
|
const { iconMap: { alert, xLg, }, } = useDContext();
|
|
332
|
-
const icon = React.useMemo(() => iconProp || alert[
|
|
455
|
+
const icon = React.useMemo(() => iconProp || alert[color], [alert, iconProp, color]);
|
|
333
456
|
const iconClose = React.useMemo(() => (iconCloseProp || xLg), [iconCloseProp, xLg]);
|
|
334
|
-
const generateClasses = React.useMemo(() => (Object.assign({ alert: true, [`alert-${
|
|
457
|
+
const generateClasses = React.useMemo(() => (Object.assign({ alert: true, [`alert-${color}`]: true, 'fade show': !!showClose }, className && { [className]: true })), [color, showClose, className]);
|
|
335
458
|
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames(generateClasses), style: style, role: "alert", id: id }, dataAttributes, { children: [icon && (jsxRuntime.jsx(DIcon, { className: "alert-icon", icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsxRuntime.jsx("div", { className: "alert-text", children: children }), showClose && (jsxRuntime.jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: iconClose, familyClass: iconCloseFamilyClass, familyPrefix: iconCloseFamilyPrefix, materialStyle: iconCloseMaterialStyle }) }))] })));
|
|
336
459
|
}
|
|
337
460
|
|
|
338
|
-
function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false,
|
|
339
|
-
const generateClasses = React.useMemo(() => {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
return {
|
|
344
|
-
'd-avatar': true,
|
|
345
|
-
[variantClass]: true,
|
|
346
|
-
[`d-avatar-${size}`]: !!size,
|
|
347
|
-
};
|
|
348
|
-
}, [variant, theme, size]);
|
|
461
|
+
function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, className, style, dataAttributes, }) {
|
|
462
|
+
const generateClasses = React.useMemo(() => ({
|
|
463
|
+
'd-avatar': true,
|
|
464
|
+
[`d-avatar-${size}`]: !!size,
|
|
465
|
+
}), [size]);
|
|
349
466
|
const name = React.useMemo(() => {
|
|
350
467
|
if (!nameProp) {
|
|
351
468
|
return undefined;
|
|
@@ -358,16 +475,21 @@ function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, t
|
|
|
358
475
|
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames(generateClasses, className), style: style, id: id }, dataAttributes, { children: [image && jsxRuntime.jsx("img", { src: image, alt: nameProp, className: "d-avatar-img" }), (name && !image) && jsxRuntime.jsx("span", { className: "d-avatar-name", children: name })] })));
|
|
359
476
|
}
|
|
360
477
|
|
|
361
|
-
function DBadge({ text, soft = false,
|
|
478
|
+
function DBadge({ text, soft = false, color = 'primary', id, rounded, className, size, style, iconStart, iconEnd, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, dataAttributes, }) {
|
|
362
479
|
const generateClasses = React.useMemo(() => ({
|
|
363
480
|
badge: true,
|
|
364
|
-
[`badge-${
|
|
365
|
-
[`badge-soft-${
|
|
481
|
+
[`badge-${color}`]: !!color && !soft,
|
|
482
|
+
[`badge-soft-${color}`]: !!color && soft,
|
|
366
483
|
'rounded-pill': !!rounded,
|
|
367
|
-
|
|
484
|
+
[`badge-${size}`]: !!size,
|
|
485
|
+
}), [rounded, soft, color, size]);
|
|
368
486
|
return (jsxRuntime.jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, dataAttributes, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsxRuntime.jsx("span", { children: text }), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }))] })));
|
|
369
487
|
}
|
|
370
488
|
|
|
489
|
+
function DBox({ className, style, children, dataAttributes, }) {
|
|
490
|
+
return (jsxRuntime.jsx("div", Object.assign({ style: style, className: classNames('d-box', className) }, dataAttributes, { children: children })));
|
|
491
|
+
}
|
|
492
|
+
|
|
371
493
|
/* eslint-disable */
|
|
372
494
|
/**
|
|
373
495
|
* This file is originally from `@primer/react`
|
|
@@ -389,7 +511,7 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
389
511
|
}
|
|
390
512
|
|
|
391
513
|
function DInput(_a, ref) {
|
|
392
|
-
var { id: idProp, style, className, label = '',
|
|
514
|
+
var { id: idProp, style, className, label = '', disabled = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconStart, iconStartDisabled, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconStartMaterialStyle, iconEnd, iconEndDisabled, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, iconEndMaterialStyle, hint, size, invalid = false, valid = false, floatingLabel = false, inputStart, inputEnd, value, placeholder = '', dataAttributes, readonly, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = tslib.__rest(_a, ["id", "style", "className", "label", "disabled", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "iconStart", "iconStartDisabled", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconStartMaterialStyle", "iconEnd", "iconEndDisabled", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "iconEndMaterialStyle", "hint", "size", "invalid", "valid", "floatingLabel", "inputStart", "inputEnd", "value", "placeholder", "dataAttributes", "readonly", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
393
515
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
394
516
|
const innerId = React.useId();
|
|
395
517
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
@@ -426,7 +548,7 @@ function DInput(_a, ref) {
|
|
|
426
548
|
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
427
549
|
'is-invalid': invalid,
|
|
428
550
|
'is-valid': valid,
|
|
429
|
-
}), disabled: disabled || loading, value: value, onChange: handleOnChange }, (floatingLabel || placeholder) && { placeholder: floatingLabel ? '' : placeholder }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
|
|
551
|
+
}), disabled: disabled || loading, readOnly: readonly, value: value, onChange: handleOnChange }, (floatingLabel || placeholder) && { placeholder: floatingLabel ? '' : placeholder }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps))), [
|
|
430
552
|
ariaDescribedby,
|
|
431
553
|
disabled,
|
|
432
554
|
handleOnChange,
|
|
@@ -439,14 +561,11 @@ function DInput(_a, ref) {
|
|
|
439
561
|
floatingLabel,
|
|
440
562
|
valid,
|
|
441
563
|
value,
|
|
564
|
+
readonly,
|
|
442
565
|
]);
|
|
443
|
-
const labelComponent = React.useMemo(() => (jsxRuntime.
|
|
566
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsx("label", { htmlFor: id, children: label })), [
|
|
444
567
|
id,
|
|
445
568
|
label,
|
|
446
|
-
labelIcon,
|
|
447
|
-
labelIconFamilyClass,
|
|
448
|
-
labelIconFamilyPrefix,
|
|
449
|
-
labelIconMaterialStyle,
|
|
450
569
|
]);
|
|
451
570
|
const dynamicComponent = React.useMemo(() => {
|
|
452
571
|
if (floatingLabel) {
|
|
@@ -575,7 +694,7 @@ async function urlToFile(url) {
|
|
|
575
694
|
null,
|
|
576
695
|
{
|
|
577
696
|
code: ErrorCodes.FailedFetch,
|
|
578
|
-
message: `Failed to fetch file from ${url}`,
|
|
697
|
+
message: `Failed to fetch file from ${url} (HTTP ${res.status})`,
|
|
579
698
|
},
|
|
580
699
|
];
|
|
581
700
|
}
|
|
@@ -585,11 +704,13 @@ async function urlToFile(url) {
|
|
|
585
704
|
return [file, null];
|
|
586
705
|
}
|
|
587
706
|
catch (error) {
|
|
707
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
708
|
+
const isCorsError = errorMessage.includes('CORS') || errorMessage.includes('Failed to fetch');
|
|
588
709
|
return [
|
|
589
710
|
null,
|
|
590
711
|
{
|
|
591
712
|
code: ErrorCodes.FailedFetch,
|
|
592
|
-
message: `Failed to fetch file from ${url}}`,
|
|
713
|
+
message: `Failed to fetch file from ${url}${isCorsError ? ' (CORS error - file may not be accessible from this domain)' : ` (${errorMessage})`}`,
|
|
593
714
|
},
|
|
594
715
|
];
|
|
595
716
|
}
|
|
@@ -860,38 +981,72 @@ function DBoxFile(_a) {
|
|
|
860
981
|
'd-box-file-disabled': props.disabled,
|
|
861
982
|
'd-box-file-valid': isDragValid,
|
|
862
983
|
'd-box-file-invalid': isDragInvalid,
|
|
863
|
-
}, className), style: style }, dataAttributes, { children: jsxRuntime.jsxs("div", Object.assign({ className: "d-box-file-dropzone", ref: rootRef, onDragEnter: handleDragEnter, onDragOver: (e) => e.preventDefault(), onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: handleClick, onKeyDown: handleKeyDown }, (!props.disabled && !props.noKeyboard ? { tabIndex: 0 } : {}), { role: "presentation", children: [jsxRuntime.jsx("input", { type: "file", multiple: props.multiple, style: { display: 'none' }, ref: inputRef, disabled: props.disabled, onChange: handleFileSelect, onClick: (e) => e.stopPropagation(), tabIndex: -1, accept: acceptAttr }), jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }), jsxRuntime.jsx("div", { className: "d-box-content", children: typeof children === 'function'
|
|
984
|
+
}, className), style: style }, dataAttributes, { children: jsxRuntime.jsxs("div", Object.assign({ className: "d-box-file-dropzone", ref: rootRef, onDragEnter: handleDragEnter, onDragOver: (e) => e.preventDefault(), onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: handleClick, onKeyDown: handleKeyDown }, (!props.disabled && !props.noKeyboard ? { tabIndex: 0 } : {}), { role: "presentation", children: [jsxRuntime.jsx("input", { type: "file", multiple: props.multiple, style: { display: 'none' }, ref: inputRef, disabled: props.disabled, onChange: handleFileSelect, onClick: (e) => e.stopPropagation(), tabIndex: -1, accept: acceptAttr }), icon && iconProp !== false && (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsxRuntime.jsx("div", { className: "d-box-content", children: typeof children === 'function'
|
|
864
985
|
? children(openFileDialog)
|
|
865
|
-
: children })] })) })), !!files.length && (jsxRuntime.jsx("ul", { className: "d-box-files", children: files.map((file, index) => (jsxRuntime.jsx(ForwardedDInput, { value: file.name, iconStart: "
|
|
986
|
+
: children || (jsxRuntime.jsx("p", { className: "text-center m-0", children: "Drag and drop some files here, or click to select files" })) })] })) })), !!files.length && (jsxRuntime.jsx("ul", { className: "d-box-files", children: files.map((file, index) => (jsxRuntime.jsx(ForwardedDInput, { value: file.name, iconStart: "Paperclip", iconEnd: "Trash", readOnly: true, onIconEndClick: () => handleRemoveFile(index) }, `${file.name} ${index}`))) }))] }));
|
|
866
987
|
}
|
|
867
988
|
|
|
868
|
-
|
|
869
|
-
const
|
|
989
|
+
const DButton = React.forwardRef((props, ref) => {
|
|
990
|
+
const { color = 'primary', size, variant, text, children, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, loading = false, loadingText, loadingAriaLabel, disabled = false, className, style, dataAttributes, onClick, type = 'button' } = props, rest = tslib.__rest(props, ["color", "size", "variant", "text", "children", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartMaterialStyle", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndMaterialStyle", "loading", "loadingText", "loadingAriaLabel", "disabled", "className", "style", "dataAttributes", "onClick", "type"]);
|
|
991
|
+
const [buttonWidth, setButtonWidth] = React.useState();
|
|
992
|
+
const buttonRef = React.useRef(null);
|
|
993
|
+
const isDisabled = React.useMemo(() => disabled || loading, [disabled, loading]);
|
|
994
|
+
const content = React.useMemo(() => children || text, [children, text]);
|
|
995
|
+
const classes = React.useMemo(() => {
|
|
870
996
|
const variantClass = variant
|
|
871
|
-
? `btn-${variant}-${
|
|
872
|
-
: `btn-${
|
|
873
|
-
return
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
997
|
+
? `btn-${variant}-${color}`
|
|
998
|
+
: `btn-${color}`;
|
|
999
|
+
return {
|
|
1000
|
+
btn: true,
|
|
1001
|
+
[variantClass]: true,
|
|
1002
|
+
[`btn-${size}`]: !!size,
|
|
1003
|
+
loading,
|
|
1004
|
+
};
|
|
1005
|
+
}, [variant, color, size, loading]);
|
|
1006
|
+
const ariaLabel = React.useMemo(() => {
|
|
1007
|
+
const ariaLabelProp = rest['aria-label'];
|
|
1008
|
+
return loading
|
|
1009
|
+
? loadingAriaLabel || ariaLabelProp || text
|
|
1010
|
+
: ariaLabelProp || text;
|
|
1011
|
+
}, [loading, loadingAriaLabel, rest, text]);
|
|
1012
|
+
const handleClick = React.useCallback((event) => {
|
|
1013
|
+
if (disabled || loading) {
|
|
1014
|
+
event.preventDefault();
|
|
1015
|
+
return;
|
|
878
1016
|
}
|
|
879
1017
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
880
|
-
}, [
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
}
|
|
1018
|
+
}, [disabled, loading, onClick]);
|
|
1019
|
+
React.useEffect(() => {
|
|
1020
|
+
if (!loading && buttonRef.current) {
|
|
1021
|
+
const width = buttonRef.current.offsetWidth;
|
|
1022
|
+
if (width > 0)
|
|
1023
|
+
setButtonWidth(width);
|
|
1024
|
+
}
|
|
1025
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1026
|
+
}, [content, iconEnd, iconStart]);
|
|
1027
|
+
return (jsxRuntime.jsxs("button", Object.assign({ ref: (node) => {
|
|
1028
|
+
buttonRef.current = node;
|
|
1029
|
+
if (typeof ref === 'function')
|
|
1030
|
+
ref(node);
|
|
1031
|
+
// eslint-disable-next-line max-len
|
|
1032
|
+
// eslint-disable-next-line no-param-reassign, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
1033
|
+
else if (ref)
|
|
1034
|
+
ref.current = node;
|
|
1035
|
+
},
|
|
1036
|
+
// eslint-disable-next-line react/button-has-type
|
|
1037
|
+
type: type, className: classNames(classes, className), style: Object.assign(Object.assign({}, style), (loading && buttonWidth
|
|
1038
|
+
? { minWidth: `${buttonWidth}px` }
|
|
1039
|
+
: undefined)), disabled: isDisabled, "aria-label": ariaLabel, "aria-busy": loading, "aria-disabled": isDisabled, onClick: handleClick }, dataAttributes, rest, { children: [loading && (jsxRuntime.jsxs("span", { className: "btn-loading", children: [jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", "aria-hidden": "true" }), loadingText && jsxRuntime.jsx("span", { role: "status", children: loadingText })] })), !loading && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })), content, iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }))] }))] })));
|
|
1040
|
+
});
|
|
1041
|
+
DButton.displayName = 'DButton';
|
|
887
1042
|
|
|
888
|
-
function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel,
|
|
1043
|
+
function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel, color = 'primary', type = 'button', loading = false, disabled = false, stopPropagationEnabled = true, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, }) {
|
|
889
1044
|
const generateClasses = React.useMemo(() => {
|
|
890
1045
|
const variantClass = variant
|
|
891
|
-
? `btn-${variant}-${
|
|
892
|
-
: `btn-${
|
|
1046
|
+
? `btn-${variant}-${color}`
|
|
1047
|
+
: `btn-${color}`;
|
|
893
1048
|
return Object.assign(Object.assign(Object.assign({ 'btn d-button-icon': true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
|
|
894
|
-
}, [variant,
|
|
1049
|
+
}, [variant, color, size, state, loading]);
|
|
895
1050
|
const clickHandler = React.useCallback((event) => {
|
|
896
1051
|
if (stopPropagationEnabled) {
|
|
897
1052
|
event.stopPropagation();
|
|
@@ -919,10 +1074,10 @@ function DCardFooter({ className, style, children, }) {
|
|
|
919
1074
|
return (jsxRuntime.jsx("div", { className: classNames('card-footer', className), style: style, children: children }));
|
|
920
1075
|
}
|
|
921
1076
|
|
|
922
|
-
function DCard({ className, style, children, dataAttributes, }) {
|
|
1077
|
+
function DCard$1({ className, style, children, dataAttributes, }) {
|
|
923
1078
|
return (jsxRuntime.jsx("div", Object.assign({ style: style, className: classNames('card', className) }, dataAttributes, { children: children })));
|
|
924
1079
|
}
|
|
925
|
-
var DCard
|
|
1080
|
+
var DCard = Object.assign(DCard$1, {
|
|
926
1081
|
Header: DCardHeader,
|
|
927
1082
|
Body: DCardBody,
|
|
928
1083
|
Footer: DCardFooter,
|
|
@@ -933,7 +1088,7 @@ function DCarouselSlide(_a) {
|
|
|
933
1088
|
return (jsxRuntime.jsx(reactSplide.SplideSlide, Object.assign({ className: classNames('d-carousel-slide', className) }, props)));
|
|
934
1089
|
}
|
|
935
1090
|
|
|
936
|
-
function DCarousel(_a, ref) {
|
|
1091
|
+
function DCarousel$1(_a, ref) {
|
|
937
1092
|
var { children, className, style, options, dataAttributes } = _a, props = tslib.__rest(_a, ["children", "className", "style", "options", "dataAttributes"]);
|
|
938
1093
|
return (jsxRuntime.jsx(reactSplide.Splide, Object.assign({ className: classNames('d-carousel', className), style: style, ref: ref, options: Object.assign(Object.assign({}, options), { classes: {
|
|
939
1094
|
// Arrows
|
|
@@ -946,17 +1101,17 @@ function DCarousel(_a, ref) {
|
|
|
946
1101
|
page: 'splide__pagination__page d-carousel-pagination-page',
|
|
947
1102
|
} }) }, dataAttributes, props, { children: children })));
|
|
948
1103
|
}
|
|
949
|
-
const ForwardedDCarousel = React.forwardRef(DCarousel);
|
|
1104
|
+
const ForwardedDCarousel = React.forwardRef(DCarousel$1);
|
|
950
1105
|
ForwardedDCarousel.displayName = 'DCarousel';
|
|
951
|
-
var DCarousel
|
|
1106
|
+
var DCarousel = Object.assign(ForwardedDCarousel, {
|
|
952
1107
|
Slide: DCarouselSlide,
|
|
953
1108
|
});
|
|
954
1109
|
|
|
955
|
-
function DChip({
|
|
1110
|
+
function DChip({ color = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle, showClose = false, closeAriaLabel = 'close', className, style, dataAttributes, onClose, }) {
|
|
956
1111
|
const generateClasses = React.useMemo(() => ({
|
|
957
1112
|
'd-chip': true,
|
|
958
|
-
[`d-chip-${
|
|
959
|
-
}), [
|
|
1113
|
+
[`d-chip-${color}`]: !!color,
|
|
1114
|
+
}), [color]);
|
|
960
1115
|
const { iconMap: { xLg, }, } = useDContext();
|
|
961
1116
|
const iconClose = React.useMemo(() => iconCloseProp || xLg, [iconCloseProp, xLg]);
|
|
962
1117
|
return (jsxRuntime.jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, dataAttributes, { children: [icon && (jsxRuntime.jsx("div", { className: "d-chip-icon-container", children: jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), jsxRuntime.jsx("span", { children: text }), showClose && (jsxRuntime.jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, "aria-label": closeAriaLabel, children: jsxRuntime.jsx(DIcon, { icon: iconClose, familyClass: iconCloseFamilyClass, familyPrefix: iconCloseFamilyPrefix, materialStyle: iconCloseMaterialStyle }) }))] })));
|
|
@@ -979,7 +1134,7 @@ function DCollapse({ id, className, style, Component, hasSeparator = false, defa
|
|
|
979
1134
|
const generateStyles = React.useMemo(() => ({
|
|
980
1135
|
[`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
|
|
981
1136
|
}), [hasSeparator]);
|
|
982
|
-
return (jsxRuntime.jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { 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:
|
|
1137
|
+
return (jsxRuntime.jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { 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: "gray", size: "1rem", icon: collapsed ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), !collapsed && (jsxRuntime.jsx("div", { className: classNames({
|
|
983
1138
|
'collapse-body': true,
|
|
984
1139
|
}), style: generateStyles, children: children }))] })));
|
|
985
1140
|
}
|
|
@@ -1018,7 +1173,7 @@ const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
|
|
|
1018
1173
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
1019
1174
|
|
|
1020
1175
|
function DInputCheck(_a) {
|
|
1021
|
-
var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, value, hint, onChange, className, style, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "value", "hint", "onChange", "className", "style", "dataAttributes"]);
|
|
1176
|
+
var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, inputClassName, value, hint, onChange, className, style, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "inputClassName", "value", "hint", "onChange", "className", "style", "dataAttributes"]);
|
|
1022
1177
|
const innerRef = React.useRef(null);
|
|
1023
1178
|
const innerId = React.useId();
|
|
1024
1179
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
@@ -1046,11 +1201,11 @@ function DInputCheck(_a) {
|
|
|
1046
1201
|
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
|
|
1047
1202
|
'is-invalid': invalid,
|
|
1048
1203
|
'is-valid': valid,
|
|
1049
|
-
},
|
|
1204
|
+
}, inputClassName), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, props))), [
|
|
1050
1205
|
handleChange,
|
|
1051
1206
|
invalid,
|
|
1052
1207
|
valid,
|
|
1053
|
-
|
|
1208
|
+
inputClassName,
|
|
1054
1209
|
style,
|
|
1055
1210
|
id,
|
|
1056
1211
|
disabled,
|
|
@@ -1064,7 +1219,7 @@ function DInputCheck(_a) {
|
|
|
1064
1219
|
if (!label) {
|
|
1065
1220
|
return inputComponent;
|
|
1066
1221
|
}
|
|
1067
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className:
|
|
1222
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('form-check', className) }, dataAttributes, { children: [inputComponent, jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
1068
1223
|
}
|
|
1069
1224
|
|
|
1070
1225
|
function DSelectOptionCheck(_a) {
|
|
@@ -1142,8 +1297,8 @@ function DSelectPlaceholder(_a) {
|
|
|
1142
1297
|
return (jsxRuntime.jsx(Select.components.Placeholder, Object.assign({ innerProps: innerProps, selectProps: selectProps }, props, { children: children })));
|
|
1143
1298
|
}
|
|
1144
1299
|
|
|
1145
|
-
function DSelect(_a) {
|
|
1146
|
-
var { id: idProp, className, style, label,
|
|
1300
|
+
function DSelect$1(_a) {
|
|
1301
|
+
var { id: idProp, className, style, label, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, floatingLabel = false, rtl, searchable, multi, components, defaultValue, placeholder, onIconStartClick, onIconEndClick, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "className", "style", "label", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "floatingLabel", "rtl", "searchable", "multi", "components", "defaultValue", "placeholder", "onIconStartClick", "onIconEndClick", "dataAttributes"]);
|
|
1147
1302
|
const innerId = React.useId();
|
|
1148
1303
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1149
1304
|
const handleOnIconStartClick = React.useCallback(() => {
|
|
@@ -1155,7 +1310,7 @@ function DSelect(_a) {
|
|
|
1155
1310
|
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('d-select', className, {
|
|
1156
1311
|
'd-select-floating': floatingLabel,
|
|
1157
1312
|
disabled: disabled || loading,
|
|
1158
|
-
}), style: style }, dataAttributes, { children: [label && (jsxRuntime.
|
|
1313
|
+
}), style: style }, dataAttributes, { children: [label && (jsxRuntime.jsx("label", { htmlFor: id, children: label })), jsxRuntime.jsxs("div", { className: classNames({
|
|
1159
1314
|
'input-group': true,
|
|
1160
1315
|
'has-validation': invalid,
|
|
1161
1316
|
disabled: disabled || loading,
|
|
@@ -1168,7 +1323,7 @@ function DSelect(_a) {
|
|
|
1168
1323
|
'is-valid': valid,
|
|
1169
1324
|
}), classNamePrefix: "d-select", isDisabled: disabled || loading, isClearable: clearable, isLoading: loading, isRtl: rtl, isSearchable: searchable, isMulti: multi, defaultValue: defaultValue, placeholder: floatingLabel ? '' : placeholder, unstyled: true, components: Object.assign({ Placeholder: DSelectPlaceholder, DropdownIndicator: DSelectDropdownIndicator, ClearIndicator: DSelectClearIndicator, MultiValueRemove: DSelectMultiValueRemove, LoadingIndicator: DSelectLoadingIndicator }, components) }, props)), (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 }))] })));
|
|
1170
1325
|
}
|
|
1171
|
-
var DSelect
|
|
1326
|
+
var DSelect = Object.assign(DSelect$1, {
|
|
1172
1327
|
OptionCheck: DSelectOptionCheck,
|
|
1173
1328
|
OptionIcon: DSelectOptionIcon,
|
|
1174
1329
|
SingleValueIconText: DSelectSingleValueIconText,
|
|
@@ -1189,7 +1344,7 @@ var PickerType;
|
|
|
1189
1344
|
PickerType["Month"] = "month";
|
|
1190
1345
|
PickerType["Year"] = "year";
|
|
1191
1346
|
})(PickerType || (PickerType = {}));
|
|
1192
|
-
function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMonth, increaseMonth, decreaseYear, increaseYear, monthDate, pickerType, prevMonthButtonDisabled, nextMonthButtonDisabled, monthsShown = 1, iconPrev, iconNext, prevYearButtonDisabled, nextYearButtonDisabled,
|
|
1347
|
+
function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMonth, increaseMonth, decreaseYear, increaseYear, monthDate, pickerType, prevMonthButtonDisabled, nextMonthButtonDisabled, monthsShown = 1, iconPrev, iconNext, prevYearButtonDisabled, nextYearButtonDisabled, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', prevYearAriaLabel = 'decrease year', nextYearAriaLabel = 'increase year', iconSize, style, className, minYearSelect = 1900, maxYearSelect = 2100, showHeaderSelectors = false, customHeaderCount, locale, }) {
|
|
1193
1348
|
const { iconMap: { chevronLeft, chevronRight, }, } = useDContext();
|
|
1194
1349
|
const arrayYears = React.useMemo(() => Array.from({ length: maxYearSelect - minYearSelect + 1 }, (_, index) => minYearSelect + index), [maxYearSelect, minYearSelect]);
|
|
1195
1350
|
const years = React.useMemo(() => arrayYears.map((year) => ({
|
|
@@ -1214,16 +1369,16 @@ function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMont
|
|
|
1214
1369
|
}, [date]);
|
|
1215
1370
|
const [startYear, endYear] = getYearRange();
|
|
1216
1371
|
if (pickerType === PickerType.Year) {
|
|
1217
|
-
return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsxRuntime.jsx(
|
|
1372
|
+
return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevYearButtonDisabled, ariaLabel: prevYearAriaLabel, className: "header-button" }), jsxRuntime.jsx("p", { children: `${startYear} - ${endYear}` }), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextYearButtonDisabled, ariaLabel: nextYearAriaLabel, className: "header-button" })] }));
|
|
1218
1373
|
}
|
|
1219
1374
|
if (pickerType === PickerType.Quarter || pickerType === PickerType.Month) {
|
|
1220
|
-
return (jsxRuntime.jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsxRuntime.jsx(
|
|
1375
|
+
return (jsxRuntime.jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), jsxRuntime.jsx("div", { className: "d-flex justify-content-center flex-grow-1", children: showHeaderSelectors ? (jsxRuntime.jsx(DSelect, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })) : (jsxRuntime.jsx("p", { children: defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label })) }), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] }));
|
|
1221
1376
|
}
|
|
1222
|
-
return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [jsxRuntime.jsx(
|
|
1377
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "datepicker-top-header", children: [showHeaderSelectors && (jsxRuntime.jsx(DSelect, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false, className: "custom-year-selector" })), jsxRuntime.jsx("h4", { className: "mb-0 fw-normal", children: dateFns.format(monthDate, 'LLLL, dd', { locale }) })] }), jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseMonth, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), showHeaderSelectors ? (jsxRuntime.jsx(DSelect, { options: months, value: defaultMonth, defaultValue: defaultMonth, onChange: (month) => changeMonth((month === null || month === void 0 ? void 0 : month.value) || 0), searchable: false, className: "custom-month-selector" })) : (jsxRuntime.jsx("p", { children: `${defaultMonth.label} ${defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label}` })), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] })] }));
|
|
1223
1378
|
}
|
|
1224
1379
|
|
|
1225
1380
|
function DDatePicker(_a) {
|
|
1226
|
-
var { inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeInputLabel,
|
|
1381
|
+
var { inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeInputLabel, minYearSelect, maxYearSelect, iconHeaderSize, iconMaterialStyle, iconInput, headerPrevMonthAriaLabel, headerNextMonthAriaLabel, invalid = false, valid = false, renderCustomHeader: renderCustomHeaderProp, className, dateFormatCalendar: dateFormatCalendarProp, style, dataAttributes, placeholder, showHeaderSelectors } = _a, props = tslib.__rest(_a, ["inputLabel", "inputHint", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeInputLabel", "minYearSelect", "maxYearSelect", "iconHeaderSize", "iconMaterialStyle", "iconInput", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "invalid", "valid", "renderCustomHeader", "className", "dateFormatCalendar", "style", "dataAttributes", "placeholder", "showHeaderSelectors"]);
|
|
1227
1382
|
const pickerType = React.useMemo(() => {
|
|
1228
1383
|
if (props.showQuarterYearPicker)
|
|
1229
1384
|
return PickerType.Quarter;
|
|
@@ -1237,15 +1392,10 @@ function DDatePicker(_a) {
|
|
|
1237
1392
|
props.showMonthYearPicker,
|
|
1238
1393
|
props.showYearPicker,
|
|
1239
1394
|
]);
|
|
1240
|
-
const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeaderSelector, Object.assign({}, headerProps, { monthsShown: props.monthsShown,
|
|
1241
|
-
iconHeaderNext,
|
|
1242
|
-
iconHeaderPrev,
|
|
1243
|
-
iconMaterialStyle,
|
|
1395
|
+
const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeaderSelector, Object.assign({}, headerProps, { monthsShown: props.monthsShown, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize: iconHeaderSize, minYearSelect: minYearSelect, maxYearSelect: maxYearSelect, pickerType: pickerType, showHeaderSelectors: showHeaderSelectors, locale: props.locale }))), [
|
|
1244
1396
|
headerPrevMonthAriaLabel,
|
|
1245
1397
|
headerNextMonthAriaLabel,
|
|
1246
1398
|
iconHeaderSize,
|
|
1247
|
-
headerButtonVariant,
|
|
1248
|
-
headerButtonTheme,
|
|
1249
1399
|
minYearSelect,
|
|
1250
1400
|
maxYearSelect,
|
|
1251
1401
|
pickerType,
|
|
@@ -1258,6 +1408,33 @@ function DDatePicker(_a) {
|
|
|
1258
1408
|
return (jsxRuntime.jsx(DatePicker, Object.assign({}, dataAttributes, props, { calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, placeholderText: placeholder, customInput: (jsxRuntime.jsx(ForwardedDDatePickerInput, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyle, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, hint: inputHint })), customTimeInput: (jsxRuntime.jsx(DDatePickerTime, { id: timeId })) })));
|
|
1259
1409
|
}
|
|
1260
1410
|
|
|
1411
|
+
function DLayoutPane({ className, style, children, cols, colsXs, colsSm, colsMd, colsLg, colsXl, colsXxl, dataAttributes, }) {
|
|
1412
|
+
const colsClass = cols ? `g-col-${cols}` : undefined;
|
|
1413
|
+
const colsXsClass = colsXs ? `g-col-${colsXs}` : undefined;
|
|
1414
|
+
const colsSmClass = colsSm ? `g-col-sm-${colsSm}` : undefined;
|
|
1415
|
+
const colsMdClass = colsMd ? `g-col-md-${colsMd}` : undefined;
|
|
1416
|
+
const colsLgClass = colsLg ? `g-col-lg-${colsLg}` : undefined;
|
|
1417
|
+
const colsXlClass = colsXl ? `g-col-xl-${colsXl}` : undefined;
|
|
1418
|
+
const colsXxlClass = colsXxl ? `g-col-xxl-${colsXxl}` : undefined;
|
|
1419
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames(colsClass, colsXsClass, colsSmClass, colsMdClass, colsLgClass, colsXlClass, colsXxlClass, className), style: style }, dataAttributes, { children: children })));
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
function DLayout$1({ className, style, children, gap, columns, gapSm, gapMd, gapLg, gapXl, gapXxl, dataAttributes, }) {
|
|
1423
|
+
const gapClasses = classNames({
|
|
1424
|
+
[`gap-${gap}`]: gap !== undefined,
|
|
1425
|
+
[`gap-sm-${gapSm}`]: gapSm !== undefined,
|
|
1426
|
+
[`gap-md-${gapMd}`]: gapMd !== undefined,
|
|
1427
|
+
[`gap-lg-${gapLg}`]: gapLg !== undefined,
|
|
1428
|
+
[`gap-xl-${gapXl}`]: gapXl !== undefined,
|
|
1429
|
+
[`gap-xxl-${gapXxl}`]: gapXxl !== undefined,
|
|
1430
|
+
});
|
|
1431
|
+
const styleWithColumns = Object.assign(Object.assign({}, style), { '--bs-columns': columns });
|
|
1432
|
+
return (jsxRuntime.jsx("div", Object.assign({ style: styleWithColumns, className: classNames('grid', gapClasses, className) }, dataAttributes, { children: children })));
|
|
1433
|
+
}
|
|
1434
|
+
var DLayout = Object.assign(DLayout$1, {
|
|
1435
|
+
Pane: DLayoutPane,
|
|
1436
|
+
});
|
|
1437
|
+
|
|
1261
1438
|
function DInputMask(props, ref) {
|
|
1262
1439
|
return (jsxRuntime.jsx(mask.InputMask, Object.assign({ ref: ref, component: ForwardedDInput }, props)));
|
|
1263
1440
|
}
|
|
@@ -1362,47 +1539,6 @@ function useItemSelection({ getItemIdentifier: getItemIdentifierProp, previousSe
|
|
|
1362
1539
|
};
|
|
1363
1540
|
}
|
|
1364
1541
|
|
|
1365
|
-
function subscribeToMediaQuery(query, callback) {
|
|
1366
|
-
const mediaQueryList = window.matchMedia(query);
|
|
1367
|
-
mediaQueryList.addEventListener('change', callback);
|
|
1368
|
-
return () => {
|
|
1369
|
-
mediaQueryList.removeEventListener('change', callback);
|
|
1370
|
-
};
|
|
1371
|
-
}
|
|
1372
|
-
function checkMediaQuery(query) {
|
|
1373
|
-
return window.matchMedia(query).matches;
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
function useMediaQuery(mediaQuery, useListener = false) {
|
|
1377
|
-
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
1378
|
-
const noop = (_) => () => { };
|
|
1379
|
-
return React.useSyncExternalStore(useListener ? (cb) => subscribeToMediaQuery(mediaQuery, cb) : noop, () => (mediaQuery ? checkMediaQuery(mediaQuery) : true), () => false);
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
function useMediaBreakpointUp(breakpoint, useListener = false) {
|
|
1383
|
-
const { breakpoints } = useDContext();
|
|
1384
|
-
const mediaQuery = React.useMemo(() => (`(min-width: ${breakpoints[breakpoint]})`), [breakpoint, breakpoints]);
|
|
1385
|
-
return useMediaQuery(mediaQuery, useListener);
|
|
1386
|
-
}
|
|
1387
|
-
function useMediaBreakpointUpXs(useListener = false) {
|
|
1388
|
-
return useMediaBreakpointUp('xs', useListener);
|
|
1389
|
-
}
|
|
1390
|
-
function useMediaBreakpointUpSm(useListener = false) {
|
|
1391
|
-
return useMediaBreakpointUp('sm', useListener);
|
|
1392
|
-
}
|
|
1393
|
-
function useMediaBreakpointUpMd(useListener = false) {
|
|
1394
|
-
return useMediaBreakpointUp('md', useListener);
|
|
1395
|
-
}
|
|
1396
|
-
function useMediaBreakpointUpLg(useListener = false) {
|
|
1397
|
-
return useMediaBreakpointUp('lg', useListener);
|
|
1398
|
-
}
|
|
1399
|
-
function useMediaBreakpointUpXl(useListener = false) {
|
|
1400
|
-
return useMediaBreakpointUp('xl', useListener);
|
|
1401
|
-
}
|
|
1402
|
-
function useMediaBreakpointUpXxl(useListener = false) {
|
|
1403
|
-
return useMediaBreakpointUp('xxl', useListener);
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
1542
|
function DInputCounter(_a, ref) {
|
|
1407
1543
|
var { minValue, maxValue, value = minValue, invalid, iconStart: iconStartProp, iconEnd: iconEndProp, iconStartAriaLabel = 'decrease action', iconEndAriaLabel = 'increase action', style, onChange } = _a, props = tslib.__rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "iconStartAriaLabel", "iconEndAriaLabel", "style", "onChange"]);
|
|
1408
1544
|
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
@@ -1441,18 +1577,6 @@ function DInputCounter(_a, ref) {
|
|
|
1441
1577
|
const ForwardedDInputCounter = React.forwardRef(DInputCounter);
|
|
1442
1578
|
ForwardedDInputCounter.displayName = 'DInputCounter';
|
|
1443
1579
|
|
|
1444
|
-
/**
|
|
1445
|
-
* @deprecated
|
|
1446
|
-
*/
|
|
1447
|
-
function DInputCurrencyBase(_a, ref) {
|
|
1448
|
-
var { value, minValue, maxValue, currencyOptions, currencyCode, onFocus, onBlur, onChange } = _a, inputProps = tslib.__rest(_a, ["value", "minValue", "maxValue", "currencyOptions", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
1449
|
-
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
1450
|
-
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
1451
|
-
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsxRuntime.jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, inputProps)));
|
|
1452
|
-
}
|
|
1453
|
-
const ForwardedDInputCurrencyBase$1 = React.forwardRef(DInputCurrencyBase);
|
|
1454
|
-
ForwardedDInputCurrencyBase$1.displayName = 'DInputCurrencyBase';
|
|
1455
|
-
|
|
1456
1580
|
function DInputCurrency(_a, ref) {
|
|
1457
1581
|
var { value, minValue, maxValue, currencyCode, onFocus, onBlur, onChange } = _a, props = tslib.__rest(_a, ["value", "minValue", "maxValue", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
1458
1582
|
const { currency: currencyOptions } = useDContext();
|
|
@@ -1460,19 +1584,8 @@ function DInputCurrency(_a, ref) {
|
|
|
1460
1584
|
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
1461
1585
|
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsxRuntime.jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, props)));
|
|
1462
1586
|
}
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
/**
|
|
1467
|
-
* @deprecated
|
|
1468
|
-
*/
|
|
1469
|
-
function DInputSearch(_a, ref) {
|
|
1470
|
-
var { type, iconEnd: iconEndProp, iconEndAriaLabel = 'search' } = _a, props = tslib.__rest(_a, ["type", "iconEnd", "iconEndAriaLabel"]);
|
|
1471
|
-
const inputRef = useProvidedRefOrCreate(ref);
|
|
1472
|
-
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", iconEndAriaLabel: iconEndAriaLabel }, props)));
|
|
1473
|
-
}
|
|
1474
|
-
const ForwardedDInputSearch = React.forwardRef(DInputSearch);
|
|
1475
|
-
ForwardedDInputSearch.displayName = 'DInputSearch';
|
|
1587
|
+
const ForwardedDInputCurrency = React.forwardRef(DInputCurrency);
|
|
1588
|
+
ForwardedDInputCurrency.displayName = 'DInputCurrency';
|
|
1476
1589
|
|
|
1477
1590
|
function DInputPassword(_a, ref) {
|
|
1478
1591
|
var { onIconEndClick, iconEndAriaLabel = 'show/hide password' } = _a, props = tslib.__rest(_a, ["onIconEndClick", "iconEndAriaLabel"]);
|
|
@@ -1489,7 +1602,87 @@ function DInputPassword(_a, ref) {
|
|
|
1489
1602
|
const ForwardedDInputPassword = React.forwardRef(DInputPassword);
|
|
1490
1603
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
1491
1604
|
|
|
1492
|
-
function
|
|
1605
|
+
function PasswordCheckItem({ password, regex, text, }) {
|
|
1606
|
+
const isValid = regex.test(password);
|
|
1607
|
+
return (jsxRuntime.jsxs("li", { className: "d-flex gap-2 align-items-start small text-gray-600", children: [jsxRuntime.jsx(DIcon, { className: classNames('flex-shrink-0', isValid ? 'text-success' : 'text-gray-300'), icon: isValid ? 'CircleCheck' : 'Circle', size: "16px" }), jsxRuntime.jsx("span", { className: classNames({ 'text-success': isValid }), children: text })] }));
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
const getColorClass = (strength, total) => {
|
|
1611
|
+
const percentage = total > 0 ? strength / total : 0;
|
|
1612
|
+
if (percentage === 0)
|
|
1613
|
+
return 'bg-gray-200';
|
|
1614
|
+
if (percentage <= 0.25)
|
|
1615
|
+
return 'bg-danger';
|
|
1616
|
+
if (percentage <= 0.5)
|
|
1617
|
+
return 'bg-warning';
|
|
1618
|
+
if (percentage <= 0.75)
|
|
1619
|
+
return 'bg-info';
|
|
1620
|
+
return 'bg-success';
|
|
1621
|
+
};
|
|
1622
|
+
function PasswordStrengthBar({ strength, total }) {
|
|
1623
|
+
const percentage = total > 0 ? (strength / total) * 100 : 0;
|
|
1624
|
+
return (jsxRuntime.jsx("div", { className: "w-100 rounded-3 overflow-hidden bg-gray-100 mb-2", style: { height: '8px' }, children: jsxRuntime.jsx("div", { className: `h-100 ${getColorClass(strength, total)}`, style: {
|
|
1625
|
+
width: `${percentage}%`,
|
|
1626
|
+
transition: 'width 0.3s ease-in-out',
|
|
1627
|
+
} }) }));
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
const CHECK_REGEX = {
|
|
1631
|
+
uppercase: /[A-Z]/,
|
|
1632
|
+
lowercase: /[a-z]/,
|
|
1633
|
+
number: /\d/,
|
|
1634
|
+
specialChar: /[~!@#$^*\-_=[\]{}|;,.?]/,
|
|
1635
|
+
};
|
|
1636
|
+
function PasswordChecksList({ password, validationMessages, enabledChecks, }) {
|
|
1637
|
+
const allChecks = [
|
|
1638
|
+
{
|
|
1639
|
+
key: 'uppercase',
|
|
1640
|
+
regex: CHECK_REGEX.uppercase,
|
|
1641
|
+
text: validationMessages.uppercaseLetter,
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
key: 'lowercase',
|
|
1645
|
+
regex: CHECK_REGEX.lowercase,
|
|
1646
|
+
text: validationMessages.lowercaseLetter,
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
key: 'number',
|
|
1650
|
+
regex: CHECK_REGEX.number,
|
|
1651
|
+
text: validationMessages.number,
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
key: 'specialChar',
|
|
1655
|
+
regex: CHECK_REGEX.specialChar,
|
|
1656
|
+
text: validationMessages.especialChar,
|
|
1657
|
+
},
|
|
1658
|
+
];
|
|
1659
|
+
const passwordChecks = allChecks.filter((check) => enabledChecks.includes(check.key));
|
|
1660
|
+
const passed = passwordChecks.filter((r) => r.regex.test(password)).length;
|
|
1661
|
+
const total = passwordChecks.length;
|
|
1662
|
+
return (jsxRuntime.jsxs("div", { className: "mt-2", children: [jsxRuntime.jsx(PasswordStrengthBar, { strength: passed, total: total }), jsxRuntime.jsx("ul", { className: "list-unstyled m-0 d-flex flex-column gap-2", children: passwordChecks.map(({ key, regex, text }) => (jsxRuntime.jsx(PasswordCheckItem, { password: password, regex: regex, text: text }, key))) })] }));
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
const DEFAULT_VALIDATION_MESSAGES = {
|
|
1666
|
+
number: 'At least one number',
|
|
1667
|
+
lowercaseLetter: 'At least one lowercase letter',
|
|
1668
|
+
uppercaseLetter: 'At least one uppercase letter',
|
|
1669
|
+
especialChar: 'At least one of these special characters: ~!@#$^*-_=[]{}|;,.?',
|
|
1670
|
+
notMatch: 'The password confirmation and the new password do not match.',
|
|
1671
|
+
};
|
|
1672
|
+
const DEFAULT_ENABLED_CHECKS = ['uppercase', 'lowercase', 'number', 'specialChar'];
|
|
1673
|
+
function DPasswordStrengthMeter({ id, label = 'Password', placeholder, value = '', name, disabled = false, invalid = false, validationMessages = DEFAULT_VALIDATION_MESSAGES, enabledChecks = DEFAULT_ENABLED_CHECKS, className, style, dataAttributes, onChange, }) {
|
|
1674
|
+
const [password, setPassword] = React.useState(value);
|
|
1675
|
+
React.useEffect(() => {
|
|
1676
|
+
setPassword(value);
|
|
1677
|
+
}, [value]);
|
|
1678
|
+
const handleChange = (newValue) => {
|
|
1679
|
+
setPassword(newValue);
|
|
1680
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
1681
|
+
};
|
|
1682
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: className, style: style }, dataAttributes, { children: [jsxRuntime.jsx(ForwardedDInputPassword, { id: id, label: label, placeholder: placeholder, value: password, name: name, disabled: disabled, invalid: invalid, onChange: handleChange }), jsxRuntime.jsx(PasswordChecksList, { password: password, validationMessages: validationMessages, enabledChecks: enabledChecks })] })));
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
function DInputPin({ id: idProp, label = '', placeholder, type = 'text', disabled = false, loading = false, secret = false, characters = 4, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, dataAttributes, onChange, }) {
|
|
1493
1686
|
const innerId = React.useId();
|
|
1494
1687
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1495
1688
|
const [pattern, setPattern] = React.useState('');
|
|
@@ -1522,7 +1715,8 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1522
1715
|
}
|
|
1523
1716
|
if (input.value !== '') {
|
|
1524
1717
|
setActiveInput((prev) => {
|
|
1525
|
-
const newValue = prev
|
|
1718
|
+
const newValue = [...prev];
|
|
1719
|
+
newValue[index] = input.value;
|
|
1526
1720
|
return newValue;
|
|
1527
1721
|
});
|
|
1528
1722
|
if (input.nextSibling) {
|
|
@@ -1538,7 +1732,8 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1538
1732
|
if (key === 'Backspace') {
|
|
1539
1733
|
const { value } = currentTarget;
|
|
1540
1734
|
setActiveInput((prev) => {
|
|
1541
|
-
const newVal = prev
|
|
1735
|
+
const newVal = [...prev];
|
|
1736
|
+
newVal[index] = '';
|
|
1542
1737
|
return newVal;
|
|
1543
1738
|
});
|
|
1544
1739
|
if (currentTarget.previousSibling && value === '') {
|
|
@@ -1551,19 +1746,23 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1551
1746
|
}
|
|
1552
1747
|
}, []);
|
|
1553
1748
|
const focusInput = React.useCallback((index) => {
|
|
1554
|
-
setActiveInput((prev) =>
|
|
1749
|
+
setActiveInput((prev) => {
|
|
1750
|
+
const newVal = [...prev];
|
|
1751
|
+
newVal[index] = '';
|
|
1752
|
+
return newVal;
|
|
1753
|
+
});
|
|
1555
1754
|
}, []);
|
|
1556
1755
|
const wheelInput = React.useCallback((event) => {
|
|
1557
1756
|
event.currentTarget.blur();
|
|
1558
1757
|
}, []);
|
|
1559
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('d-input-pin', className), style: style }, dataAttributes, { children: [label && (jsxRuntime.
|
|
1758
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('d-input-pin', className), style: style }, dataAttributes, { children: [label && (jsxRuntime.jsx("label", { htmlFor: "pinIndex0", children: label })), jsxRuntime.jsxs("div", { className: "d-input-pin-group", id: id, children: [Array.from({ length: characters }).map((_, index) => (jsxRuntime.jsx("input", Object.assign({ className: classNames({
|
|
1560
1759
|
'form-control': true,
|
|
1561
1760
|
'is-invalid': invalid,
|
|
1562
1761
|
'is-valid': valid,
|
|
1563
1762
|
}), value: activeInput[index], type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onInput: (event) => nextInput(event, index), onKeyDown: (event) => prevInput(event, index), onFocus: () => focusInput(index), onWheel: wheelInput, onClick: (event) => event.preventDefault(), onPaste: (event) => handlePaste(event), autoComplete: "off", placeholder: placeholder, disabled: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), loading && (jsxRuntime.jsx("div", { className: "input-group-text", 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 }))] })));
|
|
1564
1763
|
}
|
|
1565
1764
|
|
|
1566
|
-
function DInputSelect({ id: idProp, name, label = '', className, style, options = [],
|
|
1765
|
+
function DInputSelect({ id: idProp, name, label = '', className, style, options = [], disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, size, floatingLabel = false, invalid = false, valid = false, dataAttributes, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
|
|
1567
1766
|
const innerId = React.useId();
|
|
1568
1767
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1569
1768
|
const internalValueExtractor = React.useCallback((option) => {
|
|
@@ -1631,12 +1830,9 @@ function DInputSelect({ id: idProp, name, label = '', className, style, options
|
|
|
1631
1830
|
valid,
|
|
1632
1831
|
size,
|
|
1633
1832
|
]);
|
|
1634
|
-
const labelComponent = React.useMemo(() => (jsxRuntime.
|
|
1833
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsx("label", { htmlFor: id, children: label })), [
|
|
1635
1834
|
id,
|
|
1636
1835
|
label,
|
|
1637
|
-
labelIcon,
|
|
1638
|
-
labelIconFamilyClass,
|
|
1639
|
-
labelIconFamilyPrefix,
|
|
1640
1836
|
]);
|
|
1641
1837
|
const dynamicComponent = React.useMemo(() => {
|
|
1642
1838
|
if (floatingLabel) {
|
|
@@ -1649,7 +1845,7 @@ function DInputSelect({ id: idProp, name, label = '', className, style, options
|
|
|
1649
1845
|
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: disabled || loading, "aria-label": iconStartAriaLabel, children: iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), dynamicComponent, iconEnd && !loading && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: disabled || loading, "aria-label": iconEndAriaLabel, children: iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text form-control-icon loading", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
1650
1846
|
}
|
|
1651
1847
|
|
|
1652
|
-
function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, invalid = false, valid = false, readonly, className, style, dataAttributes, onChange, }) {
|
|
1848
|
+
function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, invalid = false, valid = false, readonly, className, style, dataAttributes, inputClassName, onChange, }) {
|
|
1653
1849
|
const innerId = React.useId();
|
|
1654
1850
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1655
1851
|
const [internalIsChecked, setInternalIsChecked] = React.useState(checked);
|
|
@@ -1661,10 +1857,10 @@ function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, i
|
|
|
1661
1857
|
setInternalIsChecked(value);
|
|
1662
1858
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
1663
1859
|
}, [onChange]);
|
|
1664
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className:
|
|
1860
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('form-check', className) }, dataAttributes, { children: [jsxRuntime.jsx("input", { id: id, name: name, onChange: readonly ? () => false : changeHandler, className: classNames('form-check-input', {
|
|
1665
1861
|
'is-invalid': invalid,
|
|
1666
1862
|
'is-valid': valid,
|
|
1667
|
-
},
|
|
1863
|
+
}, inputClassName), 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 }))] })));
|
|
1668
1864
|
}
|
|
1669
1865
|
|
|
1670
1866
|
function DInputRange(_a, ref) {
|
|
@@ -1704,38 +1900,7 @@ function DInputRange(_a, ref) {
|
|
|
1704
1900
|
const ForwardedDInputRange = React.forwardRef(DInputRange);
|
|
1705
1901
|
ForwardedDInputRange.displayName = 'DInputRange';
|
|
1706
1902
|
|
|
1707
|
-
|
|
1708
|
-
* @deprecated Please use DListGroup.Item or DListGroupItem instead
|
|
1709
|
-
*/
|
|
1710
|
-
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
1711
|
-
const Tag = React.useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
1712
|
-
return (jsxRuntime.jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
1713
|
-
onClick,
|
|
1714
|
-
type: 'button',
|
|
1715
|
-
}, { className: classNames('list-group-item list-group-item-action', theme ? `list-group-item-${theme}` : undefined, className, {
|
|
1716
|
-
active,
|
|
1717
|
-
disabled,
|
|
1718
|
-
}), style: style }, active && { 'aria-current': true }, { children: children })));
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
/**
|
|
1722
|
-
* @deprecated Please use DListGroup instead
|
|
1723
|
-
*/
|
|
1724
|
-
function DList({ children, className, style, flush = false, numbered = false, horizontal = false, horizontalBreakpoint, dataAttributes, }) {
|
|
1725
|
-
if (flush && horizontal) {
|
|
1726
|
-
throw new Error("Horizontal and Flush props don't work together");
|
|
1727
|
-
}
|
|
1728
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('list-group', {
|
|
1729
|
-
'list-group-flush': flush && !horizontal,
|
|
1730
|
-
'list-group-numbered': numbered,
|
|
1731
|
-
'list-group-horizontal': horizontal && !horizontalBreakpoint,
|
|
1732
|
-
}, (horizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className), style: style }, dataAttributes, { children: children })));
|
|
1733
|
-
}
|
|
1734
|
-
var DList$1 = Object.assign(DList, {
|
|
1735
|
-
Item: DListItem,
|
|
1736
|
-
});
|
|
1737
|
-
|
|
1738
|
-
function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href, onClick, theme, children, className, style, dataAttributes, }) {
|
|
1903
|
+
function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href, onClick, color, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, children, className, style, dataAttributes, }) {
|
|
1739
1904
|
const Tag = React.useMemo(() => {
|
|
1740
1905
|
if (href) {
|
|
1741
1906
|
return 'a';
|
|
@@ -1754,20 +1919,20 @@ function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href,
|
|
|
1754
1919
|
const generateClasses = React.useMemo(() => ({
|
|
1755
1920
|
'list-group-item': true,
|
|
1756
1921
|
'list-group-item-action': action,
|
|
1757
|
-
[`list-group-item-${
|
|
1922
|
+
[`list-group-item-${color}`]: !!color,
|
|
1758
1923
|
active,
|
|
1759
1924
|
disabled,
|
|
1760
|
-
}), [action, active, disabled,
|
|
1925
|
+
}), [action, active, disabled, color]);
|
|
1761
1926
|
const ariaAttributes = React.useMemo(() => {
|
|
1762
1927
|
if (Tag === 'button') {
|
|
1763
1928
|
return Object.assign(Object.assign({}, active && { 'aria-current': true }), disabled && { disabled: true });
|
|
1764
1929
|
}
|
|
1765
1930
|
return Object.assign(Object.assign({}, active && { 'aria-current': true }), disabled && { 'aria-disabled': true });
|
|
1766
1931
|
}, [Tag, active, disabled]);
|
|
1767
|
-
return (jsxRuntime.
|
|
1932
|
+
return (jsxRuntime.jsxs(Tag, Object.assign({ className: classNames(generateClasses, className), style: style }, Tag === 'a' && href && { href }, onClick && { onClick }, ariaAttributes, dataAttributes, Tag === 'button' && { type: 'button' }, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })), children, iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle, className: "ms-auto" }))] })));
|
|
1768
1933
|
}
|
|
1769
1934
|
|
|
1770
|
-
function DListGroup({ as = 'ul', numbered, flush, horizontal, children, className, style, dataAttributes, }) {
|
|
1935
|
+
function DListGroup$1({ as = 'ul', numbered, flush, horizontal, children, className, style, dataAttributes, }) {
|
|
1771
1936
|
const Tag = React.useMemo(() => {
|
|
1772
1937
|
if (numbered) {
|
|
1773
1938
|
return 'ol';
|
|
@@ -1787,7 +1952,7 @@ function DListGroup({ as = 'ul', numbered, flush, horizontal, children, classNam
|
|
|
1787
1952
|
}, [flush, horizontal, numbered]);
|
|
1788
1953
|
return (jsxRuntime.jsx(Tag, Object.assign({ className: classNames(generateClasses, className), style: style }, dataAttributes, { children: children })));
|
|
1789
1954
|
}
|
|
1790
|
-
var DListGroup
|
|
1955
|
+
var DListGroup = Object.assign(DListGroup$1, {
|
|
1791
1956
|
Item: DListGroupItem,
|
|
1792
1957
|
});
|
|
1793
1958
|
|
|
@@ -1809,7 +1974,11 @@ function DModalFooter({ className, style, actionPlacement, children, }) {
|
|
|
1809
1974
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "d-modal-separator" }), jsxRuntime.jsx("div", { className: classNames(generateClasses, className), style: style, children: children })] }));
|
|
1810
1975
|
}
|
|
1811
1976
|
|
|
1812
|
-
|
|
1977
|
+
const defaultTransition$1 = {
|
|
1978
|
+
ease: 'easeInOut',
|
|
1979
|
+
duration: 0.3,
|
|
1980
|
+
};
|
|
1981
|
+
function DModal$1({ name, className, style, staticBackdrop, scrollable, centered, fullScreen, fullScreenFrom, size, transition, children, dataAttributes, }) {
|
|
1813
1982
|
const fullScreenClass = React.useMemo(() => {
|
|
1814
1983
|
if (fullScreen) {
|
|
1815
1984
|
if (fullScreenFrom) {
|
|
@@ -1820,12 +1989,12 @@ function DModal({ name, className, style, staticBackdrop, scrollable, centered,
|
|
|
1820
1989
|
return '';
|
|
1821
1990
|
}, [fullScreenFrom, fullScreen]);
|
|
1822
1991
|
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]);
|
|
1823
|
-
return (jsxRuntime.jsx(
|
|
1992
|
+
return (jsxRuntime.jsx(framerMotion.motion.div, Object.assign({ className: classNames('modal portal show', className), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style, initial: { opacity: 0, scale: 0.95 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.95 }, transition: Object.assign(Object.assign({}, (transition !== null && transition !== void 0 ? transition : defaultTransition$1)), { delay: 0.15 }) }, staticBackdrop && ({
|
|
1824
1993
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
1825
1994
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
1826
1995
|
}), dataAttributes, { children: jsxRuntime.jsx("div", { className: classNames(generateModalDialogClasses), children: jsxRuntime.jsx("div", { className: "modal-content", children: children }) }) })));
|
|
1827
1996
|
}
|
|
1828
|
-
var DModal
|
|
1997
|
+
var DModal = Object.assign(DModal$1, {
|
|
1829
1998
|
Header: DModalHeader,
|
|
1830
1999
|
Body: DModalBody,
|
|
1831
2000
|
Footer: DModalFooter,
|
|
@@ -1849,10 +2018,36 @@ function DOffcanvasFooter({ actionPlacement, children, className, style, }) {
|
|
|
1849
2018
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "d-offcanvas-separator" }), jsxRuntime.jsx("div", { className: classNames(generateClasses, className), style: style, children: children })] }));
|
|
1850
2019
|
}
|
|
1851
2020
|
|
|
1852
|
-
|
|
1853
|
-
|
|
2021
|
+
const variants = {
|
|
2022
|
+
hidden: (openFrom) => {
|
|
2023
|
+
const properties = {};
|
|
2024
|
+
if (openFrom === 'start') {
|
|
2025
|
+
properties.x = '-100%';
|
|
2026
|
+
}
|
|
2027
|
+
if (openFrom === 'end') {
|
|
2028
|
+
properties.x = '100%';
|
|
2029
|
+
}
|
|
2030
|
+
if (openFrom === 'top') {
|
|
2031
|
+
properties.y = '-100%';
|
|
2032
|
+
}
|
|
2033
|
+
if (openFrom === 'bottom') {
|
|
2034
|
+
properties.y = '100%';
|
|
2035
|
+
}
|
|
2036
|
+
return properties;
|
|
2037
|
+
},
|
|
2038
|
+
visible: {
|
|
2039
|
+
x: 0,
|
|
2040
|
+
y: 0,
|
|
2041
|
+
},
|
|
2042
|
+
};
|
|
2043
|
+
const defaultTransition = {
|
|
2044
|
+
ease: 'easeInOut',
|
|
2045
|
+
duration: 0.3,
|
|
2046
|
+
};
|
|
2047
|
+
function DOffcanvas$1({ name, className, style, staticBackdrop, scrollable, openFrom = 'end', transition, children, dataAttributes, }) {
|
|
2048
|
+
return (jsxRuntime.jsx(framerMotion.motion.div, Object.assign({ className: classNames('offcanvas portal show', {
|
|
1854
2049
|
[`offcanvas-${openFrom}`]: openFrom,
|
|
1855
|
-
}, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, staticBackdrop && ({
|
|
2050
|
+
}, className), style: Object.assign(Object.assign({}, style), { transition: 'none' }), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", custom: openFrom, variants: variants, initial: "hidden", animate: "visible", exit: "hidden", transition: Object.assign(Object.assign({}, (transition !== null && transition !== void 0 ? transition : defaultTransition)), { delay: 0.15 }) }, staticBackdrop && ({
|
|
1856
2051
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
1857
2052
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
1858
2053
|
}), scrollable && ({
|
|
@@ -1860,18 +2055,15 @@ function DOffcanvas({ name, className, style, staticBackdrop, scrollable, openFr
|
|
|
1860
2055
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
1861
2056
|
}), dataAttributes, { children: children })));
|
|
1862
2057
|
}
|
|
1863
|
-
var DOffcanvas
|
|
2058
|
+
var DOffcanvas = Object.assign(DOffcanvas$1, {
|
|
1864
2059
|
Header: DOffcanvasHeader,
|
|
1865
2060
|
Body: DOffcanvasBody,
|
|
1866
2061
|
Footer: DOffcanvasFooter,
|
|
1867
2062
|
});
|
|
1868
2063
|
|
|
1869
2064
|
function DPaginator(_a) {
|
|
1870
|
-
var {
|
|
1871
|
-
|
|
1872
|
-
extraClassName: className,
|
|
1873
|
-
})), [props, page, current, showArrows, className]);
|
|
1874
|
-
return (jsxRuntime.jsx(ResponsivePagination, Object.assign({ navClassName: classNames('page-item-arrow', navClassName) }, backwardCompatibilityProps)));
|
|
2065
|
+
var { navClassName } = _a, props = tslib.__rest(_a, ["navClassName"]);
|
|
2066
|
+
return (jsxRuntime.jsx(ResponsivePagination, Object.assign({ navClassName: classNames('page-item-arrow', navClassName) }, props)));
|
|
1875
2067
|
}
|
|
1876
2068
|
|
|
1877
2069
|
function DPopover({ children, renderComponent, open, setOpen, adjustContentToRender = false, className, style, dataAttributes, }) {
|
|
@@ -1912,115 +2104,14 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
|
|
|
1912
2104
|
}), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] })));
|
|
1913
2105
|
}
|
|
1914
2106
|
|
|
1915
|
-
function DProgress({ className, style, currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, dataAttributes, }) {
|
|
2107
|
+
function DProgress({ className, style, currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, height, dataAttributes, }) {
|
|
1916
2108
|
const percentage = React.useMemo(() => (Math.round((currentValue * 100) / maxValue)), [currentValue, maxValue]);
|
|
1917
2109
|
const formatProgress = React.useMemo(() => `${percentage}%`, [percentage]);
|
|
1918
2110
|
const generateClasses = React.useMemo(() => ({
|
|
1919
2111
|
'progress-bar': true,
|
|
1920
2112
|
'progress-bar-striped progress-bar-animated': enableStripedAnimation,
|
|
1921
2113
|
}), [enableStripedAnimation]);
|
|
1922
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('progress', className) }, dataAttributes, { children: jsxRuntime.jsx("div", { className: classNames(generateClasses), role: "progressbar", "aria-label": "Progress bar", style:
|
|
1923
|
-
}
|
|
1924
|
-
|
|
1925
|
-
function DQuickActionButton({ line1, line2, className, actionIcon, actionIconFamilyClass, actionIconFamilyPrefix, actionIconTheme, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, href, hrefTarget, style, dataAttributes, }) {
|
|
1926
|
-
const Tag = React.useMemo(() => {
|
|
1927
|
-
if (href) {
|
|
1928
|
-
return 'a';
|
|
1929
|
-
}
|
|
1930
|
-
if (onClick) {
|
|
1931
|
-
return 'button';
|
|
1932
|
-
}
|
|
1933
|
-
return 'div';
|
|
1934
|
-
}, [href, onClick]);
|
|
1935
|
-
const tagProps = React.useMemo(() => {
|
|
1936
|
-
if (href) {
|
|
1937
|
-
return {
|
|
1938
|
-
className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
|
|
1939
|
-
href,
|
|
1940
|
-
target: hrefTarget,
|
|
1941
|
-
};
|
|
1942
|
-
}
|
|
1943
|
-
if (onClick) {
|
|
1944
|
-
return {
|
|
1945
|
-
className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
|
|
1946
|
-
onClick,
|
|
1947
|
-
};
|
|
1948
|
-
}
|
|
1949
|
-
return {
|
|
1950
|
-
className: classNames('d-quick-action-button', className),
|
|
1951
|
-
};
|
|
1952
|
-
}, [
|
|
1953
|
-
className,
|
|
1954
|
-
href,
|
|
1955
|
-
hrefTarget,
|
|
1956
|
-
onClick,
|
|
1957
|
-
]);
|
|
1958
|
-
return (jsxRuntime.jsxs(Tag, Object.assign({ style: style }, tagProps, dataAttributes, { children: [representativeIcon && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-representative-icon", size: representativeIconHasCircle
|
|
1959
|
-
? `var(--${PREFIX_BS}quick-action-button-representative-icon-size)`
|
|
1960
|
-
: `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsxRuntime.jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsxRuntime.jsx("div", { className: "d-quick-action-button-content", children: jsxRuntime.jsxs("div", { className: "d-quick-action-button-text", children: [jsxRuntime.jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsxRuntime.jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), actionIcon && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-action-icon", icon: actionIcon, size: `var(--${PREFIX_BS}quick-action-button-action-icon-size)`, theme: actionIconTheme, familyClass: actionIconFamilyClass, familyPrefix: actionIconFamilyPrefix }))] })));
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
/**
|
|
1964
|
-
* @deprecated
|
|
1965
|
-
*/
|
|
1966
|
-
function DQuickActionCheck({ id: idProp, name, value, line1, line2, line3, className, style, checked, dataAttributes, onChange, }) {
|
|
1967
|
-
const innerId = React.useId();
|
|
1968
|
-
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1969
|
-
const changeHandler = React.useCallback((event) => {
|
|
1970
|
-
event.stopPropagation();
|
|
1971
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1972
|
-
}, [onChange]);
|
|
1973
|
-
return (jsxRuntime.jsxs("label", Object.assign({ className: classNames('d-quick-action-check', className), htmlFor: id, style: style }, dataAttributes, { children: [jsxRuntime.jsx(DInputCheck, { id: id, type: "radio", name: name, value: value, checked: checked, onChange: changeHandler }), jsxRuntime.jsxs("div", { className: "d-quick-action-check-detail", children: [jsxRuntime.jsx("span", { className: "d-quick-action-check-line1", children: line1 }), jsxRuntime.jsx("span", { className: "d-quick-action-check-line2", children: line2 })] }), jsxRuntime.jsx("span", { className: "d-quick-action-check-line3", children: line3 })] })));
|
|
1974
|
-
}
|
|
1975
|
-
|
|
1976
|
-
function DQuickActionSelect({ id: idProp, name, value, line1, line2, className, style, selected = false, dataAttributes, onChange, }) {
|
|
1977
|
-
const innerRef = React.useRef(null);
|
|
1978
|
-
const innerId = React.useId();
|
|
1979
|
-
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1980
|
-
const changeHandler = React.useCallback((event) => {
|
|
1981
|
-
event.stopPropagation();
|
|
1982
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1983
|
-
}, [onChange]);
|
|
1984
|
-
React.useEffect(() => {
|
|
1985
|
-
if (innerRef.current) {
|
|
1986
|
-
innerRef.current.checked = selected;
|
|
1987
|
-
}
|
|
1988
|
-
}, [selected]);
|
|
1989
|
-
return (jsxRuntime.jsxs("label", Object.assign({ className: classNames('d-quick-action-select', className), htmlFor: id, style: style }, dataAttributes, { children: [jsxRuntime.jsx("input", { ref: innerRef, id: id, type: "radio", name: name, value: value, onChange: changeHandler }), jsxRuntime.jsx("span", { className: "d-quick-action-select-line1", children: line1 }), jsxRuntime.jsx("span", { className: "d-quick-action-select-line2", children: line2 })] })));
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
/**
|
|
1993
|
-
* @deprecated
|
|
1994
|
-
*/
|
|
1995
|
-
function DQuickActionSwitch({ id: idProp, name, label, hint, checked, disabled, className, style, dataAttributes, onClick, }) {
|
|
1996
|
-
const innerId = React.useId();
|
|
1997
|
-
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1998
|
-
const clickHandler = React.useCallback((event) => {
|
|
1999
|
-
event.stopPropagation();
|
|
2000
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
2001
|
-
}, [checked, onClick]);
|
|
2002
|
-
return (jsxRuntime.jsxs("button", Object.assign({ className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style }, dataAttributes, { 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 })] })));
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
|
-
/**
|
|
2006
|
-
* @deprecated Please use https://getbootstrap.com/docs/5.3/components/placeholders/ instead
|
|
2007
|
-
*/
|
|
2008
|
-
function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
|
|
2009
|
-
const innerBackgroundColor = React.useMemo(() => {
|
|
2010
|
-
if (backgroundColor) {
|
|
2011
|
-
return backgroundColor;
|
|
2012
|
-
}
|
|
2013
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
2014
|
-
return computedStyle.getPropertyValue(`--${PREFIX_BS}secondary-100`);
|
|
2015
|
-
}, [backgroundColor]);
|
|
2016
|
-
const innerForegroundColor = React.useMemo(() => {
|
|
2017
|
-
if (foregroundColor) {
|
|
2018
|
-
return foregroundColor;
|
|
2019
|
-
}
|
|
2020
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
2021
|
-
return computedStyle.getPropertyValue(`--${PREFIX_BS}gray-100`);
|
|
2022
|
-
}, [foregroundColor]);
|
|
2023
|
-
return (jsxRuntime.jsx(ContentLoader, { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
|
|
2114
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('progress', className), style: Object.assign({ height }, style) }, dataAttributes, { children: jsxRuntime.jsx("div", { className: classNames(generateClasses), role: "progressbar", "aria-label": "Progress bar", style: { width: formatProgress }, "aria-valuenow": currentValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, children: !hideCurrentValue && formatProgress }) })));
|
|
2024
2115
|
}
|
|
2025
2116
|
|
|
2026
2117
|
function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, completed, alignStart = false, className, style, }) {
|
|
@@ -2033,13 +2124,13 @@ function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSu
|
|
|
2033
2124
|
'd-stepper-desktop': true,
|
|
2034
2125
|
'is-vertical': vertical,
|
|
2035
2126
|
'is-align-start': alignStart && !vertical,
|
|
2036
|
-
}, className), style: style, children: options.map(({ label, value, description }) => (jsxRuntime.jsxs("div", { className:
|
|
2127
|
+
}, className), style: style, children: options.map(({ label, value, description }) => (jsxRuntime.jsxs("div", { className: classNames({
|
|
2128
|
+
'd-step': true,
|
|
2129
|
+
'd-step-current': value === currentStep && !completed,
|
|
2130
|
+
}), children: [jsxRuntime.jsx("div", { className: "d-step-value", children: jsxRuntime.jsxs("div", { className: classNames({
|
|
2037
2131
|
'd-step-icon-container': true,
|
|
2038
2132
|
'd-step-check': value < currentStep || completed,
|
|
2039
|
-
|
|
2040
|
-
}), children: value < currentStep || completed
|
|
2041
|
-
? (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconSuccessFamilyClass, familyPrefix: iconSuccessFamilyPrefix, materialStyle: iconSuccessMaterialStyle, className: "d-step-icon" }))
|
|
2042
|
-
: value }) }), jsxRuntime.jsxs("div", { className: "d-step-text-container", children: [jsxRuntime.jsx("div", { className: "d-step-label", children: label }), description && (jsxRuntime.jsx("div", { className: "d-step-description", children: description }))] })] }, value))) }));
|
|
2133
|
+
}), children: [((value < currentStep) || completed) && (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconSuccessFamilyClass, familyPrefix: iconSuccessFamilyPrefix, materialStyle: iconSuccessMaterialStyle, className: "d-step-icon" })), value] }) }), jsxRuntime.jsxs("div", { className: "d-step-text-container", children: [jsxRuntime.jsx("div", { className: "d-step-label", children: label }), description && (jsxRuntime.jsx("div", { className: "d-step-description", children: description }))] })] }, value))) }));
|
|
2043
2134
|
}
|
|
2044
2135
|
|
|
2045
2136
|
function DStepper$1({ options, currentStep, className, style, }) {
|
|
@@ -2079,7 +2170,7 @@ function DStepper({ options, currentStep, iconSuccess, iconSuccessFamilyClass, i
|
|
|
2079
2170
|
const ARROW_WIDTH = 8;
|
|
2080
2171
|
const ARROW_HEIGHT = 4;
|
|
2081
2172
|
const GAP = 2;
|
|
2082
|
-
function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false,
|
|
2173
|
+
function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false, placement = 'top', size, Component, children, }) {
|
|
2083
2174
|
const [isOpen, setIsOpen] = React.useState(open);
|
|
2084
2175
|
const arrowRef = React.useRef(null);
|
|
2085
2176
|
const { refs, context, floatingStyles, } = react.useFloating({
|
|
@@ -2110,10 +2201,16 @@ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT +
|
|
|
2110
2201
|
dismiss,
|
|
2111
2202
|
role,
|
|
2112
2203
|
]);
|
|
2113
|
-
const generateClasses = React.useMemo(() => (Object.assign({ 'tooltip show': true, [`tooltip-${size}`]: !!size
|
|
2204
|
+
const generateClasses = React.useMemo(() => (Object.assign({ 'tooltip show': true, [`tooltip-${size}`]: !!size }, className && { [className]: true })), [size, className]);
|
|
2114
2205
|
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 })] }))) })] }));
|
|
2115
2206
|
}
|
|
2116
2207
|
|
|
2208
|
+
function DTimeline({ className, style, dataAttributes, items, }) {
|
|
2209
|
+
return (jsxRuntime.jsx("div", Object.assign({ style: style, className: classNames('d-timeline', className) }, dataAttributes, { children: items.map((item, index) => (jsxRuntime.jsxs("div", { className: classNames('d-timeline-item', {
|
|
2210
|
+
[`d-timeline-item-${item.status}`]: item.status,
|
|
2211
|
+
}), children: [jsxRuntime.jsx("div", { className: "d-timeline-item-connector" }), jsxRuntime.jsx("div", { className: "d-timeline-item-icon", children: jsxRuntime.jsx("i", { className: `bi bi-${item.icon || 'check'}` }) }), jsxRuntime.jsxs("div", { className: "d-timeline-item-content", children: [jsxRuntime.jsx("div", { className: "d-timeline-item-title", children: item.title }), item.description && jsxRuntime.jsx("div", { className: "d-timeline-item-description", children: item.description }), item.time && jsxRuntime.jsx("div", { className: "d-timeline-item-time", children: item.time }), item.children] })] }, index))) })));
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2117
2214
|
const TabContext = React.createContext(undefined);
|
|
2118
2215
|
function useTabContext() {
|
|
2119
2216
|
const context = React.useContext(TabContext);
|
|
@@ -2131,7 +2228,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
2131
2228
|
return (jsxRuntime.jsx("div", { className: classNames('tab-pane fade show active', className), id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab`, style: style, children: children }));
|
|
2132
2229
|
}
|
|
2133
2230
|
|
|
2134
|
-
function DTabs({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', dataAttributes, }) {
|
|
2231
|
+
function DTabs$1({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', dataAttributes, }) {
|
|
2135
2232
|
const [selected, setSelected] = React.useState(defaultSelected);
|
|
2136
2233
|
const onSelect = React.useCallback((option) => {
|
|
2137
2234
|
if (option.tab) {
|
|
@@ -2152,9 +2249,9 @@ function DTabs({ children, defaultSelected, onChange, options, className, classN
|
|
|
2152
2249
|
'flex-column': !vertical || variant === 'tabs',
|
|
2153
2250
|
}), style: style }, dataAttributes, { children: [jsxRuntime.jsx("nav", { className: classNames(generateClasses), children: options.map((option) => (jsxRuntime.jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
2154
2251
|
active: option.tab === selected,
|
|
2155
|
-
}, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.
|
|
2252
|
+
}, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.tab))) }), jsxRuntime.jsx("div", { className: "tab-content w-100", children: children })] })) }));
|
|
2156
2253
|
}
|
|
2157
|
-
var DTabs
|
|
2254
|
+
var DTabs = Object.assign(DTabs$1, {
|
|
2158
2255
|
Tab: DTabContent,
|
|
2159
2256
|
});
|
|
2160
2257
|
|
|
@@ -2166,10 +2263,10 @@ function DToastBody({ children, className, style }) {
|
|
|
2166
2263
|
return (jsxRuntime.jsx("div", { className: classNames('toast-body', className), style: style, children: children }));
|
|
2167
2264
|
}
|
|
2168
2265
|
|
|
2169
|
-
function DToast({ children, className, style, dataAttributes, }) {
|
|
2266
|
+
function DToast$1({ children, className, style, dataAttributes, }) {
|
|
2170
2267
|
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('toast', className), role: "alert", "aria-live": "assertive", "aria-atomic": "true", style: style }, dataAttributes, { children: children })));
|
|
2171
2268
|
}
|
|
2172
|
-
var DToast
|
|
2269
|
+
var DToast = Object.assign(DToast$1, {
|
|
2173
2270
|
Header: DToastHeader,
|
|
2174
2271
|
Body: DToastBody,
|
|
2175
2272
|
});
|
|
@@ -2184,21 +2281,19 @@ function useDToast() {
|
|
|
2184
2281
|
if (typeof data === 'function') {
|
|
2185
2282
|
return reactHotToast.toast.custom(data, toastProps);
|
|
2186
2283
|
}
|
|
2187
|
-
const { title, description, icon, closeIcon, timestamp,
|
|
2284
|
+
const { title, description, icon, closeIcon, timestamp, color, } = data;
|
|
2188
2285
|
return reactHotToast.toast.custom(({ id, visible }) => {
|
|
2189
2286
|
if (!visible) {
|
|
2190
2287
|
return null;
|
|
2191
2288
|
}
|
|
2192
2289
|
if (!description) {
|
|
2193
|
-
return (jsxRuntime.jsx(DToast
|
|
2194
|
-
[`toast-${
|
|
2195
|
-
|
|
2196
|
-
}, 'show'), children: jsxRuntime.jsxs(DToast$1.Body, { children: [icon && (jsxRuntime.jsx(DIcon, { className: "toast-icon", icon: icon })), jsxRuntime.jsx("p", { className: "toast-title", children: title }), jsxRuntime.jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: () => reactHotToast.toast.dismiss(id), children: jsxRuntime.jsx(DIcon, { icon: closeIcon || xLg }) })] }) }));
|
|
2290
|
+
return (jsxRuntime.jsx(DToast, { className: classNames({
|
|
2291
|
+
[`toast-${color}`]: !!color,
|
|
2292
|
+
}, 'show'), children: jsxRuntime.jsxs(DToast.Body, { children: [icon && (jsxRuntime.jsx(DIcon, { className: "toast-icon", icon: icon })), jsxRuntime.jsx("p", { className: "toast-title", children: title }), jsxRuntime.jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: () => reactHotToast.toast.dismiss(id), children: jsxRuntime.jsx(DIcon, { icon: closeIcon || xLg }) })] }) }));
|
|
2197
2293
|
}
|
|
2198
|
-
return (jsxRuntime.jsxs(DToast
|
|
2199
|
-
[`toast-${
|
|
2200
|
-
|
|
2201
|
-
}, 'show'), children: [jsxRuntime.jsxs(DToast$1.Header, { children: [icon && (jsxRuntime.jsx(DIcon, { className: "toast-icon", icon: icon })), jsxRuntime.jsx("p", { className: "toast-title", children: title }), timestamp && (jsxRuntime.jsx("small", { className: "toast-timestamp", children: timestamp })), jsxRuntime.jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: () => reactHotToast.toast.dismiss(id), children: jsxRuntime.jsx(DIcon, { icon: closeIcon || xLg }) })] }), jsxRuntime.jsx(DToast$1.Body, { children: jsxRuntime.jsx("span", { children: description }) })] }));
|
|
2294
|
+
return (jsxRuntime.jsxs(DToast, { className: classNames({
|
|
2295
|
+
[`toast-${color}`]: !!color,
|
|
2296
|
+
}, 'show'), children: [jsxRuntime.jsxs(DToast.Header, { children: [icon && (jsxRuntime.jsx(DIcon, { className: "toast-icon", icon: icon })), jsxRuntime.jsx("p", { className: "toast-title", children: title }), timestamp && (jsxRuntime.jsx("small", { className: "toast-timestamp", children: timestamp })), jsxRuntime.jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: () => reactHotToast.toast.dismiss(id), children: jsxRuntime.jsx(DIcon, { icon: closeIcon || xLg }) })] }), jsxRuntime.jsx(DToast.Body, { children: jsxRuntime.jsx("span", { children: description }) })] }));
|
|
2202
2297
|
}, toastProps);
|
|
2203
2298
|
}, [xLg]);
|
|
2204
2299
|
return {
|
|
@@ -2206,19 +2301,6 @@ function useDToast() {
|
|
|
2206
2301
|
};
|
|
2207
2302
|
}
|
|
2208
2303
|
|
|
2209
|
-
function DTableHead({ className, style, field, label, value = '', onChange, }) {
|
|
2210
|
-
const handleOnChange = React.useCallback(() => {
|
|
2211
|
-
if (value === field) {
|
|
2212
|
-
return onChange(`-${field}`);
|
|
2213
|
-
}
|
|
2214
|
-
if (value === `-${field}`) {
|
|
2215
|
-
return onChange('');
|
|
2216
|
-
}
|
|
2217
|
-
return onChange(field);
|
|
2218
|
-
}, [field, value, onChange]);
|
|
2219
|
-
return (jsxRuntime.jsx("th", { style: style, className: classNames('d-table-head', className), children: jsxRuntime.jsxs("button", { type: "button", onClick: handleOnChange, children: [label, value && value.includes(field) && (jsxRuntime.jsx(DIcon, { icon: value === field ? 'arrow-up' : 'arrow-down' }))] }) }));
|
|
2220
|
-
}
|
|
2221
|
-
|
|
2222
2304
|
async function configureI8n(resources, _a = {}) {
|
|
2223
2305
|
var { lng = 'en', fallbackLng = 'en' } = _a, config = tslib.__rest(_a, ["lng", "fallbackLng"]);
|
|
2224
2306
|
return i18n
|
|
@@ -2268,7 +2350,7 @@ function validatePhoneNumber(phone) {
|
|
|
2268
2350
|
}
|
|
2269
2351
|
|
|
2270
2352
|
function DInputPhone(_a, ref) {
|
|
2271
|
-
var { id: idProp, style, className, label = '',
|
|
2353
|
+
var { id: idProp, style, className, label = '', disabled = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconEnd, iconEndDisabled, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, iconEndMaterialStyle, hint, size, invalid = false, valid = false, floatingLabel = false, inputEnd, value, placeholder = '', dataAttributes, onChange, onIconEndClick, countrySelectorProps, filteredCountries, defaultCountry = 'cl' } = _a, inputProps = tslib.__rest(_a, ["id", "style", "className", "label", "disabled", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "iconEnd", "iconEndDisabled", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "iconEndMaterialStyle", "hint", "size", "invalid", "valid", "floatingLabel", "inputEnd", "value", "placeholder", "dataAttributes", "onChange", "onIconEndClick", "countrySelectorProps", "filteredCountries", "defaultCountry"]);
|
|
2272
2354
|
const innerRef = useProvidedRefOrCreate(ref);
|
|
2273
2355
|
const innerId = React.useId();
|
|
2274
2356
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
@@ -2327,13 +2409,9 @@ function DInputPhone(_a, ref) {
|
|
|
2327
2409
|
placeholder,
|
|
2328
2410
|
valid,
|
|
2329
2411
|
]);
|
|
2330
|
-
const labelComponent = React.useMemo(() => (jsxRuntime.
|
|
2412
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsx("label", { htmlFor: id, children: label })), [
|
|
2331
2413
|
id,
|
|
2332
2414
|
label,
|
|
2333
|
-
labelIcon,
|
|
2334
|
-
labelIconFamilyClass,
|
|
2335
|
-
labelIconFamilyPrefix,
|
|
2336
|
-
labelIconMaterialStyle,
|
|
2337
2415
|
]);
|
|
2338
2416
|
const dynamicComponent = React.useMemo(() => {
|
|
2339
2417
|
if (floatingLabel) {
|
|
@@ -2354,69 +2432,243 @@ function DInputPhone(_a, ref) {
|
|
|
2354
2432
|
const ForwardedDInputPhone = React.forwardRef(DInputPhone);
|
|
2355
2433
|
ForwardedDInputPhone.displayName = 'DInputPhone';
|
|
2356
2434
|
|
|
2435
|
+
const DEFAULT_IMAGE = 'https://cdn.modyo.cloud/uploads/06b434f7-b943-4f54-9543-84a904e189aa/original/Visa_Logo_1_.png';
|
|
2436
|
+
const CHIP_IMAGE = 'https://cdn.modyo.cloud/uploads/4660ad00-e5d8-477e-8919-52b53d0a26fb/original/chip-debit-svgrepo-com_1_.png';
|
|
2437
|
+
function DCreditCard({ brand = 'visa', name, number, holderText = 'Card Holder', logoImage, isChipVisible = true, className, isVertical = false, }) {
|
|
2438
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-credit-card overflow-hidden text-white', 'position-relative rounded-3', 'd-none d-lg-flex', isVertical && 'is-vertical', className), children: [jsxRuntime.jsxs("div", { className: "d-credit-card-header", children: [jsxRuntime.jsx("img", { src: logoImage || DEFAULT_IMAGE, alt: brand, className: "d-credit-card-logo", width: 100 }), isChipVisible && (jsxRuntime.jsx("div", { className: "d-credit-card-chip p-2 rounded-2", children: jsxRuntime.jsx("img", { src: CHIP_IMAGE, alt: "chip", width: 30, className: "d-credit-card-chip-image" }) }))] }), jsxRuntime.jsxs("div", { className: "d-credit-card-details mt-auto d-none d-sm-block", children: [jsxRuntime.jsx("div", { className: "d-credit-card-number d-none d-sm-block mb-4", children: number }), jsxRuntime.jsx("small", { className: "d-block opacity-50", children: holderText }), jsxRuntime.jsx("span", { className: "name", children: name })] })] }));
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
const getItemClass = (action) => {
|
|
2442
|
+
const base = `dropdown-item d-flex align-items-center
|
|
2443
|
+
${action.color ? `dropdown-item-${action.color}` : ''} ${action.disabled ? 'disabled' : ''}`;
|
|
2444
|
+
return base;
|
|
2445
|
+
};
|
|
2446
|
+
function DDropdown({ actions, dropdownToggle, className, }) {
|
|
2447
|
+
const [open, setOpen] = React.useState(false);
|
|
2448
|
+
const dropdownRef = React.useRef(null);
|
|
2449
|
+
const [position, setPosition] = React.useState('down'); // 🆕
|
|
2450
|
+
// Cerrar al hacer click fuera
|
|
2451
|
+
React.useEffect(() => {
|
|
2452
|
+
const handleClickOutside = (event) => {
|
|
2453
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
2454
|
+
setOpen(false);
|
|
2455
|
+
}
|
|
2456
|
+
};
|
|
2457
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
2458
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
2459
|
+
}, []);
|
|
2460
|
+
// 🆕 Calcular posición del menú al abrir
|
|
2461
|
+
React.useEffect(() => {
|
|
2462
|
+
if (open && dropdownRef.current) {
|
|
2463
|
+
const rect = dropdownRef.current.getBoundingClientRect();
|
|
2464
|
+
const spaceBottom = window.innerHeight - rect.bottom;
|
|
2465
|
+
const spaceRight = window.innerWidth - rect.right;
|
|
2466
|
+
if (spaceBottom < 150) {
|
|
2467
|
+
setPosition('up');
|
|
2468
|
+
}
|
|
2469
|
+
else if (spaceRight < 150) {
|
|
2470
|
+
setPosition('start');
|
|
2471
|
+
}
|
|
2472
|
+
else {
|
|
2473
|
+
setPosition('down');
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
}, [open]);
|
|
2477
|
+
let ToggleElement;
|
|
2478
|
+
if (dropdownToggle) {
|
|
2479
|
+
if (typeof dropdownToggle === 'function') {
|
|
2480
|
+
ToggleElement = dropdownToggle({ open, toggle: () => setOpen(!open) });
|
|
2481
|
+
}
|
|
2482
|
+
else {
|
|
2483
|
+
ToggleElement = dropdownToggle;
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
else {
|
|
2487
|
+
ToggleElement = (jsxRuntime.jsx(DButtonIcon, { variant: "link", stopPropagationEnabled: false, onClick: () => setOpen(!open), icon: "MoreVertical" }));
|
|
2488
|
+
}
|
|
2489
|
+
return (jsxRuntime.jsxs("div", { className: `dropdown position-relative drop-${position} ${className}`, ref: dropdownRef, children: [ToggleElement, jsxRuntime.jsx("ul", { style: {
|
|
2490
|
+
position: 'absolute',
|
|
2491
|
+
top: position === 'up' ? 'auto' : '100%',
|
|
2492
|
+
bottom: position === 'up' ? '100%' : 'auto',
|
|
2493
|
+
left: position === 'start' ? 'auto' : 0,
|
|
2494
|
+
right: position === 'start' ? '0' : 'auto',
|
|
2495
|
+
transform: 'translateY(4px)',
|
|
2496
|
+
}, className: `dropdown-menu p-2 ${open ? 'show' : ''}`, children: actions.map((action, index) => {
|
|
2497
|
+
if (action.isDivider) {
|
|
2498
|
+
return (jsxRuntime.jsx("hr", { className: "dropdown-divider" }, index));
|
|
2499
|
+
}
|
|
2500
|
+
return (jsxRuntime.jsx("li", { children: action.href ? (jsxRuntime.jsxs("a", { className: getItemClass(action), href: action.href, onClick: (e) => {
|
|
2501
|
+
if (action.disabled) {
|
|
2502
|
+
e.preventDefault();
|
|
2503
|
+
}
|
|
2504
|
+
else {
|
|
2505
|
+
setOpen(false);
|
|
2506
|
+
}
|
|
2507
|
+
}, children: [action.icon && (jsxRuntime.jsx(DIcon, { icon: action.icon, className: "me-2", size: "1rem" })), action.label] })) : (jsxRuntime.jsxs("button", { className: getItemClass(action), type: "button", onClick: () => {
|
|
2508
|
+
var _a;
|
|
2509
|
+
if (!action.disabled) {
|
|
2510
|
+
(_a = action.onClick) === null || _a === void 0 ? void 0 : _a.call(action);
|
|
2511
|
+
setOpen(false);
|
|
2512
|
+
}
|
|
2513
|
+
}, disabled: action.disabled, children: [action.icon && (jsxRuntime.jsx(DIcon, { icon: action.icon, className: "me-2", size: "1rem" })), action.label] })) }, index));
|
|
2514
|
+
}) })] }));
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
function useScreenshot() {
|
|
2518
|
+
const clipRef = React.useRef(null);
|
|
2519
|
+
const takeBlob = React.useCallback(async (type) => {
|
|
2520
|
+
if (!clipRef.current) {
|
|
2521
|
+
throw new Error('set the clipRef');
|
|
2522
|
+
}
|
|
2523
|
+
const canvas = await html2canvas(clipRef === null || clipRef === void 0 ? void 0 : clipRef.current, {
|
|
2524
|
+
allowTaint: true,
|
|
2525
|
+
useCORS: true,
|
|
2526
|
+
});
|
|
2527
|
+
return (new Promise((resolve, reject) => {
|
|
2528
|
+
canvas.toBlob((innerBlob) => {
|
|
2529
|
+
if (!innerBlob) {
|
|
2530
|
+
return reject();
|
|
2531
|
+
}
|
|
2532
|
+
return resolve(innerBlob);
|
|
2533
|
+
}, type);
|
|
2534
|
+
}));
|
|
2535
|
+
}, []);
|
|
2536
|
+
return {
|
|
2537
|
+
clipRef,
|
|
2538
|
+
takeBlob,
|
|
2539
|
+
};
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
function useScreenshotDownload() {
|
|
2543
|
+
const { clipRef, takeBlob } = useScreenshot();
|
|
2544
|
+
const download = React.useCallback(async () => {
|
|
2545
|
+
const blob = await takeBlob();
|
|
2546
|
+
const url = window.URL.createObjectURL(blob);
|
|
2547
|
+
const link = window.document.createElement('a');
|
|
2548
|
+
link.style.display = 'none';
|
|
2549
|
+
link.href = url;
|
|
2550
|
+
link.download = 'voucher.jpg';
|
|
2551
|
+
document.body.appendChild(link);
|
|
2552
|
+
link.click();
|
|
2553
|
+
document.body.removeChild(link);
|
|
2554
|
+
window.URL.revokeObjectURL(url);
|
|
2555
|
+
}, [takeBlob]);
|
|
2556
|
+
return {
|
|
2557
|
+
download,
|
|
2558
|
+
downloadRef: clipRef,
|
|
2559
|
+
};
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
function useScreenshotWebShare() {
|
|
2563
|
+
const { takeBlob, clipRef } = useScreenshot();
|
|
2564
|
+
const share = React.useCallback(async () => {
|
|
2565
|
+
const blob = await takeBlob();
|
|
2566
|
+
const image = new File([blob], 'voucher.jpeg', { type: 'image/jpeg' });
|
|
2567
|
+
if (!navigator.canShare
|
|
2568
|
+
&& (navigator.canShare && !navigator.canShare({ files: [image] }))) {
|
|
2569
|
+
window.print();
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2572
|
+
await navigator.share({ files: [image] });
|
|
2573
|
+
}, [takeBlob]);
|
|
2574
|
+
return {
|
|
2575
|
+
share,
|
|
2576
|
+
shareRef: clipRef,
|
|
2577
|
+
};
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
function DVoucher({ amount, amountDetails, icon = 'CircleCheckBig', color = 'success', title, onError, message, downloadText = 'Download', shareText = 'Share', children, }) {
|
|
2581
|
+
const { shareRef, share } = useScreenshotWebShare();
|
|
2582
|
+
const { downloadRef, download } = useScreenshotDownload();
|
|
2583
|
+
const handleShare = () => {
|
|
2584
|
+
share()
|
|
2585
|
+
.catch(async (err) => {
|
|
2586
|
+
if (onError) {
|
|
2587
|
+
await onError(err);
|
|
2588
|
+
}
|
|
2589
|
+
})
|
|
2590
|
+
.catch(() => {
|
|
2591
|
+
// Error already handled by onError
|
|
2592
|
+
});
|
|
2593
|
+
};
|
|
2594
|
+
const handleDownload = () => {
|
|
2595
|
+
download()
|
|
2596
|
+
.catch(async (err) => {
|
|
2597
|
+
if (onError) {
|
|
2598
|
+
await onError(err);
|
|
2599
|
+
}
|
|
2600
|
+
})
|
|
2601
|
+
.catch(() => {
|
|
2602
|
+
// Error already handled by onError
|
|
2603
|
+
});
|
|
2604
|
+
};
|
|
2605
|
+
return (jsxRuntime.jsx("div", { className: "d-voucher", ref: (el) => {
|
|
2606
|
+
shareRef.current = el;
|
|
2607
|
+
downloadRef.current = el;
|
|
2608
|
+
}, children: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "d-voucher-header", children: [jsxRuntime.jsx(DIcon, { icon: icon, color: color }), jsxRuntime.jsxs("div", { className: "text-center", children: [jsxRuntime.jsx("h3", { className: "mb-2", children: title }), jsxRuntime.jsx("p", { className: "m-0", children: message })] })] }), amount && (jsxRuntime.jsxs("div", { className: "d-voucher-amount", children: [jsxRuntime.jsx("div", { className: classNames('text-center fw-bold fs-3', amountDetails ? 'mb-1' : 'm-0'), children: amount }), amountDetails] })), jsxRuntime.jsx("hr", { className: "my-4" }), children, jsxRuntime.jsx("hr", { className: "my-4" }), jsxRuntime.jsxs("div", { className: "d-voucher-footer", children: [jsxRuntime.jsx(DButton, { onClick: handleShare, iconStart: "Share2", text: shareText, variant: "outline", size: "sm" }), jsxRuntime.jsx(DButton, { onClick: handleDownload, iconStart: "Download", text: downloadText, variant: "outline", size: "sm" })] })] }) }));
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2357
2611
|
exports.DAlert = DAlert;
|
|
2358
2612
|
exports.DAvatar = DAvatar;
|
|
2359
2613
|
exports.DBadge = DBadge;
|
|
2614
|
+
exports.DBox = DBox;
|
|
2360
2615
|
exports.DBoxFile = DBoxFile;
|
|
2361
2616
|
exports.DButton = DButton;
|
|
2362
2617
|
exports.DButtonIcon = DButtonIcon;
|
|
2363
|
-
exports.DCard = DCard
|
|
2618
|
+
exports.DCard = DCard;
|
|
2364
2619
|
exports.DCardBody = DCardBody;
|
|
2365
2620
|
exports.DCardFooter = DCardFooter;
|
|
2366
2621
|
exports.DCardHeader = DCardHeader;
|
|
2367
|
-
exports.DCarousel = DCarousel
|
|
2622
|
+
exports.DCarousel = DCarousel;
|
|
2368
2623
|
exports.DCarouselSlide = DCarouselSlide;
|
|
2369
2624
|
exports.DChip = DChip;
|
|
2370
2625
|
exports.DCollapse = DCollapse;
|
|
2371
2626
|
exports.DContext = DContext;
|
|
2372
2627
|
exports.DContextProvider = DContextProvider;
|
|
2628
|
+
exports.DCreditCard = DCreditCard;
|
|
2373
2629
|
exports.DCurrencyText = DCurrencyText;
|
|
2374
2630
|
exports.DDatePicker = DDatePicker;
|
|
2631
|
+
exports.DDropdown = DDropdown;
|
|
2375
2632
|
exports.DIcon = DIcon;
|
|
2376
2633
|
exports.DIconBase = DIconBase;
|
|
2377
2634
|
exports.DInput = ForwardedDInput;
|
|
2378
2635
|
exports.DInputCheck = DInputCheck;
|
|
2379
2636
|
exports.DInputCounter = ForwardedDInputCounter;
|
|
2380
|
-
exports.DInputCurrency =
|
|
2381
|
-
exports.DInputCurrencyBase = ForwardedDInputCurrencyBase$1;
|
|
2637
|
+
exports.DInputCurrency = ForwardedDInputCurrency;
|
|
2382
2638
|
exports.DInputMask = ForwardedDInputMask;
|
|
2383
2639
|
exports.DInputPassword = ForwardedDInputPassword;
|
|
2384
2640
|
exports.DInputPhone = ForwardedDInputPhone;
|
|
2385
2641
|
exports.DInputPin = DInputPin;
|
|
2386
2642
|
exports.DInputRange = ForwardedDInputRange;
|
|
2387
|
-
exports.DInputSearch = ForwardedDInputSearch;
|
|
2388
2643
|
exports.DInputSelect = DInputSelect;
|
|
2389
2644
|
exports.DInputSwitch = DInputSwitch;
|
|
2390
|
-
exports.
|
|
2391
|
-
exports.
|
|
2645
|
+
exports.DLayout = DLayout;
|
|
2646
|
+
exports.DLayoutPane = DLayoutPane;
|
|
2647
|
+
exports.DListGroup = DListGroup;
|
|
2392
2648
|
exports.DListGroupItem = DListGroupItem;
|
|
2393
|
-
exports.
|
|
2394
|
-
exports.DModal = DModal$1;
|
|
2649
|
+
exports.DModal = DModal;
|
|
2395
2650
|
exports.DModalBody = DModalBody;
|
|
2396
2651
|
exports.DModalFooter = DModalFooter;
|
|
2397
2652
|
exports.DModalHeader = DModalHeader;
|
|
2398
|
-
exports.DOffcanvas = DOffcanvas
|
|
2653
|
+
exports.DOffcanvas = DOffcanvas;
|
|
2399
2654
|
exports.DOffcanvasBody = DOffcanvasBody;
|
|
2400
2655
|
exports.DOffcanvasFooter = DOffcanvasFooter;
|
|
2401
2656
|
exports.DOffcanvasHeader = DOffcanvasHeader;
|
|
2402
2657
|
exports.DPaginator = DPaginator;
|
|
2658
|
+
exports.DPasswordStrengthMeter = DPasswordStrengthMeter;
|
|
2403
2659
|
exports.DPopover = DPopover;
|
|
2404
2660
|
exports.DProgress = DProgress;
|
|
2405
|
-
exports.
|
|
2406
|
-
exports.DQuickActionCheck = DQuickActionCheck;
|
|
2407
|
-
exports.DQuickActionSelect = DQuickActionSelect;
|
|
2408
|
-
exports.DQuickActionSwitch = DQuickActionSwitch;
|
|
2409
|
-
exports.DSelect = DSelect$1;
|
|
2410
|
-
exports.DSkeleton = DSkeleton;
|
|
2661
|
+
exports.DSelect = DSelect;
|
|
2411
2662
|
exports.DStepper = DStepper;
|
|
2412
2663
|
exports.DStepperDesktop = DStepper$2;
|
|
2413
2664
|
exports.DStepperMobile = DStepper$1;
|
|
2414
2665
|
exports.DTabContent = DTabContent;
|
|
2415
|
-
exports.
|
|
2416
|
-
exports.
|
|
2417
|
-
exports.DToast = DToast
|
|
2666
|
+
exports.DTabs = DTabs;
|
|
2667
|
+
exports.DTimeline = DTimeline;
|
|
2668
|
+
exports.DToast = DToast;
|
|
2418
2669
|
exports.DToastContainer = DToastContainer;
|
|
2419
2670
|
exports.DTooltip = DTooltip;
|
|
2671
|
+
exports.DVoucher = DVoucher;
|
|
2420
2672
|
exports.changeQueryString = changeQueryString;
|
|
2421
2673
|
exports.checkMediaQuery = checkMediaQuery;
|
|
2422
2674
|
exports.configureI18n = configureI8n;
|