@graphiql/plugin-collections 1.0.0-beta.1 → 1.0.0-beta.3

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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -6
  3. package/dist/components/collection-item-row.js +212 -282
  4. package/dist/components/collection-item-row.js.map +1 -1
  5. package/dist/components/collection-row.js +139 -159
  6. package/dist/components/collection-row.js.map +1 -1
  7. package/dist/components/collections-panel.js +408 -496
  8. package/dist/components/collections-panel.js.map +1 -1
  9. package/dist/components/conflict-dialog.js +148 -164
  10. package/dist/components/conflict-dialog.js.map +1 -1
  11. package/dist/components/export-dialog.js +52 -52
  12. package/dist/components/export-dialog.js.map +1 -1
  13. package/dist/components/import-dialog.js +100 -112
  14. package/dist/components/import-dialog.js.map +1 -1
  15. package/dist/components/save-dialog.js +116 -124
  16. package/dist/components/save-dialog.js.map +1 -1
  17. package/dist/components/session-actions.js +23 -31
  18. package/dist/components/session-actions.js.map +1 -1
  19. package/dist/icons/check.js +18 -9
  20. package/dist/icons/check.js.map +1 -1
  21. package/dist/icons/collections.js +16 -9
  22. package/dist/icons/collections.js.map +1 -1
  23. package/dist/icons/download.js +16 -9
  24. package/dist/icons/download.js.map +1 -1
  25. package/dist/icons/upload.js +16 -9
  26. package/dist/icons/upload.js.map +1 -1
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.js +32 -41
  29. package/dist/index.js.map +1 -1
  30. package/dist/operation-method.js +24 -24
  31. package/dist/operation-method.js.map +1 -1
  32. package/dist/storage/local-storage.js +32 -37
  33. package/dist/storage/local-storage.js.map +1 -1
  34. package/dist/storage/tab-links.js +27 -30
  35. package/dist/storage/tab-links.js.map +1 -1
  36. package/dist/store.js +365 -402
  37. package/dist/store.js.map +1 -1
  38. package/dist/style.css +6 -27
  39. package/dist/types.js +9 -8
  40. package/dist/types.js.map +1 -1
  41. package/dist/utility/uuid.js +11 -9
  42. package/dist/utility/uuid.js.map +1 -1
  43. package/package.json +19 -15
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) GraphQL Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -16,14 +16,14 @@ npm install react react-dom graphql @graphiql/react
16
16
 
17
17
  ## Usage
18
18
 
19
- The collections plugin is installed by default in GraphiQL, so an unmodified `<GraphiQL>` already shows a Collections rail icon. You only need to register it explicitly to configure it, for example to supply a custom storage backend or restrict what users can do.
19
+ The collections plugin is installed by default in GraphiQL, so an unmodified `<GraphiQL>` already shows a Collections rail icon. Use `COLLECTIONS_PLUGIN` when you pass a custom `plugins` array and want to keep the default collections configuration. Use `collectionsPlugin(options)` to supply a custom storage backend or restrict what users can do.
20
20
 
21
21
  > **Note:** passing the `plugins` prop replaces the default plugin set, so include the others you want alongside it.
22
22
 
23
23
  ```jsx
24
24
  import { GraphiQL } from 'graphiql';
25
25
  import { createTransport } from '@graphiql/toolkit';
26
- import { collectionsPlugin } from '@graphiql/plugin-collections';
26
+ import { COLLECTIONS_PLUGIN } from '@graphiql/plugin-collections';
27
27
  import 'graphiql/style.css';
28
28
  import '@graphiql/plugin-collections/style.css';
29
29
 
@@ -31,10 +31,8 @@ const transport = createTransport({
31
31
  url: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
32
32
  });
33
33
 
34
- const collections = collectionsPlugin();
35
-
36
34
  function GraphiQLWithCollections() {
37
- return <GraphiQL transport={transport} plugins={[collections]} />;
35
+ return <GraphiQL transport={transport} plugins={[COLLECTIONS_PLUGIN]} />;
38
36
  }
39
37
  ```
40
38
 
@@ -155,7 +153,8 @@ await actions.reload();
155
153
 
