@automattic/vip-design-system 0.26.4 → 0.26.6

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.
@@ -27,7 +27,6 @@ var Validation = function Validation(_ref) {
27
27
  describedId = _ref$describedId === void 0 ? null : _ref$describedId,
28
28
  props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
29
29
  var Icon = isValid ? _md.MdCheckCircle : _md.MdErrorOutline;
30
- var IconLabel = isValid ? 'Valid' : 'Invalid';
31
30
  return (0, _jsxRuntime.jsxs)("p", (0, _extends2["default"])({
32
31
  sx: {
33
32
  color: isValid ? 'success' : 'error',
@@ -42,8 +41,7 @@ var Validation = function Validation(_ref) {
42
41
  sx: {
43
42
  mr: 1
44
43
  },
45
- role: "img",
46
- "aria-label": IconLabel
44
+ "aria-hidden": "true"
47
45
  }), children]
48
46
  }));
49
47
  };
@@ -13,15 +13,20 @@ var _react = _interopRequireDefault(require("react"));
13
13
 
14
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
 
16
+ var _classnames = _interopRequireDefault(require("classnames"));
17
+
16
18
  var _jsxRuntime = require("theme-ui/jsx-runtime");
17
19
 
18
- var _excluded = ["children"];
20
+ var _excluded = ["children", "className"];
19
21
 
20
22
  var Form = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
21
23
  var children = _ref.children,
24
+ className = _ref.className,
22
25
  props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
23
26
  return (0, _jsxRuntime.jsx)("form", (0, _extends2["default"])({
24
- ref: forwardRef
27
+ ref: forwardRef,
28
+ className: (0, _classnames["default"])('vip-form-component', className),
29
+ noValidate: true
25
30
  }, props, {
26
31
  children: children
27
32
  }));
@@ -29,6 +34,7 @@ var Form = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef)
29
34
 
30
35
  exports.Form = Form;
31
36
  Form.propTypes = {
32
- children: _propTypes["default"].any
37
+ children: _propTypes["default"].any,
38
+ className: _propTypes["default"].any
33
39
  };
34
40
  Form.displayName = 'Form';
@@ -13,10 +13,10 @@ var _react = _interopRequireWildcard(require("react"));
13
13
 
14
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
 
16
- var _Label = require("../Form/Label");
17
-
18
16
  var _react2 = _interopRequireDefault(require("accessible-autocomplete/react"));
19
17
 
18
+ var _classnames = _interopRequireDefault(require("classnames"));
19
+
20
20
  var _FormAutocomplete = _interopRequireDefault(require("./FormAutocomplete.css"));
21
21
 
22
22
  exports.css = _FormAutocomplete["default"];
@@ -25,9 +25,11 @@ var _FormSelectContent = require("./FormSelectContent");
25
25
 
26
26
  var _FormSelectArrow = require("./FormSelectArrow");
27
27
 
28
+ var _Label = require("../Form/Label");
29
+
28
30
  var _jsxRuntime = require("theme-ui/jsx-runtime");
29
31
 
30
- var _excluded = ["isInline", "forLabel", "options", "label", "getOptionLabel", "getOptionValue", "onChange", "value", "showAllValues", "displayMenu", "id"];
32
+ var _excluded = ["isInline", "forLabel", "options", "label", "getOptionLabel", "getOptionValue", "onChange", "value", "showAllValues", "displayMenu", "id", "className"];
31
33
 
32
34
  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); }
33
35
 
@@ -122,6 +124,7 @@ var FormAutocomplete = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
122
124
  displayMenu = _ref$displayMenu === void 0 ? 'overlay' : _ref$displayMenu,
123
125
  _ref$id = _ref.id,
124
126
  id = _ref$id === void 0 ? 'vip-autocomplete' : _ref$id,
127
+ className = _ref.className,
125
128
  props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
126
129
 
127
130
  var _useState = (0, _react.useState)(false),
@@ -184,7 +187,8 @@ var FormAutocomplete = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
184
187
  setIsDirty(true);
185
188
  });
186
189
  }, [setIsDirty]);
