@bearmenu/ui 0.7.1 → 0.8.1

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 (128) hide show
  1. package/dist/{chunk-4JOV7FXW.js → chunk-2DEIXTBN.js} +1 -1
  2. package/dist/{chunk-UUJVXN2O.js → chunk-66MAPLXS.js} +3 -1
  3. package/dist/{chunk-Y5D5LP4A.js → chunk-7BWTYWM3.js} +14 -3
  4. package/dist/{chunk-ZFNOCP6W.js → chunk-H3BV4VAG.js} +15 -1
  5. package/dist/{chunk-TL4YU2O5.js → chunk-UKBNQO6Q.js} +2 -2
  6. package/dist/{chunk-UX6SWAKH.js → chunk-UZ3PCIE5.js} +119 -28
  7. package/dist/{chunk-YLNYXPIH.js → chunk-VBA45GLP.js} +1 -1
  8. package/dist/{chunk-A5ONAJCE.js → chunk-VG3PND3D.js} +1 -1
  9. package/dist/{chunk-ZBBUKXM5.js → chunk-X3WMRKOW.js} +1 -1
  10. package/dist/{chunk-HCM6LKM5.js → chunk-XNA2INVQ.js} +2 -2
  11. package/dist/{chunk-AV777R4G.js → chunk-YYGB4G4Q.js} +1 -1
  12. package/dist/components/accordion.js +1 -1
  13. package/dist/components/alert-dialog.js +1 -1
  14. package/dist/components/alert.d.ts +2 -2
  15. package/dist/components/alert.js +1 -1
  16. package/dist/components/avatar.d.ts +10 -1
  17. package/dist/components/avatar.js +41 -14
  18. package/dist/components/badge.d.ts +11 -2
  19. package/dist/components/badge.js +1 -1
  20. package/dist/components/breadcrumb.js +1 -1
  21. package/dist/components/button.d.ts +1 -1
  22. package/dist/components/button.js +1 -1
  23. package/dist/components/calendar.js +3 -3
  24. package/dist/components/card.d.ts +2 -2
  25. package/dist/components/card.js +1 -1
  26. package/dist/components/carousel.js +1 -1
  27. package/dist/components/circular-progress.js +1 -1
  28. package/dist/components/combobox.js +3 -3
  29. package/dist/components/command.d.ts +15 -15
  30. package/dist/components/command.js +1 -1
  31. package/dist/components/currency-input.js +2 -2
  32. package/dist/components/date-input.d.ts +1 -1
  33. package/dist/components/date-input.js +1 -1
  34. package/dist/components/description-list.js +1 -1
  35. package/dist/components/dropdown-menu.js +1 -1
  36. package/dist/components/empty-state.js +2 -2
  37. package/dist/components/field.js +2 -2
  38. package/dist/components/filter-category-row.js +2 -2
  39. package/dist/components/form.js +1 -1
  40. package/dist/components/haptic-button.js +1 -1
  41. package/dist/components/input-group.js +1 -1
  42. package/dist/components/input.js +1 -1
  43. package/dist/components/item.d.ts +2 -2
  44. package/dist/components/item.js +1 -1
  45. package/dist/components/kbd.js +1 -1
  46. package/dist/components/label.js +1 -1
  47. package/dist/components/link-button.js +1 -1
  48. package/dist/components/multi-select-combobox.js +4 -4
  49. package/dist/components/pagination.js +1 -1
  50. package/dist/components/place-about-tab.d.ts +17 -1
  51. package/dist/components/place-about-tab.js +4 -4
  52. package/dist/components/place-card.js +2 -2
  53. package/dist/components/place-details-mobile.js +7 -7
  54. package/dist/components/place-schedule-week.js +2 -2
  55. package/dist/components/popover.js +1 -1
  56. package/dist/components/searchable-select.js +3 -3
  57. package/dist/components/select.js +2 -2
  58. package/dist/components/selection-bar.js +1 -1
  59. package/dist/components/sheet.d.ts +23 -0
  60. package/dist/components/sheet.js +51 -14
  61. package/dist/components/sliding-panels.js +5 -1
  62. package/dist/components/sonner.js +2 -2
  63. package/dist/components/spinner.d.ts +2 -2
  64. package/dist/components/stepper.js +4 -1
  65. package/dist/components/table.js +1 -1
  66. package/dist/components/tabs.js +1 -1
  67. package/dist/components/tag-group.js +1 -1
  68. package/dist/components/tag.d.ts +2 -2
  69. package/dist/components/tag.js +1 -1
  70. package/dist/components/text.d.ts +21 -3
  71. package/dist/components/text.js +1 -1
  72. package/dist/components/toggle-group.js +1 -1
  73. package/dist/components/toggle.js +1 -1
  74. package/dist/lib/card-hover.d.ts +75 -0
  75. package/dist/lib/card-hover.js +18 -0
  76. package/package.json +1 -1
  77. package/src/components/accordion.tsx +1 -1
  78. package/src/components/avatar.stories.tsx +59 -26
  79. package/src/components/avatar.test.tsx +129 -0
  80. package/src/components/avatar.tsx +93 -37
  81. package/src/components/badge.tsx +15 -3
  82. package/src/components/breadcrumb.tsx +1 -1
  83. package/src/components/button.tsx +16 -1
  84. package/src/components/calendar.tsx +2 -2
  85. package/src/components/circular-progress.tsx +1 -1
  86. package/src/components/command.tsx +2 -2
  87. package/src/components/currency-input.tsx +1 -1
  88. package/src/components/description-list.tsx +1 -1
  89. package/src/components/dropdown-menu.tsx +1 -1
  90. package/src/components/field.tsx +1 -1
  91. package/src/components/input-group.tsx +1 -1
  92. package/src/components/input.tsx +1 -1
  93. package/src/components/item.tsx +1 -1
  94. package/src/components/kbd.tsx +1 -1
  95. package/src/components/label.tsx +1 -1
  96. package/src/components/place-about-tab.tsx +131 -18
  97. package/src/components/place-card.tsx +1 -1
  98. package/src/components/place-details-mobile.tsx +2 -2
  99. package/src/components/popover.tsx +9 -1
  100. package/src/components/select.tsx +2 -2
  101. package/src/components/selection-bar.tsx +1 -1
  102. package/src/components/sheet.tsx +72 -12
  103. package/src/components/sliding-panels.stories.tsx +70 -0
  104. package/src/components/sliding-panels.test.tsx +116 -0
  105. package/src/components/sliding-panels.tsx +14 -0
  106. package/src/components/sonner.tsx +2 -2
  107. package/src/components/stepper.tsx +4 -1
  108. package/src/components/table.tsx +1 -1
  109. package/src/components/tabs.tsx +1 -1
  110. package/src/components/tag-group.tsx +1 -1
  111. package/src/components/tag.tsx +1 -1
  112. package/src/components/text.test.tsx +37 -3
  113. package/src/components/text.tsx +32 -3
  114. package/src/components/toggle.tsx +1 -1
  115. package/src/globals.css +53 -11
  116. package/src/lib/card-hover.ts +87 -0
  117. package/dist/chunk-EBAMCZDW.js +0 -112
  118. package/dist/chunk-VQNDZVI7.js +0 -106
  119. package/dist/components/toast.d.ts +0 -18
  120. package/dist/components/toast.js +0 -3
  121. package/dist/components/toaster.d.ts +0 -5
  122. package/dist/components/toaster.js +0 -25
  123. package/dist/components/use-toast.d.ts +0 -42
  124. package/dist/components/use-toast.js +0 -2
  125. package/src/components/toast.stories.tsx +0 -63
  126. package/src/components/toast.tsx +0 -130
  127. package/src/components/toaster.tsx +0 -31
  128. package/src/components/use-toast.ts +0 -180
