@bitrise/bitkit-v2 0.3.344 → 0.3.345-beta.2199
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/dist/components/BitkitBadge/BitkitBadge.js +8 -9
- package/dist/components/BitkitBadge/BitkitBadge.js.map +1 -1
- package/dist/components/BitkitLabel/BitkitLabel.js +2 -2
- package/dist/components/BitkitLabel/BitkitLabel.js.map +1 -1
- package/dist/components/BitkitTreeView/BitkitTreeView.js +1 -1
- package/dist/components/BitkitTreeView/BitkitTreeView.js.map +1 -1
- package/dist/theme/recipes/Badge.recipe.d.ts +2 -2
- package/dist/theme/recipes/Badge.recipe.js +3 -3
- package/dist/theme/recipes/Badge.recipe.js.map +1 -1
- package/dist/theme/recipes/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -3,18 +3,17 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Badge } from "@chakra-ui/react/badge";
|
|
4
4
|
//#region lib/components/BitkitBadge/BitkitBadge.tsx
|
|
5
5
|
var BitkitBadge = forwardRef((props, ref) => {
|
|
6
|
-
const { children, icon: Icon, size = "
|
|
6
|
+
const { children, icon: Icon, size = "sm", ...rest } = props;
|
|
7
7
|
const childrenLength = children === void 0 ? 0 : String(children).length;
|
|
8
8
|
let paddingInlineStart;
|
|
9
9
|
let paddingInlineEnd;
|
|
10
|
-
if (childrenLength
|
|
11
|
-
paddingInlineStart = size === "
|
|
12
|
-
paddingInlineEnd = size === "
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
paddingInlineStart =
|
|
17
|
-
paddingInlineEnd = size === "xs" ? "4" : "2";
|
|
10
|
+
if (childrenLength === 1 && !Icon) {
|
|
11
|
+
paddingInlineStart = size === "sm" ? "4" : "2";
|
|
12
|
+
paddingInlineEnd = size === "sm" ? "4" : "2";
|
|
13
|
+
} else if (childrenLength > 0) {
|
|
14
|
+
paddingInlineStart = size === "sm" ? "8" : "6";
|
|
15
|
+
paddingInlineEnd = size === "sm" ? "8" : "6";
|
|
16
|
+
if (Icon) paddingInlineStart = "4";
|
|
18
17
|
}
|
|
19
18
|
return /* @__PURE__ */ jsxs(Badge, {
|
|
20
19
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitBadge.js","names":[],"sources":["../../../lib/components/BitkitBadge/BitkitBadge.tsx"],"sourcesContent":["import { Badge, type BadgeProps } from '@chakra-ui/react/badge';\nimport { forwardRef } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\n\nexport type BitkitBadgeProps = {\n children?: string | number;\n icon?: BitkitIconComponent;\n} & Omit<BadgeProps, 'children' | 'colorPalette'>;\n\nconst BitkitBadge = forwardRef<HTMLSpanElement, BitkitBadgeProps>((props, ref) => {\n const { children, icon: Icon, size = '
|
|
1
|
+
{"version":3,"file":"BitkitBadge.js","names":[],"sources":["../../../lib/components/BitkitBadge/BitkitBadge.tsx"],"sourcesContent":["import { Badge, type BadgeProps } from '@chakra-ui/react/badge';\nimport { forwardRef } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\n\nexport type BitkitBadgeProps = {\n children?: string | number;\n icon?: BitkitIconComponent;\n} & Omit<BadgeProps, 'children' | 'colorPalette'>;\n\nconst BitkitBadge = forwardRef<HTMLSpanElement, BitkitBadgeProps>((props, ref) => {\n const { children, icon: Icon, size = 'sm', ...rest } = props;\n\n const childrenLength = children === undefined ? 0 : String(children).length;\n\n let paddingInlineStart: BitkitBadgeProps['paddingInlineStart'];\n let paddingInlineEnd: BitkitBadgeProps['paddingInlineEnd'];\n\n if (childrenLength === 1 && !Icon) {\n paddingInlineStart = size === 'sm' ? '4' : '2';\n paddingInlineEnd = size === 'sm' ? '4' : '2';\n } else if (childrenLength > 0) {\n paddingInlineStart = size === 'sm' ? '8' : '6';\n paddingInlineEnd = size === 'sm' ? '8' : '6';\n if (Icon) {\n paddingInlineStart = '4';\n }\n }\n\n return (\n <Badge ref={ref} {...rest} size={size} paddingInlineStart={paddingInlineStart} paddingInlineEnd={paddingInlineEnd}>\n {Icon && <Icon size=\"16\" />}\n {children}\n </Badge>\n );\n});\n\nBitkitBadge.displayName = 'BitkitBadge';\n\nexport default BitkitBadge;\n"],"mappings":";;;;AAUA,IAAM,cAAc,YAA+C,OAAO,QAAQ;CAChF,MAAM,EAAE,UAAU,MAAM,MAAM,OAAO,MAAM,GAAG,SAAS;CAEvD,MAAM,iBAAiB,aAAa,KAAA,IAAY,IAAI,OAAO,QAAQ,CAAC,CAAC;CAErE,IAAI;CACJ,IAAI;CAEJ,IAAI,mBAAmB,KAAK,CAAC,MAAM;EACjC,qBAAqB,SAAS,OAAO,MAAM;EAC3C,mBAAmB,SAAS,OAAO,MAAM;CAC3C,OAAO,IAAI,iBAAiB,GAAG;EAC7B,qBAAqB,SAAS,OAAO,MAAM;EAC3C,mBAAmB,SAAS,OAAO,MAAM;EACzC,IAAI,MACF,qBAAqB;CAEzB;CAEA,OACE,qBAAC,OAAD;EAAY;EAAK,GAAI;EAAY;EAA0B;EAAsC;EAAjG,UAAA,CACG,QAAQ,oBAAC,MAAD,EAAM,MAAK,KAAM,CAAA,GACzB,QACI;;AAEX,CAAC;AAED,YAAY,cAAc"}
|
|
@@ -19,8 +19,8 @@ var BitkitLabel = forwardRef((props, ref) => {
|
|
|
19
19
|
const optional = optionalProp ?? (field ? !field.required : void 0);
|
|
20
20
|
const badgeProps = disabled ? {
|
|
21
21
|
colorVariant: "neutral",
|
|
22
|
-
size: "
|
|
23
|
-
} : { size: "
|
|
22
|
+
size: "xs"
|
|
23
|
+
} : { size: "xs" };
|
|
24
24
|
const renderedBadge = isValidElement(badge) ? cloneElement(badge, badgeProps) : badge;
|
|
25
25
|
return /* @__PURE__ */ jsxs(chakra.label, {
|
|
26
26
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitLabel.js","names":[],"sources":["../../../lib/components/BitkitLabel/BitkitLabel.tsx"],"sourcesContent":["import { type BadgeProps } from '@chakra-ui/react/badge';\nimport { useFieldContext } from '@chakra-ui/react/field';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { chakra, type HTMLChakraProps, type SystemStyleObject, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { cloneElement, forwardRef, isValidElement, type ReactElement, type ReactNode } from 'react';\n\nimport { IconInfoCircle } from '../../icons';\nimport BitkitTooltip from '../BitkitTooltip/BitkitTooltip';\n\nexport interface BitkitLabelProps extends Omit<HTMLChakraProps<'label'>, 'children'> {\n badge?: ReactNode;\n counterText?: string;\n disabled?: boolean;\n children?: string;\n optional?: boolean;\n tooltip?: string;\n}\n\nconst disabledStyles: SystemStyleObject = {\n color: 'text/disabled',\n '& > span': { color: 'text/disabled' },\n};\n\nconst BitkitLabel = forwardRef<HTMLLabelElement, BitkitLabelProps>((props, ref) => {\n const { badge, counterText, css, disabled: disabledProp, children, optional: optionalProp, tooltip, ...rest } = props;\n\n const field = useFieldContext();\n const styles = useSlotRecipe({ key: 'field' })();\n\n const disabled = disabledProp ?? field?.disabled;\n const optional = optionalProp ?? (field ? !field.required : undefined);\n\n const badgeProps = disabled ? ({ colorVariant: 'neutral', size: '
|
|
1
|
+
{"version":3,"file":"BitkitLabel.js","names":[],"sources":["../../../lib/components/BitkitLabel/BitkitLabel.tsx"],"sourcesContent":["import { type BadgeProps } from '@chakra-ui/react/badge';\nimport { useFieldContext } from '@chakra-ui/react/field';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { chakra, type HTMLChakraProps, type SystemStyleObject, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { cloneElement, forwardRef, isValidElement, type ReactElement, type ReactNode } from 'react';\n\nimport { IconInfoCircle } from '../../icons';\nimport BitkitTooltip from '../BitkitTooltip/BitkitTooltip';\n\nexport interface BitkitLabelProps extends Omit<HTMLChakraProps<'label'>, 'children'> {\n badge?: ReactNode;\n counterText?: string;\n disabled?: boolean;\n children?: string;\n optional?: boolean;\n tooltip?: string;\n}\n\nconst disabledStyles: SystemStyleObject = {\n color: 'text/disabled',\n '& > span': { color: 'text/disabled' },\n};\n\nconst BitkitLabel = forwardRef<HTMLLabelElement, BitkitLabelProps>((props, ref) => {\n const { badge, counterText, css, disabled: disabledProp, children, optional: optionalProp, tooltip, ...rest } = props;\n\n const field = useFieldContext();\n const styles = useSlotRecipe({ key: 'field' })();\n\n const disabled = disabledProp ?? field?.disabled;\n const optional = optionalProp ?? (field ? !field.required : undefined);\n\n const badgeProps = disabled ? ({ colorVariant: 'neutral', size: 'xs' } as const) : ({ size: 'xs' } as const);\n const renderedBadge = isValidElement(badge) ? cloneElement(badge as ReactElement<BadgeProps>, badgeProps) : badge;\n\n return (\n <chakra.label\n ref={ref}\n css={[styles.label, disabled && disabledStyles, css]}\n data-disabled={disabled || undefined}\n {...rest}\n >\n {children}{' '}\n {optional && (\n <Text as=\"span\" textStyle=\"body/md/regular\">\n (optional)\n </Text>\n )}\n {!!tooltip && (\n <BitkitTooltip text={tooltip}>\n <IconInfoCircle size=\"16\" color=\"icon/tertiary\" />\n </BitkitTooltip>\n )}\n {(!!counterText || !!badge) && (\n <Flex alignItems=\"center\" gap=\"12\" marginInlineStart=\"auto\">\n {renderedBadge}\n {!!counterText && (\n <Text as=\"span\" color={disabled ? 'text/disabled' : 'text/helper'} textStyle=\"comp/input/helperText\">\n {counterText}\n </Text>\n )}\n </Flex>\n )}\n </chakra.label>\n );\n});\n\nBitkitLabel.displayName = 'BitkitLabel';\n\nexport default BitkitLabel;\n"],"mappings":";;;;;;;;;AAmBA,IAAM,iBAAoC;CACxC,OAAO;CACP,YAAY,EAAE,OAAO,gBAAgB;AACvC;AAEA,IAAM,cAAc,YAAgD,OAAO,QAAQ;CACjF,MAAM,EAAE,OAAO,aAAa,KAAK,UAAU,cAAc,UAAU,UAAU,cAAc,SAAS,GAAG,SAAS;CAEhH,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,SAAS,cAAc,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC;CAE/C,MAAM,WAAW,gBAAgB,OAAO;CACxC,MAAM,WAAW,iBAAiB,QAAQ,CAAC,MAAM,WAAW,KAAA;CAE5D,MAAM,aAAa,WAAY;EAAE,cAAc;EAAW,MAAM;CAAK,IAAe,EAAE,MAAM,KAAK;CACjG,MAAM,gBAAgB,eAAe,KAAK,IAAI,aAAa,OAAmC,UAAU,IAAI;CAE5G,OACE,qBAAC,OAAO,OAAR;EACO;EACL,KAAK;GAAC,OAAO;GAAO,YAAY;GAAgB;EAAG;EACnD,iBAAe,YAAY,KAAA;EAC3B,GAAI;EAJN,UAAA;GAMG;GAAU;GACV,YACC,oBAAC,MAAD;IAAM,IAAG;IAAO,WAAU;IAAkB,UAAA;GAEtC,CAAA;GAEP,CAAC,CAAC,WACD,oBAAC,eAAD;IAAe,MAAM;IACnB,UAAA,oBAAC,gBAAD;KAAgB,MAAK;KAAK,OAAM;IAAiB,CAAA;GACpC,CAAA;IAEf,CAAC,CAAC,eAAe,CAAC,CAAC,UACnB,qBAAC,MAAD;IAAM,YAAW;IAAS,KAAI;IAAK,mBAAkB;IAArD,UAAA,CACG,eACA,CAAC,CAAC,eACD,oBAAC,MAAD;KAAM,IAAG;KAAO,OAAO,WAAW,kBAAkB;KAAe,WAAU;KAC1E,UAAA;IACG,CAAA,CAEJ;;EAEI;;AAElB,CAAC;AAED,YAAY,cAAc"}
|
|
@@ -79,7 +79,7 @@ var Leaf = forwardRef((props, ref) => {
|
|
|
79
79
|
...rest,
|
|
80
80
|
children: [
|
|
81
81
|
Icon && /* @__PURE__ */ jsx(Icon, { size: "16" }),
|
|
82
|
-
badge && cloneElement(badge, { size: "
|
|
82
|
+
badge && cloneElement(badge, { size: "xs" }),
|
|
83
83
|
/* @__PURE__ */ jsxs(TreeView.ItemText, { children: [label, subtext && /* @__PURE__ */ jsx(Text, {
|
|
84
84
|
css: styles.secondaryText,
|
|
85
85
|
children: subtext
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitTreeView.js","names":[],"sources":["../../../lib/components/BitkitTreeView/BitkitTreeView.tsx"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { createContext } from '@chakra-ui/react';\nimport { Box } from '@chakra-ui/react/box';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport {\n TreeView,\n type TreeViewBranchControlProps,\n type TreeViewItemProps,\n type TreeViewNodeRenderProps,\n type TreeViewRootProps,\n} from '@chakra-ui/react/tree-view';\nimport { cloneElement, forwardRef, type ReactElement, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent, IconChevronRight, IconFolder, IconWarningYellow } from '../../icons';\nimport { withSubComponents } from '../../utilities/withSubComponents';\n\n// Re-export for consumer convenience\nexport { createTreeCollection } from '@chakra-ui/react/collection';\n\n// Re-export useful types\nexport type {\n TreeViewExpandedChangeDetails as BitkitTreeViewExpandedChangeDetails,\n TreeViewNodeRenderProps as BitkitTreeViewNodeRenderProps,\n TreeViewSelectionChangeDetails as BitkitTreeViewSelectionChangeDetails,\n} from '@chakra-ui/react/tree-view';\n\n// --- Variant context ---\n\nexport type BitkitTreeViewVariant = 'files' | 'navigation';\n\nconst [VariantProvider, useVariant] = createContext<{ variant: BitkitTreeViewVariant }>({\n name: 'BitkitTreeViewVariantContext',\n defaultValue: { variant: 'files' },\n});\n\nconst useCustomSlotStyles = (variant: BitkitTreeViewVariant) => {\n const recipe = useSlotRecipe({ key: 'treeView' });\n return recipe({ variant });\n};\n\n// --- Root ---\n\nexport interface BitkitTreeViewRootProps extends Omit<TreeViewRootProps, 'children'> {\n children?: ReactNode;\n render: (props: TreeViewNodeRenderProps) => ReactNode;\n variant?: BitkitTreeViewVariant;\n}\n\nconst Root = forwardRef<HTMLDivElement, BitkitTreeViewRootProps>(\n ({ children, render, variant = 'files', ...props }, ref) => {\n const indentGuide = variant === 'files' ? <TreeView.BranchIndentGuide /> : undefined;\n\n return (\n <VariantProvider value={{ variant }}>\n <TreeView.Root ref={ref} variant={variant} {...props}>\n <TreeView.Tree>\n <TreeView.Node indentGuide={indentGuide} render={render as never} />\n {children}\n </TreeView.Tree>\n </TreeView.Root>\n </VariantProvider>\n );\n },\n);\nRoot.displayName = 'BitkitTreeView';\n\n// --- Branch ---\n\nexport interface BitkitTreeViewBranchProps extends Omit<TreeViewBranchControlProps, 'children'> {\n actions?: ReactElement[];\n hasWarning?: boolean;\n label: string;\n subtext?: ReactNode;\n suffixIcon?: BitkitIconComponent;\n suffixText?: string;\n}\n\nconst Branch = forwardRef<HTMLDivElement, BitkitTreeViewBranchProps>((props, ref) => {\n const { actions, hasWarning, label, subtext, suffixIcon: SuffixIcon, suffixText, ...rest } = props;\n const { variant } = useVariant();\n const styles = useCustomSlotStyles(variant);\n const hasSuffix = hasWarning || SuffixIcon || suffixText;\n const hasActions = actions && actions.length > 0;\n\n const BranchIcon = variant === 'navigation' ? IconChevronRight : IconFolder;\n\n return (\n <TreeView.BranchControl ref={ref} className={hasActions ? 'group' : undefined} {...rest}>\n <TreeView.BranchIndicator>\n <BranchIcon size=\"16\" />\n </TreeView.BranchIndicator>\n <TreeView.BranchText>\n {label}\n {subtext && <Text css={styles.secondaryText}>{subtext}</Text>}\n </TreeView.BranchText>\n {hasSuffix && (\n <Box css={styles.suffixGroup}>\n {hasWarning && <IconWarningYellow size=\"16\" />}\n {SuffixIcon && <SuffixIcon size=\"16\" />}\n {suffixText && <span>{suffixText}</span>}\n </Box>\n )}\n {hasActions && (\n <Box css={styles.actionGroup}>{actions.map((action) => cloneElement(action, { size: 'xs' }))}</Box>\n )}\n </TreeView.BranchControl>\n );\n});\nBranch.displayName = 'BitkitTreeView.Branch';\n\n// --- Leaf ---\n\nexport interface BitkitTreeViewLeafProps extends Omit<TreeViewItemProps, 'children'> {\n actions?: ReactElement[];\n badge?: ReactElement;\n hasWarning?: boolean;\n icon?: BitkitIconComponent;\n label: string;\n subtext?: ReactNode;\n suffixIcon?: BitkitIconComponent;\n suffixText?: string;\n}\n\nconst Leaf = forwardRef<HTMLDivElement, BitkitTreeViewLeafProps>((props, ref) => {\n const { actions, badge, hasWarning, icon: Icon, label, subtext, suffixIcon: SuffixIcon, suffixText, ...rest } = props;\n const { variant } = useVariant();\n const styles = useCustomSlotStyles(variant);\n const hasSuffix = hasWarning || SuffixIcon || suffixText;\n const hasActions = actions && actions.length > 0;\n\n return (\n <TreeView.Item ref={ref} className={hasActions ? 'group' : undefined} {...rest}>\n {Icon && <Icon size=\"16\" />}\n {badge && cloneElement(badge, { size: '
|
|
1
|
+
{"version":3,"file":"BitkitTreeView.js","names":[],"sources":["../../../lib/components/BitkitTreeView/BitkitTreeView.tsx"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { createContext } from '@chakra-ui/react';\nimport { Box } from '@chakra-ui/react/box';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport {\n TreeView,\n type TreeViewBranchControlProps,\n type TreeViewItemProps,\n type TreeViewNodeRenderProps,\n type TreeViewRootProps,\n} from '@chakra-ui/react/tree-view';\nimport { cloneElement, forwardRef, type ReactElement, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent, IconChevronRight, IconFolder, IconWarningYellow } from '../../icons';\nimport { withSubComponents } from '../../utilities/withSubComponents';\n\n// Re-export for consumer convenience\nexport { createTreeCollection } from '@chakra-ui/react/collection';\n\n// Re-export useful types\nexport type {\n TreeViewExpandedChangeDetails as BitkitTreeViewExpandedChangeDetails,\n TreeViewNodeRenderProps as BitkitTreeViewNodeRenderProps,\n TreeViewSelectionChangeDetails as BitkitTreeViewSelectionChangeDetails,\n} from '@chakra-ui/react/tree-view';\n\n// --- Variant context ---\n\nexport type BitkitTreeViewVariant = 'files' | 'navigation';\n\nconst [VariantProvider, useVariant] = createContext<{ variant: BitkitTreeViewVariant }>({\n name: 'BitkitTreeViewVariantContext',\n defaultValue: { variant: 'files' },\n});\n\nconst useCustomSlotStyles = (variant: BitkitTreeViewVariant) => {\n const recipe = useSlotRecipe({ key: 'treeView' });\n return recipe({ variant });\n};\n\n// --- Root ---\n\nexport interface BitkitTreeViewRootProps extends Omit<TreeViewRootProps, 'children'> {\n children?: ReactNode;\n render: (props: TreeViewNodeRenderProps) => ReactNode;\n variant?: BitkitTreeViewVariant;\n}\n\nconst Root = forwardRef<HTMLDivElement, BitkitTreeViewRootProps>(\n ({ children, render, variant = 'files', ...props }, ref) => {\n const indentGuide = variant === 'files' ? <TreeView.BranchIndentGuide /> : undefined;\n\n return (\n <VariantProvider value={{ variant }}>\n <TreeView.Root ref={ref} variant={variant} {...props}>\n <TreeView.Tree>\n <TreeView.Node indentGuide={indentGuide} render={render as never} />\n {children}\n </TreeView.Tree>\n </TreeView.Root>\n </VariantProvider>\n );\n },\n);\nRoot.displayName = 'BitkitTreeView';\n\n// --- Branch ---\n\nexport interface BitkitTreeViewBranchProps extends Omit<TreeViewBranchControlProps, 'children'> {\n actions?: ReactElement[];\n hasWarning?: boolean;\n label: string;\n subtext?: ReactNode;\n suffixIcon?: BitkitIconComponent;\n suffixText?: string;\n}\n\nconst Branch = forwardRef<HTMLDivElement, BitkitTreeViewBranchProps>((props, ref) => {\n const { actions, hasWarning, label, subtext, suffixIcon: SuffixIcon, suffixText, ...rest } = props;\n const { variant } = useVariant();\n const styles = useCustomSlotStyles(variant);\n const hasSuffix = hasWarning || SuffixIcon || suffixText;\n const hasActions = actions && actions.length > 0;\n\n const BranchIcon = variant === 'navigation' ? IconChevronRight : IconFolder;\n\n return (\n <TreeView.BranchControl ref={ref} className={hasActions ? 'group' : undefined} {...rest}>\n <TreeView.BranchIndicator>\n <BranchIcon size=\"16\" />\n </TreeView.BranchIndicator>\n <TreeView.BranchText>\n {label}\n {subtext && <Text css={styles.secondaryText}>{subtext}</Text>}\n </TreeView.BranchText>\n {hasSuffix && (\n <Box css={styles.suffixGroup}>\n {hasWarning && <IconWarningYellow size=\"16\" />}\n {SuffixIcon && <SuffixIcon size=\"16\" />}\n {suffixText && <span>{suffixText}</span>}\n </Box>\n )}\n {hasActions && (\n <Box css={styles.actionGroup}>{actions.map((action) => cloneElement(action, { size: 'xs' }))}</Box>\n )}\n </TreeView.BranchControl>\n );\n});\nBranch.displayName = 'BitkitTreeView.Branch';\n\n// --- Leaf ---\n\nexport interface BitkitTreeViewLeafProps extends Omit<TreeViewItemProps, 'children'> {\n actions?: ReactElement[];\n badge?: ReactElement;\n hasWarning?: boolean;\n icon?: BitkitIconComponent;\n label: string;\n subtext?: ReactNode;\n suffixIcon?: BitkitIconComponent;\n suffixText?: string;\n}\n\nconst Leaf = forwardRef<HTMLDivElement, BitkitTreeViewLeafProps>((props, ref) => {\n const { actions, badge, hasWarning, icon: Icon, label, subtext, suffixIcon: SuffixIcon, suffixText, ...rest } = props;\n const { variant } = useVariant();\n const styles = useCustomSlotStyles(variant);\n const hasSuffix = hasWarning || SuffixIcon || suffixText;\n const hasActions = actions && actions.length > 0;\n\n return (\n <TreeView.Item ref={ref} className={hasActions ? 'group' : undefined} {...rest}>\n {Icon && <Icon size=\"16\" />}\n {badge && cloneElement(badge, { size: 'xs' })}\n <TreeView.ItemText>\n {label}\n {subtext && <Text css={styles.secondaryText}>{subtext}</Text>}\n </TreeView.ItemText>\n {hasSuffix && (\n <Box css={styles.suffixGroup}>\n {hasWarning && <IconWarningYellow size=\"16\" />}\n {SuffixIcon && <SuffixIcon size=\"16\" />}\n {suffixText && <span>{suffixText}</span>}\n </Box>\n )}\n {hasActions && (\n <Box css={styles.actionGroup}>{actions.map((action) => cloneElement(action, { size: 'xs' }))}</Box>\n )}\n </TreeView.Item>\n );\n});\nLeaf.displayName = 'BitkitTreeView.Leaf';\n\n// --- Main export ---\n\nconst BitkitTreeView = withSubComponents(Root, {\n Branch,\n Leaf,\n});\n\nexport default BitkitTreeView;\n"],"mappings":";;;;;;;;;;;;;AA+BA,IAAM,CAAC,iBAAiB,cAAc,gBAAkD;C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,CAAC,CAAC;GAAO,CAAA;EAEvF;;AAEnB,CAAC;AACD,KAAK,cAAc;AAInB,IAAM,iBAAiB,kBAAkB,MAAM;CAC7C;CACA;AACF,CAAC"}
|
|
@@ -16,11 +16,11 @@ var badgeRecipe = defineRecipe({
|
|
|
16
16
|
},
|
|
17
17
|
variants: {
|
|
18
18
|
size: {
|
|
19
|
-
|
|
19
|
+
xs: {
|
|
20
20
|
minWidth: "20",
|
|
21
21
|
paddingBlock: "2"
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
sm: {
|
|
24
24
|
minWidth: "24",
|
|
25
25
|
paddingBlock: "4"
|
|
26
26
|
}
|
|
@@ -124,7 +124,7 @@ var badgeRecipe = defineRecipe({
|
|
|
124
124
|
defaultVariants: {
|
|
125
125
|
colorVariant: "neutral",
|
|
126
126
|
variant: "subtle",
|
|
127
|
-
size: "
|
|
127
|
+
size: "sm"
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.recipe.js","names":[],"sources":["../../../lib/theme/recipes/Badge.recipe.ts"],"sourcesContent":["import { defineRecipe } from '@chakra-ui/react/styled-system';\n\nconst badgeRecipe = defineRecipe({\n className: 'badge',\n base: {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: '4',\n borderRadius: '4',\n textStyle: 'comp/badge/sm',\n width: 'fit-content',\n height: 'fit-content',\n verticalAlign: 'bottom',\n flexShrink: 0,\n },\n variants: {\n size: {\n
|
|
1
|
+
{"version":3,"file":"Badge.recipe.js","names":[],"sources":["../../../lib/theme/recipes/Badge.recipe.ts"],"sourcesContent":["import { defineRecipe } from '@chakra-ui/react/styled-system';\n\nconst badgeRecipe = defineRecipe({\n className: 'badge',\n base: {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: '4',\n borderRadius: '4',\n textStyle: 'comp/badge/sm',\n width: 'fit-content',\n height: 'fit-content',\n verticalAlign: 'bottom',\n flexShrink: 0,\n },\n variants: {\n size: {\n xs: {\n minWidth: '20',\n paddingBlock: '2',\n },\n sm: {\n minWidth: '24',\n paddingBlock: '4',\n },\n },\n colorVariant: {\n neutral: { color: 'color/neutral/strong', background: 'color/neutral/subtle' },\n purple: { color: 'color/purple/strong', background: 'color/purple/subtle' },\n blue: { color: 'color/blue/strong', background: 'color/blue/subtle' },\n green: { color: 'color/green/strong', background: 'color/green/subtle' },\n yellow: { color: 'color/yellow/strong', background: 'color/yellow/subtle' },\n red: { color: 'color/red/strong', background: 'color/red/subtle' },\n orange: { color: 'color/orange/strong', background: 'color/orange/subtle' },\n turquoise: { color: 'color/turquoise/strong', background: 'color/turquoise/subtle' },\n 'ai-gradient': { color: 'status/ai/text', background: 'gradient/ai/background/subtle' },\n },\n variant: {\n subtle: {},\n bold: {\n color: 'text/on-color',\n },\n },\n },\n compoundVariants: [\n { colorVariant: 'neutral', variant: 'bold', css: { background: 'color/neutral/bold' } },\n { colorVariant: 'purple', variant: 'bold', css: { background: 'color/purple/bold' } },\n { colorVariant: 'blue', variant: 'bold', css: { background: 'color/blue/bold' } },\n { colorVariant: 'green', variant: 'bold', css: { background: 'color/green/bold' } },\n { colorVariant: 'red', variant: 'bold', css: { background: 'color/red/bold' } },\n { colorVariant: 'orange', variant: 'bold', css: { background: 'color/orange/bold' } },\n { colorVariant: 'turquoise', variant: 'bold', css: { background: 'color/turquoise/bold' } },\n {\n colorVariant: 'ai-gradient',\n variant: 'bold',\n css: { background: 'gradient/ai/background/bold', color: 'text/on-color' },\n },\n { colorVariant: 'yellow', variant: 'bold', css: { background: 'color/yellow/muted', color: 'text/primary' } },\n ],\n defaultVariants: {\n colorVariant: 'neutral',\n variant: 'subtle',\n size: 'sm',\n },\n});\n\nexport default badgeRecipe;\n"],"mappings":";;AAEA,IAAM,cAAc,aAAa;CAC/B,WAAW;CACX,MAAM;EACJ,SAAS;EACT,YAAY;EACZ,gBAAgB;EAChB,KAAK;EAC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