@wordpress/grid 0.1.1-next.v.202606191442.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 +33 -0
- package/LICENSE.md +788 -0
- package/README.md +534 -0
- package/build/dashboard-grid/grid-item.cjs +308 -0
- package/build/dashboard-grid/grid-item.cjs.map +7 -0
- package/build/dashboard-grid/index.cjs +591 -0
- package/build/dashboard-grid/index.cjs.map +7 -0
- package/build/dashboard-grid/resolve-fill-widths.cjs +189 -0
- package/build/dashboard-grid/resolve-fill-widths.cjs.map +7 -0
- package/build/dashboard-grid/types.cjs +19 -0
- package/build/dashboard-grid/types.cjs.map +7 -0
- package/build/dashboard-lanes/index.cjs +558 -0
- package/build/dashboard-lanes/index.cjs.map +7 -0
- package/build/dashboard-lanes/lane-placement.cjs +110 -0
- package/build/dashboard-lanes/lane-placement.cjs.map +7 -0
- package/build/dashboard-lanes/lanes-item.cjs +295 -0
- package/build/dashboard-lanes/lanes-item.cjs.map +7 -0
- package/build/dashboard-lanes/types.cjs +19 -0
- package/build/dashboard-lanes/types.cjs.map +7 -0
- package/build/dashboard-lanes/use-lane-placement.cjs +206 -0
- package/build/dashboard-lanes/use-lane-placement.cjs.map +7 -0
- package/build/index.cjs +34 -0
- package/build/index.cjs.map +7 -0
- package/build/shared/drag-overlay-drop-animation.cjs +70 -0
- package/build/shared/drag-overlay-drop-animation.cjs.map +7 -0
- package/build/shared/grid-item-key.cjs +31 -0
- package/build/shared/grid-item-key.cjs.map +7 -0
- package/build/shared/grid-overlay.cjs +187 -0
- package/build/shared/grid-overlay.cjs.map +7 -0
- package/build/shared/item-exit-overlay.cjs +150 -0
- package/build/shared/item-exit-overlay.cjs.map +7 -0
- package/build/shared/resize-handle.cjs +224 -0
- package/build/shared/resize-handle.cjs.map +7 -0
- package/build/shared/resize-snap.cjs +47 -0
- package/build/shared/resize-snap.cjs.map +7 -0
- package/build/shared/types.cjs +19 -0
- package/build/shared/types.cjs.map +7 -0
- package/build/shared/use-item-exit-animation.cjs +148 -0
- package/build/shared/use-item-exit-animation.cjs.map +7 -0
- package/build/shared/use-layout-shift-animation.cjs +167 -0
- package/build/shared/use-layout-shift-animation.cjs.map +7 -0
- package/build-module/dashboard-grid/grid-item.mjs +273 -0
- package/build-module/dashboard-grid/grid-item.mjs.map +7 -0
- package/build-module/dashboard-grid/index.mjs +579 -0
- package/build-module/dashboard-grid/index.mjs.map +7 -0
- package/build-module/dashboard-grid/resolve-fill-widths.mjs +164 -0
- package/build-module/dashboard-grid/resolve-fill-widths.mjs.map +7 -0
- package/build-module/dashboard-grid/types.mjs +1 -0
- package/build-module/dashboard-grid/types.mjs.map +7 -0
- package/build-module/dashboard-lanes/index.mjs +547 -0
- package/build-module/dashboard-lanes/index.mjs.map +7 -0
- package/build-module/dashboard-lanes/lane-placement.mjs +85 -0
- package/build-module/dashboard-lanes/lane-placement.mjs.map +7 -0
- package/build-module/dashboard-lanes/lanes-item.mjs +260 -0
- package/build-module/dashboard-lanes/lanes-item.mjs.map +7 -0
- package/build-module/dashboard-lanes/types.mjs +1 -0
- package/build-module/dashboard-lanes/types.mjs.map +7 -0
- package/build-module/dashboard-lanes/use-lane-placement.mjs +181 -0
- package/build-module/dashboard-lanes/use-lane-placement.mjs.map +7 -0
- package/build-module/index.mjs +8 -0
- package/build-module/index.mjs.map +7 -0
- package/build-module/shared/drag-overlay-drop-animation.mjs +47 -0
- package/build-module/shared/drag-overlay-drop-animation.mjs.map +7 -0
- package/build-module/shared/grid-item-key.mjs +6 -0
- package/build-module/shared/grid-item-key.mjs.map +7 -0
- package/build-module/shared/grid-overlay.mjs +152 -0
- package/build-module/shared/grid-overlay.mjs.map +7 -0
- package/build-module/shared/item-exit-overlay.mjs +125 -0
- package/build-module/shared/item-exit-overlay.mjs.map +7 -0
- package/build-module/shared/resize-handle.mjs +193 -0
- package/build-module/shared/resize-handle.mjs.map +7 -0
- package/build-module/shared/resize-snap.mjs +21 -0
- package/build-module/shared/resize-snap.mjs.map +7 -0
- package/build-module/shared/types.mjs +1 -0
- package/build-module/shared/types.mjs.map +7 -0
- package/build-module/shared/use-item-exit-animation.mjs +128 -0
- package/build-module/shared/use-item-exit-animation.mjs.map +7 -0
- package/build-module/shared/use-layout-shift-animation.mjs +140 -0
- package/build-module/shared/use-layout-shift-animation.mjs.map +7 -0
- package/build-types/dashboard-grid/grid-item.d.ts +3 -0
- package/build-types/dashboard-grid/grid-item.d.ts.map +1 -0
- package/build-types/dashboard-grid/index.d.ts +35 -0
- package/build-types/dashboard-grid/index.d.ts.map +1 -0
- package/build-types/dashboard-grid/resolve-fill-widths.d.ts +26 -0
- package/build-types/dashboard-grid/resolve-fill-widths.d.ts.map +1 -0
- package/build-types/dashboard-grid/stories/index.story.d.ts +98 -0
- package/build-types/dashboard-grid/stories/index.story.d.ts.map +1 -0
- package/build-types/dashboard-grid/types.d.ts +232 -0
- package/build-types/dashboard-grid/types.d.ts.map +1 -0
- package/build-types/dashboard-lanes/index.d.ts +40 -0
- package/build-types/dashboard-lanes/index.d.ts.map +1 -0
- package/build-types/dashboard-lanes/lane-placement.d.ts +126 -0
- package/build-types/dashboard-lanes/lane-placement.d.ts.map +1 -0
- package/build-types/dashboard-lanes/lanes-item.d.ts +52 -0
- package/build-types/dashboard-lanes/lanes-item.d.ts.map +1 -0
- package/build-types/dashboard-lanes/stories/index.story.d.ts +64 -0
- package/build-types/dashboard-lanes/stories/index.story.d.ts.map +1 -0
- package/build-types/dashboard-lanes/types.d.ts +151 -0
- package/build-types/dashboard-lanes/types.d.ts.map +1 -0
- package/build-types/dashboard-lanes/use-lane-placement.d.ts +74 -0
- package/build-types/dashboard-lanes/use-lane-placement.d.ts.map +1 -0
- package/build-types/index.d.ts +6 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/shared/drag-overlay-drop-animation.d.ts +13 -0
- package/build-types/shared/drag-overlay-drop-animation.d.ts.map +1 -0
- package/build-types/shared/grid-item-key.d.ts +6 -0
- package/build-types/shared/grid-item-key.d.ts.map +1 -0
- package/build-types/shared/grid-overlay.d.ts +19 -0
- package/build-types/shared/grid-overlay.d.ts.map +1 -0
- package/build-types/shared/item-exit-overlay.d.ts +20 -0
- package/build-types/shared/item-exit-overlay.d.ts.map +1 -0
- package/build-types/shared/resize-handle.d.ts +23 -0
- package/build-types/shared/resize-handle.d.ts.map +1 -0
- package/build-types/shared/resize-snap.d.ts +41 -0
- package/build-types/shared/resize-snap.d.ts.map +1 -0
- package/build-types/shared/types.d.ts +144 -0
- package/build-types/shared/types.d.ts.map +1 -0
- package/build-types/shared/use-item-exit-animation.d.ts +37 -0
- package/build-types/shared/use-item-exit-animation.d.ts.map +1 -0
- package/build-types/shared/use-layout-shift-animation.d.ts +77 -0
- package/build-types/shared/use-layout-shift-animation.d.ts.map +1 -0
- package/package.json +80 -0
- package/src/dashboard-grid/grid-item.module.css +94 -0
- package/src/dashboard-grid/grid-item.tsx +205 -0
- package/src/dashboard-grid/grid.module.css +134 -0
- package/src/dashboard-grid/index.tsx +713 -0
- package/src/dashboard-grid/resolve-fill-widths.ts +224 -0
- package/src/dashboard-grid/stories/index.story.tsx +930 -0
- package/src/dashboard-grid/test/keyboard-activation.test.tsx +76 -0
- package/src/dashboard-grid/test/resolve-fill-widths.test.ts +250 -0
- package/src/dashboard-grid/types.ts +271 -0
- package/src/dashboard-lanes/index.tsx +629 -0
- package/src/dashboard-lanes/lane-placement.ts +245 -0
- package/src/dashboard-lanes/lanes-item.module.css +93 -0
- package/src/dashboard-lanes/lanes-item.tsx +236 -0
- package/src/dashboard-lanes/lanes.module.css +152 -0
- package/src/dashboard-lanes/stories/index.story.tsx +518 -0
- package/src/dashboard-lanes/test/keyboard-activation.test.tsx +71 -0
- package/src/dashboard-lanes/test/lane-placement.test.ts +442 -0
- package/src/dashboard-lanes/test/use-lane-placement.test.tsx +358 -0
- package/src/dashboard-lanes/types.ts +176 -0
- package/src/dashboard-lanes/use-lane-placement.ts +313 -0
- package/src/index.ts +17 -0
- package/src/shared/actionable-area-slot.module.css +16 -0
- package/src/shared/drag-overlay-drop-animation.ts +66 -0
- package/src/shared/grid-item-key.ts +5 -0
- package/src/shared/grid-overlay.module.css +82 -0
- package/src/shared/grid-overlay.tsx +93 -0
- package/src/shared/item-exit-animation.module.css +49 -0
- package/src/shared/item-exit-overlay.tsx +57 -0
- package/src/shared/layout-shift-animation.module.css +16 -0
- package/src/shared/resize-handle.module.css +88 -0
- package/src/shared/resize-handle.tsx +163 -0
- package/src/shared/resize-snap.ts +63 -0
- package/src/shared/test/resize-snap.test.ts +35 -0
- package/src/shared/types.ts +164 -0
- package/src/shared/use-item-exit-animation.ts +199 -0
- package/src/shared/use-layout-shift-animation.ts +284 -0
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/grid/src/dashboard-grid/index.tsx
|
|
31
|
+
var dashboard_grid_exports = {};
|
|
32
|
+
__export(dashboard_grid_exports, {
|
|
33
|
+
DashboardGrid: () => DashboardGrid
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(dashboard_grid_exports);
|
|
36
|
+
var import_core = require("@dnd-kit/core");
|
|
37
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
38
|
+
var import_clsx = __toESM(require("clsx"));
|
|
39
|
+
var import_compose = require("@wordpress/compose");
|
|
40
|
+
var import_element = require("@wordpress/element");
|
|
41
|
+
var import_grid_item = require("./grid-item.cjs");
|
|
42
|
+
var import_grid_overlay = require("../shared/grid-overlay.cjs");
|
|
43
|
+
var import_resize_snap = require("../shared/resize-snap.cjs");
|
|
44
|
+
|
|
45
|
+
// packages/style-runtime/src/index.ts
|
|
46
|
+
var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
47
|
+
function getRuntime() {
|
|
48
|
+
const globalScope = globalThis;
|
|
49
|
+
if (globalScope.__wpStyleRuntime) {
|
|
50
|
+
return globalScope.__wpStyleRuntime;
|
|
51
|
+
}
|
|
52
|
+
globalScope.__wpStyleRuntime = {
|
|
53
|
+
documents: /* @__PURE__ */ new Map(),
|
|
54
|
+
styles: /* @__PURE__ */ new Map(),
|
|
55
|
+
injectedStyles: /* @__PURE__ */ new WeakMap()
|
|
56
|
+
};
|
|
57
|
+
if (typeof document !== "undefined") {
|
|
58
|
+
registerDocument(document);
|
|
59
|
+
}
|
|
60
|
+
return globalScope.__wpStyleRuntime;
|
|
61
|
+
}
|
|
62
|
+
function documentContainsStyleHash(targetDocument, hash) {
|
|
63
|
+
if (!targetDocument.head) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
for (const style of targetDocument.head.querySelectorAll(
|
|
67
|
+
`style[${STYLE_HASH_ATTRIBUTE}]`
|
|
68
|
+
)) {
|
|
69
|
+
if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
function injectStyle(targetDocument, hash, css) {
|
|
76
|
+
if (!targetDocument.head) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const runtime = getRuntime();
|
|
80
|
+
let injectedStyles = runtime.injectedStyles.get(targetDocument);
|
|
81
|
+
if (!injectedStyles) {
|
|
82
|
+
injectedStyles = /* @__PURE__ */ new Set();
|
|
83
|
+
runtime.injectedStyles.set(targetDocument, injectedStyles);
|
|
84
|
+
}
|
|
85
|
+
if (injectedStyles.has(hash)) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (documentContainsStyleHash(targetDocument, hash)) {
|
|
89
|
+
injectedStyles.add(hash);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const style = targetDocument.createElement("style");
|
|
93
|
+
style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
|
|
94
|
+
style.appendChild(targetDocument.createTextNode(css));
|
|
95
|
+
targetDocument.head.appendChild(style);
|
|
96
|
+
injectedStyles.add(hash);
|
|
97
|
+
}
|
|
98
|
+
function registerDocument(targetDocument) {
|
|
99
|
+
const runtime = getRuntime();
|
|
100
|
+
runtime.documents.set(
|
|
101
|
+
targetDocument,
|
|
102
|
+
(runtime.documents.get(targetDocument) ?? 0) + 1
|
|
103
|
+
);
|
|
104
|
+
for (const [hash, css] of runtime.styles) {
|
|
105
|
+
injectStyle(targetDocument, hash, css);
|
|
106
|
+
}
|
|
107
|
+
return () => {
|
|
108
|
+
const count = runtime.documents.get(targetDocument);
|
|
109
|
+
if (count === void 0) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (count <= 1) {
|
|
113
|
+
runtime.documents.delete(targetDocument);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
runtime.documents.set(targetDocument, count - 1);
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function registerStyle(hash, css) {
|
|
120
|
+
const runtime = getRuntime();
|
|
121
|
+
runtime.styles.set(hash, css);
|
|
122
|
+
for (const targetDocument of runtime.documents.keys()) {
|
|
123
|
+
injectStyle(targetDocument, hash, css);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// packages/grid/src/shared/layout-shift-animation.module.css
|
|
128
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
129
|
+
registerStyle("9e5573e51f", "._2db63116caa90ae9__layout-animating [data-wp-grid-item-key]{transition:transform var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1))}@media (prefers-reduced-motion:reduce){._2db63116caa90ae9__layout-animating [data-wp-grid-item-key]{transition:none}}");
|
|
130
|
+
}
|
|
131
|
+
var layout_shift_animation_default = { "layout-animating": "_2db63116caa90ae9__layout-animating" };
|
|
132
|
+
|
|
133
|
+
// packages/grid/src/dashboard-grid/index.tsx
|
|
134
|
+
var import_item_exit_overlay = require("../shared/item-exit-overlay.cjs");
|
|
135
|
+
var import_use_layout_shift_animation = require("../shared/use-layout-shift-animation.cjs");
|
|
136
|
+
var import_use_item_exit_animation = require("../shared/use-item-exit-animation.cjs");
|
|
137
|
+
var import_resolve_fill_widths = require("./resolve-fill-widths.cjs");
|
|
138
|
+
var import_drag_overlay_drop_animation = require("../shared/drag-overlay-drop-animation.cjs");
|
|
139
|
+
|
|
140
|
+
// packages/grid/src/dashboard-grid/grid.module.css
|
|
141
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
142
|
+
registerStyle("52d51e7d5c", "._960c435c33759f46__grid{display:grid;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));position:relative}._48e8cd4225dcb813__drag-preview-frame{border-radius:var(--wp-grid-drag-preview-radius,0);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);cursor:grabbing;height:100%;pointer-events:none}._4b471bf24f891d2d__drag-preview-frame__lift{height:100%;transform:scale(var(--wp-grid-drag-preview-scale,1.05));transform-origin:center}@media not (prefers-reduced-motion:reduce){._48e8cd4225dcb813__drag-preview-frame{animation:_08fdf90ef86c4706__wp-grid-drag-preview-shadow-enter var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) both}._4b471bf24f891d2d__drag-preview-frame__lift{animation:_8aaeb335436989f9__wp-grid-drag-preview-scale-enter var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) both}}@media not (prefers-reduced-motion:reduce){@keyframes _08fdf90ef86c4706__wp-grid-drag-preview-shadow-enter{0%{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}to{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}}@keyframes _8aaeb335436989f9__wp-grid-drag-preview-scale-enter{0%{transform:scale(1)}to{transform:scale(var(--wp-grid-drag-preview-scale,1.05))}}}@media not (prefers-reduced-motion:reduce){._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting{animation:a7ead84bfd25ff8a__wp-grid-drag-preview-shadow-exit var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting ._4b471bf24f891d2d__drag-preview-frame__lift{animation:_234ccad5c20d49f8__wp-grid-drag-preview-scale-exit var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}@keyframes a7ead84bfd25ff8a__wp-grid-drag-preview-shadow-exit{0%{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}to{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}}@keyframes _234ccad5c20d49f8__wp-grid-drag-preview-scale-exit{0%{transform:scale(var(--wp-grid-drag-preview-scale,1.05))}to{transform:scale(1)}}}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting ._4b471bf24f891d2d__drag-preview-frame__lift{transform:scale(1)}@media (prefers-reduced-motion:reduce){._48e8cd4225dcb813__drag-preview-frame{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}._4b471bf24f891d2d__drag-preview-frame__lift{transform:none}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003);transition:none}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting ._4b471bf24f891d2d__drag-preview-frame__lift{transition:none}}");
|
|
143
|
+
}
|
|
144
|
+
var grid_default = { "grid": "_960c435c33759f46__grid", "drag-preview-frame": "_48e8cd4225dcb813__drag-preview-frame", "drag-preview-frame__lift": "_4b471bf24f891d2d__drag-preview-frame__lift", "wp-grid-drag-preview-shadow-enter": "_08fdf90ef86c4706__wp-grid-drag-preview-shadow-enter", "wp-grid-drag-preview-scale-enter": "_8aaeb335436989f9__wp-grid-drag-preview-scale-enter", "dragPreviewFrameExiting": "_66b0aefb2bc02eb9__dragPreviewFrameExiting", "wp-grid-drag-preview-shadow-exit": "a7ead84bfd25ff8a__wp-grid-drag-preview-shadow-exit", "wp-grid-drag-preview-scale-exit": "_234ccad5c20d49f8__wp-grid-drag-preview-scale-exit" };
|
|
145
|
+
|
|
146
|
+
// packages/grid/src/dashboard-grid/index.tsx
|
|
147
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
148
|
+
var dashboardDragDropAnimation = (0, import_drag_overlay_drop_animation.createDashboardDragDropAnimation)(
|
|
149
|
+
grid_default["drag-preview-frame"],
|
|
150
|
+
grid_default.dragPreviewFrameExiting
|
|
151
|
+
);
|
|
152
|
+
var FALLBACK_GAP_PX = 24;
|
|
153
|
+
var DEFAULT_COLUMNS = 6;
|
|
154
|
+
var NO_SORT_STRATEGY = () => null;
|
|
155
|
+
var DashboardGrid = (0, import_element.forwardRef)(
|
|
156
|
+
function DashboardGrid2(props, ref) {
|
|
157
|
+
const {
|
|
158
|
+
layout,
|
|
159
|
+
columns,
|
|
160
|
+
children,
|
|
161
|
+
className,
|
|
162
|
+
style,
|
|
163
|
+
rowHeight = "auto",
|
|
164
|
+
minColumnWidth,
|
|
165
|
+
editMode = false,
|
|
166
|
+
onChangeLayout,
|
|
167
|
+
onPreviewLayout,
|
|
168
|
+
renderResizeHandle,
|
|
169
|
+
renderDragPreview,
|
|
170
|
+
renderGridOverlay,
|
|
171
|
+
...divProps
|
|
172
|
+
} = props;
|
|
173
|
+
const [temporaryLayout, setTemporaryLayout] = (0, import_element.useState)();
|
|
174
|
+
const [activeId, setActiveId] = (0, import_element.useState)(null);
|
|
175
|
+
const [isResizing, setIsResizing] = (0, import_element.useState)(false);
|
|
176
|
+
const [resizeSnapPreview, setResizeSnapPreview] = (0, import_element.useState)(null);
|
|
177
|
+
const latestLayoutRef = (0, import_element.useRef)();
|
|
178
|
+
const lastReorderCursorRef = (0, import_element.useRef)(null);
|
|
179
|
+
const resizeBaselineRef = (0, import_element.useRef)(null);
|
|
180
|
+
const captureLayoutSnapshotRef = (0, import_element.useRef)(() => {
|
|
181
|
+
});
|
|
182
|
+
const childrenCacheRef = (0, import_element.useRef)(
|
|
183
|
+
/* @__PURE__ */ new Map()
|
|
184
|
+
);
|
|
185
|
+
const activeLayout = temporaryLayout ?? layout;
|
|
186
|
+
const [gridRoot, setGridRoot] = (0, import_element.useState)(
|
|
187
|
+
null
|
|
188
|
+
);
|
|
189
|
+
const [containerWidth, setContainerWidth] = (0, import_element.useState)(0);
|
|
190
|
+
const [containerHeight, setContainerHeight] = (0, import_element.useState)(0);
|
|
191
|
+
const [gapPx, setGapPx] = (0, import_element.useState)(FALLBACK_GAP_PX);
|
|
192
|
+
const resizeObserverRef = (0, import_compose.useResizeObserver)(
|
|
193
|
+
([{ contentRect }]) => {
|
|
194
|
+
setContainerWidth(contentRect.width);
|
|
195
|
+
setContainerHeight(contentRect.height);
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
const mergedGridRef = (0, import_compose.useMergeRefs)([
|
|
199
|
+
setGridRoot,
|
|
200
|
+
resizeObserverRef,
|
|
201
|
+
ref
|
|
202
|
+
]);
|
|
203
|
+
(0, import_element.useLayoutEffect)(() => {
|
|
204
|
+
if (!gridRoot) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const { width, height } = gridRoot.getBoundingClientRect();
|
|
208
|
+
if (width > 0) {
|
|
209
|
+
setContainerWidth(width);
|
|
210
|
+
}
|
|
211
|
+
if (height > 0) {
|
|
212
|
+
setContainerHeight(height);
|
|
213
|
+
}
|
|
214
|
+
const parsed = Number.parseFloat(
|
|
215
|
+
window.getComputedStyle(gridRoot).columnGap
|
|
216
|
+
);
|
|
217
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
218
|
+
setGapPx(parsed);
|
|
219
|
+
}
|
|
220
|
+
}, [gridRoot]);
|
|
221
|
+
const effectiveColumns = (0, import_element.useMemo)(() => {
|
|
222
|
+
if (!minColumnWidth) {
|
|
223
|
+
return columns ?? DEFAULT_COLUMNS;
|
|
224
|
+
}
|
|
225
|
+
const totalWidthPerColumn = minColumnWidth + gapPx;
|
|
226
|
+
const maxFit = Math.max(
|
|
227
|
+
1,
|
|
228
|
+
Math.floor((containerWidth + gapPx) / totalWidthPerColumn)
|
|
229
|
+
);
|
|
230
|
+
return columns !== void 0 ? Math.min(columns, maxFit) : maxFit;
|
|
231
|
+
}, [minColumnWidth, gapPx, containerWidth, columns]);
|
|
232
|
+
const columnWidth = (containerWidth - (effectiveColumns - 1) * gapPx) / effectiveColumns;
|
|
233
|
+
const minResizeWidthPx = (0, import_resize_snap.gridSpanToPixelSize)(
|
|
234
|
+
1,
|
|
235
|
+
1,
|
|
236
|
+
columnWidth,
|
|
237
|
+
gapPx,
|
|
238
|
+
null
|
|
239
|
+
).widthPx;
|
|
240
|
+
const rowHeightPx = typeof rowHeight === "number" ? rowHeight : null;
|
|
241
|
+
const minResizeHeightPx = rowHeightPx === null ? void 0 : (0, import_resize_snap.gridSpanToPixelSize)(1, 1, columnWidth, gapPx, rowHeightPx).heightPx ?? void 0;
|
|
242
|
+
const layoutMap = (0, import_element.useMemo)(() => {
|
|
243
|
+
const map = /* @__PURE__ */ new Map();
|
|
244
|
+
activeLayout.forEach((item) => map.set(item.key, item));
|
|
245
|
+
return map;
|
|
246
|
+
}, [activeLayout]);
|
|
247
|
+
const layoutKeys = (0, import_element.useMemo)(
|
|
248
|
+
() => new Set(layout.map((item) => item.key)),
|
|
249
|
+
[layout]
|
|
250
|
+
);
|
|
251
|
+
const sortedItems = (0, import_element.useMemo)(
|
|
252
|
+
() => activeLayout.map((item, index) => ({ item, index })).sort(
|
|
253
|
+
(a, b) => (a.item.order ?? a.index) - (b.item.order ?? b.index)
|
|
254
|
+
).map(({ item }) => item.key),
|
|
255
|
+
[activeLayout]
|
|
256
|
+
);
|
|
257
|
+
const items = sortedItems;
|
|
258
|
+
const resolvedItemMap = (0, import_element.useMemo)(() => {
|
|
259
|
+
const fillWidths = (0, import_resolve_fill_widths.resolveFillWidths)(
|
|
260
|
+
items,
|
|
261
|
+
layoutMap,
|
|
262
|
+
effectiveColumns
|
|
263
|
+
);
|
|
264
|
+
if (fillWidths.size === 0) {
|
|
265
|
+
return layoutMap;
|
|
266
|
+
}
|
|
267
|
+
const map = /* @__PURE__ */ new Map();
|
|
268
|
+
for (const [key, item] of layoutMap) {
|
|
269
|
+
const fillW = fillWidths.get(key);
|
|
270
|
+
map.set(
|
|
271
|
+
key,
|
|
272
|
+
fillW !== void 0 ? { ...item, width: fillW } : item
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
return map;
|
|
276
|
+
}, [items, layoutMap, effectiveColumns]);
|
|
277
|
+
const [childrenMap, actionableAreaMap, remaining, renderedByKey] = (0, import_element.useMemo)(() => {
|
|
278
|
+
const childMap = /* @__PURE__ */ new Map();
|
|
279
|
+
const actionableMap = /* @__PURE__ */ new Map();
|
|
280
|
+
const rest = [];
|
|
281
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
282
|
+
import_element.Children.forEach(children, (child) => {
|
|
283
|
+
if (!(0, import_element.isValidElement)(child)) {
|
|
284
|
+
rest.push(child);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
const key = child.key?.toString();
|
|
288
|
+
if (!key) {
|
|
289
|
+
rest.push(child);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
const { actionableArea } = child.props;
|
|
293
|
+
const stripped = actionableArea !== void 0 ? (0, import_element.cloneElement)(child, {
|
|
294
|
+
actionableArea: void 0
|
|
295
|
+
}) : child;
|
|
296
|
+
byKey.set(key, stripped);
|
|
297
|
+
if (layoutKeys.has(key)) {
|
|
298
|
+
if (actionableArea !== void 0) {
|
|
299
|
+
actionableMap.set(key, actionableArea);
|
|
300
|
+
}
|
|
301
|
+
childMap.set(key, stripped);
|
|
302
|
+
} else {
|
|
303
|
+
rest.push(child);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
return [childMap, actionableMap, rest, byKey];
|
|
307
|
+
}, [children, layoutKeys]);
|
|
308
|
+
(0, import_element.useLayoutEffect)(() => {
|
|
309
|
+
for (const [key, child] of renderedByKey) {
|
|
310
|
+
childrenCacheRef.current.set(key, child);
|
|
311
|
+
}
|
|
312
|
+
}, [renderedByKey]);
|
|
313
|
+
const sensors = (0, import_core.useSensors)(
|
|
314
|
+
(0, import_core.useSensor)(import_core.PointerSensor),
|
|
315
|
+
(0, import_core.useSensor)(import_core.KeyboardSensor, {
|
|
316
|
+
coordinateGetter: import_sortable.sortableKeyboardCoordinates
|
|
317
|
+
})
|
|
318
|
+
);
|
|
319
|
+
const handleDragStart = (0, import_compose.useEvent)((event) => {
|
|
320
|
+
setActiveId(String(event.active.id));
|
|
321
|
+
lastReorderCursorRef.current = null;
|
|
322
|
+
});
|
|
323
|
+
const handleDragCancel = (0, import_compose.useEvent)(() => {
|
|
324
|
+
setActiveId(null);
|
|
325
|
+
latestLayoutRef.current = void 0;
|
|
326
|
+
lastReorderCursorRef.current = null;
|
|
327
|
+
resizeBaselineRef.current = null;
|
|
328
|
+
setIsResizing(false);
|
|
329
|
+
setResizeSnapPreview(null);
|
|
330
|
+
setTemporaryLayout(void 0);
|
|
331
|
+
});
|
|
332
|
+
const handleDragMove = (0, import_compose.useEvent)((event) => {
|
|
333
|
+
const { active, over } = event;
|
|
334
|
+
if (!over || active.id === over.id) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const activeRect = active.rect.current.translated;
|
|
338
|
+
if (!activeRect) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
const activeCenterX = activeRect.left + activeRect.width / 2;
|
|
342
|
+
const activeCenterY = activeRect.top + activeRect.height / 2;
|
|
343
|
+
const lastCursor = lastReorderCursorRef.current;
|
|
344
|
+
if (lastCursor) {
|
|
345
|
+
const dx = activeCenterX - lastCursor.x;
|
|
346
|
+
const dy = activeCenterY - lastCursor.y;
|
|
347
|
+
if (dx * dx + dy * dy < 100) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
const overCenterX = over.rect.left + over.rect.width / 2;
|
|
352
|
+
const insertAfter = activeCenterX > overCenterX;
|
|
353
|
+
const currentIndex = items.indexOf(String(active.id));
|
|
354
|
+
const overIndex = items.indexOf(String(over.id));
|
|
355
|
+
let newIndex;
|
|
356
|
+
if (insertAfter) {
|
|
357
|
+
newIndex = currentIndex > overIndex ? overIndex + 1 : overIndex;
|
|
358
|
+
} else {
|
|
359
|
+
newIndex = currentIndex > overIndex ? overIndex : overIndex - 1;
|
|
360
|
+
}
|
|
361
|
+
newIndex = Math.max(0, Math.min(newIndex, items.length - 1));
|
|
362
|
+
if (newIndex === currentIndex) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const updatedItems = (0, import_sortable.arrayMove)(items, currentIndex, newIndex);
|
|
366
|
+
const updatedLayout = activeLayout.map((item) => ({
|
|
367
|
+
...item,
|
|
368
|
+
order: updatedItems.indexOf(item.key)
|
|
369
|
+
}));
|
|
370
|
+
lastReorderCursorRef.current = {
|
|
371
|
+
x: activeCenterX,
|
|
372
|
+
y: activeCenterY
|
|
373
|
+
};
|
|
374
|
+
latestLayoutRef.current = updatedLayout;
|
|
375
|
+
captureLayoutSnapshotRef.current();
|
|
376
|
+
setTemporaryLayout(updatedLayout);
|
|
377
|
+
onPreviewLayout?.(updatedLayout);
|
|
378
|
+
});
|
|
379
|
+
const persistTemporaryLayout = (0, import_compose.useEvent)(() => {
|
|
380
|
+
const latest = latestLayoutRef.current;
|
|
381
|
+
latestLayoutRef.current = void 0;
|
|
382
|
+
resizeBaselineRef.current = null;
|
|
383
|
+
setIsResizing(false);
|
|
384
|
+
setResizeSnapPreview(null);
|
|
385
|
+
if (!onChangeLayout || !latest) {
|
|
386
|
+
setTemporaryLayout(void 0);
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
onChangeLayout(latest);
|
|
390
|
+
setTemporaryLayout(void 0);
|
|
391
|
+
});
|
|
392
|
+
const handleResize = (0, import_compose.useEvent)((id, delta) => {
|
|
393
|
+
if (!editMode) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
if (!isResizing) {
|
|
397
|
+
setIsResizing(true);
|
|
398
|
+
}
|
|
399
|
+
const relativeDelta = {
|
|
400
|
+
width: Math.round(delta.width / (columnWidth + gapPx)),
|
|
401
|
+
height: rowHeight === "auto" ? 0 : Math.round(delta.height / (rowHeight + gapPx))
|
|
402
|
+
};
|
|
403
|
+
if (!resizeBaselineRef.current) {
|
|
404
|
+
const baseItem = activeLayout.find(
|
|
405
|
+
(item) => item.key === id
|
|
406
|
+
);
|
|
407
|
+
const resolvedItem = resolvedItemMap.get(id);
|
|
408
|
+
let baseWidth;
|
|
409
|
+
if (baseItem?.width === "full") {
|
|
410
|
+
baseWidth = effectiveColumns;
|
|
411
|
+
} else if (baseItem?.width === "fill") {
|
|
412
|
+
baseWidth = typeof resolvedItem?.width === "number" ? resolvedItem.width : 1;
|
|
413
|
+
} else {
|
|
414
|
+
baseWidth = baseItem?.width ?? 1;
|
|
415
|
+
}
|
|
416
|
+
resizeBaselineRef.current = {
|
|
417
|
+
width: baseWidth,
|
|
418
|
+
height: baseItem?.height ?? 1
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
const baseline = resizeBaselineRef.current;
|
|
422
|
+
const newWidth = Math.max(
|
|
423
|
+
1,
|
|
424
|
+
Math.min(
|
|
425
|
+
baseline.width + relativeDelta.width,
|
|
426
|
+
effectiveColumns
|
|
427
|
+
)
|
|
428
|
+
);
|
|
429
|
+
const newHeight = Math.max(
|
|
430
|
+
1,
|
|
431
|
+
baseline.height + relativeDelta.height
|
|
432
|
+
);
|
|
433
|
+
setResizeSnapPreview({
|
|
434
|
+
id,
|
|
435
|
+
snap: (0, import_resize_snap.gridSpanToPixelSize)(
|
|
436
|
+
newWidth,
|
|
437
|
+
newHeight,
|
|
438
|
+
columnWidth,
|
|
439
|
+
gapPx,
|
|
440
|
+
rowHeightPx
|
|
441
|
+
)
|
|
442
|
+
});
|
|
443
|
+
const pendingItem = latestLayoutRef.current?.find(
|
|
444
|
+
(item) => item.key === id
|
|
445
|
+
);
|
|
446
|
+
const currentItem = pendingItem ?? activeLayout.find((item) => item.key === id);
|
|
447
|
+
if (currentItem && currentItem.width === newWidth && (currentItem.height ?? 1) === newHeight) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
const updatedLayout = activeLayout.map(
|
|
451
|
+
(item) => item.key === id ? { ...item, width: newWidth, height: newHeight } : item
|
|
452
|
+
);
|
|
453
|
+
latestLayoutRef.current = updatedLayout;
|
|
454
|
+
captureLayoutSnapshotRef.current();
|
|
455
|
+
setTemporaryLayout(updatedLayout);
|
|
456
|
+
onPreviewLayout?.(updatedLayout);
|
|
457
|
+
});
|
|
458
|
+
const activeClone = activeId ? childrenMap.get(activeId) : null;
|
|
459
|
+
const DragPreview = renderDragPreview;
|
|
460
|
+
const dragOverlayContent = activeId && activeClone ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: grid_default["drag-preview-frame"], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: grid_default["drag-preview-frame__lift"], children: DragPreview ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DragPreview, { itemId: activeId, children: activeClone }) : activeClone }) }) : null;
|
|
461
|
+
const Overlay = renderGridOverlay ?? import_grid_overlay.GridOverlay;
|
|
462
|
+
const overlayRowHeight = typeof rowHeight === "number" ? rowHeight : void 0;
|
|
463
|
+
const overlayRows = (0, import_element.useMemo)(() => {
|
|
464
|
+
if (overlayRowHeight === void 0 || containerHeight <= 0) {
|
|
465
|
+
return void 0;
|
|
466
|
+
}
|
|
467
|
+
const rowTile = overlayRowHeight + gapPx;
|
|
468
|
+
return Math.max(
|
|
469
|
+
1,
|
|
470
|
+
Math.floor((containerHeight + gapPx) / rowTile)
|
|
471
|
+
);
|
|
472
|
+
}, [overlayRowHeight, containerHeight, gapPx]);
|
|
473
|
+
const gridOverlay = (0, import_element.useMemo)(
|
|
474
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
475
|
+
Overlay,
|
|
476
|
+
{
|
|
477
|
+
columns: effectiveColumns,
|
|
478
|
+
rowHeight: overlayRowHeight,
|
|
479
|
+
rows: overlayRows,
|
|
480
|
+
isActive: editMode
|
|
481
|
+
}
|
|
482
|
+
),
|
|
483
|
+
[
|
|
484
|
+
Overlay,
|
|
485
|
+
editMode,
|
|
486
|
+
effectiveColumns,
|
|
487
|
+
overlayRowHeight,
|
|
488
|
+
overlayRows
|
|
489
|
+
]
|
|
490
|
+
);
|
|
491
|
+
const layoutFingerprint = (0, import_element.useMemo)(
|
|
492
|
+
() => (0, import_use_layout_shift_animation.getLayoutFingerprint)([...resolvedItemMap.values()]),
|
|
493
|
+
[resolvedItemMap]
|
|
494
|
+
);
|
|
495
|
+
const excludeLayoutAnimationKey = activeId ?? (isResizing ? resizeSnapPreview?.id : null);
|
|
496
|
+
const { captureLayoutSnapshot, getPositionsBeforeLastChange } = (0, import_use_layout_shift_animation.useLayoutShiftAnimation)({
|
|
497
|
+
container: gridRoot,
|
|
498
|
+
enabled: editMode,
|
|
499
|
+
layoutFingerprint,
|
|
500
|
+
excludeItemKey: excludeLayoutAnimationKey
|
|
501
|
+
});
|
|
502
|
+
const { exitingItems, clearExitingItem } = (0, import_use_item_exit_animation.useItemExitAnimation)({
|
|
503
|
+
container: gridRoot,
|
|
504
|
+
enabled: editMode,
|
|
505
|
+
layoutKeys,
|
|
506
|
+
getPositionsBeforeLastChange,
|
|
507
|
+
childrenCacheRef
|
|
508
|
+
});
|
|
509
|
+
const layoutAnimating = editMode;
|
|
510
|
+
(0, import_element.useLayoutEffect)(() => {
|
|
511
|
+
captureLayoutSnapshotRef.current = captureLayoutSnapshot;
|
|
512
|
+
}, [captureLayoutSnapshot]);
|
|
513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
514
|
+
import_core.DndContext,
|
|
515
|
+
{
|
|
516
|
+
sensors,
|
|
517
|
+
onDragStart: handleDragStart,
|
|
518
|
+
onDragCancel: handleDragCancel,
|
|
519
|
+
onDragMove: handleDragMove,
|
|
520
|
+
onDragEnd: () => {
|
|
521
|
+
persistTemporaryLayout();
|
|
522
|
+
lastReorderCursorRef.current = null;
|
|
523
|
+
setActiveId(null);
|
|
524
|
+
},
|
|
525
|
+
children: [
|
|
526
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sortable.SortableContext, { items, strategy: NO_SORT_STRATEGY, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
527
|
+
"div",
|
|
528
|
+
{
|
|
529
|
+
...divProps,
|
|
530
|
+
ref: mergedGridRef,
|
|
531
|
+
className: (0, import_clsx.default)(
|
|
532
|
+
grid_default.grid,
|
|
533
|
+
layoutAnimating && layout_shift_animation_default["layout-animating"],
|
|
534
|
+
className
|
|
535
|
+
),
|
|
536
|
+
"data-wp-grid-dragging": activeId || void 0,
|
|
537
|
+
"data-wp-grid-resizing": isResizing || void 0,
|
|
538
|
+
style: {
|
|
539
|
+
...style,
|
|
540
|
+
gridTemplateColumns: `repeat(${effectiveColumns}, minmax(0, 1fr))`,
|
|
541
|
+
gridAutoRows: rowHeight
|
|
542
|
+
},
|
|
543
|
+
children: [
|
|
544
|
+
gridOverlay,
|
|
545
|
+
items.map((id) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
546
|
+
import_grid_item.GridItem,
|
|
547
|
+
{
|
|
548
|
+
item: resolvedItemMap.get(
|
|
549
|
+
id
|
|
550
|
+
),
|
|
551
|
+
maxColumns: effectiveColumns,
|
|
552
|
+
disabled: !editMode,
|
|
553
|
+
verticalResizable: rowHeight !== "auto",
|
|
554
|
+
interacting: activeId !== null || isResizing,
|
|
555
|
+
dragging: activeId !== null,
|
|
556
|
+
onResize: handleResize,
|
|
557
|
+
onResizeEnd: persistTemporaryLayout,
|
|
558
|
+
resizeSnapPreview: resizeSnapPreview?.id === id ? resizeSnapPreview.snap : null,
|
|
559
|
+
minResizeWidthPx,
|
|
560
|
+
minResizeHeightPx,
|
|
561
|
+
actionableArea: actionableAreaMap.get(id),
|
|
562
|
+
renderResizeHandle,
|
|
563
|
+
children: childrenMap.get(id)
|
|
564
|
+
},
|
|
565
|
+
id
|
|
566
|
+
)),
|
|
567
|
+
remaining,
|
|
568
|
+
exitingItems.map(({ key, rect, child }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
569
|
+
import_item_exit_overlay.ItemExitOverlay,
|
|
570
|
+
{
|
|
571
|
+
itemKey: key,
|
|
572
|
+
rect,
|
|
573
|
+
onAnimationEnd: () => clearExitingItem(key),
|
|
574
|
+
children: child
|
|
575
|
+
},
|
|
576
|
+
`exiting-${key}`
|
|
577
|
+
))
|
|
578
|
+
]
|
|
579
|
+
}
|
|
580
|
+
) }),
|
|
581
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.DragOverlay, { dropAnimation: dashboardDragDropAnimation, children: dragOverlayContent })
|
|
582
|
+
]
|
|
583
|
+
}
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
);
|
|
587
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
588
|
+
0 && (module.exports = {
|
|
589
|
+
DashboardGrid
|
|
590
|
+
});
|
|
591
|
+
//# sourceMappingURL=index.cjs.map
|