Browse Source

feat: Steps support inline (#38311)

* test: update snapshot

* docs: add inline demo

* chore: upgrage rc-steps
pull/38449/head
JarvisArt 2 years ago
committed by GitHub
parent
commit
60d8e91bd2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 909
      components/steps/__tests__/__snapshots__/demo-extend.test.ts.snap
  2. 621
      components/steps/__tests__/__snapshots__/demo.test.ts.snap
  3. 81
      components/steps/demo/inline.md
  4. 13
      components/steps/index.en-US.md
  5. 18
      components/steps/index.tsx
  6. 13
      components/steps/index.zh-CN.md
  7. 13
      components/steps/style/index.tsx
  8. 124
      components/steps/style/inline.ts
  9. 2
      package.json

909
components/steps/__tests__/__snapshots__/demo-extend.test.ts.snap

@ -1001,6 +1001,915 @@ exports[`renders ./components/steps/demo/icon.md extend context correctly 1`] =
</div> </div>
`; `;
exports[`renders ./components/steps/demo/inline.md extend context correctly 1`] = `
<div>
<div
class="ant-list ant-list-split"
>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<ul
class="ant-list-items"
>
<li
class="ant-list-item"
>
<div
class="ant-list-item-meta"
>
<div
class="ant-list-item-meta-avatar"
>
<span
class="ant-avatar ant-avatar-circle ant-avatar-image"
>
<img
src="https://joeschmoe.io/api/v1/random"
/>
</span>
</div>
<div
class="ant-list-item-meta-content"
>
<h4
class="ant-list-item-meta-title"
>
<a
href="https://ant.design"
>
Ant Design Title 1
</a>
</h4>
<div
class="ant-list-item-meta-description"
>
Ant Design, a design language for background applications, is refined by Ant UED Team
</div>
</div>
</div>
<div
class="ant-steps ant-steps-horizontal ant-steps-label-vertical ant-steps-dot ant-steps-inline"
style="margin-top:8px"
>
<div
class="ant-steps-item ant-steps-item-process ant-steps-item-active"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 1
</div>
<div
class="ant-steps-item-description"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-wait"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 2
</div>
<div
class="ant-steps-item-description"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-wait"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 3
</div>
<div
class="ant-steps-item-description"
>
This is a Step 3.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 3.
</div>
</div>
</div>
</div>
</div>
</li>
<li
class="ant-list-item"
>
<div
class="ant-list-item-meta"
>
<div
class="ant-list-item-meta-avatar"
>
<span
class="ant-avatar ant-avatar-circle ant-avatar-image"
>
<img
src="https://joeschmoe.io/api/v1/random"
/>
</span>
</div>
<div
class="ant-list-item-meta-content"
>
<h4
class="ant-list-item-meta-title"
>
<a
href="https://ant.design"
>
Ant Design Title 2
</a>
</h4>
<div
class="ant-list-item-meta-description"
>
Ant Design, a design language for background applications, is refined by Ant UED Team
</div>
</div>
</div>
<div
class="ant-steps ant-steps-horizontal ant-steps-label-vertical ant-steps-dot ant-steps-inline"
style="margin-top:8px"
>
<div
class="ant-steps-item ant-steps-item-finish ant-steps-next-error"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 1
</div>
<div
class="ant-steps-item-description"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-error ant-steps-item-active"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 2
</div>
<div
class="ant-steps-item-description"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-wait"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 3
</div>
<div
class="ant-steps-item-description"
>
This is a Step 3.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 3.
</div>
</div>
</div>
</div>
</div>
</li>
<li
class="ant-list-item"
>
<div
class="ant-list-item-meta"
>
<div
class="ant-list-item-meta-avatar"
>
<span
class="ant-avatar ant-avatar-circle ant-avatar-image"
>
<img
src="https://joeschmoe.io/api/v1/random"
/>
</span>
</div>
<div
class="ant-list-item-meta-content"
>
<h4
class="ant-list-item-meta-title"
>
<a
href="https://ant.design"
>
Ant Design Title 3
</a>
</h4>
<div
class="ant-list-item-meta-description"
>
Ant Design, a design language for background applications, is refined by Ant UED Team
</div>
</div>
</div>
<div
class="ant-steps ant-steps-horizontal ant-steps-label-vertical ant-steps-dot ant-steps-inline"
style="margin-top:8px"
>
<div
class="ant-steps-item ant-steps-item-finish"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 1
</div>
<div
class="ant-steps-item-description"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-finish"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 2
</div>
<div
class="ant-steps-item-description"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-process ant-steps-item-active"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 3
</div>
<div
class="ant-steps-item-description"
>
This is a Step 3.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 3.
</div>
</div>
</div>
</div>
</div>
</li>
<li
class="ant-list-item"
>
<div
class="ant-list-item-meta"
>
<div
class="ant-list-item-meta-avatar"
>
<span
class="ant-avatar ant-avatar-circle ant-avatar-image"
>
<img
src="https://joeschmoe.io/api/v1/random"
/>
</span>
</div>
<div
class="ant-list-item-meta-content"
>
<h4
class="ant-list-item-meta-title"
>
<a
href="https://ant.design"
>
Ant Design Title 4
</a>
</h4>
<div
class="ant-list-item-meta-description"
>
Ant Design, a design language for background applications, is refined by Ant UED Team
</div>
</div>
</div>
<div
class="ant-steps ant-steps-horizontal ant-steps-label-vertical ant-steps-dot ant-steps-inline"
style="margin-top:8px"
>
<div
class="ant-steps-item ant-steps-item-finish"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 1
</div>
<div
class="ant-steps-item-description"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-process ant-steps-item-active"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 2
</div>
<div
class="ant-steps-item-description"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-wait"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 3
</div>
<div
class="ant-steps-item-description"
>
This is a Step 3.
</div>
</div>
</div>
</div>
<div>
<div
class="ant-tooltip"
style="opacity:0"
>
<div
class="ant-tooltip-content"
>
<div
class="ant-tooltip-arrow"
>
<span
class="ant-tooltip-arrow-content"
/>
</div>
<div
class="ant-tooltip-inner"
role="tooltip"
>
This is a Step 3.
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
`;
exports[`renders ./components/steps/demo/label-placement.md extend context correctly 1`] = ` exports[`renders ./components/steps/demo/label-placement.md extend context correctly 1`] = `
Array [ Array [
<div <div

621
components/steps/__tests__/__snapshots__/demo.test.ts.snap

@ -857,6 +857,627 @@ exports[`renders ./components/steps/demo/icon.md correctly 1`] = `
</div> </div>
`; `;
exports[`renders ./components/steps/demo/inline.md correctly 1`] = `
<div>
<div
class="ant-list ant-list-split"
>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<ul
class="ant-list-items"
>
<li
class="ant-list-item"
>
<div
class="ant-list-item-meta"
>
<div
class="ant-list-item-meta-avatar"
>
<span
class="ant-avatar ant-avatar-circle ant-avatar-image"
>
<img
src="https://joeschmoe.io/api/v1/random"
/>
</span>
</div>
<div
class="ant-list-item-meta-content"
>
<h4
class="ant-list-item-meta-title"
>
<a
href="https://ant.design"
>
Ant Design Title 1
</a>
</h4>
<div
class="ant-list-item-meta-description"
>
Ant Design, a design language for background applications, is refined by Ant UED Team
</div>
</div>
</div>
<div
class="ant-steps ant-steps-horizontal ant-steps-label-vertical ant-steps-dot ant-steps-inline"
style="margin-top:8px"
>
<div
class="ant-steps-item ant-steps-item-process ant-steps-item-active"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 1
</div>
<div
class="ant-steps-item-description"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-wait"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 2
</div>
<div
class="ant-steps-item-description"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-wait"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 3
</div>
<div
class="ant-steps-item-description"
>
This is a Step 3.
</div>
</div>
</div>
</div>
</div>
</li>
<li
class="ant-list-item"
>
<div
class="ant-list-item-meta"
>
<div
class="ant-list-item-meta-avatar"
>
<span
class="ant-avatar ant-avatar-circle ant-avatar-image"
>
<img
src="https://joeschmoe.io/api/v1/random"
/>
</span>
</div>
<div
class="ant-list-item-meta-content"
>
<h4
class="ant-list-item-meta-title"
>
<a
href="https://ant.design"
>
Ant Design Title 2
</a>
</h4>
<div
class="ant-list-item-meta-description"
>
Ant Design, a design language for background applications, is refined by Ant UED Team
</div>
</div>
</div>
<div
class="ant-steps ant-steps-horizontal ant-steps-label-vertical ant-steps-dot ant-steps-inline"
style="margin-top:8px"
>
<div
class="ant-steps-item ant-steps-item-finish ant-steps-next-error"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 1
</div>
<div
class="ant-steps-item-description"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-error ant-steps-item-active"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 2
</div>
<div
class="ant-steps-item-description"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-wait"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 3
</div>
<div
class="ant-steps-item-description"
>
This is a Step 3.
</div>
</div>
</div>
</div>
</div>
</li>
<li
class="ant-list-item"
>
<div
class="ant-list-item-meta"
>
<div
class="ant-list-item-meta-avatar"
>
<span
class="ant-avatar ant-avatar-circle ant-avatar-image"
>
<img
src="https://joeschmoe.io/api/v1/random"
/>
</span>
</div>
<div
class="ant-list-item-meta-content"
>
<h4
class="ant-list-item-meta-title"
>
<a
href="https://ant.design"
>
Ant Design Title 3
</a>
</h4>
<div
class="ant-list-item-meta-description"
>
Ant Design, a design language for background applications, is refined by Ant UED Team
</div>
</div>
</div>
<div
class="ant-steps ant-steps-horizontal ant-steps-label-vertical ant-steps-dot ant-steps-inline"
style="margin-top:8px"
>
<div
class="ant-steps-item ant-steps-item-finish"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 1
</div>
<div
class="ant-steps-item-description"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-finish"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 2
</div>
<div
class="ant-steps-item-description"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-process ant-steps-item-active"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 3
</div>
<div
class="ant-steps-item-description"
>
This is a Step 3.
</div>
</div>
</div>
</div>
</div>
</li>
<li
class="ant-list-item"
>
<div
class="ant-list-item-meta"
>
<div
class="ant-list-item-meta-avatar"
>
<span
class="ant-avatar ant-avatar-circle ant-avatar-image"
>
<img
src="https://joeschmoe.io/api/v1/random"
/>
</span>
</div>
<div
class="ant-list-item-meta-content"
>
<h4
class="ant-list-item-meta-title"
>
<a
href="https://ant.design"
>
Ant Design Title 4
</a>
</h4>
<div
class="ant-list-item-meta-description"
>
Ant Design, a design language for background applications, is refined by Ant UED Team
</div>
</div>
</div>
<div
class="ant-steps ant-steps-horizontal ant-steps-label-vertical ant-steps-dot ant-steps-inline"
style="margin-top:8px"
>
<div
class="ant-steps-item ant-steps-item-finish"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 1
</div>
<div
class="ant-steps-item-description"
>
This is a Step 1.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-process ant-steps-item-active"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 2
</div>
<div
class="ant-steps-item-description"
>
This is a Step 2.
</div>
</div>
</div>
</div>
<div
class="ant-steps-item ant-steps-item-wait"
>
<div
class="ant-steps-item-container"
>
<div
class="ant-steps-item-tail"
/>
<div
class="ant-steps-item-icon"
>
<span
class="ant-steps-icon"
>
<span
class="ant-steps-icon-dot"
/>
</span>
</div>
<div
class="ant-steps-item-content"
>
<div
class="ant-steps-item-title"
>
Step 3
</div>
<div
class="ant-steps-item-description"
>
This is a Step 3.
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
`;
exports[`renders ./components/steps/demo/label-placement.md correctly 1`] = ` exports[`renders ./components/steps/demo/label-placement.md correctly 1`] = `
Array [ Array [
<div <div

81
components/steps/demo/inline.md

@ -0,0 +1,81 @@
---
order: 15
title:
zh-CN: 内联步骤
en-US: Inline Steps
---
## zh-CN
内联类型的步骤条,适用于列表内容场景中展示对象所在流程、当前状态的情况。
## en-US
Inline type steps, suitable for displaying the process and current state of the object in the list content scene.
```tsx
import type { StepsProps } from 'antd';
import { Steps, List, Avatar } from 'antd';
const data = [
{
title: 'Ant Design Title 1',
current: 0,
},
{
title: 'Ant Design Title 2',
current: 1,
status: 'error',
},
{
title: 'Ant Design Title 3',
current: 2,
},
{
title: 'Ant Design Title 4',
current: 1,
},
];
const items = [
{
title: 'Step 1',
description: 'This is a Step 1.',
},
{
title: 'Step 2',
description: 'This is a Step 2.',
},
{
title: 'Step 3',
description: 'This is a Step 3.',
},
];
const App: React.FC = () => (
<div>
<List
itemLayout="horizontal"
dataSource={data}
renderItem={item => (
<List.Item>
<List.Item.Meta
avatar={<Avatar src="https://joeschmoe.io/api/v1/random" />}
title={<a href="https://ant.design">{item.title}</a>}
description="Ant Design, a design language for background applications, is refined by Ant UED Team"
/>
<Steps
style={{ marginTop: 8 }}
type="inline"
current={item.current}
status={item.status as StepsProps['status']}
items={items}
/>
</List.Item>
)}
/>
</div>
);
export default App;
```

13
components/steps/index.en-US.md

@ -50,10 +50,21 @@ The whole of the step bar.
| responsive | Change to vertical direction when screen width smaller than `532px` | boolean | true | | | responsive | Change to vertical direction when screen width smaller than `532px` | boolean | true | |
| size | To specify the size of the step bar, `default` and `small` are currently supported | string | `default` | | | size | To specify the size of the step bar, `default` and `small` are currently supported | string | `default` | |
| status | To specify the status of current step, can be set to one of the following values: `wait` `process` `finish` `error` | string | `process` | | | status | To specify the status of current step, can be set to one of the following values: `wait` `process` `finish` `error` | string | `process` | |
| type | Type of steps, can be set to one of the following values: `default`, `navigation` | string | `default` | | | type | Type of steps, can be set to one of the following values: `default` `navigation` `inline` | string | `default` | inline: 5.0 |
| onChange | Trigger when Step is changed | (current) => void | - | | | onChange | Trigger when Step is changed | (current) => void | - | |
| items | StepItem content | [StepItem](#StepItem) | [] | 4.24.0 | | items | StepItem content | [StepItem](#StepItem) | [] | 4.24.0 |
### `type="inline"`
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| className | Additional class to Steps | string | - | |
| current | To set the current step, counting from 0. You can overwrite this state by using `status` of `Step` | number | 0 | |
| initial | Set the initial step, counting from 0 | number | 0 | |
| status | To specify the status of current step, can be set to one of the following values: `wait` `process` `finish` `error` | string | `process` | |
| onChange | Trigger when Step is changed | (current) => void | - | |
| items | StepItem content. not supported: `icon` `subtitle` | [StepItem](#StepItem) | [] | 4.24.0 |
### StepItem ### StepItem
A single step in the step bar. A single step in the step bar.

18
components/steps/index.tsx

@ -4,6 +4,7 @@ import classNames from 'classnames';
import RcSteps from 'rc-steps'; import RcSteps from 'rc-steps';
import type { ProgressDotRender } from 'rc-steps/lib/Steps'; import type { ProgressDotRender } from 'rc-steps/lib/Steps';
import * as React from 'react'; import * as React from 'react';
import Tooltip from '../tooltip';
import { ConfigContext } from '../config-provider'; import { ConfigContext } from '../config-provider';
import useBreakpoint from '../grid/hooks/useBreakpoint'; import useBreakpoint from '../grid/hooks/useBreakpoint';
import Progress from '../progress'; import Progress from '../progress';
@ -23,7 +24,7 @@ export interface StepProps {
} }
export interface StepsProps { export interface StepsProps {
type?: 'default' | 'navigation'; type?: 'default' | 'navigation' | 'inline';
className?: string; className?: string;
current?: number; current?: number;
direction?: 'horizontal' | 'vertical'; direction?: 'horizontal' | 'vertical';
@ -70,13 +71,15 @@ const Steps: StepsType = props => {
const [wrapSSR, hashId] = useStyle(prefixCls); const [wrapSSR, hashId] = useStyle(prefixCls);
const isInline = props.type === 'inline';
const iconPrefix = getPrefixCls('', props.iconPrefix); const iconPrefix = getPrefixCls('', props.iconPrefix);
const mergedItems = useLegacyItems(items, children); const mergedItems = useLegacyItems(items, children);
const mergedPercent = isInline ? undefined : percent;
const stepsClassName = classNames( const stepsClassName = classNames(
{ {
[`${prefixCls}-rtl`]: rtlDirection === 'rtl', [`${prefixCls}-rtl`]: rtlDirection === 'rtl',
[`${prefixCls}-with-progress`]: percent !== undefined, [`${prefixCls}-with-progress`]: mergedPercent !== undefined,
}, },
className, className,
hashId, hashId,
@ -96,7 +99,7 @@ const Steps: StepsType = props => {
title: string | React.ReactNode; title: string | React.ReactNode;
description: string | React.ReactNode; description: string | React.ReactNode;
}) => { }) => {
if (status === 'process' && percent !== undefined) { if (status === 'process' && mergedPercent !== undefined) {
// currently it's hard-coded, since we can't easily read the actually width of icon // currently it's hard-coded, since we can't easily read the actually width of icon
const progressWidth = size === 'small' ? 32 : 40; const progressWidth = size === 'small' ? 32 : 40;
// iconWithProgress // iconWithProgress
@ -104,7 +107,7 @@ const Steps: StepsType = props => {
<div className={`${prefixCls}-progress-icon`}> <div className={`${prefixCls}-progress-icon`}>
<Progress <Progress
type="circle" type="circle"
percent={percent} percent={mergedPercent}
width={progressWidth} width={progressWidth}
strokeWidth={4} strokeWidth={4}
format={() => null} format={() => null}
@ -116,6 +119,12 @@ const Steps: StepsType = props => {
return node; return node;
}; };
let itemRender;
if (isInline) {
itemRender = (item: StepProps, stepItem: React.ReactNode) =>
item.description ? <Tooltip title={item.description}>{stepItem}</Tooltip> : stepItem;
}
return wrapSSR( return wrapSSR(
<RcSteps <RcSteps
icons={icons} icons={icons}
@ -123,6 +132,7 @@ const Steps: StepsType = props => {
current={current} current={current}
size={size} size={size}
items={mergedItems} items={mergedItems}
itemRender={itemRender}
direction={getDirection()} direction={getDirection()}
stepIcon={stepIconRender} stepIcon={stepIconRender}
prefixCls={prefixCls} prefixCls={prefixCls}

13
components/steps/index.zh-CN.md

@ -51,10 +51,21 @@ return <Steps items={items} />;
| responsive | 当屏幕宽度小于 `532px` 时自动变为垂直模式 | boolean | true | | | responsive | 当屏幕宽度小于 `532px` 时自动变为垂直模式 | boolean | true | |
| size | 指定大小,目前支持普通(`default`)和迷你(`small`) | string | `default` | | | size | 指定大小,目前支持普通(`default`)和迷你(`small`) | string | `default` | |
| status | 指定当前步骤的状态,可选 `wait` `process` `finish` `error` | string | `process` | | | status | 指定当前步骤的状态,可选 `wait` `process` `finish` `error` | string | `process` | |
| type | 步骤条类型,`default``navigation` 两种 | string | `default` | | | type | 步骤条类型,可选 `default` `navigation` `inline` | string | `default` | inline: 5.0 |
| onChange | 点击切换步骤时触发 | (current) => void | - | | | onChange | 点击切换步骤时触发 | (current) => void | - | |
| items | 配置选项卡内容 | [StepItem](#StepItem) | [] | 4.24.0 | | items | 配置选项卡内容 | [StepItem](#StepItem) | [] | 4.24.0 |
### `type="inline"`
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| className | 步骤条类名 | string | - | |
| current | 指定当前步骤,从 0 开始记数。在子 Step 元素中,可以通过 `status` 属性覆盖状态 | number | 0 | |
| initial | 起始序号,从 0 开始记数 | number | 0 | |
| status | 指定当前步骤的状态,可选 `wait` `process` `finish` `error` | string | `process` | |
| onChange | 点击切换步骤时触发 | (current) => void | - | |
| items | 配置选项卡内容,不支持 `icon` `subtitle` | [StepItem](#StepItem) | [] | 4.24.0 |
### StepItem ### StepItem
步骤条内的每一个步骤。 步骤条内的每一个步骤。

13
components/steps/style/index.tsx

@ -9,6 +9,7 @@ import genStepsProgressDotStyle from './progress-dot';
import genStepsRTLStyle from './rtl'; import genStepsRTLStyle from './rtl';
import genStepsSmallStyle from './small'; import genStepsSmallStyle from './small';
import genStepsVerticalStyle from './vertical'; import genStepsVerticalStyle from './vertical';
import genStepsInlineStyle from './inline';
import { resetComponent } from '../../style'; import { resetComponent } from '../../style';
export interface ComponentToken { export interface ComponentToken {
@ -60,6 +61,10 @@ export interface StepsToken extends FullToken<'Steps'> {
errorDotColor: string; errorDotColor: string;
stepsNavActiveColor: string; stepsNavActiveColor: string;
stepsProgressSize: number; stepsProgressSize: number;
// Steps inline variable
inlineDotSize: number;
inlineTitleColor: string;
inlineTailColor: string;
} }
enum StepItemStatusEnum { enum StepItemStatusEnum {
@ -311,6 +316,8 @@ const genStepsStyle: GenerateStyle<StepsToken, CSSObject> = token => {
...genStepsRTLStyle(token), ...genStepsRTLStyle(token),
// progress // progress
...genStepsProgressStyle(token), ...genStepsProgressStyle(token),
// inline
...genStepsInlineStyle(token),
}, },
}; };
}; };
@ -331,10 +338,12 @@ export default genComponentStyleHook(
colorPrimary, colorPrimary,
colorTextLabel, colorTextLabel,
colorTextDescription, colorTextDescription,
colorTextQuaternary,
colorFillContent, colorFillContent,
controlItemBgActive, controlItemBgActive,
colorError, colorError,
colorBgContainer, colorBgContainer,
colorBorderSecondary,
} = token; } = token;
const stepsIconSize = token.controlHeight; const stepsIconSize = token.controlHeight;
@ -385,6 +394,10 @@ export default genComponentStyleHook(
errorDotColor: colorError, errorDotColor: colorError,
stepsNavActiveColor: colorPrimary, stepsNavActiveColor: colorPrimary,
stepsProgressSize: controlHeightLG, stepsProgressSize: controlHeightLG,
// Steps inline variable
inlineDotSize: 6,
inlineTitleColor: colorTextQuaternary,
inlineTailColor: colorBorderSecondary,
}); });
return [genStepsStyle(stepsToken)]; return [genStepsStyle(stepsToken)];

124
components/steps/style/inline.ts

@ -0,0 +1,124 @@
import type { CSSObject } from '@ant-design/cssinjs';
import type { StepsToken } from '.';
import type { GenerateStyle } from '../../theme';
const genStepsInlineStyle: GenerateStyle<StepsToken, CSSObject> = token => {
const { componentCls, inlineDotSize, inlineTitleColor, inlineTailColor } = token;
const containerPaddingTop = token.paddingXS + token.lineWidth;
const titleStyle = {
[`${componentCls}-item-container ${componentCls}-item-content ${componentCls}-item-title`]: {
color: inlineTitleColor,
},
};
return {
[`&${componentCls}-inline`]: {
width: 'auto',
display: 'inline-flex',
[`${componentCls}-item`]: {
flex: 'none',
'&-container': {
padding: `${containerPaddingTop}px ${token.paddingXXS}px 0`,
margin: `0 ${token.marginXXS / 2}px`,
borderRadius: token.borderRadiusSM,
cursor: 'pointer',
'&:hover': {
background: token.controlItemBgHover,
transition: `background-color ${token.motionDurationFast}`,
},
[`&[role='button']:hover`]: {
opacity: 1,
},
},
'&-icon': {
width: inlineDotSize,
height: inlineDotSize,
marginInlineStart: `calc(50% - ${inlineDotSize / 2}px)`,
[`> ${componentCls}-icon`]: {
top: 0,
},
[`${componentCls}-icon-dot`]: {
borderRadius: token.fontSizeSM / 4,
},
},
'&-content': {
width: 'auto',
marginTop: token.marginXS - token.lineWidth,
},
'&-title': {
color: inlineTitleColor,
fontSize: token.fontSizeSM,
lineHeight: token.lineHeightSM,
fontWeight: 'normal',
marginBottom: token.marginXXS / 2,
},
'&-description': {
display: 'none',
},
'&-tail': {
marginInlineStart: 0,
top: containerPaddingTop + inlineDotSize / 2,
transform: `translateY(-50%)`,
'&:after': {
width: '100%',
height: token.lineWidth,
borderRadius: 0,
marginInlineStart: 0,
background: inlineTailColor,
},
},
[`&:first-child ${componentCls}-item-tail`]: {
width: '50%',
marginInlineStart: '50%',
},
[`&:last-child ${componentCls}-item-tail`]: {
display: 'block',
width: '50%',
},
'&-wait': {
[`${componentCls}-item-icon ${componentCls}-icon ${componentCls}-icon-dot`]: {
backgroundColor: token.colorBorderBg,
border: `${token.lineWidth}px ${token.lineType} ${inlineTailColor}`,
},
...titleStyle,
},
'&-finish': {
[`${componentCls}-item-tail::after`]: {
backgroundColor: inlineTailColor,
},
[`${componentCls}-item-icon ${componentCls}-icon ${componentCls}-icon-dot`]: {
backgroundColor: inlineTailColor,
border: `${token.lineWidth}px ${token.lineType} ${inlineTailColor}`,
},
...titleStyle,
},
'&-error': titleStyle,
'&-active, &-process': {
[`${componentCls}-item-icon`]: {
width: inlineDotSize,
height: inlineDotSize,
marginInlineStart: `calc(50% - ${inlineDotSize / 2}px)`,
top: 0,
},
...titleStyle,
},
[`&:not(${componentCls}-item-active) > ${componentCls}-item-container[role='button']:hover`]:
{
[`${componentCls}-item-title`]: {
color: inlineTitleColor,
},
},
},
},
};
};
export default genStepsInlineStyle;

2
package.json

@ -142,7 +142,7 @@
"rc-segmented": "~2.1.0", "rc-segmented": "~2.1.0",
"rc-select": "~14.1.13", "rc-select": "~14.1.13",
"rc-slider": "~10.0.0", "rc-slider": "~10.0.0",
"rc-steps": "~5.0.0-alpha.2", "rc-steps": "~6.0.0-alpha.2",
"rc-switch": "~4.0.0", "rc-switch": "~4.0.0",
"rc-table": "~7.26.0", "rc-table": "~7.26.0",
"rc-tabs": "~12.2.0", "rc-tabs": "~12.2.0",

Loading…
Cancel
Save