@automattic/vip-design-system 0.27.7 → 0.27.9

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.
@@ -41,7 +41,7 @@ var Label = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef
41
41
 
42
42
  exports.Label = Label;
43
43
  Label.propTypes = {
44
- children: _propTypes["default"].object,
44
+ children: _propTypes["default"].any,
45
45
  required: _propTypes["default"].bool,
46
46
  sx: _propTypes["default"].object
47
47
  };
@@ -33,7 +33,7 @@ var _FormSelectLoading = require("./FormSelectLoading");
33
33
 
34
34
  var _jsxRuntime = require("theme-ui/jsx-runtime");
35
35
 
36
- var _excluded = ["isInline", "forLabel", "options", "label", "getOptionLabel", "getOptionValue", "onChange", "onInputChange", "value", "showAllValues", "searchIcon", "minLength", "debounce", "loading", "required", "displayMenu", "noOptionsMessage", "id", "className"];
36
+ var _excluded = ["autoFilter", "className", "debounce", "displayMenu", "forLabel", "getOptionLabel", "getOptionValue", "id", "isInline", "label", "loading", "minLength", "noOptionsMessage", "onChange", "onInputChange", "options", "required", "searchIcon", "showAllValues", "source", "value"];
37
37
 
38
38
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
39
 
@@ -134,35 +134,38 @@ var searchIconStyles = {
134
134
  };
135
135
 
136
136
  var FormAutocomplete = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
137
- var isInline = _ref.isInline,
137
+ var _ref$autoFilter = _ref.autoFilter,
138
+ autoFilter = _ref$autoFilter === void 0 ? true : _ref$autoFilter,
139
+ className = _ref.className,
140
+ _ref$debounce = _ref.debounce,
141
+ debounce = _ref$debounce === void 0 ? 0 : _ref$debounce,
142
+ _ref$displayMenu = _ref.displayMenu,
143
+ displayMenu = _ref$displayMenu === void 0 ? 'overlay' : _ref$displayMenu,
138
144
  forLabel = _ref.forLabel,
139
- _ref$options = _ref.options,
140
- options = _ref$options === void 0 ? [] : _ref$options,
141
- label = _ref.label,
142
145
  getOptionLabel = _ref.getOptionLabel,
143
146
  getOptionValue = _ref.getOptionValue,
144
- _ref$onChange = _ref.onChange,
145
- onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
146
- onInputChange = _ref.onInputChange,
147
- value = _ref.value,
148
- _ref$showAllValues = _ref.showAllValues,
149
- showAllValues = _ref$showAllValues === void 0 ? true : _ref$showAllValues,
150
- searchIcon = _ref.searchIcon,
147
+ _ref$id = _ref.id,
148
+ id = _ref$id === void 0 ? 'vip-autocomplete' : _ref$id,
149
+ isInline = _ref.isInline,
150
+ label = _ref.label,
151
+ loading = _ref.loading,
151
152
  _ref$minLength = _ref.minLength,
152
153
  minLength = _ref$minLength === void 0 ? 0 : _ref$minLength,
153
- _ref$debounce = _ref.debounce,
154
- debounce = _ref$debounce === void 0 ? 0 : _ref$debounce,
155
- loading = _ref.loading,
156
- required = _ref.required,
157
- _ref$displayMenu = _ref.displayMenu,
158
- displayMenu = _ref$displayMenu === void 0 ? 'overlay' : _ref$displayMenu,
159
154
  _ref$noOptionsMessage = _ref.noOptionsMessage,
160
155
  noOptionsMessage = _ref$noOptionsMessage === void 0 ? function () {
161
156
  return 'No results found.';
162
157
  } : _ref$noOptionsMessage,
163
- _ref$id = _ref.id,
164
- id = _ref$id === void 0 ? 'vip-autocomplete' : _ref$id,
165
- className = _ref.className,
158
+ _ref$onChange = _ref.onChange,
159
+ onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
160
+ onInputChange = _ref.onInputChange,
161
+ _ref$options = _ref.options,
162
+ options = _ref$options === void 0 ? [] : _ref$options,
163
+ required = _ref.required,
164
+ searchIcon = _ref.searchIcon,
165
+ _ref$showAllValues = _ref.showAllValues,
166
+ showAllValues = _ref$showAllValues === void 0 ? true : _ref$showAllValues,
167
+ source = _ref.source,
168
+ value = _ref.value,
166
169
  props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
167
170
 
168
171
  var _useState = (0, _react.useState)(false),
