@douyinfe/semi-ui 2.10.0-beta.0 → 2.10.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.
Files changed (56) hide show
  1. package/button/buttonGroup.tsx +2 -2
  2. package/carousel/CarouselArrow.tsx +4 -4
  3. package/carousel/CarouselIndicator.tsx +0 -1
  4. package/carousel/index.tsx +1 -3
  5. package/carousel/interface.ts +1 -2
  6. package/checkbox/checkbox.tsx +1 -3
  7. package/checkbox/checkboxInner.tsx +19 -14
  8. package/datePicker/monthsGrid.tsx +8 -8
  9. package/dist/css/semi.css +5 -4
  10. package/dist/css/semi.min.css +1 -1
  11. package/dist/umd/semi-ui.js +711 -547
  12. package/dist/umd/semi-ui.js.map +1 -1
  13. package/dist/umd/semi-ui.min.js +1 -1
  14. package/dist/umd/semi-ui.min.js.map +1 -1
  15. package/form/baseForm.tsx +10 -2
  16. package/form/hoc/withField.tsx +17 -5
  17. package/inputNumber/__test__/inputNumber.test.js +40 -3
  18. package/inputNumber/_story/inputNumber.stories.js +56 -1
  19. package/inputNumber/index.tsx +22 -14
  20. package/lib/cjs/button/buttonGroup.d.ts +1 -1
  21. package/lib/cjs/carousel/CarouselArrow.js +3 -6
  22. package/lib/cjs/carousel/index.js +1 -3
  23. package/lib/cjs/carousel/interface.d.ts +1 -2
  24. package/lib/cjs/checkbox/checkbox.js +1 -2
  25. package/lib/cjs/checkbox/checkboxInner.js +21 -17
  26. package/lib/cjs/datePicker/monthsGrid.js +6 -6
  27. package/lib/cjs/form/baseForm.d.ts +1 -0
  28. package/lib/cjs/form/baseForm.js +10 -2
  29. package/lib/cjs/form/hoc/withField.js +8 -1
  30. package/lib/cjs/inputNumber/index.d.ts +2 -6
  31. package/lib/cjs/inputNumber/index.js +27 -11
  32. package/lib/cjs/tooltip/index.d.ts +1 -0
  33. package/lib/cjs/tooltip/index.js +9 -6
  34. package/lib/cjs/transfer/index.js +5 -5
  35. package/lib/cjs/treeSelect/index.js +1 -1
  36. package/lib/es/button/buttonGroup.d.ts +1 -1
  37. package/lib/es/carousel/CarouselArrow.js +3 -5
  38. package/lib/es/carousel/index.js +1 -3
  39. package/lib/es/carousel/interface.d.ts +1 -2
  40. package/lib/es/checkbox/checkbox.js +1 -2
  41. package/lib/es/checkbox/checkboxInner.js +20 -17
  42. package/lib/es/datePicker/monthsGrid.js +7 -7
  43. package/lib/es/form/baseForm.d.ts +1 -0
  44. package/lib/es/form/baseForm.js +10 -2
  45. package/lib/es/form/hoc/withField.js +8 -1
  46. package/lib/es/inputNumber/index.d.ts +2 -6
  47. package/lib/es/inputNumber/index.js +26 -11
  48. package/lib/es/tooltip/index.d.ts +1 -0
  49. package/lib/es/tooltip/index.js +9 -6
  50. package/lib/es/transfer/index.js +1 -1
  51. package/lib/es/treeSelect/index.js +1 -1
  52. package/package.json +9 -9
  53. package/popover/_story/popover.stories.js +38 -2
  54. package/tooltip/index.tsx +9 -2
  55. package/transfer/index.tsx +1 -1
  56. package/treeSelect/index.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.10.0-beta.0",
3
+ "version": "2.10.2-alpha.0",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -14,12 +14,12 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@babel/runtime-corejs3": "^7.15.4",
17
- "@douyinfe/semi-animation": "2.10.0-beta.0",
18
- "@douyinfe/semi-animation-react": "2.10.0-beta.0",
19
- "@douyinfe/semi-foundation": "2.10.0-beta.0",
20
- "@douyinfe/semi-icons": "2.10.0-beta.0",
21
- "@douyinfe/semi-illustrations": "2.10.0-beta.0",
22
- "@douyinfe/semi-theme-default": "2.10.0-beta.0",
17
+ "@douyinfe/semi-animation": "2.10.1",
18
+ "@douyinfe/semi-animation-react": "2.10.2-alpha.0",
19
+ "@douyinfe/semi-foundation": "2.10.1",
20
+ "@douyinfe/semi-icons": "2.10.1",
21
+ "@douyinfe/semi-illustrations": "2.10.1",
22
+ "@douyinfe/semi-theme-default": "2.10.1",
23
23
  "@types/react-window": "^1.8.2",
24
24
  "async-validator": "^3.5.0",
25
25
  "classnames": "^2.2.6",
@@ -69,13 +69,13 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "10c5eff42fe3144451fd73d9d542a710d165d456",
72
+ "gitHead": "0af26368c88d1654b57ca177c18ed1d92b1b8b61",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",
76
76
  "@babel/preset-env": "^7.15.8",
77
77
  "@babel/preset-react": "^7.14.5",
78
- "@douyinfe/semi-scss-compile": "2.10.0-beta.0",
78
+ "@douyinfe/semi-scss-compile": "2.10.1",
79
79
  "@storybook/addon-knobs": "^6.3.1",
