@nutui/nutui-react 1.2.2 → 1.2.3-beta.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/dist/esm/Radio.js CHANGED
@@ -76,7 +76,15 @@ var Radio = function Radio(props) {
76
76
  };
77
77
 
78
78
  var color = function color() {
79
- return !disabledStatement ? checkedStatement ? 'nut-radio__icon' : 'nut-radio__icon--unchecked' : 'nut-radio__icon--disable';
79
+ if (disabledStatement) {
80
+ return 'nut-radio__icon--disable';
81
+ }
82
+
83
+ if (checkedStatement) {
84
+ return 'nut-radio__icon';
85
+ }
86
+
87
+ return 'nut-radio__icon--unchecked';
80
88
  };
81
89
 
82
90
  var renderIcon = function renderIcon() {
@@ -90,10 +98,22 @@ var Radio = function Radio(props) {
90
98
  });
91
99
  };
92
100
 
101
+ var renderRadioItem = function renderRadioItem() {
102
+ if (shape === 'button') {
103
+ return renderButton();
104
+ }
105
+
106
+ if (reverseState) {
107
+ return [renderLabel(), renderIcon()];
108
+ }
109
+
110
+ return [renderIcon(), renderLabel()];
111
+ };
112
+
93
113
  var handleClick = function handleClick(e) {
94
- if (disabledStatement) return;
114
+ if (disabledStatement || checkedStatement) return;
95
115
  setCheckedStatement(!checkedStatement);
96
- props.onChange && props.onChange(e);
116
+ onChange && onChange(e);
97
117
  context && context.onChange(valueStatement);
98
118
  };
99
119
 
@@ -101,7 +121,7 @@ var Radio = function Radio(props) {
101
121
  return React__default.createElement("div", _objectSpread({
102
122
  className: "nut-radio ".concat(className),
103
123
  onClick: handleClick
104
- }, rest), props.shape == 'button' ? renderButton() : reverseState ? [renderLabel(), renderIcon()] : [renderIcon(), renderLabel()]);
124
+ }, rest), renderRadioItem());
105
125
  };
106
126
 
107
127
  Radio.defaultProps = defaultProps;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.2.2 Wed Aug 10 2022 14:56:00 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.2.2 Thu Aug 11 2022 14:29:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.2.2 Wed Aug 10 2022 14:56:00 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.2.2 Thu Aug 11 2022 14:29:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.2.2 Wed Aug 10 2022 14:56:00 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.2.2 Thu Aug 11 2022 14:29:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.2.2 Wed Aug 10 2022 14:56:00 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.2.2 Thu Aug 11 2022 14:29:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.2.2 Wed Aug 10 2022 14:56:00 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.2.2 Thu Aug 11 2022 14:29:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.2.2 Wed Aug 10 2022 14:55:27 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.2.2 Thu Aug 11 2022 14:28:42 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -5996,7 +5996,13 @@ const Radio = (props) => {
5996
5996
  }, children);
5997
5997
  };
5998
5998
  const color = () => {
5999
- return !disabledStatement ? checkedStatement ? "nut-radio__icon" : "nut-radio__icon--unchecked" : "nut-radio__icon--disable";
5999
+ if (disabledStatement) {
6000
+ return "nut-radio__icon--disable";
6001
+ }
6002
+ if (checkedStatement) {
6003
+ return "nut-radio__icon";
6004
+ }
6005
+ return "nut-radio__icon--unchecked";
6000
6006
  };
6001
6007
  const renderIcon = () => {
6002
6008
  const { iconName: iconName2, iconSize: iconSize2, iconActiveName: iconActiveName2 } = props;
@@ -6006,11 +6012,20 @@ const Radio = (props) => {
6006
6012
  className: color()
6007
6013
  });
6008
6014
  };
6015
+ const renderRadioItem = () => {
6016
+ if (shape === "button") {
6017
+ return renderButton();
6018
+ }
6019
+ if (reverseState) {
6020
+ return [renderLabel(), renderIcon()];
6021
+ }
6022
+ return [renderIcon(), renderLabel()];
6023
+ };
6009
6024
  const handleClick = (e2) => {
6010
- if (disabledStatement)
6025
+ if (disabledStatement || checkedStatement)
6011
6026
  return;
6012
6027
  setCheckedStatement(!checkedStatement);
6013
- props.onChange && props.onChange(e2);
6028
+ onChange && onChange(e2);
6014
6029
  context2 && context2.onChange(valueStatement);
6015
6030
  };
6016
6031
  const reverseState = textPosition === "left";
@@ -6018,7 +6033,7 @@ const Radio = (props) => {
6018
6033
  className: `nut-radio ${className}`,
6019
6034
  onClick: handleClick,
6020
6035
  ...rest
6021
- }, props.shape == "button" ? renderButton() : reverseState ? [renderLabel(), renderIcon()] : [renderIcon(), renderLabel()]);
6036
+ }, renderRadioItem());
6022
6037
  };
6023
6038
  Radio.defaultProps = defaultProps$H;
6024
6039
  Radio.displayName = "NutRadio";