@dynamic-framework/ui-react 1.27.0 → 1.28.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 +567 -7
- package/dist/css/dynamic-ui-non-root.min.css +2 -2
- package/dist/css/dynamic-ui-root.css +1 -1
- package/dist/css/dynamic-ui-root.min.css +1 -1
- package/dist/css/dynamic-ui.css +567 -7
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +26 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +26 -24
- package/dist/index.js.map +1 -1
- package/dist/types/components/DDatePicker/DDatePicker.d.ts +3 -3
- package/dist/types/components/DDatePickerInput/DDatePickerInput.d.ts +2 -0
- package/dist/types/components/DToastContainer/useDToast.d.ts +1 -1
- package/jest/__mocks__/fileMock.js +1 -0
- package/jest/__mocks__/styleMock.js +1 -0
- package/jest/setup.js +16 -0
- package/package.json +8 -6
- package/src/style/abstracts/variables/_+import.scss +1 -0
- package/src/style/abstracts/variables/_options.scss +1 -1
- package/src/style/abstracts/variables/_toast.scss +5 -0
- package/src/style/base/_+import.scss +1 -0
- package/src/style/base/_toast.scss +56 -0
package/dist/index.esm.js
CHANGED
|
@@ -517,7 +517,7 @@ function DInput(_a, ref) {
|
|
|
517
517
|
value,
|
|
518
518
|
size,
|
|
519
519
|
]);
|
|
520
|
-
const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}
|
|
520
|
+
const labelComponent = useMemo(() => (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix, materialStyle: labelIconMaterialStyle }))] })), [
|
|
521
521
|
id,
|
|
522
522
|
label,
|
|
523
523
|
labelIcon,
|
|
@@ -551,8 +551,8 @@ function DDatePickerTime(_a) {
|
|
|
551
551
|
}
|
|
552
552
|
|
|
553
553
|
function DDatePickerInput(_a, ref) {
|
|
554
|
-
var { value, onClick, id, iconEnd, className, style, inputLabel, readOnly: ignored } = _a, props = __rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style", "inputLabel", "readOnly"]);
|
|
555
|
-
return (jsx(DInput$1, Object.assign({ ref: ref, onClick: onClick, readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style, label: inputLabel }, props)));
|
|
554
|
+
var { value, onClick, id, iconEnd, className, style, inputLabel, validIcon, invalidIcon, readOnly: ignored } = _a, props = __rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style", "inputLabel", "validIcon", "invalidIcon", "readOnly"]);
|
|
555
|
+
return (jsx(DInput$1, Object.assign({ ref: ref, onClick: onClick, readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style, label: inputLabel, invalidIcon: invalidIcon, validIcon: validIcon }, props)));
|
|
556
556
|
}
|
|
557
557
|
const ForwardedDDatePickerInput = forwardRef(DDatePickerInput);
|
|
558
558
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
@@ -724,7 +724,7 @@ function DDatePickerHeader({ date, changeYear, changeMonth, decreaseMonth, incre
|
|
|
724
724
|
}
|
|
725
725
|
|
|
726
726
|
function DDatePicker(_a) {
|
|
727
|
-
var { date, selectsRange = false, inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, iconInput: iconInputProp, iconHeaderPrevMonth: iconHeaderPrevMonthProp, iconHeaderNextMonth: iconHeaderNextMonthProp, iconMaterialStyle: iconMaterialStyleProp, iconFamilyClass, iconFamilyPrefix, minYearSelect = 1900, maxYearSelect = 2100, iconHeaderSize = 'sm', headerPrevMonthAriaLabel = 'decrease month', headerNextMonthAriaLabel = 'increase month', headerButtonVariant = 'link', headerButtonTheme = 'dark', invalid = false, valid = false, locale, className, formatWeekDay: formatWeekDayProp, style } = _a, props = __rest(_a, ["date", "selectsRange", "inputLabel", "inputHint", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeLabel", "iconInput", "iconHeaderPrevMonth", "iconHeaderNextMonth", "iconMaterialStyle", "iconFamilyClass", "iconFamilyPrefix", "minYearSelect", "maxYearSelect", "iconHeaderSize", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "headerButtonVariant", "headerButtonTheme", "invalid", "valid", "locale", "className", "formatWeekDay", "style"]);
|
|
727
|
+
var { date, selectsRange = false, inputLabel, inputHint, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, iconInput: iconInputProp, iconHeaderPrevMonth: iconHeaderPrevMonthProp, iconHeaderNextMonth: iconHeaderNextMonthProp, iconMaterialStyle: iconMaterialStyleProp, iconFamilyClass, iconFamilyPrefix, minYearSelect = 1900, maxYearSelect = 2100, iconHeaderSize = 'sm', headerPrevMonthAriaLabel = 'decrease month', headerNextMonthAriaLabel = 'increase month', headerButtonVariant = 'link', headerButtonTheme = 'dark', invalid = false, valid = false, renderCustomHeader: renderCustomHeaderProp, validIcon, invalidIcon, locale, className, formatWeekDay: formatWeekDayProp, style } = _a, props = __rest(_a, ["date", "selectsRange", "inputLabel", "inputHint", "inputAriaLabel", "inputActionAriaLabel", "inputId", "timeId", "timeLabel", "iconInput", "iconHeaderPrevMonth", "iconHeaderNextMonth", "iconMaterialStyle", "iconFamilyClass", "iconFamilyPrefix", "minYearSelect", "maxYearSelect", "iconHeaderSize", "headerPrevMonthAriaLabel", "headerNextMonthAriaLabel", "headerButtonVariant", "headerButtonTheme", "invalid", "valid", "renderCustomHeader", "validIcon", "invalidIcon", "locale", "className", "formatWeekDay", "style"]);
|
|
728
728
|
const { iconMap: { calendar, chevronLeft, chevronRight, }, } = useDContext();
|
|
729
729
|
const selected = useMemo(() => (date ? parseISO(date) : null), [date]);
|
|
730
730
|
const iconInput = useMemo(() => iconInputProp || calendar, [calendar, iconInputProp]);
|
|
@@ -746,7 +746,13 @@ function DDatePicker(_a) {
|
|
|
746
746
|
minYearSelect,
|
|
747
747
|
maxYearSelect,
|
|
748
748
|
]);
|
|
749
|
-
|
|
749
|
+
const defaultRenderCustomHeader = useCallback((headerProps) => (jsx(DatePickerHeader, Object.assign({}, headerProps))), [DatePickerHeader]);
|
|
750
|
+
const renderCustomHeader = useMemo(() => (renderCustomHeaderProp || defaultRenderCustomHeader), [defaultRenderCustomHeader, renderCustomHeaderProp]);
|
|
751
|
+
return (jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, selectsRange: selectsRange, formatWeekDay: handleFormatWeekDay, customInput: (jsx(DDatePickerInput$1, Object.assign({ id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyleProp }, ((!valid && !invalid)
|
|
752
|
+
|| (valid && !validIcon)
|
|
753
|
+
|| (invalid && !invalidIcon)) && {
|
|
754
|
+
iconEnd: iconInput,
|
|
755
|
+
}, { inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, validIcon: validIcon, invalidIcon: invalidIcon, hint: inputHint }))), customTimeInput: (jsx(DDatePickerTime, { id: timeId, label: timeLabel })) }, locale && { locale }, props)));
|
|
750
756
|
}
|
|
751
757
|
|
|
752
758
|
function DInputMask(props, ref) {
|
|
@@ -928,15 +934,17 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
928
934
|
const otpValue = otp.join('');
|
|
929
935
|
onChange === null || onChange === void 0 ? void 0 : onChange(otpValue);
|
|
930
936
|
}, [onChange]);
|
|
937
|
+
useEffect(() => {
|
|
938
|
+
handleOTPChange(activeInput);
|
|
939
|
+
}, [activeInput, handleOTPChange]);
|
|
931
940
|
const handlePaste = useCallback((event) => {
|
|
932
941
|
event.preventDefault();
|
|
933
942
|
const pastedData = event.clipboardData.getData('text/plain');
|
|
934
943
|
const cleanData = isInputNum ? pastedData.replace(/[^0-9]/gmi, '') : pastedData;
|
|
935
944
|
const newInput = Array.from({ length: characters }).map((_, index) => cleanData[index] || '');
|
|
936
945
|
setActiveInput(newInput);
|
|
937
|
-
handleOTPChange(newInput);
|
|
938
946
|
event.currentTarget.blur();
|
|
939
|
-
}, [characters,
|
|
947
|
+
}, [characters, isInputNum]);
|
|
940
948
|
const nextInput = useCallback((event, index) => {
|
|
941
949
|
var _a;
|
|
942
950
|
const regex = new RegExp(pattern);
|
|
@@ -947,7 +955,6 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
947
955
|
if (input.value !== '') {
|
|
948
956
|
setActiveInput((prev) => {
|
|
949
957
|
const newValue = prev.with(index, input.value);
|
|
950
|
-
handleOTPChange(newValue);
|
|
951
958
|
return newValue;
|
|
952
959
|
});
|
|
953
960
|
if (input.nextSibling) {
|
|
@@ -957,14 +964,13 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
957
964
|
input.blur();
|
|
958
965
|
}
|
|
959
966
|
}
|
|
960
|
-
}, [
|
|
967
|
+
}, [pattern]);
|
|
961
968
|
const prevInput = useCallback(({ key, currentTarget }, index) => {
|
|
962
969
|
var _a;
|
|
963
970
|
if (key === 'Backspace') {
|
|
964
971
|
const { value } = currentTarget;
|
|
965
972
|
setActiveInput((prev) => {
|
|
966
973
|
const newVal = prev.with(index, '');
|
|
967
|
-
handleOTPChange(newVal);
|
|
968
974
|
return newVal;
|
|
969
975
|
});
|
|
970
976
|
if (currentTarget.previousSibling && value === '') {
|
|
@@ -975,7 +981,7 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
975
981
|
currentTarget.focus();
|
|
976
982
|
}
|
|
977
983
|
}
|
|
978
|
-
}, [
|
|
984
|
+
}, []);
|
|
979
985
|
const focusInput = useCallback((index) => {
|
|
980
986
|
setActiveInput((prev) => prev.with(index, ''));
|
|
981
987
|
}, []);
|
|
@@ -1524,20 +1530,16 @@ function useDToast() {
|
|
|
1524
1530
|
if (!visible) {
|
|
1525
1531
|
return null;
|
|
1526
1532
|
}
|
|
1533
|
+
if (!description) {
|
|
1534
|
+
return (jsx(DToast$1, { className: classNames({
|
|
1535
|
+
[`toast-${theme}`]: !!theme,
|
|
1536
|
+
'toast-soft': soft,
|
|
1537
|
+
}, 'show'), children: jsxs(DToast$1.Body, { children: [icon && (jsx(DIcon, { className: "toast-icon", icon: icon })), jsx("p", { className: "toast-title", children: title }), jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: () => toast.dismiss(id), children: jsx(DIcon, { icon: closeIcon || xLg }) })] }) }));
|
|
1538
|
+
}
|
|
1527
1539
|
return (jsxs(DToast$1, { className: classNames({
|
|
1528
|
-
[`
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
}, 'show'), children: [!description && (jsxs(DToast$1.Body, { className: "d-flex justify-content-between align-items-center", children: [jsx("span", { className: "me-auto", children: title }), jsx("button", { type: "button", className: classNames({
|
|
1532
|
-
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1533
|
-
'd-close': true,
|
|
1534
|
-
}), "aria-label": "Close", onClick: () => toast.dismiss(id), children: jsx(DIcon, { icon: closeIcon || xLg }) })] })), description && (jsxs(Fragment$1, { children: [jsxs(DToast$1.Header, { className: classNames({
|
|
1535
|
-
[`bg-${theme}-soft`]: !!theme && soft,
|
|
1536
|
-
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1537
|
-
}, 'show'), children: [icon && (jsx(DIcon, { icon: icon })), jsx("p", { className: "mb-0 me-auto", children: title }), timestamp && (jsx("small", { children: timestamp })), jsx("button", { type: "button", className: classNames({
|
|
1538
|
-
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1539
|
-
'd-close': true,
|
|
1540
|
-
}), "aria-label": "Close", onClick: () => toast.dismiss(id), children: jsx(DIcon, { icon: closeIcon || xLg }) })] }), jsx(DToast$1.Body, { className: "d-flex justify-content-between align-items-center", children: jsx("span", { children: description }) })] }))] }));
|
|
1540
|
+
[`toast-${theme}`]: !!theme,
|
|
1541
|
+
'toast-soft': soft,
|
|
1542
|
+
}, 'show'), children: [jsxs(DToast$1.Header, { children: [icon && (jsx(DIcon, { className: "toast-icon", icon: icon })), jsx("p", { className: "toast-title", children: title }), timestamp && (jsx("small", { className: "toast-timestamp", children: timestamp })), jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: () => toast.dismiss(id), children: jsx(DIcon, { icon: closeIcon || xLg }) })] }), jsx(DToast$1.Body, { children: jsx("span", { children: description }) })] }));
|
|
1541
1543
|
}, toastProps);
|
|
1542
1544
|
}, [xLg]);
|
|
1543
1545
|
return {
|