CPV Selector
Installation
- yarn
- pnpm
- npm
yarn add @mercell/cpv-selector-react
pnpm add @mercell/cpv-selector-react
npm install --save @mercell/cpv-selector-react
The CPV Selector has necessary peerDependencies, please make sure that you have them in your project
"@carbon/icons-react": "^10.49.0",
"@mercell/checkbox-react": "^5.0.1",
"@mercell/input-react": "^3.0.1",
"@mercell/modal-react": "^2.0.1",
"@mercell/radio-button-react": "^5.0.3",
"@mercell/use-on-outside-click-react-hook": "^3.0.1",
"@mercell/use-window-resize-react-hook": "^0.0.6",
"@mercell/tailwind": "^6.0.1",
"classnames": "^2.3.1",
"react": "^17.0.2"
Usage
Using the CPV Selector component is as simple as importing it like this.
import { CPVSelector } from '@mercell/cpv-selector-react';
Types, definitions, etc.
- Types
- Changelog
- Figma
CPVProps
interface CPVProps {
isCPVPickerOpen: boolean;
onCloseCPVPickerCallback: () => void;
title?: string;
language?: string;
noCodesFoundText?: string;
selectedCodesText?: string;
onCPVListChange: (selectedCPVs: string[]) => void;
selectedCPVs?: string[];
disabledCPVs?: string[];
ariaExpandChevronLabel?: string;
ariaCollapseChevronLabel?: string;
cpvSearchPlaceholder?: string;
ariaLabelClearSearch?: string;
modalProps?: Omit<ModalProps, 'isModalVisible' | 'onCloseCallback'> &JSX.IntrinsicElements['div'];
allowToSelectOnlyOne?: boolean;
} & JSX.IntrinsicElements['div']
Name | Type | Default | Required | Description |
---|---|---|---|---|
isCPVPickerOpen | boolean | false | yes | Status boolean which is necessary to show/hide cpv selector |
onCloseCPVPickerCallback | () => void | - | yes | Callback method to close cpv selector |
title | string | Select categories | no | Title of the modal |
language | string | en | no | CPV langauge |
noCodesFoundText | string | Couldn’t find any results matching your search | no | Text where search function could not find any match |
selectedCodesText | string | Selected codes | no | Text near counter |
onCPVListChange | (selectedCPVsData: string[]) => void | - | yes | Function to catch any change of codes based on user action |
selectedCPVs | string[] | - | no | Initial codes which can be selected by default |
disabledIds | string[] | - | no | Initial codes which should be disabled |
ariaExpandChevronLabel | string | Expand | no | Expand text for aria-label |
ariaCollapseChevronLabel | string | Collapse | no | Collapse text for aria-label |
cpvSearchPlaceholder | string | CPV Search | no | Search placeholder text |
ariaLabelClearSearch | string | Clear search | no | Clear search text for aria-label |
modalProps | ModalProps | {} | no | Pass through props for Modal |
allowToSelectOnlyOne | boolean | false | no | Switch from checkbox to radio for code selection |
Change Log - @mercell/cpv-selector-react
This log was last generated on Wed, 23 Nov 2022 08:30:34 GMT and should not be manually modified.
3.0.1
Wed, 23 Nov 2022 08:30:34 GMT
Patches
- Add option to select only one code through radio button, add possibility to pass array of codes to be disabled
3.0.0
Fri, 11 Nov 2022 09:18:57 GMT
Breaking changes
- New styling approach - use only tailwind classes, add tailwind-merge library
2.0.0
Thu, 15 Sep 2022 06:07:41 GMT
Breaking changes
- Migration to Tailwind3, React 18 and ViteJS from webpack.
1.2.1
Wed, 14 Sep 2022 11:03:10 GMT
Patches
- Add missing dev dependency of loader component
1.2.0
Thu, 08 Sep 2022 11:50:02 GMT
Minor changes
- Added the new loading spinner component to replace the current placeholder loading text
1.1.3
Thu, 14 Jul 2022 09:09:03 GMT
Patches
- Changed cpv components to use prod api
1.1.2
Wed, 13 Jul 2022 09:44:27 GMT
Patches
- Added language property for CPV code picker, language param added to the nuts/api call, default: English ('en')
1.1.1
Tue, 12 Jul 2022 10:42:52 GMT
Version update only
1.1.0
Fri, 01 Jul 2022 10:11:21 GMT
Minor changes
- Fix elements to be hidden instead of unmounted for the sake of outside click hook, important for the cpv mounted inside other modal components
1.0.1
Thu, 30 Jun 2022 10:57:49 GMT
Patches
- Package.json refactor, add test suite, more tests soon
1.0.0
Wed, 22 Jun 2022 08:30:02 GMT
Breaking changes
- Refactor of CPV to be more reusable
0.0.12
Mon, 30 May 2022 08:39:44 GMT
Patches
- Visual update regarding new figma fix, code refactor
0.0.11
Tue, 19 Apr 2022 09:44:51 GMT
Patches
- Add disabled behavior and name prop to have possibility to render more than 1 cpv selector on page
0.0.10
Fri, 08 Apr 2022 10:19:50 GMT
Patches
- Refactor memo
0.0.9
Thu, 31 Mar 2022 08:00:07 GMT
Version update only
0.0.8
Wed, 30 Mar 2022 11:20:41 GMT
Patches
- Style fix regarding changes inside modal component
0.0.7
Tue, 29 Mar 2022 10:35:06 GMT
Patches
- Memoization improvements inside virtualization
0.0.6
Mon, 28 Mar 2022 06:31:59 GMT
Patches
- Add memo/callback to cpv selector to increase performance
0.0.5
Mon, 14 Mar 2022 12:43:45 GMT
Patches
- Add backend support
0.0.4
Wed, 09 Mar 2022 10:29:16 GMT
Patches
- Adjust height of container when virtualization scroll is not needed
0.0.3
Thu, 03 Mar 2022 13:56:02 GMT
Patches
- Adjust for forms
0.0.2
Mon, 28 Feb 2022 12:45:49 GMT
Patches
- New component based on modal, select cpv from list
Sometimes it can take some time until Figma will render component inside embed iframe. Try to click plus icon to 'reset' initial loader. (Works only in Chrome)
<a
target="_blank"
href="https://www.figma.com/file/bosk2VrdPqO0KS3uC8AJvq/Design-System?node-id=5225%3A5889"
className="text-valhalla font-bold">
Click me to open figma in the new card
</a>
<iframe
width="800"
height="450"
src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2Fbosk2VrdPqO0KS3uC8AJvq%2FDesign-System%3Fnode-id%3D5225%253A5889"
allowFullScreen
></iframe>