@douyinfe/semi-ui 2.19.0-alpha.7 → 2.19.0-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.
Files changed (75) hide show
  1. package/_utils/index.ts +9 -5
  2. package/avatar/index.tsx +3 -1
  3. package/checkbox/_story/checkbox.stories.js +2 -0
  4. package/checkbox/checkbox.tsx +25 -20
  5. package/checkbox/checkboxGroup.tsx +1 -0
  6. package/dist/css/semi.css +26 -59
  7. package/dist/css/semi.min.css +1 -1
  8. package/dist/umd/semi-ui.js +301 -276
  9. package/dist/umd/semi-ui.js.map +1 -1
  10. package/dist/umd/semi-ui.min.js +1 -1
  11. package/dist/umd/semi-ui.min.js.map +1 -1
  12. package/form/interface.ts +1 -1
  13. package/lib/cjs/_utils/index.js +4 -1
  14. package/lib/cjs/avatar/index.d.ts +1 -0
  15. package/lib/cjs/avatar/index.js +2 -1
  16. package/lib/cjs/carousel/CarouselIndicator.d.ts +1 -1
  17. package/lib/cjs/carousel/index.d.ts +1 -1
  18. package/lib/cjs/checkbox/checkbox.d.ts +1 -0
  19. package/lib/cjs/checkbox/checkbox.js +19 -10
  20. package/lib/cjs/checkbox/checkboxGroup.js +10 -9
  21. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  22. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  23. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  24. package/lib/cjs/form/interface.d.ts +1 -1
  25. package/lib/cjs/popconfirm/index.js +6 -6
  26. package/lib/cjs/radio/radio.d.ts +2 -1
  27. package/lib/cjs/radio/radio.js +1 -0
  28. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  29. package/lib/cjs/tabs/interface.d.ts +3 -2
  30. package/lib/cjs/tag/group.d.ts +1 -15
  31. package/lib/cjs/tag/index.d.ts +1 -1
  32. package/lib/cjs/tag/index.js +1 -1
  33. package/lib/cjs/tag/interface.d.ts +6 -3
  34. package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
  35. package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
  36. package/lib/cjs/timePicker/index.d.ts +2 -2
  37. package/lib/cjs/typography/title.d.ts +1 -1
  38. package/lib/cjs/upload/index.d.ts +1 -1
  39. package/lib/es/_utils/index.js +4 -1
  40. package/lib/es/avatar/index.d.ts +1 -0
  41. package/lib/es/avatar/index.js +2 -1
  42. package/lib/es/carousel/CarouselIndicator.d.ts +1 -1
  43. package/lib/es/carousel/index.d.ts +1 -1
  44. package/lib/es/checkbox/checkbox.d.ts +1 -0
  45. package/lib/es/checkbox/checkbox.js +19 -10
  46. package/lib/es/checkbox/checkboxGroup.js +8 -7
  47. package/lib/es/datePicker/dateInput.d.ts +1 -1
  48. package/lib/es/datePicker/datePicker.d.ts +1 -1
  49. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  50. package/lib/es/form/interface.d.ts +1 -1
  51. package/lib/es/popconfirm/index.js +6 -6
  52. package/lib/es/radio/radio.d.ts +2 -1
  53. package/lib/es/radio/radio.js +1 -0
  54. package/lib/es/radio/radioGroup.d.ts +1 -1
  55. package/lib/es/tabs/interface.d.ts +3 -2
  56. package/lib/es/tag/group.d.ts +1 -15
  57. package/lib/es/tag/index.d.ts +1 -1
  58. package/lib/es/tag/index.js +1 -1
  59. package/lib/es/tag/interface.d.ts +6 -3
  60. package/lib/es/timePicker/TimePicker.d.ts +2 -2
  61. package/lib/es/timePicker/TimeShape.d.ts +1 -1
  62. package/lib/es/timePicker/index.d.ts +2 -2
  63. package/lib/es/typography/title.d.ts +1 -1
  64. package/lib/es/upload/index.d.ts +1 -1
  65. package/package.json +7 -7
  66. package/popconfirm/_story/popconfirm.stories.js +1 -1
  67. package/popconfirm/index.tsx +6 -6
  68. package/radio/radio.tsx +2 -0
  69. package/tabs/_story/Demo.tsx +14 -5
  70. package/tabs/interface.ts +3 -2
  71. package/tag/group.tsx +2 -16
  72. package/tag/index.tsx +1 -1
  73. package/tag/interface.ts +9 -5
  74. package/transfer/_story/transfer.stories.js +2 -2
  75. package/treeSelect/_story/treeSelect.stories.js +3 -0
