@canonical/react-components 0.21.0 → 0.30.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 +4 -4
- package/dist/components/AccordionSection/AccordionSection.js +0 -13
- package/dist/components/ActionButton/ActionButton.js +2 -5
- package/dist/components/Button/Button.d.ts +1 -2
- package/dist/components/Button/Button.js +2 -16
- package/dist/components/Chip/Chip.d.ts +1 -1
- package/dist/components/Chip/Chip.js +26 -29
- package/dist/components/CodeSnippet/CodeSnippetBlock.js +1 -12
- package/dist/components/CodeSnippet/CodeSnippetDropdown.js +1 -8
- package/dist/components/ContextualMenu/ContextualMenu.js +1 -1
- package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.js +0 -16
- package/dist/components/Field/Field.js +0 -16
- package/dist/components/Icon/Icon.d.ts +8 -0
- package/dist/components/Icon/Icon.js +9 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.js +30 -9
- package/dist/components/Link/Link.d.ts +1 -5
- package/dist/components/Link/Link.js +1 -4
- package/dist/components/List/List.js +1 -15
- package/dist/components/Modal/Modal.js +66 -17
- package/dist/components/Notification/Notification.js +5 -5
- package/dist/components/PaginationButton/PaginationButton.js +1 -8
- package/dist/components/PaginationItem/PaginationItem.js +0 -7
- package/dist/components/PasswordToggle/PasswordToggle.d.ts +99 -0
- package/dist/components/PasswordToggle/PasswordToggle.js +107 -0
- package/dist/components/PasswordToggle/index.d.ts +2 -0
- package/dist/components/PasswordToggle/index.js +15 -0
- package/dist/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.js +3 -4
- package/dist/components/SearchBox/SearchBox.d.ts +9 -8
- package/dist/components/SearchBox/SearchBox.js +22 -22
- package/dist/components/SummaryButton/SummaryButton.js +0 -11
- package/dist/components/Tabs/Tabs.js +1 -7
- package/dist/components/Tooltip/Tooltip.js +1 -12
- package/dist/hooks/useListener.js +1 -7
- package/dist/hooks/usePrevious.js +1 -7
- package/dist/hooks/useThrottle.js +1 -7
- package/dist/hooks/useWindowFitment.js +1 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -0
- package/package.json +62 -56
|
@@ -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-
|
|
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-
|
|
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-
|
|
96
|
+
"data-testid": "notification-meta"
|
|
97
97
|
}, timestamp && /*#__PURE__*/_react.default.createElement("span", {
|
|
98
98
|
className: "p-notification__timestamp",
|
|
99
|
-
"data-
|
|
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-
|
|
106
|
+
"data-testid": "notification-action",
|
|
107
107
|
key: "".concat(action.label, "-").concat(i),
|
|
108
108
|
onClick: action.onClick
|
|
109
109
|
}, action.label);
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
9
|
|
|
12
10
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -29,14 +27,9 @@ var PaginationButton = function PaginationButton(_ref) {
|
|
|
29
27
|
disabled: disabled,
|
|
30
28
|
onClick: onClick
|
|
31
29
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
32
|
-
className: "p-icon--
|
|
30
|
+
className: "p-icon--chevron-down"
|
|
33
31
|
}, label)));
|
|
34
32
|
};
|
|
35
33
|
|
|
36
|
-
PaginationButton.propTypes = {
|
|
37
|
-
direction: _propTypes.default.oneOf(["forward", "back"]).isRequired,
|
|
38
|
-
disabled: _propTypes.default.bool,
|
|
39
|
-
onClick: _propTypes.default.func.isRequired
|
|
40
|
-
};
|
|
41
34
|
var _default = PaginationButton;
|
|
42
35
|
exports.default = _default;
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
9
|
|
|
12
10
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -28,10 +26,5 @@ var PaginationItem = function PaginationItem(_ref) {
|
|
|
28
26
|
}, number));
|
|
29
27
|
};
|
|
30
28
|
|
|
31
|
-
PaginationItem.propTypes = {
|
|
32
|
-
isActive: _propTypes.default.bool,
|
|
33
|
-
number: _propTypes.default.number.isRequired,
|
|
34
|
-
onClick: _propTypes.default.func.isRequired
|
|
35
|
-
};
|
|
36
29
|
var _default = PaginationItem;
|
|
37
30
|
exports.default = _default;
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
* The content for success validation.
|
|
46
|
+
*/
|
|
47
|
+
type?: "submit" | "reset" | "button";
|
|
48
|
+
/**
|
|
49
|
+
* Optional class(es) to pass to the wrapping Field component
|
|
50
|
+
*/
|
|
51
|
+
wrapperClassName?: string;
|
|
52
|
+
}, InputHTMLAttributes<HTMLInputElement>>;
|
|
53
|
+
declare const PasswordToggle: React.ForwardRefExoticComponent<{
|
|
54
|
+
/**
|
|
55
|
+
* The content for caution validation.
|
|
56
|
+
*/
|
|
57
|
+
caution?: ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* Optional class(es) to pass to the input element.
|
|
60
|
+
*/
|
|
61
|
+
className?: ClassName;
|
|
62
|
+
/**
|
|
63
|
+
* The content for error validation.
|
|
64
|
+
*/
|
|
65
|
+
error?: ReactNode;
|
|
66
|
+
/**
|
|
67
|
+
* Help text to show below the field.
|
|
68
|
+
*/
|
|
69
|
+
help?: ReactNode;
|
|
70
|
+
/**
|
|
71
|
+
* The id of the input.
|
|
72
|
+
*/
|
|
73
|
+
id: string;
|
|
74
|
+
/**
|
|
75
|
+
* The label for the field.
|
|
76
|
+
*/
|
|
77
|
+
label?: ReactNode;
|
|
78
|
+
/**
|
|
79
|
+
* Whether the field is read only.
|
|
80
|
+
*/
|
|
81
|
+
readOnly?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Whether the field is required.
|
|
84
|
+
*/
|
|
85
|
+
required?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* The content for success validation.
|
|
88
|
+
*/
|
|
89
|
+
success?: ReactNode;
|
|
90
|
+
/**
|
|
91
|
+
* The content for success validation.
|
|
92
|
+
*/
|
|
93
|
+
type?: "submit" | "reset" | "button";
|
|
94
|
+
/**
|
|
95
|
+
* Optional class(es) to pass to the wrapping Field component
|
|
96
|
+
*/
|
|
97
|
+
wrapperClassName?: string;
|
|
98
|
+
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, "label" | "className" | "error" | "id" | "type" | "readOnly" | "required" | "help" | "success" | "caution" | "wrapperClassName"> & React.RefAttributes<HTMLInputElement>>;
|
|
99
|
+
export default PasswordToggle;
|
|
@@ -0,0 +1,107 @@
|
|
|
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 = /*#__PURE__*/_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
|
+
type = _ref.type,
|
|
55
|
+
wrapperClassName = _ref.wrapperClassName,
|
|
56
|
+
inputProps = _objectWithoutProperties(_ref, ["caution", "className", "error", "help", "id", "label", "readOnly", "required", "success", "type", "wrapperClassName"]);
|
|
57
|
+
|
|
58
|
+
var _useState = (0, _react.useState)(true),
|
|
59
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
60
|
+
isPassword = _useState2[0],
|
|
61
|
+
setIsPassword = _useState2[1];
|
|
62
|
+
|
|
63
|
+
var togglePassword = function togglePassword() {
|
|
64
|
+
if (isPassword) {
|
|
65
|
+
setIsPassword(false);
|
|
66
|
+
} else {
|
|
67
|
+
setIsPassword(true);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(_Field.default, {
|
|
72
|
+
caution: caution,
|
|
73
|
+
className: wrapperClassName,
|
|
74
|
+
error: error,
|
|
75
|
+
help: help,
|
|
76
|
+
required: required,
|
|
77
|
+
success: success
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
79
|
+
className: "p-form-password-toggle"
|
|
80
|
+
}, /*#__PURE__*/_react.default.createElement(_Label.default, {
|
|
81
|
+
forId: id,
|
|
82
|
+
required: required
|
|
83
|
+
}, label), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
84
|
+
appearance: "base",
|
|
85
|
+
type: type ? type : "button",
|
|
86
|
+
className: "u-no-margin--bottom",
|
|
87
|
+
hasIcon: true,
|
|
88
|
+
"aria-controls": id,
|
|
89
|
+
"aria-live": "polite",
|
|
90
|
+
onClick: function onClick() {
|
|
91
|
+
return togglePassword();
|
|
92
|
+
}
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
94
|
+
className: "p-form-password-toggle__label"
|
|
95
|
+
}, isPassword ? "Show" : "Hide"), /*#__PURE__*/_react.default.createElement("i", {
|
|
96
|
+
className: isPassword ? "p-icon--show" : "p-icon--hide"
|
|
97
|
+
}))), /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
98
|
+
className: (0, _classnames.default)("p-form-validation__input", className),
|
|
99
|
+
id: id,
|
|
100
|
+
ref: ref,
|
|
101
|
+
type: isPassword ? "password" : "text",
|
|
102
|
+
readOnly: readOnly
|
|
103
|
+
}, inputProps)));
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
var _default = PasswordToggle;
|
|
107
|
+
exports.default = _default;
|
|
@@ -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 }; }
|
|
@@ -123,9 +123,8 @@ var FilterPanelSection = function FilterPanelSection(_ref) {
|
|
|
123
123
|
// should display
|
|
124
124
|
var searchTermInChip = (0, _utils2.highlightSubString)(chip.value, searchTerm).match;
|
|
125
125
|
var chipVisible = searchTermInChip || searchTerm === "" || (0, _utils2.highlightSubString)(heading, searchTerm).match;
|
|
126
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
127
|
-
key: "".concat(chip.lead, "+").concat(chip.value)
|
|
128
|
-
}, chipVisible && !sectionHidden && /*#__PURE__*/_react.default.createElement(_Chip.default, {
|
|
126
|
+
return chipVisible && !sectionHidden && /*#__PURE__*/_react.default.createElement(_Chip.default, {
|
|
127
|
+
key: "".concat(chip.lead, "+").concat(chip.value),
|
|
129
128
|
lead: chip.lead,
|
|
130
129
|
value: chip.value,
|
|
131
130
|
selected: (0, _utils.isChipInArray)(chip, searchData),
|
|
@@ -133,7 +132,7 @@ var FilterPanelSection = function FilterPanelSection(_ref) {
|
|
|
133
132
|
onClick: function onClick() {
|
|
134
133
|
return handleChipClick(chip);
|
|
135
134
|
}
|
|
136
|
-
})
|
|
135
|
+
});
|
|
137
136
|
}), overflowCounter > 0 && !expanded && /*#__PURE__*/_react.default.createElement("span", {
|
|
138
137
|
className: "p-filter-panel-section__counter",
|
|
139
138
|
onClick: showAllChips,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
|
24
|
+
* A function that is called when the user clicks the search icon
|
|
27
25
|
*/
|
|
28
|
-
|
|
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
|
-
}
|
|
38
|
-
declare const SearchBox:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
46
|
-
|
|
47
|
-
onSubmit && onSubmit(e);
|
|
40
|
+
var triggerSearch = function triggerSearch() {
|
|
41
|
+
onSearch && onSearch();
|
|
48
42
|
};
|
|
49
43
|
|
|
50
|
-
return /*#__PURE__*/_react.default.createElement("
|
|
51
|
-
className: (0, _classnames.default)("p-search-box", className)
|
|
52
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -5,16 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
9
|
|
|
12
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
11
|
|
|
14
12
|
var _ActionButton = _interopRequireDefault(require("../ActionButton"));
|
|
15
13
|
|
|
16
|
-
var _Button = require("../Button/Button");
|
|
17
|
-
|
|
18
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
15
|
|
|
20
16
|
var SummaryButton = function SummaryButton(_ref) {
|
|
@@ -28,7 +24,6 @@ var SummaryButton = function SummaryButton(_ref) {
|
|
|
28
24
|
}, summary && /*#__PURE__*/_react.default.createElement("span", {
|
|
29
25
|
className: "u-text--muted"
|
|
30
26
|
}, summary), onClick && /*#__PURE__*/_react.default.createElement(_ActionButton.default, {
|
|
31
|
-
appearance: _Button.ButtonAppearance.NEUTRAL,
|
|
32
27
|
className: (0, _classnames.default)("is-small", "is-dense", {
|
|
33
28
|
"is-inline": summary
|
|
34
29
|
}),
|
|
@@ -38,11 +33,5 @@ var SummaryButton = function SummaryButton(_ref) {
|
|
|
38
33
|
}, label));
|
|
39
34
|
};
|
|
40
35
|
|
|
41
|
-
SummaryButton.propTypes = {
|
|
42
|
-
isLoading: _propTypes.default.bool,
|
|
43
|
-
label: _propTypes.default.string.isRequired,
|
|
44
|
-
onClick: _propTypes.default.func.isRequired,
|
|
45
|
-
summary: _propTypes.default.string
|
|
46
|
-
};
|
|
47
36
|
var _default = SummaryButton;
|
|
48
37
|
exports.default = _default;
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
9
|
|
|
12
10
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -42,14 +40,10 @@ var Tabs = function Tabs(_ref) {
|
|
|
42
40
|
}, /*#__PURE__*/_react.default.createElement(Component, _extends({
|
|
43
41
|
"aria-selected": active,
|
|
44
42
|
className: (0, _classnames.default)("p-tabs__link", className),
|
|
45
|
-
"data-
|
|
43
|
+
"data-testid": "tab-link-".concat(label)
|
|
46
44
|
}, rest), label));
|
|
47
45
|
})));
|
|
48
46
|
};
|
|
49
47
|
|
|
50
|
-
Tabs.propTypes = {
|
|
51
|
-
links: _propTypes.default.array.isRequired,
|
|
52
|
-
listClassName: _propTypes.default.string
|
|
53
|
-
};
|
|
54
48
|
var _default = Tabs;
|
|
55
49
|
exports.default = _default;
|
|
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = exports.adjustForWindow = void 0;
|
|
9
9
|
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
11
|
|
|
14
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -226,7 +224,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
226
224
|
}
|
|
227
225
|
}, children), isOpen && /*#__PURE__*/_react.default.createElement(Portal, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
228
226
|
className: (0, _classnames.default)("p-tooltip--".concat(adjustedPosition), "is-detached", tooltipClassName),
|
|
229
|
-
"data-
|
|
227
|
+
"data-testid": "tooltip-portal",
|
|
230
228
|
style: positionStyle
|
|
231
229
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
232
230
|
className: "p-tooltip__message",
|
|
@@ -236,14 +234,5 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
236
234
|
}, children));
|
|
237
235
|
};
|
|
238
236
|
|
|
239
|
-
Tooltip.propTypes = {
|
|
240
|
-
autoAdjust: _propTypes.default.bool,
|
|
241
|
-
children: _propTypes.default.node.isRequired,
|
|
242
|
-
followMouse: _propTypes.default.bool,
|
|
243
|
-
message: _propTypes.default.node,
|
|
244
|
-
position: _propTypes.default.oneOf(["btm-center", "btm-left", "btm-right", "left", "right", "top-center", "top-left", "top-right"]),
|
|
245
|
-
positionElementClassName: _propTypes.default.string,
|
|
246
|
-
tooltipClassName: _propTypes.default.string
|
|
247
|
-
};
|
|
248
237
|
var _default = Tooltip;
|
|
249
238
|
exports.default = _default;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.useListener = void 0;
|
|
9
7
|
|
|
10
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
11
9
|
|
|
12
10
|
var _useThrottle = require("./useThrottle");
|
|
13
11
|
|
|
14
12
|
var _usePrevious = require("./usePrevious");
|
|
15
13
|
|
|
16
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
14
|
/**
|
|
21
15
|
* A hook that handles attaching/removing listeners and smartly reattaching if
|
|
22
16
|
* any of the attributes change.
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.usePrevious = void 0;
|
|
9
7
|
|
|
10
|
-
var _react =
|
|
11
|
-
|
|
12
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
13
|
-
|
|
14
|
-
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; }
|
|
8
|
+
var _react = require("react");
|
|
15
9
|
|
|
16
10
|
/**
|
|
17
11
|
* A hook to handle storing the previous value of anything.
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.useThrottle = exports.THROTTLE_DELAY = void 0;
|
|
9
7
|
|
|
10
|
-
var _react =
|
|
11
|
-
|
|
12
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
13
|
-
|
|
14
|
-
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; }
|
|
8
|
+
var _react = require("react");
|
|
15
9
|
|
|
16
10
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
17
11
|
|