@alexgorbatchev/shadcn 0.0.92 → 0.0.94

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.
@@ -5701,7 +5701,7 @@ var componentDefinitions2 = {
5701
5701
  className: string2().nullable().describe("Additional CSS classes")
5702
5702
  }),
5703
5703
  slots: ["default"],
5704
- description: "Flex container for layouts",
5704
+ description: "Flex container for layouts. Fills the width of its parent.",
5705
5705
  example: { direction: "vertical", gap: "md" }
5706
5706
  },
5707
5707
  Grid: {
@@ -5711,7 +5711,7 @@ var componentDefinitions2 = {
5711
5711
  className: string2().nullable().describe("Additional CSS classes")
5712
5712
  }),
5713
5713
  slots: ["default"],
5714
- description: "Grid layout (1-6 columns)",
5714
+ description: "Grid layout (1-6 columns). Fills the width of its parent.",
5715
5715
  example: { columns: 3, gap: "md" }
5716
5716
  },
5717
5717
  Separator: {
@@ -5731,7 +5731,7 @@ var componentDefinitions2 = {
5731
5731
  }),
5732
5732
  slots: ["default"],
5733
5733
  events: ["change"],
5734
- description: "Tab navigation. Use { $bindState } on value for active tab binding."
5734
+ description: "Tabs with panels. Child i is the panel of tab i: only the active tab's panel shows, and inactive panels stay mounted but hidden. Children beyond the tab count render below the panels. Use { $bindState } on value for active tab binding."
5735
5735
  },
5736
5736
  Accordion: {
5737
5737
  props: object({
@@ -5741,7 +5741,7 @@ var componentDefinitions2 = {
5741
5741
  })),
5742
5742
  type: _enum(["single", "multiple"]).nullable()
5743
5743
  }),
5744
- description: "Collapsible sections. Items as [{title, content}]. Type 'single' (default) or 'multiple'."
5744
+ description: "Collapsible text sections. Items as [{title, content}] with plain-text content; children are not rendered (use Collapsible to hide other components). Type 'single' (default) or 'multiple'."
5745
5745
  },
