Skip to content

✨ feat(base-ui): Spin, Progress, Badge, Result, Pagination, Upload and antd-free Empty - #660

Open
Innei wants to merge 17 commits into
masterfrom
feat/base-ui-batch-seven
Open

Innei wants to merge 17 commits into
masterfrom
feat/base-ui-batch-seven

Conversation

@Innei

@Innei Innei commented Sep 13, 2026

Copy link
Copy Markdown
Member

Why

Downstream (lobe-chat) still imports these from antd: Upload (21 files), Progress (15), Spin / Pagination / Result (11 each), Badge (10). Empty (78 files via @lobehub/ui) was a thin antd wrapper. This batch removes antd from all of them.

What

New @lobehub/ui/base-ui components (also re-exported from the root):

Component Notes
Spin size 14/20/32, percent ring, indicator, overlay via children, variant="neural" (≤6 SVG elements, 1 animated — replaces lobe-chat's 31-element NeuralNetworkLoading)
Progress type="line|circle", variant="line|segments|inset", status, showInfo, format; role="progressbar"
Badge antd-compatible signature: status/text/color or count/dot/overflowCount/offset/size
Result status="success|error|info|warning", icon/title/subTitle/extra
Pagination controlled/uncontrolled current/pageSize, showTotal, showSizeChanger (base-ui Select), clamp notifies onChange
Upload / UploadDragger headless: hidden input + drag zone, accept/multiple/directory/maxCount, beforeUpload(file, fileList) (antd-shaped), onFiles, onChange. No fileList / XHR / progress UI

src/Empty rewritten in place without antd, adds variant="default\|dashed\|stack".

Breaking / migration notes

  • EmptyProps now extends ComponentProps<'div'> instead of FlexboxProps (gap/padding/horizontal/flex no longer accepted). lobe-chat only passes description/icon/title/className/style/onClick/type — verified clean.
  • size="default" (antd) → size="middle" on Spin / Progress / Pagination. Badge keeps antd's default|small.
  • Not ported: Result 404/403/500, Progress dashboard/steps/gradient stroke, Pagination showQuickJumper/simple, Upload file list & XHR, Upload.LIST_IGNORE. Each mdx has a "Migrating from antd" section.

Verification

  • 121 tests across the 7 dirs; eslint / tsc clean on changed files
  • All 7 docs pages rendered in the dev server, light theme, no console errors

https://claude.ai/code/session_01SnPUiLfRXgaeBU3jSRZXHc

@vercel

vercel Bot commented Sep 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lobe-ui Ready Ready Preview Sep 16, 2026 2:11pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-13T11:15:41.029462Z 5ce58b8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ce58b85a0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/base-ui/Spin/Spin.tsx

if (!spinning) return children ?? null;

if (!children) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve zero-valued children while spinning

When children is 0, the falsy check selects standalone mode and drops the content while spinning is true, even though the same child reappears when spinning becomes false. This breaks counters and other numeric displays that legitimately render zero; distinguish absent children with children == null instead.

Useful? React with 👍 / 👎.

Comment on lines +186 to +188
onClick={handleClick}
onKeyDown={handleKeyDown}
{...rest}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Compose forwarded click handlers with the upload trigger

When a caller supplies the inherited native onClick or onKeyDown prop, this final spread replaces handleClick or handleKeyDown rather than augmenting it. A common analytics or telemetry handler therefore prevents the regular upload trigger from opening the file dialog; spread these props before the internal handlers or explicitly compose both callbacks.

Useful? React with 👍 / 👎.

Comment on lines +58 to +60
const filtered = filterFilesByAccept(rawFiles, accept);
const accepted = await resolveAcceptedFiles(filtered, beforeUpload);
const sliced = maxCount ? accepted.slice(0, maxCount) : accepted;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enforce single-file mode for dropped files

When multiple is false or omitted, the native picker limits selection to one file, but a drag-and-drop operation can still pass multiple files through this pipeline because only maxCount is applied. Consequently a nominally single-file dragger calls onFiles and onChange for every dropped file; cap the accepted list at one unless multiple is enabled.

Useful? React with 👍 / 👎.

@Innei
Innei force-pushed the feat/base-ui-batch-seven branch from 5ce58b8 to 6b73209 Compare September 16, 2026 13:59
@pkg-pr-new

pkg-pr-new Bot commented Sep 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@lobehub/ui@660

commit: 6b73209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant