@bearmenu/ui 0.8.46 → 0.8.48

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.
@@ -6,6 +6,13 @@ import * as React from 'react';
6
6
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
7
7
 
8
8
  var HEADING_CENTRE_LG = "lg:top-[30px]";
9
+ var RULED_STACK = "gap-4 pb-2 lg:gap-0 lg:pb-0";
10
+ function ruleFromLg(items) {
11
+ return items.map((child, index) => /* @__PURE__ */ jsxs("div", { children: [
12
+ index > 0 && /* @__PURE__ */ jsx(Separator, { className: "hidden lg:block" }),
13
+ child
14
+ ] }, index));
15
+ }
9
16
  function TimelineHour({
10
17
  time,
11
18
  role = "hour",
@@ -95,20 +102,14 @@ function TimelineHour({
95
102
  {
96
103
  className: cn(
97
104
  "flex min-w-0 flex-col",
98
- isCards && "gap-4 pb-2 lg:grid lg:grid-cols-2 lg:gap-5 lg:pb-0 lg:pt-3.5 xl:grid-cols-3",
105
+ isCards ? "gap-4 pb-2 lg:grid lg:grid-cols-2 lg:gap-5 lg:pb-0 lg:pt-3.5 xl:grid-cols-3" : RULED_STACK,
99
106
  isCards && isHero && "lg:flex lg:pt-0",
100
107
  isUnscheduled && isCards && "pt-3.5"
101
108
  ),
102
- children: isCards ? items : items.map((child, index) => /* @__PURE__ */ jsxs("div", { children: [
103
- index > 0 && /* @__PURE__ */ jsx(Separator, {}),
104
- child
105
- ] }, index))
109
+ children: isCards ? items : ruleFromLg(items)
106
110
  }
107
111
  ),
108
- overflowItems.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4 pb-2 lg:gap-0 lg:pb-0 lg:pt-2", children: overflowItems.map((child, index) => /* @__PURE__ */ jsxs("div", { children: [
109
- index > 0 && /* @__PURE__ */ jsx(Separator, { className: "hidden lg:block" }),
110
- child
111
- ] }, index)) }),
112
+ overflowItems.length > 0 && /* @__PURE__ */ jsx("div", { className: cn("flex flex-col lg:pt-2", RULED_STACK), children: ruleFromLg(overflowItems) }),
112
113
  note && /* @__PURE__ */ jsx("p", { className: "pt-[9px] text-[11.5px] text-muted-foreground", children: note })
113
114
  ]
114
115
  }
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const badgeVariants: (props?: ({
7
- variant?: "secondary" | "default" | "success" | "warning" | "destructive" | "outline" | "glass" | "overlay" | "brown" | "code" | "onPrimary" | "confirmed" | "pending" | "completed" | "assignee" | "softSuccess" | "softWarning" | "softDestructive" | "softNeutral" | null | undefined;
7
+ variant?: "default" | "secondary" | "success" | "warning" | "destructive" | "outline" | "glass" | "overlay" | "brown" | "code" | "onPrimary" | "confirmed" | "pending" | "completed" | "assignee" | "softSuccess" | "softWarning" | "softDestructive" | "softNeutral" | null | undefined;
8
8
  size?: "status" | "chip" | null | undefined;
9
9
  live?: boolean | null | undefined;
10
10
  } & class_variance_authority_types.ClassProp) | undefined) => string;
