@canonical/react-components 0.47.1 → 0.47.3
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 +3 -3
- package/dist/components/Accordion/Accordion.js +28 -41
- package/dist/components/Accordion/AccordionSection/AccordionSection.js +18 -18
- package/dist/components/Accordion/AccordionSection/index.js +1 -1
- package/dist/components/Accordion/index.js +1 -1
- package/dist/components/ActionButton/ActionButton.js +34 -66
- package/dist/components/ActionButton/index.js +1 -1
- package/dist/components/ArticlePagination/ArticlePagination.js +10 -12
- package/dist/components/ArticlePagination/index.js +1 -1
- package/dist/components/Badge/Badge.js +24 -29
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Button/Button.js +21 -26
- package/dist/components/Button/index.js +4 -5
- package/dist/components/Card/Card.js +12 -14
- package/dist/components/Card/index.js +1 -1
- package/dist/components/CheckboxInput/CheckableInput/CheckableInput.js +15 -19
- package/dist/components/CheckboxInput/CheckableInput/index.js +1 -1
- package/dist/components/CheckboxInput/CheckboxInput.js +7 -10
- package/dist/components/CheckboxInput/index.js +1 -1
- package/dist/components/Chip/Chip.js +23 -33
- package/dist/components/Chip/index.js +1 -1
- package/dist/components/Code/Code.js +14 -17
- package/dist/components/Code/index.js +1 -1
- package/dist/components/CodeSnippet/CodeSnippet.js +9 -14
- package/dist/components/CodeSnippet/CodeSnippetBlock.js +24 -29
- package/dist/components/CodeSnippet/CodeSnippetDropdown.js +11 -11
- package/dist/components/CodeSnippet/index.js +2 -2
- package/dist/components/Col/Col.js +24 -26
- package/dist/components/Col/index.js +4 -5
- package/dist/components/ConfirmationButton/ConfirmationButton.js +18 -21
- package/dist/components/ConfirmationButton/index.js +1 -1
- package/dist/components/ConfirmationModal/ConfirmationModal.js +11 -15
- package/dist/components/ConfirmationModal/index.js +1 -1
- package/dist/components/ContextualMenu/ContextualMenu.js +89 -107
- package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.d.ts +4 -4
- package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.js +97 -107
- package/dist/components/ContextualMenu/ContextualMenuDropdown/index.js +1 -1
- package/dist/components/ContextualMenu/index.js +1 -1
- package/dist/components/EmptyState/EmptyState.js +9 -11
- package/dist/components/EmptyState/index.js +1 -1
- package/dist/components/Field/Field.js +66 -65
- package/dist/components/Field/index.js +1 -1
- package/dist/components/Form/Form.js +9 -11
- package/dist/components/Form/index.js +1 -1
- package/dist/components/Icon/Icon.js +9 -12
- package/dist/components/Icon/index.js +4 -5
- package/dist/components/Input/Input.js +38 -45
- package/dist/components/Input/index.js +1 -1
- package/dist/components/Label/Label.js +9 -11
- package/dist/components/Label/index.js +1 -1
- package/dist/components/Link/Link.js +12 -18
- package/dist/components/Link/index.js +1 -1
- package/dist/components/List/List.js +50 -54
- package/dist/components/List/index.js +1 -1
- package/dist/components/Loader/Loader.js +2 -3
- package/dist/components/Loader/index.js +1 -1
- package/dist/components/MainTable/MainTable.js +87 -104
- package/dist/components/MainTable/index.js +1 -1
- package/dist/components/Modal/Modal.js +37 -38
- package/dist/components/Modal/index.js +1 -1
- package/dist/components/ModularTable/ModularTable.js +63 -77
- package/dist/components/ModularTable/index.js +1 -1
- package/dist/components/Navigation/Navigation.js +63 -97
- package/dist/components/Navigation/NavigationLink/NavigationLink.js +32 -35
- package/dist/components/Navigation/NavigationLink/index.js +1 -1
- package/dist/components/Navigation/NavigationMenu/NavigationMenu.js +26 -45
- package/dist/components/Navigation/NavigationMenu/index.js +1 -1
- package/dist/components/Navigation/index.js +1 -1
- package/dist/components/Notification/Notification.js +49 -59
- package/dist/components/Notification/index.js +4 -5
- package/dist/components/NotificationProvider/NotificationProvider.js +36 -61
- package/dist/components/NotificationProvider/index.js +7 -7
- package/dist/components/NotificationProvider/messageBuilder.js +9 -9
- package/dist/components/NotificationProvider/types.d.ts +5 -0
- package/dist/components/Pagination/Pagination.js +50 -69
- package/dist/components/Pagination/PaginationButton/PaginationButton.js +11 -12
- package/dist/components/Pagination/PaginationButton/index.js +1 -1
- package/dist/components/Pagination/PaginationItem/PaginationItem.js +7 -7
- package/dist/components/Pagination/PaginationItem/index.js +1 -1
- package/dist/components/Pagination/index.js +1 -1
- package/dist/components/PasswordToggle/PasswordToggle.d.ts +1 -1
- package/dist/components/PasswordToggle/PasswordToggle.js +29 -42
- package/dist/components/PasswordToggle/index.js +1 -1
- package/dist/components/RadioInput/RadioInput.js +6 -8
- package/dist/components/RadioInput/index.js +1 -1
- package/dist/components/Row/Row.js +7 -9
- package/dist/components/Row/index.js +1 -1
- package/dist/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.js +38 -51
- package/dist/components/SearchAndFilter/FilterPanelSection/index.js +1 -1
- package/dist/components/SearchAndFilter/SearchAndFilter.js +75 -135
- package/dist/components/SearchAndFilter/index.js +1 -1
- package/dist/components/SearchAndFilter/utils.js +4 -8
- package/dist/components/SearchBox/SearchBox.js +25 -33
- package/dist/components/SearchBox/index.js +1 -1
- package/dist/components/Select/Select.js +42 -46
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Slider/Slider.js +31 -36
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/Spinner/Spinner.js +10 -15
- package/dist/components/Spinner/index.js +1 -1
- package/dist/components/StatusLabel/StatusLabel.js +11 -13
- package/dist/components/StatusLabel/index.js +4 -5
- package/dist/components/Strip/Strip.js +27 -34
- package/dist/components/Strip/index.js +1 -1
- package/dist/components/SummaryButton/SummaryButton.js +9 -8
- package/dist/components/SummaryButton/index.js +1 -1
- package/dist/components/Switch/Switch.js +7 -10
- package/dist/components/Switch/index.js +1 -1
- package/dist/components/Table/Table.js +9 -13
- package/dist/components/Table/index.js +1 -1
- package/dist/components/TableCell/TableCell.js +11 -17
- package/dist/components/TableCell/index.js +1 -1
- package/dist/components/TableHeader/TableHeader.js +7 -9
- package/dist/components/TableHeader/index.js +1 -1
- package/dist/components/TablePagination/TablePagination.d.ts +37 -0
- package/dist/components/TablePagination/TablePagination.js +125 -0
- package/dist/components/TablePagination/TablePagination.scss +40 -0
- package/dist/components/TablePagination/TablePaginationControls/TablePaginationControls.d.ts +16 -0
- package/dist/components/TablePagination/TablePaginationControls/TablePaginationControls.js +66 -0
- package/dist/components/TablePagination/TablePaginationControls/index.d.ts +2 -0
- package/dist/components/TablePagination/TablePaginationControls/index.js +13 -0
- package/dist/components/TablePagination/index.d.ts +2 -0
- package/dist/components/TablePagination/index.js +13 -0
- package/dist/components/TableRow/TableRow.js +6 -8
- package/dist/components/TableRow/index.js +1 -1
- package/dist/components/Tabs/Tabs.js +17 -17
- package/dist/components/Tabs/index.js +1 -1
- package/dist/components/Textarea/Textarea.js +55 -47
- package/dist/components/Textarea/index.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.js +76 -79
- package/dist/components/Tooltip/index.js +4 -5
- package/dist/enums.js +2 -3
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +16 -10
- package/dist/hooks/useId.js +1 -3
- package/dist/hooks/useListener.d.ts +2 -1
- package/dist/hooks/useListener.js +25 -24
- package/dist/hooks/useOnClickOutside.d.ts +12 -0
- package/dist/hooks/useOnClickOutside.js +45 -0
- package/dist/hooks/useOnEscapePressed.d.ts +3 -1
- package/dist/hooks/useOnEscapePressed.js +13 -6
- package/dist/hooks/usePagination.js +17 -29
- package/dist/hooks/usePrevious.js +4 -4
- package/dist/hooks/useThrottle.js +16 -25
- package/dist/hooks/useWindowFitment.js +30 -28
- package/dist/index.d.ts +3 -1
- package/dist/index.js +86 -74
- package/dist/utils.js +6 -13
- package/package.json +41 -36
- package/dist/hooks/useClickOutside.d.ts +0 -6
- package/dist/hooks/useClickOutside.js +0 -32
|
@@ -7,20 +7,19 @@ exports.default = void 0;
|
|
|
7
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _hooks = require("../../hooks");
|
|
10
|
-
var _excluded = ["children", "className", "highlighted", "overlay", "thumbnail", "title"];
|
|
11
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
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); }
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
const Card = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
highlighted,
|
|
17
|
+
overlay,
|
|
18
|
+
thumbnail,
|
|
19
|
+
title,
|
|
20
|
+
...props
|
|
21
|
+
} = _ref;
|
|
22
|
+
const titleId = (0, _hooks.useId)();
|
|
24
23
|
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
25
24
|
"aria-labelledby": title ? titleId : undefined,
|
|
26
25
|
className: (0, _classnames.default)(className, {
|
|
@@ -42,5 +41,4 @@ var Card = function Card(_ref) {
|
|
|
42
41
|
className: "p-card__content"
|
|
43
42
|
}, children));
|
|
44
43
|
};
|
|
45
|
-
var _default = Card;
|
|
46
|
-
exports.default = _default;
|
|
44
|
+
var _default = exports.default = Card;
|
|
@@ -1,6 +1,5 @@
|
|
|
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,24 +7,22 @@ exports.default = void 0;
|
|
|
8
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _useId = require("../../../hooks/useId");
|
|
11
|
-
|
|
12
|
-
function
|
|
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; }
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
13
|
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); }
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
(0, _react.useEffect)(function () {
|
|
14
|
+
const CheckableInput = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
inputType,
|
|
17
|
+
label,
|
|
18
|
+
labelClassName,
|
|
19
|
+
indeterminate = false,
|
|
20
|
+
inline,
|
|
21
|
+
...checkboxProps
|
|
22
|
+
} = _ref;
|
|
23
|
+
const inputId = (0, _useId.useId)();
|
|
24
|
+
const inputRef = (0, _react.useRef)(null);
|
|
25
|
+
(0, _react.useEffect)(() => {
|
|
29
26
|
inputRef.current.indeterminate = indeterminate;
|
|
30
27
|
}, [indeterminate]);
|
|
31
28
|
return /*#__PURE__*/_react.default.createElement("label", {
|
|
@@ -42,5 +39,4 @@ var CheckableInput = function CheckableInput(_ref) {
|
|
|
42
39
|
id: inputId
|
|
43
40
|
}, label));
|
|
44
41
|
};
|
|
45
|
-
var _default = CheckableInput;
|
|
46
|
-
exports.default = _default;
|
|
42
|
+
var _default = exports.default = CheckableInput;
|
|
@@ -6,21 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _CheckableInput = _interopRequireDefault(require("./CheckableInput"));
|
|
9
|
-
var _excluded = ["label", "indeterminate"];
|
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
10
|
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); }
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
checkboxProps = _objectWithoutProperties(_ref, _excluded);
|
|
11
|
+
const CheckboxInput = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
label,
|
|
14
|
+
indeterminate = false,
|
|
15
|
+
...checkboxProps
|
|
16
|
+
} = _ref;
|
|
19
17
|
return /*#__PURE__*/_react.default.createElement(_CheckableInput.default, _extends({
|
|
20
18
|
label: label,
|
|
21
19
|
inputType: "checkbox",
|
|
22
20
|
indeterminate: indeterminate
|
|
23
21
|
}, checkboxProps));
|
|
24
22
|
};
|
|
25
|
-
var _default = CheckboxInput;
|
|
26
|
-
exports.default = _default;
|
|
23
|
+
var _default = exports.default = CheckboxInput;
|
|
@@ -1,6 +1,5 @@
|
|
|
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,42 +7,33 @@ exports.default = exports.Label = exports.ChipType = void 0;
|
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
8
|
var _utils = require("../../utils");
|
|
10
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _excluded = ["appearance", "lead", "onClick", "onDismiss", "quoteValue", "selected", "subString", "value"];
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
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); }
|
|
14
|
-
|
|
15
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
-
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); }
|
|
17
|
-
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; }
|
|
18
|
-
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; }
|
|
19
|
-
var Label = /*#__PURE__*/function (Label) {
|
|
12
|
+
let Label = exports.Label = /*#__PURE__*/function (Label) {
|
|
20
13
|
Label["Dismiss"] = "Dismiss";
|
|
21
14
|
return Label;
|
|
22
15
|
}({});
|
|
23
|
-
exports.
|
|
24
|
-
var ChipType = {
|
|
16
|
+
const ChipType = exports.ChipType = {
|
|
25
17
|
CAUTION: "caution",
|
|
26
18
|
INFORMATION: "information",
|
|
27
19
|
NEGATIVE: "negative",
|
|
28
20
|
POSITIVE: "positive"
|
|
29
21
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
value = _ref.value,
|
|
43
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
const Chip = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
appearance,
|
|
25
|
+
lead = "",
|
|
26
|
+
onClick,
|
|
27
|
+
onDismiss,
|
|
28
|
+
quoteValue,
|
|
29
|
+
selected,
|
|
30
|
+
subString = "",
|
|
31
|
+
value,
|
|
32
|
+
...props
|
|
33
|
+
} = _ref;
|
|
44
34
|
// When user tabs over chip and presses Enter or Space key, chip will trigger
|
|
45
35
|
// click functionality
|
|
46
|
-
|
|
36
|
+
const onKeyDown = e => {
|
|
47
37
|
// The " " value is what is returned for the spacebar
|
|
48
38
|
if (e.key === " " || e.key === "Enter") {
|
|
49
39
|
if (typeof onClick === "function") {
|
|
@@ -54,8 +44,8 @@ var Chip = function Chip(_ref) {
|
|
|
54
44
|
}
|
|
55
45
|
}
|
|
56
46
|
};
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
const chipValue = (0, _utils.highlightSubString)(value, subString).text;
|
|
48
|
+
const chipContent = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, lead && /*#__PURE__*/_react.default.createElement("span", {
|
|
59
49
|
className: "p-chip__lead"
|
|
60
50
|
}, lead.toUpperCase()), /*#__PURE__*/_react.default.createElement("span", {
|
|
61
51
|
className: "p-chip__value",
|
|
@@ -63,7 +53,10 @@ var Chip = function Chip(_ref) {
|
|
|
63
53
|
__html: quoteValue ? "'".concat(chipValue, "'") : chipValue
|
|
64
54
|
}
|
|
65
55
|
}));
|
|
66
|
-
|
|
56
|
+
const chipClassName = (0, _classnames.default)({
|
|
57
|
+
["p-chip--".concat(appearance)]: !!appearance,
|
|
58
|
+
"p-chip": !appearance
|
|
59
|
+
}, props.className);
|
|
67
60
|
if (onDismiss) {
|
|
68
61
|
return /*#__PURE__*/_react.default.createElement("span", _extends({}, props, {
|
|
69
62
|
className: chipClassName
|
|
@@ -79,12 +72,9 @@ var Chip = function Chip(_ref) {
|
|
|
79
72
|
"aria-pressed": selected,
|
|
80
73
|
className: chipClassName,
|
|
81
74
|
onClick: onClick,
|
|
82
|
-
onKeyDown:
|
|
83
|
-
return _onKeyDown(e);
|
|
84
|
-
},
|
|
75
|
+
onKeyDown: e => onKeyDown(e),
|
|
85
76
|
type: "button"
|
|
86
77
|
}), chipContent);
|
|
87
78
|
}
|
|
88
79
|
};
|
|
89
|
-
var _default = Chip;
|
|
90
|
-
exports.default = _default;
|
|
80
|
+
var _default = exports.default = Chip;
|
|
@@ -1,6 +1,5 @@
|
|
|
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -9,23 +8,22 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _CodeSnippet = _interopRequireWildcard(require("../CodeSnippet"));
|
|
11
10
|
var _utils = require("../../utils");
|
|
12
|
-
|
|
13
|
-
function
|
|
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; }
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
14
|
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
|
-
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; }
|
|
18
|
-
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; }
|
|
19
15
|
/**
|
|
20
16
|
* @deprecated Code component is deprecated. Use CodeSnippet component or inline `<code>` instead.
|
|
21
17
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
const Code = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
inline,
|
|
23
|
+
copyable,
|
|
24
|
+
numbered,
|
|
25
|
+
...props
|
|
26
|
+
} = _ref;
|
|
29
27
|
if (_utils.IS_DEV) {
|
|
30
28
|
console.warn("Code component is deprecated. Use CodeSnippet component or inline `<code>` instead.");
|
|
31
29
|
}
|
|
@@ -34,7 +32,7 @@ var Code = function Code(_ref) {
|
|
|
34
32
|
className: className
|
|
35
33
|
}, props), children);
|
|
36
34
|
} else {
|
|
37
|
-
|
|
35
|
+
let appearance = null;
|
|
38
36
|
if (numbered) {
|
|
39
37
|
appearance = _CodeSnippet.CodeSnippetBlockAppearance.NUMBERED;
|
|
40
38
|
} else if (copyable) {
|
|
@@ -42,7 +40,7 @@ var Code = function Code(_ref) {
|
|
|
42
40
|
}
|
|
43
41
|
return /*#__PURE__*/_react.default.createElement(_CodeSnippet.default, {
|
|
44
42
|
blocks: [{
|
|
45
|
-
appearance
|
|
43
|
+
appearance,
|
|
46
44
|
code: children
|
|
47
45
|
}]
|
|
48
46
|
});
|
|
@@ -54,5 +52,4 @@ Code.propTypes = {
|
|
|
54
52
|
copyable: _propTypes.default.bool,
|
|
55
53
|
numbered: _propTypes.default.bool
|
|
56
54
|
};
|
|
57
|
-
var _default = Code;
|
|
58
|
-
exports.default = _default;
|
|
55
|
+
var _default = exports.default = Code;
|
|
@@ -7,24 +7,19 @@ exports.default = CodeSnippet;
|
|
|
7
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _CodeSnippetBlock = _interopRequireDefault(require("./CodeSnippetBlock"));
|
|
10
|
-
var _excluded = ["className", "blocks"];
|
|
11
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
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); }
|
|
13
|
-
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; }
|
|
14
|
-
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; }
|
|
15
12
|
function CodeSnippet(_ref) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
let {
|
|
14
|
+
className,
|
|
15
|
+
blocks,
|
|
16
|
+
...props
|
|
17
|
+
} = _ref;
|
|
19
18
|
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
20
19
|
className: (0, _classnames.default)("p-code-snippet", {
|
|
21
|
-
"is-bordered": blocks.some(
|
|
22
|
-
return block.content;
|
|
23
|
-
})
|
|
20
|
+
"is-bordered": blocks.some(block => block.content)
|
|
24
21
|
}, className)
|
|
25
|
-
}, props), blocks.map(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, blockProps));
|
|
29
|
-
}));
|
|
22
|
+
}, props), blocks.map((blockProps, i) => /*#__PURE__*/_react.default.createElement(_CodeSnippetBlock.default, _extends({
|
|
23
|
+
key: "code-snippet-block-".concat(i)
|
|
24
|
+
}, blockProps))));
|
|
30
25
|
}
|
|
@@ -10,32 +10,31 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _CodeSnippetDropdown = _interopRequireDefault(require("./CodeSnippetDropdown"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
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); }
|
|
13
|
-
|
|
13
|
+
const CodeSnippetBlockAppearance = exports.CodeSnippetBlockAppearance = {
|
|
14
14
|
LINUX_PROMPT: "linuxPrompt",
|
|
15
15
|
NUMBERED: "numbered",
|
|
16
16
|
URL: "url",
|
|
17
17
|
WINDOWS_PROMPT: "windowsPrompt"
|
|
18
18
|
};
|
|
19
|
-
exports.CodeSnippetBlockAppearance = CodeSnippetBlockAppearance;
|
|
20
19
|
function CodeSnippetBlock(_ref) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
stacked =
|
|
27
|
-
title
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
let {
|
|
21
|
+
appearance,
|
|
22
|
+
code,
|
|
23
|
+
content,
|
|
24
|
+
dropdowns,
|
|
25
|
+
stacked = false,
|
|
26
|
+
title,
|
|
27
|
+
wrapLines = false
|
|
28
|
+
} = _ref;
|
|
29
|
+
let className = "p-code-snippet__block";
|
|
30
|
+
const isNumbered = appearance === CodeSnippetBlockAppearance.NUMBERED;
|
|
31
|
+
const hasIcon = appearance === CodeSnippetBlockAppearance.LINUX_PROMPT || appearance === CodeSnippetBlockAppearance.WINDOWS_PROMPT || appearance === CodeSnippetBlockAppearance.URL;
|
|
32
|
+
let numberedCode;
|
|
34
33
|
if (isNumbered) {
|
|
35
34
|
className += "--numbered";
|
|
36
35
|
|
|
37
36
|
// wrap code lines in spans (and preserve the whitespace)
|
|
38
|
-
|
|
37
|
+
let lines;
|
|
39
38
|
if (Array.isArray(code)) {
|
|
40
39
|
lines = code;
|
|
41
40
|
} else if (typeof code === "string") {
|
|
@@ -45,13 +44,11 @@ function CodeSnippetBlock(_ref) {
|
|
|
45
44
|
// a single line number.
|
|
46
45
|
lines = [code];
|
|
47
46
|
}
|
|
48
|
-
numberedCode = lines.map(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, line), "\n");
|
|
54
|
-
});
|
|
47
|
+
numberedCode = lines.map((line, i) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
48
|
+
key: "p-code-snippet__line-".concat(i)
|
|
49
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
50
|
+
className: "p-code-snippet__line"
|
|
51
|
+
}, line), "\n"));
|
|
55
52
|
} else if (hasIcon) {
|
|
56
53
|
className += "--icon";
|
|
57
54
|
}
|
|
@@ -60,18 +57,16 @@ function CodeSnippetBlock(_ref) {
|
|
|
60
57
|
"is-url": appearance === CodeSnippetBlockAppearance.URL,
|
|
61
58
|
"is-wrapped": wrapLines
|
|
62
59
|
});
|
|
63
|
-
|
|
60
|
+
const hasDropdowns = dropdowns && dropdowns.length;
|
|
64
61
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (title || hasDropdowns) && /*#__PURE__*/_react.default.createElement("div", {
|
|
65
62
|
className: "p-code-snippet__header ".concat(stacked ? "is-stacked" : "")
|
|
66
63
|
}, /*#__PURE__*/_react.default.createElement("h5", {
|
|
67
64
|
className: "p-code-snippet__title"
|
|
68
65
|
}, title), hasDropdowns && /*#__PURE__*/_react.default.createElement("div", {
|
|
69
66
|
className: "p-code-snippet__dropdowns"
|
|
70
|
-
}, dropdowns.map(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}));
|
|
74
|
-
}))), /*#__PURE__*/_react.default.createElement("pre", {
|
|
67
|
+
}, dropdowns.map((dropdown, i) => /*#__PURE__*/_react.default.createElement(_CodeSnippetDropdown.default, _extends({}, dropdown, {
|
|
68
|
+
key: "code-snippet-dropdown-".concat(i)
|
|
69
|
+
}))))), /*#__PURE__*/_react.default.createElement("pre", {
|
|
75
70
|
className: className
|
|
76
71
|
}, /*#__PURE__*/_react.default.createElement("code", null, isNumbered ? numberedCode : code)), content);
|
|
77
72
|
}
|
|
@@ -5,23 +5,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = CodeSnippetDropdown;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _excluded = ["options", "onChange"],
|
|
9
|
-
_excluded2 = ["label", "value"];
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
9
|
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); }
|
|
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; }
|
|
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; }
|
|
14
10
|
function CodeSnippetDropdown(_ref) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
let {
|
|
12
|
+
options,
|
|
13
|
+
onChange,
|
|
14
|
+
...props
|
|
15
|
+
} = _ref;
|
|
18
16
|
return /*#__PURE__*/_react.default.createElement("select", _extends({
|
|
19
17
|
className: "p-code-snippet__dropdown",
|
|
20
18
|
onChange: onChange
|
|
21
|
-
}, props), options.map(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
}, props), options.map(_ref2 => {
|
|
20
|
+
let {
|
|
21
|
+
label,
|
|
22
|
+
value,
|
|
23
|
+
...props
|
|
24
|
+
} = _ref2;
|
|
25
25
|
return /*#__PURE__*/_react.default.createElement("option", _extends({
|
|
26
26
|
value: value,
|
|
27
27
|
key: value + "" || label
|
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "CodeSnippetBlockAppearance", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _CodeSnippetBlock.CodeSnippetBlockAppearance;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "default", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function
|
|
14
|
+
get: function () {
|
|
15
15
|
return _CodeSnippet.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
@@ -1,39 +1,37 @@
|
|
|
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = exports.colSizes = void 0;
|
|
8
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _excluded = ["children", "className", "element", "emptyLarge", "emptyMedium", "emptySmall", "large", "medium", "size", "small"];
|
|
11
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
10
|
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); }
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
emptySmall = _ref.emptySmall,
|
|
29
|
-
large = _ref.large,
|
|
30
|
-
medium = _ref.medium,
|
|
31
|
-
size = _ref.size,
|
|
32
|
-
small = _ref.small,
|
|
33
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
11
|
+
const colSizes = exports.colSizes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
12
|
+
const Col = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
element: Component = "div",
|
|
17
|
+
emptyLarge,
|
|
18
|
+
emptyMedium,
|
|
19
|
+
emptySmall,
|
|
20
|
+
large,
|
|
21
|
+
medium,
|
|
22
|
+
size,
|
|
23
|
+
small,
|
|
24
|
+
...props
|
|
25
|
+
} = _ref;
|
|
34
26
|
return /*#__PURE__*/_react.default.createElement(Component, _extends({
|
|
35
|
-
className: (0, _classnames.default)(className, "col-".concat(size),
|
|
27
|
+
className: (0, _classnames.default)(className, "col-".concat(size), {
|
|
28
|
+
["col-small-".concat(small)]: !!small,
|
|
29
|
+
["col-medium-".concat(medium)]: !!medium,
|
|
30
|
+
["col-large-".concat(large)]: !!large,
|
|
31
|
+
["col-start-small-".concat(emptySmall)]: !!emptySmall,
|
|
32
|
+
["col-start-medium-".concat(emptyMedium)]: !!emptyMedium,
|
|
33
|
+
["col-start-large-".concat(emptyLarge)]: !!emptyLarge
|
|
34
|
+
})
|
|
36
35
|
}, props), children);
|
|
37
36
|
};
|
|
38
|
-
var _default = Col;
|
|
39
|
-
exports.default = _default;
|
|
37
|
+
var _default = exports.default = Col;
|