@bettercms-ai/kit 3.0.2 → 3.1.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/dist/brand/logo.js +18 -67
- package/dist/brand/logo.js.map +1 -1
- package/dist/context.js +3 -8
- package/dist/context.js.map +1 -1
- package/dist/controls/button.js +134 -451
- package/dist/controls/button.js.map +1 -1
- package/dist/controls/choice.js +95 -336
- package/dist/controls/choice.js.map +1 -1
- package/dist/controls/code.js +72 -245
- package/dist/controls/code.js.map +1 -1
- package/dist/controls/color.js +31 -108
- package/dist/controls/color.js.map +1 -1
- package/dist/controls/date.js +83 -268
- package/dist/controls/date.js.map +1 -1
- package/dist/controls/form-picker.js +9 -26
- package/dist/controls/form-picker.js.map +1 -1
- package/dist/controls/icon.js +100 -341
- package/dist/controls/icon.js.map +1 -1
- package/dist/controls/json.js +7 -20
- package/dist/controls/json.js.map +1 -1
- package/dist/controls/link.js +156 -561
- package/dist/controls/link.js.map +1 -1
- package/dist/controls/location.js +35 -124
- package/dist/controls/location.js.map +1 -1
- package/dist/controls/media.js +267 -928
- package/dist/controls/media.js.map +1 -1
- package/dist/controls/number.js +23 -80
- package/dist/controls/number.js.map +1 -1
- package/dist/controls/reference.js +155 -516
- package/dist/controls/reference.js.map +1 -1
- package/dist/controls/rich-text/article-shell.js +86 -327
- package/dist/controls/rich-text/article-shell.js.map +1 -1
- package/dist/controls/rich-text/author.js +21 -78
- package/dist/controls/rich-text/author.js.map +1 -1
- package/dist/controls/rich-text/blocks.js +317 -1086
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/button.js +10 -31
- package/dist/controls/rich-text/button.js.map +1 -1
- package/dist/controls/rich-text/catalog.js +51 -168
- package/dist/controls/rich-text/catalog.js.map +1 -1
- package/dist/controls/rich-text/columns.js +31 -104
- package/dist/controls/rich-text/columns.js.map +1 -1
- package/dist/controls/rich-text/component-card.js +209 -790
- package/dist/controls/rich-text/component-card.js.map +1 -1
- package/dist/controls/rich-text/component-panel.js +40 -102
- package/dist/controls/rich-text/component-panel.js.map +1 -1
- package/dist/controls/rich-text/control.js +32 -101
- package/dist/controls/rich-text/control.js.map +1 -1
- package/dist/controls/rich-text/editor.js +108 -369
- package/dist/controls/rich-text/editor.js.map +1 -1
- package/dist/controls/rich-text/embed.js +51 -184
- package/dist/controls/rich-text/embed.js.map +1 -1
- package/dist/controls/rich-text/floating.js +42 -171
- package/dist/controls/rich-text/floating.js.map +1 -1
- package/dist/controls/rich-text/footnote.js +28 -89
- package/dist/controls/rich-text/footnote.js.map +1 -1
- package/dist/controls/rich-text/gallery.js +27 -88
- package/dist/controls/rich-text/gallery.js.map +1 -1
- package/dist/controls/rich-text/link-form.d.ts +10 -0
- package/dist/controls/rich-text/link-form.js +16 -204
- package/dist/controls/rich-text/link-form.js.map +1 -1
- package/dist/controls/rich-text/plain.js +3 -8
- package/dist/controls/rich-text/plain.js.map +1 -1
- package/dist/controls/rich-text/related.js +25 -86
- package/dist/controls/rich-text/related.js.map +1 -1
- package/dist/controls/rich-text/toc.js +15 -48
- package/dist/controls/rich-text/toc.js.map +1 -1
- package/dist/controls/rich-text/toolbar.js +105 -402
- package/dist/controls/rich-text/toolbar.js.map +1 -1
- package/dist/controls/scale.js +52 -169
- package/dist/controls/scale.js.map +1 -1
- package/dist/controls/slot.js +73 -238
- package/dist/controls/slot.js.map +1 -1
- package/dist/controls/table/table-editor.js +500 -1766
- package/dist/controls/table/table-editor.js.map +1 -1
- package/dist/controls/table/table-link.js +41 -121
- package/dist/controls/table/table-link.js.map +1 -1
- package/dist/controls/table/table.js +9 -26
- package/dist/controls/table/table.js.map +1 -1
- package/dist/controls/text.js +68 -221
- package/dist/controls/text.js.map +1 -1
- package/dist/controls/unknown-value.js +22 -79
- package/dist/controls/unknown-value.js.map +1 -1
- package/dist/engine/array.js +228 -821
- package/dist/engine/array.js.map +1 -1
- package/dist/engine/bits.js +13 -38
- package/dist/engine/bits.js.map +1 -1
- package/dist/engine/breadcrumb.js +8 -25
- package/dist/engine/breadcrumb.js.map +1 -1
- package/dist/engine/expand.js +13 -38
- package/dist/engine/expand.js.map +1 -1
- package/dist/engine/field-list.js +5 -14
- package/dist/engine/field-list.js.map +1 -1
- package/dist/engine/field-shell.js +244 -849
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.js +78 -275
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/grouping.js +193 -630
- package/dist/engine/grouping.js.map +1 -1
- package/dist/engine/item-list.js +50 -187
- package/dist/engine/item-list.js.map +1 -1
- package/dist/engine/kit-field.js +95 -320
- package/dist/engine/kit-field.js.map +1 -1
- package/dist/engine/schema-form.js +32 -101
- package/dist/engine/schema-form.js.map +1 -1
- package/dist/engine/slot.js +45 -146
- package/dist/engine/slot.js.map +1 -1
- package/dist/lib/icons.js +5 -14
- package/dist/lib/icons.js.map +1 -1
- package/dist/styles.css +1 -5821
- package/dist/table/table-view.js +16 -49
- package/dist/table/table-view.js.map +1 -1
- package/dist/testing/test-form.js +5 -14
- package/dist/testing/test-form.js.map +1 -1
- package/dist/theme.js +3 -8
- package/dist/theme.js.map +1 -1
- package/dist/ui/action-tray.js +24 -97
- package/dist/ui/action-tray.js.map +1 -1
- package/dist/ui/autocomplete.js +38 -135
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/button.js +31 -108
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/choice-switch.js +5 -14
- package/dist/ui/choice-switch.js.map +1 -1
- package/dist/ui/controls.js +86 -279
- package/dist/ui/controls.js.map +1 -1
- package/dist/ui/display.js +116 -401
- package/dist/ui/display.js.map +1 -1
- package/dist/ui/expanded-editor-modal.js +27 -100
- package/dist/ui/expanded-editor-modal.js.map +1 -1
- package/dist/ui/floating-panel.js +37 -130
- package/dist/ui/floating-panel.js.map +1 -1
- package/dist/ui/input.js +59 -196
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/mode-bar.js +11 -32
- package/dist/ui/mode-bar.js.map +1 -1
- package/dist/ui/overlay.js +176 -613
- package/dist/ui/overlay.js.map +1 -1
- package/dist/ui/path-crumbs.js +113 -374
- package/dist/ui/path-crumbs.js.map +1 -1
- package/dist/ui/select.js +78 -311
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/shortcut-hint.js +6 -19
- package/dist/ui/shortcut-hint.js.map +1 -1
- package/dist/ui/spinner.js +7 -20
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/split-button.js +10 -35
- package/dist/ui/split-button.js.map +1 -1
- package/dist/ui/tab.js +17 -50
- package/dist/ui/tab.js.map +1 -1
- package/dist/ui/toast.js +30 -107
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/tooltip-root.js +7 -24
- package/dist/ui/tooltip-root.js.map +1 -1
- package/package.json +2 -2
package/dist/controls/media.js
CHANGED
|
@@ -12,7 +12,7 @@ import { Input, Textarea } from "../ui/input.js";
|
|
|
12
12
|
import { Select } from "../ui/select.js";
|
|
13
13
|
import { useDragReorder } from "../engine/item-list.js";
|
|
14
14
|
import * as React from "react";
|
|
15
|
-
import { Fragment,
|
|
15
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
16
16
|
import { IconAlertTriangle, IconCrop, IconDots, IconDownload, IconExternalLink, IconFileText, IconFocusCentered, IconLink, IconPhoto, IconPlayerPlay, IconPlus, IconRefresh, IconReplace, IconTrash, IconUpload, IconVideo, IconWorld, IconX } from "@tabler/icons-react";
|
|
17
17
|
//#region src/controls/media.tsx
|
|
18
18
|
/**
|
|
@@ -36,7 +36,6 @@ import { IconAlertTriangle, IconCrop, IconDots, IconDownload, IconExternalLink,
|
|
|
36
36
|
* - a typed video URL is held as a draft until it is one prod stores (http(s) or a site path), so the dock never
|
|
37
37
|
* refuses a half-typed address.
|
|
38
38
|
*/
|
|
39
|
-
var _jsxFileName = "D:/Github/bettercms/bettercms-backend/packages/kit/src/controls/media.tsx";
|
|
40
39
|
var fileNameFromUrl = (url) => {
|
|
41
40
|
const inline = /^data:image\/([a-z0-9.+-]+)/i.exec(url.trim());
|
|
42
41
|
if (inline) return `Embedded ${inline[1].replace(/\+xml$/i, "").replace(/^jpeg$/i, "jpg").toUpperCase()} image`;
|
|
@@ -91,11 +90,7 @@ function acceptsFile(accept, file) {
|
|
|
91
90
|
}
|
|
92
91
|
function MediaPicker(p) {
|
|
93
92
|
const Picker = useKitServices().MediaPicker;
|
|
94
|
-
return Picker ? /* @__PURE__ */
|
|
95
|
-
fileName: _jsxFileName,
|
|
96
|
-
lineNumber: 136,
|
|
97
|
-
columnNumber: 19
|
|
98
|
-
}, this) : null;
|
|
93
|
+
return Picker ? /* @__PURE__ */ jsx(Picker, { ...p }) : null;
|
|
99
94
|
}
|
|
100
95
|
/**
|
|
101
96
|
* Upload through the host's media library: progress while it runs, the assets handed to `onDone`, and a named reason
|
|
@@ -138,15 +133,11 @@ function useUpload(accept, kind, onDone) {
|
|
|
138
133
|
}
|
|
139
134
|
/** A line under a control that says why something did not happen (role="alert": it is the answer to an action). */
|
|
140
135
|
function Reason({ children, tone = "danger" }) {
|
|
141
|
-
return /* @__PURE__ */
|
|
136
|
+
return /* @__PURE__ */ jsx("p", {
|
|
142
137
|
role: tone === "danger" ? "alert" : "note",
|
|
143
138
|
className: cn("text-kit-xs", tone === "danger" ? "text-kit-danger-fg" : "text-kit-fg-3"),
|
|
144
139
|
children
|
|
145
|
-
}
|
|
146
|
-
fileName: _jsxFileName,
|
|
147
|
-
lineNumber: 185,
|
|
148
|
-
columnNumber: 5
|
|
149
|
-
}, this);
|
|
140
|
+
});
|
|
150
141
|
}
|
|
151
142
|
function DropWell({ id, title, hint, accept, multiple, icon, disabled, onFiles, onLibrary, onUrl, refuse, progress }) {
|
|
152
143
|
const [over, setOver] = React.useState(false);
|
|
@@ -157,7 +148,7 @@ function DropWell({ id, title, hint, accept, multiple, icon, disabled, onFiles,
|
|
|
157
148
|
const takesFiles = (!!onFiles || !!refuse) && !disabled;
|
|
158
149
|
const files = (f) => onFiles ? onFiles(f) : refuse?.(NO_UPLOAD);
|
|
159
150
|
const pickFiles = () => onFiles ? input.current?.click() : refuse?.(NO_UPLOAD);
|
|
160
|
-
return /* @__PURE__ */
|
|
151
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
161
152
|
id,
|
|
162
153
|
tabIndex: disabled ? -1 : 0,
|
|
163
154
|
role: "group",
|
|
@@ -192,34 +183,18 @@ function DropWell({ id, title, hint, accept, multiple, icon, disabled, onFiles,
|
|
|
192
183
|
"data-slot": "kit-drop-well",
|
|
193
184
|
className: cn("relative flex flex-col items-center gap-2.5 rounded-kit-lg border border-dashed px-4 py-5 text-center transition-colors", over ? "border-kit-accent bg-kit-accent-softer" : "border-kit-line-strong bg-kit-subtle hover:border-kit-field-border-hover"),
|
|
194
185
|
children: [
|
|
195
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ jsx("span", {
|
|
196
187
|
className: cn("flex size-9 items-center justify-center rounded-kit-lg border border-kit-line bg-kit-control-bg text-kit-fg-3 [&_svg]:size-[18px]", over && "text-kit-accent-fg"),
|
|
197
188
|
children: icon
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
lineNumber: 271,
|
|
201
|
-
columnNumber: 7
|
|
202
|
-
}, this),
|
|
203
|
-
/* @__PURE__ */ jsxDEV("div", { children: [/* @__PURE__ */ jsxDEV("div", {
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
|
|
204
191
|
className: "text-kit-sm font-medium text-kit-fg",
|
|
205
192
|
children: over ? "Drop to upload" : title
|
|
206
|
-
},
|
|
207
|
-
fileName: _jsxFileName,
|
|
208
|
-
lineNumber: 273,
|
|
209
|
-
columnNumber: 9
|
|
210
|
-
}, this), takesFiles ? /* @__PURE__ */ jsxDEV("div", {
|
|
193
|
+
}), takesFiles ? /* @__PURE__ */ jsx("div", {
|
|
211
194
|
className: "text-kit-xs text-kit-fg-3",
|
|
212
195
|
children: hint
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
lineNumber: 274,
|
|
216
|
-
columnNumber: 23
|
|
217
|
-
}, this) : null] }, void 0, true, {
|
|
218
|
-
fileName: _jsxFileName,
|
|
219
|
-
lineNumber: 272,
|
|
220
|
-
columnNumber: 7
|
|
221
|
-
}, this),
|
|
222
|
-
urlMode && onUrl ? /* @__PURE__ */ jsxDEV(Fragment, { children: [/* @__PURE__ */ jsxDEV("form", {
|
|
196
|
+
}) : null] }),
|
|
197
|
+
urlMode && onUrl ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("form", {
|
|
223
198
|
className: "flex w-full max-w-sm items-center gap-1.5",
|
|
224
199
|
onSubmit: (e) => {
|
|
225
200
|
e.preventDefault();
|
|
@@ -239,7 +214,7 @@ function DropWell({ id, title, hint, accept, multiple, icon, disabled, onFiles,
|
|
|
239
214
|
setUrlError(null);
|
|
240
215
|
}
|
|
241
216
|
},
|
|
242
|
-
children: [/* @__PURE__ */
|
|
217
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
243
218
|
autoFocus: true,
|
|
244
219
|
size: "sm",
|
|
245
220
|
value: url,
|
|
@@ -247,85 +222,41 @@ function DropWell({ id, title, hint, accept, multiple, icon, disabled, onFiles,
|
|
|
247
222
|
"aria-invalid": urlError ? true : void 0,
|
|
248
223
|
onChange: (e) => setUrl(e.target.value),
|
|
249
224
|
placeholder: "https://…/photo.jpg",
|
|
250
|
-
leading: /* @__PURE__ */
|
|
251
|
-
|
|
252
|
-
lineNumber: 307,
|
|
253
|
-
columnNumber: 24
|
|
254
|
-
}, this)
|
|
255
|
-
}, void 0, false, {
|
|
256
|
-
fileName: _jsxFileName,
|
|
257
|
-
lineNumber: 299,
|
|
258
|
-
columnNumber: 13
|
|
259
|
-
}, this), /* @__PURE__ */ jsxDEV(Button, {
|
|
225
|
+
leading: /* @__PURE__ */ jsx(IconLink, { stroke: 1.5 })
|
|
226
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
260
227
|
size: "sm",
|
|
261
228
|
type: "submit",
|
|
262
229
|
variant: "primary",
|
|
263
230
|
children: "Add"
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
lineNumber: 309,
|
|
267
|
-
columnNumber: 13
|
|
268
|
-
}, this)]
|
|
269
|
-
}, void 0, true, {
|
|
270
|
-
fileName: _jsxFileName,
|
|
271
|
-
lineNumber: 278,
|
|
272
|
-
columnNumber: 11
|
|
273
|
-
}, this), urlError ? /* @__PURE__ */ jsxDEV(Reason, { children: urlError }, void 0, false, {
|
|
274
|
-
fileName: _jsxFileName,
|
|
275
|
-
lineNumber: 314,
|
|
276
|
-
columnNumber: 23
|
|
277
|
-
}, this) : null] }, void 0, true, {
|
|
278
|
-
fileName: _jsxFileName,
|
|
279
|
-
lineNumber: 277,
|
|
280
|
-
columnNumber: 9
|
|
281
|
-
}, this) : /* @__PURE__ */ jsxDEV("div", {
|
|
231
|
+
})]
|
|
232
|
+
}), urlError ? /* @__PURE__ */ jsx(Reason, { children: urlError }) : null] }) : /* @__PURE__ */ jsxs("div", {
|
|
282
233
|
className: "flex flex-wrap justify-center gap-1.5",
|
|
283
234
|
children: [
|
|
284
|
-
onLibrary || refuse ? /* @__PURE__ */
|
|
235
|
+
onLibrary || refuse ? /* @__PURE__ */ jsx(Button, {
|
|
285
236
|
size: "sm",
|
|
286
237
|
variant: "secondary",
|
|
287
238
|
onClick: onLibrary ?? (() => refuse(NO_LIBRARY)),
|
|
288
239
|
disabled,
|
|
289
240
|
children: "Media library"
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
lineNumber: 319,
|
|
293
|
-
columnNumber: 13
|
|
294
|
-
}, this) : null,
|
|
295
|
-
onFiles || refuse ? /* @__PURE__ */ jsxDEV(Button, {
|
|
241
|
+
}) : null,
|
|
242
|
+
onFiles || refuse ? /* @__PURE__ */ jsx(Button, {
|
|
296
243
|
size: "sm",
|
|
297
244
|
variant: "ghost",
|
|
298
|
-
leftIcon: /* @__PURE__ */
|
|
299
|
-
fileName: _jsxFileName,
|
|
300
|
-
lineNumber: 324,
|
|
301
|
-
columnNumber: 57
|
|
302
|
-
}, this),
|
|
245
|
+
leftIcon: /* @__PURE__ */ jsx(IconUpload, { stroke: 1.5 }),
|
|
303
246
|
onClick: pickFiles,
|
|
304
247
|
disabled,
|
|
305
248
|
children: "Upload"
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
lineNumber: 324,
|
|
309
|
-
columnNumber: 13
|
|
310
|
-
}, this) : null,
|
|
311
|
-
onUrl ? /* @__PURE__ */ jsxDEV(Button, {
|
|
249
|
+
}) : null,
|
|
250
|
+
onUrl ? /* @__PURE__ */ jsx(Button, {
|
|
312
251
|
size: "sm",
|
|
313
252
|
variant: "ghost",
|
|
314
253
|
onClick: () => setUrlMode(true),
|
|
315
254
|
disabled,
|
|
316
255
|
children: "Paste URL"
|
|
317
|
-
}
|
|
318
|
-
fileName: _jsxFileName,
|
|
319
|
-
lineNumber: 329,
|
|
320
|
-
columnNumber: 13
|
|
321
|
-
}, this) : null
|
|
256
|
+
}) : null
|
|
322
257
|
]
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
lineNumber: 317,
|
|
326
|
-
columnNumber: 9
|
|
327
|
-
}, this),
|
|
328
|
-
onFiles ? /* @__PURE__ */ jsxDEV("input", {
|
|
258
|
+
}),
|
|
259
|
+
onFiles ? /* @__PURE__ */ jsx("input", {
|
|
329
260
|
ref: input,
|
|
330
261
|
type: "file",
|
|
331
262
|
hidden: true,
|
|
@@ -337,53 +268,29 @@ function DropWell({ id, title, hint, accept, multiple, icon, disabled, onFiles,
|
|
|
337
268
|
onFiles(Array.from(e.target.files ?? []));
|
|
338
269
|
e.target.value = "";
|
|
339
270
|
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
lineNumber: 336,
|
|
343
|
-
columnNumber: 9
|
|
344
|
-
}, this) : null,
|
|
345
|
-
progress != null ? /* @__PURE__ */ jsxDEV("div", {
|
|
271
|
+
}) : null,
|
|
272
|
+
progress != null ? /* @__PURE__ */ jsxs("div", {
|
|
346
273
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2 rounded-kit-lg bg-kit-surface px-8",
|
|
347
|
-
children: [/* @__PURE__ */
|
|
274
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
348
275
|
className: "text-kit-sm text-kit-fg-2",
|
|
349
276
|
children: [
|
|
350
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ jsx("span", {
|
|
351
278
|
role: "status",
|
|
352
279
|
children: "Uploading…"
|
|
353
|
-
},
|
|
354
|
-
fileName: _jsxFileName,
|
|
355
|
-
lineNumber: 353,
|
|
356
|
-
columnNumber: 13
|
|
357
|
-
}, this),
|
|
280
|
+
}),
|
|
358
281
|
" ",
|
|
359
282
|
progress,
|
|
360
283
|
"%"
|
|
361
284
|
]
|
|
362
|
-
},
|
|
363
|
-
fileName: _jsxFileName,
|
|
364
|
-
lineNumber: 352,
|
|
365
|
-
columnNumber: 11
|
|
366
|
-
}, this), /* @__PURE__ */ jsxDEV(Progress, {
|
|
285
|
+
}), /* @__PURE__ */ jsx(Progress, {
|
|
367
286
|
value: progress,
|
|
368
287
|
tone: "ink",
|
|
369
288
|
label: "Upload progress",
|
|
370
289
|
className: "max-w-56"
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
lineNumber: 355,
|
|
374
|
-
columnNumber: 11
|
|
375
|
-
}, this)]
|
|
376
|
-
}, void 0, true, {
|
|
377
|
-
fileName: _jsxFileName,
|
|
378
|
-
lineNumber: 351,
|
|
379
|
-
columnNumber: 9
|
|
380
|
-
}, this) : null
|
|
290
|
+
})]
|
|
291
|
+
}) : null
|
|
381
292
|
]
|
|
382
|
-
}
|
|
383
|
-
fileName: _jsxFileName,
|
|
384
|
-
lineNumber: 232,
|
|
385
|
-
columnNumber: 5
|
|
386
|
-
}, this);
|
|
293
|
+
});
|
|
387
294
|
}
|
|
388
295
|
/** Why the drop well offers nothing to pick with (no library, no upload): said once, in words. */
|
|
389
296
|
var NO_SOURCE = "No media library or upload is connected to this editor, so nothing can be chosen here.";
|
|
@@ -474,77 +381,41 @@ function ImageDetails({ v, onChange, readOnly, label, urlOnly, altOnly = false,
|
|
|
474
381
|
if (!r.width || !r.height) return;
|
|
475
382
|
setFocal(50 + ((e.clientX - r.left) / r.width * 100 - 50) / fx, 50 + ((e.clientY - r.top) / r.height * 100 - 50) / fy);
|
|
476
383
|
};
|
|
477
|
-
return /* @__PURE__ */
|
|
384
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
478
385
|
className: "flex flex-col gap-3",
|
|
479
386
|
children: [
|
|
480
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ jsxs("div", {
|
|
481
388
|
className: "flex items-center justify-between",
|
|
482
|
-
children: [/* @__PURE__ */
|
|
389
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
483
390
|
className: "text-kit-sm font-medium text-kit-fg",
|
|
484
391
|
children: "Alt text and details"
|
|
485
|
-
},
|
|
486
|
-
fileName: _jsxFileName,
|
|
487
|
-
lineNumber: 453,
|
|
488
|
-
columnNumber: 9
|
|
489
|
-
}, this), size ? /* @__PURE__ */ jsxDEV("span", {
|
|
392
|
+
}), size ? /* @__PURE__ */ jsxs("span", {
|
|
490
393
|
className: "tabular-nums text-kit-2xs text-kit-fg-3",
|
|
491
394
|
children: [
|
|
492
395
|
size.w,
|
|
493
396
|
" × ",
|
|
494
397
|
size.h
|
|
495
398
|
]
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
columnNumber: 11
|
|
500
|
-
}, this) : null]
|
|
501
|
-
}, void 0, true, {
|
|
502
|
-
fileName: _jsxFileName,
|
|
503
|
-
lineNumber: 452,
|
|
504
|
-
columnNumber: 7
|
|
505
|
-
}, this),
|
|
506
|
-
urlOnly ? /* @__PURE__ */ jsxDEV(Fragment, { children: [/* @__PURE__ */ jsxDEV(Reason, {
|
|
399
|
+
}) : null]
|
|
400
|
+
}),
|
|
401
|
+
urlOnly ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Reason, {
|
|
507
402
|
tone: "muted",
|
|
508
403
|
children: "This placement stores the image address only, so its alt text and focal point are the media library's."
|
|
509
|
-
},
|
|
510
|
-
fileName: _jsxFileName,
|
|
511
|
-
lineNumber: 462,
|
|
512
|
-
columnNumber: 11
|
|
513
|
-
}, this), asset?.alt ? /* @__PURE__ */ jsxDEV("div", {
|
|
404
|
+
}), asset?.alt ? /* @__PURE__ */ jsxs("div", {
|
|
514
405
|
className: "flex flex-col gap-1",
|
|
515
|
-
children: [/* @__PURE__ */
|
|
406
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
516
407
|
className: "text-kit-xs text-kit-fg-3",
|
|
517
408
|
children: "Alt text in the media library"
|
|
518
|
-
},
|
|
519
|
-
fileName: _jsxFileName,
|
|
520
|
-
lineNumber: 465,
|
|
521
|
-
columnNumber: 15
|
|
522
|
-
}, this), /* @__PURE__ */ jsxDEV("span", {
|
|
409
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
523
410
|
className: "text-kit-sm text-kit-fg",
|
|
524
411
|
children: asset.alt
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
lineNumber: 466,
|
|
528
|
-
columnNumber: 15
|
|
529
|
-
}, this)]
|
|
530
|
-
}, void 0, true, {
|
|
531
|
-
fileName: _jsxFileName,
|
|
532
|
-
lineNumber: 464,
|
|
533
|
-
columnNumber: 13
|
|
534
|
-
}, this) : null] }, void 0, true, {
|
|
535
|
-
fileName: _jsxFileName,
|
|
536
|
-
lineNumber: 461,
|
|
537
|
-
columnNumber: 9
|
|
538
|
-
}, this) : /* @__PURE__ */ jsxDEV(Fragment, { children: [/* @__PURE__ */ jsxDEV("label", {
|
|
412
|
+
})]
|
|
413
|
+
}) : null] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("label", {
|
|
539
414
|
className: "flex flex-col gap-1.5",
|
|
540
|
-
children: [/* @__PURE__ */
|
|
415
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
541
416
|
className: "text-kit-xs text-kit-fg-3",
|
|
542
417
|
children: "Alt text"
|
|
543
|
-
},
|
|
544
|
-
fileName: _jsxFileName,
|
|
545
|
-
lineNumber: 473,
|
|
546
|
-
columnNumber: 13
|
|
547
|
-
}, this), /* @__PURE__ */ jsxDEV(Textarea, {
|
|
418
|
+
}), /* @__PURE__ */ jsx(Textarea, {
|
|
548
419
|
rows: 2,
|
|
549
420
|
value: v.alt ?? "",
|
|
550
421
|
readOnly,
|
|
@@ -558,71 +429,39 @@ function ImageDetails({ v, onChange, readOnly, label, urlOnly, altOnly = false,
|
|
|
558
429
|
placeholder: "Describe the image for accessibility",
|
|
559
430
|
className: "min-h-14 text-kit-sm",
|
|
560
431
|
"aria-label": `${label} alt text`
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
lineNumber: 474,
|
|
564
|
-
columnNumber: 13
|
|
565
|
-
}, this)]
|
|
566
|
-
}, void 0, true, {
|
|
567
|
-
fileName: _jsxFileName,
|
|
568
|
-
lineNumber: 472,
|
|
569
|
-
columnNumber: 11
|
|
570
|
-
}, this), altOnly ? /* @__PURE__ */ jsxDEV(Reason, {
|
|
432
|
+
})]
|
|
433
|
+
}), altOnly ? /* @__PURE__ */ jsx(Reason, {
|
|
571
434
|
tone: "muted",
|
|
572
435
|
children: "This image block keeps its address and alt text. A crop or focal point isn't stored with it."
|
|
573
|
-
}
|
|
574
|
-
fileName: _jsxFileName,
|
|
575
|
-
lineNumber: 491,
|
|
576
|
-
columnNumber: 13
|
|
577
|
-
}, this) : /* @__PURE__ */ jsxDEV("div", {
|
|
436
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
578
437
|
className: "flex flex-col gap-1.5",
|
|
579
438
|
children: [
|
|
580
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ jsxs("div", {
|
|
581
440
|
className: "flex items-center justify-between",
|
|
582
|
-
children: [/* @__PURE__ */
|
|
441
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
583
442
|
className: "flex items-center gap-1 text-kit-xs text-kit-fg-3",
|
|
584
|
-
children: [/* @__PURE__ */
|
|
443
|
+
children: [/* @__PURE__ */ jsx(IconCrop, {
|
|
585
444
|
className: "size-3.5",
|
|
586
445
|
stroke: 1.5,
|
|
587
446
|
"aria-hidden": true
|
|
588
|
-
},
|
|
589
|
-
|
|
590
|
-
lineNumber: 496,
|
|
591
|
-
columnNumber: 17
|
|
592
|
-
}, this), "Crop for this placement"]
|
|
593
|
-
}, void 0, true, {
|
|
594
|
-
fileName: _jsxFileName,
|
|
595
|
-
lineNumber: 495,
|
|
596
|
-
columnNumber: 15
|
|
597
|
-
}, this), /* @__PURE__ */ jsxDEV("span", {
|
|
447
|
+
}), "Crop for this placement"]
|
|
448
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
598
449
|
className: "flex items-center gap-1 text-kit-2xs text-kit-fg-3",
|
|
599
450
|
children: [
|
|
600
|
-
/* @__PURE__ */
|
|
451
|
+
/* @__PURE__ */ jsx(IconFocusCentered, {
|
|
601
452
|
className: "size-3",
|
|
602
453
|
stroke: 1.5,
|
|
603
454
|
"aria-hidden": true
|
|
604
|
-
},
|
|
605
|
-
fileName: _jsxFileName,
|
|
606
|
-
lineNumber: 500,
|
|
607
|
-
columnNumber: 17
|
|
608
|
-
}, this),
|
|
455
|
+
}),
|
|
609
456
|
"Focal ",
|
|
610
457
|
focal.x,
|
|
611
458
|
"%, ",
|
|
612
459
|
focal.y,
|
|
613
460
|
"%"
|
|
614
461
|
]
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
columnNumber: 15
|
|
619
|
-
}, this)]
|
|
620
|
-
}, void 0, true, {
|
|
621
|
-
fileName: _jsxFileName,
|
|
622
|
-
lineNumber: 494,
|
|
623
|
-
columnNumber: 13
|
|
624
|
-
}, this),
|
|
625
|
-
/* @__PURE__ */ jsxDEV(Select, {
|
|
462
|
+
})]
|
|
463
|
+
}),
|
|
464
|
+
/* @__PURE__ */ jsx(Select, {
|
|
626
465
|
size: "sm",
|
|
627
466
|
"aria-label": `${label} crop`,
|
|
628
467
|
disabled: readOnly || !size,
|
|
@@ -639,20 +478,12 @@ function ImageDetails({ v, onChange, readOnly, label, urlOnly, altOnly = false,
|
|
|
639
478
|
meta: "Cut elsewhere",
|
|
640
479
|
disabled: true
|
|
641
480
|
}] : []]
|
|
642
|
-
},
|
|
643
|
-
|
|
644
|
-
lineNumber: 505,
|
|
645
|
-
columnNumber: 13
|
|
646
|
-
}, this),
|
|
647
|
-
!size && !readOnly ? /* @__PURE__ */ jsxDEV("span", {
|
|
481
|
+
}),
|
|
482
|
+
!size && !readOnly ? /* @__PURE__ */ jsx("span", {
|
|
648
483
|
className: "text-kit-2xs text-kit-fg-3",
|
|
649
484
|
children: "The crop is cut from the picture's size, which is still loading."
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
lineNumber: 517,
|
|
653
|
-
columnNumber: 35
|
|
654
|
-
}, this) : null,
|
|
655
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
485
|
+
}) : null,
|
|
486
|
+
/* @__PURE__ */ jsxs("div", {
|
|
656
487
|
role: "slider",
|
|
657
488
|
"aria-label": "Focal point. Click the subject.",
|
|
658
489
|
"aria-valuetext": `${focal.x}% across, ${focal.y}% down`,
|
|
@@ -678,91 +509,47 @@ function ImageDetails({ v, onChange, readOnly, label, urlOnly, altOnly = false,
|
|
|
678
509
|
"data-fit": fit,
|
|
679
510
|
className: cn("relative mt-1 cursor-crosshair overflow-hidden rounded-kit-md border border-kit-line", fit === "contain" ? CHECKER : "bg-kit-muted"),
|
|
680
511
|
style: { aspectRatio: padRatio },
|
|
681
|
-
children: [fit === "contain" ? /* @__PURE__ */
|
|
512
|
+
children: [fit === "contain" ? /* @__PURE__ */ jsx("img", {
|
|
682
513
|
src: src(v.url),
|
|
683
514
|
alt: "",
|
|
684
515
|
draggable: false,
|
|
685
516
|
className: "pointer-events-none size-full select-none object-contain"
|
|
686
|
-
}
|
|
687
|
-
fileName: _jsxFileName,
|
|
688
|
-
lineNumber: 543,
|
|
689
|
-
columnNumber: 17
|
|
690
|
-
}, this) : /* @__PURE__ */ jsxDEV("img", {
|
|
517
|
+
}) : /* @__PURE__ */ jsx("img", {
|
|
691
518
|
src: src(v.url),
|
|
692
519
|
alt: "",
|
|
693
520
|
draggable: false,
|
|
694
521
|
className: "pointer-events-none size-full select-none object-cover transition-[object-position] duration-200",
|
|
695
522
|
style: { objectPosition: `${focal.x}% ${focal.y}%` }
|
|
696
|
-
},
|
|
697
|
-
fileName: _jsxFileName,
|
|
698
|
-
lineNumber: 545,
|
|
699
|
-
columnNumber: 17
|
|
700
|
-
}, this), /* @__PURE__ */ jsxDEV("span", {
|
|
523
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
701
524
|
"aria-hidden": true,
|
|
702
525
|
className: "pointer-events-none absolute size-5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-kit-media-handle bg-kit-media-handle-ring shadow-kit-md transition-[left,top] duration-150",
|
|
703
526
|
style: {
|
|
704
527
|
left: `${50 + (focal.x - 50) * fx}%`,
|
|
705
528
|
top: `${50 + (focal.y - 50) * fy}%`
|
|
706
529
|
}
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
columnNumber: 15
|
|
711
|
-
}, this)]
|
|
712
|
-
}, void 0, true, {
|
|
713
|
-
fileName: _jsxFileName,
|
|
714
|
-
lineNumber: 518,
|
|
715
|
-
columnNumber: 13
|
|
716
|
-
}, this),
|
|
717
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
530
|
+
})]
|
|
531
|
+
}),
|
|
532
|
+
/* @__PURE__ */ jsx("span", {
|
|
718
533
|
className: "text-kit-2xs text-kit-fg-3",
|
|
719
534
|
children: "Click the subject. It stays in frame on every screen size."
|
|
720
|
-
}
|
|
721
|
-
fileName: _jsxFileName,
|
|
722
|
-
lineNumber: 553,
|
|
723
|
-
columnNumber: 13
|
|
724
|
-
}, this)
|
|
535
|
+
})
|
|
725
536
|
]
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
lineNumber: 493,
|
|
729
|
-
columnNumber: 11
|
|
730
|
-
}, this)] }, void 0, true, {
|
|
731
|
-
fileName: _jsxFileName,
|
|
732
|
-
lineNumber: 471,
|
|
733
|
-
columnNumber: 9
|
|
734
|
-
}, this),
|
|
735
|
-
urlOnly || altOnly ? /* @__PURE__ */ jsxDEV("div", {
|
|
537
|
+
})] }),
|
|
538
|
+
urlOnly || altOnly ? /* @__PURE__ */ jsxs("div", {
|
|
736
539
|
className: "flex flex-col gap-1.5",
|
|
737
|
-
children: [/* @__PURE__ */
|
|
540
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
738
541
|
className: "text-kit-xs text-kit-fg-3",
|
|
739
542
|
children: "File name"
|
|
740
|
-
},
|
|
741
|
-
fileName: _jsxFileName,
|
|
742
|
-
lineNumber: 560,
|
|
743
|
-
columnNumber: 11
|
|
744
|
-
}, this), /* @__PURE__ */ jsxDEV("span", {
|
|
543
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
745
544
|
className: "truncate font-kit-mono text-kit-xs text-kit-fg",
|
|
746
545
|
children: asset?.name ?? v.name ?? fileNameFromUrl(v.url)
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
lineNumber: 561,
|
|
750
|
-
columnNumber: 11
|
|
751
|
-
}, this)]
|
|
752
|
-
}, void 0, true, {
|
|
753
|
-
fileName: _jsxFileName,
|
|
754
|
-
lineNumber: 559,
|
|
755
|
-
columnNumber: 9
|
|
756
|
-
}, this) : /* @__PURE__ */ jsxDEV("label", {
|
|
546
|
+
})]
|
|
547
|
+
}) : /* @__PURE__ */ jsxs("label", {
|
|
757
548
|
className: "flex flex-col gap-1.5",
|
|
758
|
-
children: [/* @__PURE__ */
|
|
549
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
759
550
|
className: "text-kit-xs text-kit-fg-3",
|
|
760
551
|
children: "File name"
|
|
761
|
-
},
|
|
762
|
-
fileName: _jsxFileName,
|
|
763
|
-
lineNumber: 566,
|
|
764
|
-
columnNumber: 11
|
|
765
|
-
}, this), /* @__PURE__ */ jsxDEV(Input, {
|
|
552
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
766
553
|
size: "sm",
|
|
767
554
|
value: v.name ?? asset?.name ?? fileNameFromUrl(v.url),
|
|
768
555
|
readOnly,
|
|
@@ -776,22 +563,10 @@ function ImageDetails({ v, onChange, readOnly, label, urlOnly, altOnly = false,
|
|
|
776
563
|
},
|
|
777
564
|
className: "font-kit-mono [&_input]:font-kit-mono",
|
|
778
565
|
"aria-label": `${label} file name`
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
lineNumber: 567,
|
|
782
|
-
columnNumber: 11
|
|
783
|
-
}, this)]
|
|
784
|
-
}, void 0, true, {
|
|
785
|
-
fileName: _jsxFileName,
|
|
786
|
-
lineNumber: 565,
|
|
787
|
-
columnNumber: 9
|
|
788
|
-
}, this)
|
|
566
|
+
})]
|
|
567
|
+
})
|
|
789
568
|
]
|
|
790
|
-
}
|
|
791
|
-
fileName: _jsxFileName,
|
|
792
|
-
lineNumber: 451,
|
|
793
|
-
columnNumber: 5
|
|
794
|
-
}, this);
|
|
569
|
+
});
|
|
795
570
|
}
|
|
796
571
|
/**
|
|
797
572
|
* V2's icon control shape (controls/icon.tsx): ONE button — a 24px glyph tile, the field's name, a quiet replace cue —
|
|
@@ -810,11 +585,11 @@ function IconImageRow({ id, title, url, readOnly, onOpen, onFiles, busy, pickerO
|
|
|
810
585
|
const inert = readOnly || busy || !onOpen;
|
|
811
586
|
const droppable = empty && !inert && !!onFiles;
|
|
812
587
|
const chrome = React.useContext(RowChrome);
|
|
813
|
-
return /* @__PURE__ */
|
|
588
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
814
589
|
className: cn("flex h-8 min-w-0 items-center rounded-kit-md border bg-kit-field-bg pointer-coarse:min-h-11", "transition-colors duration-[120ms] ease-out motion-reduce:transition-none", over ? "border-kit-emphasis-line bg-kit-hover" : "border-kit-line-strong", inert ? "opacity-60" : "[@media(hover:hover)]:hover:bg-kit-hover"),
|
|
815
|
-
children: [/* @__PURE__ */
|
|
590
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
816
591
|
content: title,
|
|
817
|
-
children: /* @__PURE__ */
|
|
592
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
818
593
|
ref: row,
|
|
819
594
|
id,
|
|
820
595
|
type: "button",
|
|
@@ -834,72 +609,36 @@ function IconImageRow({ id, title, url, readOnly, onOpen, onFiles, busy, pickerO
|
|
|
834
609
|
} : void 0,
|
|
835
610
|
className: "flex min-w-0 flex-1 touch-manipulation items-center gap-3 self-stretch rounded-[5px] pl-[3px] pr-2 text-left text-kit-sm focus-visible:-outline-offset-2 disabled:cursor-not-allowed",
|
|
836
611
|
children: [
|
|
837
|
-
/* @__PURE__ */
|
|
612
|
+
/* @__PURE__ */ jsx("span", {
|
|
838
613
|
"aria-hidden": true,
|
|
839
614
|
className: cn("grid size-6 shrink-0 place-items-center overflow-hidden rounded-kit-sm border", empty ? "border-dashed border-kit-emphasis-line" : cn("border-kit-line p-1", CHECKER)),
|
|
840
|
-
children: empty ? /* @__PURE__ */
|
|
615
|
+
children: empty ? /* @__PURE__ */ jsx(IconPlus, {
|
|
841
616
|
className: "size-3.5 text-kit-fg-3",
|
|
842
617
|
stroke: 1.5
|
|
843
|
-
}
|
|
844
|
-
fileName: _jsxFileName,
|
|
845
|
-
lineNumber: 657,
|
|
846
|
-
columnNumber: 20
|
|
847
|
-
}, this) : /* @__PURE__ */ jsxDEV("img", {
|
|
618
|
+
}) : /* @__PURE__ */ jsx("img", {
|
|
848
619
|
src: url,
|
|
849
620
|
alt: "",
|
|
850
621
|
className: "size-full object-contain"
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
columnNumber: 83
|
|
855
|
-
}, this)
|
|
856
|
-
}, void 0, false, {
|
|
857
|
-
fileName: _jsxFileName,
|
|
858
|
-
lineNumber: 650,
|
|
859
|
-
columnNumber: 9
|
|
860
|
-
}, this),
|
|
861
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
622
|
+
})
|
|
623
|
+
}),
|
|
624
|
+
/* @__PURE__ */ jsx("span", {
|
|
862
625
|
"aria-hidden": true,
|
|
863
626
|
className: cn("min-w-0 flex-1 truncate", empty ? "text-kit-fg-3" : "text-kit-fg"),
|
|
864
627
|
children: empty ? busy ? "Uploading…" : "Add icon" : title
|
|
865
|
-
},
|
|
866
|
-
|
|
867
|
-
lineNumber: 659,
|
|
868
|
-
columnNumber: 9
|
|
869
|
-
}, this),
|
|
870
|
-
empty ? null : /* @__PURE__ */ jsxDEV(IconRefresh, {
|
|
628
|
+
}),
|
|
629
|
+
empty ? null : /* @__PURE__ */ jsx(IconRefresh, {
|
|
871
630
|
"aria-hidden": true,
|
|
872
631
|
className: "size-3.5 shrink-0 text-kit-fg-3",
|
|
873
632
|
stroke: 1.5
|
|
874
|
-
}
|
|
875
|
-
fileName: _jsxFileName,
|
|
876
|
-
lineNumber: 662,
|
|
877
|
-
columnNumber: 25
|
|
878
|
-
}, this)
|
|
633
|
+
})
|
|
879
634
|
]
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
lineNumber: 637,
|
|
883
|
-
columnNumber: 7
|
|
884
|
-
}, this)
|
|
885
|
-
}, void 0, false, {
|
|
886
|
-
fileName: _jsxFileName,
|
|
887
|
-
lineNumber: 636,
|
|
888
|
-
columnNumber: 5
|
|
889
|
-
}, this), chrome ? /* @__PURE__ */ jsxDEV("span", {
|
|
635
|
+
})
|
|
636
|
+
}), chrome ? /* @__PURE__ */ jsx("span", {
|
|
890
637
|
"data-slot": "kit-icon-row-chrome",
|
|
891
638
|
className: "flex shrink-0 items-center gap-0.5 pr-1 empty:hidden",
|
|
892
639
|
children: chrome
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
lineNumber: 665,
|
|
896
|
-
columnNumber: 17
|
|
897
|
-
}, this) : null]
|
|
898
|
-
}, void 0, true, {
|
|
899
|
-
fileName: _jsxFileName,
|
|
900
|
-
lineNumber: 628,
|
|
901
|
-
columnNumber: 5
|
|
902
|
-
}, this);
|
|
640
|
+
}) : null]
|
|
641
|
+
});
|
|
903
642
|
}
|
|
904
643
|
function ImageControl({ field, value, onChange: write, readOnly, id, path }) {
|
|
905
644
|
const { s, useAsset, src } = useMedia();
|
|
@@ -965,10 +704,10 @@ function ImageControl({ field, value, onChange: write, readOnly, id, path }) {
|
|
|
965
704
|
}));
|
|
966
705
|
setPicker(false);
|
|
967
706
|
};
|
|
968
|
-
return /* @__PURE__ */
|
|
707
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
969
708
|
className: "flex flex-col gap-1.5",
|
|
970
709
|
children: [
|
|
971
|
-
/* @__PURE__ */
|
|
710
|
+
/* @__PURE__ */ jsx(IconImageRow, {
|
|
972
711
|
id,
|
|
973
712
|
title: field.title,
|
|
974
713
|
url: v ? src(v.url) : void 0,
|
|
@@ -977,25 +716,13 @@ function ImageControl({ field, value, onChange: write, readOnly, id, path }) {
|
|
|
977
716
|
onFiles: up.run,
|
|
978
717
|
busy: up.progress != null,
|
|
979
718
|
pickerOpen: picker
|
|
980
|
-
},
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
columnNumber: 9
|
|
984
|
-
}, this),
|
|
985
|
-
up.error ? /* @__PURE__ */ jsxDEV(Reason, { children: up.error }, void 0, false, {
|
|
986
|
-
fileName: _jsxFileName,
|
|
987
|
-
lineNumber: 741,
|
|
988
|
-
columnNumber: 21
|
|
989
|
-
}, this) : null,
|
|
990
|
-
!readOnly && !library ? /* @__PURE__ */ jsxDEV(Reason, {
|
|
719
|
+
}),
|
|
720
|
+
up.error ? /* @__PURE__ */ jsx(Reason, { children: up.error }) : null,
|
|
721
|
+
!readOnly && !library ? /* @__PURE__ */ jsx(Reason, {
|
|
991
722
|
tone: "muted",
|
|
992
723
|
children: NO_LIBRARY
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
lineNumber: 742,
|
|
996
|
-
columnNumber: 34
|
|
997
|
-
}, this) : null,
|
|
998
|
-
/* @__PURE__ */ jsxDEV(MediaPicker, {
|
|
724
|
+
}) : null,
|
|
725
|
+
/* @__PURE__ */ jsx(MediaPicker, {
|
|
999
726
|
open: picker,
|
|
1000
727
|
onOpenChange: setPicker,
|
|
1001
728
|
accept: ["svg"],
|
|
@@ -1007,31 +734,19 @@ function ImageControl({ field, value, onChange: write, readOnly, id, path }) {
|
|
|
1007
734
|
} : void 0,
|
|
1008
735
|
icons,
|
|
1009
736
|
onPickIcon: readOnly ? void 0 : pickIcon
|
|
1010
|
-
}
|
|
1011
|
-
fileName: _jsxFileName,
|
|
1012
|
-
lineNumber: 743,
|
|
1013
|
-
columnNumber: 9
|
|
1014
|
-
}, this)
|
|
737
|
+
})
|
|
1015
738
|
]
|
|
1016
|
-
}
|
|
1017
|
-
fileName: _jsxFileName,
|
|
1018
|
-
lineNumber: 730,
|
|
1019
|
-
columnNumber: 7
|
|
1020
|
-
}, this);
|
|
739
|
+
});
|
|
1021
740
|
}
|
|
1022
|
-
if (!v) return /* @__PURE__ */
|
|
741
|
+
if (!v) return /* @__PURE__ */ jsxs("div", {
|
|
1023
742
|
className: "flex flex-col gap-1.5",
|
|
1024
743
|
children: [
|
|
1025
|
-
/* @__PURE__ */
|
|
744
|
+
/* @__PURE__ */ jsx(DropWell, {
|
|
1026
745
|
id,
|
|
1027
746
|
title: "Add an image",
|
|
1028
747
|
hint: "Or drop or paste one here",
|
|
1029
748
|
accept,
|
|
1030
|
-
icon: /* @__PURE__ */
|
|
1031
|
-
fileName: _jsxFileName,
|
|
1032
|
-
lineNumber: 765,
|
|
1033
|
-
columnNumber: 17
|
|
1034
|
-
}, this),
|
|
749
|
+
icon: /* @__PURE__ */ jsx(IconPhoto, { stroke: 1.5 }),
|
|
1035
750
|
onFiles: up.run,
|
|
1036
751
|
onLibrary: library,
|
|
1037
752
|
onUrl: readOnly ? void 0 : (url) => onChange({
|
|
@@ -1041,32 +756,16 @@ function ImageControl({ field, value, onChange: write, readOnly, id, path }) {
|
|
|
1041
756
|
refuse: up.setError,
|
|
1042
757
|
disabled: readOnly,
|
|
1043
758
|
progress: up.progress
|
|
1044
|
-
},
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
columnNumber: 9
|
|
1048
|
-
}, this),
|
|
1049
|
-
up.error ? /* @__PURE__ */ jsxDEV(Reason, { children: up.error }, void 0, false, {
|
|
1050
|
-
fileName: _jsxFileName,
|
|
1051
|
-
lineNumber: 773,
|
|
1052
|
-
columnNumber: 21
|
|
1053
|
-
}, this) : null,
|
|
1054
|
-
/* @__PURE__ */ jsxDEV(MediaPicker, {
|
|
759
|
+
}),
|
|
760
|
+
up.error ? /* @__PURE__ */ jsx(Reason, { children: up.error }) : null,
|
|
761
|
+
/* @__PURE__ */ jsx(MediaPicker, {
|
|
1055
762
|
open: picker,
|
|
1056
763
|
onOpenChange: setPicker,
|
|
1057
764
|
accept: kinds,
|
|
1058
765
|
onPick: (a) => a[0] && onChange(fromAsset(a[0]))
|
|
1059
|
-
}
|
|
1060
|
-
fileName: _jsxFileName,
|
|
1061
|
-
lineNumber: 774,
|
|
1062
|
-
columnNumber: 9
|
|
1063
|
-
}, this)
|
|
766
|
+
})
|
|
1064
767
|
]
|
|
1065
|
-
}
|
|
1066
|
-
fileName: _jsxFileName,
|
|
1067
|
-
lineNumber: 759,
|
|
1068
|
-
columnNumber: 7
|
|
1069
|
-
}, this);
|
|
768
|
+
});
|
|
1070
769
|
const frameRatio = CROPS.find((c) => c.value === cropChoice(v.crop, size))?.ratio;
|
|
1071
770
|
const focal = v.focal ?? {
|
|
1072
771
|
x: 50,
|
|
@@ -1081,11 +780,11 @@ function ImageControl({ field, value, onChange: write, readOnly, id, path }) {
|
|
|
1081
780
|
onChange(next);
|
|
1082
781
|
};
|
|
1083
782
|
const openDetails = () => window.setTimeout(() => setDetails(true), 0);
|
|
1084
|
-
return /* @__PURE__ */
|
|
783
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
1085
784
|
open: details,
|
|
1086
785
|
onOpenChange: setDetails,
|
|
1087
786
|
children: [
|
|
1088
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ jsxs(PopoverAnchor, {
|
|
1089
788
|
className: cn("flex flex-col gap-1.5", env.variant === "document" && "max-w-xl"),
|
|
1090
789
|
onPaste: (e) => {
|
|
1091
790
|
const files = Array.from(e.clipboardData.files);
|
|
@@ -1095,272 +794,140 @@ function ImageControl({ field, value, onChange: write, readOnly, id, path }) {
|
|
|
1095
794
|
}
|
|
1096
795
|
},
|
|
1097
796
|
children: [
|
|
1098
|
-
/* @__PURE__ */
|
|
797
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1099
798
|
"data-slot": "kit-image-frame",
|
|
1100
799
|
"data-fit": fit,
|
|
1101
800
|
className: cn("group/img relative overflow-hidden rounded-kit-lg border border-kit-line", fit === "contain" ? CHECKER : "bg-kit-muted"),
|
|
1102
801
|
style: { aspectRatio: frameRatio && frameRatio !== "auto" ? frameRatio : "16/9" },
|
|
1103
802
|
children: [
|
|
1104
|
-
/* @__PURE__ */
|
|
803
|
+
/* @__PURE__ */ jsx("button", {
|
|
1105
804
|
id,
|
|
1106
805
|
type: "button",
|
|
1107
806
|
disabled: readOnly,
|
|
1108
807
|
onClick: () => library ? library() : openDetails(),
|
|
1109
808
|
"aria-label": library ? `Replace ${field.title}` : `${field.title} details`,
|
|
1110
809
|
className: "flex size-full items-center justify-center outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-kit-focus-ring focus-visible:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:outline-none",
|
|
1111
|
-
children: /* @__PURE__ */
|
|
810
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
1112
811
|
src: src(v.url),
|
|
1113
812
|
alt: alt ?? "",
|
|
1114
813
|
ref: readNatural,
|
|
1115
814
|
onLoad: (e) => readNatural(e.currentTarget),
|
|
1116
815
|
className: fit === "contain" ? "size-full object-contain" : "size-full object-cover",
|
|
1117
816
|
style: fit === "contain" ? void 0 : { objectPosition: `${focal.x}% ${focal.y}%` }
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
columnNumber: 13
|
|
1122
|
-
}, this)
|
|
1123
|
-
}, void 0, false, {
|
|
1124
|
-
fileName: _jsxFileName,
|
|
1125
|
-
lineNumber: 810,
|
|
1126
|
-
columnNumber: 11
|
|
1127
|
-
}, this),
|
|
1128
|
-
readOnly ? null : /* @__PURE__ */ jsxDEV("div", {
|
|
817
|
+
})
|
|
818
|
+
}),
|
|
819
|
+
readOnly ? null : /* @__PURE__ */ jsxs("div", {
|
|
1129
820
|
className: "absolute right-2 top-2 flex gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/img:opacity-100 [@media(pointer:coarse)]:opacity-100",
|
|
1130
|
-
children: [library ? /* @__PURE__ */
|
|
821
|
+
children: [library ? /* @__PURE__ */ jsxs("button", {
|
|
1131
822
|
type: "button",
|
|
1132
823
|
onClick: library,
|
|
1133
824
|
className: "flex h-7 items-center gap-1 rounded-full border border-kit-swatch-ring bg-kit-media-control px-2.5 text-kit-xs font-medium text-kit-media-control-fg shadow-kit-sm",
|
|
1134
|
-
children: [/* @__PURE__ */
|
|
825
|
+
children: [/* @__PURE__ */ jsx(IconReplace, {
|
|
1135
826
|
className: "size-3.5",
|
|
1136
827
|
stroke: 1.5,
|
|
1137
828
|
"aria-hidden": true
|
|
1138
|
-
},
|
|
1139
|
-
|
|
1140
|
-
lineNumber: 831,
|
|
1141
|
-
columnNumber: 19
|
|
1142
|
-
}, this), "Replace"]
|
|
1143
|
-
}, void 0, true, {
|
|
1144
|
-
fileName: _jsxFileName,
|
|
1145
|
-
lineNumber: 830,
|
|
1146
|
-
columnNumber: 17
|
|
1147
|
-
}, this) : null, /* @__PURE__ */ jsxDEV(Tooltip, {
|
|
829
|
+
}), "Replace"]
|
|
830
|
+
}) : null, /* @__PURE__ */ jsx(Tooltip, {
|
|
1148
831
|
content: "Remove image",
|
|
1149
|
-
children: /* @__PURE__ */
|
|
832
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
1150
833
|
type: "button",
|
|
1151
834
|
"aria-label": "Remove image",
|
|
1152
835
|
onClick: () => onChange(null),
|
|
1153
836
|
className: "flex size-7 items-center justify-center rounded-full border border-kit-swatch-ring bg-kit-media-control text-kit-media-control-fg shadow-kit-sm",
|
|
1154
|
-
children: /* @__PURE__ */
|
|
837
|
+
children: /* @__PURE__ */ jsx(IconX, {
|
|
1155
838
|
className: "size-3.5",
|
|
1156
839
|
stroke: 1.5,
|
|
1157
840
|
"aria-hidden": true
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
}, void 0, false, {
|
|
1164
|
-
fileName: _jsxFileName,
|
|
1165
|
-
lineNumber: 836,
|
|
1166
|
-
columnNumber: 17
|
|
1167
|
-
}, this)
|
|
1168
|
-
}, void 0, false, {
|
|
1169
|
-
fileName: _jsxFileName,
|
|
1170
|
-
lineNumber: 835,
|
|
1171
|
-
columnNumber: 15
|
|
1172
|
-
}, this)]
|
|
1173
|
-
}, void 0, true, {
|
|
1174
|
-
fileName: _jsxFileName,
|
|
1175
|
-
lineNumber: 828,
|
|
1176
|
-
columnNumber: 13
|
|
1177
|
-
}, this),
|
|
1178
|
-
up.progress != null ? /* @__PURE__ */ jsxDEV("div", {
|
|
841
|
+
})
|
|
842
|
+
})
|
|
843
|
+
})]
|
|
844
|
+
}),
|
|
845
|
+
up.progress != null ? /* @__PURE__ */ jsx("div", {
|
|
1179
846
|
className: "absolute inset-x-3 bottom-3",
|
|
1180
|
-
children: /* @__PURE__ */
|
|
847
|
+
children: /* @__PURE__ */ jsx(Progress, {
|
|
1181
848
|
value: up.progress,
|
|
1182
849
|
tone: "ink",
|
|
1183
850
|
size: "sm",
|
|
1184
851
|
label: "Upload progress"
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
lineNumber: 844,
|
|
1188
|
-
columnNumber: 15
|
|
1189
|
-
}, this)
|
|
1190
|
-
}, void 0, false, {
|
|
1191
|
-
fileName: _jsxFileName,
|
|
1192
|
-
lineNumber: 843,
|
|
1193
|
-
columnNumber: 13
|
|
1194
|
-
}, this) : null
|
|
852
|
+
})
|
|
853
|
+
}) : null
|
|
1195
854
|
]
|
|
1196
|
-
},
|
|
1197
|
-
|
|
1198
|
-
lineNumber: 804,
|
|
1199
|
-
columnNumber: 9
|
|
1200
|
-
}, this),
|
|
1201
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
855
|
+
}),
|
|
856
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1202
857
|
className: "flex min-w-0 items-center gap-1.5 pl-0.5",
|
|
1203
|
-
children: [/* @__PURE__ */
|
|
858
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
1204
859
|
"data-slot": "kit-image-caption",
|
|
1205
860
|
className: "min-w-0 flex-1 truncate text-kit-xs text-kit-fg-3",
|
|
1206
861
|
children: [
|
|
1207
862
|
name,
|
|
1208
|
-
size ? /* @__PURE__ */
|
|
863
|
+
size ? /* @__PURE__ */ jsxs(Fragment, { children: [" · ", /* @__PURE__ */ jsxs("span", {
|
|
1209
864
|
className: "tabular-nums",
|
|
1210
865
|
children: [
|
|
1211
866
|
size.w,
|
|
1212
867
|
" × ",
|
|
1213
868
|
size.h
|
|
1214
869
|
]
|
|
1215
|
-
}
|
|
1216
|
-
fileName: _jsxFileName,
|
|
1217
|
-
lineNumber: 854,
|
|
1218
|
-
columnNumber: 17
|
|
1219
|
-
}, this)] }, void 0, true, {
|
|
1220
|
-
fileName: _jsxFileName,
|
|
1221
|
-
lineNumber: 852,
|
|
1222
|
-
columnNumber: 15
|
|
1223
|
-
}, this) : null,
|
|
870
|
+
})] }) : null,
|
|
1224
871
|
" · ",
|
|
1225
|
-
alt ? /* @__PURE__ */
|
|
872
|
+
alt ? /* @__PURE__ */ jsx("span", {
|
|
1226
873
|
className: "text-kit-fg-2",
|
|
1227
874
|
children: "Alt text set"
|
|
1228
|
-
}
|
|
1229
|
-
fileName: _jsxFileName,
|
|
1230
|
-
lineNumber: 861,
|
|
1231
|
-
columnNumber: 15
|
|
1232
|
-
}, this) : /* @__PURE__ */ jsxDEV("span", {
|
|
875
|
+
}) : /* @__PURE__ */ jsxs("span", {
|
|
1233
876
|
className: "inline-flex items-center gap-0.5 text-kit-warning-fg",
|
|
1234
|
-
children: [/* @__PURE__ */
|
|
877
|
+
children: [/* @__PURE__ */ jsx(IconAlertTriangle, {
|
|
1235
878
|
className: "size-3",
|
|
1236
879
|
stroke: 1.5,
|
|
1237
880
|
"aria-hidden": true
|
|
1238
|
-
},
|
|
1239
|
-
|
|
1240
|
-
lineNumber: 864,
|
|
1241
|
-
columnNumber: 17
|
|
1242
|
-
}, this), "No alt text"]
|
|
1243
|
-
}, void 0, true, {
|
|
1244
|
-
fileName: _jsxFileName,
|
|
1245
|
-
lineNumber: 863,
|
|
1246
|
-
columnNumber: 15
|
|
1247
|
-
}, this)
|
|
881
|
+
}), "No alt text"]
|
|
882
|
+
})
|
|
1248
883
|
]
|
|
1249
|
-
},
|
|
1250
|
-
fileName: _jsxFileName,
|
|
1251
|
-
lineNumber: 849,
|
|
1252
|
-
columnNumber: 11
|
|
1253
|
-
}, this), /* @__PURE__ */ jsxDEV(Menu, { children: [/* @__PURE__ */ jsxDEV(MenuTrigger, {
|
|
884
|
+
}), /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
1254
885
|
"aria-label": "Image actions",
|
|
1255
886
|
className: "flex size-6 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg data-[popup-open]:bg-kit-hover",
|
|
1256
|
-
children: /* @__PURE__ */
|
|
887
|
+
children: /* @__PURE__ */ jsx(IconDots, {
|
|
1257
888
|
className: "size-4",
|
|
1258
889
|
stroke: 1.5,
|
|
1259
890
|
"aria-hidden": true
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
lineNumber: 874,
|
|
1263
|
-
columnNumber: 15
|
|
1264
|
-
}, this)
|
|
1265
|
-
}, void 0, false, {
|
|
1266
|
-
fileName: _jsxFileName,
|
|
1267
|
-
lineNumber: 870,
|
|
1268
|
-
columnNumber: 13
|
|
1269
|
-
}, this), /* @__PURE__ */ jsxDEV(MenuContent, {
|
|
891
|
+
})
|
|
892
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
1270
893
|
align: "end",
|
|
1271
894
|
className: "w-52",
|
|
1272
895
|
children: [
|
|
1273
|
-
/* @__PURE__ */
|
|
1274
|
-
icon: /* @__PURE__ */
|
|
1275
|
-
fileName: _jsxFileName,
|
|
1276
|
-
lineNumber: 877,
|
|
1277
|
-
columnNumber: 31
|
|
1278
|
-
}, this),
|
|
896
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
897
|
+
icon: /* @__PURE__ */ jsx(IconFocusCentered, { stroke: 1.5 }),
|
|
1279
898
|
onClick: openDetails,
|
|
1280
899
|
children: "Alt text and details"
|
|
1281
|
-
},
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
columnNumber: 15
|
|
1285
|
-
}, this),
|
|
1286
|
-
/* @__PURE__ */ jsxDEV(MenuItem, {
|
|
1287
|
-
icon: /* @__PURE__ */ jsxDEV(IconReplace, { stroke: 1.5 }, void 0, false, {
|
|
1288
|
-
fileName: _jsxFileName,
|
|
1289
|
-
lineNumber: 881,
|
|
1290
|
-
columnNumber: 31
|
|
1291
|
-
}, this),
|
|
900
|
+
}),
|
|
901
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
902
|
+
icon: /* @__PURE__ */ jsx(IconReplace, { stroke: 1.5 }),
|
|
1292
903
|
disabled: !library,
|
|
1293
904
|
onClick: library,
|
|
1294
905
|
children: "Replace"
|
|
1295
|
-
},
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
columnNumber: 15
|
|
1299
|
-
}, this),
|
|
1300
|
-
/* @__PURE__ */ jsxDEV(MenuItem, {
|
|
1301
|
-
icon: /* @__PURE__ */ jsxDEV(IconExternalLink, { stroke: 1.5 }, void 0, false, {
|
|
1302
|
-
fileName: _jsxFileName,
|
|
1303
|
-
lineNumber: 884,
|
|
1304
|
-
columnNumber: 31
|
|
1305
|
-
}, this),
|
|
906
|
+
}),
|
|
907
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
908
|
+
icon: /* @__PURE__ */ jsx(IconExternalLink, { stroke: 1.5 }),
|
|
1306
909
|
onClick: () => window.open(src(v.url), "_blank", "noopener"),
|
|
1307
910
|
children: "Open original"
|
|
1308
|
-
},
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
columnNumber: 15
|
|
1312
|
-
}, this),
|
|
1313
|
-
/* @__PURE__ */ jsxDEV(MenuSeparator, {}, void 0, false, {
|
|
1314
|
-
fileName: _jsxFileName,
|
|
1315
|
-
lineNumber: 887,
|
|
1316
|
-
columnNumber: 15
|
|
1317
|
-
}, this),
|
|
1318
|
-
/* @__PURE__ */ jsxDEV(MenuItem, {
|
|
911
|
+
}),
|
|
912
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
913
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
1319
914
|
danger: true,
|
|
1320
|
-
icon: /* @__PURE__ */
|
|
1321
|
-
fileName: _jsxFileName,
|
|
1322
|
-
lineNumber: 888,
|
|
1323
|
-
columnNumber: 38
|
|
1324
|
-
}, this),
|
|
915
|
+
icon: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 }),
|
|
1325
916
|
disabled: readOnly,
|
|
1326
917
|
onClick: () => !readOnly && onChange(null),
|
|
1327
918
|
children: "Remove"
|
|
1328
|
-
}
|
|
1329
|
-
fileName: _jsxFileName,
|
|
1330
|
-
lineNumber: 888,
|
|
1331
|
-
columnNumber: 15
|
|
1332
|
-
}, this)
|
|
919
|
+
})
|
|
1333
920
|
]
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
columnNumber: 13
|
|
1338
|
-
}, this)] }, void 0, true, {
|
|
1339
|
-
fileName: _jsxFileName,
|
|
1340
|
-
lineNumber: 869,
|
|
1341
|
-
columnNumber: 11
|
|
1342
|
-
}, this)]
|
|
1343
|
-
}, void 0, true, {
|
|
1344
|
-
fileName: _jsxFileName,
|
|
1345
|
-
lineNumber: 848,
|
|
1346
|
-
columnNumber: 9
|
|
1347
|
-
}, this),
|
|
1348
|
-
up.error ? /* @__PURE__ */ jsxDEV(Reason, { children: up.error }, void 0, false, {
|
|
1349
|
-
fileName: _jsxFileName,
|
|
1350
|
-
lineNumber: 894,
|
|
1351
|
-
columnNumber: 21
|
|
1352
|
-
}, this) : null
|
|
921
|
+
})] })]
|
|
922
|
+
}),
|
|
923
|
+
up.error ? /* @__PURE__ */ jsx(Reason, { children: up.error }) : null
|
|
1353
924
|
]
|
|
1354
|
-
},
|
|
1355
|
-
|
|
1356
|
-
lineNumber: 794,
|
|
1357
|
-
columnNumber: 7
|
|
1358
|
-
}, this),
|
|
1359
|
-
/* @__PURE__ */ jsxDEV(PopoverContent, {
|
|
925
|
+
}),
|
|
926
|
+
/* @__PURE__ */ jsx(PopoverContent, {
|
|
1360
927
|
className: "w-[320px]",
|
|
1361
928
|
align: "start",
|
|
1362
929
|
side: "bottom",
|
|
1363
|
-
children: /* @__PURE__ */
|
|
930
|
+
children: /* @__PURE__ */ jsx(ImageDetails, {
|
|
1364
931
|
v,
|
|
1365
932
|
onChange,
|
|
1366
933
|
readOnly,
|
|
@@ -1370,44 +937,28 @@ function ImageControl({ field, value, onChange: write, readOnly, id, path }) {
|
|
|
1370
937
|
size,
|
|
1371
938
|
asset,
|
|
1372
939
|
fit
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
columnNumber: 9
|
|
1377
|
-
}, this)
|
|
1378
|
-
}, void 0, false, {
|
|
1379
|
-
fileName: _jsxFileName,
|
|
1380
|
-
lineNumber: 896,
|
|
1381
|
-
columnNumber: 7
|
|
1382
|
-
}, this),
|
|
1383
|
-
/* @__PURE__ */ jsxDEV(MediaPicker, {
|
|
940
|
+
})
|
|
941
|
+
}),
|
|
942
|
+
/* @__PURE__ */ jsx(MediaPicker, {
|
|
1384
943
|
open: picker,
|
|
1385
944
|
onOpenChange: setPicker,
|
|
1386
945
|
accept: kinds,
|
|
1387
946
|
onPick: (a) => a[0] && replace(a[0])
|
|
1388
|
-
}
|
|
1389
|
-
fileName: _jsxFileName,
|
|
1390
|
-
lineNumber: 899,
|
|
1391
|
-
columnNumber: 7
|
|
1392
|
-
}, this)
|
|
947
|
+
})
|
|
1393
948
|
]
|
|
1394
|
-
}
|
|
1395
|
-
fileName: _jsxFileName,
|
|
1396
|
-
lineNumber: 793,
|
|
1397
|
-
columnNumber: 5
|
|
1398
|
-
}, this);
|
|
949
|
+
});
|
|
1399
950
|
}
|
|
1400
951
|
function Thumb({ item, label, readOnly, sort, onRemove, onOpen, fit: known }) {
|
|
1401
952
|
const { src } = useMedia();
|
|
1402
953
|
const { fit, ref, onLoad } = useLoadedFit(known, item.v.url);
|
|
1403
954
|
const handle = sort.handle(item.key);
|
|
1404
|
-
return /* @__PURE__ */
|
|
955
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1405
956
|
ref: sort.register(item.key),
|
|
1406
957
|
role: "listitem",
|
|
1407
958
|
style: sort.style(item.key),
|
|
1408
959
|
className: cn("group/thumb relative aspect-square cursor-grab touch-none overflow-hidden rounded-kit-md border border-kit-line active:cursor-grabbing", fit === "contain" ? CHECKER : "bg-kit-muted", sort.active === item.key && "z-10 opacity-90 shadow-kit-lg ring-2 ring-kit-line-strong"),
|
|
1409
960
|
children: [
|
|
1410
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ jsx("div", {
|
|
1411
962
|
...readOnly ? {} : handle,
|
|
1412
963
|
role: void 0,
|
|
1413
964
|
tabIndex: 0,
|
|
@@ -1427,7 +978,7 @@ function Thumb({ item, label, readOnly, sort, onRemove, onOpen, fit: known }) {
|
|
|
1427
978
|
if (!readOnly) handle.onKeyDown(e);
|
|
1428
979
|
},
|
|
1429
980
|
className: "size-full outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-kit-focus-ring focus-visible:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:outline-none",
|
|
1430
|
-
children: /* @__PURE__ */
|
|
981
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
1431
982
|
src: src(item.v.url),
|
|
1432
983
|
alt: item.v.alt ?? "",
|
|
1433
984
|
ref,
|
|
@@ -1435,26 +986,14 @@ function Thumb({ item, label, readOnly, sort, onRemove, onOpen, fit: known }) {
|
|
|
1435
986
|
"data-slot": "kit-gallery-thumb",
|
|
1436
987
|
className: cn("pointer-events-none size-full select-none", fit === "contain" ? "object-contain" : "object-cover"),
|
|
1437
988
|
draggable: false
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
columnNumber: 9
|
|
1442
|
-
}, this)
|
|
1443
|
-
}, void 0, false, {
|
|
1444
|
-
fileName: _jsxFileName,
|
|
1445
|
-
lineNumber: 940,
|
|
1446
|
-
columnNumber: 7
|
|
1447
|
-
}, this),
|
|
1448
|
-
!item.v.alt ? /* @__PURE__ */ jsxDEV("span", {
|
|
989
|
+
})
|
|
990
|
+
}),
|
|
991
|
+
!item.v.alt ? /* @__PURE__ */ jsx("span", {
|
|
1449
992
|
role: "img",
|
|
1450
993
|
className: "absolute bottom-1 left-1 size-1.5 rounded-full bg-kit-warning ring-2 ring-kit-surface",
|
|
1451
994
|
"aria-label": "No alt text"
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
|
-
lineNumber: 963,
|
|
1455
|
-
columnNumber: 22
|
|
1456
|
-
}, this) : null,
|
|
1457
|
-
readOnly ? null : /* @__PURE__ */ jsxDEV("button", {
|
|
995
|
+
}) : null,
|
|
996
|
+
readOnly ? null : /* @__PURE__ */ jsx("button", {
|
|
1458
997
|
type: "button",
|
|
1459
998
|
"aria-label": (() => {
|
|
1460
999
|
const what = item.v.alt || item.v.name || fileNameFromUrl(item.v.url);
|
|
@@ -1463,26 +1002,14 @@ function Thumb({ item, label, readOnly, sort, onRemove, onOpen, fit: known }) {
|
|
|
1463
1002
|
onPointerDown: (e) => e.stopPropagation(),
|
|
1464
1003
|
onClick: onRemove,
|
|
1465
1004
|
className: "absolute right-1 top-1 flex size-6 items-center justify-center rounded-kit-md bg-kit-inverse/80 text-kit-fg-inverse opacity-0 transition-opacity focus-visible:opacity-100 group-hover/thumb:opacity-100 pointer-coarse:opacity-100",
|
|
1466
|
-
children: /* @__PURE__ */
|
|
1005
|
+
children: /* @__PURE__ */ jsx(IconX, {
|
|
1467
1006
|
className: "size-3.5",
|
|
1468
1007
|
stroke: 1.5,
|
|
1469
1008
|
"aria-hidden": true
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
lineNumber: 976,
|
|
1473
|
-
columnNumber: 11
|
|
1474
|
-
}, this)
|
|
1475
|
-
}, void 0, false, {
|
|
1476
|
-
fileName: _jsxFileName,
|
|
1477
|
-
lineNumber: 965,
|
|
1478
|
-
columnNumber: 9
|
|
1479
|
-
}, this)
|
|
1009
|
+
})
|
|
1010
|
+
})
|
|
1480
1011
|
]
|
|
1481
|
-
}
|
|
1482
|
-
fileName: _jsxFileName,
|
|
1483
|
-
lineNumber: 929,
|
|
1484
|
-
columnNumber: 5
|
|
1485
|
-
}, this);
|
|
1012
|
+
});
|
|
1486
1013
|
}
|
|
1487
1014
|
/** An array of images: a sortable grid of tiles with a dashed "Add images" tile last (hidden at `max`). */
|
|
1488
1015
|
function GalleryControl({ value, onChange, readOnly, field, id, path }) {
|
|
@@ -1520,15 +1047,15 @@ function GalleryControl({ value, onChange, readOnly, field, id, path }) {
|
|
|
1520
1047
|
const max = field.validation?.max;
|
|
1521
1048
|
const canAdd = !readOnly && (max == null || items.length < max) && (s.MediaPicker || up.run);
|
|
1522
1049
|
const noun = (i, it) => it.v.name ?? (fileNameFromUrl(it.v.url) || `Image ${i + 1}`);
|
|
1523
|
-
return /* @__PURE__ */
|
|
1050
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1524
1051
|
className: "flex flex-col gap-2",
|
|
1525
1052
|
children: [
|
|
1526
|
-
/* @__PURE__ */
|
|
1053
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1527
1054
|
id,
|
|
1528
1055
|
role: "list",
|
|
1529
1056
|
"aria-label": field.title,
|
|
1530
1057
|
className: "grid grid-cols-3 gap-1.5 @[520px]:grid-cols-5",
|
|
1531
|
-
children: [items.map((it, i) => /* @__PURE__ */
|
|
1058
|
+
children: [items.map((it, i) => /* @__PURE__ */ jsx(Thumb, {
|
|
1532
1059
|
item: it,
|
|
1533
1060
|
fit: fitOf(it.raw, field, void 0, true),
|
|
1534
1061
|
label: noun(i, it),
|
|
@@ -1540,14 +1067,10 @@ function GalleryControl({ value, onChange, readOnly, field, id, path }) {
|
|
|
1540
1067
|
title: noun(i, it)
|
|
1541
1068
|
}) : window.open(src(it.v.url), "_blank", "noopener"),
|
|
1542
1069
|
onRemove: () => write(raw.filter((_, j) => j !== i))
|
|
1543
|
-
}, it.key,
|
|
1544
|
-
fileName: _jsxFileName,
|
|
1545
|
-
lineNumber: 1022,
|
|
1546
|
-
columnNumber: 11
|
|
1547
|
-
}, this)), canAdd ? /* @__PURE__ */ jsxDEV("div", {
|
|
1070
|
+
}, it.key)), canAdd ? /* @__PURE__ */ jsx("div", {
|
|
1548
1071
|
role: "listitem",
|
|
1549
1072
|
className: "grid",
|
|
1550
|
-
children: /* @__PURE__ */
|
|
1073
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
1551
1074
|
type: "button",
|
|
1552
1075
|
onClick: () => s.MediaPicker ? setPicker(true) : up.run && document.getElementById(`${id}-files`)?.click(),
|
|
1553
1076
|
onPaste: (e) => {
|
|
@@ -1564,32 +1087,16 @@ function GalleryControl({ value, onChange, readOnly, field, id, path }) {
|
|
|
1564
1087
|
up.run(Array.from(e.dataTransfer.files));
|
|
1565
1088
|
},
|
|
1566
1089
|
className: "flex aspect-square flex-col items-center justify-center gap-1 rounded-kit-md border border-dashed border-kit-line-strong bg-kit-subtle text-kit-xs text-kit-fg-3 transition-colors hover:border-kit-field-border-hover hover:text-kit-fg",
|
|
1567
|
-
children: [/* @__PURE__ */
|
|
1090
|
+
children: [/* @__PURE__ */ jsx(IconPlus, {
|
|
1568
1091
|
className: "size-4",
|
|
1569
1092
|
stroke: 1.5,
|
|
1570
1093
|
"aria-hidden": true
|
|
1571
|
-
},
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
}, this), "Add images"]
|
|
1576
|
-
}, void 0, true, {
|
|
1577
|
-
fileName: _jsxFileName,
|
|
1578
|
-
lineNumber: 1039,
|
|
1579
|
-
columnNumber: 13
|
|
1580
|
-
}, this)
|
|
1581
|
-
}, void 0, false, {
|
|
1582
|
-
fileName: _jsxFileName,
|
|
1583
|
-
lineNumber: 1038,
|
|
1584
|
-
columnNumber: 11
|
|
1585
|
-
}, this) : null]
|
|
1586
|
-
}, void 0, true, {
|
|
1587
|
-
fileName: _jsxFileName,
|
|
1588
|
-
lineNumber: 1020,
|
|
1589
|
-
columnNumber: 7
|
|
1590
|
-
}, this),
|
|
1094
|
+
}), "Add images"]
|
|
1095
|
+
})
|
|
1096
|
+
}) : null]
|
|
1097
|
+
}),
|
|
1591
1098
|
sort.a11y,
|
|
1592
|
-
up.run && !s.MediaPicker ? /* @__PURE__ */
|
|
1099
|
+
up.run && !s.MediaPicker ? /* @__PURE__ */ jsx("input", {
|
|
1593
1100
|
id: `${id}-files`,
|
|
1594
1101
|
type: "file",
|
|
1595
1102
|
hidden: true,
|
|
@@ -1601,51 +1108,27 @@ function GalleryControl({ value, onChange, readOnly, field, id, path }) {
|
|
|
1601
1108
|
up.run?.(Array.from(e.target.files ?? []));
|
|
1602
1109
|
e.target.value = "";
|
|
1603
1110
|
}
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
lineNumber: 1065,
|
|
1607
|
-
columnNumber: 9
|
|
1608
|
-
}, this) : null,
|
|
1609
|
-
up.progress != null ? /* @__PURE__ */ jsxDEV(Progress, {
|
|
1111
|
+
}) : null,
|
|
1112
|
+
up.progress != null ? /* @__PURE__ */ jsx(Progress, {
|
|
1610
1113
|
value: up.progress,
|
|
1611
1114
|
tone: "ink",
|
|
1612
1115
|
size: "sm",
|
|
1613
1116
|
label: "Upload progress"
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
columnNumber: 30
|
|
1618
|
-
}, this) : null,
|
|
1619
|
-
up.error ? /* @__PURE__ */ jsxDEV(Reason, { children: up.error }, void 0, false, {
|
|
1620
|
-
fileName: _jsxFileName,
|
|
1621
|
-
lineNumber: 1080,
|
|
1622
|
-
columnNumber: 19
|
|
1623
|
-
}, this) : null,
|
|
1624
|
-
!readOnly && !s.MediaPicker && !up.run ? /* @__PURE__ */ jsxDEV(Reason, {
|
|
1117
|
+
}) : null,
|
|
1118
|
+
up.error ? /* @__PURE__ */ jsx(Reason, { children: up.error }) : null,
|
|
1119
|
+
!readOnly && !s.MediaPicker && !up.run ? /* @__PURE__ */ jsx(Reason, {
|
|
1625
1120
|
tone: "muted",
|
|
1626
1121
|
children: NO_SOURCE
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
lineNumber: 1081,
|
|
1630
|
-
columnNumber: 49
|
|
1631
|
-
}, this) : null,
|
|
1632
|
-
/* @__PURE__ */ jsxDEV(MediaPicker, {
|
|
1122
|
+
}) : null,
|
|
1123
|
+
/* @__PURE__ */ jsx(MediaPicker, {
|
|
1633
1124
|
open: picker,
|
|
1634
1125
|
onOpenChange: setPicker,
|
|
1635
1126
|
multiple: true,
|
|
1636
1127
|
accept: ["image", "svg"],
|
|
1637
1128
|
onPick: (a) => a.length && add(max != null ? a.slice(0, Math.max(0, max - items.length)) : a)
|
|
1638
|
-
}
|
|
1639
|
-
fileName: _jsxFileName,
|
|
1640
|
-
lineNumber: 1082,
|
|
1641
|
-
columnNumber: 7
|
|
1642
|
-
}, this)
|
|
1129
|
+
})
|
|
1643
1130
|
]
|
|
1644
|
-
}
|
|
1645
|
-
fileName: _jsxFileName,
|
|
1646
|
-
lineNumber: 1019,
|
|
1647
|
-
columnNumber: 5
|
|
1648
|
-
}, this);
|
|
1131
|
+
});
|
|
1649
1132
|
}
|
|
1650
1133
|
var normFile = (v) => {
|
|
1651
1134
|
if (typeof v === "string") return v ? { url: v } : null;
|
|
@@ -1666,173 +1149,89 @@ function FileControl({ value, onChange, readOnly, id }) {
|
|
|
1666
1149
|
const [picker, setPicker] = React.useState(false);
|
|
1667
1150
|
const up = useUpload("*", "file", (a) => a[0] && onChange(fileFromAsset(a[0])));
|
|
1668
1151
|
const library = s.MediaPicker && !readOnly ? () => setPicker(true) : void 0;
|
|
1669
|
-
const pickerEl = /* @__PURE__ */
|
|
1152
|
+
const pickerEl = /* @__PURE__ */ jsx(MediaPicker, {
|
|
1670
1153
|
open: picker,
|
|
1671
1154
|
onOpenChange: setPicker,
|
|
1672
1155
|
accept: ["file"],
|
|
1673
1156
|
onPick: (a) => a[0] && onChange(fileFromAsset(a[0]))
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
lineNumber: 1103,
|
|
1677
|
-
columnNumber: 20
|
|
1678
|
-
}, this);
|
|
1679
|
-
if (!v) return /* @__PURE__ */ jsxDEV("div", {
|
|
1157
|
+
});
|
|
1158
|
+
if (!v) return /* @__PURE__ */ jsxs("div", {
|
|
1680
1159
|
className: "flex flex-col gap-1.5",
|
|
1681
1160
|
children: [
|
|
1682
|
-
/* @__PURE__ */
|
|
1161
|
+
/* @__PURE__ */ jsx(DropWell, {
|
|
1683
1162
|
id,
|
|
1684
1163
|
title: "Add a file",
|
|
1685
1164
|
hint: "Or drop or paste one here",
|
|
1686
1165
|
accept: "*",
|
|
1687
|
-
icon: /* @__PURE__ */
|
|
1688
|
-
fileName: _jsxFileName,
|
|
1689
|
-
lineNumber: 1107,
|
|
1690
|
-
columnNumber: 96
|
|
1691
|
-
}, this),
|
|
1166
|
+
icon: /* @__PURE__ */ jsx(IconFileText, { stroke: 1.5 }),
|
|
1692
1167
|
onFiles: up.run,
|
|
1693
1168
|
onLibrary: library,
|
|
1694
1169
|
refuse: up.setError,
|
|
1695
1170
|
disabled: readOnly,
|
|
1696
1171
|
progress: up.progress
|
|
1697
|
-
},
|
|
1698
|
-
|
|
1699
|
-
lineNumber: 1107,
|
|
1700
|
-
columnNumber: 9
|
|
1701
|
-
}, this),
|
|
1702
|
-
up.error ? /* @__PURE__ */ jsxDEV(Reason, { children: up.error }, void 0, false, {
|
|
1703
|
-
fileName: _jsxFileName,
|
|
1704
|
-
lineNumber: 1108,
|
|
1705
|
-
columnNumber: 21
|
|
1706
|
-
}, this) : null,
|
|
1172
|
+
}),
|
|
1173
|
+
up.error ? /* @__PURE__ */ jsx(Reason, { children: up.error }) : null,
|
|
1707
1174
|
pickerEl
|
|
1708
1175
|
]
|
|
1709
|
-
}
|
|
1710
|
-
fileName: _jsxFileName,
|
|
1711
|
-
lineNumber: 1106,
|
|
1712
|
-
columnNumber: 7
|
|
1713
|
-
}, this);
|
|
1176
|
+
});
|
|
1714
1177
|
const name = asset?.name ?? v.name ?? fileNameFromUrl(v.url);
|
|
1715
1178
|
const ext = (name.includes(".") ? name.split(".").pop() : "")?.toUpperCase() || "FILE";
|
|
1716
1179
|
const meta = [ext.toLowerCase(), asset?.size ? formatBytes(asset.size) : null].filter(Boolean).join(" · ");
|
|
1717
|
-
return /* @__PURE__ */
|
|
1180
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1718
1181
|
className: "flex items-center gap-3 rounded-kit-lg border border-kit-line bg-kit-control-bg p-2",
|
|
1719
1182
|
children: [
|
|
1720
|
-
/* @__PURE__ */
|
|
1183
|
+
/* @__PURE__ */ jsx("span", {
|
|
1721
1184
|
"aria-hidden": true,
|
|
1722
1185
|
className: "flex size-14 shrink-0 items-center justify-center rounded-kit-md border border-kit-line bg-kit-subtle font-kit-mono text-kit-2xs font-medium text-kit-fg-2",
|
|
1723
1186
|
children: ext
|
|
1724
|
-
},
|
|
1725
|
-
|
|
1726
|
-
lineNumber: 1117,
|
|
1727
|
-
columnNumber: 7
|
|
1728
|
-
}, this),
|
|
1729
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
1187
|
+
}),
|
|
1188
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1730
1189
|
className: "min-w-0 flex-1",
|
|
1731
|
-
children: [/* @__PURE__ */
|
|
1190
|
+
children: [/* @__PURE__ */ jsx("a", {
|
|
1732
1191
|
id,
|
|
1733
1192
|
href: src(v.url),
|
|
1734
1193
|
target: "_blank",
|
|
1735
1194
|
rel: "noreferrer",
|
|
1736
1195
|
className: "block truncate text-kit-sm font-medium text-kit-accent-fg hover:underline",
|
|
1737
1196
|
children: name
|
|
1738
|
-
},
|
|
1739
|
-
fileName: _jsxFileName,
|
|
1740
|
-
lineNumber: 1121,
|
|
1741
|
-
columnNumber: 9
|
|
1742
|
-
}, this), /* @__PURE__ */ jsxDEV("div", {
|
|
1197
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1743
1198
|
className: "text-kit-xs text-kit-fg-3",
|
|
1744
1199
|
children: meta
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
columnNumber: 9
|
|
1749
|
-
}, this)]
|
|
1750
|
-
}, void 0, true, {
|
|
1751
|
-
fileName: _jsxFileName,
|
|
1752
|
-
lineNumber: 1120,
|
|
1753
|
-
columnNumber: 7
|
|
1754
|
-
}, this),
|
|
1755
|
-
library ? /* @__PURE__ */ jsxDEV(Button, {
|
|
1200
|
+
})]
|
|
1201
|
+
}),
|
|
1202
|
+
library ? /* @__PURE__ */ jsx(Button, {
|
|
1756
1203
|
size: "sm",
|
|
1757
1204
|
variant: "ghost",
|
|
1758
1205
|
onClick: library,
|
|
1759
1206
|
children: "Replace"
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
columnNumber: 9
|
|
1764
|
-
}, this) : null,
|
|
1765
|
-
/* @__PURE__ */ jsxDEV(Menu, { children: [/* @__PURE__ */ jsxDEV(MenuTrigger, {
|
|
1766
|
-
render: /* @__PURE__ */ jsxDEV(IconButton, {
|
|
1207
|
+
}) : null,
|
|
1208
|
+
/* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
1209
|
+
render: /* @__PURE__ */ jsx(IconButton, {
|
|
1767
1210
|
label: "File actions",
|
|
1768
1211
|
size: "sm"
|
|
1769
|
-
},
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
columnNumber: 30
|
|
1773
|
-
}, this),
|
|
1774
|
-
children: /* @__PURE__ */ jsxDEV(IconDots, { stroke: 1.5 }, void 0, false, {
|
|
1775
|
-
fileName: _jsxFileName,
|
|
1776
|
-
lineNumber: 1133,
|
|
1777
|
-
columnNumber: 11
|
|
1778
|
-
}, this)
|
|
1779
|
-
}, void 0, false, {
|
|
1780
|
-
fileName: _jsxFileName,
|
|
1781
|
-
lineNumber: 1132,
|
|
1782
|
-
columnNumber: 9
|
|
1783
|
-
}, this), /* @__PURE__ */ jsxDEV(MenuContent, {
|
|
1212
|
+
}),
|
|
1213
|
+
children: /* @__PURE__ */ jsx(IconDots, { stroke: 1.5 })
|
|
1214
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
1784
1215
|
align: "end",
|
|
1785
1216
|
children: [
|
|
1786
|
-
/* @__PURE__ */
|
|
1787
|
-
icon: /* @__PURE__ */
|
|
1788
|
-
fileName: _jsxFileName,
|
|
1789
|
-
lineNumber: 1136,
|
|
1790
|
-
columnNumber: 27
|
|
1791
|
-
}, this),
|
|
1217
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
1218
|
+
icon: /* @__PURE__ */ jsx(IconDownload, { stroke: 1.5 }),
|
|
1792
1219
|
onClick: () => window.open(src(v.url), "_blank", "noopener"),
|
|
1793
1220
|
children: "Open"
|
|
1794
|
-
},
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
columnNumber: 11
|
|
1798
|
-
}, this),
|
|
1799
|
-
/* @__PURE__ */ jsxDEV(MenuSeparator, {}, void 0, false, {
|
|
1800
|
-
fileName: _jsxFileName,
|
|
1801
|
-
lineNumber: 1139,
|
|
1802
|
-
columnNumber: 11
|
|
1803
|
-
}, this),
|
|
1804
|
-
/* @__PURE__ */ jsxDEV(MenuItem, {
|
|
1221
|
+
}),
|
|
1222
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
1223
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
1805
1224
|
danger: true,
|
|
1806
|
-
icon: /* @__PURE__ */
|
|
1807
|
-
fileName: _jsxFileName,
|
|
1808
|
-
lineNumber: 1140,
|
|
1809
|
-
columnNumber: 34
|
|
1810
|
-
}, this),
|
|
1225
|
+
icon: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 }),
|
|
1811
1226
|
disabled: readOnly,
|
|
1812
1227
|
onClick: () => !readOnly && onChange(null),
|
|
1813
1228
|
children: "Remove"
|
|
1814
|
-
}
|
|
1815
|
-
fileName: _jsxFileName,
|
|
1816
|
-
lineNumber: 1140,
|
|
1817
|
-
columnNumber: 11
|
|
1818
|
-
}, this)
|
|
1229
|
+
})
|
|
1819
1230
|
]
|
|
1820
|
-
}
|
|
1821
|
-
fileName: _jsxFileName,
|
|
1822
|
-
lineNumber: 1135,
|
|
1823
|
-
columnNumber: 9
|
|
1824
|
-
}, this)] }, void 0, true, {
|
|
1825
|
-
fileName: _jsxFileName,
|
|
1826
|
-
lineNumber: 1131,
|
|
1827
|
-
columnNumber: 7
|
|
1828
|
-
}, this),
|
|
1231
|
+
})] }),
|
|
1829
1232
|
pickerEl
|
|
1830
1233
|
]
|
|
1831
|
-
}
|
|
1832
|
-
fileName: _jsxFileName,
|
|
1833
|
-
lineNumber: 1116,
|
|
1834
|
-
columnNumber: 5
|
|
1835
|
-
}, this);
|
|
1234
|
+
});
|
|
1836
1235
|
}
|
|
1837
1236
|
var videoProvider = (url) => /youtu/.test(url) ? "YouTube" : /vimeo/.test(url) ? "Vimeo" : /loom/.test(url) ? "Loom" : /\.(mp4|webm|mov)(\?|$)/i.test(url) ? "MP4" : url ? "Link" : "";
|
|
1838
1237
|
var youTubeId = (url) => url.match(/(?:youtu\.be\/|v=|embed\/|shorts\/)([\w-]{11})/)?.[1];
|
|
@@ -1843,89 +1242,53 @@ function VideoPreview({ url, poster, title }) {
|
|
|
1843
1242
|
React.useEffect(() => setPlaying(false), [url]);
|
|
1844
1243
|
const yt = youTubeId(url);
|
|
1845
1244
|
const thumb = poster ? src(poster) : yt ? `https://i.ytimg.com/vi/${yt}/hqdefault.jpg` : void 0;
|
|
1846
|
-
if (playing && yt) return /* @__PURE__ */
|
|
1245
|
+
if (playing && yt) return /* @__PURE__ */ jsx("iframe", {
|
|
1847
1246
|
title,
|
|
1848
1247
|
src: `https://www.youtube-nocookie.com/embed/${yt}?autoplay=1`,
|
|
1849
1248
|
allow: "autoplay; encrypted-media",
|
|
1850
1249
|
className: "aspect-video w-full rounded-kit-lg border border-kit-line"
|
|
1851
|
-
}
|
|
1852
|
-
|
|
1853
|
-
lineNumber: 1163,
|
|
1854
|
-
columnNumber: 12
|
|
1855
|
-
}, this);
|
|
1856
|
-
if (playing && isFileVideo(url)) return /* @__PURE__ */ jsxDEV("video", {
|
|
1250
|
+
});
|
|
1251
|
+
if (playing && isFileVideo(url)) return /* @__PURE__ */ jsx("video", {
|
|
1857
1252
|
src: src(url),
|
|
1858
1253
|
poster: thumb,
|
|
1859
1254
|
controls: true,
|
|
1860
1255
|
autoPlay: true,
|
|
1861
1256
|
className: "aspect-video w-full rounded-kit-lg border border-kit-line bg-kit-media-backdrop"
|
|
1862
|
-
}
|
|
1863
|
-
fileName: _jsxFileName,
|
|
1864
|
-
lineNumber: 1164,
|
|
1865
|
-
columnNumber: 43
|
|
1866
|
-
}, this);
|
|
1257
|
+
});
|
|
1867
1258
|
const playable = !!yt || isFileVideo(url);
|
|
1868
|
-
return /* @__PURE__ */
|
|
1259
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1869
1260
|
className: "relative aspect-video overflow-hidden rounded-kit-lg border border-kit-line bg-kit-media-backdrop",
|
|
1870
1261
|
children: [
|
|
1871
|
-
thumb ? /* @__PURE__ */
|
|
1262
|
+
thumb ? /* @__PURE__ */ jsx("img", {
|
|
1872
1263
|
src: thumb,
|
|
1873
1264
|
alt: `${title} poster`,
|
|
1874
1265
|
className: "size-full object-cover opacity-85"
|
|
1875
|
-
}
|
|
1876
|
-
|
|
1877
|
-
lineNumber: 1168,
|
|
1878
|
-
columnNumber: 16
|
|
1879
|
-
}, this) : null,
|
|
1880
|
-
/* @__PURE__ */ jsxDEV("button", {
|
|
1266
|
+
}) : null,
|
|
1267
|
+
/* @__PURE__ */ jsx("button", {
|
|
1881
1268
|
type: "button",
|
|
1882
1269
|
"aria-label": playable ? "Play preview" : "Open video link",
|
|
1883
1270
|
onClick: () => playable ? setPlaying(true) : window.open(src(url), "_blank", "noopener"),
|
|
1884
1271
|
className: "absolute inset-0 m-auto flex size-12 items-center justify-center rounded-full bg-kit-media-control text-kit-media-control-fg shadow-kit-lg transition-transform hover:scale-105",
|
|
1885
|
-
children: playable ? /* @__PURE__ */
|
|
1272
|
+
children: playable ? /* @__PURE__ */ jsx(IconPlayerPlay, {
|
|
1886
1273
|
className: "size-5",
|
|
1887
1274
|
stroke: 1.5,
|
|
1888
1275
|
"aria-hidden": true
|
|
1889
|
-
}
|
|
1890
|
-
fileName: _jsxFileName,
|
|
1891
|
-
lineNumber: 1175,
|
|
1892
|
-
columnNumber: 21
|
|
1893
|
-
}, this) : /* @__PURE__ */ jsxDEV(IconExternalLink, {
|
|
1276
|
+
}) : /* @__PURE__ */ jsx(IconExternalLink, {
|
|
1894
1277
|
className: "size-5",
|
|
1895
1278
|
stroke: 1.5,
|
|
1896
1279
|
"aria-hidden": true
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
columnNumber: 86
|
|
1901
|
-
}, this)
|
|
1902
|
-
}, void 0, false, {
|
|
1903
|
-
fileName: _jsxFileName,
|
|
1904
|
-
lineNumber: 1169,
|
|
1905
|
-
columnNumber: 7
|
|
1906
|
-
}, this),
|
|
1907
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
1280
|
+
})
|
|
1281
|
+
}),
|
|
1282
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1908
1283
|
className: "absolute left-2 top-2 inline-flex items-center gap-1 rounded-kit-md bg-kit-scrim px-1.5 py-0.5 text-kit-xs text-kit-on-scrim",
|
|
1909
|
-
children: [/* @__PURE__ */
|
|
1284
|
+
children: [/* @__PURE__ */ jsx(IconVideo, {
|
|
1910
1285
|
className: "size-3.5",
|
|
1911
1286
|
stroke: 1.5,
|
|
1912
1287
|
"aria-hidden": true
|
|
1913
|
-
},
|
|
1914
|
-
|
|
1915
|
-
lineNumber: 1178,
|
|
1916
|
-
columnNumber: 9
|
|
1917
|
-
}, this), videoProvider(url)]
|
|
1918
|
-
}, void 0, true, {
|
|
1919
|
-
fileName: _jsxFileName,
|
|
1920
|
-
lineNumber: 1177,
|
|
1921
|
-
columnNumber: 7
|
|
1922
|
-
}, this)
|
|
1288
|
+
}), videoProvider(url)]
|
|
1289
|
+
})
|
|
1923
1290
|
]
|
|
1924
|
-
}
|
|
1925
|
-
fileName: _jsxFileName,
|
|
1926
|
-
lineNumber: 1167,
|
|
1927
|
-
columnNumber: 5
|
|
1928
|
-
}, this);
|
|
1291
|
+
});
|
|
1929
1292
|
}
|
|
1930
1293
|
/**
|
|
1931
1294
|
* A URL input with a live preview. The value keeps its stored shape: a URL string stays a string, a `{ url, poster… }`
|
|
@@ -1949,10 +1312,10 @@ function VideoControl({ field, value, onChange, readOnly, id, onBlur }) {
|
|
|
1949
1312
|
};
|
|
1950
1313
|
const bad = draft.trim() !== "" && !isVideoUrl(draft);
|
|
1951
1314
|
const errorId = `${id}-error`;
|
|
1952
|
-
return /* @__PURE__ */
|
|
1315
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1953
1316
|
className: "flex flex-col gap-2",
|
|
1954
1317
|
children: [
|
|
1955
|
-
/* @__PURE__ */
|
|
1318
|
+
/* @__PURE__ */ jsx(Input, {
|
|
1956
1319
|
id,
|
|
1957
1320
|
value: draft,
|
|
1958
1321
|
readOnly,
|
|
@@ -1969,52 +1332,28 @@ function VideoControl({ field, value, onChange, readOnly, id, onBlur }) {
|
|
|
1969
1332
|
}
|
|
1970
1333
|
},
|
|
1971
1334
|
placeholder: "Paste a YouTube, Vimeo, Loom or MP4 link",
|
|
1972
|
-
leading: /* @__PURE__ */
|
|
1973
|
-
fileName: _jsxFileName,
|
|
1974
|
-
lineNumber: 1223,
|
|
1975
|
-
columnNumber: 18
|
|
1976
|
-
}, this),
|
|
1335
|
+
leading: /* @__PURE__ */ jsx(IconWorld, { stroke: 1.5 }),
|
|
1977
1336
|
onChange: (e) => {
|
|
1978
1337
|
setDraft(e.target.value);
|
|
1979
1338
|
commit(e.target.value);
|
|
1980
1339
|
}
|
|
1981
|
-
},
|
|
1982
|
-
|
|
1983
|
-
lineNumber: 1206,
|
|
1984
|
-
columnNumber: 7
|
|
1985
|
-
}, this),
|
|
1986
|
-
bad && touched ? /* @__PURE__ */ jsxDEV("p", {
|
|
1340
|
+
}),
|
|
1341
|
+
bad && touched ? /* @__PURE__ */ jsx("p", {
|
|
1987
1342
|
id: errorId,
|
|
1988
1343
|
role: "alert",
|
|
1989
1344
|
className: "text-kit-xs text-kit-danger-fg",
|
|
1990
1345
|
children: "Not saved: use a full link starting with https://, or a site path starting with /."
|
|
1991
|
-
}
|
|
1992
|
-
|
|
1993
|
-
lineNumber: 1230,
|
|
1994
|
-
columnNumber: 9
|
|
1995
|
-
}, this) : null,
|
|
1996
|
-
stored ? /* @__PURE__ */ jsxDEV(VideoPreview, {
|
|
1346
|
+
}) : null,
|
|
1347
|
+
stored ? /* @__PURE__ */ jsx(VideoPreview, {
|
|
1997
1348
|
url: stored,
|
|
1998
1349
|
poster: obj?.poster,
|
|
1999
1350
|
title: field.title
|
|
2000
|
-
}
|
|
2001
|
-
fileName: _jsxFileName,
|
|
2002
|
-
lineNumber: 1236,
|
|
2003
|
-
columnNumber: 17
|
|
2004
|
-
}, this) : /* @__PURE__ */ jsxDEV("p", {
|
|
1351
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
2005
1352
|
className: "text-kit-xs text-kit-fg-3",
|
|
2006
1353
|
children: "No video yet. The embed lazy-loads on the page, so it doesn't block the first paint."
|
|
2007
|
-
}
|
|
2008
|
-
fileName: _jsxFileName,
|
|
2009
|
-
lineNumber: 1236,
|
|
2010
|
-
columnNumber: 90
|
|
2011
|
-
}, this)
|
|
1354
|
+
})
|
|
2012
1355
|
]
|
|
2013
|
-
}
|
|
2014
|
-
fileName: _jsxFileName,
|
|
2015
|
-
lineNumber: 1205,
|
|
2016
|
-
columnNumber: 5
|
|
2017
|
-
}, this);
|
|
1356
|
+
});
|
|
2018
1357
|
}
|
|
2019
1358
|
//#endregion
|
|
2020
1359
|
export { FileControl, GalleryControl, ImageControl, MediaPicker, VideoControl, VideoPreview, acceptsFile, cropChoice, fileNameFromUrl, formatBytes, fromAsset, isVideoUrl, normImage, useUpload, videoProvider, withCrop, youTubeId };
|