@dynamic-framework/ui-react 1.36.2 → 2.0.0-dev.2
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 +7220 -3665
- 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 +8012 -3785
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +250 -305
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +275 -314
- 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/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/DBoxFile/useDBoxFile.d.ts +2 -2
- package/dist/types/components/DButton/DButton.d.ts +6 -5
- 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 +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 +11 -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/DPopover/DPopover.d.ts +1 -1
- 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/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/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 +94 -1
- package/package.json +32 -30
- package/src/style/_shame.scss +42 -1
- package/src/style/abstracts/_mixins.scss +1 -3
- 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 +143 -23
- 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/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/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.esm.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useMemo, useEffect, useState, useCallback, useContext, createContext, Fragment, useLayoutEffect, forwardRef, useId, useRef, useSyncExternalStore } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
3
|
+
import React, { useMemo, useEffect, useState, useCallback, useContext, createContext, Fragment, useLayoutEffect, forwardRef, useId, useRef, useSyncExternalStore } from 'react';
|
|
4
4
|
import { __rest } from 'tslib';
|
|
5
|
+
import * as LucideIcons from 'lucide-react';
|
|
5
6
|
import { createPortal } from 'react-dom';
|
|
6
7
|
import { fromEvent } from 'file-selector';
|
|
7
8
|
import { SplideSlide, Splide } from '@splidejs/react-splide';
|
|
@@ -12,7 +13,6 @@ import Select, { components } from 'react-select';
|
|
|
12
13
|
import { InputMask } from '@react-input/mask';
|
|
13
14
|
import ResponsivePagination from 'react-responsive-pagination';
|
|
14
15
|
import { useFloating, autoUpdate, offset, flip, shift, useClick, useDismiss, useRole, useInteractions, useId as useId$1, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
15
|
-
import ContentLoader from 'react-content-loader';
|
|
16
16
|
import { Toaster, toast } from 'react-hot-toast';
|
|
17
17
|
import { defaultCountries, parseCountry, usePhoneInput, CountrySelector } from 'react-international-phone';
|
|
18
18
|
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
@@ -21,46 +21,58 @@ import { initReactI18next } from 'react-i18next';
|
|
|
21
21
|
|
|
22
22
|
const PREFIX_BS = 'bs-';
|
|
23
23
|
|
|
24
|
-
function DIconBase({ icon,
|
|
24
|
+
function DIconBase({ icon, color, style, className, size, hasCircle = false, materialStyle = false, familyClass = 'material-symbols-outlined', strokeWidth = 2, dataAttributes, }) {
|
|
25
|
+
// If materialStyle is true, use Material Design icons (legacy)
|
|
26
|
+
const useMaterialIcons = materialStyle;
|
|
27
|
+
// Get Lucide icon component
|
|
28
|
+
const LucideIcon = useMemo(() => {
|
|
29
|
+
if (useMaterialIcons)
|
|
30
|
+
return null;
|
|
31
|
+
// Try to find the icon in Lucide (expects PascalCase)
|
|
32
|
+
const icons = LucideIcons;
|
|
33
|
+
return icons[icon] || null;
|
|
34
|
+
}, [icon, useMaterialIcons]);
|
|
25
35
|
const colorStyle = useMemo(() => {
|
|
26
36
|
if (color) {
|
|
27
|
-
return { [`--${PREFIX_BS}icon-component-color`]: color };
|
|
28
|
-
}
|
|
29
|
-
if (theme) {
|
|
30
|
-
return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${theme})` };
|
|
37
|
+
return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${color})` };
|
|
31
38
|
}
|
|
32
39
|
return {};
|
|
33
|
-
}, [color
|
|
40
|
+
}, [color]);
|
|
34
41
|
const backgroundStyle = useMemo(() => {
|
|
35
|
-
if (backgroundColor) {
|
|
36
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: backgroundColor };
|
|
37
|
-
}
|
|
38
42
|
if (hasCircle) {
|
|
39
|
-
if (
|
|
40
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${
|
|
43
|
+
if (color) {
|
|
44
|
+
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${color}-rgb), 0.1)` };
|
|
41
45
|
}
|
|
42
46
|
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}body-color-rgb), 0.1)` };
|
|
43
47
|
}
|
|
44
48
|
return {};
|
|
45
|
-
}, [
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
|
|
51
|
-
}, [circleSize, hasCircle]);
|
|
52
|
-
const generateStyleVariables = 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]);
|
|
53
|
-
const generateClasses = useMemo(() => (Object.assign(Object.assign({ 'd-icon': true, [familyClass]: true, 'd-icon-loading': loading }, !materialStyle && {
|
|
54
|
-
[`${familyPrefix}${icon}`]: true,
|
|
49
|
+
}, [hasCircle, color]);
|
|
50
|
+
const generateStyleVariables = 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]);
|
|
51
|
+
const generateClasses = useMemo(() => (Object.assign(Object.assign({ 'd-icon': true }, useMaterialIcons && {
|
|
52
|
+
[familyClass]: true,
|
|
55
53
|
}), className && { [className]: true })), [
|
|
56
|
-
familyClass,
|
|
57
|
-
loading,
|
|
58
54
|
className,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
icon,
|
|
55
|
+
useMaterialIcons,
|
|
56
|
+
familyClass,
|
|
62
57
|
]);
|
|
63
|
-
|
|
58
|
+
const iconSize = useMemo(() => {
|
|
59
|
+
if (size) {
|
|
60
|
+
const numSize = parseInt(size, 10);
|
|
61
|
+
return !Number.isNaN(numSize) ? numSize : size;
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}, [size]);
|
|
65
|
+
// Render Material Design icon (legacy support)
|
|
66
|
+
if (useMaterialIcons) {
|
|
67
|
+
return (jsx("i", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: icon })));
|
|
68
|
+
}
|
|
69
|
+
// Render Lucide icon
|
|
70
|
+
if (!LucideIcon) {
|
|
71
|
+
// eslint-disable-next-line no-console
|
|
72
|
+
console.warn(`Icon "${icon}" not found in Lucide. Make sure to use PascalCase names (e.g., "Home", "User", "Settings")`);
|
|
73
|
+
return (jsx("span", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: "?" })));
|
|
74
|
+
}
|
|
75
|
+
return (jsx("span", Object.assign({ className: classNames(generateClasses), style: generateStyleVariables }, dataAttributes, { children: jsx(LucideIcon, { size: iconSize || 24, strokeWidth: strokeWidth }) })));
|
|
64
76
|
}
|
|
65
77
|
|
|
66
78
|
function useDisableBodyScrollEffect(disable) {
|
|
@@ -248,33 +260,27 @@ const DEFAULT_STATE = {
|
|
|
248
260
|
materialStyle: false,
|
|
249
261
|
},
|
|
250
262
|
iconMap: {
|
|
251
|
-
x: '
|
|
252
|
-
xLg: '
|
|
253
|
-
chevronUp: '
|
|
254
|
-
chevronDown: '
|
|
255
|
-
chevronLeft: '
|
|
256
|
-
chevronRight: '
|
|
257
|
-
upload: '
|
|
258
|
-
calendar: '
|
|
259
|
-
check: '
|
|
263
|
+
x: 'X',
|
|
264
|
+
xLg: 'X',
|
|
265
|
+
chevronUp: 'ChevronUp',
|
|
266
|
+
chevronDown: 'ChevronDown',
|
|
267
|
+
chevronLeft: 'ChevronLeft',
|
|
268
|
+
chevronRight: 'ChevronRight',
|
|
269
|
+
upload: 'Upload',
|
|
270
|
+
calendar: 'Calendar',
|
|
271
|
+
check: 'Check',
|
|
260
272
|
alert: {
|
|
261
|
-
warning: '
|
|
262
|
-
danger: '
|
|
263
|
-
success: '
|
|
264
|
-
info: '
|
|
265
|
-
dark: 'info-circle',
|
|
266
|
-
light: 'info-circle',
|
|
267
|
-
primary: 'info-circle',
|
|
268
|
-
secondary: 'info-circle',
|
|
273
|
+
warning: 'AlertCircle',
|
|
274
|
+
danger: 'AlertTriangle',
|
|
275
|
+
success: 'CheckCircle',
|
|
276
|
+
info: 'Info',
|
|
269
277
|
},
|
|
270
278
|
input: {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
increase: 'plus-square',
|
|
277
|
-
decrease: 'dash-square',
|
|
279
|
+
search: 'Search',
|
|
280
|
+
show: 'Eye',
|
|
281
|
+
hide: 'EyeOff',
|
|
282
|
+
increase: 'Plus',
|
|
283
|
+
decrease: 'Minus',
|
|
278
284
|
},
|
|
279
285
|
},
|
|
280
286
|
breakpoints: {
|
|
@@ -327,25 +333,19 @@ function DIcon(_a) {
|
|
|
327
333
|
return (jsx(DIconBase, Object.assign({ familyClass: propFamilyClass || familyClass, familyPrefix: propFamilyPrefix || familyPrefix, materialStyle: propMaterialStyle || materialStyle }, props)));
|
|
328
334
|
}
|
|
329
335
|
|
|
330
|
-
function DAlert({
|
|
336
|
+
function DAlert({ color = 'success', icon: iconProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle = false, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle = false, showClose, onClose, children, id, className, style, dataAttributes, }) {
|
|
331
337
|
const { iconMap: { alert, xLg, }, } = useDContext();
|
|
332
|
-
const icon = useMemo(() => iconProp || alert[
|
|
338
|
+
const icon = useMemo(() => iconProp || alert[color], [alert, iconProp, color]);
|
|
333
339
|
const iconClose = useMemo(() => (iconCloseProp || xLg), [iconCloseProp, xLg]);
|
|
334
|
-
const generateClasses = useMemo(() => (Object.assign({ alert: true, [`alert-${
|
|
340
|
+
const generateClasses = useMemo(() => (Object.assign({ alert: true, [`alert-${color}`]: true, 'fade show': !!showClose }, className && { [className]: true })), [color, showClose, className]);
|
|
335
341
|
return (jsxs("div", Object.assign({ className: classNames(generateClasses), style: style, role: "alert", id: id }, dataAttributes, { children: [icon && (jsx(DIcon, { className: "alert-icon", icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsx("div", { className: "alert-text", children: children }), showClose && (jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { icon: iconClose, familyClass: iconCloseFamilyClass, familyPrefix: iconCloseFamilyPrefix, materialStyle: iconCloseMaterialStyle }) }))] })));
|
|
336
342
|
}
|
|
337
343
|
|
|
338
|
-
function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false,
|
|
339
|
-
const generateClasses = useMemo(() => {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
return {
|
|
344
|
-
'd-avatar': true,
|
|
345
|
-
[variantClass]: true,
|
|
346
|
-
[`d-avatar-${size}`]: !!size,
|
|
347
|
-
};
|
|
348
|
-
}, [variant, theme, size]);
|
|
344
|
+
function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, className, style, dataAttributes, }) {
|
|
345
|
+
const generateClasses = useMemo(() => ({
|
|
346
|
+
'd-avatar': true,
|
|
347
|
+
[`d-avatar-${size}`]: !!size,
|
|
348
|
+
}), [size]);
|
|
349
349
|
const name = useMemo(() => {
|
|
350
350
|
if (!nameProp) {
|
|
351
351
|
return undefined;
|
|
@@ -358,16 +358,21 @@ function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, t
|
|
|
358
358
|
return (jsxs("div", Object.assign({ className: classNames(generateClasses, className), style: style, id: id }, dataAttributes, { children: [image && jsx("img", { src: image, alt: nameProp, className: "d-avatar-img" }), (name && !image) && jsx("span", { className: "d-avatar-name", children: name })] })));
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
function DBadge({ text, soft = false,
|
|
361
|
+
function DBadge({ text, soft = false, color = 'primary', id, rounded, className, size, style, iconStart, iconEnd, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, dataAttributes, }) {
|
|
362
362
|
const generateClasses = useMemo(() => ({
|
|
363
363
|
badge: true,
|
|
364
|
-
[`badge-${
|
|
365
|
-
[`badge-soft-${
|
|
364
|
+
[`badge-${color}`]: !!color && !soft,
|
|
365
|
+
[`badge-soft-${color}`]: !!color && soft,
|
|
366
366
|
'rounded-pill': !!rounded,
|
|
367
|
-
|
|
367
|
+
[`badge-${size}`]: !!size,
|
|
368
|
+
}), [rounded, soft, color, size]);
|
|
368
369
|
return (jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, dataAttributes, { children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsx("span", { children: text }), iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }))] })));
|
|
369
370
|
}
|
|
370
371
|
|
|
372
|
+
function DBox({ className, style, children, dataAttributes, }) {
|
|
373
|
+
return (jsx("div", Object.assign({ style: style, className: classNames('d-box', className) }, dataAttributes, { children: children })));
|
|
374
|
+
}
|
|
375
|
+
|
|
371
376
|
/* eslint-disable */
|
|
372
377
|
/**
|
|
373
378
|
* This file is originally from `@primer/react`
|
|
@@ -389,7 +394,7 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
389
394
|
}
|
|
390
395
|
|
|
391
396
|
function DInput(_a, ref) {
|
|
392
|
-
var { id: idProp, style, className, label = '',
|
|
397
|
+
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 = __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
398
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
394
399
|
const innerId = useId();
|
|
395
400
|
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
@@ -440,13 +445,9 @@ function DInput(_a, ref) {
|
|
|
440
445
|
valid,
|
|
441
446
|
value,
|
|
442
447
|
]);
|
|
443
|
-
const labelComponent = useMemo(() => (
|
|
448
|
+
const labelComponent = useMemo(() => (jsx("label", { htmlFor: id, children: label })), [
|
|
444
449
|
id,
|
|
445
450
|
label,
|
|
446
|
-
labelIcon,
|
|
447
|
-
labelIconFamilyClass,
|
|
448
|
-
labelIconFamilyPrefix,
|
|
449
|
-
labelIconMaterialStyle,
|
|
450
451
|
]);
|
|
451
452
|
const dynamicComponent = useMemo(() => {
|
|
452
453
|
if (floatingLabel) {
|
|
@@ -575,7 +576,7 @@ async function urlToFile(url) {
|
|
|
575
576
|
null,
|
|
576
577
|
{
|
|
577
578
|
code: ErrorCodes.FailedFetch,
|
|
578
|
-
message: `Failed to fetch file from ${url}`,
|
|
579
|
+
message: `Failed to fetch file from ${url} (HTTP ${res.status})`,
|
|
579
580
|
},
|
|
580
581
|
];
|
|
581
582
|
}
|
|
@@ -585,11 +586,13 @@ async function urlToFile(url) {
|
|
|
585
586
|
return [file, null];
|
|
586
587
|
}
|
|
587
588
|
catch (error) {
|
|
589
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
590
|
+
const isCorsError = errorMessage.includes('CORS') || errorMessage.includes('Failed to fetch');
|
|
588
591
|
return [
|
|
589
592
|
null,
|
|
590
593
|
{
|
|
591
594
|
code: ErrorCodes.FailedFetch,
|
|
592
|
-
message: `Failed to fetch file from ${url}}`,
|
|
595
|
+
message: `Failed to fetch file from ${url}${isCorsError ? ' (CORS error - file may not be accessible from this domain)' : ` (${errorMessage})`}`,
|
|
593
596
|
},
|
|
594
597
|
];
|
|
595
598
|
}
|
|
@@ -865,13 +868,13 @@ function DBoxFile(_a) {
|
|
|
865
868
|
: children })] })) })), !!files.length && (jsx("ul", { className: "d-box-files", children: files.map((file, index) => (jsx(ForwardedDInput, { value: file.name, iconStart: "paperclip", iconEnd: "trash", readOnly: true, onIconEndClick: () => handleRemoveFile(index) }, `${file.name} ${index}`))) }))] }));
|
|
866
869
|
}
|
|
867
870
|
|
|
868
|
-
function DButton({
|
|
871
|
+
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
872
|
const generateClasses = useMemo(() => {
|
|
870
873
|
const variantClass = variant
|
|
871
|
-
? `btn-${variant}-${
|
|
872
|
-
: `btn-${
|
|
874
|
+
? `btn-${variant}-${color}`
|
|
875
|
+
: `btn-${color}`;
|
|
873
876
|
return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
|
|
874
|
-
}, [variant,
|
|
877
|
+
}, [variant, color, size, state, loading]);
|
|
875
878
|
const clickHandler = useCallback((event) => {
|
|
876
879
|
if (stopPropagationEnabled) {
|
|
877
880
|
event.stopPropagation();
|
|
@@ -879,19 +882,20 @@ function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel
|
|
|
879
882
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
880
883
|
}, [stopPropagationEnabled, onClick]);
|
|
881
884
|
const isDisabled = useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
|
|
885
|
+
const content = children || text;
|
|
882
886
|
const newAriaLabel = useMemo(() => (loading
|
|
883
887
|
? (loadingAriaLabel || ariaLabel || text)
|
|
884
888
|
: (ariaLabel || text)), [loading, loadingAriaLabel, ariaLabel, text]);
|
|
885
|
-
return (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 && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })),
|
|
889
|
+
return (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 && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })), loading && (jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) })), jsx("span", { children: loading && loadingText ? loadingText : content }), iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }))] })));
|
|
886
890
|
}
|
|
887
891
|
|
|
888
|
-
function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, ariaLabel,
|
|
892
|
+
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
893
|
const generateClasses = useMemo(() => {
|
|
890
894
|
const variantClass = variant
|
|
891
|
-
? `btn-${variant}-${
|
|
892
|
-
: `btn-${
|
|
895
|
+
? `btn-${variant}-${color}`
|
|
896
|
+
: `btn-${color}`;
|
|
893
897
|
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,
|
|
898
|
+
}, [variant, color, size, state, loading]);
|
|
895
899
|
const clickHandler = useCallback((event) => {
|
|
896
900
|
if (stopPropagationEnabled) {
|
|
897
901
|
event.stopPropagation();
|
|
@@ -952,11 +956,11 @@ var DCarousel$1 = Object.assign(ForwardedDCarousel, {
|
|
|
952
956
|
Slide: DCarouselSlide,
|
|
953
957
|
});
|
|
954
958
|
|
|
955
|
-
function DChip({
|
|
959
|
+
function DChip({ color = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle, showClose = false, closeAriaLabel = 'close', className, style, dataAttributes, onClose, }) {
|
|
956
960
|
const generateClasses = useMemo(() => ({
|
|
957
961
|
'd-chip': true,
|
|
958
|
-
[`d-chip-${
|
|
959
|
-
}), [
|
|
962
|
+
[`d-chip-${color}`]: !!color,
|
|
963
|
+
}), [color]);
|
|
960
964
|
const { iconMap: { xLg, }, } = useDContext();
|
|
961
965
|
const iconClose = useMemo(() => iconCloseProp || xLg, [iconCloseProp, xLg]);
|
|
962
966
|
return (jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, dataAttributes, { children: [icon && (jsx("div", { className: "d-chip-icon-container", children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), jsx("span", { children: text }), showClose && (jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, "aria-label": closeAriaLabel, children: jsx(DIcon, { icon: iconClose, familyClass: iconCloseFamilyClass, familyPrefix: iconCloseFamilyPrefix, materialStyle: iconCloseMaterialStyle }) }))] })));
|
|
@@ -979,7 +983,7 @@ function DCollapse({ id, className, style, Component, hasSeparator = false, defa
|
|
|
979
983
|
const generateStyles = useMemo(() => ({
|
|
980
984
|
[`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
|
|
981
985
|
}), [hasSeparator]);
|
|
982
|
-
return (jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { children: [jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsx("div", { className: "flex-grow-1", children: Component }), jsx(DIcon, { color:
|
|
986
|
+
return (jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { children: [jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsx("div", { className: "flex-grow-1", children: Component }), jsx(DIcon, { color: "gray", size: "1rem", icon: collapsed ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), !collapsed && (jsx("div", { className: classNames({
|
|
983
987
|
'collapse-body': true,
|
|
984
988
|
}), style: generateStyles, children: children }))] })));
|
|
985
989
|
}
|
|
@@ -1143,7 +1147,7 @@ function DSelectPlaceholder(_a) {
|
|
|
1143
1147
|
}
|
|
1144
1148
|
|
|
1145
1149
|
function DSelect(_a) {
|
|
1146
|
-
var { id: idProp, className, style, label,
|
|
1150
|
+
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 = __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
1151
|
const innerId = useId();
|
|
1148
1152
|
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1149
1153
|
const handleOnIconStartClick = useCallback(() => {
|
|
@@ -1155,7 +1159,7 @@ function DSelect(_a) {
|
|
|
1155
1159
|
return (jsxs("div", Object.assign({ className: classNames('d-select', className, {
|
|
1156
1160
|
'd-select-floating': floatingLabel,
|
|
1157
1161
|
disabled: disabled || loading,
|
|
1158
|
-
}), style: style }, dataAttributes, { children: [label && (
|
|
1162
|
+
}), style: style }, dataAttributes, { children: [label && (jsx("label", { htmlFor: id, children: label })), jsxs("div", { className: classNames({
|
|
1159
1163
|
'input-group': true,
|
|
1160
1164
|
'has-validation': invalid,
|
|
1161
1165
|
disabled: disabled || loading,
|
|
@@ -1189,7 +1193,7 @@ var PickerType;
|
|
|
1189
1193
|
PickerType["Month"] = "month";
|
|
1190
1194
|
PickerType["Year"] = "year";
|
|
1191
1195
|
})(PickerType || (PickerType = {}));
|
|
1192
|
-
function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMonth, increaseMonth, decreaseYear, increaseYear, monthDate, pickerType, prevMonthButtonDisabled, nextMonthButtonDisabled, monthsShown = 1, iconPrev, iconNext, prevYearButtonDisabled, nextYearButtonDisabled,
|
|
1196
|
+
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
1197
|
const { iconMap: { chevronLeft, chevronRight, }, } = useDContext();
|
|
1194
1198
|
const arrayYears = useMemo(() => Array.from({ length: maxYearSelect - minYearSelect + 1 }, (_, index) => minYearSelect + index), [maxYearSelect, minYearSelect]);
|
|
1195
1199
|
const years = useMemo(() => arrayYears.map((year) => ({
|
|
@@ -1214,16 +1218,16 @@ function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMont
|
|
|
1214
1218
|
}, [date]);
|
|
1215
1219
|
const [startYear, endYear] = getYearRange();
|
|
1216
1220
|
if (pickerType === PickerType.Year) {
|
|
1217
|
-
return (jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsx(
|
|
1221
|
+
return (jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevYearButtonDisabled, ariaLabel: prevYearAriaLabel, className: "header-button" }), jsx("p", { children: `${startYear} - ${endYear}` }), jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextYearButtonDisabled, ariaLabel: nextYearAriaLabel, className: "header-button" })] }));
|
|
1218
1222
|
}
|
|
1219
1223
|
if (pickerType === PickerType.Quarter || pickerType === PickerType.Month) {
|
|
1220
|
-
return (jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsx(
|
|
1224
|
+
return (jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), jsx("div", { className: "d-flex justify-content-center flex-grow-1", children: showHeaderSelectors ? (jsx(DSelect$1, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })) : (jsx("p", { children: defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label })) }), 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
1225
|
}
|
|
1222
|
-
return (jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [jsx(
|
|
1226
|
+
return (jsxs(Fragment$1, { children: [jsxs("div", { className: "datepicker-top-header", children: [showHeaderSelectors && (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) => (jsx("option", { value: year.value, children: year.label }, year.value))) })), jsx("h4", { className: "mb-0 fw-normal", children: format(monthDate, 'LLLL, dd', { locale }) })] }), jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [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 ? (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" })) : (jsx("p", { children: `${defaultMonth.label} ${defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label}` })), 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
1227
|
}
|
|
1224
1228
|
|
|
1225
1229
|
function DDatePicker(_a) {
|
|
1226
|
-
var { inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeInputLabel,
|
|
1230
|
+
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 = __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
1231
|
const pickerType = useMemo(() => {
|
|
1228
1232
|
if (props.showQuarterYearPicker)
|
|
1229
1233
|
return PickerType.Quarter;
|
|
@@ -1237,15 +1241,10 @@ function DDatePicker(_a) {
|
|
|
1237
1241
|
props.showMonthYearPicker,
|
|
1238
1242
|
props.showYearPicker,
|
|
1239
1243
|
]);
|
|
1240
|
-
const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeaderSelector, Object.assign({}, headerProps, { monthsShown: props.monthsShown,
|
|
1241
|
-
iconHeaderNext,
|
|
1242
|
-
iconHeaderPrev,
|
|
1243
|
-
iconMaterialStyle,
|
|
1244
|
+
const DatePickerHeader = useCallback((headerProps) => (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
1245
|
headerPrevMonthAriaLabel,
|
|
1245
1246
|
headerNextMonthAriaLabel,
|
|
1246
1247
|
iconHeaderSize,
|
|
1247
|
-
headerButtonVariant,
|
|
1248
|
-
headerButtonTheme,
|
|
1249
1248
|
minYearSelect,
|
|
1250
1249
|
maxYearSelect,
|
|
1251
1250
|
pickerType,
|
|
@@ -1258,6 +1257,25 @@ function DDatePicker(_a) {
|
|
|
1258
1257
|
return (jsx(DatePicker, Object.assign({}, dataAttributes, props, { calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, placeholderText: placeholder, customInput: (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: (jsx(DDatePickerTime, { id: timeId })) })));
|
|
1259
1258
|
}
|
|
1260
1259
|
|
|
1260
|
+
function DLayoutPane({ className, style, children, cols, colsXs, colsSm, colsMd, colsLg, colsXl, colsXxl, dataAttributes, }) {
|
|
1261
|
+
const colsClass = cols ? `g-col-${cols}` : undefined;
|
|
1262
|
+
const colsXsClass = colsXs ? `g-col-${colsXs}` : undefined;
|
|
1263
|
+
const colsSmClass = colsSm ? `g-col-sm-${colsSm}` : undefined;
|
|
1264
|
+
const colsMdClass = colsMd ? `g-col-md-${colsMd}` : undefined;
|
|
1265
|
+
const colsLgClass = colsLg ? `g-col-lg-${colsLg}` : undefined;
|
|
1266
|
+
const colsXlClass = colsXl ? `g-col-xl-${colsXl}` : undefined;
|
|
1267
|
+
const colsXxlClass = colsXxl ? `g-col-xxl-${colsXxl}` : undefined;
|
|
1268
|
+
return (jsx("div", Object.assign({ className: classNames(colsClass, colsXsClass, colsSmClass, colsMdClass, colsLgClass, colsXlClass, colsXxlClass, className), style: style }, dataAttributes, { children: children })));
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
function DLayout({ className, style, children, gap, dataAttributes, }) {
|
|
1272
|
+
const gapClass = gap !== undefined ? `gap-${gap}` : undefined;
|
|
1273
|
+
return (jsx("div", Object.assign({ style: style, className: classNames('grid', gapClass, className) }, dataAttributes, { children: children })));
|
|
1274
|
+
}
|
|
1275
|
+
var DLayout$1 = Object.assign(DLayout, {
|
|
1276
|
+
Pane: DLayoutPane,
|
|
1277
|
+
});
|
|
1278
|
+
|
|
1261
1279
|
function DInputMask(props, ref) {
|
|
1262
1280
|
return (jsx(InputMask, Object.assign({ ref: ref, component: ForwardedDInput }, props)));
|
|
1263
1281
|
}
|
|
@@ -1441,18 +1459,6 @@ function DInputCounter(_a, ref) {
|
|
|
1441
1459
|
const ForwardedDInputCounter = forwardRef(DInputCounter);
|
|
1442
1460
|
ForwardedDInputCounter.displayName = 'DInputCounter';
|
|
1443
1461
|
|
|
1444
|
-
/**
|
|
1445
|
-
* @deprecated
|
|
1446
|
-
*/
|
|
1447
|
-
function DInputCurrencyBase(_a, ref) {
|
|
1448
|
-
var { value, minValue, maxValue, currencyOptions, currencyCode, onFocus, onBlur, onChange } = _a, inputProps = __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 (jsx(ForwardedDInput, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, inputProps)));
|
|
1452
|
-
}
|
|
1453
|
-
const ForwardedDInputCurrencyBase$1 = forwardRef(DInputCurrencyBase);
|
|
1454
|
-
ForwardedDInputCurrencyBase$1.displayName = 'DInputCurrencyBase';
|
|
1455
|
-
|
|
1456
1462
|
function DInputCurrency(_a, ref) {
|
|
1457
1463
|
var { value, minValue, maxValue, currencyCode, onFocus, onBlur, onChange } = _a, props = __rest(_a, ["value", "minValue", "maxValue", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
1458
1464
|
const { currency: currencyOptions } = useDContext();
|
|
@@ -1460,19 +1466,8 @@ function DInputCurrency(_a, ref) {
|
|
|
1460
1466
|
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
1461
1467
|
return (jsx(ForwardedDInput, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, props)));
|
|
1462
1468
|
}
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
/**
|
|
1467
|
-
* @deprecated
|
|
1468
|
-
*/
|
|
1469
|
-
function DInputSearch(_a, ref) {
|
|
1470
|
-
var { type, iconEnd: iconEndProp, iconEndAriaLabel = 'search' } = _a, props = __rest(_a, ["type", "iconEnd", "iconEndAriaLabel"]);
|
|
1471
|
-
const inputRef = useProvidedRefOrCreate(ref);
|
|
1472
|
-
return (jsx(ForwardedDInput, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", iconEndAriaLabel: iconEndAriaLabel }, props)));
|
|
1473
|
-
}
|
|
1474
|
-
const ForwardedDInputSearch = forwardRef(DInputSearch);
|
|
1475
|
-
ForwardedDInputSearch.displayName = 'DInputSearch';
|
|
1469
|
+
const ForwardedDInputCurrency = forwardRef(DInputCurrency);
|
|
1470
|
+
ForwardedDInputCurrency.displayName = 'DInputCurrency';
|
|
1476
1471
|
|
|
1477
1472
|
function DInputPassword(_a, ref) {
|
|
1478
1473
|
var { onIconEndClick, iconEndAriaLabel = 'show/hide password' } = _a, props = __rest(_a, ["onIconEndClick", "iconEndAriaLabel"]);
|
|
@@ -1489,7 +1484,7 @@ function DInputPassword(_a, ref) {
|
|
|
1489
1484
|
const ForwardedDInputPassword = forwardRef(DInputPassword);
|
|
1490
1485
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
1491
1486
|
|
|
1492
|
-
function DInputPin({ id: idProp, label = '',
|
|
1487
|
+
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
1488
|
const innerId = useId();
|
|
1494
1489
|
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1495
1490
|
const [pattern, setPattern] = useState('');
|
|
@@ -1522,7 +1517,8 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1522
1517
|
}
|
|
1523
1518
|
if (input.value !== '') {
|
|
1524
1519
|
setActiveInput((prev) => {
|
|
1525
|
-
const newValue = prev
|
|
1520
|
+
const newValue = [...prev];
|
|
1521
|
+
newValue[index] = input.value;
|
|
1526
1522
|
return newValue;
|
|
1527
1523
|
});
|
|
1528
1524
|
if (input.nextSibling) {
|
|
@@ -1538,7 +1534,8 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1538
1534
|
if (key === 'Backspace') {
|
|
1539
1535
|
const { value } = currentTarget;
|
|
1540
1536
|
setActiveInput((prev) => {
|
|
1541
|
-
const newVal = prev
|
|
1537
|
+
const newVal = [...prev];
|
|
1538
|
+
newVal[index] = '';
|
|
1542
1539
|
return newVal;
|
|
1543
1540
|
});
|
|
1544
1541
|
if (currentTarget.previousSibling && value === '') {
|
|
@@ -1551,19 +1548,23 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
1551
1548
|
}
|
|
1552
1549
|
}, []);
|
|
1553
1550
|
const focusInput = useCallback((index) => {
|
|
1554
|
-
setActiveInput((prev) =>
|
|
1551
|
+
setActiveInput((prev) => {
|
|
1552
|
+
const newVal = [...prev];
|
|
1553
|
+
newVal[index] = '';
|
|
1554
|
+
return newVal;
|
|
1555
|
+
});
|
|
1555
1556
|
}, []);
|
|
1556
1557
|
const wheelInput = useCallback((event) => {
|
|
1557
1558
|
event.currentTarget.blur();
|
|
1558
1559
|
}, []);
|
|
1559
|
-
return (jsxs("div", Object.assign({ className: classNames('d-input-pin', className), style: style }, dataAttributes, { children: [label && (
|
|
1560
|
+
return (jsxs("div", Object.assign({ className: classNames('d-input-pin', className), style: style }, dataAttributes, { children: [label && (jsx("label", { htmlFor: "pinIndex0", children: label })), jsxs("div", { className: "d-input-pin-group", id: id, children: [Array.from({ length: characters }).map((_, index) => (jsx("input", Object.assign({ className: classNames({
|
|
1560
1561
|
'form-control': true,
|
|
1561
1562
|
'is-invalid': invalid,
|
|
1562
1563
|
'is-valid': valid,
|
|
1563
1564
|
}), 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 && (jsx("div", { className: "input-group-text", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
1564
1565
|
}
|
|
1565
1566
|
|
|
1566
|
-
function DInputSelect({ id: idProp, name, label = '', className, style, options = [],
|
|
1567
|
+
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
1568
|
const innerId = useId();
|
|
1568
1569
|
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1569
1570
|
const internalValueExtractor = useCallback((option) => {
|
|
@@ -1631,12 +1632,9 @@ function DInputSelect({ id: idProp, name, label = '', className, style, options
|
|
|
1631
1632
|
valid,
|
|
1632
1633
|
size,
|
|
1633
1634
|
]);
|
|
1634
|
-
const labelComponent = useMemo(() => (
|
|
1635
|
+
const labelComponent = useMemo(() => (jsx("label", { htmlFor: id, children: label })), [
|
|
1635
1636
|
id,
|
|
1636
1637
|
label,
|
|
1637
|
-
labelIcon,
|
|
1638
|
-
labelIconFamilyClass,
|
|
1639
|
-
labelIconFamilyPrefix,
|
|
1640
1638
|
]);
|
|
1641
1639
|
const dynamicComponent = useMemo(() => {
|
|
1642
1640
|
if (floatingLabel) {
|
|
@@ -1704,38 +1702,7 @@ function DInputRange(_a, ref) {
|
|
|
1704
1702
|
const ForwardedDInputRange = forwardRef(DInputRange);
|
|
1705
1703
|
ForwardedDInputRange.displayName = 'DInputRange';
|
|
1706
1704
|
|
|
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 = useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
1712
|
-
return (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 (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, }) {
|
|
1705
|
+
function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href, onClick, color, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, children, className, style, dataAttributes, }) {
|
|
1739
1706
|
const Tag = useMemo(() => {
|
|
1740
1707
|
if (href) {
|
|
1741
1708
|
return 'a';
|
|
@@ -1754,17 +1721,17 @@ function DListGroupItem({ as = 'li', action: actionProp, active, disabled, href,
|
|
|
1754
1721
|
const generateClasses = useMemo(() => ({
|
|
1755
1722
|
'list-group-item': true,
|
|
1756
1723
|
'list-group-item-action': action,
|
|
1757
|
-
[`list-group-item-${
|
|
1724
|
+
[`list-group-item-${color}`]: !!color,
|
|
1758
1725
|
active,
|
|
1759
1726
|
disabled,
|
|
1760
|
-
}), [action, active, disabled,
|
|
1727
|
+
}), [action, active, disabled, color]);
|
|
1761
1728
|
const ariaAttributes = useMemo(() => {
|
|
1762
1729
|
if (Tag === 'button') {
|
|
1763
1730
|
return Object.assign(Object.assign({}, active && { 'aria-current': true }), disabled && { disabled: true });
|
|
1764
1731
|
}
|
|
1765
1732
|
return Object.assign(Object.assign({}, active && { 'aria-current': true }), disabled && { 'aria-disabled': true });
|
|
1766
1733
|
}, [Tag, active, disabled]);
|
|
1767
|
-
return (
|
|
1734
|
+
return (jsxs(Tag, Object.assign({ className: classNames(generateClasses, className), style: style }, Tag === 'a' && href && { href }, onClick && { onClick }, ariaAttributes, dataAttributes, Tag === 'button' && { type: 'button' }, { children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle })), jsx("div", { className: "w-100", children: children }), iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle, className: "ms-auto" }))] })));
|
|
1768
1735
|
}
|
|
1769
1736
|
|
|
1770
1737
|
function DListGroup({ as = 'ul', numbered, flush, horizontal, children, className, style, dataAttributes, }) {
|
|
@@ -1867,11 +1834,8 @@ var DOffcanvas$1 = Object.assign(DOffcanvas, {
|
|
|
1867
1834
|
});
|
|
1868
1835
|
|
|
1869
1836
|
function DPaginator(_a) {
|
|
1870
|
-
var {
|
|
1871
|
-
|
|
1872
|
-
extraClassName: className,
|
|
1873
|
-
})), [props, page, current, showArrows, className]);
|
|
1874
|
-
return (jsx(ResponsivePagination, Object.assign({ navClassName: classNames('page-item-arrow', navClassName) }, backwardCompatibilityProps)));
|
|
1837
|
+
var { navClassName } = _a, props = __rest(_a, ["navClassName"]);
|
|
1838
|
+
return (jsx(ResponsivePagination, Object.assign({ navClassName: classNames('page-item-arrow', navClassName) }, props)));
|
|
1875
1839
|
}
|
|
1876
1840
|
|
|
1877
1841
|
function DPopover({ children, renderComponent, open, setOpen, adjustContentToRender = false, className, style, dataAttributes, }) {
|
|
@@ -1904,123 +1868,22 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
|
|
|
1904
1868
|
role,
|
|
1905
1869
|
]);
|
|
1906
1870
|
const headingId = useId$1();
|
|
1907
|
-
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), adjustContentToRender && {
|
|
1871
|
+
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), (adjustContentToRender && {
|
|
1908
1872
|
[`--${PREFIX_BS}popover-component-min-width`]: 'auto',
|
|
1909
|
-
})), [style, adjustContentToRender]);
|
|
1873
|
+
}))), [style, adjustContentToRender]);
|
|
1910
1874
|
return (jsxs("div", Object.assign({ className: classNames('d-popover', className), style: generateStyleVariables }, dataAttributes, { children: [jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(isOpen) })), isOpen && (jsx(FloatingFocusManager, { context: context, modal: false, children: jsx("div", Object.assign({ className: classNames('d-popover-content', {
|
|
1911
1875
|
'w-100': adjustContentToRender,
|
|
1912
1876
|
}), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] })));
|
|
1913
1877
|
}
|
|
1914
1878
|
|
|
1915
|
-
function DProgress({ className, style, currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, dataAttributes, }) {
|
|
1879
|
+
function DProgress({ className, style, currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, height, dataAttributes, }) {
|
|
1916
1880
|
const percentage = useMemo(() => (Math.round((currentValue * 100) / maxValue)), [currentValue, maxValue]);
|
|
1917
1881
|
const formatProgress = useMemo(() => `${percentage}%`, [percentage]);
|
|
1918
1882
|
const generateClasses = useMemo(() => ({
|
|
1919
1883
|
'progress-bar': true,
|
|
1920
1884
|
'progress-bar-striped progress-bar-animated': enableStripedAnimation,
|
|
1921
1885
|
}), [enableStripedAnimation]);
|
|
1922
|
-
return (jsx("div", Object.assign({ className: classNames('progress', className) }, dataAttributes, { children: 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 = useMemo(() => {
|
|
1927
|
-
if (href) {
|
|
1928
|
-
return 'a';
|
|
1929
|
-
}
|
|
1930
|
-
if (onClick) {
|
|
1931
|
-
return 'button';
|
|
1932
|
-
}
|
|
1933
|
-
return 'div';
|
|
1934
|
-
}, [href, onClick]);
|
|
1935
|
-
const tagProps = 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 (jsxs(Tag, Object.assign({ style: style }, tagProps, dataAttributes, { children: [representativeIcon && (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 && (jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsx("div", { className: "d-quick-action-button-content", children: jsxs("div", { className: "d-quick-action-button-text", children: [jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), actionIcon && (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 = useId();
|
|
1968
|
-
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1969
|
-
const changeHandler = useCallback((event) => {
|
|
1970
|
-
event.stopPropagation();
|
|
1971
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1972
|
-
}, [onChange]);
|
|
1973
|
-
return (jsxs("label", Object.assign({ className: classNames('d-quick-action-check', className), htmlFor: id, style: style }, dataAttributes, { children: [jsx(DInputCheck, { id: id, type: "radio", name: name, value: value, checked: checked, onChange: changeHandler }), jsxs("div", { className: "d-quick-action-check-detail", children: [jsx("span", { className: "d-quick-action-check-line1", children: line1 }), jsx("span", { className: "d-quick-action-check-line2", children: line2 })] }), 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 = useRef(null);
|
|
1978
|
-
const innerId = useId();
|
|
1979
|
-
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1980
|
-
const changeHandler = useCallback((event) => {
|
|
1981
|
-
event.stopPropagation();
|
|
1982
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1983
|
-
}, [onChange]);
|
|
1984
|
-
useEffect(() => {
|
|
1985
|
-
if (innerRef.current) {
|
|
1986
|
-
innerRef.current.checked = selected;
|
|
1987
|
-
}
|
|
1988
|
-
}, [selected]);
|
|
1989
|
-
return (jsxs("label", Object.assign({ className: classNames('d-quick-action-select', className), htmlFor: id, style: style }, dataAttributes, { children: [jsx("input", { ref: innerRef, id: id, type: "radio", name: name, value: value, onChange: changeHandler }), jsx("span", { className: "d-quick-action-select-line1", children: line1 }), 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 = useId();
|
|
1997
|
-
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1998
|
-
const clickHandler = useCallback((event) => {
|
|
1999
|
-
event.stopPropagation();
|
|
2000
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
2001
|
-
}, [checked, onClick]);
|
|
2002
|
-
return (jsxs("button", Object.assign({ className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style }, dataAttributes, { children: [jsx("div", { className: "d-quick-action-switch-content", children: jsx(DInputSwitch, { id: id, name: name, disabled: disabled, checked: checked, readonly: true, label: label }) }), 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 = 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 = 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 (jsx(ContentLoader, { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
|
|
1886
|
+
return (jsx("div", Object.assign({ className: classNames('progress', className), style: Object.assign({ height }, style) }, dataAttributes, { children: 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
1887
|
}
|
|
2025
1888
|
|
|
2026
1889
|
function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSuccessFamilyClass, iconSuccessFamilyPrefix, iconSuccessMaterialStyle = false, vertical = false, completed, alignStart = false, className, style, }) {
|
|
@@ -2033,13 +1896,13 @@ function DStepper$2({ options, currentStep, iconSuccess: iconSuccessProp, iconSu
|
|
|
2033
1896
|
'd-stepper-desktop': true,
|
|
2034
1897
|
'is-vertical': vertical,
|
|
2035
1898
|
'is-align-start': alignStart && !vertical,
|
|
2036
|
-
}, className), style: style, children: options.map(({ label, value, description }) => (jsxs("div", { className:
|
|
1899
|
+
}, className), style: style, children: options.map(({ label, value, description }) => (jsxs("div", { className: classNames({
|
|
1900
|
+
'd-step': true,
|
|
1901
|
+
'd-step-current': value === currentStep && !completed,
|
|
1902
|
+
}), children: [jsx("div", { className: "d-step-value", children: jsxs("div", { className: classNames({
|
|
2037
1903
|
'd-step-icon-container': true,
|
|
2038
1904
|
'd-step-check': value < currentStep || completed,
|
|
2039
|
-
|
|
2040
|
-
}), children: value < currentStep || completed
|
|
2041
|
-
? (jsx(DIcon, { icon: icon, familyClass: iconSuccessFamilyClass, familyPrefix: iconSuccessFamilyPrefix, materialStyle: iconSuccessMaterialStyle, className: "d-step-icon" }))
|
|
2042
|
-
: value }) }), jsxs("div", { className: "d-step-text-container", children: [jsx("div", { className: "d-step-label", children: label }), description && (jsx("div", { className: "d-step-description", children: description }))] })] }, value))) }));
|
|
1905
|
+
}), children: [((value < currentStep) || completed) && (jsx(DIcon, { icon: icon, familyClass: iconSuccessFamilyClass, familyPrefix: iconSuccessFamilyPrefix, materialStyle: iconSuccessMaterialStyle, className: "d-step-icon" })), value] }) }), jsxs("div", { className: "d-step-text-container", children: [jsx("div", { className: "d-step-label", children: label }), description && (jsx("div", { className: "d-step-description", children: description }))] })] }, value))) }));
|
|
2043
1906
|
}
|
|
2044
1907
|
|
|
2045
1908
|
function DStepper$1({ options, currentStep, className, style, }) {
|
|
@@ -2079,7 +1942,7 @@ function DStepper({ options, currentStep, iconSuccess, iconSuccessFamilyClass, i
|
|
|
2079
1942
|
const ARROW_WIDTH = 8;
|
|
2080
1943
|
const ARROW_HEIGHT = 4;
|
|
2081
1944
|
const GAP = 2;
|
|
2082
|
-
function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false,
|
|
1945
|
+
function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false, placement = 'top', size, Component, children, }) {
|
|
2083
1946
|
const [isOpen, setIsOpen] = useState(open);
|
|
2084
1947
|
const arrowRef = useRef(null);
|
|
2085
1948
|
const { refs, context, floatingStyles, } = useFloating({
|
|
@@ -2110,10 +1973,16 @@ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT +
|
|
|
2110
1973
|
dismiss,
|
|
2111
1974
|
role,
|
|
2112
1975
|
]);
|
|
2113
|
-
const generateClasses = useMemo(() => (Object.assign({ 'tooltip show': true, [`tooltip-${size}`]: !!size
|
|
1976
|
+
const generateClasses = useMemo(() => (Object.assign({ 'tooltip show': true, [`tooltip-${size}`]: !!size }, className && { [className]: true })), [size, className]);
|
|
2114
1977
|
return (jsxs(Fragment$1, { children: [jsx("div", Object.assign({ className: childrenClassName, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsx(FloatingPortal, { children: isOpen && (jsxs("div", Object.assign({ className: classNames(generateClasses), ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), style) }, getFloatingProps(), { children: [jsx(FloatingArrow, { ref: arrowRef, context: context, width: ARROW_WIDTH, height: ARROW_HEIGHT }), jsx("div", { className: "tooltip-inner", children: children })] }))) })] }));
|
|
2115
1978
|
}
|
|
2116
1979
|
|
|
1980
|
+
function DTimeline({ className, style, dataAttributes, items, }) {
|
|
1981
|
+
return (jsx("div", Object.assign({ style: style, className: classNames('d-timeline', className) }, dataAttributes, { children: items.map((item, index) => (jsxs("div", { className: classNames('d-timeline-item', {
|
|
1982
|
+
[`d-timeline-item-${item.status}`]: item.status,
|
|
1983
|
+
}), children: [jsx("div", { className: "d-timeline-item-connector" }), jsx("div", { className: "d-timeline-item-icon", children: jsx("i", { className: `bi bi-${item.icon || 'check'}` }) }), jsxs("div", { className: "d-timeline-item-content", children: [jsx("div", { className: "d-timeline-item-title", children: item.title }), item.description && jsx("div", { className: "d-timeline-item-description", children: item.description }), item.time && jsx("div", { className: "d-timeline-item-time", children: item.time }), item.children] })] }, index))) })));
|
|
1984
|
+
}
|
|
1985
|
+
|
|
2117
1986
|
const TabContext = createContext(undefined);
|
|
2118
1987
|
function useTabContext() {
|
|
2119
1988
|
const context = useContext(TabContext);
|
|
@@ -2152,7 +2021,7 @@ function DTabs({ children, defaultSelected, onChange, options, className, classN
|
|
|
2152
2021
|
'flex-column': !vertical || variant === 'tabs',
|
|
2153
2022
|
}), style: style }, dataAttributes, { children: [jsx("nav", { className: classNames(generateClasses), children: options.map((option) => (jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
2154
2023
|
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.
|
|
2024
|
+
}, 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))) }), jsx("div", { className: "tab-content w-100", children: children })] })) }));
|
|
2156
2025
|
}
|
|
2157
2026
|
var DTabs$1 = Object.assign(DTabs, {
|
|
2158
2027
|
Tab: DTabContent,
|
|
@@ -2184,20 +2053,18 @@ function useDToast() {
|
|
|
2184
2053
|
if (typeof data === 'function') {
|
|
2185
2054
|
return toast.custom(data, toastProps);
|
|
2186
2055
|
}
|
|
2187
|
-
const { title, description, icon, closeIcon, timestamp,
|
|
2056
|
+
const { title, description, icon, closeIcon, timestamp, color, } = data;
|
|
2188
2057
|
return toast.custom(({ id, visible }) => {
|
|
2189
2058
|
if (!visible) {
|
|
2190
2059
|
return null;
|
|
2191
2060
|
}
|
|
2192
2061
|
if (!description) {
|
|
2193
2062
|
return (jsx(DToast$1, { className: classNames({
|
|
2194
|
-
[`toast-${
|
|
2195
|
-
[`toast-soft-${theme}`]: !!theme && !!soft,
|
|
2063
|
+
[`toast-${color}`]: !!color,
|
|
2196
2064
|
}, 'show'), children: jsxs(DToast$1.Body, { children: [icon && (jsx(DIcon, { className: "toast-icon", icon: icon })), jsx("p", { className: "toast-title", children: title }), jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: () => toast.dismiss(id), children: jsx(DIcon, { icon: closeIcon || xLg }) })] }) }));
|
|
2197
2065
|
}
|
|
2198
2066
|
return (jsxs(DToast$1, { className: classNames({
|
|
2199
|
-
[`toast-${
|
|
2200
|
-
[`toast-soft-${theme}`]: !!theme && !!soft,
|
|
2067
|
+
[`toast-${color}`]: !!color,
|
|
2201
2068
|
}, 'show'), children: [jsxs(DToast$1.Header, { children: [icon && (jsx(DIcon, { className: "toast-icon", icon: icon })), jsx("p", { className: "toast-title", children: title }), timestamp && (jsx("small", { className: "toast-timestamp", children: timestamp })), jsx("button", { type: "button", className: "d-close align-self-center", "aria-label": "Close", onClick: () => toast.dismiss(id), children: jsx(DIcon, { icon: closeIcon || xLg }) })] }), jsx(DToast$1.Body, { children: jsx("span", { children: description }) })] }));
|
|
2202
2069
|
}, toastProps);
|
|
2203
2070
|
}, [xLg]);
|
|
@@ -2268,7 +2135,7 @@ function validatePhoneNumber(phone) {
|
|
|
2268
2135
|
}
|
|
2269
2136
|
|
|
2270
2137
|
function DInputPhone(_a, ref) {
|
|
2271
|
-
var { id: idProp, style, className, label = '',
|
|
2138
|
+
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 = __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
2139
|
const innerRef = useProvidedRefOrCreate(ref);
|
|
2273
2140
|
const innerId = useId();
|
|
2274
2141
|
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
@@ -2327,13 +2194,9 @@ function DInputPhone(_a, ref) {
|
|
|
2327
2194
|
placeholder,
|
|
2328
2195
|
valid,
|
|
2329
2196
|
]);
|
|
2330
|
-
const labelComponent = useMemo(() => (
|
|
2197
|
+
const labelComponent = useMemo(() => (jsx("label", { htmlFor: id, children: label })), [
|
|
2331
2198
|
id,
|
|
2332
2199
|
label,
|
|
2333
|
-
labelIcon,
|
|
2334
|
-
labelIconFamilyClass,
|
|
2335
|
-
labelIconFamilyPrefix,
|
|
2336
|
-
labelIconMaterialStyle,
|
|
2337
2200
|
]);
|
|
2338
2201
|
const dynamicComponent = useMemo(() => {
|
|
2339
2202
|
if (floatingLabel) {
|
|
@@ -2354,5 +2217,87 @@ function DInputPhone(_a, ref) {
|
|
|
2354
2217
|
const ForwardedDInputPhone = forwardRef(DInputPhone);
|
|
2355
2218
|
ForwardedDInputPhone.displayName = 'DInputPhone';
|
|
2356
2219
|
|
|
2357
|
-
|
|
2220
|
+
const DEFAULT_IMAGE = 'https://cdn.modyo.cloud/uploads/06b434f7-b943-4f54-9543-84a904e189aa/original/Visa_Logo_1_.png';
|
|
2221
|
+
const CHIP_IMAGE = 'https://cdn.modyo.cloud/uploads/4660ad00-e5d8-477e-8919-52b53d0a26fb/original/chip-debit-svgrepo-com_1_.png';
|
|
2222
|
+
function DCreditCard({ brand = 'visa', name, number, holderText = 'Card Holder', logoImage, isChipVisible = true, className, isVertical = false, }) {
|
|
2223
|
+
return (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: [jsxs("div", { className: "d-credit-card-header", children: [jsx("img", { src: logoImage || DEFAULT_IMAGE, alt: brand, className: "d-credit-card-logo", width: 100 }), isChipVisible && (jsx("div", { className: "d-credit-card-chip p-2 rounded-2", children: jsx("img", { src: CHIP_IMAGE, alt: "chip", width: 30, className: "d-credit-card-chip-image" }) }))] }), jsxs("div", { className: "d-credit-card-details mt-auto d-none d-sm-block", children: [jsx("div", { className: "d-credit-card-number d-none d-sm-block mb-4", children: number }), jsx("small", { className: "d-block opacity-50", children: holderText }), jsx("span", { className: "name", children: name })] })] }));
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
const getItemClass = (action) => {
|
|
2227
|
+
const base = `dropdown-item d-flex align-items-center
|
|
2228
|
+
${action.color ? `dropdown-item-${action.color}` : ''} ${action.disabled ? 'disabled' : ''}`;
|
|
2229
|
+
return base;
|
|
2230
|
+
};
|
|
2231
|
+
function DDropdown({ actions, dropdownToggle, className, }) {
|
|
2232
|
+
const [open, setOpen] = useState(false);
|
|
2233
|
+
const dropdownRef = useRef(null);
|
|
2234
|
+
const [position, setPosition] = useState('down'); // 🆕
|
|
2235
|
+
// Cerrar al hacer click fuera
|
|
2236
|
+
useEffect(() => {
|
|
2237
|
+
const handleClickOutside = (event) => {
|
|
2238
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
2239
|
+
setOpen(false);
|
|
2240
|
+
}
|
|
2241
|
+
};
|
|
2242
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
2243
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
2244
|
+
}, []);
|
|
2245
|
+
// 🆕 Calcular posición del menú al abrir
|
|
2246
|
+
useEffect(() => {
|
|
2247
|
+
if (open && dropdownRef.current) {
|
|
2248
|
+
const rect = dropdownRef.current.getBoundingClientRect();
|
|
2249
|
+
const spaceBottom = window.innerHeight - rect.bottom;
|
|
2250
|
+
const spaceRight = window.innerWidth - rect.right;
|
|
2251
|
+
if (spaceBottom < 150) {
|
|
2252
|
+
setPosition('up');
|
|
2253
|
+
}
|
|
2254
|
+
else if (spaceRight < 150) {
|
|
2255
|
+
setPosition('start');
|
|
2256
|
+
}
|
|
2257
|
+
else {
|
|
2258
|
+
setPosition('down');
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
}, [open]);
|
|
2262
|
+
let ToggleElement;
|
|
2263
|
+
if (dropdownToggle) {
|
|
2264
|
+
if (typeof dropdownToggle === 'function') {
|
|
2265
|
+
ToggleElement = dropdownToggle({ open, toggle: () => setOpen(!open) });
|
|
2266
|
+
}
|
|
2267
|
+
else {
|
|
2268
|
+
ToggleElement = dropdownToggle;
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
else {
|
|
2272
|
+
ToggleElement = (jsx(DButtonIcon, { variant: "link", stopPropagationEnabled: false, onClick: () => setOpen(!open), icon: "MoreVertical" }));
|
|
2273
|
+
}
|
|
2274
|
+
return (jsxs("div", { className: `dropdown position-relative drop-${position} ${className}`, ref: dropdownRef, children: [ToggleElement, jsx("ul", { style: {
|
|
2275
|
+
position: 'absolute',
|
|
2276
|
+
top: position === 'up' ? 'auto' : '100%',
|
|
2277
|
+
bottom: position === 'up' ? '100%' : 'auto',
|
|
2278
|
+
left: position === 'start' ? 'auto' : 0,
|
|
2279
|
+
right: position === 'start' ? '0' : 'auto',
|
|
2280
|
+
transform: 'translateY(4px)',
|
|
2281
|
+
}, className: `dropdown-menu p-2 ${open ? 'show' : ''}`, children: actions.map((action, index) => {
|
|
2282
|
+
if (action.isDivider) {
|
|
2283
|
+
return (jsx("hr", { className: "dropdown-divider" }, index));
|
|
2284
|
+
}
|
|
2285
|
+
return (jsx("li", { children: action.href ? (jsxs("a", { className: getItemClass(action), href: action.href, onClick: (e) => {
|
|
2286
|
+
if (action.disabled) {
|
|
2287
|
+
e.preventDefault();
|
|
2288
|
+
}
|
|
2289
|
+
else {
|
|
2290
|
+
setOpen(false);
|
|
2291
|
+
}
|
|
2292
|
+
}, children: [action.icon && (jsx(DIcon, { icon: action.icon, className: "me-2", size: "1rem" })), action.label] })) : (jsxs("button", { className: getItemClass(action), type: "button", onClick: () => {
|
|
2293
|
+
var _a;
|
|
2294
|
+
if (!action.disabled) {
|
|
2295
|
+
(_a = action.onClick) === null || _a === void 0 ? void 0 : _a.call(action);
|
|
2296
|
+
setOpen(false);
|
|
2297
|
+
}
|
|
2298
|
+
}, disabled: action.disabled, children: [action.icon && (jsx(DIcon, { icon: action.icon, className: "me-2", size: "1rem" })), action.label] })) }, index));
|
|
2299
|
+
}) })] }));
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
export { DAlert, DAvatar, DBadge, DBox, DBoxFile, DButton, DButtonIcon, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCreditCard, DCurrencyText, DDatePicker, DDropdown, DIcon, DIconBase, ForwardedDInput as DInput, DInputCheck, ForwardedDInputCounter as DInputCounter, ForwardedDInputCurrency as DInputCurrency, ForwardedDInputMask as DInputMask, ForwardedDInputPassword as DInputPassword, ForwardedDInputPhone as DInputPhone, DInputPin, ForwardedDInputRange as DInputRange, DInputSelect, DInputSwitch, DLayout$1 as DLayout, DLayoutPane, DListGroup$1 as DListGroup, DListGroupItem, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPopover, DProgress, DSelect$1 as DSelect, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DTabContent, DTableHead, DTabs$1 as DTabs, DTimeline, DToast$1 as DToast, DToastContainer, DTooltip, changeQueryString, checkMediaQuery, configureI8n as configureI18n, formatCurrency, getCssVariable, getQueryString, subscribeToMediaQuery, useDContext, useDPortalContext, useDToast, useDisableBodyScrollEffect, useDisableInputWheel, useFormatCurrency, useInputCurrency, useItemSelection, useMediaBreakpointUpLg, useMediaBreakpointUpMd, useMediaBreakpointUpSm, useMediaBreakpointUpXl, useMediaBreakpointUpXs, useMediaBreakpointUpXxl, useMediaQuery, usePortal, useProvidedRefOrCreate, useStackState, useTabContext, validatePhoneNumber };
|
|
2358
2303
|
//# sourceMappingURL=index.esm.js.map
|