@wordpress/components 32.2.1-next.v.202602111440.0 → 32.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (588) hide show
  1. package/CHANGELOG.md +46 -1
  2. package/CLAUDE.md +1 -0
  3. package/build/alignment-matrix-control/cell.cjs +2 -2
  4. package/build/alignment-matrix-control/cell.cjs.map +1 -1
  5. package/build/alignment-matrix-control/index.cjs +2 -2
  6. package/build/alignment-matrix-control/index.cjs.map +1 -1
  7. package/build/angle-picker-control/angle-circle.cjs +4 -4
  8. package/build/angle-picker-control/angle-circle.cjs.map +2 -2
  9. package/build/autocomplete/index.cjs +16 -8
  10. package/build/autocomplete/index.cjs.map +2 -2
  11. package/build/clipboard-button/index.cjs +1 -1
  12. package/build/clipboard-button/index.cjs.map +2 -2
  13. package/build/color-picker/color-copy-button.cjs +1 -1
  14. package/build/color-picker/color-copy-button.cjs.map +2 -2
  15. package/build/confirm-dialog/component.cjs +2 -2
  16. package/build/confirm-dialog/component.cjs.map +2 -2
  17. package/build/context/context-system-provider.cjs.map +1 -1
  18. package/build/custom-gradient-picker/gradient-bar/control-points.cjs +2 -2
  19. package/build/custom-gradient-picker/gradient-bar/control-points.cjs.map +2 -2
  20. package/build/date-time/date/index.cjs +1 -1
  21. package/build/date-time/date/index.cjs.map +2 -2
  22. package/build/date-time/time/index.cjs +1 -1
  23. package/build/date-time/time/index.cjs.map +2 -2
  24. package/build/date-time/utils.cjs +9 -0
  25. package/build/date-time/utils.cjs.map +2 -2
  26. package/build/dropdown/index.cjs +1 -1
  27. package/build/dropdown/index.cjs.map +2 -2
  28. package/build/external-link/index.cjs +5 -1
  29. package/build/external-link/index.cjs.map +2 -2
  30. package/build/higher-order/with-spoken-messages/index.cjs.map +2 -2
  31. package/build/modal/index.cjs +2 -2
  32. package/build/modal/index.cjs.map +2 -2
  33. package/build/modal/use-modal-exit-animation.cjs +2 -2
  34. package/build/modal/use-modal-exit-animation.cjs.map +2 -2
  35. package/build/number-control/index.cjs +1 -1
  36. package/build/number-control/index.cjs.map +2 -2
  37. package/build/palette-edit/index.cjs +1 -1
  38. package/build/palette-edit/index.cjs.map +2 -2
  39. package/build/panel/body.cjs +1 -1
  40. package/build/panel/body.cjs.map +2 -2
  41. package/build/private-apis.cjs +0 -2
  42. package/build/private-apis.cjs.map +2 -2
  43. package/build/range-control/index.cjs +1 -1
  44. package/build/range-control/index.cjs.map +2 -2
  45. package/build/resizable-box/resize-tooltip/utils.cjs +1 -1
  46. package/build/resizable-box/resize-tooltip/utils.cjs.map +2 -2
  47. package/build/sandbox/index.cjs +126 -2
  48. package/build/sandbox/index.cjs.map +2 -2
  49. package/build/select-control/styles/select-control-styles.cjs +8 -8
  50. package/build/select-control/styles/select-control-styles.cjs.map +2 -2
  51. package/build/snackbar/list.cjs +4 -1
  52. package/build/snackbar/list.cjs.map +2 -2
  53. package/build/tabs/styles.cjs +5 -5
  54. package/build/tabs/styles.cjs.map +2 -2
  55. package/build/text/utils.cjs.map +1 -1
  56. package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs +8 -8
  57. package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs.map +2 -2
  58. package/build/tree-grid/roving-tab-index-item.cjs +1 -1
  59. package/build/tree-grid/roving-tab-index-item.cjs.map +2 -2
  60. package/build/utils/element-rect.cjs +1 -1
  61. package/build/utils/element-rect.cjs.map +2 -2
  62. package/build/utils/hooks/use-update-effect.cjs.map +1 -1
  63. package/build/utils/rtl.cjs +2 -2
  64. package/build/utils/rtl.cjs.map +2 -2
  65. package/build/utils/use-responsive-value.cjs +1 -7
  66. package/build/utils/use-responsive-value.cjs.map +2 -2
  67. package/build/validated-form-controls/control-with-error.cjs +26 -3
  68. package/build/validated-form-controls/control-with-error.cjs.map +2 -2
  69. package/build/validated-form-controls/validity-indicator.cjs +2 -0
  70. package/build/validated-form-controls/validity-indicator.cjs.map +2 -2
  71. package/build-module/alignment-matrix-control/cell.mjs +2 -2
  72. package/build-module/alignment-matrix-control/cell.mjs.map +1 -1
  73. package/build-module/alignment-matrix-control/index.mjs +2 -2
  74. package/build-module/alignment-matrix-control/index.mjs.map +1 -1
  75. package/build-module/angle-picker-control/angle-circle.mjs +4 -4
  76. package/build-module/angle-picker-control/angle-circle.mjs.map +2 -2
  77. package/build-module/autocomplete/index.mjs +14 -7
  78. package/build-module/autocomplete/index.mjs.map +2 -2
  79. package/build-module/clipboard-button/index.mjs +1 -1
  80. package/build-module/clipboard-button/index.mjs.map +2 -2
  81. package/build-module/color-picker/color-copy-button.mjs +1 -1
  82. package/build-module/color-picker/color-copy-button.mjs.map +2 -2
  83. package/build-module/confirm-dialog/component.mjs +2 -2
  84. package/build-module/confirm-dialog/component.mjs.map +2 -2
  85. package/build-module/context/context-system-provider.mjs.map +1 -1
  86. package/build-module/custom-gradient-picker/gradient-bar/control-points.mjs +2 -2
  87. package/build-module/custom-gradient-picker/gradient-bar/control-points.mjs.map +2 -2
  88. package/build-module/date-time/date/index.mjs +1 -1
  89. package/build-module/date-time/date/index.mjs.map +2 -2
  90. package/build-module/date-time/time/index.mjs +2 -2
  91. package/build-module/date-time/time/index.mjs.map +2 -2
  92. package/build-module/date-time/utils.mjs +8 -0
  93. package/build-module/date-time/utils.mjs.map +2 -2
  94. package/build-module/dropdown/index.mjs +1 -1
  95. package/build-module/dropdown/index.mjs.map +2 -2
  96. package/build-module/external-link/index.mjs +5 -1
  97. package/build-module/external-link/index.mjs.map +2 -2
  98. package/build-module/higher-order/with-spoken-messages/index.mjs.map +2 -2
  99. package/build-module/modal/index.mjs +2 -2
  100. package/build-module/modal/index.mjs.map +2 -2
  101. package/build-module/modal/use-modal-exit-animation.mjs +2 -2
  102. package/build-module/modal/use-modal-exit-animation.mjs.map +2 -2
  103. package/build-module/number-control/index.mjs +1 -1
  104. package/build-module/number-control/index.mjs.map +2 -2
  105. package/build-module/palette-edit/index.mjs +1 -1
  106. package/build-module/palette-edit/index.mjs.map +2 -2
  107. package/build-module/panel/body.mjs +1 -1
  108. package/build-module/panel/body.mjs.map +2 -2
  109. package/build-module/private-apis.mjs +0 -2
  110. package/build-module/private-apis.mjs.map +2 -2
  111. package/build-module/range-control/index.mjs +1 -1
  112. package/build-module/range-control/index.mjs.map +2 -2
  113. package/build-module/resizable-box/resize-tooltip/utils.mjs +1 -1
  114. package/build-module/resizable-box/resize-tooltip/utils.mjs.map +2 -2
  115. package/build-module/sandbox/index.mjs +127 -3
  116. package/build-module/sandbox/index.mjs.map +2 -2
  117. package/build-module/select-control/styles/select-control-styles.mjs +8 -8
  118. package/build-module/select-control/styles/select-control-styles.mjs.map +2 -2
  119. package/build-module/snackbar/list.mjs +4 -1
  120. package/build-module/snackbar/list.mjs.map +2 -2
  121. package/build-module/tabs/styles.mjs +5 -5
  122. package/build-module/tabs/styles.mjs.map +2 -2
  123. package/build-module/text/utils.mjs.map +1 -1
  124. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs +8 -8
  125. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs.map +2 -2
  126. package/build-module/tree-grid/roving-tab-index-item.mjs +1 -1
  127. package/build-module/tree-grid/roving-tab-index-item.mjs.map +2 -2
  128. package/build-module/utils/element-rect.mjs +1 -1
  129. package/build-module/utils/element-rect.mjs.map +2 -2
  130. package/build-module/utils/hooks/use-update-effect.mjs.map +1 -1
  131. package/build-module/utils/rtl.mjs +2 -2
  132. package/build-module/utils/rtl.mjs.map +2 -2
  133. package/build-module/utils/use-responsive-value.mjs +1 -7
  134. package/build-module/utils/use-responsive-value.mjs.map +2 -2
  135. package/build-module/validated-form-controls/control-with-error.mjs +27 -4
  136. package/build-module/validated-form-controls/control-with-error.mjs.map +2 -2
  137. package/build-module/validated-form-controls/validity-indicator.mjs +2 -0
  138. package/build-module/validated-form-controls/validity-indicator.mjs.map +2 -2
  139. package/build-style/style-rtl.css +8 -4
  140. package/build-style/style.css +8 -4
  141. package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts +19 -0
  142. package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts.map +1 -0
  143. package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts +23 -0
  144. package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -0
  145. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
  146. package/build-types/angle-picker-control/index.d.ts +1 -1
  147. package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
  148. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +25 -0
  149. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -0
  150. package/build-types/animate/index.d.ts +1 -1
  151. package/build-types/animate/index.d.ts.map +1 -1
  152. package/build-types/animate/types.d.ts +1 -1
  153. package/build-types/animate/types.d.ts.map +1 -1
  154. package/build-types/autocomplete/get-autocomplete-match.d.ts +20 -0
  155. package/build-types/autocomplete/get-autocomplete-match.d.ts.map +1 -0
  156. package/build-types/autocomplete/index.d.ts +10 -2
  157. package/build-types/autocomplete/index.d.ts.map +1 -1
  158. package/build-types/autocomplete/test/get-autocomplete-match.d.ts +2 -0
  159. package/build-types/autocomplete/test/get-autocomplete-match.d.ts.map +1 -0
  160. package/build-types/autocomplete/types.d.ts +1 -1
  161. package/build-types/autocomplete/types.d.ts.map +1 -1
  162. package/build-types/badge/stories/e2e/index.story.d.ts +7 -0
  163. package/build-types/badge/stories/e2e/index.story.d.ts.map +1 -0
  164. package/build-types/base-control/index.d.ts +2 -2
  165. package/build-types/base-control/stories/index.story.d.ts +1 -1
  166. package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
  167. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +1 -1
  168. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -1
  169. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +1 -1
  170. package/build-types/border-control/border-control/hook.d.ts +1 -1
  171. package/build-types/border-control/border-control-dropdown/hook.d.ts +1 -1
  172. package/build-types/border-control/border-control-style-picker/hook.d.ts +267 -0
  173. package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -0
  174. package/build-types/box-control/all-input-control.d.ts +4 -0
  175. package/build-types/box-control/all-input-control.d.ts.map +1 -0
  176. package/build-types/box-control/axial-input-controls.d.ts +4 -0
  177. package/build-types/box-control/axial-input-controls.d.ts.map +1 -0
  178. package/build-types/box-control/input-controls.d.ts +4 -0
  179. package/build-types/box-control/input-controls.d.ts.map +1 -0
  180. package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
  181. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  182. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts +46 -0
  183. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts.map +1 -0
  184. package/build-types/box-control/unit-control.d.ts +4 -0
  185. package/build-types/box-control/unit-control.d.ts.map +1 -0
  186. package/build-types/card/card/hook.d.ts +1 -1
  187. package/build-types/card/card-body/hook.d.ts +1 -1
  188. package/build-types/card/card-footer/hook.d.ts +1 -1
  189. package/build-types/card/card-header/hook.d.ts +1 -1
  190. package/build-types/card/card-media/hook.d.ts +1 -1
  191. package/build-types/color-palette/stories/index.story.d.ts +6 -5
  192. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  193. package/build-types/color-palette/styles.d.ts +1 -1
  194. package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
  195. package/build-types/color-picker/styles.d.ts +2 -2
  196. package/build-types/color-picker/styles.d.ts.map +1 -1
  197. package/build-types/combobox-control/styles.d.ts +1 -1
  198. package/build-types/context/context-connect.d.ts +2 -2
  199. package/build-types/context/context-connect.d.ts.map +1 -1
  200. package/build-types/context/context-system-provider.d.ts +2 -2
  201. package/build-types/context/context-system-provider.d.ts.map +1 -1
  202. package/build-types/context/wordpress-component.d.ts +3 -3
  203. package/build-types/context/wordpress-component.d.ts.map +1 -1
  204. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  205. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +2 -2
  206. package/build-types/custom-gradient-picker/test/index.d.ts +2 -0
  207. package/build-types/custom-gradient-picker/test/index.d.ts.map +1 -0
  208. package/build-types/custom-gradient-picker/types.d.ts +1 -1
  209. package/build-types/custom-gradient-picker/types.d.ts.map +1 -1
  210. package/build-types/custom-select-control/styles.d.ts +11 -0
  211. package/build-types/custom-select-control/styles.d.ts.map +1 -0
  212. package/build-types/custom-select-control-v2/types.d.ts +4 -4
  213. package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
  214. package/build-types/date-time/date/styles.d.ts +2 -2
  215. package/build-types/date-time/date-picker/index.d.ts +23 -0
  216. package/build-types/date-time/date-picker/index.d.ts.map +1 -0
  217. package/build-types/date-time/date-picker/styles.d.ts +45 -0
  218. package/build-types/date-time/date-picker/styles.d.ts.map +1 -0
  219. package/build-types/date-time/date-picker/test/index.d.ts +2 -0
  220. package/build-types/date-time/date-picker/test/index.d.ts.map +1 -0
  221. package/build-types/date-time/date-picker/test/use-lilius.d.ts +2 -0
  222. package/build-types/date-time/date-picker/test/use-lilius.d.ts.map +1 -0
  223. package/build-types/date-time/date-picker/use-lilius/index.d.ts +169 -0
  224. package/build-types/date-time/date-picker/use-lilius/index.d.ts.map +1 -0
  225. package/build-types/date-time/date-time/styles.d.ts +1 -1
  226. package/build-types/date-time/time/index.d.ts.map +1 -1
  227. package/build-types/date-time/time-picker/index.d.ts +27 -0
  228. package/build-types/date-time/time-picker/index.d.ts.map +1 -0
  229. package/build-types/date-time/time-picker/styles.d.ts +93 -0
  230. package/build-types/date-time/time-picker/styles.d.ts.map +1 -0
  231. package/build-types/date-time/time-picker/test/index.d.ts +2 -0
  232. package/build-types/date-time/time-picker/test/index.d.ts.map +1 -0
  233. package/build-types/date-time/time-picker/time-input/index.d.ts +4 -0
  234. package/build-types/date-time/time-picker/time-input/index.d.ts.map +1 -0
  235. package/build-types/date-time/time-picker/time-input/test/index.d.ts +2 -0
  236. package/build-types/date-time/time-picker/time-input/test/index.d.ts.map +1 -0
  237. package/build-types/date-time/time-picker/timezone.d.ts +7 -0
  238. package/build-types/date-time/time-picker/timezone.d.ts.map +1 -0
  239. package/build-types/date-time/utils.d.ts +9 -0
  240. package/build-types/date-time/utils.d.ts.map +1 -1
  241. package/build-types/dimension-control/index.d.ts +28 -0
  242. package/build-types/dimension-control/index.d.ts.map +1 -0
  243. package/build-types/dimension-control/sizes.d.ts +26 -0
  244. package/build-types/dimension-control/sizes.d.ts.map +1 -0
  245. package/build-types/dimension-control/stories/index.story.d.ts +4 -0
  246. package/build-types/dimension-control/stories/index.story.d.ts.map +1 -0
  247. package/build-types/dimension-control/types.d.ts +47 -0
  248. package/build-types/dimension-control/types.d.ts.map +1 -0
  249. package/build-types/draggable/types.d.ts +1 -1
  250. package/build-types/draggable/types.d.ts.map +1 -1
  251. package/build-types/drop-zone/types.d.ts +1 -1
  252. package/build-types/drop-zone/types.d.ts.map +1 -1
  253. package/build-types/dropdown-menu/types.d.ts +1 -1
  254. package/build-types/dropdown-menu/types.d.ts.map +1 -1
  255. package/build-types/dropdown-menu-v2/index.d.ts +17 -0
  256. package/build-types/dropdown-menu-v2/index.d.ts.map +1 -0
  257. package/build-types/dropdown-menu-v2/stories/index.story.d.ts +11 -0
  258. package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -0
  259. package/build-types/dropdown-menu-v2/styles.d.ts +42 -0
  260. package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -0
  261. package/build-types/dropdown-menu-v2/test/index.d.ts +2 -0
  262. package/build-types/dropdown-menu-v2/test/index.d.ts.map +1 -0
  263. package/build-types/dropdown-menu-v2/types.d.ts +252 -0
  264. package/build-types/dropdown-menu-v2/types.d.ts.map +1 -0
  265. package/build-types/elevation/hook.d.ts +1 -1
  266. package/build-types/external-link/index.d.ts.map +1 -1
  267. package/build-types/external-link/styles/external-link-styles.d.ts +10 -0
  268. package/build-types/external-link/styles/external-link-styles.d.ts.map +1 -0
  269. package/build-types/flex/flex/hook.d.ts +1 -1
  270. package/build-types/flex/flex-block/hook.d.ts +1 -1
  271. package/build-types/flex/flex-item/hook.d.ts +1 -1
  272. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  273. package/build-types/font-size-picker/stories/index.story.d.ts +8 -7
  274. package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
  275. package/build-types/font-size-picker/styles.d.ts +2 -2
  276. package/build-types/form-token-field/styles.d.ts +1 -1
  277. package/build-types/gradient-picker/stories/index.story.d.ts +6 -5
  278. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  279. package/build-types/grid/hook.d.ts +1 -1
  280. package/build-types/h-stack/hook.d.ts +1 -1
  281. package/build-types/heading/hook.d.ts +1 -1
  282. package/build-types/higher-order/navigate-regions/index.d.ts +1 -1
  283. package/build-types/higher-order/with-notices/types.d.ts +1 -1
  284. package/build-types/higher-order/with-notices/types.d.ts.map +1 -1
  285. package/build-types/higher-order/with-spoken-messages/index.d.ts +2 -3
  286. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
  287. package/build-types/icon/index.d.ts +2 -2
  288. package/build-types/icon/index.d.ts.map +1 -1
  289. package/build-types/input-control/styles/input-control-styles.d.ts +2 -2
  290. package/build-types/item-group/item/hook.d.ts +1 -1
  291. package/build-types/item-group/item-group/hook.d.ts +1 -1
  292. package/build-types/menu/index.d.ts +2 -2
  293. package/build-types/menu/item-help-text.d.ts +1 -1
  294. package/build-types/menu/item-label.d.ts +1 -1
  295. package/build-types/menu/styles.d.ts +2 -2
  296. package/build-types/menu-item/index.d.ts +1 -1
  297. package/build-types/menu-item/stories/index.story.d.ts +4 -4
  298. package/build-types/menu-item/types.d.ts +1 -1
  299. package/build-types/menu-item/types.d.ts.map +1 -1
  300. package/build-types/mobile/inserter-button/sparkles.d.ts +3 -0
  301. package/build-types/mobile/inserter-button/sparkles.d.ts.map +1 -0
  302. package/build-types/modal/index.d.ts.map +1 -1
  303. package/build-types/modal/types.d.ts +1 -1
  304. package/build-types/modal/types.d.ts.map +1 -1
  305. package/build-types/modal/use-modal-exit-animation.d.ts +1 -1
  306. package/build-types/navigation/styles/navigation-styles.d.ts +2 -2
  307. package/build-types/navigation/types.d.ts +1 -1
  308. package/build-types/navigation/types.d.ts.map +1 -1
  309. package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
  310. package/build-types/navigator/navigator-back-button/index.d.ts +2 -0
  311. package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -0
  312. package/build-types/navigator/navigator-button/hook.d.ts +1 -1
  313. package/build-types/navigator/navigator-button/index.d.ts +2 -0
  314. package/build-types/navigator/navigator-button/index.d.ts.map +1 -0
  315. package/build-types/navigator/navigator-provider/component.d.ts +38 -0
  316. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -0
  317. package/build-types/navigator/navigator-provider/index.d.ts +2 -0
  318. package/build-types/navigator/navigator-provider/index.d.ts.map +1 -0
  319. package/build-types/navigator/navigator-screen/index.d.ts +2 -0
  320. package/build-types/navigator/navigator-screen/index.d.ts.map +1 -0
  321. package/build-types/navigator/navigator-to-parent-button/index.d.ts +2 -0
  322. package/build-types/navigator/navigator-to-parent-button/index.d.ts.map +1 -0
  323. package/build-types/palette-edit/styles.d.ts +1 -1
  324. package/build-types/palette-edit/types.d.ts +1 -1
  325. package/build-types/palette-edit/types.d.ts.map +1 -1
  326. package/build-types/panel/types.d.ts +2 -2
  327. package/build-types/panel/types.d.ts.map +1 -1
  328. package/build-types/private-apis.d.ts.map +1 -1
  329. package/build-types/radio-group/radio/index.d.ts +7 -0
  330. package/build-types/radio-group/radio/index.d.ts.map +1 -0
  331. package/build-types/radio-group/radio-context/index.d.ts +6 -0
  332. package/build-types/radio-group/radio-context/index.d.ts.map +1 -0
  333. package/build-types/range-control/index.d.ts.map +1 -1
  334. package/build-types/range-control/input-range.d.ts +1 -1
  335. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  336. package/build-types/range-control/types.d.ts +2 -2
  337. package/build-types/range-control/types.d.ts.map +1 -1
  338. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -1
  339. package/build-types/resizable-box/resize-tooltip/utils.d.ts +1 -1
  340. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  341. package/build-types/sandbox/index.d.ts +1 -1
  342. package/build-types/sandbox/index.d.ts.map +1 -1
  343. package/build-types/sandbox/types.d.ts +11 -0
  344. package/build-types/sandbox/types.d.ts.map +1 -1
  345. package/build-types/scrollable/hook.d.ts +1 -1
  346. package/build-types/search-control/types.d.ts +1 -1
  347. package/build-types/search-control/types.d.ts.map +1 -1
  348. package/build-types/select-control/styles/select-control-styles.d.ts +2 -2
  349. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  350. package/build-types/slot-fill/bubbles-virtually/fill.d.ts +5 -0
  351. package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -0
  352. package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts +12 -0
  353. package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -0
  354. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts +4 -0
  355. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -0
  356. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
  357. package/build-types/slot-fill/types.d.ts +1 -1
  358. package/build-types/slot-fill/types.d.ts.map +1 -1
  359. package/build-types/slot-fill/use-slot.d.ts +9 -0
  360. package/build-types/slot-fill/use-slot.d.ts.map +1 -0
  361. package/build-types/snackbar/index.d.ts +1 -1
  362. package/build-types/snackbar/list.d.ts.map +1 -1
  363. package/build-types/spacer/hook.d.ts +1 -1
  364. package/build-types/style-provider/test/index.d.ts +2 -0
  365. package/build-types/style-provider/test/index.d.ts.map +1 -0
  366. package/build-types/surface/hook.d.ts +1 -1
  367. package/build-types/tabs/styles.d.ts.map +1 -1
  368. package/build-types/text/hook.d.ts +1 -1
  369. package/build-types/text/stories/index.story.d.ts +3 -3
  370. package/build-types/text/utils.d.ts +18 -18
  371. package/build-types/text/utils.d.ts.map +1 -1
  372. package/build-types/theme/stories/index.story.d.ts +1 -1
  373. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  374. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
  375. package/build-types/toggle-group-control/types.d.ts +1 -1
  376. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  377. package/build-types/tools-panel/tools-panel/hook.d.ts +1 -1
  378. package/build-types/tools-panel/tools-panel-header/hook.d.ts +1 -1
  379. package/build-types/tools-panel/tools-panel-item/hook.d.ts +1 -1
  380. package/build-types/tree-grid/types.d.ts +1 -1
  381. package/build-types/tree-grid/types.d.ts.map +1 -1
  382. package/build-types/truncate/hook.d.ts +1 -1
  383. package/build-types/ui/context/constants.d.ts +8 -0
  384. package/build-types/ui/context/constants.d.ts.map +1 -0
  385. package/build-types/ui/context/context-connect.d.ts +40 -0
  386. package/build-types/ui/context/context-connect.d.ts.map +1 -0
  387. package/build-types/ui/context/context-system-provider.d.ts +7 -0
  388. package/build-types/ui/context/context-system-provider.d.ts.map +1 -0
  389. package/build-types/ui/context/get-styled-class-name-from-key.d.ts +2 -0
  390. package/build-types/ui/context/get-styled-class-name-from-key.d.ts.map +1 -0
  391. package/build-types/ui/context/index.d.ts +5 -0
  392. package/build-types/ui/context/index.d.ts.map +1 -0
  393. package/build-types/ui/context/test/context-connect.d.ts +2 -0
  394. package/build-types/ui/context/test/context-connect.d.ts.map +1 -0
  395. package/build-types/ui/context/test/wordpress-component.d.ts +2 -0
  396. package/build-types/ui/context/test/wordpress-component.d.ts.map +1 -0
  397. package/build-types/ui/context/use-context-system.d.ts +20 -0
  398. package/build-types/ui/context/use-context-system.d.ts.map +1 -0
  399. package/build-types/ui/context/utils.d.ts +26 -0
  400. package/build-types/ui/context/utils.d.ts.map +1 -0
  401. package/build-types/ui/context/wordpress-component.d.ts +32 -0
  402. package/build-types/ui/context/wordpress-component.d.ts.map +1 -0
  403. package/build-types/ui/shortcut/component.d.ts +12 -0
  404. package/build-types/ui/shortcut/component.d.ts.map +1 -0
  405. package/build-types/ui/shortcut/index.d.ts +3 -0
  406. package/build-types/ui/shortcut/index.d.ts.map +1 -0
  407. package/build-types/ui/tooltip/component.d.ts +29 -0
  408. package/build-types/ui/tooltip/component.d.ts.map +1 -0
  409. package/build-types/ui/tooltip/content.d.ts +9 -0
  410. package/build-types/ui/tooltip/content.d.ts.map +1 -0
  411. package/build-types/ui/tooltip/context.d.ts +10 -0
  412. package/build-types/ui/tooltip/context.d.ts.map +1 -0
  413. package/build-types/ui/tooltip/index.d.ts +3 -0
  414. package/build-types/ui/tooltip/index.d.ts.map +1 -0
  415. package/build-types/ui/tooltip/styles.d.ts +12 -0
  416. package/build-types/ui/tooltip/styles.d.ts.map +1 -0
  417. package/build-types/ui/tooltip/types.d.ts +62 -0
  418. package/build-types/ui/tooltip/types.d.ts.map +1 -0
  419. package/build-types/ui/utils/colors.d.ts +17 -0
  420. package/build-types/ui/utils/colors.d.ts.map +1 -0
  421. package/build-types/ui/utils/font-size.d.ts +18 -0
  422. package/build-types/ui/utils/font-size.d.ts.map +1 -0
  423. package/build-types/ui/utils/get-valid-children.d.ts +13 -0
  424. package/build-types/ui/utils/get-valid-children.d.ts.map +1 -0
  425. package/build-types/ui/utils/index.d.ts +2 -0
  426. package/build-types/ui/utils/index.d.ts.map +1 -0
  427. package/build-types/ui/utils/space.d.ts +23 -0
  428. package/build-types/ui/utils/space.d.ts.map +1 -0
  429. package/build-types/ui/utils/types.d.ts +14 -0
  430. package/build-types/ui/utils/types.d.ts.map +1 -0
  431. package/build-types/ui/utils/use-responsive-value.d.ts +5 -0
  432. package/build-types/ui/utils/use-responsive-value.d.ts.map +1 -0
  433. package/build-types/utils/hooks/use-latest-ref.d.ts +15 -0
  434. package/build-types/utils/hooks/use-latest-ref.d.ts.map +1 -0
  435. package/build-types/utils/hooks/use-update-effect.d.ts +3 -3
  436. package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
  437. package/build-types/utils/input/base.d.ts +3 -0
  438. package/build-types/utils/input/base.d.ts.map +1 -0
  439. package/build-types/utils/input/index.d.ts +2 -0
  440. package/build-types/utils/input/index.d.ts.map +1 -0
  441. package/build-types/utils/input/input-control.d.ts +2 -0
  442. package/build-types/utils/input/input-control.d.ts.map +1 -0
  443. package/build-types/utils/reduce-motion.d.ts +8 -0
  444. package/build-types/utils/reduce-motion.d.ts.map +1 -0
  445. package/build-types/utils/rtl.d.ts +4 -4
  446. package/build-types/utils/rtl.d.ts.map +1 -1
  447. package/build-types/utils/use-responsive-value.d.ts.map +1 -1
  448. package/build-types/utils/z-index.d.ts +3 -0
  449. package/build-types/utils/z-index.d.ts.map +1 -0
  450. package/build-types/v-stack/hook.d.ts +1 -1
  451. package/build-types/v-stack/stories/index.story.d.ts +1 -1
  452. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
  453. package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
  454. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
  455. package/build-types/validated-form-controls/test/checkbox-control.d.ts +2 -0
  456. package/build-types/validated-form-controls/test/checkbox-control.d.ts.map +1 -0
  457. package/build-types/validated-form-controls/test/combobox-control.d.ts +2 -0
  458. package/build-types/validated-form-controls/test/combobox-control.d.ts.map +1 -0
  459. package/build-types/validated-form-controls/test/custom-select-control.d.ts +2 -0
  460. package/build-types/validated-form-controls/test/custom-select-control.d.ts.map +1 -0
  461. package/build-types/validated-form-controls/test/form-token-field.d.ts +2 -0
  462. package/build-types/validated-form-controls/test/form-token-field.d.ts.map +1 -0
  463. package/build-types/validated-form-controls/test/input-control.d.ts +2 -0
  464. package/build-types/validated-form-controls/test/input-control.d.ts.map +1 -0
  465. package/build-types/validated-form-controls/test/number-control.d.ts +2 -0
  466. package/build-types/validated-form-controls/test/number-control.d.ts.map +1 -0
  467. package/build-types/validated-form-controls/test/radio-control.d.ts +2 -0
  468. package/build-types/validated-form-controls/test/radio-control.d.ts.map +1 -0
  469. package/build-types/validated-form-controls/test/range-control.d.ts +2 -0
  470. package/build-types/validated-form-controls/test/range-control.d.ts.map +1 -0
  471. package/build-types/validated-form-controls/test/select-control.d.ts +2 -0
  472. package/build-types/validated-form-controls/test/select-control.d.ts.map +1 -0
  473. package/build-types/validated-form-controls/test/text-control.d.ts +2 -0
  474. package/build-types/validated-form-controls/test/text-control.d.ts.map +1 -0
  475. package/build-types/validated-form-controls/test/textarea-control.d.ts +2 -0
  476. package/build-types/validated-form-controls/test/textarea-control.d.ts.map +1 -0
  477. package/build-types/validated-form-controls/test/toggle-control.d.ts +2 -0
  478. package/build-types/validated-form-controls/test/toggle-control.d.ts.map +1 -0
  479. package/build-types/validated-form-controls/test/toggle-group-control.d.ts +2 -0
  480. package/build-types/validated-form-controls/test/toggle-group-control.d.ts.map +1 -0
  481. package/build-types/validated-form-controls/validity-indicator.d.ts +2 -1
  482. package/build-types/validated-form-controls/validity-indicator.d.ts.map +1 -1
  483. package/build-types/view/types.d.ts +8 -0
  484. package/build-types/view/types.d.ts.map +1 -0
  485. package/package.json +24 -24
  486. package/src/alignment-matrix-control/test/index.tsx +1 -1
  487. package/src/angle-picker-control/angle-circle.tsx +6 -5
  488. package/src/animate/types.ts +1 -1
  489. package/src/autocomplete/autocompleter-ui.tsx +1 -1
  490. package/src/autocomplete/index.tsx +33 -8
  491. package/src/autocomplete/test/index.tsx +110 -1
  492. package/src/autocomplete/types.ts +1 -1
  493. package/src/button/style.scss +8 -5
  494. package/src/calendar/style.scss +4 -2
  495. package/src/clipboard-button/index.tsx +1 -1
  496. package/src/color-palette/stories/index.story.tsx +56 -48
  497. package/src/color-picker/color-copy-button.tsx +1 -3
  498. package/src/composite/stories/index.story.tsx +1 -1
  499. package/src/confirm-dialog/component.tsx +2 -2
  500. package/src/context/context-connect.ts +3 -3
  501. package/src/context/context-system-provider.js +4 -4
  502. package/src/context/wordpress-component.ts +3 -5
  503. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +3 -2
  504. package/src/custom-gradient-picker/types.ts +1 -1
  505. package/src/custom-select-control-v2/custom-select.tsx +1 -1
  506. package/src/custom-select-control-v2/stories/index.story.tsx +3 -3
  507. package/src/custom-select-control-v2/test/index.tsx +3 -3
  508. package/src/custom-select-control-v2/types.ts +4 -4
  509. package/src/date-time/date/index.tsx +1 -1
  510. package/src/date-time/test/utils.test.ts +8 -11
  511. package/src/date-time/time/index.tsx +2 -12
  512. package/src/date-time/time/test/index.tsx +69 -0
  513. package/src/date-time/utils.ts +18 -0
  514. package/src/draggable/index.native.js +17 -17
  515. package/src/draggable/types.ts +1 -1
  516. package/src/drop-zone/types.ts +1 -1
  517. package/src/dropdown/index.tsx +1 -1
  518. package/src/dropdown-menu/types.ts +1 -1
  519. package/src/external-link/index.tsx +5 -1
  520. package/src/font-size-picker/stories/index.story.tsx +133 -125
  521. package/src/form-token-field/style.scss +1 -0
  522. package/src/gradient-picker/stories/index.story.tsx +48 -42
  523. package/src/h-stack/test/index.tsx +1 -1
  524. package/src/heading/hook.ts +2 -2
  525. package/src/higher-order/with-notices/test/index.tsx +2 -2
  526. package/src/higher-order/with-notices/types.ts +1 -1
  527. package/src/higher-order/with-spoken-messages/index.tsx +2 -4
  528. package/src/icon/index.tsx +2 -2
  529. package/src/keyboard-shortcuts/index.tsx +1 -1
  530. package/src/menu/stories/index.story.tsx +1 -1
  531. package/src/menu-item/types.ts +1 -1
  532. package/src/modal/index.tsx +4 -3
  533. package/src/modal/types.ts +1 -1
  534. package/src/modal/use-modal-exit-animation.ts +2 -2
  535. package/src/navigation/README.md +1 -1
  536. package/src/navigation/types.ts +1 -1
  537. package/src/number-control/index.tsx +1 -1
  538. package/src/palette-edit/index.tsx +2 -2
  539. package/src/palette-edit/types.ts +1 -1
  540. package/src/panel/README.md +1 -1
  541. package/src/panel/body.tsx +1 -1
  542. package/src/panel/types.ts +2 -2
  543. package/src/popover/stories/index.story.tsx +1 -1
  544. package/src/private-apis.ts +0 -2
  545. package/src/radio-control/test/index.tsx +5 -4
  546. package/src/range-control/index.tsx +1 -1
  547. package/src/range-control/types.ts +2 -2
  548. package/src/resizable-box/index.tsx +1 -1
  549. package/src/resizable-box/resize-tooltip/index.tsx +1 -1
  550. package/src/resizable-box/resize-tooltip/label.tsx +1 -1
  551. package/src/resizable-box/resize-tooltip/utils.ts +2 -2
  552. package/src/sandbox/index.tsx +190 -10
  553. package/src/sandbox/test/index.tsx +65 -24
  554. package/src/sandbox/types.ts +11 -0
  555. package/src/search-control/types.ts +1 -1
  556. package/src/select-control/styles/select-control-styles.ts +1 -0
  557. package/src/slot-fill/types.ts +1 -1
  558. package/src/snackbar/list.tsx +7 -2
  559. package/src/tabs/styles.ts +1 -0
  560. package/src/text/utils.ts +18 -18
  561. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +18 -16
  562. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +1 -1
  563. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +4 -6
  564. package/src/toggle-group-control/types.ts +1 -1
  565. package/src/tree-grid/roving-tab-index-item.tsx +1 -1
  566. package/src/tree-grid/types.ts +1 -1
  567. package/src/utils/element-rect.ts +1 -1
  568. package/src/utils/hooks/use-update-effect.js +2 -2
  569. package/src/utils/rtl.js +4 -4
  570. package/src/utils/use-responsive-value.ts +1 -5
  571. package/src/v-stack/test/index.tsx +1 -1
  572. package/src/validated-form-controls/components/stories/overview.story.tsx +2 -1
  573. package/src/validated-form-controls/control-with-error.tsx +44 -4
  574. package/src/validated-form-controls/test/checkbox-control.tsx +49 -0
  575. package/src/validated-form-controls/test/combobox-control.tsx +61 -0
  576. package/src/validated-form-controls/test/control-with-error.tsx +182 -1
  577. package/src/validated-form-controls/test/custom-select-control.tsx +60 -0
  578. package/src/validated-form-controls/test/form-token-field.tsx +52 -0
  579. package/src/validated-form-controls/test/input-control.tsx +42 -0
  580. package/src/validated-form-controls/test/number-control.tsx +44 -0
  581. package/src/validated-form-controls/test/radio-control.tsx +61 -0
  582. package/src/validated-form-controls/test/range-control.tsx +73 -0
  583. package/src/validated-form-controls/test/select-control.tsx +57 -0
  584. package/src/validated-form-controls/test/text-control.tsx +49 -0
  585. package/src/validated-form-controls/test/textarea-control.tsx +51 -0
  586. package/src/validated-form-controls/test/toggle-control.tsx +49 -0
  587. package/src/validated-form-controls/test/toggle-group-control.tsx +28 -0
  588. package/src/validated-form-controls/validity-indicator.tsx +3 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/external-link/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction UnforwardedExternalLink(props, ref) {\n const {\n href,\n children,\n className,\n rel = '',\n ...additionalProps\n } = props;\n const optimizedRel = [...new Set([...rel.split(' '), 'external', 'noreferrer', 'noopener'].filter(Boolean))].join(' ');\n const classes = clsx('components-external-link', className);\n /* Anchor links are perceived as external links.\n This constant helps check for on page anchor links,\n to prevent them from being opened in the editor. */\n const isInternalAnchor = !!href?.startsWith('#');\n const onClickHandler = event => {\n if (isInternalAnchor) {\n event.preventDefault();\n }\n if (props.onClick) {\n props.onClick(event);\n }\n };\n return /*#__PURE__*/ /* eslint-disable react/jsx-no-target-blank */_jsxs(\"a\", {\n ...additionalProps,\n className: classes,\n href: href,\n onClick: onClickHandler,\n target: \"_blank\",\n rel: optimizedRel,\n ref: ref,\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"components-external-link__contents\",\n children: children\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"components-external-link__icon\",\n \"aria-label\": /* translators: accessibility text */\n __('(opens in a new tab)'),\n children: isRTL() ? '\\u2196' : '\\u2197'\n })]\n })\n /* eslint-enable react/jsx-no-target-blank */;\n}\n\n/**\n * Link to an external resource.\n *\n * ```jsx\n * import { ExternalLink } from '@wordpress/components';\n *\n * const MyExternalLink = () => (\n * <ExternalLink href=\"https://wordpress.org\">WordPress.org</ExternalLink>\n * );\n * ```\n */\nexport const ExternalLink = forwardRef(UnforwardedExternalLink);\nExternalLink.displayName = 'ExternalLink';\nexport default ExternalLink;"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAIjB,SAAS,IAAI,aAAa;AAC1B,SAAS,kBAAkB;AAK3B,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,wBAAwB,OAAO,KAAK;AAC3C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,eAAe,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,IAAI,MAAM,GAAG,GAAG,YAAY,cAAc,UAAU,EAAE,OAAO,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG;AACrH,QAAM,UAAU,KAAK,4BAA4B,SAAS;AAI1D,QAAM,mBAAmB,CAAC,CAAC,MAAM,WAAW,GAAG;AAC/C,QAAM,iBAAiB,WAAS;AAC9B,QAAI,kBAAkB;AACpB,YAAM,eAAe;AAAA,IACvB;AACA,QAAI,MAAM,SAAS;AACjB,YAAM,QAAQ,KAAK;AAAA,IACrB;AAAA,EACF;AACA;AAAA;AAAA,IAAmE,sBAAM,KAAK;AAAA,MAC5E,GAAG;AAAA,MACH,WAAW;AAAA,MACX;AAAA,MACA,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,KAAK;AAAA,MACL;AAAA,MACA,UAAU,CAAc,qBAAK,QAAQ;AAAA,QACnC,WAAW;AAAA,QACX;AAAA,MACF,CAAC,GAAgB,qBAAK,QAAQ;AAAA,QAC5B,WAAW;AAAA,QACX;AAAA;AAAA,UACA,GAAG,sBAAsB;AAAA;AAAA,QACzB,UAAU,MAAM,IAAI,WAAW;AAAA,MACjC,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA;AAEH;AAaO,IAAM,eAAe,WAAW,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 { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction UnforwardedExternalLink(props, ref) {\n const {\n href,\n children,\n className,\n rel = '',\n ...additionalProps\n } = props;\n const optimizedRel = [...new Set([...rel.split(' '), 'external', 'noreferrer', 'noopener'].filter(Boolean))].join(' ');\n const classes = clsx('components-external-link', className);\n /* Anchor links are perceived as external links.\n This constant helps check for on page anchor links,\n to prevent them from being opened in the editor. */\n const isInternalAnchor = !!href?.startsWith('#');\n const onClickHandler = event => {\n if (isInternalAnchor) {\n event.preventDefault();\n }\n if (props.onClick) {\n props.onClick(event);\n }\n };\n return /*#__PURE__*/ /* eslint-disable react/jsx-no-target-blank */_jsxs(\"a\", {\n ...additionalProps,\n className: classes,\n href: href,\n onClick: onClickHandler,\n target: \"_blank\",\n rel: optimizedRel,\n ref: ref,\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"components-external-link__contents\",\n children: children\n }), /*#__PURE__*/_jsx(\"span\", {\n className: clsx('components-external-link__icon',\n // This class prevents the arrow from being replaced by a Twemoji image.\n 'wp-exclude-emoji'),\n \"aria-label\": /* translators: accessibility text */\n __('(opens in a new tab)'),\n children: isRTL() ? '\\u2196' : '\\u2197'\n })]\n })\n /* eslint-enable react/jsx-no-target-blank */;\n}\n\n/**\n * Link to an external resource.\n *\n * ```jsx\n * import { ExternalLink } from '@wordpress/components';\n *\n * const MyExternalLink = () => (\n * <ExternalLink href=\"https://wordpress.org\">WordPress.org</ExternalLink>\n * );\n * ```\n */\nexport const ExternalLink = forwardRef(UnforwardedExternalLink);\nExternalLink.displayName = 'ExternalLink';\nexport default ExternalLink;"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAIjB,SAAS,IAAI,aAAa;AAC1B,SAAS,kBAAkB;AAK3B,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,wBAAwB,OAAO,KAAK;AAC3C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,eAAe,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,IAAI,MAAM,GAAG,GAAG,YAAY,cAAc,UAAU,EAAE,OAAO,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG;AACrH,QAAM,UAAU,KAAK,4BAA4B,SAAS;AAI1D,QAAM,mBAAmB,CAAC,CAAC,MAAM,WAAW,GAAG;AAC/C,QAAM,iBAAiB,WAAS;AAC9B,QAAI,kBAAkB;AACpB,YAAM,eAAe;AAAA,IACvB;AACA,QAAI,MAAM,SAAS;AACjB,YAAM,QAAQ,KAAK;AAAA,IACrB;AAAA,EACF;AACA;AAAA;AAAA,IAAmE,sBAAM,KAAK;AAAA,MAC5E,GAAG;AAAA,MACH,WAAW;AAAA,MACX;AAAA,MACA,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,KAAK;AAAA,MACL;AAAA,MACA,UAAU,CAAc,qBAAK,QAAQ;AAAA,QACnC,WAAW;AAAA,QACX;AAAA,MACF,CAAC,GAAgB,qBAAK,QAAQ;AAAA,QAC5B,WAAW;AAAA,UAAK;AAAA;AAAA,UAEhB;AAAA,QAAkB;AAAA,QAClB;AAAA;AAAA,UACA,GAAG,sBAAsB;AAAA;AAAA,QACzB,UAAU,MAAM,IAAI,WAAW;AAAA,MACjC,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA;AAEH;AAaO,IAAM,eAAe,WAAW,uBAAuB;AAC9D,aAAa,cAAc;AAC3B,IAAO,wBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/higher-order/with-spoken-messages/index.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/** @typedef {import('react').ComponentType} ComponentType */\n\n/**\n * A Higher Order Component used to provide speak and debounced speak functions.\n *\n * @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak\n *\n * @param {ComponentType} Component The component to be wrapped.\n *\n * @return {ComponentType} The wrapped component.\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createHigherOrderComponent(Component => function WithSpokenMessages(props) {\n return /*#__PURE__*/_jsx(Component, {\n ...props,\n speak: speak,\n debouncedSpeak: useDebounce(speak, 500)\n });\n}, 'withSpokenMessages');"],
5
- "mappings": ";AAGA,SAAS,4BAA4B,mBAAmB;AACxD,SAAS,aAAa;AAatB,SAAS,OAAO,YAAY;AAC5B,IAAO,+BAAQ,2BAA2B,eAAa,SAAS,mBAAmB,OAAO;AACxF,SAAoB,qBAAK,WAAW;AAAA,IAClC,GAAG;AAAA,IACH;AAAA,IACA,gBAAgB,YAAY,OAAO,GAAG;AAAA,EACxC,CAAC;AACH,GAAG,oBAAoB;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * A Higher Order Component used to provide speak and debounced speak functions.\n *\n * @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak\n *\n * @param {React.ComponentType} Component The component to be wrapped.\n *\n * @return {React.ComponentType} The wrapped component.\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createHigherOrderComponent(Component => function WithSpokenMessages(props) {\n return /*#__PURE__*/_jsx(Component, {\n ...props,\n speak: speak,\n debouncedSpeak: useDebounce(speak, 500)\n });\n}, 'withSpokenMessages');"],
5
+ "mappings": ";AAGA,SAAS,4BAA4B,mBAAmB;AACxD,SAAS,aAAa;AAWtB,SAAS,OAAO,YAAY;AAC5B,IAAO,+BAAQ,2BAA2B,eAAa,SAAS,mBAAmB,OAAO;AACxF,SAAoB,qBAAK,WAAW;AAAA,IAClC,GAAG;AAAA,IACH;AAAA,IACA,gBAAgB,YAAY,OAAO,GAAG;AAAA,EACxC,CAAC;AACH,GAAG,oBAAoB;",
6
6
  "names": []
7
7
  }
@@ -42,7 +42,7 @@ function UnforwardedModal(props, forwardedRef) {
42
42
  headerActions = null,
43
43
  __experimentalHideHeader = false
44
44
  } = props;
45
- const ref = useRef();
45
+ const ref = useRef(null);
46
46
  const instanceId = useInstanceId(Modal);
47
47
  const headingId = title ? `components-modal-header-${instanceId}` : aria.labelledby;
48
48
  const focusOnMountRef = useFocusOnMount(focusOnMount === "firstContentElement" ? "firstElement" : focusOnMount);
@@ -73,7 +73,7 @@ function UnforwardedModal(props, forwardedRef) {
73
73
  ariaHelper.modalize(ref.current);
74
74
  return () => ariaHelper.unmodalize();
75
75
  }, []);
