@uipath/apollo-react 4.63.0 → 4.64.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.
@@ -0,0 +1,345 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button, Checkbox, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, Input, Label, RadioGroup, RadioGroupItem } from "@uipath/apollo-wind";
3
+ import { useId, useMemo, useState } from "react";
4
+ import { useSafeLingui } from "../../../i18n/index.js";
5
+ import { parseStickyNoteMediaUrl } from "./StickyNoteMedia.js";
6
+ function initialUrl(media) {
7
+ if (!media) return '';
8
+ return 'youtube' === media.kind ? `https://www.youtube.com/watch?v=${media.videoId}` : media.url;
9
+ }
10
+ function initialType(media) {
11
+ return media?.kind !== 'image' && media ? 'video' : 'image';
12
+ }
13
+ function StickyNoteMediaDialog({ initialMedia, onCancel, onSubmit }) {
14
+ const { _ } = useSafeLingui();
15
+ const urlId = useId();
16
+ const altId = useId();
17
+ const fullWidthId = useId();
18
+ const imageTypeId = useId();
19
+ const videoTypeId = useId();
20
+ const [mediaType, setMediaType] = useState(()=>initialType(initialMedia));
21
+ const [url, setUrl] = useState(()=>initialUrl(initialMedia));
22
+ const [alt, setAlt] = useState(()=>initialMedia?.kind === 'image' ? initialMedia.alt : '');
23
+ const [fullWidth, setFullWidth] = useState(initialMedia?.fullWidth ?? false);
24
+ const [touched, setTouched] = useState(false);
25
+ const [previewState, setPreviewState] = useState(()=>initialMedia?.kind !== 'youtube' && initialMedia ? 'loading' : 'loaded');
26
+ const parsed = useMemo(()=>parseStickyNoteMediaUrl(url, mediaType, {
27
+ alt: alt.trim(),
28
+ fullWidth
29
+ }), [
30
+ alt,
31
+ fullWidth,
32
+ mediaType,
33
+ url
34
+ ]);
35
+ const previewRequired = parsed.ok && 'youtube' !== parsed.value.kind;
36
+ const isEditing = void 0 !== initialMedia;
37
+ const validationMessage = (error)=>{
38
+ if ('invalid-youtube-url' === error) return _({
39
+ id: 'sticky-note.media.dialog.invalid-youtube',
40
+ message: 'Add a valid YouTube video URL'
41
+ });
42
+ if ('unsupported-video-url' === error) return _({
43
+ id: 'sticky-note.media.dialog.unsupported-video',
44
+ message: 'Add a YouTube URL or a direct public video file URL such as MP4'
45
+ });
46
+ return _({
47
+ id: 'sticky-note.media.dialog.invalid-url',
48
+ message: 'Enter a valid public HTTPS URL'
49
+ });
50
+ };
51
+ const error = url.trim() && !parsed.ok ? validationMessage(parsed.error) : null;
52
+ const canSubmit = parsed.ok && (!previewRequired || 'loaded' === previewState);
53
+ const resetPreview = (nextType, nextUrl)=>{
54
+ const next = parseStickyNoteMediaUrl(nextUrl, nextType);
55
+ setPreviewState(next.ok && 'youtube' === next.value.kind ? 'loaded' : 'loading');
56
+ };
57
+ return /*#__PURE__*/ jsx(Dialog, {
58
+ open: true,
59
+ onOpenChange: (open)=>{
60
+ if (!open) onCancel();
61
+ },
62
+ children: /*#__PURE__*/ jsxs(DialogContent, {
63
+ className: "sm:max-w-lg",
64
+ children: [
65
+ /*#__PURE__*/ jsxs(DialogHeader, {
66
+ children: [
67
+ /*#__PURE__*/ jsx(DialogTitle, {
68
+ children: isEditing ? _({
69
+ id: 'sticky-note.media.dialog.edit-title',
70
+ message: 'Edit media'
71
+ }) : _({
72
+ id: 'sticky-note.media.dialog.add-title',
73
+ message: 'Embed image or video'
74
+ })
75
+ }),
76
+ /*#__PURE__*/ jsx(DialogDescription, {
77
+ children: _({
78
+ id: "sticky-note.media.dialog.description",
79
+ message: 'Add a public link. Video supports YouTube and direct video files.'
80
+ })
81
+ })
82
+ ]
83
+ }),
84
+ /*#__PURE__*/ jsxs("form", {
85
+ className: "grid gap-4",
86
+ onSubmit: (event)=>{
87
+ event.preventDefault();
88
+ if (canSubmit && parsed.ok) onSubmit(parsed.value);
89
+ },
90
+ children: [
91
+ /*#__PURE__*/ jsxs("div", {
92
+ className: "flex flex-col gap-4 py-2",
93
+ children: [
94
+ /*#__PURE__*/ jsxs("fieldset", {
95
+ className: "m-0 border-0 p-0",
96
+ children: [
97
+ /*#__PURE__*/ jsx("legend", {
98
+ className: "mb-2 text-sm font-medium",
99
+ children: _({
100
+ id: 'sticky-note.media.dialog.type-label',
101
+ message: 'Media type'
102
+ })
103
+ }),
104
+ /*#__PURE__*/ jsxs(RadioGroup, {
105
+ value: mediaType,
106
+ onValueChange: (value)=>{
107
+ const nextType = value;
108
+ setMediaType(nextType);
109
+ setTouched(false);
110
+ resetPreview(nextType, url);
111
+ },
112
+ className: "flex gap-5",
113
+ children: [
114
+ /*#__PURE__*/ jsxs("div", {
115
+ className: "flex items-center gap-2",
116
+ children: [
117
+ /*#__PURE__*/ jsx(RadioGroupItem, {
118
+ value: "image",
119
+ id: imageTypeId
120
+ }),
121
+ /*#__PURE__*/ jsx(Label, {
122
+ htmlFor: imageTypeId,
123
+ children: _({
124
+ id: 'sticky-note.media.dialog.image-option',
125
+ message: 'Image'
126
+ })
127
+ })
128
+ ]
129
+ }),
130
+ /*#__PURE__*/ jsxs("div", {
131
+ className: "flex items-center gap-2",
132
+ children: [
133
+ /*#__PURE__*/ jsx(RadioGroupItem, {
134
+ value: "video",
135
+ id: videoTypeId
136
+ }),
137
+ /*#__PURE__*/ jsx(Label, {
138
+ htmlFor: videoTypeId,
139
+ children: _({
140
+ id: 'sticky-note.media.dialog.video-option',
141
+ message: 'Video'
142
+ })
143
+ })
144
+ ]
145
+ })
146
+ ]
147
+ })
148
+ ]
149
+ }),
150
+ /*#__PURE__*/ jsxs("div", {
151
+ className: "flex flex-col gap-1.5",
152
+ children: [
153
+ /*#__PURE__*/ jsx(Label, {
154
+ htmlFor: urlId,
155
+ children: 'image' === mediaType ? _({
156
+ id: 'sticky-note.media.dialog.image-url-label',
157
+ message: 'Image URL'
158
+ }) : _({
159
+ id: 'sticky-note.media.dialog.video-url-label',
160
+ message: 'Video URL'
161
+ })
162
+ }),
163
+ /*#__PURE__*/ jsx(Input, {
164
+ id: urlId,
165
+ type: "url",
166
+ autoFocus: true,
167
+ value: url,
168
+ placeholder: 'image' === mediaType ? _({
169
+ id: 'sticky-note.media.dialog.image-url-placeholder',
170
+ message: 'https://example.com/image.png'
171
+ }) : _({
172
+ id: 'sticky-note.media.dialog.video-url-placeholder',
173
+ message: 'https://youtube.com/watch?v=… or https://example.com/video.mp4'
174
+ }),
175
+ "aria-invalid": touched && Boolean(error),
176
+ "aria-describedby": `${urlId}-helper${touched && error ? ` ${urlId}-error` : ''}`,
177
+ onChange: (event)=>{
178
+ const nextUrl = event.target.value;
179
+ setUrl(nextUrl);
180
+ setTouched(true);
181
+ resetPreview(mediaType, nextUrl);
182
+ },
183
+ onBlur: ()=>setTouched(true)
184
+ }),
185
+ /*#__PURE__*/ jsx("p", {
186
+ id: `${urlId}-helper`,
187
+ className: "m-0 text-xs text-foreground-muted",
188
+ children: 'image' === mediaType ? _({
189
+ id: 'sticky-note.media.dialog.image-url-help',
190
+ message: 'Use a public HTTPS image link.'
191
+ }) : _({
192
+ id: 'sticky-note.media.dialog.video-url-help',
193
+ message: 'Use a YouTube link or a direct public HTTPS video file link.'
194
+ })
195
+ }),
196
+ touched && error && /*#__PURE__*/ jsx("p", {
197
+ id: `${urlId}-error`,
198
+ role: "alert",
199
+ className: "m-0 text-xs text-destructive",
200
+ children: error
201
+ })
202
+ ]
203
+ }),
204
+ 'image' === mediaType && /*#__PURE__*/ jsxs("div", {
205
+ className: "flex flex-col gap-1.5",
206
+ children: [
207
+ /*#__PURE__*/ jsx(Label, {
208
+ htmlFor: altId,
209
+ children: _({
210
+ id: 'sticky-note.media.dialog.alt-label',
211
+ message: 'Alternative text'
212
+ })
213
+ }),
214
+ /*#__PURE__*/ jsx(Input, {
215
+ id: altId,
216
+ value: alt,
217
+ onChange: (event)=>setAlt(event.target.value)
218
+ }),
219
+ /*#__PURE__*/ jsx("p", {
220
+ className: "m-0 text-xs text-foreground-muted",
221
+ children: _({
222
+ id: 'sticky-note.media.dialog.alt-help',
223
+ message: 'Describe the image for people who use screen readers.'
224
+ })
225
+ })
226
+ ]
227
+ }),
228
+ /*#__PURE__*/ jsxs("div", {
229
+ className: "flex items-start gap-2",
230
+ children: [
231
+ /*#__PURE__*/ jsx(Checkbox, {
232
+ id: fullWidthId,
233
+ checked: fullWidth,
234
+ onCheckedChange: (checked)=>setFullWidth(true === checked),
235
+ className: "mt-0.5"
236
+ }),
237
+ /*#__PURE__*/ jsxs("div", {
238
+ className: "flex flex-col gap-0.5",
239
+ children: [
240
+ /*#__PURE__*/ jsx(Label, {
241
+ htmlFor: fullWidthId,
242
+ className: "text-sm font-medium leading-none",
243
+ children: _({
244
+ id: 'sticky-note.media.dialog.full-width-label',
245
+ message: 'Make full width'
246
+ })
247
+ }),
248
+ /*#__PURE__*/ jsx("p", {
249
+ className: "m-0 text-xs text-foreground-muted",
250
+ children: _({
251
+ id: 'sticky-note.media.dialog.full-width-help',
252
+ message: 'The image or video spans the available width of the sticky note.'
253
+ })
254
+ })
255
+ ]
256
+ })
257
+ ]
258
+ }),
259
+ parsed.ok && /*#__PURE__*/ jsx("div", {
260
+ className: "rounded-md border border-border-subtle bg-surface p-3",
261
+ children: /*#__PURE__*/ jsx("div", {
262
+ className: "mx-auto max-w-full overflow-hidden rounded",
263
+ style: {
264
+ width: fullWidth ? '100%' : 'min(320px, 100%)'
265
+ },
266
+ children: 'failed' === previewState ? /*#__PURE__*/ jsx("div", {
267
+ role: "alert",
268
+ className: "flex min-h-24 items-center justify-center bg-black/10 px-3 text-center text-xs text-foreground-muted",
269
+ children: _({
270
+ id: 'sticky-note.media.dialog.preview-unavailable',
271
+ message: 'We could not load a preview for this URL.'
272
+ })
273
+ }) : 'image' === parsed.value.kind ? /*#__PURE__*/ jsx("img", {
274
+ src: parsed.value.url,
275
+ alt: alt.trim() || _({
276
+ id: 'sticky-note.media.dialog.image-preview',
277
+ message: 'Image preview'
278
+ }),
279
+ referrerPolicy: "no-referrer",
280
+ className: "block h-auto max-w-full",
281
+ style: {
282
+ width: fullWidth ? '100%' : 'auto'
283
+ },
284
+ onLoad: ()=>setPreviewState('loaded'),
285
+ onError: ()=>setPreviewState('failed')
286
+ }) : 'publicVideo' === parsed.value.kind ? /*#__PURE__*/ jsx("video", {
287
+ src: parsed.value.url,
288
+ "aria-label": _({
289
+ id: 'sticky-note.media.dialog.video-preview',
290
+ message: 'Video preview'
291
+ }),
292
+ controls: true,
293
+ preload: "metadata",
294
+ playsInline: true,
295
+ className: "block h-auto w-full bg-black",
296
+ onLoadedMetadata: ()=>setPreviewState('loaded'),
297
+ onError: ()=>setPreviewState('failed'),
298
+ children: _({
299
+ id: 'sticky-note.media.video-unavailable',
300
+ message: 'Video playback is unavailable.'
301
+ })
302
+ }) : /*#__PURE__*/ jsx("img", {
303
+ src: `https://i.ytimg.com/vi/${parsed.value.videoId}/hqdefault.jpg`,
304
+ alt: _({
305
+ id: 'sticky-note.media.dialog.video-preview',
306
+ message: 'Video preview'
307
+ }),
308
+ referrerPolicy: "no-referrer",
309
+ className: "block aspect-video w-full object-cover"
310
+ })
311
+ })
312
+ })
313
+ ]
314
+ }),
315
+ /*#__PURE__*/ jsxs(DialogFooter, {
316
+ children: [
317
+ /*#__PURE__*/ jsx(Button, {
318
+ type: "button",
319
+ variant: "outline",
320
+ onClick: onCancel,
321
+ children: _({
322
+ id: 'sticky-note.media.dialog.cancel',
323
+ message: 'Cancel'
324
+ })
325
+ }),
326
+ /*#__PURE__*/ jsx(Button, {
327
+ type: "submit",
328
+ disabled: !canSubmit,
329
+ children: isEditing ? _({
330
+ id: 'sticky-note.media.dialog.save',
331
+ message: 'Save changes'
332
+ }) : _({
333
+ id: 'sticky-note.media.dialog.embed',
334
+ message: 'Embed media'
335
+ })
336
+ })
337
+ ]
338
+ })
339
+ ]
340
+ })
341
+ ]
342
+ })
343
+ });
344
+ }
345
+ export { StickyNoteMediaDialog };
@@ -0,0 +1,272 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ StickyNoteMediaMarkdownProvider: ()=>StickyNoteMediaMarkdownProvider,
28
+ createStickyNoteMediaMarkdownComponents: ()=>createStickyNoteMediaMarkdownComponents
29
+ });
30
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
+ const external_index_cjs_namespaceObject = require("../../index.cjs");
32
+ const external_react_namespaceObject = require("react");
33
+ const index_cjs_namespaceObject = require("../../../i18n/index.cjs");
34
+ const external_StickyNoteMedia_cjs_namespaceObject = require("./StickyNoteMedia.cjs");
35
+ const StickyNoteMediaMarkdownContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)({
36
+ editable: false
37
+ });
38
+ function StickyNoteMediaMarkdownProvider({ value, children }) {
39
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(StickyNoteMediaMarkdownContext.Provider, {
40
+ value: value,
41
+ children: children
42
+ });
43
+ }
44
+ function sourceRange(node) {
45
+ const start = node?.position?.start?.offset;
46
+ const end = node?.position?.end?.offset;
47
+ return 'number' == typeof start && 'number' == typeof end ? {
48
+ start,
49
+ end
50
+ } : null;
51
+ }
52
+ function MediaContainer({ fullWidth, children }) {
53
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
54
+ className: "relative my-2 block max-w-full overflow-hidden rounded-md",
55
+ style: {
56
+ width: fullWidth ? '100%' : 'min(320px, 100%)'
57
+ },
58
+ "data-sticky-media": true,
59
+ "data-sticky-full-width": fullWidth,
60
+ children: children
61
+ });
62
+ }
63
+ function MediaEditButton({ onClick }) {
64
+ const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
65
+ const label = _({
66
+ id: 'sticky-note.media.edit',
67
+ message: 'Edit media'
68
+ });
69
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
70
+ type: "button",
71
+ "data-sticky-media-control": true,
72
+ "aria-label": label,
73
+ title: label,
74
+ className: "absolute right-1 top-1 z-10 inline-flex h-7 w-7 items-center justify-center rounded bg-surface-raised/95 text-foreground opacity-80 shadow-sm transition-opacity hover:bg-surface-hover hover:opacity-100 focus-visible:opacity-100",
75
+ onClick: (event)=>{
76
+ event.preventDefault();
77
+ event.stopPropagation();
78
+ onClick();
79
+ },
80
+ onDoubleClick: (event)=>event.stopPropagation(),
81
+ onPointerDown: (event)=>event.stopPropagation(),
82
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_cjs_namespaceObject.CanvasIcon, {
83
+ icon: "pencil",
84
+ size: 14
85
+ })
86
+ });
87
+ }
88
+ function StickyNoteMediaImage({ src, alt = '', title, node, fallbackImage, ...imageProps }) {
89
+ const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
90
+ const { editable, onEditMedia } = (0, external_react_namespaceObject.useContext)(StickyNoteMediaMarkdownContext);
91
+ const [failedImageUrl, setFailedImageUrl] = (0, external_react_namespaceObject.useState)(null);
92
+ const [loadedYouTubeId, setLoadedYouTubeId] = (0, external_react_namespaceObject.useState)(null);
93
+ const mediaMarker = (0, external_StickyNoteMedia_cjs_namespaceObject.parseStickyNoteMediaMarker)(title);
94
+ const media = 'string' == typeof src ? (0, external_StickyNoteMedia_cjs_namespaceObject.parseStickyNoteMediaSource)(src, alt, title) : null;
95
+ const range = sourceRange(node);
96
+ if (!media) {
97
+ if (mediaMarker) {
98
+ const unavailableLabel = _({
99
+ id: 'sticky-note.media.unavailable',
100
+ message: 'Media unavailable'
101
+ });
102
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(MediaContainer, {
103
+ fullWidth: mediaMarker.fullWidth,
104
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
105
+ role: "img",
106
+ "aria-label": alt || unavailableLabel,
107
+ className: "flex min-h-20 items-center justify-center bg-black/10 px-3 text-center text-xs text-foreground-muted",
108
+ children: unavailableLabel
109
+ })
110
+ });
111
+ }
112
+ if (fallbackImage) {
113
+ const fallbackProps = {
114
+ ...imageProps,
115
+ src,
116
+ alt,
117
+ title
118
+ };
119
+ return 'string' == typeof fallbackImage ? /*#__PURE__*/ (0, external_react_namespaceObject.createElement)(fallbackImage, fallbackProps) : /*#__PURE__*/ (0, external_react_namespaceObject.createElement)(fallbackImage, {
120
+ ...fallbackProps,
121
+ node
122
+ });
123
+ }
124
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
125
+ ...imageProps,
126
+ src: src,
127
+ alt: alt,
128
+ title: title
129
+ });
130
+ }
131
+ const editButton = editable && range && onEditMedia && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(MediaEditButton, {
132
+ onClick: ()=>onEditMedia(media, range)
133
+ });
134
+ if ('youtube' === media.kind) {
135
+ const playLabel = _({
136
+ id: 'sticky-note.media.play-video',
137
+ message: 'Play video'
138
+ });
139
+ const youtubeLoaded = loadedYouTubeId === media.videoId;
140
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(MediaContainer, {
141
+ fullWidth: media.fullWidth,
142
+ children: [
143
+ youtubeLoaded ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("iframe", {
144
+ src: `https://www.youtube-nocookie.com/embed/${media.videoId}?autoplay=1`,
145
+ title: _({
146
+ id: 'sticky-note.media.youtube-title',
147
+ message: 'YouTube video'
148
+ }),
149
+ loading: "lazy",
150
+ referrerPolicy: "strict-origin-when-cross-origin",
151
+ sandbox: "allow-scripts allow-same-origin allow-presentation",
152
+ allow: "autoplay; encrypted-media; fullscreen; picture-in-picture",
153
+ allowFullScreen: true,
154
+ className: "block aspect-video w-full border-0",
155
+ onPointerDown: (event)=>event.stopPropagation()
156
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
157
+ type: "button",
158
+ "data-sticky-media-control": true,
159
+ "aria-label": playLabel,
160
+ className: "group relative flex aspect-video w-full items-center justify-center overflow-hidden bg-black text-sm font-medium text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-white",
161
+ onClick: (event)=>{
162
+ event.preventDefault();
163
+ event.stopPropagation();
164
+ setLoadedYouTubeId(media.videoId);
165
+ },
166
+ onDoubleClick: (event)=>event.stopPropagation(),
167
+ onPointerDown: (event)=>event.stopPropagation(),
168
+ children: [
169
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
170
+ src: `https://i.ytimg.com/vi/${media.videoId}/hqdefault.jpg`,
171
+ alt: "",
172
+ draggable: false,
173
+ loading: "lazy",
174
+ decoding: "async",
175
+ referrerPolicy: "no-referrer",
176
+ className: "absolute inset-0 h-full w-full object-cover opacity-80 transition-opacity group-hover:opacity-70"
177
+ }),
178
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
179
+ className: "relative z-10 inline-flex items-center gap-2 rounded-full bg-black/70 px-4 py-2 shadow-sm",
180
+ children: [
181
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_cjs_namespaceObject.CanvasIcon, {
182
+ icon: "play",
183
+ size: 18
184
+ }),
185
+ playLabel
186
+ ]
187
+ })
188
+ ]
189
+ }),
190
+ editButton
191
+ ]
192
+ });
193
+ }
194
+ if ('publicVideo' === media.kind) {
195
+ const videoLabel = alt || _({
196
+ id: 'sticky-note.media.video-label',
197
+ message: 'Embedded video'
198
+ });
199
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(MediaContainer, {
200
+ fullWidth: media.fullWidth,
201
+ children: [
202
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("video", {
203
+ src: media.url,
204
+ "aria-label": videoLabel,
205
+ controls: true,
206
+ preload: "metadata",
207
+ playsInline: true,
208
+ className: "block h-auto w-full bg-black",
209
+ onClick: (event)=>event.stopPropagation(),
210
+ onDoubleClick: (event)=>event.stopPropagation(),
211
+ onPointerDown: (event)=>event.stopPropagation(),
212
+ children: _({
213
+ id: 'sticky-note.media.video-unavailable',
214
+ message: 'Video playback is unavailable.'
215
+ })
216
+ }),
217
+ editButton
218
+ ]
219
+ });
220
+ }
221
+ const imageFailed = failedImageUrl === media.url;
222
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(MediaContainer, {
223
+ fullWidth: media.fullWidth,
224
+ children: [
225
+ imageFailed ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
226
+ role: "img",
227
+ "aria-label": alt || _({
228
+ id: 'sticky-note.media.image-unavailable-label',
229
+ message: 'Image unavailable'
230
+ }),
231
+ className: "flex min-h-20 items-center justify-center bg-black/10 px-3 text-center text-xs text-foreground-muted",
232
+ children: _({
233
+ id: 'sticky-note.media.image-unavailable',
234
+ message: 'Image unavailable'
235
+ })
236
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
237
+ ...imageProps,
238
+ src: media.url,
239
+ alt: alt,
240
+ draggable: false,
241
+ loading: "lazy",
242
+ decoding: "async",
243
+ referrerPolicy: "no-referrer",
244
+ style: {
245
+ display: 'block',
246
+ maxWidth: '100%',
247
+ width: media.fullWidth ? '100%' : 'auto',
248
+ height: 'auto'
249
+ },
250
+ onError: ()=>setFailedImageUrl(media.url)
251
+ }),
252
+ editButton
253
+ ]
254
+ });
255
+ }
256
+ function createStickyNoteMediaMarkdownComponents(fallbackImage) {
257
+ return {
258
+ img: (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(StickyNoteMediaImage, {
259
+ ...props,
260
+ fallbackImage: fallbackImage
261
+ })
262
+ };
263
+ }
264
+ exports.StickyNoteMediaMarkdownProvider = __webpack_exports__.StickyNoteMediaMarkdownProvider;
265
+ exports.createStickyNoteMediaMarkdownComponents = __webpack_exports__.createStickyNoteMediaMarkdownComponents;
266
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
267
+ "StickyNoteMediaMarkdownProvider",
268
+ "createStickyNoteMediaMarkdownComponents"
269
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
270
+ Object.defineProperty(exports, '__esModule', {
271
+ value: true
272
+ });
@@ -0,0 +1,18 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { Components } from 'react-markdown';
3
+ import { type StickyNoteMedia } from './StickyNoteMedia';
4
+ export interface StickyNoteMediaSourceRange {
5
+ start: number;
6
+ end: number;
7
+ }
8
+ interface StickyNoteMediaMarkdownOptions {
9
+ editable: boolean;
10
+ onEditMedia?: (media: StickyNoteMedia, range: StickyNoteMediaSourceRange) => void;
11
+ }
12
+ export declare function StickyNoteMediaMarkdownProvider({ value, children, }: {
13
+ value: StickyNoteMediaMarkdownOptions;
14
+ children: ReactNode;
15
+ }): import("react/jsx-runtime").JSX.Element;
16
+ export declare function createStickyNoteMediaMarkdownComponents(fallbackImage?: Components['img']): Components;
17
+ export {};
18
+ //# sourceMappingURL=StickyNoteMediaMarkdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StickyNoteMediaMarkdown.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteMediaMarkdown.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,8BAA8B;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,0BAA0B,KAAK,IAAI,CAAC;CACnF;AAMD,wBAAgB,+BAA+B,CAAC,EAC9C,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,8BAA8B,CAAC;IACtC,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAMA;AAqND,wBAAgB,uCAAuC,CACrD,aAAa,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,GAChC,UAAU,CAIZ"}