@ews-admin/global-design-system

中文文档
1.40.0发布于 2026/11/10MITTypeScriptESM + CJS近 30 天下载 2128

EWS Global Design System - Reusable components for EWS applications

原始使用文档
文档目录25 节
  1. Features
  2. Installation
  3. Quick Start
  4. Components
  5. Button
  6. Input
  7. Icons
  8. Utilities
  9. Class Name Utility
  10. Formatting Utilities
  11. ID Generation
  12. Development
  13. Prerequisites
  14. Setup
  15. Storybook
  16. Publishing
  17. Prerequisites for Publishing
  18. Publishing Steps
  19. Version Management
  20. Additional Scripts
  21. Project Structure
  22. Hosted here
  23. Contributing
  24. License
  25. Support

EWS Global Design System

A comprehensive design system for EWS (Erco Web Solutions) applications, providing reusable React components, icons, and utilities.

Features

  • 🎨 Consistent Design: Unified design language across all EWS applications
  • 📦 NPM Package: Easy to install and use in any React project
  • 📚 Storybook: Interactive component documentation and testing
  • 🎯 TypeScript: Full TypeScript support with type definitions
  • 🎨 Customizable: Flexible theming and styling options
  • ♿ Accessible: Built with accessibility best practices.

Installation

pnpm add @ews-admin/global-design-system

Quick Start

import { Button, Input, ArrowRight } from "@ews-admin/global-design-system";

function App() {
  return (
    <div>
      <Button variant="ews-primary" rightIcon={<ArrowRight />}>
        Click me
      </Button>
      <Input label="Email" placeholder="Enter your email" type="email" />
    </div>
  );
}

Components

Button

A versatile button component with multiple variants and sizes.

<Button variant="ews-primary" size="md" loading={false}>
  Button Text
</Button>

Props:

  • variant: 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'outline'
  • size: 'sm' | 'md' | 'lg'
  • loading: boolean
  • fullWidth: boolean
  • leftIcon: ReactNode
  • rightIcon: ReactNode

Input

A flexible input component with validation states and icons.

<Input
  label="Email"
  placeholder="Enter your email"
  variant="default"
  helperText="We'll never share your email"
/>

Props:

  • variant: 'default' | 'error' | 'success'
  • size: 'sm' | 'md' | 'lg'
  • label: string
  • helperText: string
  • error: string
  • leftIcon: ReactNode
  • rightIcon: ReactNode

Icons

The design system includes a set of commonly used icons:

import { ArrowRight, Check, Search } from '@ews/global-design-system';

<ArrowRight size="md" color="#2563eb" />
<Check size="lg" />
<Search size="sm" />

Utilities

Class Name Utility

import { cn } from "@ews-admin/global-design-system";

const className = cn("px-4 py-2", "bg-blue-500", "text-white");

Formatting Utilities

import { formatCurrency, formatDate } from "@ews-admin/global-design-system";

formatCurrency(1234.56); // "$1,234.56"
formatDate(new Date()); // "December 7, 2023"

ID Generation

import { generateId } from "@ews/global-design-system";

const id = generateId("prefix"); // "prefix-abc123def"

Development

Prerequisites

  • Node.js 16+
  • pnpm (recommended) or npm

Setup

# Install dependencies
pnpm install

# Start Storybook
pnpm storybook

# Build the package
pnpm build

# Run linting
pnpm lint

# Run type checking
pnpm type-check

Storybook

The design system includes a comprehensive Storybook for component documentation and testing:

pnpm storybook

Visit http://localhost:6006 to view the Storybook.

Publishing

Prerequisites for Publishing

  1. Login to npm:

    npm login
    
  2. Create @ews-admin organization (if not already created):

Publishing Steps

  1. Build the package:

    pnpm build
    
  2. Publish to npm:

    pnpm publish:public
    
  3. Verify publication:

    pnpm view
    

Version Management

  • Patch version (bug fixes): pnpm publish:patch
  • Minor version (new features): pnpm publish:minor
  • Major version (breaking changes): pnpm publish:major

Additional Scripts

  • Clean build directory: pnpm clean
  • Rebuild from scratch: pnpm rebuild
  • Version only (without publishing):
    • pnpm version:patch
    • pnpm version:minor
    • pnpm version:major

Project Structure

src/
├── components/          # React components
│   ├── Button/
│   └── Input/
├── icons/              # Icon components
│   ├── Icon.tsx
│   ├── ArrowRight.tsx
│   ├── Check.tsx
│   └── Search.tsx
├── utils/              # Utility functions
│   └── index.ts
├── styles/             # Global styles
│   └── index.css
└── index.ts           # Main export file

stories/               # Storybook stories
├── Components/
├── Icons/
└── Utils/

Hosted here

See our hosted site here

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add stories for new components
  5. Run tests and linting
  6. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

For questions and support, please contact the EWS development team.

版本与发布记录

@ews-admin/global-design-system 共发布 60 个版本,首次发布于 2025/09/14;过去 12 个月发布了 44 个版本。

版本发布日期距今
1.40.0latest2026/11/104 天前
1.39.02026/11/095 天前
1.38.02026/11/095 天前
1.37.02026/11/086 天前
1.36.02026/11/086 天前
1.35.02026/10/3114 天前

关于 @ews-admin/global-design-system 的常见问题

@ews-admin/global-design-system 是什么?

EWS Global Design System - Reusable components for EWS applications

如何安装 @ews-admin/global-design-system?

在项目目录运行 npm install @ews-admin/global-design-system,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.2.0)、react-dom(^18.2.0)、react-hook-form(^7.51.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ews-admin/global-design-system 支持 TypeScript 吗?

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

@ews-admin/global-design-system 支持 ESM 还是 CommonJS?

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

@ews-admin/global-design-system 可以商用吗?

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

@ews-admin/global-design-system 的下载量有多少?

根据 npm 官方下载统计,@ews-admin/global-design-system 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,128 次,日均约 71 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ews-admin/global-design-system 还在维护吗?

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