76
- const onRequestCloseRef = useRef();
76
+ const onRequestCloseRef = useRef(void 0);
77
77
  useEffect(() => {
78
78
  onRequestCloseRef.current = onRequestClose;
79
79
  }, [onRequestClose]);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/modal/index.tsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { createPortal, useCallback, useEffect, useRef, useState, forwardRef, useLayoutEffect, useContext } from '@wordpress/element';\nimport { useInstanceId, useFocusReturn, useFocusOnMount, useConstrainedTabbing, useMergeRefs } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\nimport { getScrollContainer } from '@wordpress/dom';\nimport * as ariaHelper from './aria-helper';\nimport Button from '../button';\nimport StyleProvider from '../style-provider';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport { Spacer } from '../spacer';\nimport { useModalExitAnimation } from './use-modal-exit-animation';\nimport { ModalContext } from './context';\n\n// Used to track body class names applied while modals are open.\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst bodyOpenClasses = new Map();\nfunction UnforwardedModal(props, forwardedRef) {\n const {\n bodyOpenClassName = 'modal-open',\n role = 'dialog',\n title = null,\n focusOnMount = true,\n shouldCloseOnEsc = true,\n shouldCloseOnClickOutside = true,\n isDismissible = true,\n /* Accessibility. */\n aria = {\n labelledby: undefined,\n describedby: undefined\n },\n onRequestClose,\n icon,\n closeButtonLabel,\n children,\n style,\n overlayClassName: overlayClassnameProp,\n className,\n contentLabel,\n onKeyDown,\n isFullScreen = false,\n size,\n headerActions = null,\n __experimentalHideHeader = false\n } = props;\n const ref = useRef();\n const instanceId = useInstanceId(Modal);\n const headingId = title ? `components-modal-header-${instanceId}` : aria.labelledby;\n\n // The focus hook does not support 'firstContentElement' but this is a valid\n // value for the Modal's focusOnMount prop. The following code ensures the focus\n // hook will focus the first focusable node within the element to which it is applied.\n // When `firstContentElement` is passed as the value of the focusOnMount prop,\n // the focus hook is applied to the Modal's content element.\n // Otherwise, the focus hook is applied to the Modal's ref. This ensures that the\n // focus hook will focus the first element in the Modal's **content** when\n // `firstContentElement` is passed.\n const focusOnMountRef = useFocusOnMount(focusOnMount === 'firstContentElement' ? 'firstElement' : focusOnMount);\n const constrainedTabbingRef = useConstrainedTabbing();\n const focusReturnRef = useFocusReturn();\n const contentRef = useRef(null);\n const childrenContainerRef = useRef(null);\n const [hasScrolledContent, setHasScrolledContent] = useState(false);\n const [hasScrollableContent, setHasScrollableContent] = useState(false);\n let sizeClass;\n if (isFullScreen || size === 'fill') {\n sizeClass = 'is-full-screen';\n } else if (size) {\n sizeClass = `has-size-${size}`;\n }\n\n // Determines whether the Modal content is scrollable and updates the state.\n const isContentScrollable = useCallback(() => {\n if (!contentRef.current) {\n return;\n }\n const closestScrollContainer = getScrollContainer(contentRef.current);\n if (contentRef.current === closestScrollContainer) {\n setHasScrollableContent(true);\n } else {\n setHasScrollableContent(false);\n }\n }, [contentRef]);\n\n // Accessibly isolates/unisolates the modal.\n useEffect(() => {\n ariaHelper.modalize(ref.current);\n return () => ariaHelper.unmodalize();\n }, []);\n\n // Keeps a fresh ref for the subsequent effect.\n const onRequestCloseRef = useRef();\n useEffect(() => {\n onRequestCloseRef.current = onRequestClose;\n }, [onRequestClose]);\n\n // The list of `onRequestClose` callbacks of open (non-nested) Modals. Only\n // one should remain open at a time and the list enables closing prior ones.\n const dismissers = useContext(ModalContext);\n // Used for the tracking and dismissing any nested modals.\n const [nestedDismissers] = useState(() => new Set());\n\n // Updates the stack tracking open modals at this level and calls\n // onRequestClose for any prior and/or nested modals as applicable.\n useEffect(() => {\n // add this modal instance to the dismissers set\n dismissers.add(onRequestCloseRef);\n // request that all the other modals close themselves\n for (const dismisser of dismissers) {\n if (dismisser !== onRequestCloseRef) {\n dismisser.current?.();\n }\n }\n return () => {\n // request that all the nested modals close themselves\n for (const dismisser of nestedDismissers) {\n dismisser.current?.();\n }\n // remove this modal instance from the dismissers set\n dismissers.delete(onRequestCloseRef);\n };\n }, [dismissers, nestedDismissers]);\n\n // Adds/removes the value of bodyOpenClassName to body element.\n useEffect(() => {\n const theClass = bodyOpenClassName;\n const oneMore = 1 + (bodyOpenClasses.get(theClass) ?? 0);\n bodyOpenClasses.set(theClass, oneMore);\n document.body.classList.add(bodyOpenClassName);\n return () => {\n const oneLess = bodyOpenClasses.get(theClass) - 1;\n if (oneLess === 0) {\n document.body.classList.remove(theClass);\n bodyOpenClasses.delete(theClass);\n } else {\n bodyOpenClasses.set(theClass, oneLess);\n }\n };\n }, [bodyOpenClassName]);\n const {\n closeModal,\n frameRef,\n frameStyle,\n overlayClassname\n } = useModalExitAnimation();\n\n // Calls the isContentScrollable callback when the Modal children container resizes.\n useLayoutEffect(() => {\n if (!window.ResizeObserver || !childrenContainerRef.current) {\n return;\n }\n const resizeObserver = new ResizeObserver(isContentScrollable);\n resizeObserver.observe(childrenContainerRef.current);\n isContentScrollable();\n return () => {\n resizeObserver.disconnect();\n };\n }, [isContentScrollable, childrenContainerRef]);\n function handleEscapeKeyDown(event) {\n if (shouldCloseOnEsc && (event.code === 'Escape' || event.key === 'Escape') && !event.defaultPrevented) {\n event.preventDefault();\n closeModal().then(() => onRequestClose(event));\n }\n }\n const onContentContainerScroll = useCallback(e => {\n const scrollY = e?.currentTarget?.scrollTop ?? -1;\n if (!hasScrolledContent && scrollY > 0) {\n setHasScrolledContent(true);\n } else if (hasScrolledContent && scrollY <= 0) {\n setHasScrolledContent(false);\n }\n }, [hasScrolledContent]);\n let pressTarget = null;\n const overlayPressHandlers = {\n onPointerDown: event => {\n if (event.target === event.currentTarget) {\n pressTarget = event.target;\n // Avoids focus changing so that focus return works as expected.\n event.preventDefault();\n }\n },\n // Closes the modal with two exceptions. 1. Opening the context menu on\n // the overlay. 2. Pressing on the overlay then dragging the pointer\n // over the modal and releasing. Due to the modal being a child of the\n // overlay, such a gesture is a `click` on the overlay and cannot be\n // excepted by a `click` handler. Thus the tactic of handling\n // `pointerup` and comparing its target to that of the `pointerdown`.\n onPointerUp: ({\n target,\n button\n }) => {\n const isSameTarget = target === pressTarget;\n pressTarget = null;\n if (button === 0 && isSameTarget) {\n closeModal().then(() => onRequestClose());\n }\n }\n };\n const modal =\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n _jsx(\"div\", {\n ref: useMergeRefs([ref, forwardedRef]),\n className: clsx('components-modal__screen-overlay', overlayClassname, overlayClassnameProp),\n onKeyDown: withIgnoreIMEEvents(handleEscapeKeyDown),\n ...(shouldCloseOnClickOutside ? overlayPressHandlers : {}),\n children: /*#__PURE__*/_jsx(StyleProvider, {\n document: document,\n children: /*#__PURE__*/_jsx(\"div\", {\n className: clsx('components-modal__frame', sizeClass, className),\n style: {\n ...frameStyle,\n ...style\n },\n ref: useMergeRefs([frameRef, constrainedTabbingRef, focusReturnRef, focusOnMount !== 'firstContentElement' ? focusOnMountRef : null]),\n role: role,\n \"aria-label\": contentLabel,\n \"aria-labelledby\": contentLabel ? undefined : headingId,\n \"aria-describedby\": aria.describedby,\n tabIndex: -1,\n onKeyDown: onKeyDown,\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: clsx('components-modal__content', {\n 'hide-header': __experimentalHideHeader,\n 'is-scrollable': hasScrollableContent,\n 'has-scrolled-content': hasScrolledContent\n }),\n role: \"document\",\n onScroll: onContentContainerScroll,\n ref: contentRef,\n \"aria-label\": hasScrollableContent ? __('Scrollable section') : undefined,\n tabIndex: hasScrollableContent ? 0 : undefined,\n children: [!__experimentalHideHeader && /*#__PURE__*/_jsxs(\"div\", {\n className: \"components-modal__header\",\n children: [/*#__PURE__*/_jsxs(\"div\", {\n className: \"components-modal__header-heading-container\",\n children: [icon && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-modal__icon-container\",\n \"aria-hidden\": true,\n children: icon\n }), title && /*#__PURE__*/_jsx(\"h1\", {\n id: headingId,\n className: \"components-modal__header-heading\",\n children: title\n })]\n }), headerActions, isDismissible && /*#__PURE__*/_jsxs(_Fragment, {\n children: [/*#__PURE__*/_jsx(Spacer, {\n marginBottom: 0,\n marginLeft: 2\n }), /*#__PURE__*/_jsx(Button, {\n size: \"compact\",\n onClick: event => closeModal().then(() => onRequestClose(event)),\n icon: close,\n label: closeButtonLabel || __('Close')\n })]\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n ref: useMergeRefs([childrenContainerRef, focusOnMount === 'firstContentElement' ? focusOnMountRef : null]),\n className: \"components-modal__children-container\",\n children: children\n })]\n })\n })\n })\n });\n return createPortal(/*#__PURE__*/_jsx(ModalContext.Provider, {\n value: nestedDismissers,\n children: modal\n }), document.body);\n}\n\n/**\n * Modals give users information and choices related to a task they\u2019re trying to\n * accomplish. They can contain critical information, require decisions, or\n * involve multiple tasks.\n *\n * ```jsx\n * import { Button, Modal } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyModal = () => {\n * const [ isOpen, setOpen ] = useState( false );\n * const openModal = () => setOpen( true );\n * const closeModal = () => setOpen( false );\n *\n * return (\n * <>\n * <Button variant=\"secondary\" onClick={ openModal }>\n * Open Modal\n * </Button>\n * { isOpen && (\n * <Modal title=\"This is my modal\" onRequestClose={ closeModal }>\n * <Button variant=\"secondary\" onClick={ closeModal }>\n * My custom close button\n * </Button>\n * </Modal>\n * ) }\n * </>\n * );\n * };\n * ```\n */\nexport const Modal = forwardRef(UnforwardedModal);\nModal.displayName = 'Modal';\nexport default Modal;"],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,cAAc,aAAa,WAAW,QAAQ,UAAU,YAAY,iBAAiB,kBAAkB;AAChH,SAAS,eAAe,gBAAgB,iBAAiB,uBAAuB,oBAAoB;AACpG,SAAS,UAAU;AACnB,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,YAAY,gBAAgB;AAC5B,OAAO,YAAY;AACnB,OAAO,mBAAmB;AAC1B,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAG7B,SAAS,OAAO,MAAM,QAAQ,OAAO,YAAY,iBAAiB;AAClE,IAAM,kBAAkB,oBAAI,IAAI;AAChC,SAAS,iBAAiB,OAAO,cAAc;AAC7C,QAAM;AAAA,IACJ,oBAAoB;AAAA,IACpB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB,4BAA4B;AAAA,IAC5B,gBAAgB;AAAA;AAAA,IAEhB,OAAO;AAAA,MACL,YAAY;AAAA,MACZ,aAAa;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAA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A,IAC3D,OAAO;AAAA,IACP,UAAU;AAAA,EACZ,CAAC,GAAG,SAAS,IAAI;AACnB;AAiCO,IAAM,QAAQ,WAAW,gBAAgB;AAChD,MAAM,cAAc;AACpB,IAAO,gBAAQ;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { createPortal, useCallback, useEffect, useRef, useState, forwardRef, useLayoutEffect, useContext } from '@wordpress/element';\nimport { useInstanceId, useFocusReturn, useFocusOnMount, useConstrainedTabbing, useMergeRefs } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\nimport { getScrollContainer } from '@wordpress/dom';\nimport * as ariaHelper from './aria-helper';\nimport Button from '../button';\nimport StyleProvider from '../style-provider';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport { Spacer } from '../spacer';\nimport { useModalExitAnimation } from './use-modal-exit-animation';\nimport { ModalContext } from './context';\n\n// Used to track body class names applied while modals are open.\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst bodyOpenClasses = new Map();\nfunction UnforwardedModal(props, forwardedRef) {\n const {\n bodyOpenClassName = 'modal-open',\n role = 'dialog',\n title = null,\n focusOnMount = true,\n shouldCloseOnEsc = true,\n shouldCloseOnClickOutside = true,\n isDismissible = true,\n /* Accessibility. */\n aria = {\n labelledby: undefined,\n describedby: undefined\n },\n onRequestClose,\n icon,\n closeButtonLabel,\n children,\n style,\n overlayClassName: overlayClassnameProp,\n className,\n contentLabel,\n onKeyDown,\n isFullScreen = false,\n size,\n headerActions = null,\n __experimentalHideHeader = false\n } = props;\n const ref = useRef(null);\n const instanceId = useInstanceId(Modal);\n const headingId = title ? `components-modal-header-${instanceId}` : aria.labelledby;\n\n // The focus hook does not support 'firstContentElement' but this is a valid\n // value for the Modal's focusOnMount prop. The following code ensures the focus\n // hook will focus the first focusable node within the element to which it is applied.\n // When `firstContentElement` is passed as the value of the focusOnMount prop,\n // the focus hook is applied to the Modal's content element.\n // Otherwise, the focus hook is applied to the Modal's ref. This ensures that the\n // focus hook will focus the first element in the Modal's **content** when\n // `firstContentElement` is passed.\n const focusOnMountRef = useFocusOnMount(focusOnMount === 'firstContentElement' ? 'firstElement' : focusOnMount);\n const constrainedTabbingRef = useConstrainedTabbing();\n const focusReturnRef = useFocusReturn();\n const contentRef = useRef(null);\n const childrenContainerRef = useRef(null);\n const [hasScrolledContent, setHasScrolledContent] = useState(false);\n const [hasScrollableContent, setHasScrollableContent] = useState(false);\n let sizeClass;\n if (isFullScreen || size === 'fill') {\n sizeClass = 'is-full-screen';\n } else if (size) {\n sizeClass = `has-size-${size}`;\n }\n\n // Determines whether the Modal content is scrollable and updates the state.\n const isContentScrollable = useCallback(() => {\n if (!contentRef.current) {\n return;\n }\n const closestScrollContainer = getScrollContainer(contentRef.current);\n if (contentRef.current === closestScrollContainer) {\n setHasScrollableContent(true);\n } else {\n setHasScrollableContent(false);\n }\n }, [contentRef]);\n\n // Accessibly isolates/unisolates the modal.\n useEffect(() => {\n ariaHelper.modalize(ref.current);\n return () => ariaHelper.unmodalize();\n }, []);\n\n // Keeps a fresh ref for the subsequent effect.\n const onRequestCloseRef = useRef(undefined);\n useEffect(() => {\n onRequestCloseRef.current = onRequestClose;\n }, [onRequestClose]);\n\n // The list of `onRequestClose` callbacks of open (non-nested) Modals. Only\n // one should remain open at a time and the list enables closing prior ones.\n const dismissers = useContext(ModalContext);\n // Used for the tracking and dismissing any nested modals.\n const [nestedDismissers] = useState(() => new Set());\n\n // Updates the stack tracking open modals at this level and calls\n // onRequestClose for any prior and/or nested modals as applicable.\n useEffect(() => {\n // add this modal instance to the dismissers set\n dismissers.add(onRequestCloseRef);\n // request that all the other modals close themselves\n for (const dismisser of dismissers) {\n if (dismisser !== onRequestCloseRef) {\n dismisser.current?.();\n }\n }\n return () => {\n // request that all the nested modals close themselves\n for (const dismisser of nestedDismissers) {\n dismisser.current?.();\n }\n // remove this modal instance from the dismissers set\n dismissers.delete(onRequestCloseRef);\n };\n }, [dismissers, nestedDismissers]);\n\n // Adds/removes the value of bodyOpenClassName to body element.\n useEffect(() => {\n const theClass = bodyOpenClassName;\n const oneMore = 1 + (bodyOpenClasses.get(theClass) ?? 0);\n bodyOpenClasses.set(theClass, oneMore);\n document.body.classList.add(bodyOpenClassName);\n return () => {\n const oneLess = bodyOpenClasses.get(theClass) - 1;\n if (oneLess === 0) {\n document.body.classList.remove(theClass);\n bodyOpenClasses.delete(theClass);\n } else {\n bodyOpenClasses.set(theClass, oneLess);\n }\n };\n }, [bodyOpenClassName]);\n const {\n closeModal,\n frameRef,\n frameStyle,\n overlayClassname\n } = useModalExitAnimation();\n\n // Calls the isContentScrollable callback when the Modal children container resizes.\n useLayoutEffect(() => {\n if (!window.ResizeObserver || !childrenContainerRef.current) {\n return;\n }\n const resizeObserver = new ResizeObserver(isContentScrollable);\n resizeObserver.observe(childrenContainerRef.current);\n isContentScrollable();\n return () => {\n resizeObserver.disconnect();\n };\n }, [isContentScrollable, childrenContainerRef]);\n function handleEscapeKeyDown(event) {\n if (shouldCloseOnEsc && (event.code === 'Escape' || event.key === 'Escape') && !event.defaultPrevented) {\n event.preventDefault();\n closeModal().then(() => onRequestClose(event));\n }\n }\n const onContentContainerScroll = useCallback(e => {\n const scrollY = e?.currentTarget?.scrollTop ?? -1;\n if (!hasScrolledContent && scrollY > 0) {\n setHasScrolledContent(true);\n } else if (hasScrolledContent && scrollY <= 0) {\n setHasScrolledContent(false);\n }\n }, [hasScrolledContent]);\n let pressTarget = null;\n const overlayPressHandlers = {\n onPointerDown: event => {\n if (event.target === event.currentTarget) {\n pressTarget = event.target;\n // Avoids focus changing so that focus return works as expected.\n event.preventDefault();\n }\n },\n // Closes the modal with two exceptions. 1. Opening the context menu on\n // the overlay. 2. Pressing on the overlay then dragging the pointer\n // over the modal and releasing. Due to the modal being a child of the\n // overlay, such a gesture is a `click` on the overlay and cannot be\n // excepted by a `click` handler. Thus the tactic of handling\n // `pointerup` and comparing its target to that of the `pointerdown`.\n onPointerUp: ({\n target,\n button\n }) => {\n const isSameTarget = target === pressTarget;\n pressTarget = null;\n if (button === 0 && isSameTarget) {\n closeModal().then(() => onRequestClose());\n }\n }\n };\n const modal =\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n _jsx(\"div\", {\n ref: useMergeRefs([ref, forwardedRef]),\n className: clsx('components-modal__screen-overlay', overlayClassname, overlayClassnameProp),\n onKeyDown: withIgnoreIMEEvents(handleEscapeKeyDown),\n ...(shouldCloseOnClickOutside ? overlayPressHandlers : {}),\n children: /*#__PURE__*/_jsx(StyleProvider, {\n document: document,\n children: /*#__PURE__*/_jsx(\"div\", {\n className: clsx('components-modal__frame', sizeClass, className),\n style: {\n ...frameStyle,\n ...style\n },\n ref: useMergeRefs([frameRef, constrainedTabbingRef, focusReturnRef, focusOnMount !== 'firstContentElement' ? focusOnMountRef : null]),\n role: role,\n \"aria-label\": contentLabel,\n \"aria-labelledby\": contentLabel ? undefined : headingId,\n \"aria-describedby\": aria.describedby,\n tabIndex: -1,\n onKeyDown: onKeyDown,\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: clsx('components-modal__content', {\n 'hide-header': __experimentalHideHeader,\n 'is-scrollable': hasScrollableContent,\n 'has-scrolled-content': hasScrolledContent\n }),\n role: \"document\",\n onScroll: onContentContainerScroll,\n ref: contentRef,\n \"aria-label\": hasScrollableContent ? __('Scrollable section') : undefined,\n tabIndex: hasScrollableContent ? 0 : undefined,\n children: [!__experimentalHideHeader && /*#__PURE__*/_jsxs(\"div\", {\n className: \"components-modal__header\",\n children: [/*#__PURE__*/_jsxs(\"div\", {\n className: \"components-modal__header-heading-container\",\n children: [icon && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-modal__icon-container\",\n \"aria-hidden\": true,\n children: icon\n }), title && /*#__PURE__*/_jsx(\"h1\", {\n id: headingId,\n className: \"components-modal__header-heading\",\n children: title\n })]\n }), headerActions, isDismissible && /*#__PURE__*/_jsxs(_Fragment, {\n children: [/*#__PURE__*/_jsx(Spacer, {\n marginBottom: 0,\n marginLeft: 2\n }), /*#__PURE__*/_jsx(Button, {\n size: \"compact\",\n onClick: event => closeModal().then(() => onRequestClose(event)),\n icon: close,\n label: closeButtonLabel || __('Close')\n })]\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n ref: useMergeRefs([childrenContainerRef, focusOnMount === 'firstContentElement' ? focusOnMountRef : null]),\n className: \"components-modal__children-container\",\n children: children\n })]\n })\n })\n })\n });\n return createPortal(/*#__PURE__*/_jsx(ModalContext.Provider, {\n value: nestedDismissers,\n children: modal\n }), document.body);\n}\n\n/**\n * Modals give users information and choices related to a task they\u2019re trying to\n * accomplish. They can contain critical information, require decisions, or\n * involve multiple tasks.\n *\n * ```jsx\n * import { Button, Modal } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyModal = () => {\n * const [ isOpen, setOpen ] = useState( false );\n * const openModal = () => setOpen( true );\n * const closeModal = () => setOpen( false );\n *\n * return (\n * <>\n * <Button variant=\"secondary\" onClick={ openModal }>\n * Open Modal\n * </Button>\n * { isOpen && (\n * <Modal title=\"This is my modal\" onRequestClose={ closeModal }>\n * <Button variant=\"secondary\" onClick={ closeModal }>\n * My custom close button\n * </Button>\n * </Modal>\n * ) }\n * </>\n * );\n * };\n * ```\n */\nexport const Modal = forwardRef(UnforwardedModal);\nModal.displayName = 'Modal';\nexport default Modal;"],