@@ -227,7 +230,7 @@ var FormAutocomplete = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
227
230
  handleInputChange(query);
228
231
  }
229
232
 
230
- var data = handleTypeChange(query);
233
+ var data = autoFilter ? handleTypeChange(query) : options;
231
234
  populateResults(data == null ? void 0 : data.map(function (option) {
232
235
  return optionLabel(option);
233
236
  }));
@@ -255,7 +258,7 @@ var FormAutocomplete = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
255
258
  "aria-busy": loading,
256
259
  showAllValues: showAllValues,
257
260
  ref: forwardRef,
258
- source: suggest,
261
+ source: source || suggest,
259
262
  defaultValue: value,
260
263
  displayMenu: displayMenu,
261
264
  onConfirm: onValueChange,
@@ -268,24 +271,26 @@ var FormAutocomplete = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
268
271
 
269
272
  exports.FormAutocomplete = FormAutocomplete;
270
273
  FormAutocomplete.propTypes = {
271
- id: _propTypes["default"].string,
272
- showAllValues: _propTypes["default"].bool,
273
- searchIcon: _propTypes["default"].bool,
274
- loading: _propTypes["default"].bool,
275
- required: _propTypes["default"].bool,
276
- isInline: _propTypes["default"].bool,
277
- forLabel: _propTypes["default"].string,
278
- value: _propTypes["default"].string,
274
+ autoFilter: _propTypes["default"].bool,
275
+ className: _propTypes["default"].any,
276
+ debounce: _propTypes["default"].number,
279
277
  displayMenu: _propTypes["default"].string,
280
- label: _propTypes["default"].string,
281
- options: _propTypes["default"].array,
278
+ forLabel: _propTypes["default"].string,
282
279
  getOptionLabel: _propTypes["default"].func,
283
280
  getOptionValue: _propTypes["default"].func,
284
- onInputChange: _propTypes["default"].func,
281
+ id: _propTypes["default"].string,
282
+ isInline: _propTypes["default"].bool,
283
+ label: _propTypes["default"].string,
284
+ loading: _propTypes["default"].bool,
285
+ minLength: _propTypes["default"].number,
285
286
  noOptionsMessage: _propTypes["default"].func,
286
287
  onChange: _propTypes["default"].func,
287
- className: _propTypes["default"].any,
288
- minLength: _propTypes["default"].number,
289
- debounce: _propTypes["default"].number
288
+ onInputChange: _propTypes["default"].func,
289
+ options: _propTypes["default"].array,
290
+ required: _propTypes["default"].bool,
291
+ searchIcon: _propTypes["default"].bool,
292
+ showAllValues: _propTypes["default"].bool,
293
+ source: _propTypes["default"].func,
294
+ value: _propTypes["default"].string
290
295
  };
291
296
  FormAutocomplete.displayName = 'FormAutocomplete';
@@ -96,7 +96,7 @@
96
96
  "placeholder": {
97
97
  "type": "color",
98
98
  "description": "Use for placeholder text in fields",
99
- "value": "#8f8c8b"
99
+ "value": "#757575"
100
100
  },
101
101
  "disabled": {
102
102
  "type": "color",
@@ -149,7 +149,7 @@
149
149
  },
150
150
  "disabled": {
151
151
  "type": "color",
152
- "value": "#8f8c8b"
152
+ "value": "#757575"
153
153
  }
154
154
  },
155
155
  "button": {
@@ -1476,7 +1476,7 @@
1476
1476
  "type": "color"
1477
1477
  },
1478
1478
  "45": {
1479
- "value": "#8f8c8b",
1479
+ "value": "#757575",
1480
1480
  "type": "color"
1481
1481
  },
1482
1482
  "50": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip-design-system",
3
- "version": "0.27.7",
3
+ "version": "0.27.9",
4
4
  "main": "build/system/index.js",
