@wix/editor-react-components 1.2877.0 → 1.2879.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 (51) hide show
  1. package/dist/site/components/AccordionComponent/component.js +1 -1
  2. package/dist/site/components/AnimatedIcon/component.js +1 -1
  3. package/dist/site/components/AudioPlayer/component.js +1 -1
  4. package/dist/site/components/BoxContainer/component.js +1 -1
  5. package/dist/site/components/Breadcrumbs/component.js +1 -1
  6. package/dist/site/components/DatePicker/DatePicker.types.d.ts +1 -3
  7. package/dist/site/components/DatePicker/component.js +2 -3
  8. package/dist/site/components/DatePicker/constants.d.ts +1 -1
  9. package/dist/site/components/DatePicker/manifest.js +1 -7
  10. package/dist/site/components/Dropdown/component.js +1 -1
  11. package/dist/site/components/GoogleMap/component.js +3 -3
  12. package/dist/site/components/HTMLComponent/component.js +2 -2
  13. package/dist/site/components/HipaaIcon/component.js +1 -1
  14. package/dist/site/components/Image3/component.js +1 -1
  15. package/dist/site/components/LinkBar/component.js +1 -1
  16. package/dist/site/components/Lottie/component.js +3 -3
  17. package/dist/site/components/MarkdownBlock/component.js +2 -2
  18. package/dist/site/components/Menu/component.js +2 -2
  19. package/dist/site/components/Menu/sdk.js +1 -1
  20. package/dist/site/components/ShareButtons/component.js +1 -1
  21. package/dist/site/components/Slideshow/component.js +2 -2
  22. package/dist/site/components/TextInput/TextInput.types.d.ts +1 -2
  23. package/dist/site/components/TextInput/component.js +2 -24
  24. package/dist/site/components/TextInput/css.css +0 -11
  25. package/dist/site/components/TextInput/manifest.js +2 -14
  26. package/dist/site/components/TextMarquee/component.js +1 -1
  27. package/dist/site/components/TimePicker/TimePicker.types.d.ts +1 -3
  28. package/dist/site/components/TimePicker/component.js +5 -9
  29. package/dist/site/components/TimePicker/constants.d.ts +1 -1
  30. package/dist/site/components/TimePicker/manifest.js +4 -8
  31. package/dist/site/components/TransparentVideo/component.js +1 -1
  32. package/dist/site/components/VideoScrub/component.js +2 -2
  33. package/dist/site/components/VideoUpload/component.js +2 -2
  34. package/dist/site/components/WRichText/WRichText.types.d.ts +1 -1
  35. package/dist/site/components/WRichText/component.js +40 -4
  36. package/dist/site/components/WRichText/manifest.js +2 -1
  37. package/dist/site/components/WRichText/sdk.js +1 -1
  38. package/dist/site/components/WRichText/utils/renderRichText.d.ts +8 -0
  39. package/dist/site/components/chunks/constants2.js +1 -1
  40. package/dist/site/components/chunks/constants37.js +1 -1
  41. package/dist/site/components/chunks/index.js +2133 -3
  42. package/dist/site/components/chunks/index10.js +2012 -230
  43. package/dist/site/components/chunks/index2.js +3 -3
  44. package/dist/site/components/chunks/index3.js +2 -2
  45. package/dist/site/components/chunks/index4.js +2 -2
  46. package/dist/site/components/chunks/index5.js +3 -2133
  47. package/dist/site/components/chunks/index9.js +230 -2012
  48. package/dist/site/components/chunks/parseHtml.js +2 -2
  49. package/dist/site/components/chunks/parseSvg.js +2 -2
  50. package/dist/site/components/chunks/useConsentPolicyProps.js +2 -2
  51. package/package.json +2 -2
@@ -1,12 +1,47 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import { useRef, useEffect, useMemo } from "react";
3
+ import { createElement, useRef, useEffect, useMemo } from "react";
4
4
  import { c as clsx } from "../chunks/clsx.js";
5
5
  import { f as formatClassNames } from "../chunks/classNames.js";
6
6
  import { g as getQaDataAttributes, a as getDataAttributes } from "../chunks/dataUtils.js";
7
7
  import { a as activateBySpaceOrEnterButton, c as convertA11yKeysToHtmlFormat, g as getAccessibilityAttributesSpread } from "../chunks/a11y.js";
8
+ import { l as libExports } from "../chunks/index.js";
8
9
  import { p as parseHtml } from "../chunks/parseHtml.js";
9
10
  import { T as TestIds } from "../chunks/constants.js";
11
+ const HTML_TAGS = /* @__PURE__ */ new Set([
12
+ "h1",
13
+ "h2",
14
+ "h3",
15
+ "h4",
16
+ "h5",
17
+ "h6",
18
+ "p",
19
+ "blockquote"
20
+ ]);
21
+ const renderRichText = (html, tag) => {
22
+ if (!tag || !HTML_TAGS.has(tag)) {
23
+ return parseHtml(html);
24
+ }
25
+ let replaced = false;
26
+ const options = {
27
+ replace: (node) => {
28
+ var _a;
29
+ const isTopLevelElement = node.type === "tag" && ((_a = node.parent) == null ? void 0 : _a.type) === "root";
30
+ if (!isTopLevelElement) {
31
+ return void 0;
32
+ }
33
+ replaced = true;
34
+ const element = node;
35
+ return createElement(
36
+ tag,
37
+ libExports.attributesToProps(element.attribs),
38
+ libExports.domToReact(element.children, options)
39
+ );
40
+ }
41
+ };
42
+ const content = parseHtml(html, options);
43
+ return replaced || !html.trim() ? content : createElement(tag, null, content);
44
+ };
10
45
  const semanticClassNames = {
11
46
  root: "rich-text"
12
47
  };
