@wix/editor-react-components 1.2340.0 → 1.2342.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,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BoxContainerA11y } from './types';
|
|
3
|
+
type BoxContainerDomA11y = React.AriaAttributes & Pick<React.HTMLAttributes<HTMLDivElement>, 'role' | 'tabIndex'>;
|
|
4
|
+
export declare const normalizeBoxContainerA11y: (a11y?: BoxContainerA11y, ariaLabelOverride?: string) => BoxContainerDomA11y;
|
|
5
|
+
export {};
|
|
@@ -3,10 +3,43 @@ import { c as clsx } from "../chunks/clsx.js";
|
|
|
3
3
|
import { useService } from "@wix/services-manager-react";
|
|
4
4
|
import { T as TranslationsDefinition } from "../chunks/index5.js";
|
|
5
5
|
import { A as ARIA_LABEL_NAMESPACE } from "../chunks/constants31.js";
|
|
6
|
+
import { e as getTabIndexAttribute, f as convertA11yKeysToHtmlFormat } from "../chunks/a11y.js";
|
|
6
7
|
const root = "root__eLvEL";
|
|
7
8
|
const styles = {
|
|
8
9
|
root
|
|
9
10
|
};
|
|
11
|
+
const SPECIAL_KEYS = /* @__PURE__ */ new Set([
|
|
12
|
+
"role",
|
|
13
|
+
"tabIndex",
|
|
14
|
+
"tabindex",
|
|
15
|
+
"ariaLabel",
|
|
16
|
+
"aria-label",
|
|
17
|
+
"ariaHidden"
|
|
18
|
+
]);
|
|
19
|
+
const normalizeBoxContainerA11y = (a11y, ariaLabelOverride) => {
|
|
20
|
+
var _a;
|
|
21
|
+
const rawA11y = a11y ?? {};
|
|
22
|
+
const legacyAttributes = {};
|
|
23
|
+
const canonicalAttributes = {};
|
|
24
|
+
Object.entries(rawA11y).forEach(([key, value]) => {
|
|
25
|
+
if (SPECIAL_KEYS.has(key) || value === void 0) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const target = key.startsWith("aria-") ? legacyAttributes : canonicalAttributes;
|
|
29
|
+
target[key] = value;
|
|
30
|
+
});
|
|
31
|
+
const accessibleName = (_a = (a11y == null ? void 0 : a11y.ariaLabel) ?? rawA11y["aria-label"]) == null ? void 0 : _a.trim();
|
|
32
|
+
return {
|
|
33
|
+
...convertA11yKeysToHtmlFormat(legacyAttributes),
|
|
34
|
+
...convertA11yKeysToHtmlFormat(canonicalAttributes),
|
|
35
|
+
...getTabIndexAttribute({
|
|
36
|
+
tabIndex: a11y == null ? void 0 : a11y.tabIndex,
|
|
37
|
+
tabindex: rawA11y.tabindex
|
|
38
|
+
}),
|
|
39
|
+
role: (a11y == null ? void 0 : a11y.role) ?? (accessibleName ? "group" : void 0),
|
|
40
|
+
"aria-label": accessibleName || void 0
|
|
41
|
+
};
|
|
42
|
+
};
|
|
10
43
|
function BoxContainer({
|
|
11
44
|
id,
|
|
12
45
|
children,
|
|
@@ -21,13 +54,12 @@ function BoxContainer({
|
|
|
21
54
|
}) {
|
|
22
55
|
const { translate } = useService(TranslationsDefinition);
|
|
23
56
|
translate(ARIA_LABEL_NAMESPACE);
|
|
24
|
-
const
|
|
57
|
+
const a11yAttributes = normalizeBoxContainerA11y(a11y);
|
|
25
58
|
return /* @__PURE__ */ jsx(
|
|
26
59
|
"div",
|
|
27
60
|
{
|
|
28
61
|
id,
|
|
29
|
-
...
|
|
30
|
-
"aria-label": ariaLabel,
|
|
62
|
+
...a11yAttributes,
|
|
31
63
|
className: clsx(styles.root, "container", className),
|
|
32
64
|
onClick,
|
|
33
65
|
onDoubleClick: onDblClick,
|
|
@@ -43,7 +43,6 @@ const manifest = {
|
|
|
43
43
|
DATA.A11Y_ATTRIBUTES.ariaLive,
|
|
44
44
|
DATA.A11Y_ATTRIBUTES.ariaRoledescription,
|
|
45
45
|
DATA.A11Y_ATTRIBUTES.ariaLevel,
|
|
46
|
-
DATA.A11Y_ATTRIBUTES.ariaHidden,
|
|
47
46
|
DATA.A11Y_ATTRIBUTES.ariaAtomic,
|
|
48
47
|
DATA.A11Y_ATTRIBUTES.ariaCurrent,
|
|
49
48
|
DATA.A11Y_ATTRIBUTES.ariaRelevant
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { A11y } from '@wix/editor-react-types';
|
|
3
|
+
type CanonicalBoxContainerA11y = Pick<A11y, 'tabIndex' | 'ariaLabel' | 'ariaLive' | 'ariaRoledescription' | 'ariaLevel' | 'ariaHidden' | 'ariaAtomic' | 'ariaCurrent' | 'ariaRelevant'>;
|
|
4
|
+
export interface BoxContainerA11y extends CanonicalBoxContainerA11y {
|
|
5
|
+
role?: React.AriaRole;
|
|
6
|
+
/** @deprecated Use `tabIndex`. */
|
|
7
|
+
tabindex?: number;
|
|
8
|
+
/** @deprecated Use `ariaLabel`. */
|
|
9
|
+
'aria-label'?: string;
|
|
10
|
+
/** @deprecated Use `ariaLive`. */
|
|
11
|
+
'aria-live'?: 'polite' | 'assertive' | 'off';
|
|
12
|
+
/** @deprecated Use `ariaRoledescription`. */
|
|
13
|
+
'aria-roledescription'?: string;
|
|
14
|
+
/** @deprecated Use `ariaLevel`. */
|
|
15
|
+
'aria-level'?: number;
|
|
16
|
+
/** @deprecated Existing DOM alias preserved for compatibility. */
|
|
17
|
+
'aria-hidden'?: boolean;
|
|
18
|
+
/** @deprecated Use `ariaAtomic`. */
|
|
19
|
+
'aria-atomic'?: boolean;
|
|
20
|
+
/** @deprecated Use `ariaCurrent`. */
|
|
21
|
+
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
|
|
22
|
+
/** @deprecated Use `ariaRelevant`. */
|
|
23
|
+
'aria-relevant'?: 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals';
|
|
24
|
+
}
|
|
2
25
|
export interface BoxContainerProps {
|
|
3
26
|
/** DOM `id` on the root `<div>`. Required by the React types — the editor always supplies one. */
|
|
4
27
|
id: string;
|
|
@@ -18,17 +41,7 @@ export interface BoxContainerProps {
|
|
|
18
41
|
onFocus?: () => void;
|
|
19
42
|
/** Fires on blur of the root. Editor label: "On Blur". */
|
|
20
43
|
onBlur?: () => void;
|
|
21
|
-
/**
|
|
22
|
-
a11y?:
|
|
23
|
-
role?: string | undefined;
|
|
24
|
-
tabindex?: number | undefined;
|
|
25
|
-
'aria-label'?: string | undefined;
|
|
26
|
-
'aria-live'?: 'polite' | 'assertive' | 'off' | undefined;
|
|
27
|
-
'aria-roledescription'?: string | undefined;
|
|
28
|
-
'aria-level'?: number | undefined;
|
|
29
|
-
'aria-hidden'?: boolean | undefined;
|
|
30
|
-
'aria-atomic'?: boolean | undefined;
|
|
31
|
-
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false' | undefined;
|
|
32
|
-
'aria-relevant'?: 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' | undefined;
|
|
33
|
-
};
|
|
44
|
+
/** Accessibility data normalized onto the root `<div>`. */
|
|
45
|
+
a11y?: BoxContainerA11y;
|
|
34
46
|
}
|
|
47
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/editor-react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2342.0",
|
|
4
4
|
"description": "React components for the Wix Editor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -199,5 +199,5 @@
|
|
|
199
199
|
"registry": "https://registry.npmjs.org/",
|
|
200
200
|
"access": "public"
|
|
201
201
|
},
|
|
202
|
-
"falconPackageHash": "
|
|
202
|
+
"falconPackageHash": "d70c02cf64c2bb85b7b8a12107a4b9d25f7dea849b1c47aa37585c55"
|
|
203
203
|
}
|