# fan.zhang-ui

> 喜马拉雅国际版前端基础组件库

Latest version **1.0.1** (published 2022-12-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install fan.zhang-ui
pnpm add fan.zhang-ui
yarn add fan.zhang-ui
bun add fan.zhang-ui
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-12-27 |
| First published | 2022-12-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.11 |
| Dependencies | 11 |
| Unpacked size | 1.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | zhangfan999999 |

## Links

- npm: https://www.npmjs.com/package/fan.zhang-ui
- npm.io page: https://npm.io/package/fan.zhang-ui

## Dependencies (11)

- [keycode](https://npm.io/package/keycode.md) ^2.2.0
- [omit.js](https://npm.io/package/omit.js.md) ^1.0.2
- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [enquire.js](https://npm.io/package/enquire.js.md) ^2.1.6
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [memoize-one](https://npm.io/package/memoize-one.md) ^5.0.2
- [ua-parser-js](https://npm.io/package/ua-parser-js.md) ^0.7.20
- [intersection-observer](https://npm.io/package/intersection-observer.md) ^0.10.0
- [react-transition-group](https://npm.io/package/react-transition-group.md) ^4.3.0
- [hoist-non-react-statics](https://npm.io/package/hoist-non-react-statics.md) ^3.3.0
- [react-intersection-observer](https://npm.io/package/react-intersection-observer.md) ^8.26.2

## Recent versions

- 1.0.1 (latest) — 2022-12-27

## README

# cat-ui

喜马拉雅国际版前端基础组件库

# 预览地址

http://static2.test.ximalaya.com/yx/cat-ui/last/out/index.html

## 安装

```shell
npm install fan.zhang-ui
```

or

```shell
yarn add fan.zhang-ui
```

**发布到云效**

```
yarn build:storybook
yarn xpm3-test
```

**发布版本**

```
yarn release
npm publish
```

## 使用

### 1 在入口中导入 `css` 文件

```js
// index.js
import 'fan.zhang-ui/styles/index.css';

// 如果需要引入全局的normalize.css或者reset.css
import 'fan.zhang-ui/styles/common/normalize.css';
import 'fan.zhang-ui/styles/common/reset.css';
```

### 2 使用组件

```jsx
import { Button } from 'fan.zhang-ui';

const App = () => {
  return <Button>Add</Button>;
};

export default App;
```

### 3 组件按需加载

- `npm install babel-plugin-import -D` 下载 `babel-plugin-import` 插件
- 配置 `babel-plugin-import` 插件：

webpack.config.js

```js
/**
 * css name covert
 * 1 Button => button
 * 2 ElementSelect => element-select
 * @param {string} name 组件名称
 */
const cssNameConvert = function(name) {
  const len = name.length;
  let ret = '';
  for (let i = 0; i < len; i++) {
    const charCode = name.charCodeAt(i);
    if (charCode >= 65 && charCode <= 90) {
      ret +=
        i === 0
          ? String.fromCharCode(charCode + 32)
          : `-${String.fromCharCode(charCode + 32)}`;
    } else {
      ret += name[i];
    }
  }
  return ret;
};

module.exprots = {
  module: {
    rules: [
      {
        {
          test: /\.(js|mjs|jsx|ts|tsx)$/,
          loader: require.resolve('babel-loader'),
          options: {
            plugins: [
              [
                'import',
                {
                  libraryName: 'fan.zhang-ui',
                  libraryDirectory: 'lib/components',
                  "camel2DashComponentName": false,
                  customStyleName: name => {
                    const newName = cssNameConvert(name);
                    return `fan.zhang-ui/styles/${newName}.css`;
                  }
                }
              ]
            ]
          }
        }
      }
    ]
  }
}
```

## 开发流程

[开发流程](./docs/开发流程.md)

## 更新日志

[更新日志](./changelog.md)

---
_Source: https://npm.io/package/fan.zhang-ui · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
