@wordpress/format-library 4.35.0 → 5.0.1

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 (94) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/bold/index.js +19 -17
  3. package/build/bold/index.js.map +1 -1
  4. package/build/code/index.js +14 -12
  5. package/build/code/index.js.map +1 -1
  6. package/build/image/index.js +79 -85
  7. package/build/image/index.js.map +1 -1
  8. package/build/italic/index.js +19 -17
  9. package/build/italic/index.js.map +1 -1
  10. package/build/keyboard/index.js +2 -2
  11. package/build/keyboard/index.js.map +1 -1
  12. package/build/language/index.js +63 -58
  13. package/build/language/index.js.map +1 -1
  14. package/build/link/index.js +33 -31
  15. package/build/link/index.js.map +1 -1
  16. package/build/link/index.native.js +20 -18
  17. package/build/link/index.native.js.map +1 -1
  18. package/build/link/inline.js +24 -23
  19. package/build/link/inline.js.map +1 -1
  20. package/build/link/modal-screens/link-picker-screen.native.js +2 -2
  21. package/build/link/modal-screens/link-picker-screen.native.js.map +1 -1
  22. package/build/link/modal-screens/link-settings-screen.native.js +28 -24
  23. package/build/link/modal-screens/link-settings-screen.native.js.map +1 -1
  24. package/build/link/modal.native.js +20 -16
  25. package/build/link/modal.native.js.map +1 -1
  26. package/build/non-breaking-space/index.js +2 -2
  27. package/build/non-breaking-space/index.js.map +1 -1
  28. package/build/strikethrough/index.js +14 -12
  29. package/build/strikethrough/index.js.map +1 -1
  30. package/build/subscript/index.js +2 -2
  31. package/build/subscript/index.js.map +1 -1
  32. package/build/superscript/index.js +2 -2
  33. package/build/superscript/index.js.map +1 -1
  34. package/build/text-color/index.js +24 -22
  35. package/build/text-color/index.js.map +1 -1
  36. package/build/text-color/index.native.js +36 -30
  37. package/build/text-color/index.native.js.map +1 -1
  38. package/build/text-color/inline.js +22 -17
  39. package/build/text-color/inline.js.map +1 -1
  40. package/build/text-color/inline.native.js +20 -16
  41. package/build/text-color/inline.native.js.map +1 -1
  42. package/build/underline/index.js +11 -9
  43. package/build/underline/index.js.map +1 -1
  44. package/build/unknown/index.js +2 -2
  45. package/build/unknown/index.js.map +1 -1
  46. package/build-module/bold/index.js +21 -17
  47. package/build-module/bold/index.js.map +1 -1
  48. package/build-module/code/index.js +16 -12
  49. package/build-module/code/index.js.map +1 -1
  50. package/build-module/image/index.js +80 -85
  51. package/build-module/image/index.js.map +1 -1
  52. package/build-module/italic/index.js +21 -17
  53. package/build-module/italic/index.js.map +1 -1
  54. package/build-module/keyboard/index.js +2 -2
  55. package/build-module/keyboard/index.js.map +1 -1
  56. package/build-module/language/index.js +65 -58
  57. package/build-module/language/index.js.map +1 -1
  58. package/build-module/link/index.js +35 -31
  59. package/build-module/link/index.js.map +1 -1
  60. package/build-module/link/index.native.js +22 -18
  61. package/build-module/link/index.native.js.map +1 -1
  62. package/build-module/link/inline.js +24 -23
  63. package/build-module/link/inline.js.map +1 -1
  64. package/build-module/link/modal-screens/link-picker-screen.native.js +2 -2
  65. package/build-module/link/modal-screens/link-picker-screen.native.js.map +1 -1
  66. package/build-module/link/modal-screens/link-settings-screen.native.js +30 -24
  67. package/build-module/link/modal-screens/link-settings-screen.native.js.map +1 -1
  68. package/build-module/link/modal.native.js +21 -16
  69. package/build-module/link/modal.native.js.map +1 -1
  70. package/build-module/non-breaking-space/index.js +2 -2
  71. package/build-module/non-breaking-space/index.js.map +1 -1
  72. package/build-module/strikethrough/index.js +16 -12
  73. package/build-module/strikethrough/index.js.map +1 -1
  74. package/build-module/subscript/index.js +2 -2
  75. package/build-module/subscript/index.js.map +1 -1
  76. package/build-module/superscript/index.js +2 -2
  77. package/build-module/superscript/index.js.map +1 -1
  78. package/build-module/text-color/index.js +26 -22
  79. package/build-module/text-color/index.js.map +1 -1
  80. package/build-module/text-color/index.native.js +39 -31
  81. package/build-module/text-color/index.native.js.map +1 -1
  82. package/build-module/text-color/inline.js +23 -17
  83. package/build-module/text-color/inline.js.map +1 -1
  84. package/build-module/text-color/inline.native.js +21 -17
  85. package/build-module/text-color/inline.native.js.map +1 -1
  86. package/build-module/underline/index.js +13 -9
  87. package/build-module/underline/index.js.map +1 -1
  88. package/build-module/unknown/index.js +2 -2
  89. package/build-module/unknown/index.js.map +1 -1
  90. package/package.json +16 -15
  91. package/src/image/index.js +34 -47
  92. package/src/link/modal-screens/link-settings-screen.native.js +2 -2
  93. package/src/text-color/index.native.js +4 -4
  94. package/src/text-color/inline.native.js +3 -5
@@ -1,4 +1,3 @@
1
- import { createElement } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -14,6 +13,8 @@ import { __ } from '@wordpress/i18n';
14
13
  */
15
14
  import { textColor as settings, transparentValue } from './index';
16
15
  import { unlock } from '../lock-unlock';
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { jsxs as _jsxs } from "react/jsx-runtime";
17
18
  const {
18
19
  Tabs
19
20
  } = unlock(componentsPrivateApis);
@@ -117,7 +118,7 @@ function ColorPicker({
117
118
  }));
118
119
  }, [colors, onChange, property]);
119
120
  const activeColors = useMemo(() => getActiveColors(value, name, colors), [name, value, colors]);
120
- return createElement(ColorPalette, {
121
+ return /*#__PURE__*/_jsx(ColorPalette, {
121
122
  value: activeColors[property],
122
123
  onChange: onColorChange
123
124
  });
@@ -137,22 +138,27 @@ export default function InlineColorUI({
137
138
  isActive
138
139
  }
139
140
  });
140
- return createElement(Popover, {
141
+ return /*#__PURE__*/_jsx(Popover, {
141
142
  onClose: onClose,
142
143
  className: "format-library__inline-color-popover",
143
- anchor: popoverAnchor
144
- }, createElement(Tabs, null, createElement(Tabs.TabList, null, TABS.map(tab => createElement(Tabs.Tab, {
145
- tabId: tab.name,
146
- key: tab.name
147
- }, tab.title))), TABS.map(tab => createElement(Tabs.TabPanel, {
148
- tabId: tab.name,
149
- focusable: false,
150
- key: tab.name
151
- }, createElement(ColorPicker, {
152
- name: name,
153
- property: tab.name,
154
- value: value,
155
- onChange: onChange
156
- })))));
144
+ anchor: popoverAnchor,
145
+ children: /*#__PURE__*/_jsxs(Tabs, {
146
+ children: [/*#__PURE__*/_jsx(Tabs.TabList, {
147
+ children: TABS.map(tab => /*#__PURE__*/_jsx(Tabs.Tab, {
148
+ tabId: tab.name,
149
+ children: tab.title
150
+ }, tab.name))
151
+ }), TABS.map(tab => /*#__PURE__*/_jsx(Tabs.TabPanel, {
152
+ tabId: tab.name,
153
+ focusable: false,
154
+ children: /*#__PURE__*/_jsx(ColorPicker, {
155
+ name: name,
156
+ property: tab.name,
157
+ value: value,
158
+ onChange: onChange
159
+ })
160
+ }, tab.name))]
161
+ })
162
+ });
157
163
  }