@@ -90,6 +125,7 @@ const WRichText$1 = React.forwardRef((props, ref) => {
90
125
  } = props;
91
126
  const [isInteractive, setIsInteractive] = React.useState(false);
92
127
  const { prefix, suffix } = screenReader || {};
128
+ const { tag, ...a11yAttributes } = a11y ?? {};
93
129
  const htmlWrapperRef = React.useRef(null);
94
130
  usePopupLinkEvents(htmlWrapperRef, [html]);
95
131
  const skinsWithContainer = [
@@ -132,7 +168,7 @@ const WRichText$1 = React.forwardRef((props, ref) => {
132
168
  "data-testid": TestIds.richTextElement,
133
169
  ...sdkEventHandlers,
134
170
  ...getAccessibilityAttributesSpread({ ariaAttributes, lang }),
135
- ...convertA11yKeysToHtmlFormat(a11y ?? {}),
171
+ ...convertA11yKeysToHtmlFormat(a11yAttributes),
136
172
  ...getQaDataAttributes(isQaMode, fullNameCompType)
137
173
  } : {
138
174
  className: isClassNameToRootEnabled ? className : ""
@@ -167,7 +203,7 @@ const WRichText$1 = React.forwardRef((props, ref) => {
167
203
  "data-testid": TestIds.richTextElement,
168
204
  ...sdkEventHandlers,
169
205
  ...getAccessibilityAttributesSpread({ ariaAttributes, lang }),
170
- ...convertA11yKeysToHtmlFormat(a11y ?? {})
206
+ ...convertA11yKeysToHtmlFormat(a11yAttributes)
171
207
  }
172
208
  };
173
209
  const prefixElement = prefix && /* @__PURE__ */ jsx(
@@ -184,7 +220,7 @@ const WRichText$1 = React.forwardRef((props, ref) => {
184
220
  testId: TestIds.screenReaderSuffixElement
185
221
  }
186
222
  );
187
- const richTextElement = /* @__PURE__ */ jsx("div", { ...richTextAttributes, children: parseHtml(html) });
223
+ const richTextElement = /* @__PURE__ */ jsx("div", { ...richTextAttributes, children: renderRichText(html, tag) });
188
224
  if (isInContainer) {
189
225
  return /* @__PURE__ */ jsxs("div", { ...wrapperAttributes, children: [
190
226
  prefixElement,
@@ -69,7 +69,8 @@ const manifest = {
69
69
  DATA.A11Y_ATTRIBUTES.ariaLevel,
70
70
  DATA.A11Y_ATTRIBUTES.role,
71
71
  DATA.A11Y_ATTRIBUTES.ariaHidden,
72
- DATA.A11Y_ATTRIBUTES.lang
72
+ DATA.A11Y_ATTRIBUTES.lang,
73
+ DATA.A11Y_ATTRIBUTES.tag
73
74
  ]
74
75
  }
75
76
  }
@@ -1,6 +1,6 @@
1
1
  import { c as createA11ySdk } from "../chunks/a11ySdk.js";
2
2
  import { s as sanitizeHTML } from "../chunks/sanitizeHTML.js";
3
- import { L as LinkUtilsDefinition } from "../chunks/index.js";
3
+ import { L as LinkUtilsDefinition } from "../chunks/index2.js";
4
4
  import { w as wixCodeName, a as wixGuard, e as endBlockTagRegex, b as endTagRegex, s as startTagRegex } from "../chunks/constants.js";
5
5
  import { i as isNil } from "../chunks/assert.js";
6
6
  import { c as createElementPropsSDKFactory } from "../chunks/elementPropsSDKFactory.js";
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Renders the rich text, with every top-level element as the owner's HTML tag
4
+ * (the manifest's `a11y.tag`) when one is picked. Attributes and children are
5
+ * kept. Text-only content, as set through the SDK, is wrapped in the tag.
6
+ * Unsupported tags are ignored.
7
+ */
8
+ export declare const renderRichText: (html: string, tag: string | undefined) => ReactNode;
@@ -1,4 +1,4 @@
1
- const COMPONENT_TYPE = "wixEditorElements.TimePicker__DEV__v7";
1
+ const COMPONENT_TYPE = "wixEditorElements.TimePicker__DEV__v8";
2
2
  const DisplayNames = {
3
3
  root: {
4
4
  elementDisplayName: "Time Picker",
@@ -1,4 +1,4 @@
1
- const COMPONENT_TYPE = "wixEditorElements.DatePicker__DEV__v4";
1
+ const COMPONENT_TYPE = "wixEditorElements.DatePicker__DEV__v5";
2
2
  const DisplayNames = {
3
3
  root: {
4
4
  elementDisplayName: "Date Picker",