tooltip.stories.jsx 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532
  1. import React, { useState, useMemo, PureComponent } from 'react';
  2. import Tooltip from '../index';
  3. import './story.scss';
  4. import {
  5. Tag,
  6. Icon,
  7. IconButton,
  8. Switch,
  9. Checkbox,
  10. Radio,
  11. Button,
  12. Select,
  13. InputNumber,
  14. Space,
  15. Popover,
  16. Input,
  17. RadioGroup,
  18. SideSheet,
  19. Dropdown,
  20. Popconfirm
  21. } from '@douyinfe/semi-ui';
  22. import InTableDemo from './InTable';
  23. import EdgeDemo from './Edge';
  24. import ScrollTooltip from './ScrollDemo';
  25. import DangerousHtml from './DangerousHtml';
  26. import ArrowPointAtCenter from './ArrowPointAtCenter';
  27. import CustomContainer from './CustomContainer';
  28. import ContainerPosition from './ContainerPosition';
  29. import { IconList, IconSidebar, IconEdit } from '@douyinfe/semi-icons';
  30. import {
  31. Right2Left, Right2LeftTop, Right2LeftBottom, Right2RightTop, Right2RightBottom,
  32. Left2Right, Left2RightTop, Left2RightBottom, Left2LeftTop, Left2LeftBottom,
  33. Top2Bottom, Top2BottomLeft, Top2BottomRight, Top2TopLeft, Top2TopRight,
  34. Bottom2Top, Bottom2TopLeft, Bottom2TopRight, Bottom2BottomLeft, Bottom2BottomRight,
  35. } from './AutoAdjustOverflow';
  36. export default {
  37. title: 'Tooltip',
  38. parameters: {
  39. chromatic: { disableSnapshot: true },
  40. },
  41. };
  42. function test(visible) {
  43. console.log('visible Change:' + visible);
  44. }
  45. const ScrollDemo = function ScrollDemo(props = {}) {
  46. const tops = [
  47. ['topLeft', 'TL'],
  48. ['top', 'Top'],
  49. ['topRight', 'TR'],
  50. ];
  51. const lefts = [
  52. ['leftTop', 'LT'],
  53. ['left', 'Left'],
  54. ['leftBottom', 'LB'],
  55. ];
  56. const rights = [
  57. ['rightTop', 'RT'],
  58. ['right', 'Right'],
  59. ['rightBottom', 'RB'],
  60. ];
  61. const bottoms = [
  62. ['bottomLeft', 'BL'],
  63. ['bottom', 'Bottom'],
  64. ['bottomRight', 'BR'],
  65. ];
  66. const { tagStyle, ...restProps } = props;
  67. return (
  68. <div
  69. style={{
  70. paddingLeft: 40,
  71. }}
  72. >
  73. <div
  74. style={{
  75. marginLeft: 40,
  76. whiteSpace: 'nowrap',
  77. }}
  78. >
  79. {tops.map((pos, index) => (
  80. <Tooltip
  81. content={
  82. <article>
  83. <p>hi bytedance</p>
  84. <p>hi bytedance</p>
  85. </article>
  86. }
  87. position={Array.isArray(pos) ? pos[0] : pos}
  88. key={index}
  89. trigger={'click'}
  90. {...restProps}
  91. >
  92. <Tag style={tagStyle}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
  93. </Tooltip>
  94. ))}
  95. </div>
  96. <div
  97. style={{
  98. width: 40,
  99. float: 'left',
  100. }}
  101. >
  102. {lefts.map((pos, index) => (
  103. <Tooltip
  104. content={
  105. <article>
  106. <p>hi bytedance</p>
  107. <p>hi bytedance</p>
  108. </article>
  109. }
  110. position={Array.isArray(pos) ? pos[0] : pos}
  111. key={index}
  112. trigger={'click'}
  113. {...restProps}
  114. >
  115. <Tag style={tagStyle}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
  116. </Tooltip>
  117. ))}
  118. </div>
  119. <div
  120. style={{
  121. width: 40,
  122. marginLeft: 180,
  123. }}
  124. >
  125. {rights.map((pos, index) => (
  126. <Tooltip
  127. content={
  128. <article>
  129. <p>hi bytedance</p>
  130. <p>hi bytedance</p>
  131. </article>
  132. }
  133. position={Array.isArray(pos) ? pos[0] : pos}
  134. key={index}
  135. trigger={'click'}
  136. {...restProps}
  137. >
  138. <Tag style={tagStyle}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
  139. </Tooltip>
  140. ))}
  141. </div>
  142. <div
  143. style={{
  144. marginLeft: 40,
  145. clear: 'both',
  146. whiteSpace: 'nowrap',
  147. }}
  148. >
  149. {bottoms.map((pos, index) => (
  150. <Tooltip
  151. content={
  152. <article>
  153. <p>hi bytedance</p>
  154. <p>hi bytedance</p>
  155. </article>
  156. }
  157. position={Array.isArray(pos) ? pos[0] : pos}
  158. key={index}
  159. trigger={'click'}
  160. {...restProps}
  161. >
  162. <Tag style={tagStyle}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
  163. </Tooltip>
  164. ))}
  165. </div>
  166. </div>
  167. );
  168. };
  169. export const TooltipOnVisibleChange = () => {
  170. const [visible, setVisible] = useState(true);
  171. return (
  172. <div className="demo">
  173. <div>
  174. <label>受控</label>
  175. <Tooltip
  176. content={
  177. <article>
  178. <p>hi bytedance</p>
  179. <p>hi bytedance</p>
  180. </article>
  181. }
  182. position="top"
  183. onVisibleChange={setVisible}
  184. trigger="click"
  185. visible={visible}
  186. >
  187. <Tag>demo</Tag>
  188. </Tooltip>
  189. </div>
  190. <br />
  191. <br />
  192. <div>
  193. <label>非受控</label>
  194. <Tooltip
  195. content={
  196. <article>
  197. <p>hi bytedance</p>
  198. <p>hi bytedance</p>
  199. </article>
  200. }
  201. position="leftTop"
  202. onVisibleChange={test}
  203. trigger="click"
  204. >
  205. <Tag>demo</Tag>
  206. </Tooltip>
  207. </div>
  208. <br />
  209. <br />
  210. {/* <Tooltip
  211. content={
  212. <article>
  213. <p>hi bytedance</p>
  214. <p>hi bytedance</p>
  215. </article>
  216. }
  217. position="rightBottom"
  218. onVisibleChange={test}
  219. trigger="hover"
  220. >
  221. <Tag>hover</Tag>
  222. </Tooltip>
  223. <br />
  224. <br />
  225. <Tooltip
  226. content={
  227. <article>
  228. <p>hi bytedance</p>
  229. <p>hi bytedance</p>
  230. </article>
  231. }
  232. mouseLeaveDelay={100}
  233. position="rightBottom"
  234. onVisibleChange={test}
  235. trigger="hover"
  236. >
  237. <Tag>hover with leave delay time</Tag>
  238. </Tooltip>
  239. <br />
  240. <br />
  241. <Tooltip
  242. content={
  243. <article>
  244. <p>hi bytedance</p>
  245. <p>hi bytedance</p>
  246. </article>
  247. }
  248. position="rightBottom"
  249. onVisibleChange={test}
  250. trigger="click"
  251. >
  252. <Tag>click</Tag>
  253. </Tooltip> */}
  254. </div>
  255. );
  256. };
  257. TooltipOnVisibleChange.story = {
  258. name: 'tooltip onVisibleChange',
  259. };
  260. export const GetPopupContainerDemo = () => (
  261. <div className="demo">
  262. <div className="content-layer" />
  263. <Tooltip
  264. content={
  265. <article>
  266. <p>hi bytedance</p> <p>hi bytedance</p>
  267. </article>
  268. }
  269. position="bottom"
  270. visible
  271. trigger="custom"
  272. getPopupContainer={() => document.querySelector('.content-layer')}
  273. >
  274. <Tag>指定弹出层的容器</Tag>
  275. {/* <div className='content'></div> */}
  276. </Tooltip>
  277. <div>
  278. <label>给定容器为window,看是否报错</label>
  279. <Tooltip content={'单选'} position="top" getPopupContainer={() => window}>
  280. <Radio style={{ display: 'inline-flex' }}>单选</Radio>
  281. </Tooltip>
  282. </div>
  283. </div>
  284. );
  285. GetPopupContainerDemo.story = {
  286. name: 'tooltip指定弹出层的容器',
  287. };
  288. export const TooltipAll = () => (
  289. <div className="demo">
  290. <ScrollDemo />
  291. <div
  292. style={{
  293. padding: 120,
  294. }}
  295. >
  296. <ScrollDemo
  297. showArrow
  298. tagStyle={{
  299. height: 80,
  300. }}
  301. />
  302. </div>
  303. </div>
  304. );
  305. TooltipAll.story = {
  306. name: 'tooltip All',
  307. };
  308. export const NoContent = () => (
  309. <div className="demo">
  310. <div
  311. style={{
  312. padding: 120,
  313. }}
  314. >
  315. <ScrollDemo showArrow content={''} />
  316. </div>
  317. <div
  318. style={{
  319. padding: 120,
  320. }}
  321. >
  322. <ScrollDemo
  323. showArrow
  324. tagStyle={{
  325. minHeight: 80,
  326. minWidth: 120,
  327. }}
  328. content={''}
  329. />
  330. </div>
  331. </div>
  332. );
  333. NoContent.story = {
  334. name: 'no content',
  335. };
  336. export const AdjustPosition = () => (
  337. <>
  338. <div className="adjust">
  339. <div className="wrapper">
  340. 第一个滚动区域
  341. <Tooltip
  342. content={
  343. <article>
  344. <p>hi bytedance</p>
  345. <p>hi bytedance</p>
  346. </article>
  347. }
  348. position="rightBottom"
  349. trigger="click"
  350. >
  351. {/* <Tag className='topLeft'>topleft</Tag> */}
  352. <div>test</div>
  353. </Tooltip>
  354. <Tooltip
  355. content={
  356. <article>
  357. <p>hi bytedance</p>
  358. <p>hi bytedance</p>
  359. </article>
  360. }
  361. position="topRight"
  362. trigger="click"
  363. >
  364. <Tag className="topRight">topRight</Tag>
  365. </Tooltip>
  366. <Tooltip
  367. content={
  368. <article>
  369. <p>hi bytedance</p>
  370. <p>hi bytedance</p>
  371. </article>
  372. }
  373. position="bottomLeft"
  374. trigger="click"
  375. >
  376. <Tag className="bottomLeft">bottomLeft</Tag>
  377. </Tooltip>
  378. <Tooltip
  379. content={
  380. <article>
  381. <p>hi bytedance</p>
  382. <p>hi bytedance</p>
  383. </article>
  384. }
  385. position="bottomRight"
  386. trigger="click"
  387. >
  388. <Tag className="bottomRight">bottomRight</Tag>
  389. </Tooltip>
  390. </div>
  391. </div>
  392. <div className="adjust2">
  393. <div className="wrapper2">第二个滚动区域</div>
  394. </div>
  395. </>
  396. );
  397. AdjustPosition.story = {
  398. name: '自适应',
  399. };
  400. export const AdjustPosIfNeed = () => {
  401. const tops = [
  402. ['topLeft', 'TL'],
  403. ['top', 'Top'],
  404. ['topRight', 'TR'],
  405. ];
  406. const lefts = [
  407. ['leftTop', 'LT'],
  408. ['left', 'Left'],
  409. ['leftBottom', 'LB'],
  410. ];
  411. const rights = [
  412. ['rightTop', 'RT'],
  413. ['right', 'Right'],
  414. ['rightBottom', 'RB'],
  415. ];
  416. const bottoms = [
  417. ['bottomLeft', 'BL'],
  418. ['bottom', 'Bottom'],
  419. ['bottomRight', 'BR'],
  420. ];
  421. return (
  422. <div style={{ paddingLeft: 40 }}>
  423. <div style={{ marginLeft: 40, whiteSpace: 'nowrap' }}>
  424. {tops.map((pos, index) => (
  425. <Tooltip
  426. showArrow
  427. arrowPointAtCenter
  428. content={
  429. <article>
  430. Hi ByteDancer, this is a tooltip.
  431. <br /> We have 2 lines.
  432. </article>
  433. }
  434. position={Array.isArray(pos) ? pos[0] : pos}
  435. key={index}
  436. >
  437. <Tag
  438. style={{ marginRight: '8px' }}
  439. data-cy={Array.isArray(pos) ? pos[0] : pos}
  440. >
  441. {Array.isArray(pos) ? pos[1] : pos}
  442. </Tag>
  443. </Tooltip>
  444. ))}
  445. </div>
  446. <div style={{ width: 40, float: 'left' }}>
  447. {lefts.map((pos, index) => (
  448. <Tooltip
  449. showArrow
  450. arrowPointAtCenter
  451. content={
  452. <article>
  453. Hi ByteDancer, this is a tooltip.
  454. <br /> We have 2 lines.
  455. </article>
  456. }
  457. position={Array.isArray(pos) ? pos[0] : pos}
  458. key={index}
  459. >
  460. <Tag data-cy={Array.isArray(pos) ? pos[0] : pos} style={{ marginBottom: '8px' }}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
  461. </Tooltip>
  462. ))}
  463. </div>
  464. <div style={{ width: 40, marginLeft: 180 }}>
  465. {rights.map((pos, index) => (
  466. <Tooltip
  467. showArrow
  468. arrowPointAtCenter
  469. content={
  470. <article>
  471. Hi ByteDancer, this is a tooltip.
  472. <br /> We have 2 lines.
  473. </article>
  474. }
  475. position={Array.isArray(pos) ? pos[0] : pos}
  476. key={index}
  477. >
  478. <Tag data-cy={Array.isArray(pos) ? pos[0] : pos} style={{ marginBottom: '8px' }}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
  479. </Tooltip>
  480. ))}
  481. </div>
  482. <div style={{ marginLeft: 40, clear: 'both', whiteSpace: 'nowrap' }}>
  483. {bottoms.map((pos, index) => (
  484. <Tooltip
  485. showArrow
  486. arrowPointAtCenter
  487. content={
  488. <article>
  489. Hi ByteDancer, this is a tooltip.
  490. <br /> We have 2 lines.
  491. </article>
  492. }
  493. position={Array.isArray(pos) ? pos[0] : pos}
  494. key={index}
  495. >
  496. <Tag data-cy={Array.isArray(pos) ? pos[0] : pos} position={Array.isArray(pos) ? pos[0] : pos} style={{ marginRight: '8px' }}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
  497. </Tooltip>
  498. ))}
  499. </div>
  500. </div>
  501. );
  502. }
  503. AdjustPosIfNeed.story = {
  504. name: '自适应位置',
  505. };
  506. export const CompositeComponent = () => (
  507. <div
  508. style={{
  509. padding: 50,
  510. }}
  511. >
  512. <Tooltip
  513. content={
  514. <article>
  515. <p>hi bytedance</p> <p>hi bytedance</p>
  516. </article>
  517. }
  518. position="top"
  519. >
  520. <IconList />
  521. </Tooltip>
  522. <Tooltip content={'收起'} position="top">
  523. <IconButton icon={<IconSidebar />} />
  524. </Tooltip>
  525. <Tooltip content={'开关'} position="top">
  526. <Switch />
  527. </Tooltip>
  528. <Tooltip content={'选择框'} position="top">
  529. <Checkbox
  530. style={{
  531. display: 'inline-flex',
  532. }}
  533. >
  534. 选择框
  535. </Checkbox>
  536. </Tooltip>
  537. <Tooltip content={'单选'} position="top">
  538. <Radio
  539. style={{
  540. display: 'inline-flex',
  541. }}
  542. >
  543. 单选
  544. </Radio>
  545. </Tooltip>
  546. </div>
  547. );
  548. CompositeComponent.story = {
  549. name: '复合组件',
  550. };
  551. export const WrapDisabledElems = () => (
  552. <div
  553. style={{
  554. padding: 50,
  555. }}
  556. >
  557. <Tooltip content="disabled">
  558. <IconButton disabled icon={<IconEdit />} />
  559. </Tooltip>
  560. <Tooltip content="disabled">
  561. <IconButton disabled icon={<IconEdit />} block />
  562. </Tooltip>
  563. <Tooltip content="disabled">
  564. <Button disabled block>
  565. 编辑
  566. </Button>
  567. </Tooltip>
  568. <Tooltip content="disabled">
  569. <Button
  570. disabled
  571. style={{
  572. display: 'block',
  573. }}
  574. >
  575. 编辑
  576. </Button>
  577. </Tooltip>
  578. </div>
  579. );
  580. WrapDisabledElems.story = {
  581. name: 'wrap disabled elems',
  582. };
  583. export const InTable = () => (
  584. <div
  585. style={{
  586. marginTop: 50,
  587. }}
  588. >
  589. <InTableDemo />
  590. </div>
  591. );
  592. InTable.story = {
  593. name: 'in table',
  594. };
  595. export const _EdgeDemo = () => <EdgeDemo />;
  596. _EdgeDemo.story = {
  597. name: 'edge demo',
  598. };
  599. export const ScrollTooltipDemo = () => <ScrollTooltip />;
  600. ScrollTooltipDemo.story = {
  601. name: 'scroll demo and set popup container',
  602. };
  603. export const DangerousHtmlDemo = () => <DangerousHtml />;
  604. DangerousHtmlDemo.story = {
  605. name: 'in dangerous html',
  606. };
  607. export const ArrowPointAtCenterDemo = () => <ArrowPointAtCenter />;
  608. ArrowPointAtCenterDemo.story = {
  609. name: 'arrow point at center',
  610. };
  611. export const CustomContainerDemo = () => <CustomContainer />;
  612. CustomContainerDemo.story = {
  613. name: 'custom container',
  614. };
  615. export const ContainerPositionDemo = () => <ContainerPosition />;
  616. ContainerPositionDemo.story = {
  617. name: 'container observer',
  618. };
  619. export const QuickMoveMouse = () => {
  620. /**
  621. * mouseEnterDelay, mouseLeaveDelay 默认都为 50
  622. * mouseEnterDelay, mouseLeaveDelay 都为 0,快速滑动可能出现两个 tooltip 出现
  623. */
  624. const Demo = () => {
  625. const props = {
  626. mouseEnterDelay: 50,
  627. mouseLeaveDelay: 0,
  628. };
  629. return (
  630. <div className="demo">
  631. <div>
  632. <Tooltip content={'1'} {...props}>
  633. aaaaaaaaaaa
  634. </Tooltip>
  635. </div>
  636. <div>
  637. <Tooltip content={'2'} {...props}>
  638. bbbbbbbbbbb
  639. </Tooltip>
  640. </div>
  641. <div>
  642. <Tooltip content={'3'} {...props}>
  643. ccccccccccc
  644. </Tooltip>
  645. </div>
  646. <div>
  647. <Tooltip content={'4'} {...props}>
  648. aaaaaaaaaaa
  649. </Tooltip>
  650. </div>
  651. <div>
  652. <Tooltip content={'5'} {...props}>
  653. bbbbbbbbbbb
  654. </Tooltip>
  655. </div>
  656. <div>
  657. <Tooltip content={'6'} {...props}>
  658. ccccccccccc
  659. </Tooltip>
  660. </div>
  661. <div>
  662. <Tooltip content={'7'} {...props}>
  663. aaaaaaaaaaa
  664. </Tooltip>
  665. </div>
  666. <div>
  667. <Tooltip content={'8'} {...props}>
  668. bbbbbbbbbbb
  669. </Tooltip>
  670. </div>
  671. <div>
  672. <Tooltip content={'9'} {...props}>
  673. ccccccccccc
  674. </Tooltip>
  675. </div>
  676. </div>
  677. );
  678. };
  679. return <Demo />;
  680. };
  681. QuickMoveMouse.story = {
  682. name: '快速移动鼠标可见性',
  683. };
  684. export const MotionFalseFix1402 = () => {
  685. function Demo() {
  686. const Test = React.forwardRef((props, ref) => (
  687. <span {...props} ref={ref}>
  688. Test
  689. </span>
  690. ));
  691. return (
  692. <div>
  693. <Tooltip content={'hi bytedance'} motion={false}>
  694. <Test />
  695. </Tooltip>
  696. <br />
  697. <br />
  698. <Tooltip content={'hi bytedance'}>
  699. <Test />
  700. </Tooltip>
  701. </div>
  702. );
  703. }
  704. return <Demo />;
  705. };
  706. MotionFalseFix1402.story = {
  707. name: 'motion=false fix #1402',
  708. };
  709. export const DisabledWrapperCls = () => (
  710. <>
  711. <Tooltip wrapperClassName="test" content={'hi bytedance'}>
  712. <Button>按钮</Button>
  713. </Tooltip>
  714. <br />
  715. <br />
  716. <Tooltip wrapperClassName="test" content={'hi bytedance'}>
  717. <Button disabled>禁用的单个按钮</Button>
  718. </Tooltip>
  719. <br />
  720. <br />
  721. <Tooltip wrapperClassName="test" content={'hi bytedance'}>
  722. <Button>正常的多个按钮</Button>
  723. <Button>正常的多个按钮</Button>
  724. </Tooltip>
  725. <br />
  726. <br />
  727. <Tooltip wrapperClassName="test" content={'hi bytedance'}>
  728. <Select disabled placeholder="请选择业务线" style={{ width: 120 }}>
  729. <Select.Option value="abc">抖音</Select.Option>
  730. <Select.Option value="hotsoon">火山</Select.Option>
  731. <Select.Option value="jianying" disabled>
  732. 剪映
  733. </Select.Option>
  734. <Select.Option value="xigua">西瓜视频</Select.Option>
  735. </Select>
  736. </Tooltip>
  737. <br />
  738. <br />
  739. </>
  740. );
  741. DisabledWrapperCls.story = {
  742. name: 'disabledWrapperCls',
  743. };
  744. export const ShowArrow = () => {
  745. function Demo() {
  746. const Test = React.forwardRef((props, ref) => (
  747. <Tag {...props} ref={ref}>
  748. Test
  749. </Tag>
  750. ));
  751. return (
  752. <div>
  753. <h4>should show content and arrow when click</h4>
  754. <Tooltip showArrow trigger="click" content={'hi bytedance'}>
  755. <Test />
  756. </Tooltip>
  757. </div>
  758. );
  759. }
  760. return <Demo />;
  761. };
  762. ShowArrow.story = {
  763. name: 'showArrow',
  764. };
  765. export const OnClickOutSideDemo = () => {
  766. let [v, setV] = useState(false);
  767. let clickOutSide = () => {
  768. console.log('clickOutSide');
  769. setV(false);
  770. };
  771. return (
  772. <>
  773. <Tooltip onClickOutSide={() => clickOutSide()} content={'hi bytedance'} visible={v} trigger="custom">
  774. <Button onClick={() => setV(true)}>按钮</Button>
  775. </Tooltip>
  776. <br />
  777. <br />
  778. <Tooltip onClickOutSide={() => console.log('clickOutSide')} content={'hi bytedance'} trigger="click">
  779. <Button>单个按钮</Button>
  780. </Tooltip>
  781. </>
  782. );
  783. };
  784. OnClickOutSideDemo.story = {
  785. name: 'OnClickOutSide',
  786. };
  787. export const AutoAdjustWithSpacing = () => {
  788. const [height, setHeight] = useState(84);
  789. const [key, setKey] = useState(1);
  790. const initSpacing = 8;
  791. const [spacing, setSpacing] = useState(initSpacing);
  792. const change = (height, hasSpace) => {
  793. setHeight(height);
  794. hasSpace ? setSpacing(initSpacing) : setSpacing(0);
  795. setKey(Math.random());
  796. };
  797. return (
  798. <div className="demo1">
  799. <div>
  800. <Tooltip
  801. motion={false}
  802. rePosKey={key}
  803. // spacing={spacing}
  804. content={
  805. <article style={{ boxSizing: 'border-box', height: height }}>
  806. <p>hi bytedance, + padding 20</p>
  807. <p>hi bytedance</p>
  808. </article>
  809. }
  810. position="top"
  811. trigger="custom"
  812. visible={true}
  813. >
  814. <Tag>demo</Tag>
  815. </Tooltip>
  816. </div>
  817. <div style={{ marginTop: 200 }}>
  818. <Switch
  819. onChange={hasSpace => change(height, hasSpace)}
  820. checked={spacing === initSpacing ? true : false}
  821. ></Switch>
  822. <InputNumber onChange={height => change(Number(height))} value={height} style={{ width: 200 }} />
  823. </div>
  824. </div>
  825. );
  826. };
  827. AutoAdjustWithSpacing.story = {
  828. name: 'AutoAdjustWithSpacing',
  829. };
  830. /**
  831. * Chromatic UI test
  832. */
  833. export const leftTopOverDemo = () => {
  834. const [visible, setVisible] = useState(true);
  835. const content = <div style={{ height: 200, width: 200 }}>Semi Design</div>;
  836. const commonProps = {
  837. content,
  838. showArrow: false,
  839. visible:true,
  840. trigger: 'custom',
  841. motion: false,
  842. };
  843. const buttonStyle = {
  844. width: 200,
  845. };
  846. return (
  847. <div data-cy="wrapper">
  848. <Button onClick={() => setVisible(!visible)} data-cy="toggleVisible">toggle visible</Button>
  849. <div style={{ paddingTop: 110 }}>
  850. <Space spacing={80}>
  851. <Tooltip {...commonProps} position="leftBottomOver" trigger="click">
  852. <Button data-cy="leftBottomOver" style={buttonStyle}>
  853. leftBottomOver
  854. </Button>
  855. </Tooltip>
  856. <Tooltip {...commonProps} position="rightBottomOver" trigger="click">
  857. <Button data-cy="rightBottomOver" style={buttonStyle}>
  858. rightBottomOver
  859. </Button>
  860. </Tooltip>
  861. </Space>
  862. </div>
  863. <Space spacing={80}>
  864. <Tooltip {...commonProps} position="leftTopOver" trigger="click">
  865. <Button data-cy="leftTopOver" style={buttonStyle}>
  866. leftTopOver
  867. </Button>
  868. </Tooltip>
  869. <Tooltip {...commonProps} position="rightTopOver" trigger="click">
  870. <Button data-cy="rightTopOver" style={buttonStyle}>
  871. rightTopOver
  872. </Button>
  873. </Tooltip>
  874. </Space>
  875. </div>
  876. );
  877. };
  878. leftTopOverDemo.storyName = `leftTopOver visible`;
  879. leftTopOverDemo.parameters = {
  880. chromatic: {
  881. disableSnapshot: false,
  882. delay: 3000,
  883. viewports: [1200],
  884. },
  885. };
  886. /**
  887. * Cypress test
  888. */
  889. export const leftTopOverAutoAdjustOverflow = () => {
  890. const content = <div style={{ height: 200, width: 200 }}>Semi Design</div>;
  891. const commonProps = {
  892. content,
  893. trigger: 'click',
  894. showArrow: false,
  895. };
  896. return (
  897. <div
  898. data-cy="wrapper"
  899. style={{ width: '200vw', height: '200vw', display: 'flex', alignItems: 'center', justifyContent: 'center' }}
  900. >
  901. <div>
  902. <Tooltip {...commonProps} position="leftTopOver">
  903. <Button data-cy="leftTopOver" style={{ width: 200 }}>
  904. leftTopOver
  905. </Button>
  906. </Tooltip>
  907. </div>
  908. </div>
  909. );
  910. };
  911. leftTopOverAutoAdjustOverflow.storyName = `leftTopOver autoAdjustOverflow`;
  912. export const autoFocusContentDemo = () => {
  913. const [controlMotionVisible, setControlMotionVisible] = React.useState(false);
  914. const [controlNoMotionVisible, setControlNoMotionVisible] = React.useState(false);
  915. const onMotionVisibleChange = React.useCallback(() => {
  916. setControlMotionVisible(!controlMotionVisible);
  917. }, [setControlMotionVisible, controlMotionVisible]);
  918. const onNoMotionVisibleChange = React.useCallback(() => {
  919. setControlNoMotionVisible(!controlNoMotionVisible);
  920. }, [setControlNoMotionVisible, controlNoMotionVisible]);
  921. return (
  922. <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
  923. <div style={{ display: 'flex', gap: 18, flex: 1, alignItems: 'center' }}>
  924. <span>Hover触发</span>
  925. <Popover position="bottomLeft" content={<Input autofocus data-cy="hoverInput"/>}>
  926. <Button data-cy="hover">motion</Button>
  927. </Popover>
  928. <Popover motion={false} position="bottomLeft" content={<Input autofocus data-cy="hoverNoMotionInput"/>}>
  929. <Button data-cy="hoverNoMotion">no motion</Button>
  930. </Popover>
  931. </div>
  932. <div style={{ display: 'flex', gap: 18, flex: 1, alignItems: 'center' }}>
  933. <span>Click触发</span>
  934. <Popover position="bottomLeft" content={<Input autofocus data-cy="clickInput"/>} trigger="click">
  935. <Button data-cy="click">motion</Button>
  936. </Popover>
  937. <Popover motion={false} position="bottomLeft" content={<Input autofocus data-cy="clickNoMotionInput"/>} trigger="click">
  938. <Button data-cy="clickNoMotion">no motion</Button>
  939. </Popover>
  940. </div>
  941. <div style={{ display: 'flex', gap: 18, flex: 1, alignItems: 'center' }}>
  942. <span>受控</span>
  943. <Button onClick={onMotionVisibleChange} data-cy="controlled">motion状态切换</Button>
  944. <Popover visible={controlMotionVisible} trigger="custom" position="bottomLeft" content={<Input autofocus data-cy="controlledInput"/>}>
  945. <Button disabled data-cy="controlledDisableBtn">motion</Button>
  946. </Popover>
  947. <Button onClick={onNoMotionVisibleChange } data-cy="controlledNoMotion">no motion状态切换</Button>
  948. <Popover
  949. visible={controlNoMotionVisible}
  950. trigger="custom"
  951. motion={false}
  952. position="bottomLeft"
  953. content={<Input autofocus data-cy="controlledNoMotionInput"/>}
  954. >
  955. <Button disabled data-cy="controlledNoMotionDisableBtn">no motion</Button>
  956. </Popover>
  957. </div>
  958. </div>
  959. );
  960. };
  961. export const FlashWithReact18 = () => {
  962. const [visible, setV] = useState(false);
  963. const change = () => {
  964. setV(false);
  965. }
  966. return (<>
  967. <Tooltip content='test work with react 18' position='bottom' trigger='custom' visible={visible}>
  968. <Button style={{ marginLeft: 10 }} onClick={() => setV(true)}>show, semi with react 18 motion=true, abnormal</Button>
  969. </Tooltip>
  970. <Button style={{ marginLeft: 10 }} onClick={() => change()}>hide</Button>
  971. </>);
  972. }
  973. export const Transition = () => {
  974. const [transitionState, setT] = useState('');
  975. const [insert, setInsert] = useState(false);
  976. const handleLeave = () => {
  977. console.log('set insert false')
  978. setInsert(false);
  979. }
  980. const CommonDOM = () => {
  981. const enterCls = `semi-tooltip-bounceIn`;
  982. const leaveCls = `semi-tooltip-zoomOut`;
  983. const animateStyle = {
  984. animationDirection: 'normal',
  985. animationName: transitionState === 'enter' ? enterCls : leaveCls,
  986. animationDuration: '1000ms',
  987. }
  988. const handleEnd = () => {
  989. if (transitionState === 'enter') {
  990. console.log('animation end of show');
  991. } else if (transitionState === 'leave') {
  992. console.log('animation end of hide');
  993. handleLeave();
  994. }
  995. }
  996. return <div style={{ ...animateStyle }} onAnimationEnd={handleEnd}>test</div>
  997. };
  998. const toggleShow = (insert) => {
  999. if (!transitionState) {
  1000. setT('enter');
  1001. setInsert(insert);
  1002. } else if (transitionState === 'enter') {
  1003. setT('leave');
  1004. } else if (transitionState === 'leave') {
  1005. setT('enter');
  1006. setInsert(insert);
  1007. }
  1008. };
  1009. return (
  1010. <>
  1011. <div style={{ width: 200, height: 90, border: '1px solid var(--semi-color-text-1)' }}>
  1012. {
  1013. insert ? (
  1014. <CommonDOM></CommonDOM>
  1015. ): null
  1016. }
  1017. </div>
  1018. <Button onClick={() => toggleShow(true)}>show</Button>
  1019. <Button onClick={() => toggleShow(false)}>hide</Button>
  1020. </>
  1021. )
  1022. }
  1023. export const TransitionDemo = () => {
  1024. const [key, setKey] = useState(1);
  1025. return (
  1026. <>
  1027. <Transition key={key} />
  1028. <Button onClick={() => setKey(Math.random())}>reset Demo</Button>
  1029. </>
  1030. )
  1031. }
  1032. export const AdjustPosIfNeedTBLR = () => {
  1033. const content = <article>
  1034. Hi ByteDancer, this is a tooltip.
  1035. <br /> We have 2 lines.
  1036. </article>
  1037. const contentHigh = <article>
  1038. Hi ByteDancer, this is a tooltip.
  1039. <br /> We have 2 lines.
  1040. <br /> We have 2 lines.
  1041. </article>
  1042. return (
  1043. <div style={{ paddingLeft: 0, width: 800, height: '100%' }}>
  1044. <Tooltip
  1045. showArrow
  1046. arrowPointAtCenter
  1047. content={content}
  1048. position={'top'}
  1049. >
  1050. <Tag style={{ position: 'absolute', left: 20, top: 40 }}>top to bottomLeft</Tag>
  1051. </Tooltip>
  1052. <Tooltip
  1053. showArrow
  1054. arrowPointAtCenter
  1055. content={content}
  1056. position={'top'}
  1057. >
  1058. <Tag style={{ position: 'absolute', right: 20, top: 40 }}>top to bottomRight</Tag>
  1059. </Tooltip>
  1060. <Tooltip
  1061. showArrow
  1062. arrowPointAtCenter
  1063. content={content}
  1064. position={'top'}
  1065. >
  1066. <Tag style={{ position: 'absolute', left: 20, top: 70 }}>top to topLeft</Tag>
  1067. </Tooltip>
  1068. <Tooltip
  1069. showArrow
  1070. arrowPointAtCenter
  1071. content={content}
  1072. position={'top'}
  1073. >
  1074. <Tag style={{ position: 'absolute', right: 20, top: 70 }}>top to topRight</Tag>
  1075. </Tooltip>
  1076. <Tooltip
  1077. showArrow
  1078. arrowPointAtCenter
  1079. content={content}
  1080. position={'bottom'}
  1081. >
  1082. <Tag data-cy={'bottom'} style={{ position: 'absolute', left: 20, bottom: 70 }}>bottom to bottomLeft</Tag>
  1083. </Tooltip>
  1084. <Tooltip
  1085. showArrow
  1086. arrowPointAtCenter
  1087. content={content}
  1088. position={'bottom'}
  1089. >
  1090. <Tag data-cy={'bottom'} style={{ position: 'absolute', right: 20, bottom: 70 }}>bottom to bottomRight</Tag>
  1091. </Tooltip>
  1092. <Tooltip
  1093. showArrow
  1094. arrowPointAtCenter
  1095. content={content}
  1096. position={'bottom'}
  1097. >
  1098. <Tag data-cy={'bottom'} style={{ position: 'absolute', left: 20, bottom: 40 }}>bottom to topLeft</Tag>
  1099. </Tooltip>
  1100. <Tooltip
  1101. showArrow
  1102. arrowPointAtCenter
  1103. content={content}
  1104. position={'bottom'}
  1105. >
  1106. <Tag data-cy={'bottom'} style={{ position: 'absolute', right: 20, bottom: 40 }}>bottom to topRight</Tag>
  1107. </Tooltip>
  1108. <Tooltip
  1109. showArrow
  1110. arrowPointAtCenter
  1111. content={contentHigh}
  1112. position={'left'}
  1113. >
  1114. <Tag style={{ position: 'absolute', left: 300, top: 20 }}>left to leftTop</Tag>
  1115. </Tooltip>
  1116. <Tooltip
  1117. showArrow
  1118. arrowPointAtCenter
  1119. content={contentHigh}
  1120. position={'left'}
  1121. >
  1122. <Tag style={{ position: 'absolute', left: 300, bottom: 20 }}>left to leftBottom</Tag>
  1123. </Tooltip>
  1124. <Tooltip
  1125. showArrow
  1126. arrowPointAtCenter
  1127. content={contentHigh}
  1128. position={'left'}
  1129. >
  1130. <Tag style={{ position: 'absolute', left: 180, top: 20 }}>left to rightTop</Tag>
  1131. </Tooltip>
  1132. <Tooltip
  1133. showArrow
  1134. arrowPointAtCenter
  1135. content={contentHigh}
  1136. position={'left'}
  1137. >
  1138. <Tag style={{ position: 'absolute', left: 180, bottom: 20 }}>left to rightBottom</Tag>
  1139. </Tooltip>
  1140. <Tooltip
  1141. showArrow
  1142. arrowPointAtCenter
  1143. content={contentHigh}
  1144. position={'right'}
  1145. >
  1146. <Tag style={{ position: 'absolute', right: 300, top: 20 }}>right to rightTop</Tag>
  1147. </Tooltip>
  1148. <Tooltip
  1149. showArrow
  1150. arrowPointAtCenter
  1151. content={contentHigh}
  1152. position={'right'}
  1153. >
  1154. <Tag style={{ position: 'absolute', right: 300, bottom: 20 }}>right to rightBottom</Tag>
  1155. </Tooltip>
  1156. <Tooltip
  1157. showArrow
  1158. arrowPointAtCenter
  1159. content={contentHigh}
  1160. position={'right'}
  1161. >
  1162. <Tag style={{ position: 'absolute', right: 180, top: 20 }}>right to leftTop</Tag>
  1163. </Tooltip>
  1164. <Tooltip
  1165. showArrow
  1166. arrowPointAtCenter
  1167. content={contentHigh}
  1168. position={'right'}
  1169. >
  1170. <Tag style={{ position: 'absolute', right: 180, bottom: 20 }}>right to leftBottom</Tag>
  1171. </Tooltip>
  1172. <Tooltip
  1173. showArrow
  1174. arrowPointAtCenter
  1175. content={contentHigh}
  1176. position={'rightTop'}
  1177. >
  1178. <Tag style={{ position: 'absolute', right: 180, bottom: 50 }}>right to leftBottom</Tag>
  1179. </Tooltip>
  1180. </div>
  1181. );
  1182. }
  1183. export const marginDemo = () => {
  1184. const [visible, setVisible] = useState(false);
  1185. const change = () => {
  1186. setVisible(!visible);
  1187. };
  1188. return (
  1189. <>
  1190. <Button onClick={change}>Open SideSheet</Button>
  1191. <SideSheet title="滑动侧边栏" visible={visible} onCancel={change}>
  1192. <div style={{ height: '800px', overflow: 'scroll' }}>
  1193. <div
  1194. id='test'
  1195. style={{
  1196. height: '880px',
  1197. display: 'flex',
  1198. flexDirection: 'column-reverse',
  1199. position: 'relative'
  1200. }}
  1201. >
  1202. <Tooltip
  1203. getPopupContainer={() => document.querySelector('#test')}
  1204. content='cecece'
  1205. position='bottom'
  1206. margin={{ marginTop: 0, marginLeft: 0, marginBottom: 36, marginRight: 0 }}
  1207. >
  1208. <div style={{ marginBottom: 20 }}>
  1209. test
  1210. </div>
  1211. </Tooltip>
  1212. </div>
  1213. </div>
  1214. <footer style={{
  1215. position: 'sticky',
  1216. bottom: 0,
  1217. height: 36,
  1218. border: '1px solid pink'
  1219. }}>
  1220. i am footer
  1221. </footer>
  1222. </SideSheet>
  1223. </>
  1224. );
  1225. };
  1226. export const SmartPosAdjustDemo = () => {
  1227. const [pos, setPosition] = useState('top');
  1228. const onChange = (e) => {
  1229. setPosition(e.target.value);
  1230. };
  1231. return (
  1232. <div style={{ width: 800, height: 800 }}>
  1233. <Popover
  1234. position={pos}
  1235. showArrow={true}
  1236. content={
  1237. <div style={{ minWidth: 900, height: 900, backgroundColor: 'lightblue' }}>
  1238. <article>
  1239. <p>hi semi! hi semi! hi semi!hi semi! hi semi</p>
  1240. <p>hi semi! hi semi! hi semi!hi semi! hi semi</p>
  1241. <p>hi semi! hi semi! hi semi!</p>
  1242. </article>
  1243. </div>
  1244. }
  1245. >
  1246. <Tag style={{ marginLeft: 450, marginTop: 550 }}>悬停此处</Tag>
  1247. </Popover>
  1248. <div style={{ marginLeft: 250, width: 300 }}>
  1249. <RadioGroup onChange={onChange} value={pos} aria-label="position" name="position">
  1250. <Radio value={'topLeft'}>TL </Radio>
  1251. <Radio value={'top'}>top </Radio>
  1252. <Radio value={'topRight'}>TR </Radio>
  1253. <Radio value={'bottomLeft'}>BL</Radio>
  1254. <Radio value={'bottom'}>Bottom</Radio>
  1255. <Radio value={'bottomRight'}>BR</Radio>
  1256. <Radio value={'leftTop'}>LT</Radio>
  1257. <Radio value={'left'}>Left</Radio>
  1258. <Radio value={'leftBottom'}>LB</Radio>
  1259. <Radio value={'rightTop'}>RT</Radio>
  1260. <Radio value={'right'}>Right</Radio>
  1261. <Radio value={'rightBottom'}>RB</Radio>
  1262. </RadioGroup>
  1263. </div>
  1264. </div>
  1265. )
  1266. }
  1267. export const OcclusionDemo = () => {
  1268. return (
  1269. <div>
  1270. <Tooltip
  1271. position='left'
  1272. content={
  1273. <div
  1274. style={{
  1275. width: 520,
  1276. height: 360
  1277. }}
  1278. >
  1279. 我的上侧被遮挡啦!但是我可以正常显示! 我的上侧被遮挡啦!但是我可以正常显示!我的上侧被遮挡啦!但是我可以正常显示!
  1280. </div>
  1281. }
  1282. >
  1283. <div
  1284. style={{
  1285. position: "absolute",
  1286. top: -120,
  1287. width: 150,
  1288. height: 200,
  1289. backgroundColor: "lightBlue",
  1290. }}
  1291. >
  1292. 我的上侧被遮挡啦!我的上侧被遮挡啦!我的上侧被遮挡啦!我的上侧被遮挡啦!我的上侧被遮挡啦!我的上侧被遮挡啦!我的上侧被遮挡啦!我的上侧被遮挡啦!我的上侧被遮挡啦!
  1293. </div>
  1294. </Tooltip>
  1295. <Tooltip
  1296. content={
  1297. <div
  1298. style={{
  1299. width: 520,
  1300. height: 360
  1301. }}
  1302. >
  1303. 我的右侧被遮挡啦!但是我可以正常显示! 我的右侧被遮挡啦!但是我可以正常显示! 我的右侧被遮挡啦!但是我可以正常显示!
  1304. </div>
  1305. }
  1306. >
  1307. <div
  1308. style={{
  1309. position: "absolute",
  1310. right: -120,
  1311. width: 150,
  1312. height: 20,
  1313. lineHeight: "20px",
  1314. backgroundColor: "lightBlue",
  1315. }}
  1316. >
  1317. 我的右侧被遮挡啦!
  1318. </div>
  1319. </Tooltip>
  1320. </div>
  1321. );
  1322. }
  1323. export const Fix1449 = () =>{
  1324. return <div style={{ width: "100%", overflow: "hidden" }}>
  1325. <div style={{ position: "relative", height: 200 }}>
  1326. <Select
  1327. placeholder=""
  1328. style={{ width: 400, left: 500, position: "absolute" }}
  1329. filter
  1330. position='bottomLeft'
  1331. autoAdjustOverflow
  1332. >
  1333. <Select.Option value="abc">抖音</Select.Option>
  1334. <Select.Option value="ulikecam">轻颜相机</Select.Option>
  1335. <Select.Option value="jianying" disabled>
  1336. 剪映
  1337. </Select.Option>
  1338. <Select.Option value="xigua">西瓜视频</Select.Option>
  1339. </Select>
  1340. </div>
  1341. <div style={{ position: "relative", height: 100 }}>
  1342. <Tooltip
  1343. visible
  1344. position='topLeft'
  1345. content={
  1346. <div >
  1347. 贴右显示
  1348. </div>
  1349. }>
  1350. <Button style={{ width: 200, left: 700, top: 50, position: "absolute" }}>
  1351. 缩小视口以遮挡我的右侧
  1352. </Button>
  1353. </Tooltip>
  1354. </div>
  1355. </div>
  1356. }
  1357. // right -> other
  1358. export const AutoRight2LeftDemo = () => <Right2Left />;
  1359. AutoRight2LeftDemo.storyName = `✅ auto : right -> left`;
  1360. export const AutoRight2LeftBottomDemo = () => <Right2LeftBottom />;
  1361. AutoRight2LeftBottomDemo.storyName = `✅ auto : right -> leftBottom`;
  1362. export const AutoRight2LeftTopDemo = () => <Right2LeftTop />;
  1363. AutoRight2LeftTopDemo.storyName = `✅ auto : riht -> leftTop`;
  1364. export const AutoRight2RightBottomDemo = () => <Right2RightBottom />;
  1365. AutoRight2RightBottomDemo.storyName = `✅ auto : right -> rightBottom`;
  1366. export const AutoRight2RightTopDemo = () => <Right2RightTop />;
  1367. AutoRight2RightTopDemo.storyName = `✅ auto : riht -> rightTop`;
  1368. // left -> other
  1369. export const Left2RightDemo = () => <Left2Right />;
  1370. Left2RightDemo.storyName = `✅ auto : left -> right`;
  1371. export const Left2LeftBottomDemo = () => <Left2LeftBottom />;
  1372. Left2LeftBottomDemo.storyName = `✅ auto : left -> leftBottom`;
  1373. export const Left2LeftTopDemo = () => <Left2LeftTop />;
  1374. Left2LeftTopDemo.storyName = `✅ auto : left -> leftTop`;
  1375. export const Left2RightBottomDemo = () => <Left2RightBottom />;
  1376. Left2RightBottomDemo.storyName = `✅ auto : left -> rightBottom`;
  1377. export const Left2RightTopDemo = () => <Left2RightTop />;
  1378. Left2RightTopDemo.storyName = `✅ auto : left -> rightTop`;
  1379. // top -> other
  1380. export const Top2BottomDemo = () => <Top2Bottom />;
  1381. Top2BottomDemo.storyName = `✅ auto : top -> bottom`;
  1382. export const Top2BottomLeftDemo = () => <Top2BottomLeft />;
  1383. Top2BottomLeftDemo.storyName = `✅ auto : top -> bottomLeft`;
  1384. export const Top2BottomRightDemo = () => <Top2BottomRight />;
  1385. Top2BottomRightDemo.storyName = `✅ auto : top -> bottomRight`;
  1386. export const Top2TopLeftDemo = () => <Top2TopLeft />;
  1387. Top2TopLeftDemo.storyName = `✅ auto : top -> topLeft`;
  1388. export const Top2TopRightDemo = () => <Top2TopRight />;
  1389. Top2TopRightDemo.storyName = `✅ auto : top -> topRight`;
  1390. // bottom -> other
  1391. export const Bottom2TopDemo = () => <Bottom2Top />;
  1392. Bottom2TopDemo.storyName = `✅ auto : bottom -> top`;
  1393. export const Bottom2TopLeftDemo = () => <Bottom2TopLeft />;
  1394. Bottom2TopLeftDemo.storyName = `✅ auto : bottom -> topLeft`;
  1395. export const Bottom2TopRightDemo = () => <Bottom2TopRight />;
  1396. Bottom2TopRightDemo.storyName = `✅ auto : bottom -> topRight`;
  1397. export const Bottom2BottomLeftDemo = () => <Bottom2BottomLeft />;
  1398. Bottom2BottomLeftDemo.storyName = `✅ auto : bottom -> bottomLeft`;
  1399. export const Bottom2BottomRightDemo = () => <Bottom2BottomRight />;
  1400. Bottom2BottomRightDemo.storyName = `✅ auto : bottom -> bottomRight`;
  1401. export const Fix1557 = () =>{
  1402. return (
  1403. <Dropdown
  1404. trigger='hover'
  1405. disableFocusListener
  1406. render={
  1407. <Dropdown.Menu>
  1408. <Popconfirm
  1409. content={
  1410. <>
  1411. <Select filter/>
  1412. </>
  1413. }
  1414. >
  1415. <Button>点我后再点击select, Dropdown 面板不收起</Button>
  1416. </Popconfirm>
  1417. </Dropdown.Menu>
  1418. }
  1419. >
  1420. <Tag>Hover Me</Tag>
  1421. </Dropdown>
  1422. );
  1423. }