@wordpress/fields 0.42.1-next.v.202607070741.0 → 0.43.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 (58) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/actions/duplicate-post.cjs +0 -1
  3. package/build/actions/duplicate-post.cjs.map +2 -2
  4. package/build/actions/reorder-page.cjs +0 -1
  5. package/build/actions/reorder-page.cjs.map +2 -2
  6. package/build/components/media-edit/index.cjs +8 -2
  7. package/build/components/media-edit/index.cjs.map +2 -2
  8. package/build/fields/slug/slug-edit.cjs +0 -1
  9. package/build/fields/slug/slug-edit.cjs.map +2 -2
  10. package/build/fields/status/index.cjs +3 -0
  11. package/build/fields/status/index.cjs.map +2 -2
  12. package/build/fields/status/status-view.cjs +4 -3
  13. package/build/fields/status/status-view.cjs.map +2 -2
  14. package/build-module/actions/duplicate-post.mjs +0 -1
  15. package/build-module/actions/duplicate-post.mjs.map +2 -2
  16. package/build-module/actions/reorder-page.mjs +0 -1
  17. package/build-module/actions/reorder-page.mjs.map +2 -2
  18. package/build-module/components/media-edit/index.mjs +8 -2
  19. package/build-module/components/media-edit/index.mjs.map +2 -2
  20. package/build-module/fields/slug/slug-edit.mjs +0 -1
  21. package/build-module/fields/slug/slug-edit.mjs.map +2 -2
  22. package/build-module/fields/status/index.mjs +3 -0
  23. package/build-module/fields/status/index.mjs.map +2 -2
  24. package/build-module/fields/status/status-view.mjs +4 -3
  25. package/build-module/fields/status/status-view.mjs.map +2 -2
  26. package/build-style/style-rtl.css +1 -1
  27. package/build-style/style.css +1 -1
  28. package/build-types/actions/duplicate-post.d.ts.map +1 -1
  29. package/build-types/actions/reorder-page.d.ts.map +1 -1
  30. package/build-types/actions/reset-post.d.ts.map +1 -1
  31. package/build-types/components/create-template-part-modal/index.d.ts +1 -1
  32. package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
  33. package/build-types/components/media-edit/index.d.ts +1 -1
  34. package/build-types/components/media-edit/index.d.ts.map +1 -1
  35. package/build-types/fields/parent/parent-edit.d.ts +1 -1
  36. package/build-types/fields/parent/parent-edit.d.ts.map +1 -1
  37. package/build-types/fields/password/edit.d.ts +1 -1
  38. package/build-types/fields/password/edit.d.ts.map +1 -1
  39. package/build-types/fields/post-content-info/post-content-info-view.d.ts +1 -1
  40. package/build-types/fields/post-content-info/post-content-info-view.d.ts.map +1 -1
  41. package/build-types/fields/slug/slug-edit.d.ts.map +1 -1
  42. package/build-types/fields/status/index.d.ts.map +1 -1
  43. package/build-types/fields/status/status-view.d.ts +2 -3
  44. package/build-types/fields/status/status-view.d.ts.map +1 -1
  45. package/build-types/fields/template-author/view.d.ts +1 -1
  46. package/build-types/fields/template-author/view.d.ts.map +1 -1
  47. package/build-types/fields/title/view.d.ts +1 -1
  48. package/build-types/fields/title/view.d.ts.map +1 -1
  49. package/build-types/stories/index.story.d.ts +4 -3
  50. package/build-types/stories/index.story.d.ts.map +1 -1
  51. package/package.json +30 -29
  52. package/src/actions/duplicate-post.tsx +0 -1
  53. package/src/actions/reorder-page.tsx +0 -1
  54. package/src/components/media-edit/index.tsx +25 -19
  55. package/src/fields/slug/slug-edit.tsx +0 -1
  56. package/src/fields/slug/style.scss +1 -1
  57. package/src/fields/status/index.tsx +4 -0
  58. package/src/fields/status/status-view.tsx +5 -3
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/fields/template-author/view.tsx"],"names":[],"mappings":"AAmBA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAe1D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,EAC3C,IAAI,EACJ,EAAE;IACF,IAAI,EAAE,QAAQ,GAAG,YAAY,CAAC;CAC9B,+BAqDA"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/fields/template-author/view.tsx"],"names":[],"mappings":"AAmBA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAe1D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,EAC3C,IAAI,GACJ,EAAE;IACF,IAAI,EAAE,QAAQ,GAAG,YAAY,CAAC;CAC9B,+BAqDA"}
@@ -3,7 +3,7 @@ import type { ReactNode } from 'react';
3
3
  * Internal dependencies
