@sereno-ds/ui 0.24.0 → 0.25.0
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/README.md +47 -0
- package/dist/feedback/Dialog.d.ts +49 -14
- package/dist/feedback/Dialog.js +133 -109
- package/dist/feedback/Dialog.js.map +1 -1
- package/dist/feedback/ToastProvider.js +6 -1
- package/dist/feedback/ToastProvider.js.map +1 -1
- package/dist/forms/AvatarUpload.js +59 -71
- package/dist/forms/AvatarUpload.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js.map +1 -1
- package/dist/navigation/BottomNav.d.ts +23 -9
- package/dist/navigation/BottomNav.js +59 -47
- package/dist/navigation/BottomNav.js.map +1 -1
- package/dist/navigation/SidebarNav.d.ts +55 -30
- package/dist/navigation/SidebarNav.js +122 -154
- package/dist/navigation/SidebarNav.js.map +1 -1
- package/dist/navigation/Stepper.d.ts +28 -14
- package/dist/navigation/Stepper.js +101 -70
- package/dist/navigation/Stepper.js.map +1 -1
- package/dist/navigation/Tabs.d.ts +44 -13
- package/dist/navigation/Tabs.js +164 -67
- package/dist/navigation/Tabs.js.map +1 -1
- package/dist/navigation/TopBar.d.ts +37 -9
- package/dist/navigation/TopBar.js +45 -39
- package/dist/navigation/TopBar.js.map +1 -1
- package/dist/styles.css +7 -0
- package/package.json +1 -1
package/dist/navigation/Tabs.js
CHANGED
|
@@ -3,11 +3,24 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
5
5
|
import { sx } from "../_internal/style";
|
|
6
|
-
|
|
6
|
+
const CHEVRON_W = 56;
|
|
7
|
+
const TabsContext = React.createContext(null);
|
|
8
|
+
function useTabsContext(component) {
|
|
9
|
+
const ctx = React.useContext(TabsContext);
|
|
10
|
+
if (!ctx) throw new Error(`<Tabs.${component}> must be rendered inside <Tabs>.`);
|
|
11
|
+
return ctx;
|
|
12
|
+
}
|
|
13
|
+
function TabsRoot({ value, onChange, variant = "underline", fullWidth = false, children }) {
|
|
14
|
+
const ctx = React.useMemo(() => ({ value, onChange, variant, fullWidth }), [value, onChange, variant, fullWidth]);
|
|
15
|
+
return /* @__PURE__ */ jsx(TabsContext.Provider, { value: ctx, children });
|
|
16
|
+
}
|
|
17
|
+
function List({ children, style, ...rest }) {
|
|
18
|
+
const { value: activeValue, variant, fullWidth } = useTabsContext("List");
|
|
7
19
|
const pill = variant === "pill";
|
|
8
20
|
const scrollRef = React.useRef(null);
|
|
9
21
|
const [edge, setEdge] = React.useState({ left: false, right: false });
|
|
10
|
-
const
|
|
22
|
+
const [indicator, setIndicator] = React.useState(null);
|
|
23
|
+
const measureEdges = React.useCallback(() => {
|
|
11
24
|
const el = scrollRef.current;
|
|
12
25
|
if (!el) return;
|
|
13
26
|
setEdge({
|
|
@@ -15,18 +28,38 @@ function Tabs({ items = [], value, onChange, variant = "underline", fullWidth =
|
|
|
15
28
|
right: el.scrollLeft + el.clientWidth < el.scrollWidth - 1
|
|
16
29
|
});
|
|
17
30
|
}, []);
|
|
31
|
+
const measureIndicator = React.useCallback(() => {
|
|
32
|
+
const el = scrollRef.current;
|
|
33
|
+
if (!el || activeValue == null) {
|
|
34
|
+
setIndicator(null);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
let active = null;
|
|
38
|
+
el.querySelectorAll("[data-tab-value]").forEach((tab) => {
|
|
39
|
+
if (tab.dataset.tabValue === activeValue) active = tab;
|
|
40
|
+
});
|
|
41
|
+
setIndicator(
|
|
42
|
+
active ? { left: active.offsetLeft, width: active.offsetWidth, top: active.offsetTop, height: active.offsetHeight } : null
|
|
43
|
+
);
|
|
44
|
+
}, [activeValue]);
|
|
45
|
+
React.useLayoutEffect(() => {
|
|
46
|
+
measureIndicator();
|
|
47
|
+
}, [measureIndicator, children]);
|
|
18
48
|
React.useEffect(() => {
|
|
19
49
|
const el = scrollRef.current;
|
|
20
50
|
if (!el) return;
|
|
21
|
-
|
|
22
|
-
el.addEventListener("scroll",
|
|
23
|
-
const ro = new ResizeObserver(
|
|
51
|
+
measureEdges();
|
|
52
|
+
el.addEventListener("scroll", measureEdges, { passive: true });
|
|
53
|
+
const ro = new ResizeObserver(() => {
|
|
54
|
+
measureEdges();
|
|
55
|
+
measureIndicator();
|
|
56
|
+
});
|
|
24
57
|
ro.observe(el);
|
|
25
58
|
return () => {
|
|
26
|
-
el.removeEventListener("scroll",
|
|
59
|
+
el.removeEventListener("scroll", measureEdges);
|
|
27
60
|
ro.disconnect();
|
|
28
61
|
};
|
|
29
|
-
}, [
|
|
62
|
+
}, [measureEdges, measureIndicator, children]);
|
|
30
63
|
const nudge = (dir) => {
|
|
31
64
|
scrollRef.current?.scrollBy({ left: dir * scrollRef.current.clientWidth * 0.72, behavior: "smooth" });
|
|
32
65
|
};
|
|
@@ -46,7 +79,7 @@ function Tabs({ items = [], value, onChange, variant = "underline", fullWidth =
|
|
|
46
79
|
...style
|
|
47
80
|
}),
|
|
48
81
|
children: [
|
|
49
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ jsxs(
|
|
50
83
|
"div",
|
|
51
84
|
{
|
|
52
85
|
ref: scrollRef,
|
|
@@ -54,68 +87,44 @@ function Tabs({ items = [], value, onChange, variant = "underline", fullWidth =
|
|
|
54
87
|
...rest,
|
|
55
88
|
className: "sereno-tab-scroll" + (rest.className ? " " + rest.className : ""),
|
|
56
89
|
style: sx({
|
|
90
|
+
position: "relative",
|
|
57
91
|
display: "flex",
|
|
58
92
|
flex: 1,
|
|
59
93
|
minWidth: 0,
|
|
60
94
|
overflowX: "auto",
|
|
61
95
|
gap: pill ? "var(--space-1)" : "var(--space-5)",
|
|
62
|
-
padding: pill ? "var(--space-1)" : 0
|
|
96
|
+
padding: pill ? "var(--space-1)" : 0,
|
|
97
|
+
// The chevron overlays this edge (see ScrollChevron) rather than
|
|
98
|
+
// reserving permanent space for itself — reserving space fit fewer
|
|
99
|
+
// tabs on screen at once for no real benefit once the chevron
|
|
100
|
+
// paints correctly above whatever tab is underneath it (the actual
|
|
101
|
+
// bug, fixed below on Tab). scroll-padding keeps scrollIntoView
|
|
102
|
+
// from landing a tab half-behind the chevron's fade.
|
|
103
|
+
scrollPaddingLeft: CHEVRON_W,
|
|
104
|
+
scrollPaddingRight: CHEVRON_W
|
|
63
105
|
}),
|
|
64
|
-
children:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"button",
|
|
106
|
+
children: [
|
|
107
|
+
indicator && /* @__PURE__ */ jsx(
|
|
108
|
+
"span",
|
|
68
109
|
{
|
|
69
|
-
|
|
70
|
-
"aria-selected": active,
|
|
71
|
-
onClick: (e) => {
|
|
72
|
-
onChange?.(it.value);
|
|
73
|
-
e.currentTarget.scrollIntoView({ inline: "nearest", block: "nearest" });
|
|
74
|
-
},
|
|
110
|
+
"aria-hidden": true,
|
|
75
111
|
style: sx({
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
fontSize: "var(--text-base)",
|
|
93
|
-
fontWeight: active ? "var(--weight-semibold)" : "var(--weight-medium)",
|
|
94
|
-
color: active ? pill ? "var(--text-primary)" : "var(--text-brand)" : "var(--text-secondary)",
|
|
95
|
-
transition: "var(--transition-control)"
|
|
96
|
-
}),
|
|
97
|
-
children: [
|
|
98
|
-
it.icon,
|
|
99
|
-
it.label,
|
|
100
|
-
it.count !== void 0 && /* @__PURE__ */ jsx(
|
|
101
|
-
"span",
|
|
102
|
-
{
|
|
103
|
-
style: sx({
|
|
104
|
-
fontSize: "var(--text-2xs)",
|
|
105
|
-
fontWeight: "var(--weight-bold)",
|
|
106
|
-
padding: "1px 6px",
|
|
107
|
-
borderRadius: "999px",
|
|
108
|
-
background: active ? "var(--bg-brand-soft)" : pill ? "var(--bg-surface)" : "var(--bg-subtle)",
|
|
109
|
-
color: active ? "var(--text-brand)" : "var(--text-muted)"
|
|
110
|
-
}),
|
|
111
|
-
children: it.count
|
|
112
|
-
}
|
|
113
|
-
)
|
|
114
|
-
]
|
|
115
|
-
},
|
|
116
|
-
it.value
|
|
117
|
-
);
|
|
118
|
-
})
|
|
112
|
+
position: "absolute",
|
|
113
|
+
left: indicator.left,
|
|
114
|
+
width: indicator.width,
|
|
115
|
+
zIndex: 0,
|
|
116
|
+
pointerEvents: "none",
|
|
117
|
+
transition: "left 200ms ease, width 200ms ease, top 200ms ease, height 200ms ease",
|
|
118
|
+
// Match the active Tab's own box exactly (offsetTop/offsetHeight,
|
|
119
|
+
// not top:0/bottom:0) — the latter is relative to the scroll
|
|
120
|
+
// container's *padding edge*, which for `pill` ignores the
|
|
121
|
+
// container's own padding and over-fills it top-to-bottom.
|
|
122
|
+
...pill ? { top: indicator.top, height: indicator.height, borderRadius: "var(--radius-pill)", background: "var(--bg-surface)", boxShadow: "var(--shadow-xs)" } : { top: "auto", bottom: 0, height: 2, background: "var(--interactive-primary)" }
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
children
|
|
127
|
+
]
|
|
119
128
|
}
|
|
120
129
|
),
|
|
121
130
|
edge.left && /* @__PURE__ */ jsx(ScrollChevron, { side: "left", fade, pill, onClick: () => nudge(-1) }),
|
|
@@ -124,6 +133,77 @@ function Tabs({ items = [], value, onChange, variant = "underline", fullWidth =
|
|
|
124
133
|
}
|
|
125
134
|
);
|
|
126
135
|
}
|
|
136
|
+
function Tab({ value, icon, count, children, style, ...rest }) {
|
|
137
|
+
const { value: activeValue, onChange, variant, fullWidth } = useTabsContext("Tab");
|
|
138
|
+
const pill = variant === "pill";
|
|
139
|
+
const active = activeValue === value;
|
|
140
|
+
return /* @__PURE__ */ jsxs(
|
|
141
|
+
"button",
|
|
142
|
+
{
|
|
143
|
+
type: "button",
|
|
144
|
+
role: "tab",
|
|
145
|
+
"aria-selected": active,
|
|
146
|
+
"data-tab-value": value,
|
|
147
|
+
...rest,
|
|
148
|
+
onClick: (e) => {
|
|
149
|
+
onChange?.(value);
|
|
150
|
+
e.currentTarget.scrollIntoView({ inline: "nearest", block: "nearest" });
|
|
151
|
+
},
|
|
152
|
+
style: sx({
|
|
153
|
+
// position:relative (no explicit z-index) is enough to paint above
|
|
154
|
+
// the indicator — both sit in the DOM-order-decided stacking layer,
|
|
155
|
+
// and this comes later. An explicit z-index would promote this into
|
|
156
|
+
// its own stacking context ranked ahead of *everything* z-index:auto,
|
|
157
|
+
// including the unrelated ScrollChevron sibling outside this row —
|
|
158
|
+
// which is exactly the bug that shipped: the chevron ended up
|
|
159
|
+
// painted underneath every tab, visible only through the gaps
|
|
160
|
+
// between glyphs of whichever tab it overlapped.
|
|
161
|
+
position: "relative",
|
|
162
|
+
flex: fullWidth ? 1 : "0 0 auto",
|
|
163
|
+
whiteSpace: "nowrap",
|
|
164
|
+
display: "inline-flex",
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
justifyContent: "center",
|
|
167
|
+
gap: "var(--space-2)",
|
|
168
|
+
border: "none",
|
|
169
|
+
cursor: "pointer",
|
|
170
|
+
outline: "none",
|
|
171
|
+
background: "transparent",
|
|
172
|
+
borderRadius: pill ? "var(--radius-pill)" : 0,
|
|
173
|
+
padding: pill ? "8px var(--space-4)" : "0 0 var(--space-3)",
|
|
174
|
+
fontFamily: "var(--font-body)",
|
|
175
|
+
fontSize: "var(--text-base)",
|
|
176
|
+
fontWeight: active ? "var(--weight-semibold)" : "var(--weight-medium)",
|
|
177
|
+
color: active ? pill ? "var(--text-primary)" : "var(--text-brand)" : "var(--text-secondary)",
|
|
178
|
+
transition: "var(--transition-control)",
|
|
179
|
+
...style
|
|
180
|
+
}),
|
|
181
|
+
children: [
|
|
182
|
+
icon,
|
|
183
|
+
children,
|
|
184
|
+
count !== void 0 && /* @__PURE__ */ jsx(
|
|
185
|
+
"span",
|
|
186
|
+
{
|
|
187
|
+
style: sx({
|
|
188
|
+
fontSize: "var(--text-2xs)",
|
|
189
|
+
fontWeight: "var(--weight-bold)",
|
|
190
|
+
padding: "1px 6px",
|
|
191
|
+
borderRadius: "999px",
|
|
192
|
+
background: active ? "var(--bg-brand-soft)" : pill ? "var(--bg-surface)" : "var(--bg-subtle)",
|
|
193
|
+
color: active ? "var(--text-brand)" : "var(--text-muted)"
|
|
194
|
+
}),
|
|
195
|
+
children: count
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
function Panel({ value, children, ...rest }) {
|
|
203
|
+
const { value: activeValue } = useTabsContext("Panel");
|
|
204
|
+
if (activeValue !== value) return null;
|
|
205
|
+
return /* @__PURE__ */ jsx("div", { role: "tabpanel", ...rest, children });
|
|
206
|
+
}
|
|
127
207
|
function ScrollChevron({ side, fade, pill, onClick }) {
|
|
128
208
|
return /* @__PURE__ */ jsx(
|
|
129
209
|
"span",
|
|
@@ -132,13 +212,18 @@ function ScrollChevron({ side, fade, pill, onClick }) {
|
|
|
132
212
|
style: sx({
|
|
133
213
|
position: "absolute",
|
|
134
214
|
top: 0,
|
|
135
|
-
bottom:
|
|
215
|
+
bottom: 0,
|
|
136
216
|
[side]: 0,
|
|
137
|
-
width:
|
|
217
|
+
width: CHEVRON_W,
|
|
138
218
|
display: "flex",
|
|
139
219
|
alignItems: "center",
|
|
140
220
|
justifyContent: side === "left" ? "flex-start" : "flex-end",
|
|
141
221
|
pointerEvents: "none",
|
|
222
|
+
// Fades the tab it overlays out towards this edge — the button
|
|
223
|
+
// itself paints above every tab (Tab has no explicit z-index, so
|
|
224
|
+
// it can't outrank this), so it's never actually hidden by one;
|
|
225
|
+
// this is purely about not hard-cutting the text right at the
|
|
226
|
+
// button's boundary.
|
|
142
227
|
background: `linear-gradient(to ${side === "left" ? "right" : "left"}, ${fade} 55%, transparent)`,
|
|
143
228
|
borderRadius: pill ? "var(--radius-pill)" : 0
|
|
144
229
|
}),
|
|
@@ -156,11 +241,22 @@ function ScrollChevron({ side, fade, pill, onClick }) {
|
|
|
156
241
|
width: 26,
|
|
157
242
|
height: 26,
|
|
158
243
|
borderRadius: "999px",
|
|
159
|
-
border: "1px solid var(--border-
|
|
244
|
+
border: "1px solid var(--border-strong)",
|
|
245
|
+
// White, matching the DS's other floating circular controls.
|
|
160
246
|
background: "var(--bg-surface)",
|
|
161
|
-
boxShadow: "var(--shadow-
|
|
247
|
+
boxShadow: "var(--shadow-md)",
|
|
162
248
|
color: "var(--text-secondary)",
|
|
163
|
-
cursor: "pointer"
|
|
249
|
+
cursor: "pointer",
|
|
250
|
+
// `underline`-only correction, measured against the actual glyph
|
|
251
|
+
// box (Range.getBoundingClientRect on the label's text node, not
|
|
252
|
+
// the row's own padded box): that variant's label sits ~6px above
|
|
253
|
+
// the row's geometric center, since the row reserves padding-bottom
|
|
254
|
+
// for the underline bar that the text itself doesn't use. `pill`
|
|
255
|
+
// pads top and bottom equally, so its label is already centered —
|
|
256
|
+
// applying this there overshoots (confirmed live on the Dashboard's
|
|
257
|
+
// pill filter: the same -6px landed 6px too high once the row
|
|
258
|
+
// wasn't underline's asymmetric one).
|
|
259
|
+
transform: pill ? void 0 : "translateY(-6px)"
|
|
164
260
|
}),
|
|
165
261
|
children: side === "left" ? /* @__PURE__ */ jsx(ChevronLeft, { size: 16, strokeWidth: 2 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 16, strokeWidth: 2 })
|
|
166
262
|
}
|
|
@@ -168,6 +264,7 @@ function ScrollChevron({ side, fade, pill, onClick }) {
|
|
|
168
264
|
}
|
|
169
265
|
);
|
|
170
266
|
}
|
|
267
|
+
const Tabs = Object.assign(TabsRoot, { List, Tab, Panel });
|
|
171
268
|
export {
|
|
172
269
|
Tabs
|
|
173
270
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/navigation/Tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { sx } from '../_internal/style';\n\nexport interface TabItem {\n value: string;\n label: string;\n icon?: React.ReactNode;\n count?: number;\n}\n\n/**\n * Horizontal section switcher. `underline` for page-level sections, `pill` for\n * filters inside a panel. When the tabs overflow their width the strip scrolls\n * horizontally, with a chevron on whichever side has more.\n */\nexport interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n items: TabItem[];\n value?: string;\n onChange?: (value: string) => void;\n variant?: 'underline' | 'pill';\n fullWidth?: boolean;\n}\n\nexport function Tabs({ items = [], value, onChange, variant = 'underline', fullWidth = false, style, ...rest }: TabsProps) {\n const pill = variant === 'pill';\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const [edge, setEdge] = React.useState({ left: false, right: false });\n\n const measure = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el) return;\n setEdge({\n left: el.scrollLeft > 1,\n right: el.scrollLeft + el.clientWidth < el.scrollWidth - 1,\n });\n }, []);\n\n React.useEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n measure();\n el.addEventListener('scroll', measure, { passive: true });\n const ro = new ResizeObserver(measure);\n ro.observe(el);\n return () => {\n el.removeEventListener('scroll', measure);\n ro.disconnect();\n };\n }, [measure, items]);\n\n const nudge = (dir: 1 | -1) => {\n scrollRef.current?.scrollBy({ left: dir * scrollRef.current.clientWidth * 0.72, behavior: 'smooth' });\n };\n\n const fade = pill ? 'var(--bg-subtle)' : 'var(--bg-surface)';\n\n return (\n <div\n style={sx({\n position: 'relative',\n display: pill && !fullWidth ? 'inline-flex' : 'flex',\n alignSelf: pill && !fullWidth ? 'flex-start' : undefined,\n width: !pill && fullWidth ? '100%' : undefined,\n maxWidth: '100%',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n background: pill ? 'var(--bg-subtle)' : 'transparent',\n borderBottom: pill ? 'none' : 'var(--border-width-hairline) solid var(--border-default)',\n ...style,\n })}\n >\n <div\n ref={scrollRef}\n role=\"tablist\"\n {...rest}\n className={'sereno-tab-scroll' + (rest.className ? ' ' + rest.className : '')}\n style={sx({\n display: 'flex',\n flex: 1,\n minWidth: 0,\n overflowX: 'auto',\n gap: pill ? 'var(--space-1)' : 'var(--space-5)',\n padding: pill ? 'var(--space-1)' : 0,\n })}\n >\n {items.map((it) => {\n const active = value === it.value;\n return (\n <button\n key={it.value}\n role=\"tab\"\n aria-selected={active}\n onClick={(e) => {\n onChange?.(it.value);\n e.currentTarget.scrollIntoView({ inline: 'nearest', block: 'nearest' });\n }}\n style={sx({\n flex: fullWidth ? 1 : '0 0 auto',\n whiteSpace: 'nowrap',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 'var(--space-2)',\n border: 'none',\n cursor: 'pointer',\n outline: 'none',\n background: pill ? (active ? 'var(--bg-surface)' : 'transparent') : 'transparent',\n boxShadow: pill && active ? 'var(--shadow-xs)' : 'none',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n padding: pill ? '8px var(--space-4)' : '0 0 var(--space-3)',\n borderBottom: pill ? 'none' : '2px solid ' + (active ? 'var(--interactive-primary)' : 'transparent'),\n marginBottom: pill ? 0 : -1,\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n fontWeight: active ? 'var(--weight-semibold)' : 'var(--weight-medium)',\n color: active ? (pill ? 'var(--text-primary)' : 'var(--text-brand)') : 'var(--text-secondary)',\n transition: 'var(--transition-control)',\n })}\n >\n {it.icon}\n {it.label}\n {it.count !== undefined && (\n <span\n style={sx({\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n padding: '1px 6px',\n borderRadius: '999px',\n background: active ? 'var(--bg-brand-soft)' : pill ? 'var(--bg-surface)' : 'var(--bg-subtle)',\n color: active ? 'var(--text-brand)' : 'var(--text-muted)',\n })}\n >\n {it.count}\n </span>\n )}\n </button>\n );\n })}\n </div>\n\n {edge.left && <ScrollChevron side=\"left\" fade={fade} pill={pill} onClick={() => nudge(-1)} />}\n {edge.right && <ScrollChevron side=\"right\" fade={fade} pill={pill} onClick={() => nudge(1)} />}\n </div>\n );\n}\n\nfunction ScrollChevron({ side, fade, pill, onClick }: { side: 'left' | 'right'; fade: string; pill: boolean; onClick: () => void }) {\n return (\n <span\n aria-hidden\n style={sx({\n position: 'absolute',\n top: 0,\n bottom: pill ? 0 : 1,\n [side]: 0,\n width: 44,\n display: 'flex',\n alignItems: 'center',\n justifyContent: side === 'left' ? 'flex-start' : 'flex-end',\n pointerEvents: 'none',\n background: `linear-gradient(to ${side === 'left' ? 'right' : 'left'}, ${fade} 55%, transparent)`,\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n })}\n >\n <button\n type=\"button\"\n tabIndex={-1}\n onClick={onClick}\n style={sx({\n pointerEvents: 'auto',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 26,\n height: 26,\n borderRadius: '999px',\n border: '1px solid var(--border-default)',\n background: 'var(--bg-surface)',\n boxShadow: 'var(--shadow-sm)',\n color: 'var(--text-secondary)',\n cursor: 'pointer',\n })}\n >\n {side === 'left' ? <ChevronLeft size={16} strokeWidth={2} /> : <ChevronRight size={16} strokeWidth={2} />}\n </button>\n </span>\n );\n}\n"],"mappings":";AA0FY,SAkCI,KAlCJ;AAxFZ,YAAY,WAAW;AACvB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,UAAU;AAsBZ,SAAS,KAAK,EAAE,QAAQ,CAAC,GAAG,OAAO,UAAU,UAAU,aAAa,YAAY,OAAO,OAAO,GAAG,KAAK,GAAc;AACzH,QAAM,OAAO,YAAY;AACzB,QAAM,YAAY,MAAM,OAAuB,IAAI;AACnD,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,EAAE,MAAM,OAAO,OAAO,MAAM,CAAC;AAEpE,QAAM,UAAU,MAAM,YAAY,MAAM;AACtC,UAAM,KAAK,UAAU;AACrB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AAG;AAAA;AAAA,MACzG;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/navigation/Tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { sx } from '../_internal/style';\n\n/**\n * Horizontal section switcher — a **compound component**. `underline` for\n * page-level sections, `pill` for filters inside a panel. When the tabs\n * overflow their width the strip scrolls horizontally, with a chevron on\n * whichever side has more; picking a tab scrolls it into view.\n *\n * ```tsx\n * <Tabs value={tab} onChange={setTab} variant=\"pill\">\n * <Tabs.List>\n * <Tabs.Tab value=\"today\" count={5}>Today</Tabs.Tab>\n * <Tabs.Tab value=\"week\" count={23}>Week</Tabs.Tab>\n * </Tabs.List>\n * <Tabs.Panel value=\"today\">…</Tabs.Panel>\n * <Tabs.Panel value=\"week\">…</Tabs.Panel>\n * </Tabs>\n * ```\n *\n * `Tabs.Panel` is optional — nothing requires it. Render your own content\n * next to `Tabs.List`, keyed off the controlled `value`, if that reads\n * better for the screen.\n */\nexport interface TabsProps {\n value?: string;\n onChange?: (value: string) => void;\n variant?: 'underline' | 'pill';\n fullWidth?: boolean;\n children: React.ReactNode;\n}\n\nexport interface TabsListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n children: React.ReactNode;\n}\n\nexport interface TabsTabProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onClick'> {\n value: string;\n icon?: React.ReactNode;\n count?: number;\n children: React.ReactNode;\n}\n\nexport interface TabsPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n value: string;\n children: React.ReactNode;\n}\n\ninterface TabsContextValue {\n value?: string;\n onChange?: (value: string) => void;\n variant: 'underline' | 'pill';\n fullWidth: boolean;\n}\n\n/** Width of the overflow chevron's fade-out + hit area, and how much\n * scroll-padding the strip keeps on that side so scrollIntoView doesn't land\n * a tab half-hidden behind it. The chevron overlays this edge rather than\n * reserving space for itself — reserving space fit fewer tabs on screen at\n * once, for no benefit once the chevron reliably paints above the tab under\n * it (see Tab's z-index comment). */\nconst CHEVRON_W = 56;\n\nconst TabsContext = React.createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext(component: string): TabsContextValue {\n const ctx = React.useContext(TabsContext);\n if (!ctx) throw new Error(`<Tabs.${component}> must be rendered inside <Tabs>.`);\n return ctx;\n}\n\nfunction TabsRoot({ value, onChange, variant = 'underline', fullWidth = false, children }: TabsProps) {\n const ctx = React.useMemo<TabsContextValue>(() => ({ value, onChange, variant, fullWidth }), [value, onChange, variant, fullWidth]);\n return <TabsContext.Provider value={ctx}>{children}</TabsContext.Provider>;\n}\n\nfunction List({ children, style, ...rest }: TabsListProps) {\n const { value: activeValue, variant, fullWidth } = useTabsContext('List');\n const pill = variant === 'pill';\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const [edge, setEdge] = React.useState({ left: false, right: false });\n const [indicator, setIndicator] = React.useState<{ left: number; width: number; top: number; height: number } | null>(null);\n\n const measureEdges = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el) return;\n setEdge({\n left: el.scrollLeft > 1,\n right: el.scrollLeft + el.clientWidth < el.scrollWidth - 1,\n });\n }, []);\n\n // Finds the active <Tabs.Tab> by its data-tab-value (no ref registry needed\n // — children render into this same scroll container) and measures it in the\n // container's own coordinate space, so `indicator.left` lines up with the\n // absolutely-positioned bar/pill below.\n const measureIndicator = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el || activeValue == null) {\n setIndicator(null);\n return;\n }\n let active: HTMLElement | null = null;\n el.querySelectorAll<HTMLElement>('[data-tab-value]').forEach((tab) => {\n if (tab.dataset.tabValue === activeValue) active = tab;\n });\n setIndicator(\n active\n ? { left: (active as HTMLElement).offsetLeft, width: (active as HTMLElement).offsetWidth, top: (active as HTMLElement).offsetTop, height: (active as HTMLElement).offsetHeight }\n : null,\n );\n }, [activeValue]);\n\n // Layout effect so the indicator lands in the right spot before paint —\n // no visible jump from a stale position on the very first render after a\n // value change.\n React.useLayoutEffect(() => {\n measureIndicator();\n }, [measureIndicator, children]);\n\n React.useEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n measureEdges();\n el.addEventListener('scroll', measureEdges, { passive: true });\n const ro = new ResizeObserver(() => {\n measureEdges();\n measureIndicator();\n });\n ro.observe(el);\n return () => {\n el.removeEventListener('scroll', measureEdges);\n ro.disconnect();\n };\n }, [measureEdges, measureIndicator, children]);\n\n const nudge = (dir: 1 | -1) => {\n scrollRef.current?.scrollBy({ left: dir * scrollRef.current.clientWidth * 0.72, behavior: 'smooth' });\n };\n\n const fade = pill ? 'var(--bg-subtle)' : 'var(--bg-surface)';\n\n return (\n <div\n style={sx({\n position: 'relative',\n display: pill && !fullWidth ? 'inline-flex' : 'flex',\n alignSelf: pill && !fullWidth ? 'flex-start' : undefined,\n width: !pill && fullWidth ? '100%' : undefined,\n maxWidth: '100%',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n background: pill ? 'var(--bg-subtle)' : 'transparent',\n borderBottom: pill ? 'none' : 'var(--border-width-hairline) solid var(--border-default)',\n ...style,\n })}\n >\n <div\n ref={scrollRef}\n role=\"tablist\"\n {...rest}\n className={'sereno-tab-scroll' + (rest.className ? ' ' + rest.className : '')}\n style={sx({\n position: 'relative',\n display: 'flex',\n flex: 1,\n minWidth: 0,\n overflowX: 'auto',\n gap: pill ? 'var(--space-1)' : 'var(--space-5)',\n padding: pill ? 'var(--space-1)' : 0,\n // The chevron overlays this edge (see ScrollChevron) rather than\n // reserving permanent space for itself — reserving space fit fewer\n // tabs on screen at once for no real benefit once the chevron\n // paints correctly above whatever tab is underneath it (the actual\n // bug, fixed below on Tab). scroll-padding keeps scrollIntoView\n // from landing a tab half-behind the chevron's fade.\n scrollPaddingLeft: CHEVRON_W,\n scrollPaddingRight: CHEVRON_W,\n })}\n >\n {indicator && (\n <span\n aria-hidden\n style={sx({\n position: 'absolute',\n left: indicator.left,\n width: indicator.width,\n zIndex: 0,\n pointerEvents: 'none',\n transition: 'left 200ms ease, width 200ms ease, top 200ms ease, height 200ms ease',\n // Match the active Tab's own box exactly (offsetTop/offsetHeight,\n // not top:0/bottom:0) — the latter is relative to the scroll\n // container's *padding edge*, which for `pill` ignores the\n // container's own padding and over-fills it top-to-bottom.\n ...(pill\n ? { top: indicator.top, height: indicator.height, borderRadius: 'var(--radius-pill)', background: 'var(--bg-surface)', boxShadow: 'var(--shadow-xs)' }\n : { top: 'auto', bottom: 0, height: 2, background: 'var(--interactive-primary)' }),\n })}\n />\n )}\n {children}\n </div>\n\n {edge.left && <ScrollChevron side=\"left\" fade={fade} pill={pill} onClick={() => nudge(-1)} />}\n {edge.right && <ScrollChevron side=\"right\" fade={fade} pill={pill} onClick={() => nudge(1)} />}\n </div>\n );\n}\n\nfunction Tab({ value, icon, count, children, style, ...rest }: TabsTabProps) {\n const { value: activeValue, onChange, variant, fullWidth } = useTabsContext('Tab');\n const pill = variant === 'pill';\n const active = activeValue === value;\n\n return (\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n data-tab-value={value}\n {...rest}\n onClick={(e) => {\n onChange?.(value);\n e.currentTarget.scrollIntoView({ inline: 'nearest', block: 'nearest' });\n }}\n style={sx({\n // position:relative (no explicit z-index) is enough to paint above\n // the indicator — both sit in the DOM-order-decided stacking layer,\n // and this comes later. An explicit z-index would promote this into\n // its own stacking context ranked ahead of *everything* z-index:auto,\n // including the unrelated ScrollChevron sibling outside this row —\n // which is exactly the bug that shipped: the chevron ended up\n // painted underneath every tab, visible only through the gaps\n // between glyphs of whichever tab it overlapped.\n position: 'relative',\n flex: fullWidth ? 1 : '0 0 auto',\n whiteSpace: 'nowrap',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 'var(--space-2)',\n border: 'none',\n cursor: 'pointer',\n outline: 'none',\n background: 'transparent',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n padding: pill ? '8px var(--space-4)' : '0 0 var(--space-3)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n fontWeight: active ? 'var(--weight-semibold)' : 'var(--weight-medium)',\n color: active ? (pill ? 'var(--text-primary)' : 'var(--text-brand)') : 'var(--text-secondary)',\n transition: 'var(--transition-control)',\n ...style,\n })}\n >\n {icon}\n {children}\n {count !== undefined && (\n <span\n style={sx({\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n padding: '1px 6px',\n borderRadius: '999px',\n background: active ? 'var(--bg-brand-soft)' : pill ? 'var(--bg-surface)' : 'var(--bg-subtle)',\n color: active ? 'var(--text-brand)' : 'var(--text-muted)',\n })}\n >\n {count}\n </span>\n )}\n </button>\n );\n}\n\nfunction Panel({ value, children, ...rest }: TabsPanelProps) {\n const { value: activeValue } = useTabsContext('Panel');\n if (activeValue !== value) return null;\n return (\n <div role=\"tabpanel\" {...rest}>\n {children}\n </div>\n );\n}\n\nfunction ScrollChevron({ side, fade, pill, onClick }: { side: 'left' | 'right'; fade: string; pill: boolean; onClick: () => void }) {\n return (\n <span\n aria-hidden\n style={sx({\n position: 'absolute',\n top: 0,\n bottom: 0,\n [side]: 0,\n width: CHEVRON_W,\n display: 'flex',\n alignItems: 'center',\n justifyContent: side === 'left' ? 'flex-start' : 'flex-end',\n pointerEvents: 'none',\n // Fades the tab it overlays out towards this edge — the button\n // itself paints above every tab (Tab has no explicit z-index, so\n // it can't outrank this), so it's never actually hidden by one;\n // this is purely about not hard-cutting the text right at the\n // button's boundary.\n background: `linear-gradient(to ${side === 'left' ? 'right' : 'left'}, ${fade} 55%, transparent)`,\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n })}\n >\n <button\n type=\"button\"\n tabIndex={-1}\n onClick={onClick}\n style={sx({\n pointerEvents: 'auto',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 26,\n height: 26,\n borderRadius: '999px',\n border: '1px solid var(--border-strong)',\n // White, matching the DS's other floating circular controls.\n background: 'var(--bg-surface)',\n boxShadow: 'var(--shadow-md)',\n color: 'var(--text-secondary)',\n cursor: 'pointer',\n // `underline`-only correction, measured against the actual glyph\n // box (Range.getBoundingClientRect on the label's text node, not\n // the row's own padded box): that variant's label sits ~6px above\n // the row's geometric center, since the row reserves padding-bottom\n // for the underline bar that the text itself doesn't use. `pill`\n // pads top and bottom equally, so its label is already centered —\n // applying this there overshoots (confirmed live on the Dashboard's\n // pill filter: the same -6px landed 6px too high once the row\n // wasn't underline's asymmetric one).\n transform: pill ? undefined : 'translateY(-6px)',\n })}\n >\n {side === 'left' ? <ChevronLeft size={16} strokeWidth={2} /> : <ChevronRight size={16} strokeWidth={2} />}\n </button>\n </span>\n );\n}\n\nexport const Tabs = Object.assign(TabsRoot, { List, Tab, Panel });\n"],"mappings":";AA4ES,cAmFH,YAnFG;AA1ET,YAAY,WAAW;AACvB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,UAAU;AA4DnB,MAAM,YAAY;AAElB,MAAM,cAAc,MAAM,cAAuC,IAAI;AAErE,SAAS,eAAe,WAAqC;AAC3D,QAAM,MAAM,MAAM,WAAW,WAAW;AACxC,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,SAAS,SAAS,mCAAmC;AAC/E,SAAO;AACT;AAEA,SAAS,SAAS,EAAE,OAAO,UAAU,UAAU,aAAa,YAAY,OAAO,SAAS,GAAc;AACpG,QAAM,MAAM,MAAM,QAA0B,OAAO,EAAE,OAAO,UAAU,SAAS,UAAU,IAAI,CAAC,OAAO,UAAU,SAAS,SAAS,CAAC;AAClI,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,KAAM,UAAS;AACrD;AAEA,SAAS,KAAK,EAAE,UAAU,OAAO,GAAG,KAAK,GAAkB;AACzD,QAAM,EAAE,OAAO,aAAa,SAAS,UAAU,IAAI,eAAe,MAAM;AACxE,QAAM,OAAO,YAAY;AACzB,QAAM,YAAY,MAAM,OAAuB,IAAI;AACnD,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,EAAE,MAAM,OA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AChB,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,cAAc;AAAA,YACd,QAAQ;AAAA;AAAA,YAER,YAAY;AAAA,YACZ,WAAW;AAAA,YACX,OAAO;AAAA,YACP,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAUR,WAAW,OAAO,SAAY;AAAA,UAChC,CAAC;AAAA,UAEA,mBAAS,SAAS,oBAAC,eAAY,MAAM,IAAI,aAAa,GAAG,IAAK,oBAAC,gBAAa,MAAM,IAAI,aAAa,GAAG;AAAA;AAAA,MACzG;AAAA;AAAA,EACF;AAEJ;AAEO,MAAM,OAAO,OAAO,OAAO,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;","names":[]}
|
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Sticky page header — a **compound component**. 60px tall, blurred
|
|
5
|
+
* translucent. `Leading` / `Title` / `Actions` are all optional, independent
|
|
6
|
+
* slots — use whichever the screen needs.
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <TopBar>
|
|
10
|
+
* <TopBar.Leading><IconButton label="Back"><ChevronLeft /></IconButton></TopBar.Leading>
|
|
11
|
+
* <TopBar.Title subtitle="Therapy session">Pick a time</TopBar.Title>
|
|
12
|
+
* <TopBar.Actions><IconButton label="Notifications"><Bell /></IconButton></TopBar.Actions>
|
|
13
|
+
* </TopBar>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
4
16
|
interface TopBarProps extends React.HTMLAttributes<HTMLElement> {
|
|
5
|
-
title?: string;
|
|
6
|
-
/** Plain string in most cases; accepts nodes for e.g. a `<time>` element or a responsive date. */
|
|
7
|
-
subtitle?: React.ReactNode;
|
|
8
|
-
/** Usually a back IconButton or the wordmark. */
|
|
9
|
-
leading?: React.ReactNode;
|
|
10
|
-
actions?: React.ReactNode;
|
|
11
17
|
sticky?: boolean;
|
|
12
18
|
/** Drops the blur/border for hero headers. */
|
|
13
19
|
transparent?: boolean;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
interface TopBarLeadingProps {
|
|
23
|
+
/** Usually a back `IconButton` or the wordmark. */
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
interface TopBarTitleProps {
|
|
27
|
+
/** Plain string in most cases; accepts nodes for e.g. a `<time>` element or a responsive date. */
|
|
28
|
+
subtitle?: React.ReactNode;
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
interface TopBarActionsProps {
|
|
32
|
+
children?: React.ReactNode;
|
|
14
33
|
}
|
|
15
|
-
declare function
|
|
34
|
+
declare function TopBarRoot({ sticky, transparent, children, style, ...rest }: TopBarProps): React.JSX.Element;
|
|
35
|
+
/** No wrapper of its own — renders exactly what you give it, first in the row. */
|
|
36
|
+
declare function Leading({ children }: TopBarLeadingProps): React.JSX.Element;
|
|
37
|
+
declare function Title({ subtitle, children }: TopBarTitleProps): React.JSX.Element;
|
|
38
|
+
declare function Actions({ children }: TopBarActionsProps): React.JSX.Element;
|
|
39
|
+
declare const TopBar: typeof TopBarRoot & {
|
|
40
|
+
Leading: typeof Leading;
|
|
41
|
+
Title: typeof Title;
|
|
42
|
+
Actions: typeof Actions;
|
|
43
|
+
};
|
|
16
44
|
|
|
17
|
-
export { TopBar, type TopBarProps };
|
|
45
|
+
export { TopBar, type TopBarActionsProps, type TopBarLeadingProps, type TopBarProps, type TopBarTitleProps };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { sx } from "../_internal/style";
|
|
4
|
-
function
|
|
5
|
-
return /* @__PURE__ */
|
|
4
|
+
function TopBarRoot({ sticky = true, transparent = false, children, style, ...rest }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
6
|
"header",
|
|
7
7
|
{
|
|
8
8
|
...rest,
|
|
@@ -20,45 +20,51 @@ function TopBar({ title, subtitle, leading, actions, sticky = true, transparent
|
|
|
20
20
|
borderBottom: transparent ? "none" : "var(--border-width-hairline) solid var(--border-default)",
|
|
21
21
|
...style
|
|
22
22
|
}),
|
|
23
|
-
children
|
|
24
|
-
leading,
|
|
25
|
-
/* @__PURE__ */ jsxs("div", { style: sx({ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: 1 }), children: [
|
|
26
|
-
title && /* @__PURE__ */ jsx(
|
|
27
|
-
"span",
|
|
28
|
-
{
|
|
29
|
-
style: sx({
|
|
30
|
-
fontFamily: "var(--font-display)",
|
|
31
|
-
fontSize: "var(--text-lg)",
|
|
32
|
-
fontWeight: "var(--weight-bold)",
|
|
33
|
-
letterSpacing: "var(--tracking-tight)",
|
|
34
|
-
color: "var(--text-primary)",
|
|
35
|
-
overflow: "hidden",
|
|
36
|
-
textOverflow: "ellipsis",
|
|
37
|
-
whiteSpace: "nowrap"
|
|
38
|
-
}),
|
|
39
|
-
children: title
|
|
40
|
-
}
|
|
41
|
-
),
|
|
42
|
-
subtitle && /* @__PURE__ */ jsx(
|
|
43
|
-
"span",
|
|
44
|
-
{
|
|
45
|
-
style: sx({
|
|
46
|
-
fontFamily: "var(--font-body)",
|
|
47
|
-
fontSize: "var(--text-xs)",
|
|
48
|
-
color: "var(--text-muted)",
|
|
49
|
-
overflow: "hidden",
|
|
50
|
-
textOverflow: "ellipsis",
|
|
51
|
-
whiteSpace: "nowrap"
|
|
52
|
-
}),
|
|
53
|
-
children: subtitle
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
] }),
|
|
57
|
-
actions && /* @__PURE__ */ jsx("div", { style: sx({ display: "flex", alignItems: "center", gap: "var(--space-2)" }), children: actions })
|
|
58
|
-
]
|
|
23
|
+
children
|
|
59
24
|
}
|
|
60
25
|
);
|
|
61
26
|
}
|
|
27
|
+
function Leading({ children }) {
|
|
28
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
29
|
+
}
|
|
30
|
+
function Title({ subtitle, children }) {
|
|
31
|
+
return /* @__PURE__ */ jsxs("div", { style: sx({ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: 1 }), children: [
|
|
32
|
+
children && /* @__PURE__ */ jsx(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
style: sx({
|
|
36
|
+
fontFamily: "var(--font-display)",
|
|
37
|
+
fontSize: "var(--text-lg)",
|
|
38
|
+
fontWeight: "var(--weight-bold)",
|
|
39
|
+
letterSpacing: "var(--tracking-tight)",
|
|
40
|
+
color: "var(--text-primary)",
|
|
41
|
+
overflow: "hidden",
|
|
42
|
+
textOverflow: "ellipsis",
|
|
43
|
+
whiteSpace: "nowrap"
|
|
44
|
+
}),
|
|
45
|
+
children
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
subtitle && /* @__PURE__ */ jsx(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
style: sx({
|
|
52
|
+
fontFamily: "var(--font-body)",
|
|
53
|
+
fontSize: "var(--text-xs)",
|
|
54
|
+
color: "var(--text-muted)",
|
|
55
|
+
overflow: "hidden",
|
|
56
|
+
textOverflow: "ellipsis",
|
|
57
|
+
whiteSpace: "nowrap"
|
|
58
|
+
}),
|
|
59
|
+
children: subtitle
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
] });
|
|
63
|
+
}
|
|
64
|
+
function Actions({ children }) {
|
|
65
|
+
return /* @__PURE__ */ jsx("div", { style: sx({ display: "flex", alignItems: "center", gap: "var(--space-2)" }), children });
|
|
66
|
+
}
|
|
67
|
+
const TopBar = Object.assign(TopBarRoot, { Leading, Title, Actions });
|
|
62
68
|
export {
|
|
63
69
|
TopBar
|
|
64
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/navigation/TopBar.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n
|
|
1
|
+
{"version":3,"sources":["../../src/navigation/TopBar.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Sticky page header — a **compound component**. 60px tall, blurred\n * translucent. `Leading` / `Title` / `Actions` are all optional, independent\n * slots — use whichever the screen needs.\n *\n * ```tsx\n * <TopBar>\n * <TopBar.Leading><IconButton label=\"Back\"><ChevronLeft /></IconButton></TopBar.Leading>\n * <TopBar.Title subtitle=\"Therapy session\">Pick a time</TopBar.Title>\n * <TopBar.Actions><IconButton label=\"Notifications\"><Bell /></IconButton></TopBar.Actions>\n * </TopBar>\n * ```\n */\nexport interface TopBarProps extends React.HTMLAttributes<HTMLElement> {\n sticky?: boolean;\n /** Drops the blur/border for hero headers. */\n transparent?: boolean;\n children?: React.ReactNode;\n}\n\nexport interface TopBarLeadingProps {\n /** Usually a back `IconButton` or the wordmark. */\n children?: React.ReactNode;\n}\n\nexport interface TopBarTitleProps {\n /** Plain string in most cases; accepts nodes for e.g. a `<time>` element or a responsive date. */\n subtitle?: React.ReactNode;\n children?: React.ReactNode;\n}\n\nexport interface TopBarActionsProps {\n children?: React.ReactNode;\n}\n\nfunction TopBarRoot({ sticky = true, transparent = false, children, style, ...rest }: TopBarProps) {\n return (\n <header\n {...rest}\n style={sx({\n display: 'flex',\n alignItems: 'center',\n gap: 'var(--space-3)',\n height: 'var(--topbar-height)',\n padding: '0 var(--gutter-mobile)',\n position: sticky ? 'sticky' : 'relative',\n top: 0,\n zIndex: 20,\n background: transparent ? 'transparent' : 'color-mix(in srgb,var(--bg-surface) 88%,transparent)',\n backdropFilter: transparent ? 'none' : 'blur(12px)',\n borderBottom: transparent ? 'none' : 'var(--border-width-hairline) solid var(--border-default)',\n ...style,\n })}\n >\n {children}\n </header>\n );\n}\n\n/** No wrapper of its own — renders exactly what you give it, first in the row. */\nfunction Leading({ children }: TopBarLeadingProps) {\n return <>{children}</>;\n}\n\nfunction Title({ subtitle, children }: TopBarTitleProps) {\n return (\n <div style={sx({ flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', gap: 1 })}>\n {children && (\n <span\n style={sx({\n fontFamily: 'var(--font-display)',\n fontSize: 'var(--text-lg)',\n fontWeight: 'var(--weight-bold)',\n letterSpacing: 'var(--tracking-tight)',\n color: 'var(--text-primary)',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n })}\n >\n {children}\n </span>\n )}\n {subtitle && (\n <span\n style={sx({\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-xs)',\n color: 'var(--text-muted)',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n })}\n >\n {subtitle}\n </span>\n )}\n </div>\n );\n}\n\nfunction Actions({ children }: TopBarActionsProps) {\n return <div style={sx({ display: 'flex', alignItems: 'center', gap: 'var(--space-2)' })}>{children}</div>;\n}\n\nexport const TopBar = Object.assign(TopBarRoot, { Leading, Title, Actions });\n"],"mappings":";AA0CI,SAwBK,UAxBL,KA6BA,YA7BA;AAvCJ,SAAS,UAAU;AAqCnB,SAAS,WAAW,EAAE,SAAS,MAAM,cAAc,OAAO,UAAU,OAAO,GAAG,KAAK,GAAgB;AACjG,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO,GAAG;AAAA,QACR,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,UAAU,SAAS,WAAW;AAAA,QAC9B,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,YAAY,cAAc,gBAAgB;AAAA,QAC1C,gBAAgB,cAAc,SAAS;AAAA,QACvC,cAAc,cAAc,SAAS;AAAA,QACrC,GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA;AAAA,EACH;AAEJ;AAGA,SAAS,QAAQ,EAAE,SAAS,GAAuB;AACjD,SAAO,gCAAG,UAAS;AACrB;AAEA,SAAS,MAAM,EAAE,UAAU,SAAS,GAAqB;AACvD,SACE,qBAAC,SAAI,OAAO,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,QAAQ,eAAe,UAAU,KAAK,EAAE,CAAC,GACtF;AAAA,gBACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,GAAG;AAAA,UACR,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,eAAe;AAAA,UACf,OAAO;AAAA,UACP,UAAU;AAAA,UACV,cAAc;AAAA,UACd,YAAY;AAAA,QACd,CAAC;AAAA,QAEA;AAAA;AAAA,IACH;AAAA,IAED,YACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,GAAG;AAAA,UACR,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,OAAO;AAAA,UACP,UAAU;AAAA,UACV,cAAc;AAAA,UACd,YAAY;AAAA,QACd,CAAC;AAAA,QAEA;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;AAEA,SAAS,QAAQ,EAAE,SAAS,GAAuB;AACjD,SAAO,oBAAC,SAAI,OAAO,GAAG,EAAE,SAAS,QAAQ,YAAY,UAAU,KAAK,iBAAiB,CAAC,GAAI,UAAS;AACrG;AAEO,MAAM,SAAS,OAAO,OAAO,YAAY,EAAE,SAAS,OAAO,QAAQ,CAAC;","names":[]}
|
package/dist/styles.css
CHANGED
|
@@ -99,6 +99,13 @@
|
|
|
99
99
|
.sereno-sidenav-root[data-collapsed] .sereno-sidenav::-webkit-scrollbar {
|
|
100
100
|
display: none;
|
|
101
101
|
}
|
|
102
|
+
/* The section break — every `SidebarNav.Section` but the first gets the gap +
|
|
103
|
+
divider; `Section` itself doesn't know its own position among siblings. */
|
|
104
|
+
.sereno-sidenav-section:not(:first-child) {
|
|
105
|
+
margin-top: var(--space-3);
|
|
106
|
+
padding-top: var(--space-3);
|
|
107
|
+
border-top: var(--border-width-hairline) solid var(--border-default);
|
|
108
|
+
}
|
|
102
109
|
.sereno-sidenav-btn {
|
|
103
110
|
outline: none;
|
|
104
111
|
}
|