@wordpress/components 20.0.2-next.957ca95e4c.0 → 21.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (895) hide show
  1. package/CHANGELOG.md +68 -1
  2. package/CONTRIBUTING.md +3 -54
  3. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
  4. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  5. package/build/angle-picker-control/index.js +10 -0
  6. package/build/angle-picker-control/index.js.map +1 -1
  7. package/build/autocomplete/autocompleter-ui.js +3 -3
  8. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  9. package/build/border-box-control/border-box-control/component.js +10 -7
  10. package/build/border-box-control/border-box-control/component.js.map +1 -1
  11. package/build/border-box-control/border-box-control-linked-button/component.js +1 -2
  12. package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  13. package/build/border-box-control/border-box-control-split-controls/component.js +10 -7
  14. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  15. package/build/border-box-control/styles.js +7 -7
  16. package/build/border-box-control/styles.js.map +1 -1
  17. package/build/border-control/border-control-dropdown/component.js +2 -1
  18. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  19. package/build/box-control/linked-button.js +3 -3
  20. package/build/box-control/linked-button.js.map +1 -1
  21. package/build/card/styles.js +17 -17
  22. package/build/card/styles.js.map +1 -1
  23. package/build/checkbox-control/index.js +3 -3
  24. package/build/checkbox-control/index.js.map +1 -1
  25. package/build/color-palette/index.js +1 -1
  26. package/build/color-palette/index.js.map +1 -1
  27. package/build/color-picker/input-with-slider.js +2 -1
  28. package/build/color-picker/input-with-slider.js.map +1 -1
  29. package/build/combobox-control/index.js +1 -1
  30. package/build/combobox-control/index.js.map +1 -1
  31. package/build/custom-gradient-picker/index.js +1 -1
  32. package/build/custom-gradient-picker/index.js.map +1 -1
  33. package/build/date-time/date/index.js +1 -1
  34. package/build/date-time/date/index.js.map +1 -1
  35. package/build/date-time/time/timezone.js +1 -1
  36. package/build/date-time/time/timezone.js.map +1 -1
  37. package/build/disabled/index.js +14 -6
  38. package/build/disabled/index.js.map +1 -1
  39. package/build/disabled/styles/disabled-styles.js +8 -18
  40. package/build/disabled/styles/disabled-styles.js.map +1 -1
  41. package/build/drop-zone/index.js +44 -9
  42. package/build/drop-zone/index.js.map +1 -1
  43. package/build/drop-zone/provider.js.map +1 -1
  44. package/build/drop-zone/types.js +6 -0
  45. package/build/drop-zone/types.js.map +1 -0
  46. package/build/dropdown/index.js +11 -4
  47. package/build/dropdown/index.js.map +1 -1
  48. package/build/flex/flex/hook.js +6 -30
  49. package/build/flex/flex/hook.js.map +1 -1
  50. package/build/focal-point-picker/controls.js +10 -5
  51. package/build/focal-point-picker/controls.js.map +1 -1
  52. package/build/focal-point-picker/focal-point.js.map +1 -1
  53. package/build/focal-point-picker/grid.js.map +1 -1
  54. package/build/focal-point-picker/index.js +83 -16
  55. package/build/focal-point-picker/index.js.map +1 -1
  56. package/build/focal-point-picker/media.js +4 -0
  57. package/build/focal-point-picker/media.js.map +1 -1
  58. package/build/focal-point-picker/styles/focal-point-picker-style.js +70 -41
  59. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  60. package/build/focal-point-picker/styles/focal-point-style.js +12 -12
  61. package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
  62. package/build/focal-point-picker/types.js +6 -0
  63. package/build/focal-point-picker/types.js.map +1 -0
  64. package/build/focal-point-picker/utils.js +6 -6
  65. package/build/focal-point-picker/utils.js.map +1 -1
  66. package/build/font-size-picker/index.js +11 -0
  67. package/build/font-size-picker/index.js.map +1 -1
  68. package/build/font-size-picker/utils.js +1 -1
  69. package/build/font-size-picker/utils.js.map +1 -1
  70. package/build/form-file-upload/index.js +22 -2
  71. package/build/form-file-upload/index.js.map +1 -1
  72. package/build/form-file-upload/types.js +6 -0
  73. package/build/form-file-upload/types.js.map +1 -0
  74. package/build/form-toggle/index.js +1 -3
  75. package/build/form-toggle/index.js.map +1 -1
  76. package/build/form-token-field/index.js +4 -6
  77. package/build/form-token-field/index.js.map +1 -1
  78. package/build/form-token-field/suggestions-list.js +1 -3
  79. package/build/form-token-field/suggestions-list.js.map +1 -1
  80. package/build/gradient-picker/index.js +25 -26
  81. package/build/gradient-picker/index.js.map +1 -1
  82. package/build/icon/index.js +1 -2
  83. package/build/icon/index.js.map +1 -1
  84. package/build/input-control/input-base.js +3 -2
  85. package/build/input-control/input-base.js.map +1 -1
  86. package/build/input-control/label.js +2 -2
  87. package/build/input-control/label.js.map +1 -1
  88. package/build/input-control/styles/input-control-styles.js +41 -128
  89. package/build/input-control/styles/input-control-styles.js.map +1 -1
  90. package/build/modal/aria-helper.js +3 -10
  91. package/build/modal/aria-helper.js.map +1 -1
  92. package/build/navigable-container/container.js +5 -1
  93. package/build/navigable-container/container.js.map +1 -1
  94. package/build/navigable-container/menu.js +10 -12
  95. package/build/navigable-container/menu.js.map +1 -1
  96. package/build/navigable-container/tabbable.js +2 -4
  97. package/build/navigable-container/tabbable.js.map +1 -1
  98. package/build/navigation/menu/menu-title-search.js +2 -1
  99. package/build/navigation/menu/menu-title-search.js.map +1 -1
  100. package/build/navigation/menu/use-navigation-tree-menu.js +2 -1
  101. package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  102. package/build/navigator/navigator-button/hook.js +1 -1
  103. package/build/navigator/navigator-button/hook.js.map +1 -1
  104. package/build/navigator/navigator-screen/component.js +2 -2
  105. package/build/navigator/navigator-screen/component.js.map +1 -1
  106. package/build/number-control/index.js +29 -25
  107. package/build/number-control/index.js.map +1 -1
  108. package/build/number-control/types.js +6 -0
  109. package/build/number-control/types.js.map +1 -0
  110. package/build/placeholder/index.js +1 -3
  111. package/build/placeholder/index.js.map +1 -1
  112. package/build/popover/index.js +190 -160
  113. package/build/popover/index.js.map +1 -1
  114. package/build/popover/types.js +6 -0
  115. package/build/popover/types.js.map +1 -0
  116. package/build/popover/utils.js +125 -24
  117. package/build/popover/utils.js.map +1 -1
  118. package/build/radio-control/index.js +7 -4
  119. package/build/radio-control/index.js.map +1 -1
  120. package/build/range-control/index.js +4 -1
  121. package/build/range-control/index.js.map +1 -1
  122. package/build/range-control/styles/range-control-styles.js +33 -33
  123. package/build/range-control/styles/range-control-styles.js.map +1 -1
  124. package/build/sandbox/index.js +2 -2
  125. package/build/sandbox/index.js.map +1 -1
  126. package/build/search-control/index.js +38 -10
  127. package/build/search-control/index.js.map +1 -1
  128. package/build/search-control/types.js +6 -0
  129. package/build/search-control/types.js.map +1 -0
  130. package/build/select-control/index.native.js +2 -1
  131. package/build/select-control/index.native.js.map +1 -1
  132. package/build/tab-panel/index.js +48 -9
  133. package/build/tab-panel/index.js.map +1 -1
  134. package/build/tab-panel/types.js +6 -0
  135. package/build/tab-panel/types.js.map +1 -0
  136. package/build/text-control/index.js +2 -0
  137. package/build/text-control/index.js.map +1 -1
  138. package/build/textarea-control/index.js +3 -3
  139. package/build/textarea-control/index.js.map +1 -1
  140. package/build/toggle-control/index.js +44 -4
  141. package/build/toggle-control/index.js.map +1 -1
  142. package/build/toggle-control/types.js +6 -0
  143. package/build/toggle-control/types.js.map +1 -0
  144. package/build/toggle-group-control/toggle-group-control/component.js +2 -2
  145. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  146. package/build/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  147. package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  148. package/build/tooltip/index.js +9 -7
  149. package/build/tooltip/index.js.map +1 -1
  150. package/build/ui/context/context-connect.js +31 -22
  151. package/build/ui/context/context-connect.js.map +1 -1
  152. package/build/ui/context/context-system-provider.js +4 -3
  153. package/build/ui/context/context-system-provider.js.map +1 -1
  154. package/build/unit-control/index.js +1 -1
  155. package/build/unit-control/index.js.map +1 -1
  156. package/build/unit-control/styles/unit-control-styles.js +9 -9
  157. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  158. package/build/utils/colors-values.js +2 -30
  159. package/build/utils/colors-values.js.map +1 -1
  160. package/build/utils/math.js +4 -4
  161. package/build/utils/math.js.map +1 -1
  162. package/build/utils/values.js +62 -6
  163. package/build/utils/values.js.map +1 -1
  164. package/build/view/component.js +6 -7
  165. package/build/view/component.js.map +1 -1
  166. package/build/view/types.js +6 -0
  167. package/build/view/types.js.map +1 -0
  168. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
  169. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  170. package/build-module/angle-picker-control/index.js +9 -0
  171. package/build-module/angle-picker-control/index.js.map +1 -1
  172. package/build-module/autocomplete/autocompleter-ui.js +4 -4
  173. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  174. package/build-module/border-box-control/border-box-control/component.js +11 -8
  175. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  176. package/build-module/border-box-control/border-box-control-linked-button/component.js +1 -2
  177. package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  178. package/build-module/border-box-control/border-box-control-split-controls/component.js +11 -8
  179. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  180. package/build-module/border-box-control/styles.js +7 -7
  181. package/build-module/border-box-control/styles.js.map +1 -1
  182. package/build-module/border-control/border-control-dropdown/component.js +2 -1
  183. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  184. package/build-module/box-control/linked-button.js +3 -3
  185. package/build-module/box-control/linked-button.js.map +1 -1
  186. package/build-module/card/styles.js +17 -17
  187. package/build-module/card/styles.js.map +1 -1
  188. package/build-module/checkbox-control/index.js +3 -3
  189. package/build-module/checkbox-control/index.js.map +1 -1
  190. package/build-module/color-palette/index.js +1 -1
  191. package/build-module/color-palette/index.js.map +1 -1
  192. package/build-module/color-picker/input-with-slider.js +2 -1
  193. package/build-module/color-picker/input-with-slider.js.map +1 -1
  194. package/build-module/combobox-control/index.js +1 -1
  195. package/build-module/combobox-control/index.js.map +1 -1
  196. package/build-module/custom-gradient-picker/index.js +1 -1
  197. package/build-module/custom-gradient-picker/index.js.map +1 -1
  198. package/build-module/date-time/date/index.js +2 -3
  199. package/build-module/date-time/date/index.js.map +1 -1
  200. package/build-module/date-time/time/timezone.js +1 -1
  201. package/build-module/date-time/time/timezone.js.map +1 -1
  202. package/build-module/disabled/index.js +16 -8
  203. package/build-module/disabled/index.js.map +1 -1
  204. package/build-module/disabled/styles/disabled-styles.js +6 -12
  205. package/build-module/disabled/styles/disabled-styles.js.map +1 -1
  206. package/build-module/drop-zone/index.js +40 -9
  207. package/build-module/drop-zone/index.js.map +1 -1
  208. package/build-module/drop-zone/provider.js.map +1 -1
  209. package/build-module/drop-zone/types.js +2 -0
  210. package/build-module/drop-zone/types.js.map +1 -0
  211. package/build-module/dropdown/index.js +10 -4
  212. package/build-module/dropdown/index.js.map +1 -1
  213. package/build-module/flex/flex/hook.js +7 -29
  214. package/build-module/flex/flex/hook.js.map +1 -1
  215. package/build-module/focal-point-picker/controls.js +11 -6
  216. package/build-module/focal-point-picker/controls.js.map +1 -1
  217. package/build-module/focal-point-picker/focal-point.js.map +1 -1
  218. package/build-module/focal-point-picker/grid.js.map +1 -1
  219. package/build-module/focal-point-picker/index.js +81 -16
  220. package/build-module/focal-point-picker/index.js.map +1 -1
  221. package/build-module/focal-point-picker/media.js +4 -0
  222. package/build-module/focal-point-picker/media.js.map +1 -1
  223. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +68 -40
  224. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  225. package/build-module/focal-point-picker/styles/focal-point-style.js +12 -12
  226. package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
  227. package/build-module/focal-point-picker/types.js +2 -0
  228. package/build-module/focal-point-picker/types.js.map +1 -0
  229. package/build-module/focal-point-picker/utils.js +6 -6
  230. package/build-module/focal-point-picker/utils.js.map +1 -1
  231. package/build-module/font-size-picker/index.js +10 -0
  232. package/build-module/font-size-picker/index.js.map +1 -1
  233. package/build-module/font-size-picker/utils.js +1 -1
  234. package/build-module/font-size-picker/utils.js.map +1 -1
  235. package/build-module/form-file-upload/index.js +21 -4
  236. package/build-module/form-file-upload/index.js.map +1 -1
  237. package/build-module/form-file-upload/types.js +2 -0
  238. package/build-module/form-file-upload/types.js.map +1 -0
  239. package/build-module/form-toggle/index.js +1 -3
  240. package/build-module/form-toggle/index.js.map +1 -1
  241. package/build-module/form-token-field/index.js +4 -5
  242. package/build-module/form-token-field/index.js.map +1 -1
  243. package/build-module/form-token-field/suggestions-list.js +1 -2
  244. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  245. package/build-module/gradient-picker/index.js +25 -26
  246. package/build-module/gradient-picker/index.js.map +1 -1
  247. package/build-module/icon/index.js +1 -2
  248. package/build-module/icon/index.js.map +1 -1
  249. package/build-module/input-control/input-base.js +4 -3
  250. package/build-module/input-control/input-base.js.map +1 -1
  251. package/build-module/input-control/label.js +3 -3
  252. package/build-module/input-control/label.js.map +1 -1
  253. package/build-module/input-control/styles/input-control-styles.js +41 -127
  254. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  255. package/build-module/modal/aria-helper.js +3 -8
  256. package/build-module/modal/aria-helper.js.map +1 -1
  257. package/build-module/navigable-container/container.js +5 -1
  258. package/build-module/navigable-container/container.js.map +1 -1
  259. package/build-module/navigable-container/menu.js +10 -11
  260. package/build-module/navigable-container/menu.js.map +1 -1
  261. package/build-module/navigable-container/tabbable.js +2 -3
  262. package/build-module/navigable-container/tabbable.js.map +1 -1
  263. package/build-module/navigation/menu/menu-title-search.js +2 -1
  264. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  265. package/build-module/navigation/menu/use-navigation-tree-menu.js +2 -1
  266. package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  267. package/build-module/navigator/navigator-button/hook.js +1 -1
  268. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  269. package/build-module/navigator/navigator-screen/component.js +2 -2
  270. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  271. package/build-module/number-control/index.js +31 -23
  272. package/build-module/number-control/index.js.map +1 -1
  273. package/build-module/number-control/types.js +2 -0
  274. package/build-module/number-control/types.js.map +1 -0
  275. package/build-module/placeholder/index.js +1 -3
  276. package/build-module/placeholder/index.js.map +1 -1
  277. package/build-module/popover/index.js +192 -162
  278. package/build-module/popover/index.js.map +1 -1
  279. package/build-module/popover/types.js +2 -0
  280. package/build-module/popover/types.js.map +1 -0
  281. package/build-module/popover/utils.js +118 -23
  282. package/build-module/popover/utils.js.map +1 -1
  283. package/build-module/radio-control/index.js +7 -5
  284. package/build-module/radio-control/index.js.map +1 -1
  285. package/build-module/range-control/index.js +4 -1
  286. package/build-module/range-control/index.js.map +1 -1
  287. package/build-module/range-control/styles/range-control-styles.js +33 -33
  288. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  289. package/build-module/sandbox/index.js +2 -2
  290. package/build-module/sandbox/index.js.map +1 -1
  291. package/build-module/search-control/index.js +34 -7
  292. package/build-module/search-control/index.js.map +1 -1
  293. package/build-module/search-control/types.js +2 -0
  294. package/build-module/search-control/types.js.map +1 -0
  295. package/build-module/select-control/index.native.js +1 -1
  296. package/build-module/select-control/index.native.js.map +1 -1
  297. package/build-module/tab-panel/index.js +46 -10
  298. package/build-module/tab-panel/index.js.map +1 -1
  299. package/build-module/tab-panel/types.js +2 -0
  300. package/build-module/tab-panel/types.js.map +1 -0
  301. package/build-module/text-control/index.js +2 -0
  302. package/build-module/text-control/index.js.map +1 -1
  303. package/build-module/textarea-control/index.js +3 -3
  304. package/build-module/textarea-control/index.js.map +1 -1
  305. package/build-module/toggle-control/index.js +38 -4
  306. package/build-module/toggle-control/index.js.map +1 -1
  307. package/build-module/toggle-control/types.js +2 -0
  308. package/build-module/toggle-control/types.js.map +1 -0
  309. package/build-module/toggle-group-control/toggle-group-control/component.js +2 -2
  310. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  311. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  312. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  313. package/build-module/tooltip/index.js +10 -8
  314. package/build-module/tooltip/index.js.map +1 -1
  315. package/build-module/ui/context/context-connect.js +30 -23
  316. package/build-module/ui/context/context-connect.js.map +1 -1
  317. package/build-module/ui/context/context-system-provider.js +5 -4
  318. package/build-module/ui/context/context-system-provider.js.map +1 -1
  319. package/build-module/unit-control/index.js +1 -1
  320. package/build-module/unit-control/index.js.map +1 -1
  321. package/build-module/unit-control/styles/unit-control-styles.js +9 -9
  322. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  323. package/build-module/utils/colors-values.js +2 -30
  324. package/build-module/utils/colors-values.js.map +1 -1
  325. package/build-module/utils/math.js +4 -4
  326. package/build-module/utils/math.js.map +1 -1
  327. package/build-module/utils/values.js +48 -6
  328. package/build-module/utils/values.js.map +1 -1
  329. package/build-module/view/component.js +5 -8
  330. package/build-module/view/component.js.map +1 -1
  331. package/build-module/view/types.js +2 -0
  332. package/build-module/view/types.js.map +1 -0
  333. package/build-style/style-rtl.css +4 -31
  334. package/build-style/style.css +4 -31
  335. package/build-types/base-field/hook.d.ts +54 -55
  336. package/build-types/base-field/hook.d.ts.map +1 -1
  337. package/build-types/border-box-control/border-box-control/component.d.ts +10 -2
  338. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  339. package/build-types/border-box-control/border-box-control/hook.d.ts +56 -57
  340. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  341. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts +2 -1
  342. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  343. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +55 -56
  344. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  345. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +9 -2
  346. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  347. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +56 -57
  348. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  349. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts +2 -1
  350. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
  351. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +55 -56
  352. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  353. package/build-types/border-box-control/styles.d.ts.map +1 -1
  354. package/build-types/border-box-control/types.d.ts +5 -4
  355. package/build-types/border-box-control/types.d.ts.map +1 -1
  356. package/build-types/border-control/border-control/component.d.ts +14 -2
  357. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  358. package/build-types/border-control/border-control/hook.d.ts +56 -57
  359. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  360. package/build-types/border-control/border-control-dropdown/component.d.ts +10 -2
  361. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  362. package/build-types/border-control/border-control-dropdown/hook.d.ts +56 -57
  363. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  364. package/build-types/border-control/border-control-style-picker/component.d.ts +6 -2
  365. package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
  366. package/build-types/border-control/border-control-style-picker/hook.d.ts +55 -56
  367. package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -1
  368. package/build-types/border-control/stories/index.d.ts +74 -6
  369. package/build-types/border-control/stories/index.d.ts.map +1 -1
  370. package/build-types/border-control/types.d.ts +6 -8
  371. package/build-types/border-control/types.d.ts.map +1 -1
  372. package/build-types/button-group/index.d.ts +1 -3
  373. package/build-types/button-group/index.d.ts.map +1 -1
  374. package/build-types/card/card/component.d.ts +9 -2
  375. package/build-types/card/card/component.d.ts.map +1 -1
  376. package/build-types/card/card/hook.d.ts +55 -56
  377. package/build-types/card/card/hook.d.ts.map +1 -1
  378. package/build-types/card/card-body/component.d.ts +9 -2
  379. package/build-types/card/card-body/component.d.ts.map +1 -1
  380. package/build-types/card/card-body/hook.d.ts +55 -56
  381. package/build-types/card/card-body/hook.d.ts.map +1 -1
  382. package/build-types/card/card-divider/component.d.ts +7 -2
  383. package/build-types/card/card-divider/component.d.ts.map +1 -1
  384. package/build-types/card/card-divider/hook.d.ts +55 -55
  385. package/build-types/card/card-footer/component.d.ts +11 -2
  386. package/build-types/card/card-footer/component.d.ts.map +1 -1
  387. package/build-types/card/card-footer/hook.d.ts +55 -56
  388. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  389. package/build-types/card/card-header/component.d.ts +1 -1
  390. package/build-types/card/card-header/component.d.ts.map +1 -1
  391. package/build-types/card/card-header/hook.d.ts +55 -56
  392. package/build-types/card/card-header/hook.d.ts.map +1 -1
  393. package/build-types/card/card-media/component.d.ts +2 -1
  394. package/build-types/card/card-media/component.d.ts.map +1 -1
  395. package/build-types/card/card-media/hook.d.ts +55 -56
  396. package/build-types/card/card-media/hook.d.ts.map +1 -1
  397. package/build-types/checkbox-control/index.d.ts +1 -1
  398. package/build-types/checkbox-control/index.d.ts.map +1 -1
  399. package/build-types/checkbox-control/stories/index.d.ts.map +1 -1
  400. package/build-types/checkbox-control/types.d.ts +1 -1
  401. package/build-types/checkbox-control/types.d.ts.map +1 -1
  402. package/build-types/color-indicator/index.d.ts +1 -3
  403. package/build-types/color-indicator/index.d.ts.map +1 -1
  404. package/build-types/color-palette/styles.d.ts +1 -3
  405. package/build-types/color-palette/styles.d.ts.map +1 -1
  406. package/build-types/color-picker/component.d.ts +2 -1
  407. package/build-types/color-picker/component.d.ts.map +1 -1
  408. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  409. package/build-types/color-picker/styles.d.ts +12 -25
  410. package/build-types/color-picker/styles.d.ts.map +1 -1
  411. package/build-types/confirm-dialog/component.d.ts +4 -8
  412. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  413. package/build-types/date-time/date/styles.d.ts +4 -8
  414. package/build-types/date-time/date/styles.d.ts.map +1 -1
  415. package/build-types/date-time/date-time/styles.d.ts +4 -6
  416. package/build-types/date-time/date-time/styles.d.ts.map +1 -1
  417. package/build-types/date-time/time/styles.d.ts +21 -43
  418. package/build-types/date-time/time/styles.d.ts.map +1 -1
  419. package/build-types/disabled/index.d.ts +1 -1
  420. package/build-types/disabled/index.d.ts.map +1 -1
  421. package/build-types/disabled/styles/disabled-styles.d.ts +1 -5
  422. package/build-types/disabled/styles/disabled-styles.d.ts.map +1 -1
  423. package/build-types/divider/component.d.ts +7 -2
  424. package/build-types/divider/component.d.ts.map +1 -1
  425. package/build-types/drop-zone/index.d.ts +29 -0
  426. package/build-types/drop-zone/index.d.ts.map +1 -0
  427. package/build-types/drop-zone/provider.d.ts +5 -0
  428. package/build-types/drop-zone/provider.d.ts.map +1 -0
  429. package/build-types/drop-zone/stories/index.d.ts +12 -0
  430. package/build-types/drop-zone/stories/index.d.ts.map +1 -0
  431. package/build-types/drop-zone/types.d.ts +29 -0
  432. package/build-types/drop-zone/types.d.ts.map +1 -0
  433. package/build-types/dropdown/dropdown-content-wrapper.d.ts +2 -1
  434. package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -1
  435. package/build-types/dropdown/index.d.ts.map +1 -1
  436. package/build-types/elevation/component.d.ts +2 -1
  437. package/build-types/elevation/component.d.ts.map +1 -1
  438. package/build-types/elevation/hook.d.ts +54 -55
  439. package/build-types/elevation/hook.d.ts.map +1 -1
  440. package/build-types/external-link/index.d.ts +1 -1
  441. package/build-types/external-link/index.d.ts.map +1 -1
  442. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  443. package/build-types/flex/flex/component.d.ts +2 -1
  444. package/build-types/flex/flex/component.d.ts.map +1 -1
  445. package/build-types/flex/flex/hook.d.ts +55 -56
  446. package/build-types/flex/flex/hook.d.ts.map +1 -1
  447. package/build-types/flex/flex-block/component.d.ts +2 -1
  448. package/build-types/flex/flex-block/component.d.ts.map +1 -1
  449. package/build-types/flex/flex-block/hook.d.ts +55 -56
  450. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  451. package/build-types/flex/flex-item/component.d.ts +2 -1
  452. package/build-types/flex/flex-item/component.d.ts.map +1 -1
  453. package/build-types/flex/flex-item/hook.d.ts +55 -56
  454. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  455. package/build-types/focal-point-picker/controls.d.ts +4 -0
  456. package/build-types/focal-point-picker/controls.d.ts.map +1 -0
  457. package/build-types/focal-point-picker/focal-point.d.ts +5 -0
  458. package/build-types/focal-point-picker/focal-point.d.ts.map +1 -0
  459. package/build-types/focal-point-picker/grid.d.ts +5 -0
  460. package/build-types/focal-point-picker/grid.d.ts.map +1 -0
  461. package/build-types/focal-point-picker/index.d.ts +51 -0
  462. package/build-types/focal-point-picker/index.d.ts.map +1 -0
  463. package/build-types/focal-point-picker/media.d.ts +4 -0
  464. package/build-types/focal-point-picker/media.d.ts.map +1 -0
  465. package/build-types/focal-point-picker/stories/index.d.ts +15 -0
  466. package/build-types/focal-point-picker/stories/index.d.ts.map +1 -0
  467. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +56 -0
  468. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -0
  469. package/build-types/focal-point-picker/styles/focal-point-style.d.ts +19 -0
  470. package/build-types/focal-point-picker/styles/focal-point-style.d.ts.map +1 -0
  471. package/build-types/focal-point-picker/types.d.ts +79 -0
  472. package/build-types/focal-point-picker/types.d.ts.map +1 -0
  473. package/build-types/focal-point-picker/utils.d.ts +26 -0
  474. package/build-types/focal-point-picker/utils.d.ts.map +1 -0
  475. package/build-types/form-file-upload/index.d.ts +22 -0
  476. package/build-types/form-file-upload/index.d.ts.map +1 -0
  477. package/build-types/form-file-upload/stories/index.d.ts +23 -0
  478. package/build-types/form-file-upload/stories/index.d.ts.map +1 -0
  479. package/build-types/form-file-upload/test/index.d.ts +2 -0
  480. package/build-types/form-file-upload/test/index.d.ts.map +1 -0
  481. package/build-types/form-file-upload/types.d.ts +63 -0
  482. package/build-types/form-file-upload/types.d.ts.map +1 -0
  483. package/build-types/form-toggle/index.d.ts +1 -1
  484. package/build-types/form-toggle/index.d.ts.map +1 -1
  485. package/build-types/form-token-field/index.d.ts.map +1 -1
  486. package/build-types/form-token-field/styles.d.ts +1 -3
  487. package/build-types/form-token-field/styles.d.ts.map +1 -1
  488. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  489. package/build-types/form-token-field/token-input.d.ts +1 -3
  490. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  491. package/build-types/grid/component.d.ts +2 -1
  492. package/build-types/grid/component.d.ts.map +1 -1
  493. package/build-types/grid/hook.d.ts +55 -56
  494. package/build-types/grid/hook.d.ts.map +1 -1
  495. package/build-types/h-stack/component.d.ts +5 -2
  496. package/build-types/h-stack/component.d.ts.map +1 -1
  497. package/build-types/h-stack/hook.d.ts +55 -56
  498. package/build-types/h-stack/hook.d.ts.map +1 -1
  499. package/build-types/heading/component.d.ts +4 -2
  500. package/build-types/heading/component.d.ts.map +1 -1
  501. package/build-types/heading/hook.d.ts +54 -55
  502. package/build-types/heading/hook.d.ts.map +1 -1
  503. package/build-types/input-control/index.d.ts +1 -1
  504. package/build-types/input-control/index.d.ts.map +1 -1
  505. package/build-types/input-control/input-base.d.ts.map +1 -1
  506. package/build-types/input-control/input-field.d.ts +1 -3
  507. package/build-types/input-control/input-field.d.ts.map +1 -1
  508. package/build-types/input-control/input-prefix-wrapper.d.ts +2 -1
  509. package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -1
  510. package/build-types/input-control/input-suffix-wrapper.d.ts +2 -1
  511. package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -1
  512. package/build-types/input-control/label.d.ts.map +1 -1
  513. package/build-types/input-control/stories/index.d.ts +5 -5
  514. package/build-types/input-control/stories/index.d.ts.map +1 -1
  515. package/build-types/input-control/styles/input-control-styles.d.ts +2 -6
  516. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  517. package/build-types/input-control/types.d.ts +3 -0
  518. package/build-types/input-control/types.d.ts.map +1 -1
  519. package/build-types/item-group/item/component.d.ts +2 -1
  520. package/build-types/item-group/item/component.d.ts.map +1 -1
  521. package/build-types/item-group/item/hook.d.ts +54 -55
  522. package/build-types/item-group/item/hook.d.ts.map +1 -1
  523. package/build-types/item-group/item-group/component.d.ts +2 -1
  524. package/build-types/item-group/item-group/component.d.ts.map +1 -1
  525. package/build-types/item-group/item-group/hook.d.ts +54 -55
  526. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  527. package/build-types/modal/aria-helper.d.ts.map +1 -1
  528. package/build-types/navigable-container/menu.d.ts.map +1 -1
  529. package/build-types/navigable-container/tabbable.d.ts.map +1 -1
  530. package/build-types/navigator/navigator-back-button/component.d.ts +4 -2
  531. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  532. package/build-types/navigator/navigator-back-button/hook.d.ts +59 -60
  533. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  534. package/build-types/navigator/navigator-button/component.d.ts +7 -2
  535. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  536. package/build-types/navigator/navigator-button/hook.d.ts +59 -60
  537. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  538. package/build-types/navigator/navigator-provider/component.d.ts +2 -1
  539. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  540. package/build-types/navigator/navigator-screen/component.d.ts +1 -1
  541. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  542. package/build-types/number-control/index.d.ts +10 -28
  543. package/build-types/number-control/index.d.ts.map +1 -1
  544. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  545. package/build-types/number-control/types.d.ts +72 -0
  546. package/build-types/number-control/types.d.ts.map +1 -0
  547. package/build-types/placeholder/index.d.ts +1 -1
  548. package/build-types/placeholder/index.d.ts.map +1 -1
  549. package/build-types/popover/index.d.ts +28 -24
  550. package/build-types/popover/index.d.ts.map +1 -1
  551. package/build-types/popover/stories/index.d.ts +12 -0
  552. package/build-types/popover/stories/index.d.ts.map +1 -0
  553. package/build-types/popover/types.d.ts +179 -0
  554. package/build-types/popover/types.d.ts.map +1 -0
  555. package/build-types/popover/utils.d.ts +42 -24
  556. package/build-types/popover/utils.d.ts.map +1 -1
  557. package/build-types/radio-control/index.d.ts +1 -1
  558. package/build-types/radio-control/index.d.ts.map +1 -1
  559. package/build-types/range-control/index.d.ts +2 -4
  560. package/build-types/range-control/index.d.ts.map +1 -1
  561. package/build-types/range-control/input-range.d.ts +2 -4
  562. package/build-types/range-control/input-range.d.ts.map +1 -1
  563. package/build-types/range-control/styles/range-control-styles.d.ts +5 -10
  564. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  565. package/build-types/resizable-box/index.d.ts +1 -1
  566. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  567. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  568. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -3
  569. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  570. package/build-types/scrollable/component.d.ts +2 -1
  571. package/build-types/scrollable/component.d.ts.map +1 -1
  572. package/build-types/scrollable/hook.d.ts +55 -56
  573. package/build-types/scrollable/hook.d.ts.map +1 -1
  574. package/build-types/search-control/index.d.ts +29 -0
  575. package/build-types/search-control/index.d.ts.map +1 -0
  576. package/build-types/search-control/stories/index.d.ts +47 -0
  577. package/build-types/search-control/stories/index.d.ts.map +1 -0
  578. package/build-types/search-control/types.d.ts +39 -0
  579. package/build-types/search-control/types.d.ts.map +1 -0
  580. package/build-types/select-control/index.d.ts +1 -3
  581. package/build-types/select-control/index.d.ts.map +1 -1
  582. package/build-types/select-control/stories/index.d.ts +2 -6
  583. package/build-types/select-control/stories/index.d.ts.map +1 -1
  584. package/build-types/select-control/styles/select-control-styles.d.ts +1 -3
  585. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  586. package/build-types/spacer/component.d.ts +2 -1
  587. package/build-types/spacer/component.d.ts.map +1 -1
  588. package/build-types/spacer/hook.d.ts +55 -56
  589. package/build-types/spacer/hook.d.ts.map +1 -1
  590. package/build-types/spinner/index.d.ts +1 -3
  591. package/build-types/spinner/index.d.ts.map +1 -1
  592. package/build-types/surface/component.d.ts +2 -1
  593. package/build-types/surface/component.d.ts.map +1 -1
  594. package/build-types/surface/hook.d.ts +55 -56
  595. package/build-types/surface/hook.d.ts.map +1 -1
  596. package/build-types/tab-panel/index.d.ts +42 -0
  597. package/build-types/tab-panel/index.d.ts.map +1 -0
  598. package/build-types/tab-panel/stories/index.d.ts +12 -0
  599. package/build-types/tab-panel/stories/index.d.ts.map +1 -0
  600. package/build-types/tab-panel/test/index.d.ts +2 -0
  601. package/build-types/tab-panel/test/index.d.ts.map +1 -0
  602. package/build-types/tab-panel/types.d.ts +64 -0
  603. package/build-types/tab-panel/types.d.ts.map +1 -0
  604. package/build-types/text/component.d.ts +1 -1
  605. package/build-types/text/component.d.ts.map +1 -1
  606. package/build-types/text/hook.d.ts +55 -56
  607. package/build-types/text/hook.d.ts.map +1 -1
  608. package/build-types/text-control/index.d.ts +2 -4
  609. package/build-types/text-control/index.d.ts.map +1 -1
  610. package/build-types/text-control/types.d.ts +1 -1
  611. package/build-types/text-control/types.d.ts.map +1 -1
  612. package/build-types/textarea-control/index.d.ts +1 -1
  613. package/build-types/textarea-control/index.d.ts.map +1 -1
  614. package/build-types/textarea-control/types.d.ts +1 -1
  615. package/build-types/textarea-control/types.d.ts.map +1 -1
  616. package/build-types/toggle-control/index.d.ts +26 -0
  617. package/build-types/toggle-control/index.d.ts.map +1 -0
  618. package/build-types/toggle-control/stories/index.d.ts +13 -0
  619. package/build-types/toggle-control/stories/index.d.ts.map +1 -0
  620. package/build-types/toggle-control/test/index.d.ts +2 -0
  621. package/build-types/toggle-control/test/index.d.ts.map +1 -0
  622. package/build-types/toggle-control/types.d.ts +20 -0
  623. package/build-types/toggle-control/types.d.ts.map +1 -0
  624. package/build-types/toggle-group-control/stories/index.d.ts +4 -2
  625. package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
  626. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +12 -2
  627. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  628. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +2 -4
  629. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  630. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +2 -1
  631. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  632. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +3 -5
  633. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  634. package/build-types/toggle-group-control/types.d.ts +2 -2
  635. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  636. package/build-types/tools-panel/tools-panel/component.d.ts +2 -1
  637. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  638. package/build-types/tools-panel/tools-panel/hook.d.ts +55 -56
  639. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  640. package/build-types/tools-panel/tools-panel-header/component.d.ts +2 -1
  641. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  642. package/build-types/tools-panel/tools-panel-header/hook.d.ts +55 -56
  643. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  644. package/build-types/tools-panel/tools-panel-item/component.d.ts +6 -2
  645. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  646. package/build-types/tools-panel/tools-panel-item/hook.d.ts +55 -56
  647. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  648. package/build-types/tooltip/index.d.ts.map +1 -1
  649. package/build-types/truncate/component.d.ts +2 -1
  650. package/build-types/truncate/component.d.ts.map +1 -1
  651. package/build-types/truncate/hook.d.ts +55 -56
  652. package/build-types/truncate/hook.d.ts.map +1 -1
  653. package/build-types/ui/context/context-connect.d.ts +10 -9
  654. package/build-types/ui/context/context-connect.d.ts.map +1 -1
  655. package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
  656. package/build-types/ui/context/test/context-connect.d.ts +2 -0
  657. package/build-types/ui/context/test/context-connect.d.ts.map +1 -0
  658. package/build-types/ui/context/test/wordpress-component.d.ts +2 -0
  659. package/build-types/ui/context/test/wordpress-component.d.ts.map +1 -0
  660. package/build-types/ui/context/wordpress-component.d.ts +8 -9
  661. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  662. package/build-types/ui/control-group/component.d.ts +4 -1
  663. package/build-types/ui/control-group/component.d.ts.map +1 -1
  664. package/build-types/ui/control-group/hook.d.ts +55 -56
  665. package/build-types/ui/control-group/hook.d.ts.map +1 -1
  666. package/build-types/ui/control-label/component.d.ts +4 -1
  667. package/build-types/ui/control-label/component.d.ts.map +1 -1
  668. package/build-types/ui/control-label/hook.d.ts +55 -56
  669. package/build-types/ui/control-label/hook.d.ts.map +1 -1
  670. package/build-types/ui/form-group/form-group.d.ts +4 -8
  671. package/build-types/ui/form-group/form-group.d.ts.map +1 -1
  672. package/build-types/ui/form-group/use-form-group.d.ts +112 -114
  673. package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
  674. package/build-types/ui/shortcut/component.d.ts +2 -1
  675. package/build-types/ui/shortcut/component.d.ts.map +1 -1
  676. package/build-types/ui/spinner/component.d.ts +1 -1
  677. package/build-types/ui/tooltip/component.d.ts +11 -1
  678. package/build-types/ui/tooltip/component.d.ts.map +1 -1
  679. package/build-types/ui/tooltip/content.d.ts +7 -1
  680. package/build-types/ui/tooltip/styles.d.ts +1 -3
  681. package/build-types/ui/tooltip/styles.d.ts.map +1 -1
  682. package/build-types/unit-control/index.d.ts +2 -12
  683. package/build-types/unit-control/index.d.ts.map +1 -1
  684. package/build-types/unit-control/stories/index.d.ts.map +1 -1
  685. package/build-types/unit-control/styles/unit-control-styles.d.ts +5 -10
  686. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  687. package/build-types/unit-control/types.d.ts +3 -35
  688. package/build-types/unit-control/types.d.ts.map +1 -1
  689. package/build-types/utils/colors-values.d.ts +0 -18
  690. package/build-types/utils/colors-values.d.ts.map +1 -1
  691. package/build-types/utils/math.d.ts +6 -6
  692. package/build-types/utils/math.d.ts.map +1 -1
  693. package/build-types/utils/values.d.ts +10 -8
  694. package/build-types/utils/values.d.ts.map +1 -1
  695. package/build-types/v-stack/component.d.ts +8 -2
  696. package/build-types/v-stack/component.d.ts.map +1 -1
  697. package/build-types/v-stack/hook.d.ts +55 -56
  698. package/build-types/v-stack/hook.d.ts.map +1 -1
  699. package/build-types/v-stack/stories/index.d.ts +8 -1
  700. package/build-types/v-stack/stories/index.d.ts.map +1 -1
  701. package/build-types/view/component.d.ts +8 -6
  702. package/build-types/view/component.d.ts.map +1 -1
  703. package/build-types/view/stories/index.d.ts +12 -0
  704. package/build-types/view/stories/index.d.ts.map +1 -0
  705. package/build-types/view/types.d.ts +8 -0
  706. package/build-types/view/types.d.ts.map +1 -0
  707. package/build-types/visually-hidden/component.d.ts +2 -1
  708. package/build-types/visually-hidden/component.d.ts.map +1 -1
  709. package/build-types/z-stack/component.d.ts +2 -1
  710. package/build-types/z-stack/component.d.ts.map +1 -1
  711. package/package.json +17 -17
  712. package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +1 -1
  713. package/src/angle-picker-control/README.md +9 -1
  714. package/src/angle-picker-control/index.js +12 -0
  715. package/src/angle-picker-control/stories/index.js +3 -3
  716. package/src/autocomplete/autocompleter-ui.js +6 -3
  717. package/src/base-field/test/__snapshots__/index.js.snap +3 -5
  718. package/src/border-box-control/border-box-control/component.tsx +28 -12
  719. package/src/border-box-control/border-box-control-linked-button/component.tsx +1 -2
  720. package/src/border-box-control/border-box-control-split-controls/component.tsx +25 -11
  721. package/src/border-box-control/stories/index.js +1 -0
  722. package/src/border-box-control/styles.ts +2 -1
  723. package/src/border-box-control/types.ts +5 -4
  724. package/src/border-control/border-control-dropdown/component.tsx +3 -8
  725. package/src/border-control/types.ts +7 -9
  726. package/src/box-control/linked-button.js +3 -3
  727. package/src/box-control/test/index.js +5 -5
  728. package/src/button/style.scss +4 -3
  729. package/src/card/styles.ts +1 -1
  730. package/src/card/test/__snapshots__/index.tsx.snap +39 -51
  731. package/src/checkbox-control/index.tsx +3 -6
  732. package/src/checkbox-control/stories/index.tsx +6 -2
  733. package/src/checkbox-control/types.ts +4 -1
  734. package/src/color-palette/index.js +1 -1
  735. package/src/color-palette/test/__snapshots__/index.js.snap +67 -91
  736. package/src/color-picker/input-with-slider.tsx +1 -0
  737. package/src/combobox-control/index.js +1 -1
  738. package/src/combobox-control/test/index.js +311 -0
  739. package/src/custom-gradient-picker/index.js +1 -1
  740. package/src/date-time/date/index.tsx +2 -2
  741. package/src/date-time/time/timezone.tsx +1 -1
  742. package/src/dimension-control/test/__snapshots__/index.test.js.snap +1122 -164
  743. package/src/dimension-control/test/index.test.js +29 -38
  744. package/src/disabled/index.tsx +27 -9
  745. package/src/disabled/styles/disabled-styles.tsx +2 -2
  746. package/src/disabled/test/index.tsx +38 -0
  747. package/src/drop-zone/README.md +3 -3
  748. package/src/drop-zone/{index.js → index.tsx} +48 -13
  749. package/src/drop-zone/{provider.js → provider.ts} +5 -1
  750. package/src/drop-zone/stories/index.tsx +30 -0
  751. package/src/drop-zone/types.ts +29 -0
  752. package/src/dropdown/README.md +6 -4
  753. package/src/dropdown/index.js +15 -3
  754. package/src/dropdown/stories/index.js +1 -1
  755. package/src/flex/flex/hook.ts +5 -54
  756. package/src/flex/test/__snapshots__/index.tsx.snap +7 -15
  757. package/src/focal-point-picker/README.md +2 -2
  758. package/src/focal-point-picker/{controls.js → controls.tsx} +38 -10
  759. package/src/focal-point-picker/{focal-point.js → focal-point.tsx} +7 -1
  760. package/src/focal-point-picker/{grid.js → grid.tsx} +6 -1
  761. package/src/focal-point-picker/{index.js → index.tsx} +99 -15
  762. package/src/focal-point-picker/{media.js → media.tsx} +10 -4
  763. package/src/focal-point-picker/stories/index.tsx +93 -0
  764. package/src/focal-point-picker/styles/{focal-point-picker-style.js → focal-point-picker-style.ts} +31 -5
  765. package/src/focal-point-picker/styles/{focal-point-style.js → focal-point-style.ts} +2 -1
  766. package/src/focal-point-picker/test/index.js +27 -7
  767. package/src/focal-point-picker/types.ts +93 -0
  768. package/src/focal-point-picker/{utils.js → utils.ts} +9 -9
  769. package/src/font-size-picker/README.md +9 -0
  770. package/src/font-size-picker/index.js +9 -0
  771. package/src/font-size-picker/stories/index.js +3 -5
  772. package/src/font-size-picker/test/index.js +15 -2
  773. package/src/font-size-picker/test/utils.js +1 -2
  774. package/src/font-size-picker/utils.js +1 -1
  775. package/src/form-file-upload/README.md +6 -1
  776. package/src/form-file-upload/{index.js → index.tsx} +22 -4
  777. package/src/form-file-upload/stories/index.tsx +74 -0
  778. package/src/form-file-upload/test/{index.js → index.tsx} +7 -3
  779. package/src/form-file-upload/types.ts +63 -0
  780. package/src/form-toggle/index.tsx +1 -6
  781. package/src/form-token-field/index.tsx +4 -5
  782. package/src/form-token-field/suggestions-list.tsx +1 -2
  783. package/src/gradient-picker/index.js +41 -47
  784. package/src/gradient-picker/stories/index.js +10 -0
  785. package/src/h-stack/test/__snapshots__/index.tsx.snap +3 -12
  786. package/src/higher-order/with-filters/test/__snapshots__/index.js.snap +87 -0
  787. package/src/higher-order/with-filters/test/index.js +20 -74
  788. package/src/icon/index.tsx +1 -1
  789. package/src/icon/stories/index.js +18 -0
  790. package/src/icon/test/index.js +32 -83
  791. package/src/input-control/input-base.tsx +9 -11
  792. package/src/input-control/label.tsx +9 -4
  793. package/src/input-control/styles/input-control-styles.tsx +0 -43
  794. package/src/input-control/types.ts +3 -0
  795. package/src/isolated-event-container/test/index.js +53 -11
  796. package/src/item-group/test/__snapshots__/index.js.snap +16 -16
  797. package/src/keyboard-shortcuts/test/index.js +16 -31
  798. package/src/menu-item/test/__snapshots__/index.js.snap +60 -62
  799. package/src/menu-item/test/index.js +30 -22
  800. package/src/modal/aria-helper.js +3 -8
  801. package/src/modal/style.scss +3 -4
  802. package/src/navigable-container/README.md +2 -0
  803. package/src/navigable-container/container.js +8 -1
  804. package/src/navigable-container/menu.js +14 -11
  805. package/src/navigable-container/stories/navigable-menu.js +49 -0
  806. package/src/navigable-container/stories/tabbable-container.js +40 -0
  807. package/src/navigable-container/tabbable.js +2 -3
  808. package/src/navigable-container/test/navigable-menu.js +277 -0
  809. package/src/navigable-container/test/tababble-container.js +175 -0
  810. package/src/navigation/menu/menu-title-search.js +2 -0
  811. package/src/navigation/menu/use-navigation-tree-menu.js +2 -0
  812. package/src/navigator/navigator-button/hook.ts +1 -1
  813. package/src/navigator/navigator-screen/component.tsx +6 -1
  814. package/src/number-control/index.tsx +209 -0
  815. package/src/number-control/stories/index.js +6 -18
  816. package/src/number-control/types.ts +75 -0
  817. package/src/panel/README.md +1 -1
  818. package/src/panel/test/__snapshots__/header.js.snap +9 -0
  819. package/src/panel/test/__snapshots__/index.js.snap +17 -0
  820. package/src/panel/test/__snapshots__/row.js.snap +17 -0
  821. package/src/panel/test/header.js +30 -23
  822. package/src/panel/test/index.js +33 -25
  823. package/src/panel/test/row.js +18 -11
  824. package/src/placeholder/index.tsx +4 -5
  825. package/src/placeholder/style.scss +4 -0
  826. package/src/popover/README.md +128 -48
  827. package/src/popover/{index.js → index.tsx} +284 -182
  828. package/src/popover/stories/{index.js → index.tsx} +52 -54
  829. package/src/popover/test/index.js +7 -5
  830. package/src/popover/types.ts +192 -0
  831. package/src/popover/utils.ts +242 -0
  832. package/src/radio-control/index.tsx +28 -29
  833. package/src/radio-control/style.scss +0 -17
  834. package/src/range-control/index.tsx +4 -1
  835. package/src/range-control/styles/range-control-styles.ts +8 -8
  836. package/src/sandbox/index.js +2 -2
  837. package/src/search-control/README.md +5 -3
  838. package/src/search-control/{index.js → index.tsx} +35 -7
  839. package/src/search-control/stories/index.tsx +66 -0
  840. package/src/search-control/types.ts +43 -0
  841. package/src/select-control/index.native.js +1 -1
  842. package/src/slot-fill/test/index.js +69 -12
  843. package/src/style.scss +0 -1
  844. package/src/surface/test/__snapshots__/index.tsx.snap +10 -10
  845. package/src/tab-panel/README.md +1 -2
  846. package/src/tab-panel/{index.js → index.tsx} +58 -13
  847. package/src/tab-panel/stories/index.tsx +37 -0
  848. package/src/tab-panel/test/index.tsx +120 -0
  849. package/src/tab-panel/types.ts +65 -0
  850. package/src/text-control/index.tsx +2 -0
  851. package/src/text-control/types.ts +5 -1
  852. package/src/textarea-control/index.tsx +3 -6
  853. package/src/textarea-control/types.ts +1 -1
  854. package/src/toggle-control/index.tsx +97 -0
  855. package/src/toggle-control/stories/index.tsx +58 -0
  856. package/src/toggle-control/test/index.tsx +53 -0
  857. package/src/toggle-control/types.ts +28 -0
  858. package/src/toggle-group-control/stories/index.tsx +10 -3
  859. package/src/toggle-group-control/toggle-group-control/component.tsx +3 -3
  860. package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
  861. package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -1
  862. package/src/toggle-group-control/types.ts +2 -2
  863. package/src/tooltip/index.js +11 -7
  864. package/src/ui/context/context-connect.ts +58 -31
  865. package/src/ui/context/context-system-provider.js +5 -4
  866. package/src/ui/context/test/context-connect.tsx +55 -0
  867. package/src/ui/context/test/wordpress-component.tsx +36 -0
  868. package/src/ui/context/wordpress-component.ts +18 -12
  869. package/src/ui/control-group/test/__snapshots__/index.js.snap +1 -4
  870. package/src/unit-control/index.tsx +1 -1
  871. package/src/unit-control/stories/index.tsx +7 -16
  872. package/src/unit-control/styles/unit-control-styles.ts +2 -2
  873. package/src/unit-control/test/__snapshots__/index.tsx.snap +4 -6
  874. package/src/unit-control/types.ts +3 -44
  875. package/src/utils/colors-values.js +2 -24
  876. package/src/utils/math.js +4 -4
  877. package/src/utils/values.js +48 -6
  878. package/src/v-stack/test/__snapshots__/index.tsx.snap +3 -12
  879. package/src/view/{component.js → component.tsx} +13 -4
  880. package/src/view/stories/index.tsx +32 -0
  881. package/src/view/types.ts +6 -0
  882. package/tsconfig.json +1 -6
  883. package/tsconfig.tsbuildinfo +1 -1
  884. package/src/focal-point-picker/stories/index.js +0 -76
  885. package/src/navigable-container/test/menu.js +0 -310
  886. package/src/navigable-container/test/tabbable.js +0 -158
  887. package/src/number-control/index.js +0 -192
  888. package/src/popover/utils.js +0 -107
  889. package/src/search-control/stories/index.js +0 -39
  890. package/src/tab-panel/stories/index.js +0 -39
  891. package/src/tab-panel/test/index.js +0 -179
  892. package/src/toggle-control/index.js +0 -55
  893. package/src/toggle-control/stories/index.js +0 -64
  894. package/src/toggle-control/style.scss +0 -14
  895. package/src/toggle-control/test/index.js +0 -52
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/popover/index.js"],"names":["classnames","useFloating","flip","shift","autoUpdate","arrow","offset","offsetMiddleware","limitShift","size","motion","useReducedMotion","useRef","useLayoutEffect","forwardRef","createContext","useContext","useMemo","useEffect","useViewportMatch","useMergeRefs","__experimentalUseDialog","useDialog","close","deprecated","Path","SVG","Button","ScrollLock","Slot","Fill","useSlot","getFrameOffset","positionToPlacement","placementToMotionAnimationProps","SLOT_NAME","ArrowTriangle","props","MaybeAnimatedWrapper","forwardedRef","style","receivedInlineStyles","placement","shouldAnimate","shouldReduceMotion","motionInlineStyles","otherMotionProps","slotNameContext","Popover","range","animate","headerTitle","onClose","children","className","noArrow","isAlternate","position","placementProp","offsetProp","focusOnMount","anchorRef","anchorRect","getAnchorRect","expandOnMobile","onFocusOutside","__unstableSlotName","__unstableForcePosition","__unstableShift","contentProps","since","version","arrowRef","anchorRefFallback","isMobileViewport","isExpanded","hasArrow","normalizedPlacementFromProps","referenceOwnerDocument","documentToReturn","top","ownerDocument","startContainer","current","document","frameOffsetRef","offsetRef","middleware","currentPlacement","isTopBottomPlacement","includes","mainAxis","crossAxis","hasBeforePlacement","mainAxisModifier","undefined","apply","sizeProps","availableHeight","refs","floating","Object","assign","firstChild","maxHeight","overflow","limiter","padding","element","filter","m","slotName","slot","onDialogClose","type","event","dialogRef","dialogProps","__unstableOnClose","x","y","reference","strategy","update","computedPlacement","middlewareData","arrowData","resultingReferenceRef","getBoundingClientRect","topRect","bottomRect","bottom","window","DOMRect","width","rect","left","right","height","parentNode","animationFrame","referenceAndFloatingHaveSameDocument","hasFrameElement","defaultView","frameElement","updateFrameOffset","addEventListener","removeEventListener","mergedFloatingRef","content","Number","isNaN","split","join","isFinite","ref","PopoverContainer","PopoverSlot","name","__unstableSlotNameProvider","Provider"],"mappings":";;AAAA;;AACA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SACCC,WADD,EAECC,IAFD,EAGCC,KAHD,EAICC,UAJD,EAKCC,KALD,EAMCC,MAAM,IAAIC,gBANX,EAOCC,UAPD,EAQCC,IARD,QASO,wBATP,C,CAUA;;AACA,SAASC,MAAT,EAAiBC,gBAAjB,QAAyC,eAAzC;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,eAFD,EAGCC,UAHD,EAICC,aAJD,EAKCC,UALD,EAMCC,OAND,EAOCC,SAPD,QAQO,oBARP;AASA,SACCC,gBADD,EAECC,YAFD,EAGCC,uBAAuB,IAAIC,SAH5B,QAIO,oBAJP;AAKA,SAASC,KAAT,QAAsB,kBAAtB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,IAAT,EAAeC,GAAf,QAA0B,uBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,OAArB,QAAoC,cAApC;AACA,SACCC,cADD,EAECC,mBAFD,EAGCC,+BAHD,QAIO,SAJP;AAMA;AACA;AACA;AACA;AACA;;AACA,MAAMC,SAAS,GAAG,SAAlB,C,CAEA;AACA;AACA;AACA;;AACA,MAAMC,aAAa,GAAKC,KAAF,IACrB,cAAC,GAAD,e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AAC9B,WAAOuF,OAAP;AACA;;AAED,SAAO;AAAM,IAAA,GAAG,EAAG5E;AAAZ,KAAkC4E,OAAlC,CAAP;AACA,CAhXD;;AAkXA,MAAMO,gBAAgB,GAAG9I,UAAU,CAAEkC,OAAF,CAAnC;;AAEA,SAAS6G,WAAT,QAA4CF,GAA5C,EAAkD;AAAA,MAA5B;AAAEG,IAAAA,IAAI,GAAG3H;AAAT,GAA4B;AACjD,SACC,cAAC,IAAD;AACC,IAAA,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAG2H,IAFR;AAGC,IAAA,SAAS,EAAC,cAHX;AAIC,IAAA,GAAG,EAAGH;AAJP,IADD;AAQA;;AAEDC,gBAAgB,CAAC/H,IAAjB,GAAwBf,UAAU,CAAE+I,WAAF,CAAlC;AACAD,gBAAgB,CAACG,0BAAjB,GAA8ChH,eAAe,CAACiH,QAA9D;AAEA,eAAeJ,gBAAf","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport {\n\tuseFloating,\n\tflip,\n\tshift,\n\tautoUpdate,\n\tarrow,\n\toffset as offsetMiddleware,\n\tlimitShift,\n\tsize,\n} from '@floating-ui/react-dom';\n// eslint-disable-next-line no-restricted-imports\nimport { motion, useReducedMotion } from 'framer-motion';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport {\n\tuseViewportMatch,\n\tuseMergeRefs,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { close } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\nimport { Path, SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport ScrollLock from '../scroll-lock';\nimport { Slot, Fill, useSlot } from '../slot-fill';\nimport {\n\tgetFrameOffset,\n\tpositionToPlacement,\n\tplacementToMotionAnimationProps,\n} from './utils';\n\n/**\n * Name of slot in which popover should fill.\n *\n * @type {string}\n */\nconst SLOT_NAME = 'Popover';\n\n// An SVG displaying a triangle facing down, filled with a solid\n// color and bordered in such a way to create an arrow-like effect.\n// Keeping the SVG's viewbox squared simplify the arrow positioning\n// calculations.\nconst ArrowTriangle = ( props ) => (\n\t<SVG\n\t\t{ ...props }\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox={ `0 0 100 100` }\n\t\tclassName=\"components-popover__triangle\"\n\t\trole=\"presentation\"\n\t>\n\t\t<Path\n\t\t\tclassName=\"components-popover__triangle-bg\"\n\t\t\td=\"M 0 0 L 50 50 L 100 0\"\n\t\t/>\n\t\t<Path\n\t\t\tclassName=\"components-popover__triangle-border\"\n\t\t\td=\"M 0 0 L 50 50 L 100 0\"\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t/>\n\t</SVG>\n);\n\nconst MaybeAnimatedWrapper = forwardRef(\n\t(\n\t\t{\n\t\t\tstyle: receivedInlineStyles,\n\t\t\tplacement,\n\t\t\tshouldAnimate = false,\n\t\t\t...props\n\t\t},\n\t\tforwardedRef\n\t) => {\n\t\tconst shouldReduceMotion = useReducedMotion();\n\n\t\tconst { style: motionInlineStyles, ...otherMotionProps } = useMemo(\n\t\t\t() => placementToMotionAnimationProps( placement ),\n\t\t\t[ placement ]\n\t\t);\n\n\t\tif ( shouldAnimate && ! shouldReduceMotion ) {\n\t\t\treturn (\n\t\t\t\t<motion.div\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...motionInlineStyles,\n\t\t\t\t\t\t...receivedInlineStyles,\n\t\t\t\t\t} }\n\t\t\t\t\t{ ...otherMotionProps }\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={ receivedInlineStyles }\n\t\t\t\t{ ...props }\n\t\t\t\tref={ forwardedRef }\n\t\t\t/>\n\t\t);\n\t}\n);\n\nconst slotNameContext = createContext();\n\nconst Popover = (\n\t{\n\t\trange,\n\t\tanimate = true,\n\t\theaderTitle,\n\t\tonClose,\n\t\tchildren,\n\t\tclassName,\n\t\tnoArrow = true,\n\t\tisAlternate,\n\t\tposition,\n\t\tplacement: placementProp = 'bottom-start',\n\t\toffset: offsetProp = 0,\n\t\tfocusOnMount = 'firstElement',\n\t\tanchorRef,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\texpandOnMobile,\n\t\tonFocusOutside,\n\t\t__unstableSlotName = SLOT_NAME,\n\t\t__unstableForcePosition = false,\n\t\t__unstableShift = false,\n\t\t...contentProps\n\t},\n\tforwardedRef\n) => {\n\tif ( range ) {\n\t\tdeprecated( 'range prop in Popover component', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t} );\n\t}\n\n\tconst arrowRef = useRef( null );\n\tconst anchorRefFallback = useRef( null );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isExpanded = expandOnMobile && isMobileViewport;\n\tconst hasArrow = ! isExpanded && ! noArrow;\n\tconst normalizedPlacementFromProps = position\n\t\t? positionToPlacement( position )\n\t\t: placementProp;\n\n\tconst referenceOwnerDocument = useMemo( () => {\n\t\tlet documentToReturn;\n\n\t\tif ( anchorRef?.top ) {\n\t\t\tdocumentToReturn = anchorRef?.top.ownerDocument;\n\t\t} else if ( anchorRef?.startContainer ) {\n\t\t\tdocumentToReturn = anchorRef.startContainer.ownerDocument;\n\t\t} else if ( anchorRef?.current ) {\n\t\t\tdocumentToReturn = anchorRef.current.ownerDocument;\n\t\t} else if ( anchorRef ) {\n\t\t\t// This one should be deprecated.\n\t\t\tdocumentToReturn = anchorRef.ownerDocument;\n\t\t} else if ( anchorRect && anchorRect?.ownerDocument ) {\n\t\t\tdocumentToReturn = anchorRect.ownerDocument;\n\t\t} else if ( getAnchorRect ) {\n\t\t\tdocumentToReturn = getAnchorRect(\n\t\t\t\tanchorRefFallback.current\n\t\t\t)?.ownerDocument;\n\t\t}\n\n\t\treturn documentToReturn ?? document;\n\t}, [ anchorRef, anchorRect, getAnchorRect ] );\n\n\t/**\n\t * Offsets the position of the popover when the anchor is inside an iframe.\n\t *\n\t * Store the offset in a ref, due to constraints with floating-ui:\n\t * https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.\n\t */\n\tconst frameOffsetRef = useRef( getFrameOffset( referenceOwnerDocument ) );\n\t/**\n\t * Store the offset prop in a ref, due to constraints with floating-ui:\n\t * https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.\n\t */\n\tconst offsetRef = useRef( offsetProp );\n\n\tconst middleware = [\n\t\toffsetMiddleware( ( { placement: currentPlacement } ) => {\n\t\t\tif ( ! frameOffsetRef.current ) {\n\t\t\t\treturn offsetRef.current;\n\t\t\t}\n\n\t\t\tconst isTopBottomPlacement =\n\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\tcurrentPlacement.includes( 'bottom' );\n\n\t\t\t// The main axis should represent the gap between the\n\t\t\t// floating element and the reference element. The cross\n\t\t\t// axis is always perpendicular to the main axis.\n\t\t\tconst mainAxis = isTopBottomPlacement ? 'y' : 'x';\n\t\t\tconst crossAxis = mainAxis === 'x' ? 'y' : 'x';\n\n\t\t\t// When the popover is before the reference, subtract the offset,\n\t\t\t// of the main axis else add it.\n\t\t\tconst hasBeforePlacement =\n\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\tcurrentPlacement.includes( 'left' );\n\t\t\tconst mainAxisModifier = hasBeforePlacement ? -1 : 1;\n\n\t\t\treturn {\n\t\t\t\tmainAxis:\n\t\t\t\t\toffsetRef.current +\n\t\t\t\t\tframeOffsetRef.current[ mainAxis ] * mainAxisModifier,\n\t\t\t\tcrossAxis: frameOffsetRef.current[ crossAxis ],\n\t\t\t};\n\t\t} ),\n\t\t__unstableForcePosition ? undefined : flip(),\n\t\t__unstableForcePosition\n\t\t\t? undefined\n\t\t\t: size( {\n\t\t\t\t\tapply( sizeProps ) {\n\t\t\t\t\t\tconst { availableHeight } = sizeProps;\n\t\t\t\t\t\tif ( ! refs.floating.current ) return;\n\t\t\t\t\t\t// Reduce the height of the popover to the available space.\n\t\t\t\t\t\tObject.assign( refs.floating.current.firstChild.style, {\n\t\t\t\t\t\t\tmaxHeight: `${ availableHeight }px`,\n\t\t\t\t\t\t\toverflow: 'auto',\n\t\t\t\t\t\t} );\n\t\t\t\t\t},\n\t\t\t } ),\n\t\t__unstableShift\n\t\t\t? shift( {\n\t\t\t\t\tcrossAxis: true,\n\t\t\t\t\tlimiter: limitShift(),\n\t\t\t\t\tpadding: 1, // Necessary to avoid flickering at the edge of the viewport.\n\t\t\t } )\n\t\t\t: undefined,\n\t\thasArrow ? arrow( { element: arrowRef } ) : undefined,\n\t].filter( ( m ) => !! m );\n\tconst slotName = useContext( slotNameContext ) || __unstableSlotName;\n\tconst slot = useSlot( slotName );\n\n\tlet onDialogClose;\n\n\tif ( onClose || onFocusOutside ) {\n\t\tonDialogClose = ( type, event ) => {\n\t\t\t// Ideally the popover should have just a single onClose prop and\n\t\t\t// not three props that potentially do the same thing.\n\t\t\tif ( type === 'focus-outside' && onFocusOutside ) {\n\t\t\t\tonFocusOutside( event );\n\t\t\t} else if ( onClose ) {\n\t\t\t\tonClose();\n\t\t\t}\n\t\t};\n\t}\n\n\tconst [ dialogRef, dialogProps ] = useDialog( {\n\t\tfocusOnMount,\n\t\t__unstableOnClose: onDialogClose,\n\t\tonClose: onDialogClose,\n\t} );\n\n\tconst {\n\t\t// Positioning coordinates\n\t\tx,\n\t\ty,\n\t\t// Callback refs (not regular refs). This allows the position to be updated.\n\t\t// when either elements change.\n\t\treference,\n\t\tfloating,\n\t\t// Object with \"regular\" refs to both \"reference\" and \"floating\"\n\t\trefs,\n\t\t// Type of CSS position property to use (absolute or fixed)\n\t\tstrategy,\n\t\tupdate,\n\t\tplacement: computedPlacement,\n\t\tmiddlewareData: { arrow: arrowData = {} },\n\t} = useFloating( { placement: normalizedPlacementFromProps, middleware } );\n\n\tuseEffect( () => {\n\t\toffsetRef.current = offsetProp;\n\t\tupdate();\n\t}, [ offsetProp, update ] );\n\n\t// Update the `reference`'s ref.\n\t//\n\t// In floating-ui's terms:\n\t// - \"reference\" refers to the popover's anchor element.\n\t// - \"floating\" refers the floating popover's element.\n\t// A floating element can also be positioned relative to a virtual element,\n\t// instead of a real one. A virtual element is represented by an object\n\t// with the `getBoundingClientRect()` function (like real elements).\n\t// See https://floating-ui.com/docs/virtual-elements for more info.\n\tuseLayoutEffect( () => {\n\t\tlet resultingReferenceRef;\n\n\t\tif ( anchorRef?.top ) {\n\t\t\t// Create a virtual element for the ref. The expectation is that\n\t\t\t// if anchorRef.top is defined, then anchorRef.bottom is defined too.\n\t\t\tresultingReferenceRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\tconst topRect = anchorRef.top.getBoundingClientRect();\n\t\t\t\t\tconst bottomRect = anchorRef.bottom.getBoundingClientRect();\n\t\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\t\ttopRect.x,\n\t\t\t\t\t\ttopRect.y,\n\t\t\t\t\t\ttopRect.width,\n\t\t\t\t\t\tbottomRect.bottom - topRect.top\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( anchorRef?.current ) {\n\t\t\t// Standard React ref.\n\t\t\tresultingReferenceRef = anchorRef.current;\n\t\t} else if ( anchorRef ) {\n\t\t\t// If `anchorRef` holds directly the element's value (no `current` key)\n\t\t\t// This is a weird scenario and should be deprecated.\n\t\t\tresultingReferenceRef = anchorRef;\n\t\t} else if ( anchorRect ) {\n\t\t\t// Create a virtual element for the ref.\n\t\t\tresultingReferenceRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\treturn anchorRect;\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( getAnchorRect ) {\n\t\t\t// Create a virtual element for the ref.\n\t\t\tresultingReferenceRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\tconst rect = getAnchorRect( anchorRefFallback.current );\n\t\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\t\trect.x ?? rect.left,\n\t\t\t\t\t\trect.y ?? rect.top,\n\t\t\t\t\t\trect.width ?? rect.right - rect.left,\n\t\t\t\t\t\trect.height ?? rect.bottom - rect.top\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( anchorRefFallback.current ) {\n\t\t\t// If no explicit ref is passed via props, fall back to\n\t\t\t// anchoring to the popover's parent node.\n\t\t\tresultingReferenceRef = anchorRefFallback.current.parentNode;\n\t\t}\n\n\t\tif ( ! resultingReferenceRef ) {\n\t\t\treturn;\n\t\t}\n\n\t\treference( resultingReferenceRef );\n\n\t\tif ( ! refs.floating.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn autoUpdate(\n\t\t\tresultingReferenceRef,\n\t\t\trefs.floating.current,\n\t\t\tupdate,\n\t\t\t{\n\t\t\t\tanimationFrame: true,\n\t\t\t}\n\t\t);\n\t\t// 'reference' and 'refs.floating' are refs and don't need to be listed\n\t\t// as dependencies (see https://github.com/WordPress/gutenberg/pull/41612)\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ anchorRef, anchorRect, getAnchorRect, update ] );\n\n\t// If the reference element is in a different ownerDocument (e.g. iFrame),\n\t// we need to manually update the floating's position as the reference's owner\n\t// document scrolls. Also update the frame offset if the view resizes.\n\tuseLayoutEffect( () => {\n\t\tconst referenceAndFloatingHaveSameDocument =\n\t\t\treferenceOwnerDocument === document;\n\t\tconst hasFrameElement =\n\t\t\t!! referenceOwnerDocument?.defaultView?.frameElement;\n\n\t\tif ( referenceAndFloatingHaveSameDocument || ! hasFrameElement ) {\n\t\t\tframeOffsetRef.current = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tconst { defaultView } = referenceOwnerDocument;\n\n\t\tconst updateFrameOffset = () => {\n\t\t\tframeOffsetRef.current = getFrameOffset( referenceOwnerDocument );\n\t\t\tupdate();\n\t\t};\n\t\tdefaultView.addEventListener( 'resize', updateFrameOffset );\n\n\t\tupdateFrameOffset();\n\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'resize', updateFrameOffset );\n\t\t};\n\t}, [ referenceOwnerDocument, update ] );\n\n\tconst mergedFloatingRef = useMergeRefs( [\n\t\tfloating,\n\t\tdialogRef,\n\t\tforwardedRef,\n\t] );\n\n\t// Disable reason: We care to capture the _bubbled_ events from inputs\n\t// within popover as inferring close intent.\n\n\tlet content = (\n\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<MaybeAnimatedWrapper\n\t\t\tshouldAnimate={ animate && ! isExpanded }\n\t\t\tplacement={ computedPlacement }\n\t\t\tclassName={ classnames( 'components-popover', className, {\n\t\t\t\t'is-expanded': isExpanded,\n\t\t\t\t'is-alternate': isAlternate,\n\t\t\t} ) }\n\t\t\t{ ...contentProps }\n\t\t\tref={ mergedFloatingRef }\n\t\t\t{ ...dialogProps }\n\t\t\ttabIndex=\"-1\"\n\t\t\tstyle={\n\t\t\t\tisExpanded\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tposition: strategy,\n\t\t\t\t\t\t\tleft: Number.isNaN( x ) ? 0 : x,\n\t\t\t\t\t\t\ttop: Number.isNaN( y ) ? 0 : y,\n\t\t\t\t\t }\n\t\t\t}\n\t\t>\n\t\t\t{ /* Prevents scroll on the document */ }\n\t\t\t{ isExpanded && <ScrollLock /> }\n\t\t\t{ isExpanded && (\n\t\t\t\t<div className=\"components-popover__header\">\n\t\t\t\t\t<span className=\"components-popover__header-title\">\n\t\t\t\t\t\t{ headerTitle }\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"components-popover__close\"\n\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"components-popover__content\">{ children }</div>\n\t\t\t{ hasArrow && (\n\t\t\t\t<div\n\t\t\t\t\tref={ arrowRef }\n\t\t\t\t\tclassName={ [\n\t\t\t\t\t\t'components-popover__arrow',\n\t\t\t\t\t\t`is-${ computedPlacement.split( '-' )[ 0 ] }`,\n\t\t\t\t\t].join( ' ' ) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tleft: Number.isFinite( arrowData?.x )\n\t\t\t\t\t\t\t? `${ arrowData.x }px`\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\ttop: Number.isFinite( arrowData?.y )\n\t\t\t\t\t\t\t? `${ arrowData.y }px`\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<ArrowTriangle />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</MaybeAnimatedWrapper>\n\t);\n\n\tif ( slot.ref ) {\n\t\tcontent = <Fill name={ slotName }>{ content }</Fill>;\n\t}\n\n\tif ( anchorRef || anchorRect ) {\n\t\treturn content;\n\t}\n\n\treturn <span ref={ anchorRefFallback }>{ content }</span>;\n};\n\nconst PopoverContainer = forwardRef( Popover );\n\nfunction PopoverSlot( { name = SLOT_NAME }, ref ) {\n\treturn (\n\t\t<Slot\n\t\t\tbubblesVirtually\n\t\t\tname={ name }\n\t\t\tclassName=\"popover-slot\"\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\nPopoverContainer.Slot = forwardRef( PopoverSlot );\nPopoverContainer.__unstableSlotNameProvider = slotNameContext.Provider;\n\nexport default PopoverContainer;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/popover/index.tsx"],"names":["classnames","useFloating","flip","flipMiddleware","shift","shiftMiddleware","autoUpdate","arrow","offset","offsetMiddleware","limitShift","size","motion","useReducedMotion","useRef","useLayoutEffect","forwardRef","createContext","useContext","useMemo","useState","useCallback","useEffect","useViewportMatch","useMergeRefs","__experimentalUseDialog","useDialog","close","deprecated","Path","SVG","Button","ScrollLock","Slot","Fill","useSlot","getFrameOffset","positionToPlacement","placementToMotionAnimationProps","getReferenceOwnerDocument","getReferenceElement","SLOT_NAME","ArrowTriangle","AnimatedWrapper","forwardedRef","style","receivedInlineStyles","placement","shouldAnimate","props","hasAnimatedOnce","setHasAnimatedOnce","shouldReduceMotion","motionInlineStyles","otherMotionProps","onAnimationComplete","computedAnimationProps","animate","slotNameContext","undefined","UnforwardedPopover","headerTitle","onClose","children","className","noArrow","isAlternate","position","placementProp","offsetProp","focusOnMount","anchor","expandOnMobile","onFocusOutside","__unstableSlotName","resize","__unstableForcePosition","__unstableShift","anchorRef","anchorRect","getAnchorRect","range","contentProps","since","version","computedFlipProp","computedResizeProp","alternative","shouldShift","arrowRef","fallbackReferenceElement","setFallbackReferenceElement","referenceOwnerDocument","setReferenceOwnerDocument","anchorRefFallback","node","isMobileViewport","isExpanded","hasArrow","normalizedPlacementFromProps","frameOffsetRef","offsetRef","middleware","currentPlacement","current","isTopBottomPlacement","includes","mainAxis","crossAxis","hasBeforePlacement","mainAxisModifier","apply","sizeProps","firstElementChild","refs","floating","HTMLElement","Object","assign","maxHeight","availableHeight","overflow","limiter","padding","element","filter","m","slotName","slot","onDialogClose","type","event","dialogRef","dialogProps","__unstableOnClose","x","y","reference","referenceCallbackRef","strategy","update","computedPlacement","middlewareData","arrowData","whileElementsMounted","referenceParam","floatingParam","updateParam","animationFrame","arrowCallbackRef","resultingReferenceOwnerDoc","fallbackDocument","document","resultingReferenceElement","top","bottom","startContainer","ownerDocument","defaultView","frameElement","updateFrameOffset","addEventListener","removeEventListener","mergedFloatingRef","content","left","Number","isNaN","split","join","isFinite","ref","Popover","PopoverSlot","name","__unstableSlotNameProvider","Provider"],"mappings":";;;AAAA;AACA;AACA;AAEA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SACCC,WADD,EAECC,IAAI,IAAIC,cAFT,EAGCC,KAAK,IAAIC,eAHV,EAICC,UA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AO,GAAG,cAAC,IAAD;AAAM,MAAA,IAAI,EAAGrC;AAAb,OAA0BqC,OAA1B,CAAV;AACA;;AAED,MAAKtF,SAAS,IAAIC,UAAb,IAA2BR,MAAhC,EAAyC;AACxC,WAAO6F,OAAP;AACA;;AAED,SAAO;AAAM,IAAA,GAAG,EAAGtE;AAAZ,KAAkCsE,OAAlC,CAAP;AACA,CA5ZD;AA8ZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMQ,OAAO,GAAG5J,UAAU,CAAE4C,kBAAF,CAA1B;;AAEP,SAASiH,WAAT,QAECF,GAFD,EAGE;AAAA,MAFD;AAAEG,IAAAA,IAAI,GAAGrI;AAAT,GAEC;AACD,SACC,cAAC,IAAD,CACC;AADD;AAEC,IAAA,gBAAgB,MAFjB;AAGC,IAAA,IAAI,EAAGqI,IAHR;AAIC,IAAA,SAAS,EAAC,cAJX;AAKC,IAAA,GAAG,EAAGH;AALP,IADD;AASA,C,CAED;;;AACAC,OAAO,CAAC3I,IAAR,GAAejB,UAAU,CAAE6J,WAAF,CAAzB,C,CACA;;AACAD,OAAO,CAACG,0BAAR,GAAqCrH,eAAe,CAACsH,QAArD;AAEA,eAAeJ,OAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, SyntheticEvent, RefCallback } from 'react';\nimport classnames from 'classnames';\nimport {\n\tuseFloating,\n\tflip as flipMiddleware,\n\tshift as shiftMiddleware,\n\tautoUpdate,\n\tarrow,\n\toffset as offsetMiddleware,\n\tlimitShift,\n\tsize,\n\tMiddleware,\n} from '@floating-ui/react-dom';\n// eslint-disable-next-line no-restricted-imports\nimport {\n\tmotion,\n\tuseReducedMotion,\n\tHTMLMotionProps,\n\tMotionProps,\n} from 'framer-motion';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n\tuseMemo,\n\tuseState,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\nimport {\n\tuseViewportMatch,\n\tuseMergeRefs,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { close } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\nimport { Path, SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport ScrollLock from '../scroll-lock';\nimport { Slot, Fill, useSlot } from '../slot-fill';\nimport {\n\tgetFrameOffset,\n\tpositionToPlacement,\n\tplacementToMotionAnimationProps,\n\tgetReferenceOwnerDocument,\n\tgetReferenceElement,\n} from './utils';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type {\n\tPopoverProps,\n\tAnimatedWrapperProps,\n\tPopoverAnchorRefReference,\n\tPopoverAnchorRefTopBottom,\n} from './types';\n\n/**\n * Name of slot in which popover should fill.\n *\n * @type {string}\n */\nconst SLOT_NAME = 'Popover';\n\n// An SVG displaying a triangle facing down, filled with a solid\n// color and bordered in such a way to create an arrow-like effect.\n// Keeping the SVG's viewbox squared simplify the arrow positioning\n// calculations.\nconst ArrowTriangle = () => (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox={ `0 0 100 100` }\n\t\tclassName=\"components-popover__triangle\"\n\t\trole=\"presentation\"\n\t>\n\t\t<Path\n\t\t\tclassName=\"components-popover__triangle-bg\"\n\t\t\td=\"M 0 0 L 50 50 L 100 0\"\n\t\t/>\n\t\t<Path\n\t\t\tclassName=\"components-popover__triangle-border\"\n\t\t\td=\"M 0 0 L 50 50 L 100 0\"\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t/>\n\t</SVG>\n);\n\nconst AnimatedWrapper = forwardRef(\n\t(\n\t\t{\n\t\t\tstyle: receivedInlineStyles,\n\t\t\tplacement,\n\t\t\tshouldAnimate = false,\n\t\t\t...props\n\t\t}: HTMLMotionProps< 'div' > & AnimatedWrapperProps,\n\t\tforwardedRef: ForwardedRef< any >\n\t) => {\n\t\t// When animating, animate only once (i.e. when the popover is opened), and\n\t\t// do not animate on subsequent prop changes (as it conflicts with\n\t\t// floating-ui's positioning updates).\n\t\tconst [ hasAnimatedOnce, setHasAnimatedOnce ] = useState( false );\n\t\tconst shouldReduceMotion = useReducedMotion();\n\n\t\tconst { style: motionInlineStyles, ...otherMotionProps } = useMemo(\n\t\t\t() => placementToMotionAnimationProps( placement ),\n\t\t\t[ placement ]\n\t\t);\n\n\t\tconst onAnimationComplete = useCallback(\n\t\t\t() => setHasAnimatedOnce( true ),\n\t\t\t[]\n\t\t);\n\n\t\tconst computedAnimationProps: HTMLMotionProps< 'div' > =\n\t\t\tshouldAnimate && ! shouldReduceMotion\n\t\t\t\t? {\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...motionInlineStyles,\n\t\t\t\t\t\t\t...receivedInlineStyles,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t...otherMotionProps,\n\t\t\t\t\t\tonAnimationComplete,\n\t\t\t\t\t\tanimate: hasAnimatedOnce\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: otherMotionProps.animate,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tanimate: false,\n\t\t\t\t\t\tstyle: receivedInlineStyles,\n\t\t\t\t };\n\n\t\treturn (\n\t\t\t<motion.div\n\t\t\t\t{ ...computedAnimationProps }\n\t\t\t\t{ ...props }\n\t\t\t\tref={ forwardedRef }\n\t\t\t/>\n\t\t);\n\t}\n);\n\nconst slotNameContext = createContext< string | undefined >( undefined );\n\nconst UnforwardedPopover = (\n\tprops: Omit<\n\t\tWordPressComponentProps< PopoverProps, 'div', false >,\n\t\t// To avoid overlaps between the standard HTML attributes and the props\n\t\t// expected by `framer-motion`, omit all framer motion props from popover\n\t\t// props (except for `animate`, which is re-defined in `PopoverProps`).\n\t\tkeyof Omit< MotionProps, 'animate' >\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tanimate = true,\n\t\theaderTitle,\n\t\tonClose,\n\t\tchildren,\n\t\tclassName,\n\t\tnoArrow = true,\n\t\tisAlternate,\n\t\tposition,\n\t\tplacement: placementProp = 'bottom-start',\n\t\toffset: offsetProp = 0,\n\t\tfocusOnMount = 'firstElement',\n\t\tanchor,\n\t\texpandOnMobile,\n\t\tonFocusOutside,\n\t\t__unstableSlotName = SLOT_NAME,\n\t\tflip = true,\n\t\tresize = true,\n\t\tshift = false,\n\n\t\t// Deprecated props\n\t\t__unstableForcePosition,\n\t\t__unstableShift,\n\t\tanchorRef,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\trange,\n\n\t\t// Rest\n\t\t...contentProps\n\t} = props;\n\n\tif ( range ) {\n\t\tdeprecated( '`range` prop in wp.components.Popover', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t} );\n\t}\n\n\tlet computedFlipProp = flip;\n\tlet computedResizeProp = resize;\n\tif ( __unstableForcePosition !== undefined ) {\n\t\tdeprecated( '`__unstableForcePosition` prop wp.components.Popover', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t\talternative: '`flip={ false }` and `resize={ false }`',\n\t\t} );\n\n\t\t// Back-compat, set the `flip` and `resize` props\n\t\t// to `false` to replicate `__unstableForcePosition`.\n\t\tcomputedFlipProp = ! __unstableForcePosition;\n\t\tcomputedResizeProp = ! __unstableForcePosition;\n\t}\n\n\tlet shouldShift = shift;\n\tif ( __unstableShift !== undefined ) {\n\t\tdeprecated( '`__unstableShift` prop in wp.components.Popover', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t\talternative: '`shift` prop`',\n\t\t} );\n\n\t\t// Back-compat.\n\t\tshouldShift = __unstableShift;\n\t}\n\n\tif ( anchorRef !== undefined ) {\n\t\tdeprecated( '`anchorRef` prop in wp.components.Popover', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t\talternative: '`anchor` prop',\n\t\t} );\n\t}\n\n\tif ( anchorRect !== undefined ) {\n\t\tdeprecated( '`anchorRect` prop in wp.components.Popover', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t\talternative: '`anchor` prop',\n\t\t} );\n\t}\n\n\tif ( getAnchorRect !== undefined ) {\n\t\tdeprecated( '`getAnchorRect` prop in wp.components.Popover', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t\talternative: '`anchor` prop',\n\t\t} );\n\t}\n\n\tconst arrowRef = useRef( null );\n\n\tconst [ fallbackReferenceElement, setFallbackReferenceElement ] =\n\t\tuseState< HTMLSpanElement | null >( null );\n\tconst [ referenceOwnerDocument, setReferenceOwnerDocument ] = useState<\n\t\tDocument | undefined\n\t>();\n\n\tconst anchorRefFallback: RefCallback< HTMLSpanElement > = useCallback(\n\t\t( node ) => {\n\t\t\tsetFallbackReferenceElement( node );\n\t\t},\n\t\t[]\n\t);\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isExpanded = expandOnMobile && isMobileViewport;\n\tconst hasArrow = ! isExpanded && ! noArrow;\n\tconst normalizedPlacementFromProps = position\n\t\t? positionToPlacement( position )\n\t\t: placementProp;\n\n\t/**\n\t * Offsets the position of the popover when the anchor is inside an iframe.\n\t *\n\t * Store the offset in a ref, due to constraints with floating-ui:\n\t * https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.\n\t */\n\tconst frameOffsetRef = useRef( getFrameOffset( referenceOwnerDocument ) );\n\t/**\n\t * Store the offset prop in a ref, due to constraints with floating-ui:\n\t * https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.\n\t */\n\tconst offsetRef = useRef( offsetProp );\n\n\tconst middleware = [\n\t\toffsetMiddleware( ( { placement: currentPlacement } ) => {\n\t\t\tif ( ! frameOffsetRef.current ) {\n\t\t\t\treturn offsetRef.current;\n\t\t\t}\n\n\t\t\tconst isTopBottomPlacement =\n\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\tcurrentPlacement.includes( 'bottom' );\n\n\t\t\t// The main axis should represent the gap between the\n\t\t\t// floating element and the reference element. The cross\n\t\t\t// axis is always perpendicular to the main axis.\n\t\t\tconst mainAxis = isTopBottomPlacement ? 'y' : 'x';\n\t\t\tconst crossAxis = mainAxis === 'x' ? 'y' : 'x';\n\n\t\t\t// When the popover is before the reference, subtract the offset,\n\t\t\t// of the main axis else add it.\n\t\t\tconst hasBeforePlacement =\n\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\tcurrentPlacement.includes( 'left' );\n\t\t\tconst mainAxisModifier = hasBeforePlacement ? -1 : 1;\n\n\t\t\treturn {\n\t\t\t\tmainAxis:\n\t\t\t\t\toffsetRef.current +\n\t\t\t\t\tframeOffsetRef.current[ mainAxis ] * mainAxisModifier,\n\t\t\t\tcrossAxis: frameOffsetRef.current[ crossAxis ],\n\t\t\t};\n\t\t} ),\n\t\tcomputedFlipProp ? flipMiddleware() : undefined,\n\t\tcomputedResizeProp\n\t\t\t? size( {\n\t\t\t\t\tapply( sizeProps ) {\n\t\t\t\t\t\tconst { firstElementChild } =\n\t\t\t\t\t\t\trefs.floating.current ?? {};\n\n\t\t\t\t\t\t// Only HTMLElement instances have the `style` property.\n\t\t\t\t\t\tif ( ! ( firstElementChild instanceof HTMLElement ) )\n\t\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\t// Reduce the height of the popover to the available space.\n\t\t\t\t\t\tObject.assign( firstElementChild.style, {\n\t\t\t\t\t\t\tmaxHeight: `${ sizeProps.availableHeight }px`,\n\t\t\t\t\t\t\toverflow: 'auto',\n\t\t\t\t\t\t} );\n\t\t\t\t\t},\n\t\t\t } )\n\t\t\t: undefined,\n\t\tshouldShift\n\t\t\t? shiftMiddleware( {\n\t\t\t\t\tcrossAxis: true,\n\t\t\t\t\tlimiter: limitShift(),\n\t\t\t\t\tpadding: 1, // Necessary to avoid flickering at the edge of the viewport.\n\t\t\t } )\n\t\t\t: undefined,\n\t\tarrow( { element: arrowRef } ),\n\t].filter(\n\t\t( m: Middleware | undefined ): m is Middleware => m !== undefined\n\t);\n\tconst slotName = useContext( slotNameContext ) || __unstableSlotName;\n\tconst slot = useSlot( slotName );\n\n\tlet onDialogClose;\n\n\tif ( onClose || onFocusOutside ) {\n\t\tonDialogClose = ( type: string | undefined, event: SyntheticEvent ) => {\n\t\t\t// Ideally the popover should have just a single onClose prop and\n\t\t\t// not three props that potentially do the same thing.\n\t\t\tif ( type === 'focus-outside' && onFocusOutside ) {\n\t\t\t\tonFocusOutside( event );\n\t\t\t} else if ( onClose ) {\n\t\t\t\tonClose();\n\t\t\t}\n\t\t};\n\t}\n\n\tconst [ dialogRef, dialogProps ] = useDialog( {\n\t\tfocusOnMount,\n\t\t__unstableOnClose: onDialogClose,\n\t\t// @ts-expect-error The __unstableOnClose property needs to be deprecated first (see https://github.com/WordPress/gutenberg/pull/27675)\n\t\tonClose: onDialogClose,\n\t} );\n\n\tconst {\n\t\t// Positioning coordinates\n\t\tx,\n\t\ty,\n\t\t// Callback refs (not regular refs). This allows the position to be updated.\n\t\t// when either elements change.\n\t\treference: referenceCallbackRef,\n\t\tfloating,\n\t\t// Object with \"regular\" refs to both \"reference\" and \"floating\"\n\t\trefs,\n\t\t// Type of CSS position property to use (absolute or fixed)\n\t\tstrategy,\n\t\tupdate,\n\t\tplacement: computedPlacement,\n\t\tmiddlewareData: { arrow: arrowData },\n\t} = useFloating( {\n\t\tplacement: normalizedPlacementFromProps,\n\t\tmiddleware,\n\t\twhileElementsMounted: ( referenceParam, floatingParam, updateParam ) =>\n\t\t\tautoUpdate( referenceParam, floatingParam, updateParam, {\n\t\t\t\tanimationFrame: true,\n\t\t\t} ),\n\t} );\n\n\tuseEffect( () => {\n\t\toffsetRef.current = offsetProp;\n\t\tupdate();\n\t}, [ offsetProp, update ] );\n\n\tconst arrowCallbackRef = useCallback(\n\t\t( node ) => {\n\t\t\tarrowRef.current = node;\n\t\t\tupdate();\n\t\t},\n\t\t[ update ]\n\t);\n\n\t// When any of the possible anchor \"sources\" change,\n\t// recompute the reference element (real or virtual) and its owner document.\n\tuseLayoutEffect( () => {\n\t\tconst resultingReferenceOwnerDoc = getReferenceOwnerDocument( {\n\t\t\tanchor,\n\t\t\tanchorRef,\n\t\t\tanchorRect,\n\t\t\tgetAnchorRect,\n\t\t\tfallbackReferenceElement,\n\t\t\tfallbackDocument: document,\n\t\t} );\n\t\tconst resultingReferenceElement = getReferenceElement( {\n\t\t\tanchor,\n\t\t\tanchorRef,\n\t\t\tanchorRect,\n\t\t\tgetAnchorRect,\n\t\t\tfallbackReferenceElement,\n\t\t} );\n\n\t\treferenceCallbackRef( resultingReferenceElement );\n\n\t\tsetReferenceOwnerDocument( resultingReferenceOwnerDoc );\n\t}, [\n\t\tanchor,\n\t\tanchorRef as Element | undefined,\n\t\t( anchorRef as PopoverAnchorRefTopBottom | undefined )?.top,\n\t\t( anchorRef as PopoverAnchorRefTopBottom | undefined )?.bottom,\n\t\t( anchorRef as Range | undefined )?.startContainer,\n\t\t( anchorRef as PopoverAnchorRefReference )?.current,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\tfallbackReferenceElement,\n\t\treferenceCallbackRef,\n\t] );\n\n\t// If the reference element is in a different ownerDocument (e.g. iFrame),\n\t// we need to manually update the floating's position as the reference's owner\n\t// document scrolls. Also update the frame offset if the view resizes.\n\tuseLayoutEffect( () => {\n\t\tif (\n\t\t\t// Reference and root documents are the same.\n\t\t\treferenceOwnerDocument === document ||\n\t\t\t// Reference and floating are in the same document.\n\t\t\treferenceOwnerDocument === refs?.floating?.current?.ownerDocument ||\n\t\t\t// The reference's document has no view (i.e. window)\n\t\t\t// or frame element (ie. it's not an iframe).\n\t\t\t! referenceOwnerDocument?.defaultView?.frameElement\n\t\t) {\n\t\t\tframeOffsetRef.current = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tconst { defaultView } = referenceOwnerDocument;\n\n\t\tconst updateFrameOffset = () => {\n\t\t\tframeOffsetRef.current = getFrameOffset( referenceOwnerDocument );\n\t\t\tupdate();\n\t\t};\n\t\tdefaultView.addEventListener( 'resize', updateFrameOffset );\n\n\t\tupdateFrameOffset();\n\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'resize', updateFrameOffset );\n\t\t};\n\t}, [ referenceOwnerDocument, update ] );\n\n\tconst mergedFloatingRef = useMergeRefs( [\n\t\tfloating,\n\t\tdialogRef,\n\t\tforwardedRef,\n\t] );\n\n\t// Disable reason: We care to capture the _bubbled_ events from inputs\n\t// within popover as inferring close intent.\n\n\tlet content = (\n\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<AnimatedWrapper\n\t\t\tshouldAnimate={ animate && ! isExpanded }\n\t\t\tplacement={ computedPlacement }\n\t\t\tclassName={ classnames( 'components-popover', className, {\n\t\t\t\t'is-expanded': isExpanded,\n\t\t\t\t'is-alternate': isAlternate,\n\t\t\t} ) }\n\t\t\t{ ...contentProps }\n\t\t\tref={ mergedFloatingRef }\n\t\t\t{ ...dialogProps }\n\t\t\ttabIndex={ -1 }\n\t\t\tstyle={\n\t\t\t\tisExpanded\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tposition: strategy,\n\t\t\t\t\t\t\tleft: Number.isNaN( x ) ? 0 : x ?? undefined,\n\t\t\t\t\t\t\ttop: Number.isNaN( y ) ? 0 : y ?? undefined,\n\t\t\t\t\t }\n\t\t\t}\n\t\t>\n\t\t\t{ /* Prevents scroll on the document */ }\n\t\t\t{ isExpanded && <ScrollLock /> }\n\t\t\t{ isExpanded && (\n\t\t\t\t<div className=\"components-popover__header\">\n\t\t\t\t\t<span className=\"components-popover__header-title\">\n\t\t\t\t\t\t{ headerTitle }\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"components-popover__close\"\n\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"components-popover__content\">{ children }</div>\n\t\t\t{ hasArrow && (\n\t\t\t\t<div\n\t\t\t\t\tref={ arrowCallbackRef }\n\t\t\t\t\tclassName={ [\n\t\t\t\t\t\t'components-popover__arrow',\n\t\t\t\t\t\t`is-${ computedPlacement.split( '-' )[ 0 ] }`,\n\t\t\t\t\t].join( ' ' ) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tleft:\n\t\t\t\t\t\t\ttypeof arrowData?.x !== 'undefined' &&\n\t\t\t\t\t\t\tNumber.isFinite( arrowData.x )\n\t\t\t\t\t\t\t\t? `${\n\t\t\t\t\t\t\t\t\t\tarrowData.x +\n\t\t\t\t\t\t\t\t\t\t( frameOffsetRef.current?.x ?? 0 )\n\t\t\t\t\t\t\t\t }px`\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\ttop:\n\t\t\t\t\t\t\ttypeof arrowData?.y !== 'undefined' &&\n\t\t\t\t\t\t\tNumber.isFinite( arrowData.y )\n\t\t\t\t\t\t\t\t? `${\n\t\t\t\t\t\t\t\t\t\tarrowData.y +\n\t\t\t\t\t\t\t\t\t\t( frameOffsetRef.current?.y ?? 0 )\n\t\t\t\t\t\t\t\t }px`\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<ArrowTriangle />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</AnimatedWrapper>\n\t);\n\n\tif ( slot.ref ) {\n\t\tcontent = <Fill name={ slotName }>{ content }</Fill>;\n\t}\n\n\tif ( anchorRef || anchorRect || anchor ) {\n\t\treturn content;\n\t}\n\n\treturn <span ref={ anchorRefFallback }>{ content }</span>;\n};\n\n/**\n * `Popover` renders its content in a floating modal. If no explicit anchor is passed via props, it anchors to its parent element by default.\n *\n * ```jsx\n * import { Button, Popover } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyPopover = () => {\n * \tconst [ isVisible, setIsVisible ] = useState( false );\n * \tconst toggleVisible = () => {\n * \t\tsetIsVisible( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<Button variant=\"secondary\" onClick={ toggleVisible }>\n * \t\t\tToggle Popover!\n * \t\t\t{ isVisible && <Popover>Popover is toggled!</Popover> }\n * \t\t</Button>\n * \t);\n * };\n * ```\n *\n */\nexport const Popover = forwardRef( UnforwardedPopover );\n\nfunction PopoverSlot(\n\t{ name = SLOT_NAME }: { name?: string },\n\tref: ForwardedRef< any >\n) {\n\treturn (\n\t\t<Slot\n\t\t\t// @ts-expect-error Need to type `SlotFill`\n\t\t\tbubblesVirtually\n\t\t\tname={ name }\n\t\t\tclassName=\"popover-slot\"\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\n// @ts-expect-error For Legacy Reasons\nPopover.Slot = forwardRef( PopoverSlot );\n// @ts-expect-error For Legacy Reasons\nPopover.__unstableSlotNameProvider = slotNameContext.Provider;\n\nexport default Popover;\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -1,15 +1,18 @@
1
1
  /**
2
- * @typedef {import('../animate').AppearOrigin} AppearOrigin
3
- * @typedef {import('@floating-ui/react-dom').Placement} FloatingUIPlacement
4
- * @typedef { 'top left' | 'top center' | 'top right' | 'middle left' | 'middle center' | 'middle right' | 'bottom left' | 'bottom center' | 'bottom right' | 'bottom left' | 'bottom center' | 'bottom right' } LegacyPosition
2
+ * External dependencies
3
+ */
4
+ // eslint-disable-next-line no-restricted-imports
5
+
6
+ /**
7
+ * Internal dependencies
5
8
  */
