@@ -2,6 +2,9 @@ import React, { Fragment } from 'react';
22
33import SingleSelect from 'src/Select/SingleSelect' ;
44
5+ import Option from './Option' ;
6+ import ValueContainer from './ValueContainer' ;
7+
58const onChange = ( ) => { } ;
69
710export default {
@@ -10,11 +13,12 @@ export default {
1013} ;
1114
1215const options = [
13- { label : 'Bob' , value : 1 } ,
14- { label : 'Dave' , value : 2 } ,
15- { label : 'Jeff' , value : 3 } ,
16- { label : 'Dennis' , value : 4 } ,
17- { label : 'Basel' , value : 5 } ,
16+ { label : 'White' , value : 1 } ,
17+ { label : 'Black / African American' , value : 2 } ,
18+ { label : 'American Indian / Alaska Native' , value : 3 } ,
19+ { label : 'Asian' , value : 4 } ,
20+ { label : 'Native Hawaiian / Pacific Islander' , value : 5 } ,
21+ { label : 'Hispanic / Latinx' , value : 6 } ,
1822] ;
1923
2024export const Default = ( ) => (
@@ -53,3 +57,49 @@ export const MultiSelect = () => (
5357 />
5458 </ Fragment >
5559) ;
60+
61+ export const CustomOptionWithCheckbox = ( ) => (
62+ < Fragment >
63+ < label htmlFor = "multi-select" id = "select-label-custom-option" > Custom option with checkbox</ label >
64+ < SingleSelect
65+ aria-labelledby = "select-label"
66+ closeMenuOnSelect = { false }
67+ components = { {
68+ Option,
69+ } }
70+ hideSelectedOptions = { false }
71+ id = "multi-select"
72+ isMulti
73+ options = { options }
74+ onChange = { onChange }
75+ />
76+ </ Fragment >
77+ ) ;
78+
79+ export const CustomValueContainer = ( ) => (
80+ < Fragment >
81+ < label htmlFor = "custom-value-container-select" id = "select-label-custom-value-container" >
82+ Custom value container
83+ </ label >
84+ < SingleSelect
85+ aria-labelledby = "select-label"
86+ closeMenuOnSelect = { false }
87+ components = { {
88+ Option,
89+ ValueContainer : ( props ) => (
90+ < ValueContainer
91+ { ...props }
92+ /* eslint-disable react/prop-types */
93+ valueText = { `participant${ props . getValue ( ) . length > 1 ? 's' : '' } selected` }
94+ /* eslint-enable react/prop-types */
95+ />
96+ ) ,
97+ } }
98+ hideSelectedOptions = { false }
99+ id = "custom-value-container-select"
100+ isMulti
101+ options = { options }
102+ onChange = { onChange }
103+ />
104+ </ Fragment >
105+ ) ;
0 commit comments