@wix/editor-react-components 1.2878.0 → 1.2881.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/site/components/AccordionComponent/component.js +1 -1
- package/dist/site/components/AnimatedIcon/component.js +1 -1
- package/dist/site/components/AudioPlayer/component.js +1 -1
- package/dist/site/components/BoxContainer/component.js +1 -1
- package/dist/site/components/Breadcrumbs/component.js +1 -1
- package/dist/site/components/Checkbox/css.css +5 -6
- package/dist/site/components/DatePicker/component.js +1 -1
- package/dist/site/components/DatePicker/css.css +5 -7
- package/dist/site/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/site/components/Dropdown/Dropdown.types.d.ts +1 -3
- package/dist/site/components/Dropdown/component.js +5 -17
- package/dist/site/components/Dropdown/constants.d.ts +1 -1
- package/dist/site/components/Dropdown/css.css +4 -39
- package/dist/site/components/Dropdown/manifest.js +1 -7
- package/dist/site/components/GoogleMap/component.js +3 -3
- package/dist/site/components/HTMLComponent/component.js +2 -2
- package/dist/site/components/HipaaIcon/component.js +1 -1
- package/dist/site/components/Image3/component.js +1 -1
- package/dist/site/components/LinkBar/component.js +1 -1
- package/dist/site/components/Lottie/component.js +3 -3
- package/dist/site/components/MarkdownBlock/component.js +2 -2
- package/dist/site/components/Menu/component.js +2 -2
- package/dist/site/components/Menu/sdk.js +1 -1
- package/dist/site/components/ShareButtons/component.js +1 -1
- package/dist/site/components/Slideshow/component.js +2 -2
- package/dist/site/components/TextInput/css.css +1 -6
- package/dist/site/components/TextMarquee/component.js +1 -1
- package/dist/site/components/TimePicker/component.js +1 -1
- package/dist/site/components/TimePicker/css.css +1 -7
- package/dist/site/components/TransparentVideo/component.js +1 -1
- package/dist/site/components/VideoScrub/component.js +2 -2
- package/dist/site/components/VideoUpload/component.js +2 -2
- package/dist/site/components/WRichText/WRichText.types.d.ts +1 -1
- package/dist/site/components/WRichText/component.js +40 -4
- package/dist/site/components/WRichText/manifest.js +2 -1
- package/dist/site/components/WRichText/sdk.js +1 -1
- package/dist/site/components/WRichText/utils/renderRichText.d.ts +8 -0
- package/dist/site/components/chunks/constants36.js +1 -1
- package/dist/site/components/chunks/index.js +2133 -3
- package/dist/site/components/chunks/index10.js +2012 -230
- package/dist/site/components/chunks/index2.js +3 -3
- package/dist/site/components/chunks/index3.js +2 -2
- package/dist/site/components/chunks/index4.js +2 -2
- package/dist/site/components/chunks/index5.js +3 -2133
- package/dist/site/components/chunks/index9.js +230 -2012
- package/dist/site/components/chunks/parseHtml.js +2 -2
- package/dist/site/components/chunks/parseSvg.js +2 -2
- package/dist/site/components/chunks/useConsentPolicyProps.js +2 -2
- 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(
|
|
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(
|
|
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:
|
|
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,
|
|
@@ -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/
|
|
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;
|