@@ -3,8 +3,8 @@ import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const buttonVariants: (props?: ({
6
- variant?: "secondary" | "default" | "link" | "warning" | "destructive" | "outline" | "ghost" | "glass" | "overlay" | "ink" | "brown" | "cta" | null | undefined;
7
- size?: "default" | "icon" | "cta" | "xs" | "sm" | "lg" | "pill" | "cta-sm" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
6
+ variant?: "default" | "link" | "secondary" | "warning" | "destructive" | "outline" | "ghost" | "glass" | "overlay" | "ink" | "brown" | "cta" | null | undefined;
7
+ size?: "icon" | "default" | "cta" | "xs" | "sm" | "lg" | "pill" | "cta-sm" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
8
8
  fullWidth?: boolean | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
@@ -77,6 +77,7 @@ type CoachMarksLabels = {
77
77
  next: string;
78
78
  /** The last stop's forward action, e.g. "Done". */
79
79
  done: string;
80
+ /** The corner X's accessible name, e.g. "Skip tour"; not drawn as text. */
80
81
  skip: string;
81
82
  };
82
83
  type CoachMarksProps = {
@@ -5,7 +5,7 @@ import { cn } from '../chunk-FEK5XGZW.js';
5
5
  import '../chunk-MMUBH76A.js';
6
6
  import { useState, useLayoutEffect, useCallback, useRef, useEffect } from 'react';
7
7
  import { createPortal } from 'react-dom';
8
- import { Lightbulb, ArrowRight } from 'lucide-react';
8
+ import { Lightbulb, X, ArrowRight } from 'lucide-react';
9
9
  import { jsxs, jsx } from 'react/jsx-runtime';
10
10
 
11
11
  var PAD = 8;
@@ -203,14 +203,38 @@ function CoachMarks({
203
203
  style: { left: caretLeft }
204
204
  }
205
205
  ),
206
- /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-[oklch(0.82_0.15_85)] px-2.5 py-1 text-xs font-extrabold uppercase tracking-[0.08em] text-[oklch(0.26_0.03_60)]", children: [
207
- /* @__PURE__ */ jsx(Lightbulb, { className: "h-3 w-3", "aria-hidden": true }),
208
- labels.progress(index + 1, available.length)
206
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
207
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-[oklch(0.82_0.15_85)] px-2.5 py-1 text-xs font-extrabold uppercase tracking-[0.08em] text-[oklch(0.26_0.03_60)]", children: [
208
+ /* @__PURE__ */ jsx(Lightbulb, { className: "h-3 w-3", "aria-hidden": true }),
209
+ labels.progress(index + 1, available.length)
210
+ ] }),
211
+ /* @__PURE__ */ jsx(
212
+ Button,
213
+ {
214
+ type: "button",
215
+ variant: "ghost",
216
+ size: "icon",
217
+ className: "-my-2.5 -mr-2.5 shrink-0 text-muted-foreground hover:text-foreground",
218
+ "aria-label": labels.skip,
219
+ onClick: onClose,
220
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4", "aria-hidden": true })
221
+ }
222
+ )
209
223
  ] }),
210
224
  /* @__PURE__ */ jsx("p", { className: "mt-3 text-base font-semibold leading-snug", children: current.title }),
211
225
  /* @__PURE__ */ jsx("p", { className: "mt-1.5 text-sm leading-relaxed text-muted-foreground", children: current.body }),
212
- /* @__PURE__ */ jsxs("div", { className: "mt-4 flex items-center gap-2", children: [
213
- index > 0 && /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "pill", onClick: () => setIndex(index - 1), children: labels.back }),
226
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 flex flex-wrap items-center justify-end gap-2", children: [
227
+ index > 0 && /* @__PURE__ */ jsx(
228
+ Button,
229
+ {
230
+ type: "button",
231
+ variant: "ghost",
232
+ size: "pill",
233
+ className: "mr-auto",
234
+ onClick: () => setIndex(index - 1),
235
+ children: labels.back
236
+ }
237
+ ),
214
238
  /* @__PURE__ */ jsxs(
215
239
  Button,
216
240
  {
@@ -222,17 +246,6 @@ function CoachMarks({
222
246
  !last && /* @__PURE__ */ jsx(ArrowRight, { "aria-hidden": true })
223
247
  ]
224
248
  }
225
- ),
226
- /* @__PURE__ */ jsx(
227
- Button,
228
- {
229
- type: "button",
230
- variant: "link",
231
- size: "sm",
232
- className: "ml-auto min-h-11",
233
- onClick: onClose,
234
- children: labels.skip
235
- }
236
249
  )
237
250
  ] })
238
251
  ]
@@ -28,7 +28,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
28
28
  ref?: React.Ref<HTMLInputElement>;
29
29
  } & {
30
30
  asChild?: boolean;
31
- }, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "value" | "type"> & {
31
+ }, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "value" | "onChange" | "type"> & {
32
32
  value?: string;
33
33
  onValueChange?: (search: string) => void;
34
34
  } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -64,7 +64,7 @@ declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
64
64
  ref?: React.Ref<HTMLDivElement>;