5
5
  "scripts": {
6
6
  "build-storybook": "build-storybook",
@@ -31,7 +31,7 @@ const Label = React.forwardRef( ( { sx, children, required, ...rest }, forwardRe
31
31
  ) );
32
32
 
33
33
  Label.propTypes = {
34
- children: PropTypes.object,
34
+ children: PropTypes.any,
35
35
  required: PropTypes.bool,
36
36
  sx: PropTypes.object,
37
37
  };
@@ -95,25 +95,27 @@ const searchIconStyles = {
95
95
  const FormAutocomplete = React.forwardRef(
96
96
  (
97
97
  {
98
- isInline,
98
+ autoFilter = true,
99
+ className,
100
+ debounce = 0,
101
+ displayMenu = 'overlay',
99
102
  forLabel,
100
- options = [],
101
- label,
102
103
  getOptionLabel,
103
104
  getOptionValue,
105
+ id = 'vip-autocomplete',
106
+ isInline,
107
+ label,
108
+ loading,
109
+ minLength = 0,
110
+ noOptionsMessage = () => 'No results found.',
104
111
  onChange = () => {},
105
112
  onInputChange,
106
- value,
107
- showAllValues = true,
108
- searchIcon,
109
- minLength = 0,
110
- debounce = 0,
111
- loading,
113
+ options = [],
112
114
  required,
113
- displayMenu = 'overlay',
114
- noOptionsMessage = () => 'No results found.',
115
- id = 'vip-autocomplete',
116
- className,
115
+ searchIcon,
116
+ showAllValues = true,
117
+ source,
118
+ value,
117
119
  ...props
118
120
  },
119
121
  forwardRef
@@ -186,7 +188,7 @@ const FormAutocomplete = React.forwardRef(
186
188
  if ( isDirty && onInputChange ) {
187
189
  handleInputChange( query );
188
190
  }
189
- const data = handleTypeChange( query );
191
+ const data = autoFilter ? handleTypeChange( query ) : options;
190
192
  populateResults( data?.map( option => optionLabel( option ) ) );
191
193
  },
192
194
  [ options, isDirty ]
@@ -231,7 +233,7 @@ const FormAutocomplete = React.forwardRef(
231
233
  aria-busy={ loading }
232
234
  showAllValues={ showAllValues }
233
235
  ref={ forwardRef }
234
- source={ suggest }
236
+ source={ source || suggest }
235
237
  defaultValue={ value }
236
238
  displayMenu={ displayMenu }
237
239
  onConfirm={ onValueChange }
@@ -248,25 +250,27 @@ const FormAutocomplete = React.forwardRef(
248
250
  );
249
251
 
250
252
  FormAutocomplete.propTypes = {
251
- id: PropTypes.string,
252
- showAllValues: PropTypes.bool,
253
- searchIcon: PropTypes.bool,
254
- loading: PropTypes.bool,
255
- required: PropTypes.bool,
256
- isInline: PropTypes.bool,
257
- forLabel: PropTypes.string,
258
- value: PropTypes.string,
253
+ autoFilter: PropTypes.bool,
254
+ className: PropTypes.any,
255
+ debounce: PropTypes.number,
259
256
  displayMenu: PropTypes.string,
260
- label: PropTypes.string,
261
- options: PropTypes.array,
257
+ forLabel: PropTypes.string,
262
258
  getOptionLabel: PropTypes.func,
263
259
  getOptionValue: PropTypes.func,
264
- onInputChange: PropTypes.func,
260
+ id: PropTypes.string,
261
+ isInline: PropTypes.bool,
262
+ label: PropTypes.string,
263
+ loading: PropTypes.bool,
264
+ minLength: PropTypes.number,
265
265
  noOptionsMessage: PropTypes.func,
266
266
  onChange: PropTypes.func,
267
- className: PropTypes.any,
268
- minLength: PropTypes.number,
269
- debounce: PropTypes.number,
267
+ onInputChange: PropTypes.func,
268
+ options: PropTypes.array,
269
+ required: PropTypes.bool,
270
+ searchIcon: PropTypes.bool,
271
+ showAllValues: PropTypes.bool,
272
+ source: PropTypes.func,
273
+ value: PropTypes.string,
270
274
  };
271
275
 
272
276
  FormAutocomplete.displayName = 'FormAutocomplete';
@@ -96,7 +96,7 @@
96
96
  "placeholder": {
97
97
  "type": "color",
98
98
  "description": "Use for placeholder text in fields",
99
- "value": "#8f8c8b"
99
+ "value": "#757575"
100
100
  },
101
101
  "disabled": {
102
102
  "type": "color",
@@ -149,7 +149,7 @@
149
149
  },
150
150
  "disabled": {
151
151
  "type": "color",
152
- "value": "#8f8c8b"
152
+ "value": "#757575"
153
153
  }
154
154
  },
155
155
  "button": {
@@ -1476,7 +1476,7 @@
1476
1476
  "type": "color"
1477
1477
  },
1478
1478
  "45": {
1479
- "value": "#8f8c8b",
1479
+ "value": "#757575",
1480
1480
  "type": "color"
1481
1481
  },
1482
1482
  "50": {