158
164
  //# sourceMappingURL=inline.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useMemo","useSelect","applyFormat","removeFormat","getActiveFormat","useAnchor","ColorPalette","getColorClassName","getColorObjectByColorValue","getColorObjectByAttributeValues","store","blockEditorStore","Popover","privateApis","componentsPrivateApis","__","textColor","settings","transparentValue","unlock","Tabs","TABS","name","title","parseCSS","css","split","reduce","accumulator","rule","property","value","color","backgroundColor","parseClassName","className","colorSettings","startsWith","endsWith","colorSlug","replace","colorObject","getActiveColors","activeColorFormat","attributes","style","class","setColors","colors","styles","classNames","push","join","slug","length","type","ColorPicker","onChange","select","_getSettings$colors","getSettings","onColorChange","activeColors","createElement","InlineColorUI","onClose","contentRef","isActive","popoverAnchor","editableContentElement","current","anchor","TabList","map","tab","Tab","tabId","key","TabPanel","focusable"],"sources":["@wordpress/format-library/src/text-color/inline.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tapplyFormat,\n\tremoveFormat,\n\tgetActiveFormat,\n\tuseAnchor,\n} from '@wordpress/rich-text';\nimport {\n\tColorPalette,\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { textColor as settings, transparentValue } from './index';\nimport { unlock } from '../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst TABS = [\n\t{ name: 'color', title: __( 'Text' ) },\n\t{ name: 'backgroundColor', title: __( 'Background' ) },\n];\n\nfunction parseCSS( css = '' ) {\n\treturn css.split( ';' ).reduce( ( accumulator, rule ) => {\n\t\tif ( rule ) {\n\t\t\tconst [ property, value ] = rule.split( ':' );\n\t\t\tif ( property === 'color' ) {\n\t\t\t\taccumulator.color = value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tproperty === 'background-color' &&\n\t\t\t\tvalue !== transparentValue\n\t\t\t) {\n\t\t\t\taccumulator.backgroundColor = value;\n\t\t\t}\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function parseClassName( className = '', colorSettings ) {\n\treturn className.split( ' ' ).reduce( ( accumulator, name ) => {\n\t\t// `colorSlug` could contain dashes, so simply match the start and end.\n\t\tif ( name.startsWith( 'has-' ) && name.endsWith( '-color' ) ) {\n\t\t\tconst colorSlug = name\n\t\t\t\t.replace( /^has-/, '' )\n\t\t\t\t.replace( /-color$/, '' );\n\t\t\tconst colorObject = getColorObjectByAttributeValues(\n\t\t\t\tcolorSettings,\n\t\t\t\tcolorSlug\n\t\t\t);\n\t\t\taccumulator.color = colorObject.color;\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function getActiveColors( value, name, colorSettings ) {\n\tconst activeColorFormat = getActiveFormat( value, name );\n\n\tif ( ! activeColorFormat ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\t...parseCSS( activeColorFormat.attributes.style ),\n\t\t...parseClassName( activeColorFormat.attributes.class, colorSettings ),\n\t};\n}\n\nfunction setColors( value, name, colorSettings, colors ) {\n\tconst { color, backgroundColor } = {\n\t\t...getActiveColors( value, name, colorSettings ),\n\t\t...colors,\n\t};\n\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn removeFormat( value, name );\n\t}\n\n\tconst styles = [];\n\tconst classNames = [];\n\tconst attributes = {};\n\n\tif ( backgroundColor ) {\n\t\tstyles.push( [ 'background-color', backgroundColor ].join( ':' ) );\n\t} else {\n\t\t// Override default browser color for mark element.\n\t\tstyles.push( [ 'background-color', transparentValue ].join( ':' ) );\n\t}\n\n\tif ( color ) {\n\t\tconst colorObject = getColorObjectByColorValue( colorSettings, color );\n\n\t\tif ( colorObject ) {\n\t\t\tclassNames.push( getColorClassName( 'color', colorObject.slug ) );\n\t\t} else {\n\t\t\tstyles.push( [ 'color', color ].join( ':' ) );\n\t\t}\n\t}\n\n\tif ( styles.length ) {\n\t\tattributes.style = styles.join( ';' );\n\t}\n\tif ( classNames.length ) {\n\t\tattributes.class = classNames.join( ' ' );\n\t}\n\n\treturn applyFormat( value, { type: name, attributes } );\n}\n\nfunction ColorPicker( { name, property, value, onChange } ) {\n\tconst colors = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().colors ?? [];\n\t}, [] );\n\tconst onColorChange = useCallback(\n\t\t( color ) => {\n\t\t\tonChange(\n\t\t\t\tsetColors( value, name, colors, { [ property ]: color } )\n\t\t\t);\n\t\t},\n\t\t[ colors, onChange, property ]\n\t);\n\tconst activeColors = useMemo(\n\t\t() => getActiveColors( value, name, colors ),\n\t\t[ name, value, colors ]\n\t);\n\n\treturn (\n\t\t<ColorPalette\n\t\t\tvalue={ activeColors[ property ] }\n\t\t\tonChange={ onColorChange }\n\t\t/>\n\t);\n}\n\nexport default function InlineColorUI( {\n\tname,\n\tvalue,\n\tonChange,\n\tonClose,\n\tcontentRef,\n\tisActive,\n} ) {\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement: contentRef.current,\n\t\tsettings: { ...settings, isActive },\n\t} );\n\n\treturn (\n\t\t<Popover\n\t\t\tonClose={ onClose }\n\t\t\tclassName=\"format-library__inline-color-popover\"\n\t\t\tanchor={ popoverAnchor }\n\t\t>\n\t\t\t<Tabs>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t{ TABS.map( ( tab ) => (\n\t\t\t\t\t\t<Tabs.Tab tabId={ tab.name } key={ tab.name }>\n\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t) ) }\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t{ TABS.map( ( tab ) => (\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\tproperty={ tab.name }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t) ) }\n\t\t\t</Tabs>\n\t\t</Popover>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,WAAW,EACXC,YAAY,EACZC,eAAe,EACfC,SAAS,QACH,sBAAsB;AAC7B,SACCC,YAAY,EACZC,iBAAiB,EACjBC,0BAA0B,EAC1BC,+BAA+B,EAC/BC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SACCC,OAAO,EACPC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,SAAS,IAAIC,QAAQ,EAAEC,gBAAgB,QAAQ,SAAS;AACjE,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,MAAM;EAAEC;AAAK,CAAC,GAAGD,MAAM,CAAEL,qBAAsB,CAAC;AAEhD,M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,EAAGA;EAAU,CACrB,CACa,CACd,CACG,CACE,CAAC;AAEZ","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useMemo","useSelect","applyFormat","removeFormat","getActiveFormat","useAnchor","ColorPalette","getColorClassName","getColorObjectByColorValue","getColorObjectByAttributeValues","store","blockEditorStore","Popover","privateApis","componentsPrivateApis","__","textColor","settings","transparentValue","unlock","jsx","_jsx","jsxs","_jsxs","Tabs","TABS","name","title","parseCSS","css","split","reduce","accumulator","rule","property","value","color","backgroundColor","parseClassName","className","colorSettings","startsWith","endsWith","colorSlug","replace","colorObject","getActiveColors","activeColorFormat","attributes","style","class","setColors","colors","styles","classNames","push","join","slug","length","type","ColorPicker","onChange","select","_getSettings$colors","getSettings","onColorChange","activeColors","InlineColorUI","onClose","contentRef","isActive","popoverAnchor","editableContentElement","current","anchor","children","TabList","map","tab","Tab","tabId","TabPanel","focusable"],"sources":["@wordpress/format-library/src/text-color/inline.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tapplyFormat,\n\tremoveFormat,\n\tgetActiveFormat,\n\tuseAnchor,\n} from '@wordpress/rich-text';\nimport {\n\tColorPalette,\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { textColor as settings, transparentValue } from './index';\nimport { unlock } from '../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst TABS = [\n\t{ name: 'color', title: __( 'Text' ) },\n\t{ name: 'backgroundColor', title: __( 'Background' ) },\n];\n\nfunction parseCSS( css = '' ) {\n\treturn css.split( ';' ).reduce( ( accumulator, rule ) => {\n\t\tif ( rule ) {\n\t\t\tconst [ property, value ] = rule.split( ':' );\n\t\t\tif ( property === 'color' ) {\n\t\t\t\taccumulator.color = value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tproperty === 'background-color' &&\n\t\t\t\tvalue !== transparentValue\n\t\t\t) {\n\t\t\t\taccumulator.backgroundColor = value;\n\t\t\t}\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function parseClassName( className = '', colorSettings ) {\n\treturn className.split( ' ' ).reduce( ( accumulator, name ) => {\n\t\t// `colorSlug` could contain dashes, so simply match the start and end.\n\t\tif ( name.startsWith( 'has-' ) && name.endsWith( '-color' ) ) {\n\t\t\tconst colorSlug = name\n\t\t\t\t.replace( /^has-/, '' )\n\t\t\t\t.replace( /-color$/, '' );\n\t\t\tconst colorObject = getColorObjectByAttributeValues(\n\t\t\t\tcolorSettings,\n\t\t\t\tcolorSlug\n\t\t\t);\n\t\t\taccumulator.color = colorObject.color;\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function getActiveColors( value, name, colorSettings ) {\n\tconst activeColorFormat = getActiveFormat( value, name );\n\n\tif ( ! activeColorFormat ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\t...parseCSS( activeColorFormat.attributes.style ),\n\t\t...parseClassName( activeColorFormat.attributes.class, colorSettings ),\n\t};\n}\n\nfunction setColors( value, name, colorSettings, colors ) {\n\tconst { color, backgroundColor } = {\n\t\t...getActiveColors( value, name, colorSettings ),\n\t\t...colors,\n\t};\n\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn removeFormat( value, name );\n\t}\n\n\tconst styles = [];\n\tconst classNames = [];\n\tconst attributes = {};\n\n\tif ( backgroundColor ) {\n\t\tstyles.push( [ 'background-color', backgroundColor ].join( ':' ) );\n\t} else {\n\t\t// Override default browser color for mark element.\n\t\tstyles.push( [ 'background-color', transparentValue ].join( ':' ) );\n\t}\n\n\tif ( color ) {\n\t\tconst colorObject = getColorObjectByColorValue( colorSettings, color );\n\n\t\tif ( colorObject ) {\n\t\t\tclassNames.push( getColorClassName( 'color', colorObject.slug ) );\n\t\t} else {\n\t\t\tstyles.push( [ 'color', color ].join( ':' ) );\n\t\t}\n\t}\n\n\tif ( styles.length ) {\n\t\tattributes.style = styles.join( ';' );\n\t}\n\tif ( classNames.length ) {\n\t\tattributes.class = classNames.join( ' ' );\n\t}\n\n\treturn applyFormat( value, { type: name, attributes } );\n}\n\nfunction ColorPicker( { name, property, value, onChange } ) {\n\tconst colors = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().colors ?? [];\n\t}, [] );\n\tconst onColorChange = useCallback(\n\t\t( color ) => {\n\t\t\tonChange(\n\t\t\t\tsetColors( value, name, colors, { [ property ]: color } )\n\t\t\t);\n\t\t},\n\t\t[ colors, onChange, property ]\n\t);\n\tconst activeColors = useMemo(\n\t\t() => getActiveColors( value, name, colors ),\n\t\t[ name, value, colors ]\n\t);\n\n\treturn (\n\t\t<ColorPalette\n\t\t\tvalue={ activeColors[ property ] }\n\t\t\tonChange={ onColorChange }\n\t\t/>\n\t);\n}\n\nexport default function InlineColorUI( {\n\tname,\n\tvalue,\n\tonChange,\n\tonClose,\n\tcontentRef,\n\tisActive,\n} ) {\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement: contentRef.current,\n\t\tsettings: { ...settings, isActive },\n\t} );\n\n\treturn (\n\t\t<Popover\n\t\t\tonClose={ onClose }\n\t\t\tclassName=\"format-library__inline-color-popover\"\n\t\t\tanchor={ popoverAnchor }\n\t\t>\n\t\t\t<Tabs>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t{ TABS.map( ( tab ) => (\n\t\t\t\t\t\t<Tabs.Tab tabId={ tab.name } key={ tab.name }>\n\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t) ) }\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t{ TABS.map( ( tab ) => (\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\tproperty={ tab.name }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t) ) }\n\t\t\t</Tabs>\n\t\t</Popover>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,WAAW,EACXC,YAAY,EACZC,eAAe,EACfC,SAAS,QACH,sBAAsB;AAC7B,SACCC,YAAY,EACZC,iBAAiB,EACjBC,0BAA0B,EAC1BC,+BAA+B,EAC/BC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SACCC,OAAO,EACPC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,SAAS,IAAIC,QAAQ,EAAEC,gBAAgB,QAAQ,SAAS;AACjE,SAASC,MAAM,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAExC,MAAM;EAAEC;AAAK,CAAC,GAAGL,MAAM,CAAEL,qBAAsB,CAAC;AAEhD,MAAMW,IAAI,GAAG,CACZ;EAAEC,IAAI,EAAE,OAAO;EAAEC,KAAK,EAAEZ,EAAE,CAAE,MAAO;AAAE,CAAC,EACtC;EAAEW,IAAI,EAAE,iBAAiB;EAAEC,KAAK,EAAEZ,EAAE,CAAE,YAAa;AAAE,CAAC,CACtD;AAED,SAASa,QAAQA,CAAEC,GAAG,GAAG,EAAE,EAAG;EAC7B,OAAOA,GAAG,CAACC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SAASE,aAAaA,CAAE;EACtCzC,IAAI;EACJS,KAAK;EACL0B,QAAQ;EACRO,OAAO;EACPC,UAAU;EACVC;AACD,CAAC,EAAG;EACH,MAAMC,aAAa,GAAGlE,SAAS,CAAE;IAChCmE,sBAAsB,EAAEH,UAAU,CAACI,OAAO;IAC1CxD,QAAQ,EAAE;MAAE,GAAGA,QAAQ;MAAEqD;IAAS;EACnC,CAAE,CAAC;EAEH,oBACCjD,IAAA,CAACT,OAAO;IACPwD,OAAO,EAAGA,OAAS;IACnB7B,SAAS,EAAC,sCAAsC;IAChDmC,MAAM,EAAGH,aAAe;IAAAI,QAAA,eAExBpD,KAAA,CAACC,IAAI;MAAAmD,QAAA,gBACJtD,IAAA,CAACG,IAAI,CAACoD,OAAO;QAAAD,QAAA,EACVlD,IAAI,CAACoD,GAAG,CAAIC,GAAG,iBAChBzD,IAAA,CAACG,IAAI,CAACuD,GAAG;UAACC,KAAK,EAAGF,GAAG,CAACpD,IAAM;UAAAiD,QAAA,EACzBG,GAAG,CAACnD;QAAK,GADuBmD,GAAG,CAACpD,IAE7B,CACT;MAAC,CACU,CAAC,EACbD,IAAI,CAACoD,GAAG,CAAIC,GAAG,iBAChBzD,IAAA,CAACG,IAAI,CAACyD,QAAQ;QACbD,KAAK,EAAGF,GAAG,CAACpD,IAAM;QAClBwD,SAAS,EAAG,KAAO;QAAAP,QAAA,eAGnBtD,IAAA,CAACuC,WAAW;UACXlC,IAAI,EAAGA,IAAM;UACbQ,QAAQ,EAAG4C,GAAG,CAACpD,IAAM;UACrBS,KAAK,EAAGA,KAAO;UACf0B,QAAQ,EAAGA;QAAU,CACrB;MAAC,GAPIiB,GAAG,CAACpD,IAQI,CACd,CAAC;IAAA,CACE;EAAC,CACC,CAAC;AAEZ","ignoreList":[]}
