@alexgorbatchev/shadcn 0.0.121 → 0.0.123

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.
@@ -160,7 +160,7 @@ import {
160
160
  SidebarMenu2,
161
161
  SidebarMenuItem2,
162
162
  SidebarMenuButton2
163
- } from "./chunk-rz47npnq.js";
163
+ } from "./chunk-wjs8ks1h.js";
164
164
  import {
165
165
  AnalyticsButton
166
166
  } from "./chunk-tcefvfr8.js";
@@ -13,7 +13,7 @@ import {
13
13
  SidebarMenu2,
14
14
  SidebarMenuItem2,
15
15
  SidebarMenuButton2
16
- } from "./chunk-rz47npnq.js";
16
+ } from "./chunk-wjs8ks1h.js";
17
17
  import {
18
18
  ThreadList3
19
19
  } from "./chunk-645t7r1c.js";
@@ -88,10 +88,13 @@ function SheetContent2({
88
88
  children,
89
89
  side = "right",
90
90
  showCloseButton = true,
91
+ width,
92
+ style,
91
93
  ...props
92
94
  }) {
93
95
  const resolvedDensity = useDensity(density);
94
96
  const direction = useDirection2();
97
+ const sheetWidth = typeof width === "number" ? `${width}px` : width;
95
98
  return /* @__PURE__ */ jsxs(SheetPortal, {
96
99
  children: [
97
100
  /* @__PURE__ */ jsx(SheetOverlay, {}),
@@ -101,7 +104,15 @@ function SheetContent2({
101
104
  "data-slot": "sheet-content",
102
105
  "data-scroll": "none",
103
106
  "data-side": side,
104
- className: (state) => cn2("fixed flex flex-col gap-panel bg-popover bg-clip-padding text-sm text-popover-foreground shadow-frame border border-frame-edge transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm", typeof className === "function" ? className(state) : className),
107
+ "data-sized": sheetWidth === undefined ? undefined : "",
108
+ style: sheetWidth === undefined ? style : (state) => {
109
+ const sized = {
110
+ ...typeof style === "function" ? style(state) : style,
111
+ "--sheet-width": sheetWidth
112
+ };
113
+ return sized;
114
+ },
115
+ className: (state) => cn2("fixed flex flex-col gap-panel bg-popover bg-clip-padding text-sm text-popover-foreground shadow-frame border border-frame-edge transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-[side=left]:data-sized:w-[min(var(--sheet-width),100%)] data-[side=left]:data-sized:max-w-none data-[side=right]:data-sized:w-[min(var(--sheet-width),100%)] data-[side=right]:data-sized:max-w-none", typeof className === "function" ? className(state) : className),
105
116
  ...props,
106
117
  children: [
107
118
  children,
@@ -8,8 +8,14 @@ declare function SheetClose({ ...props }: SheetPrimitive.Close.Props): ReactElem
8
8
  type SheetContentProps = SheetPrimitive.Popup.Props & {
9
9
  side?: "top" | "right" | "bottom" | "left";
10
10
  showCloseButton?: boolean;
11
+ /**
12
+ * Width of a left or right sheet; numbers are pixels. The sheet never grows past the viewport, so
13
+ * narrow screens still get a full-width panel. Without it the sheet takes three quarters of the
14
+ * viewport, at most 24rem. Top and bottom sheets always span the viewport.
15
+ */
16
+ width?: number | string;
11
17
  } & IDensityProps;
12
- declare function SheetContent({ density, className, children, side, showCloseButton, ...props }: SheetContentProps): ReactElement;
18
+ declare function SheetContent({ density, className, children, side, showCloseButton, width, style, ...props }: SheetContentProps): ReactElement;
13
19
  type SheetHeaderProps = ComponentProps<"div"> & IDensityProps;
14
20
  declare function SheetHeader({ density, className, ...props }: SheetHeaderProps): ReactElement;
15
21
  type SheetFooterProps = ComponentProps<"div"> & IDensityProps;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ThreadListSidebar2
3
- } from "../../../chunk-dppg1p16.js";
3
+ } from "../../../chunk-8x9hkznc.js";
4
4
  import"../../../chunk-645t7r1c.js";
5
5
  import"../../../chunk-9t5h5ps3.js";
6
6
  import"../../../chunk-4bjqbky7.js";
7
- import"../../../chunk-rz47npnq.js";
7
+ import"../../../chunk-wjs8ks1h.js";
8
8
  import"../../../chunk-1fzwfn11.js";
9
9
  import"../../../chunk-m4geb1s5.js";
10
10
  import"../../../chunk-tcefvfr8.js";
@@ -201,10 +201,10 @@ import {
201
201
  TaskTray2
202
202
  } from "../../../chunk-rgdesh1z.js";
203
203
  import"../../../chunk-4bjqbky7.js";
204
- import"../../../chunk-rz47npnq.js";
204
+ import"../../../chunk-wjs8ks1h.js";
205
205
  import {
206
206
  ThreadListSidebar2
207
- } from "../../../chunk-dppg1p16.js";
207
+ } from "../../../chunk-8x9hkznc.js";
208
208
  import {
209
209
  useVoiceTranscript2,
210
210
  VoiceConversation2
@@ -26,7 +26,7 @@ import {
26
26
  PaginationPrevious2,
27
27
  PaginationNext2,
28
28
  PaginationEllipsis2
29
- } from "../../chunk-bjrh7e6g.js";
29
+ } from "../../chunk-5eswhdbp.js";
30
30
  import {
31
31
  MenuPopup,
32
32
  MenuItem2,
@@ -153,7 +153,7 @@ import {
153
153
  import"../../chunk-7vnpp3ya.js";
154
154
  import"../../chunk-m4geb1s5.js";
155
155
  import"../../chunk-9ecf92s6.js";
156
- import"../../chunk-rz47npnq.js";
156
+ import"../../chunk-wjs8ks1h.js";
157
157
  import"../../chunk-tcefvfr8.js";
158
158
  import"../../chunk-38barrma.js";
159
159
  import"../../chunk-0ef27nx1.js";
@@ -21,10 +21,10 @@ type TreeItemProps<T> = useRender.ComponentProps<"div", TreeItemState> & IDensit
21
21
  */
22
22
  hasIcon?: boolean;
23
23
  /**
24
- * Calls attention to the row with the `warning` tone: a light tint and a warning-coloured start icon, such as a
25
- * lightning bolt for something live. A selected row keeps the selection background and adds a warning ring instead.
26
- * The tint stays light enough for coloured markers and muted text on the row to keep 4.5:1. Pair it with words in
27
- * `descriptionLabel`, so the meaning never rests on colour.
24
+ * Calls attention to the row with the `warning` tone: a 2 px warning bar on its leading edge and a warning-coloured
25
+ * start icon, such as a lightning bolt for something live. The row takes no fill, so fills keep meaning selection, and
26
+ * a selected row keeps the selection background with the bar. Pair it with words in `descriptionLabel`, so the meaning
27
+ * never rests on colour.
28
28
  */
29
29
  tone?: "default" | "warning";
30
30
  endEnhancer?: ReactNode;
@@ -257,7 +257,7 @@ function TreeItem({
257
257
  onDragStart: undefined
258
258
  } : {},
259
259
  style: { paddingInlineStart: `${item.getItemMeta().level * (item.getTree().getConfig().indent ?? 20) + 8}px` },
260
- className: cn2("relative flex min-h-control min-w-0 cursor-default items-center gap-2 rounded-sm py-1 pr-2 text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring", (isSelected || isDropTarget || isInsideTarget) && "bg-accent text-accent-foreground", tone === "warning" && (isSelected || isDropTarget || isInsideTarget ? "ring-1 ring-warning ring-inset" : "bg-warning/8 hover:bg-warning/10"), isDimmed && "group/tree-item"),
260
+ className: cn2("relative flex min-h-control min-w-0 cursor-default items-center gap-2 rounded-sm py-1 pr-2 text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring", (isSelected || isDropTarget || isInsideTarget) && "bg-accent text-accent-foreground", tone === "warning" && "before:pointer-events-none before:absolute before:inset-y-1 before:start-0 before:w-0.5 before:rounded-full before:bg-warning", isDimmed && "group/tree-item"),
261
261
  children: /* @__PURE__ */ jsxs(Fragment, {
262
262
  children: [
263
263
  item.isFolder() && expandOn === "disclosure" ? /* @__PURE__ */ jsx(Button2, {
package/dist/index.js CHANGED
@@ -181,7 +181,7 @@ import {
181
181
  StatusTracker2,
182
182
  DashboardLayout2,
183
183
  BillingUsage2
184
- } from "./chunk-bjrh7e6g.js";
184
+ } from "./chunk-5eswhdbp.js";
185
185
  import {
186
186
  Combobox2,
187
187
  ComboboxValue2,
@@ -371,7 +371,7 @@ import {
371
371
  SidebarMenuSub2,
372
372
  SidebarMenuSubItem2,
373
373
  SidebarMenuSubButton2
374
- } from "./chunk-rz47npnq.js";
374
+ } from "./chunk-wjs8ks1h.js";
375
375
  import {
376
376
  Avatar2,
377
377
  AvatarImage2,
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.121",
2054
+ version: "0.0.123",
2055
2055
  description: "Sharp, monospace React components with compact and comfortable densities.",
2056
2056
  license: "MIT",
2057
2057
  repository: {
@@ -161,6 +161,66 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
161
161
  }
162
162
  ```
163
163
 
164
+ ### Wide
165
+
166
+ ```tsx
167
+ {
168
+ render: (args) => (<Sheet>
169
+ <SheetTrigger render={<Button variant="outline"/>}>Open preferences</SheetTrigger>
170
+ <SheetContent {...args}>
171
+ <SheetHeader>
172
+ <SheetTitle>Preferences</SheetTitle>
173
+ <SheetDescription>Adjust your workspace preferences.</SheetDescription>
174
+ </SheetHeader>
175
+ <SheetFooter>
176
+ <SheetClose render={<Button />}>Done</SheetClose>
177
+ </SheetFooter>
178
+ </SheetContent>
179
+ </Sheet>),
180
+ args: { side: "right", width: 768 }
181
+ }
182
+ ```
183
+
184
+ ### WideLeftWithStyle
185
+
186
+ ```tsx
187
+ {
188
+ render: (args) => (<Sheet>
189
+ <SheetTrigger render={<Button variant="outline"/>}>Open preferences</SheetTrigger>
190
+ <SheetContent {...args}>
191
+ <SheetHeader>
192
+ <SheetTitle>Preferences</SheetTitle>
193
+ <SheetDescription>Adjust your workspace preferences.</SheetDescription>
194
+ </SheetHeader>
195
+ <SheetFooter>
196
+ <SheetClose render={<Button />}>Done</SheetClose>
197
+ </SheetFooter>
198
+ </SheetContent>
199
+ </Sheet>),
200
+ args: { side: "left", width: "40rem", style: { borderStyle: "dashed" } }
201
+ }
202
+ ```
203
+
204
+ ### WideWithStyleFunction
205
+
206
+ ```tsx
207
+ {
208
+ render: (args) => (<Sheet>
209
+ <SheetTrigger render={<Button variant="outline"/>}>Open preferences</SheetTrigger>
210
+ <SheetContent {...args}>
211
+ <SheetHeader>
212
+ <SheetTitle>Preferences</SheetTitle>
213
+ <SheetDescription>Adjust your workspace preferences.</SheetDescription>
214
+ </SheetHeader>
215
+ <SheetFooter>
216
+ <SheetClose render={<Button />}>Done</SheetClose>
217
+ </SheetFooter>
218
+ </SheetContent>
219
+ </Sheet>),
220
+ args: { side: "right", width: 512, style: fn(() => ({ borderStyle: "dotted" })) }
221
+ }
222
+ ```
223
+
164
224
  ### StateCallbacks
165
225
 
166
226
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.121",
3
+ "version": "0.0.123",
4
4
  "description": "Sharp, monospace React components with compact and comfortable densities.",
5
5
  "license": "MIT",
6
6
  "repository": {