5
+ "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,cAAc,aAAa,WAAW,QAAQ,UAAU,YAAY,iBAAiB,kBAAkB;AAChH,SAAS,eAAe,gBAAgB,iBAAiB,uBAAuB,oBAAoB;AACpG,SAAS,UAAU;AACnB,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,YAAY,gBAAgB;AAC5B,OAAO,YAAY;AACnB,OAAO,mBAAmB;AAC1B,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,6BAA6B;AACtC,SAAS,oBAAo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qBAAK,QAAQ;AAAA,kBAC5B,MAAM;AAAA,kBACN,SAAS,WAAS,WAAW,EAAE,KAAK,MAAM,eAAe,KAAK,CAAC;AAAA,kBAC/D,MAAM;AAAA,kBACN,OAAO,oBAAoB,GAAG,OAAO;AAAA,gBACvC,CAAC,CAAC;AAAA,cACJ,CAAC,CAAC;AAAA,YACJ,CAAC,GAAgB,qBAAK,OAAO;AAAA,cAC3B,KAAK,aAAa,CAAC,sBAAsB,iBAAiB,wBAAwB,kBAAkB,IAAI,CAAC;AAAA,cACzG,WAAW;AAAA,cACX;AAAA,YACF,CAAC,CAAC;AAAA,UACJ,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA;AACD,SAAO,aAA0B,qBAAK,aAAa,UAAU;AAAA,IAC3D,OAAO;AAAA,IACP,UAAU;AAAA,EACZ,CAAC,GAAG,SAAS,IAAI;AACnB;AAiCO,IAAM,QAAQ,WAAW,gBAAgB;AAChD,MAAM,cAAc;AACpB,IAAO,gBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,13 +1,13 @@
1
1
  // packages/components/src/modal/use-modal-exit-animation.ts
