@wordpress/components 34.0.0 → 35.0.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 (161) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/build/border-control/border-control-dropdown/component.cjs +33 -33
  3. package/build/border-control/border-control-dropdown/component.cjs.map +3 -3
  4. package/build/disabled/index.cjs +1 -1
  5. package/build/disabled/index.cjs.map +2 -2
  6. package/build/higher-order/with-notices/index.cjs +15 -3
  7. package/build/higher-order/with-notices/index.cjs.map +2 -2
  8. package/build/input-control/input-base.cjs +34 -31
  9. package/build/input-control/input-base.cjs.map +2 -2
  10. package/build/responsive-wrapper/index.cjs +3 -4
  11. package/build/responsive-wrapper/index.cjs.map +2 -2
  12. package/build/tooltip/index.cjs +1 -2
  13. package/build/tooltip/index.cjs.map +2 -2
  14. package/build-module/border-control/border-control-dropdown/component.mjs +34 -34
  15. package/build-module/border-control/border-control-dropdown/component.mjs.map +2 -2
  16. package/build-module/disabled/index.mjs +1 -1
  17. package/build-module/disabled/index.mjs.map +2 -2
  18. package/build-module/higher-order/with-notices/index.mjs +16 -4
  19. package/build-module/higher-order/with-notices/index.mjs.map +2 -2
  20. package/build-module/input-control/input-base.mjs +34 -31
  21. package/build-module/input-control/input-base.mjs.map +2 -2
  22. package/build-module/responsive-wrapper/index.mjs +3 -4
  23. package/build-module/responsive-wrapper/index.mjs.map +2 -2
  24. package/build-module/tooltip/index.mjs +1 -2
  25. package/build-module/tooltip/index.mjs.map +2 -2
  26. package/build-types/border-box-control/border-box-control/hook.d.ts +10 -24
  27. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  28. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +12 -26
  29. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  30. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +10 -24
  31. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  32. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +11 -25
  33. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  34. package/build-types/border-control/border-control/hook.d.ts +10 -24
  35. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  36. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  37. package/build-types/border-control/border-control-dropdown/hook.d.ts +9 -23
  38. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  39. package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
  40. package/build-types/card/card/hook.d.ts +11 -25
  41. package/build-types/card/card/hook.d.ts.map +1 -1
  42. package/build-types/card/card-body/hook.d.ts +11 -25
  43. package/build-types/card/card-body/hook.d.ts.map +1 -1
  44. package/build-types/card/card-divider/hook.d.ts +12 -26
  45. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  46. package/build-types/card/card-footer/hook.d.ts +11 -25
  47. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  48. package/build-types/card/card-header/hook.d.ts +11 -25
  49. package/build-types/card/card-header/hook.d.ts.map +1 -1
  50. package/build-types/card/card-media/hook.d.ts +11 -25
  51. package/build-types/card/card-media/hook.d.ts.map +1 -1
  52. package/build-types/color-picker/styles.d.ts +2 -2
  53. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  54. package/build-types/custom-select-control-v2/styles.d.ts +12 -4
  55. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
  56. package/build-types/date-time/time-picker/styles.d.ts +4 -4
  57. package/build-types/elevation/hook.d.ts +11 -25
  58. package/build-types/elevation/hook.d.ts.map +1 -1
  59. package/build-types/flex/flex/hook.d.ts +11 -25
  60. package/build-types/flex/flex/hook.d.ts.map +1 -1
  61. package/build-types/flex/flex-block/hook.d.ts +11 -25
  62. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  63. package/build-types/flex/flex-item/hook.d.ts +11 -25
  64. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  65. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  66. package/build-types/grid/hook.d.ts +11 -25
  67. package/build-types/grid/hook.d.ts.map +1 -1
  68. package/build-types/h-stack/hook.d.ts +11 -25
  69. package/build-types/h-stack/hook.d.ts.map +1 -1
  70. package/build-types/heading/hook.d.ts +11 -25
  71. package/build-types/heading/hook.d.ts.map +1 -1
  72. package/build-types/higher-order/with-fallback-styles/index.d.ts +3 -1
  73. package/build-types/higher-order/with-filters/index.d.ts +6 -1
  74. package/build-types/higher-order/with-filters/index.d.ts.map +1 -1
  75. package/build-types/higher-order/with-notices/index.d.ts +4 -2
  76. package/build-types/higher-order/with-notices/index.d.ts.map +1 -1
  77. package/build-types/input-control/reducer/reducer.d.ts +1 -1
  78. package/build-types/item-group/item/hook.d.ts +11 -25
  79. package/build-types/item-group/item/hook.d.ts.map +1 -1
  80. package/build-types/item-group/item-group/hook.d.ts +11 -25
  81. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  82. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  83. package/build-types/menu/styles.d.ts +21 -7
  84. package/build-types/menu/styles.d.ts.map +1 -1
  85. package/build-types/modal/use-modal-exit-animation.d.ts +1 -1
  86. package/build-types/navigator/navigator-back-button/hook.d.ts +12 -26
  87. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  88. package/build-types/navigator/navigator-button/hook.d.ts +12 -26
  89. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  90. package/build-types/number-control/index.d.ts +1 -1
  91. package/build-types/number-control/index.d.ts.map +1 -1
  92. package/build-types/number-control/stories/index.story.d.ts +1 -1
  93. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  94. package/build-types/popover/types.d.ts +2 -2
  95. package/build-types/popover/types.d.ts.map +1 -1
  96. package/build-types/range-control/index.d.ts +1 -1
  97. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  98. package/build-types/range-control/types.d.ts +1 -1
  99. package/build-types/range-control/types.d.ts.map +1 -1
  100. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  101. package/build-types/scrollable/hook.d.ts +11 -25
  102. package/build-types/scrollable/hook.d.ts.map +1 -1
  103. package/build-types/snackbar/index.d.ts +2 -2
  104. package/build-types/snackbar/types.d.ts +2 -2
  105. package/build-types/snackbar/types.d.ts.map +1 -1
  106. package/build-types/spacer/hook.d.ts +11 -25
  107. package/build-types/spacer/hook.d.ts.map +1 -1
  108. package/build-types/surface/hook.d.ts +11 -25
  109. package/build-types/surface/hook.d.ts.map +1 -1
  110. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  111. package/build-types/tabs/styles.d.ts +9 -3
  112. package/build-types/tabs/styles.d.ts.map +1 -1
  113. package/build-types/text/hook.d.ts +11 -25
  114. package/build-types/text/hook.d.ts.map +1 -1
  115. package/build-types/tools-panel/tools-panel/hook.d.ts +11 -25
  116. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  117. package/build-types/tools-panel/tools-panel-header/hook.d.ts +11 -25
  118. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  119. package/build-types/tools-panel/tools-panel-item/hook.d.ts +11 -25
  120. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  121. package/build-types/tooltip/index.d.ts.map +1 -1
  122. package/build-types/truncate/hook.d.ts +11 -25
  123. package/build-types/truncate/hook.d.ts.map +1 -1
  124. package/build-types/unit-control/index.d.ts +1 -1
  125. package/build-types/unit-control/index.d.ts.map +1 -1
  126. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  127. package/build-types/utils/get-node-text.d.ts.map +1 -1
  128. package/build-types/v-stack/hook.d.ts +11 -25
  129. package/build-types/v-stack/hook.d.ts.map +1 -1
  130. package/build-types/validated-form-controls/components/number-control.d.ts +1 -1
  131. package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
  132. package/build-types/validated-form-controls/components/range-control.d.ts +1 -1
  133. package/build-types/validated-form-controls/control-with-error.d.ts +1 -4
  134. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
  135. package/package.json +26 -26
  136. package/src/autocomplete/README.md +1 -1
  137. package/src/border-control/border-control-dropdown/component.tsx +37 -36
  138. package/src/composite/stories/index.story.tsx +1 -0
  139. package/src/disabled/index.tsx +1 -1
  140. package/src/form-file-upload/README.md +1 -1
  141. package/src/h-stack/hook.tsx +1 -1
  142. package/src/higher-order/with-notices/index.tsx +21 -4
  143. package/src/higher-order/with-notices/test/index.tsx +18 -0
  144. package/src/input-control/input-base.tsx +2 -2
  145. package/src/menu/README.md +7 -7
  146. package/src/menu/stories/index.story.tsx +1 -0
  147. package/src/popover/index.tsx +1 -1
  148. package/src/popover/types.ts +4 -2
  149. package/src/range-control/types.ts +1 -1
  150. package/src/responsive-wrapper/index.tsx +3 -7
  151. package/src/snackbar/README.md +1 -1
  152. package/src/snackbar/types.ts +2 -2
  153. package/src/tabs/README.md +1 -1
  154. package/src/tabs/stories/index.story.tsx +1 -0
  155. package/src/tabs/tablist.tsx +1 -1
  156. package/src/tooltip/index.tsx +1 -7
  157. package/src/tree-grid/test/cell.tsx +1 -0
  158. package/src/tree-grid/test/roving-tab-index-item.tsx +1 -0
  159. package/src/tree-select/README.md +1 -1
  160. package/src/utils/get-node-text.ts +1 -7
  161. package/src/validated-form-controls/control-with-error.tsx +1 -6
package/CHANGELOG.md CHANGED
@@ -2,11 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 35.0.0 (2026-06-04)
6
+
7
+ ### Breaking Changes
8
+
9
+ - Revert React back to v18 [#78940](https://github.com/WordPress/gutenberg/pull/78940).
10
+
5
11
  ## 34.0.0 (2026-05-27)
6
12
 
7
13
  ### Breaking Changes
8
14
 
9
- - Upgrade React to v19 ([#61521](https://github.com/WordPress/gutenberg/pull/61521)).
10
15
  - `BoxControl`: Remove deprecated `__experimentalApplyValueToSides` export ([#78528](https://github.com/WordPress/gutenberg/pull/78528)).
11
16
  - `Navigation`: Completely remove deprecated component family ([#78529](https://github.com/WordPress/gutenberg/pull/78529)).
12
17
  - `Notice`: Rework internal DOM structure and class names ([#78231](https://github.com/WordPress/gutenberg/pull/78231)). Consumers relying on those implementation details should update their projects accordingly:
@@ -133,8 +133,6 @@ var BorderControlDropdown = (props, forwardedRef) => {
133
133
  resetButtonWrapperClassName,
134
134
  size,
135
135
  __unstablePopoverProps,
136
- onToggle: onToggleProp,
137
- // Remove from `otherProps` to avoid type errors (native HTML `onToggle` vs `Dropdown` `onToggle`).
138
136
  ...otherProps
139
137
  } = (0, import_hook.useBorderControlDropdown)(props);
140
138
  const {
@@ -163,38 +161,40 @@ var BorderControlDropdown = (props, forwardedRef) => {
163
161
  })
164
162
  })
165
163
  });
166
- const renderContent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_content_wrapper.default, {
167
- paddingSize: "medium",
168
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_v_stack.VStack, {
169
- className: popoverControlsClassName,
170
- spacing: 6,
171
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_color_palette.default, {
172
- className: popoverContentClassName,
173
- value: color,
174
- onChange: onColorChange,
175
- colors,
176
- disableCustomColors,
177
- __experimentalIsRenderedInSidebar,
178
- clearable: false,
179
- enableAlpha
180
- }), enableStyle && isStyleSettable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_border_control_style_picker.default, {
181
- label: (0, import_i18n.__)("Style"),
182
- value: style,
183
- onChange: onStyleChange
164
+ const renderContent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
165
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_content_wrapper.default, {
166
+ paddingSize: "medium",
167
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_v_stack.VStack, {
168
+ className: popoverControlsClassName,
169
+ spacing: 6,
170
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_color_palette.default, {
171
+ className: popoverContentClassName,
172
+ value: color,
173
+ onChange: onColorChange,
174
+ colors,
175
+ disableCustomColors,
176
+ __experimentalIsRenderedInSidebar,
177
+ clearable: false,
178
+ enableAlpha
179
+ }), enableStyle && isStyleSettable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_border_control_style_picker.default, {
180
+ label: (0, import_i18n.__)("Style"),
181
+ value: style,
182
+ onChange: onStyleChange
183
+ })]
184
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
185
+ className: resetButtonWrapperClassName,
186
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.default, {
187
+ variant: "tertiary",
188
+ onClick: () => {
189
+ onReset();
190
+ },
191
+ disabled: !enableResetButton,
192
+ accessibleWhenDisabled: true,
193
+ __next40pxDefaultSize: true,
194
+ children: (0, import_i18n.__)("Reset")
195
+ })
184
196
  })]
185
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
186
- className: resetButtonWrapperClassName,
187
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.default, {
188
- variant: "tertiary",
189
- onClick: () => {
190
- onReset();
191
- },
192
- disabled: !enableResetButton,
193
- accessibleWhenDisabled: true,
194
- __next40pxDefaultSize: true,
195
- children: (0, import_i18n.__)("Reset")
196
- })
197
- })]
197
+ })
198
198
  });
