@bitrise/bitkit-v2 0.3.518-beta.3311 → 0.3.519
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.
|
@@ -25,22 +25,29 @@ var variantStyles = [
|
|
|
25
25
|
color: isSecondary ? "button/secondary/text-active" : `button/${variant}/fg-active`,
|
|
26
26
|
_icon: { color: isSecondary ? "button/secondary/icon-active" : void 0 }
|
|
27
27
|
};
|
|
28
|
+
const disabledStyles = {
|
|
29
|
+
backgroundColor: `button/${variant}/bg-disabled`,
|
|
30
|
+
borderColor: disabledBorderColor,
|
|
31
|
+
color: isSecondary ? "button/secondary/text-disabled" : `button/${variant}/fg-disabled`,
|
|
32
|
+
cursor: "not-allowed",
|
|
33
|
+
_icon: { color: isSecondary ? "button/secondary/icon-disabled" : void 0 }
|
|
34
|
+
};
|
|
35
|
+
const expandedStyles = {
|
|
36
|
+
...activeStyles,
|
|
37
|
+
_disabled: disabledStyles
|
|
38
|
+
};
|
|
28
39
|
obj[variant] = {
|
|
29
40
|
_hover: {
|
|
30
41
|
backgroundColor: `button/${variant}/bg-hover`,
|
|
31
42
|
borderColor: variant?.includes("secondary") ? `button/${variant}/border-hover` : `button/${variant}/bg-hover`,
|
|
32
43
|
color: isSecondary ? "button/secondary/text-hover" : `button/${variant}/fg-hover`,
|
|
33
44
|
_icon: { color: isSecondary ? "button/secondary/icon-hover" : void 0 },
|
|
34
|
-
_active: activeStyles
|
|
45
|
+
_active: activeStyles,
|
|
46
|
+
_expanded: expandedStyles
|
|
35
47
|
},
|
|
36
48
|
_active: activeStyles,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
borderColor: disabledBorderColor,
|
|
40
|
-
color: isSecondary ? "button/secondary/text-disabled" : `button/${variant}/fg-disabled`,
|
|
41
|
-
cursor: "not-allowed",
|
|
42
|
-
_icon: { color: isSecondary ? "button/secondary/icon-disabled" : void 0 }
|
|
43
|
-
},
|
|
49
|
+
_expanded: expandedStyles,
|
|
50
|
+
_disabled: disabledStyles,
|
|
44
51
|
_icon: { color: isSecondary ? "button/secondary/icon" : void 0 },
|
|
45
52
|
backgroundColor: `button/${variant}/bg`,
|
|
46
53
|
borderColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.recipe.js","names":[],"sources":["../../../lib/theme/recipes/Button.recipe.ts"],"sourcesContent":["import { defineRecipe, type SystemStyleObject } from '@chakra-ui/react/styled-system';\n\nimport { rem } from '../themeUtils';\n\n// `as const` is load-bearing: without it `(typeof buttonVariants)[number]` widens to `string`,\n// which collapses the recipe's `variant` prop type to `string` — losing TS autocomplete/checking\n// and leaving Storybook/docgen (and the bitkit-storybook MCP) unable to enumerate the variants.\nconst buttonVariants = [\n 'primary',\n 'secondary',\n 'tertiary',\n 'danger-primary',\n 'danger-secondary',\n 'danger-tertiary',\n 'ai-primary',\n 'ai-secondary',\n 'ai-tertiary',\n] as const;\n\nexport type Variant = (typeof buttonVariants)[number];\n\nconst variantStyles = buttonVariants.reduce(\n (obj, variant) => {\n let borderColor = variant?.includes('secondary') ? `button/${variant}/border` : `button/${variant}/bg`;\n let disabledBorderColor = variant?.includes('secondary')\n ? `button/${variant}/border-disabled`\n : `button/${variant}/bg-disabled`;\n if (variant?.includes('tertiary')) {\n borderColor = 'transparent';\n disabledBorderColor = 'transparent';\n }\n const isSecondary = variant === 'secondary';\n const activeStyles: SystemStyleObject = {\n backgroundColor: `button/${variant}/bg-active`,\n borderColor: variant?.includes('secondary') ? `button/${variant}/border-active` : `button/${variant}/bg-active`,\n color: isSecondary ? 'button/secondary/text-active' : `button/${variant}/fg-active`,\n _icon: {\n color: isSecondary ? 'button/secondary/icon-active' : undefined,\n },\n };\n obj[variant as NonNullable<Variant>] = {\n // `_hover`/`_active` (not raw `&:hover`/`&:active`) compile to `:not(:disabled, [data-disabled])`,\n // so they never match a disabled button — the `_disabled` styles win naturally, no `!important` needed.\n _hover: {\n backgroundColor: `button/${variant}/bg-hover`,\n borderColor: variant?.includes('secondary') ? `button/${variant}/border-hover` : `button/${variant}/bg-hover`,\n color: isSecondary ? 'button/secondary/text-hover' : `button/${variant}/fg-hover`,\n _icon: {\n color: isSecondary ? 'button/secondary/icon-hover' : undefined,\n },\n // Repeat active under hover so
|
|
1
|
+
{"version":3,"file":"Button.recipe.js","names":[],"sources":["../../../lib/theme/recipes/Button.recipe.ts"],"sourcesContent":["import { defineRecipe, type SystemStyleObject } from '@chakra-ui/react/styled-system';\n\nimport { rem } from '../themeUtils';\n\n// `as const` is load-bearing: without it `(typeof buttonVariants)[number]` widens to `string`,\n// which collapses the recipe's `variant` prop type to `string` — losing TS autocomplete/checking\n// and leaving Storybook/docgen (and the bitkit-storybook MCP) unable to enumerate the variants.\nconst buttonVariants = [\n 'primary',\n 'secondary',\n 'tertiary',\n 'danger-primary',\n 'danger-secondary',\n 'danger-tertiary',\n 'ai-primary',\n 'ai-secondary',\n 'ai-tertiary',\n] as const;\n\nexport type Variant = (typeof buttonVariants)[number];\n\nconst variantStyles = buttonVariants.reduce(\n (obj, variant) => {\n let borderColor = variant?.includes('secondary') ? `button/${variant}/border` : `button/${variant}/bg`;\n let disabledBorderColor = variant?.includes('secondary')\n ? `button/${variant}/border-disabled`\n : `button/${variant}/bg-disabled`;\n if (variant?.includes('tertiary')) {\n borderColor = 'transparent';\n disabledBorderColor = 'transparent';\n }\n const isSecondary = variant === 'secondary';\n const activeStyles: SystemStyleObject = {\n backgroundColor: `button/${variant}/bg-active`,\n borderColor: variant?.includes('secondary') ? `button/${variant}/border-active` : `button/${variant}/bg-active`,\n color: isSecondary ? 'button/secondary/text-active' : `button/${variant}/fg-active`,\n _icon: {\n color: isSecondary ? 'button/secondary/icon-active' : undefined,\n },\n };\n const disabledStyles: SystemStyleObject = {\n backgroundColor: `button/${variant}/bg-disabled`,\n borderColor: disabledBorderColor,\n color: isSecondary ? 'button/secondary/text-disabled' : `button/${variant}/fg-disabled`,\n cursor: 'not-allowed',\n _icon: {\n color: isSecondary ? 'button/secondary/icon-disabled' : undefined,\n },\n };\n // A menu or popover trigger stays active while its content is open. `_expanded` (aria-expanded), not\n // `_open`: a tooltip trigger gets `data-state=open` too. It has no disabled guard, and Zag keeps an\n // open menu open when its trigger turns disabled, so the disabled styles are repeated inside.\n const expandedStyles: SystemStyleObject = { ...activeStyles, _disabled: disabledStyles };\n obj[variant as NonNullable<Variant>] = {\n // `_hover`/`_active` (not raw `&:hover`/`&:active`) compile to `:not(:disabled, [data-disabled])`,\n // so they never match a disabled button — the `_disabled` styles win naturally, no `!important` needed.\n _hover: {\n backgroundColor: `button/${variant}/bg-hover`,\n borderColor: variant?.includes('secondary') ? `button/${variant}/border-hover` : `button/${variant}/bg-hover`,\n color: isSecondary ? 'button/secondary/text-hover' : `button/${variant}/fg-hover`,\n _icon: {\n color: isSecondary ? 'button/secondary/icon-hover' : undefined,\n },\n // Repeat active and expanded under hover so the pointer doesn't override them (see CLAUDE.md).\n _active: activeStyles,\n _expanded: expandedStyles,\n },\n _active: activeStyles,\n _expanded: expandedStyles,\n _disabled: disabledStyles,\n _icon: {\n color: isSecondary ? 'button/secondary/icon' : undefined,\n },\n backgroundColor: `button/${variant}/bg`,\n borderColor,\n borderStyle: 'solid',\n borderWidth: '1',\n color: isSecondary ? 'button/secondary/text' : `button/${variant}/fg`,\n };\n return obj;\n },\n {} as Record<NonNullable<Variant>, SystemStyleObject>,\n);\n\nconst buttonRecipe = defineRecipe({\n className: 'button',\n base: {\n borderRadius: '4',\n cursor: 'pointer',\n fontWeight: 600,\n border: '1px solid transparent',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: '8',\n position: 'relative',\n '--spinner-color': 'currentColor',\n '--spinner-size': 'sizes.16',\n _disabled: {\n cursor: 'not-allowed',\n },\n },\n variants: {\n variant: variantStyles,\n size: {\n sm: {\n minWidth: '32',\n height: '32',\n paddingInline: rem(11),\n paddingBlock: rem(5),\n textStyle: 'comp/button/sm',\n },\n md: {\n minWidth: '40',\n height: '40',\n paddingInline: rem(15),\n paddingBlock: rem(7),\n textStyle: 'comp/button/md',\n },\n lg: {\n minWidth: '48',\n height: '48',\n padding: rem(15),\n textStyle: 'comp/button/lg',\n },\n },\n },\n defaultVariants: {\n variant: 'primary',\n size: 'lg',\n },\n});\n\nexport default buttonRecipe;\n"],"mappings":";;;AAqBA,IAAM,gBAAgB;CAbpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAKoB,CAAA,CAAe,QAClC,KAAK,YAAY;CAChB,IAAI,cAAc,SAAS,SAAS,WAAW,IAAI,UAAU,QAAQ,WAAW,UAAU,QAAQ;CAClG,IAAI,sBAAsB,SAAS,SAAS,WAAW,IACnD,UAAU,QAAQ,oBAClB,UAAU,QAAQ;CACtB,IAAI,SAAS,SAAS,UAAU,GAAG;EACjC,cAAc;EACd,sBAAsB;CACxB;CACA,MAAM,cAAc,YAAY;CAChC,MAAM,eAAkC;EACtC,iBAAiB,UAAU,QAAQ;EACnC,aAAa,SAAS,SAAS,WAAW,IAAI,UAAU,QAAQ,kBAAkB,UAAU,QAAQ;EACpG,OAAO,cAAc,iCAAiC,UAAU,QAAQ;EACxE,OAAO,EACL,OAAO,cAAc,iCAAiC,KAAA,EACxD;CACF;CACA,MAAM,iBAAoC;EACxC,iBAAiB,UAAU,QAAQ;EACnC,aAAa;EACb,OAAO,cAAc,mCAAmC,UAAU,QAAQ;EAC1E,QAAQ;EACR,OAAO,EACL,OAAO,cAAc,mCAAmC,KAAA,EAC1D;CACF;CAIA,MAAM,iBAAoC;EAAE,GAAG;EAAc,WAAW;CAAe;CACvF,IAAI,WAAmC;EAGrC,QAAQ;GACN,iBAAiB,UAAU,QAAQ;GACnC,aAAa,SAAS,SAAS,WAAW,IAAI,UAAU,QAAQ,iBAAiB,UAAU,QAAQ;GACnG,OAAO,cAAc,gCAAgC,UAAU,QAAQ;GACvE,OAAO,EACL,OAAO,cAAc,gCAAgC,KAAA,EACvD;GAEA,SAAS;GACT,WAAW;EACb;EACA,SA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