ab-ui-library 1.4.4 → 1.4.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/Modal/Modal.js +2 -1
- package/components/Modal/ModalConfirmation.js +1 -1
- package/components/SideNavigation/SideNavigation.d.ts +1 -1
- package/components/SideNavigation/SideNavigation.js +9 -26
- package/components/SideNavigation/index.js +1 -1
- package/components/SideNavigation/types.d.ts +10 -3
- package/hooks/useSideNavigation.d.ts +2 -0
- package/hooks/useSideNavigation.js +47 -0
- package/package.json +1 -1
- package/stories/SideNavigation.stories.d.ts +2 -2
|
@@ -106,7 +106,7 @@ var Modal = function Modal(props) {
|
|
|
106
106
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, {
|
|
107
107
|
lineHeight: "large",
|
|
108
108
|
size: "large",
|
|
109
|
-
weight: '
|
|
109
|
+
weight: 'bold',
|
|
110
110
|
dataId: dataIdPrefix ? "".concat(dataIdPrefix, "-modal-title") : ''
|
|
111
111
|
}, title), subtitle ? /*#__PURE__*/React.createElement(Text, {
|
|
112
112
|
className: 'mt-12',
|
|
@@ -115,6 +115,7 @@ var Modal = function Modal(props) {
|
|
|
115
115
|
dataId: dataIdPrefix ? "".concat(dataIdPrefix, "-modal-title") : ''
|
|
116
116
|
}, subtitle) : null), closeIcon ? /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
117
117
|
className: 'modal__close ml-16',
|
|
118
|
+
size: 'large',
|
|
118
119
|
dataId: dataIdPrefix ? "".concat(dataIdPrefix, "-modal-close-button") : '',
|
|
119
120
|
iconProps: {
|
|
120
121
|
Component: IconDismiss
|
|
@@ -102,7 +102,7 @@ var ModalConfirmation = function ModalConfirmation(props) {
|
|
|
102
102
|
size: 'medium',
|
|
103
103
|
iconProps: iconProps
|
|
104
104
|
}) : null, title ? /*#__PURE__*/React.createElement(Text, {
|
|
105
|
-
weight: "
|
|
105
|
+
weight: "bold",
|
|
106
106
|
lineHeight: "large",
|
|
107
107
|
size: "large",
|
|
108
108
|
dataId: dataIdPrefix ? "".concat(dataIdPrefix, "-modal-title") : ''
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import { ButtonIcon } from '../ButtonIcon/ButtonIcon.js';
|
|
5
4
|
import { IconPanelRight } from '../SVGIcons/IconPanelRight.js';
|
|
@@ -16,6 +15,7 @@ import '../Checkbox/Checkbox.js';
|
|
|
16
15
|
import '../../defineProperty-0a4bc507.js';
|
|
17
16
|
import '../../typeof-6b0bdcf3.js';
|
|
18
17
|
import '../Popover/Popover.js';
|
|
18
|
+
import '../../slicedToArray-803a4350.js';
|
|
19
19
|
import '../../hooks/useGetTooltipStyles.js';
|
|
20
20
|
import '../../hooks/useGetElemSizes.js';
|
|
21
21
|
import '../../hooks/useGetElemPositions.js';
|
|
@@ -35,34 +35,17 @@ import '../ButtonIcon/consts.js';
|
|
|
35
35
|
|
|
36
36
|
var SideNavigation = function SideNavigation(props) {
|
|
37
37
|
var children = props.children,
|
|
38
|
-
_props$isOpen = props.isOpen,
|
|
39
|
-
isOpen = _props$isOpen === void 0 ? true : _props$isOpen,
|
|
40
|
-
setOpen = props.setOpen,
|
|
41
38
|
_props$className = props.className,
|
|
42
39
|
className = _props$className === void 0 ? '' : _props$className,
|
|
43
40
|
logo = props.logo,
|
|
44
41
|
logoClosed = props.logoClosed,
|
|
45
|
-
logoUrl = props.logoUrl
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
setOpen === null || setOpen === void 0 || setOpen(true);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
var onMouseLeave = function onMouseLeave() {
|
|
56
|
-
if (!isPined) {
|
|
57
|
-
setOpen === null || setOpen === void 0 || setOpen(false);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var onPin = function onPin() {
|
|
61
|
-
setPined(!isPined);
|
|
62
|
-
};
|
|
63
|
-
var onClose = function onClose() {
|
|
64
|
-
setOpen === null || setOpen === void 0 || setOpen(false);
|
|
65
|
-
};
|
|
42
|
+
logoUrl = props.logoUrl,
|
|
43
|
+
isOpen = props.isOpen,
|
|
44
|
+
isPined = props.isPined,
|
|
45
|
+
onMouseEnter = props.onMouseEnter,
|
|
46
|
+
onMouseLeave = props.onMouseLeave,
|
|
47
|
+
onPin = props.onPin,
|
|
48
|
+
onClose = props.onClose;
|
|
66
49
|
return /*#__PURE__*/React.createElement("div", {
|
|
67
50
|
onMouseEnter: onMouseEnter,
|
|
68
51
|
onMouseLeave: onMouseLeave,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { SideNavigation } from './SideNavigation.js';
|
|
2
2
|
export { NavigationItem } from './NavigationItem/index.js';
|
|
3
|
-
import '../../slicedToArray-803a4350.js';
|
|
4
3
|
import 'react';
|
|
5
4
|
import 'classnames';
|
|
6
5
|
import '../ButtonIcon/ButtonIcon.js';
|
|
@@ -12,6 +11,7 @@ import '../Checkbox/Checkbox.js';
|
|
|
12
11
|
import '../../defineProperty-0a4bc507.js';
|
|
13
12
|
import '../../typeof-6b0bdcf3.js';
|
|
14
13
|
import '../Popover/Popover.js';
|
|
14
|
+
import '../../slicedToArray-803a4350.js';
|
|
15
15
|
import '../../hooks/useGetTooltipStyles.js';
|
|
16
16
|
import '../../hooks/useGetElemSizes.js';
|
|
17
17
|
import '../../hooks/useGetElemPositions.js';
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { JSX, ReactNode } from 'react';
|
|
2
2
|
import type { ISVGIconProps } from '../SVGIcons/types';
|
|
3
|
-
export interface
|
|
3
|
+
export interface SideNavigationControls {
|
|
4
|
+
isPined?: boolean;
|
|
5
|
+
isOpen?: boolean;
|
|
6
|
+
onOpen?: (open: boolean) => void;
|
|
7
|
+
onMouseEnter?: () => void;
|
|
8
|
+
onMouseLeave?: () => void;
|
|
9
|
+
onPin?: () => void;
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export interface TSideNavigationPropTypes extends SideNavigationControls {
|
|
4
13
|
className?: string;
|
|
5
14
|
logo?: string;
|
|
6
15
|
logoUrl?: string;
|
|
@@ -9,8 +18,6 @@ export interface TSideNavigationPropTypes {
|
|
|
9
18
|
showAction?: boolean;
|
|
10
19
|
children: ReactNode;
|
|
11
20
|
pinSidebar?: boolean;
|
|
12
|
-
isOpen?: boolean;
|
|
13
|
-
setOpen?: (arg: boolean) => void;
|
|
14
21
|
sidebarOpenIconProps?: ISVGIconProps;
|
|
15
22
|
sidebarCloseIconProps?: ISVGIconProps;
|
|
16
23
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { _ as _slicedToArray } from '../slicedToArray-803a4350.js';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
var useSideNavigationControls = function useSideNavigationControls() {
|
|
5
|
+
var _useState = useState(false),
|
|
6
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
7
|
+
isPined = _useState2[0],
|
|
8
|
+
setPined = _useState2[1];
|
|
9
|
+
var _useState3 = useState(false),
|
|
10
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
11
|
+
isOpen = _useState4[0],
|
|
12
|
+
setIsOpen = _useState4[1];
|
|
13
|
+
var onOpen = useCallback(function (open) {
|
|
14
|
+
setIsOpen(open);
|
|
15
|
+
}, []);
|
|
16
|
+
var onMouseEnter = useCallback(function () {
|
|
17
|
+
if (!isPined) {
|
|
18
|
+
onOpen(true);
|
|
19
|
+
}
|
|
20
|
+
}, [isPined, onOpen]);
|
|
21
|
+
var onMouseLeave = useCallback(function () {
|
|
22
|
+
if (!isPined) {
|
|
23
|
+
onOpen(false);
|
|
24
|
+
}
|
|
25
|
+
}, [isPined, onOpen]);
|
|
26
|
+
var onPin = useCallback(function () {
|
|
27
|
+
setPined(function (prev) {
|
|
28
|
+
var newState = !prev;
|
|
29
|
+
if (!newState) onOpen(false);
|
|
30
|
+
return newState;
|
|
31
|
+
});
|
|
32
|
+
}, [onOpen]);
|
|
33
|
+
var onClose = useCallback(function () {
|
|
34
|
+
onOpen(false);
|
|
35
|
+
}, [onOpen]);
|
|
36
|
+
return {
|
|
37
|
+
isPined: isPined,
|
|
38
|
+
isOpen: isOpen,
|
|
39
|
+
onOpen: onOpen,
|
|
40
|
+
onMouseEnter: onMouseEnter,
|
|
41
|
+
onMouseLeave: onMouseLeave,
|
|
42
|
+
onPin: onPin,
|
|
43
|
+
onClose: onClose
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { useSideNavigationControls };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { TSideNavigationPropTypes } from '../components/SideNavigation/types';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: (props: TSideNavigationPropTypes) =>
|
|
5
|
+
component: (props: TSideNavigationPropTypes) => JSX.Element;
|
|
6
6
|
argTypes: {};
|
|
7
7
|
};
|
|
8
8
|
export default _default;
|