@bergetai/ui 0.11.1 → 0.11.3

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' | 'link';
48
+ type CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | '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' | 'link';
48
+ type CustomVariant = 'default' | 'primary' | 'destructive' | 'outline' | '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
@@ -301,9 +301,28 @@ function brandVariantClasses(variant) {
301
301
  disabledClasses,
302
302
  "disabled:bg-berget-button-destructive-disabled-bg"
303
303
  );
304
+ case "outline":
305
+ return cn(
306
+ // Transparent fill with a theme-foreground-derived border (25% of the
307
+ // foreground). The state treatment is static: hover, press and
308
+ // keyboard focus render identically to rest — only the shared focus
309
+ // outline and the disabled treatment deviate.
310
+ "bg-transparent border-berget-button-outline-border text-berget-button-outline-fg",
311
+ // Hover: slight brightening (hover bg token); the border and
312
+ // foreground stay at rest. The dark:hover twin also neutralises
313
+ // the primitive ghost's dark:hover:bg-muted/50. Pressed drops the
314
+ // fill back to transparent (a pressed element is still hovered, so
315
+ // an explicit active override is needed in both colour schemes).
316
+ "hover:bg-berget-button-outline-hover dark:hover:bg-berget-button-outline-hover",
317
+ "active:bg-transparent dark:active:bg-transparent",
318
+ // Keep the resting border on focus — the shared outline is the indicator.
319
+ "focus-visible:border-berget-button-outline-border",
320
+ disabledClasses,
321
+ "disabled:bg-transparent disabled:border-berget-button-disabled-border"
322
+ );
304
323
  case "link":