65
65
  } & {
66
66
  asChild?: boolean;
67
- }, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key">, "heading" | "value"> & {
67
+ }, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key">, "value" | "heading"> & {
68
68
  heading?: React.ReactNode;
69
69
  value?: string;
70
70
  forceMount?: boolean;
@@ -82,7 +82,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
82
82
  ref?: React.Ref<HTMLDivElement>;
83
83
  } & {
84
84
  asChild?: boolean;
85
- }, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key">, "onSelect" | "value" | "disabled"> & {
85
+ }, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key">, "value" | "onSelect" | "disabled"> & {
86
86
  disabled?: boolean;
87
87
  onSelect?: (value: string) => void;
88
88
  value?: string;
@@ -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?: "primary" | "default" | "inherit" | "destructive" | null | undefined;
7
+ tone?: "default" | "inherit" | "primary" | "destructive" | 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?: "primary" | "default" | "inherit" | "destructive" | null | undefined;
11
+ tone?: "default" | "inherit" | "primary" | "destructive" | 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;
@@ -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?: "primary" | "default" | "success" | "warning" | "destructive" | "outline" | "quiet" | null | undefined;
6
+ variant?: "default" | "primary" | "success" | "warning" | "destructive" | "outline" | "quiet" | 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?: "primary" | "default" | "success" | "warning" | "destructive" | "outline" | "quiet" | null | undefined;
10
+ variant?: "default" | "primary" | "success" | "warning" | "destructive" | "outline" | "quiet" | null | undefined;
11
11
  size?: "default" | "sm" | "lg" | null | undefined;
12
12
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
13
13
  onRemove?: () => void;
@@ -22,8 +22,8 @@ import { VariantProps } from 'class-variance-authority';
22
22
  * Weights are 400 / 600 / 700. 500 is not in the system.
23
23
  */
