@trackunit/react-components 0.1.85 → 0.1.87
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/index.cjs
CHANGED
|
@@ -1179,7 +1179,7 @@ const useDebounce = (value, delay = 500) => {
|
|
|
1179
1179
|
* Get the device pixel ratio, potentially rounded and capped.
|
|
1180
1180
|
* Will emit new values if it changes.
|
|
1181
1181
|
*
|
|
1182
|
-
* @param {DevicePixelRatioOptions} options
|
|
1182
|
+
* @param {DevicePixelRatioOptions} options the options object
|
|
1183
1183
|
* @returns { number } The current device pixel ratio, or the default if none can be resolved
|
|
1184
1184
|
*/
|
|
1185
1185
|
function useDevicePixelRatio(options) {
|
|
@@ -1228,8 +1228,8 @@ function getDevicePixelRatio(options) {
|
|
|
1228
1228
|
/**
|
|
1229
1229
|
* The useLocalStorage hook works like useState, but saves to localstorage.
|
|
1230
1230
|
*
|
|
1231
|
-
* @param {string}
|
|
1232
|
-
* @param {string | null | undefined}
|
|
1231
|
+
* @param {string} key - The key the values is saved under.
|
|
1232
|
+
* @param {string | null | undefined} initialValue - The initial value for the state/local storage item
|
|
1233
1233
|
* @returns {string | null | undefined} value
|
|
1234
1234
|
*/
|
|
1235
1235
|
const useLocalStorage = (key, initialValue) => {
|
|
@@ -1344,8 +1344,9 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
1344
1344
|
* @param {MoreMenuProps} props - The props for the MoreMenu component
|
|
1345
1345
|
* @returns {JSX.Element} MoreMenu component
|
|
1346
1346
|
*/
|
|
1347
|
-
const MoreMenu = ({ className, dataTestId,
|
|
1347
|
+
const MoreMenu = ({ className, dataTestId, menuPlacement, iconProps = {
|
|
1348
1348
|
size: "medium",
|
|
1349
|
+
name: "EllipsisHorizontalIcon",
|
|
1349
1350
|
}, iconButtonProps = {
|
|
1350
1351
|
size: "small",
|
|
1351
1352
|
circular: true,
|
|
@@ -1353,12 +1354,11 @@ const MoreMenu = ({ className, dataTestId, dotsDirection = "horizontal", menuPla
|
|
|
1353
1354
|
color: "tertiary",
|
|
1354
1355
|
}, children, }) => {
|
|
1355
1356
|
const [actionMenuIsOpen, setActionMenuIsOpen] = React.useState(false);
|
|
1356
|
-
const dotsName = dotsDirection === "horizontal" ? "EllipsisHorizontalIcon" : "EllipsisVerticalIcon";
|
|
1357
1357
|
const actionMenuRef = React.useRef(null);
|
|
1358
1358
|
useClickOutside(actionMenuRef, () => {
|
|
1359
1359
|
setActionMenuIsOpen(false);
|
|
1360
1360
|
});
|
|
1361
|
-
return (jsxRuntime.jsx(Root$3, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxRuntime.jsxs(Popover, Object.assign({ placement: menuPlacement }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsxRuntime.jsx(Icon, Object.assign({ name:
|
|
1361
|
+
return (jsxRuntime.jsx(Root$3, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxRuntime.jsxs(Popover, Object.assign({ placement: menuPlacement }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx(IconButton, Object.assign({}, iconButtonProps, { icon: iconProps.name ? jsxRuntime.jsx(Icon, Object.assign({}, iconProps, { name: iconProps.name })) : null, onClick: () => {
|
|
1362
1362
|
setActionMenuIsOpen(!actionMenuIsOpen);
|
|
1363
1363
|
} })) }), jsxRuntime.jsx(PopoverContent, { children: close => (typeof children === "function" ? children(close) : children) })] })) })));
|
|
1364
1364
|
};
|
package/index.js
CHANGED
|
@@ -1152,7 +1152,7 @@ const useDebounce = (value, delay = 500) => {
|
|
|
1152
1152
|
* Get the device pixel ratio, potentially rounded and capped.
|
|
1153
1153
|
* Will emit new values if it changes.
|
|
1154
1154
|
*
|
|
1155
|
-
* @param {DevicePixelRatioOptions} options
|
|
1155
|
+
* @param {DevicePixelRatioOptions} options the options object
|
|
1156
1156
|
* @returns { number } The current device pixel ratio, or the default if none can be resolved
|
|
1157
1157
|
*/
|
|
1158
1158
|
function useDevicePixelRatio(options) {
|
|
@@ -1201,8 +1201,8 @@ function getDevicePixelRatio(options) {
|
|
|
1201
1201
|
/**
|
|
1202
1202
|
* The useLocalStorage hook works like useState, but saves to localstorage.
|
|
1203
1203
|
*
|
|
1204
|
-
* @param {string}
|
|
1205
|
-
* @param {string | null | undefined}
|
|
1204
|
+
* @param {string} key - The key the values is saved under.
|
|
1205
|
+
* @param {string | null | undefined} initialValue - The initial value for the state/local storage item
|
|
1206
1206
|
* @returns {string | null | undefined} value
|
|
1207
1207
|
*/
|
|
1208
1208
|
const useLocalStorage = (key, initialValue) => {
|
|
@@ -1317,8 +1317,9 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
1317
1317
|
* @param {MoreMenuProps} props - The props for the MoreMenu component
|
|
1318
1318
|
* @returns {JSX.Element} MoreMenu component
|
|
1319
1319
|
*/
|
|
1320
|
-
const MoreMenu = ({ className, dataTestId,
|
|
1320
|
+
const MoreMenu = ({ className, dataTestId, menuPlacement, iconProps = {
|
|
1321
1321
|
size: "medium",
|
|
1322
|
+
name: "EllipsisHorizontalIcon",
|
|
1322
1323
|
}, iconButtonProps = {
|
|
1323
1324
|
size: "small",
|
|
1324
1325
|
circular: true,
|
|
@@ -1326,12 +1327,11 @@ const MoreMenu = ({ className, dataTestId, dotsDirection = "horizontal", menuPla
|
|
|
1326
1327
|
color: "tertiary",
|
|
1327
1328
|
}, children, }) => {
|
|
1328
1329
|
const [actionMenuIsOpen, setActionMenuIsOpen] = useState(false);
|
|
1329
|
-
const dotsName = dotsDirection === "horizontal" ? "EllipsisHorizontalIcon" : "EllipsisVerticalIcon";
|
|
1330
1330
|
const actionMenuRef = useRef(null);
|
|
1331
1331
|
useClickOutside(actionMenuRef, () => {
|
|
1332
1332
|
setActionMenuIsOpen(false);
|
|
1333
1333
|
});
|
|
1334
|
-
return (jsx(Root$3, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxs(Popover, Object.assign({ placement: menuPlacement }, { children: [jsx(PopoverTrigger, { children: jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsx(Icon, Object.assign({ name:
|
|
1334
|
+
return (jsx(Root$3, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxs(Popover, Object.assign({ placement: menuPlacement }, { children: [jsx(PopoverTrigger, { children: jsx(IconButton, Object.assign({}, iconButtonProps, { icon: iconProps.name ? jsx(Icon, Object.assign({}, iconProps, { name: iconProps.name })) : null, onClick: () => {
|
|
1335
1335
|
setActionMenuIsOpen(!actionMenuIsOpen);
|
|
1336
1336
|
} })) }), jsx(PopoverContent, { children: close => (typeof children === "function" ? children(close) : children) })] })) })));
|
|
1337
1337
|
};
|
package/package.json
CHANGED
|
@@ -3,13 +3,11 @@ import { CommonProps } from "../../../common/CommonProps";
|
|
|
3
3
|
import { IconButtonProps } from "../../buttons";
|
|
4
4
|
import { IconProps } from "../../Icon/Icon";
|
|
5
5
|
import { PopoverContentChildren, PopoverPlacement } from "../../Popover";
|
|
6
|
-
export type DotsDirection = "horizontal" | "vertical";
|
|
7
6
|
export type MenuPlacement = "above" | "below";
|
|
8
|
-
type FilteredIconProps = Omit<IconProps, "name">;
|
|
7
|
+
type FilteredIconProps = Omit<IconProps, "onClick" | "name"> & Pick<Partial<IconProps>, "name">;
|
|
9
8
|
type FilteredIconButtonProps = Omit<IconButtonProps, "icon" | "onClick">;
|
|
10
9
|
export interface MoreMenuProps extends CommonProps {
|
|
11
10
|
children: PopoverContentChildren;
|
|
12
|
-
dotsDirection?: DotsDirection;
|
|
13
11
|
menuPlacement?: PopoverPlacement;
|
|
14
12
|
iconProps?: FilteredIconProps;
|
|
15
13
|
iconButtonProps?: FilteredIconButtonProps;
|
|
@@ -21,5 +19,5 @@ export interface MoreMenuProps extends CommonProps {
|
|
|
21
19
|
* @param {MoreMenuProps} props - The props for the MoreMenu component
|
|
22
20
|
* @returns {JSX.Element} MoreMenu component
|
|
23
21
|
*/
|
|
24
|
-
export declare const MoreMenu: ({ className, dataTestId,
|
|
22
|
+
export declare const MoreMenu: ({ className, dataTestId, menuPlacement, iconProps, iconButtonProps, children, }: MoreMenuProps) => JSX.Element;
|
|
25
23
|
export {};
|
|
@@ -24,7 +24,7 @@ export interface DevicePixelRatioOptions {
|
|
|
24
24
|
* Get the device pixel ratio, potentially rounded and capped.
|
|
25
25
|
* Will emit new values if it changes.
|
|
26
26
|
*
|
|
27
|
-
* @param {DevicePixelRatioOptions} options
|
|
27
|
+
* @param {DevicePixelRatioOptions} options the options object
|
|
28
28
|
* @returns { number } The current device pixel ratio, or the default if none can be resolved
|
|
29
29
|
*/
|
|
30
30
|
export declare function useDevicePixelRatio(options?: DevicePixelRatioOptions): number;
|
|
@@ -2,8 +2,8 @@ import { Dispatch, SetStateAction } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* The useLocalStorage hook works like useState, but saves to localstorage.
|
|
4
4
|
*
|
|
5
|
-
* @param {string}
|
|
6
|
-
* @param {string | null | undefined}
|
|
5
|
+
* @param {string} key - The key the values is saved under.
|
|
6
|
+
* @param {string | null | undefined} initialValue - The initial value for the state/local storage item
|
|
7
7
|
* @returns {string | null | undefined} value
|
|
8
8
|
*/
|
|
9
9
|
export declare const useLocalStorage: <TValue = string | null | undefined>(key: string, initialValue?: TValue | undefined) => [TValue | null, Dispatch<SetStateAction<TValue | null>>, () => void];
|