@koobiq/react-components 0.0.1-beta.34 → 0.0.1-beta.35
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/Calendar/Calendar.d.ts +2 -2
- package/dist/components/Calendar/types.d.ts +1 -1
- package/dist/components/DateInput/DateInput.d.ts +2 -2
- package/dist/components/DateInput/types.d.ts +1 -1
- package/dist/components/List/List.d.ts +2 -2
- package/dist/components/List/types.d.ts +1 -1
- package/dist/components/Menu/Menu.d.ts +2 -2
- package/dist/components/Menu/Menu.js +9 -1
- package/dist/components/Menu/components/MenuInner/MenuInner.d.ts +2 -2
- package/dist/components/Menu/types.d.ts +13 -3
- package/dist/components/Modal/Modal.d.ts +26 -3
- package/dist/components/Modal/Modal.js +20 -8
- package/dist/components/Modal/types.d.ts +12 -2
- package/dist/components/Popover/Popover.d.ts +34 -1
- package/dist/components/Popover/Popover.js +15 -2
- package/dist/components/Popover/PopoverInner.js +1 -0
- package/dist/components/Popover/types.d.ts +14 -2
- package/dist/components/Select/Select.d.ts +2 -2
- package/dist/components/Select/types.d.ts +1 -1
- package/dist/components/SidePanel/SidePanel.d.ts +28 -3
- package/dist/components/SidePanel/SidePanel.js +24 -10
- package/dist/components/SidePanel/SidePanel.module.css.js +7 -1
- package/dist/components/SidePanel/types.d.ts +24 -4
- package/dist/components/SidePanel/types.js +2 -0
- package/dist/components/Table/Table.d.ts +2 -2
- package/dist/components/Table/types.d.ts +1 -1
- package/dist/components/TagGroup/TagGroup.d.ts +2 -2
- package/dist/components/TagGroup/components/TagInner/TagInner.js +2 -2
- package/dist/components/TagGroup/types.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/style.css +10 -0
- package/package.json +5 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const Calendar:
|
|
1
|
+
import type { CalendarComponent } from './types';
|
|
2
|
+
export declare const Calendar: CalendarComponent;
|
|
@@ -44,6 +44,6 @@ export type CalendarProps<T extends DateValue> = {
|
|
|
44
44
|
/** Handler that is called when the focused date changes. */
|
|
45
45
|
onFocusChange?: CalendarPropOnFocusChange<T>;
|
|
46
46
|
};
|
|
47
|
-
export type
|
|
47
|
+
export type CalendarComponent = <T extends DateValue>(props: CalendarProps<T>) => ReactElement | null;
|
|
48
48
|
export type CalendarRef = ComponentRef<'div'>;
|
|
49
49
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
2
|
import type { DateValue } from '@koobiq/react-primitives';
|
|
3
|
-
import type { DateInputRef, DateInputProps,
|
|
3
|
+
import type { DateInputRef, DateInputProps, DateInputComponent } from './types';
|
|
4
4
|
export declare function DateInputRender<T extends DateValue>(props: Omit<DateInputProps<T>, 'ref'>, ref: Ref<DateInputRef>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export declare const DateInput:
|
|
5
|
+
export declare const DateInput: DateInputComponent;
|
|
@@ -43,5 +43,5 @@ export type DateInputProps<T extends DateValue> = {
|
|
|
43
43
|
/** Addon placed after the children. */
|
|
44
44
|
endAddon?: ReactNode;
|
|
45
45
|
} & Omit<AriaDateFieldProps<T>, 'description' | 'validationBehavior' | 'validate' | 'validationState'>;
|
|
46
|
-
export type
|
|
46
|
+
export type DateInputComponent = <T extends DateValue>(props: DateInputProps<T>) => ReactElement | null;
|
|
47
47
|
export type DateInputRef = ComponentRef<'div'>;
|
|
@@ -2,13 +2,13 @@ import type { Ref } from 'react';
|
|
|
2
2
|
import { type ListState } from '@koobiq/react-primitives';
|
|
3
3
|
import { Item, Section } from '../Collections';
|
|
4
4
|
import { ListItemText } from './components';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ListComponent, ListBaseProps } from './types';
|
|
6
6
|
export type ListInnerProps<T extends object> = {
|
|
7
7
|
state: ListState<T>;
|
|
8
8
|
listRef?: Ref<HTMLUListElement>;
|
|
9
9
|
} & Omit<ListBaseProps<T>, 'ref'>;
|
|
10
10
|
export declare function ListInner<T extends object>(props: ListInnerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
declare const ListComponent:
|
|
11
|
+
declare const ListComponent: ListComponent;
|
|
12
12
|
type CompoundedComponent = typeof ListComponent & {
|
|
13
13
|
Item: typeof Item;
|
|
14
14
|
Section: typeof Section;
|
|
@@ -50,4 +50,4 @@ export type ListBaseProps<T extends object> = {
|
|
|
50
50
|
};
|
|
51
51
|
export type ListProps<T extends object> = ListBaseProps<T>;
|
|
52
52
|
export type ListRef = ComponentRef<'ul'>;
|
|
53
|
-
export type
|
|
53
|
+
export type ListComponent = <T extends object>(props: ListProps<T>) => ReactElement | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Pressable } from '@koobiq/react-core';
|
|
2
2
|
import { Divider, Item, Section, Header } from '../Collections';
|
|
3
3
|
import { ListItemText } from '../List';
|
|
4
|
-
import type {
|
|
5
|
-
declare const MenuComponent:
|
|
4
|
+
import type { MenuComponent } from './index';
|
|
5
|
+
declare const MenuComponent: MenuComponent;
|
|
6
6
|
type CompoundedComponent = typeof MenuComponent & {
|
|
7
7
|
Item: typeof Item;
|
|
8
8
|
Header: typeof Header;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useRef } from "react";
|
|
4
|
+
import { deprecate } from "@koobiq/logger";
|
|
4
5
|
import { useDOMRef, mergeProps, clsx, Pressable } from "@koobiq/react-core";
|
|
5
6
|
import { useMenuTriggerState, useMenuTrigger } from "@koobiq/react-primitives";
|
|
6
7
|
import { PopoverInner } from "../Popover/PopoverInner.js";
|
|
@@ -18,12 +19,19 @@ function MenuRender(props, ref) {
|
|
|
18
19
|
control,
|
|
19
20
|
style,
|
|
20
21
|
open,
|
|
22
|
+
isOpen: isOpenProp,
|
|
21
23
|
anchorRef,
|
|
22
24
|
className,
|
|
23
25
|
slotProps,
|
|
24
26
|
...other
|
|
25
27
|
} = props;
|
|
26
|
-
const
|
|
28
|
+
const isOpen = isOpenProp ?? open;
|
|
29
|
+
if (process.env.NODE_ENV !== "production" && "open" in props) {
|
|
30
|
+
deprecate(
|
|
31
|
+
'Menu: the "open" prop is deprecated. Use "isOpen" prop to replace it.'
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
const state = useMenuTriggerState({ ...props, isOpen });
|
|
27
35
|
const domRef = useDOMRef(ref);
|
|
28
36
|
const controlRef = useRef(null);
|
|
29
37
|
const { menuTriggerProps, menuProps } = useMenuTrigger(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentRef, ReactElement } from 'react';
|
|
2
2
|
import type { AriaMenuOptions } from '@koobiq/react-primitives';
|
|
3
3
|
export type MenuInnerProps<T> = AriaMenuOptions<T>;
|
|
4
|
-
export type
|
|
4
|
+
export type MenuInnerComponent = <T extends object>(props: MenuInnerProps<T>) => ReactElement | null;
|
|
5
5
|
export type MenuInnerRef = ComponentRef<'ul'>;
|
|
6
|
-
export declare const MenuInner:
|
|
6
|
+
export declare const MenuInner: MenuInnerComponent;
|
|
@@ -13,6 +13,15 @@ export type MenuPropSelected<T extends object> = AriaMenuProps<T>['selectedKeys'
|
|
|
13
13
|
export type MenuPropSelectionChange<T extends object> = AriaMenuProps<T>['onSelectionChange'];
|
|
14
14
|
export type MenuPropDisabledKeys<T extends object> = AriaMenuProps<T>['disabledKeys'];
|
|
15
15
|
export type MenuPropPlacement = PopoverPropPlacement;
|
|
16
|
+
type MenuDeprecatedProps = {
|
|
17
|
+
/**
|
|
18
|
+
* If `true`, the component is shown.
|
|
19
|
+
*
|
|
20
|
+
* @deprecated
|
|
21
|
+
* The "open" prop is deprecated. Use "isOpen" prop to replace it.
|
|
22
|
+
*/
|
|
23
|
+
open?: boolean;
|
|
24
|
+
};
|
|
16
25
|
export type MenuProps<T extends object> = {
|
|
17
26
|
/** Additional CSS-classes. */
|
|
18
27
|
className?: string;
|
|
@@ -25,7 +34,7 @@ export type MenuProps<T extends object> = {
|
|
|
25
34
|
/** The render function of the control for displaying the modal window. */
|
|
26
35
|
control?: MenuPropControl;
|
|
27
36
|
/** Whether the overlay is open by default (controlled). */
|
|
28
|
-
|
|
37
|
+
isOpen?: boolean;
|
|
29
38
|
/** Whether the overlay is open by default (uncontrolled). */
|
|
30
39
|
defaultOpen?: boolean;
|
|
31
40
|
/** Handler that is called when the overlay's open state changes. */
|
|
@@ -58,6 +67,7 @@ export type MenuProps<T extends object> = {
|
|
|
58
67
|
popover?: PopoverBaseProps;
|
|
59
68
|
list?: ComponentPropsWithRef<'ul'>;
|
|
60
69
|
};
|
|
61
|
-
};
|
|
62
|
-
export type
|
|
70
|
+
} & MenuDeprecatedProps;
|
|
71
|
+
export type MenuComponent = <T extends object>(props: MenuProps<T>) => ReactElement | null;
|
|
63
72
|
export type MenuRef = ComponentRef<'div'>;
|
|
73
|
+
export {};
|
|
@@ -1,6 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
3
|
-
declare const ModalComponent: import("react").ForwardRefExoticComponent<
|
|
1
|
+
import { type BackdropProps } from '../Backdrop';
|
|
2
|
+
import { Dialog, type DialogProps } from '../Dialog';
|
|
3
|
+
declare const ModalComponent: import("react").ForwardRefExoticComponent<{
|
|
4
|
+
size?: import("./types").ModalPropSize;
|
|
5
|
+
isOpen?: boolean;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
children?: import("./types").ModalPropContent;
|
|
8
|
+
control?: import("./types").ModalPropControl;
|
|
9
|
+
hideCloseButton?: boolean;
|
|
10
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
portalContainer?: Element;
|
|
12
|
+
disableExitOnClickOutside?: boolean;
|
|
13
|
+
disableExitOnEscapeKeyDown?: boolean;
|
|
14
|
+
hideBackdrop?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
'data-testid'?: string | number;
|
|
17
|
+
disableFocusManagement?: boolean;
|
|
18
|
+
shouldCloseOnInteractOutside?: (element: Element) => boolean;
|
|
19
|
+
slotProps?: {
|
|
20
|
+
dialog?: DialogProps;
|
|
21
|
+
backdrop?: BackdropProps;
|
|
22
|
+
modal?: import("react").ComponentPropsWithRef<"div">;
|
|
23
|
+
};
|
|
24
|
+
} & {
|
|
25
|
+
open?: boolean;
|
|
26
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
27
|
type CompoundedComponent = typeof ModalComponent & {
|
|
5
28
|
Header: typeof Dialog.Header;
|
|
6
29
|
Body: typeof Dialog.Body;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, cloneElement, isValidElement } from "react";
|
|
4
|
+
import { deprecate } from "@koobiq/logger";
|
|
4
5
|
import { useBoolean, useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
|
|
5
6
|
import { useOverlayTriggerState, useOverlayTrigger, useModalOverlay, Overlay } from "@koobiq/react-primitives";
|
|
6
7
|
import { Transition } from "react-transition-group";
|
|
@@ -17,7 +18,8 @@ const ModalComponent = forwardRef((props, ref) => {
|
|
|
17
18
|
defaultOpen,
|
|
18
19
|
hideBackdrop,
|
|
19
20
|
onOpenChange,
|
|
20
|
-
open
|
|
21
|
+
open,
|
|
22
|
+
isOpen: isOpenProp,
|
|
21
23
|
portalContainer,
|
|
22
24
|
disableFocusManagement,
|
|
23
25
|
disableExitOnClickOutside,
|
|
@@ -25,19 +27,25 @@ const ModalComponent = forwardRef((props, ref) => {
|
|
|
25
27
|
shouldCloseOnInteractOutside,
|
|
26
28
|
...other
|
|
27
29
|
} = props;
|
|
30
|
+
const isOpen = isOpenProp ?? open;
|
|
31
|
+
if (process.env.NODE_ENV !== "production" && "open" in props) {
|
|
32
|
+
deprecate(
|
|
33
|
+
'Modal: the "open" prop is deprecated. Use "isOpen" prop to replace it.'
|
|
34
|
+
);
|
|
35
|
+
}
|
|
28
36
|
const state = useOverlayTriggerState({
|
|
29
|
-
isOpen
|
|
37
|
+
isOpen,
|
|
30
38
|
onOpenChange,
|
|
31
39
|
defaultOpen,
|
|
32
40
|
...other
|
|
33
41
|
});
|
|
34
|
-
const { isOpen:
|
|
35
|
-
const [
|
|
42
|
+
const { isOpen: isOpenState, close } = state;
|
|
43
|
+
const [isOpened, { on, off }] = useBoolean(isOpenState);
|
|
36
44
|
const modalRef = useDOMRef(null);
|
|
37
45
|
const containerRef = useDOMRef(ref);
|
|
38
46
|
const { triggerProps, overlayProps } = useOverlayTrigger(
|
|
39
47
|
{ type: "dialog" },
|
|
40
|
-
{ ...state, isOpen:
|
|
48
|
+
{ ...state, isOpen: isOpenState }
|
|
41
49
|
);
|
|
42
50
|
const { modalProps: modalCommonProps, underlayProps } = useModalOverlay(
|
|
43
51
|
{
|
|
@@ -46,7 +54,7 @@ const ModalComponent = forwardRef((props, ref) => {
|
|
|
46
54
|
isDismissable: !disableExitOnClickOutside,
|
|
47
55
|
isKeyboardDismissDisabled: disableExitOnEscapeKeyDown
|
|
48
56
|
},
|
|
49
|
-
{ ...state, isOpen:
|
|
57
|
+
{ ...state, isOpen: isOpened },
|
|
50
58
|
modalRef
|
|
51
59
|
);
|
|
52
60
|
const resolvedChildren = () => {
|
|
@@ -63,7 +71,11 @@ const ModalComponent = forwardRef((props, ref) => {
|
|
|
63
71
|
},
|
|
64
72
|
other
|
|
65
73
|
);
|
|
66
|
-
const backdropProps = mergeProps(
|
|
74
|
+
const backdropProps = mergeProps(
|
|
75
|
+
{ isOpen: isOpenState && !hideBackdrop },
|
|
76
|
+
underlayProps,
|
|
77
|
+
slotProps?.backdrop
|
|
78
|
+
);
|
|
67
79
|
const dialogProps = mergeProps(
|
|
68
80
|
{
|
|
69
81
|
onClose: close,
|
|
@@ -89,7 +101,7 @@ const ModalComponent = forwardRef((props, ref) => {
|
|
|
89
101
|
onEnter: on,
|
|
90
102
|
timeout: 300,
|
|
91
103
|
onExited: off,
|
|
92
|
-
in:
|
|
104
|
+
in: isOpenState,
|
|
93
105
|
nodeRef: containerRef,
|
|
94
106
|
unmountOnExit: true,
|
|
95
107
|
appear: true,
|
|
@@ -8,6 +8,15 @@ export type ModalPropContent = ReactNode | ((props: {
|
|
|
8
8
|
close(): void;
|
|
9
9
|
}) => ReactElement);
|
|
10
10
|
export type ModalPropControl = (props: ButtonOptions) => ReactElement;
|
|
11
|
+
type ModalDeprecatedProps = {
|
|
12
|
+
/**
|
|
13
|
+
* If `true`, the component is shown.
|
|
14
|
+
*
|
|
15
|
+
* @deprecated
|
|
16
|
+
* The "open" prop is deprecated. Use "isOpen" prop to replace it.
|
|
17
|
+
*/
|
|
18
|
+
open?: boolean;
|
|
19
|
+
};
|
|
11
20
|
export type ModalProps = {
|
|
12
21
|
/**
|
|
13
22
|
* Component width size.
|
|
@@ -15,7 +24,7 @@ export type ModalProps = {
|
|
|
15
24
|
*/
|
|
16
25
|
size?: ModalPropSize;
|
|
17
26
|
/** If `true`, the component is shown. */
|
|
18
|
-
|
|
27
|
+
isOpen?: boolean;
|
|
19
28
|
/** The default open state. Use when the component is not controlled. */
|
|
20
29
|
defaultOpen?: boolean;
|
|
21
30
|
/** The content of the component. */
|
|
@@ -71,5 +80,6 @@ export type ModalProps = {
|
|
|
71
80
|
backdrop?: BackdropProps;
|
|
72
81
|
modal?: ComponentPropsWithRef<'div'>;
|
|
73
82
|
};
|
|
74
|
-
};
|
|
83
|
+
} & ModalDeprecatedProps;
|
|
75
84
|
export type ModalRef = ComponentRef<'div'>;
|
|
85
|
+
export {};
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
import { Dialog } from '../Dialog';
|
|
2
|
-
declare const PopoverComponent: import("react").ForwardRefExoticComponent<
|
|
2
|
+
declare const PopoverComponent: import("react").ForwardRefExoticComponent<{
|
|
3
|
+
isOpen?: boolean;
|
|
4
|
+
defaultOpen?: boolean;
|
|
5
|
+
children?: import("./types").PopoverPropContent;
|
|
6
|
+
control?: import("./types").PopoverPropControl;
|
|
7
|
+
size?: import("./types").PopoverPropSize;
|
|
8
|
+
hideCloseButton?: boolean;
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
portalContainer?: Element;
|
|
11
|
+
disableExitOnEscapeKeyDown?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: import("react").CSSProperties;
|
|
14
|
+
'data-testid'?: string | number;
|
|
15
|
+
disableFocusManagement?: boolean;
|
|
16
|
+
placement?: import("./types").PopoverPropPlacement;
|
|
17
|
+
anchorRef?: import("react").RefObject<HTMLElement | null>;
|
|
18
|
+
hideArrow?: boolean;
|
|
19
|
+
isNonModal?: boolean;
|
|
20
|
+
arrowBoundaryOffset?: number;
|
|
21
|
+
containerPadding?: number;
|
|
22
|
+
offset?: number;
|
|
23
|
+
crossOffset?: number;
|
|
24
|
+
shouldCloseOnInteractOutside?: (element: Element) => boolean;
|
|
25
|
+
type?: import("./types").PopoverPropType;
|
|
26
|
+
maxBlockSize?: number;
|
|
27
|
+
slotProps?: {
|
|
28
|
+
dialog?: import("../Dialog").DialogProps;
|
|
29
|
+
arrow?: import("react").ComponentPropsWithRef<"div">;
|
|
30
|
+
backdrop?: import("react").ComponentPropsWithRef<"div">;
|
|
31
|
+
transition?: Partial<import("react-transition-group/Transition").TransitionProps<HTMLElement>>;
|
|
32
|
+
};
|
|
33
|
+
} & {
|
|
34
|
+
open?: boolean;
|
|
35
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
36
|
type CompoundedComponent = typeof PopoverComponent & {
|
|
4
37
|
Header: typeof Dialog.Header;
|
|
5
38
|
Body: typeof Dialog.Body;
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
|
+
import { deprecate } from "@koobiq/logger";
|
|
4
5
|
import { useOverlayTriggerState } from "@koobiq/react-primitives";
|
|
5
6
|
import { PopoverInner } from "./PopoverInner.js";
|
|
6
7
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
7
8
|
const PopoverComponent = forwardRef(
|
|
8
9
|
(props, ref) => {
|
|
9
|
-
const {
|
|
10
|
+
const {
|
|
11
|
+
open,
|
|
12
|
+
isOpen: isOpenProp,
|
|
13
|
+
onOpenChange,
|
|
14
|
+
defaultOpen,
|
|
15
|
+
...other
|
|
16
|
+
} = props;
|
|
17
|
+
const isOpen = isOpenProp ?? open;
|
|
18
|
+
if (process.env.NODE_ENV !== "production" && "open" in props) {
|
|
19
|
+
deprecate(
|
|
20
|
+
'Popover: the "open" prop is deprecated. Use "isOpen" prop to replace it.'
|
|
21
|
+
);
|
|
22
|
+
}
|
|
10
23
|
const state = useOverlayTriggerState({
|
|
11
|
-
isOpen
|
|
24
|
+
isOpen,
|
|
12
25
|
onOpenChange,
|
|
13
26
|
defaultOpen,
|
|
14
27
|
...other
|
|
@@ -14,9 +14,18 @@ export declare const popoverPropSize: readonly ["small", "medium", "large"];
|
|
|
14
14
|
export type PopoverPropSize = (typeof popoverPropSize)[number] | CSSProperties['inlineSize'];
|
|
15
15
|
export declare const popoverPropType: readonly ["dialog", "menu", "listbox", "tree", "grid"];
|
|
16
16
|
export type PopoverPropType = (typeof popoverPropType)[number];
|
|
17
|
+
type PopoverDeprecatedProps = {
|
|
18
|
+
/**
|
|
19
|
+
* If `true`, the component is shown.
|
|
20
|
+
*
|
|
21
|
+
* @deprecated
|
|
22
|
+
* The "open" prop is deprecated. Use "isOpen" prop to replace it.
|
|
23
|
+
*/
|
|
24
|
+
open?: boolean;
|
|
25
|
+
};
|
|
17
26
|
export type PopoverBaseProps = {
|
|
18
27
|
/** If `true`, the component is shown. */
|
|
19
|
-
|
|
28
|
+
isOpen?: boolean;
|
|
20
29
|
/** The default open state. Use when the component is not controlled. */
|
|
21
30
|
defaultOpen?: boolean;
|
|
22
31
|
/** The content of the component. */
|
|
@@ -47,6 +56,8 @@ export type PopoverBaseProps = {
|
|
|
47
56
|
disableExitOnEscapeKeyDown?: boolean;
|
|
48
57
|
/** Additional CSS-classes. */
|
|
49
58
|
className?: string;
|
|
59
|
+
/** Inline styles. */
|
|
60
|
+
style?: CSSProperties;
|
|
50
61
|
/** Unique identifier for testing purposes. */
|
|
51
62
|
'data-testid'?: string | number;
|
|
52
63
|
/**
|
|
@@ -118,9 +129,10 @@ export type PopoverBaseProps = {
|
|
|
118
129
|
backdrop?: ComponentPropsWithRef<'div'>;
|
|
119
130
|
transition?: Partial<TransitionProps<HTMLElement>>;
|
|
120
131
|
};
|
|
121
|
-
};
|
|
132
|
+
} & PopoverDeprecatedProps;
|
|
122
133
|
export type PopoverInnerProps = {
|
|
123
134
|
state: OverlayTriggerState;
|
|
124
135
|
popoverRef?: Ref<HTMLDivElement>;
|
|
125
136
|
} & Omit<PopoverBaseProps, 'ref'>;
|
|
126
137
|
export type PopoverProps = PopoverBaseProps;
|
|
138
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Item, Section } from '../Collections';
|
|
2
2
|
import { ListItemText } from '../List';
|
|
3
|
-
import type {
|
|
4
|
-
declare const SelectComponent:
|
|
3
|
+
import type { SelectComponent } from './index';
|
|
4
|
+
declare const SelectComponent: SelectComponent;
|
|
5
5
|
type CompoundedComponent = typeof SelectComponent & {
|
|
6
6
|
Item: typeof Item;
|
|
7
7
|
Section: typeof Section;
|
|
@@ -124,6 +124,6 @@ export type SelectProps<T extends object> = {
|
|
|
124
124
|
errorMessage?: FieldErrorProps;
|
|
125
125
|
};
|
|
126
126
|
} & SelectDeprecatedProps;
|
|
127
|
-
export type
|
|
127
|
+
export type SelectComponent = <T extends object>(props: SelectProps<T>) => ReactElement | null;
|
|
128
128
|
export type SelectRef = ComponentRef<'button'>;
|
|
129
129
|
export {};
|
|
@@ -1,6 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
3
|
-
declare const SidePanelComponent: import("react").ForwardRefExoticComponent<
|
|
1
|
+
import { type BackdropProps } from '../Backdrop';
|
|
2
|
+
import { Dialog, type DialogProps } from '../Dialog';
|
|
3
|
+
declare const SidePanelComponent: import("react").ForwardRefExoticComponent<{
|
|
4
|
+
size?: import("./types").SidePanelPropSize;
|
|
5
|
+
placement?: import("./types").SidePanelPropPlacement;
|
|
6
|
+
isOpen?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
children?: import("./types").SidePanelPropContent;
|
|
9
|
+
control?: import("./types").SidePanelPropControl;
|
|
10
|
+
hideCloseButton?: boolean;
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
portalContainer?: Element;
|
|
13
|
+
disableExitOnClickOutside?: boolean;
|
|
14
|
+
disableExitOnEscapeKeyDown?: boolean;
|
|
15
|
+
hideBackdrop?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
'data-testid'?: string | number;
|
|
18
|
+
disableFocusManagement?: boolean;
|
|
19
|
+
shouldCloseOnInteractOutside?: (element: Element) => boolean;
|
|
20
|
+
slotProps?: {
|
|
21
|
+
dialog?: DialogProps;
|
|
22
|
+
backdrop?: BackdropProps;
|
|
23
|
+
panel?: import("react").ComponentPropsWithRef<"div">;
|
|
24
|
+
};
|
|
25
|
+
} & {
|
|
26
|
+
open?: boolean;
|
|
27
|
+
position?: import("./types").SidePanelPropPosition;
|
|
28
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
29
|
type CompoundedComponent = typeof SidePanelComponent & {
|
|
5
30
|
Header: typeof Dialog.Header;
|
|
6
31
|
Body: typeof Dialog.Body;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, cloneElement, isValidElement } from "react";
|
|
4
|
+
import { deprecate } from "@koobiq/logger";
|
|
4
5
|
import { useBoolean, useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
|
|
5
6
|
import { useOverlayTriggerState, useOverlayTrigger, useModalOverlay, Overlay } from "@koobiq/react-primitives";
|
|
6
7
|
import { Transition } from "react-transition-group";
|
|
@@ -12,6 +13,7 @@ const SidePanelComponent = forwardRef(
|
|
|
12
13
|
const {
|
|
13
14
|
size = "medium",
|
|
14
15
|
position = "left",
|
|
16
|
+
placement = "start",
|
|
15
17
|
hideCloseButton = false,
|
|
16
18
|
control,
|
|
17
19
|
children,
|
|
@@ -19,7 +21,8 @@ const SidePanelComponent = forwardRef(
|
|
|
19
21
|
defaultOpen,
|
|
20
22
|
onOpenChange,
|
|
21
23
|
hideBackdrop,
|
|
22
|
-
open
|
|
24
|
+
open,
|
|
25
|
+
isOpen: isOpenProp,
|
|
23
26
|
portalContainer,
|
|
24
27
|
disableFocusManagement,
|
|
25
28
|
disableExitOnClickOutside,
|
|
@@ -27,19 +30,30 @@ const SidePanelComponent = forwardRef(
|
|
|
27
30
|
shouldCloseOnInteractOutside,
|
|
28
31
|
...other
|
|
29
32
|
} = props;
|
|
33
|
+
const isOpen = isOpenProp ?? open;
|
|
34
|
+
if (process.env.NODE_ENV !== "production" && "open" in props) {
|
|
35
|
+
deprecate(
|
|
36
|
+
'SidePanel: the "open" prop is deprecated. Use "isOpen" prop to replace it.'
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
if (process.env.NODE_ENV !== "production" && "position" in props) {
|
|
40
|
+
deprecate(
|
|
41
|
+
'SidePanel: the "position" prop is deprecated. Use "placement" prop to replace it.'
|
|
42
|
+
);
|
|
43
|
+
}
|
|
30
44
|
const state = useOverlayTriggerState({
|
|
31
|
-
isOpen
|
|
45
|
+
isOpen,
|
|
32
46
|
onOpenChange,
|
|
33
47
|
defaultOpen,
|
|
34
48
|
...other
|
|
35
49
|
});
|
|
36
|
-
const { isOpen:
|
|
37
|
-
const [
|
|
50
|
+
const { isOpen: isOpenState, close } = state;
|
|
51
|
+
const [isOpened, { on, off }] = useBoolean(isOpenState);
|
|
38
52
|
const modalRef = useDOMRef(null);
|
|
39
53
|
const containerRef = useDOMRef(ref);
|
|
40
54
|
const { triggerProps, overlayProps } = useOverlayTrigger(
|
|
41
55
|
{ type: "dialog" },
|
|
42
|
-
{ ...state, isOpen:
|
|
56
|
+
{ ...state, isOpen: isOpenState }
|
|
43
57
|
);
|
|
44
58
|
const { modalProps: modalCommonProps, underlayProps } = useModalOverlay(
|
|
45
59
|
{
|
|
@@ -48,7 +62,7 @@ const SidePanelComponent = forwardRef(
|
|
|
48
62
|
isDismissable: !disableExitOnClickOutside,
|
|
49
63
|
isKeyboardDismissDisabled: disableExitOnEscapeKeyDown
|
|
50
64
|
},
|
|
51
|
-
{ ...state, isOpen:
|
|
65
|
+
{ ...state, isOpen: isOpened },
|
|
52
66
|
modalRef
|
|
53
67
|
);
|
|
54
68
|
const resolvedChildren = () => {
|
|
@@ -61,13 +75,13 @@ const SidePanelComponent = forwardRef(
|
|
|
61
75
|
{
|
|
62
76
|
ref: containerRef,
|
|
63
77
|
"data-size": size,
|
|
64
|
-
"data-
|
|
65
|
-
className: clsx(s.base, s[size], s[position])
|
|
78
|
+
"data-placement": placement,
|
|
79
|
+
className: clsx(s.base, s[size], s[position], s[placement])
|
|
66
80
|
},
|
|
67
81
|
other
|
|
68
82
|
);
|
|
69
83
|
const backdropProps = mergeProps(
|
|
70
|
-
{ isOpen:
|
|
84
|
+
{ isOpen: isOpenState && !hideBackdrop },
|
|
71
85
|
underlayProps,
|
|
72
86
|
slotProps?.backdrop
|
|
73
87
|
);
|
|
@@ -96,7 +110,7 @@ const SidePanelComponent = forwardRef(
|
|
|
96
110
|
onEnter: on,
|
|
97
111
|
timeout: 300,
|
|
98
112
|
onExited: off,
|
|
99
|
-
in:
|
|
113
|
+
in: isOpenState,
|
|
100
114
|
nodeRef: containerRef,
|
|
101
115
|
unmountOnExit: true,
|
|
102
116
|
appear: true,
|
|
@@ -4,6 +4,8 @@ const medium = "kbq-sidepanel-medium-64ac8f";
|
|
|
4
4
|
const large = "kbq-sidepanel-large-e885ab";
|
|
5
5
|
const left = "kbq-sidepanel-left-e8e188";
|
|
6
6
|
const right = "kbq-sidepanel-right-4fdda0";
|
|
7
|
+
const start = "kbq-sidepanel-start-636741";
|
|
8
|
+
const end = "kbq-sidepanel-end-1bddfa";
|
|
7
9
|
const panel = "kbq-sidepanel-panel-4a4aa4";
|
|
8
10
|
const s = {
|
|
9
11
|
base,
|
|
@@ -12,15 +14,19 @@ const s = {
|
|
|
12
14
|
large,
|
|
13
15
|
left,
|
|
14
16
|
right,
|
|
17
|
+
start,
|
|
18
|
+
end,
|
|
15
19
|
panel
|
|
16
20
|
};
|
|
17
21
|
export {
|
|
18
22
|
base,
|
|
19
23
|
s as default,
|
|
24
|
+
end,
|
|
20
25
|
large,
|
|
21
26
|
left,
|
|
22
27
|
medium,
|
|
23
28
|
panel,
|
|
24
29
|
right,
|
|
25
|
-
small
|
|
30
|
+
small,
|
|
31
|
+
start
|
|
26
32
|
};
|
|
@@ -6,10 +6,29 @@ export declare const sidePanelPropSize: readonly ["small", "medium", "large"];
|
|
|
6
6
|
export type SidePanelPropSize = (typeof sidePanelPropSize)[number];
|
|
7
7
|
export declare const sidePanelPropPosition: readonly ["left", "right"];
|
|
8
8
|
export type SidePanelPropPosition = (typeof sidePanelPropPosition)[number];
|
|
9
|
+
export declare const sidePanelPropPlacement: readonly ["start", "end"];
|
|
10
|
+
export type SidePanelPropPlacement = (typeof sidePanelPropPlacement)[number];
|
|
9
11
|
export type SidePanelPropContent = ReactNode | ((props: {
|
|
10
12
|
close(): void;
|
|
11
13
|
}) => ReactElement);
|
|
12
14
|
export type SidePanelPropControl = (props: ButtonOptions) => ReactElement;
|
|
15
|
+
type SidePanelDeprecatedProps = {
|
|
16
|
+
/**
|
|
17
|
+
* If `true`, the component is shown.
|
|
18
|
+
*
|
|
19
|
+
* @deprecated
|
|
20
|
+
* The "open" prop is deprecated. Use "isOpen" prop to replace it.
|
|
21
|
+
*/
|
|
22
|
+
open?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Side from which the side panel will appear.
|
|
25
|
+
* @default left
|
|
26
|
+
*
|
|
27
|
+
* @deprecated
|
|
28
|
+
* The "position" prop is deprecated. Use "placement" prop to replace it.
|
|
29
|
+
*/
|
|
30
|
+
position?: SidePanelPropPosition;
|
|
31
|
+
};
|
|
13
32
|
export type SidePanelProps = {
|
|
14
33
|
/**
|
|
15
34
|
* Component width size.
|
|
@@ -18,11 +37,11 @@ export type SidePanelProps = {
|
|
|
18
37
|
size?: SidePanelPropSize;
|
|
19
38
|
/**
|
|
20
39
|
* Side from which the side panel will appear.
|
|
21
|
-
* @default
|
|
40
|
+
* @default start
|
|
22
41
|
*/
|
|
23
|
-
|
|
42
|
+
placement?: SidePanelPropPlacement;
|
|
24
43
|
/** If `true`, the component is shown. */
|
|
25
|
-
|
|
44
|
+
isOpen?: boolean;
|
|
26
45
|
/** The default open state. Use when the component is not controlled. */
|
|
27
46
|
defaultOpen?: boolean;
|
|
28
47
|
/** The content of the component. */
|
|
@@ -78,5 +97,6 @@ export type SidePanelProps = {
|
|
|
78
97
|
backdrop?: BackdropProps;
|
|
79
98
|
panel?: ComponentPropsWithRef<'div'>;
|
|
80
99
|
};
|
|
81
|
-
};
|
|
100
|
+
} & SidePanelDeprecatedProps;
|
|
82
101
|
export type SidePanelRef = ComponentRef<'div'>;
|
|
102
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cell, Row, Column, TableBody, TableHeader } from '../Collections';
|
|
2
|
-
import type {
|
|
3
|
-
declare const TableComponent:
|
|
2
|
+
import type { TableComponent } from './types';
|
|
3
|
+
declare const TableComponent: TableComponent;
|
|
4
4
|
type CompoundedComponent = typeof TableComponent & {
|
|
5
5
|
Header: typeof TableHeader;
|
|
6
6
|
Body: typeof TableBody;
|
|
@@ -67,5 +67,5 @@ export type TableProps<T> = ExtendableComponentPropsWithRef<{
|
|
|
67
67
|
table?: ComponentPropsWithRef<'table'>;
|
|
68
68
|
};
|
|
69
69
|
}, 'div'>;
|
|
70
|
-
export type
|
|
70
|
+
export type TableComponent = <T extends object>(props: TableProps<T>) => ReactElement | null;
|
|
71
71
|
export type TableRef = ComponentRef<'table'>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const TagGroup:
|
|
1
|
+
import type { TagGroupComponent } from './types';
|
|
2
|
+
export declare const TagGroup: TagGroupComponent;
|
|
@@ -54,8 +54,8 @@ function TagInner(props) {
|
|
|
54
54
|
const removeButtonProps = mergeProps(
|
|
55
55
|
{
|
|
56
56
|
tabIndex: -1,
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
isCompact: true,
|
|
58
|
+
isDisabled,
|
|
59
59
|
className: s.cancelIcon,
|
|
60
60
|
variant: matchVariantToCloseButton[variant],
|
|
61
61
|
"aria-label": stringFormatter.format("close")
|
|
@@ -33,5 +33,5 @@ export type TagGroupProps<T extends object> = {
|
|
|
33
33
|
root?: ComponentPropsWithRef<'div'>;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
export type
|
|
36
|
+
export type TagGroupComponent = <T extends object>(props: TagGroupProps<T>) => ReactElement | null;
|
|
37
37
|
export type TagGroupRef = ComponentRef<'div'>;
|
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ import { Modal } from "./components/Modal/Modal.js";
|
|
|
48
48
|
import { modalPropSize } from "./components/Modal/types.js";
|
|
49
49
|
import { ModalContent, ModalFooter, ModalHeader } from "./components/Modal/index.js";
|
|
50
50
|
import { SidePanel } from "./components/SidePanel/SidePanel.js";
|
|
51
|
-
import { sidePanelPropPosition, sidePanelPropSize } from "./components/SidePanel/types.js";
|
|
51
|
+
import { sidePanelPropPlacement, sidePanelPropPosition, sidePanelPropSize } from "./components/SidePanel/types.js";
|
|
52
52
|
import { SidePanelContent, SidePanelFooter, SidePanelHeader } from "./components/SidePanel/index.js";
|
|
53
53
|
import { Popover } from "./components/Popover/Popover.js";
|
|
54
54
|
import { popoverPropPlacement, popoverPropSize, popoverPropType } from "./components/Popover/types.js";
|
|
@@ -175,6 +175,7 @@ export {
|
|
|
175
175
|
radioGroupPropSize,
|
|
176
176
|
radioPropLabelPlacement,
|
|
177
177
|
radioPropSize,
|
|
178
|
+
sidePanelPropPlacement,
|
|
178
179
|
sidePanelPropPosition,
|
|
179
180
|
sidePanelPropSize,
|
|
180
181
|
spacing,
|
package/dist/style.css
CHANGED
|
@@ -2782,6 +2782,16 @@
|
|
|
2782
2782
|
justify-content: flex-end;
|
|
2783
2783
|
}
|
|
2784
2784
|
|
|
2785
|
+
.kbq-sidepanel-start-636741 {
|
|
2786
|
+
--side-panel-start-position: -100%;
|
|
2787
|
+
justify-content: flex-start;
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
.kbq-sidepanel-end-1bddfa {
|
|
2791
|
+
--side-panel-start-position: 100%;
|
|
2792
|
+
justify-content: flex-end;
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2785
2795
|
.kbq-sidepanel-2aae74[data-transition="entering"] .kbq-sidepanel-panel-4a4aa4, .kbq-sidepanel-2aae74[data-transition="entered"] .kbq-sidepanel-panel-4a4aa4 {
|
|
2786
2796
|
transform: translate(0);
|
|
2787
2797
|
}
|
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.35",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"@koobiq/design-tokens": "^3.12.1",
|
|
28
28
|
"@types/react-transition-group": "^4.4.12",
|
|
29
29
|
"react-transition-group": "^4.4.5",
|
|
30
|
-
"@koobiq/
|
|
31
|
-
"@koobiq/react-
|
|
32
|
-
"@koobiq/react-
|
|
33
|
-
"@koobiq/
|
|
30
|
+
"@koobiq/logger": "0.0.1-beta.35",
|
|
31
|
+
"@koobiq/react-core": "0.0.1-beta.35",
|
|
32
|
+
"@koobiq/react-icons": "0.0.1-beta.35",
|
|
33
|
+
"@koobiq/react-primitives": "0.0.1-beta.35"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@koobiq/design-tokens": "^3.11.2",
|