@alexgorbatchev/shadcn 0.0.184 → 0.0.185

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.
@@ -5706,12 +5706,13 @@ var componentDefinitions2 = {
5706
5706
  },
5707
5707
  Grid: {
5708
5708
  props: object({
5709
- columns: number2().nullable(),
5709
+ columns: number2().nullable().describe("The most columns to show, 1-6."),
5710
+ minColumnWidth: number2().int().min(120).max(600).nullable().optional().describe("The narrowest a column may be, in pixels (default 240). The grid shows fewer columns below it."),
5710
5711
  gap: _enum(["sm", "md", "lg", "xl"]).nullable(),
5711
5712
  className: string2().nullable().describe("Additional CSS classes")
5712
5713
  }),
5713
5714
  slots: ["default"],
5714
- description: "Grid layout (1-6 columns). Fills the width of its parent.",
5715
+ description: "Grid layout of up to 6 columns. Fills the width of its parent and stacks by its own width: it shows only as many columns as fit at minColumnWidth (default 240 px) each, so columns: 3 shows 3 columns at 744 px and wider, 2 from 492 px and 1 below.",
5715
5716
  example: { columns: 3, gap: "md" }
5716
5717
  },
5717
5718
  Separator: {
@@ -1,3 +1,8 @@
1
1
  import { type BaseComponentProps } from "@json-render/react";
2
2
  import { type JsonProps } from "./catalog.js";
3
+ /**
4
+ * A grid of at most `columns` equal columns, each at least `minColumnWidth` pixels wide: the grid shows
5
+ * min(columns, floor(width / minColumnWidth)) columns of its own width, never fewer than one, so it stacks in a narrow
6
+ * container (a phone, or a page column beside an open panel) instead of squeezing its cells.
7
+ */
3
8
  export declare const JsonGrid: ({ props, children }: BaseComponentProps<JsonProps<"Grid">>) => import("react").JSX.Element;
@@ -64,6 +64,7 @@ export declare const componentDefinitions: {
64
64
  Grid: {
65
65
  props: z.ZodObject<{
66
66
  columns: z.ZodNullable<z.ZodNumber>;
67
+ minColumnWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
67
68
  gap: z.ZodNullable<z.ZodEnum<{
68
69
  sm: "sm";
69
70
  lg: "lg";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  componentDefinitions2
3
- } from "../../chunk-h1b1mqnc.js";
3
+ } from "../../chunk-5r6qdwb2.js";
4
4
  export {
5
5
  componentDefinitions2 as componentDefinitions
6
6
  };
@@ -171,7 +171,7 @@ import {
171
171
  } from "../../chunk-607s04df.js";
172
172
  import {
173
173
  componentDefinitions2
174
- } from "../../chunk-h1b1mqnc.js";
174
+ } from "../../chunk-5r6qdwb2.js";
175
175
  import"../../chunk-5mydsjp3.js";
176
176
 
177
177
  // src/components/json-render/JsonCard.tsx
@@ -238,26 +238,17 @@ var JsonStack = ({ props, children }) => {
238
238
 
239
239
  // src/components/json-render/JsonGrid.tsx
240
240
  import { jsx as jsx3 } from "react/jsx-runtime";
241
+ var GAP_STEPS = { sm: 2, md: 3, lg: 4, xl: 6 };
242
+ var DEFAULT_GRID_MIN_COLUMN_WIDTH = 240;
241
243
  var JsonGrid = ({ props, children }) => {
242
- const colsMap = {
243
- 1: "grid-cols-1",
244
- 2: "grid-cols-2",
245
- 3: "grid-cols-3",
246
- 4: "grid-cols-4",
247
- 5: "grid-cols-5",
248
- 6: "grid-cols-6"
249
- };
250
- const gridGapMap = {
251
- sm: "gap-2",
252
- md: "gap-3",
253
- lg: "gap-4",
254
- xl: "gap-6"
255
- };
256
- const n = Math.max(1, Math.min(6, props.columns ?? 1));
257
- const cols = colsMap[n] ?? "grid-cols-1";
258
- const gridGap = gridGapMap[props.gap ?? "md"] ?? "gap-3";
244
+ const columns = Math.max(1, Math.min(6, props.columns ?? 1));
245
+ const minWidth = props.minColumnWidth ?? DEFAULT_GRID_MIN_COLUMN_WIDTH;
246
+ const gap = `calc(var(--spacing) * ${GAP_STEPS[props.gap ?? "md"] ?? 3})`;
247
+ const track = `minmax(min(100%, max(${minWidth}px, (100% - ${columns - 1} * ${gap}) / ${columns})), 1fr)`;
259
248
  return /* @__PURE__ */ jsx3("div", {
260
- className: cn2("grid w-full min-w-0", cols, gridGap, props.className),
249
+ "data-slot": "json-grid",
250
+ className: cn2("grid w-full min-w-0", props.className),
251
+ style: { gap, gridTemplateColumns: `repeat(auto-fill, ${track})` },
261
252
  children
262
253
  });
263
254
  };
@@ -749,6 +740,7 @@ import { jsx as jsx17 } from "react/jsx-runtime";
749
740
  var JsonBadge = ({ props }) => {
750
741
  return /* @__PURE__ */ jsx17(Badge2, {
751
742
  variant: props.variant ?? "default",
743
+ wrap: true,
752
744
  children: props.text
753
745
  });
754
746
  };
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.184",
2054
+ version: "0.0.185",
2055
2055
  description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
2056
2056
  license: "MIT",
2057
2057
  repository: {
@@ -571,3 +571,11 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
571
571
  }
572
572
  }
573
573
  ```
574
+
575
+ ### GridReflow
576
+
577
+ ```tsx
578
+ {
579
+ render: () => <GridReflowExample />
580
+ }
581
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.184",
3
+ "version": "0.0.185",
4
4
  "description": "Sharp, monospace React components with compact, comfortable, and touch densities.",
5
5
  "license": "MIT",
6
6
  "repository": {