@wordpress/fields 0.33.0 → 0.33.1-next.v.202603102151.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.
Files changed (62) hide show
  1. package/README.md +12 -0
  2. package/build/fields/author/author-view.cjs +4 -4
  3. package/build/fields/author/author-view.cjs.map +2 -2
  4. package/build/fields/date/scheduled/index.cjs +39 -0
  5. package/build/fields/date/scheduled/index.cjs.map +7 -0
  6. package/build/fields/featured-image/index.cjs +1 -0
  7. package/build/fields/featured-image/index.cjs.map +2 -2
  8. package/build/fields/format/index.cjs +69 -0
  9. package/build/fields/format/index.cjs.map +7 -0
  10. package/build/fields/index.cjs +9 -0
  11. package/build/fields/index.cjs.map +2 -2
  12. package/build/fields/post-content-info/index.cjs +49 -0
  13. package/build/fields/post-content-info/index.cjs.map +7 -0
  14. package/build/fields/post-content-info/post-content-info-view.cjs +76 -0
  15. package/build/fields/post-content-info/post-content-info-view.cjs.map +7 -0
  16. package/build/fields/status/status-view.cjs +1 -1
  17. package/build/fields/status/status-view.cjs.map +2 -2
  18. package/build/types.cjs.map +1 -1
  19. package/build-module/fields/author/author-view.mjs +4 -4
  20. package/build-module/fields/author/author-view.mjs.map +2 -2
  21. package/build-module/fields/date/scheduled/index.mjs +18 -0
  22. package/build-module/fields/date/scheduled/index.mjs.map +7 -0
  23. package/build-module/fields/featured-image/index.mjs +1 -0
  24. package/build-module/fields/featured-image/index.mjs.map +2 -2
  25. package/build-module/fields/format/index.mjs +48 -0
  26. package/build-module/fields/format/index.mjs.map +7 -0
  27. package/build-module/fields/index.mjs +10 -4
  28. package/build-module/fields/index.mjs.map +2 -2
  29. package/build-module/fields/post-content-info/index.mjs +18 -0
  30. package/build-module/fields/post-content-info/index.mjs.map +7 -0
  31. package/build-module/fields/post-content-info/post-content-info-view.mjs +58 -0
  32. package/build-module/fields/post-content-info/post-content-info-view.mjs.map +7 -0
  33. package/build-module/fields/status/status-view.mjs +1 -1
  34. package/build-module/fields/status/status-view.mjs.map +2 -2
  35. package/build-style/style-rtl.css +50 -0
  36. package/build-style/style.css +50 -0
  37. package/build-types/fields/date/scheduled/index.d.ts +14 -0
  38. package/build-types/fields/date/scheduled/index.d.ts.map +1 -0
  39. package/build-types/fields/featured-image/index.d.ts.map +1 -1
  40. package/build-types/fields/format/index.d.ts +14 -0
  41. package/build-types/fields/format/index.d.ts.map +1 -0
  42. package/build-types/fields/index.d.ts +3 -0
  43. package/build-types/fields/index.d.ts.map +1 -1
  44. package/build-types/fields/post-content-info/index.d.ts +14 -0
  45. package/build-types/fields/post-content-info/index.d.ts.map +1 -0
  46. package/build-types/fields/post-content-info/post-content-info-view.d.ts +8 -0
  47. package/build-types/fields/post-content-info/post-content-info-view.d.ts.map +1 -0
  48. package/build-types/types.d.ts +1 -0
  49. package/build-types/types.d.ts.map +1 -1
  50. package/package.json +26 -26
  51. package/src/fields/author/author-view.tsx +7 -7
  52. package/src/fields/author/style.scss +46 -0
  53. package/src/fields/date/scheduled/index.tsx +27 -0
  54. package/src/fields/featured-image/index.tsx +1 -0
  55. package/src/fields/format/index.ts +62 -0
  56. package/src/fields/index.ts +3 -0
  57. package/src/fields/post-content-info/index.ts +27 -0
  58. package/src/fields/post-content-info/post-content-info-view.tsx +88 -0
  59. package/src/fields/status/status-view.tsx +1 -1
  60. package/src/fields/status/style.scss +10 -0
  61. package/src/style.scss +2 -0
  62. package/src/types.ts +1 -0
package/README.md CHANGED
@@ -71,6 +71,10 @@ Export action as JSON for Pattern.
71
71
 
72
72
  Featured Image field for BasePostWithEmbeddedFeaturedMedia.
73
73
 
74
+ ### formatField
75
+
76
+ Format field for BasePost.
77
+
74
78
  ### MediaEdit
75
79
 
76
80
  A media edit control component that provides a media picker UI with upload functionality for selecting WordPress media attachments. Supports both the traditional WordPress media library and the experimental DataViews media modal.
@@ -148,6 +152,10 @@ Delete action for PostWithPermissions.
148
152
 
149
153
  Ping status field for BasePost.
150
154
 
155
+ ### postContentInfoField
156
+
157
+ Post content information field for BasePost.
158
+
151
159
  ### PostType
152
160
 
153
161
  Undocumented declaration.
@@ -168,6 +176,10 @@ Reset action for Template and TemplatePart.
168
176
 
169
177
  Restore action for PostWithPermissions.
170
178
 
179
+ ### scheduledDateField
180
+
181
+ ScheduledDate Field.
182
+
171
183
  ### slugField
172
184
 
173
185
  Slug field for BasePost.
@@ -45,7 +45,7 @@ function AuthorView({ item }) {
45
45
  const authorId = item?.author;
46
46
  const embeddedAuthorId = item?._embedded?.author?.[0]?.id;
47
47
  const shouldFetch = Boolean(
48
- authorId && embeddedAuthorId && authorId !== embeddedAuthorId
48
+ authorId && (!embeddedAuthorId || authorId !== embeddedAuthorId)
49
49
  );
50
50
  const author = (0, import_data.useSelect)(
51
51
  (select) => {
@@ -64,7 +64,7 @@ function AuthorView({ item }) {
64
64
  !!imageUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
65
  "div",
66
66
  {
67
- className: (0, import_clsx.default)("page-templates-author-field__avatar", {
67
+ className: (0, import_clsx.default)("fields-controls__author-avatar", {
68
68
  "is-loaded": isImageLoaded
69
69
  }),
70
70
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -77,8 +77,8 @@ function AuthorView({ item }) {
77
77
  )
78
78
  }
79
79
  ),
80
- !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Icon, { icon: import_icons.commentAuthorAvatar }) }),
81
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "page-templates-author-field__name", children: text })
80
+ !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "fields-controls__author-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Icon, { icon: import_icons.commentAuthorAvatar }) }),
81
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "fields-controls__author-name", children: text })
82
82
  ] });
83
83
  }
