@hanzo/ui 8.1.21 → 8.2.0

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.
@@ -1,25 +0,0 @@
1
- import type { ComponentProps, ReactNode } from 'react';
2
- export interface GridProps extends Omit<ComponentProps<'div'>, 'children'> {
3
- /**
4
- * Narrowest a column may get before the grid drops one. The whole responsive
5
- * story: no breakpoints, no props per screen size.
6
- */
7
- min?: number;
8
- /** Fixed column count. Overrides `min` — use it when the count is the design. */
9
- cols?: number;
10
- /**
11
- * Never exceed this many columns, while still wrapping down on narrow
12
- * screens. `<Grid min={160} max={4}>` is 2-up on a phone and 4-up on a
13
- * desktop, with nothing in between to configure.
14
- *
15
- * A single `min` cannot express that: 2-up at 390px needs min ~170, and that
16
- * same 170 gives SIX columns at 1280. Capping is the missing half.
17
- */
18
- max?: number;
19
- /** A `$n` space token or a raw px number. */
20
- gap?: number | string;
21
- children?: ReactNode;
22
- }
23
- declare const Grid: ({ min, cols, max, gap, style, ...props }: GridProps) => import("react/jsx-runtime").JSX.Element;
24
- export { Grid };
25
- //# sourceMappingURL=grid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/grid.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,cAAc,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErE,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACxE;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAUD,QAAA,MAAM,IAAI,GAAI,0CAAuD,SAAS,4CAmB7E,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -1,71 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- /**
4
- * Grid — a real CSS grid whose tracks come from the CONTAINER, not the children.
5
- *
6
- * This exists to kill a specific shipped defect: hand-rolled
7
- * `width="calc(25% - 7.5px)"` grids that collapse asymmetrically. That shape is
8
- * broken by construction — each child computes its own width, so the row is only
9
- * even while every child agrees, and one long word or one `box-sizing` surprise
10
- * makes the row ragged. Nothing about it can be fixed by tuning the number.
11
- *
12
- * Here the parent declares the tracks once and the children have no say. Equal
13
- * columns are structural, not arithmetic, and no child can widen its own track.
14
- *
15
- * Why a plain div and not a gui YStack: gui's box model is Yoga, which is
16
- * flexbox and has no grid — a YStack would compile its own `display:flex`
17
- * atomic class and fight the grid. Inline styles, not a stylesheet class, so
18
- * there is no rule to fail to ship: this package's own checker exists because
19
- * "class with no rule" has shipped here three times.
20
- *
21
- * The two track formulas, both deliberate:
22
- *
23
- * auto repeat(auto-fill, minmax(min(Npx, 100%), 1fr))
24
- * The `min(Npx, 100%)` is what makes it safe below N: a bare
25
- * `minmax(240px, 1fr)` forces a 240px track inside a 200px phone and
26
- * overflows the viewport horizontally. Responsive with ZERO breakpoint
27
- * props — the wrap count follows the container, so the same tree is
28
- * right at 390 and at 1280.
29
- *
30
- * cols repeat(n, minmax(0, 1fr))
31
- * `1fr` alone means `minmax(auto, 1fr)`, and `auto` floors the track at
32
- * the content's min-content width — so one long unbroken string pushes
33
- * its own column wider and every sibling narrower. That IS the ragged
34
- * row. `minmax(0, 1fr)` is the fix.
35
- *
36
- * `[data-slot='grid'] > *` also gets `min-width: 0` in the stylesheet, for the
37
- * same reason: a grid item's default `min-width: auto` lets its content set the
38
- * floor and blow the track out.
39
- */
40
- import { getTokenValue } from '@hanzo/gui';
41
- /** `'$3'` -> 12. A raw number passes through as px. */
42
- const space = (v, fallback) => {
43
- if (v == null)
44
- return fallback;
45
- if (typeof v === 'number')
46
- return v;
47
- const t = getTokenValue(v, 'space');
48
- return typeof t === 'number' ? t : fallback;
49
- };
50
- const Grid = ({ min = 240, cols, max, gap = '$3', style, ...props }) => {
51
- const g = space(gap, 12);
52
- // The track floor, capped. Without `max` it is `min(Npx, 100%)` — N wide, but
53
- // never wider than the container, which is what keeps a 900px min from
54
- // overflowing a 390px phone.
55
- //
56
- // With `max` the floor also has to be at least "one Mth of the row", so
57
- // auto-fill can never fit an (M+1)th track: subtract the M-1 gaps first, then
58
- // divide. Below that width the max() picks Npx again and the grid wraps
59
- // normally — so the cap costs nothing on small screens, which is the whole
60
- // point of expressing it as a floor rather than a breakpoint.
61
- const floor = max
62
- ? `max(min(${min}px, 100%), calc((100% - ${(max - 1) * g}px) / ${max}))`
63
- : `min(${min}px, 100%)`;
64
- const columns = cols
65
- ? `repeat(${cols}, minmax(0, 1fr))`
66
- : `repeat(auto-fill, minmax(${floor}, 1fr))`;
67
- const grid = { display: 'grid', gridTemplateColumns: columns, gap: g };
68
- return _jsx("div", { "data-slot": "grid", style: { ...grid, ...style }, ...props });
69
- };
70
- export { Grid };
71
- //# sourceMappingURL=grid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../src/backends/gui/grid.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAyB1C,uDAAuD;AACvD,MAAM,KAAK,GAAG,CAAC,CAA8B,EAAE,QAAgB,EAAU,EAAE;IACzE,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,QAAQ,CAAA;IAC9B,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAA;IACnC,MAAM,CAAC,GAAG,aAAa,CAAC,CAAU,EAAE,OAAO,CAAC,CAAA;IAC5C,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;AAC7C,CAAC,CAAA;AAED,MAAM,IAAI,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAa,EAAE,EAAE;IAChF,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IACxB,8EAA8E;IAC9E,uEAAuE;IACvE,6BAA6B;IAC7B,EAAE;IACF,wEAAwE;IACxE,8EAA8E;IAC9E,wEAAwE;IACxE,2EAA2E;IAC3E,8DAA8D;IAC9D,MAAM,KAAK,GAAG,GAAG;QACf,CAAC,CAAC,WAAW,GAAG,2BAA2B,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI;QACxE,CAAC,CAAC,OAAO,GAAG,WAAW,CAAA;IACzB,MAAM,OAAO,GAAG,IAAI;QAClB,CAAC,CAAC,UAAU,IAAI,mBAAmB;QACnC,CAAC,CAAC,4BAA4B,KAAK,SAAS,CAAA;IAC9C,MAAM,IAAI,GAAkB,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,CAAA;IACrF,OAAO,2BAAe,MAAM,EAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,EAAE,KAAM,KAAK,GAAI,CAAA;AAC1E,CAAC,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -1,8 +0,0 @@
1
- 'use client';"use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Grid = void 0;
4
- // GENERATED by scripts/gen-primitives.mjs — do not edit. Per-member entrypoint
5
- // for hosts that modularize `@hanzo/ui` imports. Source of truth:
6
- // src/backends/gui/index.ts. Re-run: node scripts/gen-primitives.mjs
7
- var grid_1 = require("../backends/gui/grid.cjs");
8
- Object.defineProperty(exports, "Grid", { enumerable: true, get: function () { return grid_1.Grid; } });
@@ -1,2 +0,0 @@
1
- export { Grid } from '../backends/gui/grid.js';
2
- //# sourceMappingURL=Grid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../src/primitives/Grid.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA"}
@@ -1,5 +0,0 @@
1
- // GENERATED by scripts/gen-primitives.mjs — do not edit. Per-member entrypoint
2
- // for hosts that modularize `@hanzo/ui` imports. Source of truth:
3
- // src/backends/gui/index.ts. Re-run: node scripts/gen-primitives.mjs
4
- export { Grid } from '../backends/gui/grid.js';
5
- //# sourceMappingURL=Grid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../src/primitives/Grid.tsx"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,kEAAkE;AAClE,qEAAqE;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA"}