@plaudit/gutenberg-api-extensions 2.88.0 → 2.90.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.
Files changed (112) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/blocks/SNPFlexibleItemsListComponent.d.ts +2 -2
  3. package/dist/blocks/SNPFlexibleItemsListComponent.js +1 -1
  4. package/dist/blocks/SNPFlexibleItemsListComponent.js.map +1 -1
  5. package/dist/blocks/SNPGroupComponent.js +2 -2
  6. package/dist/blocks/SNPGroupComponent.js.map +1 -1
  7. package/dist/blocks/SNPListComponent.js +1 -1
  8. package/dist/blocks/SNPListComponent.js.map +1 -1
  9. package/dist/blocks/basic-custom-block-bindings-support.d.ts +1 -5
  10. package/dist/blocks/basic-custom-block-bindings-support.js +6 -6
  11. package/dist/blocks/basic-custom-block-bindings-support.js.map +1 -1
  12. package/dist/blocks/common-native-property-constructors.js +21 -14
  13. package/dist/blocks/common-native-property-constructors.js.map +1 -1
  14. package/dist/blocks/conditions.js +1 -1
  15. package/dist/blocks/conditions.js.map +1 -1
  16. package/dist/blocks/index.d.ts +2 -2
  17. package/dist/blocks/index.js.map +1 -1
  18. package/dist/blocks/layout/LaidOutProperty.d.ts +1 -1
  19. package/dist/blocks/layout/LaidOutPropertyRow.d.ts +5 -2
  20. package/dist/blocks/layout/LaidOutPropertyRow.js +5 -0
  21. package/dist/blocks/layout/LaidOutPropertyRow.js.map +1 -1
  22. package/dist/blocks/layout/PanelRoot.js +1 -4
  23. package/dist/blocks/layout/PanelRoot.js.map +1 -1
  24. package/dist/blocks/layout/TabsRoot.js +1 -1
  25. package/dist/blocks/layout/TabsRoot.js.map +1 -1
  26. package/dist/blocks/simple-block.d.ts +2 -2
  27. package/dist/blocks/simple-native-property-impl.js +5 -5
  28. package/dist/blocks/simple-native-property-impl.js.map +1 -1
  29. package/dist/controls/AsynchronousFormTokenField.js +1 -1
  30. package/dist/controls/AsynchronousFormTokenField.js.map +1 -1
  31. package/dist/controls/BaseSortableItemsControl.d.ts +1 -1
  32. package/dist/controls/BaseSortableItemsControl.js +2 -2
  33. package/dist/controls/BaseSortableItemsControl.js.map +1 -1
  34. package/dist/controls/ExtendedFormTokenField.js +1 -1
  35. package/dist/controls/ExtendedFormTokenField.js.map +1 -1
  36. package/dist/controls/ExtendedRadioControl.js +1 -1
  37. package/dist/controls/ExtendedRadioControl.js.map +1 -1
  38. package/dist/controls/ExtendedTextareaControl.js +1 -1
  39. package/dist/controls/ExtendedTextareaControl.js.map +1 -1
  40. package/dist/controls/FileControl.js +3 -3
  41. package/dist/controls/FileControl.js.map +1 -1
  42. package/dist/controls/FullSizeToggleControl.js +1 -0
  43. package/dist/controls/FullSizeToggleControl.js.map +1 -1
  44. package/dist/controls/ImageControl.js +5 -5
  45. package/dist/controls/ImageControl.js.map +1 -1
  46. package/dist/controls/LazySuggestionsComboboxControl.js +4 -4
  47. package/dist/controls/LazySuggestionsComboboxControl.js.map +1 -1
  48. package/dist/controls/PickOne.js +2 -2
  49. package/dist/controls/PickOne.js.map +1 -1
  50. package/dist/controls/ProperLinkControl.js +3 -3
  51. package/dist/controls/ProperLinkControl.js.map +1 -1
  52. package/dist/controls/SimpleToggle.js +1 -1
  53. package/dist/controls/SimpleToggle.js.map +1 -1
  54. package/dist/controls/SortableFlexibleItemsControl.d.ts +2 -2
  55. package/dist/controls/SortableFlexibleItemsControl.js +1 -1
  56. package/dist/controls/SortableFlexibleItemsControl.js.map +1 -1
  57. package/dist/controls/SortableItemsControl.js +1 -1
  58. package/dist/controls/SortableItemsControl.js.map +1 -1
  59. package/dist/controls/hooks/useSuggestions.js.map +1 -1
  60. package/dist/index.d.ts +2 -1
  61. package/dist/index.js +25 -3
  62. package/dist/index.js.map +1 -1
  63. package/dist/lib/compat-types.d.ts +34 -0
  64. package/dist/lib/compat-types.js +3 -0
  65. package/dist/lib/compat-types.js.map +1 -0
  66. package/dist/lib/gutenberg-api-extensions-state/custom-block-bindings-support-logic.d.ts +1 -1
  67. package/dist/lib/gutenberg-api-extensions-state.d.ts +3 -3
  68. package/dist/lib/helpers.d.ts +1 -0
  69. package/dist/lib/helpers.js +21 -2
  70. package/dist/lib/helpers.js.map +1 -1
  71. package/dist/lib/sectioned-cache-store.d.ts +42 -0
  72. package/dist/lib/sectioned-cache-store.js +78 -0
  73. package/dist/lib/sectioned-cache-store.js.map +1 -0
  74. package/dist/lib/useful-types.d.ts +5 -0
  75. package/package.json +13 -13
  76. package/src/blocks/SNPFlexibleItemsListComponent.tsx +4 -4
  77. package/src/blocks/SNPGroupComponent.tsx +3 -3
  78. package/src/blocks/SNPListComponent.tsx +2 -2
  79. package/src/blocks/basic-custom-block-bindings-support.tsx +12 -8
  80. package/src/blocks/common-native-property-constructors.tsx +48 -34
  81. package/src/blocks/conditions.ts +1 -1
  82. package/src/blocks/index.ts +2 -2
  83. package/src/blocks/layout/LaidOutPropertyRow.tsx +7 -1
  84. package/src/blocks/layout/PanelRoot.tsx +2 -5
  85. package/src/blocks/layout/TabsRoot.tsx +2 -2
  86. package/src/blocks/simple-block.tsx +2 -2
  87. package/src/blocks/simple-native-property-impl.tsx +5 -5
  88. package/src/controls/AsynchronousFormTokenField.tsx +1 -0
  89. package/src/controls/BaseSortableItemsControl.tsx +8 -8
  90. package/src/controls/ExtendedFormTokenField.tsx +2 -0
  91. package/src/controls/ExtendedRadioControl.tsx +2 -2
  92. package/src/controls/ExtendedTextareaControl.tsx +1 -1
  93. package/src/controls/FileControl.tsx +4 -4
  94. package/src/controls/FullSizeToggleControl.tsx +1 -0
  95. package/src/controls/ImageControl.tsx +5 -5
  96. package/src/controls/LazySuggestionsComboboxControl.tsx +11 -9
  97. package/src/controls/PickOne.tsx +2 -1
  98. package/src/controls/ProperLinkControl.tsx +11 -6
  99. package/src/controls/SimpleToggle.tsx +1 -1
  100. package/src/controls/SortableFlexibleItemsControl.tsx +5 -3
  101. package/src/controls/SortableItemsControl.tsx +5 -1
  102. package/src/controls/hooks/useSuggestions.ts +1 -1
  103. package/src/index.ts +2 -3
  104. package/src/lib/compat-types.ts +21 -0
  105. package/src/lib/helpers.ts +23 -3
  106. package/src/lib/sectioned-cache-store.ts +120 -0
  107. package/src/lib/useful-types.ts +2 -0
  108. package/styles/editor.pcss +0 -16
  109. package/dist/editor/post-featured-image.d.ts +0 -4
  110. package/dist/editor/post-featured-image.js +0 -125
  111. package/dist/editor/post-featured-image.js.map +0 -1
  112. package/src/editor/post-featured-image.tsx +0 -161
