@douyinfe/semi-ui 2.19.0-alpha.1 → 2.19.0-alpha.2

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.
@@ -20,8 +20,14 @@ var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stab
20
20
 
21
21
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
22
22
 
23
+ var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
24
+
25
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
26
+
23
27
  var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
24
28
 
29
+ var _get2 = _interopRequireDefault(require("lodash/get"));
30
+
25
31
  var _react = _interopRequireDefault(require("react"));
26
32
 
27
33
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -34,7 +40,7 @@ var _checkboxGroupFoundation = _interopRequireDefault(require("@douyinfe/semi-fo
34
40
 
35
41
  var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
36
42
 
37
- var _context7 = require("./context");
43
+ var _context9 = require("./context");
38
44
 
39
45
  var _checkbox = _interopRequireDefault(require("./checkbox"));
40
46
 
@@ -139,10 +145,25 @@ class CheckboxGroup extends _baseComponent.default {
139
145
  } else if (children) {
140
146
  var _context6;
141
147
 
142
- inner = (0, _map.default)(_context6 = _react.default.Children.toArray(children)).call(_context6, (itm, index) => /*#__PURE__*/_react.default.cloneElement(itm, {
143
- key: index,
144
- role: 'listitem'
145
- }));
148
+ inner = (0, _map.default)(_context6 = _react.default.Children.toArray(children)).call(_context6, (itm, index) => {
149
+ var _context7;
150
+
151
+ const props = {
152
+ key: index,
153
+ role: 'listitem'
154
+ };
155
+ const isCheckboxComp = (0, _some.default)(_context7 = ['Checkbox', 'CheckboxWithGroup']).call(_context7, comp => {
156
+ var _context8;
157
+
158
+ return (0, _includes.default)(_context8 = [(0, _get2.default)(itm, 'type.displayName'), (0, _get2.default)(itm, 'type.name')]).call(_context8, comp);
159
+ });
160
+
161
+ if (isCheckboxComp) {
162
+ props.type = type;
163
+ }
164
+
165
+ return /*#__PURE__*/_react.default.cloneElement(itm, props);
166
+ });
146
167
  }
147
168
 
148
169
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -153,7 +174,7 @@ class CheckboxGroup extends _baseComponent.default {
153
174
  style: style,
154
175
  "aria-labelledby": this.props['aria-labelledby'],
155
176
  "aria-describedby": this.props['aria-describedby']
156
- }, /*#__PURE__*/_react.default.createElement(_context7.Context.Provider, {
177
+ }, /*#__PURE__*/_react.default.createElement(_context9.Context.Provider, {
157
178
  value: {
158
179
  checkboxGroup: {
159
180
  onChange: this.onChange,
@@ -126,7 +126,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
126
126
  onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
127
127
  children?: React.ReactNode;
128
128
  preventScroll?: boolean;
129
- } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
129
+ } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
130
130
  static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
131
131
  static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
132
132
  static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
@@ -74,7 +74,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
74
74
  onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
75
75
  children?: import("react").ReactNode;
76
76
  preventScroll?: boolean;
77
- } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
77
+ } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
78
78
  declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
79
79
  declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
80
80
  declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
@@ -16,8 +16,14 @@ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
16
16
 
17
17
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
18
18
 
19
+ var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
20
+
21
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
22
+
19
23
  var _noop2 = _interopRequireDefault(require("lodash/noop"));
20
24
 
25
+ var _get2 = _interopRequireDefault(require("lodash/get"));
26
+
21
27
  var _react = _interopRequireDefault(require("react"));
22
28
 
23
29
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -32,7 +38,7 @@ var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
32
38
 
33
39
  var _radio = _interopRequireDefault(require("./radio"));
34
40
 
35
- var _context6 = _interopRequireDefault(require("./context"));
41
+ var _context8 = _interopRequireDefault(require("./context"));
36
42
 
37
43
  class RadioGroup extends _baseComponent.default {
38
44
  constructor(props) {
@@ -142,9 +148,28 @@ class RadioGroup extends _baseComponent.default {
142
148
  } else if (children) {
143
149
  var _context5;
144
150
 
145
- inner = (0, _map.default)(_context5 = _react.default.Children).call(_context5, children, (itm, index) => /*#__PURE__*/_react.default.isValidElement(itm) ? /*#__PURE__*/_react.default.cloneElement(itm, {
146
- key: index
147
- }) : null);
151
+ inner = (0, _map.default)(_context5 = _react.default.Children).call(_context5, children, (itm, index) => {
152
+ if ( /*#__PURE__*/_react.default.isValidElement(itm)) {
153
+ var _context6;
154
+
155
+ const props = {
156
+ key: index
157
+ };
158
+ const isRadioComp = (0, _some.default)(_context6 = ['Radio', 'RadioWithGroup']).call(_context6, comp => {
159
+ var _context7;
160
+
161
+ return (0, _includes.default)(_context7 = [(0, _get2.default)(itm, 'type.displayName'), (0, _get2.default)(itm, 'type.name')]).call(_context7, comp);
162
+ });
163
+
164
+ if (isRadioComp) {
165
+ props.type = type;
166
+ }
167
+
168
+ return /*#__PURE__*/_react.default.cloneElement(itm, props);
169
+ } else {
170
+ return null;
171
+ }
172
+ });
148
173
  }
149
174
 
150
175
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -157,7 +182,7 @@ class RadioGroup extends _baseComponent.default {
157
182
  "aria-labelledby": this.props['aria-labelledby'],
158
183
  "aria-describedby": this.props['aria-describedby'],
159
184
  "aria-required": this.props['aria-required']
160
- }, /*#__PURE__*/_react.default.createElement(_context6.default.Provider, {
185
+ }, /*#__PURE__*/_react.default.createElement(_context8.default.Provider, {
161
186
  value: {
162
187
  radioGroup: {
163
188
  onChange: this.onChange,
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
37
37
  underline: PropTypes.Requireable<boolean>;
38
38
  strong: PropTypes.Requireable<boolean>;
39
39
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
40
- heading: PropTypes.Requireable<4 | 2 | 1 | 3 | 5 | 6>;
40
+ heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
41
41
  style: PropTypes.Requireable<object>;
42
42
  className: PropTypes.Requireable<string>;
43
43
  component: PropTypes.Requireable<string>;
@@ -1,9 +1,12 @@
1
1
  import _isEqual from "lodash/isEqual";
2
+ import _get from "lodash/get";
2
3
  import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
3
4
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
4
5
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
5
6
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
6
7
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
8
+ import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
9
+ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
7
10
 
8
11
  /* eslint-disable max-len */
9
12
  import React from 'react';
@@ -117,10 +120,26 @@ class CheckboxGroup extends BaseComponent {
117
120
  } else if (children) {
118
121
  var _context6;
119
122
 
120
- inner = _mapInstanceProperty(_context6 = React.Children.toArray(children)).call(_context6, (itm, index) => /*#__PURE__*/React.cloneElement(itm, {
121
- key: index,
122
- role: 'listitem'
123
- }));
123
+ inner = _mapInstanceProperty(_context6 = React.Children.toArray(children)).call(_context6, (itm, index) => {
124
+ var _context7;
125
+
126
+ const props = {
127
+ key: index,
128
+ role: 'listitem'
129
+ };
130
+
131
+ const isCheckboxComp = _someInstanceProperty(_context7 = ['Checkbox', 'CheckboxWithGroup']).call(_context7, comp => {
132
+ var _context8;
133
+
134
+ return _includesInstanceProperty(_context8 = [_get(itm, 'type.displayName'), _get(itm, 'type.name')]).call(_context8, comp);
135
+ });
136
+
137
+ if (isCheckboxComp) {
138
+ props.type = type;
139
+ }
140
+
141
+ return /*#__PURE__*/React.cloneElement(itm, props);
142
+ });
124
143
  }
125
144
 
126
145
  return /*#__PURE__*/React.createElement("div", {
@@ -126,7 +126,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
126
126
  onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
127
127
  children?: React.ReactNode;
128
128
  preventScroll?: boolean;
129
- } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
129
+ } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
130
130
  static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
131
131
  static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
132
132
  static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
@@ -74,7 +74,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
74
74
  onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
75
75
  children?: import("react").ReactNode;
76
76
  preventScroll?: boolean;
77
- } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
77
+ } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
78
78
  declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
79
79
  declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
80
80
  declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
@@ -1,7 +1,10 @@
1
1
  import _noop from "lodash/noop";
2
+ import _get from "lodash/get";
2
3
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
3
4
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
4
5
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
6
+ import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
7
+ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
5
8
  import React from 'react';
6
9
  import PropTypes from 'prop-types';
7
10
  import classnames from 'classnames';
@@ -119,9 +122,29 @@ class RadioGroup extends BaseComponent {
119
122
  } else if (children) {
120
123
  var _context5;
121
124
 
122
- inner = _mapInstanceProperty(_context5 = React.Children).call(_context5, children, (itm, index) => /*#__PURE__*/React.isValidElement(itm) ? /*#__PURE__*/React.cloneElement(itm, {
123
- key: index
124
- }) : null);
125
+ inner = _mapInstanceProperty(_context5 = React.Children).call(_context5, children, (itm, index) => {
126
+ if ( /*#__PURE__*/React.isValidElement(itm)) {
127
+ var _context6;
128
+
129
+ const props = {
130
+ key: index
131
+ };
132
+
133
+ const isRadioComp = _someInstanceProperty(_context6 = ['Radio', 'RadioWithGroup']).call(_context6, comp => {
134
+ var _context7;
135
+
136
+ return _includesInstanceProperty(_context7 = [_get(itm, 'type.displayName'), _get(itm, 'type.name')]).call(_context7, comp);
137
+ });
138
+
139
+ if (isRadioComp) {
140
+ props.type = type;
141
+ }
142
+
143
+ return /*#__PURE__*/React.cloneElement(itm, props);
144
+ } else {
145
+ return null;
146
+ }
147
+ });
125
148
  }
126
149
 
127
150
  return /*#__PURE__*/React.createElement("div", {
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
37
37
  underline: PropTypes.Requireable<boolean>;
38
38
  strong: PropTypes.Requireable<boolean>;
39
39
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
40
- heading: PropTypes.Requireable<4 | 2 | 1 | 3 | 5 | 6>;
40
+ heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
41
41
  style: PropTypes.Requireable<object>;
42
42
  className: PropTypes.Requireable<string>;
43
43
  component: PropTypes.Requireable<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.19.0-alpha.1",
3
+ "version": "2.19.0-alpha.2",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -15,11 +15,11 @@
15
15
  "dependencies": {
16
16
  "@babel/runtime-corejs3": "^7.15.4",
17
17
  "@douyinfe/semi-animation": "2.12.0",
18
- "@douyinfe/semi-animation-react": "2.19.0-alpha.1",
19
- "@douyinfe/semi-foundation": "2.19.0-alpha.1",
20
- "@douyinfe/semi-icons": "2.19.0-alpha.1",
18
+ "@douyinfe/semi-animation-react": "2.19.0-alpha.2",
19
+ "@douyinfe/semi-foundation": "2.19.0-alpha.2",
20
+ "@douyinfe/semi-icons": "2.19.0-alpha.2",
21
21
  "@douyinfe/semi-illustrations": "2.15.0",
22
- "@douyinfe/semi-theme-default": "2.19.0-alpha.1",
22
+ "@douyinfe/semi-theme-default": "2.19.0-alpha.2",
23
23
  "async-validator": "^3.5.0",
24
24
  "classnames": "^2.2.6",
25
25
  "copy-text-to-clipboard": "^2.1.1",
@@ -66,13 +66,13 @@
66
66
  ],
67
67
  "author": "",
68
68
  "license": "MIT",
69
- "gitHead": "d1dbf82734b2187cc74c4bd674ba2c22c199d823",
69
+ "gitHead": "8f3924ea67e8b1df150c590927421b42f7325074",
70
70
  "devDependencies": {
71
71
  "@babel/plugin-proposal-decorators": "^7.15.8",
72
72
  "@babel/plugin-transform-runtime": "^7.15.8",
73
73
  "@babel/preset-env": "^7.15.8",
74
74
  "@babel/preset-react": "^7.14.5",
75
- "@douyinfe/semi-scss-compile": "2.19.0-alpha.1",
75
+ "@douyinfe/semi-scss-compile": "2.19.0-alpha.2",
76
76
  "@storybook/addon-knobs": "^6.3.1",
77
77
  "@types/lodash": "^4.14.176",
78
78
  "@types/react": ">=16.0.0",
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classnames from 'classnames';
4
- import { noop } from 'lodash';
4
+ import { get, noop } from 'lodash';
5
5
 
6
6
  import { radioGroupClasses as css, strings } from '@douyinfe/semi-foundation/radio/constants';
7
7
  import RadioGroupFoundation, { RadioGroupAdapter } from '@douyinfe/semi-foundation/radio/radioGroupFoundation';
@@ -199,9 +199,18 @@ class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState> {
199
199
  }
200
200
  });
201
201
  } else if (children) {
202
- inner = React.Children.map(children, (itm, index) => (React.isValidElement(itm) ?
203
- React.cloneElement(itm, { key: index }) :
204
- null));
202
+ inner = React.Children.map(children, (itm, index) => {
203
+ if (React.isValidElement(itm)) {
204
+ const props: Record<string, any> = { key: index };
205
+ const isRadioComp = ['Radio', 'RadioWithGroup'].some(comp => [get(itm, 'type.displayName'), get(itm, 'type.name')].includes(comp));
206
+ if (isRadioComp) {
207
+ props.type = type;
208
+ }
209
+ return React.cloneElement(itm, props);
210
+ } else {
211
+ return null;
212
+ }
213
+ });
205
214
  }
206
215
 
207
216
  return (