305
324
  return cn(
306
- "h-auto bg-transparent p-0 text-berget-button-link-fg underline-offset-4 shadow-none",
325
+ "h-auto bg-transparent p-0 text-berget-button-link-fg font-medium underline-offset-4 shadow-none",
307
326
  "hover:bg-transparent hover:text-berget-button-link-hover-fg",
308
327
  // On press, return to the resting foreground (hover fg otherwise sticks).
309
328
  "active:text-berget-button-link-fg",
@@ -334,6 +353,7 @@ function primitiveVariant(variant) {
334
353
  switch (variant) {
335
354
  case "primary":
336
355
  case "destructive":
356
+ case "outline":
337
357
  return "ghost";
338
358
  default:
339
359
  return variant;
@@ -362,6 +382,14 @@ function Button2({
362
382
  // larger button text. h-auto drops the primitive's fixed h-* so the
363
383
  // vertical paddings take effect.
364
384
  !isLink && !isIcon && "py-[0.57em] px-[1.14em] h-auto",
385
+ // Text ladder: size = typography scale; the em-based padding above
386
+ // follows automatically, so no per-size paddings are needed. Only
387
+ // default/lg/sm need overrides — xs keeps the primitive's text-xs.
388
+ !isLink && !isIcon && (size === "lg" ? "text-lg" : size === "sm" ? "text-sm" : size === "xs" ? "" : "text-base"),
389
+ // Normal weight for every non-link variant — tailwind-merge strips the
390
+ // primitive's font-medium (font-weight: var(--font-weight-medium)); the
391
+ // link variant keeps medium via its own classes above.
392
+ !isLink && "font-normal",
365
393
  brandVariantClasses(variant),
366
394
  interactionClasses,
367
395
  !isLink && width === "full" && "w-full",
@@ -3715,97 +3743,33 @@ Box.displayName = "Box";
3715
3743
 
3716
3744
  // src/components/language-select/LanguageSelect.tsx
3717
3745
  import * as React27 from "react";
3718
- import { Select as SelectPrimitive2 } from "@base-ui/react/select";
3719
3746
  import { Globe as Globe2 } from "lucide-react";
3720
3747
  import { jsx as jsx42, jsxs as jsxs22 } from "react/jsx-runtime";
3721
3748
  var LanguageSelect = React27.forwardRef(
3722
3749
  ({ className, options, value, onValueChange }, ref) => {
3723
- return /* @__PURE__ */ jsxs22(
3724
- SelectPrimitive2.Root,
3725
- {
3726
- value,
3727
- onValueChange: onValueChange ? (v) => onValueChange(v ?? "") : void 0,
3728
- children: [
3729
- /* @__PURE__ */ jsxs22(
3730
- SelectPrimitive2.Trigger,
3731
- {
3732
- ref,
3733
- "aria-label": "Select language",
3734
- className: cn(
3735
- // Base styles
3736
- "h-8 w-8 p-0 rounded-full",
3737
- "flex items-center justify-center",
3738
- // Border and background
3739
- "border border-berget-border-subtle",
3740
- "bg-transparent",
3741
- // Hover effect
3742
- "hover:bg-berget-surface-hover",
3743
- // Transitions
3744
- "transition-all duration-200",
3745
- // Focus styles - remove all focus rings
3746
- "focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0",
3747
- // Disabled state
3748
- "disabled:cursor-not-allowed disabled:opacity-50",
3749
- className
3750
- ),
3751
- children: [
3752
- /* @__PURE__ */ jsx42("span", { className: "sr-only", children: "Select language" }),
3753
- /* @__PURE__ */ jsx42(Icon, { icon: Globe2, size: 16, "aria-hidden": true })
3754
- ]
3755
- }
3756
- ),
3757
- /* @__PURE__ */ jsx42(SelectPrimitive2.Portal, { children: /* @__PURE__ */ jsx42(SelectPrimitive2.Positioner, { alignItemWithTrigger: false, className: "isolate z-50", children: /* @__PURE__ */ jsx42(
3758
- SelectPrimitive2.Popup,
3750
+ return /* @__PURE__ */ jsxs22(DropdownMenu, { children: [
3751
+ /* @__PURE__ */ jsx42(DropdownMenuTrigger, { ref, asChild: true, children: /* @__PURE__ */ jsxs22(Button2, { variant: "outline", size: "icon", className, "aria-label": "Select language", children: [
3752
+ /* @__PURE__ */ jsx42("span", { className: "sr-only", children: "Select language" }),
3753
+ /* @__PURE__ */ jsx42(Icon, { icon: Globe2, size: 16, "aria-hidden": true })
3754
+ ] }) }),
3755
+ /* @__PURE__ */ jsx42(DropdownMenuContent, { align: "start", children: /* @__PURE__ */ jsx42(
3756
+ DropdownMenuRadioGroup,
3757
+ {
3758
+ value,
3759
+ onValueChange: onValueChange ? (v) => onValueChange(v) : void 0,
3760
+ children: options.map((option) => /* @__PURE__ */ jsx42(
3761
+ DropdownMenuRadioItem,
3759
3762
  {
3760
- className: cn(
3761
- // Positioning and z-index
3762
- "z-50 min-w-[8rem]",
3763
- // Overflow handling
3764
- "overflow-y-auto overflow-x-hidden",
3765
- // Border and background
3766
- "border border-berget-border bg-berget-background",
3767
- "text-berget-foreground",
3768
- // Shadow
3769
- "shadow-berget-lg",
3770
- // Rounded corners
3771
- "rounded-berget-xs",
3772
- // Animations
3773
- "transition-[opacity,transform]",
3774
- "data-starting-style:opacity-0 data-starting-style:scale-95 data-ending-style:opacity-0 data-ending-style:scale-95",
3775
- // Position-based animations
3776
- "data-[side=bottom]:slide-in-from-top-2",
3777
- "data-[side=left]:slide-in-from-right-2",
3778
- "data-[side=right]:slide-in-from-left-2",
3779
- "data-[side=top]:slide-in-from-bottom-2",
3780
- // Origin for transforms
3781
- "origin-[--transform-origin]"
3782
- ),
3783
- children: /* @__PURE__ */ jsx42(SelectPrimitive2.List, { className: "p-1", children: options.map((option) => /* @__PURE__ */ jsx42(
3784
- SelectPrimitive2.Item,
3785
- {
3786
- value: option.value,
3787
- disabled: option.disabled,
3788
- className: cn(
3789
- // Layout
3790
- "relative flex w-full cursor-default",
3791
- "select-none items-center rounded-sm py-2 px-3",
3792
- // Text
3793
- "text-sm outline-none",
3794
- // Focus/hover styles
3795
- "focus:bg-berget-primary-tint focus:text-berget-foreground",
3796
- "hover:bg-berget-primary-tint",
3797
- // Disabled state
3798
- "data-disabled:pointer-events-none data-disabled:opacity-50"
3799
- ),
3800
- children: /* @__PURE__ */ jsx42(SelectPrimitive2.ItemText, { children: option.label })
3801
- },
3802
- option.value
3803
- )) })
3804
- }
3805
- ) }) })
3806
- ]
3807
- }
3808
- );
3763
+ value: option.value,
3764
+ disabled: option.disabled,
3765
+ closeOnClick: true,
3766
+ children: option.label
3767
+ },
3768
+ option.value
3769
+ ))
3770
+ }
3771
+ ) })
3772
+ ] });
3809
3773
  }
3810
3774
  );
3811
3775
  LanguageSelect.displayName = "LanguageSelect";