@wordpress/block-library 9.29.1-next.e256d081a.0 → 9.30.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/accordion/edit.js +18 -1
- package/build/accordion/edit.js.map +1 -1
- package/build/accordion/index.js +0 -3
- package/build/accordion/index.js.map +1 -1
- package/build/accordion-content/index.js +0 -4
- package/build/accordion-content/index.js.map +1 -1
- package/build/accordion-header/index.js +0 -4
- package/build/accordion-header/index.js.map +1 -1
- package/build/accordion-panel/edit.js +5 -30
- package/build/accordion-panel/edit.js.map +1 -1
- package/build/accordion-panel/index.js +0 -4
- package/build/accordion-panel/index.js.map +1 -1
- package/build/accordion-panel/save.js +3 -29
- package/build/accordion-panel/save.js.map +1 -1
- package/build/gallery/index.js +2 -1
- package/build/gallery/index.js.map +1 -1
- package/build/group/variations.js +0 -12
- package/build/group/variations.js.map +1 -1
- package/build/navigation-link/link-ui.js +5 -1
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build-module/accordion/edit.js +20 -3
- package/build-module/accordion/edit.js.map +1 -1
- package/build-module/accordion/index.js +0 -3
- package/build-module/accordion/index.js.map +1 -1
- package/build-module/accordion-content/index.js +0 -4
- package/build-module/accordion-content/index.js.map +1 -1
- package/build-module/accordion-header/index.js +0 -4
- package/build-module/accordion-header/index.js.map +1 -1
- package/build-module/accordion-panel/edit.js +6 -29
- package/build-module/accordion-panel/edit.js.map +1 -1
- package/build-module/accordion-panel/index.js +0 -4
- package/build-module/accordion-panel/index.js.map +1 -1
- package/build-module/accordion-panel/save.js +4 -28
- package/build-module/accordion-panel/save.js.map +1 -1
- package/build-module/gallery/index.js +2 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/group/variations.js +0 -12
- package/build-module/group/variations.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +6 -2
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-style/accordion/style-rtl.css +4 -13
- package/build-style/accordion/style.css +4 -13
- package/build-style/style-rtl.css +4 -14
- package/build-style/style.css +4 -14
- package/package.json +35 -35
- package/src/accordion/block.json +0 -3
- package/src/accordion/edit.js +20 -0
- package/src/accordion/style.scss +7 -16
- package/src/accordion-content/block.json +0 -3
- package/src/accordion-content/index.js +0 -1
- package/src/accordion-header/block.json +0 -3
- package/src/accordion-header/index.js +0 -1
- package/src/accordion-panel/block.json +0 -3
- package/src/accordion-panel/edit.js +11 -51
- package/src/accordion-panel/index.js +0 -1
- package/src/accordion-panel/save.js +4 -45
- package/src/gallery/block.json +2 -1
- package/src/gallery/index.php +1 -1
- package/src/gallery/test/helpers.native.js +3 -3
- package/src/group/variations.js +0 -12
- package/src/navigation-link/link-ui.js +7 -1
- package/src/post-date/index.php +2 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
5
5
|
import { Popover, Button, VisuallyHidden, __experimentalVStack as VStack } from '@wordpress/components';
|
|
6
6
|
import { __, sprintf, isRTL } from '@wordpress/i18n';
|
|
7
|
-
import { LinkControl, store as blockEditorStore, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
7
|
+
import { LinkControl, store as blockEditorStore, privateApis as blockEditorPrivateApis, useBlockEditingMode } from '@wordpress/block-editor';
|
|
8
8
|
import { createInterpolateElement, useMemo, useState, useRef, useEffect, forwardRef } from '@wordpress/element';
|
|
9
9
|
import { store as coreStore, useResourcePermissions } from '@wordpress/core-data';
|
|
10
10
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
@@ -146,6 +146,10 @@ function UnforwardedLinkUI(props, ref) {
|
|
|
146
146
|
kind: 'postType',
|
|
147
147
|
name: postType
|
|
148
148
|
});
|
|
149
|
+
|
|
150
|
+
// Check if we're in contentOnly mode
|
|
151
|
+
const blockEditingMode = useBlockEditingMode();
|
|
152
|
+
const isDefaultBlockEditingMode = blockEditingMode === 'default';
|
|
149
153
|
async function handleCreate(pageTitle) {
|
|
150
154
|
const page = await saveEntityRecord('postType', postType, {
|
|
151
155
|
title: pageTitle,
|
|
@@ -223,7 +227,7 @@ function UnforwardedLinkUI(props, ref) {
|
|
|
223
227
|
onChange: props.onChange,
|
|
224
228
|
onRemove: props.onRemove,
|
|
225
229
|
onCancel: props.onCancel,
|
|
226
|
-
renderControlBottom: () => !link?.url?.length && /*#__PURE__*/_jsx(LinkUITools, {
|
|
230
|
+
renderControlBottom: () => !link?.url?.length && isDefaultBlockEditingMode && /*#__PURE__*/_jsx(LinkUITools, {
|
|
227
231
|
focusAddBlockButton: focusAddBlockButton,
|
|
228
232
|
setAddingBlock: () => {
|
|
229
233
|
setAddingBlock(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__unstableStripHTML","stripHTML","Popover","Button","VisuallyHidden","__experimentalVStack","VStack","__","sprintf","isRTL","LinkControl","store","blockEditorStore","privateApis","blockEditorPrivateApis","createInterpolateElement","useMemo","useState","useRef","useEffect","forwardRef","coreStore","useResourcePermissions","decodeEntities","useSelect","useDispatch","chevronLeftSmall","chevronRightSmall","plus","useInstanceId","useFocusOnMount","unlock","jsx","_jsx","jsxs","_jsxs","PrivateQuickInserter","QuickInserter","getSuggestionsQuery","type","kind","subtype","initialSuggestionsSearchOptions","perPage","LinkUIBlockInserter","clientId","onBack","rootBlockClientId","select","getBlockRootClientId","focusOnMountRef","dialogTitleId","dialogDescriptionId","className","role","ref","children","id","icon","onClick","e","preventDefault","size","rootClientId","isAppender","prioritizePatterns","selectBlockOnInsert","hasSearch","UnforwardedLinkUI","props","label","url","opensInNewTab","link","postType","addingBlock","setAddingBlock","focusAddBlockButton","setFocusAddBlockButton","saveEntityRecord","permissions","name","handleCreate","pageTitle","page","title","status","rendered","LinkUI","placement","onClose","anchor","shift","hasTextControl","hasRichPreviews","value","showInitialSuggestions","withCreateSuggestion","canCreate","createSuggestion","createSuggestionButtonText","searchTerm","format","mark","noDirectEntry","noURLSuggestion","suggestionsQuery","onChange","onRemove","onCancel","renderControlBottom","length","LinkUITools","blockInserterAriaRole","addBlockButtonRef","current","focus","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/navigation-link/link-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tPopover,\n\tButton,\n\tVisuallyHidden,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tLinkControl,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tcreateInterpolateElement,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tforwardRef,\n} from '@wordpress/element';\nimport {\n\tstore as coreStore,\n\tuseResourcePermissions,\n} from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { chevronLeftSmall, chevronRightSmall, plus } from '@wordpress/icons';\nimport { useInstanceId, useFocusOnMount } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { PrivateQuickInserter: QuickInserter } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nexport function getSuggestionsQuery( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t// for custom link which has no type\n\t\t\t\t// always show pages as initial suggestions\n\t\t\t\tinitialSuggestionsSearchOptions: {\n\t\t\t\t\ttype: 'post',\n\t\t\t\t\tsubtype: 'page',\n\t\t\t\t\tperPage: 20,\n\t\t\t\t},\n\t\t\t};\n\t}\n}\n\nfunction LinkUIBlockInserter( { clientId, onBack } ) {\n\tconst { rootBlockClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId } = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\trootBlockClientId: getBlockRootClientId( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\tconst dialogTitleId = useInstanceId(\n\t\tLinkControl,\n\t\t`link-ui-block-inserter__title`\n\t);\n\tconst dialogDescriptionId = useInstanceId(\n\t\tLinkControl,\n\t\t`link-ui-block-inserter__description`\n\t);\n\n\tif ( ! clientId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"link-ui-block-inserter\"\n\t\t\trole=\"dialog\"\n\t\t\taria-labelledby={ dialogTitleId }\n\t\t\taria-describedby={ dialogDescriptionId }\n\t\t\tref={ focusOnMountRef }\n\t\t>\n\t\t\t<VisuallyHidden>\n\t\t\t\t<h2 id={ dialogTitleId }>{ __( 'Add block' ) }</h2>\n\n\t\t\t\t<p id={ dialogDescriptionId }>\n\t\t\t\t\t{ __( 'Choose a block to add to your Navigation.' ) }\n\t\t\t\t</p>\n\t\t\t</VisuallyHidden>\n\n\t\t\t<Button\n\t\t\t\tclassName=\"link-ui-block-inserter__back\"\n\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tonBack();\n\t\t\t\t} }\n\t\t\t\tsize=\"small\"\n\t\t\t>\n\t\t\t\t{ __( 'Back' ) }\n\t\t\t</Button>\n\n\t\t\t<QuickInserter\n\t\t\t\trootClientId={ rootBlockClientId }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisAppender={ false }\n\t\t\t\tprioritizePatterns={ false }\n\t\t\t\tselectBlockOnInsert\n\t\t\t\thasSearch={ false }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction UnforwardedLinkUI( props, ref ) {\n\tconst { label, url, opensInNewTab, type, kind } = props.link;\n\tconst postType = type || 'page';\n\n\tconst [ addingBlock, setAddingBlock ] = useState( false );\n\tconst [ focusAddBlockButton, setFocusAddBlockButton ] = useState( false );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst permissions = useResourcePermissions( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t} );\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst page = await saveEntityRecord( 'postType', postType, {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: postType,\n\t\t\t// Make `title` property consistent with that in `fetchLinkSuggestions` where the `rendered` title (containing HTML entities)\n\t\t\t// is also being decoded. By being consistent in both locations we avoid having to branch in the rendering output code.\n\t\t\t// Ideally in the future we will update both APIs to utilise the \"raw\" form of the title which is better suited to edit contexts.\n\t\t\t// e.g.\n\t\t\t// - title.raw = \"Yes & No\"\n\t\t\t// - title.rendered = \"Yes & No\"\n\t\t\t// - decodeEntities( title.rendered ) = \"Yes & No\"\n\t\t\t// See:\n\t\t\t// - https://github.com/WordPress/gutenberg/pull/41063\n\t\t\t// - https://github.com/WordPress/gutenberg/blob/a1e1fdc0e6278457e9f4fc0b31ac6d2095f5450b/packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js#L212-L218\n\t\t\ttitle: decodeEntities( page.title.rendered ),\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/50976#issuecomment-1568226407.\n\tconst link = useMemo(\n\t\t() => ( {\n\t\t\turl,\n\t\t\topensInNewTab,\n\t\t\ttitle: label && stripHTML( label ),\n\t\t} ),\n\t\t[ label, opensInNewTab, url ]\n\t);\n\n\tconst dialogTitleId = useInstanceId(\n\t\tLinkUI,\n\t\t`link-ui-link-control__title`\n\t);\n\tconst dialogDescriptionId = useInstanceId(\n\t\tLinkUI,\n\t\t`link-ui-link-control__description`\n\t);\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ ref }\n\t\t\tplacement=\"bottom\"\n\t\t\tonClose={ props.onClose }\n\t\t\tanchor={ props.anchor }\n\t\t\tshift\n\t\t>\n\t\t\t{ ! addingBlock && (\n\t\t\t\t<div\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\taria-labelledby={ dialogTitleId }\n\t\t\t\t\taria-describedby={ dialogDescriptionId }\n\t\t\t\t>\n\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t<h2 id={ dialogTitleId }>{ __( 'Add link' ) }</h2>\n\n\t\t\t\t\t\t<p id={ dialogDescriptionId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Search for and add a link to your Navigation.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t<LinkControl\n\t\t\t\t\t\thasTextControl\n\t\t\t\t\t\thasRichPreviews\n\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t\twithCreateSuggestion={ permissions.canCreate }\n\t\t\t\t\t\tcreateSuggestion={ handleCreate }\n\t\t\t\t\t\tcreateSuggestionButtonText={ ( searchTerm ) => {\n\t\t\t\t\t\t\tlet format;\n\n\t\t\t\t\t\t\tif ( type === 'post' ) {\n\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t'Create draft post: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t'Create draft page: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf( format, searchTerm ),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmark: <mark />,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tnoDirectEntry={ !! type }\n\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery( type, kind ) }\n\t\t\t\t\t\tonChange={ props.onChange }\n\t\t\t\t\t\tonRemove={ props.onRemove }\n\t\t\t\t\t\tonCancel={ props.onCancel }\n\t\t\t\t\t\trenderControlBottom={ () =>\n\t\t\t\t\t\t\t! link?.url?.length && (\n\t\t\t\t\t\t\t\t<LinkUITools\n\t\t\t\t\t\t\t\t\tfocusAddBlockButton={ focusAddBlockButton }\n\t\t\t\t\t\t\t\t\tsetAddingBlock={ () => {\n\t\t\t\t\t\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t\t\t\t\t\t\tsetFocusAddBlockButton( false );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ addingBlock && (\n\t\t\t\t<LinkUIBlockInserter\n\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\tonBack={ () => {\n\t\t\t\t\t\tsetAddingBlock( false );\n\t\t\t\t\t\tsetFocusAddBlockButton( true );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nexport const LinkUI = forwardRef( UnforwardedLinkUI );\n\nconst LinkUITools = ( { setAddingBlock, focusAddBlockButton } ) => {\n\tconst blockInserterAriaRole = 'listbox';\n\tconst addBlockButtonRef = useRef();\n\n\t// Focus the add block button when the popover is opened.\n\tuseEffect( () => {\n\t\tif ( focusAddBlockButton ) {\n\t\t\taddBlockButtonRef.current?.focus();\n\t\t}\n\t}, [ focusAddBlockButton ] );\n\n\treturn (\n\t\t<VStack className=\"link-ui-tools\">\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tref={ addBlockButtonRef }\n\t\t\t\ticon={ plus }\n\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t} }\n\t\t\t\taria-haspopup={ blockInserterAriaRole }\n\t\t\t>\n\t\t\t\t{ __( 'Add block' ) }\n\t\t\t</Button>\n\t\t</VStack>\n\t);\n};\n\nexport default LinkUITools;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;AACjE,SACCC,OAAO,EACPC,MAAM,EACNC,cAAc,EACdC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,EAAEC,KAAK,QAAQ,iBAAiB;AACpD,SACCC,WAAW,EACXC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SACCC,wBAAwB,EACxBC,OAAO,EACPC,QAAQ,EACRC,MAAM,EACNC,SAAS,EACTC,UAAU,QACJ,oBAAoB;AAC3B,SACCT,KAAK,IAAIU,SAAS,EAClBC,sBAAsB,QAChB,sBAAsB;AAC7B,SAASC,cAAc,QAAQ,0BAA0B;AACzD,S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AS,CAAE,MAAM;IAChB,IAAK0D,mBAAmB,EAAG;MAC1BqC,iBAAiB,CAACC,OAAO,EAAEC,KAAK,CAAC,CAAC;IACnC;EACD,CAAC,EAAE,CAAEvC,mBAAmB,CAAG,CAAC;EAE5B,oBACC5C,IAAA,CAAC3B,MAAM;IAAC+C,SAAS,EAAC,eAAe;IAAAG,QAAA,eAChCvB,IAAA,CAAC9B,MAAM;MACNkH,qBAAqB;MACrB9D,GAAG,EAAG2D,iBAAmB;MACzBxD,IAAI,EAAG9B,IAAM;MACb+B,OAAO,EAAKC,CAAC,IAAM;QAClBA,CAAC,CAACC,cAAc,CAAC,CAAC;QAClBe,cAAc,CAAE,IAAK,CAAC;MACvB,CAAG;MACH,iBAAgBqC,qBAAuB;MAAAzD,QAAA,EAErCjD,EAAE,CAAE,WAAY;IAAC,CACZ;EAAC,CACF,CAAC;AAEX,CAAC;AAED,eAAeyG,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__unstableStripHTML","stripHTML","Popover","Button","VisuallyHidden","__experimentalVStack","VStack","__","sprintf","isRTL","LinkControl","store","blockEditorStore","privateApis","blockEditorPrivateApis","useBlockEditingMode","createInterpolateElement","useMemo","useState","useRef","useEffect","forwardRef","coreStore","useResourcePermissions","decodeEntities","useSelect","useDispatch","chevronLeftSmall","chevronRightSmall","plus","useInstanceId","useFocusOnMount","unlock","jsx","_jsx","jsxs","_jsxs","PrivateQuickInserter","QuickInserter","getSuggestionsQuery","type","kind","subtype","initialSuggestionsSearchOptions","perPage","LinkUIBlockInserter","clientId","onBack","rootBlockClientId","select","getBlockRootClientId","focusOnMountRef","dialogTitleId","dialogDescriptionId","className","role","ref","children","id","icon","onClick","e","preventDefault","size","rootClientId","isAppender","prioritizePatterns","selectBlockOnInsert","hasSearch","UnforwardedLinkUI","props","label","url","opensInNewTab","link","postType","addingBlock","setAddingBlock","focusAddBlockButton","setFocusAddBlockButton","saveEntityRecord","permissions","name","blockEditingMode","isDefaultBlockEditingMode","handleCreate","pageTitle","page","title","status","rendered","LinkUI","placement","onClose","anchor","shift","hasTextControl","hasRichPreviews","value","showInitialSuggestions","withCreateSuggestion","canCreate","createSuggestion","createSuggestionButtonText","searchTerm","format","mark","noDirectEntry","noURLSuggestion","suggestionsQuery","onChange","onRemove","onCancel","renderControlBottom","length","LinkUITools","blockInserterAriaRole","addBlockButtonRef","current","focus","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/navigation-link/link-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tPopover,\n\tButton,\n\tVisuallyHidden,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tLinkControl,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport {\n\tcreateInterpolateElement,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tforwardRef,\n} from '@wordpress/element';\nimport {\n\tstore as coreStore,\n\tuseResourcePermissions,\n} from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { chevronLeftSmall, chevronRightSmall, plus } from '@wordpress/icons';\nimport { useInstanceId, useFocusOnMount } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { PrivateQuickInserter: QuickInserter } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nexport function getSuggestionsQuery( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t// for custom link which has no type\n\t\t\t\t// always show pages as initial suggestions\n\t\t\t\tinitialSuggestionsSearchOptions: {\n\t\t\t\t\ttype: 'post',\n\t\t\t\t\tsubtype: 'page',\n\t\t\t\t\tperPage: 20,\n\t\t\t\t},\n\t\t\t};\n\t}\n}\n\nfunction LinkUIBlockInserter( { clientId, onBack } ) {\n\tconst { rootBlockClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId } = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\trootBlockClientId: getBlockRootClientId( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\tconst dialogTitleId = useInstanceId(\n\t\tLinkControl,\n\t\t`link-ui-block-inserter__title`\n\t);\n\tconst dialogDescriptionId = useInstanceId(\n\t\tLinkControl,\n\t\t`link-ui-block-inserter__description`\n\t);\n\n\tif ( ! clientId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"link-ui-block-inserter\"\n\t\t\trole=\"dialog\"\n\t\t\taria-labelledby={ dialogTitleId }\n\t\t\taria-describedby={ dialogDescriptionId }\n\t\t\tref={ focusOnMountRef }\n\t\t>\n\t\t\t<VisuallyHidden>\n\t\t\t\t<h2 id={ dialogTitleId }>{ __( 'Add block' ) }</h2>\n\n\t\t\t\t<p id={ dialogDescriptionId }>\n\t\t\t\t\t{ __( 'Choose a block to add to your Navigation.' ) }\n\t\t\t\t</p>\n\t\t\t</VisuallyHidden>\n\n\t\t\t<Button\n\t\t\t\tclassName=\"link-ui-block-inserter__back\"\n\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tonBack();\n\t\t\t\t} }\n\t\t\t\tsize=\"small\"\n\t\t\t>\n\t\t\t\t{ __( 'Back' ) }\n\t\t\t</Button>\n\n\t\t\t<QuickInserter\n\t\t\t\trootClientId={ rootBlockClientId }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisAppender={ false }\n\t\t\t\tprioritizePatterns={ false }\n\t\t\t\tselectBlockOnInsert\n\t\t\t\thasSearch={ false }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction UnforwardedLinkUI( props, ref ) {\n\tconst { label, url, opensInNewTab, type, kind } = props.link;\n\tconst postType = type || 'page';\n\n\tconst [ addingBlock, setAddingBlock ] = useState( false );\n\tconst [ focusAddBlockButton, setFocusAddBlockButton ] = useState( false );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst permissions = useResourcePermissions( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t} );\n\n\t// Check if we're in contentOnly mode\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isDefaultBlockEditingMode = blockEditingMode === 'default';\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst page = await saveEntityRecord( 'postType', postType, {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: postType,\n\t\t\t// Make `title` property consistent with that in `fetchLinkSuggestions` where the `rendered` title (containing HTML entities)\n\t\t\t// is also being decoded. By being consistent in both locations we avoid having to branch in the rendering output code.\n\t\t\t// Ideally in the future we will update both APIs to utilise the \"raw\" form of the title which is better suited to edit contexts.\n\t\t\t// e.g.\n\t\t\t// - title.raw = \"Yes & No\"\n\t\t\t// - title.rendered = \"Yes & No\"\n\t\t\t// - decodeEntities( title.rendered ) = \"Yes & No\"\n\t\t\t// See:\n\t\t\t// - https://github.com/WordPress/gutenberg/pull/41063\n\t\t\t// - https://github.com/WordPress/gutenberg/blob/a1e1fdc0e6278457e9f4fc0b31ac6d2095f5450b/packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js#L212-L218\n\t\t\ttitle: decodeEntities( page.title.rendered ),\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/50976#issuecomment-1568226407.\n\tconst link = useMemo(\n\t\t() => ( {\n\t\t\turl,\n\t\t\topensInNewTab,\n\t\t\ttitle: label && stripHTML( label ),\n\t\t} ),\n\t\t[ label, opensInNewTab, url ]\n\t);\n\n\tconst dialogTitleId = useInstanceId(\n\t\tLinkUI,\n\t\t`link-ui-link-control__title`\n\t);\n\tconst dialogDescriptionId = useInstanceId(\n\t\tLinkUI,\n\t\t`link-ui-link-control__description`\n\t);\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ ref }\n\t\t\tplacement=\"bottom\"\n\t\t\tonClose={ props.onClose }\n\t\t\tanchor={ props.anchor }\n\t\t\tshift\n\t\t>\n\t\t\t{ ! addingBlock && (\n\t\t\t\t<div\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\taria-labelledby={ dialogTitleId }\n\t\t\t\t\taria-describedby={ dialogDescriptionId }\n\t\t\t\t>\n\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t<h2 id={ dialogTitleId }>{ __( 'Add link' ) }</h2>\n\n\t\t\t\t\t\t<p id={ dialogDescriptionId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Search for and add a link to your Navigation.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t<LinkControl\n\t\t\t\t\t\thasTextControl\n\t\t\t\t\t\thasRichPreviews\n\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t\twithCreateSuggestion={ permissions.canCreate }\n\t\t\t\t\t\tcreateSuggestion={ handleCreate }\n\t\t\t\t\t\tcreateSuggestionButtonText={ ( searchTerm ) => {\n\t\t\t\t\t\t\tlet format;\n\n\t\t\t\t\t\t\tif ( type === 'post' ) {\n\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t'Create draft post: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t'Create draft page: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf( format, searchTerm ),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmark: <mark />,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tnoDirectEntry={ !! type }\n\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery( type, kind ) }\n\t\t\t\t\t\tonChange={ props.onChange }\n\t\t\t\t\t\tonRemove={ props.onRemove }\n\t\t\t\t\t\tonCancel={ props.onCancel }\n\t\t\t\t\t\trenderControlBottom={ () =>\n\t\t\t\t\t\t\t! link?.url?.length &&\n\t\t\t\t\t\t\tisDefaultBlockEditingMode && (\n\t\t\t\t\t\t\t\t<LinkUITools\n\t\t\t\t\t\t\t\t\tfocusAddBlockButton={ focusAddBlockButton }\n\t\t\t\t\t\t\t\t\tsetAddingBlock={ () => {\n\t\t\t\t\t\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t\t\t\t\t\t\tsetFocusAddBlockButton( false );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ addingBlock && (\n\t\t\t\t<LinkUIBlockInserter\n\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\tonBack={ () => {\n\t\t\t\t\t\tsetAddingBlock( false );\n\t\t\t\t\t\tsetFocusAddBlockButton( true );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nexport const LinkUI = forwardRef( UnforwardedLinkUI );\n\nconst LinkUITools = ( { setAddingBlock, focusAddBlockButton } ) => {\n\tconst blockInserterAriaRole = 'listbox';\n\tconst addBlockButtonRef = useRef();\n\n\t// Focus the add block button when the popover is opened.\n\tuseEffect( () => {\n\t\tif ( focusAddBlockButton ) {\n\t\t\taddBlockButtonRef.current?.focus();\n\t\t}\n\t}, [ focusAddBlockButton ] );\n\n\treturn (\n\t\t<VStack className=\"link-ui-tools\">\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tref={ addBlockButtonRef }\n\t\t\t\ticon={ plus }\n\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t} }\n\t\t\t\taria-haspopup={ blockInserterAriaRole }\n\t\t\t>\n\t\t\t\t{ __( 'Add block' ) }\n\t\t\t</Button>\n\t\t</VStack>\n\t);\n};\n\nexport default LinkUITools;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;AACjE,SACCC,OAAO,EACPC,MAAM,EACNC,cAAc,EACdC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,EAA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AAW,iBACZ1C,IAAA,CAACW,mBAAmB;MACnBC,QAAQ,EAAGwB,KAAK,CAACxB,QAAU;MAC3BC,MAAM,EAAGA,CAAA,KAAM;QACd8B,cAAc,CAAE,KAAM,CAAC;QACvBE,sBAAsB,CAAE,IAAK,CAAC;MAC/B;IAAG,CACH,CACD;EAAA,CACO,CAAC;AAEZ;AAEA,OAAO,MAAMY,MAAM,GAAGtE,UAAU,CAAEgD,iBAAkB,CAAC;AAErD,MAAM8C,WAAW,GAAGA,CAAE;EAAEtC,cAAc;EAAEC;AAAoB,CAAC,KAAM;EAClE,MAAMsC,qBAAqB,GAAG,SAAS;EACvC,MAAMC,iBAAiB,GAAGlG,MAAM,CAAC,CAAC;;EAElC;EACAC,SAAS,CAAE,MAAM;IAChB,IAAK0D,mBAAmB,EAAG;MAC1BuC,iBAAiB,CAACC,OAAO,EAAEC,KAAK,CAAC,CAAC;IACnC;EACD,CAAC,EAAE,CAAEzC,mBAAmB,CAAG,CAAC;EAE5B,oBACC5C,IAAA,CAAC5B,MAAM;IAACgD,SAAS,EAAC,eAAe;IAAAG,QAAA,eAChCvB,IAAA,CAAC/B,MAAM;MACNqH,qBAAqB;MACrBhE,GAAG,EAAG6D,iBAAmB;MACzB1D,IAAI,EAAG9B,IAAM;MACb+B,OAAO,EAAKC,CAAC,IAAM;QAClBA,CAAC,CAACC,cAAc,CAAC,CAAC;QAClBe,cAAc,CAAE,IAAK,CAAC;MACvB,CAAG;MACH,iBAAgBuC,qBAAuB;MAAA3D,QAAA,EAErClD,EAAE,CAAE,WAAY;IAAC,CACZ;EAAC,CACF,CAAC;AAEX,CAAC;AAED,eAAe4G,WAAW","ignoreList":[]}
|
|
@@ -142,6 +142,9 @@
|
|
|
142
142
|
.wp-block-accordion-content.is-open {
|
|
143
143
|
grid-template-rows: max-content 1fr;
|
|
144
144
|
}
|
|
145
|
+
.wp-block-accordion-content.is-open > .wp-block-accordion-header .accordion-content__toggle-icon.has-icon-plus {
|
|
146
|
+
transform: rotate(-45deg);
|
|
147
|
+
}
|
|
145
148
|
|
|
146
149
|
.accordion-content__heading {
|
|
147
150
|
margin-block-start: 0;
|
|
@@ -163,6 +166,7 @@
|
|
|
163
166
|
padding: var(--wp--preset--spacing--20, 1em) 0;
|
|
164
167
|
cursor: pointer;
|
|
165
168
|
outline: none;
|
|
169
|
+
overflow: hidden;
|
|
166
170
|
display: flex;
|
|
167
171
|
align-items: center;
|
|
168
172
|
text-align: inherit;
|
|
@@ -194,16 +198,6 @@
|
|
|
194
198
|
flex-direction: row-reverse;
|
|
195
199
|
}
|
|
196
200
|
|
|
197
|
-
/* RTL language support */
|
|
198
|
-
[dir=rtl] .wp-block-accordion-header:not(.icon-position-left) .accordion-content__toggle {
|
|
199
|
-
/* stylelint-disable-next-line declaration-property-value-allowed-list -- Automatically adjust icon position for RTL languages. */
|
|
200
|
-
flex-direction: row-reverse;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
[dir=rtl] .wp-block-accordion-header.icon-position-left .accordion-content__toggle {
|
|
204
|
-
flex-direction: row;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
201
|
.accordion-content__toggle:focus-visible {
|
|
208
202
|
outline: 2px solid -webkit-focus-ring-color;
|
|
209
203
|
outline-offset: 2px;
|
|
@@ -217,7 +211,4 @@
|
|
|
217
211
|
.wp-block-accordion-content {
|
|
218
212
|
transition: grid-template-rows 0.3s ease-out;
|
|
219
213
|
}
|
|
220
|
-
}
|
|
221
|
-
.is-open .accordion-content__toggle-icon.has-icon-plus {
|
|
222
|
-
transform: rotate(-45deg);
|
|
223
214
|
}
|
|
@@ -142,6 +142,9 @@
|
|
|
142
142
|
.wp-block-accordion-content.is-open {
|
|
143
143
|
grid-template-rows: max-content 1fr;
|
|
144
144
|
}
|
|
145
|
+
.wp-block-accordion-content.is-open > .wp-block-accordion-header .accordion-content__toggle-icon.has-icon-plus {
|
|
146
|
+
transform: rotate(45deg);
|
|
147
|
+
}
|
|
145
148
|
|
|
146
149
|
.accordion-content__heading {
|
|
147
150
|
margin-block-start: 0;
|
|
@@ -163,6 +166,7 @@
|
|
|
163
166
|
padding: var(--wp--preset--spacing--20, 1em) 0;
|
|
164
167
|
cursor: pointer;
|
|
165
168
|
outline: none;
|
|
169
|
+
overflow: hidden;
|
|
166
170
|
display: flex;
|
|
167
171
|
align-items: center;
|
|
168
172
|
text-align: inherit;
|
|
@@ -194,16 +198,6 @@
|
|
|
194
198
|
flex-direction: row-reverse;
|
|
195
199
|
}
|
|
196
200
|
|
|
197
|
-
/* RTL language support */
|
|
198
|
-
[dir=rtl] .wp-block-accordion-header:not(.icon-position-left) .accordion-content__toggle {
|
|
199
|
-
/* stylelint-disable-next-line declaration-property-value-allowed-list -- Automatically adjust icon position for RTL languages. */
|
|
200
|
-
flex-direction: row-reverse;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
[dir=rtl] .wp-block-accordion-header.icon-position-left .accordion-content__toggle {
|
|
204
|
-
flex-direction: row;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
201
|
.accordion-content__toggle:focus-visible {
|
|
208
202
|
outline: 2px solid -webkit-focus-ring-color;
|
|
209
203
|
outline-offset: 2px;
|
|
@@ -217,7 +211,4 @@
|
|
|
217
211
|
.wp-block-accordion-content {
|
|
218
212
|
transition: grid-template-rows 0.3s ease-out;
|
|
219
213
|
}
|
|
220
|
-
}
|
|
221
|
-
.is-open .accordion-content__toggle-icon.has-icon-plus {
|
|
222
|
-
transform: rotate(45deg);
|
|
223
214
|
}
|
|
@@ -143,6 +143,9 @@
|
|
|
143
143
|
.wp-block-accordion-content.is-open {
|
|
144
144
|
grid-template-rows: max-content 1fr;
|
|
145
145
|
}
|
|
146
|
+
.wp-block-accordion-content.is-open > .wp-block-accordion-header .accordion-content__toggle-icon.has-icon-plus {
|
|
147
|
+
transform: rotate(-45deg);
|
|
148
|
+
}
|
|
146
149
|
|
|
147
150
|
.accordion-content__heading {
|
|
148
151
|
margin-block-start: 0;
|
|
@@ -164,6 +167,7 @@
|
|
|
164
167
|
padding: var(--wp--preset--spacing--20, 1em) 0;
|
|
165
168
|
cursor: pointer;
|
|
166
169
|
outline: none;
|
|
170
|
+
overflow: hidden;
|
|
167
171
|
display: flex;
|
|
168
172
|
align-items: center;
|
|
169
173
|
text-align: inherit;
|
|
@@ -195,16 +199,6 @@
|
|
|
195
199
|
flex-direction: row-reverse;
|
|
196
200
|
}
|
|
197
201
|
|
|
198
|
-
/* RTL language support */
|
|
199
|
-
[dir=rtl] .wp-block-accordion-header:not(.icon-position-left) .accordion-content__toggle {
|
|
200
|
-
/* stylelint-disable-next-line declaration-property-value-allowed-list -- Automatically adjust icon position for RTL languages. */
|
|
201
|
-
flex-direction: row-reverse;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
[dir=rtl] .wp-block-accordion-header.icon-position-left .accordion-content__toggle {
|
|
205
|
-
flex-direction: row;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
202
|
.accordion-content__toggle:focus-visible {
|
|
209
203
|
outline: 2px solid -webkit-focus-ring-color;
|
|
210
204
|
outline-offset: 2px;
|
|
@@ -219,10 +213,6 @@
|
|
|
219
213
|
transition: grid-template-rows 0.3s ease-out;
|
|
220
214
|
}
|
|
221
215
|
}
|
|
222
|
-
.is-open .accordion-content__toggle-icon.has-icon-plus {
|
|
223
|
-
transform: rotate(-45deg);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
216
|
.wp-block-archives {
|
|
227
217
|
box-sizing: border-box;
|
|
228
218
|
}
|
package/build-style/style.css
CHANGED
|
@@ -143,6 +143,9 @@
|
|
|
143
143
|
.wp-block-accordion-content.is-open {
|
|
144
144
|
grid-template-rows: max-content 1fr;
|
|
145
145
|
}
|
|
146
|
+
.wp-block-accordion-content.is-open > .wp-block-accordion-header .accordion-content__toggle-icon.has-icon-plus {
|
|
147
|
+
transform: rotate(45deg);
|
|
148
|
+
}
|
|
146
149
|
|
|
147
150
|
.accordion-content__heading {
|
|
148
151
|
margin-block-start: 0;
|
|
@@ -164,6 +167,7 @@
|
|
|
164
167
|
padding: var(--wp--preset--spacing--20, 1em) 0;
|
|
165
168
|
cursor: pointer;
|
|
166
169
|
outline: none;
|
|
170
|
+
overflow: hidden;
|
|
167
171
|
display: flex;
|
|
168
172
|
align-items: center;
|
|
169
173
|
text-align: inherit;
|
|
@@ -195,16 +199,6 @@
|
|
|
195
199
|
flex-direction: row-reverse;
|
|
196
200
|
}
|
|
197
201
|
|
|
198
|
-
/* RTL language support */
|
|
199
|
-
[dir=rtl] .wp-block-accordion-header:not(.icon-position-left) .accordion-content__toggle {
|
|
200
|
-
/* stylelint-disable-next-line declaration-property-value-allowed-list -- Automatically adjust icon position for RTL languages. */
|
|
201
|
-
flex-direction: row-reverse;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
[dir=rtl] .wp-block-accordion-header.icon-position-left .accordion-content__toggle {
|
|
205
|
-
flex-direction: row;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
202
|
.accordion-content__toggle:focus-visible {
|
|
209
203
|
outline: 2px solid -webkit-focus-ring-color;
|
|
210
204
|
outline-offset: 2px;
|
|
@@ -219,10 +213,6 @@
|
|
|
219
213
|
transition: grid-template-rows 0.3s ease-out;
|
|
220
214
|
}
|
|
221
215
|
}
|
|
222
|
-
.is-open .accordion-content__toggle-icon.has-icon-plus {
|
|
223
|
-
transform: rotate(45deg);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
216
|
.wp-block-archives {
|
|
227
217
|
box-sizing: border-box;
|
|
228
218
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.30.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -42,39 +42,39 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/runtime": "7.25.7",
|
|
45
|
-
"@wordpress/a11y": "^4.
|
|
46
|
-
"@wordpress/api-fetch": "^7.
|
|
47
|
-
"@wordpress/autop": "^4.
|
|
48
|
-
"@wordpress/blob": "^4.
|
|
49
|
-
"@wordpress/block-editor": "^15.
|
|
50
|
-
"@wordpress/blocks": "^15.
|
|
51
|
-
"@wordpress/components": "^30.
|
|
52
|
-
"@wordpress/compose": "^7.
|
|
53
|
-
"@wordpress/core-data": "^7.
|
|
54
|
-
"@wordpress/data": "^10.
|
|
55
|
-
"@wordpress/date": "^5.30.
|
|
56
|
-
"@wordpress/deprecated": "^4.
|
|
57
|
-
"@wordpress/dom": "^4.
|
|
58
|
-
"@wordpress/element": "^6.
|
|
59
|
-
"@wordpress/escape-html": "^3.
|
|
60
|
-
"@wordpress/hooks": "^4.
|
|
61
|
-
"@wordpress/html-entities": "^4.
|
|
62
|
-
"@wordpress/i18n": "^6.
|
|
63
|
-
"@wordpress/icons": "^10.
|
|
64
|
-
"@wordpress/interactivity": "^6.
|
|
65
|
-
"@wordpress/interactivity-router": "^2.
|
|
66
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
67
|
-
"@wordpress/keycodes": "^4.
|
|
68
|
-
"@wordpress/notices": "^5.
|
|
69
|
-
"@wordpress/patterns": "^2.
|
|
70
|
-
"@wordpress/primitives": "^4.
|
|
71
|
-
"@wordpress/private-apis": "^1.
|
|
72
|
-
"@wordpress/reusable-blocks": "^5.
|
|
73
|
-
"@wordpress/rich-text": "^7.
|
|
74
|
-
"@wordpress/server-side-render": "^6.
|
|
75
|
-
"@wordpress/url": "^4.
|
|
76
|
-
"@wordpress/viewport": "^6.
|
|
77
|
-
"@wordpress/wordcount": "^4.
|
|
45
|
+
"@wordpress/a11y": "^4.30.0",
|
|
46
|
+
"@wordpress/api-fetch": "^7.30.0",
|
|
47
|
+
"@wordpress/autop": "^4.30.0",
|
|
48
|
+
"@wordpress/blob": "^4.30.0",
|
|
49
|
+
"@wordpress/block-editor": "^15.3.0",
|
|
50
|
+
"@wordpress/blocks": "^15.3.0",
|
|
51
|
+
"@wordpress/components": "^30.3.0",
|
|
52
|
+
"@wordpress/compose": "^7.30.0",
|
|
53
|
+
"@wordpress/core-data": "^7.30.0",
|
|
54
|
+
"@wordpress/data": "^10.30.0",
|
|
55
|
+
"@wordpress/date": "^5.30.0",
|
|
56
|
+
"@wordpress/deprecated": "^4.30.0",
|
|
57
|
+
"@wordpress/dom": "^4.30.0",
|
|
58
|
+
"@wordpress/element": "^6.30.0",
|
|
59
|
+
"@wordpress/escape-html": "^3.30.0",
|
|
60
|
+
"@wordpress/hooks": "^4.30.0",
|
|
61
|
+
"@wordpress/html-entities": "^4.30.0",
|
|
62
|
+
"@wordpress/i18n": "^6.3.0",
|
|
63
|
+
"@wordpress/icons": "^10.30.0",
|
|
64
|
+
"@wordpress/interactivity": "^6.30.0",
|
|
65
|
+
"@wordpress/interactivity-router": "^2.30.0",
|
|
66
|
+
"@wordpress/keyboard-shortcuts": "^5.30.0",
|
|
67
|
+
"@wordpress/keycodes": "^4.30.0",
|
|
68
|
+
"@wordpress/notices": "^5.30.0",
|
|
69
|
+
"@wordpress/patterns": "^2.30.0",
|
|
70
|
+
"@wordpress/primitives": "^4.30.0",
|
|
71
|
+
"@wordpress/private-apis": "^1.30.0",
|
|
72
|
+
"@wordpress/reusable-blocks": "^5.30.0",
|
|
73
|
+
"@wordpress/rich-text": "^7.30.0",
|
|
74
|
+
"@wordpress/server-side-render": "^6.6.0",
|
|
75
|
+
"@wordpress/url": "^4.30.0",
|
|
76
|
+
"@wordpress/viewport": "^6.30.0",
|
|
77
|
+
"@wordpress/wordcount": "^4.30.0",
|
|
78
78
|
"change-case": "^4.1.2",
|
|
79
79
|
"clsx": "^2.1.1",
|
|
80
80
|
"colord": "^2.7.0",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "c66cb089eed19d4f4956962fa7b4c81abe6dd513"
|
|
96
96
|
}
|
package/src/accordion/block.json
CHANGED
package/src/accordion/edit.js
CHANGED
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
useBlockProps,
|
|
6
6
|
useInnerBlocksProps,
|
|
7
7
|
InspectorControls,
|
|
8
|
+
BlockControls,
|
|
9
|
+
store as blockEditorStore,
|
|
8
10
|
} from '@wordpress/block-editor';
|
|
9
11
|
import { __ } from '@wordpress/i18n';
|
|
10
12
|
import {
|
|
@@ -13,7 +15,10 @@ import {
|
|
|
13
15
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
14
16
|
__experimentalToolsPanel as ToolsPanel,
|
|
15
17
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
18
|
+
ToolbarButton,
|
|
16
19
|
} from '@wordpress/components';
|
|
20
|
+
import { useDispatch } from '@wordpress/data';
|
|
21
|
+
import { createBlock } from '@wordpress/blocks';
|
|
17
22
|
|
|
18
23
|
/**
|
|
19
24
|
* Internal dependencies
|
|
@@ -27,10 +32,12 @@ const ACCORDION_BLOCK = {
|
|
|
27
32
|
|
|
28
33
|
export default function Edit( {
|
|
29
34
|
attributes: { autoclose, iconPosition, showIcon },
|
|
35
|
+
clientId,
|
|
30
36
|
setAttributes,
|
|
31
37
|
} ) {
|
|
32
38
|
const blockProps = useBlockProps();
|
|
33
39
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
40
|
+
const { insertBlock } = useDispatch( blockEditorStore );
|
|
34
41
|
|
|
35
42
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
36
43
|
template: [ [ ACCORDION_BLOCK_NAME ], [ ACCORDION_BLOCK_NAME ] ],
|
|
@@ -39,8 +46,21 @@ export default function Edit( {
|
|
|
39
46
|
templateInsertUpdatesSelection: true,
|
|
40
47
|
} );
|
|
41
48
|
|
|
49
|
+
const addAccordionContentBlock = () => {
|
|
50
|
+
const newAccordionContent = createBlock( ACCORDION_BLOCK_NAME );
|
|
51
|
+
insertBlock( newAccordionContent, undefined, clientId );
|
|
52
|
+
};
|
|
53
|
+
|
|
42
54
|
return (
|
|
43
55
|
<>
|
|
56
|
+
<BlockControls group="other">
|
|
57
|
+
<ToolbarButton
|
|
58
|
+
label={ __( 'Add accordion content block' ) }
|
|
59
|
+
onClick={ addAccordionContentBlock }
|
|
60
|
+
>
|
|
61
|
+
{ __( 'Add' ) }
|
|
62
|
+
</ToolbarButton>
|
|
63
|
+
</BlockControls>
|
|
44
64
|
<InspectorControls key="setting">
|
|
45
65
|
<ToolsPanel
|
|
46
66
|
label={ __( 'Settings' ) }
|
package/src/accordion/style.scss
CHANGED
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
.wp-block-accordion-content.is-open {
|
|
7
7
|
grid-template-rows: max-content 1fr;
|
|
8
|
+
|
|
9
|
+
> .wp-block-accordion-header {
|
|
10
|
+
.accordion-content__toggle-icon.has-icon-plus {
|
|
11
|
+
transform: rotate(45deg);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
8
14
|
}
|
|
9
15
|
|
|
10
16
|
.accordion-content__heading {
|
|
@@ -27,6 +33,7 @@
|
|
|
27
33
|
padding: var(--wp--preset--spacing--20, 1em) 0;
|
|
28
34
|
cursor: pointer;
|
|
29
35
|
outline: none;
|
|
36
|
+
overflow: hidden;
|
|
30
37
|
display: flex;
|
|
31
38
|
align-items: center;
|
|
32
39
|
text-align: inherit;
|
|
@@ -58,16 +65,6 @@
|
|
|
58
65
|
flex-direction: row-reverse;
|
|
59
66
|
}
|
|
60
67
|
|
|
61
|
-
/* RTL language support */
|
|
62
|
-
[dir="rtl"] .wp-block-accordion-header:not(.icon-position-left) .accordion-content__toggle {
|
|
63
|
-
/* stylelint-disable-next-line declaration-property-value-allowed-list -- Automatically adjust icon position for RTL languages. */
|
|
64
|
-
flex-direction: row-reverse;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
[dir="rtl"] .wp-block-accordion-header.icon-position-left .accordion-content__toggle {
|
|
68
|
-
flex-direction: row;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
68
|
.accordion-content__toggle:focus-visible {
|
|
72
69
|
outline: 2px solid -webkit-focus-ring-color;
|
|
73
70
|
outline-offset: 2px;
|
|
@@ -83,9 +80,3 @@
|
|
|
83
80
|
transition: grid-template-rows 0.3s ease-out;
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
|
-
|
|
87
|
-
.is-open {
|
|
88
|
-
.accordion-content__toggle-icon.has-icon-plus {
|
|
89
|
-
transform: rotate(45deg);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 3,
|
|
4
4
|
"name": "core/accordion-content",
|
|
5
|
-
"version": "0.1.0",
|
|
6
5
|
"title": "Accordion Content",
|
|
7
6
|
"category": "design",
|
|
8
7
|
"description": "Displays a section of content in an accordion, including a header and expandable content.",
|
|
9
|
-
"example": {},
|
|
10
8
|
"__experimental": true,
|
|
11
9
|
"parent": [ "core/accordion" ],
|
|
12
10
|
"allowedBlocks": [ "core/accordion-header", "core/accordion-panel" ],
|
|
13
11
|
"supports": {
|
|
14
|
-
"align": [ "wide", "full" ],
|
|
15
12
|
"color": {
|
|
16
13
|
"background": true,
|
|
17
14
|
"gradient": true
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 3,
|
|
4
4
|
"name": "core/accordion-header",
|
|
5
|
-
"version": "0.1.0",
|
|
6
5
|
"title": "Accordion Header",
|
|
7
6
|
"category": "design",
|
|
8
7
|
"description": "Displays an accordion header.",
|
|
9
|
-
"example": {},
|
|
10
8
|
"__experimental": true,
|
|
11
9
|
"parent": [ "core/accordion-content" ],
|
|
12
10
|
"usesContext": [
|
|
@@ -20,7 +18,6 @@
|
|
|
20
18
|
"gradient": true
|
|
21
19
|
},
|
|
22
20
|
"align": false,
|
|
23
|
-
"border": true,
|
|
24
21
|
"interactivity": true,
|
|
25
22
|
"spacing": {
|
|
26
23
|
"padding": true,
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 3,
|
|
4
4
|
"name": "core/accordion-panel",
|
|
5
|
-
"version": "0.1.0",
|
|
6
5
|
"title": "Accordion Panel",
|
|
7
6
|
"category": "design",
|
|
8
7
|
"description": "Displays an accordion panel.",
|
|
9
|
-
"example": {},
|
|
10
8
|
"__experimental": true,
|
|
11
9
|
"parent": [ "core/accordion-content" ],
|
|
12
10
|
"supports": {
|
|
@@ -14,7 +12,6 @@
|
|
|
14
12
|
"background": true,
|
|
15
13
|
"gradient": true
|
|
16
14
|
},
|
|
17
|
-
"border": true,
|
|
18
15
|
"interactivity": true,
|
|
19
16
|
"spacing": {
|
|
20
17
|
"padding": true,
|
|
@@ -1,61 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
useBlockProps,
|
|
6
|
-
useInnerBlocksProps,
|
|
7
|
-
__experimentalUseBorderProps as useBorderProps,
|
|
8
|
-
__experimentalUseColorProps as useColorProps,
|
|
9
|
-
__experimentalGetSpacingClassesAndStyles as useSpacingProps,
|
|
10
|
-
__experimentalGetShadowClassesAndStyles as useShadowProps,
|
|
11
|
-
} from '@wordpress/block-editor';
|
|
12
|
-
/**
|
|
13
|
-
* External dependencies
|
|
14
|
-
*/
|
|
15
|
-
import clsx from 'clsx';
|
|
4
|
+
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
16
5
|
|
|
17
6
|
export default function Edit( { attributes } ) {
|
|
18
7
|
const { allowedBlocks, templateLock, openByDefault, isSelected } =
|
|
19
8
|
attributes;
|
|
20
|
-
const borderProps = useBorderProps( attributes );
|
|
21
|
-
const colorProps = useColorProps( attributes );
|
|
22
|
-
const spacingProps = useSpacingProps( attributes );
|
|
23
|
-
const shadowProps = useShadowProps( attributes );
|
|
24
9
|
|
|
25
|
-
const blockProps = useBlockProps(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
allowedBlocks,
|
|
35
|
-
template: [ [ 'core/paragraph', {} ] ],
|
|
36
|
-
templateLock,
|
|
37
|
-
}
|
|
38
|
-
);
|
|
10
|
+
const blockProps = useBlockProps( {
|
|
11
|
+
'aria-hidden': ! isSelected && ! openByDefault,
|
|
12
|
+
} );
|
|
13
|
+
|
|
14
|
+
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
15
|
+
allowedBlocks,
|
|
16
|
+
template: [ [ 'core/paragraph', {} ] ],
|
|
17
|
+
templateLock,
|
|
18
|
+
} );
|
|
39
19
|
|
|
40
|
-
return
|
|
41
|
-
<div
|
|
42
|
-
{ ...blockProps }
|
|
43
|
-
className={ clsx(
|
|
44
|
-
blockProps.className,
|
|
45
|
-
colorProps.className,
|
|
46
|
-
borderProps.className,
|
|
47
|
-
{
|
|
48
|
-
[ `has-custom-font-size` ]: blockProps?.style?.fontSize,
|
|
49
|
-
}
|
|
50
|
-
) }
|
|
51
|
-
style={ {
|
|
52
|
-
...borderProps.style,
|
|
53
|
-
...colorProps.style,
|
|
54
|
-
...shadowProps.style,
|
|
55
|
-
} }
|
|
56
|
-
aria-hidden={ ! isSelected && ! openByDefault }
|
|
57
|
-
>
|
|
58
|
-
<div { ...innerBlocksProps } />
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
20
|
+
return <div { ...innerBlocksProps } />;
|
|
61
21
|
}
|