@@ -2,24 +2,24 @@ import {useCallback} from "@wordpress/element";
2
2
 
3
3
  import type {FlexibleItemsListPropertyConfig} from "./csnp-api";
4
4
  import {type FlexibleItem, SortableFlexibleItemsControl} from "../controls";
5
- import {LaidOutPropertyRow} from "./layout/LaidOutPropertyRow";
5
+ import {makeLaidOutPropertyRow} from "./layout/LaidOutPropertyRow";
6
6
  import {NodeContextWrapper, useNodeContext} from "./layout/NodeContext";
7
7
  import type {NonEmptyArray} from "../lib/useful-types";
8
8
  import type {CSNPControlComponentProps} from "./shared-internal-types";
9
9
  import type {HydratedSimpleNativeProperty, SNPControlSlots} from "./simple-native-property-api";
10
10
 
11
- export type SNPFlexibleItemsListComponent<T extends string> = CSNPControlComponentProps<FlexibleItemsListPropertyConfig<T>, FlexibleItem<T>[], {
11
+ export type SNPFlexibleItemsListComponentProps<T extends string> = CSNPControlComponentProps<FlexibleItemsListPropertyConfig<T>, FlexibleItem<T>[], {
12
12
  availableTypes: NonEmptyArray<{value: T, label: string}>, emptyValues: {[key in T]?: FlexibleItem<T>}
13
13
  hydratedProperties: {[key in T]: (HydratedSimpleNativeProperty|HydratedSimpleNativeProperty[])[]}
14
14
  }>&SNPControlSlots;
15
15
  export function SNPFlexibleItemsListComponent(
16
- {config, availableTypes, emptyValues, hydratedProperties, value, Label, Messages}: SNPFlexibleItemsListComponent<string>
16
+ {config, availableTypes, emptyValues, hydratedProperties, value, Label, Messages}: SNPFlexibleItemsListComponentProps<string>
17
17
  ) {
18
18
  const context = useNodeContext("build a SNP List");
19
19
  const onReorder = useCallback((oldIndex: number, newIndex: number) => context.moveNode({from: oldIndex, to: newIndex}), [context]);
20
20
  const emptyValueBuilder = useCallback((type: string) => ({...emptyValues[type], type}), [emptyValues]);
21
21
  const childRenderer = useCallback((datum: FlexibleItem, onDatumChange: (datum: FlexibleItem) => void, index: number) => {
22
- return <NodeContextWrapper nodeName={index} children={hydratedProperties[datum.type]?.map(property => <LaidOutPropertyRow property={property} />)} />
22
+ return <NodeContextWrapper nodeName={index} children={(hydratedProperties[datum.type] ?? []).map(property => makeLaidOutPropertyRow({property}))} />;
23
23
  }, [hydratedProperties]);
24
24
 
25
25
  return <SortableFlexibleItemsControl
@@ -3,7 +3,7 @@ import {useCallback} from "@wordpress/element";
3
3
 
4
4
  import type {GroupPropertyCSNPConfig} from "./csnp-api";
5
5
  import type {Dict} from "../controls";
6
- import {LaidOutPropertyRow} from "./layout/LaidOutPropertyRow";
6
+ import {LaidOutPropertyRow, makeLaidOutPropertyRow} from "./layout/LaidOutPropertyRow";
7
7
  import {useNodeContext} from "./layout/NodeContext";
8
8
  import type {CSNPControlComponentProps} from "./shared-internal-types";
9
9
  import type {SNPControlSlots} from "./simple-native-property-api";
@@ -22,7 +22,7 @@ export function SNPGroupComponent({config, hydratedProperties, Label, Messages}:
22
22
  setValue((resetAllFilters ?? []).reduce((q: any, filter) => filter(q), value))
23
23
  }, [value, setValue])}
24
24
  >
25
- {...hydratedProperties.map(property => <LaidOutPropertyRow property={property} inToolsPanel={true} />)}
25
+ {...hydratedProperties.map(property => makeLaidOutPropertyRow({property, inToolsPanel: true}))}
26
26
  </ToolsPanel>
27
27
  <Messages/>
28
28
  </>;
