@canonical/react-components 0.41.0 → 0.43.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 -65
- 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 +7 -18
- 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 +14 -30
- 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/ConfirmationButton/ConfirmationButton.d.ts +25 -0
- package/dist/components/ConfirmationButton/ConfirmationButton.js +59 -0
- package/dist/components/ConfirmationButton/index.d.ts +2 -0
- package/dist/components/ConfirmationButton/index.js +13 -0
- package/dist/components/ConfirmationModal/ConfirmationModal.d.ts +33 -0
- package/dist/components/ConfirmationModal/ConfirmationModal.js +38 -0
- package/dist/components/ConfirmationModal/index.d.ts +2 -0
- package/dist/components/ConfirmationModal/index.js +13 -0
- package/dist/components/ContextualMenu/ContextualMenu.d.ts +3 -3
- package/dist/components/ContextualMenu/ContextualMenu.js +66 -101
- package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.d.ts +2 -1
- package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.js +48 -85
- package/dist/components/ContextualMenu/ContextualMenuDropdown/index.js +0 -2
- package/dist/components/ContextualMenu/index.js +0 -2
- package/dist/components/EmptyState/EmptyState.d.ts +22 -0
- package/dist/components/EmptyState/EmptyState.js +27 -0
- package/dist/components/EmptyState/index.d.ts +2 -0
- package/dist/components/EmptyState/index.js +13 -0
- 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/Icon.stories.scss +1 -0
- 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.d.ts +5 -5
- package/dist/components/List/List.js +17 -32
- 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 +59 -111
- 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 +39 -46
- 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 -0
- package/dist/components/Notification/Notification.js +29 -42
- package/dist/components/Notification/index.js +0 -4
- package/dist/components/NotificationProvider/NotificationProvider.d.ts +5 -0
- package/dist/components/NotificationProvider/NotificationProvider.js +119 -0
- package/dist/components/NotificationProvider/index.d.ts +3 -0
- package/dist/components/NotificationProvider/index.js +49 -0
- package/dist/components/NotificationProvider/messageBuilder.d.ts +6 -0
- package/dist/components/NotificationProvider/messageBuilder.js +41 -0
- package/dist/components/NotificationProvider/types.d.ts +30 -0
- package/dist/components/NotificationProvider/types.js +5 -0
- package/dist/components/Pagination/Pagination.js +14 -44
- package/dist/components/Pagination/PaginationButton/PaginationButton.js +3 -10
- 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 +16 -45
- 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 +68 -104
- package/dist/components/SearchAndFilter/index.js +0 -2
- package/dist/components/SearchAndFilter/utils.js +1 -7
- package/dist/components/SearchBox/SearchBox.js +14 -34
- 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 +38 -88
- package/dist/components/Tooltip/index.js +0 -4
- package/dist/enums.js +0 -2
- 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.js +6 -13
- package/dist/index.d.ts +8 -0
- package/dist/index.js +64 -52
- package/dist/utils.js +3 -10
- package/package.json +31 -28
|
@@ -1,68 +1,54 @@
|
|
|
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 _Field = _interopRequireDefault(require("../Field"));
|
|
15
|
-
|
|
16
11
|
var _CheckboxInput = _interopRequireDefault(require("../CheckboxInput"));
|
|
17
|
-
|
|
18
12
|
var _RadioInput = _interopRequireDefault(require("../RadioInput"));
|
|
19
|
-
|
|
20
13
|
var _hooks = require("../../hooks");
|
|
21
|
-
|
|
22
14
|
var _excluded = ["caution", "className", "error", "help", "helpClassName", "id", "label", "labelClassName", "required", "stacked", "success", "takeFocus", "takeFocusDelay", "type", "wrapperClassName"];
|
|
23
|
-
|
|
24
15
|
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); }
|
|
25
|
-
|
|
26
16
|
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; }
|
|
27
|
-
|
|
28
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
-
|
|
30
18
|
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); }
|
|
31
|
-
|
|
32
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
-
|
|
34
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
21
|
+
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; }
|
|
22
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
|
+
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); }
|
|
38
24
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
39
|
-
|
|
40
25
|
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; }
|
|
26
|
+
/**
|
|
27
|
+
* The props for the Input component.
|
|
28
|
+
*/
|
|
41
29
|
|
|
42
30
|
var Input = function Input(_ref) {
|
|
43
31
|
var caution = _ref.caution,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
className = _ref.className,
|
|
33
|
+
error = _ref.error,
|
|
34
|
+
help = _ref.help,
|
|
35
|
+
helpClassName = _ref.helpClassName,
|
|
36
|
+
id = _ref.id,
|
|
37
|
+
label = _ref.label,
|
|
38
|
+
labelClassName = _ref.labelClassName,
|
|
39
|
+
required = _ref.required,
|
|
40
|
+
stacked = _ref.stacked,
|
|
41
|
+
success = _ref.success,
|
|
42
|
+
takeFocus = _ref.takeFocus,
|
|
43
|
+
takeFocusDelay = _ref.takeFocusDelay,
|
|
44
|
+
type = _ref.type,
|
|
45
|
+
wrapperClassName = _ref.wrapperClassName,
|
|
46
|
+
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
60
47
|
var inputRef = (0, _react.useRef)(null);
|
|
61
48
|
var fieldLabel = !["checkbox", "radio"].includes(type) ? label : "";
|
|
62
49
|
var validationId = (0, _hooks.useId)();
|
|
63
50
|
var helpId = (0, _hooks.useId)();
|
|
64
51
|
var hasError = !!error;
|
|
65
|
-
|
|
66
52
|
var commonProps = _objectSpread({
|
|
67
53
|
"aria-describedby": [help ? helpId : null, success ? validationId : null].filter(Boolean).join(" "),
|
|
68
54
|
"aria-errormessage": hasError ? validationId : null,
|
|
@@ -71,7 +57,6 @@ var Input = function Input(_ref) {
|
|
|
71
57
|
label: label,
|
|
72
58
|
required: required
|
|
73
59
|
}, inputProps);
|
|
74
|
-
|
|
75
60
|
(0, _react.useEffect)(function () {
|
|
76
61
|
if (takeFocus) {
|
|
77
62
|
if (takeFocusDelay) {
|
|
@@ -84,7 +69,6 @@ var Input = function Input(_ref) {
|
|
|
84
69
|
}
|
|
85
70
|
}, [takeFocus, takeFocusDelay]);
|
|
86
71
|
var input;
|
|
87
|
-
|
|
88
72
|
if (type === "checkbox") {
|
|
89
73
|
input = /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, _extends({
|
|
90
74
|
label: label,
|
|
@@ -102,7 +86,6 @@ var Input = function Input(_ref) {
|
|
|
102
86
|
type: type
|
|
103
87
|
}, commonProps));
|
|
104
88
|
}
|
|
105
|
-
|
|
106
89
|
return /*#__PURE__*/_react.default.createElement(_Field.default, {
|
|
107
90
|
caution: caution,
|
|
108
91
|
className: wrapperClassName,
|
|
@@ -120,6 +103,5 @@ var Input = function Input(_ref) {
|
|
|
120
103
|
validationId: validationId
|
|
121
104
|
}, input);
|
|
122
105
|
};
|
|
123
|
-
|
|
124
106
|
var _default = Input;
|
|
125
107
|
exports.default = _default;
|
|
@@ -4,28 +4,23 @@ 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 = ["children", "className", "forId", "required"];
|
|
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; }
|
|
14
|
+
/**
|
|
15
|
+
* The props for the Label component.
|
|
16
|
+
*/
|
|
21
17
|
|
|
22
18
|
var Label = function Label(_ref) {
|
|
23
19
|
var children = _ref.children,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
className = _ref.className,
|
|
21
|
+
forId = _ref.forId,
|
|
22
|
+
required = _ref.required,
|
|
23
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
24
|
return /*#__PURE__*/_react.default.createElement("label", _extends({
|
|
30
25
|
className: (0, _classnames.default)(className, "p-form__label", {
|
|
31
26
|
"is-required": required
|
|
@@ -33,6 +28,5 @@ var Label = function Label(_ref) {
|
|
|
33
28
|
htmlFor: forId
|
|
34
29
|
}, props), children);
|
|
35
30
|
};
|
|
36
|
-
|
|
37
31
|
var _default = Label;
|
|
38
32
|
exports.default = _default;
|
|
@@ -4,34 +4,25 @@ 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 = ["children", "className", "href", "inverted", "soft", "top"];
|
|
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 Link = function Link(_ref) {
|
|
23
15
|
var children = _ref.children,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
className = _ref.className,
|
|
17
|
+
_ref$href = _ref.href,
|
|
18
|
+
href = _ref$href === void 0 ? "#" : _ref$href,
|
|
19
|
+
_ref$inverted = _ref.inverted,
|
|
20
|
+
inverted = _ref$inverted === void 0 ? false : _ref$inverted,
|
|
21
|
+
_ref$soft = _ref.soft,
|
|
22
|
+
soft = _ref$soft === void 0 ? false : _ref$soft,
|
|
23
|
+
_ref$top = _ref.top,
|
|
24
|
+
top = _ref$top === void 0 ? false : _ref$top,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
35
26
|
var link = /*#__PURE__*/_react.default.createElement("a", _extends({
|
|
36
27
|
className: (0, _classnames.default)(className, {
|
|
37
28
|
"p-link--inverted": inverted,
|
|
@@ -40,15 +31,12 @@ var Link = function Link(_ref) {
|
|
|
40
31
|
}),
|
|
41
32
|
href: href
|
|
42
33
|
}, props), children);
|
|
43
|
-
|
|
44
34
|
if (top) {
|
|
45
35
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
46
36
|
className: "p-top"
|
|
47
37
|
}, link);
|
|
48
38
|
}
|
|
49
|
-
|
|
50
39
|
return link;
|
|
51
40
|
};
|
|
52
|
-
|
|
53
41
|
var _default = Link;
|
|
54
42
|
exports.default = _default;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { HTMLProps, ReactNode } from "react";
|
|
2
|
-
import
|
|
3
|
-
export type ListItem = ReactNode |
|
|
2
|
+
import { ClassName, Headings, PropsWithSpread } from "../../types";
|
|
3
|
+
export type ListItem = ReactNode | PropsWithSpread<{
|
|
4
4
|
content: ReactNode;
|
|
5
|
-
}
|
|
6
|
-
export type SteppedListItem = {
|
|
5
|
+
}, HTMLProps<HTMLLIElement>>;
|
|
6
|
+
export type SteppedListItem = PropsWithSpread<{
|
|
7
7
|
content: ReactNode;
|
|
8
8
|
title: ReactNode;
|
|
9
9
|
titleElement?: Headings;
|
|
10
|
-
}
|
|
10
|
+
}, HTMLProps<HTMLLIElement>>;
|
|
11
11
|
export type Props = {
|
|
12
12
|
/**
|
|
13
13
|
* Optional class(es) to pass to the wrapping element.
|
|
@@ -4,31 +4,22 @@ 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 = ["title", "className", "content", "titleElement"],
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
_excluded2 = ["title", "className", "content"],
|
|
11
|
+
_excluded3 = ["className", "detailed", "divided", "inline", "isDark", "items", "middot", "stretch", "split", "stepped", "ticked"];
|
|
16
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
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); }
|
|
19
|
-
|
|
20
14
|
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
15
|
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
16
|
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); }
|
|
25
|
-
|
|
26
17
|
var generateItems = function generateItems(_ref) {
|
|
27
18
|
var items = _ref.items,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
ticked = _ref.ticked,
|
|
20
|
+
inline = _ref.inline,
|
|
21
|
+
middot = _ref.middot,
|
|
22
|
+
stepped = _ref.stepped;
|
|
32
23
|
return items.map(function (item, i) {
|
|
33
24
|
var body;
|
|
34
25
|
var title;
|
|
@@ -36,7 +27,6 @@ var generateItems = function generateItems(_ref) {
|
|
|
36
27
|
var content;
|
|
37
28
|
var TitleComponent = "h3";
|
|
38
29
|
var liProps;
|
|
39
|
-
|
|
40
30
|
if ( /*#__PURE__*/_react.default.isValidElement(item) || typeof item === "string" || typeof item === "number") {
|
|
41
31
|
content = item;
|
|
42
32
|
} else if (item && _typeof(item) === "object" && "content" in item) {
|
|
@@ -58,7 +48,6 @@ var generateItems = function generateItems(_ref) {
|
|
|
58
48
|
_item2;
|
|
59
49
|
}
|
|
60
50
|
}
|
|
61
|
-
|
|
62
51
|
if (stepped) {
|
|
63
52
|
body = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TitleComponent, {
|
|
64
53
|
className: "p-stepped-list__title"
|
|
@@ -68,7 +57,6 @@ var generateItems = function generateItems(_ref) {
|
|
|
68
57
|
} else {
|
|
69
58
|
body = content;
|
|
70
59
|
}
|
|
71
|
-
|
|
72
60
|
return /*#__PURE__*/_react.default.createElement("li", _extends({
|
|
73
61
|
className: (0, _classnames.default)(className, {
|
|
74
62
|
"p-list__item": !inline && !stepped,
|
|
@@ -80,21 +68,19 @@ var generateItems = function generateItems(_ref) {
|
|
|
80
68
|
}, liProps), body, middot ? " " : null);
|
|
81
69
|
});
|
|
82
70
|
};
|
|
83
|
-
|
|
84
71
|
var List = function List(_ref2) {
|
|
85
72
|
var className = _ref2.className,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
73
|
+
detailed = _ref2.detailed,
|
|
74
|
+
divided = _ref2.divided,
|
|
75
|
+
inline = _ref2.inline,
|
|
76
|
+
isDark = _ref2.isDark,
|
|
77
|
+
items = _ref2.items,
|
|
78
|
+
middot = _ref2.middot,
|
|
79
|
+
stretch = _ref2.stretch,
|
|
80
|
+
split = _ref2.split,
|
|
81
|
+
stepped = _ref2.stepped,
|
|
82
|
+
ticked = _ref2.ticked,
|
|
83
|
+
props = _objectWithoutProperties(_ref2, _excluded3);
|
|
98
84
|
var Component = stepped ? "ol" : "ul";
|
|
99
85
|
return /*#__PURE__*/_react.default.createElement(Component, _extends({
|
|
100
86
|
className: (0, _classnames.default)(className, {
|
|
@@ -116,6 +102,5 @@ var List = function List(_ref2) {
|
|
|
116
102
|
stepped: stepped
|
|
117
103
|
}));
|
|
118
104
|
};
|
|
119
|
-
|
|
120
105
|
var _default = List;
|
|
121
106
|
exports.default = _default;
|
|
@@ -4,15 +4,10 @@ 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 _Spinner = _interopRequireDefault(require("../Spinner"));
|
|
11
|
-
|
|
12
9
|
var _utils = require("../../utils");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
/**
|
|
17
12
|
* @deprecated Loader component is deprecated. Use Spinner component instead.
|
|
18
13
|
*/
|
|
@@ -20,9 +15,7 @@ var Loader = function Loader(props) {
|
|
|
20
15
|
if (_utils.IS_DEV) {
|
|
21
16
|
console.warn("The Loader component has been renamed to Spinner and will be removed in a future release. https://canonical.github.io/react-components/?path=/story/spinner--default-story");
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
return /*#__PURE__*/_react.default.createElement(_Spinner.default, props);
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
var _default = Loader;
|
|
28
21
|
exports.default = _default;
|