@koobiq/react-components 0.0.1-beta.6 → 0.0.1-beta.7
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/dist/components/Modal/Modal.js +14 -12
- package/dist/components/Modal/types.d.ts +7 -0
- package/dist/components/Popover/Popover.js +23 -21
- package/dist/components/Popover/types.d.ts +7 -0
- package/dist/components/SidePanel/SidePanel.js +17 -15
- package/dist/components/SidePanel/types.d.ts +7 -0
- package/dist/components/Tooltip/Tooltip.js +3 -3
- package/package.json +5 -5
|
@@ -9,19 +9,20 @@ import { Backdrop } from "../Backdrop/Backdrop.js";
|
|
|
9
9
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
10
10
|
const Modal = forwardRef((props, ref) => {
|
|
11
11
|
const {
|
|
12
|
-
hideCloseButton = false,
|
|
13
12
|
size = "medium",
|
|
14
|
-
|
|
15
|
-
disableExitOnClickOutside,
|
|
16
|
-
disableFocusManagement,
|
|
17
|
-
portalContainer,
|
|
18
|
-
open: openProp,
|
|
19
|
-
hideBackdrop,
|
|
20
|
-
onOpenChange,
|
|
21
|
-
defaultOpen,
|
|
22
|
-
children,
|
|
13
|
+
hideCloseButton = false,
|
|
23
14
|
control,
|
|
15
|
+
children,
|
|
24
16
|
slotProps,
|
|
17
|
+
defaultOpen,
|
|
18
|
+
hideBackdrop,
|
|
19
|
+
onOpenChange,
|
|
20
|
+
open: openProp,
|
|
21
|
+
portalContainer,
|
|
22
|
+
disableFocusManagement,
|
|
23
|
+
disableExitOnClickOutside,
|
|
24
|
+
disableExitOnEscapeKeyDown,
|
|
25
|
+
shouldCloseOnInteractOutside,
|
|
25
26
|
...other
|
|
26
27
|
} = props;
|
|
27
28
|
const state = useOverlayTriggerState({
|
|
@@ -41,6 +42,7 @@ const Modal = forwardRef((props, ref) => {
|
|
|
41
42
|
const { modalProps: modalCommonProps, underlayProps } = useModalOverlay(
|
|
42
43
|
{
|
|
43
44
|
...props,
|
|
45
|
+
shouldCloseOnInteractOutside,
|
|
44
46
|
isDismissable: !disableExitOnClickOutside,
|
|
45
47
|
isKeyboardDismissDisabled: disableExitOnEscapeKeyDown
|
|
46
48
|
},
|
|
@@ -55,9 +57,9 @@ const Modal = forwardRef((props, ref) => {
|
|
|
55
57
|
};
|
|
56
58
|
const containerProps = mergeProps(
|
|
57
59
|
{
|
|
58
|
-
className: clsx(s.base, s[size]),
|
|
59
60
|
ref: containerRef,
|
|
60
|
-
"data-size": size
|
|
61
|
+
"data-size": size,
|
|
62
|
+
className: clsx(s.base, s[size])
|
|
61
63
|
},
|
|
62
64
|
other
|
|
63
65
|
);
|
|
@@ -58,6 +58,13 @@ export type ModalProps = {
|
|
|
58
58
|
* @default false
|
|
59
59
|
*/
|
|
60
60
|
disableFocusManagement?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* When user interacts with the argument element outside of the overlay ref,
|
|
63
|
+
* return true if onClose should be called. This gives you a chance to filter
|
|
64
|
+
* out interaction with elements that should not dismiss the overlay.
|
|
65
|
+
* By default, onClose will always be called on interaction outside the overlay ref.
|
|
66
|
+
*/
|
|
67
|
+
shouldCloseOnInteractOutside?: (element: Element) => boolean;
|
|
61
68
|
/** The props used for each slot inside. */
|
|
62
69
|
slotProps?: {
|
|
63
70
|
dialog?: DialogProps;
|
|
@@ -10,35 +10,36 @@ import { Dialog } from "../Dialog/Dialog.js";
|
|
|
10
10
|
const Popover = forwardRef(
|
|
11
11
|
(props, ref) => {
|
|
12
12
|
const {
|
|
13
|
-
|
|
14
|
-
arrowBoundaryOffset = 20,
|
|
15
|
-
containerPadding = 12,
|
|
16
|
-
hideArrow = false,
|
|
13
|
+
offset = 0,
|
|
17
14
|
size = "medium",
|
|
18
15
|
crossOffset = 0,
|
|
19
|
-
|
|
16
|
+
hideArrow = false,
|
|
17
|
+
containerPadding = 12,
|
|
18
|
+
arrowBoundaryOffset = 20,
|
|
19
|
+
placement: placementProp = "top",
|
|
20
|
+
control,
|
|
21
|
+
children,
|
|
22
|
+
anchorRef,
|
|
20
23
|
slotProps,
|
|
21
|
-
disableExitOnEscapeKeyDown,
|
|
22
|
-
disableFocusManagement,
|
|
23
|
-
portalContainer,
|
|
24
|
-
hideCloseButton,
|
|
25
|
-
open: openProp,
|
|
26
24
|
className,
|
|
25
|
+
isNonModal,
|
|
27
26
|
defaultOpen,
|
|
28
27
|
onOpenChange,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
open: openProp,
|
|
29
|
+
portalContainer,
|
|
30
|
+
hideCloseButton,
|
|
31
|
+
disableFocusManagement,
|
|
32
|
+
disableExitOnEscapeKeyDown,
|
|
33
|
+
shouldCloseOnInteractOutside,
|
|
33
34
|
...other
|
|
34
35
|
} = props;
|
|
35
36
|
const showArrow = !hideArrow;
|
|
36
37
|
const domRef = useDOMRef(ref);
|
|
37
38
|
const controlRef = useRef(null);
|
|
38
39
|
const state = useOverlayTriggerState({
|
|
39
|
-
isOpen: openProp,
|
|
40
|
-
onOpenChange,
|
|
41
40
|
defaultOpen,
|
|
41
|
+
onOpenChange,
|
|
42
|
+
isOpen: openProp,
|
|
42
43
|
...other
|
|
43
44
|
});
|
|
44
45
|
const openState = state.isOpen;
|
|
@@ -63,8 +64,9 @@ const Popover = forwardRef(
|
|
|
63
64
|
popoverRef: domRef,
|
|
64
65
|
arrowBoundaryOffset,
|
|
65
66
|
placement: placementProp,
|
|
66
|
-
|
|
67
|
-
triggerRef: anchorRef || controlRef
|
|
67
|
+
shouldCloseOnInteractOutside,
|
|
68
|
+
triggerRef: anchorRef || controlRef,
|
|
69
|
+
isKeyboardDismissDisabled: disableExitOnEscapeKeyDown
|
|
68
70
|
},
|
|
69
71
|
{ ...state, isOpen: opened }
|
|
70
72
|
);
|
|
@@ -83,9 +85,9 @@ const Popover = forwardRef(
|
|
|
83
85
|
const dialogProps = mergeProps(
|
|
84
86
|
{
|
|
85
87
|
role: "dialog",
|
|
88
|
+
hideCloseButton,
|
|
86
89
|
className: s.dialog,
|
|
87
|
-
onClose: state.close
|
|
88
|
-
hideCloseButton
|
|
90
|
+
onClose: state.close
|
|
89
91
|
},
|
|
90
92
|
slotProps?.dialog
|
|
91
93
|
);
|
|
@@ -98,8 +100,8 @@ const Popover = forwardRef(
|
|
|
98
100
|
);
|
|
99
101
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
100
102
|
control?.({
|
|
101
|
-
onClick: onPress,
|
|
102
103
|
ref: controlRef,
|
|
104
|
+
onClick: onPress,
|
|
103
105
|
disabled: isDisabled,
|
|
104
106
|
...otherTriggerProps
|
|
105
107
|
}),
|
|
@@ -95,6 +95,13 @@ export type PopoverProps = {
|
|
|
95
95
|
* @default 0
|
|
96
96
|
*/
|
|
97
97
|
crossOffset?: number;
|
|
98
|
+
/**
|
|
99
|
+
* When user interacts with the argument element outside of the popover ref,
|
|
100
|
+
* return true if onClose should be called. This gives you a chance to filter
|
|
101
|
+
* out interaction with elements that should not dismiss the popover.
|
|
102
|
+
* By default, onClose will always be called on interaction outside the popover ref.
|
|
103
|
+
*/
|
|
104
|
+
shouldCloseOnInteractOutside?: (element: Element) => boolean;
|
|
98
105
|
/** The props used for each slot inside. */
|
|
99
106
|
slotProps?: {
|
|
100
107
|
dialog?: DialogProps;
|
|
@@ -10,20 +10,21 @@ import { Dialog } from "../Dialog/Dialog.js";
|
|
|
10
10
|
const SidePanel = forwardRef(
|
|
11
11
|
(props, ref) => {
|
|
12
12
|
const {
|
|
13
|
-
hideCloseButton = false,
|
|
14
|
-
position = "left",
|
|
15
13
|
size = "medium",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
disableFocusManagement,
|
|
19
|
-
portalContainer,
|
|
20
|
-
open: openProp,
|
|
21
|
-
hideBackdrop,
|
|
22
|
-
onOpenChange,
|
|
23
|
-
defaultOpen,
|
|
24
|
-
children,
|
|
14
|
+
position = "left",
|
|
15
|
+
hideCloseButton = false,
|
|
25
16
|
control,
|
|
17
|
+
children,
|
|
26
18
|
slotProps,
|
|
19
|
+
defaultOpen,
|
|
20
|
+
onOpenChange,
|
|
21
|
+
hideBackdrop,
|
|
22
|
+
open: openProp,
|
|
23
|
+
portalContainer,
|
|
24
|
+
disableFocusManagement,
|
|
25
|
+
disableExitOnClickOutside,
|
|
26
|
+
disableExitOnEscapeKeyDown,
|
|
27
|
+
shouldCloseOnInteractOutside,
|
|
27
28
|
...other
|
|
28
29
|
} = props;
|
|
29
30
|
const state = useOverlayTriggerState({
|
|
@@ -43,6 +44,7 @@ const SidePanel = forwardRef(
|
|
|
43
44
|
const { modalProps: modalCommonProps, underlayProps } = useModalOverlay(
|
|
44
45
|
{
|
|
45
46
|
...props,
|
|
47
|
+
shouldCloseOnInteractOutside,
|
|
46
48
|
isDismissable: !disableExitOnClickOutside,
|
|
47
49
|
isKeyboardDismissDisabled: disableExitOnEscapeKeyDown
|
|
48
50
|
},
|
|
@@ -57,10 +59,10 @@ const SidePanel = forwardRef(
|
|
|
57
59
|
};
|
|
58
60
|
const containerProps = mergeProps(
|
|
59
61
|
{
|
|
60
|
-
|
|
62
|
+
ref: containerRef,
|
|
61
63
|
"data-size": size,
|
|
62
64
|
"data-position": position,
|
|
63
|
-
|
|
65
|
+
className: clsx(s.base, s[size], s[position])
|
|
64
66
|
},
|
|
65
67
|
other
|
|
66
68
|
);
|
|
@@ -81,8 +83,8 @@ const SidePanel = forwardRef(
|
|
|
81
83
|
const panelProps = mergeProps(
|
|
82
84
|
modalCommonProps,
|
|
83
85
|
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
ref: modalRef,
|
|
87
|
+
className: s.panel
|
|
86
88
|
},
|
|
87
89
|
slotProps?.panel
|
|
88
90
|
);
|
|
@@ -65,6 +65,13 @@ export type SidePanelProps = {
|
|
|
65
65
|
* @default false
|
|
66
66
|
*/
|
|
67
67
|
disableFocusManagement?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* When user interacts with the argument element outside of the overlay ref,
|
|
70
|
+
* return true if onClose should be called. This gives you a chance to filter
|
|
71
|
+
* out interaction with elements that should not dismiss the overlay.
|
|
72
|
+
* By default, onClose will always be called on interaction outside the overlay ref.
|
|
73
|
+
*/
|
|
74
|
+
shouldCloseOnInteractOutside?: (element: Element) => boolean;
|
|
68
75
|
/** The props used for each slot inside. */
|
|
69
76
|
slotProps?: {
|
|
70
77
|
dialog?: DialogProps;
|
|
@@ -10,20 +10,20 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
10
10
|
const {
|
|
11
11
|
delay = 120,
|
|
12
12
|
disabled = false,
|
|
13
|
-
defaultOpen,
|
|
14
13
|
closeDelay = 120,
|
|
15
14
|
hideArrow = false,
|
|
16
15
|
variant = "contrast",
|
|
17
|
-
onOpenChange,
|
|
18
16
|
placement: placementProp = "top",
|
|
19
17
|
control,
|
|
20
18
|
children,
|
|
21
19
|
anchorRef,
|
|
22
20
|
crossOffset,
|
|
21
|
+
defaultOpen,
|
|
22
|
+
onOpenChange,
|
|
23
23
|
open: openProp,
|
|
24
|
+
portalContainer,
|
|
24
25
|
offset: offsetProp,
|
|
25
26
|
arrowBoundaryOffset,
|
|
26
|
-
portalContainer,
|
|
27
27
|
...other
|
|
28
28
|
} = props;
|
|
29
29
|
const showArrow = !hideArrow;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koobiq/react-components",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.7",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"@koobiq/design-tokens": "^3.12.1",
|
|
23
23
|
"@types/react-transition-group": "^4.4.12",
|
|
24
24
|
"react-transition-group": "^4.4.5",
|
|
25
|
-
"@koobiq/logger": "0.0.1-beta.
|
|
26
|
-
"@koobiq/react-icons": "0.0.1-beta.
|
|
27
|
-
"@koobiq/react-
|
|
28
|
-
"@koobiq/react-
|
|
25
|
+
"@koobiq/logger": "0.0.1-beta.7",
|
|
26
|
+
"@koobiq/react-icons": "0.0.1-beta.7",
|
|
27
|
+
"@koobiq/react-core": "0.0.1-beta.7",
|
|
28
|
+
"@koobiq/react-primitives": "0.0.1-beta.7"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@koobiq/design-tokens": "^3.11.2",
|