@@ -30,7 +30,7 @@ export function SNPGroupComponent({config, hydratedProperties, Label, Messages}:
30
30
  return <fieldset {...config.component} className={config.component?.className ? `plaudit-snp-group-component ${config.component.className}` : "plaudit-snp-group-component"}>
31
31
  <legend><Label/></legend>
32
32
  <div className="plaudit-snp-laid-out-properties-wrapper">
33
- {...hydratedProperties.map(property => <LaidOutPropertyRow property={property}/>)}
33
+ {...hydratedProperties.map(property => makeLaidOutPropertyRow({property}))}
34
34
  </div>
35
35
  <Messages/>
36
36
  </fieldset>;
@@ -2,7 +2,7 @@ import {useCallback, useMemo} from "@wordpress/element";
2
2
 
3
3
  import type {ObjectListPropertyConfig} from "./csnp-api";
4
4
  import {type Dict, SortableItemsControl} from "../controls";
5
- import {LaidOutPropertyRow} from "./layout/LaidOutPropertyRow";
5
+ import {LaidOutPropertyRow, makeLaidOutPropertyRow} from "./layout/LaidOutPropertyRow";
6
6
  import {NodeContextWrapper, useNodeContext} from "./layout/NodeContext";
7
7
  import type {CSNPControlComponentProps} from "./shared-internal-types";
8
8
  import type {HydratedSimpleNativeProperty, SNPControlSlots} from "./simple-native-property-api";
@@ -15,7 +15,7 @@ export function SNPListComponent({config, hydratedProperties, value, Label, Mess
15
15
  const onReorder = useCallback((oldIndex: number, newIndex: number) => context.moveNode({from: oldIndex, to: newIndex}), [context]);
16
16
  const emptyValue = useMemo(() => config.emptyValue ?? {}, [config.emptyValue]);
17
17
  const childRenderer = useCallback((datum: Dict<any>, onDatumChange: (datum: Dict<any>) => void, index: number) => {
18
- return <NodeContextWrapper nodeName={index} children={hydratedProperties.map(property => <LaidOutPropertyRow property={property} />)} />
18
+ return <NodeContextWrapper nodeName={index} children={hydratedProperties.map(property => makeLaidOutPropertyRow({property}))} />
19
19
  }, [hydratedProperties]);
20
20
 
21
21
  return <SortableItemsControl
@@ -15,7 +15,7 @@ import {addFilter} from "@wordpress/hooks";
15
15
  import {registerSimpleGutenbergApiEndpoint} from "../editor/simple-gutenberg-endpoints-api";
16
16
  import {store as endpointsStore} from "../editor/simple-gutenberg-endpoints-impl";
17
17
  import {store as apiExtensionsStore} from "../lib/gutenberg-api-extensions-state";
18
- import type {ActualBlockEditProps, BlockName} from "../lib/useful-types";
18
+ import type {ActualBlockEditProps, BlockName, DbSource} from "../lib/useful-types";
19
19
 
20
20
  import {type ReactElement, Suspense} from "react";
21
21
  import {ErrorBoundary, FallbackProps} from "react-error-boundary";
@@ -27,7 +27,6 @@ const BLOCK_BINDINGS_ALLOWED_BLOCKS: {[key: BlockName]: string[]} = {
27
27
  'core/button': ['url', 'text', 'linkTarget', 'rel']
28
28
  };
29
29
 
30
- export type DbSource = {label: string, value: string, help?: string};
31
30
  type CBBParams = {dbSources?: DbSource[]/*, supportsContext?: boolean*/};
32
31
  export function registerCustomBlockBindingsSource(args: Parameters<typeof registerBlockBindingsSource>[0]&CBBParams) {
33
32
  installCustomBlockBindingsSupport();
@@ -47,7 +46,7 @@ export function installCustomBlockBindingsSupport() {
47
46
  );
48
47
 
49
48
  addFilter('editor.BlockEdit', 'plaudit/gutenberg-api-extensions/basic-custom-block-bindings-support',
50
- createHigherOrderComponent(BlockEdit => (blockEditProps: ActualBlockEditProps) => {
49
+ createHigherOrderComponent(BlockEdit => function CustomBlockBindingsSupportBlockEdit(blockEditProps: ActualBlockEditProps) {
51
50
  const availableBindingsList = BLOCK_BINDINGS_ALLOWED_BLOCKS[blockEditProps.name];
52
51
  if (!availableBindingsList?.length) {
53
52
  return <BlockEdit {...blockEditProps} />;
@@ -118,7 +117,8 @@ export function installCustomBlockBindingsSupport() {
118
117
  <SelectControl
119
118
  key="source"
120
119
  label="Source"
121
- __nextHasNoMarginBottom={true}
120
+ __next40pxDefaultSize
121
+ __nextHasNoMarginBottom
122
122
  onChange={source => updateBlockBindings({[binding]: {source, args: {}}})}
123
123
  options={[
124
124
  {
@@ -170,7 +170,8 @@ export function installCustomBlockBindingsSupport() {
170
170
  controls.push(<SelectControl
171
171
  key="field"
172
172
  label="Field"
173
- __nextHasNoMarginBottom={true}
173
+ __next40pxDefaultSize
174
+ __nextHasNoMarginBottom
174
175
  // We exclude subfield from this update because we need to reset it when the selected field changes
175
176
  onChange={key => updateBlockBindings({[binding]: (value ? {...value, args: {key}} : undefined)})}
176
177
  options={[
@@ -189,7 +190,8 @@ export function installCustomBlockBindingsSupport() {
189
190
  controls.push(<TextControl
190
191
  key="subfield"
191
192
  label="Subfield"
192
- __nextHasNoMarginBottom={true}
193
+ __next40pxDefaultSize
194
+ __nextHasNoMarginBottom
193
195
  onChange={subfield => updateBlockBindings({[binding]: (value ? {...value, args: {...value.args, subfield}} : undefined)})}
194
196
  value={value?.args['subfield'] ?? ''}
195
197
  help="Please enter the name of a subfield. You may need to inspect the raw data from this binding to determine the subfield."
@@ -198,7 +200,8 @@ export function installCustomBlockBindingsSupport() {
198
200
  controls.push(<SelectControl
199
201
  key="subfield"
200
202
  label="Subfield"
201
- __nextHasNoMarginBottom={true}
203
+ __next40pxDefaultSize
204
+ __nextHasNoMarginBottom
202
205
  onChange={subfield => updateBlockBindings({[binding]: (value ? {...value, args: {...value.args, subfield}} : undefined)})}
203
206
  options={[
204
207
  {
@@ -217,7 +220,8 @@ export function installCustomBlockBindingsSupport() {
217
220
  controls.push(<SelectControl
218
221
  key="db-source"
219
222
  label="DB Source"
220
- __nextHasNoMarginBottom={true}
223
+ __next40pxDefaultSize
224
+ __nextHasNoMarginBottom
221
225
  onChange={db_source => updateBlockBindings({[binding]: (value ? {...value, args: {...value.args, db_source}} : undefined)})}
222
226
  options={dbSources}
223
227
  value={value?.args['db_source'] ?? dbSources[0]!.value}
@@ -131,7 +131,7 @@ function hydrateDesiccatedSimpleNativeProperty(
131
131
  const safeOnChange = useCallback((v: string|undefined) => onChange(v ? colorToValue[v] : undefined), [colorToValue, onChange]);
132
132
 
133
133
  const {baseControlProps, controlProps} = useBaseControlProps({label: <Label />, help: config.help});
134
- return <BaseControl {...baseControlProps}>
134
+ return <BaseControl __nextHasNoMarginBottom {...baseControlProps}>
135
135
  <ColorPalette
136
136
  {...config.component}
137
137
  {...controlProps}
@@ -157,7 +157,7 @@ function hydrateDesiccatedSimpleNativeProperty(
157
157
  control({value, slots: {Label, Messages}}: SNPControlProps<any>) {
158
158
  const {current: voidChangeHandler} = useRef(() => {});
159
159
  return <Disabled>
160
- <TextControl {...config.component} value={value} onChange={voidChangeHandler} label={<Label />} help={config.help} disabled={true} />
160
+ <TextControl __nextHasNoMarginBottom __next40pxDefaultSize {...config.component} value={value} onChange={voidChangeHandler} label={<Label />} help={config.help} disabled={true} />
161
161
  <Messages />
162
162
  </Disabled>;
163
163
  }
@@ -172,7 +172,7 @@ function hydrateDesiccatedSimpleNativeProperty(
172
172
  transformer: config.transformer,
173
173
  control({value, onChange, slots: {Label, Messages}}) {
174
174
  const safeOnChange = useCallback((v: string|null) => onChange(v === null ? undefined : new Date(v).getTime()), [onChange]);
175
- return <BaseControl id="" label={<Label />} help={config.help}>
175
+ return <BaseControl __nextHasNoMarginBottom id="" label={<Label />} help={config.help}>
176
176
  {config.time
177
177
  ? <DateTimePicker {...config.component} currentDate={value ?? null} onChange={safeOnChange} />
178
178
  : <DatePicker {...config.component} currentDate={value ?? null} onChange={safeOnChange} />
@@ -193,7 +193,7 @@ function hydrateDesiccatedSimpleNativeProperty(
193
193
  return <FileControl label={<Label />} help={config.help} onChange={onChange} value={value} allowedTypes={config.allowedTypes} />;
194
194
  }
195
195
  };
196
- case "group":
196
+ case "group": {
197
197
  registerPlainTextLabelRequiredMarker("post", " > .components-tools-panel > .components-tools-panel-header > *");
198
198
  const currentTypes = parentTypes.toSpliced(parentTypes.length - 1, 0, 'object');
199
199
  const hydratedProperties = (config.fields ?? [])
@@ -228,6 +228,7 @@ function hydrateDesiccatedSimpleNativeProperty(
228
228
  </ToolsPanelContext.Provider>;
229
229
  }
230
230
  };
231
+ }
231
232
  case "image":
232
233
  return {
233
234
  type: 'object',
@@ -264,24 +265,24 @@ function hydrateDesiccatedSimpleNativeProperty(
264
265
  </>;
265
266
  }
266
267
  };
267
- case "list":
268
+ case "list": {
268
269
  const sharedProps: ShareableSNPElements<'array'> = {...passthroughProps, type: 'array', alwaysStore: config.alwaysStore};
269
270
  switch (config.itemType) {
270
271
  case undefined:
271
272
  case "string":
272
273
  return {
273
274
  ...sharedProps,
274
- default: config.default,
275
- type: 'array',
276
- validator: config.validator,
275
+ default: config.default,
276
+ type: 'array',
277
+ validator: config.validator,
277
278
  transformer: config.transformer,
278
279
  control({value, onChange, slots}) {
279
280
  const children = useCallback((datum: any, onDatumChange: (datum: any) => void) => {
280
- return <TextControl {...config.listComponent} value={datum} onChange={onDatumChange}/>;
281
+ return <TextControl {...config.listComponent} __nextHasNoMarginBottom __next40pxDefaultSize value={datum} onChange={onDatumChange} />;
281
282
  }, [config.listComponent]);
282
283
  return <SortableItemsControl {...config.component} {...slots}
283
- value={value} onChange={onChange} min={config.min} max={config.max} label={config.label}
284
- help={config.help} emptyValue={config.emptyValue ?? ''} children={children}
284
+ value={value} onChange={onChange} min={config.min} max={config.max} label={config.label}
285
+ help={config.help} emptyValue={config.emptyValue ?? ''} children={children}
285
286
  />;
286
287
  }
287
288
  };
@@ -290,21 +291,22 @@ function hydrateDesiccatedSimpleNativeProperty(
290
291
  case "integer":
291
292
  return {
292
293
  ...sharedProps,
293
- default: config.default,
294
- type: 'array',
295
- validator: config.validator,
294
+ default: config.default,
295
+ type: 'array',
296
+ validator: config.validator,
296
297
  transformer: config.transformer,
297
298
  control({value, onChange, slots}) {
298
299
  const children = useCallback((datum: any, onDatumChange: (datum: any) => void) => {
299
- return <NumberLikeListTextControl listComponent={config.listComponent} datum={datum} itemType={config.itemType} onDatumChange={onDatumChange} />;
300
+ return <NumberLikeListTextControl listComponent={config.listComponent} datum={datum} itemType={config.itemType}
301
+ onDatumChange={onDatumChange} />;
300
302
  }, [config.listComponent, config.itemType]);
301
303
  return <SortableItemsControl {...config.component} {...slots}
302
- value={value} onChange={onChange} min={config.min} max={config.max} label={config.label}
303
- help={config.help} emptyValue={config.emptyValue ?? 0} children={children}
304
+ value={value} onChange={onChange} min={config.min} max={config.max} label={config.label}
305
+ help={config.help} emptyValue={config.emptyValue ?? 0} children={children}
304
306
  />;
305
307
  }
306
308
  };
307
- default:
309
+ default: {
308
310
  const currentTypes = parentTypes.toSpliced(parentTypes.length - 1, 0, 'array');
309
311
  if (isObjectListPropertyConfig(config)) {
310
312
  const hydratedProperties = config.itemType
@@ -312,9 +314,9 @@ function hydrateDesiccatedSimpleNativeProperty(
312
314
  const def = config.default ?? [];
313
315
  return {
314
316
  ...sharedProps,
315
- children: hydratedProperties,
316
- default: def, // This type-checks, but directly inlining the value doesn't
317
- validator: config.validator,
317
+ children: hydratedProperties,
318
+ default: def, // This type-checks, but directly inlining the value doesn't
319
+ validator: config.validator,
318
320
  transformer: config.transformer,
319
321
  control({value, onChange, slots}) {
320
322
  return <SNPListComponent config={config as ObjectListPropertyConfig} onChange={onChange} value={value}
@@ -340,10 +342,10 @@ function hydrateDesiccatedSimpleNativeProperty(
340
342
  }
341
343
  const hydratedProperties = Object.fromEntries(
342
344
  Object.entries(completedItemTypes)
343
- .map(([itemType, {properties}]) => {
344
- return [itemType, properties
345
- .map(property => hydrateSimpleNativeProperty(property, propPath, outsideHydrationInfo, currentTypes))]
346
- })
345
+ .map(([itemType, {properties}]) => {
346
+ return [itemType, properties
347
+ .map(property => hydrateSimpleNativeProperty(property, propPath, outsideHydrationInfo, currentTypes))]
348
+ })
347
349
  );
348
350
  const emptyValues = Object.fromEntries(
349
351
  Object.entries(completedItemTypes).map(([itemType, {emptyValue}]) => {
@@ -352,9 +354,9 @@ function hydrateDesiccatedSimpleNativeProperty(
352
354
  const def = config.default ?? [];
353
355
  return {
354
356
  ...sharedProps,
355
- children: hydratedProperties,
356
- default: def, // This type-checks, but directly inlining the value doesn't
357
- validator: config.validator,
357
+ children: hydratedProperties,
358
+ default: def, // This type-checks, but directly inlining the value doesn't
359
+ validator: config.validator,
358
360
  transformer: config.transformer,
359
361
  control({value, onChange, slots}) {
360
362
  return <SNPFlexibleItemsListComponent
@@ -364,7 +366,9 @@ function hydrateDesiccatedSimpleNativeProperty(
364
366
  }
365
367
  }
366
368
  }
369
+ }
367
370
  }
371
+ }
368
372
  case "message":
369
373
  return {
370
374
  type: 'string',
@@ -375,7 +379,11 @@ function hydrateDesiccatedSimpleNativeProperty(
375
379
  transformer: config.transformer as any,
376
380
  control({value}: SNPControlProps<string>) {
377
381
  const lines = useMemo(() => {
378
- return !value || !/\r?\n/.exec(value) ? value : value?.split(/\r?\n/g).flatMap(line => [<br />, line]).slice(1);
382
+ if (value && /\r?\n/.exec(value)) {
383
+ // eslint-disable-next-line react/jsx-key -- random <br /> elements don't need a key
384
+ return value.split(/\r?\n/g).flatMap(line => [<br />, line]).slice(1);
385
+ }
386
+ return value;
379
387
  }, [value]);
380
388
  return <Disabled children={lines} />;
381
389
  }
@@ -396,6 +404,7 @@ function hydrateDesiccatedSimpleNativeProperty(
396
404
  || (config.step !== undefined && !Number.isInteger(config.step));
397
405
  return <>
398
406
  <TextControl {...config.component}
407
+ __nextHasNoMarginBottom __next40pxDefaultSize
399
408
  type="number" value={value ?? ''} min={config.min} max={config.max} step={config.step ?? (float ? "any" : undefined)}
400
409
  onChange={safeOnChange} label={<Label />} help={config.help} placeholder={config.placeholder}
401
410
  />
@@ -433,7 +442,7 @@ function hydrateDesiccatedSimpleNativeProperty(
433
442
  return <>
434
443
  <RangeControl
435
444
  {...config.component} value={value} onChange={onChange} min={config.min} max={config.max} label={config.label}
436
- step={config.step} help={config.help}
445
+ step={config.step} help={config.help} __nextHasNoMarginBottom __next40pxDefaultSize
437
446
  />
438
447
  <Messages />
439
448
  </>;
@@ -470,7 +479,8 @@ function hydrateDesiccatedSimpleNativeProperty(
470
479
  transformer: config.transformer,
471
480
  control({value, onChange, slots: {Label, Messages}}) {
472
481
  return <>
473
- <TextControl {...config.component} value={value ?? ''} onChange={onChange} label={<Label />} help={config.help} placeholder={config.placeholder} />
482
+ <TextControl {...config.component} __nextHasNoMarginBottom __next40pxDefaultSize value={value ?? ''}
483
+ onChange={onChange} label={<Label />} help={config.help} placeholder={config.placeholder} />
474
484
  <Messages />
475
485
  </>;
476
486
  }
@@ -488,7 +498,8 @@ function hydrateDesiccatedSimpleNativeProperty(
488
498
  const switchCfg = useMemo(() => config.switch ?? {}, [config.switch]);
489
499
  if (switchCfg.small === true) {
490
500
  return <>
491
- <ToggleControl {...config.component as Partial<ComponentPropsWithoutRef<typeof ToggleControl>>} checked={value} onChange={onChange} label={<Label />} help={config.help} />
501
+ <ToggleControl {...config.component as Partial<ComponentPropsWithoutRef<typeof ToggleControl>>}
502
+ __nextHasNoMarginBottom checked={value} onChange={onChange} label={<Label />} help={config.help} />
492
503
  <Messages />
493
504
  </>;
494
505
  } else {
@@ -574,7 +585,7 @@ const ToggleGroupControlLabelSelector: string = " > .components-base-control > .
574
585
  type NumberLikeListTextControlProps = {listComponent?: ComponentPropsWithoutRef<typeof TextControl>, datum: string, itemType: string, onDatumChange(value: any): void};
575
586
  function NumberLikeListTextControl({listComponent, datum, itemType, onDatumChange}: NumberLikeListTextControlProps) {
576
587
  const onChange = useCallback((v: string) => onDatumChange(itemType !== 'float' ? parseInt(v) : parseFloat(v)), [itemType, onDatumChange])
577
- return <TextControl {...listComponent} type="number" value={datum} onChange={onChange} />
588
+ return <TextControl {...listComponent} __nextHasNoMarginBottom __next40pxDefaultSize type="number" value={datum} onChange={onChange} />
578
589
  }
579
590
 
580
591
  type PotentiallyExtendedRadioControlProps = CSNPControlComponentProps<RadioPropertyCSNPConfig, string>&SNPControlSlots;
@@ -839,7 +850,10 @@ function hydrateSelectProperty(config: SelectPropertyCSNPConfig): HydratedSimple
839
850
  control({value, onChange, slots: {Label, Messages}}) {
840
851
  const normalizedOptions = useAsOptions(useSuspendableOptions(config), value, config.clearable ? '' : undefined);
841
852
  return <>
842
- <SelectControl value={value ?? config.default ?? ''} onChange={onChange} options={normalizedOptions} label={<Label />} help={config.help}/>
853
+ <SelectControl
854
+ __nextHasNoMarginBottom __next40pxDefaultSize
855
+ value={value ?? config.default ?? ''} onChange={onChange} options={normalizedOptions} label={<Label />} help={config.help}
856
+ />
843
857
  <Messages />
844
858
  </>;
845
859
  }
@@ -172,7 +172,7 @@ export function resolveValueForCondition(propertyPath: RawPath, contextPath: Raw
172
172
  return undefined;
173
173
  }
174
174
  const dataStore = getDataStore(actualPath[0]);
175
- return walkToNodeWithLogging(dataStore ? dataStore.getValue(actualPath[0]) : select("core/block-editor").getBlockAttributes(blockClientId)?.[actualPath[0]], actualPath);
175
+ return walkToNodeWithLogging(dataStore ? dataStore.getValue(actualPath[0]) : select(blockEditorStore).getBlockAttributes(blockClientId)?.[actualPath[0]], actualPath);
176
176
  }
177
177
 
178
178
  function resolveActualPathToValueForCondition(propertyPath: RawPath, contextPath: RawPath): NodePath|undefined {
@@ -7,8 +7,8 @@ export * from "./utilities";
7
7
 
8
8
  export type {SuspendableOptionsHandler} from "./hooks/useSuspendableOptions";
9
9
 
10
- export {type DbSource, installCustomBlockBindingsSupport, registerCustomBlockBindingsSource} from "./basic-custom-block-bindings-support";
11
- export type {BlockName} from "../lib/useful-types"; // This is for backwards compatibility
10
+ export {installCustomBlockBindingsSupport, registerCustomBlockBindingsSource} from "./basic-custom-block-bindings-support";
11
+ export type {DbSource, BlockName} from "../lib/useful-types"; // This is for backwards compatibility
12
12
 
13
13
  import {installGutenbergExtensions} from "../index";
14
14
 
@@ -5,8 +5,9 @@ import type {HydratedLaidOutProperties} from "../simple-native-property-internal
5
5
 
6
6
  import React from "react";
7
7
 
8
+ type LaidOutPropertyRowProps = {property: HydratedLaidOutProperties[number], dataController?: DataController, inToolsPanel?: boolean};
8
9
  export function LaidOutPropertyRow(
9
- {property, dataController, inToolsPanel}: {property: HydratedLaidOutProperties[number], dataController?: DataController, inToolsPanel?: boolean}
10
+ {property, dataController, inToolsPanel}: LaidOutPropertyRowProps
10
11
  ) {
11
12
  if (Array.isArray(property)) {
12
13
  return <div style={{display: "flex", flexWrap: "wrap", columnGap: "8px"}}>
@@ -20,3 +21,8 @@ export function LaidOutPropertyRow(
20
21
  </NodeContextWrapper>;
21
22
  }
22
23
  }
24
+
25
+ export function makeLaidOutPropertyRow({property, ...args}: LaidOutPropertyRowProps) {
26
+ const key = Array.isArray(property) ? property.map(prop => prop.name).join('-') : property.name;
27
+ return <LaidOutPropertyRow key={key} property={property} {...args} />;
28
+ }
@@ -3,7 +3,7 @@ import {PanelBody} from "@wordpress/components";
3
3
  import {cautionFilled} from "@wordpress/icons";
4
4
 
5
5
  import {testCondition} from "../conditions";
6
- import {LaidOutPropertyRow} from "./LaidOutPropertyRow";
6
+ import {makeLaidOutPropertyRow} from "./LaidOutPropertyRow";
7
7
  import {HydratedSimpleNativePanel, isRootLevelPanelGroup} from "../simple-native-property-internal-shared";
8
8
  import {useSNPTreeContext} from "../SNPTreeContext";
9
9
 
@@ -25,9 +25,6 @@ export function PanelRoot({panel}: PanelRootProps) {
25
25
  : {};
26
26
 
27
27
  const panelGroup = panel.group === 'layered-styles' ? 'styles' : panel.group;
28
- const children = properties.map(property => {
29
- const key = Array.isArray(property) ? property.map(prop => prop.name).join('-') : property.name;
30
- return <LaidOutPropertyRow key={key} property={property} dataController={dataController}/>;
31
- });
28
+ const children = properties.map(property => makeLaidOutPropertyRow({property, dataController}));
32
29
  return <InspectorControls group={panelGroup} children={(raw ?? !isRootLevelPanelGroup(panelGroup)) ? children : <PanelBody {...panelBodyProps} {...bonusProps} children={children} />} />;
33
30
  }
@@ -2,7 +2,7 @@ import {InspectorControls} from "@wordpress/block-editor";
2
2
  import {PanelBody, TabPanel} from "@wordpress/components";
3
3
 
4
4
  import {testCondition} from "../conditions";
5
- import {LaidOutPropertyRow} from "./LaidOutPropertyRow";
5
+ import {LaidOutPropertyRow, makeLaidOutPropertyRow} from "./LaidOutPropertyRow";
6
6
  import type {DataController, InspectorPanelGroup} from "../simple-native-property-api";
7
7
  import type {HydratedSimpleNativeTab, HydratedSimpleNativeTabItem, HydratedSimpleNativeTabGroup} from "../simple-native-property-internal-shared";
8
8
  import {useSNPTreeContext} from "../SNPTreeContext";
@@ -51,6 +51,6 @@ type RenderedTabPanelProps = {dataController: DataController, panel: HydratedSim
51
51
  function RenderedTabPanel({dataController, panel}: RenderedTabPanelProps): ReactNode {
52
52
  // We have already tested the rendered-ness of the Panel earlier, so there's no need to redo it
53
53
  const {condition, properties, raw, ...panelBodyProps} = panel;
54
- const children = properties.map(property => <LaidOutPropertyRow property={property} dataController={dataController} />);
54
+ const children = properties.map(property => makeLaidOutPropertyRow({property, dataController}));
55
55
  return raw ? children : <PanelBody {...panelBodyProps} opened={panelBodyProps.title ? undefined : true} children={children} />;
56
56
  }
@@ -4,13 +4,13 @@ import type {UseBlockProps} from "@wordpress/block-editor/components/use-block-p
4
4
 
5
5
  import {plauditIcon} from "../lib/plaudit-icons";
6
6
 
7
- import type {ComponentType, ReactNode} from "react";
7
+ import type {ComponentType, ReactElement, ReactNode} from "react";
8
8
 
9
9
  export type SimpleBlockTypeConfig<TAttributes extends Record<string, any>> = {
10
10
  icon?: BlockConfiguration<TAttributes>['icon']|undefined,
11
11
  defaults?: Required<TAttributes>,
12
12
  controls?: NonNullable<Block<TAttributes>['edit']>,
13
- renderer: (attributes: BlockSaveProps<TAttributes>, wrapperProps: UseBlockProps|UseBlockProps['save'], InnerBlocks: () => React.ReactElement, mode: "edit"|"save") => ReactNode,
13
+ renderer: (attributes: BlockSaveProps<TAttributes>, wrapperProps: UseBlockProps|UseBlockProps['save'], InnerBlocks: () => ReactElement, mode: "edit"|"save") => ReactNode,
14
14
  innerBlocksProps?: InnerBlocks.Props,
15
15
  settings?: Partial<BlockConfiguration<TAttributes>>,
16
16
  };
@@ -1,3 +1,4 @@
1
+ import {store as blockEditorStore} from "@wordpress/block-editor";
1
2
  import {createHigherOrderComponent} from "@wordpress/compose";
2
3
  import {dispatch, select} from "@wordpress/data";
3
4
  import {useEffect, useMemo} from "@wordpress/element";
@@ -86,14 +87,13 @@ export function installSimpleNativePropertiesSupport() {
86
87
  });
87
88
 
88
89
  addFilter('editor.BlockEdit', 'plaudit/gutenberg-api-extensions/simple-native-properties',
89
- createHigherOrderComponent(BlockEdit => (blockEditProps: ActualBlockEditProps) => {
90
+ createHigherOrderComponent(BlockEdit => function SNPBlockEdit(blockEditProps: ActualBlockEditProps) {
90
91
  const blockSimpleNativePanelsAndTabs = select(gutenbergApiExtensionsStore).preppedProperties(blockEditProps.name);
91
92
  if (!blockSimpleNativePanelsAndTabs) {
92
93
  return <BlockEdit {...blockEditProps} />;
93
94
  }
94
- const selectedEditor = select("core/block-editor");
95
- if (selectedEditor.getBlockParentsByBlockName(blockEditProps.clientId, "core/block")?.length) {
96
- // If we have a core/block ancestor, then we can't be edited and attempting to self-edit will cause a crash
95
+ if (select(blockEditorStore).getBlockParentsByBlockName(blockEditProps.clientId, "core/block")?.length) {
96
+ // If we have a core/block ancestor, then we can't be edited, and attempting to self-edit will cause a crash
97
97
  return <BlockEdit {...blockEditProps} />;
98
98
  }
99
99
  return <DataControllerInitializationIsolator bep={blockEditProps} dcm={dataControllerManager} BlockEdit={BlockEdit} snpPanelsAndTabs={blockSimpleNativePanelsAndTabs} />;
@@ -120,7 +120,7 @@ export function installSimpleNativePropertiesSupport() {
120
120
  });
121
121
 
122
122
  addFilter('editor.BlockListBlock', 'plaudit/gutenberg-api-extensions/simple-native-properties',
123
- createHigherOrderComponent(BlockListBlock => (props: ActualBlockListBlockProps) => {
123
+ createHigherOrderComponent(BlockListBlock => function SNPBlockListBlock(props: ActualBlockListBlockProps) {
124
124
  const wrapperProps: {className?: string, style?: Record<string, unknown>} = {...props.wrapperProps};
125
125
  const extraPropTransforms = select(gutenbergApiExtensionsStore).computedExtraPropTransforms(props.name);
126
126
  if (!extraPropTransforms || !extraPropTransforms.appliesInEditor) {
@@ -63,6 +63,7 @@ export function AsynchronousFormTokenField(props: AsynchronousFormTokenFieldProp
63
63
  //TODO: If focus is in field but user hasn't started typing, show a message telling them to start typing
64
64
  return <>
65
65
  <FormTokenField
66
+ __next40pxDefaultSize
66
67
  value={currentTokens}
67
68
  label={props.label}
68
69
  placeholder="Start typing to see suggestions"
@@ -2,10 +2,10 @@ import {BaseControl, Button, useBaseControlProps} from "@wordpress/components";
2
2
  import {useCallback} from "@wordpress/element";
3
3
  import {dragHandle, Icon} from "@wordpress/icons";
4
4
 
5
- import {ProvidedSlot} from "../blocks";
6
-
7
5
  import {Reorder, useDragControls} from "framer-motion";
8
- import type {ReactNode} from "react";
6
+ import type {PointerEvent, ReactNode} from "react";
7
+
8
+ import {ProvidedSlot} from "../blocks";
9
9
  import {IndexedItemActionsMaker, KeyedValue, useSortableItemsModel} from "./hooks/useSortableItemsModel";
10
10
 
11
11
  export type BaseSortableItemsControlProps<D> = Omit<Parameters<typeof useBaseControlProps>[0], 'children'|'id'>&{
@@ -33,7 +33,7 @@ export function BaseSortableItemsControl<D>({
33
33
  const removeDisabled = min !== undefined && listLength <= min;
34
34
  const {baseControlProps, controlProps} = useBaseControlProps({...wrapperProps, label: Label ? <Label /> : label});
35
35
 
36
- return <BaseControl {...baseControlProps}>
36
+ return <BaseControl {...baseControlProps} __nextHasNoMarginBottom>
37
37
  <div {...controlProps} className="plaudit-sortable-items-container">
38
38
  <Reorder.Group
39
39
  axis="y" onReorder={commit} values={keyedValues}
@@ -58,7 +58,7 @@ function SortableItemsListNode<D>({datum, index, listLength, makeChild, makeInde
58
58
  //TODO: If used, implement addBefore and addAfter the same way as moveUp and moveDown
59
59
 
60
60
  const dragControls = useDragControls();
61
- const dragStartHandler = useCallback((event: React.PointerEvent) => dragControls.start(event), [dragControls]);
61
+ const dragStartHandler = useCallback((event: PointerEvent) => dragControls.start(event), [dragControls]);
62
62
 
63
63
  return <Reorder.Item className="plaudit-sortable-items-row" data-index={index} dragListener={false} dragControls={dragControls} layout="position" value={datum}>
64
64
  <div className="plaudit-sortable-items-ordering-controls">
@@ -66,8 +66,8 @@ function SortableItemsListNode<D>({datum, index, listLength, makeChild, makeInde
66
66
  <Icon icon={dragHandle} onPointerDown={dragStartHandler} />
67
67
  </div>
68
68
  <div className="plaudit-sortable-items-ordering-control">
69
- <Button icon="arrow-up" aria-label="Move Up" disabled={index < 1} onClick={moveUp} />
70
- <Button icon="arrow-down" aria-label="Move Down" disabled={index >= listLength - 1} onClick={moveDown} />
69
+ <Button icon="arrow-up" aria-label="Move Up" disabled={index < 1} onClick={moveUp} __next40pxDefaultSize accessibleWhenDisabled />
70
+ <Button icon="arrow-down" aria-label="Move Down" disabled={index >= listLength - 1} onClick={moveDown} __next40pxDefaultSize accessibleWhenDisabled />
71
71
  </div>
72
72
  </div>
73
73
  <div className="plaudit-sortable-items-inputs plaudit-sortable-items-padded">
@@ -76,7 +76,7 @@ function SortableItemsListNode<D>({datum, index, listLength, makeChild, makeInde
76
76
  <div className="plaudit-sortable-items-presence-controls plaudit-sortable-items-padded">
77
77
  {/*addEmptyHandlers && index === 0 &&
78
78
  <Button icon="insert" className="insert-before" disabled={addDisabled} onClick={addEmptyHandlers[0]} aria-label="Insert Before"/>*/}
79
- <Button icon="remove" disabled={removeDisabled} onClick={remove} aria-label="Remove"/>
79
+ <Button icon="remove" disabled={removeDisabled} onClick={remove} aria-label="Remove" __next40pxDefaultSize accessibleWhenDisabled />
80
80
  {/*addEmptyHandlers && <Button icon="insert" className="insert-after" disabled={addDisabled} onClick={addEmptyHandlers[1]}
81
81
  aria-label={index < listLength - 1 ? "Insert Between" : "Insert After"}/>*/}
82
82
  </div>
@@ -97,6 +97,8 @@ export function ExtendedFormTokenField(props: ExtendedFormTokenFieldProps) {
97
97
  __experimentalShowHowTo={props.multiple !== false}
98
98
  onInputChange={setDebouncedInput}
99
99
  onFocus={useCallback(() => setImmediateInput(input), [input])}
100
+ __next40pxDefaultSize
101
+ __nextHasNoMarginBottom
100
102
  />
101
103
  {help && <div><span className="components-form-token-field__help">{help}</span></div>}
102
104
  {hasLoadingError && <div><Spinner /><span className="components-form-token-field__help">{__("An Error Occurred While Loading Suggestions")}</span></div>}
@@ -71,7 +71,7 @@ export function ExtendedRadioControl(props: ExtendedRadioControlProps) {
71
71
  value={option.value}
72
72
  onChange={onChangeValue}
73
73
  checked={option.value === selected}
74
- aria-describedby={!!help ? `${id}__help` : undefined}
74
+ aria-describedby={help ? `${id}__help` : undefined}
75
75
  {...additionalProps}
76
76
  />
77
77
  <label
@@ -94,7 +94,7 @@ export function ExtendedRadioControl(props: ExtendedRadioControlProps) {
94
94
  value={customValue ?? ''}
95
95
  onChange={onChangeValue}
96
96
  checked={valueIsCustom}
97
- aria-describedby={!!help ? `${id}__help` : undefined}
97
+ aria-describedby={help ? `${id}__help` : undefined}
98
98
  {...additionalProps}
99
99
  />
100
100
  <label id={`${id}-custom-label`} className="components-radio-control__label" htmlFor={`${id}-${options.length}`}>Custom:</label>
@@ -58,7 +58,7 @@ export const ExtendedTextareaControl = (() => {
58
58
  }, [rich, debouncedUpdate, textareaRef.current]);
59
59
 
60
60
  return <>
61
- <TextareaControl ref={textareaRef} {...forwardedProps} value={v} onChange={safeOnChange} />
61
+ <TextareaControl {...forwardedProps} ref={textareaRef} value={v} onChange={safeOnChange} __nextHasNoMarginBottom />
62
62
  {Messages && <Messages/>}
63
63
  </>;
64
64
  })
@@ -24,7 +24,7 @@ export function FileControl(props: FileControlProps) {
24
24
 
25
25
  const attachment = useSuspenseSelect(select => value !== undefined ? select(coreStore).getMedia(value) : undefined, [value]);
26
26
  const {baseControlProps, controlProps} = useBaseControlProps({label, help});
27
- return <BaseControl {...baseControlProps}>
27
+ return <BaseControl {...baseControlProps} __nextHasNoMarginBottom>
28
28
  <MediaUploadCheck>
29
29
  <MediaUpload
30
30
  onSelect={onSelect}
@@ -32,13 +32,13 @@ export function FileControl(props: FileControlProps) {
32
32
  allowedTypes={allowedTypes}
33
33
  render={useCallback(({open}) => {
34
34
  if (!attachment?.id) {
35
- return <div {...controlProps}><Button onClick={open} children={__('Select a File', 'plaudit')}/></div>
35
+ return <div {...controlProps}><Button onClick={open} children={__('Select a File', 'plaudit')} __next40pxDefaultSize /></div>
36
36
  }
37
37
  return <div {...controlProps}>
38
38
  <p>{__('Selected File', 'plaudit')}: <a href={attachment.source_url} target="_blank" rel="noopener noreferrer">{attachment.title.rendered}</a></p>
39
39
  <div className="selected-file-control-buttons">
40
- <Button onClick={open} variant="secondary" children="Replace File" />
41
- <Button onClick={() => onChange(undefined)} isDestructive children={__('Remove File', 'plaudit')} />
40
+ <Button onClick={open} variant="secondary" children="Replace File" __next40pxDefaultSize />
41
+ <Button onClick={() => onChange(undefined)} isDestructive children={__('Remove File', 'plaudit')} __next40pxDefaultSize />
42
42
  </div>
43
43
  </div>;
44
44
  }, [attachment, onChange, controlProps])}