6
9
 
7
10
  /**
8
11
  * Converts the `Popover`'s legacy "position" prop to the new "placement" prop
9
12
  * (used by `floating-ui`).
10
13
  *
11
- * @param {LegacyPosition} position The legacy position
12
- * @return {FloatingUIPlacement} The corresponding placement
14
+ * @param position The legacy position
15
+ * @return The corresponding placement
13
16
  */
14
17
  export const positionToPlacement = position => {
15
18
  const [x, y, z] = position.split(' ');
@@ -21,12 +24,10 @@ export const positionToPlacement = position => {
21
24
  suffix = '-start';
22
25
  } else if (!!z && z === 'right' || y === 'left') {
23
26
  suffix = '-end';
24
- } // @ts-expect-error More TypeScript effort would be required to reconcile `string` and `Placement` types.
25
-
27
+ }
26
28
 
27
29
  return x + suffix;
28
- } // @ts-expect-error More TypeScript effort would be required to reconcile `string` and `Placement` types.
29
-
30
+ }
30
31
 
31
32
  return y;
32
33
  };
@@ -37,8 +38,6 @@ export const positionToPlacement = position => {
37
38
  * @property {number} originY A number between 0 and 1 (0 is top, 0.5 is center, and 1 is bottom)
38
39
  */
39
40
 
40
- /** @type {Object.<FloatingUIPlacement, {originX: number, originY: number}>} */
41
-
42
41
  const PLACEMENT_TO_ANIMATION_ORIGIN = {
43
42
  top: {
44
43
  originX: 0.5,
@@ -105,8 +104,8 @@ const PLACEMENT_TO_ANIMATION_ORIGIN = {
105
104
  * Given the floating-ui `placement`, compute the framer-motion props for the
106
105
  * popover's entry animation.
107
106
  *
108
- * @param {FloatingUIPlacement} placement A placement string from floating ui
109
- * @return {import('framer-motion').MotionProps} The object containing the motion props
107
+ * @param placement A placement string from floating ui
108
+ * @return The object containing the motion props
110
109
  */
111
110
 
112
111
  export const placementToMotionAnimationProps = placement => {
@@ -130,20 +129,13 @@ export const placementToMotionAnimationProps = placement => {
130
129
  }
131
130
  };
132
131
  };
133
- /**
134
- * @typedef FrameOffset
135
- * @type {Object}
136
- * @property {number} x A numerical value representing the horizontal offset of the frame.
137
- * @property {number} y A numerical value representing the vertical offset of the frame.
138
- */
139
-
140
132
  /**
141
133
  * Returns the offset of a document's frame element.
142
134
  *
143
- * @param {Document} document A document. This will usually be the document within an iframe.
135
+ * @param document The iframe's owner document.
144
136
  *
145
- * @return {FrameOffset|undefined} The offset of the document's frame element,
146
- * or undefined if the document has no frame element.
137
+ * @return The offset of the document's frame element, or undefined if the
138
+ * document has no frame element.
147
139
  */
148
140
 
149
141
  export const getFrameOffset = document => {
@@ -161,4 +153,107 @@ export const getFrameOffset = document => {
161
153
  y: iframeRect.top
162
154
  };
163
155
  };
156
+ export const getReferenceOwnerDocument = _ref => {
157
+ var _resultingReferenceOw;
158
+
159
+ let {
160
+ anchor,
161
+ anchorRef,
162
+ anchorRect,
163
+ getAnchorRect,
164
+ fallbackReferenceElement,
165
+ fallbackDocument
166
+ } = _ref;
167
+ // In floating-ui's terms:
168
+ // - "reference" refers to the popover's anchor element.
169
+ // - "floating" refers the floating popover's element.
170
+ // A floating element can also be positioned relative to a virtual element,
171
+ // instead of a real one. A virtual element is represented by an object
172
+ // with the `getBoundingClientRect()` function (like real elements).
173
+ // See https://floating-ui.com/docs/virtual-elements for more info.
174
+ let resultingReferenceOwnerDoc;
175
+
176
+ if (anchor) {
177
+ resultingReferenceOwnerDoc = anchor.ownerDocument;
178
+ } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
179
+ resultingReferenceOwnerDoc = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.top.ownerDocument;
180
+ } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.startContainer) {
181
+ resultingReferenceOwnerDoc = anchorRef.startContainer.ownerDocument;
182
+ } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
183
+ resultingReferenceOwnerDoc = anchorRef.current.ownerDocument;
184
+ } else if (anchorRef) {
185
+ // This one should be deprecated.
186
+ resultingReferenceOwnerDoc = anchorRef.ownerDocument;
187
+ } else if (anchorRect && anchorRect !== null && anchorRect !== void 0 && anchorRect.ownerDocument) {
188
+ resultingReferenceOwnerDoc = anchorRect.ownerDocument;
189
+ } else if (getAnchorRect) {
190
+ var _getAnchorRect;
191
+
192
+ resultingReferenceOwnerDoc = (_getAnchorRect = getAnchorRect(fallbackReferenceElement)) === null || _getAnchorRect === void 0 ? void 0 : _getAnchorRect.ownerDocument;
193
+ }
194
+
195
+ return (_resultingReferenceOw = resultingReferenceOwnerDoc) !== null && _resultingReferenceOw !== void 0 ? _resultingReferenceOw : fallbackDocument;
196
+ };
197
+ export const getReferenceElement = _ref2 => {
198
+ var _referenceElement;
199
+
200
+ let {
201
+ anchor,
202
+ anchorRef,
203
+ anchorRect,
204
+ getAnchorRect,
205
+ fallbackReferenceElement
206
+ } = _ref2;
207
+ let referenceElement = null;
208
+
209
+ if (anchor) {
210
+ referenceElement = anchor;
211
+ } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
212
+ // Create a virtual element for the ref. The expectation is that
213
+ // if anchorRef.top is defined, then anchorRef.bottom is defined too.
214
+ // Seems to be used by the block toolbar, when multiple blocks are selected
215
+ // (top and bottom blocks are used to calculate the resulting rect).
216
+ referenceElement = {
217
+ getBoundingClientRect() {
218
+ const topRect = anchorRef.top.getBoundingClientRect();
219
+ const bottomRect = anchorRef.bottom.getBoundingClientRect();
220
+ return new window.DOMRect(topRect.x, topRect.y, topRect.width, bottomRect.bottom - topRect.top);
221
+ }
222
+
223
+ };
224
+ } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
225
+ // Standard React ref.
226
+ referenceElement = anchorRef.current;
227
+ } else if (anchorRef) {
228
+ // If `anchorRef` holds directly the element's value (no `current` key)
229
+ // This is a weird scenario and should be deprecated.
230
+ referenceElement = anchorRef;
231
+ } else if (anchorRect) {
232
+ // Create a virtual element for the ref.
233
+ referenceElement = {
234
+ getBoundingClientRect() {
235
+ return anchorRect;
236
+ }
237
+
238
+ };
239
+ } else if (getAnchorRect) {
240
+ // Create a virtual element for the ref.
241
+ referenceElement = {
242
+ getBoundingClientRect() {
243
+ var _rect$x, _rect$y, _rect$width, _rect$height;
244
+
245
+ const rect = getAnchorRect(fallbackReferenceElement);
246
+ return new window.DOMRect((_rect$x = rect.x) !== null && _rect$x !== void 0 ? _rect$x : rect.left, (_rect$y = rect.y) !== null && _rect$y !== void 0 ? _rect$y : rect.top, (_rect$width = rect.width) !== null && _rect$width !== void 0 ? _rect$width : rect.right - rect.left, (_rect$height = rect.height) !== null && _rect$height !== void 0 ? _rect$height : rect.bottom - rect.top);
247
+ }
248
+
249
+ };
250
+ } else if (fallbackReferenceElement) {
251
+ // If no explicit ref is passed via props, fall back to
252
+ // anchoring to the popover's parent node.
253
+ referenceElement = fallbackReferenceElement.parentElement;
254
+ } // Convert any `undefined` value to `null`.
255
+
256
+
257
+ return (_referenceElement = referenceElement) !== null && _referenceElement !== void 0 ? _referenceElement : null;
258
+ };
164
259
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/popover/utils.js"],"names":["positionToPlacement","position","x","y","z","split","includes","suffix","PLACEMENT_TO_ANIMATION_ORIGIN","top","originX","originY","right","bottom","left","placementToMotionAnimationProps","placement","translateProp","startsWith","translateDirection","style","initial","opacity","scale","animate","transition","duration","ease","getFrameOffset","document","frameElement","defaultView","iframeRect","getBoundingClientRect"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,mBAAmB,GAAKC,QAAF,IAAgB;AAClD,QAAM,CAAEC,CAAF,EAAKC,CAAL,EAAQC,CAAR,IAAcH,QAAQ,CAACI,KAAT,CAAgB,GAAhB,CAApB;;AAEA,MAAK,CAAE,KAAF,EAAS,QAAT,EAAoBC,QAApB,CAA8BJ,CAA9B,CAAL,EAAyC;AACxC,QAAIK,MAAM,GAAG,EAAb;;AACA,QAAO,CAAC,CAAEH,CAAH,IAAQA,CAAC,KAAK,MAAhB,IAA4BD,CAAC,KAAK,OAAvC,EAAiD;AAChDI,MAAAA,MAAM,GAAG,QAAT;AACA,KAFD,MAEO,IAAO,CAAC,CAAEH,CAAH,IAAQA,CAAC,KAAK,OAAhB,IAA6BD,CAAC,KAAK,MAAxC,EAAiD;AACvDI,MAAAA,MAAM,GAAG,MAAT;AACA,KANuC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;;AACD,QAAME,UAAU,GAAGF,YAAY,CAACG,qBAAb,EAAnB;AACA,SAAO;AAAE/B,IAAAA,CAAC,EAAE8B,UAAU,CAAClB,IAAhB;AAAsBX,IAAAA,CAAC,EAAE6B,UAAU,CAACvB;AAApC,GAAP;AACA,CAPM","sourcesContent":["/**\n * @typedef {import('../animate').AppearOrigin} AppearOrigin\n * @typedef {import('@floating-ui/react-dom').Placement} FloatingUIPlacement\n * @typedef {\t'top left' | 'top center' | 'top right' | 'middle left' | 'middle center' | 'middle right' | 'bottom left' | 'bottom center' | 'bottom right' | 'bottom left' | 'bottom center' | 'bottom right' } LegacyPosition\n */\n\n/**\n * Converts the `Popover`'s legacy \"position\" prop to the new \"placement\" prop\n * (used by `floating-ui`).\n *\n * @param {LegacyPosition} position The legacy position\n * @return {FloatingUIPlacement} The corresponding placement\n */\nexport const positionToPlacement = ( position ) => {\n\tconst [ x, y, z ] = position.split( ' ' );\n\n\tif ( [ 'top', 'bottom' ].includes( x ) ) {\n\t\tlet suffix = '';\n\t\tif ( ( !! z && z === 'left' ) || y === 'right' ) {\n\t\t\tsuffix = '-start';\n\t\t} else if ( ( !! z && z === 'right' ) || y === 'left' ) {\n\t\t\tsuffix = '-end';\n\t\t}\n\n\t\t// @ts-expect-error More TypeScript effort would be required to reconcile `string` and `Placement` types.\n\t\treturn x + suffix;\n\t}\n\n\t// @ts-expect-error More TypeScript effort would be required to reconcile `string` and `Placement` types.\n\treturn y;\n};\n\n/**\n * @typedef AnimationOrigin\n * @type {Object}\n * @property {number} originX A number between 0 and 1 (in CSS logical properties jargon, 0 is \"start\", 0.5 is \"center\", and 1 is \"end\")\n * @property {number} originY A number between 0 and 1 (0 is top, 0.5 is center, and 1 is bottom)\n */\n\n/** @type {Object.<FloatingUIPlacement, {originX: number, originY: number}>} */\nconst PLACEMENT_TO_ANIMATION_ORIGIN = {\n\ttop: { originX: 0.5, originY: 1 }, // open from bottom, center\n\t'top-start': { originX: 0, originY: 1 }, // open from bottom, left\n\t'top-end': { originX: 1, originY: 1 }, // open from bottom, right\n\tright: { originX: 0, originY: 0.5 }, // open from middle, left\n\t'right-start': { originX: 0, originY: 0 }, // open from top, left\n\t'right-end': { originX: 0, originY: 1 }, // open from bottom, left\n\tbottom: { originX: 0.5, originY: 0 }, // open from top, center\n\t'bottom-start': { originX: 0, originY: 0 }, // open from top, left\n\t'bottom-end': { originX: 1, originY: 0 }, // open from top, right\n\tleft: { originX: 1, originY: 0.5 }, // open from middle, right\n\t'left-start': { originX: 1, originY: 0 }, // open from top, right\n\t'left-end': { originX: 1, originY: 1 }, // open from bottom, right\n};\n\n/**\n * Given the floating-ui `placement`, compute the framer-motion props for the\n * popover's entry animation.\n *\n * @param {FloatingUIPlacement} placement A placement string from floating ui\n * @return {import('framer-motion').MotionProps} The object containing the motion props\n */\nexport const placementToMotionAnimationProps = ( placement ) => {\n\tconst translateProp =\n\t\tplacement.startsWith( 'top' ) || placement.startsWith( 'bottom' )\n\t\t\t? 'translateY'\n\t\t\t: 'translateX';\n\tconst translateDirection =\n\t\tplacement.startsWith( 'top' ) || placement.startsWith( 'left' )\n\t\t\t? 1\n\t\t\t: -1;\n\n\treturn {\n\t\tstyle: PLACEMENT_TO_ANIMATION_ORIGIN[ placement ],\n\t\tinitial: {\n\t\t\topacity: 0,\n\t\t\tscale: 0,\n\t\t\t[ translateProp ]: `${ 2 * translateDirection }em`,\n\t\t},\n\t\tanimate: { opacity: 1, scale: 1, [ translateProp ]: 0 },\n\t\ttransition: { duration: 0.1, ease: [ 0, 0, 0.2, 1 ] },\n\t};\n};\n\n/**\n * @typedef FrameOffset\n * @type {Object}\n * @property {number} x A numerical value representing the horizontal offset of the frame.\n * @property {number} y A numerical value representing the vertical offset of the frame.\n */\n\n/**\n * Returns the offset of a document's frame element.\n *\n * @param {Document} document A document. This will usually be the document within an iframe.\n *\n * @return {FrameOffset|undefined} The offset of the document's frame element,\n * or undefined if the document has no frame element.\n */\nexport const getFrameOffset = ( document ) => {\n\tconst frameElement = document?.defaultView?.frameElement;\n\tif ( ! frameElement ) {\n\t\treturn;\n\t}\n\tconst iframeRect = frameElement.getBoundingClientRect();\n\treturn { x: iframeRect.left, y: iframeRect.top };\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/popover/utils.ts"],"names":["positionToPlacement","position","x","y","z","split","includes","suffix","PLACEMENT_TO_ANIMATION_ORIGIN","top","originX","originY","right","bottom","left","placementToMotionAnimationProps","placement","translateProp","startsWith","translateDirection","style","initial","opacity","scale","animate","transition","duration","ease","getFrameOffset","document","frameElement","defaultView","iframeRect","getBoundingClientRect","getReferenceOwnerDocument","anchor","anchorRef","anchorRect","getAnchorRect","fallbackReferenceElement","fallbackDocument","resultingReferenceOwnerDoc","ownerDocument","startContainer","current","getReferenceElement","referenceElement","topRect","bottomRect","window","DOMRect","width","rect","height","parentElement"],"mappings":"AAAA;AACA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,mBAAmB,GAC/BC,QADkC,IAEc;AAChD,QAAM,CAAEC,CAAF,EAAKC,CAAL,EAAQC,CAAR,IAAcH,QAAQ,CAACI,KAAT,CAAgB,GAAhB,CAApB;;AAEA,MAAK,CAAE,KAAF,EAAS,QAAT,EAAoBC,QAApB,CAA8BJ,CAA9B,CAAL,EAAyC;AACxC,QAAIK,MAAM,GAAG,EAAb;;AACA,QAAO,CAAC,CAAEH,CAAH,IAAQA,CAAC,KAAK,MAAhB,IAA4BD,CAAC,KAAK,OAAvC,EAAiD;AAChDI,MAAAA,MAAM,GAAG,QAAT;AACA,KAFD,MAEO,IAAO,CAAC,CAAEH,CAAH,IAAQA,CAAC,KAAK,OAAhB,IAA6BD,CAAC,KAAK,MAAxC,EAAiD;AACvDI,MAAAA,MAAM,GAAG,MAAT;AACA;;AAED,WAASL,CAAC,GAAGK,MAAb;AACA;;AAED,SAAOJ,CAAP;AACA,CAjBM;AAmBP;AACA;AACA;AACA;AACA;AACA;;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qB,GAAG;AAAA;;AACvB,cAAMmB,IAAI,GAAGd,aAAa,CAAEC,wBAAF,CAA1B;AACA,eAAO,IAAIU,MAAM,CAACC,OAAX,YACNE,IAAI,CAAClD,CADC,6CACIkD,IAAI,CAACtC,IADT,aAENsC,IAAI,CAACjD,CAFC,6CAEIiD,IAAI,CAAC3C,GAFT,iBAGN2C,IAAI,CAACD,KAHC,qDAGQC,IAAI,CAACxC,KAAL,GAAawC,IAAI,CAACtC,IAH1B,kBAINsC,IAAI,CAACC,MAJC,uDAISD,IAAI,CAACvC,MAAL,GAAcuC,IAAI,CAAC3C,GAJ5B,CAAP;AAMA;;AATiB,KAAnB;AAWA,GAbM,MAaA,IAAK8B,wBAAL,EAAgC;AACtC;AACA;AACAO,IAAAA,gBAAgB,GAAGP,wBAAwB,CAACe,aAA5C;AACA,GA3D2B,CA6D5B;;;AACA,8BAAOR,gBAAP,iEAA2B,IAA3B;AACA,CA1EM","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport type { MotionProps } from 'framer-motion';\nimport type { ReferenceType } from '@floating-ui/react-dom';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tPopoverProps,\n\tPopoverAnchorRefReference,\n\tPopoverAnchorRefTopBottom,\n} from './types';\n\n/**\n * Converts the `Popover`'s legacy \"position\" prop to the new \"placement\" prop\n * (used by `floating-ui`).\n *\n * @param position The legacy position\n * @return The corresponding placement\n */\nexport const positionToPlacement = (\n\tposition: NonNullable< PopoverProps[ 'position' ] >\n): NonNullable< PopoverProps[ 'placement' ] > => {\n\tconst [ x, y, z ] = position.split( ' ' );\n\n\tif ( [ 'top', 'bottom' ].includes( x ) ) {\n\t\tlet suffix = '';\n\t\tif ( ( !! z && z === 'left' ) || y === 'right' ) {\n\t\t\tsuffix = '-start';\n\t\t} else if ( ( !! z && z === 'right' ) || y === 'left' ) {\n\t\t\tsuffix = '-end';\n\t\t}\n\n\t\treturn ( x + suffix ) as NonNullable< PopoverProps[ 'placement' ] >;\n\t}\n\n\treturn y as NonNullable< PopoverProps[ 'placement' ] >;\n};\n\n/**\n * @typedef AnimationOrigin\n * @type {Object}\n * @property {number} originX A number between 0 and 1 (in CSS logical properties jargon, 0 is \"start\", 0.5 is \"center\", and 1 is \"end\")\n * @property {number} originY A number between 0 and 1 (0 is top, 0.5 is center, and 1 is bottom)\n */\n\nconst PLACEMENT_TO_ANIMATION_ORIGIN: Record<\n\tNonNullable< PopoverProps[ 'placement' ] >,\n\t{ originX: number; originY: number }\n> = {\n\ttop: { originX: 0.5, originY: 1 }, // open from bottom, center\n\t'top-start': { originX: 0, originY: 1 }, // open from bottom, left\n\t'top-end': { originX: 1, originY: 1 }, // open from bottom, right\n\tright: { originX: 0, originY: 0.5 }, // open from middle, left\n\t'right-start': { originX: 0, originY: 0 }, // open from top, left\n\t'right-end': { originX: 0, originY: 1 }, // open from bottom, left\n\tbottom: { originX: 0.5, originY: 0 }, // open from top, center\n\t'bottom-start': { originX: 0, originY: 0 }, // open from top, left\n\t'bottom-end': { originX: 1, originY: 0 }, // open from top, right\n\tleft: { originX: 1, originY: 0.5 }, // open from middle, right\n\t'left-start': { originX: 1, originY: 0 }, // open from top, right\n\t'left-end': { originX: 1, originY: 1 }, // open from bottom, right\n};\n\n/**\n * Given the floating-ui `placement`, compute the framer-motion props for the\n * popover's entry animation.\n *\n * @param placement A placement string from floating ui\n * @return The object containing the motion props\n */\nexport const placementToMotionAnimationProps = (\n\tplacement: NonNullable< PopoverProps[ 'placement' ] >\n): MotionProps => {\n\tconst translateProp =\n\t\tplacement.startsWith( 'top' ) || placement.startsWith( 'bottom' )\n\t\t\t? 'translateY'\n\t\t\t: 'translateX';\n\tconst translateDirection =\n\t\tplacement.startsWith( 'top' ) || placement.startsWith( 'left' )\n\t\t\t? 1\n\t\t\t: -1;\n\n\treturn {\n\t\tstyle: PLACEMENT_TO_ANIMATION_ORIGIN[ placement ],\n\t\tinitial: {\n\t\t\topacity: 0,\n\t\t\tscale: 0,\n\t\t\t[ translateProp ]: `${ 2 * translateDirection }em`,\n\t\t},\n\t\tanimate: { opacity: 1, scale: 1, [ translateProp ]: 0 },\n\t\ttransition: { duration: 0.1, ease: [ 0, 0, 0.2, 1 ] },\n\t};\n};\n\n/**\n * Returns the offset of a document's frame element.\n *\n * @param document The iframe's owner document.\n *\n * @return The offset of the document's frame element, or undefined if the\n * document has no frame element.\n */\nexport const getFrameOffset = (\n\tdocument?: Document\n): { x: number; y: number } | undefined => {\n\tconst frameElement = document?.defaultView?.frameElement;\n\tif ( ! frameElement ) {\n\t\treturn;\n\t}\n\tconst iframeRect = frameElement.getBoundingClientRect();\n\treturn { x: iframeRect.left, y: iframeRect.top };\n};\n\nexport const getReferenceOwnerDocument = ( {\n\tanchor,\n\tanchorRef,\n\tanchorRect,\n\tgetAnchorRect,\n\tfallbackReferenceElement,\n\tfallbackDocument,\n}: Pick<\n\tPopoverProps,\n\t'anchorRef' | 'anchorRect' | 'getAnchorRect' | 'anchor'\n> & {\n\tfallbackReferenceElement: Element | null;\n\tfallbackDocument: Document;\n} ): Document => {\n\t// In floating-ui's terms:\n\t// - \"reference\" refers to the popover's anchor element.\n\t// - \"floating\" refers the floating popover's element.\n\t// A floating element can also be positioned relative to a virtual element,\n\t// instead of a real one. A virtual element is represented by an object\n\t// with the `getBoundingClientRect()` function (like real elements).\n\t// See https://floating-ui.com/docs/virtual-elements for more info.\n\tlet resultingReferenceOwnerDoc;\n\tif ( anchor ) {\n\t\tresultingReferenceOwnerDoc = anchor.ownerDocument;\n\t} else if ( ( anchorRef as PopoverAnchorRefTopBottom | undefined )?.top ) {\n\t\tresultingReferenceOwnerDoc = ( anchorRef as PopoverAnchorRefTopBottom )\n\t\t\t?.top.ownerDocument;\n\t} else if ( ( anchorRef as Range | undefined )?.startContainer ) {\n\t\tresultingReferenceOwnerDoc = ( anchorRef as Range ).startContainer\n\t\t\t.ownerDocument;\n\t} else if (\n\t\t( anchorRef as PopoverAnchorRefReference | undefined )?.current\n\t) {\n\t\tresultingReferenceOwnerDoc = (\n\t\t\t( anchorRef as PopoverAnchorRefReference ).current as Element\n\t\t ).ownerDocument;\n\t} else if ( anchorRef as Element | undefined ) {\n\t\t// This one should be deprecated.\n\t\tresultingReferenceOwnerDoc = ( anchorRef as Element ).ownerDocument;\n\t} else if ( anchorRect && anchorRect?.ownerDocument ) {\n\t\tresultingReferenceOwnerDoc = anchorRect.ownerDocument;\n\t} else if ( getAnchorRect ) {\n\t\tresultingReferenceOwnerDoc = getAnchorRect(\n\t\t\tfallbackReferenceElement\n\t\t)?.ownerDocument;\n\t}\n\n\treturn resultingReferenceOwnerDoc ?? fallbackDocument;\n};\n\nexport const getReferenceElement = ( {\n\tanchor,\n\tanchorRef,\n\tanchorRect,\n\tgetAnchorRect,\n\tfallbackReferenceElement,\n}: Pick<\n\tPopoverProps,\n\t'anchorRef' | 'anchorRect' | 'getAnchorRect' | 'anchor'\n> & {\n\tfallbackReferenceElement: Element | null;\n} ): ReferenceType | null => {\n\tlet referenceElement = null;\n\n\tif ( anchor ) {\n\t\treferenceElement = anchor;\n\t} else if ( ( anchorRef as PopoverAnchorRefTopBottom | undefined )?.top ) {\n\t\t// Create a virtual element for the ref. The expectation is that\n\t\t// if anchorRef.top is defined, then anchorRef.bottom is defined too.\n\t\t// Seems to be used by the block toolbar, when multiple blocks are selected\n\t\t// (top and bottom blocks are used to calculate the resulting rect).\n\t\treferenceElement = {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst topRect = (\n\t\t\t\t\tanchorRef as PopoverAnchorRefTopBottom\n\t\t\t\t ).top.getBoundingClientRect();\n\t\t\t\tconst bottomRect = (\n\t\t\t\t\tanchorRef as PopoverAnchorRefTopBottom\n\t\t\t\t ).bottom.getBoundingClientRect();\n\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\ttopRect.x,\n\t\t\t\t\ttopRect.y,\n\t\t\t\t\ttopRect.width,\n\t\t\t\t\tbottomRect.bottom - topRect.top\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t} else if (\n\t\t( anchorRef as PopoverAnchorRefReference | undefined )?.current\n\t) {\n\t\t// Standard React ref.\n\t\treferenceElement = ( anchorRef as PopoverAnchorRefReference ).current;\n\t} else if ( anchorRef as Element | undefined ) {\n\t\t// If `anchorRef` holds directly the element's value (no `current` key)\n\t\t// This is a weird scenario and should be deprecated.\n\t\treferenceElement = anchorRef as Element;\n\t} else if ( anchorRect ) {\n\t\t// Create a virtual element for the ref.\n\t\treferenceElement = {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\treturn anchorRect;\n\t\t\t},\n\t\t};\n\t} else if ( getAnchorRect ) {\n\t\t// Create a virtual element for the ref.\n\t\treferenceElement = {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst rect = getAnchorRect( fallbackReferenceElement );\n\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\trect.x ?? rect.left,\n\t\t\t\t\trect.y ?? rect.top,\n\t\t\t\t\trect.width ?? rect.right - rect.left,\n\t\t\t\t\trect.height ?? rect.bottom - rect.top\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t} else if ( fallbackReferenceElement ) {\n\t\t// If no explicit ref is passed via props, fall back to\n\t\t// anchoring to the popover's parent node.\n\t\treferenceElement = fallbackReferenceElement.parentElement;\n\t}\n\n\t// Convert any `undefined` value to `null`.\n\treturn referenceElement ?? null;\n};\n"]}
@@ -15,7 +15,7 @@ import { useInstanceId } from '@wordpress/compose';
15
15
  */
