@bitrise/bitkit-v2 0.3.452 → 0.3.453
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.
|
@@ -3,6 +3,11 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import { BitkitIconComponent } from '../../icons';
|
|
4
4
|
export interface BitkitSectionHeadingProps extends Omit<BoxProps, 'icon'> {
|
|
5
5
|
children?: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* The heading tag the label renders as, so the section fits the page's outline. Only the tag
|
|
8
|
+
* changes: the label keeps the `heading/h3` look at every level.
|
|
9
|
+
*/
|
|
10
|
+
headingLevel?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
6
11
|
helperText?: ReactNode | ReactNode[];
|
|
7
12
|
helperTooltip?: string;
|
|
8
13
|
icon?: BitkitIconComponent;
|
|
@@ -4,10 +4,11 @@ import { Box } from "@chakra-ui/react/box";
|
|
|
4
4
|
import { chakra, useSlotRecipe } from "@chakra-ui/react/styled-system";
|
|
5
5
|
import { Fragment, forwardRef } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Text } from "@chakra-ui/react/text";
|
|
7
8
|
//#region lib/components/BitkitSectionHeading/BitkitSectionHeading.tsx
|
|
8
9
|
var HELPER_DOT = "•";
|
|
9
10
|
var BitkitSectionHeading = forwardRef((props, ref) => {
|
|
10
|
-
const { children, css, helperText, helperTooltip, icon: Icon, label, ...rest } = props;
|
|
11
|
+
const { children, css, headingLevel = "h3", helperText, helperTooltip, icon: Icon, label, ...rest } = props;
|
|
11
12
|
const styles = useSlotRecipe({ key: "sectionHeading" })();
|
|
12
13
|
const helperItems = Array.isArray(helperText) ? helperText : helperText ? [helperText] : [];
|
|
13
14
|
const hasHelper = helperItems.length > 0 || Boolean(helperTooltip);
|
|
@@ -22,7 +23,8 @@ var BitkitSectionHeading = forwardRef((props, ref) => {
|
|
|
22
23
|
children: [Icon && /* @__PURE__ */ jsx(Icon, {
|
|
23
24
|
css: styles.icon,
|
|
24
25
|
size: "24"
|
|
25
|
-
}), /* @__PURE__ */ jsx(
|
|
26
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
27
|
+
as: headingLevel,
|
|
26
28
|
css: styles.label,
|
|
27
29
|
children: label
|
|
28
30
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitSectionHeading.js","names":[],"sources":["../../../lib/components/BitkitSectionHeading/BitkitSectionHeading.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { chakra, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef, Fragment, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport IconInfoCircle from '../../icons/IconInfoCircle';\nimport BitkitTooltip from '../BitkitTooltip/BitkitTooltip';\n\nexport interface BitkitSectionHeadingProps extends Omit<BoxProps, 'icon'> {\n children?: ReactNode;\n helperText?: ReactNode | ReactNode[];\n helperTooltip?: string;\n icon?: BitkitIconComponent;\n label: string;\n}\n\nconst HELPER_DOT = '\\u2022';\n\nconst BitkitSectionHeading = forwardRef<HTMLDivElement, BitkitSectionHeadingProps>((props, ref) => {\n const { children, css, helperText, helperTooltip, icon: Icon, label, ...rest } = props;\n\n const recipe = useSlotRecipe({ key: 'sectionHeading' });\n const styles = recipe();\n\n const helperItems = Array.isArray(helperText) ? helperText : helperText ? [helperText] : [];\n const hasHelper = helperItems.length > 0 || Boolean(helperTooltip);\n\n return (\n <Box css={[styles.root, css]} ref={ref} {...rest}>\n <chakra.div css={styles.contentBlock}>\n <chakra.div css={styles.titleBlock}>\n {Icon && <Icon css={styles.icon} size=\"24\" />}\n <
|
|
1
|
+
{"version":3,"file":"BitkitSectionHeading.js","names":[],"sources":["../../../lib/components/BitkitSectionHeading/BitkitSectionHeading.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { chakra, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { forwardRef, Fragment, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport IconInfoCircle from '../../icons/IconInfoCircle';\nimport BitkitTooltip from '../BitkitTooltip/BitkitTooltip';\n\nexport interface BitkitSectionHeadingProps extends Omit<BoxProps, 'icon'> {\n children?: ReactNode;\n /**\n * The heading tag the label renders as, so the section fits the page's outline. Only the tag\n * changes: the label keeps the `heading/h3` look at every level.\n */\n headingLevel?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n helperText?: ReactNode | ReactNode[];\n helperTooltip?: string;\n icon?: BitkitIconComponent;\n label: string;\n}\n\nconst HELPER_DOT = '\\u2022';\n\nconst BitkitSectionHeading = forwardRef<HTMLDivElement, BitkitSectionHeadingProps>((props, ref) => {\n const { children, css, headingLevel = 'h3', helperText, helperTooltip, icon: Icon, label, ...rest } = props;\n\n const recipe = useSlotRecipe({ key: 'sectionHeading' });\n const styles = recipe();\n\n const helperItems = Array.isArray(helperText) ? helperText : helperText ? [helperText] : [];\n const hasHelper = helperItems.length > 0 || Boolean(helperTooltip);\n\n return (\n <Box css={[styles.root, css]} ref={ref} {...rest}>\n <chakra.div css={styles.contentBlock}>\n <chakra.div css={styles.titleBlock}>\n {Icon && <Icon css={styles.icon} size=\"24\" />}\n <Text as={headingLevel} css={styles.label}>\n {label}\n </Text>\n </chakra.div>\n {hasHelper && (\n <chakra.div css={styles.helperBlock}>\n {helperItems.map((text, index) => (\n <Fragment key={index}>\n {index > 0 && (\n <chakra.span color=\"text/tertiary\" flexShrink={0} textStyle=\"body/md/regular\">\n {HELPER_DOT}\n </chakra.span>\n )}\n <chakra.span css={styles.helperText}>{text}</chakra.span>\n </Fragment>\n ))}\n {helperTooltip && (\n <BitkitTooltip text={helperTooltip}>\n <IconInfoCircle color=\"icon/tertiary\" size=\"16\" />\n </BitkitTooltip>\n )}\n </chakra.div>\n )}\n </chakra.div>\n {children}\n </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