@bitrise/bitkit-v2 0.3.441 → 0.3.443

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.
@@ -2,21 +2,15 @@ import BitkitCodeSnippet from "../BitkitCodeSnippet/BitkitCodeSnippet.js";
2
2
  import BitkitHeading from "../BitkitHeading/BitkitHeading.js";
3
3
  import BitkitLink from "../BitkitLink/BitkitLink.js";
4
4
  import BitkitList_default from "../BitkitList/BitkitList.js";
5
+ import { getTextContent } from "../../utilities/getTextContent.js";
5
6
  import { chakra, useSlotRecipe } from "@chakra-ui/react/styled-system";
6
- import { forwardRef, isValidElement } from "react";
7
+ import { forwardRef } from "react";
7
8
  import { jsx } from "react/jsx-runtime";
8
9
  import { Separator } from "@chakra-ui/react/separator";
9
10
  import { Text } from "@chakra-ui/react/text";
10
11
  import { Stack } from "@chakra-ui/react/stack";
11
12
  import Markdown from "react-markdown";
12
13
  //#region lib/components/BitkitMarkdown/BitkitMarkdown.tsx
13
- var getTextContent = (node) => {
14
- if (typeof node === "string") return node;
15
- if (typeof node === "number") return String(node);
16
- if (Array.isArray(node)) return node.map(getTextContent).join("");
17
- if (isValidElement(node)) return getTextContent(node.props.children);
18
- return "";
19
- };
20
14
  var createComponents = (size, blockquoteStyles) => {
21
15
  const codeSize = size === "lg" ? "lg" : "md";
22
16
  const listSize = size === "lg" ? "lg" : "md";
@@ -1 +1 @@
1
- {"version":3,"file":"BitkitMarkdown.js","names":[],"sources":["../../../lib/components/BitkitMarkdown/BitkitMarkdown.tsx"],"sourcesContent":["import { Separator } from '@chakra-ui/react/separator';\nimport { Stack, type StackProps } from '@chakra-ui/react/stack';\nimport { chakra, type SystemStyleObject, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { type ComponentProps, forwardRef, isValidElement, type ReactNode } from 'react';\nimport Markdown, { type Components } from 'react-markdown';\n\nimport BitkitCodeSnippet from '../BitkitCodeSnippet/BitkitCodeSnippet';\nimport BitkitHeading from '../BitkitHeading/BitkitHeading';\nimport BitkitLink from '../BitkitLink/BitkitLink';\nimport BitkitList from '../BitkitList/BitkitList';\n\n// ----- Helpers -----\n\nconst getTextContent = (node: ReactNode): string => {\n if (typeof node === 'string') return node;\n if (typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(getTextContent).join('');\n if (isValidElement(node)) return getTextContent((node.props as { children?: ReactNode }).children);\n return '';\n};\n\n// ----- Component mappings -----\n\nconst createComponents = (size: 'sm' | 'md' | 'lg', blockquoteStyles: SystemStyleObject): Components => {\n const codeSize = size === 'lg' ? 'lg' : 'md';\n const listSize = size === 'lg' ? 'lg' : 'md';\n\n return {\n a: ({ node: _, ...props }) => (\n <BitkitLink colorVariant=\"purple\" rel=\"noopener noreferrer\" target=\"_blank\" {...props} />\n ),\n blockquote: ({ node: _, ...props }) => <chakra.blockquote css={blockquoteStyles} {...props} />,\n // Not String(children): a rehypePlugin such as a syntax highlighter turns the text into\n // elements, and String() on those yields \"[object Object]\".\n code: ({ node: _, children }) => (\n <BitkitCodeSnippet variant=\"inline\" size={codeSize}>\n {getTextContent(children)}\n </BitkitCodeSnippet>\n ),\n h1: ({ node: _, ...props }) => <BitkitHeading as=\"h1\" {...props} />,\n h2: ({ node: _, ...props }) => <BitkitHeading as=\"h2\" {...props} />,\n h3: ({ node: _, ...props }) => <BitkitHeading as=\"h3\" {...props} />,\n h4: ({ node: _, ...props }) => <BitkitHeading as=\"h4\" {...props} />,\n h5: ({ node: _, ...props }) => <BitkitHeading as=\"h5\" {...props} />,\n h6: ({ node: _, ...props }) => <BitkitHeading as=\"h6\" {...props} />,\n hr: () => <Separator />,\n li: ({ node: _, ...props }) => <BitkitList.Item>{props.children}</BitkitList.Item>,\n ol: ({ node: _, ...props }) => (\n <BitkitList size={listSize} variant=\"ordered\">\n {props.children}\n </BitkitList>\n ),\n p: ({ node: _, ...props }) => <Text {...props} />,\n // The parser closes a code block with a newline, which the `multi` variant renders as an\n // empty last line because its content is `white-space: pre-wrap`.\n pre: ({ node: _, children }) => (\n <BitkitCodeSnippet variant=\"multi\" size={codeSize}>\n {getTextContent(children).replace(/\\n$/, '')}\n </BitkitCodeSnippet>\n ),\n ul: ({ node: _, ...props }) => (\n <BitkitList size={listSize} variant=\"unordered\">\n {props.children}\n </BitkitList>\n ),\n };\n};\n\n// ----- BitkitMarkdown -----\n\nexport interface BitkitMarkdownProps extends Omit<StackProps, 'children'> {\n children: string;\n components?: Components | null;\n rehypePlugins?: ComponentProps<typeof Markdown>['rehypePlugins'];\n size?: 'sm' | 'md' | 'lg';\n}\n\nconst BitkitMarkdown = forwardRef<HTMLDivElement, BitkitMarkdownProps>((props, ref) => {\n const { children, components, css, rehypePlugins, size = 'md', ...rest } = props;\n\n const recipe = useSlotRecipe({ key: 'markdown' });\n const styles = recipe({ size });\n\n const defaultComponents = createComponents(size, styles.blockquote);\n const mergedComponents = { ...defaultComponents, ...(components ?? {}) };\n\n return (\n <Stack ref={ref} gap=\"16\" css={[styles.root, css]} {...rest}>\n <Markdown components={mergedComponents} rehypePlugins={rehypePlugins}>\n {children}\n </Markdown>\n </Stack>\n );\n});\n\nBitkitMarkdown.displayName = 'BitkitMarkdown';\n\nexport default BitkitMarkdown;\n"],"mappings":";;;;;;;;;;;;AAcA,IAAM,kBAAkB,SAA4B;CAClD,IAAI,OAAO,SAAS,UAAU,OAAO;CACrC,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO,IAAI;CAChD,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,KAAK,IAAI,cAAc,CAAC,CAAC,KAAK,EAAE;CAChE,IAAI,eAAe,IAAI,GAAG,OAAO,eAAgB,KAAK,MAAmC,QAAQ;CACjG,OAAO;AACT;AAIA,IAAM,oBAAoB,MAA0B,qBAAoD;CACtG,MAAM,WAAW,SAAS,OAAO,OAAO;CACxC,MAAM,WAAW,SAAS,OAAO,OAAO;CAExC,OAAO;EACL,IAAI,EAAE,MAAM,GAAG,GAAG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AAmB,SAAQ;GAAQ,MAAM;GACtC,UAAA,eAAe,QAAQ,CAAC,CAAC,QAAQ,OAAO,EAAE;EAC1B,CAAA;EAErB,KAAK,EAAE,MAAM,GAAG,GAAG,YACjB,oBAAC,oBAAD;GAAY,MAAM;GAAU,SAAQ;GACjC,UAAA,MAAM;EACG,CAAA;CAEhB;AACF;AAWA,IAAM,iBAAiB,YAAiD,OAAO,QAAQ;CACrF,MAAM,EAAE,UAAU,YAAY,KAAK,eAAe,OAAO,MAAM,GAAG,SAAS;CAG3E,MAAM,SADS,cAAc,EAAE,KAAK,WAAW,CAChC,CAAA,CAAO,EAAE,KAAK,CAAC;CAG9B,MAAM,mBAAmB;EAAE,GADD,iBAAiB,MAAM,OAAO,UAC1B;EAAmB,GAAI,cAAc,CAAC;CAAG;CAEvE,OACE,oBAAC,OAAD;EAAY;EAAK,KAAI;EAAK,KAAK,CAAC,OAAO,MAAM,GAAG;EAAG,GAAI;EACrD,UAAA,oBAAC,UAAD;GAAU,YAAY;GAAiC;GACpD;EACO,CAAA;CACL,CAAA;AAEX,CAAC;AAED,eAAe,cAAc"}
1
+ {"version":3,"file":"BitkitMarkdown.js","names":[],"sources":["../../../lib/components/BitkitMarkdown/BitkitMarkdown.tsx"],"sourcesContent":["import { Separator } from '@chakra-ui/react/separator';\nimport { Stack, type StackProps } from '@chakra-ui/react/stack';\nimport { chakra, type SystemStyleObject, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { type ComponentProps, forwardRef } from 'react';\nimport Markdown, { type Components } from 'react-markdown';\n\nimport { getTextContent } from '../../utilities/getTextContent';\nimport BitkitCodeSnippet from '../BitkitCodeSnippet/BitkitCodeSnippet';\nimport BitkitHeading from '../BitkitHeading/BitkitHeading';\nimport BitkitLink from '../BitkitLink/BitkitLink';\nimport BitkitList from '../BitkitList/BitkitList';\n\n// ----- Component mappings -----\n\nconst createComponents = (size: 'sm' | 'md' | 'lg', blockquoteStyles: SystemStyleObject): Components => {\n const codeSize = size === 'lg' ? 'lg' : 'md';\n const listSize = size === 'lg' ? 'lg' : 'md';\n\n return {\n a: ({ node: _, ...props }) => (\n <BitkitLink colorVariant=\"purple\" rel=\"noopener noreferrer\" target=\"_blank\" {...props} />\n ),\n blockquote: ({ node: _, ...props }) => <chakra.blockquote css={blockquoteStyles} {...props} />,\n // Not String(children): a rehypePlugin such as a syntax highlighter turns the text into\n // elements, and String() on those yields \"[object Object]\".\n code: ({ node: _, children }) => (\n <BitkitCodeSnippet variant=\"inline\" size={codeSize}>\n {getTextContent(children)}\n </BitkitCodeSnippet>\n ),\n h1: ({ node: _, ...props }) => <BitkitHeading as=\"h1\" {...props} />,\n h2: ({ node: _, ...props }) => <BitkitHeading as=\"h2\" {...props} />,\n h3: ({ node: _, ...props }) => <BitkitHeading as=\"h3\" {...props} />,\n h4: ({ node: _, ...props }) => <BitkitHeading as=\"h4\" {...props} />,\n h5: ({ node: _, ...props }) => <BitkitHeading as=\"h5\" {...props} />,\n h6: ({ node: _, ...props }) => <BitkitHeading as=\"h6\" {...props} />,\n hr: () => <Separator />,\n li: ({ node: _, ...props }) => <BitkitList.Item>{props.children}</BitkitList.Item>,\n ol: ({ node: _, ...props }) => (\n <BitkitList size={listSize} variant=\"ordered\">\n {props.children}\n </BitkitList>\n ),\n p: ({ node: _, ...props }) => <Text {...props} />,\n // The parser closes a code block with a newline, which the `multi` variant renders as an\n // empty last line because its content is `white-space: pre-wrap`.\n pre: ({ node: _, children }) => (\n <BitkitCodeSnippet variant=\"multi\" size={codeSize}>\n {getTextContent(children).replace(/\\n$/, '')}\n </BitkitCodeSnippet>\n ),\n ul: ({ node: _, ...props }) => (\n <BitkitList size={listSize} variant=\"unordered\">\n {props.children}\n </BitkitList>\n ),\n };\n};\n\n// ----- BitkitMarkdown -----\n\nexport interface BitkitMarkdownProps extends Omit<StackProps, 'children'> {\n children: string;\n components?: Components | null;\n rehypePlugins?: ComponentProps<typeof Markdown>['rehypePlugins'];\n size?: 'sm' | 'md' | 'lg';\n}\n\nconst BitkitMarkdown = forwardRef<HTMLDivElement, BitkitMarkdownProps>((props, ref) => {\n const { children, components, css, rehypePlugins, size = 'md', ...rest } = props;\n\n const recipe = useSlotRecipe({ key: 'markdown' });\n const styles = recipe({ size });\n\n const defaultComponents = createComponents(size, styles.blockquote);\n const mergedComponents = { ...defaultComponents, ...(components ?? {}) };\n\n return (\n <Stack ref={ref} gap=\"16\" css={[styles.root, css]} {...rest}>\n <Markdown components={mergedComponents} rehypePlugins={rehypePlugins}>\n {children}\n </Markdown>\n </Stack>\n );\n});\n\nBitkitMarkdown.displayName = 'BitkitMarkdown';\n\nexport default BitkitMarkdown;\n"],"mappings":";;;;;;;;;;;;;AAeA,IAAM,oBAAoB,MAA0B,qBAAoD;CACtG,MAAM,WAAW,SAAS,OAAO,OAAO;CACxC,MAAM,WAAW,SAAS,OAAO,OAAO;CAExC,OAAO;EACL,IAAI,EAAE,MAAM,GAAG,GAAG,YAChB,oBAAC,YAAD;GAAY,cAAa;GAAS,KAAI;GAAsB,QAAO;GAAS,GAAI;EAAQ,CAAA;EAE1F,aAAa,EAAE,MAAM,GAAG,GAAG,YAAY,oBAAC,OAAO,YAAR;GAAmB,KAAK;GAAkB,GAAI;EAAQ,CAAA;EAG7F,OAAO,EAAE,MAAM,GAAG,eAChB,oBAAC,mBAAD;GAAmB,SAAQ;GAAS,MAAM;GACvC,UAAA,eAAe,QAAQ;EACP,CAAA;EAErB,KAAK,EAAE,MAAM,GAAG,GAAG,YAAY,oBAAC,eAAD;GAAe,IAAG;GAAK,GAAI;EAAQ,CAAA;EAClE,KAAK,EAAE,MAAM,GAAG,GAAG,YAAY,oBAAC,eAAD;GAAe,IAAG;GAAK,GAAI;EAAQ,CAAA;EAClE,KAAK,EAAE,MAAM,GAAG,GAAG,YAAY,oBAAC,eAAD;GAAe,IAAG;GAAK,GAAI;EAAQ,CAAA;EAClE,KAAK,EAAE,MAAM,GAAG,GAAG,YAAY,oBAAC,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AiC;GACpD;EACO,CAAA;CACL,CAAA;AAEX,CAAC;AAED,eAAe,cAAc"}
@@ -1,3 +1,4 @@
1
+ import { Tokens } from '@chakra-ui/react/styled-system';
1
2
  import { Tabs } from '@chakra-ui/react/tabs';
2
3
  import { ReactNode } from 'react';
3
4
  import { BitkitIconComponent } from '../../icons';
@@ -21,10 +22,31 @@ declare const Root: import('react').ForwardRefExoticComponent<Omit<Tabs.RootProp
21
22
  } & import('react').RefAttributes<HTMLDivElement>>;
