@councilbox/councilbox-ui 2.0.53 → 2.0.55
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/Accordion.js +3 -0
- package/Alert.js +3 -0
- package/Avatar.js +3 -0
- package/AvatarGroup.js +3 -0
- package/Block.js +3 -0
- package/Button.js +3 -0
- package/ButtonBasic.js +3 -0
- package/Checkbox.js +3 -0
- package/DatePicker.js +3 -0
- package/DateRangePicker.js +3 -0
- package/DateTimePicker.js +3 -0
- package/DragDrop.js +3 -0
- package/DrawerPanel.js +3 -0
- package/DropDown.js +3 -0
- package/EnhancedTable.js +3 -0
- package/FabButton.js +3 -0
- package/Grid.js +3 -0
- package/Header.js +3 -0
- package/IconButton.js +3 -0
- package/IconButtonSquare.js +3 -0
- package/IconFont.js +3 -0
- package/InputAutocomplete.js +3 -0
- package/InputPassword.js +3 -0
- package/InputText.js +3 -0
- package/InputTextArea.js +3 -0
- package/LoadingSection.js +3 -0
- package/MenuItem.js +3 -0
- package/MenuLateralLeft.js +3 -0
- package/MenuLateralRight.js +3 -0
- package/Modal.js +3 -0
- package/Radio.js +3 -0
- package/RichTextInput.js +3 -0
- package/Scrollbar.js +3 -0
- package/ScrollbarNew.js +3 -0
- package/SelectInput.js +3 -0
- package/Slider.js +3 -0
- package/Spacing.js +3 -0
- package/Stars.js +3 -0
- package/Stepper.js +3 -0
- package/Table.js +3 -0
- package/TableBody.js +3 -0
- package/TableCell.js +3 -0
- package/TableContainer.js +3 -0
- package/TableHead.js +3 -0
- package/TableRow.js +3 -0
- package/TableSortLabel.js +3 -0
- package/Tabs.js +3 -0
- package/Tag.js +3 -0
- package/TextInput.js +3 -0
- package/ThemeProvider.js +3 -0
- package/TimePicker.js +3 -0
- package/Timeline.js +3 -0
- package/ToastProvider.js +3 -0
- package/Toggle.js +3 -0
- package/Tooltip.js +3 -0
- package/Typography.js +3 -0
- package/dist/HOCs/overlayA11yStack.js +47 -0
- package/dist/HOCs/useA11yGuard.js +38 -0
- package/dist/HOCs/useDynamicStyles.js +41 -60
- package/dist/HOCs/useMenuNavigation.js +110 -0
- package/dist/HOCs/useOverlay.js +87 -0
- package/dist/HOCs/usePopoverPosition.js +228 -0
- package/dist/HOCs/useRipple.js +17 -35
- package/dist/HOCs/useWindowSize.js +24 -42
- package/dist/build-index.js +119 -99
- package/dist/components/1.Introduction.stories.mdx +4 -1
- package/dist/components/2.Changelog.stories.mdx +54 -0
- package/dist/components/3.Guide.stories.mdx +1 -1
- package/dist/components/Accordion/Accordion.css +7 -0
- package/dist/components/Accordion/Accordion.js +97 -102
- package/dist/components/Accordion/Accordion.stories.js +10 -12
- package/dist/components/Accordion/DesignAccordion.stories.js +10 -21
- package/dist/components/Alert/Alert.js +55 -55
- package/dist/components/Alert/Alert.stories.js +10 -11
- package/dist/components/Avatar/Avatar.js +82 -74
- package/dist/components/Avatar/Avatar.stories.js +19 -23
- package/dist/components/Avatar/DesignAvatar.stories.js +18 -26
- package/dist/components/Avatar/DesignAvatarText.stories.js +31 -40
- package/dist/components/AvatarGroup/AvatarGroup.js +7 -14
- package/dist/components/AvatarGroup/AvatarGroup.stories.js +6 -13
- package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +34 -45
- package/dist/components/Block/Block.css +3 -3
- package/dist/components/Block/Block.js +31 -45
- package/dist/components/Block/Block.stories.js +5 -12
- package/dist/components/Block/DesignBlock.stories.js +7 -13
- package/dist/components/Button/Button.js +44 -66
- package/dist/components/Button/Button.stories.js +8 -14
- package/dist/components/Button/button.css +1 -1
- package/dist/components/ButtonBasic/ButtonBasic.css +6 -1
- package/dist/components/ButtonBasic/ButtonBasic.js +96 -118
- package/dist/components/ButtonBasic/ButtonBasic.stories.js +14 -15
- package/dist/components/Checkbox/Checkbox.css +6 -0
- package/dist/components/Checkbox/Checkbox.js +81 -100
- package/dist/components/Checkbox/Checkbox.stories.js +10 -11
- package/dist/components/DatePicker/Calendar.js +243 -0
- package/dist/components/DatePicker/DatePicker.css +197 -0
- package/dist/components/DatePicker/DatePicker.js +384 -0
- package/dist/components/DatePicker/DatePicker.stories.js +180 -0
- package/dist/components/DatePicker/dateUtils.js +478 -0
- package/dist/components/DateRangePicker/DateRangePicker.css +41 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +435 -0
- package/dist/components/DateRangePicker/DateRangePicker.stories.js +147 -0
- package/dist/components/DateRangePicker/RangeCalendar.js +188 -0
- package/dist/components/DateTimePicker/DateTimePicker.css +4 -0
- package/dist/components/DateTimePicker/DateTimePicker.js +481 -0
- package/dist/components/DateTimePicker/DateTimePicker.stories.js +144 -0
- package/dist/components/DateTimePicker/TimeColumns.css +46 -0
- package/dist/components/DateTimePicker/TimeColumns.js +175 -0
- package/dist/components/DragDrop/DragDrop.css +20 -9
- package/dist/components/DragDrop/DragDrop.js +83 -76
- package/dist/components/DragDrop/DragDrop.stories.js +9 -16
- package/dist/components/DrawerPanel/DesignDrawerPanel.js +35 -53
- package/dist/components/DrawerPanel/DrawerPanel.js +157 -146
- package/dist/components/DrawerPanel/DrawerPanel.stories.js +10 -12
- package/dist/components/DropDown/DesignDropDown.stories.js +87 -97
- package/dist/components/DropDown/DropDown.js +179 -343
- package/dist/components/DropDown/DropDown.stories.js +6 -12
- package/dist/components/DropDown/PopoverPlayground.js +68 -98
- package/dist/components/EnhancedTable/DesignEnhancedTable.stories.js +26 -36
- package/dist/components/EnhancedTable/EnhancedMyTable.js +16 -19
- package/dist/components/EnhancedTable/EnhancedTable.js +77 -136
- package/dist/components/EnhancedTable/EnhancedTable.stories.js +5 -12
- package/dist/components/EnhancedTable/EnhancedTableBody.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableCell.js +25 -34
- package/dist/components/EnhancedTable/EnhancedTableContainer.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableHead.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableRow.js +15 -18
- package/dist/components/EnhancedTable/EnhancedTableSortLabel.js +15 -18
- package/dist/components/FabButton/DesignFabButton.stories.js +9 -16
- package/dist/components/FabButton/FabButton.js +51 -54
- package/dist/components/FabButton/FabButton.stories.js +10 -12
- package/dist/components/Grid/DesignGrid.stories.js +7 -14
- package/dist/components/Grid/Grid.js +38 -46
- package/dist/components/Grid/Grid.stories.js +6 -13
- package/dist/components/Grid/GridItem.js +37 -39
- package/dist/components/Header/DesignHeader.stories.js +20 -24
- package/dist/components/Header/Header.js +227 -246
- package/dist/components/Header/Header.stories.js +9 -21
- package/dist/components/Header/header.css +10 -5
- package/dist/components/IconButton/DesignIconButton.stories.js +31 -36
- package/dist/components/IconButton/IconButton.css +6 -1
- package/dist/components/IconButton/IconButton.js +135 -140
- package/dist/components/IconButton/IconButton.stories.js +12 -13
- package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +5 -11
- package/dist/components/IconButtonSquare/IconButtonSquare.js +14 -28
- package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +7 -13
- package/dist/components/IconFont/IconFont.js +27 -48
- package/dist/components/IconFont/IconFont.stories.js +5 -11
- package/dist/components/InputAutocomplete/InputAutocomplete.css +6 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.js +184 -260
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +5 -11
- package/dist/components/InputPassword/InputPassword.css +0 -6
- package/dist/components/InputPassword/InputPassword.js +58 -73
- package/dist/components/InputPassword/InputPassword.stories.js +5 -11
- package/dist/components/InputText/InputText.css +96 -83
- package/dist/components/InputText/InputText.js +211 -215
- package/dist/components/InputText/InputText.stories.js +11 -11
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +38 -51
- package/dist/components/InputTextArea/InputTextArea.js +84 -93
- package/dist/components/InputTextArea/InputTextArea.stories.js +5 -12
- package/dist/components/LoadingSection/LoadingSection.js +44 -51
- package/dist/components/LoadingSection/LoadingSection.stories.js +5 -11
- package/dist/components/MenuItem/DesignMenuItem.stories.js +20 -34
- package/dist/components/MenuItem/MenuItem.css +7 -2
- package/dist/components/MenuItem/MenuItem.js +131 -140
- package/dist/components/MenuItem/MenuItem.stories.js +6 -15
- package/dist/components/MenuLateralLeft/MenuLateralLeft.css +24 -0
- package/dist/components/MenuLateralLeft/MenuLateralLeft.js +120 -157
- package/dist/components/MenuLateralLeft/MenuLateralLeft.stories.js +5 -12
- package/dist/components/MenuLateralRight/MenuLateralRight.css +2 -2
- package/dist/components/MenuLateralRight/MenuLateralRight.js +91 -79
- package/dist/components/MenuLateralRight/MenuLateralRight.stories.js +5 -12
- package/dist/components/Modal/DesignModal.stories.js +15 -30
- package/dist/components/Modal/Modal.css +35 -15
- package/dist/components/Modal/Modal.js +156 -145
- package/dist/components/Modal/Modal.stories.js +7 -16
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +4 -10
- package/dist/components/PaginationFooter/PaginationFooter.css +10 -0
- package/dist/components/PaginationFooter/PaginationFooter.js +99 -91
- package/dist/components/PaginationFooter/PaginationFooter.stories.js +5 -12
- package/dist/components/RadioButton/Radio.css +19 -18
- package/dist/components/RadioButton/Radio.js +65 -83
- package/dist/components/RadioButton/Radio.stories.js +27 -36
- package/dist/components/RichTextInput/DesignRichTextInput.stories.js +119 -0
- package/dist/components/RichTextInput/RichTextInput.css +309 -0
- package/dist/components/RichTextInput/RichTextInput.js +851 -0
- package/dist/components/RichTextInput/RichTextInput.stories.js +33 -0
- package/dist/components/Ripple/DesignRipple.js +42 -41
- package/dist/components/Ripple/Ripple.stories.js +5 -11
- package/dist/components/Scrollbar/DesignScrollbar.js +5 -10
- package/dist/components/Scrollbar/Scrollbar.js +37 -56
- package/dist/components/Scrollbar/Scrollbar.stories.js +5 -12
- package/dist/components/ScrollbarNew/DesignScrollbarNew.js +24 -0
- package/dist/components/ScrollbarNew/ScrollbarNew.css +79 -0
- package/dist/components/ScrollbarNew/ScrollbarNew.js +426 -0
- package/dist/components/ScrollbarNew/ScrollbarNew.stories.js +37 -0
- package/dist/components/SelectInput/DesignSelectInput.js +22 -45
- package/dist/components/SelectInput/SelectInput.js +171 -218
- package/dist/components/SelectInput/SelectInput.stories.js +6 -15
- package/dist/components/Slider/DesignSlider.js +8 -14
- package/dist/components/Slider/Slider.css +57 -37
- package/dist/components/Slider/Slider.js +85 -84
- package/dist/components/Slider/Slider.stories.js +5 -12
- package/dist/components/Spacing/Spacing.js +38 -45
- package/dist/components/Spacing/Spacing.stories.js +5 -11
- package/dist/components/Stars/DesignStars.js +17 -30
- package/dist/components/Stars/Stars.css +55 -104
- package/dist/components/Stars/Stars.js +89 -73
- package/dist/components/Stars/Stars.stories.js +5 -12
- package/dist/components/Stepper/DesignStepper.stories.js +16 -30
- package/dist/components/Stepper/Stepper.css +46 -10
- package/dist/components/Stepper/Stepper.js +118 -134
- package/dist/components/Stepper/Stepper.stories.js +5 -12
- package/dist/components/Table/DesignTable.stories.js +200 -211
- package/dist/components/Table/Table.css +33 -2
- package/dist/components/Table/Table.js +30 -38
- package/dist/components/Table/Table.stories.js +5 -12
- package/dist/components/Table/TableBody.js +22 -34
- package/dist/components/Table/TableCell.js +71 -61
- package/dist/components/Table/TableContainer.js +22 -34
- package/dist/components/Table/TableHead.js +22 -34
- package/dist/components/Table/TableRow.js +33 -37
- package/dist/components/Table/TableSortLabel.js +42 -52
- package/dist/components/Tabs/DesignTabs.js +14 -28
- package/dist/components/Tabs/Tabs.css +30 -11
- package/dist/components/Tabs/Tabs.js +151 -138
- package/dist/components/Tabs/Tabs.stories.js +5 -12
- package/dist/components/Tag/DesignTags.stories.js +24 -39
- package/dist/components/Tag/Tag.css +61 -42
- package/dist/components/Tag/Tag.js +93 -91
- package/dist/components/Tag/Tag.stories.js +5 -12
- package/dist/components/TextInput/TextInput.js +38 -54
- package/dist/components/TextInput/TextInput.stories.js +5 -11
- package/dist/components/ThemeProvider/Colors.js +2 -2
- package/dist/components/ThemeProvider/CouncilboxThemeContext.js +7 -10
- package/dist/components/ThemeProvider/ThemeProvider.js +34 -52
- package/dist/components/TimePicker/TimePicker.css +3 -0
- package/dist/components/TimePicker/TimePicker.js +359 -0
- package/dist/components/TimePicker/TimePicker.stories.js +132 -0
- package/dist/components/Timeline/DesignTimeline.stories.js +4 -10
- package/dist/components/Timeline/Timeline.js +66 -46
- package/dist/components/Timeline/Timeline.stories.js +5 -12
- package/dist/components/Toast/DesignToast.stories.js +174 -0
- package/dist/components/Toast/Toast.css +154 -0
- package/dist/components/Toast/Toast.js +165 -0
- package/dist/components/Toast/Toast.stories.js +33 -0
- package/dist/components/Toast/ToastProvider.js +33 -0
- package/dist/components/Toast/ToastRoot.js +89 -0
- package/dist/components/Toast/toastStore.js +127 -0
- package/dist/components/Toast/useToast.js +42 -0
- package/dist/components/Toggle/Toggle.css +10 -0
- package/dist/components/Toggle/Toggle.js +123 -100
- package/dist/components/Toggle/Toggle.stories.js +10 -11
- package/dist/components/Tooltip/DesignTooltip.stories.js +10 -16
- package/dist/components/Tooltip/Tooltip.css +17 -1
- package/dist/components/Tooltip/Tooltip.js +195 -366
- package/dist/components/Tooltip/Tooltip.stories.js +5 -12
- package/dist/components/Typography/Typography.css +57 -6
- package/dist/components/Typography/Typography.js +44 -97
- package/dist/components/Typography/Typography.stories.js +5 -11
- package/dist/index.js +2 -6
- package/dist/reportWebVitals.js +8 -14
- package/dist/storybook.test.js +2 -4
- package/dist/styles/colorConsts.css +4 -4
- package/dist/styles/main.css +16 -0
- package/dist/styles/styleFont.css +1 -1
- package/dist/styles/stylesheet.js +10 -22
- package/dist/styles/zIndexConsts.css +2 -0
- package/dist/testing/TestAutocomplete.js +74 -97
- package/dist/testing/TestComponents.js +5 -10
- package/dist/testing/TestDropdown.js +33 -41
- package/dist/utils/autoDetectScroll.js +12 -35
- package/dist/utils/index.js +37 -63
- package/dist/utils/useFallbackId.js +19 -0
- package/package.json +67 -4
- package/toast.js +7 -0
- package/useCouncilboxTheme.js +7 -0
- package/useToast.js +7 -0
- package/dist/components/Accordion/AccordionOld.css +0 -16
- package/dist/components/Accordion/AccordionOld.js +0 -115
- package/dist/components/Avatar/AvatarOld.js +0 -138
- package/dist/components/ButtonBasic/ButtonBasicOld.css +0 -41
- package/dist/components/ButtonBasic/ButtonBasicOld.js +0 -231
- package/dist/components/Checkbox/CheckboxOld.css +0 -31
- package/dist/components/Checkbox/CheckboxOld.js +0 -112
- package/dist/components/DrawerPanel/DrawerPanelOld.css +0 -56
- package/dist/components/DrawerPanel/DrawerPanelOld.js +0 -233
- package/dist/components/DropDown/DropDownOld.css +0 -3
- package/dist/components/DropDown/DropDownOld.js +0 -186
- package/dist/components/Grid/GridItemOld.js +0 -43
- package/dist/components/Grid/GridOld.css +0 -0
- package/dist/components/Grid/GridOld.js +0 -53
- package/dist/components/IconButton/IconButtonOld.css +0 -0
- package/dist/components/IconButton/IconButtonOld.js +0 -138
- package/dist/components/IconButtonSquare/IconButtonSquareOld.css +0 -43
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +0 -133
- package/dist/components/InputAutocomplete/InputAutocompleteOld.css +0 -5
- package/dist/components/InputAutocomplete/InputAutocompleteOld.js +0 -178
- package/dist/components/InputText/InputTextOld.css +0 -10
- package/dist/components/InputText/InputTextOld.js +0 -340
- package/dist/components/MenuItem/MenuItemOld.js +0 -139
- package/dist/components/Modal/ModalOld.css +0 -3
- package/dist/components/Modal/ModalOld.js +0 -230
- package/dist/components/RadioButton/RadioOld.css +0 -31
- package/dist/components/RadioButton/RadioOld.js +0 -142
- package/dist/components/SelectInput/SelectInputOld.css +0 -17
- package/dist/components/SelectInput/SelectInputOld.js +0 -325
- package/dist/components/Table/TableOld.css +0 -79
- package/dist/components/Table/TableOld.js +0 -165
- package/dist/components/Tabs/TabsOld.js +0 -92
- package/dist/components/Typography/TypographyOld.js +0 -132
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _overlayA11yStack = require("./overlayA11yStack");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
var FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
11
|
+
var useOverlay = function useOverlay(_ref) {
|
|
12
|
+
var open = _ref.open,
|
|
13
|
+
containerRef = _ref.containerRef,
|
|
14
|
+
contentRef = _ref.contentRef,
|
|
15
|
+
onEscape = _ref.onEscape;
|
|
16
|
+
var previouslyFocusedElement = _react["default"].useRef(null);
|
|
17
|
+
_react["default"].useEffect(function () {
|
|
18
|
+
if (!open) {
|
|
19
|
+
if (previouslyFocusedElement.current && previouslyFocusedElement.current.focus) {
|
|
20
|
+
previouslyFocusedElement.current.focus();
|
|
21
|
+
previouslyFocusedElement.current = null;
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
previouslyFocusedElement.current = document.activeElement;
|
|
26
|
+
var registeredNode = null;
|
|
27
|
+
var focusTimeout = setTimeout(function () {
|
|
28
|
+
var _contentRef$current$q, _contentRef$current;
|
|
29
|
+
if (containerRef.current) {
|
|
30
|
+
(0, _overlayA11yStack.registerOverlay)(containerRef.current);
|
|
31
|
+
registeredNode = containerRef.current;
|
|
32
|
+
}
|
|
33
|
+
var focusable = Array.from((_contentRef$current$q = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.querySelectorAll(FOCUSABLE_SELECTOR)) !== null && _contentRef$current$q !== void 0 ? _contentRef$current$q : []).filter(function (el) {
|
|
34
|
+
return el.offsetParent !== null && !el.hasAttribute('data-overlay-skip-autofocus');
|
|
35
|
+
});
|
|
36
|
+
if (focusable !== null && focusable !== void 0 && focusable.length) {
|
|
37
|
+
var firstFocusable = Array.from(focusable).find(function (element) {
|
|
38
|
+
return element.offsetParent !== null;
|
|
39
|
+
});
|
|
40
|
+
if (firstFocusable) {
|
|
41
|
+
firstFocusable.focus();
|
|
42
|
+
} else {
|
|
43
|
+
var _contentRef$current2;
|
|
44
|
+
(_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 ? void 0 : _contentRef$current2.focus();
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
var _contentRef$current3;
|
|
48
|
+
(_contentRef$current3 = contentRef.current) === null || _contentRef$current3 === void 0 ? void 0 : _contentRef$current3.focus();
|
|
49
|
+
}
|
|
50
|
+
}, 20);
|
|
51
|
+
return function () {
|
|
52
|
+
clearTimeout(focusTimeout);
|
|
53
|
+
if (registeredNode) {
|
|
54
|
+
(0, _overlayA11yStack.unregisterOverlay)(registeredNode);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}, [open, containerRef, contentRef]);
|
|
58
|
+
var handleKeyDown = _react["default"].useCallback(function (e) {
|
|
59
|
+
if (e.key === 'Escape') {
|
|
60
|
+
onEscape === null || onEscape === void 0 ? void 0 : onEscape(e);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (e.key !== 'Tab' || !contentRef.current) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
var focusable = Array.from(contentRef.current.querySelectorAll(FOCUSABLE_SELECTOR)).filter(function (element) {
|
|
67
|
+
return element.offsetParent !== null;
|
|
68
|
+
});
|
|
69
|
+
if (!focusable.length) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
var first = focusable[0];
|
|
73
|
+
var last = focusable[focusable.length - 1];
|
|
74
|
+
if (e.shiftKey && document.activeElement === first) {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
last.focus();
|
|
77
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
first.focus();
|
|
80
|
+
}
|
|
81
|
+
}, [contentRef, onEscape]);
|
|
82
|
+
return {
|
|
83
|
+
handleKeyDown: handleKeyDown
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
var _default = useOverlay;
|
|
87
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _utils = require("../utils");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
17
|
+
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."); }
|
|
18
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
19
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
20
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
21
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
22
|
+
var oppositeEdge = {
|
|
23
|
+
left: 'right',
|
|
24
|
+
right: 'left',
|
|
25
|
+
top: 'bottom',
|
|
26
|
+
bottom: 'top'
|
|
27
|
+
};
|
|
28
|
+
var getDefaultCoordinates = function getDefaultCoordinates(_ref) {
|
|
29
|
+
var transformOrigin = _ref.transformOrigin,
|
|
30
|
+
anchorOrigin = _ref.anchorOrigin,
|
|
31
|
+
popoverRect = _ref.popoverRect,
|
|
32
|
+
anchorRect = _ref.anchorRect,
|
|
33
|
+
viewportHeight = _ref.viewportHeight,
|
|
34
|
+
viewportWidth = _ref.viewportWidth,
|
|
35
|
+
outMargin = _ref.outMargin;
|
|
36
|
+
var anchorVertical = anchorRect[anchorOrigin.vertical !== 'center' ? anchorOrigin.vertical : 'top'];
|
|
37
|
+
var anchorHorizontal = anchorRect[anchorOrigin.horizontal !== 'center' ? anchorOrigin.horizontal : 'left'];
|
|
38
|
+
if (anchorOrigin.vertical === 'center') {
|
|
39
|
+
anchorVertical += anchorRect.height / 2;
|
|
40
|
+
}
|
|
41
|
+
if (anchorOrigin.horizontal === 'center') {
|
|
42
|
+
anchorHorizontal += anchorRect.width / 2;
|
|
43
|
+
}
|
|
44
|
+
var transformVertical = 0;
|
|
45
|
+
var transformHorizontal = 0;
|
|
46
|
+
if (transformOrigin.vertical === 'center') {
|
|
47
|
+
transformVertical = popoverRect.height / 2;
|
|
48
|
+
}
|
|
49
|
+
if (transformOrigin.horizontal === 'center') {
|
|
50
|
+
transformHorizontal = popoverRect.width / 2;
|
|
51
|
+
}
|
|
52
|
+
var maxRight = viewportWidth - outMargin;
|
|
53
|
+
var maxBottom = viewportHeight - outMargin;
|
|
54
|
+
var top = null;
|
|
55
|
+
var left = null;
|
|
56
|
+
var right = null;
|
|
57
|
+
var bottom = null;
|
|
58
|
+
if (transformOrigin.vertical === 'top') {
|
|
59
|
+
top = anchorVertical - transformVertical;
|
|
60
|
+
if (top + popoverRect.height > maxBottom) {
|
|
61
|
+
var flippedBottom = anchorOrigin.vertical !== 'center' ? viewportHeight - anchorRect[oppositeEdge[anchorOrigin.vertical]] : null;
|
|
62
|
+
var flippedFits = flippedBottom !== null && flippedBottom >= outMargin && flippedBottom + popoverRect.height <= maxBottom;
|
|
63
|
+
if (flippedFits) {
|
|
64
|
+
top = null;
|
|
65
|
+
bottom = flippedBottom;
|
|
66
|
+
} else {
|
|
67
|
+
top = null;
|
|
68
|
+
bottom = outMargin;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (top !== null && top < 0) {
|
|
72
|
+
top = outMargin;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (transformOrigin.vertical === 'center') {
|
|
76
|
+
top = anchorVertical - transformVertical;
|
|
77
|
+
if (top + popoverRect.height > maxBottom) {
|
|
78
|
+
top = null;
|
|
79
|
+
bottom = outMargin;
|
|
80
|
+
}
|
|
81
|
+
if (top !== null && top < 0) {
|
|
82
|
+
top = outMargin;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (transformOrigin.horizontal === 'left' || transformOrigin.horizontal === 'center') {
|
|
86
|
+
left = anchorHorizontal - transformHorizontal;
|
|
87
|
+
}
|
|
88
|
+
if (transformOrigin.horizontal === 'right') {
|
|
89
|
+
if (anchorOrigin.horizontal === 'center') {
|
|
90
|
+
right = anchorHorizontal - transformHorizontal;
|
|
91
|
+
} else {
|
|
92
|
+
right = viewportWidth - anchorRect[anchorOrigin.horizontal];
|
|
93
|
+
}
|
|
94
|
+
if (right + popoverRect.width > maxRight) {
|
|
95
|
+
var flippedLeft = anchorOrigin.horizontal !== 'center' ? anchorRect[oppositeEdge[anchorOrigin.horizontal]] : null;
|
|
96
|
+
if (flippedLeft !== null && flippedLeft >= outMargin && flippedLeft + popoverRect.width <= maxRight) {
|
|
97
|
+
left = flippedLeft;
|
|
98
|
+
right = null;
|
|
99
|
+
} else {
|
|
100
|
+
left = outMargin;
|
|
101
|
+
right = null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (left !== null && left + popoverRect.width > maxRight) {
|
|
106
|
+
if (transformOrigin.horizontal === 'left' && anchorOrigin.horizontal !== 'center') {
|
|
107
|
+
var flippedRight = viewportWidth - anchorRect[oppositeEdge[anchorOrigin.horizontal]];
|
|
108
|
+
if (flippedRight >= outMargin && flippedRight + popoverRect.width <= maxRight) {
|
|
109
|
+
left = null;
|
|
110
|
+
right = flippedRight;
|
|
111
|
+
} else {
|
|
112
|
+
left = outMargin;
|
|
113
|
+
right = null;
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
left = null;
|
|
117
|
+
right = outMargin;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (left !== null && left < outMargin) {
|
|
121
|
+
left = outMargin;
|
|
122
|
+
right = null;
|
|
123
|
+
}
|
|
124
|
+
if (transformOrigin.vertical === 'bottom') {
|
|
125
|
+
if (anchorOrigin.vertical === 'center') {
|
|
126
|
+
bottom = viewportHeight - anchorVertical;
|
|
127
|
+
} else {
|
|
128
|
+
bottom = viewportHeight - anchorRect[anchorOrigin.vertical];
|
|
129
|
+
}
|
|
130
|
+
if (bottom + popoverRect.height > maxBottom) {
|
|
131
|
+
var flippedTop = anchorOrigin.vertical !== 'center' ? anchorRect[oppositeEdge[anchorOrigin.vertical]] : null;
|
|
132
|
+
var _flippedFits = flippedTop !== null && flippedTop >= outMargin && flippedTop + popoverRect.height <= maxBottom;
|
|
133
|
+
if (_flippedFits) {
|
|
134
|
+
top = flippedTop;
|
|
135
|
+
bottom = null;
|
|
136
|
+
} else {
|
|
137
|
+
top = outMargin;
|
|
138
|
+
bottom = null;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
top: top,
|
|
144
|
+
left: left,
|
|
145
|
+
right: right,
|
|
146
|
+
bottom: bottom
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
var usePopoverPosition = function usePopoverPosition(_ref2) {
|
|
150
|
+
var anchorRef = _ref2.anchorRef,
|
|
151
|
+
popoverRef = _ref2.popoverRef,
|
|
152
|
+
isOpen = _ref2.isOpen,
|
|
153
|
+
anchorOrigin = _ref2.anchorOrigin,
|
|
154
|
+
transformOrigin = _ref2.transformOrigin,
|
|
155
|
+
outMargin = _ref2.outMargin,
|
|
156
|
+
_ref2$debounceMs = _ref2.debounceMs,
|
|
157
|
+
debounceMs = _ref2$debounceMs === void 0 ? 0 : _ref2$debounceMs,
|
|
158
|
+
baseStyles = _ref2.baseStyles;
|
|
159
|
+
var _React$useState = _react["default"].useState(null),
|
|
160
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
161
|
+
popoverStyles = _React$useState2[0],
|
|
162
|
+
setPopoverStyles = _React$useState2[1];
|
|
163
|
+
var debounceRef = _react["default"].useRef(null);
|
|
164
|
+
var latestOptionsRef = _react["default"].useRef(null);
|
|
165
|
+
latestOptionsRef.current = {
|
|
166
|
+
anchorRef: anchorRef,
|
|
167
|
+
popoverRef: popoverRef,
|
|
168
|
+
anchorOrigin: anchorOrigin,
|
|
169
|
+
transformOrigin: transformOrigin,
|
|
170
|
+
outMargin: outMargin,
|
|
171
|
+
baseStyles: baseStyles
|
|
172
|
+
};
|
|
173
|
+
var adjustPosition = _react["default"].useCallback(function () {
|
|
174
|
+
var options = latestOptionsRef.current;
|
|
175
|
+
if (!options.anchorRef.current || !options.popoverRef.current) return;
|
|
176
|
+
var _getDefaultCoordinate = getDefaultCoordinates({
|
|
177
|
+
transformOrigin: options.transformOrigin,
|
|
178
|
+
anchorOrigin: options.anchorOrigin,
|
|
179
|
+
anchorRect: options.anchorRef.current.getBoundingClientRect(),
|
|
180
|
+
popoverRect: (0, _utils.getOuterSize)(options.popoverRef.current),
|
|
181
|
+
viewportWidth: document.documentElement.clientWidth,
|
|
182
|
+
viewportHeight: document.documentElement.clientHeight,
|
|
183
|
+
outMargin: options.outMargin
|
|
184
|
+
}),
|
|
185
|
+
top = _getDefaultCoordinate.top,
|
|
186
|
+
left = _getDefaultCoordinate.left,
|
|
187
|
+
right = _getDefaultCoordinate.right,
|
|
188
|
+
bottom = _getDefaultCoordinate.bottom;
|
|
189
|
+
setPopoverStyles(_objectSpread(_objectSpread(_objectSpread({
|
|
190
|
+
position: 'absolute'
|
|
191
|
+
}, options.baseStyles), bottom !== null ? {
|
|
192
|
+
bottom: "".concat(bottom, "px")
|
|
193
|
+
} : {
|
|
194
|
+
top: "".concat(top, "px")
|
|
195
|
+
}), right !== null ? {
|
|
196
|
+
right: "".concat(right, "px")
|
|
197
|
+
} : {
|
|
198
|
+
left: "".concat(left, "px")
|
|
199
|
+
}));
|
|
200
|
+
}, []);
|
|
201
|
+
var scheduleAdjustPosition = _react["default"].useCallback(function () {
|
|
202
|
+
if (!debounceMs) {
|
|
203
|
+
adjustPosition();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (debounceRef.current) {
|
|
207
|
+
clearTimeout(debounceRef.current);
|
|
208
|
+
}
|
|
209
|
+
debounceRef.current = setTimeout(adjustPosition, debounceMs);
|
|
210
|
+
}, [adjustPosition, debounceMs]);
|
|
211
|
+
_react["default"].useLayoutEffect(function () {
|
|
212
|
+
if (!isOpen) return undefined;
|
|
213
|
+
scheduleAdjustPosition();
|
|
214
|
+
window.addEventListener('resize', scheduleAdjustPosition);
|
|
215
|
+
return function () {
|
|
216
|
+
window.removeEventListener('resize', scheduleAdjustPosition);
|
|
217
|
+
if (debounceRef.current) {
|
|
218
|
+
clearTimeout(debounceRef.current);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}, [isOpen, scheduleAdjustPosition]);
|
|
222
|
+
return {
|
|
223
|
+
popoverStyles: popoverStyles,
|
|
224
|
+
adjustPosition: adjustPosition
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
var _default = usePopoverPosition;
|
|
228
|
+
exports["default"] = _default;
|
package/dist/HOCs/useRipple.js
CHANGED
|
@@ -1,50 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
4
|
-
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
7
|
+
exports["default"] = useRipple;
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
17
|
-
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
|
|
10
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
18
11
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
23
|
-
|
|
24
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
|
-
|
|
12
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
13
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
14
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
26
15
|
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
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
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
|
-
|
|
34
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
|
-
|
|
16
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
17
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
18
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
19
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
36
20
|
var MINIMUM_RIPPLE_SIZE = 100;
|
|
37
21
|
var MINIMUM_RIPPLE_SIZE_CENTER = 20;
|
|
38
|
-
|
|
39
22
|
function useRipple() {
|
|
40
23
|
var style = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
41
24
|
var variant = arguments.length > 1 ? arguments[1] : undefined;
|
|
42
|
-
|
|
43
25
|
var _useState = (0, _react.useState)([]),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
ripples = _useState2[0],
|
|
28
|
+
setRipples = _useState2[1];
|
|
48
29
|
var showRipple = (0, _react.useCallback)(function (event) {
|
|
49
30
|
var target = event.currentTarget;
|
|
50
31
|
var rect = target.getBoundingClientRect();
|
|
@@ -78,13 +59,14 @@ function useRipple() {
|
|
|
78
59
|
});
|
|
79
60
|
}, []);
|
|
80
61
|
var ripplesArray = ripples.map(function (ripple) {
|
|
81
|
-
return /*#__PURE__*/_react
|
|
62
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
82
63
|
key: ripple.key,
|
|
83
64
|
className: "ripple",
|
|
84
65
|
style: ripple.style,
|
|
85
66
|
onAnimationEnd: function onAnimationEnd() {
|
|
86
67
|
return handleAnimationEnd(ripple.key);
|
|
87
|
-
}
|
|
68
|
+
},
|
|
69
|
+
"aria-hidden": "true"
|
|
88
70
|
});
|
|
89
71
|
});
|
|
90
72
|
return [showRipple, ripplesArray];
|
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
7
|
+
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
9
|
var _stylesheet = require("../styles/stylesheet");
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
-
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
22
17
|
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."); }
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
|
|
30
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
-
|
|
18
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
19
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
20
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
21
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
32
22
|
var getSize = function getSize(innerWidth) {
|
|
33
23
|
if (innerWidth < 600) return 'xs';
|
|
34
24
|
if (innerWidth < 960) return 'sm';
|
|
@@ -36,43 +26,35 @@ var getSize = function getSize(innerWidth) {
|
|
|
36
26
|
if (innerWidth < 1920) return 'lg';
|
|
37
27
|
return 'xl';
|
|
38
28
|
};
|
|
39
|
-
|
|
40
29
|
var useWindowSize = function useWindowSize() {
|
|
41
|
-
var _React$useState = _react
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
_react.default.useEffect(function () {
|
|
30
|
+
var _React$useState = _react["default"].useState({
|
|
31
|
+
size: getSize(window.innerWidth),
|
|
32
|
+
innerWidth: window.innerWidth,
|
|
33
|
+
innerHeight: window.innerHeight,
|
|
34
|
+
breakpoints: _stylesheet.defaultBreakpoints
|
|
35
|
+
}),
|
|
36
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
37
|
+
windowSize = _React$useState2[0],
|
|
38
|
+
setWindowSize = _React$useState2[1];
|
|
39
|
+
_react["default"].useEffect(function () {
|
|
52
40
|
function handleResize() {
|
|
53
41
|
var state = _objectSpread({}, windowSize);
|
|
54
|
-
|
|
55
42
|
state.size = getSize(window.innerWidth);
|
|
56
43
|
state.innerWidth = window.innerWidth;
|
|
57
|
-
|
|
58
44
|
if (window.innerWidth < window.innerHeight) {
|
|
59
45
|
state.orientation = 'portrait';
|
|
60
46
|
} else if (window.innerWidth > window.innerHeight) {
|
|
61
47
|
state.orientation = 'landscape';
|
|
62
48
|
}
|
|
63
|
-
|
|
64
49
|
setWindowSize(_objectSpread({}, state));
|
|
65
50
|
}
|
|
66
|
-
|
|
67
51
|
window.addEventListener('resize', handleResize);
|
|
68
52
|
handleResize();
|
|
69
53
|
return function () {
|
|
70
54
|
return window.removeEventListener('resize', handleResize);
|
|
71
55
|
};
|
|
72
56
|
}, []);
|
|
73
|
-
|
|
74
57
|
return windowSize;
|
|
75
58
|
};
|
|
76
|
-
|
|
77
59
|
var _default = useWindowSize;
|
|
78
|
-
exports
|
|
60
|
+
exports["default"] = _default;
|