[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> preferences.js (source)

   1  /******/ (() => { // webpackBootstrap
   2  /******/     "use strict";
   3  /******/     // The require scope
   4  /******/     var __webpack_require__ = {};
   5  /******/     
   6  /************************************************************************/
   7  /******/     /* webpack/runtime/compat get default export */
   8  /******/     (() => {
   9  /******/         // getDefaultExport function for compatibility with non-harmony modules
  10  /******/         __webpack_require__.n = (module) => {
  11  /******/             var getter = module && module.__esModule ?
  12  /******/                 () => (module['default']) :
  13  /******/                 () => (module);
  14  /******/             __webpack_require__.d(getter, { a: getter });
  15  /******/             return getter;
  16  /******/         };
  17  /******/     })();
  18  /******/     
  19  /******/     /* webpack/runtime/define property getters */
  20  /******/     (() => {
  21  /******/         // define getter functions for harmony exports
  22  /******/         __webpack_require__.d = (exports, definition) => {
  23  /******/             for(var key in definition) {
  24  /******/                 if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  25  /******/                     Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  26  /******/                 }
  27  /******/             }
  28  /******/         };
  29  /******/     })();
  30  /******/     
  31  /******/     /* webpack/runtime/hasOwnProperty shorthand */
  32  /******/     (() => {
  33  /******/         __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  34  /******/     })();
  35  /******/     
  36  /******/     /* webpack/runtime/make namespace object */
  37  /******/     (() => {
  38  /******/         // define __esModule on exports
  39  /******/         __webpack_require__.r = (exports) => {
  40  /******/             if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  41  /******/                 Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  42  /******/             }
  43  /******/             Object.defineProperty(exports, '__esModule', { value: true });
  44  /******/         };
  45  /******/     })();
  46  /******/     
  47  /************************************************************************/
  48  var __webpack_exports__ = {};
  49  // ESM COMPAT FLAG
  50  __webpack_require__.r(__webpack_exports__);
  51  
  52  // EXPORTS
  53  __webpack_require__.d(__webpack_exports__, {
  54    PreferenceToggleMenuItem: () => (/* reexport */ PreferenceToggleMenuItem),
  55    privateApis: () => (/* reexport */ privateApis),
  56    store: () => (/* reexport */ store)
  57  });
  58  
  59  // NAMESPACE OBJECT: ./node_modules/@wordpress/preferences/build-module/store/actions.js
  60  var actions_namespaceObject = {};
  61  __webpack_require__.r(actions_namespaceObject);
  62  __webpack_require__.d(actions_namespaceObject, {
  63    set: () => (set),
  64    setDefaults: () => (setDefaults),
  65    setPersistenceLayer: () => (setPersistenceLayer),
  66    toggle: () => (toggle)
  67  });
  68  
  69  // NAMESPACE OBJECT: ./node_modules/@wordpress/preferences/build-module/store/selectors.js
  70  var selectors_namespaceObject = {};
  71  __webpack_require__.r(selectors_namespaceObject);
  72  __webpack_require__.d(selectors_namespaceObject, {
  73    get: () => (get)
  74  });
  75  
  76  ;// CONCATENATED MODULE: external "React"
  77  const external_React_namespaceObject = window["React"];
  78  ;// CONCATENATED MODULE: external ["wp","data"]
  79  const external_wp_data_namespaceObject = window["wp"]["data"];
  80  ;// CONCATENATED MODULE: external ["wp","components"]
  81  const external_wp_components_namespaceObject = window["wp"]["components"];
  82  ;// CONCATENATED MODULE: external ["wp","i18n"]
  83  const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  84  ;// CONCATENATED MODULE: external ["wp","primitives"]
  85  const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  86  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
  87  
  88  /**
  89   * WordPress dependencies
  90   */
  91  
  92  const check = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  93    xmlns: "http://www.w3.org/2000/svg",
  94    viewBox: "0 0 24 24"
  95  }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  96    d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
  97  }));
  98  /* harmony default export */ const library_check = (check);
  99  
 100  ;// CONCATENATED MODULE: external ["wp","a11y"]
 101  const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
 102  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/reducer.js
 103  /**
 104   * WordPress dependencies
 105   */
 106  
 107  
 108  /**
 109   * Reducer returning the defaults for user preferences.
 110   *
 111   * This is kept intentionally separate from the preferences
 112   * themselves so that defaults are not persisted.
 113   *
 114   * @param {Object} state  Current state.
 115   * @param {Object} action Dispatched action.
 116   *
 117   * @return {Object} Updated state.
 118   */
 119  function defaults(state = {}, action) {
 120    if (action.type === 'SET_PREFERENCE_DEFAULTS') {
 121      const {
 122        scope,
 123        defaults: values
 124      } = action;
 125      return {
 126        ...state,
 127        [scope]: {
 128          ...state[scope],
 129          ...values
 130        }
 131      };
 132    }
 133    return state;
 134  }
 135  
 136  /**
 137   * Higher order reducer that does the following:
 138   * - Merges any data from the persistence layer into the state when the
 139   *   `SET_PERSISTENCE_LAYER` action is received.
 140   * - Passes any preferences changes to the persistence layer.
 141   *
 142   * @param {Function} reducer The preferences reducer.
 143   *
 144   * @return {Function} The enhanced reducer.
 145   */
 146  function withPersistenceLayer(reducer) {
 147    let persistenceLayer;
 148    return (state, action) => {
 149      // Setup the persistence layer, and return the persisted data
 150      // as the state.
 151      if (action.type === 'SET_PERSISTENCE_LAYER') {
 152        const {
 153          persistenceLayer: persistence,
 154          persistedData
 155        } = action;
 156        persistenceLayer = persistence;
 157        return persistedData;
 158      }
 159      const nextState = reducer(state, action);
 160      if (action.type === 'SET_PREFERENCE_VALUE') {
 161        persistenceLayer?.set(nextState);
 162      }
 163      return nextState;
 164    };
 165  }
 166  
 167  /**
 168   * Reducer returning the user preferences.
 169   *
 170   * @param {Object} state  Current state.
 171   * @param {Object} action Dispatched action.
 172   *
 173   * @return {Object} Updated state.
 174   */
 175  const preferences = withPersistenceLayer((state = {}, action) => {
 176    if (action.type === 'SET_PREFERENCE_VALUE') {
 177      const {
 178        scope,
 179        name,
 180        value
 181      } = action;
 182      return {
 183        ...state,
 184        [scope]: {
 185          ...state[scope],
 186          [name]: value
 187        }
 188      };
 189    }
 190    return state;
 191  });
 192  /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
 193    defaults,
 194    preferences
 195  }));
 196  
 197  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/actions.js
 198  /**
 199   * Returns an action object used in signalling that a preference should be
 200   * toggled.
 201   *
 202   * @param {string} scope The preference scope (e.g. core/edit-post).
 203   * @param {string} name  The preference name.
 204   */
 205  function toggle(scope, name) {
 206    return function ({
 207      select,
 208      dispatch
 209    }) {
 210      const currentValue = select.get(scope, name);
 211      dispatch.set(scope, name, !currentValue);
 212    };
 213  }
 214  
 215  /**
 216   * Returns an action object used in signalling that a preference should be set
 217   * to a value
 218   *
 219   * @param {string} scope The preference scope (e.g. core/edit-post).
 220   * @param {string} name  The preference name.
 221   * @param {*}      value The value to set.
 222   *
 223   * @return {Object} Action object.
 224   */
 225  function set(scope, name, value) {
 226    return {
 227      type: 'SET_PREFERENCE_VALUE',
 228      scope,
 229      name,
 230      value
 231    };
 232  }
 233  
 234  /**
 235   * Returns an action object used in signalling that preference defaults should
 236   * be set.
 237   *
 238   * @param {string}            scope    The preference scope (e.g. core/edit-post).
 239   * @param {Object<string, *>} defaults A key/value map of preference names to values.
 240   *
 241   * @return {Object} Action object.
 242   */
 243  function setDefaults(scope, defaults) {
 244    return {
 245      type: 'SET_PREFERENCE_DEFAULTS',
 246      scope,
 247      defaults
 248    };
 249  }
 250  
 251  /** @typedef {() => Promise<Object>} WPPreferencesPersistenceLayerGet */
 252  /** @typedef {(Object) => void} WPPreferencesPersistenceLayerSet */
 253  /**
 254   * @typedef WPPreferencesPersistenceLayer
 255   *
 256   * @property {WPPreferencesPersistenceLayerGet} get An async function that gets data from the persistence layer.
 257   * @property {WPPreferencesPersistenceLayerSet} set A function that sets data in the persistence layer.
 258   */
 259  
 260  /**
 261   * Sets the persistence layer.
 262   *
 263   * When a persistence layer is set, the preferences store will:
 264   * - call `get` immediately and update the store state to the value returned.
 265   * - call `set` with all preferences whenever a preference changes value.
 266   *
 267   * `setPersistenceLayer` should ideally be dispatched at the start of an
 268   * application's lifecycle, before any other actions have been dispatched to
 269   * the preferences store.
 270   *
 271   * @param {WPPreferencesPersistenceLayer} persistenceLayer The persistence layer.
 272   *
 273   * @return {Object} Action object.
 274   */
 275  async function setPersistenceLayer(persistenceLayer) {
 276    const persistedData = await persistenceLayer.get();
 277    return {
 278      type: 'SET_PERSISTENCE_LAYER',
 279      persistenceLayer,
 280      persistedData
 281    };
 282  }
 283  
 284  ;// CONCATENATED MODULE: external ["wp","deprecated"]
 285  const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
 286  var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
 287  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/selectors.js
 288  /**
 289   * WordPress dependencies
 290   */
 291  
 292  const withDeprecatedKeys = originalGet => (state, scope, name) => {
 293    const settingsToMoveToCore = ['allowRightClickOverrides', 'distractionFree', 'editorMode', 'fixedToolbar', 'focusMode', 'hiddenBlockTypes', 'inactivePanels', 'keepCaretInsideBlock', 'mostUsedBlocks', 'openPanels', 'showBlockBreadcrumbs', 'showIconLabels', 'showListViewByDefault'];
 294    if (settingsToMoveToCore.includes(name) && ['core/edit-post', 'core/edit-site'].includes(scope)) {
 295      external_wp_deprecated_default()(`wp.data.select( 'core/preferences' ).get( '$scope}', '$name}' )`, {
 296        since: '6.5',
 297        alternative: `wp.data.select( 'core/preferences' ).get( 'core', '$name}' )`
 298      });
 299      return originalGet(state, 'core', name);
 300    }
 301    return originalGet(state, scope, name);
 302  };
 303  
 304  /**
 305   * Returns a boolean indicating whether a prefer is active for a particular
 306   * scope.
 307   *
 308   * @param {Object} state The store state.
 309   * @param {string} scope The scope of the feature (e.g. core/edit-post).
 310   * @param {string} name  The name of the feature.
 311   *
 312   * @return {*} Is the feature enabled?
 313   */
 314  const get = withDeprecatedKeys((state, scope, name) => {
 315    const value = state.preferences[scope]?.[name];
 316    return value !== undefined ? value : state.defaults[scope]?.[name];
 317  });
 318  
 319  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/constants.js
 320  /**
 321   * The identifier for the data store.
 322   *
 323   * @type {string}
 324   */
 325  const STORE_NAME = 'core/preferences';
 326  
 327  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/index.js
 328  /**
 329   * WordPress dependencies
 330   */
 331  
 332  
 333  /**
 334   * Internal dependencies
 335   */
 336  
 337  
 338  
 339  
 340  
 341  /**
 342   * Store definition for the preferences namespace.
 343   *
 344   * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
 345   *
 346   * @type {Object}
 347   */
 348  const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
 349    reducer: reducer,
 350    actions: actions_namespaceObject,
 351    selectors: selectors_namespaceObject
 352  });
 353  (0,external_wp_data_namespaceObject.register)(store);
 354  
 355  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preference-toggle-menu-item/index.js
 356  
 357  /**
 358   * WordPress dependencies
 359   */
 360  
 361  
 362  
 363  
 364  
 365  
 366  /**
 367   * Internal dependencies
 368   */
 369  
 370  function PreferenceToggleMenuItem({
 371    scope,
 372    name,
 373    label,
 374    info,
 375    messageActivated,
 376    messageDeactivated,
 377    shortcut,
 378    handleToggling = true,
 379    onToggle = () => null,
 380    disabled = false
 381  }) {
 382    const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(store).get(scope, name), [scope, name]);
 383    const {
 384      toggle
 385    } = (0,external_wp_data_namespaceObject.useDispatch)(store);
 386    const speakMessage = () => {
 387      if (isActive) {
 388        const message = messageDeactivated || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: preference name, e.g. 'Fullscreen mode' */
 389        (0,external_wp_i18n_namespaceObject.__)('Preference deactivated - %s'), label);
 390        (0,external_wp_a11y_namespaceObject.speak)(message);
 391      } else {
 392        const message = messageActivated || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: preference name, e.g. 'Fullscreen mode' */
 393        (0,external_wp_i18n_namespaceObject.__)('Preference activated - %s'), label);
 394        (0,external_wp_a11y_namespaceObject.speak)(message);
 395      }
 396    };
 397    return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
 398      icon: isActive && library_check,
 399      isSelected: isActive,
 400      onClick: () => {
 401        onToggle();
 402        if (handleToggling) {
 403          toggle(scope, name);
 404        }
 405        speakMessage();
 406      },
 407      role: "menuitemcheckbox",
 408      info: info,
 409      shortcut: shortcut,
 410      disabled: disabled
 411    }, label);
 412  }
 413  
 414  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/index.js
 415  
 416  
 417  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preference-base-option/index.js
 418  
 419  /**
 420   * WordPress dependencies
 421   */
 422  
 423  function BaseOption({
 424    help,
 425    label,
 426    isChecked,
 427    onChange,
 428    children
 429  }) {
 430    return (0,external_React_namespaceObject.createElement)("div", {
 431      className: "preference-base-option"
 432    }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
 433      __nextHasNoMarginBottom: true,
 434      help: help,
 435      label: label,
 436      checked: isChecked,
 437      onChange: onChange
 438    }), children);
 439  }
 440  /* harmony default export */ const preference_base_option = (BaseOption);
 441  
 442  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preference-toggle-control/index.js
 443  
 444  /**
 445   * WordPress dependencies
 446   */
 447  
 448  
 449  /**
 450   * Internal dependencies
 451   */
 452  
 453  
 454  function PreferenceToggleControl(props) {
 455    const {
 456      scope,
 457      featureName,
 458      onToggle = () => {},
 459      ...remainingProps
 460    } = props;
 461    const isChecked = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(store).get(scope, featureName), [scope, featureName]);
 462    const {
 463      toggle
 464    } = (0,external_wp_data_namespaceObject.useDispatch)(store);
 465    const onChange = () => {
 466      onToggle();
 467      toggle(scope, featureName);
 468    };
 469    return (0,external_React_namespaceObject.createElement)(preference_base_option, {
 470      onChange: onChange,
 471      isChecked: isChecked,
 472      ...remainingProps
 473    });
 474  }
 475  /* harmony default export */ const preference_toggle_control = (PreferenceToggleControl);
 476  
 477  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preferences-modal/index.js
 478  
 479  /**
 480   * WordPress dependencies
 481   */
 482  
 483  
 484  function PreferencesModal({
 485    closeModal,
 486    children
 487  }) {
 488    return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
 489      className: "preferences-modal",
 490      title: (0,external_wp_i18n_namespaceObject.__)('Preferences'),
 491      onRequestClose: closeModal
 492    }, children);
 493  }
 494  
 495  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preferences-modal-section/index.js
 496  
 497  const Section = ({
 498    description,
 499    title,
 500    children
 501  }) => (0,external_React_namespaceObject.createElement)("fieldset", {
 502    className: "preferences-modal__section"
 503  }, (0,external_React_namespaceObject.createElement)("legend", {
 504    className: "preferences-modal__section-legend"
 505  }, (0,external_React_namespaceObject.createElement)("h2", {
 506    className: "preferences-modal__section-title"
 507  }, title), description && (0,external_React_namespaceObject.createElement)("p", {
 508    className: "preferences-modal__section-description"
 509  }, description)), (0,external_React_namespaceObject.createElement)("div", {
 510    className: "preferences-modal__section-content"
 511  }, children));
 512  /* harmony default export */ const preferences_modal_section = (Section);
 513  
 514  ;// CONCATENATED MODULE: external ["wp","compose"]
 515  const external_wp_compose_namespaceObject = window["wp"]["compose"];
 516  ;// CONCATENATED MODULE: external ["wp","element"]
 517  const external_wp_element_namespaceObject = window["wp"]["element"];
 518  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
 519  /**
 520   * WordPress dependencies
 521   */
 522  
 523  
 524  /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
 525  
 526  /**
 527   * Return an SVG icon.
 528   *
 529   * @param {IconProps}                                 props icon is the SVG component to render
 530   *                                                          size is a number specifiying the icon size in pixels
 531   *                                                          Other props will be passed to wrapped SVG component
 532   * @param {import('react').ForwardedRef<HTMLElement>} ref   The forwarded ref to the SVG element.
 533   *
 534   * @return {JSX.Element}  Icon component
 535   */
 536  function Icon({
 537    icon,
 538    size = 24,
 539    ...props
 540  }, ref) {
 541    return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
 542      width: size,
 543      height: size,
 544      ...props,
 545      ref
 546    });
 547  }
 548  /* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
 549  
 550  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
 551  
 552  /**
 553   * WordPress dependencies
 554   */
 555  
 556  const chevronLeft = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
 557    xmlns: "http://www.w3.org/2000/svg",
 558    viewBox: "0 0 24 24"
 559  }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
 560    d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
 561  }));
 562  /* harmony default export */ const chevron_left = (chevronLeft);
 563  
 564  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
 565  
 566  /**
 567   * WordPress dependencies
 568   */
 569  
 570  const chevronRight = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
 571    xmlns: "http://www.w3.org/2000/svg",
 572    viewBox: "0 0 24 24"
 573  }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
 574    d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
 575  }));
 576  /* harmony default export */ const chevron_right = (chevronRight);
 577  
 578  ;// CONCATENATED MODULE: external ["wp","privateApis"]
 579  const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
 580  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/lock-unlock.js
 581  /**
 582   * WordPress dependencies
 583   */
 584  
 585  const {
 586    lock,
 587    unlock
 588  } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/preferences');
 589  
 590  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preferences-modal-tabs/index.js
 591  
 592  /**
 593   * WordPress dependencies
 594   */
 595  
 596  
 597  
 598  
 599  
 600  
 601  /**
 602   * Internal dependencies
 603   */
 604  
 605  const {
 606    Tabs
 607  } = unlock(external_wp_components_namespaceObject.privateApis);
 608  const PREFERENCES_MENU = 'preferences-menu';
 609  function PreferencesModalTabs({
 610    sections
 611  }) {
 612    const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
 613  
 614    // This is also used to sync the two different rendered components
 615    // between small and large viewports.
 616    const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU);
 617    /**
 618     * Create helper objects from `sections` for easier data handling.
 619     * `tabs` is used for creating the `Tabs` and `sectionsContentMap`
 620     * is used for easier access to active tab's content.
 621     */
 622    const {
 623      tabs,
 624      sectionsContentMap
 625    } = (0,external_wp_element_namespaceObject.useMemo)(() => {
 626      let mappedTabs = {
 627        tabs: [],
 628        sectionsContentMap: {}
 629      };
 630      if (sections.length) {
 631        mappedTabs = sections.reduce((accumulator, {
 632          name,
 633          tabLabel: title,
 634          content
 635        }) => {
 636          accumulator.tabs.push({
 637            name,
 638            title
 639          });
 640          accumulator.sectionsContentMap[name] = content;
 641          return accumulator;
 642        }, {
 643          tabs: [],
 644          sectionsContentMap: {}
 645        });
 646      }
 647      return mappedTabs;
 648    }, [sections]);
 649    let modalContent;
 650    // We render different components based on the viewport size.
 651    if (isLargeViewport) {
 652      modalContent = (0,external_React_namespaceObject.createElement)("div", {
 653        className: "preferences__tabs"
 654      }, (0,external_React_namespaceObject.createElement)(Tabs, {
 655        initialTabId: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
 656        onSelect: setActiveMenu,
 657        orientation: "vertical"
 658      }, (0,external_React_namespaceObject.createElement)(Tabs.TabList, {
 659        className: "preferences__tabs-tablist"
 660      }, tabs.map(tab => (0,external_React_namespaceObject.createElement)(Tabs.Tab, {
 661        tabId: tab.name,
 662        key: tab.name,
 663        className: "preferences__tabs-tab"
 664      }, tab.title))), tabs.map(tab => (0,external_React_namespaceObject.createElement)(Tabs.TabPanel, {
 665        tabId: tab.name,
 666        key: tab.name,
 667        className: "preferences__tabs-tabpanel",
 668        focusable: false
 669      }, sectionsContentMap[tab.name] || null))));
 670    } else {
 671      modalContent = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
 672        initialPath: "/",
 673        className: "preferences__provider"
 674      }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
 675        path: "/"
 676      }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
 677        isBorderless: true,
 678        size: "small"
 679      }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, tabs.map(tab => {
 680        return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
 681          key: tab.name,
 682          path: tab.name,
 683          as: external_wp_components_namespaceObject.__experimentalItem,
 684          isAction: true
 685        }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
 686          justify: "space-between"
 687        }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, tab.title)), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_namespaceObject.createElement)(icon, {
 688          icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
 689        }))));
 690      }))))), sections.length && sections.map(section => {
 691        return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
 692          key: `$section.name}-menu`,
 693          path: section.name
 694        }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
 695          isBorderless: true,
 696          size: "large"
 697        }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.CardHeader, {
 698          isBorderless: false,
 699          justify: "left",
 700          size: "small",
 701          gap: "6"
 702        }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, {
 703          icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
 704          "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
 705        }), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
 706          size: "16"
 707        }, section.tabLabel)), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, section.content)));
 708      }));
 709    }
 710    return modalContent;
 711  }
 712  
 713  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/private-apis.js
 714  /**
 715   * Internal dependencies
 716   */
 717  
 718  
 719  
 720  
 721  
 722  
 723  const privateApis = {};
 724  lock(privateApis, {
 725    PreferenceBaseOption: preference_base_option,
 726    PreferenceToggleControl: preference_toggle_control,
 727    PreferencesModal: PreferencesModal,
 728    PreferencesModalSection: preferences_modal_section,
 729    PreferencesModalTabs: PreferencesModalTabs
 730  });
 731  
 732  ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/index.js
 733  
 734  
 735  
 736  
 737  (window.wp = window.wp || {}).preferences = __webpack_exports__;
 738  /******/ })()
 739  ;


Generated : Thu Apr 25 08:20:02 2024 Cross-referenced by PHPXref