dropdowns-js 1.0.0 → 1.0.2
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 +17 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,8 +12,8 @@ Searchable dropdown components for React applications.
|
|
|
12
12
|
npm install dropdowns-js
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
## 1. Wrap your
|
|
16
|
-
All components must be wrapped in the CollectionsProvider to manage the dropdown states.
|
|
15
|
+
## 1. Wrap your Component
|
|
16
|
+
All components must be separately wrapped in the CollectionsProvider to manage the dropdown states.
|
|
17
17
|
|
|
18
18
|
```
|
|
19
19
|
// App.jsx
|
|
@@ -59,7 +59,7 @@ export default function MyComponent {
|
|
|
59
59
|
}
|
|
60
60
|
```
|
|
61
61
|
**Context functions**
|
|
62
|
-
`addCollection(collectionName, anArray, maxNumSelections = null, primitiveType = true, ...sortFields)`
|
|
62
|
+
`addCollection(collectionName, anArray, maxNumSelections = null, primitiveType = true, ...sortFields)`
|
|
63
63
|
Add a new collection of data to be displayed in a dropdown for selection.
|
|
64
64
|
|
|
65
65
|
|
|
@@ -81,10 +81,19 @@ Get the selected items (array) of the specified collection. An error is thrown f
|
|
|
81
81
|
`getMaxNumSelections(collectionName)`
|
|
82
82
|
Get the maximum number of items that can be selected on this collection. An error is thrown for a non-existent collection name is specified.
|
|
83
83
|
|
|
84
|
-
## 3.
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
## 3. Dropdown Component Attributes
|
|
85
|
+
`label` - to be used for aria-label.
|
|
86
|
+
|
|
87
|
+
`isDisabled` - disables the component when set to true. Default = false.
|
|
88
|
+
|
|
89
|
+
`collectionName` - name of the collection to populate the dropdown.
|
|
90
|
+
|
|
91
|
+
`dropdownStyle` - for providing styling the dropdown. Fields: {color, backgroundColor}.
|
|
92
|
+
|
|
93
|
+
`buttonStyle` - for providing styling the DONE button (pressed after completing selection in multi-selection dropdowns). Fields: {color, backgroundColor}.
|
|
94
|
+
|
|
95
|
+
`onItemSelected` - a providing a method to execute on selection of items.
|
|
96
|
+
|
|
88
97
|
## 4. Dropdown usage example
|
|
89
98
|
This dropdown is to be used when the underlying data is a primitive type array.
|
|
90
99
|
```
|
|
@@ -347,7 +356,7 @@ export default function MyComponent4() {
|
|
|
347
356
|
);
|
|
348
357
|
}
|
|
349
358
|
```
|
|
350
|
-
|
|
359
|
+
## 8. Multiple dropdown usage example
|
|
351
360
|
```
|
|
352
361
|
export default function MyComponent5() {
|
|
353
362
|
const [output, setOutput] = useState();
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "ITA",
|
|
4
4
|
"description": "A React library providing customizable search dropdown components with single and multi-selection capabilities.",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.2",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"module": "dist/dropdowns-js.es.js",
|
|
9
9
|
"main": "dist/dropdowns-js.cjs.js",
|