@bergetai/ui 0.11.2 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -45,7 +45,7 @@ declare const buttonVariants: (props?: ({
45
45
  declare function Button$1({ className, variant, size, ...props }: Button$2.Props & VariantProps<typeof buttonVariants>): react_jsx_runtime.JSX.Element;
46
46
 
47
47
  /** Variants exposed by the Berget wrapper. */
48
- type CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | 'link';
48
+ type CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | 'ghost' | 'link';
49
49
  /** Props for the Berget Button wrapper. */
50
50
  interface ButtonProps extends Omit<React$1.ComponentProps<typeof Button$1>, 'variant' | 'ref'> {
51
51
  /** Visual style variant. `primary` is Berget-specific. */
package/dist/index.d.ts CHANGED
@@ -45,7 +45,7 @@ declare const buttonVariants: (props?: ({
45
45
  declare function Button$1({ className, variant, size, ...props }: Button$2.Props & VariantProps<typeof buttonVariants>): react_jsx_runtime.JSX.Element;
46
46
 
47
47
  /** Variants exposed by the Berget wrapper. */
48
- type CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | 'link';
48
+ type CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | 'ghost' | 'link';
49
49
  /** Props for the Berget Button wrapper. */
50
50
  interface ButtonProps extends Omit<React$1.ComponentProps<typeof Button$1>, 'variant' | 'ref'> {
51
51
  /** Visual style variant. `primary` is Berget-specific. */
package/dist/index.js CHANGED
@@ -320,6 +320,21 @@ function brandVariantClasses(variant) {
320
320
  disabledClasses,
321
321
  "disabled:bg-transparent disabled:border-berget-button-disabled-border"
322
322
  );
323
+ case "ghost":
324
+ return cn(
325
+ "bg-transparent text-berget-button-ghost-fg",
326
+ // Pin the foreground on hover — the underlying primitive ghost adds
327
+ // hover:text-foreground, which is the same value here but pinned
328
+ // explicitly for parity with the other fg-token variants.
329
+ "hover:bg-berget-button-ghost-hover hover:text-berget-button-ghost-fg",
330
+ // The dark:hover twin neutralises the primitive ghost's
331
+ // dark:hover:bg-muted/50 so only the token fill applies.
332
+ "dark:hover:bg-berget-button-ghost-hover",
333
+ "active:bg-berget-button-ghost-active dark:active:bg-berget-button-ghost-active",
334
+ "focus-visible:border-transparent",
335
+ disabledClasses,
336
+ "disabled:bg-transparent"
337
+ );
323
338
  case "link":
324
339
  return cn(
325
340
  "h-auto bg-transparent p-0 text-berget-button-link-fg font-medium underline-offset-4 shadow-none",
@@ -354,6 +369,7 @@ function primitiveVariant(variant) {
354
369
  case "primary":
355
370
  case "destructive":
356
371
  case "outline":
372
+ case "ghost":
357
373
  return "ghost";
358
374
  default:
359
375
  return variant;
@@ -3743,97 +3759,33 @@ Box.displayName = "Box";
3743
3759
 
3744
3760
  // src/components/language-select/LanguageSelect.tsx
3745
3761
  import * as React27 from "react";
3746
- import { Select as SelectPrimitive2 } from "@base-ui/react/select";
3747
3762
  import { Globe as Globe2 } from "lucide-react";
3748
3763
  import { jsx as jsx42, jsxs as jsxs22 } from "react/jsx-runtime";
3749
3764
  var LanguageSelect = React27.forwardRef(
3750
3765
  ({ className, options, value, onValueChange }, ref) => {
3751
- return /* @__PURE__ */ jsxs22(
3752
- SelectPrimitive2.Root,
3753
- {
3754
- value,
3755
- onValueChange: onValueChange ? (v) => onValueChange(v ?? "") : void 0,
3756
- children: [
3757
- /* @__PURE__ */ jsxs22(
3758
- SelectPrimitive2.Trigger,
3759
- {
3760
- ref,
3761
- "aria-label": "Select language",
3762
- className: cn(
3763
- // Base styles
3764
- "h-8 w-8 p-0 rounded-full",
3765
- "flex items-center justify-center",
3766
- // Border and background
3767
- "border border-berget-border-subtle",
3768
- "bg-transparent",
3769
- // Hover effect
3770
- "hover:bg-berget-surface-hover",
3771
- // Transitions
3772
- "transition-all duration-200",
3773
- // Focus styles - remove all focus rings
3774
- "focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0",
3775
- // Disabled state
3776
- "disabled:cursor-not-allowed disabled:opacity-50",
3777
- className
3778
- ),
3779
- children: [
3780
- /* @__PURE__ */ jsx42("span", { className: "sr-only", children: "Select language" }),
3781
- /* @__PURE__ */ jsx42(Icon, { icon: Globe2, size: 16, "aria-hidden": true })
3782
- ]
3783
- }
3784
- ),
3785
- /* @__PURE__ */ jsx42(SelectPrimitive2.Portal, { children: /* @__PURE__ */ jsx42(SelectPrimitive2.Positioner, { alignItemWithTrigger: false, className: "isolate z-50", children: /* @__PURE__ */ jsx42(
3786
- SelectPrimitive2.Popup,
3766
+ return /* @__PURE__ */ jsxs22(DropdownMenu, { children: [
3767
+ /* @__PURE__ */ jsx42(DropdownMenuTrigger, { ref, asChild: true, children: /* @__PURE__ */ jsxs22(Button2, { variant: "outline", size: "icon", className, "aria-label": "Select language", children: [
3768
+ /* @__PURE__ */ jsx42("span", { className: "sr-only", children: "Select language" }),
3769
+ /* @__PURE__ */ jsx42(Icon, { icon: Globe2, size: 16, "aria-hidden": true })
3770
+ ] }) }),
3771
+ /* @__PURE__ */ jsx42(DropdownMenuContent, { align: "start", children: /* @__PURE__ */ jsx42(
3772
+ DropdownMenuRadioGroup,
3773
+ {
3774
+ value,
3775
+ onValueChange: onValueChange ? (v) => onValueChange(v) : void 0,
3776
+ children: options.map((option) => /* @__PURE__ */ jsx42(
3777
+ DropdownMenuRadioItem,
3787
3778
  {
3788
- className: cn(
3789
- // Positioning and z-index
3790
- "z-50 min-w-[8rem]",
3791
- // Overflow handling
3792
- "overflow-y-auto overflow-x-hidden",
3793
- // Border and background
3794
- "border border-berget-border bg-berget-background",
3795
- "text-berget-foreground",
3796
- // Shadow
3797
- "shadow-berget-lg",
3798
- // Rounded corners
3799
- "rounded-berget-xs",
3800
- // Animations
3801
- "transition-[opacity,transform]",
3802
- "data-starting-style:opacity-0 data-starting-style:scale-95 data-ending-style:opacity-0 data-ending-style:scale-95",
3803
- // Position-based animations
3804
- "data-[side=bottom]:slide-in-from-top-2",
3805
- "data-[side=left]:slide-in-from-right-2",
3806
- "data-[side=right]:slide-in-from-left-2",
3807
- "data-[side=top]:slide-in-from-bottom-2",
3808
- // Origin for transforms
3809
- "origin-[--transform-origin]"
3810
- ),
3811
- children: /* @__PURE__ */ jsx42(SelectPrimitive2.List, { className: "p-1", children: options.map((option) => /* @__PURE__ */ jsx42(
3812
- SelectPrimitive2.Item,
3813
- {
3814
- value: option.value,
3815
- disabled: option.disabled,
3816
- className: cn(
3817
- // Layout
3818
- "relative flex w-full cursor-default",
3819
- "select-none items-center rounded-sm py-2 px-3",
3820
- // Text
3821
- "text-sm outline-none",
3822
- // Focus/hover styles
3823
- "focus:bg-berget-primary-tint focus:text-berget-foreground",
3824
- "hover:bg-berget-primary-tint",
3825
- // Disabled state
3826
- "data-disabled:pointer-events-none data-disabled:opacity-50"
3827
- ),
3828
- children: /* @__PURE__ */ jsx42(SelectPrimitive2.ItemText, { children: option.label })
3829
- },
3830
- option.value
3831
- )) })
3832
- }
3833
- ) }) })
3834
- ]
3835
- }
3836
- );
3779
+ value: option.value,
3780
+ disabled: option.disabled,
3781
+ closeOnClick: true,
3782
+ children: option.label
3783
+ },
3784
+ option.value
3785
+ ))
3786
+ }
3787
+ ) })
3788
+ ] });
3837
3789
  }
3838
3790
  );
3839
3791
  LanguageSelect.displayName = "LanguageSelect";