5746
5746
  Collapsible: {
5747
5747
  props: object({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  componentDefinitions2
3
- } from "../../chunk-tch86q2w.js";
3
+ } from "../../chunk-p8bdmafq.js";
4
4
  export {
5
5
  componentDefinitions2 as componentDefinitions
6
6
  };
@@ -25,13 +25,8 @@ import {
25
25
  PaginationLink2,
26
26
  PaginationPrevious2,
27
27
  PaginationNext2,
28
- PaginationEllipsis2,
29
- Drawer2,
30
- DrawerContent2,
31
- DrawerHeader2,
32
- DrawerTitle2,
33
- DrawerDescription2
34
- } from "../../chunk-kr38ww4n.js";
28
+ PaginationEllipsis2
29
+ } from "../../chunk-fg1h007n.js";
35
30
  import {
36
31
  MenuPopup,
37
32
  MenuItem2,
@@ -101,7 +96,8 @@ import"../../chunk-kmqx7c48.js";
101
96
  import {
102
97
  Tabs2,
103
98
  TabsList2,
104
- TabsTrigger2
99
+ TabsTrigger2,
100
+ TabsContent2
105
101
  } from "../../chunk-t0t1c3a7.js";
106
102
  import"../../chunk-4e96tpw0.js";
107
103
  import {
@@ -115,7 +111,13 @@ import {
115
111
  SelectItem2
116
112
  } from "../../chunk-p6z2m3zp.js";
117
113
  import"../../chunk-1j2hz3w9.js";
118
- import"../../chunk-k99h6evz.js";
114
+ import {
115
+ Drawer2,
116
+ DrawerContent2,
117
+ DrawerHeader2,
118
+ DrawerTitle2,
119
+ DrawerDescription2
120
+ } from "../../chunk-cc35g6sr.js";
119
121
  import {
120
122
  Toggle2,
121
123
  ToggleGroup2,
@@ -161,7 +163,7 @@ import {
161
163
  } from "../../chunk-xfz7r7dk.js";
162
164
  import {
163
165
  componentDefinitions2
164
- } from "../../chunk-tch86q2w.js";
166
+ } from "../../chunk-p8bdmafq.js";
165
167
  import"../../chunk-5mydsjp3.js";
166
168
 
167
169
  // src/components/json-render/JsonCard.tsx
@@ -218,7 +220,7 @@ var JsonStack = ({ props, children }) => {
218
220
  const alignClass = alignMap[props.align ?? "start"] ?? "items-start";
219
221
  const justifyClass = justifyMap[props.justify ?? ""] ?? "";
220
222
  return /* @__PURE__ */ jsx2("div", {
221
- className: cn2("flex", isHorizontal ? "flex-row flex-wrap" : "flex-col", gapClass, alignClass, justifyClass, props.className),
223
+ className: cn2("flex w-full min-w-0", isHorizontal ? "flex-row flex-wrap" : "flex-col", gapClass, alignClass, justifyClass, props.className),
222
224
  children
223
225
  });
224
226
  };
@@ -244,7 +246,7 @@ var JsonGrid = ({ props, children }) => {
244
246
  const cols = colsMap[n] ?? "grid-cols-1";
245
247
  const gridGap = gridGapMap[props.gap ?? "md"] ?? "gap-3";
246
248
  return /* @__PURE__ */ jsx3("div", {
247
- className: cn2("grid", cols, gridGap, props.className),
249
+ className: cn2("grid w-full min-w-0", cols, gridGap, props.className),
248
250
  children
249
251
  });
250
252
  };
@@ -262,6 +264,11 @@ var JsonSeparator = ({ props }) => {
262
264
  import { useState } from "react";
263
265
  import { useBoundProp } from "@json-render/react";
264
266
  import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
267
+ function toChildList(children) {
268
+ if (Array.isArray(children))
269
+ return children;
270
+ return children === undefined || children === null ? [] : [children];
271
+ }
265
272
  var JsonTabs = ({ props, children, bindings, emit }) => {
266
273
  const tabs = props.tabs ?? [];
267
274
  const [boundValue, setBoundValue] = useBoundProp(props.value ?? undefined, bindings?.value);
@@ -269,6 +276,9 @@ var JsonTabs = ({ props, children, bindings, emit }) => {
269
276
  const isBound = !!bindings?.value;
270
277
  const value = isBound ? boundValue ?? tabs[0]?.value ?? "" : localValue;
271
278
  const setValue = isBound ? setBoundValue : setLocalValue;
279
+ const childList = toChildList(children);
280
+ const hasPanels = childList.length > 0;
281
+ const extraChildren = childList.slice(tabs.length);
272
282
  return /* @__PURE__ */ jsxs2(Tabs2, {
273
283
  value,
274
284
  onValueChange: (v) => {
@@ -282,7 +292,12 @@ var JsonTabs = ({ props, children, bindings, emit }) => {
282
292
  children: tab.label
283
293
  }, tab.value))
284
294
  }),
285
- children
295
+ hasPanels && tabs.map((tab, index) => /* @__PURE__ */ jsx5(TabsContent2, {
296
+ value: tab.value,
297
+ keepMounted: true,
298
+ children: childList[index]
299
+ }, tab.value)),
300
+ extraChildren
286
301
  ]
287
302
  });
288
303
  };