24
24
  declare const textVariants: (props?: ({
25
- variant?: "small" | "body" | "display" | "h2" | "h3" | "label" | "caption" | "h1" | "h4" | "body-lg" | "body-sm" | "overline" | null | undefined;
26
- color?: "primary" | "default" | "inherit" | "destructive" | "muted" | "primary-foreground" | null | undefined;
25
+ variant?: "body" | "small" | "display" | "h2" | "h3" | "label" | "caption" | "h1" | "h4" | "body-lg" | "body-sm" | "overline" | null | undefined;
26
+ color?: "default" | "inherit" | "primary" | "destructive" | "muted" | "primary-foreground" | null | undefined;
27
27
  weight?: "bold" | "medium" | "normal" | "semibold" | null | undefined;
28
28
  leading?: "none" | "normal" | "tight" | "snug" | "relaxed" | "loose" | null | undefined;
29
29
  tracking?: "normal" | "tight" | "wide" | "wider" | null | undefined;
@@ -1,4 +1,4 @@
1
- import { TimelineHourSkeleton } from '../chunk-QRSIJC4X.js';
1
+ import { TimelineHourSkeleton } from '../chunk-S5GDARLW.js';
2
2
  import '../chunk-BRXI6EDO.js';
3
3
  import { Separator } from '../chunk-NWZGSLPU.js';
4
4
  import { Skeleton } from '../chunk-XBBEX4SF.js';
@@ -48,7 +48,8 @@ import * as React from 'react';
48
48
  *
49
49
  * `layout`: `cards` stacks posters with a gap (a card is its own frame, a
50
50
  * hairline between two posters reads as a third object) and from `lg` lays
51
- * them on a two/three-up grid; `rows` rules between children on both widths.
51
+ * them on a two/three-up grid; `rows` is the same gapped stack on the phone
52
+ * (rows are full cards there) and rules between children from `lg`.
52
53
  * Children are read with `Children.toArray`, which drops `null`/`false`, so a
53
54
  * conditional first row never inherits a rule meant for a second; pass rows
54
55
  * as siblings, not inside a fragment.
@@ -1,4 +1,4 @@
1
- export { TimelineHour, TimelineHourSkeleton } from '../chunk-QRSIJC4X.js';
1
+ export { TimelineHour, TimelineHourSkeleton } from '../chunk-S5GDARLW.js';
2
2
  import '../chunk-BRXI6EDO.js';
3
3
  import '../chunk-NWZGSLPU.js';
4
4
  import '../chunk-XBBEX4SF.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bearmenu/ui",
3
- "version": "0.8.46",
3
+ "version": "0.8.48",
4
4
  "description": "BearMenu design system — shared UI tokens, primitives, and components",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -127,7 +127,7 @@ describe("CoachMarks", () => {
127
127
  it("Skip and Escape close; the dimmed page does not", () => {
128
128
  const onClose = vi.fn();
129
129
  render(<Page onClose={onClose} />);
130
- fireEvent.click(screen.getByText("Skip"));
130
+ fireEvent.click(screen.getByRole("button", { name: "Skip" }));
131
131
  fireEvent.keyDown(window, { key: "Escape" });
132
132
  expect(onClose).toHaveBeenCalledTimes(2);
133
133
  expect(screen.getAllByRole("button", { name: "Skip" })).toHaveLength(1);
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
4
4
  import { createPortal } from "react-dom";
5
- import { ArrowRight, Lightbulb } from "lucide-react";
5
+ import { ArrowRight, Lightbulb, X } from "lucide-react";
6
6
  import { cn } from "../lib/utils";
7
7
  import { Button } from "./button";
8
8
 
@@ -86,6 +86,7 @@ export type CoachMarksLabels = {
86
86
  next: string;
87
87
  /** The last stop's forward action, e.g. "Done". */
88
88
  done: string;
89
+ /** The corner X's accessible name, e.g. "Skip tour"; not drawn as text. */
89
90
  skip: string;
90
91
  };
91
92
 
@@ -374,15 +375,35 @@ export function CoachMarks({
374
375
  style={{ left: caretLeft }}
375
376
  />
376
377
  )}
377
- <span className="inline-flex items-center gap-1.5 rounded-full bg-[oklch(0.82_0.15_85)] px-2.5 py-1 text-xs font-extrabold uppercase tracking-[0.08em] text-[oklch(0.26_0.03_60)]">
378
- <Lightbulb className="h-3 w-3" aria-hidden />
379
- {labels.progress(index + 1, available.length)}
380
- </span>
378
+ {/* Skip is chrome, not a step action: the corner X keeps the footer
379
+ to Back and Next, which fit the callout in any locale. */}
380
+ <div className="flex items-center justify-between gap-2">
381
+ <span className="inline-flex items-center gap-1.5 rounded-full bg-[oklch(0.82_0.15_85)] px-2.5 py-1 text-xs font-extrabold uppercase tracking-[0.08em] text-[oklch(0.26_0.03_60)]">
382
+ <Lightbulb className="h-3 w-3" aria-hidden />
383
+ {labels.progress(index + 1, available.length)}
384
+ </span>
385
+ <Button
386
+ type="button"
387
+ variant="ghost"
388
+ size="icon"
389
+ className="-my-2.5 -mr-2.5 shrink-0 text-muted-foreground hover:text-foreground"
390
+ aria-label={labels.skip}
391
+ onClick={onClose}
392
+ >
393
+ <X className="h-4 w-4" aria-hidden />
394
+ </Button>
395
+ </div>
381
396
  <p className="mt-3 text-base font-semibold leading-snug">{current.title}</p>
382
397
  <p className="mt-1.5 text-sm leading-relaxed text-muted-foreground">{current.body}</p>
383
- <div className="mt-4 flex items-center gap-2">
398
+ <div className="mt-4 flex flex-wrap items-center justify-end gap-2">
384
399
  {index > 0 && (
385
- <Button type="button" variant="ghost" size="pill" onClick={() => setIndex(index - 1)}>
400
+ <Button
401
+ type="button"
402
+ variant="ghost"
403
+ size="pill"
404
+ className="mr-auto"
405
+ onClick={() => setIndex(index - 1)}
406
+ >
386
407
  {labels.back}
387
408
  </Button>
388
409
  )}
@@ -394,15 +415,6 @@ export function CoachMarks({
394
415
  {last ? labels.done : labels.next}
395
416
  {!last && <ArrowRight aria-hidden />}
396
417
  </Button>
397
- <Button
398
- type="button"
399
- variant="link"
400
- size="sm"
401
- className="ml-auto min-h-11"
402
- onClick={onClose}
403
- >
404
- {labels.skip}
405
- </Button>
406
418
  </div>
407
419
  </div>
408
420
  </div>,
@@ -75,4 +75,18 @@ describe("TimelineDay", () => {
75
75
  expect(rows.querySelectorAll('[data-orientation="horizontal"]').length).toBe(2);
76
76
  expect(cards.querySelectorAll('[data-orientation="horizontal"]').length).toBe(1);
77
77
  });
78
+
79
+ it("stacks rows like cards on the phone and rules them only from lg", () => {
80
+ render(
81
+ <TimelineHour time="21:00" layout="rows">
82
+ <p>a</p>
83
+ <p>b</p>
84
+ </TimelineHour>
85
+ );
86
+ const stack = screen.getByText("a").parentElement?.parentElement;
87
+ expect(stack).toHaveClass("gap-4", "lg:gap-0");
88
+ const rule = screen.getByText("b").previousElementSibling;
89
+ expect(rule).toHaveAttribute("data-orientation", "horizontal");
90
+ expect(rule).toHaveClass("hidden", "lg:block");
91
+ });
78
92
  });
@@ -53,7 +53,8 @@ import { TIMELINE_MOBILE_GUTTER_CLASS, TimelineHourPuck } from "./timeline-hour-
53
53
  *
54
54
  * `layout`: `cards` stacks posters with a gap (a card is its own frame, a
55
55
  * hairline between two posters reads as a third object) and from `lg` lays
56
- * them on a two/three-up grid; `rows` rules between children on both widths.
56
+ * them on a two/three-up grid; `rows` is the same gapped stack on the phone
57
+ * (rows are full cards there) and rules between children from `lg`.
57
58
  * Children are read with `Children.toArray`, which drops `null`/`false`, so a
58
59
  * conditional first row never inherits a rule meant for a second; pass rows
59
60
  * as siblings, not inside a fragment.
@@ -92,6 +93,19 @@ export type TimelineHourProps = {
92
93
  * half the fixed 16px heading row. */
93
94
  const HEADING_CENTRE_LG = "lg:top-[30px]";
94
95
 
96
+ /** A stack that is cards on the phone (gapped, unruled) and rows from `lg`
97
+ * (flush, ruled). Shared by `layout="rows"` and `overflow`. */
98
+ const RULED_STACK = "gap-4 pb-2 lg:gap-0 lg:pb-0";
99
+
100
+ function ruleFromLg(items: React.ReactNode[]) {
101
+ return items.map((child, index) => (
102
+ <div key={index}>
103
+ {index > 0 && <Separator className="hidden lg:block" />}
104
+ {child}
105
+ </div>
106
+ ));
107
+ }
108
+
95
109
  export function TimelineHour({
96
110
  time,
97
111
  role = "hour",
@@ -188,30 +202,18 @@ export function TimelineHour({
188
202
  <div
189
203
  className={cn(
190
204
  "flex min-w-0 flex-col",
191
- isCards && "gap-4 pb-2 lg:grid lg:grid-cols-2 lg:gap-5 lg:pb-0 lg:pt-3.5 xl:grid-cols-3",
205
+ isCards
206
+ ? "gap-4 pb-2 lg:grid lg:grid-cols-2 lg:gap-5 lg:pb-0 lg:pt-3.5 xl:grid-cols-3"
207
+ : RULED_STACK,
192
208
  isCards && isHero && "lg:flex lg:pt-0",
193
209
  isUnscheduled && isCards && "pt-3.5"
194
210
  )}
195
211
  >
196
- {isCards
197
- ? items
198
- : items.map((child, index) => (
199
- <div key={index}>
200
- {index > 0 && <Separator />}
201
- {child}
202
- </div>
203
- ))}
212
+ {isCards ? items : ruleFromLg(items)}
204
213
  </div>
205
214
 
206
215
  {overflowItems.length > 0 && (
207
- <div className="flex flex-col gap-4 pb-2 lg:gap-0 lg:pb-0 lg:pt-2">
208
- {overflowItems.map((child, index) => (
209
- <div key={index}>
210
- {index > 0 && <Separator className="hidden lg:block" />}
211
- {child}
212
- </div>
213
- ))}
214
- </div>
216
+ <div className={cn("flex flex-col lg:pt-2", RULED_STACK)}>{ruleFromLg(overflowItems)}</div>
215
217
  )}
216
218
 
217
219
  {note && <p className="pt-[9px] text-[11.5px] text-muted-foreground">{note}</p>}