@wordpress/block-library 9.43.0 → 9.43.1-next.v.202604091042.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 (76) hide show
  1. package/build/code/edit.cjs +2 -1
  2. package/build/code/edit.cjs.map +2 -2
  3. package/build/cover/edit/color-utils.cjs +1 -1
  4. package/build/cover/edit/color-utils.cjs.map +2 -2
  5. package/build/cover/edit/index.cjs +31 -25
  6. package/build/cover/edit/index.cjs.map +2 -2
  7. package/build/cover/embed-video-utils.cjs +9 -7
  8. package/build/cover/embed-video-utils.cjs.map +2 -2
  9. package/build/file/utils/index.cjs +1 -1
  10. package/build/file/utils/index.cjs.map +2 -2
  11. package/build/form/view.cjs +1 -1
  12. package/build/form/view.cjs.map +2 -2
  13. package/build/icon/edit.cjs +1 -3
  14. package/build/icon/edit.cjs.map +2 -2
  15. package/build/image/image.cjs +4 -3
  16. package/build/image/image.cjs.map +2 -2
  17. package/build/navigation-link/link-ui/page-creator.cjs +1 -1
  18. package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
  19. package/build/navigation-link/shared/update-attributes.cjs +1 -1
  20. package/build/navigation-link/shared/update-attributes.cjs.map +2 -2
  21. package/build/navigation-link/shared/use-link-preview.cjs +1 -1
  22. package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
  23. package/build/pattern/edit.cjs +1 -1
  24. package/build/pattern/edit.cjs.map +2 -2
  25. package/build/search/block.json +0 -4
  26. package/build/search/edit.cjs +6 -33
  27. package/build/search/edit.cjs.map +2 -2
  28. package/build-module/code/edit.mjs +2 -1
  29. package/build-module/code/edit.mjs.map +2 -2
  30. package/build-module/cover/edit/color-utils.mjs +1 -1
  31. package/build-module/cover/edit/color-utils.mjs.map +2 -2
  32. package/build-module/cover/edit/index.mjs +39 -28
  33. package/build-module/cover/edit/index.mjs.map +2 -2
  34. package/build-module/cover/embed-video-utils.mjs +8 -6
  35. package/build-module/cover/embed-video-utils.mjs.map +2 -2
  36. package/build-module/file/utils/index.mjs +1 -1
  37. package/build-module/file/utils/index.mjs.map +2 -2
  38. package/build-module/form/view.mjs +1 -1
  39. package/build-module/form/view.mjs.map +2 -2
  40. package/build-module/icon/edit.mjs +1 -3
  41. package/build-module/icon/edit.mjs.map +2 -2
  42. package/build-module/image/image.mjs +4 -3
  43. package/build-module/image/image.mjs.map +2 -2
  44. package/build-module/navigation-link/link-ui/page-creator.mjs +1 -1
  45. package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
  46. package/build-module/navigation-link/shared/update-attributes.mjs +1 -1
  47. package/build-module/navigation-link/shared/update-attributes.mjs.map +2 -2
  48. package/build-module/navigation-link/shared/use-link-preview.mjs +1 -1
  49. package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
  50. package/build-module/pattern/edit.mjs +1 -1
  51. package/build-module/pattern/edit.mjs.map +2 -2
  52. package/build-module/search/block.json +0 -4
  53. package/build-module/search/edit.mjs +6 -33
  54. package/build-module/search/edit.mjs.map +2 -2
  55. package/build-style/code/style-rtl.css +1 -1
  56. package/build-style/code/style.css +1 -1
  57. package/build-style/style-rtl.css +1 -1
  58. package/build-style/style.css +1 -1
  59. package/package.json +38 -38
  60. package/src/code/edit.js +1 -0
  61. package/src/code/style.scss +1 -1
  62. package/src/cover/edit/color-utils.js +1 -1
  63. package/src/cover/edit/index.js +63 -34
  64. package/src/cover/embed-video-utils.js +10 -8
  65. package/src/embed/test/index.native.js +3 -2
  66. package/src/file/utils/index.js +1 -1
  67. package/src/form/view.js +1 -1
  68. package/src/icon/edit.js +1 -3
  69. package/src/image/image.js +6 -4
  70. package/src/image/index.php +4 -4
  71. package/src/navigation-link/link-ui/page-creator.js +1 -1
  72. package/src/navigation-link/shared/update-attributes.js +1 -1
  73. package/src/navigation-link/shared/use-link-preview.js +1 -1
  74. package/src/pattern/edit.js +1 -1
  75. package/src/search/block.json +0 -4
  76. package/src/search/edit.js +2 -35
