@automattic/vip-design-system 0.26.3 → 0.26.5
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.
- package/build/system/Form/Input.js +0 -1
- package/build/system/Form/Validation.js +1 -0
- package/build/system/NewForm/Form.js +9 -3
- package/build/system/NewForm/FormAutocomplete.js +10 -5
- package/build/system/ResourceList/ResourceList.js +1 -1
- package/package.json +1 -1
- package/src/system/Form/Input.js +0 -1
- package/src/system/Form/Validation.js +1 -1
- package/src/system/NewForm/Form.js +9 -2
- package/src/system/NewForm/FormAutocomplete.js +6 -3
- package/build/system/Form/MultiSelect.js +0 -38
- package/build/system/UsageChart/UsageChart.js +0 -60
- package/build/system/UsageChart/index.js +0 -7
|
@@ -79,7 +79,6 @@ var Input = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
79
79
|
ref: ref,
|
|
80
80
|
id: forLabel,
|
|
81
81
|
required: required,
|
|
82
|
-
noValidate: true,
|
|
83
82
|
"aria-describedby": hasError ? "describe-" + forLabel + "-validation" : undefined,
|
|
84
83
|
sx: (0, _extends2["default"])({}, inputStyles, sx)
|
|
85
84
|
}, props)), hasError && errorMessage && (0, _jsxRuntime.jsx)(_.Validation, {
|
|
@@ -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)(
|
|
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
package/src/system/Form/Input.js
CHANGED
|
@@ -26,7 +26,7 @@ const Validation = ( { children, isValid, describedId = null, ...props } ) => {
|
|
|
26
26
|
id={ describedId ? `describe-${ describedId }-validation` : undefined }
|
|
27
27
|
{ ...props }
|
|
28
28
|
>
|
|
29
|
-
<Icon sx={ { mr: 1 } } aria-label={ IconLabel } />
|
|
29
|
+
<Icon sx={ { mr: 1 } } role="img" aria-label={ IconLabel } />
|
|
30
30
|
{ children }
|
|
31
31
|
</p>
|
|
32
32
|
);
|
|
@@ -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
|
|
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';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.MultiSelect = void 0;
|
|
5
|
-
|
|
6
|
-
var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
7
|
-
|
|
8
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
-
|
|
14
|
-
var vipGold = '#c29c69'; // hardcoding for now
|
|
15
|
-
|
|
16
|
-
var vipGrey2 = '#d7dee2';
|
|
17
|
-
var customStyles = {
|
|
18
|
-
control: function control(styles) {
|
|
19
|
-
return _extends({}, styles, {
|
|
20
|
-
border: "1px solid " + vipGrey2,
|
|
21
|
-
boxShadow: 'none',
|
|
22
|
-
'&:hover': {
|
|
23
|
-
border: "1px solid " + vipGold
|
|
24
|
-
},
|
|
25
|
-
'&:focus': {
|
|
26
|
-
border: "1px solid " + vipGold
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
var MultiSelect = function MultiSelect(props) {
|
|
33
|
-
return (0, _jsxRuntime.jsx)(_reactSelect["default"], _extends({}, props, {
|
|
34
|
-
styles: customStyles
|
|
35
|
-
}));
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
exports.MultiSelect = MultiSelect;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.UsageChart = void 0;
|
|
5
|
-
|
|
6
|
-
var _framerMotion = require("framer-motion");
|
|
7
|
-
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* External dependencies
|
|
16
|
-
*/
|
|
17
|
-
var UsageChart = function UsageChart(_ref) {
|
|
18
|
-
var total = _ref.total,
|
|
19
|
-
max = _ref.max,
|
|
20
|
-
_ref$variant = _ref.variant,
|
|
21
|
-
variant = _ref$variant === void 0 ? 'primary' : _ref$variant;
|
|
22
|
-
var width = total / max * 100 + '%';
|
|
23
|
-
var formattedTotal = total;
|
|
24
|
-
|
|
25
|
-
if (total > 1000000) {
|
|
26
|
-
formattedTotal = (total / 1000000).toFixed(2) + "M";
|
|
27
|
-
} else if (total > 1000) {
|
|
28
|
-
formattedTotal = (total / 1000).toFixed(2) + "K";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return (0, _jsxRuntime.jsx)("div", {
|
|
32
|
-
sx: {
|
|
33
|
-
height: variant === 'primary' ? 32 : 8,
|
|
34
|
-
overflow: 'hidden',
|
|
35
|
-
backgroundColor: variant === 'primary' ? 'border' : 'transparent'
|
|
36
|
-
},
|
|
37
|
-
children: (0, _jsxRuntime.jsx)(_framerMotion.motion.div, {
|
|
38
|
-
initial: {
|
|
39
|
-
width: 0
|
|
40
|
-
},
|
|
41
|
-
animate: {
|
|
42
|
-
width: width
|
|
43
|
-
},
|
|
44
|
-
transition: {
|
|
45
|
-
duration: 0.7
|
|
46
|
-
},
|
|
47
|
-
sx: {
|
|
48
|
-
height: '100%',
|
|
49
|
-
backgroundColor: variant === 'primary' ? 'primary' : 'grey.40'
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
exports.UsageChart = UsageChart;
|
|
56
|
-
UsageChart.propTypes = {
|
|
57
|
-
total: _propTypes["default"].number,
|
|
58
|
-
max: _propTypes["default"].number,
|
|
59
|
-
variant: _propTypes["default"].string
|
|
60
|
-
};
|