@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.cjs CHANGED
@@ -465,9 +465,28 @@ function brandVariantClasses(variant) {
465
465
  disabledClasses,
466
466
  "disabled:bg-berget-button-destructive-disabled-bg"
467
467
  );
468
+ case "outline":
469
+ return cn(
470
+ // Transparent fill with a theme-foreground-derived border (25% of the
471
+ // foreground). The state treatment is static: hover, press and
472
+ // keyboard focus render identically to rest — only the shared focus
473
+ // outline and the disabled treatment deviate.
474
+ "bg-transparent border-berget-button-outline-border text-berget-button-outline-fg",
475
+ // Hover: slight brightening (hover bg token); the border and
476
+ // foreground stay at rest. The dark:hover twin also neutralises
477
+ // the primitive ghost's dark:hover:bg-muted/50. Pressed drops the
478
+ // fill back to transparent (a pressed element is still hovered, so
479
+ // an explicit active override is needed in both colour schemes).
480
+ "hover:bg-berget-button-outline-hover dark:hover:bg-berget-button-outline-hover",
481
+ "active:bg-transparent dark:active:bg-transparent",
482
+ // Keep the resting border on focus — the shared outline is the indicator.
483
+ "focus-visible:border-berget-button-outline-border",
484
+ disabledClasses,
485
+ "disabled:bg-transparent disabled:border-berget-button-disabled-border"
486
+ );
468
487
  case "link":
