@wordpress/preferences 3.26.0 → 3.27.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 (63) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/preference-base-option/index.js +32 -0
  3. package/build/components/preference-base-option/index.js.map +1 -0
  4. package/build/components/preference-toggle-control/index.js +43 -0
  5. package/build/components/preference-toggle-control/index.js.map +1 -0
  6. package/build/components/preferences-modal/index.js +24 -0
  7. package/build/components/preferences-modal/index.js.map +1 -0
  8. package/build/components/preferences-modal-section/index.js +25 -0
  9. package/build/components/preferences-modal-section/index.js.map +1 -0
  10. package/build/components/preferences-modal-tabs/index.js +129 -0
  11. package/build/components/preferences-modal-tabs/index.js.map +1 -0
  12. package/build/index.js +12 -0
  13. package/build/index.js.map +1 -1
  14. package/build/lock-unlock.js +18 -0
  15. package/build/lock-unlock.js.map +1 -0
  16. package/build/private-apis.js +27 -0
  17. package/build/private-apis.js.map +1 -0
  18. package/build/store/index.js +1 -1
  19. package/build/store/index.js.map +1 -1
  20. package/build/store/selectors.js +22 -3
  21. package/build/store/selectors.js.map +1 -1
  22. package/build-module/components/preference-base-option/index.js +24 -0
  23. package/build-module/components/preference-base-option/index.js.map +1 -0
  24. package/build-module/components/preference-toggle-control/index.js +34 -0
  25. package/build-module/components/preference-toggle-control/index.js.map +1 -0
  26. package/build-module/components/preferences-modal/index.js +17 -0
  27. package/build-module/components/preferences-modal/index.js.map +1 -0
  28. package/build-module/components/preferences-modal-section/index.js +18 -0
  29. package/build-module/components/preferences-modal-section/index.js.map +1 -0
  30. package/build-module/components/preferences-modal-tabs/index.js +122 -0
  31. package/build-module/components/preferences-modal-tabs/index.js.map +1 -0
  32. package/build-module/index.js +1 -0
  33. package/build-module/index.js.map +1 -1
  34. package/build-module/lock-unlock.js +9 -0
  35. package/build-module/lock-unlock.js.map +1 -0
  36. package/build-module/private-apis.js +18 -0
  37. package/build-module/private-apis.js.map +1 -0
  38. package/build-module/store/index.js +1 -1
  39. package/build-module/store/index.js.map +1 -1
  40. package/build-module/store/selectors.js +18 -2
  41. package/build-module/store/selectors.js.map +1 -1
  42. package/build-style/style-rtl.css +199 -0
  43. package/build-style/style.css +199 -0
  44. package/package.json +11 -8
  45. package/src/components/preference-base-option/README.md +40 -0
  46. package/src/components/preference-base-option/index.js +21 -0
  47. package/src/components/preference-base-option/style.scss +10 -0
  48. package/src/components/preference-toggle-control/index.js +38 -0
  49. package/src/components/preferences-modal/README.md +69 -0
  50. package/src/components/preferences-modal/index.js +17 -0
  51. package/src/components/preferences-modal/style.scss +21 -0
  52. package/src/components/preferences-modal-section/README.md +31 -0
  53. package/src/components/preferences-modal-section/index.js +15 -0
  54. package/src/components/preferences-modal-section/style.scss +28 -0
  55. package/src/components/preferences-modal-tabs/README.md +14 -0
  56. package/src/components/preferences-modal-tabs/index.js +178 -0
  57. package/src/components/preferences-modal-tabs/style.scss +48 -0
  58. package/src/index.js +1 -0
  59. package/src/lock-unlock.js +9 -0
  60. package/src/private-apis.js +18 -0
  61. package/src/store/index.js +1 -1
  62. package/src/store/selectors.js +42 -2
  63. package/src/style.scss +4 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.27.0 (2024-01-24)
6
+
5
7
  ## 3.26.0 (2024-01-10)
6
8
 