80
80
  "@types/lodash": "^4.14.176",
81
81
  "babel-loader": "^8.2.2",
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
2
2
 
3
3
  import Popover from '../index';
4
4
  import { strings } from '@douyinfe/semi-foundation/tooltip/constants';
5
- import { Button, Input, Table, IconButton, Modal, Tag, Space } from '@douyinfe/semi-ui';
5
+ import { Button, Input, Table, IconButton, Modal, Tag, Space, Select } from '@douyinfe/semi-ui';
6
6
  import SelectInPopover from './SelectInPopover';
7
7
  import BtnClose from './BtnClose';
8
8
  import PopRight from './PopRight';
@@ -10,6 +10,8 @@ import NestedPopover from './NestedPopover';
10
10
  import ArrowPointAtCenter from './ArrowPointAtCenter';
11
11
  import { IconDelete } from '@douyinfe/semi-icons';
12
12
 
13
+ const Option = Select.Option;
14
+
13
15
  export default {
14
16
  title: 'Popover',
15
17
  parameters: {
@@ -645,4 +647,38 @@ export const A11yKeyboard = () => {
645
647
  </div>
646
648
  );
647
649
  };
648
- A11yKeyboard.storyName = "a11y keyboard and focus";
650
+ A11yKeyboard.storyName = "a11y keyboard and focus";
651
+
652
+ /**
653
+ * fix 嵌套 popover 的弹出层会导致外部 popover 关闭问题
654
+ *
655
+ * @see https://github.com/DouyinFE/semi-design/issues/818
656
+ * @see https://github.com/facebook/react/issues/4335#issuecomment-421705171
657
+ */
658
+ export const FixNestedPopover = () => {
659
+ return (
660
+ <div data-cy="fix-nested-popover" style={{ paddingLeft: 100 }}>
661
+ <Popover
662
+ content={(
663
+ <div data-cy="select-in-popover" style={{ padding: 20 }}>
664
+ <Select
665
+ defaultValue="abc"
666
+ style={{ width: 120 }}
667
+ >
668
+ <Option value="abc">抖音</Option>
669
+ <Option value="hotsoon">火山</Option>
670
+ <Option value="pipixia" disabled>
671
+ 皮皮虾
672
+ </Option>
673
+ <Option value="xigua">西瓜视频</Option>
674
+ </Select>
675
+ </div>
676
+ )}
677
+ trigger="click"
678
+ showArrow
679
+ >
680
+ <Tag>点击此处</Tag>
681
+ </Popover>
682
+ </div>
683
+ );
684
+ }
package/tooltip/index.tsx CHANGED
@@ -343,11 +343,11 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
343
343
  cb();
344
344
  }
345
345
  };
346
- document.addEventListener('mousedown', this.clickOutsideHandler, { capture: true });
346
+ window.addEventListener('mousedown', this.clickOutsideHandler);
347
347
  },
348
348
  unregisterClickOutsideHandler: () => {
349
349
  if (this.clickOutsideHandler) {
350
- document.removeEventListener('mousedown', this.clickOutsideHandler, { capture: true });
350
+ window.removeEventListener('mousedown', this.clickOutsideHandler);
351
351
  this.clickOutsideHandler = null;
352
352
  }
353
353
  },
@@ -528,6 +528,12 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
528
528
  }
529
529
  };
530
530
 
531
+ handlePortalMouseDown = (e: React.MouseEvent) => {
532
+ if (this.props.stopPropagation) {
533
+ stopPropagation(e);
534
+ }
535
+ }
536
+
531
537
  handlePortalInnerKeyDown = (e: React.KeyboardEvent) => {
532
538
  this.foundation.handleContainerKeydown(e);
533
539
  }
@@ -595,6 +601,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
595
601
  style={portalInnerStyle}
596
602
  ref={this.setContainerEl}
597
603
  onClick={this.handlePortalInnerClick}
604
+ onMouseDown={this.handlePortalMouseDown}
598
605
  onKeyDown={this.handlePortalInnerKeyDown}
599
606
  >
600
607
  {inner}
@@ -4,7 +4,7 @@ import { SortableContainer, SortableElement, SortableHandle } from 'react-sortab
4
4
  import PropTypes from 'prop-types';
5
5
  import { isEqual, noop, omit, isEmpty, isArray } from 'lodash';
6
6
  import TransferFoundation, { TransferAdapter, BasicDataItem, OnSortEndProps } from '@douyinfe/semi-foundation/transfer/foundation';
7
- import { _generateDataByType, _generateSelectedItems } from '@douyinfe/semi-foundation/transfer/transferUtlls';
7
+ import { _generateDataByType, _generateSelectedItems } from '@douyinfe/semi-foundation/transfer/transferUtils';
8
8
  import { cssClasses, strings } from '@douyinfe/semi-foundation/transfer/constants';
9
9
  import '@douyinfe/semi-foundation/transfer/transfer.scss';
10
10
  import BaseComponent from '../_base/baseComponent';
@@ -163,7 +163,7 @@ export interface TreeSelectState extends Omit<BasicTreeSelectInnerData, Override
163
163
  }
164
164
 
165
165
  const prefixcls = cssClasses.PREFIX;
166
- const prefixTree = cssClasses.PREFIXTREE;
166
+ const prefixTree = cssClasses.PREFIX_TREE;
167
167
 
168
168
  const key = 0;
169
169