@trackunit/react-components 0.0.111 → 0.0.112
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/Popover/AnimatedPopover.d.ts +28 -0
- package/components/Popover/PopoverList.d.ts +1 -1
- package/components/Popover/PopoverListItem.d.ts +9 -0
- package/components/Popover/PopoverTitle.d.ts +6 -0
- package/components/Popover/usePopover.d.ts +12 -0
- package/index.js +20 -31
- package/package.json +1 -1
|
@@ -2,14 +2,42 @@ import * as React from "react";
|
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
import { PopoverLifecycle } from "./usePopover";
|
|
4
4
|
export interface AnimatedPopoverProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Controls the lifecycle of the popover.
|
|
7
|
+
*/
|
|
5
8
|
lifecycle: PopoverLifecycle;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the popover to closing state.
|
|
11
|
+
*/
|
|
6
12
|
onRequestClose: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Sets the popover to closed state.
|
|
15
|
+
*/
|
|
7
16
|
onClosed: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Child nodes
|
|
19
|
+
*/
|
|
8
20
|
children: React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* The delay(in seconds) for triggering the popover state when entering it.
|
|
23
|
+
*/
|
|
9
24
|
enterDelay?: number;
|
|
25
|
+
/**
|
|
26
|
+
* The delay(in seconds) for triggering the popover state when exiting it.
|
|
27
|
+
*/
|
|
10
28
|
exitDelay?: number;
|
|
11
29
|
/** An element to use as the portal root for the popover component */
|
|
12
30
|
bindTo?: HTMLElement;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the popover should have a backdrop or not.
|
|
33
|
+
*/
|
|
13
34
|
enableBackdrop?: boolean;
|
|
14
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* The Popover component is used to display some content on top of another.
|
|
38
|
+
* Use a popover to expose a small amount of information or functionality.
|
|
39
|
+
*
|
|
40
|
+
* @param {AnimatedPopoverProps} props - The props for the Card component
|
|
41
|
+
* @returns {JSX.Element} Popover component
|
|
42
|
+
*/
|
|
15
43
|
export declare const AnimatedPopover: React.ForwardRefExoticComponent<AnimatedPopoverProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -9,4 +9,4 @@ export interface PopoverListProps extends CommonProps {
|
|
|
9
9
|
* @param {PopoverListProps} props - The props for the PopoverList component
|
|
10
10
|
* @returns {JSX.Element} PopoverList component
|
|
11
11
|
*/
|
|
12
|
-
export declare const PopoverList: ({ className, children, dataTestId
|
|
12
|
+
export declare const PopoverList: ({ className, children, dataTestId }: PopoverListProps) => JSX.Element;
|
|
@@ -8,8 +8,17 @@ export interface PopoverListItemProps extends CommonProps {
|
|
|
8
8
|
onClick?: (event: React.MouseEvent<HTMLLIElement, MouseEvent>) => void;
|
|
9
9
|
/** Navigation Url for this item */
|
|
10
10
|
url?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The prefix to be displayed for the list item.
|
|
13
|
+
*/
|
|
11
14
|
prefix?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The suffix to be displayed for the list item.
|
|
17
|
+
*/
|
|
12
18
|
suffix?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* The child nodes.
|
|
21
|
+
*/
|
|
13
22
|
children: React.ReactNode;
|
|
14
23
|
renderAs?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
|
|
15
24
|
}
|
|
@@ -2,7 +2,13 @@ import * as React from "react";
|
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
export interface PopoverTitleProps extends CommonProps {
|
|
4
4
|
action?: React.ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* Whether there should be a divider between the title and the content.
|
|
7
|
+
*/
|
|
5
8
|
divider?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The child nodes.
|
|
11
|
+
*/
|
|
6
12
|
children?: React.ReactNode;
|
|
7
13
|
}
|
|
8
14
|
/**
|
|
@@ -2,9 +2,21 @@ import { Placement } from "@popperjs/core";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
export declare type PopoverPlacement = Placement;
|
|
4
4
|
export interface UsePopoverProps<T, Y> {
|
|
5
|
+
/**
|
|
6
|
+
* Reference to the target component.
|
|
7
|
+
*/
|
|
5
8
|
targetRef: React.RefObject<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Reference to the popover component.
|
|
11
|
+
*/
|
|
6
12
|
popoverRef: React.RefObject<Y>;
|
|
13
|
+
/**
|
|
14
|
+
* Placement of the popover.
|
|
15
|
+
*/
|
|
7
16
|
placement?: PopoverPlacement;
|
|
17
|
+
/**
|
|
18
|
+
* The positional offset of the popover from the target component.
|
|
19
|
+
*/
|
|
8
20
|
offset?: [number, number];
|
|
9
21
|
}
|
|
10
22
|
export declare enum PopoverLifecycle {
|
package/index.js
CHANGED
|
@@ -1860,6 +1860,14 @@ const usePopover = ({
|
|
|
1860
1860
|
};
|
|
1861
1861
|
};
|
|
1862
1862
|
|
|
1863
|
+
/**
|
|
1864
|
+
* The Popover component is used to display some content on top of another.
|
|
1865
|
+
* Use a popover to expose a small amount of information or functionality.
|
|
1866
|
+
*
|
|
1867
|
+
* @param {AnimatedPopoverProps} props - The props for the Card component
|
|
1868
|
+
* @returns {JSX.Element} Popover component
|
|
1869
|
+
*/
|
|
1870
|
+
|
|
1863
1871
|
const AnimatedPopover = React.forwardRef(({
|
|
1864
1872
|
lifecycle,
|
|
1865
1873
|
onRequestClose,
|
|
@@ -1913,9 +1921,7 @@ const AnimatedPopover = React.forwardRef(({
|
|
|
1913
1921
|
});
|
|
1914
1922
|
});
|
|
1915
1923
|
const Backdrop$1 = tw.div`
|
|
1916
|
-
|
|
1917
|
-
inset-0
|
|
1918
|
-
z-popover
|
|
1924
|
+
tu-popover-backdrop
|
|
1919
1925
|
`;
|
|
1920
1926
|
|
|
1921
1927
|
const AnimatedContainer = ({
|
|
@@ -1953,7 +1959,7 @@ const AnimatedContainer = ({
|
|
|
1953
1959
|
};
|
|
1954
1960
|
|
|
1955
1961
|
const StyledContainer = tw.div`
|
|
1956
|
-
|
|
1962
|
+
tu-popover-container
|
|
1957
1963
|
`;
|
|
1958
1964
|
|
|
1959
1965
|
/**
|
|
@@ -1982,12 +1988,10 @@ const PopoverList = ({
|
|
|
1982
1988
|
}));
|
|
1983
1989
|
};
|
|
1984
1990
|
const List = tw.ul`
|
|
1985
|
-
list
|
|
1986
|
-
p-0
|
|
1987
|
-
m-0
|
|
1991
|
+
tu-popover-list
|
|
1988
1992
|
`;
|
|
1989
1993
|
const StyledCardBody = tw(CardBody)`
|
|
1990
|
-
|
|
1994
|
+
tu-popover-list-body
|
|
1991
1995
|
`;
|
|
1992
1996
|
|
|
1993
1997
|
/**
|
|
@@ -2153,21 +2157,16 @@ const PopoverListItem = ({
|
|
|
2153
2157
|
}));
|
|
2154
2158
|
};
|
|
2155
2159
|
const StyledText$2 = tw(Text)`
|
|
2156
|
-
|
|
2157
|
-
|
|
2160
|
+
tu-popover-list-item__text
|
|
2161
|
+
${p => p.$selected && tws`tu-popover-list-item__text--selected`}
|
|
2158
2162
|
`;
|
|
2159
2163
|
const ListItem = tw.li`
|
|
2160
2164
|
group
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
py-1
|
|
2164
|
-
px-2
|
|
2165
|
-
${p => !p.disabled ? tws`hover:bg-neutral-50` : null}
|
|
2165
|
+
tu-popover-list-item
|
|
2166
|
+
${p => p.disabled && tws`tu-popover-list-item--disabled`}
|
|
2166
2167
|
`;
|
|
2167
2168
|
const UnstyledAnchor = tw.a`
|
|
2168
|
-
|
|
2169
|
-
w-full
|
|
2170
|
-
text-inherit
|
|
2169
|
+
tu-popover-list-item__anchor
|
|
2171
2170
|
`;
|
|
2172
2171
|
|
|
2173
2172
|
/**
|
|
@@ -2201,21 +2200,11 @@ const PopoverTitle = ({
|
|
|
2201
2200
|
}));
|
|
2202
2201
|
};
|
|
2203
2202
|
const Container$5 = tw.div`
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
px-2
|
|
2207
|
-
py-1
|
|
2208
|
-
|
|
2209
|
-
${p => p.$divider ? `
|
|
2210
|
-
border-b
|
|
2211
|
-
border-solid
|
|
2212
|
-
border-b-neutral-100
|
|
2213
|
-
mb-1
|
|
2214
|
-
` : null}
|
|
2203
|
+
tu-popover-title-container
|
|
2204
|
+
${p => p.$divider && `tu-popover-title-container--divider`}
|
|
2215
2205
|
`;
|
|
2216
2206
|
const StyledText$1 = tw(Text)`
|
|
2217
|
-
|
|
2218
|
-
text-neutral-500
|
|
2207
|
+
tu-popover-title-text
|
|
2219
2208
|
`;
|
|
2220
2209
|
|
|
2221
2210
|
/**
|