@webstudio-is/sdk-components-react 0.189.0 → 0.191.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.
Files changed (126) hide show
  1. package/lib/__generated__/blockquote.props.js +514 -0
  2. package/lib/__generated__/body.props.js +508 -0
  3. package/lib/__generated__/bold.props.js +508 -0
  4. package/lib/__generated__/box.props.js +527 -0
  5. package/lib/__generated__/button.props.js +570 -0
  6. package/lib/__generated__/checkbox.props.js +672 -0
  7. package/lib/__generated__/code-text.props.js +509 -0
  8. package/lib/__generated__/form.props.js +556 -0
  9. package/lib/__generated__/heading.props.js +516 -0
  10. package/lib/__generated__/html-embed.props.js +13 -0
  11. package/lib/__generated__/image.props.js +592 -0
  12. package/lib/__generated__/input.props.js +696 -0
  13. package/lib/__generated__/italic.props.js +508 -0
  14. package/lib/__generated__/label.props.js +520 -0
  15. package/lib/__generated__/link.props.js +568 -0
  16. package/lib/__generated__/list-item.props.js +514 -0
  17. package/lib/__generated__/list.props.js +534 -0
  18. package/lib/__generated__/markdown-embed.props.js +7 -0
  19. package/lib/__generated__/option.props.js +532 -0
  20. package/lib/__generated__/paragraph.props.js +508 -0
  21. package/lib/__generated__/radio-button.props.js +672 -0
  22. package/lib/__generated__/select.props.js +556 -0
  23. package/lib/__generated__/separator.props.js +508 -0
  24. package/lib/__generated__/span.props.js +508 -0
  25. package/lib/__generated__/subscript.props.js +508 -0
  26. package/lib/__generated__/superscript.props.js +508 -0
  27. package/lib/__generated__/text.props.js +516 -0
  28. package/lib/__generated__/textarea.props.js +587 -0
  29. package/lib/__generated__/time.props.js +312 -0
  30. package/lib/__generated__/vimeo-play-button.props.js +569 -0
  31. package/lib/__generated__/vimeo-preview-image.props.js +586 -0
  32. package/lib/__generated__/vimeo-spinner.props.js +508 -0
  33. package/lib/__generated__/vimeo.props.js +674 -0
  34. package/lib/__generated__/xml-node.props.js +7 -0
  35. package/lib/__generated__/xml-time.props.js +18 -0
  36. package/lib/blockquote.js +9 -0
  37. package/lib/blockquote.ws.js +79 -0
  38. package/lib/body.js +7 -0
  39. package/lib/body.ws.js +30 -0
  40. package/lib/bold.js +7 -0
  41. package/lib/bold.ws.js +20 -0
  42. package/lib/box.js +9 -0
  43. package/lib/box.ws.js +31 -0
  44. package/lib/button.js +9 -0
  45. package/lib/button.ws.js +44 -0
  46. package/lib/checkbox.js +15 -0
  47. package/lib/checkbox.ws.js +59 -0
  48. package/lib/code-text.js +10 -0
  49. package/lib/code-text.ws.js +60 -0
  50. package/lib/components.js +77 -1357
  51. package/lib/content-embed.ws.js +77 -0
  52. package/lib/form.js +7 -0
  53. package/lib/form.ws.js +31 -0
  54. package/lib/fragment.js +7 -0
  55. package/lib/fragment.ws.js +11 -0
  56. package/lib/heading.js +9 -0
  57. package/lib/heading.ws.js +45 -0
  58. package/lib/home_wsKvRSqvkajPPBeycZ-C8.svg +3 -0
  59. package/lib/hooks.js +5 -0
  60. package/lib/html-embed-patchers.js +29 -0
  61. package/lib/html-embed.js +112 -0
  62. package/lib/html-embed.ws.js +46 -0
  63. package/lib/image.js +40 -0
  64. package/lib/image.ws.js +65 -0
  65. package/lib/input.js +17 -0
  66. package/lib/input.ws.js +55 -0
  67. package/lib/italic.js +7 -0
  68. package/lib/italic.ws.js +26 -0
  69. package/lib/label.js +7 -0
  70. package/lib/label.ws.js +43 -0
  71. package/lib/link.js +15 -0
  72. package/lib/link.ws.js +68 -0
  73. package/lib/list-item.js +9 -0
  74. package/lib/list-item.ws.js +40 -0
  75. package/lib/list.js +6 -0
  76. package/lib/list.ws.js +92 -0
  77. package/lib/markdown-embed.js +14 -0
  78. package/lib/markdown-embed.ws.js +111 -0
  79. package/lib/metas.js +79 -4581
  80. package/lib/option.js +7 -0
  81. package/lib/option.ws.js +47 -0
  82. package/lib/paragraph.js +7 -0
  83. package/lib/paragraph.ws.js +40 -0
  84. package/lib/props.js +77 -17919
  85. package/lib/radio-button.js +15 -0
  86. package/lib/radio-button.ws.js +61 -0
  87. package/lib/rich-text-link.js +8 -0
  88. package/lib/rich-text-link.ws.js +11 -0
  89. package/lib/select.js +19 -0
  90. package/lib/select.ws.js +97 -0
  91. package/lib/separator.js +9 -0
  92. package/lib/separator.ws.js +48 -0
  93. package/lib/slot.js +14 -0
  94. package/lib/slot.ws.js +15 -0
  95. package/lib/span.js +7 -0
  96. package/lib/span.ws.js +20 -0
  97. package/lib/subscript.js +7 -0
  98. package/lib/subscript.ws.js +20 -0
  99. package/lib/superscript.js +7 -0
  100. package/lib/superscript.ws.js +20 -0
  101. package/lib/text.js +10 -0
  102. package/lib/text.ws.js +41 -0
  103. package/lib/textarea.js +7 -0
  104. package/lib/textarea.ws.js +56 -0
  105. package/lib/time.js +319 -0
  106. package/lib/time.ws.js +22 -0
  107. package/lib/types/__generated__/xml-time.props.d.ts +2 -0
  108. package/lib/types/components.d.ts +1 -0
  109. package/lib/types/metas.d.ts +1 -0
  110. package/lib/types/props.d.ts +1 -0
  111. package/lib/types/vimeo-preview-image.d.ts +94 -94
  112. package/lib/types/xml-time.d.ts +6 -0
  113. package/lib/types/xml-time.ws.d.ts +3 -0
  114. package/lib/vimeo-play-button.js +15 -0
  115. package/lib/vimeo-play-button.ws.js +33 -0
  116. package/lib/vimeo-preview-image.js +19 -0
  117. package/lib/vimeo-preview-image.ws.js +20 -0
  118. package/lib/vimeo-spinner.js +13 -0
  119. package/lib/vimeo-spinner.ws.js +26 -0
  120. package/lib/vimeo.js +215 -0
  121. package/lib/vimeo.ws.js +330 -0
  122. package/lib/xml-node.js +44 -0
  123. package/lib/xml-node.ws.js +18 -0
  124. package/lib/xml-time.js +25 -0
  125. package/lib/xml-time.ws.js +18 -0
  126. package/package.json +8 -11
