@douyinfe/semi-ui 2.15.0-beta.0 → 2.15.2-alpha.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.
@@ -1056,6 +1056,7 @@ describe(`DatePicker`, () => {
1056
1056
  const rightSecondWeek = rightPanel.querySelectorAll(`.${BASE_CLASS_PREFIX}-datepicker-week`)[1];
1057
1057
  const rightSecondWeekDays = rightSecondWeek.querySelectorAll(`.${BASE_CLASS_PREFIX}-datepicker-day`);
1058
1058
  leftSecondWeekDays[0].click();
1059
+ await sleep();
1059
1060
  rightSecondWeekDays[0].click();
1060
1061
 
1061
1062
  const baseElem = elem.find(BaseDatePicker);
@@ -0,0 +1,36 @@
1
+ import React, { useState, useCallback, useMemo } from 'react';
2
+ import { DatePicker, Button, Icon, Space } from '../../../index';
3
+
4
+ export default function Demo() {
5
+ const [date, setDate] = useState([]);
6
+ const onChange = useCallback(date => {
7
+ setDate(date);
8
+ console.log(date);
9
+ }, []);
10
+ const onClear = useCallback(e => {
11
+ e && e.stopPropagation();
12
+ setDate(null);
13
+ }, []);
14
+
15
+ const closeIcon = useMemo(() => (date ? <Icon type="close" onClick={onClear} /> : <Icon type="chevron_down" />), [date]);
16
+
17
+ return (
18
+ <Space>
19
+ <DatePicker
20
+ type="dateTimeRange"
21
+ onChange={onChange}
22
+ value={date}
23
+ triggerRender={({ placeholder }) => (
24
+ <Button theme={'light'} icon={closeIcon} iconPosition={'right'}>
25
+ {(date && String(date)) || placeholder}
26
+ </Button>
27
+ )}
28
+ />
29
+ <DatePicker
30
+ type="dateRange"
31
+ motion={false}
32
+ triggerRender={({ placeholder }) => <Button theme={'light'}>{placeholder}</Button>}
33
+ />
34
+ </Space>
35
+ );
36
+ }
@@ -8,3 +8,4 @@ export { default as InputFormat } from './InputFormat';
8
8
  export { default as InputFormatDisabled } from './InputFormatDisabled';
9
9
  export { default as AutoFillTime } from './AutoFillTime';
10
10
  export { default as InputFormatConfirm } from './InputFormatConfirm';
11
+ export { default as FixedTriggerRender } from './FixTriggerRender';
package/dist/css/semi.css CHANGED
@@ -3471,11 +3471,6 @@ body[theme-mode=dark], body .semi-always-dark {
3471
3471
  .semi-checkbox-inner-display .semi-icon {
3472
3472
  font-size: 16px;
3473
3473
  }
3474
- .semi-checkbox-inner-pureCardType {
3475
- opacity: 0;
3476
- width: 0;
3477
- margin-right: 0 !important;
3478
- }
3479
3474
  .semi-checkbox-inner-checked .semi-checkbox-inner-display {
3480
3475
  background: var(--semi-color-primary);
3481
3476
  color: var(--semi-color-white);
@@ -3534,6 +3529,11 @@ body[theme-mode=dark], body .semi-always-dark {
3534
3529
  .semi-checkbox-cardType .semi-checkbox-inner-display {
3535
3530
  background: var(--semi-color-white);
3536
3531
  }
3532
+ .semi-checkbox-cardType .semi-checkbox-inner-pureCardType {
3533
+ opacity: 0;
3534
+ width: 0;
3535
+ margin-right: 0;
3536
+ }
3537
3537
  .semi-checkbox-cardType .semi-checkbox-addon {
3538
3538
  font-weight: 600;
3539
3539
  font-size: 14px;
@@ -14257,9 +14257,8 @@ body[theme-mode=dark], body .semi-always-dark {
14257
14257
  font-size: 14px;
14258
14258
  line-height: 20px;
14259
14259
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
14260
- position: relative;
14261
14260
  display: inline-flex;
14262
- flex-wrap: wrap;
14261
+ column-gap: 8px;
14263
14262
  min-height: 20px;
14264
14263
  min-width: 16px;
14265
14264
  cursor: pointer;
@@ -14307,6 +14306,7 @@ body[theme-mode=dark], body .semi-always-dark {
14307
14306
  border-radius: var(--semi-border-radius-small);
14308
14307
  }
14309
14308
  .semi-radio-buttonRadioGroup {
14309
+ position: relative;
14310
14310
  padding: 4px;
14311
14311
  border-radius: var(--semi-border-radius-small);
14312
14312
  line-height: 16px;
@@ -14330,7 +14330,6 @@ body[theme-mode=dark], body .semi-always-dark {
14330
14330
  border: 1px solid transparent;
14331
14331
  }
14332
14332
  .semi-radio-cardRadioGroup .semi-radio-inner {
14333
- position: relative;
14334
14333
  margin-right: 8px;
14335
14334
  flex-shrink: 0;
14336
14335
  }
@@ -14400,19 +14399,18 @@ body[theme-mode=dark], body .semi-always-dark {
14400
14399
  border-color: var(--semi-color-primary-disabled);
14401
14400
  }
14402
14401
  .semi-radio-inner {
14403
- position: absolute;
14404
- display: inline-block;
14405
- top: 2px;
14406
- left: 0;
14402
+ display: inline-flex;
14403
+ margin-top: 2px;
14404
+ position: relative;
14407
14405
  width: 16px;
14408
14406
  height: 16px;
14409
14407
  vertical-align: sub;
14410
14408
  user-select: none;
14411
14409
  }
14412
14410
  .semi-radio-inner-display {
14413
- position: absolute;
14414
- left: 0;
14415
- top: 0;
14411
+ display: inline-flex;
14412
+ align-items: center;
14413
+ justify-content: center;
14416
14414
  box-sizing: border-box;
14417
14415
  width: 16px;
14418
14416
  height: 16px;
@@ -14421,11 +14419,14 @@ body[theme-mode=dark], body .semi-always-dark {
14421
14419
  background: transparent;
14422
14420
  }
14423
14421
  .semi-radio-inner-display .semi-icon {
14424
- position: absolute;
14425
14422
  width: 100%;
14426
14423
  height: 100%;
14427
14424
  font-size: 14px;
14428
14425
  }
14426
+ .semi-radio-content {
14427
+ display: flex;
14428
+ flex-direction: column;
14429
+ }
14429
14430
  .semi-radio:hover .semi-radio-inner-display {
14430
14431
  background: var(--semi-color-fill-0);
14431
14432
  }
@@ -14434,8 +14435,6 @@ body[theme-mode=dark], body .semi-always-dark {
14434
14435
  }
14435
14436
  .semi-radio-addon {
14436
14437
  user-select: none;
14437
- padding-left: 8px;
14438
- margin-left: 16px;
14439
14438
  color: var(--semi-color-text-0);
14440
14439
  display: inline-flex;
14441
14440
  align-items: center;
@@ -14524,11 +14523,7 @@ body[theme-mode=dark], body .semi-always-dark {
14524
14523
  color: var(--semi-color-disabled-text);
14525
14524
  }
14526
14525
  .semi-radio-extra {
14527
- flex-grow: 1;
14528
- flex-basis: 100%;
14529
- flex-shrink: 0;
14530
14526
  color: var(--semi-color-text-2);
14531
- padding-left: 24px;
14532
14527
  box-sizing: border-box;
14533
14528
  }
14534
14529
  .semi-radio-focus {
@@ -14543,25 +14538,20 @@ body[theme-mode=dark], body .semi-always-dark {
14543
14538
  line-height: 20px;
14544
14539
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
14545
14540
  }
14546
- .semi-radioGroup-vertical .semi-radio:last-of-type {
14547
- margin-bottom: 0;
14541
+ .semi-radioGroup-vertical {
14542
+ display: flex;
14543
+ flex-direction: column;
14544
+ row-gap: 12px;
14548
14545
  }
14549
14546
  .semi-radioGroup-vertical-default .semi-radio {
14550
- display: block;
14551
- margin-bottom: 12px;
14547
+ display: flex;
14552
14548
  }
14553
14549
  .semi-radioGroup-vertical-card .semi-radio {
14554
14550
  display: flex;
14555
- margin-bottom: 16px;
14556
- }
14557
- .semi-radioGroup-horizontal .semi-radio {
14558
- margin-right: 16px;
14559
- }
14560
- .semi-radioGroup-horizontal .semi-radio:last-of-type {
14561
- margin-right: 0;
14562
14551
  }
14563
- .semi-radioGroup-horizontal-default {
14564
- display: inline-block;
14552
+ .semi-radioGroup-horizontal {
14553
+ display: inline-flex;
14554
+ column-gap: 16px;
14565
14555
  }
14566
14556
  .semi-radioGroup-buttonRadio {
14567
14557
  display: inline-block;
@@ -14585,59 +14575,14 @@ body[theme-mode=dark], body .semi-always-dark {
14585
14575
  .semi-portal-rtl .semi-radio-buttonRadioGroup:not(:last-child) {
14586
14576
  padding-left: 0;
14587
14577
  }
14588
- .semi-rtl .semi-radio-inner,
14589
- .semi-portal-rtl .semi-radio-inner {
14590
- left: auto;
14591
- right: 0;
14592
- }
14593
- .semi-rtl .semi-radio-inner-display,
14594
- .semi-portal-rtl .semi-radio-inner-display {
14595
- left: auto;
14596
- right: 0;
14597
- }
14598
- .semi-rtl .semi-radio-addon,
14599
- .semi-portal-rtl .semi-radio-addon {
14600
- padding-left: 0;
14601
- margin-left: 0;
14602
- padding-right: 8px;
14603
- margin-right: 16px;
14604
- }
14605
14578
  .semi-rtl .semi-radio-addon-buttonRadio,
14606
14579
  .semi-portal-rtl .semi-radio-addon-buttonRadio {
14607
14580
  margin-right: 0;
14608
14581
  }
14609
- .semi-rtl .semi-radio-extra,
14610
- .semi-portal-rtl .semi-radio-extra {
14611
- padding-left: 0;
14612
- padding-right: 24px;
14613
- }
14614
- .semi-rtl-isCardRadioGroup .semi-radio-inner,
14615
- .semi-portal-rtl-isCardRadioGroup .semi-radio-inner {
14616
- margin-right: 0;
14617
- margin-left: 8px;
14618
- }
14619
- .semi-rtl-isCardRadioGroup .semi-radio-addon,
14620
- .semi-portal-rtl-isCardRadioGroup .semi-radio-addon {
14621
- margin-right: 0;
14622
- padding-right: 0;
14623
- }
14624
- .semi-rtl-isCardRadioGroup .semi-radio-extra,
14625
- .semi-portal-rtl-isCardRadioGroup .semi-radio-extra {
14626
- padding-right: 0;
14627
- }
14628
14582
  .semi-rtl .semi-radioGroup,
14629
14583
  .semi-portal-rtl .semi-radioGroup {
14630
14584
  direction: rtl;
14631
14585
  }
14632
- .semi-rtl .semi-radioGroup-horizontal .semi-radio,
14633
- .semi-portal-rtl .semi-radioGroup-horizontal .semi-radio {
14634
- margin-right: 0;
14635
- margin-left: 16px;
14636
- }
14637
- .semi-rtl .semi-radioGroup-horizontal .semi-radio:last-of-type,
14638
- .semi-portal-rtl .semi-radioGroup-horizontal .semi-radio:last-of-type {
14639
- margin-left: 0;
14640
- }
14641
14586
 
14642
14587
  .semi-rating {
14643
14588
  display: inline-block;