@bergetai/ui 0.16.2 → 0.18.0

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.
Files changed (118) hide show
  1. package/dist/components/alert/Alert.d.cts +1 -1
  2. package/dist/components/alert/Alert.d.mts +1 -1
  3. package/dist/components/badge/Badge.d.cts +1 -1
  4. package/dist/components/badge/Badge.d.mts +1 -1
  5. package/dist/components/box/Box.d.cts +2 -2
  6. package/dist/components/box/Box.d.mts +2 -2
  7. package/dist/components/button/Button.cjs +21 -4
  8. package/dist/components/button/Button.cjs.map +1 -1
  9. package/dist/components/button/Button.d.cts +2 -1
  10. package/dist/components/button/Button.d.cts.map +1 -1
  11. package/dist/components/button/Button.d.mts +2 -1
  12. package/dist/components/button/Button.d.mts.map +1 -1
  13. package/dist/components/button/Button.mjs +19 -5
  14. package/dist/components/button/Button.mjs.map +1 -1
  15. package/dist/components/button/anchorVariants.cjs +56 -0
  16. package/dist/components/button/anchorVariants.cjs.map +1 -0
  17. package/dist/components/button/anchorVariants.d.cts +45 -0
  18. package/dist/components/button/anchorVariants.d.cts.map +1 -0
  19. package/dist/components/button/anchorVariants.d.mts +45 -0
  20. package/dist/components/button/anchorVariants.d.mts.map +1 -0
  21. package/dist/components/button/anchorVariants.mjs +55 -0
  22. package/dist/components/button/anchorVariants.mjs.map +1 -0
  23. package/dist/components/button/index.d.cts +2 -1
  24. package/dist/components/button/index.d.mts +2 -1
  25. package/dist/components/code-block/CodeBlock.cjs +50 -48
  26. package/dist/components/code-block/CodeBlock.cjs.map +1 -1
  27. package/dist/components/code-block/CodeBlock.d.cts +27 -7
  28. package/dist/components/code-block/CodeBlock.d.cts.map +1 -1
  29. package/dist/components/code-block/CodeBlock.d.mts +27 -7
  30. package/dist/components/code-block/CodeBlock.d.mts.map +1 -1
  31. package/dist/components/code-block/CodeBlock.mjs +45 -50
  32. package/dist/components/code-block/CodeBlock.mjs.map +1 -1
  33. package/dist/components/code-block/index.d.cts +3 -0
  34. package/dist/components/code-block/index.d.mts +3 -0
  35. package/dist/components/combobox/index.d.cts +2 -0
  36. package/dist/components/combobox/index.d.mts +2 -0
  37. package/dist/components/country-select/CountrySelect.cjs +1 -1
  38. package/dist/components/country-select/CountrySelect.mjs +1 -1
  39. package/dist/components/grid/Grid.d.cts +2 -2
  40. package/dist/components/grid/Grid.d.mts +2 -2
  41. package/dist/components/popover/index.d.cts +2 -0
  42. package/dist/components/popover/index.d.mts +2 -0
  43. package/dist/components/radio-group/index.d.cts +2 -0
  44. package/dist/components/radio-group/index.d.mts +2 -0
  45. package/dist/components/tabs/Tabs.cjs +109 -0
  46. package/dist/components/tabs/Tabs.cjs.map +1 -0
  47. package/dist/components/tabs/Tabs.d.cts +29 -0
  48. package/dist/components/tabs/Tabs.d.cts.map +1 -0
  49. package/dist/components/tabs/Tabs.d.mts +29 -0
  50. package/dist/components/tabs/Tabs.d.mts.map +1 -0
  51. package/dist/components/tabs/Tabs.mjs +103 -0
  52. package/dist/components/tabs/Tabs.mjs.map +1 -0
  53. package/dist/components/tabs/index.d.cts +2 -0
  54. package/dist/components/tabs/index.d.mts +2 -0
  55. package/dist/hooks/use-highlighted-code.cjs +58 -0
  56. package/dist/hooks/use-highlighted-code.cjs.map +1 -0
  57. package/dist/hooks/use-highlighted-code.d.cts +5 -0
  58. package/dist/hooks/use-highlighted-code.d.cts.map +1 -0
  59. package/dist/hooks/use-highlighted-code.d.mts +5 -0
  60. package/dist/hooks/use-highlighted-code.d.mts.map +1 -0
  61. package/dist/hooks/use-highlighted-code.mjs +56 -0
  62. package/dist/hooks/use-highlighted-code.mjs.map +1 -0
  63. package/dist/index.cjs +44 -0
  64. package/dist/index.d.cts +14 -2
  65. package/dist/index.d.mts +14 -2
  66. package/dist/index.mjs +9 -2
  67. package/dist/lib/highlighter.cjs +81 -0
  68. package/dist/lib/highlighter.cjs.map +1 -0
  69. package/dist/lib/highlighter.mjs +79 -0
  70. package/dist/lib/highlighter.mjs.map +1 -0
  71. package/dist/primitives/button.d.cts +1 -1
  72. package/dist/primitives/button.d.mts +1 -1
  73. package/dist/primitives/code-block.cjs +133 -0
  74. package/dist/primitives/code-block.cjs.map +1 -0
  75. package/dist/primitives/code-block.d.cts +29 -0
  76. package/dist/primitives/code-block.d.cts.map +1 -0
  77. package/dist/primitives/code-block.d.mts +29 -0
  78. package/dist/primitives/code-block.d.mts.map +1 -0
  79. package/dist/primitives/code-block.mjs +124 -0
  80. package/dist/primitives/code-block.mjs.map +1 -0
  81. package/dist/primitives/combobox.cjs +123 -0
  82. package/dist/primitives/combobox.cjs.map +1 -0
  83. package/dist/primitives/combobox.d.cts +25 -0
  84. package/dist/primitives/combobox.d.cts.map +1 -0
  85. package/dist/primitives/combobox.d.mts +25 -0
  86. package/dist/primitives/combobox.d.mts.map +1 -0
  87. package/dist/primitives/combobox.mjs +111 -0
  88. package/dist/primitives/combobox.mjs.map +1 -0
  89. package/dist/primitives/message-scroller.cjs +1 -1
  90. package/dist/primitives/message-scroller.mjs +1 -1
  91. package/dist/primitives/popover.cjs +24 -0
  92. package/dist/primitives/popover.cjs.map +1 -1
  93. package/dist/primitives/popover.d.cts +12 -0
  94. package/dist/primitives/popover.d.cts.map +1 -0
  95. package/dist/primitives/popover.d.mts +12 -0
  96. package/dist/primitives/popover.d.mts.map +1 -0
  97. package/dist/primitives/popover.mjs +22 -1
  98. package/dist/primitives/popover.mjs.map +1 -1
  99. package/dist/primitives/radio-group.cjs +23 -0
  100. package/dist/primitives/radio-group.cjs.map +1 -0
  101. package/dist/primitives/radio-group.d.cts +8 -0
  102. package/dist/primitives/radio-group.d.cts.map +1 -0
  103. package/dist/primitives/radio-group.d.mts +8 -0
  104. package/dist/primitives/radio-group.d.mts.map +1 -0
  105. package/dist/primitives/radio-group.mjs +22 -0
  106. package/dist/primitives/radio-group.mjs.map +1 -0
  107. package/dist/primitives/sidebar.cjs +1 -1
  108. package/dist/primitives/sidebar.mjs +1 -1
  109. package/dist/primitives/tabs.cjs +51 -0
  110. package/dist/primitives/tabs.cjs.map +1 -0
  111. package/dist/primitives/tabs.d.cts +11 -0
  112. package/dist/primitives/tabs.d.cts.map +1 -0
  113. package/dist/primitives/tabs.d.mts +11 -0
  114. package/dist/primitives/tabs.d.mts.map +1 -0
  115. package/dist/primitives/tabs.mjs +47 -0
  116. package/dist/primitives/tabs.mjs.map +1 -0
  117. package/dist/styles/index.css +61 -0
  118. package/package.json +2 -1
@@ -3,7 +3,7 @@ import * as React from "react";
3
3
  import { VariantProps } from "class-variance-authority";
4
4
  //#region src/components/alert/Alert.d.ts