@@ -449,7 +464,7 @@ var JsonTable = ({ props }) => {
449
464
  const columns = props.columns ?? [];
450
465
  const rows = (props.rows ?? []).map((row) => row.map(String));
451
466
  return /* @__PURE__ */ jsx11("div", {
452
- className: "rounded-md border border-border overflow-hidden",
467
+ className: "w-full min-w-0 rounded-md border border-border overflow-hidden",
453
468
  children: /* @__PURE__ */ jsxs8(Table2, {
454
469
  children: [
455
470
  props.caption && /* @__PURE__ */ jsx11(TableCaption2, {
@@ -1,4 +1,5 @@
1
1
  import { type ReactElement, type ReactNode } from "react";
2
+ import type { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
2
3
  import { type LayoutStorage } from "react-resizable-panels";
3
4
  interface ISplitViewProps {
4
5
  sidebar: ReactNode;
@@ -26,16 +27,30 @@ interface ISplitViewProps {
26
27
  * Below `wideQuery`: "stack" places the panes one above the other; "takeover" shows an open sidebar in the content's
27
28
  * place, with the content hidden but still mounted, as a narrow window's inspector or review does; "strip" places an
28
29
  * open sidebar above the content as a strip whose height the divider resizes, so both stay in view and usable, as a
29
- * persistent tool panel under a player does.
30
+ * persistent tool panel under a player does. "sheet" opens the sidebar as a modal, full-height panel from its own
31
+ * edge, titled `sidebarLabel` with a Close button, as a phone's navigation does; "drawer" opens it as a modal bottom
32
+ * drawer at 85% of the viewport height, full height while `sidebarExpanded`, as a phone's comments do. Both close on
33
+ * Escape, an outside press or a swipe toward their edge, report it through `onSidebarOpenChange`, and leave the
34
+ * content in the document's flow so the page scrolls as one document.
35
+ */
36
+ narrowLayout?: "stack" | "takeover" | "strip" | "sheet" | "drawer";
37
+ /**
38
+ * Widens the sidebar to `maxSidebarSize`; turning it off restores the width it had before. With the "drawer" narrow
39
+ * layout it raises the drawer to the full viewport height.
30
40
  */
31
- narrowLayout?: "stack" | "takeover" | "strip";
32
- /** Widens the sidebar to `maxSidebarSize`; turning it off restores the width it had before. */
33
41
  sidebarExpanded?: boolean;
42
+ /** Called when a "sheet" or "drawer" narrow layout asks to open or close the sidebar, such as on Escape or a swipe. */
43
+ onSidebarOpenChange?: (open: boolean) => void;
44
+ /**
45
+ * Where focus goes when a "sheet" or "drawer" narrow layout closes, as Base UI's `finalFocus`: by default the element
46
+ * that had focus before it opened; return `false` from a function to leave focus where the consumer put it.
47
+ */
48
+ sidebarFinalFocus?: DialogPrimitive.Popup.Props["finalFocus"];
34
49
  }
35
50
  /**
36
51
  * Pairs a resizable sidebar with its content above `wideQuery` (1024px by default) and stacks them below it, or lets an
37
52
  * open sidebar take over the content's place. The sidebar and content render into slots that move between the
38
53
  * layouts, so their state survives resizing across the breakpoint and opening or closing the sidebar.
39
54
  */
40
- export declare function SplitView({ sidebar, children, storageKey, sidebarPosition, sidebarOpen, storage, sidebarLabel, contentLabel, resizeLabel, defaultSidebarSize, sidebarPadding, contentPadding, layout: layoutMode, minSidebarSize, maxSidebarSize, wideQuery, narrowLayout, sidebarExpanded, }: ISplitViewProps): ReactElement;
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;
41
56
  export {};
@@ -12,8 +12,20 @@ import {
12
12
  Separator2
13
13
  } from "../../chunk-52aadmkc.js";
14
14
  import {
15
- useMediaQuery
16
- } from "../../chunk-k99h6evz.js";
15
+ useMediaQuery,
16
+ Drawer2,
17
+ DrawerClose2,
18
+ DrawerContent2,
19
+ DrawerTitle2
20
+ } from "../../chunk-cc35g6sr.js";
21
+ import"../../chunk-e6hk39ev.js";
22
+ import"../../chunk-x90xmrba.js";
23
+ import {
24
+ useDirection2
25
+ } from "../../chunk-jpvw9xqy.js";
26
+ import {
27
+ Button2
28
+ } from "../../chunk-32t5kc0y.js";
17
29
  import"../../chunk-5mydsjp3.js";
18
30
  // src/components/resizable/SplitView.tsx
19
31
  import {
@@ -24,6 +36,7 @@ import {
24
36
  useSyncExternalStore
25
37
  } from "react";
26
38
  import { createPortal } from "react-dom";
39
+ import { XIcon } from "lucide-react";
27
40
  import { useDefaultLayout, usePanelRef } from "react-resizable-panels";
28
41
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
29
42
  var layoutStorage = {
@@ -33,6 +46,8 @@ var layoutStorage = {
33
46
  if (!raw)
34
47
  return null;
35
48
  const value = JSON.parse(raw);
49
+ if (typeof value === "number")
50
+ return Number.isFinite(value) && value > 0 ? raw : null;
36
51
  if (typeof value !== "object" || value === null || Array.isArray(value))
37
52
  return null;
38
53
  return Object.values(value).every((size) => typeof size === "number" && Number.isFinite(size) && size >= 0 && size <= 100) ? raw : null;
@@ -46,6 +61,23 @@ var layoutStorage = {
46
61
  } catch {}
47
62
  }
48
63
  };
64
+ function getSidebarWidthKey(storageKey) {
65
+ return `split-view:${storageKey}:sidebar-px`;
66
+ }
67
+ function readSidebarWidth(storage, storageKey) {
68
+ try {
69
+ const raw = storage.getItem(getSidebarWidthKey(storageKey));
70
+ const value = raw === null ? null : JSON.parse(raw);
71
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : null;
72
+ } catch {
73
+ return null;
74
+ }
75
+ }
76
+ function writeSidebarWidth(storage, storageKey, width) {
77
+ try {
78
+ storage.setItem(getSidebarWidthKey(storageKey), JSON.stringify(width));
79
+ } catch {}
80
+ }
49
81
  function createSlot() {
50
82
  const slot = document.createElement("div");
51
83
  slot.className = "contents";
@@ -82,22 +114,25 @@ function SplitView({
82
114
  maxSidebarSize = "50%",
83
115
  wideQuery = "(min-width: 1024px)",
84
116
  narrowLayout = "stack",
85
- sidebarExpanded = false
117
+ sidebarExpanded = false,
118
+ onSidebarOpenChange,
119
+ sidebarFinalFocus
86
120
  }) {
87
121
  const isFill = layoutMode === "fill";
88
122
  const isWide = useMediaQuery(wideQuery);
123
+ const direction = useDirection2();
89
124
  const isTakeover = !isWide && narrowLayout === "takeover" && sidebarOpen;
90
125
  const isStrip = !isWide && narrowLayout === "strip" && sidebarOpen;
91
- const layout = useDefaultLayout({ id: storageKey, storage, onlySaveAfterUserInteractions: true });
126
+ const isOverlay = !isWide && (narrowLayout === "sheet" || narrowLayout === "drawer");
92
127
  const stripLayout = useDefaultLayout({ id: `${storageKey}:strip`, storage, onlySaveAfterUserInteractions: true });
93
128
  const sidebarRef = usePanelRef();
94
129
  const isHydrated = useSyncExternalStore(subscribeToHydration, () => true, () => false);
95
130
  const [slots] = useState(createSlots);
96
131
  const portalSlots = isHydrated ? slots : null;
97
- const storedSize = layout.defaultLayout?.sidebar;
98
- const openSize = useRef(storedSize !== undefined && storedSize > 0 ? `${storedSize}%` : defaultSidebarSize);
99
- const wasShownOpen = useRef(false);
132
+ const [storedWidth] = useState(() => readSidebarWidth(storage, storageKey));
133
+ const openSize = useRef(storedWidth ?? defaultSidebarSize);
100
134
  const pendingOpenSize = useRef(null);
135
+ const groupRef = useRef(null);
101
136
  useEffect(() => {
102
137
  const panel = sidebarRef.current;
103
138
  if (!isWide || !panel)
@@ -107,12 +142,8 @@ function SplitView({
107
142
  pendingOpenSize.current = openSize.current;
108
143
  panel.expand();
109
144
  }
110
- wasShownOpen.current = true;
111
145
  return;
112
146
  }
113
- if (wasShownOpen.current && !panel.isCollapsed())
114
- openSize.current = `${panel.getSize().asPercentage}%`;
115
- wasShownOpen.current = false;
116
147
  panel.collapse();
117
148
  }, [isWide, sidebarOpen, sidebarRef]);
118
149
  const unexpandedSize = useRef(null);
@@ -129,15 +160,15 @@ function SplitView({
129
160
  }
130
161
  }, [isWide, sidebarOpen, sidebarExpanded, maxSidebarSize, sidebarRef]);
131
162
  const sidebarContent = /* @__PURE__ */ jsx("aside", {
132
- hidden: !sidebarOpen,
163
+ hidden: !sidebarOpen && !isOverlay,
133
164
  "aria-label": sidebarLabel,
134
- className: cn2("min-w-0 bg-card", isWide && "h-full", sidebarPadding === "panel" && "p-4", isFill && "min-h-0 overflow-y-auto", !isWide && isFill && !isTakeover && !isStrip && "max-h-[35%] shrink-0", isStrip && "h-full", isTakeover && isFill && "flex-1"),
165
+ className: cn2("min-w-0 bg-card", isWide && "h-full", sidebarPadding === "panel" && "p-4", (isFill || isOverlay) && "min-h-0 overflow-y-auto", isOverlay && "flex-1", !isWide && isFill && !isTakeover && !isStrip && !isOverlay && "max-h-[35%] shrink-0", isStrip && "h-full", isTakeover && isFill && "flex-1"),
135
166
  children: sidebar
136
167
  });
137
168
  const content = /* @__PURE__ */ jsx("section", {
138
169
  "aria-label": contentLabel,
139
170
  hidden: isTakeover,
140
- className: cn2("min-w-0 bg-card", isWide && "h-full", contentPadding === "panel" && "p-4", isFill && "flex min-h-0 flex-1 flex-col overflow-hidden"),
171
+ className: cn2("min-w-0 bg-card", isWide && "h-full", contentPadding === "panel" && "p-4", isFill && (isOverlay ? "flex flex-1 flex-col" : "flex min-h-0 flex-1 flex-col overflow-hidden")),
141
172
  children
142
173
  });
143
174
  const sidebarSlot = portalSlots ? /* @__PURE__ */ jsx(SlotHost, {
@@ -160,8 +191,11 @@ function SplitView({
160
191
  sidebarRef.current?.resize(pending);
161
192
  } else if (pending === null && size.inPixels === 0)
162
193
  sidebarRef.current?.resize(minSidebarSize);
194
+ else if (pending === null)
195
+ openSize.current = size.inPixels;
163
196
  },
164
- defaultSize: defaultSidebarSize,
197
+ defaultSize: openSize.current,
198
+ groupResizeBehavior: "preserve-pixel-size",
165
199
  minSize: minSidebarSize,
166
200
  maxSize: maxSidebarSize,
167
201
  children: sidebarSlot
@@ -173,8 +207,17 @@ function SplitView({
173
207
  });
174
208
  const frame = isWide ? /* @__PURE__ */ jsxs(Resizable2, {
175
209
  orientation: "horizontal",
176
- defaultLayout: layout.defaultLayout,
177
- onLayoutChanged: layout.onLayoutChanged,
210
+ elementRef: groupRef,
211
+ onLayoutChanged: (layout, meta) => {
212
+ const share = layout.sidebar;
213
+ const group = groupRef.current;
214
+ if (!meta.isUserInteraction || !sidebarOpen || share === undefined || share <= 0 || !group)
215
+ return;
216
+ const dividers = Array.from(group.querySelectorAll(":scope > [role='separator']"));
217
+ const width = dividers.reduce((total, divider) => total - divider.getBoundingClientRect().width, group.getBoundingClientRect().width);
218
+ openSize.current = width * share / 100;
219
+ writeSidebarWidth(storage, storageKey, openSize.current);
220
+ },
178
221
  children: [
179
222
  sidebarPosition === "start" ? sidebarPanel : contentPanel,
180
223
  /* @__PURE__ */ jsx(ResizableHandle2, {
@@ -208,6 +251,47 @@ function SplitView({
208
251
  children: contentSlot
209
252
  })
210
253
  ]
254
+ }) : isOverlay ? /* @__PURE__ */ jsxs(Fragment, {
255
+ children: [
256
+ /* @__PURE__ */ jsx("div", {
257
+ className: cn2("flex min-w-0 flex-col bg-card", isFill && "flex-1"),
258
+ children: contentSlot
259
+ }),
260
+ /* @__PURE__ */ jsx(Drawer2, {
261
+ open: sidebarOpen,
262
+ onOpenChange: (open) => onSidebarOpenChange?.(open),
263
+ showSwipeHandle: true,
264
+ swipeDirection: narrowLayout === "drawer" ? "down" : sidebarPosition === "start" === (direction === "rtl") ? "right" : "left",
265
+ children: /* @__PURE__ */ jsxs(DrawerContent2, {
266
+ "aria-label": sidebarLabel,
267
+ 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
+ children: [
270
+ narrowLayout === "sheet" && /* @__PURE__ */ jsxs("div", {
271
+ className: "flex shrink-0 items-center justify-between gap-2 p-panel pb-0",
272
+ children: [
273
+ /* @__PURE__ */ jsx(DrawerTitle2, {
274
+ children: sidebarLabel
275
+ }),
276
+ /* @__PURE__ */ jsxs(DrawerClose2, {
277
+ render: /* @__PURE__ */ jsx(Button2, {
278
+ variant: "ghost",
279
+ size: "sm"
280
+ }),
281
+ children: [
282
+ /* @__PURE__ */ jsx(XIcon, {
283
+ "aria-hidden": "true"
284
+ }),
285
+ "Close"
286
+ ]
287
+ })
288
+ ]
289
+ }),
290
+ sidebarSlot
291
+ ]
292
+ })
293
+ })
294
+ ]
211
295
  }) : /* @__PURE__ */ jsxs("div", {
212
296
  className: cn2("flex min-w-0 flex-col bg-card", isFill && "h-full min-h-0 overflow-hidden"),
213
297
  children: [
package/dist/index.js CHANGED
@@ -66,17 +66,6 @@ import {
66
66
  PaginationPrevious2,
67
67
  PaginationNext2,
68
68
  PaginationEllipsis2,
69
- Drawer2,
70
- DrawerTrigger2,
71
- DrawerPortal2,
72
- DrawerClose2,
73
- DrawerOverlay2,
74
- DrawerSwipeHandle2,
75
- DrawerContent2,
76
- DrawerHeader2,
77
- DrawerFooter2,
78
- DrawerTitle2,
79
- DrawerDescription2,
80
69
  Menubar2,
81
70
  MenubarMenu2,
82
71
  MenubarGroup2,
@@ -176,7 +165,7 @@ import {
176
165
  StatusTracker2,
177
166
  DashboardLayout2,
178
167
  BillingUsage2
179
- } from "./chunk-kr38ww4n.js";
168
+ } from "./chunk-fg1h007n.js";
180
169
  import {
181
170
  Combobox2,
182
171
  ComboboxValue2,
@@ -443,7 +432,19 @@ import {
443
432
  Input2
444
433
  } from "./chunk-7vg045gd.js";
445
434
  import"./chunk-7jpsybag.js";
446
- import"./chunk-k99h6evz.js";
435
+ import {
436
+ Drawer2,
437
+ DrawerTrigger2,
438
+ DrawerPortal2,
439
+ DrawerClose2,
440
+ DrawerOverlay2,
441
+ DrawerSwipeHandle2,
442
+ DrawerContent2,
443
+ DrawerHeader2,
444
+ DrawerFooter2,
445
+ DrawerTitle2,
446
+ DrawerDescription2
447
+ } from "./chunk-cc35g6sr.js";
447
448
  import {
448
449
  Separator2
449
450
  } from "./chunk-52aadmkc.js";
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.92",
2054
+ version: "0.0.94",
2055
2055
  description: "Sharp, monospace React components with compact and comfortable densities.",
2056
2056
  license: "MIT",
2057
2057
  repository: {
@@ -491,3 +491,83 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
491
491
  }
492
492
  }
493
493
  ```
494
+
495
+ ### TableInStack
496
+
497
+ ```tsx
498
+ {
499
+ args: {
500
+ spec: {
501
+ root: "root",
502
+ elements: {
503
+ root: {
504
+ type: "Stack",
505
+ props: { direction: null, gap: null, align: null, justify: null, className: null },
506
+ children: [...tableAlignments.map((alignment) => `stack-${alignment}`), "wide-stack"],
507
+ },
508
+ ...Object.fromEntries(tableAlignments.flatMap((alignment) => [
509
+ [
510
+ `stack-${alignment}`,
511
+ {
512
+ type: "Stack",
513
+ props: { align: alignment === "default" ? null : alignment },
514
+ children: [`table-${alignment}`],
515
+ },
516
+ ],
517
+ [
518
+ `table-${alignment}`,
519
+ {
520
+ type: "Table",
521
+ props: {
522
+ caption: `Benchmarks aligned ${alignment}`,
523
+ columns: ["Option", "Latency", "Cost"],
524
+ rows: [
525
+ ["Blue-green", "120 ms", "$40"],
526
+ ["Canary", "95 ms", "$55"],
527
+ ],
528
+ },
529
+ },
530
+ ],
531
+ ])),
532
+ "wide-stack": { type: "Stack", props: { align: null }, children: ["wide-table"] },
533
+ "wide-table": {
534
+ type: "Table",
535
+ props: {
536
+ caption: "Wide benchmarks",
537
+ columns: wideColumns,
538
+ rows: [wideColumns.map((_, index) => `measured value ${index + 1}`)],
539
+ },
540
+ },
541
+ },
542
+ },
543
+ }
544
+ }
545
+ ```
546
+
547
+ ### TabsWithPanels
548
+
549
+ ```tsx
550
+ {
551
+ args: {
552
+ spec: {
553
+ root: "tabs",
554
+ elements: {
555
+ tabs: {
556
+ type: "Tabs",
557
+ props: {
558
+ tabs: [
559
+ { value: "summary", label: "Summary" },
560
+ { value: "risks", label: "Risks" },
561
+ ],
562
+ },
563
+ children: ["summary", "risks", "footer"],
564
+ },
565
+ summary: { type: "Text", props: { text: "Summary panel content" } },
566
+ risks: { type: "Collapsible", props: { title: "Risk details", defaultOpen: true }, children: ["risk-text"] },
567
+ "risk-text": { type: "Text", props: { text: "Risks panel content" } },
568
+ footer: { type: "Text", props: { text: "Shown under every tab" } },
569
+ },
570
+ },
571
+ }
572
+ }
573
+ ```
@@ -82,7 +82,7 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
82
82
  {isVisible && (<SplitView {...args} storageKey="external-layout" storage={storage} sidebar={<h2>Navigation</h2>}>
83
83
  <h2>Content</h2>
84
84
  </SplitView>)}
85
- <Button onClick={() => setVisible(values.has("react-resizable-panels:external-layout"))}>
85
+ <Button onClick={() => setVisible(values.has("split-view:external-layout:sidebar-px"))}>
86
86
  Restore saved panels
87
87
  </Button>
88
88
  <p role="status">{isSaved ? "Layout saved" : "No saved layout"}</p>
@@ -236,3 +236,47 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
236
236
  }
237
237
  }
238
238
  ```
239
+
240
+ ### NarrowSheet
241
+
242
+ ```tsx
243
+ {
244
+ render: function Example(args) {
245
+ const [open, setOpen] = useState(false);
246
+ return (<div className="flex w-[600px] flex-col gap-2">
247
+ <Button onClick={() => setOpen(true)}>Pages</Button>
248
+ <SplitView {...args} sidebarLabel="Pages" sidebarOpen={open} onSidebarOpenChange={setOpen} wideQuery="(min-width: 100000px)" narrowLayout="sheet" layout="fill" sidebar={<nav aria-label="Projects and pages">
249
+ <button type="button" onClick={() => setOpen(false)}>
250
+ Brand questionnaire
251
+ </button>
252
+ </nav>}>
253
+ <h2>Incident review</h2>
254
+ </SplitView>
255
+ </div>);
256
+ }
257
+ }
258
+ ```
259
+
260
+ ### NarrowDrawer
261
+
262
+ ```tsx
263
+ {
264
+ render: function Example(args) {
265
+ const [open, setOpen] = useState(false);
266
+ const [expanded, setExpanded] = useState(false);
267
+ return (<div className="flex w-[600px] flex-col gap-2">
268
+ <Button onClick={() => setOpen(true)}>Comments</Button>
269
+ <SplitView {...args} sidebarLabel="Comments" sidebarPosition="end" sidebarOpen={open} sidebarExpanded={expanded} onSidebarOpenChange={setOpen} wideQuery="(min-width: 100000px)" narrowLayout="drawer" layout="fill" sidebar={<div className="flex gap-2 p-panel">
270
+ <Button variant="outline" onClick={() => setExpanded(!expanded)}>
271
+ {expanded ? "Collapse" : "Full height"}
272
+ </Button>
273
+ <Button variant="outline" onClick={() => setOpen(false)}>
274
+ Close comments
275
+ </Button>
276
+ </div>}>
277
+ <h2>Incident review</h2>
278
+ </SplitView>
279
+ </div>);
280
+ }
281
+ }
282
+ ```
@@ -595,3 +595,23 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
595
595
  </Drawer>)
596
596
  }
597
597
  ```
598
+
599
+ ### MotionPreference
600
+
601
+ ```tsx
602
+ {
603
+ render: (args) => (<Drawer {...args}>
604
+ <DrawerTrigger render={<Button variant="outline"/>}>Open details</DrawerTrigger>
605
+ <DrawerContent>
606
+ <DrawerHeader>
607
+ <DrawerTitle>Project details</DrawerTitle>
608
+ <DrawerDescription>Review the project before continuing.</DrawerDescription>
609
+ </DrawerHeader>
610
+ <div className="p-panel">Three tasks are ready.</div>
611
+ <DrawerFooter>
612
+ <DrawerClose render={<Button />}>Done</DrawerClose>
613
+ </DrawerFooter>
614
+ </DrawerContent>
615
+ </Drawer>)
616
+ }
617
+ ```
@@ -431,3 +431,23 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
431
431
  </Sheet>)
432
432
  }
433
433
  ```
434
+
435
+ ### MotionPreference
436
+
437
+ ```tsx
438
+ {
439
+ render: (args) => (<Sheet>
440
+ <SheetTrigger render={<Button variant="outline"/>}>Open preferences</SheetTrigger>
441
+ <SheetContent {...args}>
442
+ <SheetHeader>
443
+ <SheetTitle>Preferences</SheetTitle>
444
+ <SheetDescription>Adjust your workspace preferences.</SheetDescription>
445
+ </SheetHeader>
446
+ <SheetFooter>
447
+ <SheetClose render={<Button />}>Done</SheetClose>
448
+ </SheetFooter>
449
+ </SheetContent>
450
+ </Sheet>),
451
+ args: { side: "left" }
452
+ }
453
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.92",
3
+ "version": "0.0.94",
4
4
  "description": "Sharp, monospace React components with compact and comfortable densities.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,11 +0,0 @@
1
- // src/hooks/useMediaQuery.ts
2
- import { useMemo, useSyncExternalStore } from "react";
3
- function useMediaQuery(query) {
4
- const media = useMemo(() => typeof window === "undefined" ? undefined : window.matchMedia(query), [query]);
5
- return useSyncExternalStore((listener) => {
6
- media?.addEventListener("change", listener);
7
- return () => media?.removeEventListener("change", listener);
8
- }, () => media?.matches ?? false, () => false);
9
- }
10
-
11
- export { useMediaQuery };