@bitrise/bitkit-v2 0.3.343 → 0.3.345-beta.2197

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,18 +3,18 @@ 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 = "xs", ...rest } = props;
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
10
  if (childrenLength > 1) {
11
- paddingInlineStart = size === "xs" ? "8" : "6";
12
- paddingInlineEnd = size === "xs" ? "8" : "6";
13
- if (Icon) paddingInlineStart = size === "xs" ? "4" : "2";
11
+ paddingInlineStart = size === "sm" ? "8" : "6";
12
+ paddingInlineEnd = size === "sm" ? "8" : "6";
13
+ if (Icon) paddingInlineStart = "4";
14
14
  }
15
15
  if (childrenLength === 1) {
16
- paddingInlineStart = size === "xs" ? "4" : "2";
17
- paddingInlineEnd = size === "xs" ? "4" : "2";
16
+ paddingInlineStart = size === "sm" ? "4" : "2";
17
+ paddingInlineEnd = size === "sm" ? "4" : "2";
18
18
  }
19
19
  return /* @__PURE__ */ jsxs(Badge, {
20
20
  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 = 'xs', ...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) {\n paddingInlineStart = size === 'xs' ? '8' : '6';\n paddingInlineEnd = size === 'xs' ? '8' : '6';\n if (Icon) {\n paddingInlineStart = size === 'xs' ? '4' : '2';\n }\n }\n if (childrenLength === 1) {\n paddingInlineStart = size === 'xs' ? '4' : '2';\n paddingInlineEnd = size === 'xs' ? '4' : '2';\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,iBAAiB,GAAG;EACtB,qBAAqB,SAAS,OAAO,MAAM;EAC3C,mBAAmB,SAAS,OAAO,MAAM;EACzC,IAAI,MACF,qBAAqB,SAAS,OAAO,MAAM;CAE/C;CACA,IAAI,mBAAmB,GAAG;EACxB,qBAAqB,SAAS,OAAO,MAAM;EAC3C,mBAAmB,SAAS,OAAO,MAAM;CAC3C;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"}
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) {\n paddingInlineStart = size === 'sm' ? '8' : '6';\n paddingInlineEnd = size === 'sm' ? '8' : '6';\n if (Icon) {\n paddingInlineStart = '4';\n }\n }\n if (childrenLength === 1) {\n paddingInlineStart = size === 'sm' ? '4' : '2';\n paddingInlineEnd = size === 'sm' ? '4' : '2';\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,iBAAiB,GAAG;EACtB,qBAAqB,SAAS,OAAO,MAAM;EAC3C,mBAAmB,SAAS,OAAO,MAAM;EACzC,IAAI,MACF,qBAAqB;CAEzB;CACA,IAAI,mBAAmB,GAAG;EACxB,qBAAqB,SAAS,OAAO,MAAM;EAC3C,mBAAmB,SAAS,OAAO,MAAM;CAC3C;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"}
@@ -1,14 +1,41 @@
1
1
  import IconChevronDown from "../../icons/IconChevronDown.js";
2
2
  import IconChevronUp from "../../icons/IconChevronUp.js";
3
3
  import BitkitLabel from "../BitkitLabel/BitkitLabel.js";
4
+ import { Box } from "@chakra-ui/react/box";
4
5
  import { useSlotRecipe } from "@chakra-ui/react/styled-system";
5
- import { forwardRef } from "react";
6
+ import { forwardRef, useRef, useState } from "react";
6
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ import { useSafeLayoutEffect } from "@chakra-ui/react/hooks";
7
9
  import { Collapsible } from "@chakra-ui/react/collapsible";
8
10
  //#region lib/components/BitkitCollapsible/BitkitCollapsible.tsx
11
+ var useIsContentOverflowing = (collapsedHeight) => {
12
+ const contentRef = useRef(null);
13
+ const [isOverflowing, setIsOverflowing] = useState(true);
14
+ useSafeLayoutEffect(() => {
15
+ const contentEl = contentRef.current;
16
+ const measureScope = contentEl?.parentElement;
17
+ if (!contentEl || !measureScope) return;
18
+ const probe = document.createElement("div");
19
+ probe.style.cssText = `position: absolute; visibility: hidden; pointer-events: none; height: ${collapsedHeight};`;
20
+ measureScope.appendChild(probe);
21
+ const collapsedHeightPx = probe.getBoundingClientRect().height;
22
+ measureScope.removeChild(probe);
23
+ const checkOverflow = () => setIsOverflowing(contentEl.scrollHeight > collapsedHeightPx);
24
+ checkOverflow();
25
+ if (typeof ResizeObserver === "undefined") return;
26
+ const resizeObserver = new ResizeObserver(checkOverflow);
27
+ resizeObserver.observe(contentEl);
28
+ return () => resizeObserver.disconnect();
29
+ }, [collapsedHeight]);
30
+ return {
31
+ contentRef,
32
+ isOverflowing
33
+ };
34
+ };
9
35
  var BitkitCollapsible = forwardRef((props, ref) => {
10
36
  const { children, closedLabel = "Show less", collapsedHeight = "48px", defaultOpen, label, labelProps, onOpenChange, open, openLabel = "Show more", ...rest } = props;
11
37
  const styles = useSlotRecipe({ key: "collapsible" })();
38
+ const { contentRef, isOverflowing } = useIsContentOverflowing(collapsedHeight);
12
39
  const handleOpenChange = onOpenChange ? (details) => onOpenChange(details.open) : void 0;
13
40
  return /* @__PURE__ */ jsxs(Collapsible.Root, {
14
41
  ref,
@@ -25,9 +52,12 @@ var BitkitCollapsible = forwardRef((props, ref) => {
25
52
  }),
26
53
  /* @__PURE__ */ jsx(Collapsible.Content, {
27
54
  css: styles.content,
28
- children
55
+ children: /* @__PURE__ */ jsx(Box, {
56
+ ref: contentRef,
57
+ children
58
+ })
29
59
  }),
30
- /* @__PURE__ */ jsx(Collapsible.Trigger, {
60
+ isOverflowing && /* @__PURE__ */ jsx(Collapsible.Trigger, {
31
61
  css: styles.trigger,
32
62
  children: /* @__PURE__ */ jsx(Collapsible.Context, { children: (api) => /* @__PURE__ */ jsxs(Fragment$1, { children: [api.open ? closedLabel : openLabel, api.open ? /* @__PURE__ */ jsx(IconChevronUp, { size: "16" }) : /* @__PURE__ */ jsx(IconChevronDown, { size: "16" })] }) })
33
63
  })
@@ -1 +1 @@
1
- {"version":3,"file":"BitkitCollapsible.js","names":[],"sources":["../../../lib/components/BitkitCollapsible/BitkitCollapsible.tsx"],"sourcesContent":["import { Collapsible, type CollapsibleRootProps } from '@chakra-ui/react/collapsible';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef, type ReactNode } from 'react';\n\n// TODO: Investigate using AssetSelectChevron instead of IconChevronDown/IconChevronUp\nimport { IconChevronDown, IconChevronUp } from '../../icons';\nimport BitkitLabel, { type BitkitLabelProps } from '../BitkitLabel/BitkitLabel';\n\ntype UncontrolledProps = {\n defaultOpen?: boolean;\n open?: never;\n onOpenChange?: never;\n};\n\ntype ControlledProps = {\n defaultOpen?: never;\n onOpenChange: (open: boolean) => void;\n open: boolean;\n};\n\nexport type BitkitCollapsibleProps = Omit<\n CollapsibleRootProps,\n 'collapsedHeight' | 'defaultOpen' | 'onOpenChange' | 'open'\n> & {\n children: ReactNode;\n closedLabel?: string;\n collapsedHeight?: string;\n label?: string;\n labelProps?: Omit<BitkitLabelProps, 'children'>;\n openLabel?: string;\n} & (UncontrolledProps | ControlledProps);\n\nconst BitkitCollapsible = forwardRef<HTMLDivElement, BitkitCollapsibleProps>((props, ref) => {\n const {\n children,\n closedLabel = 'Show less',\n collapsedHeight = '48px',\n defaultOpen,\n label,\n labelProps,\n onOpenChange,\n open,\n openLabel = 'Show more',\n ...rest\n } = props;\n\n const recipe = useSlotRecipe({ key: 'collapsible' });\n const styles = recipe();\n\n const handleOpenChange = onOpenChange ? (details: { open: boolean }) => onOpenChange(details.open) : undefined;\n\n return (\n <Collapsible.Root\n ref={ref}\n collapsedHeight={collapsedHeight}\n css={styles.root}\n defaultOpen={defaultOpen}\n onOpenChange={handleOpenChange}\n open={open}\n {...rest}\n >\n {label && <BitkitLabel {...labelProps}>{label}</BitkitLabel>}\n <Collapsible.Content css={styles.content}>{children}</Collapsible.Content>\n <Collapsible.Trigger css={styles.trigger}>\n <Collapsible.Context>\n {(api) => (\n <>\n {api.open ? closedLabel : openLabel}\n {api.open ? <IconChevronUp size=\"16\" /> : <IconChevronDown size=\"16\" />}\n </>\n )}\n </Collapsible.Context>\n </Collapsible.Trigger>\n </Collapsible.Root>\n );\n});\n\nBitkitCollapsible.displayName = 'BitkitCollapsible';\n\nexport default BitkitCollapsible;\n"],"mappings":";;;;;;;;AAgCA,IAAM,oBAAoB,YAAoD,OAAO,QAAQ;CAC3F,MAAM,EACJ,UACA,cAAc,aACd,kBAAkB,QAClB,aACA,OACA,YACA,cACA,MACA,YAAY,aACZ,GAAG,SACD;CAGJ,MAAM,SADS,cAAc,EAAE,KAAK,cAAc,CACnC,CAAA,CAAO;CAEtB,MAAM,mBAAmB,gBAAgB,YAA+B,aAAa,QAAQ,IAAI,IAAI,KAAA;CAErG,OACE,qBAAC,YAAY,MAAb;EACO;EACY;EACjB,KAAK,OAAO;EACC;EACb,cAAc;EACR;EACN,GAAI;EAPN,UAAA;GASG,SAAS,oBAAC,aAAD;IAAa,GAAI;IAAa,UAAA;GAAmB,CAAA;GAC3D,oBAAC,YAAY,SAAb;IAAqB,KAAK,OAAO;IAAU;GAA8B,CAAA;GACzE,oBAAC,YAAY,SAAb;IAAqB,KAAK,OAAO;IAC/B,UAAA,oBAAC,YAAY,SAAb,EAAA,WACI,QACA,qBAAA,YAAA,EAAA,UAAA,CACG,IAAI,OAAO,cAAc,WACzB,IAAI,OAAO,oBAAC,eAAD,EAAe,MAAK,KAAM,CAAA,IAAI,oBAAC,iBAAD,EAAiB,MAAK,KAAM,CAAA,CACtE,EAAA,CAAA,EAEe,CAAA;GACF,CAAA;EACL;;AAEtB,CAAC;AAED,kBAAkB,cAAc"}
1
+ {"version":3,"file":"BitkitCollapsible.js","names":[],"sources":["../../../lib/components/BitkitCollapsible/BitkitCollapsible.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Collapsible, type CollapsibleRootProps } from '@chakra-ui/react/collapsible';\nimport { useSafeLayoutEffect } from '@chakra-ui/react/hooks';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef, type ReactNode, useRef, useState } from 'react';\n\n// TODO: Investigate using AssetSelectChevron instead of IconChevronDown/IconChevronUp\nimport { IconChevronDown, IconChevronUp } from '../../icons';\nimport BitkitLabel, { type BitkitLabelProps } from '../BitkitLabel/BitkitLabel';\n\ntype UncontrolledProps = {\n defaultOpen?: boolean;\n open?: never;\n onOpenChange?: never;\n};\n\ntype ControlledProps = {\n defaultOpen?: never;\n onOpenChange: (open: boolean) => void;\n open: boolean;\n};\n\nexport type BitkitCollapsibleProps = Omit<\n CollapsibleRootProps,\n 'collapsedHeight' | 'defaultOpen' | 'onOpenChange' | 'open'\n> & {\n children: ReactNode;\n closedLabel?: string;\n collapsedHeight?: string;\n label?: string;\n labelProps?: Omit<BitkitLabelProps, 'children'>;\n openLabel?: string;\n} & (UncontrolledProps | ControlledProps);\n\n// contentRef sits on an unclamped wrapper *inside* Collapsible.Content, not on Content itself: when\n// closed, Content's own box is pinned to collapsedHeight (max-height + overflow), so a ResizeObserver\n// on Content can't see content that grows without changing Content's own (clamped) box - e.g. an image\n// or async child rendering more after mount. scrollHeight still reports the wrapper's true height\n// either way, clamped or not, so the read doesn't change - only where we watch for changes does.\n// collapsedHeight is the only effect dependency: the wrapper being unclamped means the observer itself\n// sees every content-driven size change, so re-running the whole effect just because `children`'s\n// identity changed (which it does on every parent render, once children stop being a plain string)\n// would only add a redundant probe/layout/observer teardown-and-rebuild on top of what the observer\n// already covers.\nconst useIsContentOverflowing = (collapsedHeight: string) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const [isOverflowing, setIsOverflowing] = useState(true);\n\n useSafeLayoutEffect(() => {\n const contentEl = contentRef.current;\n const measureScope = contentEl?.parentElement;\n if (!contentEl || !measureScope) {\n return undefined;\n }\n\n // Appended as a sibling of contentEl (not document.body) so it inherits the same font-size and\n // CSS custom properties contentEl actually sees, resolving em/var(...) heights correctly - not\n // just px/rem, which don't depend on where in the tree they're resolved.\n const probe = document.createElement('div');\n probe.style.cssText = `position: absolute; visibility: hidden; pointer-events: none; height: ${collapsedHeight};`;\n measureScope.appendChild(probe);\n const collapsedHeightPx = probe.getBoundingClientRect().height;\n measureScope.removeChild(probe);\n\n const checkOverflow = () => setIsOverflowing(contentEl.scrollHeight > collapsedHeightPx);\n checkOverflow();\n\n if (typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n\n const resizeObserver = new ResizeObserver(checkOverflow);\n resizeObserver.observe(contentEl);\n return () => resizeObserver.disconnect();\n }, [collapsedHeight]);\n\n return { contentRef, isOverflowing };\n};\n\nconst BitkitCollapsible = forwardRef<HTMLDivElement, BitkitCollapsibleProps>((props, ref) => {\n const {\n children,\n closedLabel = 'Show less',\n collapsedHeight = '48px',\n defaultOpen,\n label,\n labelProps,\n onOpenChange,\n open,\n openLabel = 'Show more',\n ...rest\n } = props;\n\n const recipe = useSlotRecipe({ key: 'collapsible' });\n const styles = recipe();\n\n const { contentRef, isOverflowing } = useIsContentOverflowing(collapsedHeight);\n\n const handleOpenChange = onOpenChange ? (details: { open: boolean }) => onOpenChange(details.open) : undefined;\n\n return (\n <Collapsible.Root\n ref={ref}\n collapsedHeight={collapsedHeight}\n css={styles.root}\n defaultOpen={defaultOpen}\n onOpenChange={handleOpenChange}\n open={open}\n {...rest}\n >\n {label && <BitkitLabel {...labelProps}>{label}</BitkitLabel>}\n <Collapsible.Content css={styles.content}>\n <Box ref={contentRef}>{children}</Box>\n </Collapsible.Content>\n {isOverflowing && (\n <Collapsible.Trigger css={styles.trigger}>\n <Collapsible.Context>\n {(api) => (\n <>\n {api.open ? closedLabel : openLabel}\n {api.open ? <IconChevronUp size=\"16\" /> : <IconChevronDown size=\"16\" />}\n </>\n )}\n </Collapsible.Context>\n </Collapsible.Trigger>\n )}\n </Collapsible.Root>\n );\n});\n\nBitkitCollapsible.displayName = 'BitkitCollapsible';\n\nexport default BitkitCollapsible;\n"],"mappings":";;;;;;;;;;AA4CA,IAAM,2BAA2B,oBAA4B;CAC3D,MAAM,aAAa,OAAuB,IAAI;CAC9C,MAAM,CAAC,eAAe,oBAAoB,SAAS,IAAI;CAEvD,0BAA0B;EACxB,MAAM,YAAY,WAAW;EAC7B,MAAM,eAAe,WAAW;EAChC,IAAI,CAAC,aAAa,CAAC,cACjB;EAMF,MAAM,QAAQ,SAAS,cAAc,KAAK;EAC1C,MAAM,MAAM,UAAU,yEAAyE,gBAAgB;EAC/G,aAAa,YAAY,KAAK;EAC9B,MAAM,oBAAoB,MAAM,sBAAsB,CAAC,CAAC;EACxD,aAAa,YAAY,KAAK;EAE9B,MAAM,sBAAsB,iBAAiB,UAAU,eAAe,iBAAiB;EACvF,cAAc;EAEd,IAAI,OAAO,mBAAmB,aAC5B;EAGF,MAAM,iBAAiB,IAAI,eAAe,aAAa;EACvD,eAAe,QAAQ,SAAS;EAChC,aAAa,eAAe,WAAW;CACzC,GAAG,CAAC,eAAe,CAAC;CAEpB,OAAO;EAAE;EAAY;CAAc;AACrC;AAEA,IAAM,oBAAoB,YAAoD,OAAO,QAAQ;CAC3F,MAAM,EACJ,UACA,cAAc,aACd,kBAAkB,QAClB,aACA,OACA,YACA,cACA,MACA,YAAY,aACZ,GAAG,SACD;CAGJ,MAAM,SADS,cAAc,EAAE,KAAK,cAAc,CACnC,CAAA,CAAO;CAEtB,MAAM,EAAE,YAAY,kBAAkB,wBAAwB,eAAe;CAE7E,MAAM,mBAAmB,gBAAgB,YAA+B,aAAa,QAAQ,IAAI,IAAI,KAAA;CAErG,OACE,qBAAC,YAAY,MAAb;EACO;EACY;EACjB,KAAK,OAAO;EACC;EACb,cAAc;EACR;EACN,GAAI;EAPN,UAAA;GASG,SAAS,oBAAC,aAAD;IAAa,GAAI;IAAa,UAAA;GAAmB,CAAA;GAC3D,oBAAC,YAAY,SAAb;IAAqB,KAAK,OAAO;IAC/B,UAAA,oBAAC,KAAD;KAAK,KAAK;KAAa;IAAc,CAAA;GAClB,CAAA;GACpB,iBACC,oBAAC,YAAY,SAAb;IAAqB,KAAK,OAAO;IAC/B,UAAA,oBAAC,YAAY,SAAb,EAAA,WACI,QACA,qBAAA,YAAA,EAAA,UAAA,CACG,IAAI,OAAO,cAAc,WACzB,IAAI,OAAO,oBAAC,eAAD,EAAe,MAAK,KAAM,CAAA,IAAI,oBAAC,iBAAD,EAAiB,MAAK,KAAM,CAAA,CACtE,EAAA,CAAA,EAEe,CAAA;GACF,CAAA;EAEP;;AAEtB,CAAC;AAED,kBAAkB,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: "xxs"
23
- } : { size: "xxs" };
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: 'xxs' } as const) : ({ size: 'xxs' } 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;CAAM,IAAe,EAAE,MAAM,MAAM;CACnG,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"}
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: "xxs" }),
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: 'xxs' })}\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;CACtF,MAAM;CACN,cAAc,EAAE,SAAS,QAAQ;AACnC,CAAC;AAED,IAAM,uBAAuB,YAAmC;CAE9D,OADe,cAAc,EAAE,KAAK,WAAW,CACxC,CAAA,CAAO,EAAE,QAAQ,CAAC;AAC3B;AAUA,IAAM,OAAO,YACV,EAAE,UAAU,QAAQ,UAAU,SAAS,GAAG,SAAS,QAAQ;CAC1D,MAAM,cAAc,YAAY,UAAU,oBAAC,SAAS,mBAAV,CAA6B,CAAA,IAAI,KAAA;CAE3E,OACE,oBAAC,iBAAD;EAAiB,OAAO,EAAE,QAAQ;EAChC,UAAA,oBAAC,SAAS,MAAV;GAAoB;GAAc;GAAS,GAAI;GAC7C,UAAA,qBAAC,SAAS,MAAV,EAAA,UAAA,CACE,oBAAC,SAAS,MAAV;IAA4B;IAAqB;GAAkB,CAAA,GAClE,QACY,EAAA,CAAA;EACF,CAAA;CACA,CAAA;AAErB,CACF;AACA,KAAK,cAAc;AAanB,IAAM,SAAS,YAAuD,OAAO,QAAQ;CACnF,MAAM,EAAE,SAAS,YAAY,OAAO,SAAS,YAAY,YAAY,YAAY,GAAG,SAAS;CAC7F,MAAM,EAAE,YAAY,WAAW;CAC/B,MAAM,SAAS,oBAAoB,OAAO;CAC1C,MAAM,YAAY,cAAc,cAAc;CAC9C,MAAM,aAAa,WAAW,QAAQ,SAAS;CAE/C,MAAM,aAAa,YAAY,eAAe,mBAAmB;CAEjE,OACE,qBAAC,SAAS,eAAV;EAA6B;EAAK,WAAW,aAAa,UAAU,KAA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AAK,KAAK,OAAO;IAAjB,UAAA;KACG,cAAc,oBAAC,mBAAD,EAAmB,MAAK,KAAM,CAAA;KAC5C,cAAc,oBAAC,YAAD,EAAY,MAAK,KAAM,CAAA;KACrC,cAAc,oBAAC,QAAD,EAAA,UAAO,WAAiB,CAAA;IACpC;;GAEN,cACC,oBAAC,KAAD;IAAK,KAAK,OAAO;IAAc,UAAA,QAAQ,KAAK,WAAW,aAAa,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC;GAAO,CAAA;EAEvF;;AAEnB,CAAC;AACD,KAAK,cAAc;AAInB,IAAM,iBAAiB,kBAAkB,MAAM;CAC7C;CACA;AACF,CAAC"}
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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,aAAa,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC;GAAO,CAAA;EAEvF;;AAEnB,CAAC;AACD,KAAK,cAAc;AAInB,IAAM,iBAAiB,kBAAkB,MAAM;CAC7C;CACA;AACF,CAAC"}
@@ -1,10 +1,10 @@
1
1
  declare const badgeRecipe: import('@chakra-ui/react').RecipeDefinition<{
2
2
  size: {
3
- xxs: {
3
+ xs: {
4
4
  minWidth: "20";
5
5
  paddingBlock: "2";
6
6
  };
7
- xs: {
7
+ sm: {
8
8
  minWidth: "24";
9
9
  paddingBlock: "4";
10
10
  };
@@ -16,11 +16,11 @@ var badgeRecipe = defineRecipe({
16
16
  },
17
17
  variants: {
18
18
  size: {
19
- xxs: {
19
+ xs: {
20
20
  minWidth: "20",
21
21
  paddingBlock: "2"
22
22
  },
23
- xs: {
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: "xs"
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 xxs: {\n minWidth: '20',\n paddingBlock: '2',\n },\n xs: {\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: 'xs',\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;EACL,cAAc;EACd,WAAW;EACX,OAAO;EACP,QAAQ;EACR,eAAe;EACf,YAAY;CACd;CACA,UAAU;EACR,MAAM;GACJ,KAAK;IACH,UAAU;IACV,cAAc;GAChB;GACA,IAAI;IACF,UAAU;IACV,cAAc;GAChB;EACF;EACA,cAAc;GACZ,SAAS;IAAE,OAAO;IAAwB,YAAY;GAAuB;GAC7E,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"],"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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C9E;GAAE,cAAc;GAAU,SAAS;GAAQ,KAAK,EAAE,YAAY,oBAAoB;EAAE;EACpF;GAAE,cAAc;GAAa,SAAS;GAAQ,KAAK,EAAE,YAAY,uBAAuB;EAAE;EAC1F;GACE,cAAc;GACd,SAAS;GACT,KAAK;IAAE,YAAY;IAA+B,OAAO;GAAgB;EAC3E;EACA;GAAE,cAAc;GAAU,SAAS;GAAQ,KAAK;IAAE,YAAY;IAAsB,OAAO;GAAe;EAAE;CAC9G;CACA,iBAAiB;EACf,cAAc;EACd,SAAS;EACT,MAAM;CACR;AACF,CAAC"}
@@ -1,11 +1,11 @@
1
1
  declare const recipes: {
2
2
  badge: import('@chakra-ui/react').RecipeDefinition<{
3
3
  size: {
4
- xxs: {
4
+ xs: {
5
5
  minWidth: "20";
6
6
  paddingBlock: "2";
7
7
  };
8
- xs: {
8
+ sm: {
9
9
  minWidth: "24";
10
10
  paddingBlock: "4";
11
11
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit-v2",
3
3
  "private": false,
4
- "version": "0.3.343",
4
+ "version": "0.3.345-beta.2197",
5
5
  "description": "Bitrise Design System Components built with Chakra UI V3",
6
6
  "keywords": [
7
7
  "react",