Skip to content

Commit 6379138

Browse files
authored
Merge branch 'master' into master
2 parents 3686094 + c0dd6ed commit 6379138

File tree

19 files changed

+975
-375
lines changed

19 files changed

+975
-375
lines changed

.dumirc.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import { defineConfig } from 'dumi';
22

3+
const basePath = process.env.GH_PAGES ? '/input/' : '/';
4+
const publicPath = process.env.GH_PAGES ? '/input/' : '/';
5+
36
export default defineConfig({
47
mfsu: false,
58
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
69
themeConfig: {
710
name: 'Input',
811
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
912
},
13+
outputPath: '.doc',
14+
base: basePath,
15+
publicPath,
1016
});

.github/workflows/main.yml

Lines changed: 5 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,6 @@
1-
name: CI
2-
3-
on:
4-
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
8-
1+
name: ✅ test
2+
on: [push, pull_request]
93
jobs:
10-
setup:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: checkout
14-
uses: actions/checkout@master
15-
16-
- uses: actions/setup-node@v1
17-
with:
18-
node-version: '12'
19-
20-
- name: cache package-lock.json
21-
uses: actions/cache@v2
22-
with:
23-
path: package-temp-dir
24-
key: lock-${{ github.sha }}
25-
26-
- name: create package-lock.json
27-
run: npm i --package-lock-only
28-
29-
- name: hack for singe file
30-
run: |
31-
if [ ! -d "package-temp-dir" ]; then
32-
mkdir package-temp-dir
33-
fi
34-
cp package-lock.json package-temp-dir
35-
36-
- name: cache node_modules
37-
id: node_modules_cache_id
38-
uses: actions/cache@v2
39-
with:
40-
path: node_modules
41-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
42-
43-
- name: install
44-
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
45-
run: npm ci
46-
47-
lint:
48-
runs-on: ubuntu-latest
49-
steps:
50-
- name: checkout
51-
uses: actions/checkout@master
52-
53-
- name: restore cache from package-lock.json
54-
uses: actions/cache@v2
55-
with:
56-
path: package-temp-dir
57-
key: lock-${{ github.sha }}
58-
59-
- name: restore cache from node_modules
60-
uses: actions/cache@v2
61-
with:
62-
path: node_modules
63-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
64-
65-
- name: lint
66-
run: npm run lint
67-
68-
needs: setup
69-
70-
compile:
71-
runs-on: ubuntu-latest
72-
steps:
73-
- name: checkout
74-
uses: actions/checkout@master
75-
76-
- name: restore cache from package-lock.json
77-
uses: actions/cache@v2
78-
with:
79-
path: package-temp-dir
80-
key: lock-${{ github.sha }}
81-
82-
- name: restore cache from node_modules
83-
uses: actions/cache@v2
84-
with:
85-
path: node_modules
86-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
87-
88-
- name: compile
89-
run: npm run compile
90-
91-
needs: setup
92-
93-
coverage:
94-
runs-on: ubuntu-latest
95-
steps:
96-
- name: checkout
97-
uses: actions/checkout@master
98-
99-
- name: restore cache from package-lock.json
100-
uses: actions/cache@v2
101-
with:
102-
path: package-temp-dir
103-
key: lock-${{ github.sha }}
104-
105-
- name: restore cache from node_modules
106-
uses: actions/cache@v2
107-
with:
108-
path: node_modules
109-
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
110-
111-
- name: coverage
112-
run: npm test -- --coverage && bash <(curl -s https://codecov.io/bash)
113-
114-
needs: setup
4+
test:
5+
uses: react-component/rc-test/.github/workflows/test.yml@main
6+
secrets: inherit

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ dist/
4040
# dumi
4141
.dumi/tmp
4242
.dumi/tmp-production
43+
.node
44+
bun.lockb

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
# rc-input ⌨️
22

3-
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![Dependencies][david-image]](david-url) [![DevDependencies][david-dev-image]][david-dev-url] [![bundle size][bundlephobia-image]][bundlephobia-url]
3+
[![NPM version][npm-image]][npm-url]
4+
[![npm download][download-image]][download-url]
5+
[![build status][github-actions-image]][github-actions-url]
6+
[![Codecov][codecov-image]][codecov-url]
7+
[![bundle size][bundlephobia-image]][bundlephobia-url]
8+
[![dumi][dumi-image]][dumi-url]
49

510
[npm-image]: http://img.shields.io/npm/v/rc-input.svg?style=flat-square
6-
[npm-url]: http://npmjs.org/package/rc-input
11+
[npm-url]: http://npmjs.org/package/rc-select
12+
[travis-image]: https://img.shields.io/travis/react-component/input/master?style=flat-square
13+
[travis-url]: https://travis-ci.com/react-component/input
714
[github-actions-image]: https://github.com/react-component/input/workflows/CI/badge.svg
815
[github-actions-url]: https://github.com/react-component/input/actions
916
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/input/master.svg?style=flat-square
10-
[codecov-url]: https://codecov.io/gh/react-component/input/branch/master
17+
[codecov-url]: https://app.codecov.io/gh/react-component/input
1118
[david-url]: https://david-dm.org/react-component/input
1219
[david-image]: https://david-dm.org/react-component/input/status.svg?style=flat-square
1320
[david-dev-url]: https://david-dm.org/react-component/input?type=dev
1421
[david-dev-image]: https://david-dm.org/react-component/input/dev-status.svg?style=flat-square
15-
[download-image]: https://img.shields.io/npm/dm/rc-input.svg?style=flat-square
16-
[download-url]: https://npmjs.org/package/rc-input
17-
[bundlephobia-url]: https://bundlephobia.com/result?p=rc-input
18-
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-input
22+
[download-image]: https://img.shields.io/npm/dm/rc-select.svg?style=flat-square
23+
[download-url]: https://npmjs.org/package/rc-select
24+
[bundlephobia-url]: https://bundlephobia.com/package/rc-select
25+
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-select
26+
[dumi-url]: https://github.com/umijs/dumi
27+
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
1928

