@douyinfe/semi-ui 2.19.0-alpha.7 → 2.19.0-alpha.8

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 (42) hide show
  1. package/checkbox/_story/checkbox.stories.js +2 -0
  2. package/checkbox/checkbox.tsx +22 -19
  3. package/checkbox/checkboxGroup.tsx +1 -0
  4. package/dist/css/semi.css +21 -52
  5. package/dist/css/semi.min.css +1 -1
  6. package/dist/umd/semi-ui.js +268 -259
  7. package/dist/umd/semi-ui.js.map +1 -1
  8. package/dist/umd/semi-ui.min.js +1 -1
  9. package/dist/umd/semi-ui.min.js.map +1 -1
  10. package/lib/cjs/carousel/CarouselIndicator.d.ts +1 -1
  11. package/lib/cjs/carousel/index.d.ts +1 -1
  12. package/lib/cjs/checkbox/checkbox.js +18 -10
  13. package/lib/cjs/checkbox/checkboxGroup.js +10 -9
  14. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  15. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  16. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  17. package/lib/cjs/form/baseForm.d.ts +1 -1
  18. package/lib/cjs/form/field.d.ts +1 -1
  19. package/lib/cjs/radio/radio.d.ts +1 -1
  20. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  21. package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
  22. package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
  23. package/lib/cjs/timePicker/index.d.ts +2 -2
  24. package/lib/cjs/typography/title.d.ts +1 -1
  25. package/lib/cjs/upload/index.d.ts +1 -1
  26. package/lib/es/carousel/CarouselIndicator.d.ts +1 -1
  27. package/lib/es/carousel/index.d.ts +1 -1
  28. package/lib/es/checkbox/checkbox.js +18 -10
  29. package/lib/es/checkbox/checkboxGroup.js +8 -7
  30. package/lib/es/datePicker/dateInput.d.ts +1 -1
  31. package/lib/es/datePicker/datePicker.d.ts +1 -1
  32. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  33. package/lib/es/form/baseForm.d.ts +1 -1
  34. package/lib/es/form/field.d.ts +1 -1
  35. package/lib/es/radio/radio.d.ts +1 -1
  36. package/lib/es/radio/radioGroup.d.ts +1 -1
  37. package/lib/es/timePicker/TimePicker.d.ts +2 -2
  38. package/lib/es/timePicker/TimeShape.d.ts +1 -1
  39. package/lib/es/timePicker/index.d.ts +2 -2
  40. package/lib/es/typography/title.d.ts +1 -1
  41. package/lib/es/upload/index.d.ts +1 -1
  42. package/package.json +7 -7
@@ -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
  };
@@ -235,20 +235,27 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
235
235
  const name = inGroup && this.context.checkboxGroup.name;
236
236
  const xSemiPropChildren = this.props['x-semi-children-alias'] || 'children';
237
237
 
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
- );
238
+ const renderContent = () => {
239
+ if (!children && !extra) {
240
+ return null;
241
+ }
242
+
243
+ return (
244
+ <div className={`${prefix}-content`}>
245
+ {children ? (
246
+ <span id={addonId} className={`${prefix}-addon`} x-semi-prop={xSemiPropChildren}>
247
+ {children}
248
+ </span>
249
+ ) : null}
250
+ {extra ? (
251
+ <div id={extraId} className={extraCls} x-semi-prop="extra">
252
+ {extra}
253
+ </div>
254
+ ) : null}
255
+ </div>
256
+ );
257
+ };
258
+
252
259
  return (
253
260
  // label is better than span, however span is here which is to solve gitlab issue #364
254
261
  <span
@@ -276,11 +283,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
276
283
  onInputFocus={this.handleFocusVisible}
277
284
  onInputBlur={this.handleBlur}
278
285
  />
279
- {
280
- props.isCardType ?
281
- <div>{renderContent()}</div> :
282
- renderContent()
283
- }
286
+ {renderContent()}
284
287
  </span>
285
288
  );
286
289
  }
@@ -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);