@wordpress/fields 0.31.1-next.v.202602111440.0 → 0.32.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 (76) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +1 -1
  3. package/build/actions/duplicate-post.cjs.map +1 -1
  4. package/build/actions/reorder-page.cjs.map +1 -1
  5. package/build/components/create-template-part-modal/index.cjs +2 -5
  6. package/build/components/create-template-part-modal/index.cjs.map +3 -3
  7. package/build/components/media-edit/index.cjs +372 -157
  8. package/build/components/media-edit/index.cjs.map +3 -3
  9. package/build/components/media-edit/use-moving-animation.cjs +75 -0
  10. package/build/components/media-edit/use-moving-animation.cjs.map +7 -0
  11. package/build/fields/featured-image/index.cjs +2 -1
  12. package/build/fields/featured-image/index.cjs.map +2 -2
  13. package/build/fields/template/hooks.cjs +96 -0
  14. package/build/fields/template/hooks.cjs.map +7 -0
  15. package/build/fields/template/index.cjs +2 -0
  16. package/build/fields/template/index.cjs.map +2 -2
  17. package/build/fields/template/template-edit.cjs +33 -114
  18. package/build/fields/template/template-edit.cjs.map +3 -3
  19. package/build/fields/template/template-view.cjs +68 -0
  20. package/build/fields/template/template-view.cjs.map +7 -0
  21. package/build/fields/template/utils.cjs +91 -0
  22. package/build/fields/template/utils.cjs.map +7 -0
  23. package/build-module/actions/duplicate-post.mjs.map +1 -1
  24. package/build-module/actions/reorder-page.mjs.map +1 -1
  25. package/build-module/components/create-template-part-modal/index.mjs +3 -6
  26. package/build-module/components/create-template-part-modal/index.mjs.map +2 -2
  27. package/build-module/components/media-edit/index.mjs +379 -159
  28. package/build-module/components/media-edit/index.mjs.map +2 -2
  29. package/build-module/components/media-edit/use-moving-animation.mjs +54 -0
  30. package/build-module/components/media-edit/use-moving-animation.mjs.map +7 -0
  31. package/build-module/fields/featured-image/index.mjs +2 -1
  32. package/build-module/fields/featured-image/index.mjs.map +2 -2
  33. package/build-module/fields/template/hooks.mjs +71 -0
  34. package/build-module/fields/template/hooks.mjs.map +7 -0
  35. package/build-module/fields/template/index.mjs +2 -0
  36. package/build-module/fields/template/index.mjs.map +2 -2
  37. package/build-module/fields/template/template-edit.mjs +36 -123
  38. package/build-module/fields/template/template-edit.mjs.map +2 -2
  39. package/build-module/fields/template/template-view.mjs +43 -0
  40. package/build-module/fields/template/template-view.mjs.map +7 -0
  41. package/build-module/fields/template/utils.mjs +65 -0
  42. package/build-module/fields/template/utils.mjs.map +7 -0
  43. package/build-style/style-rtl.css +69 -61
  44. package/build-style/style.css +69 -61
  45. package/build-types/actions/duplicate-post.d.ts +1 -1
  46. package/build-types/actions/duplicate-post.d.ts.map +1 -1
  47. package/build-types/actions/reorder-page.d.ts +1 -1
  48. package/build-types/actions/reorder-page.d.ts.map +1 -1
  49. package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
  50. package/build-types/components/media-edit/index.d.ts +1 -1
  51. package/build-types/components/media-edit/index.d.ts.map +1 -1
  52. package/build-types/components/media-edit/use-moving-animation.d.ts +13 -0
  53. package/build-types/components/media-edit/use-moving-animation.d.ts.map +1 -0
  54. package/build-types/fields/template/hooks.d.ts +10 -0
  55. package/build-types/fields/template/hooks.d.ts.map +1 -0
  56. package/build-types/fields/template/index.d.ts.map +1 -1
  57. package/build-types/fields/template/template-edit.d.ts.map +1 -1
  58. package/build-types/fields/template/template-view.d.ts +4 -0
  59. package/build-types/fields/template/template-view.d.ts.map +1 -0
  60. package/build-types/fields/template/utils.d.ts +28 -0
  61. package/build-types/fields/template/utils.d.ts.map +1 -0
  62. package/package.json +27 -26
  63. package/src/actions/duplicate-post.tsx +1 -1
  64. package/src/actions/reorder-page.tsx +1 -1
  65. package/src/components/create-template-part-modal/index.tsx +5 -14
  66. package/src/components/media-edit/index.tsx +420 -163
  67. package/src/components/media-edit/style.scss +83 -30
  68. package/src/components/media-edit/use-moving-animation.ts +77 -0
  69. package/src/fields/featured-image/index.tsx +1 -1
  70. package/src/fields/template/hooks.ts +121 -0
  71. package/src/fields/template/index.ts +2 -0
  72. package/src/fields/template/template-edit.tsx +38 -149
  73. package/src/fields/template/template-view.tsx +52 -0
  74. package/src/fields/template/utils.ts +119 -0
  75. package/src/style.scss +0 -1
  76. package/src/fields/template/style.scss +0 -34
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/template/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAMlD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,QAAA,MAAM,aAAa,EAAE,KAAK,CAAE,QAAQ,CAOnC,CAAC;AAEF;;GAEG;AACH,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/template/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAMlD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI5C,QAAA,MAAM,aAAa,EAAE,KAAK,CAAE,QAAQ,CAQnC,CAAC;AAEF;;GAEG;AACH,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"template-edit.d.ts","sourceRoot":"","sources":["../../../src/fields/template/template-edit.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAmBjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK5C,eAAO,MAAM,YAAY,GAAK,4BAI3B,oBAAoB,CAAE,QAAQ,CAAE,gCAgLlC,CAAC"}
1
+ {"version":3,"file":"template-edit.d.ts","sourceRoot":"","sources":["../../../src/fields/template/template-edit.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AASjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAM5C,eAAO,MAAM,YAAY,GAAK,4BAI3B,oBAAoB,CAAE,QAAQ,CAAE,gCA4ElC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DataViewRenderFieldProps } from '@wordpress/dataviews';
2
+ import type { BasePost } from '../../types';
3
+ export declare const TemplateView: ({ item, field, }: DataViewRenderFieldProps<BasePost>) => import("react").JSX.Element;
4
+ //# sourceMappingURL=template-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-view.d.ts","sourceRoot":"","sources":["../../../src/fields/template/template-view.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAMrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,eAAO,MAAM,YAAY,GAAK,kBAG3B,wBAAwB,CAAE,QAAQ,CAAE,gCAiCtC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store as coreStore } from '@wordpress/core-data';
5
+ /**
6
+ * Compute the template slug to look up in the template hierarchy.
7
+ *
8
+ * In `draft` status we might not have a slug available, so we use the
9
+ * `single` post type template slug (e.g. page, single-post,
10
+ * single-product, etc.). Pages do not need the `single` prefix to be
11
+ * prioritised through template hierarchy.
12
+ *
13
+ * @param postType The post type.
14
+ * @param slug The post slug.
15
+ */
16
+ export declare function getTemplateSlugToCheck(postType: string, slug: string | undefined): string;
17
+ /**
18
+ * Resolve the human-readable label for the default template that would
19
+ * apply to a post, given its type, ID and slug. Meant to be called inside a
20
+ * `useSelect` callback (receives `select` as its first argument).
21
+ *
22
+ * @param select The `select` function from a `useSelect` callback.
23
+ * @param postType The post type.
24
+ * @param postId The post ID.
25
+ * @param slug The post slug.
26
+ */
27
+ export declare function getDefaultTemplateLabel(select: (store: typeof coreStore) => any, postType: string | undefined, postId: string | number | undefined, slug: string | undefined): string;
28
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/fields/template/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAU1D;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GAAG,SAAS,GACtB,MAAM,CAOR;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACtC,MAAM,EAAE,CAAE,KAAK,EAAE,OAAO,SAAS,KAAM,GAAG,EAC1C,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EACnC,IAAI,EAAE,MAAM,GAAG,SAAS,GACtB,MAAM,CAmER"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/fields",
3
- "version": "0.31.1-next.v.202602111440.0+a307a2e35",
3
+ "version": "0.32.0",
4
4
  "description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -47,30 +47,31 @@
47
47
  "src/**/*.scss"
48
48
  ],
49
49
  "dependencies": {
50
- "@wordpress/api-fetch": "^7.39.1-next.v.202602111440.0+a307a2e35",
51
- "@wordpress/base-styles": "^6.15.1-next.v.202602111440.0+a307a2e35",
52
- "@wordpress/blob": "^4.39.1-next.v.202602111440.0+a307a2e35",
53
- "@wordpress/block-editor": "^15.12.2-next.v.202602111440.0+a307a2e35",
54
- "@wordpress/blocks": "^15.12.1-next.v.202602111440.0+a307a2e35",
55
- "@wordpress/components": "^32.2.1-next.v.202602111440.0+a307a2e35",
56
- "@wordpress/compose": "^7.39.1-next.v.202602111440.0+a307a2e35",
57
- "@wordpress/core-data": "^7.39.1-next.v.202602111440.0+a307a2e35",
58
- "@wordpress/data": "^10.39.1-next.v.202602111440.0+a307a2e35",
59
- "@wordpress/dataviews": "^12.0.1-next.v.202602111440.0+a307a2e35",
60
- "@wordpress/date": "^5.39.1-next.v.202602111440.0+a307a2e35",
61
- "@wordpress/element": "^6.39.1-next.v.202602111440.0+a307a2e35",
62
- "@wordpress/hooks": "^4.39.1-next.v.202602111440.0+a307a2e35",
63
- "@wordpress/html-entities": "^4.39.1-next.v.202602111440.0+a307a2e35",
64
- "@wordpress/i18n": "^6.12.1-next.v.202602111440.0+a307a2e35",
65
- "@wordpress/icons": "^11.6.1-next.v.202602111440.0+a307a2e35",
66
- "@wordpress/media-utils": "^5.39.1-next.v.202602111440.0+a307a2e35",
67
- "@wordpress/notices": "^5.39.1-next.v.202602111440.0+a307a2e35",
68
- "@wordpress/patterns": "^2.39.1-next.v.202602111440.0+a307a2e35",
69
- "@wordpress/primitives": "^4.39.1-next.v.202602111440.0+a307a2e35",
70
- "@wordpress/private-apis": "^1.39.1-next.v.202602111440.0+a307a2e35",
71
- "@wordpress/router": "^1.39.1-next.v.202602111440.0+a307a2e35",
72
- "@wordpress/url": "^4.39.1-next.v.202602111440.0+a307a2e35",
73
- "@wordpress/warning": "^3.39.1-next.v.202602111440.0+a307a2e35",
50
+ "@react-spring/web": "^9.4.5",
51
+ "@wordpress/api-fetch": "^7.40.0",
52
+ "@wordpress/base-styles": "^6.16.0",
53
+ "@wordpress/blob": "^4.40.0",
54
+ "@wordpress/block-editor": "^15.13.0",
55
+ "@wordpress/blocks": "^15.13.0",
56
+ "@wordpress/components": "^32.2.0",
57
+ "@wordpress/compose": "^7.40.0",
58
+ "@wordpress/core-data": "^7.40.0",
59
+ "@wordpress/data": "^10.40.0",
60
+ "@wordpress/dataviews": "^12.0.0",
61
+ "@wordpress/date": "^5.40.0",
62
+ "@wordpress/element": "^6.40.0",
63
+ "@wordpress/hooks": "^4.40.0",
64
+ "@wordpress/html-entities": "^4.40.0",
65
+ "@wordpress/i18n": "^6.13.0",
66
+ "@wordpress/icons": "^11.7.0",
67
+ "@wordpress/media-utils": "^5.40.0",
68
+ "@wordpress/notices": "^5.40.0",
69
+ "@wordpress/patterns": "^2.40.0",
70
+ "@wordpress/primitives": "^4.40.0",
71
+ "@wordpress/private-apis": "^1.40.0",
72
+ "@wordpress/router": "^1.40.0",
73
+ "@wordpress/url": "^4.40.0",
74
+ "@wordpress/warning": "^3.40.0",
74
75
  "change-case": "4.1.2",
75
76
  "client-zip": "^2.4.5",
76
77
  "clsx": "2.1.1",
@@ -82,5 +83,5 @@
82
83
  "publishConfig": {
83
84
  "access": "public"
84
85
  },
85
- "gitHead": "e0a2324a9690e55f4101d61113f4bbbf240b55ed"
86
+ "gitHead": "376124aa10dbc2cc0c81c964ec00b99fcfee5382"
86
87
  }
@@ -30,7 +30,7 @@ interface Action< Item > {
30
30
  label: string;
31
31
  isEligible?: ( item: Item ) => boolean;
32
32
  modalFocusOnMount?: string;
33
- RenderModal: ( props: RenderModalProps< Item > ) => JSX.Element;
33
+ RenderModal: ( props: RenderModalProps< Item > ) => React.JSX.Element;
34
34
  }
35
35
 
36
36
  const duplicatePost: Action< BasePost > = {
@@ -29,7 +29,7 @@ interface Action< Item > {
29
29
  label: string;
30
30
  isEligible?: ( item: Item ) => boolean;
31
31
  modalFocusOnMount?: string;
32
- RenderModal: ( props: RenderModalProps< Item > ) => JSX.Element;
32
+ RenderModal: ( props: RenderModalProps< Item > ) => React.JSX.Element;
33
33
  }
34
34
 
35
35
  function isItemValid( item: BasePost ): boolean {
@@ -21,7 +21,7 @@ import {
21
21
  footer as footerIcon,
22
22
  header as headerIcon,
23
23
  sidebar as sidebarIcon,
24
- tableColumnAfter as overlayIcon,
24
+ navigationOverlay as navigationOverlayIcon,
25
25
  symbolFilled as symbolFilledIcon,
26
26
  } from '@wordpress/icons';
27
27
  import { store as noticesStore } from '@wordpress/notices';
@@ -86,30 +86,21 @@ export default function CreateTemplatePartModal( {
86
86
  }
87
87
 
88
88
  /**
89
- * Helper function to retrieve the corresponding icon by area name or icon name.
89
+ * Helper function to retrieve the corresponding icon by area name.
90
90
  *
91
- * @param {string} areaOrIconName The area name (e.g., 'header', 'navigation-overlay') or icon name (e.g., 'menu').
91
+ * @param {string} areaOrIconName The area name (e.g., 'header', 'navigation-overlay').
92
92
  *
93
93
  * @return {Object} The corresponding icon.
94
94
  */
95
95
  const getTemplatePartIcon = ( areaOrIconName: string ) => {
96
- // Handle area names first
97
96
  if ( 'header' === areaOrIconName ) {
98
97
  return headerIcon;
99
98
  } else if ( 'footer' === areaOrIconName ) {
100
99
  return footerIcon;
101
100
  } else if ( 'sidebar' === areaOrIconName ) {
102
101
  return sidebarIcon;
103
- } else if ( 'overlay' === areaOrIconName ) {
104
- // TODO: Replace with a proper overlay icon when available.
105
- // Using tableColumnAfter as a placeholder.
106
- return overlayIcon;
107
- }
108
- // Handle icon names for backwards compatibility
109
- if ( 'menu' === areaOrIconName ) {
110
- // TODO: Replace with a proper overlay icon when available.
111
- // Using tableColumnAfter as a placeholder.
112
- return overlayIcon;
102
+ } else if ( 'navigation-overlay' === areaOrIconName ) {
103
+ return navigationOverlayIcon;
113
104
  }
114
105
  return symbolFilledIcon;
115
106
  };