2029
## Install
2130

assets/index.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
.rc-input {
2+
&-out-of-range {
3+
color: red;
4+
}
5+
26
&-affix-wrapper {
37
padding: 2px 8px;
48
overflow: hidden;

bunfig.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[install]
2+
peer = false

docs/examples/addon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import Input from 'rc-input';
12
import type { FC } from 'react';
23
import React from 'react';
34
import '../../assets/index.less';
4-
import Input from 'rc-input';
55

66
const Demo: FC = () => {
77
return (

docs/examples/show-count.tsx

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,68 @@
1+
import Input from 'rc-input';
12
import type { FC } from 'react';
23
import React from 'react';
34
import '../../assets/index.less';
4-
import Input from 'rc-input';
5+
6+
const sharedHeadStyle: React.CSSProperties = {
7+
margin: 0,
8+
padding: 0,
9+
};
510

611
const Demo: FC = () => {
7-
return <Input prefixCls="rc-input" showCount />;
12+
return (
13+
<div
14+
style={{
15+
display: 'flex',
16+
flexDirection: 'column',
17+
gap: 16,
18+
alignItems: 'start',
19+
}}
20+
>
21+
<h3 style={sharedHeadStyle}>Native</h3>
22+
<Input prefixCls="rc-input" showCount defaultValue="👨‍👩‍👧‍👦" />
23+
<Input prefixCls="rc-input" showCount defaultValue="👨‍👩‍👧‍👦" maxLength={20} />
24+
<h3 style={sharedHeadStyle}>Count</h3>
25+
<h4 style={sharedHeadStyle}>Only Max</h4>
26+
<Input
27+
placeholder="count.max"
28+
prefixCls="rc-input"
29+
defaultValue="🔥"
30+
count={{
31+
show: true,
32+
max: 5,
33+
}}
34+
/>
35+
<h4 style={sharedHeadStyle}>Customize strategy</h4>
36+
<Input
37+
placeholder="Emoji count 1"
38+
prefixCls="rc-input"
39+
defaultValue="🔥"
40+
count={{
41+
show: true,
42+
max: 5,
43+
strategy: (val) => [...new Intl.Segmenter().segment(val)].length,
44+
}}
45+
/>
46+
<h4 style={sharedHeadStyle}>Customize exceedFormatter</h4>
47+
<Input
48+
placeholder="Emoji count 1"
49+
prefixCls="rc-input"
50+
defaultValue="🔥"
51+
count={{
52+
show: true,
53+
max: 5,
54+
exceedFormatter: (val, { max }) => {
55+
const segments = [...new Intl.Segmenter().segment(val)];
56+
57+
return segments
58+
.filter((seg) => seg.index + seg.segment.length <= max)
59+
.map((seg) => seg.segment)
60+
.join('');
61+
},
62+
}}
63+
/>
64+
</div>
65+
);
866
};
967

1068
export default Demo;

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rc-input",
3-
"version": "1.1.0",
3+
"version": "1.6.4",
44
"description": "React input component",
55
"keywords": [
66
"react",
@@ -32,15 +32,15 @@
3232
"docs:build": "dumi build",
3333
"docs:deploy": "gh-pages -d .doc",
3434
"compile": "father build && lessc assets/index.less assets/index.css",
35-
"gh-pages": "npm run docs:build && npm run docs:deploy",
35+
"gh-pages": "GH_PAGES=1 npm run docs:build && npm run docs:deploy",
3636
"prepublishOnly": "npm run compile && np --yolo --no-publish",
3737
"postpublish": "npm run gh-pages",
3838
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
3939
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
4040
"pretty-quick": "pretty-quick",
4141
"lint-staged": "lint-staged",
42-
"test": "umi-test test",
43-
"coverage": "father test --coverage",
42+
"test": "rc-test",
43+
"coverage": "rc-test --coverage",
4444
"prepare": "husky install"
4545
},
4646
"dependencies": {
@@ -61,7 +61,7 @@
6161
"cross-env": "^7.0.2",
6262
"dumi": "^2.1.14",
6363
"eslint": "^7.0.0",
64-
"father": "^4",
64+
"father": "^4.3.7",
6565
"gh-pages": "^3.1.0",
6666
"husky": "^8.0.1",
6767
"less": "^3.10.3",
@@ -70,10 +70,10 @@
7070
"prettier": "^2.0.5",
7171
"pretty-quick": "^3.0.0",
7272
"rc-dialog": "^9.1.0",
73+
"rc-test": "^7.0.15",
7374
"react": "^18.0.0",
7475
"react-dom": "^18.0.0",
75-
"typescript": "^4.0.5",
76-
"umi-test": "^1.9.7"
76+
"typescript": "^4.0.5"
7777
},
7878
"peerDependencies": {
7979
"react": ">=16.0.0",

0 commit comments

Comments
 (0)