@wordpress/components 19.12.0 → 19.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (717) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/CONTRIBUTING.md +94 -12
  3. package/build/alignment-matrix-control/index.js +3 -3
  4. package/build/alignment-matrix-control/index.js.map +1 -1
  5. package/build/angle-picker-control/index.js +2 -2
  6. package/build/angle-picker-control/index.js.map +1 -1
  7. package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  8. package/build/border-box-control/utils.js.map +1 -1
  9. package/build/border-control/border-control/hook.js.map +1 -1
  10. package/build/box-control/all-input-control.js +6 -10
  11. package/build/box-control/all-input-control.js.map +1 -1
  12. package/build/box-control/axial-input-controls.js.map +1 -1
  13. package/build/box-control/index.js +3 -7
  14. package/build/box-control/index.js.map +1 -1
  15. package/build/box-control/input-controls.js +6 -10
  16. package/build/box-control/input-controls.js.map +1 -1
  17. package/build/box-control/unit-control.js +4 -4
  18. package/build/box-control/unit-control.js.map +1 -1
  19. package/build/button/index.native.js +1 -3
  20. package/build/button/index.native.js.map +1 -1
  21. package/build/checkbox-control/index.js.map +1 -1
  22. package/build/color-picker/index.native.js.map +1 -1
  23. package/build/combobox-control/index.js +4 -2
  24. package/build/combobox-control/index.js.map +1 -1
  25. package/build/confirm-dialog/component.js.map +1 -1
  26. package/build/custom-gradient-bar/constants.js +1 -3
  27. package/build/custom-gradient-bar/constants.js.map +1 -1
  28. package/build/custom-gradient-bar/control-points.js +15 -8
  29. package/build/custom-gradient-bar/control-points.js.map +1 -1
  30. package/build/custom-gradient-bar/index.js +5 -5
  31. package/build/custom-gradient-bar/index.js.map +1 -1
  32. package/build/custom-gradient-bar/utils.js +5 -7
  33. package/build/custom-gradient-bar/utils.js.map +1 -1
  34. package/build/custom-gradient-picker/utils.js.map +1 -1
  35. package/build/custom-select-control/index.js.map +1 -1
  36. package/build/date-time/date/index.js +4 -4
  37. package/build/date-time/date/index.js.map +1 -1
  38. package/build/date-time/date-time/index.js +3 -3
  39. package/build/date-time/date-time/index.js.map +1 -1
  40. package/build/dimension-control/index.js +1 -3
  41. package/build/dimension-control/index.js.map +1 -1
  42. package/build/divider/styles.js +5 -5
  43. package/build/divider/styles.js.map +1 -1
  44. package/build/draggable/index.js.map +1 -1
  45. package/build/draggable/index.native.js +6 -1
  46. package/build/draggable/index.native.js.map +1 -1
  47. package/build/drop-zone/provider.js.map +1 -1
  48. package/build/dropdown/index.js +2 -2
  49. package/build/dropdown/index.js.map +1 -1
  50. package/build/dropdown-menu/index.js +13 -2
  51. package/build/dropdown-menu/index.js.map +1 -1
  52. package/build/dropdown-menu/index.native.js +13 -2
  53. package/build/dropdown-menu/index.native.js.map +1 -1
  54. package/build/external-link/index.js +20 -8
  55. package/build/external-link/index.js.map +1 -1
  56. package/build/external-link/styles/external-link-styles.js +3 -3
  57. package/build/external-link/styles/external-link-styles.js.map +1 -1
  58. package/build/external-link/types.js +6 -0
  59. package/build/external-link/types.js.map +1 -0
  60. package/build/flex/flex/hook.js +9 -5
  61. package/build/flex/flex/hook.js.map +1 -1
  62. package/build/focal-point-picker/controls.js +3 -7
  63. package/build/focal-point-picker/controls.js.map +1 -1
  64. package/build/focal-point-picker/index.js.map +1 -1
  65. package/build/focal-point-picker/media.js +4 -8
  66. package/build/focal-point-picker/media.js.map +1 -1
  67. package/build/font-size-picker/index.js +1 -1
  68. package/build/font-size-picker/index.js.map +1 -1
  69. package/build/form-toggle/index.js +6 -4
  70. package/build/form-toggle/index.js.map +1 -1
  71. package/build/form-token-field/index.js +328 -359
  72. package/build/form-token-field/index.js.map +1 -1
  73. package/build/form-token-field/suggestions-list.js +26 -20
  74. package/build/form-token-field/suggestions-list.js.map +1 -1
  75. package/build/form-token-field/token-input.js +39 -53
  76. package/build/form-token-field/token-input.js.map +1 -1
  77. package/build/form-token-field/token.js +3 -3
  78. package/build/form-token-field/token.js.map +1 -1
  79. package/build/form-token-field/types.js +6 -0
  80. package/build/form-token-field/types.js.map +1 -0
  81. package/build/gradient-picker/index.js.map +1 -1
  82. package/build/heading/hook.js.map +1 -1
  83. package/build/higher-order/navigate-regions/index.js.map +1 -1
  84. package/build/higher-order/with-focus-return/index.js.map +1 -1
  85. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  86. package/build/icon/index.js.map +1 -1
  87. package/build/input-control/index.js +5 -5
  88. package/build/input-control/index.js.map +1 -1
  89. package/build/input-control/input-field.js +10 -10
  90. package/build/input-control/input-field.js.map +1 -1
  91. package/build/input-control/reducer/reducer.js.map +1 -1
  92. package/build/input-control/utils.js +1 -1
  93. package/build/input-control/utils.js.map +1 -1
  94. package/build/menu-items-choice/index.js +3 -7
  95. package/build/menu-items-choice/index.js.map +1 -1
  96. package/build/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  97. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  98. package/build/mobile/bottom-sheet/cycle-picker-cell.native.js +1 -7
  99. package/build/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
  100. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  101. package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  102. package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  103. package/build/mobile/color-settings/index.native.js.map +1 -1
  104. package/build/mobile/global-styles-context/index.native.js.map +1 -1
  105. package/build/mobile/gradient/index.native.js.map +1 -1
  106. package/build/mobile/html-text-input/index.native.js.map +1 -1
  107. package/build/mobile/inserter-button/index.native.js.map +1 -1
  108. package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
  109. package/build/mobile/media-edit/index.native.js.map +1 -1
  110. package/build/mobile/segmented-control/index.native.js +1 -1
  111. package/build/mobile/segmented-control/index.native.js.map +1 -1
  112. package/build/modal/index.js +1 -1
  113. package/build/modal/index.js.map +1 -1
  114. package/build/navigable-container/container.js +4 -2
  115. package/build/navigable-container/container.js.map +1 -1
  116. package/build/navigation/context.js +12 -16
  117. package/build/navigation/context.js.map +1 -1
  118. package/build/navigation/index.js +3 -3
  119. package/build/navigation/index.js.map +1 -1
  120. package/build/navigation/item/index.js +3 -3
  121. package/build/navigation/item/index.js.map +1 -1
  122. package/build/navigator/navigator-back-button/hook.js.map +1 -1
  123. package/build/navigator/navigator-button/hook.js.map +1 -1
  124. package/build/navigator/navigator-provider/component.js +1 -1
  125. package/build/navigator/navigator-provider/component.js.map +1 -1
  126. package/build/navigator/navigator-screen/component.js +1 -1
  127. package/build/navigator/navigator-screen/component.js.map +1 -1
  128. package/build/notice/index.js +5 -5
  129. package/build/notice/index.js.map +1 -1
  130. package/build/notice/list.js +4 -2
  131. package/build/notice/list.js.map +1 -1
  132. package/build/panel/body.js +3 -3
  133. package/build/panel/body.js.map +1 -1
  134. package/build/placeholder/index.js +26 -12
  135. package/build/placeholder/index.js.map +1 -1
  136. package/build/radio-control/index.js +43 -7
  137. package/build/radio-control/index.js.map +1 -1
  138. package/build/radio-control/types.js +6 -0
  139. package/build/radio-control/types.js.map +1 -0
  140. package/build/range-control/index.js +8 -6
  141. package/build/range-control/index.js.map +1 -1
  142. package/build/range-control/input-range.js +6 -10
  143. package/build/range-control/input-range.js.map +1 -1
  144. package/build/range-control/utils.js +7 -5
  145. package/build/range-control/utils.js.map +1 -1
  146. package/build/resizable-box/resize-tooltip/index.js +3 -3
  147. package/build/resizable-box/resize-tooltip/index.js.map +1 -1
  148. package/build/resizable-box/resize-tooltip/utils.js +4 -7
  149. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  150. package/build/responsive-wrapper/index.js.map +1 -1
  151. package/build/select-control/index.js +5 -3
  152. package/build/select-control/index.js.map +1 -1
  153. package/build/slot-fill/fill.js +1 -7
  154. package/build/slot-fill/fill.js.map +1 -1
  155. package/build/slot-fill/slot.js +14 -3
  156. package/build/slot-fill/slot.js.map +1 -1
  157. package/build/snackbar/index.js +7 -7
  158. package/build/snackbar/index.js.map +1 -1
  159. package/build/snackbar/list.js +3 -1
  160. package/build/snackbar/list.js.map +1 -1
  161. package/build/tab-panel/index.js +3 -1
  162. package/build/tab-panel/index.js.map +1 -1
  163. package/build/text/hook.js +4 -4
  164. package/build/text/hook.js.map +1 -1
  165. package/build/text/utils.js.map +1 -1
  166. package/build/toggle-control/index.js +1 -3
  167. package/build/toggle-control/index.js.map +1 -1
  168. package/build/toggle-control/index.native.js +1 -7
  169. package/build/toggle-control/index.native.js.map +1 -1
  170. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  171. package/build/toolbar/index.js.map +1 -1
  172. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  173. package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
  174. package/build/tooltip/index.js +2 -1
  175. package/build/tooltip/index.js.map +1 -1
  176. package/build/tree-grid/roving-tab-index-item.js.map +1 -1
  177. package/build/tree-select/index.js +57 -4
  178. package/build/tree-select/index.js.map +1 -1
  179. package/build/tree-select/types.js +6 -0
  180. package/build/tree-select/types.js.map +1 -0
  181. package/build/ui/form-group/form-group-content.js.map +1 -1
  182. package/build/unit-control/index.js.map +1 -1
  183. package/build/utils/unit-values.js.map +1 -1
  184. package/build/utils/values.js.map +1 -1
  185. package/build/z-stack/component.js +22 -3
  186. package/build/z-stack/component.js.map +1 -1
  187. package/build/z-stack/types.js +6 -0
  188. package/build/z-stack/types.js.map +1 -0
  189. package/build-module/alignment-matrix-control/index.js +2 -1
  190. package/build-module/alignment-matrix-control/index.js.map +1 -1
  191. package/build-module/angle-picker-control/index.js +1 -1
  192. package/build-module/angle-picker-control/index.js.map +1 -1
  193. package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  194. package/build-module/border-box-control/utils.js.map +1 -1
  195. package/build-module/border-control/border-control/hook.js.map +1 -1
  196. package/build-module/box-control/all-input-control.js +3 -5
  197. package/build-module/box-control/all-input-control.js.map +1 -1
  198. package/build-module/box-control/axial-input-controls.js.map +1 -1
  199. package/build-module/box-control/index.js +2 -5
  200. package/build-module/box-control/index.js.map +1 -1
  201. package/build-module/box-control/input-controls.js +3 -5
  202. package/build-module/box-control/input-controls.js.map +1 -1
  203. package/build-module/box-control/unit-control.js +3 -1
  204. package/build-module/box-control/unit-control.js.map +1 -1
  205. package/build-module/button/index.native.js +1 -2
  206. package/build-module/button/index.native.js.map +1 -1
  207. package/build-module/checkbox-control/index.js.map +1 -1
  208. package/build-module/color-picker/index.native.js.map +1 -1
  209. package/build-module/combobox-control/index.js +5 -2
  210. package/build-module/combobox-control/index.js.map +1 -1
  211. package/build-module/confirm-dialog/component.js.map +1 -1
  212. package/build-module/custom-gradient-bar/constants.js +0 -1
  213. package/build-module/custom-gradient-bar/constants.js.map +1 -1
  214. package/build-module/custom-gradient-bar/control-points.js +16 -9
  215. package/build-module/custom-gradient-bar/control-points.js.map +1 -1
  216. package/build-module/custom-gradient-bar/index.js +6 -6
  217. package/build-module/custom-gradient-bar/index.js.map +1 -1
  218. package/build-module/custom-gradient-bar/utils.js +6 -8
  219. package/build-module/custom-gradient-bar/utils.js.map +1 -1
  220. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  221. package/build-module/custom-select-control/index.js.map +1 -1
  222. package/build-module/date-time/date/index.js +4 -3
  223. package/build-module/date-time/date/index.js.map +1 -1
  224. package/build-module/date-time/date-time/index.js +2 -1
  225. package/build-module/date-time/date-time/index.js.map +1 -1
  226. package/build-module/dimension-control/index.js +1 -2
  227. package/build-module/dimension-control/index.js.map +1 -1
  228. package/build-module/divider/styles.js +5 -5
  229. package/build-module/divider/styles.js.map +1 -1
  230. package/build-module/draggable/index.js.map +1 -1
  231. package/build-module/draggable/index.native.js +6 -1
  232. package/build-module/draggable/index.native.js.map +1 -1
  233. package/build-module/drop-zone/provider.js.map +1 -1
  234. package/build-module/dropdown/index.js +2 -2
  235. package/build-module/dropdown/index.js.map +1 -1
  236. package/build-module/dropdown-menu/index.js +12 -1
  237. package/build-module/dropdown-menu/index.js.map +1 -1
  238. package/build-module/dropdown-menu/index.native.js +12 -1
  239. package/build-module/dropdown-menu/index.native.js.map +1 -1
  240. package/build-module/external-link/index.js +22 -7
  241. package/build-module/external-link/index.js.map +1 -1
  242. package/build-module/external-link/styles/external-link-styles.js +3 -3
  243. package/build-module/external-link/styles/external-link-styles.js.map +1 -1
  244. package/build-module/external-link/types.js +2 -0
  245. package/build-module/external-link/types.js.map +1 -0
  246. package/build-module/flex/flex/hook.js +7 -5
  247. package/build-module/flex/flex/hook.js.map +1 -1
  248. package/build-module/focal-point-picker/controls.js +3 -5
  249. package/build-module/focal-point-picker/controls.js.map +1 -1
  250. package/build-module/focal-point-picker/index.js.map +1 -1
  251. package/build-module/focal-point-picker/media.js +3 -5
  252. package/build-module/focal-point-picker/media.js.map +1 -1
  253. package/build-module/font-size-picker/index.js +1 -1
  254. package/build-module/font-size-picker/index.js.map +1 -1
  255. package/build-module/form-toggle/index.js +1 -1
  256. package/build-module/form-toggle/index.js.map +1 -1
  257. package/build-module/form-token-field/index.js +329 -361
  258. package/build-module/form-token-field/index.js.map +1 -1
  259. package/build-module/form-token-field/suggestions-list.js +32 -23
  260. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  261. package/build-module/form-token-field/token-input.js +43 -58
  262. package/build-module/form-token-field/token-input.js.map +1 -1
  263. package/build-module/form-token-field/token.js +3 -1
  264. package/build-module/form-token-field/token.js.map +1 -1
  265. package/build-module/form-token-field/types.js +2 -0
  266. package/build-module/form-token-field/types.js.map +1 -0
  267. package/build-module/gradient-picker/index.js.map +1 -1
  268. package/build-module/heading/hook.js.map +1 -1
  269. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  270. package/build-module/higher-order/with-focus-return/index.js.map +1 -1
  271. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  272. package/build-module/icon/index.js.map +1 -1
  273. package/build-module/input-control/index.js +2 -1
  274. package/build-module/input-control/index.js.map +1 -1
  275. package/build-module/input-control/input-field.js +2 -1
  276. package/build-module/input-control/input-field.js.map +1 -1
  277. package/build-module/input-control/reducer/reducer.js.map +1 -1
  278. package/build-module/input-control/utils.js +1 -1
  279. package/build-module/input-control/utils.js.map +1 -1
  280. package/build-module/menu-items-choice/index.js +3 -5
  281. package/build-module/menu-items-choice/index.js.map +1 -1
  282. package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  283. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  284. package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js +1 -6
  285. package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
  286. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  287. package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  288. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  289. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  290. package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
  291. package/build-module/mobile/gradient/index.native.js.map +1 -1
  292. package/build-module/mobile/html-text-input/index.native.js.map +1 -1
  293. package/build-module/mobile/inserter-button/index.native.js.map +1 -1
  294. package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
  295. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  296. package/build-module/mobile/segmented-control/index.native.js +2 -2
  297. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  298. package/build-module/modal/index.js +1 -1
  299. package/build-module/modal/index.js.map +1 -1
  300. package/build-module/navigable-container/container.js +5 -2
  301. package/build-module/navigable-container/container.js.map +1 -1
  302. package/build-module/navigation/context.js +3 -5
  303. package/build-module/navigation/context.js.map +1 -1
  304. package/build-module/navigation/index.js +3 -1
  305. package/build-module/navigation/index.js.map +1 -1
  306. package/build-module/navigation/item/index.js +3 -1
  307. package/build-module/navigation/item/index.js.map +1 -1
  308. package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
  309. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  310. package/build-module/navigator/navigator-provider/component.js +1 -1
  311. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  312. package/build-module/navigator/navigator-screen/component.js +1 -1
  313. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  314. package/build-module/notice/index.js +2 -1
  315. package/build-module/notice/index.js.map +1 -1
  316. package/build-module/notice/list.js +4 -1
  317. package/build-module/notice/list.js.map +1 -1
  318. package/build-module/panel/body.js +3 -1
  319. package/build-module/panel/body.js.map +1 -1
  320. package/build-module/placeholder/index.js +24 -11
  321. package/build-module/placeholder/index.js.map +1 -1
  322. package/build-module/radio-control/index.js +40 -7
  323. package/build-module/radio-control/index.js.map +1 -1
  324. package/build-module/radio-control/types.js +2 -0
  325. package/build-module/radio-control/types.js.map +1 -0
  326. package/build-module/range-control/index.js +4 -2
  327. package/build-module/range-control/index.js.map +1 -1
  328. package/build-module/range-control/input-range.js +2 -5
  329. package/build-module/range-control/input-range.js.map +1 -1
  330. package/build-module/range-control/utils.js +4 -1
  331. package/build-module/range-control/utils.js.map +1 -1
  332. package/build-module/resizable-box/resize-tooltip/index.js +2 -1
  333. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  334. package/build-module/resizable-box/resize-tooltip/utils.js +3 -5
  335. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  336. package/build-module/responsive-wrapper/index.js.map +1 -1
  337. package/build-module/select-control/index.js +3 -1
  338. package/build-module/select-control/index.js.map +1 -1
  339. package/build-module/slot-fill/fill.js +1 -6
  340. package/build-module/slot-fill/fill.js.map +1 -1
  341. package/build-module/slot-fill/slot.js +12 -2
  342. package/build-module/slot-fill/slot.js.map +1 -1
  343. package/build-module/snackbar/index.js +3 -1
  344. package/build-module/snackbar/index.js.map +1 -1
  345. package/build-module/snackbar/list.js +4 -1
  346. package/build-module/snackbar/list.js.map +1 -1
  347. package/build-module/tab-panel/index.js +3 -1
  348. package/build-module/tab-panel/index.js.map +1 -1
  349. package/build-module/text/hook.js +4 -4
  350. package/build-module/text/hook.js.map +1 -1
  351. package/build-module/text/utils.js.map +1 -1
  352. package/build-module/toggle-control/index.js +1 -2
  353. package/build-module/toggle-control/index.js.map +1 -1
  354. package/build-module/toggle-control/index.native.js +1 -6
  355. package/build-module/toggle-control/index.native.js.map +1 -1
  356. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  357. package/build-module/toolbar/index.js.map +1 -1
  358. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  359. package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
  360. package/build-module/tooltip/index.js +2 -1
  361. package/build-module/tooltip/index.js.map +1 -1
  362. package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
  363. package/build-module/tree-select/index.js +53 -3
  364. package/build-module/tree-select/index.js.map +1 -1
  365. package/build-module/tree-select/types.js +2 -0
  366. package/build-module/tree-select/types.js.map +1 -0
  367. package/build-module/ui/form-group/form-group-content.js.map +1 -1
  368. package/build-module/unit-control/index.js.map +1 -1
  369. package/build-module/utils/unit-values.js.map +1 -1
  370. package/build-module/utils/values.js.map +1 -1
  371. package/build-module/z-stack/component.js +21 -2
  372. package/build-module/z-stack/component.js.map +1 -1
  373. package/build-module/z-stack/types.js +2 -0
  374. package/build-module/z-stack/types.js.map +1 -0
  375. package/build-style/style-rtl.css +32 -3
  376. package/build-style/style.css +32 -4
  377. package/build-types/base-control/stories/index.d.ts.map +1 -1
  378. package/build-types/base-field/hook.d.ts +0 -1
  379. package/build-types/base-field/hook.d.ts.map +1 -1
  380. package/build-types/border-box-control/border-box-control/hook.d.ts +0 -1
  381. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  382. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  383. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +0 -1
  384. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  385. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +0 -1
  386. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  387. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +0 -1
  388. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  389. package/build-types/border-box-control/utils.d.ts.map +1 -1
  390. package/build-types/border-control/border-control/hook.d.ts +0 -1
  391. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  392. package/build-types/border-control/border-control-dropdown/hook.d.ts +0 -1
  393. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  394. package/build-types/border-control/border-control-style-picker/hook.d.ts +0 -1
  395. package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -1
  396. package/build-types/button-group/index.d.ts +1 -1
  397. package/build-types/button-group/index.d.ts.map +1 -1
  398. package/build-types/card/card/hook.d.ts +0 -1
  399. package/build-types/card/card/hook.d.ts.map +1 -1
  400. package/build-types/card/card-body/hook.d.ts +0 -1
  401. package/build-types/card/card-body/hook.d.ts.map +1 -1
  402. package/build-types/card/card-divider/hook.d.ts +0 -1
  403. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  404. package/build-types/card/card-footer/hook.d.ts +0 -1
  405. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  406. package/build-types/card/card-header/hook.d.ts +0 -1
  407. package/build-types/card/card-header/hook.d.ts.map +1 -1
  408. package/build-types/card/card-media/hook.d.ts +0 -1
  409. package/build-types/card/card-media/hook.d.ts.map +1 -1
  410. package/build-types/checkbox-control/index.d.ts.map +1 -1
  411. package/build-types/checkbox-control/stories/index.d.ts.map +1 -1
  412. package/build-types/color-picker/styles.d.ts +7 -7
  413. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  414. package/build-types/date-time/date/index.d.ts.map +1 -1
  415. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  416. package/build-types/date-time/stories/date-time.d.ts.map +1 -1
  417. package/build-types/date-time/stories/date.d.ts.map +1 -1
  418. package/build-types/date-time/time/styles.d.ts +1 -1
  419. package/build-types/divider/styles.d.ts.map +1 -1
  420. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  421. package/build-types/elevation/hook.d.ts +0 -1
  422. package/build-types/elevation/hook.d.ts.map +1 -1
  423. package/build-types/external-link/index.d.ts +17 -0
  424. package/build-types/external-link/index.d.ts.map +1 -0
  425. package/build-types/external-link/stories/index.d.ts +12 -0
  426. package/build-types/external-link/stories/index.d.ts.map +1 -0
  427. package/build-types/external-link/styles/external-link-styles.d.ts +10 -0
  428. package/build-types/external-link/styles/external-link-styles.d.ts.map +1 -0
  429. package/build-types/external-link/types.d.ts +15 -0
  430. package/build-types/external-link/types.d.ts.map +1 -0
  431. package/build-types/flex/flex/hook.d.ts +0 -1
  432. package/build-types/flex/flex/hook.d.ts.map +1 -1
  433. package/build-types/flex/flex-block/hook.d.ts +0 -1
  434. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  435. package/build-types/flex/flex-item/hook.d.ts +0 -1
  436. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  437. package/build-types/form-token-field/index.d.ts +15 -0
  438. package/build-types/form-token-field/index.d.ts.map +1 -0
  439. package/build-types/form-token-field/stories/index.d.ts +13 -0
  440. package/build-types/form-token-field/stories/index.d.ts.map +1 -0
  441. package/build-types/form-token-field/suggestions-list.d.ts +10 -0
  442. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -0
  443. package/build-types/form-token-field/test/lib/fixtures.d.ts +26 -0
  444. package/build-types/form-token-field/test/lib/fixtures.d.ts.map +1 -0
  445. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts +18 -0
  446. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts.map +1 -0
  447. package/build-types/form-token-field/token-input.d.ts +12 -0
  448. package/build-types/form-token-field/token-input.d.ts.map +1 -0
  449. package/build-types/form-token-field/token.d.ts +4 -0
  450. package/build-types/form-token-field/token.d.ts.map +1 -0
  451. package/build-types/form-token-field/types.d.ts +176 -0
  452. package/build-types/form-token-field/types.d.ts.map +1 -0
  453. package/build-types/grid/hook.d.ts +0 -1
  454. package/build-types/grid/hook.d.ts.map +1 -1
  455. package/build-types/h-stack/hook.d.ts +0 -1
  456. package/build-types/h-stack/hook.d.ts.map +1 -1
  457. package/build-types/heading/hook.d.ts +0 -1
  458. package/build-types/heading/hook.d.ts.map +1 -1
  459. package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
  460. package/build-types/input-control/index.d.ts +1 -1
  461. package/build-types/input-control/index.d.ts.map +1 -1
  462. package/build-types/input-control/input-field.d.ts +1 -1
  463. package/build-types/input-control/input-field.d.ts.map +1 -1
  464. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  465. package/build-types/input-control/stories/index.d.ts +5 -5
  466. package/build-types/input-control/stories/index.d.ts.map +1 -1
  467. package/build-types/item-group/item/hook.d.ts +0 -1
  468. package/build-types/item-group/item/hook.d.ts.map +1 -1
  469. package/build-types/item-group/item-group/hook.d.ts +0 -1
  470. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  471. package/build-types/navigator/navigator-back-button/hook.d.ts +0 -1
  472. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  473. package/build-types/navigator/navigator-button/hook.d.ts +0 -1
  474. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  475. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  476. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  477. package/build-types/radio-control/index.d.ts +31 -0
  478. package/build-types/radio-control/index.d.ts.map +1 -0
  479. package/build-types/radio-control/stories/index.d.ts +12 -0
  480. package/build-types/radio-control/stories/index.d.ts.map +1 -0
  481. package/build-types/radio-control/types.d.ts +29 -0
  482. package/build-types/radio-control/types.d.ts.map +1 -0
  483. package/build-types/range-control/index.d.ts +5 -5
  484. package/build-types/range-control/index.d.ts.map +1 -1
  485. package/build-types/range-control/input-range.d.ts +4 -4
  486. package/build-types/range-control/input-range.d.ts.map +1 -1
  487. package/build-types/range-control/utils.d.ts.map +1 -1
  488. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  489. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  490. package/build-types/scrollable/hook.d.ts +0 -1
  491. package/build-types/scrollable/hook.d.ts.map +1 -1
  492. package/build-types/select-control/index.d.ts +1 -1
  493. package/build-types/select-control/index.d.ts.map +1 -1
  494. package/build-types/select-control/stories/index.d.ts +3 -3
  495. package/build-types/select-control/stories/index.d.ts.map +1 -1
  496. package/build-types/slot-fill/fill.d.ts.map +1 -1
  497. package/build-types/slot-fill/slot.d.ts.map +1 -1
  498. package/build-types/spacer/hook.d.ts +0 -1
  499. package/build-types/spacer/hook.d.ts.map +1 -1
  500. package/build-types/surface/hook.d.ts +0 -1
  501. package/build-types/surface/hook.d.ts.map +1 -1
  502. package/build-types/text/hook.d.ts +0 -1
  503. package/build-types/text/hook.d.ts.map +1 -1
  504. package/build-types/text/utils.d.ts.map +1 -1
  505. package/build-types/text-control/index.d.ts +1 -1
  506. package/build-types/text-control/index.d.ts.map +1 -1
  507. package/build-types/text-control/stories/index.d.ts.map +1 -1
  508. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +1 -1
  509. package/build-types/tools-panel/tools-panel/hook.d.ts +0 -1
  510. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  511. package/build-types/tools-panel/tools-panel-header/hook.d.ts +0 -1
  512. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  513. package/build-types/tools-panel/tools-panel-item/hook.d.ts +0 -1
  514. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  515. package/build-types/tooltip/index.d.ts.map +1 -1
  516. package/build-types/tree-select/index.d.ts +53 -0
  517. package/build-types/tree-select/index.d.ts.map +1 -0
  518. package/build-types/tree-select/stories/index.d.ts +12 -0
  519. package/build-types/tree-select/stories/index.d.ts.map +1 -0
  520. package/build-types/tree-select/types.d.ts +30 -0
  521. package/build-types/tree-select/types.d.ts.map +1 -0
  522. package/build-types/truncate/hook.d.ts +0 -1
  523. package/build-types/truncate/hook.d.ts.map +1 -1
  524. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  525. package/build-types/ui/control-group/hook.d.ts +0 -1
  526. package/build-types/ui/control-group/hook.d.ts.map +1 -1
  527. package/build-types/ui/control-label/hook.d.ts +0 -1
  528. package/build-types/ui/control-label/hook.d.ts.map +1 -1
  529. package/build-types/ui/form-group/use-form-group.d.ts +0 -2
  530. package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
  531. package/build-types/unit-control/index.d.ts +1 -1
  532. package/build-types/unit-control/index.d.ts.map +1 -1
  533. package/build-types/unit-control/stories/index.d.ts.map +1 -1
  534. package/build-types/utils/unit-values.d.ts.map +1 -1
  535. package/build-types/utils/values.d.ts.map +1 -1
  536. package/build-types/v-stack/hook.d.ts +0 -1
  537. package/build-types/v-stack/hook.d.ts.map +1 -1
  538. package/build-types/z-stack/component.d.ts +18 -28
  539. package/build-types/z-stack/component.d.ts.map +1 -1
  540. package/build-types/z-stack/stories/index.d.ts +6 -0
  541. package/build-types/z-stack/stories/index.d.ts.map +1 -0
  542. package/build-types/z-stack/types.d.ts +33 -0
  543. package/build-types/z-stack/types.d.ts.map +1 -0
  544. package/package.json +17 -17
  545. package/src/alignment-matrix-control/index.js +2 -1
  546. package/src/angle-picker-control/index.js +1 -1
  547. package/src/base-control/stories/index.tsx +2 -3
  548. package/src/border-box-control/border-box-control-linked-button/component.tsx +2 -5
  549. package/src/border-box-control/utils.ts +5 -2
  550. package/src/border-control/border-control/hook.ts +2 -3
  551. package/src/box-control/all-input-control.js +2 -4
  552. package/src/box-control/axial-input-controls.js +4 -6
  553. package/src/box-control/index.js +2 -5
  554. package/src/box-control/input-controls.js +33 -36
  555. package/src/box-control/unit-control.js +2 -1
  556. package/src/button/index.native.js +1 -2
  557. package/src/card/stories/index.js +10 -5
  558. package/src/checkbox-control/index.tsx +2 -3
  559. package/src/checkbox-control/stories/index.tsx +2 -3
  560. package/src/checkbox-control/test/index.tsx +2 -1
  561. package/src/color-picker/index.native.js +7 -4
  562. package/src/combobox-control/index.js +4 -2
  563. package/src/confirm-dialog/component.tsx +7 -8
  564. package/src/custom-gradient-bar/constants.js +2 -2
  565. package/src/custom-gradient-bar/control-points.js +20 -16
  566. package/src/custom-gradient-bar/index.js +11 -11
  567. package/src/custom-gradient-bar/test/utils.js +79 -0
  568. package/src/custom-gradient-bar/utils.js +6 -18
  569. package/src/custom-gradient-picker/style.scss +1 -3
  570. package/src/custom-gradient-picker/utils.js +4 -3
  571. package/src/custom-select-control/index.js +2 -1
  572. package/src/custom-select-control/stories/index.js +1 -2
  573. package/src/date-time/date/index.tsx +2 -2
  574. package/src/date-time/date/style.scss +10 -0
  575. package/src/date-time/date/test/index.tsx +1 -1
  576. package/src/date-time/date-time/index.tsx +6 -8
  577. package/src/date-time/stories/date-time.tsx +4 -6
  578. package/src/date-time/stories/date.tsx +2 -3
  579. package/src/date-time/time/test/index.tsx +12 -12
  580. package/src/dimension-control/index.js +1 -2
  581. package/src/divider/styles.ts +2 -3
  582. package/src/draggable/index.js +3 -3
  583. package/src/draggable/index.native.js +12 -4
  584. package/src/drop-zone/provider.js +1 -2
  585. package/src/dropdown/index.js +2 -2
  586. package/src/dropdown-menu/index.js +11 -1
  587. package/src/dropdown-menu/index.native.js +11 -1
  588. package/src/external-link/README.md +18 -0
  589. package/src/external-link/{index.js → index.tsx} +26 -6
  590. package/src/external-link/stories/index.tsx +36 -0
  591. package/src/external-link/styles/{external-link-styles.js → external-link-styles.ts} +0 -0
  592. package/src/external-link/types.ts +15 -0
  593. package/src/flex/flex/hook.js +4 -1
  594. package/src/focal-point-picker/controls.js +1 -5
  595. package/src/focal-point-picker/index.js +2 -8
  596. package/src/focal-point-picker/media.js +2 -5
  597. package/src/font-size-picker/index.js +3 -1
  598. package/src/form-toggle/index.js +2 -1
  599. package/src/form-toggle/test/index.js +1 -2
  600. package/src/form-token-field/index.tsx +694 -0
  601. package/src/form-token-field/stories/index.tsx +103 -0
  602. package/src/form-token-field/style.scss +2 -1
  603. package/src/form-token-field/{suggestions-list.js → suggestions-list.tsx} +45 -29
  604. package/src/form-token-field/test/index.js +64 -31
  605. package/src/form-token-field/test/lib/{token-field-wrapper.js → token-field-wrapper.tsx} +24 -9
  606. package/src/form-token-field/token-input.tsx +76 -0
  607. package/src/form-token-field/{token.js → token.tsx} +4 -2
  608. package/src/form-token-field/types.ts +178 -0
  609. package/src/gradient-picker/index.js +4 -3
  610. package/src/heading/hook.ts +5 -4
  611. package/src/higher-order/navigate-regions/index.js +7 -5
  612. package/src/higher-order/with-filters/test/index.js +43 -36
  613. package/src/higher-order/with-focus-return/index.js +14 -13
  614. package/src/higher-order/with-spoken-messages/index.js +8 -7
  615. package/src/higher-order/with-spoken-messages/test/index.js +1 -1
  616. package/src/icon/index.tsx +2 -2
  617. package/src/input-control/index.tsx +2 -1
  618. package/src/input-control/input-field.tsx +2 -1
  619. package/src/input-control/reducer/reducer.ts +23 -21
  620. package/src/input-control/utils.ts +1 -1
  621. package/src/item-group/stories/index.js +2 -1
  622. package/src/menu-item/test/index.js +2 -1
  623. package/src/menu-items-choice/index.js +2 -5
  624. package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +2 -4
  625. package/src/mobile/bottom-sheet/cell.native.js +2 -3
  626. package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +3 -5
  627. package/src/mobile/bottom-sheet/index.native.js +14 -17
  628. package/src/mobile/bottom-sheet/picker-cell.native.js +2 -7
  629. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +4 -6
  630. package/src/mobile/color-settings/index.native.js +2 -4
  631. package/src/mobile/global-styles-context/index.native.js +8 -7
  632. package/src/mobile/gradient/index.native.js +12 -9
  633. package/src/mobile/gradient/test/index.native.js +1 -3
  634. package/src/mobile/html-text-input/index.native.js +2 -3
  635. package/src/mobile/inserter-button/index.native.js +2 -6
  636. package/src/mobile/link-settings/image-link-destinations-screen.native.js +6 -2
  637. package/src/mobile/media-edit/index.native.js +2 -3
  638. package/src/mobile/segmented-control/index.native.js +4 -5
  639. package/src/mobile/utils/test/index.native.js +3 -12
  640. package/src/modal/index.js +1 -1
  641. package/src/navigable-container/container.js +3 -2
  642. package/src/navigable-container/test/menu.js +1 -2
  643. package/src/navigable-container/test/tabbable.js +1 -2
  644. package/src/navigation/context.js +2 -5
  645. package/src/navigation/index.js +2 -1
  646. package/src/navigation/item/index.js +2 -1
  647. package/src/navigation/stories/controlled-state.js +1 -1
  648. package/src/navigation/stories/more-examples.js +2 -3
  649. package/src/navigation/test/index.js +252 -52
  650. package/src/navigator/navigator-back-button/hook.ts +14 -12
  651. package/src/navigator/navigator-button/hook.ts +14 -13
  652. package/src/navigator/navigator-provider/component.tsx +2 -6
  653. package/src/navigator/navigator-screen/component.tsx +3 -3
  654. package/src/notice/index.js +2 -1
  655. package/src/notice/list.js +3 -1
  656. package/src/panel/body.js +2 -1
  657. package/src/placeholder/README.md +7 -6
  658. package/src/placeholder/index.js +27 -10
  659. package/src/placeholder/style.scss +23 -0
  660. package/src/radio-control/README.md +17 -23
  661. package/src/radio-control/index.tsx +107 -0
  662. package/src/radio-control/stories/index.tsx +72 -0
  663. package/src/radio-control/types.ts +32 -0
  664. package/src/range-control/index.js +4 -2
  665. package/src/range-control/input-range.js +2 -5
  666. package/src/range-control/utils.js +3 -1
  667. package/src/resizable-box/resize-tooltip/index.tsx +2 -1
  668. package/src/resizable-box/resize-tooltip/utils.ts +1 -5
  669. package/src/responsive-wrapper/index.js +2 -4
  670. package/src/sandbox/test/index.js +4 -6
  671. package/src/select-control/index.tsx +3 -1
  672. package/src/select-control/stories/index.tsx +3 -4
  673. package/src/slot-fill/fill.js +1 -5
  674. package/src/slot-fill/slot.js +12 -2
  675. package/src/snackbar/index.js +1 -1
  676. package/src/snackbar/list.js +2 -1
  677. package/src/tab-panel/index.js +3 -1
  678. package/src/text/hook.js +4 -1
  679. package/src/text/utils.js +2 -3
  680. package/src/text-control/stories/index.tsx +4 -6
  681. package/src/toggle-control/index.js +1 -2
  682. package/src/toggle-control/index.native.js +2 -6
  683. package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +2 -4
  684. package/src/toolbar/index.js +1 -2
  685. package/src/tools-panel/tools-panel/hook.ts +2 -4
  686. package/src/tools-panel/tools-panel-header/hook.ts +2 -5
  687. package/src/tooltip/index.js +1 -0
  688. package/src/tree-grid/roving-tab-index-item.js +2 -4
  689. package/src/tree-grid/test/index.js +2 -3
  690. package/src/tree-select/README.md +2 -2
  691. package/src/tree-select/index.tsx +99 -0
  692. package/src/tree-select/stories/index.tsx +80 -0
  693. package/src/tree-select/types.ts +35 -0
  694. package/src/ui/context/wordpress-component.ts +4 -5
  695. package/src/ui/form-group/form-group-content.js +4 -4
  696. package/src/unit-control/index.tsx +7 -9
  697. package/src/unit-control/stories/index.tsx +8 -12
  698. package/src/unit-control/test/index.tsx +4 -7
  699. package/src/utils/hooks/stories/use-cx.js +8 -7
  700. package/src/utils/hooks/test/use-controlled-state.js +2 -1
  701. package/src/utils/unit-values.ts +2 -1
  702. package/src/utils/values.js +2 -3
  703. package/src/z-stack/README.md +14 -3
  704. package/src/z-stack/component.tsx +24 -29
  705. package/src/z-stack/stories/index.tsx +76 -0
  706. package/src/z-stack/types.ts +33 -0
  707. package/tsconfig.json +5 -0
  708. package/tsconfig.tsbuildinfo +1 -1
  709. package/src/external-link/stories/index.js +0 -23
  710. package/src/form-token-field/index.js +0 -725
  711. package/src/form-token-field/stories/index.js +0 -102
  712. package/src/form-token-field/token-input.js +0 -81
  713. package/src/radio-control/index.js +0 -69
  714. package/src/radio-control/stories/index.js +0 -41
  715. package/src/tree-select/index.js +0 -48
  716. package/src/tree-select/stories/index.js +0 -80
  717. package/src/z-stack/stories/index.js +0 -70
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/range-control/utils.js"],"names":["floatClamp","value","min","max","parseFloat","useControlledRangeValue","valueProp","initial","state","setInternalState","fallback","setState","nextValue","useDebouncedHoverInteraction","onHide","noop","onMouseLeave","onMouseMove","onShow","timeout","show","setShow","timeoutRef","setDebouncedTimeout","callback","window","clearTimeout","current","setTimeout","handleOnMouseMove","event","handleOnMouseLeave"],"mappings":";;;;;;;;;AAIA;;AAKA;;AAKA;;AAdA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAT,CAAqBC,KAArB,EAA4BC,GAA5B,EAAiCC,GAAjC,EAAuC;AAC7C,MAAK,OAAOF,KAAP,KAAiB,QAAtB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SAAOG,UAAU,CAAE,mBAAOH,KAAP,EAAcC,GAAd,EAAmBC,GAAnB,CAAF,CAAjB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,uBAAT,OAKH;AAAA,MALqC;AACxCH,IAAAA,GADwC;AAExCC,IAAAA,GAFwC;AAGxCF,IAAAA,KAAK,EAAEK,SAHiC;AAIxCC,IAAAA;AAJwC,GAKrC;AACH,QAAM,CAAEC,KAAF,EAASC,gBAAT,IAA8B,+BACnCT,UAAU,CAAEM,SAAF,EAAaJ,GAAb,EAAkBC,GAAlB,CADyB,EAEnC;AAAEI,IAAAA,OAAF;AAAWG,IAAAA,QAAQ,EAAE;AAArB,GAFmC,CAApC;AAKA,QAAMC,QAAQ,GAAG,0BACdC,SAAF,IAAiB;AAChB,QAAKA,SAAS,KAAK,IAAnB,EAA0B;AACzBH,MAAAA,gBAAgB,CAAE,IAAF,CAAhB;AACA,KAFD,MAEO;AACNA,MAAAA,gBAAgB,CAAET,UAAU,CAAEY,SAAF,EAAaV,GAAb,EAAkBC,GAAlB,CAAZ,CAAhB;AACA;AACD,GAPe,EAQhB,CAAED,GAAF,EAAOC,GAAP,CARgB,CAAjB;AAWA,SAAO,CAAEK,KAAF,EAASG,QAAT,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AAC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AAAA,WAAW,EAAEY,iBADP;AAENb,IAAAA,YAAY,EAAEe;AAFR,GAAP;AAIA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { clamp, noop } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useControlledState } from '../utils/hooks';\n\n/**\n * A float supported clamp function for a specific value.\n *\n * @param {number|null} value The value to clamp.\n * @param {number} min The minimum value.\n * @param {number} max The maximum value.\n *\n * @return {number} A (float) number\n */\nexport function floatClamp( value, min, max ) {\n\tif ( typeof value !== 'number' ) {\n\t\treturn null;\n\t}\n\n\treturn parseFloat( clamp( value, min, max ) );\n}\n\n/**\n * Hook to store a clamped value, derived from props.\n *\n * @param {Object} settings Hook settings.\n * @param {number} settings.min The minimum value.\n * @param {number} settings.max The maximum value.\n * @param {number} settings.value The current value.\n * @param {any} settings.initial The initial value.\n *\n * @return {[*, Function]} The controlled value and the value setter.\n */\nexport function useControlledRangeValue( {\n\tmin,\n\tmax,\n\tvalue: valueProp,\n\tinitial,\n} ) {\n\tconst [ state, setInternalState ] = useControlledState(\n\t\tfloatClamp( valueProp, min, max ),\n\t\t{ initial, fallback: null }\n\t);\n\n\tconst setState = useCallback(\n\t\t( nextValue ) => {\n\t\t\tif ( nextValue === null ) {\n\t\t\t\tsetInternalState( null );\n\t\t\t} else {\n\t\t\t\tsetInternalState( floatClamp( nextValue, min, max ) );\n\t\t\t}\n\t\t},\n\t\t[ min, max ]\n\t);\n\n\treturn [ state, setState ];\n}\n\n/**\n * Hook to encapsulate the debouncing \"hover\" to better handle the showing\n * and hiding of the Tooltip.\n *\n * @param {Object} settings Hook settings.\n * @param {Function} [settings.onShow=noop] A callback function invoked when the element is shown.\n * @param {Function} [settings.onHide=noop] A callback function invoked when the element is hidden.\n * @param {Function} [settings.onMouseMove=noop] A callback function invoked when the mouse is moved.\n * @param {Function} [settings.onMouseLeave=noop] A callback function invoked when the mouse is moved out of the element.\n * @param {number} [settings.timeout=300] Timeout before the element is shown or hidden.\n *\n * @return {Object} Bound properties for use on a React.Node.\n */\nexport function useDebouncedHoverInteraction( {\n\tonHide = noop,\n\tonMouseLeave = noop,\n\tonMouseMove = noop,\n\tonShow = noop,\n\ttimeout = 300,\n} ) {\n\tconst [ show, setShow ] = useState( false );\n\tconst timeoutRef = useRef();\n\n\tconst setDebouncedTimeout = useCallback(\n\t\t( callback ) => {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\n\t\t\ttimeoutRef.current = setTimeout( callback, timeout );\n\t\t},\n\t\t[ timeout ]\n\t);\n\n\tconst handleOnMouseMove = useCallback( ( event ) => {\n\t\tonMouseMove( event );\n\n\t\tsetDebouncedTimeout( () => {\n\t\t\tif ( ! show ) {\n\t\t\t\tsetShow( true );\n\t\t\t\tonShow();\n\t\t\t}\n\t\t} );\n\t}, [] );\n\n\tconst handleOnMouseLeave = useCallback( ( event ) => {\n\t\tonMouseLeave( event );\n\n\t\tsetDebouncedTimeout( () => {\n\t\t\tsetShow( false );\n\t\t\tonHide();\n\t\t} );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t};\n\t} );\n\n\treturn {\n\t\tonMouseMove: handleOnMouseMove,\n\t\tonMouseLeave: handleOnMouseLeave,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/range-control/utils.js"],"names":["noop","floatClamp","value","min","max","parseFloat","useControlledRangeValue","valueProp","initial","state","setInternalState","fallback","setState","nextValue","useDebouncedHoverInteraction","onHide","onMouseLeave","onMouseMove","onShow","timeout","show","setShow","timeoutRef","setDebouncedTimeout","callback","window","clearTimeout","current","setTimeout","handleOnMouseMove","event","handleOnMouseLeave"],"mappings":";;;;;;;;;AAIA;;AAKA;;AAKA;;AAdA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,IAAI,GAAG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+B;AAI7CkB,IAAAA,MAAM,GAAGlB,IAJoC;AAK7CmB,IAAAA,OAAO,GAAG;AALmC,GAM1C;AACH,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,uBAAU,KAAV,CAA1B;AACA,QAAMC,UAAU,GAAG,sBAAnB;AAEA,QAAMC,mBAAmB,GAAG,0BACzBC,QAAF,IAAgB;AACfC,IAAAA,MAAM,CAACC,YAAP,CAAqBJ,UAAU,CAACK,OAAhC;AAEAL,IAAAA,UAAU,CAACK,OAAX,GAAqBC,UAAU,CAAEJ,QAAF,EAAYL,OAAZ,CAA/B;AACA,GAL0B,EAM3B,CAAEA,OAAF,CAN2B,CAA5B;AASA,QAAMU,iBAAiB,GAAG,0BAAeC,KAAF,IAAa;AACnDb,IAAAA,WAAW,CAAEa,KAAF,CAAX;AAEAP,IAAAA,mBAAmB,CAAE,MAAM;AAC1B,UAAK,CAAEH,IAAP,EAAc;AACbC,QAAAA,OAAO,CAAE,IAAF,CAAP;AACAH,QAAAA,MAAM;AACN;AACD,KALkB,CAAnB;AAMA,GATyB,EASvB,EATuB,CAA1B;AAWA,QAAMa,kBAAkB,GAAG,0BAAeD,KAAF,IAAa;AACpDd,IAAAA,YAAY,CAAEc,KAAF,CAAZ;AAEAP,IAAAA,mBAAmB,CAAE,MAAM;AAC1BF,MAAAA,OAAO,CAAE,KAAF,CAAP;AACAN,MAAAA,MAAM;AACN,KAHkB,CAAnB;AAIA,GAP0B,EAOxB,EAPwB,CAA3B;AASA,0BAAW,MAAM;AAChB,WAAO,MAAM;AACZU,MAAAA,MAAM,CAACC,YAAP,CAAqBJ,UAAU,CAACK,OAAhC;AACA,KAFD;AAGA,GAJD;AAMA,SAAO;AACNV,IAAAA,WAAW,EAAEY,iBADP;AAENb,IAAAA,YAAY,EAAEe;AAFR,GAAP;AAIA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { clamp } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useControlledState } from '../utils/hooks';\n\nconst noop = () => {};\n\n/**\n * A float supported clamp function for a specific value.\n *\n * @param {number|null} value The value to clamp.\n * @param {number} min The minimum value.\n * @param {number} max The maximum value.\n *\n * @return {number} A (float) number\n */\nexport function floatClamp( value, min, max ) {\n\tif ( typeof value !== 'number' ) {\n\t\treturn null;\n\t}\n\n\treturn parseFloat( clamp( value, min, max ) );\n}\n\n/**\n * Hook to store a clamped value, derived from props.\n *\n * @param {Object} settings Hook settings.\n * @param {number} settings.min The minimum value.\n * @param {number} settings.max The maximum value.\n * @param {number} settings.value The current value.\n * @param {any} settings.initial The initial value.\n *\n * @return {[*, Function]} The controlled value and the value setter.\n */\nexport function useControlledRangeValue( {\n\tmin,\n\tmax,\n\tvalue: valueProp,\n\tinitial,\n} ) {\n\tconst [ state, setInternalState ] = useControlledState(\n\t\tfloatClamp( valueProp, min, max ),\n\t\t{ initial, fallback: null }\n\t);\n\n\tconst setState = useCallback(\n\t\t( nextValue ) => {\n\t\t\tif ( nextValue === null ) {\n\t\t\t\tsetInternalState( null );\n\t\t\t} else {\n\t\t\t\tsetInternalState( floatClamp( nextValue, min, max ) );\n\t\t\t}\n\t\t},\n\t\t[ min, max ]\n\t);\n\n\treturn [ state, setState ];\n}\n\n/**\n * Hook to encapsulate the debouncing \"hover\" to better handle the showing\n * and hiding of the Tooltip.\n *\n * @param {Object} settings Hook settings.\n * @param {Function} [settings.onShow=noop] A callback function invoked when the element is shown.\n * @param {Function} [settings.onHide=noop] A callback function invoked when the element is hidden.\n * @param {Function} [settings.onMouseMove=noop] A callback function invoked when the mouse is moved.\n * @param {Function} [settings.onMouseLeave=noop] A callback function invoked when the mouse is moved out of the element.\n * @param {number} [settings.timeout=300] Timeout before the element is shown or hidden.\n *\n * @return {Object} Bound properties for use on a React.Node.\n */\nexport function useDebouncedHoverInteraction( {\n\tonHide = noop,\n\tonMouseLeave = noop,\n\tonMouseMove = noop,\n\tonShow = noop,\n\ttimeout = 300,\n} ) {\n\tconst [ show, setShow ] = useState( false );\n\tconst timeoutRef = useRef();\n\n\tconst setDebouncedTimeout = useCallback(\n\t\t( callback ) => {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\n\t\t\ttimeoutRef.current = setTimeout( callback, timeout );\n\t\t},\n\t\t[ timeout ]\n\t);\n\n\tconst handleOnMouseMove = useCallback( ( event ) => {\n\t\tonMouseMove( event );\n\n\t\tsetDebouncedTimeout( () => {\n\t\t\tif ( ! show ) {\n\t\t\t\tsetShow( true );\n\t\t\t\tonShow();\n\t\t\t}\n\t\t} );\n\t}, [] );\n\n\tconst handleOnMouseLeave = useCallback( ( event ) => {\n\t\tonMouseLeave( event );\n\n\t\tsetDebouncedTimeout( () => {\n\t\t\tsetShow( false );\n\t\t\tonHide();\n\t\t} );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t};\n\t} );\n\n\treturn {\n\t\tonMouseMove: handleOnMouseMove,\n\t\tonMouseLeave: handleOnMouseLeave,\n\t};\n}\n"]}
@@ -11,8 +11,6 @@ var _element = require("@wordpress/element");
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
- var _lodash = require("lodash");
15
-
16
14
  var _classnames = _interopRequireDefault(require("classnames"));
