@wordpress/fields 0.5.1-next.a9f418477.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/actions/delete-post.js +1 -0
- package/build/actions/delete-post.js.map +1 -1
- package/build/actions/duplicate-post.js +1 -0
- package/build/actions/duplicate-post.js.map +1 -1
- package/build/actions/export-pattern.js +1 -0
- package/build/actions/export-pattern.js.map +1 -1
- package/build/actions/permanently-delete-post.js +1 -0
- package/build/actions/permanently-delete-post.js.map +1 -1
- package/build/actions/restore-post.js +1 -0
- package/build/actions/restore-post.js.map +1 -1
- package/build/actions/trash-post.js +1 -0
- package/build/actions/trash-post.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +32 -41
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/create-template-part-modal/utils.js +1 -0
- package/build/components/create-template-part-modal/utils.js.map +1 -1
- package/build/fields/parent/parent-edit.js +1 -0
- package/build/fields/parent/parent-edit.js.map +1 -1
- package/build/fields/status/status-view.js +1 -0
- package/build/fields/status/status-view.js.map +1 -1
- package/build/fields/template/template-edit.js +1 -0
- package/build/fields/template/template-edit.js.map +1 -1
- package/build/mutation/index.js +1 -0
- package/build/mutation/index.js.map +1 -1
- package/build-module/actions/delete-post.js +1 -0
- package/build-module/actions/delete-post.js.map +1 -1
- package/build-module/actions/duplicate-post.js +1 -0
- package/build-module/actions/duplicate-post.js.map +1 -1
- package/build-module/actions/export-pattern.js +1 -0
- package/build-module/actions/export-pattern.js.map +1 -1
- package/build-module/actions/permanently-delete-post.js +1 -0
- package/build-module/actions/permanently-delete-post.js.map +1 -1
- package/build-module/actions/restore-post.js +1 -0
- package/build-module/actions/restore-post.js.map +1 -1
- package/build-module/actions/trash-post.js +1 -0
- package/build-module/actions/trash-post.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +32 -41
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/utils.js +1 -0
- package/build-module/components/create-template-part-modal/utils.js.map +1 -1
- package/build-module/fields/parent/parent-edit.js +1 -0
- package/build-module/fields/parent/parent-edit.js.map +1 -1
- package/build-module/fields/status/status-view.js +1 -0
- package/build-module/fields/status/status-view.js.map +1 -1
- package/build-module/fields/template/template-edit.js +1 -0
- package/build-module/fields/template/template-edit.js.map +1 -1
- package/build-module/mutation/index.js +1 -0
- package/build-module/mutation/index.js.map +1 -1
- package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
- package/package.json +24 -24
- package/src/components/create-template-part-modal/index.tsx +25 -26
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/fields",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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",
|
|
@@ -33,29 +33,29 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "7.25.7",
|
|
36
|
-
"@wordpress/api-fetch": "
|
|
37
|
-
"@wordpress/blob": "
|
|
38
|
-
"@wordpress/block-editor": "
|
|
39
|
-
"@wordpress/blocks": "
|
|
36
|
+
"@wordpress/api-fetch": "*",
|
|
37
|
+
"@wordpress/blob": "*",
|
|
38
|
+
"@wordpress/block-editor": "*",
|
|
39
|
+
"@wordpress/blocks": "*",
|
|
40
40
|
"@wordpress/components": "*",
|
|
41
|
-
"@wordpress/compose": "
|
|
42
|
-
"@wordpress/core-data": "
|
|
43
|
-
"@wordpress/data": "
|
|
44
|
-
"@wordpress/dataviews": "
|
|
45
|
-
"@wordpress/date": "
|
|
46
|
-
"@wordpress/element": "
|
|
47
|
-
"@wordpress/hooks": "
|
|
48
|
-
"@wordpress/html-entities": "
|
|
49
|
-
"@wordpress/i18n": "
|
|
50
|
-
"@wordpress/icons": "
|
|
51
|
-
"@wordpress/media-utils": "
|
|
52
|
-
"@wordpress/notices": "
|
|
53
|
-
"@wordpress/patterns": "
|
|
54
|
-
"@wordpress/primitives": "
|
|
55
|
-
"@wordpress/private-apis": "
|
|
56
|
-
"@wordpress/router": "
|
|
57
|
-
"@wordpress/url": "
|
|
58
|
-
"@wordpress/warning": "
|
|
41
|
+
"@wordpress/compose": "*",
|
|
42
|
+
"@wordpress/core-data": "*",
|
|
43
|
+
"@wordpress/data": "*",
|
|
44
|
+
"@wordpress/dataviews": "*",
|
|
45
|
+
"@wordpress/date": "*",
|
|
46
|
+
"@wordpress/element": "*",
|
|
47
|
+
"@wordpress/hooks": "*",
|
|
48
|
+
"@wordpress/html-entities": "*",
|
|
49
|
+
"@wordpress/i18n": "*",
|
|
50
|
+
"@wordpress/icons": "*",
|
|
51
|
+
"@wordpress/media-utils": "*",
|
|
52
|
+
"@wordpress/notices": "*",
|
|
53
|
+
"@wordpress/patterns": "*",
|
|
54
|
+
"@wordpress/primitives": "*",
|
|
55
|
+
"@wordpress/private-apis": "*",
|
|
56
|
+
"@wordpress/router": "*",
|
|
57
|
+
"@wordpress/url": "*",
|
|
58
|
+
"@wordpress/warning": "*",
|
|
59
59
|
"change-case": "4.1.2",
|
|
60
60
|
"client-zip": "^2.4.5",
|
|
61
61
|
"clsx": "2.1.1",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "b432c18934c9db866b6dba7d37517a4e97d642e3"
|
|
71
71
|
}
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
symbolFilled as symbolFilledIcon,
|
|
29
29
|
} from '@wordpress/icons';
|
|
30
30
|
import { store as noticesStore } from '@wordpress/notices';
|
|
31
|
-
// @ts-
|
|
31
|
+
// @ts-expect-error serialize is not typed
|
|
32
32
|
import { serialize } from '@wordpress/blocks';
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -50,6 +50,13 @@ type CreateTemplatePartModalContentsProps = {
|
|
|
50
50
|
defaultTitle?: string;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
type TemplatePartArea = {
|
|
54
|
+
area: string;
|
|
55
|
+
label: string;
|
|
56
|
+
icon: string;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
53
60
|
/**
|
|
54
61
|
* A React component that renders a modal for creating a template part. The modal displays a title and the contents for creating the template part.
|
|
55
62
|
* This component should not live in this package, it should be moved to a dedicated package responsible for managing template.
|
|
@@ -64,7 +71,7 @@ export default function CreateTemplatePartModal( {
|
|
|
64
71
|
} & CreateTemplatePartModalContentsProps ) {
|
|
65
72
|
const defaultModalTitle = useSelect(
|
|
66
73
|
( select ) =>
|
|
67
|
-
// @ts-
|
|
74
|
+
// @ts-expect-error getPostType is not typed with 'wp_template_part' as argument.
|
|
68
75
|
select( coreStore ).getPostType( 'wp_template_part' )?.labels
|
|
69
76
|
?.add_new_item,
|
|
70
77
|
[]
|
|
@@ -77,7 +84,6 @@ export default function CreateTemplatePartModal( {
|
|
|
77
84
|
focusOnMount="firstContentElement"
|
|
78
85
|
size="medium"
|
|
79
86
|
>
|
|
80
|
-
{ /* @ts-ignore */ }
|
|
81
87
|
<CreateTemplatePartModalContents { ...restProps } />
|
|
82
88
|
</Modal>
|
|
83
89
|
);
|
|
@@ -125,22 +131,14 @@ export function CreateTemplatePartModalContents( {
|
|
|
125
131
|
const [ isSubmitting, setIsSubmitting ] = useState( false );
|
|
126
132
|
const instanceId = useInstanceId( CreateTemplatePartModal );
|
|
127
133
|
|
|
128
|
-
const defaultTemplatePartAreas = useSelect(
|
|
129
|
-
|
|
134
|
+
const defaultTemplatePartAreas = useSelect(
|
|
135
|
+
( select ) =>
|
|
130
136
|
// @ts-expect-error getEntityRecord is not typed with unstableBase as argument.
|
|
131
137
|
select( coreStore ).getEntityRecord< {
|
|
132
|
-
default_template_part_areas: Array<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
description: string;
|
|
137
|
-
} >;
|
|
138
|
-
} >( 'root', '__unstableBase' )?.default_template_part_areas || [];
|
|
139
|
-
|
|
140
|
-
return areas.map( ( item ) => {
|
|
141
|
-
return { ...item, icon: getTemplatePartIcon( item.icon ) };
|
|
142
|
-
} );
|
|
143
|
-
}, [] );
|
|
138
|
+
default_template_part_areas: Array< TemplatePartArea >;
|
|
139
|
+
} >( 'root', '__unstableBase' )?.default_template_part_areas,
|
|
140
|
+
[]
|
|
141
|
+
);
|
|
144
142
|
|
|
145
143
|
async function createTemplatePart() {
|
|
146
144
|
if ( ! title || isSubmitting ) {
|
|
@@ -220,12 +218,13 @@ export function CreateTemplatePartModalContents( {
|
|
|
220
218
|
}
|
|
221
219
|
checked={ area }
|
|
222
220
|
>
|
|
223
|
-
{ defaultTemplatePartAreas.map(
|
|
224
|
-
|
|
221
|
+
{ ( defaultTemplatePartAreas ?? [] ).map( ( item ) => {
|
|
222
|
+
const icon = getTemplatePartIcon( item.icon );
|
|
223
|
+
return (
|
|
225
224
|
<Radio
|
|
226
225
|
__next40pxDefaultSize
|
|
227
|
-
key={ label }
|
|
228
|
-
value={
|
|
226
|
+
key={ item.label }
|
|
227
|
+
value={ item.area }
|
|
229
228
|
className="fields-create-template-part-modal__area-radio"
|
|
230
229
|
>
|
|
231
230
|
<Flex align="start" justify="start">
|
|
@@ -233,19 +232,19 @@ export function CreateTemplatePartModalContents( {
|
|
|
233
232
|
<Icon icon={ icon } />
|
|
234
233
|
</FlexItem>
|
|
235
234
|
<FlexBlock className="fields-create-template-part-modal__option-label">
|
|
236
|
-
{ label }
|
|
237
|
-
<div>{ description }</div>
|
|
235
|
+
{ item.label }
|
|
236
|
+
<div>{ item.description }</div>
|
|
238
237
|
</FlexBlock>
|
|
239
238
|
|
|
240
239
|
<FlexItem className="fields-create-template-part-modal__checkbox">
|
|
241
|
-
{ area ===
|
|
240
|
+
{ area === item.area && (
|
|
242
241
|
<Icon icon={ check } />
|
|
243
242
|
) }
|
|
244
243
|
</FlexItem>
|
|
245
244
|
</Flex>
|
|
246
245
|
</Radio>
|
|
247
|
-
)
|
|
248
|
-
) }
|
|
246
|
+
);
|
|
247
|
+
} ) }
|
|
249
248
|
</RadioGroup>
|
|
250
249
|
</BaseControl>
|
|
251
250
|
<HStack justify="right">
|