@canonical/react-components 0.20.0 → 0.24.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.
package/README.md CHANGED
@@ -6,7 +6,7 @@ This is a collection of components designed to be the way to consume [Vanilla Fr
6
6
 
7
7
  See the [component docs](https://canonical-web-and-design.github.io/react-components/) for usage instructions.
8
8
 
9
- ![CI](https://github.com/canonical-web-and-design/react-components/workflows/CI/badge.svg?branch=master)
9
+ ![CI](https://github.com/canonical-web-and-design/react-components/workflows/CI/badge.svg?branch=main)
10
10
  ![Cypress chrome headless](https://github.com/canonical-web-and-design/react-components/workflows/Cypress%20chrome%20headless/badge.svg)
11
11
 
12
12
  ## Requirements
@@ -36,9 +36,9 @@ Please file any issues at [GitHub](https://github.com/canonical-web-and-design/r
36
36
  You might want to:
37
37
 
38
38
  - [View the source](https://github.com/canonical-web-and-design/react-components) on GitHub.
39
- - Read about [developing components](https://github.com/canonical-web-and-design/react-components/blob/master/HACKING.md).
40
- - Find out how to [publish to NPM](https://github.com/canonical-web-and-design/react-components/blob/master/PUBLISH-NPM-PACKAGE.md).
41
- - Know how to [publish the docs](https://github.com/canonical-web-and-design/react-components/blob/master/PUBLISHING-DOCS.md) to GitHub Pages.
39
+ - Read about [developing components](https://github.com/canonical-web-and-design/react-components/blob/main/HACKING.md).
40
+ - Find out how to [publish to NPM](https://github.com/canonical-web-and-design/react-components/blob/main/PUBLISH-NPM-PACKAGE.md).
41
+ - Know how to [publish the docs](https://github.com/canonical-web-and-design/react-components/blob/main/PUBLISHING-DOCS.md) to GitHub Pages.
42
42
 
43
43
  ## Developing locally using this repository
44
44
 
@@ -24,6 +24,14 @@ export declare const ICONS: {
24
24
  readonly success: "success";
25
25
  readonly user: "user";
26
26
  readonly warning: "warning";
27
+ readonly facebook: "facebook";
28
+ readonly twitter: "twitter";
29
+ readonly instagram: "instagram";
30
+ readonly linkedin: "linkedin";
31
+ readonly youtube: "youtube";
32
+ readonly github: "github";
33
+ readonly rss: "rss";
34
+ readonly email: "email";
27
35
  };
28
36
  export declare type Props = PropsWithSpread<{
29
37
  /**
@@ -40,7 +40,15 @@ var ICONS = {
40
40
  spinner: "spinner",
41
41
  success: "success",
42
42
  user: "user",
43
- warning: "warning"
43
+ warning: "warning",
44
+ facebook: "facebook",
45
+ twitter: "twitter",
46
+ instagram: "instagram",
47
+ linkedin: "linkedin",
48
+ youtube: "youtube",
49
+ github: "github",
50
+ rss: "rss",
51
+ email: "email"
44
52
  };
45
53
  exports.ICONS = ICONS;
46
54
 
@@ -13,7 +13,7 @@ export declare type Props = PropsWithSpread<{
13
13
  */
14
14
  className?: ClassName;
15
15
  /**
16
- * The content for error validation.
16
+ * The content for error validation message. Controls the value of aria-invalid attribute.
17
17
  */
18
18
  error?: ReactNode;
19
19
  /**
@@ -64,7 +64,8 @@ var Input = function Input(_ref) {
64
64
  className: (0, _classnames.default)("p-form-validation__input", className),
65
65
  id: id,
66
66
  ref: inputRef,
67
- type: type
67
+ type: type,
68
+ "aria-invalid": !!error
68
69
  }, inputProps)));
69
70
  };
70
71
 
@@ -1,9 +1,15 @@
1
- import { ReactElement, ReactNode } from "react";
2
- export declare type Props = {
1
+ import { ReactElement } from "react";
2
+ import type { HTMLProps, ReactNode } from "react";
3
+ import { ClassName, PropsWithSpread } from "../../types";
4
+ export declare type Props = PropsWithSpread<{
3
5
  /**
4
6
  * Buttons to display underneath the main modal content.
5
7
  */
6
8
  buttonRow?: ReactNode | null;
9
+ /**
10
+ * Optional class(es) to apply to the wrapping element.
11
+ */
12
+ className?: ClassName;
7
13
  /**
8
14
  * The content of the modal.
9
15
  */
@@ -16,6 +22,6 @@ export declare type Props = {
16
22
  * The title of the modal.
17
23
  */
18
24
  title?: ReactNode | null;
19
- };
20
- export declare const Modal: ({ buttonRow, children, close, title, }: Props) => ReactElement;
25
+ }, HTMLProps<HTMLDivElement>>;
26
+ export declare const Modal: ({ buttonRow, children, className, close, title, ...wrapperProps }: Props) => ReactElement;
21
27
  export default Modal;
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = exports.Modal = void 0;
9
9
 
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
11
 
12
12
  var _nanoid = require("nanoid");
13
13
 
@@ -19,44 +19,102 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
+ 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); }
23
+
24
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
+
26
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
27
+
22
28
  var Modal = function Modal(_ref) {
23
29
  var buttonRow = _ref.buttonRow,
24
30
  children = _ref.children,
31
+ className = _ref.className,
25
32
  close = _ref.close,
26
- title = _ref.title;
33
+ title = _ref.title,
34
+ wrapperProps = _objectWithoutProperties(_ref, ["buttonRow", "children", "className", "close", "title"]);
35
+
36
+ // list of focusable selectors is based on this Stack Overflow answer:
37
+ // https://stackoverflow.com/a/30753870/3732840
38
+ var focusableElementSelectors = 'a[href]:not([tabindex="-1"]), button:not([disabled]), textarea:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([tabindex="-1"]), select:not([disabled]):not([tabindex="-1"]), area[href]:not([tabindex="-1"]), iframe:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"]), [contentEditable=true]:not([tabindex="-1"])';
27
39
  var descriptionId = (0, _react.useRef)((0, _nanoid.nanoid)());
28
- var titleId = (0, _react.useRef)((0, _nanoid.nanoid)()); // This useEffect sets up listeners so the panel will close if user clicks
29
- // anywhere else on the page or hits the escape key
40
+ var titleId = (0, _react.useRef)((0, _nanoid.nanoid)());
41
+ var shouldClose = (0, _react.useRef)(false);
42
+ var modalRef = (0, _react.useRef)(null);
43
+ var focusableModalElements = (0, _react.useRef)(null);
30
44
 
31
- (0, _react.useEffect)(function () {
32
- var keyDown = function keyDown(e) {
33
- if (e.code === "Escape") {
34
- // Close panel if Esc keydown detected
35
- if (close) {
36
- close();
37
- }
45
+ var handleTabKey = function handleTabKey(e) {
46
+ if (focusableModalElements.current.length > 0) {
47
+ var firstElement = focusableModalElements.current[0];
48
+ var lastElement = focusableModalElements.current[focusableModalElements.current.length - 1];
49
+
50
+ if (!e.shiftKey && document.activeElement === lastElement) {
51
+ firstElement.focus();
52
+ e.preventDefault();
38
53
  }
39
- }; // Add listener on document to capture keydown events
40
54
 
55
+ if (e.shiftKey && document.activeElement === firstElement) {
56
+ lastElement.focus();
57
+ return e.preventDefault();
58
+ }
59
+ }
60
+ };
41
61
 
42
- document.addEventListener("keydown", keyDown); // return function to be called when unmounted
62
+ var keyListenersMap = new Map([[27, close], [9, handleTabKey]]);
63
+ (0, _react.useEffect)(function () {
64
+ modalRef.current.focus();
65
+ }, [modalRef]);
66
+ (0, _react.useEffect)(function () {
67
+ var _focusableModalElemen;
43
68
 
69
+ focusableModalElements.current = modalRef.current.querySelectorAll(focusableElementSelectors);
70
+ (_focusableModalElemen = focusableModalElements.current[0]) === null || _focusableModalElemen === void 0 ? void 0 : _focusableModalElemen.focus();
71
+ }, []);
72
+ (0, _react.useEffect)(function () {
73
+ var keyDown = function keyDown(e) {
74
+ var listener = keyListenersMap.get(e.keyCode);
75
+ return listener && listener(e);
76
+ };
77
+
78
+ document.addEventListener("keydown", keyDown);
44
79
  return function () {
45
80
  document.removeEventListener("keydown", keyDown);
46
81
  };
47
- }, [close]);
48
- return /*#__PURE__*/_react.default.createElement("div", {
49
- className: "p-modal",
50
- onClick: close
51
- }, /*#__PURE__*/_react.default.createElement("section", {
82
+ });
83
+
84
+ var handleContentOnMouseDown = function handleContentOnMouseDown() {
85
+ shouldClose.current = false;
86
+ };
87
+
88
+ var handleContentOnMouseUp = function handleContentOnMouseUp() {
89
+ shouldClose.current = false;
90
+ };
91
+
92
+ var handleOverlayOnMouseDown = function handleOverlayOnMouseDown(event) {
93
+ if (event.target === modalRef.current) {
94
+ shouldClose.current = true;
95
+ }
96
+ };
97
+
98
+ var handleOverlayOnClick = function handleOverlayOnClick() {
99
+ if (shouldClose.current) {
100
+ close();
101
+ }
102
+ };
103
+
104
+ return /*#__PURE__*/_react.default.createElement("div", _extends({
105
+ className: (0, _classnames.default)("p-modal", className),
106
+ onClick: handleOverlayOnClick,
107
+ onMouseDown: handleOverlayOnMouseDown
108
+ }, wrapperProps, {
109
+ ref: modalRef
110
+ }), /*#__PURE__*/_react.default.createElement("section", {
52
111
  className: "p-modal__dialog",
53
112
  role: "dialog",
54
113
  "aria-modal": "true",
55
114
  "aria-labelledby": titleId.current,
56
115
  "aria-describedby": descriptionId.current,
57
- onClick: function onClick(evt) {
58
- return evt.stopPropagation();
59
- }
116
+ onMouseDown: handleContentOnMouseDown,
117
+ onMouseUp: handleContentOnMouseUp
60
118
  }, !!title && /*#__PURE__*/_react.default.createElement("header", {
61
119
  className: "p-modal__header"
62
120
  }, /*#__PURE__*/_react.default.createElement("h2", {
@@ -74,11 +132,5 @@ var Modal = function Modal(_ref) {
74
132
  };
75
133
 
76
134
  exports.Modal = Modal;
77
- Modal.propTypes = {
78
- buttonRow: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.oneOf([null])]),
79
- children: _propTypes.default.node.isRequired,
80
- close: _propTypes.default.func,
81
- title: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.oneOf([null])])
82
- };
83
135
  var _default = Modal;
84
136
  exports.default = _default;
@@ -83,27 +83,27 @@ var Notification = function Notification(_ref) {
83
83
  className: "p-notification__content"
84
84
  }, title && /*#__PURE__*/_react.default.createElement("h5", {
85
85
  className: "p-notification__title",
86
- "data-test": "notification-title"
86
+ "data-testid": "notification-title"
87
87
  }, title), inline && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "\u2002"), /*#__PURE__*/_react.default.createElement("p", {
88
88
  className: "p-notification__message"
89
89
  }, children), onDismiss && /*#__PURE__*/_react.default.createElement("button", {
90
90
  "aria-label": "Close notification",
91
91
  className: "p-notification__close",
92
- "data-test": "notification-close-button",
92
+ "data-testid": "notification-close-button",
93
93
  onClick: onDismiss
94
94
  }, "Close")), showMeta && /*#__PURE__*/_react.default.createElement("div", {
95
95
  className: "p-notification__meta",
96
- "data-test": "notification-meta"
96
+ "data-testid": "notification-meta"
97
97
  }, timestamp && /*#__PURE__*/_react.default.createElement("span", {
98
98
  className: "p-notification__timestamp",
99
- "data-test": "notification-timestamp"
99
+ "data-testid": "notification-timestamp"
100
100
  }, timestamp), hasActions ? /*#__PURE__*/_react.default.createElement("div", {
101
101
  className: "p-notification__actions"
102
102
  }, actions.map(function (action, i) {
103
103
  return /*#__PURE__*/_react.default.createElement(_Button.default, {
104
104
  appearance: _Button.ButtonAppearance.LINK,
105
105
  className: "p-notification__action",
106
- "data-test": "notification-action",
106
+ "data-testid": "notification-action",
107
107
  key: "".concat(action.label, "-").concat(i),
108
108
  onClick: action.onClick
109
109
  }, action.label);
@@ -0,0 +1,91 @@
1
+ import React from "react";
2
+ import type { InputHTMLAttributes, ReactNode } from "react";
3
+ import type { ClassName, PropsWithSpread } from "../../types";
4
+ /**
5
+ * The props for the Password Toggle component.
6
+ */
7
+ export declare type Props = PropsWithSpread<{
8
+ /**
9
+ * The content for caution validation.
10
+ */
11
+ caution?: ReactNode;
12
+ /**
13
+ * Optional class(es) to pass to the input element.
14
+ */
15
+ className?: ClassName;
16
+ /**
17
+ * The content for error validation.
18
+ */
19
+ error?: ReactNode;
20
+ /**
21
+ * Help text to show below the field.
22
+ */
23
+ help?: ReactNode;
24
+ /**
25
+ * The id of the input.
26
+ */
27
+ id: string;
28
+ /**
29
+ * The label for the field.
30
+ */
31
+ label?: ReactNode;
32
+ /**
33
+ * Whether the field is read only.
34
+ */
35
+ readOnly?: boolean;
36
+ /**
37
+ * Whether the field is required.
38
+ */
39
+ required?: boolean;
40
+ /**
41
+ * The content for success validation.
42
+ */
43
+ success?: ReactNode;
44
+ /**
45
+ * Optional class(es) to pass to the wrapping Field component
46
+ */
47
+ wrapperClassName?: string;
48
+ }, InputHTMLAttributes<HTMLInputElement>>;
49
+ declare const PasswordToggle: React.ForwardRefExoticComponent<{
50
+ /**
51
+ * The content for caution validation.
52
+ */
53
+ caution?: ReactNode;
54
+ /**
55
+ * Optional class(es) to pass to the input element.
56
+ */
57
+ className?: ClassName;
58
+ /**
59
+ * The content for error validation.
60
+ */
61
+ error?: ReactNode;
62
+ /**
63
+ * Help text to show below the field.
64
+ */
65
+ help?: ReactNode;
66
+ /**
67
+ * The id of the input.
68
+ */
69
+ id: string;
70
+ /**
71
+ * The label for the field.
72
+ */
73
+ label?: ReactNode;
74
+ /**
75
+ * Whether the field is read only.
76
+ */
77
+ readOnly?: boolean;
78
+ /**
79
+ * Whether the field is required.
80
+ */
81
+ required?: boolean;
82
+ /**
83
+ * The content for success validation.
84
+ */
85
+ success?: ReactNode;
86
+ /**
87
+ * Optional class(es) to pass to the wrapping Field component
88
+ */
89
+ wrapperClassName?: string;
90
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "label" | "className" | "error" | "id" | "readOnly" | "required" | "help" | "success" | "caution" | "wrapperClassName"> & React.RefAttributes<HTMLInputElement>>;
91
+ export default PasswordToggle;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+
12
+ var _react = _interopRequireWildcard(require("react"));
13
+
14
+ var _Button = _interopRequireDefault(require("../Button"));
15
+
16
+ var _Field = _interopRequireDefault(require("../Field"));
17
+
18
+ var _Label = _interopRequireDefault(require("../Label"));
19
+
20
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
21
+
22
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+
26
+ 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); }
27
+
28
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
+
30
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
31
+
32
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
33
+
34
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
35
+
36
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
37
+
38
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
+
40
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
41
+
42
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
43
+
44
+ var PasswordToggle = _react.default.forwardRef(function (_ref, ref) {
45
+ var caution = _ref.caution,
46
+ className = _ref.className,
47
+ error = _ref.error,
48
+ help = _ref.help,
49
+ id = _ref.id,
50
+ label = _ref.label,
51
+ readOnly = _ref.readOnly,
52
+ required = _ref.required,
53
+ success = _ref.success,
54
+ wrapperClassName = _ref.wrapperClassName,
55
+ inputProps = _objectWithoutProperties(_ref, ["caution", "className", "error", "help", "id", "label", "readOnly", "required", "success", "wrapperClassName"]);
56
+
57
+ var _useState = (0, _react.useState)(true),
58
+ _useState2 = _slicedToArray(_useState, 2),
59
+ isPassword = _useState2[0],
60
+ setIsPassword = _useState2[1];
61
+
62
+ var togglePassword = function togglePassword() {
63
+ if (isPassword) {
64
+ setIsPassword(false);
65
+ } else {
66
+ setIsPassword(true);
67
+ }
68
+ };
69
+
70
+ return /*#__PURE__*/_react.default.createElement(_Field.default, {
71
+ caution: caution,
72
+ className: wrapperClassName,
73
+ error: error,
74
+ help: help,
75
+ required: required,
76
+ success: success
77
+ }, /*#__PURE__*/_react.default.createElement("div", {
78
+ className: "p-form-password-toggle"
79
+ }, /*#__PURE__*/_react.default.createElement(_Label.default, {
80
+ forId: id,
81
+ required: required
82
+ }, label), /*#__PURE__*/_react.default.createElement(_Button.default, {
83
+ appearance: "base",
84
+ className: "u-no-margin--bottom",
85
+ hasIcon: true,
86
+ "aria-controls": id,
87
+ "aria-live": "polite",
88
+ onClick: function onClick() {
89
+ return togglePassword();
90
+ }
91
+ }, /*#__PURE__*/_react.default.createElement("span", {
92
+ className: "p-form-password-toggle__label"
93
+ }, isPassword ? "Show" : "Hide"), /*#__PURE__*/_react.default.createElement("i", {
94
+ className: isPassword ? "p-icon--show" : "p-icon--hide"
95
+ }))), /*#__PURE__*/_react.default.createElement("input", _extends({
96
+ className: (0, _classnames.default)("p-form-validation__input", className),
97
+ id: id,
98
+ ref: ref,
99
+ type: isPassword ? "password" : "text",
100
+ readOnly: readOnly
101
+ }, inputProps)));
102
+ });
103
+
104
+ var _default = PasswordToggle;
105
+ exports.default = _default;
@@ -0,0 +1,2 @@
1
+ export { default } from "./PasswordToggle";
2
+ export type { Props as PasswordToggleProps } from "./PasswordToggle";
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _PasswordToggle.default;
10
+ }
11
+ });
12
+
13
+ var _PasswordToggle = _interopRequireDefault(require("./PasswordToggle"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,7 +1,5 @@
1
- import React from "react";
2
- import type { HTMLProps, FormEvent } from "react";
3
- import type { ClassName, PropsWithSpread } from "../../types";
4
- export declare type Props = PropsWithSpread<{
1
+ import type { ClassName } from "../../types";
2
+ export declare type Props = {
5
3
  /**
6
4
  * Whether autocomplete should be enabled for the search input.
7
5
  */
@@ -23,9 +21,9 @@ export declare type Props = PropsWithSpread<{
23
21
  */
24
22
  onChange?: (inputValue: string) => void;
25
23
  /**
26
- * A function that will be called when the form is submitted.
24
+ * A function that is called when the user clicks the search icon
27
25
  */
28
- onSubmit?: (evt: FormEvent) => void;
26
+ onSearch?: () => void;
29
27
  /**
30
28
  * A search input placeholder message.
31
29
  */
@@ -34,6 +32,9 @@ export declare type Props = PropsWithSpread<{
34
32
  * The value of the search input when the state is externally controlled.
35
33
  */
36
34
  value?: string;
37
- }, HTMLProps<HTMLFormElement>>;
38
- declare const SearchBox: React.ForwardRefExoticComponent<Pick<Props, "content" | "title" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "pattern" | "children" | "list" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "externallyControlled" | "autocomplete"> & React.RefAttributes<HTMLFormElement>>;
35
+ };
36
+ declare const SearchBox: {
37
+ ({ autocomplete, className, disabled, externallyControlled, onChange, onSearch, placeholder, value, }: Props): JSX.Element;
38
+ displayName: string;
39
+ };
39
40
  export default SearchBox;
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
8
10
  var _classnames = _interopRequireDefault(require("classnames"));
9
11
 
10
12
  var _react = _interopRequireDefault(require("react"));
@@ -13,26 +15,19 @@ var _Icon = _interopRequireDefault(require("../Icon"));
13
15
 
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
 
16
- 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); }
17
-
18
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
-
20
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
21
-
22
- var SearchBox = _react.default.forwardRef(function (_ref, ref) {
18
+ var SearchBox = function SearchBox(_ref) {
23
19
  var _ref$autocomplete = _ref.autocomplete,
24
20
  autocomplete = _ref$autocomplete === void 0 ? "on" : _ref$autocomplete,
25
21
  className = _ref.className,
26
22
  disabled = _ref.disabled,
27
23
  externallyControlled = _ref.externallyControlled,
28
24
  _onChange = _ref.onChange,
29
- onSubmit = _ref.onSubmit,
25
+ onSearch = _ref.onSearch,
30
26
  _ref$placeholder = _ref.placeholder,
31
27
  placeholder = _ref$placeholder === void 0 ? "Search" : _ref$placeholder,
32
- value = _ref.value,
33
- props = _objectWithoutProperties(_ref, ["autocomplete", "className", "disabled", "externallyControlled", "onChange", "onSubmit", "placeholder", "value"]);
28
+ value = _ref.value;
34
29
 
35
- var input = _react.default.createRef();
30
+ var input = /*#__PURE__*/_react.default.createRef();
36
31
 
37
32
  var resetInput = function resetInput() {
38
33
  _onChange && _onChange("");
@@ -42,17 +37,13 @@ var SearchBox = _react.default.forwardRef(function (_ref, ref) {
42
37
  }
43
38
  };
44
39
 
45
- var submit = function submit(e) {
46
- e.preventDefault();
47
- onSubmit && onSubmit(e);
40
+ var triggerSearch = function triggerSearch() {
41
+ onSearch && onSearch();
48
42
  };
49
43
 
50
- return /*#__PURE__*/_react.default.createElement("form", _extends({
51
- className: (0, _classnames.default)("p-search-box", className),
52
- onSubmit: submit
53
- }, props, {
54
- ref: ref
55
- }), /*#__PURE__*/_react.default.createElement("label", {
44
+ return /*#__PURE__*/_react.default.createElement("div", {
45
+ className: (0, _classnames.default)("p-search-box", className)
46
+ }, /*#__PURE__*/_react.default.createElement("label", {
56
47
  className: "u-off-screen",
57
48
  htmlFor: "search"
58
49
  }, placeholder || "Search"), /*#__PURE__*/_react.default.createElement("input", {
@@ -79,12 +70,21 @@ var SearchBox = _react.default.forwardRef(function (_ref, ref) {
79
70
  }, "Clear search field")), /*#__PURE__*/_react.default.createElement("button", {
80
71
  className: "p-search-box__button",
81
72
  disabled: disabled,
82
- type: "submit"
73
+ onClick: triggerSearch
83
74
  }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
84
75
  name: "search"
85
76
  }, "Search")));
86
- });
77
+ };
87
78
 
79
+ SearchBox.propTypes = {
80
+ autocomplete: _propTypes.default.oneOf(["on", "off"]),
81
+ disabled: _propTypes.default.bool,
82
+ externallyControlled: _propTypes.default.bool,
83
+ onChange: _propTypes.default.func,
84
+ onSearch: _propTypes.default.func,
85
+ placeholder: _propTypes.default.string,
86
+ value: _propTypes.default.string
87
+ };
88
88
  SearchBox.displayName = "SearchBox";
89
89
  var _default = SearchBox;
90
90
  exports.default = _default;
@@ -24,7 +24,7 @@ export declare type Props = PropsWithSpread<{
24
24
  /**
25
25
  * The id of the input.
26
26
  */
27
- id?: string;
27
+ id?: string | null;
28
28
  /**
29
29
  * The label for the field.
30
30
  */
@@ -32,15 +32,15 @@ export declare type Props = PropsWithSpread<{
32
32
  /**
33
33
  * Optional class(es) to pass to the label component.
34
34
  */
35
- labelClassName?: string;
35
+ labelClassName?: string | null;
36
36
  /**
37
37
  * Function to run when select value changes.
38
38
  */
39
- onChange?: ChangeEventHandler<HTMLSelectElement>;
39
+ onChange?: ChangeEventHandler<HTMLSelectElement> | null;
40
40
  /**
41
41
  * Array of options that the select can choose from.
42
42
  */
43
- options?: Option[];
43
+ options?: Option[] | null;
44
44
  /**
45
45
  * Whether the field is required.
46
46
  */
@@ -60,7 +60,7 @@ export declare type Props = PropsWithSpread<{
60
60
  /**
61
61
  * Optional class(es) to pass to the wrapping Field component
62
62
  */
63
- wrapperClassName?: string;
63
+ wrapperClassName?: ClassName;
64
64
  }, SelectHTMLAttributes<HTMLSelectElement>>;
65
65
  declare const Select: ({ caution, className, error, help, id, label, labelClassName, onChange, options, required, stacked, success, takeFocus, wrapperClassName, ...selectProps }: Props) => JSX.Element;
66
66
  export default Select;
@@ -26,7 +26,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
26
26
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
27
27
 
28
28
  var generateOptions = function generateOptions(options) {
29
- return options.map(function (_ref) {
29
+ return options === null || options === void 0 ? void 0 : options.map(function (_ref) {
30
30
  var label = _ref.label,
31
31
  value = _ref.value,
32
32
  props = _objectWithoutProperties(_ref, ["label", "value"]);
@@ -42,7 +42,7 @@ var Tabs = function Tabs(_ref) {
42
42
  }, /*#__PURE__*/_react.default.createElement(Component, _extends({
43
43
  "aria-selected": active,
44
44
  className: (0, _classnames.default)("p-tabs__link", className),
45
- "data-test": "tab-link-".concat(label)
45
+ "data-testid": "tab-link-".concat(label)
46
46
  }, rest), label));
47
47
  })));
48
48
  };
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes, ReactNode } from "react";
1
+ import type { TextareaHTMLAttributes, ReactNode } from "react";
2
2
  import type { ClassName, PropsWithSpread } from "../../types";
3
3
  /**
4
4
  * The props for the Textarea component.
@@ -56,6 +56,6 @@ export declare type Props = PropsWithSpread<{
56
56
  * Optional class(es) to pass to the wrapping Field component
57
57
  */
58
58
  wrapperClassName?: string;
59
- }, HTMLAttributes<HTMLTextAreaElement>>;
59
+ }, TextareaHTMLAttributes<HTMLTextAreaElement>>;
60
60
  declare const Textarea: ({ caution, className, error, grow, help, id, label, labelClassName, onKeyUp, required, stacked, style, success, takeFocus, wrapperClassName, ...props }: Props) => JSX.Element;
61
61
  export default Textarea;
@@ -29,7 +29,7 @@ export declare type Props = {
29
29
  /**
30
30
  * Message to display when the element is hovered.
31
31
  */
32
- message?: string | null;
32
+ message?: ReactNode;
33
33
  /**
34
34
  * Position of the tooltip relative to the element.
35
35
  */
@@ -226,7 +226,7 @@ var Tooltip = function Tooltip(_ref) {
226
226
  }
227
227
  }, children), isOpen && /*#__PURE__*/_react.default.createElement(Portal, null, /*#__PURE__*/_react.default.createElement("span", {
228
228
  className: (0, _classnames.default)("p-tooltip--".concat(adjustedPosition), "is-detached", tooltipClassName),
229
- "data-test": "tooltip-portal",
229
+ "data-testid": "tooltip-portal",
230
230
  style: positionStyle
231
231
  }, /*#__PURE__*/_react.default.createElement("span", {
232
232
  className: "p-tooltip__message",
@@ -240,7 +240,7 @@ Tooltip.propTypes = {
240
240
  autoAdjust: _propTypes.default.bool,
241
241
  children: _propTypes.default.node.isRequired,
242
242
  followMouse: _propTypes.default.bool,
243
- message: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.oneOf([null])]),
243
+ message: _propTypes.default.node,
244
244
  position: _propTypes.default.oneOf(["btm-center", "btm-left", "btm-right", "left", "right", "top-center", "top-left", "top-right"]),
245
245
  positionElementClassName: _propTypes.default.string,
246
246
  tooltipClassName: _propTypes.default.string
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export { default as ModularTable } from "./components/ModularTable";
22
22
  export { default as Modal } from "./components/Modal";
23
23
  export { default as Notification, NotificationSeverity, } from "./components/Notification";
24
24
  export { default as Pagination } from "./components/Pagination";
25
+ export { default as PasswordToggle } from "./components/PasswordToggle";
25
26
  export { default as RadioInput } from "./components/RadioInput";
26
27
  export { default as Row } from "./components/Row";
27
28
  export { default as SearchAndFilter } from "./components/SearchAndFilter";
package/dist/index.js CHANGED
@@ -173,6 +173,12 @@ Object.defineProperty(exports, "Pagination", {
173
173
  return _Pagination.default;
174
174
  }
175
175
  });
176
+ Object.defineProperty(exports, "PasswordToggle", {
177
+ enumerable: true,
178
+ get: function get() {
179
+ return _PasswordToggle.default;
180
+ }
181
+ });
176
182
  Object.defineProperty(exports, "RadioInput", {
177
183
  enumerable: true,
178
184
  get: function get() {
@@ -318,6 +324,8 @@ var _Notification = _interopRequireWildcard(require("./components/Notification")
318
324
 
319
325
  var _Pagination = _interopRequireDefault(require("./components/Pagination"));
320
326
 
327
+ var _PasswordToggle = _interopRequireDefault(require("./components/PasswordToggle"));
328
+
321
329
  var _RadioInput = _interopRequireDefault(require("./components/RadioInput"));
322
330
 
323
331
  var _Row = _interopRequireDefault(require("./components/Row"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-components",
3
- "version": "0.20.0",
3
+ "version": "0.24.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "Huw Wilkins <huw.wilkins@canonical.com>",
@@ -22,45 +22,48 @@
22
22
  },
23
23
  "homepage": "/react-components/",
24
24
  "devDependencies": {
25
- "@babel/cli": "7.14.8",
26
- "@babel/preset-typescript": "7.14.5",
25
+ "@babel/cli": "7.16.0",
26
+ "@babel/preset-typescript": "7.16.0",
27
27
  "@percy/storybook": "3.3.1",
28
- "@storybook/addon-a11y": "6.3.2",
29
- "@storybook/addon-controls": "6.3.2",
30
- "@storybook/addon-docs": "6.3.2",
31
- "@storybook/addons": "6.3.2",
32
- "@storybook/react": "6.3.2",
33
- "@storybook/theming": "6.3.2",
34
- "@testing-library/react-hooks": "7.0.1",
35
- "@typescript-eslint/eslint-plugin": "4.28.1",
36
- "@typescript-eslint/parser": "4.28.1",
37
- "@wojtekmaj/enzyme-adapter-react-17": "0.6.3",
28
+ "@storybook/addon-a11y": "6.3.12",
29
+ "@storybook/addon-controls": "6.3.12",
30
+ "@storybook/addon-docs": "6.3.12",
31
+ "@storybook/addons": "6.3.12",
32
+ "@storybook/react": "6.3.12",
33
+ "@storybook/theming": "6.3.12",
34
+ "@testing-library/cypress": "8.0.2",
35
+ "@testing-library/dom": "8.11.1",
36
+ "@testing-library/react-hooks": "7.0.2",
37
+ "@testing-library/user-event": "13.5.0",
38
+ "@typescript-eslint/eslint-plugin": "4.33.0",
39
+ "@typescript-eslint/parser": "4.33.0",
40
+ "@wojtekmaj/enzyme-adapter-react-17": "0.6.5",
38
41
  "babel-eslint": "10.1.0",
39
- "babel-jest": "27.0.6",
40
- "babel-loader": "8.2.2",
42
+ "babel-jest": "27.3.1",
43
+ "babel-loader": "8.2.3",
41
44
  "babel-plugin-module-resolver": "4.1.0",
42
45
  "babel-plugin-typescript-to-proptypes": "1.4.2",
43
- "concurrently": "6.2.0",
46
+ "concurrently": "6.4.0",
44
47
  "css-loader": "5.2.7",
45
- "cypress": "7.6.0",
48
+ "cypress": "7.7.0",
46
49
  "deepmerge": "4.2.2",
47
50
  "enzyme": "3.11.0",
48
51
  "enzyme-adapter-react-16": "1.15.6",
49
52
  "enzyme-to-json": "3.6.2",
50
- "eslint": "7.30.0",
53
+ "eslint": "7.32.0",
51
54
  "eslint-config-prettier": "8.3.0",
52
55
  "eslint-config-react-app": "6.0.0",
53
- "eslint-plugin-cypress": "2.11.3",
54
- "eslint-plugin-flowtype": "5.8.1",
55
- "eslint-plugin-import": "2.23.4",
56
- "eslint-plugin-jsx-a11y": "6.4.1",
57
- "eslint-plugin-prettier": "3.4.0",
58
- "eslint-plugin-react": "7.24.0",
59
- "eslint-plugin-react-hooks": "4.2.0",
60
- "jest": "27.0.6",
56
+ "eslint-plugin-cypress": "2.12.1",
57
+ "eslint-plugin-flowtype": "5.10.0",
58
+ "eslint-plugin-import": "2.25.3",
59
+ "eslint-plugin-jsx-a11y": "6.5.1",
60
+ "eslint-plugin-prettier": "3.4.1",
61
+ "eslint-plugin-react": "7.27.1",
62
+ "eslint-plugin-react-hooks": "4.3.0",
63
+ "jest": "27.3.1",
61
64
  "node-sass": "6.0.1",
62
- "npm-package-json-lint": "5.1.0",
63
- "prettier": "2.3.2",
65
+ "npm-package-json-lint": "5.4.2",
66
+ "prettier": "2.4.1",
64
67
  "react": "17.0.2",
65
68
  "react-docgen-typescript-loader": "3.7.2",
66
69
  "react-dom": "17.0.2",
@@ -71,21 +74,21 @@
71
74
  "stylelint-config-standard": "22.0.0",
72
75
  "stylelint-order": "4.1.0",
73
76
  "stylelint-prettier": "1.2.0",
74
- "stylelint-scss": "3.19.0",
75
- "ts-jest": "27.0.4",
76
- "tsc-alias": "1.3.7",
77
- "typescript": "4.3.5",
78
- "vanilla-framework": "2.33.0",
77
+ "stylelint-scss": "3.21.0",
78
+ "ts-jest": "27.0.7",
79
+ "tsc-alias": "1.4.1",
80
+ "typescript": "4.5.2",
81
+ "vanilla-framework": "2.37.1",
79
82
  "wait-on": "5.3.0"
80
83
  },
81
84
  "dependencies": {
82
- "@types/jest": "26.0.24",
83
- "@types/node": "14.17.6",
84
- "@types/react": "17.0.15",
85
- "@types/react-dom": "17.0.9",
86
- "@types/react-table": "7.7.2",
85
+ "@types/jest": "27.0.3",
86
+ "@types/node": "16.11.9",
87
+ "@types/react": "17.0.36",
88
+ "@types/react-dom": "17.0.11",
89
+ "@types/react-table": "7.7.8",
87
90
  "classnames": "2.3.1",
88
- "nanoid": "3.1.23",
91
+ "nanoid": "3.1.30",
89
92
  "prop-types": "15.7.2",
90
93
  "react-table": "7.7.0",
91
94
  "react-useportal": "1.0.14"
@@ -93,7 +96,7 @@
93
96
  "peerDependencies": {
94
97
  "react": "17.0.2",
95
98
  "react-dom": "17.0.2",
96
- "vanilla-framework": "2.33.0"
99
+ "vanilla-framework": "2.37.1"
97
100
  },
98
101
  "scripts": {
99
102
  "build": "rm -rf dist && yarn build-local; yarn build-declaration",
@@ -102,7 +105,7 @@
102
105
  "build-watch": "yarn run build-local --watch",
103
106
  "build-docs": "build-storybook -c .storybook -o docs",
104
107
  "clean": "rm -rf node_modules dist .out",
105
- "docs": "start-storybook --port ${PORT}",
108
+ "docs": "start-storybook --port ${PORT:-9009}",
106
109
  "link-packages": "yarn install && yarn build && yarn link && cd node_modules/react && yarn link && cd ../react-dom && yarn link",
107
110
  "lint-js": "eslint src",
108
111
  "lint-style": "stylelint src",
@@ -115,7 +118,7 @@
115
118
  "test": "jest",
116
119
  "test-cypress": "concurrently 'yarn run docs' 'yarn run cypress:test' -k -s first",
117
120
  "unlink-packages": "yarn unlink && cd node_modules/react && yarn unlink && cd ../react-dom && yarn unlink",
118
- "cypress:test": "wait-on http://localhost:${PORT} && cypress run --env port=${PORT}",
121
+ "cypress:test": "wait-on http://localhost:${PORT:-9009} && cypress run --env port=${PORT:-9009}",
119
122
  "cypress:run": "cypress run",
120
123
  "cypress:open": "cypress open"
121
124
  },