Skip to content

Commit e3fe014

Browse files
committed
init
0 parents  commit e3fe014

File tree

16 files changed

+402
-0
lines changed

16 files changed

+402
-0
lines changed

.circleci/config.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: 2
2+
jobs:
3+
lint:
4+
docker:
5+
- image: circleci/node:latest
6+
steps:
7+
- checkout
8+
- restore_cache:
9+
keys:
10+
- v1-dependencies-{{ checksum "package.json" }}
11+
- run: npm install
12+
- run: npm run init-tslint
13+
- save_cache:
14+
paths:
15+
- node_modules
16+
key: v1-dependencies-{{ checksum "package.json" }}
17+
- run: npm run lint
18+
test:
19+
docker:
20+
- image: circleci/node:latest
21+
working_directory: ~/repo
22+
steps:
23+
- checkout
24+
- restore_cache:
25+
keys:
26+
- v1-dependencies-{{ checksum "package.json" }}
27+
- run: npm install
28+
- run: npm run init-tslint
29+
- save_cache:
30+
paths:
31+
- node_modules
32+
key: v1-dependencies-{{ checksum "package.json" }}
33+
- run: npm test -- --coverage
34+
workflows:
35+
version: 2
36+
build_and_test:
37+
jobs:
38+
- lint
39+
- test

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*.{js,css}]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
indent_style = space
9+
indent_size = 2

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
*.iml
2+
*.log
3+
.idea/
4+
.ipr
5+
.iws
6+
*~
7+
~*
8+
*.diff
9+
*.patch
10+
*.bak
11+
.DS_Store
12+
Thumbs.db
13+
.project
14+
.*proj
15+
.svn/
16+
*.swp
17+
*.swo
18+
*.pyc
19+
*.pyo
20+
.build
21+
node_modules
22+
.cache
23+
dist
24+
assets/**/*.css
25+
build
26+
lib
27+
coverage
28+
.vscode
29+
yarn.lock
30+
es/
31+
package-lock.json
32+
src/*.js
33+
src/*.map
34+
.prettierrc
35+
jest.config.js
36+
tsconfig.json
37+
tslint.json
38+
tsconfig.test.json
39+
.eslintrc.js
40+
.prettierignore

HISTORY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# History
2+
----

LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019-present alipay.com
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# rc-select
2+
---
3+
4+
React Select
5+
6+
[![NPM version][npm-image]][npm-url]
7+
[![build status][travis-image]][travis-url]
8+
[![Test coverage][coveralls-image]][coveralls-url]
9+
[![Dependencies](https://img.shields.io/david/react-component/select.svg?style=flat-square)](https://david-dm.org/react-component/select)
10+
[![DevDependencies](https://img.shields.io/david/dev/react-component/select.svg?style=flat-square)](https://david-dm.org/react-component/select?type=dev)
11+
[![npm download][download-image]][download-url]
12+
[![Storybook](https://gw.alipayobjects.com/mdn/ob_info/afts/img/A*CQXNTZfK1vwAAAAAAAAAAABjAQAAAQ/original)](https://github.com/react-component/select)
13+
14+
[Storybook]: https://github.com/storybooks/press/blob/master/badges/storybook.svg
15+
[npm-image]: http://img.shields.io/npm/v/rc-select.svg?style=flat-square
16+
[npm-url]: http://npmjs.org/package/rc-select
17+
[travis-image]: https://img.shields.io/travis/react-component/select.svg?style=flat-square
18+
[travis-url]: https://travis-ci.org/react-component/select
19+
[coveralls-image]: https://img.shields.io/coveralls/react-component/select.svg?style=flat-square
20+
[coveralls-url]: https://coveralls.io/r/react-component/select?branch=maste
21+
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
22+
[node-url]: http://nodejs.org/download/
23+
[download-image]: https://img.shields.io/npm/dm/rc-select.svg?style=flat-square
24+
[download-url]: https://npmjs.org/package/rc-select
25+
26+
## Screenshots
27+
28+
<img src="https://user-images.githubusercontent.com/8186664/50768510-a8b30680-12bb-11e9-8251-0e0ed82c5076.png" />
29+
30+
## Feature
31+
32+
* support ie9,ie9+,chrome,firefox,safari
33+
34+
### Keyboard
35+
36+
* Open select (focus input || focus and click)
37+
* KeyDown/KeyUp/Enter to navigate menu
38+
39+
## install
40+
41+
[![rc-select](https://nodei.co/npm/rc-select.png)](https://npmjs.org/package/rc-select)
42+
43+
## Usage
44+
45+
### basic use
46+
47+
```js
48+
import Select, {Option, OptGroup} from 'rc-select';
49+
50+
var c = (
51+
<Select>
52+
<Option value="jack">jack</Option>
53+
<Option value="lucy">lucy</Option>
54+
<Option value="yiminghe">yiminghe</Option>
55+
</Select>
56+
);
57+
React.render(c, container);
58+
```
59+
60+
## API
61+
62+
### Select props
63+
64+
| name | description | type | default |
65+
|----------|----------------|----------|--------------|
66+
|id | html id to set on the component wrapper | String | '' |
67+
|className | additional css class of root dom node | String | '' |
68+
|data-\* | html data attributes to set on the component wrapper | String | '' |
69+
|prefixCls | prefix class | String | '' |
70+
|animation | dropdown animation name. only support slide-up now | String | '' |
71+
|transitionName | dropdown css animation name | String | '' |
72+
|choiceTransitionName | css animation name for selected items at multiple mode | String | '' |
73+
|dropdownMatchSelectWidth | whether dropdown's with is same with select | bool | true |
74+
|dropdownClassName | additional className applied to dropdown | String | - |
75+
|dropdownStyle | additional style applied to dropdown | Object | {} |
76+
|dropdownAlign | additional align applied to dropdown | Object | {} |
77+
|dropdownMenuStyle | additional style applied to dropdown menu | Object | {} |
78+
|notFoundContent | specify content to show when no result matches. | String | 'Not Found' |
79+
|tokenSeparators | separator used to tokenize on tag/multiple mode | string[]? | |
80+
|open | control select open | bool | |
81+
|defaultOpen | control select default open | bool | |
82+
|placeholder | select placeholder | React Node | |
83+
|showSearch | whether show search input in single mode | bool | true |
84+
|showArrow | whether show arrow | bool | true (single mode), false (multiple mode) |
85+
|allowClear | whether allowClear | bool | false |
86+
|tags | when tagging is enabled the user can select from pre-existing options or create a new tag by picking the first choice, which is what the user has typed into the search box so far. | bool | false |
87+
|maxTagTextLength | max tag text length to show | number | - |
88+
|maxTagCount | max tag count to show | number | - |
89+
|maxTagPlaceholder | placeholder for omitted values | ReactNode/function(omittedValues) | - |
90+
|combobox | enable combobox mode(can not set multiple at the same time) | bool | false |
91+
|multiple | whether multiple select | bool | false |
92+
|disabled | whether disabled select | bool | false |
93+
|filterOption | whether filter options by input value. default filter by option's optionFilterProp prop's value | bool | true/Function(inputValue:string, option:Option) |
94+
|optionFilterProp | which prop value of option will be used for filter if filterOption is true | String | 'value' |
95+
|optionLabelProp | render option value or option children as content of select | String: 'value'/'children' | 'value' |
96+
|defaultValue | initial selected option(s) | String/Array<String> | - |
97+
|value | current selected option(s) | String/Array<String>/{key:String, label:React.Node}/Array<{key, label}> | - |
98+
|firstActiveValue | first active value when there is no value | String/Array<String> | - |
99+
|labelInValue| whether to embed label in value, see above value type | Bool | false |
100+
|backfill| whether backfill select option to search input (Only works in single and combobox mode) | Bool | false |
101+
|onChange | called when select an option or input value change(combobox) | function(value, option:Option/Array<Option>) | - |
102+
|onSearch | called when input changed | function | - |
103+
|onBlur | called when blur | function | - |
104+
|onFocus | called when focus | function | - |
105+
|onPopupScroll | called when menu is scrolled | function | - |
106+
|onSelect | called when a option is selected. param is option's value and option instance | Function(value, option:Option) | - |
107+
|onDeselect | called when a option is deselected. param is option's value. only called for multiple or tags | Function(value, option:Option) | - |
108+
|onInputKeyDown | called when key down on input | Function(event) | - |
109+
|defaultActiveFirstOption | whether active first option by default | bool | true |
110+
|getPopupContainer | container which popup select menu rendered into | function(trigger:Node):Node | function(){return document.body;} |
111+
|getInputElement| customize input element | function(): Element | - |
112+
|showAction| actions trigger the dropdown to show | String[]? | - |
113+
|autoFocus| focus select after mount | Bool | - |
114+
| autoClearSearchValue | auto clear search input value when multiple select is selected/deselected | boolean | true |
115+
| inputIcon | specify the select arrow icon | ReactNode | - |
116+
| clearIcon | specify the clear icon | ReactNode | - |
117+
| removeIcon | specify the remove icon | ReactNode | - |
118+
| menuItemSelectedIcon | specify the remove icon | ReactNode \| (props: MenuItemProps) => ReactNode | - |
119+
| dropdownRender | render custom dropdown menu | (menu: React.Node, props: MenuProps) => ReactNode | - |
120+
| loading | show loading icon in arrow | Boolean | false |
121+
122+
### Methods
123+
124+
| name | description | parameters | return |
125+
|----------|----------------|----------|--------------|
126+
|focus | focus select programmably | - | - |
127+
|blur | blur select programmably | - | - |
128+
129+
### Option props
130+
131+
| name | description | type | default |
132+
|----------|----------------|----------|--------------|
133+
|className | additional class to option | String | '' |
134+
|disabled | no effect for click or keydown for this item | bool | false |
135+
|key | if react want you to set key, then key is same as value, you can omit value | String/number | - |
136+
|value | default filter by this attribute. if react want you to set key, then key is same as value, you can omit value | String/number | - |
137+
|title | if you are not satisfied with auto-generated `title` which is show while hovering on selected value, you can customize it with this property | String | - |
138+
139+
140+
### OptGroup props
141+
142+
| name | description | type | default |
143+
|----------|----------------|----------|--------------|
144+
|label | group label | String/React.Element | - |
145+
|key | - | String | - |
146+
|value | default filter by this attribute. if react want you to set key, then key is same as value, you can omit value | String | - |
147+
148+
149+
## Development
150+
151+
```
152+
npm install
153+
npm start
154+
```
155+
156+
## Example
157+
158+
http://localhost:9001/
159+
160+
online example: http://react-component.github.io/select/
161+
162+
## Test Case
163+
164+
```
165+
npm test
166+
```
167+
168+
## Coverage
169+
170+
```
171+
npm run coverage
172+
```
173+
174+
175+
## License
176+
177+
rc-select is released under the MIT license.

assets/index.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@mentionsPrefixCls: rc-mentions;

examples/basic.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* eslint no-console: 0 */
2+
3+
import React from 'react';
4+
// import Mentions from '../src';
5+
import '../assets/index.less';
6+
7+
class Demo extends React.Component {
8+
render() {
9+
return null;
10+
}
11+
}
12+
13+
export default Demo;

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
module.exports = require('./src/');

now.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 2,
3+
"name": "rc-mentions",
4+
"builds": [
5+
{
6+
"src": "package.json",
7+
"use": "@now/static-build",
8+
"config": { "distDir": "build" }
9+
}
10+
]
11+
}

0 commit comments

Comments
 (0)