@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.
- package/dist/{chunk-QRSIJC4X.js → chunk-S5GDARLW.js} +10 -9
- package/dist/components/timeline-day.js +1 -1
- package/dist/components/timeline-hour.d.ts +2 -1
- package/dist/components/timeline-hour.js +1 -1
- package/package.json +1 -1
- package/src/components/timeline-day.test.tsx +14 -0
- package/src/components/timeline-hour.tsx +20 -18
|
@@ -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
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -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`
|
|
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.
|
package/package.json
CHANGED
|
@@ -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`
|
|
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
|
|
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
|
|
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>}
|