@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.js
CHANGED
|
@@ -13,14 +13,14 @@ var currency = require('currency.js');
|
|
|
13
13
|
var DatePicker = require('react-datepicker');
|
|
14
14
|
var dateFns = require('date-fns');
|
|
15
15
|
var Select = require('react-select');
|
|
16
|
+
var reactErrorBoundary = require('react-error-boundary');
|
|
16
17
|
var mask = require('@react-input/mask');
|
|
18
|
+
var reactInternationalPhone = require('react-international-phone');
|
|
19
|
+
var googleLibphonenumber = require('google-libphonenumber');
|
|
17
20
|
var ResponsivePagination = require('react-responsive-pagination');
|
|
18
21
|
var react = require('@floating-ui/react');
|
|
19
22
|
var reactHotToast = require('react-hot-toast');
|
|
20
|
-
var reactInternationalPhone = require('react-international-phone');
|
|
21
|
-
var googleLibphonenumber = require('google-libphonenumber');
|
|
22
23
|
var html2canvas = require('html2canvas');
|
|
23
|
-
var reactErrorBoundary = require('react-error-boundary');
|
|
24
24
|
var i18n = require('i18next');
|
|
25
25
|
var reactI18next = require('react-i18next');
|
|
26
26
|
|
|
@@ -432,21 +432,6 @@ function DIconBase({ icon, color, style, className, size, useListenerSize = fals
|
|
|
432
432
|
const icons = LucideIcons__namespace;
|
|
433
433
|
return icons[icon] || null;
|
|
434
434
|
}, [icon, useMaterialIcons]);
|
|
435
|
-
const colorStyle = React.useMemo(() => {
|
|
436
|
-
if (color) {
|
|
437
|
-
return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${color})` };
|
|
438
|
-
}
|
|
439
|
-
return {};
|
|
440
|
-
}, [color]);
|
|
441
|
-
const backgroundStyle = React.useMemo(() => {
|
|
442
|
-
if (hasCircle) {
|
|
443
|
-
if (color) {
|
|
444
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}${color}-rgb), 0.1)` };
|
|
445
|
-
}
|
|
446
|
-
return { [`--${PREFIX_BS}icon-component-bg-color`]: `rgba(var(--${PREFIX_BS}body-color-rgb), 0.1)` };
|
|
447
|
-
}
|
|
448
|
-
return {};
|
|
449
|
-
}, [hasCircle, color]);
|
|
450
435
|
const { responsivePropValue } = useResponsiveProp(useListenerSize);
|
|
451
436
|
const resolvedSize = React.useMemo(() => {
|
|
452
437
|
if (!size)
|
|
@@ -455,8 +440,8 @@ function DIconBase({ icon, color, style, className, size, useListenerSize = fals
|
|
|
455
440
|
return size;
|
|
456
441
|
return responsivePropValue(size);
|
|
457
442
|
}, [responsivePropValue, size]);
|
|
458
|
-
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign(Object.assign(
|
|
459
|
-
const generateClasses = React.useMemo(() => (Object.assign({ 'd-icon': true }, className && { [className]: true })), [className]);
|
|
443
|
+
const generateStyleVariables = React.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]);
|
|
444
|
+
const generateClasses = React.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]);
|
|
460
445
|
const iconSize = React.useMemo(() => {
|
|
461
446
|
if (resolvedSize) {
|
|
462
447
|
const numSize = parseInt(resolvedSize, 10);
|
|
@@ -511,14 +496,24 @@ function DAvatar({ id, size, image, name: nameProp, useNameAsInitials = false, c
|
|
|
511
496
|
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames(generateClasses, className), style: style, id: id }, dataAttributes, { children: [image && jsxRuntime.jsx("img", { src: image, alt: nameProp, className: "d-avatar-img" }), (name && !image) && jsxRuntime.jsx("span", { className: "d-avatar-name", children: name })] })));
|
|
512
497
|
}
|
|
513
498
|
|
|
514
|
-
function DBadge(
|
|
499
|
+
function DBadge(props) {
|
|
500
|
+
const { text, soft = false, color = 'primary', id, rounded, className, size, style, iconStart, iconEnd, iconMaterialStyle, iconFamilyClass, iconFamilyPrefix, dataAttributes, } = props;
|
|
501
|
+
// Responsive size resolution using useResponsiveProp
|
|
502
|
+
const { responsivePropValue } = useResponsiveProp(true);
|
|
503
|
+
const resolvedSize = React.useMemo(() => {
|
|
504
|
+
if (!size)
|
|
505
|
+
return undefined;
|
|
506
|
+
if (typeof size === 'string')
|
|
507
|
+
return size;
|
|
508
|
+
return responsivePropValue(size);
|
|
509
|
+
}, [responsivePropValue, size]);
|
|
515
510
|
const generateClasses = React.useMemo(() => ({
|
|
516
511
|
badge: true,
|
|
517
512
|
[`badge-${color}`]: !!color && !soft,
|
|
518
513
|
[`badge-soft-${color}`]: !!color && soft,
|
|
519
514
|
'rounded-pill': !!rounded,
|
|
520
|
-
[`badge-${
|
|
521
|
-
}), [rounded, soft, color,
|
|
515
|
+
[`badge-${resolvedSize}`]: !!resolvedSize,
|
|
516
|
+
}), [rounded, soft, color, resolvedSize]);
|
|
522
517
|
return (jsxRuntime.jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, dataAttributes, { children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })), jsxRuntime.jsx("span", { children: text }), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }))] })));
|
|
523
518
|
}
|
|
524
519
|
|
|
@@ -613,7 +608,7 @@ function DInput(_a, ref) {
|
|
|
613
608
|
[`input-group-${size}`]: !!size,
|
|
614
609
|
'input-group': true,
|
|
615
610
|
'has-validation': invalid || valid,
|
|
616
|
-
}), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputStart`, children: inputStart })), iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading || iconStartDisabled, "aria-label": iconStartAriaLabel, tabIndex:
|
|
611
|
+
}), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputStart`, children: inputStart })), iconStart && (onIconStartClick ? (jsxRuntime.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: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })) : (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}Start`, "aria-hidden": "true", tabIndex: -1, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) }))), dynamicComponent, (iconEnd && !loading) && (onIconEndClick ? (jsxRuntime.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: jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })) : (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}End`, "aria-hidden": "true", tabIndex: -1, children: jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) }))), loading && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}Loading`, children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", "data-testid": "loading-spinner", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })), !!inputEnd && (jsxRuntime.jsx("div", { className: "input-group-text", id: `${id}InputEnd`, children: inputEnd }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
617
612
|
}
|
|
618
613
|
const ForwardedDInput = React.forwardRef(DInput);
|
|
619
614
|
ForwardedDInput.displayName = 'DInput';
|
|
@@ -1023,7 +1018,16 @@ function DBoxFile(_a) {
|
|
|
1023
1018
|
}
|
|
1024
1019
|
|
|
1025
1020
|
const DButton = React.forwardRef((props, ref) => {
|
|
1026
|
-
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 = tslib.__rest(props, ["color", "size", "variant", "text", "children", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartMaterialStyle", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndMaterialStyle", "loading", "loadingText", "loadingAriaLabel", "disabled", "className", "style", "dataAttributes", "onClick", "type", "target", "rel"]);
|
|
1021
|
+
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 = tslib.__rest(props, ["color", "size", "variant", "text", "children", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartMaterialStyle", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndMaterialStyle", "loading", "loadingText", "loadingAriaLabel", "disabled", "className", "style", "dataAttributes", "onClick", "type", "target", "rel", "href", 'aria-label']);
|
|
1022
|
+
// Responsive size resolution using useResponsiveProp
|
|
1023
|
+
const { responsivePropValue } = useResponsiveProp(true);
|
|
1024
|
+
const resolvedSize = React.useMemo(() => {
|
|
1025
|
+
if (!size)
|
|
1026
|
+
return undefined;
|
|
1027
|
+
if (typeof size === 'string')
|
|
1028
|
+
return size;
|
|
1029
|
+
return responsivePropValue(size);
|
|
1030
|
+
}, [responsivePropValue, size]);
|
|
1027
1031
|
const [buttonWidth, setButtonWidth] = React.useState();
|
|
1028
1032
|
const buttonRef = React.useRef(null);
|
|
1029
1033
|
const isDisabled = React.useMemo(() => disabled || loading, [disabled, loading]);
|
|
@@ -1035,16 +1039,13 @@ const DButton = React.forwardRef((props, ref) => {
|
|
|
1035
1039
|
return {
|
|
1036
1040
|
btn: true,
|
|
1037
1041
|
[variantClass]: true,
|
|
1038
|
-
[`btn-${
|
|
1042
|
+
[`btn-${resolvedSize}`]: !!resolvedSize,
|
|
1039
1043
|
loading,
|
|
1040
1044
|
};
|
|
1041
|
-
}, [variant, color,
|
|
1042
|
-
const ariaLabel = React.useMemo(() =>
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
? loadingAriaLabel || ariaLabelProp || text
|
|
1046
|
-
: ariaLabelProp || text;
|
|
1047
|
-
}, [loading, loadingAriaLabel, rest, text]);
|
|
1045
|
+
}, [variant, color, loading, resolvedSize]);
|
|
1046
|
+
const ariaLabel = React.useMemo(() => (loading
|
|
1047
|
+
? loadingAriaLabel || ariaLabelProp || text
|
|
1048
|
+
: ariaLabelProp || text), [loading, loadingAriaLabel, text, ariaLabelProp]);
|
|
1048
1049
|
const handleClick = React.useCallback((event) => {
|
|
1049
1050
|
if (disabled || loading) {
|
|
1050
1051
|
event.preventDefault();
|
|
@@ -1060,8 +1061,8 @@ const DButton = React.forwardRef((props, ref) => {
|
|
|
1060
1061
|
}
|
|
1061
1062
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1062
1063
|
}, [content, iconEnd, iconStart]);
|
|
1063
|
-
if (
|
|
1064
|
-
return (jsxRuntime.jsxs("a", Object.assign({ href:
|
|
1064
|
+
if (href) {
|
|
1065
|
+
return (jsxRuntime.jsxs("a", Object.assign({ href: href, target: target, rel: rel, ref: (node) => {
|
|
1065
1066
|
buttonRef.current = node;
|
|
1066
1067
|
if (typeof ref === 'function')
|
|
1067
1068
|
ref(node);
|
|
@@ -1089,7 +1090,8 @@ const DButton = React.forwardRef((props, ref) => {
|
|
|
1089
1090
|
});
|
|
1090
1091
|
DButton.displayName = 'DButton';
|
|
1091
1092
|
|
|
1092
|
-
function DButtonIcon(
|
|
1093
|
+
function DButtonIcon(_a) {
|
|
1094
|
+
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 = tslib.__rest(_a, ["id", "icon", "size", "className", "variant", "state", "loadingAriaLabel", "iconMaterialStyle", "disabled", "color", "loading", "href", "target", "rel", "stopPropagationEnabled", "style", "iconFamilyClass", "iconFamilyPrefix", "dataAttributes", "onClick", 'aria-label']);
|
|
1093
1095
|
const generateClasses = React.useMemo(() => {
|
|
1094
1096
|
const variantClass = variant
|
|
1095
1097
|
? `btn-${variant}-${color}`
|
|
@@ -1107,15 +1109,15 @@ function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLab
|
|
|
1107
1109
|
}
|
|
1108
1110
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
1109
1111
|
}, [stopPropagationEnabled, onClick, isDisabled]);
|
|
1110
|
-
const
|
|
1111
|
-
?
|
|
1112
|
-
:
|
|
1112
|
+
const ariaLabel = React.useMemo(() => (loading
|
|
1113
|
+
? loadingAriaLabel || ariaLabelProp
|
|
1114
|
+
: ariaLabelProp), [loading, loadingAriaLabel, ariaLabelProp]);
|
|
1113
1115
|
if (href) {
|
|
1114
|
-
return (jsxRuntime.jsx("a", Object.assign({ href: href, target: target, rel: rel, className: classNames(generateClasses, className), style: style, onClick: clickHandler, "aria-label":
|
|
1116
|
+
return (jsxRuntime.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
|
|
1115
1117
|
? (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }))
|
|
1116
1118
|
: (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })) })));
|
|
1117
1119
|
}
|
|
1118
|
-
return (jsxRuntime.jsx("button", Object.assign({ className: classNames(generateClasses, className), style: style,
|
|
1120
|
+
return (jsxRuntime.jsx("button", Object.assign({ className: classNames(generateClasses, className), style: style, disabled: state === 'disabled' || loading, onClick: clickHandler, "aria-label": ariaLabel }, dataAttributes, rest, { children: loading
|
|
1119
1121
|
? (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }))
|
|
1120
1122
|
: (jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })) })));
|
|
1121
1123
|
}
|
|
@@ -1175,7 +1177,7 @@ function DChip({ color = 'primary', text, icon, iconFamilyClass, iconFamilyPrefi
|
|
|
1175
1177
|
return (jsxRuntime.jsxs("span", Object.assign({ className: classNames(generateClasses, className), style: style }, dataAttributes, { children: [icon && (jsxRuntime.jsx("div", { className: "d-chip-icon-container", children: jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), jsxRuntime.jsx("span", { children: text }), showClose && (jsxRuntime.jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, "aria-label": closeAriaLabel, children: jsxRuntime.jsx(DIcon, { icon: iconClose, familyClass: iconCloseFamilyClass, familyPrefix: iconCloseFamilyPrefix, materialStyle: iconCloseMaterialStyle }) }))] })));
|
|
1176
1178
|
}
|
|
1177
1179
|
|
|
1178
|
-
function DCollapse({ id, className, style, Component,
|
|
1180
|
+
function DCollapse({ id, className, style, Component, defaultCollapsed = true, onChange, children, iconOpen: iconOpenProp, iconClose: iconCloseProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle = false, dataAttributes, }) {
|
|
1179
1181
|
const [collapsed, setCollapsed] = React.useState(defaultCollapsed);
|
|
1180
1182
|
const onChangeCollapse = () => {
|
|
1181
1183
|
setCollapsed((prev) => {
|
|
@@ -1192,12 +1194,9 @@ function DCollapse({ id, className, style, Component, hasSeparator = false, defa
|
|
|
1192
1194
|
const { iconMap: { chevronDown, chevronUp, }, } = useDContext();
|
|
1193
1195
|
const iconOpen = React.useMemo(() => iconOpenProp || chevronDown, [chevronDown, iconOpenProp]);
|
|
1194
1196
|
const iconClose = React.useMemo(() => iconCloseProp || chevronUp, [chevronUp, iconCloseProp]);
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
return (jsxRuntime.jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { children: [jsxRuntime.jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: Component }), jsxRuntime.jsx(DIcon, { color: "gray", size: "1rem", icon: collapsed ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), !collapsed && (jsxRuntime.jsx("div", { className: classNames({
|
|
1199
|
-
'collapse-body': true,
|
|
1200
|
-
}), style: generateStyles, children: children }))] })));
|
|
1197
|
+
return (jsxRuntime.jsxs("div", Object.assign({ id: id, className: classNames('collapse-container', className), style: style }, dataAttributes, { children: [jsxRuntime.jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: Component }), jsxRuntime.jsx(DIcon, { color: "primary", size: "1.25rem", icon: collapsed ? iconOpen : iconClose, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle })] }), jsxRuntime.jsx("div", { className: classNames('collapse-body-wrapper', {
|
|
1198
|
+
show: !collapsed,
|
|
1199
|
+
}), children: jsxRuntime.jsx("div", { className: "collapse-body", children: children }) })] })));
|
|
1201
1200
|
}
|
|
1202
1201
|
|
|
1203
1202
|
function formatCurrency(amount, options) {
|
|
@@ -1219,10 +1218,9 @@ function DCurrencyText({ value, className, style, dataAttributes, }) {
|
|
|
1219
1218
|
return (jsxRuntime.jsx("span", Object.assign({ className: className, style: style }, dataAttributes, { children: valueFormatted })));
|
|
1220
1219
|
}
|
|
1221
1220
|
|
|
1222
|
-
function DDatePickerTime(
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
} }));
|
|
1221
|
+
function DDatePickerTime(_a) {
|
|
1222
|
+
var rest = tslib.__rest(_a, []);
|
|
1223
|
+
return (jsxRuntime.jsx(ForwardedDInput, Object.assign({ className: "d-datepicker-time", type: "time" }, rest)));
|
|
1226
1224
|
}
|
|
1227
1225
|
|
|
1228
1226
|
function DDatePickerInput(_a, ref) {
|
|
@@ -1233,62 +1231,11 @@ function DDatePickerInput(_a, ref) {
|
|
|
1233
1231
|
const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
|
|
1234
1232
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
1235
1233
|
|
|
1236
|
-
function DInputCheck(_a) {
|
|
1237
|
-
var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, inputClassName, value, hint, onChange, className, style, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "inputClassName", "value", "hint", "onChange", "className", "style", "dataAttributes"]);
|
|
1238
|
-
const innerRef = React.useRef(null);
|
|
1239
|
-
const innerId = React.useId();
|
|
1240
|
-
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1241
|
-
const handleChange = React.useCallback((event) => {
|
|
1242
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1243
|
-
}, [onChange]);
|
|
1244
|
-
const ariaDescribedby = React.useMemo(() => ([
|
|
1245
|
-
!!hint && `${id}Hint`,
|
|
1246
|
-
]
|
|
1247
|
-
.filter(Boolean)
|
|
1248
|
-
.join(' ')), [
|
|
1249
|
-
id,
|
|
1250
|
-
hint,
|
|
1251
|
-
]);
|
|
1252
|
-
React.useEffect(() => {
|
|
1253
|
-
if (innerRef.current) {
|
|
1254
|
-
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
1255
|
-
}
|
|
1256
|
-
}, [indeterminate]);
|
|
1257
|
-
React.useEffect(() => {
|
|
1258
|
-
if (innerRef.current) {
|
|
1259
|
-
innerRef.current.checked = checked;
|
|
1260
|
-
}
|
|
1261
|
-
}, [checked]);
|
|
1262
|
-
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
|
|
1263
|
-
'is-invalid': invalid,
|
|
1264
|
-
'is-valid': valid,
|
|
1265
|
-
}, inputClassName), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, props))), [
|
|
1266
|
-
handleChange,
|
|
1267
|
-
invalid,
|
|
1268
|
-
valid,
|
|
1269
|
-
inputClassName,
|
|
1270
|
-
style,
|
|
1271
|
-
id,
|
|
1272
|
-
disabled,
|
|
1273
|
-
type,
|
|
1274
|
-
name,
|
|
1275
|
-
value,
|
|
1276
|
-
ariaLabel,
|
|
1277
|
-
ariaDescribedby,
|
|
1278
|
-
props,
|
|
1279
|
-
]);
|
|
1280
|
-
if (!label) {
|
|
1281
|
-
return inputComponent;
|
|
1282
|
-
}
|
|
1283
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('form-check', className) }, dataAttributes, { children: [inputComponent, jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
1234
|
function DSelectOptionCheck(_a) {
|
|
1287
|
-
var {
|
|
1288
|
-
return (jsxRuntime.
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
}), isSelected: isSelected, innerProps: innerProps }, props, { children: jsxRuntime.jsxs("label", { htmlFor: `${innerProps.id}Check`, children: [jsxRuntime.jsx(DInputCheck, { type: "checkbox", checked: isSelected, id: `${innerProps.id}Check` }), children] }) })));
|
|
1235
|
+
var { children, isSelected } = _a, props = tslib.__rest(_a, ["children", "isSelected"]);
|
|
1236
|
+
return (jsxRuntime.jsxs(Select.components.Option, Object.assign({}, props, { isSelected: isSelected, className: classNames('d-select__option'), children: [jsxRuntime.jsx("span", { className: classNames('d-select__check', {
|
|
1237
|
+
'd-select__check--selected': isSelected,
|
|
1238
|
+
}), "aria-hidden": "true" }), jsxRuntime.jsx("span", { className: "d-select__label", children: children })] })));
|
|
1292
1239
|
}
|
|
1293
1240
|
|
|
1294
1241
|
function DSelectOptionIcon(_a) {
|
|
@@ -1359,7 +1306,7 @@ function DSelectPlaceholder(_a) {
|
|
|
1359
1306
|
}
|
|
1360
1307
|
|
|
1361
1308
|
function DSelect$1(_a) {
|
|
1362
|
-
var { id: idProp, className, style, label, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent = false, disabled, clearable, loading, floatingLabel = false, rtl, searchable, multi, components, defaultValue, placeholder, onIconStartClick, onIconEndClick, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "className", "style", "label", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "floatingLabel", "rtl", "searchable", "multi", "components", "defaultValue", "placeholder", "onIconStartClick", "onIconEndClick", "dataAttributes"]);
|
|
1309
|
+
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 = tslib.__rest(_a, ["id", "className", "style", "label", "hint", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "invalid", "valid", "menuWithMaxContent", "disabled", "clearable", "loading", "floatingLabel", "rtl", "searchable", "multi", "components", "defaultValue", "placeholder", "onIconStartClick", "onIconEndClick", "dataAttributes", "ariaLabel"]);
|
|
1363
1310
|
const innerId = React.useId();
|
|
1364
1311
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1365
1312
|
const handleOnIconStartClick = React.useCallback(() => {
|
|
@@ -1375,7 +1322,7 @@ function DSelect$1(_a) {
|
|
|
1375
1322
|
'input-group': true,
|
|
1376
1323
|
'has-validation': invalid,
|
|
1377
1324
|
disabled: disabled || loading,
|
|
1378
|
-
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsxRuntime.jsx(Select, Object.assign({ id: `${id}Container`, inputId: id, styles: {
|
|
1325
|
+
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix }) })), jsxRuntime.jsx(Select, Object.assign({ id: `${id}Container`, inputId: id, "aria-label": ariaLabel, styles: {
|
|
1379
1326
|
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
1380
1327
|
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
1381
1328
|
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%', zIndex: 1000 })),
|
|
@@ -1430,16 +1377,16 @@ function DDatePickerHeaderSelector({ date, changeYear, changeMonth, decreaseMont
|
|
|
1430
1377
|
}, [date]);
|
|
1431
1378
|
const [startYear, endYear] = getYearRange();
|
|
1432
1379
|
if (pickerType === PickerType.Year) {
|
|
1433
|
-
return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevYearButtonDisabled,
|
|
1380
|
+
return (jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-year-selector', className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevYearButtonDisabled, "aria-label": prevYearAriaLabel, className: "header-button" }), jsxRuntime.jsx("p", { children: `${startYear} - ${endYear}` }), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextYearButtonDisabled, "aria-label": nextYearAriaLabel, className: "header-button" })] }));
|
|
1434
1381
|
}
|
|
1435
1382
|
if (pickerType === PickerType.Quarter || pickerType === PickerType.Month) {
|
|
1436
|
-
return (jsxRuntime.jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevMonthButtonDisabled,
|
|
1383
|
+
return (jsxRuntime.jsxs("div", { className: classNames(`react-datepicker__header-selector react-datepicker__header-${pickerType}-selector`, className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseYear, disabled: prevMonthButtonDisabled, "aria-label": prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), jsxRuntime.jsx("div", { className: "d-flex justify-content-center flex-grow-1", children: showHeaderSelectors ? (jsxRuntime.jsx(DSelect, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false })) : (jsxRuntime.jsx("p", { children: defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label })) }), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseYear, disabled: nextMonthButtonDisabled, "aria-label": nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] }));
|
|
1437
1384
|
}
|
|
1438
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "datepicker-top-header", children: [showHeaderSelectors && (jsxRuntime.jsx(DSelect, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false, className: "custom-year-selector" })), jsxRuntime.jsx("h4", { className: "mb-0 fw-normal", children: dateFns.format(monthDate, formatHeaderDate, { locale }) })] }), jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseMonth, disabled: prevMonthButtonDisabled,
|
|
1385
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "datepicker-top-header", children: [showHeaderSelectors && (jsxRuntime.jsx(DSelect, { options: years, value: defaultYear, defaultValue: defaultYear, onChange: (year) => changeYear(Number(year === null || year === void 0 ? void 0 : year.value)), searchable: false, className: "custom-year-selector" })), jsxRuntime.jsx("h4", { className: "mb-0 fw-normal", children: dateFns.format(monthDate, formatHeaderDate, { locale }) })] }), jsxRuntime.jsxs("div", { className: classNames('react-datepicker__header-selector react-datepicker__header-day-selector', className), style: style, children: [jsxRuntime.jsx(DButtonIcon, { icon: iconPrev || chevronLeft, size: iconSize, variant: "link", onClick: decreaseMonth, disabled: prevMonthButtonDisabled, "aria-label": prevMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === 0 ? 'visible' : 'hidden' } }), showHeaderSelectors ? (jsxRuntime.jsx(DSelect, { options: months, value: defaultMonth, defaultValue: defaultMonth, onChange: (month) => changeMonth((month === null || month === void 0 ? void 0 : month.value) || 0), searchable: false, className: "custom-month-selector" })) : (jsxRuntime.jsx("p", { children: `${defaultMonth.label} ${defaultYear === null || defaultYear === void 0 ? void 0 : defaultYear.label}` })), jsxRuntime.jsx(DButtonIcon, { icon: iconNext || chevronRight, size: iconSize, variant: "link", onClick: increaseMonth, disabled: nextMonthButtonDisabled, "aria-label": nextMonthAriaLabel, className: "header-button", style: { visibility: customHeaderCount === monthsShown - 1 ? 'visible' : 'hidden' } })] })] }));
|
|
1439
1386
|
}
|
|
1440
1387
|
|
|
1441
1388
|
function DDatePicker(_a) {
|
|
1442
|
-
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 = tslib.__rest(_a, ["inputLabel", "inputHint", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeInputLabel", "minYearSelect", "maxYearSelect", "iconHeaderSize", "iconMaterialStyle", "iconInput", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "invalid", "valid", "renderCustomHeader", "className", "dateFormatCalendar", "style", "dataAttributes", "placeholder", "showHeaderSelectors", "formatHeaderDate"]);
|
|
1389
|
+
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 = tslib.__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"]);
|
|
1443
1390
|
const pickerType = React.useMemo(() => {
|
|
1444
1391
|
if (props.showQuarterYearPicker)
|
|
1445
1392
|
return PickerType.Quarter;
|
|
@@ -1467,7 +1414,7 @@ function DDatePicker(_a) {
|
|
|
1467
1414
|
]);
|
|
1468
1415
|
const defaultRenderCustomHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps))), [DatePickerHeader]);
|
|
1469
1416
|
const renderCustomHeader = React.useMemo(() => (renderCustomHeaderProp || defaultRenderCustomHeader), [defaultRenderCustomHeader, renderCustomHeaderProp]);
|
|
1470
|
-
return (jsxRuntime.jsx(DatePicker, Object.assign({}, dataAttributes, props, { calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, placeholderText: placeholder, customInput: (jsxRuntime.jsx(ForwardedDDatePickerInput, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyle, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, hint: inputHint })), customTimeInput: (jsxRuntime.jsx(DDatePickerTime, { id: timeId })) })));
|
|
1417
|
+
return (jsxRuntime.jsx(DatePicker, Object.assign({}, dataAttributes, props, { calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, placeholderText: placeholder, customInput: (jsxRuntime.jsx(ForwardedDDatePickerInput, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyle, iconEnd: iconInput, inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, hint: inputHint })), customTimeInput: (jsxRuntime.jsx(DDatePickerTime, { id: timeId, "aria-label": ariaLabelInputTime })) })));
|
|
1471
1418
|
}
|
|
1472
1419
|
|
|
1473
1420
|
function DLayoutPane({ className, style, children, cols, colsXs, colsSm, colsMd, colsLg, colsXl, colsXxl, dataAttributes, }) {
|
|
@@ -1744,7 +1691,57 @@ function DPasswordStrengthMeter({ id, label = 'Password', placeholder, value = '
|
|
|
1744
1691
|
return (jsxRuntime.jsxs("div", Object.assign({ className: className, style: style }, dataAttributes, { children: [jsxRuntime.jsx(ForwardedDInputPassword, { id: id, label: label, placeholder: placeholder, value: password, name: name, disabled: disabled, invalid: invalid, onChange: handleChange }), jsxRuntime.jsx(PasswordChecksList, { password: password, validationMessages: validationMessages, enabledChecks: enabledChecks })] })));
|
|
1745
1692
|
}
|
|
1746
1693
|
|
|
1747
|
-
function
|
|
1694
|
+
function DInputCheck(_a) {
|
|
1695
|
+
var { id: idProp, type, name, label, ariaLabel, checked = false, disabled = false, invalid = false, valid = false, indeterminate, inputClassName, value, hint, onChange, className, style, dataAttributes } = _a, props = tslib.__rest(_a, ["id", "type", "name", "label", "ariaLabel", "checked", "disabled", "invalid", "valid", "indeterminate", "inputClassName", "value", "hint", "onChange", "className", "style", "dataAttributes"]);
|
|
1696
|
+
const innerRef = React.useRef(null);
|
|
1697
|
+
const innerId = React.useId();
|
|
1698
|
+
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1699
|
+
const handleChange = React.useCallback((event) => {
|
|
1700
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1701
|
+
}, [onChange]);
|
|
1702
|
+
const ariaDescribedby = React.useMemo(() => ([
|
|
1703
|
+
!!hint && `${id}Hint`,
|
|
1704
|
+
]
|
|
1705
|
+
.filter(Boolean)
|
|
1706
|
+
.join(' ')), [
|
|
1707
|
+
id,
|
|
1708
|
+
hint,
|
|
1709
|
+
]);
|
|
1710
|
+
React.useEffect(() => {
|
|
1711
|
+
if (innerRef.current) {
|
|
1712
|
+
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
1713
|
+
}
|
|
1714
|
+
}, [indeterminate]);
|
|
1715
|
+
React.useEffect(() => {
|
|
1716
|
+
if (innerRef.current) {
|
|
1717
|
+
innerRef.current.checked = checked;
|
|
1718
|
+
}
|
|
1719
|
+
}, [checked]);
|
|
1720
|
+
const inputComponent = React.useMemo(() => (jsxRuntime.jsx("input", Object.assign({ ref: innerRef, onChange: handleChange, className: classNames('form-check-input', {
|
|
1721
|
+
'is-invalid': invalid,
|
|
1722
|
+
'is-valid': valid,
|
|
1723
|
+
}, inputClassName), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, props))), [
|
|
1724
|
+
handleChange,
|
|
1725
|
+
invalid,
|
|
1726
|
+
valid,
|
|
1727
|
+
inputClassName,
|
|
1728
|
+
style,
|
|
1729
|
+
id,
|
|
1730
|
+
disabled,
|
|
1731
|
+
type,
|
|
1732
|
+
name,
|
|
1733
|
+
value,
|
|
1734
|
+
ariaLabel,
|
|
1735
|
+
ariaDescribedby,
|
|
1736
|
+
props,
|
|
1737
|
+
]);
|
|
1738
|
+
if (!label) {
|
|
1739
|
+
return inputComponent;
|
|
1740
|
+
}
|
|
1741
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('form-check', className) }, dataAttributes, { children: [inputComponent, jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
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', }) {
|
|
1748
1745
|
const innerId = React.useId();
|
|
1749
1746
|
const id = React.useMemo(() => idProp || innerId, [idProp, innerId]);
|
|
1750
1747
|
const [pattern, setPattern] = React.useState('');
|
|
@@ -1821,7 +1818,7 @@ function DInputPin({ id: idProp, label = '', placeholder, type = 'text', disable
|
|
|
1821
1818
|
'form-control': true,
|
|
1822
1819
|
'is-invalid': invalid,
|
|
1823
1820
|
'is-valid': valid,
|
|
1824
|
-
}), value: activeInput[index], type: secret ? 'password' : type, "aria-
|
|
1821
|
+
}), 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 && (jsxRuntime.jsx("div", { className: "input-group-text", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })));
|
|
1825
1822
|
}
|
|
1826
1823
|
|
|
1827
1824
|
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, }) {
|
|
@@ -2135,9 +2132,7 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
|
|
|
2135
2132
|
}, [open]);
|
|
2136
2133
|
const onOpenChange = React.useCallback((value) => {
|
|
2137
2134
|
setIsOpen(value);
|
|
2138
|
-
|
|
2139
|
-
setOpen(value);
|
|
2140
|
-
}
|
|
2135
|
+
setOpen === null || setOpen === void 0 ? void 0 : setOpen(value);
|
|
2141
2136
|
}, [setOpen]);
|
|
2142
2137
|
const { refs, floatingStyles, context, } = react.useFloating({
|
|
2143
2138
|
open: isOpen,
|
|
@@ -2161,7 +2156,12 @@ function DPopover({ children, renderComponent, open, setOpen, adjustContentToRen
|
|
|
2161
2156
|
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign({}, style), (adjustContentToRender && {
|
|
2162
2157
|
[`--${PREFIX_BS}popover-component-min-width`]: 'auto',
|
|
2163
2158
|
}))), [style, adjustContentToRender]);
|
|
2164
|
-
|
|
2159
|
+
const triggerElement = renderComponent(isOpen);
|
|
2160
|
+
if (!React.isValidElement(triggerElement)) {
|
|
2161
|
+
throw new Error('renderComponent must return a valid React element');
|
|
2162
|
+
}
|
|
2163
|
+
const reference = React.cloneElement(triggerElement, Object.assign({ ref: refs.setReference }, getReferenceProps(triggerElement.props)));
|
|
2164
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames('d-popover', className), style: generateStyleVariables }, dataAttributes, { children: [reference, isOpen && (jsxRuntime.jsx(react.FloatingFocusManager, { context: context, modal: false, children: jsxRuntime.jsx("div", Object.assign({ className: classNames('d-popover-content', {
|
|
2165
2165
|
'w-100': adjustContentToRender,
|
|
2166
2166
|
}), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] })));
|
|
2167
2167
|
}
|
|
@@ -2270,7 +2270,7 @@ function DTooltip({ className, childrenClassName, style, offSet = ARROW_HEIGHT +
|
|
|
2270
2270
|
function DTimeline({ className, style, dataAttributes, items, }) {
|
|
2271
2271
|
return (jsxRuntime.jsx("div", Object.assign({ style: style, className: classNames('d-timeline', className) }, dataAttributes, { children: items.map((item, index) => (jsxRuntime.jsxs("div", { className: classNames('d-timeline-item', {
|
|
2272
2272
|
[`d-timeline-item-${item.status}`]: item.status,
|
|
2273
|
-
}), children: [jsxRuntime.jsx("div", { className: "d-timeline-item-connector" }), jsxRuntime.jsx("div", { className: "d-timeline-item-icon", children: jsxRuntime.jsx(
|
|
2273
|
+
}), children: [jsxRuntime.jsx("div", { className: "d-timeline-item-connector" }), jsxRuntime.jsx("div", { className: "d-timeline-item-icon", children: jsxRuntime.jsx(DIcon, { icon: item.icon || 'check', size: "1rem" }) }), jsxRuntime.jsxs("div", { className: "d-timeline-item-content", children: [jsxRuntime.jsx("div", { className: "d-timeline-item-title", children: item.title }), item.description && jsxRuntime.jsx("div", { className: "d-timeline-item-description", children: item.description }), item.time && jsxRuntime.jsx("div", { className: "d-timeline-item-time", children: item.time }), item.children] })] }, index))) })));
|
|
2274
2274
|
}
|
|
2275
2275
|
|
|
2276
2276
|
const TabContext = React.createContext(undefined);
|
|
@@ -2290,7 +2290,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
2290
2290
|
return (jsxRuntime.jsx("div", { className: classNames('tab-pane fade show active', className), id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab`, style: style, children: children }));
|
|
2291
2291
|
}
|
|
2292
2292
|
|
|
2293
|
-
function DTabs$1({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', dataAttributes, }) {
|
|
2293
|
+
function DTabs$1({ children, defaultSelected, onChange, options, className, classNameTab, style, vertical, variant = 'underline', dataAttributes, ariaLabel, ariaLabelledBy, }) {
|
|
2294
2294
|
const [selected, setSelected] = React.useState(defaultSelected);
|
|
2295
2295
|
const onSelect = React.useCallback((option) => {
|
|
2296
2296
|
if (option.tab) {
|
|
@@ -2301,17 +2301,83 @@ function DTabs$1({ children, defaultSelected, onChange, options, className, clas
|
|
|
2301
2301
|
React.useEffect(() => {
|
|
2302
2302
|
setSelected(defaultSelected);
|
|
2303
2303
|
}, [defaultSelected]);
|
|
2304
|
+
const generateClasses = React.useMemo(() => (Object.assign({ nav: true, 'flex-column align-items-center': vertical && variant !== 'tabs', [`nav-${variant}`]: true }, className && { [className]: true })), [vertical, variant, className]);
|
|
2305
|
+
const tabRefs = React.useRef([]);
|
|
2306
|
+
React.useEffect(() => {
|
|
2307
|
+
tabRefs.current = options.map((_, i) => tabRefs.current[i] || React.createRef());
|
|
2308
|
+
}, [options]);
|
|
2309
|
+
// Ensure selected is never disabled
|
|
2310
|
+
React.useEffect(() => {
|
|
2311
|
+
if (options.length === 0)
|
|
2312
|
+
return;
|
|
2313
|
+
const selectedOption = options.find((opt) => opt.tab === selected);
|
|
2314
|
+
if (selectedOption && selectedOption.disabled) {
|
|
2315
|
+
const firstEnabled = options.find((opt) => !opt.disabled);
|
|
2316
|
+
if (firstEnabled)
|
|
2317
|
+
setSelected(firstEnabled.tab);
|
|
2318
|
+
}
|
|
2319
|
+
}, [options, selected]);
|
|
2320
|
+
// Declarative focus management
|
|
2321
|
+
const focusTab = (idx) => {
|
|
2322
|
+
var _a;
|
|
2323
|
+
if ((_a = tabRefs.current[idx]) === null || _a === void 0 ? void 0 : _a.current) {
|
|
2324
|
+
tabRefs.current[idx].current.focus();
|
|
2325
|
+
}
|
|
2326
|
+
};
|
|
2327
|
+
// Focus selected tab when selected changes
|
|
2328
|
+
React.useEffect(() => {
|
|
2329
|
+
const idx = options.findIndex((opt) => opt.tab === selected && !opt.disabled);
|
|
2330
|
+
if (idx !== -1) {
|
|
2331
|
+
focusTab(idx);
|
|
2332
|
+
}
|
|
2333
|
+
}, [selected, options]);
|
|
2334
|
+
const handleKeyDown = React.useCallback((idx, e) => {
|
|
2335
|
+
const count = options.length;
|
|
2336
|
+
if (count === 0)
|
|
2337
|
+
return;
|
|
2338
|
+
let next = idx;
|
|
2339
|
+
let prev = idx;
|
|
2340
|
+
if (e.key === 'ArrowRight' || (vertical && e.key === 'ArrowDown')) {
|
|
2341
|
+
e.preventDefault();
|
|
2342
|
+
for (let i = 0; i < count; i += 1) {
|
|
2343
|
+
next = (next + 1) % count;
|
|
2344
|
+
if (!options[next].disabled) {
|
|
2345
|
+
focusTab(next);
|
|
2346
|
+
setSelected(options[next].tab);
|
|
2347
|
+
break;
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
if (e.key === 'ArrowLeft' || (vertical && e.key === 'ArrowUp')) {
|
|
2352
|
+
e.preventDefault();
|
|
2353
|
+
for (let i = 0; i < count; i += 1) {
|
|
2354
|
+
prev = (prev - 1 + count) % count;
|
|
2355
|
+
if (!options[prev].disabled) {
|
|
2356
|
+
focusTab(prev);
|
|
2357
|
+
setSelected(options[prev].tab);
|
|
2358
|
+
break;
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
}, [options, vertical]);
|
|
2363
|
+
let tablistProps = {};
|
|
2364
|
+
if (ariaLabelledBy) {
|
|
2365
|
+
tablistProps = { 'aria-labelledby': ariaLabelledBy };
|
|
2366
|
+
}
|
|
2367
|
+
else if (ariaLabel) {
|
|
2368
|
+
tablistProps = { 'aria-label': ariaLabel };
|
|
2369
|
+
}
|
|
2304
2370
|
const isSelected = React.useCallback((tab) => (selected === tab), [selected]);
|
|
2305
2371
|
const value = React.useMemo(() => ({
|
|
2306
2372
|
isSelected,
|
|
2307
2373
|
}), [isSelected]);
|
|
2308
|
-
const generateClasses = React.useMemo(() => (Object.assign({ nav: true, 'flex-column align-items-center': vertical && variant !== 'tabs', [`nav-${variant}`]: true }, className && { [className]: true })), [vertical, variant, className]);
|
|
2309
2374
|
return (jsxRuntime.jsx(TabContext.Provider, { value: value, children: jsxRuntime.jsxs("div", Object.assign({ className: classNames({
|
|
2310
2375
|
'd-flex w-100': true,
|
|
2311
2376
|
'flex-column': !vertical || variant === 'tabs',
|
|
2312
|
-
}), style: style }, dataAttributes, { children: [jsxRuntime.jsx("
|
|
2313
|
-
|
|
2314
|
-
}, classNameTab), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected":
|
|
2377
|
+
}), style: style }, dataAttributes, { children: [jsxRuntime.jsx("ul", Object.assign({ className: classNames(generateClasses), role: "tablist", "aria-orientation": vertical ? 'vertical' : undefined }, tablistProps, { children: options.map((option, idx) => {
|
|
2378
|
+
const isTabSelected = !!option.tab && option.tab === selected;
|
|
2379
|
+
return (jsxRuntime.jsx("li", { role: "presentation", className: "nav-item", children: jsxRuntime.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));
|
|
2380
|
+
}) })), jsxRuntime.jsx("div", { className: "tab-content w-100", children: children })] })) }));
|
|
2315
2381
|
}
|
|
2316
2382
|
var DTabs = Object.assign(DTabs$1, {
|
|
2317
2383
|
Tab: DTabContent,
|
|
@@ -2501,7 +2567,7 @@ const BRAND_LOGOS = {
|
|
|
2501
2567
|
mastercard: 'https://cdn.modyo.cloud/uploads/f686b9aa-65ab-4369-9db3-89ceece84f29/original/mastercard.png',
|
|
2502
2568
|
};
|
|
2503
2569
|
function DCreditCard({ brand = 'visa', name, number, holderText = 'Card Holder', logoImage, isChipVisible = true, className, isVertical = false, }) {
|
|
2504
|
-
return (jsxRuntime.jsxs("div", { className: classNames('d-credit-card
|
|
2570
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-credit-card', isVertical && 'is-vertical', className), children: [jsxRuntime.jsxs("div", { className: "d-credit-card-header", children: [jsxRuntime.jsx("img", { src: logoImage || BRAND_LOGOS[brand] || DEFAULT_IMAGE, alt: brand, className: "d-credit-card-logo", width: 100 }), isChipVisible && (jsxRuntime.jsx("div", { className: "d-credit-card-chip", children: jsxRuntime.jsx("img", { src: CHIP_IMAGE, alt: "chip", width: 30, className: "d-credit-card-chip-image" }) }))] }), jsxRuntime.jsxs("div", { className: "d-credit-card-details", children: [jsxRuntime.jsx("div", { className: "d-credit-card-number", children: number }), jsxRuntime.jsx("small", { className: "d-credit-card-holder-text", children: holderText }), jsxRuntime.jsx("span", { className: "d-credit-card-name", children: name })] })] }));
|
|
2505
2571
|
}
|
|
2506
2572
|
|
|
2507
2573
|
const getItemClass = (action) => {
|
|
@@ -2523,7 +2589,6 @@ function DDropdown({ actions, dropdownToggle, className, }) {
|
|
|
2523
2589
|
document.addEventListener('mousedown', handleClickOutside);
|
|
2524
2590
|
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
2525
2591
|
}, []);
|
|
2526
|
-
// 🆕 Calcular posición del menú al abrir
|
|
2527
2592
|
React.useEffect(() => {
|
|
2528
2593
|
if (open && dropdownRef.current) {
|
|
2529
2594
|
const rect = dropdownRef.current.getBoundingClientRect();
|
|
@@ -2550,7 +2615,7 @@ function DDropdown({ actions, dropdownToggle, className, }) {
|
|
|
2550
2615
|
}
|
|
2551
2616
|
}
|
|
2552
2617
|
else {
|
|
2553
|
-
ToggleElement = (jsxRuntime.jsx(DButtonIcon, { variant: "link", stopPropagationEnabled: false, onClick: () => setOpen(!open), icon: "MoreVertical" }));
|
|
2618
|
+
ToggleElement = (jsxRuntime.jsx(DButtonIcon, { variant: "link", stopPropagationEnabled: false, "aria-label": "Toggle Dropdown", "aria-haspopup": "menu", "aria-expanded": open, onClick: () => setOpen(!open), icon: "MoreVertical" }));
|
|
2554
2619
|
}
|
|
2555
2620
|
return (jsxRuntime.jsxs("div", { className: `dropdown position-relative drop-${position} ${className}`, ref: dropdownRef, children: [ToggleElement, jsxRuntime.jsx("ul", { style: {
|
|
2556
2621
|
position: 'absolute',
|
|
@@ -2725,7 +2790,7 @@ const defaultMessage = (secs) => (secs > 0
|
|
|
2725
2790
|
: "Didn't get any code?");
|
|
2726
2791
|
function OtpCountdown({ seconds, resendText, message, }) {
|
|
2727
2792
|
const { secondsLeft, restartCountdown } = useCountdown(seconds);
|
|
2728
|
-
return (jsxRuntime.jsxs("div", { className: "d-flex gap-2 align-items-center", children: [jsxRuntime.jsx("p", { className: "mb-0", children: message ? message(secondsLeft) : defaultMessage(secondsLeft) }), jsxRuntime.jsx(DButton, { text: resendText, variant: "link", disabled: secondsLeft > 0, onClick: restartCountdown })] }));
|
|
2793
|
+
return (jsxRuntime.jsxs("div", { className: "d-flex gap-2 align-items-center", children: [jsxRuntime.jsx("p", { className: "mb-0 flex-1", children: message ? message(secondsLeft) : defaultMessage(secondsLeft) }), jsxRuntime.jsx(DButton, { text: resendText, variant: "link", className: "text-nowrap", disabled: secondsLeft > 0, onClick: restartCountdown })] }));
|
|
2729
2794
|
}
|
|
2730
2795
|
|
|
2731
2796
|
const TEXT_PROPS = {
|