kurtosis-ui-components 0.85.53 → 0.85.55

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.
@@ -12,7 +12,7 @@ export const AppPageLayout = ({ preventPageScroll, children }) => {
12
12
  const { hasNavbar } = useContext(AppLayoutContext);
13
13
  const numberOfChildren = Array.isArray(children) ? children.length : 1;
14
14
  if (numberOfChildren === 1) {
15
- return (_jsx(Box, { w: "100%", h: preventPageScroll ? `100vh` : "100%", children: _jsxs(Flex, { flexDirection: "column", flex: "1", w: "100%", h: "100%", maxWidth: MAIN_APP_MAX_WIDTH, pl: hasNavbar ? MAIN_APP_LEFT_PADDING_WITH_NAV : MAIN_APP_LEFT_PADDING_WITHOUT_NAV, pr: MAIN_APP_RIGHT_PADDING, children: [_jsx(KurtosisBreadcrumbs, {}), _jsx(Box, { w: "100%", h: "100%", minH: preventPageScroll ? "0" : undefined, pt: MAIN_APP_TOP_PADDING, pb: MAIN_APP_BOTTOM_PADDING, flexDirection: "column", flex: "1", children: children })] }) }));
15
+ return (_jsx(Box, { w: "100%", h: preventPageScroll ? `100vh` : "100%", flex: "1", children: _jsxs(Flex, { position: "absolute", top: "0", bottom: "0", flexDirection: "column", w: "100%", h: "100%", minH: "100%", maxWidth: MAIN_APP_MAX_WIDTH, pl: hasNavbar ? MAIN_APP_LEFT_PADDING_WITH_NAV : MAIN_APP_LEFT_PADDING_WITHOUT_NAV, pr: MAIN_APP_RIGHT_PADDING, children: [_jsx(KurtosisBreadcrumbs, {}), _jsx(Flex, { w: "100%", h: "100%", minH: preventPageScroll ? "0" : undefined, pt: MAIN_APP_TOP_PADDING, pb: MAIN_APP_BOTTOM_PADDING, flexDirection: "column", flex: "1", children: children })] }) }));
16
16
  }
17
17
  // TS cannot infer that children is an array if numberOfChildren === 2
18
18
  if (numberOfChildren === 2 && Array.isArray(children)) {
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ChakraProvider, defineStyle, extendTheme, Tooltip, useColorMode, } from "@chakra-ui/react";
3
+ import { cssVar } from "@chakra-ui/styled-system";
3
4
  import { mode } from "@chakra-ui/theme-tools";
4
5
  import { useEffect } from "react";
5
6
  import Fonts from "./theme/Fonts";
@@ -25,8 +26,7 @@ const theme = extendTheme({
25
26
  },
26
27
  colors: {
27
28
  kurtosisGreen: {
28
- 50: "#00371E",
29
- 100: "#005e11",
29
+ 100: "#18371E",
30
30
  200: "#008c19",
31
31
  300: "#00bb22",
32
32
  400: "#00C223",
@@ -95,16 +95,13 @@ const theme = extendTheme({
95
95
  color: `${props.colorScheme}.400`,
96
96
  borderColor: "gray.300",
97
97
  }),
98
- solidOutline: (props) => {
99
- const outline = theme.components.Button.variants.outline(props);
100
- return {
101
- ...outline,
102
- _hover: { bg: `${props.colorScheme}.400`, color: "gray.900" },
103
- _active: { bg: `${props.colorScheme}.400`, color: "gray.900" },
104
- color: `${props.colorScheme}.400`,
105
- borderColor: `${props.colorScheme}.400`,
106
- };
107
- },
98
+ activeFilterControl: (props) => ({
99
+ _hover: { borderColor: `${props.colorScheme}.200` },
100
+ borderColor: `${props.colorScheme}.400`,
101
+ borderWidth: "1px",
102
+ bg: `${props.colorScheme}.100`,
103
+ color: `${props.colorScheme}.400`,
104
+ }),
108
105
  kurtosisGroupOutline: (props) => {
109
106
  const outline = theme.components.Button.variants.outline(props);
110
107
  return {
@@ -126,11 +123,18 @@ const theme = extendTheme({
126
123
  };
127
124
  },
128
125
  solid: defineStyle((props) => ({
129
- _hover: { bg: "gray.600" },
130
- _active: { bg: "gray.600" },
131
- color: `${props.colorScheme}.400`,
132
- bg: "gray.700",
126
+ color: `white`,
133
127
  })),
128
+ savedSolid: (props) => {
129
+ const solid = theme.components.Button.variants.solid(props);
130
+ return {
131
+ ...solid,
132
+ _hover: { bg: "gray.600" },
133
+ _active: { bg: "gray.600" },
134
+ bg: "gray.700",
135
+ color: `${props.colorScheme}.400`,
136
+ };
137
+ },
134
138
  ghost: defineStyle((props) => ({
135
139
  _hover: { bg: "gray.650" },
136
140
  color: props.colorScheme === "gray" ? undefined : `${props.colorScheme}.400`,
@@ -189,10 +193,17 @@ const theme = extendTheme({
189
193
  },
190
194
  },
191
195
  Card: {
196
+ baseStyle: {
197
+ container: { [cssVar("card-bg").variable]: "colors.gray.850" },
198
+ },
192
199
  variants: {
200
+ elevated: {
201
+ container: {
202
+ _dark: { [cssVar("card-bg").variable]: "colors.gray.850" },
203
+ },
204
+ },
193
205
  valueCard: {
194
206
  container: {
195
- bg: "gray.850",
196
207
  borderRadius: "8px",
197
208
  padding: "16px",
198
209
  gap: "16px",
@@ -214,6 +225,7 @@ const theme = extendTheme({
214
225
  borderStyle: "solid",
215
226
  borderWidth: "1px",
216
227
  borderRadius: "6px",
228
+ overflow: "hidden",
217
229
  },
218
230
  header: {
219
231
  bg: "gray.850",
@@ -256,7 +268,13 @@ const theme = extendTheme({
256
268
  baseStyle: {
257
269
  list: {
258
270
  minW: "unset",
271
+ padding: "4px",
272
+ boxShadow: "0px 11.25px 30px 0px rgba(0, 0, 0, 0.40), 0px 3.75px 7.5px 0px rgba(0, 0, 0, 0.20), 0px 0px 0px 0.75px rgba(0, 0, 0, 0.10)",
273
+ },
274
+ item: {
275
+ borderRadius: "6px",
259
276
  },
277
+ icon: { color: "gray.400", "font-size": "18px !important" },
260
278
  },
261
279
  },
262
280
  Popover: {
@@ -15,7 +15,7 @@ export const PackageSourceButton = ({ source, children, ...buttonProps }) => {
15
15
  if (repositoryResult.isOk) {
16
16
  const repository = repositoryResult.value;
17
17
  const url = `https://${repository.baseUrl}/${repository.owner}/${repository.name}${isDefined(repository.rootPath) && repository.rootPath !== "/" ? "/tree/main/" + repository.rootPath : ""}`;
18
- button = (_jsx(Link, { href: url, target: "_blank", rel: "noopener noreferrer", w: buttonProps.w || buttonProps.width, children: _jsx(Button, { leftIcon: _jsx(Icon, { as: IoLogoGithub, color: "gray.400" }), variant: "ghost", size: "xs", ...buttonProps, children: children || source.replace("github.com/", "") }) }));
18
+ button = (_jsx(Link, { href: url, target: "_blank", rel: "noopener noreferrer", w: buttonProps.w || buttonProps.width, children: _jsx(Button, { leftIcon: _jsx(Icon, { as: IoLogoGithub }), variant: "ghost", size: "xs", ...buttonProps, children: children || source.replace("github.com/", "") }) }));
19
19
  }
20
20
  else {
21
21
  button = (_jsx(Tooltip, { shouldWrapChildren: true, label: repositoryResult.error, children: _jsx("a", { href: `https://${source}`, target: "_blank", rel: "noopener noreferrer", children: _jsx(Button, { variant: "ghost", size: "xs", ...buttonProps, colorScheme: "red", children: children || source }) }) }));
@@ -1,18 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Flex, Icon, Image, Text } from "@chakra-ui/react";
2
+ import { Box, Flex, Icon, Text, Tooltip } from "@chakra-ui/react";
3
3
  import { IoPlay, IoStar } from "react-icons/io5";
4
- import { Link, useHref } from "react-router-dom";
4
+ import { Link } from "react-router-dom";
5
+ import { numberSummary } from "../utils";
5
6
  import { readablePackageName } from "./utils";
7
+ import { PackageLogo } from "./widgets/PackageLogo";
6
8
  import { RunKurtosisPackageButton } from "./widgets/RunKurtosisPackageButton";
7
9
  import { SaveKurtosisPackageButton } from "./widgets/SaveKurtosisPackageButton";
8
10
  export const KurtosisPackageCard = ({ kurtosisPackage, onRunClick }) => {
9
11
  var _a;
10
- const logoHref = useHref("/logo.png");
11
- return (_jsx(Link, { to: `/catalog/${encodeURIComponent(kurtosisPackage.name)}`, children: _jsxs(Flex, { h: "168px", p: "0 24px", bg: "gray.900", borderColor: "whiteAlpha.300", borderWidth: "1px", borderStyle: "solid", borderRadius: "6px", flexDirection: "column", gap: "16px", justifyContent: "center", alignItems: "center", _hover: { bg: "gray.850", cursor: "pointer" }, children: [_jsxs(Flex, { h: "80px", gap: "16px", width: "100%", children: [_jsx(Image, { h: "80px", w: "80px", bg: kurtosisPackage.iconUrl !== "" ? "white" : "black", src: kurtosisPackage.iconUrl || logoHref, fallbackSrc: logoHref, borderRadius: "6px" }), _jsxs(Flex, { flexDirection: "column", flex: "1", justifyContent: "space-between", children: [_jsx(Text, { noOfLines: 2, fontSize: "lg", children: readablePackageName(kurtosisPackage.name) }), _jsx(Box, { flex: "1", sx: {
12
- containerType: "size",
13
- containerName: "details-container",
14
- "@container details-container (min-height: 30px)": {
15
- "> div": { flexDirection: "column", justifyContent: "flex-end", height: "100%" },
16
- },
17
- }, children: _jsxs(Flex, { justifyContent: "space-between", fontSize: "xs", gap: "8px", children: [_jsx(Text, { as: "span", textTransform: "capitalize", children: ((_a = kurtosisPackage.repositoryMetadata) === null || _a === void 0 ? void 0 : _a.owner.replaceAll("-", " ")) || "Unknown owner" }), _jsxs(Flex, { gap: "16px", children: [_jsxs(Flex, { gap: "4px", alignItems: "center", children: [_jsx(Icon, { color: "gray. 500", as: IoStar }), _jsx(Text, { as: "span", children: kurtosisPackage.stars.toString() })] }), _jsxs(Flex, { gap: "4px", alignItems: "center", children: [_jsx(Icon, { color: "gray. 500", as: IoPlay }), _jsx(Text, { as: "span", children: kurtosisPackage.runCount.toString() })] })] })] }) })] })] }), _jsxs(Flex, { gap: "16px", width: "100%", children: [_jsx(SaveKurtosisPackageButton, { kurtosisPackage: kurtosisPackage, flex: "1" }), _jsx(RunKurtosisPackageButton, { kurtosisPackage: kurtosisPackage, onClick: onRunClick, flex: "1" })] })] }) }));
12
+ return (_jsx(Link, { to: `/catalog/${encodeURIComponent(kurtosisPackage.name)}`, children: _jsxs(Flex, { position: "relative", h: "260px", w: "204px", p: "24px", bg: "gray.900", borderColor: "whiteAlpha.300", borderWidth: "1px", borderStyle: "solid", borderRadius: "6px", flexDirection: "column", gap: "16px", justifyContent: "space-between", alignItems: "center", _hover: { bg: "gray.850", cursor: "pointer" }, children: [_jsx(Box, { position: "absolute", top: "8px", right: "8px", children: _jsx(SaveKurtosisPackageButton, { isIconButton: true, "aria-label": "Toggle button save", kurtosisPackage: kurtosisPackage, flex: "1", variant: "ghost" }) }), _jsx(PackageLogo, { kurtosisPackage: kurtosisPackage, h: "80px", w: "80px" }), _jsx(Flex, { h: "80px", gap: "8px", width: "100%", children: _jsxs(Flex, { flexDirection: "column", flex: "1", justifyContent: "space-between", children: [_jsx(Text, { noOfLines: 1, fontSize: "md", fontWeight: "bold", children: readablePackageName(kurtosisPackage.name) }), _jsx(Text, { as: "span", textTransform: "capitalize", noOfLines: 1, fontSize: "xs", children: ((_a = kurtosisPackage.repositoryMetadata) === null || _a === void 0 ? void 0 : _a.owner.replaceAll("-", " ")) || "Unknown owner" }), _jsxs(Flex, { gap: "16px", color: "gray.200", fontSize: "xs", children: [_jsx(Tooltip, { label: `This package has ${kurtosisPackage.runCount} stars`, children: _jsxs(Flex, { gap: "4px", alignItems: "center", children: [_jsx(Icon, { as: IoStar }), _jsx(Text, { as: "span", children: numberSummary(Number(kurtosisPackage.stars)) })] }) }), _jsx(Tooltip, { label: `This package has been run ${kurtosisPackage.runCount} times`, children: _jsxs(Flex, { gap: "4px", alignItems: "center", children: [_jsx(Icon, { as: IoPlay }), _jsx(Text, { as: "span", children: numberSummary(kurtosisPackage.runCount) })] }) })] })] }) }), _jsx(Flex, { gap: "16px", width: "100%", children: _jsx(RunKurtosisPackageButton, { kurtosisPackage: kurtosisPackage, onClick: onRunClick, flex: "1" }) })] }) }));
18
13
  };
@@ -2,8 +2,7 @@
2
2
  import { KurtosisPackage } from "kurtosis-cloud-indexer-sdk";
3
3
  type KurtosisPackageCardGridProps = {
4
4
  packages: KurtosisPackage[];
5
- onPackageClicked?: (kurtosisPackage: KurtosisPackage) => void;
6
5
  onPackageRunClicked: (kurtosisPackage: KurtosisPackage) => void;
7
6
  };
8
- export declare const KurtosisPackageCardGrid: import("react").MemoExoticComponent<({ packages, onPackageClicked, onPackageRunClicked }: KurtosisPackageCardGridProps) => import("react/jsx-runtime").JSX.Element>;
7
+ export declare const KurtosisPackageCardGrid: import("react").MemoExoticComponent<({ packages, onPackageRunClicked }: KurtosisPackageCardGridProps) => import("react/jsx-runtime").JSX.Element>;
9
8
  export {};
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Grid, GridItem } from "@chakra-ui/react";
2
+ import { Flex } from "@chakra-ui/react";
3
3
  import { memo } from "react";
4
4
  import { KurtosisPackageCard } from "./KurtosisPackageCard";
5
- export const KurtosisPackageCardGrid = memo(({ packages, onPackageClicked, onPackageRunClicked }) => {
6
- return (_jsx(Grid, { gridTemplateColumns: "1fr 1fr 1fr", columnGap: "32px", rowGap: "32px", children: packages.map((kurtosisPackage) => (_jsx(GridItem, { onClick: onPackageClicked ? () => onPackageClicked(kurtosisPackage) : undefined, children: _jsx(KurtosisPackageCard, { kurtosisPackage: kurtosisPackage, onRunClick: () => onPackageRunClicked(kurtosisPackage) }) }, kurtosisPackage.url))) }));
5
+ export const KurtosisPackageCardGrid = memo(({ packages, onPackageRunClicked }) => {
6
+ return (_jsx(Flex, { gap: "32px", rowGap: "32px", flexWrap: "wrap", justifyContent: "center", children: packages.map((kurtosisPackage) => (_jsx(KurtosisPackageCard, { kurtosisPackage: kurtosisPackage, onRunClick: () => onPackageRunClicked(kurtosisPackage) }))) }));
7
7
  });
@@ -0,0 +1,11 @@
1
+ import { KurtosisPackage } from "kurtosis-cloud-indexer-sdk";
2
+ import { ReactElement } from "react";
3
+ type KurtosisPackageCardRowProps = {
4
+ title: string;
5
+ icon?: ReactElement;
6
+ packages: KurtosisPackage[];
7
+ onSeeAllClicked?: () => void;
8
+ onPackageRunClicked: (kurtosisPackage: KurtosisPackage) => void;
9
+ };
10
+ export declare const KurtosisPackageCardRow: import("react").MemoExoticComponent<({ packages, onSeeAllClicked, onPackageRunClicked, title, icon }: KurtosisPackageCardRowProps) => import("react/jsx-runtime").JSX.Element>;
11
+ export {};
@@ -0,0 +1,49 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, ButtonGroup, Flex, IconButton, Text } from "@chakra-ui/react";
3
+ import { memo, useEffect, useRef, useState } from "react";
4
+ import { MdArrowBackIosNew, MdArrowForwardIos } from "react-icons/md";
5
+ import { isDefined } from "../utils";
6
+ import { KurtosisPackageCard } from "./KurtosisPackageCard";
7
+ export const KurtosisPackageCardRow = memo(({ packages, onSeeAllClicked, onPackageRunClicked, title, icon }) => {
8
+ const flexRef = useRef(null);
9
+ const [scrollPosition, setScrollPosition] = useState("start");
10
+ const handleScrollLeft = () => {
11
+ if (isDefined(flexRef.current)) {
12
+ flexRef.current.scrollBy({ left: -200, top: 0, behavior: "smooth" });
13
+ }
14
+ };
15
+ const handleScrollRight = () => {
16
+ if (isDefined(flexRef.current)) {
17
+ flexRef.current.scrollBy({ left: 200, top: 0, behavior: "smooth" });
18
+ }
19
+ };
20
+ useEffect(() => {
21
+ if (isDefined(flexRef.current)) {
22
+ const updateScrollPosition = () => {
23
+ if (flexRef.current) {
24
+ if (flexRef.current.scrollWidth === flexRef.current.clientWidth) {
25
+ setScrollPosition("not-scrollable");
26
+ }
27
+ else if (flexRef.current.scrollLeft <= 0) {
28
+ setScrollPosition("start");
29
+ }
30
+ else if (flexRef.current.scrollLeft >= flexRef.current.scrollWidth - flexRef.current.clientWidth) {
31
+ setScrollPosition("end");
32
+ }
33
+ else {
34
+ setScrollPosition("mid");
35
+ }
36
+ }
37
+ };
38
+ window.addEventListener("resize", updateScrollPosition);
39
+ flexRef.current.addEventListener("scroll", updateScrollPosition);
40
+ return () => {
41
+ if (isDefined(flexRef.current)) {
42
+ window.removeEventListener("resize", updateScrollPosition);
43
+ flexRef.current.removeEventListener("scroll", updateScrollPosition);
44
+ }
45
+ };
46
+ }
47
+ }, [flexRef.current]);
48
+ return (_jsxs(Flex, { flexDirection: "column", children: [_jsxs(Flex, { justifyContent: "space-between", fontSize: "lg", pb: "16px", fontWeight: "medium", children: [_jsxs(Flex, { gap: "8px", alignItems: "center", children: [icon, _jsx(Text, { as: "span", children: title })] }), _jsxs(Flex, { gap: "16px", children: [isDefined(onSeeAllClicked) && (_jsx(Button, { variant: "ghost", onClick: onSeeAllClicked, size: "xs", children: "See all" })), _jsxs(ButtonGroup, { isAttached: true, variant: "ghost", size: "xs", children: [_jsx(IconButton, { "aria-label": "Scroll left", onClick: handleScrollLeft, icon: _jsx(MdArrowBackIosNew, {}), isDisabled: scrollPosition === "start" || scrollPosition === "not-scrollable" }), _jsx(IconButton, { "aria-label": "Scroll right", onClick: handleScrollRight, icon: _jsx(MdArrowForwardIos, {}), isDisabled: scrollPosition === "end" || scrollPosition === "not-scrollable" })] })] })] }), _jsx(Flex, { ref: flexRef, gap: "32px", rowGap: "32px", overflowX: "auto", justifyContent: "flex-start", children: packages.map((kurtosisPackage) => (_jsx(KurtosisPackageCard, { kurtosisPackage: kurtosisPackage, onRunClick: () => onPackageRunClicked(kurtosisPackage) }))) })] }));
49
+ });
@@ -1,6 +1,8 @@
1
1
  export * from "./KurtosisPackageCard";
2
2
  export * from "./KurtosisPackageCardGrid";
3
+ export * from "./KurtosisPackageCardRow";
3
4
  export * from "./SavedPackages";
4
5
  export * from "./utils";
6
+ export * from "./widgets/PackageLogo";
5
7
  export * from "./widgets/RunKurtosisPackageButton";
6
8
  export * from "./widgets/SaveKurtosisPackageButton";
@@ -1,6 +1,8 @@
1
1
  export * from "./KurtosisPackageCard";
2
2
  export * from "./KurtosisPackageCardGrid";
3
+ export * from "./KurtosisPackageCardRow";
3
4
  export * from "./SavedPackages";
4
5
  export * from "./utils";
6
+ export * from "./widgets/PackageLogo";
5
7
  export * from "./widgets/RunKurtosisPackageButton";
6
8
  export * from "./widgets/SaveKurtosisPackageButton";
@@ -0,0 +1,7 @@
1
+ import { ImageProps } from "@chakra-ui/react";
2
+ import { KurtosisPackage } from "kurtosis-cloud-indexer-sdk";
3
+ type PackageLogoProps = ImageProps & {
4
+ kurtosisPackage: KurtosisPackage;
5
+ };
6
+ export declare const PackageLogo: ({ kurtosisPackage, ...imageProps }: PackageLogoProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Image } from "@chakra-ui/react";
3
+ import { useHref } from "react-router-dom";
4
+ import { isDefined } from "../../utils";
5
+ export const PackageLogo = ({ kurtosisPackage, ...imageProps }) => {
6
+ var _a;
7
+ const noLogoHref = useHref("/noLogo.png");
8
+ const kurtosisLogoHref = useHref("/logo.png");
9
+ const hasLogo = isDefined(kurtosisPackage.iconUrl) && kurtosisPackage.iconUrl !== "";
10
+ const isKurtosisPackage = ((_a = kurtosisPackage.repositoryMetadata) === null || _a === void 0 ? void 0 : _a.owner) === "kurtosis-tech";
11
+ return (_jsx(Image, { src: hasLogo ? kurtosisPackage.iconUrl : isKurtosisPackage ? kurtosisLogoHref : noLogoHref, fallbackSrc: noLogoHref, borderRadius: "6px", ...imageProps }));
12
+ };
@@ -3,7 +3,7 @@ import { Button } from "@chakra-ui/react";
3
3
  import { FiPlay } from "react-icons/fi";
4
4
  import { isDefined } from "../../utils";
5
5
  export const RunKurtosisPackageButton = ({ kurtosisPackage, ...buttonProps }) => {
6
- return (_jsx(Button, { size: "xs", variant: "solidOutline", colorScheme: "kurtosisGreen", leftIcon: _jsx(FiPlay, {}), ...buttonProps, onClick: (e) => {
6
+ return (_jsx(Button, { size: "xs", variant: "solid", colorScheme: "kurtosisGreen", leftIcon: _jsx(FiPlay, {}), ...buttonProps, onClick: (e) => {
7
7
  e.preventDefault();
8
8
  if (isDefined(buttonProps.onClick)) {
9
9
  buttonProps.onClick(e);
@@ -1,7 +1,8 @@
1
- import { ButtonProps } from "@chakra-ui/react";
1
+ import { ButtonProps, IconButtonProps } from "@chakra-ui/react";
2
2
  import { KurtosisPackage } from "kurtosis-cloud-indexer-sdk";
3
- type SaveKurtosisPackageButtonProps = ButtonProps & {
3
+ type SaveKurtosisPackageButtonProps<IsIconButton extends boolean> = (IsIconButton extends true ? IconButtonProps : ButtonProps) & {
4
4
  kurtosisPackage: KurtosisPackage;
5
+ isIconButton?: IsIconButton;
5
6
  };
6
- export declare const SaveKurtosisPackageButton: ({ kurtosisPackage, ...buttonProps }: SaveKurtosisPackageButtonProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ export declare const SaveKurtosisPackageButton: <IsIconButton extends boolean>({ kurtosisPackage, ...buttonProps }: SaveKurtosisPackageButtonProps<IsIconButton>) => import("react/jsx-runtime").JSX.Element | null;
7
8
  export {};
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Button } from "@chakra-ui/react";
2
+ import { Button, IconButton } from "@chakra-ui/react";
3
3
  import { memo, useCallback, useMemo } from "react";
4
4
  import { MdBookmarkAdd } from "react-icons/md";
5
5
  import { isDefined } from "../../utils";
@@ -23,6 +23,11 @@ const SaveKurtosisPackageButtonImpl = ({ kurtosisPackage, ...buttonProps }) => {
23
23
  };
24
24
  // this is memo'd to skip unecessary renders, which effectively doubles the performance of this component (as it is
25
25
  // displayed a lot.
26
- const SaveKurtosisPackageButtonMemo = memo(({ isPackageSaved, onClick, ...buttonProps }) => {
27
- return (_jsx(Button, { size: "xs", variant: "solid", colorScheme: isPackageSaved ? "kurtosisGreen" : "darkBlue", leftIcon: _jsx(MdBookmarkAdd, {}), onClick: onClick, bg: isPackageSaved ? "#18371E" : undefined, ...buttonProps, children: isPackageSaved ? "Saved" : "Save" }));
26
+ const SaveKurtosisPackageButtonMemo = memo(({ isPackageSaved, onClick, isIconButton, ...buttonProps }) => {
27
+ if (isIconButton) {
28
+ return (_jsx(IconButton, { icon: _jsx(MdBookmarkAdd, {}), size: "xs", variant: "solid", colorScheme: isPackageSaved ? "kurtosisGreen" : "darkBlue", onClick: onClick, ...buttonProps, children: isPackageSaved ? "Saved" : "Save" }));
29
+ }
30
+ else {
31
+ return (_jsx(Button, { leftIcon: _jsx(MdBookmarkAdd, {}), size: "xs", variant: "savedSolid", colorScheme: isPackageSaved ? "kurtosisGreen" : "darkBlue", bg: isPackageSaved ? "#18371E" : undefined, onClick: onClick, ...buttonProps, children: isPackageSaved ? "Saved" : "Save" }));
32
+ }
28
33
  });
@@ -1,4 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Global } from "@emotion/react";
3
- const Fonts = () => (_jsx(Global, { styles: `@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');` }));
3
+ const Fonts = () => (_jsx(Global, { styles: `
4
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');
5
+ @import url('https://fonts.googleapis.com/css2?family=Inconsolata:wght@200;300;400;500;600;700;800;900&display=swap');
6
+ ` }));
4
7
  export default Fonts;
@@ -11,6 +11,8 @@ export declare function isAsyncIterable<T>(input: Iterable<T> | any): input is A
11
11
  export declare function capitalize(input: string): string;
12
12
  export declare function hasAnsi(text: string): boolean;
13
13
  export declare function stripAnsi(input: string): string;
14
+ export declare const numberSummary: (val: number) => string;
15
+ export declare function maybeArrayToArray<T>(maybeArray: T | T[]): T[];
14
16
  export declare function range(until: number): number[];
15
17
  export declare function range(from: number, to: number): [];
16
18
  export declare function range(from: number, to: number, step: number): number[];
@@ -48,6 +48,21 @@ export function stripAnsi(input) {
48
48
  }
49
49
  return input.replace(ansiRegex, "");
50
50
  }
51
+ export const numberSummary = (val) => {
52
+ if (val < 1000) {
53
+ return `${val}`;
54
+ }
55
+ if (val < 10000) {
56
+ return `${(val / 1000).toFixed(1)}k`;
57
+ }
58
+ if (val < 1000000) {
59
+ return `${Math.round(val / 1000)}k`;
60
+ }
61
+ return `${Math.round(val / 1000000).toFixed(1)}m`;
62
+ };
63
+ export function maybeArrayToArray(maybeArray) {
64
+ return Array.isArray(maybeArray) ? maybeArray : [maybeArray];
65
+ }
51
66
  export function range(a, b, c) {
52
67
  const start = isDefined(b) ? a : 0;
53
68
  const stop = isDefined(b) ? b : a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kurtosis-ui-components",
3
- "version": "0.85.53",
3
+ "version": "0.85.55",
4
4
  "private": false,
5
5
  "main": "build/index",
6
6
  "description": "This repo contains components used by Kurtosis UI applications.",