199
199
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown.default, {
200
200
  renderToggle,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/border-control/border-control-dropdown/component.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { VStack } from '../../v-stack';\nimport { contextConnect } from '../../context';\nimport { useBorderControlDropdown } from './hook';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\nimport { isMultiplePaletteArray } from '../../color-palette/utils';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst getAriaLabelColorValue = colorValue => {\n // Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n return colorValue.replace(/^var\\((.+)\\)$/, '$1');\n};\nconst getColorObject = (colorValue, colors) => {\n if (!colorValue || !colors) {\n return;\n }\n if (isMultiplePaletteArray(colors)) {\n // Multiple origins\n let matchedColor;\n colors.some(origin => origin.colors.some(color => {\n if (color.color === colorValue) {\n matchedColor = color;\n return true;\n }\n return false;\n }));\n return matchedColor;\n }\n\n // Single origin\n return colors.find(color => color.color === colorValue);\n};\nconst getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => {\n if (isStyleEnabled) {\n if (colorObject) {\n const ariaLabelValue = getAriaLabelColorValue(colorObject.color);\n return style ? sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\". 3: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".'), colorObject.name, ariaLabelValue, style) : sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, ariaLabelValue);\n }\n if (colorValue) {\n const ariaLabelValue = getAriaLabelColorValue(colorValue);\n return style ? sprintf(\n // translators: 1: The color's hex code e.g.: \"#f00:\". 2: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".'), ariaLabelValue, style) : sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color and style picker. The currently selected color has a value of \"%s\".'), ariaLabelValue);\n }\n return __('Border color and style picker.');\n }\n if (colorObject) {\n return sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, getAriaLabelColorValue(colorObject.color));\n }\n if (colorValue) {\n return sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color has a value of \"%s\".'), getAriaLabelColorValue(colorValue));\n }\n return __('Border color picker.');\n};\nconst BorderControlDropdown = (props, forwardedRef) => {\n const {\n __experimentalIsRenderedInSidebar,\n border,\n colors,\n disableCustomColors,\n enableAlpha,\n enableStyle,\n indicatorClassName,\n indicatorWrapperClassName,\n isStyleSettable,\n onReset,\n onColorChange,\n onStyleChange,\n popoverContentClassName,\n popoverControlsClassName,\n resetButtonWrapperClassName,\n size,\n __unstablePopoverProps,\n onToggle: onToggleProp,\n // Remove from `otherProps` to avoid type errors (native HTML `onToggle` vs `Dropdown` `onToggle`).\n ...otherProps\n } = useBorderControlDropdown(props);\n const {\n color,\n style\n } = border || {};\n const colorObject = getColorObject(color, colors);\n const toggleAriaLabel = getToggleAriaLabel(color, colorObject, style, enableStyle);\n const enableResetButton = color || style && style !== 'none';\n const dropdownPosition = __experimentalIsRenderedInSidebar ? 'bottom left' : undefined;\n const renderToggle = ({\n onToggle\n }) => /*#__PURE__*/_jsx(Button, {\n onClick: onToggle,\n variant: \"tertiary\",\n \"aria-label\": toggleAriaLabel,\n tooltipPosition: dropdownPosition,\n label: __('Border color and style picker'),\n showTooltip: true,\n __next40pxDefaultSize: size === '__unstable-large',\n children: /*#__PURE__*/_jsx(\"span\", {\n className: indicatorWrapperClassName,\n children: /*#__PURE__*/_jsx(ColorIndicator, {\n className: indicatorClassName,\n colorValue: color\n })\n })\n });\n const renderContent = () => /*#__PURE__*/_jsxs(DropdownContentWrapper, {\n paddingSize: \"medium\",\n children: [/*#__PURE__*/_jsxs(VStack, {\n className: popoverControlsClassName,\n spacing: 6,\n children: [/*#__PURE__*/_jsx(ColorPalette, {\n className: popoverContentClassName,\n value: color,\n onChange: onColorChange,\n colors,\n disableCustomColors,\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n clearable: false,\n enableAlpha: enableAlpha\n }), enableStyle && isStyleSettable && /*#__PURE__*/_jsx(BorderControlStylePicker, {\n label: __('Style'),\n value: style,\n onChange: onStyleChange\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n className: resetButtonWrapperClassName,\n children: /*#__PURE__*/_jsx(Button, {\n variant: \"tertiary\",\n onClick: () => {\n onReset();\n },\n disabled: !enableResetButton,\n accessibleWhenDisabled: true,\n __next40pxDefaultSize: true,\n children: __('Reset')\n })\n })]\n });\n return /*#__PURE__*/_jsx(Dropdown, {\n renderToggle: renderToggle,\n renderContent: renderContent,\n popoverProps: {\n ...__unstablePopoverProps\n },\n ...otherProps,\n ref: forwardedRef\n });\n};\nconst ConnectedBorderControlDropdown = contextConnect(BorderControlDropdown, 'BorderControlDropdown');\nexport default ConnectedBorderControlDropdown;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,kBAA4B;AAK5B,yCAAqC;AACrC,oBAAmB;AACnB,6BAA2B;AAC3B,2BAAyB;AACzB,sBAAqB;AACrB,qBAAuB;AACvB,qBAA+B;AAC/B,kBAAyC;AACzC,sCAAmC;AACnC,mBAAuC;AACvC,yBAA2C;AAC3C,IAAM,yBAAyB,gBAAc;AAE3C,SAAO,WAAW,QAAQ,iBAAiB,IAAI;AACjD;AACA,IAAM,iBAAiB,CAAC,YAAY,WAAW;AAC7C,MAAI,CAAC,cAAc,CAAC,QAAQ;AAC1B;AAAA,EACF;AACA,UAAI,qCAAuB,MAAM,GAAG;AAElC,QAAI;AACJ,WAAO,KAAK,YAAU,OAAO,OAAO,KAAK,WAAS;AAChD,UAAI,MAAM,UAAU,YAAY;AAC9B,uBAAe;AACf,eAAO;AAAA,MACT;AACA,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;AAAA,MAC3B,WAAW;AAAA,MACX,UAAuB,uCAAAA,KAAK,cAAAC,SAAQ;AAAA,QAClC,SAAS;AAAA,QACT,SAAS,MAAM;AACb,kBAAQ;AAAA,QACV;AAAA,QACA,UAAU,CAAC;AAAA,QACX,wBAAwB;AAAA,QACxB,uBAAuB;AAAA,QACvB,cAAU,gBAAG,OAAO;AAAA,MACtB,CAAC;AAAA,IACH,CAAC,CAAC;AAAA,EACJ,CAAC;AACD,SAAoB,uCAAAD,KAAK,gBAAAO,SAAU;AAAA,IACjC;AAAA,IACA;AAAA,IACA,cAAc;AAAA,MACZ,GAAG;AAAA,IACL;AAAA,IACA,GAAG;AAAA,IACH,KAAK;AAAA,EACP,CAAC;AACH;AACA,IAAM,qCAAiC,+BAAe,uBAAuB,uBAAuB;AACpG,IAAO,oBAAQ;",
6
- "names": ["_jsx", "Button", "ColorIndicator", "_jsxs", "DropdownContentWrapper", "ColorPalette", "BorderControlStylePicker", "Dropdown"]
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { VStack } from '../../v-stack';\nimport { contextConnect } from '../../context';\nimport { useBorderControlDropdown } from './hook';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\nimport { isMultiplePaletteArray } from '../../color-palette/utils';\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst getAriaLabelColorValue = colorValue => {\n // Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n return colorValue.replace(/^var\\((.+)\\)$/, '$1');\n};\nconst getColorObject = (colorValue, colors) => {\n if (!colorValue || !colors) {\n return;\n }\n if (isMultiplePaletteArray(colors)) {\n // Multiple origins\n let matchedColor;\n colors.some(origin => origin.colors.some(color => {\n if (color.color === colorValue) {\n matchedColor = color;\n return true;\n }\n return false;\n }));\n return matchedColor;\n }\n\n // Single origin\n return colors.find(color => color.color === colorValue);\n};\nconst getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => {\n if (isStyleEnabled) {\n if (colorObject) {\n const ariaLabelValue = getAriaLabelColorValue(colorObject.color);\n return style ? sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\". 3: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".'), colorObject.name, ariaLabelValue, style) : sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, ariaLabelValue);\n }\n if (colorValue) {\n const ariaLabelValue = getAriaLabelColorValue(colorValue);\n return style ? sprintf(\n // translators: 1: The color's hex code e.g.: \"#f00:\". 2: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".'), ariaLabelValue, style) : sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color and style picker. The currently selected color has a value of \"%s\".'), ariaLabelValue);\n }\n return __('Border color and style picker.');\n }\n if (colorObject) {\n return sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, getAriaLabelColorValue(colorObject.color));\n }\n if (colorValue) {\n return sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color has a value of \"%s\".'), getAriaLabelColorValue(colorValue));\n }\n return __('Border color picker.');\n};\nconst BorderControlDropdown = (props, forwardedRef) => {\n const {\n __experimentalIsRenderedInSidebar,\n border,\n colors,\n disableCustomColors,\n enableAlpha,\n enableStyle,\n indicatorClassName,\n indicatorWrapperClassName,\n isStyleSettable,\n onReset,\n onColorChange,\n onStyleChange,\n popoverContentClassName,\n popoverControlsClassName,\n resetButtonWrapperClassName,\n size,\n __unstablePopoverProps,\n ...otherProps\n } = useBorderControlDropdown(props);\n const {\n color,\n style\n } = border || {};\n const colorObject = getColorObject(color, colors);\n const toggleAriaLabel = getToggleAriaLabel(color, colorObject, style, enableStyle);\n const enableResetButton = color || style && style !== 'none';\n const dropdownPosition = __experimentalIsRenderedInSidebar ? 'bottom left' : undefined;\n const renderToggle = ({\n onToggle\n }) => /*#__PURE__*/_jsx(Button, {\n onClick: onToggle,\n variant: \"tertiary\",\n \"aria-label\": toggleAriaLabel,\n tooltipPosition: dropdownPosition,\n label: __('Border color and style picker'),\n showTooltip: true,\n __next40pxDefaultSize: size === '__unstable-large',\n children: /*#__PURE__*/_jsx(\"span\", {\n className: indicatorWrapperClassName,\n children: /*#__PURE__*/_jsx(ColorIndicator, {\n className: indicatorClassName,\n colorValue: color\n })\n })\n });\n const renderContent = () => /*#__PURE__*/_jsx(_Fragment, {\n children: /*#__PURE__*/_jsxs(DropdownContentWrapper, {\n paddingSize: \"medium\",\n children: [/*#__PURE__*/_jsxs(VStack, {\n className: popoverControlsClassName,\n spacing: 6,\n children: [/*#__PURE__*/_jsx(ColorPalette, {\n className: popoverContentClassName,\n value: color,\n onChange: onColorChange,\n colors,\n disableCustomColors,\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n clearable: false,\n enableAlpha: enableAlpha\n }), enableStyle && isStyleSettable && /*#__PURE__*/_jsx(BorderControlStylePicker, {\n label: __('Style'),\n value: style,\n onChange: onStyleChange\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n className: resetButtonWrapperClassName,\n children: /*#__PURE__*/_jsx(Button, {\n variant: \"tertiary\",\n onClick: () => {\n onReset();\n },\n disabled: !enableResetButton,\n accessibleWhenDisabled: true,\n __next40pxDefaultSize: true,\n children: __('Reset')\n })\n })]\n })\n });\n return /*#__PURE__*/_jsx(Dropdown, {\n renderToggle: renderToggle,\n renderContent: renderContent,\n popoverProps: {\n ...__unstablePopoverProps\n },\n ...otherProps,\n ref: forwardedRef\n });\n};\nconst ConnectedBorderControlDropdown = contextConnect(BorderControlDropdown, 'BorderControlDropdown');\nexport default ConnectedBorderControlDropdown;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,kBAA4B;AAK5B,yCAAqC;AACrC,oBAAmB;AACnB,6BAA2B;AAC3B,2BAAyB;AACzB,sBAAqB;AACrB,qBAAuB;AACvB,qBAA+B;AAC/B,kBAAyC;AACzC,sCAAmC;AACnC,mBAAuC;AACvC,yBAAkE;AAClE,IAAM,yBAAyB,gBAAc;AAE3C,SAAO,WAAW,QAAQ,iBAAiB,IAAI;AACjD;AACA,IAAM,iBAAiB,CAAC,YAAY,WAAW;AAC7C,MAAI,CAAC,cAAc,CAAC,QAAQ;AAC1B;AAAA,EACF;AACA,UAAI,qCAAuB,MAAM,GAAG;AAElC,QAAI;AACJ,WAAO,KAAK,YAAU,OAAO,OAAO,KAAK,WAAS;AAChD,UAAI,MAAM,UAAU,YAAY;AAC9B,uBAAe;AACf,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,CAAC,CAAC;AACF,WAAO;AAAA,EACT;AAGA,SAAO,OAAO,KAAK,WAAS,MAAM,UAAU,UAAU;AACxD;AACA,IAAM,qBAAqB,CAAC,YAAY,aAAa,OAAO,mBAAmB;AAC7E,MAAI,gBAAgB;AAClB,QAAI,aAAa;AACf,YAAM,iBAAiB,uBAAuB,YAAY,KAAK;AAC/D,aAAO,YAAQ;AAAA;AAAA,YAEf,gBAAG,iJAAiJ;AAAA,QAAG,YAAY;AAAA,QAAM;AAAA,QAAgB;AAAA,MAAK,QAAI;AAAA;AAAA,YAElM,gBAAG,yGAAyG;AAAA,QAAG,YAAY;AAA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;AAAA,MACZ,GAAG;AAAA,IACL;AAAA,IACA,GAAG;AAAA,IACH,KAAK;AAAA,EACP,CAAC;AACH;AACA,IAAM,qCAAiC,+BAAe,uBAAuB,uBAAuB;AACpG,IAAO,oBAAQ;",
6
+ "names": ["_jsx", "Button", "ColorIndicator", "_Fragment", "_jsxs", "DropdownContentWrapper", "ColorPalette", "BorderControlStylePicker", "Dropdown"]
7
7
  }
@@ -52,7 +52,7 @@ function Disabled({
52
52
  value: isDisabled,
53
53
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
54
54
  // @ts-ignore Reason: inert is a recent HTML attribute
55
- inert: isDisabled ? true : void 0,
55
+ inert: isDisabled ? "true" : void 0,
56
56
  className: isDisabled ? cx(import_disabled_styles.disabledStyles, className, "components-disabled") : void 0,
57
57
  ...props,
58
58
  children
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/disabled/index.tsx"],
4
- "sourcesContent": ["import { disabledStyles } from './styles/disabled-styles';\nimport { useCx } from '../utils';\nimport Context from './context';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst {\n Consumer,\n Provider\n} = Context;\n\n/**\n * `Disabled` is a component which disables descendant tabbable elements and\n * prevents pointer interaction.\n *\n * _Note: this component may not behave as expected in browsers that don't\n * support the `inert` HTML attribute. We recommend adding the official WICG\n * polyfill when using this component in your project._\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n *\n * ```jsx\n * import { Button, Disabled, TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDisabled = () => {\n * \tconst [ isDisabled, setIsDisabled ] = useState( true );\n *\n *\tlet input = (\n *\t\t<TextControl\n *\t\t\t__next40pxDefaultSize\n *\t\t\tlabel=\"Input\"\n *\t\t\tonChange={ () => {} }\n *\t\t/>\n *\t);\n * \tif ( isDisabled ) {\n * \t\tinput = <Disabled>{ input }</Disabled>;\n * \t}\n *\n * \tconst toggleDisabled = () => {\n * \t\tsetIsDisabled( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ input }\n * \t\t\t<Button variant=\"primary\" onClick={ toggleDisabled }>\n * \t\t\t\tToggle Disabled\n * \t\t\t</Button>\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction Disabled({\n className,\n children,\n isDisabled = true,\n ...props\n}) {\n const cx = useCx();\n return /*#__PURE__*/_jsx(Provider, {\n value: isDisabled,\n children: /*#__PURE__*/_jsx(\"div\", {\n // @ts-ignore Reason: inert is a recent HTML attribute\n inert: isDisabled ? true : undefined,\n className: isDisabled ? cx(disabledStyles, className, 'components-disabled') : undefined,\n ...props,\n children: children\n })\n });\n}\nDisabled.Context = Context;\nDisabled.Consumer = Consumer;\nexport default Disabled;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAA+B;AAC/B,mBAAsB;AACtB,qBAAoB;AACpB,yBAA4B;AAC5B,IAAM;AAAA,EACJ;AAAA,EACA;AACF,IAAI,eAAAA;AA6CJ,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,GAAG;AACL,GAAG;AACD,QAAM,SAAK,oBAAM;AACjB,SAAoB,uCAAAC,KAAK,UAAU;AAAA,IACjC,OAAO;AAAA,IACP,UAAuB,uCAAAA,KAAK,OAAO;AAAA;AAAA,MAEjC,OAAO,aAAa,OAAO;AAAA,MAC3B,WAAW,aAAa,GAAG,uCAAgB,WAAW,qBAAqB,IAAI;AAAA,MAC/E,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AACA,SAAS,UAAU,eAAAD;AACnB,SAAS,WAAW;AACpB,IAAO,mBAAQ;",
4
+ "sourcesContent": ["import { disabledStyles } from './styles/disabled-styles';\nimport { useCx } from '../utils';\nimport Context from './context';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst {\n Consumer,\n Provider\n} = Context;\n\n/**\n * `Disabled` is a component which disables descendant tabbable elements and\n * prevents pointer interaction.\n *\n * _Note: this component may not behave as expected in browsers that don't\n * support the `inert` HTML attribute. We recommend adding the official WICG\n * polyfill when using this component in your project._\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n *\n * ```jsx\n * import { Button, Disabled, TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDisabled = () => {\n * \tconst [ isDisabled, setIsDisabled ] = useState( true );\n *\n *\tlet input = (\n *\t\t<TextControl\n *\t\t\t__next40pxDefaultSize\n *\t\t\tlabel=\"Input\"\n *\t\t\tonChange={ () => {} }\n *\t\t/>\n *\t);\n * \tif ( isDisabled ) {\n * \t\tinput = <Disabled>{ input }</Disabled>;\n * \t}\n *\n * \tconst toggleDisabled = () => {\n * \t\tsetIsDisabled( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ input }\n * \t\t\t<Button variant=\"primary\" onClick={ toggleDisabled }>\n * \t\t\t\tToggle Disabled\n * \t\t\t</Button>\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction Disabled({\n className,\n children,\n isDisabled = true,\n ...props\n}) {\n const cx = useCx();\n return /*#__PURE__*/_jsx(Provider, {\n value: isDisabled,\n children: /*#__PURE__*/_jsx(\"div\", {\n // @ts-ignore Reason: inert is a recent HTML attribute\n inert: isDisabled ? 'true' : undefined,\n className: isDisabled ? cx(disabledStyles, className, 'components-disabled') : undefined,\n ...props,\n children: children\n })\n });\n}\nDisabled.Context = Context;\nDisabled.Consumer = Consumer;\nexport default Disabled;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAA+B;AAC/B,mBAAsB;AACtB,qBAAoB;AACpB,yBAA4B;AAC5B,IAAM;AAAA,EACJ;AAAA,EACA;AACF,IAAI,eAAAA;AA6CJ,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,GAAG;AACL,GAAG;AACD,QAAM,SAAK,oBAAM;AACjB,SAAoB,uCAAAC,KAAK,UAAU;AAAA,IACjC,OAAO;AAAA,IACP,UAAuB,uCAAAA,KAAK,OAAO;AAAA;AAAA,MAEjC,OAAO,aAAa,SAAS;AAAA,MAC7B,WAAW,aAAa,GAAG,uCAAgB,WAAW,qBAAqB,IAAI;AAAA,MAC/E,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AACA,SAAS,UAAU,eAAAD;AACnB,SAAS,WAAW;AACpB,IAAO,mBAAQ;",
6
6
  "names": ["Context", "_jsx"]
7
7
  }
@@ -39,7 +39,7 @@ var import_compose = require("@wordpress/compose");
39
39
  var import_list = __toESM(require("../../notice/list.cjs"));
40
40
  var import_jsx_runtime = require("react/jsx-runtime");
41
41
  var with_notices_default = (0, import_compose.createHigherOrderComponent)((OriginalComponent) => {
42
- return function Component(props) {
42
+ function Component(props, ref) {
43
43
  const [noticeList, setNoticeList] = (0, import_element.useState)([]);
44
44
  const noticeOperations = (0, import_element.useMemo)(() => {
45
45
  const createNotice = (notice) => {
@@ -75,9 +75,21 @@ var with_notices_default = (0, import_compose.createHigherOrderComponent)((Origi
75
75
  onRemove: noticeOperations.removeNotice
76
76
  })
77
77
  };
78
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OriginalComponent, {
78
+ return isForwardRef ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OriginalComponent, {
79
+ ...propsOut,
80
+ ref
81
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OriginalComponent, {
79
82
  ...propsOut
80
83
  });
81
- };
84
+ }
85
+ let isForwardRef;
86
+ const {
87
+ render
88
+ } = OriginalComponent;
89
+ if (typeof render === "function") {
90
+ isForwardRef = true;
91
+ return (0, import_element.forwardRef)(Component);
92
+ }
93
+ return Component;
82
94
  }, "withNotices");
83
95
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/higher-order/with-notices/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NoticeList from '../../notice/list';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Override the default edit UI to include notices if supported.\n *\n * Wrapping the original component with `withNotices` encapsulates the component\n * with the additional props `noticeOperations` and `noticeUI`.\n *\n * ```jsx\n * import { withNotices, Button } from '@wordpress/components';\n *\n * const MyComponentWithNotices = withNotices(\n * \t( { noticeOperations, noticeUI } ) => {\n * \t\tconst addError = () =>\n * \t\t\tnoticeOperations.createErrorNotice( 'Error message' );\n * \t\treturn (\n * \t\t\t<div>\n * \t\t\t\t{ noticeUI }\n * \t\t\t\t<Button variant=\"secondary\" onClick={ addError }>\n * \t\t\t\t\tAdd error\n * \t\t\t\t</Button>\n * \t\t\t</div>\n * \t\t);\n * \t}\n * );\n * ```\n *\n * @param OriginalComponent Original component.\n *\n * @return Wrapped component.\n */\nexport default createHigherOrderComponent(OriginalComponent => {\n return function Component(props) {\n const [noticeList, setNoticeList] = useState([]);\n const noticeOperations = useMemo(() => {\n const createNotice = notice => {\n const noticeToAdd = notice.id ? notice : {\n ...notice,\n id: uuid()\n };\n setNoticeList(current => [...current, noticeToAdd]);\n };\n return {\n createNotice,\n createErrorNotice: msg => {\n // @ts-expect-error TODO: Missing `id`, potentially a bug\n createNotice({\n status: 'error',\n content: msg\n });\n },\n removeNotice: id => {\n setNoticeList(current => current.filter(notice => notice.id !== id));\n },\n removeAllNotices: () => {\n setNoticeList([]);\n }\n };\n }, []);\n const propsOut = {\n ...props,\n noticeList,\n noticeOperations,\n noticeUI: noticeList.length > 0 && /*#__PURE__*/_jsx(NoticeList, {\n className: \"components-with-notices-ui\",\n notices: noticeList,\n onRemove: noticeOperations.removeNotice\n })\n };\n return /*#__PURE__*/_jsx(OriginalComponent, {\n ...propsOut\n });\n };\n}, 'withNotices');"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2B;AAK3B,qBAAkC;AAClC,qBAA2C;AAK3C,kBAAuB;AACvB,yBAA4B;AA8B5B,IAAO,2BAAQ,2CAA2B,uBAAqB;AAC7D,SAAO,SAAS,UAAU,OAAO;AAC/B,UAAM,CAAC,YAAY,aAAa,QAAI,yBAAS,CAAC,CAAC;AAC/C,UAAM,uBAAmB,wBAAQ,MAAM;AACrC,YAAM,eAAe,YAAU;AAC7B,cAAM,cAAc,OAAO,KAAK,SAAS;AAAA,UACvC,GAAG;AAAA,UACH,QAAI,YAAAA,IAAK;AAAA,QACX;AACA,sBAAc,aAAW,CAAC,GAAG,SAAS,WAAW,CAAC;AAAA,MACpD;AACA,aAAO;AAAA,QACL;AAAA,QACA,mBAAmB,SAAO;AAExB,uBAAa;AAAA,YACX,QAAQ;AAAA,YACR,SAAS;AAAA,UACX,CAAC;AAAA,QACH;AAAA,QACA,cAAc,QAAM;AAClB,wBAAc,aAAW,QAAQ,OAAO,YAAU,OAAO,OAAO,EAAE,CAAC;AAAA,QACrE;AAAA,QACA,kBAAkB,MAAM;AACtB,wBAAc,CAAC,CAAC;AAAA,QAClB;AAAA,MACF;AAAA,IACF,GAAG,CAAC,CAAC;AACL,UAAM,WAAW;AAAA,MACf,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,UAAU,WAAW,SAAS,KAAkB,uCAAAC,KAAK,YAAAC,SAAY;AAAA,QAC/D,WAAW;AAAA,QACX,SAAS;AAAA,QACT,UAAU,iBAAiB;AAAA,MAC7B,CAAC;AAAA,IACH;AACA,WAAoB,uCAAAD,KAAK,mBAAmB;AAAA,MAC1C,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF,GAAG,aAAa;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useState, useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NoticeList from '../../notice/list';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Override the default edit UI to include notices if supported.\n *\n * Wrapping the original component with `withNotices` encapsulates the component\n * with the additional props `noticeOperations` and `noticeUI`.\n *\n * ```jsx\n * import { withNotices, Button } from '@wordpress/components';\n *\n * const MyComponentWithNotices = withNotices(\n * \t( { noticeOperations, noticeUI } ) => {\n * \t\tconst addError = () =>\n * \t\t\tnoticeOperations.createErrorNotice( 'Error message' );\n * \t\treturn (\n * \t\t\t<div>\n * \t\t\t\t{ noticeUI }\n * \t\t\t\t<Button variant=\"secondary\" onClick={ addError }>\n * \t\t\t\t\tAdd error\n * \t\t\t\t</Button>\n * \t\t\t</div>\n * \t\t);\n * \t}\n * );\n * ```\n *\n * @param OriginalComponent Original component.\n *\n * @return Wrapped component.\n */\nexport default createHigherOrderComponent(OriginalComponent => {\n function Component(props, ref) {\n const [noticeList, setNoticeList] = useState([]);\n const noticeOperations = useMemo(() => {\n const createNotice = notice => {\n const noticeToAdd = notice.id ? notice : {\n ...notice,\n id: uuid()\n };\n setNoticeList(current => [...current, noticeToAdd]);\n };\n return {\n createNotice,\n createErrorNotice: msg => {\n // @ts-expect-error TODO: Missing `id`, potentially a bug\n createNotice({\n status: 'error',\n content: msg\n });\n },\n removeNotice: id => {\n setNoticeList(current => current.filter(notice => notice.id !== id));\n },\n removeAllNotices: () => {\n setNoticeList([]);\n }\n };\n }, []);\n const propsOut = {\n ...props,\n noticeList,\n noticeOperations,\n noticeUI: noticeList.length > 0 && /*#__PURE__*/_jsx(NoticeList, {\n className: \"components-with-notices-ui\",\n notices: noticeList,\n onRemove: noticeOperations.removeNotice\n })\n };\n return isForwardRef ? /*#__PURE__*/_jsx(OriginalComponent, {\n ...propsOut,\n ref: ref\n }) : /*#__PURE__*/_jsx(OriginalComponent, {\n ...propsOut\n });\n }\n let isForwardRef;\n // @ts-expect-error - `render` will only be present when OriginalComponent was wrapped with forwardRef().\n const {\n render\n } = OriginalComponent;\n // Returns a forwardRef if OriginalComponent appears to be a forwardRef.\n if (typeof render === 'function') {\n isForwardRef = true;\n return forwardRef(Component);\n }\n return Component;\n}, 'withNotices');"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2B;AAK3B,qBAA8C;AAC9C,qBAA2C;AAK3C,kBAAuB;AACvB,yBAA4B;AA8B5B,IAAO,2BAAQ,2CAA2B,uBAAqB;AAC7D,WAAS,UAAU,OAAO,KAAK;AAC7B,UAAM,CAAC,YAAY,aAAa,QAAI,yBAAS,CAAC,CAAC;AAC/C,UAAM,uBAAmB,wBAAQ,MAAM;AACrC,YAAM,eAAe,YAAU;AAC7B,cAAM,cAAc,OAAO,KAAK,SAAS;AAAA,UACvC,GAAG;AAAA,UACH,QAAI,YAAAA,IAAK;AAAA,QACX;AACA,sBAAc,aAAW,CAAC,GAAG,SAAS,WAAW,CAAC;AAAA,MACpD;AACA,aAAO;AAAA,QACL;AAAA,QACA,mBAAmB,SAAO;AAExB,uBAAa;AAAA,YACX,QAAQ;AAAA,YACR,SAAS;AAAA,UACX,CAAC;AAAA,QACH;AAAA,QACA,cAAc,QAAM;AAClB,wBAAc,aAAW,QAAQ,OAAO,YAAU,OAAO,OAAO,EAAE,CAAC;AAAA,QACrE;AAAA,QACA,kBAAkB,MAAM;AACtB,wBAAc,CAAC,CAAC;AAAA,QAClB;AAAA,MACF;AAAA,IACF,GAAG,CAAC,CAAC;AACL,UAAM,WAAW;AAAA,MACf,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,UAAU,WAAW,SAAS,KAAkB,uCAAAC,KAAK,YAAAC,SAAY;AAAA,QAC/D,WAAW;AAAA,QACX,SAAS;AAAA,QACT,UAAU,iBAAiB;AAAA,MAC7B,CAAC;AAAA,IACH;AACA,WAAO,eAA4B,uCAAAD,KAAK,mBAAmB;AAAA,MACzD,GAAG;AAAA,MACH;AAAA,IACF,CAAC,IAAiB,uCAAAA,KAAK,mBAAmB;AAAA,MACxC,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,MAAI;AAEJ,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AAEJ,MAAI,OAAO,WAAW,YAAY;AAChC,mBAAe;AACf,eAAO,2BAAW,SAAS;AAAA,EAC7B;AACA,SAAO;AACT,GAAG,aAAa;",
6
6
  "names": ["uuid", "_jsx", "NoticeList"]
7
7
  }
@@ -96,39 +96,42 @@ function InputBase(props, ref) {
96
96
  }
97
97
  };
98
98
  }, [__next40pxDefaultSize, size]);
99
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_input_control_styles.Root, {
100
- ...restProps,
101
- ...getUIFlexProps(labelPosition),
102
- className,
103
- gap: 2,
104
- ref,
105
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.default, {
106
- className: "components-input-control__label",
107
- hideLabelFromVision,
108
- labelPosition,
109
- htmlFor: id,
110
- children: label
111
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_input_control_styles.Container, {
112
- __unstableInputWidth,
113
- className: "components-input-control__container",
114
- disabled,
115
- hideLabel,
116
- labelPosition,
117
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_context.ContextSystemProvider, {
118
- value: prefixSuffixContextValue,
119
- children: [prefix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_control_styles.Prefix, {
120
- className: "components-input-control__prefix",
121
- children: prefix
122
- }), children, suffix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_control_styles.Suffix, {
123
- className: "components-input-control__suffix",
124
- children: suffix
125
- })]
126
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_backdrop.default, {
99
+ return (
100
+ // @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions.
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_input_control_styles.Root, {
102
+ ...restProps,
103
+ ...getUIFlexProps(labelPosition),
104
+ className,
105
+ gap: 2,
106
+ ref,
107
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.default, {
108
+ className: "components-input-control__label",
109
+ hideLabelFromVision,
110
+ labelPosition,
111
+ htmlFor: id,
112
+ children: label
113
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_input_control_styles.Container, {
114
+ __unstableInputWidth,
115
+ className: "components-input-control__container",
127
116
  disabled,
128
- isBorderless
117
+ hideLabel,
118
+ labelPosition,
119
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_context.ContextSystemProvider, {
120
+ value: prefixSuffixContextValue,
121
+ children: [prefix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_control_styles.Prefix, {
122
+ className: "components-input-control__prefix",
123
+ children: prefix
124
+ }), children, suffix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_control_styles.Suffix, {
125
+ className: "components-input-control__suffix",
126
+ children: suffix
127
+ })]
128
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_backdrop.default, {
129
+ disabled,
130
+ isBorderless
131
+ })]
129
132
  })]
130
- })]
131
- });
133
+ })
134
+ );
132
135
  }
133
136
  var input_base_default = (0, import_context.contextConnect)(InputBase, "InputBase");
134
137
  //# sourceMappingURL=input-base.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/input-control/input-base.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Backdrop from './backdrop';\nimport Label from './label';\nimport { Container, Root, Prefix, Suffix } from './styles/input-control-styles';\nimport { ContextSystemProvider, contextConnect, useContextSystem } from '../context';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction useUniqueId(idProp) {\n const instanceId = useInstanceId(InputBase);\n const id = `input-base-control-${instanceId}`;\n return idProp || id;\n}\n\n// Adapter to map props for the new ui/flex component.\nfunction getUIFlexProps(labelPosition) {\n const props = {};\n switch (labelPosition) {\n case 'top':\n props.direction = 'column';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'bottom':\n props.direction = 'column-reverse';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'edge':\n props.justify = 'space-between';\n break;\n }\n return props;\n}\nfunction InputBase(props, ref) {\n const {\n __next40pxDefaultSize,\n __unstableInputWidth,\n children,\n className,\n disabled = false,\n hideLabelFromVision = false,\n labelPosition,\n id: idProp,\n isBorderless = false,\n label,\n prefix,\n size = 'default',\n suffix,\n ...restProps\n } = useDeprecated36pxDefaultSizeProp(useContextSystem(props, 'InputBase'));\n const id = useUniqueId(idProp);\n const hideLabel = hideLabelFromVision || !label;\n const prefixSuffixContextValue = useMemo(() => {\n return {\n InputControlPrefixWrapper: {\n __next40pxDefaultSize,\n size\n },\n InputControlSuffixWrapper: {\n __next40pxDefaultSize,\n size\n }\n };\n }, [__next40pxDefaultSize, size]);\n return /*#__PURE__*/_jsxs(Root, {\n ...restProps,\n ...getUIFlexProps(labelPosition),\n className: className,\n gap: 2,\n ref: ref,\n children: [/*#__PURE__*/_jsx(Label, {\n className: \"components-input-control__label\",\n hideLabelFromVision: hideLabelFromVision,\n labelPosition: labelPosition,\n htmlFor: id,\n children: label\n }), /*#__PURE__*/_jsxs(Container, {\n __unstableInputWidth: __unstableInputWidth,\n className: \"components-input-control__container\",\n disabled: disabled,\n hideLabel: hideLabel,\n labelPosition: labelPosition,\n children: [/*#__PURE__*/_jsxs(ContextSystemProvider, {\n value: prefixSuffixContextValue,\n children: [prefix && /*#__PURE__*/_jsx(Prefix, {\n className: \"components-input-control__prefix\",\n children: prefix\n }), children, suffix && /*#__PURE__*/_jsx(Suffix, {\n className: \"components-input-control__suffix\",\n children: suffix\n })]\n }), /*#__PURE__*/_jsx(Backdrop, {\n disabled: disabled,\n isBorderless: isBorderless\n })]\n })]\n });\n}\n\n/**\n * `InputBase` is an internal component used to style the standard borders for an input,\n * as well as handle the layout for prefix/suffix elements.\n */\nexport default contextConnect(InputBase, 'InputBase');"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAA8B;AAC9B,qBAAwB;AAKxB,sBAAqB;AACrB,mBAAkB;AAClB,kCAAgD;AAChD,qBAAwE;AACxE,kCAAiD;AACjD,yBAA2C;AAC3C,SAAS,YAAY,QAAQ;AAC3B,QAAM,iBAAa,8BAAc,SAAS;AAC1C,QAAM,KAAK,sBAAsB,UAAU;AAC3C,SAAO,UAAU;AACnB;AAGA,SAAS,eAAe,eAAe;AACrC,QAAM,QAAQ,CAAC;AACf,UAAQ,eAAe;AAAA,IACrB,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,UAAU;AAChB;AAAA,EACJ;AACA,SAAO;AACT;AACA,SAAS,UAAU,OAAO,KAAK;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,sBAAsB;AAAA,IACtB;AAAA,IACA,IAAI;AAAA,IACJ,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,GAAG;AAAA,EACL,QAAI,kEAAiC,iCAAiB,OAAO,WAAW,CAAC;AACzE,QAAM,KAAK,YAAY,MAAM;AAC7B,QAAM,YAAY,uBAAuB,CAAC;AAC1C,QAAM,+BAA2B,wBAAQ,MAAM;AAC7C,WAAO;AAAA,MACL,2BAA2B;AAAA,QACzB;AAAA,QACA;AAAA,MACF;AAAA,MACA,2BAA2B;AAAA,QACzB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAC,uBAAuB,IAAI,CAAC;AAChC,SAAoB,uCAAAA,MAAM,kCAAM;AAAA,IAC9B,GAAG;AAAA,IACH,GAAG,eAAe,aAAa;AAAA,IAC/B;AAAA,IACA,KAAK;AAAA,IACL;AAAA,IACA,UAAU,CAAc,uCAAAC,KAAK,aAAAC,SAAO;AAAA,MAClC,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,IACZ,CAAC,GAAgB,uCAAAF,MAAM,uCAAW;AAAA,MAChC;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,CAAc,uCAAAA,MAAM,sCAAuB;AAAA,QACnD,OAAO;AAAA,QACP,UAAU,CAAC,UAAuB,uCAAAC,KAAK,oCAAQ;AAAA,UAC7C,WAAW;AAAA,UACX,UAAU;AAAA,QACZ,CAAC,GAAG,UAAU,UAAuB,uCAAAA,KAAK,oCAAQ;AAAA,UAChD,WAAW;AAAA,UACX,UAAU;AAAA,QACZ,CAAC,CAAC;AAAA,MACJ,CAAC,GAAgB,uCAAAA,KAAK,gBAAAE,SAAU;AAAA,QAC9B;AAAA,QACA;AAAA,MACF,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AAMA,IAAO,yBAAQ,+BAAe,WAAW,WAAW;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Backdrop from './backdrop';\nimport Label from './label';\nimport { Container, Root, Prefix, Suffix } from './styles/input-control-styles';\nimport { ContextSystemProvider, contextConnect, useContextSystem } from '../context';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction useUniqueId(idProp) {\n const instanceId = useInstanceId(InputBase);\n const id = `input-base-control-${instanceId}`;\n return idProp || id;\n}\n\n// Adapter to map props for the new ui/flex component.\nfunction getUIFlexProps(labelPosition) {\n const props = {};\n switch (labelPosition) {\n case 'top':\n props.direction = 'column';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'bottom':\n props.direction = 'column-reverse';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'edge':\n props.justify = 'space-between';\n break;\n }\n return props;\n}\nfunction InputBase(props, ref) {\n const {\n __next40pxDefaultSize,\n __unstableInputWidth,\n children,\n className,\n disabled = false,\n hideLabelFromVision = false,\n labelPosition,\n id: idProp,\n isBorderless = false,\n label,\n prefix,\n size = 'default',\n suffix,\n ...restProps\n } = useDeprecated36pxDefaultSizeProp(useContextSystem(props, 'InputBase'));\n const id = useUniqueId(idProp);\n const hideLabel = hideLabelFromVision || !label;\n const prefixSuffixContextValue = useMemo(() => {\n return {\n InputControlPrefixWrapper: {\n __next40pxDefaultSize,\n size\n },\n InputControlSuffixWrapper: {\n __next40pxDefaultSize,\n size\n }\n };\n }, [__next40pxDefaultSize, size]);\n return (\n /*#__PURE__*/\n // @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions.\n _jsxs(Root, {\n ...restProps,\n ...getUIFlexProps(labelPosition),\n className: className,\n gap: 2,\n ref: ref,\n children: [/*#__PURE__*/_jsx(Label, {\n className: \"components-input-control__label\",\n hideLabelFromVision: hideLabelFromVision,\n labelPosition: labelPosition,\n htmlFor: id,\n children: label\n }), /*#__PURE__*/_jsxs(Container, {\n __unstableInputWidth: __unstableInputWidth,\n className: \"components-input-control__container\",\n disabled: disabled,\n hideLabel: hideLabel,\n labelPosition: labelPosition,\n children: [/*#__PURE__*/_jsxs(ContextSystemProvider, {\n value: prefixSuffixContextValue,\n children: [prefix && /*#__PURE__*/_jsx(Prefix, {\n className: \"components-input-control__prefix\",\n children: prefix\n }), children, suffix && /*#__PURE__*/_jsx(Suffix, {\n className: \"components-input-control__suffix\",\n children: suffix\n })]\n }), /*#__PURE__*/_jsx(Backdrop, {\n disabled: disabled,\n isBorderless: isBorderless\n })]\n })]\n })\n );\n}\n\n/**\n * `InputBase` is an internal component used to style the standard borders for an input,\n * as well as handle the layout for prefix/suffix elements.\n */\nexport default contextConnect(InputBase, 'InputBase');"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAA8B;AAC9B,qBAAwB;AAKxB,sBAAqB;AACrB,mBAAkB;AAClB,kCAAgD;AAChD,qBAAwE;AACxE,kCAAiD;AACjD,yBAA2C;AAC3C,SAAS,YAAY,QAAQ;AAC3B,QAAM,iBAAa,8BAAc,SAAS;AAC1C,QAAM,KAAK,sBAAsB,UAAU;AAC3C,SAAO,UAAU;AACnB;AAGA,SAAS,eAAe,eAAe;AACrC,QAAM,QAAQ,CAAC;AACf,UAAQ,eAAe;AAAA,IACrB,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,UAAU;AAChB;AAAA,EACJ;AACA,SAAO;AACT;AACA,SAAS,UAAU,OAAO,KAAK;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,sBAAsB;A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A,IAAO,yBAAQ,+BAAe,WAAW,WAAW;",
6
6
  "names": ["_jsxs", "_jsx", "Label", "Backdrop"]
7
7
  }
@@ -50,14 +50,13 @@ function ResponsiveWrapper({
50
50
  if (naturalWidth && naturalHeight) {
51
51
  aspectRatio = `${naturalWidth} / ${naturalHeight}`;
52
52
  }
53
- const ch = children;
54
53
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TagName, {
55
54
  className: "components-responsive-wrapper",
56
55
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
57
- children: (0, import_element.cloneElement)(ch, {
58
- className: (0, import_clsx.default)("components-responsive-wrapper__content", ch.props.className),
56
+ children: (0, import_element.cloneElement)(children, {
57
+ className: (0, import_clsx.default)("components-responsive-wrapper__content", children.props.className),
59
58
  style: {
60
- ...ch.props.style,
59
+ ...children.props.style,
61
60
  aspectRatio
62
61
  }
63
62
  })
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/responsive-wrapper/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneElement, Children } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * A wrapper component that maintains its aspect ratio when resized.\n *\n * ```jsx\n * import { ResponsiveWrapper } from '@wordpress/components';\n *\n * const MyResponsiveWrapper = () => (\n * \t<ResponsiveWrapper naturalWidth={ 2000 } naturalHeight={ 680 }>\n * \t\t<img\n * \t\t\tsrc=\"https://s.w.org/style/images/about/WordPress-logotype-standard.png\"\n * \t\t\talt=\"WordPress\"\n * \t\t/>\n * \t</ResponsiveWrapper>\n * );\n * ```\n */\nfunction ResponsiveWrapper({\n naturalWidth,\n naturalHeight,\n children,\n isInline = false\n}) {\n if (Children.count(children) !== 1) {\n return null;\n }\n const TagName = isInline ? 'span' : 'div';\n let aspectRatio;\n if (naturalWidth && naturalHeight) {\n aspectRatio = `${naturalWidth} / ${naturalHeight}`;\n }\n const ch = children;\n return /*#__PURE__*/_jsx(TagName, {\n className: \"components-responsive-wrapper\",\n children: /*#__PURE__*/_jsx(\"div\", {\n children: cloneElement(ch, {\n className: clsx('components-responsive-wrapper__content', ch.props.className),\n style: {\n ...ch.props.style,\n aspectRatio\n }\n })\n })\n });\n}\nexport default ResponsiveWrapper;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAuC;AAKvC,yBAA4B;AAiB5B,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAG;AACD,MAAI,wBAAS,MAAM,QAAQ,MAAM,GAAG;AAClC,WAAO;AAAA,EACT;AACA,QAAM,UAAU,WAAW,SAAS;AACpC,MAAI;AACJ,MAAI,gBAAgB,eAAe;AACjC,kBAAc,GAAG,YAAY,MAAM,aAAa;AAAA,EAClD;AACA,QAAM,KAAK;AACX,SAAoB,uCAAAA,KAAK,SAAS;AAAA,IAChC,WAAW;AAAA,IACX,UAAuB,uCAAAA,KAAK,OAAO;AAAA,MACjC,cAAU,6BAAa,IAAI;AAAA,QACzB,eAAW,YAAAC,SAAK,0CAA0C,GAAG,MAAM,SAAS;AAAA,QAC5E,OAAO;AAAA,UACL,GAAG,GAAG,MAAM;AAAA,UACZ;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH;AACA,IAAO,6BAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneElement, Children } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * A wrapper component that maintains its aspect ratio when resized.\n *\n * ```jsx\n * import { ResponsiveWrapper } from '@wordpress/components';\n *\n * const MyResponsiveWrapper = () => (\n * \t<ResponsiveWrapper naturalWidth={ 2000 } naturalHeight={ 680 }>\n * \t\t<img\n * \t\t\tsrc=\"https://s.w.org/style/images/about/WordPress-logotype-standard.png\"\n * \t\t\talt=\"WordPress\"\n * \t\t/>\n * \t</ResponsiveWrapper>\n * );\n * ```\n */\nfunction ResponsiveWrapper({\n naturalWidth,\n naturalHeight,\n children,\n isInline = false\n}) {\n if (Children.count(children) !== 1) {\n return null;\n }\n const TagName = isInline ? 'span' : 'div';\n let aspectRatio;\n if (naturalWidth && naturalHeight) {\n aspectRatio = `${naturalWidth} / ${naturalHeight}`;\n }\n return /*#__PURE__*/_jsx(TagName, {\n className: \"components-responsive-wrapper\",\n children: /*#__PURE__*/_jsx(\"div\", {\n children: cloneElement(children, {\n className: clsx('components-responsive-wrapper__content', children.props.className),\n style: {\n ...children.props.style,\n aspectRatio\n }\n })\n })\n });\n}\nexport default ResponsiveWrapper;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAuC;AAKvC,yBAA4B;AAiB5B,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAG;AACD,MAAI,wBAAS,MAAM,QAAQ,MAAM,GAAG;AAClC,WAAO;AAAA,EACT;AACA,QAAM,UAAU,WAAW,SAAS;AACpC,MAAI;AACJ,MAAI,gBAAgB,eAAe;AACjC,kBAAc,GAAG,YAAY,MAAM,aAAa;AAAA,EAClD;AACA,SAAoB,uCAAAA,KAAK,SAAS;AAAA,IAChC,WAAW;AAAA,IACX,UAAuB,uCAAAA,KAAK,OAAO;AAAA,MACjC,cAAU,6BAAa,UAAU;AAAA,QAC/B,eAAW,YAAAC,SAAK,0CAA0C,SAAS,MAAM,SAAS;AAAA,QAClF,OAAO;AAAA,UACL,GAAG,SAAS,MAAM;AAAA,UAClB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH;AACA,IAAO,6BAAQ;",
6
6
  "names": ["_jsx", "clsx"]
7
7
  }
@@ -93,8 +93,7 @@ function UnforwardedTooltip(props, ref) {
93
93
  render: children
94
94
  }) : children;
95
95
  }
96
- function addDescribedById(el) {
97
- const element = el;
96
+ function addDescribedById(element) {
98
97
  return describedById && mounted && element.props["aria-describedby"] === void 0 && element.props["aria-label"] !== text ? (0, import_element.cloneElement)(element, {
99
98
  "aria-describedby": describedById
100
99
  }) : element;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/tooltip/index.tsx"],
4
- "sourcesContent": ["import * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Children, useContext, forwardRef, cloneElement } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\nimport { TooltipInternalContext } from './context';\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const TOOLTIP_DELAY = 700;\nconst CONTEXT_VALUE = {\n isNestedInTooltip: true\n};\nfunction UnforwardedTooltip(props, ref) {\n const {\n children,\n className,\n delay = TOOLTIP_DELAY,\n hideOnClick = true,\n placement,\n position,\n shortcut,\n text,\n ...restProps\n } = props;\n const {\n isNestedInTooltip\n } = useContext(TooltipInternalContext);\n const baseId = useInstanceId(Tooltip, 'tooltip');\n const describedById = text || shortcut ? baseId : undefined;\n const isOnlyChild = Children.count(children) === 1;\n // console error if more than one child element is added\n if (!isOnlyChild) {\n if ('development' === process.env.NODE_ENV) {\n // eslint-disable-next-line no-console\n console.error('wp-components.Tooltip should be called with only a single child element.');\n }\n }\n\n // Compute tooltip's placement:\n // - give priority to `placement` prop, if defined\n // - otherwise, compute it from the legacy `position` prop (if defined)\n // - finally, fallback to the default placement: 'top'\n let computedPlacement;\n if (placement !== undefined) {\n computedPlacement = placement;\n } else if (position !== undefined) {\n computedPlacement = positionToPlacement(position);\n deprecated('`position` prop in wp.components.tooltip', {\n since: '6.4',\n alternative: '`placement` prop'\n });\n }\n computedPlacement = computedPlacement || 'top';\n const tooltipStore = Ariakit.useTooltipStore({\n placement: computedPlacement,\n showTimeout: delay\n });\n const mounted = Ariakit.useStoreState(tooltipStore, 'mounted');\n if (isNestedInTooltip) {\n return isOnlyChild ? /*#__PURE__*/_jsx(Ariakit.Role, {\n ...restProps,\n render: children\n }) : children;\n }\n\n // TODO: this is a temporary workaround to minimize the effects of the\n // Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to\n // the tooltip anchor anymore since 0.4.0, so we need to add it manually.\n // The `aria-describedby` attribute is added only if the anchor doesn't have\n // one already, and if the tooltip text is not the same as the anchor's\n // `aria-label`\n // See: https://github.com/WordPress/gutenberg/pull/64066\n // See: https://github.com/WordPress/gutenberg/pull/65989\n function addDescribedById(el) {\n const element = el;\n return describedById && mounted && element.props['aria-describedby'] === undefined && element.props['aria-label'] !== text ? cloneElement(element, {\n 'aria-describedby': describedById\n }) : element;\n }\n return /*#__PURE__*/_jsxs(TooltipInternalContext.Provider, {\n value: CONTEXT_VALUE,\n children: [/*#__PURE__*/_jsx(Ariakit.TooltipAnchor, {\n onClick: hideOnClick ? tooltipStore.hide : undefined,\n store: tooltipStore,\n render: isOnlyChild ? addDescribedById(children) : undefined,\n ref: ref,\n children: isOnlyChild ? undefined : children\n }), isOnlyChild && (text || shortcut) && /*#__PURE__*/_jsxs(Ariakit.Tooltip, {\n ...restProps,\n className: clsx('components-tooltip', className),\n unmountOnHide: true,\n gutter: 4,\n id: describedById,\n overflowPadding: 0.5,\n store: tooltipStore,\n children: [text, shortcut && /*#__PURE__*/_jsx(Shortcut, {\n className: text ? 'components-tooltip__shortcut' : '',\n shortcut: shortcut\n })]\n })]\n });\n}\nexport const Tooltip = forwardRef(UnforwardedTooltip);\nex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;AAAA,IACV,CAAC,IAAI;AAAA,EACP;AAUA,WAAS,iBAAiB,IAAI;AAC5B,UAAM,UAAU;AAChB,WAAO,iBAAiB,WAAW,QAAQ,MAAM,kBAAkB,MAAM,UAAa,QAAQ,MAAM,YAAY,MAAM,WAAO,6BAAa,SAAS;AAAA,MACjJ,oBAAoB;AAAA,IACtB,CAAC,IAAI;AAAA,EACP;AACA,SAAoB,uCAAAC,MAAM,sCAAuB,UAAU;AAAA,IACzD,OAAO;AAAA,IACP,UAAU,CAAc,uCAAAD,KAAa,uBAAe;AAAA,MAClD,SAAS,cAAc,aAAa,OAAO;AAAA,MAC3C,OAAO;AAAA,MACP,QAAQ,cAAc,iBAAiB,QAAQ,IAAI;AAAA,MACnD;AAAA,MACA,UAAU,cAAc,SAAY;AAAA,IACtC,CAAC,GAAG,gBAAgB,QAAQ,aAA0B,uCAAAC,MAAc,iBAAS;AAAA,MAC3E,GAAG;AAAA,MACH,eAAW,YAAAC,SAAK,sBAAsB,SAAS;AAAA,MAC/C,eAAe;AAAA,MACf,QAAQ;AAAA,MACR,IAAI;AAAA,MACJ,iBAAiB;AAAA,MACjB,OAAO;AAAA,MACP,UAAU,CAAC,MAAM,YAAyB,uCAAAF,KAAK,gBAAAG,SAAU;AAAA,QACvD,WAAW,OAAO,iCAAiC;AAAA,QACnD;AAAA,MACF,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACO,IAAML,eAAU,2BAAW,kBAAkB;AACpD,IAAO,kBAAQA;",
4
+ "sourcesContent": ["import * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Children, useContext, forwardRef, cloneElement } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\nimport { TooltipInternalContext } from './context';\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const TOOLTIP_DELAY = 700;\nconst CONTEXT_VALUE = {\n isNestedInTooltip: true\n};\nfunction UnforwardedTooltip(props, ref) {\n const {\n children,\n className,\n delay = TOOLTIP_DELAY,\n hideOnClick = true,\n placement,\n position,\n shortcut,\n text,\n ...restProps\n } = props;\n const {\n isNestedInTooltip\n } = useContext(TooltipInternalContext);\n const baseId = useInstanceId(Tooltip, 'tooltip');\n const describedById = text || shortcut ? baseId : undefined;\n const isOnlyChild = Children.count(children) === 1;\n // console error if more than one child element is added\n if (!isOnlyChild) {\n if ('development' === process.env.NODE_ENV) {\n // eslint-disable-next-line no-console\n console.error('wp-components.Tooltip should be called with only a single child element.');\n }\n }\n\n // Compute tooltip's placement:\n // - give priority to `placement` prop, if defined\n // - otherwise, compute it from the legacy `position` prop (if defined)\n // - finally, fallback to the default placement: 'top'\n let computedPlacement;\n if (placement !== undefined) {\n computedPlacement = placement;\n } else if (position !== undefined) {\n computedPlacement = positionToPlacement(position);\n deprecated('`position` prop in wp.components.tooltip', {\n since: '6.4',\n alternative: '`placement` prop'\n });\n }\n computedPlacement = computedPlacement || 'top';\n const tooltipStore = Ariakit.useTooltipStore({\n placement: computedPlacement,\n showTimeout: delay\n });\n const mounted = Ariakit.useStoreState(tooltipStore, 'mounted');\n if (isNestedInTooltip) {\n return isOnlyChild ? /*#__PURE__*/_jsx(Ariakit.Role, {\n ...restProps,\n render: children\n }) : children;\n }\n\n // TODO: this is a temporary workaround to minimize the effects of the\n // Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to\n // the tooltip anchor anymore since 0.4.0, so we need to add it manually.\n // The `aria-describedby` attribute is added only if the anchor doesn't have\n // one already, and if the tooltip text is not the same as the anchor's\n // `aria-label`\n // See: https://github.com/WordPress/gutenberg/pull/64066\n // See: https://github.com/WordPress/gutenberg/pull/65989\n function addDescribedById(element) {\n return describedById && mounted && element.props['aria-describedby'] === undefined && element.props['aria-label'] !== text ? cloneElement(element, {\n 'aria-describedby': describedById\n }) : element;\n }\n return /*#__PURE__*/_jsxs(TooltipInternalContext.Provider, {\n value: CONTEXT_VALUE,\n children: [/*#__PURE__*/_jsx(Ariakit.TooltipAnchor, {\n onClick: hideOnClick ? tooltipStore.hide : undefined,\n store: tooltipStore,\n render: isOnlyChild ? addDescribedById(children) : undefined,\n ref: ref,\n children: isOnlyChild ? undefined : children\n }), isOnlyChild && (text || shortcut) && /*#__PURE__*/_jsxs(Ariakit.Tooltip, {\n ...restProps,\n className: clsx('components-tooltip', className),\n unmountOnHide: true,\n gutter: 4,\n id: describedById,\n overflowPadding: 0.5,\n store: tooltipStore,\n children: [text, shortcut && /*#__PURE__*/_jsx(Shortcut, {\n className: text ? 'components-tooltip__shortcut' : '',\n shortcut: shortcut\n })]\n })]\n });\n}\nexport const Tooltip = forwardRef(UnforwardedTooltip);\nexport default Tooltip;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA,cAAyB;AACzB,kBAAiB;AACjB,qBAA8B;AAC9B,qBAA+D;AAC/D,wBAAuB;AACvB,sBAAqB;AACrB,mBAAoC;AACpC,qBAAuC;AAKvC,yBAA2C;AACpC,IAAM,gBAAgB;AAC7B,IAAM,gBAAgB;AAAA,EACpB,mBAAmB;AACrB;AACA,SAAS,mBAAmB,OAAO,KAAK;AACtC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM;AAAA,IACJ;AAAA,EACF,QAAI,2BAAW,qCAAsB;AACrC,QAAM,aAAS,8BAAcA,UAAS,SAAS;AAC/C,QAAM,gBAAgB,QAAQ,WAAW,SAAS;AAClD,QAAM,cAAc,wBAAS,MAAM,QAAQ,MAAM;AAEjD,MAAI,CAAC,aAAa;AA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,UAAU,CAAC,MAAM,YAAyB,uCAAAF,KAAK,gBAAAG,SAAU;AAAA,QACvD,WAAW,OAAO,iCAAiC;AAAA,QACnD;AAAA,MACF,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACO,IAAML,eAAU,2BAAW,kBAAkB;AACpD,IAAO,kBAAQA;",
6
6
  "names": ["Tooltip", "deprecated", "_jsx", "_jsxs", "clsx", "Shortcut"]
7
7
  }
@@ -10,7 +10,7 @@ import { contextConnect } from "../../context/index.mjs";
10
10
  import { useBorderControlDropdown } from "./hook.mjs";
11
11
  import DropdownContentWrapper from "../../dropdown/dropdown-content-wrapper.mjs";
12
12
  import { isMultiplePaletteArray } from "../../color-palette/utils.mjs";
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  var getAriaLabelColorValue = (colorValue) => {
15
15
  return colorValue.replace(/^var\((.+)\)$/, "$1");
16
16
  };
@@ -99,8 +99,6 @@ var BorderControlDropdown = (props, forwardedRef) => {
99
99
  resetButtonWrapperClassName,
100
100
  size,
101
101
  __unstablePopoverProps,
102
- onToggle: onToggleProp,
103
- // Remove from `otherProps` to avoid type errors (native HTML `onToggle` vs `Dropdown` `onToggle`).
104
102
  ...otherProps
105
103
  } = useBorderControlDropdown(props);
106
104
  const {
@@ -129,38 +127,40 @@ var BorderControlDropdown = (props, forwardedRef) => {
129
127
  })
130
128
  })
131
129
  });
132
- const renderContent = () => /* @__PURE__ */ _jsxs(DropdownContentWrapper, {
133
- paddingSize: "medium",
134
- children: [/* @__PURE__ */ _jsxs(VStack, {
135
- className: popoverControlsClassName,
136
- spacing: 6,
137
- children: [/* @__PURE__ */ _jsx(ColorPalette, {
138
- className: popoverContentClassName,
139
- value: color,
140
- onChange: onColorChange,
141
- colors,
142
- disableCustomColors,
143
- __experimentalIsRenderedInSidebar,
144
- clearable: false,
145
- enableAlpha
146
- }), enableStyle && isStyleSettable && /* @__PURE__ */ _jsx(BorderControlStylePicker, {
147
- label: __("Style"),
148
- value: style,
149
- onChange: onStyleChange
130
+ const renderContent = () => /* @__PURE__ */ _jsx(_Fragment, {
131
+ children: /* @__PURE__ */ _jsxs(DropdownContentWrapper, {
132
+ paddingSize: "medium",
133
+ children: [/* @__PURE__ */ _jsxs(VStack, {
134
+ className: popoverControlsClassName,
135
+ spacing: 6,
136
+ children: [/* @__PURE__ */ _jsx(ColorPalette, {
137
+ className: popoverContentClassName,
138
+ value: color,
139
+ onChange: onColorChange,
140
+ colors,
141
+ disableCustomColors,
142
+ __experimentalIsRenderedInSidebar,
143
+ clearable: false,
144
+ enableAlpha
145
+ }), enableStyle && isStyleSettable && /* @__PURE__ */ _jsx(BorderControlStylePicker, {
146
+ label: __("Style"),
147
+ value: style,
148
+ onChange: onStyleChange
149
+ })]
150
+ }), /* @__PURE__ */ _jsx("div", {
151
+ className: resetButtonWrapperClassName,
152
+ children: /* @__PURE__ */ _jsx(Button, {
153
+ variant: "tertiary",
154
+ onClick: () => {
155
+ onReset();
156
+ },
157
+ disabled: !enableResetButton,
158
+ accessibleWhenDisabled: true,
159
+ __next40pxDefaultSize: true,
160
+ children: __("Reset")
161
+ })
150
162
  })]
151
- }), /* @__PURE__ */ _jsx("div", {
152
- className: resetButtonWrapperClassName,
153
- children: /* @__PURE__ */ _jsx(Button, {
154
- variant: "tertiary",
155
- onClick: () => {
156
- onReset();
157
- },
158
- disabled: !enableResetButton,
159
- accessibleWhenDisabled: true,
160
- __next40pxDefaultSize: true,
161
- children: __("Reset")
162
- })
163
- })]
163
+ })
164
164
  });
165
165
  return /* @__PURE__ */ _jsx(Dropdown, {
166
166
  renderToggle,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/border-control/border-control-dropdown/component.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { VStack } from '../../v-stack';\nimport { contextConnect } from '../../context';\nimport { useBorderControlDropdown } from './hook';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\nimport { isMultiplePaletteArray } from '../../color-palette/utils';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst getAriaLabelColorValue = colorValue => {\n // Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n return colorValue.replace(/^var\\((.+)\\)$/, '$1');\n};\nconst getColorObject = (colorValue, colors) => {\n if (!colorValue || !colors) {\n return;\n }\n if (isMultiplePaletteArray(colors)) {\n // Multiple origins\n let matchedColor;\n colors.some(origin => origin.colors.some(color => {\n if (color.color === colorValue) {\n matchedColor = color;\n return true;\n }\n return false;\n }));\n return matchedColor;\n }\n\n // Single origin\n return colors.find(color => color.color === colorValue);\n};\nconst getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => {\n if (isStyleEnabled) {\n if (colorObject) {\n const ariaLabelValue = getAriaLabelColorValue(colorObject.color);\n return style ? sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\". 3: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".'), colorObject.name, ariaLabelValue, style) : sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, ariaLabelValue);\n }\n if (colorValue) {\n const ariaLabelValue = getAriaLabelColorValue(colorValue);\n return style ? sprintf(\n // translators: 1: The color's hex code e.g.: \"#f00:\". 2: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".'), ariaLabelValue, style) : sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color and style picker. The currently selected color has a value of \"%s\".'), ariaLabelValue);\n }\n return __('Border color and style picker.');\n }\n if (colorObject) {\n return sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, getAriaLabelColorValue(colorObject.color));\n }\n if (colorValue) {\n return sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color has a value of \"%s\".'), getAriaLabelColorValue(colorValue));\n }\n return __('Border color picker.');\n};\nconst BorderControlDropdown = (props, forwardedRef) => {\n const {\n __experimentalIsRenderedInSidebar,\n border,\n colors,\n disableCustomColors,\n enableAlpha,\n enableStyle,\n indicatorClassName,\n indicatorWrapperClassName,\n isStyleSettable,\n onReset,\n onColorChange,\n onStyleChange,\n popoverContentClassName,\n popoverControlsClassName,\n resetButtonWrapperClassName,\n size,\n __unstablePopoverProps,\n onToggle: onToggleProp,\n // Remove from `otherProps` to avoid type errors (native HTML `onToggle` vs `Dropdown` `onToggle`).\n ...otherProps\n } = useBorderControlDropdown(props);\n const {\n color,\n style\n } = border || {};\n const colorObject = getColorObject(color, colors);\n const toggleAriaLabel = getToggleAriaLabel(color, colorObject, style, enableStyle);\n const enableResetButton = color || style && style !== 'none';\n const dropdownPosition = __experimentalIsRenderedInSidebar ? 'bottom left' : undefined;\n const renderToggle = ({\n onToggle\n }) => /*#__PURE__*/_jsx(Button, {\n onClick: onToggle,\n variant: \"tertiary\",\n \"aria-label\": toggleAriaLabel,\n tooltipPosition: dropdownPosition,\n label: __('Border color and style picker'),\n showTooltip: true,\n __next40pxDefaultSize: size === '__unstable-large',\n children: /*#__PURE__*/_jsx(\"span\", {\n className: indicatorWrapperClassName,\n children: /*#__PURE__*/_jsx(ColorIndicator, {\n className: indicatorClassName,\n colorValue: color\n })\n })\n });\n const renderContent = () => /*#__PURE__*/_jsxs(DropdownContentWrapper, {\n paddingSize: \"medium\",\n children: [/*#__PURE__*/_jsxs(VStack, {\n className: popoverControlsClassName,\n spacing: 6,\n children: [/*#__PURE__*/_jsx(ColorPalette, {\n className: popoverContentClassName,\n value: color,\n onChange: onColorChange,\n colors,\n disableCustomColors,\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n clearable: false,\n enableAlpha: enableAlpha\n }), enableStyle && isStyleSettable && /*#__PURE__*/_jsx(BorderControlStylePicker, {\n label: __('Style'),\n value: style,\n onChange: onStyleChange\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n className: resetButtonWrapperClassName,\n children: /*#__PURE__*/_jsx(Button, {\n variant: \"tertiary\",\n onClick: () => {\n onReset();\n },\n disabled: !enableResetButton,\n accessibleWhenDisabled: true,\n __next40pxDefaultSize: true,\n children: __('Reset')\n })\n })]\n });\n return /*#__PURE__*/_jsx(Dropdown, {\n renderToggle: renderToggle,\n renderContent: renderContent,\n popoverProps: {\n ...__unstablePopoverProps\n },\n ...otherProps,\n ref: forwardedRef\n });\n};\nconst ConnectedBorderControlDropdown = contextConnect(BorderControlDropdown, 'BorderControlDropdown');\nexport default ConnectedBorderControlDropdown;"],
5
- "mappings": ";AAOA,SAAS,IAAI,eAAe;AAK5B,OAAO,8BAA8B;AACrC,OAAO,YAAY;AACnB,OAAO,oBAAoB;AAC3B,OAAO,kBAAkB;AACzB,OAAO,cAAc;AACrB,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,OAAO,4BAA4B;AACnC,SAAS,8BAA8B;AACvC,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,yBAAyB,gBAAc;AAE3C,SAAO,WAAW,QAAQ,iBAAiB,IAAI;AACjD;AACA,IAAM,iBAAiB,CAAC,YAAY,WAAW;AAC7C,MAAI,CAAC,c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QACjB,OAAO;AAAA,QACP,UAAU;AAAA,MACZ,CAAC,CAAC;AAAA,IACJ,CAAC,GAAgB,qBAAK,OAAO;AAAA,MAC3B,WAAW;AAAA,MACX,UAAuB,qBAAK,QAAQ;AAAA,QAClC,SAAS;AAAA,QACT,SAAS,MAAM;AACb,kBAAQ;AAAA,QACV;AAAA,QACA,UAAU,CAAC;AAAA,QACX,wBAAwB;AAAA,QACxB,uBAAuB;AAAA,QACvB,UAAU,GAAG,OAAO;AAAA,MACtB,CAAC;AAAA,IACH,CAAC,CAAC;AAAA,EACJ,CAAC;AACD,SAAoB,qBAAK,UAAU;AAAA,IACjC;AAAA,IACA;AAAA,IACA,cAAc;AAAA,MACZ,GAAG;AAAA,IACL;AAAA,IACA,GAAG;AAAA,IACH,KAAK;AAAA,EACP,CAAC;AACH;AACA,IAAM,iCAAiC,eAAe,uBAAuB,uBAAuB;AACpG,IAAO,oBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { VStack } from '../../v-stack';\nimport { contextConnect } from '../../context';\nimport { useBorderControlDropdown } from './hook';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\nimport { isMultiplePaletteArray } from '../../color-palette/utils';\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst getAriaLabelColorValue = colorValue => {\n // Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n return colorValue.replace(/^var\\((.+)\\)$/, '$1');\n};\nconst getColorObject = (colorValue, colors) => {\n if (!colorValue || !colors) {\n return;\n }\n if (isMultiplePaletteArray(colors)) {\n // Multiple origins\n let matchedColor;\n colors.some(origin => origin.colors.some(color => {\n if (color.color === colorValue) {\n matchedColor = color;\n return true;\n }\n return false;\n }));\n return matchedColor;\n }\n\n // Single origin\n return colors.find(color => color.color === colorValue);\n};\nconst getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => {\n if (isStyleEnabled) {\n if (colorObject) {\n const ariaLabelValue = getAriaLabelColorValue(colorObject.color);\n return style ? sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\". 3: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".'), colorObject.name, ariaLabelValue, style) : sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, ariaLabelValue);\n }\n if (colorValue) {\n const ariaLabelValue = getAriaLabelColorValue(colorValue);\n return style ? sprintf(\n // translators: 1: The color's hex code e.g.: \"#f00:\". 2: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".'), ariaLabelValue, style) : sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color and style picker. The currently selected color has a value of \"%s\".'), ariaLabelValue);\n }\n return __('Border color and style picker.');\n }\n if (colorObject) {\n return sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, getAriaLabelColorValue(colorObject.color));\n }\n if (colorValue) {\n return sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color has a value of \"%s\".'), getAriaLabelColorValue(colorValue));\n }\n return __('Border color picker.');\n};\nconst BorderControlDropdown = (props, forwardedRef) => {\n const {\n __experimentalIsRenderedInSidebar,\n border,\n colors,\n disableCustomColors,\n enableAlpha,\n enableStyle,\n indicatorClassName,\n indicatorWrapperClassName,\n isStyleSettable,\n onReset,\n onColorChange,\n onStyleChange,\n popoverContentClassName,\n popoverControlsClassName,\n resetButtonWrapperClassName,\n size,\n __unstablePopoverProps,\n ...otherProps\n } = useBorderControlDropdown(props);\n const {\n color,\n style\n } = border || {};\n const colorObject = getColorObject(color, colors);\n const toggleAriaLabel = getToggleAriaLabel(color, colorObject, style, enableStyle);\n const enableResetButton = color || style && style !== 'none';\n const dropdownPosition = __experimentalIsRenderedInSidebar ? 'bottom left' : undefined;\n const renderToggle = ({\n onToggle\n }) => /*#__PURE__*/_jsx(Button, {\n onClick: onToggle,\n variant: \"tertiary\",\n \"aria-label\": toggleAriaLabel,\n tooltipPosition: dropdownPosition,\n label: __('Border color and style picker'),\n showTooltip: true,\n __next40pxDefaultSize: size === '__unstable-large',\n children: /*#__PURE__*/_jsx(\"span\", {\n className: indicatorWrapperClassName,\n children: /*#__PURE__*/_jsx(ColorIndicator, {\n className: indicatorClassName,\n colorValue: color\n })\n })\n });\n const renderContent = () => /*#__PURE__*/_jsx(_Fragment, {\n children: /*#__PURE__*/_jsxs(DropdownContentWrapper, {\n paddingSize: \"medium\",\n children: [/*#__PURE__*/_jsxs(VStack, {\n className: popoverControlsClassName,\n spacing: 6,\n children: [/*#__PURE__*/_jsx(ColorPalette, {\n className: popoverContentClassName,\n value: color,\n onChange: onColorChange,\n colors,\n disableCustomColors,\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n clearable: false,\n enableAlpha: enableAlpha\n }), enableStyle && isStyleSettable && /*#__PURE__*/_jsx(BorderControlStylePicker, {\n label: __('Style'),\n value: style,\n onChange: onStyleChange\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n className: resetButtonWrapperClassName,\n children: /*#__PURE__*/_jsx(Button, {\n variant: \"tertiary\",\n onClick: () => {\n onReset();\n },\n disabled: !enableResetButton,\n accessibleWhenDisabled: true,\n __next40pxDefaultSize: true,\n children: __('Reset')\n })\n })]\n })\n });\n return /*#__PURE__*/_jsx(Dropdown, {\n renderToggle: renderToggle,\n renderContent: renderContent,\n popoverProps: {\n ...__unstablePopoverProps\n },\n ...otherProps,\n ref: forwardedRef\n });\n};\nconst ConnectedBorderControlDropdown = contextConnect(BorderControlDropdown, 'BorderControlDropdown');\nexport default ConnectedBorderControlDropdown;"],
5
+ "mappings": ";AAOA,SAAS,IAAI,eAAe;AAK5B,OAAO,8BAA8B;AACrC,OAAO,YAAY;AACnB,OAAO,oBAAoB;AAC3B,OAAO,kBAAkB;AACzB,OAAO,cAAc;AACrB,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,OAAO,4BAA4B;AACnC,SAAS,8BAA8B;AACvC,SAAS,OAAO,MAAM,QAAQ,OAAO,YAAY,iBAAiB;AAClE,IAAM,yBAAyB,gBAAc;AAE3C,SAAO,WAAW,QAAQ,iBAAiB,IAAI;AACjD;AACA,IAAM,iBAAiB,CAAC,YAAY,WAAW;AAC7C,MAAI,CAAC,cAAc,CAAC,QAAQ;AAC1B;AAAA,EACF;AACA,MAAI,uBAAuB,MAAM,GAAG;AAElC,QAAI;AACJ,WAAO,KAAK,YAAU,OAAO,OAAO,KAAK,WAAS;AAChD,UAAI,MAAM,UAAU,YAAY;AAC9B,uBAAe;AACf,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,CAAC,CAAC;AACF,WAAO;AAAA,EACT;AAGA,SAAO,OAAO,KAAK,WAAS,MAAM,UAAU,UAAU;AACxD;AACA,IAAM,qBAAqB,CAAC,YAAY,aAAa,OAAO,mBAAmB;AAC7E,MAAI,gBAAgB;AAClB,QAAI,aAAa;AACf,YAAM,iBAAiB,uBAAuB,YAAY,KAAK;AAC/D,aAAO,QAAQ;AAAA;AAAA,QAEf,GAAG,iJAAiJ;AAAA,QAAG,YAAY;AAAA,QAAM;AAAA,QAAgB;AAAA,MAAK,IAAI;AAAA;AAAA,QAElM,GAAG,yGAAyG;AAAA,QAAG,YAAY;AA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