2
2
  import { useReducedMotion } from "@wordpress/compose";
3
3
  import { useCallback, useRef, useState } from "@wordpress/element";
4
- import { CONFIG } from "../utils/index.mjs";
5
4
  import warning from "@wordpress/warning";
5
+ import { CONFIG } from "../utils/index.mjs";
6
6
  var FRAME_ANIMATION_DURATION = CONFIG.transitionDuration;
7
7
  var FRAME_ANIMATION_DURATION_NUMBER = Number.parseInt(CONFIG.transitionDuration);
8
8
  var EXIT_ANIMATION_NAME = "components-modal__disappear-animation";
9
9
  function useModalExitAnimation() {
10
- const frameRef = useRef();
10
+ const frameRef = useRef(null);
11
11
  const [isAnimatingOut, setIsAnimatingOut] = useState(false);
12
12
  const isReducedMotion = useReducedMotion();
13
13
  const closeModal = useCallback(() => new Promise((closeModalResolve) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/modal/use-modal-exit-animation.ts"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useCallback, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { CONFIG } from '../utils';\nimport warning from '@wordpress/warning';\n\n// Animation duration (ms) extracted to JS in order to be used on a setTimeout.\nconst FRAME_ANIMATION_DURATION = CONFIG.transitionDuration;\nconst FRAME_ANIMATION_DURATION_NUMBER = Number.parseInt(CONFIG.transitionDuration);\nconst EXIT_ANIMATION_NAME = 'components-modal__disappear-animation';\nexport function useModalExitAnimation() {\n const frameRef = useRef();\n const [isAnimatingOut, setIsAnimatingOut] = useState(false);\n const isReducedMotion = useReducedMotion();\n const closeModal = useCallback(() => new Promise(closeModalResolve => {\n // Grab a \"stable\" reference of the frame element, since\n // the value held by the react ref might change at runtime.\n const frameEl = frameRef.current;\n if (isReducedMotion) {\n closeModalResolve();\n return;\n }\n if (!frameEl) {\n globalThis.SCRIPT_DEBUG === true ? warning(\"wp.components.Modal: the Modal component can't be closed with an exit animation because of a missing reference to the modal frame element.\") : void 0;\n closeModalResolve();\n return;\n }\n let handleAnimationEnd;\n const startAnimation = () => new Promise(animationResolve => {\n handleAnimationEnd = e => {\n if (e.animationName === EXIT_ANIMATION_NAME) {\n animationResolve();\n }\n };\n frameEl.addEventListener('animationend', handleAnimationEnd);\n setIsAnimatingOut(true);\n });\n const animationTimeout = () => new Promise(timeoutResolve => {\n setTimeout(() => timeoutResolve(),\n // Allow an extra 20% of the animation duration for the\n // animationend event to fire, in case the animation frame is\n // slightly delayes by some other events in the event loop.\n FRAME_ANIMATION_DURATION_NUMBER * 1.2);\n });\n Promise.race([startAnimation(), animationTimeout()]).then(() => {\n if (handleAnimationEnd) {\n frameEl.removeEventListener('animationend', handleAnimationEnd);\n }\n setIsAnimatingOut(false);\n closeModalResolve();\n });\n }), [isReducedMotion]);\n return {\n overlayClassname: isAnimatingOut ? 'is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AC;AAAA,EACH,CAAC,GAAG,CAAC,eAAe,CAAC;AACrB,SAAO;AAAA,IACL,kBAAkB,iBAAiB,qBAAqB;AAAA,IACxD;AAAA,IACA,YAAY;AAAA,MACV,oCAAoC,GAAG,wBAAwB;AAAA,IACjE;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONFIG } from '../utils';\n\n// Animation duration (ms) extracted to JS in order to be used on a setTimeout.\nconst FRAME_ANIMATION_DURATION = CONFIG.transitionDuration;\nconst FRAME_ANIMATION_DURATION_NUMBER = Number.parseInt(CONFIG.transitionDuration);\nconst EXIT_ANIMATION_NAME = 'components-modal__disappear-animation';\nexport function useModalExitAnimation() {\n const frameRef = useRef(null);\n const [isAnimatingOut, setIsAnimatingOut] = useState(false);\n const isReducedMotion = useReducedMotion();\n const closeModal = useCallback(() => new Promise(closeModalResolve => {\n // Grab a \"stable\" reference of the frame element, since\n // the value held by the react ref might change at runtime.\n const frameEl = frameRef.current;\n if (isReducedMotion) {\n closeModalResolve();\n return;\n }\n if (!frameEl) {\n globalThis.SCRIPT_DEBUG === true ? warning(\"wp.components.Modal: the Modal component can't be closed with an exit animation because of a missing reference to the modal frame element.\") : void 0;\n closeModalResolve();\n return;\n }\n let handleAnimationEnd;\n const startAnimation = () => new Promise(animationResolve => {\n handleAnimationEnd = e => {\n if (e.animationName === EXIT_ANIMATION_NAME) {\n animationResolve();\n }\n };\n frameEl.addEventListener('animationend', handleAnimationEnd);\n setIsAnimatingOut(true);\n });\n const animationTimeout = () => new Promise(timeoutResolve => {\n setTimeout(() => timeoutResolve(),\n // Allow an extra 20% of the animation duration for the\n // animationend event to fire, in case the animation frame is\n // slightly delayes by some other events in the event loop.\n FRAME_ANIMATION_DURATION_NUMBER * 1.2);\n });\n Promise.race([startAnimation(), animationTimeout()]).then(() => {\n if (handleAnimationEnd) {\n frameEl.removeEventListener('animationend', handleAnimationEnd);\n }\n setIsAnimatingOut(false);\n closeModalResolve();\n });\n }), [isReducedMotion]);\n return {\n overlayClassname: isAnimatingOut ? 'is-animating-out' : undefined,\n frameRef,\n frameStyle: {\n '--modal-frame-animation-duration': `${FRAME_ANIMATION_DURATION}`\n },\n closeModal\n };\n}"],
5
+ "mappings": ";AAGA,SAAS,wBAAwB;AACjC,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,OAAO,aAAa;AAKpB,SAAS,cAAc;AAGvB,IAAM,2BAA2B,OAAO;AACxC,IAAM,kCAAkC,OAAO,SAAS,OAAO,kBAAkB;AACjF,IAAM,sBAAsB;AACrB,SAAS,wBAAwB;AACtC,QAAM,WAAW,OAAO,IAAI;AAC5B,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAAK;AAC1D,QAAM,kBAAkB,iBAAiB;AACzC,QAAM,aAAa,YAAY,MAAM,IAAI,QAAQ,uBAAqB;AAGpE,UAAM,UAAU,SAAS;AACzB,QAAI,iBAAiB;AACnB,wBAAkB;AAClB;AAAA,IACF;AACA,QAAI,CAAC,SAAS;AACZ,iBAAW,iBAAiB,OAAO,QAAQ,4IAA4I,IAAI;AAC3L,wBAAkB;AAClB;AAAA,IACF;AACA,QAAI;AACJ,UAAM,iBAAiB,MAAM,IAAI,QAAQ,sBAAoB;AAC3D,2BAAqB,OAAK;AACxB,YAAI,EAAE,kBAAkB,qBAAqB;AAC3C,2BAAiB;AAAA,QACnB;AAAA,MACF;AACA,cAAQ,iBAAiB,gBAAgB,kBAAkB;AAC3D,wBAAkB,IAAI;AAAA,IACxB,CAAC;AACD,UAAM,mBAAmB,MAAM,IAAI,QAAQ,oBAAkB;AAC3D;AAAA,QAAW,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA,QAIhC,kCAAkC;AAAA,MAAG;AAAA,IACvC,CAAC;AACD,YAAQ,KAAK,CAAC,eAAe,GAAG,iBAAiB,CAAC,CAAC,EAAE,KAAK,MAAM;AAC9D,UAAI,oBAAoB;AACtB,gBAAQ,oBAAoB,gBAAgB,kBAAkB;AAAA,MAChE;AACA,wBAAkB,KAAK;AACvB,wBAAkB;AAAA,IACpB,CAAC;AAAA,EACH,CAAC,GAAG,CAAC,eAAe,CAAC;AACrB,SAAO;AAAA,IACL,kBAAkB,iBAAiB,qBAAqB;AAAA,IACxD;AAAA,IACA,YAAY;AAAA,MACV,oCAAoC,GAAG,wBAAwB;AAAA,IACjE;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -54,7 +54,7 @@ function UnforwardedNumberControl(props, forwardedRef) {
54
54
  version: "6.3"
55
55
  });
