@vezham/react 26.0.0-alpha.9 → 26.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/components/command/index.js +2 -2
- package/dist/lib/components/menu/index.js +2 -2
- package/dist/lib/components/panel/footer/ai/message-actions.js +2 -2
- package/dist/lib/components/panel/footer/ai/mock-result.js +2 -2
- package/dist/lib/components/panel/footer/control-center/appearance.d.ts +2 -1
- package/dist/lib/components/panel/footer/control-center/appearance.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/control-center/appearance.js +4 -3
- package/dist/lib/components/panel/footer/control-center/control-center.js +11 -8
- package/dist/lib/components/panel/footer/control-center/direction.d.ts +2 -1
- package/dist/lib/components/panel/footer/control-center/direction.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/control-center/direction.js +6 -4
- package/dist/lib/components/panel/footer/control-center/editor.d.ts +3 -1
- package/dist/lib/components/panel/footer/control-center/editor.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/control-center/editor.js +24 -6
- package/dist/lib/components/panel/footer/control-center/preview.d.ts +4 -2
- package/dist/lib/components/panel/footer/control-center/preview.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/control-center/preview.js +4 -2
- package/dist/lib/components/panel/footer/control-center/tile.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/control-center/tile.js +12 -7
- package/dist/lib/components/panel/footer/control-center/variant.d.ts +27 -0
- package/dist/lib/components/panel/footer/control-center/variant.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/control-center/variant.js +30 -9
- package/dist/lib/components/panel/footer/index.js +2 -2
- package/dist/lib/components/panel/footer/notification-center/index.js +2 -2
- package/dist/lib/components/panel/footer/notification-center/widget-tiles.d.ts +88 -3
- package/dist/lib/components/panel/footer/notification-center/widget-tiles.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/notification-center/widget-tiles.js +63 -25
- package/dist/lib/components/panel/footer/user-menu.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/user-menu.js +258 -230
- package/dist/lib/components/panel/header/application-menu-sheet.js +5 -5
- package/dist/lib/components/panel/header/bookmarks/bookmark-file-tree/index.js +1 -1
- package/dist/lib/components/panel/header/bookmarks/bookmark-file-tree/variants.js +1 -1
- package/dist/lib/components/panel/header/bookmarks/favorites/grid-list.js +2 -2
- package/dist/lib/components/panel/header/bookmarks/index.js +2 -1
- package/dist/lib/components/panel/header/bookmarks/shortcut-context-menu.js +2 -1
- package/dist/lib/components/panel/header/bookmarks/tree-data.js +2 -1
- package/dist/lib/components/panel/header/index.js +5 -5
- package/dist/lib/components/panel/header/storage/types.d.ts +1 -1
- package/dist/lib/components/panel/info-panel/container.module.js +4 -2
- package/dist/lib/components/panel/menu/index.js +2 -2
- package/dist/lib/components/panel/menu/types.d.ts +1 -1
- package/dist/lib/layouts/menu-layout/index-md.js +3 -3
- package/dist/lib/layouts/menu-layout/index-sm.js +2 -2
- package/dist/lib/layouts/section/index.d.ts.map +1 -1
- package/dist/lib/layouts/section/index.js +7 -7
- package/dist/lib/layouts/section/sidebar.js +2 -2
- package/dist/lib/layouts/section/toolbar-more-sheet.js +3 -3
- package/dist/lib/layouts/section/toolbar.js +4 -4
- package/dist/lib/pages/settings/index.d.ts.map +1 -1
- package/dist/lib/pages/settings/index.js +72 -27
- package/dist/lib/pages/settings/navigation.d.ts +1 -1
- package/dist/lib/pages/settings/navigation.d.ts.map +1 -1
- package/dist/lib/pages/settings/settings-content.js +1 -1
- package/dist/lib/pages/settings/tile-gallery.d.ts +6 -1
- package/dist/lib/pages/settings/tile-gallery.d.ts.map +1 -1
- package/dist/lib/pages/settings/tile-gallery.js +175 -100
- package/dist/lib/store/useBookmarks/index.js +2 -2
- package/dist/lib/store/useStorage/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { controlCenterVariants } from "../../components/panel/footer/control-center/variant.js";
|
|
2
|
+
import { notificationCenterWidgetVariants } from "../../components/panel/footer/notification-center/widget-tiles.js";
|
|
3
|
+
import { Fragment, useId, useState } from "react";
|
|
2
4
|
import { Button, Drawer, SearchField, Surface, Tooltip } from "@vezham/react-v3";
|
|
3
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
import { Add, AltArrowLeft, Minus, Settings, Sidebar } from "@vezham/icons-react";
|
|
5
7
|
//#region src/lib/pages/settings/tile-gallery.tsx
|
|
8
|
+
var controlCenterStyles = controlCenterVariants();
|
|
9
|
+
var widgetStyles = notificationCenterWidgetVariants();
|
|
10
|
+
var controlSpan = (shape) => shape;
|
|
11
|
+
var widgetSize = (shape) => shape;
|
|
6
12
|
var useGallery = ({ kind, tiles, editor }) => {
|
|
7
13
|
const dragInstructionsId = useId();
|
|
8
14
|
const [draggedId, setDraggedId] = useState(null);
|
|
9
|
-
const [draggedHeight, setDraggedHeight] = useState(0);
|
|
10
15
|
const [dropTarget, setDropTarget] = useState(null);
|
|
11
16
|
const [announcement, setAnnouncement] = useState("");
|
|
12
17
|
const [query, setQuery] = useState("");
|
|
@@ -18,19 +23,43 @@ var useGallery = ({ kind, tiles, editor }) => {
|
|
|
18
23
|
const categories = ["All", ...new Set(tiles.map((tile) => tile.category))];
|
|
19
24
|
const matchingTiles = tiles.filter((tile) => `${tile.label} ${tile.category}`.toLowerCase().includes(normalizedQuery));
|
|
20
25
|
const matchingCategories = [...new Set(matchingTiles.map((tile) => tile.category))];
|
|
21
|
-
const
|
|
26
|
+
const availableTiles = tiles.filter((tile) => `${tile.label} ${tile.category}`.toLowerCase().includes(normalizedQuery) && (category === "All" || tile.category === category));
|
|
27
|
+
const seenSuggestionGroups = /* @__PURE__ */ new Set();
|
|
28
|
+
const available = availableTiles.filter((tile) => {
|
|
29
|
+
const group = tile.suggestionGroup ?? tile.id;
|
|
30
|
+
if (seenSuggestionGroups.has(group)) return false;
|
|
31
|
+
seenSuggestionGroups.add(group);
|
|
32
|
+
return true;
|
|
33
|
+
}).flatMap((tile) => tile.suggestionShapes ? tile.suggestionShapes.map((shape) => ({
|
|
34
|
+
...tile,
|
|
35
|
+
shape,
|
|
36
|
+
preview: tile.suggestionPreview?.(shape) ?? tile.preview,
|
|
37
|
+
suggestionKey: `${tile.id}:${shape}`
|
|
38
|
+
})) : [{
|
|
39
|
+
...tile,
|
|
40
|
+
suggestionKey: tile.id
|
|
41
|
+
}]);
|
|
42
|
+
const availableGroups = Array.from(available.reduce((groups, tile) => {
|
|
43
|
+
const group = tile.suggestionGroup ?? tile.id;
|
|
44
|
+
const existing = groups.get(group);
|
|
45
|
+
if (existing) existing.tiles.push(tile);
|
|
46
|
+
else groups.set(group, {
|
|
47
|
+
id: group,
|
|
48
|
+
label: tile.label,
|
|
49
|
+
tiles: [tile]
|
|
50
|
+
});
|
|
51
|
+
return groups;
|
|
52
|
+
}, /* @__PURE__ */ new Map()).values());
|
|
22
53
|
const visible = editor.items.filter((item) => item.visible).flatMap((item) => tiles.filter((tile) => tile.id === item.id));
|
|
23
54
|
const itemFor = (id) => editor.items.find((item) => item.id === id);
|
|
24
55
|
const finishDrag = () => {
|
|
25
56
|
setDraggedId(null);
|
|
26
57
|
setDropTarget(null);
|
|
27
|
-
setDraggedHeight(0);
|
|
28
58
|
};
|
|
29
|
-
const startDrag = (event, id) => {
|
|
59
|
+
const startDrag = (event, id, span) => {
|
|
30
60
|
event.dataTransfer.setData("application/x-vx-settings-tile", id);
|
|
61
|
+
if (span) event.dataTransfer.setData("application/x-vx-settings-tile-span", span);
|
|
31
62
|
event.dataTransfer.effectAllowed = "move";
|
|
32
|
-
const currentTile = event.currentTarget;
|
|
33
|
-
setDraggedHeight((currentTile.hasAttribute("data-preview-tile") ? currentTile : currentTile.querySelector("[inert]"))?.getBoundingClientRect().height ?? 64);
|
|
34
63
|
setDraggedId(id);
|
|
35
64
|
};
|
|
36
65
|
const moveTile = (id, offset) => {
|
|
@@ -49,11 +78,14 @@ var useGallery = ({ kind, tiles, editor }) => {
|
|
|
49
78
|
event.preventDefault();
|
|
50
79
|
event.stopPropagation();
|
|
51
80
|
const id = event.dataTransfer.getData("application/x-vx-settings-tile");
|
|
81
|
+
const requestedSpan = event.dataTransfer.getData("application/x-vx-settings-tile-span");
|
|
52
82
|
const item = itemFor(id);
|
|
83
|
+
const span = tiles.find((tile) => tile.id === id)?.suggestionShapes?.includes(requestedSpan) ? requestedSpan : void 0;
|
|
53
84
|
finishDrag();
|
|
54
85
|
if (!item?.editable) return;
|
|
55
86
|
if (editor.onPlace) {
|
|
56
|
-
editor.onPlace(id, target);
|
|
87
|
+
if (span) editor.onPlace(id, target, span);
|
|
88
|
+
else editor.onPlace(id, target);
|
|
57
89
|
return;
|
|
58
90
|
}
|
|
59
91
|
if (!item.visible) editor.onVisibilityChange(id, true);
|
|
@@ -87,18 +119,17 @@ var useGallery = ({ kind, tiles, editor }) => {
|
|
|
87
119
|
className: `w-full justify-start rounded-lg text-sm ${category === value ? "bg-surface-secondary font-semibold" : "text-muted"}`,
|
|
88
120
|
children: [/* @__PURE__ */ jsx(Settings, { size: 16 }), value === "All" ? `All ${kind}` : value]
|
|
89
121
|
}, value));
|
|
90
|
-
const tileSpan = (tile) => kind === "widgets" ?
|
|
122
|
+
const tileSpan = (tile) => kind === "widgets" ? widgetStyles.tile({ size: widgetSize(tile.shape) }) : controlCenterStyles.tileContainer({ span: controlSpan(tile.shape) });
|
|
91
123
|
const draggedTile = tiles.find((tile) => tile.id === draggedId);
|
|
92
124
|
const blankWidget = (tile) => /* @__PURE__ */ jsx(Surface, {
|
|
93
125
|
variant: "transparent",
|
|
94
126
|
"aria-hidden": "true",
|
|
95
|
-
className: `bg-surface-secondary border-border w-full rounded-2xl border ${
|
|
127
|
+
className: `bg-surface-secondary border-border w-full rounded-2xl border ${widgetStyles.preview({ size: widgetSize(tile.shape) })}`,
|
|
96
128
|
children: null
|
|
97
129
|
});
|
|
98
130
|
return {
|
|
99
131
|
dragInstructionsId,
|
|
100
132
|
draggedId,
|
|
101
|
-
draggedHeight,
|
|
102
133
|
dropTarget,
|
|
103
134
|
announcement,
|
|
104
135
|
query,
|
|
@@ -107,12 +138,18 @@ var useGallery = ({ kind, tiles, editor }) => {
|
|
|
107
138
|
isCategoryMenuOpen,
|
|
108
139
|
showPreview,
|
|
109
140
|
available,
|
|
141
|
+
availableGroups,
|
|
110
142
|
visible,
|
|
111
143
|
itemFor,
|
|
112
144
|
finishDrag,
|
|
113
145
|
startDrag,
|
|
114
146
|
moveTile,
|
|
115
147
|
dropTile,
|
|
148
|
+
addTile: (tile) => {
|
|
149
|
+
if (editor.onAdd && tile.suggestionShapes) editor.onAdd(tile.id, tile.shape);
|
|
150
|
+
else if (editor.onPlace && tile.suggestionShapes) editor.onPlace(tile.id, void 0, tile.shape);
|
|
151
|
+
else editor.onVisibilityChange(tile.id, true);
|
|
152
|
+
},
|
|
116
153
|
search,
|
|
117
154
|
categoryButtons,
|
|
118
155
|
tileSpan,
|
|
@@ -123,19 +160,9 @@ var useGallery = ({ kind, tiles, editor }) => {
|
|
|
123
160
|
setShowPreview
|
|
124
161
|
};
|
|
125
162
|
};
|
|
126
|
-
var GalleryPreview = ({ kind, editor, showPreview, visible, draggedId,
|
|
163
|
+
var GalleryPreview = ({ kind, editor, showPreview, visible, draggedId, dropTarget, itemFor, startDrag, finishDrag, moveTile, dropTile, tileSpan, blankWidget, dragInstructionsId, draggedTile, setDropTarget }) => /* @__PURE__ */ jsxs("aside", {
|
|
127
164
|
"aria-label": `Current ${kind}`,
|
|
128
165
|
className: `${showPreview ? "flex" : "hidden xl:flex"} border-border min-h-0 min-w-0 flex-1 flex-col p-5 xl:w-96 xl:flex-none xl:border-l`,
|
|
129
|
-
onDragOver: (event) => {
|
|
130
|
-
if (!event.dataTransfer.types.includes("application/x-vx-settings-tile")) return;
|
|
131
|
-
event.preventDefault();
|
|
132
|
-
event.dataTransfer.dropEffect = "move";
|
|
133
|
-
setDropTarget("empty");
|
|
134
|
-
},
|
|
135
|
-
onDragLeave: (event) => {
|
|
136
|
-
if (!event.currentTarget.contains(event.relatedTarget)) setDropTarget(null);
|
|
137
|
-
},
|
|
138
|
-
onDrop: (event) => dropTile(event),
|
|
139
166
|
children: [
|
|
140
167
|
/* @__PURE__ */ jsxs("div", {
|
|
141
168
|
className: "mb-4 flex items-center justify-between gap-3",
|
|
@@ -148,7 +175,18 @@ var GalleryPreview = ({ kind, editor, showPreview, visible, draggedId, draggedHe
|
|
|
148
175
|
})]
|
|
149
176
|
}),
|
|
150
177
|
/* @__PURE__ */ jsxs("div", {
|
|
151
|
-
|
|
178
|
+
"data-preview-drop-area": true,
|
|
179
|
+
className: `relative ${kind === "widgets" ? widgetStyles.galleryPreview() : controlCenterStyles.galleryPreview()}`,
|
|
180
|
+
onDragOver: (event) => {
|
|
181
|
+
if (!event.dataTransfer.types.includes("application/x-vx-settings-tile")) return;
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
event.dataTransfer.dropEffect = "move";
|
|
184
|
+
setDropTarget("empty");
|
|
185
|
+
},
|
|
186
|
+
onDragLeave: (event) => {
|
|
187
|
+
if (!event.currentTarget.contains(event.relatedTarget)) setDropTarget(null);
|
|
188
|
+
},
|
|
189
|
+
onDrop: (event) => dropTile(event),
|
|
152
190
|
children: [visible.length === 0 && /* @__PURE__ */ jsxs("p", {
|
|
153
191
|
className: "text-muted py-8 text-center text-sm",
|
|
154
192
|
children: [
|
|
@@ -156,11 +194,13 @@ var GalleryPreview = ({ kind, editor, showPreview, visible, draggedId, draggedHe
|
|
|
156
194
|
kind,
|
|
157
195
|
" added. Choose a tile from the gallery."
|
|
158
196
|
]
|
|
159
|
-
}), /* @__PURE__ */
|
|
160
|
-
className:
|
|
161
|
-
children:
|
|
197
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
198
|
+
className: kind === "widgets" ? widgetStyles.grid() : controlCenterStyles.home(),
|
|
199
|
+
children: visible.map((tile, index) => {
|
|
162
200
|
const editable = itemFor(tile.id)?.editable;
|
|
163
|
-
|
|
201
|
+
const nextTile = visible[index + 1];
|
|
202
|
+
const emptyWidgetSlot = kind === "widgets" && draggedTile !== void 0 && tile.shape === "small" && nextTile?.shape !== "small";
|
|
203
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
164
204
|
"data-preview-tile": tile.id,
|
|
165
205
|
draggable: editable,
|
|
166
206
|
role: "group",
|
|
@@ -180,7 +220,7 @@ var GalleryPreview = ({ kind, editor, showPreview, visible, draggedId, draggedHe
|
|
|
180
220
|
onDrop: (event) => dropTile(event, tile.id),
|
|
181
221
|
"data-dragging": draggedId === tile.id || void 0,
|
|
182
222
|
"data-drop-target": dropTarget === tile.id || void 0,
|
|
183
|
-
className: `group focus-visible:outline-focus data-[drop-target]:bg-accent-soft data-[drop-target]:outline-accent/40 group-focus-within:[&>div>*]:ring-foreground/35 group-hover:[&>div>*]:ring-foreground/35 relative min-w-0 rounded-2xl focus-visible:outline-2 focus-visible:outline-offset-2 data-[dragging]:opacity-40 data-[drop-target]:outline data-[drop-target]:outline-offset-2 [&>div>*]:transition-[box-shadow] group-focus-within:[&>div>*]:ring-1 group-hover:[&>div>*]:ring-1 ${editable ? "cursor-grab active:cursor-grabbing" : ""} ${tileSpan(tile)}`,
|
|
223
|
+
className: `group focus-visible:outline-focus data-[drop-target]:bg-accent-soft data-[drop-target]:outline-accent/40 group-focus-within:[&>div>*]:ring-foreground/35 group-hover:[&>div>*]:ring-foreground/35 relative min-w-0 overflow-visible rounded-2xl focus-visible:outline-2 focus-visible:outline-offset-2 data-[dragging]:opacity-40 data-[drop-target]:outline data-[drop-target]:outline-offset-2 [&>div>*]:transition-[box-shadow] group-focus-within:[&>div>*]:ring-1 group-hover:[&>div>*]:ring-1 ${editable ? "cursor-grab active:cursor-grabbing" : ""} ${tileSpan(tile)}`,
|
|
184
224
|
children: [
|
|
185
225
|
/* @__PURE__ */ jsx("div", {
|
|
186
226
|
inert: true,
|
|
@@ -215,24 +255,32 @@ var GalleryPreview = ({ kind, editor, showPreview, visible, draggedId, draggedHe
|
|
|
215
255
|
isIconOnly: true,
|
|
216
256
|
size: "sm",
|
|
217
257
|
variant: "secondary",
|
|
218
|
-
className: "text-
|
|
258
|
+
className: "border-danger text-danger hover:bg-danger/10! absolute -top-1 -left-1 z-20 size-6! min-w-0 rounded-full border bg-transparent! p-0 opacity-0 shadow-md transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
|
|
219
259
|
"aria-label": `Remove ${tile.label}`,
|
|
220
260
|
onPress: () => editor.onVisibilityChange(tile.id, false),
|
|
221
261
|
children: /* @__PURE__ */ jsx(Minus, {
|
|
222
262
|
"aria-hidden": "true",
|
|
223
|
-
className: "size-3
|
|
263
|
+
className: "size-3"
|
|
224
264
|
})
|
|
225
265
|
}), /* @__PURE__ */ jsxs(Tooltip.Content, { children: ["Remove ", tile.label] })] })
|
|
226
266
|
]
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
267
|
+
}), emptyWidgetSlot && /* @__PURE__ */ jsx("div", {
|
|
268
|
+
"data-preview-empty-slot": tile.id,
|
|
269
|
+
"data-drop-target": dropTarget === `after:${tile.id}` || void 0,
|
|
270
|
+
onDragOver: (event) => {
|
|
271
|
+
if (!event.dataTransfer.types.includes("application/x-vx-settings-tile")) return;
|
|
272
|
+
event.preventDefault();
|
|
273
|
+
event.stopPropagation();
|
|
274
|
+
event.dataTransfer.dropEffect = "move";
|
|
275
|
+
setDropTarget(`after:${tile.id}`);
|
|
276
|
+
},
|
|
277
|
+
onDragLeave: (event) => {
|
|
278
|
+
if (!event.currentTarget.contains(event.relatedTarget)) setDropTarget((current) => current === `after:${tile.id}` ? null : current);
|
|
279
|
+
},
|
|
280
|
+
onDrop: (event) => dropTile(event, nextTile?.id),
|
|
281
|
+
className: "aspect-square"
|
|
282
|
+
})] }, tile.id);
|
|
283
|
+
})
|
|
236
284
|
})]
|
|
237
285
|
}),
|
|
238
286
|
/* @__PURE__ */ jsxs(Button, {
|
|
@@ -243,67 +291,94 @@ var GalleryPreview = ({ kind, editor, showPreview, visible, draggedId, draggedHe
|
|
|
243
291
|
})
|
|
244
292
|
]
|
|
245
293
|
});
|
|
246
|
-
var GalleryAvailable = ({ kind,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
"
|
|
265
|
-
kind
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
"aria-label": `Quick add ${tile.label}`,
|
|
289
|
-
className: "bg-success hover:bg-success/90 absolute -top-1 -left-1 z-10 size-7 min-w-0 rounded-full p-0 text-white opacity-0 shadow-sm transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
|
|
290
|
-
onPress: () => editor.onVisibilityChange(tile.id, true),
|
|
291
|
-
children: /* @__PURE__ */ jsx(Add, {
|
|
292
|
-
"aria-hidden": "true",
|
|
293
|
-
className: "size-4"
|
|
294
|
-
})
|
|
295
|
-
}),
|
|
296
|
-
/* @__PURE__ */ jsx("p", {
|
|
297
|
-
className: "mt-2 min-w-0 truncate text-xs",
|
|
298
|
-
children: tile.label
|
|
299
|
-
})
|
|
300
|
-
]
|
|
301
|
-
}, tile.id);
|
|
294
|
+
var GalleryAvailable = ({ kind, isSearching, showPreview, category, available, availableGroups, itemFor, startDrag, finishDrag, blankWidget, addTile }) => {
|
|
295
|
+
const suggestionTile = (tile) => {
|
|
296
|
+
const item = itemFor(tile.id);
|
|
297
|
+
const isAdded = item?.visible === true;
|
|
298
|
+
const isCompactControl = kind === "controls" && tile.shape === "compact";
|
|
299
|
+
const size = kind === "controls" ? controlCenterStyles.gallerySuggestion({ span: controlSpan(tile.shape) }) : widgetStyles.gallerySuggestion({ size: widgetSize(tile.shape) });
|
|
300
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
301
|
+
"data-gallery-tile": tile.suggestionKey,
|
|
302
|
+
"data-control-span": kind === "controls" ? tile.shape : void 0,
|
|
303
|
+
"data-widget-size": kind === "widgets" ? tile.shape : void 0,
|
|
304
|
+
"data-added": isAdded || void 0,
|
|
305
|
+
draggable: item?.editable,
|
|
306
|
+
onDragStart: (event) => startDrag(event, tile.id, tile.suggestionShapes ? tile.shape : void 0),
|
|
307
|
+
onDragEnd: finishDrag,
|
|
308
|
+
className: `group relative min-w-0 justify-self-center transition-opacity ${kind === "widgets" ? "grid h-full grid-rows-[minmax(0,1fr)_auto] self-stretch" : ""} ${isAdded ? "opacity-50" : ""} ${size}`,
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ jsx("div", {
|
|
311
|
+
inert: true,
|
|
312
|
+
className: `pointer-events-none flex items-center justify-center [&>section]:w-full ${isCompactControl ? "mx-auto size-14 [&>button]:size-14" : "[&>button]:w-full"} ${kind === "widgets" ? "h-full min-h-24 [&>[data-widget-size]]:w-full" : ""}`,
|
|
313
|
+
children: kind === "widgets" ? tile.preview ?? blankWidget(tile) : tile.preview
|
|
314
|
+
}),
|
|
315
|
+
item?.editable && !item.visible && /* @__PURE__ */ jsx(Button, {
|
|
316
|
+
isIconOnly: true,
|
|
317
|
+
size: "sm",
|
|
318
|
+
variant: "ghost",
|
|
319
|
+
"aria-label": `Quick add ${tile.label}${tile.suggestionKey === tile.id ? "" : ` (${tile.shape})`}`,
|
|
320
|
+
className: "bg-success hover:bg-success/90 absolute -top-1 -left-1 z-10 size-6 min-w-0 rounded-full p-0 text-white opacity-0 shadow-sm transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
|
|
321
|
+
onPress: () => addTile(tile),
|
|
322
|
+
children: /* @__PURE__ */ jsx(Add, {
|
|
323
|
+
"aria-hidden": "true",
|
|
324
|
+
className: "size-3"
|
|
325
|
+
})
|
|
326
|
+
}),
|
|
327
|
+
/* @__PURE__ */ jsxs("div", {
|
|
328
|
+
className: "mt-2 min-w-0 text-center",
|
|
329
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
330
|
+
className: "truncate text-sm font-medium",
|
|
331
|
+
children: tile.label
|
|
332
|
+
}), kind === "widgets" && tile.description && /* @__PURE__ */ jsx("p", {
|
|
333
|
+
className: "text-muted mt-0.5 line-clamp-2 text-xs",
|
|
334
|
+
children: tile.description
|
|
335
|
+
})]
|
|
302
336
|
})
|
|
303
|
-
|
|
304
|
-
})
|
|
305
|
-
|
|
306
|
-
|
|
337
|
+
]
|
|
338
|
+
}, tile.suggestionKey);
|
|
339
|
+
};
|
|
340
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
341
|
+
"aria-label": `Available ${kind}`,
|
|
342
|
+
className: `${showPreview ? "hidden xl:flex" : "flex"} min-h-0 min-w-0 flex-1 flex-col p-4 md:p-6`,
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ jsx("h2", {
|
|
345
|
+
className: "mb-1 text-sm font-semibold",
|
|
346
|
+
children: isSearching ? "Search results" : category === "All" ? "Suggestions" : category
|
|
347
|
+
}),
|
|
348
|
+
/* @__PURE__ */ jsx("p", {
|
|
349
|
+
className: "text-muted mb-5 text-xs",
|
|
350
|
+
children: "Add or drag a tile into your preview. Changes save automatically."
|
|
351
|
+
}),
|
|
352
|
+
/* @__PURE__ */ jsxs("div", {
|
|
353
|
+
className: "min-h-0 flex-1 overflow-y-auto p-3",
|
|
354
|
+
children: [available.length === 0 && /* @__PURE__ */ jsxs("p", {
|
|
355
|
+
role: "status",
|
|
356
|
+
className: "text-muted py-8 text-sm",
|
|
357
|
+
children: [
|
|
358
|
+
"No ",
|
|
359
|
+
kind,
|
|
360
|
+
" found."
|
|
361
|
+
]
|
|
362
|
+
}), available.some((tile) => tile.suggestionShapes) ? /* @__PURE__ */ jsx("div", {
|
|
363
|
+
className: "flex flex-col gap-6",
|
|
364
|
+
children: availableGroups.map((group) => /* @__PURE__ */ jsxs("section", {
|
|
365
|
+
"aria-label": `${group.label} sizes`,
|
|
366
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
367
|
+
className: "text-sm font-light",
|
|
368
|
+
children: group.label
|
|
369
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
370
|
+
className: `mt-3 grid grid-cols-1 justify-items-center gap-x-8 gap-y-4 min-[600px]:grid-cols-2 min-[820px]:grid-cols-3 ${kind === "widgets" ? "items-stretch" : ""}`,
|
|
371
|
+
children: group.tiles.map(suggestionTile)
|
|
372
|
+
})]
|
|
373
|
+
}, group.id))
|
|
374
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
375
|
+
className: "grid grid-cols-2 items-start gap-4 sm:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5",
|
|
376
|
+
children: available.map(suggestionTile)
|
|
377
|
+
})]
|
|
378
|
+
})
|
|
379
|
+
]
|
|
380
|
+
});
|
|
381
|
+
};
|
|
307
382
|
var TileGallery = (props) => {
|
|
308
383
|
const context = {
|
|
309
384
|
...props,
|
|
@@ -316,7 +391,7 @@ var TileGallery = (props) => {
|
|
|
316
391
|
/* @__PURE__ */ jsx("span", {
|
|
317
392
|
id: dragInstructionsId,
|
|
318
393
|
className: "sr-only",
|
|
319
|
-
children: "Drag the tile to reorder
|
|
394
|
+
children: "Drag the tile to reorder or drop it anywhere in the preview. You can also focus it and use the arrow keys."
|
|
320
395
|
}),
|
|
321
396
|
/* @__PURE__ */ jsx("span", {
|
|
322
397
|
role: "status",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bookmarksData } from "./data.js";
|
|
1
|
+
import { bookmarksData, sampleFavorites } from "./data.js";
|
|
2
2
|
import { Bookmarks } from "./action.js";
|
|
3
3
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
4
|
//#region src/lib/store/useBookmarks/index.ts
|
|
@@ -26,4 +26,4 @@ var useBookmarks = {
|
|
|
26
26
|
actions: useBookmarksActions
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
|
-
export { useBookmarks };
|
|
29
|
+
export { bookmarksData, sampleFavorites, useBookmarks };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vezham/react",
|
|
3
|
-
"version": "26.0.0-
|
|
3
|
+
"version": "26.0.0-beta.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/vezham/vx-fe-pkgs.git",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
],
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@tanstack/react-hotkeys": "^0.10.0",
|
|
112
|
-
"@vezham/hooks": "26.0.0-
|
|
112
|
+
"@vezham/hooks": "26.0.0-beta.1",
|
|
113
113
|
"react-aria-components": "1.21.1"
|
|
114
114
|
}
|
|
115
115
|
}
|