156
154
  ## Exports
157
155
 
158
- - `collectionsPlugin(options?)` — the plugin factory
156
+ - `COLLECTIONS_PLUGIN` — the default plugin configuration
157
+ - `collectionsPlugin(options?)` — the plugin factory for custom configuration
159
158
  - `collectionsStore`, `useCollectionsStore` — the store and its React hook
160
159
  - `createLocalStorageAdapter(key)`, `localStorageAdapter` — built-in storage
161
160
  - `CollectionsSaveDialog` — the save dialog component
@@ -1,286 +1,216 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState, useRef, useEffect } from "react";
3
- import { MethodPill, PenIcon, CopyIcon, TrashIcon } from "@graphiql/react";
4
1
  import { getDocumentMethod } from "../operation-method.js";
5
2
  import SvgUpload from "../icons/upload.js";
6
3
  import SvgCheck from "../icons/check.js";
7
- const CollectionItemRow = ({
8
- item,
9
- collectionId,
10
- index,
11
- readOnly = false,
12
- isGrabbed,
13
- onGrabToggle,
14
- onGrabMove,
15
- onGrabCancel,
16
- onOpen,
17
- onShare,
18
- onAnnounce,
19
- onDelete,
20
- onMove,
21
- onRenameItem
22
- }) => {
23
- const [isDragOver, setIsDragOver] = useState(false);
24
- const [isEditing, setIsEditing] = useState(false);
25
- const [confirmed, setConfirmed] = useState(null);
26
- const [confirmToken, setConfirmToken] = useState(0);
27
- const editFormRef = useRef(null);
28
- const [editName, setEditName] = useState(item.name);
29
- const [editDescription, setEditDescription] = useState(
30
- item.description ?? ""
31
- );
32
- const method = getDocumentMethod(item.query);
33
- const startEdit = (e) => {
34
- e.stopPropagation();
35
- setEditName(item.name);
36
- setEditDescription(item.description ?? "");
37
- setIsEditing(true);
38
- };
39
- useEffect(() => {
40
- if (!confirmed) {
41
- return;
42
- }
43
- const timer = setTimeout(() => setConfirmed(null), 1500);
44
- return () => clearTimeout(timer);
45
- }, [confirmed, confirmToken]);
46
- const runAction = async (kind, write, message, failureMessage) => {
47
- try {
48
- await write();
49
- onAnnounce(message);
50
- setConfirmed(kind);
51
- setConfirmToken((t) => t + 1);
52
- } catch {
53
- onAnnounce(failureMessage);
54
- }
55
- };
56
- const handleDelete = (e) => {
57
- e.stopPropagation();
58
- onDelete(collectionId, item.id);
59
- };
60
- const commitEdit = () => {
61
- const name = editName.trim() || item.name;
62
- onRenameItem(collectionId, item.id, {
63
- name,
64
- description: editDescription
65
- });
66
- setIsEditing(false);
67
- };
68
- const handleBlur = (e) => {
69
- var _a;
70
- if ((_a = editFormRef.current) == null ? void 0 : _a.contains(e.relatedTarget)) {
71
- return;
72
- }
73
- commitEdit();
74
- };
75
- const cancelEdit = () => {
76
- setEditName(item.name);
77
- setEditDescription(item.description ?? "");
78
- setIsEditing(false);
79
- };
80
- return /* @__PURE__ */ jsxs(
81
- "div",
82
- {
83
- className: `graphiql-collection-item-row${isDragOver ? " graphiql-collection-drop-target" : ""}`,
84
- "data-grabbed": isGrabbed || void 0,
85
- draggable: !readOnly && !isEditing,
86
- onDragStart: readOnly || isEditing ? void 0 : (e) => {
87
- e.dataTransfer.setData(
88
- "application/x-graphiql-item",
89
- JSON.stringify({ collectionId, index })
90
- );
91
- e.dataTransfer.effectAllowed = "move";
92
- },
93
- onDragOver: readOnly ? void 0 : (e) => {
94
- e.preventDefault();
95
- e.dataTransfer.dropEffect = "move";
96
- setIsDragOver(true);
97
- },
98
- onDragLeave: readOnly ? void 0 : () => setIsDragOver(false),
99
- onDrop: readOnly ? void 0 : (e) => {
100
- e.preventDefault();
101
- setIsDragOver(false);
102
- try {
103
- const data = JSON.parse(
104
- e.dataTransfer.getData("application/x-graphiql-item")
105
- );
106
- onMove(data.collectionId, data.index, collectionId, index);
107
- } catch {
108
- }
109
- },
110
- onClick: () => {
111
- if (!isEditing) {
112
- onOpen(item);
113
- }
114
- },
115
- children: [
116
- /* @__PURE__ */ jsx(
117
- "button",
118
- {
119
- type: "button",
120
- className: "graphiql-collection-drag-handle",
121
- "data-collection-drag-handle": item.id,
122
- "aria-label": `Reorder ${item.name}. Press space to grab, arrow keys to move, escape to cancel.`,
123
- "aria-pressed": isGrabbed,
124
- disabled: readOnly,
125
- onClick: (e) => e.stopPropagation(),
126
- onKeyDown: (e) => {
127
- if (e.key === " " || e.key === "Enter") {
128
- e.preventDefault();
129
- e.stopPropagation();
130
- onGrabToggle();
131
- } else if (isGrabbed && e.key === "ArrowDown") {
132
- e.preventDefault();
133
- e.stopPropagation();
134
- onGrabMove("down");
135
- } else if (isGrabbed && e.key === "ArrowUp") {
136
- e.preventDefault();
137
- e.stopPropagation();
138
- onGrabMove("up");
139
- } else if (isGrabbed && e.key === "Escape") {
140
- e.preventDefault();
141
- e.stopPropagation();
142
- onGrabCancel();
143
- }
144
- },
145
- children: "⠿"
146
- }
147
- ),
148
- method === "mix" ? /* @__PURE__ */ jsx(
149
- "span",
150
- {
151
- className: "graphiql-method-pill graphiql-collection-method-pill-mix",
152
- "aria-hidden": true,
153
- children: "MIX"
154
- }
155
- ) : /* @__PURE__ */ jsx(MethodPill, { operation: method, "aria-hidden": true }),
156
- isEditing ? /* @__PURE__ */ jsxs(
157
- "div",
158
- {
159
- ref: editFormRef,
160
- className: "graphiql-collection-item-edit-form",
161
- onClick: (e) => e.stopPropagation(),
162
- children: [
163
- /* @__PURE__ */ jsx(
164
- "input",
165
- {
166
- className: "graphiql-collection-item-edit-input",
167
- value: editName,
168
- autoFocus: true,
169
- placeholder: item.name,
170
- onChange: (e) => setEditName(e.target.value),
171
- onBlur: handleBlur,
172
- onKeyDown: (e) => {
173
- if (e.key === "Enter") {
174
- commitEdit();
175
- }
176
- if (e.key === "Escape") {
177
- cancelEdit();
178
- }
179
- e.stopPropagation();
180
- }
181
- }
182
- ),
183
- /* @__PURE__ */ jsx(
184
- "input",
185
- {
186
- className: "graphiql-collection-item-edit-input",
187
- value: editDescription,
188
- placeholder: "Description (optional)",
189
- onChange: (e) => setEditDescription(e.target.value),
190
- onBlur: handleBlur,
191
- onKeyDown: (e) => {
192
- if (e.key === "Enter") {
193
- commitEdit();
194
- }
195
- if (e.key === "Escape") {
196
- cancelEdit();
197
- }
198
- e.stopPropagation();
199
- }
200
- }
201
- )
202
- ]
203
- }
204
- ) : /* @__PURE__ */ jsxs("div", { className: "graphiql-collection-item-main", children: [
205
- /* @__PURE__ */ jsx("span", { className: "graphiql-collection-item-name", title: item.name, children: item.name }),
206
- item.description && /* @__PURE__ */ jsx(
207
- "span",
208
- {
209
- className: "graphiql-collection-item-description",
210
- title: item.description,
211
- children: item.description
212
- }
213
- )
214
- ] }),
215
- !isEditing && /* @__PURE__ */ jsxs("div", { className: "graphiql-collection-item-actions", children: [
216
- !readOnly && /* @__PURE__ */ jsx(
217
- "button",
218
- {
219
- type: "button",
220
- className: "graphiql-collection-item-action",
221
- "aria-label": `Rename ${item.name}`,
222
- title: "Rename",
223
- onClick: startEdit,
224
- children: /* @__PURE__ */ jsx(PenIcon, { "aria-hidden": "true" })
225
- }
226
- ),
227
- /* @__PURE__ */ jsx(
228
- "button",
229
- {
230
- type: "button",
231
- className: "graphiql-collection-item-action",
232
- "aria-label": `Copy operation ${item.name}`,
233
- title: "Copy operation",
234
- "data-confirmed": confirmed === "copy" || void 0,
235
- onClick: (e) => {
236
- e.stopPropagation();
237
- void runAction(
238
- "copy",
239
- () => navigator.clipboard.writeText(item.query),
240
- "Copied query to clipboard.",
241
- "Could not copy to clipboard."
242
- );
243
- },
244
- children: confirmed === "copy" ? /* @__PURE__ */ jsx(SvgCheck, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(CopyIcon, { "aria-hidden": "true" })
245
- }
246
- ),
247
- /* @__PURE__ */ jsx(
248
- "button",
249
- {
250
- type: "button",
251
- className: "graphiql-collection-item-action",
252
- "aria-label": `Share ${item.name} as collection`,
253
- title: "Share as collection",
254
- "data-confirmed": confirmed === "share" || void 0,
255
- onClick: (e) => {
256
- e.stopPropagation();
257
- void runAction(
258
- "share",
259
- () => onShare(item.id),
260
- "Shared operation to clipboard.",
261
- "Could not share to clipboard."
262
- );
263
- },
264
- children: confirmed === "share" ? /* @__PURE__ */ jsx(SvgCheck, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(SvgUpload, { "aria-hidden": "true" })
265
- }
266
- ),
267
- !readOnly && /* @__PURE__ */ jsx(
268
- "button",
269
- {
270
- type: "button",
271
- className: "graphiql-collection-item-action",
272
- "aria-label": `Delete ${item.name}`,
273
- title: "Delete",
274
- onClick: handleDelete,
275
- children: /* @__PURE__ */ jsx(TrashIcon, { "aria-hidden": "true" })
276
- }
277
- )
278
- ] })
279
- ]
280
- }
281
- );
4
+ import { useEffect, useRef, useState } from "react";
5
+ import { CopyIcon, MethodPill, PenIcon, TrashIcon } from "@graphiql/react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/collection-item-row.tsx
8
+ var CollectionItemRow = ({ item, collectionId, index, readOnly = false, isGrabbed, onGrabToggle, onGrabMove, onGrabCancel, onOpen, onShare, onAnnounce, onDelete, onMove, onRenameItem }) => {
9
+ const [isDragOver, setIsDragOver] = useState(false);
10
+ const [isEditing, setIsEditing] = useState(false);
11
+ const [confirmed, setConfirmed] = useState(null);
12
+ const [confirmToken, setConfirmToken] = useState(0);
13
+ const editFormRef = useRef(null);
14
+ const [editName, setEditName] = useState(item.name);
15
+ const [editDescription, setEditDescription] = useState(item.description ?? "");
16
+ const method = getDocumentMethod(item.query);
17
+ const startEdit = (e) => {
18
+ e.stopPropagation();
19
+ setEditName(item.name);
20
+ setEditDescription(item.description ?? "");
21
+ setIsEditing(true);
22
+ };
23
+ useEffect(() => {
24
+ if (!confirmed) return;
25
+ const timer = setTimeout(() => setConfirmed(null), 1500);
26
+ return () => clearTimeout(timer);
27
+ }, [confirmed, confirmToken]);
28
+ const runAction = async (kind, write, message, failureMessage) => {
29
+ try {
30
+ await write();
31
+ onAnnounce(message);
32
+ setConfirmed(kind);
33
+ setConfirmToken((t) => t + 1);
34
+ } catch {
35
+ onAnnounce(failureMessage);
36
+ }
37
+ };
38
+ const handleDelete = (e) => {
39
+ e.stopPropagation();
40
+ onDelete(collectionId, item.id);
41
+ };
42
+ const commitEdit = () => {
43
+ const name = editName.trim() || item.name;
44
+ onRenameItem(collectionId, item.id, {
45
+ name,
46
+ description: editDescription
47
+ });
48
+ setIsEditing(false);
49
+ };
50
+ const handleBlur = (e) => {
51
+ if (editFormRef.current?.contains(e.relatedTarget)) return;
52
+ commitEdit();
53
+ };
54
+ const cancelEdit = () => {
55
+ setEditName(item.name);
56
+ setEditDescription(item.description ?? "");
57
+ setIsEditing(false);
58
+ };
59
+ return /* @__PURE__ */ jsxs("div", {
60
+ className: `graphiql-collection-item-row${isDragOver ? " graphiql-collection-drop-target" : ""}`,
61
+ "data-grabbed": isGrabbed || void 0,
62
+ draggable: !readOnly && !isEditing,
63
+ onDragStart: readOnly || isEditing ? void 0 : (e) => {
64
+ e.dataTransfer.setData("application/x-graphiql-item", JSON.stringify({
65
+ collectionId,
66
+ index
67
+ }));
68
+ e.dataTransfer.effectAllowed = "move";
69
+ },
70
+ onDragOver: readOnly ? void 0 : (e) => {
71
+ e.preventDefault();
72
+ e.dataTransfer.dropEffect = "move";
73
+ setIsDragOver(true);
74
+ },
75
+ onDragLeave: readOnly ? void 0 : () => setIsDragOver(false),
76
+ onDrop: readOnly ? void 0 : (e) => {
77
+ e.preventDefault();
78
+ setIsDragOver(false);
79
+ try {
80
+ const data = JSON.parse(e.dataTransfer.getData("application/x-graphiql-item"));
81
+ onMove(data.collectionId, data.index, collectionId, index);
82
+ } catch {}
83
+ },
84
+ onClick: () => {
85
+ if (!isEditing) onOpen(item);
86
+ },
87
+ children: [
88
+ /* @__PURE__ */ jsx("button", {
89
+ type: "button",
90
+ className: "graphiql-collection-drag-handle",
91
+ "data-collection-drag-handle": item.id,
92
+ "aria-label": `Reorder ${item.name}. Press space to grab, arrow keys to move, escape to cancel.`,
93
+ "aria-pressed": isGrabbed,
94
+ disabled: readOnly,
95
+ onClick: (e) => e.stopPropagation(),
96
+ onKeyDown: (e) => {
97
+ if (e.key === " " || e.key === "Enter") {
98
+ e.preventDefault();
99
+ e.stopPropagation();
100
+ onGrabToggle();
101
+ } else if (isGrabbed && e.key === "ArrowDown") {
102
+ e.preventDefault();
103
+ e.stopPropagation();
104
+ onGrabMove("down");
105
+ } else if (isGrabbed && e.key === "ArrowUp") {
106
+ e.preventDefault();
107
+ e.stopPropagation();
108
+ onGrabMove("up");
109
+ } else if (isGrabbed && e.key === "Escape") {
110
+ e.preventDefault();
111
+ e.stopPropagation();
112
+ onGrabCancel();
113
+ }
114
+ },
115
+ children: "⠿"
116
+ }),
117
+ method === "mix" ? /* @__PURE__ */ jsx("span", {
118
+ className: "graphiql-method-pill graphiql-collection-method-pill-mix",
119
+ "aria-hidden": true,
120
+ children: "MIX"
121
+ }) : /* @__PURE__ */ jsx(MethodPill, {
122
+ operation: method,
123
+ "aria-hidden": true
124
+ }),
125
+ isEditing ? /* @__PURE__ */ jsxs("div", {
126
+ ref: editFormRef,
127
+ className: "graphiql-collection-item-edit-form",
128
+ onClick: (e) => e.stopPropagation(),
129
+ children: [/* @__PURE__ */ jsx("input", {
130
+ className: "graphiql-collection-item-edit-input",
131
+ value: editName,
132
+ autoFocus: true,
133
+ placeholder: item.name,
134
+ onChange: (e) => setEditName(e.target.value),
135
+ onBlur: handleBlur,
136
+ onKeyDown: (e) => {
137
+ if (e.key === "Enter") commitEdit();
138
+ if (e.key === "Escape") cancelEdit();
139
+ e.stopPropagation();
140
+ }
141
+ }), /* @__PURE__ */ jsx("input", {
142
+ className: "graphiql-collection-item-edit-input",
143
+ value: editDescription,
144
+ placeholder: "Description (optional)",
145
+ onChange: (e) => setEditDescription(e.target.value),
146
+ onBlur: handleBlur,
147
+ onKeyDown: (e) => {
148
+ if (e.key === "Enter") commitEdit();
149
+ if (e.key === "Escape") cancelEdit();
150
+ e.stopPropagation();
151
+ }
152
+ })]
153
+ }) : /* @__PURE__ */ jsxs("div", {
154
+ className: "graphiql-collection-item-main",
155
+ children: [/* @__PURE__ */ jsx("span", {
156
+ className: "graphiql-collection-item-name",
157
+ title: item.name,
158
+ children: item.name
159
+ }), item.description && /* @__PURE__ */ jsx("span", {
160
+ className: "graphiql-collection-item-description",
161
+ title: item.description,
162
+ children: item.description
163
+ })]
164
+ }),
165
+ !isEditing && /* @__PURE__ */ jsxs("div", {
166
+ className: "graphiql-collection-item-actions",
167
+ children: [
168
+ !readOnly && /* @__PURE__ */ jsx("button", {
169
+ type: "button",
170
+ className: "graphiql-collection-item-action",
171
+ "aria-label": `Rename ${item.name}`,
172
+ title: "Rename",
173
+ onClick: startEdit,
174
+ children: /* @__PURE__ */ jsx(PenIcon, { "aria-hidden": "true" })
175
+ }),
176
+ /* @__PURE__ */ jsx("button", {
177
+ type: "button",
178
+ className: "graphiql-collection-item-action",
179
+ "aria-label": `Copy operation ${item.name}`,
180
+ title: "Copy operation",
181
+ "data-confirmed": confirmed === "copy" || void 0,
182
+ onClick: (e) => {
183
+ e.stopPropagation();
184
+ runAction("copy", () => navigator.clipboard.writeText(item.query), "Copied query to clipboard.", "Could not copy to clipboard.");
185
+ },
186
+ children: confirmed === "copy" ? /* @__PURE__ */ jsx(SvgCheck, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(CopyIcon, { "aria-hidden": "true" })
187
+ }),
188
+ /* @__PURE__ */ jsx("button", {
189
+ type: "button",
190
+ className: "graphiql-collection-item-action",
191
+ "aria-label": `Share ${item.name} as collection`,
192
+ title: "Share as collection",
193
+ "data-confirmed": confirmed === "share" || void 0,
194
+ onClick: (e) => {
195
+ e.stopPropagation();
196
+ runAction("share", () => onShare(item.id), "Shared operation to clipboard.", "Could not share to clipboard.");
197
+ },
198
+ children: confirmed === "share" ? /* @__PURE__ */ jsx(SvgCheck, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(SvgUpload, { "aria-hidden": "true" })
199
+ }),
200
+ !readOnly && /* @__PURE__ */ jsx("button", {
201
+ type: "button",
202
+ className: "graphiql-collection-item-action",
203
+ "aria-label": `Delete ${item.name}`,
204
+ title: "Delete",
205
+ onClick: handleDelete,
206
+ children: /* @__PURE__ */ jsx(TrashIcon, { "aria-hidden": "true" })
207
+ })
208
+ ]
209
+ })
210
+ ]
211
+ });
282
212
  };
283
- export {
284
- CollectionItemRow
285
- };
286
- //# sourceMappingURL=collection-item-row.js.map
213
+ //#endregion
214
+ export { CollectionItemRow };
215
+
216
+ //# sourceMappingURL=collection-item-row.js.map