ab-ui-library 1.12.4 → 1.12.5
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/components/AdvancedTable/AdvancedPagination.js +1 -0
- package/components/AdvancedTable/index.js +1 -0
- package/components/Select/Select/Select.js +2 -0
- package/components/Select/index.js +1 -0
- package/consts/index.d.ts +2 -0
- package/consts/index.js +3 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/useHideOnResize.d.ts +1 -0
- package/hooks/useHideOnResize.js +24 -0
- package/index.js +1 -0
- package/package.json +1 -1
|
@@ -48,6 +48,7 @@ import '../../hooks/useOnOutsideClick.js';
|
|
|
48
48
|
import '../Link/Link.js';
|
|
49
49
|
import '../../helperComponents/Loader/Loader.js';
|
|
50
50
|
import '../Button/consts.js';
|
|
51
|
+
import '../../hooks/useHideOnResize.js';
|
|
51
52
|
import '../../utils/helpers.js';
|
|
52
53
|
import '../../hooks/useGetHasBottomSpace.js';
|
|
53
54
|
import '../../helperComponents/OptionItem/OptionItem.js';
|
|
@@ -81,6 +81,7 @@ import '../SVGIcons/IconEyeOff.js';
|
|
|
81
81
|
import '../SVGIcons/IconEyeOn.js';
|
|
82
82
|
import '../Divider/Divider.js';
|
|
83
83
|
import '../Select/Select/Select.js';
|
|
84
|
+
import '../../hooks/useHideOnResize.js';
|
|
84
85
|
import '../../hooks/useGetHasBottomSpace.js';
|
|
85
86
|
import '../Select/SharedComponents/ContentTop.js';
|
|
86
87
|
import '../Select/SharedComponents/Actions.js';
|
|
@@ -5,6 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { useGetElemSizes } from '../../../hooks/useGetElemSizes.js';
|
|
6
6
|
import { useGetElemPositions } from '../../../hooks/useGetElemPositions.js';
|
|
7
7
|
import { DROPDOWN_AND_INPUT_GAP } from '../../../consts/index.js';
|
|
8
|
+
import { useHideOnResize } from '../../../hooks/useHideOnResize.js';
|
|
8
9
|
import { noop } from '../../../utils/helpers.js';
|
|
9
10
|
import { useOnOutsideClick } from '../../../hooks/useOnOutsideClick.js';
|
|
10
11
|
import '../../../hooks/useScreenSize.js';
|
|
@@ -252,6 +253,7 @@ var Select = function Select(props) {
|
|
|
252
253
|
childElement: dropdownRef,
|
|
253
254
|
hasBottomSpace: hasBottomSpace
|
|
254
255
|
});
|
|
256
|
+
useHideOnResize(closeDropdown);
|
|
255
257
|
return /*#__PURE__*/React.createElement("div", {
|
|
256
258
|
"data-id": "".concat(dataId, "-content"),
|
|
257
259
|
className: classNames("select select--".concat(size), className, {
|
|
@@ -11,6 +11,7 @@ import 'classnames';
|
|
|
11
11
|
import '../../hooks/useGetElemSizes.js';
|
|
12
12
|
import '../../hooks/useGetElemPositions.js';
|
|
13
13
|
import '../../consts/index.js';
|
|
14
|
+
import '../../hooks/useHideOnResize.js';
|
|
14
15
|
import '../../utils/helpers.js';
|
|
15
16
|
import 'dayjs';
|
|
16
17
|
import '../../hooks/useOnOutsideClick.js';
|
package/consts/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export declare enum CARD_SELECT_TYPES {
|
|
|
16
16
|
}
|
|
17
17
|
export declare const CUSTOM_SCROLL_MESSAGE = "Custom scroll event has fired";
|
|
18
18
|
export declare const CUSTOM_SCROLL_NAME = "CUSTOM_SCROLL_EVENT";
|
|
19
|
+
export declare const CUSTOM_RESIZE_MESSAGE = "Custom resize event has fired";
|
|
20
|
+
export declare const CUSTOM_RESIZE_NAME = "CUSTOM_RESIZE_EVENT";
|
|
19
21
|
export declare const MONTHS: {
|
|
20
22
|
label: string;
|
|
21
23
|
value: number;
|
package/consts/index.js
CHANGED
|
@@ -20,6 +20,8 @@ var CARD_SELECT_TYPES = /*#__PURE__*/function (CARD_SELECT_TYPES) {
|
|
|
20
20
|
}({});
|
|
21
21
|
var CUSTOM_SCROLL_MESSAGE = 'Custom scroll event has fired';
|
|
22
22
|
var CUSTOM_SCROLL_NAME = 'CUSTOM_SCROLL_EVENT';
|
|
23
|
+
var CUSTOM_RESIZE_MESSAGE = 'Custom resize event has fired';
|
|
24
|
+
var CUSTOM_RESIZE_NAME = 'CUSTOM_RESIZE_EVENT';
|
|
23
25
|
var MONTHS = [{
|
|
24
26
|
label: 'January',
|
|
25
27
|
value: 0
|
|
@@ -59,4 +61,4 @@ var MONTHS = [{
|
|
|
59
61
|
}];
|
|
60
62
|
var DROPDOWN_AND_INPUT_GAP = 10;
|
|
61
63
|
|
|
62
|
-
export { CARD_SELECT_TYPES, CUSTOM_SCROLL_MESSAGE, CUSTOM_SCROLL_NAME, DROPDOWN_AND_INPUT_GAP, FILE_UPLOAD_ERRORS, IMAGE_MIME_TYPE, IMAGE_MIME_TYPES, IMAGE_MIME_TYPES_FOR_PREVIEW, MONTHS, SCREEN_SIZES };
|
|
64
|
+
export { CARD_SELECT_TYPES, CUSTOM_RESIZE_MESSAGE, CUSTOM_RESIZE_NAME, CUSTOM_SCROLL_MESSAGE, CUSTOM_SCROLL_NAME, DROPDOWN_AND_INPUT_GAP, FILE_UPLOAD_ERRORS, IMAGE_MIME_TYPE, IMAGE_MIME_TYPES, IMAGE_MIME_TYPES_FOR_PREVIEW, MONTHS, SCREEN_SIZES };
|
package/hooks/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './useGetTooltipStyles';
|
|
|
3
3
|
export * from './useGetElemPositions';
|
|
4
4
|
export * from './useGetTooltipPosition';
|
|
5
5
|
export * from './useHideOnScroll';
|
|
6
|
+
export * from './useHideOnResize';
|
|
6
7
|
export * from './useFormProps';
|
|
7
8
|
export * from './useFormContext';
|
|
8
9
|
export * from './useOnOutsideClick';
|
package/hooks/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { useGetTooltipStyles } from './useGetTooltipStyles.js';
|
|
|
3
3
|
export { useGetElemPositions } from './useGetElemPositions.js';
|
|
4
4
|
export { useGetTooltipPosition } from './useGetTooltipPosition.js';
|
|
5
5
|
export { useHideOnScroll } from './useHideOnScroll.js';
|
|
6
|
+
export { useHideOnResize } from './useHideOnResize.js';
|
|
6
7
|
export { useFormProps } from './useFormProps.js';
|
|
7
8
|
export { useFormContext } from './useFormContext.js';
|
|
8
9
|
export { useOnOutsideClick } from './useOnOutsideClick.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useHideOnResize: (hide: () => void) => null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { CUSTOM_RESIZE_NAME, CUSTOM_RESIZE_MESSAGE } from '../consts/index.js';
|
|
3
|
+
|
|
4
|
+
var useHideOnResize = function useHideOnResize(hide) {
|
|
5
|
+
useEffect(function () {
|
|
6
|
+
window.addEventListener('resize', hide);
|
|
7
|
+
return function () {
|
|
8
|
+
window.removeEventListener('resize', hide);
|
|
9
|
+
};
|
|
10
|
+
}, []);
|
|
11
|
+
useEffect(function () {
|
|
12
|
+
window.addEventListener(CUSTOM_RESIZE_NAME, function (event) {
|
|
13
|
+
var customEvent = event;
|
|
14
|
+
// Check the event type
|
|
15
|
+
if (customEvent.detail === CUSTOM_RESIZE_MESSAGE) {
|
|
16
|
+
// Close the menu
|
|
17
|
+
hide();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}, []);
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { useHideOnResize };
|
package/index.js
CHANGED
|
@@ -477,6 +477,7 @@ import './components/Select/SharedComponents/ContentTop.js';
|
|
|
477
477
|
import './components/Select/SharedComponents/Actions.js';
|
|
478
478
|
import 'react-input-mask';
|
|
479
479
|
import 'react-number-format';
|
|
480
|
+
import './hooks/useHideOnResize.js';
|
|
480
481
|
import './hooks/useGetHasBottomSpace.js';
|
|
481
482
|
import './components/Select/SharedComponents/Loading.js';
|
|
482
483
|
import './hooks/useChangePositionsOnScroll.js';
|