17
15
 
18
16
  var _label = _interopRequireDefault(require("./label"));
@@ -32,6 +30,8 @@ var _resizeTooltip = require("./styles/resize-tooltip.styles");
32
30
  /**
33
31
  * Internal dependencies
34
32
  */
33
+ const noop = () => {};
34
+
35
35
  function ResizeTooltip(_ref, ref) {
36
36
  let {
37
37
  axis,
@@ -39,7 +39,7 @@ function ResizeTooltip(_ref, ref) {
39
39
  fadeTimeout = 180,
40
40
  isVisible = true,
41
41
  labelRef,
42
- onResize = _lodash.noop,
42
+ onResize = noop,
43
43
  position = _utils.POSITIONS.bottom,
44
44
  showPx = true,
45
45
  zIndex = 1000,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/resizable-box/resize-tooltip/index.tsx"],"names":["ResizeTooltip","ref","axis","className","fadeTimeout","isVisible","labelRef","onResize","noop","position","POSITIONS","bottom","showPx","zIndex","props","label","resizeListener","classes","ForwardedComponent"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAWA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AAkBA,SAASA,aAAT,OAaCC,GAbD,EAcsB;AAAA,MAbrB;AACCC,IAAAA,IADD;AAECC,IAAAA,SAFD;AAGCC,IAAAA,WAAW,GAAG,GAHf;AAICC,IAAAA,SAAS,GAAG,IAJb;AAKCC,IAAAA,QALD;AAMCC,IAAAA,QAAQ,GAAGC,YANZ;AAOCC,IAAAA,QAAQ,GAAGC,iBAAUC,MAPtB;AAQCC,IAAAA,MAAM,GAAG,IARV;AASCC,IAAAA,MAAM,GAAG,IATV;AAUC,OAAGC;AAVJ,GAaqB;AACrB,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAA4B,2BAAgB;AACjDd,IAAAA,IADiD;AAEjDE,IAAAA,WAFiD;AAGjDG,IAAAA,QAHiD;AAIjDK,IAAAA,MAJiD;AAKjDH,IAAAA;AALiD,GAAhB,CAAlC;AAQA,MAAK,CAAEJ,SAAP,EAAmB,OAAO,IAAP;AAEnB,QAAMY,OAAO,GAAG,yBAAY,2BAAZ,EAAyCd,SAAzC,CAAhB;AAEA,SACC,4BAAC,mBAAD;AAAM,mBAAY,MAAlB;AAAyB,IAAA,SAAS,EAAGc,OAArC;AAA+C,IAAA,GAAG,EAAGhB;AAArD,KAAgEa,KAAhE,GACGE,cADH,EAEC,4BAAC,cAAD;AACC,mBAAcF,KAAK,CAAE,aAAF,CADpB;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,QAAQ,EAAGN,QAHZ;AAIC,IAAA,GAAG,EAAGH,QAJP;AAKC,IAAA,MAAM,EAAGO;AALV,IAFD,CADD;AAYA;;AAED,MAAMK,kBAAkB,GAAG,yBAAYlB,aAAZ,CAA3B;eAEekB,kB","sourcesContent":["/**\n * External dependencies\n */\nimport { noop } from 'lodash';\nimport classnames from 'classnames';\nimport type { Ref, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Label from './label';\nimport { useResizeLabel, Axis, Position, POSITIONS } from './utils';\nimport { Root } from './styles/resize-tooltip.styles';\n\ntype ResizeTooltipProps = React.ComponentProps< typeof Root > & {\n\t'aria-hidden'?: boolean;\n\taxis?: Axis;\n\tclassName?: string;\n\tfadeTimeout?: number;\n\tisVisible?: boolean;\n\tlabelRef?: Ref< HTMLDivElement >;\n\tonResize?: Parameters< typeof useResizeLabel >[ 0 ][ 'onResize' ];\n\tposition?: Position;\n\tshowPx?: boolean;\n\tzIndex?: number;\n};\n\nfunction ResizeTooltip(\n\t{\n\t\taxis,\n\t\tclassName,\n\t\tfadeTimeout = 180,\n\t\tisVisible = true,\n\t\tlabelRef,\n\t\tonResize = noop,\n\t\tposition = POSITIONS.bottom,\n\t\tshowPx = true,\n\t\tzIndex = 1000,\n\t\t...props\n\t}: ResizeTooltipProps,\n\tref: ForwardedRef< HTMLDivElement >\n): JSX.Element | null {\n\tconst { label, resizeListener } = useResizeLabel( {\n\t\taxis,\n\t\tfadeTimeout,\n\t\tonResize,\n\t\tshowPx,\n\t\tposition,\n\t} );\n\n\tif ( ! isVisible ) return null;\n\n\tconst classes = classnames( 'components-resize-tooltip', className );\n\n\treturn (\n\t\t<Root aria-hidden=\"true\" className={ classes } ref={ ref } { ...props }>\n\t\t\t{ resizeListener }\n\t\t\t<Label\n\t\t\t\taria-hidden={ props[ 'aria-hidden' ] }\n\t\t\t\tlabel={ label }\n\t\t\t\tposition={ position }\n\t\t\t\tref={ labelRef }\n\t\t\t\tzIndex={ zIndex }\n\t\t\t/>\n\t\t</Root>\n\t);\n}\n\nconst ForwardedComponent = forwardRef( ResizeTooltip );\n\nexport default ForwardedComponent;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/resizable-box/resize-tooltip/index.tsx"],"names":["noop","ResizeTooltip","ref","axis","className","fadeTimeout","isVisible","labelRef","onResize","position","POSITIONS","bottom","showPx","zIndex","props","label","resizeListener","classes","ForwardedComponent"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAWA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AAkBA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,aAAT,OAaCC,GAbD,EAcsB;AAAA,MAbrB;AACCC,IAAAA,IADD;AAECC,IAAAA,SAFD;AAGCC,IAAAA,WAAW,GAAG,GAHf;AAICC,IAAAA,SAAS,GAAG,IAJb;AAKCC,IAAAA,QALD;AAMCC,IAAAA,QAAQ,GAAGR,IANZ;AAOCS,IAAAA,QAAQ,GAAGC,iBAAUC,MAPtB;AAQCC,IAAAA,MAAM,GAAG,IARV;AASCC,IAAAA,MAAM,GAAG,IATV;AAUC,OAAGC;AAVJ,GAaqB;AACrB,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAA4B,2BAAgB;AACjDb,IAAAA,IADiD;AAEjDE,IAAAA,WAFiD;AAGjDG,IAAAA,QAHiD;AAIjDI,IAAAA,MAJiD;AAKjDH,IAAAA;AALiD,GAAhB,CAAlC;AAQA,MAAK,CAAEH,SAAP,EAAmB,OAAO,IAAP;AAEnB,QAAMW,OAAO,GAAG,yBAAY,2BAAZ,EAAyCb,SAAzC,CAAhB;AAEA,SACC,4BAAC,mBAAD;AAAM,mBAAY,MAAlB;AAAyB,IAAA,SAAS,EAAGa,OAArC;AAA+C,IAAA,GAAG,EAAGf;AAArD,KAAgEY,KAAhE,GACGE,cADH,EAEC,4BAAC,cAAD;AACC,mBAAcF,KAAK,CAAE,aAAF,CADpB;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,QAAQ,EAAGN,QAHZ;AAIC,IAAA,GAAG,EAAGF,QAJP;AAKC,IAAA,MAAM,EAAGM;AALV,IAFD,CADD;AAYA;;AAED,MAAMK,kBAAkB,GAAG,yBAAYjB,aAAZ,CAA3B;eAEeiB,kB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { Ref, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Label from './label';\nimport { useResizeLabel, Axis, Position, POSITIONS } from './utils';\nimport { Root } from './styles/resize-tooltip.styles';\n\ntype ResizeTooltipProps = React.ComponentProps< typeof Root > & {\n\t'aria-hidden'?: boolean;\n\taxis?: Axis;\n\tclassName?: string;\n\tfadeTimeout?: number;\n\tisVisible?: boolean;\n\tlabelRef?: Ref< HTMLDivElement >;\n\tonResize?: Parameters< typeof useResizeLabel >[ 0 ][ 'onResize' ];\n\tposition?: Position;\n\tshowPx?: boolean;\n\tzIndex?: number;\n};\n\nconst noop = () => {};\n\nfunction ResizeTooltip(\n\t{\n\t\taxis,\n\t\tclassName,\n\t\tfadeTimeout = 180,\n\t\tisVisible = true,\n\t\tlabelRef,\n\t\tonResize = noop,\n\t\tposition = POSITIONS.bottom,\n\t\tshowPx = true,\n\t\tzIndex = 1000,\n\t\t...props\n\t}: ResizeTooltipProps,\n\tref: ForwardedRef< HTMLDivElement >\n): JSX.Element | null {\n\tconst { label, resizeListener } = useResizeLabel( {\n\t\taxis,\n\t\tfadeTimeout,\n\t\tonResize,\n\t\tshowPx,\n\t\tposition,\n\t} );\n\n\tif ( ! isVisible ) return null;\n\n\tconst classes = classnames( 'components-resize-tooltip', className );\n\n\treturn (\n\t\t<Root aria-hidden=\"true\" className={ classes } ref={ ref } { ...props }>\n\t\t\t{ resizeListener }\n\t\t\t<Label\n\t\t\t\taria-hidden={ props[ 'aria-hidden' ] }\n\t\t\t\tlabel={ label }\n\t\t\t\tposition={ position }\n\t\t\t\tref={ labelRef }\n\t\t\t\tzIndex={ zIndex }\n\t\t\t/>\n\t\t</Root>\n\t);\n}\n\nconst ForwardedComponent = forwardRef( ResizeTooltip );\n\nexport default ForwardedComponent;\n"]}
@@ -6,16 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.POSITIONS = void 0;
7
7
  exports.useResizeLabel = useResizeLabel;
8
8
 
9
- var _lodash = require("lodash");
10
-
11
9
  var _element = require("@wordpress/element");
12
10
 
13
11
  var _compose = require("@wordpress/compose");
14
12
 
15
- /**
16
- * External dependencies
17
- */
18
-
19
13
  /**
20
14
  * WordPress dependencies
21
15
  */
@@ -23,6 +17,9 @@ const {
23
17
  clearTimeout,
24
18
  setTimeout
25
19
  } = window;
20
+
21
+ const noop = () => {};
22
+
26
23
  const POSITIONS = {
27
24
  bottom: 'bottom',
28
25
  corner: 'corner'
@@ -46,7 +43,7 @@ function useResizeLabel(_ref) {
46
43
  let {
47
44
  axis,
48
45
  fadeTimeout = 180,
49
- onResize = _lodash.noop,
46
+ onResize = noop,
50
47
  position = POSITIONS.bottom,
51
48
  showPx = false
52
49
  } = _ref;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/resizable-box/resize-tooltip/utils.ts"],"names":["clearTimeout","setTimeout","window","POSITIONS","bottom","corner","useResizeLabel","axis","fadeTimeout","onResize","noop","position","showPx","resizeListener","sizes","isAxisControlled","moveX","setMoveX","moveY","setMoveY","width","height","heightRef","widthRef","moveTimeoutRef","unsetMoveXY","debounceUnsetMoveXY","current","isRendered","didWidthChange","didHeightChange","label","getSizeLabel","undefined","labelUnit"],"mappings":";;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA,YAAF;AAAgBC,EAAAA;AAAhB,IAA+BC,MAArC;AAIO,MAAMC,SAAS,GAAG;AACxBC,EAAAA,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ies\n */\nimport { noop } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useResizeObserver } from '@wordpress/compose';\n\nconst { clearTimeout, setTimeout } = window;\n\nexport type Axis = 'x' | 'y';\n\nexport const POSITIONS = {\n\tbottom: 'bottom',\n\tcorner: 'corner',\n} as const;\n\nexport type Position = typeof POSITIONS[ keyof typeof POSITIONS ];\n\ninterface UseResizeLabelProps {\n\t/** The label value. */\n\tlabel?: string;\n\t/** Element to be rendered for resize listening events. */\n\tresizeListener: JSX.Element;\n}\n\ninterface UseResizeLabelArgs {\n\taxis?: Axis;\n\tfadeTimeout: number;\n\tonResize( data: { width: number | null; height: number | null } ): void;\n\tposition: Position;\n\tshowPx: boolean;\n}\n\n/**\n * Custom hook that manages resize listener events. It also provides a label\n * based on current resize width x height values.\n *\n * @param props\n * @param props.axis Only shows the label corresponding to the axis.\n * @param props.fadeTimeout Duration (ms) before deactivating the resize label.\n * @param props.onResize Callback when a resize occurs. Provides { width, height } callback.\n * @param props.position Adjusts label value.\n * @param props.showPx Whether to add `PX` to the label.\n *\n * @return Properties for hook.\n */\nexport function useResizeLabel( {\n\taxis,\n\tfadeTimeout = 180,\n\tonResize = noop,\n\tposition = POSITIONS.bottom,\n\tshowPx = false,\n}: UseResizeLabelArgs ): UseResizeLabelProps {\n\t/*\n\t * The width/height values derive from this special useResizeObserver hook.\n\t * This custom hook uses the ResizeObserver API to listen for resize events.\n\t */\n\tconst [ resizeListener, sizes ] = useResizeObserver();\n\n\t/*\n\t * Indicates if the x/y axis is preferred.\n\t * If set, we will avoid resetting the moveX and moveY values.\n\t * This will allow for the preferred axis values to persist in the label.\n\t */\n\tconst isAxisControlled = !! axis;\n\n\t/*\n\t * The moveX and moveY values are used to track whether the label should\n\t * display width, height, or width x height.\n\t */\n\tconst [ moveX, setMoveX ] = useState( false );\n\tconst [ moveY, setMoveY ] = useState( false );\n\n\t/*\n\t * Cached dimension values to check for width/height updates from the\n\t * sizes property from useResizeAware()\n\t */\n\tconst { width, height } = sizes;\n\tconst heightRef = useRef( height );\n\tconst widthRef = useRef( width );\n\n\t/*\n\t * This timeout is used with setMoveX and setMoveY to determine of\n\t * both width and height values have changed at (roughly) the same time.\n\t */\n\tconst moveTimeoutRef = useRef< number >();\n\n\tconst unsetMoveXY = () => {\n\t\t/*\n\t\t * If axis is controlled, we will avoid resetting the moveX and moveY values.\n\t\t * This will allow for the preferred axis values to persist in the label.\n\t\t */\n\t\tif ( isAxisControlled ) return;\n\t\tsetMoveX( false );\n\t\tsetMoveY( false );\n\t};\n\n\tconst debounceUnsetMoveXY = () => {\n\t\tif ( moveTimeoutRef.current ) {\n\t\t\tclearTimeout( moveTimeoutRef.current );\n\t\t}\n\n\t\tmoveTimeoutRef.current = setTimeout( unsetMoveXY, fadeTimeout );\n\t};\n\n\tuseEffect( () => {\n\t\t/*\n\t\t * On the initial render of useResizeAware, the height and width values are\n\t\t * null. They are calculated then set using via an internal useEffect hook.\n\t\t */\n\t\tconst isRendered = width !== null || height !== null;\n\n\t\tif ( ! isRendered ) return;\n\n\t\tconst didWidthChange = width !== widthRef.current;\n\t\tconst didHeightChange = height !== heightRef.current;\n\n\t\tif ( ! didWidthChange && ! didHeightChange ) return;\n\n\t\t/*\n\t\t * After the initial render, the useResizeAware will set the first\n\t\t * width and height values. We'll sync those values with our\n\t\t * width and height refs. However, we shouldn't render our Tooltip\n\t\t * label on this first cycle.\n\t\t */\n\t\tif ( width && ! widthRef.current && height && ! heightRef.current ) {\n\t\t\twidthRef.current = width;\n\t\t\theightRef.current = height;\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * After the first cycle, we can track width and height changes.\n\t\t */\n\t\tif ( didWidthChange ) {\n\t\t\tsetMoveX( true );\n\t\t\twidthRef.current = width;\n\t\t}\n\n\t\tif ( didHeightChange ) {\n\t\t\tsetMoveY( true );\n\t\t\theightRef.current = height;\n\t\t}\n\n\t\tonResize( { width, height } );\n\t\tdebounceUnsetMoveXY();\n\t}, [ width, height ] );\n\n\tconst label = getSizeLabel( {\n\t\taxis,\n\t\theight,\n\t\tmoveX,\n\t\tmoveY,\n\t\tposition,\n\t\tshowPx,\n\t\twidth,\n\t} );\n\n\treturn {\n\t\tlabel,\n\t\tresizeListener,\n\t};\n}\n\ninterface GetSizeLabelArgs {\n\taxis?: Axis;\n\theight: number | null;\n\tmoveX: boolean;\n\tmoveY: boolean;\n\tposition: Position;\n\tshowPx: boolean;\n\twidth: number | null;\n}\n\n/**\n * Gets the resize label based on width and height values (as well as recent changes).\n *\n * @param props\n * @param props.axis Only shows the label corresponding to the axis.\n * @param props.height Height value.\n * @param props.moveX Recent width (x axis) changes.\n * @param props.moveY Recent width (y axis) changes.\n * @param props.position Adjusts label value.\n * @param props.showPx Whether to add `PX` to the label.\n * @param props.width Width value.\n *\n * @return The rendered label.\n */\nfunction getSizeLabel( {\n\taxis,\n\theight,\n\tmoveX = false,\n\tmoveY = false,\n\tposition = POSITIONS.bottom,\n\tshowPx = false,\n\twidth,\n}: GetSizeLabelArgs ): string | undefined {\n\tif ( ! moveX && ! moveY ) return undefined;\n\n\t/*\n\t * Corner position...\n\t * We want the label to appear like width x height.\n\t */\n\tif ( position === POSITIONS.corner ) {\n\t\treturn `${ width } x ${ height }`;\n\t}\n\n\t/*\n\t * Other POSITIONS...\n\t * The label will combine both width x height values if both\n\t * values have recently been changed.\n\t *\n\t * Otherwise, only width or height will be displayed.\n\t * The `PX` unit will be added, if specified by the `showPx` prop.\n\t */\n\tconst labelUnit = showPx ? ' px' : '';\n\n\tif ( axis ) {\n\t\tif ( axis === 'x' && moveX ) {\n\t\t\treturn `${ width }${ labelUnit }`;\n\t\t}\n\t\tif ( axis === 'y' && moveY ) {\n\t\t\treturn `${ height }${ labelUnit }`;\n\t\t}\n\t}\n\n\tif ( moveX && moveY ) {\n\t\treturn `${ width } x ${ height }`;\n\t}\n\tif ( moveX ) {\n\t\treturn `${ width }${ labelUnit }`;\n\t}\n\tif ( moveY ) {\n\t\treturn `${ height }${ labelUnit }`;\n\t}\n\n\treturn undefined;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/resizable-box/resize-tooltip/utils.ts"],"names":["clearTimeout","setTimeout","window","noop","POSITIONS","bottom","corner","useResizeLabel","axis","fadeTimeout","onResize","position","showPx","resizeListener","sizes","isAxisControlled","moveX","setMoveX","moveY","setMoveY","width","height","heightRef","widthRef","moveTimeoutRef","unsetMoveXY","debounceUnsetMoveXY","current","isRendered","didWidthChange","didHeightChange","label","getSizeLabel","undefined","labelUnit"],"mappings":";;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA,YAAF;AAAgBC,EAAAA;AAAhB,IAA+BC,MAArC;;AACA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAIO,MAAMC,SAAS,GAAG;AACxBC,EAAAA,MAAM,EAAE,QADgB;AAExBC,EAAAA,MAAM,EAAE;AAFgB,CAAlB;;;AAsBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAT,OAMsC;AAAA,MANb;AAC/BC,IAAAA,IAD+B;AAE/BC,IAAAA,WAAW,GAAG,GAFiB;AAG/BC,IAAAA,QAAQ,GAAGP,IAHoB;AAI/BQ,IAAAA,QAAQ,GAAGP,SAAS,CAACC,MAJU;AAK/BO,IAAAA,MAAM,GAAG;AALsB,GAMa;;AAC5C;AACD;AACA;AACA;AACC,QAAM,CAAEC,cAAF,EAAkBC,KAAlB,IAA4B,iCAAlC;AAEA;AACD;AACA;AACA;AACA;;AACC,QAAMC,gBAAgB,GAAG,CAAC,CAAEP,IAA5B;AAEA;AACD;AACA;AACA;;AACC,QAAM,CAAEQ,KAAF,EAASC,QAAT,IAAsB,uBAAU,KAAV,CAA5B;AACA,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,uBAAU,KAAV,CAA5B;AAEA;AACD;AACA;AACA;;AACC,QAAM;AA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AAW,EAAnC;;AAEA,MAAKJ,IAAL,EAAY;AACX,QAAKA,IAAI,KAAK,GAAT,IAAgBQ,KAArB,EAA6B;AAC5B,aAAQ,GAAGI,KAAO,GAAGc,SAAW,EAAhC;AACA;;AACD,QAAK1B,IAAI,KAAK,GAAT,IAAgBU,KAArB,EAA6B;AAC5B,aAAQ,GAAGG,MAAQ,GAAGa,SAAW,EAAjC;AACA;AACD;;AAED,MAAKlB,KAAK,IAAIE,KAAd,EAAsB;AACrB,WAAQ,GAAGE,KAAO,MAAMC,MAAQ,EAAhC;AACA;;AACD,MAAKL,KAAL,EAAa;AACZ,WAAQ,GAAGI,KAAO,GAAGc,SAAW,EAAhC;AACA;;AACD,MAAKhB,KAAL,EAAa;AACZ,WAAQ,GAAGG,MAAQ,GAAGa,SAAW,EAAjC;AACA;;AAED,SAAOD,SAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useResizeObserver } from '@wordpress/compose';\n\nconst { clearTimeout, setTimeout } = window;\nconst noop = () => {};\n\nexport type Axis = 'x' | 'y';\n\nexport const POSITIONS = {\n\tbottom: 'bottom',\n\tcorner: 'corner',\n} as const;\n\nexport type Position = typeof POSITIONS[ keyof typeof POSITIONS ];\n\ninterface UseResizeLabelProps {\n\t/** The label value. */\n\tlabel?: string;\n\t/** Element to be rendered for resize listening events. */\n\tresizeListener: JSX.Element;\n}\n\ninterface UseResizeLabelArgs {\n\taxis?: Axis;\n\tfadeTimeout: number;\n\tonResize( data: { width: number | null; height: number | null } ): void;\n\tposition: Position;\n\tshowPx: boolean;\n}\n\n/**\n * Custom hook that manages resize listener events. It also provides a label\n * based on current resize width x height values.\n *\n * @param props\n * @param props.axis Only shows the label corresponding to the axis.\n * @param props.fadeTimeout Duration (ms) before deactivating the resize label.\n * @param props.onResize Callback when a resize occurs. Provides { width, height } callback.\n * @param props.position Adjusts label value.\n * @param props.showPx Whether to add `PX` to the label.\n *\n * @return Properties for hook.\n */\nexport function useResizeLabel( {\n\taxis,\n\tfadeTimeout = 180,\n\tonResize = noop,\n\tposition = POSITIONS.bottom,\n\tshowPx = false,\n}: UseResizeLabelArgs ): UseResizeLabelProps {\n\t/*\n\t * The width/height values derive from this special useResizeObserver hook.\n\t * This custom hook uses the ResizeObserver API to listen for resize events.\n\t */\n\tconst [ resizeListener, sizes ] = useResizeObserver();\n\n\t/*\n\t * Indicates if the x/y axis is preferred.\n\t * If set, we will avoid resetting the moveX and moveY values.\n\t * This will allow for the preferred axis values to persist in the label.\n\t */\n\tconst isAxisControlled = !! axis;\n\n\t/*\n\t * The moveX and moveY values are used to track whether the label should\n\t * display width, height, or width x height.\n\t */\n\tconst [ moveX, setMoveX ] = useState( false );\n\tconst [ moveY, setMoveY ] = useState( false );\n\n\t/*\n\t * Cached dimension values to check for width/height updates from the\n\t * sizes property from useResizeAware()\n\t */\n\tconst { width, height } = sizes;\n\tconst heightRef = useRef( height );\n\tconst widthRef = useRef( width );\n\n\t/*\n\t * This timeout is used with setMoveX and setMoveY to determine of\n\t * both width and height values have changed at (roughly) the same time.\n\t */\n\tconst moveTimeoutRef = useRef< number >();\n\n\tconst unsetMoveXY = () => {\n\t\t/*\n\t\t * If axis is controlled, we will avoid resetting the moveX and moveY values.\n\t\t * This will allow for the preferred axis values to persist in the label.\n\t\t */\n\t\tif ( isAxisControlled ) return;\n\t\tsetMoveX( false );\n\t\tsetMoveY( false );\n\t};\n\n\tconst debounceUnsetMoveXY = () => {\n\t\tif ( moveTimeoutRef.current ) {\n\t\t\tclearTimeout( moveTimeoutRef.current );\n\t\t}\n\n\t\tmoveTimeoutRef.current = setTimeout( unsetMoveXY, fadeTimeout );\n\t};\n\n\tuseEffect( () => {\n\t\t/*\n\t\t * On the initial render of useResizeAware, the height and width values are\n\t\t * null. They are calculated then set using via an internal useEffect hook.\n\t\t */\n\t\tconst isRendered = width !== null || height !== null;\n\n\t\tif ( ! isRendered ) return;\n\n\t\tconst didWidthChange = width !== widthRef.current;\n\t\tconst didHeightChange = height !== heightRef.current;\n\n\t\tif ( ! didWidthChange && ! didHeightChange ) return;\n\n\t\t/*\n\t\t * After the initial render, the useResizeAware will set the first\n\t\t * width and height values. We'll sync those values with our\n\t\t * width and height refs. However, we shouldn't render our Tooltip\n\t\t * label on this first cycle.\n\t\t */\n\t\tif ( width && ! widthRef.current && height && ! heightRef.current ) {\n\t\t\twidthRef.current = width;\n\t\t\theightRef.current = height;\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * After the first cycle, we can track width and height changes.\n\t\t */\n\t\tif ( didWidthChange ) {\n\t\t\tsetMoveX( true );\n\t\t\twidthRef.current = width;\n\t\t}\n\n\t\tif ( didHeightChange ) {\n\t\t\tsetMoveY( true );\n\t\t\theightRef.current = height;\n\t\t}\n\n\t\tonResize( { width, height } );\n\t\tdebounceUnsetMoveXY();\n\t}, [ width, height ] );\n\n\tconst label = getSizeLabel( {\n\t\taxis,\n\t\theight,\n\t\tmoveX,\n\t\tmoveY,\n\t\tposition,\n\t\tshowPx,\n\t\twidth,\n\t} );\n\n\treturn {\n\t\tlabel,\n\t\tresizeListener,\n\t};\n}\n\ninterface GetSizeLabelArgs {\n\taxis?: Axis;\n\theight: number | null;\n\tmoveX: boolean;\n\tmoveY: boolean;\n\tposition: Position;\n\tshowPx: boolean;\n\twidth: number | null;\n}\n\n/**\n * Gets the resize label based on width and height values (as well as recent changes).\n *\n * @param props\n * @param props.axis Only shows the label corresponding to the axis.\n * @param props.height Height value.\n * @param props.moveX Recent width (x axis) changes.\n * @param props.moveY Recent width (y axis) changes.\n * @param props.position Adjusts label value.\n * @param props.showPx Whether to add `PX` to the label.\n * @param props.width Width value.\n *\n * @return The rendered label.\n */\nfunction getSizeLabel( {\n\taxis,\n\theight,\n\tmoveX = false,\n\tmoveY = false,\n\tposition = POSITIONS.bottom,\n\tshowPx = false,\n\twidth,\n}: GetSizeLabelArgs ): string | undefined {\n\tif ( ! moveX && ! moveY ) return undefined;\n\n\t/*\n\t * Corner position...\n\t * We want the label to appear like width x height.\n\t */\n\tif ( position === POSITIONS.corner ) {\n\t\treturn `${ width } x ${ height }`;\n\t}\n\n\t/*\n\t * Other POSITIONS...\n\t * The label will combine both width x height values if both\n\t * values have recently been changed.\n\t *\n\t * Otherwise, only width or height will be displayed.\n\t * The `PX` unit will be added, if specified by the `showPx` prop.\n\t */\n\tconst labelUnit = showPx ? ' px' : '';\n\n\tif ( axis ) {\n\t\tif ( axis === 'x' && moveX ) {\n\t\t\treturn `${ width }${ labelUnit }`;\n\t\t}\n\t\tif ( axis === 'y' && moveY ) {\n\t\t\treturn `${ height }${ labelUnit }`;\n\t\t}\n\t}\n\n\tif ( moveX && moveY ) {\n\t\treturn `${ width } x ${ height }`;\n\t}\n\tif ( moveX ) {\n\t\treturn `${ width }${ labelUnit }`;\n\t}\n\tif ( moveY ) {\n\t\treturn `${ height }${ labelUnit }`;\n\t}\n\n\treturn undefined;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/responsive-wrapper/index.js"],"names":["ResponsiveWrapper","naturalWidth","naturalHeight","children","isInline","containerResizeListener","width","containerWidth","Children","count","imageStyle","paddingBottom","TagName","className","props"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,iBAAT,OAKI;AAAA,MALwB;AAC3BC,IAAAA,YAD2B;AAE3BC,IAAAA,aAF2B;AAG3BC,IAAAA,QAH2B;AAI3BC,IAAAA,QAAQ,GAAG;AAJgB,GAKxB;AACH,QAAM,CACLC,uBADK,EAEL;AAAEC,IAAAA,KAAK,EAAEC;AAAT,GAFK,IAGF,iCAHJ;;AAIA,MAAKC,kBAASC,KAAT,CAAgBN,QAAhB,MAA+B,CAApC,EAAwC;AACvC,WAAO,IAAP;AACA;;AACD,QAAMO,UAAU,GAAG;AAClBC,IAAAA,aAAa,EACZV,YAAY,GAAGM,cAAf,GACGL,aADH,GAEKA,aAAa,GAAGD,YAAlB,GAAmC,GAAnC,GAAyC;AAJ3B,GAAnB;AAMA,QAAMW,OAAO,GAAGR,QAAQ,GAAG,MAAH,GAAY,KAApC;AACA,SACC,4BAAC,OAAD;AAAS,IAAA,SAAS,EAAC;AAAnB,KACGC,uBADH,EAEC,4BAAC,OAAD;AAAS,IAAA,KAAK,EAAGK;AAAjB,IAFD,EAGG,2BAAcP,QAAd,EAAwB;AACzBU,IAAAA,SAAS,EAAE,yBACV,wCADU,EAEVV,QAAQ,CAACW,KAAT,CAAeD,SAFL;AADc,GAAxB,CAHH,CADD;AAYA;;eAEcb,iB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { cloneElement, Children } from '@wordpress/element';\nimport { useResizeObserver } from '@wordpress/compose';\n\nfunction ResponsiveWrapper( {\n\tnaturalWidth,\n\tnaturalHeight,\n\tchildren,\n\tisInline = false,\n} ) {\n\tconst [\n\t\tcontainerResizeListener,\n\t\t{ width: containerWidth },\n\t] = useResizeObserver();\n\tif ( Children.count( children ) !== 1 ) {\n\t\treturn null;\n\t}\n\tconst imageStyle = {\n\t\tpaddingBottom:\n\t\t\tnaturalWidth < containerWidth\n\t\t\t\t? naturalHeight\n\t\t\t\t: ( naturalHeight / naturalWidth ) * 100 + '%',\n\t};\n\tconst TagName = isInline ? 'span' : 'div';\n\treturn (\n\t\t<TagName className=\"components-responsive-wrapper\">\n\t\t\t{ containerResizeListener }\n\t\t\t<TagName style={ imageStyle } />\n\t\t\t{ cloneElement( children, {\n\t\t\t\tclassName: classnames(\n\t\t\t\t\t'components-responsive-wrapper__content',\n\t\t\t\t\tchildren.props.className\n\t\t\t\t),\n\t\t\t} ) }\n\t\t</TagName>\n\t);\n}\n\nexport default ResponsiveWrapper;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/responsive-wrapper/index.js"],"names":["ResponsiveWrapper","naturalWidth","naturalHeight","children","isInline","containerResizeListener","width","containerWidth","Children","count","imageStyle","paddingBottom","TagName","className","props"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,iBAAT,OAKI;AAAA,MALwB;AAC3BC,IAAAA,YAD2B;AAE3BC,IAAAA,aAF2B;AAG3BC,IAAAA,QAH2B;AAI3BC,IAAAA,QAAQ,GAAG;AAJgB,GAKxB;AACH,QAAM,CAAEC,uBAAF,EAA2B;AAAEC,IAAAA,KAAK,EAAEC;AAAT,GAA3B,IACL,iCADD;;AAEA,MAAKC,kBAASC,KAAT,CAAgBN,QAAhB,MAA+B,CAApC,EAAwC;AACvC,WAAO,IAAP;AACA;;AACD,QAAMO,UAAU,GAAG;AAClBC,IAAAA,aAAa,EACZV,YAAY,GAAGM,cAAf,GACGL,aADH,GAEKA,aAAa,GAAGD,YAAlB,GAAmC,GAAnC,GAAyC;AAJ3B,GAAnB;AAMA,QAAMW,OAAO,GAAGR,QAAQ,GAAG,MAAH,GAAY,KAApC;AACA,SACC,4BAAC,OAAD;AAAS,IAAA,SAAS,EAAC;AAAnB,KACGC,uBADH,EAEC,4BAAC,OAAD;AAAS,IAAA,KAAK,EAAGK;AAAjB,IAFD,EAGG,2BAAcP,QAAd,EAAwB;AACzBU,IAAAA,SAAS,EAAE,yBACV,wCADU,EAEVV,QAAQ,CAACW,KAAT,CAAeD,SAFL;AADc,GAAxB,CAHH,CADD;AAYA;;eAEcb,iB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { cloneElement, Children } from '@wordpress/element';\nimport { useResizeObserver } from '@wordpress/compose';\n\nfunction ResponsiveWrapper( {\n\tnaturalWidth,\n\tnaturalHeight,\n\tchildren,\n\tisInline = false,\n} ) {\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\tif ( Children.count( children ) !== 1 ) {\n\t\treturn null;\n\t}\n\tconst imageStyle = {\n\t\tpaddingBottom:\n\t\t\tnaturalWidth < containerWidth\n\t\t\t\t? naturalHeight\n\t\t\t\t: ( naturalHeight / naturalWidth ) * 100 + '%',\n\t};\n\tconst TagName = isInline ? 'span' : 'div';\n\treturn (\n\t\t<TagName className=\"components-responsive-wrapper\">\n\t\t\t{ containerResizeListener }\n\t\t\t<TagName style={ imageStyle } />\n\t\t\t{ cloneElement( children, {\n\t\t\t\tclassName: classnames(\n\t\t\t\t\t'components-responsive-wrapper__content',\n\t\t\t\t\tchildren.props.className\n\t\t\t\t),\n\t\t\t} ) }\n\t\t</TagName>\n\t);\n}\n\nexport default ResponsiveWrapper;\n"]}
@@ -36,6 +36,8 @@ var _selectControlStyles = require("./styles/select-control-styles");
36
36
  /**
37
37
  * Internal dependencies
38
38
  */
39
+ const noop = () => {};
40
+
39
41
  function useUniqueId(idProp) {
40
42
  const instanceId = (0, _compose.useInstanceId)(SelectControl);
41
43
  const id = `inspector-select-control-${instanceId}`;
@@ -51,9 +53,9 @@ function UnforwardedSelectControl(_ref, ref) {
51
53
  id: idProp,
52
54
  label,
53
55
  multiple = false,
54
- onBlur = _lodash.noop,
55
- onChange = _lodash.noop,
56
- onFocus = _lodash.noop,
56
+ onBlur = noop,
57
+ onChange = noop,
58
+ onFocus = noop,
57
59
  options = [],
58
60
  size = 'default',
59
61
  value: valueProp,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/select-control/index.tsx"],"names":["useUniqueId","idProp","instanceId","SelectControl","id","UnforwardedSelectControl","ref","className","disabled","help","hideLabelFromVision","label","multiple","onBlur","noop","onChange","onFocus","options","size","value","valueProp","labelPosition","children","prefix","suffix","__nextHasNoMarginBottom","props","isFocused","setIsFocused","helpId","undefined","handleOnBlur","event","handleOnFocus","handleOnChange","selectedOptions","Array","from","target","filter","selected","newValues","map","classes","chevronDown","option","index","key"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AACA;;AAMA;;AAEA;;AAKA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAKA;AACA;AACA;;A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;AAeC,IAAA,MAAM,EAAGrB,MAfV;AAgBC,IAAA,aAAa,EAAGF;AAhBjB,KAkBC,4BAAC,2BAAD,6BACMK,KADN;AAEC,wBAAmBG,MAFpB;AAGC,IAAA,SAAS,EAAC,kCAHX;AAIC,IAAA,QAAQ,EAAGrB,QAJZ;AAKC,IAAA,EAAE,EAAGJ,EALN;AAMC,IAAA,QAAQ,EAAGQ,QANZ;AAOC,IAAA,MAAM,EAAGmB,YAPV;AAQC,IAAA,QAAQ,EAAGG,cARZ;AASC,IAAA,OAAO,EAAGD,aATX;AAUC,IAAA,GAAG,EAAG3B,GAVP;AAWC,IAAA,UAAU,EAAGY,IAXd;AAYC,IAAA,KAAK,EAAGE;AAZT,MAcGE,QAAQ,IACTL,OAAO,CAACyB,GAAR,CAAa,CAAEG,MAAF,EAAUC,KAAV,KAAqB;AACjC,UAAMC,GAAG,GACRF,MAAM,CAACzC,EAAP,IACC,GAAGyC,MAAM,CAAClC,KAAO,IAAIkC,MAAM,CAAC1B,KAAO,IAAI2B,KAAO,EAFhD;AAIA,WACC;AACC,MAAA,GAAG,EAAGC,GADP;AAEC,MAAA,KAAK,EAAGF,MAAM,CAAC1B,KAFhB;AAGC,MAAA,QAAQ,EAAG0B,MAAM,CAACrC;AAHnB,OAKGqC,MAAM,CAAClC,KALV,CADD;AASA,GAdD,CAfF,CAlBD,CALD,CADD;AA0DA;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMR,aAAa,GAAG,yBAAYE,wBAAZ,CAAtB;;eAEQF,a","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, noop } from 'lodash';\nimport classNames from 'classnames';\nimport type { ChangeEvent, FocusEvent, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useState, forwardRef } from '@wordpress/element';\nimport { Icon, chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport InputBase from '../input-control/input-base';\nimport { Select, DownArrowWrapper } from './styles/select-control-styles';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { SelectControlProps } from './types';\n\nfunction useUniqueId( idProp?: string ) {\n\tconst instanceId = useInstanceId( SelectControl );\n\tconst id = `inspector-select-control-${ instanceId }`;\n\n\treturn idProp || id;\n}\n\nfunction UnforwardedSelectControl(\n\t{\n\t\tclassName,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision,\n\t\tid: idProp,\n\t\tlabel,\n\t\tmultiple = false,\n\t\tonBlur = noop,\n\t\tonChange = noop,\n\t\tonFocus = noop,\n\t\toptions = [],\n\t\tsize = 'default',\n\t\tvalue: valueProp,\n\t\tlabelPosition = 'top',\n\t\tchildren,\n\t\tprefix,\n\t\tsuffix,\n\t\t__nextHasNoMarginBottom = false,\n\t\t...props\n\t}: WordPressComponentProps< SelectControlProps, 'select', false >,\n\tref: ForwardedRef< HTMLSelectElement >\n) {\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\tconst id = useUniqueId( idProp );\n\tconst helpId = help ? `${ id }__help` : undefined;\n\n\t// Disable reason: A select with an onchange throws a warning.\n\tif ( isEmpty( options ) && ! children ) return null;\n\n\tconst handleOnBlur = ( event: FocusEvent< HTMLSelectElement > ) => {\n\t\tonBlur( event );\n\t\tsetIsFocused( false );\n\t};\n\n\tconst handleOnFocus = ( event: FocusEvent< HTMLSelectElement > ) => {\n\t\tonFocus( event );\n\t\tsetIsFocused( true );\n\t};\n\n\tconst handleOnChange = ( event: ChangeEvent< HTMLSelectElement > ) => {\n\t\tif ( multiple ) {\n\t\t\tconst selectedOptions = Array.from( event.target.options ).filter(\n\t\t\t\t( { selected } ) => selected\n\t\t\t);\n\t\t\tconst newValues = selectedOptions.map( ( { value } ) => value );\n\t\t\tonChange( newValues );\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( event.target.value, { event } );\n\t};\n\n\tconst classes = classNames( 'components-select-control', className );\n\n\t/* eslint-disable jsx-a11y/no-onchange */\n\treturn (\n\t\t<BaseControl\n\t\t\thelp={ help }\n\t\t\tid={ id }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t>\n\t\t\t<InputBase\n\t\t\t\tclassName={ classes }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\tid={ id }\n\t\t\t\tisFocused={ isFocused }\n\t\t\t\tlabel={ label }\n\t\t\t\tsize={ size }\n\t\t\t\tsuffix={\n\t\t\t\t\tsuffix || (\n\t\t\t\t\t\t<DownArrowWrapper>\n\t\t\t\t\t\t\t<Icon icon={ chevronDown } size={ 18 } />\n\t\t\t\t\t\t</DownArrowWrapper>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tprefix={ prefix }\n\t\t\t\tlabelPosition={ labelPosition }\n\t\t\t>\n\t\t\t\t<Select\n\t\t\t\t\t{ ...props }\n\t\t\t\t\taria-describedby={ helpId }\n\t\t\t\t\tclassName=\"components-select-control__input\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\tid={ id }\n\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tselectSize={ size }\n\t\t\t\t\tvalue={ valueProp }\n\t\t\t\t>\n\t\t\t\t\t{ children ||\n\t\t\t\t\t\toptions.map( ( option, index ) => {\n\t\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\t\toption.id ||\n\t\t\t\t\t\t\t\t`${ option.label }-${ option.value }-${ index }`;\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<option\n\t\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\t\t\tdisabled={ option.disabled }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ option.label }\n\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t</Select>\n\t\t\t</InputBase>\n\t\t</BaseControl>\n\t);\n\t/* eslint-enable jsx-a11y/no-onchange */\n}\n\n/**\n * `SelectControl` allows users to select from a single or multiple option menu.\n * It functions as a wrapper around the browser's native `<select>` element.\n *\n * @example\n * import { SelectControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MySelectControl = () => {\n * const [ size, setSize ] = useState( '50%' );\n *\n * return (\n * <SelectControl\n * label=\"Size\"\n * value={ size }\n * options={ [\n * { label: 'Big', value: '100%' },\n * { label: 'Medium', value: '50%' },\n * { label: 'Small', value: '25%' },\n * ] }\n * onChange={ setSize }\n * />\n * );\n * };\n */\nexport const SelectControl = forwardRef( UnforwardedSelectControl );\n\nexport default SelectControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/select-control/index.tsx"],"names":["noop","useUniqueId","idProp","instanceId","SelectControl","id","UnforwardedSelectControl","ref","className","disabled","help","hideLabelFromVision","label","multiple","onBlur","onChange","onFocus","options","size","value","valueProp","labelPosition","children","prefix","suffix","__nextHasNoMarginBottom","props","isFocused","setIsFocused","helpId","undefined","handleOnBlur","event","handleOnFocus","handleOnChange","selectedOptions","Array","from","target","filter","selected","newValues","map","classes","chevronDown","option","index","key"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AACA;;AAMA;;AAEA;;AAKA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAKA;AACA;AACA;;AAKA;AACA;AACA;AAOA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,WAAT,CAAsBC,MAAtB,EAAwC;AACvC,QAAMC,UAAU,GAAG,4BAAeC,aAAf,CAAnB;AACA,QAAMC,EAAE,GAAI,4BAA4BF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A,SAAS,EAAC,kCAHX;AAIC,IAAA,QAAQ,EAAGpB,QAJZ;AAKC,IAAA,EAAE,EAAGJ,EALN;AAMC,IAAA,QAAQ,EAAGQ,QANZ;AAOC,IAAA,MAAM,EAAGkB,YAPV;AAQC,IAAA,QAAQ,EAAGG,cARZ;AASC,IAAA,OAAO,EAAGD,aATX;AAUC,IAAA,GAAG,EAAG1B,GAVP;AAWC,IAAA,UAAU,EAAGW,IAXd;AAYC,IAAA,KAAK,EAAGE;AAZT,MAcGE,QAAQ,IACTL,OAAO,CAACyB,GAAR,CAAa,CAAEG,MAAF,EAAUC,KAAV,KAAqB;AACjC,UAAMC,GAAG,GACRF,MAAM,CAACxC,EAAP,IACC,GAAGwC,MAAM,CAACjC,KAAO,IAAIiC,MAAM,CAAC1B,KAAO,IAAI2B,KAAO,EAFhD;AAIA,WACC;AACC,MAAA,GAAG,EAAGC,GADP;AAEC,MAAA,KAAK,EAAGF,MAAM,CAAC1B,KAFhB;AAGC,MAAA,QAAQ,EAAG0B,MAAM,CAACpC;AAHnB,OAKGoC,MAAM,CAACjC,KALV,CADD;AASA,GAdD,CAfF,CAlBD,CALD,CADD;AA0DA;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMR,aAAa,GAAG,yBAAYE,wBAAZ,CAAtB;;eAEQF,a","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\nimport classNames from 'classnames';\nimport type { ChangeEvent, FocusEvent, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useState, forwardRef } from '@wordpress/element';\nimport { Icon, chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport InputBase from '../input-control/input-base';\nimport { Select, DownArrowWrapper } from './styles/select-control-styles';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { SelectControlProps } from './types';\n\nconst noop = () => {};\n\nfunction useUniqueId( idProp?: string ) {\n\tconst instanceId = useInstanceId( SelectControl );\n\tconst id = `inspector-select-control-${ instanceId }`;\n\n\treturn idProp || id;\n}\n\nfunction UnforwardedSelectControl(\n\t{\n\t\tclassName,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision,\n\t\tid: idProp,\n\t\tlabel,\n\t\tmultiple = false,\n\t\tonBlur = noop,\n\t\tonChange = noop,\n\t\tonFocus = noop,\n\t\toptions = [],\n\t\tsize = 'default',\n\t\tvalue: valueProp,\n\t\tlabelPosition = 'top',\n\t\tchildren,\n\t\tprefix,\n\t\tsuffix,\n\t\t__nextHasNoMarginBottom = false,\n\t\t...props\n\t}: WordPressComponentProps< SelectControlProps, 'select', false >,\n\tref: ForwardedRef< HTMLSelectElement >\n) {\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\tconst id = useUniqueId( idProp );\n\tconst helpId = help ? `${ id }__help` : undefined;\n\n\t// Disable reason: A select with an onchange throws a warning.\n\tif ( isEmpty( options ) && ! children ) return null;\n\n\tconst handleOnBlur = ( event: FocusEvent< HTMLSelectElement > ) => {\n\t\tonBlur( event );\n\t\tsetIsFocused( false );\n\t};\n\n\tconst handleOnFocus = ( event: FocusEvent< HTMLSelectElement > ) => {\n\t\tonFocus( event );\n\t\tsetIsFocused( true );\n\t};\n\n\tconst handleOnChange = ( event: ChangeEvent< HTMLSelectElement > ) => {\n\t\tif ( multiple ) {\n\t\t\tconst selectedOptions = Array.from( event.target.options ).filter(\n\t\t\t\t( { selected } ) => selected\n\t\t\t);\n\t\t\tconst newValues = selectedOptions.map( ( { value } ) => value );\n\t\t\tonChange( newValues );\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( event.target.value, { event } );\n\t};\n\n\tconst classes = classNames( 'components-select-control', className );\n\n\t/* eslint-disable jsx-a11y/no-onchange */\n\treturn (\n\t\t<BaseControl\n\t\t\thelp={ help }\n\t\t\tid={ id }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t>\n\t\t\t<InputBase\n\t\t\t\tclassName={ classes }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\tid={ id }\n\t\t\t\tisFocused={ isFocused }\n\t\t\t\tlabel={ label }\n\t\t\t\tsize={ size }\n\t\t\t\tsuffix={\n\t\t\t\t\tsuffix || (\n\t\t\t\t\t\t<DownArrowWrapper>\n\t\t\t\t\t\t\t<Icon icon={ chevronDown } size={ 18 } />\n\t\t\t\t\t\t</DownArrowWrapper>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tprefix={ prefix }\n\t\t\t\tlabelPosition={ labelPosition }\n\t\t\t>\n\t\t\t\t<Select\n\t\t\t\t\t{ ...props }\n\t\t\t\t\taria-describedby={ helpId }\n\t\t\t\t\tclassName=\"components-select-control__input\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\tid={ id }\n\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tselectSize={ size }\n\t\t\t\t\tvalue={ valueProp }\n\t\t\t\t>\n\t\t\t\t\t{ children ||\n\t\t\t\t\t\toptions.map( ( option, index ) => {\n\t\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\t\toption.id ||\n\t\t\t\t\t\t\t\t`${ option.label }-${ option.value }-${ index }`;\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<option\n\t\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\t\t\tdisabled={ option.disabled }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ option.label }\n\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t</Select>\n\t\t\t</InputBase>\n\t\t</BaseControl>\n\t);\n\t/* eslint-enable jsx-a11y/no-onchange */\n}\n\n/**\n * `SelectControl` allows users to select from a single or multiple option menu.\n * It functions as a wrapper around the browser's native `<select>` element.\n *\n * @example\n * import { SelectControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MySelectControl = () => {\n * const [ size, setSize ] = useState( '50%' );\n *\n * return (\n * <SelectControl\n * label=\"Size\"\n * value={ size }\n * options={ [\n * { label: 'Big', value: '100%' },\n * { label: 'Medium', value: '50%' },\n * { label: 'Small', value: '25%' },\n * ] }\n * onChange={ setSize }\n * />\n * );\n * };\n */\nexport const SelectControl = forwardRef( UnforwardedSelectControl );\n\nexport default SelectControl;\n"]}
@@ -11,18 +11,12 @@ var _element = require("@wordpress/element");
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
- var _lodash = require("lodash");
15
-
16
14
  var _context = _interopRequireDefault(require("./context"));
17
15
 
18
16
  var _useSlot = _interopRequireDefault(require("./use-slot"));
19
17
 
20
18
  // @ts-nocheck
21
19
 
22
- /**
23
- * External dependencies
24
- */
25
-
26
20
  /**
27
21
  * WordPress dependencies
28
22
  */
@@ -69,7 +63,7 @@ function FillComponent(_ref) {
69
63
  } // If a function is passed as a child, provide it with the fillProps.
70
64
 
71
65
 
72
- if ((0, _lodash.isFunction)(children)) {
66
+ if (typeof children === 'function') {
73
67
  children = children(slot.props.fillProps);
74
68
  }
75
69
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/slot-fill/fill.js"],"names":["FillComponent","name","children","registerFill","unregisterFill","slot","ref","current","forceUpdate","node","props","fillProps","Fill"],"mappings":";;;;;;;;;AASA;;;;AALA;;AAUA;;AACA;;AAfA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,aA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,QAAd,EAAwBG,IAAI,CAACI,IAA7B,CAAP;AACA;;AAED,MAAMG,IAAI,GAAKF,KAAF,IACZ,4BAAC,gBAAD,CAAiB,QAAjB,QACG;AAAA,MAAE;AAAEP,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAAF;AAAA,SACD,4BAAC,aAAD,6BACMM,KADN;AAEC,IAAA,YAAY,EAAGP,YAFhB;AAGC,IAAA,cAAc,EAAGC;AAHlB,KADC;AAAA,CADH,CADD;;eAYeQ,I","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { isFunction } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createPortal, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport useSlot from './use-slot';\n\nfunction FillComponent( { name, children, registerFill, unregisterFill } ) {\n\tconst slot = useSlot( name );\n\n\tconst ref = useRef( {\n\t\tname,\n\t\tchildren,\n\t} );\n\n\tuseLayoutEffect( () => {\n\t\tregisterFill( name, ref.current );\n\t\treturn () => unregisterFill( name, ref.current );\n\t}, [] );\n\n\tuseLayoutEffect( () => {\n\t\tref.current.children = children;\n\t\tif ( slot ) {\n\t\t\tslot.forceUpdate();\n\t\t}\n\t}, [ children ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( name === ref.current.name ) {\n\t\t\t// Ignore initial effect.\n\t\t\treturn;\n\t\t}\n\t\tunregisterFill( ref.current.name, ref.current );\n\t\tref.current.name = name;\n\t\tregisterFill( name, ref.current );\n\t}, [ name ] );\n\n\tif ( ! slot || ! slot.node ) {\n\t\treturn null;\n\t}\n\n\t// If a function is passed as a child, provide it with the fillProps.\n\tif ( isFunction( children ) ) {\n\t\tchildren = children( slot.props.fillProps );\n\t}\n\n\treturn createPortal( children, slot.node );\n}\n\nconst Fill = ( props ) => (\n\t<SlotFillContext.Consumer>\n\t\t{ ( { registerFill, unregisterFill } ) => (\n\t\t\t<FillComponent\n\t\t\t\t{ ...props }\n\t\t\t\tregisterFill={ registerFill }\n\t\t\t\tunregisterFill={ unregisterFill }\n\t\t\t/>\n\t\t) }\n\t</SlotFillContext.Consumer>\n);\n\nexport default Fill;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/slot-fill/fill.js"],"names":["FillComponent","name","children","registerFill","unregisterFill","slot","ref","current","forceUpdate","node","props","fillProps","Fill"],"mappings":";;;;;;;;;AAKA;;;;AAKA;;AACA;;AAXA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,aAAT,OAA2E;AAAA,MAAnD;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,QAAR;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,GAAmD;AAC1E,QAAMC,IAAI,GAAG,sBAASJ,IAAT,CAAb;AAEA,QAAMK,GAAG,GAAG,qBAAQ;AACnBL,IAAAA,IADmB;AAEnBC,IAAAA;AAFmB,GAAR,CAAZ;AAKA,gCAAiB,MAAM;AACtBC,IAAAA,YAAY,CAAEF,IAAF,EAAQK,GAAG,CAACC,OAAZ,CAAZ;AACA,WAAO,MAAMH,cAAc,CAAEH,IAAF,EAAQK,GAAG,CAACC,OAAZ,CAA3B;AACA,GAHD,EAGG,EAHH;AAKA,gCAAiB,MAAM;AACtBD,IAAAA,GAAG,CAACC,OAAJ,CAAYL,QAAZ,GAAuBA,QAAvB;;AACA,QAAKG,IAAL,EAAY;AACXA,MAAAA,IAAI,CAACG,WAAL;AACA;AACD,GALD,EAKG,CAAEN,QAAF,CALH;AAOA,gCAAiB,MAAM;AACtB,QAAKD,IAAI,KAAKK,GAAG,CAACC,OAAJ,CAAYN,IAA1B,EAAiC;AAChC;AACA;AACA;;AACDG,IAAAA,cAAc,CAAEE,GAAG,CAACC,OAAJ,CAAYN,IAAd,EAAoBK,GAAG,CAACC,OAAxB,CAAd;AACAD,IAAAA,GAAG,CAACC,OAAJ,CAAYN,IAAZ,GAAmBA,IAAnB;AACAE,IAAAA,YAAY,CAAEF,IAAF,EAAQK,GAAG,CAACC,OAAZ,CAAZ;AACA,GARD,EAQG,CAAEN,IAAF,CARH;;AAUA,MAAK,CAAEI,IAAF,IAAU,CAAEA,IAAI,CAACI,IAAtB,EAA6B;AAC5B,WAAO,IAAP;AACA,GAhCyE,CAkC1E;;;AACA,MAAK,OAAOP,QAAP,KAAoB,UAAzB,EAAsC;AACrCA,IAAAA,QAAQ,GAAGA,QAAQ,CAAEG,IAAI,CAACK,KAAL,CAAWC,SAAb,CAAnB;AACA;;AAED,SAAO,2BAAcT,QAAd,EAAwBG,IAAI,CAACI,IAA7B,CAAP;AACA;;AAED,MAAMG,IAAI,GAAKF,KAAF,IACZ,4BAAC,gBAAD,CAAiB,QAAjB,QACG;AAAA,MAAE;AAAEP,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAAF;AAAA,SACD,4BAAC,aAAD,6BACMM,KADN;AAEC,IAAA,YAAY,EAAGP,YAFhB;AAGC,IAAA,cAAc,EAAGC;AAHlB,KADC;AAAA,CADH,CADD;;eAYeQ,I","sourcesContent":["// @ts-nocheck\n\n/**\n * WordPress dependencies\n */\nimport { createPortal, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport useSlot from './use-slot';\n\nfunction FillComponent( { name, children, registerFill, unregisterFill } ) {\n\tconst slot = useSlot( name );\n\n\tconst ref = useRef( {\n\t\tname,\n\t\tchildren,\n\t} );\n\n\tuseLayoutEffect( () => {\n\t\tregisterFill( name, ref.current );\n\t\treturn () => unregisterFill( name, ref.current );\n\t}, [] );\n\n\tuseLayoutEffect( () => {\n\t\tref.current.children = children;\n\t\tif ( slot ) {\n\t\t\tslot.forceUpdate();\n\t\t}\n\t}, [ children ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( name === ref.current.name ) {\n\t\t\t// Ignore initial effect.\n\t\t\treturn;\n\t\t}\n\t\tunregisterFill( ref.current.name, ref.current );\n\t\tref.current.name = name;\n\t\tregisterFill( name, ref.current );\n\t}, [ name ] );\n\n\tif ( ! slot || ! slot.node ) {\n\t\treturn null;\n\t}\n\n\t// If a function is passed as a child, provide it with the fillProps.\n\tif ( typeof children === 'function' ) {\n\t\tchildren = children( slot.props.fillProps );\n\t}\n\n\treturn createPortal( children, slot.node );\n}\n\nconst Fill = ( props ) => (\n\t<SlotFillContext.Consumer>\n\t\t{ ( { registerFill, unregisterFill } ) => (\n\t\t\t<FillComponent\n\t\t\t\t{ ...props }\n\t\t\t\tregisterFill={ registerFill }\n\t\t\t\tunregisterFill={ unregisterFill }\n\t\t\t/>\n\t\t) }\n\t</SlotFillContext.Consumer>\n);\n\nexport default Fill;\n"]}
@@ -28,6 +28,17 @@ var _context = _interopRequireDefault(require("./context"));
28
28
  /**
29
29
  * Internal dependencies
30
30
  */
31
+
32
+ /**
33
+ * Whether the argument is a function.
34
+ *
35
+ * @param {*} maybeFunc The argument to check.
36
+ * @return {boolean} True if the argument is a function, false otherwise.
37
+ */
38
+ function isFunction(maybeFunc) {
39
+ return typeof maybeFunc === 'function';
40
+ }
41
+
31
42
  class SlotComponent extends _element.Component {
32
43
  constructor() {
33
44
  super(...arguments);
@@ -83,7 +94,7 @@ class SlotComponent extends _element.Component {
83
94
  getFills
84
95
  } = this.props;
85
96
  const fills = (0, _lodash.map)(getFills(name, this), fill => {
86
- const fillChildren = (0, _lodash.isFunction)(fill.children) ? fill.children(fillProps) : fill.children;
97
+ const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
87
98
  return _element.Children.map(fillChildren, (child, childIndex) => {
88
99
  if (!child || (0, _lodash.isString)(child)) {
89
100
  return child;
@@ -97,8 +108,8 @@ class SlotComponent extends _element.Component {
97
108
  }).filter( // In some cases fills are rendered only when some conditions apply.
98
109
  // This ensures that we only use non-empty fills when rendering, i.e.,
99
110
  // it allows us to render wrappers only when the fills are actually present.
100
- (0, _lodash.negate)(_element.isEmptyElement));
101
- return (0, _element.createElement)(_element.Fragment, null, (0, _lodash.isFunction)(children) ? children(fills) : fills);
111
+ element => !(0, _element.isEmptyElement)(element));
112
+ return (0, _element.createElement)(_element.Fragment, null, isFunction(children) ? children(fills) : fills);
102
113
  }
103
114
 
104
115
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/slot-fill/slot.js"],"names":["SlotComponent","Component","constructor","arguments","isUnmounted","bindNode","bind","componentDidMount","registerSlot","props","name","componentWillUnmount","unregisterSlot","componentDidUpdate","prevProps","node","forceUpdate","render","children","fillProps","getFills","fills","fill","fillChildren","Children","map","child","childIndex","childKey","key","filter","isEmptyElement","Slot"],"mappings":";;;;;;;;;AASA;;;;AALA;;AAeA;;AAnBA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAGA,MAAMA,aAAN,SAA4BC,kBAA5B,CAAsC;AACrCC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AAEA,SAAKC,WAAL,GAAmB,KAAnB;AACA,SAAKC,QAAL,GAAgB,KAAKA,QAAL,CAAcC,IAAd,CAAoB,IAApB,CAAhB;AACA;;AAEDC,EAAAA,iBAAiB,GAAG;AACnB,UAAM;AAAEC,MAAAA;AAAF,QAAmB,KAAKC,KAA9B;AAEAD,IAAAA,YAAY,CAAE,KAAKC,KAAL,CAAWC,IAAb,EAAmB,IAAnB,CAAZ;AACA;;AAEDC,EAAAA,oBAAoB,GAAG;AACtB,UAAM;AAAEC,MAAAA;AAAF,QAAqB,KAAKH,KAAhC;AACA,SAAKL,WAAL,GAAmB,IAAnB;AACAQ,IAAAA,cAAc,CAAE,KAAKH,KAAL,CAAWC,IAAb,EAAmB,IAAnB,CAAd;AACA;;AAEDG,EAAAA,kBAAkB,CAAEC,SAAF,EAAc;AAC/B,UAAM;AAAEJ,MAAAA,IAAF;AAAQE,MAAAA,cAAR;AAAwBJ,MAAAA;AAAxB,QAAyC,KAAKC,KAApD;;AAEA,QAAKK,SAAS,CAACJ,IAAV,KAAmBA,IAAxB,EAA+B;A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AiB,QAAjB,QACG;AAAA,MAAE;AAAED,IAAAA,YAAF;AAAgBI,IAAAA,cAAhB;AAAgCQ,IAAAA;AAAhC,GAAF;AAAA,SACD,4BAAC,aAAD,6BACMX,KADN;AAEC,IAAA,YAAY,EAAGD,YAFhB;AAGC,IAAA,cAAc,EAAGI,cAHlB;AAIC,IAAA,QAAQ,EAAGQ;AAJZ,KADC;AAAA,CADH,CADD;;eAaeY,I","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { isFunction, isString, map, negate } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tChildren,\n\tComponent,\n\tcloneElement,\n\tisEmptyElement,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\n\nclass SlotComponent extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.isUnmounted = false;\n\t\tthis.bindNode = this.bindNode.bind( this );\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { registerSlot } = this.props;\n\n\t\tregisterSlot( this.props.name, this );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tconst { unregisterSlot } = this.props;\n\t\tthis.isUnmounted = true;\n\t\tunregisterSlot( this.props.name, this );\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { name, unregisterSlot, registerSlot } = this.props;\n\n\t\tif ( prevProps.name !== name ) {\n\t\t\tunregisterSlot( prevProps.name );\n\t\t\tregisterSlot( name, this );\n\t\t}\n\t}\n\n\tbindNode( node ) {\n\t\tthis.node = node;\n\t}\n\n\tforceUpdate() {\n\t\tif ( this.isUnmounted ) {\n\t\t\treturn;\n\t\t}\n\t\tsuper.forceUpdate();\n\t}\n\n\trender() {\n\t\tconst { children, name, fillProps = {}, getFills } = this.props;\n\n\t\tconst fills = map( getFills( name, this ), ( fill ) => {\n\t\t\tconst fillChildren = isFunction( fill.children )\n\t\t\t\t? fill.children( fillProps )\n\t\t\t\t: fill.children;\n\n\t\t\treturn Children.map( fillChildren, ( child, childIndex ) => {\n\t\t\t\tif ( ! child || isString( child ) ) {\n\t\t\t\t\treturn child;\n\t\t\t\t}\n\n\t\t\t\tconst childKey = child.key || childIndex;\n\t\t\t\treturn cloneElement( child, { key: childKey } );\n\t\t\t} );\n\t\t} ).filter(\n\t\t\t// In some cases fills are rendered only when some conditions apply.\n\t\t\t// This ensures that we only use non-empty fills when rendering, i.e.,\n\t\t\t// it allows us to render wrappers only when the fills are actually present.\n\t\t\tnegate( isEmptyElement )\n\t\t);\n\n\t\treturn <>{ isFunction( children ) ? children( fills ) : fills }</>;\n\t}\n}\n\nconst Slot = ( props ) => (\n\t<SlotFillContext.Consumer>\n\t\t{ ( { registerSlot, unregisterSlot, getFills } ) => (\n\t\t\t<SlotComponent\n\t\t\t\t{ ...props }\n\t\t\t\tregisterSlot={ registerSlot }\n\t\t\t\tunregisterSlot={ unregisterSlot }\n\t\t\t\tgetFills={ getFills }\n\t\t\t/>\n\t\t) }\n\t</SlotFillContext.Consumer>\n);\n\nexport default Slot;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/slot-fill/slot.js"],"names":["isFunction","maybeFunc","SlotComponent","Component","constructor","arguments","isUnmounted","bindNode","bind","componentDidMount","registerSlot","props","name","componentWillUnmount","unregisterSlot","componentDidUpdate","prevProps","node","forceUpdate","render","children","fillProps","getFills","fills","fill","fillChildren","Children","map","child","childIndex","childKey","key","filter","element","Slot"],"mappings":";;;;;;;;;AASA;;;;AALA;;AAeA;;AAnBA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAT,CAAqBC,SAArB,EAAiC;AAChC,SAAO,OAAOA,SAAP,KAAqB,UAA5B;AACA;;AAED,MAAMC,aAAN,SAA4BC,kBAA5B,CAAsC;AACrCC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AAEA,SAAKC,WAAL,GAAmB,KAAnB;AACA,SAAKC,QAAL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,GAClBI,IAAI,CAACJ,QAAL,CAAeC,SAAf,CADkB,GAElBG,IAAI,CAACJ,QAFR;AAIA,aAAOM,kBAASC,GAAT,CAAcF,YAAd,EAA4B,CAAEG,KAAF,EAASC,UAAT,KAAyB;AAC3D,YAAK,CAAED,KAAF,IAAW,sBAAUA,KAAV,CAAhB,EAAoC;AACnC,iBAAOA,KAAP;AACA;;AAED,cAAME,QAAQ,GAAGF,KAAK,CAACG,GAAN,IAAaF,UAA9B;AACA,eAAO,2BAAcD,KAAd,EAAqB;AAAEG,UAAAA,GAAG,EAAED;AAAP,SAArB,CAAP;AACA,OAPM,CAAP;AAQA,KAba,EAaVE,MAbU,EAcb;AACA;AACA;AACEC,IAAAA,OAAF,IAAe,CAAE,6BAAgBA,OAAhB,CAjBJ,CAAd;AAoBA,WAAO,qDAAIjC,UAAU,CAAEoB,QAAF,CAAV,GAAyBA,QAAQ,CAAEG,KAAF,CAAjC,GAA6CA,KAAjD,CAAP;AACA;;AAhEoC;;AAmEtC,MAAMW,IAAI,GAAKvB,KAAF,IACZ,4BAAC,gBAAD,CAAiB,QAAjB,QACG;AAAA,MAAE;AAAED,IAAAA,YAAF;AAAgBI,IAAAA,cAAhB;AAAgCQ,IAAAA;AAAhC,GAAF;AAAA,SACD,4BAAC,aAAD,6BACMX,KADN;AAEC,IAAA,YAAY,EAAGD,YAFhB;AAGC,IAAA,cAAc,EAAGI,cAHlB;AAIC,IAAA,QAAQ,EAAGQ;AAJZ,KADC;AAAA,CADH,CADD;;eAaeY,I","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { isString, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tChildren,\n\tComponent,\n\tcloneElement,\n\tisEmptyElement,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\n\n/**\n * Whether the argument is a function.\n *\n * @param {*} maybeFunc The argument to check.\n * @return {boolean} True if the argument is a function, false otherwise.\n */\nfunction isFunction( maybeFunc ) {\n\treturn typeof maybeFunc === 'function';\n}\n\nclass SlotComponent extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.isUnmounted = false;\n\t\tthis.bindNode = this.bindNode.bind( this );\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { registerSlot } = this.props;\n\n\t\tregisterSlot( this.props.name, this );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tconst { unregisterSlot } = this.props;\n\t\tthis.isUnmounted = true;\n\t\tunregisterSlot( this.props.name, this );\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { name, unregisterSlot, registerSlot } = this.props;\n\n\t\tif ( prevProps.name !== name ) {\n\t\t\tunregisterSlot( prevProps.name );\n\t\t\tregisterSlot( name, this );\n\t\t}\n\t}\n\n\tbindNode( node ) {\n\t\tthis.node = node;\n\t}\n\n\tforceUpdate() {\n\t\tif ( this.isUnmounted ) {\n\t\t\treturn;\n\t\t}\n\t\tsuper.forceUpdate();\n\t}\n\n\trender() {\n\t\tconst { children, name, fillProps = {}, getFills } = this.props;\n\n\t\tconst fills = map( getFills( name, this ), ( fill ) => {\n\t\t\tconst fillChildren = isFunction( fill.children )\n\t\t\t\t? fill.children( fillProps )\n\t\t\t\t: fill.children;\n\n\t\t\treturn Children.map( fillChildren, ( child, childIndex ) => {\n\t\t\t\tif ( ! child || isString( child ) ) {\n\t\t\t\t\treturn child;\n\t\t\t\t}\n\n\t\t\t\tconst childKey = child.key || childIndex;\n\t\t\t\treturn cloneElement( child, { key: childKey } );\n\t\t\t} );\n\t\t} ).filter(\n\t\t\t// In some cases fills are rendered only when some conditions apply.\n\t\t\t// This ensures that we only use non-empty fills when rendering, i.e.,\n\t\t\t// it allows us to render wrappers only when the fills are actually present.\n\t\t\t( element ) => ! isEmptyElement( element )\n\t\t);\n\n\t\treturn <>{ isFunction( children ) ? children( fills ) : fills }</>;\n\t}\n}\n\nconst Slot = ( props ) => (\n\t<SlotFillContext.Consumer>\n\t\t{ ( { registerSlot, unregisterSlot, getFills } ) => (\n\t\t\t<SlotComponent\n\t\t\t\t{ ...props }\n\t\t\t\tregisterSlot={ registerSlot }\n\t\t\t\tunregisterSlot={ unregisterSlot }\n\t\t\t\tgetFills={ getFills }\n\t\t\t/>\n\t\t) }\n\t</SlotFillContext.Consumer>\n);\n\nexport default Slot;\n"]}
@@ -9,8 +9,6 @@ exports.default = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _lodash = require("lodash");
13
-
14
12
  var _classnames = _interopRequireDefault(require("classnames"));
15
13
 
16
14
  var _a11y = require("@wordpress/a11y");
@@ -32,6 +30,8 @@ var _ = require("../");
32
30
  /**
33
31
  * Internal dependencies
34
32
  */
33
+ const noop = () => {};
34
+
35
35
  const NOTICE_TIMEOUT = 10000;
36
36
  /** @typedef {import('@wordpress/element').WPElement} WPElement */
37
37
 
@@ -59,16 +59,16 @@ function Snackbar(_ref, ref) {
59
59
  spokenMessage = children,
60
60
  politeness = 'polite',
61
61
  actions = [],
62
- onRemove = _lodash.noop,
62
+ onRemove = noop,
63
63
  icon = null,
64
64
  explicitDismiss = false,
65
65
  // onDismiss is a callback executed when the snackbar is dismissed.
66
66
  // It is distinct from onRemove, which _looks_ like a callback but is
67
67
  // actually the function to call to remove the snackbar from the UI.
68
- onDismiss = _lodash.noop,
68
+ onDismiss = noop,
69
69
  listRef
70
70
  } = _ref;
71
- onDismiss = onDismiss || _lodash.noop;
71
+ onDismiss = onDismiss || noop;
72
72
 
73
73
  function dismissMe(event) {
74
74
  if (event && event.preventDefault) {
@@ -118,10 +118,10 @@ function Snackbar(_ref, ref) {
118
118
  return (0, _element.createElement)("div", {
119
119
  ref: ref,
120
120
  className: classes,
121
- onClick: !explicitDismiss ? dismissMe : _lodash.noop,
121
+ onClick: !explicitDismiss ? dismissMe : noop,
122
122
  tabIndex: "0",
123
123
  role: !explicitDismiss ? 'button' : '',
124
- onKeyPress: !explicitDismiss ? dismissMe : _lodash.noop,
124
+ onKeyPress: !explicitDismiss ? dismissMe : noop,
125
125
  "aria-label": !explicitDismiss ? (0, _i18n.__)('Dismiss this notice') : ''
126
126
  }, (0, _element.createElement)("div", {
127
127
  className: snackbarContentClassnames
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/snackbar/index.js"],"names":["NOTICE_TIMEOUT","useSpokenMessage","message","politeness","spokenMessage","Snackbar","ref","className","children","actions","onRemove","noop","icon","explicitDismiss","onDismiss","listRef","dismissMe","event","preventDefault","current","focus","onActionClick","onClick","stopPropagation","timeoutHandle","setTimeout","clearTimeout","classes","length","snackbarContentClassnames","map","index","label","url"],"mappings":";;;;;;;;;AAUA;;AAPA;;AACA;;AAKA;;AAEA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;AAGA,MAAMA,cAAc,GAAG,KAAvB;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,OAA3B,EAAoCC,UAApC,EAAiD;AAChD,QAAMC,aAAa,GAClB,OAAOF,OAAP,KAAmB,QAAnB,GAA8BA,OAA9B,GAAwC,6BAAgBA,OAAhB,CADzC;AAGA,0BAAW,MAAM;AAChB,QAAKE,aAAL,EAAqB;AACpB,uBAAOA,aAAP,EAAsBD,UAAtB;AACA;AACD,GAJD,EAIG,CAAEC,aAAF,EAAiBD,UAAjB,CAJH;AAKA;;AAED,SAASE,QAAT,OAgBCC,GAhBD,EAiBE;AAAA,MAhBD;AACCC,IAAAA,SADD;AAECC,IAAAA,QAFD;AAGCJ,IAAAA,aAAa,GAAGI,QAHjB;AAICL,IAAAA,UAAU,GAAG,QAJd;AAKCM,IAAAA,OAAO,GAAG,EALX;AAMCC,IAAAA,QAAQ,GAAGC,YANZ;AAOCC,IAAAA,IAAI,GAAG,IAPR;AAQCC,IAAAA,eAAe,GAAG,KARnB;AASC;AACA;AACA;AACAC,IAAAA,SAAS,GAAGH,YAZb;AAaCI,IAAAA;AAb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SACC;AACC,IAAA,GAAG,EAAGN,GADP;AAEC,IAAA,SAAS,EAAGqB,OAFb;AAGC,IAAA,OAAO,EAAG,CAAEd,eAAF,GAAoBG,SAApB,GAAgCL,YAH3C;AAIC,IAAA,QAAQ,EAAC,GAJV;AAKC,IAAA,IAAI,EAAG,CAAEE,eAAF,GAAoB,QAApB,GAA+B,EALvC;AAMC,IAAA,UAAU,EAAG,CAAEA,eAAF,GAAoBG,SAApB,GAAgCL,YAN9C;AAOC,kBAAa,CAAEE,eAAF,GAAoB,cAAI,qBAAJ,CAApB,GAAkD;AAPhE,KASC;AAAK,IAAA,SAAS,EAAGgB;AAAjB,KACGjB,IAAI,IACL;AAAK,IAAA,SAAS,EAAC;AAAf,KAA6CA,IAA7C,CAFF,EAIGJ,QAJH,EAKGC,OAAO,CAACqB,GAAR,CAAa,QAA2BC,KAA3B,KAAsC;AAAA,QAApC;AAAEC,MAAAA,KAAF;AAASV,MAAAA,OAAT;AAAkBW,MAAAA;AAAlB,KAAoC;AACpD,WACC,4BAAC,QAAD;AACC,MAAA,GAAG,EAAGF,KADP;AAEC,MAAA,IAAI,EAAGE,GAFR;AAGC,MAAA,OAAO,EAAC,UAHT;AAIC,MAAA,OAAO,EAAKhB,KAAF,IACTI,aAAa,CAAEJ,KAAF,EAASK,OAAT,CALf;AAOC,MAAA,SAAS,EAAC;AAPX,OASGU,KATH,CADD;AAaA,GAdC,CALH,EAoBGnB,eAAe,IAChB;AACC,IAAA,IAAI,EAAC,QADN;AAEC,kBAAW,qBAFZ;AAGC,IAAA,QAAQ,EAAC,GAHV;AAIC,IAAA,SAAS,EAAC,qCAJX;AAKC,IAAA,OAAO,EAAGG,SALX;AAMC,IAAA,UAAU,EAAGA;AANd,cArBF,CATD,CADD;AA6CA;;eAEc,yBAAYX,QAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport { noop } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { useEffect, forwardRef, renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { Button } from '../';\n\nconst NOTICE_TIMEOUT = 10000;\n\n/** @typedef {import('@wordpress/element').WPElement} WPElement */\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param {string|WPElement} [message] Message to announce.\n * @param {'polite'|'assertive'} politeness Politeness to announce.\n */\nfunction useSpokenMessage( message, politeness ) {\n\tconst spokenMessage =\n\t\ttypeof message === 'string' ? message : renderToString( message );\n\n\tuseEffect( () => {\n\t\tif ( spokenMessage ) {\n\t\t\tspeak( spokenMessage, politeness );\n\t\t}\n\t}, [ spokenMessage, politeness ] );\n}\n\nfunction Snackbar(\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\tspokenMessage = children,\n\t\tpoliteness = 'polite',\n\t\tactions = [],\n\t\tonRemove = noop,\n\t\ticon = null,\n\t\texplicitDismiss = false,\n\t\t// onDismiss is a callback executed when the snackbar is dismissed.\n\t\t// It is distinct from onRemove, which _looks_ like a callback but is\n\t\t// actually the function to call to remove the snackbar from the UI.\n\t\tonDismiss = noop,\n\t\tlistRef,\n\t},\n\tref\n) {\n\tonDismiss = onDismiss || noop;\n\n\tfunction dismissMe( event ) {\n\t\tif ( event && event.preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\t// Prevent focus loss by moving it to the list element.\n\t\tlistRef.current.focus();\n\n\t\tonDismiss();\n\t\tonRemove();\n\t}\n\n\tfunction onActionClick( event, onClick ) {\n\t\tevent.stopPropagation();\n\n\t\tonRemove();\n\n\t\tif ( onClick ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\tuseSpokenMessage( spokenMessage, politeness );\n\n\t// Only set up the timeout dismiss if we're not explicitly dismissing.\n\tuseEffect( () => {\n\t\tconst timeoutHandle = setTimeout( () => {\n\t\t\tif ( ! explicitDismiss ) {\n\t\t\t\tonDismiss();\n\t\t\t\tonRemove();\n\t\t\t}\n\t\t}, NOTICE_TIMEOUT );\n\n\t\treturn () => clearTimeout( timeoutHandle );\n\t}, [ onDismiss, onRemove ] );\n\n\tconst classes = classnames( className, 'components-snackbar', {\n\t\t'components-snackbar-explicit-dismiss': !! explicitDismiss,\n\t} );\n\tif ( actions && actions.length > 1 ) {\n\t\t// We need to inform developers that snackbar only accepts 1 action.\n\t\twarning(\n\t\t\t'Snackbar can only have 1 action, use Notice if your message require many messages'\n\t\t);\n\t\t// return first element only while keeping it inside an array\n\t\tactions = [ actions[ 0 ] ];\n\t}\n\n\tconst snackbarContentClassnames = classnames(\n\t\t'components-snackbar__content',\n\t\t{\n\t\t\t'components-snackbar__content-with-icon': !! icon,\n\t\t}\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ classes }\n\t\t\tonClick={ ! explicitDismiss ? dismissMe : noop }\n\t\t\ttabIndex=\"0\"\n\t\t\trole={ ! explicitDismiss ? 'button' : '' }\n\t\t\tonKeyPress={ ! explicitDismiss ? dismissMe : noop }\n\t\t\taria-label={ ! explicitDismiss ? __( 'Dismiss this notice' ) : '' }\n\t\t>\n\t\t\t<div className={ snackbarContentClassnames }>\n\t\t\t\t{ icon && (\n\t\t\t\t\t<div className=\"components-snackbar__icon\">{ icon }</div>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ actions.map( ( { label, onClick, url }, index ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\thref={ url }\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ ( event ) =>\n\t\t\t\t\t\t\t\tonActionClick( event, onClick )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"components-snackbar__action\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ explicitDismiss && (\n\t\t\t\t\t<span\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\taria-label=\"Dismiss this notice\"\n\t\t\t\t\t\ttabIndex=\"0\"\n\t\t\t\t\t\tclassName=\"components-snackbar__dismiss-button\"\n\t\t\t\t\t\tonClick={ dismissMe }\n\t\t\t\t\t\tonKeyPress={ dismissMe }\n\t\t\t\t\t>\n\t\t\t\t\t\t&#x2715;\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( Snackbar );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/snackbar/index.js"],"names":["noop","NOTICE_TIMEOUT","useSpokenMessage","message","politeness","spokenMessage","Snackbar","ref","className","children","actions","onRemove","icon","explicitDismiss","onDismiss","listRef","dismissMe","event","preventDefault","current","focus","onActionClick","onClick","stopPropagation","timeoutHandle","setTimeout","clearTimeout","classes","length","snackbarContentClassnames","map","index","label","url"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAGA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,cAAc,GAAG,KAAvB;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,OAA3B,EAAoCC,UAApC,EAAiD;AAChD,QAAMC,aAAa,GAClB,OAAOF,OAAP,KAAmB,QAAnB,GAA8BA,OAA9B,GAAwC,6BAAgBA,OAAhB,CADzC;AAGA,0BAAW,MAAM;AAChB,QAAKE,aAAL,EAAqB;AACpB,uBAAOA,aAAP,EAAsBD,UAAtB;AACA;AACD,GAJD,EAIG,CAAEC,aAAF,EAAiBD,UAAjB,CAJH;AAKA;;AAED,SAASE,QAAT,OAgBCC,GAhBD,EAiBE;AAAA,MAhBD;AACCC,IAAAA,SADD;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AAA,QAAQ,EAAC,GAHV;AAIC,IAAA,SAAS,EAAC,qCAJX;AAKC,IAAA,OAAO,EAAGG,SALX;AAMC,IAAA,UAAU,EAAGA;AANd,cArBF,CATD,CADD;AA6CA;;eAEc,yBAAYV,QAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { useEffect, forwardRef, renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { Button } from '../';\n\nconst noop = () => {};\nconst NOTICE_TIMEOUT = 10000;\n\n/** @typedef {import('@wordpress/element').WPElement} WPElement */\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param {string|WPElement} [message] Message to announce.\n * @param {'polite'|'assertive'} politeness Politeness to announce.\n */\nfunction useSpokenMessage( message, politeness ) {\n\tconst spokenMessage =\n\t\ttypeof message === 'string' ? message : renderToString( message );\n\n\tuseEffect( () => {\n\t\tif ( spokenMessage ) {\n\t\t\tspeak( spokenMessage, politeness );\n\t\t}\n\t}, [ spokenMessage, politeness ] );\n}\n\nfunction Snackbar(\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\tspokenMessage = children,\n\t\tpoliteness = 'polite',\n\t\tactions = [],\n\t\tonRemove = noop,\n\t\ticon = null,\n\t\texplicitDismiss = false,\n\t\t// onDismiss is a callback executed when the snackbar is dismissed.\n\t\t// It is distinct from onRemove, which _looks_ like a callback but is\n\t\t// actually the function to call to remove the snackbar from the UI.\n\t\tonDismiss = noop,\n\t\tlistRef,\n\t},\n\tref\n) {\n\tonDismiss = onDismiss || noop;\n\n\tfunction dismissMe( event ) {\n\t\tif ( event && event.preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\t// Prevent focus loss by moving it to the list element.\n\t\tlistRef.current.focus();\n\n\t\tonDismiss();\n\t\tonRemove();\n\t}\n\n\tfunction onActionClick( event, onClick ) {\n\t\tevent.stopPropagation();\n\n\t\tonRemove();\n\n\t\tif ( onClick ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\tuseSpokenMessage( spokenMessage, politeness );\n\n\t// Only set up the timeout dismiss if we're not explicitly dismissing.\n\tuseEffect( () => {\n\t\tconst timeoutHandle = setTimeout( () => {\n\t\t\tif ( ! explicitDismiss ) {\n\t\t\t\tonDismiss();\n\t\t\t\tonRemove();\n\t\t\t}\n\t\t}, NOTICE_TIMEOUT );\n\n\t\treturn () => clearTimeout( timeoutHandle );\n\t}, [ onDismiss, onRemove ] );\n\n\tconst classes = classnames( className, 'components-snackbar', {\n\t\t'components-snackbar-explicit-dismiss': !! explicitDismiss,\n\t} );\n\tif ( actions && actions.length > 1 ) {\n\t\t// We need to inform developers that snackbar only accepts 1 action.\n\t\twarning(\n\t\t\t'Snackbar can only have 1 action, use Notice if your message require many messages'\n\t\t);\n\t\t// return first element only while keeping it inside an array\n\t\tactions = [ actions[ 0 ] ];\n\t}\n\n\tconst snackbarContentClassnames = classnames(\n\t\t'components-snackbar__content',\n\t\t{\n\t\t\t'components-snackbar__content-with-icon': !! icon,\n\t\t}\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ classes }\n\t\t\tonClick={ ! explicitDismiss ? dismissMe : noop }\n\t\t\ttabIndex=\"0\"\n\t\t\trole={ ! explicitDismiss ? 'button' : '' }\n\t\t\tonKeyPress={ ! explicitDismiss ? dismissMe : noop }\n\t\t\taria-label={ ! explicitDismiss ? __( 'Dismiss this notice' ) : '' }\n\t\t>\n\t\t\t<div className={ snackbarContentClassnames }>\n\t\t\t\t{ icon && (\n\t\t\t\t\t<div className=\"components-snackbar__icon\">{ icon }</div>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ actions.map( ( { label, onClick, url }, index ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\thref={ url }\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ ( event ) =>\n\t\t\t\t\t\t\t\tonActionClick( event, onClick )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"components-snackbar__action\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ explicitDismiss && (\n\t\t\t\t\t<span\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\taria-label=\"Dismiss this notice\"\n\t\t\t\t\t\ttabIndex=\"0\"\n\t\t\t\t\t\tclassName=\"components-snackbar__dismiss-button\"\n\t\t\t\t\t\tonClick={ dismissMe }\n\t\t\t\t\t\tonKeyPress={ dismissMe }\n\t\t\t\t\t>\n\t\t\t\t\t\t&#x2715;\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( Snackbar );\n"]}
@@ -32,6 +32,8 @@ var _animation = require("../animation");
32
32
  /**
33
33
  * Internal dependencies
34
34
  */
35
+ const noop = () => {};
36
+
35
37
  const SNACKBAR_VARIANTS = {
36
38
  init: {
37
39
  height: 0,
@@ -76,7 +78,7 @@ function SnackbarList(_ref) {
76
78
  notices,
77
79
  className,
78
80
  children,
79
- onRemove = _lodash.noop
81
+ onRemove = noop
80
82
  } = _ref;
81
83
  const listRef = (0, _element.useRef)();
82
84
  const isReducedMotion = (0, _compose.useReducedMotion)();
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/snackbar/list.js"],"names":["SNACKBAR_VARIANTS","init","height","opacity","open","transition","stiffness","velocity","exit","duration","SNACKBAR_REDUCE_MOTION_VARIANTS","SnackbarList","notices","className","children","onRemove","noop","listRef","isReducedMotion","removeNotice","notice","id","map","content"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAKA;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,QADH,EAEC,4BAAC,oCAAD,QACGF,OAAO,CAACU,GAAR,CAAeF,MAAF,IAAc;AAC5B,WACC,4BAAC,2BAAD,CAAQ,GAAR;AACC,MAAA,MAAM,EAAG,CAAEF,eADZ,CAC8B;AAD9B;AAEC,MAAA,OAAO,EAAG,MAFX;AAGC,MAAA,OAAO,EAAG,MAHX;AAIC,MAAA,IAAI,EAAG,MAJR;AAKC,MAAA,GAAG,EAAGE,MAAM,CAACC,EALd;AAMC,MAAA,QAAQ,EACPH,eAAe,GACZR,+BADY,GAEZV;AATL,OAYC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,SAAD,6BACM,kBAAMoB,MAAN,EAAc,CAAE,SAAF,CAAd,CADN;AAEC,MAAA,QAAQ,EAAGD,YAAY,CAAEC,MAAF,CAFxB;AAGC,MAAA,OAAO,EAAGH;AAHX,QAKGG,MAAM,CAACG,OALV,CADD,CAZD,CADD;AAwBA,GAzBC,CADH,CAFD,CADD;AAiCA;;eAEcZ,Y","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { omit, noop } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Snackbar from './';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '../animation';\n\nconst SNACKBAR_VARIANTS = {\n\tinit: {\n\t\theight: 0,\n\t\topacity: 0,\n\t},\n\topen: {\n\t\theight: 'auto',\n\t\topacity: 1,\n\t\ttransition: {\n\t\t\theight: { stiffness: 1000, velocity: -100 },\n\t\t},\n\t},\n\texit: {\n\t\topacity: 0,\n\t\ttransition: {\n\t\t\tduration: 0.5,\n\t\t},\n\t},\n};\n\nconst SNACKBAR_REDUCE_MOTION_VARIANTS = {\n\tinit: false,\n\topen: false,\n\texit: false,\n};\n\n/**\n * Renders a list of notices.\n *\n * @param {Object} $0 Props passed to the component.\n * @param {Array} $0.notices Array of notices to render.\n * @param {Function} $0.onRemove Function called when a notice should be removed / dismissed.\n * @param {Object} $0.className Name of the class used by the component.\n * @param {Object} $0.children Array of children to be rendered inside the notice list.\n *\n * @return {Object} The rendered notices list.\n */\nfunction SnackbarList( { notices, className, children, onRemove = noop } ) {\n\tconst listRef = useRef();\n\tconst isReducedMotion = useReducedMotion();\n\tclassName = classnames( 'components-snackbar-list', className );\n\tconst removeNotice = ( notice ) => () => onRemove( notice.id );\n\treturn (\n\t\t<div className={ className } tabIndex={ -1 } ref={ listRef }>\n\t\t\t{ children }\n\t\t\t<AnimatePresence>\n\t\t\t\t{ notices.map( ( notice ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tlayout={ ! isReducedMotion } // See https://www.framer.com/docs/animation/#layout-animations\n\t\t\t\t\t\t\tinitial={ 'init' }\n\t\t\t\t\t\t\tanimate={ 'open' }\n\t\t\t\t\t\t\texit={ 'exit' }\n\t\t\t\t\t\t\tkey={ notice.id }\n\t\t\t\t\t\t\tvariants={\n\t\t\t\t\t\t\t\tisReducedMotion\n\t\t\t\t\t\t\t\t\t? SNACKBAR_REDUCE_MOTION_VARIANTS\n\t\t\t\t\t\t\t\t\t: SNACKBAR_VARIANTS\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"components-snackbar-list__notice-container\">\n\t\t\t\t\t\t\t\t<Snackbar\n\t\t\t\t\t\t\t\t\t{ ...omit( notice, [ 'content' ] ) }\n\t\t\t\t\t\t\t\t\tonRemove={ removeNotice( notice ) }\n\t\t\t\t\t\t\t\t\tlistRef={ listRef }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ notice.content }\n\t\t\t\t\t\t\t\t</Snackbar>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</AnimatePresence>\n\t\t</div>\n\t);\n}\n\nexport default SnackbarList;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/snackbar/list.js"],"names":["noop","SNACKBAR_VARIANTS","init","height","opacity","open","transition","stiffness","velocity","exit","duration","SNACKBAR_REDUCE_MOTION_VARIANTS","SnackbarList","notices","className","children","onRemove","listRef","isReducedMotion","removeNotice","notice","id","map","content"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAKA;;AAMA;;AACA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAOA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,iBAAiB,GAAG;AACzBC,EAAAA,IAAI,EAAE;AACLC,IAAAA,MAAM,EAAE,CADH;AAELC,IAAAA,OAAO,EAAE;AAFJ,GADmB;AAKzBC,EAAAA,IAAI,EAAE;AACLF,IAAAA,MAAM,EAAE,MADH;AAELC,IAAAA,OAAO,EAAE,CAFJ;AAGLE,IAAAA,UAAU,EAAE;AACXH,MAAAA,MAAM,EAAE;AAAEI,QAAAA,SAAS,EAAE,IAAb;AAAmBC,QAAAA,QAAQ,EAAE,CAAC;AAA9B;AADG;AAHP,GALmB;AAYzBC,EAAAA,IAAI,EAAE;AACLL,IAAAA,OAAO,EAAE,CADJ;AAELE,IAAAA,UAAU,EAAE;AACXI,MAAAA,QAAQ,EAAE;AADC;AAFP;AAZmB,CAA1B;AAoBA,MAAMC,+BAA+B,GAAG;AACvCT,EAAAA,IAAI,EAAE,KADiC;AAEvCG,EAAAA,IAAI,EAAE,KAFiC;AAGvCI,EAAAA,IAAI,EAAE;AAHiC,CAAxC;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASG,YAAT,OAA2E;AAAA,MAApD;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,SAAX;AAAsBC,IAAAA,QAAtB;AAAgCC,IAAAA,QAAQ,GAAGhB;AAA3C,GAAoD;AAC1E,QAAMiB,OAAO,GAAG,sBAAhB;AACA,QAAMC,eAAe,GAAG,gCAAxB;AACAJ,EAAAA,SAAS,GAAG,yBAAY,0BAAZ,EAAwCA,SAAxC,CAAZ;;AACA,QAAMK,YAAY,GAAKC,MAAF,IAAc,MAAMJ,QAAQ,CAAEI,MAAM,CAACC,EAAT,CAAjD;;AACA,SACC;AAAK,IAAA,SAAS,EAAGP,SAAjB;AAA6B,IAAA,QAAQ,EAAG,CAAC,CAAzC;AAA6C,IAAA,GAAG,EAAGG;AAAnD,KACGF,QADH,EAEC,4BAAC,oCAAD,QACGF,OAAO,CAACS,GAAR,CAAeF,MAAF,IAAc;AAC5B,WACC,4BAAC,2BAAD,CAAQ,GAAR;AACC,MAAA,MAAM,EAAG,CAAEF,eADZ,CAC8B;AAD9B;AAEC,MAAA,OAAO,EAAG,MAFX;AAGC,MAAA,OAAO,EAAG,MAHX;AAIC,MAAA,IAAI,EAAG,MAJR;AAKC,MAAA,GAAG,EAAGE,MAAM,CAACC,EALd;AAMC,MAAA,QAAQ,EACPH,eAAe,GACZP,+BADY,GAEZV;AATL,OAYC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,SAAD,6BACM,kBAAMmB,MAAN,EAAc,CAAE,SAAF,CAAd,CADN;AAEC,MAAA,QAAQ,EAAGD,YAAY,CAAEC,MAAF,CAFxB;AAGC,MAAA,OAAO,EAAGH;AAHX,QAKGG,MAAM,CAACG,OALV,CADD,CAZD,CADD;AAwBA,GAzBC,CADH,CAFD,CADD;AAiCA;;eAEcX,Y","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { omit } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Snackbar from './';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '../animation';\n\nconst noop = () => {};\nconst SNACKBAR_VARIANTS = {\n\tinit: {\n\t\theight: 0,\n\t\topacity: 0,\n\t},\n\topen: {\n\t\theight: 'auto',\n\t\topacity: 1,\n\t\ttransition: {\n\t\t\theight: { stiffness: 1000, velocity: -100 },\n\t\t},\n\t},\n\texit: {\n\t\topacity: 0,\n\t\ttransition: {\n\t\t\tduration: 0.5,\n\t\t},\n\t},\n};\n\nconst SNACKBAR_REDUCE_MOTION_VARIANTS = {\n\tinit: false,\n\topen: false,\n\texit: false,\n};\n\n/**\n * Renders a list of notices.\n *\n * @param {Object} $0 Props passed to the component.\n * @param {Array} $0.notices Array of notices to render.\n * @param {Function} $0.onRemove Function called when a notice should be removed / dismissed.\n * @param {Object} $0.className Name of the class used by the component.\n * @param {Object} $0.children Array of children to be rendered inside the notice list.\n *\n * @return {Object} The rendered notices list.\n */\nfunction SnackbarList( { notices, className, children, onRemove = noop } ) {\n\tconst listRef = useRef();\n\tconst isReducedMotion = useReducedMotion();\n\tclassName = classnames( 'components-snackbar-list', className );\n\tconst removeNotice = ( notice ) => () => onRemove( notice.id );\n\treturn (\n\t\t<div className={ className } tabIndex={ -1 } ref={ listRef }>\n\t\t\t{ children }\n\t\t\t<AnimatePresence>\n\t\t\t\t{ notices.map( ( notice ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tlayout={ ! isReducedMotion } // See https://www.framer.com/docs/animation/#layout-animations\n\t\t\t\t\t\t\tinitial={ 'init' }\n\t\t\t\t\t\t\tanimate={ 'open' }\n\t\t\t\t\t\t\texit={ 'exit' }\n\t\t\t\t\t\t\tkey={ notice.id }\n\t\t\t\t\t\t\tvariants={\n\t\t\t\t\t\t\t\tisReducedMotion\n\t\t\t\t\t\t\t\t\t? SNACKBAR_REDUCE_MOTION_VARIANTS\n\t\t\t\t\t\t\t\t\t: SNACKBAR_VARIANTS\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"components-snackbar-list__notice-container\">\n\t\t\t\t\t\t\t\t<Snackbar\n\t\t\t\t\t\t\t\t\t{ ...omit( notice, [ 'content' ] ) }\n\t\t\t\t\t\t\t\t\tonRemove={ removeNotice( notice ) }\n\t\t\t\t\t\t\t\t\tlistRef={ listRef }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ notice.content }\n\t\t\t\t\t\t\t\t</Snackbar>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</AnimatePresence>\n\t\t</div>\n\t);\n}\n\nexport default SnackbarList;\n"]}
@@ -32,6 +32,8 @@ var _button = _interopRequireDefault(require("../button"));
32
32
  /**
33
33
  * Internal dependencies
34
34
  */
35
+ const noop = () => {};
36
+
35
37
  const TabButton = _ref => {
36
38
  let {
37
39
  tabId,
@@ -59,7 +61,7 @@ function TabPanel(_ref2) {
59
61
  initialTabName,
60
62
  orientation = 'horizontal',
61
63
  activeClass = 'is-active',
62
- onSelect = _lodash.noop
64
+ onSelect = noop
63
65
  } = _ref2;
64
66
  const instanceId = (0, _compose.useInstanceId)(TabPanel, 'tab-panel');
65
67
  const [selected, setSelected] = (0, _element.useState)(null);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tab-panel/index.js"],"names":["TabButton","tabId","onClick","children","selected","rest","TabPanel","className","tabs","initialTabName","orientation","activeClass","onSelect","noop","instanceId","setSelected","handleClick","tabKey","onNavigate","childIndex","child","click","selectedTab","name","selectedId","newSelectedTab","length","map","tab","title"],"mappings":";;;;;;;;;AASA;;;;AANA;;AACA;;AAMA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAMA,SAAS,GAAG;AAAA,MAAE;AAAEC,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA,QAA5B;AAAsC,OAAGC;AAAzC,GAAF;AAAA,SACjB,4BAAC,eAAD;AAC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AAMD,IAAI,CAACkB,MAAL,GAAc,CAAd,GAAkBlB,IAAI,CAAE,CAAF,CAAJ,CAAUe,IAA5B,GAAmC,IAAzC,CADJ,CAAX;AAGA;AACD,GAPD,EAOG,CAAEf,IAAF,CAPH;AASA,SACC;AAAK,IAAA,SAAS,EAAGD;AAAjB,KACC,4BAAC,iCAAD;AACC,IAAA,IAAI,EAAC,SADN;AAEC,IAAA,WAAW,EAAGG,WAFf;AAGC,IAAA,UAAU,EAAGQ,UAHd;AAIC,IAAA,SAAS,EAAC;AAJX,KAMGV,IAAI,CAACmB,GAAL,CAAYC,GAAF,IACX,4BAAC,SAAD;AACC,IAAA,SAAS,EAAG,yBACX,iCADW,EAEXA,GAAG,CAACrB,SAFO,EAGX;AACC,OAAEI,WAAF,GAAiBiB,GAAG,CAACL,IAAJ,KAAanB;AAD/B,KAHW,CADb;AAQC,IAAA,KAAK,EAAI,GAAGU,UAAY,IAAIc,GAAG,CAACL,IAAM,EARvC;AASC,qBAAiB,GAAGT,UAAY,IAAIc,GAAG,CAACL,IAAM,OAT/C;AAUC,IAAA,QAAQ,EAAGK,GAAG,CAACL,IAAJ,KAAanB,QAVzB;AAWC,IAAA,GAAG,EAAGwB,GAAG,CAACL,IAXX;AAYC,IAAA,OAAO,EAAG,qBAASP,WAAT,EAAsBY,GAAG,CAACL,IAA1B;AAZX,KAcGK,GAAG,CAACC,KAdP,CADC,CANH,CADD,EA0BGP,WAAW,IACZ;AACC,IAAA,GAAG,EAAGE,UADP;AAEC,uBAAkBA,UAFnB;AAGC,IAAA,IAAI,EAAC,UAHN;AAIC,IAAA,EAAE,EAAI,GAAGA,UAAY,OAJtB;AAKC,IAAA,SAAS,EAAC;AALX,KAOGrB,QAAQ,CAAEmB,WAAF,CAPX,CA3BF,CADD;AAwCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { partial, noop, find } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { NavigableMenu } from '../navigable-container';\nimport Button from '../button';\n\nconst TabButton = ( { tabId, onClick, children, selected, ...rest } ) => (\n\t<Button\n\t\trole=\"tab\"\n\t\ttabIndex={ selected ? null : -1 }\n\t\taria-selected={ selected }\n\t\tid={ tabId }\n\t\tonClick={ onClick }\n\t\t{ ...rest }\n\t>\n\t\t{ children }\n\t</Button>\n);\n\nexport default function TabPanel( {\n\tclassName,\n\tchildren,\n\ttabs,\n\tinitialTabName,\n\torientation = 'horizontal',\n\tactiveClass = 'is-active',\n\tonSelect = noop,\n} ) {\n\tconst instanceId = useInstanceId( TabPanel, 'tab-panel' );\n\tconst [ selected, setSelected ] = useState( null );\n\n\tconst handleClick = ( tabKey ) => {\n\t\tsetSelected( tabKey );\n\t\tonSelect( tabKey );\n\t};\n\n\tconst onNavigate = ( childIndex, child ) => {\n\t\tchild.click();\n\t};\n\tconst selectedTab = find( tabs, { name: selected } );\n\tconst selectedId = `${ instanceId }-${ selectedTab?.name ?? 'none' }`;\n\n\tuseEffect( () => {\n\t\tconst newSelectedTab = find( tabs, { name: selected } );\n\t\tif ( ! newSelectedTab ) {\n\t\t\tsetSelected(\n\t\t\t\tinitialTabName || ( tabs.length > 0 ? tabs[ 0 ].name : null )\n\t\t\t);\n\t\t}\n\t}, [ tabs ] );\n\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<NavigableMenu\n\t\t\t\trole=\"tablist\"\n\t\t\t\torientation={ orientation }\n\t\t\t\tonNavigate={ onNavigate }\n\t\t\t\tclassName=\"components-tab-panel__tabs\"\n\t\t\t>\n\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t<TabButton\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'components-tab-panel__tabs-item',\n\t\t\t\t\t\t\ttab.className,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ activeClass ]: tab.name === selected,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\ttabId={ `${ instanceId }-${ tab.name }` }\n\t\t\t\t\t\taria-controls={ `${ instanceId }-${ tab.name }-view` }\n\t\t\t\t\t\tselected={ tab.name === selected }\n\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\tonClick={ partial( handleClick, tab.name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t</TabButton>\n\t\t\t\t) ) }\n\t\t\t</NavigableMenu>\n\t\t\t{ selectedTab && (\n\t\t\t\t<div\n\t\t\t\t\tkey={ selectedId }\n\t\t\t\t\taria-labelledby={ selectedId }\n\t\t\t\t\trole=\"tabpanel\"\n\t\t\t\t\tid={ `${ selectedId }-view` }\n\t\t\t\t\tclassName=\"components-tab-panel__tab-content\"\n\t\t\t\t>\n\t\t\t\t\t{ children( selectedTab ) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tab-panel/index.js"],"names":["noop","TabButton","tabId","onClick","children","selected","rest","TabPanel","className","tabs","initialTabName","orientation","activeClass","onSelect","instanceId","setSelected","handleClick","tabKey","onNavigate","childIndex","child","click","selectedTab","name","selectedId","newSelectedTab","length","map","tab","title"],"mappings":";;;;;;;;;AASA;;;;AANA;;AACA;;AAMA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,SAAS,GAAG;AAAA,MAAE;AAAEC,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA,QAA5B;AAAsC,OAAGC;AAAzC,GAAF;AAAA,SACjB,4BAAC,eAAD;AACC,IAAA,IAAI,EAAC,KADN;AAEC,IAAA,QAAQ,EAAGD,QAAQ,GAAG,IAAH,GAAU,CAAC,CAF/B;AAGC,qB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,CADJ,CAAX;AAGA;AACD,GAPD,EAOG,CAAEd,IAAF,CAPH;AASA,SACC;AAAK,IAAA,SAAS,EAAGD;AAAjB,KACC,4BAAC,iCAAD;AACC,IAAA,IAAI,EAAC,SADN;AAEC,IAAA,WAAW,EAAGG,WAFf;AAGC,IAAA,UAAU,EAAGO,UAHd;AAIC,IAAA,SAAS,EAAC;AAJX,KAMGT,IAAI,CAACkB,GAAL,CAAYC,GAAF,IACX,4BAAC,SAAD;AACC,IAAA,SAAS,EAAG,yBACX,iCADW,EAEXA,GAAG,CAACpB,SAFO,EAGX;AACC,OAAEI,WAAF,GAAiBgB,GAAG,CAACL,IAAJ,KAAalB;AAD/B,KAHW,CADb;AAQC,IAAA,KAAK,EAAI,GAAGS,UAAY,IAAIc,GAAG,CAACL,IAAM,EARvC;AASC,qBAAiB,GAAGT,UAAY,IAAIc,GAAG,CAACL,IAAM,OAT/C;AAUC,IAAA,QAAQ,EAAGK,GAAG,CAACL,IAAJ,KAAalB,QAVzB;AAWC,IAAA,GAAG,EAAGuB,GAAG,CAACL,IAXX;AAYC,IAAA,OAAO,EAAG,qBAASP,WAAT,EAAsBY,GAAG,CAACL,IAA1B;AAZX,KAcGK,GAAG,CAACC,KAdP,CADC,CANH,CADD,EA0BGP,WAAW,IACZ;AACC,IAAA,GAAG,EAAGE,UADP;AAEC,uBAAkBA,UAFnB;AAGC,IAAA,IAAI,EAAC,UAHN;AAIC,IAAA,EAAE,EAAI,GAAGA,UAAY,OAJtB;AAKC,IAAA,SAAS,EAAC;AALX,KAOGpB,QAAQ,CAAEkB,WAAF,CAPX,CA3BF,CADD;AAwCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { partial, find } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { NavigableMenu } from '../navigable-container';\nimport Button from '../button';\n\nconst noop = () => {};\n\nconst TabButton = ( { tabId, onClick, children, selected, ...rest } ) => (\n\t<Button\n\t\trole=\"tab\"\n\t\ttabIndex={ selected ? null : -1 }\n\t\taria-selected={ selected }\n\t\tid={ tabId }\n\t\tonClick={ onClick }\n\t\t{ ...rest }\n\t>\n\t\t{ children }\n\t</Button>\n);\n\nexport default function TabPanel( {\n\tclassName,\n\tchildren,\n\ttabs,\n\tinitialTabName,\n\torientation = 'horizontal',\n\tactiveClass = 'is-active',\n\tonSelect = noop,\n} ) {\n\tconst instanceId = useInstanceId( TabPanel, 'tab-panel' );\n\tconst [ selected, setSelected ] = useState( null );\n\n\tconst handleClick = ( tabKey ) => {\n\t\tsetSelected( tabKey );\n\t\tonSelect( tabKey );\n\t};\n\n\tconst onNavigate = ( childIndex, child ) => {\n\t\tchild.click();\n\t};\n\tconst selectedTab = find( tabs, { name: selected } );\n\tconst selectedId = `${ instanceId }-${ selectedTab?.name ?? 'none' }`;\n\n\tuseEffect( () => {\n\t\tconst newSelectedTab = find( tabs, { name: selected } );\n\t\tif ( ! newSelectedTab ) {\n\t\t\tsetSelected(\n\t\t\t\tinitialTabName || ( tabs.length > 0 ? tabs[ 0 ].name : null )\n\t\t\t);\n\t\t}\n\t}, [ tabs ] );\n\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<NavigableMenu\n\t\t\t\trole=\"tablist\"\n\t\t\t\torientation={ orientation }\n\t\t\t\tonNavigate={ onNavigate }\n\t\t\t\tclassName=\"components-tab-panel__tabs\"\n\t\t\t>\n\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t<TabButton\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'components-tab-panel__tabs-item',\n\t\t\t\t\t\t\ttab.className,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ activeClass ]: tab.name === selected,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\ttabId={ `${ instanceId }-${ tab.name }` }\n\t\t\t\t\t\taria-controls={ `${ instanceId }-${ tab.name }-view` }\n\t\t\t\t\t\tselected={ tab.name === selected }\n\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\tonClick={ partial( handleClick, tab.name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t</TabButton>\n\t\t\t\t) ) }\n\t\t\t</NavigableMenu>\n\t\t\t{ selectedTab && (\n\t\t\t\t<div\n\t\t\t\t\tkey={ selectedId }\n\t\t\t\t\taria-labelledby={ selectedId }\n\t\t\t\t\trole=\"tabpanel\"\n\t\t\t\t\tid={ `${ selectedId }-view` }\n\t\t\t\t\tclassName=\"components-tab-panel__tab-content\"\n\t\t\t\t>\n\t\t\t\t\t{ children( selectedTab ) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}