@dxos/react-ui-list 0.6.12-main.ac23639
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/LICENSE +8 -0
- package/README.md +5 -0
- package/dist/lib/browser/index.mjs +303 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/node/index.cjs +328 -0
- package/dist/lib/node/index.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -0
- package/dist/lib/node-esm/index.mjs +305 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/types/src/components/List/DropIndicator.d.ts +10 -0
- package/dist/types/src/components/List/DropIndicator.d.ts.map +1 -0
- package/dist/types/src/components/List/List.d.ts +26 -0
- package/dist/types/src/components/List/List.d.ts.map +1 -0
- package/dist/types/src/components/List/List.stories.d.ts +13 -0
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/ListItem.d.ts +52 -0
- package/dist/types/src/components/List/ListItem.d.ts.map +1 -0
- package/dist/types/src/components/List/ListRoot.d.ts +30 -0
- package/dist/types/src/components/List/ListRoot.d.ts.map +1 -0
- package/dist/types/src/components/List/index.d.ts +2 -0
- package/dist/types/src/components/List/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/testing.d.ts +15 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/package.json +63 -0
- package/src/components/List/DropIndicator.tsx +64 -0
- package/src/components/List/List.stories.tsx +108 -0
- package/src/components/List/List.tsx +44 -0
- package/src/components/List/ListItem.tsx +234 -0
- package/src/components/List/ListRoot.tsx +85 -0
- package/src/components/List/index.ts +5 -0
- package/src/components/index.ts +5 -0
- package/src/index.ts +5 -0
- package/src/testing.ts +29 -0
|
@@ -0,0 +1,328 @@
|
|
|
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
|
+
var node_exports = {};
|
|
30
|
+
__export(node_exports, {
|
|
31
|
+
List: () => List
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(node_exports);
|
|
34
|
+
var import_combine = require("@atlaskit/pragmatic-drag-and-drop/combine");
|
|
35
|
+
var import_adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
36
|
+
var import_set_custom_native_drag_preview = require("@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview");
|
|
37
|
+
var import_closest_edge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
|
|
38
|
+
var import_react_context = require("@radix-ui/react-context");
|
|
39
|
+
var import_react = __toESM(require("react"));
|
|
40
|
+
var import_react_dom = require("react-dom");
|
|
41
|
+
var import_invariant = require("@dxos/invariant");
|
|
42
|
+
var import_react_ui = require("@dxos/react-ui");
|
|
43
|
+
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
44
|
+
var import_react2 = __toESM(require("react"));
|
|
45
|
+
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
46
|
+
var import_adapter2 = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
47
|
+
var import_closest_edge2 = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
|
|
48
|
+
var import_reorder_with_edge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge");
|
|
49
|
+
var import_react_context2 = require("@radix-ui/react-context");
|
|
50
|
+
var import_react3 = __toESM(require("react"));
|
|
51
|
+
var import_react_dom2 = require("react-dom");
|
|
52
|
+
var import_react_ui2 = require("@dxos/react-ui");
|
|
53
|
+
var edgeToOrientationMap = {
|
|
54
|
+
top: "horizontal",
|
|
55
|
+
bottom: "horizontal",
|
|
56
|
+
left: "vertical",
|
|
57
|
+
right: "vertical"
|
|
58
|
+
};
|
|
59
|
+
var orientationStyles = {
|
|
60
|
+
horizontal: "h-[--line-thickness] left-[--terminal-radius] right-0 before:left-[--negative-terminal-size]",
|
|
61
|
+
vertical: "w-[--line-thickness] top-[--terminal-radius] bottom-0 before:top-[--negative-terminal-size]"
|
|
62
|
+
};
|
|
63
|
+
var edgeStyles = {
|
|
64
|
+
top: "top-[--line-offset] before:top-[--offset-terminal]",
|
|
65
|
+
right: "right-[--line-offset] before:right-[--offset-terminal]",
|
|
66
|
+
bottom: "bottom-[--line-offset] before:bottom-[--offset-terminal]",
|
|
67
|
+
left: "left-[--line-offset] before:left-[--offset-terminal]"
|
|
68
|
+
};
|
|
69
|
+
var strokeSize = 2;
|
|
70
|
+
var terminalSize = 8;
|
|
71
|
+
var offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
|
|
72
|
+
var DropIndicator = ({ edge, gap = "0px" }) => {
|
|
73
|
+
const lineOffset = `calc(-0.5 * (${gap} + ${strokeSize}px))`;
|
|
74
|
+
const orientation = edgeToOrientationMap[edge];
|
|
75
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
76
|
+
style: {
|
|
77
|
+
"--line-thickness": `${strokeSize}px`,
|
|
78
|
+
"--line-offset": `${lineOffset}`,
|
|
79
|
+
"--terminal-size": `${terminalSize}px`,
|
|
80
|
+
"--terminal-radius": `${terminalSize / 2}px`,
|
|
81
|
+
"--negative-terminal-size": `-${terminalSize}px`,
|
|
82
|
+
"--offset-terminal": `${offsetToAlignTerminalWithLine}px`
|
|
83
|
+
},
|
|
84
|
+
className: (0, import_react_ui_theme2.mx)("absolute z-10 pointer-events-none bg-blue-700", "before:content-[''] before:w-[--terminal-size] before:h-[--terminal-size] box-border before:absolute", "before:border-[length:--line-thickness] before:border-solid before:border-blue-700 before:rounded-full", orientationStyles[orientation], edgeStyles[edge])
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
var LIST_NAME = "List";
|
|
88
|
+
var [ListProvider, useListContext] = (0, import_react_context2.createContext)(LIST_NAME);
|
|
89
|
+
var ListRoot = ({ classNames, children, items: _items = [], isItem, ...props }) => {
|
|
90
|
+
const [items, setItems] = (0, import_react_ui2.useControlledValue)(_items);
|
|
91
|
+
const [state, setState] = (0, import_react3.useState)(idle);
|
|
92
|
+
(0, import_react3.useEffect)(() => {
|
|
93
|
+
return (0, import_adapter2.monitorForElements)({
|
|
94
|
+
canMonitor: ({ source }) => isItem(source.data),
|
|
95
|
+
onDrop: ({ location, source }) => {
|
|
96
|
+
const target = location.current.dropTargets[0];
|
|
97
|
+
if (!target) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const sourceData = source.data;
|
|
101
|
+
const targetData = target.data;
|
|
102
|
+
if (!isItem(sourceData) || !isItem(targetData)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const sourceIdx = items.findIndex((item) => item.id === sourceData.id);
|
|
106
|
+
const targetIdx = items.findIndex((item) => item.id === targetData.id);
|
|
107
|
+
if (targetIdx < 0 || sourceIdx < 0) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const closestEdgeOfTarget = (0, import_closest_edge2.extractClosestEdge)(targetData);
|
|
111
|
+
(0, import_react_dom2.flushSync)(() => {
|
|
112
|
+
setItems((0, import_reorder_with_edge.reorderWithEdge)({
|
|
113
|
+
list: items,
|
|
114
|
+
startIndex: sourceIdx,
|
|
115
|
+
indexOfTarget: targetIdx,
|
|
116
|
+
axis: "vertical",
|
|
117
|
+
closestEdgeOfTarget
|
|
118
|
+
}));
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}, [
|
|
123
|
+
items
|
|
124
|
+
]);
|
|
125
|
+
return /* @__PURE__ */ import_react3.default.createElement(ListProvider, {
|
|
126
|
+
isItem,
|
|
127
|
+
state,
|
|
128
|
+
setState,
|
|
129
|
+
...props
|
|
130
|
+
}, children?.({
|
|
131
|
+
state,
|
|
132
|
+
items
|
|
133
|
+
}));
|
|
134
|
+
};
|
|
135
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-list/src/components/List/ListItem.tsx";
|
|
136
|
+
var idle = {
|
|
137
|
+
type: "idle"
|
|
138
|
+
};
|
|
139
|
+
var stateStyles = {
|
|
140
|
+
"is-dragging": "opacity-50"
|
|
141
|
+
};
|
|
142
|
+
var defaultContext = {};
|
|
143
|
+
var LIST_ITEM_NAME = "ListItem";
|
|
144
|
+
var [ListItemProvider, useListItemContext] = (0, import_react_context.createContext)(LIST_ITEM_NAME, defaultContext);
|
|
145
|
+
var ListItem = ({ children, classNames, item }) => {
|
|
146
|
+
const { isItem, dragPreview, setState: setRootState } = useListContext(LIST_ITEM_NAME);
|
|
147
|
+
const ref = (0, import_react.useRef)(null);
|
|
148
|
+
const dragHandleRef = (0, import_react.useRef)(null);
|
|
149
|
+
const [state, setState] = (0, import_react.useState)(idle);
|
|
150
|
+
(0, import_react.useEffect)(() => {
|
|
151
|
+
const element = ref.current;
|
|
152
|
+
(0, import_invariant.invariant)(element, void 0, {
|
|
153
|
+
F: __dxlog_file,
|
|
154
|
+
L: 89,
|
|
155
|
+
S: void 0,
|
|
156
|
+
A: [
|
|
157
|
+
"element",
|
|
158
|
+
""
|
|
159
|
+
]
|
|
160
|
+
});
|
|
161
|
+
return (0, import_combine.combine)(
|
|
162
|
+
//
|
|
163
|
+
// https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/element/about#draggable
|
|
164
|
+
//
|
|
165
|
+
(0, import_adapter.draggable)({
|
|
166
|
+
element,
|
|
167
|
+
dragHandle: dragHandleRef.current,
|
|
168
|
+
getInitialData: () => item,
|
|
169
|
+
onGenerateDragPreview: dragPreview ? ({ nativeSetDragImage, source }) => {
|
|
170
|
+
const rect = source.element.getBoundingClientRect();
|
|
171
|
+
(0, import_set_custom_native_drag_preview.setCustomNativeDragPreview)({
|
|
172
|
+
nativeSetDragImage,
|
|
173
|
+
getOffset: ({ container }) => {
|
|
174
|
+
const { height } = container.getBoundingClientRect();
|
|
175
|
+
return {
|
|
176
|
+
x: 20,
|
|
177
|
+
y: height / 2
|
|
178
|
+
};
|
|
179
|
+
},
|
|
180
|
+
render: ({ container }) => {
|
|
181
|
+
container.style.width = rect.width + "px";
|
|
182
|
+
setState({
|
|
183
|
+
type: "preview",
|
|
184
|
+
container
|
|
185
|
+
});
|
|
186
|
+
setRootState({
|
|
187
|
+
type: "preview",
|
|
188
|
+
container,
|
|
189
|
+
item
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
} : void 0,
|
|
194
|
+
onDragStart: () => {
|
|
195
|
+
setState({
|
|
196
|
+
type: "is-dragging"
|
|
197
|
+
});
|
|
198
|
+
setRootState({
|
|
199
|
+
type: "is-dragging",
|
|
200
|
+
item
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
onDrop: () => {
|
|
204
|
+
setState(idle);
|
|
205
|
+
setRootState(idle);
|
|
206
|
+
}
|
|
207
|
+
}),
|
|
208
|
+
//
|
|
209
|
+
// https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/element/about#drop-target-for-elements
|
|
210
|
+
//
|
|
211
|
+
(0, import_adapter.dropTargetForElements)({
|
|
212
|
+
element,
|
|
213
|
+
canDrop: ({ source }) => {
|
|
214
|
+
return source.element !== element && isItem(source.data);
|
|
215
|
+
},
|
|
216
|
+
getData: ({ input }) => {
|
|
217
|
+
return (0, import_closest_edge.attachClosestEdge)(item, {
|
|
218
|
+
element,
|
|
219
|
+
input,
|
|
220
|
+
allowedEdges: [
|
|
221
|
+
"top",
|
|
222
|
+
"bottom"
|
|
223
|
+
]
|
|
224
|
+
});
|
|
225
|
+
},
|
|
226
|
+
getIsSticky: () => true,
|
|
227
|
+
onDragEnter: ({ self }) => {
|
|
228
|
+
const closestEdge = (0, import_closest_edge.extractClosestEdge)(self.data);
|
|
229
|
+
setState({
|
|
230
|
+
type: "is-dragging-over",
|
|
231
|
+
closestEdge
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
onDrag: ({ self }) => {
|
|
235
|
+
const closestEdge = (0, import_closest_edge.extractClosestEdge)(self.data);
|
|
236
|
+
setState((current) => {
|
|
237
|
+
if (current.type === "is-dragging-over" && current.closestEdge === closestEdge) {
|
|
238
|
+
return current;
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
type: "is-dragging-over",
|
|
242
|
+
closestEdge
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
},
|
|
246
|
+
onDragLeave: () => {
|
|
247
|
+
setState(idle);
|
|
248
|
+
},
|
|
249
|
+
onDrop: () => {
|
|
250
|
+
setState(idle);
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
);
|
|
254
|
+
}, [
|
|
255
|
+
item
|
|
256
|
+
]);
|
|
257
|
+
return /* @__PURE__ */ import_react.default.createElement(ListItemProvider, {
|
|
258
|
+
item,
|
|
259
|
+
dragHandleRef
|
|
260
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
261
|
+
className: "relative"
|
|
262
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
263
|
+
ref,
|
|
264
|
+
role: "listitem",
|
|
265
|
+
className: (0, import_react_ui_theme.mx)("flex", classNames, stateStyles[state.type])
|
|
266
|
+
}, children), state.type === "is-dragging-over" && state.closestEdge && /* @__PURE__ */ import_react.default.createElement(DropIndicator, {
|
|
267
|
+
edge: state.closestEdge
|
|
268
|
+
})));
|
|
269
|
+
};
|
|
270
|
+
var IconButton = /* @__PURE__ */ (0, import_react.forwardRef)(({ classNames, icon, ...props }, forwardedRef) => {
|
|
271
|
+
return /* @__PURE__ */ import_react.default.createElement("button", {
|
|
272
|
+
ref: forwardedRef,
|
|
273
|
+
className: (0, import_react_ui_theme.mx)("flex items-center justify-center", classNames),
|
|
274
|
+
...props
|
|
275
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Icon, {
|
|
276
|
+
icon,
|
|
277
|
+
classNames: "cursor-pointer",
|
|
278
|
+
size: 4
|
|
279
|
+
}));
|
|
280
|
+
});
|
|
281
|
+
var ListItemDeleteButton = ({ autoHide = true, classNames, ...props }) => {
|
|
282
|
+
const { state } = useListContext("DELETE_BUTTON");
|
|
283
|
+
const disabled = state.type !== "idle";
|
|
284
|
+
return /* @__PURE__ */ import_react.default.createElement(IconButton, {
|
|
285
|
+
icon: "ph--x--regular",
|
|
286
|
+
disabled,
|
|
287
|
+
classNames: [
|
|
288
|
+
classNames,
|
|
289
|
+
autoHide && disabled && "hidden"
|
|
290
|
+
],
|
|
291
|
+
...props
|
|
292
|
+
});
|
|
293
|
+
};
|
|
294
|
+
var ListItemDragHandle = () => {
|
|
295
|
+
const { dragHandleRef } = useListItemContext("DRAG_HANDLE");
|
|
296
|
+
return /* @__PURE__ */ import_react.default.createElement(IconButton, {
|
|
297
|
+
ref: dragHandleRef,
|
|
298
|
+
icon: "ph--dots-six--regular"
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
var ListItemDragPreview = ({ children }) => {
|
|
302
|
+
const { state } = useListContext("DRAG_PREVIEW");
|
|
303
|
+
return state?.type === "preview" ? /* @__PURE__ */ (0, import_react_dom.createPortal)(children({
|
|
304
|
+
item: state.item
|
|
305
|
+
}), state.container) : null;
|
|
306
|
+
};
|
|
307
|
+
var ListItemWrapper = ({ classNames, children }) => /* @__PURE__ */ import_react.default.createElement("div", {
|
|
308
|
+
className: (0, import_react_ui_theme.mx)("flex w-full", classNames)
|
|
309
|
+
}, children);
|
|
310
|
+
var ListItemTitle = ({ classNames, children, ...props }) => /* @__PURE__ */ import_react.default.createElement("div", {
|
|
311
|
+
className: (0, import_react_ui_theme.mx)("flex w-full items-center", classNames),
|
|
312
|
+
...props
|
|
313
|
+
}, children);
|
|
314
|
+
var List = {
|
|
315
|
+
Root: ListRoot,
|
|
316
|
+
Item: ListItem,
|
|
317
|
+
ItemDragPreview: ListItemDragPreview,
|
|
318
|
+
ItemWrapper: ListItemWrapper,
|
|
319
|
+
ItemDragHandle: ListItemDragHandle,
|
|
320
|
+
ItemDeleteButton: ListItemDeleteButton,
|
|
321
|
+
ItemTitle: ListItemTitle,
|
|
322
|
+
IconButton
|
|
323
|
+
};
|
|
324
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
325
|
+
0 && (module.exports = {
|
|
326
|
+
List
|
|
327
|
+
});
|
|
328
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/List/ListItem.tsx", "../../../src/components/List/DropIndicator.tsx", "../../../src/components/List/ListRoot.tsx", "../../../src/components/List/List.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';\nimport { draggable, dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\nimport { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';\nimport { type Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';\nimport { attachClosestEdge, extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';\nimport { createContext } from '@radix-ui/react-context';\nimport React, {\n type ComponentProps,\n type HTMLAttributes,\n type MutableRefObject,\n type PropsWithChildren,\n type ReactNode,\n forwardRef,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { invariant } from '@dxos/invariant';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { Icon } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { DropIndicator } from './DropIndicator';\nimport { useListContext } from './ListRoot';\n\nexport type ListItemRecord = { id: string };\n\nexport type ItemState =\n | {\n type: 'idle';\n }\n | {\n type: 'preview';\n container: HTMLElement;\n }\n | {\n type: 'is-dragging';\n }\n | {\n type: 'is-dragging-over';\n closestEdge: Edge | null;\n };\n\nexport const idle: ItemState = { type: 'idle' };\n\nconst stateStyles: { [Key in ItemState['type']]?: HTMLAttributes<HTMLDivElement>['className'] } = {\n 'is-dragging': 'opacity-50',\n};\n\ntype ListItemContext<T extends ListItemRecord> = {\n item: T;\n dragHandleRef: MutableRefObject<HTMLElement | null>;\n};\n\n/**\n * Default context defined for ListItemDragPreview, which is defined outside of ListItem.\n */\nconst defaultContext: ListItemContext<any> = {} as any;\n\nconst LIST_ITEM_NAME = 'ListItem';\n\nexport const [ListItemProvider, useListItemContext] = createContext<ListItemContext<any>>(\n LIST_ITEM_NAME,\n defaultContext,\n);\n\nexport type ListItemProps<T extends ListItemRecord> = ThemedClassName<\n PropsWithChildren<{\n item: T;\n }>\n>;\n\n/**\n * Draggable list item.\n */\nexport const ListItem = <T extends ListItemRecord>({ children, classNames, item }: ListItemProps<T>) => {\n const { isItem, dragPreview, setState: setRootState } = useListContext(LIST_ITEM_NAME);\n const ref = useRef<HTMLDivElement | null>(null);\n const dragHandleRef = useRef<HTMLElement | null>(null);\n const [state, setState] = useState<ItemState>(idle);\n useEffect(() => {\n const element = ref.current;\n invariant(element);\n return combine(\n //\n // https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/element/about#draggable\n //\n draggable({\n element,\n dragHandle: dragHandleRef.current!,\n getInitialData: () => item,\n onGenerateDragPreview: dragPreview\n ? ({ nativeSetDragImage, source }) => {\n const rect = source.element.getBoundingClientRect();\n setCustomNativeDragPreview({\n nativeSetDragImage,\n getOffset: ({ container }) => {\n const { height } = container.getBoundingClientRect();\n return {\n x: 20,\n y: height / 2,\n };\n },\n render: ({ container }) => {\n container.style.width = rect.width + 'px';\n setState({ type: 'preview', container });\n setRootState({ type: 'preview', container, item });\n },\n });\n }\n : undefined,\n onDragStart: () => {\n setState({ type: 'is-dragging' });\n setRootState({ type: 'is-dragging', item });\n },\n onDrop: () => {\n setState(idle);\n setRootState(idle);\n },\n }),\n\n //\n // https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/element/about#drop-target-for-elements\n //\n dropTargetForElements({\n element,\n canDrop: ({ source }) => {\n return source.element !== element && isItem(source.data);\n },\n getData: ({ input }) => {\n return attachClosestEdge(item, { element, input, allowedEdges: ['top', 'bottom'] });\n },\n getIsSticky: () => true,\n onDragEnter: ({ self }) => {\n const closestEdge = extractClosestEdge(self.data);\n setState({ type: 'is-dragging-over', closestEdge });\n },\n onDrag: ({ self }) => {\n const closestEdge = extractClosestEdge(self.data);\n setState((current) => {\n if (current.type === 'is-dragging-over' && current.closestEdge === closestEdge) {\n return current;\n }\n return { type: 'is-dragging-over', closestEdge };\n });\n },\n onDragLeave: () => {\n setState(idle);\n },\n onDrop: () => {\n setState(idle);\n },\n }),\n );\n }, [item]);\n\n return (\n <ListItemProvider item={item} dragHandleRef={dragHandleRef}>\n <div className='relative'>\n <div ref={ref} role='listitem' className={mx('flex', classNames, stateStyles[state.type])}>\n {children}\n </div>\n {state.type === 'is-dragging-over' && state.closestEdge && <DropIndicator edge={state.closestEdge} />}\n </div>\n </ListItemProvider>\n );\n};\n\n//\n// List item components\n//\n\nexport type IconButtonProps = ThemedClassName<ComponentProps<'button'>> & { icon: string };\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ classNames, icon, ...props }, forwardedRef) => {\n return (\n <button ref={forwardedRef} className={mx('flex items-center justify-center', classNames)} {...props}>\n <Icon icon={icon} classNames='cursor-pointer' size={4} />\n </button>\n );\n },\n);\n\nexport const ListItemDeleteButton = ({\n autoHide = true,\n classNames,\n ...props\n}: Omit<IconButtonProps, 'icon'> & { autoHide?: boolean }) => {\n const { state } = useListContext('DELETE_BUTTON');\n const disabled = state.type !== 'idle';\n return (\n <IconButton\n icon='ph--x--regular'\n disabled={disabled}\n classNames={[classNames, autoHide && disabled && 'hidden']}\n {...props}\n />\n );\n};\n\nexport const ListItemDragHandle = () => {\n const { dragHandleRef } = useListItemContext('DRAG_HANDLE');\n return <IconButton ref={dragHandleRef as any} icon='ph--dots-six--regular' />;\n};\n\nexport const ListItemDragPreview = <T extends ListItemRecord>({\n children,\n}: {\n children: ({ item }: { item: T }) => ReactNode;\n}) => {\n const { state } = useListContext('DRAG_PREVIEW');\n return state?.type === 'preview' ? createPortal(children({ item: state.item }), state.container) : null;\n};\n\nexport const ListItemWrapper = ({ classNames, children }: ThemedClassName<PropsWithChildren>) => (\n <div className={mx('flex w-full', classNames)}>{children}</div>\n);\n\nexport const ListItemTitle = ({\n classNames,\n children,\n ...props\n}: ThemedClassName<PropsWithChildren<ComponentProps<'div'>>>) => (\n <div className={mx('flex w-full items-center', classNames)} {...props}>\n {children}\n </div>\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/types';\nimport React, { type CSSProperties, type HTMLAttributes } from 'react';\n\nimport { mx } from '@dxos/react-ui-theme';\n\ntype Orientation = 'horizontal' | 'vertical';\n\nconst edgeToOrientationMap: Record<Edge, Orientation> = {\n top: 'horizontal',\n bottom: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n};\n\nconst orientationStyles: Record<Orientation, HTMLAttributes<HTMLElement>['className']> = {\n horizontal: 'h-[--line-thickness] left-[--terminal-radius] right-0 before:left-[--negative-terminal-size]',\n vertical: 'w-[--line-thickness] top-[--terminal-radius] bottom-0 before:top-[--negative-terminal-size]',\n};\n\nconst edgeStyles: Record<Edge, HTMLAttributes<HTMLElement>['className']> = {\n top: 'top-[--line-offset] before:top-[--offset-terminal]',\n right: 'right-[--line-offset] before:right-[--offset-terminal]',\n bottom: 'bottom-[--line-offset] before:bottom-[--offset-terminal]',\n left: 'left-[--line-offset] before:left-[--offset-terminal]',\n};\n\nconst strokeSize = 2;\nconst terminalSize = 8;\nconst offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;\n\n/**\n * This is a tailwind port of `@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box`\n */\nexport const DropIndicator = ({ edge, gap = '0px' }: { edge: Edge; gap?: string }) => {\n const lineOffset = `calc(-0.5 * (${gap} + ${strokeSize}px))`;\n\n const orientation = edgeToOrientationMap[edge];\n\n return (\n <div\n style={\n {\n '--line-thickness': `${strokeSize}px`,\n '--line-offset': `${lineOffset}`,\n '--terminal-size': `${terminalSize}px`,\n '--terminal-radius': `${terminalSize / 2}px`,\n '--negative-terminal-size': `-${terminalSize}px`,\n '--offset-terminal': `${offsetToAlignTerminalWithLine}px`,\n } as CSSProperties\n }\n className={mx(\n 'absolute z-10 pointer-events-none bg-blue-700',\n \"before:content-[''] before:w-[--terminal-size] before:h-[--terminal-size] box-border before:absolute\",\n 'before:border-[length:--line-thickness] before:border-solid before:border-blue-700 before:rounded-full',\n orientationStyles[orientation],\n edgeStyles[edge],\n )}\n ></div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\nimport { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';\nimport { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge';\nimport { createContext } from '@radix-ui/react-context';\nimport React, { type ReactNode, useEffect, useState } from 'react';\nimport { flushSync } from 'react-dom';\n\nimport { type ThemedClassName, useControlledValue } from '@dxos/react-ui';\n\nimport { type ListItemRecord, idle, type ItemState } from './ListItem';\n\ntype ListContext<T extends ListItemRecord> = {\n isItem: (item: any) => boolean;\n dragPreview?: boolean;\n state: ItemState & { item?: T };\n setState: (state: ItemState & { item?: T }) => void;\n};\n\nconst LIST_NAME = 'List';\n\nexport const [ListProvider, useListContext] = createContext<ListContext<any>>(LIST_NAME);\n\nexport type ListRendererProps<T extends ListItemRecord> = {\n state: ListContext<T>['state'];\n items: T[];\n};\n\nexport type ListRootProps<T extends ListItemRecord> = ThemedClassName<{\n children?: (props: ListRendererProps<T>) => ReactNode;\n items?: T[];\n}> &\n Pick<ListContext<T>, 'isItem' | 'dragPreview'>;\n\nexport const ListRoot = <T extends ListItemRecord>({\n classNames,\n children,\n items: _items = [],\n isItem,\n ...props\n}: ListRootProps<T>) => {\n const [items, setItems] = useControlledValue<T[]>(_items);\n const [state, setState] = useState<ListContext<T>['state']>(idle);\n useEffect(() => {\n return monitorForElements({\n canMonitor: ({ source }) => isItem(source.data),\n onDrop: ({ location, source }) => {\n const target = location.current.dropTargets[0];\n if (!target) {\n return;\n }\n\n const sourceData = source.data;\n const targetData = target.data;\n if (!isItem(sourceData) || !isItem(targetData)) {\n return;\n }\n\n const sourceIdx = items.findIndex((item) => item.id === sourceData.id);\n const targetIdx = items.findIndex((item) => item.id === targetData.id);\n if (targetIdx < 0 || sourceIdx < 0) {\n return;\n }\n\n const closestEdgeOfTarget = extractClosestEdge(targetData);\n flushSync(() => {\n setItems(\n reorderWithEdge({\n list: items,\n startIndex: sourceIdx,\n indexOfTarget: targetIdx,\n axis: 'vertical',\n closestEdgeOfTarget,\n }),\n );\n });\n },\n });\n }, [items]);\n\n return <ListProvider {...{ isItem, state, setState, ...props }}>{children?.({ state, items })}</ListProvider>;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport {\n IconButton,\n type IconButtonProps,\n ListItem,\n ListItemDeleteButton,\n ListItemDragHandle,\n ListItemDragPreview,\n type ListItemProps,\n type ListItemRecord,\n ListItemTitle,\n ListItemWrapper,\n} from './ListItem';\nimport { ListRoot, type ListRootProps } from './ListRoot';\n\n// TODO(burdon): Multi-select model.\n// TODO(burdon): Key nav.\n// TODO(burdon): Animation.\n// TODO(burdon): Constrain axis.\n// TODO(burdon): Tree view.\n// TODO(burdon): Fix autoscroll while dragging.\n\n/**\n * Draggable list.\n * Ref: https://github.com/atlassian/pragmatic-drag-and-drop\n * Ref: https://github.com/alexreardon/pdnd-react-tailwind/blob/main/src/task.tsx\n */\nexport const List = {\n Root: ListRoot,\n Item: ListItem,\n ItemDragPreview: ListItemDragPreview,\n ItemWrapper: ListItemWrapper,\n ItemDragHandle: ListItemDragHandle,\n ItemDeleteButton: ListItemDeleteButton,\n ItemTitle: ListItemTitle,\n IconButton,\n};\n\ntype ListItem = ListItemRecord;\n\nexport type { ListRootProps, ListItemProps, IconButtonProps, ListItem };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,qBAAwB;AACxB,qBAAiD;AACjD,4CAA2C;AAE3C,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MAAMxD;EACNyD,iBAAiBP;EACjBQ,aAAaN;EACbO,gBAAgBV;EAChBW,kBAAkBd;EAClBe,WAAWR;EACXd;AACF;",
|
|
6
|
+
"names": ["import_react", "import_react_ui_theme", "import_adapter", "import_closest_edge", "import_react_context", "import_react_dom", "import_react_ui", "edgeToOrientationMap", "top", "bottom", "left", "right", "orientationStyles", "horizontal", "vertical", "edgeStyles", "strokeSize", "terminalSize", "offsetToAlignTerminalWithLine", "DropIndicator", "edge", "gap", "lineOffset", "orientation", "React", "div", "style", "className", "mx", "LIST_NAME", "ListProvider", "useListContext", "createContext", "ListRoot", "classNames", "children", "items", "_items", "isItem", "props", "setItems", "useControlledValue", "state", "setState", "useState", "idle", "useEffect", "monitorForElements", "canMonitor", "source", "data", "onDrop", "location", "target", "current", "dropTargets", "sourceData", "targetData", "sourceIdx", "findIndex", "item", "id", "targetIdx", "closestEdgeOfTarget", "extractClosestEdge", "flushSync", "reorderWithEdge", "list", "startIndex", "indexOfTarget", "axis", "type", "stateStyles", "defaultContext", "LIST_ITEM_NAME", "ListItemProvider", "useListItemContext", "ListItem", "dragPreview", "setRootState", "ref", "useRef", "dragHandleRef", "element", "invariant", "combine", "draggable", "dragHandle", "getInitialData", "onGenerateDragPreview", "nativeSetDragImage", "rect", "getBoundingClientRect", "setCustomNativeDragPreview", "getOffset", "container", "height", "x", "y", "render", "width", "undefined", "onDragStart", "dropTargetForElements", "canDrop", "getData", "input", "attachClosestEdge", "allowedEdges", "getIsSticky", "onDragEnter", "self", "closestEdge", "onDrag", "onDragLeave", "role", "IconButton", "forwardRef", "icon", "forwardedRef", "button", "Icon", "size", "ListItemDeleteButton", "autoHide", "disabled", "ListItemDragHandle", "ListItemDragPreview", "createPortal", "ListItemWrapper", "ListItemTitle", "List", "Root", "Item", "ItemDragPreview", "ItemWrapper", "ItemDragHandle", "ItemDeleteButton", "ItemTitle"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"packages/ui/react-ui-list/src/components/List/DropIndicator.tsx":{"bytes":6988,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-list/src/components/List/ListRoot.tsx":{"bytes":8857,"imports":[{"path":"@atlaskit/pragmatic-drag-and-drop/element/adapter","kind":"import-statement","external":true},{"path":"@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge","kind":"import-statement","external":true},{"path":"@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-list/src/components/List/ListItem.tsx","kind":"import-statement","original":"./ListItem"}],"format":"esm"},"packages/ui/react-ui-list/src/components/List/ListItem.tsx":{"bytes":24071,"imports":[{"path":"@atlaskit/pragmatic-drag-and-drop/combine","kind":"import-statement","external":true},{"path":"@atlaskit/pragmatic-drag-and-drop/element/adapter","kind":"import-statement","external":true},{"path":"@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview","kind":"import-statement","external":true},{"path":"@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-list/src/components/List/DropIndicator.tsx","kind":"import-statement","original":"./DropIndicator"},{"path":"packages/ui/react-ui-list/src/components/List/ListRoot.tsx","kind":"import-statement","original":"./ListRoot"}],"format":"esm"},"packages/ui/react-ui-list/src/components/List/List.tsx":{"bytes":3478,"imports":[{"path":"packages/ui/react-ui-list/src/components/List/ListItem.tsx","kind":"import-statement","original":"./ListItem"},{"path":"packages/ui/react-ui-list/src/components/List/ListRoot.tsx","kind":"import-statement","original":"./ListRoot"}],"format":"esm"},"packages/ui/react-ui-list/src/components/List/index.ts":{"bytes":505,"imports":[{"path":"packages/ui/react-ui-list/src/components/List/List.tsx","kind":"import-statement","original":"./List"}],"format":"esm"},"packages/ui/react-ui-list/src/components/index.ts":{"bytes":500,"imports":[{"path":"packages/ui/react-ui-list/src/components/List/index.ts","kind":"import-statement","original":"./List"}],"format":"esm"},"packages/ui/react-ui-list/src/index.ts":{"bytes":503,"imports":[{"path":"packages/ui/react-ui-list/src/components/index.ts","kind":"import-statement","original":"./components"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-list/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22106},"packages/ui/react-ui-list/dist/lib/node/index.cjs":{"imports":[{"path":"@atlaskit/pragmatic-drag-and-drop/combine","kind":"import-statement","external":true},{"path":"@atlaskit/pragmatic-drag-and-drop/element/adapter","kind":"import-statement","external":true},{"path":"@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview","kind":"import-statement","external":true},{"path":"@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@atlaskit/pragmatic-drag-and-drop/element/adapter","kind":"import-statement","external":true},{"path":"@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge","kind":"import-statement","external":true},{"path":"@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["List"],"entryPoint":"packages/ui/react-ui-list/src/index.ts","inputs":{"packages/ui/react-ui-list/src/components/List/ListItem.tsx":{"bytesInOutput":6314},"packages/ui/react-ui-list/src/components/List/DropIndicator.tsx":{"bytesInOutput":1702},"packages/ui/react-ui-list/src/components/List/ListRoot.tsx":{"bytesInOutput":1927},"packages/ui/react-ui-list/src/components/List/List.tsx":{"bytesInOutput":245},"packages/ui/react-ui-list/src/components/List/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-list/src/components/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-list/src/index.ts":{"bytesInOutput":0}},"bytes":10557}}}
|