187
- return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
190
+ return (0, _jsxRuntime.jsxs)("div", {
191
+ className: (0, _classnames["default"])('vip-form-autocomplete-component', className),
188
192
  children: [label && !isInline && (0, _jsxRuntime.jsx)(SelectLabel, {}), (0, _jsxRuntime.jsx)("div", {
189
193
  sx: (0, _extends2["default"])({}, defaultStyles, isInline && inlineStyles),
190
194
  children: (0, _jsxRuntime.jsxs)(_FormSelectContent.FormSelectContent, {
@@ -216,6 +220,7 @@ FormAutocomplete.propTypes = {
216
220
  options: _propTypes["default"].array,
217
221
  getOptionLabel: _propTypes["default"].func,
218
222
  getOptionValue: _propTypes["default"].func,
219
- onChange: _propTypes["default"].func
223
+ onChange: _propTypes["default"].func,
224
+ className: _propTypes["default"].any
220
225
  };
221
226
  FormAutocomplete.displayName = 'FormAutocomplete';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip-design-system",
3
- "version": "0.26.4",
3
+ "version": "0.26.6",
4
4
  "main": "build/system/index.js",
5
5
  "scripts": {
6
6
  "build-storybook": "build-storybook",
@@ -12,7 +12,6 @@ import { MdErrorOutline, MdCheckCircle } from 'react-icons/md';
12
12
 
13
13
  const Validation = ( { children, isValid, describedId = null, ...props } ) => {
14
14
  const Icon = isValid ? MdCheckCircle : MdErrorOutline;
15
- const IconLabel = isValid ? 'Valid' : 'Invalid';
16
15
 
17
16
  return (
18
17
  <p
@@ -26,7 +25,7 @@ const Validation = ( { children, isValid, describedId = null, ...props } ) => {
26
25
  id={ describedId ? `describe-${ describedId }-validation` : undefined }
27
26
  { ...props }
28
27
  >
29
- <Icon sx={ { mr: 1 } } role="img" aria-label={ IconLabel } />
28
+ <Icon sx={ { mr: 1 } } aria-hidden="true" />
30
29
  { children }
31
30
  </p>
32
31
  );
@@ -3,15 +3,22 @@
3
3
  */
4
4
  import React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import classNames from 'classnames';
6
7
 
7
- const Form = React.forwardRef( ( { children, ...props }, forwardRef ) => (
8
- <form ref={ forwardRef } { ...props }>
8
+ const Form = React.forwardRef( ( { children, className, ...props }, forwardRef ) => (
9
+ <form
10
+ ref={ forwardRef }
11
+ className={ classNames( 'vip-form-component', className ) }
12
+ noValidate
13
+ { ...props }
14
+ >
9
15
  { children }
10
16
  </form>
11
17
  ) );
12
18
 
13
19
  Form.propTypes = {
14
20
  children: PropTypes.any,
21
+ className: PropTypes.any,
15
22
  };
16
23
 
17
24
  Form.displayName = 'Form';
@@ -5,8 +5,8 @@
5
5
  */
6
6
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import { Label } from '../Form/Label';
9
8
  import Autocomplete from 'accessible-autocomplete/react';
9
+ import classNames from 'classnames';
10
10
 
11
11
  /**
12
12
  * Internal dependencies
@@ -14,6 +14,7 @@ import Autocomplete from 'accessible-autocomplete/react';
14
14
  import css from './FormAutocomplete.css';
15
15
  import { FormSelectContent } from './FormSelectContent';
16
16
  import { FormSelectArrow } from './FormSelectArrow';
17
+ import { Label } from '../Form/Label';
17
18
 
18
19
  const defaultStyles = {
19
20
  width: '100%',
@@ -81,6 +82,7 @@ const FormAutocomplete = React.forwardRef(
81
82
  showAllValues = true,
82
83
  displayMenu = 'overlay',
83
84
  id = 'vip-autocomplete',
85
+ className,
84
86
  ...props
85
87
  },
86
88
  forwardRef
@@ -152,7 +154,7 @@ const FormAutocomplete = React.forwardRef(
152
154
  }, [ setIsDirty ] );
153
155
 
154
156
  return (
155
- <>
157
+ <div className={ classNames( 'vip-form-autocomplete-component', className ) }>
156
158
  { label && ! isInline && <SelectLabel /> }
157
159
 
158
160
  <div sx={ { ...defaultStyles, ...( isInline && inlineStyles ) } }>
@@ -173,7 +175,7 @@ const FormAutocomplete = React.forwardRef(
173
175
  <FormSelectArrow />
174
176
  </FormSelectContent>
175
177
  </div>
176
- </>
178
+ </div>
177
179
  );
178
180
  }
179
181
  );
@@ -190,6 +192,7 @@ FormAutocomplete.propTypes = {
190
192
  getOptionLabel: PropTypes.func,
191
193
  getOptionValue: PropTypes.func,
192
194
  onChange: PropTypes.func,
195
+ className: PropTypes.any,
193
196
  };
194
197
 
195
198
  FormAutocomplete.displayName = 'FormAutocomplete';