@dynamic-framework/ui-react 1.36.2 → 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 +7051 -3728
- 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 +7392 -3891
- package/dist/css/dynamic-ui.min.css +3 -3
- package/dist/index.esm.js +643 -410
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +687 -437
- package/dist/index.js.map +1 -1
- package/dist/js/bootstrap.bundle.js +3 -6
- package/dist/js/bootstrap.bundle.min.js +2 -2
- package/dist/js/bootstrap.esm.js +3 -6
- package/dist/js/bootstrap.esm.min.js +2 -2
- package/dist/js/bootstrap.js +3 -6
- package/dist/js/bootstrap.min.js +2 -2
- 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/DBoxFile/useDBoxFile.d.ts +2 -2
- package/dist/types/components/DButton/DButton.d.ts +8 -17
- package/dist/types/components/DButtonIcon/DButtonIcon.d.ts +3 -3
- package/dist/types/components/DCarousel/components/DCarouselSlide.d.ts +3 -1
- package/dist/types/components/DChip/DChip.d.ts +3 -3
- package/dist/types/components/DCollapse/DCollapse.d.ts +2 -2
- 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/DPopover/DPopover.d.ts +1 -1
- 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/contexts/DContext.d.ts +0 -2
- package/dist/types/hooks/tests/useDisableBodyScrollEffect.spec.d.ts +1 -0
- package/dist/types/hooks/tests/useDisableInputWheel.spec.d.ts +1 -0
- package/dist/types/hooks/tests/useFormatCurrency.spec.d.ts +1 -0
- package/dist/types/hooks/tests/useInputCurrency.spec.d.ts +1 -0
- package/dist/types/hooks/tests/useItemSelection.spec.d.ts +1 -0
- package/dist/types/hooks/tests/useMediaBreakpointUp.spec.d.ts +1 -0
- package/dist/types/hooks/tests/useMediaQuery.spec.d.ts +1 -0
- package/dist/types/hooks/tests/usePortal.spec.d.ts +1 -0
- package/dist/types/hooks/tests/useProvidedRefOrCreate.spec.d.ts +1 -0
- package/dist/types/hooks/tests/useStackState.spec.d.ts +1 -0
- package/dist/types/hooks/useInputCurrency.d.ts +1 -1
- package/dist/types/hooks/useProvidedRefOrCreate.d.ts +1 -1
- package/dist/types/hooks/useResponsiveProp.d.ts +35 -0
- package/dist/types/types/polymorphic.d.ts +3 -3
- package/dist/types/utils/tests/attr-accept.spec.d.ts +1 -0
- package/dist/types/utils/tests/changeQueryString.spec.d.ts +1 -0
- package/dist/types/utils/tests/configureI18n.spec.d.ts +1 -0
- package/dist/types/utils/tests/formatCurrency.spec.d.ts +1 -0
- package/dist/types/utils/tests/getCssVariable.spec.d.ts +1 -0
- package/dist/types/utils/tests/getKeyboardFocusableElements.spec.d.ts +1 -0
- package/dist/types/utils/tests/getQueryString.spec.d.ts +1 -0
- package/dist/types/utils/tests/mediaQuery.spec.d.ts +1 -0
- package/dist/types/utils/tests/validatePhoneNumber.spec.d.ts +1 -0
- package/jest/setup.js +93 -2
- package/package.json +57 -57
- 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/css/bootstrap-icons.css +0 -2106
- package/dist/css/bootstrap-icons.json +0 -2080
- package/dist/css/bootstrap-icons.min.css +0 -5
- package/dist/css/bootstrap-icons.scss +0 -2118
- package/dist/css/fonts/bootstrap-icons.woff +0 -0
- package/dist/css/fonts/bootstrap-icons.woff2 +0 -0
- 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,33 +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
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
increase: 'plus-square',
|
|
279
|
-
decrease: 'dash-square',
|
|
251
|
+
search: 'Search',
|
|
252
|
+
show: 'Eye',
|
|
253
|
+
hide: 'EyeOff',
|
|
254
|
+
increase: 'Plus',
|
|
255
|
+
decrease: 'Minus',
|
|
280
256
|
},
|
|
281
257
|
},
|
|
282
258
|
breakpoints: {
|
|
@@ -323,31 +299,170 @@ function useDContext() {
|
|
|
323
299
|
return context;
|
|
324
300
|
}
|
|
325
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
|
+
|
|
326
447
|
function DIcon(_a) {
|
|
327
448
|
var { familyClass: propFamilyClass, familyPrefix: propFamilyPrefix, materialStyle: propMaterialStyle } = _a, props = tslib.__rest(_a, ["familyClass", "familyPrefix", "materialStyle"]);
|
|
328
449
|
const { icon: { familyClass, familyPrefix, materialStyle, }, } = useDContext();
|
|
329
450
|
return (jsxRuntime.jsx(DIconBase, Object.assign({ familyClass: propFamilyClass || familyClass, familyPrefix: propFamilyPrefix || familyPrefix, materialStyle: propMaterialStyle || materialStyle }, props)));
|
|
330
451
|
}
|
|
331
452
|
|
|
332
|
-
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, }) {
|
|
333
454
|
const { iconMap: { alert, xLg, }, } = useDContext();
|
|
334
|
-
const icon = React.useMemo(() => iconProp || alert[
|
|
455
|
+
const icon = React.useMemo(() => iconProp || alert[color], [alert, iconProp, color]);
|
|
335
456
|
const iconClose = React.useMemo(() => (iconCloseProp || xLg), [iconCloseProp, xLg]);
|
|
336
|
-
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]);
|
|
337
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 }) }))] })));
|
|
338
459
|
}
|
|
339
460
|
|
|
340
|
-
function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false,
|
|
341
|
-
const generateClasses = React.useMemo(() => {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
return {
|
|
346
|
-
'd-avatar': true,
|
|
347
|
-
[variantClass]: true,
|
|
348
|
-
[`d-avatar-${size}`]: !!size,
|
|
349
|
-
};
|
|
350
|
-
}, [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]);
|
|
351
466
|
const name = React.useMemo(() => {
|
|
352
467
|
if (!nameProp) {
|
|
353
468
|
return undefined;
|
|
@@ -360,16 +475,21 @@ function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, t
|
|
|
360
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 })] })));
|
|
361
476
|
}
|
|
362
477
|
|
|
363
|
-
function DBadge({ text, soft = false,
|
|
478
|
+
function DBadge({ text, soft = false, color = 'primary', id, rounded, className, size, style, iconStart, iconEnd, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, dataAttributes, }) {
|
|
364
479
|
const generateClasses = React.useMemo(() => ({
|
|
365
480
|
badge: true,
|
|
366
|
-
[`badge-${
|
|
367
|
-
[`badge-soft-${
|
|
481
|
+
[`badge-${color}`]: !!color && !soft,
|
|
482
|
+
[`badge-soft-${color}`]: !!color && soft,
|
|
368
483
|
'rounded-pill': !!rounded,
|
|
369
|
-
|
|
484
|
+
[`badge-${size}`]: !!size,
|
|
485
|
+
}), [rounded, soft, color, size]);
|
|
370
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 }))] })));
|
|
371
487
|
}
|
|
372
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
|
+
|
|
373
493
|
/* eslint-disable */
|
|
374
494
|
/**
|
|
375
495
|
* This file is originally from `@primer/react`
|
|
@@ -391,7 +511,7 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
391
511
|
}
|
|
392
512
|
|
|
393
513
|
function DInput(_a, ref) {
|
|
394
|
-
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"]);
|
|
395
515
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
396
516
|
const innerId = React.useId();
|
|
397
517
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
@@ -428,7 +548,7 @@ function DInput(_a, ref) {
|
|
|
428
548
|
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
429
549
|
'is-invalid': invalid,
|
|
430
550
|
'is-valid': valid,
|
|
431
|
-
}), 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))), [
|
|
432
552
|
ariaDescribedby,
|
|
433
553
|
disabled,
|
|
434
554
|
handleOnChange,
|
|
@@ -441,14 +561,11 @@ function DInput(_a, ref) {
|
|
|
441
561
|
floatingLabel,
|
|
442
562
|
valid,
|
|
443
563
|
value,
|
|
564
|
+
readonly,
|
|
444
565
|
]);
|
|
445
|
-
const labelComponent = React.useMemo(() => (jsxRuntime.
|
|
566
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsx("label", { htmlFor: id, children: label })), [
|
|
446
567
|
id,
|
|
447
568
|
label,
|
|
448
|
-
labelIcon,
|
|
449
|
-
labelIconFamilyClass,
|
|
450
|
-
labelIconFamilyPrefix,
|
|
451
|
-
labelIconMaterialStyle,
|
|
452
569
|
]);
|
|
453
570
|
const dynamicComponent = React.useMemo(() => {
|
|
454
571
|
if (floatingLabel) {
|
|
@@ -577,7 +694,7 @@ async function urlToFile(url) {
|
|
|
577
694
|
null,
|
|
578
695
|
{
|
|
579
696
|
code: ErrorCodes.FailedFetch,
|
|
580
|
-
message: `Failed to fetch file from ${url}`,
|
|
697
|
+
message: `Failed to fetch file from ${url} (HTTP ${res.status})`,
|
|
581
698
|
},
|
|
582
699
|
];
|
|
583
700
|
}
|
|
@@ -587,11 +704,13 @@ async function urlToFile(url) {
|
|
|
587
704
|
return [file, null];
|
|
588
705
|
}
|
|
589
706
|
catch (error) {
|
|
707
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
708
|
+
const isCorsError = errorMessage.includes('CORS') || errorMessage.includes('Failed to fetch');
|
|
590
709
|
return [
|
|
591
710
|
null,
|
|
592
711
|
{
|
|
593
712
|
code: ErrorCodes.FailedFetch,
|
|
594
|
-
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})`}`,
|
|
595
714
|
},
|
|
596
715
|
];
|
|
597
716
|
}
|
|
@@ -862,38 +981,72 @@ function DBoxFile(_a) {
|
|
|
862
981
|
'd-box-file-disabled': props.disabled,
|
|
863
982
|
'd-box-file-valid': isDragValid,
|
|
864
983
|
'd-box-file-invalid': isDragInvalid,
|
|
865
|
-
}, 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'
|
|
866
985
|
? children(openFileDialog)
|
|
867
|
-
: 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}`))) }))] }));
|
|
868
987
|
}
|
|
869
988
|
|
|
870
|
-
|
|
871
|
-
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(() => {
|
|
872
996
|
const variantClass = variant
|
|
873
|
-
? `btn-${variant}-${
|
|
874
|
-
: `btn-${
|
|
875
|
-
return
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
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;
|
|
880
1016
|
}
|
|
881
1017
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
882
|
-
}, [
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}
|
|
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';
|
|
889
1042
|
|
|
890
|
-
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, }) {
|
|
891
1044
|
const generateClasses = React.useMemo(() => {
|
|
892
1045
|
const variantClass = variant
|
|
893
|
-
? `btn-${variant}-${
|
|
894
|
-
: `btn-${
|
|
1046
|
+
? `btn-${variant}-${color}`
|
|
1047
|
+
: `btn-${color}`;
|
|
895
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 });
|
|
896
|
-
}, [variant,
|
|
1049
|
+
}, [variant, color, size, state, loading]);
|
|
897
1050
|
const clickHandler = React.useCallback((event) => {
|
|
898
1051
|
if (stopPropagationEnabled) {
|
|
899
1052
|
event.stopPropagation();
|
|
@@ -921,10 +1074,10 @@ function DCardFooter({ className, style, children, }) {
|
|
|
921
1074
|
return (jsxRuntime.jsx("div", { className: classNames('card-footer', className), style: style, children: children }));
|
|
922
1075
|
}
|
|
923
1076
|
|
|
924
|
-
function DCard({ className, style, children, dataAttributes, }) {
|
|
1077
|
+
function DCard$1({ className, style, children, dataAttributes, }) {
|
|
925
1078
|
return (jsxRuntime.jsx("div", Object.assign({ style: style, className: classNames('card', className) }, dataAttributes, { children: children })));
|
|
926
1079
|
}
|
|
927
|
-
var DCard
|
|
1080
|
+
var DCard = Object.assign(DCard$1, {
|
|
928
1081
|
Header: DCardHeader,
|
|
929
1082
|
Body: DCardBody,
|
|
930
1083
|
Footer: DCardFooter,
|
|
@@ -935,7 +1088,7 @@ function DCarouselSlide(_a) {
|
|
|
935
1088
|
return (jsxRuntime.jsx(reactSplide.SplideSlide, Object.assign({ className: classNames('d-carousel-slide', className) }, props)));
|
|
936
1089
|
}
|
|
937
1090
|
|
|
938
|
-
function DCarousel(_a, ref) {
|
|
1091
|
+
function DCarousel$1(_a, ref) {
|
|
939
1092
|
var { children, className, style, options, dataAttributes } = _a, props = tslib.__rest(_a, ["children", "className", "style", "options", "dataAttributes"]);
|
|
940
1093
|
return (jsxRuntime.jsx(reactSplide.Splide, Object.assign({ className: classNames('d-carousel', className), style: style, ref: ref, options: Object.assign(Object.assign({}, options), { classes: {
|
|
941
1094
|
// Arrows
|
|
@@ -948,17 +1101,17 @@ function DCarousel(_a, ref) {
|
|
|
948
1101
|
page: 'splide__pagination__page d-carousel-pagination-page',
|
|
949
1102
|
} }) }, dataAttributes, props, { children: children })));
|
|
950
1103
|
}
|
|
951
|
-
const ForwardedDCarousel = React.forwardRef(DCarousel);
|
|
1104
|
+
const ForwardedDCarousel = React.forwardRef(DCarousel$1);
|
|
952
1105
|
ForwardedDCarousel.displayName = 'DCarousel';
|
|
953
|
-
var DCarousel
|
|
1106
|
+
var DCarousel = Object.assign(ForwardedDCarousel, {
|
|
954
1107
|
Slide: DCarouselSlide,
|
|
955
1108
|
});
|
|
956
1109
|
|
|
957
|
-
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, }) {
|
|
958
1111
|
const generateClasses = React.useMemo(() => ({
|
|
959
1112
|
'd-chip': true,
|
|
960
|
-
[`d-chip-${
|
|
961
|
-
}), [
|
|
1113
|
+
[`d-chip-${color}`]: !!color,
|
|
1114
|
+
}), [color]);
|
|
962
1115
|
const { iconMap: { xLg, }, } = useDContext();
|
|
963
1116
|
const iconClose = React.useMemo(() => iconCloseProp || xLg, [iconCloseProp, xLg]);
|
|
964
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 }) }))] })));
|
|
@@ -981,7 +1134,7 @@ function DCollapse({ id, className, style, Component, hasSeparator = false, defa
|
|
|
981
1134
|
const generateStyles = React.useMemo(() => ({
|
|
982
1135
|
[`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
|
|
983
1136
|
}), [hasSeparator]);
|
|
984
|
-
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({
|
|
985
1138
|
'collapse-body': true,
|
|
986
1139
|
}), style: generateStyles, children: children }))] })));
|
|
987
1140
|
}
|
|
@@ -1020,7 +1173,7 @@ const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
|
|
|
1020
1173
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
1021
1174
|
|
|
1022
1175
|
function DInputCheck(_a) {
|
|
1023
|
-
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"]);
|
|
1024
1177
|
const innerRef = React.useRef(null);
|
|
1025
1178
|
const innerId = React.useId();
|
|
1026
1179
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
@@ -1048,11 +1201,11 @@ function DInputCheck(_a) {
|
|
|
1048
1201
|
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
|
|
1049
1202
|
'is-invalid': invalid,
|
|
1050
1203
|
'is-valid': valid,
|
|
1051
|
-
},
|
|
1204
|
+
}, inputClassName), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, props))), [
|
|
1052
1205
|
handleChange,
|
|
1053
1206
|
invalid,
|
|
1054
1207
|
valid,
|
|
1055
|
-
|
|
1208
|
+
inputClassName,
|
|
1056
1209
|
style,
|
|
1057
1210
|
id,
|
|
1058
1211
|
disabled,
|
|
@@ -1066,7 +1219,7 @@ function DInputCheck(_a) {
|
|
|
1066
1219
|
if (!label) {
|
|
1067
1220
|
return inputComponent;
|
|
1068
1221
|
}
|
|
1069
|
-
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 }))] })));
|
|
1070
1223
|
}
|
|
1071
1224
|
|
|
1072
1225
|
function DSelectOptionCheck(_a) {
|
|
@@ -1144,8 +1297,8 @@ function DSelectPlaceholder(_a) {
|
|
|
1144
1297
|
return (jsxRuntime.jsx(Select.components.Placeholder, Object.assign({ innerProps: innerProps, selectProps: selectProps }, props, { children: children })));
|
|
1145
1298
|
}
|
|
1146
1299
|
|
|
1147
|
-
function DSelect(_a) {
|
|
1148
|
-
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"]);
|
|
1149
1302
|
const innerId = React.useId();
|
|
1150
1303
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1151
1304
|
const handleOnIconStartClick = React.useCallback(() => {
|
|
@@ -1157,7 +1310,7 @@ function DSelect(_a) {
|
|
|
1157
1310
|
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('d-select', className, {
|
|
1158
1311
|
'd-select-floating': floatingLabel,
|
|
1159
1312
|
disabled: disabled || loading,
|
|
1160
|
-
}), style: style }, dataAttributes, { children: [label && (jsxRuntime.
|
|
1313
|
+
}), style: style }, dataAttributes, { children: [label && (jsxRuntime.jsx("label", { htmlFor: id, children: label })), jsxRuntime.jsxs("div", { className: classNames({
|
|
1161
1314
|
'input-group': true,
|
|
1162
1315
|
'has-validation': invalid,
|
|
1163
1316
|
disabled: disabled || loading,
|
|
@@ -1170,7 +1323,7 @@ function DSelect(_a) {
|
|
|
1170
1323
|
'is-valid': valid,
|
|
1171
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 }))] })));
|
|
1172
1325
|
}
|
|
1173
|
-
var DSelect
|
|
1326
|
+
var DSelect = Object.assign(DSelect$1, {
|
|
1174
1327
|
OptionCheck: DSelectOptionCheck,
|
|
1175
1328
|
OptionIcon: DSelectOptionIcon,
|
|
1176
1329
|
SingleValueIconText: DSelectSingleValueIconText,
|
|
@@ -1191,7 +1344,7 @@ var PickerType;
|
|
|
1191
1344
|
PickerType["Month"] = "month";
|
|
1192
1345
|
PickerType["Year"] = "year";
|
|
1193
1346
|
})(PickerType || (PickerType = {}));
|
|
1194
|
-
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, }) {
|
|
1195
1348
|
const { iconMap: { chevronLeft, chevronRight, }, } = useDContext();
|
|
1196
1349
|
const arrayYears = React.useMemo(() => Array.from({ length: maxYearSelect - minYearSelect + 1 }, (_, index) => minYearSelect + index), [maxYearSelect, minYearSelect]);
|
|
1197
1350
|
const years = React.useMemo(() => arrayYears.map((year) => ({
|
|
@@ -1216,16 +1369,16 @@ function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMont
|
|
|
1216
1369
|
}, [date]);
|
|
1217
1370
|
const [startYear, endYear] = getYearRange();
|
|
1218
1371
|
if (pickerType === PickerType.Year) {
|
|
1219
|
-
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" })] }));
|
|
1220
1373
|
}
|
|
1221
1374
|
if (pickerType === PickerType.Quarter || pickerType === PickerType.Month) {
|
|
1222
|
-
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' } })] }));
|
|
1223
1376
|
}
|
|
1224
|
-
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' } })] })] }));
|
|
1225
1378
|
}
|
|
1226
1379
|
|
|
1227
1380
|
function DDatePicker(_a) {
|
|
1228
|
-
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"]);
|
|
1229
1382
|
const pickerType = React.useMemo(() => {
|
|
1230
1383
|
if (props.showQuarterYearPicker)
|
|
1231
1384
|
return PickerType.Quarter;
|
|
@@ -1239,15 +1392,10 @@ function DDatePicker(_a) {
|
|
|
1239
1392
|
props.showMonthYearPicker,
|
|
1240
1393
|
props.showYearPicker,
|
|
1241
1394
|
]);
|
|
1242
|
-
const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeaderSelector, Object.assign({}, headerProps, { monthsShown: props.monthsShown,
|
|
1243
|
-
iconHeaderNext,
|
|
1244
|
-
iconHeaderPrev,
|
|
1245
|
-
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 }))), [
|
|
1246
1396
|
headerPrevMonthAriaLabel,
|
|
1247
1397
|
headerNextMonthAriaLabel,
|
|
1248
1398
|
iconHeaderSize,
|
|
1249
|
-
headerButtonVariant,
|
|
1250
|
-
headerButtonTheme,
|
|
1251
1399
|
minYearSelect,
|
|
1252
1400
|
maxYearSelect,
|
|
1253
1401
|
pickerType,
|
|
@@ -1260,6 +1408,33 @@ function DDatePicker(_a) {
|
|
|
1260
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 })) })));
|
|
1261
1409
|
}
|
|
1262
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
|
+
|
|
1263
1438
|
function DInputMask(props, ref) {
|
|
1264
1439
|
return (jsxRuntime.jsx(mask.InputMask, Object.assign({ ref: ref, component: ForwardedDInput }, props)));
|
|
1265
1440
|
}
|
|
@@ -1364,47 +1539,6 @@ function useItemSelection({ getItemIdentifier: getItemIdentifierProp, previousSe
|
|
|
1364
1539
|
};
|
|
1365
1540
|
}
|
|
1366
1541
|
|
|
1367
|
-
function subscribeToMediaQuery(query, callback) {
|
|
1368
|
-
const mediaQueryList = window.matchMedia(query);
|
|
1369
|
-
mediaQueryList.addEventListener('change', callback);
|
|
1370
|
-
return () => {
|
|
1371
|
-
mediaQueryList.removeEventListener('change', callback);
|
|
1372
|
-
};
|
|
1373
|
-
}
|
|
1374
|
-
function checkMediaQuery(query) {
|
|
1375
|
-
return window.matchMedia(query).matches;
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
function useMediaQuery(mediaQuery, useListener = false) {
|
|
1379
|
-
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
1380
|
-
const noop = (_) => () => { };
|
|
1381
|
-
return React.useSyncExternalStore(useListener ? (cb) => subscribeToMediaQuery(mediaQuery, cb) : noop, () => (mediaQuery ? checkMediaQuery(mediaQuery) : true), () => false);
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
function useMediaBreakpointUp(breakpoint, useListener = false) {
|
|
1385
|
-
const { breakpoints } = useDContext();
|
|
1386
|
-
const mediaQuery = React.useMemo(() => (`(min-width: ${breakpoints[breakpoint]})`), [breakpoint, breakpoints]);
|
|
1387
|
-
return useMediaQuery(mediaQuery, useListener);
|
|
1388
|
-
}
|
|
1389
|
-
function useMediaBreakpointUpXs(useListener = false) {
|
|
1390
|
-
return useMediaBreakpointUp('xs', useListener);
|
|
1391
|
-
}
|
|
1392
|
-
function useMediaBreakpointUpSm(useListener = false) {
|
|
1393
|
-
return useMediaBreakpointUp('sm', useListener);
|
|
1394
|
-
}
|
|
1395
|
-
function useMediaBreakpointUpMd(useListener = false) {
|
|
1396
|
-
return useMediaBreakpointUp('md', useListener);
|
|
1397
|
-
}
|
|
1398
|
-
function useMediaBreakpointUpLg(useListener = false) {
|
|
1399
|
-
return useMediaBreakpointUp('lg', useListener);
|
|
1400
|
-
}
|
|
1401
|
-
function useMediaBreakpointUpXl(useListener = false) {
|
|
1402
|
-
return useMediaBreakpointUp('xl', useListener);
|
|
1403
|
-
}
|
|
1404
|
-
function useMediaBreakpointUpXxl(useListener = false) {
|
|
1405
|
-
return useMediaBreakpointUp('xxl', useListener);
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
1542
|
function DInputCounter(_a, ref) {
|
|
1409
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"]);
|
|
1410
1544
|
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
@@ -1443,18 +1577,6 @@ function DInputCounter(_a, ref) {
|
|
|
1443
1577
|
const ForwardedDInputCounter = React.forwardRef(DInputCounter);
|
|
1444
1578
|
ForwardedDInputCounter.displayName = 'DInputCounter';
|
|
1445
1579
|
|
|
1446
|
-
/**
|
|
1447
|
-
* @deprecated
|
|
1448
|
-
*/
|
|
1449
|
-
function DInputCurrencyBase(_a, ref) {
|
|
1450
|
-
var { value, minValue, maxValue, currencyOptions, currencyCode, onFocus, onBlur, onChange } = _a, inputProps = tslib.__rest(_a, ["value", "minValue", "maxValue", "currencyOptions", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
1451
|
-
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
1452
|
-
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
1453
|
-
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)));
|
|
1454
|
-
}
|
|
1455
|
-
const ForwardedDInputCurrencyBase$1 = React.forwardRef(DInputCurrencyBase);
|
|
1456
|
-
ForwardedDInputCurrencyBase$1.displayName = 'DInputCurrencyBase';
|
|
1457
|
-
|
|
1458
1580
|
function DInputCurrency(_a, ref) {
|
|
1459
1581
|
var { value, minValue, maxValue, currencyCode, onFocus, onBlur, onChange } = _a, props = tslib.__rest(_a, ["value", "minValue", "maxValue", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
1460
1582
|
const { currency: currencyOptions } = useDContext();
|
|
@@ -1462,19 +1584,8 @@ function DInputCurrency(_a, ref) {
|
|
|
1462
1584
|
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
1463
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)));
|
|
1464
1586
|
}
|
|
1465
|
-
const
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
/**
|
|
1469
|
-
* @deprecated
|
|
1470
|
-
*/
|
|
1471
|
-
function DInputSearch(_a, ref) {
|
|
1472
|
-
var { type, iconEnd: iconEndProp, iconEndAriaLabel = 'search' } = _a, props = tslib.__rest(_a, ["type", "iconEnd", "iconEndAriaLabel"]);
|
|
1473
|
-
const inputRef = useProvidedRefOrCreate(ref);
|
|
1474
|
-
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", iconEndAriaLabel: iconEndAriaLabel }, props)));
|
|
1475
|
-
}
|
|
1476
|
-
const ForwardedDInputSearch = React.forwardRef(DInputSearch);
|
|
1477
|
-
ForwardedDInputSearch.displayName = 'DInputSearch';
|
|
1587
|
+
const ForwardedDInputCurrency = React.forwardRef(DInputCurrency);
|
|
1588
|
+
ForwardedDInputCurrency.displayName = 'DInputCurrency';
|
|
1478
1589
|
|
|
1479
1590
|
function DInputPassword(_a, ref) {
|
|
1480
1591
|
var { onIconEndClick, iconEndAriaLabel = 'show/hide password' } = _a, props = tslib.__rest(_a, ["onIconEndClick", "iconEndAriaLabel"]);
|
|
@@ -1491,7 +1602,87 @@ function DInputPassword(_a, ref) {
|
|
|
1491
1602
|
const ForwardedDInputPassword = React.forwardRef(DInputPassword);
|
|
1492
1603
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
1493
1604
|
|
|
1494
|
-
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, }) {
|
|
1495
1686
|
const innerId = React.useId();
|
|
1496
1687
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1497
1688
|
const [pattern, setPattern] = React.useState('');
|
|
@@ -1524,7 +1715,8 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1524
1715
|
}
|
|
1525
1716
|
if (input.value !== '') {
|
|
1526
1717
|
setActiveInput((prev) => {
|
|
1527
|
-
const newValue = prev
|
|
1718
|
+
const newValue = [...prev];
|
|
1719
|
+
newValue[index] = input.value;
|
|
1528
1720
|
return newValue;
|
|
1529
1721
|
});
|
|
1530
1722
|
if (input.nextSibling) {
|
|
@@ -1540,7 +1732,8 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1540
1732
|
if (key === 'Backspace') {
|
|
1541
1733
|
const { value } = currentTarget;
|
|
1542
1734
|
setActiveInput((prev) => {
|
|
1543
|
-
const newVal = prev
|
|
1735
|
+
const newVal = [...prev];
|
|
1736
|
+
newVal[index] = '';
|
|
1544
1737
|
return newVal;
|
|
1545
1738
|
});
|
|
1546
1739
|
if (currentTarget.previousSibling && value === '') {
|
|
@@ -1553,19 +1746,23 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1553
1746
|
}
|
|
1554
1747
|
}, []);
|
|
1555
1748
|
const focusInput = React.useCallback((index) => {
|
|
1556
|
-
setActiveInput((prev) =>
|
|
1749
|
+
setActiveInput((prev) => {
|
|
1750
|
+
const newVal = [...prev];
|
|
1751
|
+
newVal[index] = '';
|
|
1752
|
+
return newVal;
|
|
1753
|
+
});
|
|
1557
1754
|
}, []);
|
|
1558
1755
|
const wheelInput = React.useCallback((event) => {
|
|
1559
1756
|
event.currentTarget.blur();
|
|
1560
1757
|
}, []);
|
|
1561
|
-
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({
|
|
1562
1759
|
'form-control': true,
|
|
1563
1760
|
'is-invalid': invalid,
|
|
1564
1761
|
'is-valid': valid,
|
|
1565
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 }))] })));
|
|
1566
1763
|
}
|
|
1567
1764
|
|
|
1568
|
-
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, }) {
|
|
1569
1766
|
const innerId = React.useId();
|
|
1570
1767
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1571
1768
|
const internalValueExtractor = React.useCallback((option) => {
|
|
@@ -1633,12 +1830,9 @@ function DInputSelect({ id: idProp, name, label = '', className, style, options
|
|
|
1633
1830
|
valid,
|
|
1634
1831
|
size,
|
|
1635
1832
|
]);
|
|
1636
|
-
const labelComponent = React.useMemo(() => (jsxRuntime.
|
|
1833
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsx("label", { htmlFor: id, children: label })), [
|
|
1637
1834
|
id,
|
|
1638
1835
|
label,
|
|
1639
|
-
labelIcon,
|
|
1640
|
-
labelIconFamilyClass,
|
|
1641
|
-
labelIconFamilyPrefix,
|
|
1642
1836
|
]);
|
|
1643
1837
|
const dynamicComponent = React.useMemo(() => {
|
|
1644
1838
|
if (floatingLabel) {
|
|
@@ -1651,7 +1845,7 @@ function DInputSelect({ id: idProp, name, label = '', className, style, options
|
|
|
1651
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 }))] })));
|
|
1652
1846
|
}
|
|
1653
1847
|
|
|
1654
|
-
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, }) {
|
|
1655
1849
|
const innerId = React.useId();
|
|
1656
1850
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1657
1851
|
const [internalIsChecked, setInternalIsChecked] = React.useState(checked);
|
|
@@ -1663,10 +1857,10 @@ function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, i
|
|
|
1663
1857
|
setInternalIsChecked(value);
|
|
1664
1858
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
1665
1859
|
}, [onChange]);
|
|
1666
|
-
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', {
|
|
1667
1861
|
'is-invalid': invalid,
|
|
1668
1862
|
'is-valid': valid,
|
|
1669
|
-
},
|
|
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 }))] })));
|
|
1670
1864
|
}
|
|
1671
1865
|
|
|
1672
1866
|
function DInputRange(_a, ref) {
|
|
@@ -1706,38 +1900,7 @@ function DInputRange(_a, ref) {
|
|
|
1706
1900
|
const ForwardedDInputRange = React.forwardRef(DInputRange);
|
|
1707
1901
|
ForwardedDInputRange.displayName = 'DInputRange';
|
|
1708
1902
|
|
|
1709
|
-
|
|
1710
|
-
* @deprecated Please use DListGroup.Item or DListGroupItem instead
|
|
1711
|
-
*/
|
|
1712
|
-
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
1713
|
-
const Tag = React.useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
1714
|
-
return (jsxRuntime.jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
1715
|
-
onClick,
|
|
1716
|
-
type: 'button',
|
|
1717
|
-
}, { className: classNames('list-group-item list-group-item-action', theme ? `list-group-item-${theme}` : undefined, className, {
|
|
1718
|
-
active,
|
|
1719
|
-
disabled,
|
|
1720
|
-
}), style: style }, active && { 'aria-current': true }, { children: children })));
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
/**
|
|
1724
|
-
* @deprecated Please use DListGroup instead
|
|
1725
|
-
*/
|
|
1726
|
-
function DList({ children, className, style, flush = false, numbered = false, horizontal = false, horizontalBreakpoint, dataAttributes, }) {
|
|
1727
|
-
if (flush && horizontal) {
|
|
1728
|
-
throw new Error("Horizontal and Flush props don't work together");
|
|
1729
|
-
}
|
|
1730
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('list-group', {
|
|
1731
|
-
'list-group-flush': flush && !horizontal,
|
|
1732
|
-
'list-group-numbered': numbered,
|
|
1733
|
-
'list-group-horizontal': horizontal && !horizontalBreakpoint,
|
|
1734
|
-
}, (horizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className), style: style }, dataAttributes, { children: children })));
|
|
1735
|
-
}
|
|
1736
|
-
var DList$1 = Object.assign(DList, {
|
|
1737
|
-
Item: DListItem,
|
|
1738
|
-
});
|
|
1739
|
-
|
|
1740
|
-
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, }) {
|
|
1741
1904
|
const Tag = React.useMemo(() => {
|
|
1742
1905
|
if (href) {
|
|
1743
1906
|
return 'a';
|
|
@@ -1756,20 +1919,20 @@ function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href,
|
|
|
1756
1919
|
const generateClasses = React.useMemo(() => ({
|
|
1757
1920
|
'list-group-item': true,
|
|
1758
1921
|
'list-group-item-action': action,
|
|
1759
|
-
[`list-group-item-${
|
|
1922
|
+
[`list-group-item-${color}`]: !!color,
|
|
1760
1923
|
active,
|
|
1761
1924
|
disabled,
|
|
1762
|
-
}), [action, active, disabled,
|
|
1925
|
+
}), [action, active, disabled, color]);
|
|
1763
1926
|
const ariaAttributes = React.useMemo(() => {
|
|
1764
1927
|
if (Tag === 'button') {
|
|
1765
1928
|
return Object.assign(Object.assign({}, active && { 'aria-current': true }), disabled && { disabled: true });
|
|
1766
1929
|
}
|
|
1767
1930
|
return Object.assign(Object.assign({}, active && { 'aria-current': true }), disabled && { 'aria-disabled': true });
|
|
1768
1931
|
}, [Tag, active, disabled]);
|
|
1769
|
-
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" }))] })));
|
|
1770
1933
|
}
|
|
1771
1934
|
|
|
1772
|
-
function DListGroup({ as = 'ul', numbered, flush, horizontal, children, className, style, dataAttributes, }) {
|
|
1935
|
+
function DListGroup$1({ as = 'ul', numbered, flush, horizontal, children, className, style, dataAttributes, }) {
|
|
1773
1936
|
const Tag = React.useMemo(() => {
|
|
1774
1937
|
if (numbered) {
|
|
1775
1938
|
return 'ol';
|
|
@@ -1789,7 +1952,7 @@ function DListGroup({ as = 'ul', numbered, flush, horizontal, children, classNam
|
|
|
1789
1952
|
}, [flush, horizontal, numbered]);
|
|
1790
1953
|
return (jsxRuntime.jsx(Tag, Object.assign({ className: classNames(generateClasses, className), style: style }, dataAttributes, { children: children })));
|
|
1791
1954
|
}
|
|
1792
|
-
var DListGroup
|
|
1955
|
+
var DListGroup = Object.assign(DListGroup$1, {
|
|
1793
1956
|
Item: DListGroupItem,
|
|
1794
1957
|
});
|
|
1795
1958
|
|
|
@@ -1811,7 +1974,11 @@ function DModalFooter({ className, style, actionPlacement, children, }) {
|
|
|
1811
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 })] }));
|
|
1812
1975
|
}
|
|
1813
1976
|
|
|
1814
|
-
|
|
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, }) {
|
|
1815
1982
|
const fullScreenClass = React.useMemo(() => {
|
|
1816
1983
|
if (fullScreen) {
|
|
1817
1984
|
if (fullScreenFrom) {
|
|
@@ -1822,12 +1989,12 @@ function DModal({ name, className, style, staticBackdrop, scrollable, centered,
|
|
|
1822
1989
|
return '';
|
|
1823
1990
|
}, [fullScreenFrom, fullScreen]);
|
|
1824
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]);
|
|
1825
|
-
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 && ({
|
|
1826
1993
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
1827
1994
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
1828
1995
|
}), dataAttributes, { children: jsxRuntime.jsx("div", { className: classNames(generateModalDialogClasses), children: jsxRuntime.jsx("div", { className: "modal-content", children: children }) }) })));
|
|
1829
1996
|
}
|
|
1830
|
-
var DModal
|
|
1997
|
+
var DModal = Object.assign(DModal$1, {
|
|
1831
1998
|
Header: DModalHeader,
|
|
1832
1999
|
Body: DModalBody,
|
|
1833
2000
|
Footer: DModalFooter,
|
|
@@ -1851,10 +2018,36 @@ function DOffcanvasFooter({ actionPlacement, children, className, style, }) {
|
|
|
1851
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 })] }));
|
|
1852
2019
|
}
|
|
1853
2020
|
|
|
1854
|
-
|
|
1855
|
-
|
|
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', {
|
|
1856
2049
|
[`offcanvas-${openFrom}`]: openFrom,
|
|
1857
|
-
}, 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 && ({
|
|
1858
2051
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
1859
2052
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
1860
2053
|
}), scrollable && ({
|
|
@@ -1862,18 +2055,15 @@ function DOffcanvas({ name, className, style, staticBackdrop, scrollable, openFr
|
|
|
1862
2055
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
1863
2056
|
}), dataAttributes, { children: children })));
|
|
1864
2057
|
}
|
|
1865
|
-
var DOffcanvas
|
|
2058
|
+
var DOffcanvas = Object.assign(DOffcanvas$1, {
|
|
1866
2059
|
Header: DOffcanvasHeader,
|
|
1867
2060
|
Body: DOffcanvasBody,
|
|
1868
2061
|
Footer: DOffcanvasFooter,
|
|
1869
2062
|
});
|
|
1870
2063
|
|
|
1871
2064
|
function DPaginator(_a) {
|
|
1872
|
-
var {
|
|
1873
|
-
|
|
1874
|
-
extraClassName: className,
|
|
1875
|
-
})), [props, page, current, showArrows, className]);
|
|
1876
|
-
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)));
|
|
1877
2067
|
}
|
|
1878
2068
|
|
|
1879
2069
|
function DPopover({ children, renderComponent, open, setOpen, adjustContentToRender = false, className, style, dataAttributes, }) {
|
|
@@ -1906,123 +2096,22 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
|
|
|
1906
2096
|
role,
|
|
1907
2097
|
]);
|
|
1908
2098
|
const headingId = react.useId();
|
|
1909
|
-
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign({}, style), adjustContentToRender && {
|
|
2099
|
+
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign({}, style), (adjustContentToRender && {
|
|
1910
2100
|
[`--${PREFIX_BS}popover-component-min-width`]: 'auto',
|
|
1911
|
-
})), [style, adjustContentToRender]);
|
|
2101
|
+
}))), [style, adjustContentToRender]);
|
|
1912
2102
|
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('d-popover', className), style: generateStyleVariables }, dataAttributes, { children: [jsxRuntime.jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(isOpen) })), isOpen && (jsxRuntime.jsx(react.FloatingFocusManager, { context: context, modal: false, children: jsxRuntime.jsx("div", Object.assign({ className: classNames('d-popover-content', {
|
|
1913
2103
|
'w-100': adjustContentToRender,
|
|
1914
2104
|
}), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] })));
|
|
1915
2105
|
}
|
|
1916
2106
|
|
|
1917
|
-
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, }) {
|
|
1918
2108
|
const percentage = React.useMemo(() => (Math.round((currentValue * 100) / maxValue)), [currentValue, maxValue]);
|
|
1919
2109
|
const formatProgress = React.useMemo(() => `${percentage}%`, [percentage]);
|
|
1920
2110
|
const generateClasses = React.useMemo(() => ({
|
|
1921
2111
|
'progress-bar': true,
|
|
1922
2112
|
'progress-bar-striped progress-bar-animated': enableStripedAnimation,
|
|
1923
2113
|
}), [enableStripedAnimation]);
|
|
1924
|
-
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:
|
|
1925
|
-
}
|
|
1926
|
-
|
|
1927
|
-
function DQuickActionButton({ line1, line2, className, actionIcon, actionIconFamilyClass, actionIconFamilyPrefix, actionIconTheme, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, href, hrefTarget, style, dataAttributes, }) {
|
|
1928
|
-
const Tag = React.useMemo(() => {
|
|
1929
|
-
if (href) {
|
|
1930
|
-
return 'a';
|
|
1931
|
-
}
|
|
1932
|
-
if (onClick) {
|
|
1933
|
-
return 'button';
|
|
1934
|
-
}
|
|
1935
|
-
return 'div';
|
|
1936
|
-
}, [href, onClick]);
|
|
1937
|
-
const tagProps = React.useMemo(() => {
|
|
1938
|
-
if (href) {
|
|
1939
|
-
return {
|
|
1940
|
-
className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
|
|
1941
|
-
href,
|
|
1942
|
-
target: hrefTarget,
|
|
1943
|
-
};
|
|
1944
|
-
}
|
|
1945
|
-
if (onClick) {
|
|
1946
|
-
return {
|
|
1947
|
-
className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
|
|
1948
|
-
onClick,
|
|
1949
|
-
};
|
|
1950
|
-
}
|
|
1951
|
-
return {
|
|
1952
|
-
className: classNames('d-quick-action-button', className),
|
|
1953
|
-
};
|
|
1954
|
-
}, [
|
|
1955
|
-
className,
|
|
1956
|
-
href,
|
|
1957
|
-
hrefTarget,
|
|
1958
|
-
onClick,
|
|
1959
|
-
]);
|
|
1960
|
-
return (jsxRuntime.jsxs(Tag, Object.assign({ style: style }, tagProps, dataAttributes, { children: [representativeIcon && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-representative-icon", size: representativeIconHasCircle
|
|
1961
|
-
? `var(--${PREFIX_BS}quick-action-button-representative-icon-size)`
|
|
1962
|
-
: `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 }))] })));
|
|
1963
|
-
}
|
|
1964
|
-
|
|
1965
|
-
/**
|
|
1966
|
-
* @deprecated
|
|
1967
|
-
*/
|
|
1968
|
-
function DQuickActionCheck({ id: idProp, name, value, line1, line2, line3, className, style, checked, dataAttributes, onChange, }) {
|
|
1969
|
-
const innerId = React.useId();
|
|
1970
|
-
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1971
|
-
const changeHandler = React.useCallback((event) => {
|
|
1972
|
-
event.stopPropagation();
|
|
1973
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1974
|
-
}, [onChange]);
|
|
1975
|
-
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 })] })));
|
|
1976
|
-
}
|
|
1977
|
-
|
|
1978
|
-
function DQuickActionSelect({ id: idProp, name, value, line1, line2, className, style, selected = false, dataAttributes, onChange, }) {
|
|
1979
|
-
const innerRef = React.useRef(null);
|
|
1980
|
-
const innerId = React.useId();
|
|
1981
|
-
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1982
|
-
const changeHandler = React.useCallback((event) => {
|
|
1983
|
-
event.stopPropagation();
|
|
1984
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1985
|
-
}, [onChange]);
|
|
1986
|
-
React.useEffect(() => {
|
|
1987
|
-
if (innerRef.current) {
|
|
1988
|
-
innerRef.current.checked = selected;
|
|
1989
|
-
}
|
|
1990
|
-
}, [selected]);
|
|
1991
|
-
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 })] })));
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
/**
|
|
1995
|
-
* @deprecated
|
|
1996
|
-
*/
|
|
1997
|
-
function DQuickActionSwitch({ id: idProp, name, label, hint, checked, disabled, className, style, dataAttributes, onClick, }) {
|
|
1998
|
-
const innerId = React.useId();
|
|
1999
|
-
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
2000
|
-
const clickHandler = React.useCallback((event) => {
|
|
2001
|
-
event.stopPropagation();
|
|
2002
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
2003
|
-
}, [checked, onClick]);
|
|
2004
|
-
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 })] })));
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
/**
|
|
2008
|
-
* @deprecated Please use https://getbootstrap.com/docs/5.3/components/placeholders/ instead
|
|
2009
|
-
*/
|
|
2010
|
-
function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
|
|
2011
|
-
const innerBackgroundColor = React.useMemo(() => {
|
|
2012
|
-
if (backgroundColor) {
|
|
2013
|
-
return backgroundColor;
|
|
2014
|
-
}
|
|
2015
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
2016
|
-
return computedStyle.getPropertyValue(`--${PREFIX_BS}secondary-100`);
|
|
2017
|
-
}, [backgroundColor]);
|
|
2018
|
-
const innerForegroundColor = React.useMemo(() => {
|
|
2019
|
-
if (foregroundColor) {
|
|
2020
|
-
return foregroundColor;
|
|
2021
|
-
}
|
|
2022
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
2023
|
-
return computedStyle.getPropertyValue(`--${PREFIX_BS}gray-100`);
|
|
2024
|
-
}, [foregroundColor]);
|
|
2025
|
-
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 }) })));
|
|
2026
2115
|
}
|
|
2027
2116
|
|
|
2028
2117
|
function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, completed, alignStart = false, className, style, }) {
|
|
@@ -2035,13 +2124,13 @@ function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSu
|
|
|
2035
2124
|
'd-stepper-desktop': true,
|
|
2036
2125
|
'is-vertical': vertical,
|
|
2037
2126
|
'is-align-start': alignStart && !vertical,
|
|
2038
|
-
}, 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({
|
|
2039
2131
|
'd-step-icon-container': true,
|
|
2040
2132
|
'd-step-check': value < currentStep || completed,
|
|
2041
|
-
|
|
2042
|
-
}), children: value < currentStep || completed
|
|
2043
|
-
? (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconSuccessFamilyClass, familyPrefix: iconSuccessFamilyPrefix, materialStyle: iconSuccessMaterialStyle, className: "d-step-icon" }))
|
|
2044
|
-
: 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))) }));
|
|
2045
2134
|
}
|
|
2046
2135
|
|
|
2047
2136
|
function DStepper$1({ options, currentStep, className, style, }) {
|
|
@@ -2081,7 +2170,7 @@ function DStepper({ options, currentStep, iconSuccess, iconSuccessFamilyClass, i
|
|
|
2081
2170
|
const ARROW_WIDTH = 8;
|
|
2082
2171
|
const ARROW_HEIGHT = 4;
|
|
2083
2172
|
const GAP = 2;
|
|
2084
|
-
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, }) {
|
|
2085
2174
|
const [isOpen, setIsOpen] = React.useState(open);
|
|
2086
2175
|
const arrowRef = React.useRef(null);
|
|
2087
2176
|
const { refs, context, floatingStyles, } = react.useFloating({
|
|
@@ -2112,10 +2201,16 @@ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT +
|
|
|
2112
2201
|
dismiss,
|
|
2113
2202
|
role,
|
|
2114
2203
|
]);
|
|
2115
|
-
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]);
|
|
2116
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 })] }))) })] }));
|
|
2117
2206
|
}
|
|
2118
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
|
+
|
|
2119
2214
|
const TabContext = React.createContext(undefined);
|
|
2120
2215
|
function useTabContext() {
|
|
2121
2216
|
const context = React.useContext(TabContext);
|
|
@@ -2133,7 +2228,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
2133
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 }));
|
|
2134
2229
|
}
|
|
2135
2230
|
|
|
2136
|
-
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, }) {
|
|
2137
2232
|
const [selected, setSelected] = React.useState(defaultSelected);
|
|
2138
2233
|
const onSelect = React.useCallback((option) => {
|
|
2139
2234
|
if (option.tab) {
|
|
@@ -2154,9 +2249,9 @@ function DTabs({ children, defaultSelected, onChange, options, className, classN
|
|
|
2154
2249
|
'flex-column': !vertical || variant === 'tabs',
|
|
2155
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', {
|
|
2156
2251
|
active: option.tab === selected,
|
|
2157
|
-
}, 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 })] })) }));
|
|
2158
2253
|
}
|
|
2159
|
-
var DTabs
|
|
2254
|
+
var DTabs = Object.assign(DTabs$1, {
|
|
2160
2255
|
Tab: DTabContent,
|
|
2161
2256
|
});
|
|
2162
2257
|
|
|
@@ -2168,10 +2263,10 @@ function DToastBody({ children, className, style }) {
|
|
|
2168
2263
|
return (jsxRuntime.jsx("div", { className: classNames('toast-body', className), style: style, children: children }));
|
|
2169
2264
|
}
|
|
2170
2265
|
|
|
2171
|
-
function DToast({ children, className, style, dataAttributes, }) {
|
|
2266
|
+
function DToast$1({ children, className, style, dataAttributes, }) {
|
|
2172
2267
|
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('toast', className), role: "alert", "aria-live": "assertive", "aria-atomic": "true", style: style }, dataAttributes, { children: children })));
|
|
2173
2268
|
}
|
|
2174
|
-
var DToast
|
|
2269
|
+
var DToast = Object.assign(DToast$1, {
|
|
2175
2270
|
Header: DToastHeader,
|
|
2176
2271
|
Body: DToastBody,
|
|
2177
2272
|
});
|
|
@@ -2186,21 +2281,19 @@ function useDToast() {
|
|
|
2186
2281
|
if (typeof data === 'function') {
|
|
2187
2282
|
return reactHotToast.toast.custom(data, toastProps);
|
|
2188
2283
|
}
|
|
2189
|
-
const { title, description, icon, closeIcon, timestamp,
|
|
2284
|
+
const { title, description, icon, closeIcon, timestamp, color, } = data;
|
|
2190
2285
|
return reactHotToast.toast.custom(({ id, visible }) => {
|
|
2191
2286
|
if (!visible) {
|
|
2192
2287
|
return null;
|
|
2193
2288
|
}
|
|
2194
2289
|
if (!description) {
|
|
2195
|
-
return (jsxRuntime.jsx(DToast
|
|
2196
|
-
[`toast-${
|
|
2197
|
-
|
|
2198
|
-
}, '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 }) })] }) }));
|
|
2199
2293
|
}
|
|
2200
|
-
return (jsxRuntime.jsxs(DToast
|
|
2201
|
-
[`toast-${
|
|
2202
|
-
|
|
2203
|
-
}, '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 }) })] }));
|
|
2204
2297
|
}, toastProps);
|
|
2205
2298
|
}, [xLg]);
|
|
2206
2299
|
return {
|
|
@@ -2208,19 +2301,6 @@ function useDToast() {
|
|
|
2208
2301
|
};
|
|
2209
2302
|
}
|
|
2210
2303
|
|
|
2211
|
-
function DTableHead({ className, style, field, label, value = '', onChange, }) {
|
|
2212
|
-
const handleOnChange = React.useCallback(() => {
|
|
2213
|
-
if (value === field) {
|
|
2214
|
-
return onChange(`-${field}`);
|
|
2215
|
-
}
|
|
2216
|
-
if (value === `-${field}`) {
|
|
2217
|
-
return onChange('');
|
|
2218
|
-
}
|
|
2219
|
-
return onChange(field);
|
|
2220
|
-
}, [field, value, onChange]);
|
|
2221
|
-
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' }))] }) }));
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
2304
|
async function configureI8n(resources, _a = {}) {
|
|
2225
2305
|
var { lng = 'en', fallbackLng = 'en' } = _a, config = tslib.__rest(_a, ["lng", "fallbackLng"]);
|
|
2226
2306
|
return i18n
|
|
@@ -2270,7 +2350,7 @@ function validatePhoneNumber(phone) {
|
|
|
2270
2350
|
}
|
|
2271
2351
|
|
|
2272
2352
|
function DInputPhone(_a, ref) {
|
|
2273
|
-
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"]);
|
|
2274
2354
|
const innerRef = useProvidedRefOrCreate(ref);
|
|
2275
2355
|
const innerId = React.useId();
|
|
2276
2356
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
@@ -2329,13 +2409,9 @@ function DInputPhone(_a, ref) {
|
|
|
2329
2409
|
placeholder,
|
|
2330
2410
|
valid,
|
|
2331
2411
|
]);
|
|
2332
|
-
const labelComponent = React.useMemo(() => (jsxRuntime.
|
|
2412
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsx("label", { htmlFor: id, children: label })), [
|
|
2333
2413
|
id,
|
|
2334
2414
|
label,
|
|
2335
|
-
labelIcon,
|
|
2336
|
-
labelIconFamilyClass,
|
|
2337
|
-
labelIconFamilyPrefix,
|
|
2338
|
-
labelIconMaterialStyle,
|
|
2339
2415
|
]);
|
|
2340
2416
|
const dynamicComponent = React.useMemo(() => {
|
|
2341
2417
|
if (floatingLabel) {
|
|
@@ -2356,69 +2432,243 @@ function DInputPhone(_a, ref) {
|
|
|
2356
2432
|
const ForwardedDInputPhone = React.forwardRef(DInputPhone);
|
|
2357
2433
|
ForwardedDInputPhone.displayName = 'DInputPhone';
|
|
2358
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
|
+
|
|
2359
2611
|
exports.DAlert = DAlert;
|
|
2360
2612
|
exports.DAvatar = DAvatar;
|
|
2361
2613
|
exports.DBadge = DBadge;
|
|
2614
|
+
exports.DBox = DBox;
|
|
2362
2615
|
exports.DBoxFile = DBoxFile;
|
|
2363
2616
|
exports.DButton = DButton;
|
|
2364
2617
|
exports.DButtonIcon = DButtonIcon;
|
|
2365
|
-
exports.DCard = DCard
|
|
2618
|
+
exports.DCard = DCard;
|
|
2366
2619
|
exports.DCardBody = DCardBody;
|
|
2367
2620
|
exports.DCardFooter = DCardFooter;
|
|
2368
2621
|
exports.DCardHeader = DCardHeader;
|
|
2369
|
-
exports.DCarousel = DCarousel
|
|
2622
|
+
exports.DCarousel = DCarousel;
|
|
2370
2623
|
exports.DCarouselSlide = DCarouselSlide;
|
|
2371
2624
|
exports.DChip = DChip;
|
|
2372
2625
|
exports.DCollapse = DCollapse;
|
|
2373
2626
|
exports.DContext = DContext;
|
|
2374
2627
|
exports.DContextProvider = DContextProvider;
|
|
2628
|
+
exports.DCreditCard = DCreditCard;
|
|
2375
2629
|
exports.DCurrencyText = DCurrencyText;
|
|
2376
2630
|
exports.DDatePicker = DDatePicker;
|
|
2631
|
+
exports.DDropdown = DDropdown;
|
|
2377
2632
|
exports.DIcon = DIcon;
|
|
2378
2633
|
exports.DIconBase = DIconBase;
|
|
2379
2634
|
exports.DInput = ForwardedDInput;
|
|
2380
2635
|
exports.DInputCheck = DInputCheck;
|
|
2381
2636
|
exports.DInputCounter = ForwardedDInputCounter;
|
|
2382
|
-
exports.DInputCurrency =
|
|
2383
|
-
exports.DInputCurrencyBase = ForwardedDInputCurrencyBase$1;
|
|
2637
|
+
exports.DInputCurrency = ForwardedDInputCurrency;
|
|
2384
2638
|
exports.DInputMask = ForwardedDInputMask;
|
|
2385
2639
|
exports.DInputPassword = ForwardedDInputPassword;
|
|
2386
2640
|
exports.DInputPhone = ForwardedDInputPhone;
|
|
2387
2641
|
exports.DInputPin = DInputPin;
|
|
2388
2642
|
exports.DInputRange = ForwardedDInputRange;
|
|
2389
|
-
exports.DInputSearch = ForwardedDInputSearch;
|
|
2390
2643
|
exports.DInputSelect = DInputSelect;
|
|
2391
2644
|
exports.DInputSwitch = DInputSwitch;
|
|
2392
|
-
exports.
|
|
2393
|
-
exports.
|
|
2645
|
+
exports.DLayout = DLayout;
|
|
2646
|
+
exports.DLayoutPane = DLayoutPane;
|
|
2647
|
+
exports.DListGroup = DListGroup;
|
|
2394
2648
|
exports.DListGroupItem = DListGroupItem;
|
|
2395
|
-
exports.
|
|
2396
|
-
exports.DModal = DModal$1;
|
|
2649
|
+
exports.DModal = DModal;
|
|
2397
2650
|
exports.DModalBody = DModalBody;
|
|
2398
2651
|
exports.DModalFooter = DModalFooter;
|
|
2399
2652
|
exports.DModalHeader = DModalHeader;
|
|
2400
|
-
exports.DOffcanvas = DOffcanvas
|
|
2653
|
+
exports.DOffcanvas = DOffcanvas;
|
|
2401
2654
|
exports.DOffcanvasBody = DOffcanvasBody;
|
|
2402
2655
|
exports.DOffcanvasFooter = DOffcanvasFooter;
|
|
2403
2656
|
exports.DOffcanvasHeader = DOffcanvasHeader;
|
|
2404
2657
|
exports.DPaginator = DPaginator;
|
|
2658
|
+
exports.DPasswordStrengthMeter = DPasswordStrengthMeter;
|
|
2405
2659
|
exports.DPopover = DPopover;
|
|
2406
2660
|
exports.DProgress = DProgress;
|
|
2407
|
-
exports.
|
|
2408
|
-
exports.DQuickActionCheck = DQuickActionCheck;
|
|
2409
|
-
exports.DQuickActionSelect = DQuickActionSelect;
|
|
2410
|
-
exports.DQuickActionSwitch = DQuickActionSwitch;
|
|
2411
|
-
exports.DSelect = DSelect$1;
|
|
2412
|
-
exports.DSkeleton = DSkeleton;
|
|
2661
|
+
exports.DSelect = DSelect;
|
|
2413
2662
|
exports.DStepper = DStepper;
|
|
2414
2663
|
exports.DStepperDesktop = DStepper$2;
|
|
2415
2664
|
exports.DStepperMobile = DStepper$1;
|
|
2416
2665
|
exports.DTabContent = DTabContent;
|
|
2417
|
-
exports.
|
|
2418
|
-
exports.
|
|
2419
|
-
exports.DToast = DToast
|
|
2666
|
+
exports.DTabs = DTabs;
|
|
2667
|
+
exports.DTimeline = DTimeline;
|
|
2668
|
+
exports.DToast = DToast;
|
|
2420
2669
|
exports.DToastContainer = DToastContainer;
|
|
2421
2670
|
exports.DTooltip = DTooltip;
|
|
2671
|
+
exports.DVoucher = DVoucher;
|
|
2422
2672
|
exports.changeQueryString = changeQueryString;
|
|
2423
2673
|
exports.checkMediaQuery = checkMediaQuery;
|
|
2424
2674
|
exports.configureI18n = configureI8n;
|