84
84
  var author_view_default = AuthorView;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/fields/author/author-view.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { commentAuthorAvatar as authorIcon } from '@wordpress/icons';\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedAuthor } from '../../types';\n\nfunction AuthorView( { item }: { item: BasePostWithEmbeddedAuthor } ) {\n\t// When editing, item.author may differ from _embedded.author (which preserves\n\t// the saved record). Fetch the updated author only when they differ, so the\n\t// view reflects edits while lists preserve original data.\n\tconst authorId = item?.author;\n\tconst embeddedAuthorId = item?._embedded?.author?.[ 0 ]?.id;\n\tconst shouldFetch = Boolean(\n\t\tauthorId && embeddedAuthorId && authorId !== embeddedAuthorId\n\t);\n\tconst author = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! shouldFetch ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\t// This doesn't make extra REST requests because the records are\n\t\t\t// already in the store from the field's getElements function.\n\t\t\treturn authorId\n\t\t\t\t? getEntityRecord( 'root', 'user', authorId )\n\t\t\t\t: null;\n\t\t},\n\t\t[ authorId, shouldFetch ]\n\t);\n\t// Use fetched author if available, otherwise use _embedded.\n\tconst text = author?.name || item?._embedded?.author?.[ 0 ]?.name;\n\tconst imageUrl =\n\t\tauthor?.avatar_urls?.[ 48 ] ||\n\t\titem?._embedded?.author?.[ 0 ]?.avatar_urls?.[ 48 ];\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ !! imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt={ __( 'Author avatar' ) }\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ authorIcon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default AuthorView;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAmB;AACnB,qBAAyB;AACzB,mBAAkD;AAClD,wBAAqD;AACrD,kBAA0B;AAC1B,uBAAmC;AAqCjC;AA9BF,SAAS,WAAY,EAAE,KAAK,GAA0C;AAIrE,QAAM,WAAW,MAAM;AACvB,QAAM,mBAAmB,MAAM,WAAW,SAAU,CAAE,GAAG;AACzD,QAAM,cAAc;AAAA,IACnB,YAAY,oBAAoB,aAAa;AAAA,EAC9C;AACA,QAAM,aAAS;AAAA,IACd,CAAE,WAAY;AACb,UAAK,CAAE,aAAc;AACpB,eAAO;AAAA,MACR;AACA,YAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAAA,KAAU;AAG9C,aAAO,WACJ,gBAAiB,QAAQ,QAAQ,QAAS,IAC1C;AAAA,IACJ;AAAA,IACA,CAAE,UAAU,WAAY;AAAA,EACzB;AAEA,QAAM,OAAO,QAAQ,QAAQ,MAAM,WAAW,SAAU,CAAE,GAAG;AAC7D,QAAM,WACL,QAAQ,cAAe,EAAG,KAC1B,MAAM,WAAW,SAAU,CAAE,GAAG,cAAe,EAAG;AACnD,QAAM,CAAE,eAAe,gBAAiB,QAAI,yBAAU,KAAM;AAC5D,SACC,6CAAC,kBAAAC,sBAAA,EAAO,WAAU,QAAO,SAAU,GAChC;AAAA,KAAC,CAAE,YACJ;AAAA,MAAC;AAAA;AAAA,QACA,eAAY,YAAAC,SAAM,uCAAuC;AAAA,UACxD,aAAa;AAAA,QACd,CAAE;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACA,QAAS,MAAM,iBAAkB,IAAK;AAAA,YACtC,SAAM,gBAAI,eAAgB;AAAA,YAC1B,KAAM;AAAA;AAAA,QACP;AAAA;AAAA,IACD;AAAA,IAEC,CAAE,YACH,4CAAC,SAAI,WAAU,qCACd,sDAAC,0BAAK,MAAO,aAAAC,qBAAa,GAC3B;AAAA,IAED,4CAAC,UAAK,WAAU,qCAAsC,gBAAM;AAAA,KAC7D;AAEF;AAEA,IAAO,sBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { commentAuthorAvatar as authorIcon } from '@wordpress/icons';\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedAuthor } from '../../types';\n\nfunction AuthorView( { item }: { item: BasePostWithEmbeddedAuthor } ) {\n\t// Fetch the author record from the store when _embedded data is unavailable\n\t// (e.g. in the post editor inspector) or when the author has been changed\n\t// during editing (item.author differs from _embedded.author).\n\tconst authorId = item?.author;\n\tconst embeddedAuthorId = item?._embedded?.author?.[ 0 ]?.id;\n\tconst shouldFetch = Boolean(\n\t\tauthorId && ( ! embeddedAuthorId || authorId !== embeddedAuthorId )\n\t);\n\tconst author = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! shouldFetch ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\t// This doesn't make extra REST requests because the records are\n\t\t\t// already in the store from the field's getElements function.\n\t\t\treturn authorId\n\t\t\t\t? getEntityRecord( 'root', 'user', authorId )\n\t\t\t\t: null;\n\t\t},\n\t\t[ authorId, shouldFetch ]\n\t);\n\t// Use fetched author if available, otherwise use _embedded.\n\tconst text = author?.name || item?._embedded?.author?.[ 0 ]?.name;\n\tconst imageUrl =\n\t\tauthor?.avatar_urls?.[ 48 ] ||\n\t\titem?._embedded?.author?.[ 0 ]?.avatar_urls?.[ 48 ];\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ !! imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'fields-controls__author-avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt={ __( 'Author avatar' ) }\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"fields-controls__author-icon\">\n\t\t\t\t\t<Icon icon={ authorIcon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"fields-controls__author-name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default AuthorView;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAmB;AACnB,qBAAyB;AACzB,mBAAkD;AAClD,wBAAqD;AACrD,kBAA0B;AAC1B,uBAAmC;AAqCjC;AA9BF,SAAS,WAAY,EAAE,KAAK,GAA0C;AAIrE,QAAM,WAAW,MAAM;AACvB,QAAM,mBAAmB,MAAM,WAAW,SAAU,CAAE,GAAG;AACzD,QAAM,cAAc;AAAA,IACnB,aAAc,CAAE,oBAAoB,aAAa;AAAA,EAClD;AACA,QAAM,aAAS;AAAA,IACd,CAAE,WAAY;AACb,UAAK,CAAE,aAAc;AACpB,eAAO;AAAA,MACR;AACA,YAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAAA,KAAU;AAG9C,aAAO,WACJ,gBAAiB,QAAQ,QAAQ,QAAS,IAC1C;AAAA,IACJ;AAAA,IACA,CAAE,UAAU,WAAY;AAAA,EACzB;AAEA,QAAM,OAAO,QAAQ,QAAQ,MAAM,WAAW,SAAU,CAAE,GAAG;AAC7D,QAAM,WACL,QAAQ,cAAe,EAAG,KAC1B,MAAM,WAAW,SAAU,CAAE,GAAG,cAAe,EAAG;AACnD,QAAM,CAAE,eAAe,gBAAiB,QAAI,yBAAU,KAAM;AAC5D,SACC,6CAAC,kBAAAC,sBAAA,EAAO,WAAU,QAAO,SAAU,GAChC;AAAA,KAAC,CAAE,YACJ;AAAA,MAAC;AAAA;AAAA,QACA,eAAY,YAAAC,SAAM,kCAAkC;AAAA,UACnD,aAAa;AAAA,QACd,CAAE;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACA,QAAS,MAAM,iBAAkB,IAAK;AAAA,YACtC,SAAM,gBAAI,eAAgB;AAAA,YAC1B,KAAM;AAAA;AAAA,QACP;AAAA;AAAA,IACD;AAAA,IAEC,CAAE,YACH,4CAAC,SAAI,WAAU,gCACd,sDAAC,0BAAK,MAAO,aAAAC,qBAAa,GAC3B;AAAA,IAED,4CAAC,UAAK,WAAU,gCAAiC,gBAAM;AAAA,KACxD;AAEF;AAEA,IAAO,sBAAQ;",
6
6
  "names": ["coreStore", "HStack", "clsx", "authorIcon"]
7
7
  }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/fields/src/fields/date/scheduled/index.tsx
