@decisiv/ui-components 2.0.1-alpha.12 → 2.0.1-alpha.132
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/elements.d.ts.map +1 -1
- package/lib/atoms/BooleanInput/elements.js +8 -3
- package/lib/atoms/BooleanInput/index.d.ts.map +1 -1
- package/lib/atoms/BooleanInput/index.js +26 -5
- package/lib/atoms/BooleanInput/index.test.js +17 -6
- package/lib/atoms/BooleanInput/types.d.ts +4 -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 +46 -6
- package/lib/atoms/Calendar/index.test.js +68 -38
- package/lib/atoms/Calendar/types.d.ts +1 -1
- package/lib/atoms/Calendar/types.d.ts.map +1 -1
- 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/Alert/Container.d.ts +201 -0
- package/lib/components/Alert/Container.d.ts.map +1 -0
- package/lib/components/Alert/Container.js +26 -0
- package/lib/components/Alert/StyledButton.d.ts +5 -0
- package/lib/components/Alert/StyledButton.d.ts.map +1 -0
- package/lib/components/Alert/StyledButton.js +23 -0
- package/lib/components/Alert/index.d.ts +27 -0
- package/lib/components/Alert/index.d.ts.map +1 -0
- package/lib/components/Alert/index.js +112 -0
- package/lib/components/Alert/index.test.js +79 -0
- package/lib/components/Alert/intents.d.ts +13 -0
- package/lib/components/Alert/intents.d.ts.map +1 -0
- package/lib/components/Alert/intents.js +72 -0
- package/lib/components/Alert/schema.d.ts +3 -0
- package/lib/components/Alert/schema.d.ts.map +1 -0
- package/lib/components/Alert/schema.js +25 -0
- package/lib/components/Alert/types.d.ts +36 -0
- package/lib/components/Alert/types.d.ts.map +1 -0
- package/lib/components/Alert/types.js +32 -0
- 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 +41 -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 +29 -0
- package/lib/components/Filter/index.d.ts.map +1 -0
- package/lib/components/Filter/index.js +105 -0
- package/lib/components/Filter/index.test.js +60 -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 +33 -0
- package/lib/components/Filter/types.d.ts +18 -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/DisabledLink.d.ts +7 -0
- package/lib/components/Link/DisabledLink.d.ts.map +1 -0
- package/lib/components/Link/DisabledLink.js +46 -0
- package/lib/components/Link/Link.d.ts +4 -0
- package/lib/components/Link/Link.d.ts.map +1 -0
- package/lib/components/Link/Link.js +67 -0
- package/lib/components/Link/index.d.ts +4 -23
- package/lib/components/Link/index.d.ts.map +1 -1
- package/lib/components/Link/index.js +20 -158
- package/lib/components/Link/index.test.js +63 -42
- package/lib/components/Link/schema.d.ts.map +1 -1
- package/lib/components/Link/schema.js +2 -1
- package/lib/components/Link/styles.d.ts +20 -0
- package/lib/components/Link/styles.d.ts.map +1 -0
- package/lib/components/Link/styles.js +131 -0
- package/lib/components/Link/types.d.ts +28 -0
- package/lib/components/Link/types.d.ts.map +1 -0
- package/lib/components/Link/types.js +5 -0
- 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.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 +29 -2
- 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 +29 -2
- 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 +180 -39
- 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/index.d.ts +2 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +25 -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 +4 -0
- package/lib/providers/ConfigProvider/utils/translations.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/utils/translations.js +4 -0
- 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
|
@@ -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"}
|
|
@@ -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>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../src/components/Pagination/Pagination.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AAUnC,OAAO,EAAuB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjE,UAAU,sBAAsB;IAC9B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAgB,SAAQ,sBAAsB;IAC7D,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,iBAAwB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../src/components/Pagination/Pagination.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AAUnC,OAAO,EAAuB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjE,UAAU,sBAAsB;IAC9B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAgB,SAAQ,sBAAsB;IAC7D,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,iBAAwB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CA+E7E;kBA/EuB,UAAU;;;;;;;;;;;;eAAV,UAAU"}
|
|
@@ -49,6 +49,7 @@ function Pagination(props) {
|
|
|
49
49
|
currentPage = _useState2[0],
|
|
50
50
|
setCurrentPage = _useState2[1];
|
|
51
51
|
|
|
52
|
+
if (totalPages <= 1) return null;
|
|
52
53
|
var activePageIsControlled = typeof activePage !== 'undefined';
|
|
53
54
|
|
|
54
55
|
if (activePageIsControlled && activePage !== currentPage) {
|
|
@@ -245,4 +245,13 @@ describe('Pagination', function () {
|
|
|
245
245
|
expect(onPageChange).toHaveBeenCalledWith(props.activePage + 1, props.activePage);
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
|
+
it("doesn't display when there is only 1 page", function () {
|
|
249
|
+
var _renderPagination17 = renderPagination(_objectSpread({}, defaultProps, {
|
|
250
|
+
totalPages: 1,
|
|
251
|
+
defaultActivePage: 1
|
|
252
|
+
})),
|
|
253
|
+
container = _renderPagination17.container;
|
|
254
|
+
|
|
255
|
+
expect(container).toBeEmpty();
|
|
256
|
+
});
|
|
248
257
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { PopoverProps, Side, TargetType, VisibilityActions } from './types';
|
|
3
|
-
export declare const getPlacementParts: (placement?: "
|
|
3
|
+
export declare const getPlacementParts: (placement?: "auto" | "bottom" | "left" | "right" | "top" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "auto-start" | "auto-end") => [Side, ("end" | "start" | undefined)?];
|
|
4
4
|
interface UseTargetProps extends PopoverProps {
|
|
5
5
|
actions: VisibilityActions;
|
|
6
6
|
internalNodeRef: RefObject<HTMLElement>;
|
|
@@ -48,7 +48,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
48
48
|
var TargetContainer = _styledComponents.default.div.withConfig({
|
|
49
49
|
displayName: "Target__TargetContainer",
|
|
50
50
|
componentId: "sc-1t0verh-0"
|
|
51
|
-
})(["align-items:center;display:flex;justify-content:space-between;position:relative;top:-
|
|
51
|
+
})(["align-items:center;display:flex;justify-content:space-between;position:relative;top:-2px;width:100%;"]);
|
|
52
52
|
|
|
53
53
|
var TargetButton = (0, _styledComponents.default)(_BaseButton.default).withConfig({
|
|
54
54
|
displayName: "Target__TargetButton",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAGA,OAAc,EAEZ,sBAAsB,EAMvB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAGA,OAAc,EAEZ,sBAAsB,EAMvB,MAAM,OAAO,CAAC;AAoBf,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAyPjD,QAAA,MAAM,aAAa,EAAE,sBAAsB,CACzC,SAAS,EACT,WAAW,CACS,CAAC;AAgCvB,eAAe,aAAa,CAAC"}
|
|
@@ -27,8 +27,12 @@ var _useClickOutside = _interopRequireDefault(require("../../utils/useClickOutsi
|
|
|
27
27
|
|
|
28
28
|
var _useUniqueId = _interopRequireDefault(require("../../utils/useUniqueId"));
|
|
29
29
|
|
|
30
|
+
var _useUpdateEffect = _interopRequireDefault(require("../../utils/useUpdateEffect"));
|
|
31
|
+
|
|
30
32
|
var _DropdownList = _interopRequireDefault(require("../DropdownList"));
|
|
31
33
|
|
|
34
|
+
var _Button = require("../Button");
|
|
35
|
+
|
|
32
36
|
var _Target = _interopRequireDefault(require("./Target"));
|
|
33
37
|
|
|
34
38
|
var _propTypes2 = require("./propTypes");
|
|
@@ -66,7 +70,8 @@ function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d =
|
|
|
66
70
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
67
71
|
|
|
68
72
|
function Select(props, ref) {
|
|
69
|
-
var
|
|
73
|
+
var actions = props.actions,
|
|
74
|
+
clearButtonLabel = props.clearButtonLabel,
|
|
70
75
|
defaultValue = props.defaultValue,
|
|
71
76
|
id = props.id,
|
|
72
77
|
inputContainerRef = props.inputContainerRef,
|
|
@@ -74,8 +79,11 @@ function Select(props, ref) {
|
|
|
74
79
|
name = props.name,
|
|
75
80
|
onChange = props.onChange,
|
|
76
81
|
onClick = props.onClick,
|
|
82
|
+
onHide = props.onHide,
|
|
77
83
|
onKeyDown = props.onKeyDown,
|
|
84
|
+
onShow = props.onShow,
|
|
78
85
|
options = props.options,
|
|
86
|
+
renderOptionLabel = props.renderOptionLabel,
|
|
79
87
|
propValue = props.value,
|
|
80
88
|
zIndex = props.zIndex;
|
|
81
89
|
var fallbackSelectRef = (0, _react.useRef)(null);
|
|
@@ -199,6 +207,19 @@ function Select(props, ref) {
|
|
|
199
207
|
}, [isPopoverVisible]);
|
|
200
208
|
(0, _useClickOutside.default)([listRef], handleClickOutsideList);
|
|
201
209
|
var inputContainerRefs = (0, _compact.default)([inputContainerRef, popoverTargetRef]);
|
|
210
|
+
/**
|
|
211
|
+
* Triggers onShow/onHide callbacks representing wether the Popover is open or not.
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
(0, _useUpdateEffect.default)(function () {
|
|
215
|
+
if (isPopoverVisible) {
|
|
216
|
+
onShow && onShow();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (!isPopoverVisible) {
|
|
220
|
+
onHide && onHide();
|
|
221
|
+
}
|
|
222
|
+
}, [isPopoverVisible, onHide, onShow]);
|
|
202
223
|
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_InputField.default, _extends({}, props, {
|
|
203
224
|
"aria-live": "assertive",
|
|
204
225
|
cursor: "default",
|
|
@@ -235,6 +256,7 @@ function Select(props, ref) {
|
|
|
235
256
|
ref: targetRef,
|
|
236
257
|
type: "button"
|
|
237
258
|
}, value), _react.default.createElement(_DropdownList.default, {
|
|
259
|
+
actions: actions,
|
|
238
260
|
"aria-labelledby": ariaLabelledBy,
|
|
239
261
|
borderRadius: "0",
|
|
240
262
|
id: dropdownListId,
|
|
@@ -246,6 +268,7 @@ function Select(props, ref) {
|
|
|
246
268
|
onChange: handleChangeValue,
|
|
247
269
|
onHide: toggleIsPopoverVisible,
|
|
248
270
|
onShow: toggleIsPopoverVisible,
|
|
271
|
+
renderOptionLabel: renderOptionLabel,
|
|
249
272
|
selectedIds: selectedValue,
|
|
250
273
|
showArrow: false,
|
|
251
274
|
target: popoverTargetRef,
|
|
@@ -258,9 +281,22 @@ function Select(props, ref) {
|
|
|
258
281
|
var SelectWithRef = (0, _react.forwardRef)(Select);
|
|
259
282
|
SelectWithRef.displayName = 'Select';
|
|
260
283
|
SelectWithRef.propTypes = _objectSpread({}, _schema.default.propTypes, {
|
|
284
|
+
actions: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.shape((0, _Button.makeButtonSchemaPropTypes)({
|
|
285
|
+
id: _propTypes.default.string.isRequired
|
|
286
|
+
}))), _propTypes.default.shape({
|
|
287
|
+
left: _propTypes.default.arrayOf(_propTypes.default.shape((0, _Button.makeButtonSchemaPropTypes)({
|
|
288
|
+
id: _propTypes.default.string.isRequired
|
|
289
|
+
}))),
|
|
290
|
+
right: _propTypes.default.arrayOf(_propTypes.default.shape((0, _Button.makeButtonSchemaPropTypes)({
|
|
291
|
+
id: _propTypes.default.string.isRequired
|
|
292
|
+
})))
|
|
293
|
+
})]),
|
|
261
294
|
defaultValue: _propTypes2.valueValidator,
|
|
262
295
|
icon: _propTypes.default.elementType,
|
|
263
296
|
value: _propTypes2.valueValidator
|
|
264
297
|
});
|
|
298
|
+
SelectWithRef.defaultProps = {
|
|
299
|
+
actions: undefined
|
|
300
|
+
};
|
|
265
301
|
var _default = SelectWithRef;
|
|
266
302
|
exports.default = _default;
|
|
@@ -111,16 +111,53 @@ describe('Select', function () {
|
|
|
111
111
|
expect(getByText(defaultProps.label)).toBeTruthy();
|
|
112
112
|
expect((0, _react2.queryByText)(baseElement, opt0.label)).toBeTruthy();
|
|
113
113
|
});
|
|
114
|
+
it('triggers onShow callback', function () {
|
|
115
|
+
var onShow = jest.fn();
|
|
116
|
+
|
|
117
|
+
var _render2 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
118
|
+
onShow: onShow
|
|
119
|
+
}))),
|
|
120
|
+
queryByText = _render2.queryByText;
|
|
121
|
+
|
|
122
|
+
expect(onShow).not.toHaveBeenCalled();
|
|
123
|
+
var label = queryByText(defaultProps.label);
|
|
124
|
+
|
|
125
|
+
_react2.fireEvent.click(label);
|
|
126
|
+
|
|
127
|
+
expect(onShow).toHaveBeenCalled();
|
|
128
|
+
});
|
|
129
|
+
it('triggers onHide callback', function () {
|
|
130
|
+
var onHide = jest.fn();
|
|
131
|
+
|
|
132
|
+
var _render3 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
133
|
+
onHide: onHide
|
|
134
|
+
}))),
|
|
135
|
+
queryByText = _render3.queryByText;
|
|
136
|
+
|
|
137
|
+
expect(onHide).not.toHaveBeenCalled();
|
|
138
|
+
var label = queryByText(defaultProps.label);
|
|
139
|
+
|
|
140
|
+
_react2.fireEvent.click(label);
|
|
141
|
+
|
|
142
|
+
_react2.fireEvent.keyDown(label, {
|
|
143
|
+
key: 'Escape',
|
|
144
|
+
code: 'Escape',
|
|
145
|
+
keyCode: 27,
|
|
146
|
+
charCode: 27
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
expect(onHide).toHaveBeenCalled();
|
|
150
|
+
});
|
|
114
151
|
});
|
|
115
152
|
describe('clicking an option', function () {
|
|
116
153
|
it('calls the onchange handler with the new value', function () {
|
|
117
154
|
var onChange = jest.fn();
|
|
118
155
|
|
|
119
|
-
var
|
|
156
|
+
var _render4 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
120
157
|
onChange: onChange
|
|
121
158
|
}))),
|
|
122
|
-
baseElement =
|
|
123
|
-
getByText =
|
|
159
|
+
baseElement = _render4.baseElement,
|
|
160
|
+
getByText = _render4.getByText;
|
|
124
161
|
|
|
125
162
|
_react2.fireEvent.click(getByText(defaultProps.label));
|
|
126
163
|
|
|
@@ -129,9 +166,9 @@ describe('Select', function () {
|
|
|
129
166
|
expect(onChange).toHaveBeenCalledWith(cat0Opt0.id);
|
|
130
167
|
});
|
|
131
168
|
it('automatically updates the option label inside the input field', function () {
|
|
132
|
-
var
|
|
133
|
-
baseElement =
|
|
134
|
-
getByText =
|
|
169
|
+
var _render5 = render(_react.default.createElement(_.default, defaultProps)),
|
|
170
|
+
baseElement = _render5.baseElement,
|
|
171
|
+
getByText = _render5.getByText;
|
|
135
172
|
|
|
136
173
|
_react2.fireEvent.click(getByText(defaultProps.label));
|
|
137
174
|
|
|
@@ -143,10 +180,10 @@ describe('Select', function () {
|
|
|
143
180
|
});
|
|
144
181
|
describe('with a default value', function () {
|
|
145
182
|
it('displays the option label matching the defaultValue inside the input field', function () {
|
|
146
|
-
var
|
|
183
|
+
var _render6 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
147
184
|
defaultValue: cat0Opt0.id
|
|
148
185
|
}))),
|
|
149
|
-
getByText =
|
|
186
|
+
getByText = _render6.getByText;
|
|
150
187
|
|
|
151
188
|
expect(getByText(cat0Opt0.label)).toBeTruthy();
|
|
152
189
|
});
|
|
@@ -154,12 +191,12 @@ describe('Select', function () {
|
|
|
154
191
|
it('calls the onchange handler with the new value', function () {
|
|
155
192
|
var onChange = jest.fn();
|
|
156
193
|
|
|
157
|
-
var
|
|
194
|
+
var _render7 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
158
195
|
onChange: onChange,
|
|
159
196
|
defaultValue: opt1.id
|
|
160
197
|
}))),
|
|
161
|
-
baseElement =
|
|
162
|
-
getByText =
|
|
198
|
+
baseElement = _render7.baseElement,
|
|
199
|
+
getByText = _render7.getByText;
|
|
163
200
|
|
|
164
201
|
_react2.fireEvent.click(getByText(defaultProps.label));
|
|
165
202
|
|
|
@@ -168,11 +205,11 @@ describe('Select', function () {
|
|
|
168
205
|
expect(onChange).toHaveBeenCalledWith(cat0Opt0.id);
|
|
169
206
|
});
|
|
170
207
|
it('automatically updates the option label inside the input field', function () {
|
|
171
|
-
var
|
|
208
|
+
var _render8 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
172
209
|
defaultValue: opt1.id
|
|
173
210
|
}))),
|
|
174
|
-
baseElement =
|
|
175
|
-
getByText =
|
|
211
|
+
baseElement = _render8.baseElement,
|
|
212
|
+
getByText = _render8.getByText;
|
|
176
213
|
|
|
177
214
|
_react2.fireEvent.click(getByText(defaultProps.label));
|
|
178
215
|
|
|
@@ -183,12 +220,34 @@ describe('Select', function () {
|
|
|
183
220
|
});
|
|
184
221
|
});
|
|
185
222
|
});
|
|
223
|
+
describe('when label hidden', function () {
|
|
224
|
+
it('does not display the label element', function () {
|
|
225
|
+
var _render9 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
226
|
+
defaultvalue: opt1.id,
|
|
227
|
+
hideLabel: true
|
|
228
|
+
}))),
|
|
229
|
+
getByText = _render9.getByText;
|
|
230
|
+
|
|
231
|
+
expect(getByText(defaultProps.label, {
|
|
232
|
+
selector: 'span'
|
|
233
|
+
})).not.toBeVisible();
|
|
234
|
+
});
|
|
235
|
+
it('does display the input related to the label', function () {
|
|
236
|
+
var _render10 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
237
|
+
defaultValue: opt1.id,
|
|
238
|
+
hideLabel: true
|
|
239
|
+
}))),
|
|
240
|
+
getByLabelText = _render10.getByLabelText;
|
|
241
|
+
|
|
242
|
+
expect(getByLabelText(defaultProps.label)).toBeVisible();
|
|
243
|
+
});
|
|
244
|
+
});
|
|
186
245
|
describe('when component is controlled', function () {
|
|
187
246
|
it('displays the option label matching the value inside the input field', function () {
|
|
188
|
-
var
|
|
247
|
+
var _render11 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
189
248
|
value: cat0Opt0.id
|
|
190
249
|
}))),
|
|
191
|
-
getByText =
|
|
250
|
+
getByText = _render11.getByText;
|
|
192
251
|
|
|
193
252
|
expect(getByText(cat0Opt0.label)).toBeTruthy();
|
|
194
253
|
});
|
|
@@ -196,12 +255,12 @@ describe('Select', function () {
|
|
|
196
255
|
it('calls the onchange handler with the new value', function () {
|
|
197
256
|
var onChange = jest.fn();
|
|
198
257
|
|
|
199
|
-
var
|
|
258
|
+
var _render12 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
200
259
|
onChange: onChange,
|
|
201
260
|
value: opt1.id
|
|
202
261
|
}))),
|
|
203
|
-
baseElement =
|
|
204
|
-
getByText =
|
|
262
|
+
baseElement = _render12.baseElement,
|
|
263
|
+
getByText = _render12.getByText;
|
|
205
264
|
|
|
206
265
|
_react2.fireEvent.click(getByText(defaultProps.label));
|
|
207
266
|
|
|
@@ -210,12 +269,12 @@ describe('Select', function () {
|
|
|
210
269
|
expect(onChange).toHaveBeenCalledWith(cat0Opt0.id);
|
|
211
270
|
});
|
|
212
271
|
it('does NOT automatically update the option label inside the input field', function () {
|
|
213
|
-
var
|
|
272
|
+
var _render13 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
214
273
|
value: opt1.id
|
|
215
274
|
}))),
|
|
216
|
-
baseElement =
|
|
217
|
-
getByText =
|
|
218
|
-
queryByText =
|
|
275
|
+
baseElement = _render13.baseElement,
|
|
276
|
+
getByText = _render13.getByText,
|
|
277
|
+
queryByText = _render13.queryByText;
|
|
219
278
|
|
|
220
279
|
_react2.fireEvent.click(getByText(defaultProps.label));
|
|
221
280
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Select/schema.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,MAAM,KAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Select/schema.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,MAAM,KAAsC,CAAC;AA8DnD,eAAe,MAAM,CAAC"}
|
|
@@ -25,7 +25,13 @@ var schema = (0, _reactDesc.describe)({
|
|
|
25
25
|
schema.propTypes = _objectSpread({}, (0, _omit.default)(_InputField.schema.makePropTypes(), ['children', 'maxLength', 'onChange', 'showCharacterCount']), {
|
|
26
26
|
clearButtonLabel: _reactDesc.PropTypes.string.description("A hidden label value for the clear button. The select component's label is available within the string for clarity.").defaultValue('Clear {label} value'),
|
|
27
27
|
defaultValue: _reactDesc.PropTypes.string.description('The ID of the option that should be selected by default.'),
|
|
28
|
+
actions: _reactDesc.PropTypes.oneOfType([_reactDesc.PropTypes.arrayOf(_reactDesc.PropTypes.object), _reactDesc.PropTypes.shape({
|
|
29
|
+
left: _reactDesc.PropTypes.arrayOf(_reactDesc.PropTypes.object),
|
|
30
|
+
right: _reactDesc.PropTypes.arrayOf(_reactDesc.PropTypes.object)
|
|
31
|
+
})]).description('A collection of objects, each containing a subset of props valid for a Button component. Check the notes on the OptionsList.'),
|
|
28
32
|
onChange: _reactDesc.PropTypes.func.description(''),
|
|
33
|
+
onHide: _reactDesc.PropTypes.func.description('A callback which is triggered when the popover is closed'),
|
|
34
|
+
onShow: _reactDesc.PropTypes.func.description('A callback which is triggered when the popover is opened'),
|
|
29
35
|
options: _reactDesc.PropTypes.arrayOf(_reactDesc.PropTypes.shape({
|
|
30
36
|
decoration: _reactDesc.PropTypes.shape({
|
|
31
37
|
type: _reactDesc.PropTypes.oneOf(['Avatar', 'Badge'])
|
|
@@ -35,6 +41,7 @@ schema.propTypes = _objectSpread({}, (0, _omit.default)(_InputField.schema.makeP
|
|
|
35
41
|
label: _reactDesc.PropTypes.string.description('The label text for an option in the dropdown list.'),
|
|
36
42
|
value: _reactDesc.PropTypes.string.description('The value for an option in the dropdown list.')
|
|
37
43
|
})).description('The array of data for the options that will be rendered').isRequired,
|
|
44
|
+
renderOptionLabel: _reactDesc.PropTypes.func.description('Function to customize render of option labels, called with the item value'),
|
|
38
45
|
value: _reactDesc.PropTypes.string.description('The ID of the option that is selected. If provided, controlling the Select must be handled externally. Overrides `defaultValue`.'),
|
|
39
46
|
zIndex: _reactDesc.PropTypes.number.description('Sets the z-index style property of the options list')
|
|
40
47
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes, FocusEventHandler, KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
2
2
|
import { BaseInputFieldProps, InputComponentProps } from '../../atoms/InputField';
|
|
3
|
+
import { OptionsListProps } from '../../atoms/OptionsList/types';
|
|
3
4
|
import { Items } from '../DropdownList';
|
|
4
5
|
import { PopoverProps } from '../Popover/types';
|
|
5
6
|
export declare type SelectRef = HTMLButtonElement;
|
|
6
|
-
interface BaseSelectProps extends ButtonHTMLAttributes<SelectRef>, Omit<BaseInputFieldProps, 'children' | 'maxLength' | 'onChange' | 'showCharacterCount' | 'value'> {
|
|
7
|
+
interface BaseSelectProps extends ButtonHTMLAttributes<SelectRef>, Omit<BaseInputFieldProps, 'children' | 'maxLength' | 'onChange' | 'showCharacterCount' | 'value'>, Pick<OptionsListProps, 'actions' | 'renderOptionLabel'> {
|
|
7
8
|
onBlur?: FocusEventHandler;
|
|
8
9
|
onClick?: MouseEventHandler;
|
|
9
10
|
onFocus?: FocusEventHandler;
|
|
@@ -14,6 +15,8 @@ export declare type SelectProps = BaseSelectProps & {
|
|
|
14
15
|
defaultValue?: string;
|
|
15
16
|
name: string;
|
|
16
17
|
onChange?: (value: string) => void;
|
|
18
|
+
onHide?: () => void;
|
|
19
|
+
onShow?: () => void;
|
|
17
20
|
options: Items;
|
|
18
21
|
value?: string;
|
|
19
22
|
zIndex?: PopoverProps['zIndex'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Select/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,oBAAY,SAAS,GAAG,iBAAiB,CAAC;AAE1C,UAAU,eACR,SAAQ,oBAAoB,CAAC,SAAS,CAAC,EACrC,IAAI,CACF,mBAAmB,EACnB,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,oBAAoB,GAAG,OAAO,CACvE;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Select/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,oBAAY,SAAS,GAAG,iBAAiB,CAAC;AAE1C,UAAU,eACR,SAAQ,oBAAoB,CAAC,SAAS,CAAC,EACrC,IAAI,CACF,mBAAmB,EACnB,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,oBAAoB,GAAG,OAAO,CACvE,EACD,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,mBAAmB,CAAC;IACzD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAClC;AAED,oBAAY,WAAW,GAAG,eAAe,GAAG;IAC1C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,oBAAoB,CAAC,SAAS,CAAC,EACrC,IAAI,CACF,mBAAmB,EACnB,UAAU,GAAG,IAAI,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,OAAO,CACxE;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC3C,OAAO,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;CACzC"}
|