@@ -1,17 +1,17 @@
1
- import { createElement } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
5
4
  import { useCallback, useMemo } from '@wordpress/element';
6
5
  import { applyFormat, removeFormat, getActiveFormat } from '@wordpress/rich-text';
7
- import { getColorClassName, getColorObjectByColorValue, useMultipleOriginColorsAndGradients } from '@wordpress/block-editor';
8
- import { BottomSheet, ColorSettings, useMobileGlobalStylesColors } from '@wordpress/components';
6
+ import { getColorClassName, getColorObjectByColorValue, useMultipleOriginColorsAndGradients, useMobileGlobalStylesColors } from '@wordpress/block-editor';
7
+ import { BottomSheet, ColorSettings } from '@wordpress/components';
9
8
 
10
9
  /**
11
10
  * Internal dependencies
12
11
  */
13
12
  import { transparentValue } from './index.js';
14
13
  import { parseClassName } from './inline.js';
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
15
  function parseCSS(css = '') {
16
16
  return css.split(';').reduce((accumulator, rule) => {
17
17
  if (rule) {
@@ -91,13 +91,14 @@ function ColorPicker({
91
91
  const property = 'color';
92
92
  const colors = useMobileGlobalStylesColors();
93
93
  const colorSettings = useMultipleOriginColorsAndGradients();
94
+ colorSettings.allAvailableColors = colors;
94
95
  const onColorChange = useCallback(color => {
95
96
  onChange(setColors(value, name, colors, {
96
97
  [property]: color
97
98
  }, contentRef));
98
99
  }, [colors, contentRef, name, onChange, value]);
99
100
  const activeColors = useMemo(() => getActiveColors(value, name, colors), [name, value, colors]);
100
- return createElement(ColorSettings, {
101
+ return /*#__PURE__*/_jsx(ColorSettings, {
101
102
  colorValue: activeColors[property],
102
103
  onColorChange: onColorChange,
103
104
  onColorCleared: onColorChange,
@@ -112,7 +113,7 @@ export default function InlineColorUI({
112
113
  onClose,
113
114
  contentRef
114
115
  }) {
115
- return createElement(BottomSheet, {
116
+ return /*#__PURE__*/_jsx(BottomSheet, {
116
117
  isVisible: true,
117
118
  onClose: onClose,
118
119
  hideHeader: true,
@@ -122,17 +123,20 @@ export default function InlineColorUI({
122
123
  },
123
124
  hasNavigation: true,
124
125
  leftButton: null,
125
- testID: "inline-text-color-modal"
126
- }, createElement(BottomSheet.NavigationContainer, {
127
- animate: true,
128
- main: true
129
- }, createElement(BottomSheet.NavigationScreen, {
130
- name: "text-color"
131
- }, createElement(ColorPicker, {
132
- name: name,
133
- value: value,
134
- onChange: onChange,
135
- contentRef: contentRef
136
- }))));
126
+ testID: "inline-text-color-modal",
127
+ children: /*#__PURE__*/_jsx(BottomSheet.NavigationContainer, {
128
+ animate: true,
129
+ main: true,
130
+ children: /*#__PURE__*/_jsx(BottomSheet.NavigationScreen, {
131
+ name: "text-color",
132
+ children: /*#__PURE__*/_jsx(ColorPicker, {
133
+ name: name,
134
+ value: value,
135
+ onChange: onChange,
136
+ contentRef: contentRef
137
+ })
138
+ })
139
+ })
140
+ });
137
141
  }
138
142
  //# sourceMappingURL=inline.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useMemo","applyFormat","removeFormat","getActiveFormat","getColorClassName","getColorObjectByColorValue","useMultipleOriginColorsAndGradients","BottomSheet","ColorSettings","useMobileGlobalStylesColors","transparentValue","parseClassName","parseCSS","css","split","reduce","accumulator","rule","property","value","replace","color","backgroundColor","getActiveColors","name","colorSettings","activeColorFormat","attributes","style","class","setColors","colors","contentRef","onRemoveMarkFormatting","styles","classNames","push","join","colorObject","slug","length","format","type","hasNoSelection","start","end","onMarkFormatting","ColorPicker","onChange","onColorChange","activeColors","createElement","colorValue","onColorCleared","defaultSettings","hideNavigation","InlineColorUI","onClose","isVisible","hideHeader","contentStyle","paddingLeft","paddingRight","hasNavigation","leftButton","testID","NavigationContainer","animate","main","NavigationScreen"],"sources":["@wordpress/format-library/src/text-color/inline.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport {\n\tapplyFormat,\n\tremoveFormat,\n\tgetActiveFormat,\n} from '@wordpress/rich-text';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tuseMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport {\n\tBottomSheet,\n\tColorSettings,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { transparentValue } from './index.js';\nimport { parseClassName } from './inline.js';\n\nfunction parseCSS( css = '' ) {\n\treturn css.split( ';' ).reduce( ( accumulator, rule ) => {\n\t\tif ( rule ) {\n\t\t\tconst [ property, value ] = rule.replace( / /g, '' ).split( ':' );\n\t\t\tif ( property === 'color' ) {\n\t\t\t\taccumulator.color = value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tproperty === 'background-color' &&\n\t\t\t\tvalue !== transparentValue\n\t\t\t) {\n\t\t\t\taccumulator.backgroundColor = value;\n\t\t\t}\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function getActiveColors( value, name, colorSettings ) {\n\tconst activeColorFormat = getActiveFormat( value, name );\n\n\tif ( ! activeColorFormat ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\t...parseCSS( activeColorFormat.attributes.style ),\n\t\t...parseClassName( activeColorFormat.attributes.class, colorSettings ),\n\t};\n}\n\nfunction setColors( value, name, colorSettings, colors, contentRef ) {\n\tconst { color, backgroundColor } = {\n\t\t...getActiveColors( value, name, colorSettings ),\n\t\t...colors,\n\t};\n\n\tif ( ! color ) {\n\t\tcontentRef?.onRemoveMarkFormatting();\n\t\treturn removeFormat( value, name );\n\t}\n\n\tconst styles = [];\n\tconst classNames = [];\n\tconst attributes = {};\n\n\tif ( backgroundColor ) {\n\t\tstyles.push( [ 'background-color', backgroundColor ].join( ':' ) );\n\t} else {\n\t\t// Override default browser color for mark element.\n\t\tstyles.push( [ 'background-color', transparentValue ].join( ':' ) );\n\t}\n\n\tif ( color ) {\n\t\tconst colorObject = getColorObjectByColorValue( colorSettings, color );\n\n\t\tif ( colorObject ) {\n\t\t\tclassNames.push( getColorClassName( 'color', colorObject.slug ) );\n\t\t\tstyles.push( [ 'color', colorObject.color ].join( ':' ) );\n\t\t} else {\n\t\t\tstyles.push( [ 'color', color ].join( ':' ) );\n\t\t}\n\t}\n\n\tif ( styles.length ) {\n\t\tattributes.style = styles.join( ';' );\n\t}\n\tif ( classNames.length ) {\n\t\tattributes.class = classNames.join( ' ' );\n\t}\n\n\tconst format = { type: name, attributes };\n\tconst hasNoSelection = value.start === value.end;\n\n\tif ( hasNoSelection ) {\n\t\tcontentRef?.onMarkFormatting( color );\n\t}\n\treturn applyFormat( value, format );\n}\n\nfunction ColorPicker( { name, value, onChange, contentRef } ) {\n\tconst property = 'color';\n\tconst colors = useMobileGlobalStylesColors();\n\tconst colorSettings = useMultipleOriginColorsAndGradients();\n\n\tconst onColorChange = useCallback(\n\t\t( color ) => {\n\t\t\tonChange(\n\t\t\t\tsetColors(\n\t\t\t\t\tvalue,\n\t\t\t\t\tname,\n\t\t\t\t\tcolors,\n\t\t\t\t\t{ [ property ]: color },\n\t\t\t\t\tcontentRef\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\t\t[ colors, contentRef, name, onChange, value ]\n\t);\n\tconst activeColors = useMemo(\n\t\t() => getActiveColors( value, name, colors ),\n\t\t[ name, value, colors ]\n\t);\n\n\treturn (\n\t\t<ColorSettings\n\t\t\tcolorValue={ activeColors[ property ] }\n\t\t\tonColorChange={ onColorChange }\n\t\t\tonColorCleared={ onColorChange }\n\t\t\tdefaultSettings={ colorSettings }\n\t\t\thideNavigation\n\t\t/>\n\t);\n}\n\nexport default function InlineColorUI( {\n\tname,\n\tvalue,\n\tonChange,\n\tonClose,\n\tcontentRef,\n} ) {\n\treturn (\n\t\t<BottomSheet\n\t\t\tisVisible\n\t\t\tonClose={ onClose }\n\t\t\thideHeader\n\t\t\tcontentStyle={ { paddingLeft: 0, paddingRight: 0 } }\n\t\t\thasNavigation\n\t\t\tleftButton={ null }\n\t\t\ttestID=\"inline-text-color-modal\"\n\t\t>\n\t\t\t<BottomSheet.NavigationContainer animate main>\n\t\t\t\t<BottomSheet.NavigationScreen name=\"text-color\">\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tc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I,EAAEO,MAAO,CAAC,EAC5C,CAAEP,IAAI,EAAEL,KAAK,EAAEY,MAAM,CACtB,CAAC;EAED,OACCoB,aAAA,CAAC3C,aAAa;IACb4C,UAAU,EAAGF,YAAY,CAAEhC,QAAQ,CAAI;IACvC+B,aAAa,EAAGA,aAAe;IAC/BI,cAAc,EAAGJ,aAAe;IAChCK,eAAe,EAAG7B,aAAe;IACjC8B,cAAc;EAAA,CACd,CAAC;AAEJ;AAEA,eAAe,SAASC,aAAaA,CAAE;EACtChC,IAAI;EACJL,KAAK;EACL6B,QAAQ;EACRS,OAAO;EACPzB;AACD,CAAC,EAAG;EACH,OACCmB,aAAA,CAAC5C,WAAW;IACXmD,SAAS;IACTD,OAAO,EAAGA,OAAS;IACnBE,UAAU;IACVC,YAAY,EAAG;MAAEC,WAAW,EAAE,CAAC;MAAEC,YAAY,EAAE;IAAE,CAAG;IACpDC,aAAa;IACbC,UAAU,EAAG,IAAM;IACnBC,MAAM,EAAC;EAAyB,GAEhCd,aAAA,CAAC5C,WAAW,CAAC2D,mBAAmB;IAACC,OAAO;IAACC,IAAI;EAAA,GAC5CjB,aAAA,CAAC5C,WAAW,CAAC8D,gBAAgB;IAAC7C,IAAI,EAAC;EAAY,GAC9C2B,aAAA,CAACJ,WAAW;IACXvB,IAAI,EAAGA,IAAM;IACbL,KAAK,EAAGA,KAAO;IACf6B,QAAQ,EAAGA,QAAU;IACrBhB,UAAU,EAAGA;EAAY,CACzB,CAC4B,CACE,CACrB,CAAC;AAEhB","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useMemo","applyFormat","removeFormat","getActiveFormat","getColorClassName","getColorObjectByColorValue","useMultipleOriginColorsAndGradients","useMobileGlobalStylesColors","BottomSheet","ColorSettings","transparentValue","parseClassName","jsx","_jsx","parseCSS","css","split","reduce","accumulator","rule","property","value","replace","color","backgroundColor","getActiveColors","name","colorSettings","activeColorFormat","attributes","style","class","setColors","colors","contentRef","onRemoveMarkFormatting","styles","classNames","push","join","colorObject","slug","length","format","type","hasNoSelection","start","end","onMarkFormatting","ColorPicker","onChange","allAvailableColors","onColorChange","activeColors","colorValue","onColorCleared","defaultSettings","hideNavigation","InlineColorUI","onClose","isVisible","hideHeader","contentStyle","paddingLeft","paddingRight","hasNavigation","leftButton","testID","children","NavigationContainer","animate","main","NavigationScreen"],"sources":["@wordpress/format-library/src/text-color/inline.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport {\n\tapplyFormat,\n\tremoveFormat,\n\tgetActiveFormat,\n} from '@wordpress/rich-text';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tuseMultipleOriginColorsAndGradients,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/block-editor';\nimport { BottomSheet, ColorSettings } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { transparentValue } from './index.js';\nimport { parseClassName } from './inline.js';\n\nfunction parseCSS( css = '' ) {\n\treturn css.split( ';' ).reduce( ( accumulator, rule ) => {\n\t\tif ( rule ) {\n\t\t\tconst [ property, value ] = rule.replace( / /g, '' ).split( ':' );\n\t\t\tif ( property === 'color' ) {\n\t\t\t\taccumulator.color = value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tproperty === 'background-color' &&\n\t\t\t\tvalue !== transparentValue\n\t\t\t) {\n\t\t\t\taccumulator.backgroundColor = value;\n\t\t\t}\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function getActiveColors( value, name, colorSettings ) {\n\tconst activeColorFormat = getActiveFormat( value, name );\n\n\tif ( ! activeColorFormat ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\t...parseCSS( activeColorFormat.attributes.style ),\n\t\t...parseClassName( activeColorFormat.attributes.class, colorSettings ),\n\t};\n}\n\nfunction setColors( value, name, colorSettings, colors, contentRef ) {\n\tconst { color, backgroundColor } = {\n\t\t...getActiveColors( value, name, colorSettings ),\n\t\t...colors,\n\t};\n\n\tif ( ! color ) {\n\t\tcontentRef?.onRemoveMarkFormatting();\n\t\treturn removeFormat( value, name );\n\t}\n\n\tconst styles = [];\n\tconst classNames = [];\n\tconst attributes = {};\n\n\tif ( backgroundColor ) {\n\t\tstyles.push( [ 'background-color', backgroundColor ].join( ':' ) );\n\t} else {\n\t\t// Override default browser color for mark element.\n\t\tstyles.push( [ 'background-color', transparentValue ].join( ':' ) );\n\t}\n\n\tif ( color ) {\n\t\tconst colorObject = getColorObjectByColorValue( colorSettings, color );\n\n\t\tif ( colorObject ) {\n\t\t\tclassNames.push( getColorClassName( 'color', colorObject.slug ) );\n\t\t\tstyles.push( [ 'color', colorObject.color ].join( ':' ) );\n\t\t} else {\n\t\t\tstyles.push( [ 'color', color ].join( ':' ) );\n\t\t}\n\t}\n\n\tif ( styles.length ) {\n\t\tattributes.style = styles.join( ';' );\n\t}\n\tif ( classNames.length ) {\n\t\tattributes.class = classNames.join( ' ' );\n\t}\n\n\tconst format = { type: name, attributes };\n\tconst hasNoSelection = value.start === value.end;\n\n\tif ( hasNoSelection ) {\n\t\tcontentRef?.onMarkFormatting( color );\n\t}\n\treturn applyFormat( value, format );\n}\n\nfunction ColorPicker( { name, value, onChange, contentRef } ) {\n\tconst property = 'color';\n\tconst colors = useMobileGlobalStylesColors();\n\tconst colorSettings = useMultipleOriginColorsAndGradients();\n\tcolorSettings.allAvailableColors = colors;\n\n\tconst onColorChange = useCallback(\n\t\t( color ) => {\n\t\t\tonChange(\n\t\t\t\tsetColors(\n\t\t\t\t\tvalue,\n\t\t\t\t\tname,\n\t\t\t\t\tcolors,\n\t\t\t\t\t{ [ property ]: color },\n\t\t\t\t\tcontentRef\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\t\t[ colors, contentRef, name, onChange, value ]\n\t);\n\tconst activeColors = useMemo(\n\t\t() => getActiveColors( value, name, colors ),\n\t\t[ name, value, colors ]\n\t);\n\n\treturn (\n\t\t<ColorSettings\n\t\t\tcolorValue={ activeColors[ property ] }\n\t\t\tonColorChange={ onColorChange }\n\t\t\tonColorCleared={ onColorChange }\n\t\t\tdefaultSettings={ colorSettings }\n\t\t\thideNavigation\n\t\t/>\n\t);\n}\n\nexport default function InlineColorUI( {\n\tname,\n\tvalue,\n\tonChange,\n\tonClose,\n\tcontentRef,\n} ) {\n\treturn (\n\t\t<BottomSheet\n\t\t\tisVisible\n\t\t\tonClose={ onClose }\n\t\t\thideHeader\n\t\t\tcontentStyle={ { paddingLeft: 0, paddingRight: 0 } }\n\t\t\thasNavigation\n\t\t\tleftButton={ null }\n\t\t\ttestID=\"inline-text-color-modal\"\n\t\t>\n\t\t\t<BottomSheet.NavigationContainer animate main>\n\t\t\t\t<BottomSheet.NavigationScreen name=\"text-color\">\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t/>\n\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t</BottomSheet.NavigationContainer>\n\t\t</BottomSheet>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SACCC,WAAW,EACXC,YAAY,EACZC,eAAe,QACT,sBAAsB;AAC7B,SACCC,iBAAiB,EACjBC,0BAA0B,EAC1BC,mCAAmC,EACnCC,2BAA2B,QACrB,yBAAyB;AAChC,SAASC,WAAW,EAAEC,aAAa,QAAQ,uBAAuB;;AAElE;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,cAAc,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE7C,SAASC,QAAQA,CAAEC,GAAG,GAAG,EAAE,EAAG;EAC7B,OAAOA,GAAG,CAACC,KAAK,CAAE,GAAI,CAAC,CAACC,MAAM,CAAE,CAAEC,WAAW,EAAEC,IAAI,KAAM;IACxD,IAAKA,IAAI,EAAG;M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C,MAAM,EAAC,yBAAyB;IAAAC,QAAA,eAEhCvD,IAAA,CAACL,WAAW,CAAC6D,mBAAmB;MAACC,OAAO;MAACC,IAAI;MAAAH,QAAA,eAC5CvD,IAAA,CAACL,WAAW,CAACgE,gBAAgB;QAAC9C,IAAI,EAAC,YAAY;QAAA0C,QAAA,eAC9CvD,IAAA,CAACoC,WAAW;UACXvB,IAAI,EAAGA,IAAM;UACbL,KAAK,EAAGA,KAAO;UACf6B,QAAQ,EAAGA,QAAU;UACrBhB,UAAU,EAAGA;QAAY,CACzB;MAAC,CAC2B;IAAC,CACC;EAAC,CACtB,CAAC;AAEhB","ignoreList":[]}
@@ -1,10 +1,12 @@
1
- import { createElement, Fragment } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
5
4
  import { __ } from '@wordpress/i18n';
6
5
  import { toggleFormat } from '@wordpress/rich-text';
7
6
  import { RichTextShortcut, __unstableRichTextInputEvent } from '@wordpress/block-editor';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { Fragment as _Fragment } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
10
  const name = 'core/underline';
9
11
  const title = __('Underline');
10
12
  export const underline = {
@@ -28,14 +30,16 @@ export const underline = {
28
30
  title
29
31
  }));
30
32
  };
31
- return createElement(Fragment, null, createElement(RichTextShortcut, {
32
- type: "primary",
33
- character: "u",
34
- onUse: onToggle
35
- }), createElement(__unstableRichTextInputEvent, {
36
- inputType: "formatUnderline",
37
- onInput: onToggle
38
- }));
33
+ return /*#__PURE__*/_jsxs(_Fragment, {
34
+ children: [/*#__PURE__*/_jsx(RichTextShortcut, {
35
+ type: "primary",
36
+ character: "u",
37
+ onUse: onToggle
38
+ }), /*#__PURE__*/_jsx(__unstableRichTextInputEvent, {
39
+ inputType: "formatUnderline",
40
+ onInput: onToggle
41
+ })]
42
+ });
39
43
  }
40
44
  };
41
45
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","toggleFormat","RichTextShortcut","__unstableRichTextInputEvent","name","title","underline","tagName","className","attributes","style","edit","value","onChange","onToggle","type","createElement","Fragment","character","onUse","inputType","onInput"],"sources":["@wordpress/format-library/src/underline/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport {\n\tRichTextShortcut,\n\t__unstableRichTextInputEvent,\n} from '@wordpress/block-editor';\n\nconst name = 'core/underline';\nconst title = __( 'Underline' );\n\nexport const underline = {\n\tname,\n\ttitle,\n\ttagName: 'span',\n\tclassName: null,\n\tattributes: {\n\t\tstyle: 'style',\n\t},\n\tedit( { value, onChange } ) {\n\t\tconst onToggle = () => {\n\t\t\tonChange(\n\t\t\t\ttoggleFormat( value, {\n\t\t\t\t\ttype: name,\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tstyle: 'text-decoration: underline;',\n\t\t\t\t\t},\n\t\t\t\t\ttitle,\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<RichTextShortcut\n\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\tcharacter=\"u\"\n\t\t\t\t\tonUse={ onToggle }\n\t\t\t\t/>\n\t\t\t\t<__unstableRichTextInputEvent\n\t\t\t\t\tinputType=\"formatUnderline\"\n\t\t\t\t\tonInput={ onToggle }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SACCC,gBAAgB,EAChBC,4BAA4B,QACtB,yBAAyB;AAEhC,MAAMC,IAAI,GAAG,gBAAgB;AAC7B,MAAMC,KAAK,GAAGL,EAAE,CAAE,WAAY,CAAC;AAE/B,OAAO,MAAMM,SAAS,GAAG;EACxBF,IAAI;EACJC,KAAK;EACLE,OAAO,EAAE,MAAM;EACfC,SAAS,EAAE,IAAI;EACfC,UAAU,EAAE;IACXC,KAAK,EAAE;EACR,CAAC;EACDC,IAAIA,CAAE;IAAEC,KAAK;IAAEC;EAAS,CAAC,EAAG;IAC3B,MAAMC,QAAQ,GAAGA,CAAA,KAAM;MACtBD,QAAQ,CACPZ,YAAY,CAAEW,KAAK,EAAE;QACpBG,IAAI,EAAEX,IAAI;QACVK,UAAU,EAAE;UACXC,KAAK,EAAE;QACR,CAAC;QACDL;MACD,CAAE,CACH,CAAC;IACF,CAAC;IAED,OACCW,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACd,gBAAgB;MAChBa,IAAI,EAAC,SAAS;MACdG,SAAS,EAAC,GAAG;MACbC,KAAK,EAAGL;IAAU,CAClB,CAAC,EACFE,aAAA,CAACb,4BAA4B;MAC5BiB,SAAS,EAAC,iBAAiB;MAC3BC,OAAO,EAAGP;IAAU,CACpB,CACA,CAAC;EAEL;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","toggleFormat","RichTextShortcut","__unstableRichTextInputEvent","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","name","title","underline","tagName","className","attributes","style","edit","value","onChange","onToggle","type","children","character","onUse","inputType","onInput"],"sources":["@wordpress/format-library/src/underline/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport {\n\tRichTextShortcut,\n\t__unstableRichTextInputEvent,\n} from '@wordpress/block-editor';\n\nconst name = 'core/underline';\nconst title = __( 'Underline' );\n\nexport const underline = {\n\tname,\n\ttitle,\n\ttagName: 'span',\n\tclassName: null,\n\tattributes: {\n\t\tstyle: 'style',\n\t},\n\tedit( { value, onChange } ) {\n\t\tconst onToggle = () => {\n\t\t\tonChange(\n\t\t\t\ttoggleFormat( value, {\n\t\t\t\t\ttype: name,\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tstyle: 'text-decoration: underline;',\n\t\t\t\t\t},\n\t\t\t\t\ttitle,\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<RichTextShortcut\n\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\tcharacter=\"u\"\n\t\t\t\t\tonUse={ onToggle }\n\t\t\t\t/>\n\t\t\t\t<__unstableRichTextInputEvent\n\t\t\t\t\tinputType=\"formatUnderline\"\n\t\t\t\t\tonInput={ onToggle }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SACCC,gBAAgB,EAChBC,4BAA4B,QACtB,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEjC,MAAMC,IAAI,GAAG,gBAAgB;AAC7B,MAAMC,KAAK,GAAGX,EAAE,CAAE,WAAY,CAAC;AAE/B,OAAO,MAAMY,SAAS,GAAG;EACxBF,IAAI;EACJC,KAAK;EACLE,OAAO,EAAE,MAAM;EACfC,SAAS,EAAE,IAAI;EACfC,UAAU,EAAE;IACXC,KAAK,EAAE;EACR,CAAC;EACDC,IAAIA,CAAE;IAAEC,KAAK;IAAEC;EAAS,CAAC,EAAG;IAC3B,MAAMC,QAAQ,GAAGA,CAAA,KAAM;MACtBD,QAAQ,CACPlB,YAAY,CAAEiB,KAAK,EAAE;QACpBG,IAAI,EAAEX,IAAI;QACVK,UAAU,EAAE;UACXC,KAAK,EAAE;QACR,CAAC;QACDL;MACD,CAAE,CACH,CAAC;IACF,CAAC;IAED,oBACCF,KAAA,CAAAF,SAAA;MAAAe,QAAA,gBACCjB,IAAA,CAACH,gBAAgB;QAChBmB,IAAI,EAAC,SAAS;QACdE,SAAS,EAAC,GAAG;QACbC,KAAK,EAAGJ;MAAU,CAClB,CAAC,eACFf,IAAA,CAACF,4BAA4B;QAC5BsB,SAAS,EAAC,iBAAiB;QAC3BC,OAAO,EAAGN;MAAU,CACpB,CAAC;IAAA,CACD,CAAC;EAEL;AACD,CAAC","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- import { createElement } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -6,6 +5,7 @@ import { __ } from '@wordpress/i18n';
6
5
  import { removeFormat, slice, isCollapsed } from '@wordpress/rich-text';
7
6
  import { RichTextToolbarButton } from '@wordpress/block-editor';
8
7
  import { help } from '@wordpress/icons';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
9
  const name = 'core/unknown';
10
10
  const title = __('Clear Unknown Formatting');
11
11
  function selectionContainsUnknownFormats(value) {
@@ -35,7 +35,7 @@ export const unknown = {
35
35
  onChange(removeFormat(value, name));
36
36
  onFocus();
37
37
  }
38
- return createElement(RichTextToolbarButton, {
38
+ return /*#__PURE__*/_jsx(RichTextToolbarButton, {
39
39
  name: "unknown",
40
40
  icon: help,
41
41
  title: title,
@@ -1 +1 @@
1
- {"version":3,"names":["__","removeFormat","slice","isCollapsed","RichTextToolbarButton","help","name","title","selectionContainsUnknownFormats","value","selectedValue","formats","some","format","type","unknown","tagName","className","edit","isActive","onChange","onFocus","onClick","createElement","icon"],"sources":["@wordpress/format-library/src/unknown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { removeFormat, slice, isCollapsed } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { help } from '@wordpress/icons';\n\nconst name = 'core/unknown';\nconst title = __( 'Clear Unknown Formatting' );\n\nfunction selectionContainsUnknownFormats( value ) {\n\tif ( isCollapsed( value ) ) {\n\t\treturn false;\n\t}\n\n\tconst selectedValue = slice( value );\n\treturn selectedValue.formats.some( ( formats ) => {\n\t\treturn formats.some( ( format ) => format.type === name );\n\t} );\n}\n\nexport const unknown = {\n\tname,\n\ttitle,\n\ttagName: '*',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tif ( ! isActive && ! selectionContainsUnknownFormats( value ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonChange( removeFormat( value, name ) );\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\tname=\"unknown\"\n\t\t\t\ticon={ help }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive\n\t\t\t/>\n\t\t);\n\t},\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,EAAEC,KAAK,EAAEC,WAAW,QAAQ,sBAAsB;AACvE,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,IAAI,QAAQ,kBAAkB;AAEvC,MAAMC,IAAI,GAAG,cAAc;AAC3B,MAAMC,KAAK,GAAGP,EAAE,CAAE,0BAA2B,CAAC;AAE9C,SAASQ,+BAA+BA,CAAEC,KAAK,EAAG;EACjD,IAAKN,WAAW,CAAEM,KAAM,CAAC,EAAG;IAC3B,OAAO,KAAK;EACb;EAEA,MAAMC,aAAa,GAAGR,KAAK,CAAEO,KAAM,CAAC;EACpC,OAAOC,aAAa,CAACC,OAAO,CAACC,IAAI,CAAID,OAAO,IAAM;IACjD,OAAOA,OAAO,CAACC,IAAI,CAAIC,MAAM,IAAMA,MAAM,CAACC,IAAI,KAAKR,IAAK,CAAC;EAC1D,CAAE,CAAC;AACJ;AAEA,OAAO,MAAMS,OAAO,GAAG;EACtBT,IAAI;EACJC,KAAK;EACLS,OAAO,EAAE,GAAG;EACZC,SAAS,EAAE,IAAI;EACfC,IAAIA,CAAE;IAAEC,QAAQ;IAAEV,KAAK;IAAEW,QAAQ;IAAEC;EAAQ,CAAC,EAAG;IAC9C,IAAK,CAAEF,QAAQ,IAAI,CAAEX,+BAA+B,CAAEC,KAAM,CAAC,EAAG;MAC/D,OAAO,IAAI;IACZ;IAEA,SAASa,OAAOA,CAAA,EAAG;MAClBF,QAAQ,CAAEnB,YAAY,CAAEQ,KAAK,EAAEH,IAAK,CAAE,CAAC;MACvCe,OAAO,CAAC,CAAC;IACV;IAEA,OACCE,aAAA,CAACnB,qBAAqB;MACrBE,IAAI,EAAC,SAAS;MACdkB,IAAI,EAAGnB,IAAM;MACbE,KAAK,EAAGA,KAAO;MACfe,OAAO,EAAGA,OAAS;MACnBH,QAAQ;IAAA,CACR,CAAC;EAEJ;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","removeFormat","slice","isCollapsed","RichTextToolbarButton","help","jsx","_jsx","name","title","selectionContainsUnknownFormats","value","selectedValue","formats","some","format","type","unknown","tagName","className","edit","isActive","onChange","onFocus","onClick","icon"],"sources":["@wordpress/format-library/src/unknown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { removeFormat, slice, isCollapsed } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { help } from '@wordpress/icons';\n\nconst name = 'core/unknown';\nconst title = __( 'Clear Unknown Formatting' );\n\nfunction selectionContainsUnknownFormats( value ) {\n\tif ( isCollapsed( value ) ) {\n\t\treturn false;\n\t}\n\n\tconst selectedValue = slice( value );\n\treturn selectedValue.formats.some( ( formats ) => {\n\t\treturn formats.some( ( format ) => format.type === name );\n\t} );\n}\n\nexport const unknown = {\n\tname,\n\ttitle,\n\ttagName: '*',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tif ( ! isActive && ! selectionContainsUnknownFormats( value ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonChange( removeFormat( value, name ) );\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\tname=\"unknown\"\n\t\t\t\ticon={ help }\n\t\t\t\ttitle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,KAAK,EAAGA,KAAO;MACfe,OAAO,EAAGA,OAAS;MACnBH,QAAQ;IAAA,CACR,CAAC;EAEJ;AACD,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/format-library",
3
- "version": "4.35.0",
3
+ "version": "5.0.1",
4
4
  "description": "Format library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -19,25 +19,26 @@
19
19
  "url": "https://github.com/WordPress/gutenberg/issues"
20
20
  },
21
21
  "engines": {
22
- "node": ">=12"
22
+ "node": ">=18.12.0",
23
+ "npm": ">=8.19.2"
23
24
  },
24
25
  "main": "build/index.js",
25
26
  "module": "build-module/index.js",
26
27
  "react-native": "src/index",
27
28
  "dependencies": {
28
29
  "@babel/runtime": "^7.16.0",
29
- "@wordpress/a11y": "^3.58.0",
30
- "@wordpress/block-editor": "^12.26.0",
31
- "@wordpress/components": "^27.6.0",
32
- "@wordpress/compose": "^6.35.0",
33
- "@wordpress/data": "^9.28.0",
34
- "@wordpress/element": "^5.35.0",
35
- "@wordpress/html-entities": "^3.58.0",
36
- "@wordpress/i18n": "^4.58.0",
37
- "@wordpress/icons": "^9.49.0",
38
- "@wordpress/private-apis": "^0.40.0",
39
- "@wordpress/rich-text": "^6.35.0",
40
- "@wordpress/url": "^3.59.0"
30
+ "@wordpress/a11y": "^4.0.1",
31
+ "@wordpress/block-editor": "^13.0.1",
32
+ "@wordpress/components": "^28.0.1",
33
+ "@wordpress/compose": "^7.0.1",
34
+ "@wordpress/data": "^10.0.1",
35
+ "@wordpress/element": "^6.0.1",
36
+ "@wordpress/html-entities": "^4.0.1",
37
+ "@wordpress/i18n": "^5.0.1",
38
+ "@wordpress/icons": "^10.0.1",
39
+ "@wordpress/private-apis": "^1.0.1",
40
+ "@wordpress/rich-text": "^7.0.1",
41
+ "@wordpress/url": "^4.0.1"
41
42
  },
42
43
  "peerDependencies": {
43
44
  "react": "^18.0.0",
@@ -46,5 +47,5 @@
46
47
  "publishConfig": {
47
48
  "access": "public"
48
49
  },
49
- "gitHead": "42f38f287506a6b3ed8ccba839b18ad066821044"
50
+ "gitHead": "0e973525f7787401b5a544e0727774d52a78639f"
50
51
  }
@@ -104,56 +104,43 @@ function Edit( {
104
104
  activeObjectAttributes,
105
105
  contentRef,
106
106
  } ) {
107
- const [ isModalOpen, setIsModalOpen ] = useState( false );
108
-
109
- function openModal() {
110
- setIsModalOpen( true );
111
- }
112
-
113
- function closeModal() {
114
- setIsModalOpen( false );
115
- }
116
-
117
107
  return (
118
108
  <MediaUploadCheck>
119
- <RichTextToolbarButton
120
- icon={
121
- <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
122
- <Path d="M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z" />
123
- </SVG>
124
- }
125
- title={ title }
126
- onClick={ openModal }
127
- isActive={ isObjectActive }
109
+ <MediaUpload
110
+ allowedTypes={ ALLOWED_MEDIA_TYPES }
111
+ onSelect={ ( { id, url, alt, width: imgWidth } ) => {
112
+ onChange(
113
+ insertObject( value, {
114
+ type: name,
115
+ attributes: {
116
+ className: `wp-image-${ id }`,
117
+ style: `width: ${ Math.min(
118
+ imgWidth,
119
+ 150
120
+ ) }px;`,
121
+ url,
122
+ alt,
123
+ },
124
+ } )
125
+ );
126
+ onFocus();
127
+ } }
128
+ render={ ( { open } ) => (
129
+ <RichTextToolbarButton
130
+ icon={
131
+ <SVG
132
+ xmlns="http://www.w3.org/2000/svg"
133
+ viewBox="0 0 24 24"
134
+ >
135
+ <Path d="M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z" />
136
+ </SVG>
137
+ }
138
+ title={ title }
139
+ onClick={ open }
140
+ isActive={ isObjectActive }
141
+ />
142
+ ) }
128
143
  />
129
- { isModalOpen && (
130
- <MediaUpload
131
- allowedTypes={ ALLOWED_MEDIA_TYPES }
132
- onSelect={ ( { id, url, alt, width: imgWidth } ) => {
133
- closeModal();
134
- onChange(
135
- insertObject( value, {
136
- type: name,
137
- attributes: {
138
- className: `wp-image-${ id }`,
139
- style: `width: ${ Math.min(
140
- imgWidth,
141
- 150
142
- ) }px;`,
143
- url,
144
- alt,
145
- },
146
- } )
147
- );
148
- onFocus();
149
- } }
150
- onClose={ closeModal }
151
- render={ ( { open } ) => {
152
- open();
153
- return null;
154
- } }
155
- />
156
- ) }
157
144
  { isObjectActive && (
158
145
  <InlineUI
159
146
  value={ value }
@@ -211,12 +211,12 @@ const LinkSettingsScreen = ( {
211
211
  label={ __( 'Open in new tab' ) }
212
212
  value={ opensInNewWindow }
213
213
  onValueChange={ setOpensInNewWindows }
214
- separatorType={ 'fullWidth' }
214
+ separatorType="fullWidth"
215
215
  />
216
216
  <BottomSheet.Cell
217
217
  label={ __( 'Remove link' ) }
218
218
  labelStyle={ styles.clearLinkButton }
219
- separatorType={ 'none' }
219
+ separatorType="none"
220
220
  onPress={ removeLink }
221
221
  />
222
222
  </>
@@ -8,12 +8,12 @@ import { StyleSheet, View } from 'react-native';
8
8
  */
9
9
  import { __ } from '@wordpress/i18n';
10
10
  import { useCallback, useMemo, useState } from '@wordpress/element';
11
- import { BlockControls, useSettings } from '@wordpress/block-editor';
12
11
  import {
13
- ToolbarGroup,
14
- ToolbarButton,
12
+ BlockControls,
13
+ useSettings,
15
14
  useMobileGlobalStylesColors,
16
- } from '@wordpress/components';
15
+ } from '@wordpress/block-editor';
16
+ import { ToolbarGroup, ToolbarButton } from '@wordpress/components';
17
17
  import {
18
18
  Icon,
19
19
  color as colorIcon,
@@ -11,12 +11,9 @@ import {
11
11
  getColorClassName,
12
12
  getColorObjectByColorValue,
13
13
  useMultipleOriginColorsAndGradients,
14
- } from '@wordpress/block-editor';
15
- import {
16
- BottomSheet,
17
- ColorSettings,
18
14
  useMobileGlobalStylesColors,
19
- } from '@wordpress/components';
15
+ } from '@wordpress/block-editor';
16
+ import { BottomSheet, ColorSettings } from '@wordpress/components';
20
17
 
21
18
  /**
22
19
  * Internal dependencies
@@ -108,6 +105,7 @@ function ColorPicker( { name, value, onChange, contentRef } ) {
108
105
  const property = 'color';
109
106
  const colors = useMobileGlobalStylesColors();
110
107
  const colorSettings = useMultipleOriginColorsAndGradients();
108
+ colorSettings.allAvailableColors = colors;
111
109
 
112
110
  const onColorChange = useCallback(
113
111
  ( color ) => {