16
16
 
17
17
  import BaseControl from '../base-control';
18
-
18
+ import { VStack } from '../v-stack';
19
19
  /**
20
20
  * Render a user interface to select the user type using radio inputs.
21
21
  *
@@ -41,9 +41,8 @@ import BaseControl from '../base-control';
41
41
  * };
42
42
  * ```
43
43
  */
44
- export function RadioControl( // ref is omitted until we have `WordPressComponentPropsWithoutRef` or add
45
- // ref forwarding to RadioControl.
46
- props) {
44
+
45
+ export function RadioControl(props) {
47
46
  const {
48
47
  label,
49
48
  className,
@@ -64,11 +63,14 @@ props) {
64
63
  }
65
64
 
66
65
  return createElement(BaseControl, {
66
+ __nextHasNoMarginBottom: true,
67
67
  label: label,
68
68
  id: id,
69
69
  hideLabelFromVision: hideLabelFromVision,
70
70
  help: help,
71
71
  className: classnames(className, 'components-radio-control')
72
+ }, createElement(VStack, {
73
+ spacing: 1
72
74
  }, options.map((option, index) => createElement("div", {
73
75
  key: `${id}-${index}`,
74
76
  className: "components-radio-control__option"
@@ -83,7 +85,7 @@ props) {
83
85
  "aria-describedby": !!help ? `${id}__help` : undefined
84
86
  }, additionalProps)), createElement("label", {
85
87
  htmlFor: `${id}-${index}`
86
- }, option.label))));
88
+ }, option.label)))));
87
89
  }