package/_utils/index.ts CHANGED
@@ -47,12 +47,16 @@ export function cloneDeep(value: any, customizer?: (value: any) => void) {
47
47
  set(newArray, key, v[key]);
48
48
  });
49
49
  // internal-issues:887
50
- warning(
51
- get(process, 'env.NODE_ENV') !== 'production',
52
- `[Semi] You may use an out-of-bounds array. In some cases, your program may not behave as expected.
50
+ try {
51
+ warning(
52
+ get(process, 'env.NODE_ENV') !== 'production',
53
+ `[Semi] You may use an out-of-bounds array. In some cases, your program may not behave as expected.
53
54
  The maximum length of an array is 4294967295.
54
55
  Please check whether the array subscript in your data exceeds the maximum value of the JS array subscript`
55
- );
56
+ );
57
+ } catch (e){
58
+
59
+ }
56
60
  return newArray;
57
61
  } else {
58
62
  return undefined;
@@ -191,4 +195,4 @@ export function getFocusableElements(node: HTMLElement) {
191
195
  // we are not filtered elements which are invisible
192
196
  const focusableElements = Array.from(node.querySelectorAll<HTMLElement>(focusableSelectorsStr));
193
197
  return focusableElements;
194
- }
198
+ }
package/avatar/index.tsx CHANGED
@@ -31,6 +31,7 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
31
31
  onMouseLeave: noop,
32
32
  };
33
33
 
34
+ static elementType: string;
34
35
  static propTypes = {
35
36
  children: PropTypes.node,
36
37
  color: PropTypes.oneOf(colorSet),
@@ -192,7 +193,7 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
192
193
  const finalProps = clickable ? { ...props, ...a11yFocusProps } : props;
193
194
  content = (
194
195
  <span className={`${prefixCls}-content`}>
195
- <span {...finalProps} x-semi-prop="children">{children}</span>
196
+ <span {...finalProps} x-semi-prop="children">{children}</span>
196
197
  </span>
197
198
  );
198
199
  }
@@ -234,3 +235,4 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
234
235
  );
235
236
  }
236
237
  }
238
+ Avatar.elementType = 'Avatar';
@@ -31,6 +31,8 @@ export const CheckboxDefault = () => {
31
31
  </Checkbox>
32
32
  <br />
33
33
  <Checkbox indeterminate>indeterminate</Checkbox>
34
+ <Checkbox onChange={e => console.log(e)} value={1} onChange={v => console.log(v)}>
35
+ </Checkbox>
34
36
  </div>
35
37
  );
36
38
  };
@@ -81,6 +81,8 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
81
81
  onMouseLeave: noop,
82
82
  type: 'default',
83
83
  };
84
+ static elementType: string;
85
+
84
86
  checkboxEntity: CheckboxInner;
85
87
  context: CheckboxContextType;
86
88
 
@@ -235,20 +237,27 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
235
237
  const name = inGroup && this.context.checkboxGroup.name;
236
238
  const xSemiPropChildren = this.props['x-semi-children-alias'] || 'children';
237
239
 
238
- const renderContent = () => (
239
- <>
240
- {children ? (
241
- <span id={addonId} className={`${prefix}-addon`} x-semi-prop={xSemiPropChildren}>
242
- {children}
243
- </span>
244
- ) : null}
245
- {extra ? (
246
- <div id={extraId} className={extraCls} x-semi-prop="extra">
247
- {extra}
248
- </div>
249
- ) : null}
250
- </>
251
- );
240
+ const renderContent = () => {
241
+ if (!children && !extra) {
242
+ return null;
243
+ }
244
+
245
+ return (
246
+ <div className={`${prefix}-content`}>
247
+ {children ? (
248
+ <span id={addonId} className={`${prefix}-addon`} x-semi-prop={xSemiPropChildren}>
249
+ {children}
250
+ </span>
251
+ ) : null}
252
+ {extra ? (
253
+ <div id={extraId} className={extraCls} x-semi-prop="extra">
254
+ {extra}
255
+ </div>
256
+ ) : null}
257
+ </div>
258
+ );
259
+ };
260
+
252
261
  return (
253
262
  // label is better than span, however span is here which is to solve gitlab issue #364
254
263
  <span
@@ -276,15 +285,11 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
276
285
  onInputFocus={this.handleFocusVisible}
277
286
  onInputBlur={this.handleBlur}
278
287
  />
279
- {
280
- props.isCardType ?
281
- <div>{renderContent()}</div> :
282
- renderContent()
283
- }
288
+ {renderContent()}
284
289
  </span>
285
290
  );
286
291
  }
287
292
  }
288
-
293
+ Checkbox.elementType = 'Checkbox';
289
294
 
290
295
  export default Checkbox;
@@ -120,6 +120,7 @@ class CheckboxGroup extends BaseComponent<CheckboxGroupProps, CheckboxGroupState
120
120
  [`${prefix }-wrapper`]: true,
121
121
  [`${prefix }-${ direction}`]: direction,
122
122
  [`${prefix}-${direction}-cardType`]: direction && isCardType,
123
+ [`${prefix}-${direction}-pureCardType`]: direction && isPureCardType,
123
124
  }, className);
124
125
 
125
126
  const realValue = this.state.value.slice();
package/dist/css/semi.css CHANGED
@@ -3508,7 +3508,7 @@ body {
3508
3508
  box-sizing: border-box;
3509
3509
  position: relative;
3510
3510
  display: flex;
3511
- align-items: center;
3511
+ align-items: flex-start;
3512
3512
  flex-wrap: wrap;
3513
3513
  font-size: 14px;
3514
3514
  line-height: 20px;
@@ -3516,6 +3516,7 @@ body {
3516
3516
  cursor: pointer;
3517
3517
  transition: background-color var(--semi-transition_duration-faster) var(--semi-transition_function-easeIn) var(--semi-transition_delay-fastest), border var(--semi-transition_duration-faster) var(--semi-transition_function-easeIn) var(--semi-transition_delay-fastest);
3518
3518
  transform: scale(var(--semi-transform_scale-none));
3519
+ column-gap: 8px;
3519
3520
  }
3520
3521
  .semi-checkbox input[type=checkbox] {
3521
3522
  position: absolute;
@@ -3526,11 +3527,16 @@ body {
3526
3527
  margin: 0;
3527
3528
  opacity: 0;
3528
3529
  }
3530
+ .semi-checkbox-content {
3531
+ flex: 1;
3532
+ display: flex;
3533
+ flex-direction: column;
3534
+ row-gap: 4px;
3535
+ }
3529
3536
  .semi-checkbox-addon {
3530
3537
  display: flex;
3531
3538
  flex: 1;
3532
3539
  align-items: center;
3533
- padding-left: 8px;
3534
3540
  color: var(--semi-color-text-0);
3535
3541
  line-height: 20px;
3536
3542
  user-select: none;
@@ -3633,7 +3639,6 @@ body {
3633
3639
  }
3634
3640
  .semi-checkbox-cardType .semi-checkbox-inner {
3635
3641
  position: relative;
3636
- margin-right: 8px;
3637
3642
  flex-shrink: 0;
3638
3643
  }
3639
3644
  .semi-checkbox-cardType .semi-checkbox-inner-display {
@@ -3642,22 +3647,18 @@ body {
3642
3647
  .semi-checkbox-cardType .semi-checkbox-inner-pureCardType {
3643
3648
  opacity: 0;
3644
3649
  width: 0;
3645
- margin-right: 0;
3646
3650
  }
3647
3651
  .semi-checkbox-cardType .semi-checkbox-addon {
3648
3652
  font-weight: 600;
3649
3653
  font-size: 14px;
3650
3654
  line-height: 20px;
3651
3655
  color: var(--semi-color-text-0);
3652
- margin-left: 0;
3653
- padding-left: 0;
3654
3656
  }
3655
3657
  .semi-checkbox-cardType .semi-checkbox-extra {
3656
3658
  font-weight: normal;
3657
3659
  font-size: 14px;
3658
3660
  line-height: 20px;
3659
3661
  color: var(--semi-color-text-2);
3660
- padding-left: 0;
3661
3662
  }
3662
3663
  .semi-checkbox-cardType .semi-checkbox-extra.semi-checkbox-cardType_extra_noChildren {
3663
3664
  margin-top: 0;
@@ -3759,9 +3760,7 @@ body {
3759
3760
  flex-grow: 1;
3760
3761
  flex-basis: 100%;
3761
3762
  box-sizing: border-box;
3762
- padding-left: 24px;
3763
3763
  color: var(--semi-color-text-2);
3764
- margin-top: 4px;
3765
3764
  }
3766
3765
  .semi-checkbox-focus {
3767
3766
  outline: 2px solid var(--semi-color-primary-light-active);
@@ -3779,21 +3778,24 @@ body {
3779
3778
  .semi-checkboxGroup .semi-checkbox.semi-checkbox-vertical {
3780
3779
  margin-bottom: 16px;
3781
3780
  }
3781
+ .semi-checkboxGroup-horizontal {
3782
+ display: flex;
3783
+ flex-wrap: wrap;
3784
+ gap: 16px;
3785
+ }
3782
3786
  .semi-checkboxGroup-horizontal .semi-checkbox {
3783
- margin-right: 16px;
3784
3787
  display: inline-flex;
3785
3788
  }
3786
- .semi-checkboxGroup-horizontal .semi-checkbox:last-of-type {
3787
- margin-right: 0;
3788
- }
3789
- .semi-checkboxGroup-vertical .semi-checkbox {
3790
- margin-bottom: 12px;
3789
+ .semi-checkboxGroup-vertical {
3790
+ display: flex;
3791
+ flex-direction: column;
3792
+ row-gap: 12px;
3791
3793
  }
3792
- .semi-checkboxGroup-vertical .semi-checkbox:last-of-type {
3793
- margin-bottom: 0;
3794
+ .semi-checkboxGroup-vertical-cardType {
3795
+ row-gap: 16px;
3794
3796
  }
3795
- .semi-checkboxGroup-vertical-cardType .semi-checkbox {
3796
- margin-bottom: 16px;
3797
+ .semi-checkboxGroup-vertical-pureCardType .semi-checkbox {
3798
+ column-gap: 0;
3797
3799
  }
3798
3800
 
3799
3801
  .semi-rtl .semi-checkbox,
@@ -3805,43 +3807,10 @@ body {
3805
3807
  left: auto;
3806
3808
  right: 0;
3807
3809
  }
3808
- .semi-rtl .semi-checkbox-addon,
3809
- .semi-portal-rtl .semi-checkbox-addon {
3810
- padding-left: 0;
3811
- padding-right: 8px;
3812
- }
3813
- .semi-rtl .semi-checkbox-extra,
3814
- .semi-portal-rtl .semi-checkbox-extra {
3815
- padding-left: 0;
3816
- padding-right: 24px;
3817
- }
3818
- .semi-rtl .semi-checkbox-cardType .semi-checkbox-inner,
3819
- .semi-portal-rtl .semi-checkbox-cardType .semi-checkbox-inner {
3820
- margin-right: 0;
3821
- margin-left: 8px;
3822
- }
3823
- .semi-rtl .semi-checkbox-cardType .semi-checkbox-addon,
3824
- .semi-portal-rtl .semi-checkbox-cardType .semi-checkbox-addon {
3825
- margin-right: 0;
3826
- padding-right: 0;
3827
- }
3828
- .semi-rtl .semi-checkbox-cardType .semi-checkbox-extra,
3829
- .semi-portal-rtl .semi-checkbox-cardType .semi-checkbox-extra {
3830
- padding-right: 0;
3831
- }
3832
3810
  .semi-rtl .semi-checkboxGroup,
3833
3811
  .semi-portal-rtl .semi-checkboxGroup {
3834
3812
  direction: rtl;
3835
3813
  }
3836
- .semi-rtl .semi-checkboxGroup-horizontal .semi-checkbox,
3837
- .semi-portal-rtl .semi-checkboxGroup-horizontal .semi-checkbox {
3838
- margin-right: 0;
3839
- margin-left: 16px;
3840
- }
3841
- .semi-rtl .semi-checkboxGroup-horizontal .semi-checkbox:last-of-type,
3842
- .semi-portal-rtl .semi-checkboxGroup-horizontal .semi-checkbox:last-of-type {
3843
- margin-left: 0;
3844
- }
3845
3814
 
3846
3815
  .semi-collapse-item {
3847
3816
  border-bottom: 1px solid var(--semi-color-border);
@@ -14324,14 +14293,8 @@ body {
14324
14293
  display: inline-flex;
14325
14294
  flex-direction: column;
14326
14295
  }
14327
- .semi-popconfirm-header-content {
14328
- color: var(--semi-color-text-2);
14329
- }
14330
- .semi-popconfirm-header-content > p {
14331
- margin: 0;
14332
- padding: 0;
14333
- }
14334
14296
  .semi-popconfirm-body {
14297
+ margin-left: 36px;
14335
14298
  color: var(--semi-color-text-2);
14336
14299
  }
14337
14300
  .semi-popconfirm-body > p {
@@ -15816,6 +15779,7 @@ body {
15816
15779
  .semi-sidesheet-body {
15817
15780
  padding: 0 24px;
15818
15781
  flex: 1;
15782
+ overflow: auto;
15819
15783
  }
15820
15784
  .semi-sidesheet-content {
15821
15785
  height: 100%;
@@ -19654,6 +19618,9 @@ body {
19654
19618
  user-select: none;
19655
19619
  cursor: not-allowed;
19656
19620
  }
19621
+ .semi-tree-option-list .semi-checkboxGroup-vertical {
19622
+ row-gap: 0;
19623
+ }
19657
19624
 
19658
19625
  .semi-tree-option-list-block .semi-tree-option:hover {
19659
19626
  background-color: var(--semi-color-fill-0);