@rhc-shared-components/form-multi-select-component 0.0.0 → 0.0.1

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 CHANGED
@@ -7,22 +7,63 @@
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npm install --save @rhc-shared-components/sample-project
10
+ npm install --save @rhc-shared-components/form-multi-select-component
11
11
  ```
12
12
 
13
13
  ## Usage
14
14
 
15
15
  ```tsx
16
- import React, { Component } from 'react'
16
+ import React from 'react';
17
17
 
18
- import MyComponent from '@rhc-shared-components/sample-project'
19
- import '@rhc-shared-components/sample-project/dist/index.css'
18
+ import { FormMultiSelectInput } from '@rhc-shared-components/form-multi-select-component';
19
+ import { IMultiSelectItem } from '../../dist/FormMultiSelect';
20
+ import { Form, Formik } from 'formik';
20
21
 
21
- class Example extends Component {
22
- render() {
23
- return <MyComponent />
24
- }
25
- }
22
+ const App = () => {
23
+ const FieldName = 'form multi select';
24
+ const options = [
25
+ 'Accounting',
26
+ 'API Management',
27
+ 'Application Delivery',
28
+ 'Application Server',
29
+ 'Automation',
30
+ 'Backup & Recovery',
31
+ 'Business Intelligence',
32
+ 'Business Process Management',
33
+ 'Capacity Management'
34
+ ];
35
+ const getActions = () => {
36
+ const getAllOptions: IMultiSelectItem[] = options.map((item) => ({
37
+ value: item
38
+ }));
39
+ return getAllOptions;
40
+ };
41
+
42
+ return (
43
+ <Formik
44
+ initialValues={{
45
+ [FieldName]: 'test'
46
+ }}
47
+ enableReinitialize={true}
48
+ onSubmit={() => {}}
49
+ >
50
+ <Form>
51
+ <FormMultiSelectInput
52
+ name={FieldName}
53
+ maxHeight={200}
54
+ label='Industries'
55
+ placeholder='Select'
56
+ helperText='Select upto 3 industries'
57
+ selectOptions={getActions()}
58
+ isRequired
59
+ maxItems={3}
60
+ />
61
+ </Form>
62
+ </Formik>
63
+ );
64
+ };
65
+
66
+ export default App;
26
67
  ```
27
68
 
28
69
  ## License
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import FormMultiSelectInput from './FormMultiSelectInput';
2
- export { FormMultiSelectInput };
1
+ import FormMultiSelectInput, { IMultiSelectItem } from './FormMultiSelectInput';
2
+ export { FormMultiSelectInput, IMultiSelectItem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhc-shared-components/form-multi-select-component",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "description": "project description",
5
5
  "author": "shkale",
6
6
  "license": "MIT",