88
90
  export default RadioControl;
89
91
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/radio-control/index.tsx"],"names":["classnames","useInstanceId","BaseControl","RadioControl","props","label","className","selected","help","onChange","hideLabelFromVision","options","additionalProps","instanceId","id","onChangeValue","event","target","value","length","map","option","index","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;;AAGA;AACA;AACA;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,iBAAxB;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAT,EACN;AACA;AACAC,KAHM,EAOL;AACD,QAAM;AACLC,IAAAA,KADK;AAELC,IAAAA,SAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,IAJK;AAKLC,IAAAA,QALK;AAMLC,IAAAA,mBANK;AAOLC,IAAAA,OAAO,GAAG,EAPL;AAQL,OAAGC;AARE,MASFR,KATJ;AAUA,QAAMS,UAAU,GAAGZ,aAAa,CAAEE,YAAF,CAAhC;AACA,QAAMW,EAAE,GAAI,2BAA2BD,UAAY,EAAnD;;AACA,QAAME,aAAa,GAAKC,KAAF,IACrBP,QAAQ,CAAEO,KAAK,CAACC,MAAN,CAAaC,KAAf,CADT;;AAGA,MAAK,EAAEP,OAAF,aAAEA,OAAF,eAAEA,OAAO,CAAEQ,MAAX,CAAL,EAAyB;AACxB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,WAAD;AACC,IAAA,KAAK,EAAGd,KADT;AAEC,IAAA,EAAE,EAAGS,EAFN;AAGC,IAAA,mBAAmB,EAAGJ,mBAHvB;AAIC,IAAA,IAAI,EAAGF,IAJR;AAKC,IAAA,SAAS,EAAGR,UAAU,CAAEM,SAAF,EAAa,0BAAb;AALvB,KAOGK,OAAO,CAACS,GAAR,CAAa,CAAEC,MAAF,EAAUC,KAAV,KACd;AACC,IAAA,GAAG,EAAI,GAAGR,EAAI,IAAIQ,KAAO,EAD1B;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC;AACC,IAAA,EAAE,EAAI,GAAGR,EAAI,IAAIQ,KAAO,EADzB;AAEC,IAAA,SAAS,EAAC,iCAFX;AAGC,IAAA,IAAI,EAAC,OAHN;AAIC,IAAA,IAAI,EAAGR,EAJR;AAKC,IAAA,KAAK,EAAGO,MAAM,CAACH,KALhB;AAMC,IAAA,QAAQ,EAAGH,aANZ;AAOC,IAAA,OAAO,EAAGM,MAAM,CAACH,KAAP,KAAiBX,QAP5B;AAQC,wBACC,CAAC,CAAEC,IAAH,GAAW,GAAGM,EAAI,QAAlB,GAA4BS;AAT9B,KAWMX,eAXN,EAJD,EAiBC;AAAO,IAAA,OAAO,EAAI,GAAGE,EAAI,IAAIQ,KAAO;AAApC,KACGD,MAAM,CAAChB,KADV,CAjBD,CADC,CAPH,CADD;AAiCA;AAED,eAAeF,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ChangeEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { RadioControlProps } from './types';\n\n/**\n * Render a user interface to select the user type using radio inputs.\n *\n * ```jsx\n * import { RadioControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRadioControl = () => {\n * const [ option, setOption ] = useState( 'a' );\n *\n * return (\n * <RadioControl\n * label=\"User type\"\n * help=\"The type of the current user\"\n * selected={ option }\n * options={ [\n * { label: 'Author', value: 'a' },\n * { label: 'Editor', value: 'e' },\n * ] }\n * onChange={ ( value ) => setOption( value ) }\n * />\n * );\n * };\n * ```\n */\nexport function RadioControl(\n\t// ref is omitted until we have `WordPressComponentPropsWithoutRef` or add\n\t// ref forwarding to RadioControl.\n\tprops: Omit<\n\t\tWordPressComponentProps< RadioControlProps, 'input', false >,\n\t\t'ref'\n\t>\n) {\n\tconst {\n\t\tlabel,\n\t\tclassName,\n\t\tselected,\n\t\thelp,\n\t\tonChange,\n\t\thideLabelFromVision,\n\t\toptions = [],\n\t\t...additionalProps\n\t} = props;\n\tconst instanceId = useInstanceId( RadioControl );\n\tconst id = `inspector-radio-control-${ instanceId }`;\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\tif ( ! options?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BaseControl\n\t\t\tlabel={ label }\n\t\t\tid={ id }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\thelp={ help }\n\t\t\tclassName={ classnames( className, 'components-radio-control' ) }\n\t\t>\n\t\t\t{ options.map( ( option, index ) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={ `${ id }-${ index }` }\n\t\t\t\t\tclassName=\"components-radio-control__option\"\n\t\t\t\t>\n\t\t\t\t\t<input\n\t\t\t\t\t\tid={ `${ id }-${ index }` }\n\t\t\t\t\t\tclassName=\"components-radio-control__input\"\n\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\tname={ id }\n\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\tonChange={ onChangeValue }\n\t\t\t\t\t\tchecked={ option.value === selected }\n\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t!! help ? `${ id }__help` : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...additionalProps }\n\t\t\t\t\t/>\n\t\t\t\t\t<label htmlFor={ `${ id }-${ index }` }>\n\t\t\t\t\t\t{ option.label }\n\t\t\t\t\t</label>\n\t\t\t\t</div>\n\t\t\t) ) }\n\t\t</BaseControl>\n\t);\n}\n\nexport default RadioControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/radio-control/index.tsx"],"names":["classnames","useInstanceId","BaseControl","VStack","RadioControl","props","label","className","selected","help","onChange","hideLabelFromVision","options","additionalProps","instanceId","id","onChangeValue","event","target","value","length","map","option","index","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;;AAGA;AACA;AACA;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AAGA,SAASC,MAAT,QAAuB,YAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,YAAT,CACNC,KADM,EAEL;AACD,QAAM;AACLC,IAAAA,KADK;AAELC,IAAAA,SAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,IAJK;AAKLC,IAAAA,QALK;AAMLC,IAAAA,mBANK;AAOLC,IAAAA,OAAO,GAAG,EAPL;AAQL,OAAGC;AARE,MASFR,KATJ;AAUA,QAAMS,UAAU,GAAGb,aAAa,CAAEG,YAAF,CAAhC;AACA,QAAMW,EAAE,GAAI,2BAA2BD,UAAY,EAAnD;;AACA,QAAME,aAAa,GAAKC,KAAF,IACrBP,QAAQ,CAAEO,KAAK,CAACC,MAAN,CAAaC,KAAf,CADT;;AAGA,MAAK,EAAEP,OAAF,aAAEA,OAAF,eAAEA,OAAO,CAAEQ,MAAX,CAAL,EAAyB;AACxB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,WAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGd,KAFT;AAGC,IAAA,EAAE,EAAGS,EAHN;AAIC,IAAA,mBAAmB,EAAGJ,mBAJvB;AAKC,IAAA,IAAI,EAAGF,IALR;AAMC,IAAA,SAAS,EAAGT,UAAU,CAAEO,SAAF,EAAa,0BAAb;AANvB,KAQC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACGK,OAAO,CAACS,GAAR,CAAa,CAAEC,MAAF,EAAUC,KAAV,KACd;AACC,IAAA,GAAG,EAAI,GAAGR,EAAI,IAAIQ,KAAO,EAD1B;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC;AACC,IAAA,EAAE,EAAI,GAAGR,EAAI,IAAIQ,KAAO,EADzB;AAEC,IAAA,SAAS,EAAC,iCAFX;AAGC,IAAA,IAAI,EAAC,OAHN;AAIC,IAAA,IAAI,EAAGR,EAJR;AAKC,IAAA,KAAK,EAAGO,MAAM,CAACH,KALhB;AAMC,IAAA,QAAQ,EAAGH,aANZ;AAOC,IAAA,OAAO,EAAGM,MAAM,CAACH,KAAP,KAAiBX,QAP5B;AAQC,wBACC,CAAC,CAAEC,IAAH,GAAW,GAAGM,EAAI,QAAlB,GAA4BS;AAT9B,KAWMX,eAXN,EAJD,EAiBC;AAAO,IAAA,OAAO,EAAI,GAAGE,EAAI,IAAIQ,KAAO;AAApC,KACGD,MAAM,CAAChB,KADV,CAjBD,CADC,CADH,CARD,CADD;AAoCA;AAED,eAAeF,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ChangeEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { RadioControlProps } from './types';\nimport { VStack } from '../v-stack';\n\n/**\n * Render a user interface to select the user type using radio inputs.\n *\n * ```jsx\n * import { RadioControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRadioControl = () => {\n * const [ option, setOption ] = useState( 'a' );\n *\n * return (\n * <RadioControl\n * label=\"User type\"\n * help=\"The type of the current user\"\n * selected={ option }\n * options={ [\n * { label: 'Author', value: 'a' },\n * { label: 'Editor', value: 'e' },\n * ] }\n * onChange={ ( value ) => setOption( value ) }\n * />\n * );\n * };\n * ```\n */\nexport function RadioControl(\n\tprops: WordPressComponentProps< RadioControlProps, 'input', false >\n) {\n\tconst {\n\t\tlabel,\n\t\tclassName,\n\t\tselected,\n\t\thelp,\n\t\tonChange,\n\t\thideLabelFromVision,\n\t\toptions = [],\n\t\t...additionalProps\n\t} = props;\n\tconst instanceId = useInstanceId( RadioControl );\n\tconst id = `inspector-radio-control-${ instanceId }`;\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\tif ( ! options?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ label }\n\t\t\tid={ id }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\thelp={ help }\n\t\t\tclassName={ classnames( className, 'components-radio-control' ) }\n\t\t>\n\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t{ options.map( ( option, index ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={ `${ id }-${ index }` }\n\t\t\t\t\t\tclassName=\"components-radio-control__option\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tid={ `${ id }-${ index }` }\n\t\t\t\t\t\t\tclassName=\"components-radio-control__input\"\n\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\tname={ id }\n\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\tonChange={ onChangeValue }\n\t\t\t\t\t\t\tchecked={ option.value === selected }\n\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t!! help ? `${ id }__help` : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{ ...additionalProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<label htmlFor={ `${ id }-${ index }` }>\n\t\t\t\t\t\t\t{ option.label }\n\t\t\t\t\t\t</label>\n\t\t\t\t\t</div>\n\t\t\t\t) ) }\n\t\t\t</VStack>\n\t\t</BaseControl>\n\t);\n}\n\nexport default RadioControl;\n"]}
@@ -106,6 +106,8 @@ function UnforwardedRangeControl(props, forwardedRef) {
106
106
  };
107
107
 
108
108
  const handleOnChange = next => {
109
+ // @ts-expect-error TODO: Investigate if it's problematic for setValue() to
110
+ // potentially receive a NaN when next is undefined.
109
111
  let nextValue = parseFloat(next);
110
112
  setValue(nextValue);
111
113
  /*
@@ -255,7 +257,8 @@ function UnforwardedRangeControl(props, forwardedRef) {
255
257
  onBlur: handleOnInputNumberBlur,
256
258
  onChange: handleOnChange,
257
259
  shiftStep: shiftStep,
258
- step: step,
260
+ step: step // @ts-expect-error TODO: Investigate if the `null` value is necessary
261
+ ,
259
262
  value: inputSliderValue
260
263
  }), allowReset && createElement(ActionRightWrapper, null, createElement(Button, {
261
264
  className: "components-range-control__reset",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/range-control/index.tsx"],"names":["classnames","__","isRTL","useRef","useState","forwardRef","useInstanceId","useMergeRefs","BaseControl","Button","Icon","COLORS","floatClamp","useControlledRangeValue","clamp","InputRange","RangeRail","SimpleTooltip","ActionRightWrapper","AfterIconWrapper","BeforeIconWrapper","InputNumber","Root","Track","ThumbWrapper","Thumb","Wrapper","noop","UnforwardedRangeControl","props","forwardedRef","__nextHasNoMarginBottom","afterIcon","allowReset","beforeIcon","className","color","colorProp","ui","theme","currentInput","disabled","help","hideLabelFromVision","initialPosition","isShiftStepEnabled","label","marks","max","min","onBlur","onChange","onFocus","onMouseLeave","onMouseMove","railColor","renderTooltipContent","v","resetFallbackValue","shiftStep","showTooltip","showTooltipProp","step","trackColor","value","valueProp","withInputField","otherProps","setValue","initial","isResetPendent","hasTooltip","hasInputField","setShowTooltip","isFocused","setIsFocused","inputRef","isCurrentlyFocused","current","matches","isThumbFocused","isValueReset","currentValue","undefined","inputSliderValue","rangeFillValue","fillValue","fillValueOffset","classes","wrapperClasses","id","describedBy","enableTooltip","Number","isFinite","handleOnRangeChange","event","nextValue","parseFloat","target","handleOnChange","next","isNaN","handleOnInputNumberBlur","handleOnReset","resetValue","onChangeResetValue","handleShowTooltip","handleHideTooltip","handleOnBlur","handleOnFocus","offsetStyle","width","RangeControl"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;;AAGA;AACA;AACA;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SAASC,MAAT,EAAiBC,QAAjB,EAA2BC,UAA3B,QAA6C,oBAA7C;AACA,SAASC,aAAT,EAAwBC,YAAxB,QAA4C,oBAA5C;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,UAAT,EAAqBC,uBAArB,QAAoD,SAApD;AACA,SAASC,KAAT,QAAsB,eAAtB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,SAAP,MAAsB,QAAtB;AACA,OAAOC,aAAP,MAA0B,WAA1B;AACA,SACCC,kBADD,EAECC,gBAFD,EAGCC,iBAHD,EAICC,WAJD,EAKCC,IALD,EAMCC,KAND,EAOCC,YAPD,EAQCC,KARD,EASCC,OATD,QAUO,+BAVP;;AAeA,MAAMC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,IAAA,KAAK,EAAGsB;AAZT,IAxEF,EAuFGnD,UAAU,IACX,cAAC,kBAAD,QACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,QAAQ,EAAGQ,QAAQ,IAAIuB,KAAK,KAAKmB,SAFlC;AAGC,IAAA,OAAO,EAAC,WAHT;AAIC,IAAA,OAAO,MAJR;AAKC,IAAA,OAAO,EAAGqB;AALX,KAOGvG,EAAE,CAAE,OAAF,CAPL,CADD,CAxFF,CARD,CADD;AAgHA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMgH,YAAY,GAAG5G,UAAU,CAAEuB,uBAAF,CAA/B;AAEP,eAAeqF,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ChangeEvent, FocusEvent, ForwardedRef } from 'react';\n\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 {\n\tActionRightWrapper,\n\tAfterIconWrapper,\n\tBeforeIconWrapper,\n\tInputNumber,\n\tRoot,\n\tTrack,\n\tThumbWrapper,\n\tThumb,\n\tWrapper,\n} from './styles/range-control-styles';\n\nimport type { RangeControlProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst noop = () => {};\n\nfunction UnforwardedRangeControl< IconProps = unknown >(\n\tprops: WordPressComponentProps<\n\t\tRangeControlProps< IconProps >,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\tafterIcon,\n\t\tallowReset = false,\n\t\tbeforeIcon,\n\t\tclassName,\n\t\tcolor: colorProp = COLORS.ui.theme,\n\t\tcurrentInput,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision = false,\n\t\tinitialPosition,\n\t\tisShiftStepEnabled = true,\n\t\tlabel,\n\t\tmarks = false,\n\t\tmax = 100,\n\t\tmin = 0,\n\t\tonBlur = noop,\n\t\tonChange = noop,\n\t\tonFocus = noop,\n\t\tonMouseLeave = noop,\n\t\tonMouseMove = noop,\n\t\trailColor,\n\t\trenderTooltipContent = ( v ) => v,\n\t\tresetFallbackValue,\n\t\tshiftStep = 10,\n\t\tshowTooltip: showTooltipProp,\n\t\tstep = 1,\n\t\ttrackColor,\n\t\tvalue: valueProp,\n\t\twithInputField = true,\n\t\t...otherProps\n\t} = props;\n\n\tconst [ value, setValue ] = useControlledRangeValue( {\n\t\tmin,\n\t\tmax,\n\t\tvalue: valueProp ?? null,\n\t\tinitial: initialPosition,\n\t} );\n\tconst isResetPendent = useRef( false );\n\n\tlet hasTooltip = showTooltipProp;\n\tlet hasInputField = withInputField;\n\n\tif ( step === 'any' ) {\n\t\t// The tooltip and number input field are hidden when the step is \"any\"\n\t\t// because the decimals get too lengthy to fit well.\n\t\thasTooltip = false;\n\t\thasInputField = false;\n\t}\n\n\tconst [ showTooltip, setShowTooltip ] = useState( hasTooltip );\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tconst inputRef = useRef< HTMLInputElement >();\n\tconst isCurrentlyFocused = inputRef.current?.matches( ':focus' );\n\tconst isThumbFocused = ! disabled && isFocused;\n\n\tconst isValueReset = value === null;\n\tconst currentValue = value !== undefined ? value : currentInput;\n\n\tconst inputSliderValue = isValueReset ? '' : currentValue;\n\tconst rangeFillValue = isValueReset ? ( max - min ) / 2 + min : value;\n\n\tconst fillValue = isValueReset\n\t\t? 50\n\t\t: ( ( value - min ) / ( max - min ) ) * 100;\n\tconst fillValueOffset = `${ clamp( fillValue, 0, 100 ) }%`;\n\n\tconst classes = classnames( 'components-range-control', className );\n\n\tconst wrapperClasses = classnames(\n\t\t'components-range-control__wrapper',\n\t\t!! marks && 'is-marked'\n\t);\n\n\tconst id = useInstanceId(\n\t\tUnforwardedRangeControl,\n\t\t'inspector-range-control'\n\t);\n\tconst describedBy = !! help ? `${ id }__help` : undefined;\n\tconst enableTooltip = hasTooltip !== false && Number.isFinite( value );\n\n\tconst handleOnRangeChange = ( event: ChangeEvent< HTMLInputElement > ) => {\n\t\tconst nextValue = parseFloat( event.target.value );\n\t\tsetValue( nextValue );\n\t\tonChange( nextValue );\n\t};\n\n\tconst handleOnChange = ( next: string ) => {\n\t\tlet nextValue = parseFloat( next );\n\t\tsetValue( nextValue );\n\n\t\t/*\n\t\t * Calls onChange only when nextValue is numeric\n\t\t * otherwise may queue a reset for the blur event.\n\t\t */\n\t\tif ( ! isNaN( nextValue ) ) {\n\t\t\tif ( nextValue < min || nextValue > max ) {\n\t\t\t\tnextValue = floatClamp( nextValue, min, max ) as number;\n\t\t\t}\n\n\t\t\tonChange( nextValue );\n\t\t\tisResetPendent.current = false;\n\t\t} else if ( allowReset ) {\n\t\t\tisResetPendent.current = true;\n\t\t}\n\t};\n\n\tconst handleOnInputNumberBlur = () => {\n\t\tif ( isResetPendent.current ) {\n\t\t\thandleOnReset();\n\t\t\tisResetPendent.current = false;\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tlet resetValue: number | null = parseFloat( `${ resetFallbackValue }` );\n\t\tlet onChangeResetValue: number | undefined = resetValue;\n\n\t\tif ( isNaN( resetValue ) ) {\n\t\t\tresetValue = null;\n\t\t\tonChangeResetValue = undefined;\n\t\t}\n\n\t\tsetValue( resetValue );\n\n\t\t/**\n\t\t * Previously, this callback would always receive undefined as\n\t\t * an argument. This behavior is unexpected, specifically\n\t\t * when resetFallbackValue is defined.\n\t\t *\n\t\t * The value of undefined is not ideal. Passing it through\n\t\t * to internal <input /> elements would change it from a\n\t\t * controlled component to an uncontrolled component.\n\t\t *\n\t\t * For now, to minimize unexpected regressions, we're going to\n\t\t * preserve the undefined callback argument, except when a\n\t\t * resetFallbackValue is defined.\n\t\t */\n\t\tonChange( onChangeResetValue );\n\t};\n\n\tconst handleShowTooltip = () => setShowTooltip( true );\n\tconst handleHideTooltip = () => setShowTooltip( false );\n\n\tconst handleOnBlur = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonBlur( event );\n\t\tsetIsFocused( false );\n\t\thandleHideTooltip();\n\t};\n\n\tconst handleOnFocus = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonFocus( event );\n\t\tsetIsFocused( true );\n\t\thandleShowTooltip();\n\t};\n\n\tconst offsetStyle = {\n\t\t[ isRTL() ? 'right' : 'left' ]: fillValueOffset,\n\t};\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tclassName={ classes }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ `${ id }` }\n\t\t\thelp={ help }\n\t\t>\n\t\t\t<Root className=\"components-range-control__root\">\n\t\t\t\t{ beforeIcon && (\n\t\t\t\t\t<BeforeIconWrapper>\n\t\t\t\t\t\t<Icon icon={ beforeIcon } />\n\t\t\t\t\t</BeforeIconWrapper>\n\t\t\t\t) }\n\t\t\t\t<Wrapper\n\t\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t\tclassName={ wrapperClasses }\n\t\t\t\t\tcolor={ colorProp }\n\t\t\t\t\tmarks={ !! marks }\n\t\t\t\t>\n\t\t\t\t\t<InputRange\n\t\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\t\tclassName=\"components-range-control__slider\"\n\t\t\t\t\t\tdescribedBy={ describedBy }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tid={ `${ id }` }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\t\t\tonChange={ handleOnRangeChange }\n\t\t\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\t\t\tonMouseMove={ onMouseMove }\n\t\t\t\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\t\t\t\tref={ useMergeRefs( [ inputRef, forwardedRef ] ) }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ inputSliderValue ?? undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeRail\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tmarks={ marks }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\trailColor={ railColor }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ rangeFillValue }\n\t\t\t\t\t/>\n\t\t\t\t\t<Track\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tclassName=\"components-range-control__track\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tstyle={ { width: fillValueOffset } }\n\t\t\t\t\t\ttrackColor={ trackColor }\n\t\t\t\t\t/>\n\t\t\t\t\t<ThumbWrapper style={ offsetStyle } disabled={ disabled }>\n\t\t\t\t\t\t<Thumb\n\t\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\t\tisFocused={ isThumbFocused }\n\t\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ThumbWrapper>\n\t\t\t\t\t{ enableTooltip && (\n\t\t\t\t\t\t<SimpleTooltip\n\t\t\t\t\t\t\tclassName=\"components-range-control__tooltip\"\n\t\t\t\t\t\t\tinputRef={ inputRef }\n\t\t\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\t\t\trenderTooltipContent={ renderTooltipContent }\n\t\t\t\t\t\t\tshow={ isCurrentlyFocused || showTooltip }\n\t\t\t\t\t\t\tstyle={ offsetStyle }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Wrapper>\n\t\t\t\t{ afterIcon && (\n\t\t\t\t\t<AfterIconWrapper>\n\t\t\t\t\t\t<Icon icon={ afterIcon } />\n\t\t\t\t\t</AfterIconWrapper>\n\t\t\t\t) }\n\t\t\t\t{ hasInputField && (\n\t\t\t\t\t<InputNumber\n\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\tclassName=\"components-range-control__number\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tinputMode=\"decimal\"\n\t\t\t\t\t\tisShiftStepEnabled={ isShiftStepEnabled }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnInputNumberBlur }\n\t\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\t\tshiftStep={ shiftStep }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ inputSliderValue }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowReset && (\n\t\t\t\t\t<ActionRightWrapper>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-range-control__reset\"\n\t\t\t\t\t\t\tdisabled={ disabled || value === undefined }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ActionRightWrapper>\n\t\t\t\t) }\n\t\t\t</Root>\n\t\t</BaseControl>\n\t);\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 [ isChecked, setChecked ] = useState( true );\n * return (\n * <RangeControl\n * help=\"Please select how transparent you would like this.\"\n * initialPosition={50}\n * label=\"Opacity\"\n * max={100}\n * min={0}\n * onChange={() => {}}\n * />\n * );\n * };\n * ```\n */\nexport const RangeControl = forwardRef( UnforwardedRangeControl );\n\nexport default RangeControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/range-control/index.tsx"],"names":["classnames","__","isRTL","useRef","useState","forwardRef","useInstanceId","useMergeRefs","BaseControl","Button","Icon","COLORS","floatClamp","useControlledRangeValue","clamp","InputRange","RangeRail","SimpleTooltip","ActionRightWrapper","AfterIconWrapper","BeforeIconWrapper","InputNumber","Root","Track","ThumbWrapper","Thumb","Wrapper","noop","UnforwardedRangeControl","props","forwardedRef","__nextHasNoMarginBottom","afterIcon","allowReset","beforeIcon","className","color","colorProp","ui","theme","currentInput","disabled","help","hideLabelFromVision","initialPosition","isShiftStepEnabled","label","marks","max","min","onBlur","onChange","onFocus","onMouseLeave","onMouseMove","railColor","renderTooltipContent","v","resetFallbackValue","shiftStep","showTooltip","showTooltipProp","step","trackColor","value","valueProp","withInputField","otherProps","setValue","initial","isResetPendent","hasTooltip","hasInputField","setShowTooltip","isFocused","setIsFocused","inputRef","isCurrentlyFocused","current","matches","isThumbFocused","isValueReset","currentValue","undefined","inputSliderValue","rangeFillValue","fillValue","fillValueOffset","classes","wrapperClasses","id","describedBy","enableTooltip","Number","isFinite","handleOnRangeChange","event","nextValue","parseFloat","target","handleOnChange","next","isNaN","handleOnInputNumberBlur","handleOnReset","resetValue","onChangeResetValue","handleShowTooltip","handleHideTooltip","handleOnBlur","handleOnFocus","offsetStyle","width","RangeControl"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;;AAGA;AACA;AACA;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,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I,EAAGqB,kBAAkB,IAAIjB,WAL9B;AAMC,IAAA,KAAK,EAAGmD,WANT;AAOC,IAAA,KAAK,EAAG/C;AAPT,IAjDF,CAND,EAkEGhC,SAAS,IACV,cAAC,gBAAD,QACC,cAAC,IAAD;AAAM,IAAA,IAAI,EAAGA;AAAb,IADD,CAnEF,EAuEGwC,aAAa,IACd,cAAC,WAAD;AACC,kBAAa1B,KADd;AAEC,IAAA,SAAS,EAAC,kCAFX;AAGC,IAAA,QAAQ,EAAGL,QAHZ;AAIC,IAAA,SAAS,EAAC,SAJX;AAKC,IAAA,kBAAkB,EAAGI,kBALtB;AAMC,IAAA,GAAG,EAAGG,GANP;AAOC,IAAA,GAAG,EAAGC,GAPP;AAQC,IAAA,MAAM,EAAGsD,uBARV;AASC,IAAA,QAAQ,EAAGH,cATZ;AAUC,IAAA,SAAS,EAAGzC,SAVb;AAWC,IAAA,IAAI,EAAGG,IAXR,CAYC;AAZD;AAaC,IAAA,KAAK,EAAGsB;AAbT,IAxEF,EAwFGnD,UAAU,IACX,cAAC,kBAAD,QACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,QAAQ,EAAGQ,QAAQ,IAAIuB,KAAK,KAAKmB,SAFlC;AAGC,IAAA,OAAO,EAAC,WAHT;AAIC,IAAA,OAAO,MAJR;AAKC,IAAA,OAAO,EAAGqB;AALX,KAOGvG,EAAE,CAAE,OAAF,CAPL,CADD,CAzFF,CARD,CADD;AAiHA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMgH,YAAY,GAAG5G,UAAU,CAAEuB,uBAAF,CAA/B;AAEP,eAAeqF,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ChangeEvent, FocusEvent, ForwardedRef } from 'react';\n\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 {\n\tActionRightWrapper,\n\tAfterIconWrapper,\n\tBeforeIconWrapper,\n\tInputNumber,\n\tRoot,\n\tTrack,\n\tThumbWrapper,\n\tThumb,\n\tWrapper,\n} from './styles/range-control-styles';\n\nimport type { RangeControlProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst noop = () => {};\n\nfunction UnforwardedRangeControl< IconProps = unknown >(\n\tprops: WordPressComponentProps<\n\t\tRangeControlProps< IconProps >,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\tafterIcon,\n\t\tallowReset = false,\n\t\tbeforeIcon,\n\t\tclassName,\n\t\tcolor: colorProp = COLORS.ui.theme,\n\t\tcurrentInput,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision = false,\n\t\tinitialPosition,\n\t\tisShiftStepEnabled = true,\n\t\tlabel,\n\t\tmarks = false,\n\t\tmax = 100,\n\t\tmin = 0,\n\t\tonBlur = noop,\n\t\tonChange = noop,\n\t\tonFocus = noop,\n\t\tonMouseLeave = noop,\n\t\tonMouseMove = noop,\n\t\trailColor,\n\t\trenderTooltipContent = ( v ) => v,\n\t\tresetFallbackValue,\n\t\tshiftStep = 10,\n\t\tshowTooltip: showTooltipProp,\n\t\tstep = 1,\n\t\ttrackColor,\n\t\tvalue: valueProp,\n\t\twithInputField = true,\n\t\t...otherProps\n\t} = props;\n\n\tconst [ value, setValue ] = useControlledRangeValue( {\n\t\tmin,\n\t\tmax,\n\t\tvalue: valueProp ?? null,\n\t\tinitial: initialPosition,\n\t} );\n\tconst isResetPendent = useRef( false );\n\n\tlet hasTooltip = showTooltipProp;\n\tlet hasInputField = withInputField;\n\n\tif ( step === 'any' ) {\n\t\t// The tooltip and number input field are hidden when the step is \"any\"\n\t\t// because the decimals get too lengthy to fit well.\n\t\thasTooltip = false;\n\t\thasInputField = false;\n\t}\n\n\tconst [ showTooltip, setShowTooltip ] = useState( hasTooltip );\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tconst inputRef = useRef< HTMLInputElement >();\n\tconst isCurrentlyFocused = inputRef.current?.matches( ':focus' );\n\tconst isThumbFocused = ! disabled && isFocused;\n\n\tconst isValueReset = value === null;\n\tconst currentValue = value !== undefined ? value : currentInput;\n\n\tconst inputSliderValue = isValueReset ? '' : currentValue;\n\tconst rangeFillValue = isValueReset ? ( max - min ) / 2 + min : value;\n\n\tconst fillValue = isValueReset\n\t\t? 50\n\t\t: ( ( value - min ) / ( max - min ) ) * 100;\n\tconst fillValueOffset = `${ clamp( fillValue, 0, 100 ) }%`;\n\n\tconst classes = classnames( 'components-range-control', className );\n\n\tconst wrapperClasses = classnames(\n\t\t'components-range-control__wrapper',\n\t\t!! marks && 'is-marked'\n\t);\n\n\tconst id = useInstanceId(\n\t\tUnforwardedRangeControl,\n\t\t'inspector-range-control'\n\t);\n\tconst describedBy = !! help ? `${ id }__help` : undefined;\n\tconst enableTooltip = hasTooltip !== false && Number.isFinite( value );\n\n\tconst handleOnRangeChange = ( event: ChangeEvent< HTMLInputElement > ) => {\n\t\tconst nextValue = parseFloat( event.target.value );\n\t\tsetValue( nextValue );\n\t\tonChange( nextValue );\n\t};\n\n\tconst handleOnChange = ( next?: string ) => {\n\t\t// @ts-expect-error TODO: Investigate if it's problematic for setValue() to\n\t\t// potentially receive a NaN when next is undefined.\n\t\tlet nextValue = parseFloat( next );\n\t\tsetValue( nextValue );\n\n\t\t/*\n\t\t * Calls onChange only when nextValue is numeric\n\t\t * otherwise may queue a reset for the blur event.\n\t\t */\n\t\tif ( ! isNaN( nextValue ) ) {\n\t\t\tif ( nextValue < min || nextValue > max ) {\n\t\t\t\tnextValue = floatClamp( nextValue, min, max ) as number;\n\t\t\t}\n\n\t\t\tonChange( nextValue );\n\t\t\tisResetPendent.current = false;\n\t\t} else if ( allowReset ) {\n\t\t\tisResetPendent.current = true;\n\t\t}\n\t};\n\n\tconst handleOnInputNumberBlur = () => {\n\t\tif ( isResetPendent.current ) {\n\t\t\thandleOnReset();\n\t\t\tisResetPendent.current = false;\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tlet resetValue: number | null = parseFloat( `${ resetFallbackValue }` );\n\t\tlet onChangeResetValue: number | undefined = resetValue;\n\n\t\tif ( isNaN( resetValue ) ) {\n\t\t\tresetValue = null;\n\t\t\tonChangeResetValue = undefined;\n\t\t}\n\n\t\tsetValue( resetValue );\n\n\t\t/**\n\t\t * Previously, this callback would always receive undefined as\n\t\t * an argument. This behavior is unexpected, specifically\n\t\t * when resetFallbackValue is defined.\n\t\t *\n\t\t * The value of undefined is not ideal. Passing it through\n\t\t * to internal <input /> elements would change it from a\n\t\t * controlled component to an uncontrolled component.\n\t\t *\n\t\t * For now, to minimize unexpected regressions, we're going to\n\t\t * preserve the undefined callback argument, except when a\n\t\t * resetFallbackValue is defined.\n\t\t */\n\t\tonChange( onChangeResetValue );\n\t};\n\n\tconst handleShowTooltip = () => setShowTooltip( true );\n\tconst handleHideTooltip = () => setShowTooltip( false );\n\n\tconst handleOnBlur = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonBlur( event );\n\t\tsetIsFocused( false );\n\t\thandleHideTooltip();\n\t};\n\n\tconst handleOnFocus = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonFocus( event );\n\t\tsetIsFocused( true );\n\t\thandleShowTooltip();\n\t};\n\n\tconst offsetStyle = {\n\t\t[ isRTL() ? 'right' : 'left' ]: fillValueOffset,\n\t};\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tclassName={ classes }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ `${ id }` }\n\t\t\thelp={ help }\n\t\t>\n\t\t\t<Root className=\"components-range-control__root\">\n\t\t\t\t{ beforeIcon && (\n\t\t\t\t\t<BeforeIconWrapper>\n\t\t\t\t\t\t<Icon icon={ beforeIcon } />\n\t\t\t\t\t</BeforeIconWrapper>\n\t\t\t\t) }\n\t\t\t\t<Wrapper\n\t\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t\tclassName={ wrapperClasses }\n\t\t\t\t\tcolor={ colorProp }\n\t\t\t\t\tmarks={ !! marks }\n\t\t\t\t>\n\t\t\t\t\t<InputRange\n\t\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\t\tclassName=\"components-range-control__slider\"\n\t\t\t\t\t\tdescribedBy={ describedBy }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tid={ `${ id }` }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\t\t\tonChange={ handleOnRangeChange }\n\t\t\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\t\t\tonMouseMove={ onMouseMove }\n\t\t\t\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\t\t\t\tref={ useMergeRefs( [ inputRef, forwardedRef ] ) }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ inputSliderValue ?? undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeRail\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tmarks={ marks }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\trailColor={ railColor }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ rangeFillValue }\n\t\t\t\t\t/>\n\t\t\t\t\t<Track\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tclassName=\"components-range-control__track\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tstyle={ { width: fillValueOffset } }\n\t\t\t\t\t\ttrackColor={ trackColor }\n\t\t\t\t\t/>\n\t\t\t\t\t<ThumbWrapper style={ offsetStyle } disabled={ disabled }>\n\t\t\t\t\t\t<Thumb\n\t\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\t\tisFocused={ isThumbFocused }\n\t\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ThumbWrapper>\n\t\t\t\t\t{ enableTooltip && (\n\t\t\t\t\t\t<SimpleTooltip\n\t\t\t\t\t\t\tclassName=\"components-range-control__tooltip\"\n\t\t\t\t\t\t\tinputRef={ inputRef }\n\t\t\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\t\t\trenderTooltipContent={ renderTooltipContent }\n\t\t\t\t\t\t\tshow={ isCurrentlyFocused || showTooltip }\n\t\t\t\t\t\t\tstyle={ offsetStyle }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Wrapper>\n\t\t\t\t{ afterIcon && (\n\t\t\t\t\t<AfterIconWrapper>\n\t\t\t\t\t\t<Icon icon={ afterIcon } />\n\t\t\t\t\t</AfterIconWrapper>\n\t\t\t\t) }\n\t\t\t\t{ hasInputField && (\n\t\t\t\t\t<InputNumber\n\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\tclassName=\"components-range-control__number\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tinputMode=\"decimal\"\n\t\t\t\t\t\tisShiftStepEnabled={ isShiftStepEnabled }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnInputNumberBlur }\n\t\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\t\tshiftStep={ shiftStep }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t// @ts-expect-error TODO: Investigate if the `null` value is necessary\n\t\t\t\t\t\tvalue={ inputSliderValue }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowReset && (\n\t\t\t\t\t<ActionRightWrapper>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-range-control__reset\"\n\t\t\t\t\t\t\tdisabled={ disabled || value === undefined }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ActionRightWrapper>\n\t\t\t\t) }\n\t\t\t</Root>\n\t\t</BaseControl>\n\t);\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 [ isChecked, setChecked ] = useState( true );\n * return (\n * <RangeControl\n * help=\"Please select how transparent you would like this.\"\n * initialPosition={50}\n * label=\"Opacity\"\n * max={100}\n * min={0}\n * onChange={() => {}}\n * />\n * );\n * };\n * ```\n */\nexport const RangeControl = forwardRef( UnforwardedRangeControl );\n\nexport default RangeControl;\n"]}