Repository navigation
[refactor] upgrade Idea React v2 components & examples to Bootstrap 6 - #76
Merged
Merged
Conversation
Deploying idea-react with
|
| Latest commit: |
b15c5ab
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8fa20b69.idea-react.pages.dev |
| Branch Preview URL: | https://copilot-upgrade-bootstrap-v6.idea-react.pages.dev |
Copilot
AI
changed the title
[WIP] Upgrade Idea React v2 components to Bootstrap v6
Upgrade Idea React components and docs to Bootstrap 6
Oct 30, 2026
完成组件库向 Bootstrap 6 的全面迁移,并引入了一系列新的基础与增强组件。
主要变更包括:
- 核心组件升级:将现有组件(如 `OverlayBox`, `UserRank`, `Timeline` 等)重构以适配 Bootstrap 6 的类名和结构。
- 新增组件:
- 布局相关:`Card`, `Grid` (Container, Row, Col), `Nav`
- 媒体相关:`Image`
- 交互相关:`Popover`, `Tooltip`
- 数据展示:`Table`
- 代码重构:
- 将部分 MobX 驱动的类组件转换为更简洁的函数式组件(如 `Time`, `TextTruncate` 等)。
- 优化了 `ScrollNav` 的实现,将其拆分为 `Scroller` 逻辑组件。
- 统一了 `Overlay` 相关的类型定义与方向处理。
- 文档与测试:
- 更新 `ReadMe.md` 中的组件列表与示例代码。
- 为新增组件编写了完整的单元测试,并更新了现有组件的测试用例以匹配 Bootstrap 6 的 DOM 结构。
- 版本更新:将 `package.json` 中的版本号提升至 `3.0.0-alpha.1`。
TechQuery
marked this pull request as ready for review
October 30, 2026 22:18
同步更新文档内容以匹配 Bootstrap 6 的最新规范,并扩展了组件库的组件范围与功能细节。
主要变更包括:
- **组件实现扩展**:
- 新增 `ButtonGroup`, `CloseButton`, `Drawer`, `ToggleButton` 等基础组件。
- 增强 `Menu` 组件,引入 `MenuPanel`, `MenuHeader`, `MenuDivider`, `MenuSubmenu` 等子组件以支持复杂菜单结构。
- 完善 `Navbar` 组件,新增 `NavbarBrand`, `NavbarNav`, `NavbarToggler` 等子组件。
- 完善 `Nav` 组件,新增 `NavItem` 和 `NavLink`。
- 增强 `Button` 组件,支持 `link` 变体及 `xs` 尺寸。
- **文档同步更新**:
- 重写了 `Avatar`, `Badge`, `Button`, `Dialog`, `Menu`, `Navbar`, `OverlayBox`, `Spinner`, `Toast` 等核心组件的 MDX 文档,使其符合 Bootstrap 6 的设计指南与示例。
- 更新了 `AGENTS.md` 中的 Bootstrap 源码获取路径。
- 在文档页面中引入了新的交互式 Demo 组件(如 `DialogDemo`, `NavbarDemo`, `ToastDemo`)。
- **功能增强与优化**:
- 为 `NativeDialog` 和 `Navbar` 增加了主题(`theme`)支持。
- 为 `OverlayBox` 增加了自定义类名(`overlayClassName`)支持,便于实现自定义主题。
- 优化了文档页面的布局,引入了 `DocumentationFooter`。
- **测试覆盖**:
- 为新增组件(`ButtonGroup`, `CloseButton`, `Drawer`, `ToggleButton`)编写了单元测试。
- 扩展了现有组件(`Button`, `Menu`, `Nav`, `Navbar`, `OverlayBox`)的测试用例,以验证 Bootstrap 6 的类名与交互逻辑。
通过新增多个核心组件、增强现有组件功能以及升级文档构建流程,进一步完善了基于 Bootstrap 6 的组件库。
主要变更包括:
- **新增组件实现**:
- `ButtonGroup`: 支持水平与垂直布局。
- `Card`: 提供灵活的内容容器。
- `CloseButton`: 用于关闭对话框或抽屉的通用按钮。
- `Drawer`: 基于原生 `<dialog>` 实现的侧边抽屉组件。
- `Grid`: 实现响应式容器、行与列系统,支持断点布尔值配置。
- `Image`: 支持响应式图片与缩略图样式。
- `Nav`: 支持 Tabs、Pills、Underline 等多种导航样式。
- `Table`: 支持条纹、悬停、边框等多种样式变体。
- **文档系统升级**:
- 引入 `remark-gfm` 以支持 Markdown 中的 GitHub 风格表格。
- 配置 Vite 插件,自动为文档中的 `table` 元素添加 `.table` 类名并包裹在 `.table-responsive` 容器中。
- 新增多个组件的 MDX 交互式文档页面。
- 更新侧边栏导航以包含新组件。
- **代码优化与测试**:
- 优化 `Col` 组件的类型定义,支持 `true` 作为响应式断点的简写。
- 为 `ButtonGroup` 和 `Grid` 增加了针对新特性的单元测试。
通过引入全新的交互式文档组件,提升了组件示例的可读性与演示效果。同时清理了不再使用的 `preview` 目录及相关依赖,优化了项目结构。
主要变更包括:
- **文档交互升级**:
- 新增 `LiveRunner` 组件,利用 `LiveTSX` 实现文档页面的实时代码运行。
- 新增 `CodeExample` 与 `LiveExample` 封装组件,支持在文档中同时展示代码块与实时交互演示。
- 新增 `CodeCard` 用于美化代码展示样式。
- 为 `Dialog`、`Loading`、`Select` 等多个组件新增了复杂的交互式 Demo 演示。
- **项目结构清理**:
- 彻底移除 `preview/` 目录及其相关的配置文件(`package.json`, `tsconfig.json` 等)。
- 从 `package.json` 中移除 `react-bootstrap` 依赖及相关的 `preview` 构建脚本。
- 更新 `.npmignore` 以移除对已删除 `preview` 目录的忽略。
- **配置与文档更新**:
- 更新 `document/app/site.ts`,移除已失效的预览站点链接及导航项。
- 更新 `ReadMe.md`,同步移除预览站点的入口说明。
- 优化了各组件 MDX 文档中的示例代码展示方式。
通过改进组件的布局逻辑、样式变量以及文档中的代码展示方式,提升了组件库的视觉一致性与文档的可读性。
主要变更包括:
- **组件样式与逻辑优化**:
- **Overlay 系统**:为 `Popover` 和 `Tooltip` 的箭头(arrow)引入了基于位置的绝对定位类,并为 `OverlayBox` 增加了根据类型(popover/tooltip)自动计算间距(gap)的逻辑。
- **组件细节调整**:优化了 `Menu` 的内联块布局、`Select` 的宽度控制、`VerticalMarquee` 的高度填充以及 `Card` 图片的填充模式。
- **主题变量更新**:将 `OverlayBox` 的自定义样式从旧版 Bootstrap 变量迁移至 Bootstrap 6 的新版变量(如 `var(--bs-primary-bg)`)。
- **文档系统增强**:
- **代码块升级**:在 MDX 文档中全面引入 `CodeBlock` 组件,统一了代码示例的展示风格,并支持了暗色主题(github-dark)。
- **MDX 解析优化**:在 `vite.config.ts` 中新增了 `remarkInlineButtonChildren` 插件,解决了 MDX 解析中内联组件(如 `Button`, `Span` 等)可能导致的段落嵌套问题。
- **测试与配置**:
- 更新了 `OverlayBox`、`Popover` 和 `Tooltip` 的单元测试,以匹配新的类名和布局结构。
- 优化了文档布局的 CSS 样式,确保在暗色模式下代码高亮显示正常。
通过将大型组件拆分为更细粒度的子组件,并优化核心组件的 Props 定义,提升了组件库的可组合性与开发体验。
主要变更包括:
- **组件原子化重构**:
- **Card**:新增 `CardHeader`、`CardBody`、`CardFooter` 和 `CardTitle` 子组件,取代原有的纯 div 布局。
- **Drawer**:新增 `DrawerHeader`、`DrawerTitle`、`DrawerBody` 和 `DrawerFooter` 子组件。
- **NativeDialog**:新增 `DialogHeader`、`DialogTitle`、`DialogBody` 和 `DialogFooter` 子组件。
- **ButtonGroup**:新增 `ButtonToolbar` 组件,用于处理工具栏角色。
- **ListGroup**:新增 `ListGroup` 及 `ListGroupItem` 组件,支持水平、编号及紧凑(flush)模式。
- **API 与逻辑优化**:
- **Grid**:重构 `Row` 组件,支持通过 `cols` 和响应式断点 props(`sm`, `md` 等)直接控制列数,简化了 `row-cols-*` 类名的手动编写。
- **Overlay**:统一了 `Popover` 和 `Tooltip` 的 Props 接口,通过 `OverlayTriggerProps` 实现逻辑复用。
- **Select**:优化了 `SelectProps` 的类型定义,使其更符合 Bootstrap 6 的属性规范。
- **MobX 实践**:将部分类组件中的 `@action` 装饰器改为 `action()` 函数式包装,并优化了异步方法后的状态更新逻辑。
- **文档与测试同步**:
- 更新了所有受影响组件的 MDX 文档示例,使用新的原子化组件进行演示。
- 增加了 `ListGroup` 的单元测试,并同步更新了 `Card`、`Drawer`、`Grid`、`NativeDialog` 等组件的测试用例以匹配新的子组件结构。
新增 ListGroup 组件及其子组件 ListGroupItem,支持多种交互模式与样式。同时更新文档系统以展示新组件。
主要变更:
- **组件实现**:
- 实现 `ListGroup` 容器组件。
- 实现 `ListGroupItem` 组件,支持根据 `href` 或 `type` 属性自动切换渲染为 `<a>`、`<button>` 或 `<li>` 标签。
- 支持 `action`、`active`、`disabled`、`flush` 及 `numbered` 等 Bootstrap 6 风格的属性。
- 为禁用状态的交互元素添加了 `pe-none` 类名及相应的无障碍属性处理。
- **文档更新**:
- 新增 `ListGroup` 的 MDX 示例文档,涵盖基础用法、激活状态、链接与按钮模式、紧凑模式及编号模式。
- 在组件概览页及侧边栏导航中同步添加了 ListGroup 链接。
- **测试增强**:
- 编写 `ListGroup` 的单元测试,验证不同标签渲染逻辑、类名组合以及无障碍属性(aria-current, aria-disabled)的正确性。
TechQuery
approved these changes
Nov 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate every Bootstrap-dependent wrapper in
source/to Bootstrap 6 (6.0.0-alpha.1), replace monolithic components with composable sub-components, and turn the ViNext workspace into a complete, statically exported documentation site.react-bootstrapand the legacypreview/workspace are gone, and the library now runs on React 19 with explicit client boundaries so ViNext can prerender class components.Component library
ButtonGroup/ButtonToolbar,Card(+CardHeader,CardBody,CardFooter,CardTitle,CardText),Grid(Container/Row/Col),Image,Table,ListGroup/ListGroupItem,Spinner,CloseButton,ToggleButton,Drawer(+DrawerHeader,DrawerTitle,DrawerBody,DrawerFooter),DialogHeader/DialogTitle/DialogBody/DialogFooter,Nav/NavItem/NavLink,Popover, andTooltip.Rowacceptscolsplussm/md/lg/xl/2xlbreakpoints;Colacceptsspanand the same breakpoints (truefor equal-width columns).ListGroupsupportsflush,numbered, andhorizontal(boolean or breakpoint);ListGroupItemsupportstheme,action,active, anddisabled.Card,Drawer, andNativeDialogexpose header/title/body/footer parts, so guides never inline structural class names.Menu(MenuPanel,MenuHeader,MenuDivider,MenuSubmenu,MenuItemContent,MenuItemDescription,MenuText) andNavbar(NavbarBrand,NavbarNav,NavbarText,NavbarToggler).ToastContainer,ToastItem,ToastHeader, andToastBody; splitTextTruncate/TypeEchointo folders and addedScrollNavScroller.CodeBlockhighlights JavaScript, JSX, TypeScript, and TSX with Shiki, using paired light/dark themes and inline colors for zero client-side highlighting; React element children are serialized to JSX source.OverlayBoxderives its distance from the popover/tooltip type instead of a fixed offset.UserRankView,NativeDialog,Countdown,Menu,MonthCalendar,OverlayBox,PageNav,ScrollNav.Scroller,TextTruncate/TypeEchocontent,Editor,ShareBox,ClickBoundary) starts with'use client'. ViNext prerenders through React'sreact-serverexport, which does not provideComponent/PureComponent, so a missing directive failed the build withClass extends value undefined.Behavior and API
Toast.open()messages usethemeinstead of the oldvariantfield.NativeDialogkeeps its nativeopenstate in sync with the prop and supportstheme,modal,keyboard, andbackdrop.OverlayBoxgainsoverlayClassNamefor scoped popover/tooltip theming, opens on hover/focus/click, and closes on outside pointer interaction or Esc;PopoverandTooltipshareOverlayTriggerPropsfromOverlay.ts.Navremains server-renderable: disabled links usedisabled pe-nonewitharia-disabled="true"andtabindex="-1"instead of a click interceptor;PageNavreusesNav/NavLinkthroughNavProps.Navbarsupportstheme="dark"and responsiveexpandbreakpoints with drawer-based mobile navigation;Drawersupports all placements plus optional footer content.MenuexposesautoClose(true | 'inside' | 'outside' | false), logicalalign, submenus, and keyboard navigation with focus restoration.Selectprops follow the Bootstrap 6 attribute names, andMonthCalendar/ShareBoxcomposeBadge/Imageinstead of duplicating markup.action(() => …)rather than@actionfield decorators, and state updates afterawaitgo through their own actions.Documentation site
LiveExample,CodeExample,CodeCard, andLiveRunner(built onLiveTSX), plus docs-only interactive demos (DialogDemo,DialogModelDemo,DrawerDemo,LoadingDemo,NavbarDemo,SelectDemo,ToastDemo).CodeBlock, imported directly in the MDX page. The build keeps two small helpers:remarkInlineButtonChildrenunwraps auto-generated paragraphs inside inline wrappers, andrehypeBootstrapTableadds thetableclass and atable-responsivewrapper to Markdown tables. No code-fence AST rewriting.document/dist/client/, and no Tailwind is used.Tooling and tests
3.0.0-alpha.1;react-bootstrapis no longer a runtime dependency and thepreview/workspace with its Parcel build is removed.node:assert/strictand native mocks, covering the new and refactored wrappers (includingListGroup,ButtonGroup,Grid,Drawer,Card,Popover,Tooltip).AGENTS.mdnow documents the Bootstrap upgrade workflow, client-component directives anddisplayName, MobX action conventions, render-method structure, component composition and prop reuse, docs styling rules, testing stages, deployment, and Git workflow.Breaking changes
react-bootstrapis no longer a runtime dependency; Bootstrap 6 CSS is required.themeinstead ofvariant.Card,Drawer,NativeDialog); the old single-elementtitle/dialoglayout props are replaced by sub-components.Validation
tsc --noEmitdocumentworkspacetsc --noEmit(fixed the index signature inTimeDistanceand theRefCallbackreturn types inTypeEcho/animate)TimeDistanceoutput, andTypeEchotyping animation — no console or hydration errorsFixes #75