Skip to content

Commit efa6b1d

Browse files
version 1.0.0
1 parent c0df4d7 commit efa6b1d

23 files changed

+16248
-45
lines changed

.babelrc.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
const output = process.env.BABEL_OUTPUT;
4+
const modules = output == null ? false : output;
5+
const options = {
6+
presets: [['@babel/env', {loose: true, modules}], '@babel/react'],
7+
plugins: ['@babel/plugin-transform-react-jsx'],
8+
env: {
9+
test: {
10+
// extra configuration for process.env.NODE_ENV === 'test'
11+
presets: ['@babel/env'], // overwrite env-config from above with transpiled module syntax
12+
},
13+
},
14+
};
15+
16+
module.exports = options;

.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#ide
2+
3+
# dependencies
4+
/node_modules
5+
example/node_modules
6+
/.pnp
7+
.pnp.js
8+
9+
# testing
10+
/coverage
11+
/sandbox
12+
13+
# production
14+
/build
15+
/lib
16+
/dist
17+
18+
# demo
19+
/demo
20+
21+
# misc
22+
.DS_Store
23+
.env.local
24+
.env.development.local
25+
.env.test.local
26+
.env.production.local
27+
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*

.npmignore

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#ide
2+
/.vscode
3+
4+
# dependencies
5+
/node_modules
6+
/.pnp
7+
.pnp.js
8+
9+
# production
10+
webpack*
11+
rollup*
12+
.babelrc.js
13+
14+
#development
15+
/sandbox
16+
17+
#demo
18+
/example
19+
index.html
20+
/demo
21+
22+
# testing
23+
/coverage
24+
25+
# misc
26+
.DS_Store
27+
.env.local
28+
.env.development.local
29+
.env.test.local
30+
.env.production.local
31+
32+
npm-debug.log*
33+
yarn-debug.log*
34+
yarn-error.log*

.prettierignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#ide
2+
/.vscode
3+
4+
# dependencies
5+
/node_modules
6+
example/node_modules
7+
/.pnp
8+
.pnp.js
9+
10+
# testing
11+
/coverage
12+
13+
# production
14+
/build
15+
/lib
16+
/dist
17+
18+
# demo
19+
/demo
20+
21+
# misc
22+
.DS_Store
23+
.env.local
24+
.env.development.local
25+
.env.test.local
26+
.env.production.local
27+
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*

.prettierrc.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"arrowParens": "always",
3+
"bracketSpacing": false,
4+
"jsxBracketSameLine": true,
5+
"printWidth": 120,
6+
"semi": true,
7+
"singleQuote": true,
8+
"tabWidth": 2,
9+
"trailingComma": "all",
10+
"useTabs": false,
11+
"proseWrap": "never"
12+
}

.vscode/settings.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"[javascript]": {
4+
"editor.formatOnPaste": true,
5+
"editor.formatOnSave": true,
6+
},
7+
"editor.formatOnPaste": true,
8+
"editor.formatOnSave": true,
9+
}

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

CODE_OF_CONDUCT.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Contributing
2+
3+
## Semantic Versioning
4+
5+
`react-custom-search-list` follows semantic versioning. We release patch versions for critical bugfixes, minor versions for new features or non-essential changes, and major versions for any breaking changes.
6+
7+
## Proposing a Change
8+
9+
Patches for bugfixes are always welcome. Please accompany pull requests for bugfixes with a test case that is fixed by the PR. If you want to implement a new feature, It is advised to open an issue first in the GitHub.
10+
11+
## Before submitting a pull request, please make sure the following is done:
12+
13+
- Fork the repository and create your branch from `main`.
14+
- If you’ve fixed a bug or added code that should be tested, add tests.
15+
- Ensure the test suite passes : `$ npm run test`
16+
- Format your code with prettier.
17+
- Make sure you don't check-in any ESLint violations : `$ npm run lint`
18+
- Update README with appropriate docs.
19+
- Commit and PR

README.md

+45-45
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Whether you want to showcase a constant list of options or dynamically adapt to
1313
- Clear button
1414

1515
- `Rtl` support
16-
16+
1717
- Flexible style
1818

1919
## Installation
@@ -27,79 +27,79 @@ or
2727
If you need to directly include script in your html, use the following links :
2828

2929
```js
30-
<script src="https://unpkg.com/react-custom-search-list@latest/dist/react-custom-search-list.min.js"></script>
30+
<script src="https://unpkg.com/react-custom-search-list@latest/dist/react-custom-search-list.umd.min.js"></script>
3131
```
3232

3333
## Minimal Usage
3434

3535
```js
3636
import {useState} from 'react';
3737
import ReactCustomSearchList from 'react-custom-search-list';
38-
function App(){
39-
const [searchValue, setSearchValue] = useState('');
40-
return (
41-
<ReactCustomSearchList fullWidth value={searchValue} setValue={setSearchValue}>
42-
/**Render your suggestions list here */
43-
<ul>
44-
<li>Option A</li>
45-
<li>Option B</li>
46-
<li>Option C</li>
47-
</ul>
48-
</ReactCustomSearchList>
49-
);
38+
function App() {
39+
const [searchValue, setSearchValue] = useState('');
40+
return (
41+
<ReactCustomSearchList fullWidth value={searchValue} setValue={setSearchValue}>
42+
/**Render your suggestions list here */
43+
<ul>
44+
<li>Option A</li>
45+
<li>Option B</li>
46+
<li>Option C</li>
47+
</ul>
48+
</ReactCustomSearchList>
49+
);
5050
}
5151
```
5252

