Skip to content

Commit d34d818

Browse files
authored
docs(FluidMultiSelect): update propType definitions for FluidMultiSelect (#15108)
* docs(FluidMultiSelect): update propType definitions for FluidMultiSelect * test(snapshot): update snapshots
1 parent 5f47b04 commit d34d818

File tree

2 files changed

+120
-44
lines changed

2 files changed

+120
-44
lines changed

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9686,6 +9686,15 @@ Map {
96869686
"className": Object {
96879687
"type": "string",
96889688
},
9689+
"clearSelectionDescription": Object {
9690+
"type": "string",
9691+
},
9692+
"clearSelectionText": Object {
9693+
"type": "string",
9694+
},
9695+
"compareItems": Object {
9696+
"type": "func",
9697+
},
96899698
"direction": Object {
96909699
"args": Array [
96919700
Array [
@@ -9698,25 +9707,15 @@ Map {
96989707
"disabled": Object {
96999708
"type": "bool",
97009709
},
9710+
"downshiftProps": Object {
9711+
"type": "object",
9712+
},
97019713
"id": Object {
97029714
"isRequired": true,
97039715
"type": "string",
97049716
},
9705-
"initialSelectedItem": Object {
9706-
"args": Array [
9707-
Array [
9708-
Object {
9709-
"type": "object",
9710-
},
9711-
Object {
9712-
"type": "string",
9713-
},
9714-
Object {
9715-
"type": "number",
9716-
},
9717-
],
9718-
],
9719-
"type": "oneOfType",
9717+
"initialSelectedItems": Object {
9718+
"type": "array",
97209719
},
97219720
"invalid": Object {
97229721
"type": "bool",
@@ -9744,34 +9743,46 @@ Map {
97449743
"isRequired": true,
97459744
"type": "node",
97469745
},
9746+
"locale": Object {
9747+
"type": "string",
9748+
},
97479749
"onChange": Object {
97489750
"type": "func",
97499751
},
9750-
"renderSelectedItem": Object {
9752+
"onInputValueChange": Object {
97519753
"type": "func",
97529754
},
9753-
"selectedItem": Object {
9755+
"onMenuChange": Object {
9756+
"type": "func",
9757+
},
9758+
"readOnly": Object {
9759+
"type": "bool",
9760+
},
9761+
"selectedItems": Object {
9762+
"type": "array",
9763+
},
9764+
"selectionFeedback": Object {
97549765
"args": Array [
97559766
Array [
9756-
Object {
9757-
"type": "object",
9758-
},
9759-
Object {
9760-
"type": "string",
9761-
},
9762-
Object {
9763-
"type": "number",
9764-
},
9767+
"top",
9768+
"fixed",
9769+
"top-after-reopen",
97659770
],
97669771
],
9767-
"type": "oneOfType",
9772+
"type": "oneOf",
9773+
},
9774+
"sortItems": Object {
9775+
"type": "func",
97689776
},
97699777
"titleText": Object {
97709778
"type": "node",
97719779
},
97729780
"translateWithId": Object {
97739781
"type": "func",
97749782
},
9783+
"useTitleInItem": Object {
9784+
"type": "bool",
9785+
},
97759786
"warn": Object {
97769787
"type": "bool",
97779788
},

packages/react/src/components/FluidMultiSelect/FluidMultiSelect.js

Lines changed: 82 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,23 @@ FluidMultiSelect.propTypes = {
4242
className: PropTypes.string,
4343

4444
/**
45-
* Specify the direction of the dropdown. Can be either top or bottom.
45+
* Specify the text that should be read for screen readers that describes total items selected
46+
*/
47+
clearSelectionDescription: PropTypes.string,
48+
49+
/**
50+
* Specify the text that should be read for screen readers to clear selection.
51+
*/
52+
clearSelectionText: PropTypes.string,
53+
54+
/**
55+
* Provide a compare function that is used to determine the ordering of
56+
* options. See 'sortItems' for more control.
57+
*/
58+
compareItems: PropTypes.func,
59+
60+
/**
61+
* Specify the direction of the multiselect dropdown. Can be either top or bottom.
4662
*/
4763
direction: PropTypes.oneOf(['top', 'bottom']),
4864

@@ -51,20 +67,21 @@ FluidMultiSelect.propTypes = {
5167
*/
5268
disabled: PropTypes.bool,
5369

70+
/**
71+
* Additional props passed to Downshift
72+
*/
73+
downshiftProps: PropTypes.object,
74+
5475
/**
5576
* Specify a custom `id` for the `<input>`
5677
*/
5778
id: PropTypes.string.isRequired,
5879

5980
/**
60-
* Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
61-
* from their collection that are pre-selected
81+
* Allow users to pass in arbitrary items from their collection that are
82+
* pre-selected
6283
*/
63-
initialSelectedItem: PropTypes.oneOfType([
64-
PropTypes.object,
65-
PropTypes.string,
66-
PropTypes.number,
67-
]),
84+
initialSelectedItems: PropTypes.array,
6885

6986
/**
7087
* Specify if the currently selected value is invalid.
@@ -111,26 +128,69 @@ FluidMultiSelect.propTypes = {
111128
*/
112129
label: PropTypes.node.isRequired,
113130

131+
/**
132+
* Specify the locale of the control. Used for the default `compareItems`
133+
* used for sorting the list of items in the control.
134+
*/
135+
locale: PropTypes.string,
136+
114137
/**
115138
* `onChange` is a utility for this controlled component to communicate to a
116139
* consuming component what kind of internal state changes are occurring.
117140
*/
118141
onChange: PropTypes.func,
119142

120143
/**
121-
* An optional callback to render the currently selected item as a react element instead of only
122-
* as a string.
144+
* **Filterable variant only** - `onInputValueChange` is a utility for this controlled component to communicate to
145+
* the currently typed input.
123146
*/
124-
renderSelectedItem: PropTypes.func,
147+
onInputValueChange: PropTypes.func,
125148

126149
/**
127-
* In the case you want to control the dropdown selection entirely.
150+
* `onMenuChange` is a utility for this controlled component to communicate to a
151+
* consuming component that the menu was open(`true`)/closed(`false`).
128152
*/
129-
selectedItem: PropTypes.oneOfType([
130-
PropTypes.object,
131-
PropTypes.string,
132-
PropTypes.number,
133-
]),
153+
onMenuChange: PropTypes.func,
154+
155+
/**
156+
* Whether or not the Multiselect is readonly
157+
*/
158+
readOnly: PropTypes.bool,
159+
160+
/**
161+
* For full control of the selected items
162+
*/
163+
selectedItems: PropTypes.array,
164+
165+
/**
166+
* Specify feedback (mode) of the selection.
167+
* `top`: selected item jumps to top
168+
* `fixed`: selected item stays at it's position
169+
* `top-after-reopen`: selected item jump to top after reopen dropdown
170+
*/
171+
selectionFeedback: PropTypes.oneOf(['top', 'fixed', 'top-after-reopen']),
172+
173+
/**
174+
* Provide a method that sorts all options in the control. Overriding this
175+
* prop means that you also have to handle the sort logic for selected versus
176+
* un-selected items. If you just want to control ordering, consider the
177+
* `compareItems` prop instead.
178+
*
179+
* The return value should be a number whose sign indicates the relative order
180+
* of the two elements: negative if a is less than b, positive if a is greater
181+
* than b, and zero if they are equal.
182+
*
183+
* sortItems :
184+
* (items: Array<Item>, {
185+
* selectedItems: Array<Item>,
186+
* itemToString: Item => string,
187+
* compareItems: (itemA: string, itemB: string, {
188+
* locale: string
189+
* }) => number,
190+
* locale: string,
191+
* }) => Array<Item>
192+
*/
193+
sortItems: PropTypes.func,
134194

135195
/**
136196
* Provide the title text that will be read by a screen reader when
@@ -143,6 +203,11 @@ FluidMultiSelect.propTypes = {
143203
*/
144204
translateWithId: PropTypes.func,
145205

206+
/**
207+
* Specify title to show title on hover
208+
*/
209+
useTitleInItem: PropTypes.bool,
210+
146211
/**
147212
* Specify whether the control is currently in warning state
148213
*/

0 commit comments

Comments
 (0)