@decisiv/ui-components 2.0.1-alpha.8 → 2.0.1-alpha.97
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/lib/atoms/BaseButton/index.d.ts.map +1 -1
- package/lib/atoms/BaseButton/index.js +1 -1
- package/lib/atoms/BooleanInput/index.d.ts.map +1 -1
- package/lib/atoms/BooleanInput/index.js +19 -2
- package/lib/atoms/BooleanInput/index.test.js +17 -6
- package/lib/atoms/BooleanInput/types.d.ts +2 -0
- package/lib/atoms/BooleanInput/types.d.ts.map +1 -1
- package/lib/atoms/BooleanInput/types.js +5 -1
- package/lib/atoms/Calendar/hooks/useCalendar/index.d.ts.map +1 -1
- package/lib/atoms/Calendar/hooks/useCalendar/index.js +2 -1
- package/lib/atoms/Calendar/hooks/useCalendar/index.test.js +5 -6
- package/lib/atoms/Calendar/index.d.ts.map +1 -1
- package/lib/atoms/Calendar/index.js +8 -1
- package/lib/atoms/Calendar/index.test.js +70 -40
- package/lib/atoms/Calendar/types.js +5 -1
- package/lib/atoms/InputField/Containers.d.ts +11 -6
- package/lib/atoms/InputField/Containers.d.ts.map +1 -1
- package/lib/atoms/InputField/Containers.js +6 -6
- package/lib/atoms/InputField/InputLabel.d.ts +1 -0
- package/lib/atoms/InputField/InputLabel.d.ts.map +1 -1
- package/lib/atoms/InputField/InputLabel.js +2 -1
- package/lib/atoms/InputField/index.d.ts +5 -0
- package/lib/atoms/InputField/index.d.ts.map +1 -1
- package/lib/atoms/InputField/index.js +21 -7
- package/lib/atoms/InputField/index.test.js +91 -0
- package/lib/atoms/InputField/schema.d.ts.map +1 -1
- package/lib/atoms/InputField/schema.js +1 -0
- package/lib/atoms/OptionsList/Category.d.ts +1 -1
- package/lib/atoms/OptionsList/Category.d.ts.map +1 -1
- package/lib/atoms/OptionsList/Category.js +4 -2
- package/lib/atoms/OptionsList/Footer.d.ts +8 -0
- package/lib/atoms/OptionsList/Footer.d.ts.map +1 -0
- package/lib/atoms/OptionsList/Footer.js +72 -0
- package/lib/atoms/OptionsList/Option.d.ts.map +1 -1
- package/lib/atoms/OptionsList/Option.js +8 -5
- package/lib/atoms/OptionsList/index.d.ts.map +1 -1
- package/lib/atoms/OptionsList/index.js +43 -16
- package/lib/atoms/OptionsList/index.test.js +107 -11
- package/lib/atoms/OptionsList/schema.d.ts.map +1 -1
- package/lib/atoms/OptionsList/schema.js +4 -0
- package/lib/atoms/OptionsList/types.d.ts +14 -0
- package/lib/atoms/OptionsList/types.d.ts.map +1 -1
- package/lib/atoms/OptionsList/types.js +5 -1
- package/lib/atoms/RequiredIcon.d.ts +9 -0
- package/lib/atoms/RequiredIcon.d.ts.map +1 -0
- package/lib/atoms/{InputField/RequiredIcon.js → RequiredIcon.js} +7 -3
- package/lib/components/Accordion/types.js +5 -1
- package/lib/components/Accordion/useAccordion/types.js +5 -1
- package/lib/components/Avatar/types.js +5 -1
- package/lib/components/Badge/constants.d.ts +2 -0
- package/lib/components/Badge/constants.d.ts.map +1 -0
- package/lib/components/Badge/constants.js +29 -0
- package/lib/components/Badge/index.d.ts.map +1 -1
- package/lib/components/Badge/index.js +12 -23
- package/lib/components/Badge/index.test.js +51 -8
- package/lib/components/Badge/schema.js +1 -1
- package/lib/components/Badge/types.d.ts +1 -1
- package/lib/components/Badge/types.d.ts.map +1 -1
- package/lib/components/Badge/types.js +7 -3
- package/lib/components/Breadcrumbs/types.js +5 -1
- package/lib/components/Button/schema.d.ts +6 -1
- package/lib/components/Button/schema.d.ts.map +1 -1
- package/lib/components/Button/schema.js +9 -4
- package/lib/components/Button/types.js +5 -1
- package/lib/components/Checkbox/index.d.ts.map +1 -1
- package/lib/components/Checkbox/index.js +3 -1
- package/lib/components/Checkbox/schema.d.ts.map +1 -1
- package/lib/components/Checkbox/schema.js +2 -0
- package/lib/components/Combobox/Target.d.ts.map +1 -1
- package/lib/components/Combobox/Target.js +45 -14
- package/lib/components/Combobox/index.d.ts.map +1 -1
- package/lib/components/Combobox/index.js +193 -65
- package/lib/components/Combobox/index.test.js +358 -135
- package/lib/components/Combobox/schema.d.ts.map +1 -1
- package/lib/components/Combobox/schema.js +9 -2
- package/lib/components/Combobox/types.d.ts +12 -3
- package/lib/components/Combobox/types.d.ts.map +1 -1
- package/lib/components/Combobox/types.js +5 -1
- package/lib/components/DropdownList/index.d.ts +4 -0
- package/lib/components/DropdownList/index.d.ts.map +1 -1
- package/lib/components/DropdownList/index.js +76 -11
- package/lib/components/DropdownList/propTypes.d.ts +4 -0
- package/lib/components/DropdownList/propTypes.d.ts.map +1 -0
- package/lib/components/DropdownList/propTypes.js +42 -0
- package/lib/components/DropdownList/schema.d.ts.map +1 -1
- package/lib/components/DropdownList/schema.js +5 -0
- package/lib/components/DropdownList/types.d.ts +4 -1
- package/lib/components/DropdownList/types.d.ts.map +1 -1
- package/lib/components/Filter/IconWrapper/index.d.ts +197 -0
- package/lib/components/Filter/IconWrapper/index.d.ts.map +1 -0
- package/lib/components/Filter/IconWrapper/index.js +35 -0
- package/lib/components/Filter/SimplePrimary/index.d.ts +31 -0
- package/lib/components/Filter/SimplePrimary/index.d.ts.map +1 -0
- package/lib/components/Filter/SimplePrimary/index.js +58 -0
- package/lib/components/Filter/SimplePrimary/index.test.js +34 -0
- package/lib/components/Filter/StyledFilter.d.ts +4 -0
- package/lib/components/Filter/StyledFilter.d.ts.map +1 -0
- package/lib/components/Filter/StyledFilter.js +39 -0
- package/lib/components/Filter/StyledLabel/index.d.ts +8 -0
- package/lib/components/Filter/StyledLabel/index.d.ts.map +1 -0
- package/lib/components/Filter/StyledLabel/index.js +30 -0
- package/lib/components/Filter/index.d.ts +27 -0
- package/lib/components/Filter/index.d.ts.map +1 -0
- package/lib/components/Filter/index.js +95 -0
- package/lib/components/Filter/index.test.js +41 -0
- package/lib/components/Filter/kind.d.ts +6 -0
- package/lib/components/Filter/kind.d.ts.map +1 -0
- package/lib/components/Filter/kind.js +45 -0
- package/lib/components/Filter/schema.d.ts +9 -0
- package/lib/components/Filter/schema.d.ts.map +1 -0
- package/lib/components/Filter/schema.js +32 -0
- package/lib/components/Filter/types.d.ts +17 -0
- package/lib/components/Filter/types.d.ts.map +1 -0
- package/lib/components/Filter/types.js +5 -0
- package/lib/components/JumpTo/JumpToMenu.d.ts +2 -2
- package/lib/components/JumpTo/JumpToMenu.d.ts.map +1 -1
- package/lib/components/JumpTo/JumpToMenu.js +3 -3
- package/lib/components/JumpTo/types.js +5 -1
- package/lib/components/LeftNav/Item/ClickArea.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/ClickArea.js +2 -2
- package/lib/components/LeftNav/Item/ItemWrapper.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/ItemWrapper.js +3 -3
- package/lib/components/LeftNav/Item/MenuItemWrapper.d.ts +7 -0
- package/lib/components/LeftNav/Item/MenuItemWrapper.d.ts.map +1 -0
- package/lib/components/LeftNav/Item/MenuItemWrapper.js +20 -0
- package/lib/components/LeftNav/Item/NavCollapsedXItem/index.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/NavCollapsedXItem/index.js +7 -5
- package/lib/components/LeftNav/Item/NavExpandedItem/index.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/NavExpandedItem/index.js +24 -13
- package/lib/components/LeftNav/Item/types.d.ts +1 -1
- package/lib/components/LeftNav/Item/types.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/types.js +5 -1
- package/lib/components/LeftNav/index.test.js +13 -3
- package/lib/components/LeftNav/schema.d.ts.map +1 -1
- package/lib/components/LeftNav/schema.js +2 -0
- package/lib/components/LeftNav/types.d.ts +1 -0
- package/lib/components/LeftNav/types.d.ts.map +1 -1
- package/lib/components/LeftNav/types.js +5 -1
- package/lib/components/Link/index.d.ts +2 -2
- package/lib/components/Link/index.d.ts.map +1 -1
- package/lib/components/Link/index.js +1 -1
- package/lib/components/Link/index.test.js +8 -0
- package/lib/components/Link/schema.d.ts.map +1 -1
- package/lib/components/Link/schema.js +1 -1
- package/lib/components/Menu/index.d.ts.map +1 -1
- package/lib/components/Menu/index.js +3 -1
- package/lib/components/Menu/types.d.ts +2 -0
- package/lib/components/Menu/types.d.ts.map +1 -1
- package/lib/components/Menu/types.js +5 -1
- package/lib/components/Modal/components.d.ts +2 -2
- package/lib/components/Modal/index.d.ts.map +1 -1
- package/lib/components/Modal/index.js +5 -5
- package/lib/components/Modal/index.test.js +32 -0
- package/lib/components/Modal/schema.d.ts.map +1 -1
- package/lib/components/Modal/schema.js +2 -2
- package/lib/components/Modal/types.d.ts +2 -2
- package/lib/components/Modal/types.d.ts.map +1 -1
- package/lib/components/Modal/types.js +5 -1
- package/lib/components/Notifications/Notification/components.d.ts +3 -3
- package/lib/components/Notifications/Notification/components.d.ts.map +1 -1
- package/lib/components/Notifications/Notification/components.js +12 -6
- package/lib/components/Notifications/Notification/index.d.ts +3 -6
- package/lib/components/Notifications/Notification/index.d.ts.map +1 -1
- package/lib/components/Notifications/Notification/index.js +19 -12
- package/lib/components/Notifications/Notification/index.test.js +38 -19
- package/lib/components/Notifications/NotificationsPanel/index.d.ts +2 -1
- package/lib/components/Notifications/NotificationsPanel/index.d.ts.map +1 -1
- package/lib/components/Notifications/NotificationsPanel/index.js +44 -21
- package/lib/components/Notifications/NotificationsPanel/schema.js +1 -1
- package/lib/components/Notifications/Notifier.test.js +79 -10
- package/lib/components/Notifications/constants.d.ts +2 -0
- package/lib/components/Notifications/constants.d.ts.map +1 -0
- package/lib/components/Notifications/constants.js +16 -0
- package/lib/components/Notifications/schema.d.ts.map +1 -1
- package/lib/components/Notifications/schema.js +2 -1
- package/lib/components/Notifications/useNotifications.d.ts +1 -0
- package/lib/components/Notifications/useNotifications.d.ts.map +1 -1
- package/lib/components/Notifications/useNotifications.js +3 -3
- package/lib/components/Notifications/useNotifications.test.js +7 -4
- package/lib/components/Pagination/Pagination.d.ts +1 -1
- package/lib/components/Pagination/Pagination.d.ts.map +1 -1
- package/lib/components/Pagination/Pagination.js +1 -0
- package/lib/components/Pagination/Pagination.test.js +9 -0
- package/lib/components/Pagination/types.js +5 -1
- package/lib/components/Popover/utils.d.ts +1 -1
- package/lib/components/Select/Target.js +1 -1
- package/lib/components/Select/index.d.ts.map +1 -1
- package/lib/components/Select/index.js +37 -1
- package/lib/components/Select/index.test.js +82 -23
- package/lib/components/Select/schema.d.ts.map +1 -1
- package/lib/components/Select/schema.js +7 -0
- package/lib/components/Select/types.d.ts +4 -1
- package/lib/components/Select/types.d.ts.map +1 -1
- package/lib/components/Select/types.js +5 -1
- package/lib/components/SelectDate/Target.js +1 -1
- package/lib/components/SelectDate/index.d.ts.map +1 -1
- package/lib/components/SelectDate/index.js +28 -1
- package/lib/components/SelectDate/index.test.js +108 -51
- package/lib/components/SelectDate/schema.d.ts.map +1 -1
- package/lib/components/SelectDate/schema.js +2 -0
- package/lib/components/SelectDate/types.d.ts +2 -0
- package/lib/components/SelectDate/types.d.ts.map +1 -1
- package/lib/components/SelectDate/types.js +5 -1
- package/lib/components/SelectDateRange/index.d.ts.map +1 -1
- package/lib/components/SelectDateRange/index.js +28 -1
- package/lib/components/SelectDateRange/index.test.js +115 -58
- package/lib/components/SelectDateRange/schema.d.ts.map +1 -1
- package/lib/components/SelectDateRange/schema.js +2 -0
- package/lib/components/SelectDateRange/types.js +5 -1
- package/lib/components/SelectMenu/index.d.ts +5 -0
- package/lib/components/SelectMenu/index.d.ts.map +1 -1
- package/lib/components/SelectMenu/index.js +27 -3
- package/lib/components/SelectMenu/schema.d.ts.map +1 -1
- package/lib/components/SelectMenu/schema.js +4 -0
- package/lib/components/Table/Body.d.ts.map +1 -1
- package/lib/components/Table/Body.js +182 -38
- package/lib/components/Table/Container.d.ts.map +1 -1
- package/lib/components/Table/Container.js +2 -2
- package/lib/components/Table/DataRow.d.ts.map +1 -1
- package/lib/components/Table/DataRow.js +43 -16
- package/lib/components/Table/DraggableWrapper.d.ts +5 -0
- package/lib/components/Table/DraggableWrapper.d.ts.map +1 -0
- package/lib/components/Table/DraggableWrapper.js +38 -0
- package/lib/components/Table/Grip.d.ts +4 -0
- package/lib/components/Table/Grip.d.ts.map +1 -0
- package/lib/components/Table/Grip.js +30 -0
- package/lib/components/Table/Head.d.ts +1 -1
- package/lib/components/Table/Head.d.ts.map +1 -1
- package/lib/components/Table/Head.js +11 -5
- package/lib/components/Table/HeaderCell/index.d.ts.map +1 -1
- package/lib/components/Table/HeaderCell/index.js +22 -8
- package/lib/components/Table/HeaderCell/types.d.ts +6 -1
- package/lib/components/Table/HeaderCell/types.d.ts.map +1 -1
- package/lib/components/Table/HeaderCell/types.js +5 -1
- package/lib/components/Table/Provider.d.ts +13 -4
- package/lib/components/Table/Provider.d.ts.map +1 -1
- package/lib/components/Table/Provider.js +45 -5
- package/lib/components/Table/index.d.ts.map +1 -1
- package/lib/components/Table/index.js +112 -18
- package/lib/components/Table/index.test.js +330 -84
- package/lib/components/Table/schema.columns.d.ts.map +1 -1
- package/lib/components/Table/schema.columns.js +6 -4
- package/lib/components/Table/schema.d.ts.map +1 -1
- package/lib/components/Table/schema.js +8 -6
- package/lib/components/Table/types.d.ts +34 -4
- package/lib/components/Table/types.d.ts.map +1 -1
- package/lib/components/Table/utils.d.ts +2 -8
- package/lib/components/Table/utils.d.ts.map +1 -1
- package/lib/components/Table/utils.js +21 -20
- package/lib/components/Tabs/types.js +5 -1
- package/lib/components/Tag/types.d.ts +1 -1
- package/lib/components/Tag/types.d.ts.map +1 -1
- package/lib/components/Tag/types.js +5 -1
- package/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextArea/index.js +1 -0
- package/lib/components/TextArea/index.test.js +5 -0
- package/lib/components/TextField/Input.js +1 -1
- package/lib/components/TextField/index.test.js +5 -0
- package/lib/components/Toggle/index.d.ts.map +1 -1
- package/lib/components/Toggle/index.js +4 -0
- package/lib/components/Toggle/index.test.js +39 -10
- package/lib/components/Toggle/types.js +5 -1
- package/lib/components/TopNav/BrandInfo/index.d.ts +2 -1
- package/lib/components/TopNav/BrandInfo/index.d.ts.map +1 -1
- package/lib/components/TopNav/BrandInfo/index.js +9 -1
- package/lib/components/TopNav/BrandInfo/schema.d.ts.map +1 -1
- package/lib/components/TopNav/BrandInfo/schema.js +4 -1
- package/lib/components/TopNav/index.test.js +28 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +9 -0
- package/lib/providers/ConfigProvider/index.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/index.js +5 -1
- package/lib/providers/ConfigProvider/utils/context.d.ts +1 -1
- package/lib/providers/ConfigProvider/utils/context.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/utils/normalizer.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/utils/normalizer.js +1 -1
- package/lib/providers/ConfigProvider/utils/translations.d.ts +1 -1
- package/lib/providers/ConfigProvider/utils/translations.js +1 -1
- package/lib/providers/NotificationsProvider/index.d.ts +6 -5
- package/lib/providers/NotificationsProvider/index.d.ts.map +1 -1
- package/lib/providers/NotificationsProvider/index.js +47 -28
- package/lib/providers/NotificationsProvider/types.d.ts +4 -1
- package/lib/providers/NotificationsProvider/types.d.ts.map +1 -1
- package/lib/utils/joinClassnames.d.ts +3 -0
- package/lib/utils/joinClassnames.d.ts.map +1 -0
- package/lib/utils/joinClassnames.js +26 -0
- package/lib/utils/useFirstMount.d.ts +2 -0
- package/lib/utils/useFirstMount.d.ts.map +1 -0
- package/lib/utils/useFirstMount.js +19 -0
- package/lib/utils/useUpdateEffect.d.ts +4 -0
- package/lib/utils/useUpdateEffect.d.ts.map +1 -0
- package/lib/utils/useUpdateEffect.js +28 -0
- package/package.json +4 -2
- package/lib/atoms/InputField/RequiredIcon.d.ts +0 -4
- package/lib/atoms/InputField/RequiredIcon.d.ts.map +0 -1
|
@@ -15,7 +15,7 @@ var _color = _interopRequireDefault(require("@decisiv/design-tokens/lib/color"))
|
|
|
15
15
|
|
|
16
16
|
var _spacing = _interopRequireDefault(require("@decisiv/design-tokens/lib/spacing"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _utils = require("../../../utils");
|
|
19
19
|
|
|
20
20
|
var _skyPlane = _interopRequireDefault(require("../../../utils/skyPlane"));
|
|
21
21
|
|
|
@@ -23,6 +23,8 @@ var _Grid = _interopRequireDefault(require("../../Grid"));
|
|
|
23
23
|
|
|
24
24
|
var _Button = _interopRequireDefault(require("../../Button"));
|
|
25
25
|
|
|
26
|
+
var _constants = require("../constants");
|
|
27
|
+
|
|
26
28
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
27
29
|
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -30,17 +32,21 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
30
32
|
var NotificationCard = (0, _styledComponents.default)(_Grid.default.Container).withConfig({
|
|
31
33
|
displayName: "components__NotificationCard",
|
|
32
34
|
componentId: "ds1zkc-0"
|
|
33
|
-
})(["background-color:", ";box-shadow:", ";border-radius:2px;width:", ";", ";"], (0, _toColorString.default)(_color.default.base.snowWhite), (0, _skyPlane.default)(2),
|
|
35
|
+
})(["background-color:", ";box-shadow:", ";border-radius:2px;width:", ";", ";"], (0, _toColorString.default)(_color.default.base.snowWhite), (0, _skyPlane.default)(2), _constants.NOTIFICATION_CARD_WIDTH, (0, _utils.applyDynamicModifiers)('borderColor', function (_ref) {
|
|
34
36
|
var borderColor = _ref.borderColor;
|
|
35
37
|
return (0, _styledComponents.css)(["border-left:2px solid ", ";"], borderColor);
|
|
36
38
|
}));
|
|
37
39
|
exports.NotificationCard = NotificationCard;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}).withConfig({
|
|
40
|
+
|
|
41
|
+
var IconColumn = _styledComponents.default.div.withConfig({
|
|
41
42
|
displayName: "components__IconColumn",
|
|
42
43
|
componentId: "ds1zkc-1"
|
|
43
|
-
})(["
|
|
44
|
+
})(["padding-left:", ";", ""], (0, _rem.default)(_spacing.default.base), function (_ref2) {
|
|
45
|
+
var _ref2$right = _ref2.right,
|
|
46
|
+
right = _ref2$right === void 0 ? false : _ref2$right;
|
|
47
|
+
return right && (0, _styledComponents.css)(["padding-right:", ";"], (0, _rem.default)(_spacing.default.base));
|
|
48
|
+
});
|
|
49
|
+
|
|
44
50
|
exports.IconColumn = IconColumn;
|
|
45
51
|
var CloseButton = (0, _styledComponents.default)(_Button.default).withConfig({
|
|
46
52
|
displayName: "components__CloseButton",
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
import { TNotificationProps } from '../../../providers/NotificationsProvider/types';
|
|
3
4
|
declare function Notification(props: TNotificationProps): JSX.Element;
|
|
4
5
|
declare namespace Notification {
|
|
5
|
-
var propTypes:
|
|
6
|
-
var defaultProps:
|
|
7
|
-
actions: undefined;
|
|
8
|
-
children: null;
|
|
9
|
-
icon: undefined;
|
|
10
|
-
};
|
|
6
|
+
var propTypes: PropTypes.ValidationMap<TNotificationProps>;
|
|
7
|
+
var defaultProps: Partial<TNotificationProps>;
|
|
11
8
|
var displayName: string;
|
|
12
9
|
}
|
|
13
10
|
export default Notification;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Notifications/Notification/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Notifications/Notification/index.tsx"],"names":[],"mappings":";AAGA,OAAO,SAA4B,MAAM,YAAY,CAAC;AAMtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAwBpF,iBAAS,YAAY,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAuG5D;kBAvGQ,YAAY;;;;;AA8HrB,eAAe,YAAY,CAAC"}
|
|
@@ -72,6 +72,8 @@ function Notification(props) {
|
|
|
72
72
|
_props$intent = props.intent,
|
|
73
73
|
intent = _props$intent === void 0 ? _constants.intentNames.information : _props$intent,
|
|
74
74
|
onClose = props.onClose,
|
|
75
|
+
onFocus = props.onFocus,
|
|
76
|
+
onHover = props.onHover,
|
|
75
77
|
title = props.title;
|
|
76
78
|
var translate = (0, _useTranslations.default)();
|
|
77
79
|
|
|
@@ -91,13 +93,15 @@ function Notification(props) {
|
|
|
91
93
|
id: id,
|
|
92
94
|
borderColor: accentColor,
|
|
93
95
|
margin: 0,
|
|
94
|
-
padding: 1.5
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}, Icon), _react.default.createElement(_Grid.default.Column, null, _react.default.createElement(_Grid.default.Row, null, _react.default.createElement(_Grid.default.Column, null, _react.default.createElement(_Typography.P, {
|
|
96
|
+
padding: 1.5,
|
|
97
|
+
onFocus: onFocus,
|
|
98
|
+
onMouseOver: onHover
|
|
99
|
+
}, _react.default.createElement(_Grid.default.Row, null, _react.default.createElement(_components.IconColumn, null, Icon), _react.default.createElement(_Grid.default.Column, null, _react.default.createElement(_Grid.default.Row, null, _react.default.createElement(_Grid.default.Column, null, _react.default.createElement(_Typography.P, {
|
|
98
100
|
shade: 0,
|
|
99
101
|
weight: "semibold"
|
|
100
|
-
}, title)), _react.default.createElement(_components.IconColumn,
|
|
102
|
+
}, title)), onClose && _react.default.createElement(_components.IconColumn, {
|
|
103
|
+
right: true
|
|
104
|
+
}, _react.default.createElement(_Tooltip.default, {
|
|
101
105
|
target: // eslint-disable-next-line react/jsx-wrap-multilines
|
|
102
106
|
_react.default.createElement(_components.CloseButton, {
|
|
103
107
|
"aria-label": translate(closeHint, 'notification.closeHint'),
|
|
@@ -120,21 +124,24 @@ function Notification(props) {
|
|
|
120
124
|
key: action.text
|
|
121
125
|
}, _react.default.createElement(_Button.default, _extends({}, (0, _omit.default)(action, ['kind', 'size', 'variant']), actionProps[index])));
|
|
122
126
|
}))))));
|
|
123
|
-
}
|
|
127
|
+
}
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
Notification.propTypes = _objectSpread({}, _schema.default.propTypes, {
|
|
129
|
+
var propTypes = _objectSpread({}, _schema.default.propTypes, {
|
|
127
130
|
actions: _proptypeValidators.actionsValidator,
|
|
128
|
-
children: _propTypes.default.
|
|
131
|
+
children: _propTypes.default.node,
|
|
129
132
|
icon: _propTypes.default.elementType,
|
|
130
133
|
id: _propTypes.default.string.isRequired,
|
|
131
|
-
onClose: _propTypes.default.func
|
|
134
|
+
onClose: _propTypes.default.func
|
|
132
135
|
});
|
|
133
|
-
|
|
136
|
+
|
|
137
|
+
var defaultProps = {
|
|
134
138
|
actions: undefined,
|
|
135
139
|
children: null,
|
|
136
|
-
icon: undefined
|
|
140
|
+
icon: undefined,
|
|
141
|
+
onClose: undefined
|
|
137
142
|
};
|
|
143
|
+
Notification.propTypes = propTypes;
|
|
144
|
+
Notification.defaultProps = defaultProps;
|
|
138
145
|
Notification.displayName = 'Notification';
|
|
139
146
|
var _default = Notification;
|
|
140
147
|
exports.default = _default;
|
|
@@ -6,12 +6,16 @@ var _react2 = require("@testing-library/react");
|
|
|
6
6
|
|
|
7
7
|
var _constants = require("../../../constants");
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _providers = require("../../../providers");
|
|
10
10
|
|
|
11
11
|
var _ = _interopRequireDefault(require("."));
|
|
12
12
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
|
|
15
|
+
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; }
|
|
16
|
+
|
|
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; }
|
|
18
|
+
|
|
15
19
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
20
|
|
|
17
21
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
|
@@ -20,12 +24,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
20
24
|
|
|
21
25
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
26
|
|
|
27
|
+
var wrapper = function wrapper(_ref) {
|
|
28
|
+
var children = _ref.children;
|
|
29
|
+
return _react.default.createElement(_providers.ConfigProvider, null, children);
|
|
30
|
+
};
|
|
31
|
+
|
|
23
32
|
var render = function render(ui, options) {
|
|
24
33
|
return (0, _react2.render)(ui, _objectSpread({}, options, {
|
|
25
|
-
wrapper:
|
|
26
|
-
var children = _ref.children;
|
|
27
|
-
return _react.default.createElement(_ConfigProvider.ConfigProvider, null, children);
|
|
28
|
-
}
|
|
34
|
+
wrapper: wrapper
|
|
29
35
|
}));
|
|
30
36
|
};
|
|
31
37
|
|
|
@@ -60,26 +66,39 @@ describe('Notification', function () {
|
|
|
60
66
|
|
|
61
67
|
expect(queryByText(defaultProps.title)).toBeTruthy();
|
|
62
68
|
});
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
describe('when onClose is NOT provided', function () {
|
|
70
|
+
it('does NOT render a close button in the header of the notification', function () {
|
|
71
|
+
var onClose = defaultProps.onClose,
|
|
72
|
+
testProps = _objectWithoutProperties(defaultProps, ["onClose"]);
|
|
65
73
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
var _render3 = render(_react.default.createElement(_.default, testProps)),
|
|
75
|
+
queryByLabelText = _render3.queryByLabelText;
|
|
76
|
+
|
|
77
|
+
expect(queryByLabelText(/close/i)).not.toBeTruthy();
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
describe('when onClose is provided', function () {
|
|
81
|
+
it('renders a close button in the header of the notification', function () {
|
|
82
|
+
var onClose = jest.fn();
|
|
83
|
+
|
|
84
|
+
var _render4 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
85
|
+
onClose: onClose
|
|
86
|
+
}))),
|
|
87
|
+
queryByLabelText = _render4.queryByLabelText;
|
|
70
88
|
|
|
71
|
-
|
|
72
|
-
|
|
89
|
+
var closeButton = queryByLabelText(/close/i);
|
|
90
|
+
expect(closeButton).toBeTruthy();
|
|
73
91
|
|
|
74
|
-
|
|
92
|
+
_react2.fireEvent.click(closeButton);
|
|
75
93
|
|
|
76
|
-
|
|
94
|
+
expect(onClose).toHaveBeenCalled();
|
|
95
|
+
});
|
|
77
96
|
});
|
|
78
97
|
it('renders the children as the content of the notification', function () {
|
|
79
98
|
var content = 'Test modal content.';
|
|
80
99
|
|
|
81
|
-
var
|
|
82
|
-
queryByText =
|
|
100
|
+
var _render5 = render(_react.default.createElement(_.default, defaultProps, content)),
|
|
101
|
+
queryByText = _render5.queryByText;
|
|
83
102
|
|
|
84
103
|
expect(queryByText(content)).toBeTruthy();
|
|
85
104
|
});
|
|
@@ -94,10 +113,10 @@ describe('Notification', function () {
|
|
|
94
113
|
text: 'secondary'
|
|
95
114
|
}];
|
|
96
115
|
|
|
97
|
-
var
|
|
116
|
+
var _render6 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
98
117
|
actions: actions
|
|
99
118
|
}))),
|
|
100
|
-
queryByText =
|
|
119
|
+
queryByText = _render6.queryByText;
|
|
101
120
|
|
|
102
121
|
var primaryActionButton = queryByText(actions[0].text);
|
|
103
122
|
expect(primaryActionButton).toBeTruthy();
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TNotifications } from '../../../providers/NotificationsProvider/types';
|
|
3
3
|
interface TNotificationsContainerProps {
|
|
4
|
+
scroll?: boolean;
|
|
4
5
|
notifications?: TNotifications;
|
|
5
6
|
marginTop?: number;
|
|
6
7
|
zIndex?: number;
|
|
7
8
|
}
|
|
8
|
-
declare function NotificationsPanel({ marginTop, zIndex, }: TNotificationsContainerProps): JSX.Element;
|
|
9
|
+
declare function NotificationsPanel({ marginTop, zIndex, }: TNotificationsContainerProps): JSX.Element | null;
|
|
9
10
|
export default NotificationsPanel;
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Notifications/NotificationsPanel/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAEL,cAAc,EACf,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Notifications/NotificationsPanel/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAEL,cAAc,EACf,MAAM,gDAAgD,CAAC;AAcxD,UAAU,4BAA4B;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA4ED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,MAAM,GACP,EAAE,4BAA4B,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CA2CnD;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -37,6 +37,8 @@ var _Notification = _interopRequireDefault(require("../Notification"));
|
|
|
37
37
|
|
|
38
38
|
var _useNotifications2 = _interopRequireDefault(require("../useNotifications"));
|
|
39
39
|
|
|
40
|
+
var _constants = require("../constants");
|
|
41
|
+
|
|
40
42
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
41
43
|
|
|
42
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -54,14 +56,30 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
54
56
|
var NotificationsContainer = _styledComponents.default.div.withConfig({
|
|
55
57
|
displayName: "NotificationsPanel__NotificationsContainer",
|
|
56
58
|
componentId: "sc-1u8dp2k-0"
|
|
57
|
-
})(["bottom:", ";margin-top:", ";overflow-y:
|
|
59
|
+
})(["max-height:", ";margin-bottom:", ";margin-top:", ";overflow-y:hidden;padding-bottom:", ";position:fixed;right:", ";top:0;min-width:calc(1.25rem + ", ");z-index:", ";overflow-x:hidden;scrollbar-width:thin;", ";", ";"], function (_ref) {
|
|
58
60
|
var _ref$marginTop = _ref.marginTop,
|
|
59
61
|
marginTop = _ref$marginTop === void 0 ? 0 : _ref$marginTop;
|
|
62
|
+
return "calc(100vh - ".concat((0, _rem.default)(_spacing.default.base * marginTop), ");");
|
|
63
|
+
}, function (_ref2) {
|
|
64
|
+
var _ref2$marginTop = _ref2.marginTop,
|
|
65
|
+
marginTop = _ref2$marginTop === void 0 ? 0 : _ref2$marginTop;
|
|
66
|
+
return (0, _rem.default)(_spacing.default.base * marginTop);
|
|
67
|
+
}, function (_ref3) {
|
|
68
|
+
var _ref3$marginTop = _ref3.marginTop,
|
|
69
|
+
marginTop = _ref3$marginTop === void 0 ? 0 : _ref3$marginTop;
|
|
60
70
|
return (0, _rem.default)(_spacing.default.base * marginTop);
|
|
61
|
-
}, (0, _rem.default)(_spacing.default.base * 0.
|
|
62
|
-
var
|
|
63
|
-
zIndex =
|
|
71
|
+
}, (0, _rem.default)(_spacing.default.base * 0.8), (0, _rem.default)(_spacing.default.base), _constants.NOTIFICATION_CARD_WIDTH, function (_ref4) {
|
|
72
|
+
var _ref4$zIndex = _ref4.zIndex,
|
|
73
|
+
zIndex = _ref4$zIndex === void 0 ? 100 : _ref4$zIndex;
|
|
64
74
|
return zIndex;
|
|
75
|
+
}, function (_ref5) {
|
|
76
|
+
var scroll = _ref5.scroll,
|
|
77
|
+
_ref5$notifications = _ref5.notifications,
|
|
78
|
+
notifications = _ref5$notifications === void 0 ? [] : _ref5$notifications;
|
|
79
|
+
return scroll && notifications.length > 2 ? "overflow-y: auto;" : "overflow-y: hidden;";
|
|
80
|
+
}, function (_ref6) {
|
|
81
|
+
var notifications = _ref6.notifications;
|
|
82
|
+
return (0, _isEmpty.default)(notifications) && "width : 0";
|
|
65
83
|
});
|
|
66
84
|
|
|
67
85
|
var FloatingButton = (0, _styledComponents.default)(_Button.default).attrs({
|
|
@@ -71,41 +89,46 @@ var FloatingButton = (0, _styledComponents.default)(_Button.default).attrs({
|
|
|
71
89
|
componentId: "sc-1u8dp2k-1"
|
|
72
90
|
})(["box-shadow:", ";&:focus,&:focus:not(:active){border-color:", ";", ";}&:hover,&:hover:not(:active){background-color:", ";color:", ";}"], (0, _skyPlane.default)(2), (0, _toColorString.default)(_color.default.interaction.pacificOcean), (0, _focusRingWithColor.default)((0, _toColorString.default)(_color.default.interaction.pacificOcean40)), (0, _toColorString.default)(_color.default.interaction.pacificOcean), (0, _toColorString.default)(_color.default.interaction.pacificOcean.fg));
|
|
73
91
|
|
|
92
|
+
var FloatingButtonColumn = _styledComponents.default.div.withConfig({
|
|
93
|
+
displayName: "NotificationsPanel__FloatingButtonColumn",
|
|
94
|
+
componentId: "sc-1u8dp2k-2"
|
|
95
|
+
})(["display:flex;flex:1;height:24px;justify-content:flex-end;padding-left:", ";padding-right:", ";"], (0, _rem.default)(_spacing.default.base), (0, _rem.default)(_spacing.default.base));
|
|
96
|
+
|
|
74
97
|
var NotificationContainer = _styledComponents.default.div.withConfig({
|
|
75
98
|
displayName: "NotificationsPanel__NotificationContainer",
|
|
76
|
-
componentId: "sc-1u8dp2k-
|
|
99
|
+
componentId: "sc-1u8dp2k-3"
|
|
77
100
|
})(["height:auto;max-height:0;opacity:0;transition:opacity 1s cubic-bezier(0.33,1,0.68,1),max-height 1s cubic-bezier(0.33,1,0.68,1);", ";"], (0, _styledComponentsModifiers.applyStyleModifiers)(_defineProperty({}, _types.NotificationState.DISPLAYING, function () {
|
|
78
101
|
return (0, _styledComponents.css)(["max-height:100vh;opacity:1;"]);
|
|
79
102
|
}), 'renderState'));
|
|
80
103
|
|
|
81
|
-
function NotificationsPanel(
|
|
82
|
-
var marginTop =
|
|
83
|
-
zIndex =
|
|
104
|
+
function NotificationsPanel(_ref7) {
|
|
105
|
+
var marginTop = _ref7.marginTop,
|
|
106
|
+
zIndex = _ref7.zIndex;
|
|
84
107
|
|
|
85
108
|
var _useNotifications = (0, _useNotifications2.default)(),
|
|
86
109
|
dismissAll = _useNotifications.dismissAll,
|
|
110
|
+
isDismissingAll = _useNotifications.isDismissingAll,
|
|
87
111
|
notifications = _useNotifications.notifications;
|
|
88
112
|
|
|
89
113
|
var translate = (0, _useTranslations.default)();
|
|
90
|
-
return _react.default.createElement(NotificationsContainer, {
|
|
114
|
+
return (0, _isEmpty.default)(notifications) ? null : _react.default.createElement(NotificationsContainer, {
|
|
115
|
+
scroll: !isDismissingAll,
|
|
91
116
|
marginTop: marginTop,
|
|
92
|
-
zIndex: zIndex
|
|
117
|
+
zIndex: zIndex,
|
|
118
|
+
notifications: notifications
|
|
93
119
|
}, _react.default.createElement(_Grid.default.Container, null, _react.default.createElement(_Grid.default.Row, {
|
|
94
120
|
alignment: "end"
|
|
95
|
-
}, _react.default.createElement(
|
|
96
|
-
height: "24px",
|
|
97
|
-
span: "0"
|
|
98
|
-
}, notifications.length >= 2 && _react.default.createElement(FloatingButton, {
|
|
121
|
+
}, _react.default.createElement(FloatingButtonColumn, null, !isDismissingAll && notifications.length >= 2 && _react.default.createElement(FloatingButton, {
|
|
99
122
|
onClick: dismissAll,
|
|
100
123
|
size: "small",
|
|
101
124
|
text: translate(undefined, 'notifications.dismissAll')
|
|
102
|
-
})))),
|
|
103
|
-
var
|
|
104
|
-
notificationProps =
|
|
105
|
-
body =
|
|
106
|
-
|
|
107
|
-
notificationID =
|
|
108
|
-
state =
|
|
125
|
+
})))), _react.default.createElement(_Grid.default.Container, null, (notifications || []).map(function (_ref8) {
|
|
126
|
+
var _ref9 = _slicedToArray(_ref8, 3),
|
|
127
|
+
notificationProps = _ref9[0],
|
|
128
|
+
body = _ref9[1],
|
|
129
|
+
_ref9$ = _ref9[2],
|
|
130
|
+
notificationID = _ref9$.notificationID,
|
|
131
|
+
state = _ref9$.state;
|
|
109
132
|
|
|
110
133
|
return _react.default.createElement(_Grid.default.Row, {
|
|
111
134
|
key: notificationID,
|
|
@@ -4,7 +4,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
4
4
|
|
|
5
5
|
var _react2 = require("@testing-library/react");
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _providers = require("../../providers");
|
|
8
8
|
|
|
9
9
|
var _NotificationsPanel = _interopRequireDefault(require("./NotificationsPanel"));
|
|
10
10
|
|
|
@@ -12,6 +12,10 @@ var _Notifier = _interopRequireDefault(require("./Notifier"));
|
|
|
12
12
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
|
|
15
|
+
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; }
|
|
16
|
+
|
|
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; }
|
|
18
|
+
|
|
15
19
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
20
|
|
|
17
21
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -22,12 +26,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
22
26
|
|
|
23
27
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
28
|
|
|
29
|
+
var wrapper = function wrapper(_ref) {
|
|
30
|
+
var children = _ref.children;
|
|
31
|
+
return _react.default.createElement(_providers.ConfigProvider, null, _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_NotificationsPanel.default, null), children));
|
|
32
|
+
};
|
|
33
|
+
|
|
25
34
|
var render = function render(ui, options) {
|
|
26
35
|
return (0, _react2.render)(ui, _objectSpread({}, options, {
|
|
27
|
-
wrapper:
|
|
28
|
-
var children = _ref.children;
|
|
29
|
-
return _react.default.createElement(_ConfigProvider.ConfigProvider, null, _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_NotificationsPanel.default, null), children));
|
|
30
|
-
}
|
|
36
|
+
wrapper: wrapper
|
|
31
37
|
}));
|
|
32
38
|
};
|
|
33
39
|
|
|
@@ -70,7 +76,7 @@ describe('Notifier', function () {
|
|
|
70
76
|
|
|
71
77
|
expect((0, _react2.queryAllByText)(baseElement, defaultProps.title)).toHaveLength(1);
|
|
72
78
|
|
|
73
|
-
_react2.fireEvent.click((0, _react2.
|
|
79
|
+
_react2.fireEvent.click((0, _react2.getByLabelText)(baseElement, /close/gi));
|
|
74
80
|
|
|
75
81
|
_context.next = 7;
|
|
76
82
|
return (0, _react2.wait)(function () {
|
|
@@ -96,18 +102,19 @@ describe('Notifier', function () {
|
|
|
96
102
|
});
|
|
97
103
|
describe('dispatching more than one notification', function () {
|
|
98
104
|
it('renders a dismiss all button in the notifications panel', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
99
|
-
var buttonText, _render2, baseElement, getByText;
|
|
105
|
+
var buttonText, onClose, testProps, _render2, baseElement, getByText;
|
|
100
106
|
|
|
101
107
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
102
108
|
while (1) {
|
|
103
109
|
switch (_context2.prev = _context2.next) {
|
|
104
110
|
case 0:
|
|
105
111
|
buttonText = 'notify';
|
|
112
|
+
onClose = defaultProps.onClose, testProps = _objectWithoutProperties(defaultProps, ["onClose"]);
|
|
106
113
|
_render2 = render(_react.default.createElement(_Notifier.default, null, function (_ref5) {
|
|
107
114
|
var notify = _ref5.notify;
|
|
108
115
|
return _react.default.createElement("button", {
|
|
109
116
|
onClick: function onClick() {
|
|
110
|
-
notify(
|
|
117
|
+
notify(testProps);
|
|
111
118
|
},
|
|
112
119
|
type: "button"
|
|
113
120
|
}, buttonText);
|
|
@@ -125,7 +132,7 @@ describe('Notifier', function () {
|
|
|
125
132
|
|
|
126
133
|
_react2.fireEvent.click((0, _react2.getByText)(baseElement, /dismiss all/gi));
|
|
127
134
|
|
|
128
|
-
_context2.next =
|
|
135
|
+
_context2.next = 12;
|
|
129
136
|
return (0, _react2.wait)(function () {
|
|
130
137
|
return expect((0, _react2.queryAllByText)(baseElement, defaultProps.title)).toHaveLength(0);
|
|
131
138
|
},
|
|
@@ -139,12 +146,74 @@ describe('Notifier', function () {
|
|
|
139
146
|
timeout: 2750
|
|
140
147
|
});
|
|
141
148
|
|
|
142
|
-
case
|
|
149
|
+
case 12:
|
|
143
150
|
case "end":
|
|
144
151
|
return _context2.stop();
|
|
145
152
|
}
|
|
146
153
|
}
|
|
147
154
|
}, _callee2);
|
|
148
155
|
})));
|
|
156
|
+
it('fires onClose for each notification when clicking dismiss all', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
157
|
+
var buttonText, onClose, _render3, baseElement, getByText, notifications;
|
|
158
|
+
|
|
159
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
160
|
+
while (1) {
|
|
161
|
+
switch (_context3.prev = _context3.next) {
|
|
162
|
+
case 0:
|
|
163
|
+
buttonText = 'notify';
|
|
164
|
+
onClose = jest.fn();
|
|
165
|
+
jest.useFakeTimers();
|
|
166
|
+
_render3 = render(_react.default.createElement(_Notifier.default, null, function (_ref7) {
|
|
167
|
+
var notify = _ref7.notify;
|
|
168
|
+
return _react.default.createElement("button", {
|
|
169
|
+
onClick: function onClick() {
|
|
170
|
+
notify(_objectSpread({}, defaultProps, {
|
|
171
|
+
onClose: onClose
|
|
172
|
+
}));
|
|
173
|
+
},
|
|
174
|
+
type: "button"
|
|
175
|
+
}, buttonText);
|
|
176
|
+
})), baseElement = _render3.baseElement, getByText = _render3.getByText;
|
|
177
|
+
(0, _react2.act)(function () {
|
|
178
|
+
_react2.fireEvent.click(getByText(buttonText));
|
|
179
|
+
|
|
180
|
+
_react2.fireEvent.click(getByText(buttonText));
|
|
181
|
+
|
|
182
|
+
_react2.fireEvent.click(getByText(buttonText));
|
|
183
|
+
|
|
184
|
+
jest.runAllTimers();
|
|
185
|
+
});
|
|
186
|
+
notifications = (0, _react2.queryAllByText)(baseElement, defaultProps.title);
|
|
187
|
+
expect(notifications).toHaveLength(3);
|
|
188
|
+
(0, _react2.act)(function () {
|
|
189
|
+
_react2.fireEvent.click((0, _react2.getByText)(baseElement, /dismiss all/gi));
|
|
190
|
+
});
|
|
191
|
+
_context3.next = 10;
|
|
192
|
+
return (0, _react2.wait)(function () {
|
|
193
|
+
(0, _react2.act)(function () {
|
|
194
|
+
return jest.runAllTimers();
|
|
195
|
+
});
|
|
196
|
+
expect((0, _react2.queryAllByText)(baseElement, defaultProps.title)).toHaveLength(0);
|
|
197
|
+
},
|
|
198
|
+
/**
|
|
199
|
+
* this timeout is important in checking that the notifications were dismissed via
|
|
200
|
+
* `dismissAll` instead of just timing out. If just timing out, the notifications would
|
|
201
|
+
* dismiss after 5.2 seconds. Selecting a timeout shorter than that verifies `dismissAll`
|
|
202
|
+
* was fired.
|
|
203
|
+
*/
|
|
204
|
+
{
|
|
205
|
+
timeout: 2750
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
case 10:
|
|
209
|
+
expect(onClose).toHaveBeenCalledTimes(3);
|
|
210
|
+
|
|
211
|
+
case 11:
|
|
212
|
+
case "end":
|
|
213
|
+
return _context3.stop();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}, _callee3);
|
|
217
|
+
})));
|
|
149
218
|
});
|
|
150
219
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uBAAuB,QAAyB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NOTIFICATION_CARD_WIDTH = void 0;
|
|
7
|
+
|
|
8
|
+
var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
|
|
9
|
+
|
|
10
|
+
var _spacing = _interopRequireDefault(require("@decisiv/design-tokens/lib/spacing"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
15
|
+
var NOTIFICATION_CARD_WIDTH = (0, _rem.default)(_spacing.default.base * 34);
|
|
16
|
+
exports.NOTIFICATION_CARD_WIDTH = NOTIFICATION_CARD_WIDTH;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/schema.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,MAAM,KAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/schema.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,MAAM,KAA4C,CAAC;AA0DzD,eAAe,MAAM,CAAC"}
|
|
@@ -18,13 +18,14 @@ schema.propTypes = {
|
|
|
18
18
|
onClick: _reactDesc.PropTypes.func.isRequired,
|
|
19
19
|
text: _reactDesc.PropTypes.string.isRequired
|
|
20
20
|
})).description('An array of objects containing a subset of props valid for the Button. Specifically excluded are `kind`, `size`, and `variant`.').isRequired,
|
|
21
|
+
duration: _reactDesc.PropTypes.number.description('An integer representing the amount of milliseconds to wait until dismissing the notification if no user interaction is captured. If omitted, notification will remain until manually closed.'),
|
|
21
22
|
children: _reactDesc.PropTypes.func.description('The body of the notification containing additional UI elements').format('React Component'),
|
|
22
23
|
closeHint: _reactDesc.PropTypes.string.description('The text to present in the tooltip when hovering over the close button.'),
|
|
23
24
|
color: _reactDesc.PropTypes.oneOf(_commonUIColors.commonUIColorKeys).description('The icon/ border color. Will override the default color associated with any specified `intent`.').format('string'),
|
|
24
25
|
icon: _reactDesc.PropTypes.element.description('The `iconix` icon to display. Will override the default icon associated with any specified `intent`.').format('Iconix Icon'),
|
|
25
26
|
id: _reactDesc.PropTypes.string.description('A unique identifier for the notification.'),
|
|
26
27
|
intent: _reactDesc.PropTypes.oneOf(['information', 'success', 'warning', 'danger']).description('Shortcuts to the most common combinations of icon and color.'),
|
|
27
|
-
onClose: _reactDesc.PropTypes.func.description('The event handler called
|
|
28
|
+
onClose: _reactDesc.PropTypes.func.description('The event handler called when the notification is manually closed. Will also be called with a blank event if "DISMISS ALL" is clicked. WILL NOT be called if notification times out or is closed because an action button is clicked. In IE, will be called with an empty object.'),
|
|
28
29
|
title: _reactDesc.PropTypes.string.description('The text for rendering in the H2 at the top of the notification').isRequired
|
|
29
30
|
};
|
|
30
31
|
var _default = schema;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TNotificationsContext } from '../../providers/NotificationsProvider';
|
|
2
2
|
export interface TUseNotifications {
|
|
3
3
|
dismissAll: TNotificationsContext['dismissAll'];
|
|
4
|
+
isDismissingAll: TNotificationsContext['isDismissingAll'];
|
|
4
5
|
notifications: TNotificationsContext['notifications'];
|
|
5
6
|
notify: TNotificationsContext['notify'];
|
|
6
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/useNotifications.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,qBAAqB,EACtB,MAAM,uCAAuC,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAChD,aAAa,EAAE,qBAAqB,CAAC,eAAe,CAAC,CAAC;IACtD,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;CACzC;AAED,iBAAS,gBAAgB,IAAI,iBAAiB,CAI7C;AAED,eAAe,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/useNotifications.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,qBAAqB,EACtB,MAAM,uCAAuC,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAChD,eAAe,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;IAC1D,aAAa,EAAE,qBAAqB,CAAC,eAAe,CAAC,CAAC;IACtD,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;CACzC;AAED,iBAAS,gBAAgB,IAAI,iBAAiB,CAI7C;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -10,10 +10,10 @@ var _react = require("react");
|
|
|
10
10
|
var _NotificationsProvider = require("../../providers/NotificationsProvider");
|
|
11
11
|
|
|
12
12
|
function useNotifications() {
|
|
13
|
-
var
|
|
13
|
+
var context = (0, _react.useContext)(_NotificationsProvider.NotificationsContext);
|
|
14
14
|
return (0, _react.useMemo)(function () {
|
|
15
|
-
return
|
|
16
|
-
}, [
|
|
15
|
+
return context;
|
|
16
|
+
}, [context]);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
var _default = useNotifications;
|
|
@@ -19,11 +19,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
19
19
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
20
|
|
|
21
21
|
jest.useFakeTimers();
|
|
22
|
+
|
|
23
|
+
var wrapper = function wrapper(_ref) {
|
|
24
|
+
var children = _ref.children;
|
|
25
|
+
return _react.default.createElement(_NotificationsProvider.default, null, _react.default.createElement(_react.default.Fragment, null, children));
|
|
26
|
+
};
|
|
27
|
+
|
|
22
28
|
var defaultRenderHookOptions = {
|
|
23
|
-
wrapper:
|
|
24
|
-
var children = _ref.children;
|
|
25
|
-
return _react.default.createElement(_NotificationsProvider.default, null, _react.default.createElement(_react.default.Fragment, null, children));
|
|
26
|
-
}
|
|
29
|
+
wrapper: wrapper
|
|
27
30
|
};
|
|
28
31
|
var defaultNotificationOptions = {
|
|
29
32
|
id: 'test-0',
|
|
@@ -12,7 +12,7 @@ interface DefaultPaginationProps {
|
|
|
12
12
|
export interface PaginationProps extends DefaultPaginationProps {
|
|
13
13
|
totalPages: number;
|
|
14
14
|
}
|
|
15
|
-
declare function Pagination(props: PaginationProps): JSX.Element;
|
|
15
|
+
declare function Pagination(props: PaginationProps): JSX.Element | null;
|
|
16
16
|
declare namespace Pagination {
|
|
17
17
|
var propTypes: {
|
|
18
18
|
variant: PropTypes.Requireable<string>;
|