21
+ var scheduled_exports = {};
22
+ __export(scheduled_exports, {
23
+ default: () => scheduled_default
24
+ });
25
+ module.exports = __toCommonJS(scheduled_exports);
26
+ var import_i18n = require("@wordpress/i18n");
27
+ var scheduledDateField = {
28
+ id: "scheduled_date",
29
+ type: "datetime",
30
+ label: (0, import_i18n.__)("Scheduled Date"),
31
+ getValue: ({ item }) => item.date,
32
+ setValue: ({ value }) => ({ date: value }),
33
+ isVisible: (item) => item.status === "future",
34
+ enableHiding: false,
35
+ enableSorting: false,
36
+ filterBy: false
37
+ };
38
+ var scheduled_default = scheduledDateField;
39
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/fields/date/scheduled/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 type { BasePost } from '../../../types';\n\nconst scheduledDateField: Field< BasePost > = {\n\tid: 'scheduled_date',\n\ttype: 'datetime',\n\tlabel: __( 'Scheduled Date' ),\n\tgetValue: ( { item } ) => item.date,\n\tsetValue: ( { value } ) => ( { date: value } ),\n\tisVisible: ( item ) => item.status === 'future',\n\tenableHiding: false,\n\tenableSorting: false,\n\tfilterBy: false,\n};\n\n/**\n * ScheduledDate Field.\n */\nexport default scheduledDateField;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmB;AAOnB,IAAM,qBAAwC;AAAA,EAC7C,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,gBAAiB;AAAA,EAC5B,UAAU,CAAE,EAAE,KAAK,MAAO,KAAK;AAAA,EAC/B,UAAU,CAAE,EAAE,MAAM,OAAS,EAAE,MAAM,MAAM;AAAA,EAC3C,WAAW,CAAE,SAAU,KAAK,WAAW;AAAA,EACvC,cAAc;AAAA,EACd,eAAe;AAAA,EACf,UAAU;AACX;AAKA,IAAO,oBAAQ;",
6
+ "names": []
7
+ }
@@ -41,6 +41,7 @@ var featuredImageField = {
41
41
  id: "featured_media",
42
42
  type: "media",
43
43
  label: (0, import_i18n.__)("Featured Image"),
44
+ placeholder: (0, import_i18n.__)("Set featured image"),
44
45
  Edit: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_media_edit.default, { ...props, isExpanded: true }),
45
46
  render: import_featured_image_view.FeaturedImageView,