@@ -57,7 +57,6 @@ function SearchEdit({
57
57
  buttonText,
58
58
  buttonPosition,
59
59
  buttonUseIcon,
60
- isSearchFieldHidden,
61
60
  style
62
61
  } = attributes;
63
62
  const wasJustInsertedIntoNavigationBlock = useSelect(
@@ -112,27 +111,13 @@ function SearchEdit({
112
111
  const isButtonPositionOutside = "button-outside" === buttonPosition;
113
112
  const hasNoButton = "no-button" === buttonPosition;
114
113
  const hasOnlyButton = "button-only" === buttonPosition;
114
+ const isSearchFieldHidden = hasOnlyButton && !isSelected;
115
115
  const searchFieldRef = useRef();
116
116
  const buttonRef = useRef();
117
117
  const units = useCustomUnits({
118
118
  availableUnits: ["%", "px"],
119
119
  defaultValues: { "%": PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT }
120
120
  });
121
- useEffect(() => {
122
- if (hasOnlyButton && !isSelected) {
123
- setAttributes({
124
- isSearchFieldHidden: true
125
- });
126
- }
127
- }, [hasOnlyButton, isSelected, setAttributes]);
128
- useEffect(() => {
129
- if (!hasOnlyButton || !isSelected) {
130
- return;
131
- }
132
- setAttributes({
133
- isSearchFieldHidden: false
134
- });
135
- }, [hasOnlyButton, isSelected, setAttributes, width]);
136
121
  const getBlockClassNames = () => {
137
122
  return clsx(
138
123
  className,
@@ -142,7 +127,7 @@ function SearchEdit({
142
127
  hasOnlyButton ? "wp-block-search__button-only" : void 0,
143
128
  !buttonUseIcon && !hasNoButton ? "wp-block-search__text-button" : void 0,
144
129
  buttonUseIcon && !hasNoButton ? "wp-block-search__icon-button" : void 0,
145
- hasOnlyButton && isSearchFieldHidden ? "wp-block-search__searchfield-hidden" : void 0
130
+ isSearchFieldHidden ? "wp-block-search__searchfield-hidden" : void 0
146
131
  );
147
132
  };
148
133
  const buttonPositionControls = [
@@ -223,13 +208,6 @@ function SearchEdit({
223
208
  borderBottomRightRadius: borderProps.style?.borderBottomRightRadius
224
209
  } : borderProps.style
225
210
  };
226
- const handleButtonClick = () => {
227
- if (hasOnlyButton) {
228
- setAttributes({
229
- isSearchFieldHidden: !isSearchFieldHidden
230
- });
231
- }
232
- };
233
211
  return /* @__PURE__ */ jsxs(Fragment, { children: [
234
212
  buttonUseIcon && /* @__PURE__ */ jsx(
235
213
  "button",
@@ -238,7 +216,6 @@ function SearchEdit({
238
216
  className: buttonClasses,
239
217
  style: buttonStyles,
240
218
  "aria-label": buttonText ? stripHTML(buttonText) : __("Search"),
241
- onClick: handleButtonClick,
242
219
  ref: buttonRef,
243
220
  children: /* @__PURE__ */ jsx(Icon, { icon: search })
244
221
  }
@@ -253,8 +230,7 @@ function SearchEdit({
253
230
  placeholder: __("Add button text\u2026"),
254
231
  withoutInteractiveFormatting: true,
255
232
  value: buttonText,
256
- onChange: (html) => setAttributes({ buttonText: html }),
257
- onClick: handleButtonClick
233
+ onChange: (html) => setAttributes({ buttonText: html })
258
234
  }
259
235
  )
260
236
  ] });
@@ -270,8 +246,7 @@ function SearchEdit({
270
246
  widthUnit: void 0,
271
247
  showLabel: true,
272
248
  buttonUseIcon: false,
273
- buttonPosition: "button-outside",
274
- isSearchFieldHidden: false
249
+ buttonPosition: "button-outside"
275
250
  });
276
251
  },
277
252
  dropdownMenuProps,
@@ -306,8 +281,7 @@ function SearchEdit({
306
281
  label: __("Button position"),
307
282
  onDeselect: () => {
308
283
  setAttributes({
309
- buttonPosition: "button-outside",
310
- isSearchFieldHidden: false
284
+ buttonPosition: "button-outside"
311
285
  });
312
286
  },
313
287
  isShownByDefault: true,
@@ -319,8 +293,7 @@ function SearchEdit({
319
293
  label: __("Button position"),
320
294
  onChange: (value) => {
321
295
  setAttributes({
322
- buttonPosition: value,
323
- isSearchFieldHidden: value === "button-only"
296
+ buttonPosition: value
324
297
  });
325
298
  },
326
299
  options: buttonPositionControls
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/search/edit.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tSelectControl,\n\tToggleControl,\n\tResizableBox,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon, search } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tisPercentageUnit,\n} from './utils.js';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\nconst PERCENTAGE_WIDTHS = [ 25, 50, 75, 100 ];\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tisSearchFieldHidden,\n\t\tstyle,\n\t} = attributes;\n\n\tconst wasJustInsertedIntoNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( wasJustInsertedIntoNavigationBlock ) {\n\t\t\t// This side-effect should not create an undo level.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\tshowLabel: false,\n\t\t\t\tbuttonUseIcon: true,\n\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t} );\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\twasJustInsertedIntoNavigationBlock,\n\t\tsetAttributes,\n\t] );\n\n\tconst borderRadius = style?.border?.radius;\n\tlet borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps = {\n\t\t\t...borderProps,\n\t\t\tstyle: {\n\t\t\t\t...borderProps.style,\n\t\t\t\tborderRadius: `${ borderRadius }px`,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst [ fluidTypographySettings, layout ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\tconst searchFieldRef = useRef();\n\tconst buttonRef = useRef();\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( hasOnlyButton && ! isSelected ) {\n\t\t\tsetAttributes( {\n\t\t\t\tisSearchFieldHidden: true,\n\t\t\t} );\n\t\t}\n\t}, [ hasOnlyButton, isSelected, setAttributes ] );\n\n\t// Show the search field when width changes.\n\tuseEffect( () => {\n\t\tif ( ! hasOnlyButton || ! isSelected ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tisSearchFieldHidden: false,\n\t\t} );\n\t}, [ hasOnlyButton, isSelected, setAttributes, width ] );\n\n\tconst getBlockClassNames = () => {\n\t\treturn clsx(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined,\n\t\t\thasOnlyButton && isSearchFieldHidden\n\t\t\t\t? 'wp-block-search__searchfield-hidden'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\tlabel: __( 'Button outside' ),\n\t\t\tvalue: 'button-outside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button inside' ),\n\t\t\tvalue: 'button-inside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'No button' ),\n\t\t\tvalue: 'no-button',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button only' ),\n\t\t\tvalue: 'button-only',\n\t\t},\n\t];\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = clsx(\n\t\t\t'wp-block-search__input',\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\ttypographyProps.className\n\t\t);\n\t\tconst textFieldStyles = {\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? {\n\t\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopLeftRadius,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t\t }\n\t\t\t\t: borderProps.style ),\n\t\t\t...typographyProps.style,\n\t\t\ttextDecoration: undefined,\n\t\t};\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder\u2026' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t\tref={ searchFieldRef }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = clsx(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\ttypographyProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...typographyProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? {\n\t\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopLeftRadius,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t\t }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\t\tconst handleButtonClick = () => {\n\t\t\tif ( hasOnlyButton ) {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tisSearchFieldHidden: ! isSearchFieldHidden,\n\t\t\t\t} );\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\t\tref={ buttonRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ search } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"buttonText\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text\u2026' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst controls = (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! showLabel }\n\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowLabel: value,\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</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => buttonPosition !== 'button-outside' }\n\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tvalue={ buttonPosition }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonPosition: value,\n\t\t\t\t\t\t\t\t\tisSearchFieldHidden:\n\t\t\t\t\t\t\t\t\t\tvalue === 'button-only',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\toptions={ buttonPositionControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ buttonPosition !== 'no-button' && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! buttonUseIcon }\n\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tchecked={ buttonUseIcon }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tbuttonUseIcon: value,\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</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! width }\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\t\tid={ unitControlInputId } // Unused, kept for backwards compatibility\n\t\t\t\t\t\t\t\tmin={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t: MIN_WIDTH\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tconst parsedNewWidth =\n\t\t\t\t\t\t\t\t\t\tnewWidth === ''\n\t\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t\t: parseInt( newWidth, 10 );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: parsedNewWidth,\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\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\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\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\t\tPERCENTAGE_WIDTHS.includes( width ) &&\n\t\t\t\t\t\t\t\t\twidthUnit === '%'\n\t\t\t\t\t\t\t\t\t\t? width\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: newWidth,\n\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\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\tisBlock\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ PERCENTAGE_WIDTHS.map( ( widthValue ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %d: Percentage value. */\n\t\t\t\t\t\t\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\t\t\t\t\t\t\twidthValue\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t/>\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</ToggleGroupControl>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst isNonZeroBorderRadius = ( radius ) =>\n\t\tradius !== undefined && parseInt( radius, 10 ) !== 0;\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tisNonZeroBorderRadius( radius )\n\t\t\t? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`\n\t\t\t: undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tif ( isButtonPositionInside ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst {\n\t\t\t\t\tborderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius,\n\t\t\t\t} = borderProps.style;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( borderTopLeftRadius ),\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tpadBorderRadius( borderTopRightRadius ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius(\n\t\t\t\t\t\tborderBottomLeftRadius\n\t\t\t\t\t),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius(\n\t\t\t\t\t\tborderBottomRightRadius\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t\tstyle: {\n\t\t\t...typographyProps.style,\n\t\t\t// Input opts out of text decoration.\n\t\t\ttextDecoration: undefined,\n\t\t},\n\t} );\n\n\tconst labelClassnames = clsx(\n\t\t'wp-block-search__label',\n\t\ttypographyProps.className\n\t);\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<RichText\n\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\tclassName={ labelClassnames }\n\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add label\u2026' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( html ) => setAttributes( { label: html } ) }\n\t\t\t\t\tstyle={ typographyProps.style }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth:\n\t\t\t\t\t\twidth === undefined\n\t\t\t\t\t\t\t? 'auto'\n\t\t\t\t\t\t\t: `${ width }${ widthUnit }`,\n\t\t\t\t\theight: 'auto',\n\t\t\t\t} }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\tisButtonPositionInside ? borderProps.className : undefined\n\t\t\t\t) }\n\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\tenable={ getResizableSides() }\n\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t>\n\t\t\t\t{ ( isButtonPositionInside ||\n\t\t\t\t\tisButtonPositionOutside ||\n\t\t\t\t\thasOnlyButton ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t</ResizableBox>\n\t\t</div>\n\t);\n}\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC,+BAA+B;AAAA,EAC/B,iCAAiC;AAAA,EACjC,SAAS;AAAA,EACT;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa,iBAAiB;AACvC,SAAS,WAAW,cAAc;AAClC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,EAChC,wBAAwB;AAAA,OAClB;AACP,SAAS,qBAAqB;AAC9B,SAAS,MAAM,cAAc;AAC7B,SAAS,IAAI,eAAe;AAC5B,SAAS,uBAAuB,iBAAiB;AAKjD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,sCAAsC;AAwM5C,SAwDA,UAxDA,KAwDA,YAxDA;AApMH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WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tSelectControl,\n\tToggleControl,\n\tResizableBox,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon, search } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tisPercentageUnit,\n} from './utils.js';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\nconst PERCENTAGE_WIDTHS = [ 25, 50, 75, 100 ];\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tstyle,\n\t} = attributes;\n\n\tconst wasJustInsertedIntoNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( wasJustInsertedIntoNavigationBlock ) {\n\t\t\t// This side-effect should not create an undo level.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\tshowLabel: false,\n\t\t\t\tbuttonUseIcon: true,\n\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t} );\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\twasJustInsertedIntoNavigationBlock,\n\t\tsetAttributes,\n\t] );\n\n\tconst borderRadius = style?.border?.radius;\n\tlet borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps = {\n\t\t\t...borderProps,\n\t\t\tstyle: {\n\t\t\t\t...borderProps.style,\n\t\t\t\tborderRadius: `${ borderRadius }px`,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst [ fluidTypographySettings, layout ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\tconst isSearchFieldHidden = hasOnlyButton && ! isSelected;\n\tconst searchFieldRef = useRef();\n\tconst buttonRef = useRef();\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tconst getBlockClassNames = () => {\n\t\treturn clsx(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined,\n\t\t\tisSearchFieldHidden\n\t\t\t\t? 'wp-block-search__searchfield-hidden'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\tlabel: __( 'Button outside' ),\n\t\t\tvalue: 'button-outside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button inside' ),\n\t\t\tvalue: 'button-inside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'No button' ),\n\t\t\tvalue: 'no-button',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button only' ),\n\t\t\tvalue: 'button-only',\n\t\t},\n\t];\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = clsx(\n\t\t\t'wp-block-search__input',\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\ttypographyProps.className\n\t\t);\n\t\tconst textFieldStyles = {\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? {\n\t\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopLeftRadius,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t\t }\n\t\t\t\t: borderProps.style ),\n\t\t\t...typographyProps.style,\n\t\t\ttextDecoration: undefined,\n\t\t};\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder\u2026' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t\tref={ searchFieldRef }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = clsx(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\ttypographyProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...typographyProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? {\n\t\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopLeftRadius,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t\t }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tref={ buttonRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ search } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"buttonText\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text\u2026' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst controls = (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! showLabel }\n\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowLabel: value,\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</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => buttonPosition !== 'button-outside' }\n\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tvalue={ buttonPosition }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonPosition: value,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\toptions={ buttonPositionControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ buttonPosition !== 'no-button' && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! buttonUseIcon }\n\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tchecked={ buttonUseIcon }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tbuttonUseIcon: value,\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</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! width }\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\t\tid={ unitControlInputId } // Unused, kept for backwards compatibility\n\t\t\t\t\t\t\t\tmin={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t: MIN_WIDTH\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tconst parsedNewWidth =\n\t\t\t\t\t\t\t\t\t\tnewWidth === ''\n\t\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t\t: parseInt( newWidth, 10 );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: parsedNewWidth,\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\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\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\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\t\tPERCENTAGE_WIDTHS.includes( width ) &&\n\t\t\t\t\t\t\t\t\twidthUnit === '%'\n\t\t\t\t\t\t\t\t\t\t? width\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: newWidth,\n\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\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\tisBlock\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ PERCENTAGE_WIDTHS.map( ( widthValue ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %d: Percentage value. */\n\t\t\t\t\t\t\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\t\t\t\t\t\t\twidthValue\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t/>\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</ToggleGroupControl>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst isNonZeroBorderRadius = ( radius ) =>\n\t\tradius !== undefined && parseInt( radius, 10 ) !== 0;\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tisNonZeroBorderRadius( radius )\n\t\t\t? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`\n\t\t\t: undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tif ( isButtonPositionInside ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst {\n\t\t\t\t\tborderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius,\n\t\t\t\t} = borderProps.style;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( borderTopLeftRadius ),\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tpadBorderRadius( borderTopRightRadius ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius(\n\t\t\t\t\t\tborderBottomLeftRadius\n\t\t\t\t\t),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius(\n\t\t\t\t\t\tborderBottomRightRadius\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t\tstyle: {\n\t\t\t...typographyProps.style,\n\t\t\t// Input opts out of text decoration.\n\t\t\ttextDecoration: undefined,\n\t\t},\n\t} );\n\n\tconst labelClassnames = clsx(\n\t\t'wp-block-search__label',\n\t\ttypographyProps.className\n\t);\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<RichText\n\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\tclassName={ labelClassnames }\n\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add label\u2026' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( html ) => setAttributes( { label: html } ) }\n\t\t\t\t\tstyle={ typographyProps.style }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth:\n\t\t\t\t\t\twidth === undefined\n\t\t\t\t\t\t\t? 'auto'\n\t\t\t\t\t\t\t: `${ width }${ widthUnit }`,\n\t\t\t\t\theight: 'auto',\n\t\t\t\t} }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\tisButtonPositionInside ? borderProps.className : undefined\n\t\t\t\t) }\n\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\tenable={ getResizableSides() }\n\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t>\n\t\t\t\t{ ( isButtonPositionInside ||\n\t\t\t\t\tisButtonPositionOutside ||\n\t\t\t\t\thasOnlyButton ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t</ResizableBox>\n\t\t</div>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,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[]
7
7
  }
@@ -5,7 +5,7 @@
5
5
  display: block;
6
6
  font-family: inherit;
7
7
  overflow-wrap: break-word;
8
- white-space: pre-wrap;
8
+ white-space: break-spaces;
9
9
  direction: ltr;
10
10
  text-align: initial;
11
11
  }
@@ -5,7 +5,7 @@
5
5
  display: block;
6
6
  font-family: inherit;
7
7
  overflow-wrap: break-word;
8
- white-space: pre-wrap;
8
+ white-space: break-spaces;
9
9
  /*!rtl:begin:ignore*/
10
10
  direction: ltr;
11
11
  text-align: initial;
@@ -427,7 +427,7 @@
427
427
  display: block;
428
428
  font-family: inherit;
429
429
  overflow-wrap: break-word;
430
- white-space: pre-wrap;
430
+ white-space: break-spaces;
431
431
  direction: ltr;
432
432
  text-align: initial;
433
433
  }
@@ -430,7 +430,7 @@
430
430
  display: block;
431
431
  font-family: inherit;
432
432
  overflow-wrap: break-word;
433
- white-space: pre-wrap;
433
+ white-space: break-spaces;
434
434
  /*!rtl:begin:ignore*/
435
435
  direction: ltr;
436
436
  text-align: initial;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "9.43.0",
3
+ "version": "9.43.1-next.v.202604091042.0+668146787",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -95,42 +95,42 @@
95
95
  ],
96
96
  "dependencies": {
97
97
  "@arraypress/waveform-player": "1.2.1",
98
- "@wordpress/a11y": "^4.43.0",
99
- "@wordpress/api-fetch": "^7.43.0",
100
- "@wordpress/autop": "^4.43.0",
101
- "@wordpress/base-styles": "^6.19.0",
102
- "@wordpress/blob": "^4.43.0",
103
- "@wordpress/block-editor": "^15.16.0",
104
- "@wordpress/blocks": "^15.16.0",
105
- "@wordpress/components": "^32.5.0",
106
- "@wordpress/compose": "^7.43.0",
107
- "@wordpress/core-data": "^7.43.0",
108
- "@wordpress/data": "^10.43.0",
109
- "@wordpress/date": "^5.43.0",
110
- "@wordpress/deprecated": "^4.43.0",
111
- "@wordpress/dom": "^4.43.0",
112
- "@wordpress/element": "^6.43.0",
113
- "@wordpress/escape-html": "^3.43.0",
114
- "@wordpress/hooks": "^4.43.0",
115
- "@wordpress/html-entities": "^4.43.0",
116
- "@wordpress/i18n": "^6.16.0",
117
- "@wordpress/icons": "^12.1.0",
118
- "@wordpress/interactivity": "^6.43.0",
119
- "@wordpress/interactivity-router": "^2.43.0",
120
- "@wordpress/keyboard-shortcuts": "^5.43.0",
121
- "@wordpress/keycodes": "^4.43.0",
122
- "@wordpress/latex-to-mathml": "^1.11.0",
123
- "@wordpress/notices": "^5.43.0",
124
- "@wordpress/patterns": "^2.43.0",
125
- "@wordpress/primitives": "^4.43.0",
126
- "@wordpress/private-apis": "^1.43.0",
127
- "@wordpress/reusable-blocks": "^5.43.0",
128
- "@wordpress/rich-text": "^7.43.0",
129
- "@wordpress/server-side-render": "^6.19.0",
130
- "@wordpress/upload-media": "^0.28.0",
131
- "@wordpress/url": "^4.43.0",
132
- "@wordpress/viewport": "^6.43.0",
133
- "@wordpress/wordcount": "^4.43.0",
98
+ "@wordpress/a11y": "^4.43.1-next.v.202604091042.0+668146787",
99
+ "@wordpress/api-fetch": "^7.43.1-next.v.202604091042.0+668146787",
100
+ "@wordpress/autop": "^4.43.1-next.v.202604091042.0+668146787",
101
+ "@wordpress/base-styles": "^6.19.1-next.v.202604091042.0+668146787",
102
+ "@wordpress/blob": "^4.43.1-next.v.202604091042.0+668146787",
103
+ "@wordpress/block-editor": "^15.16.1-next.v.202604091042.0+668146787",
104
+ "@wordpress/blocks": "^15.16.1-next.v.202604091042.0+668146787",
105
+ "@wordpress/components": "^32.5.2-next.v.202604091042.0+668146787",
106
+ "@wordpress/compose": "^7.43.1-next.v.202604091042.0+668146787",
107
+ "@wordpress/core-data": "^7.43.2-next.v.202604091042.0+668146787",
108
+ "@wordpress/data": "^10.43.1-next.v.202604091042.0+668146787",
109
+ "@wordpress/date": "^5.43.1-next.v.202604091042.0+668146787",
110
+ "@wordpress/deprecated": "^4.43.1-next.v.202604091042.0+668146787",
111
+ "@wordpress/dom": "^4.43.1-next.v.202604091042.0+668146787",
112
+ "@wordpress/element": "^6.44.1-next.v.202604091042.0+668146787",
113
+ "@wordpress/escape-html": "^3.43.1-next.v.202604091042.0+668146787",
114
+ "@wordpress/hooks": "^4.43.1-next.v.202604091042.0+668146787",
115
+ "@wordpress/html-entities": "^4.43.1-next.v.202604091042.0+668146787",
116
+ "@wordpress/i18n": "^6.17.1-next.v.202604091042.0+668146787",
117
+ "@wordpress/icons": "^12.1.1-next.v.202604091042.0+668146787",
118
+ "@wordpress/interactivity": "^6.43.1-next.v.202604091042.0+668146787",
119
+ "@wordpress/interactivity-router": "^2.43.1-next.v.202604091042.0+668146787",
120
+ "@wordpress/keyboard-shortcuts": "^5.43.1-next.v.202604091042.0+668146787",
121
+ "@wordpress/keycodes": "^4.43.1-next.v.202604091042.0+668146787",
122
+ "@wordpress/latex-to-mathml": "^1.11.1-next.v.202604091042.0+668146787",
123
+ "@wordpress/notices": "^5.43.1-next.v.202604091042.0+668146787",
124
+ "@wordpress/patterns": "^2.43.1-next.v.202604091042.0+668146787",
125
+ "@wordpress/primitives": "^4.43.1-next.v.202604091042.0+668146787",
126
+ "@wordpress/private-apis": "^1.43.1-next.v.202604091042.0+668146787",
127
+ "@wordpress/reusable-blocks": "^5.43.1-next.v.202604091042.0+668146787",
128
+ "@wordpress/rich-text": "^7.43.1-next.v.202604091042.0+668146787",
129
+ "@wordpress/server-side-render": "^6.19.1-next.v.202604091042.0+668146787",
130
+ "@wordpress/upload-media": "^0.28.1-next.v.202604091042.0+668146787",
131
+ "@wordpress/url": "^4.43.1-next.v.202604091042.0+668146787",
132
+ "@wordpress/viewport": "^6.43.1-next.v.202604091042.0+668146787",
133
+ "@wordpress/wordcount": "^4.43.1-next.v.202604091042.0+668146787",
134
134
  "change-case": "^4.1.2",
135
135
  "clsx": "^2.1.1",
136
136
  "colord": "^2.7.0",
@@ -151,5 +151,5 @@
151
151
  "publishConfig": {
152
152
  "access": "public"
153
153
  },
154
- "gitHead": "2cea90674d11aa521ec3f71652fb3a6a4c383969"
154
+ "gitHead": "73606df74f1c38a084bfa5db97205259ef817593"
155
155
  }
package/src/code/edit.js CHANGED
@@ -29,6 +29,7 @@ export default function CodeEdit( {
29
29
  __unstableOnSplitAtDoubleLineEnd={ () =>
30
30
  insertBlocksAfter( createBlock( getDefaultBlockName() ) )
31
31
  }
32
+ style={ { whiteSpace: 'break-spaces' } }
32
33
  />
33
34
  </pre>
34
35
  );
@@ -8,7 +8,7 @@
8
8
  display: block;
9
9
  font-family: inherit;
10
10
  overflow-wrap: break-word;
11
- white-space: pre-wrap;
11
+ white-space: break-spaces;
12
12
  // Set direction and avoid inheriting alignment from a parent element.
13
13
  /*!rtl:begin:ignore*/
14
14
  direction: ltr;
@@ -92,7 +92,7 @@ export const getMediaColor = memoize( async ( url ) => {
92
92
  crossOrigin: imgCrossOrigin,
93
93
  } );
94
94
  return color.hex;
95
- } catch ( error ) {
95
+ } catch {
96
96
  // If there's an error return the fallback color.
97
97
  return DEFAULT_BACKGROUND_COLOR;
98
98
  }
@@ -7,8 +7,13 @@ import clsx from 'clsx';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { useEntityProp, store as coreStore } from '@wordpress/core-data';
10
- import { useEffect, useMemo, useRef } from '@wordpress/element';
11
- import { Placeholder, Spinner } from '@wordpress/components';
10
+ import {
11
+ useEffect,
12
+ useLayoutEffect,
13
+ useMemo,
14
+ useRef,
15
+ } from '@wordpress/element';
16
+ import { Placeholder, SandBox, Spinner } from '@wordpress/components';
12
17
  import { compose, useResizeObserver } from '@wordpress/compose';
13
18
  import {
14
19
  withColors,
@@ -49,7 +54,7 @@ import {
49
54
  DEFAULT_OVERLAY_COLOR,
50
55
  } from './color-utils';
51
56
  import { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';
52
- import { getIframeSrc, getBackgroundVideoSrc } from '../embed-video-utils';
57
+ import { getBackgroundEmbedHtml } from '../embed-video-utils';
53
58
 
54
59
  function getInnerBlocksTemplate( attributes ) {
55
60
  return [
@@ -121,6 +126,14 @@ function CoverEdit( {
121
126
 
122
127
  const { __unstableMarkNextChangeAsNotPersistent } =
123
128
  useDispatch( blockEditorStore );
129
+
130
+ // Ref to access latest values after async operations (e.g. getMediaColor),
131
+ // avoiding stale values that could overwrite concurrent remote changes.
132
+ const propsRef = useRef( { attributes, overlayColor } );
133
+ useLayoutEffect( () => {
134
+ propsRef.current = { attributes, overlayColor };
135
+ } );
136
+
124
137
  const { media } = useSelect(
125
138
  ( select ) => {
126
139
  return {
@@ -155,22 +168,26 @@ function CoverEdit( {
155
168
 
156
169
  const averageBackgroundColor = await getMediaColor( mediaUrl );
157
170
 
158
- let newOverlayColor = overlayColor.color;
159
- if ( ! isUserOverlayColor ) {
171
+ // Read latest values after await to avoid stale closures.
172
+ const { attributes: currentAttrs, overlayColor: currentOverlay } =
173
+ propsRef.current;
174
+
175
+ let newOverlayColor = currentOverlay.color;
176
+ if ( ! currentAttrs.isUserOverlayColor ) {
160
177
  newOverlayColor = averageBackgroundColor;
161
178
  __unstableMarkNextChangeAsNotPersistent();
162
179
  setOverlayColor( newOverlayColor );
163
180
  }
164
181
 
165
182
  const newIsDark = compositeIsDark(
166
- dimRatio,
183
+ currentAttrs.dimRatio,
167
184
  newOverlayColor,
168
185
  averageBackgroundColor
169
186
  );
170
187
  __unstableMarkNextChangeAsNotPersistent();
171
188
  setAttributes( {
172
189
  isDark: newIsDark,
173
- isUserOverlayColor: isUserOverlayColor || false,
190
+ isUserOverlayColor: currentAttrs.isUserOverlayColor || false,
174
191
  } );
175
192
  } )();
176
193
  // Update the block only when the featured image changes.
@@ -201,8 +218,12 @@ function CoverEdit( {
201
218
  isImage ? newMedia?.url : undefined
202
219
  );
203
220
 
204
- let newOverlayColor = overlayColor.color;
205
- if ( ! isUserOverlayColor ) {
221
+ // Read latest values to avoid stale closures.
222
+ const { attributes: currentAttrs, overlayColor: currentOverlay } =
223
+ propsRef.current;
224
+
225
+ let newOverlayColor = currentOverlay.color;
226
+ if ( ! currentAttrs.isUserOverlayColor ) {
206
227
  newOverlayColor = averageBackgroundColor;
207
228
  setOverlayColor( newOverlayColor );
208
229
 
@@ -214,7 +235,9 @@ function CoverEdit( {
214
235
  // to avoid resetting to 50 if it has been explicitly set to 100.
215
236
  // See issue #52835 for context.
216
237
  const newDimRatio =
217
- originalUrl === undefined && dimRatio === 100 ? 50 : dimRatio;
238
+ currentAttrs.url === undefined && currentAttrs.dimRatio === 100
239
+ ? 50
240
+ : currentAttrs.dimRatio;
218
241
 
219
242
  const newIsDark = compositeIsDark(
220
243
  newDimRatio,
@@ -256,7 +279,7 @@ function CoverEdit( {
256
279
  useFeaturedImage: undefined,
257
280
  dimRatio: newDimRatio,
258
281
  isDark: newIsDark,
259
- isUserOverlayColor: isUserOverlayColor || false,
282
+ isUserOverlayColor: currentAttrs.isUserOverlayColor || false,
260
283
  } );
261
284
  };
262
285
 
@@ -290,8 +313,12 @@ function CoverEdit( {
290
313
 
291
314
  const onSetOverlayColor = async ( newOverlayColor ) => {
292
315
  const averageBackgroundColor = await getMediaColor( url );
316
+
317
+ // Read latest dimRatio after await to avoid stale closure.
318
+ const { attributes: currentAttrs } = propsRef.current;
319
+
293
320
  const newIsDark = compositeIsDark(
294
- dimRatio,
321
+ currentAttrs.dimRatio,
295
322
  newOverlayColor,
296
323
  averageBackgroundColor
297
324
  );
@@ -309,9 +336,13 @@ function CoverEdit( {
309
336
 
310
337
  const onUpdateDimRatio = async ( newDimRatio ) => {
311
338
  const averageBackgroundColor = await getMediaColor( url );
339
+
340
+ // Read latest overlayColor after await to avoid stale closure.
341
+ const { overlayColor: currentOverlay } = propsRef.current;
342
+
312
343
  const newIsDark = compositeIsDark(
313
344
  newDimRatio,
314
- overlayColor.color,
345
+ currentOverlay.color,
315
346
  averageBackgroundColor
316
347
  );
317
348
 
@@ -365,23 +396,15 @@ function CoverEdit( {
365
396
  [ url, backgroundType ]
366
397
  );
367
398
 
368
- // Compute embedSrc on-the-fly from embed preview for editor display
369
- const embedSrc = useMemo( () => {
399
+ // Compute embed HTML for editor display via SandBox
400
+ const embedHtml = useMemo( () => {
370
401
  if (
371
402
  backgroundType !== EMBED_VIDEO_BACKGROUND_TYPE ||
372
403
  ! embedPreview?.html
373
404
  ) {
374
405
  return null;
375
406
  }
376
-
377
- // Extract iframe src from embed HTML
378
- const iframeSrc = getIframeSrc( embedPreview.html );
379
- if ( ! iframeSrc ) {
380
- return null;
381
- }
382
-
383
- // Modify the src to add background video parameters (provider auto-detected)
384
- return getBackgroundVideoSrc( iframeSrc );
407
+ return getBackgroundEmbedHtml( embedPreview.html );
385
408
  }, [ embedPreview, backgroundType ] );
386
409
 
387
410
  const isUploadingMedia = isTemporaryMedia( id, url );
@@ -477,11 +500,15 @@ function CoverEdit( {
477
500
  ? await getMediaColor( mediaUrl )
478
501
  : DEFAULT_BACKGROUND_COLOR;
479
502
 
480
- const newOverlayColor = ! isUserOverlayColor
503
+ // Read latest values after await to avoid stale closures.
504
+ const { attributes: currentAttrs, overlayColor: currentOverlay } =
505
+ propsRef.current;
506
+
507
+ const newOverlayColor = ! currentAttrs.isUserOverlayColor
481
508
  ? averageBackgroundColor
482
- : overlayColor.color;
509
+ : currentOverlay.color;
483
510
 
484
- if ( ! isUserOverlayColor ) {
511
+ if ( ! currentAttrs.isUserOverlayColor ) {
485
512
  if ( newUseFeaturedImage ) {
486
513
  setOverlayColor( newOverlayColor );
487
514
  } else {
@@ -492,7 +519,8 @@ function CoverEdit( {
492
519
  __unstableMarkNextChangeAsNotPersistent();
493
520
  }
494
521
 
495
- const newDimRatio = dimRatio === 100 ? 50 : dimRatio;
522
+ const newDimRatio =
523
+ currentAttrs.dimRatio === 100 ? 50 : currentAttrs.dimRatio;
496
524
  const newIsDark = compositeIsDark(
497
525
  newDimRatio,
498
526
  newOverlayColor,
@@ -668,21 +696,22 @@ function CoverEdit( {
668
696
  style={ mediaStyle }
669
697
  />
670
698
  ) }
671
- { isEmbedVideoBackground && embedSrc && (
699
+ { isEmbedVideoBackground && embedHtml && (
672
700
  <div
673
701
  ref={ mediaElement }
674
702
  className="wp-block-cover__video-background wp-block-cover__embed-background"
675
703
  style={ mediaStyle }
676
704
  >
677
- <iframe
678
- src={ embedSrc }
705
+ <SandBox
706
+ html={ embedHtml }
679
707
  title="Background video"
680
- frameBorder="0"
681
- allow="autoplay; fullscreen"
708
+ styles={ [
709
+ 'iframe{position:fixed;top:0;left:0;width:100%;height:100%;}',
710
+ ] }
682
711
  />
683
712
  </div>
684
713
  ) }
685
- { isEmbedVideoBackground && ! embedSrc && isFetchingEmbed && (
714
+ { isEmbedVideoBackground && ! embedHtml && isFetchingEmbed && (
686
715
  <Spinner />
687
716
  ) }
688
717