@wordpress/dataviews 1.2.0 → 2.0.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 (150) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +33 -30
  3. package/build/add-filter.js +30 -22
  4. package/build/add-filter.js.map +1 -1
  5. package/build/bulk-actions-toolbar.js +74 -69
  6. package/build/bulk-actions-toolbar.js.map +1 -1
  7. package/build/bulk-actions.js +69 -56
  8. package/build/bulk-actions.js.map +1 -1
  9. package/build/constants.js +17 -10
  10. package/build/constants.js.map +1 -1
  11. package/build/dataviews.js +63 -56
  12. package/build/dataviews.js.map +1 -1
  13. package/build/filter-summary.js +105 -95
  14. package/build/filter-summary.js.map +1 -1
  15. package/build/filters.js +18 -17
  16. package/build/filters.js.map +1 -1
  17. package/build/index.js.map +1 -1
  18. package/build/item-actions.js +78 -65
  19. package/build/item-actions.js.map +1 -1
  20. package/build/layouts.js.map +1 -1
  21. package/build/pagination.js +60 -57
  22. package/build/pagination.js.map +1 -1
  23. package/build/reset-filters.js +9 -4
  24. package/build/reset-filters.js.map +1 -1
  25. package/build/search-widget.js +108 -89
  26. package/build/search-widget.js.map +1 -1
  27. package/build/search.js +13 -6
  28. package/build/search.js.map +1 -1
  29. package/build/single-selection-checkbox.js +2 -2
  30. package/build/single-selection-checkbox.js.map +1 -1
  31. package/build/types.js.map +1 -1
  32. package/build/utils.js +3 -15
  33. package/build/utils.js.map +1 -1
  34. package/build/view-actions.js +168 -120
  35. package/build/view-actions.js.map +1 -1
  36. package/build/view-grid.js +113 -99
  37. package/build/view-grid.js.map +1 -1
  38. package/build/view-list.js +153 -132
  39. package/build/view-list.js.map +1 -1
  40. package/build/view-table.js +220 -192
  41. package/build/view-table.js.map +1 -1
  42. package/build-module/add-filter.js +30 -22
  43. package/build-module/add-filter.js.map +1 -1
  44. package/build-module/bulk-actions-toolbar.js +76 -69
  45. package/build-module/bulk-actions-toolbar.js.map +1 -1
  46. package/build-module/bulk-actions.js +71 -56
  47. package/build-module/bulk-actions.js.map +1 -1
  48. package/build-module/constants.js +16 -9
  49. package/build-module/constants.js.map +1 -1
  50. package/build-module/dataviews.js +64 -56
  51. package/build-module/dataviews.js.map +1 -1
  52. package/build-module/filter-summary.js +106 -96
  53. package/build-module/filter-summary.js.map +1 -1
  54. package/build-module/filters.js +18 -17
  55. package/build-module/filters.js.map +1 -1
  56. package/build-module/index.js.map +1 -1
  57. package/build-module/item-actions.js +80 -65
  58. package/build-module/item-actions.js.map +1 -1
  59. package/build-module/layouts.js.map +1 -1
  60. package/build-module/pagination.js +61 -58
  61. package/build-module/pagination.js.map +1 -1
  62. package/build-module/reset-filters.js +9 -4
  63. package/build-module/reset-filters.js.map +1 -1
  64. package/build-module/search-widget.js +109 -89
  65. package/build-module/search-widget.js.map +1 -1
  66. package/build-module/search.js +13 -6
  67. package/build-module/search.js.map +1 -1
  68. package/build-module/single-selection-checkbox.js +2 -3
  69. package/build-module/single-selection-checkbox.js.map +1 -1
  70. package/build-module/types.js.map +1 -1
  71. package/build-module/utils.js +2 -13
  72. package/build-module/utils.js.map +1 -1
  73. package/build-module/view-actions.js +170 -121
  74. package/build-module/view-actions.js.map +1 -1
  75. package/build-module/view-grid.js +115 -99
  76. package/build-module/view-grid.js.map +1 -1
  77. package/build-module/view-list.js +154 -132
  78. package/build-module/view-list.js.map +1 -1
  79. package/build-module/view-table.js +223 -194
  80. package/build-module/view-table.js.map +1 -1
  81. package/build-style/style-rtl.css +109 -20
  82. package/build-style/style.css +109 -20
  83. package/build-types/add-filter.d.ts +9 -6
  84. package/build-types/add-filter.d.ts.map +1 -1
  85. package/build-types/bulk-actions-toolbar.d.ts +11 -7
  86. package/build-types/bulk-actions-toolbar.d.ts.map +1 -1
  87. package/build-types/bulk-actions.d.ts.map +1 -1
  88. package/build-types/constants.d.ts +19 -32
  89. package/build-types/constants.d.ts.map +1 -1
  90. package/build-types/dataviews.d.ts +21 -14
  91. package/build-types/dataviews.d.ts.map +1 -1
  92. package/build-types/filter-summary.d.ts +13 -5
  93. package/build-types/filter-summary.d.ts.map +1 -1
  94. package/build-types/filters.d.ts +11 -1
  95. package/build-types/filters.d.ts.map +1 -1
  96. package/build-types/index.d.ts +3 -3
  97. package/build-types/index.d.ts.map +1 -1
  98. package/build-types/item-actions.d.ts +5 -7
  99. package/build-types/item-actions.d.ts.map +1 -1
  100. package/build-types/layouts.d.ts +8 -4
  101. package/build-types/layouts.d.ts.map +1 -1
  102. package/build-types/reset-filters.d.ts +12 -5
  103. package/build-types/reset-filters.d.ts.map +1 -1
  104. package/build-types/search-widget.d.ts +9 -1
  105. package/build-types/search-widget.d.ts.map +1 -1
  106. package/build-types/search.d.ts +11 -1
  107. package/build-types/search.d.ts.map +1 -1
  108. package/build-types/types.d.ts +78 -10
  109. package/build-types/types.d.ts.map +1 -1
  110. package/build-types/utils.d.ts +2 -1
  111. package/build-types/utils.d.ts.map +1 -1
  112. package/build-types/view-actions.d.ts +10 -1
  113. package/build-types/view-actions.d.ts.map +1 -1
  114. package/build-types/view-grid.d.ts +1 -12
  115. package/build-types/view-grid.d.ts.map +1 -1
  116. package/build-types/view-list.d.ts +2 -14
  117. package/build-types/view-list.d.ts.map +1 -1
  118. package/build-types/view-table.d.ts +3 -12
  119. package/build-types/view-table.d.ts.map +1 -1
  120. package/package.json +11 -12
  121. package/src/{add-filter.js → add-filter.tsx} +17 -1
  122. package/src/{bulk-actions-toolbar.js → bulk-actions-toolbar.tsx} +68 -40
  123. package/src/bulk-actions.tsx +5 -1
  124. package/src/constants.ts +12 -5
  125. package/src/{dataviews.js → dataviews.tsx} +41 -12
  126. package/src/{filter-summary.js → filter-summary.tsx} +35 -6
  127. package/src/{filters.js → filters.tsx} +18 -6
  128. package/src/item-actions.tsx +20 -15
  129. package/src/pagination.tsx +1 -1
  130. package/src/{reset-filters.js → reset-filters.tsx} +17 -2
  131. package/src/{search-widget.js → search-widget.tsx} +27 -7
  132. package/src/{search.js → search.tsx} +22 -5
  133. package/src/style.scss +97 -23
  134. package/src/types.ts +105 -10
  135. package/src/{utils.js → utils.ts} +5 -13
  136. package/src/{view-actions.js → view-actions.tsx} +105 -49
  137. package/src/view-grid.tsx +4 -20
  138. package/src/view-list.tsx +12 -23
  139. package/src/{view-table.js → view-table.tsx} +91 -32
  140. package/tsconfig.json +0 -3
  141. package/tsconfig.tsbuildinfo +1 -1
  142. package/build/dropdown-menu-helper.js +0 -71
  143. package/build/dropdown-menu-helper.js.map +0 -1
  144. package/build-module/dropdown-menu-helper.js +0 -64
  145. package/build-module/dropdown-menu-helper.js.map +0 -1
  146. package/build-types/dropdown-menu-helper.d.ts +0 -6
  147. package/build-types/dropdown-menu-helper.d.ts.map +0 -1
  148. package/src/dropdown-menu-helper.js +0 -61
  149. /package/src/{index.js → index.ts} +0 -0
  150. /package/src/{layouts.js → layouts.ts} +0 -0