46
47
  setValue: ({ value }) => ({
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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: ( props ) => <MediaEdit { ...props } isExpanded />,\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;AAMd;AAJpB,IAAM,qBAAiE;AAAA,EACtE,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,gBAAiB;AAAA,EAC5B,MAAM,CAAE,UAAW,4CAAC,kBAAAA,SAAA,EAAY,GAAG,OAAQ,YAAU,MAAC;AAAA,EACtD,QAAQ;AAAA,EACR,UAAU,CAAE,EAAE,MAAM,OAAS;AAAA,IAC5B,gBAAgB,SAAS;AAAA,EAC1B;AAAA,EACA,eAAe;AAAA,EACf,UAAU;AACX;AAKA,IAAO,yBAAQ;",
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\tplaceholder: __( 'Set featured image' ),\n\tEdit: ( props ) => <MediaEdit { ...props } isExpanded />,\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;AAOd;AALpB,IAAM,qBAAiE;AAAA,EACtE,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,gBAAiB;AAAA,EAC5B,iBAAa,gBAAI,oBAAqB;AAAA,EACtC,MAAM,CAAE,UAAW,4CAAC,kBAAAA,SAAA,EAAY,GAAG,OAAQ,YAAU,MAAC;AAAA,EACtD,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
6
  "names": ["MediaEdit"]
7
7
  }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/fields/src/fields/format/index.ts
21
+ var format_exports = {};
22
+ __export(format_exports, {
23
+ default: () => format_default
24
+ });
25
+ module.exports = __toCommonJS(format_exports);
26
+ var import_i18n = require("@wordpress/i18n");
27
+ var import_data = require("@wordpress/data");
28
+ var import_core_data = require("@wordpress/core-data");
29
+ var POST_FORMATS = [
30
+ { id: "aside", caption: (0, import_i18n.__)("Aside") },
31
+ { id: "audio", caption: (0, import_i18n.__)("Audio") },
32
+ { id: "chat", caption: (0, import_i18n.__)("Chat") },
33
+ { id: "gallery", caption: (0, import_i18n.__)("Gallery") },
34
+ { id: "image", caption: (0, import_i18n.__)("Image") },
35
+ { id: "link", caption: (0, import_i18n.__)("Link") },
36
+ { id: "quote", caption: (0, import_i18n.__)("Quote") },
37
+ { id: "standard", caption: (0, import_i18n.__)("Standard") },
38
+ { id: "status", caption: (0, import_i18n.__)("Status") },
39
+ { id: "video", caption: (0, import_i18n.__)("Video") }
40
+ ].sort((a, b) => {
41
+ const normalizedA = a.caption.toUpperCase();
42
+ const normalizedB = b.caption.toUpperCase();
43
+ if (normalizedA < normalizedB) {
44
+ return -1;
45
+ }
46
+ if (normalizedA > normalizedB) {
47
+ return 1;
48
+ }
49
+ return 0;
50
+ });
51
+ var formatField = {
52
+ id: "format",
53
+ label: (0, import_i18n.__)("Format"),
54
+ type: "text",
55
+ Edit: "radio",
56
+ enableSorting: false,
57
+ enableHiding: false,
58
+ filterBy: false,
59
+ getElements: async () => {
60
+ const themeSupports = await (0, import_data.resolveSelect)(import_core_data.store).getThemeSupports();
61
+ return POST_FORMATS.filter(
62
+ (f) => themeSupports?.formats?.includes(
63
+ f.id
64
+ )
65
+ ).map((f) => ({ value: f.id, label: f.caption }));
66
+ }
67
+ };
68
+ var format_default = formatField;
69
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/fields/format/index.ts"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\n// All WP post formats, sorted alphabetically by translated name.\nconst POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\nconst formatField: Field< BasePost > = {\n\tid: 'format',\n\tlabel: __( 'Format' ),\n\ttype: 'text',\n\tEdit: 'radio',\n\tenableSorting: false,\n\tenableHiding: false,\n\tfilterBy: false,\n\tgetElements: async () => {\n\t\tconst themeSupports =\n\t\t\tawait resolveSelect( coreStore ).getThemeSupports();\n\t\treturn POST_FORMATS.filter(\n\t\t\t( f ) =>\n\t\t\t\t( themeSupports?.formats as string[] | undefined )?.includes(\n\t\t\t\t\tf.id\n\t\t\t\t)\n\t\t).map( ( f ) => ( { value: f.id, label: f.caption } ) );\n\t},\n};\n\n/**\n * Format field for BasePost.\n */\nexport default formatField;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmB;AACnB,kBAA8B;AAC9B,uBAAmC;AAQnC,IAAM,eAAe;AAAA,EACpB,EAAE,IAAI,SAAS,aAAS,gBAAI,OAAQ,EAAE;AAAA,EACtC,EAAE,IAAI,SAAS,aAAS,gBAAI,OAAQ,EAAE;AAAA,EACtC,EAAE,IAAI,QAAQ,aAAS,gBAAI,MAAO,EAAE;AAAA,EACpC,EAAE,IAAI,WAAW,aAAS,gBAAI,SAAU,EAAE;AAAA,EAC1C,EAAE,IAAI,SAAS,aAAS,gBAAI,OAAQ,EAAE;AAAA,EACtC,EAAE,IAAI,QAAQ,aAAS,gBAAI,MAAO,EAAE;AAAA,EACpC,EAAE,IAAI,SAAS,aAAS,gBAAI,OAAQ,EAAE;AAAA,EACtC,EAAE,IAAI,YAAY,aAAS,gBAAI,UAAW,EAAE;AAAA,EAC5C,EAAE,IAAI,UAAU,aAAS,gBAAI,QAAS,EAAE;AAAA,EACxC,EAAE,IAAI,SAAS,aAAS,gBAAI,OAAQ,EAAE;AACvC,EAAE,KAAM,CAAE,GAAG,MAAO;AACnB,QAAM,cAAc,EAAE,QAAQ,YAAY;AAC1C,QAAM,cAAc,EAAE,QAAQ,YAAY;AAE1C,MAAK,cAAc,aAAc;AAChC,WAAO;AAAA,EACR;AACA,MAAK,cAAc,aAAc;AAChC,WAAO;AAAA,EACR;AACA,SAAO;AACR,CAAE;AAEF,IAAM,cAAiC;AAAA,EACtC,IAAI;AAAA,EACJ,WAAO,gBAAI,QAAS;AAAA,EACpB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAU;AAAA,EACV,aAAa,YAAY;AACxB,UAAM,gBACL,UAAM,2BAAe,iBAAAA,KAAU,EAAE,iBAAiB;AACnD,WAAO,aAAa;AAAA,MACnB,CAAE,MACC,eAAe,SAAmC;AAAA,QACnD,EAAE;AAAA,MACH;AAAA,IACF,EAAE,IAAK,CAAE,OAAS,EAAE,OAAO,EAAE,IAAI,OAAO,EAAE,QAAQ,EAAI;AAAA,EACvD;AACD;AAKA,IAAO,iBAAQ;",
6
+ "names": ["coreStore"]
7
+ }
@@ -35,6 +35,7 @@ __export(fields_exports, {
35
35
  dateField: () => import_date.default,
36
36
  discussionField: () => import_discussion.default,
37
37
  featuredImageField: () => import_featured_image.default,
38
+ formatField: () => import_format.default,
38
39
  notesField: () => import_notes.default,
39
40
  orderField: () => import_order.default,
40
41
  pageTitleField: () => import_page_title.default,
@@ -42,6 +43,8 @@ __export(fields_exports, {
42
43
  passwordField: () => import_password.default,
43
44
  patternTitleField: () => import_pattern_title.default,
44
45
  pingStatusField: () => import_ping_status.default,
46
+ postContentInfoField: () => import_post_content_info.default,
47
+ scheduledDateField: () => import_scheduled.default,
45
48
  slugField: () => import_slug.default,
46
49
  statusField: () => import_status.default,
47
50
  templateField: () => import_template.default,
@@ -64,8 +67,11 @@ var import_comment_status = __toESM(require("./comment-status/index.cjs"));
64
67
  var import_ping_status = __toESM(require("./ping-status/index.cjs"));
65
68
  var import_discussion = __toESM(require("./discussion/index.cjs"));
66
69
  var import_date = __toESM(require("./date/index.cjs"));
70
+ var import_scheduled = __toESM(require("./date/scheduled/index.cjs"));
67
71
  var import_author = __toESM(require("./author/index.cjs"));
68
72
  var import_notes = __toESM(require("./notes/index.cjs"));
73
+ var import_format = __toESM(require("./format/index.cjs"));
74
+ var import_post_content_info = __toESM(require("./post-content-info/index.cjs"));
69
75
  // Annotate the CommonJS export names for ESM import in node:
70
76
  0 && (module.exports = {
71
77
  authorField,
@@ -73,6 +79,7 @@ var import_notes = __toESM(require("./notes/index.cjs"));
73
79
  dateField,
74
80
  discussionField,
75
81
  featuredImageField,
82
+ formatField,
76
83
  notesField,
77
84
  orderField,
78
85
  pageTitleField,
@@ -80,6 +87,8 @@ var import_notes = __toESM(require("./notes/index.cjs"));
80
87
  passwordField,
81
88
  patternTitleField,
82
89
  pingStatusField,
90
+ postContentInfoField,
91
+ scheduledDateField,
83
92
  slugField,
84
93
  statusField,
85
94
  templateField,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/fields/index.ts"],
4
- "sourcesContent": ["export { default as slugField } from './slug';\nexport { default as titleField } from './title';\nexport { default as pageTitleField } from './page-title';\nexport { default as templateTitleField } from './template-title';\nexport { default as patternTitleField } from './pattern-title';\nexport { default as orderField } from './order';\nexport { default as featuredImageField } from './featured-image';\nexport { default as templateField } from './template';\nexport { default as parentField } from './parent';\nexport { default as passwordField } from './password';\nexport { default as statusField } from './status';\nexport { default as commentStatusField } from './comment-status';\nexport { default as pingStatusField } from './ping-status';\nexport { default as discussionField } from './discussion';\nexport { default as dateField } from './date';\nexport { default as authorField } from './author';\nexport { default as notesField } from './notes';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqC;AACrC,mBAAsC;AACtC,wBAA0C;AAC1C,4BAA8C;AAC9C,2BAA6C;AAC7C,mBAAsC;AACtC,4BAA8C;AAC9C,sBAAyC;AACzC,oBAAuC;AACvC,sBAAyC;AACzC,oBAAuC;AACvC,4BAA8C;AAC9C,yBAA2C;AAC3C,wBAA2C;AAC3C,kBAAqC;AACrC,oBAAuC;AACvC,mBAAsC;",
4
+ "sourcesContent": ["export { default as slugField } from './slug';\nexport { default as titleField } from './title';\nexport { default as pageTitleField } from './page-title';\nexport { default as templateTitleField } from './template-title';\nexport { default as patternTitleField } from './pattern-title';\nexport { default as orderField } from './order';\nexport { default as featuredImageField } from './featured-image';\nexport { default as templateField } from './template';\nexport { default as parentField } from './parent';\nexport { default as passwordField } from './password';\nexport { default as statusField } from './status';\nexport { default as commentStatusField } from './comment-status';\nexport { default as pingStatusField } from './ping-status';\nexport { default as discussionField } from './discussion';\nexport { default as dateField } from './date';\nexport { default as scheduledDateField } from './date/scheduled';\nexport { default as authorField } from './author';\nexport { default as notesField } from './notes';\nexport { default as formatField } from './format';\nexport { default as postContentInfoField } from './post-content-info';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqC;AACrC,mBAAsC;AACtC,wBAA0C;AAC1C,4BAA8C;AAC9C,2BAA6C;AAC7C,mBAAsC;AACtC,4BAA8C;AAC9C,sBAAyC;AACzC,oBAAuC;AACvC,sBAAyC;AACzC,oBAAuC;AACvC,4BAA8C;AAC9C,yBAA2C;AAC3C,wBAA2C;AAC3C,kBAAqC;AACrC,uBAA8C;AAC9C,oBAAuC;AACvC,mBAAsC;AACtC,oBAAuC;AACvC,+BAAgD;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,49 @@
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/post-content-info/index.ts
31
+ var post_content_info_exports = {};
32
+ __export(post_content_info_exports, {
33
+ default: () => post_content_info_default
34
+ });
35
+ module.exports = __toCommonJS(post_content_info_exports);
36
+ var import_i18n = require("@wordpress/i18n");
37
+ var import_post_content_info_view = __toESM(require("./post-content-info-view.cjs"));
38
+ var postContentInfoField = {
39
+ label: (0, import_i18n.__)("Post content information"),
40
+ id: "post-content-info",
41
+ type: "text",
42
+ readOnly: true,
43
+ render: import_post_content_info_view.default,
44
+ enableSorting: false,
45
+ enableHiding: false,
46
+ filterBy: false
47
+ };
48
+ var post_content_info_default = postContentInfoField;
49
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/fields/post-content-info/index.ts"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport PostContentInfoView from './post-content-info-view';\n\nconst postContentInfoField: Field< BasePost > = {\n\tlabel: __( 'Post content information' ),\n\tid: 'post-content-info',\n\ttype: 'text',\n\treadOnly: true,\n\trender: PostContentInfoView,\n\tenableSorting: false,\n\tenableHiding: false,\n\tfilterBy: false,\n};\n\n/**\n * Post content information field for BasePost.\n */\nexport default postContentInfoField;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmB;AAMnB,oCAAgC;AAEhC,IAAM,uBAA0C;AAAA,EAC/C,WAAO,gBAAI,0BAA2B;AAAA,EACtC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,8BAAAA;AAAA,EACR,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAU;AACX;AAKA,IAAO,4BAAQ;",
6
+ "names": ["PostContentInfoView"]
7
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/fields/src/fields/post-content-info/post-content-info-view.tsx
21
+ var post_content_info_view_exports = {};
22
+ __export(post_content_info_view_exports, {
23
+ default: () => PostContentInfoView
24
+ });
25
+ module.exports = __toCommonJS(post_content_info_view_exports);
26
+ var import_components = require("@wordpress/components");
27
+ var import_i18n = require("@wordpress/i18n");
28
+ var import_wordcount = require("@wordpress/wordcount");
29
+ var import_date = require("@wordpress/date");
30
+ var import_element = require("@wordpress/element");
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ var AVERAGE_READING_RATE = 189;
33
+ function PostContentInfoView({ item }) {
34
+ const content = typeof item.content === "string" ? item.content : item.content?.raw || "";
35
+ const wordCountType = (0, import_i18n._x)(
36
+ "words",
37
+ "Word count type. Do not translate!"
38
+ );
39
+ const wordsCounted = (0, import_element.useMemo)(
40
+ () => content ? (0, import_wordcount.count)(content, wordCountType) : 0,
41
+ [content, wordCountType]
42
+ );
43
+ const modified = item.modified;
44
+ if (!wordsCounted && !modified) {
45
+ return null;
46
+ }
47
+ let contentInfoText;
48
+ if (wordsCounted) {
49
+ const readingTime = Math.round(wordsCounted / AVERAGE_READING_RATE);
50
+ const wordsCountText = (0, import_i18n.sprintf)(
51
+ // translators: %s: the number of words in the post.
52
+ (0, import_i18n._n)("%s word", "%s words", wordsCounted),
53
+ wordsCounted.toLocaleString()
54
+ );
55
+ const minutesText = readingTime <= 1 ? (0, import_i18n.__)("1 minute") : (0, import_i18n.sprintf)(
56
+ /* translators: %s: the number of minutes to read the post. */
57
+ (0, import_i18n._n)("%s minute", "%s minutes", readingTime),
58
+ readingTime.toLocaleString()
59
+ );
60
+ contentInfoText = (0, import_i18n.sprintf)(
61
+ /* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */
62
+ (0, import_i18n.__)("%1$s, %2$s read time."),
63
+ wordsCountText,
64
+ minutesText
65
+ );
66
+ }
67
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: 1, children: [
68
+ contentInfoText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { variant: "muted", children: contentInfoText }),
69
+ modified && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { variant: "muted", children: (0, import_i18n.sprintf)(
70
+ // translators: %s: Human-readable time difference, e.g. "2 days ago".
71
+ (0, import_i18n.__)("Last edited %s."),
72
+ (0, import_date.humanTimeDiff)(modified)
73
+ ) })
74
+ ] });
75
+ }
76
+ //# sourceMappingURL=post-content-info-view.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/fields/post-content-info/post-content-info-view.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport type { Strategy } from '@wordpress/wordcount';\nimport { humanTimeDiff } from '@wordpress/date';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\nexport default function PostContentInfoView( { item }: { item: BasePost } ) {\n\tconst content =\n\t\ttypeof item.content === 'string'\n\t\t\t? item.content\n\t\t\t: item.content?.raw || '';\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x(\n\t\t'words',\n\t\t'Word count type. Do not translate!'\n\t) as Strategy;\n\tconst wordsCounted = useMemo(\n\t\t() => ( content ? wordCount( content, wordCountType ) : 0 ),\n\t\t[ content, wordCountType ]\n\t);\n\n\tconst modified = item.modified;\n\n\tif ( ! wordsCounted && ! modified ) {\n\t\treturn null;\n\t}\n\n\tlet contentInfoText: string | undefined;\n\tif ( wordsCounted ) {\n\t\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\t\tconst wordsCountText = sprintf(\n\t\t\t// translators: %s: the number of words in the post.\n\t\t\t_n( '%s word', '%s words', wordsCounted ),\n\t\t\twordsCounted.toLocaleString()\n\t\t);\n\t\tconst minutesText =\n\t\t\treadingTime <= 1\n\t\t\t\t? __( '1 minute' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: the number of minutes to read the post. */\n\t\t\t\t\t\t_n( '%s minute', '%s minutes', readingTime ),\n\t\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t\t );\n\t\tcontentInfoText = sprintf(\n\t\t\t/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */\n\t\t\t__( '%1$s, %2$s read time.' ),\n\t\t\twordsCountText,\n\t\t\tminutesText\n\t\t);\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 1 }>\n\t\t\t{ contentInfoText && (\n\t\t\t\t<Text variant=\"muted\">{ contentInfoText }</Text>\n\t\t\t) }\n\t\t\t{ modified && (\n\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t// translators: %s: Human-readable time difference, e.g. \"2 days ago\".\n\t\t\t\t\t\t__( 'Last edited %s.' ),\n\t\t\t\t\t\thumanTimeDiff( modified )\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,kBAAoC;AACpC,uBAAmC;AAEnC,kBAA8B;AAC9B,qBAAwB;AA6DtB;AArDF,IAAM,uBAAuB;AAEd,SAAR,oBAAsC,EAAE,KAAK,GAAwB;AAC3E,QAAM,UACL,OAAO,KAAK,YAAY,WACrB,KAAK,UACL,KAAK,SAAS,OAAO;AAOzB,QAAM,oBAAgB;AAAA,IACrB;AAAA,IACA;AAAA,EACD;AACA,QAAM,mBAAe;AAAA,IACpB,MAAQ,cAAU,iBAAAA,OAAW,SAAS,aAAc,IAAI;AAAA,IACxD,CAAE,SAAS,aAAc;AAAA,EAC1B;AAEA,QAAM,WAAW,KAAK;AAEtB,MAAK,CAAE,gBAAgB,CAAE,UAAW;AACnC,WAAO;AAAA,EACR;AAEA,MAAI;AACJ,MAAK,cAAe;AACnB,UAAM,cAAc,KAAK,MAAO,eAAe,oBAAqB;AACpE,UAAM,qBAAiB;AAAA;AAAA,UAEtB,gBAAI,WAAW,YAAY,YAAa;AAAA,MACxC,aAAa,eAAe;AAAA,IAC7B;AACA,UAAM,cACL,eAAe,QACZ,gBAAI,UAAW,QACf;AAAA;AAAA,UAEA,gBAAI,aAAa,cAAc,WAAY;AAAA,MAC3C,YAAY,eAAe;AAAA,IAC3B;AACJ,0BAAkB;AAAA;AAAA,UAEjB,gBAAI,uBAAwB;AAAA,MAC5B;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,SACC,6CAAC,kBAAAC,sBAAA,EAAO,SAAU,GACf;AAAA,uBACD,4CAAC,kBAAAC,oBAAA,EAAK,SAAQ,SAAU,2BAAiB;AAAA,IAExC,YACD,4CAAC,kBAAAA,oBAAA,EAAK,SAAQ,SACX;AAAA;AAAA,UAED,gBAAI,iBAAkB;AAAA,UACtB,2BAAe,QAAS;AAAA,IACzB,GACD;AAAA,KAEF;AAEF;",
6
+ "names": ["wordCount", "VStack", "Text"]
7
+ }
@@ -41,7 +41,7 @@ function StatusView({ item }) {
41
41
  const label = status?.label || item.status;
42
42
  const icon = status?.icon;
43
43
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { alignment: "left", spacing: 0, children: [
44
- icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "edit-site-post-list__status-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Icon, { icon }) }),
44
+ icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "fields-controls__status-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Icon, { icon }) }),
45
45
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: label })
46
46
  ] });
47
47
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/fields/status/status-view.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport STATUSES from './status-elements';\n\nfunction StatusView( { item }: { item: BasePost } ) {\n\tconst status = STATUSES.find( ( { value } ) => value === item.status );\n\tconst label = status?.label || item.status;\n\tconst icon = status?.icon;\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ icon && (\n\t\t\t\t<div className=\"edit-site-post-list__status-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span>{ label }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default StatusView;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqD;AAMrD,6BAAqB;AAOnB;AALF,SAAS,WAAY,EAAE,KAAK,GAAwB;AACnD,QAAM,SAAS,uBAAAA,QAAS,KAAM,CAAE,EAAE,MAAM,MAAO,UAAU,KAAK,MAAO;AACrE,QAAM,QAAQ,QAAQ,SAAS,KAAK;AACpC,QAAM,OAAO,QAAQ;AACrB,SACC,6CAAC,kBAAAC,sBAAA,EAAO,WAAU,QAAO,SAAU,GAChC;AAAA,YACD,4CAAC,SAAI,WAAU,oCACd,sDAAC,0BAAK,MAAc,GACrB;AAAA,IAED,4CAAC,UAAO,iBAAO;AAAA,KAChB;AAEF;AAEA,IAAO,sBAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport STATUSES from './status-elements';\n\nfunction StatusView( { item }: { item: BasePost } ) {\n\tconst status = STATUSES.find( ( { value } ) => value === item.status );\n\tconst label = status?.label || item.status;\n\tconst icon = status?.icon;\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ icon && (\n\t\t\t\t<div className=\"fields-controls__status-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span>{ label }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default StatusView;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqD;AAMrD,6BAAqB;AAOnB;AALF,SAAS,WAAY,EAAE,KAAK,GAAwB;AACnD,QAAM,SAAS,uBAAAA,QAAS,KAAM,CAAE,EAAE,MAAM,MAAO,UAAU,KAAK,MAAO;AACrE,QAAM,QAAQ,QAAQ,SAAS,KAAK;AACpC,QAAM,OAAO,QAAQ;AACrB,SACC,6CAAC,kBAAAC,sBAAA,EAAO,WAAU,QAAO,SAAU,GAChC;AAAA,YACD,4CAAC,SAAI,WAAU,gCACd,sDAAC,0BAAK,MAAc,GACrB;AAAA,IAED,4CAAC,UAAO,iBAAO;AAAA,KAChB;AAEF;AAEA,IAAO,sBAAQ;",
6
6
  "names": ["STATUSES", "HStack"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/types.ts"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { DataFormControlProps } from '@wordpress/dataviews';\n\ntype PostStatus =\n\t| 'publish'\n\t| 'draft'\n\t| 'pending'\n\t| 'private'\n\t| 'future'\n\t| 'auto-draft'\n\t| 'trash';\n\nexport interface CommonPost {\n\tstatus?: PostStatus;\n\ttitle: string | { rendered: string } | { raw: string };\n\tcontent: string | { raw: string; rendered: string };\n\ttype: string;\n\tid: string | number;\n\tblocks?: Object[];\n\t_links?: Links;\n}\n\ninterface Links {\n\t'predecessor-version'?: { href: string; id: number }[];\n\t'version-history'?: { href: string; count: number }[];\n\t[ key: string ]: { href: string }[] | undefined;\n}\n\ninterface Author {\n\tid: number;\n\tname: string;\n\tavatar_urls: Record< string, string >;\n}\n\ninterface EmbeddedAuthor {\n\tauthor: Author[];\n}\n\n/**\n * BasePost interface used for all post types.\n */\nexport interface BasePost extends CommonPost {\n\tcomment_status?: 'open' | 'closed';\n\texcerpt?: string | { raw: string; rendered: string };\n\tmeta?: Record< string, any >;\n\tparent?: number;\n\tpassword?: string;\n\ttemplate?: string;\n\tformat?: string;\n\tfeatured_media?: number;\n\tmenu_order?: number;\n\tping_status?: 'open' | 'closed';\n\tlink?: string;\n\tslug?: string;\n\tpermalink_template?: string;\n\tdate?: string;\n\tmodified?: string;\n\tauthor?: number;\n}\n\nexport interface BasePostWithEmbeddedAuthor extends BasePost {\n\t_embedded: EmbeddedAuthor;\n}\n\ninterface FeaturedMedia {\n\ttitle: {\n\t\trendered: string;\n\t};\n\tsource_url: string;\n\tmedia_details: {\n\t\tsizes: Record< string, { width: number; source_url: string } >;\n\t};\n}\n\ninterface EmbeddedFeaturedMedia {\n\t'wp:featuredmedia': FeaturedMedia[];\n}\n\nexport interface BasePostWithEmbeddedFeaturedMedia extends BasePost {\n\t_embedded: EmbeddedFeaturedMedia;\n}\n\nexport interface Template extends CommonPost {\n\ttype: 'wp_template';\n\tis_custom: boolean;\n\tsource: string;\n\torigin: string;\n\tplugin?: string;\n\thas_theme_file: boolean;\n\tid: string;\n}\n\nexport interface TemplatePart extends CommonPost {\n\ttype: 'wp_template_part';\n\tsource: string;\n\torigin: string;\n\thas_theme_file: boolean;\n\tid: string;\n\tarea: string;\n\tplugin?: string;\n}\n\nexport interface Pattern extends CommonPost {\n\tslug: string;\n\ttitle: { raw: string };\n\twp_pattern_sync_status: string;\n}\n\nexport type Post = Template | TemplatePart | Pattern | BasePost;\n\nexport type PostWithPermissions = Post & {\n\tpermissions: {\n\t\tdelete: boolean;\n\t\tupdate: boolean;\n\t};\n};\n\ninterface EditorSupport {\n\tnotes?: boolean;\n}\n\nexport interface PostType {\n\tslug: string;\n\tviewable: boolean;\n\tsupports?: {\n\t\t'page-attributes'?: boolean;\n\t\ttitle?: boolean;\n\t\trevisions?: boolean;\n\t\tauthor?: string;\n\t\tthumbnail?: string;\n\t\tcomments?: string;\n\t\teditor?: boolean | [ EditorSupport ];\n\t\ttrackbacks?: boolean;\n\t};\n}\n\n// Will be unnecessary after typescript 5.0 upgrade.\nexport type CoreDataError = { message?: string; code?: string };\n\nexport interface MediaEditProps< Item >\n\textends Pick<\n\t\tDataFormControlProps< Item >,\n\t\t'data' | 'field' | 'onChange' | 'hideLabelFromVision' | 'validity'\n\t> {\n\t/**\n\t * Array of allowed media types (e.g., ['image', 'video']).\n\t *\n\t * @default ['image']\n\t */\n\tallowedTypes?: string[];\n\t/**\n\t * Whether to allow multiple media selections.\n\t *\n\t * @default false\n\t */\n\tmultiple?: boolean;\n\t/**\n\t * Whether to render in an expanded form.\n\t *\n\t * @default false\n\t */\n\tisExpanded?: boolean;\n}\n"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { DataFormControlProps } from '@wordpress/dataviews';\n\ntype PostStatus =\n\t| 'publish'\n\t| 'draft'\n\t| 'pending'\n\t| 'private'\n\t| 'future'\n\t| 'auto-draft'\n\t| 'trash';\n\nexport interface CommonPost {\n\tstatus?: PostStatus;\n\ttitle: string | { rendered: string } | { raw: string };\n\tcontent: string | { raw: string; rendered: string };\n\ttype: string;\n\tid: string | number;\n\tblocks?: Object[];\n\t_links?: Links;\n}\n\ninterface Links {\n\t'predecessor-version'?: { href: string; id: number }[];\n\t'version-history'?: { href: string; count: number }[];\n\t[ key: string ]: { href: string }[] | undefined;\n}\n\ninterface Author {\n\tid: number;\n\tname: string;\n\tavatar_urls: Record< string, string >;\n}\n\ninterface EmbeddedAuthor {\n\tauthor: Author[];\n}\n\n/**\n * BasePost interface used for all post types.\n */\nexport interface BasePost extends CommonPost {\n\tcomment_status?: 'open' | 'closed';\n\texcerpt?: string | { raw: string; rendered: string };\n\tmeta?: Record< string, any >;\n\tparent?: number;\n\tpassword?: string;\n\ttemplate?: string;\n\tformat?: string;\n\tfeatured_media?: number;\n\tmenu_order?: number;\n\tping_status?: 'open' | 'closed';\n\tlink?: string;\n\tslug?: string;\n\tpermalink_template?: string;\n\tdate?: string;\n\tmodified?: string;\n\tauthor?: number;\n}\n\nexport interface BasePostWithEmbeddedAuthor extends BasePost {\n\t_embedded: EmbeddedAuthor;\n}\n\ninterface FeaturedMedia {\n\ttitle: {\n\t\trendered: string;\n\t};\n\tsource_url: string;\n\tmedia_details: {\n\t\tsizes: Record< string, { width: number; source_url: string } >;\n\t};\n}\n\ninterface EmbeddedFeaturedMedia {\n\t'wp:featuredmedia': FeaturedMedia[];\n}\n\nexport interface BasePostWithEmbeddedFeaturedMedia extends BasePost {\n\t_embedded: EmbeddedFeaturedMedia;\n}\n\nexport interface Template extends CommonPost {\n\ttype: 'wp_template';\n\tis_custom: boolean;\n\tsource: string;\n\torigin: string;\n\tplugin?: string;\n\thas_theme_file: boolean;\n\tid: string;\n}\n\nexport interface TemplatePart extends CommonPost {\n\ttype: 'wp_template_part';\n\tsource: string;\n\torigin: string;\n\thas_theme_file: boolean;\n\tid: string;\n\tarea: string;\n\tplugin?: string;\n}\n\nexport interface Pattern extends CommonPost {\n\tslug: string;\n\ttitle: { raw: string };\n\twp_pattern_sync_status: string;\n}\n\nexport type Post = Template | TemplatePart | Pattern | BasePost;\n\nexport type PostWithPermissions = Post & {\n\tpermissions: {\n\t\tdelete: boolean;\n\t\tupdate: boolean;\n\t};\n};\n\ninterface EditorSupport {\n\tnotes?: boolean;\n}\n\nexport interface PostType {\n\tslug: string;\n\tviewable: boolean;\n\tsupports?: {\n\t\t'page-attributes'?: boolean;\n\t\ttitle?: boolean;\n\t\trevisions?: boolean;\n\t\tauthor?: string;\n\t\tthumbnail?: string;\n\t\tcomments?: string;\n\t\teditor?: boolean | [ EditorSupport ];\n\t\ttrackbacks?: boolean;\n\t\t'post-formats'?: boolean;\n\t};\n}\n\n// Will be unnecessary after typescript 5.0 upgrade.\nexport type CoreDataError = { message?: string; code?: string };\n\nexport interface MediaEditProps< Item >\n\textends Pick<\n\t\tDataFormControlProps< Item >,\n\t\t'data' | 'field' | 'onChange' | 'hideLabelFromVision' | 'validity'\n\t> {\n\t/**\n\t * Array of allowed media types (e.g., ['image', 'video']).\n\t *\n\t * @default ['image']\n\t */\n\tallowedTypes?: string[];\n\t/**\n\t * Whether to allow multiple media selections.\n\t *\n\t * @default false\n\t */\n\tmultiple?: boolean;\n\t/**\n\t * Whether to render in an expanded form.\n\t *\n\t * @default false\n\t */\n\tisExpanded?: boolean;\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -11,7 +11,7 @@ function AuthorView({ item }) {
11
11
  const authorId = item?.author;
12
12
  const embeddedAuthorId = item?._embedded?.author?.[0]?.id;
13
13
  const shouldFetch = Boolean(
14
- authorId && embeddedAuthorId && authorId !== embeddedAuthorId
14
+ authorId && (!embeddedAuthorId || authorId !== embeddedAuthorId)
15
15
  );
16
16
  const author = useSelect(
17
17
  (select) => {
@@ -30,7 +30,7 @@ function AuthorView({ item }) {
30
30
  !!imageUrl && /* @__PURE__ */ jsx(
31
31
  "div",
32
32
  {
33
- className: clsx("page-templates-author-field__avatar", {
33
+ className: clsx("fields-controls__author-avatar", {
34
34
  "is-loaded": isImageLoaded
35
35
  }),
36
36
  children: /* @__PURE__ */ jsx(
@@ -43,8 +43,8 @@ function AuthorView({ item }) {
43
43
  )
44
44
  }
45
45
  ),
46
- !imageUrl && /* @__PURE__ */ jsx("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ jsx(Icon, { icon: authorIcon }) }),
47
- /* @__PURE__ */ jsx("span", { className: "page-templates-author-field__name", children: text })
46
+ !imageUrl && /* @__PURE__ */ jsx("div", { className: "fields-controls__author-icon", children: /* @__PURE__ */ jsx(Icon, { icon: authorIcon }) }),
47
+ /* @__PURE__ */ jsx("span", { className: "fields-controls__author-name", children: text })
48
48
  ] });
49
49
  }
50
50
  var author_view_default = AuthorView;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/fields/author/author-view.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { commentAuthorAvatar as authorIcon } from '@wordpress/icons';\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedAuthor } from '../../types';\n\nfunction AuthorView( { item }: { item: BasePostWithEmbeddedAuthor } ) {\n\t// When editing, item.author may differ from _embedded.author (which preserves\n\t// the saved record). Fetch the updated author only when they differ, so the\n\t// view reflects edits while lists preserve original data.\n\tconst authorId = item?.author;\n\tconst embeddedAuthorId = item?._embedded?.author?.[ 0 ]?.id;\n\tconst shouldFetch = Boolean(\n\t\tauthorId && embeddedAuthorId && authorId !== embeddedAuthorId\n\t);\n\tconst author = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! shouldFetch ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\t// This doesn't make extra REST requests because the records are\n\t\t\t// already in the store from the field's getElements function.\n\t\t\treturn authorId\n\t\t\t\t? getEntityRecord( 'root', 'user', authorId )\n\t\t\t\t: null;\n\t\t},\n\t\t[ authorId, shouldFetch ]\n\t);\n\t// Use fetched author if available, otherwise use _embedded.\n\tconst text = author?.name || item?._embedded?.author?.[ 0 ]?.name;\n\tconst imageUrl =\n\t\tauthor?.avatar_urls?.[ 48 ] ||\n\t\titem?._embedded?.author?.[ 0 ]?.avatar_urls?.[ 48 ];\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ !! imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt={ __( 'Author avatar' ) }\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ authorIcon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default AuthorView;\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB,kBAAkB;AAClD,SAAS,wBAAwB,QAAQ,YAAY;AACrD,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AAqCjC,SAOG,KAPH;AA9BF,SAAS,WAAY,EAAE,KAAK,GAA0C;AAIrE,QAAM,WAAW,MAAM;AACvB,QAAM,mBAAmB,MAAM,WAAW,SAAU,CAAE,GAAG;AACzD,QAAM,cAAc;AAAA,IACnB,YAAY,oBAAoB,aAAa;AAAA,EAC9C;AACA,QAAM,SAAS;AAAA,IACd,CAAE,WAAY;AACb,UAAK,CAAE,aAAc;AACpB,eAAO;AAAA,MACR;AACA,YAAM,EAAE,gBAAgB,IAAI,OAAQ,SAAU;AAG9C,aAAO,WACJ,gBAAiB,QAAQ,QAAQ,QAAS,IAC1C;AAAA,IACJ;AAAA,IACA,CAAE,UAAU,WAAY;AAAA,EACzB;AAEA,QAAM,OAAO,QAAQ,QAAQ,MAAM,WAAW,SAAU,CAAE,GAAG;AAC7D,QAAM,WACL,QAAQ,cAAe,EAAG,KAC1B,MAAM,WAAW,SAAU,CAAE,GAAG,cAAe,EAAG;AACnD,QAAM,CAAE,eAAe,gBAAiB,IAAI,SAAU,KAAM;AAC5D,SACC,qBAAC,UAAO,WAAU,QAAO,SAAU,GAChC;AAAA,KAAC,CAAE,YACJ;AAAA,MAAC;AAAA;AAAA,QACA,WAAY,KAAM,uCAAuC;AAAA,UACxD,aAAa;AAAA,QACd,CAAE;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACA,QAAS,MAAM,iBAAkB,IAAK;AAAA,YACtC,KAAM,GAAI,eAAgB;AAAA,YAC1B,KAAM;AAAA;AAAA,QACP;AAAA;AAAA,IACD;AAAA,IAEC,CAAE,YACH,oBAAC,SAAI,WAAU,qCACd,8BAAC,QAAK,MAAO,YAAa,GAC3B;AAAA,IAED,oBAAC,UAAK,WAAU,qCAAsC,gBAAM;AAAA,KAC7D;AAEF;AAEA,IAAO,sBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { commentAuthorAvatar as authorIcon } from '@wordpress/icons';\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedAuthor } from '../../types';\n\nfunction AuthorView( { item }: { item: BasePostWithEmbeddedAuthor } ) {\n\t// Fetch the author record from the store when _embedded data is unavailable\n\t// (e.g. in the post editor inspector) or when the author has been changed\n\t// during editing (item.author differs from _embedded.author).\n\tconst authorId = item?.author;\n\tconst embeddedAuthorId = item?._embedded?.author?.[ 0 ]?.id;\n\tconst shouldFetch = Boolean(\n\t\tauthorId && ( ! embeddedAuthorId || authorId !== embeddedAuthorId )\n\t);\n\tconst author = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! shouldFetch ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\t// This doesn't make extra REST requests because the records are\n\t\t\t// already in the store from the field's getElements function.\n\t\t\treturn authorId\n\t\t\t\t? getEntityRecord( 'root', 'user', authorId )\n\t\t\t\t: null;\n\t\t},\n\t\t[ authorId, shouldFetch ]\n\t);\n\t// Use fetched author if available, otherwise use _embedded.\n\tconst text = author?.name || item?._embedded?.author?.[ 0 ]?.name;\n\tconst imageUrl =\n\t\tauthor?.avatar_urls?.[ 48 ] ||\n\t\titem?._embedded?.author?.[ 0 ]?.avatar_urls?.[ 48 ];\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ !! imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'fields-controls__author-avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt={ __( 'Author avatar' ) }\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"fields-controls__author-icon\">\n\t\t\t\t\t<Icon icon={ authorIcon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"fields-controls__author-name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default AuthorView;\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB,kBAAkB;AAClD,SAAS,wBAAwB,QAAQ,YAAY;AACrD,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AAqCjC,SAOG,KAPH;AA9BF,SAAS,WAAY,EAAE,KAAK,GAA0C;AAIrE,QAAM,WAAW,MAAM;AACvB,QAAM,mBAAmB,MAAM,WAAW,SAAU,CAAE,GAAG;AACzD,QAAM,cAAc;AAAA,IACnB,aAAc,CAAE,oBAAoB,aAAa;AAAA,EAClD;AACA,QAAM,SAAS;AAAA,IACd,CAAE,WAAY;AACb,UAAK,CAAE,aAAc;AACpB,eAAO;AAAA,MACR;AACA,YAAM,EAAE,gBAAgB,IAAI,OAAQ,SAAU;AAG9C,aAAO,WACJ,gBAAiB,QAAQ,QAAQ,QAAS,IAC1C;AAAA,IACJ;AAAA,IACA,CAAE,UAAU,WAAY;AAAA,EACzB;AAEA,QAAM,OAAO,QAAQ,QAAQ,MAAM,WAAW,SAAU,CAAE,GAAG;AAC7D,QAAM,WACL,QAAQ,cAAe,EAAG,KAC1B,MAAM,WAAW,SAAU,CAAE,GAAG,cAAe,EAAG;AACnD,QAAM,CAAE,eAAe,gBAAiB,IAAI,SAAU,KAAM;AAC5D,SACC,qBAAC,UAAO,WAAU,QAAO,SAAU,GAChC;AAAA,KAAC,CAAE,YACJ;AAAA,MAAC;AAAA;AAAA,QACA,WAAY,KAAM,kCAAkC;AAAA,UACnD,aAAa;AAAA,QACd,CAAE;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACA,QAAS,MAAM,iBAAkB,IAAK;AAAA,YACtC,KAAM,GAAI,eAAgB;AAAA,YAC1B,KAAM;AAAA;AAAA,QACP;AAAA;AAAA,IACD;AAAA,IAEC,CAAE,YACH,oBAAC,SAAI,WAAU,gCACd,8BAAC,QAAK,MAAO,YAAa,GAC3B;AAAA,IAED,oBAAC,UAAK,WAAU,gCAAiC,gBAAM;AAAA,KACxD;AAEF;AAEA,IAAO,sBAAQ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,18 @@
1
+ // packages/fields/src/fields/date/scheduled/index.tsx
2
+ import { __ } from "@wordpress/i18n";
3
+ var scheduledDateField = {
4
+ id: "scheduled_date",
5
+ type: "datetime",
6
+ label: __("Scheduled Date"),
7
+ getValue: ({ item }) => item.date,
8
+ setValue: ({ value }) => ({ date: value }),
9
+ isVisible: (item) => item.status === "future",
10
+ enableHiding: false,
11
+ enableSorting: false,
12
+ filterBy: false
13
+ };
14
+ var scheduled_default = scheduledDateField;
15
+ export {
16
+ scheduled_default as default
17
+ };
18
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/fields/date/scheduled/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 type { BasePost } from '../../../types';\n\nconst scheduledDateField: Field< BasePost > = {\n\tid: 'scheduled_date',\n\ttype: 'datetime',\n\tlabel: __( 'Scheduled Date' ),\n\tgetValue: ( { item } ) => item.date,\n\tsetValue: ( { value } ) => ( { date: value } ),\n\tisVisible: ( item ) => item.status === 'future',\n\tenableHiding: false,\n\tenableSorting: false,\n\tfilterBy: false,\n};\n\n/**\n * ScheduledDate Field.\n */\nexport default scheduledDateField;\n"],
5
+ "mappings": ";AAIA,SAAS,UAAU;AAOnB,IAAM,qBAAwC;AAAA,EAC7C,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,gBAAiB;AAAA,EAC5B,UAAU,CAAE,EAAE,KAAK,MAAO,KAAK;AAAA,EAC/B,UAAU,CAAE,EAAE,MAAM,OAAS,EAAE,MAAM,MAAM;AAAA,EAC3C,WAAW,CAAE,SAAU,KAAK,WAAW;AAAA,EACvC,cAAc;AAAA,EACd,eAAe;AAAA,EACf,UAAU;AACX;AAKA,IAAO,oBAAQ;",
6
+ "names": []
7
+ }
@@ -7,6 +7,7 @@ var featuredImageField = {
7
7
  id: "featured_media",
8
8
  type: "media",
9
9
  label: __("Featured Image"),
10
+ placeholder: __("Set featured image"),
10
11
  Edit: (props) => /* @__PURE__ */ jsx(MediaEdit, { ...props, isExpanded: true }),
11
12
  render: FeaturedImageView,
12
13
  setValue: ({ value }) => ({