package/lib/components.js CHANGED
@@ -1,1359 +1,79 @@
1
- // src/slot.tsx
2
- import { forwardRef } from "react";
3
- import { jsx } from "react/jsx-runtime";
4
- var Slot = forwardRef((props, ref) => {
5
- return /* @__PURE__ */ jsx(
6
- "div",
7
- {
8
- ...props,
9
- ref,
10
- style: { display: props.children ? "contents" : "block" }
11
- }
12
- );
13
- });
14
- Slot.displayName = "Slot";
15
-
16
- // src/fragment.tsx
17
- import { forwardRef as forwardRef2 } from "react";
18
- import { jsx as jsx2 } from "react/jsx-runtime";
19
- var Fragment = forwardRef2((props, ref) => {
20
- return /* @__PURE__ */ jsx2("div", { ...props, ref, style: { display: "contents" } });
21
- });
22
- Fragment.displayName = "Fragment";
23
-
24
- // src/html-embed.tsx
25
- import {
26
- forwardRef as forwardRef3,
27
- useContext,
28
- useEffect,
29
- useRef,
30
- useSyncExternalStore,
31
- useState,
32
- useMemo
33
- } from "react";
34
- import { mergeRefs } from "@react-aria/utils";
35
- import { ReactSdkContext } from "@webstudio-is/react-sdk/runtime";
36
-
37
- // src/html-embed-patchers.ts
38
- var isDOMContentLoaded = () => {
39
- return document.readyState === "complete" || document.readyState === "interactive";
40
- };
41
- var eventListenerTasks = [];
42
- var domContentLoadedPatched = false;
43
- var patchDomEvents = () => {
44
- if (isDOMContentLoaded() === false) {
45
- console.error("DOMContentLoaded event has not been fired yet");
46
- return;
47
- }
48
- if (domContentLoadedPatched) {
49
- return;
50
- }
51
- domContentLoadedPatched = true;
52
- const originalAddEventListener = document.addEventListener;
53
- const originalWindowAddEventListener = window.addEventListener;
54
- const domContentLoadedEvent = new Event("DOMContentLoaded");
55
- const windowLoadEvent = new Event("load");
56
- window.addEventListener = (type, listener, options) => {
57
- if (type === "DOMContentLoaded") {
58
- eventListenerTasks.push(
59
- () => listener.call(window, domContentLoadedEvent)
60
- );
61
- } else if (type === "load") {
62
- eventListenerTasks.push(() => listener.call(window, windowLoadEvent));
63
- originalWindowAddEventListener.call(window, type, listener, options);
64
- } else {
65
- originalWindowAddEventListener.call(window, type, listener, options);
66
- }
67
- };
68
- document.addEventListener = (type, listener, options) => {
69
- if (type === "DOMContentLoaded") {
70
- eventListenerTasks.push(
71
- () => listener.call(document, domContentLoadedEvent)
72
- );
73
- } else {
74
- originalAddEventListener.call(document, type, listener, options);
75
- }
76
- };
77
- };
78
- var executeDomEvents = () => {
79
- for (const task of eventListenerTasks) {
80
- task();
81
- }
82
- eventListenerTasks.length = 0;
83
- };
84
-
85
- // src/html-embed.tsx
86
- import { jsx as jsx3 } from "react/jsx-runtime";
87
- var __testing__ = {
88
- scriptTestIdPrefix: "client-"
89
- };
90
- var insertScript = (sourceScript) => {
91
- return new Promise((resolve, reject) => {
92
- const script = document.createElement("script");
93
- const hasSrc = sourceScript.hasAttribute("src");
94
- const isTypeModule = sourceScript.type === "module";
95
- for (const { name, value } of sourceScript.attributes) {
96
- script.setAttribute(name, value);
97
- }
98
- if (script.dataset.testid !== void 0) {
99
- script.dataset.testid = `${__testing__.scriptTestIdPrefix}${script.dataset.testid}`;
100
- }
101
- if (hasSrc) {
102
- script.addEventListener("load", () => {
103
- resolve();
104
- });
105
- script.addEventListener("error", reject);
106
- } else {
107
- if (isTypeModule) {
108
- const blob = new Blob([sourceScript.innerText], {
109
- type: "text/javascript"
110
- });
111
- const url = URL.createObjectURL(blob);
112
- import(
113
- /* @vite-ignore */
114
- url
115
- ).then(resolve).catch(reject).finally(() => {
116
- URL.revokeObjectURL(url);
117
- });
118
- return;
119
- }
120
- script.textContent = sourceScript.innerText;
121
- }
122
- sourceScript.replaceWith(script);
123
- if (hasSrc === false) {
124
- resolve();
125
- }
126
- });
127
- };
128
- var syncTasksQueue = [];
129
- var processing = false;
130
- var processSyncTasks = async (syncTasks) => {
131
- syncTasksQueue.push(...syncTasks);
132
- await Promise.resolve();
133
- if (processing) {
134
- return;
135
- }
136
- patchDomEvents();
137
- processing = true;
138
- while (syncTasksQueue.length > 0) {
139
- const task = syncTasksQueue.shift();
140
- await task();
141
- }
142
- executeDomEvents();
143
- processing = false;
144
- };
145
- var execute = (container) => {
146
- const scripts = container.querySelectorAll("script");
147
- const syncTasks = [];
148
- const asyncTasks = [];
149
- scripts.forEach((script) => {
150
- const tasks = script.hasAttribute("async") ? asyncTasks : syncTasks;
151
- tasks.push(() => {
152
- return insertScript(script);
153
- });
154
- });
155
- for (const task of asyncTasks) {
156
- task();
157
- }
158
- processSyncTasks(syncTasks);
159
- };
160
- var Placeholder = (props) => {
161
- const { code, innerRef, ...rest } = props;
162
- return /* @__PURE__ */ jsx3("div", { ref: innerRef, ...rest, style: { display: "block", padding: 20 }, children: 'Open the "Settings" panel to insert HTML code.' });
163
- };
164
- var useIsServer = () => {
165
- const isServer = useSyncExternalStore(
166
- () => () => {
167
- },
168
- () => false,
169
- () => true
170
- );
171
- return isServer;
172
- };
173
- var ClientOnly = (props) => {
174
- const isServer = useIsServer();
175
- if (isServer) {
176
- return;
177
- }
178
- return props.children;
179
- };
180
- var ClientEmbed = (props) => {
181
- const { code, innerRef, ...rest } = props;
182
- const containerRef = useRef(null);
183
- const executeScripts = useRef(true);
184
- const html = useMemo(
185
- () => ({
186
- __html: code ?? ""
187
- }),
188
- [code]
189
- );
190
- useEffect(() => {
191
- const container = containerRef.current;
192
- if (container && executeScripts.current) {
193
- executeScripts.current = false;
194
- execute(container);
195
- }
196
- }, []);
197
- return /* @__PURE__ */ jsx3(
198
- "div",
199
- {
200
- ...rest,
201
- ref: mergeRefs(innerRef, containerRef),
202
- dangerouslySetInnerHTML: html
203
- }
204
- );
205
- };
206
- var ServerEmbed = (props) => {
207
- const { code, innerRef, ...rest } = props;
208
- return /* @__PURE__ */ jsx3(
209
- "div",
210
- {
211
- ...rest,
212
- ref: innerRef,
213
- dangerouslySetInnerHTML: { __html: code ?? "" }
214
- }
215
- );
216
- };
217
- var ClientEmbedWithNonExecutableScripts = ServerEmbed;
218
- var HtmlEmbed = forwardRef3(
219
- (props, ref) => {
220
- const { code, executeScriptOnCanvas, clientOnly, children, ...rest } = props;
221
- const { renderer } = useContext(ReactSdkContext);
222
- const isServer = useIsServer();
223
- const [ssrRendered] = useState(isServer);
224
- if (code === void 0 || String(code).trim().length === 0) {
225
- return /* @__PURE__ */ jsx3(Placeholder, { innerRef: ref, ...rest });
226
- }
227
- if (ssrRendered) {
228
- if (clientOnly !== true) {
229
- return /* @__PURE__ */ jsx3(ServerEmbed, { innerRef: ref, code, ...rest });
230
- }
231
- return /* @__PURE__ */ jsx3(ClientOnly, { children: /* @__PURE__ */ jsx3(ClientEmbed, { innerRef: ref, code, ...rest }) });
232
- }
233
- if (renderer === "canvas" && executeScriptOnCanvas !== true) {
234
- return /* @__PURE__ */ jsx3(ClientOnly, { children: /* @__PURE__ */ jsx3(
235
- ClientEmbedWithNonExecutableScripts,
236
- {
237
- innerRef: ref,
238
- code,
239
- ...rest
240
- }
241
- ) });
242
- }
243
- return /* @__PURE__ */ jsx3(ClientOnly, { children: /* @__PURE__ */ jsx3(
244
- ClientEmbed,
245
- {
246
- innerRef: ref,
247
- code,
248
- ...rest
249
- },
250
- code
251
- ) });
252
- }
253
- );
254
- HtmlEmbed.displayName = "HtmlEmbed";
255
-
256
- // src/markdown-embed.tsx
257
- import { micromark } from "micromark";
258
- import { forwardRef as forwardRef4, useMemo as useMemo2 } from "react";
259
- import { jsx as jsx4 } from "react/jsx-runtime";
260
- var MarkdownEmbed = /* @__PURE__ */ forwardRef4((props, ref) => {
261
- const { code, children, ...rest } = props;
262
- const html = useMemo2(
263
- // support data uri protocol in images
264
- () => micromark(code ?? "", { allowDangerousProtocol: true }),
265
- [code]
266
- );
267
- return /* @__PURE__ */ jsx4("div", { ...rest, ref, dangerouslySetInnerHTML: { __html: html } });
268
- });
269
-
270
- // src/body.tsx
271
- import { forwardRef as forwardRef5 } from "react";
272
- import { jsx as jsx5 } from "react/jsx-runtime";
273
- var Body = forwardRef5((props, ref) => /* @__PURE__ */ jsx5("body", { ...props, ref }));
274
- Body.displayName = "Body";
275
-
276
- // src/box.tsx
277
- import {
278
- createElement,
279
- forwardRef as forwardRef6
280
- } from "react";
281
- var defaultTag = "div";
282
- var Box = forwardRef6(
283
- ({ tag = defaultTag, ...props }, ref) => {
284
- return createElement(tag, { ...props, ref });
285
- }
286
- );
287
- Box.displayName = "Box";
288
-
289
- // src/text.tsx
290
- import { forwardRef as forwardRef7 } from "react";
291
- import { jsx as jsx6 } from "react/jsx-runtime";
292
- var defaultTag2 = "div";
293
- var Text = forwardRef7(
294
- ({ tag = defaultTag2, children, ...props }, ref) => {
295
- const Tag = tag;
296
- return /* @__PURE__ */ jsx6(Tag, { ...props, ref, children });
297
- }
298
- );
299
- Text.displayName = "Text";
300
-
301
- // src/heading.tsx
302
- import { forwardRef as forwardRef8 } from "react";
303
- import { jsx as jsx7 } from "react/jsx-runtime";
304
- var defaultTag3 = "h1";
305
- var Heading = forwardRef8(
306
- ({ tag = defaultTag3, children, ...props }, ref) => {
307
- const Tag = tag;
308
- return /* @__PURE__ */ jsx7(Tag, { ...props, ref, children });
309
- }
310
- );
311
- Heading.displayName = "Heading";
312
-
313
- // src/paragraph.tsx
314
- import { forwardRef as forwardRef9 } from "react";
315
- import { jsx as jsx8 } from "react/jsx-runtime";
316
- var Paragraph = forwardRef9(({ children, ...props }, ref) => /* @__PURE__ */ jsx8("p", { ...props, ref, children }));
317
- Paragraph.displayName = "Paragraph";
318
-
319
- // src/link.tsx
320
- import { forwardRef as forwardRef10 } from "react";
321
- import { jsx as jsx9 } from "react/jsx-runtime";
322
- var Link = forwardRef10((props, ref) => {
323
- const {
324
- children,
325
- // @todo: it's a hack made for Image component for the builder and should't be in the runtime at all.
326
- $webstudio$canvasOnly$assetId,
327
- ...rest
328
- } = props;
329
- return /* @__PURE__ */ jsx9("a", { ...rest, href: rest.href ?? "#", ref, children });
330
- });
331
- Link.displayName = "Link";
332
-
333
- // src/rich-text-link.tsx
334
- import { forwardRef as forwardRef11 } from "react";
335
- import { jsx as jsx10 } from "react/jsx-runtime";
336
- var RichTextLink = forwardRef11((props, ref) => /* @__PURE__ */ jsx10(Link, { ...props, ref }));
337
- RichTextLink.displayName = "RichTextLink";
338
-
339
- // src/span.tsx
340
- import { forwardRef as forwardRef12 } from "react";
341
- import { jsx as jsx11 } from "react/jsx-runtime";
342
- var Span = forwardRef12((props, ref) => /* @__PURE__ */ jsx11("span", { ...props, ref }));
343
- Span.displayName = "Span";
344
-
345
- // src/bold.tsx
346
- import { forwardRef as forwardRef13 } from "react";
347
- import { jsx as jsx12 } from "react/jsx-runtime";
348
- var Bold = forwardRef13((props, ref) => /* @__PURE__ */ jsx12("b", { ...props, ref }));
349
- Bold.displayName = "Bold";
350
-
351
- // src/italic.tsx
352
- import { forwardRef as forwardRef14 } from "react";
353
- import { jsx as jsx13 } from "react/jsx-runtime";
354
- var Italic = forwardRef14((props, ref) => /* @__PURE__ */ jsx13("i", { ...props, ref }));
355
- Italic.displayName = "Italic";
356
-
357
- // src/superscript.tsx
358
- import { forwardRef as forwardRef15 } from "react";
359
- import { jsx as jsx14 } from "react/jsx-runtime";
360
- var Superscript = forwardRef15((props, ref) => /* @__PURE__ */ jsx14("sup", { ...props, ref }));
361
- Superscript.displayName = "Bold";
362
-
363
- // src/subscript.tsx
364
- import { forwardRef as forwardRef16 } from "react";
365
- import { jsx as jsx15 } from "react/jsx-runtime";
366
- var Subscript = forwardRef16((props, ref) => /* @__PURE__ */ jsx15("sub", { ...props, ref }));
367
- Subscript.displayName = "Subscript";
368
-
369
- // src/button.tsx
370
- import { forwardRef as forwardRef17 } from "react";
371
- import { jsx as jsx16 } from "react/jsx-runtime";
372
- var Button = forwardRef17(
373
- ({ type = "submit", children, ...props }, ref) => /* @__PURE__ */ jsx16("button", { type, ...props, ref, children })
374
- );
375
- Button.displayName = "Button";
376
-
377
- // src/input.tsx
378
- import { forwardRef as forwardRef18 } from "react";
379
- import { jsx as jsx17 } from "react/jsx-runtime";
380
- var Input = forwardRef18(
381
- ({ children: _children, type = "text", value, defaultValue, ...props }, ref) => /* @__PURE__ */ jsx17(
382
- "input",
383
- {
384
- ...props,
385
- defaultValue: value ?? defaultValue,
386
- type,
387
- ref
388
- }
389
- )
390
- );
391
- Input.displayName = "Input";
392
-
393
- // src/form.tsx
394
- import { forwardRef as forwardRef19 } from "react";
395
- import { jsx as jsx18 } from "react/jsx-runtime";
396
- var Form = forwardRef19(({ children, ...props }, ref) => /* @__PURE__ */ jsx18("form", { ...props, ref, children }));
397
- Form.displayName = "Form";
398
-
399
- // src/image.tsx
400
- import {
401
- forwardRef as forwardRef20,
402
- useContext as useContext2
403
- } from "react";
404
- import { Image as WebstudioImage } from "@webstudio-is/image";
405
- import { ReactSdkContext as ReactSdkContext2 } from "@webstudio-is/react-sdk/runtime";
406
- import { jsx as jsx19 } from "react/jsx-runtime";
407
- var Image = forwardRef20(
408
- ({
409
- loading = "lazy",
410
- width,
411
- height,
412
- optimize = true,
413
- decoding: decodingProp,
414
- // @todo: it's a hack made for the builder and should't be in the runtime at all.
415
- $webstudio$canvasOnly$assetId,
416
- ...props
417
- }, ref) => {
418
- const src = String(props.src ?? "");
419
- const { imageLoader, renderer, assetBaseUrl } = useContext2(ReactSdkContext2);
420
- let decoding = decodingProp;
421
- let key = src;
422
- if (renderer === "canvas") {
423
- loading = "eager";
424
- decoding = "sync";
425
- key = $webstudio$canvasOnly$assetId ?? src;
426
- if (width !== void 0 && height !== void 0 && Number.isNaN(width) && Number.isNaN(height)) {
427
- optimize = false;
428
- width = void 0;
429
- height = void 0;
430
- }
431
- }
432
- let assetName = src;
433
- if (src.startsWith(assetBaseUrl)) {
434
- assetName = src.slice(assetBaseUrl.length);
435
- }
436
- return /* @__PURE__ */ jsx19(
437
- WebstudioImage,
438
- {
439
- loading,
440
- decoding,
441
- optimize,
442
- width,
443
- height,
444
- ...props,
445
- loader: imageLoader,
446
- src: assetName,
447
- ref
448
- },
449
- key
450
- );
451
- }
452
- );
453
- Image.displayName = "Image";
454
-
455
- // src/blockquote.tsx
456
- import { forwardRef as forwardRef21 } from "react";
457
- import { jsx as jsx20 } from "react/jsx-runtime";
458
- var Blockquote = forwardRef21(
459
- ({ children, ...props }, ref) => {
460
- return /* @__PURE__ */ jsx20("blockquote", { ...props, ref, children });
461
- }
462
- );
463
- Blockquote.displayName = "Blockquote";
464
-
465
- // src/list.tsx
466
- import {
467
- forwardRef as forwardRef22,
468
- createElement as createElement2
469
- } from "react";
470
- var unorderedTag = "ul";
471
- var orderedTag = "ol";
472
- var List = forwardRef22(({ ordered = false, ...props }, ref) => {
473
- const tag = ordered ? orderedTag : unorderedTag;
474
- return createElement2(tag, { ...props, ref });
475
- });
476
- List.displayName = "List";
477
-
478
- // src/list-item.tsx
479
- import { forwardRef as forwardRef23 } from "react";
480
- import { jsx as jsx21 } from "react/jsx-runtime";
481
- var ListItem = forwardRef23(
482
- ({ children, ...props }, ref) => {
483
- return /* @__PURE__ */ jsx21("li", { ...props, ref, children });
484
- }
485
- );
486
- ListItem.displayName = "ListItem";
487
-
488
- // src/separator.tsx
489
- import {
490
- forwardRef as forwardRef24,
491
- createElement as createElement3
492
- } from "react";
493
- var defaultTag4 = "hr";
494
- var Separator = forwardRef24(
495
- (props, ref) => {
496
- return createElement3(defaultTag4, { ...props, ref });
497
- }
498
- );
499
- Separator.displayName = "Separator";
500
-
501
- // src/code-text.tsx
502
- import {
503
- forwardRef as forwardRef25
504
- } from "react";
505
- import { jsx as jsx22 } from "react/jsx-runtime";
506
- var Placeholder2 = ({
507
- innerRef,
508
- ...rest
509
- }) => {
510
- return /* @__PURE__ */ jsx22("code", { ...rest, style: { padding: 20 }, ref: innerRef, children: `Open the "Settings" panel to edit the code.` });
511
- };
512
- var CodeText = forwardRef25(({ code, children, ...props }, ref) => {
513
- if (children === void 0 && code === void 0 || String(code).trim().length === 0) {
514
- return /* @__PURE__ */ jsx22(Placeholder2, { innerRef: ref, ...props });
515
- }
516
- return /* @__PURE__ */ jsx22("code", { ...props, ref, children: code ?? children });
517
- });
518
- CodeText.displayName = "CodeText";
519
-
520
- // src/label.tsx
521
- import { forwardRef as forwardRef26 } from "react";
522
- import { jsx as jsx23 } from "react/jsx-runtime";
523
- var Label = forwardRef26((props, ref) => /* @__PURE__ */ jsx23("label", { ...props, ref }));
524
- Label.displayName = "Label";
525
-
526
- // src/textarea.tsx
527
- import { forwardRef as forwardRef27 } from "react";
528
- import { jsx as jsx24 } from "react/jsx-runtime";
529
- var Textarea = forwardRef27(({ children: _children, value, defaultValue, ...props }, ref) => /* @__PURE__ */ jsx24("textarea", { ...props, defaultValue: value ?? defaultValue, ref }));
530
- Textarea.displayName = "Textarea";
531
-
532
- // src/radio-button.tsx
533
- import { forwardRef as forwardRef28 } from "react";
534
- import { jsx as jsx25 } from "react/jsx-runtime";
535
- var RadioButton = forwardRef28(({ children: _children, checked, defaultChecked, ...props }, ref) => /* @__PURE__ */ jsx25(
536
- "input",
537
- {
538
- ...props,
539
- defaultChecked: checked ?? defaultChecked,
540
- type: "radio",
541
- ref
542
- }
543
- ));
544
- RadioButton.displayName = "RadioButton";
545
-
546
- // src/checkbox.tsx
547
- import { forwardRef as forwardRef29 } from "react";
548
- import { jsx as jsx26 } from "react/jsx-runtime";
549
- var Checkbox = forwardRef29(({ children: _children, checked, defaultChecked, ...props }, ref) => {
550
- return /* @__PURE__ */ jsx26(
551
- "input",
552
- {
553
- ...props,
554
- defaultChecked: checked ?? defaultChecked,
555
- type: "checkbox",
556
- ref
557
- }
558
- );
559
- });
560
- Checkbox.displayName = "Checkbox";
561
-
562
- // src/vimeo.tsx
563
- import { colord } from "colord";
564
- import {
565
- forwardRef as forwardRef30,
566
- useState as useState2,
567
- useEffect as useEffect2,
568
- useContext as useContext3,
569
- createContext
570
- } from "react";
571
- import { ReactSdkContext as ReactSdkContext3 } from "@webstudio-is/react-sdk/runtime";
572
- import { Fragment as Fragment2, jsx as jsx27, jsxs } from "react/jsx-runtime";
573
- var getVideoUrl = (options) => {
574
- if (options.url === void 0) {
575
- return;
576
- }
577
- let url;
578
- try {
579
- const userUrl = new URL(options.url);
580
- url = new URL(IFRAME_CDN);
581
- url.pathname = `/video${userUrl.pathname}`;
582
- } catch {
583
- }
584
- if (url === void 0) {
585
- return;
586
- }
587
- const optionsMap = {
588
- showPortrait: "portrait",
589
- showByline: "byline",
590
- showTitle: "title",
591
- controlsColor: "color",
592
- showControls: "controls",
593
- interactiveParams: "interactive_params",
594
- backgroundMode: "background",
595
- doNotTrack: "dnt"
596
- };
597
- let option;
598
- for (option in options) {
599
- const value = options[option];
600
- if (option === "url" || value === void 0) {
601
- continue;
602
- }
603
- const mappedOption = optionsMap[option] ?? option;
604
- url.searchParams.append(mappedOption, value.toString());
605
- }
606
- url.searchParams.set("autoplay", "true");
607
- if (typeof options.controlsColor === "string") {
608
- const color = colord(options.controlsColor).toHex().replace("#", "");
609
- url.searchParams.set("color", color);
610
- }
611
- if (options.showPortrait) {
612
- url.searchParams.set("title", "true");
613
- }
614
- if (options.showByline) {
615
- url.searchParams.set("portrait", "true");
616
- url.searchParams.set("title", "true");
617
- }
618
- return url.toString();
619
- };
620
- var preconnect = (url) => {
621
- const link = document.createElement("link");
622
- link.rel = "preconnect";
623
- link.href = url;
624
- link.crossOrigin = "true";
625
- document.head.appendChild(link);
626
- };
627
- var warmed = false;
628
- var PLAYER_CDN = "https://f.vimeocdn.com";
629
- var IFRAME_CDN = "https://player.vimeo.com";
630
- var IMAGE_CDN = "https://i.vimeocdn.com";
631
- var warmConnections = () => {
632
- if (warmed) {
633
- return;
634
- }
635
- if (window.matchMedia("(hover: none)").matches) {
636
- return;
637
- }
638
- preconnect(PLAYER_CDN);
639
- preconnect(IFRAME_CDN);
640
- preconnect(IMAGE_CDN);
641
- warmed = true;
642
- };
643
- var getVideoId = (url) => {
644
- try {
645
- const parsedUrl = new URL(url);
646
- const id = parsedUrl.pathname.split("/")[2];
647
- if (id === "" || id == null) {
648
- return;
649
- }
650
- return id;
651
- } catch {
652
- }
653
- };
654
- var loadPreviewImageUrl = async (videoUrl) => {
655
- const videoId = getVideoId(videoUrl);
656
- const apiUrl = `https://vimeo.com/api/v2/video/${videoId}.json`;
657
- const response = (await (await fetch(apiUrl)).json())[0];
658
- const thumbnail = response.thumbnail_large;
659
- const imgId = thumbnail.substr(thumbnail.lastIndexOf("/") + 1).split("_")[0];
660
- const imageUrl = new URL(IMAGE_CDN);
661
- imageUrl.pathname = `/video/${imgId}.webp`;
662
- imageUrl.searchParams.append("mw", "1100");
663
- imageUrl.searchParams.append("mh", "619");
664
- imageUrl.searchParams.append("q", "70");
665
- return imageUrl;
666
- };
667
- var EmptyState = () => {
668
- return /* @__PURE__ */ jsx27(
669
- "div",
670
- {
671
- style: {
672
- display: "flex",
673
- width: "100%",
674
- height: "100%",
675
- alignItems: "center",
676
- justifyContent: "center",
677
- fontSize: "1.2em"
678
- },
679
- children: 'Open the "Settings" panel and paste a video URL, e.g. https://vimeo.com/831343124.'
680
- }
681
- );
682
- };
683
- var Player = ({
684
- status,
685
- loading,
686
- videoUrl,
687
- previewImageUrl,
688
- autoplay,
689
- renderer,
690
- showPreview,
691
- onStatusChange,
692
- onPreviewImageUrlChange
693
- }) => {
694
- const [opacity, setOpacity] = useState2(0);
695
- useEffect2(() => {
696
- if (autoplay && renderer !== "canvas" && status === "initial") {
697
- onStatusChange("loading");
698
- }
699
- }, [autoplay, status, renderer, onStatusChange]);
700
- useEffect2(() => {
701
- if (renderer !== "canvas") {
702
- warmConnections();
703
- }
704
- }, [renderer]);
705
- useEffect2(() => {
706
- if (videoUrl === void 0) {
707
- return;
708
- }
709
- if (showPreview === false) {
710
- onPreviewImageUrlChange(void 0);
711
- return;
712
- }
713
- if (previewImageUrl === void 0) {
714
- loadPreviewImageUrl(videoUrl).then(onPreviewImageUrlChange).catch(() => {
715
- console.error(`Could not load preview image for ${videoUrl}`);
716
- });
717
- }
718
- }, [onPreviewImageUrlChange, showPreview, videoUrl, previewImageUrl]);
719
- if (renderer === "canvas" || status === "initial") {
720
- return;
721
- }
722
- return /* @__PURE__ */ jsx27(
723
- "iframe",
724
- {
725
- src: videoUrl,
726
- loading,
727
- allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture;",
728
- allowFullScreen: true,
729
- style: {
730
- position: "absolute",
731
- width: "100%",
732
- height: "100%",
733
- opacity,
734
- transition: "opacity 1s",
735
- border: "none"
736
- },
737
- onLoad: () => {
738
- onStatusChange("ready");
739
- setOpacity(1);
740
- }
741
- }
742
- );
743
- };
744
- var VimeoContext = createContext({
745
- onInitPlayer: () => {
746
- },
747
- status: "initial"
748
- });
749
- var Vimeo = forwardRef30(
750
- ({
751
- url,
752
- loading = "lazy",
753
- autoplay = false,
754
- autopause = true,
755
- backgroundMode = false,
756
- showByline = false,
757
- showControls = true,
758
- doNotTrack = false,
759
- keyboard = true,
760
- loop = false,
761
- muted = false,
762
- pip = false,
763
- playsinline = true,
764
- showPortrait = true,
765
- quality = "auto",
766
- responsive = true,
767
- speed = false,
768
- showTitle = false,
769
- transparent = true,
770
- showPreview = false,
771
- autopip,
772
- controlsColor,
773
- interactiveParams,
774
- texttrack,
775
- children,
776
- ...rest
777
- }, ref) => {
778
- const [status, setStatus] = useState2("initial");
779
- const [previewImageUrl, setPreviewImageUrl] = useState2();
780
- const { renderer } = useContext3(ReactSdkContext3);
781
- const videoUrl = getVideoUrl({
782
- url,
783
- autoplay,
784
- autopause,
785
- backgroundMode,
786
- showControls,
787
- controlsColor,
788
- doNotTrack,
789
- interactiveParams,
790
- keyboard,
791
- loop,
792
- muted,
793
- pip,
794
- playsinline,
795
- quality,
796
- responsive,
797
- speed,
798
- texttrack,
799
- showTitle,
800
- transparent,
801
- showPortrait,
802
- autopip
803
- });
804
- return /* @__PURE__ */ jsx27(
805
- VimeoContext.Provider,
806
- {
807
- value: {
808
- status,
809
- previewImageUrl,
810
- onInitPlayer() {
811
- if (renderer !== "canvas") {
812
- setStatus("loading");
813
- }
814
- }
815
- },
816
- children: /* @__PURE__ */ jsx27(
817
- "div",
818
- {
819
- ...rest,
820
- ref: (value) => {
821
- if (ref !== null) {
822
- typeof ref === "function" ? ref(value) : ref.current = value;
823
- }
824
- },
825
- children: videoUrl === void 0 ? /* @__PURE__ */ jsx27(EmptyState, {}) : /* @__PURE__ */ jsxs(Fragment2, { children: [
826
- children,
827
- /* @__PURE__ */ jsx27(
828
- Player,
829
- {
830
- autoplay,
831
- videoUrl,
832
- previewImageUrl,
833
- loading,
834
- showPreview,
835
- renderer,
836
- status,
837
- onStatusChange: setStatus,
838
- onPreviewImageUrlChange: setPreviewImageUrl
839
- }
840
- )
841
- ] })
842
- }
843
- )
844
- }
845
- );
846
- }
847
- );
848
- Vimeo.displayName = "Vimeo";
849
-
850
- // src/vimeo-preview-image.tsx
851
- import {
852
- forwardRef as forwardRef31,
853
- useContext as useContext4
854
- } from "react";
855
- import { jsx as jsx28 } from "react/jsx-runtime";
856
- var base64Preview = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkOAMAANIAzr59FiYAAAAASUVORK5CYII=`;
857
- var VimeoPreviewImage = forwardRef31(({ src, ...rest }, ref) => {
858
- const vimeoContext = useContext4(VimeoContext);
859
- return /* @__PURE__ */ jsx28(
860
- Image,
861
- {
862
- ...rest,
863
- src: String(vimeoContext.previewImageUrl ?? src ?? base64Preview),
864
- ref
865
- }
866
- );
867
- });
868
- VimeoPreviewImage.displayName = "VimeoPreviewImage";
869
-
870
- // src/vimeo-play-button.tsx
871
- import {
872
- forwardRef as forwardRef32,
873
- useContext as useContext5
874
- } from "react";
875
- import { jsx as jsx29 } from "react/jsx-runtime";
876
- var VimeoPlayButton = forwardRef32(
877
- (props, ref) => {
878
- const vimeoContext = useContext5(VimeoContext);
879
- if (vimeoContext.status !== "initial") {
880
- return;
881
- }
882
- return /* @__PURE__ */ jsx29(Button, { ...props, onClick: vimeoContext.onInitPlayer, ref });
883
- }
884
- );
885
- VimeoPlayButton.displayName = "VimeoPlayButton";
886
-
887
- // src/vimeo-spinner.tsx
888
- import {
889
- forwardRef as forwardRef33,
890
- useContext as useContext6
891
- } from "react";
892
- import { jsx as jsx30 } from "react/jsx-runtime";
893
- var VimeoSpinner = forwardRef33(
894
- (props, ref) => {
895
- const vimeoContext = useContext6(VimeoContext);
896
- if (vimeoContext.status !== "loading") {
897
- return;
898
- }
899
- return /* @__PURE__ */ jsx30("div", { ...props, ref });
900
- }
901
- );
902
- VimeoSpinner.displayName = "VimeoSpinner";
903
-
904
- // src/xml-node.tsx
905
- import { ReactSdkContext as ReactSdkContext4 } from "@webstudio-is/react-sdk/runtime";
906
- import {
907
- Children,
908
- createElement as createElement4,
909
- forwardRef as forwardRef34,
910
- useContext as useContext7
911
- } from "react";
912
- import { jsx as jsx31, jsxs as jsxs2 } from "react/jsx-runtime";
913
- var XmlNode = forwardRef34(
914
- ({ tag = "", children, ...props }, ref) => {
915
- const { renderer } = useContext7(ReactSdkContext4);
916
- const attributeEntries = Object.entries(props).filter(
917
- ([key]) => key.startsWith("data-") === false && key.startsWith("aria-") === false
918
- ).filter(([key]) => key !== "tabIndex").filter(([, value]) => typeof value !== "function");
919
- if (renderer === void 0) {
920
- const attrProps = Object.fromEntries(attributeEntries);
921
- return createElement4(tag, attrProps, children);
922
- }
923
- const childrenArray = Children.toArray(children);
924
- const isTextChild = childrenArray.length > 0 && childrenArray.every((child) => typeof child === "string");
925
- const elementName = tag.replace(/^[^\p{L}_]+/u, "").replaceAll(/[^\p{L}\p{N}\-._:]+/gu, "");
926
- const attributes = attributeEntries.map(
927
- ([key, value]) => `${key}=${JSON.stringify(value)}`
928
- );
929
- return /* @__PURE__ */ jsxs2("div", { ...props, children: [
930
- /* @__PURE__ */ jsxs2("span", { style: { color: "rgb(16, 23, 233)" }, children: [
931
- "<",
932
- [elementName, ...attributes].join(" "),
933
- ">"
934
- ] }),
935
- childrenArray.length > 0 && /* @__PURE__ */ jsx31(
936
- "div",
937
- {
938
- ref,
939
- style: {
940
- display: isTextChild ? "inline" : "block",
941
- marginLeft: isTextChild ? 0 : "1rem"
942
- },
943
- children
944
- }
945
- ),
946
- /* @__PURE__ */ jsxs2("span", { style: { color: "rgb(16, 23, 233)" }, children: [
947
- "</",
948
- elementName,
949
- ">"
950
- ] })
951
- ] });
952
- }
953
- );
954
- XmlNode.displayName = "XmlNode";
955
-
956
- // src/time.tsx
957
- import { forwardRef as forwardRef35 } from "react";
958
- import { jsx as jsx32 } from "react/jsx-runtime";
959
- var languages = [
960
- "af",
961
- "am",
962
- "ar",
963
- "az",
964
- "be",
965
- "bg",
966
- "bn",
967
- "bs",
968
- "ca",
969
- "cs",
970
- "cy",
971
- "da",
972
- "de",
973
- "el",
974
- "en",
975
- "es",
976
- "et",
977
- "eu",
978
- "fa",
979
- "fi",
980
- "fr",
981
- "ga",
982
- "gl",
983
- "gu",
984
- "he",
985
- "hi",
986
- "hr",
987
- "hu",
988
- "hy",
989
- "id",
990
- "is",
991
- "it",
992
- "ja",
993
- "ka",
994
- "kk",
995
- "km",
996
- "kn",
997
- "ko",
998
- "ky",
999
- "lb",
1000
- "lt",
1001
- "lv",
1002
- "mk",
1003
- "ml",
1004
- "mn",
1005
- "mr",
1006
- "ms",
1007
- "mt",
1008
- "nb",
1009
- "nl",
1010
- "nn",
1011
- "pl",
1012
- "pt",
1013
- "ro",
1014
- "ru",
1015
- "si",
1016
- "sk",
1017
- "sl",
1018
- "sq",
1019
- "sr",
1020
- "sv",
1021
- "sw",
1022
- "ta",
1023
- "te",
1024
- "th",
1025
- "tr",
1026
- "uk",
1027
- "ur",
1028
- "uz",
1029
- "vi",
1030
- "zh"
1031
- ];
1032
- var countries = [
1033
- "AF",
1034
- "AL",
1035
- "DZ",
1036
- "AS",
1037
- "AD",
1038
- "AO",
1039
- "AI",
1040
- "AQ",
1041
- "AG",
1042
- "AR",
1043
- "AM",
1044
- "AW",
1045
- "AU",
1046
- "AT",
1047
- "AZ",
1048
- "BS",
1049
- "BH",
1050
- "BD",
1051
- "BB",
1052
- "BY",
1053
- "BE",
1054
- "BZ",
1055
- "BJ",
1056
- "BM",
1057
- "BT",
1058
- "BO",
1059
- "BA",
1060
- "BW",
1061
- "BR",
1062
- "BN",
1063
- "BG",
1064
- "BF",
1065
- "BI",
1066
- "CV",
1067
- "KH",
1068
- "CM",
1069
- "CA",
1070
- "KY",
1071
- "CF",
1072
- "TD",
1073
- "CL",
1074
- "CN",
1075
- "CO",
1076
- "KM",
1077
- "CG",
1078
- "CD",
1079
- "CR",
1080
- "HR",
1081
- "CU",
1082
- "CY",
1083
- "CZ",
1084
- "DK",
1085
- "DJ",
1086
- "DM",
1087
- "DO",
1088
- "EC",
1089
- "EG",
1090
- "SV",
1091
- "GQ",
1092
- "ER",
1093
- "EE",
1094
- "SZ",
1095
- "ET",
1096
- "FJ",
1097
- "FI",
1098
- "FR",
1099
- "GA",
1100
- "GM",
1101
- "GE",
1102
- "DE",
1103
- "GH",
1104
- "GR",
1105
- "GD",
1106
- "GT",
1107
- "GN",
1108
- "GW",
1109
- "GY",
1110
- "HT",
1111
- "HN",
1112
- "HU",
1113
- "IS",
1114
- "IN",
1115
- "ID",
1116
- "IR",
1117
- "IQ",
1118
- "IE",
1119
- "IL",
1120
- "IT",
1121
- "JM",
1122
- "JP",
1123
- "JO",
1124
- "KZ",
1125
- "KE",
1126
- "KI",
1127
- "KP",
1128
- "KR",
1129
- "KW",
1130
- "KG",
1131
- "LA",
1132
- "LV",
1133
- "LB",
1134
- "LS",
1135
- "LR",
1136
- "LY",
1137
- "LI",
1138
- "LT",
1139
- "LU",
1140
- "MG",
1141
- "MW",
1142
- "MY",
1143
- "MV",
1144
- "ML",
1145
- "MT",
1146
- "MH",
1147
- "MR",
1148
- "MU",
1149
- "MX",
1150
- "FM",
1151
- "MD",
1152
- "MC",
1153
- "MN",
1154
- "ME",
1155
- "MA",
1156
- "MZ",
1157
- "MM",
1158
- "NA",
1159
- "NR",
1160
- "NP",
1161
- "NL",
1162
- "NZ",
1163
- "NI",
1164
- "NE",
1165
- "NG",
1166
- "NO",
1167
- "OM",
1168
- "PK",
1169
- "PW",
1170
- "PA",
1171
- "PG",
1172
- "PY",
1173
- "PE",
1174
- "PH",
1175
- "PL",
1176
- "PT",
1177
- "QA",
1178
- "RO",
1179
- "RU",
1180
- "RW",
1181
- "KN",
1182
- "LC",
1183
- "VC",
1184
- "WS",
1185
- "SM",
1186
- "ST",
1187
- "SA",
1188
- "SN",
1189
- "RS",
1190
- "SC",
1191
- "SL",
1192
- "SG",
1193
- "SK",
1194
- "SI",
1195
- "SB",
1196
- "SO",
1197
- "ZA",
1198
- "SS",
1199
- "ES",
1200
- "LK",
1201
- "SD",
1202
- "SR",
1203
- "SE",
1204
- "CH",
1205
- "SY",
1206
- "TW",
1207
- "TJ",
1208
- "TZ",
1209
- "TH",
1210
- "TL",
1211
- "TG",
1212
- "TO",
1213
- "TT",
1214
- "TN",
1215
- "TR",
1216
- "TM",
1217
- "TV",
1218
- "UG",
1219
- "UA",
1220
- "AE",
1221
- "GB",
1222
- "US",
1223
- "UY",
1224
- "UZ",
1225
- "VU",
1226
- "VA",
1227
- "VE",
1228
- "VN",
1229
- "YE",
1230
- "ZM",
1231
- "ZW"
1232
- ];
1233
- var INITIAL_DATE_STRING = "dateTime attribute is not set";
1234
- var INVALID_DATE_STRING = "";
1235
- var DEFAULT_LANGUAGE = "en";
1236
- var DEFAULT_COUNTRY = "GB";
1237
- var DEFAULT_DATE_STYLE = "medium";
1238
- var DEFAULT_TIME_STYLE = "none";
1239
- var languageOrDefault = (language) => {
1240
- return languages.includes(language) ? language : DEFAULT_LANGUAGE;
1241
- };
1242
- var countryOrDefault = (country) => {
1243
- return countries.includes(country) ? country : DEFAULT_COUNTRY;
1244
- };
1245
- var dateStyleOrUndefined = (value) => {
1246
- if (["full", "long", "medium", "short"].includes(value)) {
1247
- return value;
1248
- }
1249
- return void 0;
1250
- };
1251
- var timeStyleOrUndefined = (value) => {
1252
- if (["full", "long", "medium", "short"].includes(value)) {
1253
- return value;
1254
- }
1255
- return void 0;
1256
- };
1257
- var parseDate = (datetimeString) => {
1258
- if (datetimeString === "") {
1259
- return;
1260
- }
1261
- let date = new Date(datetimeString);
1262
- if (Number.isNaN(date.getTime()) === false) {
1263
- return date;
1264
- }
1265
- if (/^\d+$/.test(datetimeString)) {
1266
- let timestamp = Number(datetimeString);
1267
- if (datetimeString.length === 10) {
1268
- timestamp *= 1e3;
1269
- }
1270
- date = new Date(timestamp);
1271
- }
1272
- if (Number.isNaN(date.getTime()) === false) {
1273
- return date;
1274
- }
1275
- };
1276
- var Time = forwardRef35(
1277
- ({
1278
- language = DEFAULT_LANGUAGE,
1279
- country = DEFAULT_COUNTRY,
1280
- dateStyle = DEFAULT_DATE_STYLE,
1281
- timeStyle = DEFAULT_TIME_STYLE,
1282
- datetime = INITIAL_DATE_STRING,
1283
- ...props
1284
- }, ref) => {
1285
- const locale = `${languageOrDefault(language)}-${countryOrDefault(
1286
- country
1287
- )}`;
1288
- const options = {
1289
- dateStyle: dateStyleOrUndefined(dateStyle),
1290
- timeStyle: timeStyleOrUndefined(timeStyle)
1291
- };
1292
- const datetimeString = datetime === null ? INVALID_DATE_STRING : datetime.toString();
1293
- const date = parseDate(datetimeString);
1294
- let formattedDate = datetimeString;
1295
- if (date) {
1296
- try {
1297
- formattedDate = new Intl.DateTimeFormat(locale, options).format(date);
1298
- } catch {
1299
- }
1300
- }
1301
- return /* @__PURE__ */ jsx32("time", { ref, dateTime: datetimeString, ...props, children: formattedDate });
1302
- }
1303
- );
1304
-
1305
- // src/select.tsx
1306
- import {
1307
- getClosestInstance,
1308
- getInstanceSelectorById
1309
- } from "@webstudio-is/react-sdk/runtime";
1310
- import { forwardRef as forwardRef36 } from "react";
1311
- import { jsx as jsx33 } from "react/jsx-runtime";
1312
- var Select = forwardRef36(({ value, defaultValue, ...props }, ref) => /* @__PURE__ */ jsx33("select", { ...props, defaultValue: value ?? defaultValue, ref }));
1313
- Select.displayName = "Select";
1314
-
1315
- // src/option.tsx
1316
- import { forwardRef as forwardRef37 } from "react";
1317
- import { jsx as jsx34 } from "react/jsx-runtime";
1318
- var Option = forwardRef37((props, ref) => /* @__PURE__ */ jsx34("option", { ...props, ref }));
1319
- Option.displayName = "Option";
1
+ import { Slot as e } from "./slot.js";
2
+ import { Fragment as m } from "./fragment.js";
3
+ import { HtmlEmbed as x } from "./html-embed.js";
4
+ import { MarkdownEmbed as i } from "./markdown-embed.js";
5
+ import { Body as n } from "./body.js";
6
+ import { Box as d } from "./box.js";
7
+ import { Text as u } from "./text.js";
8
+ import { Heading as S } from "./heading.js";
9
+ import { Paragraph as b } from "./paragraph.js";
10
+ import { Link as k } from "./link.js";
11
+ import { RichTextLink as I } from "./rich-text-link.js";
12
+ import { Span as F } from "./span.js";
13
+ import { Bold as h } from "./bold.js";
14
+ import { Italic as R } from "./italic.js";
15
+ import { Superscript as y } from "./superscript.js";
16
+ import { Subscript as E } from "./subscript.js";
17
+ import { Button as X } from "./button.js";
18
+ import { Input as v } from "./input.js";
19
+ import { Form as N, Form as O } from "./form.js";
20
+ import { Image as z } from "./image.js";
21
+ import { Blockquote as D } from "./blockquote.js";
22
+ import { List as J } from "./list.js";
23
+ import { ListItem as Q } from "./list-item.js";
24
+ import { Separator as W } from "./separator.js";
25
+ import { CodeText as Z } from "./code-text.js";
26
+ import { Label as $ } from "./label.js";
27
+ import { Textarea as ro } from "./textarea.js";
28
+ import { RadioButton as to } from "./radio-button.js";
29
+ import { Checkbox as po } from "./checkbox.js";
30
+ import { Vimeo as fo } from "./vimeo.js";
31
+ import { VimeoPreviewImage as ao } from "./vimeo-preview-image.js";
32
+ import { VimeoPlayButton as lo } from "./vimeo-play-button.js";
33
+ import { VimeoSpinner as uo } from "./vimeo-spinner.js";
34
+ import { XmlNode as So } from "./xml-node.js";
35
+ import { XmlTime as bo } from "./xml-time.js";
36
+ import { Time as ko } from "./time.js";
37
+ import { Select as Io } from "./select.js";
38
+ import { Option as Fo } from "./option.js";
1320
39
  export {
1321
- Blockquote,
1322
- Body,
1323
- Bold,
1324
- Box,
1325
- Button,
1326
- Checkbox,
1327
- CodeText,
1328
- Form,
1329
- Fragment,
1330
- Heading,
1331
- HtmlEmbed,
1332
- Image,
1333
- Input,
1334
- Italic,
1335
- Label,
1336
- Link,
1337
- List,
1338
- ListItem,
1339
- MarkdownEmbed,
1340
- Option,
1341
- Paragraph,
1342
- RadioButton,
1343
- Form as RemixForm,
1344
- RichTextLink,
1345
- Select,
1346
- Separator,
1347
- Slot,
1348
- Span,
1349
- Subscript,
1350
- Superscript,
1351
- Text,
1352
- Textarea,
1353
- Time,
1354
- Vimeo,
1355
- VimeoPlayButton,
1356
- VimeoPreviewImage,
1357
- VimeoSpinner,
1358
- XmlNode
40
+ D as Blockquote,
41
+ n as Body,
42
+ h as Bold,
43
+ d as Box,
44
+ X as Button,
45
+ po as Checkbox,
46
+ Z as CodeText,
47
+ N as Form,
48
+ m as Fragment,
49
+ S as Heading,
50
+ x as HtmlEmbed,
51
+ z as Image,
52
+ v as Input,
53
+ R as Italic,
54
+ $ as Label,
55
+ k as Link,
56
+ J as List,
57
+ Q as ListItem,
58
+ i as MarkdownEmbed,
59
+ Fo as Option,
60
+ b as Paragraph,
61
+ to as RadioButton,
62
+ O as RemixForm,
63
+ I as RichTextLink,
64
+ Io as Select,
65
+ W as Separator,
66
+ e as Slot,
67
+ F as Span,
68
+ E as Subscript,
69
+ y as Superscript,
70
+ u as Text,
71
+ ro as Textarea,
72
+ ko as Time,
73
+ fo as Vimeo,
74
+ lo as VimeoPlayButton,
75
+ ao as VimeoPreviewImage,
76
+ uo as VimeoSpinner,
77
+ So as XmlNode,
78
+ bo as XmlTime
1359
79
  };