@1money/component-ui

中文文档
0.2.0发布于 2026/11/05MITTypeScriptESM + CJS近 30 天下载 5099

React Components based on primereact for 1money front-end projects

原始使用文档
文档目录11 节
  1. Live Storybook
  2. Releases
  3. Features
  4. Installation
  5. Quick Start
  6. Components In This Repository
  7. Styling
  8. Development
  9. Required i18n for feature changes
  10. Project Structure
  11. Release Notes

1Money Component UI

This repository contains the source for @1money/component-ui, a React component library used across 1Money front-end projects.

It combines reusable UI components with a 1Money SCSS design system, Storybook for local development, and dual CommonJS/ES module builds for distribution.

Live Storybook

Browse the published component documentation and interactive examples at:

https://1money-co.github.io/1money-components-ui/**

The site is built from the main branch (pnpm build:demo) and deployed to GitHub Pages on every push. For unreleased work on other branches, run Storybook locally with pnpm dev.

Releases

Include a new stable package.json version in a PR to main. PR Release Version checks the version before merge; Auto Tag creates the matching annotated tag and GitHub Release after merge. The tag starts the existing NPM CICD workflow. Repository tooling and documentation alone do not require a release; published MCP server changes do.

See Automatic release tags for the required GitHub App setup, manual prereleases, dry runs, and recovery. pnpm release prepares a version locally; npm publication runs through GitHub Actions.

Features

  • React and TypeScript component library
  • Reusable UI building blocks styled for 1Money products
  • SCSS design system in src/styles/
  • Storybook development server on port 6205
  • Dual build output to lib/ and es/

Installation

Requires React 19 (react and react-dom >=19.0.0). Components take ref as a regular prop and use useId, so React 18 and earlier are not supported.

Install the package and the required React dependencies:

pnpm add @1money/component-ui react react-dom primereact primeicons

Then import the library stylesheet once in your app entrypoint:

import '@1money/component-ui/index.css';

Quick Start

Named imports are available from the root package entry:

import {
  Button,
  Checkbox,
  CheckboxGroup,
  Grid,
  Icons,
  notification,
  Tag,
  Tooltip,
} from '@1money/component-ui';
import '@1money/component-ui/index.css';

export function Example() {
  return (
    <>
      <Grid gutter={[16, 16]}>
        <Grid.Col span={12} md={6}>
          <Button color="primary">Continue</Button>
        </Grid.Col>
        <Grid.Col span={12} md={6}>
          <Checkbox label="Accept terms" />
        </Grid.Col>
        <Grid.Col span={12} md={6}>
          <CheckboxGroup
            options={['Email', 'SMS']}
            defaultValue={['Email']}
          />
        </Grid.Col>
      </Grid>

      <Tag label="Active" color="success" />

      <button id="help-trigger" type="button">
        <Icons name="info" />
      </button>
      <Tooltip anchorSelect="#help-trigger" body="More details" />

      {/*
        notification is a static API. Call it from event handlers,
        effects, or other client-side actions.
      */}
      <Button
        onClick={() =>
          notification.success({
            title: 'Saved',
            body: 'Settings were updated.',
          })
        }
      >
        Show notification
      </Button>
    </>
  );
}

Tree-shakeable subpath imports are also supported:

import { Button } from '@1money/component-ui/Button';
import { Spinner } from '@1money/component-ui/Spinner';

Components In This Repository

The current source tree includes these component modules:

  • Accordion
  • Alert
  • Button
  • Calendar
  • Carousel
  • Cell
  • Checkbox (+ CheckboxGroup)
  • CoachMark
  • Copy (+ Clipboard)
  • Dialog
  • Divider
  • Drawer
  • Dropdown
  • Empty
  • Flex
  • Grid (+ Row, Col)
  • Icons (+ IconWrapper, IconHover)
  • Input
  • Link
  • Navigation (+ Nav, NavigationStepper)
  • notification (static Notification API)
  • Pagination
  • Popconfirm
  • Portal
  • ProForm
  • Progress
  • Radio (+ RadioGroup)
  • ResizeObserver
  • Segment
  • Select
  • Skeleton
  • Slider
  • Space
  • Spinner
  • Step
  • Switch
  • Table (+ VirtualTable)
  • Tabs
  • Tag
  • Tooltip
  • Tour
  • Trigger
  • Typography
  • Upload (+ UploadFileBar)
  • VirtualList

