@rhc-shared-components/form-select-component 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/FormSelectComponent.d.ts +22 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9756 -0
- package/dist/index.modern.js +9703 -0
- package/dist/index.test.d.ts +1 -0
- package/package.json +77 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @rhc-shared-components/sample-project
|
|
2
|
+
|
|
3
|
+
> project description
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@rhc-shared-components/sample-project) [](https://standardjs.com)
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install --save @rhc-shared-components/form-select-component
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import React from 'react';
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
FormSelect,
|
|
20
|
+
ISelectItem
|
|
21
|
+
} from '@rhc-shared-components/form-select-component';
|
|
22
|
+
import { Form, Formik } from 'formik';
|
|
23
|
+
|
|
24
|
+
const App = () => {
|
|
25
|
+
const FieldName = 'form multi select';
|
|
26
|
+
const options = [
|
|
27
|
+
'Accounting',
|
|
28
|
+
'API Management',
|
|
29
|
+
'Application Delivery',
|
|
30
|
+
'Application Server',
|
|
31
|
+
'Automation',
|
|
32
|
+
'Backup & Recovery',
|
|
33
|
+
'Business Intelligence',
|
|
34
|
+
'Business Process Management',
|
|
35
|
+
'Capacity Management'
|
|
36
|
+
];
|
|
37
|
+
const getActions = () => {
|
|
38
|
+
const getAllOptions: ISelectItem[] = options.map((item) => ({
|
|
39
|
+
value: item
|
|
40
|
+
}));
|
|
41
|
+
return getAllOptions;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Formik
|
|
46
|
+
initialValues={{
|
|
47
|
+
[FieldName]: 'test'
|
|
48
|
+
}}
|
|
49
|
+
enableReinitialize={true}
|
|
50
|
+
onSubmit={() => {}}
|
|
51
|
+
>
|
|
52
|
+
<Form>
|
|
53
|
+
<FormSelect
|
|
54
|
+
name={FieldName}
|
|
55
|
+
label='Types of business'
|
|
56
|
+
placeholder='Select'
|
|
57
|
+
selectOptions={getActions()}
|
|
58
|
+
isRequired
|
|
59
|
+
/>
|
|
60
|
+
</Form>
|
|
61
|
+
</Formik>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default App;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
MIT © [authorGithubUsername](https://github.com/authorGithubUsername)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './styles.scss';
|
|
3
|
+
export interface ISelectItem {
|
|
4
|
+
value: string;
|
|
5
|
+
key?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
isPlaceholder?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface FormSelectProps {
|
|
11
|
+
name: string;
|
|
12
|
+
label: string;
|
|
13
|
+
isRequired?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
selectOptions: ISelectItem[];
|
|
16
|
+
subLabel?: string;
|
|
17
|
+
subInfo?: string;
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
helperText?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const FormSelect: React.FC<FormSelectProps>;
|
|
22
|
+
export default FormSelect;
|
package/dist/index.d.ts
ADDED