4
4
  */
5
5
  import type { CommonPost } from '../../types';
6
- export declare function BaseTitleView({ item, className, children }: {
6
+ export declare function BaseTitleView({ item, className, children, }: {
7
7
  item: CommonPost;
8
8
  className?: string;
9
9
  children?: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/fields/title/view.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,wBAAgB,aAAa,CAAE,EAC9B,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,EAAE;IACF,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB,+BAYA;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,+BAEhE"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/fields/title/view.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,wBAAgB,aAAa,CAAE,EAC9B,IAAI,EACJ,SAAS,EACT,QAAQ,GACR,EAAE;IACF,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB,+BAYA;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,+BAEhE"}
@@ -4,10 +4,11 @@ declare const _default: {
4
4
  component: typeof DataForm;
5
5
  };
6
6
  export default _default;
7
+ declare const DataFormsComponent: ({ type }: {
8
+ type: 'regular' | 'panel';
9
+ }) => import("react").JSX.Element;
7
10
  export declare const DataFormsPreview: {
8
- render: ({ type }: {
9
- type: 'regular' | 'panel';
10
- }) => import("react").JSX.Element;
11
+ render: typeof DataFormsComponent;
11
12
  argTypes: {
12
13
  type: {
13
14
  control: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../src/stories/index.story.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAa,MAAM,sBAAsB,CAAC;;IA4D1D,KAAK;IACL,SAAS;;;AA0FV,eAAO,MAAM,gBAAgB;IAC5B,MAAM,aA3CgC;QAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAA;KAAE;IA4CnE,QAAQ;QACP,IAAI;YACH,OAAO;gBAAI,IAAI;;YACf,WAAW;YACX,OAAO;;;IAGT,IAAI;QACH,IAAI;;CAEL,CAAC;AAEF,eAAO,MAAM,gBAAgB,mCAgC5B,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../src/stories/index.story.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAa,MAAM,sBAAsB,CAAC;;IA4D1D,KAAK;IACL,SAAS;;;AAgDV,QAAA,MAAM,kBAAkB,aAAe;IAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAA;CAAE,gCAwCnE,CAAC;AAEF,eAAO,MAAM,gBAAgB;IAC5B,MAAM;IACN,QAAQ;QACP,IAAI;YACH,OAAO;gBAAI,IAAI;;YACf,WAAW;YACX,OAAO;;;IAGT,IAAI;QACH,IAAI;;CAEL,CAAC;AAEF,eAAO,MAAM,gBAAgB,mCAgC5B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/fields",
3
- "version": "0.42.1-next.v.202607070741.0+a51d59513",
3
+ "version": "0.43.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,39 +47,40 @@
47
47
  ],
48
48
  "dependencies": {
49
49
  "@react-spring/web": "^9.4.5",
50
- "@wordpress/api-fetch": "^7.50.1-next.v.202607070741.0+a51d59513",
51
- "@wordpress/base-styles": "^10.3.1-next.v.202607070741.0+a51d59513",
52
- "@wordpress/blob": "^4.50.1-next.v.202607070741.0+a51d59513",
53
- "@wordpress/blocks": "^15.23.1-next.v.202607070741.0+a51d59513",
54
- "@wordpress/components": "^37.0.1-next.v.202607070741.0+a51d59513",
55
- "@wordpress/compose": "^8.3.1-next.v.202607070741.0+a51d59513",
56
- "@wordpress/core-data": "^7.50.1-next.v.202607070741.0+a51d59513",
57
- "@wordpress/data": "^10.50.1-next.v.202607070741.0+a51d59513",
58
- "@wordpress/dataviews": "^17.1.2-next.v.202607070741.0+a51d59513",
59
- "@wordpress/date": "^5.50.1-next.v.202607070741.0+a51d59513",
60
- "@wordpress/element": "^8.2.1-next.v.202607070741.0+a51d59513",
61
- "@wordpress/hooks": "^4.50.1-next.v.202607070741.0+a51d59513",
62
- "@wordpress/html-entities": "^4.50.1-next.v.202607070741.0+a51d59513",
63
- "@wordpress/i18n": "^6.23.1-next.v.202607070741.0+a51d59513",
64
- "@wordpress/icons": "^15.1.1-next.v.202607070741.0+a51d59513",
65
- "@wordpress/media-utils": "^5.50.1-next.v.202607070741.0+a51d59513",
66
- "@wordpress/notices": "^5.50.1-next.v.202607070741.0+a51d59513",
67
- "@wordpress/patterns": "^2.50.1-next.v.202607070741.0+a51d59513",
68
- "@wordpress/primitives": "^4.50.1-next.v.202607070741.0+a51d59513",
69
- "@wordpress/private-apis": "^1.50.1-next.v.202607070741.0+a51d59513",
70
- "@wordpress/router": "^1.50.1-next.v.202607070741.0+a51d59513",
71
- "@wordpress/ui": "^0.18.1-next.v.202607070741.0+a51d59513",
72
- "@wordpress/url": "^4.50.1-next.v.202607070741.0+a51d59513",
73
- "@wordpress/warning": "^3.50.1-next.v.202607070741.0+a51d59513",
74
- "@wordpress/wordcount": "^4.50.1-next.v.202607070741.0+a51d59513",
50
+ "@wordpress/a11y": "^4.51.0",
51
+ "@wordpress/api-fetch": "^7.51.0",
52
+ "@wordpress/base-styles": "^11.0.0",
53
+ "@wordpress/blob": "^4.51.0",
54
+ "@wordpress/blocks": "^15.24.0",
55
+ "@wordpress/components": "^37.0.0",
56
+ "@wordpress/compose": "^8.4.0",
57
+ "@wordpress/core-data": "^7.51.0",
58
+ "@wordpress/data": "^10.51.0",
59
+ "@wordpress/dataviews": "^17.2.0",
60
+ "@wordpress/date": "^5.51.0",
61
+ "@wordpress/element": "^8.3.0",
62
+ "@wordpress/hooks": "^4.51.0",
63
+ "@wordpress/html-entities": "^4.51.0",
64
+ "@wordpress/i18n": "^6.24.0",
65
+ "@wordpress/icons": "^15.2.0",
66
+ "@wordpress/media-utils": "^5.51.0",
67
+ "@wordpress/notices": "^5.51.0",
68
+ "@wordpress/patterns": "^2.51.0",
69
+ "@wordpress/primitives": "^4.51.0",
70
+ "@wordpress/private-apis": "^1.51.0",
71
+ "@wordpress/router": "^1.51.0",
72
+ "@wordpress/ui": "^0.18.0",
73
+ "@wordpress/url": "^4.51.0",
74
+ "@wordpress/warning": "^3.51.0",
75
+ "@wordpress/wordcount": "^4.51.0",
75
76
  "change-case": "^4.1.2",
76
77
  "client-zip": "^2.4.5",
77
78
  "clsx": "^2.1.1",
78
79
  "remove-accents": "^0.5.0"
79
80
  },
80
81
  "peerDependencies": {
81
- "@types/react": "^18.3.27",
82
- "react": "^18.0.0"
82
+ "@types/react": "^18 || ^19",
83
+ "react": "^18 || ^19"
83
84
  },
84
85
  "peerDependenciesMeta": {
85
86
  "@types/react": {
@@ -89,5 +90,5 @@
89
90
  "publishConfig": {
90
91
  "access": "public"
91
92
  },
92
- "gitHead": "f637726e370c8b23695ed9af82adbe171ad235d8"
93
+ "gitHead": "e9a74f9c14095a34398ecd4d1f7a908e55051205"
93
94
  }
@@ -153,7 +153,6 @@ const duplicatePost: Action< BasePost > = {
153
153
  </div>
154
154
  ) }
155
155
  <InputControl
156
- __next40pxDefaultSize
157
156
  label={ __( 'Title' ) }
158
157
  placeholder={ __( 'No title' ) }
159
158
  value={ getItemTitle( item ) }
@@ -93,7 +93,6 @@ function ReorderModal( {
93
93
  ) }
94
94
  </div>
95
95
  <InputControl
96
- __next40pxDefaultSize
97
96
  label={ __( 'Order' ) }
98
97
  type="number"
99
98
  value={
@@ -41,6 +41,7 @@ import {
41
41
  chevronRight,
42
42
  } from '@wordpress/icons';
43
43
  import { VisuallyHidden, Tooltip } from '@wordpress/ui';
44
+ import { speak } from '@wordpress/a11y';
44
45
  import {
45
46
  MediaUpload,
46
47
  uploadMedia,
@@ -838,6 +839,13 @@ export default function MediaEdit< Item >( {
838
839
  setCustomValidity( undefined );
839
840
  }
840
841
  }, [ isTouched, field.isValid, validity ] );
842
+
843
+ useEffect( () => {
844
+ if ( isTouched && customValidity?.message ) {
845
+ speak( customValidity.message );
846
+ }
847
+ }, [ isTouched, customValidity?.message ] );
848
+
841
849
  const onBlur = useCallback(
842
850
  ( event: React.FocusEvent< HTMLElement > ) => {
843
851
  if ( isTouched ) {
@@ -961,25 +969,23 @@ export default function MediaEdit< Item >( {
961
969
  />
962
970
  </VisuallyHidden>
963
971
  { customValidity && (
964
- <div aria-live="polite">
965
- <p
966
- className={ clsx(
967
- 'components-validated-control__indicator',
968
- {
969
- 'is-invalid': customValidity.type === 'invalid',
970
- 'is-valid': customValidity.type === 'valid',
971
- }
972
- ) }
973
- >
974
- <WCIcon
975
- className="components-validated-control__indicator-icon"
976
- icon={ errorIcon }
977
- size={ 16 }
978
- fill="currentColor"
979
- />
980
- { customValidity.message }
981
- </p>
982
- </div>
972
+ <p
973
+ className={ clsx(
974
+ 'components-validated-control__indicator',
975
+ {
976
+ 'is-invalid': customValidity.type === 'invalid',
977
+ 'is-valid': customValidity.type === 'valid',
978
+ }
979
+ ) }
980
+ >
981
+ <WCIcon
982
+ className="components-validated-control__indicator-icon"
983
+ icon={ errorIcon }
984
+ size={ 16 }
985
+ fill="currentColor"
986
+ />
987
+ { customValidity.message }
988
+ </p>
983
989
  ) }
984
990
  </div>
985
991
  );
@@ -87,7 +87,6 @@ const SlugEdit = ( {
87
87
  </ExternalLink>
88
88
  </VStack>
89
89
  <InputControl
90
- __next40pxDefaultSize
91
90
  prefix={
92
91
  <InputControlPrefixWrapper>
93
92
  /
@@ -21,7 +21,7 @@
21
21
  flex-direction: column;
22
22
 
23
23
  .fields-controls__slug-help-slug {
24
- font-weight: 600;
24
+ font-weight: var(--wpds-typography-font-weight-emphasis);
25
25
  }
26
26
  }
27
27
  }
@@ -18,6 +18,10 @@ const statusField: Field< BasePost > = {
18
18
  id: 'status',
19
19
  type: 'text',
20
20
  elements: STATUSES,
21
+ // An auto-draft is a draft that hasn't been saved yet, so treat it as
22
+ // one for display, selection, and filtering.
23
+ getValue: ( { item } ) =>
24
+ item.status === 'auto-draft' ? 'draft' : item.status,
21
25
  render: StatusView,
22
26
  Edit: 'radio',
23
27
  enableSorting: false,
@@ -5,6 +5,7 @@ import {
5
5
  __experimentalHStack as HStack,
6
6
  Icon as WCIcon,
7
7
  } from '@wordpress/components';
8
+ import type { DataViewRenderFieldProps } from '@wordpress/dataviews';
8
9
 
9
10
  /**
10
11
  * Internal dependencies
@@ -12,9 +13,10 @@ import {
12
13
  import type { BasePost } from '../../types';
13
14
  import STATUSES from './status-elements';
14
15
 
15
- function StatusView( { item }: { item: BasePost } ) {
16
- const status = STATUSES.find( ( { value } ) => value === item.status );
17
- const label = status?.label || item.status;
16
+ function StatusView( { item, field }: DataViewRenderFieldProps< BasePost > ) {
17
+ const currentStatus = field.getValue( { item } );
18
+ const status = STATUSES.find( ( { value } ) => value === currentStatus );
19
+ const label = status?.label || currentStatus;
18
20
  const icon = status?.icon;
19
21
  return (
20
22
  <HStack alignment="left" spacing={ 0 }>