@wordpress/interface 6.8.3 → 6.9.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/CHANGELOG.md +2 -0
- package/build/components/complementary-area-toggle/index.js +13 -1
- package/build/components/complementary-area-toggle/index.js.map +1 -1
- package/build-module/components/complementary-area-toggle/index.js +15 -1
- package/build-module/components/complementary-area-toggle/index.js.map +1 -1
- package/build-style/style-rtl.css +10 -1
- package/build-style/style.css +10 -1
- package/package.json +14 -14
- package/src/components/complementary-area-toggle/index.js +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,15 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
18
18
|
* Internal dependencies
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Whether the role supports checked state.
|
|
23
|
+
*
|
|
24
|
+
* @param {import('react').AriaRole} role Role.
|
|
25
|
+
* @return {boolean} Whether the role supports checked state.
|
|
26
|
+
* @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
27
|
+
*/function roleSupportsCheckedState(role) {
|
|
28
|
+
return ['checkbox', 'option', 'radio', 'switch', 'menuitemcheckbox', 'menuitemradio', 'treeitem'].includes(role);
|
|
29
|
+
}
|
|
21
30
|
function ComplementaryAreaToggle({
|
|
22
31
|
as = _components.Button,
|
|
23
32
|
scope,
|
|
@@ -36,7 +45,10 @@ function ComplementaryAreaToggle({
|
|
|
36
45
|
} = (0, _data.useDispatch)(_store.store);
|
|
37
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ComponentToUse, {
|
|
38
47
|
icon: selectedIcon && isSelected ? selectedIcon : icon,
|
|
39
|
-
"aria-controls": identifier.replace('/', ':')
|
|
48
|
+
"aria-controls": identifier.replace('/', ':')
|
|
49
|
+
// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
50
|
+
,
|
|
51
|
+
"aria-checked": roleSupportsCheckedState(props.role) ? isSelected : undefined,
|
|
40
52
|
onClick: () => {
|
|
41
53
|
if (isSelected) {
|
|
42
54
|
disableComplementaryArea(scope);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_store","_complementaryAreaContext","_interopRequireDefault","_jsxRuntime","ComplementaryAreaToggle","as","Button","scope","identifier","icon","selectedIcon","name","shortcut","props","ComponentToUse","isSelected","useSelect","select","interfaceStore","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","useDispatch","jsx","replace","onClick","_default","exports","default","complementaryAreaContext"],"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\nimport complementaryAreaContext from '../complementary-area-context';\n\nfunction ComplementaryAreaToggle( {\n\tas = Button,\n\tscope,\n\tidentifier,\n\ticon,\n\tselectedIcon,\n\tname,\n\tshortcut,\n\t...props\n} ) {\n\tconst ComponentToUse = as;\n\tconst isSelected = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( scope ) ===\n\t\t\tidentifier,\n\t\t[ identifier, scope ]\n\t);\n\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\n\treturn (\n\t\t<ComponentToUse\n\t\t\ticon={ selectedIcon && isSelected ? selectedIcon : icon }\n\t\t\taria-controls={ identifier.replace( '/', ':' ) }\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isSelected ) {\n\t\t\t\t\tdisableComplementaryArea( scope );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( scope, identifier );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAqE,IAAAK,WAAA,GAAAL,OAAA;AAVrE;AACA;AACA;;AAIA;AACA;AACA;;AAIA,SAASM,uBAAuBA,CAAE;EACjCC,EAAE,GAAGC,kBAAM;EACXC,KAAK;EACLC,UAAU;EACVC,IAAI;EACJC,YAAY;EACZC,IAAI;EACJC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,MAAMC,cAAc,GAAGT,EAAE;EACzB,MAAMU,UAAU,GAAG,IAAAC,eAAS,EACzBC,MAAM,IACPA,MAAM,CAAEC,YAAe,CAAC,CAACC,0BAA0B,CAAEZ,KAAM,CAAC,KAC5DC,UAAU,EACX,CAAEA,UAAU,EAAED,KAAK,CACpB,CAAC;EAED,MAAM;IAAEa,uBAAuB;IAAEC;EAAyB,CAAC,GAC1D,IAAAC,iBAAW,EAAEJ,YAAe,CAAC;EAE9B,oBACC,
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_store","_complementaryAreaContext","_interopRequireDefault","_jsxRuntime","roleSupportsCheckedState","role","includes","ComplementaryAreaToggle","as","Button","scope","identifier","icon","selectedIcon","name","shortcut","props","ComponentToUse","isSelected","useSelect","select","interfaceStore","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","useDispatch","jsx","replace","undefined","onClick","_default","exports","default","complementaryAreaContext"],"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\nimport complementaryAreaContext from '../complementary-area-context';\n\n/**\n * Whether the role supports checked state.\n *\n * @param {import('react').AriaRole} role Role.\n * @return {boolean} Whether the role supports checked state.\n * @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked\n */\nfunction roleSupportsCheckedState( role ) {\n\treturn [\n\t\t'checkbox',\n\t\t'option',\n\t\t'radio',\n\t\t'switch',\n\t\t'menuitemcheckbox',\n\t\t'menuitemradio',\n\t\t'treeitem',\n\t].includes( role );\n}\n\nfunction ComplementaryAreaToggle( {\n\tas = Button,\n\tscope,\n\tidentifier,\n\ticon,\n\tselectedIcon,\n\tname,\n\tshortcut,\n\t...props\n} ) {\n\tconst ComponentToUse = as;\n\tconst isSelected = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( scope ) ===\n\t\t\tidentifier,\n\t\t[ identifier, scope ]\n\t);\n\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\n\treturn (\n\t\t<ComponentToUse\n\t\t\ticon={ selectedIcon && isSelected ? selectedIcon : icon }\n\t\t\taria-controls={ identifier.replace( '/', ':' ) }\n\t\t\t// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked\n\t\t\taria-checked={\n\t\t\t\troleSupportsCheckedState( props.role ) ? isSelected : undefined\n\t\t\t}\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isSelected ) {\n\t\t\t\t\tdisableComplementaryArea( scope );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( scope, identifier );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAqE,IAAAK,WAAA,GAAAL,OAAA;AAVrE;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,SAASM,wBAAwBA,CAAEC,IAAI,EAAG;EACzC,OAAO,CACN,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,UAAU,CACV,CAACC,QAAQ,CAAED,IAAK,CAAC;AACnB;AAEA,SAASE,uBAAuBA,CAAE;EACjCC,EAAE,GAAGC,kBAAM;EACXC,KAAK;EACLC,UAAU;EACVC,IAAI;EACJC,YAAY;EACZC,IAAI;EACJC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,MAAMC,cAAc,GAAGT,EAAE;EACzB,MAAMU,UAAU,GAAG,IAAAC,eAAS,EACzBC,MAAM,IACPA,MAAM,CAAEC,YAAe,CAAC,CAACC,0BAA0B,CAAEZ,KAAM,CAAC,KAC5DC,UAAU,EACX,CAAEA,UAAU,EAAED,KAAK,CACpB,CAAC;EAED,MAAM;IAAEa,uBAAuB;IAAEC;EAAyB,CAAC,GAC1D,IAAAC,iBAAW,EAAEJ,YAAe,CAAC;EAE9B,oBACC,IAAAlB,WAAA,CAAAuB,GAAA,EAACT,cAAc;IACdL,IAAI,EAAGC,YAAY,IAAIK,UAAU,GAAGL,YAAY,GAAGD,IAAM;IACzD,iBAAgBD,UAAU,CAACgB,OAAO,CAAE,GAAG,EAAE,GAAI;IAC7C;IAAA;IACA,gBACCvB,wBAAwB,CAAEY,KAAK,CAACX,IAAK,CAAC,GAAGa,UAAU,GAAGU,SACtD;IACDC,OAAO,EAAGA,CAAA,KAAM;MACf,IAAKX,UAAU,EAAG;QACjBM,wBAAwB,CAAEd,KAAM,CAAC;MAClC,CAAC,MAAM;QACNa,uBAAuB,CAAEb,KAAK,EAAEC,UAAW,CAAC;MAC7C;IACD,CAAG;IACHI,QAAQ,EAAGA,QAAU;IAAA,GAChBC;EAAK,CACV,CAAC;AAEJ;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,iCAAwB,EAAE1B,uBAAwB,CAAC","ignoreList":[]}
|
|
@@ -9,7 +9,18 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
9
9
|
*/
|
|
10
10
|
import { store as interfaceStore } from '../../store';
|
|
11
11
|
import complementaryAreaContext from '../complementary-area-context';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Whether the role supports checked state.
|
|
15
|
+
*
|
|
16
|
+
* @param {import('react').AriaRole} role Role.
|
|
17
|
+
* @return {boolean} Whether the role supports checked state.
|
|
18
|
+
* @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
19
|
+
*/
|
|
12
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
function roleSupportsCheckedState(role) {
|
|
22
|
+
return ['checkbox', 'option', 'radio', 'switch', 'menuitemcheckbox', 'menuitemradio', 'treeitem'].includes(role);
|
|
23
|
+
}
|
|
13
24
|
function ComplementaryAreaToggle({
|
|
14
25
|
as = Button,
|
|
15
26
|
scope,
|
|
@@ -28,7 +39,10 @@ function ComplementaryAreaToggle({
|
|
|
28
39
|
} = useDispatch(interfaceStore);
|
|
29
40
|
return /*#__PURE__*/_jsx(ComponentToUse, {
|
|
30
41
|
icon: selectedIcon && isSelected ? selectedIcon : icon,
|
|
31
|
-
"aria-controls": identifier.replace('/', ':')
|
|
42
|
+
"aria-controls": identifier.replace('/', ':')
|
|
43
|
+
// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
44
|
+
,
|
|
45
|
+
"aria-checked": roleSupportsCheckedState(props.role) ? isSelected : undefined,
|
|
32
46
|
onClick: () => {
|
|
33
47
|
if (isSelected) {
|
|
34
48
|
disableComplementaryArea(scope);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","useDispatch","useSelect","store","interfaceStore","complementaryAreaContext","jsx","_jsx","ComplementaryAreaToggle","as","scope","identifier","icon","selectedIcon","name","shortcut","props","ComponentToUse","isSelected","select","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","replace","onClick"],"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\nimport complementaryAreaContext from '../complementary-area-context';\n\nfunction ComplementaryAreaToggle( {\n\tas = Button,\n\tscope,\n\tidentifier,\n\ticon,\n\tselectedIcon,\n\tname,\n\tshortcut,\n\t...props\n} ) {\n\tconst ComponentToUse = as;\n\tconst isSelected = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( scope ) ===\n\t\t\tidentifier,\n\t\t[ identifier, scope ]\n\t);\n\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\n\treturn (\n\t\t<ComponentToUse\n\t\t\ticon={ selectedIcon && isSelected ? selectedIcon : icon }\n\t\t\taria-controls={ identifier.replace( '/', ':' ) }\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isSelected ) {\n\t\t\t\t\tdisableComplementaryArea( scope );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( scope, identifier );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,cAAc,QAAQ,aAAa;AACrD,OAAOC,wBAAwB,MAAM,+BAA+B;
|
|
1
|
+
{"version":3,"names":["Button","useDispatch","useSelect","store","interfaceStore","complementaryAreaContext","jsx","_jsx","roleSupportsCheckedState","role","includes","ComplementaryAreaToggle","as","scope","identifier","icon","selectedIcon","name","shortcut","props","ComponentToUse","isSelected","select","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","replace","undefined","onClick"],"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\nimport complementaryAreaContext from '../complementary-area-context';\n\n/**\n * Whether the role supports checked state.\n *\n * @param {import('react').AriaRole} role Role.\n * @return {boolean} Whether the role supports checked state.\n * @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked\n */\nfunction roleSupportsCheckedState( role ) {\n\treturn [\n\t\t'checkbox',\n\t\t'option',\n\t\t'radio',\n\t\t'switch',\n\t\t'menuitemcheckbox',\n\t\t'menuitemradio',\n\t\t'treeitem',\n\t].includes( role );\n}\n\nfunction ComplementaryAreaToggle( {\n\tas = Button,\n\tscope,\n\tidentifier,\n\ticon,\n\tselectedIcon,\n\tname,\n\tshortcut,\n\t...props\n} ) {\n\tconst ComponentToUse = as;\n\tconst isSelected = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( scope ) ===\n\t\t\tidentifier,\n\t\t[ identifier, scope ]\n\t);\n\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\n\treturn (\n\t\t<ComponentToUse\n\t\t\ticon={ selectedIcon && isSelected ? selectedIcon : icon }\n\t\t\taria-controls={ identifier.replace( '/', ':' ) }\n\t\t\t// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked\n\t\t\taria-checked={\n\t\t\t\troleSupportsCheckedState( props.role ) ? isSelected : undefined\n\t\t\t}\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isSelected ) {\n\t\t\t\t\tdisableComplementaryArea( scope );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( scope, identifier );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,cAAc,QAAQ,aAAa;AACrD,OAAOC,wBAAwB,MAAM,+BAA+B;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,SAASC,wBAAwBA,CAAEC,IAAI,EAAG;EACzC,OAAO,CACN,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,UAAU,CACV,CAACC,QAAQ,CAAED,IAAK,CAAC;AACnB;AAEA,SAASE,uBAAuBA,CAAE;EACjCC,EAAE,GAAGZ,MAAM;EACXa,KAAK;EACLC,UAAU;EACVC,IAAI;EACJC,YAAY;EACZC,IAAI;EACJC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,MAAMC,cAAc,GAAGR,EAAE;EACzB,MAAMS,UAAU,GAAGnB,SAAS,CACzBoB,MAAM,IACPA,MAAM,CAAElB,cAAe,CAAC,CAACmB,0BAA0B,CAAEV,KAAM,CAAC,KAC5DC,UAAU,EACX,CAAEA,UAAU,EAAED,KAAK,CACpB,CAAC;EAED,MAAM;IAAEW,uBAAuB;IAAEC;EAAyB,CAAC,GAC1DxB,WAAW,CAAEG,cAAe,CAAC;EAE9B,oBACCG,IAAA,CAACa,cAAc;IACdL,IAAI,EAAGC,YAAY,IAAIK,UAAU,GAAGL,YAAY,GAAGD,IAAM;IACzD,iBAAgBD,UAAU,CAACY,OAAO,CAAE,GAAG,EAAE,GAAI;IAC7C;IAAA;IACA,gBACClB,wBAAwB,CAAEW,KAAK,CAACV,IAAK,CAAC,GAAGY,UAAU,GAAGM,SACtD;IACDC,OAAO,EAAGA,CAAA,KAAM;MACf,IAAKP,UAAU,EAAG;QACjBI,wBAAwB,CAAEZ,KAAM,CAAC;MAClC,CAAC,MAAM;QACNW,uBAAuB,CAAEX,KAAK,EAAEC,UAAW,CAAC;MAC7C;IACD,CAAG;IACHI,QAAQ,EAAGA,QAAU;IAAA,GAChBC;EAAK,CACV,CAAC;AAEJ;AAEA,eAAed,wBAAwB,CAAEM,uBAAwB,CAAC","ignoreList":[]}
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
/**
|
|
30
30
|
* Fonts & basic variables.
|
|
31
31
|
*/
|
|
32
|
+
/**
|
|
33
|
+
* Typography
|
|
34
|
+
*/
|
|
32
35
|
/**
|
|
33
36
|
* Grid System.
|
|
34
37
|
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
@@ -43,7 +46,10 @@
|
|
|
43
46
|
* Dimensions.
|
|
44
47
|
*/
|
|
45
48
|
/**
|
|
46
|
-
*
|
|
49
|
+
* Mobile specific styles
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* Editor styles.
|
|
47
53
|
*/
|
|
48
54
|
/**
|
|
49
55
|
* Block & Editor UI.
|
|
@@ -67,6 +73,9 @@
|
|
|
67
73
|
* Creates a fading overlay to signify that the content is longer
|
|
68
74
|
* than the space allows.
|
|
69
75
|
*/
|
|
76
|
+
/**
|
|
77
|
+
* Typography
|
|
78
|
+
*/
|
|
70
79
|
/**
|
|
71
80
|
* Breakpoint mixins
|
|
72
81
|
*/
|
package/build-style/style.css
CHANGED
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
/**
|
|
30
30
|
* Fonts & basic variables.
|
|
31
31
|
*/
|
|
32
|
+
/**
|
|
33
|
+
* Typography
|
|
34
|
+
*/
|
|
32
35
|
/**
|
|
33
36
|
* Grid System.
|
|
34
37
|
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
@@ -43,7 +46,10 @@
|
|
|
43
46
|
* Dimensions.
|
|
44
47
|
*/
|
|
45
48
|
/**
|
|
46
|
-
*
|
|
49
|
+
* Mobile specific styles
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* Editor styles.
|
|
47
53
|
*/
|
|
48
54
|
/**
|
|
49
55
|
* Block & Editor UI.
|
|
@@ -67,6 +73,9 @@
|
|
|
67
73
|
* Creates a fading overlay to signify that the content is longer
|
|
68
74
|
* than the space allows.
|
|
69
75
|
*/
|
|
76
|
+
/**
|
|
77
|
+
* Typography
|
|
78
|
+
*/
|
|
70
79
|
/**
|
|
71
80
|
* Breakpoint mixins
|
|
72
81
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/interface",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.9.0",
|
|
4
4
|
"description": "Interface module for WordPress. The package contains shared functionality across the modern JavaScript-based WordPress screens.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "^7.16.0",
|
|
36
|
-
"@wordpress/a11y": "^4.
|
|
37
|
-
"@wordpress/components": "^28.
|
|
38
|
-
"@wordpress/compose": "^7.
|
|
39
|
-
"@wordpress/data": "^10.
|
|
40
|
-
"@wordpress/deprecated": "^4.
|
|
41
|
-
"@wordpress/element": "^6.
|
|
42
|
-
"@wordpress/i18n": "^5.
|
|
43
|
-
"@wordpress/icons": "^10.
|
|
44
|
-
"@wordpress/plugins": "^7.
|
|
45
|
-
"@wordpress/preferences": "^4.
|
|
46
|
-
"@wordpress/private-apis": "^1.
|
|
47
|
-
"@wordpress/viewport": "^6.
|
|
36
|
+
"@wordpress/a11y": "^4.9.0",
|
|
37
|
+
"@wordpress/components": "^28.9.0",
|
|
38
|
+
"@wordpress/compose": "^7.9.0",
|
|
39
|
+
"@wordpress/data": "^10.9.0",
|
|
40
|
+
"@wordpress/deprecated": "^4.9.0",
|
|
41
|
+
"@wordpress/element": "^6.9.0",
|
|
42
|
+
"@wordpress/i18n": "^5.9.0",
|
|
43
|
+
"@wordpress/icons": "^10.9.0",
|
|
44
|
+
"@wordpress/plugins": "^7.9.0",
|
|
45
|
+
"@wordpress/preferences": "^4.9.0",
|
|
46
|
+
"@wordpress/private-apis": "^1.9.0",
|
|
47
|
+
"@wordpress/viewport": "^6.9.0",
|
|
48
48
|
"clsx": "^2.1.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "2e5495c635910cb34bfaca3c6258d2e989f66214"
|
|
58
58
|
}
|
|
@@ -10,6 +10,25 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
10
10
|
import { store as interfaceStore } from '../../store';
|
|
11
11
|
import complementaryAreaContext from '../complementary-area-context';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Whether the role supports checked state.
|
|
15
|
+
*
|
|
16
|
+
* @param {import('react').AriaRole} role Role.
|
|
17
|
+
* @return {boolean} Whether the role supports checked state.
|
|
18
|
+
* @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
19
|
+
*/
|
|
20
|
+
function roleSupportsCheckedState( role ) {
|
|
21
|
+
return [
|
|
22
|
+
'checkbox',
|
|
23
|
+
'option',
|
|
24
|
+
'radio',
|
|
25
|
+
'switch',
|
|
26
|
+
'menuitemcheckbox',
|
|
27
|
+
'menuitemradio',
|
|
28
|
+
'treeitem',
|
|
29
|
+
].includes( role );
|
|
30
|
+
}
|
|
31
|
+
|
|
13
32
|
function ComplementaryAreaToggle( {
|
|
14
33
|
as = Button,
|
|
15
34
|
scope,
|
|
@@ -35,6 +54,10 @@ function ComplementaryAreaToggle( {
|
|
|
35
54
|
<ComponentToUse
|
|
36
55
|
icon={ selectedIcon && isSelected ? selectedIcon : icon }
|
|
37
56
|
aria-controls={ identifier.replace( '/', ':' ) }
|
|
57
|
+
// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
58
|
+
aria-checked={
|
|
59
|
+
roleSupportsCheckedState( props.role ) ? isSelected : undefined
|
|
60
|
+
}
|
|
38
61
|
onClick={ () => {
|
|
39
62
|
if ( isSelected ) {
|
|
40
63
|
disableComplementaryArea( scope );
|