@wordpress/components 37.0.1-next.v.202607070741.0 → 38.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 (786) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +65 -1
  3. package/build/angle-picker-control/index.cjs +0 -1
  4. package/build/angle-picker-control/index.cjs.map +2 -2
  5. package/build/autocomplete/index.cjs +6 -4
  6. package/build/autocomplete/index.cjs.map +3 -3
  7. package/build/border-box-control/styles.cjs +9 -9
  8. package/build/border-box-control/styles.cjs.map +2 -2
  9. package/build/color-palette/styles.cjs +1 -1
  10. package/build/color-palette/styles.cjs.map +2 -2
  11. package/build/color-picker/component.cjs +14 -5
  12. package/build/color-picker/component.cjs.map +2 -2
  13. package/build/color-picker/hex-input.cjs +0 -1
  14. package/build/color-picker/hex-input.cjs.map +2 -2
  15. package/build/color-picker/input-with-slider.cjs +0 -1
  16. package/build/color-picker/input-with-slider.cjs.map +2 -2
  17. package/build/color-picker/picker.cjs +95 -23
  18. package/build/color-picker/picker.cjs.map +2 -2
  19. package/build/confirm-dialog/component.cjs +86 -4
  20. package/build/confirm-dialog/component.cjs.map +3 -3
  21. package/build/content-editable-control/docs-manifest.json +5 -0
  22. package/build/content-editable-control/index.cjs +181 -0
  23. package/build/content-editable-control/index.cjs.map +7 -0
  24. package/build/{theme → content-editable-control}/types.cjs +1 -1
  25. package/build/{theme → content-editable-control}/types.cjs.map +1 -1
  26. package/build/custom-select-control/index.cjs +1 -2
  27. package/build/custom-select-control/index.cjs.map +2 -2
  28. package/build/custom-select-control-v2/custom-select.cjs +0 -1
  29. package/build/custom-select-control-v2/custom-select.cjs.map +2 -2
  30. package/build/date-time/date-picker/styles.cjs +8 -8
  31. package/build/date-time/date-picker/styles.cjs.map +2 -2
  32. package/build/date-time/time-picker/index.cjs +0 -2
  33. package/build/date-time/time-picker/index.cjs.map +2 -2
  34. package/build/date-time/time-picker/time-input/index.cjs +0 -2
  35. package/build/date-time/time-picker/time-input/index.cjs.map +2 -2
  36. package/build/disabled/index.cjs +87 -4
  37. package/build/disabled/index.cjs.map +4 -4
  38. package/build/form-token-field/index.cjs +87 -2
  39. package/build/form-token-field/index.cjs.map +3 -3
  40. package/build/gradient-picker/index.cjs +26 -20
  41. package/build/gradient-picker/index.cjs.map +2 -2
  42. package/build/heading/hook.cjs +1 -1
  43. package/build/heading/hook.cjs.map +1 -1
  44. package/build/input-control/index.cjs +4 -14
  45. package/build/input-control/index.cjs.map +2 -2
  46. package/build/input-control/input-base.cjs +2 -6
  47. package/build/input-control/input-base.cjs.map +2 -2
  48. package/build/input-control/styles/input-control-styles.cjs +25 -39
  49. package/build/input-control/styles/input-control-styles.cjs.map +2 -2
  50. package/build/menu/group-label.cjs +2 -1
  51. package/build/menu/group-label.cjs.map +2 -2
  52. package/build/number-control/index.cjs +1 -11
  53. package/build/number-control/index.cjs.map +2 -2
  54. package/build/palette-edit/styles.cjs +9 -9
  55. package/build/palette-edit/styles.cjs.map +2 -2
  56. package/build/private-apis.cjs +3 -2
  57. package/build/private-apis.cjs.map +3 -3
  58. package/build/range-control/index.cjs +0 -2
  59. package/build/range-control/index.cjs.map +2 -2
  60. package/build/sandbox/index.cjs +96 -73
  61. package/build/sandbox/index.cjs.map +3 -3
  62. package/build/search-control/index.cjs +93 -11
  63. package/build/search-control/index.cjs.map +4 -4
  64. package/build/select-control/index.cjs +0 -2
  65. package/build/select-control/index.cjs.map +2 -2
  66. package/build/select-control/styles/select-control-styles.cjs +9 -16
  67. package/build/select-control/styles/select-control-styles.cjs.map +2 -2
  68. package/build/slot-fill/fill.cjs.map +2 -2
  69. package/build/spacer/hook.cjs +150 -14
  70. package/build/spacer/hook.cjs.map +4 -4
  71. package/build/toggle-group-control/toggle-group-control/component.cjs +91 -8
  72. package/build/toggle-group-control/toggle-group-control/component.cjs.map +4 -4
  73. package/build/toggle-group-control/toggle-group-control-option-base/component.cjs +98 -17
  74. package/build/toggle-group-control/toggle-group-control-option-base/component.cjs.map +4 -4
  75. package/build/tools-panel/tools-panel/component.cjs +6 -0
  76. package/build/tools-panel/tools-panel/component.cjs.map +2 -2
  77. package/build/tools-panel/tools-panel/hook.cjs +87 -11
  78. package/build/tools-panel/tools-panel/hook.cjs.map +4 -4
  79. package/build/tools-panel/tools-panel-header/component.cjs +87 -2
  80. package/build/tools-panel/tools-panel-header/component.cjs.map +3 -3
  81. package/build/tools-panel/tools-panel-header/hook.cjs +90 -20
  82. package/build/tools-panel/tools-panel-header/hook.cjs.map +4 -4
  83. package/build/tools-panel/tools-panel-item/hook.cjs +88 -9
  84. package/build/tools-panel/tools-panel-item/hook.cjs.map +4 -4
  85. package/build/unit-control/index.cjs +0 -1
  86. package/build/unit-control/index.cjs.map +2 -2
  87. package/build/utils/base-label.cjs +1 -1
  88. package/build/utils/base-label.cjs.map +2 -2
  89. package/build/utils/config-values.cjs +1 -3
  90. package/build/utils/config-values.cjs.map +2 -2
  91. package/build/utils/font-values.cjs +1 -1
  92. package/build/utils/font-values.cjs.map +1 -1
  93. package/build/validated-form-controls/components/content-editable-control.cjs +84 -0
  94. package/build/validated-form-controls/components/content-editable-control.cjs.map +7 -0
  95. package/build/validated-form-controls/components/index.cjs +2 -0
  96. package/build/validated-form-controls/components/index.cjs.map +2 -2
  97. package/build/validated-form-controls/components/input-control.cjs +0 -1
  98. package/build/validated-form-controls/components/input-control.cjs.map +2 -2
  99. package/build/validated-form-controls/components/number-control.cjs +0 -1
  100. package/build/validated-form-controls/components/number-control.cjs.map +2 -2
  101. package/build/validated-form-controls/control-with-error.cjs +4 -4
  102. package/build/validated-form-controls/control-with-error.cjs.map +2 -2
  103. package/build-module/angle-picker-control/index.mjs +0 -1
  104. package/build-module/angle-picker-control/index.mjs.map +2 -2
  105. package/build-module/autocomplete/index.mjs +8 -6
  106. package/build-module/autocomplete/index.mjs.map +2 -2
  107. package/build-module/border-box-control/styles.mjs +9 -9
  108. package/build-module/border-box-control/styles.mjs.map +2 -2
  109. package/build-module/color-palette/styles.mjs +1 -1
  110. package/build-module/color-palette/styles.mjs.map +2 -2
  111. package/build-module/color-picker/component.mjs +14 -5
  112. package/build-module/color-picker/component.mjs.map +2 -2
  113. package/build-module/color-picker/hex-input.mjs +0 -1
  114. package/build-module/color-picker/hex-input.mjs.map +2 -2
  115. package/build-module/color-picker/input-with-slider.mjs +0 -1
  116. package/build-module/color-picker/input-with-slider.mjs.map +2 -2
  117. package/build-module/color-picker/picker.mjs +96 -24
  118. package/build-module/color-picker/picker.mjs.map +2 -2
  119. package/build-module/confirm-dialog/component.mjs +86 -4
  120. package/build-module/confirm-dialog/component.mjs.map +3 -3
  121. package/build-module/content-editable-control/docs-manifest.json +5 -0
  122. package/build-module/content-editable-control/index.mjs +146 -0
  123. package/build-module/content-editable-control/index.mjs.map +7 -0
  124. package/build-module/custom-select-control/index.mjs +1 -2
  125. package/build-module/custom-select-control/index.mjs.map +2 -2
  126. package/build-module/custom-select-control-v2/custom-select.mjs +0 -1
  127. package/build-module/custom-select-control-v2/custom-select.mjs.map +2 -2
  128. package/build-module/date-time/date-picker/styles.mjs +8 -8
  129. package/build-module/date-time/date-picker/styles.mjs.map +2 -2
  130. package/build-module/date-time/time-picker/index.mjs +0 -2
  131. package/build-module/date-time/time-picker/index.mjs.map +2 -2
  132. package/build-module/date-time/time-picker/time-input/index.mjs +0 -2
  133. package/build-module/date-time/time-picker/time-input/index.mjs.map +2 -2
  134. package/build-module/disabled/index.mjs +87 -4
  135. package/build-module/disabled/index.mjs.map +3 -3
  136. package/build-module/form-token-field/index.mjs +88 -3
  137. package/build-module/form-token-field/index.mjs.map +3 -3
  138. package/build-module/gradient-picker/index.mjs +26 -20
  139. package/build-module/gradient-picker/index.mjs.map +2 -2
  140. package/build-module/heading/hook.mjs +1 -1
  141. package/build-module/heading/hook.mjs.map +1 -1
  142. package/build-module/input-control/index.mjs +4 -14
  143. package/build-module/input-control/index.mjs.map +2 -2
  144. package/build-module/input-control/input-base.mjs +2 -6
  145. package/build-module/input-control/input-base.mjs.map +2 -2
  146. package/build-module/input-control/styles/input-control-styles.mjs +25 -39
  147. package/build-module/input-control/styles/input-control-styles.mjs.map +2 -2
  148. package/build-module/menu/group-label.mjs +2 -1
  149. package/build-module/menu/group-label.mjs.map +2 -2
  150. package/build-module/number-control/index.mjs +1 -11
  151. package/build-module/number-control/index.mjs.map +2 -2
  152. package/build-module/palette-edit/styles.mjs +9 -9
  153. package/build-module/palette-edit/styles.mjs.map +2 -2
  154. package/build-module/private-apis.mjs +4 -3
  155. package/build-module/private-apis.mjs.map +2 -2
  156. package/build-module/range-control/index.mjs +0 -2
  157. package/build-module/range-control/index.mjs.map +2 -2
  158. package/build-module/sandbox/index.mjs +84 -72
  159. package/build-module/sandbox/index.mjs.map +2 -2
  160. package/build-module/search-control/index.mjs +93 -11
  161. package/build-module/search-control/index.mjs.map +3 -3
  162. package/build-module/select-control/index.mjs +0 -2
  163. package/build-module/select-control/index.mjs.map +2 -2
  164. package/build-module/select-control/styles/select-control-styles.mjs +9 -16
  165. package/build-module/select-control/styles/select-control-styles.mjs.map +2 -2
  166. package/build-module/slot-fill/fill.mjs.map +2 -2
  167. package/build-module/spacer/hook.mjs +140 -14
  168. package/build-module/spacer/hook.mjs.map +3 -3
  169. package/build-module/toggle-group-control/toggle-group-control/component.mjs +92 -9
  170. package/build-module/toggle-group-control/toggle-group-control/component.mjs.map +3 -3
  171. package/build-module/toggle-group-control/toggle-group-control-option-base/component.mjs +99 -18
  172. package/build-module/toggle-group-control/toggle-group-control-option-base/component.mjs.map +3 -3
  173. package/build-module/tools-panel/tools-panel/component.mjs +6 -0
  174. package/build-module/tools-panel/tools-panel/component.mjs.map +2 -2
  175. package/build-module/tools-panel/tools-panel/hook.mjs +87 -11
  176. package/build-module/tools-panel/tools-panel/hook.mjs.map +3 -3
  177. package/build-module/tools-panel/tools-panel-header/component.mjs +87 -2
  178. package/build-module/tools-panel/tools-panel-header/component.mjs.map +3 -3
  179. package/build-module/tools-panel/tools-panel-header/hook.mjs +90 -20
  180. package/build-module/tools-panel/tools-panel-header/hook.mjs.map +3 -3
  181. package/build-module/tools-panel/tools-panel-item/hook.mjs +89 -10
  182. package/build-module/tools-panel/tools-panel-item/hook.mjs.map +3 -3
  183. package/build-module/unit-control/index.mjs +0 -1
  184. package/build-module/unit-control/index.mjs.map +2 -2
  185. package/build-module/utils/base-label.mjs +1 -1
  186. package/build-module/utils/base-label.mjs.map +2 -2
  187. package/build-module/utils/config-values.mjs +1 -3
  188. package/build-module/utils/config-values.mjs.map +2 -2
  189. package/build-module/utils/font-values.mjs +1 -1
  190. package/build-module/utils/font-values.mjs.map +1 -1
  191. package/build-module/validated-form-controls/components/content-editable-control.mjs +49 -0
  192. package/build-module/validated-form-controls/components/content-editable-control.mjs.map +7 -0
  193. package/build-module/validated-form-controls/components/index.mjs +1 -0
  194. package/build-module/validated-form-controls/components/index.mjs.map +2 -2
  195. package/build-module/validated-form-controls/components/input-control.mjs +0 -1
  196. package/build-module/validated-form-controls/components/input-control.mjs.map +2 -2
  197. package/build-module/validated-form-controls/components/number-control.mjs +0 -1
  198. package/build-module/validated-form-controls/components/number-control.mjs.map +2 -2
  199. package/build-module/validated-form-controls/control-with-error.mjs +4 -4
  200. package/build-module/validated-form-controls/control-with-error.mjs.map +2 -2
  201. package/build-style/style-rtl.css +70 -81
  202. package/build-style/style.css +70 -81
  203. package/build-types/angle-picker-control/index.d.ts.map +1 -1
  204. package/build-types/autocomplete/autocompleter-ui.d.ts +1 -1
  205. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  206. package/build-types/autocomplete/index.d.ts +8 -4
  207. package/build-types/autocomplete/index.d.ts.map +1 -1
  208. package/build-types/border-box-control/border-box-control/component.d.ts +1 -3
  209. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  210. package/build-types/border-box-control/stories/index.story.d.ts +1 -3
  211. package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
  212. package/build-types/border-box-control/styles.d.ts.map +1 -1
  213. package/build-types/border-box-control/types.d.ts +1 -15
  214. package/build-types/border-box-control/types.d.ts.map +1 -1
  215. package/build-types/box-control/index.d.ts +1 -1
  216. package/build-types/box-control/index.d.ts.map +1 -1
  217. package/build-types/box-control/input-control.d.ts +3 -0
  218. package/build-types/box-control/input-control.d.ts.map +1 -0
  219. package/build-types/box-control/styles/box-control-styles.d.ts +4 -8
  220. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  221. package/build-types/box-control/types.d.ts +1 -8
  222. package/build-types/box-control/types.d.ts.map +1 -1
  223. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  224. package/build-types/calendar/date-range-calendar/index.d.ts +1 -1
  225. package/build-types/calendar/date-range-calendar/index.d.ts.map +1 -1
  226. package/build-types/calendar/utils/use-localization-props.d.ts +6 -2
  227. package/build-types/calendar/utils/use-localization-props.d.ts.map +1 -1
  228. package/build-types/card/context.d.ts +3 -0
  229. package/build-types/card/context.d.ts.map +1 -0
  230. package/build-types/card/styles.d.ts +3 -3
  231. package/build-types/card/styles.d.ts.map +1 -1
  232. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts +1 -1
  233. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -1
  234. package/build-types/circular-option-picker/circular-option-picker.d.ts +8 -13
  235. package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
  236. package/build-types/color-picker/component.d.ts.map +1 -1
  237. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  238. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  239. package/build-types/color-picker/picker.d.ts +17 -1
  240. package/build-types/color-picker/picker.d.ts.map +1 -1
  241. package/build-types/color-picker/styles.d.ts +3 -6
  242. package/build-types/color-picker/styles.d.ts.map +1 -1
  243. package/build-types/color-picker/types.d.ts +2 -0
  244. package/build-types/color-picker/types.d.ts.map +1 -1
  245. package/build-types/composite/legacy/stories/utils.d.ts.map +1 -1
  246. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  247. package/build-types/content-editable-control/index.d.ts +31 -0
  248. package/build-types/content-editable-control/index.d.ts.map +1 -0
  249. package/build-types/content-editable-control/stories/index.story.d.ts +13 -0
  250. package/build-types/content-editable-control/stories/index.story.d.ts.map +1 -0
  251. package/build-types/content-editable-control/test/index.d.ts +2 -0
  252. package/build-types/content-editable-control/test/index.d.ts.map +1 -0
  253. package/build-types/content-editable-control/types.d.ts +32 -0
  254. package/build-types/content-editable-control/types.d.ts.map +1 -0
  255. package/build-types/context/context-system-provider.d.ts +21 -2
  256. package/build-types/context/context-system-provider.d.ts.map +1 -1
  257. package/build-types/context/wordpress-component.d.ts +2 -1
  258. package/build-types/context/wordpress-component.d.ts.map +1 -1
  259. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +3 -2
  260. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  261. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +1 -1
  262. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  263. package/build-types/custom-gradient-picker/index.d.ts +1 -1
  264. package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
  265. package/build-types/custom-gradient-picker/serializer.d.ts +3 -3
  266. package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -1
  267. package/build-types/custom-select-control/index.d.ts.map +1 -1
  268. package/build-types/custom-select-control/types.d.ts +1 -8
  269. package/build-types/custom-select-control/types.d.ts.map +1 -1
  270. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  271. package/build-types/custom-select-control-v2/index.d.ts +2 -1
  272. package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
  273. package/build-types/custom-select-control-v2/item.d.ts.map +1 -1
  274. package/build-types/date-time/date/index.d.ts +23 -0
  275. package/build-types/date-time/date/index.d.ts.map +1 -0
  276. package/build-types/date-time/date/styles.d.ts +45 -0
  277. package/build-types/date-time/date/styles.d.ts.map +1 -0
  278. package/build-types/date-time/date/test/index.d.ts +2 -0
  279. package/build-types/date-time/date/test/index.d.ts.map +1 -0
  280. package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
  281. package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
  282. package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
  283. package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
  284. package/build-types/date-time/date-picker/index.d.ts +1 -1
  285. package/build-types/date-time/date-picker/index.d.ts.map +1 -1
  286. package/build-types/date-time/time/index.d.ts +27 -0
  287. package/build-types/date-time/time/index.d.ts.map +1 -0
  288. package/build-types/date-time/time/styles.d.ts +93 -0
  289. package/build-types/date-time/time/styles.d.ts.map +1 -0
  290. package/build-types/date-time/time/test/index.d.ts +2 -0
  291. package/build-types/date-time/time/test/index.d.ts.map +1 -0
  292. package/build-types/date-time/time/time-input/index.d.ts +4 -0
  293. package/build-types/date-time/time/time-input/index.d.ts.map +1 -0
  294. package/build-types/date-time/time/time-input/test/index.d.ts +2 -0
  295. package/build-types/date-time/time/time-input/test/index.d.ts.map +1 -0
  296. package/build-types/date-time/time/timezone.d.ts +7 -0
  297. package/build-types/date-time/time/timezone.d.ts.map +1 -0
  298. package/build-types/date-time/time-picker/index.d.ts +3 -2
  299. package/build-types/date-time/time-picker/index.d.ts.map +1 -1
  300. package/build-types/date-time/time-picker/styles.d.ts +4 -8
  301. package/build-types/date-time/time-picker/styles.d.ts.map +1 -1
  302. package/build-types/date-time/time-picker/time-input/index.d.ts +1 -1
  303. package/build-types/date-time/time-picker/time-input/index.d.ts.map +1 -1
  304. package/build-types/disabled/index.d.ts +4 -4
  305. package/build-types/disabled/index.d.ts.map +1 -1
  306. package/build-types/divider/styles.d.ts +10 -0
  307. package/build-types/divider/styles.d.ts.map +1 -0
  308. package/build-types/draggable/index.d.ts +1 -1
  309. package/build-types/draggable/index.d.ts.map +1 -1
  310. package/build-types/drop-zone/provider.d.ts +1 -1
  311. package/build-types/drop-zone/provider.d.ts.map +1 -1
  312. package/build-types/duotone-picker/color-list-picker/index.d.ts +1 -1
  313. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -1
  314. package/build-types/duotone-picker/custom-duotone-bar.d.ts +1 -1
  315. package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -1
  316. package/build-types/flex/styles.d.ts +17 -0
  317. package/build-types/flex/styles.d.ts.map +1 -0
  318. package/build-types/focal-point-picker/controls.d.ts +1 -1
  319. package/build-types/focal-point-picker/controls.d.ts.map +1 -1
  320. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +2 -4
  321. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
  322. package/build-types/font-size-picker/index.d.ts +12 -2
  323. package/build-types/font-size-picker/index.d.ts.map +1 -1
  324. package/build-types/font-size-picker/stories/e2e/index.story.d.ts +12 -1
  325. package/build-types/font-size-picker/stories/e2e/index.story.d.ts.map +1 -1
  326. package/build-types/font-size-picker/types.d.ts +2 -15
  327. package/build-types/font-size-picker/types.d.ts.map +1 -1
  328. package/build-types/form-token-field/index.d.ts.map +1 -1
  329. package/build-types/form-token-field/suggestions-list.d.ts +1 -1
  330. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  331. package/build-types/form-token-field/token.d.ts +1 -1
  332. package/build-types/form-token-field/token.d.ts.map +1 -1
  333. package/build-types/gradient-picker/index.d.ts.map +1 -1
  334. package/build-types/gradient-picker/stories/index.story.d.ts +1 -0
  335. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  336. package/build-types/gradient-picker/test/index.d.ts +2 -0
  337. package/build-types/gradient-picker/test/index.d.ts.map +1 -0
  338. package/build-types/gradient-picker/types.d.ts +19 -4
  339. package/build-types/gradient-picker/types.d.ts.map +1 -1
  340. package/build-types/guide/index.d.ts +1 -1
  341. package/build-types/guide/index.d.ts.map +1 -1
  342. package/build-types/guide/page-control.d.ts +1 -1
  343. package/build-types/guide/page-control.d.ts.map +1 -1
  344. package/build-types/higher-order/with-fallback-styles/index.d.ts +3 -3
  345. package/build-types/higher-order/with-fallback-styles/index.d.ts.map +1 -1
  346. package/build-types/input-control/index.d.ts +0 -1
  347. package/build-types/input-control/index.d.ts.map +1 -1
  348. package/build-types/input-control/input-base.d.ts.map +1 -1
  349. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  350. package/build-types/input-control/styles/input-control-styles.d.ts +1 -8
  351. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  352. package/build-types/input-control/types.d.ts +15 -29
  353. package/build-types/input-control/types.d.ts.map +1 -1
  354. package/build-types/keyboard-shortcuts/index.d.ts +1 -1
  355. package/build-types/keyboard-shortcuts/index.d.ts.map +1 -1
  356. package/build-types/menu/group-label.d.ts.map +1 -1
  357. package/build-types/menu-items-choice/index.d.ts +1 -1
  358. package/build-types/menu-items-choice/index.d.ts.map +1 -1
  359. package/build-types/mobile/image/constants.d.ts +5 -0
  360. package/build-types/mobile/image/constants.d.ts.map +1 -0
  361. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  362. package/build-types/navigation/back-button/index.d.ts +7 -0
  363. package/build-types/navigation/back-button/index.d.ts.map +1 -0
  364. package/build-types/navigation/constants.d.ts +3 -0
  365. package/build-types/navigation/constants.d.ts.map +1 -0
  366. package/build-types/navigation/context.d.ts +4 -0
  367. package/build-types/navigation/context.d.ts.map +1 -0
  368. package/build-types/navigation/group/context.d.ts +7 -0
  369. package/build-types/navigation/group/context.d.ts.map +1 -0
  370. package/build-types/navigation/group/index.d.ts +7 -0
  371. package/build-types/navigation/group/index.d.ts.map +1 -0
  372. package/build-types/navigation/index.d.ts +46 -0
  373. package/build-types/navigation/index.d.ts.map +1 -0
  374. package/build-types/navigation/item/base-content.d.ts +3 -0
  375. package/build-types/navigation/item/base-content.d.ts.map +1 -0
  376. package/build-types/navigation/item/base.d.ts +3 -0
  377. package/build-types/navigation/item/base.d.ts.map +1 -0
  378. package/build-types/navigation/item/index.d.ts +7 -0
  379. package/build-types/navigation/item/index.d.ts.map +1 -0
  380. package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
  381. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
  382. package/build-types/navigation/menu/context.d.ts +7 -0
  383. package/build-types/navigation/menu/context.d.ts.map +1 -0
  384. package/build-types/navigation/menu/index.d.ts +7 -0
  385. package/build-types/navigation/menu/index.d.ts.map +1 -0
  386. package/build-types/navigation/menu/menu-title-search.d.ts +3 -0
  387. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
  388. package/build-types/navigation/menu/menu-title.d.ts +3 -0
  389. package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
  390. package/build-types/navigation/menu/search-no-results-found.d.ts +3 -0
  391. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
  392. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
  393. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
  394. package/build-types/navigation/stories/index.story.d.ts +23 -0
  395. package/build-types/navigation/stories/index.story.d.ts.map +1 -0
  396. package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
  397. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
  398. package/build-types/navigation/stories/utils/default.d.ts +10 -0
  399. package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
  400. package/build-types/navigation/stories/utils/group.d.ts +10 -0
  401. package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
  402. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
  403. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
  404. package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
  405. package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
  406. package/build-types/navigation/stories/utils/search.d.ts +10 -0
  407. package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
  408. package/build-types/navigation/styles/navigation-styles.d.ts +55 -0
  409. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
  410. package/build-types/navigation/test/index.d.ts +2 -0
  411. package/build-types/navigation/test/index.d.ts.map +1 -0
  412. package/build-types/navigation/types.d.ts +266 -0
  413. package/build-types/navigation/types.d.ts.map +1 -0
  414. package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
  415. package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
  416. package/build-types/navigation/use-navigation-tree-nodes.d.ts +10 -0
  417. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
  418. package/build-types/navigation/utils.d.ts +3 -0
  419. package/build-types/navigation/utils.d.ts.map +1 -0
  420. package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts +1 -1
  421. package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts.map +1 -1
  422. package/build-types/notice/index.d.ts +1 -1
  423. package/build-types/notice/index.d.ts.map +1 -1
  424. package/build-types/notice/list.d.ts +1 -1
  425. package/build-types/notice/list.d.ts.map +1 -1
  426. package/build-types/number-control/index.d.ts +1 -2
  427. package/build-types/number-control/index.d.ts.map +1 -1
  428. package/build-types/number-control/stories/index.story.d.ts +1 -2
  429. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  430. package/build-types/number-control/types.d.ts +0 -7
  431. package/build-types/number-control/types.d.ts.map +1 -1
  432. package/build-types/palette-edit/index.d.ts +1 -1
  433. package/build-types/palette-edit/index.d.ts.map +1 -1
  434. package/build-types/private-apis.d.ts.map +1 -1
  435. package/build-types/query-controls/author-select.d.ts +1 -1
  436. package/build-types/query-controls/author-select.d.ts.map +1 -1
  437. package/build-types/range-control/index.d.ts +2 -4
  438. package/build-types/range-control/index.d.ts.map +1 -1
  439. package/build-types/range-control/styles/range-control-styles.d.ts +1 -2
  440. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  441. package/build-types/range-control/types.d.ts +2 -16
  442. package/build-types/range-control/types.d.ts.map +1 -1
  443. package/build-types/resizable-box/resize-tooltip/utils.d.ts +1 -1
  444. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  445. package/build-types/responsive-wrapper/index.d.ts +1 -1
  446. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  447. package/build-types/sandbox/index.d.ts +34 -0
  448. package/build-types/sandbox/index.d.ts.map +1 -1
  449. package/build-types/sandbox/types.d.ts +11 -0
  450. package/build-types/sandbox/types.d.ts.map +1 -1
  451. package/build-types/search-control/index.d.ts.map +1 -1
  452. package/build-types/search-control/types.d.ts +1 -1
  453. package/build-types/search-control/types.d.ts.map +1 -1
  454. package/build-types/select-control/index.d.ts.map +1 -1
  455. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  456. package/build-types/select-control/types.d.ts +9 -1
  457. package/build-types/select-control/types.d.ts.map +1 -1
  458. package/build-types/slot-fill/fill.d.ts.map +1 -1
  459. package/build-types/slot-fill/index.d.ts +1 -1
  460. package/build-types/slot-fill/index.d.ts.map +1 -1
  461. package/build-types/slot-fill/stories/index.story.d.ts +1 -6
  462. package/build-types/slot-fill/stories/index.story.d.ts.map +1 -1
  463. package/build-types/snackbar/list.d.ts +1 -1
  464. package/build-types/snackbar/list.d.ts.map +1 -1
  465. package/build-types/spacer/hook.d.ts +2 -4
  466. package/build-types/spacer/hook.d.ts.map +1 -1
  467. package/build-types/spacer/stories/index.story.d.ts +1 -6
  468. package/build-types/spacer/stories/index.story.d.ts.map +1 -1
  469. package/build-types/surface/styles.d.ts +11 -0
  470. package/build-types/surface/styles.d.ts.map +1 -0
  471. package/build-types/text/types.d.ts +4 -4
  472. package/build-types/text/types.d.ts.map +1 -1
  473. package/build-types/text/utils.d.ts +1 -1
  474. package/build-types/text/utils.d.ts.map +1 -1
  475. package/build-types/theme/styles.d.ts +10 -0
  476. package/build-types/theme/styles.d.ts.map +1 -0
  477. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +0 -1
  478. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  479. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  480. package/build-types/toggle-group-control/types.d.ts +0 -7
  481. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  482. package/build-types/tools-panel/styles.d.ts +1 -1
  483. package/build-types/tools-panel/styles.d.ts.map +1 -1
  484. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  485. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  486. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  487. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  488. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  489. package/build-types/tree-grid/roving-tab-index.d.ts +1 -1
  490. package/build-types/tree-grid/roving-tab-index.d.ts.map +1 -1
  491. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  492. package/build-types/tree-select/types.d.ts +1 -8
  493. package/build-types/tree-select/types.d.ts.map +1 -1
  494. package/build-types/truncate/styles.d.ts +2 -0
  495. package/build-types/truncate/styles.d.ts.map +1 -0
  496. package/build-types/unit-control/index.d.ts +2 -4
  497. package/build-types/unit-control/index.d.ts.map +1 -1
  498. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -2
  499. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  500. package/build-types/unit-control/types.d.ts +1 -15
  501. package/build-types/unit-control/types.d.ts.map +1 -1
  502. package/build-types/utils/config-values.d.ts +1 -2
  503. package/build-types/utils/hooks/use-animated-offset-rect.d.ts +1 -1
  504. package/build-types/utils/hooks/use-animated-offset-rect.d.ts.map +1 -1
  505. package/build-types/utils/hooks/use-controlled-state.d.ts +6 -0
  506. package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
  507. package/build-types/utils/hooks/use-controlled-value.d.ts +1 -1
  508. package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
  509. package/build-types/utils/rtl.d.ts.map +1 -1
  510. package/build-types/validated-form-controls/components/content-editable-control.d.ts +16 -0
  511. package/build-types/validated-form-controls/components/content-editable-control.d.ts.map +1 -0
  512. package/build-types/validated-form-controls/components/index.d.ts +1 -0
  513. package/build-types/validated-form-controls/components/index.d.ts.map +1 -1
  514. package/build-types/validated-form-controls/components/input-control.d.ts +1 -1
  515. package/build-types/validated-form-controls/components/input-control.d.ts.map +1 -1
  516. package/build-types/validated-form-controls/components/number-control.d.ts +2 -3
  517. package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
  518. package/build-types/validated-form-controls/components/range-control.d.ts +2 -4
  519. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
  520. package/build-types/validated-form-controls/components/stories/content-editable-control.story.d.ts +9 -0
  521. package/build-types/validated-form-controls/components/stories/content-editable-control.story.d.ts.map +1 -0
  522. package/build-types/validated-form-controls/components/stories/overview.story.d.ts +5 -0
  523. package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
  524. package/build-types/validated-form-controls/components/toggle-group-control.d.ts +1 -2
  525. package/build-types/validated-form-controls/components/toggle-group-control.d.ts.map +1 -1
  526. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
  527. package/build-types/validated-form-controls/test/content-editable-control.d.ts +2 -0
  528. package/build-types/validated-form-controls/test/content-editable-control.d.ts.map +1 -0
  529. package/build-types/validated-form-controls/validity-indicator.d.ts +1 -1
  530. package/build-types/validated-form-controls/validity-indicator.d.ts.map +1 -1
  531. package/build-types/visually-hidden/test/index.d.ts +2 -0
  532. package/build-types/visually-hidden/test/index.d.ts.map +1 -0
  533. package/package.json +30 -30
  534. package/src/angle-picker-control/index.tsx +0 -1
  535. package/src/autocomplete/index.tsx +20 -11
  536. package/src/autocomplete/style.scss +1 -0
  537. package/src/badge/stories/index.story.tsx +1 -1
  538. package/src/base-control/README.md +2 -2
  539. package/src/base-control/stories/index.story.tsx +1 -1
  540. package/src/border-box-control/styles.ts +6 -2
  541. package/src/border-box-control/types.ts +4 -15
  542. package/src/box-control/types.ts +4 -8
  543. package/src/button/stories/e2e/index.story.tsx +10 -2
  544. package/src/button/stories/index.story.tsx +1 -1
  545. package/src/button/style.scss +32 -27
  546. package/src/button-group/style.scss +1 -6
  547. package/src/calendar/style.scss +1 -1
  548. package/src/card/stories/index.story.tsx +1 -1
  549. package/src/card/test/__snapshots__/index.tsx.snap +1 -1
  550. package/src/checkbox-control/stories/index.story.tsx +1 -1
  551. package/src/checkbox-control/test/__snapshots__/index.tsx.snap +1 -1
  552. package/src/color-indicator/test/__snapshots__/index.tsx.snap +1 -1
  553. package/src/color-palette/styles.ts +1 -1
  554. package/src/color-picker/component.tsx +23 -19
  555. package/src/color-picker/hex-input.tsx +0 -1
  556. package/src/color-picker/input-with-slider.tsx +0 -1
  557. package/src/color-picker/picker.tsx +144 -21
  558. package/src/color-picker/test/index.tsx +502 -0
  559. package/src/color-picker/types.ts +2 -0
  560. package/src/combobox-control/style.scss +2 -2
  561. package/src/confirm-dialog/component.tsx +2 -4
  562. package/src/confirm-dialog/stories/index.story.tsx +1 -1
  563. package/src/confirm-dialog/style.module.scss +7 -0
  564. package/src/confirm-dialog/test/index.tsx +5 -0
  565. package/src/content-editable-control/README.md +88 -0
  566. package/src/content-editable-control/docs-manifest.json +5 -0
  567. package/src/content-editable-control/index.tsx +110 -0
  568. package/src/content-editable-control/stories/index.story.tsx +32 -0
  569. package/src/content-editable-control/style.module.scss +34 -0
  570. package/src/content-editable-control/test/index.tsx +176 -0
  571. package/src/content-editable-control/types.ts +35 -0
  572. package/src/context/test/__snapshots__/context-system-provider.js.snap +1 -1
  573. package/src/context/wordpress-component.ts +7 -2
  574. package/src/custom-gradient-picker/test/index.tsx +111 -1
  575. package/src/custom-select-control/index.tsx +1 -2
  576. package/src/custom-select-control/stories/index.story.tsx +1 -1
  577. package/src/custom-select-control/test/__snapshots__/index.tsx.snap +6 -0
  578. package/src/custom-select-control/test/index.tsx +23 -0
  579. package/src/custom-select-control/types.ts +1 -8
  580. package/src/custom-select-control-v2/custom-select.tsx +1 -5
  581. package/src/custom-select-control-v2/stories/index.story.tsx +1 -1
  582. package/src/date-time/date-picker/styles.ts +1 -1
  583. package/src/date-time/time-picker/index.tsx +0 -2
  584. package/src/date-time/time-picker/time-input/index.tsx +0 -2
  585. package/src/disabled/index.tsx +7 -5
  586. package/src/disabled/style.module.scss +15 -0
  587. package/src/disabled/test/index.tsx +6 -4
  588. package/src/dropdown-menu/style.scss +1 -1
  589. package/src/elevation/stories/index.story.tsx +1 -1
  590. package/src/elevation/test/__snapshots__/index.tsx.snap +1 -1
  591. package/src/external-link/stories/index.story.tsx +1 -1
  592. package/src/external-link/style.scss +7 -13
  593. package/src/flex/stories/index.story.tsx +1 -1
  594. package/src/flex/test/__snapshots__/index.tsx.snap +1 -1
  595. package/src/font-size-picker/types.ts +6 -15
  596. package/src/form-toggle/test/__snapshots__/index.tsx.snap +1 -1
  597. package/src/form-token-field/index.tsx +5 -4
  598. package/src/form-token-field/style.module.scss +6 -0
  599. package/src/form-token-field/style.scss +2 -2
  600. package/src/gradient-picker/README.md +21 -3
  601. package/src/gradient-picker/index.tsx +43 -28
  602. package/src/gradient-picker/stories/index.story.tsx +41 -5
  603. package/src/gradient-picker/test/index.tsx +148 -0
  604. package/src/gradient-picker/types.ts +24 -4
  605. package/src/h-stack/stories/index.story.tsx +1 -1
  606. package/src/h-stack/test/__snapshots__/index.tsx.snap +1 -1
  607. package/src/heading/hook.ts +1 -1
  608. package/src/heading/stories/index.story.tsx +1 -1
  609. package/src/heading/test/__snapshots__/index.tsx.snap +1 -1
  610. package/src/higher-order/with-filters/test/__snapshots__/index.tsx.snap +1 -1
  611. package/src/icon/stories/index.story.tsx +1 -1
  612. package/src/input-control/README.md +0 -8
  613. package/src/input-control/index.tsx +4 -16
  614. package/src/input-control/input-base.tsx +4 -8
  615. package/src/input-control/stories/index.story.tsx +2 -4
  616. package/src/input-control/styles/input-control-styles.tsx +1 -19
  617. package/src/input-control/test/__snapshots__/index.js.snap +11 -0
  618. package/src/input-control/test/index.js +29 -7
  619. package/src/input-control/types.ts +15 -30
  620. package/src/item-group/test/__snapshots__/index.js.snap +1 -1
  621. package/src/menu/README.md +2 -2
  622. package/src/menu/group-label.tsx +2 -1
  623. package/src/menu-group/style.scss +1 -1
  624. package/src/menu-item/style.scss +1 -1
  625. package/src/menu-item/test/__snapshots__/index.js.snap +1 -1
  626. package/src/modal/stories/index.story.tsx +2 -5
  627. package/src/modal/style.scss +1 -1
  628. package/src/modal/test/index.tsx +42 -0
  629. package/src/notice/stories/index.story.tsx +1 -1
  630. package/src/notice/test/__snapshots__/index.tsx.snap +1 -1
  631. package/src/number-control/README.md +0 -8
  632. package/src/number-control/index.tsx +1 -12
  633. package/src/number-control/stories/index.story.tsx +1 -3
  634. package/src/number-control/test/index.tsx +1 -1
  635. package/src/number-control/types.ts +0 -7
  636. package/src/palette-edit/styles.ts +1 -1
  637. package/src/panel/stories/index.story.tsx +4 -4
  638. package/src/panel/style.scss +2 -5
  639. package/src/panel/test/__snapshots__/body.tsx.snap +1 -1
  640. package/src/panel/test/__snapshots__/header.tsx.snap +1 -1
  641. package/src/panel/test/__snapshots__/index.tsx.snap +1 -1
  642. package/src/panel/test/__snapshots__/row.tsx.snap +1 -1
  643. package/src/placeholder/style.scss +1 -1
  644. package/src/private-apis.ts +4 -2
  645. package/src/range-control/index.tsx +0 -2
  646. package/src/range-control/types.ts +2 -15
  647. package/src/sandbox/index.tsx +165 -98
  648. package/src/sandbox/test/index.tsx +63 -1
  649. package/src/sandbox/types.ts +11 -0
  650. package/src/scrollable/test/__snapshots__/index.tsx.snap +1 -1
  651. package/src/search-control/index.tsx +23 -21
  652. package/src/search-control/style.module.scss +16 -0
  653. package/src/search-control/test/index.tsx +8 -0
  654. package/src/search-control/types.ts +1 -1
  655. package/src/select-control/index.tsx +0 -2
  656. package/src/select-control/stories/index.story.tsx +1 -1
  657. package/src/select-control/styles/select-control-styles.ts +0 -7
  658. package/src/select-control/test/__snapshots__/select-control.tsx.snap +11 -0
  659. package/src/select-control/test/select-control.tsx +37 -0
  660. package/src/select-control/types.ts +8 -2
  661. package/src/shortcut/test/__snapshots__/index.tsx.snap +1 -1
  662. package/src/slot-fill/fill.tsx +3 -9
  663. package/src/slot-fill/stories/index.story.tsx +52 -10
  664. package/src/slot-fill/test/__snapshots__/slot.js.snap +1 -1
  665. package/src/slot-fill/test/slot.js +53 -11
  666. package/src/spacer/hook.ts +93 -77
  667. package/src/spacer/stories/index.story.tsx +8 -6
  668. package/src/spacer/style.module.scss +25 -0
  669. package/src/spacer/test/__snapshots__/index.tsx.snap +3 -223
  670. package/src/spacer/test/index.tsx +106 -110
  671. package/src/tab-panel/stories/index.story.tsx +1 -1
  672. package/src/tab-panel/style.scss +1 -1
  673. package/src/tabs/stories/index.story.tsx +1 -1
  674. package/src/text/stories/index.story.tsx +1 -1
  675. package/src/text/test/__snapshots__/index.tsx.snap +1 -1
  676. package/src/text/types.ts +5 -5
  677. package/src/text-control/style.scss +1 -1
  678. package/src/textarea-control/stories/index.story.tsx +1 -1
  679. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +37 -715
  680. package/src/toggle-group-control/test/index.tsx +33 -3
  681. package/src/toggle-group-control/toggle-group-control/component.tsx +11 -16
  682. package/src/toggle-group-control/toggle-group-control/style.module.scss +63 -0
  683. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +22 -24
  684. package/src/toggle-group-control/toggle-group-control-option-base/style.module.scss +88 -0
  685. package/src/toggle-group-control/types.ts +0 -7
  686. package/src/toolbar/toolbar-button/style.scss +1 -1
  687. package/src/tools-panel/style.module.scss +117 -0
  688. package/src/tools-panel/test/index.tsx +105 -39
  689. package/src/tools-panel/tools-panel/component.tsx +12 -1
  690. package/src/tools-panel/tools-panel/hook.ts +13 -15
  691. package/src/tools-panel/tools-panel-header/component.tsx +6 -2
  692. package/src/tools-panel/tools-panel-header/hook.ts +7 -25
  693. package/src/tools-panel/tools-panel-item/hook.ts +16 -34
  694. package/src/tooltip/stories/index.story.tsx +1 -1
  695. package/src/tooltip/test/index.tsx +1 -1
  696. package/src/tree-grid/stories/index.story.tsx +0 -2
  697. package/src/tree-grid/test/__snapshots__/cell.tsx.snap +1 -1
  698. package/src/tree-grid/test/__snapshots__/index.tsx.snap +1 -1
  699. package/src/tree-grid/test/__snapshots__/roving-tab-index-item.tsx.snap +1 -1
  700. package/src/tree-grid/test/__snapshots__/roving-tab-index.tsx.snap +1 -1
  701. package/src/tree-grid/test/__snapshots__/row.tsx.snap +1 -1
  702. package/src/tree-select/README.md +1 -1
  703. package/src/tree-select/types.ts +1 -8
  704. package/src/unit-control/index.tsx +0 -1
  705. package/src/unit-control/types.ts +1 -18
  706. package/src/utils/base-label.ts +1 -1
  707. package/src/utils/config-values.js +1 -2
  708. package/src/utils/font-values.js +1 -1
  709. package/src/utils/theme-variables.scss +1 -0
  710. package/src/v-stack/stories/index.story.tsx +1 -1
  711. package/src/v-stack/test/__snapshots__/index.tsx.snap +1 -1
  712. package/src/validated-form-controls/components/content-editable-control.tsx +88 -0
  713. package/src/validated-form-controls/components/index.ts +1 -0
  714. package/src/validated-form-controls/components/input-control.tsx +2 -10
  715. package/src/validated-form-controls/components/number-control.tsx +2 -10
  716. package/src/validated-form-controls/components/stories/content-editable-control.story.tsx +56 -0
  717. package/src/validated-form-controls/components/stories/overview.story.tsx +51 -0
  718. package/src/validated-form-controls/control-with-error.tsx +10 -1
  719. package/src/validated-form-controls/style.scss +9 -2
  720. package/src/validated-form-controls/test/content-editable-control.tsx +71 -0
  721. package/src/validated-form-controls/test/control-with-error.tsx +42 -0
  722. package/src/view/test/__snapshots__/index.js.snap +1 -1
  723. package/src/visually-hidden/stories/index.story.tsx +1 -1
  724. package/build/confirm-dialog/styles.cjs +0 -42
  725. package/build/confirm-dialog/styles.cjs.map +0 -7
  726. package/build/disabled/styles/disabled-styles.cjs +0 -42
  727. package/build/disabled/styles/disabled-styles.cjs.map +0 -7
  728. package/build/form-token-field/styles.cjs +0 -49
  729. package/build/form-token-field/styles.cjs.map +0 -7
  730. package/build/search-control/styles.cjs +0 -74
  731. package/build/search-control/styles.cjs.map +0 -7
  732. package/build/theme/color-algorithms.cjs +0 -131
  733. package/build/theme/color-algorithms.cjs.map +0 -7
  734. package/build/theme/index.cjs +0 -160
  735. package/build/theme/index.cjs.map +0 -7
  736. package/build/toggle-group-control/toggle-group-control/styles.cjs +0 -53
  737. package/build/toggle-group-control/toggle-group-control/styles.cjs.map +0 -7
  738. package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs +0 -94
  739. package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs.map +0 -7
  740. package/build/tools-panel/styles.cjs +0 -129
  741. package/build/tools-panel/styles.cjs.map +0 -7
  742. package/build/utils/deprecated-36px-size.cjs +0 -56
  743. package/build/utils/deprecated-36px-size.cjs.map +0 -7
  744. package/build/utils/use-deprecated-props.cjs +0 -41
  745. package/build/utils/use-deprecated-props.cjs.map +0 -7
  746. package/build-module/confirm-dialog/styles.mjs +0 -17
  747. package/build-module/confirm-dialog/styles.mjs.map +0 -7
  748. package/build-module/disabled/styles/disabled-styles.mjs +0 -17
  749. package/build-module/disabled/styles/disabled-styles.mjs.map +0 -7
  750. package/build-module/form-token-field/styles.mjs +0 -14
  751. package/build-module/form-token-field/styles.mjs.map +0 -7
  752. package/build-module/search-control/styles.mjs +0 -38
  753. package/build-module/search-control/styles.mjs.map +0 -7
  754. package/build-module/theme/color-algorithms.mjs +0 -94
  755. package/build-module/theme/color-algorithms.mjs.map +0 -7
  756. package/build-module/theme/index.mjs +0 -129
  757. package/build-module/theme/index.mjs.map +0 -7
  758. package/build-module/toggle-group-control/toggle-group-control/styles.mjs +0 -27
  759. package/build-module/toggle-group-control/toggle-group-control/styles.mjs.map +0 -7
  760. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs +0 -56
  761. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs.map +0 -7
  762. package/build-module/tools-panel/styles.mjs +0 -84
  763. package/build-module/tools-panel/styles.mjs.map +0 -7
  764. package/build-module/utils/deprecated-36px-size.mjs +0 -21
  765. package/build-module/utils/deprecated-36px-size.mjs.map +0 -7
  766. package/build-module/utils/use-deprecated-props.mjs +0 -16
  767. package/build-module/utils/use-deprecated-props.mjs.map +0 -7
  768. package/src/confirm-dialog/styles.ts +0 -18
  769. package/src/disabled/styles/disabled-styles.tsx +0 -23
  770. package/src/form-token-field/styles.ts +0 -15
  771. package/src/search-control/styles.ts +0 -27
  772. package/src/theme/README.md +0 -47
  773. package/src/theme/color-algorithms.ts +0 -142
  774. package/src/theme/index.tsx +0 -80
  775. package/src/theme/stories/index.story.tsx +0 -127
  776. package/src/theme/style.module.scss +0 -4
  777. package/src/theme/test/color-algorithms.ts +0 -100
  778. package/src/theme/test/index.tsx +0 -151
  779. package/src/theme/types.ts +0 -61
  780. package/src/toggle-group-control/toggle-group-control/styles.ts +0 -84
  781. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +0 -109
  782. package/src/tools-panel/styles.ts +0 -176
  783. package/src/utils/deprecated-36px-size.ts +0 -30
  784. package/src/utils/use-deprecated-props.ts +0 -14
  785. /package/build-module/{theme → content-editable-control}/types.mjs +0 -0
  786. /package/build-module/{theme → content-editable-control}/types.mjs.map +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/range-control/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useRef, useState, forwardRef } from '@wordpress/element';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { COLORS } from '../utils';\nimport { floatClamp, useControlledRangeValue } from './utils';\nimport { clamp } from '../utils/math';\nimport InputRange from './input-range';\nimport RangeRail from './rail';\nimport SimpleTooltip from './tooltip';\nimport { ActionRightWrapper, AfterIconWrapper, BeforeIconWrapper, InputNumber, Root, Track, ThumbWrapper, Thumb, Wrapper } from './styles/range-control-styles';\nimport { space } from '../utils/space';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst noop = () => {};\n\n/**\n * Computes the value that `RangeControl` should reset to when pressing\n * the reset button.\n */\nfunction computeResetValue({\n resetFallbackValue,\n initialPosition\n}) {\n if (resetFallbackValue !== undefined) {\n return !Number.isNaN(resetFallbackValue) ? resetFallbackValue : null;\n }\n if (initialPosition !== undefined) {\n return !Number.isNaN(initialPosition) ? initialPosition : null;\n }\n return null;\n}\nfunction UnforwardedRangeControl(props, forwardedRef) {\n const {\n // Prevent passing legacy props to internal component.\n __nextHasNoMarginBottom: _,\n __next40pxDefaultSize: _next40pxDefaultSize,\n __shouldNotWarnDeprecated36pxSize: _shouldNotWarnDeprecated36pxSize,\n afterIcon,\n allowReset = false,\n beforeIcon,\n className,\n color: colorProp = COLORS.theme.accent,\n currentInput,\n disabled = false,\n help,\n hideLabelFromVision = false,\n initialPosition,\n isShiftStepEnabled = true,\n label,\n marks = false,\n max = 100,\n min = 0,\n onBlur = noop,\n onChange = noop,\n onFocus = noop,\n onMouseLeave = noop,\n onMouseMove = noop,\n railColor,\n renderTooltipContent = v => v,\n resetFallbackValue,\n shiftStep = 10,\n showTooltip: showTooltipProp,\n step = 1,\n trackColor,\n value: valueProp,\n withInputField = true,\n ...otherProps\n } = props;\n const [value, setValue] = useControlledRangeValue({\n min,\n max,\n value: valueProp ?? null,\n initial: initialPosition\n });\n const isResetPendent = useRef(false);\n let hasTooltip = showTooltipProp;\n let hasInputField = withInputField;\n if (step === 'any') {\n // The tooltip and number input field are hidden when the step is \"any\"\n // because the decimals get too lengthy to fit well.\n hasTooltip = false;\n hasInputField = false;\n }\n const [showTooltip, setShowTooltip] = useState(hasTooltip);\n const [isFocused, setIsFocused] = useState(false);\n const inputRef = useRef(null);\n const isCurrentlyFocused = inputRef.current?.matches(':focus');\n const isThumbFocused = !disabled && isFocused;\n const isValueReset = value === null;\n const currentValue = value !== undefined ? value : currentInput;\n const inputSliderValue = isValueReset ? '' : currentValue;\n const rangeFillValue = isValueReset ? (max - min) / 2 + min : value;\n const fillValue = isValueReset ? 50 : (value - min) / (max - min) * 100;\n const fillValueOffset = `${clamp(fillValue, 0, 100)}%`;\n const classes = clsx('components-range-control', className);\n const wrapperClasses = clsx('components-range-control__wrapper', !!marks && 'is-marked');\n const id = useInstanceId(UnforwardedRangeControl, 'inspector-range-control');\n const describedBy = !!help ? `${id}__help` : undefined;\n const enableTooltip = hasTooltip !== false && Number.isFinite(value);\n const handleOnRangeChange = event => {\n const nextValue = parseFloat(event.target.value);\n setValue(nextValue);\n onChange(nextValue);\n };\n const handleOnChange = next => {\n // @ts-expect-error TODO: Investigate if it's problematic for setValue() to\n // potentially receive a NaN when next is undefined.\n let nextValue = parseFloat(next);\n setValue(nextValue);\n\n /*\n * Calls onChange only when nextValue is numeric\n * otherwise may queue a reset for the blur event.\n */\n if (!isNaN(nextValue)) {\n if (nextValue < min || nextValue > max) {\n nextValue = floatClamp(nextValue, min, max);\n }\n onChange(nextValue);\n isResetPendent.current = false;\n } else if (allowReset) {\n isResetPendent.current = true;\n }\n };\n const handleOnInputNumberBlur = () => {\n if (isResetPendent.current) {\n handleOnReset();\n isResetPendent.current = false;\n }\n };\n const handleOnReset = () => {\n // Reset to `resetFallbackValue` if defined, otherwise set internal value\n // to `null` — which, if propagated to the `value` prop, will cause\n // the value to be reset to the `initialPosition` prop if defined.\n const resetValue = Number.isNaN(resetFallbackValue) ? null : resetFallbackValue ?? null;\n setValue(resetValue);\n\n /**\n * Previously, this callback would always receive undefined as\n * an argument. This behavior is unexpected, specifically\n * when resetFallbackValue is defined.\n *\n * The value of undefined is not ideal. Passing it through\n * to internal <input /> elements would change it from a\n * controlled component to an uncontrolled component.\n *\n * For now, to minimize unexpected regressions, we're going to\n * preserve the undefined callback argument, except when a\n * resetFallbackValue is defined.\n */\n onChange(resetValue ?? undefined);\n };\n const handleShowTooltip = () => setShowTooltip(true);\n const handleHideTooltip = () => setShowTooltip(false);\n const handleOnBlur = event => {\n onBlur(event);\n setIsFocused(false);\n handleHideTooltip();\n };\n const handleOnFocus = event => {\n onFocus(event);\n setIsFocused(true);\n handleShowTooltip();\n };\n const offsetStyle = {\n [isRTL() ? 'right' : 'left']: fillValueOffset\n };\n return /*#__PURE__*/_jsx(BaseControl, {\n className: classes,\n label: label,\n hideLabelFromVision: hideLabelFromVision,\n id: `${id}`,\n help: help,\n children: /*#__PURE__*/_jsxs(Root, {\n className: \"components-range-control__root\",\n children: [beforeIcon && /*#__PURE__*/_jsx(BeforeIconWrapper, {\n children: /*#__PURE__*/_jsx(Icon, {\n icon: beforeIcon\n })\n }), /*#__PURE__*/_jsxs(Wrapper, {\n className: wrapperClasses,\n color: colorProp,\n marks: !!marks,\n children: [/*#__PURE__*/_jsx(InputRange, {\n ...otherProps,\n className: \"components-range-control__slider\",\n describedBy: describedBy,\n disabled: disabled,\n id: `${id}`,\n label: label,\n max: max,\n min: min,\n onBlur: handleOnBlur,\n onChange: handleOnRangeChange,\n onFocus: handleOnFocus,\n onMouseMove: onMouseMove,\n onMouseLeave: onMouseLeave,\n ref: useMergeRefs([inputRef, forwardedRef]),\n step: step,\n value: inputSliderValue ?? undefined\n }), /*#__PURE__*/_jsx(RangeRail, {\n \"aria-hidden\": true,\n disabled: disabled,\n marks: marks,\n max: max,\n min: min,\n railColor: railColor,\n step: step,\n value: rangeFillValue\n }), /*#__PURE__*/_jsx(Track, {\n \"aria-hidden\": true,\n className: \"components-range-control__track\",\n disabled: disabled,\n style: {\n width: fillValueOffset\n },\n trackColor: trackColor\n }), /*#__PURE__*/_jsx(ThumbWrapper, {\n className: \"components-range-control__thumb-wrapper\",\n style: offsetStyle,\n disabled: disabled,\n children: /*#__PURE__*/_jsx(Thumb, {\n \"aria-hidden\": true,\n isFocused: isThumbFocused,\n disabled: disabled\n })\n }), enableTooltip && /*#__PURE__*/_jsx(SimpleTooltip, {\n className: \"components-range-control__tooltip\",\n inputRef: inputRef,\n tooltipPlacement: \"bottom\",\n renderTooltipContent: renderTooltipContent,\n show: isCurrentlyFocused || showTooltip,\n style: offsetStyle,\n value: value\n })]\n }), afterIcon && /*#__PURE__*/_jsx(AfterIconWrapper, {\n children: /*#__PURE__*/_jsx(Icon, {\n icon: afterIcon\n })\n }), hasInputField && /*#__PURE__*/_jsx(InputNumber, {\n \"aria-label\": label,\n className: \"components-range-control__number\",\n disabled: disabled,\n inputMode: \"decimal\",\n isShiftStepEnabled: isShiftStepEnabled,\n max: max,\n min: min,\n onBlur: handleOnInputNumberBlur,\n onChange: handleOnChange,\n shiftStep: shiftStep,\n __unstableInputWidth: space(20),\n __next40pxDefaultSize: true,\n step: step\n // @ts-expect-error TODO: Investigate if the `null` value is necessary\n ,\n value: inputSliderValue\n }), allowReset && /*#__PURE__*/_jsx(ActionRightWrapper, {\n children: /*#__PURE__*/_jsx(Button, {\n className: \"components-range-control__reset\"\n // If the RangeControl itself is disabled, the reset button shouldn't be in the tab sequence.\n ,\n accessibleWhenDisabled: !disabled\n // The reset button should be disabled if RangeControl itself is disabled,\n // or if the current `value` is equal to the value that would be currently\n // assigned when clicking the button.\n ,\n disabled: disabled || value === computeResetValue({\n resetFallbackValue,\n initialPosition\n }),\n variant: \"secondary\",\n size: \"small\",\n onClick: handleOnReset,\n children: __('Reset')\n })\n })]\n })\n });\n}\n\n/**\n * RangeControls are used to make selections from a range of incremental values.\n *\n * ```jsx\n * import { RangeControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRangeControl = () => {\n * const [ value, setValue ] = useState();\n * return (\n * <RangeControl\n * help=\"Please select how transparent you would like this.\"\n * initialPosition={ 50 }\n * label=\"Opacity\"\n * max={ 100 }\n * min={ 0 }\n * value={ value }\n * onChange={ setValue }\n * />\n * );\n * };\n * ```\n */\nexport const RangeControl = forwardRef(UnforwardedRangeControl);\nRangeControl.displayName = 'RangeControl';\nexport default RangeControl;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA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,UAAU;AAAA,QACV;AAAA,QACA,0BAAsB,oBAAM,EAAE;AAAA,QAC9B,uBAAuB;AAAA,QACvB;AAAA,QAGA,OAAO;AAAA,MACT,CAAC,GAAG,cAA2B,uCAAAA,KAAK,gDAAoB;AAAA,QACtD,UAAuB,uCAAAA,KAAK,cAAAO,SAAQ;AAAA,UAClC,WAAW;AAAA,UAGX,wBAAwB,CAAC;AAAA,UAKzB,UAAU,YAAY,UAAU,kBAAkB;AAAA,YAChD;AAAA,YACA;AAAA,UACF,CAAC;AAAA,UACD,SAAS;AAAA,UACT,MAAM;AAAA,UACN,SAAS;AAAA,UACT,cAAU,gBAAG,OAAO;AAAA,QACtB,CAAC;AAAA,MACH,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH;AAyBO,IAAM,mBAAe,2BAAW,uBAAuB;AAC9D,aAAa,cAAc;AAC3B,IAAO,wBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useRef, useState, forwardRef } from '@wordpress/element';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { COLORS } from '../utils';\nimport { floatClamp, useControlledRangeValue } from './utils';\nimport { clamp } from '../utils/math';\nimport InputRange from './input-range';\nimport RangeRail from './rail';\nimport SimpleTooltip from './tooltip';\nimport { ActionRightWrapper, AfterIconWrapper, BeforeIconWrapper, InputNumber, Root, Track, ThumbWrapper, Thumb, Wrapper } from './styles/range-control-styles';\nimport { space } from '../utils/space';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst noop = () => {};\n\n/**\n * Computes the value that `RangeControl` should reset to when pressing\n * the reset button.\n */\nfunction computeResetValue({\n resetFallbackValue,\n initialPosition\n}) {\n if (resetFallbackValue !== undefined) {\n return !Number.isNaN(resetFallbackValue) ? resetFallbackValue : null;\n }\n if (initialPosition !== undefined) {\n return !Number.isNaN(initialPosition) ? initialPosition : null;\n }\n return null;\n}\nfunction UnforwardedRangeControl(props, forwardedRef) {\n const {\n // Prevent passing legacy props to internal component.\n __nextHasNoMarginBottom: _,\n __next40pxDefaultSize: _next40pxDefaultSize,\n afterIcon,\n allowReset = false,\n beforeIcon,\n className,\n color: colorProp = COLORS.theme.accent,\n currentInput,\n disabled = false,\n help,\n hideLabelFromVision = false,\n initialPosition,\n isShiftStepEnabled = true,\n label,\n marks = false,\n max = 100,\n min = 0,\n onBlur = noop,\n onChange = noop,\n onFocus = noop,\n onMouseLeave = noop,\n onMouseMove = noop,\n railColor,\n renderTooltipContent = v => v,\n resetFallbackValue,\n shiftStep = 10,\n showTooltip: showTooltipProp,\n step = 1,\n trackColor,\n value: valueProp,\n withInputField = true,\n ...otherProps\n } = props;\n const [value, setValue] = useControlledRangeValue({\n min,\n max,\n value: valueProp ?? null,\n initial: initialPosition\n });\n const isResetPendent = useRef(false);\n let hasTooltip = showTooltipProp;\n let hasInputField = withInputField;\n if (step === 'any') {\n // The tooltip and number input field are hidden when the step is \"any\"\n // because the decimals get too lengthy to fit well.\n hasTooltip = false;\n hasInputField = false;\n }\n const [showTooltip, setShowTooltip] = useState(hasTooltip);\n const [isFocused, setIsFocused] = useState(false);\n const inputRef = useRef(null);\n const isCurrentlyFocused = inputRef.current?.matches(':focus');\n const isThumbFocused = !disabled && isFocused;\n const isValueReset = value === null;\n const currentValue = value !== undefined ? value : currentInput;\n const inputSliderValue = isValueReset ? '' : currentValue;\n const rangeFillValue = isValueReset ? (max - min) / 2 + min : value;\n const fillValue = isValueReset ? 50 : (value - min) / (max - min) * 100;\n const fillValueOffset = `${clamp(fillValue, 0, 100)}%`;\n const classes = clsx('components-range-control', className);\n const wrapperClasses = clsx('components-range-control__wrapper', !!marks && 'is-marked');\n const id = useInstanceId(UnforwardedRangeControl, 'inspector-range-control');\n const describedBy = !!help ? `${id}__help` : undefined;\n const enableTooltip = hasTooltip !== false && Number.isFinite(value);\n const handleOnRangeChange = event => {\n const nextValue = parseFloat(event.target.value);\n setValue(nextValue);\n onChange(nextValue);\n };\n const handleOnChange = next => {\n // @ts-expect-error TODO: Investigate if it's problematic for setValue() to\n // potentially receive a NaN when next is undefined.\n let nextValue = parseFloat(next);\n setValue(nextValue);\n\n /*\n * Calls onChange only when nextValue is numeric\n * otherwise may queue a reset for the blur event.\n */\n if (!isNaN(nextValue)) {\n if (nextValue < min || nextValue > max) {\n nextValue = floatClamp(nextValue, min, max);\n }\n onChange(nextValue);\n isResetPendent.current = false;\n } else if (allowReset) {\n isResetPendent.current = true;\n }\n };\n const handleOnInputNumberBlur = () => {\n if (isResetPendent.current) {\n handleOnReset();\n isResetPendent.current = false;\n }\n };\n const handleOnReset = () => {\n // Reset to `resetFallbackValue` if defined, otherwise set internal value\n // to `null` — which, if propagated to the `value` prop, will cause\n // the value to be reset to the `initialPosition` prop if defined.\n const resetValue = Number.isNaN(resetFallbackValue) ? null : resetFallbackValue ?? null;\n setValue(resetValue);\n\n /**\n * Previously, this callback would always receive undefined as\n * an argument. This behavior is unexpected, specifically\n * when resetFallbackValue is defined.\n *\n * The value of undefined is not ideal. Passing it through\n * to internal <input /> elements would change it from a\n * controlled component to an uncontrolled component.\n *\n * For now, to minimize unexpected regressions, we're going to\n * preserve the undefined callback argument, except when a\n * resetFallbackValue is defined.\n */\n onChange(resetValue ?? undefined);\n };\n const handleShowTooltip = () => setShowTooltip(true);\n const handleHideTooltip = () => setShowTooltip(false);\n const handleOnBlur = event => {\n onBlur(event);\n setIsFocused(false);\n handleHideTooltip();\n };\n const handleOnFocus = event => {\n onFocus(event);\n setIsFocused(true);\n handleShowTooltip();\n };\n const offsetStyle = {\n [isRTL() ? 'right' : 'left']: fillValueOffset\n };\n return /*#__PURE__*/_jsx(BaseControl, {\n className: classes,\n label: label,\n hideLabelFromVision: hideLabelFromVision,\n id: `${id}`,\n help: help,\n children: /*#__PURE__*/_jsxs(Root, {\n className: \"components-range-control__root\",\n children: [beforeIcon && /*#__PURE__*/_jsx(BeforeIconWrapper, {\n children: /*#__PURE__*/_jsx(Icon, {\n icon: beforeIcon\n })\n }), /*#__PURE__*/_jsxs(Wrapper, {\n className: wrapperClasses,\n color: colorProp,\n marks: !!marks,\n children: [/*#__PURE__*/_jsx(InputRange, {\n ...otherProps,\n className: \"components-range-control__slider\",\n describedBy: describedBy,\n disabled: disabled,\n id: `${id}`,\n label: label,\n max: max,\n min: min,\n onBlur: handleOnBlur,\n onChange: handleOnRangeChange,\n onFocus: handleOnFocus,\n onMouseMove: onMouseMove,\n onMouseLeave: onMouseLeave,\n ref: useMergeRefs([inputRef, forwardedRef]),\n step: step,\n value: inputSliderValue ?? undefined\n }), /*#__PURE__*/_jsx(RangeRail, {\n \"aria-hidden\": true,\n disabled: disabled,\n marks: marks,\n max: max,\n min: min,\n railColor: railColor,\n step: step,\n value: rangeFillValue\n }), /*#__PURE__*/_jsx(Track, {\n \"aria-hidden\": true,\n className: \"components-range-control__track\",\n disabled: disabled,\n style: {\n width: fillValueOffset\n },\n trackColor: trackColor\n }), /*#__PURE__*/_jsx(ThumbWrapper, {\n className: \"components-range-control__thumb-wrapper\",\n style: offsetStyle,\n disabled: disabled,\n children: /*#__PURE__*/_jsx(Thumb, {\n \"aria-hidden\": true,\n isFocused: isThumbFocused,\n disabled: disabled\n })\n }), enableTooltip && /*#__PURE__*/_jsx(SimpleTooltip, {\n className: \"components-range-control__tooltip\",\n inputRef: inputRef,\n tooltipPlacement: \"bottom\",\n renderTooltipContent: renderTooltipContent,\n show: isCurrentlyFocused || showTooltip,\n style: offsetStyle,\n value: value\n })]\n }), afterIcon && /*#__PURE__*/_jsx(AfterIconWrapper, {\n children: /*#__PURE__*/_jsx(Icon, {\n icon: afterIcon\n })\n }), hasInputField && /*#__PURE__*/_jsx(InputNumber, {\n \"aria-label\": label,\n className: \"components-range-control__number\",\n disabled: disabled,\n inputMode: \"decimal\",\n isShiftStepEnabled: isShiftStepEnabled,\n max: max,\n min: min,\n onBlur: handleOnInputNumberBlur,\n onChange: handleOnChange,\n shiftStep: shiftStep,\n __unstableInputWidth: space(20),\n step: step\n // @ts-expect-error TODO: Investigate if the `null` value is necessary\n ,\n value: inputSliderValue\n }), allowReset && /*#__PURE__*/_jsx(ActionRightWrapper, {\n children: /*#__PURE__*/_jsx(Button, {\n className: \"components-range-control__reset\"\n // If the RangeControl itself is disabled, the reset button shouldn't be in the tab sequence.\n ,\n accessibleWhenDisabled: !disabled\n // The reset button should be disabled if RangeControl itself is disabled,\n // or if the current `value` is equal to the value that would be currently\n // assigned when clicking the button.\n ,\n disabled: disabled || value === computeResetValue({\n resetFallbackValue,\n initialPosition\n }),\n variant: \"secondary\",\n size: \"small\",\n onClick: handleOnReset,\n children: __('Reset')\n })\n })]\n })\n });\n}\n\n/**\n * RangeControls are used to make selections from a range of incremental values.\n *\n * ```jsx\n * import { RangeControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRangeControl = () => {\n * const [ value, setValue ] = useState();\n * return (\n * <RangeControl\n * help=\"Please select how transparent you would like this.\"\n * initialPosition={ 50 }\n * label=\"Opacity\"\n * max={ 100 }\n * min={ 0 }\n * value={ value }\n * onChange={ setValue }\n * />\n * );\n * };\n * ```\n */\nexport const RangeControl = forwardRef(UnforwardedRangeControl);\nRangeControl.displayName = 'RangeControl';\nexport default RangeControl;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,kBAA0B;AAC1B,qBAA6C;AAC7C,qBAA4C;AAK5C,0BAAwB;AACxB,oBAAmB;AACnB,kBAAiB;AACjB,mBAAuB;AACvB,IAAAA,gBAAoD;AACpD,kBAAsB;AACtB,yBAAuB;AACvB,kBAAsB;AACtB,qBAA0B;AAC1B,kCAAgI;AAChI,mBAAsB;AACtB,yBAA2C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A,YACA;AAAA,UACF,CAAC;AAAA,UACD,SAAS;AAAA,UACT,MAAM;AAAA,UACN,SAAS;AAAA,UACT,cAAU,gBAAG,OAAO;AAAA,QACtB,CAAC;AAAA,MACH,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH;AAyBO,IAAM,mBAAe,2BAAW,uBAAuB;AAC9D,aAAa,cAAc;AAC3B,IAAO,wBAAQ;",
6
6
  "names": ["import_utils", "clsx", "_jsx", "BaseControl", "_jsxs", "Icon", "InputRange", "RangeRail", "SimpleTooltip", "Button"]
7
7
  }
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,15 +17,25 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // packages/components/src/sandbox/index.tsx
21
31
  var sandbox_exports = {};
22
32
  __export(sandbox_exports, {
23
33
  VIEWPORT_UNIT_VALUE_REGEX: () => VIEWPORT_UNIT_VALUE_REGEX,
34
+ buildSandBoxDocument: () => buildSandBoxDocument,
24
35
  default: () => sandbox_default
25
36
  });
26
37
  module.exports = __toCommonJS(sandbox_exports);
38
+ var import_clsx = __toESM(require("clsx"));
27
39
  var import_element = require("@wordpress/element");
28
40
  var import_compose = require("@wordpress/compose");
29
41
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -32,10 +44,13 @@ var observeAndResizeJS = function() {
32
44
  const {
33
45
  MutationObserver
34
46
  } = window;
35
- if (!MutationObserver || !document.body || !window.parent) {
47
+ if (!MutationObserver || !window.parent) {
36
48
  return;
37
49
  }
38
50
  function sendResize() {
51
+ if (!document.body) {
52
+ return;
53
+ }
39
54
  const clientBoundingRect = document.body.getBoundingClientRect();
40
55
  window.parent.postMessage({
41
56
  action: "resize",
@@ -43,34 +58,53 @@ var observeAndResizeJS = function() {
43
58
  height: clientBoundingRect.height
44
59
  }, "*");
45
60
  }
46
- const observer = new MutationObserver(sendResize);
47
- observer.observe(document.body, {
48
- attributes: true,
49
- attributeOldValue: false,
50
- characterData: true,
51
- characterDataOldValue: false,
52
- childList: true,
53
- subtree: true
54
- });
55
- window.addEventListener("load", sendResize, true);
56
- function removeViewportStyles(ruleOrNode) {
57
- if (ruleOrNode.style) {
58
- ["width", "height", "minHeight", "maxHeight"].forEach(function(style2) {
59
- if (/^\d*\.?\d+(?:vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test(ruleOrNode.style[style2])) {
60
- ruleOrNode.style[style2] = "";
61
- }
62
- });
61
+ function connect() {
62
+ const {
63
+ body
64
+ } = document;
65
+ if (!body) {
66
+ return;
67
+ }
68
+ const observer = new MutationObserver(sendResize);
69
+ observer.observe(body, {
70
+ attributes: true,
71
+ attributeOldValue: false,
72
+ characterData: true,
73
+ characterDataOldValue: false,
74
+ childList: true,
75
+ subtree: true
76
+ });
77
+ function removeViewportStyles(ruleOrNode) {
78
+ if (ruleOrNode.style) {
79
+ ["width", "height", "minHeight", "maxHeight"].forEach(function(style2) {
80
+ if (/^\d*\.?\d+(?:vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test(ruleOrNode.style[style2])) {
81
+ ruleOrNode.style[style2] = "";
82
+ }
83
+ });
84
+ }
63
85
  }
86
+ Array.prototype.forEach.call(document.querySelectorAll("[style]"), removeViewportStyles);
87
+ Array.prototype.forEach.call(document.styleSheets, function(stylesheet) {
88
+ let rules;
89
+ try {
90
+ rules = stylesheet.cssRules || stylesheet.rules;
91
+ } catch {
92
+ return;
93
+ }
94
+ Array.prototype.forEach.call(rules, removeViewportStyles);
95
+ });
96
+ body.style.position = "absolute";
97
+ body.style.width = "100%";
98
+ body.setAttribute("data-resizable-iframe-connected", "");
99
+ sendResize();
64
100
  }
65
- Array.prototype.forEach.call(document.querySelectorAll("[style]"), removeViewportStyles);
66
- Array.prototype.forEach.call(document.styleSheets, function(stylesheet) {
67
- Array.prototype.forEach.call(stylesheet.cssRules || stylesheet.rules, removeViewportStyles);
68
- });
69
- document.body.style.position = "absolute";
70
- document.body.style.width = "100%";
71
- document.body.setAttribute("data-resizable-iframe-connected", "");
72
- sendResize();
101
+ window.addEventListener("load", sendResize, true);
73
102
  window.addEventListener("resize", sendResize, true);
103
+ if (document.body) {
104
+ connect();
105
+ } else {
106
+ document.addEventListener("DOMContentLoaded", connect);
107
+ }
74
108
  };
75
109
  var style = `
76
110
  body {
@@ -99,10 +133,11 @@ function buildSandBoxDocument({
99
133
  title,
100
134
  type,
101
135
  styles,
102
- scripts
136
+ scripts,
137
+ lang
103
138
  }) {
104
139
  const htmlDoc = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("html", {
105
- lang: document.documentElement.lang,
140
+ lang,
106
141
  className: type,
107
142
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("head", {
108
143
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", {
@@ -115,7 +150,12 @@ function buildSandBoxDocument({
115
150
  dangerouslySetInnerHTML: {
116
151
  __html: rules
117
152
  }
118
- }, i))]
153
+ }, i)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
154
+ type: "text/javascript",
155
+ dangerouslySetInnerHTML: {
156
+ __html: `(${observeAndResizeJS.toString()})();`
157
+ }
158
+ })]
119
159
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("body", {
120
160
  "data-resizable-iframe-connected": "data-resizable-iframe-connected",
121
161
  className: type,
@@ -123,11 +163,6 @@ function buildSandBoxDocument({
123
163
  dangerouslySetInnerHTML: {
124
164
  __html: html
125
165
  }
126
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
127
- type: "text/javascript",
128
- dangerouslySetInnerHTML: {
129
- __html: `(${observeAndResizeJS.toString()})();`
130
- }
131
166
  }), scripts.map((src) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
132
167
  src
133
168
  }, src))]
@@ -142,17 +177,25 @@ function IsolatedSandBox({
142
177
  styles = [],
143
178
  scripts = [],
144
179
  onFocus,
145
- tabIndex
180
+ tabIndex,
181
+ allowPopups = false
146
182
  }) {
147
183
  const ref = (0, import_element.useRef)(null);
148
184
  const [width, setWidth] = (0, import_element.useState)(0);
149
185
  const [height, setHeight] = (0, import_element.useState)(0);
186
+ const sandbox = (0, import_clsx.default)("allow-scripts", "allow-presentation", {
187
+ "allow-popups": allowPopups
188
+ });
150
189
  const srcDoc = (0, import_element.useMemo)(() => buildSandBoxDocument({
151
190
  html,
152
191
  title,
153
192
  type,
154
193
  styles,
155
- scripts
194
+ scripts,
195
+ // Read inside the memo: the `no-dom-globals-in-react-fc` lint
196
+ // rule forbids DOM globals in the render body. `lang` rarely
197
+ // changes after load, so leaving it out of the deps is fine.
198
+ lang: document.documentElement.lang
156
199
  }), [html, title, type, styles, scripts]);
157
200
  (0, import_element.useEffect)(() => {
158
201
  const iframe = ref.current;
@@ -198,7 +241,7 @@ function IsolatedSandBox({
198
241
  title,
199
242
  tabIndex,
200
243
  className: "components-sandbox",
201
- sandbox: "allow-scripts allow-presentation",
244
+ sandbox,
202
245
  srcDoc,
203
246
  onFocus,
204
247
  width: Math.ceil(width),
@@ -212,11 +255,15 @@ function SameOriginSandBox({
212
255
  styles = [],
213
256
  scripts = [],
214
257
  onFocus,
215
- tabIndex
258
+ tabIndex,
259
+ allowPopups = false
216
260
  }) {
217
261
  const ref = (0, import_element.useRef)(null);
218
262
  const [width, setWidth] = (0, import_element.useState)(0);
219
263
  const [height, setHeight] = (0, import_element.useState)(0);
264
+ const sandbox = (0, import_clsx.default)("allow-scripts", "allow-same-origin", "allow-presentation", {
265
+ "allow-popups": allowPopups
266
+ });
220
267
  function isFrameAccessible() {
221
268
  try {
222
269
  return !!ref.current?.contentDocument?.body;
@@ -235,40 +282,15 @@ function SameOriginSandBox({
235
282
  if (!forceRerender && null !== contentDocument?.body.getAttribute("data-resizable-iframe-connected")) {
236
283
  return;
237
284
  }
238
- const htmlDoc = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("html", {
239
- lang: ownerDocument.documentElement.lang,
240
- className: type,
241
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("head", {
242
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", {
243
- children: title
244
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", {
245
- dangerouslySetInnerHTML: {
246
- __html: style
247
- }
248
- }), styles.map((rules, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", {
249
- dangerouslySetInnerHTML: {
250
- __html: rules
251
- }
252
- }, i))]
253
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("body", {
254
- "data-resizable-iframe-connected": "data-resizable-iframe-connected",
255
- className: type,
256
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
257
- dangerouslySetInnerHTML: {
258
- __html: html
259
- }
260
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
261
- type: "text/javascript",
262
- dangerouslySetInnerHTML: {
263
- __html: `(${observeAndResizeJS.toString()})();`
264
- }
265
- }), scripts.map((src) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
266
- src
267
- }, src))]
268
- })]
269
- });
270
285
  contentDocument.open();
271
- contentDocument.write("<!DOCTYPE html>" + (0, import_element.renderToString)(htmlDoc));
286
+ contentDocument.write(buildSandBoxDocument({
287
+ html,
288
+ title,
289
+ type,
290
+ styles,
291
+ scripts,
292
+ lang: ownerDocument.documentElement.lang
293
+ }));
272
294
  contentDocument.close();
273
295
  }
274
296
  (0, import_element.useEffect)(() => {
@@ -314,7 +336,7 @@ function SameOriginSandBox({
314
336
  title,
315
337
  tabIndex,
316
338
  className: "components-sandbox",
317
- sandbox: "allow-scripts allow-same-origin allow-presentation",
339
+ sandbox,
318
340
  onFocus,
319
341
  width: Math.ceil(width),
320
342
  height: Math.ceil(height)
@@ -336,6 +358,7 @@ function SandBox({
336
358
  var sandbox_default = SandBox;
337
359
  // Annotate the CommonJS export names for ESM import in node:
338
360
  0 && (module.exports = {
339
- VIEWPORT_UNIT_VALUE_REGEX
361
+ VIEWPORT_UNIT_VALUE_REGEX,
362
+ buildSandBoxDocument
340
363
  });
341
364
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/sandbox/index.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { renderToString, useRef, useState, useEffect, useMemo } from '@wordpress/element';\nimport { useFocusableIframe, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/**\n * Matches CSS viewport-relative length values such as `100vh`, `50.5vw`,\n * and `.5dvh`. Used to strip viewport units from user-supplied HTML inside\n * the sandbox iframe, because those units are relative to the iframe's\n * own size and would create a measurement feedback loop with the\n * resize observer.\n *\n * Exported for tests. NOTE: an identical regex literal is duplicated\n * inside `observeAndResizeJS` below because that function is serialized\n * via `.toString()` and embedded into the iframe's `srcdoc` — it has no\n * access to this module's scope at runtime. If you change one, change\n * the other; the \"is embedded in the sandbox iframe srcdoc\" test\n * guards against drift.\n */\nexport const VIEWPORT_UNIT_VALUE_REGEX = /^\\d*\\.?\\d+(?:vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/;\nconst observeAndResizeJS = function () {\n const {\n MutationObserver\n } = window;\n if (!MutationObserver || !document.body || !window.parent) {\n return;\n }\n function sendResize() {\n const clientBoundingRect = document.body.getBoundingClientRect();\n window.parent.postMessage({\n action: 'resize',\n width: clientBoundingRect.width,\n height: clientBoundingRect.height\n }, '*');\n }\n const observer = new MutationObserver(sendResize);\n observer.observe(document.body, {\n attributes: true,\n attributeOldValue: false,\n characterData: true,\n characterDataOldValue: false,\n childList: true,\n subtree: true\n });\n window.addEventListener('load', sendResize, true);\n\n // Hack: Remove viewport unit styles, as these are relative\n // the iframe root and interfere with our mechanism for\n // determining the unconstrained page bounds.\n function removeViewportStyles(ruleOrNode) {\n if (ruleOrNode.style) {\n ['width', 'height', 'minHeight', 'maxHeight'].forEach(function (style) {\n if (/^\\d*\\.?\\d+(?:vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test(ruleOrNode.style[style])) {\n ruleOrNode.style[style] = '';\n }\n });\n }\n }\n Array.prototype.forEach.call(document.querySelectorAll('[style]'), removeViewportStyles);\n Array.prototype.forEach.call(document.styleSheets, function (stylesheet) {\n Array.prototype.forEach.call(stylesheet.cssRules || stylesheet.rules, removeViewportStyles);\n });\n document.body.style.position = 'absolute';\n document.body.style.width = '100%';\n document.body.setAttribute('data-resizable-iframe-connected', '');\n sendResize();\n\n // Resize events can change the width of elements with 100% width, but we don't\n // get an DOM mutations for that, so do the resize when the window is resized, too.\n window.addEventListener('resize', sendResize, true);\n};\n\n// TODO: These styles shouldn't be coupled with WordPress.\nconst style = `\n\tbody {\n\t\tmargin: 0;\n\t}\n\thtml,\n\tbody,\n\tbody > div {\n\t\twidth: 100%;\n\t}\n\thtml.wp-has-aspect-ratio,\n\tbody.wp-has-aspect-ratio,\n\tbody.wp-has-aspect-ratio > div,\n\tbody.wp-has-aspect-ratio > div iframe {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\toverflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */\n\t}\n\tbody > div > * {\n\t\tmargin-top: 0 !important; /* Has to have !important to override inline styles. */\n\t\tmargin-bottom: 0 !important;\n\t}\n`;\n\n/**\n * Builds the full HTML document string for the sandbox iframe content.\n */\nfunction buildSandBoxDocument({\n html,\n title,\n type,\n styles,\n scripts\n}) {\n const htmlDoc = /*#__PURE__*/_jsxs(\"html\", {\n lang: document.documentElement.lang,\n className: type,\n children: [/*#__PURE__*/_jsxs(\"head\", {\n children: [/*#__PURE__*/_jsx(\"title\", {\n children: title\n }), /*#__PURE__*/_jsx(\"style\", {\n dangerouslySetInnerHTML: {\n __html: style\n }\n }), styles.map((rules, i) => /*#__PURE__*/_jsx(\"style\", {\n dangerouslySetInnerHTML: {\n __html: rules\n }\n }, i))]\n }), /*#__PURE__*/_jsxs(\"body\", {\n \"data-resizable-iframe-connected\": \"data-resizable-iframe-connected\",\n className: type,\n children: [/*#__PURE__*/_jsx(\"div\", {\n dangerouslySetInnerHTML: {\n __html: html\n }\n }), /*#__PURE__*/_jsx(\"script\", {\n type: \"text/javascript\",\n dangerouslySetInnerHTML: {\n __html: `(${observeAndResizeJS.toString()})();`\n }\n }), scripts.map(src => /*#__PURE__*/_jsx(\"script\", {\n src: src\n }, src))]\n })]\n });\n return '<!DOCTYPE html>' + renderToString(htmlDoc);\n}\n\n/**\n * Isolated sandbox that uses the `srcdoc` attribute to render content\n * without `allow-same-origin`. This is the default for user-controlled\n * content (e.g., the HTML block) where same-origin access would be a\n * security risk.\n *\n * Because `srcdoc` is a declarative attribute, the browser automatically\n * re-renders the content when the iframe is moved in the DOM (e.g.,\n * block reordering), so no `load` event listener is needed.\n * The `message` listener is re-synced on every `load` so\n * it follows the iframe if it's reparented into a different document.\n */\nfunction IsolatedSandBox({\n html = '',\n title = '',\n type,\n styles = [],\n scripts = [],\n onFocus,\n tabIndex\n}) {\n const ref = useRef(null);\n const [width, setWidth] = useState(0);\n const [height, setHeight] = useState(0);\n const srcDoc = useMemo(() => buildSandBoxDocument({\n html,\n title,\n type,\n styles,\n scripts\n }), [html, title, type, styles, scripts]);\n useEffect(() => {\n const iframe = ref.current;\n if (!iframe) {\n return;\n }\n function checkMessageForResize(event) {\n // Verify that the mounted element is the source of the message.\n // iframe.contentWindow is accessible cross-origin as a\n // WindowProxy reference, so this check still works without\n // allow-same-origin.\n if (!iframe || iframe.contentWindow !== event.source) {\n return;\n }\n\n // Attempt to parse the message data as JSON if passed as string.\n let data = event.data || {};\n if ('string' === typeof data) {\n try {\n data = JSON.parse(data);\n } catch {}\n }\n\n // Update the state only if the message is formatted as we expect,\n // i.e. as an object with a 'resize' action.\n if ('resize' !== data.action) {\n return;\n }\n setWidth(data.width);\n setHeight(data.height);\n }\n let currentView = null;\n function syncListener() {\n const view = iframe?.ownerDocument?.defaultView ?? null;\n if (view === currentView) {\n return;\n }\n currentView?.removeEventListener('message', checkMessageForResize);\n currentView = view;\n currentView?.addEventListener('message', checkMessageForResize);\n }\n syncListener();\n iframe.addEventListener('load', syncListener);\n return () => {\n iframe.removeEventListener('load', syncListener);\n currentView?.removeEventListener('message', checkMessageForResize);\n };\n }, []);\n return /*#__PURE__*/_jsx(\"iframe\", {\n ref: useMergeRefs([ref, useFocusableIframe()]),\n title: title,\n tabIndex: tabIndex,\n className: \"components-sandbox\",\n sandbox: \"allow-scripts allow-presentation\",\n srcDoc: srcDoc,\n onFocus: onFocus,\n width: Math.ceil(width),\n height: Math.ceil(height)\n });\n}\n\n/**\n * Same-origin sandbox that writes to `contentDocument` directly. This\n * preserves the parent page's URL as the iframe's document URL, which\n * provides a valid Referer header for nested iframes (required by\n * providers like YouTube).\n *\n * Only used when `allowSameOrigin` is true — i.e., for server-fetched\n * oEmbed previews that are not directly user-controlled.\n *\n * This implementation is intentionally kept close to the original\n * pre-refactor code to preserve past bugfixes:\n * - load listener for iframe re-initialization after DOM moves (#21916)\n * - forceRerender guard to avoid unnecessary full rewrites (#20176)\n */\nfunction SameOriginSandBox({\n html = '',\n title = '',\n type,\n styles = [],\n scripts = [],\n onFocus,\n tabIndex\n}) {\n const ref = useRef(null);\n const [width, setWidth] = useState(0);\n const [height, setHeight] = useState(0);\n function isFrameAccessible() {\n try {\n return !!ref.current?.contentDocument?.body;\n } catch {\n return false;\n }\n }\n function trySandBox(forceRerender = false) {\n if (!isFrameAccessible()) {\n return;\n }\n const {\n contentDocument,\n ownerDocument\n } = ref.current;\n if (!forceRerender && null !== contentDocument?.body.getAttribute('data-resizable-iframe-connected')) {\n return;\n }\n\n // Put the html snippet into a html document, and then write it to the iframe's document\n // we can use this in the future to inject custom styles or scripts.\n // Scripts go into the body rather than the head, to support embedded content such as Instagram\n // that expect the scripts to be part of the body.\n const htmlDoc = /*#__PURE__*/_jsxs(\"html\", {\n lang: ownerDocument.documentElement.lang,\n className: type,\n children: [/*#__PURE__*/_jsxs(\"head\", {\n children: [/*#__PURE__*/_jsx(\"title\", {\n children: title\n }), /*#__PURE__*/_jsx(\"style\", {\n dangerouslySetInnerHTML: {\n __html: style\n }\n }), styles.map((rules, i) => /*#__PURE__*/_jsx(\"style\", {\n dangerouslySetInnerHTML: {\n __html: rules\n }\n }, i))]\n }), /*#__PURE__*/_jsxs(\"body\", {\n \"data-resizable-iframe-connected\": \"data-resizable-iframe-connected\",\n className: type,\n children: [/*#__PURE__*/_jsx(\"div\", {\n dangerouslySetInnerHTML: {\n __html: html\n }\n }), /*#__PURE__*/_jsx(\"script\", {\n type: \"text/javascript\",\n dangerouslySetInnerHTML: {\n __html: `(${observeAndResizeJS.toString()})();`\n }\n }), scripts.map(src => /*#__PURE__*/_jsx(\"script\", {\n src: src\n }, src))]\n })]\n });\n\n // Writing the document like this makes it act in the same way as if it was\n // loaded over the network, so DOM creation and mutation, script execution, etc.\n // all work as expected.\n contentDocument.open();\n contentDocument.write('<!DOCTYPE html>' + renderToString(htmlDoc));\n contentDocument.close();\n }\n useEffect(() => {\n trySandBox();\n function tryNoForceSandBox() {\n trySandBox(false);\n }\n function checkMessageForResize(event) {\n const iframe = ref.current;\n\n // Verify that the mounted element is the source of the message.\n if (!iframe || iframe.contentWindow !== event.source) {\n return;\n }\n\n // Attempt to parse the message data as JSON if passed as string.\n let data = event.data || {};\n if ('string' === typeof data) {\n try {\n data = JSON.parse(data);\n } catch {}\n }\n\n // Update the state only if the message is formatted as we expect,\n // i.e. as an object with a 'resize' action.\n if ('resize' !== data.action) {\n return;\n }\n setWidth(data.width);\n setHeight(data.height);\n }\n const iframe = ref.current;\n const defaultView = iframe?.ownerDocument?.defaultView;\n\n // This used to be registered using <iframe onLoad={} />, but it made the iframe blank\n // after reordering the containing block. See these two issues for more details:\n // https://github.com/WordPress/gutenberg/issues/6146\n // https://github.com/facebook/react/issues/18752\n iframe?.addEventListener('load', tryNoForceSandBox, false);\n defaultView?.addEventListener('message', checkMessageForResize);\n return () => {\n iframe?.removeEventListener('load', tryNoForceSandBox, false);\n defaultView?.removeEventListener('message', checkMessageForResize);\n };\n // Passing `exhaustive-deps` will likely involve a more detailed refactor.\n // See https://github.com/WordPress/gutenberg/pull/44378\n }, []);\n useEffect(() => {\n trySandBox();\n // Passing `exhaustive-deps` will likely involve a more detailed refactor.\n // See https://github.com/WordPress/gutenberg/pull/44378\n }, [title, styles, scripts]);\n useEffect(() => {\n trySandBox(true);\n // Passing `exhaustive-deps` will likely involve a more detailed refactor.\n // See https://github.com/WordPress/gutenberg/pull/44378\n }, [html, type]);\n return /*#__PURE__*/_jsx(\"iframe\", {\n ref: useMergeRefs([ref, useFocusableIframe()]),\n title: title,\n tabIndex: tabIndex,\n className: \"components-sandbox\",\n sandbox: \"allow-scripts allow-same-origin allow-presentation\",\n onFocus: onFocus,\n width: Math.ceil(width),\n height: Math.ceil(height)\n });\n}\n\n/**\n * This component provides an isolated environment for arbitrary HTML via iframes.\n *\n * ```jsx\n * import { SandBox } from '@wordpress/components';\n *\n * const MySandBox = () => (\n * \t<SandBox html=\"<p>Content</p>\" title=\"SandBox\" type=\"embed\" />\n * );\n * ```\n */\nfunction SandBox({\n allowSameOrigin = false,\n ...contentProps\n}) {\n if (allowSameOrigin) {\n return /*#__PURE__*/_jsx(SameOriginSandBox, {\n ...contentProps\n });\n }\n return /*#__PURE__*/_jsx(IsolatedSandBox, {\n ...contentProps\n });\n}\nexport default SandBox;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAqE;AACrE,qBAAiD;AAKjD,yBAA2C;AAepC,IAAM,4BAA4B;AACzC,IAAM,qBAAqB,WAAY;AACrC,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AACJ,MAAI,CAAC,oBAAoB,CAAC,SAAS,QAAQ,CAAC,OAAO,QAAQ;AACzD;AAAA,EACF;AACA,WAAS,aAAa;AACpB,UAAM,qBAAqB,SAAS,KAAK,sBAAsB;AAC/D,WAAO,OAAO,YAAY;AAAA,MACxB,QAAQ;AAAA,MACR,OAAO,mBAAmB;AAAA,MAC1B,QAAQ,mBAAmB;AAAA,IAC7B,GAAG,GAAG;AAAA,EACR;AACA,QAAM,WAAW,IAAI,iBAAiB,UAAU;AAChD,WAAS,QAAQ,SAAS,MAAM;AAAA,IAC9B,YAAY;AAAA,IACZ,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,WAAW;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AACD,SAAO,iBAAiB,Q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A,EAC1B,CAAC;AACH;AAaA,SAAS,QAAQ;AAAA,EACf,kBAAkB;AAAA,EAClB,GAAG;AACL,GAAG;AACD,MAAI,iBAAiB;AACnB,WAAoB,uCAAAA,KAAK,mBAAmB;AAAA,MAC1C,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,SAAoB,uCAAAA,KAAK,iBAAiB;AAAA,IACxC,GAAG;AAAA,EACL,CAAC;AACH;AACA,IAAO,kBAAQ;",
6
- "names": ["style", "_jsxs", "_jsx", "iframe"]
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { renderToString, useRef, useState, useEffect, useMemo } from '@wordpress/element';\nimport { useFocusableIframe, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/**\n * Matches CSS viewport-relative length values such as `100vh`, `50.5vw`,\n * and `.5dvh`. Used to strip viewport units from user-supplied HTML inside\n * the sandbox iframe, because those units are relative to the iframe's\n * own size and would create a measurement feedback loop with the\n * resize observer.\n *\n * Exported for tests. NOTE: an identical regex literal is duplicated\n * inside `observeAndResizeJS` below because that function is serialized\n * via `.toString()` and embedded into the iframe's `srcdoc` — it has no\n * access to this module's scope at runtime. If you change one, change\n * the other; the \"is embedded in the sandbox iframe srcdoc\" test\n * guards against drift.\n */\nexport const VIEWPORT_UNIT_VALUE_REGEX = /^\\d*\\.?\\d+(?:vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/;\nconst observeAndResizeJS = function () {\n const {\n MutationObserver\n } = window;\n if (!MutationObserver || !window.parent) {\n return;\n }\n function sendResize() {\n // This runs in the document <head>, and as a `load`/`resize` listener,\n // so the body may not exist yet. Bail rather than throw on a null body.\n if (!document.body) {\n return;\n }\n const clientBoundingRect = document.body.getBoundingClientRect();\n window.parent.postMessage({\n action: 'resize',\n width: clientBoundingRect.width,\n height: clientBoundingRect.height\n }, '*');\n }\n\n // Runs the body-dependent setup once the document body is available. Reads\n // `document.body` into a local so the null check narrows it for the rest of\n // the function: this runs in <head> and via DOMContentLoaded, so the body\n // isn't guaranteed to exist yet.\n function connect() {\n const {\n body\n } = document;\n if (!body) {\n return;\n }\n const observer = new MutationObserver(sendResize);\n observer.observe(body, {\n attributes: true,\n attributeOldValue: false,\n characterData: true,\n characterDataOldValue: false,\n childList: true,\n subtree: true\n });\n\n // Hack: Remove viewport unit styles, as these are relative\n // the iframe root and interfere with our mechanism for\n // determining the unconstrained page bounds.\n function removeViewportStyles(ruleOrNode) {\n if (ruleOrNode.style) {\n ['width', 'height', 'minHeight', 'maxHeight'].forEach(function (style) {\n if (/^\\d*\\.?\\d+(?:vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test(ruleOrNode.style[style])) {\n ruleOrNode.style[style] = '';\n }\n });\n }\n }\n Array.prototype.forEach.call(document.querySelectorAll('[style]'), removeViewportStyles);\n Array.prototype.forEach.call(document.styleSheets, function (stylesheet) {\n let rules;\n try {\n rules = stylesheet.cssRules || stylesheet.rules;\n } catch {\n // Reading `cssRules` throws a SecurityError for a\n // cross-origin stylesheet (e.g. a remote <link> in the\n // user's HTML). Skip those rather than aborting the setup.\n return;\n }\n Array.prototype.forEach.call(rules, removeViewportStyles);\n });\n body.style.position = 'absolute';\n body.style.width = '100%';\n body.setAttribute('data-resizable-iframe-connected', '');\n sendResize();\n }\n window.addEventListener('load', sendResize, true);\n\n // Resize events can change the width of elements with 100% width, but we don't\n // get an DOM mutations for that, so do the resize when the window is resized, too.\n window.addEventListener('resize', sendResize, true);\n\n // This script is injected into the document <head> so it parses before the\n // (possibly malformed) user content in <body>: an unclosed attribute quote\n // in that content can't then swallow this <script> tag and dump its source\n // into the preview as visible text. Because <head> runs before <body>\n // exists, defer the body-dependent setup until the DOM is ready.\n if (document.body) {\n connect();\n } else {\n document.addEventListener('DOMContentLoaded', connect);\n }\n};\n\n// TODO: These styles shouldn't be coupled with WordPress.\nconst style = `\n\tbody {\n\t\tmargin: 0;\n\t}\n\thtml,\n\tbody,\n\tbody > div {\n\t\twidth: 100%;\n\t}\n\thtml.wp-has-aspect-ratio,\n\tbody.wp-has-aspect-ratio,\n\tbody.wp-has-aspect-ratio > div,\n\tbody.wp-has-aspect-ratio > div iframe {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\toverflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */\n\t}\n\tbody > div > * {\n\t\tmargin-top: 0 !important; /* Has to have !important to override inline styles. */\n\t\tmargin-bottom: 0 !important;\n\t}\n`;\n\n/**\n * Builds the full HTML document string for the sandbox iframe content. Shared\n * by both the isolated (`srcdoc`) and same-origin (`contentDocument.write`)\n * sandboxes so the two paths always emit the same markup — notably keeping the\n * resize script in `<head>`, ahead of the user content, on both. A single\n * builder means the write path cannot drift back to putting the script in\n * `<body>` while the `srcdoc` path keeps it in `<head>`.\n *\n * `lang` is passed in rather than read here because the two callers source it\n * from different documents: the isolated sandbox uses the module's `document`,\n * while the same-origin sandbox uses the iframe's `ownerDocument`. They are\n * normally the same document, but keeping the argument preserves each path's\n * exact prior behavior.\n *\n * Exported for tests.\n *\n * @param props\n * @param props.html User-supplied HTML for the iframe body.\n * @param props.title Document title.\n * @param props.type Optional class name for the `<html>`/`<body>` elements.\n * @param props.styles CSS rule strings, injected as `<style>` tags in the head.\n * @param props.scripts External script URLs, injected as `<script src>` in the\n * body (embeds expect their scripts there).\n * @param props.lang Language for the `<html lang>` attribute.\n * @return The full `<!DOCTYPE html>…` document string.\n */\nexport function buildSandBoxDocument({\n html,\n title,\n type,\n styles,\n scripts,\n lang\n}) {\n const htmlDoc = /*#__PURE__*/_jsxs(\"html\", {\n lang: lang,\n className: type,\n children: [/*#__PURE__*/_jsxs(\"head\", {\n children: [/*#__PURE__*/_jsx(\"title\", {\n children: title\n }), /*#__PURE__*/_jsx(\"style\", {\n dangerouslySetInnerHTML: {\n __html: style\n }\n }), styles.map((rules, i) => /*#__PURE__*/_jsx(\"style\", {\n dangerouslySetInnerHTML: {\n __html: rules\n }\n }, i)), /*#__PURE__*/_jsx(\"script\", {\n type: \"text/javascript\",\n dangerouslySetInnerHTML: {\n __html: `(${observeAndResizeJS.toString()})();`\n }\n })]\n }), /*#__PURE__*/_jsxs(\"body\", {\n \"data-resizable-iframe-connected\": \"data-resizable-iframe-connected\",\n className: type,\n children: [/*#__PURE__*/_jsx(\"div\", {\n dangerouslySetInnerHTML: {\n __html: html\n }\n }), scripts.map(src => /*#__PURE__*/_jsx(\"script\", {\n src: src\n }, src))]\n })]\n });\n return '<!DOCTYPE html>' + renderToString(htmlDoc);\n}\n\n/**\n * Isolated sandbox that uses the `srcdoc` attribute to render content\n * without `allow-same-origin`. This is the default for user-controlled\n * content (e.g., the HTML block) where same-origin access would be a\n * security risk.\n *\n * Because `srcdoc` is a declarative attribute, the browser automatically\n * re-renders the content when the iframe is moved in the DOM (e.g.,\n * block reordering), so no `load` event listener is needed.\n * The `message` listener is re-synced on every `load` so\n * it follows the iframe if it's reparented into a different document.\n */\nfunction IsolatedSandBox({\n html = '',\n title = '',\n type,\n styles = [],\n scripts = [],\n onFocus,\n tabIndex,\n allowPopups = false\n}) {\n const ref = useRef(null);\n const [width, setWidth] = useState(0);\n const [height, setHeight] = useState(0);\n const sandbox = clsx('allow-scripts', 'allow-presentation', {\n 'allow-popups': allowPopups\n });\n const srcDoc = useMemo(() => buildSandBoxDocument({\n html,\n title,\n type,\n styles,\n scripts,\n // Read inside the memo: the `no-dom-globals-in-react-fc` lint\n // rule forbids DOM globals in the render body. `lang` rarely\n // changes after load, so leaving it out of the deps is fine.\n lang: document.documentElement.lang\n }), [html, title, type, styles, scripts]);\n useEffect(() => {\n const iframe = ref.current;\n if (!iframe) {\n return;\n }\n function checkMessageForResize(event) {\n // Verify that the mounted element is the source of the message.\n // iframe.contentWindow is accessible cross-origin as a\n // WindowProxy reference, so this check still works without\n // allow-same-origin.\n if (!iframe || iframe.contentWindow !== event.source) {\n return;\n }\n\n // Attempt to parse the message data as JSON if passed as string.\n let data = event.data || {};\n if ('string' === typeof data) {\n try {\n data = JSON.parse(data);\n } catch {}\n }\n\n // Update the state only if the message is formatted as we expect,\n // i.e. as an object with a 'resize' action.\n if ('resize' !== data.action) {\n return;\n }\n setWidth(data.width);\n setHeight(data.height);\n }\n let currentView = null;\n function syncListener() {\n const view = iframe?.ownerDocument?.defaultView ?? null;\n if (view === currentView) {\n return;\n }\n currentView?.removeEventListener('message', checkMessageForResize);\n currentView = view;\n currentView?.addEventListener('message', checkMessageForResize);\n }\n syncListener();\n iframe.addEventListener('load', syncListener);\n return () => {\n iframe.removeEventListener('load', syncListener);\n currentView?.removeEventListener('message', checkMessageForResize);\n };\n }, []);\n return /*#__PURE__*/_jsx(\"iframe\", {\n ref: useMergeRefs([ref, useFocusableIframe()]),\n title: title,\n tabIndex: tabIndex,\n className: \"components-sandbox\",\n sandbox: sandbox,\n srcDoc: srcDoc,\n onFocus: onFocus,\n width: Math.ceil(width),\n height: Math.ceil(height)\n });\n}\n\n/**\n * Same-origin sandbox that writes to `contentDocument` directly. This\n * preserves the parent page's URL as the iframe's document URL, which\n * provides a valid Referer header for nested iframes (required by\n * providers like YouTube).\n *\n * Only used when `allowSameOrigin` is true — i.e., for server-fetched\n * oEmbed previews that are not directly user-controlled.\n *\n * This implementation is intentionally kept close to the original\n * pre-refactor code to preserve past bugfixes:\n * - load listener for iframe re-initialization after DOM moves (#21916)\n * - forceRerender guard to avoid unnecessary full rewrites (#20176)\n */\nfunction SameOriginSandBox({\n html = '',\n title = '',\n type,\n styles = [],\n scripts = [],\n onFocus,\n tabIndex,\n allowPopups = false\n}) {\n const ref = useRef(null);\n const [width, setWidth] = useState(0);\n const [height, setHeight] = useState(0);\n const sandbox = clsx('allow-scripts', 'allow-same-origin', 'allow-presentation', {\n 'allow-popups': allowPopups\n });\n function isFrameAccessible() {\n try {\n return !!ref.current?.contentDocument?.body;\n } catch {\n return false;\n }\n }\n function trySandBox(forceRerender = false) {\n if (!isFrameAccessible()) {\n return;\n }\n const {\n contentDocument,\n ownerDocument\n } = ref.current;\n if (!forceRerender && null !== contentDocument?.body.getAttribute('data-resizable-iframe-connected')) {\n return;\n }\n\n // Put the html snippet into a html document, and then write it to the\n // iframe's document. The external `scripts` still go into the body to\n // support embedded content such as Instagram that expects them there;\n // only the resize helper lives in the head.\n //\n // Writing the document like this makes it act in the same way as if it\n // was loaded over the network, so DOM creation and mutation, script\n // execution, etc. all work as expected.\n contentDocument.open();\n contentDocument.write(buildSandBoxDocument({\n html,\n title,\n type,\n styles,\n scripts,\n lang: ownerDocument.documentElement.lang\n }));\n contentDocument.close();\n }\n useEffect(() => {\n trySandBox();\n function tryNoForceSandBox() {\n trySandBox(false);\n }\n function checkMessageForResize(event) {\n const iframe = ref.current;\n\n // Verify that the mounted element is the source of the message.\n if (!iframe || iframe.contentWindow !== event.source) {\n return;\n }\n\n // Attempt to parse the message data as JSON if passed as string.\n let data = event.data || {};\n if ('string' === typeof data) {\n try {\n data = JSON.parse(data);\n } catch {}\n }\n\n // Update the state only if the message is formatted as we expect,\n // i.e. as an object with a 'resize' action.\n if ('resize' !== data.action) {\n return;\n }\n setWidth(data.width);\n setHeight(data.height);\n }\n const iframe = ref.current;\n const defaultView = iframe?.ownerDocument?.defaultView;\n\n // This used to be registered using <iframe onLoad={} />, but it made the iframe blank\n // after reordering the containing block. See these two issues for more details:\n // https://github.com/WordPress/gutenberg/issues/6146\n // https://github.com/facebook/react/issues/18752\n iframe?.addEventListener('load', tryNoForceSandBox, false);\n defaultView?.addEventListener('message', checkMessageForResize);\n return () => {\n iframe?.removeEventListener('load', tryNoForceSandBox, false);\n defaultView?.removeEventListener('message', checkMessageForResize);\n };\n // Passing `exhaustive-deps` will likely involve a more detailed refactor.\n // See https://github.com/WordPress/gutenberg/pull/44378\n }, []);\n useEffect(() => {\n trySandBox();\n // Passing `exhaustive-deps` will likely involve a more detailed refactor.\n // See https://github.com/WordPress/gutenberg/pull/44378\n }, [title, styles, scripts]);\n useEffect(() => {\n trySandBox(true);\n // Passing `exhaustive-deps` will likely involve a more detailed refactor.\n // See https://github.com/WordPress/gutenberg/pull/44378\n }, [html, type]);\n return /*#__PURE__*/_jsx(\"iframe\", {\n ref: useMergeRefs([ref, useFocusableIframe()]),\n title: title,\n tabIndex: tabIndex,\n className: \"components-sandbox\",\n sandbox: sandbox,\n onFocus: onFocus,\n width: Math.ceil(width),\n height: Math.ceil(height)\n });\n}\n\n/**\n * This component provides an isolated environment for arbitrary HTML via iframes.\n *\n * ```jsx\n * import { SandBox } from '@wordpress/components';\n *\n * const MySandBox = () => (\n * \t<SandBox html=\"<p>Content</p>\" title=\"SandBox\" type=\"embed\" />\n * );\n * ```\n */\nfunction SandBox({\n allowSameOrigin = false,\n ...contentProps\n}) {\n if (allowSameOrigin) {\n return /*#__PURE__*/_jsx(SameOriginSandBox, {\n ...contentProps\n });\n }\n return /*#__PURE__*/_jsx(IsolatedSandBox, {\n ...contentProps\n });\n}\nexport default SandBox;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAqE;AACrE,qBAAiD;AAKjD,yBAA2C;AAepC,IAAM,4BAA4B;AACzC,IAAM,qBAAqB,WAAY;AACrC,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AACJ,MAAI,CAAC,oBAAoB,CAAC,OAAO,QAAQ;AACvC;AAAA,EACF;AACA,WAAS,aAAa;AAGpB,QAAI,CAAC,SAAS,MAAM;AAClB;AAAA,IACF;AACA,UAAM,qBAAqB,SAAS,KAAK,sBAAsB;AAC/D,WAAO,OAAO,YAAY;AAAA,MACxB,QAAQ;AA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AQ;AAAA,EACf,kBAAkB;AAAA,EAClB,GAAG;AACL,GAAG;AACD,MAAI,iBAAiB;AACnB,WAAoB,uCAAAA,KAAK,mBAAmB;AAAA,MAC1C,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,SAAoB,uCAAAA,KAAK,iBAAiB;AAAA,IACxC,GAAG;AAAA,EACL,CAAC;AACH;AACA,IAAO,kBAAQ;",
6
+ "names": ["style", "_jsxs", "_jsx", "clsx", "iframe"]
7
7
  }
@@ -41,19 +41,101 @@ var import_icons = require("@wordpress/icons");
41
41
  var import_element = require("@wordpress/element");
42
42
  var import_deprecated = __toESM(require("@wordpress/deprecated"));
43
43
  var import_button = __toESM(require("../button/index.cjs"));
44
+ var import_input_control = __toESM(require("../input-control/index.cjs"));
45
+ var import_icon = __toESM(require("../icon/index.cjs"));
44
46
  var import_input_prefix_wrapper = require("../input-control/input-prefix-wrapper.cjs");
45
47
  var import_input_suffix_wrapper = require("../input-control/input-suffix-wrapper.cjs");
46
- var import_styles = require("./styles.cjs");
48
+
49
+ // packages/style-runtime/src/index.ts
50
+ var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
51
+ function getRuntime() {
52
+ const globalScope = globalThis;
53
+ if (globalScope.__wpStyleRuntime) {
54
+ return globalScope.__wpStyleRuntime;
55
+ }
56
+ globalScope.__wpStyleRuntime = {
57
+ documents: /* @__PURE__ */ new Map(),
58
+ styles: /* @__PURE__ */ new Map(),
59
+ injectedStyles: /* @__PURE__ */ new WeakMap()
60
+ };
61
+ if (typeof document !== "undefined") {
62
+ registerDocument(document);
63
+ }
64
+ return globalScope.__wpStyleRuntime;
65
+ }
66
+ function documentContainsStyleHash(targetDocument, hash) {
67
+ if (!targetDocument.head) {
68
+ return false;
69
+ }
70
+ for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {
71
+ if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
72
+ return true;
73
+ }
74
+ }
75
+ return false;
76
+ }
77
+ function injectStyle(targetDocument, hash, css) {
78
+ if (!targetDocument.head) {
79
+ return;
80
+ }
81
+ const runtime = getRuntime();
82
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
83
+ if (!injectedStyles) {
84
+ injectedStyles = /* @__PURE__ */ new Set();
85
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
86
+ }
87
+ if (injectedStyles.has(hash)) {
88
+ return;
89
+ }
90
+ if (documentContainsStyleHash(targetDocument, hash)) {
91
+ injectedStyles.add(hash);
92
+ return;
93
+ }
94
+ const style = targetDocument.createElement("style");
95
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
96
+ style.appendChild(targetDocument.createTextNode(css));
97
+ targetDocument.head.appendChild(style);
98
+ injectedStyles.add(hash);
99
+ }
100
+ function registerDocument(targetDocument) {
101
+ const runtime = getRuntime();
102
+ runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);
103
+ for (const [hash, css] of runtime.styles) {
104
+ injectStyle(targetDocument, hash, css);
105
+ }
106
+ return () => {
107
+ const count = runtime.documents.get(targetDocument);
108
+ if (count === void 0) {
109
+ return;
110
+ }
111
+ if (count <= 1) {
112
+ runtime.documents.delete(targetDocument);
113
+ return;
114
+ }
115
+ runtime.documents.set(targetDocument, count - 1);
116
+ };
117
+ }
118
+ function registerStyle(hash, css) {
119
+ const runtime = getRuntime();
120
+ runtime.styles.set(hash, css);
121
+ for (const targetDocument of runtime.documents.keys()) {
122
+ injectStyle(targetDocument, hash, css);
123
+ }
124
+ }
125
+
126
+ // packages/components/src/search-control/style.module.scss
127
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
128
+ registerStyle("77f847972d", "._5e6152f7430df331__input input[type=search]::-webkit-search-cancel-button,._5e6152f7430df331__input input[type=search]::-webkit-search-decoration,._5e6152f7430df331__input input[type=search]::-webkit-search-results-button,._5e6152f7430df331__input input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}._9a856163f1b1aaae__icon:dir(ltr){transform:scaleX(-1)}");
129
+ }
130
+ var style_module_default = { "input": "_5e6152f7430df331__input", "icon": "_9a856163f1b1aaae__icon" };
131
+
132
+ // packages/components/src/search-control/index.tsx
47
133
  var import_jsx_runtime = require("react/jsx-runtime");
48
134
  function SuffixItem({
49
135
  searchRef,
50
- value,
51
136
  onChange,
52
137
  onClose
53
138
  }) {
54
- if (!onClose && !value) {
55
- return null;
56
- }
57
139
  if (onClose) {
58
140
  (0, import_deprecated.default)("`onClose` prop in wp.components.SearchControl", {
59
141
  since: "6.8"
@@ -93,29 +175,29 @@ function UnforwardedSearchControl({
93
175
  } = restProps;
94
176
  const searchRef = (0, import_element.useRef)(null);
95
177
  const instanceId = (0, import_compose.useInstanceId)(SearchControl, "components-search-control");
96
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledInputControl, {
97
- __next40pxDefaultSize: true,
178
+ const hasSuffix = !!onClose || !!value;
179
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_control.default, {
98
180
  id: instanceId,
99
181
  hideLabelFromVision,
100
182
  label,
101
183
  ref: (0, import_compose.useMergeRefs)([searchRef, forwardedRef]),
102
184
  type: "search",
103
185
  size,
104
- className: (0, import_clsx.default)("components-search-control", className),
186
+ className: (0, import_clsx.default)(style_module_default.input, "components-search-control", className),
105
187
  onChange: (nextValue) => onChange(nextValue ?? ""),
106
188
  autoComplete: "off",
107
189
  placeholder,
108
190
  value: value ?? "",
109
191
  prefix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_prefix_wrapper.InputControlPrefixWrapper, {
110
192
  variant: "icon",
111
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledIcon, {
193
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.default, {
194
+ className: style_module_default.icon,
112
195
  icon: import_icons.search,
113
196
  fill: "currentColor"
114
197
  })
115
198
  }),
116
- suffix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SuffixItem, {
199
+ suffix: hasSuffix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SuffixItem, {
117
200
  searchRef,
118
- value,
119
201
  onChange,
120
202
  onClose
121
203
  }),