@@ -26,32 +26,69 @@ var SheetOverlay = React.forwardRef((_a, ref) => {
26
26
  });
27
27
  SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
28
28
  var sheetVariants = cva(
29
- "fixed z-[1000] gap-4 bg-background border-border p-6 shadow-2xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:duration-[var(--duration-deliberate)] data-[state=closed]:duration-[var(--duration-exit-standard)] data-[state=open]:ease-[var(--ease-enter)] data-[state=closed]:ease-[var(--ease-exit)]",
29
+ "fixed z-[1000] gap-4 bg-background border-border shadow-2xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:duration-[var(--duration-deliberate)] data-[state=closed]:duration-[var(--duration-exit-standard)] data-[state=open]:ease-[var(--ease-enter)] data-[state=closed]:ease-[var(--ease-exit)]",
30
30
  {
31
31
  variants: {
32
32
  side: {
33
- top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
34
- bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom rounded-t-2xl",
35
- left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm rounded-r-2xl",
36
- right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm rounded-l-2xl"
33
+ top: "inset-x-0 top-0 data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
34
+ bottom: "inset-x-0 bottom-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
35
+ left: "inset-y-0 left-0 h-full w-3/4 data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",
36
+ right: "inset-y-0 right-0 h-full w-3/4 data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right"
37
+ },
38
+ attachment: {
39
+ edge: "p-6",
40
+ // Padding is the caller's business here: a detail surface runs a gallery
41
+ // and a sticky action bar to the panel edge, and a fixed p-6 would inset
42
+ // both. `edge` keeps its p-6 so nothing already shipped shifts.
43
+ inset: "rounded-2xl overflow-hidden"
37
44
  }
38
45
  },
46
+ compoundVariants: [
47
+ // `edge` restates exactly what each side carried before `attachment`
48
+ // existed — the seam border and the two inward-facing corners. Kept as
49
+ // compounds rather than left on `side` so `inset` is not fighting them
50
+ // through class-merge order.
51
+ // `sm:max-w-sm` lives here, not on `side`: an inset panel is sized by its
52
+ // caller, and a responsive cap left on `side` cannot be overridden from
53
+ // className — tailwind-merge scopes `sm:max-w-*` and `max-w-*` to
54
+ // different groups, so `max-w-none` loses to it at every width ≥ sm.
55
+ { side: "top", attachment: "edge", class: "border-b" },
56
+ { side: "bottom", attachment: "edge", class: "border-t rounded-t-2xl" },
57
+ { side: "left", attachment: "edge", class: "border-r rounded-r-2xl sm:max-w-sm" },
58
+ { side: "right", attachment: "edge", class: "border-l rounded-l-2xl sm:max-w-sm" },
59
+ // The inset offsets live here rather than on `attachment` because each
60
+ // side has to give up its own edge: a right-side panel clears top, right
61
+ // and bottom but is still anchored to the right.
62
+ { side: "right", attachment: "inset", class: "inset-y-3 right-3 h-auto" },
63
+ { side: "left", attachment: "inset", class: "inset-y-3 left-3 h-auto" },
64
+ { side: "top", attachment: "inset", class: "inset-x-3 top-3" },
65
+ { side: "bottom", attachment: "inset", class: "inset-x-3 bottom-3" }
66
+ ],
39
67
  defaultVariants: {
40
- side: "right"
68
+ side: "right",
69
+ attachment: "edge"
41
70
  }
42
71
  }
43
72
  );
