@dynamic-framework/ui-react 1.16.2 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/dynamic-ui-non-root.css +3523 -1210
- package/dist/css/dynamic-ui-non-root.min.css +2 -2
- package/dist/css/dynamic-ui-root.css +16 -10
- package/dist/css/dynamic-ui-root.min.css +2 -2
- package/dist/css/dynamic-ui.css +3538 -1219
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +88 -78
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +88 -77
- package/dist/index.js.map +1 -1
- package/dist/types/components/DTabs/DTabs.d.ts +3 -2
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useDisableInputWheel.d.ts +4 -0
- package/dist/types/hooks/useInputCurrency.d.ts +1 -2
- package/package.json +3 -3
- package/src/style/abstracts/_mixins.scss +1 -1
- package/src/style/abstracts/_utilities.scss +12 -3
- package/src/style/abstracts/variables/_+import.scss +6 -81
- package/src/style/abstracts/variables/_accordion.scss +3 -23
- package/src/style/abstracts/variables/_alerts.scss +7 -13
- package/src/style/abstracts/variables/_badges.scss +3 -3
- package/src/style/abstracts/variables/_body.scss +2 -22
- package/src/style/abstracts/variables/_border.scss +0 -12
- package/src/style/abstracts/variables/_box-file.scss +3 -3
- package/src/style/abstracts/variables/_buttons.scss +8 -27
- package/src/style/abstracts/variables/_cards.scss +0 -16
- package/src/style/abstracts/variables/_carousel.scss +0 -25
- package/src/style/abstracts/variables/_chips.scss +1 -1
- package/src/style/abstracts/variables/_close.scss +0 -6
- package/src/style/abstracts/variables/_code.scss +0 -10
- package/src/style/abstracts/variables/_collapse-icon-text.scss +1 -1
- package/src/style/abstracts/variables/_dropdowns.scss +3 -27
- package/src/style/abstracts/variables/_forms.scss +20 -160
- package/src/style/abstracts/variables/_list-group.scss +6 -12
- package/src/style/abstracts/variables/_modals.scss +11 -31
- package/src/style/abstracts/variables/_navbar.scss +0 -28
- package/src/style/abstracts/variables/_navs.scss +11 -20
- package/src/style/abstracts/variables/_offcanvas.scss +6 -13
- package/src/style/abstracts/variables/_pagination.scss +20 -25
- package/src/style/abstracts/variables/_progress.scss +0 -3
- package/src/style/abstracts/variables/_quick-action-button.scss +3 -3
- package/src/style/abstracts/variables/_quick-action-check.scss +2 -2
- package/src/style/abstracts/variables/_quick-action-select.scss +1 -1
- package/src/style/abstracts/variables/_quick-action-switch.scss +1 -1
- package/src/style/abstracts/variables/_spacers.scss +20 -8
- package/src/style/abstracts/variables/_tables.scss +0 -18
- package/src/style/abstracts/variables/_typography.scss +3 -33
- package/src/style/base/_+import.scss +5 -0
- package/src/style/base/_body.scss +3 -0
- package/src/style/base/_collapse.scss +5 -5
- package/src/style/base/_form-control.scss +10 -0
- package/src/style/base/_form-text.scss +12 -0
- package/src/style/base/_input-group.scss +114 -0
- package/src/style/base/_label.scss +15 -0
- package/src/style/base/_pagination.scss +12 -82
- package/src/style/base/_tables.scss +1 -1
- package/src/style/components/_+import.scss +0 -2
- package/src/style/components/_d-card-account.scss +2 -2
- package/src/style/components/_d-carousel.scss +2 -2
- package/src/style/components/_d-datepicker.scss +9 -9
- package/src/style/components/_d-icon.scss +1 -1
- package/src/style/components/_d-input-pin.scss +14 -63
- package/src/style/components/_d-modal.scss +1 -1
- package/src/style/components/_d-monthpicker.scss +3 -3
- package/src/style/components/_d-offcanvas.scss +1 -1
- package/src/style/components/_d-select.scss +59 -111
- package/src/style/components/_d-stepper-desktop.scss +12 -8
- package/src/style/components/_d-stepper-mobile.scss +2 -1
- package/src/style/components/_d-tabs.scss +22 -29
- package/src/style/helpers/_+import.scss +2 -0
- package/src/style/helpers/_overlay.scss +17 -0
- package/src/style/abstracts/variables/_breadcrumb.scss +0 -15
- package/src/style/abstracts/variables/_figures.scss +0 -6
- package/src/style/abstracts/variables/_grid.scss +0 -41
- package/src/style/abstracts/variables/_popovers.scss +0 -31
- package/src/style/abstracts/variables/_spinners.scss +0 -13
- package/src/style/abstracts/variables/_thumbnails.scss +0 -10
- package/src/style/abstracts/variables/_toasts.scss +0 -19
- package/src/style/abstracts/variables/_tooltips.scss +0 -29
- package/src/style/abstracts/variables/_z-index.scss +0 -28
- package/src/style/components/_d-input-select.scss +0 -27
- package/src/style/components/_d-input.scss +0 -178
package/dist/index.esm.js
CHANGED
|
@@ -495,7 +495,7 @@ function DInput(_a, ref) {
|
|
|
495
495
|
valid,
|
|
496
496
|
value,
|
|
497
497
|
]);
|
|
498
|
-
const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, {
|
|
498
|
+
const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix, materialStyle: labelIconMaterialStyle }))] })), [
|
|
499
499
|
id,
|
|
500
500
|
label,
|
|
501
501
|
labelIcon,
|
|
@@ -512,11 +512,10 @@ function DInput(_a, ref) {
|
|
|
512
512
|
const { iconMap: { input } } = useDContext();
|
|
513
513
|
const invalidIcon = useMemo(() => invalidIconProp || input.invalid, [input.invalid, invalidIconProp]);
|
|
514
514
|
const validIcon = useMemo(() => validIconProp || input.valid, [input.valid, validIconProp]);
|
|
515
|
-
return (jsxs("div", { className:
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}), children: [!!inputStart && (jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading || iconStartDisabled, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })), dynamicComponent, ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "d-input-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), (iconEnd && !loading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading || iconEndDisabled, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })), loading && (jsx("div", { className: "input-group-text d-input-icon", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) })), !!inputEnd && (jsx("div", { className: "input-group-text", children: inputEnd }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
|
|
515
|
+
return (jsxs("div", { className: className, style: style, children: [label && !floatingLabel && labelComponent, jsxs("div", { className: classNames({
|
|
516
|
+
'input-group': true,
|
|
517
|
+
'has-validation': invalid || valid,
|
|
518
|
+
}), children: [!!inputStart && (jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading || iconStartDisabled, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix, materialStyle: iconStartMaterialStyle }) })), dynamicComponent, ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, materialStyle: iconMaterialStyle }) })), (iconEnd && !loading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading || iconEndDisabled, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix, materialStyle: iconEndMaterialStyle }) })), 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..." }) }) })), !!inputEnd && (jsx("div", { className: "input-group-text", children: inputEnd }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
520
519
|
}
|
|
521
520
|
const ForwardedDInput = forwardRef(DInput);
|
|
522
521
|
ForwardedDInput.displayName = 'DInput';
|
|
@@ -544,7 +543,7 @@ function DMonthPicker(_a) {
|
|
|
544
543
|
const iconPrevMonth = useMemo(() => iconPrevMonthProp || chevronLeft, [chevronLeft, iconPrevMonthProp]);
|
|
545
544
|
const iconNextMonth = useMemo(() => iconNextMonthProp || chevronRight, [chevronRight, iconNextMonthProp]);
|
|
546
545
|
const dateFormatted = useMemo(() => (format(new Date(date), 'MMMM yyyy', { locale })), [date, locale]);
|
|
547
|
-
return (jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: selected, className: className, calendarClassName: classNames('d-month-picker', calendarClassName), onChange: onChange }, locale && { locale }, { customInput: (jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxs("div", { className: "d-flex align-items-center justify-content-between gap-
|
|
546
|
+
return (jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: selected, className: className, calendarClassName: classNames('d-month-picker', calendarClassName), onChange: onChange }, locale && { locale }, { customInput: (jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxs("div", { className: "d-flex align-items-center justify-content-between gap-6 fs-6 bg-dark", children: [jsx(DButton, { iconStart: iconPrevMonth, size: "sm", variant: "link", theme: "light", onClick: decreaseYear, disabled: prevYearButtonDisabled, ariaLabel: headerPrevYearAriaLabel, iconStartFamilyClass: iconFamilyClass, iconStartFamilyPrefix: iconFamilyPrefix }), jsx("p", { className: "fs-6 fw-bold", children: monthDate.getFullYear() }), jsx(DButton, { iconStart: iconNextMonth, size: "sm", variant: "link", theme: "light", onClick: increaseYear, disabled: nextYearButtonDisabled, ariaLabel: headerNextYearAriaLabel, iconEndFamilyClass: iconFamilyPrefix, iconEndFamilyPrefix: iconFamilyPrefix })] })) }, props)));
|
|
548
547
|
}
|
|
549
548
|
|
|
550
549
|
function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, iconPrevMonth, iconNextMonth, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', iconSize, buttonVariant, buttonTheme, locale, style, className, }) {
|
|
@@ -585,44 +584,6 @@ const ForwardedDInputMask = forwardRef(DInputMask);
|
|
|
585
584
|
ForwardedDInputMask.displayName = 'DInputMask';
|
|
586
585
|
var DInputMask$1 = ForwardedDInputMask;
|
|
587
586
|
|
|
588
|
-
function DInputCounter(_a, ref) {
|
|
589
|
-
var { minValue, maxValue, value = minValue, invalid, iconStart: iconStartProp, iconEnd: iconEndProp, iconStartAriaLabel = 'decrease action', iconEndAriaLabel = 'increase action', style, onChange } = _a, props = __rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "iconStartAriaLabel", "iconEndAriaLabel", "style", "onChange"]);
|
|
590
|
-
const inputRef = useProvidedRefOrCreate(ref);
|
|
591
|
-
const [internalIsInvalid, setInternalIsInvalid] = useState(false);
|
|
592
|
-
const [internalValue, setInternalValue] = useState(value);
|
|
593
|
-
useEffect(() => {
|
|
594
|
-
setInternalValue(value);
|
|
595
|
-
}, [value]);
|
|
596
|
-
useEffect(() => {
|
|
597
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(Number(internalValue));
|
|
598
|
-
}, [onChange, internalValue]);
|
|
599
|
-
const handleOnChange = useCallback((newValue) => {
|
|
600
|
-
setInternalValue(Number(newValue || '0'));
|
|
601
|
-
}, []);
|
|
602
|
-
const handleOnIconStartClick = useCallback(() => {
|
|
603
|
-
setInternalValue((prevInternalValue) => Math.max(prevInternalValue - 1, minValue));
|
|
604
|
-
}, [minValue]);
|
|
605
|
-
const handleOnIconEndClick = useCallback(() => {
|
|
606
|
-
setInternalValue((prevInternalValue) => Math.min(prevInternalValue + 1, maxValue));
|
|
607
|
-
}, [maxValue]);
|
|
608
|
-
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}input-component-form-control-text-align`]: 'center' })), [style]);
|
|
609
|
-
const valueString = useMemo(() => (internalValue.toString()), [internalValue]);
|
|
610
|
-
useEffect(() => {
|
|
611
|
-
setInternalIsInvalid(!(internalValue >= minValue && internalValue <= maxValue));
|
|
612
|
-
}, [internalValue, minValue, maxValue]);
|
|
613
|
-
const { iconMap: { input } } = useDContext();
|
|
614
|
-
const iconEnd = useMemo(() => iconEndProp || input.increase, [iconEndProp, input.increase]);
|
|
615
|
-
const iconStart = useMemo(() => iconStartProp || input.decrease, [iconStartProp, input.decrease]);
|
|
616
|
-
return (jsx(DInput$1, Object.assign({ ref: inputRef, value: valueString, style: generateStyleVariables, iconStart: iconStart, iconEnd: iconEnd, invalid: internalIsInvalid || invalid, type: "number", onChange: handleOnChange, onIconStartClick: handleOnIconStartClick, onIconEndClick: handleOnIconEndClick, iconStartAriaLabel: iconStartAriaLabel, iconEndAriaLabel: iconEndAriaLabel }, internalValue === minValue && {
|
|
617
|
-
iconStartDisabled: true,
|
|
618
|
-
}, internalValue === maxValue && {
|
|
619
|
-
iconEndDisabled: true,
|
|
620
|
-
}, props)));
|
|
621
|
-
}
|
|
622
|
-
const ForwardedDInputCounter = forwardRef(DInputCounter);
|
|
623
|
-
ForwardedDInputCounter.displayName = 'DInputCounter';
|
|
624
|
-
var DInputCounter$1 = ForwardedDInputCounter;
|
|
625
|
-
|
|
626
587
|
function formatValue(value, currencyOptions) {
|
|
627
588
|
if (value === undefined) {
|
|
628
589
|
return '';
|
|
@@ -644,17 +605,12 @@ function useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref
|
|
|
644
605
|
setInnerType('text');
|
|
645
606
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
646
607
|
}, [onBlur]);
|
|
647
|
-
const handleOnWheel = useCallback((event) => {
|
|
648
|
-
var _a;
|
|
649
|
-
event.stopPropagation();
|
|
650
|
-
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
651
|
-
}, [inputRef]);
|
|
652
608
|
const generateStyleVariables = useMemo(() => ({
|
|
653
609
|
[`--${PREFIX_BS}input-currency-component-symbol-color`]: `var(--${PREFIX_BS}secondary)`,
|
|
654
610
|
[`--${PREFIX_BS}input-currency-symbol-color`]: `var(--${PREFIX_BS}input-currency-component-symbol-color)`,
|
|
655
611
|
}), []);
|
|
656
612
|
const generateSymbolStyleVariables = useMemo(() => ({
|
|
657
|
-
color: `var(--${PREFIX_BS}
|
|
613
|
+
color: `var(--${PREFIX_BS}input-currency-symbol-color)`,
|
|
658
614
|
}), []);
|
|
659
615
|
const handleOnChange = useCallback((newValue) => {
|
|
660
616
|
const newNumber = (newValue === undefined || newValue === '')
|
|
@@ -685,15 +641,66 @@ function useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref
|
|
|
685
641
|
handleOnFocus,
|
|
686
642
|
handleOnChange,
|
|
687
643
|
handleOnBlur,
|
|
688
|
-
handleOnWheel,
|
|
689
644
|
generateStyleVariables,
|
|
690
645
|
generateSymbolStyleVariables,
|
|
691
646
|
};
|
|
692
647
|
}
|
|
693
648
|
|
|
649
|
+
function useDisableInputWheel(ref) {
|
|
650
|
+
const inputRef = useProvidedRefOrCreate(ref);
|
|
651
|
+
const handleOnWheel = useCallback((event) => {
|
|
652
|
+
var _a;
|
|
653
|
+
event.stopPropagation();
|
|
654
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
655
|
+
}, [inputRef]);
|
|
656
|
+
return {
|
|
657
|
+
handleOnWheel,
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
function DInputCounter(_a, ref) {
|
|
662
|
+
var { minValue, maxValue, value = minValue, invalid, iconStart: iconStartProp, iconEnd: iconEndProp, iconStartAriaLabel = 'decrease action', iconEndAriaLabel = 'increase action', style, onChange } = _a, props = __rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "iconStartAriaLabel", "iconEndAriaLabel", "style", "onChange"]);
|
|
663
|
+
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
664
|
+
const inputRef = useProvidedRefOrCreate(ref);
|
|
665
|
+
const [internalIsInvalid, setInternalIsInvalid] = useState(false);
|
|
666
|
+
const [internalValue, setInternalValue] = useState(value);
|
|
667
|
+
useEffect(() => {
|
|
668
|
+
setInternalValue(value);
|
|
669
|
+
}, [value]);
|
|
670
|
+
useEffect(() => {
|
|
671
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(Number(internalValue));
|
|
672
|
+
}, [onChange, internalValue]);
|
|
673
|
+
const handleOnChange = useCallback((newValue) => {
|
|
674
|
+
setInternalValue(Number(newValue || '0'));
|
|
675
|
+
}, []);
|
|
676
|
+
const handleOnIconStartClick = useCallback(() => {
|
|
677
|
+
setInternalValue((prevInternalValue) => Math.max(prevInternalValue - 1, minValue));
|
|
678
|
+
}, [minValue]);
|
|
679
|
+
const handleOnIconEndClick = useCallback(() => {
|
|
680
|
+
setInternalValue((prevInternalValue) => Math.min(prevInternalValue + 1, maxValue));
|
|
681
|
+
}, [maxValue]);
|
|
682
|
+
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}form-control-component-text-align`]: 'center' })), [style]);
|
|
683
|
+
const valueString = useMemo(() => (internalValue.toString()), [internalValue]);
|
|
684
|
+
useEffect(() => {
|
|
685
|
+
setInternalIsInvalid(!(internalValue >= minValue && internalValue <= maxValue));
|
|
686
|
+
}, [internalValue, minValue, maxValue]);
|
|
687
|
+
const { iconMap: { input } } = useDContext();
|
|
688
|
+
const iconEnd = useMemo(() => iconEndProp || input.increase, [iconEndProp, input.increase]);
|
|
689
|
+
const iconStart = useMemo(() => iconStartProp || input.decrease, [iconStartProp, input.decrease]);
|
|
690
|
+
return (jsx(DInput$1, Object.assign({ ref: inputRef, value: valueString, style: generateStyleVariables, iconStart: iconStart, iconEnd: iconEnd, invalid: internalIsInvalid || invalid, type: "number", onChange: handleOnChange, onWheel: handleOnWheel, onIconStartClick: handleOnIconStartClick, onIconEndClick: handleOnIconEndClick, iconStartAriaLabel: iconStartAriaLabel, iconEndAriaLabel: iconEndAriaLabel }, internalValue === minValue && {
|
|
691
|
+
iconStartDisabled: true,
|
|
692
|
+
}, internalValue === maxValue && {
|
|
693
|
+
iconEndDisabled: true,
|
|
694
|
+
}, props)));
|
|
695
|
+
}
|
|
696
|
+
const ForwardedDInputCounter = forwardRef(DInputCounter);
|
|
697
|
+
ForwardedDInputCounter.displayName = 'DInputCounter';
|
|
698
|
+
var DInputCounter$1 = ForwardedDInputCounter;
|
|
699
|
+
|
|
694
700
|
function DInputCurrencyBase(_a, ref) {
|
|
695
701
|
var { value, minValue, maxValue, currencyOptions, currencyCode, onFocus, onBlur, onChange } = _a, inputProps = __rest(_a, ["value", "minValue", "maxValue", "currencyOptions", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
696
|
-
const {
|
|
702
|
+
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
703
|
+
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
697
704
|
return (jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", pattern: "^[0-9]", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, inputProps)));
|
|
698
705
|
}
|
|
699
706
|
const ForwardedDInputCurrencyBase$1 = forwardRef(DInputCurrencyBase);
|
|
@@ -703,7 +710,8 @@ var DInputCurrencyBase$1 = ForwardedDInputCurrencyBase$1;
|
|
|
703
710
|
function DInputCurrency(_a, ref) {
|
|
704
711
|
var { value, minValue, maxValue, currencyCode, onFocus, onBlur, onChange } = _a, props = __rest(_a, ["value", "minValue", "maxValue", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
705
712
|
const { currency: currencyOptions } = useDContext();
|
|
706
|
-
const {
|
|
713
|
+
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
714
|
+
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
707
715
|
return (jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", pattern: "^[0-9]", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, props)));
|
|
708
716
|
}
|
|
709
717
|
const ForwardedDInputCurrencyBase = forwardRef(DInputCurrency);
|
|
@@ -808,11 +816,11 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
808
816
|
const { iconMap: { input } } = useDContext();
|
|
809
817
|
const invalidIcon = useMemo(() => invalidIconProp || input.invalid, [input.invalid, invalidIconProp]);
|
|
810
818
|
const validIcon = useMemo(() => validIconProp || input.valid, [input.valid, validIconProp]);
|
|
811
|
-
return (jsxs("div", { className: classNames('d-input-pin', className), style: style, children: [label && (jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsx(DIcon, {
|
|
819
|
+
return (jsxs("div", { className: classNames('d-input-pin', className), style: style, children: [label && (jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("form", { id: id, onInput: formChange, onSubmit: preventDefaultEvent, children: [Array.from({ length: characters }).map((_, index) => (jsx("input", Object.assign({ className: classNames({
|
|
812
820
|
'form-control': true,
|
|
813
821
|
'is-invalid': invalid,
|
|
814
822
|
'is-valid': valid,
|
|
815
|
-
}), type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onChange: nextInput, onKeyDown: prevInput, onFocus: focusInput, onWheel: wheelInput, onClick: preventDefaultEvent, autoComplete: "off", placeholder: placeholder, disabled: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), (invalid || valid) && !loading && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "
|
|
823
|
+
}), type: secret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onChange: nextInput, onKeyDown: prevInput, onFocus: focusInput, onWheel: wheelInput, onClick: preventDefaultEvent, autoComplete: "off", placeholder: placeholder, disabled: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), (invalid || valid) && !loading && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? invalidIcon : validIcon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), 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 }))] }));
|
|
816
824
|
}
|
|
817
825
|
|
|
818
826
|
function DInputSelect({ id, name, label = '', className, style, options = [], labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, floatingLabel = false, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
|
|
@@ -875,7 +883,7 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
875
883
|
value,
|
|
876
884
|
floatingLabel,
|
|
877
885
|
]);
|
|
878
|
-
const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, {
|
|
886
|
+
const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), [
|
|
879
887
|
id,
|
|
880
888
|
label,
|
|
881
889
|
labelIcon,
|
|
@@ -888,10 +896,9 @@ function DInputSelect({ id, name, label = '', className, style, options = [], la
|
|
|
888
896
|
}
|
|
889
897
|
return selectComponent;
|
|
890
898
|
}, [floatingLabel, labelComponent, selectComponent]);
|
|
891
|
-
return (jsxs("div", { className:
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: disabled || loading, "aria-label": iconStartAriaLabel, children: iconStart && (jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), dynamicComponent, iconEnd && !loading && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: disabled || loading, "aria-label": iconEndAriaLabel, children: iconEnd && (jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsx("div", { className: "input-group-text form-control-icon loading", 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 }))] })] }));
|
|
899
|
+
return (jsxs("div", { className: className, style: style, children: [label && !floatingLabel && (labelComponent), jsxs("div", { className: classNames({
|
|
900
|
+
'input-group': true,
|
|
901
|
+
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: disabled || loading, "aria-label": iconStartAriaLabel, children: iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), dynamicComponent, iconEnd && !loading && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: disabled || loading, "aria-label": iconEndAriaLabel, children: iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsx("div", { className: "input-group-text form-control-icon loading", 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 }))] }));
|
|
895
902
|
}
|
|
896
903
|
|
|
897
904
|
function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly, className, style, onChange, }) {
|
|
@@ -985,15 +992,18 @@ function DSelect(_a) {
|
|
|
985
992
|
}, [onIconEndClick, defaultValue]);
|
|
986
993
|
return (jsxs("div", { className: classNames('d-select', className, {
|
|
987
994
|
disabled: disabled || loading,
|
|
988
|
-
}), style: style, children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, {
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
995
|
+
}), style: style, children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: classNames({
|
|
996
|
+
'input-group': true,
|
|
997
|
+
'has-validation': invalid,
|
|
998
|
+
disabled: disabled || loading,
|
|
999
|
+
}), 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({ styles: {
|
|
1000
|
+
control: (base) => (Object.assign(Object.assign({}, base), { minHeight: 'unset' })),
|
|
1001
|
+
container: (base) => (Object.assign(Object.assign({}, base), { flex: 1 })),
|
|
1002
|
+
menu: (base) => (Object.assign(Object.assign({}, base), { width: menuWithMaxContent ? 'max-context' : '100%' })),
|
|
1003
|
+
}, className: classNames('d-select-component', {
|
|
1004
|
+
'is-invalid': invalid,
|
|
1005
|
+
'is-valid': valid,
|
|
1006
|
+
}), classNamePrefix: "d-select", isDisabled: disabled || loading, isClearable: clearable, isLoading: loading, isRtl: rtl, isSearchable: searchable, isMulti: multi, defaultValue: defaultValue, unstyled: true, components: Object.assign({ DropdownIndicator: DSelectDropdownIndicator, ClearIndicator: DSelectClearIndicator, MultiValueRemove: DSelectMultiValueRemove, LoadingIndicator: DSelectLoadingIndicator }, components) }, props)), ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "input-group-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
997
1007
|
}
|
|
998
1008
|
var DSelect$1 = Object.assign(DSelect, {
|
|
999
1009
|
OptionCheck: DSelectOptionCheck,
|
|
@@ -1103,7 +1113,7 @@ var DOffcanvas$1 = Object.assign(DOffcanvas, {
|
|
|
1103
1113
|
|
|
1104
1114
|
function DPaginator(_a) {
|
|
1105
1115
|
var { className, nextLabel, previousLabel, showArrows = true, page, onPageChange } = _a, props = __rest(_a, ["className", "nextLabel", "previousLabel", "showArrows", "page", "onPageChange"]);
|
|
1106
|
-
return (jsx(ResponsivePagination, Object.assign({ extraClassName:
|
|
1116
|
+
return (jsx(ResponsivePagination, Object.assign({ extraClassName: className, nextLabel: nextLabel, previousLabel: previousLabel, renderNav: showArrows, current: page, onPageChange: onPageChange }, props)));
|
|
1107
1117
|
}
|
|
1108
1118
|
|
|
1109
1119
|
function DPopover({ children, renderComponent, open, setOpen, adjustContentToRender = false, className, style, }) {
|
|
@@ -1331,7 +1341,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
1331
1341
|
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 }));
|
|
1332
1342
|
}
|
|
1333
1343
|
|
|
1334
|
-
function DTabs({ children, defaultSelected, onChange, options, className, style, vertical,
|
|
1344
|
+
function DTabs({ children, defaultSelected, onChange, options, className, style, vertical, variant = 'underline', }) {
|
|
1335
1345
|
const [selected, setSelected] = useState(defaultSelected);
|
|
1336
1346
|
const onSelect = useCallback((option) => {
|
|
1337
1347
|
if (option.tab) {
|
|
@@ -1346,13 +1356,13 @@ function DTabs({ children, defaultSelected, onChange, options, className, style,
|
|
|
1346
1356
|
const value = useMemo(() => ({
|
|
1347
1357
|
isSelected,
|
|
1348
1358
|
}), [isSelected]);
|
|
1349
|
-
const generateClasses = useMemo(() => (Object.assign({ nav: true, 'flex-column align-items-center': vertical
|
|
1359
|
+
const generateClasses = useMemo(() => (Object.assign({ nav: true, 'flex-column align-items-center': vertical && variant !== 'tabs', [`nav-${variant}`]: true }, className && { [className]: true })), [vertical, variant, className]);
|
|
1350
1360
|
return (jsx(TabContext.Provider, { value: value, children: jsxs("div", { className: classNames({
|
|
1351
|
-
'd-flex': true,
|
|
1352
|
-
'flex-column': !vertical,
|
|
1353
|
-
}
|
|
1361
|
+
'd-flex w-100': true,
|
|
1362
|
+
'flex-column': !vertical || variant === 'tabs',
|
|
1363
|
+
}), style: style, children: [jsx("nav", { className: classNames(generateClasses), children: options.map((option) => (jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
1354
1364
|
active: option.tab === selected,
|
|
1355
|
-
}, className), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.label))) }), jsx("div", { className: "tab-content", children: children })] }) }));
|
|
1365
|
+
}, className), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.label))) }), jsx("div", { className: "tab-content w-100", children: children })] }) }));
|
|
1356
1366
|
}
|
|
1357
1367
|
var DTabs$1 = Object.assign(DTabs, {
|
|
1358
1368
|
Tab: DTabContent,
|
|
@@ -1389,5 +1399,5 @@ async function configureI8n(resources, _a = {}) {
|
|
|
1389
1399
|
.then((t) => t);
|
|
1390
1400
|
}
|
|
1391
1401
|
|
|
1392
|
-
export { DAlert, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DIconBase, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputMask$1 as DInputMask, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DModal$1 as DModal, DModalBody, DModalContext, DModalContextProvider, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasContext, DOffcanvasContextProvider, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSelect$1 as DSelect, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DTabContent, DTabs$1 as DTabs, DToastContainer, DTooltip, configureI8n as configureI18n, formatCurrency, useDContext, useDModalContext, useDOffcanvasContext, useDisableBodyScrollEffect, useFormatCurrency, useInputCurrency, usePortal, useProvidedRefOrCreate, useStackState, useTabContext, useToast };
|
|
1402
|
+
export { DAlert, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DIconBase, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputMask$1 as DInputMask, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DModal$1 as DModal, DModalBody, DModalContext, DModalContextProvider, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasContext, DOffcanvasContextProvider, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSelect$1 as DSelect, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DTabContent, DTabs$1 as DTabs, DToastContainer, DTooltip, configureI8n as configureI18n, formatCurrency, useDContext, useDModalContext, useDOffcanvasContext, useDisableBodyScrollEffect, useDisableInputWheel, useFormatCurrency, useInputCurrency, usePortal, useProvidedRefOrCreate, useStackState, useTabContext, useToast };
|
|
1393
1403
|
//# sourceMappingURL=index.esm.js.map
|