@dynamic-framework/ui-react 2.2.0 → 2.3.0
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/README.md +8 -0
- package/dist/css/dynamic-ui.css +2265 -214
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +197 -132
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +195 -130
- package/dist/index.js.map +1 -1
- package/dist/types/components/DBadge/DBadge.d.ts +3 -2
- package/dist/types/components/DButton/DButton.d.ts +3 -2
- package/dist/types/components/DButtonIcon/DButtonIcon.d.ts +3 -7
- package/dist/types/components/DCollapse/DCollapse.d.ts +1 -2
- package/dist/types/components/DDatePicker/DDatePicker.d.ts +2 -1
- package/dist/types/components/DDatePicker/components/DDatePickerTime.d.ts +4 -6
- package/dist/types/components/DInputPin/DInputPin.d.ts +2 -1
- package/dist/types/components/DPopover/DPopover.d.ts +2 -7
- package/dist/types/components/DSelect/DSelect.d.ts +2 -1
- package/dist/types/components/DSelect/components/DSelectOptionCheck.d.ts +1 -1
- package/dist/types/components/DTabs/DTabs.d.ts +3 -1
- package/package.json +11 -15
- package/src/style/_shame.scss +2 -2
- package/src/style/abstracts/_mixins.scss +4 -4
- package/src/style/abstracts/_utilities.scss +69 -0
- package/src/style/abstracts/variables/_+import.scss +2 -2
- package/src/style/abstracts/variables/_alerts.scss +1 -1
- package/src/style/abstracts/variables/_border.scss +9 -0
- package/src/style/abstracts/variables/_buttons.scss +1 -1
- package/src/style/abstracts/variables/_carousel.scss +13 -1
- package/src/style/abstracts/variables/_colors.scss +2 -2
- package/src/style/abstracts/variables/_navs.scss +23 -27
- package/src/style/base/_+import.scss +1 -0
- package/src/style/base/_badge.scss +1 -1
- package/src/style/base/_carousel.scss +44 -0
- package/src/style/base/_collapse.scss +21 -8
- package/src/style/base/_nav.scss +10 -59
- package/src/style/base/_type.scss +4 -0
- package/src/style/components/_+import.scss +0 -1
- package/src/style/components/_d-avatar.scss +2 -2
- package/src/style/components/_d-carousel.scss +26 -4
- package/src/style/components/_d-chip.scss +13 -3
- package/src/style/components/_d-credit-card.scss +22 -12
- package/src/style/components/_d-icon.scss +17 -0
- package/src/style/components/_d-select.scss +59 -25
- package/src/style/components/_d-stepper-desktop.scss +2 -2
- package/src/style/components/_d-tabs.scss +7 -18
- package/src/style/components/_d-timeline.scss +6 -5
- package/src/style/components/_d-voucher.scss +1 -1
- package/src/style/helpers/_+import.scss +1 -0
- package/src/style/helpers/_animations.scss +13 -0
- package/src/style/root/_root.scss +8 -4
- package/dist/css/dynamic-ui-non-root.css +0 -50044
- package/dist/css/dynamic-ui-non-root.min.css +0 -6
- package/dist/css/dynamic-ui-root.css +0 -1116
- package/dist/css/dynamic-ui-root.min.css +0 -6
- package/src/style/components/_d-collapse-icon-text.scss +0 -16
- package/src/style/dynamic-ui-non-root.scss +0 -17
- package/src/style/dynamic-ui-root.scss +0 -5
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import React, { useEffect, useState, useCallback, useMemo, useContext, createContext, useLayoutEffect, useSyncExternalStore, forwardRef, useId, useRef } from 'react';
|
|
3
|
+
import React, { useEffect, useState, useCallback, useMemo, useContext, createContext, useLayoutEffect, useSyncExternalStore, forwardRef, useId, useRef, isValidElement, cloneElement, createRef } from 'react';
|
|
4
4
|
import { __rest } from 'tslib';
|
|
5
5
|
import * as LucideIcons from 'lucide-react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
@@ -11,15 +11,15 @@ import currency from 'currency.js';
|
|
|
11
11
|
import DatePicker from 'react-datepicker';
|
|
12
12
|
import { getYear, format, getMonth } from 'date-fns';
|
|
13
13
|
import Select, { components } from 'react-select';
|
|
14
|
+
import { getErrorMessage, ErrorBoundary } from 'react-error-boundary';
|
|
15
|
+
export { getErrorMessage, useErrorBoundary } from 'react-error-boundary';
|
|
14
16
|
import { InputMask } from '@react-input/mask';
|
|
17
|
+
import { defaultCountries, parseCountry, usePhoneInput, CountrySelector } from 'react-international-phone';
|
|
18
|
+
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
15
19
|
import ResponsivePagination from 'react-responsive-pagination';
|
|
16
20
|
import { useFloating, autoUpdate, offset, flip, shift, useClick, useDismiss, useRole, useInteractions, useId as useId$1, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
17
21
|
import { Toaster, toast } from 'react-hot-toast';
|
|
18
|
-
import { defaultCountries, parseCountry, usePhoneInput, CountrySelector } from 'react-international-phone';
|
|
19
|
-
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
20
22
|
import html2canvas from 'html2canvas';
|
|
21
|
-
import { getErrorMessage, ErrorBoundary } from 'react-error-boundary';
|
|
22
|
-
export { getErrorMessage, useErrorBoundary } from 'react-error-boundary';
|
|
23
23
|
import i18n from 'i18next';
|
|
24
24
|
import { initReactI18next } from 'react-i18next';
|
|
25
25
|
|
|
@@ -412,21 +412,6 @@ function DIconBase({ icon, color, style, className, size, useListenerSize = fals
|
|
|
412
412
|
const icons = LucideIcons;
|
|
413
413
|
return icons[icon] || null;
|
|
414
414
|
}, [icon, useMaterialIcons]);
|
|
415
|
-
const colorStyle = useMemo(() => {
|
|
416
|
-
if (color) {
|
|
417
|
-
return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${color})` };
|
|
418
|
-
}
|
|
419
|
-
return {};
|
|
420
|
-
}, [color]);
|
|
421
|
-
const backgroundStyle = useMemo(() => {
|
|
422
|
-
if (hasCircle) {
|
|
423
|
-
if (color) {
|
|
424
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${color}-rgb), 0.1)` };
|
|
425
|
-
}
|
|
426
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}body-color-rgb), 0.1)` };
|
|
427
|
-
}
|
|
428
|
-
return {};
|
|
429
|
-
}, [hasCircle, color]);
|
|
430
415
|
const { responsivePropValue } = useResponsiveProp(useListenerSize);
|
|
431
416
|
const resolvedSize = useMemo(() => {
|
|
432
417
|
if (!size)
|
|
@@ -435,8 +420,8 @@ function DIconBase({ icon, color, style, className, size, useListenerSize = fals
|
|
|
435
420
|
return size;
|
|
436
421
|
return responsivePropValue(size);
|
|
437
422
|
}, [responsivePropValue, size]);
|
|
438
|
-
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign(Object.assign(
|
|
439
|
-
const generateClasses = useMemo(() => (Object.assign({ 'd-icon': true }, className && { [className]: true })), [className]);
|
|
423
|
+
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign(Object.assign({}, resolvedSize && { [`--${PREFIX_BS}icon-component-size`]: resolvedSize }), hasCircle && { [`--${PREFIX_BS}icon-component-padding`]: `calc(var(--${PREFIX_BS}icon-component-size, 24px) * 0.4)` }), style)), [resolvedSize, hasCircle, style]);
|
|
424
|
+
const generateClasses = useMemo(() => (Object.assign(Object.assign(Object.assign({ 'd-icon': true }, className && { [className]: true }), { 'd-icon-has-circle': hasCircle }), color && { [`d-icon-color-${color}`]: true })), [className, hasCircle, color]);
|
|
440
425
|
const iconSize = useMemo(() => {
|
|
441
426
|
if (resolvedSize) {
|
|
442
427
|
const numSize = parseInt(resolvedSize, 10);
|
|
@@ -491,14 +476,24 @@ function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, c
|
|
|
491
476
|
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 })] })));
|
|
492
477
|
}
|
|
493
478
|
|
|
494
|
-
function DBadge(
|
|
479
|
+
function DBadge(props) {
|
|
480
|
+
const { text, soft = false, color = 'primary', id, rounded, className, size, style, iconStart, iconEnd, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, dataAttributes, } = props;
|
|
481
|
+
// Responsive size resolution using useResponsiveProp
|
|
482
|
+
const { responsivePropValue } = useResponsiveProp(true);
|
|
483
|
+
const resolvedSize = useMemo(() => {
|
|
484
|
+
if (!size)
|
|
485
|
+
return undefined;
|
|
486
|
+
if (typeof size === 'string')
|
|
487
|
+
return size;
|
|
488
|
+
return responsivePropValue(size);
|
|
489
|
+
}, [responsivePropValue, size]);
|
|
495
490
|
const generateClasses = useMemo(() => ({
|
|
496
491
|
badge: true,
|
|
497
492
|
[`badge-${color}`]: !!color && !soft,
|
|
498
493
|
[`badge-soft-${color}`]: !!color && soft,
|
|
499
494
|
'rounded-pill': !!rounded,
|
|
500
|
-
[`badge-${
|
|
501
|
-
}), [rounded, soft, color,
|
|
495
|
+
[`badge-${resolvedSize}`]: !!resolvedSize,
|
|
496
|
+
}), [rounded, soft, color, resolvedSize]);
|
|
502
497
|
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 }))] })));
|
|
503
498
|
}
|
|
504
499
|
|
|
@@ -593,7 +588,7 @@ function DInput(_a, ref) {
|
|
|
593
588
|
[`input-group-${size}`]: !!size,
|
|
594
589
|
'input-group': true,
|
|
595
590
|
'has-validation': invalid || valid,
|
|
596
|
-
}), children: [!!inputStart && (jsx("div", { className: "input-group-text", id: `${id}InputStart`, children: inputStart })), iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading || iconStartDisabled, "aria-label": iconStartAriaLabel, tabIndex:
|
|
591
|
+
}), children: [!!inputStart && (jsx("div", { className: "input-group-text", id: `${id}InputStart`, children: inputStart })), iconStart && (onIconStartClick ? (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading || iconStartDisabled, "aria-label": iconStartAriaLabel || (typeof iconStart === 'string' ? iconStart : 'start icon'), tabIndex: iconStartTabIndex, children: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })) : (jsx("div", { className: "input-group-text", id: `${id}Start`, "aria-hidden": "true", tabIndex: -1, children: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) }))), dynamicComponent, (iconEnd && !loading) && (onIconEndClick ? (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading || iconEndDisabled, "aria-label": iconEndAriaLabel || (typeof iconEnd === 'string' ? iconEnd : 'end icon'), tabIndex: iconEndTabIndex, children: jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })) : (jsx("div", { className: "input-group-text", id: `${id}End`, "aria-hidden": "true", tabIndex: -1, children: jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) }))), loading && (jsx("div", { className: "input-group-text", id: `${id}Loading`, children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", "data-testid": "loading-spinner", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })), !!inputEnd && (jsx("div", { className: "input-group-text", id: `${id}InputEnd`, children: inputEnd }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
597
592
|
}
|
|
598
593
|
const ForwardedDInput = forwardRef(DInput);
|
|
599
594
|
ForwardedDInput.displayName = 'DInput';
|
|
@@ -1003,7 +998,16 @@ function DBoxFile(_a) {
|
|
|
1003
998
|
}
|
|
1004
999
|
|
|
1005
1000
|
const DButton = forwardRef((props, ref) => {
|
|
1006
|
-
const { color = 'primary', size, variant, text, children, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, loading = false, loadingText, loadingAriaLabel, disabled = false, className, style, dataAttributes, onClick, type = 'button', target, rel } = props, rest = __rest(props, ["color", "size", "variant", "text", "children", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartMaterialStyle", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndMaterialStyle", "loading", "loadingText", "loadingAriaLabel", "disabled", "className", "style", "dataAttributes", "onClick", "type", "target", "rel"]);
|
|
1001
|
+
const { color = 'primary', size, variant, text, children, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, loading = false, loadingText, loadingAriaLabel, disabled = false, className, style, dataAttributes, onClick, type = 'button', target, rel, href, 'aria-label': ariaLabelProp } = props, rest = __rest(props, ["color", "size", "variant", "text", "children", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartMaterialStyle", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndMaterialStyle", "loading", "loadingText", "loadingAriaLabel", "disabled", "className", "style", "dataAttributes", "onClick", "type", "target", "rel", "href", 'aria-label']);
|
|
1002
|
+
// Responsive size resolution using useResponsiveProp
|
|
1003
|
+
const { responsivePropValue } = useResponsiveProp(true);
|
|
1004
|
+
const resolvedSize = useMemo(() => {
|
|
1005
|
+
if (!size)
|
|
1006
|
+
return undefined;
|
|
1007
|
+
if (typeof size === 'string')
|
|
1008
|
+
return size;
|
|
1009
|
+
return responsivePropValue(size);
|
|
1010
|
+
}, [responsivePropValue, size]);
|
|
1007
1011
|
const [buttonWidth, setButtonWidth] = useState();
|
|
1008
1012
|
const buttonRef = useRef(null);
|
|
1009
1013
|
const isDisabled = useMemo(() => disabled || loading, [disabled, loading]);
|
|
@@ -1015,16 +1019,13 @@ const DButton = forwardRef((props, ref) => {
|
|
|
1015
1019
|
return {
|
|
1016
1020
|
btn: true,
|
|
1017
1021
|
[variantClass]: true,
|
|
1018
|
-
[`btn-${
|
|
1022
|
+
[`btn-${resolvedSize}`]: !!resolvedSize,
|
|
1019
1023
|
loading,
|
|
1020
1024
|
};
|
|
1021
|
-
}, [variant, color,
|
|
1022
|
-
const ariaLabel = useMemo(() =>
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
? loadingAriaLabel || ariaLabelProp || text
|
|
1026
|
-
: ariaLabelProp || text;
|
|
1027
|
-
}, [loading, loadingAriaLabel, rest, text]);
|
|
1025
|
+
}, [variant, color, loading, resolvedSize]);
|
|
1026
|
+
const ariaLabel = useMemo(() => (loading
|
|
1027
|
+
? loadingAriaLabel || ariaLabelProp || text
|
|
1028
|
+
: ariaLabelProp || text), [loading, loadingAriaLabel, text, ariaLabelProp]);
|
|
1028
1029
|
const handleClick = useCallback((event) => {
|
|
1029
1030
|
if (disabled || loading) {
|
|
1030
1031
|
event.preventDefault();
|
|
@@ -1040,8 +1041,8 @@ const DButton = forwardRef((props, ref) => {
|
|
|
1040
1041
|
}
|
|
1041
1042
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1042
1043
|
}, [content, iconEnd, iconStart]);
|
|
1043
|
-
if (
|
|
1044
|
-
return (jsxs("a", Object.assign({ href:
|
|
1044
|
+
if (href) {
|
|
1045
|
+
return (jsxs("a", Object.assign({ href: href, target: target, rel: rel, ref: (node) => {
|
|
1045
1046
|
buttonRef.current = node;
|
|
1046
1047
|
if (typeof ref === 'function')
|
|
1047
1048
|
ref(node);
|
|
@@ -1069,7 +1070,8 @@ const DButton = forwardRef((props, ref) => {
|
|
|
1069
1070
|
});
|
|
1070
1071
|
DButton.displayName = 'DButton';
|
|
1071
1072
|
|
|
1072
|
-
function DButtonIcon(
|
|
1073
|
+
function DButtonIcon(_a) {
|
|
1074
|
+
var { id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, disabled = false, color = 'primary', loading = false, href, target, rel, stopPropagationEnabled = true, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, 'aria-label': ariaLabelProp } = _a, rest = __rest(_a, ["id", "icon", "size", "className", "variant", "state", "loadingAriaLabel", "iconMaterialStyle", "disabled", "color", "loading", "href", "target", "rel", "stopPropagationEnabled", "style", "iconFamilyClass", "iconFamilyPrefix", "dataAttributes", "onClick", 'aria-label']);
|
|
1073
1075
|
const generateClasses = useMemo(() => {
|
|
1074
1076
|
const variantClass = variant
|
|
1075
1077
|
? `btn-${variant}-${color}`
|
|
@@ -1087,15 +1089,15 @@ function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLab
|
|
|
1087
1089
|
}
|
|
1088
1090
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
1089
1091
|
}, [stopPropagationEnabled, onClick, isDisabled]);
|
|
1090
|
-
const
|
|
1091
|
-
?
|
|
1092
|
-
:
|
|
1092
|
+
const ariaLabel = useMemo(() => (loading
|
|
1093
|
+
? loadingAriaLabel || ariaLabelProp
|
|
1094
|
+
: ariaLabelProp), [loading, loadingAriaLabel, ariaLabelProp]);
|
|
1093
1095
|
if (href) {
|
|
1094
|
-
return (jsx("a", Object.assign({ href: href, target: target, rel: rel, className: classNames(generateClasses, className), style: style, onClick: clickHandler, "aria-label":
|
|
1096
|
+
return (jsx("a", Object.assign({ id: id, href: href, target: target, rel: rel, className: classNames(generateClasses, className), style: style, onClick: clickHandler, "aria-label": ariaLabel, "aria-disabled": isDisabled }, dataAttributes, { children: loading
|
|
1095
1097
|
? (jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }))
|
|
1096
1098
|
: (jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })) })));
|
|
1097
1099
|
}
|
|
1098
|
-
return (jsx("button", Object.assign({ className: classNames(generateClasses, className), style: style,
|
|
1100
|
+
return (jsx("button", Object.assign({ className: classNames(generateClasses, className), style: style, disabled: state === 'disabled' || loading, onClick: clickHandler, "aria-label": ariaLabel }, dataAttributes, rest, { children: loading
|
|
1099
1101
|
? (jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }))
|
|
1100
1102
|
: (jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })) })));
|
|
1101
1103
|
}
|
|
@@ -1155,7 +1157,7 @@ function DChip({ color = 'primary', text, icon, iconFamilyClass, iconFamilyPrefi
|
|
|
1155
1157
|
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 }) }))] })));
|
|
1156
1158
|
}
|
|
1157
1159
|
|
|
1158
|
-
function DCollapse({ id, className, style, Component,
|
|
1160
|
+
function DCollapse({ id, className, style, Component, defaultCollapsed = true, onChange, children, iconOpen: iconOpenProp, iconClose: iconCloseProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle = false, dataAttributes, }) {
|
|
1159
1161
|
const [collapsed, setCollapsed] = useState(defaultCollapsed);
|
|
1160
1162
|
const onChangeCollapse = () => {
|
|
1161
1163
|
setCollapsed((prev) => {
|
|
@@ -1172,12 +1174,9 @@ function DCollapse({ id, className, style, Component, hasSeparator = false, defa
|
|
|
1172
1174
|
const { iconMap: { chevronDown, chevronUp, }, } = useDContext();
|
|
1173
1175
|
const iconOpen = useMemo(() => iconOpenProp || chevronDown, [chevronDown, iconOpenProp]);
|
|
1174
1176
|
const iconClose = useMemo(() => iconCloseProp || chevronUp, [chevronUp, iconCloseProp]);
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
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({
|
|
1179
|
-
'collapse-body': true,
|
|
1180
|
-
}), style: generateStyles, children: children }))] })));
|
|
1177
|
+
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: "primary", size: "1.25rem", icon: collapsed ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), jsx("div", { className: classNames('collapse-body-wrapper', {
|
|
1178
|
+
show: !collapsed,
|
|
1179
|
+
}), children: jsx("div", { className: "collapse-body", children: children }) })] })));
|
|
1181
1180
|
}
|
|
1182
1181
|
|
|
1183
1182
|
function formatCurrency(amount, options) {
|
|
@@ -1199,10 +1198,9 @@ function DCurrencyText({ value, className, style, dataAttributes, }) {
|
|
|
1199
1198
|
return (jsx("span", Object.assign({ className: className, style: style }, dataAttributes, { children: valueFormatted })));
|
|
1200
1199
|
}
|
|
1201
1200
|
|
|
1202
|
-
function DDatePickerTime(
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
} }));
|
|
1201
|
+
function DDatePickerTime(_a) {
|
|
1202
|
+
var rest = __rest(_a, []);
|
|
1203
|
+
return (jsx(ForwardedDInput, Object.assign({ className: "d-datepicker-time", type: "time" }, rest)));
|
|
1206
1204
|
}
|
|
1207
1205
|
|
|
1208
1206
|
function DDatePickerInput(_a, ref) {
|
|
@@ -1213,62 +1211,11 @@ function DDatePickerInput(_a, ref) {
|
|
|
1213
1211
|
const ForwardedDDatePickerInput = forwardRef(DDatePickerInput);
|
|
1214
1212
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
1215
1213
|
|
|
1216
|
-
function DInputCheck(_a) {
|
|
1217
|
-
var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, inputClassName, value, hint, onChange, className, style, dataAttributes } = _a, props = __rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "inputClassName", "value", "hint", "onChange", "className", "style", "dataAttributes"]);
|
|
1218
|
-
const innerRef = useRef(null);
|
|
1219
|
-
const innerId = useId();
|
|
1220
|
-
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1221
|
-
const handleChange = useCallback((event) => {
|
|
1222
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1223
|
-
}, [onChange]);
|
|
1224
|
-
const ariaDescribedby = useMemo(() => ([
|
|
1225
|
-
!!hint && `${id}Hint`,
|
|
1226
|
-
]
|
|
1227
|
-
.filter(Boolean)
|
|
1228
|
-
.join(' ')), [
|
|
1229
|
-
id,
|
|
1230
|
-
hint,
|
|
1231
|
-
]);
|
|
1232
|
-
useEffect(() => {
|
|
1233
|
-
if (innerRef.current) {
|
|
1234
|
-
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
1235
|
-
}
|
|
1236
|
-
}, [indeterminate]);
|
|
1237
|
-
useEffect(() => {
|
|
1238
|
-
if (innerRef.current) {
|
|
1239
|
-
innerRef.current.checked = checked;
|
|
1240
|
-
}
|
|
1241
|
-
}, [checked]);
|
|
1242
|
-
const inputComponent = useMemo(() => (jsx("input", Object.assign({ ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
|
|
1243
|
-
'is-invalid': invalid,
|
|
1244
|
-
'is-valid': valid,
|
|
1245
|
-
}, inputClassName), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, props))), [
|
|
1246
|
-
handleChange,
|
|
1247
|
-
invalid,
|
|
1248
|
-
valid,
|
|
1249
|
-
inputClassName,
|
|
1250
|
-
style,
|
|
1251
|
-
id,
|
|
1252
|
-
disabled,
|
|
1253
|
-
type,
|
|
1254
|
-
name,
|
|
1255
|
-
value,
|
|
1256
|
-
ariaLabel,
|
|
1257
|
-
ariaDescribedby,
|
|
1258
|
-
props,
|
|
1259
|
-
]);
|
|
1260
|
-
if (!label) {
|
|
1261
|
-
return inputComponent;
|
|
1262
|
-
}
|
|
1263
|
-
return (jsxs("div", Object.assign({ className: classNames('form-check', className) }, dataAttributes, { children: [inputComponent, jsx("label", { className: "form-check-label", htmlFor: id, children: label }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
1214
|
function DSelectOptionCheck(_a) {
|
|
1267
|
-
var {
|
|
1268
|
-
return (
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
}), isSelected: isSelected, innerProps: innerProps }, props, { children: jsxs("label", { htmlFor: `${innerProps.id}Check`, children: [jsx(DInputCheck, { type: "checkbox", checked: isSelected, id: `${innerProps.id}Check` }), children] }) })));
|
|
1215
|
+
var { children, isSelected } = _a, props = __rest(_a, ["children", "isSelected"]);
|
|
1216
|
+
return (jsxs(components.Option, Object.assign({}, props, { isSelected: isSelected, className: classNames('d-select__option'), children: [jsx("span", { className: classNames('d-select__check', {
|
|
1217
|
+
'd-select__check--selected': isSelected,
|
|
1218
|
+
}), "aria-hidden": "true" }), jsx("span", { className: "d-select__label", children: children })] })));
|
|
1272
1219
|
}
|
|
1273
1220
|
|
|
1274
1221
|
function DSelectOptionIcon(_a) {
|
|
@@ -1339,7 +1286,7 @@ function DSelectPlaceholder(_a) {
|
|
|
1339
1286
|
}
|
|
1340
1287
|
|
|
1341
1288
|
function DSelect(_a) {
|
|
1342
|
-
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"]);
|
|
1289
|
+
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, ariaLabel = 'Search for an option' } = _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", "ariaLabel"]);
|
|
1343
1290
|
const innerId = useId();
|
|
1344
1291
|
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1345
1292
|
const handleOnIconStartClick = useCallback(() => {
|
|
@@ -1355,7 +1302,7 @@ function DSelect(_a) {
|
|
|
1355
1302
|
'input-group': true,
|
|
1356
1303
|
'has-validation': invalid,
|
|
1357
1304
|
disabled: disabled || loading,
|
|
1358
|
-
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsx(Select, Object.assign({ id: `${id}Container`, inputId: id, styles: {
|
|
1305
|
+
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsx(Select, Object.assign({ id: `${id}Container`, inputId: id, "aria-label": ariaLabel, styles: {
|
|
1359
1306
|
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
1360
1307
|
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
1361
1308
|
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%', zIndex: 1000 })),
|
|
@@ -1410,16 +1357,16 @@ function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMont
|
|
|
1410
1357
|
}, [date]);
|
|
1411
1358
|
const [startYear, endYear] = getYearRange();
|
|
1412
1359
|
if (pickerType === PickerType.Year) {
|
|
1413
|
-
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,
|
|
1360
|
+
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, "aria-label": prevYearAriaLabel, className: "header-button" }), jsx("p", { children: `${startYear} - ${endYear}` }), jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextYearButtonDisabled, "aria-label": nextYearAriaLabel, className: "header-button" })] }));
|
|
1414
1361
|
}
|
|
1415
1362
|
if (pickerType === PickerType.Quarter || pickerType === PickerType.Month) {
|
|
1416
|
-
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,
|
|
1363
|
+
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, "aria-label": 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, "aria-label": nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] }));
|
|
1417
1364
|
}
|
|
1418
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: "datepicker-top-header", 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, className: "custom-year-selector" })), jsx("h4", { className: "mb-0 fw-normal", children: format(monthDate, formatHeaderDate, { 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,
|
|
1365
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: "datepicker-top-header", 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, className: "custom-year-selector" })), jsx("h4", { className: "mb-0 fw-normal", children: format(monthDate, formatHeaderDate, { 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, "aria-label": 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, "aria-label": nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] })] }));
|
|
1419
1366
|
}
|
|
1420
1367
|
|
|
1421
1368
|
function DDatePicker(_a) {
|
|
1422
|
-
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, formatHeaderDate } = _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", "formatHeaderDate"]);
|
|
1369
|
+
var { inputLabel, inputHint, inputAriaLabel, ariaLabelInputTime, 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, formatHeaderDate } = _a, props = __rest(_a, ["inputLabel", "inputHint", "inputAriaLabel", "ariaLabelInputTime", "inputActionAriaLabel", "inputId", "timeId", "timeInputLabel", "minYearSelect", "maxYearSelect", "iconHeaderSize", "iconMaterialStyle", "iconInput", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "invalid", "valid", "renderCustomHeader", "className", "dateFormatCalendar", "style", "dataAttributes", "placeholder", "showHeaderSelectors", "formatHeaderDate"]);
|
|
1423
1370
|
const pickerType = useMemo(() => {
|
|
1424
1371
|
if (props.showQuarterYearPicker)
|
|
1425
1372
|
return PickerType.Quarter;
|
|
@@ -1447,7 +1394,7 @@ function DDatePicker(_a) {
|
|
|
1447
1394
|
]);
|
|
1448
1395
|
const defaultRenderCustomHeader = useCallback((headerProps) => (jsx(DatePickerHeader, Object.assign({}, headerProps))), [DatePickerHeader]);
|
|
1449
1396
|
const renderCustomHeader = useMemo(() => (renderCustomHeaderProp || defaultRenderCustomHeader), [defaultRenderCustomHeader, renderCustomHeaderProp]);
|
|
1450
|
-
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 })) })));
|
|
1397
|
+
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, "aria-label": ariaLabelInputTime })) })));
|
|
1451
1398
|
}
|
|
1452
1399
|
|
|
1453
1400
|
function DLayoutPane({ className, style, children, cols, colsXs, colsSm, colsMd, colsLg, colsXl, colsXxl, dataAttributes, }) {
|
|
@@ -1724,7 +1671,57 @@ function DPasswordStrengthMeter({ id, label = 'Password', placeholder, value = '
|
|
|
1724
1671
|
return (jsxs("div", Object.assign({ className: className, style: style }, dataAttributes, { children: [jsx(ForwardedDInputPassword, { id: id, label: label, placeholder: placeholder, value: password, name: name, disabled: disabled, invalid: invalid, onChange: handleChange }), jsx(PasswordChecksList, { password: password, validationMessages: validationMessages, enabledChecks: enabledChecks })] })));
|
|
1725
1672
|
}
|
|
1726
1673
|
|
|
1727
|
-
function
|
|
1674
|
+
function DInputCheck(_a) {
|
|
1675
|
+
var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, inputClassName, value, hint, onChange, className, style, dataAttributes } = _a, props = __rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "inputClassName", "value", "hint", "onChange", "className", "style", "dataAttributes"]);
|
|
1676
|
+
const innerRef = useRef(null);
|
|
1677
|
+
const innerId = useId();
|
|
1678
|
+
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1679
|
+
const handleChange = useCallback((event) => {
|
|
1680
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1681
|
+
}, [onChange]);
|
|
1682
|
+
const ariaDescribedby = useMemo(() => ([
|
|
1683
|
+
!!hint && `${id}Hint`,
|
|
1684
|
+
]
|
|
1685
|
+
.filter(Boolean)
|
|
1686
|
+
.join(' ')), [
|
|
1687
|
+
id,
|
|
1688
|
+
hint,
|
|
1689
|
+
]);
|
|
1690
|
+
useEffect(() => {
|
|
1691
|
+
if (innerRef.current) {
|
|
1692
|
+
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
1693
|
+
}
|
|
1694
|
+
}, [indeterminate]);
|
|
1695
|
+
useEffect(() => {
|
|
1696
|
+
if (innerRef.current) {
|
|
1697
|
+
innerRef.current.checked = checked;
|
|
1698
|
+
}
|
|
1699
|
+
}, [checked]);
|
|
1700
|
+
const inputComponent = useMemo(() => (jsx("input", Object.assign({ ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
|
|
1701
|
+
'is-invalid': invalid,
|
|
1702
|
+
'is-valid': valid,
|
|
1703
|
+
}, inputClassName), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, props))), [
|
|
1704
|
+
handleChange,
|
|
1705
|
+
invalid,
|
|
1706
|
+
valid,
|
|
1707
|
+
inputClassName,
|
|
1708
|
+
style,
|
|
1709
|
+
id,
|
|
1710
|
+
disabled,
|
|
1711
|
+
type,
|
|
1712
|
+
name,
|
|
1713
|
+
value,
|
|
1714
|
+
ariaLabel,
|
|
1715
|
+
ariaDescribedby,
|
|
1716
|
+
props,
|
|
1717
|
+
]);
|
|
1718
|
+
if (!label) {
|
|
1719
|
+
return inputComponent;
|
|
1720
|
+
}
|
|
1721
|
+
return (jsxs("div", Object.assign({ className: classNames('form-check', className) }, dataAttributes, { children: [inputComponent, jsx("label", { className: "form-check-label", htmlFor: id, children: label }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
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, 'aria-label': ariaLabel = 'Pin character number', }) {
|
|
1728
1725
|
const innerId = useId();
|
|
1729
1726
|
const id = useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1730
1727
|
const [pattern, setPattern] = useState('');
|
|
@@ -1801,7 +1798,7 @@ function DInputPin({ id: idProp, label = '', placeholder, type = 'text', disable
|
|
|
1801
1798
|
'form-control': true,
|
|
1802
1799
|
'is-invalid': invalid,
|
|
1803
1800
|
'is-valid': valid,
|
|
1804
|
-
}), value: activeInput[index], type: secret ? 'password' : type, "aria-
|
|
1801
|
+
}), value: activeInput[index], type: secret ? 'password' : type, "aria-label": `${ariaLabel} ${index + 1} of ${characters}`, 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 }))] })));
|
|
1805
1802
|
}
|
|
1806
1803
|
|
|
1807
1804
|
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, }) {
|
|
@@ -2115,9 +2112,7 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
|
|
|
2115
2112
|
}, [open]);
|
|
2116
2113
|
const onOpenChange = useCallback((value) => {
|
|
2117
2114
|
setIsOpen(value);
|
|
2118
|
-
|
|
2119
|
-
setOpen(value);
|
|
2120
|
-
}
|
|
2115
|
+
setOpen === null || setOpen === void 0 ? void 0 : setOpen(value);
|
|
2121
2116
|
}, [setOpen]);
|
|
2122
2117
|
const { refs, floatingStyles, context, } = useFloating({
|
|
2123
2118
|
open: isOpen,
|
|
@@ -2141,7 +2136,12 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
|
|
|
2141
2136
|
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), (adjustContentToRender && {
|
|
2142
2137
|
[`--${PREFIX_BS}popover-component-min-width`]: 'auto',
|
|
2143
2138
|
}))), [style, adjustContentToRender]);
|
|
2144
|
-
|
|
2139
|
+
const triggerElement = renderComponent(isOpen);
|
|
2140
|
+
if (!isValidElement(triggerElement)) {
|
|
2141
|
+
throw new Error('renderComponent must return a valid React element');
|
|
2142
|
+
}
|
|
2143
|
+
const reference = cloneElement(triggerElement, Object.assign({ ref: refs.setReference }, getReferenceProps(triggerElement.props)));
|
|
2144
|
+
return (jsxs("div", Object.assign({ className: classNames('d-popover', className), style: generateStyleVariables }, dataAttributes, { children: [reference, isOpen && (jsx(FloatingFocusManager, { context: context, modal: false, children: jsx("div", Object.assign({ className: classNames('d-popover-content', {
|
|
2145
2145
|
'w-100': adjustContentToRender,
|
|
2146
2146
|
}), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] })));
|
|
2147
2147
|
}
|
|
@@ -2250,7 +2250,7 @@ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT +
|
|
|
2250
2250
|
function DTimeline({ className, style, dataAttributes, items, }) {
|
|
2251
2251
|
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', {
|
|
2252
2252
|
[`d-timeline-item-${item.status}`]: item.status,
|
|
2253
|
-
}), children: [jsx("div", { className: "d-timeline-item-connector" }), jsx("div", { className: "d-timeline-item-icon", children: jsx(
|
|
2253
|
+
}), children: [jsx("div", { className: "d-timeline-item-connector" }), jsx("div", { className: "d-timeline-item-icon", children: jsx(DIcon, { icon: item.icon || 'check', size: "1rem" }) }), 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))) })));
|
|
2254
2254
|
}
|
|
2255
2255
|
|
|
2256
2256
|
const TabContext = createContext(undefined);
|
|
@@ -2270,7 +2270,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
2270
2270
|
return (jsx("div", { className: classNames('tab-pane fade show active', className), id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab`, style: style, children: children }));
|
|
2271
2271
|
}
|
|
2272
2272
|
|
|
2273
|
-
function DTabs({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', dataAttributes, }) {
|
|
2273
|
+
function DTabs({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', dataAttributes, ariaLabel, ariaLabelledBy, }) {
|
|
2274
2274
|
const [selected, setSelected] = useState(defaultSelected);
|
|
2275
2275
|
const onSelect = useCallback((option) => {
|
|
2276
2276
|
if (option.tab) {
|
|
@@ -2281,17 +2281,83 @@ function DTabs({ children, defaultSelected, onChange, options, className, classN
|
|
|
2281
2281
|
useEffect(() => {
|
|
2282
2282
|
setSelected(defaultSelected);
|
|
2283
2283
|
}, [defaultSelected]);
|
|
2284
|
+
const generateClasses = useMemo(() => (Object.assign({ nav: true, 'flex-column align-items-center': vertical && variant !== 'tabs', [`nav-${variant}`]: true }, className && { [className]: true })), [vertical, variant, className]);
|
|
2285
|
+
const tabRefs = useRef([]);
|
|
2286
|
+
useEffect(() => {
|
|
2287
|
+
tabRefs.current = options.map((_, i) => tabRefs.current[i] || createRef());
|
|
2288
|
+
}, [options]);
|
|
2289
|
+
// Ensure selected is never disabled
|
|
2290
|
+
useEffect(() => {
|
|
2291
|
+
if (options.length === 0)
|
|
2292
|
+
return;
|
|
2293
|
+
const selectedOption = options.find((opt) => opt.tab === selected);
|
|
2294
|
+
if (selectedOption && selectedOption.disabled) {
|
|
2295
|
+
const firstEnabled = options.find((opt) => !opt.disabled);
|
|
2296
|
+
if (firstEnabled)
|
|
2297
|
+
setSelected(firstEnabled.tab);
|
|
2298
|
+
}
|
|
2299
|
+
}, [options, selected]);
|
|
2300
|
+
// Declarative focus management
|
|
2301
|
+
const focusTab = (idx) => {
|
|
2302
|
+
var _a;
|
|
2303
|
+
if ((_a = tabRefs.current[idx]) === null || _a === void 0 ? void 0 : _a.current) {
|
|
2304
|
+
tabRefs.current[idx].current.focus();
|
|
2305
|
+
}
|
|
2306
|
+
};
|
|
2307
|
+
// Focus selected tab when selected changes
|
|
2308
|
+
useEffect(() => {
|
|
2309
|
+
const idx = options.findIndex((opt) => opt.tab === selected && !opt.disabled);
|
|
2310
|
+
if (idx !== -1) {
|
|
2311
|
+
focusTab(idx);
|
|
2312
|
+
}
|
|
2313
|
+
}, [selected, options]);
|
|
2314
|
+
const handleKeyDown = useCallback((idx, e) => {
|
|
2315
|
+
const count = options.length;
|
|
2316
|
+
if (count === 0)
|
|
2317
|
+
return;
|
|
2318
|
+
let next = idx;
|
|
2319
|
+
let prev = idx;
|
|
2320
|
+
if (e.key === 'ArrowRight' || (vertical && e.key === 'ArrowDown')) {
|
|
2321
|
+
e.preventDefault();
|
|
2322
|
+
for (let i = 0; i < count; i += 1) {
|
|
2323
|
+
next = (next + 1) % count;
|
|
2324
|
+
if (!options[next].disabled) {
|
|
2325
|
+
focusTab(next);
|
|
2326
|
+
setSelected(options[next].tab);
|
|
2327
|
+
break;
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
if (e.key === 'ArrowLeft' || (vertical && e.key === 'ArrowUp')) {
|
|
2332
|
+
e.preventDefault();
|
|
2333
|
+
for (let i = 0; i < count; i += 1) {
|
|
2334
|
+
prev = (prev - 1 + count) % count;
|
|
2335
|
+
if (!options[prev].disabled) {
|
|
2336
|
+
focusTab(prev);
|
|
2337
|
+
setSelected(options[prev].tab);
|
|
2338
|
+
break;
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
}, [options, vertical]);
|
|
2343
|
+
let tablistProps = {};
|
|
2344
|
+
if (ariaLabelledBy) {
|
|
2345
|
+
tablistProps = { 'aria-labelledby': ariaLabelledBy };
|
|
2346
|
+
}
|
|
2347
|
+
else if (ariaLabel) {
|
|
2348
|
+
tablistProps = { 'aria-label': ariaLabel };
|
|
2349
|
+
}
|
|
2284
2350
|
const isSelected = useCallback((tab) => (selected === tab), [selected]);
|
|
2285
2351
|
const value = useMemo(() => ({
|
|
2286
2352
|
isSelected,
|
|
2287
2353
|
}), [isSelected]);
|
|
2288
|
-
const generateClasses = useMemo(() => (Object.assign({ nav: true, 'flex-column align-items-center': vertical && variant !== 'tabs', [`nav-${variant}`]: true }, className && { [className]: true })), [vertical, variant, className]);
|
|
2289
2354
|
return (jsx(TabContext.Provider, { value: value, children: jsxs("div", Object.assign({ className: classNames({
|
|
2290
2355
|
'd-flex w-100': true,
|
|
2291
2356
|
'flex-column': !vertical || variant === 'tabs',
|
|
2292
|
-
}), style: style }, dataAttributes, { children: [jsx("
|
|
2293
|
-
|
|
2294
|
-
}, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected":
|
|
2357
|
+
}), style: style }, dataAttributes, { children: [jsx("ul", Object.assign({ className: classNames(generateClasses), role: "tablist", "aria-orientation": vertical ? 'vertical' : undefined }, tablistProps, { children: options.map((option, idx) => {
|
|
2358
|
+
const isTabSelected = !!option.tab && option.tab === selected;
|
|
2359
|
+
return (jsx("li", { role: "presentation", className: "nav-item", children: jsx("button", { ref: tabRefs.current[idx], id: `${option.tab}Tab`, className: classNames('nav-link', { active: isTabSelected }, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": isTabSelected, tabIndex: isTabSelected ? 0 : -1, disabled: option.disabled, onClick: () => onSelect(option), onKeyDown: (e) => handleKeyDown(idx, e), children: option.label }) }, option.tab));
|
|
2360
|
+
}) })), jsx("div", { className: "tab-content w-100", children: children })] })) }));
|
|
2295
2361
|
}
|
|
2296
2362
|
var DTabs$1 = Object.assign(DTabs, {
|
|
2297
2363
|
Tab: DTabContent,
|
|
@@ -2481,7 +2547,7 @@ const BRAND_LOGOS = {
|
|
|
2481
2547
|
mastercard: 'https://cdn.modyo.cloud/uploads/f686b9aa-65ab-4369-9db3-89ceece84f29/original/mastercard.png',
|
|
2482
2548
|
};
|
|
2483
2549
|
function DCreditCard({ brand = 'visa', name, number, holderText = 'Card Holder', logoImage, isChipVisible = true, className, isVertical = false, }) {
|
|
2484
|
-
return (jsxs("div", { className: classNames('d-credit-card
|
|
2550
|
+
return (jsxs("div", { className: classNames('d-credit-card', isVertical && 'is-vertical', className), children: [jsxs("div", { className: "d-credit-card-header", children: [jsx("img", { src: logoImage || BRAND_LOGOS[brand] || DEFAULT_IMAGE, alt: brand, className: "d-credit-card-logo", width: 100 }), isChipVisible && (jsx("div", { className: "d-credit-card-chip", children: jsx("img", { src: CHIP_IMAGE, alt: "chip", width: 30, className: "d-credit-card-chip-image" }) }))] }), jsxs("div", { className: "d-credit-card-details", children: [jsx("div", { className: "d-credit-card-number", children: number }), jsx("small", { className: "d-credit-card-holder-text", children: holderText }), jsx("span", { className: "d-credit-card-name", children: name })] })] }));
|
|
2485
2551
|
}
|
|
2486
2552
|
|
|
2487
2553
|
const getItemClass = (action) => {
|
|
@@ -2503,7 +2569,6 @@ function DDropdown({ actions, dropdownToggle, className, }) {
|
|
|
2503
2569
|
document.addEventListener('mousedown', handleClickOutside);
|
|
2504
2570
|
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
2505
2571
|
}, []);
|
|
2506
|
-
// 🆕 Calcular posición del menú al abrir
|
|
2507
2572
|
useEffect(() => {
|
|
2508
2573
|
if (open && dropdownRef.current) {
|
|
2509
2574
|
const rect = dropdownRef.current.getBoundingClientRect();
|
|
@@ -2530,7 +2595,7 @@ function DDropdown({ actions, dropdownToggle, className, }) {
|
|
|
2530
2595
|
}
|
|
2531
2596
|
}
|
|
2532
2597
|
else {
|
|
2533
|
-
ToggleElement = (jsx(DButtonIcon, { variant: "link", stopPropagationEnabled: false, onClick: () => setOpen(!open), icon: "MoreVertical" }));
|
|
2598
|
+
ToggleElement = (jsx(DButtonIcon, { variant: "link", stopPropagationEnabled: false, "aria-label": "Toggle Dropdown", "aria-haspopup": "menu", "aria-expanded": open, onClick: () => setOpen(!open), icon: "MoreVertical" }));
|
|
2534
2599
|
}
|
|
2535
2600
|
return (jsxs("div", { className: `dropdown position-relative drop-${position} ${className}`, ref: dropdownRef, children: [ToggleElement, jsx("ul", { style: {
|
|
2536
2601
|
position: 'absolute',
|
|
@@ -2705,7 +2770,7 @@ const defaultMessage = (secs) => (secs > 0
|
|
|
2705
2770
|
: "Didn't get any code?");
|
|
2706
2771
|
function OtpCountdown({ seconds, resendText, message, }) {
|
|
2707
2772
|
const { secondsLeft, restartCountdown } = useCountdown(seconds);
|
|
2708
|
-
return (jsxs("div", { className: "d-flex gap-2 align-items-center", children: [jsx("p", { className: "mb-0", children: message ? message(secondsLeft) : defaultMessage(secondsLeft) }), jsx(DButton, { text: resendText, variant: "link", disabled: secondsLeft > 0, onClick: restartCountdown })] }));
|
|
2773
|
+
return (jsxs("div", { className: "d-flex gap-2 align-items-center", children: [jsx("p", { className: "mb-0 flex-1", children: message ? message(secondsLeft) : defaultMessage(secondsLeft) }), jsx(DButton, { text: resendText, variant: "link", className: "text-nowrap", disabled: secondsLeft > 0, onClick: restartCountdown })] }));
|
|
2709
2774
|
}
|
|
2710
2775
|
|
|
2711
2776
|
const TEXT_PROPS = {
|