x-ui-design 0.3.40 → 0.3.42
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/index.esm.js +20 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +19 -11
- package/dist/index.js.map +1 -1
- package/lib/components/Radio/Group/Group.tsx +15 -12
- package/lib/components/Radio/Radio.tsx +1 -0
- package/lib/hooks/useForm.ts +6 -0
- package/package.json +1 -1
- package/src/app/page.tsx +24 -10
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import require$$1 from 'react/jsx-runtime';
|
|
2
|
-
import React$1, { useRef, useState, useContext, useMemo, useEffect, Children, isValidElement, Fragment, createContext, forwardRef, useImperativeHandle,
|
|
2
|
+
import React$1, { useRef, useState, useContext, useMemo, useEffect, Children, isValidElement, Fragment, createContext, forwardRef, useImperativeHandle, useCallback } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import ReactDOMServer from 'react-dom/server';
|
|
5
5
|
|
|
@@ -640,6 +640,12 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange) => {
|
|
|
640
640
|
}));
|
|
641
641
|
}
|
|
642
642
|
function setFieldValue(name, value, errors, reset = null) {
|
|
643
|
+
console.info({
|
|
644
|
+
name,
|
|
645
|
+
value,
|
|
646
|
+
errors,
|
|
647
|
+
reset
|
|
648
|
+
});
|
|
643
649
|
if (!reset && reset !== null && ([undefined, null].includes(value) || formRef.current[name] === value)) {
|
|
644
650
|
return;
|
|
645
651
|
}
|
|
@@ -2744,19 +2750,20 @@ const RadioGroup = ({
|
|
|
2744
2750
|
}
|
|
2745
2751
|
return Children.map(children, child => {
|
|
2746
2752
|
if (/*#__PURE__*/isValidElement(child) && (child.type === Radio$1 || child.type === RadioButton)) {
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2753
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2754
|
+
// @ts-expect-error
|
|
2755
|
+
const {
|
|
2756
|
+
...childProps
|
|
2757
|
+
} = child.props;
|
|
2758
|
+
return /*#__PURE__*/React$1.createElement(child.type, _extends({}, props, childProps, child.type === RadioButton ? {
|
|
2759
|
+
size,
|
|
2760
|
+
buttonStyle
|
|
2761
|
+
} : {}, {
|
|
2762
|
+
defaultValue: defaultValue,
|
|
2756
2763
|
disabled: disabled ?? child.props.disabled,
|
|
2757
2764
|
checked: selectedValue === child.props.value,
|
|
2758
2765
|
name: name ?? prefixClsRadio
|
|
2759
|
-
});
|
|
2766
|
+
}));
|
|
2760
2767
|
}
|
|
2761
2768
|
return child;
|
|
2762
2769
|
});
|
|
@@ -2827,7 +2834,8 @@ const RadioComponent = /*#__PURE__*/forwardRef(({
|
|
|
2827
2834
|
disabled: disabled,
|
|
2828
2835
|
onChange: handleChange,
|
|
2829
2836
|
onBlur: e => onBlur?.(e),
|
|
2830
|
-
onFocus: e => onFocus?.(e)
|
|
2837
|
+
onFocus: e => onFocus?.(e),
|
|
2838
|
+
defaultChecked: defaultChecked ?? checked
|
|
2831
2839
|
}), /*#__PURE__*/React$1.createElement("span", {
|
|
2832
2840
|
className: clsx([`${prefixCls} ${prefixCls}-${disabled ? 'disabled' : 'enabled'}`])
|
|
2833
2841
|
}), /*#__PURE__*/React$1.createElement("span", {
|