@bitrise/bitkit-v2 0.3.398 → 0.3.399
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,8 +12,8 @@ export interface BitkitStepsCardBodyProps extends Omit<CardBodyProps, 'children'
|
|
|
12
12
|
}
|
|
13
13
|
export interface BitkitStepsCardStepProps {
|
|
14
14
|
children?: ReactNode;
|
|
15
|
-
description?:
|
|
16
|
-
title
|
|
15
|
+
description?: ReactNode;
|
|
16
|
+
title?: ReactNode;
|
|
17
17
|
}
|
|
18
18
|
export interface BitkitStepsCardFooterProps extends Omit<CardFooterProps, 'children'> {
|
|
19
19
|
children: ReactNode;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { withSubComponents } from "../../utilities/withSubComponents.js";
|
|
2
2
|
import { StepCardProvider, useStepCardContext } from "./StepCardContext.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Box } from "@chakra-ui/react/box";
|
|
4
|
+
import { useSlotRecipe } from "@chakra-ui/react/styled-system";
|
|
4
5
|
import { Children, cloneElement, forwardRef, isValidElement } from "react";
|
|
5
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { Card } from "@chakra-ui/react/card";
|
|
@@ -48,17 +49,20 @@ var BitkitStepsCardBody = forwardRef((props, ref) => {
|
|
|
48
49
|
});
|
|
49
50
|
});
|
|
50
51
|
BitkitStepsCardBody.displayName = "BitkitStepsCardBody";
|
|
52
|
+
var hasContent = (node) => node !== null && node !== void 0 && node !== "";
|
|
51
53
|
var BitkitStepsCardStep = (props) => {
|
|
52
54
|
const { _index = 0, children, description, title } = props;
|
|
53
55
|
const { step } = useStepCardContext() ?? { step: 0 };
|
|
54
56
|
const styles = useStepsCardStyles();
|
|
55
57
|
if (_index !== step) return null;
|
|
56
|
-
|
|
58
|
+
const showTitle = hasContent(title);
|
|
59
|
+
const showDescription = hasContent(description);
|
|
60
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [(showTitle || showDescription) && /* @__PURE__ */ jsxs(Box, {
|
|
57
61
|
css: styles.titleGroup,
|
|
58
|
-
children: [/* @__PURE__ */ jsx(Card.Title, {
|
|
62
|
+
children: [showTitle && /* @__PURE__ */ jsx(Card.Title, {
|
|
59
63
|
css: styles.title,
|
|
60
64
|
children: title
|
|
61
|
-
}),
|
|
65
|
+
}), showDescription && /* @__PURE__ */ jsx(Card.Description, {
|
|
62
66
|
css: styles.description,
|
|
63
67
|
children: description
|
|
64
68
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitStepsCard.js","names":[],"sources":["../../../lib/components/BitkitStepsCard/BitkitStepsCard.tsx"],"sourcesContent":["import {\n Card,\n type CardBodyProps,\n type CardFooterProps,\n type CardHeaderProps,\n type CardRootProps,\n} from '@chakra-ui/react/card';\nimport {
|
|
1
|
+
{"version":3,"file":"BitkitStepsCard.js","names":[],"sources":["../../../lib/components/BitkitStepsCard/BitkitStepsCard.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport {\n Card,\n type CardBodyProps,\n type CardFooterProps,\n type CardHeaderProps,\n type CardRootProps,\n} from '@chakra-ui/react/card';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Children, cloneElement, forwardRef, isValidElement, type ReactElement, type ReactNode } from 'react';\n\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport { StepCardProvider, useStepCardContext } from './StepCardContext';\n\nconst useStepsCardStyles = () => {\n const recipe = useSlotRecipe({ key: 'stepsCard' });\n return recipe();\n};\n\nexport interface BitkitStepsCardProps extends Omit<CardRootProps, 'children' | 'title'> {\n children: ReactNode;\n step: number;\n}\n\nconst BitkitStepsCard = forwardRef<HTMLDivElement, BitkitStepsCardProps>((props, ref) => {\n const { children, step, ...rest } = props;\n const styles = useStepsCardStyles();\n\n return (\n <StepCardProvider value={{ step }}>\n <Card.Root ref={ref} css={styles.root} unstyled {...rest}>\n {children}\n </Card.Root>\n </StepCardProvider>\n );\n});\n\nBitkitStepsCard.displayName = 'BitkitStepsCard';\n\nexport interface BitkitStepsCardHeaderProps extends Omit<CardHeaderProps, 'children'> {\n children: ReactNode;\n}\n\nconst BitkitStepsCardHeader = forwardRef<HTMLDivElement, BitkitStepsCardHeaderProps>((props, ref) => {\n const { children, ...rest } = props;\n const styles = useStepsCardStyles();\n\n return (\n <Card.Header ref={ref} css={styles.header} {...rest}>\n {children}\n </Card.Header>\n );\n});\n\nBitkitStepsCardHeader.displayName = 'BitkitStepsCardHeader';\n\nexport interface BitkitStepsCardBodyProps extends Omit<CardBodyProps, 'children'> {\n children: ReactNode;\n}\n\nconst BitkitStepsCardBody = forwardRef<HTMLDivElement, BitkitStepsCardBodyProps>((props, ref) => {\n const { children, ...rest } = props;\n const styles = useStepsCardStyles();\n\n return (\n <Card.Body ref={ref} css={styles.body} {...rest}>\n {Children.map(children, (child, index) => {\n if (isValidElement(child)) {\n return cloneElement(child as ReactElement<{ _index?: number }>, { _index: index });\n }\n return child;\n })}\n </Card.Body>\n );\n});\n\nBitkitStepsCardBody.displayName = 'BitkitStepsCardBody';\n\nconst hasContent = (node: ReactNode) => node !== null && node !== undefined && node !== '';\n\nexport interface BitkitStepsCardStepProps {\n children?: ReactNode;\n description?: ReactNode;\n title?: ReactNode;\n}\n\ninterface BitkitStepsCardStepInternalProps extends BitkitStepsCardStepProps {\n _index?: number;\n}\n\nconst BitkitStepsCardStep = (props: BitkitStepsCardStepProps) => {\n const { _index = 0, children, description, title } = props as BitkitStepsCardStepInternalProps;\n const { step } = useStepCardContext() ?? { step: 0 };\n const styles = useStepsCardStyles();\n\n if (_index !== step) return null;\n\n const showTitle = hasContent(title);\n const showDescription = hasContent(description);\n\n return (\n <>\n {(showTitle || showDescription) && (\n <Box css={styles.titleGroup}>\n {showTitle && <Card.Title css={styles.title}>{title}</Card.Title>}\n {showDescription && <Card.Description css={styles.description}>{description}</Card.Description>}\n </Box>\n )}\n {children}\n </>\n );\n};\n\nBitkitStepsCardStep.displayName = 'BitkitStepsCardStep';\n\nexport interface BitkitStepsCardFooterProps extends Omit<CardFooterProps, 'children'> {\n children: ReactNode;\n}\n\nconst BitkitStepsCardFooter = forwardRef<HTMLDivElement, BitkitStepsCardFooterProps>((props, ref) => {\n const { children, ...rest } = props;\n const styles = useStepsCardStyles();\n\n return (\n <Card.Footer ref={ref} css={styles.footer} {...rest}>\n {children}\n </Card.Footer>\n );\n});\n\nBitkitStepsCardFooter.displayName = 'BitkitStepsCardFooter';\n\nexport default withSubComponents(BitkitStepsCard, {\n Body: BitkitStepsCardBody,\n Footer: BitkitStepsCardFooter,\n Header: BitkitStepsCardHeader,\n Step: BitkitStepsCardStep,\n});\n"],"mappings":";;;;;;;;AAcA,IAAM,2BAA2B;CAE/B,OADe,cAAc,EAAE,KAAK,YAAY,CACzC,CAAA,CAAO;AAChB;AAOA,IAAM,kBAAkB,YAAkD,OAAO,QAAQ;CACvF,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS;CACpC,MAAM,SAAS,mBAAmB;CAElC,OACE,oBAAC,kBAAD;EAAkB,OAAO,EAAE,KAAK;EAC9B,UAAA,oBAAC,KAAK,MAAN;GAAgB;GAAK,KAAK,OAAO;GAAM,UAAA;GAAS,GAAI;GACjD;EACQ,CAAA;CACK,CAAA;AAEtB,CAAC;AAED,gBAAgB,cAAc;AAM9B,IAAM,wBAAwB,YAAwD,OAAO,QAAQ;CACnG,MAAM,EAAE,UAAU,GAAG,SAAS;CAC9B,MAAM,SAAS,mBAAmB;CAElC,OACE,oBAAC,KAAK,QAAN;EAAkB;EAAK,KAAK,OAAO;EAAQ,GAAI;EAC5C;CACU,CAAA;AAEjB,CAAC;AAED,sBAAsB,cAAc;AAMpC,IAAM,sBAAsB,YAAsD,OAAO,QAAQ;CAC/F,MAAM,EAAE,UAAU,GAAG,SAAS;CAC9B,MAAM,SAAS,mBAAmB;CAElC,OACE,oBAAC,KAAK,MAAN;EAAgB;EAAK,KAAK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