469
488
  return cn(
470
- "h-auto bg-transparent p-0 text-berget-button-link-fg underline-offset-4 shadow-none",
489
+ "h-auto bg-transparent p-0 text-berget-button-link-fg font-medium underline-offset-4 shadow-none",
471
490
  "hover:bg-transparent hover:text-berget-button-link-hover-fg",
472
491
  // On press, return to the resting foreground (hover fg otherwise sticks).
473
492
  "active:text-berget-button-link-fg",
@@ -498,6 +517,7 @@ function primitiveVariant(variant) {
498
517
  switch (variant) {
499
518
  case "primary":
500
519
  case "destructive":
520
+ case "outline":
501
521
  return "ghost";
502
522
  default:
503
523
  return variant;
@@ -526,6 +546,14 @@ function Button2({
526
546
  // larger button text. h-auto drops the primitive's fixed h-* so the
527
547
  // vertical paddings take effect.
528
548
  !isLink && !isIcon && "py-[0.57em] px-[1.14em] h-auto",
549
+ // Text ladder: size = typography scale; the em-based padding above
550
+ // follows automatically, so no per-size paddings are needed. Only
551
+ // default/lg/sm need overrides — xs keeps the primitive's text-xs.
552
+ !isLink && !isIcon && (size === "lg" ? "text-lg" : size === "sm" ? "text-sm" : size === "xs" ? "" : "text-base"),
553
+ // Normal weight for every non-link variant — tailwind-merge strips the
554
+ // primitive's font-medium (font-weight: var(--font-weight-medium)); the
555
+ // link variant keeps medium via its own classes above.
556
+ !isLink && "font-normal",
529
557
  brandVariantClasses(variant),
530
558
  interactionClasses,
531
559
  !isLink && width === "full" && "w-full",
@@ -3879,97 +3907,33 @@ Box.displayName = "Box";
3879
3907
 
3880
3908
  // src/components/language-select/LanguageSelect.tsx
3881
3909
  var React27 = __toESM(require("react"), 1);
3882
- var import_select3 = require("@base-ui/react/select");
3883
3910
  var import_lucide_react13 = require("lucide-react");
3884
3911
  var import_jsx_runtime42 = require("react/jsx-runtime");
3885
3912
  var LanguageSelect = React27.forwardRef(
3886
3913
  ({ className, options, value, onValueChange }, ref) => {
3887
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
3888
- import_select3.Select.Root,
3889
- {
3890
- value,
3891
- onValueChange: onValueChange ? (v) => onValueChange(v ?? "") : void 0,
3892
- children: [
3893
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
3894
- import_select3.Select.Trigger,
3895
- {
3896
- ref,
3897
- "aria-label": "Select language",
3898
- className: cn(
3899
- // Base styles
3900
- "h-8 w-8 p-0 rounded-full",
3901
- "flex items-center justify-center",
3902
- // Border and background
3903
- "border border-berget-border-subtle",
3904
- "bg-transparent",
3905
- // Hover effect
3906
- "hover:bg-berget-surface-hover",
3907
- // Transitions
3908
- "transition-all duration-200",
3909
- // Focus styles - remove all focus rings
3910
- "focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0",
3911
- // Disabled state
3912
- "disabled:cursor-not-allowed disabled:opacity-50",
3913
- className
3914
- ),
3915
- children: [
3916
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sr-only", children: "Select language" }),
3917
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { icon: import_lucide_react13.Globe, size: 16, "aria-hidden": true })
3918
- ]
3919
- }
3920
- ),
3921
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_select3.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_select3.Select.Positioner, { alignItemWithTrigger: false, className: "isolate z-50", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
3922
- import_select3.Select.Popup,
3914
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(DropdownMenu, { children: [
3915
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DropdownMenuTrigger, { ref, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Button2, { variant: "outline", size: "icon", className, "aria-label": "Select language", children: [
3916
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sr-only", children: "Select language" }),
3917
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { icon: import_lucide_react13.Globe, size: 16, "aria-hidden": true })
3918
+ ] }) }),
3919
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DropdownMenuContent, { align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
3920
+ DropdownMenuRadioGroup,
3921
+ {
3922
+ value,
3923
+ onValueChange: onValueChange ? (v) => onValueChange(v) : void 0,
3924
+ children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
3925
+ DropdownMenuRadioItem,
3923
3926
  {
3924
- className: cn(
3925
- // Positioning and z-index
3926
- "z-50 min-w-[8rem]",
3927
- // Overflow handling
3928
- "overflow-y-auto overflow-x-hidden",
3929
- // Border and background
3930
- "border border-berget-border bg-berget-background",
3931
- "text-berget-foreground",
3932
- // Shadow
3933
- "shadow-berget-lg",
3934
- // Rounded corners
3935
- "rounded-berget-xs",
3936
- // Animations
3937
- "transition-[opacity,transform]",
3938
- "data-starting-style:opacity-0 data-starting-style:scale-95 data-ending-style:opacity-0 data-ending-style:scale-95",
3939
- // Position-based animations
3940
- "data-[side=bottom]:slide-in-from-top-2",
3941
- "data-[side=left]:slide-in-from-right-2",
3942
- "data-[side=right]:slide-in-from-left-2",
3943
- "data-[side=top]:slide-in-from-bottom-2",
3944
- // Origin for transforms
3945
- "origin-[--transform-origin]"
3946
- ),
3947
- children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_select3.Select.List, { className: "p-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
3948
- import_select3.Select.Item,
3949
- {
3950
- value: option.value,
3951
- disabled: option.disabled,
3952
- className: cn(
3953
- // Layout
3954
- "relative flex w-full cursor-default",
3955
- "select-none items-center rounded-sm py-2 px-3",
3956
- // Text
3957
- "text-sm outline-none",
3958
- // Focus/hover styles
3959
- "focus:bg-berget-primary-tint focus:text-berget-foreground",
3960
- "hover:bg-berget-primary-tint",
3961
- // Disabled state
3962
- "data-disabled:pointer-events-none data-disabled:opacity-50"
3963
- ),
3964
- children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_select3.Select.ItemText, { children: option.label })
3965
- },
3966
- option.value
3967
- )) })
3968
- }
3969
- ) }) })
3970
- ]
3971
- }
3972
- );
3927
+ value: option.value,
3928
+ disabled: option.disabled,
3929
+ closeOnClick: true,
3930
+ children: option.label
3931
+ },
3932
+ option.value
3933
+ ))
3934
+ }
3935
+ ) })
3936
+ ] });
3973
3937
  }
3974
3938
  );
3975
3939
  LanguageSelect.displayName = "LanguageSelect";