@bearmenu/ui 0.8.46 → 0.8.47

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
  }
@@ -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.47",
4
4
  "description": "BearMenu design system — shared UI tokens, primitives, and components",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -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>}