Skip to content

Commit

Permalink
WordPress 6.7 compatibility: Add __nextHasNoMarginBottom to controls …
Browse files Browse the repository at this point in the history
…to prevent deprecation notices (#39877)
  • Loading branch information
coder-karen authored Oct 28, 2024
1 parent 74210e4 commit 291b09e
Show file tree
Hide file tree
Showing 97 changed files with 256 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Components: Add __nextHasNoMarginBottom to BaseControl-based components, preventing deprecation notices.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export function MarkAsShared( { connection }: MarkAsSharedProps ) {
onChange={ onChange }
disabled={ isUpdating || connection.status === 'broken' }
label={ __( 'Mark the connection as shared', 'jetpack' ) }
__nextHasNoMarginBottom={ true }
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default function MessageBoxControl( {
_n( '%d character remaining', '%d characters remaining', charactersRemaining, 'jetpack' ),
charactersRemaining
) }
__nextHasNoMarginBottom={ true }
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const PublicizePanel = ( { prePublish, children } ) => {
onChange={ togglePublicizeFeature }
checked={ isPublicizeEnabled && hasConnections }
disabled={ ! hasConnections }
__nextHasNoMarginBottom={ true }
/>
) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const SocialImageGeneratorPanel = ( { prePublish = false } ) => {
help={ ! isEnabled ? __( 'Social Image is disabled for this post.', 'jetpack' ) : '' }
checked={ isEnabled }
onChange={ setIsEnabled }
__nextHasNoMarginBottom={ true }
/>
{ isEnabled && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const SocialImageGeneratorSettingsModal = ( { onClose } ) => {
{ label: __( 'No Image', 'jetpack' ), value: 'none' },
] }
onChange={ setEditedImageType }
__nextHasNoMarginBottom={ true }
/>

{ localImageType === 'custom' && (
Expand All @@ -92,6 +93,7 @@ const SocialImageGeneratorSettingsModal = ( { onClose } ) => {
'By default the post title is used for the image. You can use this field to set your own text.',
'jetpack'
) }
__nextHasNoMarginBottom={ true }
/>
<BaseControl __nextHasNoMarginBottom={ true } className={ styles.templateControl }>
<BaseControl.VisualLabel>{ __( 'Templates', 'jetpack' ) }</BaseControl.VisualLabel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export function PreviewSection() {
}
checked={ isEnabled }
onChange={ toggleConnection( tab.connection_id, tab ) }
__nextHasNoMarginBottom={ true }
/>
) : null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Components: Add __nextHasNoMarginBottom to BaseControl-based components, preventing deprecation notices.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const CRMPluginIsActive = ( { crmData, setCRMData, jetpackCRM, setAttributes } )
checked={ jetpackCRM }
onChange={ value => setAttributes( { jetpackCRM: value } ) }
help={ __( 'Store contact form submissions in your CRM.', 'jetpack-forms' ) }
__nextHasNoMarginBottom={ true }
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const CRMPluginData = ( { jetpackCRM, setAttributes } ) => {

const CRMIntegrationSettings = ( { jetpackCRM, setAttributes } ) => {
return (
<BaseControl>
<BaseControl __nextHasNoMarginBottom={ true }>
<CRMPluginData jetpackCRM={ jetpackCRM } setAttributes={ setAttributes } />
</BaseControl>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const JetpackEmailConnectionSettings = ( {
'You can enter multiple email addresses separated by commas.',
'jetpack-forms'
) }
__nextHasNoMarginBottom={ true }
/>

<HelpMessage isError id={ `contact-form-${ instanceId }-email-error` }>
Expand All @@ -120,6 +121,7 @@ const JetpackEmailConnectionSettings = ( {
value={ emailSubject }
placeholder={ __( 'Enter a subject', 'jetpack-forms' ) }
onChange={ newSubject => setAttributes( { subject: newSubject } ) }
__nextHasNoMarginBottom={ true }
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function JetpackFieldCheckbox( props ) {
label={ __( 'Checked by default', 'jetpack-forms' ) }
checked={ defaultValue }
onChange={ value => setAttributes( { defaultValue: value ? 'true' : '' } ) }
__nextHasNoMarginBottom={ true }
/>
</PanelBody>
</InspectorControls>
Expand All @@ -77,6 +78,7 @@ function JetpackFieldCheckbox( props ) {
checked={ required }
onChange={ value => setAttributes( { required: value } ) }
help={ __( 'You can edit the "required" label in the editor', 'jetpack-forms' ) }
__nextHasNoMarginBottom={ true }
/>
<JetpackFieldWidth setAttributes={ setAttributes } width={ width } />

Expand All @@ -85,6 +87,7 @@ function JetpackFieldCheckbox( props ) {
checked={ attributes.shareFieldAttributes }
onChange={ value => setAttributes( { shareFieldAttributes: value } ) }
help={ __( 'Deactivate for individual styling of this block', 'jetpack-forms' ) }
__nextHasNoMarginBottom={ true }
/>
</PanelBody>
<PanelColorSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const JetpackFieldConsent = ( {
checked={ attributes.shareFieldAttributes }
onChange={ value => setAttributes( { shareFieldAttributes: value } ) }
help={ __( 'Deactivate for individual styling of this block', 'jetpack-forms' ) }
__nextHasNoMarginBottom={ true }
/>
</PanelBody>
<PanelColorSettings
Expand All @@ -68,7 +69,7 @@ const JetpackFieldConsent = ( {
] }
/>
<PanelBody title={ __( 'Consent Settings', 'jetpack-forms' ) }>
<BaseControl>
<BaseControl __nextHasNoMarginBottom={ true }>
<SelectControl
label={ __( 'Permission to email', 'jetpack-forms' ) }
value={ consentType }
Expand All @@ -77,6 +78,7 @@ const JetpackFieldConsent = ( {
{ label: __( 'Add a privacy checkbox', 'jetpack-forms' ), value: 'explicit' },
] }
onChange={ value => setAttributes( { consentType: value } ) }
__nextHasNoMarginBottom={ true }
/>
</BaseControl>
</PanelBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const JetpackFieldControls = ( {
checked={ required }
onChange={ value => setAttributes( { required: value } ) }
help={ __( 'You can edit the "required" label in the editor', 'jetpack-forms' ) }
__nextHasNoMarginBottom={ true }
/>,
! hidePlaceholder && (
<TextControl
Expand All @@ -124,6 +125,7 @@ const JetpackFieldControls = ( {
'Show visitors an example of the type of content expected. Otherwise, leave blank.',
'jetpack-forms'
) }
__nextHasNoMarginBottom={ true }
/>
),
<JetpackFieldWidth key="width" setAttributes={ setAttributes } width={ width } />,
Expand All @@ -133,6 +135,7 @@ const JetpackFieldControls = ( {
checked={ attributes.shareFieldAttributes }
onChange={ value => setAttributes( { shareFieldAttributes: value } ) }
help={ __( 'Deactivate for individual styling of this block', 'jetpack-forms' ) }
__nextHasNoMarginBottom={ true }
/>,
];

Expand Down Expand Up @@ -203,6 +206,7 @@ const JetpackFieldControls = ( {
onChange={ setNumberAttribute( 'buttonBorderWidth' ) }
min={ 0 }
max={ 100 }
__nextHasNoMarginBottom={ true }
/>
<RangeControl
label={ __( 'Button Border Radius', 'jetpack-forms' ) }
Expand All @@ -211,6 +215,7 @@ const JetpackFieldControls = ( {
onChange={ setNumberAttribute( 'buttonBorderRadius' ) }
min={ 0 }
max={ 100 }
__nextHasNoMarginBottom={ true }
/>
</>
) }
Expand All @@ -223,6 +228,7 @@ const JetpackFieldControls = ( {
onChange={ setNumberAttribute( 'borderWidth' ) }
min={ 0 }
max={ 100 }
__nextHasNoMarginBottom={ true }
/>
<RangeControl
label={ __( 'Border Radius', 'jetpack-forms' ) }
Expand All @@ -231,6 +237,7 @@ const JetpackFieldControls = ( {
onChange={ setNumberAttribute( 'borderRadius' ) }
min={ 0 }
max={ 100 }
__nextHasNoMarginBottom={ true }
/>
</>
) }
Expand Down Expand Up @@ -266,6 +273,7 @@ const JetpackFieldControls = ( {
"Customize the input's name/ID. Only alphanumeric, dash and underscore characters are allowed",
'jetpack-forms'
) }
__nextHasNoMarginBottom={ true }
/>
</InspectorAdvancedControls>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const JetpackDatePicker = props => {
'Select the format in which the date will be displayed.',
'jetpack-forms'
) }
__nextHasNoMarginBottom={ true }
/>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default function JetpackFieldWidth( { setAttributes, width } ) {
'jetpack-forms'
) }
className="jetpack-field-label__width"
__nextHasNoMarginBottom={ true }
>
<BaseControl.VisualLabel>{ __( 'Field Width', 'jetpack-forms' ) }</BaseControl.VisualLabel>
<ButtonGroup aria-label={ __( 'Field Width', 'jetpack-forms' ) }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CreativeMailPlugin from './jetpack-newsletter-integration-settings-creati

const NewsletterIntegrationSettings = () => {
return (
<BaseControl>
<BaseControl __nextHasNoMarginBottom={ true }>
<ConsentBlockSettings />
<CreativeMailPlugin />
</BaseControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,15 @@ export default ( { salesforceData, setAttributes, instanceId } ) => {
return (
<Fragment>
<PanelBody title={ __( 'Salesforce', 'jetpack-forms' ) } initialOpen={ true }>
<BaseControl>
<BaseControl __nextHasNoMarginBottom={ true }>
<TextControl
label={ __( 'Organization ID', 'jetpack-forms' ) }
value={ salesforceData.organizationId || '' }
placeholder={ __( 'Enter your Organization ID', 'jetpack-forms' ) }
onBlur={ onBlurOrgIdField }
onChange={ setOrganizationId }
help={ __( 'Enter the Salesforce organization ID to send Leads to.', 'jetpack-forms' ) }
__nextHasNoMarginBottom={ true }
/>
{ organizationIdError && (
<HelpMessage isError id={ `contact-form-${ instanceId }-email-error` }>
Expand Down
4 changes: 4 additions & 0 deletions projects/packages/forms/src/blocks/contact-form/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export const JetpackContactFormEdit = forwardRef(
{ label: __( 'Redirect to another webpage', 'jetpack-forms' ), value: 'redirect' },
] }
onChange={ newMessage => setAttributes( { customThankyou: newMessage } ) }
__nextHasNoMarginBottom={ true }
/>

{ 'redirect' !== customThankyou && (
Expand All @@ -182,6 +183,7 @@ export const JetpackContactFormEdit = forwardRef(
value={ customThankyouHeading }
placeholder={ __( 'Your message has been sent', 'jetpack-forms' ) }
onChange={ newHeading => setAttributes( { customThankyouHeading: newHeading } ) }
__nextHasNoMarginBottom={ true }
/>
) }

Expand All @@ -191,13 +193,15 @@ export const JetpackContactFormEdit = forwardRef(
value={ customThankyouMessage }
placeholder={ __( 'Thank you for your submission!', 'jetpack-forms' ) }
onChange={ newMessage => setAttributes( { customThankyouMessage: newMessage } ) }
__nextHasNoMarginBottom={ true }
/>
) }

{ 'redirect' === customThankyou && (
<BaseControl
label={ __( 'Redirect Address', 'jetpack-forms' ) }
id={ `contact-form-${ instanceId }-thankyou-url` }
__nextHasNoMarginBottom={ true }
>
<URLInput
id={ `contact-form-${ instanceId }-thankyou-url` }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const EvaluationStep = ( {
label={ question }
checked={ values[ key ] }
onChange={ setChecked( key ) }
__nextHasNoMarginBottom={ true }
/>
) ) }
<div className={ styles[ 'form-actions' ] }>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Components: Add __nextHasNoMarginBottom to BaseControl-based components, preventing deprecation notices.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Components: Add __nextHasNoMarginBottom to BaseControl-based components, preventing deprecation notices.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default function ExcludedPostTypesControl( {
label={ VALID_POST_TYPES[ type ].name }
onChange={ changeHandler( type ) }
value={ type }
__nextHasNoMarginBottom={ true }
/>
) ) }
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export default function SidebarOptions() {
value={ sort }
options={ sortOptions }
onChange={ setSort }
__nextHasNoMarginBottom={ true }
/>
<SelectControl
className="jp-search-configure-overlay-trigger-select"
Expand All @@ -121,6 +122,7 @@ export default function SidebarOptions() {
},
] }
onChange={ setTrigger }
__nextHasNoMarginBottom={ true }
/>
<ToggleControl
className="jp-search-configure-filtering-opens-overlay-toggle"
Expand All @@ -132,6 +134,7 @@ export default function SidebarOptions() {
) }
label={ __( 'Open overlay from filter links', 'jetpack-search-pkg' ) }
onChange={ setFilteringOpensOverlay }
__nextHasNoMarginBottom={ true }
/>
<ExcludedPostTypesControl
disabled={ isDisabled }
Expand All @@ -147,13 +150,15 @@ export default function SidebarOptions() {
disabled={ isDisabled }
label={ __( 'Show sort selector', 'jetpack-search-pkg' ) }
onChange={ setSortEnabled }
__nextHasNoMarginBottom={ true }
/>
<ToggleControl
className="jp-search-configure-infinite-scroll-toggle"
checked={ infiniteScroll }
disabled={ isDisabled }
label={ __( 'Enable infinite scroll', 'jetpack-search-pkg' ) }
onChange={ setInfiniteScroll }
__nextHasNoMarginBottom={ true }
/>
{ 'expanded' === resultFormat && (
<ToggleControl
Expand All @@ -162,6 +167,7 @@ export default function SidebarOptions() {
disabled={ isDisabled }
label={ __( 'Show post date', 'jetpack-search-pkg' ) }
onChange={ setPostDate }
__nextHasNoMarginBottom={ true }
/>
) }
{ ! isFreePlan && (
Expand All @@ -171,6 +177,7 @@ export default function SidebarOptions() {
disabled={ isDisabled }
label={ __( 'Show "Powered by Jetpack"', 'jetpack-search-pkg' ) }
onChange={ setShowLogo }
__nextHasNoMarginBottom={ true }
/>
) }
</PanelBody>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Components: Add __nextHasNoMarginBottom to BaseControl-based components, preventing deprecation notices.
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ const EditVideoDetails = () => {
value: VIDEO_PRIVACY_LEVEL_PRIVATE,
},
] }
__nextHasNoMarginBottom={ true }
/>
) }
{ isFetchingData ? (
Expand All @@ -388,6 +389,7 @@ const EditVideoDetails = () => {
'jetpack-videopress-pkg'
) }
onChange={ value => setDisplayEmbed( value ? 1 : 0 ) }
__nextHasNoMarginBottom={ true }
/>
</>
) }
Expand All @@ -406,6 +408,7 @@ const EditVideoDetails = () => {
'jetpack-videopress-pkg'
) }
onChange={ value => setAllowDownload( value ? 1 : 0 ) }
__nextHasNoMarginBottom={ true }
/>
</>
) }
Expand Down
Loading

0 comments on commit 291b09e

Please sign in to comment.