44
73
  var SheetContent = React.forwardRef((_a, ref) => {
45
- var _b = _a, { side = "right", className, children } = _b, props = __objRest(_b, ["side", "className", "children"]);
74
+ var _b = _a, { side = "right", attachment = "edge", className, children, hideClose } = _b, props = __objRest(_b, ["side", "attachment", "className", "children", "hideClose"]);
46
75
  return /* @__PURE__ */ jsxs(SheetPortal, { children: [
47
76
  /* @__PURE__ */ jsx(SheetOverlay, {}),
48
- /* @__PURE__ */ jsxs(SheetPrimitive.Content, __spreadProps(__spreadValues({ ref, className: cn(sheetVariants({ side }), className) }, props), { children: [
49
- children,
50
- /* @__PURE__ */ jsxs(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-lg opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary glass-hover p-2", children: [
51
- /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
52
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
53
- ] })
54
- ] }))
77
+ /* @__PURE__ */ jsxs(
78
+ SheetPrimitive.Content,
79
+ __spreadProps(__spreadValues({
80
+ ref,
81
+ className: cn(sheetVariants({ side, attachment }), className)
82
+ }, props), {
83
+ children: [
84
+ children,
85
+ !hideClose && /* @__PURE__ */ jsxs(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-lg opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary glass-hover p-2", children: [
86
+ /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
87
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
88
+ ] })
89
+ ]
90
+ })
91
+ )
55
92
  ] });
56
93
  });
57
94
  SheetContent.displayName = SheetPrimitive.Content.displayName;
@@ -1,4 +1,4 @@
1
- import { Button } from '../chunk-ZFNOCP6W.js';
1
+ import { Button } from '../chunk-H3BV4VAG.js';
2
2
  import '../chunk-R47NEOSI.js';
3
3
  import { cn } from '../chunk-FEK5XGZW.js';
4
4
  import '../chunk-3GWWZKX7.js';
