@wordpress/fields 0.40.0 → 0.40.2-next.v.202606191442.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 +11 -1
- package/README.md +28 -0
- package/build/components/media-edit/index.cjs +4 -1
- package/build/components/media-edit/index.cjs.map +3 -3
- package/build/fields/description/index.cjs +69 -0
- package/build/fields/description/index.cjs.map +7 -0
- package/build/fields/index.cjs +19 -2
- package/build/fields/index.cjs.map +2 -2
- package/build/fields/last-edited/index.cjs +51 -0
- package/build/fields/last-edited/index.cjs.map +7 -0
- package/build/fields/last-edited/last-edited-date-view.cjs +40 -0
- package/build/fields/last-edited/last-edited-date-view.cjs.map +7 -0
- package/build/fields/parent/parent-edit.cjs +3 -2
- package/build/fields/parent/parent-edit.cjs.map +2 -2
- package/build/fields/pattern-title/view.cjs +14 -9
- package/build/fields/pattern-title/view.cjs.map +3 -3
- package/build/fields/posts-page-title/index.cjs +47 -0
- package/build/fields/posts-page-title/index.cjs.map +7 -0
- package/build/fields/posts-per-page/index.cjs +42 -0
- package/build/fields/posts-per-page/index.cjs.map +7 -0
- package/build/fields/{date/scheduled → scheduled-date}/index.cjs +6 -6
- package/build/fields/scheduled-date/index.cjs.map +7 -0
- package/build/fields/site-discussion/index.cjs +58 -0
- package/build/fields/site-discussion/index.cjs.map +7 -0
- package/build/fields/template-title/index.cjs +1 -1
- package/build/fields/template-title/index.cjs.map +2 -2
- package/build/types.cjs.map +1 -1
- package/build-module/components/media-edit/index.mjs +6 -4
- package/build-module/components/media-edit/index.mjs.map +2 -2
- package/build-module/fields/description/index.mjs +44 -0
- package/build-module/fields/description/index.mjs.map +7 -0
- package/build-module/fields/index.mjs +27 -13
- package/build-module/fields/index.mjs.map +2 -2
- package/build-module/fields/last-edited/index.mjs +20 -0
- package/build-module/fields/last-edited/index.mjs.map +7 -0
- package/build-module/fields/last-edited/last-edited-date-view.mjs +19 -0
- package/build-module/fields/last-edited/last-edited-date-view.mjs.map +7 -0
- package/build-module/fields/parent/parent-edit.mjs +3 -2
- package/build-module/fields/parent/parent-edit.mjs.map +2 -2
- package/build-module/fields/pattern-title/view.mjs +15 -10
- package/build-module/fields/pattern-title/view.mjs.map +2 -2
- package/build-module/fields/posts-page-title/index.mjs +26 -0
- package/build-module/fields/posts-page-title/index.mjs.map +7 -0
- package/build-module/fields/posts-per-page/index.mjs +21 -0
- package/build-module/fields/posts-per-page/index.mjs.map +7 -0
- package/build-module/fields/{date/scheduled → scheduled-date}/index.mjs +3 -3
- package/build-module/fields/scheduled-date/index.mjs.map +7 -0
- package/build-module/fields/site-discussion/index.mjs +37 -0
- package/build-module/fields/site-discussion/index.mjs.map +7 -0
- package/build-module/fields/template-title/index.mjs +1 -1
- package/build-module/fields/template-title/index.mjs.map +2 -2
- package/build-style/style-rtl.css +6 -3
- package/build-style/style.css +6 -3
- package/build-types/components/media-edit/index.d.ts.map +1 -1
- package/build-types/fields/description/index.d.ts +20 -0
- package/build-types/fields/description/index.d.ts.map +1 -0
- package/build-types/fields/index.d.ts +6 -1
- package/build-types/fields/index.d.ts.map +1 -1
- package/build-types/fields/last-edited/index.d.ts +14 -0
- package/build-types/fields/last-edited/index.d.ts.map +1 -0
- package/build-types/fields/last-edited/last-edited-date-view.d.ts +8 -0
- package/build-types/fields/last-edited/last-edited-date-view.d.ts.map +1 -0
- package/build-types/fields/parent/parent-edit.d.ts.map +1 -1
- package/build-types/fields/pattern-title/view.d.ts.map +1 -1
- package/build-types/fields/posts-page-title/index.d.ts +14 -0
- package/build-types/fields/posts-page-title/index.d.ts.map +1 -0
- package/build-types/fields/posts-per-page/index.d.ts +14 -0
- package/build-types/fields/posts-per-page/index.d.ts.map +1 -0
- package/build-types/fields/{date/scheduled → scheduled-date}/index.d.ts +1 -1
- package/build-types/fields/scheduled-date/index.d.ts.map +1 -0
- package/build-types/fields/site-discussion/index.d.ts +14 -0
- package/build-types/fields/site-discussion/index.d.ts.map +1 -0
- package/build-types/types.d.ts +10 -0
- package/build-types/types.d.ts.map +1 -1
- package/package.json +35 -30
- package/src/components/media-edit/index.tsx +5 -5
- package/src/fields/description/index.tsx +64 -0
- package/src/fields/index.ts +9 -1
- package/src/fields/last-edited/index.tsx +29 -0
- package/src/fields/last-edited/last-edited-date-view.tsx +26 -0
- package/src/fields/parent/parent-edit.tsx +1 -0
- package/src/fields/pattern-title/view.tsx +12 -7
- package/src/fields/posts-page-title/index.ts +35 -0
- package/src/fields/posts-per-page/index.ts +30 -0
- package/src/fields/{date/scheduled → scheduled-date}/index.tsx +1 -1
- package/src/fields/site-discussion/index.ts +48 -0
- package/src/fields/template-title/index.ts +1 -1
- package/src/types.ts +10 -0
- package/build/fields/date/scheduled/index.cjs.map +0 -7
- package/build-module/fields/date/scheduled/index.mjs.map +0 -7
- package/build-types/fields/date/scheduled/index.d.ts.map +0 -1
- package/build-types/index.native.d.ts +0 -1
- package/build-types/index.native.d.ts.map +0 -1
- package/src/index.native.ts +0 -0
|
@@ -119,7 +119,8 @@ function PageAttributesParent({
|
|
|
119
119
|
...!!fieldValue && {
|
|
120
120
|
// Perform a search by relevance when the field is changed.
|
|
121
121
|
search: fieldValue,
|
|
122
|
-
orderby: "relevance"
|
|
122
|
+
orderby: "relevance",
|
|
123
|
+
search_columns: ["post_title"]
|
|
123
124
|
}
|
|
124
125
|
};
|
|
125
126
|
return {
|
|
@@ -139,7 +140,7 @@ function PageAttributesParent({
|
|
|
139
140
|
const mappedNodes = tree2.map((treeNode) => [
|
|
140
141
|
{
|
|
141
142
|
value: treeNode.id,
|
|
142
|
-
label: "
|
|
143
|
+
label: "— ".repeat(level) + (0, import_html_entities.decodeEntities)(treeNode.name),
|
|
143
144
|
rawName: treeNode.name
|
|
144
145
|
},
|
|
145
146
|
...getOptionsFromTree(treeNode.children || [], level + 1)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/parent/parent-edit.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { ComboboxControl, ExternalLink } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tcreateInterpolateElement,\n\tuseCallback,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n// @ts-ignore\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\nimport { debounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { filterURLForDisplay } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getTitleWithFallbackName } from './utils';\n\ntype TreeBase = {\n\tid: number;\n\tname: string;\n\t[ key: string ]: any;\n};\n\ntype TreeWithParent = TreeBase & {\n\tparent: number;\n};\n\ntype TreeWithoutParent = TreeBase & {\n\tparent: null;\n};\n\ntype Tree = TreeWithParent | TreeWithoutParent;\n\nfunction buildTermsTree( flatTerms: Tree[] ) {\n\tconst flatTermsWithParentAndChildren = flatTerms.map( ( term ) => {\n\t\treturn {\n\t\t\tchildren: [],\n\t\t\t...term,\n\t\t};\n\t} );\n\n\t// All terms should have a `parent` because we're about to index them by it.\n\tif (\n\t\tflatTermsWithParentAndChildren.some(\n\t\t\t( { parent } ) => parent === null || parent === undefined\n\t\t)\n\t) {\n\t\treturn flatTermsWithParentAndChildren as TreeWithParent[];\n\t}\n\n\tconst termsByParent = (\n\t\tflatTermsWithParentAndChildren as TreeWithParent[]\n\t ).reduce(\n\t\t( acc, term ) => {\n\t\t\tconst { parent } = term;\n\t\t\tif ( ! acc[ parent ] ) {\n\t\t\t\tacc[ parent ] = [];\n\t\t\t}\n\t\t\tacc[ parent ].push( term );\n\t\t\treturn acc;\n\t\t},\n\t\t{} as Record< string, Array< TreeWithParent > >\n\t);\n\n\tconst fillWithChildren = (\n\t\tterms: Array< TreeWithParent >\n\t): Array< TreeWithParent > => {\n\t\treturn terms.map( ( term ) => {\n\t\t\tconst children = termsByParent[ term.id ];\n\t\t\treturn {\n\t\t\t\t...term,\n\t\t\t\tchildren:\n\t\t\t\t\tchildren && children.length\n\t\t\t\t\t\t? fillWithChildren( children )\n\t\t\t\t\t\t: [],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn fillWithChildren( termsByParent[ '0' ] || [] );\n}\n\nexport const getItemPriority = ( name: string, searchValue: string ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent( {\n\tdata,\n\tonChangeControl,\n}: {\n\tdata: BasePost;\n\tonChangeControl: ( newValue: number ) => void;\n} ) {\n\tconst [ fieldValue, setFieldValue ] = useState< string >( '' );\n\n\tconst pageId = data.parent;\n\tconst postId = data.id;\n\tconst postTypeSlug = data.type;\n\n\tconst { parentPostTitle, pageItems, isHierarchical } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEntityRecords, getPostType } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst postTypeInfo = getPostType( postTypeSlug );\n\n\t\t\tconst postIsHierarchical =\n\t\t\t\tpostTypeInfo?.hierarchical && postTypeInfo.viewable;\n\n\t\t\tconst parentPost = pageId\n\t\t\t\t? getEntityRecord< BasePost >(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\t\tpageId\n\t\t\t\t )\n\t\t\t\t: null;\n\n\t\t\tconst query = {\n\t\t\t\tper_page: 100,\n\t\t\t\texclude: postId,\n\t\t\t\tparent_exclude: postId,\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: 'id,title,parent',\n\t\t\t\t...( !! fieldValue && {\n\t\t\t\t\t// Perform a search by relevance when the field is changed.\n\t\t\t\t\tsearch: fieldValue,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t} ),\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tisHierarchical: postIsHierarchical,\n\t\t\t\tparentPostTitle: parentPost\n\t\t\t\t\t? getTitleWithFallbackName( parentPost )\n\t\t\t\t\t: '',\n\t\t\t\tpageItems: postIsHierarchical\n\t\t\t\t\t? getEntityRecords< BasePost >(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\t\t\tquery\n\t\t\t\t\t )\n\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[ fieldValue, pageId, postId, postTypeSlug ]\n\t);\n\n\t/**\n\t * This logic has been copied from https://github.com/WordPress/gutenberg/blob/0249771b519d5646171fb9fae422006c8ab773f2/packages/editor/src/components/page-attributes/parent.js#L106.\n\t */\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = (\n\t\t\ttree: Array< Tree >,\n\t\t\tlevel = 0\n\t\t): Array< {\n\t\t\tvalue: number;\n\t\t\tlabel: string;\n\t\t\trawName: string;\n\t\t} > => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAA0B;AAK1B,wBAA8C;AAC9C,kBAA0B;AAC1B,qBAKO;AAEP,uBAAmC;AAEnC,qBAAyB;AACzB,2BAA+B;AAC/B,kBAA4B;AAC5B,iBAAoC;AAMpC,mBAAyC;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { ComboboxControl, ExternalLink } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tcreateInterpolateElement,\n\tuseCallback,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n// @ts-ignore\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\nimport { debounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { filterURLForDisplay } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getTitleWithFallbackName } from './utils';\n\ntype TreeBase = {\n\tid: number;\n\tname: string;\n\t[ key: string ]: any;\n};\n\ntype TreeWithParent = TreeBase & {\n\tparent: number;\n};\n\ntype TreeWithoutParent = TreeBase & {\n\tparent: null;\n};\n\ntype Tree = TreeWithParent | TreeWithoutParent;\n\nfunction buildTermsTree( flatTerms: Tree[] ) {\n\tconst flatTermsWithParentAndChildren = flatTerms.map( ( term ) => {\n\t\treturn {\n\t\t\tchildren: [],\n\t\t\t...term,\n\t\t};\n\t} );\n\n\t// All terms should have a `parent` because we're about to index them by it.\n\tif (\n\t\tflatTermsWithParentAndChildren.some(\n\t\t\t( { parent } ) => parent === null || parent === undefined\n\t\t)\n\t) {\n\t\treturn flatTermsWithParentAndChildren as TreeWithParent[];\n\t}\n\n\tconst termsByParent = (\n\t\tflatTermsWithParentAndChildren as TreeWithParent[]\n\t ).reduce(\n\t\t( acc, term ) => {\n\t\t\tconst { parent } = term;\n\t\t\tif ( ! acc[ parent ] ) {\n\t\t\t\tacc[ parent ] = [];\n\t\t\t}\n\t\t\tacc[ parent ].push( term );\n\t\t\treturn acc;\n\t\t},\n\t\t{} as Record< string, Array< TreeWithParent > >\n\t);\n\n\tconst fillWithChildren = (\n\t\tterms: Array< TreeWithParent >\n\t): Array< TreeWithParent > => {\n\t\treturn terms.map( ( term ) => {\n\t\t\tconst children = termsByParent[ term.id ];\n\t\t\treturn {\n\t\t\t\t...term,\n\t\t\t\tchildren:\n\t\t\t\t\tchildren && children.length\n\t\t\t\t\t\t? fillWithChildren( children )\n\t\t\t\t\t\t: [],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn fillWithChildren( termsByParent[ '0' ] || [] );\n}\n\nexport const getItemPriority = ( name: string, searchValue: string ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent( {\n\tdata,\n\tonChangeControl,\n}: {\n\tdata: BasePost;\n\tonChangeControl: ( newValue: number ) => void;\n} ) {\n\tconst [ fieldValue, setFieldValue ] = useState< string >( '' );\n\n\tconst pageId = data.parent;\n\tconst postId = data.id;\n\tconst postTypeSlug = data.type;\n\n\tconst { parentPostTitle, pageItems, isHierarchical } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEntityRecords, getPostType } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst postTypeInfo = getPostType( postTypeSlug );\n\n\t\t\tconst postIsHierarchical =\n\t\t\t\tpostTypeInfo?.hierarchical && postTypeInfo.viewable;\n\n\t\t\tconst parentPost = pageId\n\t\t\t\t? getEntityRecord< BasePost >(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\t\tpageId\n\t\t\t\t )\n\t\t\t\t: null;\n\n\t\t\tconst query = {\n\t\t\t\tper_page: 100,\n\t\t\t\texclude: postId,\n\t\t\t\tparent_exclude: postId,\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: 'id,title,parent',\n\t\t\t\t...( !! fieldValue && {\n\t\t\t\t\t// Perform a search by relevance when the field is changed.\n\t\t\t\t\tsearch: fieldValue,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\tsearch_columns: [ 'post_title' ],\n\t\t\t\t} ),\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tisHierarchical: postIsHierarchical,\n\t\t\t\tparentPostTitle: parentPost\n\t\t\t\t\t? getTitleWithFallbackName( parentPost )\n\t\t\t\t\t: '',\n\t\t\t\tpageItems: postIsHierarchical\n\t\t\t\t\t? getEntityRecords< BasePost >(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\t\t\tquery\n\t\t\t\t\t )\n\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[ fieldValue, pageId, postId, postTypeSlug ]\n\t);\n\n\t/**\n\t * This logic has been copied from https://github.com/WordPress/gutenberg/blob/0249771b519d5646171fb9fae422006c8ab773f2/packages/editor/src/components/page-attributes/parent.js#L106.\n\t */\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = (\n\t\t\ttree: Array< Tree >,\n\t\t\tlevel = 0\n\t\t): Array< {\n\t\t\tvalue: number;\n\t\t\tlabel: string;\n\t\t\trawName: string;\n\t\t} > => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + decodeEntities( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tif ( ! pageItems ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id as number,\n\t\t\tparent: item.parent ?? null,\n\t\t\tname: getTitleWithFallbackName( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = opts.find( ( item ) => item.value === pageId );\n\t\tif ( pageId && parentPostTitle && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: pageId,\n\t\t\t\tlabel: parentPostTitle,\n\t\t\t\trawName: '',\n\t\t\t} );\n\t\t}\n\t\treturn opts.map( ( option ) => ( {\n\t\t\t...option,\n\t\t\tvalue: option.value.toString(),\n\t\t} ) );\n\t}, [ pageItems, fieldValue, parentPostTitle, pageId ] );\n\n\tif ( ! isHierarchical ) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue: string ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId: string | null | undefined ) => {\n\t\tif ( selectedPostId ) {\n\t\t\treturn onChangeControl( parseInt( selectedPostId, 10 ) ?? 0 );\n\t\t}\n\n\t\tonChangeControl( 0 );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Parent' ) }\n\t\t\thelp={ __( 'Choose a parent page.' ) }\n\t\t\tvalue={ pageId?.toString() }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce(\n\t\t\t\t( value: unknown ) => handleKeydown( value as string ),\n\t\t\t\t300\n\t\t\t) }\n\t\t\tonChange={ handleChange }\n\t\t\thideLabelFromVision\n\t\t/>\n\t);\n}\n\nexport const ParentEdit = ( {\n\tdata,\n\tfield,\n\tonChange,\n}: DataFormControlProps< BasePost > ) => {\n\tconst { id } = field;\n\n\tconst homeUrl = useSelect( ( select ) => {\n\t\treturn select( coreStore ).getEntityRecord< {\n\t\t\thome: string;\n\t\t} >( 'root', '__unstableBase' )?.home as string;\n\t}, [] );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue?: number ) =>\n\t\t\tonChange( {\n\t\t\t\t[ id ]: newValue,\n\t\t\t} ),\n\t\t[ id, onChange ]\n\t);\n\n\treturn (\n\t\t<fieldset className=\"fields-controls__parent\">\n\t\t\t<div>\n\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %1$s The home URL of the WordPress installation without the scheme. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Child pages inherit characteristics from their parent, such as URL structure. For instance, if \"Pricing\" is a child of \"Services\", its URL would be %1$s<wbr />/services<wbr />/pricing.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tfilterURLForDisplay( homeUrl ).replace(\n\t\t\t\t\t\t\t/([/.])/g,\n\t\t\t\t\t\t\t'<wbr />$1'\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\twbr: <wbr />,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\t<p>\n\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'They also show up as sub-items in the default navigation menu. <a>Learn more.</a>'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\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D;AAAA,MACA;AAAA,QACC,KAAK,4CAAC,SAAI;AAAA,MACX;AAAA,IACD;AAAA,IACA,4CAAC,OACE;AAAA,UACD;AAAA,QACC;AAAA,MACD;AAAA,MACA;AAAA,QACC,GACC;AAAA,UAAC;AAAA;AAAA,YACA,UAAO;AAAA,cACN;AAAA,YACD;AAAA,YACA,UAAW;AAAA;AAAA,QACZ;AAAA,MAEF;AAAA,IACD,GACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,KACD,GACD;AAEF;",
|
|
6
6
|
"names": ["removeAccents", "coreStore", "tree"]
|
|
7
7
|
}
|
|
@@ -26,21 +26,26 @@ __export(view_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(view_exports);
|
|
27
27
|
var import_i18n = require("@wordpress/i18n");
|
|
28
28
|
var import_icons = require("@wordpress/icons");
|
|
29
|
-
var import_components = require("@wordpress/components");
|
|
30
29
|
var import_patterns = require("@wordpress/patterns");
|
|
30
|
+
var import_ui = require("@wordpress/ui");
|
|
31
31
|
var import_view = require("../title/view.cjs");
|
|
32
32
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
33
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
34
|
var { PATTERN_TYPES } = (0, import_lock_unlock.unlock)(import_patterns.privateApis);
|
|
35
35
|
function PatternTitleView({ item }) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
const lockMessage = (0, import_i18n.__)("This pattern cannot be edited.");
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_view.BaseTitleView, { item, className: "fields-field__pattern-title", children: item.type === PATTERN_TYPES.theme && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.VisuallyHidden, { children: lockMessage }),
|
|
39
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Tooltip.Root, { children: [
|
|
40
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
41
|
+
import_ui.Tooltip.Trigger,
|
|
42
|
+
{
|
|
43
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.Icon, { icon: import_icons.lockSmall, size: 24 })
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Tooltip.Popup, { children: lockMessage })
|
|
47
|
+
] })
|
|
48
|
+
] }) });
|
|
44
49
|
}
|
|
45
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
51
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/pattern-title/view.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, lockSmall } from '@wordpress/icons';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAAgC;
|
|
6
|
-
"names": ["patternPrivateApis"
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, lockSmall } from '@wordpress/icons';\n// @ts-ignore\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\nimport { Tooltip, VisuallyHidden } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport type { CommonPost } from '../../types';\n\nimport { BaseTitleView } from '../title/view';\nimport { unlock } from '../../lock-unlock';\n\nexport const { PATTERN_TYPES } = unlock( patternPrivateApis );\n\nexport default function PatternTitleView( { item }: { item: CommonPost } ) {\n\tconst lockMessage = __( 'This pattern cannot be edited.' );\n\treturn (\n\t\t<BaseTitleView item={ item } className=\"fields-field__pattern-title\">\n\t\t\t{ item.type === PATTERN_TYPES.theme && (\n\t\t\t\t<>\n\t\t\t\t\t<VisuallyHidden>{ lockMessage }</VisuallyHidden>\n\t\t\t\t\t<Tooltip.Root>\n\t\t\t\t\t\t<Tooltip.Trigger\n\t\t\t\t\t\t\trender={ <Icon icon={ lockSmall } size={ 24 } /> }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Tooltip.Popup>{ lockMessage }</Tooltip.Popup>\n\t\t\t\t\t</Tooltip.Root>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</BaseTitleView>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAAgC;AAEhC,sBAAkD;AAClD,gBAAwC;AAOxC,kBAA8B;AAC9B,yBAAuB;AASnB;AAPG,IAAM,EAAE,cAAc,QAAI,2BAAQ,gBAAAA,WAAmB;AAE7C,SAAR,iBAAmC,EAAE,KAAK,GAA0B;AAC1E,QAAM,kBAAc,gBAAI,gCAAiC;AACzD,SACC,4CAAC,6BAAc,MAAc,WAAU,+BACpC,eAAK,SAAS,cAAc,SAC7B,4EACC;AAAA,gDAAC,4BAAiB,uBAAa;AAAA,IAC/B,6CAAC,kBAAQ,MAAR,EACA;AAAA;AAAA,QAAC,kBAAQ;AAAA,QAAR;AAAA,UACA,QAAS,4CAAC,qBAAK,MAAO,wBAAY,MAAO,IAAK;AAAA;AAAA,MAC/C;AAAA,MACA,4CAAC,kBAAQ,OAAR,EAAgB,uBAAa;AAAA,OAC/B;AAAA,KACD,GAEF;AAEF;",
|
|
6
|
+
"names": ["patternPrivateApis"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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/posts-page-title/index.ts
|
|
21
|
+
var posts_page_title_exports = {};
|
|
22
|
+
__export(posts_page_title_exports, {
|
|
23
|
+
default: () => posts_page_title_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(posts_page_title_exports);
|
|
26
|
+
var import_i18n = require("@wordpress/i18n");
|
|
27
|
+
var postsPageTitleField = {
|
|
28
|
+
id: "posts_page_title",
|
|
29
|
+
type: "text",
|
|
30
|
+
label: (0, import_i18n.__)("Blog title"),
|
|
31
|
+
description: (0, import_i18n.__)(
|
|
32
|
+
"Set the Posts Page title. Appears in search results, and when the page is shared on social media."
|
|
33
|
+
),
|
|
34
|
+
getValue: ({ item }) => {
|
|
35
|
+
const title = item.title;
|
|
36
|
+
if (typeof title === "string") {
|
|
37
|
+
return title;
|
|
38
|
+
}
|
|
39
|
+
return title?.raw ?? "";
|
|
40
|
+
},
|
|
41
|
+
setValue: ({ value }) => ({ title: value }),
|
|
42
|
+
enableSorting: false,
|
|
43
|
+
enableHiding: false,
|
|
44
|
+
filterBy: false
|
|
45
|
+
};
|
|
46
|
+
var posts_page_title_default = postsPageTitleField;
|
|
47
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/posts-page-title/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 { PostsPage } from '../../types';\n\nconst postsPageTitleField: Field< PostsPage > = {\n\tid: 'posts_page_title',\n\ttype: 'text',\n\tlabel: __( 'Blog title' ),\n\tdescription: __(\n\t\t'Set the Posts Page title. Appears in search results, and when the page is shared on social media.'\n\t),\n\tgetValue: ( { item } ) => {\n\t\tconst title = item.title;\n\t\tif ( typeof title === 'string' ) {\n\t\t\treturn title;\n\t\t}\n\t\treturn title?.raw ?? '';\n\t},\n\tsetValue: ( { value } ) => ( { title: value } ),\n\tenableSorting: false,\n\tenableHiding: false,\n\tfilterBy: false,\n};\n\n/**\n * Title field for the posts page (the `page` assigned as `page_for_posts`).\n */\nexport default postsPageTitleField;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmB;AAOnB,IAAM,sBAA0C;AAAA,EAC/C,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,YAAa;AAAA,EACxB,iBAAa;AAAA,IACZ;AAAA,EACD;AAAA,EACA,UAAU,CAAE,EAAE,KAAK,MAAO;AACzB,UAAM,QAAQ,KAAK;AACnB,QAAK,OAAO,UAAU,UAAW;AAChC,aAAO;AAAA,IACR;AACA,WAAO,OAAO,OAAO;AAAA,EACtB;AAAA,EACA,UAAU,CAAE,EAAE,MAAM,OAAS,EAAE,OAAO,MAAM;AAAA,EAC5C,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAU;AACX;AAKA,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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/posts-per-page/index.ts
|
|
21
|
+
var posts_per_page_exports = {};
|
|
22
|
+
__export(posts_per_page_exports, {
|
|
23
|
+
default: () => posts_per_page_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(posts_per_page_exports);
|
|
26
|
+
var import_i18n = require("@wordpress/i18n");
|
|
27
|
+
var postsPerPageField = {
|
|
28
|
+
id: "posts_per_page",
|
|
29
|
+
type: "integer",
|
|
30
|
+
label: (0, import_i18n.__)("Posts per page"),
|
|
31
|
+
description: (0, import_i18n.__)(
|
|
32
|
+
"Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting."
|
|
33
|
+
),
|
|
34
|
+
getValue: ({ item }) => item.posts_per_page ?? 1,
|
|
35
|
+
setValue: ({ value }) => ({ posts_per_page: value }),
|
|
36
|
+
isValid: { min: 1 },
|
|
37
|
+
enableSorting: false,
|
|
38
|
+
enableHiding: false,
|
|
39
|
+
filterBy: false
|
|
40
|
+
};
|
|
41
|
+
var posts_per_page_default = postsPerPageField;
|
|
42
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/posts-per-page/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 { SiteSettings } from '../../types';\n\nconst postsPerPageField: Field< SiteSettings > = {\n\tid: 'posts_per_page',\n\ttype: 'integer',\n\tlabel: __( 'Posts per page' ),\n\tdescription: __(\n\t\t'Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.'\n\t),\n\tgetValue: ( { item } ) => item.posts_per_page ?? 1,\n\tsetValue: ( { value } ) => ( { posts_per_page: value } ),\n\tisValid: { min: 1 },\n\tenableSorting: false,\n\tenableHiding: false,\n\tfilterBy: false,\n};\n\n/**\n * Posts per page field for the `root/site` entity.\n */\nexport default postsPerPageField;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmB;AAOnB,IAAM,oBAA2C;AAAA,EAChD,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,gBAAiB;AAAA,EAC5B,iBAAa;AAAA,IACZ;AAAA,EACD;AAAA,EACA,UAAU,CAAE,EAAE,KAAK,MAAO,KAAK,kBAAkB;AAAA,EACjD,UAAU,CAAE,EAAE,MAAM,OAAS,EAAE,gBAAgB,MAAM;AAAA,EACrD,SAAS,EAAE,KAAK,EAAE;AAAA,EAClB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAU;AACX;AAKA,IAAO,yBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -17,12 +17,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// packages/fields/src/fields/date/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
default: () =>
|
|
20
|
+
// packages/fields/src/fields/scheduled-date/index.tsx
|
|
21
|
+
var scheduled_date_exports = {};
|
|
22
|
+
__export(scheduled_date_exports, {
|
|
23
|
+
default: () => scheduled_date_default
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(scheduled_date_exports);
|
|
26
26
|
var import_i18n = require("@wordpress/i18n");
|
|
27
27
|
var scheduledDateField = {
|
|
28
28
|
id: "scheduled_date",
|
|
@@ -39,5 +39,5 @@ var scheduledDateField = {
|
|
|
39
39
|
enableSorting: false,
|
|
40
40
|
filterBy: false
|
|
41
41
|
};
|
|
42
|
-
var
|
|
42
|
+
var scheduled_date_default = scheduledDateField;
|
|
43
43
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/scheduled-date/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\tEdit: {\n\t\tcontrol: 'datetime',\n\t\tcompact: true,\n\t},\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,MAAM;AAAA,IACL,SAAS;AAAA,IACT,SAAS;AAAA,EACV;AAAA,EACA,cAAc;AAAA,EACd,eAAe;AAAA,EACf,UAAU;AACX;AAKA,IAAO,yBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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/site-discussion/index.ts
|
|
21
|
+
var site_discussion_exports = {};
|
|
22
|
+
__export(site_discussion_exports, {
|
|
23
|
+
default: () => site_discussion_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(site_discussion_exports);
|
|
26
|
+
var import_i18n = require("@wordpress/i18n");
|
|
27
|
+
var siteDiscussionField = {
|
|
28
|
+
id: "default_comment_status",
|
|
29
|
+
type: "text",
|
|
30
|
+
label: (0, import_i18n.__)("Discussion"),
|
|
31
|
+
Edit: "radio",
|
|
32
|
+
getValue: ({ item }) => item.default_comment_status || "",
|
|
33
|
+
setValue: ({ value }) => ({
|
|
34
|
+
default_comment_status: value || null
|
|
35
|
+
}),
|
|
36
|
+
render: ({ item }) => {
|
|
37
|
+
return item.default_comment_status === "open" ? (0, import_i18n.__)("Comments open") : (0, import_i18n.__)("Comments closed");
|
|
38
|
+
},
|
|
39
|
+
elements: [
|
|
40
|
+
{
|
|
41
|
+
value: "open",
|
|
42
|
+
label: (0, import_i18n.__)("Open"),
|
|
43
|
+
description: (0, import_i18n.__)("Visitors can add new comments and replies.")
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
value: "",
|
|
47
|
+
label: (0, import_i18n.__)("Closed"),
|
|
48
|
+
description: (0, import_i18n.__)(
|
|
49
|
+
"Visitors cannot add new comments or replies. Existing comments remain visible."
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
enableSorting: false,
|
|
54
|
+
enableHiding: false,
|
|
55
|
+
filterBy: false
|
|
56
|
+
};
|
|
57
|
+
var site_discussion_default = siteDiscussionField;
|
|
58
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/site-discussion/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 { SiteSettings } from '../../types';\n\nconst siteDiscussionField: Field< SiteSettings > = {\n\tid: 'default_comment_status',\n\ttype: 'text',\n\tlabel: __( 'Discussion' ),\n\tEdit: 'radio',\n\tgetValue: ( { item } ) => item.default_comment_status || '',\n\tsetValue: ( { value } ) => ( {\n\t\tdefault_comment_status: value || null,\n\t} ),\n\trender: ( { item } ) => {\n\t\treturn item.default_comment_status === 'open'\n\t\t\t? __( 'Comments open' )\n\t\t\t: __( 'Comments closed' );\n\t},\n\telements: [\n\t\t{\n\t\t\tvalue: 'open',\n\t\t\tlabel: __( 'Open' ),\n\t\t\tdescription: __( 'Visitors can add new comments and replies.' ),\n\t\t},\n\t\t{\n\t\t\tvalue: '',\n\t\t\tlabel: __( 'Closed' ),\n\t\t\tdescription: __(\n\t\t\t\t'Visitors cannot add new comments or replies. Existing comments remain visible.'\n\t\t\t),\n\t\t},\n\t],\n\tenableSorting: false,\n\tenableHiding: false,\n\tfilterBy: false,\n};\n\n/**\n * Discussion field for the `root/site` entity.\n */\nexport default siteDiscussionField;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmB;AAOnB,IAAM,sBAA6C;AAAA,EAClD,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,YAAa;AAAA,EACxB,MAAM;AAAA,EACN,UAAU,CAAE,EAAE,KAAK,MAAO,KAAK,0BAA0B;AAAA,EACzD,UAAU,CAAE,EAAE,MAAM,OAAS;AAAA,IAC5B,wBAAwB,SAAS;AAAA,EAClC;AAAA,EACA,QAAQ,CAAE,EAAE,KAAK,MAAO;AACvB,WAAO,KAAK,2BAA2B,aACpC,gBAAI,eAAgB,QACpB,gBAAI,iBAAkB;AAAA,EAC1B;AAAA,EACA,UAAU;AAAA,IACT;AAAA,MACC,OAAO;AAAA,MACP,WAAO,gBAAI,MAAO;AAAA,MAClB,iBAAa,gBAAI,4CAA6C;AAAA,IAC/D;AAAA,IACA;AAAA,MACC,OAAO;AAAA,MACP,WAAO,gBAAI,QAAS;AAAA,MACpB,iBAAa;AAAA,QACZ;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAU;AACX;AAKA,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -37,10 +37,10 @@ var import_i18n = require("@wordpress/i18n");
|
|
|
37
37
|
var import_utils = require("../../actions/utils.cjs");
|
|
38
38
|
var import_view = __toESM(require("../title/view.cjs"));
|
|
39
39
|
var templateTitleField = {
|
|
40
|
+
id: "title",
|
|
40
41
|
type: "text",
|
|
41
42
|
label: (0, import_i18n.__)("Template"),
|
|
42
43
|
placeholder: (0, import_i18n.__)("No title"),
|
|
43
|
-
id: "title",
|
|
44
44
|
getValue: ({ item }) => (0, import_utils.getItemTitle)(item),
|
|
45
45
|
render: import_view.default,
|
|
46
46
|
enableHiding: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/template-title/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 { Template } from '../../types';\nimport { getItemTitle } from '../../actions/utils';\nimport TitleView from '../title/view';\n\nconst templateTitleField: Field< Template > = {\n\ttype: 'text',\n\tlabel: __( 'Template' ),\n\tplaceholder: __( 'No title' ),\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmB;AAMnB,mBAA6B;AAC7B,kBAAsB;AAEtB,IAAM,qBAAwC;AAAA,EAC7C,MAAM;AAAA,EACN,WAAO,gBAAI,UAAW;AAAA,EACtB,iBAAa,gBAAI,UAAW;AAAA,EAC5B,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { Template } from '../../types';\nimport { getItemTitle } from '../../actions/utils';\nimport TitleView from '../title/view';\n\nconst templateTitleField: Field< Template > = {\n\tid: 'title',\n\ttype: 'text',\n\tlabel: __( 'Template' ),\n\tplaceholder: __( 'No title' ),\n\tgetValue: ( { item } ) => getItemTitle( item ),\n\trender: TitleView,\n\tenableHiding: false,\n\tenableGlobalSearch: true,\n\tfilterBy: false,\n};\n\n/**\n * Title for the template entity.\n */\nexport default templateTitleField;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmB;AAMnB,mBAA6B;AAC7B,kBAAsB;AAEtB,IAAM,qBAAwC;AAAA,EAC7C,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,UAAW;AAAA,EACtB,iBAAa,gBAAI,UAAW;AAAA,EAC5B,UAAU,CAAE,EAAE,KAAK,UAAO,2BAAc,IAAK;AAAA,EAC7C,QAAQ,YAAAA;AAAA,EACR,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,UAAU;AACX;AAKA,IAAO,yBAAQ;",
|
|
6
6
|
"names": ["TitleView"]
|
|
7
7
|
}
|
package/build/types.cjs.map
CHANGED
|
@@ -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\tsticky?: boolean;\n\tpermalink_template?: string;\n\tdate?: string;\n\tmodified?: string;\n\tauthor?: number;\n}\n\nexport interface BasePostWithEditedEntity extends Omit< BasePost, 'content' > {\n\tcontent:\n\t\t| BasePost[ 'content' ]\n\t\t| ( ( record: BasePostWithEditedEntity ) => string );\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\texcerpt?: 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 * Use ['*'] to allow all file types.\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\tsticky?: boolean;\n\tpermalink_template?: string;\n\tdate?: string;\n\tmodified?: string;\n\tauthor?: number;\n}\n\nexport interface BasePostWithEditedEntity extends Omit< BasePost, 'content' > {\n\tcontent:\n\t\t| BasePost[ 'content' ]\n\t\t| ( ( record: BasePostWithEditedEntity ) => string );\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\tdescription?: 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 interface SiteSettings {\n\tposts_per_page?: number;\n\tdefault_comment_status?: string | null;\n}\n\nexport interface PostsPage {\n\ttitle?: { raw?: string } | 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\texcerpt?: 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 * Use ['*'] to allow all file types.\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
|
}
|
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
__experimentalTruncate as Truncate,
|
|
10
10
|
__experimentalVStack as VStack,
|
|
11
11
|
__experimentalHStack as HStack,
|
|
12
|
-
BaseControl
|
|
13
|
-
Tooltip as WCTooltip
|
|
12
|
+
BaseControl
|
|
14
13
|
} from "@wordpress/components";
|
|
15
14
|
import { isBlobURL, getBlobTypeByURL } from "@wordpress/blob";
|
|
16
15
|
import { store as coreStore } from "@wordpress/core-data";
|
|
@@ -35,7 +34,7 @@ import {
|
|
|
35
34
|
chevronLeft,
|
|
36
35
|
chevronRight
|
|
37
36
|
} from "@wordpress/icons";
|
|
38
|
-
import { VisuallyHidden } from "@wordpress/ui";
|
|
37
|
+
import { VisuallyHidden, Tooltip } from "@wordpress/ui";
|
|
39
38
|
import {
|
|
40
39
|
MediaUpload,
|
|
41
40
|
uploadMedia,
|
|
@@ -141,7 +140,10 @@ function MediaPickerButton({
|
|
|
141
140
|
if (!showTooltip) {
|
|
142
141
|
return mediaPickerButton;
|
|
143
142
|
}
|
|
144
|
-
return /* @__PURE__ */
|
|
143
|
+
return /* @__PURE__ */ jsxs(Tooltip.Root, { children: [
|
|
144
|
+
/* @__PURE__ */ jsx(Tooltip.Trigger, { render: mediaPickerButton }),
|
|
145
|
+
/* @__PURE__ */ jsx(Tooltip.Popup, { children: label })
|
|
146
|
+
] });
|
|
145
147
|
}
|
|
146
148
|
var archiveMimeTypes = [
|
|
147
149
|
"application/zip",
|