build/scripts/preferences
index.js
20.9 KB
3 months ago
index.js.map
30.8 KB
3 months ago
index.min.asset.php
263 B
4 months ago
index.min.js
7.7 KB
4 months ago
index.min.js.map
33.6 KB
3 months ago
index.js in Gutenberg 23.2.0, at build/scripts/preferences/index.js
| 1 | "use strict"; |
| 2 | var wp; |
| 3 | (wp ||= {}).preferences = (() => { |
| 4 | var __create = Object.create; |
| 5 | var __defProp = Object.defineProperty; |
| 6 | var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
| 7 | var __getOwnPropNames = Object.getOwnPropertyNames; |
| 8 | var __getProtoOf = Object.getPrototypeOf; |
| 9 | var __hasOwnProp = Object.prototype.hasOwnProperty; |
| 10 | var __commonJS = (cb, mod) => function __require() { |
| 11 | return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; |
| 12 | }; |
| 13 | var __export = (target, all) => { |
| 14 | for (var name in all) |
| 15 | __defProp(target, name, { get: all[name], enumerable: true }); |
| 16 | }; |
| 17 | var __copyProps = (to, from, except, desc) => { |
| 18 | if (from && typeof from === "object" || typeof from === "function") { |
| 19 | for (let key of __getOwnPropNames(from)) |
| 20 | if (!__hasOwnProp.call(to, key) && key !== except) |
| 21 | __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
| 22 | } |
| 23 | return to; |
| 24 | }; |
| 25 | var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( |
| 26 | // If the importer is in node compatibility mode or this is not an ESM |
| 27 | // file that has been converted to a CommonJS file using a Babel- |
| 28 | // compatible transform (i.e. "__esModule" has not been set), then set |
| 29 | // "default" to the CommonJS "module.exports" for node compatibility. |
| 30 | isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, |
| 31 | mod |
| 32 | )); |
| 33 | var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); |
| 34 | |
| 35 | // package-external:@wordpress/data |
| 36 | var require_data = __commonJS({ |
| 37 | "package-external:@wordpress/data"(exports, module) { |
| 38 | module.exports = window.wp.data; |
| 39 | } |
| 40 | }); |
| 41 | |
| 42 | // package-external:@wordpress/components |
| 43 | var require_components = __commonJS({ |
| 44 | "package-external:@wordpress/components"(exports, module) { |
| 45 | module.exports = window.wp.components; |
| 46 | } |
| 47 | }); |
| 48 | |
| 49 | // package-external:@wordpress/i18n |
| 50 | var require_i18n = __commonJS({ |
| 51 | "package-external:@wordpress/i18n"(exports, module) { |
| 52 | module.exports = window.wp.i18n; |
| 53 | } |
| 54 | }); |
| 55 | |
| 56 | // package-external:@wordpress/element |
| 57 | var require_element = __commonJS({ |
| 58 | "package-external:@wordpress/element"(exports, module) { |
| 59 | module.exports = window.wp.element; |
| 60 | } |
| 61 | }); |
| 62 | |
| 63 | // package-external:@wordpress/primitives |
| 64 | var require_primitives = __commonJS({ |
| 65 | "package-external:@wordpress/primitives"(exports, module) { |
| 66 | module.exports = window.wp.primitives; |
| 67 | } |
| 68 | }); |
| 69 | |
| 70 | // vendor-external:react/jsx-runtime |
| 71 | var require_jsx_runtime = __commonJS({ |
| 72 | "vendor-external:react/jsx-runtime"(exports, module) { |
| 73 | module.exports = window.ReactJSXRuntime; |
| 74 | } |
| 75 | }); |
| 76 | |
| 77 | // package-external:@wordpress/a11y |
| 78 | var require_a11y = __commonJS({ |
| 79 | "package-external:@wordpress/a11y"(exports, module) { |
| 80 | module.exports = window.wp.a11y; |
| 81 | } |
| 82 | }); |
| 83 | |
| 84 | // package-external:@wordpress/deprecated |
| 85 | var require_deprecated = __commonJS({ |
| 86 | "package-external:@wordpress/deprecated"(exports, module) { |
| 87 | module.exports = window.wp.deprecated; |
| 88 | } |
| 89 | }); |
| 90 | |
| 91 | // package-external:@wordpress/compose |
| 92 | var require_compose = __commonJS({ |
| 93 | "package-external:@wordpress/compose"(exports, module) { |
| 94 | module.exports = window.wp.compose; |
| 95 | } |
| 96 | }); |
| 97 | |
| 98 | // package-external:@wordpress/private-apis |
| 99 | var require_private_apis = __commonJS({ |
| 100 | "package-external:@wordpress/private-apis"(exports, module) { |
| 101 | module.exports = window.wp.privateApis; |
| 102 | } |
| 103 | }); |
| 104 | |
| 105 | // packages/preferences/build-module/index.mjs |
| 106 | var index_exports = {}; |
| 107 | __export(index_exports, { |
| 108 | PreferenceToggleMenuItem: () => PreferenceToggleMenuItem, |
| 109 | privateApis: () => privateApis, |
| 110 | store: () => store |
| 111 | }); |
| 112 | |
| 113 | // packages/preferences/build-module/components/preference-toggle-menu-item/index.mjs |
| 114 | var import_data3 = __toESM(require_data(), 1); |
| 115 | var import_components = __toESM(require_components(), 1); |
| 116 | var import_i18n = __toESM(require_i18n(), 1); |
| 117 | |
| 118 | // packages/icons/build-module/icon/index.mjs |
| 119 | var import_element = __toESM(require_element(), 1); |
| 120 | var icon_default = (0, import_element.forwardRef)( |
| 121 | ({ icon, size = 24, ...props }, ref) => { |
| 122 | return (0, import_element.cloneElement)(icon, { |
| 123 | width: size, |
| 124 | height: size, |
| 125 | ...props, |
| 126 | ref |
| 127 | }); |
| 128 | } |
| 129 | ); |
| 130 | |
| 131 | // packages/icons/build-module/library/check.mjs |
| 132 | var import_primitives = __toESM(require_primitives(), 1); |
| 133 | var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); |
| 134 | var check_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); |
| 135 | |
| 136 | // packages/icons/build-module/library/chevron-left.mjs |
| 137 | var import_primitives2 = __toESM(require_primitives(), 1); |
| 138 | var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); |
| 139 | var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); |
| 140 | |
| 141 | // packages/icons/build-module/library/chevron-right.mjs |
| 142 | var import_primitives3 = __toESM(require_primitives(), 1); |
| 143 | var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); |
| 144 | var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); |
| 145 | |
| 146 | // packages/preferences/build-module/components/preference-toggle-menu-item/index.mjs |
| 147 | var import_a11y = __toESM(require_a11y(), 1); |
| 148 | |
| 149 | // packages/preferences/build-module/store/index.mjs |
| 150 | var import_data2 = __toESM(require_data(), 1); |
| 151 | |
| 152 | // packages/preferences/build-module/store/reducer.mjs |
| 153 | var import_data = __toESM(require_data(), 1); |
| 154 | function defaults(state = {}, action) { |
| 155 | if (action.type === "SET_PREFERENCE_DEFAULTS") { |
| 156 | const { scope, defaults: values } = action; |
| 157 | return { |
| 158 | ...state, |
| 159 | [scope]: { |
| 160 | ...state[scope], |
| 161 | ...values |
| 162 | } |
| 163 | }; |
| 164 | } |
| 165 | return state; |
| 166 | } |
| 167 | function withPersistenceLayer(reducer) { |
| 168 | let persistenceLayer; |
| 169 | return (state, action) => { |
| 170 | if (action.type === "SET_PERSISTENCE_LAYER") { |
| 171 | const { persistenceLayer: persistence, persistedData } = action; |
| 172 | persistenceLayer = persistence; |
| 173 | return persistedData; |
| 174 | } |
| 175 | const nextState = reducer(state, action); |
| 176 | if (action.type === "SET_PREFERENCE_VALUE") { |
| 177 | persistenceLayer?.set(nextState); |
| 178 | } |
| 179 | return nextState; |
| 180 | }; |
| 181 | } |
| 182 | var preferences = withPersistenceLayer((state = {}, action) => { |
| 183 | if (action.type === "SET_PREFERENCE_VALUE") { |
| 184 | const { scope, name, value } = action; |
| 185 | return { |
| 186 | ...state, |
| 187 | [scope]: { |
| 188 | ...state[scope], |
| 189 | [name]: value |
| 190 | } |
| 191 | }; |
| 192 | } |
| 193 | return state; |
| 194 | }); |
| 195 | var reducer_default = (0, import_data.combineReducers)({ |
| 196 | defaults, |
| 197 | preferences |
| 198 | }); |
| 199 | |
| 200 | // packages/preferences/build-module/store/actions.mjs |
| 201 | var actions_exports = {}; |
| 202 | __export(actions_exports, { |
| 203 | set: () => set, |
| 204 | setDefaults: () => setDefaults, |
| 205 | setPersistenceLayer: () => setPersistenceLayer, |
| 206 | toggle: () => toggle |
| 207 | }); |
| 208 | function toggle(scope, name) { |
| 209 | return function({ select, dispatch }) { |
| 210 | const currentValue = select.get(scope, name); |
| 211 | dispatch.set(scope, name, !currentValue); |
| 212 | }; |
| 213 | } |
| 214 | function set(scope, name, value) { |
| 215 | return { |
| 216 | type: "SET_PREFERENCE_VALUE", |
| 217 | scope, |
| 218 | name, |
| 219 | value |
| 220 | }; |
| 221 | } |
| 222 | function setDefaults(scope, defaults2) { |
| 223 | return { |
| 224 | type: "SET_PREFERENCE_DEFAULTS", |
| 225 | scope, |
| 226 | defaults: defaults2 |
| 227 | }; |
| 228 | } |
| 229 | async function setPersistenceLayer(persistenceLayer) { |
| 230 | const persistedData = await persistenceLayer.get(); |
| 231 | return { |
| 232 | type: "SET_PERSISTENCE_LAYER", |
| 233 | persistenceLayer, |
| 234 | persistedData |
| 235 | }; |
| 236 | } |
| 237 | |
| 238 | // packages/preferences/build-module/store/selectors.mjs |
| 239 | var selectors_exports = {}; |
| 240 | __export(selectors_exports, { |
| 241 | get: () => get |
| 242 | }); |
| 243 | var import_deprecated = __toESM(require_deprecated(), 1); |
| 244 | var withDeprecatedKeys = (originalGet) => (state, scope, name) => { |
| 245 | const settingsToMoveToCore = [ |
| 246 | "allowRightClickOverrides", |
| 247 | "distractionFree", |
| 248 | "editorMode", |
| 249 | "fixedToolbar", |
| 250 | "focusMode", |
| 251 | "hiddenBlockTypes", |
| 252 | "inactivePanels", |
| 253 | "keepCaretInsideBlock", |
| 254 | "mostUsedBlocks", |
| 255 | "openPanels", |
| 256 | "showBlockBreadcrumbs", |
| 257 | "showIconLabels", |
| 258 | "showListViewByDefault", |
| 259 | "isPublishSidebarEnabled", |
| 260 | "isComplementaryAreaVisible", |
| 261 | "pinnedItems" |
| 262 | ]; |
| 263 | if (settingsToMoveToCore.includes(name) && ["core/edit-post", "core/edit-site"].includes(scope)) { |
| 264 | (0, import_deprecated.default)( |
| 265 | `wp.data.select( 'core/preferences' ).get( '${scope}', '${name}' )`, |
| 266 | { |
| 267 | since: "6.5", |
| 268 | alternative: `wp.data.select( 'core/preferences' ).get( 'core', '${name}' )` |
| 269 | } |
| 270 | ); |
| 271 | return originalGet(state, "core", name); |
| 272 | } |
| 273 | return originalGet(state, scope, name); |
| 274 | }; |
| 275 | var get = withDeprecatedKeys( |
| 276 | (state, scope, name) => { |
| 277 | const value = state.preferences[scope]?.[name]; |
| 278 | return value !== void 0 ? value : state.defaults[scope]?.[name]; |
| 279 | } |
| 280 | ); |
| 281 | |
| 282 | // packages/preferences/build-module/store/constants.mjs |
| 283 | var STORE_NAME = "core/preferences"; |
| 284 | |
| 285 | // packages/preferences/build-module/store/index.mjs |
| 286 | var store = (0, import_data2.createReduxStore)(STORE_NAME, { |
| 287 | reducer: reducer_default, |
| 288 | actions: actions_exports, |
| 289 | selectors: selectors_exports |
| 290 | }); |
| 291 | (0, import_data2.register)(store); |
| 292 | |
| 293 | // packages/preferences/build-module/components/preference-toggle-menu-item/index.mjs |
| 294 | var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); |
| 295 | function PreferenceToggleMenuItem({ |
| 296 | scope, |
| 297 | name, |
| 298 | label, |
| 299 | info, |
| 300 | messageActivated, |
| 301 | messageDeactivated, |
| 302 | shortcut, |
| 303 | handleToggling = true, |
| 304 | onToggle = () => null, |
| 305 | disabled = false |
| 306 | }) { |
| 307 | const isActive = (0, import_data3.useSelect)( |
| 308 | (select) => !!select(store).get(scope, name), |
| 309 | [scope, name] |
| 310 | ); |
| 311 | const { toggle: toggle2 } = (0, import_data3.useDispatch)(store); |
| 312 | const speakMessage = () => { |
| 313 | if (isActive) { |
| 314 | const message = messageDeactivated || (0, import_i18n.sprintf)( |
| 315 | /* translators: %s: preference name, e.g. 'Fullscreen mode' */ |
| 316 | (0, import_i18n.__)("Preference deactivated - %s"), |
| 317 | label |
| 318 | ); |
| 319 | (0, import_a11y.speak)(message); |
| 320 | } else { |
| 321 | const message = messageActivated || (0, import_i18n.sprintf)( |
| 322 | /* translators: %s: preference name, e.g. 'Fullscreen mode' */ |
| 323 | (0, import_i18n.__)("Preference activated - %s"), |
| 324 | label |
| 325 | ); |
| 326 | (0, import_a11y.speak)(message); |
| 327 | } |
| 328 | }; |
| 329 | return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( |
| 330 | import_components.MenuItem, |
| 331 | { |
| 332 | icon: isActive ? check_default : null, |
| 333 | isSelected: isActive, |
| 334 | onClick: () => { |
| 335 | onToggle(); |
| 336 | if (handleToggling) { |
| 337 | toggle2(scope, name); |
| 338 | } |
| 339 | speakMessage(); |
| 340 | }, |
| 341 | role: "menuitemcheckbox", |
| 342 | info, |
| 343 | shortcut, |
| 344 | disabled, |
| 345 | children: label |
| 346 | } |
| 347 | ); |
| 348 | } |
| 349 | |
| 350 | // packages/preferences/build-module/components/preference-base-option/index.mjs |
| 351 | var import_components2 = __toESM(require_components(), 1); |
| 352 | var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); |
| 353 | function BaseOption({ |
| 354 | help, |
| 355 | label, |
| 356 | isChecked, |
| 357 | onChange, |
| 358 | children |
| 359 | }) { |
| 360 | return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "preference-base-option", children: [ |
| 361 | /* @__PURE__ */ (0, import_jsx_runtime5.jsx)( |
| 362 | import_components2.ToggleControl, |
| 363 | { |
| 364 | help, |
| 365 | label, |
| 366 | checked: isChecked, |
| 367 | onChange |
| 368 | } |
| 369 | ), |
| 370 | children |
| 371 | ] }); |
| 372 | } |
| 373 | var preference_base_option_default = BaseOption; |
| 374 | |
| 375 | // packages/preferences/build-module/components/preference-toggle-control/index.mjs |
| 376 | var import_data4 = __toESM(require_data(), 1); |
| 377 | var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); |
| 378 | function PreferenceToggleControl(props) { |
| 379 | const { |
| 380 | scope, |
| 381 | featureName, |
| 382 | onToggle = () => { |
| 383 | }, |
| 384 | ...remainingProps |
| 385 | } = props; |
| 386 | const isChecked = (0, import_data4.useSelect)( |
| 387 | (select) => !!select(store).get(scope, featureName), |
| 388 | [scope, featureName] |
| 389 | ); |
| 390 | const { toggle: toggle2 } = (0, import_data4.useDispatch)(store); |
| 391 | const onChange = () => { |
| 392 | onToggle(); |
| 393 | toggle2(scope, featureName); |
| 394 | }; |
| 395 | return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)( |
| 396 | preference_base_option_default, |
| 397 | { |
| 398 | ...remainingProps, |
| 399 | onChange, |
| 400 | isChecked |
| 401 | } |
| 402 | ); |
| 403 | } |
| 404 | var preference_toggle_control_default = PreferenceToggleControl; |
| 405 | |
| 406 | // packages/preferences/build-module/components/preferences-modal/index.mjs |
| 407 | var import_components3 = __toESM(require_components(), 1); |
| 408 | var import_i18n2 = __toESM(require_i18n(), 1); |
| 409 | var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); |
| 410 | function PreferencesModal({ |
| 411 | closeModal, |
| 412 | children |
| 413 | }) { |
| 414 | return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( |
| 415 | import_components3.Modal, |
| 416 | { |
| 417 | className: "preferences-modal", |
| 418 | title: (0, import_i18n2.__)("Preferences"), |
| 419 | onRequestClose: closeModal, |
| 420 | children |
| 421 | } |
| 422 | ); |
| 423 | } |
| 424 | |
| 425 | // packages/preferences/build-module/components/preferences-modal-section/index.mjs |
| 426 | var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); |
| 427 | var Section = ({ description, title, children }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("fieldset", { className: "preferences-modal__section", children: [ |
| 428 | /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("legend", { className: "preferences-modal__section-legend", children: [ |
| 429 | /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h2", { className: "preferences-modal__section-title", children: title }), |
| 430 | description && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "preferences-modal__section-description", children: description }) |
| 431 | ] }), |
| 432 | /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "preferences-modal__section-content", children }) |
| 433 | ] }); |
| 434 | var preferences_modal_section_default = Section; |
| 435 | |
| 436 | // packages/preferences/build-module/components/preferences-modal-tabs/index.mjs |
| 437 | var import_compose = __toESM(require_compose(), 1); |
| 438 | var import_components4 = __toESM(require_components(), 1); |
| 439 | var import_element2 = __toESM(require_element(), 1); |
| 440 | var import_i18n3 = __toESM(require_i18n(), 1); |
| 441 | |
| 442 | // packages/preferences/build-module/lock-unlock.mjs |
| 443 | var import_private_apis = __toESM(require_private_apis(), 1); |
| 444 | var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( |
| 445 | "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", |
| 446 | "@wordpress/preferences" |
| 447 | ); |
| 448 | |
| 449 | // packages/preferences/build-module/components/preferences-modal-tabs/index.mjs |
| 450 | var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); |
| 451 | var { Tabs } = unlock(import_components4.privateApis); |
| 452 | var PREFERENCES_MENU = "preferences-menu"; |
| 453 | function PreferencesModalTabs({ |
| 454 | sections |
| 455 | }) { |
| 456 | const isLargeViewport = (0, import_compose.useViewportMatch)("medium"); |
| 457 | const [activeMenu, setActiveMenu] = (0, import_element2.useState)(PREFERENCES_MENU); |
| 458 | const { tabs, sectionsContentMap } = (0, import_element2.useMemo)(() => { |
| 459 | let mappedTabs = { |
| 460 | tabs: [], |
| 461 | sectionsContentMap: {} |
| 462 | }; |
| 463 | if (sections.length) { |
| 464 | mappedTabs = sections.reduce( |
| 465 | (accumulator, { name, tabLabel: title, content }) => { |
| 466 | accumulator.tabs.push({ name, title }); |
| 467 | accumulator.sectionsContentMap[name] = content; |
| 468 | return accumulator; |
| 469 | }, |
| 470 | { tabs: [], sectionsContentMap: {} } |
| 471 | ); |
| 472 | } |
| 473 | return mappedTabs; |
| 474 | }, [sections]); |
| 475 | let modalContent; |
| 476 | if (isLargeViewport) { |
| 477 | modalContent = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "preferences__tabs", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)( |
| 478 | Tabs, |
| 479 | { |
| 480 | defaultTabId: activeMenu !== PREFERENCES_MENU ? activeMenu : void 0, |
| 481 | onSelect: setActiveMenu, |
| 482 | orientation: "vertical", |
| 483 | children: [ |
| 484 | /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Tabs.TabList, { className: "preferences__tabs-tablist", children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( |
| 485 | Tabs.Tab, |
| 486 | { |
| 487 | tabId: tab.name, |
| 488 | className: "preferences__tabs-tab", |
| 489 | children: tab.title |
| 490 | }, |
| 491 | tab.name |
| 492 | )) }), |
| 493 | tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( |
| 494 | Tabs.TabPanel, |
| 495 | { |
| 496 | tabId: tab.name, |
| 497 | className: "preferences__tabs-tabpanel", |
| 498 | focusable: false, |
| 499 | children: sectionsContentMap[tab.name] || null |
| 500 | }, |
| 501 | tab.name |
| 502 | )) |
| 503 | ] |
| 504 | } |
| 505 | ) }); |
| 506 | } else { |
| 507 | modalContent = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_components4.Navigator, { initialPath: "/", className: "preferences__provider", children: [ |
| 508 | /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.Navigator.Screen, { path: "/", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.Card, { isBorderless: true, size: "small", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.CardBody, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.__experimentalItemGroup, { children: tabs.map((tab) => { |
| 509 | return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( |
| 510 | import_components4.Navigator.Button, |
| 511 | { |
| 512 | path: `/${tab.name}`, |
| 513 | as: import_components4.__experimentalItem, |
| 514 | isAction: true, |
| 515 | children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_components4.__experimentalHStack, { justify: "space-between", children: [ |
| 516 | /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.__experimentalTruncate, { children: tab.title }) }), |
| 517 | /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( |
| 518 | icon_default, |
| 519 | { |
| 520 | icon: (0, import_i18n3.isRTL)() ? chevron_left_default : chevron_right_default |
| 521 | } |
| 522 | ) }) |
| 523 | ] }) |
| 524 | }, |
| 525 | tab.name |
| 526 | ); |
| 527 | }) }) }) }) }), |
| 528 | sections.length && sections.map((section) => { |
| 529 | return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( |
| 530 | import_components4.Navigator.Screen, |
| 531 | { |
| 532 | path: `/${section.name}`, |
| 533 | children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_components4.Card, { isBorderless: true, size: "large", children: [ |
| 534 | /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)( |
| 535 | import_components4.CardHeader, |
| 536 | { |
| 537 | isBorderless: false, |
| 538 | justify: "left", |
| 539 | size: "small", |
| 540 | gap: "6", |
| 541 | as: "div", |
| 542 | children: [ |
| 543 | /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( |
| 544 | import_components4.Navigator.BackButton, |
| 545 | { |
| 546 | icon: (0, import_i18n3.isRTL)() ? chevron_right_default : chevron_left_default, |
| 547 | label: (0, import_i18n3.__)("Back") |
| 548 | } |
| 549 | ), |
| 550 | /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.__experimentalText, { size: "16", children: section.tabLabel }) |
| 551 | ] |
| 552 | } |
| 553 | ), |
| 554 | /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.CardBody, { children: section.content }) |
| 555 | ] }) |
| 556 | }, |
| 557 | `${section.name}-menu` |
| 558 | ); |
| 559 | }) |
| 560 | ] }); |
| 561 | } |
| 562 | return modalContent; |
| 563 | } |
| 564 | |
| 565 | // packages/preferences/build-module/private-apis.mjs |
| 566 | var privateApis = {}; |
| 567 | lock(privateApis, { |
| 568 | PreferenceBaseOption: preference_base_option_default, |
| 569 | PreferenceToggleControl: preference_toggle_control_default, |
| 570 | PreferencesModal, |
| 571 | PreferencesModalSection: preferences_modal_section_default, |
| 572 | PreferencesModalTabs |
| 573 | }); |
| 574 | return __toCommonJS(index_exports); |
| 575 | })(); |
| 576 | //# sourceMappingURL=index.js.map |
| 577 |