@@ -53,6 +53,7 @@ var SlidingPanels = ({
53
53
  return /* @__PURE__ */ jsx(
54
54
  "div",
55
55
  {
56
+ "data-slot": "sliding-panels",
56
57
  className: cn(
57
58
  "relative overflow-clip transition-[height] duration-500 ease-[cubic-bezier(0.32,0.72,0,1)]",
58
59
  className
@@ -68,12 +69,15 @@ var SlidingPanels = ({
68
69
  ref: (el) => {
69
70
  panelRefs.current[index] = el;
70
71
  },
72
+ "data-slot": "sliding-panel",
73
+ "data-state": isActive ? "active" : "inactive",
71
74
  className: cn(
72
75
  "absolute top-0 left-0 w-full transition-transform duration-500 ease-[cubic-bezier(0.32,0.72,0,1)]",
73
76
  isActive && "translate-x-0",
74
77
  isLeft && "-translate-x-[calc(100%+8px)]",
75
78
  isRight && "translate-x-[calc(100%+8px)]"
76
79
  ),
80
+ inert: !isActive || void 0,
77
81
  "aria-hidden": !isActive,
78
82
  children: [
79
83
  panel.showBackButton && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
@@ -1,5 +1,5 @@
1
1
  import { __objRest, __spreadValues } from '../chunk-3GWWZKX7.js';
2
- import { Loader2Icon, OctagonXIcon, TriangleAlertIcon, InfoIcon, CircleCheckIcon } from 'lucide-react';
2
+ import { Loader2Icon, CircleAlertIcon, TriangleAlertIcon, InfoIcon, CircleCheckIcon } from 'lucide-react';
3
3
  import { useTheme } from 'next-themes';
4
4
  import { Toaster as Toaster$1 } from 'sonner';
5
5
  import { jsx } from 'react/jsx-runtime';
@@ -16,7 +16,7 @@ var Toaster = (_a) => {
16
16
  success: /* @__PURE__ */ jsx(CircleCheckIcon, { className: "size-4" }),
17
17
  info: /* @__PURE__ */ jsx(InfoIcon, { className: "size-4" }),
18
18
  warning: /* @__PURE__ */ jsx(TriangleAlertIcon, { className: "size-4" }),
19
- error: /* @__PURE__ */ jsx(OctagonXIcon, { className: "size-4" }),
19
+ error: /* @__PURE__ */ jsx(CircleAlertIcon, { className: "size-4" }),
20
20
  loading: /* @__PURE__ */ jsx(Loader2Icon, { className: "size-4 animate-spin" })
21
21
  },
22
22
  style: {
@@ -4,11 +4,11 @@ import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const spinnerVariants: (props?: ({
6
6
  size?: "default" | "xs" | "sm" | "lg" | "xl" | null | undefined;
7
- tone?: "inherit" | "default" | "destructive" | "primary" | null | undefined;
7
+ tone?: "default" | "destructive" | "inherit" | "primary" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  declare const Spinner: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & VariantProps<(props?: ({
10
10
  size?: "default" | "xs" | "sm" | "lg" | "xl" | null | undefined;
11
- tone?: "inherit" | "default" | "destructive" | "primary" | null | undefined;
11
+ tone?: "default" | "destructive" | "inherit" | "primary" | null | undefined;
12
12
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
13
13
  /** Visually-hidden label for screen readers. Defaults to "Loading". */
14
14
  label?: string;
@@ -58,8 +58,11 @@ var Stepper = React.forwardRef(
58
58
  {
59
59
  className: cn(
60
60
  "whitespace-nowrap transition-colors",
61
+ // current and complete share a weight; COLOUR carries the
62
+ // state (full → 80% → 40%). `complete` was 500, the one
63
+ // step that is not in the 400/600/700 system.
61
64
  status === "current" && "font-semibold text-foreground",
62
- status === "complete" && "font-medium text-foreground/80",
65
+ status === "complete" && "font-semibold text-foreground/80",
63
66
  status === "upcoming" && "text-foreground/40"
64
67
  ),
65
68
  children: step.title
@@ -51,7 +51,7 @@ var TableFooter = React.forwardRef((_a, ref) => {
51
51
  __spreadValues({
52
52
  ref,
53
53
  "data-slot": "table-footer",
54
- className: cn("border-t border-border bg-muted/50 font-medium [&>tr]:last:border-b-0", className)
54
+ className: cn("border-t border-border bg-muted/50 font-semibold [&>tr]:last:border-b-0", className)
55
55
  }, props)
56
56
  );
57
57
  });
@@ -77,7 +77,7 @@ var TabsTrigger = React.forwardRef((_a, ref) => {
77
77
  ref: composedRef,
78
78
  "data-slot": "tabs-trigger",
79
79
  className: cn(
80
- "relative inline-flex items-center justify-center whitespace-nowrap text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
80
+ "relative inline-flex items-center justify-center whitespace-nowrap text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
81
81
  variant === "pill" && "rounded-xl px-4 py-1.5 text-muted-foreground hover:text-foreground data-[state=active]:text-foreground",
82
82
  variant === "underline" && orientation === "horizontal" && "h-11 rounded-none px-4 text-muted-foreground hover:text-foreground data-[state=active]:text-foreground",
83
83
  variant === "underline" && orientation === "vertical" && "rounded-none px-4 py-2 -mr-px text-muted-foreground hover:text-foreground data-[state=active]:text-foreground justify-start",
@@ -15,7 +15,7 @@ var TagGroup = React.forwardRef((_a, ref) => {
15
15
  className: cn("flex flex-wrap items-center gap-1.5", className)
16
16
  }, props), {
17
17
  children: [
18
- label && !srLabel && /* @__PURE__ */ jsx("span", { className: "mr-1 text-xs font-medium text-muted-foreground", children: label }),
18
+ label && !srLabel && /* @__PURE__ */ jsx("span", { className: "mr-1 text-xs font-semibold text-muted-foreground", children: label }),
19
19
  children
20
20
  ]
21
21
  })
@@ -3,11 +3,11 @@ import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const tagVariants: (props?: ({
6
- variant?: "default" | "destructive" | "outline" | "success" | "warning" | "primary" | null | undefined;
6
+ variant?: "default" | "destructive" | "warning" | "success" | "primary" | "outline" | null | undefined;
7
7
  size?: "default" | "sm" | "lg" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  declare const Tag: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & VariantProps<(props?: ({
10
- variant?: "default" | "destructive" | "outline" | "success" | "warning" | "primary" | null | undefined;
10
+ variant?: "default" | "destructive" | "warning" | "success" | "primary" | "outline" | null | undefined;
11
11
  size?: "default" | "sm" | "lg" | null | undefined;
12
12
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
13
13
  onRemove?: () => void;
@@ -1,3 +1,3 @@
1
- export { Tag, tagVariants } from '../chunk-YLNYXPIH.js';
1
+ export { Tag, tagVariants } from '../chunk-VBA45GLP.js';
2
2
  import '../chunk-FEK5XGZW.js';
3
3
  import '../chunk-3GWWZKX7.js';
@@ -3,10 +3,28 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
3
3
  import * as React from 'react';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
+ /**
7
+ * The type scale is a CLOSED set of roles. Seven carry every surface:
8
+ *
9
+ * h1 page title 30/700
10
+ * h3 section heading 20/600
11
+ * body running prose 16/400 relaxed
12
+ * label row / item title 14/600
13
+ * body-sm secondary fact 14/400
14
+ * overline eyebrow 12/600 uppercase
15
+ * caption fine print 12/400
16
+ *
17
+ * Emphasis, colour and tabular figures are ORTHOGONAL modifiers (`weight`,
18
+ * `color`, className) — they must never be expressed by changing SIZE. A
19
+ * paragraph that steps 16 → 14 mid-sentence to mark its lead reads as two
20
+ * paragraphs jammed together; that is what the modifiers exist for.
21
+ *
22
+ * Weights are 400 / 600 / 700. 500 is not in the system.
23
+ */
6
24
  declare const textVariants: (props?: ({
7
- variant?: "h2" | "h3" | "label" | "body" | "caption" | "h1" | "h4" | "small" | "display" | "body-lg" | "body-sm" | "overline" | null | undefined;
8
- color?: "inherit" | "default" | "destructive" | "muted" | "primary" | "primary-foreground" | null | undefined;
9
- weight?: "bold" | "medium" | "normal" | "semibold" | null | undefined;
25
+ variant?: "small" | "display" | "h1" | "h2" | "h3" | "h4" | "body-lg" | "body" | "body-sm" | "caption" | "label" | "overline" | null | undefined;
26
+ color?: "default" | "destructive" | "inherit" | "muted" | "primary" | "primary-foreground" | null | undefined;
27
+ weight?: "bold" | "normal" | "medium" | "semibold" | null | undefined;
10
28
  leading?: "none" | "normal" | "tight" | "snug" | "relaxed" | "loose" | null | undefined;
11
29
  tracking?: "normal" | "tight" | "wide" | "wider" | null | undefined;
12
30
  wrap?: "balance" | "pretty" | "nowrap" | null | undefined;
@@ -1,3 +1,3 @@
1
- export { Text, textVariants } from '../chunk-Y5D5LP4A.js';
1
+ export { Text, textVariants } from '../chunk-7BWTYWM3.js';
2
2
  import '../chunk-FEK5XGZW.js';
3
3
  import '../chunk-3GWWZKX7.js';
@@ -1,4 +1,4 @@
1
- import { toggleVariants } from '../chunk-ZBBUKXM5.js';
1
+ import { toggleVariants } from '../chunk-X3WMRKOW.js';
2
2
  import { cn } from '../chunk-FEK5XGZW.js';
3
3
  import { __objRest, __spreadProps, __spreadValues } from '../chunk-3GWWZKX7.js';
4
4
  import * as React from 'react';
@@ -1,3 +1,3 @@
1
- export { Toggle, toggleVariants } from '../chunk-ZBBUKXM5.js';
1
+ export { Toggle, toggleVariants } from '../chunk-X3WMRKOW.js';
2
2
  import '../chunk-FEK5XGZW.js';
3
3
  import '../chunk-3GWWZKX7.js';
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Card hover motion tokens — the shared recipe for any card with a cover image.
3
+ *
4
+ * Every card type animates the same set of properties (transform on the card
5
+ * root, transform on the image, box-shadow on the image wrapper) so the timings
6
+ * must stay in lockstep. Defining the tokens in one place is the only way to
7
+ * guarantee a hover that feels identical across a mixed grid.
8
+ *
9
+ * Prefer the COMPOSED tokens (`HOVER_IMAGE_WRAPPER`, `HOVER_IMAGE_MOTION`) over
10
+ * re-assembling a recipe from `HOVER_DURATION` + `HOVER_EASE` + a shadow at the
11
+ * call site. Consumers that did the latter silently shipped without a hover
12
+ * shadow — the transition and the resting shadow were wired up, the hover state
13
+ * simply never was, and nothing failed loudly. One class per element is what
14
+ * stops that.
15
+ *
16
+ * Companion CSS custom properties live in `./globals.css`:
17
+ * --shadow-card-image / --shadow-card-image-hover / --shadow-menu-cover-inset
18
+ * They carry the dark-mode override, so none of these tokens needs a `dark:`
19
+ * twin of every state. A consumer app must NOT redefine them locally — app
20
+ * stylesheets are imported after this one and would silently win.
21
+ *
22
+ * Why we don't animate filter / mix-blend-mode opacity:
23
+ * - filter animations (`saturate`, `brightness`) on <img> are CPU-heavy and
24
+ * can hitch on lower-end devices.
25
+ * - mix-blend-multiply opacity transitions composite at unpredictable frame
26
+ * rates so they never sync with transform/opacity transitions.
27
+ * Restricting hover to transform + box-shadow keeps every element on the same
28
+ * GPU-composited frame, which is what makes the in/out feel perfectly synced.
29
+ */
30
+ declare const HOVER_DURATION = "duration-[320ms]";
31
+ declare const HOVER_EASE = "ease-[cubic-bezier(0.4,0,0.2,1)]";
32
+ /** Apply to the card root — composes the base transform transition. */
33
+ declare const HOVER_MOTION = "transition-transform duration-[320ms] ease-[cubic-bezier(0.4,0,0.2,1)] motion-reduce:transition-none will-change-transform";
34
+ /** Apply to elements that animate box-shadow on hover (image wrappers). */
35
+ declare const HOVER_SHADOW_MOTION = "transition-shadow duration-[320ms] ease-[cubic-bezier(0.4,0,0.2,1)]";
36
+ /** Grid/standard/hero card variants — full lift. */
37
+ declare const HOVER_LIFT_GRID = "[@media(hover:hover)]:hover:-translate-y-1";
38
+ /**
39
+ * Same lift as `HOVER_LIFT_GRID`, but driven by a NAMED `group/card` ancestor
40
+ * instead of the element's own `:hover`.
41
+ *
42
+ * For overlays that must render as SIBLINGS of the interactive card rather than
43
+ * children — e.g. a pill that is itself a button or link, which would be
44
+ * invalid ARIA nested inside the card's own `role="button"` / `<a>`. A sibling
45
+ * can't inherit the card's transform, so it stays pinned while the card lifts
46
+ * out from under it. Putting `group/card` on the shared wrapper and this token
47
+ * on BOTH the card and the overlay moves them as one, and means hovering the
48
+ * overlay lifts the card too (its own `:hover` never fires for a sibling).
49
+ */
50
+ declare const HOVER_LIFT_GRID_GROUP = "[@media(hover:hover)]:group-hover/card:-translate-y-1";
51
+ /** List/compact row variants — half lift since rows are denser. */
52
+ declare const HOVER_LIFT_LIST = "[@media(hover:hover)]:hover:-translate-y-0.5";
53
+ /** Image inside a card — scales subtly on group hover. */
54
+ declare const HOVER_IMAGE_SCALE = "group-hover:scale-[1.05]";
55
+ /** Drop-in className for the `<img>` element inside card image wrappers. */
56
+ declare const HOVER_IMAGE_MOTION = "transition-transform duration-[320ms] ease-[cubic-bezier(0.4,0,0.2,1)] motion-reduce:transition-none will-change-transform group-hover:scale-[1.05]";
57
+ /** Warm image-wrapper shadow that deepens on group hover. */
58
+ declare const HOVER_IMAGE_SHADOW = "shadow-[var(--shadow-card-image)] [@media(hover:hover)]:group-hover:shadow-[var(--shadow-card-image-hover)]";
59
+ /**
60
+ * Same lift, for covers that ALSO carry an inset "well" edge on a generated
61
+ * illustration rather than a photo. `box-shadow` is a single property, so the
62
+ * inset can't be a second `shadow-*` class stacked on `HOVER_IMAGE_SHADOW`; it
63
+ * has to be part of the same value, which is why both states are spelled out.
64
+ */
65
+ declare const HOVER_IMAGE_SHADOW_INSET = "shadow-[var(--shadow-menu-cover-inset),var(--shadow-card-image)] [@media(hover:hover)]:group-hover:shadow-[var(--shadow-menu-cover-inset),var(--shadow-card-image-hover)]";
66
+ /**
67
+ * The whole cover-wrapper recipe: shadow transition + the warm lift. Pair with
68
+ * `HOVER_IMAGE_MOTION` on the image inside (covers that render a generated
69
+ * illustration have no image to scale and use this alone).
70
+ */
71
+ declare const HOVER_IMAGE_WRAPPER = "transition-shadow duration-[320ms] ease-[cubic-bezier(0.4,0,0.2,1)] shadow-[var(--shadow-card-image)] [@media(hover:hover)]:group-hover:shadow-[var(--shadow-card-image-hover)]";
72
+ /** `HOVER_IMAGE_WRAPPER` for the inset-well covers. */
73
+ declare const HOVER_IMAGE_WRAPPER_INSET = "transition-shadow duration-[320ms] ease-[cubic-bezier(0.4,0,0.2,1)] shadow-[var(--shadow-menu-cover-inset),var(--shadow-card-image)] [@media(hover:hover)]:group-hover:shadow-[var(--shadow-menu-cover-inset),var(--shadow-card-image-hover)]";
74
+
75
+ export { HOVER_DURATION, HOVER_EASE, HOVER_IMAGE_MOTION, HOVER_IMAGE_SCALE, HOVER_IMAGE_SHADOW, HOVER_IMAGE_SHADOW_INSET, HOVER_IMAGE_WRAPPER, HOVER_IMAGE_WRAPPER_INSET, HOVER_LIFT_GRID, HOVER_LIFT_GRID_GROUP, HOVER_LIFT_LIST, HOVER_MOTION, HOVER_SHADOW_MOTION };
@@ -0,0 +1,18 @@
1
+ import '../chunk-3GWWZKX7.js';
2
+
3
+ // src/lib/card-hover.ts
4
+ var HOVER_DURATION = "duration-[320ms]";
5
+ var HOVER_EASE = "ease-[cubic-bezier(0.4,0,0.2,1)]";
6
+ var HOVER_MOTION = `transition-transform ${HOVER_DURATION} ${HOVER_EASE} motion-reduce:transition-none will-change-transform`;
7
+ var HOVER_SHADOW_MOTION = `transition-shadow ${HOVER_DURATION} ${HOVER_EASE}`;
8
+ var HOVER_LIFT_GRID = "[@media(hover:hover)]:hover:-translate-y-1";
9
+ var HOVER_LIFT_GRID_GROUP = "[@media(hover:hover)]:group-hover/card:-translate-y-1";
10
+ var HOVER_LIFT_LIST = "[@media(hover:hover)]:hover:-translate-y-0.5";
11
+ var HOVER_IMAGE_SCALE = "group-hover:scale-[1.05]";
12
+ var HOVER_IMAGE_MOTION = `${HOVER_MOTION} ${HOVER_IMAGE_SCALE}`;
13
+ var HOVER_IMAGE_SHADOW = "shadow-[var(--shadow-card-image)] [@media(hover:hover)]:group-hover:shadow-[var(--shadow-card-image-hover)]";
14
+ var HOVER_IMAGE_SHADOW_INSET = "shadow-[var(--shadow-menu-cover-inset),var(--shadow-card-image)] [@media(hover:hover)]:group-hover:shadow-[var(--shadow-menu-cover-inset),var(--shadow-card-image-hover)]";
15
+ var HOVER_IMAGE_WRAPPER = `${HOVER_SHADOW_MOTION} ${HOVER_IMAGE_SHADOW}`;
16
+ var HOVER_IMAGE_WRAPPER_INSET = `${HOVER_SHADOW_MOTION} ${HOVER_IMAGE_SHADOW_INSET}`;
17
+
18
+ export { HOVER_DURATION, HOVER_EASE, HOVER_IMAGE_MOTION, HOVER_IMAGE_SCALE, HOVER_IMAGE_SHADOW, HOVER_IMAGE_SHADOW_INSET, HOVER_IMAGE_WRAPPER, HOVER_IMAGE_WRAPPER_INSET, HOVER_LIFT_GRID, HOVER_LIFT_GRID_GROUP, HOVER_LIFT_LIST, HOVER_MOTION, HOVER_SHADOW_MOTION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bearmenu/ui",
3
- "version": "0.7.1",
3
+ "version": "0.8.1",
4
4
  "description": "BearMenu design system — shared UI tokens, primitives, and components",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -29,7 +29,7 @@ const AccordionTrigger = React.forwardRef<
29
29
  ref={ref}
30
30
  data-slot="accordion-trigger"
31
31
  className={cn(
32
- "flex flex-1 cursor-pointer items-center justify-between py-4 text-sm font-medium text-foreground transition-colors hover:text-foreground/80",
32
+ "flex flex-1 cursor-pointer items-center justify-between py-4 text-sm font-semibold text-foreground transition-colors hover:text-foreground/80",
33
33
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-sm",
34
34
  "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
35
35
  "[&[data-state=open]>svg]:rotate-180",
@@ -1,5 +1,9 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
- import { Avatar, AvatarFallback, AvatarImage } from "./avatar";
2
+ import { Avatar, AvatarFallback, AvatarGroup, AvatarImage, type AvatarSize } from "./avatar";
3
+
4
+ const sizes: AvatarSize[] = ["xs", "sm", "default", "lg", "xl"];
5
+
6
+ const people = ["AB", "CD", "EF", "GH", "IJ", "KL", "MN"];
3
7
 
4
8
  const meta = {
5
9
  title: "Components/Avatar",
@@ -30,37 +34,66 @@ export const Fallback: Story = {
30
34
  export const Sizes: Story = {
31
35
  render: () => (
32
36
  <div className="flex items-center gap-4">
33
- <Avatar className="h-8 w-8">
34
- <AvatarFallback className="text-xs">S</AvatarFallback>
35
- </Avatar>
36
- <Avatar>
37
- <AvatarFallback>MD</AvatarFallback>
38
- </Avatar>
39
- <Avatar className="h-14 w-14">
40
- <AvatarFallback className="text-lg">LG</AvatarFallback>
41
- </Avatar>
42
- <Avatar className="h-20 w-20">
43
- <AvatarFallback className="text-xl">XL</AvatarFallback>
44
- </Avatar>
37
+ {sizes.map((size) => (
38
+ <Avatar key={size} size={size}>
39
+ <AvatarFallback>{size.slice(0, 2).toUpperCase()}</AvatarFallback>
40
+ </Avatar>
41
+ ))}
45
42
  </div>
46
43
  ),
47
44
  };
48
45
 
49
46
  export const Group: Story = {
50
47
  render: () => (
51
- <div className="flex -space-x-3">
52
- <Avatar className="border-2 border-background">
53
- <AvatarFallback>A</AvatarFallback>
54
- </Avatar>
55
- <Avatar className="border-2 border-background">
56
- <AvatarFallback>B</AvatarFallback>
57
- </Avatar>
58
- <Avatar className="border-2 border-background">
59
- <AvatarFallback>C</AvatarFallback>
60
- </Avatar>
61
- <Avatar className="border-2 border-background">
62
- <AvatarFallback className="text-xs">+3</AvatarFallback>
63
- </Avatar>
48
+ <AvatarGroup max={4} spacing="tight">
49
+ {people.map((initials) => (
50
+ <Avatar key={initials}>
51
+ <AvatarFallback>{initials}</AvatarFallback>
52
+ </Avatar>
53
+ ))}
54
+ </AvatarGroup>
55
+ ),
56
+ };
57
+
58
+ /**
59
+ * `AvatarGroup` takes the same `size` union as `Avatar`. It sizes the "+N"
60
+ * overflow chip and is inherited by child avatars, so the row stays one
61
+ * consistent height without per-call-site class overrides.
62
+ */
63
+ export const GroupSizes: Story = {
64
+ render: () => (
65
+ <div className="flex flex-col gap-6">
66
+ {sizes.map((size) => (
67
+ <div key={size} className="flex items-center gap-4">
68
+ <span className="w-16 text-xs text-muted-foreground">{size}</span>
69
+ <AvatarGroup max={3} spacing="tight" size={size}>
70
+ {people.map((initials) => (
71
+ <Avatar key={initials}>
72
+ <AvatarFallback>{initials}</AvatarFallback>
73
+ </Avatar>
74
+ ))}
75
+ </AvatarGroup>
76
+ </div>
77
+ ))}
64
78
  </div>
65
79
  ),
66
80
  };
81
+
82
+ /**
83
+ * An individual `Avatar` can still opt out of the group size — useful for
84
+ * highlighting "you" inside a roster.
85
+ */
86
+ export const GroupSizeOverride: Story = {
87
+ render: () => (
88
+ <AvatarGroup max={4} spacing="tight" size="sm">
89
+ <Avatar size="lg">
90
+ <AvatarFallback>ME</AvatarFallback>
91
+ </Avatar>
92
+ {people.map((initials) => (
93
+ <Avatar key={initials}>
94
+ <AvatarFallback>{initials}</AvatarFallback>
95
+ </Avatar>
96
+ ))}
97
+ </AvatarGroup>
98
+ ),
99
+ };
@@ -0,0 +1,129 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { render, screen } from "@testing-library/react";
3
+ import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup } from "./avatar";
4
+
5
+ // Returned as an array, not a fragment: AvatarGroup counts its direct children,
6
+ // and a fragment would collapse the whole set into one child.
7
+ const members = (count: number) =>
8
+ Array.from({ length: count }, (_, i) => (
9
+ <Avatar key={i}>
10
+ <AvatarFallback>{String.fromCharCode(65 + i)}</AvatarFallback>
11
+ </Avatar>
12
+ ));
13
+
14
+ const overflowChip = () => document.querySelector('[data-slot="avatar-group-overflow"]');
15
+ const avatars = () => Array.from(document.querySelectorAll('[data-slot="avatar"]'));
16
+
17
+ describe("Avatar", () => {
18
+ it("applies the default size scale when no size is given", () => {
19
+ render(
20
+ <Avatar>
21
+ <AvatarFallback>JD</AvatarFallback>
22
+ </Avatar>
23
+ );
24
+ expect(avatars()[0]).toHaveClass("size-10", "text-sm");
25
+ });
26
+
27
+ it("applies an explicit size variant", () => {
28
+ render(
29
+ <Avatar size="xs">
30
+ <AvatarFallback>JD</AvatarFallback>
31
+ </Avatar>
32
+ );
33
+ expect(avatars()[0]).toHaveClass("size-6", "text-[10px]");
34
+ });
35
+
36
+ it("scales AvatarBadge off the avatar size via context", () => {
37
+ render(
38
+ <Avatar size="xl">
39
+ <AvatarFallback>JD</AvatarFallback>
40
+ <AvatarBadge />
41
+ </Avatar>
42
+ );
43
+ expect(document.querySelector('[data-slot="avatar-badge"]')).toHaveClass("size-4");
44
+ });
45
+ });
46
+
47
+ describe("AvatarGroup", () => {
48
+ it("renders no overflow chip when the item count fits within max", () => {
49
+ render(
50
+ <AvatarGroup max={3}>
51
+ {members(3)}
52
+ </AvatarGroup>
53
+ );
54
+ expect(overflowChip()).toBeNull();
55
+ });
56
+
57
+ it("renders a +N overflow chip for the hidden remainder", () => {
58
+ render(
59
+ <AvatarGroup max={2}>
60
+ {members(5)}
61
+ </AvatarGroup>
62
+ );
63
+ expect(screen.getByText("+3")).toBeInTheDocument();
64
+ expect(avatars()).toHaveLength(2);
65
+ });
66
+
67
+ it("keeps the pre-existing chip appearance when no size is passed", () => {
68
+ render(
69
+ <AvatarGroup max={1}>
70
+ {members(3)}
71
+ </AvatarGroup>
72
+ );
73
+ expect(overflowChip()).toHaveClass("size-10", "text-xs");
74
+ });
75
+
76
+ it.each([
77
+ ["xs", "size-6", "text-[9px]"],
78
+ ["sm", "size-8", "text-[10px]"],
79
+ ["default", "size-10", "text-xs"],
80
+ ["lg", "size-12", "text-sm"],
81
+ ["xl", "size-16", "text-base"],
82
+ ] as const)("sizes the overflow chip to match a %s group", (size, sizeClass, textClass) => {
83
+ render(
84
+ <AvatarGroup max={1} size={size}>
85
+ {members(4)}
86
+ </AvatarGroup>
87
+ );
88
+ expect(overflowChip()).toHaveClass(sizeClass, textClass);
89
+ });
90
+
91
+ it("passes the group size down to child avatars", () => {
92
+ render(
93
+ <AvatarGroup max={2} size="sm">
94
+ {members(4)}
95
+ </AvatarGroup>
96
+ );
97
+ for (const avatar of avatars()) {
98
+ expect(avatar).toHaveClass("size-8");
99
+ }
100
+ });
101
+
102
+ it("lets an individual avatar override the group size", () => {
103
+ render(
104
+ <AvatarGroup size="sm">
105
+ <Avatar>
106
+ <AvatarFallback>A</AvatarFallback>
107
+ </Avatar>
108
+ <Avatar size="lg">
109
+ <AvatarFallback>B</AvatarFallback>
110
+ </Avatar>
111
+ </AvatarGroup>
112
+ );
113
+ const [inherited, overridden] = avatars();
114
+ expect(inherited).toHaveClass("size-8");
115
+ expect(overridden).toHaveClass("size-12");
116
+ });
117
+
118
+ it("scales avatar and chip together so the group reads as one row", () => {
119
+ render(
120
+ <AvatarGroup max={2} size="xs">
121
+ {members(9)}
122
+ </AvatarGroup>
123
+ );
124
+ for (const avatar of avatars()) {
125
+ expect(avatar).toHaveClass("size-6");
126
+ }
127
+ expect(overflowChip()).toHaveClass("size-6");
128
+ });
129
+ });