linear-react-components-ui 1.0.10-beta.4 → 1.0.10-beta.6
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/demo/06c001f4d19c06397d470bb43ff3fe49.png +0 -0
- package/demo/270084ef02ed3bddc3f735fd91ee3cae.png +0 -0
- package/demo/882f8e819d18f5f2dc08d23ebd28a7d5.png +0 -0
- package/demo/bundle.js +2 -0
- package/demo/bundle.js.LICENSE.txt +65 -0
- package/demo/cbc3b4bd6342c551db7afafe26dc458c.jpg +0 -0
- package/demo/edc9476523b940deab91951066981a31.png +0 -0
- package/demo/fb44e7c36db6d95bb85a745d4f060fb2.png +0 -0
- package/demo/fonts/Roboto-Black.woff +0 -0
- package/demo/fonts/Roboto-Black.woff2 +0 -0
- package/demo/fonts/Roboto-Bold.woff +0 -0
- package/demo/fonts/Roboto-Bold.woff2 +0 -0
- package/demo/fonts/Roboto-Light.woff +0 -0
- package/demo/fonts/Roboto-Light.woff2 +0 -0
- package/demo/fonts/Roboto-Medium.woff +0 -0
- package/demo/fonts/Roboto-Medium.woff2 +0 -0
- package/demo/fonts/Roboto-Regular.woff +0 -0
- package/demo/fonts/Roboto-Regular.woff2 +0 -0
- package/demo/fonts/Roboto-Thin.woff +0 -0
- package/demo/fonts/Roboto-Thin.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Black.woff +0 -0
- package/demo/fonts/TitilliumWeb-Black.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Bold.woff +0 -0
- package/demo/fonts/TitilliumWeb-Bold.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-ExtraLight.woff +0 -0
- package/demo/fonts/TitilliumWeb-ExtraLight.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Light.woff +0 -0
- package/demo/fonts/TitilliumWeb-Light.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Regular.woff +0 -0
- package/demo/fonts/TitilliumWeb-Regular.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-SemiBold.woff +0 -0
- package/demo/fonts/TitilliumWeb-SemiBold.woff2 +0 -0
- package/demo/index.html +1 -0
- package/lib/@types/Align.d.ts +2 -2
- package/lib/@types/ButtonTypes.d.ts +1 -1
- package/lib/@types/ColorStyles.d.ts +1 -1
- package/lib/@types/DataCombo.d.ts +1 -1
- package/lib/@types/Icon.d.ts +1 -1
- package/lib/@types/LabelStyles.d.ts +1 -1
- package/lib/@types/Period.d.ts +1 -1
- package/lib/@types/PermissionAttr.d.ts +2 -2
- package/lib/@types/PointerEvents.d.ts +1 -1
- package/lib/@types/Position.d.ts +1 -1
- package/lib/@types/PositionAlert.d.ts +1 -1
- package/lib/@types/Size.d.ts +1 -1
- package/lib/@types/SizePixels.d.ts +1 -1
- package/lib/alerts/AlertContainer.js +21 -5
- package/lib/alerts/AlertProvider.js +45 -15
- package/lib/alerts/BaseAlert.js +20 -4
- package/lib/alerts/Message.js +32 -21
- package/lib/alerts/helpers.js +2 -0
- package/lib/alerts/index.d.ts +1 -4
- package/lib/alerts/index.js +4 -0
- package/lib/alerts/types.d.ts +4 -4
- package/lib/alerts/withAlert.js +12 -1
- package/lib/assets/styles/table.scss +30 -0
- package/lib/avatar/index.js +35 -20
- package/lib/badge/index.js +14 -9
- package/lib/buttons/ActivateButton.js +6 -0
- package/lib/buttons/AddButton.js +7 -0
- package/lib/buttons/Button.js +15 -2
- package/lib/buttons/ButtonGroups.js +4 -0
- package/lib/buttons/CancelButton.js +11 -1
- package/lib/buttons/DangerButton.js +11 -1
- package/lib/buttons/DefaultButton.js +81 -45
- package/lib/buttons/DestroyButton.js +12 -1
- package/lib/buttons/EditButton.js +6 -0
- package/lib/buttons/InactivateButton.js +6 -0
- package/lib/buttons/InfoButton.js +11 -1
- package/lib/buttons/PrimaryButton.js +11 -1
- package/lib/buttons/RestoreButton.js +6 -0
- package/lib/buttons/SaveButton.js +11 -1
- package/lib/buttons/SuccessButton.js +11 -1
- package/lib/buttons/WarningButton.js +11 -1
- package/lib/buttons/button_container/index.js +11 -5
- package/lib/buttons/index.d.ts +1 -4
- package/lib/buttons/index.js +18 -0
- package/lib/buttons/split_button/index.js +17 -11
- package/lib/calendar/DangerCalendar.js +11 -1
- package/lib/calendar/InfoCalendar.js +11 -1
- package/lib/calendar/PrimaryCalendar.js +11 -1
- package/lib/calendar/SuccessCalendar.js +11 -1
- package/lib/calendar/WarningCalendar.js +11 -1
- package/lib/calendar/base/Day.js +13 -2
- package/lib/calendar/base/Month.js +18 -1
- package/lib/calendar/base/Week.js +18 -2
- package/lib/calendar/base/helpers.js +24 -8
- package/lib/calendar/base/index.js +37 -13
- package/lib/calendar/index.d.ts +1 -4
- package/lib/calendar/index.js +8 -0
- package/lib/checkbox/Label.js +7 -1
- package/lib/checkbox/index.js +54 -28
- package/lib/checkbox/types.d.ts +2 -2
- package/lib/dialog/Alert.js +8 -0
- package/lib/dialog/Custom.js +17 -5
- package/lib/dialog/Error.js +8 -0
- package/lib/dialog/Information.js +8 -0
- package/lib/dialog/Question.js +15 -4
- package/lib/dialog/Warning.js +8 -0
- package/lib/dialog/base/Content.js +6 -1
- package/lib/dialog/base/Footer.js +4 -0
- package/lib/dialog/base/Header.js +13 -5
- package/lib/dialog/base/index.js +28 -7
- package/lib/dialog/base/style.js +2 -0
- package/lib/dialog/form/index.js +29 -9
- package/lib/dialog/index.d.ts +1 -4
- package/lib/dialog/index.js +9 -0
- package/lib/drawer/Content.js +13 -2
- package/lib/drawer/Drawer.js +58 -22
- package/lib/drawer/Header.js +27 -10
- package/lib/drawer/helpers.js +4 -0
- package/lib/drawer/index.js +8 -0
- package/lib/dropdown/Popup.js +32 -19
- package/lib/dropdown/helper.js +4 -0
- package/lib/dropdown/withDropdown.js +47 -18
- package/lib/fieldset/index.js +46 -21
- package/lib/form/Field.js +45 -18
- package/lib/form/FieldArray.js +32 -15
- package/lib/form/FieldNumber.js +20 -6
- package/lib/form/FieldPeriod.js +21 -9
- package/lib/form/helpers.js +30 -5
- package/lib/form/index.d.ts +2 -1
- package/lib/form/index.js +101 -37
- package/lib/form/types.d.ts +7 -6
- package/lib/form/withFieldHOC.js +34 -15
- package/lib/form/withFormSecurity.js +30 -6
- package/lib/gridlayout/GridCol.js +11 -5
- package/lib/gridlayout/GridRow.js +9 -3
- package/lib/gridlayout/index.d.ts +1 -4
- package/lib/gridlayout/index.js +4 -0
- package/lib/hint/index.js +11 -6
- package/lib/icons/index.js +26 -16
- package/lib/icons/types.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +10 -0
- package/lib/inputs/base/InputTextBase.js +82 -51
- package/lib/inputs/base/helpers.js +19 -6
- package/lib/inputs/color/index.js +38 -11
- package/lib/inputs/date/Dialog.js +7 -2
- package/lib/inputs/date/Dropdown.js +8 -1
- package/lib/inputs/date/helpers.js +11 -2
- package/lib/inputs/date/index.js +101 -48
- package/lib/inputs/file/DefaultFile.js +42 -13
- package/lib/inputs/file/DragDropFile.js +90 -37
- package/lib/inputs/file/File.js +25 -4
- package/lib/inputs/file/FileButtonSettings.js +11 -5
- package/lib/inputs/file/helpers.js +5 -0
- package/lib/inputs/file/index.d.ts +1 -4
- package/lib/inputs/file/index.js +6 -0
- package/lib/inputs/file/types.d.ts +1 -1
- package/lib/inputs/inputHOC.js +34 -10
- package/lib/inputs/mask/BaseMask.js +17 -1
- package/lib/inputs/mask/Cnpj.js +37 -12
- package/lib/inputs/mask/Cpf.js +33 -10
- package/lib/inputs/mask/Phone.js +6 -0
- package/lib/inputs/mask/ZipCode.js +6 -0
- package/lib/inputs/mask/helpers.js +20 -8
- package/lib/inputs/mask/imaskHOC.js +83 -52
- package/lib/inputs/mask/index.d.ts +1 -4
- package/lib/inputs/mask/index.js +7 -0
- package/lib/inputs/multiSelect/ActionButtons.d.ts +1 -1
- package/lib/inputs/multiSelect/ActionButtons.js +16 -4
- package/lib/inputs/multiSelect/Dropdown.js +46 -23
- package/lib/inputs/multiSelect/helper.d.ts +8 -6
- package/lib/inputs/multiSelect/helper.js +11 -3
- package/lib/inputs/multiSelect/index.js +108 -41
- package/lib/inputs/multiSelect/types.d.ts +11 -3
- package/lib/inputs/number/BaseNumber.js +16 -3
- package/lib/inputs/number/Currency.js +7 -1
- package/lib/inputs/number/Decimal.js +5 -0
- package/lib/inputs/number/format_number.js +7 -0
- package/lib/inputs/number/index.js +13 -3
- package/lib/inputs/period/Dialog.js +7 -2
- package/lib/inputs/period/Dropdown.js +7 -0
- package/lib/inputs/period/PeriodList.js +7 -1
- package/lib/inputs/period/helper.js +12 -2
- package/lib/inputs/period/index.js +120 -49
- package/lib/inputs/period/types.d.ts +3 -3
- package/lib/inputs/search/index.js +63 -18
- package/lib/inputs/select/ActionButtons.js +12 -4
- package/lib/inputs/select/Dropdown.js +49 -29
- package/lib/inputs/select/helper.d.ts +4 -9
- package/lib/inputs/select/helper.js +41 -11
- package/lib/inputs/select/index.js +24 -8
- package/lib/inputs/select/multiple/Selecteds.js +8 -4
- package/lib/inputs/select/multiple/index.js +109 -47
- package/lib/inputs/select/simple/index.js +123 -57
- package/lib/inputs/select/types.d.ts +22 -8
- package/lib/inputs/text/index.js +5 -1
- package/lib/inputs/text/types.d.ts +1 -1
- package/lib/inputs/textarea/index.js +10 -4
- package/lib/inputs/types.d.ts +2 -1
- package/lib/internals/withTooltip.js +70 -25
- package/lib/labelMessages/index.js +45 -25
- package/lib/labels/DangerLabel.js +11 -1
- package/lib/labels/DefaultLabel.js +41 -19
- package/lib/labels/InfoLabel.js +11 -1
- package/lib/labels/PrimaryLabel.js +11 -1
- package/lib/labels/SuccessLabel.js +11 -1
- package/lib/labels/WarningLabel.js +11 -1
- package/lib/labels/index.d.ts +1 -4
- package/lib/labels/index.js +10 -0
- package/lib/labels/label_container/index.js +7 -3
- package/lib/list/Header.js +7 -3
- package/lib/list/Item.js +68 -33
- package/lib/list/Separator.js +4 -0
- package/lib/list/helpers.js +4 -0
- package/lib/list/index.js +60 -25
- package/lib/list/types.d.ts +1 -1
- package/lib/menus/float/MenuItem.js +26 -9
- package/lib/menus/float/SubMenuContainer.js +17 -5
- package/lib/menus/float/helpers.js +4 -0
- package/lib/menus/float/index.js +21 -8
- package/lib/menus/index.d.ts +1 -4
- package/lib/menus/index.js +3 -0
- package/lib/menus/sidenav/ExpandMenu.js +7 -2
- package/lib/menus/sidenav/MenuLink.js +12 -3
- package/lib/menus/sidenav/NavMenuGroup.js +12 -3
- package/lib/menus/sidenav/NavMenuItem.js +56 -27
- package/lib/menus/sidenav/NavSubMenuItem.js +27 -8
- package/lib/menus/sidenav/helpers.js +9 -0
- package/lib/menus/sidenav/index.js +75 -26
- package/lib/menus/sidenav/popup_menu_search/EmptyList.js +7 -2
- package/lib/menus/sidenav/popup_menu_search/index.js +45 -15
- package/lib/menus/sidenav/types.d.ts +1 -1
- package/lib/noPermission/index.js +6 -0
- package/lib/panel/Content.d.ts +1 -1
- package/lib/panel/Content.js +22 -7
- package/lib/panel/DangerPanel.d.ts +1 -1
- package/lib/panel/DangerPanel.js +7 -0
- package/lib/panel/Default.d.ts +1 -1
- package/lib/panel/Default.js +44 -20
- package/lib/panel/Header.d.ts +1 -1
- package/lib/panel/Header.js +27 -12
- package/lib/panel/InfoPanel.d.ts +1 -1
- package/lib/panel/InfoPanel.js +7 -0
- package/lib/panel/PrimaryPanel.d.ts +1 -1
- package/lib/panel/PrimaryPanel.js +7 -0
- package/lib/panel/SuccessPanel.d.ts +1 -1
- package/lib/panel/SuccessPanel.js +7 -0
- package/lib/panel/ToolBar.d.ts +1 -1
- package/lib/panel/ToolBar.js +5 -0
- package/lib/panel/WarningPanel.d.ts +1 -1
- package/lib/panel/WarningPanel.js +7 -0
- package/lib/panel/helpers.d.ts +1 -1
- package/lib/panel/helpers.js +10 -2
- package/lib/panel/index.d.ts +2 -5
- package/lib/panel/index.js +11 -0
- package/lib/panel/types.d.ts +1 -1
- package/lib/permissionValidations.js +15 -3
- package/lib/popover/PopoverText.js +4 -0
- package/lib/popover/PopoverTitle.js +4 -0
- package/lib/popover/index.js +23 -12
- package/lib/progress/Bar.js +33 -20
- package/lib/progress/index.js +14 -5
- package/lib/radio/index.js +46 -23
- package/lib/skeleton/SkeletonContainer.js +9 -3
- package/lib/skeleton/index.js +22 -10
- package/lib/spinner/SpinnerLoading.js +7 -3
- package/lib/spinner/index.js +40 -18
- package/lib/split/Split.js +83 -32
- package/lib/split/SplitSide.js +18 -6
- package/lib/split/helpers.d.ts +1 -1
- package/lib/split/helpers.js +4 -0
- package/lib/split/index.d.ts +1 -4
- package/lib/split/index.js +5 -0
- package/lib/table/Body.js +29 -15
- package/lib/table/Header.js +26 -5
- package/lib/table/HeaderColumn.js +21 -10
- package/lib/table/Row.js +47 -20
- package/lib/table/RowColumn.js +29 -12
- package/lib/table/helpers.js +7 -0
- package/lib/table/index.js +62 -32
- package/lib/table/types.d.ts +6 -1
- package/lib/tabs/DropdownItems.js +21 -12
- package/lib/tabs/Menu.js +15 -5
- package/lib/tabs/MenuItems.js +33 -23
- package/lib/tabs/Panel.js +39 -14
- package/lib/tabs/index.js +113 -46
- package/lib/tabs/tabHelpers.js +16 -3
- package/lib/toolbar/ButtonBar.js +29 -13
- package/lib/toolbar/LabelBar.js +28 -11
- package/lib/toolbar/Separator.js +4 -0
- package/lib/toolbar/ToolBarGroup.js +6 -2
- package/lib/toolbar/helpers.js +2 -0
- package/lib/toolbar/index.js +23 -7
- package/lib/tooltip/index.js +25 -10
- package/lib/tooltip/types.d.ts +1 -1
- package/lib/treetable/Body.js +27 -9
- package/lib/treetable/Header.js +11 -1
- package/lib/treetable/Row.js +113 -58
- package/lib/treetable/helpers.js +10 -0
- package/lib/treetable/index.js +11 -0
- package/lib/treeview/Header.js +6 -2
- package/lib/treeview/Node.js +111 -47
- package/lib/treeview/constants.js +4 -0
- package/lib/treeview/index.js +134 -54
- package/lib/treeview/types.d.ts +2 -2
- package/lib/treeview_old/Header.js +6 -1
- package/lib/treeview_old/Node.js +32 -5
- package/lib/treeview_old/index.js +9 -1
- package/lib/{types-90c43ae1.d.ts → types-3c6f1c20.d.ts} +1 -1
- package/lib/uitour/index.js +73 -33
- package/lib/uitour/types.d.ts +1 -1
- package/package.json +1 -1
package/lib/drawer/Drawer.js
CHANGED
|
@@ -1,58 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
|
+
|
|
10
14
|
var _helpers = _interopRequireDefault(require("./helpers"));
|
|
15
|
+
|
|
11
16
|
var _permissionValidations = require("../permissionValidations");
|
|
17
|
+
|
|
12
18
|
var _ = require(".");
|
|
19
|
+
|
|
13
20
|
var _excluded = ["position", "customClass", "children", "style", "customClassForContent", "targetId", "closeOnEsc", "overlay", "permissionAttr", "skeletonize", "handlerClose", "customClassForDrawer", "content", "title"];
|
|
21
|
+
|
|
14
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
15
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
16
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
|
|
17
28
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
+
|
|
18
30
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
+
|
|
19
32
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20
|
-
|
|
21
|
-
function
|
|
33
|
+
|
|
34
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
35
|
+
|
|
36
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
37
|
+
|
|
22
38
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
+
|
|
23
40
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
41
|
+
|
|
24
42
|
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; }
|
|
43
|
+
|
|
25
44
|
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; }
|
|
45
|
+
|
|
26
46
|
var BaseDrawer = function BaseDrawer(_ref) {
|
|
27
47
|
var _ref$position = _ref.position,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
position = _ref$position === void 0 ? 'left' : _ref$position,
|
|
49
|
+
_ref$customClass = _ref.customClass,
|
|
50
|
+
customClass = _ref$customClass === void 0 ? '' : _ref$customClass,
|
|
51
|
+
children = _ref.children,
|
|
52
|
+
style = _ref.style,
|
|
53
|
+
_ref$customClassForCo = _ref.customClassForContent,
|
|
54
|
+
customClassForContent = _ref$customClassForCo === void 0 ? '' : _ref$customClassForCo,
|
|
55
|
+
targetId = _ref.targetId,
|
|
56
|
+
closeOnEsc = _ref.closeOnEsc,
|
|
57
|
+
overlay = _ref.overlay,
|
|
58
|
+
permissionAttr = _ref.permissionAttr,
|
|
59
|
+
skeletonize = _ref.skeletonize,
|
|
60
|
+
handlerClose = _ref.handlerClose,
|
|
61
|
+
_ref$customClassForDr = _ref.customClassForDrawer,
|
|
62
|
+
customClassForDrawer = _ref$customClassForDr === void 0 ? '' : _ref$customClassForDr,
|
|
63
|
+
content = _ref.content,
|
|
64
|
+
title = _ref.title,
|
|
65
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
66
|
+
|
|
46
67
|
var headerProps = _extends({}, rest, {
|
|
47
68
|
title: title
|
|
48
69
|
});
|
|
70
|
+
|
|
49
71
|
var drawerContainerEl = (0, _react.useRef)(document.createElement('div'));
|
|
50
72
|
drawerContainerEl.current.className = 'drawercontainer';
|
|
51
73
|
var drawerComponentEl = (0, _react.useRef)();
|
|
52
74
|
var hideContent = _permissionValidations.OPTIONS_ON_DENIED.hideContent;
|
|
75
|
+
|
|
53
76
|
var _useState = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)([hideContent], permissionAttr)),
|
|
54
|
-
|
|
55
|
-
|
|
77
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
78
|
+
onDenied = _useState2[0];
|
|
79
|
+
|
|
56
80
|
var setDrawerComponent = function setDrawerComponent(body, randonId) {
|
|
57
81
|
var componentEl = document.createElement('div');
|
|
58
82
|
componentEl.className = 'drawer-component';
|
|
@@ -61,36 +85,44 @@ var BaseDrawer = function BaseDrawer(_ref) {
|
|
|
61
85
|
componentEl.appendChild(drawerContainerEl.current);
|
|
62
86
|
drawerComponentEl.current = componentEl;
|
|
63
87
|
};
|
|
88
|
+
|
|
64
89
|
var setDrawerOverlay = function setDrawerOverlay(body) {
|
|
65
90
|
var drawerOverlay = document.createElement('div');
|
|
66
91
|
drawerOverlay.className = 'drawer-overlay';
|
|
67
92
|
drawerOverlay.dataset.testid = 'drawer-overlay';
|
|
68
93
|
body.appendChild(drawerOverlay);
|
|
69
94
|
};
|
|
95
|
+
|
|
70
96
|
var closeDrawerOnEsc = function closeDrawerOnEsc(e) {
|
|
71
97
|
if (closeOnEsc && (e.keyCode === 27 || e.key === 'ESC')) {
|
|
72
98
|
handlerClose === null || handlerClose === void 0 ? void 0 : handlerClose();
|
|
73
99
|
}
|
|
74
100
|
};
|
|
101
|
+
|
|
75
102
|
(0, _react.useEffect)(function () {
|
|
76
103
|
var body;
|
|
77
104
|
var randonId = Math.round(+new Date() / 1000);
|
|
105
|
+
|
|
78
106
|
if (targetId === undefined) {
|
|
79
107
|
body = document.getElementsByTagName('body')[0];
|
|
80
108
|
} else {
|
|
81
109
|
body = document.getElementById(targetId);
|
|
82
110
|
}
|
|
111
|
+
|
|
83
112
|
if (body) setDrawerComponent(body, randonId);
|
|
84
113
|
if (overlay && !targetId && body) setDrawerOverlay(body);
|
|
85
114
|
return function () {
|
|
86
115
|
var drawerOverlay = document.getElementsByClassName('drawer-overlay')[0];
|
|
87
116
|
if (closeOnEsc) document.body.removeEventListener('keyup', closeDrawerOnEsc);
|
|
117
|
+
|
|
88
118
|
if (targetId) {
|
|
89
119
|
var drawerComponentTarget = document.getElementById(targetId);
|
|
120
|
+
|
|
90
121
|
if (drawerComponentTarget && drawerComponentEl.current) {
|
|
91
122
|
drawerComponentTarget.removeChild(drawerComponentEl.current);
|
|
92
123
|
}
|
|
93
124
|
} else if (drawerComponentEl.current) document.body.removeChild(drawerComponentEl.current);
|
|
125
|
+
|
|
94
126
|
if (drawerOverlay && !targetId && body) body.removeChild(drawerOverlay);
|
|
95
127
|
};
|
|
96
128
|
}, []);
|
|
@@ -98,6 +130,7 @@ var BaseDrawer = function BaseDrawer(_ref) {
|
|
|
98
130
|
if (closeOnEsc) {
|
|
99
131
|
document.body.addEventListener('keyup', closeDrawerOnEsc);
|
|
100
132
|
}
|
|
133
|
+
|
|
101
134
|
return function () {
|
|
102
135
|
return document.body.removeEventListener('keyup', closeDrawerOnEsc);
|
|
103
136
|
};
|
|
@@ -107,6 +140,7 @@ var BaseDrawer = function BaseDrawer(_ref) {
|
|
|
107
140
|
hideContent: onDenied.hideContent,
|
|
108
141
|
skeletonize: skeletonize
|
|
109
142
|
};
|
|
143
|
+
|
|
110
144
|
var drawerContent = function drawerContent() {
|
|
111
145
|
return /*#__PURE__*/_react.default.createElement(_helpers.default.Provider, {
|
|
112
146
|
value: contextValues
|
|
@@ -121,7 +155,9 @@ var BaseDrawer = function BaseDrawer(_ref) {
|
|
|
121
155
|
customClass: customClassForDrawer
|
|
122
156
|
})), content ? /*#__PURE__*/_react.default.createElement(_.DrawerContent, null, content) : children)));
|
|
123
157
|
};
|
|
158
|
+
|
|
124
159
|
return /*#__PURE__*/_reactDom.default.createPortal(drawerContent(), drawerContainerEl.current);
|
|
125
160
|
};
|
|
161
|
+
|
|
126
162
|
var _default = BaseDrawer;
|
|
127
163
|
exports.default = _default;
|
package/lib/drawer/Header.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _icons = _interopRequireDefault(require("../icons"));
|
|
13
|
+
|
|
10
14
|
var _helpers = _interopRequireDefault(require("./helpers"));
|
|
15
|
+
|
|
11
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
12
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
13
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
14
22
|
var getCloseButton = function getCloseButton(handlerClose) {
|
|
15
23
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
16
24
|
"data-testid": "header-closebutton",
|
|
@@ -21,6 +29,7 @@ var getCloseButton = function getCloseButton(handlerClose) {
|
|
|
21
29
|
tabIndex: 0
|
|
22
30
|
}, "X");
|
|
23
31
|
};
|
|
32
|
+
|
|
24
33
|
var getIcon = function getIcon(titleIcon, icon) {
|
|
25
34
|
if (titleIcon || icon) {
|
|
26
35
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -32,36 +41,43 @@ var getIcon = function getIcon(titleIcon, icon) {
|
|
|
32
41
|
size: 24
|
|
33
42
|
}));
|
|
34
43
|
}
|
|
44
|
+
|
|
35
45
|
return /*#__PURE__*/_react.default.createElement("noscript", null);
|
|
36
46
|
};
|
|
47
|
+
|
|
37
48
|
var Header = function Header(_ref) {
|
|
38
49
|
var _ref$showCloseButton = _ref.showCloseButton,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
showCloseButton = _ref$showCloseButton === void 0 ? true : _ref$showCloseButton,
|
|
51
|
+
title = _ref.title,
|
|
52
|
+
subTitle = _ref.subTitle,
|
|
53
|
+
icon = _ref.icon,
|
|
54
|
+
titleIcon = _ref.titleIcon,
|
|
55
|
+
customClass = _ref.customClass,
|
|
56
|
+
titleContent = _ref.titleContent,
|
|
57
|
+
subTitleContent = _ref.subTitleContent,
|
|
58
|
+
titleRightContent = _ref.titleRightContent;
|
|
59
|
+
|
|
48
60
|
var _useContext = (0, _react.useContext)(_helpers.default),
|
|
49
|
-
|
|
61
|
+
handlerClose = _useContext.handlerClose;
|
|
62
|
+
|
|
50
63
|
var renderTitle = function renderTitle() {
|
|
51
64
|
if (titleContent) return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, titleContent);
|
|
52
65
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, icon ? getIcon(titleIcon, icon) : getIcon(titleIcon, null), /*#__PURE__*/_react.default.createElement("h2", {
|
|
53
66
|
className: "drawer-title"
|
|
54
67
|
}, title), titleRightContent);
|
|
55
68
|
};
|
|
69
|
+
|
|
56
70
|
var renderSubtitle = function renderSubtitle() {
|
|
57
71
|
if (subTitleContent) return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, subTitleContent);
|
|
58
72
|
return subTitle && /*#__PURE__*/_react.default.createElement("h3", {
|
|
59
73
|
className: "drawer-subtitle"
|
|
60
74
|
}, subTitle);
|
|
61
75
|
};
|
|
76
|
+
|
|
62
77
|
var checkHandlerClose = function checkHandlerClose() {
|
|
63
78
|
return handlerClose ? handlerClose() : undefined;
|
|
64
79
|
};
|
|
80
|
+
|
|
65
81
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
66
82
|
className: "drawerheader ".concat(customClass),
|
|
67
83
|
"data-testid": "drawerheader"
|
|
@@ -75,5 +91,6 @@ var Header = function Header(_ref) {
|
|
|
75
91
|
checkHandlerClose();
|
|
76
92
|
})));
|
|
77
93
|
};
|
|
94
|
+
|
|
78
95
|
var _default = Header;
|
|
79
96
|
exports.default = _default;
|
package/lib/drawer/helpers.js
CHANGED
|
@@ -4,8 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
8
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
9
12
|
var DrawerContext = /*#__PURE__*/_react.default.createContext({});
|
|
13
|
+
|
|
10
14
|
var _default = DrawerContext;
|
|
11
15
|
exports.default = _default;
|
package/lib/drawer/index.js
CHANGED
|
@@ -16,11 +16,19 @@ Object.defineProperty(exports, "DrawerHeader", {
|
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
exports.default = void 0;
|
|
19
|
+
|
|
19
20
|
var _Drawer = _interopRequireDefault(require("./Drawer"));
|
|
21
|
+
|
|
20
22
|
var _Header = _interopRequireDefault(require("./Header"));
|
|
23
|
+
|
|
21
24
|
var _Content = _interopRequireDefault(require("./Content"));
|
|
25
|
+
|
|
22
26
|
require("../assets/styles/drawers.scss");
|
|
27
|
+
|
|
23
28
|
var _withFormSecurity = _interopRequireDefault(require("../form/withFormSecurity"));
|
|
29
|
+
|
|
24
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
25
32
|
var _default = (0, _withFormSecurity.default)(_Drawer.default);
|
|
33
|
+
|
|
26
34
|
exports.default = _default;
|
package/lib/dropdown/Popup.js
CHANGED
|
@@ -4,44 +4,56 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = require("react");
|
|
9
|
+
|
|
8
10
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
11
|
+
|
|
9
12
|
var _excluded = ["customClassForDropdown", "align", "isFloatMenu", "topPosition", "leftPosition", "rightPosition", "minWidth"];
|
|
13
|
+
|
|
10
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
11
16
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
+
|
|
12
18
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
|
+
|
|
13
20
|
var getCalendarDropdownStyle = function getCalendarDropdownStyle(_ref) {
|
|
14
21
|
var topPosition = _ref.topPosition,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
leftPosition = _ref.leftPosition,
|
|
23
|
+
rightPosition = _ref.rightPosition,
|
|
24
|
+
align = _ref.align,
|
|
25
|
+
isFloatMenu = _ref.isFloatMenu,
|
|
26
|
+
minWidth = _ref.minWidth;
|
|
20
27
|
var style = "top: ".concat(topPosition + (isFloatMenu ? 6 : 2), "px; min-width: ").concat(minWidth, "px;");
|
|
28
|
+
|
|
21
29
|
if (align === 'left') {
|
|
22
30
|
style += "left: ".concat(leftPosition, "px;");
|
|
23
31
|
} else if (align === 'right') {
|
|
24
32
|
style += "right: ".concat(rightPosition, "px;");
|
|
25
33
|
}
|
|
34
|
+
|
|
26
35
|
return style;
|
|
27
36
|
};
|
|
37
|
+
|
|
28
38
|
var body = document.getElementsByTagName('body')[0];
|
|
39
|
+
|
|
29
40
|
var DropdownPopup = function DropdownPopup(_ref2) {
|
|
30
41
|
var _ref2$customClassForD = _ref2.customClassForDropdown,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
customClassForDropdown = _ref2$customClassForD === void 0 ? '' : _ref2$customClassForD,
|
|
43
|
+
_ref2$align = _ref2.align,
|
|
44
|
+
align = _ref2$align === void 0 ? 'left' : _ref2$align,
|
|
45
|
+
_ref2$isFloatMenu = _ref2.isFloatMenu,
|
|
46
|
+
isFloatMenu = _ref2$isFloatMenu === void 0 ? false : _ref2$isFloatMenu,
|
|
47
|
+
_ref2$topPosition = _ref2.topPosition,
|
|
48
|
+
topPosition = _ref2$topPosition === void 0 ? 0 : _ref2$topPosition,
|
|
49
|
+
_ref2$leftPosition = _ref2.leftPosition,
|
|
50
|
+
leftPosition = _ref2$leftPosition === void 0 ? 0 : _ref2$leftPosition,
|
|
51
|
+
_ref2$rightPosition = _ref2.rightPosition,
|
|
52
|
+
rightPosition = _ref2$rightPosition === void 0 ? 0 : _ref2$rightPosition,
|
|
53
|
+
_ref2$minWidth = _ref2.minWidth,
|
|
54
|
+
minWidth = _ref2$minWidth === void 0 ? 0 : _ref2$minWidth,
|
|
55
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
56
|
+
|
|
45
57
|
var popup = (0, _react.useRef)(document.createElement('div'));
|
|
46
58
|
popup.current.className = "dropdown-component ".concat(customClassForDropdown);
|
|
47
59
|
popup.current.dataset.testid = 'dropdown-component';
|
|
@@ -61,5 +73,6 @@ var DropdownPopup = function DropdownPopup(_ref2) {
|
|
|
61
73
|
}, []);
|
|
62
74
|
return /*#__PURE__*/_reactDom.default.createPortal(props.children, popup.current);
|
|
63
75
|
};
|
|
76
|
+
|
|
64
77
|
var _default = DropdownPopup;
|
|
65
78
|
exports.default = _default;
|
package/lib/dropdown/helper.js
CHANGED
|
@@ -4,10 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getDropdownItemCssClass = exports.contentClass = void 0;
|
|
7
|
+
|
|
7
8
|
var contentClass = function contentClass(showClearButton) {
|
|
8
9
|
return "content ".concat(showClearButton ? '' : 'noclear');
|
|
9
10
|
};
|
|
11
|
+
|
|
10
12
|
exports.contentClass = contentClass;
|
|
13
|
+
|
|
11
14
|
var getDropdownItemCssClass = function getDropdownItemCssClass(selected, disabled, striped) {
|
|
12
15
|
var className = 'item';
|
|
13
16
|
className += selected && !disabled ? ' -selected ' : '';
|
|
@@ -15,4 +18,5 @@ var getDropdownItemCssClass = function getDropdownItemCssClass(selected, disable
|
|
|
15
18
|
className += !selected && !disabled && striped ? ' -striped ' : '';
|
|
16
19
|
return className;
|
|
17
20
|
};
|
|
21
|
+
|
|
18
22
|
exports.getDropdownItemCssClass = getDropdownItemCssClass;
|
|
@@ -1,66 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = exports.WithDropdownContext = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _Popup = _interopRequireDefault(require("./Popup"));
|
|
13
|
+
|
|
10
14
|
require("../assets/styles/dropdown.scss");
|
|
15
|
+
|
|
11
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
12
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
13
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
14
22
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
+
|
|
15
24
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
|
+
|
|
16
26
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
27
|
+
|
|
17
28
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
|
|
19
|
-
function
|
|
29
|
+
|
|
30
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
31
|
+
|
|
32
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
33
|
+
|
|
20
34
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
|
+
|
|
21
36
|
var WithDropdownContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
22
37
|
exports.WithDropdownContext = WithDropdownContext;
|
|
38
|
+
|
|
23
39
|
var getDisplayName = function getDisplayName(Component) {
|
|
24
40
|
return Component.displayName || Component.name || 'Component';
|
|
25
41
|
};
|
|
42
|
+
|
|
26
43
|
var withDropdown = function withDropdown(WrappedComponent) {
|
|
27
44
|
var EnhancedComponent = function EnhancedComponent(props) {
|
|
28
45
|
var dropdownOpened = props.dropdownOpened,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
showDropdown = props.showDropdown,
|
|
47
|
+
dropdown = props.dropdown,
|
|
48
|
+
_props$closeDropdownO = props.closeDropdownOnClickOutside,
|
|
49
|
+
closeDropdownOnClickOutside = _props$closeDropdownO === void 0 ? true : _props$closeDropdownO,
|
|
50
|
+
customClassForDropdown = props.customClassForDropdown,
|
|
51
|
+
children = props.children,
|
|
52
|
+
_props$dropdownAlign = props.dropdownAlign,
|
|
53
|
+
dropdownAlign = _props$dropdownAlign === void 0 ? 'left' : _props$dropdownAlign,
|
|
54
|
+
isFloatMenu = props.isFloatMenu,
|
|
55
|
+
isDropdownOpened = props.isDropdownOpened;
|
|
56
|
+
|
|
39
57
|
var _useState = (0, _react.useState)(dropdownOpened),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
59
|
+
opened = _useState2[0],
|
|
60
|
+
setOpened = _useState2[1];
|
|
61
|
+
|
|
43
62
|
var _useState3 = (0, _react.useState)(dropdownOpened),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
63
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
64
|
+
prevOpened = _useState4[0],
|
|
65
|
+
setPrevOpened = _useState4[1];
|
|
66
|
+
|
|
47
67
|
var popupRef = (0, _react.useRef)(null);
|
|
48
68
|
var wrappedComponentRef = (0, _react.useRef)(null);
|
|
69
|
+
|
|
49
70
|
if (dropdownOpened !== prevOpened) {
|
|
50
71
|
setOpened(dropdownOpened);
|
|
51
72
|
setPrevOpened(dropdownOpened);
|
|
52
73
|
}
|
|
74
|
+
|
|
53
75
|
var onClickOutside = function onClickOutside(event) {
|
|
54
76
|
var target = event.target;
|
|
77
|
+
|
|
55
78
|
if (popupRef !== null && popupRef !== void 0 && popupRef.current && target !== (popupRef === null || popupRef === void 0 ? void 0 : popupRef.current) && !event.composedPath().includes(popupRef.current) && wrappedComponentRef.current !== target) {
|
|
56
79
|
setOpened(false);
|
|
57
80
|
}
|
|
58
81
|
};
|
|
82
|
+
|
|
59
83
|
var onDropdownClick = function onDropdownClick() {
|
|
60
84
|
setOpened(function (prevState) {
|
|
61
85
|
return !prevState;
|
|
62
86
|
});
|
|
63
87
|
};
|
|
88
|
+
|
|
64
89
|
var getDropdown = function getDropdown(targetRef) {
|
|
65
90
|
if (!targetRef || !opened) return null;
|
|
66
91
|
wrappedComponentRef.current = targetRef;
|
|
@@ -79,10 +104,12 @@ var withDropdown = function withDropdown(WrappedComponent) {
|
|
|
79
104
|
}
|
|
80
105
|
}, children));
|
|
81
106
|
};
|
|
107
|
+
|
|
82
108
|
(0, _react.useEffect)(function () {
|
|
83
109
|
if (dropdown && closeDropdownOnClickOutside) {
|
|
84
110
|
document.addEventListener('click', onClickOutside);
|
|
85
111
|
}
|
|
112
|
+
|
|
86
113
|
return function () {
|
|
87
114
|
if (dropdown && closeDropdownOnClickOutside) {
|
|
88
115
|
document.removeEventListener('click', onClickOutside);
|
|
@@ -106,8 +133,10 @@ var withDropdown = function withDropdown(WrappedComponent) {
|
|
|
106
133
|
value: contextValues
|
|
107
134
|
}, /*#__PURE__*/_react.default.createElement(WrappedComponent, _extends({}, props, newProps)));
|
|
108
135
|
};
|
|
136
|
+
|
|
109
137
|
EnhancedComponent.displayName = "withDropdown(".concat(getDisplayName(WrappedComponent), ")");
|
|
110
138
|
return EnhancedComponent;
|
|
111
139
|
};
|
|
140
|
+
|
|
112
141
|
var _default = withDropdown;
|
|
113
142
|
exports.default = _default;
|