5
5
  declare const alertVariants: (props?: ({
6
- variant?: "info" | "default" | "destructive" | "success" | "warning" | null | undefined;
6
+ variant?: "default" | "info" | "destructive" | "success" | "warning" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  export interface AlertProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {}
9
9
  declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
@@ -3,7 +3,7 @@ import * as React from "react";
3
3
  import { VariantProps } from "class-variance-authority";
4
4
  //#region src/components/alert/Alert.d.ts
5
5
  declare const alertVariants: (props?: ({
6
- variant?: "info" | "default" | "destructive" | "success" | "warning" | null | undefined;
6
+ variant?: "default" | "info" | "destructive" | "success" | "warning" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  export interface AlertProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {}
9
9
  declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
@@ -3,7 +3,7 @@ import { VariantProps } from "class-variance-authority";
3
3
  //#region src/components/badge/Badge.d.ts
4
4
  declare const badgeVariants: (props?: ({
5
5
  variant?: "default" | "tag" | "semantic" | null | undefined;
6
- status?: "error" | "info" | "default" | "active" | "success" | "warning" | "tagDefault" | "tagActive" | "tagGhost" | null | undefined;
6
+ status?: "error" | "default" | "info" | "active" | "success" | "warning" | "tagDefault" | "tagActive" | "tagGhost" | null | undefined;
7
7
  size?: "sm" | "md" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
@@ -3,7 +3,7 @@ import { VariantProps } from "class-variance-authority";
3
3
  //#region src/components/badge/Badge.d.ts
4
4
  declare const badgeVariants: (props?: ({
5
5
  variant?: "default" | "tag" | "semantic" | null | undefined;
6
- status?: "error" | "info" | "default" | "active" | "success" | "warning" | "tagDefault" | "tagActive" | "tagGhost" | null | undefined;
6
+ status?: "error" | "default" | "info" | "active" | "success" | "warning" | "tagDefault" | "tagActive" | "tagGhost" | null | undefined;
7
7
  size?: "sm" | "md" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
@@ -4,8 +4,8 @@ import { useRender } from "@base-ui/react/use-render";
4
4
  //#region src/components/box/Box.d.ts
5
5
  declare const boxVariants: (props?: ({
6
6
  direction?: "row" | "column" | "row-reverse" | "column-reverse" | null | undefined;
7
- align?: "center" | "start" | "end" | "stretch" | "baseline" | null | undefined;
8
- justify?: "center" | "start" | "end" | "between" | "around" | "evenly" | null | undefined;
7
+ align?: "center" | "end" | "start" | "stretch" | "baseline" | null | undefined;
8
+ justify?: "center" | "end" | "start" | "between" | "around" | "evenly" | null | undefined;
9
9
  wrap?: "wrap" | "nowrap" | "wrap-reverse" | null | undefined;
10
10
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
11
11
  export type SpacingScale = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 96;
@@ -4,8 +4,8 @@ import { useRender } from "@base-ui/react/use-render";
4
4
  //#region src/components/box/Box.d.ts
5
5
  declare const boxVariants: (props?: ({
6
6
  direction?: "row" | "column" | "row-reverse" | "column-reverse" | null | undefined;
7
- align?: "center" | "start" | "end" | "stretch" | "baseline" | null | undefined;
8
- justify?: "center" | "start" | "end" | "between" | "around" | "evenly" | null | undefined;
7
+ align?: "center" | "end" | "start" | "stretch" | "baseline" | null | undefined;
8
+ justify?: "center" | "end" | "start" | "between" | "around" | "evenly" | null | undefined;
9
9
  wrap?: "wrap" | "nowrap" | "wrap-reverse" | null | undefined;
10
10
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
11
11
  export type SpacingScale = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 96;
@@ -24,6 +24,9 @@ let react_jsx_runtime = require("react/jsx-runtime");
24
24
  * `dark:` is intentionally absent — it tracks `prefers-color-scheme`, not the
25
25
  * Berget theme. Theme switching is driven entirely by the semantic tokens.
26
26
  */
27
+ /** Shared interaction chrome for every variant.
28
+ * (Exported for `anchorVariants`, which replicates the wrapper chrome on
29
+ * real `<a>` elements without dragging in button semantics.) */
27
30
  const interactionClasses = require_utils.cn(`
28
31
  focus-visible:ring-0 focus-visible:outline-2 focus-visible:outline-offset-2
29
32
  focus-visible:outline-berget-button-focus-ring focus-visible:outline-solid
@@ -33,11 +36,23 @@ const interactionClasses = require_utils.cn(`
33
36
  `, "active:not-aria-[haspopup]:translate-y-0");
34
37
  /** Disabled treatment shared by every variant. */
35
38
  const disabledClasses = "disabled:text-berget-button-disabled-fg disabled:shadow-none";
36
- /** Brand-specific classes applied *on top* of the upstream primitive. */
39
+ /** Brand-specific classes applied *on top* of the upstream primitive.
40
+ * (Exported for `anchorVariants` — keep in lockstep with the `Button` wrapper.) */
37
41
  function brandVariantClasses(variant) {
38
42
  switch (variant) {
39
43
  case "primary": return require_utils.cn("bg-berget-button-primary-bg text-berget-button-primary-fg", "hover:bg-berget-button-primary-hover", "hover:text-berget-button-primary-fg", "active:bg-berget-button-primary-active", "focus-visible:border-transparent", disabledClasses, "disabled:bg-berget-button-primary-disabled-bg");
40
44
  case "destructive": return require_utils.cn("bg-berget-button-destructive-bg text-berget-button-destructive-fg", "hover:bg-berget-button-destructive-hover", "hover:text-berget-button-destructive-hover-fg", "active:bg-berget-button-destructive-active", "focus-visible:border-transparent", disabledClasses, "disabled:bg-berget-button-destructive-disabled-bg");
45
+ case "destructive-outline": return require_utils.cn(`
46
+ border-berget-button-destructive-outline-border bg-transparent
47
+ text-berget-button-destructive-outline-fg
48
+ `, `
49
+ hover:bg-berget-button-destructive-outline-hover
50
+ hover:text-berget-button-destructive-outline-fg
51
+ dark:hover:bg-berget-button-destructive-outline-hover
52
+ `, `
53
+ active:bg-transparent
54
+ dark:active:bg-transparent
55
+ `, "focus-visible:border-berget-button-destructive-outline-border", disabledClasses, "disabled:border-berget-button-disabled-border disabled:bg-transparent");
41
56
  case "outline": return require_utils.cn(`
42
57
  border-berget-button-outline-border bg-transparent
43
58
  text-berget-button-outline-fg
@@ -72,6 +87,7 @@ function primitiveVariant(variant) {
72
87
  switch (variant) {
73
88
  case "primary":
74
89
  case "destructive":
90
+ case "destructive-outline":
75
91
  case "outline":
76
92
  case "ghost": return "ghost";
77
93
  default: return variant;
@@ -83,9 +99,7 @@ function Button({ className, variant = "default", size, asChild = false, width =
83
99
  const baseClass = require_utils.cn(!isLink && require_button.buttonVariants({
84
100
  variant: primitiveVariant(variant),
85
101
  size
86
- }), !isLink && (width === "full" ? "rounded-berget-xs" : "rounded-full"), !isLink && !isIcon && "h-auto px-[1.14em] py-[0.57em]", !isLink && !isIcon && (size === "lg" ? "text-lg" : size === "sm" ? "text-sm" : size === "xs" ? "" : `
87
- text-base
88
- `), !isLink && "font-normal", brandVariantClasses(variant), interactionClasses, !isLink && width === "full" && "w-full", isIcon && `
102
+ }), !isLink && (width === "full" ? "rounded-berget-xs" : "rounded-full"), !isLink && !isIcon && "h-auto px-[0.8em] py-[0.4em]", !isLink && !isIcon && (size === "lg" ? "text-lg" : size === "sm" ? "text-sm" : size === "xs" ? "" : `text-base`), !isLink && "font-normal", brandVariantClasses(variant), interactionClasses, !isLink && width === "full" && "w-full", isIcon && `
89
103
  rounded-full
90
104
  shadow-[0px_1px_3px_rgba(0,0,0,0.1),0px_1px_2px_-1px_rgba(0,0,0,0.1)]
91
105
  `, className);
@@ -104,6 +118,9 @@ function Button({ className, variant = "default", size, asChild = false, width =
104
118
  }
105
119
  //#endregion
106
120
  exports.Button = Button;
121
+ exports.brandVariantClasses = brandVariantClasses;
107
122
  exports.buttonVariants = require_button.buttonVariants;
123
+ exports.interactionClasses = interactionClasses;
124
+ exports.primitiveVariant = primitiveVariant;
108
125
 
109
126
  //# sourceMappingURL=Button.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.cjs","names":["cn","buttonVariants","ButtonPrimitive","asChildRender"],"sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { cn, asChildRender } from '../../lib/utils';\nimport { Button as ButtonPrimitive, buttonVariants } from '../../primitives/button';\nimport type { VariantProps } from 'class-variance-authority';\n\n/** Variants exposed by the Berget wrapper. */\ntype CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | 'ghost' | 'link';\n\n/** Props for the Berget Button wrapper. */\nexport interface ButtonProps extends Omit<\n React.ComponentProps<typeof ButtonPrimitive>,\n 'variant' | 'ref'\n> {\n /** Visual style variant. `primary` is Berget-specific. */\n variant?: CustomVariant;\n /** Full width or auto width. */\n width?: 'default' | 'full';\n /** Render as a different element/component. Replaces the Radix `asChild` prop. */\n asChild?: boolean;\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * Shared interaction chrome for every variant.\n *\n * The primitive already provides hover/focus/disabled plumbing via shadcn\n * tokens (`--primary`, `--muted`, `--ring`, …), which the shadcn bridge in\n * `styles/index.css` maps to brand values. These classes neutralise the bits\n * that don't fit the Berget system and apply the component-scoped\n * `--berget-button-*` state tokens:\n *\n * - Focus: always visible on keyboard focus (`focus-visible`), drawn as a\n * real CSS **outline** (2px, offset 2px) in `--berget-button-focus-ring`\n * (moss-300 dark / moss-600 light, ≥3:1 against the surface per\n * WCAG 2.4.7) — not a ring/box-shadow hugging the edge, and the control's\n * own border keeps its resting colour.\n * - Disabled: replaces the primitive's flat `opacity-50` fade with explicit\n * muted tokens so every variant stays legible (≥3:1, and disabled UI is\n * exempt from AA text contrast per WCAG 1.4.3).\n *\n * `dark:` is intentionally absent — it tracks `prefers-color-scheme`, not the\n * Berget theme. Theme switching is driven entirely by the semantic tokens.\n */\nconst interactionClasses = cn(\n // Outline-based focus indicator; neutralise the primitive's ring (the\n // ring colour class is left — harmless at width 0).\n `\n focus-visible:ring-0 focus-visible:outline-2 focus-visible:outline-offset-2\n focus-visible:outline-berget-button-focus-ring focus-visible:outline-solid\n `,\n // Neutralise the primitive's disabled fade; variants apply their own tokens.\n `\n disabled:pointer-events-none disabled:cursor-not-allowed\n disabled:opacity-100\n `,\n // No press movement: same compound selector as the primitive base's 1px\n // active translate so tailwind-merge strips it down to 0.\n 'active:not-aria-[haspopup]:translate-y-0',\n);\n\n/** Disabled treatment shared by every variant. */\nconst disabledClasses = 'disabled:text-berget-button-disabled-fg disabled:shadow-none';\n\n/** Brand-specific classes applied *on top* of the upstream primitive. */\nfunction brandVariantClasses(variant?: CustomVariant): string {\n switch (variant) {\n case 'primary':\n return cn(\n // Flat tinted-glass fill; the alpha carries the state, so no shadow lift.\n 'bg-berget-button-primary-bg text-berget-button-primary-fg',\n 'hover:bg-berget-button-primary-hover',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which would override the primary fg token.\n 'hover:text-berget-button-primary-fg',\n 'active:bg-berget-button-primary-active',\n // Keep the resting (transparent) border on focus — the outline is the indicator.\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-primary-disabled-bg',\n );\n case 'destructive':\n return cn(\n 'bg-berget-button-destructive-bg text-berget-button-destructive-fg',\n 'hover:bg-berget-button-destructive-hover',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which would override the destructive fg token.\n 'hover:text-berget-button-destructive-hover-fg',\n 'active:bg-berget-button-destructive-active',\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-destructive-disabled-bg',\n );\n case 'outline':\n return cn(\n // Transparent fill with a theme-foreground-derived border (25% of the\n // foreground). The state treatment is static: hover, press and\n // keyboard focus render identically to rest — only the shared focus\n // outline and the disabled treatment deviate.\n `\n border-berget-button-outline-border bg-transparent\n text-berget-button-outline-fg\n `,\n // Hover: slight brightening (hover bg token); the border and\n // foreground stay at rest. The dark:hover twin also neutralises\n // the primitive ghost's dark:hover:bg-muted/50. Pressed drops the\n // fill back to transparent (a pressed element is still hovered, so\n // an explicit active override is needed in both colour schemes).\n `\n hover:bg-berget-button-outline-hover\n dark:hover:bg-berget-button-outline-hover\n `,\n `\n active:bg-transparent\n dark:active:bg-transparent\n `,\n // Keep the resting border on focus — the shared outline is the indicator.\n 'focus-visible:border-berget-button-outline-border',\n disabledClasses,\n 'disabled:border-berget-button-disabled-border disabled:bg-transparent',\n );\n case 'ghost':\n // Transparent fill with foreground text; hover and press add subtle\n // theme-foreground-derived fills (10% / 5%). No border of its own —\n // the primitive's resting transparent border persists. The primitive\n // ghost variant's aria-expanded state (bg-muted + foreground text)\n // passes through for dropdown-trigger use.\n return cn(\n 'bg-transparent text-berget-button-ghost-fg',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which is the same value here but pinned\n // explicitly for parity with the other fg-token variants.\n 'hover:bg-berget-button-ghost-hover hover:text-berget-button-ghost-fg',\n // The dark:hover twin neutralises the primitive ghost's\n // dark:hover:bg-muted/50 so only the token fill applies.\n 'dark:hover:bg-berget-button-ghost-hover',\n `\n active:bg-berget-button-ghost-active\n dark:active:bg-berget-button-ghost-active\n `,\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-transparent',\n );\n case 'link':\n // Rendered without buttonVariants — needs its own sizing, focus ring and\n // disabled treatment (the primitive's fade is not legible on text links).\n return cn(\n `\n h-auto bg-transparent p-0 font-medium text-berget-button-link-fg\n underline-offset-4 shadow-none\n `,\n 'hover:bg-transparent hover:text-berget-button-link-hover-fg',\n // On press, return to the resting foreground (hover fg otherwise sticks).\n 'active:text-berget-button-link-fg',\n 'focus:bg-transparent',\n // Neutralise the primitive base's focus-visible:border-ring + ring-3,\n // which land on link too (the primitive merges its cva base under\n // every variant): the outline above is the only focus indicator.\n 'focus-visible:border-transparent focus-visible:ring-0',\n `\n focus-visible:rounded-berget-xs focus-visible:outline-2\n focus-visible:outline-offset-2\n focus-visible:outline-berget-button-focus-ring\n focus-visible:outline-solid\n `,\n 'disabled:text-berget-button-disabled-fg disabled:no-underline',\n 'disabled:cursor-not-allowed disabled:opacity-100',\n );\n\n case 'default':\n default:\n return cn(\n // Solid granite-800 fill with a granite-700 border on dark surfaces\n // (ink glass in light theme).\n `\n border-berget-button-default-border bg-berget-button-default-bg\n text-berget-button-default-fg\n `,\n 'hover:bg-berget-button-default-hover',\n 'active:bg-berget-button-default-active',\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-default-disabled-bg',\n );\n }\n}\n\n/** Map custom variants to the closest upstream primitive variant. */\nfunction primitiveVariant(variant?: CustomVariant): VariantProps<typeof buttonVariants>['variant'] {\n switch (variant) {\n case 'primary':\n case 'destructive':\n case 'outline':\n case 'ghost':\n return 'ghost';\n default:\n return variant;\n }\n}\n\nexport function Button({\n className,\n variant = 'default',\n size,\n asChild = false,\n width = 'default',\n type = 'button',\n ref,\n children,\n ...props\n}: ButtonProps) {\n const isIcon = typeof size === 'string' && size.startsWith('icon');\n const isLink = variant === 'link';\n\n const baseClass = cn(\n !isLink && buttonVariants({ variant: primitiveVariant(variant), size }),\n // Berget brand overrides — full-width buttons use the square radius;\n // everything else stays pill-shaped.\n !isLink && (width === 'full' ? 'rounded-berget-xs' : 'rounded-full'),\n // Em-based padding, inline = 2× block — matches the 8px/16px spacing-scale\n // values at the default text-sm (14px) and scales down/up with smaller or\n // larger button text. h-auto drops the primitive's fixed h-* so the\n // vertical paddings take effect.\n !isLink && !isIcon && 'h-auto px-[1.14em] py-[0.57em]',\n // Text ladder: size = typography scale; the em-based padding above\n // follows automatically, so no per-size paddings are needed. Only\n // default/lg/sm need overrides — xs keeps the primitive's text-xs.\n !isLink &&\n !isIcon &&\n (size === 'lg'\n ? 'text-lg'\n : size === 'sm'\n ? 'text-sm'\n : size === 'xs'\n ? ''\n : `\n text-base\n `),\n // Normal weight for every non-link variant — tailwind-merge strips the\n // primitive's font-medium (font-weight: var(--font-weight-medium)); the\n // link variant keeps medium via its own classes above.\n !isLink && 'font-normal',\n brandVariantClasses(variant),\n interactionClasses,\n !isLink && width === 'full' && 'w-full',\n isIcon &&\n `\n rounded-full\n shadow-[0px_1px_3px_rgba(0,0,0,0.1),0px_1px_2px_-1px_rgba(0,0,0,0.1)]\n `,\n className,\n );\n\n const content = (\n <span className={cn('inline-flex items-center', !isIcon && 'gap-2')}>{children}</span>\n );\n\n return (\n <ButtonPrimitive\n className={baseClass}\n ref={ref}\n render={asChildRender(asChild, children)}\n type={type}\n {...props}\n >\n {asChild ? undefined : content}\n </ButtonPrimitive>\n );\n}\n\nexport { buttonVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,qBAAqBA,cAAAA,GAGzB;;;KAKA;;;KAMA,0CACF;;AAGA,MAAM,kBAAkB;;AAGxB,SAAS,oBAAoB,SAAiC;CAC5D,QAAQ,SAAR;EACE,KAAK,WACH,OAAOA,cAAAA,GAEL,6DACA,wCAGA,uCACA,0CAEA,oCACA,iBACA,+CACF;EACF,KAAK,eACH,OAAOA,cAAAA,GACL,qEACA,4CAGA,iDACA,8CACA,oCACA,iBACA,mDACF;EACF,KAAK,WACH,OAAOA,cAAAA,GAKL;;;WASA;;;WAIA;;;WAKA,qDACA,iBACA,uEACF;EACF,KAAK,SAMH,OAAOA,cAAAA,GACL,8CAIA,wEAGA,2CACA;;;WAIA,oCACA,iBACA,yBACF;EACF,KAAK,QAGH,OAAOA,cAAAA,GACL;;;WAIA,+DAEA,qCACA,wBAIA,yDACA;;;;;WAMA,iEACA,kDACF;EAGF,SACE,OAAOA,cAAAA,GAGL;;;WAIA,wCACA,0CACA,oCACA,iBACA,+CACF;CACJ;AACF;;AAGA,SAAS,iBAAiB,SAAyE;CACjG,QAAQ,SAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,SACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAEA,SAAgB,OAAO,EACrB,WACA,UAAU,WACV,MACA,UAAU,OACV,QAAQ,WACR,OAAO,UACP,KACA,UACA,GAAG,SACW;CACd,MAAM,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,MAAM;CACjE,MAAM,SAAS,YAAY;CAE3B,MAAM,YAAYA,cAAAA,GAChB,CAAC,UAAUC,eAAAA,eAAe;EAAE,SAAS,iBAAiB,OAAO;EAAG;CAAK,CAAC,GAGtE,CAAC,WAAW,UAAU,SAAS,sBAAsB,iBAKrD,CAAC,UAAU,CAAC,UAAU,kCAItB,CAAC,UACC,CAAC,WACA,SAAS,OACN,YACA,SAAS,OACP,YACA,SAAS,OACP,KACA;;UAMV,CAAC,UAAU,eACX,oBAAoB,OAAO,GAC3B,oBACA,CAAC,UAAU,UAAU,UAAU,UAC/B,UACE;;;SAIF,SACF;CAEA,MAAM,UACJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EAAM,WAAWD,cAAAA,GAAG,4BAA4B,CAAC,UAAU,OAAO;EAAI;CAAe,CAAA;CAGvF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACE,eAAAA,QAAD;EACE,WAAW;EACN;EACL,QAAQC,cAAAA,cAAc,SAAS,QAAQ;EACjC;EACN,GAAI;EAEH,UAAA,UAAU,KAAA,IAAY;CACR,CAAA;AAErB"}
1
+ {"version":3,"file":"Button.cjs","names":["cn","buttonVariants","ButtonPrimitive","asChildRender"],"sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { cn, asChildRender } from '../../lib/utils';\nimport { Button as ButtonPrimitive, buttonVariants } from '../../primitives/button';\nimport type { VariantProps } from 'class-variance-authority';\n\n/** Variants exposed by the Berget wrapper. */\nexport type CustomVariant =\n | 'default'\n | 'primary'\n | 'destructive'\n | 'destructive-outline'\n | 'outline'\n | 'ghost'\n | 'link';\n\n/** Props for the Berget Button wrapper. */\nexport interface ButtonProps extends Omit<\n React.ComponentProps<typeof ButtonPrimitive>,\n 'variant' | 'ref'\n> {\n /** Visual style variant. `primary` is Berget-specific. */\n variant?: CustomVariant;\n /** Full width or auto width. */\n width?: 'default' | 'full';\n /** Render as a different element/component. Replaces the Radix `asChild` prop. */\n asChild?: boolean;\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * Shared interaction chrome for every variant.\n *\n * The primitive already provides hover/focus/disabled plumbing via shadcn\n * tokens (`--primary`, `--muted`, `--ring`, …), which the shadcn bridge in\n * `styles/index.css` maps to brand values. These classes neutralise the bits\n * that don't fit the Berget system and apply the component-scoped\n * `--berget-button-*` state tokens:\n *\n * - Focus: always visible on keyboard focus (`focus-visible`), drawn as a\n * real CSS **outline** (2px, offset 2px) in `--berget-button-focus-ring`\n * (moss-300 dark / moss-600 light, ≥3:1 against the surface per\n * WCAG 2.4.7) — not a ring/box-shadow hugging the edge, and the control's\n * own border keeps its resting colour.\n * - Disabled: replaces the primitive's flat `opacity-50` fade with explicit\n * muted tokens so every variant stays legible (≥3:1, and disabled UI is\n * exempt from AA text contrast per WCAG 1.4.3).\n *\n * `dark:` is intentionally absent — it tracks `prefers-color-scheme`, not the\n * Berget theme. Theme switching is driven entirely by the semantic tokens.\n */\n/** Shared interaction chrome for every variant.\n * (Exported for `anchorVariants`, which replicates the wrapper chrome on\n * real `<a>` elements without dragging in button semantics.) */\nexport const interactionClasses = cn(\n // Outline-based focus indicator; neutralise the primitive's ring (the\n // ring colour class is left — harmless at width 0).\n `\n focus-visible:ring-0 focus-visible:outline-2 focus-visible:outline-offset-2\n focus-visible:outline-berget-button-focus-ring focus-visible:outline-solid\n `,\n // Neutralise the primitive's disabled fade; variants apply their own tokens.\n `\n disabled:pointer-events-none disabled:cursor-not-allowed\n disabled:opacity-100\n `,\n // No press movement: same compound selector as the primitive base's 1px\n // active translate so tailwind-merge strips it down to 0.\n 'active:not-aria-[haspopup]:translate-y-0',\n);\n\n/** Disabled treatment shared by every variant. */\nconst disabledClasses = 'disabled:text-berget-button-disabled-fg disabled:shadow-none';\n\n/** Brand-specific classes applied *on top* of the upstream primitive.\n * (Exported for `anchorVariants` — keep in lockstep with the `Button` wrapper.) */\nexport function brandVariantClasses(variant?: CustomVariant): string {\n switch (variant) {\n case 'primary':\n return cn(\n // Flat tinted-glass fill; the alpha carries the state, so no shadow lift.\n 'bg-berget-button-primary-bg text-berget-button-primary-fg',\n 'hover:bg-berget-button-primary-hover',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which would override the primary fg token.\n 'hover:text-berget-button-primary-fg',\n 'active:bg-berget-button-primary-active',\n // Keep the resting (transparent) border on focus — the outline is the indicator.\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-primary-disabled-bg',\n );\n case 'destructive':\n return cn(\n 'bg-berget-button-destructive-bg text-berget-button-destructive-fg',\n 'hover:bg-berget-button-destructive-hover',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which would override the destructive fg token.\n 'hover:text-berget-button-destructive-hover-fg',\n 'active:bg-berget-button-destructive-active',\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-destructive-disabled-bg',\n );\n case 'destructive-outline':\n // Muscaria-tinted outline: transparent fill, red border + red text;\n // hover adds a subtle red fill (10% in both colour schemes). Follows\n // the outline case's static-state shape, with token hues swapped.\n return cn(\n `\n border-berget-button-destructive-outline-border bg-transparent\n text-berget-button-destructive-outline-fg\n `,\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which would override the destructive fg token.\n `\n hover:bg-berget-button-destructive-outline-hover\n hover:text-berget-button-destructive-outline-fg\n dark:hover:bg-berget-button-destructive-outline-hover\n `,\n `\n active:bg-transparent\n dark:active:bg-transparent\n `,\n // Keep the resting border on focus — the shared outline is the indicator.\n 'focus-visible:border-berget-button-destructive-outline-border',\n disabledClasses,\n 'disabled:border-berget-button-disabled-border disabled:bg-transparent',\n );\n case 'outline':\n return cn(\n // Transparent fill with a theme-foreground-derived border (25% of the\n // foreground). The state treatment is static: hover, press and\n // keyboard focus render identically to rest — only the shared focus\n // outline and the disabled treatment deviate.\n `\n border-berget-button-outline-border bg-transparent\n text-berget-button-outline-fg\n `,\n // Hover: slight brightening (hover bg token); the border and\n // foreground stay at rest. The dark:hover twin also neutralises\n // the primitive ghost's dark:hover:bg-muted/50. Pressed drops the\n // fill back to transparent (a pressed element is still hovered, so\n // an explicit active override is needed in both colour schemes).\n `\n hover:bg-berget-button-outline-hover\n dark:hover:bg-berget-button-outline-hover\n `,\n `\n active:bg-transparent\n dark:active:bg-transparent\n `,\n // Keep the resting border on focus — the shared outline is the indicator.\n 'focus-visible:border-berget-button-outline-border',\n disabledClasses,\n 'disabled:border-berget-button-disabled-border disabled:bg-transparent',\n );\n case 'ghost':\n // Transparent fill with foreground text; hover and press add subtle\n // theme-foreground-derived fills (10% / 5%). No border of its own —\n // the primitive's resting transparent border persists. The primitive\n // ghost variant's aria-expanded state (bg-muted + foreground text)\n // passes through for dropdown-trigger use.\n return cn(\n 'bg-transparent text-berget-button-ghost-fg',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which is the same value here but pinned\n // explicitly for parity with the other fg-token variants.\n 'hover:bg-berget-button-ghost-hover hover:text-berget-button-ghost-fg',\n // The dark:hover twin neutralises the primitive ghost's\n // dark:hover:bg-muted/50 so only the token fill applies.\n 'dark:hover:bg-berget-button-ghost-hover',\n `\n active:bg-berget-button-ghost-active\n dark:active:bg-berget-button-ghost-active\n `,\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-transparent',\n );\n case 'link':\n // Rendered without buttonVariants — needs its own sizing, focus ring and\n // disabled treatment (the primitive's fade is not legible on text links).\n return cn(\n `\n h-auto bg-transparent p-0 font-medium text-berget-button-link-fg\n underline-offset-4 shadow-none\n `,\n 'hover:bg-transparent hover:text-berget-button-link-hover-fg',\n // On press, return to the resting foreground (hover fg otherwise sticks).\n 'active:text-berget-button-link-fg',\n 'focus:bg-transparent',\n // Neutralise the primitive base's focus-visible:border-ring + ring-3,\n // which land on link too (the primitive merges its cva base under\n // every variant): the outline above is the only focus indicator.\n 'focus-visible:border-transparent focus-visible:ring-0',\n `\n focus-visible:rounded-berget-xs focus-visible:outline-2\n focus-visible:outline-offset-2\n focus-visible:outline-berget-button-focus-ring\n focus-visible:outline-solid\n `,\n 'disabled:text-berget-button-disabled-fg disabled:no-underline',\n 'disabled:cursor-not-allowed disabled:opacity-100',\n );\n\n case 'default':\n default:\n return cn(\n // Solid granite-800 fill with a granite-700 border on dark surfaces\n // (ink glass in light theme).\n `\n border-berget-button-default-border bg-berget-button-default-bg\n text-berget-button-default-fg\n `,\n 'hover:bg-berget-button-default-hover',\n 'active:bg-berget-button-default-active',\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-default-disabled-bg',\n );\n }\n}\n\n/** Map custom variants to the closest upstream primitive variant. */\nexport function primitiveVariant(\n variant?: CustomVariant,\n): VariantProps<typeof buttonVariants>['variant'] {\n switch (variant) {\n case 'primary':\n case 'destructive':\n case 'destructive-outline':\n case 'outline':\n case 'ghost':\n return 'ghost';\n default:\n return variant;\n }\n}\n\nexport function Button({\n className,\n variant = 'default',\n size,\n asChild = false,\n width = 'default',\n type = 'button',\n ref,\n children,\n ...props\n}: ButtonProps) {\n const isIcon = typeof size === 'string' && size.startsWith('icon');\n const isLink = variant === 'link';\n\n const baseClass = cn(\n !isLink && buttonVariants({ variant: primitiveVariant(variant), size }),\n // Berget brand overrides — full-width buttons use the square radius;\n // everything else stays pill-shaped.\n !isLink && (width === 'full' ? 'rounded-berget-xs' : 'rounded-full'),\n // Em-based padding, inline = 2× block, so the ratio holds as the padding\n // scales down/up with smaller or larger button text. h-auto drops the\n // primitive's fixed h-* so the vertical paddings take effect.\n !isLink && !isIcon && 'h-auto px-[0.8em] py-[0.4em]',\n // Text ladder: size = typography scale; the em-based padding above\n // follows automatically, so no per-size paddings are needed. Only\n // default/lg/sm need overrides — xs keeps the primitive's text-xs.\n !isLink &&\n !isIcon &&\n (size === 'lg' ? 'text-lg' : size === 'sm' ? 'text-sm' : size === 'xs' ? '' : `text-base`),\n // Normal weight for every non-link variant — tailwind-merge strips the\n // primitive's font-medium (font-weight: var(--font-weight-medium)); the\n // link variant keeps medium via its own classes above.\n !isLink && 'font-normal',\n brandVariantClasses(variant),\n interactionClasses,\n !isLink && width === 'full' && 'w-full',\n isIcon &&\n `\n rounded-full\n shadow-[0px_1px_3px_rgba(0,0,0,0.1),0px_1px_2px_-1px_rgba(0,0,0,0.1)]\n `,\n className,\n );\n\n const content = (\n <span className={cn('inline-flex items-center', !isIcon && 'gap-2')}>{children}</span>\n );\n\n return (\n <ButtonPrimitive\n className={baseClass}\n ref={ref}\n render={asChildRender(asChild, children)}\n type={type}\n {...props}\n >\n {asChild ? undefined : content}\n </ButtonPrimitive>\n );\n}\n\nexport { buttonVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,MAAa,qBAAqBA,cAAAA,GAGhC;;;KAKA;;;KAMA,0CACF;;AAGA,MAAM,kBAAkB;;;AAIxB,SAAgB,oBAAoB,SAAiC;CACnE,QAAQ,SAAR;EACE,KAAK,WACH,OAAOA,cAAAA,GAEL,6DACA,wCAGA,uCACA,0CAEA,oCACA,iBACA,+CACF;EACF,KAAK,eACH,OAAOA,cAAAA,GACL,qEACA,4CAGA,iDACA,8CACA,oCACA,iBACA,mDACF;EACF,KAAK,uBAIH,OAAOA,cAAAA,GACL;;;WAMA;;;;WAKA;;;WAKA,iEACA,iBACA,uEACF;EACF,KAAK,WACH,OAAOA,cAAAA,GAKL;;;WASA;;;WAIA;;;WAKA,qDACA,iBACA,uEACF;EACF,KAAK,SAMH,OAAOA,cAAAA,GACL,8CAIA,wEAGA,2CACA;;;WAIA,oCACA,iBACA,yBACF;EACF,KAAK,QAGH,OAAOA,cAAAA,GACL;;;WAIA,+DAEA,qCACA,wBAIA,yDACA;;;;;WAMA,iEACA,kDACF;EAGF,SACE,OAAOA,cAAAA,GAGL;;;WAIA,wCACA,0CACA,oCACA,iBACA,+CACF;CACJ;AACF;;AAGA,SAAgB,iBACd,SACgD;CAChD,QAAQ,SAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,SACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAEA,SAAgB,OAAO,EACrB,WACA,UAAU,WACV,MACA,UAAU,OACV,QAAQ,WACR,OAAO,UACP,KACA,UACA,GAAG,SACW;CACd,MAAM,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,MAAM;CACjE,MAAM,SAAS,YAAY;CAE3B,MAAM,YAAYA,cAAAA,GAChB,CAAC,UAAUC,eAAAA,eAAe;EAAE,SAAS,iBAAiB,OAAO;EAAG;CAAK,CAAC,GAGtE,CAAC,WAAW,UAAU,SAAS,sBAAsB,iBAIrD,CAAC,UAAU,CAAC,UAAU,gCAItB,CAAC,UACC,CAAC,WACA,SAAS,OAAO,YAAY,SAAS,OAAO,YAAY,SAAS,OAAO,KAAK,cAIhF,CAAC,UAAU,eACX,oBAAoB,OAAO,GAC3B,oBACA,CAAC,UAAU,UAAU,UAAU,UAC/B,UACE;;;SAIF,SACF;CAEA,MAAM,UACJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EAAM,WAAWD,cAAAA,GAAG,4BAA4B,CAAC,UAAU,OAAO;EAAI;CAAe,CAAA;CAGvF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACE,eAAAA,QAAD;EACE,WAAW;EACN;EACL,QAAQC,cAAAA,cAAc,SAAS,QAAQ;EACjC;EACN,GAAI;EAEH,UAAA,UAAU,KAAA,IAAY;CACR,CAAA;AAErB"}
@@ -1,8 +1,9 @@
1
1
  import { Button as Button$1, buttonVariants } from "../../primitives/button.cjs";
2
2
  import * as React from "react";
3
+ import { VariantProps } from "class-variance-authority";
3
4
  //#region src/components/button/Button.d.ts
4
5
  /** Variants exposed by the Berget wrapper. */
5
- type CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | 'ghost' | 'link';
6
+ export type CustomVariant = 'default' | 'primary' | 'destructive' | 'destructive-outline' | 'outline' | 'ghost' | 'link';
6
7
  /** Props for the Berget Button wrapper. */
7
8
  export interface ButtonProps extends Omit<React.ComponentProps<typeof Button$1>, 'variant' | 'ref'> {
8
9
  /** Visual style variant. `primary` is Berget-specific. */
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.cts","names":["ButtonPrimitive"],"sources":["../../../src/components/button/Button.tsx"],"mappings":";;;;KAQK;;iBAGY,oBAAoB,KACnC,MAAM,sBAAsBA;;EAI5B,UAAU;;EAEV;;EAEA;EACA,MAAM,MAAM,IAAI;;wBAqLF,SACd,WACA,SACA,MACA,SACA,OACA,MACA,KACA,aACG,SACF,0CAAW,IAAA"}
1
+ {"version":3,"file":"Button.d.cts","names":["ButtonPrimitive"],"sources":["../../../src/components/button/Button.tsx"],"mappings":";;;;;YAQY;;iBAUK,oBAAoB,KACnC,MAAM,sBAAsBA;;EAI5B,UAAU;;EAEV;;EAEA;EACA,MAAM,MAAM,IAAI;;wBAqNF,SACd,WACA,SACA,MACA,SACA,OACA,MACA,KACA,aACG,SACF,0CAAW,IAAA"}
@@ -1,8 +1,9 @@
1
1
  import { Button as Button$1, buttonVariants } from "../../primitives/button.mjs";
2
2
  import * as React from "react";
3
+ import { VariantProps } from "class-variance-authority";
3
4
  //#region src/components/button/Button.d.ts
4
5
  /** Variants exposed by the Berget wrapper. */
5
- type CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | 'ghost' | 'link';
6
+ export type CustomVariant = 'default' | 'primary' | 'destructive' | 'destructive-outline' | 'outline' | 'ghost' | 'link';
6
7
  /** Props for the Berget Button wrapper. */
7
8
  export interface ButtonProps extends Omit<React.ComponentProps<typeof Button$1>, 'variant' | 'ref'> {
8
9
  /** Visual style variant. `primary` is Berget-specific. */
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.mts","names":["ButtonPrimitive"],"sources":["../../../src/components/button/Button.tsx"],"mappings":";;;;KAQK;;iBAGY,oBAAoB,KACnC,MAAM,sBAAsBA;;EAI5B,UAAU;;EAEV;;EAEA;EACA,MAAM,MAAM,IAAI;;wBAqLF,SACd,WACA,SACA,MACA,SACA,OACA,MACA,KACA,aACG,SACF,0CAAW,IAAA"}
1
+ {"version":3,"file":"Button.d.mts","names":["ButtonPrimitive"],"sources":["../../../src/components/button/Button.tsx"],"mappings":";;;;;YAQY;;iBAUK,oBAAoB,KACnC,MAAM,sBAAsBA;;EAI5B,UAAU;;EAEV;;EAEA;EACA,MAAM,MAAM,IAAI;;wBAqNF,SACd,WACA,SACA,MACA,SACA,OACA,MACA,KACA,aACG,SACF,0CAAW,IAAA"}
@@ -24,6 +24,9 @@ import { jsx } from "react/jsx-runtime";
24
24
  * `dark:` is intentionally absent — it tracks `prefers-color-scheme`, not the
25
25
  * Berget theme. Theme switching is driven entirely by the semantic tokens.
26
26
  */
27
+ /** Shared interaction chrome for every variant.
28
+ * (Exported for `anchorVariants`, which replicates the wrapper chrome on
29
+ * real `<a>` elements without dragging in button semantics.) */
27
30
  const interactionClasses = cn(`
28
31
  focus-visible:ring-0 focus-visible:outline-2 focus-visible:outline-offset-2
29
32
  focus-visible:outline-berget-button-focus-ring focus-visible:outline-solid
@@ -33,11 +36,23 @@ const interactionClasses = cn(`
33
36
  `, "active:not-aria-[haspopup]:translate-y-0");
34
37
  /** Disabled treatment shared by every variant. */
35
38
  const disabledClasses = "disabled:text-berget-button-disabled-fg disabled:shadow-none";
36
- /** Brand-specific classes applied *on top* of the upstream primitive. */
39
+ /** Brand-specific classes applied *on top* of the upstream primitive.
40
+ * (Exported for `anchorVariants` — keep in lockstep with the `Button` wrapper.) */
37
41
  function brandVariantClasses(variant) {
38
42
  switch (variant) {
39
43
  case "primary": return cn("bg-berget-button-primary-bg text-berget-button-primary-fg", "hover:bg-berget-button-primary-hover", "hover:text-berget-button-primary-fg", "active:bg-berget-button-primary-active", "focus-visible:border-transparent", disabledClasses, "disabled:bg-berget-button-primary-disabled-bg");
40
44
  case "destructive": return cn("bg-berget-button-destructive-bg text-berget-button-destructive-fg", "hover:bg-berget-button-destructive-hover", "hover:text-berget-button-destructive-hover-fg", "active:bg-berget-button-destructive-active", "focus-visible:border-transparent", disabledClasses, "disabled:bg-berget-button-destructive-disabled-bg");
45
+ case "destructive-outline": return cn(`
46
+ border-berget-button-destructive-outline-border bg-transparent
47
+ text-berget-button-destructive-outline-fg
48
+ `, `
49
+ hover:bg-berget-button-destructive-outline-hover
50
+ hover:text-berget-button-destructive-outline-fg
51
+ dark:hover:bg-berget-button-destructive-outline-hover
52
+ `, `
53
+ active:bg-transparent
54
+ dark:active:bg-transparent
55
+ `, "focus-visible:border-berget-button-destructive-outline-border", disabledClasses, "disabled:border-berget-button-disabled-border disabled:bg-transparent");
41
56
  case "outline": return cn(`
42
57
  border-berget-button-outline-border bg-transparent
43
58
  text-berget-button-outline-fg
@@ -72,6 +87,7 @@ function primitiveVariant(variant) {
72
87
  switch (variant) {
73
88
  case "primary":
74
89
  case "destructive":
90
+ case "destructive-outline":
75
91
  case "outline":
76
92
  case "ghost": return "ghost";
77
93
  default: return variant;
@@ -83,9 +99,7 @@ function Button({ className, variant = "default", size, asChild = false, width =
83
99
  const baseClass = cn(!isLink && buttonVariants({
84
100
  variant: primitiveVariant(variant),
85
101
  size
86
- }), !isLink && (width === "full" ? "rounded-berget-xs" : "rounded-full"), !isLink && !isIcon && "h-auto px-[1.14em] py-[0.57em]", !isLink && !isIcon && (size === "lg" ? "text-lg" : size === "sm" ? "text-sm" : size === "xs" ? "" : `
87
- text-base
88
- `), !isLink && "font-normal", brandVariantClasses(variant), interactionClasses, !isLink && width === "full" && "w-full", isIcon && `
102
+ }), !isLink && (width === "full" ? "rounded-berget-xs" : "rounded-full"), !isLink && !isIcon && "h-auto px-[0.8em] py-[0.4em]", !isLink && !isIcon && (size === "lg" ? "text-lg" : size === "sm" ? "text-sm" : size === "xs" ? "" : `text-base`), !isLink && "font-normal", brandVariantClasses(variant), interactionClasses, !isLink && width === "full" && "w-full", isIcon && `
89
103
  rounded-full
90
104
  shadow-[0px_1px_3px_rgba(0,0,0,0.1),0px_1px_2px_-1px_rgba(0,0,0,0.1)]
91
105
  `, className);
@@ -103,6 +117,6 @@ function Button({ className, variant = "default", size, asChild = false, width =
103
117
  });
104
118
  }
105
119
  //#endregion
106
- export { Button, buttonVariants };
120
+ export { Button, brandVariantClasses, buttonVariants, interactionClasses, primitiveVariant };
107
121
 
108
122
  //# sourceMappingURL=Button.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.mjs","names":["ButtonPrimitive"],"sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { cn, asChildRender } from '../../lib/utils';\nimport { Button as ButtonPrimitive, buttonVariants } from '../../primitives/button';\nimport type { VariantProps } from 'class-variance-authority';\n\n/** Variants exposed by the Berget wrapper. */\ntype CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | 'ghost' | 'link';\n\n/** Props for the Berget Button wrapper. */\nexport interface ButtonProps extends Omit<\n React.ComponentProps<typeof ButtonPrimitive>,\n 'variant' | 'ref'\n> {\n /** Visual style variant. `primary` is Berget-specific. */\n variant?: CustomVariant;\n /** Full width or auto width. */\n width?: 'default' | 'full';\n /** Render as a different element/component. Replaces the Radix `asChild` prop. */\n asChild?: boolean;\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * Shared interaction chrome for every variant.\n *\n * The primitive already provides hover/focus/disabled plumbing via shadcn\n * tokens (`--primary`, `--muted`, `--ring`, …), which the shadcn bridge in\n * `styles/index.css` maps to brand values. These classes neutralise the bits\n * that don't fit the Berget system and apply the component-scoped\n * `--berget-button-*` state tokens:\n *\n * - Focus: always visible on keyboard focus (`focus-visible`), drawn as a\n * real CSS **outline** (2px, offset 2px) in `--berget-button-focus-ring`\n * (moss-300 dark / moss-600 light, ≥3:1 against the surface per\n * WCAG 2.4.7) — not a ring/box-shadow hugging the edge, and the control's\n * own border keeps its resting colour.\n * - Disabled: replaces the primitive's flat `opacity-50` fade with explicit\n * muted tokens so every variant stays legible (≥3:1, and disabled UI is\n * exempt from AA text contrast per WCAG 1.4.3).\n *\n * `dark:` is intentionally absent — it tracks `prefers-color-scheme`, not the\n * Berget theme. Theme switching is driven entirely by the semantic tokens.\n */\nconst interactionClasses = cn(\n // Outline-based focus indicator; neutralise the primitive's ring (the\n // ring colour class is left — harmless at width 0).\n `\n focus-visible:ring-0 focus-visible:outline-2 focus-visible:outline-offset-2\n focus-visible:outline-berget-button-focus-ring focus-visible:outline-solid\n `,\n // Neutralise the primitive's disabled fade; variants apply their own tokens.\n `\n disabled:pointer-events-none disabled:cursor-not-allowed\n disabled:opacity-100\n `,\n // No press movement: same compound selector as the primitive base's 1px\n // active translate so tailwind-merge strips it down to 0.\n 'active:not-aria-[haspopup]:translate-y-0',\n);\n\n/** Disabled treatment shared by every variant. */\nconst disabledClasses = 'disabled:text-berget-button-disabled-fg disabled:shadow-none';\n\n/** Brand-specific classes applied *on top* of the upstream primitive. */\nfunction brandVariantClasses(variant?: CustomVariant): string {\n switch (variant) {\n case 'primary':\n return cn(\n // Flat tinted-glass fill; the alpha carries the state, so no shadow lift.\n 'bg-berget-button-primary-bg text-berget-button-primary-fg',\n 'hover:bg-berget-button-primary-hover',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which would override the primary fg token.\n 'hover:text-berget-button-primary-fg',\n 'active:bg-berget-button-primary-active',\n // Keep the resting (transparent) border on focus — the outline is the indicator.\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-primary-disabled-bg',\n );\n case 'destructive':\n return cn(\n 'bg-berget-button-destructive-bg text-berget-button-destructive-fg',\n 'hover:bg-berget-button-destructive-hover',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which would override the destructive fg token.\n 'hover:text-berget-button-destructive-hover-fg',\n 'active:bg-berget-button-destructive-active',\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-destructive-disabled-bg',\n );\n case 'outline':\n return cn(\n // Transparent fill with a theme-foreground-derived border (25% of the\n // foreground). The state treatment is static: hover, press and\n // keyboard focus render identically to rest — only the shared focus\n // outline and the disabled treatment deviate.\n `\n border-berget-button-outline-border bg-transparent\n text-berget-button-outline-fg\n `,\n // Hover: slight brightening (hover bg token); the border and\n // foreground stay at rest. The dark:hover twin also neutralises\n // the primitive ghost's dark:hover:bg-muted/50. Pressed drops the\n // fill back to transparent (a pressed element is still hovered, so\n // an explicit active override is needed in both colour schemes).\n `\n hover:bg-berget-button-outline-hover\n dark:hover:bg-berget-button-outline-hover\n `,\n `\n active:bg-transparent\n dark:active:bg-transparent\n `,\n // Keep the resting border on focus — the shared outline is the indicator.\n 'focus-visible:border-berget-button-outline-border',\n disabledClasses,\n 'disabled:border-berget-button-disabled-border disabled:bg-transparent',\n );\n case 'ghost':\n // Transparent fill with foreground text; hover and press add subtle\n // theme-foreground-derived fills (10% / 5%). No border of its own —\n // the primitive's resting transparent border persists. The primitive\n // ghost variant's aria-expanded state (bg-muted + foreground text)\n // passes through for dropdown-trigger use.\n return cn(\n 'bg-transparent text-berget-button-ghost-fg',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which is the same value here but pinned\n // explicitly for parity with the other fg-token variants.\n 'hover:bg-berget-button-ghost-hover hover:text-berget-button-ghost-fg',\n // The dark:hover twin neutralises the primitive ghost's\n // dark:hover:bg-muted/50 so only the token fill applies.\n 'dark:hover:bg-berget-button-ghost-hover',\n `\n active:bg-berget-button-ghost-active\n dark:active:bg-berget-button-ghost-active\n `,\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-transparent',\n );\n case 'link':\n // Rendered without buttonVariants — needs its own sizing, focus ring and\n // disabled treatment (the primitive's fade is not legible on text links).\n return cn(\n `\n h-auto bg-transparent p-0 font-medium text-berget-button-link-fg\n underline-offset-4 shadow-none\n `,\n 'hover:bg-transparent hover:text-berget-button-link-hover-fg',\n // On press, return to the resting foreground (hover fg otherwise sticks).\n 'active:text-berget-button-link-fg',\n 'focus:bg-transparent',\n // Neutralise the primitive base's focus-visible:border-ring + ring-3,\n // which land on link too (the primitive merges its cva base under\n // every variant): the outline above is the only focus indicator.\n 'focus-visible:border-transparent focus-visible:ring-0',\n `\n focus-visible:rounded-berget-xs focus-visible:outline-2\n focus-visible:outline-offset-2\n focus-visible:outline-berget-button-focus-ring\n focus-visible:outline-solid\n `,\n 'disabled:text-berget-button-disabled-fg disabled:no-underline',\n 'disabled:cursor-not-allowed disabled:opacity-100',\n );\n\n case 'default':\n default:\n return cn(\n // Solid granite-800 fill with a granite-700 border on dark surfaces\n // (ink glass in light theme).\n `\n border-berget-button-default-border bg-berget-button-default-bg\n text-berget-button-default-fg\n `,\n 'hover:bg-berget-button-default-hover',\n 'active:bg-berget-button-default-active',\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-default-disabled-bg',\n );\n }\n}\n\n/** Map custom variants to the closest upstream primitive variant. */\nfunction primitiveVariant(variant?: CustomVariant): VariantProps<typeof buttonVariants>['variant'] {\n switch (variant) {\n case 'primary':\n case 'destructive':\n case 'outline':\n case 'ghost':\n return 'ghost';\n default:\n return variant;\n }\n}\n\nexport function Button({\n className,\n variant = 'default',\n size,\n asChild = false,\n width = 'default',\n type = 'button',\n ref,\n children,\n ...props\n}: ButtonProps) {\n const isIcon = typeof size === 'string' && size.startsWith('icon');\n const isLink = variant === 'link';\n\n const baseClass = cn(\n !isLink && buttonVariants({ variant: primitiveVariant(variant), size }),\n // Berget brand overrides — full-width buttons use the square radius;\n // everything else stays pill-shaped.\n !isLink && (width === 'full' ? 'rounded-berget-xs' : 'rounded-full'),\n // Em-based padding, inline = 2× block — matches the 8px/16px spacing-scale\n // values at the default text-sm (14px) and scales down/up with smaller or\n // larger button text. h-auto drops the primitive's fixed h-* so the\n // vertical paddings take effect.\n !isLink && !isIcon && 'h-auto px-[1.14em] py-[0.57em]',\n // Text ladder: size = typography scale; the em-based padding above\n // follows automatically, so no per-size paddings are needed. Only\n // default/lg/sm need overrides — xs keeps the primitive's text-xs.\n !isLink &&\n !isIcon &&\n (size === 'lg'\n ? 'text-lg'\n : size === 'sm'\n ? 'text-sm'\n : size === 'xs'\n ? ''\n : `\n text-base\n `),\n // Normal weight for every non-link variant — tailwind-merge strips the\n // primitive's font-medium (font-weight: var(--font-weight-medium)); the\n // link variant keeps medium via its own classes above.\n !isLink && 'font-normal',\n brandVariantClasses(variant),\n interactionClasses,\n !isLink && width === 'full' && 'w-full',\n isIcon &&\n `\n rounded-full\n shadow-[0px_1px_3px_rgba(0,0,0,0.1),0px_1px_2px_-1px_rgba(0,0,0,0.1)]\n `,\n className,\n );\n\n const content = (\n <span className={cn('inline-flex items-center', !isIcon && 'gap-2')}>{children}</span>\n );\n\n return (\n <ButtonPrimitive\n className={baseClass}\n ref={ref}\n render={asChildRender(asChild, children)}\n type={type}\n {...props}\n >\n {asChild ? undefined : content}\n </ButtonPrimitive>\n );\n}\n\nexport { buttonVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,qBAAqB,GAGzB;;;KAKA;;;KAMA,0CACF;;AAGA,MAAM,kBAAkB;;AAGxB,SAAS,oBAAoB,SAAiC;CAC5D,QAAQ,SAAR;EACE,KAAK,WACH,OAAO,GAEL,6DACA,wCAGA,uCACA,0CAEA,oCACA,iBACA,+CACF;EACF,KAAK,eACH,OAAO,GACL,qEACA,4CAGA,iDACA,8CACA,oCACA,iBACA,mDACF;EACF,KAAK,WACH,OAAO,GAKL;;;WASA;;;WAIA;;;WAKA,qDACA,iBACA,uEACF;EACF,KAAK,SAMH,OAAO,GACL,8CAIA,wEAGA,2CACA;;;WAIA,oCACA,iBACA,yBACF;EACF,KAAK,QAGH,OAAO,GACL;;;WAIA,+DAEA,qCACA,wBAIA,yDACA;;;;;WAMA,iEACA,kDACF;EAGF,SACE,OAAO,GAGL;;;WAIA,wCACA,0CACA,oCACA,iBACA,+CACF;CACJ;AACF;;AAGA,SAAS,iBAAiB,SAAyE;CACjG,QAAQ,SAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,SACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAEA,SAAgB,OAAO,EACrB,WACA,UAAU,WACV,MACA,UAAU,OACV,QAAQ,WACR,OAAO,UACP,KACA,UACA,GAAG,SACW;CACd,MAAM,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,MAAM;CACjE,MAAM,SAAS,YAAY;CAE3B,MAAM,YAAY,GAChB,CAAC,UAAU,eAAe;EAAE,SAAS,iBAAiB,OAAO;EAAG;CAAK,CAAC,GAGtE,CAAC,WAAW,UAAU,SAAS,sBAAsB,iBAKrD,CAAC,UAAU,CAAC,UAAU,kCAItB,CAAC,UACC,CAAC,WACA,SAAS,OACN,YACA,SAAS,OACP,YACA,SAAS,OACP,KACA;;UAMV,CAAC,UAAU,eACX,oBAAoB,OAAO,GAC3B,oBACA,CAAC,UAAU,UAAU,UAAU,UAC/B,UACE;;;SAIF,SACF;CAEA,MAAM,UACJ,oBAAC,QAAD;EAAM,WAAW,GAAG,4BAA4B,CAAC,UAAU,OAAO;EAAI;CAAe,CAAA;CAGvF,OACE,oBAACA,UAAD;EACE,WAAW;EACN;EACL,QAAQ,cAAc,SAAS,QAAQ;EACjC;EACN,GAAI;EAEH,UAAA,UAAU,KAAA,IAAY;CACR,CAAA;AAErB"}
1
+ {"version":3,"file":"Button.mjs","names":["ButtonPrimitive"],"sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { cn, asChildRender } from '../../lib/utils';\nimport { Button as ButtonPrimitive, buttonVariants } from '../../primitives/button';\nimport type { VariantProps } from 'class-variance-authority';\n\n/** Variants exposed by the Berget wrapper. */\nexport type CustomVariant =\n | 'default'\n | 'primary'\n | 'destructive'\n | 'destructive-outline'\n | 'outline'\n | 'ghost'\n | 'link';\n\n/** Props for the Berget Button wrapper. */\nexport interface ButtonProps extends Omit<\n React.ComponentProps<typeof ButtonPrimitive>,\n 'variant' | 'ref'\n> {\n /** Visual style variant. `primary` is Berget-specific. */\n variant?: CustomVariant;\n /** Full width or auto width. */\n width?: 'default' | 'full';\n /** Render as a different element/component. Replaces the Radix `asChild` prop. */\n asChild?: boolean;\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * Shared interaction chrome for every variant.\n *\n * The primitive already provides hover/focus/disabled plumbing via shadcn\n * tokens (`--primary`, `--muted`, `--ring`, …), which the shadcn bridge in\n * `styles/index.css` maps to brand values. These classes neutralise the bits\n * that don't fit the Berget system and apply the component-scoped\n * `--berget-button-*` state tokens:\n *\n * - Focus: always visible on keyboard focus (`focus-visible`), drawn as a\n * real CSS **outline** (2px, offset 2px) in `--berget-button-focus-ring`\n * (moss-300 dark / moss-600 light, ≥3:1 against the surface per\n * WCAG 2.4.7) — not a ring/box-shadow hugging the edge, and the control's\n * own border keeps its resting colour.\n * - Disabled: replaces the primitive's flat `opacity-50` fade with explicit\n * muted tokens so every variant stays legible (≥3:1, and disabled UI is\n * exempt from AA text contrast per WCAG 1.4.3).\n *\n * `dark:` is intentionally absent — it tracks `prefers-color-scheme`, not the\n * Berget theme. Theme switching is driven entirely by the semantic tokens.\n */\n/** Shared interaction chrome for every variant.\n * (Exported for `anchorVariants`, which replicates the wrapper chrome on\n * real `<a>` elements without dragging in button semantics.) */\nexport const interactionClasses = cn(\n // Outline-based focus indicator; neutralise the primitive's ring (the\n // ring colour class is left — harmless at width 0).\n `\n focus-visible:ring-0 focus-visible:outline-2 focus-visible:outline-offset-2\n focus-visible:outline-berget-button-focus-ring focus-visible:outline-solid\n `,\n // Neutralise the primitive's disabled fade; variants apply their own tokens.\n `\n disabled:pointer-events-none disabled:cursor-not-allowed\n disabled:opacity-100\n `,\n // No press movement: same compound selector as the primitive base's 1px\n // active translate so tailwind-merge strips it down to 0.\n 'active:not-aria-[haspopup]:translate-y-0',\n);\n\n/** Disabled treatment shared by every variant. */\nconst disabledClasses = 'disabled:text-berget-button-disabled-fg disabled:shadow-none';\n\n/** Brand-specific classes applied *on top* of the upstream primitive.\n * (Exported for `anchorVariants` — keep in lockstep with the `Button` wrapper.) */\nexport function brandVariantClasses(variant?: CustomVariant): string {\n switch (variant) {\n case 'primary':\n return cn(\n // Flat tinted-glass fill; the alpha carries the state, so no shadow lift.\n 'bg-berget-button-primary-bg text-berget-button-primary-fg',\n 'hover:bg-berget-button-primary-hover',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which would override the primary fg token.\n 'hover:text-berget-button-primary-fg',\n 'active:bg-berget-button-primary-active',\n // Keep the resting (transparent) border on focus — the outline is the indicator.\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-primary-disabled-bg',\n );\n case 'destructive':\n return cn(\n 'bg-berget-button-destructive-bg text-berget-button-destructive-fg',\n 'hover:bg-berget-button-destructive-hover',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which would override the destructive fg token.\n 'hover:text-berget-button-destructive-hover-fg',\n 'active:bg-berget-button-destructive-active',\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-destructive-disabled-bg',\n );\n case 'destructive-outline':\n // Muscaria-tinted outline: transparent fill, red border + red text;\n // hover adds a subtle red fill (10% in both colour schemes). Follows\n // the outline case's static-state shape, with token hues swapped.\n return cn(\n `\n border-berget-button-destructive-outline-border bg-transparent\n text-berget-button-destructive-outline-fg\n `,\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which would override the destructive fg token.\n `\n hover:bg-berget-button-destructive-outline-hover\n hover:text-berget-button-destructive-outline-fg\n dark:hover:bg-berget-button-destructive-outline-hover\n `,\n `\n active:bg-transparent\n dark:active:bg-transparent\n `,\n // Keep the resting border on focus — the shared outline is the indicator.\n 'focus-visible:border-berget-button-destructive-outline-border',\n disabledClasses,\n 'disabled:border-berget-button-disabled-border disabled:bg-transparent',\n );\n case 'outline':\n return cn(\n // Transparent fill with a theme-foreground-derived border (25% of the\n // foreground). The state treatment is static: hover, press and\n // keyboard focus render identically to rest — only the shared focus\n // outline and the disabled treatment deviate.\n `\n border-berget-button-outline-border bg-transparent\n text-berget-button-outline-fg\n `,\n // Hover: slight brightening (hover bg token); the border and\n // foreground stay at rest. The dark:hover twin also neutralises\n // the primitive ghost's dark:hover:bg-muted/50. Pressed drops the\n // fill back to transparent (a pressed element is still hovered, so\n // an explicit active override is needed in both colour schemes).\n `\n hover:bg-berget-button-outline-hover\n dark:hover:bg-berget-button-outline-hover\n `,\n `\n active:bg-transparent\n dark:active:bg-transparent\n `,\n // Keep the resting border on focus — the shared outline is the indicator.\n 'focus-visible:border-berget-button-outline-border',\n disabledClasses,\n 'disabled:border-berget-button-disabled-border disabled:bg-transparent',\n );\n case 'ghost':\n // Transparent fill with foreground text; hover and press add subtle\n // theme-foreground-derived fills (10% / 5%). No border of its own —\n // the primitive's resting transparent border persists. The primitive\n // ghost variant's aria-expanded state (bg-muted + foreground text)\n // passes through for dropdown-trigger use.\n return cn(\n 'bg-transparent text-berget-button-ghost-fg',\n // Pin the foreground on hover — the underlying primitive ghost adds\n // hover:text-foreground, which is the same value here but pinned\n // explicitly for parity with the other fg-token variants.\n 'hover:bg-berget-button-ghost-hover hover:text-berget-button-ghost-fg',\n // The dark:hover twin neutralises the primitive ghost's\n // dark:hover:bg-muted/50 so only the token fill applies.\n 'dark:hover:bg-berget-button-ghost-hover',\n `\n active:bg-berget-button-ghost-active\n dark:active:bg-berget-button-ghost-active\n `,\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-transparent',\n );\n case 'link':\n // Rendered without buttonVariants — needs its own sizing, focus ring and\n // disabled treatment (the primitive's fade is not legible on text links).\n return cn(\n `\n h-auto bg-transparent p-0 font-medium text-berget-button-link-fg\n underline-offset-4 shadow-none\n `,\n 'hover:bg-transparent hover:text-berget-button-link-hover-fg',\n // On press, return to the resting foreground (hover fg otherwise sticks).\n 'active:text-berget-button-link-fg',\n 'focus:bg-transparent',\n // Neutralise the primitive base's focus-visible:border-ring + ring-3,\n // which land on link too (the primitive merges its cva base under\n // every variant): the outline above is the only focus indicator.\n 'focus-visible:border-transparent focus-visible:ring-0',\n `\n focus-visible:rounded-berget-xs focus-visible:outline-2\n focus-visible:outline-offset-2\n focus-visible:outline-berget-button-focus-ring\n focus-visible:outline-solid\n `,\n 'disabled:text-berget-button-disabled-fg disabled:no-underline',\n 'disabled:cursor-not-allowed disabled:opacity-100',\n );\n\n case 'default':\n default:\n return cn(\n // Solid granite-800 fill with a granite-700 border on dark surfaces\n // (ink glass in light theme).\n `\n border-berget-button-default-border bg-berget-button-default-bg\n text-berget-button-default-fg\n `,\n 'hover:bg-berget-button-default-hover',\n 'active:bg-berget-button-default-active',\n 'focus-visible:border-transparent',\n disabledClasses,\n 'disabled:bg-berget-button-default-disabled-bg',\n );\n }\n}\n\n/** Map custom variants to the closest upstream primitive variant. */\nexport function primitiveVariant(\n variant?: CustomVariant,\n): VariantProps<typeof buttonVariants>['variant'] {\n switch (variant) {\n case 'primary':\n case 'destructive':\n case 'destructive-outline':\n case 'outline':\n case 'ghost':\n return 'ghost';\n default:\n return variant;\n }\n}\n\nexport function Button({\n className,\n variant = 'default',\n size,\n asChild = false,\n width = 'default',\n type = 'button',\n ref,\n children,\n ...props\n}: ButtonProps) {\n const isIcon = typeof size === 'string' && size.startsWith('icon');\n const isLink = variant === 'link';\n\n const baseClass = cn(\n !isLink && buttonVariants({ variant: primitiveVariant(variant), size }),\n // Berget brand overrides — full-width buttons use the square radius;\n // everything else stays pill-shaped.\n !isLink && (width === 'full' ? 'rounded-berget-xs' : 'rounded-full'),\n // Em-based padding, inline = 2× block, so the ratio holds as the padding\n // scales down/up with smaller or larger button text. h-auto drops the\n // primitive's fixed h-* so the vertical paddings take effect.\n !isLink && !isIcon && 'h-auto px-[0.8em] py-[0.4em]',\n // Text ladder: size = typography scale; the em-based padding above\n // follows automatically, so no per-size paddings are needed. Only\n // default/lg/sm need overrides — xs keeps the primitive's text-xs.\n !isLink &&\n !isIcon &&\n (size === 'lg' ? 'text-lg' : size === 'sm' ? 'text-sm' : size === 'xs' ? '' : `text-base`),\n // Normal weight for every non-link variant — tailwind-merge strips the\n // primitive's font-medium (font-weight: var(--font-weight-medium)); the\n // link variant keeps medium via its own classes above.\n !isLink && 'font-normal',\n brandVariantClasses(variant),\n interactionClasses,\n !isLink && width === 'full' && 'w-full',\n isIcon &&\n `\n rounded-full\n shadow-[0px_1px_3px_rgba(0,0,0,0.1),0px_1px_2px_-1px_rgba(0,0,0,0.1)]\n `,\n className,\n );\n\n const content = (\n <span className={cn('inline-flex items-center', !isIcon && 'gap-2')}>{children}</span>\n );\n\n return (\n <ButtonPrimitive\n className={baseClass}\n ref={ref}\n render={asChildRender(asChild, children)}\n type={type}\n {...props}\n >\n {asChild ? undefined : content}\n </ButtonPrimitive>\n );\n}\n\nexport { buttonVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,MAAa,qBAAqB,GAGhC;;;KAKA;;;KAMA,0CACF;;AAGA,MAAM,kBAAkB;;;AAIxB,SAAgB,oBAAoB,SAAiC;CACnE,QAAQ,SAAR;EACE,KAAK,WACH,OAAO,GAEL,6DACA,wCAGA,uCACA,0CAEA,oCACA,iBACA,+CACF;EACF,KAAK,eACH,OAAO,GACL,qEACA,4CAGA,iDACA,8CACA,oCACA,iBACA,mDACF;EACF,KAAK,uBAIH,OAAO,GACL;;;WAMA;;;;WAKA;;;WAKA,iEACA,iBACA,uEACF;EACF,KAAK,WACH,OAAO,GAKL;;;WASA;;;WAIA;;;WAKA,qDACA,iBACA,uEACF;EACF,KAAK,SAMH,OAAO,GACL,8CAIA,wEAGA,2CACA;;;WAIA,oCACA,iBACA,yBACF;EACF,KAAK,QAGH,OAAO,GACL;;;WAIA,+DAEA,qCACA,wBAIA,yDACA;;;;;WAMA,iEACA,kDACF;EAGF,SACE,OAAO,GAGL;;;WAIA,wCACA,0CACA,oCACA,iBACA,+CACF;CACJ;AACF;;AAGA,SAAgB,iBACd,SACgD;CAChD,QAAQ,SAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,SACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAEA,SAAgB,OAAO,EACrB,WACA,UAAU,WACV,MACA,UAAU,OACV,QAAQ,WACR,OAAO,UACP,KACA,UACA,GAAG,SACW;CACd,MAAM,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,MAAM;CACjE,MAAM,SAAS,YAAY;CAE3B,MAAM,YAAY,GAChB,CAAC,UAAU,eAAe;EAAE,SAAS,iBAAiB,OAAO;EAAG;CAAK,CAAC,GAGtE,CAAC,WAAW,UAAU,SAAS,sBAAsB,iBAIrD,CAAC,UAAU,CAAC,UAAU,gCAItB,CAAC,UACC,CAAC,WACA,SAAS,OAAO,YAAY,SAAS,OAAO,YAAY,SAAS,OAAO,KAAK,cAIhF,CAAC,UAAU,eACX,oBAAoB,OAAO,GAC3B,oBACA,CAAC,UAAU,UAAU,UAAU,UAC/B,UACE;;;SAIF,SACF;CAEA,MAAM,UACJ,oBAAC,QAAD;EAAM,WAAW,GAAG,4BAA4B,CAAC,UAAU,OAAO;EAAI;CAAe,CAAA;CAGvF,OACE,oBAACA,UAAD;EACE,WAAW;EACN;EACL,QAAQ,cAAc,SAAS,QAAQ;EACjC;EACN,GAAI;EAEH,UAAA,UAAU,KAAA,IAAY;CACR,CAAA;AAErB"}
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ const require_utils = require("../../lib/utils.cjs");
3
+ const require_button = require("../../primitives/button.cjs");
4
+ const require_Button = require("./Button.cjs");
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ //#region src/components/button/anchorVariants.tsx
7
+ /**
8
+ * Class variants for real `<a>` elements styled like `Button` chrome.
9
+ *
10
+ * Base UI's Button enforces button semantics and its docs forbid rendering
11
+ * links through the `render` prop, and the package's `asChild` leaves
12
+ * `nativeButton={true}` — anchors through it keep `role="button"` and log a
13
+ * dev-console error. This helper bakes in exactly the wrapper chrome the
14
+ * `Button` component applies, so consumers can style a plain anchor instead
15
+ * of replicating package internals:
16
+ *
17
+ * ```tsx
18
+ * <a className={anchorVariants({ variant: 'primary', width: 'full' })} href="…">
19
+ * Open dashboard
20
+ * </a>
21
+ * ```
22
+ *
23
+ * Class output is equivalent to `Button variant=… width=…` (ignoring
24
+ * `disabled:*`, which does not apply to anchors), with anchor-safe focus
25
+ * treatment: `:focus-visible` works natively on `<a>` elements, and the
26
+ * shared outline-based focus ring lands the same way.
27
+ */
28
+ function anchorVariants({ variant = "default", width = "default", size, className } = {}) {
29
+ const isIcon = typeof size === "string" && size.startsWith("icon");
30
+ return require_utils.cn(require_button.buttonVariants({
31
+ variant: require_Button.primitiveVariant(variant),
32
+ size
33
+ }), width === "full" ? "rounded-berget-xs" : "rounded-full", !isIcon && "h-auto px-[0.8em] py-[0.4em]", !isIcon && (size === "lg" ? "text-lg" : size === "sm" ? "text-sm" : size === "xs" ? "" : `text-base`), !isIcon && "font-normal", require_Button.brandVariantClasses(variant), require_Button.interactionClasses, width === "full" && "w-full", className);
34
+ }
35
+ /** Ready-to-use anchor styled through {@link anchorVariants}. For cases
36
+ * where a component (rather than a class string) is easier to consume. */
37
+ function Anchor({ variant, width, size, className, children, ...props }) {
38
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
39
+ className: anchorVariants({
40
+ variant,
41
+ width,
42
+ size,
43
+ className
44
+ }),
45
+ ...props,
46
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
47
+ className: "inline-flex items-center gap-2",
48
+ children
49
+ })
50
+ });
51
+ }
52
+ //#endregion
53
+ exports.Anchor = Anchor;
54
+ exports.anchorVariants = anchorVariants;
55
+
56
+ //# sourceMappingURL=anchorVariants.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchorVariants.cjs","names":["cn","buttonVariants","primitiveVariant","brandVariantClasses","interactionClasses"],"sources":["../../../src/components/button/anchorVariants.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { cn } from '../../lib/utils';\nimport { buttonVariants } from '../../primitives/button';\nimport type { VariantProps } from 'class-variance-authority';\nimport {\n brandVariantClasses,\n interactionClasses,\n primitiveVariant,\n type CustomVariant,\n} from './Button';\n\n/** Props for {@link anchorVariants}. Consumes like `buttonVariants` with the\n * same variant union as the `Button` wrapper. */\nexport interface AnchorVariantsProps {\n /** Visual style variant — same union as `Button`'s `variant` prop. */\n variant?: CustomVariant;\n /** Full width or auto width. */\n width?: 'default' | 'full';\n /** Button size ladder — maps to the same text scale as `Button`. */\n size?: VariantProps<typeof buttonVariants>['size'];\n /** Extra classes, merged last (same override position as `Button`). */\n className?: string;\n}\n\n/**\n * Class variants for real `<a>` elements styled like `Button` chrome.\n *\n * Base UI's Button enforces button semantics and its docs forbid rendering\n * links through the `render` prop, and the package's `asChild` leaves\n * `nativeButton={true}` — anchors through it keep `role=\"button\"` and log a\n * dev-console error. This helper bakes in exactly the wrapper chrome the\n * `Button` component applies, so consumers can style a plain anchor instead\n * of replicating package internals:\n *\n * ```tsx\n * <a className={anchorVariants({ variant: 'primary', width: 'full' })} href=\"…\">\n * Open dashboard\n * </a>\n * ```\n *\n * Class output is equivalent to `Button variant=… width=…` (ignoring\n * `disabled:*`, which does not apply to anchors), with anchor-safe focus\n * treatment: `:focus-visible` works natively on `<a>` elements, and the\n * shared outline-based focus ring lands the same way.\n */\nexport function anchorVariants({\n variant = 'default',\n width = 'default',\n size,\n className,\n}: AnchorVariantsProps = {}): string {\n const isIcon = typeof size === 'string' && size.startsWith('icon');\n\n return cn(\n buttonVariants({ variant: primitiveVariant(variant), size }),\n // Full-width anchors use the square radius; otherwise pill (same rule\n // as the Button wrapper).\n width === 'full' ? 'rounded-berget-xs' : 'rounded-full',\n // Em-based padding, inline = 2× block, matching the Button wrapper.\n !isIcon && 'h-auto px-[0.8em] py-[0.4em]',\n // Text ladder: default renders at text-base like the wrapper Button.\n !isIcon &&\n (size === 'lg' ? 'text-lg' : size === 'sm' ? 'text-sm' : size === 'xs' ? '' : `text-base`),\n !isIcon && 'font-normal',\n brandVariantClasses(variant),\n interactionClasses,\n width === 'full' && 'w-full',\n className,\n );\n}\n\nexport type AnchorProps = React.ComponentProps<'a'> & AnchorVariantsProps;\n\n/** Ready-to-use anchor styled through {@link anchorVariants}. For cases\n * where a component (rather than a class string) is easier to consume. */\nexport function Anchor({ variant, width, size, className, children, ...props }: AnchorProps) {\n return (\n <a className={anchorVariants({ variant, width, size, className })} {...props}>\n <span className=\"inline-flex items-center gap-2\">{children}</span>\n </a>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,eAAe,EAC7B,UAAU,WACV,QAAQ,WACR,MACA,cACuB,CAAC,GAAW;CACnC,MAAM,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,MAAM;CAEjE,OAAOA,cAAAA,GACLC,eAAAA,eAAe;EAAE,SAASC,eAAAA,iBAAiB,OAAO;EAAG;CAAK,CAAC,GAG3D,UAAU,SAAS,sBAAsB,gBAEzC,CAAC,UAAU,gCAEX,CAAC,WACE,SAAS,OAAO,YAAY,SAAS,OAAO,YAAY,SAAS,OAAO,KAAK,cAChF,CAAC,UAAU,eACXC,eAAAA,oBAAoB,OAAO,GAC3BC,eAAAA,oBACA,UAAU,UAAU,UACpB,SACF;AACF;;;AAMA,SAAgB,OAAO,EAAE,SAAS,OAAO,MAAM,WAAW,UAAU,GAAG,SAAsB;CAC3F,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EAAG,WAAW,eAAe;GAAE;GAAS;GAAO;GAAM;EAAU,CAAC;EAAG,GAAI;EACrE,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,WAAU;GAAkC;EAAe,CAAA;CAChE,CAAA;AAEP"}
@@ -0,0 +1,45 @@
1
+ import { buttonVariants } from "../../primitives/button.cjs";
2
+ import { CustomVariant } from "./Button.cjs";
3
+ import * as React from "react";
4
+ import { VariantProps } from "class-variance-authority";
5
+ //#region src/components/button/anchorVariants.d.ts
6
+ /** Props for {@link anchorVariants}. Consumes like `buttonVariants` with the
7
+ * same variant union as the `Button` wrapper. */
8
+ export interface AnchorVariantsProps {
9
+ /** Visual style variant — same union as `Button`'s `variant` prop. */
10
+ variant?: CustomVariant;
11
+ /** Full width or auto width. */
12
+ width?: 'default' | 'full';
13
+ /** Button size ladder — maps to the same text scale as `Button`. */
14
+ size?: VariantProps<typeof buttonVariants>['size'];
15
+ /** Extra classes, merged last (same override position as `Button`). */
16
+ className?: string;
17
+ }
18
+ /**
19
+ * Class variants for real `<a>` elements styled like `Button` chrome.
20
+ *
21
+ * Base UI's Button enforces button semantics and its docs forbid rendering
22
+ * links through the `render` prop, and the package's `asChild` leaves
23
+ * `nativeButton={true}` — anchors through it keep `role="button"` and log a
24
+ * dev-console error. This helper bakes in exactly the wrapper chrome the
25
+ * `Button` component applies, so consumers can style a plain anchor instead
26
+ * of replicating package internals:
27
+ *
28
+ * ```tsx
29
+ * <a className={anchorVariants({ variant: 'primary', width: 'full' })} href="…">
30
+ * Open dashboard
31
+ * </a>
32
+ * ```
33
+ *
34
+ * Class output is equivalent to `Button variant=… width=…` (ignoring
35
+ * `disabled:*`, which does not apply to anchors), with anchor-safe focus
36
+ * treatment: `:focus-visible` works natively on `<a>` elements, and the
37
+ * shared outline-based focus ring lands the same way.
38
+ */
39
+ export declare function anchorVariants({ variant, width, size, className }?: AnchorVariantsProps): string;
40
+ export type AnchorProps = React.ComponentProps<'a'> & AnchorVariantsProps;
41
+ /** Ready-to-use anchor styled through {@link anchorVariants}. For cases
42
+ * where a component (rather than a class string) is easier to consume. */
43
+ export declare function Anchor({ variant, width, size, className, children, ...props }: AnchorProps): import("react/jsx-runtime").JSX.Element;
44
+ //#endregion
45
+ //# sourceMappingURL=anchorVariants.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchorVariants.d.cts","names":[],"sources":["../../../src/components/button/anchorVariants.tsx"],"mappings":";;;;;;;iBAeiB;;EAEf,UAAU;;EAEV;;EAEA,OAAO,oBAAoB;;EAE3B;;;;;;;;;;;;;;;;;;;;;;;wBAwBc,iBACd,SACA,OACA,MACA,cACC;YAqBS,cAAc,MAAM,sBAAsB;;;wBAItC,SAAS,SAAS,OAAO,MAAM,WAAW,aAAa,SAAS,0CAAW,IAAA"}
@@ -0,0 +1,45 @@
1
+ import { buttonVariants } from "../../primitives/button.mjs";
2
+ import { CustomVariant } from "./Button.mjs";
3
+ import * as React from "react";
4
+ import { VariantProps } from "class-variance-authority";
5
+ //#region src/components/button/anchorVariants.d.ts
6
+ /** Props for {@link anchorVariants}. Consumes like `buttonVariants` with the
7
+ * same variant union as the `Button` wrapper. */
8
+ export interface AnchorVariantsProps {
9
+ /** Visual style variant — same union as `Button`'s `variant` prop. */
10
+ variant?: CustomVariant;
11
+ /** Full width or auto width. */
12
+ width?: 'default' | 'full';
13
+ /** Button size ladder — maps to the same text scale as `Button`. */
14
+ size?: VariantProps<typeof buttonVariants>['size'];
15
+ /** Extra classes, merged last (same override position as `Button`). */
16
+ className?: string;
17
+ }
18
+ /**
19
+ * Class variants for real `<a>` elements styled like `Button` chrome.
20
+ *
21
+ * Base UI's Button enforces button semantics and its docs forbid rendering
22
+ * links through the `render` prop, and the package's `asChild` leaves
23
+ * `nativeButton={true}` — anchors through it keep `role="button"` and log a
24
+ * dev-console error. This helper bakes in exactly the wrapper chrome the
25
+ * `Button` component applies, so consumers can style a plain anchor instead
26
+ * of replicating package internals:
27
+ *
28
+ * ```tsx
29
+ * <a className={anchorVariants({ variant: 'primary', width: 'full' })} href="…">
30
+ * Open dashboard
31
+ * </a>
32
+ * ```
33
+ *
34
+ * Class output is equivalent to `Button variant=… width=…` (ignoring
35
+ * `disabled:*`, which does not apply to anchors), with anchor-safe focus
36
+ * treatment: `:focus-visible` works natively on `<a>` elements, and the
37
+ * shared outline-based focus ring lands the same way.
38
+ */
39
+ export declare function anchorVariants({ variant, width, size, className }?: AnchorVariantsProps): string;
40
+ export type AnchorProps = React.ComponentProps<'a'> & AnchorVariantsProps;
41
+ /** Ready-to-use anchor styled through {@link anchorVariants}. For cases
42
+ * where a component (rather than a class string) is easier to consume. */
43
+ export declare function Anchor({ variant, width, size, className, children, ...props }: AnchorProps): import("react/jsx-runtime").JSX.Element;
44
+ //#endregion
45
+ //# sourceMappingURL=anchorVariants.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchorVariants.d.mts","names":[],"sources":["../../../src/components/button/anchorVariants.tsx"],"mappings":";;;;;;;iBAeiB;;EAEf,UAAU;;EAEV;;EAEA,OAAO,oBAAoB;;EAE3B;;;;;;;;;;;;;;;;;;;;;;;wBAwBc,iBACd,SACA,OACA,MACA,cACC;YAqBS,cAAc,MAAM,sBAAsB;;;wBAItC,SAAS,SAAS,OAAO,MAAM,WAAW,aAAa,SAAS,0CAAW,IAAA"}
@@ -0,0 +1,55 @@
1
+ "use client";
2
+ import { cn } from "../../lib/utils.mjs";
3
+ import { buttonVariants } from "../../primitives/button.mjs";
4
+ import { brandVariantClasses, interactionClasses, primitiveVariant } from "./Button.mjs";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/components/button/anchorVariants.tsx
7
+ /**
8
+ * Class variants for real `<a>` elements styled like `Button` chrome.
9
+ *
10
+ * Base UI's Button enforces button semantics and its docs forbid rendering
11
+ * links through the `render` prop, and the package's `asChild` leaves
12
+ * `nativeButton={true}` — anchors through it keep `role="button"` and log a
13
+ * dev-console error. This helper bakes in exactly the wrapper chrome the
14
+ * `Button` component applies, so consumers can style a plain anchor instead
15
+ * of replicating package internals:
16
+ *
17
+ * ```tsx
18
+ * <a className={anchorVariants({ variant: 'primary', width: 'full' })} href="…">
19
+ * Open dashboard
20
+ * </a>
21
+ * ```
22
+ *
23
+ * Class output is equivalent to `Button variant=… width=…` (ignoring
24
+ * `disabled:*`, which does not apply to anchors), with anchor-safe focus
25
+ * treatment: `:focus-visible` works natively on `<a>` elements, and the
26
+ * shared outline-based focus ring lands the same way.
27
+ */
28
+ function anchorVariants({ variant = "default", width = "default", size, className } = {}) {
29
+ const isIcon = typeof size === "string" && size.startsWith("icon");
30
+ return cn(buttonVariants({
31
+ variant: primitiveVariant(variant),
32
+ size
33
+ }), width === "full" ? "rounded-berget-xs" : "rounded-full", !isIcon && "h-auto px-[0.8em] py-[0.4em]", !isIcon && (size === "lg" ? "text-lg" : size === "sm" ? "text-sm" : size === "xs" ? "" : `text-base`), !isIcon && "font-normal", brandVariantClasses(variant), interactionClasses, width === "full" && "w-full", className);
34
+ }
35
+ /** Ready-to-use anchor styled through {@link anchorVariants}. For cases
36
+ * where a component (rather than a class string) is easier to consume. */
37
+ function Anchor({ variant, width, size, className, children, ...props }) {
38
+ return /* @__PURE__ */ jsx("a", {
39
+ className: anchorVariants({
40
+ variant,
41
+ width,
42
+ size,
43
+ className
44
+ }),
45
+ ...props,
46
+ children: /* @__PURE__ */ jsx("span", {
47
+ className: "inline-flex items-center gap-2",
48
+ children
49
+ })
50
+ });
51
+ }
52
+ //#endregion
53
+ export { Anchor, anchorVariants };
54
+
55
+ //# sourceMappingURL=anchorVariants.mjs.map