22
23
  /** Status-dot colors for the `canvas` variant. */
23
24
  export type BitkitTabsStatusColor = 'neutral' | 'purple' | 'red' | 'yellow';
25
+ type BitkitTabsIconColor = [Extract<Tokens['colors'], `icon/${string}`>] extends [never] ? string : Extract<Tokens['colors'], `icon/${string}`>;
26
+ export type BitkitTabsTriggerProps = Tabs.TriggerProps & {
27
+ badge?: ReactNode;
28
+ children?: string;
29
+ icon?: BitkitIconComponent;
30
+ /**
31
+ * `contained` variant only: an `icon/*` token for the icon when it carries meaning of its own,
32
+ * such as a trend arrow. It wins over the hover and selected colours; a disabled tab keeps its own.
33
+ */
34
+ iconColor?: BitkitTabsIconColor;
35
+ /** `canvas` variant only — when provided, a close button reveals on hover and calls this handler when clicked. */
36
+ onClose?: () => void;
37
+ secondaryText?: ReactNode;
38
+ /** `canvas` variant only — shows a status indicator dot. When hovered (and `onClose` is set), the close button replaces it. */
39
+ statusColor?: BitkitTabsStatusColor;
40
+ };
24
41
  declare const Trigger: import('react').ForwardRefExoticComponent<Tabs.TriggerProps & {
25
42
  badge?: ReactNode;
26
43
  children?: string;
27
44
  icon?: BitkitIconComponent;
45
+ /**
46
+ * `contained` variant only: an `icon/*` token for the icon when it carries meaning of its own,
47
+ * such as a trend arrow. It wins over the hover and selected colours; a disabled tab keeps its own.
48
+ */
49
+ iconColor?: BitkitTabsIconColor;
28
50
  /** `canvas` variant only — when provided, a close button reveals on hover and calls this handler when clicked. */
29
51
  onClose?: () => void;
30
52
  secondaryText?: ReactNode;
@@ -2,6 +2,7 @@ import IconCross from "../../icons/IconCross.js";
2
2
  import IconPlus from "../../icons/IconPlus.js";
3
3
  import { flattenChildren } from "../../utilities/flattenChildren.js";
4
4
  import BitkitControlButton from "../BitkitControlButton/BitkitControlButton.js";
5
+ import { getTextContent } from "../../utilities/getTextContent.js";
5
6
  import { Box } from "@chakra-ui/react/box";
6
7
  import { chakra, useRecipe } from "@chakra-ui/react/styled-system";
7
8
  import { cloneElement, forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
@@ -33,9 +34,10 @@ var STATUS_COLOR_TOKEN = {
33
34
  yellow: "color/yellow/bold"
34
35
  };
35
36
  Root.displayName = "BitkitTabs.Root";
37
+ var isCompactTabs = (variant, size) => variant === "canvas" || variant === "line" && size === "md";
36
38
  var Trigger = forwardRef((props, ref) => {
37
- const { badge, children, className, icon: Icon, onClose, onKeyDown, secondaryText, statusColor, ...rest } = props;
38
- const { variant = "line" } = useRootPropsContext();
39
+ const { badge, children, className, icon: Icon, iconColor, onClose, onKeyDown, secondaryText, statusColor, ...rest } = props;
40
+ const { size = "lg", variant = "line" } = useRootPropsContext();
39
41
  const closeButtonRecipe = useRecipe({ key: "closeButton" });
40
42
  const isCanvas = variant === "canvas";
41
43
  const closable = isCanvas && !!onClose && !rest.disabled;
@@ -101,46 +103,47 @@ var Trigger = forwardRef((props, ref) => {
101
103
  children: /* @__PURE__ */ jsx(IconCross, { size: "16" })
102
104
  })]
103
105
  }) : null;
106
+ const isCompact = isCompactTabs(variant, size);
107
+ const hasOwnIconColor = variant === "contained" && !!iconColor && !rest.disabled;
108
+ const icon = Icon && /* @__PURE__ */ jsx(Icon, {
109
+ color: hasOwnIconColor ? iconColor : "var(--tabs-icon-color)",
110
+ size: isCompact ? "16" : "24"
111
+ });
112
+ const canvasPadding = isCanvas ? {
113
+ paddingInlineEnd: showTrailing ? "8" : Icon ? "16" : void 0,
114
+ paddingInlineStart: Icon ? "8" : void 0
115
+ } : void 0;
104
116
  return /* @__PURE__ */ jsx(Tabs.Trigger, {
105
117
  ref,
106
118
  ...rest,
119
+ ...canvasPadding,
107
120
  className: mergedClassName,
108
- gap: isCanvas ? "4" : showTrailing ? "12" : void 0,
109
121
  onKeyDown: handleTriggerKeyDown,
110
- paddingInlineEnd: isCanvas ? showTrailing ? "8" : void 0 : showTrailing ? "12" : void 0,
111
- paddingInlineStart: isCanvas && Icon ? "8" : void 0,
112
122
  children: isCanvas ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Box, {
113
123
  display: "flex",
114
124
  alignItems: "center",
115
125
  gap: "8",
116
- children: [Icon && /* @__PURE__ */ jsx(Icon, { size: "16" }), children]
126
+ children: [icon, children]
117
127
  }), trailing] }) : variant === "line" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Box, {
118
128
  display: "flex",
119
129
  alignItems: "center",
120
130
  gap: "8",
121
- children: [
122
- Icon && /* @__PURE__ */ jsx(Icon, { size: "24" }),
123
- children,
124
- badge
125
- ]
126
- }), trailing] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
127
- /* @__PURE__ */ jsxs(Box, {
131
+ children: [icon, children]
132
+ }), badge] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Box, {
133
+ display: "flex",
134
+ flexDirection: "column",
135
+ children: [/* @__PURE__ */ jsxs(Box, {
128
136
  display: "flex",
137
+ alignItems: "flex-start",
129
138
  gap: "16",
130
- children: [
131
- children,
132
- badge,
133
- Icon && /* @__PURE__ */ jsx(Icon, { size: "24" })
134
- ]
135
- }),
136
- !!secondaryText && /* @__PURE__ */ jsx(Text, {
139
+ children: [children, badge]
140
+ }), !!secondaryText && /* @__PURE__ */ jsx(Text, {
137
141
  as: "span",
138
142
  textStyle: "body/md/regular",
139
143
  color: rest.disabled ? "text/on-disabled" : "text/secondary",
140
144
  children: secondaryText
141
- }),
142
- trailing
143
- ] })
145
+ })]
146
+ }), icon] })
144
147
  });