5353
## Props
5454

5555
- value
56-
- type : `String`
57-
- description : input value
56+
- type : `String`
57+
- description : input value
5858
- setValue
59-
- type : `Func`
60-
- description : setState function for input value
59+
- type : `Func`
60+
- description : setState function for input value
6161
- children
62-
- type : `ReactNode`
63-
- description : suggestions list
62+
- type : `ReactNode`
63+
- description : suggestions list
6464
- rootStyle?
65-
- type : `Object`
66-
- description : style object of the `root` element
65+
- type : `Object`
66+
- description : style object of the `root` element
6767
- inputStyle?
68-
- type : `Object`
69-
- description : style object of the `input` element
68+
- type : `Object`
69+
- description : style object of the `input` element
7070
- placeholder?
71-
- type : `String`
72-
- default : `"search"`
71+
- type : `String`
72+
- default : `"search"`
7373
- iconsColor?
74-
- type : `String`
75-
- description : svg icon's color
76-
- default : `"gray"`
74+
- type : `String`
75+
- description : svg icon's color
76+
- default : `"gray"`
7777
- searchIconStyle?
78-
- type : `Object`
79-
- description : style object of the magnifying icon
78+
- type : `Object`
79+
- description : style object of the magnifying icon
8080
- clearIconStyle?
81-
- type : `Object`
82-
- description : style object of the clear icon
81+
- type : `Object`
82+
- description : style object of the clear icon
8383
- popperStyle?
84-
- type : `Object`
85-
- description : style object of the popper container
84+
- type : `Object`
85+
- description : style object of the popper container
8686
- onKeyDown?
87-
- type : `Func`
88-
- description : keydown event for input
87+
- type : `Func`
88+
- description : keydown event for input
8989
- onBlur?
90-
- type : `Func`
91-
- description : blur event for input
90+
- type : `Func`
91+
- description : blur event for input
9292
- fullWidth?
93-
- type : `Boolean`
94-
- description : set popper width same as input
95-
- placement?
96-
- type : `'auto'| 'auto-start'| 'auto-end'| 'top'| 'top-start'| 'top-end'| 'bottom'| 'bottom-start'| 'bottom-end'| 'right'| 'right-start'| 'right-end'| 'left'| 'left-start'| 'left-end'`
97-
- description : popper's placement
93+
- type : `Boolean`
94+
- description : set popper width same as input
95+
- placement?
96+
- type : `'auto'| 'auto-start'| 'auto-end'| 'top'| 'top-start'| 'top-end'| 'bottom'| 'bottom-start'| 'bottom-end'| 'right'| 'right-start'| 'right-end'| 'left'| 'left-start'| 'left-end'`
97+
- description : popper's placement
9898

9999
## Test
100100

101101
> $ npm run test
102102
103103
## License
104104

105-
MIT
105+
MIT

eslint.config.js

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
const prettier = require('eslint-plugin-prettier');
2+
const trunOffPrettier = require('eslint-config-prettier');
3+
const globals = require('globals');
4+
const babelParser = require('@babel/eslint-parser');
5+
const path = require('path');
6+
const {fileURLToPath} = require('url');
7+
const js = require('@eslint/js');
8+
const {FlatCompat} = require('@eslint/eslintrc');
9+
10+
//const __filename = fileURLToPath(import.meta.url);
11+
//const __dirname = path.dirname(__filename);
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all,
16+
});
17+
// Fix TypeError Key "languageOptions": Key "globals": Global "AudioWorkletGlobalScope " has leading or trailing whitespace.
18+
const GLOBALS_BROWSER_FIX = Object.assign({}, globals.browser, {
19+
AudioWorkletGlobalScope: globals.browser['AudioWorkletGlobalScope '],
20+
});
21+
delete GLOBALS_BROWSER_FIX['AudioWorkletGlobalScope '];
22+
23+
module.exports = [
24+
...compat.extends('eslint:recommended', 'plugin:prettier/recommended', 'prettier'),
25+
{
26+
plugins: {
27+
prettier,
28+
trunOffPrettier,
29+
},
30+
31+
languageOptions: {
32+
globals: {
33+
...GLOBALS_BROWSER_FIX,
34+
...globals.node,
35+
...globals.jest,
36+
},
37+
38+
parser: babelParser,
39+
ecmaVersion: 12,
40+
sourceType: 'module',
41+
parserOptions: {
42+
ecmaFeatures: {
43+
//jsx: true,
44+
},
45+
46+
allowImportExportEverywhere: false,
47+
},
48+
},
49+
50+
rules: {
51+
'prettier/prettier': [
52+
'error',
53+
{
54+
endOfLine: 'auto',
55+
},
56+
],
57+
},
58+
},
59+
];

0 commit comments

Comments
 (0)