Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] trunk from WordPress:trunk #96

Merged
merged 10 commits into from
Dec 18, 2024
1 change: 0 additions & 1 deletion bin/api-docs/gen-components-docs/markdown/props.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ export function generateMarkdownPropsJson( props, { headingLevel = 2 } = {} ) {

return [ { [ `h${ headingLevel }` ]: 'Props' }, ...propsJson ];
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* WordPress dependencies
*/
import { box, button, cog, paragraph } from '@wordpress/icons';

/**
* Internal dependencies
*/
import BlockCard from '../';

const meta = {
title: 'BlockEditor/BlockCard',
component: BlockCard,
parameters: {
docs: {
description: {
component:
'The `BlockCard` component allows to display a "card" which contains the title of a block, its icon and its description.',
},
canvas: { sourceState: 'shown' },
},
},
argTypes: {
title: {
control: 'text',
description: 'The title of the block.',
table: {
type: { summary: 'string' },
},
},
description: {
control: 'text',
description: 'A description of the block functionality.',
table: {
type: { summary: 'string' },
},
},
icon: {
control: 'select',
options: [ 'paragraph', 'cog', 'box', 'button' ],
mapping: {
paragraph,
cog,
box,
button,
},
description:
'The icon of the block. This can be any of [WordPress Dashicons](https://developer.wordpress.org/resource/dashicons/), or a custom `svg` element.',
table: {
type: { summary: 'string | object' },
},
},
name: {
control: 'text',
description: 'Optional custom name for the block.',
table: {
type: { summary: 'string' },
},
},
className: {
control: 'text',
description: 'Additional CSS class names.',
table: {
type: { summary: 'string' },
},
},
},
};

export default meta;

export const Default = {
args: {
title: 'Paragraph',
icon: paragraph,
description: 'This is a paragraph block description.',
name: 'Paragraph Block',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export default function DateFormatPicker( {
onChange,
} ) {
return (
<fieldset className="block-editor-date-format-picker">
<VStack
as="fieldset"
spacing={ 4 }
className="block-editor-date-format-picker"
>
<VisuallyHidden as="legend">{ __( 'Date format' ) }</VisuallyHidden>
<ToggleControl
__nextHasNoMarginBottom
Expand All @@ -57,7 +61,7 @@ export default function DateFormatPicker( {
{ format && (
<NonDefaultControls format={ format } onChange={ onChange } />
) }
</fieldset>
</VStack>
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.block-editor-date-format-picker {
margin-bottom: $grid-unit-20;
margin: 0 0 $grid-unit-20;
padding: 0;
border: none;
}

.block-editor-date-format-picker__custom-format-select-control__custom-option {
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/badge/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Badge from '..';
const meta = {
component: Badge,
title: 'Components/Containers/Badge',
id: 'components-badge',
tags: [ 'status-private' ],
} satisfies Meta< typeof Badge >;

Expand Down
4 changes: 4 additions & 0 deletions packages/create-block/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancement

- Add support for custom `textdomain` property for the scaffolded block ([#57197](https://github.com/WordPress/gutenberg/pull/57197)).

## 4.57.0 (2024-12-11)

### Internal
Expand Down
1 change: 1 addition & 0 deletions packages/create-block/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ program
'description',
'dashicon',
'category',
'textdomain',
],
variant
).filter( filterOptionsProvided );
Expand Down
15 changes: 15 additions & 0 deletions packages/create-block/lib/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ const category = {
choices: [ 'text', 'media', 'design', 'widgets', 'theme', 'embed' ],
};

const textdomain = {
type: 'input',
name: 'textdomain',
message:
'The text domain used to internationalize text in the block (by default it will be same as slug):',
validate( input ) {
if ( input.length && ! /^[a-z][a-z0-9\-]*$/.test( input ) ) {
return 'Invalid text domain specified. Text domain can contain only lowercase alphanumeric characters or dashes, and start with a letter.';
}

return true;
},
};

// Plugin header fields.
const pluginURI = {
type: 'input',
Expand Down Expand Up @@ -141,6 +155,7 @@ module.exports = {
description,
dashicon,
category,
textdomain,
pluginURI,
version,
author,
Expand Down
3 changes: 2 additions & 1 deletion packages/create-block/lib/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = async (
description,
dashicon,
category,
textdomain,
attributes,
supports,
author,
Expand Down Expand Up @@ -95,7 +96,7 @@ module.exports = async (
customPackageJSON,
customBlockJSON,
example,
textdomain: slug,
textdomain: textdomain || slug,
rootDirectory,
} );

Expand Down
Loading
Loading