@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.js
CHANGED
|
@@ -519,7 +519,7 @@ function DInput(_a, ref) {
|
|
|
519
519
|
value,
|
|
520
520
|
size,
|
|
521
521
|
]);
|
|
522
|
-
const labelComponent = React.useMemo(() => (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}
|
|
522
|
+
const labelComponent = React.useMemo(() => (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { icon: labelIcon, size: `var(--${PREFIX_BS}label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix, materialStyle: labelIconMaterialStyle }))] })), [
|
|
523
523
|
id,
|
|
524
524
|
label,
|
|
525
525
|
labelIcon,
|
|
@@ -553,8 +553,8 @@ function DDatePickerTime(_a) {
|
|
|
553
553
|
}
|
|
554
554
|
|
|
555
555
|
function DDatePickerInput(_a, ref) {
|
|
556
|
-
var { value, onClick, id, iconEnd, className, style, inputLabel, readOnly: ignored } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style", "inputLabel", "readOnly"]);
|
|
557
|
-
return (jsxRuntime.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)));
|
|
556
|
+
var { value, onClick, id, iconEnd, className, style, inputLabel, validIcon, invalidIcon, readOnly: ignored } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style", "inputLabel", "validIcon", "invalidIcon", "readOnly"]);
|
|
557
|
+
return (jsxRuntime.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)));
|
|
558
558
|
}
|
|
559
559
|
const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
|
|
560
560
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
@@ -726,7 +726,7 @@ function DDatePickerHeader({ date, changeYear, changeMonth, decreaseMonth, incre
|
|
|
726
726
|
}
|
|
727
727
|
|
|
728
728
|
function DDatePicker(_a) {
|
|
729
|
-
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 = tslib.__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"]);
|
|
729
|
+
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 = tslib.__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"]);
|
|
730
730
|
const { iconMap: { calendar, chevronLeft, chevronRight, }, } = useDContext();
|
|
731
731
|
const selected = React.useMemo(() => (date ? dateFns.parseISO(date) : null), [date]);
|
|
732
732
|
const iconInput = React.useMemo(() => iconInputProp || calendar, [calendar, iconInputProp]);
|
|
@@ -748,7 +748,13 @@ function DDatePicker(_a) {
|
|
|
748
748
|
minYearSelect,
|
|
749
749
|
maxYearSelect,
|
|
750
750
|
]);
|
|
751
|
-
|
|
751
|
+
const defaultRenderCustomHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps))), [DatePickerHeader]);
|
|
752
|
+
const renderCustomHeader = React.useMemo(() => (renderCustomHeaderProp || defaultRenderCustomHeader), [defaultRenderCustomHeader, renderCustomHeaderProp]);
|
|
753
|
+
return (jsxRuntime.jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: renderCustomHeader, selectsRange: selectsRange, formatWeekDay: handleFormatWeekDay, customInput: (jsxRuntime.jsx(DDatePickerInput$1, Object.assign({ id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconMaterialStyle: iconMaterialStyleProp }, ((!valid && !invalid)
|
|
754
|
+
|| (valid && !validIcon)
|
|
755
|
+
|| (invalid && !invalidIcon)) && {
|
|
756
|
+
iconEnd: iconInput,
|
|
757
|
+
}, { inputLabel: inputLabel, className: className, style: style, invalid: invalid, valid: valid, validIcon: validIcon, invalidIcon: invalidIcon, hint: inputHint }))), customTimeInput: (jsxRuntime.jsx(DDatePickerTime, { id: timeId, label: timeLabel })) }, locale && { locale }, props)));
|
|
752
758
|
}
|
|
753
759
|
|
|
754
760
|
function DInputMask(props, ref) {
|
|
@@ -930,15 +936,17 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
930
936
|
const otpValue = otp.join('');
|
|
931
937
|
onChange === null || onChange === void 0 ? void 0 : onChange(otpValue);
|
|
932
938
|
}, [onChange]);
|
|
939
|
+
React.useEffect(() => {
|
|
940
|
+
handleOTPChange(activeInput);
|
|
941
|
+
}, [activeInput, handleOTPChange]);
|
|
933
942
|
const handlePaste = React.useCallback((event) => {
|
|
934
943
|
event.preventDefault();
|
|
935
944
|
const pastedData = event.clipboardData.getData('text/plain');
|
|
936
945
|
const cleanData = isInputNum ? pastedData.replace(/[^0-9]/gmi, '') : pastedData;
|
|
937
946
|
const newInput = Array.from({ length: characters }).map((_, index) => cleanData[index] || '');
|
|
938
947
|
setActiveInput(newInput);
|
|
939
|
-
handleOTPChange(newInput);
|
|
940
948
|
event.currentTarget.blur();
|
|
941
|
-
}, [characters,
|
|
949
|
+
}, [characters, isInputNum]);
|
|
942
950
|
const nextInput = React.useCallback((event, index) => {
|
|
943
951
|
var _a;
|
|
944
952
|
const regex = new RegExp(pattern);
|
|
@@ -949,7 +957,6 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
949
957
|
if (input.value !== '') {
|
|
950
958
|
setActiveInput((prev) => {
|
|
951
959
|
const newValue = prev.with(index, input.value);
|
|
952
|
-
handleOTPChange(newValue);
|
|
953
960
|
return newValue;
|
|
954
961
|
});
|
|
955
962
|
if (input.nextSibling) {
|
|
@@ -959,14 +966,13 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
959
966
|
input.blur();
|
|
960
967
|
}
|
|
961
968
|
}
|
|
962
|
-
}, [
|
|
969
|
+
}, [pattern]);
|
|
963
970
|
const prevInput = React.useCallback(({ key, currentTarget }, index) => {
|
|
964
971
|
var _a;
|
|
965
972
|
if (key === 'Backspace') {
|
|
966
973
|
const { value } = currentTarget;
|
|
967
974
|
setActiveInput((prev) => {
|
|
968
975
|
const newVal = prev.with(index, '');
|
|
969
|
-
handleOTPChange(newVal);
|
|
970
976
|
return newVal;
|
|
971
977
|
});
|
|
972
978
|
if (currentTarget.previousSibling && value === '') {
|
|
@@ -977,7 +983,7 @@ function DInputPin({ id: idProp, label = '', labelIcon, labelIconFamilyClass, la
|
|
|
977
983
|
currentTarget.focus();
|
|
978
984
|
}
|
|
979
985
|
}
|
|
980
|
-
}, [
|
|
986
|
+
}, []);
|
|
981
987
|
const focusInput = React.useCallback((index) => {
|
|
982
988
|
setActiveInput((prev) => prev.with(index, ''));
|
|
983
989
|
}, []);
|
|
@@ -1526,20 +1532,16 @@ function useDToast() {
|
|
|
1526
1532
|
if (!visible) {
|
|
1527
1533
|
return null;
|
|
1528
1534
|
}
|
|
1535
|
+
if (!description) {
|
|
1536
|
+
return (jsxRuntime.jsx(DToast$1, { className: classNames({
|
|
1537
|
+
[`toast-${theme}`]: !!theme,
|
|
1538
|
+
'toast-soft': soft,
|
|
1539
|
+
}, 'show'), children: jsxRuntime.jsxs(DToast$1.Body, { children: [icon && (jsxRuntime.jsx(DIcon, { className: "toast-icon", icon: icon })), jsxRuntime.jsx("p", { className: "toast-title", children: title }), jsxRuntime.jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: () => reactHotToast.toast.dismiss(id), children: jsxRuntime.jsx(DIcon, { icon: closeIcon || xLg }) })] }) }));
|
|
1540
|
+
}
|
|
1529
1541
|
return (jsxRuntime.jsxs(DToast$1, { className: classNames({
|
|
1530
|
-
[`
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
}, 'show'), children: [!description && (jsxRuntime.jsxs(DToast$1.Body, { className: "d-flex justify-content-between align-items-center", children: [jsxRuntime.jsx("span", { className: "me-auto", children: title }), jsxRuntime.jsx("button", { type: "button", className: classNames({
|
|
1534
|
-
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1535
|
-
'd-close': true,
|
|
1536
|
-
}), "aria-label": "Close", onClick: () => reactHotToast.toast.dismiss(id), children: jsxRuntime.jsx(DIcon, { icon: closeIcon || xLg }) })] })), description && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(DToast$1.Header, { className: classNames({
|
|
1537
|
-
[`bg-${theme}-soft`]: !!theme && soft,
|
|
1538
|
-
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1539
|
-
}, 'show'), children: [icon && (jsxRuntime.jsx(DIcon, { icon: icon })), jsxRuntime.jsx("p", { className: "mb-0 me-auto", children: title }), timestamp && (jsxRuntime.jsx("small", { children: timestamp })), jsxRuntime.jsx("button", { type: "button", className: classNames({
|
|
1540
|
-
[`text-bg-${theme}`]: !!theme && !soft,
|
|
1541
|
-
'd-close': true,
|
|
1542
|
-
}), "aria-label": "Close", onClick: () => reactHotToast.toast.dismiss(id), children: jsxRuntime.jsx(DIcon, { icon: closeIcon || xLg }) })] }), jsxRuntime.jsx(DToast$1.Body, { className: "d-flex justify-content-between align-items-center", children: jsxRuntime.jsx("span", { children: description }) })] }))] }));
|
|
1542
|
+
[`toast-${theme}`]: !!theme,
|
|
1543
|
+
'toast-soft': soft,
|
|
1544
|
+
}, 'show'), children: [jsxRuntime.jsxs(DToast$1.Header, { children: [icon && (jsxRuntime.jsx(DIcon, { className: "toast-icon", icon: icon })), jsxRuntime.jsx("p", { className: "toast-title", children: title }), timestamp && (jsxRuntime.jsx("small", { className: "toast-timestamp", children: timestamp })), jsxRuntime.jsx("button", { type: "button", className: "d-close", "aria-label": "Close", onClick: () => reactHotToast.toast.dismiss(id), children: jsxRuntime.jsx(DIcon, { icon: closeIcon || xLg }) })] }), jsxRuntime.jsx(DToast$1.Body, { children: jsxRuntime.jsx("span", { children: description }) })] }));
|
|
1543
1545
|
}, toastProps);
|
|
1544
1546
|
}, [xLg]);
|
|
1545
1547
|
return {
|