@alexgorbatchev/shadcn 0.0.184 → 0.0.186
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/dist/{chunk-h1b1mqnc.js → chunk-8em5bx1s.js} +3 -2
- package/dist/components/json-render/JsonGrid.d.ts +5 -0
- package/dist/components/json-render/catalog.d.ts +6 -0
- package/dist/components/json-render/catalog.js +1 -1
- package/dist/components/json-render/index.js +12 -19
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/JsonRender.md +33 -0
- package/package.json +1 -1
|
@@ -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: _enum(["xs", "sm", "md", "lg"]).nullable().optional().describe("The narrowest a column may be: xs 128 px, sm 192 px, md 256 px or lg 352 px; null or absent is 240 px. 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
|
|
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 240 px each (or minColumnWidth), 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` wide (240 px by default): 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,12 @@ 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.ZodEnum<{
|
|
68
|
+
xs: "xs";
|
|
69
|
+
sm: "sm";
|
|
70
|
+
lg: "lg";
|
|
71
|
+
md: "md";
|
|
72
|
+
}>>>;
|
|
67
73
|
gap: z.ZodNullable<z.ZodEnum<{
|
|
68
74
|
sm: "sm";
|
|
69
75
|
lg: "lg";
|
|
@@ -171,7 +171,7 @@ import {
|
|
|
171
171
|
} from "../../chunk-607s04df.js";
|
|
172
172
|
import {
|
|
173
173
|
componentDefinitions2
|
|
174
|
-
} from "../../chunk-
|
|
174
|
+
} from "../../chunk-8em5bx1s.js";
|
|
175
175
|
import"../../chunk-5mydsjp3.js";
|
|
176
176
|
|
|
177
177
|
// src/components/json-render/JsonCard.tsx
|
|
@@ -238,26 +238,18 @@ 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 MIN_COLUMN_WIDTHS = { xs: "8rem", sm: "12rem", md: "16rem", lg: "22rem" };
|
|
243
|
+
var DEFAULT_MIN_COLUMN_WIDTH = "240px";
|
|
241
244
|
var JsonGrid = ({ props, children }) => {
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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";
|
|
245
|
+
const columns = Math.max(1, Math.min(6, props.columns ?? 1));
|
|
246
|
+
const minWidth = MIN_COLUMN_WIDTHS[props.minColumnWidth ?? ""] ?? DEFAULT_MIN_COLUMN_WIDTH;
|
|
247
|
+
const gap = `calc(var(--spacing) * ${GAP_STEPS[props.gap ?? "md"] ?? 3})`;
|
|
248
|
+
const track = `minmax(min(100%, max(${minWidth}, (100% - ${columns - 1} * ${gap}) / ${columns})), 1fr)`;
|
|
259
249
|
return /* @__PURE__ */ jsx3("div", {
|
|
260
|
-
|
|
250
|
+
"data-slot": "json-grid",
|
|
251
|
+
className: cn2("grid w-full min-w-0", props.className),
|
|
252
|
+
style: { gap, gridTemplateColumns: `repeat(auto-fill, ${track})` },
|
|
261
253
|
children
|
|
262
254
|
});
|
|
263
255
|
};
|
|
@@ -749,6 +741,7 @@ import { jsx as jsx17 } from "react/jsx-runtime";
|
|
|
749
741
|
var JsonBadge = ({ props }) => {
|
|
750
742
|
return /* @__PURE__ */ jsx17(Badge2, {
|
|
751
743
|
variant: props.variant ?? "default",
|
|
744
|
+
wrap: true,
|
|
752
745
|
children: props.text
|
|
753
746
|
});
|
|
754
747
|
};
|
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.186",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -571,3 +571,36 @@ 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
|
+
```
|
|
582
|
+
|
|
583
|
+
### GridMinColumnWidth
|
|
584
|
+
|
|
585
|
+
```tsx
|
|
586
|
+
{
|
|
587
|
+
decorators: [
|
|
588
|
+
(Story) => (<div style={{ width: "342px" }}>
|
|
589
|
+
<Story />
|
|
590
|
+
</div>),
|
|
591
|
+
],
|
|
592
|
+
args: {
|
|
593
|
+
spec: {
|
|
594
|
+
...rolloutGrid,
|
|
595
|
+
elements: {
|
|
596
|
+
...rolloutGrid.elements,
|
|
597
|
+
grid: {
|
|
598
|
+
type: "Grid",
|
|
599
|
+
props: { columns: 3, gap: "md", minColumnWidth: "xs" },
|
|
600
|
+
children: ["card0", "card1", "card2"],
|
|
601
|
+
},
|
|
602
|
+
},
|
|
603
|
+
},
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
```
|