@commercetools-uikit/search-select-field 19.9.0 → 19.10.0

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.
@@ -187,7 +187,7 @@ SearchSelectField.toFieldErrors = function toFieldErrors(errors) {
187
187
  var SearchSelectField$1 = SearchSelectField;
188
188
 
189
189
  // NOTE: This string will be replaced on build time with the package version.
190
- var version = "19.9.0";
190
+ var version = "19.10.0";
191
191
 
192
192
  exports["default"] = SearchSelectField$1;
193
193
  exports.version = version;
@@ -152,7 +152,7 @@ SearchSelectField.toFieldErrors = function toFieldErrors(errors) {
152
152
  var SearchSelectField$1 = SearchSelectField;
153
153
 
154
154
  // NOTE: This string will be replaced on build time with the package version.
155
- var version = "19.9.0";
155
+ var version = "19.10.0";
156
156
 
157
157
  exports["default"] = SearchSelectField$1;
158
158
  exports.version = version;
@@ -162,6 +162,6 @@ SearchSelectField.toFieldErrors = function toFieldErrors(errors) {
162
162
  var SearchSelectField$1 = SearchSelectField;
163
163
 
164
164
  // NOTE: This string will be replaced on build time with the package version.
165
- var version = "19.9.0";
165
+ var version = "19.10.0";
166
166
 
167
167
  export { SearchSelectField$1 as default, version };
@@ -17,61 +17,277 @@ type TCustomFormErrors<Values> = {
17
17
  [K in keyof Values]?: TFieldErrors;
18
18
  };
19
19
  export type TSearchSelectFieldProps = {
20
+ /**
21
+ *Horizontal size limit of the input fields.
22
+ */
20
23
  horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
24
+ /**
25
+ * Aria label (for assistive tech)
26
+ * <br>
27
+ * [Props from React select was used](https://react-select.com/props)
28
+ */
21
29
  'aria-label'?: ReactSelectAsyncProps['aria-label'];
30
+ /**
31
+ * HTML ID of an element that should be used as the label (for assistive tech)
32
+ * <br>
33
+ * [Props from React select was used](https://react-select.com/props)
34
+ */
22
35
  'aria-labelledby'?: ReactSelectAsyncProps['aria-labelledby'];
36
+ /**
37
+ * The id of the search input. This forwarded as react-select's "inputId"
38
+ * <br>
39
+ * [Props from React select was used](https://react-select.com/props)
40
+ */
23
41
  id?: ReactSelectAsyncProps['inputId'];
42
+ /**
43
+ * The id to set on the SelectContainer component. This is forwarded as react-select's "id"
44
+ * <br>
45
+ * [Props from React select was used](https://react-select.com/props)
46
+ */
24
47
  containerId?: ReactSelectAsyncProps['id'];
48
+ /**
49
+ * Name of the HTML Input (optional - without this, no input will be rendered)
50
+ * <br>
51
+ * [Props from React select was used](https://react-select.com/props)
52
+ */
25
53
  name?: ReactSelectAsyncProps['name'];
54
+ /**
55
+ * Placeholder text for the select value
56
+ * <br>
57
+ * [Props from React select was used](https://react-select.com/props)
58
+ */
26
59
  placeholder?: ReactSelectAsyncProps['placeholder'];
60
+ /**
61
+ * Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
62
+ * <br>
63
+ * [Props from React select was used](https://react-select.com/props)
64
+ */
27
65
  components?: ReactSelectAsyncProps['components'];
66
+ /**
67
+ * Control whether the selected values should be rendered in the control
68
+ * <br>
69
+ * [Props from React select was used](https://react-select.com/props)
70
+ */
28
71
  controlShouldRenderValue?: ReactSelectAsyncProps['controlShouldRenderValue'];
72
+ /**
73
+ * Sets the tabIndex attribute on the input
74
+ * <br>
75
+ * [Props from React select was used](https://react-select.com/props)
76
+ */
29
77
  tabIndex?: ReactSelectAsyncProps['tabIndex'];
78
+ /**
79
+ * The value of the select; reflected by the selected option
80
+ * <br>
81
+ * [Props from React select was used](https://react-select.com/props)
82
+ */
30
83
  value?: ReactSelectAsyncProps['value'];
84
+ /**
85
+ * Remove the currently focused option when the user presses backspace
86
+ * <br>
87
+ * [Props from React select was used](https://react-select.com/props)
88
+ */
31
89
  backspaceRemovesValue?: ReactSelectAsyncProps['backspaceRemovesValue'];
90
+ /**
91
+ * Indicates the input field has an error
92
+ */
32
93
  hasError?: boolean;
94
+ /**
95
+ * Indicates the input field has a warning
96
+ * @deprecated Please use the `warnings` prop instead so users know the reason why the field is in warning state.
97
+ */
33
98
  hasWarning?: boolean;
99
+ /**
100
+ * Is the select read-only
101
+ */
34
102
  isReadOnly?: boolean;
103
+ /**
104
+ * Is the select disabled
105
+ */
35
106
  isDisabled?: boolean;
107
+ /**
108
+ * Is the select value clearable
109
+ */
36
110
  isClearable?: boolean;
111
+ /**
112
+ * Whether the input and its options are rendered with condensed paddings
113
+ */
37
114
  isCondensed?: boolean;
115
+ /**
116
+ * Override the built-in logic to detect whether an option is disabled
117
+ * <br>
118
+ * [Props from React select was used](https://react-select.com/props)
119
+ */
38
120
  isOptionDisabled?: ReactSelectAsyncProps['isOptionDisabled'];
121
+ /**
122
+ * Support multiple selected options
123
+ * <br>
124
+ * [Props from React select was used](https://react-select.com/props)
125
+ */
39
126
  isMulti?: ReactSelectAsyncProps['isMulti'];
127
+ /**
128
+ * Focus the control when it is mounted. Renamed autoFocus of react-select
129
+ */
40
130
  isAutofocussed?: boolean;
131
+ /**
132
+ * Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place). Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
133
+ * <br>
134
+ * [Props from React select was used](https://react-select.com/props)
135
+ */
41
136
  noOptionsMessage?: ReactSelectAsyncProps['noOptionsMessage'];
137
+ /**
138
+ * Maximum height of the menu before scrolling
139
+ * <br>
140
+ * [Props from React select was used](https://react-select.com/props)
141
+ */
42
142
  maxMenuHeight?: ReactSelectAsyncProps['maxMenuHeight'];
143
+ /**
144
+ * Dom element to portal the select menu to
145
+ * <br>
146
+ * [Props from React select was used](https://react-select.com/props)
147
+ */
43
148
  menuPortalTarget?: ReactSelectAsyncProps['menuPortalTarget'];
149
+ /**
150
+ * z-index value for the menu portal
151
+ * <br>
152
+ * Use in conjunction with `menuPortalTarget`
153
+ */
44
154
  menuPortalZIndex?: number;
155
+ /**
156
+ * whether the menu should block scroll while open
157
+ */
45
158
  menuShouldBlockScroll?: boolean;
159
+ /**
160
+ * Determines if option groups will be separated by a divider
161
+ */
46
162
  showOptionGroupDivider?: boolean;
163
+ /**
164
+ * Handle blur events on the control
165
+ */
47
166
  onBlur?: (event: TCustomEvent) => void;
167
+ /**
168
+ * Called with a fake event when value changes.
169
+ * <br />
170
+ * The event's `target.name` will be the `name` supplied in props. The event's `target.value` will hold the value. The value will be the selected option, or an array of options in case `isMulti` is `true`.
171
+ */
48
172
  onChange?: (event: TCustomEvent, info: ActionMeta<unknown>) => void;
173
+ /**
174
+ * Handle focus events on the control
175
+ * <br>
176
+ * [Props from React select was used](https://react-select.com/props)
177
+ */
49
178
  onFocus?: ReactSelectAsyncProps['onFocus'];
179
+ /**
180
+ * Handle change events on the input
181
+ * <br>
182
+ * [Props from React select was used](https://react-select.com/props)
183
+ */
50
184
  onInputChange?: ReactSelectAsyncProps['onInputChange'];
185
+ /**
186
+ * Select the currently focused option when the user presses tab
187
+ * <br>
188
+ * [Props from React select was used](https://react-select.com/props)
189
+ */
51
190
  tabSelectsValue?: ReactSelectAsyncProps['tabSelectsValue'];
191
+ /**
192
+ * Function that returns a promise, which is the set of options to be used once the promise resolves.
193
+ * <br>
194
+ * [Props from React select was used](https://react-select.com/props)
195
+ */
52
196
  loadOptions: ReactSelectAsyncProps['loadOptions'];
197
+ /**
198
+ * The text shown while the options are being loaded
199
+ */
53
200
  loadingMessage?: string | (() => string);
201
+ /**
202
+ * If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
203
+ * <br>
204
+ * [Props from React select was used](https://react-select.com/props)
205
+ */
54
206
  cacheOptions?: ReactSelectAsyncProps['cacheOptions'];
207
+ /**
208
+ * Custom method to filter whether an option should be displayed in the menu
209
+ * <br>
210
+ * [Props from React select was used](https://react-select.com/props)
211
+ */
55
212
  filterOption?: ReactSelectAsyncProps['filterOption'];
213
+ /**
214
+ * The style of the an option in the dropdown menu. It could be single lined option or an option with more and custom info
215
+ */
56
216
  optionType?: 'single-property' | 'double-property' | 'multiple-properties';
217
+ /**
218
+ * A map of errors. Error messages for known errors are rendered automatically.
219
+ * <br />
220
+ * Unknown errors will be forwarded to `renderError`
221
+ */
57
222
  errors?: TFieldErrors;
223
+ /**
224
+ * Called with custom errors. This function can return a message which will be wrapped in an ErrorMessage. It can also return null to show no error.
225
+ */
58
226
  renderError?: TErrorRenderer;
227
+ /**
228
+ * A map of warnings. Warning messages for known warnings are rendered automatically.
229
+ * <br/>
230
+ * Unknown warnings will be forwarded to renderWarning.
231
+ */
59
232
  warnings?: TFieldWarnings;
233
+ /**
234
+ * Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.
235
+ * <br />
236
+ * It can also return null to show no warning.
237
+ */
60
238
  renderWarning?: (key: string, warning?: boolean) => ReactNode;
239
+ /**
240
+ * Indicates if the value is required. Shows an the "required asterisk" if so.
241
+ */
61
242
  isRequired?: boolean;
243
+ /**
244
+ * Indicates whether the field was touched. Errors will only be shown when the field was touched.
245
+ */
62
246
  touched?: boolean[] | boolean;
247
+ /**
248
+ * Title of the label
249
+ */
63
250
  title: ReactNode;
251
+ /**
252
+ * Hint for the label. Provides a supplementary but important information regarding the behaviour of the input (e.g warn about uniqueness of a field, when it can only be set once), whereas `description` can describe it in more depth. Can also receive a `hintIcon`.
253
+ */
64
254
  hint?: ReactNode;
255
+ /**
256
+ * Provides a description for the title.
257
+ */
65
258
  description?: ReactNode;
259
+ /**
260
+ * Function called when info button is pressed.
261
+ * <br />
262
+ * Info button will only be visible when this prop is passed.
263
+ */
66
264
  onInfoButtonClick?: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
265
+ /**
266
+ * Icon to be displayed beside the hint text.
267
+ * <br />
268
+ * Will only get rendered when `hint` is passed as well.
269
+ */
67
270
  hintIcon?: ReactElement;
271
+ /**
272
+ * Badge to be displayed beside the label.
273
+ * <br />
274
+ * Might be used to display additional information about the content of the field (E.g verified email)
275
+ */
68
276
  badge?: ReactNode;
277
+ /**
278
+ * Icon to display on the left of the placeholder text and selected value. Has no effect when `isMulti` is enabled.
279
+ */
69
280
  iconLeft?: ReactNode;
70
281
  };
71
282
  declare const SearchSelectField: {
72
283
  (props: TSearchSelectFieldProps): import("@emotion/react/jsx-runtime").JSX.Element;
73
284
  defaultProps: Pick<TSearchSelectFieldProps, "controlShouldRenderValue">;
74
285
  displayName: string;
286
+ /**
287
+ * Use this function to convert the Formik `errors` object type to
288
+ * our custom field errors type.
289
+ * This is primarly useful when using TypeScript.
290
+ */
75
291
  toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
76
292
  };
77
293
  export default SearchSelectField;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/search-select-field",
3
3
  "description": "A search select field built on top of search select input, allowing users to asynchronously search for options",
4
- "version": "19.9.0",
4
+ "version": "19.10.0",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,15 +21,15 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.20.13",
23
23
  "@babel/runtime-corejs3": "^7.20.13",
24
- "@commercetools-uikit/constraints": "19.9.0",
25
- "@commercetools-uikit/design-system": "19.9.0",
26
- "@commercetools-uikit/field-errors": "19.9.0",
27
- "@commercetools-uikit/field-label": "19.9.0",
28
- "@commercetools-uikit/field-warnings": "19.9.0",
29
- "@commercetools-uikit/hooks": "19.9.0",
30
- "@commercetools-uikit/search-select-input": "19.9.0",
31
- "@commercetools-uikit/spacings": "19.9.0",
32
- "@commercetools-uikit/utils": "19.9.0",
24
+ "@commercetools-uikit/constraints": "19.10.0",
25
+ "@commercetools-uikit/design-system": "19.10.0",
26
+ "@commercetools-uikit/field-errors": "19.10.0",
27
+ "@commercetools-uikit/field-label": "19.10.0",
28
+ "@commercetools-uikit/field-warnings": "19.10.0",
29
+ "@commercetools-uikit/hooks": "19.10.0",
30
+ "@commercetools-uikit/search-select-input": "19.10.0",
31
+ "@commercetools-uikit/spacings": "19.10.0",
32
+ "@commercetools-uikit/utils": "19.10.0",
33
33
  "@emotion/react": "^11.10.5",
34
34
  "@emotion/styled": "^11.10.5",
35
35
  "prop-types": "15.8.1",