56
56
  }
57
- const inputRef = useRef();
57
+ const inputRef = useRef(null);
58
58
  const mergedRef = useMergeRefs([inputRef, forwardedRef]);
59
59
  const isStepAny = step === "any";
60
60
  const baseStep = isStepAny ? 1 : ensureNumber(step);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/number-control/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { plus as plusIcon, reset as resetIcon } from '@wordpress/icons';\nimport { useMergeRefs } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { Input, SpinButton, styles } from './styles/number-control-styles';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { add, subtract, clamp, ensureValidStep } from '../utils/math';\nimport { ensureNumber, isValueEmpty } from '../utils/values';\nimport { HStack } from '../h-stack';\nimport { Spacer } from '../spacer';\nimport { useCx } from '../utils';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst noop = () => {};\nfunction UnforwardedNumberControl(props, forwardedRef) {\n const {\n __unstableStateReducer: stateReducerProp,\n className,\n dragDirection = 'n',\n hideHTMLArrows = false,\n spinControls = hideHTMLArrows ? 'none' : 'native',\n isDragEnabled = true,\n isShiftStepEnabled = true,\n label,\n max = Infinity,\n min = -Infinity,\n required = false,\n shiftStep = 10,\n step = 1,\n spinFactor = 1,\n type: typeProp = 'number',\n value: valueProp,\n size = 'default',\n suffix,\n onChange = noop,\n __shouldNotWarnDeprecated36pxSize,\n ...restProps\n } = useDeprecated36pxDefaultSizeProp(props);\n maybeWarnDeprecated36pxSize({\n componentName: 'NumberControl',\n size,\n __next40pxDefaultSize: restProps.__next40pxDefaultSize,\n __shouldNotWarnDeprecated36pxSize\n });\n if (hideHTMLArrows) {\n deprecated('wp.components.NumberControl hideHTMLArrows prop ', {\n alternative: 'spinControls=\"none\"',\n since: '6.2',\n version: '6.3'\n });\n }\n const inputRef = useRef();\n const mergedRef = useMergeRefs([inputRef, forwardedRef]);\n const isStepAny = step === 'any';\n const baseStep = isStepAny ? 1 : ensureNumber(step);\n const baseSpin = ensureNumber(spinFactor) * baseStep;\n const constrainValue = (value, stepOverride) => {\n // When step is not \"any\" the value must be a valid step.\n if (!isStepAny) {\n value = ensureValidStep(value, min, stepOverride ?? baseStep);\n }\n return `${clamp(value, min, max)}`;\n };\n const baseValue = constrainValue(0);\n const autoComplete = typeProp === 'number' ? 'off' : undefined;\n const classes = clsx('components-number-control', className);\n const cx = useCx();\n const spinButtonClasses = cx(size === 'small' && styles.smallSpinButtons);\n const spinValue = (value, direction, event) => {\n event?.preventDefault();\n const shift = event?.shiftKey && isShiftStepEnabled;\n const delta = shift ? ensureNumber(shiftStep) * baseSpin : baseSpin;\n let nextValue = isValueEmpty(value) ? baseValue : value;\n if (direction === 'up') {\n nextValue = add(nextValue, delta);\n } else if (direction === 'down') {\n nextValue = subtract(nextValue, delta);\n }\n return constrainValue(nextValue, shift ? delta : undefined);\n };\n\n /**\n * \"Middleware\" function that intercepts updates from InputControl.\n * This allows us to tap into actions to transform the (next) state for\n * InputControl.\n *\n * @return The updated state to apply to InputControl\n */\n const numberControlStateReducer = (state, action) => {\n const nextState = {\n ...state\n };\n const {\n type,\n payload\n } = action;\n const event = payload.event;\n const currentValue = nextState.value;\n\n /**\n * Handles custom UP and DOWN Keyboard events\n */\n if (type === inputControlActionTypes.PRESS_UP || type === inputControlActionTypes.PRESS_DOWN) {\n nextState.value = spinValue(currentValue, type === inputControlActionTypes.PRESS_UP ? 'up' : 'down', event);\n }\n\n /**\n * Handles drag to update events\n */\n if (type === inputControlActionTypes.DRAG && isDragEnabled) {\n const [x, y] = payload.delta;\n const enableShift = payload.shiftKey && isShiftStepEnabled;\n const modifier = enableShift ? ensureNumber(shiftStep) * baseSpin : baseSpin;\n let directionModifier;\n let delta;\n switch (dragDirection) {\n case 'n':\n delta = y;\n directionModifier = -1;\n break;\n case 'e':\n delta = x;\n directionModifier = isRTL() ? -1 : 1;\n break;\n case 's':\n delta = y;\n directionModifier = 1;\n break;\n case 'w':\n delta = x;\n directionModifier = isRTL() ? 1 : -1;\n break;\n }\n if (delta !== 0) {\n delta = Math.ceil(Math.abs(delta)) * Math.sign(delta);\n const distance = delta * modifier * directionModifier;\n nextState.value = constrainValue(\n // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n add(currentValue, distance), enableShift ? modifier : undefined);\n }\n }\n\n /**\n * Handles commit (ENTER key press or blur)\n */\n if (type === inputControlActionTypes.PRESS_ENTER || type === inputControlActionTypes.COMMIT) {\n const applyEmptyValue = required === false && currentValue === '';\n nextState.value = applyEmptyValue ? currentValue :\n // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n constrainValue(currentValue);\n }\n return nextState;\n };\n const buildSpinButtonClickHandler = direction => event => onChange(String(spinValue(valueProp, direction, event)), {\n // Set event.target to the <input> so that consumers can use\n // e.g. event.target.validity.\n event: {\n ...event,\n target: inputRef.current\n }\n });\n return /*#__PURE__*/_jsx(Input, {\n autoComplete: autoComplete,\n inputMode: \"numeric\",\n ...restProps,\n className: classes,\n dragDirection: dragDirection,\n hideHTMLArrows: spinControls !== 'native',\n isDragEnabled: isDragEnabled,\n label: label,\n max: max === Infinity ? undefined : max,\n min: min === -Infinity ? undefined : min,\n ref: mergedRef,\n required: required,\n step: step,\n type: typeProp\n // @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components\n ,\n value: valueProp,\n __unstableStateReducer: (state, action) => {\n const baseState = numberControlStateReducer(state, action);\n return stateReducerProp?.(baseState, action) ?? baseState;\n },\n size: size,\n __shouldNotWarnDeprecated36pxSize: true,\n suffix: spinControls === 'custom' ? /*#__PURE__*/_jsxs(_Fragment, {\n children: [suffix, /*#__PURE__*/_jsx(Spacer, {\n marginBottom: 0,\n marginRight: 2,\n children: /*#__PURE__*/_jsxs(HStack, {\n spacing: 1,\n children: [/*#__PURE__*/_jsx(SpinButton, {\n className: spinButtonClasses,\n icon: plusIcon,\n size: \"small\",\n label: __('Increment'),\n onClick: buildSpinButtonClickHandler('up')\n }), /*#__PURE__*/_jsx(SpinButton, {\n className: spinButtonClasses,\n icon: resetIcon,\n size: \"small\",\n label: __('Decrement'),\n onClick: buildSpinButtonClickHandler('down')\n })]\n })\n })]\n }) : suffix,\n onChange: onChange\n });\n}\nexport const NumberControl = forwardRef(UnforwardedNumberControl);\nNumberControl.displayName = 'NumberControl';\nexport default NumberControl;"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAIjB,SAAS,QAAQ,kBAAkB;AACnC,SAAS,OAAO,UAAU;AAC1B,SAAS,QAAQ,UAAU,SAAS,iBAAiB;AACrD,SAAS,oBAAoB;AAC7B,OAAO,gBAAgB;AAKvB,SAAS,OAAO,YAAY,cAAc;AAC1C,YAAY,6BAA6B;AACzC,SAAS,KAAK,UAAU,OAAO,uBAAuB;AACtD,SAAS,cAAc,oBAAoB;AAC3C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AAAA,QACd,aAAa;AAAA,QACb,UAAuB,sBAAM,QAAQ;AAAA,UACnC,SAAS;AAAA,UACT,UAAU,CAAc,qBAAK,YAAY;AAAA,YACvC,WAAW;AAAA,YACX,MAAM;AAAA,YACN,MAAM;AAAA,YACN,OAAO,GAAG,WAAW;AAAA,YACrB,SAAS,4BAA4B,IAAI;AAAA,UAC3C,CAAC,GAAgB,qBAAK,YAAY;AAAA,YAChC,WAAW;AAAA,YACX,MAAM;AAAA,YACN,MAAM;AAAA,YACN,OAAO,GAAG,WAAW;AAAA,YACrB,SAAS,4BAA4B,MAAM;AAAA,UAC7C,CAAC,CAAC;AAAA,QACJ,CAAC;AAAA,MACH,CAAC,CAAC;AAAA,IACJ,CAAC,IAAI;AAAA,IACL;AAAA,EACF,CAAC;AACH;AACO,IAAM,gBAAgB,WAAW,wBAAwB;AAChE,cAAc,cAAc;AAC5B,IAAO,yBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { plus as plusIcon, reset as resetIcon } from '@wordpress/icons';\nimport { useMergeRefs } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { Input, SpinButton, styles } from './styles/number-control-styles';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { add, subtract, clamp, ensureValidStep } from '../utils/math';\nimport { ensureNumber, isValueEmpty } from '../utils/values';\nimport { HStack } from '../h-stack';\nimport { Spacer } from '../spacer';\nimport { useCx } from '../utils';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst noop = () => {};\nfunction UnforwardedNumberControl(props, forwardedRef) {\n const {\n __unstableStateReducer: stateReducerProp,\n className,\n dragDirection = 'n',\n hideHTMLArrows = false,\n spinControls = hideHTMLArrows ? 'none' : 'native',\n isDragEnabled = true,\n isShiftStepEnabled = true,\n label,\n max = Infinity,\n min = -Infinity,\n required = false,\n shiftStep = 10,\n step = 1,\n spinFactor = 1,\n type: typeProp = 'number',\n value: valueProp,\n size = 'default',\n suffix,\n onChange = noop,\n __shouldNotWarnDeprecated36pxSize,\n ...restProps\n } = useDeprecated36pxDefaultSizeProp(props);\n maybeWarnDeprecated36pxSize({\n componentName: 'NumberControl',\n size,\n __next40pxDefaultSize: restProps.__next40pxDefaultSize,\n __shouldNotWarnDeprecated36pxSize\n });\n if (hideHTMLArrows) {\n deprecated('wp.components.NumberControl hideHTMLArrows prop ', {\n alternative: 'spinControls=\"none\"',\n since: '6.2',\n version: '6.3'\n });\n }\n const inputRef = useRef(null);\n const mergedRef = useMergeRefs([inputRef, forwardedRef]);\n const isStepAny = step === 'any';\n const baseStep = isStepAny ? 1 : ensureNumber(step);\n const baseSpin = ensureNumber(spinFactor) * baseStep;\n const constrainValue = (value, stepOverride) => {\n // When step is not \"any\" the value must be a valid step.\n if (!isStepAny) {\n value = ensureValidStep(value, min, stepOverride ?? baseStep);\n }\n return `${clamp(value, min, max)}`;\n };\n const baseValue = constrainValue(0);\n const autoComplete = typeProp === 'number' ? 'off' : undefined;\n const classes = clsx('components-number-control', className);\n const cx = useCx();\n const spinButtonClasses = cx(size === 'small' && styles.smallSpinButtons);\n const spinValue = (value, direction, event) => {\n event?.preventDefault();\n const shift = event?.shiftKey && isShiftStepEnabled;\n const delta = shift ? ensureNumber(shiftStep) * baseSpin : baseSpin;\n let nextValue = isValueEmpty(value) ? baseValue : value;\n if (direction === 'up') {\n nextValue = add(nextValue, delta);\n } else if (direction === 'down') {\n nextValue = subtract(nextValue, delta);\n }\n return constrainValue(nextValue, shift ? delta : undefined);\n };\n\n /**\n * \"Middleware\" function that intercepts updates from InputControl.\n * This allows us to tap into actions to transform the (next) state for\n * InputControl.\n *\n * @return The updated state to apply to InputControl\n */\n const numberControlStateReducer = (state, action) => {\n const nextState = {\n ...state\n };\n const {\n type,\n payload\n } = action;\n const event = payload.event;\n const currentValue = nextState.value;\n\n /**\n * Handles custom UP and DOWN Keyboard events\n */\n if (type === inputControlActionTypes.PRESS_UP || type === inputControlActionTypes.PRESS_DOWN) {\n nextState.value = spinValue(currentValue, type === inputControlActionTypes.PRESS_UP ? 'up' : 'down', event);\n }\n\n /**\n * Handles drag to update events\n */\n if (type === inputControlActionTypes.DRAG && isDragEnabled) {\n const [x, y] = payload.delta;\n const enableShift = payload.shiftKey && isShiftStepEnabled;\n const modifier = enableShift ? ensureNumber(shiftStep) * baseSpin : baseSpin;\n let directionModifier;\n let delta;\n switch (dragDirection) {\n case 'n':\n delta = y;\n directionModifier = -1;\n break;\n case 'e':\n delta = x;\n directionModifier = isRTL() ? -1 : 1;\n break;\n case 's':\n delta = y;\n directionModifier = 1;\n break;\n case 'w':\n delta = x;\n directionModifier = isRTL() ? 1 : -1;\n break;\n }\n if (delta !== 0) {\n delta = Math.ceil(Math.abs(delta)) * Math.sign(delta);\n const distance = delta * modifier * directionModifier;\n nextState.value = constrainValue(\n // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n add(currentValue, distance), enableShift ? modifier : undefined);\n }\n }\n\n /**\n * Handles commit (ENTER key press or blur)\n */\n if (type === inputControlActionTypes.PRESS_ENTER || type === inputControlActionTypes.COMMIT) {\n const applyEmptyValue = required === false && currentValue === '';\n nextState.value = applyEmptyValue ? currentValue :\n // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n constrainValue(currentValue);\n }\n return nextState;\n };\n const buildSpinButtonClickHandler = direction => event => onChange(String(spinValue(valueProp, direction, event)), {\n // Set event.target to the <input> so that consumers can use\n // e.g. event.target.validity.\n event: {\n ...event,\n target: inputRef.current\n }\n });\n return /*#__PURE__*/_jsx(Input, {\n autoComplete: autoComplete,\n inputMode: \"numeric\",\n ...restProps,\n className: classes,\n dragDirection: dragDirection,\n hideHTMLArrows: spinControls !== 'native',\n isDragEnabled: isDragEnabled,\n label: label,\n max: max === Infinity ? undefined : max,\n min: min === -Infinity ? undefined : min,\n ref: mergedRef,\n required: required,\n step: step,\n type: typeProp\n // @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components\n ,\n value: valueProp,\n __unstableStateReducer: (state, action) => {\n const baseState = numberControlStateReducer(state, action);\n return stateReducerProp?.(baseState, action) ?? baseState;\n },\n size: size,\n __shouldNotWarnDeprecated36pxSize: true,\n suffix: spinControls === 'custom' ? /*#__PURE__*/_jsxs(_Fragment, {\n children: [suffix, /*#__PURE__*/_jsx(Spacer, {\n marginBottom: 0,\n marginRight: 2,\n children: /*#__PURE__*/_jsxs(HStack, {\n spacing: 1,\n children: [/*#__PURE__*/_jsx(SpinButton, {\n className: spinButtonClasses,\n icon: plusIcon,\n size: \"small\",\n label: __('Increment'),\n onClick: buildSpinButtonClickHandler('up')\n }), /*#__PURE__*/_jsx(SpinButton, {\n className: spinButtonClasses,\n icon: resetIcon,\n size: \"small\",\n label: __('Decrement'),\n onClick: buildSpinButtonClickHandler('down')\n })]\n })\n })]\n }) : suffix,\n onChange: onChange\n });\n}\nexport const NumberControl = forwardRef(UnforwardedNumberControl);\nNumberControl.displayName = 'NumberControl';\nexport default NumberControl;"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAIjB,SAAS,QAAQ,kBAAkB;AACnC,SAAS,OAAO,UAAU;AAC1B,SAAS,QAAQ,UAAU,SAAS,iBAAiB;AACrD,SAAS,oBAAoB;AAC7B,OAAO,gBAAgB;AAKvB,SAAS,OAAO,YAAY,cAAc;AAC1C,YAAY,6BAA6B;AACzC,SAAS,KAAK,UAAU,OAAO,uBAAuB;AACtD,SAAS,cAAc,oBAAoB;AAC3C,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,wCAAwC;AACjD,SAAS,mCAAmC;AAC5C,SAAS,OAAO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Y;AAAA,YACvC,WAAW;AAAA,YACX,MAAM;AAAA,YACN,MAAM;AAAA,YACN,OAAO,GAAG,WAAW;AAAA,YACrB,SAAS,4BAA4B,IAAI;AAAA,UAC3C,CAAC,GAAgB,qBAAK,YAAY;AAAA,YAChC,WAAW;AAAA,YACX,MAAM;AAAA,YACN,MAAM;AAAA,YACN,OAAO,GAAG,WAAW;AAAA,YACrB,SAAS,4BAA4B,MAAM;AAAA,UAC7C,CAAC,CAAC;AAAA,QACJ,CAAC;AAAA,MACH,CAAC,CAAC;AAAA,IACJ,CAAC,IAAI;AAAA,IACL;AAAA,EACF,CAAC;AACH;AACO,IAAM,gBAAgB,WAAW,wBAAwB;AAChE,cAAc,cAAc;AAC5B,IAAO,yBAAQ;",
6
6
  "names": []
7
7
  }
@@ -203,7 +203,7 @@ function PaletteEditListView({
203
203
  popoverProps,
204
204
  addColorRef
205
205
  }) {
206
- const elementsReferenceRef = useRef();
206
+ const elementsReferenceRef = useRef(void 0);
207
207
  useEffect(() => {
208
208
  elementsReferenceRef.current = elements;
209
209
  }, [elements]);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/palette-edit/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect, useCallback, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport { FlexBlock, FlexItem } from '../flex';\nimport { HStack } from '../h-stack';\nimport { Item, ItemGroup } from '../item-group';\nimport { VStack } from '../v-stack';\nimport GradientPicker from '../gradient-picker';\nimport ColorPalette from '../color-palette';\nimport DropdownMenu from '../dropdown-menu';\nimport Popover from '../popover';\nimport { PaletteActionsContainer, PaletteEditStyles, PaletteHeading, IndicatorStyled, NameContainer, NameInputControl, DoneButton, RemoveButton, PaletteEditContents } from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { kebabCase } from '../utils/strings';\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst DEFAULT_COLOR = '#000';\nfunction NameInput({\n value,\n onChange,\n label\n}) {\n return /*#__PURE__*/_jsx(NameInputControl, {\n size: \"compact\",\n label: label,\n hideLabelFromVision: true,\n value: value,\n onChange: onChange\n });\n}\n\n/*\n * Deduplicates the slugs of the provided elements.\n */\nexport function deduplicateElementSlugs(elements) {\n const slugCounts = {};\n return elements.map(element => {\n let newSlug;\n const {\n slug\n } = element;\n slugCounts[slug] = (slugCounts[slug] || 0) + 1;\n if (slugCounts[slug] > 1) {\n newSlug = `${slug}-${slugCounts[slug] - 1}`;\n }\n return {\n ...element,\n slug: newSlug ?? slug\n };\n });\n}\n\n/**\n * Returns a name and slug for a palette item. The name takes the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs.\n * It expects slugs to be in the format: slugPrefix + color- + number.\n * It then sets the id component of the new name based on the incremented id of the highest existing slug id.\n *\n * @param elements An array of color palette items.\n * @param slugPrefix The slug prefix used to match the element slug.\n *\n * @return A name and slug for the new palette item.\n */\nexport function getNameAndSlugForPosition(elements, slugPrefix) {\n const nameRegex = new RegExp(`^${slugPrefix}color-([\\\\d]+)$`);\n const position = elements.reduce((previousValue, currentValue) => {\n if (typeof currentValue?.slug === 'string') {\n const matches = currentValue?.slug.match(nameRegex);\n if (matches) {\n const id = parseInt(matches[1], 10);\n if (id >= previousValue) {\n return id + 1;\n }\n }\n }\n return previousValue;\n }, 1);\n return {\n name: sprintf(/* translators: %d: is an id for a custom color */\n __('Color %d'), position),\n slug: `${slugPrefix}color-${position}`\n };\n}\nfunction ColorPickerPopover({\n isGradient,\n element,\n onChange,\n popoverProps: receivedPopoverProps,\n onClose = () => {}\n}) {\n const popoverProps = useMemo(() => ({\n shift: true,\n offset: 20,\n // Disabling resize as it would otherwise cause the popover to show\n // scrollbars while dragging the color picker's handle close to the\n // popover edge.\n resize: false,\n placement: 'left-start',\n ...receivedPopoverProps,\n className: clsx('components-palette-edit__popover', receivedPopoverProps?.className)\n }), [receivedPopoverProps]);\n return /*#__PURE__*/_jsxs(Popover, {\n ...popoverProps,\n onClose: onClose,\n children: [!isGradient && /*#__PURE__*/_jsx(ColorPicker, {\n color: element.color,\n enableAlpha: true,\n onChange: newColor => {\n onChange({\n ...element,\n color: newColor\n });\n }\n }), isGradient && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-palette-edit__popover-gradient-picker\",\n children: /*#__PURE__*/_jsx(CustomGradientPicker, {\n __experimentalIsRenderedInSidebar: true,\n value: element.gradient,\n onChange: newGradient => {\n onChange({\n ...element,\n gradient: newGradient\n });\n }\n })\n })]\n });\n}\nfunction Option({\n canOnlyChangeValues,\n element,\n onChange,\n onRemove,\n popoverProps: receivedPopoverProps,\n slugPrefix,\n isGradient\n}) {\n const value = isGradient ? element.gradient : element.color;\n const [isEditingColor, setIsEditingColor] = useState(false);\n\n // Use internal state instead of a ref to make sure that the component\n // re-renders when the popover's anchor updates.\n const [popoverAnchor, setPopoverAnchor] = useState(null);\n const popoverProps = useMemo(() => ({\n ...receivedPopoverProps,\n // Use the custom palette color item as the popover anchor.\n anchor: popoverAnchor\n }), [popoverAnchor, receivedPopoverProps]);\n return /*#__PURE__*/_jsxs(Item, {\n ref: setPopoverAnchor,\n size: \"small\",\n children: [/*#__PURE__*/_jsxs(HStack, {\n justify: \"flex-start\",\n children: [/*#__PURE__*/_jsx(Button, {\n size: \"small\",\n onClick: () => {\n setIsEditingColor(true);\n },\n \"aria-label\": sprintf(\n // translators: %s is a color or gradient name, e.g. \"Red\".\n __('Edit: %s'), element.name.trim().length ? element.name : value || ''),\n style: {\n padding: 0\n },\n children: /*#__PURE__*/_jsx(IndicatorStyled, {\n colorValue: value\n })\n }), /*#__PURE__*/_jsx(FlexBlock, {\n children: !canOnlyChangeValues ? /*#__PURE__*/_jsx(NameInput, {\n label: isGradient ? __('Gradient name') : __('Color name'),\n value: element.name,\n onChange: nextName => onChange({\n ...element,\n name: nextName,\n slug: slugPrefix + kebabCase(nextName ?? '')\n })\n }) : /*#__PURE__*/_jsx(NameContainer, {\n children: element.name.trim().length ? element.name : /* Fall back to non-breaking space to maintain height */\n '\\u00A0'\n })\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(FlexItem, {\n children: /*#__PURE__*/_jsx(RemoveButton, {\n size: \"small\",\n icon: lineSolid,\n label: sprintf(\n // translators: %s is a color or gradient name, e.g. \"Red\".\n __('Remove color: %s'), element.name.trim().length ? element.name : value || ''),\n onClick: onRemove\n })\n })]\n }), isEditingColor && /*#__PURE__*/_jsx(ColorPickerPopover, {\n isGradient: isGradient,\n onChange: onChange,\n element: element,\n popoverProps: popoverProps,\n onClose: () => setIsEditingColor(false)\n })]\n });\n}\nfunction PaletteEditListView({\n elements,\n onChange,\n canOnlyChangeValues,\n slugPrefix,\n isGradient,\n popoverProps,\n addColorRef\n}) {\n // When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.\n const elementsReferenceRef = useRef();\n useEffect(() => {\n elementsReferenceRef.current = elements;\n }, [elements]);\n const debounceOnChange = useDebounce(updatedElements => onChange(deduplicateElementSlugs(updatedElements)), 100);\n return /*#__PURE__*/_jsx(VStack, {\n spacing: 3,\n children: /*#__PURE__*/_jsx(ItemGroup, {\n isRounded: true,\n isBordered: true,\n isSeparated: true,\n children: elements.map((element, index) => /*#__PURE__*/_jsx(Option, {\n isGradient: isGradient,\n canOnlyChangeValues: canOnlyChangeValues,\n element: element,\n onChange: newElement => {\n debounceOnChange(elements.map((currentElement, currentIndex) => {\n if (currentIndex === index) {\n return newElement;\n }\n return currentElement;\n }));\n },\n onRemove: () => {\n const newElements = elements.filter((_currentElement, currentIndex) => {\n if (currentIndex === index) {\n return false;\n }\n return true;\n });\n onChange(newElements.length ? newElements : undefined);\n addColorRef.current?.focus();\n },\n slugPrefix: slugPrefix,\n popoverProps: popoverProps\n }, index))\n })\n });\n}\nconst EMPTY_ARRAY = [];\n\n/**\n * Allows editing a palette of colors or gradients.\n *\n * ```jsx\n * import { PaletteEdit } from '@wordpress/components';\n * const MyPaletteEdit = () => {\n * const [ controlledColors, setControlledColors ] = useState( colors );\n *\n * return (\n * <PaletteEdit\n * colors={ controlledColors }\n * onChange={ ( newColors?: Color[] ) => {\n * setControlledColors( newColors );\n * } }\n * paletteLabel=\"Here is a label\"\n * />\n * );\n * };\n * ```\n */\nexport function PaletteEdit({\n gradients,\n colors = EMPTY_ARRAY,\n onChange,\n paletteLabel,\n paletteLabelHeadingLevel = 2,\n emptyMessage,\n canOnlyChangeValues,\n canReset,\n slugPrefix = '',\n popoverProps\n}) {\n const isGradient = !!gradients;\n const elements = isGradient ? gradients : colors;\n const [isEditing, setIsEditing] = useState(false);\n const [editingElement, setEditingElement] = useState(null);\n const isAdding = isEditing && !!editingElement && elements[editingElement] && !elements[editingElement].slug;\n const elementsLength = elements.length;\n const hasElements = elementsLength > 0;\n const debounceOnChange = useDebounce(onChange, 100);\n const onSelectPaletteItem = useCallback((value, newEditingElementIndex) => {\n const selectedElement = newEditingElementIndex === undefined ? undefined : elements[newEditingElementIndex];\n const key = isGradient ? 'gradient' : 'color';\n // Ensures that the index returned matches a known element value.\n if (!!selectedElement && selectedElement[key] === value) {\n setEditingElement(newEditingElementIndex);\n } else {\n setIsEditing(true);\n }\n }, [isGradient, elements]);\n const addColorRef = useRef(null);\n return /*#__PURE__*/_jsxs(PaletteEditStyles, {\n children: [/*#__PURE__*/_jsxs(HStack, {\n children: [/*#__PURE__*/_jsx(PaletteHeading, {\n level: paletteLabelHeadingLevel,\n children: paletteLabel\n }), /*#__PURE__*/_jsxs(PaletteActionsContainer, {\n children: [hasElements && isEditing && /*#__PURE__*/_jsx(DoneButton, {\n size: \"small\",\n onClick: () => {\n setIsEditing(false);\n setEditingElement(null);\n },\n children: __('Done')\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(Button, {\n ref: addColorRef,\n size: \"small\",\n isPressed: isAdding,\n icon: plus,\n label: isGradient ? __('Add gradient') : __('Add color'),\n onClick: () => {\n const {\n name,\n slug\n } = getNameAndSlugForPosition(elements, slugPrefix);\n if (!!gradients) {\n onChange([...gradients, {\n gradient: DEFAULT_GRADIENT,\n name,\n slug\n }]);\n } else {\n onChange([...colors, {\n color: DEFAULT_COLOR,\n name,\n slug\n }]);\n }\n setIsEditing(true);\n setEditingElement(elements.length);\n }\n }), hasElements && (!isEditing || !canOnlyChangeValues || canReset) && /*#__PURE__*/_jsx(DropdownMenu, {\n icon: moreVertical,\n label: isGradient ? __('Gradient options') : __('Color options'),\n toggleProps: {\n size: 'small'\n },\n children: ({\n onClose\n }) => /*#__PURE__*/_jsx(_Fragment, {\n children: /*#__PURE__*/_jsxs(NavigableMenu, {\n role: \"menu\",\n children: [!isEditing && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n variant: \"tertiary\",\n onClick: () => {\n setIsEditing(true);\n onClose();\n },\n className: \"components-palette-edit__menu-button\",\n children: __('Show details')\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n variant: \"tertiary\",\n onClick: () => {\n setEditingElement(null);\n setIsEditing(false);\n onChange();\n onClose();\n },\n className: \"components-palette-edit__menu-button\",\n children: isGradient ? __('Remove all gradients') : __('Remove all colors')\n }), canReset && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n className: \"components-palette-edit__menu-button\",\n variant: \"tertiary\",\n onClick: () => {\n setEditingElement(null);\n onChange();\n onClose();\n },\n children: isGradient ? __('Reset gradient') : __('Reset colors')\n })]\n })\n })\n })]\n })]\n }), hasElements && /*#__PURE__*/_jsxs(PaletteEditContents, {\n children: [isEditing && /*#__PURE__*/_jsx(PaletteEditListView, {\n canOnlyChangeValues: canOnlyChangeValues,\n elements: elements\n // @ts-expect-error TODO: Don't know how to resolve\n ,\n onChange: onChange,\n slugPrefix: slugPrefix,\n isGradient: isGradient,\n popoverProps: popoverProps,\n addColorRef: addColorRef\n }), !isEditing && editingElement !== null && /*#__PURE__*/_jsx(ColorPickerPopover, {\n isGradient: isGradient,\n onClose: () => setEditingElement(null),\n onChange: newElement => {\n debounceOnChange(\n // @ts-expect-error TODO: Don't know how to resolve\n elements.map((currentElement, currentIndex) => {\n if (currentIndex === editingElement) {\n return newElement;\n }\n return currentElement;\n }));\n },\n element: elements[editingElement ?? -1],\n popoverProps: popoverProps\n }), !isEditing && (isGradient ? /*#__PURE__*/_jsx(GradientPicker, {\n gradients: gradients,\n onChange: onSelectPaletteItem,\n clearable: false,\n disableCustomGradients: true\n }) : /*#__PURE__*/_jsx(ColorPalette, {\n colors: colors,\n onChange: onSelectPaletteItem,\n clearable: false,\n disableCustomColors: true\n }))]\n }), !hasElements && emptyMessage && /*#__PURE__*/_jsx(PaletteEditContents, {\n children: emptyMessage\n })]\n });\n}\nexport default PaletteEdit;"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU,QAAQ,WAAW,aAAa,eAAe;AAClE,SAAS,IAAI,eAAe;AAC5B,SAAS,WAAW,cAAc,YAAY;AAC9C,SAAS,mBAAmB;AAK5B,OAAO,YAAY;AACnB,SAAS,mBAAmB;AAC5B,SAAS,WAAW,gBAAgB;AACpC,SAAS,cAAc;AACvB,SAAS,MAAM,iBAAiB;AAChC,SAAS,cAAc;AACvB,OAAO,oBAAoB;AAC3B,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;AACzB,OAAO,aAAa;AACpB,SAAS,yBAAyB,mBAAmB,gBAAgB,iBAAiB,eAAe,kBAAkB,YAAY,cAAc,2BAA2B;AAC5K,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,OAAO,0BAA0B;AACjC,SAA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AAA,IACZ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,uBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect, useCallback, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport { FlexBlock, FlexItem } from '../flex';\nimport { HStack } from '../h-stack';\nimport { Item, ItemGroup } from '../item-group';\nimport { VStack } from '../v-stack';\nimport GradientPicker from '../gradient-picker';\nimport ColorPalette from '../color-palette';\nimport DropdownMenu from '../dropdown-menu';\nimport Popover from '../popover';\nimport { PaletteActionsContainer, PaletteEditStyles, PaletteHeading, IndicatorStyled, NameContainer, NameInputControl, DoneButton, RemoveButton, PaletteEditContents } from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { kebabCase } from '../utils/strings';\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst DEFAULT_COLOR = '#000';\nfunction NameInput({\n value,\n onChange,\n label\n}) {\n return /*#__PURE__*/_jsx(NameInputControl, {\n size: \"compact\",\n label: label,\n hideLabelFromVision: true,\n value: value,\n onChange: onChange\n });\n}\n\n/*\n * Deduplicates the slugs of the provided elements.\n */\nexport function deduplicateElementSlugs(elements) {\n const slugCounts = {};\n return elements.map(element => {\n let newSlug;\n const {\n slug\n } = element;\n slugCounts[slug] = (slugCounts[slug] || 0) + 1;\n if (slugCounts[slug] > 1) {\n newSlug = `${slug}-${slugCounts[slug] - 1}`;\n }\n return {\n ...element,\n slug: newSlug ?? slug\n };\n });\n}\n\n/**\n * Returns a name and slug for a palette item. The name takes the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs.\n * It expects slugs to be in the format: slugPrefix + color- + number.\n * It then sets the id component of the new name based on the incremented id of the highest existing slug id.\n *\n * @param elements An array of color palette items.\n * @param slugPrefix The slug prefix used to match the element slug.\n *\n * @return A name and slug for the new palette item.\n */\nexport function getNameAndSlugForPosition(elements, slugPrefix) {\n const nameRegex = new RegExp(`^${slugPrefix}color-([\\\\d]+)$`);\n const position = elements.reduce((previousValue, currentValue) => {\n if (typeof currentValue?.slug === 'string') {\n const matches = currentValue?.slug.match(nameRegex);\n if (matches) {\n const id = parseInt(matches[1], 10);\n if (id >= previousValue) {\n return id + 1;\n }\n }\n }\n return previousValue;\n }, 1);\n return {\n name: sprintf(/* translators: %d: is an id for a custom color */\n __('Color %d'), position),\n slug: `${slugPrefix}color-${position}`\n };\n}\nfunction ColorPickerPopover({\n isGradient,\n element,\n onChange,\n popoverProps: receivedPopoverProps,\n onClose = () => {}\n}) {\n const popoverProps = useMemo(() => ({\n shift: true,\n offset: 20,\n // Disabling resize as it would otherwise cause the popover to show\n // scrollbars while dragging the color picker's handle close to the\n // popover edge.\n resize: false,\n placement: 'left-start',\n ...receivedPopoverProps,\n className: clsx('components-palette-edit__popover', receivedPopoverProps?.className)\n }), [receivedPopoverProps]);\n return /*#__PURE__*/_jsxs(Popover, {\n ...popoverProps,\n onClose: onClose,\n children: [!isGradient && /*#__PURE__*/_jsx(ColorPicker, {\n color: element.color,\n enableAlpha: true,\n onChange: newColor => {\n onChange({\n ...element,\n color: newColor\n });\n }\n }), isGradient && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-palette-edit__popover-gradient-picker\",\n children: /*#__PURE__*/_jsx(CustomGradientPicker, {\n __experimentalIsRenderedInSidebar: true,\n value: element.gradient,\n onChange: newGradient => {\n onChange({\n ...element,\n gradient: newGradient\n });\n }\n })\n })]\n });\n}\nfunction Option({\n canOnlyChangeValues,\n element,\n onChange,\n onRemove,\n popoverProps: receivedPopoverProps,\n slugPrefix,\n isGradient\n}) {\n const value = isGradient ? element.gradient : element.color;\n const [isEditingColor, setIsEditingColor] = useState(false);\n\n // Use internal state instead of a ref to make sure that the component\n // re-renders when the popover's anchor updates.\n const [popoverAnchor, setPopoverAnchor] = useState(null);\n const popoverProps = useMemo(() => ({\n ...receivedPopoverProps,\n // Use the custom palette color item as the popover anchor.\n anchor: popoverAnchor\n }), [popoverAnchor, receivedPopoverProps]);\n return /*#__PURE__*/_jsxs(Item, {\n ref: setPopoverAnchor,\n size: \"small\",\n children: [/*#__PURE__*/_jsxs(HStack, {\n justify: \"flex-start\",\n children: [/*#__PURE__*/_jsx(Button, {\n size: \"small\",\n onClick: () => {\n setIsEditingColor(true);\n },\n \"aria-label\": sprintf(\n // translators: %s is a color or gradient name, e.g. \"Red\".\n __('Edit: %s'), element.name.trim().length ? element.name : value || ''),\n style: {\n padding: 0\n },\n children: /*#__PURE__*/_jsx(IndicatorStyled, {\n colorValue: value\n })\n }), /*#__PURE__*/_jsx(FlexBlock, {\n children: !canOnlyChangeValues ? /*#__PURE__*/_jsx(NameInput, {\n label: isGradient ? __('Gradient name') : __('Color name'),\n value: element.name,\n onChange: nextName => onChange({\n ...element,\n name: nextName,\n slug: slugPrefix + kebabCase(nextName ?? '')\n })\n }) : /*#__PURE__*/_jsx(NameContainer, {\n children: element.name.trim().length ? element.name : /* Fall back to non-breaking space to maintain height */\n '\\u00A0'\n })\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(FlexItem, {\n children: /*#__PURE__*/_jsx(RemoveButton, {\n size: \"small\",\n icon: lineSolid,\n label: sprintf(\n // translators: %s is a color or gradient name, e.g. \"Red\".\n __('Remove color: %s'), element.name.trim().length ? element.name : value || ''),\n onClick: onRemove\n })\n })]\n }), isEditingColor && /*#__PURE__*/_jsx(ColorPickerPopover, {\n isGradient: isGradient,\n onChange: onChange,\n element: element,\n popoverProps: popoverProps,\n onClose: () => setIsEditingColor(false)\n })]\n });\n}\nfunction PaletteEditListView({\n elements,\n onChange,\n canOnlyChangeValues,\n slugPrefix,\n isGradient,\n popoverProps,\n addColorRef\n}) {\n // When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.\n const elementsReferenceRef = useRef(undefined);\n useEffect(() => {\n elementsReferenceRef.current = elements;\n }, [elements]);\n const debounceOnChange = useDebounce(updatedElements => onChange(deduplicateElementSlugs(updatedElements)), 100);\n return /*#__PURE__*/_jsx(VStack, {\n spacing: 3,\n children: /*#__PURE__*/_jsx(ItemGroup, {\n isRounded: true,\n isBordered: true,\n isSeparated: true,\n children: elements.map((element, index) => /*#__PURE__*/_jsx(Option, {\n isGradient: isGradient,\n canOnlyChangeValues: canOnlyChangeValues,\n element: element,\n onChange: newElement => {\n debounceOnChange(elements.map((currentElement, currentIndex) => {\n if (currentIndex === index) {\n return newElement;\n }\n return currentElement;\n }));\n },\n onRemove: () => {\n const newElements = elements.filter((_currentElement, currentIndex) => {\n if (currentIndex === index) {\n return false;\n }\n return true;\n });\n onChange(newElements.length ? newElements : undefined);\n addColorRef.current?.focus();\n },\n slugPrefix: slugPrefix,\n popoverProps: popoverProps\n }, index))\n })\n });\n}\nconst EMPTY_ARRAY = [];\n\n/**\n * Allows editing a palette of colors or gradients.\n *\n * ```jsx\n * import { PaletteEdit } from '@wordpress/components';\n * const MyPaletteEdit = () => {\n * const [ controlledColors, setControlledColors ] = useState( colors );\n *\n * return (\n * <PaletteEdit\n * colors={ controlledColors }\n * onChange={ ( newColors?: Color[] ) => {\n * setControlledColors( newColors );\n * } }\n * paletteLabel=\"Here is a label\"\n * />\n * );\n * };\n * ```\n */\nexport function PaletteEdit({\n gradients,\n colors = EMPTY_ARRAY,\n onChange,\n paletteLabel,\n paletteLabelHeadingLevel = 2,\n emptyMessage,\n canOnlyChangeValues,\n canReset,\n slugPrefix = '',\n popoverProps\n}) {\n const isGradient = !!gradients;\n const elements = isGradient ? gradients : colors;\n const [isEditing, setIsEditing] = useState(false);\n const [editingElement, setEditingElement] = useState(null);\n const isAdding = isEditing && !!editingElement && elements[editingElement] && !elements[editingElement].slug;\n const elementsLength = elements.length;\n const hasElements = elementsLength > 0;\n const debounceOnChange = useDebounce(onChange, 100);\n const onSelectPaletteItem = useCallback((value, newEditingElementIndex) => {\n const selectedElement = newEditingElementIndex === undefined ? undefined : elements[newEditingElementIndex];\n const key = isGradient ? 'gradient' : 'color';\n // Ensures that the index returned matches a known element value.\n if (!!selectedElement && selectedElement[key] === value) {\n setEditingElement(newEditingElementIndex);\n } else {\n setIsEditing(true);\n }\n }, [isGradient, elements]);\n const addColorRef = useRef(null);\n return /*#__PURE__*/_jsxs(PaletteEditStyles, {\n children: [/*#__PURE__*/_jsxs(HStack, {\n children: [/*#__PURE__*/_jsx(PaletteHeading, {\n level: paletteLabelHeadingLevel,\n children: paletteLabel\n }), /*#__PURE__*/_jsxs(PaletteActionsContainer, {\n children: [hasElements && isEditing && /*#__PURE__*/_jsx(DoneButton, {\n size: \"small\",\n onClick: () => {\n setIsEditing(false);\n setEditingElement(null);\n },\n children: __('Done')\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(Button, {\n ref: addColorRef,\n size: \"small\",\n isPressed: isAdding,\n icon: plus,\n label: isGradient ? __('Add gradient') : __('Add color'),\n onClick: () => {\n const {\n name,\n slug\n } = getNameAndSlugForPosition(elements, slugPrefix);\n if (!!gradients) {\n onChange([...gradients, {\n gradient: DEFAULT_GRADIENT,\n name,\n slug\n }]);\n } else {\n onChange([...colors, {\n color: DEFAULT_COLOR,\n name,\n slug\n }]);\n }\n setIsEditing(true);\n setEditingElement(elements.length);\n }\n }), hasElements && (!isEditing || !canOnlyChangeValues || canReset) && /*#__PURE__*/_jsx(DropdownMenu, {\n icon: moreVertical,\n label: isGradient ? __('Gradient options') : __('Color options'),\n toggleProps: {\n size: 'small'\n },\n children: ({\n onClose\n }) => /*#__PURE__*/_jsx(_Fragment, {\n children: /*#__PURE__*/_jsxs(NavigableMenu, {\n role: \"menu\",\n children: [!isEditing && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n variant: \"tertiary\",\n onClick: () => {\n setIsEditing(true);\n onClose();\n },\n className: \"components-palette-edit__menu-button\",\n children: __('Show details')\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n variant: \"tertiary\",\n onClick: () => {\n setEditingElement(null);\n setIsEditing(false);\n onChange();\n onClose();\n },\n className: \"components-palette-edit__menu-button\",\n children: isGradient ? __('Remove all gradients') : __('Remove all colors')\n }), canReset && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n className: \"components-palette-edit__menu-button\",\n variant: \"tertiary\",\n onClick: () => {\n setEditingElement(null);\n onChange();\n onClose();\n },\n children: isGradient ? __('Reset gradient') : __('Reset colors')\n })]\n })\n })\n })]\n })]\n }), hasElements && /*#__PURE__*/_jsxs(PaletteEditContents, {\n children: [isEditing && /*#__PURE__*/_jsx(PaletteEditListView, {\n canOnlyChangeValues: canOnlyChangeValues,\n elements: elements\n // @ts-expect-error TODO: Don't know how to resolve\n ,\n onChange: onChange,\n slugPrefix: slugPrefix,\n isGradient: isGradient,\n popoverProps: popoverProps,\n addColorRef: addColorRef\n }), !isEditing && editingElement !== null && /*#__PURE__*/_jsx(ColorPickerPopover, {\n isGradient: isGradient,\n onClose: () => setEditingElement(null),\n onChange: newElement => {\n debounceOnChange(\n // @ts-expect-error TODO: Don't know how to resolve\n elements.map((currentElement, currentIndex) => {\n if (currentIndex === editingElement) {\n return newElement;\n }\n return currentElement;\n }));\n },\n element: elements[editingElement ?? -1],\n popoverProps: popoverProps\n }), !isEditing && (isGradient ? /*#__PURE__*/_jsx(GradientPicker, {\n gradients: gradients,\n onChange: onSelectPaletteItem,\n clearable: false,\n disableCustomGradients: true\n }) : /*#__PURE__*/_jsx(ColorPalette, {\n colors: colors,\n onChange: onSelectPaletteItem,\n clearable: false,\n disableCustomColors: true\n }))]\n }), !hasElements && emptyMessage && /*#__PURE__*/_jsx(PaletteEditContents,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AA,QACrC,UAAU,gBAAc;AACtB;AAAA;AAAA,YAEA,SAAS,IAAI,CAAC,gBAAgB,iBAAiB;AAC7C,kBAAI,iBAAiB,gBAAgB;AACnC,uBAAO;AAAA,cACT;AACA,qBAAO;AAAA,YACT,CAAC;AAAA,UAAC;AAAA,QACJ;AAAA,QACA,SAAS,SAAS,kBAAkB,EAAE;AAAA,QACtC;AAAA,MACF,CAAC,GAAG,CAAC,cAAc,aAA0B,qBAAK,gBAAgB;AAAA,QAChE;AAAA,QACA,UAAU;AAAA,QACV,WAAW;AAAA,QACX,wBAAwB;AAAA,MAC1B,CAAC,IAAiB,qBAAK,cAAc;AAAA,QACnC;AAAA,QACA,UAAU;AAAA,QACV,WAAW;AAAA,QACX,qBAAqB;AAAA,MACvB,CAAC,EAAE;AAAA,IACL,CAAC,GAAG,CAAC,eAAe,gBAA6B,qBAAK,qBAAqB;AAAA,MACzE,UAAU;AAAA,IACZ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,uBAAQ;",
6
6
  "names": []
7
7
  }
@@ -33,7 +33,7 @@ function UnforwardedPanelBody(props, ref) {
33
33
  setIsOpened(next);
34
34
  onToggle(next);
35
35
  };
36
- const scrollAfterOpenRef = useRef();
36
+ const scrollAfterOpenRef = useRef(void 0);
37
37
  scrollAfterOpenRef.current = scrollAfterOpen;
38
38
  useUpdateEffect(() => {
39
39
  if (isOpened && scrollAfterOpenRef.current && nodeRef.current?.scrollIntoView) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/panel/body.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useReducedMotion, useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useRef } from '@wordpress/element';\nimport { chevronUp, chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\n\nimport Button from '../button';\nimport Icon from '../icon';\nimport { useControlledState, useUpdateEffect } from '../utils';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst noop = () => {};\nexport function UnforwardedPanelBody(props, ref) {\n const {\n buttonProps = {},\n children,\n className,\n icon,\n initialOpen,\n onToggle = noop,\n opened,\n title,\n scrollAfterOpen = true\n } = props;\n const [isOpened, setIsOpened] = useControlledState(opened, {\n initial: initialOpen === undefined ? true : initialOpen,\n fallback: false\n });\n const nodeRef = useRef(null);\n\n // Defaults to 'smooth' scrolling\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView\n const scrollBehavior = useReducedMotion() ? 'auto' : 'smooth';\n const handleOnToggle = event => {\n event.preventDefault();\n const next = !isOpened;\n setIsOpened(next);\n onToggle(next);\n };\n\n // Ref is used so that the effect does not re-run upon scrollAfterOpen changing value.\n const scrollAfterOpenRef = useRef();\n scrollAfterOpenRef.current = scrollAfterOpen;\n // Runs after initial render.\n useUpdateEffect(() => {\n if (isOpened && scrollAfterOpenRef.current && nodeRef.current?.scrollIntoView) {\n /*\n * Scrolls the content into view when visible.\n * This improves the UX when there are multiple stacking <PanelBody />\n * components in a scrollable container.\n */\n nodeRef.current.scrollIntoView({\n inline: 'nearest',\n block: 'nearest',\n behavior: scrollBehavior\n });\n }\n }, [isOpened, scrollBehavior]);\n const classes = clsx('components-panel__body', className, {\n 'is-opened': isOpened\n });\n return /*#__PURE__*/_jsxs(\"div\", {\n className: classes,\n ref: useMergeRefs([nodeRef, ref]),\n children: [/*#__PURE__*/_jsx(PanelBodyTitle, {\n icon: icon,\n isOpened: Boolean(isOpened),\n onClick: handleOnToggle,\n title: title,\n ...buttonProps\n }), typeof children === 'function' ? children({\n opened: Boolean(isOpened)\n }) : isOpened && children]\n });\n}\nconst PanelBodyTitle = forwardRef(({\n isOpened,\n icon,\n title,\n ...props\n}, ref) => {\n if (!title) {\n return null;\n }\n return /*#__PURE__*/_jsx(\"h2\", {\n className: \"components-panel__body-title\",\n children: /*#__PURE__*/_jsxs(Button, {\n __next40pxDefaultSize: true,\n className: \"components-panel__body-toggle\",\n \"aria-expanded\": isOpened,\n ref: ref,\n ...props,\n children: [/*#__PURE__*/_jsx(\"span\", {\n \"aria-hidden\": \"true\",\n children: /*#__PURE__*/_jsx(Icon, {\n className: \"components-panel__arrow\",\n icon: isOpened ? chevronUp : chevronDown\n })\n }), title, icon && /*#__PURE__*/_jsx(Icon, {\n icon: icon,\n className: \"components-panel__icon\",\n size: 20\n })]\n })\n });\n});\nexport const PanelBody = forwardRef(UnforwardedPanelBody);\nPanelBody.displayName = 'PanelBody';\nexport default PanelBody;"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,kBAAkB,oBAAoB;AAC/C,SAAS,YAAY,cAAc;AACnC,SAAS,WAAW,mBAAmB;AAMvC,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,SAAS,oBAAoB,uBAAuB;AACpD,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,OAAO,MAAM;AAAC;AACb,SAAS,qBAAqB,OAAO,KAAK;AAC/C,QAAM;AAAA,IACJ,cAAc,CAAC;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,EACpB,IAAI;AACJ,QAAM,CAAC,UAAU,WAAW,IAAI,mBAAmB,QAAQ;AAAA,IACzD,SAAS,gBAAgB,SAAY,OAAO;AAAA,IAC5C,UAAU;AAAA,EACZ,CAAC;AACD,QAAM,UAAU,OAAO,IAAI;AAI3B,QAAM,iBAAiB,iBAAiB,IAAI,SAAS;AACrD,QAAM,iBAAiB,WAAS;AAC9B,UAAM,eAAe;AACrB,UAAM,OAAO,CAAC;AACd,gBAAY,IAAI;AAChB,aAAS,IAAI;AAAA,EACf;AAGA,QAAM,qBAAqB,OAAO;AAClC,qBAAmB,UAAU;AAE7B,kBAAgB,MAAM;AACpB,QAAI,YAAY,mBAAmB,WAAW,QAAQ,SAAS,gB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M,YAAY,WAAW,oBAAoB;AACxD,UAAU,cAAc;AACxB,IAAO,eAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useReducedMotion, useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useRef } from '@wordpress/element';\nimport { chevronUp, chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\n\nimport Button from '../button';\nimport Icon from '../icon';\nimport { useControlledState, useUpdateEffect } from '../utils';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst noop = () => {};\nexport function UnforwardedPanelBody(props, ref) {\n const {\n buttonProps = {},\n children,\n className,\n icon,\n initialOpen,\n onToggle = noop,\n opened,\n title,\n scrollAfterOpen = true\n } = props;\n const [isOpened, setIsOpened] = useControlledState(opened, {\n initial: initialOpen === undefined ? true : initialOpen,\n fallback: false\n });\n const nodeRef = useRef(null);\n\n // Defaults to 'smooth' scrolling\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView\n const scrollBehavior = useReducedMotion() ? 'auto' : 'smooth';\n const handleOnToggle = event => {\n event.preventDefault();\n const next = !isOpened;\n setIsOpened(next);\n onToggle(next);\n };\n\n // Ref is used so that the effect does not re-run upon scrollAfterOpen changing value.\n const scrollAfterOpenRef = useRef(undefined);\n scrollAfterOpenRef.current = scrollAfterOpen;\n // Runs after initial render.\n useUpdateEffect(() => {\n if (isOpened && scrollAfterOpenRef.current && nodeRef.current?.scrollIntoView) {\n /*\n * Scrolls the content into view when visible.\n * This improves the UX when there are multiple stacking <PanelBody />\n * components in a scrollable container.\n */\n nodeRef.current.scrollIntoView({\n inline: 'nearest',\n block: 'nearest',\n behavior: scrollBehavior\n });\n }\n }, [isOpened, scrollBehavior]);\n const classes = clsx('components-panel__body', className, {\n 'is-opened': isOpened\n });\n return /*#__PURE__*/_jsxs(\"div\", {\n className: classes,\n ref: useMergeRefs([nodeRef, ref]),\n children: [/*#__PURE__*/_jsx(PanelBodyTitle, {\n icon: icon,\n isOpened: Boolean(isOpened),\n onClick: handleOnToggle,\n title: title,\n ...buttonProps\n }), typeof children === 'function' ? children({\n opened: Boolean(isOpened)\n }) : isOpened && children]\n });\n}\nconst PanelBodyTitle = forwardRef(({\n isOpened,\n icon,\n title,\n ...props\n}, ref) => {\n if (!title) {\n return null;\n }\n return /*#__PURE__*/_jsx(\"h2\", {\n className: \"components-panel__body-title\",\n children: /*#__PURE__*/_jsxs(Button, {\n __next40pxDefaultSize: true,\n className: \"components-panel__body-toggle\",\n \"aria-expanded\": isOpened,\n ref: ref,\n ...props,\n children: [/*#__PURE__*/_jsx(\"span\", {\n \"aria-hidden\": \"true\",\n children: /*#__PURE__*/_jsx(Icon, {\n className: \"components-panel__arrow\",\n icon: isOpened ? chevronUp : chevronDown\n })\n }), title, icon && /*#__PURE__*/_jsx(Icon, {\n icon: icon,\n className: \"components-panel__icon\",\n size: 20\n })]\n })\n });\n});\nexport const PanelBody = forwardRef(UnforwardedPanelBody);\nPanelBody.displayName = 'PanelBody';\nexport default PanelBody;"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,kBAAkB,oBAAoB;AAC/C,SAAS,YAAY,cAAc;AACnC,SAAS,WAAW,mBAAmB;AAMvC,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,SAAS,oBAAoB,uBAAuB;AACpD,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,OAAO,MAAM;AAAC;AACb,SAAS,qBAAqB,OAAO,KAAK;AAC/C,QAAM;AAAA,IACJ,cAAc,CAAC;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,EACpB,IAAI;AACJ,QAAM,CAAC,UAAU,WAAW,IAAI,mBAAmB,QAAQ;AAAA,IACzD,SAAS,gBAAgB,SAAY,OAAO;AAAA,IAC5C,UAAU;AAAA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AAAA,MACH,UAAU,CAAc,qBAAK,QAAQ;AAAA,QACnC,eAAe;AAAA,QACf,UAAuB,qBAAK,MAAM;AAAA,UAChC,WAAW;AAAA,UACX,MAAM,WAAW,YAAY;AAAA,QAC/B,CAAC;AAAA,MACH,CAAC,GAAG,OAAO,QAAqB,qBAAK,MAAM;AAAA,QACzC;AAAA,QACA,WAAW;AAAA,QACX,MAAM;AAAA,MACR,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AACM,IAAM,YAAY,WAAW,oBAAoB;AACxD,UAAU,cAAc;AACxB,IAAO,eAAQ;",
6
6
  "names": []
7
7
  }
@@ -12,7 +12,6 @@ import Badge from "./badge/index.mjs";
12
12
  import { DateCalendar, DateRangeCalendar, TZDate } from "./calendar/index.mjs";
13
13
  import { ValidatedCheckboxControl, ValidatedComboboxControl, ValidatedInputControl, ValidatedNumberControl, ValidatedSelectControl, ValidatedRadioControl, ValidatedTextControl, ValidatedTextareaControl, ValidatedToggleControl, ValidatedToggleGroupControl } from "./validated-form-controls/index.mjs";
14
14
  import { ValidatedFormTokenField } from "./validated-form-controls/components/form-token-field.mjs";
15
- import { Picker } from "./color-picker/picker.mjs";
16
15
  var privateApis = {};
17
16
  lock(privateApis, {
18
17
  __experimentalPopoverLegacyPositionToPlacement,
@@ -27,7 +26,6 @@ lock(privateApis, {
27
26
  DateCalendar,
28
27
  DateRangeCalendar,
29
28
  TZDate,
30
- Picker,
31
29
  useDrag,
32
30
  ValidatedInputControl,
33
31
  ValidatedCheckboxControl,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/private-apis.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { useDrag } from '@use-gesture/react';\n\n/**\n * Internal dependencies\n */\nimport { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';\nimport { Menu } from './menu';\nimport { ComponentsContext } from './context/context-system-provider';\nimport Theme from './theme';\nimport { Tabs } from './tabs';\nimport { kebabCase, normalizeTextString } from './utils/strings';\nimport { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';\nimport { lock } from './lock-unlock';\nimport Badge from './badge';\nimport { DateCalendar, DateRangeCalendar, TZDate } from './calendar';\nimport { ValidatedCheckboxControl, ValidatedComboboxControl, ValidatedInputControl, ValidatedNumberControl, ValidatedSelectControl, ValidatedRadioControl, ValidatedTextControl, ValidatedTextareaControl, ValidatedToggleControl, ValidatedToggleGroupControl } from './validated-form-controls';\nimport { ValidatedFormTokenField } from './validated-form-controls/components/form-token-field';\nimport { Picker } from './color-picker/picker';\nexport const privateApis = {};\nlock(privateApis, {\n __experimentalPopoverLegacyPositionToPlacement,\n ComponentsContext,\n Tabs,\n Theme,\n Menu,\n kebabCase,\n withIgnoreIMEEvents,\n Badge,\n normalizeTextString,\n DateCalendar,\n DateRangeCalendar,\n TZDate,\n Picker,\n useDrag,\n ValidatedInputControl,\n ValidatedCheckboxControl,\n ValidatedComboboxControl,\n ValidatedNumberControl,\n ValidatedSelectControl,\n ValidatedRadioControl,\n ValidatedTextControl,\n ValidatedTextareaControl,\n ValidatedToggleControl,\n ValidatedToggleGroupControl,\n ValidatedFormTokenField\n});"],
5
- "mappings": ";AAGA,SAAS,eAAe;AAKxB,SAAS,uBAAuB,sDAAsD;AACtF,SAAS,YAAY;AACrB,SAAS,yBAAyB;AAClC,OAAO,WAAW;AAClB,SAAS,YAAY;AACrB,SAAS,WAAW,2BAA2B;AAC/C,SAAS,2BAA2B;AACpC,SAAS,YAAY;AACrB,OAAO,WAAW;AAClB,SAAS,cAAc,mBAAmB,cAAc;AACxD,SAAS,0BAA0B,0BAA0B,uBAAuB,wBAAwB,wBAAwB,uBAAuB,sBAAsB,0BAA0B,wBAAwB,mCAAmC;AACtQ,SAAS,+BAA+B;AACxC,SAAS,cAAc;AAChB,IAAM,cAAc,CAAC;AAC5B,KAAK,aAAa;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { useDrag } from '@use-gesture/react';\n\n/**\n * Internal dependencies\n */\nimport { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';\nimport { Menu } from './menu';\nimport { ComponentsContext } from './context/context-system-provider';\nimport Theme from './theme';\nimport { Tabs } from './tabs';\nimport { kebabCase, normalizeTextString } from './utils/strings';\nimport { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';\nimport { lock } from './lock-unlock';\nimport Badge from './badge';\nimport { DateCalendar, DateRangeCalendar, TZDate } from './calendar';\nimport { ValidatedCheckboxControl, ValidatedComboboxControl, ValidatedInputControl, ValidatedNumberControl, ValidatedSelectControl, ValidatedRadioControl, ValidatedTextControl, ValidatedTextareaControl, ValidatedToggleControl, ValidatedToggleGroupControl } from './validated-form-controls';\nimport { ValidatedFormTokenField } from './validated-form-controls/components/form-token-field';\nexport const privateApis = {};\nlock(privateApis, {\n __experimentalPopoverLegacyPositionToPlacement,\n ComponentsContext,\n Tabs,\n Theme,\n Menu,\n kebabCase,\n withIgnoreIMEEvents,\n Badge,\n normalizeTextString,\n DateCalendar,\n DateRangeCalendar,\n TZDate,\n useDrag,\n ValidatedInputControl,\n ValidatedCheckboxControl,\n ValidatedComboboxControl,\n ValidatedNumberControl,\n ValidatedSelectControl,\n ValidatedRadioControl,\n ValidatedTextControl,\n ValidatedTextareaControl,\n ValidatedToggleControl,\n ValidatedToggleGroupControl,\n ValidatedFormTokenField\n});"],
5
+ "mappings": ";AAGA,SAAS,eAAe;AAKxB,SAAS,uBAAuB,sDAAsD;AACtF,SAAS,YAAY;AACrB,SAAS,yBAAyB;AAClC,OAAO,WAAW;AAClB,SAAS,YAAY;AACrB,SAAS,WAAW,2BAA2B;AAC/C,SAAS,2BAA2B;AACpC,SAAS,YAAY;AACrB,OAAO,WAAW;AAClB,SAAS,cAAc,mBAAmB,cAAc;AACxD,SAAS,0BAA0B,0BAA0B,uBAAuB,wBAAwB,wBAAwB,uBAAuB,sBAAsB,0BAA0B,wBAAwB,mCAAmC;AACtQ,SAAS,+BAA+B;AACjC,IAAM,cAAc,CAAC;AAC5B,KAAK,aAAa;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
6
6
  "names": []
7
7
  }
@@ -82,7 +82,7 @@ function UnforwardedRangeControl(props, forwardedRef) {
82
82
  }
83
83
  const [showTooltip, setShowTooltip] = useState(hasTooltip);
84
84
  const [isFocused, setIsFocused] = useState(false);
85
- const inputRef = useRef();
85
+ const inputRef = useRef(null);
86
86
  const isCurrentlyFocused = inputRef.current?.matches(":focus");
87
87
  const isThumbFocused = !disabled && isFocused;
88
88
  const isValueReset = value === null;
@@ -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 { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\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 __nextHasNoMarginBottom: _,\n // Prevent passing to internal component\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 __next40pxDefaultSize = false,\n shiftStep = 10,\n showTooltip: showTooltipProp,\n step = 1,\n trackColor,\n value: valueProp,\n withInputField = true,\n __shouldNotWarnDeprecated36pxSize,\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();\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` \u2014 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\n // Add default size deprecation warning.\n maybeWarnDeprecated36pxSize({\n componentName: 'RangeControl',\n __next40pxDefaultSize,\n size: undefined,\n __shouldNotWarnDeprecated36pxSize\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 __next40pxDefaultSize: __next40pxDefaultSize,\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 size: __next40pxDefaultSize ? '__unstable-large' : 'default',\n __unstableInputWidth: __next40pxDefaultSize ? space(20) : space(16),\n step: step\n // @ts-expect-error TODO: Investigate if the `null` value is necessary\n ,\n value: inputSliderValue,\n __shouldNotWarnDeprecated36pxSize: true\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 * __next40pxDefaultSize\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": ";AAGA,OAAO,UAAU;AAIjB,SAAS,IAAI,aAAa;AAC1B,SAAS,QAAQ,UAAU,kBAAkB;AAC7C,SAAS,eAAe,oBAAoB;AAK5C,OAAO,iBAAiB;AACxB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,SAAS,cAAc;AACvB,SAAS,YAAY,+BAA+B;AACpD,SAAS,aAAa;AACtB,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,mBAAmB;AAC1B,SAAS,oBAAoB,kBAAkB,mBAAmB,aAAa,MAAM,OAAO,cAAc,OAAO,eAAe;AAChI,SAAS,aAAa;AACtB,SAAS,mCAAmC;AAC5C,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,OAAO,MAAM;AAAC;AAMpB,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AACF,GAAG;AACD,MAAI,uBAAuB,QAAW;AACpC,WAAO,CAAC,OAAO,MAAM,kBAAkB,IAAI,qBAAqB;AAAA,EAClE;AACA,MAAI,oBAAoB,QAAW;AACjC,WAAO,CAAC,OAAO,MAAM,eAAe,IAAI,kBAAkB;AAAA,EAC5D;AACA,SAAO;AACT;AACA,SAAS,wBAAwB,OAAO,cAAc;AACpD,QAAM;AAAA,IACJ,yBAAyB;AAAA;AAAA,IAEzB;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA;AA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AAAA,QACH,CAAC,GAAG,iBAA8B,qBAAK,eAAe;AAAA,UACpD,WAAW;AAAA,UACX;AAAA,UACA,kBAAkB;AAAA,UAClB;AAAA,UACA,MAAM,sBAAsB;AAAA,UAC5B,OAAO;AAAA,UACP;AAAA,QACF,CAAC,CAAC;AAAA,MACJ,CAAC,GAAG,aAA0B,qBAAK,kBAAkB;AAAA,QACnD,UAAuB,qBAAK,MAAM;AAAA,UAChC,MAAM;AAAA,QACR,CAAC;AAAA,MACH,CAAC,GAAG,iBAA8B,qBAAK,aAAa;AAAA,QAClD,cAAc;AAAA,QACd,WAAW;AAAA,QACX;AAAA,QACA,WAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ;AAAA,QACR,UAAU;AAAA,QACV;AAAA,QACA,MAAM,wBAAwB,qBAAqB;AAAA,QACnD,sBAAsB,wBAAwB,MAAM,EAAE,IAAI,MAAM,EAAE;AAAA,QAClE;AAAA,QAGA,OAAO;AAAA,QACP,mCAAmC;AAAA,MACrC,CAAC,GAAG,cAA2B,qBAAK,oBAAoB;AAAA,QACtD,UAAuB,qBAAK,QAAQ;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,UAAU,GAAG,OAAO;AAAA,QACtB,CAAC;AAAA,MACH,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH;AA0BO,IAAM,eAAe,WAAW,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 { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\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 __nextHasNoMarginBottom: _,\n // Prevent passing to internal component\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 __next40pxDefaultSize = false,\n shiftStep = 10,\n showTooltip: showTooltipProp,\n step = 1,\n trackColor,\n value: valueProp,\n withInputField = true,\n __shouldNotWarnDeprecated36pxSize,\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` \u2014 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\n // Add default size deprecation warning.\n maybeWarnDeprecated36pxSize({\n componentName: 'RangeControl',\n __next40pxDefaultSize,\n size: undefined,\n __shouldNotWarnDeprecated36pxSize\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 __next40pxDefaultSize: __next40pxDefaultSize,\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 size: __next40pxDefaultSize ? '__unstable-large' : 'default',\n __unstableInputWidth: __next40pxDefaultSize ? space(20) : space(16),\n step: step\n // @ts-expect-error TODO: Investigate if the `null` value is necessary\n ,\n value: inputSliderValue,\n __shouldNotWarnDeprecated36pxSize: true\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 * __next40pxDefaultSize\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": ";AAGA,OAAO,UAAU;AAIjB,SAAS,IAAI,aAAa;AAC1B,SAAS,QAAQ,UAAU,kBAAkB;AAC7C,SAAS,eAAe,oBAAoB;AAK5C,OAAO,iBAAiB;AACxB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,SAAS,cAAc;AACvB,SAAS,YAAY,+BAA+B;AACpD,SAAS,aAAa;AACtB,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,mBAAmB;AAC1B,SAAS,oBAAoB,kBAAkB,mBAAmB,aAAa,MAAM,OAAO,cAAc,OAAO,eAAe;AAChI,SAAS,aAAa;AACtB,SAAS,mCAAmC;AAC5C,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,OAAO,MAAM;AAAC;AAMpB,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AACF,GAAG;AACD,MAAI,uBAAuB,QAAW;AACpC,WAAO,CAAC,OAAO,MAAM,kBAAkB,IAAI,qBAAqB;AAAA,EAClE;AACA,MAAI,oBAAoB,QAAW;AACjC,WAAO,CAAC,OAAO,MAAM,eAAe,IAAI,kBAAkB;AAAA,EAC5D;AACA,SAAO;AACT;AACA,SAAS,wBAAwB,OA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