145
148
  });
146
149
  Trigger.displayName = "BitkitTabs.Trigger";
@@ -164,29 +167,42 @@ var AddButton = forwardRef((props, ref) => {
164
167
  });
165
168
  });
166
169
  AddButton.displayName = "BitkitTabs.AddButton";
170
+ var measureContentWidth = (node) => {
171
+ const { cssText } = node.style;
172
+ node.style.flex = "0 0 auto";
173
+ node.style.width = "max-content";
174
+ const contentWidth = node.getBoundingClientRect().width;
175
+ node.style.cssText = cssText;
176
+ return contentWidth;
177
+ };
167
178
  var List = forwardRef((props, ref) => {
168
179
  const { children, css, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...rest } = props;
169
- const { variant = "line" } = useRootPropsContext();
180
+ const { size = "lg", variant = "line" } = useRootPropsContext();
170
181
  const api = useTabsContext();
171
182
  const styles = useTabsStyles();
183
+ const isCompact = isCompactTabs(variant, size);
172
184
  const allChildren = flattenChildren(children);
173
185
  const addButton = allChildren.find((child) => child.type === AddButton) ?? null;
174
186
  const items = allChildren.filter((child) => child.type === Trigger);
175
- const measureKey = variant + items.map((item) => {
176
- const p = item.props;
177
- return [
178
- p.value,
179
- String(p.children),
180
- p.icon ? "i" : "",
181
- p.badge ? String(p.badge) : "",
182
- p.secondaryText ? String(p.secondaryText) : "",
183
- p.statusColor ?? "",
184
- p.onClose ? "c" : "",
185
- p.disabled ? "d" : ""
186
- ].join(":");
187
- }).join("|");
187
+ const measureKey = [
188
+ variant,
189
+ size,
190
+ ...items.map((item) => {
191
+ const p = item.props;
192
+ return [
193
+ p.value,
194
+ String(p.children),
195
+ p.icon ? "i" : "",
196
+ getTextContent(p.badge),
197
+ getTextContent(p.secondaryText),
198
+ p.statusColor ?? "",
199
+ p.onClose ? "c" : "",
200
+ p.disabled ? "d" : ""
201
+ ].join(":");
202
+ })
203
+ ].join("|");
188
204
  const selectedIndex = items.findIndex((item) => item.props.value === api.value);
189
- const moreReserve = variant === "canvas" ? 100 : 140;
205
+ const moreReserve = isCompact ? 88 : 104;
190
206
  const addReserve = addButton ? 48 : 0;
191
207
  const listRef = useRef(null);
192
208
  const widthsRef = useRef([]);
@@ -218,7 +234,7 @@ var List = forwardRef((props, ref) => {
218
234
  if (!el) return;
219
235
  if (measuredKey !== measureKey) {
220
236
  const tabEls = el.querySelectorAll("[data-tab-trigger]");
221
- widthsRef.current = Array.from(tabEls, (node) => node.offsetWidth);
237
+ widthsRef.current = Array.from(tabEls, measureContentWidth);
222
238
  const cs = getComputedStyle(el);
223
239
  paddingRef.current = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight);
224
240
  setMeasuredKey(measureKey);
@@ -229,6 +245,15 @@ var List = forwardRef((props, ref) => {
229
245
  measuredKey,
230
246
  recompute
231
247
  ]);
248
+ useEffect(() => {
249
+ let cancelled = false;
250
+ document.fonts?.ready.then(() => {
251
+ if (!cancelled) setMeasuredKey(null);
252
+ });
253
+ return () => {
254
+ cancelled = true;
255
+ };
256
+ }, []);
232
257
  useEffect(() => {
233
258
  const el = listRef.current;
234
259
  if (!el || typeof ResizeObserver === "undefined") return;
@@ -248,6 +273,7 @@ var List = forwardRef((props, ref) => {
248
273
  return /* @__PURE__ */ jsxs(Box, {
249
274
  ref: setListRef,
250
275
  css: [styles.list, css],
276
+ "data-overflowing": hiddenItems.length > 0 ? "" : void 0,
251
277
  ...rest,
252
278
  children: [
253
279
  /* @__PURE__ */ jsx(Tabs.List, {
@@ -262,7 +288,7 @@ var List = forwardRef((props, ref) => {
262
288
  }))
263
289
  }),
264
290
  hiddenItems.length > 0 && /* @__PURE__ */ jsxs(Menu.Root, {
265
- size: "md",
291
+ size: isCompact ? "md" : "lg",
266
292
  positioning: {
267
293
  gutter: 0,
268
294
  shift: -4
@@ -1 +1 @@
1
- {"version":3,"file":"BitkitTabs.js","names":[],"sources":["../../../lib/components/BitkitTabs/BitkitTabs.tsx"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { createContext, mergeRefs, useSafeLayoutEffect } from '@chakra-ui/react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Menu } from '@chakra-ui/react/menu';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { chakra, useRecipe } from '@chakra-ui/react/styled-system';\nimport { Tabs, useTabsContext, useTabsStyles } from '@chakra-ui/react/tabs';\nimport { Text } from '@chakra-ui/react/text';\nimport {\n cloneElement,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { type BitkitIconComponent, IconCross, IconPlus } from '../../icons';\nimport { flattenChildren } from '../../utilities/flattenChildren';\nimport BitkitControlButton, { type BitkitControlButtonProps } from '../BitkitControlButton/BitkitControlButton';\n\n/**\n * Root props. `onValueChange` is re-declared with a concrete `{ value }` arg so the callback\n * parameter is inferred at the call site: the base `Tabs.RootProps` intersection breaks\n * contextual typing, which otherwise leaves consumers' `({ value }) => …` flagged as an\n * implicit `any` under `noImplicitAny`.\n */\nexport type BitkitTabsRootProps = Omit<Tabs.RootProps, 'onValueChange'> & {\n onValueChange?: (details: { value: string }) => void;\n};\n\nexport const [RootPropsProvider, useRootPropsContext] = createContext<BitkitTabsRootProps>({\n name: 'RootPropsContext',\n hookName: 'useRootPropsContext',\n providerName: '<RootProps />',\n});\n\nconst Root = forwardRef<HTMLDivElement, BitkitTabsRootProps>((props, ref) => {\n return (\n <RootPropsProvider value={props}>\n <Tabs.Root ref={ref} {...props} />\n </RootPropsProvider>\n );\n});\n\n/** Status-dot colors for the `canvas` variant. */\nexport type BitkitTabsStatusColor = 'neutral' | 'purple' | 'red' | 'yellow';\n\nconst STATUS_COLOR_TOKEN: Record<BitkitTabsStatusColor, string> = {\n neutral: 'color/neutral/muted',\n purple: 'interactive/bold',\n red: 'color/red/base',\n yellow: 'color/yellow/bold',\n};\n\ntype TriggerProps = Tabs.TriggerProps & {\n badge?: ReactNode;\n children?: string;\n icon?: BitkitIconComponent;\n /** `canvas` variant only — when provided, a close button reveals on hover and calls this handler when clicked. */\n onClose?: () => void;\n secondaryText?: ReactNode;\n /** `canvas` variant only — shows a status indicator dot. When hovered (and `onClose` is set), the close button replaces it. */\n statusColor?: BitkitTabsStatusColor;\n};\n\nRoot.displayName = 'BitkitTabs.Root';\n\nconst Trigger = forwardRef<HTMLButtonElement, TriggerProps>((props, ref) => {\n const { badge, children, className, icon: Icon, onClose, onKeyDown, secondaryText, statusColor, ...rest } = props;\n // Mirror the recipe's defaultVariant so an unset `variant` renders the line layout (not the\n // contained one) — otherwise an undefined variant would fall through to the contained branch.\n const { variant = 'line' } = useRootPropsContext();\n const closeButtonRecipe = useRecipe({ key: 'closeButton' });\n\n // Close button and status dot are exclusive to the canvas variant.\n const isCanvas = variant === 'canvas';\n const closable = isCanvas && !!onClose && !rest.disabled;\n const hasStatus = isCanvas && !!statusColor && !rest.disabled;\n const showTrailing = closable || hasStatus;\n const mergedClassName = showTrailing ? (className ? `group ${className}` : 'group') : className;\n // The close button is always visible when there is no status dot; when the dot is shown it is\n // revealed on hover/focus instead (replacing the dot).\n const revealCloseOnInteraction = closable && hasStatus;\n const revealOnInteraction = { opacity: 1, pointerEvents: 'auto' } as const;\n\n const handleCloseClick = (event: MouseEvent<HTMLSpanElement>) => {\n event.stopPropagation();\n event.preventDefault();\n onClose?.();\n };\n\n // The close control is not in the tab order; keyboard users close the focused tab with Delete/Backspace.\n const handleTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (closable && (event.key === 'Delete' || event.key === 'Backspace')) {\n event.preventDefault();\n // Move focus to a sibling tab before removal so keyboard navigation can continue.\n const trigger = event.currentTarget;\n // Skip overflowed (`hidden`) tabs — they aren't focusable.\n const triggers = [\n ...(trigger.closest('[role=\"tablist\"]')?.querySelectorAll<HTMLElement>('[role=\"tab\"]:not([hidden])') ?? []),\n ];\n const index = triggers.indexOf(trigger);\n (triggers[index + 1] ?? triggers[index - 1])?.focus();\n onClose?.();\n }\n onKeyDown?.(event);\n };\n\n const trailing = showTrailing ? (\n <chakra.span\n position=\"relative\"\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n boxSize=\"24\"\n flexShrink={0}\n >\n {hasStatus && statusColor && (\n <chakra.span\n position=\"absolute\"\n inset={0}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n pointerEvents=\"none\"\n transition=\"opacity 0.1s\"\n _groupHover={closable ? { opacity: 0 } : undefined}\n _groupFocusWithin={closable ? { opacity: 0 } : undefined}\n >\n <chakra.span boxSize=\"8\" borderRadius=\"full\" backgroundColor={STATUS_COLOR_TOKEN[statusColor]} />\n </chakra.span>\n )}\n {closable && (\n <chakra.span\n aria-hidden\n tabIndex={-1}\n onClick={handleCloseClick}\n css={closeButtonRecipe({ size: 'xs' })}\n position=\"absolute\"\n inset={0}\n color=\"icon/primary\"\n opacity={revealCloseOnInteraction ? 0 : 1}\n pointerEvents={revealCloseOnInteraction ? 'none' : 'auto'}\n transition=\"opacity 0.1s\"\n _groupHover={revealCloseOnInteraction ? revealOnInteraction : undefined}\n _groupFocusWithin={revealCloseOnInteraction ? revealOnInteraction : undefined}\n >\n <IconCross size=\"16\" />\n </chakra.span>\n )}\n </chakra.span>\n ) : null;\n\n return (\n <Tabs.Trigger\n ref={ref}\n {...rest}\n className={mergedClassName}\n gap={isCanvas ? '4' : showTrailing ? '12' : undefined}\n onKeyDown={handleTriggerKeyDown}\n paddingInlineEnd={isCanvas ? (showTrailing ? '8' : undefined) : showTrailing ? '12' : undefined}\n paddingInlineStart={isCanvas && Icon ? '8' : undefined}\n >\n {isCanvas ? (\n <>\n <Box display=\"flex\" alignItems=\"center\" gap=\"8\">\n {Icon && <Icon size=\"16\" />}\n {children}\n </Box>\n {trailing}\n </>\n ) : variant === 'line' ? (\n <>\n <Box display=\"flex\" alignItems=\"center\" gap=\"8\">\n {Icon && <Icon size=\"24\" />}\n {children}\n {badge}\n </Box>\n {trailing}\n </>\n ) : (\n <>\n <Box display=\"flex\" gap=\"16\">\n {children}\n {badge}\n {Icon && <Icon size=\"24\" />}\n </Box>\n {!!secondaryText && (\n <Text as=\"span\" textStyle=\"body/md/regular\" color={rest.disabled ? 'text/on-disabled' : 'text/secondary'}>\n {secondaryText}\n </Text>\n )}\n {trailing}\n </>\n )}\n </Tabs.Trigger>\n );\n});\n\nTrigger.displayName = 'BitkitTabs.Trigger';\n\ntype TabItem = ReactElement<TriggerProps>;\n\n// Returns the set of visible tab indices for the overflow, always keeping the selected tab\n// visible: if it would overflow, it takes the last visible slot.\nconst getVisibleIndices = (total: number, count: number, selectedIndex: number) => {\n const visible = new Set<number>();\n for (let i = 0; i < count; i += 1) visible.add(i);\n if (selectedIndex >= 0 && selectedIndex < total && !visible.has(selectedIndex)) {\n visible.delete(count - 1);\n visible.add(selectedIndex);\n }\n return visible;\n};\n\nexport type BitkitTabsAddButtonProps = Omit<\n Extract<BitkitControlButtonProps, { href?: undefined }>,\n 'icon' | 'label' | 'size'\n> & {\n /** Accessible label / tooltip for the add button. */\n label?: string;\n};\n\n// \"+\" button to add a tab. Place it as a child of `List`; it always renders at the end of the row\n// (after the overflow menu). A compact `xxs` control button (16px icon, 4px padding) per the design.\nconst AddButton = forwardRef<HTMLButtonElement, BitkitTabsAddButtonProps>((props, ref) => {\n const { label = 'Add tab', ...rest } = props;\n return <BitkitControlButton ref={ref} icon={IconPlus} label={label} size=\"xxs\" {...rest} />;\n});\n\nAddButton.displayName = 'BitkitTabs.AddButton';\n\n// Overflow-aware List (all variants): measures the tabs and collapses the overflowing ones into a\n// \"N more…\" menu. The more-button look comes from the variant's `moreTrigger` recipe slot.\nconst List = forwardRef<HTMLDivElement, Tabs.ListProps>((props, ref) => {\n // Semantic/labelling attributes belong on the actual tablist, not the visual wrapper.\n const { children, css, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, ...rest } = props;\n const { variant = 'line' } = useRootPropsContext();\n const api = useTabsContext();\n const styles = useTabsStyles();\n\n // Split children: tab triggers participate in overflow; the optional add button always renders last.\n const allChildren = flattenChildren(children);\n const addButton = allChildren.find((child) => child.type === AddButton) ?? null;\n // Only Trigger elements are measured/overflowed; anything else (fragments, stray nodes) is ignored.\n const items = allChildren.filter((child) => child.type === Trigger) as TabItem[];\n // Re-measure whenever the tab set OR any width-affecting input changes — the variant, each tab's\n // value/label, icon/status/close/disabled state, and badge/secondaryText content (best-effort\n // string form, so width-changing text like \"3 errors\" → \"12 errors\" invalidates the cache).\n const measureKey =\n variant +\n items\n .map((item) => {\n const p = item.props;\n return [\n p.value,\n String(p.children),\n p.icon ? 'i' : '',\n p.badge ? String(p.badge) : '',\n p.secondaryText ? String(p.secondaryText) : '',\n p.statusColor ?? '',\n p.onClose ? 'c' : '',\n p.disabled ? 'd' : '',\n ].join(':');\n })\n .join('|');\n const selectedIndex = items.findIndex((item) => item.props.value === api.value);\n // Conservative width reservations: the more button (wider for the lg/semibold variants) and the\n // always-visible add button.\n const moreReserve = variant === 'canvas' ? 100 : 140;\n const addReserve = addButton ? 48 : 0;\n\n const listRef = useRef<HTMLDivElement | null>(null);\n const widthsRef = useRef<number[]>([]);\n // Horizontal padding of the list, cached during the measure pass so the resize hot path doesn't\n // call getComputedStyle on every tick.\n const paddingRef = useRef(0);\n // `measuredKey` is state (not a ref) so finishing the measure pass always re-renders and flips\n // `measuring` off — even when recompute keeps the same visibleCount (which would skip a re-render).\n const [measuredKey, setMeasuredKey] = useState<string | null>(null);\n const [visibleCount, setVisibleCount] = useState(items.length);\n\n const setListRef = useMemo(() => mergeRefs(listRef, ref), [ref]);\n\n const recompute = useCallback(() => {\n const el = listRef.current;\n const widths = widthsRef.current;\n if (!el || !widths.length) return;\n const available = el.clientWidth - paddingRef.current - addReserve;\n const totalWidth = widths.reduce((sum, w) => sum + w, 0);\n if (totalWidth <= available) {\n setVisibleCount(widths.length);\n return;\n }\n let used = moreReserve;\n let count = 0;\n for (let i = 0; i < widths.length; i += 1) {\n if (used + widths[i] > available) break;\n used += widths[i];\n count += 1;\n }\n setVisibleCount(Math.max(count, 1));\n }, [addReserve, moreReserve]);\n\n // Measure once per width-affecting change (all tabs are rendered visible during this pass).\n // Isomorphic layout effect: avoids the SSR \"useLayoutEffect does nothing on the server\" warning.\n const measuring = measuredKey !== measureKey;\n useSafeLayoutEffect(() => {\n const el = listRef.current;\n if (!el) return;\n if (measuredKey !== measureKey) {\n const tabEls = el.querySelectorAll<HTMLElement>('[data-tab-trigger]');\n widthsRef.current = Array.from(tabEls, (node) => node.offsetWidth);\n const cs = getComputedStyle(el);\n paddingRef.current = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight);\n setMeasuredKey(measureKey);\n }\n recompute();\n }, [measureKey, measuredKey, recompute]);\n\n useEffect(() => {\n const el = listRef.current;\n if (!el || typeof ResizeObserver === 'undefined') return;\n // Coalesce resize bursts into one recompute per frame to avoid a read/write layout storm.\n let raf = 0;\n const observer = new ResizeObserver(() => {\n cancelAnimationFrame(raf);\n raf = requestAnimationFrame(recompute);\n });\n observer.observe(el);\n return () => {\n cancelAnimationFrame(raf);\n observer.disconnect();\n };\n }, [recompute]);\n\n const showAll = measuring || visibleCount >= items.length;\n const visible = showAll ? null : getVisibleIndices(items.length, visibleCount, selectedIndex);\n const hiddenItems = visible ? items.filter((_, i) => !visible.has(i)) : [];\n\n return (\n // The visual row carries the list styling (background, baseline border, leading padding) and is\n // measured for overflow. The tablist itself only wraps the tabs (`display: contents` keeps the\n // flex layout intact), so the more/add controls stay outside `role=\"tablist\"` per the ARIA spec.\n <Box ref={setListRef} css={[styles.list, css]} {...rest}>\n <Tabs.List display=\"contents\" id={id} aria-label={ariaLabel} aria-labelledby={ariaLabelledby}>\n {items.map((item, i) =>\n cloneElement(item, {\n key: item.props.value,\n 'data-tab-trigger': '',\n hidden: visible ? !visible.has(i) : undefined,\n } as Partial<TriggerProps>),\n )}\n </Tabs.List>\n {hiddenItems.length > 0 && (\n <Menu.Root size=\"md\" positioning={{ gutter: 0, shift: -4 }}>\n <Menu.Trigger asChild>\n <chakra.button type=\"button\" css={styles.moreTrigger}>\n {hiddenItems.length} more…\n </chakra.button>\n </Menu.Trigger>\n <Portal>\n <Menu.Positioner>\n <Menu.Content>\n {hiddenItems.map((item) => (\n <Menu.Item\n key={item.props.value}\n value={item.props.value}\n disabled={item.props.disabled}\n onSelect={() => api.setValue(item.props.value)}\n alignItems=\"center\"\n >\n <Text flex=\"1\" color={item.props.disabled ? 'text/on-disabled' : 'inherit'}>\n {item.props.children}\n </Text>\n {variant === 'canvas' && item.props.statusColor && (\n <chakra.span\n boxSize=\"8\"\n borderRadius=\"full\"\n flexShrink={0}\n backgroundColor={STATUS_COLOR_TOKEN[item.props.statusColor]}\n />\n )}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu.Positioner>\n </Portal>\n </Menu.Root>\n )}\n {addButton && (\n <Box display=\"flex\" alignItems=\"center\" flexShrink={0} paddingInline=\"8\">\n {addButton}\n </Box>\n )}\n </Box>\n );\n});\n\nList.displayName = 'BitkitTabs.List';\n\nconst BitkitTabs: Omit<typeof Tabs, 'Root' | 'Trigger' | 'List'> & {\n AddButton: typeof AddButton;\n List: typeof List;\n Root: typeof Root;\n Trigger: typeof Trigger;\n} = {\n ...Tabs,\n AddButton,\n List,\n Root,\n Trigger,\n};\n\nBitkitTabs.Content.displayName = 'BitkitTabs.Content';\nBitkitTabs.ContentGroup.displayName = 'BitkitTabs.ContentGroup';\nBitkitTabs.Root.displayName = 'BitkitTabs.Root';\n\nexport default BitkitTabs;\n"],"mappings":";;;;;;;;;;;;;;AAoCA,IAAa,CAAC,mBAAmB,uBAAuB,gBAAmC;CACzF,MAAM;CACN,UAAU;CACV,cAAc;AAChB,CAAC;AAED,IAAM,OAAO,YAAiD,OAAO,QAAQ;CAC3E,OACE,oBAAC,mBAAD;EAAmB,OAAO;EACxB,UAAA,oBAAC,KAAK,MAAN;GAAgB;GAAK,GAAI;EAAQ,CAAA;CAChB,CAAA;AAEvB,CAAC;AAKD,IAAM,qBAA4D;CAChE,SAAS;CACT,QAAQ;CACR,KAAK;CACL,QAAQ;AAC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E,QAAQ;KAAG,OAAO;IAAG;IAAzD,UAAA,CACE,oBAAC,KAAK,SAAN;KAAc,SAAA;KACZ,UAAA,qBAAC,OAAO,QAAR;MAAe,MAAK;MAAS,KAAK,OAAO;MAAzC,UAAA,CACG,YAAY,QAAO,QACP;;IACH,CAAA,GACd,oBAAC,QAAD,EAAA,UACE,oBAAC,KAAK,YAAN,EAAA,UACE,oBAAC,KAAK,SAAN,EAAA,UACG,YAAY,KAAK,SAChB,qBAAC,KAAK,MAAN;KAEE,OAAO,KAAK,MAAM;KAClB,UAAU,KAAK,MAAM;KACrB,gBAAgB,IAAI,SAAS,KAAK,MAAM,KAAK;KAC7C,YAAW;KALb,UAAA,CAOE,oBAAC,MAAD;MAAM,MAAK;MAAI,OAAO,KAAK,MAAM,WAAW,qBAAqB;MAC9D,UAAA,KAAK,MAAM;KACR,CAAA,GACL,YAAY,YAAY,KAAK,MAAM,eAClC,oBAAC,OAAO,MAAR;MACE,SAAQ;MACR,cAAa;MACb,YAAY;MACZ,iBAAiB,mBAAmB,KAAK,MAAM;KAChD,CAAA,CAEM;IAjBJ,GAAA,KAAK,MAAM,KAiBP,CACZ,EACW,CAAA,EACC,CAAA,EACX,CAAA,CACC;;GAEZ,aACC,oBAAC,KAAD;IAAK,SAAQ;IAAO,YAAW;IAAS,YAAY;IAAG,eAAc;IAClE,UAAA;GACE,CAAA;EAEJ;;AAET,CAAC;AAED,KAAK,cAAc;AAEnB,IAAM,aAKF;CACF,GAAG;CACH;CACA;CACA;CACA;AACF;AAEA,WAAW,QAAQ,cAAc;AACjC,WAAW,aAAa,cAAc;AACtC,WAAW,KAAK,cAAc"}
1
+ {"version":3,"file":"BitkitTabs.js","names":[],"sources":["../../../lib/components/BitkitTabs/BitkitTabs.tsx"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { createContext, mergeRefs, useSafeLayoutEffect } from '@chakra-ui/react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Menu } from '@chakra-ui/react/menu';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { chakra, type Tokens, useRecipe } from '@chakra-ui/react/styled-system';\nimport { Tabs, useTabsContext, useTabsStyles } from '@chakra-ui/react/tabs';\nimport { Text } from '@chakra-ui/react/text';\nimport {\n cloneElement,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { type BitkitIconComponent, IconCross, IconPlus } from '../../icons';\nimport { flattenChildren } from '../../utilities/flattenChildren';\nimport { getTextContent } from '../../utilities/getTextContent';\nimport BitkitControlButton, { type BitkitControlButtonProps } from '../BitkitControlButton/BitkitControlButton';\n\n/**\n * Root props. `onValueChange` is re-declared with a concrete `{ value }` arg so the callback\n * parameter is inferred at the call site: the base `Tabs.RootProps` intersection breaks\n * contextual typing, which otherwise leaves consumers' `({ value }) => …` flagged as an\n * implicit `any` under `noImplicitAny`.\n */\nexport type BitkitTabsRootProps = Omit<Tabs.RootProps, 'onValueChange'> & {\n onValueChange?: (details: { value: string }) => void;\n};\n\nexport const [RootPropsProvider, useRootPropsContext] = createContext<BitkitTabsRootProps>({\n name: 'RootPropsContext',\n hookName: 'useRootPropsContext',\n providerName: '<RootProps />',\n});\n\nconst Root = forwardRef<HTMLDivElement, BitkitTabsRootProps>((props, ref) => {\n return (\n <RootPropsProvider value={props}>\n <Tabs.Root ref={ref} {...props} />\n </RootPropsProvider>\n );\n});\n\n/** Status-dot colors for the `canvas` variant. */\nexport type BitkitTabsStatusColor = 'neutral' | 'purple' | 'red' | 'yellow';\n\nconst STATUS_COLOR_TOKEN: Record<BitkitTabsStatusColor, string> = {\n neutral: 'color/neutral/muted',\n purple: 'interactive/bold',\n red: 'color/red/base',\n yellow: 'color/yellow/bold',\n};\n\n// Falls back to `string` where the consumer's `chakra typegen` did not run, for the reason given on\n// `BitkitStatusColorToken` in BitkitPageSidebar.\ntype BitkitTabsIconColor = [Extract<Tokens['colors'], `icon/${string}`>] extends [never]\n ? string\n : Extract<Tokens['colors'], `icon/${string}`>;\n\nexport type BitkitTabsTriggerProps = Tabs.TriggerProps & {\n badge?: ReactNode;\n children?: string;\n icon?: BitkitIconComponent;\n /**\n * `contained` variant only: an `icon/*` token for the icon when it carries meaning of its own,\n * such as a trend arrow. It wins over the hover and selected colours; a disabled tab keeps its own.\n */\n iconColor?: BitkitTabsIconColor;\n /** `canvas` variant only — when provided, a close button reveals on hover and calls this handler when clicked. */\n onClose?: () => void;\n secondaryText?: ReactNode;\n /** `canvas` variant only — shows a status indicator dot. When hovered (and `onClose` is set), the close button replaces it. */\n statusColor?: BitkitTabsStatusColor;\n};\n\nRoot.displayName = 'BitkitTabs.Root';\n\n// Canvas and line md tabs are the small ones: 16px icons, and an md overflow menu to match.\nconst isCompactTabs = (variant: BitkitTabsRootProps['variant'], size: BitkitTabsRootProps['size']) =>\n variant === 'canvas' || (variant === 'line' && size === 'md');\n\nconst Trigger = forwardRef<HTMLButtonElement, BitkitTabsTriggerProps>((props, ref) => {\n const {\n badge,\n children,\n className,\n icon: Icon,\n iconColor,\n onClose,\n onKeyDown,\n secondaryText,\n statusColor,\n ...rest\n } = props;\n // Mirror the recipe's defaultVariants: an unset `variant` must take the line branch below, not\n // fall through to the contained one, and an unset `size` the lg icon size.\n const { size = 'lg', variant = 'line' } = useRootPropsContext();\n const closeButtonRecipe = useRecipe({ key: 'closeButton' });\n\n // Close button and status dot are exclusive to the canvas variant.\n const isCanvas = variant === 'canvas';\n const closable = isCanvas && !!onClose && !rest.disabled;\n const hasStatus = isCanvas && !!statusColor && !rest.disabled;\n const showTrailing = closable || hasStatus;\n const mergedClassName = showTrailing ? (className ? `group ${className}` : 'group') : className;\n // The close button is always visible when there is no status dot; when the dot is shown it is\n // revealed on hover/focus instead (replacing the dot).\n const revealCloseOnInteraction = closable && hasStatus;\n const revealOnInteraction = { opacity: 1, pointerEvents: 'auto' } as const;\n\n const handleCloseClick = (event: MouseEvent<HTMLSpanElement>) => {\n event.stopPropagation();\n event.preventDefault();\n onClose?.();\n };\n\n // The close control is not in the tab order; keyboard users close the focused tab with Delete/Backspace.\n const handleTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (closable && (event.key === 'Delete' || event.key === 'Backspace')) {\n event.preventDefault();\n // Move focus to a sibling tab before removal so keyboard navigation can continue.\n const trigger = event.currentTarget;\n // Skip overflowed (`hidden`) tabs — they aren't focusable.\n const triggers = [\n ...(trigger.closest('[role=\"tablist\"]')?.querySelectorAll<HTMLElement>('[role=\"tab\"]:not([hidden])') ?? []),\n ];\n const index = triggers.indexOf(trigger);\n (triggers[index + 1] ?? triggers[index - 1])?.focus();\n onClose?.();\n }\n onKeyDown?.(event);\n };\n\n const trailing = showTrailing ? (\n <chakra.span\n position=\"relative\"\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n boxSize=\"24\"\n flexShrink={0}\n >\n {hasStatus && statusColor && (\n <chakra.span\n position=\"absolute\"\n inset={0}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n pointerEvents=\"none\"\n transition=\"opacity 0.1s\"\n _groupHover={closable ? { opacity: 0 } : undefined}\n _groupFocusWithin={closable ? { opacity: 0 } : undefined}\n >\n <chakra.span boxSize=\"8\" borderRadius=\"full\" backgroundColor={STATUS_COLOR_TOKEN[statusColor]} />\n </chakra.span>\n )}\n {closable && (\n <chakra.span\n aria-hidden\n tabIndex={-1}\n onClick={handleCloseClick}\n css={closeButtonRecipe({ size: 'xs' })}\n position=\"absolute\"\n inset={0}\n color=\"icon/primary\"\n opacity={revealCloseOnInteraction ? 0 : 1}\n pointerEvents={revealCloseOnInteraction ? 'none' : 'auto'}\n transition=\"opacity 0.1s\"\n _groupHover={revealCloseOnInteraction ? revealOnInteraction : undefined}\n _groupFocusWithin={revealCloseOnInteraction ? revealOnInteraction : undefined}\n >\n <IconCross size=\"16\" />\n </chakra.span>\n )}\n </chakra.span>\n ) : null;\n\n const isCompact = isCompactTabs(variant, size);\n const hasOwnIconColor = variant === 'contained' && !!iconColor && !rest.disabled;\n const icon = Icon && (\n <Icon color={hasOwnIconColor ? iconColor : 'var(--tabs-icon-color)'} size={isCompact ? '16' : '24'} />\n );\n const canvasPadding = isCanvas\n ? { paddingInlineEnd: showTrailing ? '8' : Icon ? '16' : undefined, paddingInlineStart: Icon ? '8' : undefined }\n : undefined;\n\n return (\n <Tabs.Trigger ref={ref} {...rest} {...canvasPadding} className={mergedClassName} onKeyDown={handleTriggerKeyDown}>\n {isCanvas ? (\n <>\n <Box display=\"flex\" alignItems=\"center\" gap=\"8\">\n {icon}\n {children}\n </Box>\n {trailing}\n </>\n ) : variant === 'line' ? (\n <>\n <Box display=\"flex\" alignItems=\"center\" gap=\"8\">\n {icon}\n {children}\n </Box>\n {badge}\n </>\n ) : (\n <>\n <Box display=\"flex\" flexDirection=\"column\">\n <Box display=\"flex\" alignItems=\"flex-start\" gap=\"16\">\n {children}\n {badge}\n </Box>\n {!!secondaryText && (\n <Text as=\"span\" textStyle=\"body/md/regular\" color={rest.disabled ? 'text/on-disabled' : 'text/secondary'}>\n {secondaryText}\n </Text>\n )}\n </Box>\n {icon}\n </>\n )}\n </Tabs.Trigger>\n );\n});\n\nTrigger.displayName = 'BitkitTabs.Trigger';\n\ntype TabItem = ReactElement<BitkitTabsTriggerProps>;\n\n// Returns the set of visible tab indices for the overflow, always keeping the selected tab\n// visible: if it would overflow, it takes the last visible slot.\nconst getVisibleIndices = (total: number, count: number, selectedIndex: number) => {\n const visible = new Set<number>();\n for (let i = 0; i < count; i += 1) visible.add(i);\n if (selectedIndex >= 0 && selectedIndex < total && !visible.has(selectedIndex)) {\n visible.delete(count - 1);\n visible.add(selectedIndex);\n }\n return visible;\n};\n\nexport type BitkitTabsAddButtonProps = Omit<\n Extract<BitkitControlButtonProps, { href?: undefined }>,\n 'icon' | 'label' | 'size'\n> & {\n /** Accessible label / tooltip for the add button. */\n label?: string;\n};\n\n// \"+\" button to add a tab. Place it as a child of `List`; it always renders at the end of the row\n// (after the overflow menu). A compact `xxs` control button (16px icon, 4px padding) per the design.\nconst AddButton = forwardRef<HTMLButtonElement, BitkitTabsAddButtonProps>((props, ref) => {\n const { label = 'Add tab', ...rest } = props;\n return <BitkitControlButton ref={ref} icon={IconPlus} label={label} size=\"xxs\" {...rest} />;\n});\n\nAddButton.displayName = 'BitkitTabs.AddButton';\n\n// A stretched trigger (line tabs on mobile, or a consumer's own `flex`/`width`) is as wide as\n// its share of the list, not its content, so its laid-out width would count the free space as\n// needed space. Measure it unstretched, and unrounded: two 163.5px tabs read as 164 + 164 through\n// `offsetWidth` and overflow a 327px row.\n// The whole inline style is restored, because resetting the `flex` shorthand would also wipe any\n// inline flex longhands the consumer set.\nconst measureContentWidth = (node: HTMLElement) => {\n const { cssText } = node.style;\n node.style.flex = '0 0 auto';\n node.style.width = 'max-content';\n const contentWidth = node.getBoundingClientRect().width;\n node.style.cssText = cssText;\n return contentWidth;\n};\n\n// Overflow-aware List (all variants): measures the tabs and collapses the overflowing ones into a\n// \"N more…\" menu. The more-button look comes from the variant's `moreTrigger` recipe slot.\nconst List = forwardRef<HTMLDivElement, Tabs.ListProps>((props, ref) => {\n // Semantic/labelling attributes belong on the actual tablist, not the visual wrapper.\n const { children, css, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, ...rest } = props;\n const { size = 'lg', variant = 'line' } = useRootPropsContext();\n const api = useTabsContext();\n const styles = useTabsStyles();\n const isCompact = isCompactTabs(variant, size);\n\n // Split children: tab triggers participate in overflow; the optional add button always renders last.\n const allChildren = flattenChildren(children);\n const addButton = allChildren.find((child) => child.type === AddButton) ?? null;\n // Only Trigger elements are measured/overflowed; anything else (fragments, stray nodes) is ignored.\n const items = allChildren.filter((child) => child.type === Trigger) as TabItem[];\n // Re-measure whenever the tab set OR any width-affecting input changes: the variant and size, each\n // tab's value/label, icon/status/close/disabled state, and the text of its badge and secondaryText,\n // so a count going from 3 to 12 invalidates the cache.\n const measureKey = [\n variant,\n size,\n ...items.map((item) => {\n const p = item.props;\n return [\n p.value,\n String(p.children),\n p.icon ? 'i' : '',\n getTextContent(p.badge),\n getTextContent(p.secondaryText),\n p.statusColor ?? '',\n p.onClose ? 'c' : '',\n p.disabled ? 'd' : '',\n ].join(':');\n }),\n ].join('|');\n const selectedIndex = items.findIndex((item) => item.props.value === api.value);\n // Width reservations for the more button, sized for a two-digit count (\"10 more…\"), and for the\n // always-visible add button. Any slack here hides a tab that would have fitted.\n const moreReserve = isCompact ? 88 : 104;\n const addReserve = addButton ? 48 : 0;\n\n const listRef = useRef<HTMLDivElement | null>(null);\n const widthsRef = useRef<number[]>([]);\n // Horizontal padding of the list, cached during the measure pass so the resize hot path doesn't\n // call getComputedStyle on every tick.\n const paddingRef = useRef(0);\n // `measuredKey` is state (not a ref) so finishing the measure pass always re-renders and flips\n // `measuring` off — even when recompute keeps the same visibleCount (which would skip a re-render).\n const [measuredKey, setMeasuredKey] = useState<string | null>(null);\n const [visibleCount, setVisibleCount] = useState(items.length);\n\n const setListRef = useMemo(() => mergeRefs(listRef, ref), [ref]);\n\n const recompute = useCallback(() => {\n const el = listRef.current;\n const widths = widthsRef.current;\n if (!el || !widths.length) return;\n const available = el.clientWidth - paddingRef.current - addReserve;\n const totalWidth = widths.reduce((sum, w) => sum + w, 0);\n if (totalWidth <= available) {\n setVisibleCount(widths.length);\n return;\n }\n let used = moreReserve;\n let count = 0;\n for (let i = 0; i < widths.length; i += 1) {\n if (used + widths[i] > available) break;\n used += widths[i];\n count += 1;\n }\n setVisibleCount(Math.max(count, 1));\n }, [addReserve, moreReserve]);\n\n // Measure once per width-affecting change (all tabs are rendered visible during this pass).\n // Isomorphic layout effect: avoids the SSR \"useLayoutEffect does nothing on the server\" warning.\n const measuring = measuredKey !== measureKey;\n useSafeLayoutEffect(() => {\n const el = listRef.current;\n if (!el) return;\n if (measuredKey !== measureKey) {\n const tabEls = el.querySelectorAll<HTMLElement>('[data-tab-trigger]');\n widthsRef.current = Array.from(tabEls, measureContentWidth);\n const cs = getComputedStyle(el);\n paddingRef.current = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight);\n setMeasuredKey(measureKey);\n }\n recompute();\n }, [measureKey, measuredKey, recompute]);\n\n // Swapping the fallback font for the webfont changes the tabs' widths without resizing the list,\n // so no ResizeObserver fires for it: measure again once the fonts are in.\n useEffect(() => {\n let cancelled = false;\n void document.fonts?.ready.then(() => {\n if (!cancelled) setMeasuredKey(null);\n });\n return () => {\n cancelled = true;\n };\n }, []);\n\n useEffect(() => {\n const el = listRef.current;\n if (!el || typeof ResizeObserver === 'undefined') return;\n // Coalesce resize bursts into one recompute per frame to avoid a read/write layout storm.\n let raf = 0;\n const observer = new ResizeObserver(() => {\n cancelAnimationFrame(raf);\n raf = requestAnimationFrame(recompute);\n });\n observer.observe(el);\n return () => {\n cancelAnimationFrame(raf);\n observer.disconnect();\n };\n }, [recompute]);\n\n const showAll = measuring || visibleCount >= items.length;\n const visible = showAll ? null : getVisibleIndices(items.length, visibleCount, selectedIndex);\n const hiddenItems = visible ? items.filter((_, i) => !visible.has(i)) : [];\n\n return (\n // The visual row carries the list styling (background, baseline border, leading padding) and is\n // measured for overflow. The tablist itself only wraps the tabs (`display: contents` keeps the\n // flex layout intact), so the more/add controls stay outside `role=\"tablist\"` per the ARIA spec.\n <Box ref={setListRef} css={[styles.list, css]} data-overflowing={hiddenItems.length > 0 ? '' : undefined} {...rest}>\n <Tabs.List display=\"contents\" id={id} aria-label={ariaLabel} aria-labelledby={ariaLabelledby}>\n {items.map((item, i) =>\n cloneElement(item, {\n key: item.props.value,\n 'data-tab-trigger': '',\n hidden: visible ? !visible.has(i) : undefined,\n } as Partial<BitkitTabsTriggerProps>),\n )}\n </Tabs.List>\n {hiddenItems.length > 0 && (\n <Menu.Root size={isCompact ? 'md' : 'lg'} positioning={{ gutter: 0, shift: -4 }}>\n <Menu.Trigger asChild>\n <chakra.button type=\"button\" css={styles.moreTrigger}>\n {hiddenItems.length} more…\n </chakra.button>\n </Menu.Trigger>\n <Portal>\n <Menu.Positioner>\n <Menu.Content>\n {hiddenItems.map((item) => (\n <Menu.Item\n key={item.props.value}\n value={item.props.value}\n disabled={item.props.disabled}\n onSelect={() => api.setValue(item.props.value)}\n alignItems=\"center\"\n >\n <Text flex=\"1\" color={item.props.disabled ? 'text/on-disabled' : 'inherit'}>\n {item.props.children}\n </Text>\n {variant === 'canvas' && item.props.statusColor && (\n <chakra.span\n boxSize=\"8\"\n borderRadius=\"full\"\n flexShrink={0}\n backgroundColor={STATUS_COLOR_TOKEN[item.props.statusColor]}\n />\n )}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu.Positioner>\n </Portal>\n </Menu.Root>\n )}\n {addButton && (\n <Box display=\"flex\" alignItems=\"center\" flexShrink={0} paddingInline=\"8\">\n {addButton}\n </Box>\n )}\n </Box>\n );\n});\n\nList.displayName = 'BitkitTabs.List';\n\nconst BitkitTabs: Omit<typeof Tabs, 'Root' | 'Trigger' | 'List'> & {\n AddButton: typeof AddButton;\n List: typeof List;\n Root: typeof Root;\n Trigger: typeof Trigger;\n} = {\n ...Tabs,\n AddButton,\n List,\n Root,\n Trigger,\n};\n\nBitkitTabs.Content.displayName = 'BitkitTabs.Content';\nBitkitTabs.ContentGroup.displayName = 'BitkitTabs.ContentGroup';\nBitkitTabs.Root.displayName = 'BitkitTabs.Root';\n\nexport default BitkitTabs;\n"],"mappings":";;;;;;;;;;;;;;;AAqCA,IAAa,CAAC,mBAAmB,uBAAuB,gBAAmC;CACzF,MAAM;CACN,UAAU;CACV,cAAc;AAChB,CAAC;AAED,IAAM,OAAO,YAAiD,OAAO,QAAQ;CAC3E,OACE,oBAAC,mBAAD;EAAmB,OAAO;EACxB,UAAA,oBAAC,KAAK,MAAN;GAAgB;GAAK,GAAI;EAAQ,CAAA;CAChB,CAAA;AAEvB,CAAC;AAKD,IAAM,qBAA4D;CAChE,SAAS;CACT,QAAQ;CACR,KAAK;CACL,QAAQ;AACV;AAwBA,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E,SAAQ;MACR,cAAa;MACb,YAAY;MACZ,iBAAiB,mBAAmB,KAAK,MAAM;KAChD,CAAA,CAEM;IAjBJ,GAAA,KAAK,MAAM,KAiBP,CACZ,EACW,CAAA,EACC,CAAA,EACX,CAAA,CACC;;GAEZ,aACC,oBAAC,KAAD;IAAK,SAAQ;IAAO,YAAW;IAAS,YAAY;IAAG,eAAc;IAClE,UAAA;GACE,CAAA;EAEJ;;AAET,CAAC;AAED,KAAK,cAAc;AAEnB,IAAM,aAKF;CACF,GAAG;CACH;CACA;CACA;CACA;AACF;AAEA,WAAW,QAAQ,cAAc;AACjC,WAAW,aAAa,cAAc;AACtC,WAAW,KAAK,cAAc"}
@@ -83,7 +83,7 @@ export { type BitkitRowAction, type BitkitRowActionsCellProps } from './BitkitTa
83
83
  export { type BitkitSortableColumnHeaderProps } from './BitkitTable/BitkitSortableColumnHeader';
84
84
  export { default as BitkitTable } from './BitkitTable/BitkitTable';
85
85
  export { default as BitkitTableCard, type BitkitTableCardProps } from './BitkitTableCard/BitkitTableCard';
86
- export { default as BitkitTabs } from './BitkitTabs/BitkitTabs';
86
+ export { default as BitkitTabs, type BitkitTabsAddButtonProps, type BitkitTabsRootProps, type BitkitTabsStatusColor, type BitkitTabsTriggerProps, } from './BitkitTabs/BitkitTabs';
87
87
  export { default as BitkitTag, type BitkitTagProps } from './BitkitTag/BitkitTag';
88
88
  export { default as BitkitTagsInput, type BitkitTagsInputProps } from './BitkitTagsInput/BitkitTagsInput';
89
89
  export { default as BitkitTextArea, type BitkitTextAreaProps } from './BitkitTextArea/BitkitTextArea';
@@ -15,7 +15,7 @@ declare const settingsCardSlotRecipe: import('@chakra-ui/react').SlotRecipeDefin
15
15
  };
16
16
  'in-progress': {
17
17
  statusIcon: {
18
- color: "color/yellow/bold";
18
+ color: "icon/warning";
19
19
  };
20
20
  };
21
21
  neutral: {
@@ -81,7 +81,7 @@ var settingsCardSlotRecipe = defineSlotRecipe({
81
81
  statusLabel: { color: "text/negative" }
82
82
  },
83
83
  failed: { statusIcon: { color: "icon/negative" } },
84
- "in-progress": { statusIcon: { color: "color/yellow/bold" } },
84
+ "in-progress": { statusIcon: { color: "icon/warning" } },
85
85
  neutral: { statusIcon: { color: "icon/secondary" } },
86
86
  success: { statusIcon: { color: "icon/positive" } },
87
87
  warning: {}
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsCard.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/SettingsCard.recipe.ts"],"sourcesContent":["import { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nimport { rem } from '../themeUtils';\n\nconst settingsCardSlotRecipe = defineSlotRecipe({\n className: 'settings-card',\n slots: [\n 'root',\n 'content',\n 'contentBody',\n 'contentActions',\n 'footer',\n 'status',\n 'statusIcon',\n 'statusLabel',\n 'statusMessage',\n 'statusMessageText',\n 'statusHelperText',\n ],\n base: {\n root: {\n maxWidth: rem(800),\n },\n content: {\n alignItems: 'center',\n display: 'flex',\n gap: '12',\n },\n contentBody: {\n flex: 1,\n minWidth: 0,\n },\n contentActions: {\n alignItems: 'center',\n display: 'flex',\n flexShrink: 0,\n gap: '8',\n },\n footer: {\n alignItems: 'center',\n display: 'flex',\n gap: '12',\n justifyContent: 'space-between',\n // The switch footer is drawn on a wider gap than the status one.\n '&:has([data-scope=\"switch\"][data-part=\"root\"])': {\n gap: '16',\n },\n // A status message wraps to more than one line: the design gives that footer a deeper bottom\n // padding than the single-line one the Card recipe sets, and keeps the trailing action level\n // with the status row rather than centred against the whole block.\n '&:has([data-slot=\"status-message\"])': {\n alignItems: 'flex-start',\n paddingBlockEnd: '12',\n },\n },\n status: {\n // Not `center`: the icon lines up with the first line of the label, which is where it still\n // belongs once the label wraps.\n alignItems: 'flex-start',\n display: 'flex',\n gap: '4',\n minWidth: 0,\n paddingBlock: '2',\n },\n statusIcon: {\n flexShrink: 0,\n marginBlockStart: '2',\n },\n statusLabel: {\n color: 'text/body',\n textStyle: 'body/md/regular',\n wordBreak: 'break-word',\n },\n statusMessage: {\n minWidth: 0,\n },\n statusMessageText: {\n color: 'text/body',\n paddingInlineStart: '20',\n textStyle: 'body/sm/regular',\n wordBreak: 'break-word',\n },\n statusHelperText: {\n color: 'text/helper',\n marginBlockStart: '8',\n paddingInlineStart: '20',\n textStyle: 'body/sm/regular',\n wordBreak: 'break-word',\n },\n },\n variants: {\n status: {\n error: {\n statusIcon: { color: 'icon/negative' },\n statusLabel: { color: 'text/negative' },\n },\n failed: {\n statusIcon: { color: 'icon/negative' },\n },\n 'in-progress': {\n statusIcon: { color: 'color/yellow/bold' },\n },\n neutral: {\n statusIcon: { color: 'icon/secondary' },\n },\n success: {\n statusIcon: { color: 'icon/positive' },\n },\n // No colour on purpose: IconWarningYellow carries its own fixed colours, and CLAUDE.md says a\n // fixed-colour icon is never recoloured. Setting one here would only reach an icon swapped in\n // via `icon`, and would put a second yellow on the same status.\n warning: {},\n },\n },\n defaultVariants: {\n status: 'neutral',\n },\n});\n\nexport default settingsCardSlotRecipe;\n"],"mappings":";;;AAIA,IAAM,yBAAyB,iBAAiB;CAC9C,WAAW;CACX,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,MAAM;EACJ,MAAM,EACJ,UAAU,IAAI,GAAG,EACnB;EACA,SAAS;GACP,YAAY;GACZ,SAAS;GACT,KAAK;EACP;EACA,aAAa;GACX,MAAM;GACN,UAAU;EACZ;EACA,gBAAgB;GACd,YAAY;GACZ,SAAS;GACT,YAAY;GACZ,KAAK;EACP;EACA,QAAQ;GACN,YAAY;GACZ,SAAS;GACT,KAAK;GACL,gBAAgB;GAEhB,sDAAkD,EAChD,KAAK,KACP;GAIA,yCAAuC;IACrC,YAAY;IACZ,iBAAiB;GACnB;EACF;EACA,QAAQ;GAGN,YAAY;GACZ,SAAS;GACT,KAAK;GACL,UAAU;GACV,cAAc;EAChB;EACA,YAAY;GACV,YAAY;GACZ,kBAAkB;EACpB;EACA,aAAa;GACX,OAAO;GACP,WAAW;GACX,WAAW;EACb;EACA,eAAe,EACb,UAAU,EACZ;EACA,mBAAmB;GACjB,OAAO;GACP,oBAAoB;GACpB,WAAW;GACX,WAAW;EACb;EACA,kBAAkB;GAChB,OAAO;GACP,kBAAkB;GAClB,oBAAoB;GACpB,WAAW;GACX,WAAW;EACb;CACF;CACA,UAAU,EACR,QAAQ;EACN,OAAO;GACL,YAAY,EAAE,OAAO,gBAAgB;GACrC,aAAa,EAAE,OAAO,gBAAgB;EACxC;EACA,QAAQ,EACN,YAAY,EAAE,OAAO,gBAAgB,EACvC;EACA,eAAe,EACb,YAAY,EAAE,OAAO,oBAAoB,EAC3C;EACA,SAAS,EACP,YAAY,EAAE,OAAO,iBAAiB,EACxC;EACA,SAAS,EACP,YAAY,EAAE,OAAO,gBAAgB,EACvC;EAIA,SAAS,CAAC;CACZ,EACF;CACA,iBAAiB,EACf,QAAQ,UACV;AACF,CAAC"}
1
+ {"version":3,"file":"SettingsCard.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/SettingsCard.recipe.ts"],"sourcesContent":["import { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nimport { rem } from '../themeUtils';\n\nconst settingsCardSlotRecipe = defineSlotRecipe({\n className: 'settings-card',\n slots: [\n 'root',\n 'content',\n 'contentBody',\n 'contentActions',\n 'footer',\n 'status',\n 'statusIcon',\n 'statusLabel',\n 'statusMessage',\n 'statusMessageText',\n 'statusHelperText',\n ],\n base: {\n root: {\n maxWidth: rem(800),\n },\n content: {\n alignItems: 'center',\n display: 'flex',\n gap: '12',\n },\n contentBody: {\n flex: 1,\n minWidth: 0,\n },\n contentActions: {\n alignItems: 'center',\n display: 'flex',\n flexShrink: 0,\n gap: '8',\n },\n footer: {\n alignItems: 'center',\n display: 'flex',\n gap: '12',\n justifyContent: 'space-between',\n // The switch footer is drawn on a wider gap than the status one.\n '&:has([data-scope=\"switch\"][data-part=\"root\"])': {\n gap: '16',\n },\n // A status message wraps to more than one line: the design gives that footer a deeper bottom\n // padding than the single-line one the Card recipe sets, and keeps the trailing action level\n // with the status row rather than centred against the whole block.\n '&:has([data-slot=\"status-message\"])': {\n alignItems: 'flex-start',\n paddingBlockEnd: '12',\n },\n },\n status: {\n // Not `center`: the icon lines up with the first line of the label, which is where it still\n // belongs once the label wraps.\n alignItems: 'flex-start',\n display: 'flex',\n gap: '4',\n minWidth: 0,\n paddingBlock: '2',\n },\n statusIcon: {\n flexShrink: 0,\n marginBlockStart: '2',\n },\n statusLabel: {\n color: 'text/body',\n textStyle: 'body/md/regular',\n wordBreak: 'break-word',\n },\n statusMessage: {\n minWidth: 0,\n },\n statusMessageText: {\n color: 'text/body',\n paddingInlineStart: '20',\n textStyle: 'body/sm/regular',\n wordBreak: 'break-word',\n },\n statusHelperText: {\n color: 'text/helper',\n marginBlockStart: '8',\n paddingInlineStart: '20',\n textStyle: 'body/sm/regular',\n wordBreak: 'break-word',\n },\n },\n variants: {\n status: {\n error: {\n statusIcon: { color: 'icon/negative' },\n statusLabel: { color: 'text/negative' },\n },\n failed: {\n statusIcon: { color: 'icon/negative' },\n },\n 'in-progress': {\n statusIcon: { color: 'icon/warning' },\n },\n neutral: {\n statusIcon: { color: 'icon/secondary' },\n },\n success: {\n statusIcon: { color: 'icon/positive' },\n },\n // No colour on purpose: IconWarningYellow carries its own fixed colours, and CLAUDE.md says a\n // fixed-colour icon is never recoloured. Setting one here would only reach an icon swapped in\n // via `icon`, and would put a second yellow on the same status.\n warning: {},\n },\n },\n defaultVariants: {\n status: 'neutral',\n },\n});\n\nexport default settingsCardSlotRecipe;\n"],"mappings":";;;AAIA,IAAM,yBAAyB,iBAAiB;CAC9C,WAAW;CACX,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,MAAM;EACJ,MAAM,EACJ,UAAU,IAAI,GAAG,EACnB;EACA,SAAS;GACP,YAAY;GACZ,SAAS;GACT,KAAK;EACP;EACA,aAAa;GACX,MAAM;GACN,UAAU;EACZ;EACA,gBAAgB;GACd,YAAY;GACZ,SAAS;GACT,YAAY;GACZ,KAAK;EACP;EACA,QAAQ;GACN,YAAY;GACZ,SAAS;GACT,KAAK;GACL,gBAAgB;GAEhB,sDAAkD,EAChD,KAAK,KACP;GAIA,yCAAuC;IACrC,YAAY;IACZ,iBAAiB;GACnB;EACF;EACA,QAAQ;GAGN,YAAY;GACZ,SAAS;GACT,KAAK;GACL,UAAU;GACV,cAAc;EAChB;EACA,YAAY;GACV,YAAY;GACZ,kBAAkB;EACpB;EACA,aAAa;GACX,OAAO;GACP,WAAW;GACX,WAAW;EACb;EACA,eAAe,EACb,UAAU,EACZ;EACA,mBAAmB;GACjB,OAAO;GACP,oBAAoB;GACpB,WAAW;GACX,WAAW;EACb;EACA,kBAAkB;GAChB,OAAO;GACP,kBAAkB;GAClB,oBAAoB;GACpB,WAAW;GACX,WAAW;EACb;CACF;CACA,UAAU,EACR,QAAQ;EACN,OAAO;GACL,YAAY,EAAE,OAAO,gBAAgB;GACrC,aAAa,EAAE,OAAO,gBAAgB;EACxC;EACA,QAAQ,EACN,YAAY,EAAE,OAAO,gBAAgB,EACvC;EACA,eAAe,EACb,YAAY,EAAE,OAAO,eAAe,EACtC;EACA,SAAS,EACP,YAAY,EAAE,OAAO,iBAAiB,EACxC;EACA,SAAS,EACP,YAAY,EAAE,OAAO,gBAAgB,EACvC;EAIA,SAAS,CAAC;CACZ,EACF;CACA,iBAAiB,EACf,QAAQ,UACV;AACF,CAAC"}