7
9
  ## 3.25.0 (2023-12-13)
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _components = require("@wordpress/components");
9
+ /**
10
+ * WordPress dependencies
11
+ */
12
+
13
+ function BaseOption({
14
+ help,
15
+ label,
16
+ isChecked,
17
+ onChange,
18
+ children
19
+ }) {
20
+ return (0, _react.createElement)("div", {
21
+ className: "preference-base-option"
22
+ }, (0, _react.createElement)(_components.ToggleControl, {
23
+ __nextHasNoMarginBottom: true,
24
+ help: help,
25
+ label: label,
26
+ checked: isChecked,
27
+ onChange: onChange
28
+ }), children);
29
+ }
30
+ var _default = BaseOption;
31
+ exports.default = _default;
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","BaseOption","help","label","isChecked","onChange","children","_react","createElement","className","ToggleControl","__nextHasNoMarginBottom","checked","_default","exports","default"],"sources":["@wordpress/preferences/src/components/preference-base-option/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToggleControl } from '@wordpress/components';\n\nfunction BaseOption( { help, label, isChecked, onChange, children } ) {\n\treturn (\n\t\t<div className=\"preference-base-option\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\thelp={ help }\n\t\t\t\tlabel={ label }\n\t\t\t\tchecked={ isChecked }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default BaseOption;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,SAASC,UAAUA,CAAE;EAAEC,IAAI;EAAEC,KAAK;EAAEC,SAAS;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EACrE,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAwB,GACtC,IAAAF,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAW,aAAa;IACbC,uBAAuB;IACvBT,IAAI,EAAGA,IAAM;IACbC,KAAK,EAAGA,KAAO;IACfS,OAAO,EAAGR,SAAW;IACrBC,QAAQ,EAAGA;EAAU,CACrB,CAAC,EACAC,QACE,CAAC;AAER;AAAC,IAAAO,QAAA,GAEcZ,UAAU;AAAAa,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = require("react");
9
+ var _data = require("@wordpress/data");
10
+ var _store = require("../../store");
11
+ var _preferenceBaseOption = _interopRequireDefault(require("../preference-base-option"));
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ function PreferenceToggleControl(props) {
21
+ const {
22
+ scope,
23
+ featureName,
24
+ onToggle = () => {},
25
+ ...remainingProps
26
+ } = props;
27
+ const isChecked = (0, _data.useSelect)(select => !!select(_store.store).get(scope, featureName), [scope, featureName]);
28
+ const {
29
+ toggle
30
+ } = (0, _data.useDispatch)(_store.store);
31
+ const onChange = () => {
32
+ onToggle();
33
+ toggle(scope, featureName);
34
+ };
35
+ return (0, _react.createElement)(_preferenceBaseOption.default, {
36
+ onChange: onChange,
37
+ isChecked: isChecked,
38
+ ...remainingProps
39
+ });
40
+ }
41
+ var _default = PreferenceToggleControl;
42
+ exports.default = _default;
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_data","require","_store","_preferenceBaseOption","_interopRequireDefault","PreferenceToggleControl","props","scope","featureName","onToggle","remainingProps","isChecked","useSelect","select","preferencesStore","get","toggle","useDispatch","onChange","_react","createElement","default","_default","exports"],"sources":["@wordpress/preferences/src/components/preference-toggle-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as preferencesStore } from '../../store';\nimport PreferenceBaseOption from '../preference-base-option';\n\nfunction PreferenceToggleControl( props ) {\n\tconst {\n\t\tscope,\n\t\tfeatureName,\n\t\tonToggle = () => {},\n\t\t...remainingProps\n\t} = props;\n\tconst isChecked = useSelect(\n\t\t( select ) => !! select( preferencesStore ).get( scope, featureName ),\n\t\t[ scope, featureName ]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst onChange = () => {\n\t\tonToggle();\n\t\ttoggle( scope, featureName );\n\t};\n\n\treturn (\n\t\t<PreferenceBaseOption\n\t\t\tonChange={ onChange }\n\t\t\tisChecked={ isChecked }\n\t\t\t{ ...remainingProps }\n\t\t/>\n\t);\n}\n\nexport default PreferenceToggleControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA,SAASI,uBAAuBA,CAAEC,KAAK,EAAG;EACzC,MAAM;IACLC,KAAK;IACLC,WAAW;IACXC,QAAQ,GAAGA,CAAA,KAAM,CAAC,CAAC;IACnB,GAAGC;EACJ,CAAC,GAAGJ,KAAK;EACT,MAAMK,SAAS,GAAG,IAAAC,eAAS,EACxBC,MAAM,IAAM,CAAC,CAAEA,MAAM,CAAEC,YAAiB,CAAC,CAACC,GAAG,CAAER,KAAK,EAAEC,WAAY,CAAC,EACrE,CAAED,KAAK,EAAEC,WAAW,CACrB,CAAC;EACD,MAAM;IAAEQ;EAAO,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAiB,CAAC;EAClD,MAAMI,QAAQ,GAAGA,CAAA,KAAM;IACtBT,QAAQ,CAAC,CAAC;IACVO,MAAM,CAAET,KAAK,EAAEC,WAAY,CAAC;EAC7B,CAAC;EAED,OACC,IAAAW,MAAA,CAAAC,aAAA,EAACjB,qBAAA,CAAAkB,OAAoB;IACpBH,QAAQ,EAAGA,QAAU;IACrBP,SAAS,EAAGA,SAAW;IAAA,GAClBD;EAAc,CACnB,CAAC;AAEJ;AAAC,IAAAY,QAAA,GAEcjB,uBAAuB;AAAAkB,OAAA,CAAAF,OAAA,GAAAC,QAAA"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = PreferencesModal;
7
+ var _react = require("react");
8
+ var _components = require("@wordpress/components");
9
+ var _i18n = require("@wordpress/i18n");
10
+ /**
11
+ * WordPress dependencies
12
+ */
13
+
14
+ function PreferencesModal({
15
+ closeModal,
16
+ children
17
+ }) {
18
+ return (0, _react.createElement)(_components.Modal, {
19
+ className: "preferences-modal",
20
+ title: (0, _i18n.__)('Preferences'),
21
+ onRequestClose: closeModal
22
+ }, children);
23
+ }
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_i18n","PreferencesModal","closeModal","children","_react","createElement","Modal","className","title","__","onRequestClose"],"sources":["@wordpress/preferences/src/components/preferences-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function PreferencesModal( { closeModal, children } ) {\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"preferences-modal\"\n\t\t\ttitle={ __( 'Preferences' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t>\n\t\t\t{ children }\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIe,SAASE,gBAAgBA,CAAE;EAAEC,UAAU;EAAEC;AAAS,CAAC,EAAG;EACpE,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACP,WAAA,CAAAQ,KAAK;IACLC,SAAS,EAAC,mBAAmB;IAC7BC,KAAK,EAAG,IAAAC,QAAE,EAAE,aAAc,CAAG;IAC7BC,cAAc,EAAGR;EAAY,GAE3BC,QACI,CAAC;AAEV"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ const Section = ({
9
+ description,
10
+ title,
11
+ children
12
+ }) => (0, _react.createElement)("fieldset", {
13
+ className: "preferences-modal__section"
14
+ }, (0, _react.createElement)("legend", {
15
+ className: "preferences-modal__section-legend"
16
+ }, (0, _react.createElement)("h2", {
17
+ className: "preferences-modal__section-title"
18
+ }, title), description && (0, _react.createElement)("p", {
19
+ className: "preferences-modal__section-description"
20
+ }, description)), (0, _react.createElement)("div", {
21
+ className: "preferences-modal__section-content"
22
+ }, children));
23
+ var _default = Section;
24
+ exports.default = _default;
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Section","description","title","children","_react","createElement","className","_default","exports","default"],"sources":["@wordpress/preferences/src/components/preferences-modal-section/index.js"],"sourcesContent":["const Section = ( { description, title, children } ) => (\n\t<fieldset className=\"preferences-modal__section\">\n\t\t<legend className=\"preferences-modal__section-legend\">\n\t\t\t<h2 className=\"preferences-modal__section-title\">{ title }</h2>\n\t\t\t{ description && (\n\t\t\t\t<p className=\"preferences-modal__section-description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</legend>\n\t\t<div className=\"preferences-modal__section-content\">{ children }</div>\n\t</fieldset>\n);\n\nexport default Section;\n"],"mappings":";;;;;;;AAAA,MAAMA,OAAO,GAAGA,CAAE;EAAEC,WAAW;EAAEC,KAAK;EAAEC;AAAS,CAAC,KACjD,IAAAC,MAAA,CAAAC,aAAA;EAAUC,SAAS,EAAC;AAA4B,GAC/C,IAAAF,MAAA,CAAAC,aAAA;EAAQC,SAAS,EAAC;AAAmC,GACpD,IAAAF,MAAA,CAAAC,aAAA;EAAIC,SAAS,EAAC;AAAkC,GAAGJ,KAAW,CAAC,EAC7DD,WAAW,IACZ,IAAAG,MAAA,CAAAC,aAAA;EAAGC,SAAS,EAAC;AAAwC,GAClDL,WACA,CAEG,CAAC,EACT,IAAAG,MAAA,CAAAC,aAAA;EAAKC,SAAS,EAAC;AAAoC,GAAGH,QAAe,CAC5D,CACV;AAAC,IAAAI,QAAA,GAEaP,OAAO;AAAAQ,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = PreferencesModalTabs;
7
+ var _react = require("react");
8
+ var _compose = require("@wordpress/compose");
9
+ var _components = require("@wordpress/components");
10
+ var _element = require("@wordpress/element");
11
+ var _icons = require("@wordpress/icons");
12
+ var _i18n = require("@wordpress/i18n");
13
+ var _lockUnlock = require("../../lock-unlock");
14
+ /**
15
+ * WordPress dependencies
16
+ */
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+
22
+ const {
23
+ Tabs
24
+ } = (0, _lockUnlock.unlock)(_components.privateApis);
25
+ const PREFERENCES_MENU = 'preferences-menu';
26
+ function PreferencesModalTabs({
27
+ sections
28
+ }) {
29
+ const isLargeViewport = (0, _compose.useViewportMatch)('medium');
30
+
31
+ // This is also used to sync the two different rendered components
32
+ // between small and large viewports.
33
+ const [activeMenu, setActiveMenu] = (0, _element.useState)(PREFERENCES_MENU);
34
+ /**
35
+ * Create helper objects from `sections` for easier data handling.
36
+ * `tabs` is used for creating the `Tabs` and `sectionsContentMap`
37
+ * is used for easier access to active tab's content.
38
+ */
39
+ const {
40
+ tabs,
41
+ sectionsContentMap
42
+ } = (0, _element.useMemo)(() => {
43
+ let mappedTabs = {
44
+ tabs: [],
45
+ sectionsContentMap: {}
46
+ };
47
+ if (sections.length) {
48
+ mappedTabs = sections.reduce((accumulator, {
49
+ name,
50
+ tabLabel: title,
51
+ content
52
+ }) => {
53
+ accumulator.tabs.push({
54
+ name,
55
+ title
56
+ });
57
+ accumulator.sectionsContentMap[name] = content;
58
+ return accumulator;
59
+ }, {
60
+ tabs: [],
61
+ sectionsContentMap: {}
62
+ });
63
+ }
64
+ return mappedTabs;
65
+ }, [sections]);
66
+ let modalContent;
67
+ // We render different components based on the viewport size.
68
+ if (isLargeViewport) {
69
+ modalContent = (0, _react.createElement)("div", {
70
+ className: "preferences__tabs"
71
+ }, (0, _react.createElement)(Tabs, {
72
+ initialTabId: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
73
+ onSelect: setActiveMenu,
74
+ orientation: "vertical"
75
+ }, (0, _react.createElement)(Tabs.TabList, {
76
+ className: "preferences__tabs-tablist"
77
+ }, tabs.map(tab => (0, _react.createElement)(Tabs.Tab, {
78
+ tabId: tab.name,
79
+ key: tab.name,
80
+ className: "preferences__tabs-tab"
81
+ }, tab.title))), tabs.map(tab => (0, _react.createElement)(Tabs.TabPanel, {
82
+ tabId: tab.name,
83
+ key: tab.name,
84
+ className: "preferences__tabs-tabpanel",
85
+ focusable: false
86
+ }, sectionsContentMap[tab.name] || null))));
87
+ } else {
88
+ modalContent = (0, _react.createElement)(_components.__experimentalNavigatorProvider, {
89
+ initialPath: "/",
90
+ className: "preferences__provider"
91
+ }, (0, _react.createElement)(_components.__experimentalNavigatorScreen, {
92
+ path: "/"
93
+ }, (0, _react.createElement)(_components.Card, {
94
+ isBorderless: true,
95
+ size: "small"
96
+ }, (0, _react.createElement)(_components.CardBody, null, (0, _react.createElement)(_components.__experimentalItemGroup, null, tabs.map(tab => {
97
+ return (0, _react.createElement)(_components.__experimentalNavigatorButton, {
98
+ key: tab.name,
99
+ path: tab.name,
100
+ as: _components.__experimentalItem,
101
+ isAction: true
102
+ }, (0, _react.createElement)(_components.__experimentalHStack, {
103
+ justify: "space-between"
104
+ }, (0, _react.createElement)(_components.FlexItem, null, (0, _react.createElement)(_components.__experimentalTruncate, null, tab.title)), (0, _react.createElement)(_components.FlexItem, null, (0, _react.createElement)(_icons.Icon, {
105
+ icon: (0, _i18n.isRTL)() ? _icons.chevronLeft : _icons.chevronRight
106
+ }))));
107
+ }))))), sections.length && sections.map(section => {
108
+ return (0, _react.createElement)(_components.__experimentalNavigatorScreen, {
109
+ key: `${section.name}-menu`,
110
+ path: section.name
111
+ }, (0, _react.createElement)(_components.Card, {
112
+ isBorderless: true,
113
+ size: "large"
114
+ }, (0, _react.createElement)(_components.CardHeader, {
115
+ isBorderless: false,
116
+ justify: "left",
117
+ size: "small",
118
+ gap: "6"
119
+ }, (0, _react.createElement)(_components.__experimentalNavigatorBackButton, {
120
+ icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
121
+ "aria-label": (0, _i18n.__)('Navigate to the previous view')
122
+ }), (0, _react.createElement)(_components.__experimentalText, {
123
+ size: "16"
124
+ }, section.tabLabel)), (0, _react.createElement)(_components.CardBody, null, section.content)));
125
+ }));
126
+ }
127
+ return modalContent;
128
+ }
129
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_compose","require","_components","_element","_icons","_i18n","_lockUnlock","Tabs","unlock","componentsPrivateApis","PREFERENCES_MENU","PreferencesModalTabs","sections","isLargeViewport","useViewportMatch","activeMenu","setActiveMenu","useState","tabs","sectionsContentMap","useMemo","mappedTabs","length","reduce","accumulator","name","tabLabel","title","content","push","modalContent","_react","createElement","className","initialTabId","undefined","onSelect","orientation","TabList","map","tab","Tab","tabId","key","TabPanel","focusable","__experimentalNavigatorProvider","initialPath","__experimentalNavigatorScreen","path","Card","isBorderless","size","CardBody","__experimentalItemGroup","__experimentalNavigatorButton","as","Item","isAction","__experimentalHStack","justify","FlexItem","__experimentalTruncate","Icon","icon","isRTL","chevronLeft","chevronRight","section","CardHeader","gap","__experimentalNavigatorBackButton","__","__experimentalText"],"sources":["@wordpress/preferences/src/components/preferences-modal-tabs/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalNavigatorBackButton as NavigatorBackButton,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\t__experimentalTruncate as Truncate,\n\tFlexItem,\n\tCard,\n\tCardHeader,\n\tCardBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useMemo, useState } from '@wordpress/element';\nimport { chevronLeft, chevronRight, Icon } from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst PREFERENCES_MENU = 'preferences-menu';\n\nexport default function PreferencesModalTabs( { sections } ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\t// This is also used to sync the two different rendered components\n\t// between small and large viewports.\n\tconst [ activeMenu, setActiveMenu ] = useState( PREFERENCES_MENU );\n\t/**\n\t * Create helper objects from `sections` for easier data handling.\n\t * `tabs` is used for creating the `Tabs` and `sectionsContentMap`\n\t * is used for easier access to active tab's content.\n\t */\n\tconst { tabs, sectionsContentMap } = useMemo( () => {\n\t\tlet mappedTabs = {\n\t\t\ttabs: [],\n\t\t\tsectionsContentMap: {},\n\t\t};\n\t\tif ( sections.length ) {\n\t\t\tmappedTabs = sections.reduce(\n\t\t\t\t( accumulator, { name, tabLabel: title, content } ) => {\n\t\t\t\t\taccumulator.tabs.push( { name, title } );\n\t\t\t\t\taccumulator.sectionsContentMap[ name ] = content;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ tabs: [], sectionsContentMap: {} }\n\t\t\t);\n\t\t}\n\t\treturn mappedTabs;\n\t}, [ sections ] );\n\n\tlet modalContent;\n\t// We render different components based on the viewport size.\n\tif ( isLargeViewport ) {\n\t\tmodalContent = (\n\t\t\t<div className=\"preferences__tabs\">\n\t\t\t\t<Tabs\n\t\t\t\t\tinitialTabId={\n\t\t\t\t\t\tactiveMenu !== PREFERENCES_MENU ? activeMenu : undefined\n\t\t\t\t\t}\n\t\t\t\t\tonSelect={ setActiveMenu }\n\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t>\n\t\t\t\t\t<Tabs.TabList className=\"preferences__tabs-tablist\">\n\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\tclassName=\"preferences__tabs-tab\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\tclassName=\"preferences__tabs-tabpanel\"\n\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sectionsContentMap[ tab.name ] || null }\n\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t) ) }\n\t\t\t\t</Tabs>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tmodalContent = (\n\t\t\t<NavigatorProvider\n\t\t\t\tinitialPath=\"/\"\n\t\t\t\tclassName=\"preferences__provider\"\n\t\t\t>\n\t\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t\t<Card isBorderless size=\"small\">\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tpath={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tas={ Item }\n\t\t\t\t\t\t\t\t\t\t\tisAction\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t</Card>\n\t\t\t\t</NavigatorScreen>\n\t\t\t\t{ sections.length &&\n\t\t\t\t\tsections.map( ( section ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<NavigatorScreen\n\t\t\t\t\t\t\t\tkey={ `${ section.name }-menu` }\n\t\t\t\t\t\t\t\tpath={ section.name }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Card isBorderless size=\"large\">\n\t\t\t\t\t\t\t\t\t<CardHeader\n\t\t\t\t\t\t\t\t\t\tisBorderless={ false }\n\t\t\t\t\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tgap=\"6\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<NavigatorBackButton\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Navigate to the previous view'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<Text size=\"16\">\n\t\t\t\t\t\t\t\t\t\t\t{ section.tabLabel }\n\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t</CardHeader>\n\t\t\t\t\t\t\t\t\t<CardBody>{ section.content }</CardBody>\n\t\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t\t</NavigatorScreen>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t</NavigatorProvider>\n\t\t);\n\t}\n\n\treturn modalContent;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAgBA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AA3BA;AACA;AACA;;AAsBA;AACA;AACA;;AAGA,MAAM;EAAEM;AAAK,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAEhD,MAAMC,gBAAgB,GAAG,kBAAkB;AAE5B,SAASC,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC5D,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;;EAEpD;EACA;EACA,MAAM,CAAEC,UAAU,EAAEC,aAAa,CAAE,GAAG,IAAAC,iBAAQ,EAAEP,gBAAiB,CAAC;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,QAAGe,OAAO,CAACxC,OAAmB,CAClC,CACU,CAAC;IAEpB,CAAE,CACe,CACnB;EACF;EAEA,OAAOE,YAAY;AACpB"}
package/build/index.js CHANGED
@@ -25,4 +25,16 @@ Object.keys(_components).forEach(function (key) {
25
25
  });
26
26
  });
27
27
  var _store = require("./store");
28
+ var _privateApis = require("./private-apis");
29
+ Object.keys(_privateApis).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
32
+ if (key in exports && exports[key] === _privateApis[key]) return;
33
+ Object.defineProperty(exports, key, {
34
+ enumerable: true,
35
+ get: function () {
36
+ return _privateApis[key];
37
+ }
38
+ });
39
+ });
28
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_store"],"sources":["@wordpress/preferences/src/index.js"],"sourcesContent":["export * from './components';\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,MAAA,GAAAb,OAAA"}
1
+ {"version":3,"names":["_components","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_store","_privateApis"],"sources":["@wordpress/preferences/src/index.js"],"sourcesContent":["export * from './components';\nexport { store } from './store';\nexport * from './private-apis';\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,MAAA,GAAAb,OAAA;AACA,IAAAc,YAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,YAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,YAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,YAAA,CAAAV,GAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.unlock = exports.lock = void 0;
7
+ var _privateApis = require("@wordpress/private-apis");
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+
12
+ const {
13
+ lock,
14
+ unlock
15
+ } = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/preferences');
16
+ exports.unlock = unlock;
17
+ exports.lock = lock;
18
+ //# sourceMappingURL=lock-unlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/preferences/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/preferences'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAEO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,iHAAiH,EACjH,wBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.privateApis = void 0;
8
+ var _preferenceBaseOption = _interopRequireDefault(require("./components/preference-base-option"));
9
+ var _preferenceToggleControl = _interopRequireDefault(require("./components/preference-toggle-control"));
10
+ var _preferencesModal = _interopRequireDefault(require("./components/preferences-modal"));
11
+ var _preferencesModalSection = _interopRequireDefault(require("./components/preferences-modal-section"));
12
+ var _preferencesModalTabs = _interopRequireDefault(require("./components/preferences-modal-tabs"));
13
+ var _lockUnlock = require("./lock-unlock");
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+
18
+ const privateApis = {};
19
+ exports.privateApis = privateApis;
20
+ (0, _lockUnlock.lock)(privateApis, {
21
+ PreferenceBaseOption: _preferenceBaseOption.default,
22
+ PreferenceToggleControl: _preferenceToggleControl.default,
23
+ PreferencesModal: _preferencesModal.default,
24
+ PreferencesModalSection: _preferencesModalSection.default,
25
+ PreferencesModalTabs: _preferencesModalTabs.default
26
+ });
27
+ //# sourceMappingURL=private-apis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_preferenceBaseOption","_interopRequireDefault","require","_preferenceToggleControl","_preferencesModal","_preferencesModalSection","_preferencesModalTabs","_lockUnlock","privateApis","exports","lock","PreferenceBaseOption","PreferenceToggleControl","PreferencesModal","PreferencesModalSection","PreferencesModalTabs"],"sources":["@wordpress/preferences/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PreferenceBaseOption from './components/preference-base-option';\nimport PreferenceToggleControl from './components/preference-toggle-control';\nimport PreferencesModal from './components/preferences-modal';\nimport PreferencesModalSection from './components/preferences-modal-section';\nimport PreferencesModalTabs from './components/preferences-modal-tabs';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tPreferenceBaseOption,\n\tPreferenceToggleControl,\n\tPreferencesModal,\n\tPreferencesModalSection,\n\tPreferencesModalTabs,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,wBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,qBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAQO,MAAMM,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,oBAAoB,EAApBA,6BAAoB;EACpBC,uBAAuB,EAAvBA,gCAAuB;EACvBC,gBAAgB,EAAhBA,yBAAgB;EAChBC,uBAAuB,EAAvBA,gCAAuB;EACvBC,oBAAoB,EAApBA;AACD,CAAE,CAAC"}
@@ -21,7 +21,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21
21
  */
22
22
 
23
23
  /**
24
- * Store definition for the interface namespace.
24
+ * Store definition for the preferences namespace.
25
25
  *
26
26
  * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
27
27
  *
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_reducer","_interopRequireDefault","actions","_interopRequireWildcard","selectors","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","store","createReduxStore","STORE_NAME","reducer","exports","register"],"sources":["@wordpress/preferences/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the interface namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAAyC,SAAAO,yBAAAC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ACP7B,OAAO;EACPE;AACD,CAAE,CAAC;AAAC4B,OAAA,CAAAJ,KAAA,GAAAA,KAAA;AAEJ,IAAAK,cAAQ,EAAEL,KAAM,CAAC"}
1
+ {"version":3,"names":["_data","require","_reducer","_interopRequireDefault","actions","_interopRequireWildcard","selectors","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","store","createReduxStore","STORE_NAME","reducer","exports","register"],"sources":["@wordpress/preferences/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the preferences namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAAyC,SAAAO,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAXzC;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,KAAK,GAAG,IAAAC,sBAAgB,EAAEC,qBAAU,EAAE;EAClDC,OAAO,EAAPA,gBAAO;EACP7B,OAAO;EACPE;AACD,CAAE,CAAC;AAAC4B,OAAA,CAAAJ,KAAA,GAAAA,KAAA;AAEJ,IAAAK,cAAQ,EAAEL,KAAM,CAAC"}
@@ -1,9 +1,27 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.get = get;
7
+ exports.get = void 0;
8
+ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
9
+ /**
10
+ * WordPress dependencies
11
+ */
12
+
13
+ const withDeprecatedKeys = originalGet => (state, scope, name) => {
14
+ const settingsToMoveToCore = ['allowRightClickOverrides', 'distractionFree', 'editorMode', 'fixedToolbar', 'focusMode', 'hiddenBlockTypes', 'inactivePanels', 'keepCaretInsideBlock', 'mostUsedBlocks', 'openPanels', 'showBlockBreadcrumbs', 'showIconLabels', 'showListViewByDefault'];
15
+ if (settingsToMoveToCore.includes(name) && ['core/edit-post', 'core/edit-site'].includes(scope)) {
16
+ (0, _deprecated.default)(`wp.data.select( 'core/preferences' ).get( '${scope}', '${name}' )`, {
17
+ since: '6.5',
18
+ alternative: `wp.data.select( 'core/preferences' ).get( 'core', '${name}' )`
19
+ });
20
+ return originalGet(state, 'core', name);
21
+ }
22
+ return originalGet(state, scope, name);
23
+ };
24
+
7
25
  /**
8
26
  * Returns a boolean indicating whether a prefer is active for a particular
9
27
  * scope.
@@ -14,8 +32,9 @@ exports.get = get;
14
32
  *
15
33
  * @return {*} Is the feature enabled?
16
34
  */
17
- function get(state, scope, name) {
35
+ const get = withDeprecatedKeys((state, scope, name) => {
18
36
  const value = state.preferences[scope]?.[name];
19
37
  return value !== undefined ? value : state.defaults[scope]?.[name];
20
- }
38
+ });
39
+ exports.get = get;
21
40
  //# sourceMappingURL=selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["get","state","scope","name","value","preferences","undefined","defaults"],"sources":["@wordpress/preferences/src/store/selectors.js"],"sourcesContent":["/**\n * Returns a boolean indicating whether a prefer is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} name The name of the feature.\n *\n * @return {*} Is the feature enabled?\n */\nexport function get( state, scope, name ) {\n\tconst value = state.preferences[ scope ]?.[ name ];\n\treturn value !== undefined ? value : state.defaults[ scope ]?.[ name ];\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,GAAGA,CAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,EAAG;EACzC,MAAMC,KAAK,GAAGH,KAAK,CAACI,WAAW,CAAEH,KAAK,CAAE,GAAIC,IAAI,CAAE;EAClD,OAAOC,KAAK,KAAKE,SAAS,GAAGF,KAAK,GAAGH,KAAK,CAACM,QAAQ,CAAEL,KAAK,CAAE,GAAIC,IAAI,CAAE;AACvE"}
1
+ {"version":3,"names":["_deprecated","_interopRequireDefault","require","withDeprecatedKeys","originalGet","state","scope","name","settingsToMoveToCore","includes","deprecated","since","alternative","get","value","preferences","undefined","defaults","exports"],"sources":["@wordpress/preferences/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\nconst withDeprecatedKeys = ( originalGet ) => ( state, scope, name ) => {\n\tconst settingsToMoveToCore = [\n\t\t'allowRightClickOverrides',\n\t\t'distractionFree',\n\t\t'editorMode',\n\t\t'fixedToolbar',\n\t\t'focusMode',\n\t\t'hiddenBlockTypes',\n\t\t'inactivePanels',\n\t\t'keepCaretInsideBlock',\n\t\t'mostUsedBlocks',\n\t\t'openPanels',\n\t\t'showBlockBreadcrumbs',\n\t\t'showIconLabels',\n\t\t'showListViewByDefault',\n\t];\n\n\tif (\n\t\tsettingsToMoveToCore.includes( name ) &&\n\t\t[ 'core/edit-post', 'core/edit-site' ].includes( scope )\n\t) {\n\t\tdeprecated(\n\t\t\t`wp.data.select( 'core/preferences' ).get( '${ scope }', '${ name }' )`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\talternative: `wp.data.select( 'core/preferences' ).get( 'core', '${ name }' )`,\n\t\t\t}\n\t\t);\n\n\t\treturn originalGet( state, 'core', name );\n\t}\n\n\treturn originalGet( state, scope, name );\n};\n\n/**\n * Returns a boolean indicating whether a prefer is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} name The name of the feature.\n *\n * @return {*} Is the feature enabled?\n */\nexport const get = withDeprecatedKeys( ( state, scope, name ) => {\n\tconst value = state.preferences[ scope ]?.[ name ];\n\treturn value !== undefined ? value : state.defaults[ scope ]?.[ name ];\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,kBAAkB,GAAKC,WAAW,IAAM,CAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,KAAM;EACvE,MAAMC,oBAAoB,GAAG,CAC5B,0BAA0B,EAC1B,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,CACvB;EAED,IACCA,oBAAoB,CAACC,QAAQ,CAAEF,IAAK,CAAC,IACrC,CAAE,gBAAgB,EAAE,gBAAgB,CAAE,CAACE,QAAQ,CAAEH,KAAM,CAAC,EACvD;IACD,IAAAI,mBAAU,EACR,8CAA8CJ,KAAO,OAAOC,IAAM,KAAI,EACvE;MACCI,KAAK,EAAE,KAAK;MACZC,WAAW,EAAG,sDAAsDL,IAAM;IAC3E,CACD,CAAC;IAED,OAAOH,WAAW,CAAEC,KAAK,EAAE,MAAM,EAAEE,IAAK,CAAC;EAC1C;EAEA,OAAOH,WAAW,CAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAK,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,GAAG,GAAGV,kBAAkB,CAAE,CAAEE,KAAK,EAAEC,KAAK,EAAEC,IAAI,KAAM;EAChE,MAAMO,KAAK,GAAGT,KAAK,CAACU,WAAW,CAAET,KAAK,CAAE,GAAIC,IAAI,CAAE;EAClD,OAAOO,KAAK,KAAKE,SAAS,GAAGF,KAAK,GAAGT,KAAK,CAACY,QAAQ,CAAEX,KAAK,CAAE,GAAIC,IAAI,CAAE;AACvE,CAAE,CAAC;AAACW,OAAA,CAAAL,GAAA,GAAAA,GAAA"}
@@ -0,0 +1,24 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { ToggleControl } from '@wordpress/components';
6
+ function BaseOption({
7
+ help,
8
+ label,
9
+ isChecked,
10
+ onChange,
11
+ children
12
+ }) {
13
+ return createElement("div", {
14
+ className: "preference-base-option"
15
+ }, createElement(ToggleControl, {
16
+ __nextHasNoMarginBottom: true,
17
+ help: help,
18
+ label: label,
19
+ checked: isChecked,
20
+ onChange: onChange
21
+ }), children);
22
+ }
23
+ export default BaseOption;
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ToggleControl","BaseOption","help","label","isChecked","onChange","children","createElement","className","__nextHasNoMarginBottom","checked"],"sources":["@wordpress/preferences/src/components/preference-base-option/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToggleControl } from '@wordpress/components';\n\nfunction BaseOption( { help, label, isChecked, onChange, children } ) {\n\treturn (\n\t\t<div className=\"preference-base-option\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\thelp={ help }\n\t\t\t\tlabel={ label }\n\t\t\t\tchecked={ isChecked }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default BaseOption;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,uBAAuB;AAErD,SAASC,UAAUA,CAAE;EAAEC,IAAI;EAAEC,KAAK;EAAEC,SAAS;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EACrE,OACCC,aAAA;IAAKC,SAAS,EAAC;EAAwB,GACtCD,aAAA,CAACP,aAAa;IACbS,uBAAuB;IACvBP,IAAI,EAAGA,IAAM;IACbC,KAAK,EAAGA,KAAO;IACfO,OAAO,EAAGN,SAAW;IACrBC,QAAQ,EAAGA;EAAU,CACrB,CAAC,EACAC,QACE,CAAC;AAER;AAEA,eAAeL,UAAU"}
@@ -0,0 +1,34 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { useSelect, useDispatch } from '@wordpress/data';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { store as preferencesStore } from '../../store';
11
+ import PreferenceBaseOption from '../preference-base-option';
12
+ function PreferenceToggleControl(props) {
13
+ const {
14
+ scope,
15
+ featureName,
16
+ onToggle = () => {},
17
+ ...remainingProps
18
+ } = props;
19
+ const isChecked = useSelect(select => !!select(preferencesStore).get(scope, featureName), [scope, featureName]);
20
+ const {
21
+ toggle
22
+ } = useDispatch(preferencesStore);
23
+ const onChange = () => {
24
+ onToggle();
25
+ toggle(scope, featureName);
26
+ };
27
+ return createElement(PreferenceBaseOption, {
28
+ onChange: onChange,
29
+ isChecked: isChecked,
30
+ ...remainingProps
31
+ });
32
+ }
33
+ export default PreferenceToggleControl;
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useSelect","useDispatch","store","preferencesStore","PreferenceBaseOption","PreferenceToggleControl","props","scope","featureName","onToggle","remainingProps","isChecked","select","get","toggle","onChange","createElement"],"sources":["@wordpress/preferences/src/components/preference-toggle-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as preferencesStore } from '../../store';\nimport PreferenceBaseOption from '../preference-base-option';\n\nfunction PreferenceToggleControl( props ) {\n\tconst {\n\t\tscope,\n\t\tfeatureName,\n\t\tonToggle = () => {},\n\t\t...remainingProps\n\t} = props;\n\tconst isChecked = useSelect(\n\t\t( select ) => !! select( preferencesStore ).get( scope, featureName ),\n\t\t[ scope, featureName ]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst onChange = () => {\n\t\tonToggle();\n\t\ttoggle( scope, featureName );\n\t};\n\n\treturn (\n\t\t<PreferenceBaseOption\n\t\t\tonChange={ onChange }\n\t\t\tisChecked={ isChecked }\n\t\t\t{ ...remainingProps }\n\t\t/>\n\t);\n}\n\nexport default PreferenceToggleControl;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,oBAAoB,MAAM,2BAA2B;AAE5D,SAASC,uBAAuBA,CAAEC,KAAK,EAAG;EACzC,MAAM;IACLC,KAAK;IACLC,WAAW;IACXC,QAAQ,GAAGA,CAAA,KAAM,CAAC,CAAC;IACnB,GAAGC;EACJ,CAAC,GAAGJ,KAAK;EACT,MAAMK,SAAS,GAAGX,SAAS,CACxBY,MAAM,IAAM,CAAC,CAAEA,MAAM,CAAET,gBAAiB,CAAC,CAACU,GAAG,CAAEN,KAAK,EAAEC,WAAY,CAAC,EACrE,CAAED,KAAK,EAAEC,WAAW,CACrB,CAAC;EACD,MAAM;IAAEM;EAAO,CAAC,GAAGb,WAAW,CAAEE,gBAAiB,CAAC;EAClD,MAAMY,QAAQ,GAAGA,CAAA,KAAM;IACtBN,QAAQ,CAAC,CAAC;IACVK,MAAM,CAAEP,KAAK,EAAEC,WAAY,CAAC;EAC7B,CAAC;EAED,OACCQ,aAAA,CAACZ,oBAAoB;IACpBW,QAAQ,EAAGA,QAAU;IACrBJ,SAAS,EAAGA,SAAW;IAAA,GAClBD;EAAc,CACnB,CAAC;AAEJ;AAEA,eAAeL,uBAAuB"}
@@ -0,0 +1,17 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { Modal } from '@wordpress/components';
6
+ import { __ } from '@wordpress/i18n';
7
+ export default function PreferencesModal({
8
+ closeModal,
9
+ children
10
+ }) {
11
+ return createElement(Modal, {
12
+ className: "preferences-modal",
13
+ title: __('Preferences'),
14
+ onRequestClose: closeModal
15
+ }, children);
16
+ }
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Modal","__","PreferencesModal","closeModal","children","createElement","className","title","onRequestClose"],"sources":["@wordpress/preferences/src/components/preferences-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function PreferencesModal( { closeModal, children } ) {\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"preferences-modal\"\n\t\t\ttitle={ __( 'Preferences' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t>\n\t\t\t{ children }\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,eAAe,SAASC,gBAAgBA,CAAE;EAAEC,UAAU;EAAEC;AAAS,CAAC,EAAG;EACpE,OACCC,aAAA,CAACL,KAAK;IACLM,SAAS,EAAC,mBAAmB;IAC7BC,KAAK,EAAGN,EAAE,CAAE,aAAc,CAAG;IAC7BO,cAAc,EAAGL;EAAY,GAE3BC,QACI,CAAC;AAEV"}
@@ -0,0 +1,18 @@
1
+ import { createElement } from "react";
2
+ const Section = ({
3
+ description,
4
+ title,
5
+ children
6
+ }) => createElement("fieldset", {
7
+ className: "preferences-modal__section"
8
+ }, createElement("legend", {
9
+ className: "preferences-modal__section-legend"
10
+ }, createElement("h2", {
11
+ className: "preferences-modal__section-title"
12
+ }, title), description && createElement("p", {
13
+ className: "preferences-modal__section-description"
14
+ }, description)), createElement("div", {
15
+ className: "preferences-modal__section-content"
16
+ }, children));
17
+ export default Section;
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Section","description","title","children","createElement","className"],"sources":["@wordpress/preferences/src/components/preferences-modal-section/index.js"],"sourcesContent":["const Section = ( { description, title, children } ) => (\n\t<fieldset className=\"preferences-modal__section\">\n\t\t<legend className=\"preferences-modal__section-legend\">\n\t\t\t<h2 className=\"preferences-modal__section-title\">{ title }</h2>\n\t\t\t{ description && (\n\t\t\t\t<p className=\"preferences-modal__section-description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</legend>\n\t\t<div className=\"preferences-modal__section-content\">{ children }</div>\n\t</fieldset>\n);\n\nexport default Section;\n"],"mappings":";AAAA,MAAMA,OAAO,GAAGA,CAAE;EAAEC,WAAW;EAAEC,KAAK;EAAEC;AAAS,CAAC,KACjDC,aAAA;EAAUC,SAAS,EAAC;AAA4B,GAC/CD,aAAA;EAAQC,SAAS,EAAC;AAAmC,GACpDD,aAAA;EAAIC,SAAS,EAAC;AAAkC,GAAGH,KAAW,CAAC,EAC7DD,WAAW,IACZG,aAAA;EAAGC,SAAS,EAAC;AAAwC,GAClDJ,WACA,CAEG,CAAC,EACTG,aAAA;EAAKC,SAAS,EAAC;AAAoC,GAAGF,QAAe,CAC5D,CACV;AAED,eAAeH,OAAO"}