@wordpress/fields 0.29.0 → 0.29.1-next.79a2f3cdd.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.
- package/CHANGELOG.md +0 -2
- package/LICENSE.md +1 -1
- package/README.md +41 -0
- package/build/actions/{delete-post.js → delete-post.cjs} +4 -4
- package/build/actions/{duplicate-pattern.js → duplicate-pattern.cjs} +2 -2
- package/build/actions/{duplicate-post.js → duplicate-post.cjs} +2 -2
- package/build/actions/{duplicate-template-part.js → duplicate-template-part.cjs} +3 -3
- package/build/actions/{export-pattern.js → export-pattern.cjs} +2 -2
- package/build/actions/{index.js → index.cjs} +14 -14
- package/build/actions/{permanently-delete-post.js → permanently-delete-post.cjs} +2 -2
- package/build/actions/{rename-post.js → rename-post.cjs} +3 -4
- package/build/actions/{rename-post.js.map → rename-post.cjs.map} +2 -2
- package/build/actions/{reorder-page.js → reorder-page.cjs} +2 -2
- package/build/actions/reorder-page.cjs.map +7 -0
- package/build/actions/{reset-post.js → reset-post.cjs} +2 -2
- package/build/actions/{restore-post.js → restore-post.cjs} +2 -2
- package/build/actions/{trash-post.js → trash-post.cjs} +2 -2
- package/build/actions/{utils.js → utils.cjs} +1 -1
- package/build/actions/{view-post-revisions.js → view-post-revisions.cjs} +1 -1
- package/build/actions/{view-post.js → view-post.cjs} +1 -1
- package/build/components/create-template-part-modal/{index.js → index.cjs} +2 -3
- package/build/components/create-template-part-modal/{index.js.map → index.cjs.map} +2 -2
- package/build/components/create-template-part-modal/{utils.js → utils.cjs} +1 -1
- package/build/components/media-edit/index.cjs +333 -0
- package/build/components/media-edit/index.cjs.map +7 -0
- package/build/fields/author/{author-view.js → author-view.cjs} +1 -1
- package/build/fields/author/{index.js → index.cjs} +2 -2
- package/build/fields/comment-status/{index.js → index.cjs} +1 -1
- package/build/fields/date/{date-view.js → date-view.cjs} +1 -1
- package/build/fields/date/{index.js → index.cjs} +2 -2
- package/build/fields/discussion/{index.js → index.cjs} +1 -1
- package/build/fields/featured-image/{featured-image-view.js → featured-image-view.cjs} +1 -1
- package/build/fields/featured-image/index.cjs +52 -0
- package/build/fields/featured-image/index.cjs.map +7 -0
- package/build/fields/{index.js → index.cjs} +18 -18
- package/build/fields/notes/{index.js → index.cjs} +1 -1
- package/build/fields/order/{index.js → index.cjs} +1 -1
- package/build/fields/page-title/{index.js → index.cjs} +3 -3
- package/build/fields/page-title/{view.js → view.cjs} +3 -3
- package/build/fields/parent/{index.js → index.cjs} +3 -3
- package/build/fields/parent/{parent-edit.js → parent-edit.cjs} +2 -3
- package/build/fields/parent/{parent-edit.js.map → parent-edit.cjs.map} +2 -2
- package/build/fields/parent/{parent-view.js → parent-view.cjs} +2 -2
- package/build/fields/parent/{utils.js → utils.cjs} +1 -1
- package/build/fields/password/{edit.js → edit.cjs} +1 -3
- package/build/fields/password/{edit.js.map → edit.cjs.map} +2 -2
- package/build/fields/password/{index.js → index.cjs} +2 -2
- package/build/fields/pattern-title/{index.js → index.cjs} +3 -3
- package/build/fields/pattern-title/{view.js → view.cjs} +3 -3
- package/build/fields/ping-status/{index.js → index.cjs} +1 -2
- package/build/fields/ping-status/index.cjs.map +7 -0
- package/build/fields/slug/{index.js → index.cjs} +3 -3
- package/build/fields/slug/{slug-edit.js → slug-edit.cjs} +2 -2
- package/build/fields/slug/{slug-view.js → slug-view.cjs} +2 -2
- package/build/fields/slug/{utils.js → utils.cjs} +2 -2
- package/build/fields/status/{index.js → index.cjs} +3 -3
- package/build/fields/status/{status-elements.js → status-elements.cjs} +1 -1
- package/build/fields/status/{status-view.js → status-view.cjs} +2 -2
- package/build/fields/template/{index.js → index.cjs} +2 -2
- package/build/fields/template/{template-edit.js → template-edit.cjs} +3 -3
- package/build/fields/template-title/{index.js → index.cjs} +3 -3
- package/build/fields/title/{index.js → index.cjs} +3 -3
- package/build/fields/title/{view.js → view.cjs} +2 -2
- package/build/{index.js → index.cjs} +10 -7
- package/build/index.cjs.map +7 -0
- package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
- package/build/mutation/{index.js → index.cjs} +1 -1
- package/build/{types.js → types.cjs} +1 -1
- package/build/types.cjs.map +7 -0
- package/build-module/actions/{delete-post.js → delete-post.mjs} +4 -4
- package/build-module/actions/{duplicate-pattern.js → duplicate-pattern.mjs} +2 -2
- package/build-module/actions/{duplicate-post.js → duplicate-post.mjs} +2 -2
- package/build-module/actions/{duplicate-template-part.js → duplicate-template-part.mjs} +3 -3
- package/build-module/actions/{export-pattern.js → export-pattern.mjs} +2 -2
- package/build-module/actions/index.mjs +30 -0
- package/build-module/actions/{permanently-delete-post.js → permanently-delete-post.mjs} +2 -2
- package/build-module/actions/{rename-post.js → rename-post.mjs} +3 -4
- package/build-module/actions/{rename-post.js.map → rename-post.mjs.map} +2 -2
- package/build-module/actions/{reorder-page.js → reorder-page.mjs} +2 -2
- package/build-module/actions/reorder-page.mjs.map +7 -0
- package/build-module/actions/{reset-post.js → reset-post.mjs} +2 -2
- package/build-module/actions/{restore-post.js → restore-post.mjs} +2 -2
- package/build-module/actions/{trash-post.js → trash-post.mjs} +2 -2
- package/build-module/actions/{utils.js → utils.mjs} +1 -1
- package/build-module/actions/{view-post-revisions.js → view-post-revisions.mjs} +1 -1
- package/build-module/actions/{view-post.js → view-post.mjs} +1 -1
- package/build-module/components/create-template-part-modal/{index.js → index.mjs} +2 -3
- package/build-module/components/create-template-part-modal/{index.js.map → index.mjs.map} +2 -2
- package/build-module/components/create-template-part-modal/{utils.js → utils.mjs} +1 -1
- package/build-module/components/media-edit/index.mjs +314 -0
- package/build-module/components/media-edit/index.mjs.map +7 -0
- package/build-module/fields/author/{author-view.js → author-view.mjs} +1 -1
- package/build-module/fields/author/{index.js → index.mjs} +2 -2
- package/build-module/fields/comment-status/{index.js → index.mjs} +1 -1
- package/build-module/fields/date/{date-view.js → date-view.mjs} +1 -1
- package/build-module/fields/date/{index.js → index.mjs} +2 -2
- package/build-module/fields/discussion/{index.js → index.mjs} +1 -1
- package/build-module/fields/featured-image/{featured-image-view.js → featured-image-view.mjs} +1 -1
- package/build-module/fields/featured-image/{index.js → index.mjs} +8 -5
- package/build-module/fields/featured-image/index.mjs.map +7 -0
- package/build-module/fields/index.mjs +38 -0
- package/build-module/fields/notes/{index.js → index.mjs} +1 -1
- package/build-module/fields/order/{index.js → index.mjs} +1 -1
- package/build-module/fields/page-title/{index.js → index.mjs} +3 -3
- package/build-module/fields/page-title/{view.js → view.mjs} +3 -3
- package/build-module/fields/parent/{index.js → index.mjs} +3 -3
- package/build-module/fields/parent/{parent-edit.js → parent-edit.mjs} +2 -3
- package/build-module/fields/parent/{parent-edit.js.map → parent-edit.mjs.map} +2 -2
- package/build-module/fields/parent/{parent-view.js → parent-view.mjs} +2 -2
- package/build-module/fields/parent/{utils.js → utils.mjs} +1 -1
- package/build-module/fields/password/{edit.js → edit.mjs} +1 -3
- package/build-module/fields/password/{edit.js.map → edit.mjs.map} +2 -2
- package/build-module/fields/password/{index.js → index.mjs} +2 -2
- package/build-module/fields/pattern-title/{index.js → index.mjs} +3 -3
- package/build-module/fields/pattern-title/{view.js → view.mjs} +3 -3
- package/build-module/fields/ping-status/{index.js → index.mjs} +1 -2
- package/build-module/fields/ping-status/index.mjs.map +7 -0
- package/build-module/fields/slug/{index.js → index.mjs} +3 -3
- package/build-module/fields/slug/{slug-edit.js → slug-edit.mjs} +2 -2
- package/build-module/fields/slug/{slug-view.js → slug-view.mjs} +2 -2
- package/build-module/fields/slug/{utils.js → utils.mjs} +2 -2
- package/build-module/fields/status/{index.js → index.mjs} +3 -3
- package/build-module/fields/status/{status-elements.js → status-elements.mjs} +1 -1
- package/build-module/fields/status/{status-view.js → status-view.mjs} +2 -2
- package/build-module/fields/template/{index.js → index.mjs} +2 -2
- package/build-module/fields/template/{template-edit.js → template-edit.mjs} +3 -3
- package/build-module/fields/template-title/{index.js → index.mjs} +3 -3
- package/build-module/fields/title/{index.js → index.mjs} +3 -3
- package/build-module/fields/title/{view.js → view.mjs} +2 -2
- package/build-module/index.mjs +10 -0
- package/build-module/index.mjs.map +7 -0
- package/build-module/{lock-unlock.js → lock-unlock.mjs} +1 -1
- package/build-module/mutation/{index.js → index.mjs} +1 -1
- package/build-module/types.mjs +1 -0
- package/build-style/style-rtl.css +154 -64
- package/build-style/style.css +154 -64
- package/build-types/actions/rename-post.d.ts.map +1 -1
- package/build-types/actions/reorder-page.d.ts.map +1 -1
- package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
- package/build-types/components/media-edit/index.d.ts +42 -0
- package/build-types/components/media-edit/index.d.ts.map +1 -0
- package/build-types/fields/featured-image/index.d.ts +0 -3
- package/build-types/fields/featured-image/index.d.ts.map +1 -1
- package/build-types/fields/parent/parent-edit.d.ts.map +1 -1
- package/build-types/fields/password/edit.d.ts.map +1 -1
- package/build-types/fields/ping-status/index.d.ts.map +1 -1
- package/build-types/index.d.ts +2 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/types.d.ts +24 -0
- package/build-types/types.d.ts.map +1 -1
- package/package.json +38 -30
- package/src/actions/rename-post.tsx +0 -1
- package/src/actions/reorder-page.tsx +1 -2
- package/src/components/create-template-part-modal/index.tsx +0 -1
- package/src/components/media-edit/index.tsx +424 -0
- package/src/components/media-edit/style.scss +189 -0
- package/src/fields/featured-image/{index.ts → index.tsx} +5 -2
- package/src/fields/featured-image/style.scss +7 -89
- package/src/fields/parent/parent-edit.tsx +0 -1
- package/src/fields/password/edit.tsx +0 -2
- package/src/fields/ping-status/index.tsx +0 -1
- package/src/index.ts +2 -0
- package/src/style.scss +1 -0
- package/src/types.ts +30 -0
- package/build/actions/reorder-page.js.map +0 -7
- package/build/fields/featured-image/featured-image-edit.js +0 -162
- package/build/fields/featured-image/featured-image-edit.js.map +0 -7
- package/build/fields/featured-image/index.js +0 -39
- package/build/fields/featured-image/index.js.map +0 -7
- package/build/fields/ping-status/index.js.map +0 -7
- package/build/index.js.map +0 -7
- package/build/types.js.map +0 -7
- package/build-module/actions/index.js +0 -30
- package/build-module/actions/reorder-page.js.map +0 -7
- package/build-module/fields/featured-image/featured-image-edit.js +0 -140
- package/build-module/fields/featured-image/featured-image-edit.js.map +0 -7
- package/build-module/fields/featured-image/index.js.map +0 -7
- package/build-module/fields/index.js +0 -38
- package/build-module/fields/ping-status/index.js.map +0 -7
- package/build-module/index.js +0 -8
- package/build-module/index.js.map +0 -7
- package/build-module/types.js +0 -1
- package/build-types/fields/featured-image/featured-image-edit.d.ts +0 -7
- package/build-types/fields/featured-image/featured-image-edit.d.ts.map +0 -1
- package/src/fields/featured-image/featured-image-edit.tsx +0 -170
- package/tsconfig.json +0 -31
- package/tsconfig.tsbuildinfo +0 -1
- /package/build/actions/{delete-post.js.map → delete-post.cjs.map} +0 -0
- /package/build/actions/{duplicate-pattern.js.map → duplicate-pattern.cjs.map} +0 -0
- /package/build/actions/{duplicate-post.js.map → duplicate-post.cjs.map} +0 -0
- /package/build/actions/{duplicate-template-part.js.map → duplicate-template-part.cjs.map} +0 -0
- /package/build/actions/{export-pattern.js.map → export-pattern.cjs.map} +0 -0
- /package/build/actions/{index.js.map → index.cjs.map} +0 -0
- /package/build/actions/{permanently-delete-post.js.map → permanently-delete-post.cjs.map} +0 -0
- /package/build/actions/{reset-post.js.map → reset-post.cjs.map} +0 -0
- /package/build/actions/{restore-post.js.map → restore-post.cjs.map} +0 -0
- /package/build/actions/{trash-post.js.map → trash-post.cjs.map} +0 -0
- /package/build/actions/{utils.js.map → utils.cjs.map} +0 -0
- /package/build/actions/{view-post-revisions.js.map → view-post-revisions.cjs.map} +0 -0
- /package/build/actions/{view-post.js.map → view-post.cjs.map} +0 -0
- /package/build/components/create-template-part-modal/{utils.js.map → utils.cjs.map} +0 -0
- /package/build/fields/author/{author-view.js.map → author-view.cjs.map} +0 -0
- /package/build/fields/author/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/comment-status/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/date/{date-view.js.map → date-view.cjs.map} +0 -0
- /package/build/fields/date/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/discussion/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/featured-image/{featured-image-view.js.map → featured-image-view.cjs.map} +0 -0
- /package/build/fields/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/notes/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/order/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/page-title/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/page-title/{view.js.map → view.cjs.map} +0 -0
- /package/build/fields/parent/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/parent/{parent-view.js.map → parent-view.cjs.map} +0 -0
- /package/build/fields/parent/{utils.js.map → utils.cjs.map} +0 -0
- /package/build/fields/password/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/pattern-title/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/pattern-title/{view.js.map → view.cjs.map} +0 -0
- /package/build/fields/slug/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/slug/{slug-edit.js.map → slug-edit.cjs.map} +0 -0
- /package/build/fields/slug/{slug-view.js.map → slug-view.cjs.map} +0 -0
- /package/build/fields/slug/{utils.js.map → utils.cjs.map} +0 -0
- /package/build/fields/status/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/status/{status-elements.js.map → status-elements.cjs.map} +0 -0
- /package/build/fields/status/{status-view.js.map → status-view.cjs.map} +0 -0
- /package/build/fields/template/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/template/{template-edit.js.map → template-edit.cjs.map} +0 -0
- /package/build/fields/template-title/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/title/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/title/{view.js.map → view.cjs.map} +0 -0
- /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
- /package/build/mutation/{index.js.map → index.cjs.map} +0 -0
- /package/build-module/actions/{delete-post.js.map → delete-post.mjs.map} +0 -0
- /package/build-module/actions/{duplicate-pattern.js.map → duplicate-pattern.mjs.map} +0 -0
- /package/build-module/actions/{duplicate-post.js.map → duplicate-post.mjs.map} +0 -0
- /package/build-module/actions/{duplicate-template-part.js.map → duplicate-template-part.mjs.map} +0 -0
- /package/build-module/actions/{export-pattern.js.map → export-pattern.mjs.map} +0 -0
- /package/build-module/actions/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/actions/{permanently-delete-post.js.map → permanently-delete-post.mjs.map} +0 -0
- /package/build-module/actions/{reset-post.js.map → reset-post.mjs.map} +0 -0
- /package/build-module/actions/{restore-post.js.map → restore-post.mjs.map} +0 -0
- /package/build-module/actions/{trash-post.js.map → trash-post.mjs.map} +0 -0
- /package/build-module/actions/{utils.js.map → utils.mjs.map} +0 -0
- /package/build-module/actions/{view-post-revisions.js.map → view-post-revisions.mjs.map} +0 -0
- /package/build-module/actions/{view-post.js.map → view-post.mjs.map} +0 -0
- /package/build-module/components/create-template-part-modal/{utils.js.map → utils.mjs.map} +0 -0
- /package/build-module/fields/author/{author-view.js.map → author-view.mjs.map} +0 -0
- /package/build-module/fields/author/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/comment-status/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/date/{date-view.js.map → date-view.mjs.map} +0 -0
- /package/build-module/fields/date/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/discussion/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/featured-image/{featured-image-view.js.map → featured-image-view.mjs.map} +0 -0
- /package/build-module/fields/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/notes/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/order/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/page-title/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/page-title/{view.js.map → view.mjs.map} +0 -0
- /package/build-module/fields/parent/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/parent/{parent-view.js.map → parent-view.mjs.map} +0 -0
- /package/build-module/fields/parent/{utils.js.map → utils.mjs.map} +0 -0
- /package/build-module/fields/password/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/pattern-title/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/pattern-title/{view.js.map → view.mjs.map} +0 -0
- /package/build-module/fields/slug/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/slug/{slug-edit.js.map → slug-edit.mjs.map} +0 -0
- /package/build-module/fields/slug/{slug-view.js.map → slug-view.mjs.map} +0 -0
- /package/build-module/fields/slug/{utils.js.map → utils.mjs.map} +0 -0
- /package/build-module/fields/status/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/status/{status-elements.js.map → status-elements.mjs.map} +0 -0
- /package/build-module/fields/status/{status-view.js.map → status-view.mjs.map} +0 -0
- /package/build-module/fields/template/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/template/{template-edit.js.map → template-edit.mjs.map} +0 -0
- /package/build-module/fields/template-title/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/title/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/title/{view.js.map → view.mjs.map} +0 -0
- /package/build-module/{lock-unlock.js.map → lock-unlock.mjs.map} +0 -0
- /package/build-module/mutation/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/{types.js.map → types.mjs.map} +0 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/fields/src/components/media-edit/index.tsx
|
|
31
|
+
var media_edit_exports = {};
|
|
32
|
+
__export(media_edit_exports, {
|
|
33
|
+
default: () => MediaEdit
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(media_edit_exports);
|
|
36
|
+
var import_clsx = __toESM(require("clsx"));
|
|
37
|
+
var import_components = require("@wordpress/components");
|
|
38
|
+
var import_core_data = require("@wordpress/core-data");
|
|
39
|
+
var import_data = require("@wordpress/data");
|
|
40
|
+
var import_element = require("@wordpress/element");
|
|
41
|
+
var import_i18n = require("@wordpress/i18n");
|
|
42
|
+
var import_icons = require("@wordpress/icons");
|
|
43
|
+
var import_media_utils = require("@wordpress/media-utils");
|
|
44
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
45
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
+
var { MediaUploadModal } = (0, import_lock_unlock.unlock)(import_media_utils.privateApis);
|
|
47
|
+
function ConditionalMediaUpload({ render, multiple, ...props }) {
|
|
48
|
+
const [isModalOpen, setIsModalOpen] = (0, import_element.useState)(false);
|
|
49
|
+
if (window.__experimentalDataViewsMediaModal) {
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
51
|
+
render && render({ open: () => setIsModalOpen(true) }),
|
|
52
|
+
isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
+
MediaUploadModal,
|
|
54
|
+
{
|
|
55
|
+
...props,
|
|
56
|
+
multiple,
|
|
57
|
+
isOpen: isModalOpen,
|
|
58
|
+
onClose: () => {
|
|
59
|
+
setIsModalOpen(false);
|
|
60
|
+
props.onClose?.();
|
|
61
|
+
},
|
|
62
|
+
onSelect: (media) => {
|
|
63
|
+
setIsModalOpen(false);
|
|
64
|
+
props.onSelect?.(media);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] });
|
|
69
|
+
}
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
+
import_media_utils.MediaUpload,
|
|
72
|
+
{
|
|
73
|
+
...props,
|
|
74
|
+
render,
|
|
75
|
+
multiple: multiple ? "add" : void 0
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
function MediaPickerButton({
|
|
80
|
+
open,
|
|
81
|
+
children,
|
|
82
|
+
label,
|
|
83
|
+
showTooltip = false
|
|
84
|
+
}) {
|
|
85
|
+
const mediaPickerButton = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: "fields__media-edit-picker-button",
|
|
89
|
+
role: "button",
|
|
90
|
+
tabIndex: 0,
|
|
91
|
+
onClick: open,
|
|
92
|
+
onKeyDown: (event) => {
|
|
93
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
open();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"aria-label": label,
|
|
99
|
+
children
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
if (!showTooltip) {
|
|
103
|
+
return mediaPickerButton;
|
|
104
|
+
}
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Tooltip, { text: label, children: mediaPickerButton });
|
|
106
|
+
}
|
|
107
|
+
var archiveMimeTypes = [
|
|
108
|
+
"application/zip",
|
|
109
|
+
"application/x-zip-compressed",
|
|
110
|
+
"application/x-rar-compressed",
|
|
111
|
+
"application/x-7z-compressed",
|
|
112
|
+
"application/x-tar",
|
|
113
|
+
"application/x-gzip"
|
|
114
|
+
];
|
|
115
|
+
function MediaTitle({ attachment }) {
|
|
116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalTruncate, { className: "fields__media-edit-filename", children: attachment.title.rendered });
|
|
117
|
+
}
|
|
118
|
+
function MediaEditPlaceholder({
|
|
119
|
+
open,
|
|
120
|
+
label
|
|
121
|
+
}) {
|
|
122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MediaPickerButton, { open, label, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "fields__media-edit-placeholder", children: label }) });
|
|
123
|
+
}
|
|
124
|
+
function MediaPreview({ attachment }) {
|
|
125
|
+
const url = attachment.source_url;
|
|
126
|
+
const mimeType = attachment.mime_type;
|
|
127
|
+
if (mimeType.startsWith("image/")) {
|
|
128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
129
|
+
"img",
|
|
130
|
+
{
|
|
131
|
+
className: "fields__media-edit-thumbnail",
|
|
132
|
+
alt: attachment.alt_text || "",
|
|
133
|
+
src: url
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
} else if (mimeType.startsWith("audio/")) {
|
|
137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Icon, { icon: import_icons.audio });
|
|
138
|
+
} else if (mimeType.startsWith("video/")) {
|
|
139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Icon, { icon: import_icons.video });
|
|
140
|
+
} else if (archiveMimeTypes.includes(mimeType)) {
|
|
141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Icon, { icon: import_icons.archive });
|
|
142
|
+
}
|
|
143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Icon, { icon: import_icons.file });
|
|
144
|
+
}
|
|
145
|
+
function ExpandedMediaEditAttachments({
|
|
146
|
+
attachments,
|
|
147
|
+
addButtonLabel,
|
|
148
|
+
multiple,
|
|
149
|
+
removeItem,
|
|
150
|
+
open
|
|
151
|
+
}) {
|
|
152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: (0, import_clsx.default)("fields__media-edit-expanded", {
|
|
156
|
+
"is-multiple": multiple,
|
|
157
|
+
"is-single": !multiple,
|
|
158
|
+
"is-empty": !attachments?.length
|
|
159
|
+
}),
|
|
160
|
+
children: [
|
|
161
|
+
attachments?.map((attachment) => {
|
|
162
|
+
const hasPreviewImage = attachment.mime_type.startsWith("image/");
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
className: (0, import_clsx.default)("fields__media-edit-expanded-item", {
|
|
167
|
+
"has-preview-image": hasPreviewImage
|
|
168
|
+
}),
|
|
169
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
171
|
+
MediaPickerButton,
|
|
172
|
+
{
|
|
173
|
+
open,
|
|
174
|
+
label: (0, import_i18n.__)("Replace"),
|
|
175
|
+
showTooltip: true,
|
|
176
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "fields__media-edit-expanded-preview", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
177
|
+
import_components.__experimentalVStack,
|
|
178
|
+
{
|
|
179
|
+
spacing: 0,
|
|
180
|
+
alignment: "center",
|
|
181
|
+
justify: "center",
|
|
182
|
+
className: "fields__media-edit-expanded-preview-stack",
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MediaPreview, { attachment }),
|
|
185
|
+
!hasPreviewImage ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MediaTitle, { attachment }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "fields__media-edit-expanded-title", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
186
|
+
MediaTitle,
|
|
187
|
+
{
|
|
188
|
+
attachment
|
|
189
|
+
}
|
|
190
|
+
) })
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
) })
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "fields__media-edit-expanded-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
197
|
+
import_components.Button,
|
|
198
|
+
{
|
|
199
|
+
__next40pxDefaultSize: true,
|
|
200
|
+
className: "fields__media-edit-expanded-remove",
|
|
201
|
+
icon: import_icons.closeSmall,
|
|
202
|
+
label: (0, import_i18n.__)("Remove"),
|
|
203
|
+
size: "small",
|
|
204
|
+
onClick: (event) => {
|
|
205
|
+
event.stopPropagation();
|
|
206
|
+
removeItem(attachment.id);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
) })
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
attachment.id
|
|
213
|
+
);
|
|
214
|
+
}),
|
|
215
|
+
(multiple || !attachments?.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MediaEditPlaceholder, { open, label: addButtonLabel })
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
function CompactMediaEditAttachments({
|
|
221
|
+
attachments,
|
|
222
|
+
addButtonLabel,
|
|
223
|
+
multiple,
|
|
224
|
+
removeItem,
|
|
225
|
+
open
|
|
226
|
+
}) {
|
|
227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
228
|
+
!!attachments?.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalVStack, { spacing: 2, children: attachments.map((attachment) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
229
|
+
"div",
|
|
230
|
+
{
|
|
231
|
+
className: "fields__media-edit-compact",
|
|
232
|
+
children: [
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
234
|
+
MediaPickerButton,
|
|
235
|
+
{
|
|
236
|
+
open,
|
|
237
|
+
label: (0, import_i18n.__)("Replace"),
|
|
238
|
+
showTooltip: true,
|
|
239
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
240
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MediaPreview, { attachment }),
|
|
241
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MediaTitle, { attachment })
|
|
242
|
+
] })
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
246
|
+
import_components.Button,
|
|
247
|
+
{
|
|
248
|
+
__next40pxDefaultSize: true,
|
|
249
|
+
className: "fields__media-edit-remove",
|
|
250
|
+
text: (0, import_i18n.__)("Remove"),
|
|
251
|
+
variant: "secondary",
|
|
252
|
+
onClick: (event) => {
|
|
253
|
+
event.stopPropagation();
|
|
254
|
+
removeItem(attachment.id);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
attachment.id
|
|
261
|
+
)) }),
|
|
262
|
+
(multiple || !attachments?.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MediaEditPlaceholder, { open, label: addButtonLabel })
|
|
263
|
+
] });
|
|
264
|
+
}
|
|
265
|
+
function MediaEdit({
|
|
266
|
+
data,
|
|
267
|
+
field,
|
|
268
|
+
onChange,
|
|
269
|
+
hideLabelFromVision,
|
|
270
|
+
allowedTypes = ["image"],
|
|
271
|
+
multiple,
|
|
272
|
+
isExpanded
|
|
273
|
+
}) {
|
|
274
|
+
const value = field.getValue({ item: data });
|
|
275
|
+
const attachments = (0, import_data.useSelect)(
|
|
276
|
+
(select) => {
|
|
277
|
+
if (!value) {
|
|
278
|
+
return null;
|
|
279
|
+
}
|
|
280
|
+
const normalizedValue = Array.isArray(value) ? value : [value];
|
|
281
|
+
const { getEntityRecords } = select(import_core_data.store);
|
|
282
|
+
return getEntityRecords("postType", "attachment", {
|
|
283
|
+
include: normalizedValue
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
[value]
|
|
287
|
+
);
|
|
288
|
+
const onChangeControl = (0, import_element.useCallback)(
|
|
289
|
+
(newValue) => onChange(field.setValue({ item: data, value: newValue })),
|
|
290
|
+
[data, field, onChange]
|
|
291
|
+
);
|
|
292
|
+
const removeItem = (itemId) => {
|
|
293
|
+
const currentIds = Array.isArray(value) ? value : [value];
|
|
294
|
+
const newIds = currentIds.filter((id) => id !== itemId);
|
|
295
|
+
onChangeControl(newIds.length ? newIds : void 0);
|
|
296
|
+
};
|
|
297
|
+
const addButtonLabel = field.placeholder || (multiple ? (0, import_i18n.__)("Choose files") : (0, import_i18n.__)("Choose file"));
|
|
298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("fieldset", { className: "fields__media-edit", "data-field-id": field.id, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
299
|
+
ConditionalMediaUpload,
|
|
300
|
+
{
|
|
301
|
+
onSelect: (selectedMedia) => {
|
|
302
|
+
if (multiple) {
|
|
303
|
+
const newIds = Array.isArray(selectedMedia) ? selectedMedia.map((m) => m.id) : [selectedMedia.id];
|
|
304
|
+
onChangeControl(newIds);
|
|
305
|
+
} else {
|
|
306
|
+
onChangeControl(selectedMedia.id);
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
allowedTypes,
|
|
310
|
+
value,
|
|
311
|
+
multiple,
|
|
312
|
+
title: field.label,
|
|
313
|
+
render: ({ open }) => {
|
|
314
|
+
const AttachmentsComponent = isExpanded ? ExpandedMediaEditAttachments : CompactMediaEditAttachments;
|
|
315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: 2, children: [
|
|
316
|
+
field.label && (hideLabelFromVision ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.VisuallyHidden, { as: "legend", children: field.label }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.BaseControl.VisualLabel, { as: "legend", children: field.label })),
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
318
|
+
AttachmentsComponent,
|
|
319
|
+
{
|
|
320
|
+
attachments,
|
|
321
|
+
addButtonLabel,
|
|
322
|
+
multiple,
|
|
323
|
+
removeItem,
|
|
324
|
+
open
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
field.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { variant: "muted", children: field.description })
|
|
328
|
+
] });
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
) });
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/media-edit/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon,\n\t__experimentalText as Text,\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n\tBaseControl,\n\tTooltip,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { store as coreStore, type Attachment } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { archive, audio, video, file, closeSmall } from '@wordpress/icons';\nimport {\n\tMediaUpload,\n\tprivateApis as mediaUtilsPrivateApis,\n} from '@wordpress/media-utils';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport type { MediaEditProps } from '../../types';\n\nconst { MediaUploadModal } = unlock( mediaUtilsPrivateApis );\n\n/**\n * Conditional Media component that uses MediaUploadModal when experiment is enabled,\n * otherwise falls back to media-utils MediaUpload.\n *\n * @param root0 Component props.\n * @param root0.render Render prop function that receives { open } object.\n * @param root0.multiple Whether to allow multiple media selections.\n * @return The component.\n */\nfunction ConditionalMediaUpload( { render, multiple, ...props }: any ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tif ( ( window as any ).__experimentalDataViewsMediaModal ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ render && render( { open: () => setIsModalOpen( true ) } ) }\n\t\t\t\t{ isModalOpen && (\n\t\t\t\t\t<MediaUploadModal\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tprops.onClose?.();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonSelect={ ( media: any ) => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tprops.onSelect?.( media );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n\t// Fallback to media-utils MediaUpload when experiment is disabled.\n\treturn (\n\t\t<MediaUpload\n\t\t\t{ ...props }\n\t\t\trender={ render }\n\t\t\tmultiple={ multiple ? 'add' : undefined }\n\t\t/>\n\t);\n}\n\nfunction MediaPickerButton( {\n\topen,\n\tchildren,\n\tlabel,\n\tshowTooltip = false,\n}: {\n\topen: () => void;\n\tchildren: React.ReactNode;\n\tlabel: string;\n\tshowTooltip?: boolean;\n} ) {\n\tconst mediaPickerButton = (\n\t\t<div\n\t\t\tclassName=\"fields__media-edit-picker-button\"\n\t\t\trole=\"button\"\n\t\t\ttabIndex={ 0 }\n\t\t\tonClick={ open }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\topen();\n\t\t\t\t}\n\t\t\t} }\n\t\t\taria-label={ label }\n\t\t>\n\t\t\t{ children }\n\t\t</div>\n\t);\n\tif ( ! showTooltip ) {\n\t\treturn mediaPickerButton;\n\t}\n\treturn <Tooltip text={ label }>{ mediaPickerButton }</Tooltip>;\n}\n\nconst archiveMimeTypes = [\n\t'application/zip',\n\t'application/x-zip-compressed',\n\t'application/x-rar-compressed',\n\t'application/x-7z-compressed',\n\t'application/x-tar',\n\t'application/x-gzip',\n];\n\nfunction MediaTitle( { attachment }: { attachment: Attachment< 'view' > } ) {\n\treturn (\n\t\t<Truncate className=\"fields__media-edit-filename\">\n\t\t\t{ attachment.title.rendered }\n\t\t</Truncate>\n\t);\n}\n\nfunction MediaEditPlaceholder( {\n\topen,\n\tlabel,\n}: {\n\topen: () => void;\n\tlabel: string;\n} ) {\n\treturn (\n\t\t<MediaPickerButton open={ open } label={ label }>\n\t\t\t<span className=\"fields__media-edit-placeholder\">{ label }</span>\n\t\t</MediaPickerButton>\n\t);\n}\n\nfunction MediaPreview( { attachment }: { attachment: Attachment< 'view' > } ) {\n\tconst url = attachment.source_url;\n\tconst mimeType = attachment.mime_type;\n\tif ( mimeType.startsWith( 'image/' ) ) {\n\t\treturn (\n\t\t\t<img\n\t\t\t\tclassName=\"fields__media-edit-thumbnail\"\n\t\t\t\talt={ attachment.alt_text || '' }\n\t\t\t\tsrc={ url }\n\t\t\t/>\n\t\t);\n\t} else if ( mimeType.startsWith( 'audio/' ) ) {\n\t\treturn <Icon icon={ audio } />;\n\t} else if ( mimeType.startsWith( 'video/' ) ) {\n\t\treturn <Icon icon={ video } />;\n\t} else if ( archiveMimeTypes.includes( mimeType ) ) {\n\t\treturn <Icon icon={ archive } />;\n\t}\n\treturn <Icon icon={ file } />;\n}\n\ninterface MediaEditAttachmentsProps {\n\tattachments: Attachment< 'view' >[] | null;\n\taddButtonLabel: string;\n\tmultiple?: boolean;\n\tremoveItem: ( itemId: number ) => void;\n\topen: () => void;\n}\n\nfunction ExpandedMediaEditAttachments( {\n\tattachments,\n\taddButtonLabel,\n\tmultiple,\n\tremoveItem,\n\topen,\n}: MediaEditAttachmentsProps ) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'fields__media-edit-expanded', {\n\t\t\t\t'is-multiple': multiple,\n\t\t\t\t'is-single': ! multiple,\n\t\t\t\t'is-empty': ! attachments?.length,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ attachments?.map( ( attachment ) => {\n\t\t\t\tconst hasPreviewImage =\n\t\t\t\t\tattachment.mime_type.startsWith( 'image/' );\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={ attachment.id }\n\t\t\t\t\t\tclassName={ clsx( 'fields__media-edit-expanded-item', {\n\t\t\t\t\t\t\t'has-preview-image': hasPreviewImage,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MediaPickerButton\n\t\t\t\t\t\t\topen={ open }\n\t\t\t\t\t\t\tlabel={ __( 'Replace' ) }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"fields__media-edit-expanded-preview\">\n\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\t\t\t\tclassName=\"fields__media-edit-expanded-preview-stack\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<MediaPreview attachment={ attachment } />\n\t\t\t\t\t\t\t\t\t{ ! hasPreviewImage ? (\n\t\t\t\t\t\t\t\t\t\t<MediaTitle attachment={ attachment } />\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<div className=\"fields__media-edit-expanded-title\">\n\t\t\t\t\t\t\t\t\t\t\t<MediaTitle\n\t\t\t\t\t\t\t\t\t\t\t\tattachment={ attachment }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</MediaPickerButton>\n\t\t\t\t\t\t<div className=\"fields__media-edit-expanded-overlay\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tclassName=\"fields__media-edit-expanded-remove\"\n\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove' ) }\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\tonClick={ (\n\t\t\t\t\t\t\t\t\tevent: React.MouseEvent< HTMLButtonElement >\n\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\tremoveItem( attachment.id );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ ( multiple || ! attachments?.length ) && (\n\t\t\t\t<MediaEditPlaceholder open={ open } label={ addButtonLabel } />\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction CompactMediaEditAttachments( {\n\tattachments,\n\taddButtonLabel,\n\tmultiple,\n\tremoveItem,\n\topen,\n}: MediaEditAttachmentsProps ) {\n\treturn (\n\t\t<>\n\t\t\t{ !! attachments?.length && (\n\t\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t\t{ attachments.map( ( attachment ) => (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={ attachment.id }\n\t\t\t\t\t\t\tclassName=\"fields__media-edit-compact\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<MediaPickerButton\n\t\t\t\t\t\t\t\topen={ open }\n\t\t\t\t\t\t\t\tlabel={ __( 'Replace' ) }\n\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<MediaPreview attachment={ attachment } />\n\t\t\t\t\t\t\t\t\t<MediaTitle attachment={ attachment } />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t</MediaPickerButton>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tclassName=\"fields__media-edit-remove\"\n\t\t\t\t\t\t\t\ttext={ __( 'Remove' ) }\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tonClick={ (\n\t\t\t\t\t\t\t\t\tevent: React.MouseEvent< HTMLButtonElement >\n\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\tremoveItem( attachment.id );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) ) }\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t{ ( multiple || ! attachments?.length ) && (\n\t\t\t\t<MediaEditPlaceholder open={ open } label={ addButtonLabel } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * A media edit control component that provides a media picker UI with upload functionality\n * for selecting WordPress media attachments. Supports both the traditional WordPress media\n * library and the experimental DataViews media modal.\n *\n * This component is intended to be used as the `Edit` property of a field definition when\n * registering fields with `registerEntityField` from `@wordpress/editor`.\n *\n * @template Item - The type of the item being edited.\n *\n * @param {MediaEditProps<Item>} props - The component props.\n * @param {Item} props.data - The item being edited.\n * @param {Object} props.field - The field configuration with getValue and setValue methods.\n * @param {Function} props.onChange - Callback function when the media selection changes.\n * @param {string[]} [props.allowedTypes] - Array of allowed media types. Default `['image']`.\n * @param {boolean} [props.multiple] - Whether to allow multiple media selections. Default `false`.\n * @param {boolean} [props.hideLabelFromVision] - Whether the label should be hidden from vision.\n * @param {boolean} [props.isExpanded] - Whether to render in an expanded form. Default `false`.\n *\n * @return {JSX.Element} The media edit control component.\n *\n * @example\n * ```tsx\n * import { MediaEdit } from '@wordpress/fields';\n * import type { DataFormControlProps } from '@wordpress/dataviews';\n *\n * const featuredImageField = {\n * id: 'featured_media',\n * type: 'media',\n * label: 'Featured Image',\n * Edit: (props: DataFormControlProps<MyPostType>) => (\n * <MediaEdit\n * {...props}\n * allowedTypes={['image']}\n * />\n * ),\n * };\n * ```\n */\nexport default function MediaEdit< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tallowedTypes = [ 'image' ],\n\tmultiple,\n\tisExpanded,\n}: MediaEditProps< Item > ) {\n\tconst value = field.getValue( { item: data } );\n\tconst attachments = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! value ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst normalizedValue = Array.isArray( value ) ? value : [ value ];\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'postType', 'attachment', {\n\t\t\t\tinclude: normalizedValue,\n\t\t\t} ) as Attachment< 'view' >[] | null;\n\t\t},\n\t\t[ value ]\n\t);\n\tconst onChangeControl = useCallback(\n\t\t( newValue: number | number[] | undefined ) =>\n\t\t\tonChange( field.setValue( { item: data, value: newValue } ) ),\n\t\t[ data, field, onChange ]\n\t);\n\tconst removeItem = ( itemId: number ) => {\n\t\tconst currentIds = Array.isArray( value ) ? value : [ value ];\n\t\tconst newIds = currentIds.filter( ( id ) => id !== itemId );\n\t\tonChangeControl( newIds.length ? newIds : undefined );\n\t};\n\tconst addButtonLabel =\n\t\tfield.placeholder ||\n\t\t( multiple ? __( 'Choose files' ) : __( 'Choose file' ) );\n\treturn (\n\t\t<fieldset className=\"fields__media-edit\" data-field-id={ field.id }>\n\t\t\t<ConditionalMediaUpload\n\t\t\t\tonSelect={ ( selectedMedia: any ) => {\n\t\t\t\t\tif ( multiple ) {\n\t\t\t\t\t\tconst newIds = Array.isArray( selectedMedia )\n\t\t\t\t\t\t\t? selectedMedia.map( ( m: any ) => m.id )\n\t\t\t\t\t\t\t: [ selectedMedia.id ];\n\t\t\t\t\t\tonChangeControl( newIds );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tonChangeControl( selectedMedia.id );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tvalue={ value }\n\t\t\t\tmultiple={ multiple }\n\t\t\t\ttitle={ field.label }\n\t\t\t\trender={ ( { open }: any ) => {\n\t\t\t\t\tconst AttachmentsComponent = isExpanded\n\t\t\t\t\t\t? ExpandedMediaEditAttachments\n\t\t\t\t\t\t: CompactMediaEditAttachments;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t\t\t\t{ field.label &&\n\t\t\t\t\t\t\t\t( hideLabelFromVision ? (\n\t\t\t\t\t\t\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t\t\t\t\t\t\t{ field.label }\n\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t\t\t\t\t\t\t{ field.label }\n\t\t\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t<AttachmentsComponent\n\t\t\t\t\t\t\t\tattachments={ attachments }\n\t\t\t\t\t\t\t\taddButtonLabel={ addButtonLabel }\n\t\t\t\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\t\t\t\tremoveItem={ removeItem }\n\t\t\t\t\t\t\t\topen={ open }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ field.description && (\n\t\t\t\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t\t\t\t{ field.description }\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t</fieldset>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBASO;AACP,uBAAoD;AACpD,kBAA0B;AAC1B,qBAAsC;AACtC,kBAAmB;AACnB,mBAAwD;AACxD,yBAGO;AAKP,yBAAuB;AAkBpB;AAfH,IAAM,EAAE,iBAAiB,QAAI,2BAAQ,mBAAAA,WAAsB;AAW3D,SAAS,uBAAwB,EAAE,QAAQ,UAAU,GAAG,MAAM,GAAS;AACtE,QAAM,CAAE,aAAa,cAAe,QAAI,yBAAU,KAAM;AACxD,MAAO,OAAgB,mCAAoC;AAC1D,WACC,4EACG;AAAA,gBAAU,OAAQ,EAAE,MAAM,MAAM,eAAgB,IAAK,EAAE,CAAE;AAAA,MACzD,eACD;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACL;AAAA,UACA,QAAS;AAAA,UACT,SAAU,MAAM;AACf,2BAAgB,KAAM;AACtB,kBAAM,UAAU;AAAA,UACjB;AAAA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tB,0BAAiB,MAAO;AAAA,QACzB,OAAO;AACN,0BAAiB,cAAc,EAAG;AAAA,QACnC;AAAA,MACD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAQ,MAAM;AAAA,MACd,QAAS,CAAE,EAAE,KAAK,MAAY;AAC7B,cAAM,uBAAuB,aAC1B,+BACA;AACH,eACC,6CAAC,kBAAAD,sBAAA,EAAO,SAAU,GACf;AAAA,gBAAM,UACL,sBACD,4CAAC,oCAAe,IAAG,UAChB,gBAAM,OACT,IAEA,4CAAC,8BAAY,aAAZ,EAAwB,IAAG,UACzB,gBAAM,OACT;AAAA,UAEF;AAAA,YAAC;AAAA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACD;AAAA,UACE,MAAM,eACP,4CAAC,kBAAAE,oBAAA,EAAK,SAAQ,SACX,gBAAM,aACT;AAAA,WAEF;AAAA,MAEF;AAAA;AAAA,EACD,GACD;AAEF;",
|
|
6
|
+
"names": ["mediaUtilsPrivateApis", "Truncate", "clsx", "VStack", "coreStore", "Text"]
|
|
7
|
+
}
|
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(author_exports);
|
|
|
36
36
|
var import_i18n = require("@wordpress/i18n");
|
|
37
37
|
var import_data = require("@wordpress/data");
|
|
38
38
|
var import_core_data = require("@wordpress/core-data");
|
|
39
|
-
var import_author_view = __toESM(require("./author-view"));
|
|
39
|
+
var import_author_view = __toESM(require("./author-view.cjs"));
|
|
40
40
|
var authorField = {
|
|
41
41
|
label: (0, import_i18n.__)("Author"),
|
|
42
42
|
id: "author",
|
|
@@ -66,4 +66,4 @@ var authorField = {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
var author_default = authorField;
|
|
69
|
-
//# sourceMappingURL=index.
|
|
69
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -94,4 +94,4 @@ var DateView = ({ item }) => {
|
|
|
94
94
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", { children: getFormattedDate(item.date ?? null) });
|
|
95
95
|
};
|
|
96
96
|
var date_view_default = DateView;
|
|
97
|
-
//# sourceMappingURL=date-view.
|
|
97
|
+
//# sourceMappingURL=date-view.cjs.map
|
|
@@ -34,7 +34,7 @@ __export(date_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(date_exports);
|
|
36
36
|
var import_i18n = require("@wordpress/i18n");
|
|
37
|
-
var import_date_view = __toESM(require("./date-view"));
|
|
37
|
+
var import_date_view = __toESM(require("./date-view.cjs"));
|
|
38
38
|
var dateField = {
|
|
39
39
|
id: "date",
|
|
40
40
|
type: "datetime",
|
|
@@ -45,4 +45,4 @@ var dateField = {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
var date_default = dateField;
|
|
48
|
-
//# sourceMappingURL=index.
|
|
48
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/fields/src/fields/featured-image/index.tsx
|
|
31
|
+
var featured_image_exports = {};
|
|
32
|
+
__export(featured_image_exports, {
|
|
33
|
+
default: () => featured_image_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(featured_image_exports);
|
|
36
|
+
var import_i18n = require("@wordpress/i18n");
|
|
37
|
+
var import_media_edit = __toESM(require("../../components/media-edit/index.cjs"));
|
|
38
|
+
var import_featured_image_view = require("./featured-image-view.cjs");
|
|
39
|
+
var featuredImageField = {
|
|
40
|
+
id: "featured_media",
|
|
41
|
+
type: "media",
|
|
42
|
+
label: (0, import_i18n.__)("Featured Image"),
|
|
43
|
+
Edit: import_media_edit.default,
|
|
44
|
+
render: import_featured_image_view.FeaturedImageView,
|
|
45
|
+
setValue: ({ value }) => ({
|
|
46
|
+
featured_media: value ?? 0
|
|
47
|
+
}),
|
|
48
|
+
enableSorting: false,
|
|
49
|
+
filterBy: false
|
|
50
|
+
};
|
|
51
|
+
var featured_image_default = featuredImageField;
|
|
52
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/featured-image/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport MediaEdit from '../../components/media-edit';\nimport type { BasePostWithEmbeddedFeaturedMedia } from '../../types';\nimport { FeaturedImageView } from './featured-image-view';\n\nconst featuredImageField: Field< BasePostWithEmbeddedFeaturedMedia > = {\n\tid: 'featured_media',\n\ttype: 'media',\n\tlabel: __( 'Featured Image' ),\n\tEdit: MediaEdit,\n\trender: FeaturedImageView,\n\tsetValue: ( { value } ) => ( {\n\t\tfeatured_media: value ?? 0,\n\t} ),\n\tenableSorting: false,\n\tfilterBy: false,\n};\n\n/**\n * Featured Image field for BasePostWithEmbeddedFeaturedMedia.\n */\nexport default featuredImageField;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmB;AAKnB,wBAAsB;AAEtB,iCAAkC;AAElC,IAAM,qBAAiE;AAAA,EACtE,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,gBAAiB;AAAA,EAC5B,MAAM,kBAAAA;AAAA,EACN,QAAQ;AAAA,EACR,UAAU,CAAE,EAAE,MAAM,OAAS;AAAA,IAC5B,gBAAgB,SAAS;AAAA,EAC1B;AAAA,EACA,eAAe;AAAA,EACf,UAAU;AACX;AAKA,IAAO,yBAAQ;",
|
|
6
|
+
"names": ["MediaEdit"]
|
|
7
|
+
}
|
|
@@ -49,23 +49,23 @@ __export(fields_exports, {
|
|
|
49
49
|
titleField: () => import_title.default
|
|
50
50
|
});
|
|
51
51
|
module.exports = __toCommonJS(fields_exports);
|
|
52
|
-
var import_slug = __toESM(require("./slug"));
|
|
53
|
-
var import_title = __toESM(require("./title"));
|
|
54
|
-
var import_page_title = __toESM(require("./page-title"));
|
|
55
|
-
var import_template_title = __toESM(require("./template-title"));
|
|
56
|
-
var import_pattern_title = __toESM(require("./pattern-title"));
|
|
57
|
-
var import_order = __toESM(require("./order"));
|
|
58
|
-
var import_featured_image = __toESM(require("./featured-image"));
|
|
59
|
-
var import_template = __toESM(require("./template"));
|
|
60
|
-
var import_parent = __toESM(require("./parent"));
|
|
61
|
-
var import_password = __toESM(require("./password"));
|
|
62
|
-
var import_status = __toESM(require("./status"));
|
|
63
|
-
var import_comment_status = __toESM(require("./comment-status"));
|
|
64
|
-
var import_ping_status = __toESM(require("./ping-status"));
|
|
65
|
-
var import_discussion = __toESM(require("./discussion"));
|
|
66
|
-
var import_date = __toESM(require("./date"));
|
|
67
|
-
var import_author = __toESM(require("./author"));
|
|
68
|
-
var import_notes = __toESM(require("./notes"));
|
|
52
|
+
var import_slug = __toESM(require("./slug/index.cjs"));
|
|
53
|
+
var import_title = __toESM(require("./title/index.cjs"));
|
|
54
|
+
var import_page_title = __toESM(require("./page-title/index.cjs"));
|
|
55
|
+
var import_template_title = __toESM(require("./template-title/index.cjs"));
|
|
56
|
+
var import_pattern_title = __toESM(require("./pattern-title/index.cjs"));
|
|
57
|
+
var import_order = __toESM(require("./order/index.cjs"));
|
|
58
|
+
var import_featured_image = __toESM(require("./featured-image/index.cjs"));
|
|
59
|
+
var import_template = __toESM(require("./template/index.cjs"));
|
|
60
|
+
var import_parent = __toESM(require("./parent/index.cjs"));
|
|
61
|
+
var import_password = __toESM(require("./password/index.cjs"));
|
|
62
|
+
var import_status = __toESM(require("./status/index.cjs"));
|
|
63
|
+
var import_comment_status = __toESM(require("./comment-status/index.cjs"));
|
|
64
|
+
var import_ping_status = __toESM(require("./ping-status/index.cjs"));
|
|
65
|
+
var import_discussion = __toESM(require("./discussion/index.cjs"));
|
|
66
|
+
var import_date = __toESM(require("./date/index.cjs"));
|
|
67
|
+
var import_author = __toESM(require("./author/index.cjs"));
|
|
68
|
+
var import_notes = __toESM(require("./notes/index.cjs"));
|
|
69
69
|
// Annotate the CommonJS export names for ESM import in node:
|
|
70
70
|
0 && (module.exports = {
|
|
71
71
|
authorField,
|
|
@@ -86,4 +86,4 @@ var import_notes = __toESM(require("./notes"));
|
|
|
86
86
|
templateTitleField,
|
|
87
87
|
titleField
|
|
88
88
|
});
|
|
89
|
-
//# sourceMappingURL=index.
|
|
89
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -34,8 +34,8 @@ __export(page_title_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(page_title_exports);
|
|
36
36
|
var import_i18n = require("@wordpress/i18n");
|
|
37
|
-
var import_utils = require("../../actions/utils");
|
|
38
|
-
var import_view = __toESM(require("./view"));
|
|
37
|
+
var import_utils = require("../../actions/utils.cjs");
|
|
38
|
+
var import_view = __toESM(require("./view.cjs"));
|
|
39
39
|
var pageTitleField = {
|
|
40
40
|
type: "text",
|
|
41
41
|
id: "title",
|
|
@@ -48,4 +48,4 @@ var pageTitleField = {
|
|
|
48
48
|
filterBy: false
|
|
49
49
|
};
|
|
50
50
|
var page_title_default = pageTitleField;
|
|
51
|
-
//# sourceMappingURL=index.
|
|
51
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -27,8 +27,8 @@ var import_i18n = require("@wordpress/i18n");
|
|
|
27
27
|
var import_data = require("@wordpress/data");
|
|
28
28
|
var import_core_data = require("@wordpress/core-data");
|
|
29
29
|
var import_components = require("@wordpress/components");
|
|
30
|
-
var import_view = require("../title/view");
|
|
31
|
-
var import_lock_unlock = require("../../lock-unlock");
|
|
30
|
+
var import_view = require("../title/view.cjs");
|
|
31
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
32
32
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
33
|
var { Badge } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
34
34
|
function PageTitleView({ item }) {
|
|
@@ -45,4 +45,4 @@ function PageTitleView({ item }) {
|
|
|
45
45
|
}, []);
|
|
46
46
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_view.BaseTitleView, { item, className: "fields-field__page-title", children: [frontPageId, postsPageId].includes(item.id) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { children: item.id === frontPageId ? (0, import_i18n.__)("Homepage") : (0, import_i18n.__)("Posts Page") }) });
|
|
47
47
|
}
|
|
48
|
-
//# sourceMappingURL=view.
|
|
48
|
+
//# sourceMappingURL=view.cjs.map
|
|
@@ -24,8 +24,8 @@ __export(parent_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(parent_exports);
|
|
26
26
|
var import_i18n = require("@wordpress/i18n");
|
|
27
|
-
var import_parent_edit = require("./parent-edit");
|
|
28
|
-
var import_parent_view = require("./parent-view");
|
|
27
|
+
var import_parent_edit = require("./parent-edit.cjs");
|
|
28
|
+
var import_parent_view = require("./parent-view.cjs");
|
|
29
29
|
var parentField = {
|
|
30
30
|
id: "parent",
|
|
31
31
|
type: "text",
|
|
@@ -36,4 +36,4 @@ var parentField = {
|
|
|
36
36
|
filterBy: false
|
|
37
37
|
};
|
|
38
38
|
var parent_default = parentField;
|
|
39
|
-
//# sourceMappingURL=index.
|
|
39
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -44,7 +44,7 @@ var import_compose = require("@wordpress/compose");
|
|
|
44
44
|
var import_html_entities = require("@wordpress/html-entities");
|
|
45
45
|
var import_i18n = require("@wordpress/i18n");
|
|
46
46
|
var import_url = require("@wordpress/url");
|
|
47
|
-
var import_utils = require("./utils");
|
|
47
|
+
var import_utils = require("./utils.cjs");
|
|
48
48
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
49
|
function buildTermsTree(flatTerms) {
|
|
50
50
|
const flatTermsWithParentAndChildren = flatTerms.map((term) => {
|
|
@@ -197,7 +197,6 @@ function PageAttributesParent({
|
|
|
197
197
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
198
198
|
import_components.ComboboxControl,
|
|
199
199
|
{
|
|
200
|
-
__nextHasNoMarginBottom: true,
|
|
201
200
|
__next40pxDefaultSize: true,
|
|
202
201
|
label: (0, import_i18n.__)("Parent"),
|
|
203
202
|
help: (0, import_i18n.__)("Choose a parent page."),
|
|
@@ -274,4 +273,4 @@ var ParentEdit = ({
|
|
|
274
273
|
ParentEdit,
|
|
275
274
|
getItemPriority
|
|
276
275
|
});
|
|
277
|
-
//# sourceMappingURL=parent-edit.
|
|
276
|
+
//# sourceMappingURL=parent-edit.cjs.map
|