PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/notices/index.js +14 -8 23.2.1 → trunk View file →
@@ -1,4 +1,5 @@
1 +(function() {
1 2 "use strict";
2 3 var wp;
3 4 (wp ||= {}).notices = (() => {
4 5 var __create = Object.create;
@@ -207,16 +208,14 @@
207 208 // packages/notices/build-module/components/inline-notices/index.mjs
208 209 var import_components = __toESM(require_components(), 1);
209 210 var import_data3 = __toESM(require_data(), 1);
210 211 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
211 - if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='2c1d02983b']")) {
212 - const style = document.createElement("style");
213 - style.setAttribute("data-wp-hash", "2c1d02983b");
214 - style.appendChild(document.createTextNode(".components-notices__dismissible,.components-notices__pinned{color:#1e1e1e}.components-notices__dismissible .components-notice,.components-notices__pinned .components-notice{border-bottom:1px solid #0003;box-sizing:border-box;min-height:64px;padding:0 12px}.components-notices__dismissible .components-notice .components-notice__dismiss,.components-notices__pinned .components-notice .components-notice__dismiss{margin-top:12px}"));
215 - document.head.appendChild(style);
212 + function hasRenderableChildren(children) {
213 + return children !== null && children !== void 0 && children !== false && children !== "";
216 214 }
217 215 function InlineNotices({
218 216 children,
217 + className,
219 218 pinnedNoticesClassName,
220 219 dismissibleNoticesClassName,
221 220 context
222 221 }) {
@@ -230,10 +229,15 @@
230 229 );
231 230 const nonDismissibleNotices = notices2.filter(
232 231 ({ isDismissible, type }) => !isDismissible && type === "default"
233 232 );
234 - return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
235 - /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
233 + const hasPinnedNotices = nonDismissibleNotices.length > 0;
234 + const hasDismissibleNotices = dismissibleNotices.length > 0 || hasRenderableChildren(children);
235 + if (!hasPinnedNotices && !hasDismissibleNotices) {
236 + return null;
237 + }
238 + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: clsx_default("notices-inline-notices-wrapper", className), children: [
239 + hasPinnedNotices && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
236 240 import_components.NoticeList,
237 241 {
238 242 notices: nonDismissibleNotices,
239 243 className: clsx_default(
@@ -241,9 +245,9 @@
241 245 pinnedNoticesClassName
242 246 )
243 247 }
244 248 ),
245 - /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
249 + hasDismissibleNotices && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
246 250 import_components.NoticeList,
247 251 {
248 252 notices: dismissibleNotices,
249 253 className: clsx_default(
@@ -281,6 +285,8 @@
281 285 }
282 286 );
283 287 }
284 288 return __toCommonJS(index_exports);
289 +})();
290 +(window.wp ||= {}).notices = wp.notices;
285 291 })();
286 292 //# sourceMappingURL=index.js.map