@alexgorbatchev/shadcn 0.0.106 → 0.0.107
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.
|
@@ -39,6 +39,12 @@ interface ISplitViewProps {
|
|
|
39
39
|
* layout it raises the drawer to the full viewport height.
|
|
40
40
|
*/
|
|
41
41
|
sidebarExpanded?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Height of the "drawer" narrow layout until `sidebarExpanded` raises it to full height: "tall" (the default) is 85%
|
|
44
|
+
* of the viewport, as a phone's comments; "half" is 50%, so content the drawer refers to, such as a region on an
|
|
45
|
+
* image, stays in view above it.
|
|
46
|
+
*/
|
|
47
|
+
drawerHeight?: "tall" | "half";
|
|
42
48
|
/** Called when a "sheet" or "drawer" narrow layout asks to open or close the sidebar, such as on Escape or a swipe. */
|
|
43
49
|
onSidebarOpenChange?: (open: boolean) => void;
|
|
44
50
|
/**
|
|
@@ -52,5 +58,5 @@ interface ISplitViewProps {
|
|
|
52
58
|
* open sidebar take over the content's place. The sidebar and content render into slots that move between the
|
|
53
59
|
* layouts, so their state survives resizing across the breakpoint and opening or closing the sidebar.
|
|
54
60
|
*/
|
|
55
|
-
export declare function SplitView({ sidebar, children, storageKey, sidebarPosition, sidebarOpen, storage, sidebarLabel, contentLabel, resizeLabel, defaultSidebarSize, sidebarPadding, contentPadding, layout: layoutMode, minSidebarSize, maxSidebarSize, wideQuery, narrowLayout, sidebarExpanded, onSidebarOpenChange, sidebarFinalFocus, }: ISplitViewProps): ReactElement;
|
|
61
|
+
export declare function SplitView({ sidebar, children, storageKey, sidebarPosition, sidebarOpen, storage, sidebarLabel, contentLabel, resizeLabel, defaultSidebarSize, sidebarPadding, contentPadding, layout: layoutMode, minSidebarSize, maxSidebarSize, wideQuery, narrowLayout, sidebarExpanded, drawerHeight, onSidebarOpenChange, sidebarFinalFocus, }: ISplitViewProps): ReactElement;
|
|
56
62
|
export {};
|
|
@@ -115,6 +115,7 @@ function SplitView({
|
|
|
115
115
|
wideQuery = "(min-width: 1024px)",
|
|
116
116
|
narrowLayout = "stack",
|
|
117
117
|
sidebarExpanded = false,
|
|
118
|
+
drawerHeight = "tall",
|
|
118
119
|
onSidebarOpenChange,
|
|
119
120
|
sidebarFinalFocus
|
|
120
121
|
}) {
|
|
@@ -265,7 +266,7 @@ function SplitView({
|
|
|
265
266
|
children: /* @__PURE__ */ jsxs(DrawerContent2, {
|
|
266
267
|
"aria-label": sidebarLabel,
|
|
267
268
|
finalFocus: sidebarFinalFocus,
|
|
268
|
-
className: cn2(narrowLayout === "drawer" && "data-[swipe-axis=y]:[--drawer-content-max-height:100dvh] data-[swipe-axis=y]:rounded-t-none", narrowLayout === "drawer" && (sidebarExpanded ? "h-dvh" : "h-[85dvh]")),
|
|
269
|
+
className: cn2(narrowLayout === "drawer" && "data-[swipe-axis=y]:[--drawer-content-max-height:100dvh] data-[swipe-axis=y]:rounded-t-none", narrowLayout === "drawer" && (sidebarExpanded ? "h-dvh" : drawerHeight === "half" ? "h-[50dvh]" : "h-[85dvh]")),
|
|
269
270
|
children: [
|
|
270
271
|
narrowLayout === "sheet" && /* @__PURE__ */ jsxs("div", {
|
|
271
272
|
className: "flex shrink-0 items-center justify-between gap-2 p-panel pb-0",
|
package/dist/prototype.js
CHANGED
|
@@ -2051,7 +2051,7 @@ var program = new Command;
|
|
|
2051
2051
|
// package.json
|
|
2052
2052
|
var package_default = {
|
|
2053
2053
|
name: "@alexgorbatchev/shadcn",
|
|
2054
|
-
version: "0.0.
|
|
2054
|
+
version: "0.0.107",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -280,3 +280,24 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
```
|
|
283
|
+
|
|
284
|
+
### NarrowHalfDrawer
|
|
285
|
+
|
|
286
|
+
```tsx
|
|
287
|
+
{
|
|
288
|
+
render: function Example(args) {
|
|
289
|
+
const [open, setOpen] = useState(false);
|
|
290
|
+
const [expanded, setExpanded] = useState(false);
|
|
291
|
+
return (<div className="flex w-[600px] flex-col gap-2">
|
|
292
|
+
<Button onClick={() => setOpen(true)}>Comment on region</Button>
|
|
293
|
+
<SplitView {...args} sidebarLabel="Comments on this image" sidebarPosition="end" sidebarOpen={open} sidebarExpanded={expanded} drawerHeight="half" onSidebarOpenChange={setOpen} wideQuery="(min-width: 100000px)" narrowLayout="drawer" layout="fill" sidebar={<div className="flex gap-2 p-panel">
|
|
294
|
+
<Button variant="outline" onClick={() => setExpanded(!expanded)}>
|
|
295
|
+
{expanded ? "Collapse" : "Full height"}
|
|
296
|
+
</Button>
|
|
297
|
+
</div>}>
|
|
298
|
+
<h2>Deploy monitor screenshot</h2>
|
|
299
|
+
</SplitView>
|
|
300
|
+
</div>);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
```
|