@canonical/react-components 0.40.1 → 0.42.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/dist/__mocks__/nanoid.js +0 -2
- package/dist/components/Accordion/Accordion.js +13 -37
- package/dist/components/Accordion/AccordionSection/AccordionSection.js +8 -14
- package/dist/components/Accordion/AccordionSection/index.js +0 -2
- package/dist/components/Accordion/index.js +0 -2
- package/dist/components/ActionButton/ActionButton.js +36 -68
- package/dist/components/ActionButton/index.js +0 -2
- package/dist/components/ArticlePagination/ArticlePagination.js +5 -15
- package/dist/components/ArticlePagination/index.js +0 -2
- package/dist/components/Badge/Badge.js +10 -28
- package/dist/components/Badge/index.js +0 -2
- package/dist/components/Button/Button.js +12 -25
- package/dist/components/Button/index.js +0 -4
- package/dist/components/Card/Card.js +6 -17
- package/dist/components/Card/index.js +0 -2
- package/dist/components/CheckboxInput/CheckableInput/CheckableInput.js +6 -20
- package/dist/components/CheckboxInput/CheckableInput/index.js +0 -2
- package/dist/components/CheckboxInput/CheckboxInput.js +3 -13
- package/dist/components/CheckboxInput/index.js +0 -2
- package/dist/components/Chip/Chip.js +18 -35
- package/dist/components/Chip/index.js +0 -2
- package/dist/components/Code/Code.js +5 -23
- package/dist/components/Code/index.js +0 -2
- package/dist/components/CodeSnippet/CodeSnippet.js +2 -12
- package/dist/components/CodeSnippet/CodeSnippetBlock.js +10 -18
- package/dist/components/CodeSnippet/CodeSnippetDropdown.js +5 -14
- package/dist/components/CodeSnippet/index.js +0 -3
- package/dist/components/Col/Col.js +15 -25
- package/dist/components/Col/index.js +0 -4
- package/dist/components/ContextualMenu/ContextualMenu.js +70 -105
- package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.js +51 -88
- package/dist/components/ContextualMenu/ContextualMenuDropdown/index.js +0 -2
- package/dist/components/ContextualMenu/index.js +0 -2
- package/dist/components/Field/Field.js +35 -51
- package/dist/components/Field/index.js +0 -2
- package/dist/components/Form/Form.js +4 -14
- package/dist/components/Form/index.js +0 -2
- package/dist/components/Icon/Icon.js +3 -14
- package/dist/components/Icon/index.js +0 -4
- package/dist/components/Input/Input.js +21 -39
- package/dist/components/Input/index.js +0 -2
- package/dist/components/Label/Label.js +7 -13
- package/dist/components/Label/index.js +0 -2
- package/dist/components/Link/Link.js +10 -22
- package/dist/components/Link/index.js +0 -2
- package/dist/components/List/List.js +18 -31
- package/dist/components/List/index.js +0 -2
- package/dist/components/Loader/Loader.js +0 -7
- package/dist/components/Loader/index.js +0 -2
- package/dist/components/MainTable/MainTable.js +60 -112
- package/dist/components/MainTable/index.js +0 -2
- package/dist/components/Modal/Modal.js +7 -34
- package/dist/components/Modal/index.js +0 -2
- package/dist/components/ModularTable/ModularTable.d.ts +9 -1
- package/dist/components/ModularTable/ModularTable.js +74 -63
- package/dist/components/ModularTable/index.js +0 -2
- package/dist/components/Navigation/Navigation.js +46 -82
- package/dist/components/Navigation/NavigationLink/NavigationLink.js +15 -30
- package/dist/components/Navigation/NavigationLink/index.js +0 -2
- package/dist/components/Navigation/NavigationMenu/NavigationMenu.js +12 -35
- package/dist/components/Navigation/NavigationMenu/index.js +0 -2
- package/dist/components/Navigation/index.js +0 -2
- package/dist/components/Notification/Notification.d.ts +6 -1
- package/dist/components/Notification/Notification.js +31 -46
- package/dist/components/Notification/index.js +0 -4
- package/dist/components/Pagination/Pagination.js +14 -44
- package/dist/components/Pagination/PaginationButton/PaginationButton.js +7 -14
- package/dist/components/Pagination/PaginationButton/index.js +0 -2
- package/dist/components/Pagination/PaginationItem/PaginationItem.js +3 -8
- package/dist/components/Pagination/PaginationItem/index.js +0 -2
- package/dist/components/Pagination/index.js +0 -2
- package/dist/components/PasswordToggle/PasswordToggle.js +21 -50
- package/dist/components/PasswordToggle/index.js +0 -2
- package/dist/components/RadioInput/RadioInput.js +1 -11
- package/dist/components/RadioInput/index.js +0 -2
- package/dist/components/Row/Row.js +2 -12
- package/dist/components/Row/index.js +0 -2
- package/dist/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.js +27 -49
- package/dist/components/SearchAndFilter/FilterPanelSection/index.js +0 -2
- package/dist/components/SearchAndFilter/SearchAndFilter.d.ts +9 -1
- package/dist/components/SearchAndFilter/SearchAndFilter.js +84 -105
- package/dist/components/SearchAndFilter/index.js +0 -2
- package/dist/components/SearchAndFilter/utils.js +1 -7
- package/dist/components/SearchBox/SearchBox.js +18 -38
- package/dist/components/SearchBox/index.js +0 -2
- package/dist/components/Select/Select.js +20 -33
- package/dist/components/Select/index.js +0 -2
- package/dist/components/Slider/Slider.js +16 -32
- package/dist/components/Slider/index.js +0 -2
- package/dist/components/Spinner/Spinner.js +8 -19
- package/dist/components/Spinner/index.js +0 -2
- package/dist/components/StatusLabel/StatusLabel.js +4 -15
- package/dist/components/StatusLabel/index.js +0 -4
- package/dist/components/Strip/Strip.js +25 -36
- package/dist/components/Strip/index.js +0 -2
- package/dist/components/SummaryButton/SummaryButton.js +4 -10
- package/dist/components/SummaryButton/index.js +0 -2
- package/dist/components/Switch/Switch.js +3 -12
- package/dist/components/Switch/index.js +0 -2
- package/dist/components/Table/Table.js +6 -16
- package/dist/components/Table/index.js +0 -2
- package/dist/components/TableCell/TableCell.js +10 -20
- package/dist/components/TableCell/index.js +0 -2
- package/dist/components/TableHeader/TableHeader.js +2 -11
- package/dist/components/TableHeader/index.js +0 -2
- package/dist/components/TableRow/TableRow.js +1 -10
- package/dist/components/TableRow/index.js +0 -2
- package/dist/components/Tabs/Tabs.js +7 -17
- package/dist/components/Tabs/index.js +0 -2
- package/dist/components/Textarea/Textarea.js +23 -36
- package/dist/components/Textarea/index.js +0 -2
- package/dist/components/Tooltip/Tooltip.js +42 -87
- package/dist/components/Tooltip/index.js +0 -4
- package/dist/enums.js +4 -6
- package/dist/hooks/index.js +0 -8
- package/dist/hooks/useClickOutside.js +2 -7
- package/dist/hooks/useId.js +0 -4
- package/dist/hooks/useListener.js +0 -8
- package/dist/hooks/useOnEscapePressed.js +0 -3
- package/dist/hooks/usePagination.js +13 -25
- package/dist/hooks/usePrevious.js +0 -3
- package/dist/hooks/useThrottle.js +1 -15
- package/dist/hooks/useWindowFitment.d.ts +12 -0
- package/dist/hooks/useWindowFitment.js +22 -17
- package/dist/index.js +0 -52
- package/dist/utils.js +3 -10
- package/package.json +36 -35
package/dist/__mocks__/nanoid.js
CHANGED
|
@@ -1,50 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _AccordionSection = _interopRequireDefault(require("./AccordionSection"));
|
|
15
|
-
|
|
16
11
|
var _excluded = ["key"],
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
_excluded2 = ["className", "expanded", "externallyControlled", "onExpandedChange", "sections", "titleElement"];
|
|
19
13
|
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); }
|
|
20
|
-
|
|
21
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
|
|
22
|
-
|
|
23
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
-
|
|
25
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
-
|
|
27
17
|
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."); }
|
|
28
|
-
|
|
29
18
|
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); }
|
|
30
|
-
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
|
|
34
|
-
|
|
19
|
+
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; }
|
|
20
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
35
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
36
|
-
|
|
37
22
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
38
|
-
|
|
39
23
|
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; }
|
|
40
|
-
|
|
41
24
|
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; }
|
|
42
|
-
|
|
43
25
|
var generateSections = function generateSections(sections, setExpanded, expanded, titleElement) {
|
|
44
26
|
return sections.map(function (_ref, i) {
|
|
45
27
|
var key = _ref.key,
|
|
46
|
-
|
|
47
|
-
|
|
28
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
29
|
return /*#__PURE__*/_react.default.createElement(_AccordionSection.default, _extends({
|
|
49
30
|
expanded: expanded,
|
|
50
31
|
key: key || i,
|
|
@@ -54,26 +35,22 @@ var generateSections = function generateSections(sections, setExpanded, expanded
|
|
|
54
35
|
}, props));
|
|
55
36
|
});
|
|
56
37
|
};
|
|
57
|
-
|
|
58
38
|
var Accordion = function Accordion(_ref2) {
|
|
59
39
|
var className = _ref2.className,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
40
|
+
expanded = _ref2.expanded,
|
|
41
|
+
externallyControlled = _ref2.externallyControlled,
|
|
42
|
+
onExpandedChange = _ref2.onExpandedChange,
|
|
43
|
+
sections = _ref2.sections,
|
|
44
|
+
titleElement = _ref2.titleElement,
|
|
45
|
+
asideProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
67
46
|
var _useState = (0, _react.useState)(expanded),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
47
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
+
expandedSection = _useState2[0],
|
|
49
|
+
setExpandedSection = _useState2[1];
|
|
72
50
|
var setExpanded = function setExpanded(id, title) {
|
|
73
51
|
setExpandedSection(id);
|
|
74
52
|
onExpandedChange && onExpandedChange(id, title);
|
|
75
53
|
};
|
|
76
|
-
|
|
77
54
|
return /*#__PURE__*/_react.default.createElement("aside", _extends({
|
|
78
55
|
className: (0, _classnames.default)(className, "p-accordion")
|
|
79
56
|
}, asideProps, {
|
|
@@ -83,6 +60,5 @@ var Accordion = function Accordion(_ref2) {
|
|
|
83
60
|
className: "p-accordion__list"
|
|
84
61
|
}, generateSections(sections, setExpanded, externallyControlled ? expanded : expandedSection, titleElement)));
|
|
85
62
|
};
|
|
86
|
-
|
|
87
63
|
var _default = Accordion;
|
|
88
64
|
exports.default = _default;
|
|
@@ -4,23 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _useId = require("../../../hooks/useId");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
var AccordionSection = function AccordionSection(_ref) {
|
|
15
11
|
var content = _ref.content,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
expanded = _ref.expanded,
|
|
13
|
+
onTitleClick = _ref.onTitleClick,
|
|
14
|
+
sectionKey = _ref.sectionKey,
|
|
15
|
+
setExpanded = _ref.setExpanded,
|
|
16
|
+
title = _ref.title,
|
|
17
|
+
titleElement = _ref.titleElement,
|
|
18
|
+
_ref$headingLevel = _ref.headingLevel,
|
|
19
|
+
headingLevel = _ref$headingLevel === void 0 ? 3 : _ref$headingLevel;
|
|
24
20
|
var sectionId = (0, _useId.useId)();
|
|
25
21
|
var tabId = (0, _useId.useId)();
|
|
26
22
|
var key = sectionKey || sectionId;
|
|
@@ -43,7 +39,6 @@ var AccordionSection = function AccordionSection(_ref) {
|
|
|
43
39
|
} else {
|
|
44
40
|
setExpanded(key, title);
|
|
45
41
|
}
|
|
46
|
-
|
|
47
42
|
onTitleClick && onTitleClick(!isExpanded, key);
|
|
48
43
|
},
|
|
49
44
|
role: "tab",
|
|
@@ -56,6 +51,5 @@ var AccordionSection = function AccordionSection(_ref) {
|
|
|
56
51
|
role: "tabpanel"
|
|
57
52
|
}, content));
|
|
58
53
|
};
|
|
59
|
-
|
|
60
54
|
var _default = AccordionSection;
|
|
61
55
|
exports.default = _default;
|
|
@@ -9,7 +9,5 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
return _AccordionSection.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
var _AccordionSection = _interopRequireDefault(require("./AccordionSection"));
|
|
14
|
-
|
|
15
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,125 +1,94 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = exports.SUCCESS_DURATION = exports.Label = exports.LOADER_MIN_DURATION = void 0;
|
|
9
|
-
|
|
10
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
15
|
-
|
|
16
11
|
var _excluded = ["appearance", "children", "className", "disabled", "inline", "loading", "success"];
|
|
17
|
-
|
|
18
12
|
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); }
|
|
19
|
-
|
|
20
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
15
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
25
|
-
|
|
26
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
-
|
|
28
17
|
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."); }
|
|
29
|
-
|
|
30
18
|
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); }
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
|
|
35
|
-
|
|
19
|
+
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; }
|
|
20
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
36
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
-
|
|
38
22
|
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; }
|
|
39
|
-
|
|
40
23
|
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; }
|
|
41
|
-
|
|
42
24
|
var LOADER_MIN_DURATION = 400; // minimium duration (ms) loader displays
|
|
43
|
-
|
|
44
25
|
exports.LOADER_MIN_DURATION = LOADER_MIN_DURATION;
|
|
45
26
|
var SUCCESS_DURATION = 2000; // duration (ms) success tick is displayed
|
|
46
|
-
|
|
47
27
|
exports.SUCCESS_DURATION = SUCCESS_DURATION;
|
|
48
|
-
var Label
|
|
49
|
-
exports.Label = Label;
|
|
50
|
-
|
|
51
|
-
(function (Label) {
|
|
28
|
+
var Label = /*#__PURE__*/function (Label) {
|
|
52
29
|
Label["WAITING"] = "Waiting for action to complete";
|
|
53
30
|
Label["SUCCESS"] = "Action completed";
|
|
54
|
-
|
|
55
|
-
|
|
31
|
+
return Label;
|
|
32
|
+
}({});
|
|
33
|
+
exports.Label = Label;
|
|
56
34
|
var ActionButton = function ActionButton(_ref) {
|
|
57
35
|
var appearance = _ref.appearance,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
36
|
+
children = _ref.children,
|
|
37
|
+
className = _ref.className,
|
|
38
|
+
_ref$disabled = _ref.disabled,
|
|
39
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
40
|
+
_ref$inline = _ref.inline,
|
|
41
|
+
inline = _ref$inline === void 0 ? false : _ref$inline,
|
|
42
|
+
_ref$loading = _ref.loading,
|
|
43
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
44
|
+
_ref$success = _ref.success,
|
|
45
|
+
success = _ref$success === void 0 ? false : _ref$success,
|
|
46
|
+
buttonProps = _objectWithoutProperties(_ref, _excluded);
|
|
70
47
|
var _useState = (0, _react.useState)(),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
48
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
+
height = _useState2[0],
|
|
50
|
+
setHeight = _useState2[1];
|
|
75
51
|
var _useState3 = (0, _react.useState)(),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
52
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
|
+
width = _useState4[0],
|
|
54
|
+
setWidth = _useState4[1];
|
|
80
55
|
var _useState5 = (0, _react.useState)(false),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
56
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
57
|
+
showLoader = _useState6[0],
|
|
58
|
+
setShowLoader = _useState6[1];
|
|
85
59
|
var _useState7 = (0, _react.useState)(false),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var ref = (0, _react.useRef)(null); // Set up loader timer
|
|
60
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
61
|
+
showSuccess = _useState8[0],
|
|
62
|
+
setShowSuccess = _useState8[1];
|
|
63
|
+
var ref = (0, _react.useRef)(null);
|
|
91
64
|
|
|
65
|
+
// Set up loader timer
|
|
92
66
|
(0, _react.useEffect)(function () {
|
|
93
67
|
var loaderTimeout;
|
|
94
|
-
|
|
95
68
|
if (loading) {
|
|
96
69
|
// Explicitly set button dimensions
|
|
97
70
|
if (ref.current && !!ref.current.getBoundingClientRect()) {
|
|
98
71
|
setHeight(ref.current.getBoundingClientRect().height);
|
|
99
72
|
setWidth(ref.current.getBoundingClientRect().width);
|
|
100
73
|
}
|
|
101
|
-
|
|
102
74
|
setShowLoader(true);
|
|
103
75
|
}
|
|
104
|
-
|
|
105
76
|
if (!loading && showLoader) {
|
|
106
77
|
loaderTimeout = window.setTimeout(function () {
|
|
107
78
|
setShowLoader(false);
|
|
108
|
-
|
|
109
79
|
if (success) {
|
|
110
80
|
setShowSuccess(true);
|
|
111
81
|
}
|
|
112
82
|
}, LOADER_MIN_DURATION);
|
|
113
83
|
}
|
|
114
|
-
|
|
115
84
|
return function () {
|
|
116
85
|
return window.clearTimeout(loaderTimeout);
|
|
117
86
|
};
|
|
118
|
-
}, [loading, showLoader, success]);
|
|
87
|
+
}, [loading, showLoader, success]);
|
|
119
88
|
|
|
89
|
+
// Set up success timer
|
|
120
90
|
(0, _react.useEffect)(function () {
|
|
121
91
|
var successTimeout;
|
|
122
|
-
|
|
123
92
|
if (showSuccess) {
|
|
124
93
|
successTimeout = window.setTimeout(function () {
|
|
125
94
|
setHeight(null);
|
|
@@ -127,7 +96,6 @@ var ActionButton = function ActionButton(_ref) {
|
|
|
127
96
|
setShowSuccess(false);
|
|
128
97
|
}, SUCCESS_DURATION);
|
|
129
98
|
}
|
|
130
|
-
|
|
131
99
|
return function () {
|
|
132
100
|
return window.clearTimeout(successTimeout);
|
|
133
101
|
};
|
|
@@ -139,11 +107,12 @@ var ActionButton = function ActionButton(_ref) {
|
|
|
139
107
|
});
|
|
140
108
|
var showIcon = showLoader || showSuccess;
|
|
141
109
|
var icon = showLoader && "spinner" || showSuccess && "success" || null;
|
|
142
|
-
var iconLight = appearance === "positive" || appearance === "negative";
|
|
110
|
+
var iconLight = appearance === "positive" || appearance === "negative";
|
|
111
|
+
|
|
112
|
+
// This component uses the base button element instead of the Button component
|
|
143
113
|
// as the button requires a ref and Button would have to be updated to use
|
|
144
114
|
// forwardRef which is not currently supported by components that use
|
|
145
115
|
// typescript generics.
|
|
146
|
-
|
|
147
116
|
return /*#__PURE__*/_react.default.createElement("button", _extends({
|
|
148
117
|
className: buttonClasses,
|
|
149
118
|
disabled: disabled,
|
|
@@ -159,6 +128,5 @@ var ActionButton = function ActionButton(_ref) {
|
|
|
159
128
|
name: icon
|
|
160
129
|
}) : children);
|
|
161
130
|
};
|
|
162
|
-
|
|
163
131
|
var _default = ActionButton;
|
|
164
132
|
exports.default = _default;
|
|
@@ -9,7 +9,5 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
return _ActionButton.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
var _ActionButton = _interopRequireDefault(require("./ActionButton"));
|
|
14
|
-
|
|
15
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -4,29 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _excluded = ["className", "nextURL", "nextLabel", "previousURL", "previousLabel"];
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
12
|
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
13
|
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
14
|
var ArticlePagination = function ArticlePagination(_ref) {
|
|
23
15
|
var className = _ref.className,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
nextURL = _ref.nextURL,
|
|
17
|
+
nextLabel = _ref.nextLabel,
|
|
18
|
+
previousURL = _ref.previousURL,
|
|
19
|
+
previousLabel = _ref.previousLabel,
|
|
20
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
21
|
return /*#__PURE__*/_react.default.createElement("footer", _extends({
|
|
31
22
|
className: (0, _classnames.default)(className, "p-article-pagination")
|
|
32
23
|
}, props), previousURL && previousLabel && /*#__PURE__*/_react.default.createElement("a", {
|
|
@@ -45,6 +36,5 @@ var ArticlePagination = function ArticlePagination(_ref) {
|
|
|
45
36
|
className: "p-article-pagination__title"
|
|
46
37
|
}, nextLabel)));
|
|
47
38
|
};
|
|
48
|
-
|
|
49
39
|
var _default = ArticlePagination;
|
|
50
40
|
exports.default = _default;
|
|
@@ -9,7 +9,5 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
return _ArticlePagination.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
var _ArticlePagination = _interopRequireDefault(require("./ArticlePagination"));
|
|
14
|
-
|
|
15
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,85 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = exports.BadgeType = void 0;
|
|
7
|
-
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
|
|
10
9
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
10
|
var _excluded = ["value", "badgeType", "className", "isNegative"];
|
|
13
|
-
|
|
14
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
12
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
|
|
19
|
-
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
16
|
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; }
|
|
21
|
-
|
|
22
17
|
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; }
|
|
23
|
-
|
|
24
18
|
var BadgeType = {
|
|
25
19
|
ROUNDED_LARGE_NUMBER: "ROUNDED_LARGE_NUMBER",
|
|
26
20
|
UNDEFINED_LARGE_NUMBER: "UNDEFINED_LARGE_NUMBER"
|
|
27
21
|
};
|
|
22
|
+
|
|
28
23
|
/**
|
|
29
24
|
* The props for the Badge component.
|
|
30
25
|
*/
|
|
31
|
-
|
|
32
26
|
exports.BadgeType = BadgeType;
|
|
33
27
|
var MAX_VAL = 999;
|
|
34
28
|
var units = ["", "k", "M", "B", "T"];
|
|
35
|
-
|
|
36
29
|
var round = function round(value) {
|
|
37
30
|
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
38
|
-
|
|
39
31
|
if (value < 1000) {
|
|
40
32
|
var truncatedValue = Number(value.toString().slice(0, 3));
|
|
41
33
|
return "".concat(truncatedValue).concat(units[unit]);
|
|
42
34
|
}
|
|
43
|
-
|
|
44
35
|
if (unit >= units.length - 1) {
|
|
45
36
|
return "999T";
|
|
46
37
|
}
|
|
47
|
-
|
|
48
38
|
var newValue = value / 1000;
|
|
49
39
|
return round(newValue, unit + 1);
|
|
50
40
|
};
|
|
51
|
-
|
|
52
41
|
var clamp = function clamp(value) {
|
|
53
42
|
if (value > MAX_VAL) {
|
|
54
43
|
return "".concat(MAX_VAL, "+");
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
return value;
|
|
58
46
|
};
|
|
59
|
-
|
|
60
47
|
var Badge = function Badge(_ref) {
|
|
61
48
|
var _classNames;
|
|
62
|
-
|
|
63
49
|
var value = _ref.value,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
50
|
+
_ref$badgeType = _ref.badgeType,
|
|
51
|
+
badgeType = _ref$badgeType === void 0 ? BadgeType.UNDEFINED_LARGE_NUMBER : _ref$badgeType,
|
|
52
|
+
className = _ref.className,
|
|
53
|
+
isNegative = _ref.isNegative,
|
|
54
|
+
spanProps = _objectWithoutProperties(_ref, _excluded);
|
|
70
55
|
var badgeClassName = (0, _classnames.default)((_classNames = {}, _defineProperty(_classNames, "p-badge--negative", !!isNegative), _defineProperty(_classNames, "p-badge", !isNegative), _classNames), className);
|
|
71
56
|
var safeValue = Math.round(value);
|
|
72
|
-
|
|
73
57
|
if (value < 0) {
|
|
74
58
|
console.error("The value used in the badge should be positive");
|
|
75
59
|
safeValue = 0;
|
|
76
60
|
}
|
|
77
|
-
|
|
78
61
|
var formattedValue = badgeType === BadgeType.ROUNDED_LARGE_NUMBER ? round(safeValue) : clamp(safeValue);
|
|
79
62
|
return /*#__PURE__*/_react.default.createElement("span", _extends({}, spanProps, {
|
|
80
63
|
className: badgeClassName
|
|
81
64
|
}), formattedValue);
|
|
82
65
|
};
|
|
83
|
-
|
|
84
66
|
var _default = Badge;
|
|
85
67
|
exports.default = _default;
|
|
@@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.ButtonAppearance = void 0;
|
|
7
|
-
|
|
8
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _excluded = ["appearance", "children", "className", "dense", "disabled", "element", "hasIcon", "inline", "onClick", "small"];
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
12
|
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
13
|
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
14
|
var ButtonAppearance = {
|
|
23
15
|
BASE: "base",
|
|
24
16
|
BRAND: "brand",
|
|
@@ -27,31 +19,29 @@ var ButtonAppearance = {
|
|
|
27
19
|
NEGATIVE: "negative",
|
|
28
20
|
POSITIVE: "positive"
|
|
29
21
|
};
|
|
22
|
+
|
|
30
23
|
/**
|
|
31
24
|
* The type of the Button props.
|
|
32
25
|
* @template P - The type of the props if providing a component to `element`
|
|
33
26
|
*/
|
|
34
|
-
|
|
35
27
|
exports.ButtonAppearance = ButtonAppearance;
|
|
36
|
-
|
|
37
28
|
/**
|
|
38
29
|
* A component for the Vanilla button.
|
|
39
30
|
* @template P - The type of the props if providing a component to `element`
|
|
40
31
|
*/
|
|
41
32
|
var Button = function Button(_ref) {
|
|
42
33
|
var appearance = _ref.appearance,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
34
|
+
children = _ref.children,
|
|
35
|
+
className = _ref.className,
|
|
36
|
+
dense = _ref.dense,
|
|
37
|
+
disabled = _ref.disabled,
|
|
38
|
+
_ref$element = _ref.element,
|
|
39
|
+
Component = _ref$element === void 0 ? "button" : _ref$element,
|
|
40
|
+
hasIcon = _ref.hasIcon,
|
|
41
|
+
inline = _ref.inline,
|
|
42
|
+
onClick = _ref.onClick,
|
|
43
|
+
small = _ref.small,
|
|
44
|
+
buttonProps = _objectWithoutProperties(_ref, _excluded);
|
|
55
45
|
var classes = (0, _classnames.default)(appearance ? "p-button--".concat(appearance) : "p-button", {
|
|
56
46
|
"has-icon": hasIcon,
|
|
57
47
|
"is-dense": dense,
|
|
@@ -59,11 +49,9 @@ var Button = function Button(_ref) {
|
|
|
59
49
|
"is-inline": inline,
|
|
60
50
|
"is-small": small
|
|
61
51
|
}, className);
|
|
62
|
-
|
|
63
52
|
var onClickDisabled = function onClickDisabled(e) {
|
|
64
53
|
return e.preventDefault();
|
|
65
54
|
};
|
|
66
|
-
|
|
67
55
|
var disabledProp = Component === "button" ? {
|
|
68
56
|
disabled: disabled
|
|
69
57
|
} : {
|
|
@@ -74,6 +62,5 @@ var Button = function Button(_ref) {
|
|
|
74
62
|
onClick: disabled ? onClickDisabled : onClick
|
|
75
63
|
}, disabledProp, buttonProps), children);
|
|
76
64
|
};
|
|
77
|
-
|
|
78
65
|
var _default = Button;
|
|
79
66
|
exports.default = _default;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -17,9 +16,6 @@ Object.defineProperty(exports, "default", {
|
|
|
17
16
|
return _Button.default;
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
|
-
|
|
21
19
|
var _Button = _interopRequireWildcard(require("./Button"));
|
|
22
|
-
|
|
23
20
|
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); }
|
|
24
|
-
|
|
25
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
|