@gridui/grid 0.0.0-stage → 0.1.1
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/README.md +74 -2
- package/dist/frame/boundary/boundary.d.ts +12 -0
- package/dist/frame/chrome/chrome.d.ts +27 -0
- package/dist/frame/chrome/style.d.ts +9 -0
- package/dist/frame/decoration/decoration.d.ts +14 -0
- package/dist/frame/export.d.ts +19 -0
- package/dist/frame/page/page.d.ts +20 -0
- package/dist/frame/page/style.d.ts +9 -0
- package/dist/frame/rail/rail.d.ts +17 -0
- package/dist/frame/rail/style.d.ts +9 -0
- package/dist/frame/section.d.ts +19 -0
- package/dist/frame/style.d.ts +11 -0
- package/dist/frame/texture/texture.d.ts +12 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +732 -0
- package/dist/index.js.map +7 -0
- package/dist/primitives/container/container.d.ts +12 -0
- package/dist/primitives/container/style.d.ts +9 -0
- package/dist/primitives/export.d.ts +18 -0
- package/dist/primitives/grid/grid-item.d.ts +16 -0
- package/dist/primitives/grid/grid.d.ts +20 -0
- package/dist/primitives/grid/style.d.ts +13 -0
- package/dist/primitives/grid/tracks.d.ts +10 -0
- package/dist/primitives/responsive.d.ts +27 -0
- package/dist/primitives/row/row.d.ts +17 -0
- package/dist/primitives/row/style.d.ts +7 -0
- package/dist/primitives/stack/stack.d.ts +16 -0
- package/dist/primitives/stack/style.d.ts +7 -0
- package/dist/primitives/types.d.ts +11 -0
- package/dist/styles.css +524 -0
- package/package.json +54 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,732 @@
|
|
|
1
|
+
// src/primitives/responsive.ts
|
|
2
|
+
var resolveResponsive = (value) => {
|
|
3
|
+
if (typeof value !== "object" || !("base" in value)) {
|
|
4
|
+
return {
|
|
5
|
+
base: value,
|
|
6
|
+
md: value,
|
|
7
|
+
lg: value
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
base: value.base,
|
|
12
|
+
md: value.md ?? value.base,
|
|
13
|
+
lg: value.lg ?? value.md ?? value.base
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
var spaceValue = (value) => {
|
|
17
|
+
return `var(--gridui-space-${value})`;
|
|
18
|
+
};
|
|
19
|
+
var spanValue = (value) => {
|
|
20
|
+
return value === "full" ? "1 / -1" : `span ${value} / span ${value}`;
|
|
21
|
+
};
|
|
22
|
+
var spacingStyle = (name, value) => {
|
|
23
|
+
const sizes = resolveResponsive(value);
|
|
24
|
+
return {
|
|
25
|
+
[`--gridui-${name}`]: spaceValue(sizes.base),
|
|
26
|
+
[`--gridui-${name}-md`]: spaceValue(sizes.md),
|
|
27
|
+
[`--gridui-${name}-lg`]: spaceValue(sizes.lg)
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// src/frame/boundary/boundary.tsx
|
|
32
|
+
import { cn } from "@gridui/style-utils";
|
|
33
|
+
import { jsx } from "react/jsx-runtime";
|
|
34
|
+
var FrameBoundary = (props) => {
|
|
35
|
+
const { boundary } = props;
|
|
36
|
+
return boundary === "none" ? null : /* @__PURE__ */ jsx(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: cn(
|
|
40
|
+
"gridui-frame-boundary",
|
|
41
|
+
(boundary === "band" || boundary === "stripe") && "gridui-frame-divider",
|
|
42
|
+
boundary === "stripe" && "gridui-frame-stripe",
|
|
43
|
+
boundary === "space" && "gridui-frame-space"
|
|
44
|
+
),
|
|
45
|
+
"aria-hidden": "true"
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// src/frame/decoration/decoration.tsx
|
|
51
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
52
|
+
var resolveFrameDecoration = (boundary, decoration) => {
|
|
53
|
+
return decoration ?? (boundary === "band" ? "nodes" : "none");
|
|
54
|
+
};
|
|
55
|
+
var FrameDecoration = (props) => {
|
|
56
|
+
const { decoration } = props;
|
|
57
|
+
return decoration === "none" ? null : /* @__PURE__ */ jsx2(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: "gridui-frame-decoration",
|
|
61
|
+
"data-decoration": decoration,
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
inert: true
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/frame/style.ts
|
|
69
|
+
import { cn as cn2 } from "@gridui/style-utils";
|
|
70
|
+
import { cva } from "class-variance-authority";
|
|
71
|
+
var frameToneStyles = cva("", {
|
|
72
|
+
variants: {
|
|
73
|
+
tone: {
|
|
74
|
+
neutral: "",
|
|
75
|
+
brand: "gridui-frame-brand",
|
|
76
|
+
warning: "gridui-frame-warning",
|
|
77
|
+
danger: "gridui-frame-danger"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
var frameContentStyles = cva(cn2(
|
|
82
|
+
"gridui-frame-content",
|
|
83
|
+
"border-x border-solid border-border wrap-anywhere"
|
|
84
|
+
));
|
|
85
|
+
|
|
86
|
+
// src/frame/chrome/style.ts
|
|
87
|
+
import { cn as cn3 } from "@gridui/style-utils";
|
|
88
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
89
|
+
var frameChromeStyles = cva2(cn3(
|
|
90
|
+
"gridui-frame-chrome",
|
|
91
|
+
"flex flex-wrap items-center justify-between gap-gridui-16"
|
|
92
|
+
));
|
|
93
|
+
var frameSignatureStyles = cva2(cn3(
|
|
94
|
+
"gridui-frame-signature flex min-w-0 items-center justify-center gap-gridui-24 py-gridui-32 px-gridui-24 overflow-hidden border-t border-solid border-border bg-transparent",
|
|
95
|
+
"[&>svg]:h-auto [&>svg]:opacity-30 [&>span]:font-display [&>span]:leading-none [&>span]:text-transparent"
|
|
96
|
+
));
|
|
97
|
+
var frameSignatureCroppedStyles = cva2("gridui-frame-signature-cropped block pb-0 @container [&>span]:block [&>span]:text-center [&>span]:whitespace-nowrap");
|
|
98
|
+
|
|
99
|
+
// src/frame/chrome/chrome.tsx
|
|
100
|
+
import { cn as cn4 } from "@gridui/style-utils";
|
|
101
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
102
|
+
var chromeStyle = (padding) => {
|
|
103
|
+
const values = resolveResponsive(padding);
|
|
104
|
+
return {
|
|
105
|
+
"--gridui-chrome-padding": spaceValue(values.base),
|
|
106
|
+
"--gridui-chrome-padding-md": spaceValue(values.md),
|
|
107
|
+
"--gridui-chrome-padding-lg": spaceValue(values.lg)
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
var FrameHeader = (props) => {
|
|
111
|
+
const { padding = {
|
|
112
|
+
base: 16,
|
|
113
|
+
md: 24
|
|
114
|
+
}, wrap = true, gap = 16, className, children, ...restProps } = props;
|
|
115
|
+
return /* @__PURE__ */ jsx3(
|
|
116
|
+
"header",
|
|
117
|
+
{
|
|
118
|
+
...restProps,
|
|
119
|
+
className: cn4("gridui-container gridui-frame-header", className),
|
|
120
|
+
children: /* @__PURE__ */ jsx3(
|
|
121
|
+
"div",
|
|
122
|
+
{
|
|
123
|
+
className: cn4(frameContentStyles(), frameChromeStyles()),
|
|
124
|
+
style: {
|
|
125
|
+
...chromeStyle(padding),
|
|
126
|
+
flexWrap: wrap ? "wrap" : "nowrap",
|
|
127
|
+
gap: spaceValue(gap)
|
|
128
|
+
},
|
|
129
|
+
children
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
var FrameFooter = (props) => {
|
|
136
|
+
const { padding = {
|
|
137
|
+
base: 16,
|
|
138
|
+
md: 24
|
|
139
|
+
}, tone = "neutral", boundary = "line", decoration, signature, signatureAppearance = "standard", className, children, ...restProps } = props;
|
|
140
|
+
return /* @__PURE__ */ jsxs(
|
|
141
|
+
"footer",
|
|
142
|
+
{
|
|
143
|
+
...restProps,
|
|
144
|
+
className: cn4("gridui-container gridui-frame-footer", frameToneStyles({
|
|
145
|
+
tone
|
|
146
|
+
}), className),
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ jsx3(
|
|
149
|
+
FrameBoundary,
|
|
150
|
+
{
|
|
151
|
+
boundary
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ jsxs(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
className: cn4(frameContentStyles(), frameChromeStyles(), "gridui-frame-surface"),
|
|
158
|
+
style: chromeStyle(padding),
|
|
159
|
+
children: [
|
|
160
|
+
children,
|
|
161
|
+
/* @__PURE__ */ jsx3(
|
|
162
|
+
FrameDecoration,
|
|
163
|
+
{
|
|
164
|
+
decoration: resolveFrameDecoration(boundary, decoration)
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
signature ? /* @__PURE__ */ jsx3(
|
|
171
|
+
"div",
|
|
172
|
+
{
|
|
173
|
+
className: cn4(frameContentStyles(), frameSignatureStyles(), signatureAppearance === "cropped" && frameSignatureCroppedStyles()),
|
|
174
|
+
"aria-hidden": "true",
|
|
175
|
+
inert: true,
|
|
176
|
+
children: signature
|
|
177
|
+
}
|
|
178
|
+
) : null
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// src/frame/rail/style.ts
|
|
185
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
186
|
+
var frameRailStyles = cva3("gridui-frame-rail flex h-full box-border flex-col py-gridui-24 text-muted");
|
|
187
|
+
var frameRailContentStyles = cva3("gridui-frame-rail-content relative z-(--gridui-z-interaction) min-w-0 type-eyebrow bg-inherit");
|
|
188
|
+
var frameRailStickyBottomStyles = cva3("gridui-frame-rail-sticky-bottom justify-end [&>.gridui-frame-rail-content]:sticky");
|
|
189
|
+
|
|
190
|
+
// src/frame/rail/rail.tsx
|
|
191
|
+
import { cn as cn5 } from "@gridui/style-utils";
|
|
192
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
193
|
+
var FrameRail = (props) => {
|
|
194
|
+
const {
|
|
195
|
+
placement = "start",
|
|
196
|
+
children,
|
|
197
|
+
className,
|
|
198
|
+
...restProps
|
|
199
|
+
} = props;
|
|
200
|
+
return /* @__PURE__ */ jsx4(
|
|
201
|
+
"div",
|
|
202
|
+
{
|
|
203
|
+
...restProps,
|
|
204
|
+
className: cn5(frameRailStyles(), placement === "sticky-bottom" && frameRailStickyBottomStyles(), className),
|
|
205
|
+
children: /* @__PURE__ */ jsx4(
|
|
206
|
+
"div",
|
|
207
|
+
{
|
|
208
|
+
className: frameRailContentStyles(),
|
|
209
|
+
children
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
};
|
|
215
|
+
var FrameRailGroup = (props) => {
|
|
216
|
+
const { rail, railWidth = {
|
|
217
|
+
base: 0,
|
|
218
|
+
md: 32
|
|
219
|
+
}, children, className, style, ...restProps } = props;
|
|
220
|
+
const hasRail = rail !== void 0 && rail !== null && rail !== false;
|
|
221
|
+
const width = resolveResponsive(hasRail ? railWidth : 0);
|
|
222
|
+
const layoutStyle = {
|
|
223
|
+
"--gridui-rail-width-base": spaceValue(width.base),
|
|
224
|
+
"--gridui-rail-width-md": spaceValue(width.md),
|
|
225
|
+
"--gridui-rail-width-lg": spaceValue(width.lg),
|
|
226
|
+
"--gridui-rail-display-base": width.base === 0 ? "none" : "block",
|
|
227
|
+
"--gridui-rail-display-md": width.md === 0 ? "none" : "block",
|
|
228
|
+
"--gridui-rail-display-lg": width.lg === 0 ? "none" : "block",
|
|
229
|
+
...style
|
|
230
|
+
};
|
|
231
|
+
return /* @__PURE__ */ jsxs2(
|
|
232
|
+
"div",
|
|
233
|
+
{
|
|
234
|
+
...restProps,
|
|
235
|
+
className: cn5("gridui-frame-rail-group", className),
|
|
236
|
+
style: layoutStyle,
|
|
237
|
+
children: [
|
|
238
|
+
hasRail ? /* @__PURE__ */ jsx4(
|
|
239
|
+
"div",
|
|
240
|
+
{
|
|
241
|
+
className: "gridui-frame-rail-track",
|
|
242
|
+
children: rail
|
|
243
|
+
}
|
|
244
|
+
) : null,
|
|
245
|
+
/* @__PURE__ */ jsx4(
|
|
246
|
+
"div",
|
|
247
|
+
{
|
|
248
|
+
className: "gridui-frame-rail-body",
|
|
249
|
+
children
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// src/frame/page/style.ts
|
|
258
|
+
import { cva as cva4 } from "class-variance-authority";
|
|
259
|
+
var pageFrameVariants = cva4("gridui-page-frame min-h-svh", {
|
|
260
|
+
variants: {
|
|
261
|
+
width: {
|
|
262
|
+
narrow: "gridui-container-narrow",
|
|
263
|
+
standard: "gridui-container-standard",
|
|
264
|
+
wide: "gridui-container-wide"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
defaultVariants: { width: "standard" }
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// src/frame/page/page.tsx
|
|
271
|
+
import { cn as cn6 } from "@gridui/style-utils";
|
|
272
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
273
|
+
var FrameSections = (props) => {
|
|
274
|
+
const { className, ...restProps } = props;
|
|
275
|
+
return /* @__PURE__ */ jsx5(
|
|
276
|
+
"div",
|
|
277
|
+
{
|
|
278
|
+
...restProps,
|
|
279
|
+
className: cn6("gridui-frame-sections", className)
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
};
|
|
283
|
+
var PageFrame = (props) => {
|
|
284
|
+
const {
|
|
285
|
+
width = "standard",
|
|
286
|
+
header,
|
|
287
|
+
footer,
|
|
288
|
+
rail,
|
|
289
|
+
railWidth,
|
|
290
|
+
railScope = "page",
|
|
291
|
+
mainGutterStart,
|
|
292
|
+
children,
|
|
293
|
+
className,
|
|
294
|
+
...restProps
|
|
295
|
+
} = props;
|
|
296
|
+
const railOptions = railWidth === void 0 ? {} : { railWidth };
|
|
297
|
+
const content = /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
298
|
+
/* @__PURE__ */ jsx5(FrameSections, { children }),
|
|
299
|
+
/* @__PURE__ */ jsx5(
|
|
300
|
+
"div",
|
|
301
|
+
{
|
|
302
|
+
className: "gridui-container gridui-frame-fill",
|
|
303
|
+
"aria-hidden": "true",
|
|
304
|
+
children: /* @__PURE__ */ jsx5(
|
|
305
|
+
"div",
|
|
306
|
+
{
|
|
307
|
+
className: cn6(frameContentStyles())
|
|
308
|
+
}
|
|
309
|
+
)
|
|
310
|
+
}
|
|
311
|
+
)
|
|
312
|
+
] });
|
|
313
|
+
return /* @__PURE__ */ jsxs3(
|
|
314
|
+
FrameRailGroup,
|
|
315
|
+
{
|
|
316
|
+
...restProps,
|
|
317
|
+
rail: railScope === "page" ? rail : void 0,
|
|
318
|
+
...railOptions,
|
|
319
|
+
className: cn6(pageFrameVariants({ width }), className),
|
|
320
|
+
children: [
|
|
321
|
+
header ? /* @__PURE__ */ jsx5(
|
|
322
|
+
"div",
|
|
323
|
+
{
|
|
324
|
+
className: "gridui-frame-page-header",
|
|
325
|
+
children: header
|
|
326
|
+
}
|
|
327
|
+
) : null,
|
|
328
|
+
/* @__PURE__ */ jsx5(
|
|
329
|
+
"main",
|
|
330
|
+
{
|
|
331
|
+
className: "gridui-frame-main",
|
|
332
|
+
style: mainGutterStart === void 0 ? void 0 : spacingStyle("main-gutter-start", mainGutterStart),
|
|
333
|
+
children: railScope === "main" && rail !== void 0 && rail !== null && rail !== false ? /* @__PURE__ */ jsx5(
|
|
334
|
+
FrameRailGroup,
|
|
335
|
+
{
|
|
336
|
+
rail,
|
|
337
|
+
...railOptions,
|
|
338
|
+
className: "gridui-frame-main-rail-group",
|
|
339
|
+
children: content
|
|
340
|
+
}
|
|
341
|
+
) : content
|
|
342
|
+
}
|
|
343
|
+
),
|
|
344
|
+
footer ? /* @__PURE__ */ jsx5(
|
|
345
|
+
"div",
|
|
346
|
+
{
|
|
347
|
+
className: "gridui-frame-page-footer",
|
|
348
|
+
children: footer
|
|
349
|
+
}
|
|
350
|
+
) : null
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
// src/frame/texture/texture.tsx
|
|
357
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
358
|
+
var FrameTexture = (props) => {
|
|
359
|
+
const { texture } = props;
|
|
360
|
+
return texture === "none" ? null : /* @__PURE__ */ jsx6(
|
|
361
|
+
"div",
|
|
362
|
+
{
|
|
363
|
+
className: "gridui-frame-texture",
|
|
364
|
+
"data-texture": texture,
|
|
365
|
+
"aria-hidden": "true",
|
|
366
|
+
inert: true
|
|
367
|
+
}
|
|
368
|
+
);
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
// src/frame/section.tsx
|
|
372
|
+
import { cn as cn7 } from "@gridui/style-utils";
|
|
373
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
374
|
+
var FrameSection = (props) => {
|
|
375
|
+
const {
|
|
376
|
+
tone = "neutral",
|
|
377
|
+
boundary = "line",
|
|
378
|
+
decoration,
|
|
379
|
+
texture = "none",
|
|
380
|
+
edges = "frame",
|
|
381
|
+
className,
|
|
382
|
+
children,
|
|
383
|
+
...restProps
|
|
384
|
+
} = props;
|
|
385
|
+
return /* @__PURE__ */ jsxs4(
|
|
386
|
+
"section",
|
|
387
|
+
{
|
|
388
|
+
...restProps,
|
|
389
|
+
className: cn7("gridui-container gridui-frame-section", frameToneStyles({ tone }), className),
|
|
390
|
+
"data-edges": edges,
|
|
391
|
+
children: [
|
|
392
|
+
/* @__PURE__ */ jsx7(
|
|
393
|
+
FrameBoundary,
|
|
394
|
+
{
|
|
395
|
+
boundary
|
|
396
|
+
}
|
|
397
|
+
),
|
|
398
|
+
/* @__PURE__ */ jsxs4(
|
|
399
|
+
"div",
|
|
400
|
+
{
|
|
401
|
+
className: cn7(frameContentStyles(), "gridui-frame-surface", edges === "none" && "border-x-0"),
|
|
402
|
+
children: [
|
|
403
|
+
/* @__PURE__ */ jsx7(
|
|
404
|
+
FrameTexture,
|
|
405
|
+
{
|
|
406
|
+
texture
|
|
407
|
+
}
|
|
408
|
+
),
|
|
409
|
+
children,
|
|
410
|
+
/* @__PURE__ */ jsx7(
|
|
411
|
+
FrameDecoration,
|
|
412
|
+
{
|
|
413
|
+
decoration: resolveFrameDecoration(boundary, decoration)
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
)
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
);
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
// src/primitives/container/style.ts
|
|
425
|
+
import { cva as cva5 } from "class-variance-authority";
|
|
426
|
+
var containerVariants = cva5("gridui-container", {
|
|
427
|
+
variants: {
|
|
428
|
+
width: {
|
|
429
|
+
narrow: "gridui-container-narrow",
|
|
430
|
+
standard: "gridui-container-standard",
|
|
431
|
+
wide: "gridui-container-wide"
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
defaultVariants: { width: "standard" }
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
// src/primitives/container/container.tsx
|
|
438
|
+
import { cn as cn8 } from "@gridui/style-utils";
|
|
439
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
440
|
+
var Container = (props) => {
|
|
441
|
+
const { width = "standard", className, ...restProps } = props;
|
|
442
|
+
return /* @__PURE__ */ jsx8(
|
|
443
|
+
"div",
|
|
444
|
+
{
|
|
445
|
+
...restProps,
|
|
446
|
+
className: cn8(containerVariants({ width }), className)
|
|
447
|
+
}
|
|
448
|
+
);
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
// src/primitives/grid/style.ts
|
|
452
|
+
import { cn as cn9 } from "@gridui/style-utils";
|
|
453
|
+
import { cva as cva6 } from "class-variance-authority";
|
|
454
|
+
var gridStyles = cva6(cn9(
|
|
455
|
+
"gridui-grid",
|
|
456
|
+
"grid min-w-0"
|
|
457
|
+
));
|
|
458
|
+
var gridCellsStyles = cva6(cn9(
|
|
459
|
+
"gridui-grid-cells",
|
|
460
|
+
"border-t border-solid border-border border-l border-solid border-border"
|
|
461
|
+
));
|
|
462
|
+
var gridItemStyles = cva6(cn9(
|
|
463
|
+
"gridui-grid-item",
|
|
464
|
+
"min-w-0 wrap-anywhere"
|
|
465
|
+
));
|
|
466
|
+
var gridInternalStyles = cva6(cn9(
|
|
467
|
+
"gridui-grid-internal",
|
|
468
|
+
"bg-border"
|
|
469
|
+
));
|
|
470
|
+
var gridVariants = cva6(gridStyles(), {
|
|
471
|
+
variants: {
|
|
472
|
+
frame: {
|
|
473
|
+
none: "",
|
|
474
|
+
cells: gridCellsStyles(),
|
|
475
|
+
internal: gridInternalStyles()
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
defaultVariants: { frame: "none" }
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
// src/primitives/grid/grid-item.tsx
|
|
482
|
+
import { cn as cn10 } from "@gridui/style-utils";
|
|
483
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
484
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
485
|
+
var GridItem = (props) => {
|
|
486
|
+
const {
|
|
487
|
+
asChild = false,
|
|
488
|
+
span = 1,
|
|
489
|
+
padding = 0,
|
|
490
|
+
align,
|
|
491
|
+
className,
|
|
492
|
+
style,
|
|
493
|
+
...restProps
|
|
494
|
+
} = props;
|
|
495
|
+
const size = resolveResponsive(span);
|
|
496
|
+
const inset = resolveResponsive(padding);
|
|
497
|
+
const layoutStyle = {
|
|
498
|
+
"--gridui-span": spanValue(size.base),
|
|
499
|
+
"--gridui-span-md": spanValue(size.md),
|
|
500
|
+
"--gridui-span-lg": spanValue(size.lg),
|
|
501
|
+
"--gridui-padding": spaceValue(inset.base),
|
|
502
|
+
"--gridui-padding-md": spaceValue(inset.md),
|
|
503
|
+
"--gridui-padding-lg": spaceValue(inset.lg),
|
|
504
|
+
...align ? {
|
|
505
|
+
display: "flex",
|
|
506
|
+
alignItems: align
|
|
507
|
+
} : {},
|
|
508
|
+
...style
|
|
509
|
+
};
|
|
510
|
+
const Component = asChild ? Slot : "div";
|
|
511
|
+
return /* @__PURE__ */ jsx9(
|
|
512
|
+
Component,
|
|
513
|
+
{
|
|
514
|
+
...restProps,
|
|
515
|
+
className: cn10(gridItemStyles(), className),
|
|
516
|
+
style: layoutStyle
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
// src/primitives/grid/tracks.ts
|
|
522
|
+
var gridColumnCount = (columns) => {
|
|
523
|
+
return typeof columns === "number" ? columns : columns.length;
|
|
524
|
+
};
|
|
525
|
+
var gridTemplate = (columns) => {
|
|
526
|
+
if (typeof columns === "number") {
|
|
527
|
+
return `repeat(${columns}, minmax(0, 1fr))`;
|
|
528
|
+
}
|
|
529
|
+
return columns.map((track) => {
|
|
530
|
+
return track === "1fr" ? "minmax(0, 1fr)" : track;
|
|
531
|
+
}).join(" ");
|
|
532
|
+
};
|
|
533
|
+
var fillGridRowSpans = (columns, spans) => {
|
|
534
|
+
let occupied = 0;
|
|
535
|
+
return spans.map((span, index) => {
|
|
536
|
+
if (span < 1 || span > columns) {
|
|
537
|
+
throw new RangeError("Grid item spans must fit within the grid columns.");
|
|
538
|
+
}
|
|
539
|
+
if (occupied + span > columns) {
|
|
540
|
+
occupied = 0;
|
|
541
|
+
}
|
|
542
|
+
occupied += span;
|
|
543
|
+
const next = spans[index + 1];
|
|
544
|
+
if (next === void 0 || occupied + next > columns) {
|
|
545
|
+
const filled = span + columns - occupied;
|
|
546
|
+
occupied = 0;
|
|
547
|
+
return filled;
|
|
548
|
+
}
|
|
549
|
+
if (occupied === columns) {
|
|
550
|
+
occupied = 0;
|
|
551
|
+
}
|
|
552
|
+
return span;
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
// src/primitives/grid/grid.tsx
|
|
557
|
+
import { cn as cn11 } from "@gridui/style-utils";
|
|
558
|
+
import { Children, cloneElement, isValidElement } from "react";
|
|
559
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
560
|
+
var Grid = (props) => {
|
|
561
|
+
const {
|
|
562
|
+
columns = 1,
|
|
563
|
+
frame = "none",
|
|
564
|
+
gap = 16,
|
|
565
|
+
fillLastRow = false,
|
|
566
|
+
className,
|
|
567
|
+
style,
|
|
568
|
+
children,
|
|
569
|
+
...restProps
|
|
570
|
+
} = props;
|
|
571
|
+
const tracks = resolveResponsive(columns);
|
|
572
|
+
const count = {
|
|
573
|
+
base: gridColumnCount(tracks.base),
|
|
574
|
+
md: gridColumnCount(tracks.md),
|
|
575
|
+
lg: gridColumnCount(tracks.lg)
|
|
576
|
+
};
|
|
577
|
+
const spacing = resolveResponsive(frame === "none" ? gap : 0);
|
|
578
|
+
const layoutStyle = {
|
|
579
|
+
"--gridui-columns": count.base,
|
|
580
|
+
"--gridui-columns-md": count.md,
|
|
581
|
+
"--gridui-columns-lg": count.lg,
|
|
582
|
+
"--gridui-grid-template": gridTemplate(tracks.base),
|
|
583
|
+
"--gridui-grid-template-md": gridTemplate(tracks.md),
|
|
584
|
+
"--gridui-grid-template-lg": gridTemplate(tracks.lg),
|
|
585
|
+
"--gridui-gap": frame === "internal" ? "1px" : spaceValue(spacing.base),
|
|
586
|
+
"--gridui-gap-md": frame === "internal" ? "1px" : spaceValue(spacing.md),
|
|
587
|
+
"--gridui-gap-lg": frame === "internal" ? "1px" : spaceValue(spacing.lg),
|
|
588
|
+
...style
|
|
589
|
+
};
|
|
590
|
+
let content = children;
|
|
591
|
+
if (fillLastRow) {
|
|
592
|
+
const items = Children.toArray(children).map((child) => {
|
|
593
|
+
if (!isValidElement(child) || child.type !== GridItem) {
|
|
594
|
+
throw new TypeError("Grid fillLastRow requires direct GridItem children.");
|
|
595
|
+
}
|
|
596
|
+
return child;
|
|
597
|
+
});
|
|
598
|
+
const spans = items.map((item) => {
|
|
599
|
+
return resolveResponsive(item.props.span ?? 1);
|
|
600
|
+
});
|
|
601
|
+
const filled = {
|
|
602
|
+
base: fillGridRowSpans(count.base, spans.map((span) => {
|
|
603
|
+
return span.base === "full" ? count.base : span.base;
|
|
604
|
+
})),
|
|
605
|
+
md: fillGridRowSpans(count.md, spans.map((span) => {
|
|
606
|
+
return span.md === "full" ? count.md : span.md;
|
|
607
|
+
})),
|
|
608
|
+
lg: fillGridRowSpans(count.lg, spans.map((span) => {
|
|
609
|
+
return span.lg === "full" ? count.lg : span.lg;
|
|
610
|
+
}))
|
|
611
|
+
};
|
|
612
|
+
content = items.map((item, index) => {
|
|
613
|
+
const itemStyle = {
|
|
614
|
+
"--gridui-span": `span ${filled.base[index]} / span ${filled.base[index]}`,
|
|
615
|
+
"--gridui-span-md": `span ${filled.md[index]} / span ${filled.md[index]}`,
|
|
616
|
+
"--gridui-span-lg": `span ${filled.lg[index]} / span ${filled.lg[index]}`,
|
|
617
|
+
...item.props.style
|
|
618
|
+
};
|
|
619
|
+
return cloneElement(item, {
|
|
620
|
+
style: itemStyle
|
|
621
|
+
});
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
return /* @__PURE__ */ jsx10(
|
|
625
|
+
"div",
|
|
626
|
+
{
|
|
627
|
+
...restProps,
|
|
628
|
+
className: cn11(gridVariants({ frame }), className),
|
|
629
|
+
style: layoutStyle,
|
|
630
|
+
children: content
|
|
631
|
+
}
|
|
632
|
+
);
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
// src/primitives/row/style.ts
|
|
636
|
+
import { cn as cn12 } from "@gridui/style-utils";
|
|
637
|
+
import { cva as cva7 } from "class-variance-authority";
|
|
638
|
+
var rowStyles = cva7(cn12(
|
|
639
|
+
"gridui-row",
|
|
640
|
+
"min-w-0"
|
|
641
|
+
));
|
|
642
|
+
|
|
643
|
+
// src/primitives/row/row.tsx
|
|
644
|
+
import { cn as cn13 } from "@gridui/style-utils";
|
|
645
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
646
|
+
var Row = (props) => {
|
|
647
|
+
const {
|
|
648
|
+
gap = 16,
|
|
649
|
+
rowGap = gap,
|
|
650
|
+
align = "stretch",
|
|
651
|
+
justify = "start",
|
|
652
|
+
wrap = true,
|
|
653
|
+
inline = false,
|
|
654
|
+
className,
|
|
655
|
+
style,
|
|
656
|
+
...restProps
|
|
657
|
+
} = props;
|
|
658
|
+
return /* @__PURE__ */ jsx11(
|
|
659
|
+
"div",
|
|
660
|
+
{
|
|
661
|
+
...restProps,
|
|
662
|
+
className: cn13(rowStyles(), className),
|
|
663
|
+
"data-inline": inline,
|
|
664
|
+
style: {
|
|
665
|
+
display: inline ? "inline-flex" : "flex",
|
|
666
|
+
alignItems: align,
|
|
667
|
+
justifyContent: justify === "between" ? "space-between" : "flex-start",
|
|
668
|
+
flexWrap: wrap ? "wrap" : "nowrap",
|
|
669
|
+
gap: `${spaceValue(rowGap)} ${spaceValue(gap)}`,
|
|
670
|
+
...style
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
);
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
// src/primitives/stack/style.ts
|
|
677
|
+
import { cn as cn14 } from "@gridui/style-utils";
|
|
678
|
+
import { cva as cva8 } from "class-variance-authority";
|
|
679
|
+
var stackStyles = cva8(cn14(
|
|
680
|
+
"gridui-stack",
|
|
681
|
+
"flex min-w-0 flex-col"
|
|
682
|
+
));
|
|
683
|
+
|
|
684
|
+
// src/primitives/stack/stack.tsx
|
|
685
|
+
import { cn as cn15 } from "@gridui/style-utils";
|
|
686
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
687
|
+
var Stack = (props) => {
|
|
688
|
+
const {
|
|
689
|
+
gap = 16,
|
|
690
|
+
width,
|
|
691
|
+
maxWidth,
|
|
692
|
+
paddingStart,
|
|
693
|
+
className,
|
|
694
|
+
style,
|
|
695
|
+
...restProps
|
|
696
|
+
} = props;
|
|
697
|
+
const spacing = resolveResponsive(gap);
|
|
698
|
+
const layoutStyle = {
|
|
699
|
+
"--gridui-gap": spaceValue(spacing.base),
|
|
700
|
+
"--gridui-gap-md": spaceValue(spacing.md),
|
|
701
|
+
"--gridui-gap-lg": spaceValue(spacing.lg),
|
|
702
|
+
width: width === "full" ? "100%" : void 0,
|
|
703
|
+
maxWidth,
|
|
704
|
+
paddingTop: paddingStart === void 0 ? void 0 : spaceValue(paddingStart),
|
|
705
|
+
...style
|
|
706
|
+
};
|
|
707
|
+
return /* @__PURE__ */ jsx12(
|
|
708
|
+
"div",
|
|
709
|
+
{
|
|
710
|
+
...restProps,
|
|
711
|
+
className: cn15(stackStyles(), className),
|
|
712
|
+
style: layoutStyle
|
|
713
|
+
}
|
|
714
|
+
);
|
|
715
|
+
};
|
|
716
|
+
export {
|
|
717
|
+
Container,
|
|
718
|
+
FrameFooter,
|
|
719
|
+
FrameHeader,
|
|
720
|
+
FrameRail,
|
|
721
|
+
FrameRailGroup,
|
|
722
|
+
FrameSection,
|
|
723
|
+
FrameSections,
|
|
724
|
+
FrameTexture,
|
|
725
|
+
Grid,
|
|
726
|
+
GridItem,
|
|
727
|
+
PageFrame,
|
|
728
|
+
Row,
|
|
729
|
+
Stack,
|
|
730
|
+
spacingStyle
|
|
731
|
+
};
|
|
732
|
+
//# sourceMappingURL=index.js.map
|