@@ -1,71 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DropdownMenuRadioItemCustom = void 0;
7
- var _react = require("react");
8
- var _components = require("@wordpress/components");
9
- var _element = require("@wordpress/element");
10
- var _primitives = require("@wordpress/primitives");
11
- var _lockUnlock = require("./lock-unlock");
12
- /**
13
- * WordPress dependencies
14
- */
15
-
16
- /**
17
- * Internal dependencies
18
- */
19
-
20
- const {
21
- DropdownMenuItemV2: DropdownMenuItem
22
- } = (0, _lockUnlock.unlock)(_components.privateApis);
23
- const radioCheck = (0, _react.createElement)(_primitives.SVG, {
24
- xmlns: "http://www.w3.org/2000/svg",
25
- viewBox: "0 0 24 24"
26
- }, (0, _react.createElement)(_primitives.Circle, {
27
- cx: 12,
28
- cy: 12,
29
- r: 3
30
- }));
31
-
32
- /**
33
- * A custom implementation of a radio menu item using the standard menu item
34
- * component, which allows deselecting selected values.
35
- */
36
- const DropdownMenuRadioItemCustom = exports.DropdownMenuRadioItemCustom = (0, _element.forwardRef)(function DropdownMenuRadioItemCustom({
37
- checked,
38
- name,
39
- value,
40
- hideOnClick,
41
- onChange,
42
- onClick,
43
- ...props
44
- }, ref) {
45
- const onClickHandler = e => {
46
- onClick?.(e);
47
- onChange?.({
48
- ...e,
49
- target: {
50
- ...e.target,
51
- value
52
- }
53
- });
54
- };
55
- return (0, _react.createElement)(DropdownMenuItem, {
56
- ref: ref,
57
- role: "menuitemradio",
58
- name: name,
59
- "aria-checked": checked,
60
- hideOnClick: !!hideOnClick,
61
- prefix: checked ? (0, _react.createElement)(_components.Icon, {
62
- icon: radioCheck
63
- }) : (0, _react.createElement)("span", {
64
- className: "dataviews-filters__custom-menu-radio-item-prefix",
65
- "aria-hidden": "true"
66
- }),
67
- onClick: onClickHandler,
68
- ...props
69
- });
70
- });
71
- //# sourceMappingURL=dropdown-menu-helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_components","require","_element","_primitives","_lockUnlock","DropdownMenuItemV2","DropdownMenuItem","unlock","componentsPrivateApis","radioCheck","_react","createElement","SVG","xmlns","viewBox","Circle","cx","cy","r","DropdownMenuRadioItemCustom","exports","forwardRef","checked","name","value","hideOnClick","onChange","onClick","props","ref","onClickHandler","e","target","role","prefix","Icon","icon","className"],"sources":["@wordpress/dataviews/src/dropdown-menu-helper.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { SVG, Circle } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\n\nconst { DropdownMenuItemV2: DropdownMenuItem } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst radioCheck = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Circle cx={ 12 } cy={ 12 } r={ 3 }></Circle>\n\t</SVG>\n);\n\n/**\n * A custom implementation of a radio menu item using the standard menu item\n * component, which allows deselecting selected values.\n */\nexport const DropdownMenuRadioItemCustom = forwardRef(\n\tfunction DropdownMenuRadioItemCustom(\n\t\t{ checked, name, value, hideOnClick, onChange, onClick, ...props },\n\t\tref\n\t) {\n\t\tconst onClickHandler = ( e ) => {\n\t\t\tonClick?.( e );\n\t\t\tonChange?.( { ...e, target: { ...e.target, value } } );\n\t\t};\n\t\treturn (\n\t\t\t<DropdownMenuItem\n\t\t\t\tref={ ref }\n\t\t\t\trole=\"menuitemradio\"\n\t\t\t\tname={ name }\n\t\t\t\taria-checked={ checked }\n\t\t\t\thideOnClick={ !! hideOnClick }\n\t\t\t\tprefix={\n\t\t\t\t\tchecked ? (\n\t\t\t\t\t\t<Icon icon={ radioCheck } />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"dataviews-filters__custom-menu-radio-item-prefix\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t></span>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tonClick={ onClickHandler }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n);\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AAbA;AACA;AACA;;AAQA;AACA;AACA;;AAGA,MAAM;EAAEI,kBAAkB,EAAEC;AAAiB,CAAC,GAAG,IAAAC,kBAAM,EACtDC,uBACD,CAAC;AAED,MAAMC,UAAU,GACf,IAAAC,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAS,GAAG;EAACC,KAAK,EAAC,4BAA4B;EAACC,OAAO,EAAC;AAAW,GAC1D,IAAAJ,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAY,MAAM;EAACC,EAAE,EAAG,EAAI;EAACC,EAAE,EAAG,EAAI;EAACC,CAAC,EAAG;AAAG,CAAS,CACxC,CACL;;AAED;AACA;AACA;AACA;AACO,MAAMC,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAG,IAAAE,mBAAU,EACpD,SAASF,2BAA2BA,CACnC;EAAEG,OAAO;EAAEC,IAAI;EAAEC,KAAK;EAAEC,WAAW;EAAEC,QAAQ;EAAEC,OAAO;EAAE,GAAGC;AAAM,CAAC,EAClEC,GAAG,EACF;EACD,MAAMC,cAAc,GAAKC,CAAC,IAAM;IAC/BJ,OAAO,GAAII,CAAE,CAAC;IACdL,QAAQ,GAAI;MAAE,GAAGK,CAAC;MAAEC,MAAM,EAAE;QAAE,GAAGD,CAAC,CAACC,MAAM;QAAER;MAAM;IAAE,CAAE,CAAC;EACvD,CAAC;EACD,OACC,IAAAd,MAAA,CAAAC,aAAA,EAACL,gBAAgB;IAChBuB,GAAG,EAAGA,GAAK;IACXI,IAAI,EAAC,eAAe;IACpBV,IAAI,EAAGA,IAAM;IACb,gBAAeD,OAAS;IACxBG,WAAW,EAAG,CAAC,CAAEA,WAAa;IAC9BS,MAAM,EACLZ,OAAO,GACN,IAAAZ,MAAA,CAAAC,aAAA,EAACX,WAAA,CAAAmC,IAAI;MAACC,IAAI,EAAG3B;IAAY,CAAE,CAAC,GAE5B,IAAAC,MAAA,CAAAC,aAAA;MACC0B,SAAS,EAAC,kDAAkD;MAC5D,eAAY;IAAM,CACZ,CAER;IACDV,OAAO,EAAGG,cAAgB;IAAA,GACrBF;EAAK,CACV,CAAC;AAEJ,CACD,CAAC","ignoreList":[]}
@@ -1,64 +0,0 @@
1
- import { createElement } from "react";
2
- /**
3
- * WordPress dependencies
4
- */
5
- import { Icon, privateApis as componentsPrivateApis } from '@wordpress/components';
6
- import { forwardRef } from '@wordpress/element';
7
- import { SVG, Circle } from '@wordpress/primitives';
8
-
9
- /**
10
- * Internal dependencies
11
- */
12
- import { unlock } from './lock-unlock';
13
- const {
14
- DropdownMenuItemV2: DropdownMenuItem
15
- } = unlock(componentsPrivateApis);
16
- const radioCheck = createElement(SVG, {
17
- xmlns: "http://www.w3.org/2000/svg",
18
- viewBox: "0 0 24 24"
19
- }, createElement(Circle, {
20
- cx: 12,
21
- cy: 12,
22
- r: 3
23
- }));
24
-
25
- /**
26
- * A custom implementation of a radio menu item using the standard menu item
27
- * component, which allows deselecting selected values.
28
- */
29
- export const DropdownMenuRadioItemCustom = forwardRef(function DropdownMenuRadioItemCustom({
30
- checked,
31
- name,
32
- value,
33
- hideOnClick,
34
- onChange,
35
- onClick,
36
- ...props
37
- }, ref) {
38
- const onClickHandler = e => {
39
- onClick?.(e);
40
- onChange?.({
41
- ...e,
42
- target: {
43
- ...e.target,
44
- value
45
- }
46
- });
47
- };
48
- return createElement(DropdownMenuItem, {
49
- ref: ref,
50
- role: "menuitemradio",
51
- name: name,
52
- "aria-checked": checked,
53
- hideOnClick: !!hideOnClick,
54
- prefix: checked ? createElement(Icon, {
55
- icon: radioCheck
56
- }) : createElement("span", {
57
- className: "dataviews-filters__custom-menu-radio-item-prefix",
58
- "aria-hidden": "true"
59
- }),
60
- onClick: onClickHandler,
61
- ...props
62
- });
63
- });
64
- //# sourceMappingURL=dropdown-menu-helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Icon","privateApis","componentsPrivateApis","forwardRef","SVG","Circle","unlock","DropdownMenuItemV2","DropdownMenuItem","radioCheck","createElement","xmlns","viewBox","cx","cy","r","DropdownMenuRadioItemCustom","checked","name","value","hideOnClick","onChange","onClick","props","ref","onClickHandler","e","target","role","prefix","icon","className"],"sources":["@wordpress/dataviews/src/dropdown-menu-helper.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { SVG, Circle } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\n\nconst { DropdownMenuItemV2: DropdownMenuItem } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst radioCheck = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Circle cx={ 12 } cy={ 12 } r={ 3 }></Circle>\n\t</SVG>\n);\n\n/**\n * A custom implementation of a radio menu item using the standard menu item\n * component, which allows deselecting selected values.\n */\nexport const DropdownMenuRadioItemCustom = forwardRef(\n\tfunction DropdownMenuRadioItemCustom(\n\t\t{ checked, name, value, hideOnClick, onChange, onClick, ...props },\n\t\tref\n\t) {\n\t\tconst onClickHandler = ( e ) => {\n\t\t\tonClick?.( e );\n\t\t\tonChange?.( { ...e, target: { ...e.target, value } } );\n\t\t};\n\t\treturn (\n\t\t\t<DropdownMenuItem\n\t\t\t\tref={ ref }\n\t\t\t\trole=\"menuitemradio\"\n\t\t\t\tname={ name }\n\t\t\t\taria-checked={ checked }\n\t\t\t\thideOnClick={ !! hideOnClick }\n\t\t\t\tprefix={\n\t\t\t\t\tchecked ? (\n\t\t\t\t\t\t<Icon icon={ radioCheck } />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"dataviews-filters__custom-menu-radio-item-prefix\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t></span>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tonClick={ onClickHandler }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,IAAI,EACJC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,GAAG,EAAEC,MAAM,QAAQ,uBAAuB;;AAEnD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,eAAe;AAEtC,MAAM;EAAEC,kBAAkB,EAAEC;AAAiB,CAAC,GAAGF,MAAM,CACtDJ,qBACD,CAAC;AAED,MAAMO,UAAU,GACfC,aAAA,CAACN,GAAG;EAACO,KAAK,EAAC,4BAA4B;EAACC,OAAO,EAAC;AAAW,GAC1DF,aAAA,CAACL,MAAM;EAACQ,EAAE,EAAG,EAAI;EAACC,EAAE,EAAG,EAAI;EAACC,CAAC,EAAG;AAAG,CAAS,CACxC,CACL;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,GAAGb,UAAU,CACpD,SAASa,2BAA2BA,CACnC;EAAEC,OAAO;EAAEC,IAAI;EAAEC,KAAK;EAAEC,WAAW;EAAEC,QAAQ;EAAEC,OAAO;EAAE,GAAGC;AAAM,CAAC,EAClEC,GAAG,EACF;EACD,MAAMC,cAAc,GAAKC,CAAC,IAAM;IAC/BJ,OAAO,GAAII,CAAE,CAAC;IACdL,QAAQ,GAAI;MAAE,GAAGK,CAAC;MAAEC,MAAM,EAAE;QAAE,GAAGD,CAAC,CAACC,MAAM;QAAER;MAAM;IAAE,CAAE,CAAC;EACvD,CAAC;EACD,OACCT,aAAA,CAACF,gBAAgB;IAChBgB,GAAG,EAAGA,GAAK;IACXI,IAAI,EAAC,eAAe;IACpBV,IAAI,EAAGA,IAAM;IACb,gBAAeD,OAAS;IACxBG,WAAW,EAAG,CAAC,CAAEA,WAAa;IAC9BS,MAAM,EACLZ,OAAO,GACNP,aAAA,CAACV,IAAI;MAAC8B,IAAI,EAAGrB;IAAY,CAAE,CAAC,GAE5BC,aAAA;MACCqB,SAAS,EAAC,kDAAkD;MAC5D,eAAY;IAAM,CACZ,CAER;IACDT,OAAO,EAAGG,cAAgB;IAAA,GACrBF;EAAK,CACV,CAAC;AAEJ,CACD,CAAC","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- /**
2
- * A custom implementation of a radio menu item using the standard menu item
3
- * component, which allows deselecting selected values.
4
- */
5
- export const DropdownMenuRadioItemCustom: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
6
- //# sourceMappingURL=dropdown-menu-helper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dropdown-menu-helper.d.ts","sourceRoot":"","sources":["../src/dropdown-menu-helper.js"],"names":[],"mappings":"AAyBA;;;GAGG;AACH,wHA+BE"}
@@ -1,61 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- Icon,
6
- privateApis as componentsPrivateApis,
7
- } from '@wordpress/components';
8
- import { forwardRef } from '@wordpress/element';
9
- import { SVG, Circle } from '@wordpress/primitives';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import { unlock } from './lock-unlock';
15
-
16
- const { DropdownMenuItemV2: DropdownMenuItem } = unlock(
17
- componentsPrivateApis
18
- );
19
-
20
- const radioCheck = (
21
- <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
22
- <Circle cx={ 12 } cy={ 12 } r={ 3 }></Circle>
23
- </SVG>
24
- );
25
-
26
- /**
27
- * A custom implementation of a radio menu item using the standard menu item
28
- * component, which allows deselecting selected values.
29
- */
30
- export const DropdownMenuRadioItemCustom = forwardRef(
31
- function DropdownMenuRadioItemCustom(
32
- { checked, name, value, hideOnClick, onChange, onClick, ...props },
33
- ref
34
- ) {
35
- const onClickHandler = ( e ) => {
36
- onClick?.( e );
37
- onChange?.( { ...e, target: { ...e.target, value } } );
38
- };
39
- return (
40
- <DropdownMenuItem
41
- ref={ ref }
42
- role="menuitemradio"
43
- name={ name }
44
- aria-checked={ checked }
45
- hideOnClick={ !! hideOnClick }
46
- prefix={
47
- checked ? (
48
- <Icon icon={ radioCheck } />
49
- ) : (
50
- <span
51
- className="dataviews-filters__custom-menu-radio-item-prefix"
52
- aria-hidden="true"
53
- ></span>
54
- )
55
- }
56
- onClick={ onClickHandler }
57
- { ...props }
58
- />
59
- );
60
- }
61
- );
File without changes
File without changes