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