@wordpress/grid 0.5.0 → 0.7.1-next.v.202608281122.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.
- package/CHANGELOG.md +22 -0
- package/README.md +44 -1
- package/build/dashboard-grid/grid-item.cjs +21 -7
- package/build/dashboard-grid/grid-item.cjs.map +2 -2
- package/build/dashboard-grid/index.cjs +110 -48
- package/build/dashboard-grid/index.cjs.map +2 -2
- package/build/dashboard-grid/resolve-fill-widths.cjs +68 -50
- package/build/dashboard-grid/resolve-fill-widths.cjs.map +2 -2
- package/build/dashboard-grid/types.cjs.map +1 -1
- package/build/dashboard-lanes/index.cjs +62 -20
- package/build/dashboard-lanes/index.cjs.map +2 -2
- package/build/dashboard-lanes/lanes-item.cjs +14 -6
- package/build/dashboard-lanes/lanes-item.cjs.map +2 -2
- package/build/dashboard-lanes/types.cjs.map +1 -1
- package/build/index.cjs.map +1 -1
- package/build/shared/array-move-with-pinned.cjs +49 -0
- package/build/shared/array-move-with-pinned.cjs.map +7 -0
- package/build/shared/resize-snap.cjs +91 -5
- package/build/shared/resize-snap.cjs.map +2 -2
- package/build/shared/types.cjs.map +1 -1
- package/build/shared/use-span-bounds.cjs +85 -0
- package/build/shared/use-span-bounds.cjs.map +7 -0
- package/build-module/dashboard-grid/grid-item.mjs +21 -7
- package/build-module/dashboard-grid/grid-item.mjs.map +2 -2
- package/build-module/dashboard-grid/index.mjs +111 -50
- package/build-module/dashboard-grid/index.mjs.map +2 -2
- package/build-module/dashboard-grid/resolve-fill-widths.mjs +68 -50
- package/build-module/dashboard-grid/resolve-fill-widths.mjs.map +2 -2
- package/build-module/dashboard-lanes/index.mjs +63 -22
- package/build-module/dashboard-lanes/index.mjs.map +2 -2
- package/build-module/dashboard-lanes/lanes-item.mjs +14 -6
- package/build-module/dashboard-lanes/lanes-item.mjs.map +2 -2
- package/build-module/index.mjs.map +1 -1
- package/build-module/shared/array-move-with-pinned.mjs +24 -0
- package/build-module/shared/array-move-with-pinned.mjs.map +7 -0
- package/build-module/shared/resize-snap.mjs +87 -4
- package/build-module/shared/resize-snap.mjs.map +2 -2
- package/build-module/shared/use-span-bounds.mjs +62 -0
- package/build-module/shared/use-span-bounds.mjs.map +7 -0
- package/build-types/dashboard-grid/grid-item.d.ts +1 -1
- package/build-types/dashboard-grid/grid-item.d.ts.map +1 -1
- package/build-types/dashboard-grid/index.d.ts.map +1 -1
- package/build-types/dashboard-grid/resolve-fill-widths.d.ts +12 -1
- package/build-types/dashboard-grid/resolve-fill-widths.d.ts.map +1 -1
- package/build-types/dashboard-grid/types.d.ts +43 -1
- package/build-types/dashboard-grid/types.d.ts.map +1 -1
- package/build-types/dashboard-lanes/index.d.ts.map +1 -1
- package/build-types/dashboard-lanes/lanes-item.d.ts +18 -1
- package/build-types/dashboard-lanes/lanes-item.d.ts.map +1 -1
- package/build-types/dashboard-lanes/types.d.ts +20 -1
- package/build-types/dashboard-lanes/types.d.ts.map +1 -1
- package/build-types/index.d.ts +1 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/shared/array-move-with-pinned.d.ts +13 -0
- package/build-types/shared/array-move-with-pinned.d.ts.map +1 -0
- package/build-types/shared/resize-snap.d.ts +65 -2
- package/build-types/shared/resize-snap.d.ts.map +1 -1
- package/build-types/shared/types.d.ts +31 -0
- package/build-types/shared/types.d.ts.map +1 -1
- package/build-types/shared/use-span-bounds.d.ts +29 -0
- package/build-types/shared/use-span-bounds.d.ts.map +1 -0
- package/package.json +10 -10
- package/src/dashboard-grid/grid-item.tsx +21 -7
- package/src/dashboard-grid/grid.module.css +6 -6
- package/src/dashboard-grid/index.tsx +155 -58
- package/src/dashboard-grid/resolve-fill-widths.ts +85 -62
- package/src/dashboard-grid/stories/index.story.tsx +169 -0
- package/src/dashboard-grid/test/item-interactions.test.tsx +63 -0
- package/src/dashboard-grid/test/item-limits.test.tsx +147 -0
- package/src/dashboard-grid/test/resolve-fill-widths.test.ts +158 -0
- package/src/dashboard-grid/types.ts +50 -0
- package/src/dashboard-lanes/index.tsx +87 -25
- package/src/dashboard-lanes/lanes-item.tsx +34 -6
- package/src/dashboard-lanes/lanes.module.css +6 -6
- package/src/dashboard-lanes/stories/index.story.tsx +144 -0
- package/src/dashboard-lanes/test/item-interactions.test.tsx +63 -0
- package/src/dashboard-lanes/test/item-limits.test.tsx +140 -0
- package/src/dashboard-lanes/test/use-lane-placement.test.tsx +10 -3
- package/src/dashboard-lanes/types.ts +23 -0
- package/src/index.ts +2 -0
- package/src/shared/array-move-with-pinned.ts +36 -0
- package/src/shared/resize-snap.ts +161 -5
- package/src/shared/test/array-move-with-pinned.test.ts +39 -0
- package/src/shared/test/resize-snap.test.ts +170 -2
- package/src/shared/test/use-span-bounds.test.ts +104 -0
- package/src/shared/types.ts +35 -0
- package/src/shared/use-span-bounds.ts +99 -0
- package/build-types/dashboard-grid/stories/index.story.d.ts +0 -92
- package/build-types/dashboard-grid/stories/index.story.d.ts.map +0 -1
- package/build-types/dashboard-lanes/stories/index.story.d.ts +0 -58
- package/build-types/dashboard-lanes/stories/index.story.d.ts.map +0 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { useResizePixelLimits, useSpanBounds } from '../use-span-bounds';
|
|
3
|
+
import type { GridItemLimits } from '../types';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
itemLimits?: Record< string, GridItemLimits >;
|
|
7
|
+
columnWidth: number;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function renderSpanBounds( initialProps: Props ) {
|
|
11
|
+
return renderHook(
|
|
12
|
+
( { itemLimits, columnWidth }: Props ) =>
|
|
13
|
+
useSpanBounds( itemLimits, columnWidth, 16, 80, 6 ),
|
|
14
|
+
{ initialProps }
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
describe( 'useSpanBounds', () => {
|
|
19
|
+
const itemLimits = { a: { minWidth: 300, maxHeight: 250 } };
|
|
20
|
+
|
|
21
|
+
it( 'quantizes limits to whole tracks', () => {
|
|
22
|
+
const { result } = renderSpanBounds( { itemLimits, columnWidth: 100 } );
|
|
23
|
+
expect( result.current.get( 'a' ) ).toEqual( {
|
|
24
|
+
minWidth: 3,
|
|
25
|
+
minHeight: 1,
|
|
26
|
+
maxWidth: 6,
|
|
27
|
+
maxHeight: 2,
|
|
28
|
+
} );
|
|
29
|
+
} );
|
|
30
|
+
|
|
31
|
+
it( 'keeps the map identity across geometry ticks that leave the bounds unchanged', () => {
|
|
32
|
+
const { result, rerender } = renderSpanBounds( {
|
|
33
|
+
itemLimits,
|
|
34
|
+
columnWidth: 100,
|
|
35
|
+
} );
|
|
36
|
+
const first = result.current;
|
|
37
|
+
rerender( { itemLimits, columnWidth: 101 } );
|
|
38
|
+
expect( result.current ).toBe( first );
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
it( 'keeps the map identity when an equal itemLimits object is passed', () => {
|
|
42
|
+
const { result, rerender } = renderSpanBounds( {
|
|
43
|
+
itemLimits,
|
|
44
|
+
columnWidth: 100,
|
|
45
|
+
} );
|
|
46
|
+
const first = result.current;
|
|
47
|
+
rerender( { itemLimits: { ...itemLimits }, columnWidth: 100 } );
|
|
48
|
+
expect( result.current ).toBe( first );
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
it( 'returns a new map once a bound crosses a track threshold', () => {
|
|
52
|
+
const { result, rerender } = renderSpanBounds( {
|
|
53
|
+
itemLimits,
|
|
54
|
+
columnWidth: 100,
|
|
55
|
+
} );
|
|
56
|
+
const first = result.current;
|
|
57
|
+
rerender( { itemLimits, columnWidth: 150 } );
|
|
58
|
+
expect( result.current ).not.toBe( first );
|
|
59
|
+
expect( result.current.get( 'a' )?.minWidth ).toBe( 2 );
|
|
60
|
+
} );
|
|
61
|
+
|
|
62
|
+
it( 'returns a stable empty map without limits', () => {
|
|
63
|
+
const { result, rerender } = renderSpanBounds( { columnWidth: 100 } );
|
|
64
|
+
const first = result.current;
|
|
65
|
+
expect( first.size ).toBe( 0 );
|
|
66
|
+
rerender( { columnWidth: 120 } );
|
|
67
|
+
expect( result.current ).toBe( first );
|
|
68
|
+
} );
|
|
69
|
+
} );
|
|
70
|
+
|
|
71
|
+
describe( 'useResizePixelLimits', () => {
|
|
72
|
+
it( 'converts bounds to pixel limits for the resize gesture', () => {
|
|
73
|
+
const bounds = new Map( [
|
|
74
|
+
[ 'a', { minWidth: 2, minHeight: 1, maxWidth: 4, maxHeight: 3 } ],
|
|
75
|
+
] );
|
|
76
|
+
const { result } = renderHook( () =>
|
|
77
|
+
useResizePixelLimits( bounds, 100, 16, 80 )
|
|
78
|
+
);
|
|
79
|
+
expect( result.current.get( 'a' ) ).toEqual( {
|
|
80
|
+
minWidthPx: 216,
|
|
81
|
+
minHeightPx: 80,
|
|
82
|
+
maxWidthPx: 448,
|
|
83
|
+
maxHeightPx: 272,
|
|
84
|
+
} );
|
|
85
|
+
} );
|
|
86
|
+
|
|
87
|
+
it( 'leaves the height open when the height bound is open', () => {
|
|
88
|
+
const bounds = new Map( [
|
|
89
|
+
[
|
|
90
|
+
'a',
|
|
91
|
+
{
|
|
92
|
+
minWidth: 1,
|
|
93
|
+
minHeight: 1,
|
|
94
|
+
maxWidth: 2,
|
|
95
|
+
maxHeight: Infinity,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
] );
|
|
99
|
+
const { result } = renderHook( () =>
|
|
100
|
+
useResizePixelLimits( bounds, 100, 16, 80 )
|
|
101
|
+
);
|
|
102
|
+
expect( result.current.get( 'a' )?.maxHeightPx ).toBeNull();
|
|
103
|
+
} );
|
|
104
|
+
} );
|
package/src/shared/types.ts
CHANGED
|
@@ -159,3 +159,38 @@ export interface ResizeHandleProps {
|
|
|
159
159
|
*/
|
|
160
160
|
renderResizeHandle?: React.ComponentType< ResizeHandleRenderProps >;
|
|
161
161
|
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Per-item width limits, in pixels. Surfaces quantize each limit to
|
|
165
|
+
* whole tracks (minimums round up, maximums round down), bound rendered
|
|
166
|
+
* spans and resize gestures at the result, and never write it into the
|
|
167
|
+
* layout. A quantized minimum wins over a smaller quantized maximum.
|
|
168
|
+
*/
|
|
169
|
+
export type GridItemWidthLimits = {
|
|
170
|
+
/**
|
|
171
|
+
* Minimum tile width in pixels.
|
|
172
|
+
*/
|
|
173
|
+
minWidth?: number;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Maximum tile width in pixels.
|
|
177
|
+
*/
|
|
178
|
+
maxWidth?: number;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Per-item size limits on both axes, in pixels, for surfaces with row
|
|
183
|
+
* tracks. Height limits quantize against the row track when `rowHeight`
|
|
184
|
+
* is numeric and stay open otherwise.
|
|
185
|
+
*/
|
|
186
|
+
export type GridItemLimits = GridItemWidthLimits & {
|
|
187
|
+
/**
|
|
188
|
+
* Minimum tile height in pixels.
|
|
189
|
+
*/
|
|
190
|
+
minHeight?: number;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Maximum tile height in pixels.
|
|
194
|
+
*/
|
|
195
|
+
maxHeight?: number;
|
|
196
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useMemo } from '@wordpress/element';
|
|
2
|
+
import {
|
|
3
|
+
pixelLimitsToSpanBounds,
|
|
4
|
+
spanBoundsToPixelLimits,
|
|
5
|
+
} from './resize-snap';
|
|
6
|
+
import type { ResizePixelLimits, SpanBounds } from './resize-snap';
|
|
7
|
+
import type { GridItemLimits } from './types';
|
|
8
|
+
|
|
9
|
+
const NO_BOUNDS: ReadonlyMap< string, SpanBounds > = new Map();
|
|
10
|
+
const NO_LIMITS: ReadonlyMap< string, ResizePixelLimits > = new Map();
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Quantizes per-item pixel limits to span bounds for the current
|
|
14
|
+
* geometry. The map keeps its identity while every bound is unchanged,
|
|
15
|
+
* so container width ticks and fresh `itemLimits` objects do not
|
|
16
|
+
* invalidate the layout memos or the sortable context downstream.
|
|
17
|
+
*
|
|
18
|
+
* @param itemLimits Per-item pixel limits, keyed by layout item key.
|
|
19
|
+
* @param columnWidth Width of one column track in pixels.
|
|
20
|
+
* @param gapPx Gap between tracks in pixels.
|
|
21
|
+
* @param rowHeightPx Row track height in pixels, or `null` when rows
|
|
22
|
+
* are content-sized.
|
|
23
|
+
* @param maxColumns Number of column tracks in the surface.
|
|
24
|
+
*/
|
|
25
|
+
export function useSpanBounds(
|
|
26
|
+
itemLimits: Record< string, GridItemLimits > | undefined,
|
|
27
|
+
columnWidth: number,
|
|
28
|
+
gapPx: number,
|
|
29
|
+
rowHeightPx: number | null,
|
|
30
|
+
maxColumns: number
|
|
31
|
+
): ReadonlyMap< string, SpanBounds > {
|
|
32
|
+
const computed = useMemo( () => {
|
|
33
|
+
if ( ! itemLimits ) {
|
|
34
|
+
return NO_BOUNDS;
|
|
35
|
+
}
|
|
36
|
+
const map = new Map< string, SpanBounds >();
|
|
37
|
+
for ( const [ key, limits ] of Object.entries( itemLimits ) ) {
|
|
38
|
+
map.set(
|
|
39
|
+
key,
|
|
40
|
+
pixelLimitsToSpanBounds(
|
|
41
|
+
limits,
|
|
42
|
+
columnWidth,
|
|
43
|
+
gapPx,
|
|
44
|
+
rowHeightPx,
|
|
45
|
+
maxColumns
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
return map;
|
|
50
|
+
}, [ itemLimits, columnWidth, gapPx, rowHeightPx, maxColumns ] );
|
|
51
|
+
|
|
52
|
+
const signature = useMemo( () => {
|
|
53
|
+
let value = '';
|
|
54
|
+
for ( const [ key, bounds ] of computed ) {
|
|
55
|
+
value += `${ key }:${ bounds.minWidth }:${ bounds.minHeight }:${ bounds.maxWidth }:${ bounds.maxHeight }|`;
|
|
56
|
+
}
|
|
57
|
+
return value;
|
|
58
|
+
}, [ computed ] );
|
|
59
|
+
|
|
60
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- `signature` encodes every bound; `computed` changes identity on geometry ticks that leave the bounds unchanged.
|
|
61
|
+
return useMemo( () => computed, [ signature ] );
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Pixel limits for the resize gesture of every bounded item. Tracks
|
|
66
|
+
* the continuous geometry, but only recomputes when it changes, not on
|
|
67
|
+
* every gesture frame.
|
|
68
|
+
*
|
|
69
|
+
* @param spanBounds Span bounds per item key.
|
|
70
|
+
* @param columnWidth Width of one column track in pixels.
|
|
71
|
+
* @param gapPx Gap between tracks in pixels.
|
|
72
|
+
* @param rowHeightPx Row track height in pixels, or `null` when rows
|
|
73
|
+
* are content-sized.
|
|
74
|
+
*/
|
|
75
|
+
export function useResizePixelLimits(
|
|
76
|
+
spanBounds: ReadonlyMap< string, SpanBounds >,
|
|
77
|
+
columnWidth: number,
|
|
78
|
+
gapPx: number,
|
|
79
|
+
rowHeightPx: number | null
|
|
80
|
+
): ReadonlyMap< string, ResizePixelLimits > {
|
|
81
|
+
return useMemo( () => {
|
|
82
|
+
if ( spanBounds.size === 0 ) {
|
|
83
|
+
return NO_LIMITS;
|
|
84
|
+
}
|
|
85
|
+
const map = new Map< string, ResizePixelLimits >();
|
|
86
|
+
for ( const [ key, bounds ] of spanBounds ) {
|
|
87
|
+
map.set(
|
|
88
|
+
key,
|
|
89
|
+
spanBoundsToPixelLimits(
|
|
90
|
+
bounds,
|
|
91
|
+
columnWidth,
|
|
92
|
+
gapPx,
|
|
93
|
+
rowHeightPx
|
|
94
|
+
)
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return map;
|
|
98
|
+
}, [ spanBounds, columnWidth, gapPx, rowHeightPx ] );
|
|
99
|
+
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { DashboardGrid } from '..';
|
|
3
|
-
declare const meta: Meta<typeof DashboardGrid>;
|
|
4
|
-
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof DashboardGrid>;
|
|
6
|
-
/**
|
|
7
|
-
* Static grid with a fixed number of columns. Each item declares its
|
|
8
|
-
* column span via `width`. Items flow left-to-right and wrap to new
|
|
9
|
-
* rows as the total exceeds `columns`.
|
|
10
|
-
*/
|
|
11
|
-
export declare const Default: Story;
|
|
12
|
-
/**
|
|
13
|
-
* Responsive grid: the column count is derived from the container
|
|
14
|
-
* width using `minColumnWidth` as the lower bound per column. A
|
|
15
|
-
* `ResizeObserver` recomputes the count on container resize.
|
|
16
|
-
*/
|
|
17
|
-
export declare const Responsive: Story;
|
|
18
|
-
/**
|
|
19
|
-
* Layered configuration: `columns` caps the count and
|
|
20
|
-
* `minColumnWidth` enforces a per-tile width floor. The grid renders
|
|
21
|
-
* up to `columns` columns on wide containers and reduces the count
|
|
22
|
-
* on narrow ones whenever fitting all of them would push tiles
|
|
23
|
-
* below `minColumnWidth`. Resize the preview to see the cap apply
|
|
24
|
-
* on wide widths and the floor reduce the count on narrow widths.
|
|
25
|
-
*/
|
|
26
|
-
export declare const Layered: Story;
|
|
27
|
-
/**
|
|
28
|
-
* A `width: 'fill'` item expands to cover the remaining columns in
|
|
29
|
-
* its row. Mix it with fixed-width items on either side to build
|
|
30
|
-
* sidebar-like layouts that adapt to the column count.
|
|
31
|
-
*/
|
|
32
|
-
export declare const FillWidth: Story;
|
|
33
|
-
/**
|
|
34
|
-
* A `width: 'full'` item spans every column (`grid-column: 1 / -1`),
|
|
35
|
-
* forcing a row break around it. Useful for dividers, hero banners,
|
|
36
|
-
* or embedded content that should always take the full width.
|
|
37
|
-
*/
|
|
38
|
-
export declare const FullWidth: Story;
|
|
39
|
-
/**
|
|
40
|
-
* Numeric `rowHeight` lets items span multiple rows via `height`.
|
|
41
|
-
* Combined with `width`, this produces tile-based dashboards where
|
|
42
|
-
* each cell can be tuned independently.
|
|
43
|
-
*/
|
|
44
|
-
export declare const RowHeight: Story;
|
|
45
|
-
/**
|
|
46
|
-
* Edit mode with drag, resize, and all width modes. While `editMode`
|
|
47
|
-
* is on, `<DashboardGrid />` paints its default overlay behind the
|
|
48
|
-
* tiles to visualize the underlying template: rounded row-marker
|
|
49
|
-
* tiles in each column when `rowHeight` is numeric. The overlay
|
|
50
|
-
* disappears when `editMode` flips back to `false`.
|
|
51
|
-
*
|
|
52
|
-
* Theme the default look in place via `--wp-grid-overlay-tile-bg`,
|
|
53
|
-
* or replace the visual wholesale by passing `renderGridOverlay`.
|
|
54
|
-
* See the `Custom Grid Overlay` story for a full override example.
|
|
55
|
-
*
|
|
56
|
-
* A state panel shows the raw layout JSON. Drag items to reorder;
|
|
57
|
-
* resize from the bottom-right handle. Keyboard sensor is enabled:
|
|
58
|
-
* use Tab to focus an item, Space to grab, arrow keys to move, Space
|
|
59
|
-
* to drop.
|
|
60
|
-
*/
|
|
61
|
-
export declare const EditMode: Story;
|
|
62
|
-
/**
|
|
63
|
-
* Exercises the three customization vectors on a single grid:
|
|
64
|
-
*
|
|
65
|
-
* 1. `renderResizeHandle` swaps the default corner triangle for a
|
|
66
|
-
* custom diagonal-arrow icon.
|
|
67
|
-
* 2. `renderDragPreview` wraps the dragged clone (here only for the
|
|
68
|
-
* height chain; lift and shadow stay on the grid frame).
|
|
69
|
-
* 3. CSS custom properties on an ancestor retheme the lift scale,
|
|
70
|
-
* placeholder opacity, placeholder outline color, and placeholder
|
|
71
|
-
* border-radius without touching the package.
|
|
72
|
-
*
|
|
73
|
-
* Toggle `editMode`, then drag and resize a tile to see all three
|
|
74
|
-
* respond.
|
|
75
|
-
*/
|
|
76
|
-
export declare const Customization: Story;
|
|
77
|
-
/**
|
|
78
|
-
* Replaces the package's default edit-mode overlay with a custom
|
|
79
|
-
* visual through the `renderGridOverlay` prop. The grid mounts the
|
|
80
|
-
* supplied component as a sibling behind the tiles whenever
|
|
81
|
-
* `editMode` is on, passing the resolved `{ columns, rowHeight }`
|
|
82
|
-
* so the override can reproduce the column and row tracks
|
|
83
|
-
* pixel-accurately without re-deriving them.
|
|
84
|
-
*
|
|
85
|
-
* Here the override (see `NumberedOverlay` above) swaps the warning
|
|
86
|
-
* tone for info, drops the row dividers, and labels each column
|
|
87
|
-
* track with its index. Pass `renderGridOverlay={ () => null }` to
|
|
88
|
-
* suppress the overlay entirely while keeping `editMode` interactions
|
|
89
|
-
* on.
|
|
90
|
-
*/
|
|
91
|
-
export declare const CustomGridOverlayStory: Story;
|
|
92
|
-
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/dashboard-grid/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAQnC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,aAAa,CAuCrC,CAAC;eACa,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,aAAa,CAAE,CAAC;AAgM9C;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,KA4BrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,KAiCxB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,KAkCrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,KAwBvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,KA4BvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,KA6BvB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,EAAE,KA8JtB,CAAC;AAoEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,EAAE,KA6D3B,CAAC;AAoEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAmDpC,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { DashboardLanes } from '..';
|
|
3
|
-
declare const meta: Meta<typeof DashboardLanes>;
|
|
4
|
-
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof DashboardLanes>;
|
|
6
|
-
/**
|
|
7
|
-
* Mixed-height tiles in a fixed lane count. Items pack from
|
|
8
|
-
* left-to-right by source order, falling into whichever lane has
|
|
9
|
-
* the lowest baseline at the moment of placement.
|
|
10
|
-
*/
|
|
11
|
-
export declare const Default: Story;
|
|
12
|
-
/**
|
|
13
|
-
* Responsive lane count: derived from container width using
|
|
14
|
-
* `minColumnWidth` as the per-lane lower bound. Resize the preview
|
|
15
|
-
* frame to see the lane count adapt.
|
|
16
|
-
*/
|
|
17
|
-
export declare const Responsive: Story;
|
|
18
|
-
/**
|
|
19
|
-
* Layered configuration: `columns` caps the lane count and
|
|
20
|
-
* `minColumnWidth` enforces a per-tile width floor. The surface
|
|
21
|
-
* renders up to `columns` lanes on wide containers and reduces the
|
|
22
|
-
* count on narrow ones whenever fitting all of them would push
|
|
23
|
-
* tiles below `minColumnWidth`.
|
|
24
|
-
*/
|
|
25
|
-
export declare const Layered: Story;
|
|
26
|
-
/**
|
|
27
|
-
* Items with `width: 2` span two lanes. The skyline picks a span
|
|
28
|
-
* position that minimizes the resulting baseline across spanned
|
|
29
|
-
* lanes.
|
|
30
|
-
*/
|
|
31
|
-
export declare const Spanning: Story;
|
|
32
|
-
/**
|
|
33
|
-
* Edit mode: drag to reorder, resize from the bottom-right corner
|
|
34
|
-
* (horizontal only — heights are content-driven). Drop commits the
|
|
35
|
-
* new layout via `onChangeLayout`.
|
|
36
|
-
*
|
|
37
|
-
* While `editMode` is on, `<DashboardLanes />` paints its default
|
|
38
|
-
* overlay behind the tiles to mark the lane tracks. Lanes paint
|
|
39
|
-
* columns only — there are no row markers because heights are
|
|
40
|
-
* content-driven.
|
|
41
|
-
*
|
|
42
|
-
* Theme the default look in place via `--wp-grid-overlay-tile-bg`,
|
|
43
|
-
* or replace the visual wholesale
|
|
44
|
-
* by passing `renderGridOverlay`. See the `Custom Grid Overlay`
|
|
45
|
-
* story below for a full override example.
|
|
46
|
-
*/
|
|
47
|
-
export declare const EditMode: Story;
|
|
48
|
-
/**
|
|
49
|
-
* Replaces the surface's default edit-mode overlay with a custom
|
|
50
|
-
* visual through the `renderGridOverlay` prop. The same contract as
|
|
51
|
-
* `<DashboardGrid />`'s override path, with `rowHeight` omitted from
|
|
52
|
-
* the render props because lanes are content-driven vertically.
|
|
53
|
-
*
|
|
54
|
-
* Pass `renderGridOverlay={ () => null }` to suppress the overlay
|
|
55
|
-
* entirely while keeping `editMode` interactions on.
|
|
56
|
-
*/
|
|
57
|
-
export declare const CustomGridOverlayStory: Story;
|
|
58
|
-
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/dashboard-lanes/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAIpC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,cAAc,CA6CtC,CAAC;eACa,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,cAAc,CAAE,CAAC;AAkF/C;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,KAwCrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,KAoBxB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,KAqBrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,KA0BtB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,QAAQ,EAAE,KAuEtB,CAAC;AAkEF;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAwEpC,CAAC"}
|