@dynamic-framework/ui-react 2.0.0-dev.1 → 2.0.0-dev.3
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 +7153 -3699
- package/dist/css/dynamic-ui-non-root.min.css +2 -2
- package/dist/css/dynamic-ui-root.css +799 -127
- package/dist/css/dynamic-ui-root.min.css +2 -2
- package/dist/css/dynamic-ui.css +7950 -3824
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +255 -301
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +280 -310
- package/dist/index.js.map +1 -1
- package/dist/types/components/DAlert/DAlert.d.ts +3 -3
- package/dist/types/components/DAvatar/DAvatar.d.ts +1 -3
- package/dist/types/components/DBadge/DBadge.d.ts +4 -3
- package/dist/types/components/DBarChart/DBarChart.d.ts +9 -0
- package/dist/types/components/DBox/DBox.d.ts +5 -0
- package/dist/types/components/DBox/index.d.ts +2 -0
- package/dist/types/components/DButton/DButton.d.ts +6 -5
- package/dist/types/components/DButtonIcon/DButtonIcon.d.ts +3 -3
- package/dist/types/components/DChip/DChip.d.ts +3 -3
- package/dist/types/components/DCollapse/DCollapse.d.ts +1 -1
- package/dist/types/components/DCreditCard/DCreditCard.d.ts +12 -0
- package/dist/types/components/DCreditCard/index.d.ts +2 -0
- package/dist/types/components/DDatePicker/DDatePicker.d.ts +3 -3
- package/dist/types/components/DDatePicker/components/DDatePickerHeaderSelector.d.ts +2 -4
- package/dist/types/components/DDropdown/DDropdown.d.ts +20 -0
- package/dist/types/components/DDropdown/index.d.ts +2 -0
- package/dist/types/components/DIconBase/DIconBase.d.ts +4 -8
- package/dist/types/components/DInput/DInput.d.ts +2 -2
- package/dist/types/components/DInputCounter/DInputCounter.d.ts +2 -2
- package/dist/types/components/DInputCurrency/DInputCurrency.d.ts +3 -3
- package/dist/types/components/DInputMask/DInputMask.d.ts +1 -1
- 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/DLayout/DLayout.d.ts +21 -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/DMinimalLineChart/DMinimalLineChart.d.ts +9 -0
- package/dist/types/components/DMultiLineChart/DMultiLineChart.d.ts +9 -0
- 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/DPieChart/DPieChart.d.ts +9 -0
- package/dist/types/components/DProgress/DProgress.d.ts +2 -1
- package/dist/types/components/DRadialBarChart/DRadialBarChart.d.ts +6 -0
- 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/index.d.ts +5 -8
- package/dist/types/components/interface.d.ts +3 -8
- package/package.json +8 -3
- package/src/style/_shame.scss +42 -1
- package/src/style/abstracts/_mixins.scss +1 -7
- package/src/style/abstracts/_utilities.scss +51 -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 +17 -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 +140 -69
- 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 +148 -22
- package/src/style/base/_dropdown.scss +18 -0
- package/src/style/base/_input-group.scss +5 -0
- 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 +4 -4
- package/src/style/components/_d-avatar.scss +2 -20
- 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 +64 -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/helpers/_color-bg.scss +13 -3
- package/src/style/root/_root.scss +35 -18
- 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/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,9 +1,10 @@
|
|
|
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');
|
|
8
9
|
var fileSelector = require('file-selector');
|
|
9
10
|
var reactSplide = require('@splidejs/react-splide');
|
|
@@ -14,55 +15,85 @@ var Select = require('react-select');
|
|
|
14
15
|
var mask = require('@react-input/mask');
|
|
15
16
|
var ResponsivePagination = require('react-responsive-pagination');
|
|
16
17
|
var react = require('@floating-ui/react');
|
|
17
|
-
var ContentLoader = require('react-content-loader');
|
|
18
18
|
var reactHotToast = require('react-hot-toast');
|
|
19
19
|
var reactInternationalPhone = require('react-international-phone');
|
|
20
20
|
var googleLibphonenumber = require('google-libphonenumber');
|
|
21
21
|
var i18n = require('i18next');
|
|
22
22
|
var reactI18next = require('react-i18next');
|
|
23
23
|
|
|
24
|
+
function _interopNamespaceDefault(e) {
|
|
25
|
+
var n = Object.create(null);
|
|
26
|
+
if (e) {
|
|
27
|
+
Object.keys(e).forEach(function (k) {
|
|
28
|
+
if (k !== 'default') {
|
|
29
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
30
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return e[k]; }
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
n.default = e;
|
|
38
|
+
return Object.freeze(n);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var LucideIcons__namespace = /*#__PURE__*/_interopNamespaceDefault(LucideIcons);
|
|
42
|
+
|
|
24
43
|
const PREFIX_BS = 'bs-';
|
|
25
44
|
|
|
26
|
-
function DIconBase({ icon,
|
|
45
|
+
function DIconBase({ icon, color, style, className, size, hasCircle = false, materialStyle = false, familyClass = 'material-symbols-outlined', strokeWidth = 2, dataAttributes, }) {
|
|
46
|
+
// If materialStyle is true, use Material Design icons (legacy)
|
|
47
|
+
const useMaterialIcons = materialStyle;
|
|
48
|
+
// Get Lucide icon component
|
|
49
|
+
const LucideIcon = React.useMemo(() => {
|
|
50
|
+
if (useMaterialIcons)
|
|
51
|
+
return null;
|
|
52
|
+
// Try to find the icon in Lucide (expects PascalCase)
|
|
53
|
+
const icons = LucideIcons__namespace;
|
|
54
|
+
return icons[icon] || null;
|
|
55
|
+
}, [icon, useMaterialIcons]);
|
|
27
56
|
const colorStyle = React.useMemo(() => {
|
|
28
57
|
if (color) {
|
|
29
|
-
return { [`--${PREFIX_BS}icon-component-color`]: color };
|
|
30
|
-
}
|
|
31
|
-
if (theme) {
|
|
32
|
-
return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${theme})` };
|
|
58
|
+
return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${color})` };
|
|
33
59
|
}
|
|
34
60
|
return {};
|
|
35
|
-
}, [color
|
|
61
|
+
}, [color]);
|
|
36
62
|
const backgroundStyle = React.useMemo(() => {
|
|
37
|
-
if (backgroundColor) {
|
|
38
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: backgroundColor };
|
|
39
|
-
}
|
|
40
63
|
if (hasCircle) {
|
|
41
|
-
if (
|
|
42
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${
|
|
64
|
+
if (color) {
|
|
65
|
+
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${color}-rgb), 0.1)` };
|
|
43
66
|
}
|
|
44
67
|
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}body-color-rgb), 0.1)` };
|
|
45
68
|
}
|
|
46
69
|
return {};
|
|
47
|
-
}, [
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
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,
|
|
70
|
+
}, [hasCircle, color]);
|
|
71
|
+
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, size && { [`--${PREFIX_BS}icon-component-size`]: size }), colorStyle), backgroundStyle), hasCircle && { [`--${PREFIX_BS}icon-component-padding`]: `calc(var(--${PREFIX_BS}icon-component-size, 24px) * 0.4)` }), style)), [size, colorStyle, backgroundStyle, hasCircle, style]);
|
|
72
|
+
const generateClasses = React.useMemo(() => (Object.assign(Object.assign({ 'd-icon': true }, useMaterialIcons && {
|
|
73
|
+
[familyClass]: true,
|
|
57
74
|
}), className && { [className]: true })), [
|
|
58
|
-
familyClass,
|
|
59
|
-
loading,
|
|
60
75
|
className,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
icon,
|
|
76
|
+
useMaterialIcons,
|
|
77
|
+
familyClass,
|
|
64
78
|
]);
|
|
65
|
-
|
|
79
|
+
const iconSize = React.useMemo(() => {
|
|
80
|
+
if (size) {
|
|
81
|
+
const numSize = parseInt(size, 10);
|
|
82
|
+
return !Number.isNaN(numSize) ? numSize : size;
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}, [size]);
|
|
86
|
+
// Render Material Design icon (legacy support)
|
|
87
|
+
if (useMaterialIcons) {
|
|
88
|
+
return (jsxRuntime.jsx("i", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: icon })));
|
|
89
|
+
}
|
|
90
|
+
// Render Lucide icon
|
|
91
|
+
if (!LucideIcon) {
|
|
92
|
+
// eslint-disable-next-line no-console
|
|
93
|
+
console.warn(`Icon "${icon}" not found in Lucide. Make sure to use PascalCase names (e.g., "Home", "User", "Settings")`);
|
|
94
|
+
return (jsxRuntime.jsx("span", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: "?" })));
|
|
95
|
+
}
|
|
96
|
+
return (jsxRuntime.jsx("span", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: jsxRuntime.jsx(LucideIcon, { size: iconSize || 24, strokeWidth: strokeWidth }) })));
|
|
66
97
|
}
|
|
67
98
|
|
|
68
99
|
function useDisableBodyScrollEffect(disable) {
|
|
@@ -250,31 +281,27 @@ const DEFAULT_STATE = {
|
|
|
250
281
|
materialStyle: false,
|
|
251
282
|
},
|
|
252
283
|
iconMap: {
|
|
253
|
-
x: '
|
|
254
|
-
xLg: '
|
|
255
|
-
chevronUp: '
|
|
256
|
-
chevronDown: '
|
|
257
|
-
chevronLeft: '
|
|
258
|
-
chevronRight: '
|
|
259
|
-
upload: '
|
|
260
|
-
calendar: '
|
|
261
|
-
check: '
|
|
284
|
+
x: 'X',
|
|
285
|
+
xLg: 'X',
|
|
286
|
+
chevronUp: 'ChevronUp',
|
|
287
|
+
chevronDown: 'ChevronDown',
|
|
288
|
+
chevronLeft: 'ChevronLeft',
|
|
289
|
+
chevronRight: 'ChevronRight',
|
|
290
|
+
upload: 'Upload',
|
|
291
|
+
calendar: 'Calendar',
|
|
292
|
+
check: 'Check',
|
|
262
293
|
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',
|
|
294
|
+
warning: 'AlertCircle',
|
|
295
|
+
danger: 'AlertTriangle',
|
|
296
|
+
success: 'CheckCircle',
|
|
297
|
+
info: 'Info',
|
|
271
298
|
},
|
|
272
299
|
input: {
|
|
273
|
-
search: '
|
|
274
|
-
show: '
|
|
275
|
-
hide: '
|
|
276
|
-
increase: '
|
|
277
|
-
decrease: '
|
|
300
|
+
search: 'Search',
|
|
301
|
+
show: 'Eye',
|
|
302
|
+
hide: 'EyeOff',
|
|
303
|
+
increase: 'Plus',
|
|
304
|
+
decrease: 'Minus',
|
|
278
305
|
},
|
|
279
306
|
},
|
|
280
307
|
breakpoints: {
|
|
@@ -327,25 +354,19 @@ function DIcon(_a) {
|
|
|
327
354
|
return (jsxRuntime.jsx(DIconBase, Object.assign({ familyClass: propFamilyClass || familyClass, familyPrefix: propFamilyPrefix || familyPrefix, materialStyle: propMaterialStyle || materialStyle }, props)));
|
|
328
355
|
}
|
|
329
356
|
|
|
330
|
-
function DAlert({
|
|
357
|
+
function DAlert({ color = 'success', icon: iconProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle = false, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle = false, showClose, onClose, children, id, className, style, dataAttributes, }) {
|
|
331
358
|
const { iconMap: { alert, xLg, }, } = useDContext();
|
|
332
|
-
const icon = React.useMemo(() => iconProp || alert[
|
|
359
|
+
const icon = React.useMemo(() => iconProp || alert[color], [alert, iconProp, color]);
|
|
333
360
|
const iconClose = React.useMemo(() => (iconCloseProp || xLg), [iconCloseProp, xLg]);
|
|
334
|
-
const generateClasses = React.useMemo(() => (Object.assign({ alert: true, [`alert-${
|
|
361
|
+
const generateClasses = React.useMemo(() => (Object.assign({ alert: true, [`alert-${color}`]: true, 'fade show': !!showClose }, className && { [className]: true })), [color, showClose, className]);
|
|
335
362
|
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames(generateClasses), style: style, role: "alert", id: id }, dataAttributes, { children: [icon && (jsxRuntime.jsx(DIcon, { className: "alert-icon", icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsxRuntime.jsx("div", { className: "alert-text", children: children }), showClose && (jsxRuntime.jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: iconClose, familyClass: iconCloseFamilyClass, familyPrefix: iconCloseFamilyPrefix, materialStyle: iconCloseMaterialStyle }) }))] })));
|
|
336
363
|
}
|
|
337
364
|
|
|
338
|
-
function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false,
|
|
339
|
-
const generateClasses = React.useMemo(() => {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
return {
|
|
344
|
-
'd-avatar': true,
|
|
345
|
-
[variantClass]: true,
|
|
346
|
-
[`d-avatar-${size}`]: !!size,
|
|
347
|
-
};
|
|
348
|
-
}, [variant, theme, size]);
|
|
365
|
+
function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, className, style, dataAttributes, }) {
|
|
366
|
+
const generateClasses = React.useMemo(() => ({
|
|
367
|
+
'd-avatar': true,
|
|
368
|
+
[`d-avatar-${size}`]: !!size,
|
|
369
|
+
}), [size]);
|
|
349
370
|
const name = React.useMemo(() => {
|
|
350
371
|
if (!nameProp) {
|
|
351
372
|
return undefined;
|
|
@@ -358,16 +379,21 @@ function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, t
|
|
|
358
379
|
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames(generateClasses, className), style: style, id: id }, dataAttributes, { children: [image && jsxRuntime.jsx("img", { src: image, alt: nameProp, className: "d-avatar-img" }), (name && !image) && jsxRuntime.jsx("span", { className: "d-avatar-name", children: name })] })));
|
|
359
380
|
}
|
|
360
381
|
|
|
361
|
-
function DBadge({ text, soft = false,
|
|
382
|
+
function DBadge({ text, soft = false, color = 'primary', id, rounded, className, size, style, iconStart, iconEnd, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, dataAttributes, }) {
|
|
362
383
|
const generateClasses = React.useMemo(() => ({
|
|
363
384
|
badge: true,
|
|
364
|
-
[`badge-${
|
|
365
|
-
[`badge-soft-${
|
|
385
|
+
[`badge-${color}`]: !!color && !soft,
|
|
386
|
+
[`badge-soft-${color}`]: !!color && soft,
|
|
366
387
|
'rounded-pill': !!rounded,
|
|
367
|
-
|
|
388
|
+
[`badge-${size}`]: !!size,
|
|
389
|
+
}), [rounded, soft, color, size]);
|
|
368
390
|
return (jsxRuntime.jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, dataAttributes, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsxRuntime.jsx("span", { children: text }), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }))] })));
|
|
369
391
|
}
|
|
370
392
|
|
|
393
|
+
function DBox({ className, style, children, dataAttributes, }) {
|
|
394
|
+
return (jsxRuntime.jsx("div", Object.assign({ style: style, className: classNames('d-box', className) }, dataAttributes, { children: children })));
|
|
395
|
+
}
|
|
396
|
+
|
|
371
397
|
/* eslint-disable */
|
|
372
398
|
/**
|
|
373
399
|
* This file is originally from `@primer/react`
|
|
@@ -389,7 +415,7 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
389
415
|
}
|
|
390
416
|
|
|
391
417
|
function DInput(_a, ref) {
|
|
392
|
-
var { id: idProp, style, className, label = '',
|
|
418
|
+
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, 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", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
393
419
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
394
420
|
const innerId = React.useId();
|
|
395
421
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
@@ -440,13 +466,9 @@ function DInput(_a, ref) {
|
|
|
440
466
|
valid,
|
|
441
467
|
value,
|
|
442
468
|
]);
|
|
443
|
-
const labelComponent = React.useMemo(() => (jsxRuntime.
|
|
469
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsx("label", { htmlFor: id, children: label })), [
|
|
444
470
|
id,
|
|
445
471
|
label,
|
|
446
|
-
labelIcon,
|
|
447
|
-
labelIconFamilyClass,
|
|
448
|
-
labelIconFamilyPrefix,
|
|
449
|
-
labelIconMaterialStyle,
|
|
450
472
|
]);
|
|
451
473
|
const dynamicComponent = React.useMemo(() => {
|
|
452
474
|
if (floatingLabel) {
|
|
@@ -575,7 +597,7 @@ async function urlToFile(url) {
|
|
|
575
597
|
null,
|
|
576
598
|
{
|
|
577
599
|
code: ErrorCodes.FailedFetch,
|
|
578
|
-
message: `Failed to fetch file from ${url}`,
|
|
600
|
+
message: `Failed to fetch file from ${url} (HTTP ${res.status})`,
|
|
579
601
|
},
|
|
580
602
|
];
|
|
581
603
|
}
|
|
@@ -585,11 +607,13 @@ async function urlToFile(url) {
|
|
|
585
607
|
return [file, null];
|
|
586
608
|
}
|
|
587
609
|
catch (error) {
|
|
610
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
611
|
+
const isCorsError = errorMessage.includes('CORS') || errorMessage.includes('Failed to fetch');
|
|
588
612
|
return [
|
|
589
613
|
null,
|
|
590
614
|
{
|
|
591
615
|
code: ErrorCodes.FailedFetch,
|
|
592
|
-
message: `Failed to fetch file from ${url}}`,
|
|
616
|
+
message: `Failed to fetch file from ${url}${isCorsError ? ' (CORS error - file may not be accessible from this domain)' : ` (${errorMessage})`}`,
|
|
593
617
|
},
|
|
594
618
|
];
|
|
595
619
|
}
|
|
@@ -865,13 +889,13 @@ function DBoxFile(_a) {
|
|
|
865
889
|
: children })] })) })), !!files.length && (jsxRuntime.jsx("ul", { className: "d-box-files", children: files.map((file, index) => (jsxRuntime.jsx(ForwardedDInput, { value: file.name, iconStart: "paperclip", iconEnd: "trash", readOnly: true, onIconEndClick: () => handleRemoveFile(index) }, `${file.name} ${index}`))) }))] }));
|
|
866
890
|
}
|
|
867
891
|
|
|
868
|
-
function DButton({
|
|
892
|
+
function DButton({ color = 'primary', size, variant, state, text = '', children, ariaLabel, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, loadingText, value, type = 'button', loading = false, loadingAriaLabel, disabled = false, stopPropagationEnabled = true, className, style, form, dataAttributes, onClick, }) {
|
|
869
893
|
const generateClasses = React.useMemo(() => {
|
|
870
894
|
const variantClass = variant
|
|
871
|
-
? `btn-${variant}-${
|
|
872
|
-
: `btn-${
|
|
895
|
+
? `btn-${variant}-${color}`
|
|
896
|
+
: `btn-${color}`;
|
|
873
897
|
return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
|
|
874
|
-
}, [variant,
|
|
898
|
+
}, [variant, color, size, state, loading]);
|
|
875
899
|
const clickHandler = React.useCallback((event) => {
|
|
876
900
|
if (stopPropagationEnabled) {
|
|
877
901
|
event.stopPropagation();
|
|
@@ -879,19 +903,20 @@ function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel
|
|
|
879
903
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
880
904
|
}, [stopPropagationEnabled, onClick]);
|
|
881
905
|
const isDisabled = React.useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
|
|
906
|
+
const content = children || text;
|
|
882
907
|
const newAriaLabel = React.useMemo(() => (loading
|
|
883
908
|
? (loadingAriaLabel || ariaLabel || text)
|
|
884
909
|
: (ariaLabel || text)), [loading, loadingAriaLabel, ariaLabel, text]);
|
|
885
|
-
return (jsxRuntime.jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: style, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel, form: form }, dataAttributes, value && { value }, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })),
|
|
910
|
+
return (jsxRuntime.jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: style, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel, form: form }, dataAttributes, value && { value }, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })), loading && (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) })), jsxRuntime.jsx("span", { children: loading && loadingText ? loadingText : content }), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }))] })));
|
|
886
911
|
}
|
|
887
912
|
|
|
888
|
-
function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel,
|
|
913
|
+
function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel, color = 'primary', type = 'button', loading = false, disabled = false, stopPropagationEnabled = true, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, }) {
|
|
889
914
|
const generateClasses = React.useMemo(() => {
|
|
890
915
|
const variantClass = variant
|
|
891
|
-
? `btn-${variant}-${
|
|
892
|
-
: `btn-${
|
|
916
|
+
? `btn-${variant}-${color}`
|
|
917
|
+
: `btn-${color}`;
|
|
893
918
|
return Object.assign(Object.assign(Object.assign({ 'btn d-button-icon': true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
|
|
894
|
-
}, [variant,
|
|
919
|
+
}, [variant, color, size, state, loading]);
|
|
895
920
|
const clickHandler = React.useCallback((event) => {
|
|
896
921
|
if (stopPropagationEnabled) {
|
|
897
922
|
event.stopPropagation();
|
|
@@ -952,11 +977,11 @@ var DCarousel$1 = Object.assign(ForwardedDCarousel, {
|
|
|
952
977
|
Slide: DCarouselSlide,
|
|
953
978
|
});
|
|
954
979
|
|
|
955
|
-
function DChip({
|
|
980
|
+
function DChip({ color = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle, showClose = false, closeAriaLabel = 'close', className, style, dataAttributes, onClose, }) {
|
|
956
981
|
const generateClasses = React.useMemo(() => ({
|
|
957
982
|
'd-chip': true,
|
|
958
|
-
[`d-chip-${
|
|
959
|
-
}), [
|
|
983
|
+
[`d-chip-${color}`]: !!color,
|
|
984
|
+
}), [color]);
|
|
960
985
|
const { iconMap: { xLg, }, } = useDContext();
|
|
961
986
|
const iconClose = React.useMemo(() => iconCloseProp || xLg, [iconCloseProp, xLg]);
|
|
962
987
|
return (jsxRuntime.jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, dataAttributes, { children: [icon && (jsxRuntime.jsx("div", { className: "d-chip-icon-container", children: jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), jsxRuntime.jsx("span", { children: text }), showClose && (jsxRuntime.jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, "aria-label": closeAriaLabel, children: jsxRuntime.jsx(DIcon, { icon: iconClose, familyClass: iconCloseFamilyClass, familyPrefix: iconCloseFamilyPrefix, materialStyle: iconCloseMaterialStyle }) }))] })));
|
|
@@ -979,7 +1004,7 @@ function DCollapse({ id, className, style, Component, hasSeparator = false, defa
|
|
|
979
1004
|
const generateStyles = React.useMemo(() => ({
|
|
980
1005
|
[`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
|
|
981
1006
|
}), [hasSeparator]);
|
|
982
|
-
return (jsxRuntime.jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { children: [jsxRuntime.jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: Component }), jsxRuntime.jsx(DIcon, { color:
|
|
1007
|
+
return (jsxRuntime.jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { children: [jsxRuntime.jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: Component }), jsxRuntime.jsx(DIcon, { color: "gray", size: "1rem", icon: collapsed ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), !collapsed && (jsxRuntime.jsx("div", { className: classNames({
|
|
983
1008
|
'collapse-body': true,
|
|
984
1009
|
}), style: generateStyles, children: children }))] })));
|
|
985
1010
|
}
|
|
@@ -1143,7 +1168,7 @@ function DSelectPlaceholder(_a) {
|
|
|
1143
1168
|
}
|
|
1144
1169
|
|
|
1145
1170
|
function DSelect(_a) {
|
|
1146
|
-
var { id: idProp, className, style, label,
|
|
1171
|
+
var { id: idProp, className, style, label, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, floatingLabel = false, rtl, searchable, multi, components, defaultValue, placeholder, onIconStartClick, onIconEndClick, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "className", "style", "label", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "floatingLabel", "rtl", "searchable", "multi", "components", "defaultValue", "placeholder", "onIconStartClick", "onIconEndClick", "dataAttributes"]);
|
|
1147
1172
|
const innerId = React.useId();
|
|
1148
1173
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1149
1174
|
const handleOnIconStartClick = React.useCallback(() => {
|
|
@@ -1155,7 +1180,7 @@ function DSelect(_a) {
|
|
|
1155
1180
|
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('d-select', className, {
|
|
1156
1181
|
'd-select-floating': floatingLabel,
|
|
1157
1182
|
disabled: disabled || loading,
|
|
1158
|
-
}), style: style }, dataAttributes, { children: [label && (jsxRuntime.
|
|
1183
|
+
}), style: style }, dataAttributes, { children: [label && (jsxRuntime.jsx("label", { htmlFor: id, children: label })), jsxRuntime.jsxs("div", { className: classNames({
|
|
1159
1184
|
'input-group': true,
|
|
1160
1185
|
'has-validation': invalid,
|
|
1161
1186
|
disabled: disabled || loading,
|
|
@@ -1189,7 +1214,7 @@ var PickerType;
|
|
|
1189
1214
|
PickerType["Month"] = "month";
|
|
1190
1215
|
PickerType["Year"] = "year";
|
|
1191
1216
|
})(PickerType || (PickerType = {}));
|
|
1192
|
-
function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMonth, increaseMonth, decreaseYear, increaseYear, monthDate, pickerType, prevMonthButtonDisabled, nextMonthButtonDisabled, monthsShown = 1, iconPrev, iconNext, prevYearButtonDisabled, nextYearButtonDisabled,
|
|
1217
|
+
function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMonth, increaseMonth, decreaseYear, increaseYear, monthDate, pickerType, prevMonthButtonDisabled, nextMonthButtonDisabled, monthsShown = 1, iconPrev, iconNext, prevYearButtonDisabled, nextYearButtonDisabled, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', prevYearAriaLabel = 'decrease year', nextYearAriaLabel = 'increase year', iconSize, style, className, minYearSelect = 1900, maxYearSelect = 2100, showHeaderSelectors = false, customHeaderCount, locale, }) {
|
|
1193
1218
|
const { iconMap: { chevronLeft, chevronRight, }, } = useDContext();
|
|
1194
1219
|
const arrayYears = React.useMemo(() => Array.from({ length: maxYearSelect - minYearSelect + 1 }, (_, index) => minYearSelect + index), [maxYearSelect, minYearSelect]);
|
|
1195
1220
|
const years = React.useMemo(() => arrayYears.map((year) => ({
|
|
@@ -1214,16 +1239,16 @@ function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMont
|
|
|
1214
1239
|
}, [date]);
|
|
1215
1240
|
const [startYear, endYear] = getYearRange();
|
|
1216
1241
|
if (pickerType === PickerType.Year) {
|
|
1217
|
-
return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsxRuntime.jsx(
|
|
1242
|
+
return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevYearButtonDisabled, ariaLabel: prevYearAriaLabel, className: "header-button" }), jsxRuntime.jsx("p", { children: `${startYear} - ${endYear}` }), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextYearButtonDisabled, ariaLabel: nextYearAriaLabel, className: "header-button" })] }));
|
|
1218
1243
|
}
|
|
1219
1244
|
if (pickerType === PickerType.Quarter || pickerType === PickerType.Month) {
|
|
1220
|
-
return (jsxRuntime.jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsxRuntime.jsx(
|
|
1245
|
+
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$1, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })) : (jsxRuntime.jsx("p", { children: defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label })) }), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] }));
|
|
1221
1246
|
}
|
|
1222
|
-
return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [jsxRuntime.jsx(
|
|
1247
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "datepicker-top-header", children: [showHeaderSelectors && (jsxRuntime.jsx("select", { value: defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.value, onChange: (e) => changeYear(Number(e.target.value)), className: "custom-year-selector", children: years.map((year) => (jsxRuntime.jsx("option", { value: year.value, children: year.label }, year.value))) })), 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$1, { options: months, value: defaultMonth, defaultValue: defaultMonth, onChange: (month) => changeMonth((month === null || month === void 0 ? void 0 : month.value) || 0), searchable: false, className: "custom-month-selector" })) : (jsxRuntime.jsx("p", { children: `${defaultMonth.label} ${defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label}` })), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] })] }));
|
|
1223
1248
|
}
|
|
1224
1249
|
|
|
1225
1250
|
function DDatePicker(_a) {
|
|
1226
|
-
var { inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeInputLabel,
|
|
1251
|
+
var { inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeInputLabel, minYearSelect, maxYearSelect, iconHeaderSize, iconMaterialStyle, iconInput, headerPrevMonthAriaLabel, headerNextMonthAriaLabel, invalid = false, valid = false, renderCustomHeader: renderCustomHeaderProp, className, dateFormatCalendar: dateFormatCalendarProp, style, dataAttributes, placeholder, showHeaderSelectors } = _a, props = tslib.__rest(_a, ["inputLabel", "inputHint", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeInputLabel", "minYearSelect", "maxYearSelect", "iconHeaderSize", "iconMaterialStyle", "iconInput", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "invalid", "valid", "renderCustomHeader", "className", "dateFormatCalendar", "style", "dataAttributes", "placeholder", "showHeaderSelectors"]);
|
|
1227
1252
|
const pickerType = React.useMemo(() => {
|
|
1228
1253
|
if (props.showQuarterYearPicker)
|
|
1229
1254
|
return PickerType.Quarter;
|
|
@@ -1237,15 +1262,10 @@ function DDatePicker(_a) {
|
|
|
1237
1262
|
props.showMonthYearPicker,
|
|
1238
1263
|
props.showYearPicker,
|
|
1239
1264
|
]);
|
|
1240
|
-
const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeaderSelector, Object.assign({}, headerProps, { monthsShown: props.monthsShown,
|
|
1241
|
-
iconHeaderNext,
|
|
1242
|
-
iconHeaderPrev,
|
|
1243
|
-
iconMaterialStyle,
|
|
1265
|
+
const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeaderSelector, Object.assign({}, headerProps, { monthsShown: props.monthsShown, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize: iconHeaderSize, minYearSelect: minYearSelect, maxYearSelect: maxYearSelect, pickerType: pickerType, showHeaderSelectors: showHeaderSelectors, locale: props.locale }))), [
|
|
1244
1266
|
headerPrevMonthAriaLabel,
|
|
1245
1267
|
headerNextMonthAriaLabel,
|
|
1246
1268
|
iconHeaderSize,
|
|
1247
|
-
headerButtonVariant,
|
|
1248
|
-
headerButtonTheme,
|
|
1249
1269
|
minYearSelect,
|
|
1250
1270
|
maxYearSelect,
|
|
1251
1271
|
pickerType,
|
|
@@ -1258,6 +1278,32 @@ function DDatePicker(_a) {
|
|
|
1258
1278
|
return (jsxRuntime.jsx(DatePicker, Object.assign({}, dataAttributes, props, { calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, placeholderText: placeholder, customInput: (jsxRuntime.jsx(ForwardedDDatePickerInput, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyle, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, hint: inputHint })), customTimeInput: (jsxRuntime.jsx(DDatePickerTime, { id: timeId })) })));
|
|
1259
1279
|
}
|
|
1260
1280
|
|
|
1281
|
+
function DLayoutPane({ className, style, children, cols, colsXs, colsSm, colsMd, colsLg, colsXl, colsXxl, dataAttributes, }) {
|
|
1282
|
+
const colsClass = cols ? `g-col-${cols}` : undefined;
|
|
1283
|
+
const colsXsClass = colsXs ? `g-col-${colsXs}` : undefined;
|
|
1284
|
+
const colsSmClass = colsSm ? `g-col-sm-${colsSm}` : undefined;
|
|
1285
|
+
const colsMdClass = colsMd ? `g-col-md-${colsMd}` : undefined;
|
|
1286
|
+
const colsLgClass = colsLg ? `g-col-lg-${colsLg}` : undefined;
|
|
1287
|
+
const colsXlClass = colsXl ? `g-col-xl-${colsXl}` : undefined;
|
|
1288
|
+
const colsXxlClass = colsXxl ? `g-col-xxl-${colsXxl}` : undefined;
|
|
1289
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames(colsClass, colsXsClass, colsSmClass, colsMdClass, colsLgClass, colsXlClass, colsXxlClass, className), style: style }, dataAttributes, { children: children })));
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
function DLayout({ className, style, children, gap, gapSm, gapMd, gapLg, gapXl, gapXxl, dataAttributes, }) {
|
|
1293
|
+
const gapClasses = classNames({
|
|
1294
|
+
[`gap-${gap}`]: gap !== undefined,
|
|
1295
|
+
[`gap-sm-${gapSm}`]: gapSm !== undefined,
|
|
1296
|
+
[`gap-md-${gapMd}`]: gapMd !== undefined,
|
|
1297
|
+
[`gap-lg-${gapLg}`]: gapLg !== undefined,
|
|
1298
|
+
[`gap-xl-${gapXl}`]: gapXl !== undefined,
|
|
1299
|
+
[`gap-xxl-${gapXxl}`]: gapXxl !== undefined,
|
|
1300
|
+
});
|
|
1301
|
+
return (jsxRuntime.jsx("div", Object.assign({ style: style, className: classNames('grid', gapClasses, className) }, dataAttributes, { children: children })));
|
|
1302
|
+
}
|
|
1303
|
+
var DLayout$1 = Object.assign(DLayout, {
|
|
1304
|
+
Pane: DLayoutPane,
|
|
1305
|
+
});
|
|
1306
|
+
|
|
1261
1307
|
function DInputMask(props, ref) {
|
|
1262
1308
|
return (jsxRuntime.jsx(mask.InputMask, Object.assign({ ref: ref, component: ForwardedDInput }, props)));
|
|
1263
1309
|
}
|
|
@@ -1441,18 +1487,6 @@ function DInputCounter(_a, ref) {
|
|
|
1441
1487
|
const ForwardedDInputCounter = React.forwardRef(DInputCounter);
|
|
1442
1488
|
ForwardedDInputCounter.displayName = 'DInputCounter';
|
|
1443
1489
|
|
|
1444
|
-
/**
|
|
1445
|
-
* @deprecated
|
|
1446
|
-
*/
|
|
1447
|
-
function DInputCurrencyBase(_a, ref) {
|
|
1448
|
-
var { value, minValue, maxValue, currencyOptions, currencyCode, onFocus, onBlur, onChange } = _a, inputProps = tslib.__rest(_a, ["value", "minValue", "maxValue", "currencyOptions", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
1449
|
-
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
1450
|
-
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
1451
|
-
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsxRuntime.jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, inputProps)));
|
|
1452
|
-
}
|
|
1453
|
-
const ForwardedDInputCurrencyBase$1 = React.forwardRef(DInputCurrencyBase);
|
|
1454
|
-
ForwardedDInputCurrencyBase$1.displayName = 'DInputCurrencyBase';
|
|
1455
|
-
|
|
1456
1490
|
function DInputCurrency(_a, ref) {
|
|
1457
1491
|
var { value, minValue, maxValue, currencyCode, onFocus, onBlur, onChange } = _a, props = tslib.__rest(_a, ["value", "minValue", "maxValue", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
1458
1492
|
const { currency: currencyOptions } = useDContext();
|
|
@@ -1460,19 +1494,8 @@ function DInputCurrency(_a, ref) {
|
|
|
1460
1494
|
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
1461
1495
|
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsxRuntime.jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, props)));
|
|
1462
1496
|
}
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
/**
|
|
1467
|
-
* @deprecated
|
|
1468
|
-
*/
|
|
1469
|
-
function DInputSearch(_a, ref) {
|
|
1470
|
-
var { type, iconEnd: iconEndProp, iconEndAriaLabel = 'search' } = _a, props = tslib.__rest(_a, ["type", "iconEnd", "iconEndAriaLabel"]);
|
|
1471
|
-
const inputRef = useProvidedRefOrCreate(ref);
|
|
1472
|
-
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", iconEndAriaLabel: iconEndAriaLabel }, props)));
|
|
1473
|
-
}
|
|
1474
|
-
const ForwardedDInputSearch = React.forwardRef(DInputSearch);
|
|
1475
|
-
ForwardedDInputSearch.displayName = 'DInputSearch';
|
|
1497
|
+
const ForwardedDInputCurrency = React.forwardRef(DInputCurrency);
|
|
1498
|
+
ForwardedDInputCurrency.displayName = 'DInputCurrency';
|
|
1476
1499
|
|
|
1477
1500
|
function DInputPassword(_a, ref) {
|
|
1478
1501
|
var { onIconEndClick, iconEndAriaLabel = 'show/hide password' } = _a, props = tslib.__rest(_a, ["onIconEndClick", "iconEndAriaLabel"]);
|
|
@@ -1489,7 +1512,7 @@ function DInputPassword(_a, ref) {
|
|
|
1489
1512
|
const ForwardedDInputPassword = React.forwardRef(DInputPassword);
|
|
1490
1513
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
1491
1514
|
|
|
1492
|
-
function DInputPin({ id: idProp, label = '',
|
|
1515
|
+
function DInputPin({ id: idProp, label = '', placeholder, type = 'text', disabled = false, loading = false, secret = false, characters = 4, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, dataAttributes, onChange, }) {
|
|
1493
1516
|
const innerId = React.useId();
|
|
1494
1517
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1495
1518
|
const [pattern, setPattern] = React.useState('');
|
|
@@ -1522,7 +1545,8 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1522
1545
|
}
|
|
1523
1546
|
if (input.value !== '') {
|
|
1524
1547
|
setActiveInput((prev) => {
|
|
1525
|
-
const newValue = prev
|
|
1548
|
+
const newValue = [...prev];
|
|
1549
|
+
newValue[index] = input.value;
|
|
1526
1550
|
return newValue;
|
|
1527
1551
|
});
|
|
1528
1552
|
if (input.nextSibling) {
|
|
@@ -1538,7 +1562,8 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1538
1562
|
if (key === 'Backspace') {
|
|
1539
1563
|
const { value } = currentTarget;
|
|
1540
1564
|
setActiveInput((prev) => {
|
|
1541
|
-
const newVal = prev
|
|
1565
|
+
const newVal = [...prev];
|
|
1566
|
+
newVal[index] = '';
|
|
1542
1567
|
return newVal;
|
|
1543
1568
|
});
|
|
1544
1569
|
if (currentTarget.previousSibling && value === '') {
|
|
@@ -1551,19 +1576,23 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1551
1576
|
}
|
|
1552
1577
|
}, []);
|
|
1553
1578
|
const focusInput = React.useCallback((index) => {
|
|
1554
|
-
setActiveInput((prev) =>
|
|
1579
|
+
setActiveInput((prev) => {
|
|
1580
|
+
const newVal = [...prev];
|
|
1581
|
+
newVal[index] = '';
|
|
1582
|
+
return newVal;
|
|
1583
|
+
});
|
|
1555
1584
|
}, []);
|
|
1556
1585
|
const wheelInput = React.useCallback((event) => {
|
|
1557
1586
|
event.currentTarget.blur();
|
|
1558
1587
|
}, []);
|
|
1559
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('d-input-pin', className), style: style }, dataAttributes, { children: [label && (jsxRuntime.
|
|
1588
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('d-input-pin', className), style: style }, dataAttributes, { children: [label && (jsxRuntime.jsx("label", { htmlFor: "pinIndex0", children: label })), jsxRuntime.jsxs("div", { className: "d-input-pin-group", id: id, children: [Array.from({ length: characters }).map((_, index) => (jsxRuntime.jsx("input", Object.assign({ className: classNames({
|
|
1560
1589
|
'form-control': true,
|
|
1561
1590
|
'is-invalid': invalid,
|
|
1562
1591
|
'is-valid': valid,
|
|
1563
1592
|
}), value: activeInput[index], type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onInput: (event) => nextInput(event, index), onKeyDown: (event) => prevInput(event, index), onFocus: () => focusInput(index), onWheel: wheelInput, onClick: (event) => event.preventDefault(), onPaste: (event) => handlePaste(event), autoComplete: "off", placeholder: placeholder, disabled: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), loading && (jsxRuntime.jsx("div", { className: "input-group-text", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
1564
1593
|
}
|
|
1565
1594
|
|
|
1566
|
-
function DInputSelect({ id: idProp, name, label = '', className, style, options = [],
|
|
1595
|
+
function DInputSelect({ id: idProp, name, label = '', className, style, options = [], disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, size, floatingLabel = false, invalid = false, valid = false, dataAttributes, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
|
|
1567
1596
|
const innerId = React.useId();
|
|
1568
1597
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1569
1598
|
const internalValueExtractor = React.useCallback((option) => {
|
|
@@ -1631,12 +1660,9 @@ function DInputSelect({ id: idProp, name, label = '', className, style, options
|
|
|
1631
1660
|
valid,
|
|
1632
1661
|
size,
|
|
1633
1662
|
]);
|
|
1634
|
-
const labelComponent = React.useMemo(() => (jsxRuntime.
|
|
1663
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsx("label", { htmlFor: id, children: label })), [
|
|
1635
1664
|
id,
|
|
1636
1665
|
label,
|
|
1637
|
-
labelIcon,
|
|
1638
|
-
labelIconFamilyClass,
|
|
1639
|
-
labelIconFamilyPrefix,
|
|
1640
1666
|
]);
|
|
1641
1667
|
const dynamicComponent = React.useMemo(() => {
|
|
1642
1668
|
if (floatingLabel) {
|
|
@@ -1704,38 +1730,7 @@ function DInputRange(_a, ref) {
|
|
|
1704
1730
|
const ForwardedDInputRange = React.forwardRef(DInputRange);
|
|
1705
1731
|
ForwardedDInputRange.displayName = 'DInputRange';
|
|
1706
1732
|
|
|
1707
|
-
|
|
1708
|
-
* @deprecated Please use DListGroup.Item or DListGroupItem instead
|
|
1709
|
-
*/
|
|
1710
|
-
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
1711
|
-
const Tag = React.useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
1712
|
-
return (jsxRuntime.jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
1713
|
-
onClick,
|
|
1714
|
-
type: 'button',
|
|
1715
|
-
}, { className: classNames('list-group-item list-group-item-action', theme ? `list-group-item-${theme}` : undefined, className, {
|
|
1716
|
-
active,
|
|
1717
|
-
disabled,
|
|
1718
|
-
}), style: style }, active && { 'aria-current': true }, { children: children })));
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
/**
|
|
1722
|
-
* @deprecated Please use DListGroup instead
|
|
1723
|
-
*/
|
|
1724
|
-
function DList({ children, className, style, flush = false, numbered = false, horizontal = false, horizontalBreakpoint, dataAttributes, }) {
|
|
1725
|
-
if (flush && horizontal) {
|
|
1726
|
-
throw new Error("Horizontal and Flush props don't work together");
|
|
1727
|
-
}
|
|
1728
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('list-group', {
|
|
1729
|
-
'list-group-flush': flush && !horizontal,
|
|
1730
|
-
'list-group-numbered': numbered,
|
|
1731
|
-
'list-group-horizontal': horizontal && !horizontalBreakpoint,
|
|
1732
|
-
}, (horizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className), style: style }, dataAttributes, { children: children })));
|
|
1733
|
-
}
|
|
1734
|
-
var DList$1 = Object.assign(DList, {
|
|
1735
|
-
Item: DListItem,
|
|
1736
|
-
});
|
|
1737
|
-
|
|
1738
|
-
function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href, onClick, theme, children, className, style, dataAttributes, }) {
|
|
1733
|
+
function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href, onClick, color, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, children, className, style, dataAttributes, }) {
|
|
1739
1734
|
const Tag = React.useMemo(() => {
|
|
1740
1735
|
if (href) {
|
|
1741
1736
|
return 'a';
|
|
@@ -1754,17 +1749,17 @@ function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href,
|
|
|
1754
1749
|
const generateClasses = React.useMemo(() => ({
|
|
1755
1750
|
'list-group-item': true,
|
|
1756
1751
|
'list-group-item-action': action,
|
|
1757
|
-
[`list-group-item-${
|
|
1752
|
+
[`list-group-item-${color}`]: !!color,
|
|
1758
1753
|
active,
|
|
1759
1754
|
disabled,
|
|
1760
|
-
}), [action, active, disabled,
|
|
1755
|
+
}), [action, active, disabled, color]);
|
|
1761
1756
|
const ariaAttributes = React.useMemo(() => {
|
|
1762
1757
|
if (Tag === 'button') {
|
|
1763
1758
|
return Object.assign(Object.assign({}, active && { 'aria-current': true }), disabled && { disabled: true });
|
|
1764
1759
|
}
|
|
1765
1760
|
return Object.assign(Object.assign({}, active && { 'aria-current': true }), disabled && { 'aria-disabled': true });
|
|
1766
1761
|
}, [Tag, active, disabled]);
|
|
1767
|
-
return (jsxRuntime.
|
|
1762
|
+
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 })), jsxRuntime.jsx("div", { className: "w-100", children: children }), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle, className: "ms-auto" }))] })));
|
|
1768
1763
|
}
|
|
1769
1764
|
|
|
1770
1765
|
function DListGroup({ as = 'ul', numbered, flush, horizontal, children, className, style, dataAttributes, }) {
|
|
@@ -1867,11 +1862,8 @@ var DOffcanvas$1 = Object.assign(DOffcanvas, {
|
|
|
1867
1862
|
});
|
|
1868
1863
|
|
|
1869
1864
|
function DPaginator(_a) {
|
|
1870
|
-
var {
|
|
1871
|
-
|
|
1872
|
-
extraClassName: className,
|
|
1873
|
-
})), [props, page, current, showArrows, className]);
|
|
1874
|
-
return (jsxRuntime.jsx(ResponsivePagination, Object.assign({ navClassName: classNames('page-item-arrow', navClassName) }, backwardCompatibilityProps)));
|
|
1865
|
+
var { navClassName } = _a, props = tslib.__rest(_a, ["navClassName"]);
|
|
1866
|
+
return (jsxRuntime.jsx(ResponsivePagination, Object.assign({ navClassName: classNames('page-item-arrow', navClassName) }, props)));
|
|
1875
1867
|
}
|
|
1876
1868
|
|
|
1877
1869
|
function DPopover({ children, renderComponent, open, setOpen, adjustContentToRender = false, className, style, dataAttributes, }) {
|
|
@@ -1912,115 +1904,14 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
|
|
|
1912
1904
|
}), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] })));
|
|
1913
1905
|
}
|
|
1914
1906
|
|
|
1915
|
-
function DProgress({ className, style, currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, dataAttributes, }) {
|
|
1907
|
+
function DProgress({ className, style, currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, height, dataAttributes, }) {
|
|
1916
1908
|
const percentage = React.useMemo(() => (Math.round((currentValue * 100) / maxValue)), [currentValue, maxValue]);
|
|
1917
1909
|
const formatProgress = React.useMemo(() => `${percentage}%`, [percentage]);
|
|
1918
1910
|
const generateClasses = React.useMemo(() => ({
|
|
1919
1911
|
'progress-bar': true,
|
|
1920
1912
|
'progress-bar-striped progress-bar-animated': enableStripedAnimation,
|
|
1921
1913
|
}), [enableStripedAnimation]);
|
|
1922
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('progress', className) }, dataAttributes, { children: jsxRuntime.jsx("div", { className: classNames(generateClasses), role: "progressbar", "aria-label": "Progress bar", style:
|
|
1923
|
-
}
|
|
1924
|
-
|
|
1925
|
-
function DQuickActionButton({ line1, line2, className, actionIcon, actionIconFamilyClass, actionIconFamilyPrefix, actionIconTheme, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, href, hrefTarget, style, dataAttributes, }) {
|
|
1926
|
-
const Tag = React.useMemo(() => {
|
|
1927
|
-
if (href) {
|
|
1928
|
-
return 'a';
|
|
1929
|
-
}
|
|
1930
|
-
if (onClick) {
|
|
1931
|
-
return 'button';
|
|
1932
|
-
}
|
|
1933
|
-
return 'div';
|
|
1934
|
-
}, [href, onClick]);
|
|
1935
|
-
const tagProps = React.useMemo(() => {
|
|
1936
|
-
if (href) {
|
|
1937
|
-
return {
|
|
1938
|
-
className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
|
|
1939
|
-
href,
|
|
1940
|
-
target: hrefTarget,
|
|
1941
|
-
};
|
|
1942
|
-
}
|
|
1943
|
-
if (onClick) {
|
|
1944
|
-
return {
|
|
1945
|
-
className: classNames('d-quick-action-button', 'd-quick-action-button-feedback', className),
|
|
1946
|
-
onClick,
|
|
1947
|
-
};
|
|
1948
|
-
}
|
|
1949
|
-
return {
|
|
1950
|
-
className: classNames('d-quick-action-button', className),
|
|
1951
|
-
};
|
|
1952
|
-
}, [
|
|
1953
|
-
className,
|
|
1954
|
-
href,
|
|
1955
|
-
hrefTarget,
|
|
1956
|
-
onClick,
|
|
1957
|
-
]);
|
|
1958
|
-
return (jsxRuntime.jsxs(Tag, Object.assign({ style: style }, tagProps, dataAttributes, { children: [representativeIcon && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-representative-icon", size: representativeIconHasCircle
|
|
1959
|
-
? `var(--${PREFIX_BS}quick-action-button-representative-icon-size)`
|
|
1960
|
-
: `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsxRuntime.jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsxRuntime.jsx("div", { className: "d-quick-action-button-content", children: jsxRuntime.jsxs("div", { className: "d-quick-action-button-text", children: [jsxRuntime.jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsxRuntime.jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), actionIcon && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-action-icon", icon: actionIcon, size: `var(--${PREFIX_BS}quick-action-button-action-icon-size)`, theme: actionIconTheme, familyClass: actionIconFamilyClass, familyPrefix: actionIconFamilyPrefix }))] })));
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
/**
|
|
1964
|
-
* @deprecated
|
|
1965
|
-
*/
|
|
1966
|
-
function DQuickActionCheck({ id: idProp, name, value, line1, line2, line3, className, style, checked, dataAttributes, onChange, }) {
|
|
1967
|
-
const innerId = React.useId();
|
|
1968
|
-
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1969
|
-
const changeHandler = React.useCallback((event) => {
|
|
1970
|
-
event.stopPropagation();
|
|
1971
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1972
|
-
}, [onChange]);
|
|
1973
|
-
return (jsxRuntime.jsxs("label", Object.assign({ className: classNames('d-quick-action-check', className), htmlFor: id, style: style }, dataAttributes, { children: [jsxRuntime.jsx(DInputCheck, { id: id, type: "radio", name: name, value: value, checked: checked, onChange: changeHandler }), jsxRuntime.jsxs("div", { className: "d-quick-action-check-detail", children: [jsxRuntime.jsx("span", { className: "d-quick-action-check-line1", children: line1 }), jsxRuntime.jsx("span", { className: "d-quick-action-check-line2", children: line2 })] }), jsxRuntime.jsx("span", { className: "d-quick-action-check-line3", children: line3 })] })));
|
|
1974
|
-
}
|
|
1975
|
-
|
|
1976
|
-
function DQuickActionSelect({ id: idProp, name, value, line1, line2, className, style, selected = false, dataAttributes, onChange, }) {
|
|
1977
|
-
const innerRef = React.useRef(null);
|
|
1978
|
-
const innerId = React.useId();
|
|
1979
|
-
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1980
|
-
const changeHandler = React.useCallback((event) => {
|
|
1981
|
-
event.stopPropagation();
|
|
1982
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1983
|
-
}, [onChange]);
|
|
1984
|
-
React.useEffect(() => {
|
|
1985
|
-
if (innerRef.current) {
|
|
1986
|
-
innerRef.current.checked = selected;
|
|
1987
|
-
}
|
|
1988
|
-
}, [selected]);
|
|
1989
|
-
return (jsxRuntime.jsxs("label", Object.assign({ className: classNames('d-quick-action-select', className), htmlFor: id, style: style }, dataAttributes, { children: [jsxRuntime.jsx("input", { ref: innerRef, id: id, type: "radio", name: name, value: value, onChange: changeHandler }), jsxRuntime.jsx("span", { className: "d-quick-action-select-line1", children: line1 }), jsxRuntime.jsx("span", { className: "d-quick-action-select-line2", children: line2 })] })));
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
/**
|
|
1993
|
-
* @deprecated
|
|
1994
|
-
*/
|
|
1995
|
-
function DQuickActionSwitch({ id: idProp, name, label, hint, checked, disabled, className, style, dataAttributes, onClick, }) {
|
|
1996
|
-
const innerId = React.useId();
|
|
1997
|
-
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1998
|
-
const clickHandler = React.useCallback((event) => {
|
|
1999
|
-
event.stopPropagation();
|
|
2000
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
2001
|
-
}, [checked, onClick]);
|
|
2002
|
-
return (jsxRuntime.jsxs("button", Object.assign({ className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style }, dataAttributes, { children: [jsxRuntime.jsx("div", { className: "d-quick-action-switch-content", children: jsxRuntime.jsx(DInputSwitch, { id: id, name: name, disabled: disabled, checked: checked, readonly: true, label: label }) }), jsxRuntime.jsx("div", { className: "d-quick-action-switch-hint", children: hint })] })));
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
|
-
/**
|
|
2006
|
-
* @deprecated Please use https://getbootstrap.com/docs/5.3/components/placeholders/ instead
|
|
2007
|
-
*/
|
|
2008
|
-
function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
|
|
2009
|
-
const innerBackgroundColor = React.useMemo(() => {
|
|
2010
|
-
if (backgroundColor) {
|
|
2011
|
-
return backgroundColor;
|
|
2012
|
-
}
|
|
2013
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
2014
|
-
return computedStyle.getPropertyValue(`--${PREFIX_BS}secondary-100`);
|
|
2015
|
-
}, [backgroundColor]);
|
|
2016
|
-
const innerForegroundColor = React.useMemo(() => {
|
|
2017
|
-
if (foregroundColor) {
|
|
2018
|
-
return foregroundColor;
|
|
2019
|
-
}
|
|
2020
|
-
const computedStyle = getComputedStyle(document.documentElement);
|
|
2021
|
-
return computedStyle.getPropertyValue(`--${PREFIX_BS}gray-100`);
|
|
2022
|
-
}, [foregroundColor]);
|
|
2023
|
-
return (jsxRuntime.jsx(ContentLoader, { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
|
|
1914
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('progress', className), style: Object.assign({ height }, style) }, dataAttributes, { children: jsxRuntime.jsx("div", { className: classNames(generateClasses), role: "progressbar", "aria-label": "Progress bar", style: { width: formatProgress }, "aria-valuenow": currentValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, children: !hideCurrentValue && formatProgress }) })));
|
|
2024
1915
|
}
|
|
2025
1916
|
|
|
2026
1917
|
function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, completed, alignStart = false, className, style, }) {
|
|
@@ -2033,13 +1924,13 @@ function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSu
|
|
|
2033
1924
|
'd-stepper-desktop': true,
|
|
2034
1925
|
'is-vertical': vertical,
|
|
2035
1926
|
'is-align-start': alignStart && !vertical,
|
|
2036
|
-
}, className), style: style, children: options.map(({ label, value, description }) => (jsxRuntime.jsxs("div", { className:
|
|
1927
|
+
}, className), style: style, children: options.map(({ label, value, description }) => (jsxRuntime.jsxs("div", { className: classNames({
|
|
1928
|
+
'd-step': true,
|
|
1929
|
+
'd-step-current': value === currentStep && !completed,
|
|
1930
|
+
}), children: [jsxRuntime.jsx("div", { className: "d-step-value", children: jsxRuntime.jsxs("div", { className: classNames({
|
|
2037
1931
|
'd-step-icon-container': true,
|
|
2038
1932
|
'd-step-check': value < currentStep || completed,
|
|
2039
|
-
|
|
2040
|
-
}), children: value < currentStep || completed
|
|
2041
|
-
? (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconSuccessFamilyClass, familyPrefix: iconSuccessFamilyPrefix, materialStyle: iconSuccessMaterialStyle, className: "d-step-icon" }))
|
|
2042
|
-
: value }) }), jsxRuntime.jsxs("div", { className: "d-step-text-container", children: [jsxRuntime.jsx("div", { className: "d-step-label", children: label }), description && (jsxRuntime.jsx("div", { className: "d-step-description", children: description }))] })] }, value))) }));
|
|
1933
|
+
}), children: [((value < currentStep) || completed) && (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconSuccessFamilyClass, familyPrefix: iconSuccessFamilyPrefix, materialStyle: iconSuccessMaterialStyle, className: "d-step-icon" })), value] }) }), jsxRuntime.jsxs("div", { className: "d-step-text-container", children: [jsxRuntime.jsx("div", { className: "d-step-label", children: label }), description && (jsxRuntime.jsx("div", { className: "d-step-description", children: description }))] })] }, value))) }));
|
|
2043
1934
|
}
|
|
2044
1935
|
|
|
2045
1936
|
function DStepper$1({ options, currentStep, className, style, }) {
|
|
@@ -2079,7 +1970,7 @@ function DStepper({ options, currentStep, iconSuccess, iconSuccessFamilyClass, i
|
|
|
2079
1970
|
const ARROW_WIDTH = 8;
|
|
2080
1971
|
const ARROW_HEIGHT = 4;
|
|
2081
1972
|
const GAP = 2;
|
|
2082
|
-
function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false,
|
|
1973
|
+
function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false, placement = 'top', size, Component, children, }) {
|
|
2083
1974
|
const [isOpen, setIsOpen] = React.useState(open);
|
|
2084
1975
|
const arrowRef = React.useRef(null);
|
|
2085
1976
|
const { refs, context, floatingStyles, } = react.useFloating({
|
|
@@ -2110,10 +2001,16 @@ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT +
|
|
|
2110
2001
|
dismiss,
|
|
2111
2002
|
role,
|
|
2112
2003
|
]);
|
|
2113
|
-
const generateClasses = React.useMemo(() => (Object.assign({ 'tooltip show': true, [`tooltip-${size}`]: !!size
|
|
2004
|
+
const generateClasses = React.useMemo(() => (Object.assign({ 'tooltip show': true, [`tooltip-${size}`]: !!size }, className && { [className]: true })), [size, className]);
|
|
2114
2005
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ className: childrenClassName, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsxRuntime.jsx(react.FloatingPortal, { children: isOpen && (jsxRuntime.jsxs("div", Object.assign({ className: classNames(generateClasses), ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), style) }, getFloatingProps(), { children: [jsxRuntime.jsx(react.FloatingArrow, { ref: arrowRef, context: context, width: ARROW_WIDTH, height: ARROW_HEIGHT }), jsxRuntime.jsx("div", { className: "tooltip-inner", children: children })] }))) })] }));
|
|
2115
2006
|
}
|
|
2116
2007
|
|
|
2008
|
+
function DTimeline({ className, style, dataAttributes, items, }) {
|
|
2009
|
+
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', {
|
|
2010
|
+
[`d-timeline-item-${item.status}`]: item.status,
|
|
2011
|
+
}), 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))) })));
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2117
2014
|
const TabContext = React.createContext(undefined);
|
|
2118
2015
|
function useTabContext() {
|
|
2119
2016
|
const context = React.useContext(TabContext);
|
|
@@ -2152,7 +2049,7 @@ function DTabs({ children, defaultSelected, onChange, options, className, classN
|
|
|
2152
2049
|
'flex-column': !vertical || variant === 'tabs',
|
|
2153
2050
|
}), style: style }, dataAttributes, { children: [jsxRuntime.jsx("nav", { className: classNames(generateClasses), children: options.map((option) => (jsxRuntime.jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
2154
2051
|
active: option.tab === selected,
|
|
2155
|
-
}, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.
|
|
2052
|
+
}, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.tab))) }), jsxRuntime.jsx("div", { className: "tab-content w-100", children: children })] })) }));
|
|
2156
2053
|
}
|
|
2157
2054
|
var DTabs$1 = Object.assign(DTabs, {
|
|
2158
2055
|
Tab: DTabContent,
|
|
@@ -2184,20 +2081,18 @@ function useDToast() {
|
|
|
2184
2081
|
if (typeof data === 'function') {
|
|
2185
2082
|
return reactHotToast.toast.custom(data, toastProps);
|
|
2186
2083
|
}
|
|
2187
|
-
const { title, description, icon, closeIcon, timestamp,
|
|
2084
|
+
const { title, description, icon, closeIcon, timestamp, color, } = data;
|
|
2188
2085
|
return reactHotToast.toast.custom(({ id, visible }) => {
|
|
2189
2086
|
if (!visible) {
|
|
2190
2087
|
return null;
|
|
2191
2088
|
}
|
|
2192
2089
|
if (!description) {
|
|
2193
2090
|
return (jsxRuntime.jsx(DToast$1, { className: classNames({
|
|
2194
|
-
[`toast-${
|
|
2195
|
-
[`toast-soft-${theme}`]: !!theme && !!soft,
|
|
2091
|
+
[`toast-${color}`]: !!color,
|
|
2196
2092
|
}, '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 }) })] }) }));
|
|
2197
2093
|
}
|
|
2198
2094
|
return (jsxRuntime.jsxs(DToast$1, { className: classNames({
|
|
2199
|
-
[`toast-${
|
|
2200
|
-
[`toast-soft-${theme}`]: !!theme && !!soft,
|
|
2095
|
+
[`toast-${color}`]: !!color,
|
|
2201
2096
|
}, '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 }) })] }));
|
|
2202
2097
|
}, toastProps);
|
|
2203
2098
|
}, [xLg]);
|
|
@@ -2268,7 +2163,7 @@ function validatePhoneNumber(phone) {
|
|
|
2268
2163
|
}
|
|
2269
2164
|
|
|
2270
2165
|
function DInputPhone(_a, ref) {
|
|
2271
|
-
var { id: idProp, style, className, label = '',
|
|
2166
|
+
var { id: idProp, style, className, label = '', disabled = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconEnd, iconEndDisabled, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, iconEndMaterialStyle, hint, size, invalid = false, valid = false, floatingLabel = false, inputEnd, value, placeholder = '', dataAttributes, onChange, onIconEndClick, countrySelectorProps, filteredCountries, defaultCountry = 'cl' } = _a, inputProps = tslib.__rest(_a, ["id", "style", "className", "label", "disabled", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconMaterialStyle", "iconEnd", "iconEndDisabled", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "iconEndMaterialStyle", "hint", "size", "invalid", "valid", "floatingLabel", "inputEnd", "value", "placeholder", "dataAttributes", "onChange", "onIconEndClick", "countrySelectorProps", "filteredCountries", "defaultCountry"]);
|
|
2272
2167
|
const innerRef = useProvidedRefOrCreate(ref);
|
|
2273
2168
|
const innerId = React.useId();
|
|
2274
2169
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
@@ -2327,13 +2222,9 @@ function DInputPhone(_a, ref) {
|
|
|
2327
2222
|
placeholder,
|
|
2328
2223
|
valid,
|
|
2329
2224
|
]);
|
|
2330
|
-
const labelComponent = React.useMemo(() => (jsxRuntime.
|
|
2225
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsx("label", { htmlFor: id, children: label })), [
|
|
2331
2226
|
id,
|
|
2332
2227
|
label,
|
|
2333
|
-
labelIcon,
|
|
2334
|
-
labelIconFamilyClass,
|
|
2335
|
-
labelIconFamilyPrefix,
|
|
2336
|
-
labelIconMaterialStyle,
|
|
2337
2228
|
]);
|
|
2338
2229
|
const dynamicComponent = React.useMemo(() => {
|
|
2339
2230
|
if (floatingLabel) {
|
|
@@ -2354,9 +2245,92 @@ function DInputPhone(_a, ref) {
|
|
|
2354
2245
|
const ForwardedDInputPhone = React.forwardRef(DInputPhone);
|
|
2355
2246
|
ForwardedDInputPhone.displayName = 'DInputPhone';
|
|
2356
2247
|
|
|
2248
|
+
const DEFAULT_IMAGE = 'https://cdn.modyo.cloud/uploads/06b434f7-b943-4f54-9543-84a904e189aa/original/Visa_Logo_1_.png';
|
|
2249
|
+
const CHIP_IMAGE = 'https://cdn.modyo.cloud/uploads/4660ad00-e5d8-477e-8919-52b53d0a26fb/original/chip-debit-svgrepo-com_1_.png';
|
|
2250
|
+
function DCreditCard({ brand = 'visa', name, number, holderText = 'Card Holder', logoImage, isChipVisible = true, className, isVertical = false, }) {
|
|
2251
|
+
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 })] })] }));
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
const getItemClass = (action) => {
|
|
2255
|
+
const base = `dropdown-item d-flex align-items-center
|
|
2256
|
+
${action.color ? `dropdown-item-${action.color}` : ''} ${action.disabled ? 'disabled' : ''}`;
|
|
2257
|
+
return base;
|
|
2258
|
+
};
|
|
2259
|
+
function DDropdown({ actions, dropdownToggle, className, }) {
|
|
2260
|
+
const [open, setOpen] = React.useState(false);
|
|
2261
|
+
const dropdownRef = React.useRef(null);
|
|
2262
|
+
const [position, setPosition] = React.useState('down'); // 🆕
|
|
2263
|
+
// Cerrar al hacer click fuera
|
|
2264
|
+
React.useEffect(() => {
|
|
2265
|
+
const handleClickOutside = (event) => {
|
|
2266
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
2267
|
+
setOpen(false);
|
|
2268
|
+
}
|
|
2269
|
+
};
|
|
2270
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
2271
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
2272
|
+
}, []);
|
|
2273
|
+
// 🆕 Calcular posición del menú al abrir
|
|
2274
|
+
React.useEffect(() => {
|
|
2275
|
+
if (open && dropdownRef.current) {
|
|
2276
|
+
const rect = dropdownRef.current.getBoundingClientRect();
|
|
2277
|
+
const spaceBottom = window.innerHeight - rect.bottom;
|
|
2278
|
+
const spaceRight = window.innerWidth - rect.right;
|
|
2279
|
+
if (spaceBottom < 150) {
|
|
2280
|
+
setPosition('up');
|
|
2281
|
+
}
|
|
2282
|
+
else if (spaceRight < 150) {
|
|
2283
|
+
setPosition('start');
|
|
2284
|
+
}
|
|
2285
|
+
else {
|
|
2286
|
+
setPosition('down');
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
}, [open]);
|
|
2290
|
+
let ToggleElement;
|
|
2291
|
+
if (dropdownToggle) {
|
|
2292
|
+
if (typeof dropdownToggle === 'function') {
|
|
2293
|
+
ToggleElement = dropdownToggle({ open, toggle: () => setOpen(!open) });
|
|
2294
|
+
}
|
|
2295
|
+
else {
|
|
2296
|
+
ToggleElement = dropdownToggle;
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
else {
|
|
2300
|
+
ToggleElement = (jsxRuntime.jsx(DButtonIcon, { variant: "link", stopPropagationEnabled: false, onClick: () => setOpen(!open), icon: "MoreVertical" }));
|
|
2301
|
+
}
|
|
2302
|
+
return (jsxRuntime.jsxs("div", { className: `dropdown position-relative drop-${position} ${className}`, ref: dropdownRef, children: [ToggleElement, jsxRuntime.jsx("ul", { style: {
|
|
2303
|
+
position: 'absolute',
|
|
2304
|
+
top: position === 'up' ? 'auto' : '100%',
|
|
2305
|
+
bottom: position === 'up' ? '100%' : 'auto',
|
|
2306
|
+
left: position === 'start' ? 'auto' : 0,
|
|
2307
|
+
right: position === 'start' ? '0' : 'auto',
|
|
2308
|
+
transform: 'translateY(4px)',
|
|
2309
|
+
}, className: `dropdown-menu p-2 ${open ? 'show' : ''}`, children: actions.map((action, index) => {
|
|
2310
|
+
if (action.isDivider) {
|
|
2311
|
+
return (jsxRuntime.jsx("hr", { className: "dropdown-divider" }, index));
|
|
2312
|
+
}
|
|
2313
|
+
return (jsxRuntime.jsx("li", { children: action.href ? (jsxRuntime.jsxs("a", { className: getItemClass(action), href: action.href, onClick: (e) => {
|
|
2314
|
+
if (action.disabled) {
|
|
2315
|
+
e.preventDefault();
|
|
2316
|
+
}
|
|
2317
|
+
else {
|
|
2318
|
+
setOpen(false);
|
|
2319
|
+
}
|
|
2320
|
+
}, 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: () => {
|
|
2321
|
+
var _a;
|
|
2322
|
+
if (!action.disabled) {
|
|
2323
|
+
(_a = action.onClick) === null || _a === void 0 ? void 0 : _a.call(action);
|
|
2324
|
+
setOpen(false);
|
|
2325
|
+
}
|
|
2326
|
+
}, disabled: action.disabled, children: [action.icon && (jsxRuntime.jsx(DIcon, { icon: action.icon, className: "me-2", size: "1rem" })), action.label] })) }, index));
|
|
2327
|
+
}) })] }));
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2357
2330
|
exports.DAlert = DAlert;
|
|
2358
2331
|
exports.DAvatar = DAvatar;
|
|
2359
2332
|
exports.DBadge = DBadge;
|
|
2333
|
+
exports.DBox = DBox;
|
|
2360
2334
|
exports.DBoxFile = DBoxFile;
|
|
2361
2335
|
exports.DButton = DButton;
|
|
2362
2336
|
exports.DButtonIcon = DButtonIcon;
|
|
@@ -2370,27 +2344,27 @@ exports.DChip = DChip;
|
|
|
2370
2344
|
exports.DCollapse = DCollapse;
|
|
2371
2345
|
exports.DContext = DContext;
|
|
2372
2346
|
exports.DContextProvider = DContextProvider;
|
|
2347
|
+
exports.DCreditCard = DCreditCard;
|
|
2373
2348
|
exports.DCurrencyText = DCurrencyText;
|
|
2374
2349
|
exports.DDatePicker = DDatePicker;
|
|
2350
|
+
exports.DDropdown = DDropdown;
|
|
2375
2351
|
exports.DIcon = DIcon;
|
|
2376
2352
|
exports.DIconBase = DIconBase;
|
|
2377
2353
|
exports.DInput = ForwardedDInput;
|
|
2378
2354
|
exports.DInputCheck = DInputCheck;
|
|
2379
2355
|
exports.DInputCounter = ForwardedDInputCounter;
|
|
2380
|
-
exports.DInputCurrency =
|
|
2381
|
-
exports.DInputCurrencyBase = ForwardedDInputCurrencyBase$1;
|
|
2356
|
+
exports.DInputCurrency = ForwardedDInputCurrency;
|
|
2382
2357
|
exports.DInputMask = ForwardedDInputMask;
|
|
2383
2358
|
exports.DInputPassword = ForwardedDInputPassword;
|
|
2384
2359
|
exports.DInputPhone = ForwardedDInputPhone;
|
|
2385
2360
|
exports.DInputPin = DInputPin;
|
|
2386
2361
|
exports.DInputRange = ForwardedDInputRange;
|
|
2387
|
-
exports.DInputSearch = ForwardedDInputSearch;
|
|
2388
2362
|
exports.DInputSelect = DInputSelect;
|
|
2389
2363
|
exports.DInputSwitch = DInputSwitch;
|
|
2390
|
-
exports.
|
|
2364
|
+
exports.DLayout = DLayout$1;
|
|
2365
|
+
exports.DLayoutPane = DLayoutPane;
|
|
2391
2366
|
exports.DListGroup = DListGroup$1;
|
|
2392
2367
|
exports.DListGroupItem = DListGroupItem;
|
|
2393
|
-
exports.DListItem = DListItem;
|
|
2394
2368
|
exports.DModal = DModal$1;
|
|
2395
2369
|
exports.DModalBody = DModalBody;
|
|
2396
2370
|
exports.DModalFooter = DModalFooter;
|
|
@@ -2402,18 +2376,14 @@ exports.DOffcanvasHeader = DOffcanvasHeader;
|
|
|
2402
2376
|
exports.DPaginator = DPaginator;
|
|
2403
2377
|
exports.DPopover = DPopover;
|
|
2404
2378
|
exports.DProgress = DProgress;
|
|
2405
|
-
exports.DQuickActionButton = DQuickActionButton;
|
|
2406
|
-
exports.DQuickActionCheck = DQuickActionCheck;
|
|
2407
|
-
exports.DQuickActionSelect = DQuickActionSelect;
|
|
2408
|
-
exports.DQuickActionSwitch = DQuickActionSwitch;
|
|
2409
2379
|
exports.DSelect = DSelect$1;
|
|
2410
|
-
exports.DSkeleton = DSkeleton;
|
|
2411
2380
|
exports.DStepper = DStepper;
|
|
2412
2381
|
exports.DStepperDesktop = DStepper$2;
|
|
2413
2382
|
exports.DStepperMobile = DStepper$1;
|
|
2414
2383
|
exports.DTabContent = DTabContent;
|
|
2415
2384
|
exports.DTableHead = DTableHead;
|
|
2416
2385
|
exports.DTabs = DTabs$1;
|
|
2386
|
+
exports.DTimeline = DTimeline;
|
|
2417
2387
|
exports.DToast = DToast$1;
|
|
2418
2388
|
exports.DToastContainer = DToastContainer;
|
|
2419
2389
|
exports.DTooltip = DTooltip;
|