The package manifest defines subpath exports for top-level component modules. Grouped exports such as Row, Col, Nav, and VirtualTable are imported from their parent module subpaths.

Styling

Consumers should import @1money/component-ui/index.css.

When building or updating components inside this repository, SCSS files should import the internal style API:

@use '@/styles/api' as theme;

The style system follows a layered boundary model:

  • theme/ = design-domain API
  • system/ = sx engine
  • recipes/ = library recipe helpers
  • public/ = consumer-facing facade exported by src/styles/_api.scss

Component SCSS should not import system/* or tokens/* directly. theme/functions is reserved for rare library-only reader access such as om-line-height(...) or om-line-height-px(...). The design token and utility system is documented in src/styles/README.md.

Development

Install dependencies:

pnpm install

Start Storybook locally:

pnpm dev

Storybook runs at http://localhost:6205.

Useful commands:

pnpm test
pnpm lint
pnpm build
pnpm new
pnpm new Button -f

Build output is generated in:

  • lib/ for CommonJS
  • es/ for ES modules

Required i18n for feature changes

Every new feature or enhancement must deliver its i18n in the same PR. Cover all library-owned copy, including validation, empty/loading states, tooltips, and accessibility labels. Feature flags and gray releases do not waive this requirement.

  • Maintain the locale contract in src/locale/interface.ts and translations in all supported packs: src/locale/en_US/, src/locale/zh_CN/, src/locale/pt_BR/, and src/locale/es_ES/. Keep required keys and placeholders aligned.
  • Use the existing ConfigProvider locale APIs for defaults and formatting; preserve caller prop overrides, English fallback, and runtime language changes.
  • Review each changed file for i18n, verify all three languages in Storybook, and include check results in the PR. Explain an N/A claim when there is no user-facing copy or locale-sensitive behavior. Missing translations block feature completion and merge.

See the contributor rules and ConfigProvider usage for details.

Project Structure

src/
├── components/   # Component source
├── styles/       # SCSS public/theme/system/recipes/internal layers
└── index.ts      # Root library exports

Release Notes

  • Package name: @1money/component-ui
  • Repository: https://github.com/1Money-Co/1money-components-ui
  • License: MIT

版本与发布记录

@1money/component-ui 共发布 259 个版本,首次发布于 2026/04/09;过去 12 个月发布了 259 个版本。

版本发布日期距今
0.2.0latest2026/11/051 天前
0.2.0-alpha.0alpha2026/11/051 天前
0.1.312026/10/298 天前
0.1.302026/10/298 天前
0.1.292026/10/289 天前
0.1.282026/10/289 天前

关于 @1money/component-ui 的常见问题

@1money/component-ui 是什么?

React Components based on primereact for 1money front-end projects

如何安装 @1money/component-ui?

在项目目录运行 npm install @1money/component-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=19.0.0)、react-dom(>=19.0.0)、primeicons(>=7)、primereact(>=10.9.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 1money-ui-mcp,可以用 npx 1money-ui-mcp 直接运行。

@1money/component-ui 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@1money/component-ui 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@1money/component-ui 可以商用吗?

@1money/component-ui 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@1money/component-ui 的下载量有多少?

根据 npm 官方下载统计,@1money/component-ui 在 2026/10/05 – 2026/11/03 这 30 天内被下载 5,099 次,日均约 170 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@1money/component-ui 还在维护吗?

最新版本 0.2.0 发布于 2026/11/05(1 天前);至今共发布 259 个版本,其中过去 12 个月发布了 259 个;首次发布于 2026/04/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。