@wordpress/components 19.4.0 → 19.5.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 (406) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/CONTRIBUTING.md +69 -2
  3. package/build/box-control/unit-control.js +2 -2
  4. package/build/box-control/unit-control.js.map +1 -1
  5. package/build/card/card/component.js +2 -2
  6. package/build/card/card/component.js.map +1 -1
  7. package/build/card/card-body/component.js +1 -1
  8. package/build/card/card-body/component.js.map +1 -1
  9. package/build/card/card-divider/component.js +1 -1
  10. package/build/card/card-divider/component.js.map +1 -1
  11. package/build/card/card-footer/component.js +1 -1
  12. package/build/card/card-footer/component.js.map +1 -1
  13. package/build/card/card-header/component.js +1 -1
  14. package/build/card/card-header/component.js.map +1 -1
  15. package/build/card/card-media/component.js +1 -1
  16. package/build/card/card-media/component.js.map +1 -1
  17. package/build/color-palette/index.native.js +35 -30
  18. package/build/color-palette/index.native.js.map +1 -1
  19. package/build/color-picker/component.js.map +1 -1
  20. package/build/color-picker/hex-input.js +6 -9
  21. package/build/color-picker/hex-input.js.map +1 -1
  22. package/build/confirm-dialog/component.js.map +1 -1
  23. package/build/divider/component.js.map +1 -1
  24. package/build/elevation/component.js +1 -1
  25. package/build/elevation/component.js.map +1 -1
  26. package/build/flex/flex/component.js +1 -1
  27. package/build/flex/flex/component.js.map +1 -1
  28. package/build/flex/flex-block/component.js +1 -1
  29. package/build/flex/flex-block/component.js.map +1 -1
  30. package/build/flex/flex-item/component.js +1 -1
  31. package/build/flex/flex-item/component.js.map +1 -1
  32. package/build/flyout/flyout/component.js +1 -1
  33. package/build/flyout/flyout/component.js.map +1 -1
  34. package/build/flyout/flyout-content/component.js +1 -1
  35. package/build/flyout/flyout-content/component.js.map +1 -1
  36. package/build/focal-point-picker/index.js +18 -12
  37. package/build/focal-point-picker/index.js.map +1 -1
  38. package/build/font-size-picker/index.js +0 -1
  39. package/build/font-size-picker/index.js.map +1 -1
  40. package/build/grid/component.js +1 -1
  41. package/build/grid/component.js.map +1 -1
  42. package/build/h-stack/component.js +1 -1
  43. package/build/h-stack/component.js.map +1 -1
  44. package/build/heading/component.js.map +1 -1
  45. package/build/index.js +12 -0
  46. package/build/index.js.map +1 -1
  47. package/build/index.native.js +15 -1
  48. package/build/index.native.js.map +1 -1
  49. package/build/input-control/index.js.map +1 -1
  50. package/build/input-control/input-base.js.map +1 -1
  51. package/build/input-control/input-field.js +7 -7
  52. package/build/input-control/input-field.js.map +1 -1
  53. package/build/input-control/reducer/reducer.js +3 -0
  54. package/build/input-control/reducer/reducer.js.map +1 -1
  55. package/build/item-group/item/component.js.map +1 -1
  56. package/build/item-group/item-group/component.js.map +1 -1
  57. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  58. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  59. package/build/mobile/color-settings/palette.screen.native.js +26 -9
  60. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  61. package/build/mobile/global-styles-context/utils.native.js +63 -9
  62. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  63. package/build/mobile/inserter-button/index.native.js +3 -3
  64. package/build/mobile/inserter-button/index.native.js.map +1 -1
  65. package/build/mobile/inserter-button/sparkles.js +25 -0
  66. package/build/mobile/inserter-button/sparkles.js.map +1 -0
  67. package/build/navigator/index.js +16 -0
  68. package/build/navigator/index.js.map +1 -1
  69. package/build/navigator/navigator-back-button/component.js +72 -0
  70. package/build/navigator/navigator-back-button/component.js.map +1 -0
  71. package/build/navigator/navigator-back-button/hook.js +49 -0
  72. package/build/navigator/navigator-back-button/hook.js.map +1 -0
  73. package/build/navigator/navigator-back-button/index.js +16 -0
  74. package/build/navigator/navigator-back-button/index.js.map +1 -0
  75. package/build/navigator/navigator-button/component.js +71 -0
  76. package/build/navigator/navigator-button/component.js.map +1 -0
  77. package/build/navigator/navigator-button/hook.js +59 -0
  78. package/build/navigator/navigator-button/hook.js.map +1 -0
  79. package/build/navigator/navigator-button/index.js +16 -0
  80. package/build/navigator/navigator-button/index.js.map +1 -0
  81. package/build/navigator/navigator-provider/component.js +11 -21
  82. package/build/navigator/navigator-provider/component.js.map +1 -1
  83. package/build/navigator/navigator-screen/component.js +14 -22
  84. package/build/navigator/navigator-screen/component.js.map +1 -1
  85. package/build/resizable-box/index.js.map +1 -1
  86. package/build/resizable-box/resize-tooltip/index.js.map +1 -1
  87. package/build/resizable-box/resize-tooltip/label.js.map +1 -1
  88. package/build/scrollable/component.js +1 -1
  89. package/build/scrollable/component.js.map +1 -1
  90. package/build/select-control/index.js.map +1 -1
  91. package/build/spacer/component.js.map +1 -1
  92. package/build/surface/component.js +1 -1
  93. package/build/surface/component.js.map +1 -1
  94. package/build/text/component.js +1 -1
  95. package/build/text/component.js.map +1 -1
  96. package/build/text-control/index.js +2 -2
  97. package/build/text-control/index.js.map +1 -1
  98. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  99. package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  100. package/build/tools-panel/tools-panel/component.js.map +1 -1
  101. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  102. package/build/tools-panel/tools-panel-item/component.js.map +1 -1
  103. package/build/tree-grid/index.js +50 -6
  104. package/build/tree-grid/index.js.map +1 -1
  105. package/build/truncate/component.js +1 -1
  106. package/build/truncate/component.js.map +1 -1
  107. package/build/ui/control-group/component.js +1 -1
  108. package/build/ui/control-group/component.js.map +1 -1
  109. package/build/ui/control-label/component.js +1 -1
  110. package/build/ui/control-label/component.js.map +1 -1
  111. package/build/ui/form-group/form-group.js +1 -1
  112. package/build/ui/form-group/form-group.js.map +1 -1
  113. package/build/ui/shortcut/component.js.map +1 -1
  114. package/build/ui/spinner/component.js +1 -1
  115. package/build/ui/spinner/component.js.map +1 -1
  116. package/build/ui/tooltip/component.js +1 -1
  117. package/build/ui/tooltip/component.js.map +1 -1
  118. package/build/ui/tooltip/content.js +1 -1
  119. package/build/ui/tooltip/content.js.map +1 -1
  120. package/build/unit-control/index.js.map +1 -1
  121. package/build/v-stack/component.js +1 -1
  122. package/build/v-stack/component.js.map +1 -1
  123. package/build/visually-hidden/component.js +1 -1
  124. package/build/visually-hidden/component.js.map +1 -1
  125. package/build/z-stack/component.js.map +1 -1
  126. package/build-module/box-control/unit-control.js +1 -1
  127. package/build-module/box-control/unit-control.js.map +1 -1
  128. package/build-module/card/card/component.js +2 -2
  129. package/build-module/card/card/component.js.map +1 -1
  130. package/build-module/card/card-body/component.js +1 -1
  131. package/build-module/card/card-body/component.js.map +1 -1
  132. package/build-module/card/card-divider/component.js +1 -1
  133. package/build-module/card/card-divider/component.js.map +1 -1
  134. package/build-module/card/card-footer/component.js +1 -1
  135. package/build-module/card/card-footer/component.js.map +1 -1
  136. package/build-module/card/card-header/component.js +1 -1
  137. package/build-module/card/card-header/component.js.map +1 -1
  138. package/build-module/card/card-media/component.js +1 -1
  139. package/build-module/card/card-media/component.js.map +1 -1
  140. package/build-module/color-palette/index.native.js +36 -31
  141. package/build-module/color-palette/index.native.js.map +1 -1
  142. package/build-module/color-picker/component.js.map +1 -1
  143. package/build-module/color-picker/hex-input.js +6 -9
  144. package/build-module/color-picker/hex-input.js.map +1 -1
  145. package/build-module/confirm-dialog/component.js.map +1 -1
  146. package/build-module/divider/component.js.map +1 -1
  147. package/build-module/elevation/component.js +1 -1
  148. package/build-module/elevation/component.js.map +1 -1
  149. package/build-module/flex/flex/component.js +1 -1
  150. package/build-module/flex/flex/component.js.map +1 -1
  151. package/build-module/flex/flex-block/component.js +1 -1
  152. package/build-module/flex/flex-block/component.js.map +1 -1
  153. package/build-module/flex/flex-item/component.js +1 -1
  154. package/build-module/flex/flex-item/component.js.map +1 -1
  155. package/build-module/flyout/flyout/component.js +1 -1
  156. package/build-module/flyout/flyout/component.js.map +1 -1
  157. package/build-module/flyout/flyout-content/component.js +1 -1
  158. package/build-module/flyout/flyout-content/component.js.map +1 -1
  159. package/build-module/focal-point-picker/index.js +18 -12
  160. package/build-module/focal-point-picker/index.js.map +1 -1
  161. package/build-module/font-size-picker/index.js +0 -1
  162. package/build-module/font-size-picker/index.js.map +1 -1
  163. package/build-module/grid/component.js +1 -1
  164. package/build-module/grid/component.js.map +1 -1
  165. package/build-module/h-stack/component.js +1 -1
  166. package/build-module/h-stack/component.js.map +1 -1
  167. package/build-module/heading/component.js.map +1 -1
  168. package/build-module/index.js +1 -1
  169. package/build-module/index.js.map +1 -1
  170. package/build-module/index.native.js +1 -1
  171. package/build-module/index.native.js.map +1 -1
  172. package/build-module/input-control/index.js.map +1 -1
  173. package/build-module/input-control/input-base.js.map +1 -1
  174. package/build-module/input-control/input-field.js +6 -6
  175. package/build-module/input-control/input-field.js.map +1 -1
  176. package/build-module/input-control/reducer/reducer.js +3 -0
  177. package/build-module/input-control/reducer/reducer.js.map +1 -1
  178. package/build-module/item-group/item/component.js.map +1 -1
  179. package/build-module/item-group/item-group/component.js.map +1 -1
  180. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  181. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  182. package/build-module/mobile/color-settings/palette.screen.native.js +27 -10
  183. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  184. package/build-module/mobile/global-styles-context/utils.native.js +60 -10
  185. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  186. package/build-module/mobile/inserter-button/index.native.js +1 -1
  187. package/build-module/mobile/inserter-button/index.native.js.map +1 -1
  188. package/build-module/mobile/inserter-button/sparkles.js +16 -0
  189. package/build-module/mobile/inserter-button/sparkles.js.map +1 -0
  190. package/build-module/navigator/index.js +2 -0
  191. package/build-module/navigator/index.js.map +1 -1
  192. package/build-module/navigator/navigator-back-button/component.js +59 -0
  193. package/build-module/navigator/navigator-back-button/component.js.map +1 -0
  194. package/build-module/navigator/navigator-back-button/hook.js +36 -0
  195. package/build-module/navigator/navigator-back-button/hook.js.map +1 -0
  196. package/build-module/navigator/navigator-back-button/index.js +2 -0
  197. package/build-module/navigator/navigator-back-button/index.js.map +1 -0
  198. package/build-module/navigator/navigator-button/component.js +58 -0
  199. package/build-module/navigator/navigator-button/component.js.map +1 -0
  200. package/build-module/navigator/navigator-button/hook.js +46 -0
  201. package/build-module/navigator/navigator-button/hook.js.map +1 -0
  202. package/build-module/navigator/navigator-button/index.js +2 -0
  203. package/build-module/navigator/navigator-button/index.js.map +1 -0
  204. package/build-module/navigator/navigator-provider/component.js +11 -21
  205. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  206. package/build-module/navigator/navigator-screen/component.js +13 -22
  207. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  208. package/build-module/resizable-box/index.js.map +1 -1
  209. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  210. package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
  211. package/build-module/scrollable/component.js +1 -1
  212. package/build-module/scrollable/component.js.map +1 -1
  213. package/build-module/select-control/index.js +1 -1
  214. package/build-module/select-control/index.js.map +1 -1
  215. package/build-module/spacer/component.js.map +1 -1
  216. package/build-module/surface/component.js +1 -1
  217. package/build-module/surface/component.js.map +1 -1
  218. package/build-module/text/component.js +1 -1
  219. package/build-module/text/component.js.map +1 -1
  220. package/build-module/text-control/index.js +2 -2
  221. package/build-module/text-control/index.js.map +1 -1
  222. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  223. package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  224. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  225. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  226. package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
  227. package/build-module/tree-grid/index.js +51 -7
  228. package/build-module/tree-grid/index.js.map +1 -1
  229. package/build-module/truncate/component.js +1 -1
  230. package/build-module/truncate/component.js.map +1 -1
  231. package/build-module/ui/control-group/component.js +1 -1
  232. package/build-module/ui/control-group/component.js.map +1 -1
  233. package/build-module/ui/control-label/component.js +1 -1
  234. package/build-module/ui/control-label/component.js.map +1 -1
  235. package/build-module/ui/form-group/form-group.js +1 -1
  236. package/build-module/ui/form-group/form-group.js.map +1 -1
  237. package/build-module/ui/shortcut/component.js.map +1 -1
  238. package/build-module/ui/spinner/component.js +1 -1
  239. package/build-module/ui/spinner/component.js.map +1 -1
  240. package/build-module/ui/tooltip/component.js +1 -1
  241. package/build-module/ui/tooltip/component.js.map +1 -1
  242. package/build-module/ui/tooltip/content.js +1 -1
  243. package/build-module/ui/tooltip/content.js.map +1 -1
  244. package/build-module/unit-control/index.js.map +1 -1
  245. package/build-module/v-stack/component.js +1 -1
  246. package/build-module/v-stack/component.js.map +1 -1
  247. package/build-module/visually-hidden/component.js +1 -1
  248. package/build-module/visually-hidden/component.js.map +1 -1
  249. package/build-module/z-stack/component.js.map +1 -1
  250. package/build-types/card/card-divider/hook.d.ts +0 -1
  251. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  252. package/build-types/color-picker/styles.d.ts +2 -4
  253. package/build-types/color-picker/styles.d.ts.map +1 -1
  254. package/build-types/confirm-dialog/component.d.ts +2 -6
  255. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  256. package/build-types/flyout/flyout/hook.d.ts +0 -1
  257. package/build-types/flyout/flyout/hook.d.ts.map +1 -1
  258. package/build-types/input-control/index.d.ts +3 -3
  259. package/build-types/input-control/index.d.ts.map +1 -1
  260. package/build-types/input-control/input-base.d.ts +2 -2
  261. package/build-types/input-control/input-base.d.ts.map +1 -1
  262. package/build-types/input-control/input-field.d.ts +1 -3
  263. package/build-types/input-control/input-field.d.ts.map +1 -1
  264. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  265. package/build-types/input-control/types.d.ts +1 -1
  266. package/build-types/input-control/types.d.ts.map +1 -1
  267. package/build-types/navigator/index.d.ts +2 -0
  268. package/build-types/navigator/index.d.ts.map +1 -1
  269. package/build-types/navigator/navigator-back-button/component.d.ts +38 -0
  270. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -0
  271. package/build-types/navigator/navigator-back-button/hook.d.ts +282 -0
  272. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -0
  273. package/build-types/navigator/navigator-back-button/index.d.ts +2 -0
  274. package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -0
  275. package/build-types/navigator/navigator-button/component.d.ts +37 -0
  276. package/build-types/navigator/navigator-button/component.d.ts.map +1 -0
  277. package/build-types/navigator/navigator-button/hook.d.ts +282 -0
  278. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -0
  279. package/build-types/navigator/navigator-button/index.d.ts +2 -0
  280. package/build-types/navigator/navigator-button/index.d.ts.map +1 -0
  281. package/build-types/navigator/navigator-provider/component.d.ts +10 -20
  282. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  283. package/build-types/navigator/navigator-screen/component.d.ts +10 -20
  284. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  285. package/build-types/navigator/types.d.ts +21 -0
  286. package/build-types/navigator/types.d.ts.map +1 -1
  287. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  288. package/build-types/resizable-box/index.d.ts +2 -2
  289. package/build-types/resizable-box/index.d.ts.map +1 -1
  290. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  291. package/build-types/select-control/index.d.ts +1 -3
  292. package/build-types/select-control/index.d.ts.map +1 -1
  293. package/build-types/ui/context/wordpress-component.d.ts +2 -6
  294. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  295. package/build-types/unit-control/index.d.ts +1 -3
  296. package/build-types/unit-control/index.d.ts.map +1 -1
  297. package/build-types/z-stack/component.d.ts.map +1 -1
  298. package/package.json +8 -7
  299. package/src/alignment-matrix-control/README.md +4 -0
  300. package/src/alignment-matrix-control/stories/index.js +1 -1
  301. package/src/base-control/stories/index.js +65 -22
  302. package/src/box-control/stories/index.js +4 -1
  303. package/src/box-control/unit-control.js +1 -1
  304. package/src/card/card/component.js +1 -1
  305. package/src/card/card-body/component.js +1 -1
  306. package/src/card/card-divider/component.js +1 -1
  307. package/src/card/card-footer/component.js +1 -1
  308. package/src/card/card-header/component.js +1 -1
  309. package/src/card/card-media/component.js +1 -1
  310. package/src/color-palette/index.native.js +92 -75
  311. package/src/color-palette/style.native.scss +10 -5
  312. package/src/color-picker/component.tsx +2 -2
  313. package/src/color-picker/hex-input.tsx +9 -9
  314. package/src/confirm-dialog/component.tsx +2 -2
  315. package/src/divider/component.tsx +2 -2
  316. package/src/elevation/component.js +1 -1
  317. package/src/flex/flex/component.js +1 -1
  318. package/src/flex/flex-block/component.js +1 -1
  319. package/src/flex/flex-item/component.js +1 -1
  320. package/src/flyout/flyout/component.js +1 -1
  321. package/src/flyout/flyout-content/component.js +1 -1
  322. package/src/focal-point-picker/README.md +7 -0
  323. package/src/focal-point-picker/index.js +12 -7
  324. package/src/focal-point-picker/stories/index.js +30 -0
  325. package/src/focal-point-picker/test/index.js +44 -0
  326. package/src/font-size-picker/index.js +0 -1
  327. package/src/form-file-upload/README.md +1 -1
  328. package/src/form-file-upload/stories/index.js +51 -0
  329. package/src/grid/component.js +1 -1
  330. package/src/h-stack/component.js +1 -1
  331. package/src/heading/component.tsx +2 -2
  332. package/src/index.js +2 -0
  333. package/src/index.native.js +5 -1
  334. package/src/input-control/index.tsx +2 -2
  335. package/src/input-control/input-base.tsx +2 -2
  336. package/src/input-control/input-field.tsx +4 -6
  337. package/src/input-control/reducer/reducer.ts +3 -0
  338. package/src/input-control/stories/index.js +1 -1
  339. package/src/input-control/types.ts +1 -1
  340. package/src/item-group/item/component.tsx +2 -2
  341. package/src/item-group/item-group/component.tsx +2 -2
  342. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +10 -1
  343. package/src/mobile/color-settings/palette.screen.native.js +39 -9
  344. package/src/mobile/color-settings/style.native.scss +4 -0
  345. package/src/mobile/global-styles-context/test/fixtures/theme.native.js +27 -0
  346. package/src/mobile/global-styles-context/test/utils.native.js +2 -2
  347. package/src/mobile/global-styles-context/utils.native.js +75 -6
  348. package/src/mobile/inserter-button/index.native.js +1 -2
  349. package/src/mobile/inserter-button/sparkles.js +15 -0
  350. package/src/navigation/stories/index.js +1 -1
  351. package/src/navigator/index.ts +2 -0
  352. package/src/navigator/navigator-back-button/README.md +31 -0
  353. package/src/navigator/navigator-back-button/component.tsx +62 -0
  354. package/src/navigator/navigator-back-button/hook.ts +40 -0
  355. package/src/navigator/navigator-back-button/index.ts +1 -0
  356. package/src/navigator/navigator-button/README.md +38 -0
  357. package/src/navigator/navigator-button/component.tsx +61 -0
  358. package/src/navigator/navigator-button/hook.ts +55 -0
  359. package/src/navigator/navigator-button/index.ts +1 -0
  360. package/src/navigator/navigator-provider/README.md +20 -33
  361. package/src/navigator/navigator-provider/component.tsx +12 -22
  362. package/src/navigator/navigator-screen/README.md +1 -1
  363. package/src/navigator/navigator-screen/component.tsx +14 -23
  364. package/src/navigator/stories/index.js +24 -37
  365. package/src/navigator/test/index.js +89 -34
  366. package/src/navigator/types.ts +26 -0
  367. package/src/number-control/stories/index.js +1 -1
  368. package/src/radio/stories/index.js +1 -1
  369. package/src/radio-group/stories/index.js +4 -1
  370. package/src/resizable-box/index.tsx +2 -2
  371. package/src/resizable-box/resize-tooltip/index.tsx +2 -2
  372. package/src/resizable-box/resize-tooltip/label.tsx +2 -2
  373. package/src/scrollable/component.js +1 -1
  374. package/src/select-control/index.tsx +2 -3
  375. package/src/spacer/component.tsx +2 -2
  376. package/src/surface/component.js +1 -1
  377. package/src/text/component.js +1 -1
  378. package/src/text-control/index.js +2 -2
  379. package/src/toggle-group-control/stories/index.js +1 -1
  380. package/src/toggle-group-control/toggle-group-control/component.tsx +2 -2
  381. package/src/toggle-group-control/toggle-group-control-option/component.tsx +2 -2
  382. package/src/tools-panel/stories/index.js +0 -1
  383. package/src/tools-panel/tools-panel/component.tsx +2 -2
  384. package/src/tools-panel/tools-panel-header/component.tsx +2 -2
  385. package/src/tools-panel/tools-panel-item/component.tsx +2 -2
  386. package/src/tree-grid/README.md +24 -1
  387. package/src/tree-grid/index.js +66 -7
  388. package/src/tree-grid/stories/index.js +4 -1
  389. package/src/tree-grid/test/__snapshots__/index.js.snap +1 -14
  390. package/src/tree-grid/test/index.js +226 -7
  391. package/src/truncate/component.js +1 -1
  392. package/src/ui/context/wordpress-component.ts +2 -2
  393. package/src/ui/control-group/component.js +1 -1
  394. package/src/ui/control-label/component.js +1 -1
  395. package/src/ui/form-group/form-group.js +1 -1
  396. package/src/ui/shortcut/component.tsx +2 -2
  397. package/src/ui/spinner/component.js +1 -1
  398. package/src/ui/tooltip/component.js +1 -1
  399. package/src/ui/tooltip/content.js +1 -1
  400. package/src/unit-control/index.tsx +2 -2
  401. package/src/unit-control/stories/index.js +1 -1
  402. package/src/v-stack/component.js +1 -1
  403. package/src/visually-hidden/component.js +1 -1
  404. package/src/z-stack/component.tsx +2 -2
  405. package/tsconfig.tsbuildinfo +1 -1
  406. package/src/tools-panel/stories/typography-panel.js +0 -215
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/navigator/navigator-screen/component.tsx"],"names":["motion","css","focus","useContext","useEffect","useMemo","useRef","useReducedMotion","useMergeRefs","usePrevious","isRTL","contextConnect","useContextSystem","useCx","View","NavigatorContext","animationEnterDelay","animationEnterDuration","animationExitDuration","animationExitDelay","NavigatorScreen","props","forwardedRef","children","className","path","otherProps","prefersReducedMotion","location","isMatch","wrapperRef","previousLocation","cx","classes","isInitialLocation","isInitial","isBack","current","elementToFocus","focusTargetSelector","querySelector","firstTabbable","tabbable","find","mergedWrapperRef","animate","opacity","transition","delay","duration","ease","x","initial","exit","animatedProps","ConnectedNavigatorScreen"],"mappings":";;;;;AAAA;AACA;AACA;AAEA;AACA,SAASA,MAAT,QAAoC,eAApC;AACA,SAASC,GAAT,QAAoB,gBAApB;AAEA;AACA;AACA;;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,UAAT,E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AFG;AAOfC,IAAAA,CAAC,EAAE;AAPY,GAAhB;AASA,QAAMC,OAAO,GAAG;AACfN,IAAAA,OAAO,EAAE,CADM;AAEfK,IAAAA,CAAC,EACEzC,KAAK,MAAMkB,QAAQ,CAACQ,MAAtB,IAAoC,CAAE1B,KAAK,EAAP,IAAa,CAAEkB,QAAQ,CAACQ,MAA5D,GACG,EADH,GAEG,CAAC;AALU,GAAhB;AAOA,QAAMiB,IAAI,GAAG;AACZL,IAAAA,KAAK,EAAE7B,kBADK;AAEZ2B,IAAAA,OAAO,EAAE,CAFG;AAGZK,IAAAA,CAAC,EACE,CAAEzC,KAAK,EAAP,IAAakB,QAAQ,CAACQ,MAAxB,IAAsC1B,KAAK,MAAM,CAAEkB,QAAQ,CAACQ,MAA5D,GACG,EADH,GAEG,CAAC,EANO;AAOZW,IAAAA,UAAU,EAAE;AACXE,MAAAA,QAAQ,EAAE/B,qBADC;AAEXgC,MAAAA,IAAI,EAAE;AAFK;AAPA,GAAb;AAaA,QAAMI,aAAa,GAAG;AACrBT,IAAAA,OADqB;AAErBQ,IAAAA,IAFqB;AAGrBD,IAAAA;AAHqB,GAAtB;AAMA,SACC,cAAC,MAAD,CAAQ,GAAR;AACC,IAAA,GAAG,EAAGR,gBADP;AAEC,IAAA,SAAS,EAAGX;AAFb,KAGMP,UAHN,EAIM4B,aAJN,GAMG/B,QANH,CADD;AAUA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMgC,wBAAwB,GAAG5C,cAAc,CAC9CS,eAD8C,EAE9C,iBAF8C,CAA/C;AAKA,eAAemC,wBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport { motion, MotionProps } from 'framer-motion';\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { useContext, useEffect, useMemo, useRef } from '@wordpress/element';\nimport {\n\tuseReducedMotion,\n\tuseMergeRefs,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport { View } from '../../view';\nimport { NavigatorContext } from '../context';\nimport type { NavigatorScreenProps } from '../types';\n\nconst animationEnterDelay = 0;\nconst animationEnterDuration = 0.14;\nconst animationExitDuration = 0.14;\nconst animationExitDelay = 0;\n\n// Props specific to `framer-motion` can't be currently passed to `NavigatorScreen`,\n// as some of them would overlap with HTML props (e.g. `onAnimationStart`, ...)\ntype Props = Omit<\n\tWordPressComponentProps< NavigatorScreenProps, 'div', false >,\n\tkeyof MotionProps\n>;\n\nfunction NavigatorScreen( props: Props, forwardedRef: Ref< any > ) {\n\tconst { children, className, path, ...otherProps } = useContextSystem(\n\t\tprops,\n\t\t'NavigatorScreen'\n\t);\n\n\tconst prefersReducedMotion = useReducedMotion();\n\tconst { location } = useContext( NavigatorContext );\n\tconst isMatch = location.path === path;\n\tconst wrapperRef = useRef< HTMLDivElement >( null );\n\n\tconst previousLocation = usePrevious( location );\n\n\tconst cx = useCx();\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tcss( {\n\t\t\t\t\t// Ensures horizontal overflow is visually accessible\n\t\t\t\t\toverflowX: 'auto',\n\t\t\t\t\t// In case the root has a height, it should not be exceeded\n\t\t\t\t\tmaxHeight: '100%',\n\t\t\t\t} ),\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx ]\n\t);\n\n\t// Focus restoration\n\tconst isInitialLocation = location.isInitial && ! location.isBack;\n\tuseEffect( () => {\n\t\t// Only attempt to restore focus:\n\t\t// - if the current location is not the initial one (to avoid moving focus on page load)\n\t\t// - when the screen becomes visible\n\t\t// - if the wrapper ref has been assigned\n\t\tif ( isInitialLocation || ! isMatch || ! wrapperRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet elementToFocus: HTMLElement | null = null;\n\n\t\t// When navigating back, if a selector is provided, use it to look for the\n\t\t// target element (assumed to be a node inside the current NavigatorScreen)\n\t\tif ( location.isBack && previousLocation?.focusTargetSelector ) {\n\t\t\telementToFocus = wrapperRef.current.querySelector(\n\t\t\t\tpreviousLocation.focusTargetSelector\n\t\t\t);\n\t\t}\n\n\t\t// If the previous query didn't run or find any element to focus, fallback\n\t\t// to the first tabbable element in the screen (or the screen itself).\n\t\tif ( ! elementToFocus ) {\n\t\t\tconst firstTabbable = ( focus.tabbable.find(\n\t\t\t\twrapperRef.current\n\t\t\t) as HTMLElement[] )[ 0 ];\n\n\t\t\telementToFocus = firstTabbable ?? wrapperRef.current;\n\t\t}\n\n\t\telementToFocus.focus();\n\t}, [ isInitialLocation, isMatch ] );\n\n\tconst mergedWrapperRef = useMergeRefs( [ forwardedRef, wrapperRef ] );\n\n\tif ( ! isMatch ) {\n\t\treturn null;\n\t}\n\n\tif ( prefersReducedMotion ) {\n\t\treturn (\n\t\t\t<View\n\t\t\t\tref={ mergedWrapperRef }\n\t\t\t\tclassName={ classes }\n\t\t\t\t{ ...otherProps }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tconst animate = {\n\t\topacity: 1,\n\t\ttransition: {\n\t\t\tdelay: animationEnterDelay,\n\t\t\tduration: animationEnterDuration,\n\t\t\tease: 'easeInOut',\n\t\t},\n\t\tx: 0,\n\t};\n\tconst initial = {\n\t\topacity: 0,\n\t\tx:\n\t\t\t( isRTL() && location.isBack ) || ( ! isRTL() && ! location.isBack )\n\t\t\t\t? 50\n\t\t\t\t: -50,\n\t};\n\tconst exit = {\n\t\tdelay: animationExitDelay,\n\t\topacity: 0,\n\t\tx:\n\t\t\t( ! isRTL() && location.isBack ) || ( isRTL() && ! location.isBack )\n\t\t\t\t? 50\n\t\t\t\t: -50,\n\t\ttransition: {\n\t\t\tduration: animationExitDuration,\n\t\t\tease: 'easeInOut',\n\t\t},\n\t};\n\n\tconst animatedProps = {\n\t\tanimate,\n\t\texit,\n\t\tinitial,\n\t};\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={ mergedWrapperRef }\n\t\t\tclassName={ classes }\n\t\t\t{ ...otherProps }\n\t\t\t{ ...animatedProps }\n\t\t>\n\t\t\t{ children }\n\t\t</motion.div>\n\t);\n}\n\n/**\n * The `NavigatorScreen` component represents a single view/screen/panel/menu and is supposed to be used in combination with the `NavigatorProvider` component.\n *\n * @example\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalUseNavigator as useNavigator,\n * } from '@wordpress/components';\n *\n * function NavigatorButton( { path, ...props } ) {\n * const { goTo } = useNavigator();\n * return (\n * <Button\n * variant=\"primary\"\n * onClick={ () => goTo( path ) }\n * { ...props }\n * />\n * );\n * }\n *\n * function NavigatorBackButton( props ) {\n * const { goBack } = useNavigator();\n * return <Button variant=\"secondary\" onClick={ () => goBack() } { ...props } />;\n * }\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * \t <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>Go back</NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nconst ConnectedNavigatorScreen = contextConnect(\n\tNavigatorScreen,\n\t'NavigatorScreen'\n);\n\nexport default ConnectedNavigatorScreen;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/navigator/navigator-screen/component.tsx"],"names":["motion","css","focus","useContext","useEffect","useMemo","useRef","useReducedMotion","useMergeRefs","usePrevious","isRTL","escapeAttribute","contextConnect","useContextSystem","useCx","View","NavigatorContext","animationEnterDelay","animationEnterDuration","animationExitDuration","animationExitDelay","NavigatorScreen","props","forwardedRef","children","className","path","otherProps","prefersReducedMotion","location","isMatch","wrapperRef","previousLocation","cx","classes","isInitialLocation","isInitial","isBack","current","elementToFocus","focusTargetSelector","querySelector","firstTabbable","tabbable","find","mergedWrapperRef","animate","opacity","transition","delay","duration","ease","x","initial","exit","animatedProps","ConnectedNavigatorScreen"],"mappings":";;;;;AAAA;AACA;AACA;AAEA;AACA,SAASA,MAAT,QAAoC,eAApC;AACA,SAASC,GAAT,QAAoB,gBAApB;AAEA;AACA;AACA;;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,UAAT,EAAqBC,SAArB,EAAgCC,OAAhC,EAAyCC,MAAzC,QAAuD,oBAAvD;AACA,SACCC,gBADD,EAECC,YAFD,EAGCC,WAHD,QAIO,oBAJP;AAKA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,eAAT,QAAgC,wBAAhC;AAEA;AACA;AACA;;AACA,SACCC,cADD,EAECC,gBAFD,QAIO,kBAJP;AAKA,SAASC,KAAT,QAAsB,0BAAtB;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,gBAAT,QAAiC,YAAjC;AAGA,MAAMC,mBAAmB,GAAG,CAA5B;AACA,MAAMC,sBAAsB,GAAG,IAA/B;AACA,MAAMC,qBAAqB,GAAG,IAA9B;AACA,MAAMC,kBAAkB,GAAG,CAA3B,C,CAEA;AACA;;;;;;;;;;;;AAMA,SAASC,eAAT,CAA0BC,KAA1B,EAAwCC,YAAxC,EAA4E;AAC3E,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA,IAAvB;AAA6B,OAAGC;AAAhC,MAA+Cd,gBAAgB,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,QAAMI,aAAa,GAAG;AACrBT,IAAAA,OADqB;AAErBQ,IAAAA,IAFqB;AAGrBD,IAAAA;AAHqB,GAAtB;AAMA,SACC,cAAC,MAAD,CAAQ,GAAR;AACC,IAAA,GAAG,EAAGR,gBADP;AAEC,IAAA,SAAS,EAAGX;AAFb,KAGMP,UAHN,EAIM4B,aAJN,GAMG/B,QANH,CADD;AAUA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMgC,wBAAwB,GAAG5C,cAAc,CAC9CS,eAD8C,EAE9C,iBAF8C,CAA/C;AAKA,eAAemC,wBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport { motion, MotionProps } from 'framer-motion';\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { useContext, useEffect, useMemo, useRef } from '@wordpress/element';\nimport {\n\tuseReducedMotion,\n\tuseMergeRefs,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\nimport { escapeAttribute } from '@wordpress/escape-html';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport { View } from '../../view';\nimport { NavigatorContext } from '../context';\nimport type { NavigatorScreenProps } from '../types';\n\nconst animationEnterDelay = 0;\nconst animationEnterDuration = 0.14;\nconst animationExitDuration = 0.14;\nconst animationExitDelay = 0;\n\n// Props specific to `framer-motion` can't be currently passed to `NavigatorScreen`,\n// as some of them would overlap with HTML props (e.g. `onAnimationStart`, ...)\ntype Props = Omit<\n\tWordPressComponentProps< NavigatorScreenProps, 'div', false >,\n\tkeyof MotionProps\n>;\n\nfunction NavigatorScreen( props: Props, forwardedRef: ForwardedRef< any > ) {\n\tconst { children, className, path, ...otherProps } = useContextSystem(\n\t\tprops,\n\t\t'NavigatorScreen'\n\t);\n\n\tconst prefersReducedMotion = useReducedMotion();\n\tconst { location } = useContext( NavigatorContext );\n\tconst isMatch = location.path === escapeAttribute( path );\n\tconst wrapperRef = useRef< HTMLDivElement >( null );\n\n\tconst previousLocation = usePrevious( location );\n\n\tconst cx = useCx();\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tcss( {\n\t\t\t\t\t// Ensures horizontal overflow is visually accessible\n\t\t\t\t\toverflowX: 'auto',\n\t\t\t\t\t// In case the root has a height, it should not be exceeded\n\t\t\t\t\tmaxHeight: '100%',\n\t\t\t\t} ),\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx ]\n\t);\n\n\t// Focus restoration\n\tconst isInitialLocation = location.isInitial && ! location.isBack;\n\tuseEffect( () => {\n\t\t// Only attempt to restore focus:\n\t\t// - if the current location is not the initial one (to avoid moving focus on page load)\n\t\t// - when the screen becomes visible\n\t\t// - if the wrapper ref has been assigned\n\t\tif ( isInitialLocation || ! isMatch || ! wrapperRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet elementToFocus: HTMLElement | null = null;\n\n\t\t// When navigating back, if a selector is provided, use it to look for the\n\t\t// target element (assumed to be a node inside the current NavigatorScreen)\n\t\tif ( location.isBack && previousLocation?.focusTargetSelector ) {\n\t\t\telementToFocus = wrapperRef.current.querySelector(\n\t\t\t\tpreviousLocation.focusTargetSelector\n\t\t\t);\n\t\t}\n\n\t\t// If the previous query didn't run or find any element to focus, fallback\n\t\t// to the first tabbable element in the screen (or the screen itself).\n\t\tif ( ! elementToFocus ) {\n\t\t\tconst firstTabbable = ( focus.tabbable.find(\n\t\t\t\twrapperRef.current\n\t\t\t) as HTMLElement[] )[ 0 ];\n\n\t\t\telementToFocus = firstTabbable ?? wrapperRef.current;\n\t\t}\n\n\t\telementToFocus.focus();\n\t}, [ isInitialLocation, isMatch ] );\n\n\tconst mergedWrapperRef = useMergeRefs( [ forwardedRef, wrapperRef ] );\n\n\tif ( ! isMatch ) {\n\t\treturn null;\n\t}\n\n\tif ( prefersReducedMotion ) {\n\t\treturn (\n\t\t\t<View\n\t\t\t\tref={ mergedWrapperRef }\n\t\t\t\tclassName={ classes }\n\t\t\t\t{ ...otherProps }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tconst animate = {\n\t\topacity: 1,\n\t\ttransition: {\n\t\t\tdelay: animationEnterDelay,\n\t\t\tduration: animationEnterDuration,\n\t\t\tease: 'easeInOut',\n\t\t},\n\t\tx: 0,\n\t};\n\tconst initial = {\n\t\topacity: 0,\n\t\tx:\n\t\t\t( isRTL() && location.isBack ) || ( ! isRTL() && ! location.isBack )\n\t\t\t\t? 50\n\t\t\t\t: -50,\n\t};\n\tconst exit = {\n\t\tdelay: animationExitDelay,\n\t\topacity: 0,\n\t\tx:\n\t\t\t( ! isRTL() && location.isBack ) || ( isRTL() && ! location.isBack )\n\t\t\t\t? 50\n\t\t\t\t: -50,\n\t\ttransition: {\n\t\t\tduration: animationExitDuration,\n\t\t\tease: 'easeInOut',\n\t\t},\n\t};\n\n\tconst animatedProps = {\n\t\tanimate,\n\t\texit,\n\t\tinitial,\n\t};\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={ mergedWrapperRef }\n\t\t\tclassName={ classes }\n\t\t\t{ ...otherProps }\n\t\t\t{ ...animatedProps }\n\t\t>\n\t\t\t{ children }\n\t\t</motion.div>\n\t);\n}\n\n/**\n * The `NavigatorScreen` component represents a single view/screen/panel and\n * should be used in combination with the `NavigatorProvider`, the\n * `NavigatorButton` and the `NavigatorBackButton` components (or the `useNavigator`\n * hook).\n *\n * @example\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nconst ConnectedNavigatorScreen = contextConnect(\n\tNavigatorScreen,\n\t'NavigatorScreen'\n);\n\nexport default ConnectedNavigatorScreen;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/resizable-box/index.tsx"],"names":["forwardRef","classnames","Resizable","ResizeTooltip","HANDLE_CLASS_NAME","SIDE_HANDLE_CLASS_NAME","CORNER_HANDLE_CLASS_NAME","HANDLE_CLASSES","top","right","bottom","left","topLeft","topRight","bottomRight","bottomLeft","HANDLE_STYLES_OVERRIDES","width","undefined","height","HANDLE_STYLES","ResizableBox","ref","className","children","showHandle","__experimentalShowTooltip","showTooltip","__experimentalTooltipProps","tooltipProps","props"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,SAAT,QAA0B,cAA1B;;AAIA;AACA;AACA;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AAEA,MAAMC,iBAAiB,GAAG,kCAA1B;AACA,MAAMC,sBAAsB,GAAG,uCAA/B;AACA,MAAMC,wBAAwB,GAAG,yCAAjC;AAEA,MAAMC,cAAc,GAAG;AACtBC,EAAAA,GAAG,EAAEP,UAAU,CACdG,iBADc,EAEdC,sBAFc,EAGd,sCAHc,CADO;AAMtBI,EAAAA,KAAK,EAAER,UAAU,CAChB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K,YAAT,OASCC,GATD,EAUe;AAAA,MATd;AACCC,IAAAA,SADD;AAECC,IAAAA,QAFD;AAGCC,IAAAA,UAAU,GAAG,IAHd;AAICC,IAAAA,yBAAyB,EAAEC,WAAW,GAAG,KAJ1C;AAKCC,IAAAA,0BAA0B,EAAEC,YAAY,GAAG,EAL5C;AAMC,OAAGC;AANJ,GASc;AACd,SACC,cAAC,SAAD;AACC,IAAA,SAAS,EAAG7B,UAAU,CACrB,qCADqB,EAErBwB,UAAU,IAAI,iBAFO,EAGrBF,SAHqB,CADvB;AAMC,IAAA,aAAa,EAAGhB,cANjB;AAOC,IAAA,YAAY,EAAGa,aAPhB;AAQC,IAAA,GAAG,EAAGE;AARP,KASMQ,KATN,GAWGN,QAXH,EAYGG,WAAW,IAAI,cAAC,aAAD,EAAoBE,YAApB,CAZlB,CADD;AAgBA;;AAED,eAAe7B,UAAU,CAAEqB,YAAF,CAAzB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { Resizable } from 're-resizable';\nimport type { ResizableProps } from 're-resizable';\nimport type { ReactNode, Ref } from 'react';\n\n/**\n * Internal dependencies\n */\nimport ResizeTooltip from './resize-tooltip';\n\nconst HANDLE_CLASS_NAME = 'components-resizable-box__handle';\nconst SIDE_HANDLE_CLASS_NAME = 'components-resizable-box__side-handle';\nconst CORNER_HANDLE_CLASS_NAME = 'components-resizable-box__corner-handle';\n\nconst HANDLE_CLASSES = {\n\ttop: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top'\n\t),\n\tright: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottom: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom'\n\t),\n\tleft: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-left'\n\t),\n\ttopLeft: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top',\n\t\t'components-resizable-box__handle-left'\n\t),\n\ttopRight: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top',\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottomRight: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom',\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottomLeft: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom',\n\t\t'components-resizable-box__handle-left'\n\t),\n};\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDES = {\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\nconst HANDLE_STYLES = {\n\ttop: HANDLE_STYLES_OVERRIDES,\n\tright: HANDLE_STYLES_OVERRIDES,\n\tbottom: HANDLE_STYLES_OVERRIDES,\n\tleft: HANDLE_STYLES_OVERRIDES,\n\ttopLeft: HANDLE_STYLES_OVERRIDES,\n\ttopRight: HANDLE_STYLES_OVERRIDES,\n\tbottomRight: HANDLE_STYLES_OVERRIDES,\n\tbottomLeft: HANDLE_STYLES_OVERRIDES,\n};\n\ntype ResizableBoxProps = ResizableProps & {\n\tclassName: string;\n\tchildren: ReactNode;\n\tshowHandle: boolean;\n\t__experimentalShowTooltip: boolean;\n\t__experimentalTooltipProps: Parameters< typeof ResizeTooltip >[ 0 ];\n};\n\nfunction ResizableBox(\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\tshowHandle = true,\n\t\t__experimentalShowTooltip: showTooltip = false,\n\t\t__experimentalTooltipProps: tooltipProps = {},\n\t\t...props\n\t}: ResizableBoxProps,\n\tref: Ref< Resizable >\n): JSX.Element {\n\treturn (\n\t\t<Resizable\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-resizable-box__container',\n\t\t\t\tshowHandle && 'has-show-handle',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\thandleClasses={ HANDLE_CLASSES }\n\t\t\thandleStyles={ HANDLE_STYLES }\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t\t{ showTooltip && <ResizeTooltip { ...tooltipProps } /> }\n\t\t</Resizable>\n\t);\n}\n\nexport default forwardRef( ResizableBox );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/resizable-box/index.tsx"],"names":["forwardRef","classnames","Resizable","ResizeTooltip","HANDLE_CLASS_NAME","SIDE_HANDLE_CLASS_NAME","CORNER_HANDLE_CLASS_NAME","HANDLE_CLASSES","top","right","bottom","left","topLeft","topRight","bottomRight","bottomLeft","HANDLE_STYLES_OVERRIDES","width","undefined","height","HANDLE_STYLES","ResizableBox","ref","className","children","showHandle","__experimentalShowTooltip","showTooltip","__experimentalTooltipProps","tooltipProps","props"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,SAAT,QAA0B,cAA1B;;AAIA;AACA;AACA;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AAEA,MAAMC,iBAAiB,GAAG,kCAA1B;AACA,MAAMC,sBAAsB,GAAG,uCAA/B;AACA,MAAMC,wBAAwB,GAAG,yCAAjC;AAEA,MAAMC,cAAc,GAAG;AACtBC,EAAAA,GAAG,EAAEP,UAAU,CACdG,iBADc,EAEdC,sBAFc,EAGd,sCAHc,CADO;AAMtBI,EAAA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;AARS,CAAtB;;AAmBA,SAASK,YAAT,OASCC,GATD,EAUe;AAAA,MATd;AACCC,IAAAA,SADD;AAECC,IAAAA,QAFD;AAGCC,IAAAA,UAAU,GAAG,IAHd;AAICC,IAAAA,yBAAyB,EAAEC,WAAW,GAAG,KAJ1C;AAKCC,IAAAA,0BAA0B,EAAEC,YAAY,GAAG,EAL5C;AAMC,OAAGC;AANJ,GASc;AACd,SACC,cAAC,SAAD;AACC,IAAA,SAAS,EAAG7B,UAAU,CACrB,qCADqB,EAErBwB,UAAU,IAAI,iBAFO,EAGrBF,SAHqB,CADvB;AAMC,IAAA,aAAa,EAAGhB,cANjB;AAOC,IAAA,YAAY,EAAGa,aAPhB;AAQC,IAAA,GAAG,EAAGE;AARP,KASMQ,KATN,GAWGN,QAXH,EAYGG,WAAW,IAAI,cAAC,aAAD,EAAoBE,YAApB,CAZlB,CADD;AAgBA;;AAED,eAAe7B,UAAU,CAAEqB,YAAF,CAAzB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { Resizable } from 're-resizable';\nimport type { ResizableProps } from 're-resizable';\nimport type { ReactNode, ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport ResizeTooltip from './resize-tooltip';\n\nconst HANDLE_CLASS_NAME = 'components-resizable-box__handle';\nconst SIDE_HANDLE_CLASS_NAME = 'components-resizable-box__side-handle';\nconst CORNER_HANDLE_CLASS_NAME = 'components-resizable-box__corner-handle';\n\nconst HANDLE_CLASSES = {\n\ttop: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top'\n\t),\n\tright: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottom: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom'\n\t),\n\tleft: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-left'\n\t),\n\ttopLeft: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top',\n\t\t'components-resizable-box__handle-left'\n\t),\n\ttopRight: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top',\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottomRight: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom',\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottomLeft: classnames(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom',\n\t\t'components-resizable-box__handle-left'\n\t),\n};\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDES = {\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\nconst HANDLE_STYLES = {\n\ttop: HANDLE_STYLES_OVERRIDES,\n\tright: HANDLE_STYLES_OVERRIDES,\n\tbottom: HANDLE_STYLES_OVERRIDES,\n\tleft: HANDLE_STYLES_OVERRIDES,\n\ttopLeft: HANDLE_STYLES_OVERRIDES,\n\ttopRight: HANDLE_STYLES_OVERRIDES,\n\tbottomRight: HANDLE_STYLES_OVERRIDES,\n\tbottomLeft: HANDLE_STYLES_OVERRIDES,\n};\n\ntype ResizableBoxProps = ResizableProps & {\n\tclassName: string;\n\tchildren: ReactNode;\n\tshowHandle: boolean;\n\t__experimentalShowTooltip: boolean;\n\t__experimentalTooltipProps: Parameters< typeof ResizeTooltip >[ 0 ];\n};\n\nfunction ResizableBox(\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\tshowHandle = true,\n\t\t__experimentalShowTooltip: showTooltip = false,\n\t\t__experimentalTooltipProps: tooltipProps = {},\n\t\t...props\n\t}: ResizableBoxProps,\n\tref: ForwardedRef< Resizable >\n): JSX.Element {\n\treturn (\n\t\t<Resizable\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-resizable-box__container',\n\t\t\t\tshowHandle && 'has-show-handle',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\thandleClasses={ HANDLE_CLASSES }\n\t\t\thandleStyles={ HANDLE_STYLES }\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t\t{ showTooltip && <ResizeTooltip { ...tooltipProps } /> }\n\t\t</Resizable>\n\t);\n}\n\nexport default forwardRef( ResizableBox );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/resizable-box/resize-tooltip/index.tsx"],"names":["noop","classnames","forwardRef","Label","useResizeLabel","POSITIONS","Root","ResizeTooltip","ref","axis","className","fadeTimeout","isVisible","labelRef","onResize","position","bottom","showPx","zIndex","props","label","resizeListener","classes","ForwardedComponent"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AACA,OAAOC,UAAP,MAAuB,YAAvB;;AAGA;AACA;AACA;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,KAAP,MAAkB,SAAlB;AACA,SAASC,cAAT,EAAyCC,SAAzC,QAA0D,SAA1D;AACA,SAASC,IAAT,QAAqB,gCAArB;;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,GAAGd,IANZ;AAOCe,IAAAA,QAAQ,GAAGV,SAAS,CAACW,MAPtB;AAQCC,IAAAA,MAAM,GAAG,IARV;AASCC,IAAAA,MAAM,GAAG,IATV;AAUC,OAAGC;AAVJ,GAaqB;AACrB,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAA4BjB,cAAc,CAAE;AACjDK,IAAAA,IADiD;AAEjDE,IAAAA,WAFiD;AAGjDG,IAAAA,QAHiD;AAIjDG,IAAAA,MAJiD;AAKjDF,IAAAA;AALiD,GAAF,CAAhD;AAQA,MAAK,CAAEH,SAAP,EAAmB,OAAO,IAAP;AAEnB,QAAMU,OAAO,GAAGrB,UAAU,CAAE,2BAAF,EAA+BS,SAA/B,CAA1B;AAEA,SACC,cAAC,IAAD;AAAM,mBAAY,MAAlB;AAAyB,IAAA,SAAS,EAAGY,OAArC;AAA+C,IAAA,GAAG,EAAGd;AAArD,KAAgEW,KAAhE,GACGE,cADH,EAEC,cAAC,KAAD;AACC,mBAAcF,KAAK,CAAE,aAAF,CADpB;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,QAAQ,EAAGL,QAHZ;AAIC,IAAA,GAAG,EAAGF,QAJP;AAKC,IAAA,MAAM,EAAGK;AALV,IAFD,CADD;AAYA;;AAED,MAAMK,kBAAkB,GAAGrB,UAAU,CAAEK,aAAF,CAArC;AAEA,eAAegB,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { noop } from 'lodash';\nimport classnames from 'classnames';\nimport type { Ref } 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: Ref< 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","classnames","forwardRef","Label","useResizeLabel","POSITIONS","Root","ResizeTooltip","ref","axis","className","fadeTimeout","isVisible","labelRef","onResize","position","bottom","showPx","zIndex","props","label","resizeListener","classes","ForwardedComponent"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AACA,OAAOC,UAAP,MAAuB,YAAvB;;AAGA;AACA;AACA;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,KAAP,MAAkB,SAAlB;AACA,SAASC,cAAT,EAAyCC,SAAzC,QAA0D,SAA1D;AACA,SAASC,IAAT,QAAqB,gCAArB;;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,GAAGd,IANZ;AAOCe,IAAAA,QAAQ,GAAGV,SAAS,CAACW,MAPtB;AAQCC,IAAAA,MAAM,GAAG,IARV;AASCC,IAAAA,MAAM,GAAG,IATV;AAUC,OAAGC;AAVJ,GAaqB;AACrB,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAA4BjB,cAAc,CAAE;AACjDK,IAAAA,IADiD;AAEjDE,IAAAA,WAFiD;AAGjDG,IAAAA,QAHiD;AAIjDG,IAAAA,MAJiD;AAKjDF,IAAAA;AALiD,GAAF,CAAhD;AAQA,MAAK,CAAEH,SAAP,EAAmB,OAAO,IAAP;AAEnB,QAAMU,OAAO,GAAGrB,UAAU,CAAE,2BAAF,EAA+BS,SAA/B,CAA1B;AAEA,SACC,cAAC,IAAD;AAAM,mBAAY,MAAlB;AAAyB,IAAA,SAAS,EAAGY,OAArC;AAA+C,IAAA,GAAG,EAAGd;AAArD,KAAgEW,KAAhE,GACGE,cADH,EAEC,cAAC,KAAD;AACC,mBAAcF,KAAK,CAAE,aAAF,CADpB;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,QAAQ,EAAGL,QAHZ;AAIC,IAAA,GAAG,EAAGF,QAJP;AAKC,IAAA,MAAM,EAAGK;AALV,IAFD,CADD;AAYA;;AAED,MAAMK,kBAAkB,GAAGrB,UAAU,CAAEK,aAAF,CAArC;AAEA,eAAegB,kBAAf","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 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/resizable-box/resize-tooltip/label.tsx"],"names":["forwardRef","isRTL","POSITIONS","TooltipWrapper","Tooltip","LabelText","CORNER_OFFSET","CURSOR_OFFSET_TOP","Label","ref","label","position","corner","zIndex","props","showLabel","isBottom","bottom","isCorner","style","opacity","undefined","labelStyle","left","transform","top","right","ForwardedComponent"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,SAAmBC,SAAnB,QAAoC,SAApC;AACA,SACCC,cADD,EAECC,OAFD,EAGCC,SAHD,QAIO,gCAJP;AAMA,MAAMC,aAAa,GAAG,CAAtB;AACA,MAAMC,iBAAiB,GAAGD,aAAa,GAAG,GAA1C;;AAWA,SAASE,KAAT,OAECC,GAFD,EAGsB;AAAA,MAFrB;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAQ,GAAGT,SAAS,CAACU,MAA9B;AAAsCC,IAAAA,MAAM,GAAG,IAA/C;AAAqD,OAAGC;AAAxD,GAEqB;AACrB,QAAMC,SAAS,GAAG,CAAC,CAAEL,KAArB;AAEA,QAAMM,QAAQ,GAAGL,QAAQ,KAAKT,SAAS,CAACe,MAAxC;AACA,QAAMC,QAAQ,GAAGP,QAAQ,KAAKT,SAAS,CAACU,MAAxC;AAEA,MAAK,CAAEG,SAAP,EAAmB,OAAO,IAAP;AAEnB,MAAII,KAA0B,GAAG;AAChCC,IAAAA,OAAO,EAAEL,SAAS,GAAG,CAAH,GAAOM,SADO;AAEhCR,IAAAA;AAFgC,GAAjC;AAKA,MAAIS,UAAU,GAAG,EAAjB;;AAEA,MAAKN,QAAL,EAAgB;AACfG,IAAAA,KAAK,GAAG,EACP,GAAGA,KADI;AAEPR,MAAAA,QAAQ,EAAE,UAFH;AAGPM,MAAAA,MAAM,EAAEV,iBAAiB,GAAG,CAAC,CAHtB;AAIPgB,MAAAA,IAAI,EAAE,KAJC;AAKPC,MAAAA,SAAS,EAAE;AALJ,KAAR;AAQAF,IAAAA,UAAU,GAAG;AACZE,MAAAA,SAAS,EAAG;AADA,KAAb;AAGA;;AAED,MAAKN,QAAL,EAAgB;AACfC,IAAAA,KAAK,GAAG,EACP,GAAGA,KADI;AAEPR,MAAAA,QAAQ,EAAE,UAFH;AAGPc,MAAAA,GAAG,EAAEnB,aAHE;AAIPoB,MAAAA,KAAK,EAAEzB,KAAK,KAAKoB,SAAL,GAAiBf,aAJtB;AAKPiB,MAAAA,IAAI,EAAEtB,KAAK,KAAKK,aAAL,GAAqBe;AALzB,KAAR;AAOA;;AAED,SACC,cAAC,cAAD;AACC,mBAAY,MADb;AAEC,IAAA,SAAS,EAAC,+CAFX;AAGC,IAAA,GAAG,EAAGZ,GAHP;AAIC,IAAA,KAAK,EAAGU;AAJT,KAKML,KALN,GAOC,cAAC,OAAD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,KAAK,EAAGQ;AAFT,KAIC,cAAC,SAAD;AAAW,IAAA,EAAE,EAAC;AAAd,KAAuBZ,KAAvB,CAJD,CAPD,CADD;AAgBA;;AAED,MAAMiB,kBAAkB,GAAG3B,UAAU,CAAEQ,KAAF,CAArC;AAEA,eAAemB,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { Position, POSITIONS } from './utils';\nimport {\n\tTooltipWrapper,\n\tTooltip,\n\tLabelText,\n} from './styles/resize-tooltip.styles';\n\nconst CORNER_OFFSET = 4;\nconst CURSOR_OFFSET_TOP = CORNER_OFFSET * 2.5;\n\ntype LabelProps = React.DetailedHTMLProps<\n\tReact.HTMLAttributes< HTMLDivElement >,\n\tHTMLDivElement\n> & {\n\tlabel?: string;\n\tposition: Position;\n\tzIndex: number;\n};\n\nfunction Label(\n\t{ label, position = POSITIONS.corner, zIndex = 1000, ...props }: LabelProps,\n\tref: Ref< HTMLDivElement >\n): JSX.Element | null {\n\tconst showLabel = !! label;\n\n\tconst isBottom = position === POSITIONS.bottom;\n\tconst isCorner = position === POSITIONS.corner;\n\n\tif ( ! showLabel ) return null;\n\n\tlet style: React.CSSProperties = {\n\t\topacity: showLabel ? 1 : undefined,\n\t\tzIndex,\n\t};\n\n\tlet labelStyle = {};\n\n\tif ( isBottom ) {\n\t\tstyle = {\n\t\t\t...style,\n\t\t\tposition: 'absolute',\n\t\t\tbottom: CURSOR_OFFSET_TOP * -1,\n\t\t\tleft: '50%',\n\t\t\ttransform: 'translate(-50%, 0)',\n\t\t};\n\n\t\tlabelStyle = {\n\t\t\ttransform: `translate(0, 100%)`,\n\t\t};\n\t}\n\n\tif ( isCorner ) {\n\t\tstyle = {\n\t\t\t...style,\n\t\t\tposition: 'absolute',\n\t\t\ttop: CORNER_OFFSET,\n\t\t\tright: isRTL() ? undefined : CORNER_OFFSET,\n\t\t\tleft: isRTL() ? CORNER_OFFSET : undefined,\n\t\t};\n\t}\n\n\treturn (\n\t\t<TooltipWrapper\n\t\t\taria-hidden=\"true\"\n\t\t\tclassName=\"components-resizable-tooltip__tooltip-wrapper\"\n\t\t\tref={ ref }\n\t\t\tstyle={ style }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<Tooltip\n\t\t\t\tclassName=\"components-resizable-tooltip__tooltip\"\n\t\t\t\tstyle={ labelStyle }\n\t\t\t>\n\t\t\t\t<LabelText as=\"span\">{ label }</LabelText>\n\t\t\t</Tooltip>\n\t\t</TooltipWrapper>\n\t);\n}\n\nconst ForwardedComponent = forwardRef( Label );\n\nexport default ForwardedComponent;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/resizable-box/resize-tooltip/label.tsx"],"names":["forwardRef","isRTL","POSITIONS","TooltipWrapper","Tooltip","LabelText","CORNER_OFFSET","CURSOR_OFFSET_TOP","Label","ref","label","position","corner","zIndex","props","showLabel","isBottom","bottom","isCorner","style","opacity","undefined","labelStyle","left","transform","top","right","ForwardedComponent"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oB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AK,KAAKoB,SAAL,GAAiBf,aAJtB;AAKPiB,MAAAA,IAAI,EAAEtB,KAAK,KAAKK,aAAL,GAAqBe;AALzB,KAAR;AAOA;;AAED,SACC,cAAC,cAAD;AACC,mBAAY,MADb;AAEC,IAAA,SAAS,EAAC,+CAFX;AAGC,IAAA,GAAG,EAAGZ,GAHP;AAIC,IAAA,KAAK,EAAGU;AAJT,KAKML,KALN,GAOC,cAAC,OAAD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,KAAK,EAAGQ;AAFT,KAIC,cAAC,SAAD;AAAW,IAAA,EAAE,EAAC;AAAd,KAAuBZ,KAAvB,CAJD,CAPD,CADD;AAgBA;;AAED,MAAMiB,kBAAkB,GAAG3B,UAAU,CAAEQ,KAAF,CAArC;AAEA,eAAemB,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { Position, POSITIONS } from './utils';\nimport {\n\tTooltipWrapper,\n\tTooltip,\n\tLabelText,\n} from './styles/resize-tooltip.styles';\n\nconst CORNER_OFFSET = 4;\nconst CURSOR_OFFSET_TOP = CORNER_OFFSET * 2.5;\n\ntype LabelProps = React.DetailedHTMLProps<\n\tReact.HTMLAttributes< HTMLDivElement >,\n\tHTMLDivElement\n> & {\n\tlabel?: string;\n\tposition: Position;\n\tzIndex: number;\n};\n\nfunction Label(\n\t{ label, position = POSITIONS.corner, zIndex = 1000, ...props }: LabelProps,\n\tref: ForwardedRef< HTMLDivElement >\n): JSX.Element | null {\n\tconst showLabel = !! label;\n\n\tconst isBottom = position === POSITIONS.bottom;\n\tconst isCorner = position === POSITIONS.corner;\n\n\tif ( ! showLabel ) return null;\n\n\tlet style: React.CSSProperties = {\n\t\topacity: showLabel ? 1 : undefined,\n\t\tzIndex,\n\t};\n\n\tlet labelStyle = {};\n\n\tif ( isBottom ) {\n\t\tstyle = {\n\t\t\t...style,\n\t\t\tposition: 'absolute',\n\t\t\tbottom: CURSOR_OFFSET_TOP * -1,\n\t\t\tleft: '50%',\n\t\t\ttransform: 'translate(-50%, 0)',\n\t\t};\n\n\t\tlabelStyle = {\n\t\t\ttransform: `translate(0, 100%)`,\n\t\t};\n\t}\n\n\tif ( isCorner ) {\n\t\tstyle = {\n\t\t\t...style,\n\t\t\tposition: 'absolute',\n\t\t\ttop: CORNER_OFFSET,\n\t\t\tright: isRTL() ? undefined : CORNER_OFFSET,\n\t\t\tleft: isRTL() ? CORNER_OFFSET : undefined,\n\t\t};\n\t}\n\n\treturn (\n\t\t<TooltipWrapper\n\t\t\taria-hidden=\"true\"\n\t\t\tclassName=\"components-resizable-tooltip__tooltip-wrapper\"\n\t\t\tref={ ref }\n\t\t\tstyle={ style }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<Tooltip\n\t\t\t\tclassName=\"components-resizable-tooltip__tooltip\"\n\t\t\t\tstyle={ labelStyle }\n\t\t\t>\n\t\t\t\t<LabelText as=\"span\">{ label }</LabelText>\n\t\t\t</Tooltip>\n\t\t</TooltipWrapper>\n\t);\n}\n\nconst ForwardedComponent = forwardRef( Label );\n\nexport default ForwardedComponent;\n"]}
@@ -9,7 +9,7 @@ import { View } from '../view';
9
9
  import { useScrollable } from './hook';
10
10
  /**
11
11
  * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
12
- * @param {import('react').Ref<any>} forwardedRef
12
+ * @param {import('react').ForwardedRef<any>} forwardedRef
13
13
  */
14
14
 
15
15
  function Scrollable(props, forwardedRef) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/scrollable/component.js"],"names":["contextConnect","View","useScrollable","Scrollable","props","forwardedRef","scrollableProps","ConnectedScrollable"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,aAAT,QAA8B,QAA9B;AAEA;AACA;AACA;AACA;;AACA,SAASC,UAAT,CAAqBC,KAArB,EAA4BC,YAA5B,EAA2C;AAC1C,QAAMC,eAAe,GAAGJ,aAAa,CAAEE,KAAF,CAArC;AAEA,SAAO,cAAC,IAAD,eAAWE,eAAX;AAA6B,IAAA,GAAG,EAAGD;AAAnC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA,MAAME,mBAAmB,GAAGP,cAAc,CAAEG,UAAF,EAAc,YAAd,CAA1C;AAEA,eAAeI,mBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport { useScrollable } from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction Scrollable( props, forwardedRef ) {\n\tconst scrollableProps = useScrollable( props );\n\n\treturn <View { ...scrollableProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Scrollable` is a layout component that content in a scrollable container.\n *\n * @example\n * ```jsx\n * import { __experimentalScrollable as Scrollable } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Scrollable style={ { maxHeight: 200 } }>\n * \t\t\t<div style={ { height: 500 } }>...</div>\n * \t\t</Scrollable>\n * \t);\n * }\n * ```\n */\n\nconst ConnectedScrollable = contextConnect( Scrollable, 'Scrollable' );\n\nexport default ConnectedScrollable;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/scrollable/component.js"],"names":["contextConnect","View","useScrollable","Scrollable","props","forwardedRef","scrollableProps","ConnectedScrollable"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,aAAT,QAA8B,QAA9B;AAEA;AACA;AACA;AACA;;AACA,SAASC,UAAT,CAAqBC,KAArB,EAA4BC,YAA5B,EAA2C;AAC1C,QAAMC,eAAe,GAAGJ,aAAa,CAAEE,KAAF,CAArC;AAEA,SAAO,cAAC,IAAD,eAAWE,eAAX;AAA6B,IAAA,GAAG,EAAGD;AAAnC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA,MAAME,mBAAmB,GAAGP,cAAc,CAAEG,UAAF,EAAc,YAAd,CAA1C;AAEA,eAAeI,mBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport { useScrollable } from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction Scrollable( props, forwardedRef ) {\n\tconst scrollableProps = useScrollable( props );\n\n\treturn <View { ...scrollableProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Scrollable` is a layout component that content in a scrollable container.\n *\n * @example\n * ```jsx\n * import { __experimentalScrollable as Scrollable } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Scrollable style={ { maxHeight: 200 } }>\n * \t\t\t<div style={ { height: 500 } }>...</div>\n * \t\t</Scrollable>\n * \t);\n * }\n * ```\n */\n\nconst ConnectedScrollable = contextConnect( Scrollable, 'Scrollable' );\n\nexport default ConnectedScrollable;\n"]}
@@ -5,7 +5,7 @@ import { createElement } from "@wordpress/element";
5
5
  * External dependencies
6
6
  */
7
7
  import { isEmpty, noop } from 'lodash';
8
- import classNames from 'classnames'; // eslint-disable-next-line no-restricted-imports
8
+ import classNames from 'classnames';
9
9
 
10
10
  /**
11
11
  * WordPress dependencies
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/select-control/index.tsx"],"names":["isEmpty","noop","classNames","useInstanceId","useState","forwardRef","Icon","chevronDown","BaseControl","InputBase","Select","DownArrowWrapper","useUniqueId","idProp","instanceId","SelectControl","id","ref","className","disabled","help","hideLabelFromVision","label","multiple","onBlur","onChange","onFocus","options","size","value","valueProp","labelPosition","children","prefix","suffix","props","isFocused","setIsFocused","helpId","undefined","handleOnBlur","event","handleOnFocus","handleOnChange","selectedOptions","Array","from","target","filter","selected","newValues","map","classes","option","index","key","ForwardedComponent"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,IAAlB,QAA8B,QAA9B;AACA,OAAOC,UAAP,MAAuB,YAAvB,C,CACA;;AAGA;AACA;AACA;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,QAAT,EAAmBC,UAAnB,QAAqC,oBAArC;AACA,SAASC,IAAT,EAAeC,WAAf,QAAkC,kBAAlC;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,SAAP,MAAsB,6BAAtB;AAEA,SAASC,MAAT,EAAiBC,gBAAjB,QAAyC,gCAAzC;;AAIA,SAASC,WAAT,CAAsBC,MAAtB,EAAwC;AACvC,QAAMC,UAAU,GAAGX,aAAa,CAAEY,aAAF,CAAhC;AACA,QAAMC,EAAE,GAAI,4BAA4BF,UAAY,EAApD;AAEA,SAAOD,MAAM,IAAIG,EAAjB;AACA;;AAyBD,SAASD,aAAT,OAqBCE,GArBD,EAsBE;AAAA,MArBD;AACCC,IAAAA,SADD;AAECC,IAAAA,QAAQ,GAAG,KAFZ;AAGCC,IAAAA,IAHD;AAICC,IAAAA,mBAJD;AAKCL,IAAAA,EAAE,EAAEH,MALL;AAMCS,IAAAA,KAND;AAOCC,IAAAA,QAAQ,GAAG,KAPZ;AAQCC,IAAAA,MAAM,GAAGvB,IARV;AASCwB,IAAAA,QAAQ,GAAGxB,IATZ;AAUCyB,IAAAA,OAAO,GAAGzB,IAVX;AAWC0B,IAAAA,OAAO,GAAG,EAXX;AAYCC,IAAAA,IAAI,GAAG,SAZR;AAaCC,IAAAA,KAAK,EAAEC,SAbR;AAcCC,IAAAA,aAAa,GAA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MAAA,KAAK,EAAGF,MAAM,CAACxB,KAFhB;AAGC,MAAA,QAAQ,EAAGwB,MAAM,CAAClC;AAHnB,OAKGkC,MAAM,CAAC/B,KALV,CADD;AASA,GAdD,CAfF,CAlBD,CADD,CADD;AAsDA;AACA;;AAED,MAAMkC,kBAAkB,GAAGnD,UAAU,CAAEU,aAAF,CAArC;AAEA,eAAeyC,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, noop } from 'lodash';\nimport classNames from 'classnames';\n// eslint-disable-next-line no-restricted-imports\nimport type { ChangeEvent, FocusEvent, ReactNode, Ref } 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 type { InputBaseProps, LabelPosition } from '../input-control/types';\nimport { Select, DownArrowWrapper } from './styles/select-control-styles';\nimport type { Size } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nfunction useUniqueId( idProp?: string ) {\n\tconst instanceId = useInstanceId( SelectControl );\n\tconst id = `inspector-select-control-${ instanceId }`;\n\n\treturn idProp || id;\n}\n\nexport interface SelectControlProps\n\textends Omit< InputBaseProps, 'children' | 'isFocused' > {\n\thelp?: string;\n\thideLabelFromVision?: boolean;\n\tmultiple?: boolean;\n\tonBlur?: ( event: FocusEvent< HTMLSelectElement > ) => void;\n\tonFocus?: ( event: FocusEvent< HTMLSelectElement > ) => void;\n\tonChange?: (\n\t\tvalue: string | string[],\n\t\textra?: { event?: ChangeEvent< HTMLSelectElement > }\n\t) => void;\n\toptions?: {\n\t\tlabel: string;\n\t\tvalue: string;\n\t\tid?: string;\n\t\tdisabled?: boolean;\n\t}[];\n\tsize?: Size;\n\tvalue?: string | string[];\n\tlabelPosition?: LabelPosition;\n\tchildren?: ReactNode;\n}\n\nfunction SelectControl(\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...props\n\t}: WordPressComponentProps< SelectControlProps, 'select', false >,\n\tref: Ref< 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 help={ help } id={ id }>\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\nconst ForwardedComponent = forwardRef( SelectControl );\n\nexport default ForwardedComponent;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/select-control/index.tsx"],"names":["isEmpty","noop","classNames","useInstanceId","useState","forwardRef","Icon","chevronDown","BaseControl","InputBase","Select","DownArrowWrapper","useUniqueId","idProp","instanceId","SelectControl","id","ref","className","disabled","help","hideLabelFromVision","label","multiple","onBlur","onChange","onFocus","options","size","value","valueProp","labelPosition","children","prefix","suffix","props","isFocused","setIsFocused","helpId","undefined","handleOnBlur","event","handleOnFocus","handleOnChange","selectedOptions","Array","from","target","filter","selected","newValues","map","classes","option","index","key","ForwardedComponent"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,IAAlB,QAA8B,QAA9B;AACA,OAAOC,UAAP,MAAuB,YAAvB;;AAGA;AACA;AACA;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,QAAT,EAAmBC,UAAnB,QAAqC,oBAArC;AACA,SAASC,IAAT,EAAeC,WAAf,QAAkC,kBAAlC;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,SAAP,MAAsB,6BAAtB;AAEA,SAASC,MAAT,EAAiBC,gBAAjB,QAAyC,gCAAzC;;AAIA,SAASC,WAAT,CAAsBC,MAAtB,EAAwC;AACvC,QAAMC,UAAU,GAAGX,aAAa,CAAEY,aAAF,CAAhC;AACA,QAAMC,EAAE,GAAI,4BAA4BF,UAAY,EAApD;AAEA,SAAOD,MAAM,IAAIG,EAAjB;AACA;;AAyBD,SAASD,aAAT,OAqBCE,GArBD,EAsBE;AAAA,MArBD;AACCC,IAAAA,SADD;AAECC,IAAAA,QAAQ,GAAG,KAFZ;AAGCC,IAAAA,IAHD;AAICC,IAAAA,mBAJD;AAKCL,IAAAA,EAAE,EAAEH,MALL;AAMCS,IAAAA,KAND;AAOCC,IAAAA,QAAQ,GAAG,KAPZ;AAQCC,IAAAA,MAAM,GAAGvB,IARV;AASCwB,IAAAA,QAAQ,GAAGxB,IATZ;AAUCyB,IAAAA,OAAO,GAAGzB,IAVX;AAWC0B,IAAAA,OAAO,GAAG,EAXX;AAYCC,IAAAA,IAAI,GAAG,SAZR;AAaCC,IAAAA,KAAK,EAAEC,SAbR;A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AAG,EAAGC,GADP;AAEC,MAAA,KAAK,EAAGF,MAAM,CAACxB,KAFhB;AAGC,MAAA,QAAQ,EAAGwB,MAAM,CAAClC;AAHnB,OAKGkC,MAAM,CAAC/B,KALV,CADD;AASA,GAdD,CAfF,CAlBD,CADD,CADD;AAsDA;AACA;;AAED,MAAMkC,kBAAkB,GAAGnD,UAAU,CAAEU,aAAF,CAArC;AAEA,eAAeyC,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, noop } from 'lodash';\nimport classNames from 'classnames';\nimport type { ChangeEvent, FocusEvent, ReactNode, 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 type { InputBaseProps, LabelPosition } from '../input-control/types';\nimport { Select, DownArrowWrapper } from './styles/select-control-styles';\nimport type { Size } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nfunction useUniqueId( idProp?: string ) {\n\tconst instanceId = useInstanceId( SelectControl );\n\tconst id = `inspector-select-control-${ instanceId }`;\n\n\treturn idProp || id;\n}\n\nexport interface SelectControlProps\n\textends Omit< InputBaseProps, 'children' | 'isFocused' > {\n\thelp?: string;\n\thideLabelFromVision?: boolean;\n\tmultiple?: boolean;\n\tonBlur?: ( event: FocusEvent< HTMLSelectElement > ) => void;\n\tonFocus?: ( event: FocusEvent< HTMLSelectElement > ) => void;\n\tonChange?: (\n\t\tvalue: string | string[],\n\t\textra?: { event?: ChangeEvent< HTMLSelectElement > }\n\t) => void;\n\toptions?: {\n\t\tlabel: string;\n\t\tvalue: string;\n\t\tid?: string;\n\t\tdisabled?: boolean;\n\t}[];\n\tsize?: Size;\n\tvalue?: string | string[];\n\tlabelPosition?: LabelPosition;\n\tchildren?: ReactNode;\n}\n\nfunction SelectControl(\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...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 help={ help } id={ id }>\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\nconst ForwardedComponent = forwardRef( SelectControl );\n\nexport default ForwardedComponent;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/spacer/component.tsx"],"names":["contextConnect","View","useSpacer","Spacer","props","forwardedRef","spacerProps","ConnectedSpacer"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,cAAT,QAAwD,eAAxD;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,SAAT,QAA0B,QAA1B;;AAGA,SAASC,MAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,WAAW,GAAGJ,SAAS,CAAEE,KAAF,CAA7B;AAEA,SAAO,cAAC,IAAD,eAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;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,MAAME,eAAe,GAAGP,cAAc,CAAEG,MAAF,EAAU,QAAV,CAAtC;AAEA,eAAeI,eAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, WordPressComponentProps } from '../ui/context';\nimport { View } from '../view';\nimport { useSpacer } from './hook';\nimport type { Props } from './types';\n\nfunction Spacer(\n\tprops: WordPressComponentProps< Props, 'div' >,\n\tforwardedRef: Ref< any >\n) {\n\tconst spacerProps = useSpacer( props );\n\n\treturn <View { ...spacerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Spacer` is a primitive layout component that providers inner (`padding`) or outer (`margin`) space in-between components. It can also be used to adaptively provide space within an `HStack` or `VStack`.\n *\n * `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props work as a multiplier to the library's grid system (base of `4px`).\n *\n * @example\n * ```jsx\n * import { Spacer } from `@wordpress/components`\n *\n * function Example() {\n * return (\n * <View>\n * <Spacer>\n * <Heading>WordPress.org</Heading>\n * </Spacer>\n * <Text>\n * Code is Poetry\n * </Text>\n * </View>\n * );\n * }\n * ```\n */\nconst ConnectedSpacer = contextConnect( Spacer, 'Spacer' );\n\nexport default ConnectedSpacer;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/spacer/component.tsx"],"names":["contextConnect","View","useSpacer","Spacer","props","forwardedRef","spacerProps","ConnectedSpacer"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,cAAT,QAAwD,eAAxD;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,SAAT,QAA0B,QAA1B;;AAGA,SAASC,MAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,WAAW,GAAGJ,SAAS,CAAEE,KAAF,CAA7B;AAEA,SAAO,cAAC,IAAD,eAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;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,MAAME,eAAe,GAAGP,cAAc,CAAEG,MAAF,EAAU,QAAV,CAAtC;AAEA,eAAeI,eAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, WordPressComponentProps } from '../ui/context';\nimport { View } from '../view';\nimport { useSpacer } from './hook';\nimport type { Props } from './types';\n\nfunction Spacer(\n\tprops: WordPressComponentProps< Props, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst spacerProps = useSpacer( props );\n\n\treturn <View { ...spacerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Spacer` is a primitive layout component that providers inner (`padding`) or outer (`margin`) space in-between components. It can also be used to adaptively provide space within an `HStack` or `VStack`.\n *\n * `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props work as a multiplier to the library's grid system (base of `4px`).\n *\n * @example\n * ```jsx\n * import { Spacer } from `@wordpress/components`\n *\n * function Example() {\n * return (\n * <View>\n * <Spacer>\n * <Heading>WordPress.org</Heading>\n * </Spacer>\n * <Text>\n * Code is Poetry\n * </Text>\n * </View>\n * );\n * }\n * ```\n */\nconst ConnectedSpacer = contextConnect( Spacer, 'Spacer' );\n\nexport default ConnectedSpacer;\n"]}
@@ -9,7 +9,7 @@ import { View } from '../view';
9
9
  import { useSurface } from './hook';
10
10
  /**
11
11
  * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
12
- * @param {import('react').Ref<any>} forwardedRef
12
+ * @param {import('react').ForwardedRef<any>} forwardedRef
13
13
  */
14
14
 
15
15
  function Surface(props, forwardedRef) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/surface/component.js"],"names":["contextConnect","View","useSurface","Surface","props","forwardedRef","surfaceProps","ConnectedSurface"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,UAAT,QAA2B,QAA3B;AAEA;AACA;AACA;AACA;;AACA,SAASC,OAAT,CAAkBC,KAAlB,EAAyBC,YAAzB,EAAwC;AACvC,QAAMC,YAAY,GAAGJ,UAAU,CAAEE,KAAF,CAA/B;AAEA,SAAO,cAAC,IAAD,eAAWE,YAAX;AAA0B,IAAA,GAAG,EAAGD;AAAhC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,gBAAgB,GAAGP,cAAc,CAAEG,OAAF,EAAW,SAAX,CAAvC;AAEA,eAAeI,gBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport { useSurface } from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction Surface( props, forwardedRef ) {\n\tconst surfaceProps = useSurface( props );\n\n\treturn <View { ...surfaceProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Surface` is a core component that renders a primary background color.\n *\n * In the example below, notice how the `Surface` renders in white (or dark gray if in dark mode).\n *\n * ```jsx\n * import {\n *\t__experimentalSurface as Surface,\n *\t__experimentalText as Text,\n * } from '@wordpress/components';\n *\n * function Example() {\n * \treturn (\n * \t\t<Surface>\n * \t\t\t<Text>Code is Poetry</Text>\n * \t\t</Surface>\n * \t);\n * }\n * ```\n */\nconst ConnectedSurface = contextConnect( Surface, 'Surface' );\n\nexport default ConnectedSurface;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/surface/component.js"],"names":["contextConnect","View","useSurface","Surface","props","forwardedRef","surfaceProps","ConnectedSurface"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,UAAT,QAA2B,QAA3B;AAEA;AACA;AACA;AACA;;AACA,SAASC,OAAT,CAAkBC,KAAlB,EAAyBC,YAAzB,EAAwC;AACvC,QAAMC,YAAY,GAAGJ,UAAU,CAAEE,KAAF,CAA/B;AAEA,SAAO,cAAC,IAAD,eAAWE,YAAX;AAA0B,IAAA,GAAG,EAAGD;AAAhC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,gBAAgB,GAAGP,cAAc,CAAEG,OAAF,EAAW,SAAX,CAAvC;AAEA,eAAeI,gBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport { useSurface } from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction Surface( props, forwardedRef ) {\n\tconst surfaceProps = useSurface( props );\n\n\treturn <View { ...surfaceProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Surface` is a core component that renders a primary background color.\n *\n * In the example below, notice how the `Surface` renders in white (or dark gray if in dark mode).\n *\n * ```jsx\n * import {\n *\t__experimentalSurface as Surface,\n *\t__experimentalText as Text,\n * } from '@wordpress/components';\n *\n * function Example() {\n * \treturn (\n * \t\t<Surface>\n * \t\t\t<Text>Code is Poetry</Text>\n * \t\t</Surface>\n * \t);\n * }\n * ```\n */\nconst ConnectedSurface = contextConnect( Surface, 'Surface' );\n\nexport default ConnectedSurface;\n"]}
@@ -9,7 +9,7 @@ import { View } from '../view';
9
9
  import useText from './hook';
10
10
  /**
11
11
  * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
12
- * @param {import('react').Ref<any>} forwardedRef
12
+ * @param {import('react').ForwardedRef<any>} forwardedRef
13
13
  */
14
14
 
15
15
  function Text(props, forwardedRef) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/text/component.js"],"names":["contextConnect","View","useText","Text","props","forwardedRef","textProps","ConnectedText"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,OAAOC,OAAP,MAAoB,QAApB;AAEA;AACA;AACA;AACA;;AACA,SAASC,IAAT,CAAeC,KAAf,EAAsBC,YAAtB,EAAqC;AACpC,QAAMC,SAAS,GAAGJ,OAAO,CAAEE,KAAF,CAAzB;AAEA,SAAO,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAAqBE,SAArB;AAAiC,IAAA,GAAG,EAAGD;AAAvC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,aAAa,GAAGP,cAAc,CAAEG,IAAF,EAAQ,MAAR,CAApC;AAEA,eAAeI,aAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport useText from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction Text( props, forwardedRef ) {\n\tconst textProps = useText( props );\n\n\treturn <View as=\"span\" { ...textProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Text` is a core component that renders text in the library, using the\n * library's typography system.\n *\n * `Text` can be used to render any text-content, like an HTML `p` or `span`.\n *\n * @example\n *\n * ```jsx\n * import { __experimentalText as Text } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn <Text>Code is Poetry</Text>;\n * }\n * ```\n */\nconst ConnectedText = contextConnect( Text, 'Text' );\n\nexport default ConnectedText;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/text/component.js"],"names":["contextConnect","View","useText","Text","props","forwardedRef","textProps","ConnectedText"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,OAAOC,OAAP,MAAoB,QAApB;AAEA;AACA;AACA;AACA;;AACA,SAASC,IAAT,CAAeC,KAAf,EAAsBC,YAAtB,EAAqC;AACpC,QAAMC,SAAS,GAAGJ,OAAO,CAAEE,KAAF,CAAzB;AAEA,SAAO,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAAqBE,SAArB;AAAiC,IAAA,GAAG,EAAGD;AAAvC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,aAAa,GAAGP,cAAc,CAAEG,IAAF,EAAQ,MAAR,CAApC;AAEA,eAAeI,aAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport useText from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction Text( props, forwardedRef ) {\n\tconst textProps = useText( props );\n\n\treturn <View as=\"span\" { ...textProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Text` is a core component that renders text in the library, using the\n * library's typography system.\n *\n * `Text` can be used to render any text-content, like an HTML `p` or `span`.\n *\n * @example\n *\n * ```jsx\n * import { __experimentalText as Text } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn <Text>Code is Poetry</Text>;\n * }\n * ```\n */\nconst ConnectedText = contextConnect( Text, 'Text' );\n\nexport default ConnectedText;\n"]}
@@ -26,8 +26,8 @@ import BaseControl from '../base-control';
26
26
 
27
27
  /**
28
28
  *
29
- * @param {Props} props Props
30
- * @param {import('react').Ref<HTMLInputElement>} [ref]
29
+ * @param {Props} props Props
30
+ * @param {import('react').ForwardedRef<HTMLInputElement>} ref
31
31
  */
32
32
 
33
33
  function TextControl(_ref, ref) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/text-control/index.js"],"names":["useInstanceId","forwardRef","BaseControl","TextControl","ref","label","hideLabelFromVision","value","help","className","onChange","type","props","instanceId","id","onChangeValue","event","target","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,oBAA9B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AACA,SAASC,WAAT,OAWCC,GAXD,EAYE;AAAA,MAXD;AACCC,IAAAA,KADD;AAECC,IAAAA,mBAFD;AAGCC,IAAAA,KAHD;AAICC,IAAAA,IAJD;AAKCC,IAAAA,SALD;AAMCC,IAAAA,QAND;AAOCC,IAAAA,IAAI,GAAG,MAPR;AAQC,OAAGC;AARJ,GAWC;AACD,QAAMC,UAAU,GAAGb,aAAa,CAAEG,WAAF,CAAhC;AACA,QAAMW,EAAE,GAAI,0BAA0BD,UAAY,EAAlD;;AACA,QAAME,aAAa,GAAG;AACrB;AACAC,EAAAA,KAFqB,KAGjBN,QAAQ,CAAEM,KAAK,CAACC,MAAN,CAAaV,KAAf,CAHb;;AAKA,SACC,cAAC,WAAD;AACC,IAAA,KAAK,EAAGF,KADT;AAEC,IAAA,mBAAmB,EAAGC,mBAFvB;AAGC,IAAA,EAAE,EAAGQ,EAHN;AAIC,IAAA,IAAI,EAAGN,IAJR;AAKC,IAAA,SAAS,EAAGC;AALb,KAOC;AACC,IAAA,SAAS,EAAC,gCADX;AAEC,IAAA,IAAI,EAAGE,IAFR;AAGC,IAAA,EAAE,EAAGG,EAHN;AAIC,IAAA,KAAK,EAAGP,KAJT;AAKC,IAAA,QAAQ,EAAGQ,aALZ;AAMC,wBAAmB,CAAC,CAAEP,IAAH,GAAUM,EAAE,GAAG,QAAf,GAA0BI,SAN9C;AAOC,IAAA,GAAG,EAAGd;AAPP,KAQMQ,KARN,EAPD,CADD;AAoBA;;AAED,eAAeX,UAAU,CAAEE,WAAF,CAAzB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\n\n/**\n * @typedef OwnProps\n * @property {string} label Label for the control.\n * @property {boolean} [hideLabelFromVision] Whether to accessibly hide the label.\n * @property {string} value Value of the input.\n * @property {string} [help] Optional help text for the control.\n * @property {string} [className] Classname passed to BaseControl wrapper\n * @property {(value: string) => void} onChange Handle changes.\n * @property {string} [type='text'] Type of the input.\n */\n\n/** @typedef {OwnProps & import('react').ComponentProps<'input'>} Props */\n\n/**\n *\n * @param {Props} props Props\n * @param {import('react').Ref<HTMLInputElement>} [ref]\n */\nfunction TextControl(\n\t{\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tclassName,\n\t\tonChange,\n\t\ttype = 'text',\n\t\t...props\n\t},\n\tref\n) {\n\tconst instanceId = useInstanceId( TextControl );\n\tconst id = `inspector-text-control-${ instanceId }`;\n\tconst onChangeValue = (\n\t\t/** @type {import('react').ChangeEvent<HTMLInputElement>} */\n\t\tevent\n\t) => onChange( event.target.value );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t>\n\t\t\t<input\n\t\t\t\tclassName=\"components-text-control__input\"\n\t\t\t\ttype={ type }\n\t\t\t\tid={ id }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\nexport default forwardRef( TextControl );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/text-control/index.js"],"names":["useInstanceId","forwardRef","BaseControl","TextControl","ref","label","hideLabelFromVision","value","help","className","onChange","type","props","instanceId","id","onChangeValue","event","target","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,oBAA9B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AACA,SAASC,WAAT,OAWCC,GAXD,EAYE;AAAA,MAXD;AACCC,IAAAA,KADD;AAECC,IAAAA,mBAFD;AAGCC,IAAAA,KAHD;AAICC,IAAAA,IAJD;AAKCC,IAAAA,SALD;AAMCC,IAAAA,QAND;AAOCC,IAAAA,IAAI,GAAG,MAPR;AAQC,OAAGC;AARJ,GAWC;AACD,QAAMC,UAAU,GAAGb,aAAa,CAAEG,WAAF,CAAhC;AACA,QAAMW,EAAE,GAAI,0BAA0BD,UAAY,EAAlD;;AACA,QAAME,aAAa,GAAG;AACrB;AACAC,EAAAA,KAFqB,KAGjBN,QAAQ,CAAEM,KAAK,CAACC,MAAN,CAAaV,KAAf,CAHb;;AAKA,SACC,cAAC,WAAD;AACC,IAAA,KAAK,EAAGF,KADT;AAEC,IAAA,mBAAmB,EAAGC,mBAFvB;AAGC,IAAA,EAAE,EAAGQ,EAHN;AAIC,IAAA,IAAI,EAAGN,IAJR;AAKC,IAAA,SAAS,EAAGC;AALb,KAOC;AACC,IAAA,SAAS,EAAC,gCADX;AAEC,IAAA,IAAI,EAAGE,IAFR;AAGC,IAAA,EAAE,EAAGG,EAHN;AAIC,IAAA,KAAK,EAAGP,KAJT;AAKC,IAAA,QAAQ,EAAGQ,aALZ;AAMC,wBAAmB,CAAC,CAAEP,IAAH,GAAUM,EAAE,GAAG,QAAf,GAA0BI,SAN9C;AAOC,IAAA,GAAG,EAAGd;AAPP,KAQMQ,KARN,EAPD,CADD;AAoBA;;AAED,eAAeX,UAAU,CAAEE,WAAF,CAAzB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\n\n/**\n * @typedef OwnProps\n * @property {string} label Label for the control.\n * @property {boolean} [hideLabelFromVision] Whether to accessibly hide the label.\n * @property {string} value Value of the input.\n * @property {string} [help] Optional help text for the control.\n * @property {string} [className] Classname passed to BaseControl wrapper\n * @property {(value: string) => void} onChange Handle changes.\n * @property {string} [type='text'] Type of the input.\n */\n\n/** @typedef {OwnProps & import('react').ComponentProps<'input'>} Props */\n\n/**\n *\n * @param {Props} props Props\n * @param {import('react').ForwardedRef<HTMLInputElement>} ref\n */\nfunction TextControl(\n\t{\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tclassName,\n\t\tonChange,\n\t\ttype = 'text',\n\t\t...props\n\t},\n\tref\n) {\n\tconst instanceId = useInstanceId( TextControl );\n\tconst id = `inspector-text-control-${ instanceId }`;\n\tconst onChangeValue = (\n\t\t/** @type {import('react').ChangeEvent<HTMLInputElement>} */\n\t\tevent\n\t) => onChange( event.target.value );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t>\n\t\t\t<input\n\t\t\t\tclassName=\"components-text-control__input\"\n\t\t\t\ttype={ type }\n\t\t\t\tid={ id }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\nexport default forwardRef( TextControl );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control/component.tsx"],"names":["RadioGroup","useRadioState","useRef","useMemo","useMergeRefs","useInstanceId","usePrevious","contextConnect","useContextSystem","useUpdateEffect","useCx","View","BaseControl","ToggleGroupControlContext","styles","noop","ToggleGroupControl","props","forwardedRef","className","isAdaptiveWidth","isBlock","label","hideLabelFromVision","help","onChange","value","children","otherProps","cx","containerRef","baseId","toString","radio","state","previousValue","setState","classes","block","ConnectedToggleGroupControl"],"mappings":";;;AAAA;AACA;AACA;AAEA;AACA,SAASA,UAAT,EAAqBC,aAArB,QAA0C,QAA1C;AAEA;AACA;AACA;;AAEA,SAASC,MAAT,EAAiBC,OAAjB,QAAgC,oBAAhC;AACA,SAASC,YAAT,EAAuBC,aAAvB,EAAsCC,WAAtC,QAAyD,oBAAzD;AAEA;AACA;AACA;;AACA,SACCC,cADD,EAECC,gBAFD,QAIO,kBAJP;AAKA,SAASC,eAAT,EAA0BC,KAA1B,QAAuC,mBAAvC;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,OAAOC,WAAP,MAAwB,oBAAxB;AAEA,OAAOC,yBAAP,MAAsC,YAAtC;AACA,OAAO,KAAKC,MAAZ,MAAwB,UAAxB;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC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AHC,EAIDnB,SAJC,CAFmB,EAQtB,CAAEA,SAAF,EAAaU,EAAb,EAAiBR,OAAjB,CARsB,CAAvB;AAUA,SACC,cAAC,WAAD;AAAa,IAAA,IAAI,EAAGG;AAApB,KACC,cAAC,yBAAD,CAA2B,QAA3B;AACC,IAAA,KAAK,EAAG,EAAE,GAAGS,KAAL;AAAYZ,MAAAA,OAAO,EAAE,CAAED;AAAvB;AADT,KAGG,CAAEG,mBAAF,IACD,2BACC,cAAC,WAAD,CAAa,WAAb,QACGD,KADH,CADD,CAJF,EAUC,cAAC,UAAD,eACMW,KADN;AAEC,kBAAaX,KAFd;AAGC,IAAA,EAAE,EAAGX,IAHN;AAIC,IAAA,SAAS,EAAG0B;AAJb,KAKMT,UALN;AAMC,IAAA,GAAG,EAAGxB,YAAY,CAAE,CAAE0B,YAAF,EAAgBZ,YAAhB,CAAF;AANnB,MAQGS,QARH,CAVD,CADD,CADD;AAyBA;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;AACA;;;AACA,MAAMY,2BAA2B,GAAGhC,cAAc,CACjDS,kBADiD,EAEjD,oBAFiD,CAAlD;AAKA,eAAeuB,2BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport { RadioGroup, useRadioState } from 'reakit';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useMemo } from '@wordpress/element';\nimport { useMergeRefs, useInstanceId, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../../ui/context';\nimport { useUpdateEffect, useCx } from '../../utils/hooks';\nimport { View } from '../../view';\nimport BaseControl from '../../base-control';\nimport type { ToggleGroupControlProps } from '../types';\nimport ToggleGroupControlContext from '../context';\nimport * as styles from './styles';\n\nconst noop = () => {};\n\nfunction ToggleGroupControl(\n\tprops: WordPressComponentProps< ToggleGroupControlProps, 'input' >,\n\tforwardedRef: Ref< any >\n) {\n\tconst {\n\t\tclassName,\n\t\tisAdaptiveWidth = false,\n\t\tisBlock = false,\n\t\tlabel,\n\t\thideLabelFromVision = false,\n\t\thelp,\n\t\tonChange = noop,\n\t\tvalue,\n\t\tchildren,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToggleGroupControl' );\n\tconst cx = useCx();\n\tconst containerRef = useRef();\n\tconst baseId = useInstanceId(\n\t\tToggleGroupControl,\n\t\t'toggle-group-control'\n\t).toString();\n\tconst radio = useRadioState( {\n\t\tbaseId,\n\t\tstate: value,\n\t} );\n\tconst previousValue = usePrevious( value );\n\n\t// Propagate radio.state change\n\tuseUpdateEffect( () => {\n\t\t// Avoid calling onChange if radio state changed\n\t\t// from incoming value.\n\t\tif ( previousValue !== radio.state ) {\n\t\t\tonChange( radio.state );\n\t\t}\n\t}, [ radio.state ] );\n\n\t// Sync incoming value with radio.state\n\tuseUpdateEffect( () => {\n\t\tif ( value !== radio.state ) {\n\t\t\tradio.setState( value );\n\t\t}\n\t}, [ value ] );\n\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.ToggleGroupControl,\n\t\t\t\tisBlock && styles.block,\n\t\t\t\t'medium',\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx, isBlock ]\n\t);\n\treturn (\n\t\t<BaseControl help={ help }>\n\t\t\t<ToggleGroupControlContext.Provider\n\t\t\t\tvalue={ { ...radio, isBlock: ! isAdaptiveWidth } }\n\t\t\t>\n\t\t\t\t{ ! hideLabelFromVision && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<RadioGroup\n\t\t\t\t\t{ ...radio }\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tas={ View }\n\t\t\t\t\tclassName={ classes }\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\tref={ useMergeRefs( [ containerRef, forwardedRef ] ) }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</RadioGroup>\n\t\t\t</ToggleGroupControlContext.Provider>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * `ToggleGroupControl` is a form component that lets users choose options\n * represented in horizontal segments. To render options for this control use\n * `ToggleGroupControlOption` component.\n *\n * Only use this control when you know for sure the labels of items inside won't\n * wrap. For items with longer labels, you can consider a `SelectControl` or a\n * `CustomSelectControl` component instead.\n *\n * @example\n * ```jsx\n * import {\n * __experimentalToggleGroupControl as ToggleGroupControl,\n * __experimentalToggleGroupControlOption as ToggleGroupControlOption,\n * } from '@wordpress/components';\n *\n * function Example() {\n * return (\n * <ToggleGroupControl label=\"my label\" value=\"vertical\" isBlock>\n * <ToggleGroupControlOption value=\"horizontal\" label=\"Horizontal\" />\n * <ToggleGroupControlOption value=\"vertical\" label=\"Vertical\" />\n * </ToggleGroupControl>\n * );\n * }\n * ```\n */\nconst ConnectedToggleGroupControl = contextConnect(\n\tToggleGroupControl,\n\t'ToggleGroupControl'\n);\n\nexport default ConnectedToggleGroupControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control/component.tsx"],"names":["RadioGroup","useRadioState","useRef","useMemo","useMergeRefs","useInstanceId","usePrevious","contextConnect","useContextSystem","useUpdateEffect","useCx","View","BaseControl","ToggleGroupControlContext","styles","noop","ToggleGroupControl","props","forwardedRef","className","isAdaptiveWidth","isBlock","label","hideLabelFromVision","help","onChange","value","children","otherProps","cx","containerRef","baseId","toString","radio","state","previousValue","setState","classes","block","ConnectedToggleGroupControl"],"mappings":";;;AAAA;AACA;AACA;AAEA;AACA,SAASA,UAAT,EAAqBC,aAArB,QAA0C,QAA1C;AAEA;AAC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esContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport { RadioGroup, useRadioState } from 'reakit';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useMemo } from '@wordpress/element';\nimport { useMergeRefs, useInstanceId, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../../ui/context';\nimport { useUpdateEffect, useCx } from '../../utils/hooks';\nimport { View } from '../../view';\nimport BaseControl from '../../base-control';\nimport type { ToggleGroupControlProps } from '../types';\nimport ToggleGroupControlContext from '../context';\nimport * as styles from './styles';\n\nconst noop = () => {};\n\nfunction ToggleGroupControl(\n\tprops: WordPressComponentProps< ToggleGroupControlProps, 'input' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tclassName,\n\t\tisAdaptiveWidth = false,\n\t\tisBlock = false,\n\t\tlabel,\n\t\thideLabelFromVision = false,\n\t\thelp,\n\t\tonChange = noop,\n\t\tvalue,\n\t\tchildren,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToggleGroupControl' );\n\tconst cx = useCx();\n\tconst containerRef = useRef();\n\tconst baseId = useInstanceId(\n\t\tToggleGroupControl,\n\t\t'toggle-group-control'\n\t).toString();\n\tconst radio = useRadioState( {\n\t\tbaseId,\n\t\tstate: value,\n\t} );\n\tconst previousValue = usePrevious( value );\n\n\t// Propagate radio.state change\n\tuseUpdateEffect( () => {\n\t\t// Avoid calling onChange if radio state changed\n\t\t// from incoming value.\n\t\tif ( previousValue !== radio.state ) {\n\t\t\tonChange( radio.state );\n\t\t}\n\t}, [ radio.state ] );\n\n\t// Sync incoming value with radio.state\n\tuseUpdateEffect( () => {\n\t\tif ( value !== radio.state ) {\n\t\t\tradio.setState( value );\n\t\t}\n\t}, [ value ] );\n\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.ToggleGroupControl,\n\t\t\t\tisBlock && styles.block,\n\t\t\t\t'medium',\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx, isBlock ]\n\t);\n\treturn (\n\t\t<BaseControl help={ help }>\n\t\t\t<ToggleGroupControlContext.Provider\n\t\t\t\tvalue={ { ...radio, isBlock: ! isAdaptiveWidth } }\n\t\t\t>\n\t\t\t\t{ ! hideLabelFromVision && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<RadioGroup\n\t\t\t\t\t{ ...radio }\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tas={ View }\n\t\t\t\t\tclassName={ classes }\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\tref={ useMergeRefs( [ containerRef, forwardedRef ] ) }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</RadioGroup>\n\t\t\t</ToggleGroupControlContext.Provider>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * `ToggleGroupControl` is a form component that lets users choose options\n * represented in horizontal segments. To render options for this control use\n * `ToggleGroupControlOption` component.\n *\n * Only use this control when you know for sure the labels of items inside won't\n * wrap. For items with longer labels, you can consider a `SelectControl` or a\n * `CustomSelectControl` component instead.\n *\n * @example\n * ```jsx\n * import {\n * __experimentalToggleGroupControl as ToggleGroupControl,\n * __experimentalToggleGroupControlOption as ToggleGroupControlOption,\n * } from '@wordpress/components';\n *\n * function Example() {\n * return (\n * <ToggleGroupControl label=\"my label\" value=\"vertical\" isBlock>\n * <ToggleGroupControlOption value=\"horizontal\" label=\"Horizontal\" />\n * <ToggleGroupControlOption value=\"vertical\" label=\"Vertical\" />\n * </ToggleGroupControl>\n * );\n * }\n * ```\n */\nconst ConnectedToggleGroupControl = contextConnect(\n\tToggleGroupControl,\n\t'ToggleGroupControl'\n);\n\nexport default ConnectedToggleGroupControl;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control-option/component.tsx"],"names":["Radio","useInstanceId","contextConnect","useContextSystem","useToggleGroupControlContext","styles","useCx","Tooltip","ButtonContentView","LabelPlaceholderView","LabelView","WithToolTip","showTooltip","text","children","ToggleGroupControlOption","props","forwardedRef","toggleGroupControlContext","id","baseId","buttonProps","className","isBlock","label","value","radioProps","isActive","state","cx","labelViewClasses","labelBlock","classes","buttonView","buttonActive","optionLabel","ConnectedToggleGroupControlOption"],"mappings":";;;AAAA;AACA;AACA;AAEA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,SACCC,cADD,EAECC,gBAFD,QAIO,kBAJP;AAMA,SAASC,4BAAT,QAA6C,YAA7C;AACA,OAAO,KAAKC,MAAZ,MAAwB,UAAxB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,OAAOC,OAAP,MAAoB,eAApB;AAEA,MAAM;AAAEC,EAAAA,iBAAF;AAAqBC,EAAAA,oBAArB;AAA2CC,EAAAA;AAA3C,IAAyDL,MAA/D;;AAEA,MAAMM,WAAW,GAAG,QAAyD;AAAA,MAAvD;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,IAAf;AAAqBC,IAAAA;AAArB,GAAuD;;AAC5E,MAAKF,WAAW,IAAIC,IAApB,EAA2B;AAC1B,WACC,cAAC,OAAD;AAAS,MAAA,IAAI,EAAGA,IAAhB;AAAuB,MAAA,QAAQ,EAAC;AAAhC,OACGC,QADH,CADD;AAKA;;AACD,SAAO,8BAAIA,QAAJ,CAAP;AACA,CATD;;AAWA,SAASC,wBAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,yBAAyB,GAAGd,4BAA4B,EAA9D;AACA,QAAMe,EAAE,GAAGlB,aAAa,CACvBc,wBADuB,EAEvBG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oBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMY,iCAAiC,GAAGlC,cAAc,CACvDa,wBADuD,EAEvD,0BAFuD,CAAxD;AAKA,eAAeqB,iCAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport { Radio } from 'reakit';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../../ui/context';\nimport type { ToggleGroupControlOptionProps, WithToolTipProps } from '../types';\nimport { useToggleGroupControlContext } from '../context';\nimport * as styles from './styles';\nimport { useCx } from '../../utils/hooks';\nimport Tooltip from '../../tooltip';\n\nconst { ButtonContentView, LabelPlaceholderView, LabelView } = styles;\n\nconst WithToolTip = ( { showTooltip, text, children }: WithToolTipProps ) => {\n\tif ( showTooltip && text ) {\n\t\treturn (\n\t\t\t<Tooltip text={ text } position=\"top center\">\n\t\t\t\t{ children }\n\t\t\t</Tooltip>\n\t\t);\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction ToggleGroupControlOption(\n\tprops: WordPressComponentProps< ToggleGroupControlOptionProps, 'button' >,\n\tforwardedRef: Ref< any >\n) {\n\tconst toggleGroupControlContext = useToggleGroupControlContext();\n\tconst id = useInstanceId(\n\t\tToggleGroupControlOption,\n\t\ttoggleGroupControlContext.baseId || 'toggle-group-control-option'\n\t) as string;\n\tconst buttonProps = useContextSystem(\n\t\t{ ...props, id },\n\t\t'ToggleGroupControlOption'\n\t);\n\n\tconst {\n\t\tclassName,\n\t\tisBlock = false,\n\t\tlabel,\n\t\tvalue,\n\t\tshowTooltip = false,\n\t\t...radioProps\n\t} = {\n\t\t...toggleGroupControlContext,\n\t\t...buttonProps,\n\t};\n\n\tconst isActive = radioProps.state === value;\n\tconst cx = useCx();\n\tconst labelViewClasses = cx( isBlock && styles.labelBlock );\n\tconst classes = cx(\n\t\tstyles.buttonView,\n\t\tclassName,\n\t\tisActive && styles.buttonActive\n\t);\n\tconst optionLabel = !! radioProps[ 'aria-label' ]\n\t\t? radioProps[ 'aria-label' ]\n\t\t: label;\n\n\treturn (\n\t\t<LabelView className={ labelViewClasses } data-active={ isActive }>\n\t\t\t<WithToolTip showTooltip={ showTooltip } text={ optionLabel }>\n\t\t\t\t<Radio\n\t\t\t\t\t{ ...radioProps }\n\t\t\t\t\tas=\"button\"\n\t\t\t\t\taria-label={ optionLabel }\n\t\t\t\t\tclassName={ classes }\n\t\t\t\t\tdata-value={ value }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t>\n\t\t\t\t\t<ButtonContentView>{ label }</ButtonContentView>\n\t\t\t\t\t<LabelPlaceholderView aria-hidden>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</LabelPlaceholderView>\n\t\t\t\t</Radio>\n\t\t\t</WithToolTip>\n\t\t</LabelView>\n\t);\n}\n\n/**\n * `ToggleGroupControlOption` is a form component and is meant to be used as a\n * child of `ToggleGroupControl`.\n *\n * @example\n * ```jsx\n * import {\n * __experimentalToggleGroupControl as ToggleGroupControl,\n * __experimentalToggleGroupControlOption as ToggleGroupControlOption,\n * } from '@wordpress/components';\n *\n * function Example() {\n * return (\n * <ToggleGroupControl label=\"my label\" value=\"vertical\" isBlock>\n * <ToggleGroupControlOption value=\"horizontal\" label=\"Horizontal\" />\n * <ToggleGroupControlOption value=\"vertical\" label=\"Vertical\" />\n * </ToggleGroupControl>\n * );\n * }\n * ```\n */\nconst ConnectedToggleGroupControlOption = contextConnect(\n\tToggleGroupControlOption,\n\t'ToggleGroupControlOption'\n);\n\nexport default ConnectedToggleGroupControlOption;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control-option/component.tsx"],"names":["Radio","useInstanceId","contextConnect","useContextSystem","useToggleGroupControlContext","styles","useCx","Tooltip","ButtonContentView","LabelPlaceholderView","LabelView","WithToolTip","showTooltip","text","children","ToggleGroupControlOption","props","forwardedRef","toggleGroupControlContext","id","baseId","buttonProps","className","isBlock","label","value","radioProps","isActive","state","cx","labelViewClasses","labelBlock","classes","buttonView","buttonActive","optionLabel","ConnectedToggleGroupControlOption"],"mappings":";;;AAAA;AACA;AACA;AAEA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,SACCC,cADD,EAECC,gBAFD,QAIO,kBAJP;AAMA,SAASC,4BAAT,QAA6C,YAA7C;AACA,OAAO,KAAKC,MAAZ,MAAwB,UAAxB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,OAAOC,OAAP,MAAoB,eAApB;AAEA,MAAM;AAAEC,EAAAA,iBAAF;AAAqBC,EAAAA,oBAArB;AAA2CC,EAAAA;AAA3C,IAAyDL,MAA/D;;AAEA,MAAMM,WAAW,GAAG,QAAyD;AAAA,MAAvD;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,IAAf;AAAqBC,IAAAA;AAArB,GAAuD;;AAC5E,MAAKF,WAAW,IAAIC,IAApB,EAA2B;AAC1B,WACC,cAAC,OAAD;AAAS,MAAA,IAAI,EAAGA,IAAhB;AAAuB,MAAA,QAAQ,EAAC;AAAhC,OACGC,QADH,CADD;AAKA;;AACD,SAAO,8BAAIA,QAAJ,CAAP;AACA,CATD;;AAWA,SAASC,wBAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,yBAAyB,GAAGd,4BAA4B,EAA9D;AACA,QAAMe,EAAE,GAAGlB,aAAa,CACvBc,wBADuB,EAEvBG,yBAAyB,CAACE,MAA1B,IAAoC,6BAFb,CAAxB;AAIA,QAAMC,WAAW,GAAGlB,gBAAgB,CACnC,EAAE,GAAGa,KAAL;AAAYG,IAAAA;AA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AAiC,GAAGlC,cAAc,CACvDa,wBADuD,EAEvD,0BAFuD,CAAxD;AAKA,eAAeqB,iCAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport { Radio } from 'reakit';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../../ui/context';\nimport type { ToggleGroupControlOptionProps, WithToolTipProps } from '../types';\nimport { useToggleGroupControlContext } from '../context';\nimport * as styles from './styles';\nimport { useCx } from '../../utils/hooks';\nimport Tooltip from '../../tooltip';\n\nconst { ButtonContentView, LabelPlaceholderView, LabelView } = styles;\n\nconst WithToolTip = ( { showTooltip, text, children }: WithToolTipProps ) => {\n\tif ( showTooltip && text ) {\n\t\treturn (\n\t\t\t<Tooltip text={ text } position=\"top center\">\n\t\t\t\t{ children }\n\t\t\t</Tooltip>\n\t\t);\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction ToggleGroupControlOption(\n\tprops: WordPressComponentProps< ToggleGroupControlOptionProps, 'button' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst toggleGroupControlContext = useToggleGroupControlContext();\n\tconst id = useInstanceId(\n\t\tToggleGroupControlOption,\n\t\ttoggleGroupControlContext.baseId || 'toggle-group-control-option'\n\t) as string;\n\tconst buttonProps = useContextSystem(\n\t\t{ ...props, id },\n\t\t'ToggleGroupControlOption'\n\t);\n\n\tconst {\n\t\tclassName,\n\t\tisBlock = false,\n\t\tlabel,\n\t\tvalue,\n\t\tshowTooltip = false,\n\t\t...radioProps\n\t} = {\n\t\t...toggleGroupControlContext,\n\t\t...buttonProps,\n\t};\n\n\tconst isActive = radioProps.state === value;\n\tconst cx = useCx();\n\tconst labelViewClasses = cx( isBlock && styles.labelBlock );\n\tconst classes = cx(\n\t\tstyles.buttonView,\n\t\tclassName,\n\t\tisActive && styles.buttonActive\n\t);\n\tconst optionLabel = !! radioProps[ 'aria-label' ]\n\t\t? radioProps[ 'aria-label' ]\n\t\t: label;\n\n\treturn (\n\t\t<LabelView className={ labelViewClasses } data-active={ isActive }>\n\t\t\t<WithToolTip showTooltip={ showTooltip } text={ optionLabel }>\n\t\t\t\t<Radio\n\t\t\t\t\t{ ...radioProps }\n\t\t\t\t\tas=\"button\"\n\t\t\t\t\taria-label={ optionLabel }\n\t\t\t\t\tclassName={ classes }\n\t\t\t\t\tdata-value={ value }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t>\n\t\t\t\t\t<ButtonContentView>{ label }</ButtonContentView>\n\t\t\t\t\t<LabelPlaceholderView aria-hidden>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</LabelPlaceholderView>\n\t\t\t\t</Radio>\n\t\t\t</WithToolTip>\n\t\t</LabelView>\n\t);\n}\n\n/**\n * `ToggleGroupControlOption` is a form component and is meant to be used as a\n * child of `ToggleGroupControl`.\n *\n * @example\n * ```jsx\n * import {\n * __experimentalToggleGroupControl as ToggleGroupControl,\n * __experimentalToggleGroupControlOption as ToggleGroupControlOption,\n * } from '@wordpress/components';\n *\n * function Example() {\n * return (\n * <ToggleGroupControl label=\"my label\" value=\"vertical\" isBlock>\n * <ToggleGroupControlOption value=\"horizontal\" label=\"Horizontal\" />\n * <ToggleGroupControlOption value=\"vertical\" label=\"Vertical\" />\n * </ToggleGroupControl>\n * );\n * }\n * ```\n */\nconst ConnectedToggleGroupControlOption = contextConnect(\n\tToggleGroupControlOption,\n\t'ToggleGroupControlOption'\n);\n\nexport default ConnectedToggleGroupControlOption;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel/component.tsx"],"names":["ToolsPanelHeader","ToolsPanelContext","useToolsPanel","Grid","contextConnect","ToolsPanel","props","forwardedRef","children","label","panelContext","resetAllItems","toggleItem","toolsPanelProps","ConnectedToolsPanel"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAOA,gBAAP,MAA6B,uBAA7B;AACA,SAASC,iBAAT,QAAkC,YAAlC;AACA,SAASC,aAAT,QAA8B,QAA9B;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,cAAT,QAAwD,kBAAxD;;AAGA,MAAMC,UAAU,GAAG,CAClBC,KADkB,EAElBC,YAFkB,KAGd;AACJ,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,KAFK;AAGLC,IAAAA,YAHK;AAILC,IAAAA,aAJK;AAKLC,IAAAA,UALK;AAML,OAAGC;AANE,MAOFX,aAAa,CAAEI,KAAF,CAPjB;AASA,SACC,cAAC,IAAD,eAAWO,eAAX;AAA6B,IAAA,OAAO,EAAG,CAAvC;AAA2C,IAAA,GAAG,EAAGN;AAAjD,MACC,cAAC,iBAAD,CAAmB,QAAnB;AAA4B,IAAA,KAAK,EAAGG;AAApC,KACC,cAAC,gBAAD;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,QAAQ,EAAGE,aAFZ;AAGC,IAAA,UAAU,EAAGC;AAHd,IADD,EAMGJ,QANH,CADD,CADD;AAYA,CAzBD;;AA2BA,MAAMM,mBAAmB,GAAGV,cAAc,CAAEC,UAAF,EAAc,YAAd,CAA1C;AAEA,eAAeS,mBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n\n/**\n * Internal dependencies\n */\nimport ToolsPanelHeader from '../tools-panel-header';\nimport { ToolsPanelContext } from '../context';\nimport { useToolsPanel } from './hook';\nimport { Grid } from '../../grid';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type { ToolsPanelProps } from '../types';\n\nconst ToolsPanel = (\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >,\n\tforwardedRef: Ref< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tlabel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\t...toolsPanelProps\n\t} = useToolsPanel( props );\n\n\treturn (\n\t\t<Grid { ...toolsPanelProps } columns={ 2 } ref={ forwardedRef }>\n\t\t\t<ToolsPanelContext.Provider value={ panelContext }>\n\t\t\t\t<ToolsPanelHeader\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tresetAll={ resetAllItems }\n\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</ToolsPanelContext.Provider>\n\t\t</Grid>\n\t);\n};\n\nconst ConnectedToolsPanel = contextConnect( ToolsPanel, 'ToolsPanel' );\n\nexport default ConnectedToolsPanel;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel/component.tsx"],"names":["ToolsPanelHeader","ToolsPanelContext","useToolsPanel","Grid","contextConnect","ToolsPanel","props","forwardedRef","children","label","panelContext","resetAllItems","toggleItem","toolsPanelProps","ConnectedToolsPanel"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAOA,gBAAP,MAA6B,uBAA7B;AACA,SAASC,iBAAT,QAAkC,YAAlC;AACA,SAASC,aAAT,QAA8B,QAA9B;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,cAAT,QAAwD,kBAAxD;;AAGA,MAAMC,UAAU,GAAG,CAClBC,KADkB,EAElBC,YAFkB,KAGd;AACJ,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,KAFK;AAGLC,IAAAA,YAHK;AAILC,IAAAA,aAJK;AAKLC,IAAAA,UALK;AAML,OAAGC;AANE,MAOFX,aAAa,CAAEI,KAAF,CAPjB;AASA,SACC,cAAC,IAAD,eAAWO,eAAX;AAA6B,IAAA,OAAO,EAAG,CAAvC;AAA2C,IAAA,GAAG,EAAGN;AAAjD,MACC,cAAC,iBAAD,CAAmB,QAAnB;AAA4B,IAAA,KAAK,EAAGG;AAApC,KACC,cAAC,gBAAD;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,QAAQ,EAAGE,aAFZ;AAGC,IAAA,UAAU,EAAGC;AAHd,IADD,EAMGJ,QANH,CADD,CADD;AAYA,CAzBD;;AA2BA,MAAMM,mBAAmB,GAAGV,cAAc,CAAEC,UAAF,EAAc,YAAd,CAA1C;AAEA,eAAeS,mBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport ToolsPanelHeader from '../tools-panel-header';\nimport { ToolsPanelContext } from '../context';\nimport { useToolsPanel } from './hook';\nimport { Grid } from '../../grid';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type { ToolsPanelProps } from '../types';\n\nconst ToolsPanel = (\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tlabel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\t...toolsPanelProps\n\t} = useToolsPanel( props );\n\n\treturn (\n\t\t<Grid { ...toolsPanelProps } columns={ 2 } ref={ forwardedRef }>\n\t\t\t<ToolsPanelContext.Provider value={ panelContext }>\n\t\t\t\t<ToolsPanelHeader\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tresetAll={ resetAllItems }\n\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</ToolsPanelContext.Provider>\n\t\t</Grid>\n\t);\n};\n\nconst ConnectedToolsPanel = contextConnect( ToolsPanel, 'ToolsPanel' );\n\nexport default ConnectedToolsPanel;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-header/component.tsx"],"names":["check","reset","moreVertical","plus","__","_x","sprintf","DropdownMenu","MenuGroup","MenuItem","HStack","Heading","useToolsPanelHeader","contextConnect","noop","DefaultControlsGroup","items","onClose","toggleItem","length","map","label","hasValue","icon","itemLabel","undefined","OptionalControlsGroup","isSelected","ToolsPanelHeader","props","forwardedRef","areAllOptionalControlsHidden","dropdownMenuClassName","hasMenuItems","headingClassName","labelText","menuItems","resetAll","headerProps","defaultItems","Object","entries","default","optionalItems","optional","dropDownMenuIcon","dropDownMenuLabelText","className","isSmall","ConnectedToolsPanelHeader"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,KAAhB,EAAuBC,YAAvB,EAAqCC,IAArC,QAAiD,kBAAjD;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,qBAAzB;AACA,OAAOC,SAAP,MAAsB,kBAAtB;AACA,OAAOC,QAAP,MAAqB,iBAArB;AACA,SAASC,MAAT,QAAuB,eAAvB;AACA,SAASC,OAAT,QAAwB,eAAxB;AACA,SAASC,mBAAT,QAAoC,QAApC;AACA,SAASC,cAAT,QAAwD,kBAAxD;;AAMA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,oBAAoB,GAAG,QAIQ;AAAA,MAJN;AAC9BC,IAAAA,KAD8B;AAE9BC,IAAAA,OAF8B;AAG9BC,IAAAA;AAH8B,GAIM;;AACpC,MAAK,CAAEF,KAAK,CAACG,MAAb,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,SAAD,QACGH,KAAK,CAACI,GAAN,CAAW,SAA2B;AAAA,QAAzB,CAAEC,KAAF,EAASC,QAAT,CAAyB;AACvC,UAAMC,IAAI,GAAGD,QAAQ,GAAGrB,KAAH,GAAWD,KAAhC;AACA,UAAMwB,SAAS,GAAGF,QAAQ,GACvBhB,OAAO,EACP;AACAF,IAAAA,EAAE,CAAE,UAAF,CAFK,EAGPiB,KAHO,CADgB,GAMvBI,SANH;AAQA,WACC,cAAC,QAAD;AACC,MAAA,GAAG,EAAGJ,KADP;AAEC,MAAA,IAAI,EAAGE,IAFR;AAGC,MAAA,UAAU,EAAG,IAHd;AA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UAAU,EAAGC;AAHd,MADD,EAMC,cAAC,qBAAD;AACC,MAAA,KAAK,EAAGyB,aADT;AAEC,MAAA,OAAO,EAAG1B,OAFX;AAGC,MAAA,UAAU,EAAGC;AAHd,MAND,EAWC,cAAC,SAAD,QACC,cAAC,QAAD;AACC,MAAA,OAAO,EAAG,UADX;AAEC,MAAA,OAAO,EAAG,MAAM;AACfmB,QAAAA,QAAQ;AACRpB,QAAAA,OAAO;AACP;AALF,OAOGb,EAAE,CAAE,WAAF,CAPL,CADD,CAXD,CADC;AAAA,GANH,CALF,CADD;AAyCA,CAvED;;AAyEA,MAAM6C,yBAAyB,GAAGpC,cAAc,CAC/Ce,gBAD+C,EAE/C,kBAF+C,CAAhD;AAKA,eAAeqB,yBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { check, reset, moreVertical, plus } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DropdownMenu from '../../dropdown-menu';\nimport MenuGroup from '../../menu-group';\nimport MenuItem from '../../menu-item';\nimport { HStack } from '../../h-stack';\nimport { Heading } from '../../heading';\nimport { useToolsPanelHeader } from './hook';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type {\n\tToolsPanelControlsGroupProps,\n\tToolsPanelHeaderProps,\n} from '../types';\n\nconst noop = () => {};\n\nconst DefaultControlsGroup = ( {\n\titems,\n\tonClose,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup>\n\t\t\t{ items.map( ( [ label, hasValue ] ) => {\n\t\t\t\tconst icon = hasValue ? reset : check;\n\t\t\t\tconst itemLabel = hasValue\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: undefined;\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tisSelected={ true }\n\t\t\t\t\t\tdisabled={ ! hasValue }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst OptionalControlsGroup = ( {\n\titems,\n\tonClose,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup>\n\t\t\t{ items.map( ( [ label, isSelected ] ) => {\n\t\t\t\tconst itemLabel = isSelected\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being hidden and reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Hide and reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control to display e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Show %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ isSelected && check }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst ToolsPanelHeader = (\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >,\n\tforwardedRef: Ref< any >\n) => {\n\tconst {\n\t\tareAllOptionalControlsHidden,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\tlabel: labelText,\n\t\tmenuItems,\n\t\tresetAll,\n\t\ttoggleItem,\n\t\t...headerProps\n\t} = useToolsPanelHeader( props );\n\n\tif ( ! labelText ) {\n\t\treturn null;\n\t}\n\n\tconst defaultItems = Object.entries( menuItems?.default || {} );\n\tconst optionalItems = Object.entries( menuItems?.optional || {} );\n\tconst dropDownMenuIcon = areAllOptionalControlsHidden ? plus : moreVertical;\n\tconst dropDownMenuLabelText = areAllOptionalControlsHidden\n\t\t? _x(\n\t\t\t\t'View and add options',\n\t\t\t\t'Button label to reveal tool panel options'\n\t\t )\n\t\t: _x( 'View options', 'Button label to reveal tool panel options' );\n\n\treturn (\n\t\t<HStack { ...headerProps } ref={ forwardedRef }>\n\t\t\t<Heading level={ 2 } className={ headingClassName }>\n\t\t\t\t{ labelText }\n\t\t\t</Heading>\n\t\t\t{ hasMenuItems && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ dropDownMenuIcon }\n\t\t\t\t\tlabel={ dropDownMenuLabelText }\n\t\t\t\t\tmenuProps={ { className: dropdownMenuClassName } }\n\t\t\t\t\ttoggleProps={ { isSmall: true } }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose = noop } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<DefaultControlsGroup\n\t\t\t\t\t\t\t\titems={ defaultItems }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<OptionalControlsGroup\n\t\t\t\t\t\t\t\titems={ optionalItems }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tvariant={ 'tertiary' }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tresetAll();\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset all' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</HStack>\n\t);\n};\n\nconst ConnectedToolsPanelHeader = contextConnect(\n\tToolsPanelHeader,\n\t'ToolsPanelHeader'\n);\n\nexport default ConnectedToolsPanelHeader;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-header/component.tsx"],"names":["check","reset","moreVertical","plus","__","_x","sprintf","DropdownMenu","MenuGroup","MenuItem","HStack","Heading","useToolsPanelHeader","contextConnect","noop","DefaultControlsGroup","items","onClose","toggleItem","length","map","label","hasValue","icon","itemLabel","undefined","OptionalControlsGroup","isSelected","ToolsPanelHeader","props","forwardedRef","areAllOptionalControlsHidden","dropdownMenuClassName","hasMenuItems","headingClassName","labelText","menuItems","resetAll","headerProps","defaultItems","Object","entries","default","optionalItems","optional","dropDownMenuIcon","dropDownMenuLabelText","className","isSmall","ConnectedToolsPanelHeader"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,KAAhB,EAAuBC,YAAvB,EAAqCC,IAArC,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AA,OAAO;AACP;AALF,OAOGb,EAAE,CAAE,WAAF,CAPL,CADD,CAXD,CADC;AAAA,GANH,CALF,CADD;AAyCA,CAvED;;AAyEA,MAAM6C,yBAAyB,GAAGpC,cAAc,CAC/Ce,gBAD+C,EAE/C,kBAF+C,CAAhD;AAKA,eAAeqB,yBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { check, reset, moreVertical, plus } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DropdownMenu from '../../dropdown-menu';\nimport MenuGroup from '../../menu-group';\nimport MenuItem from '../../menu-item';\nimport { HStack } from '../../h-stack';\nimport { Heading } from '../../heading';\nimport { useToolsPanelHeader } from './hook';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type {\n\tToolsPanelControlsGroupProps,\n\tToolsPanelHeaderProps,\n} from '../types';\n\nconst noop = () => {};\n\nconst DefaultControlsGroup = ( {\n\titems,\n\tonClose,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup>\n\t\t\t{ items.map( ( [ label, hasValue ] ) => {\n\t\t\t\tconst icon = hasValue ? reset : check;\n\t\t\t\tconst itemLabel = hasValue\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: undefined;\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tisSelected={ true }\n\t\t\t\t\t\tdisabled={ ! hasValue }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst OptionalControlsGroup = ( {\n\titems,\n\tonClose,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup>\n\t\t\t{ items.map( ( [ label, isSelected ] ) => {\n\t\t\t\tconst itemLabel = isSelected\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being hidden and reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Hide and reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control to display e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Show %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ isSelected && check }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst ToolsPanelHeader = (\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tareAllOptionalControlsHidden,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\tlabel: labelText,\n\t\tmenuItems,\n\t\tresetAll,\n\t\ttoggleItem,\n\t\t...headerProps\n\t} = useToolsPanelHeader( props );\n\n\tif ( ! labelText ) {\n\t\treturn null;\n\t}\n\n\tconst defaultItems = Object.entries( menuItems?.default || {} );\n\tconst optionalItems = Object.entries( menuItems?.optional || {} );\n\tconst dropDownMenuIcon = areAllOptionalControlsHidden ? plus : moreVertical;\n\tconst dropDownMenuLabelText = areAllOptionalControlsHidden\n\t\t? _x(\n\t\t\t\t'View and add options',\n\t\t\t\t'Button label to reveal tool panel options'\n\t\t )\n\t\t: _x( 'View options', 'Button label to reveal tool panel options' );\n\n\treturn (\n\t\t<HStack { ...headerProps } ref={ forwardedRef }>\n\t\t\t<Heading level={ 2 } className={ headingClassName }>\n\t\t\t\t{ labelText }\n\t\t\t</Heading>\n\t\t\t{ hasMenuItems && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ dropDownMenuIcon }\n\t\t\t\t\tlabel={ dropDownMenuLabelText }\n\t\t\t\t\tmenuProps={ { className: dropdownMenuClassName } }\n\t\t\t\t\ttoggleProps={ { isSmall: true } }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose = noop } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<DefaultControlsGroup\n\t\t\t\t\t\t\t\titems={ defaultItems }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<OptionalControlsGroup\n\t\t\t\t\t\t\t\titems={ optionalItems }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tvariant={ 'tertiary' }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tresetAll();\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset all' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</HStack>\n\t);\n};\n\nconst ConnectedToolsPanelHeader = contextConnect(\n\tToolsPanelHeader,\n\t'ToolsPanelHeader'\n);\n\nexport default ConnectedToolsPanelHeader;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/component.tsx"],"names":["useToolsPanelItem","View","contextConnect","ToolsPanelItem","props","forwardedRef","children","isShown","shouldRenderPlaceholder","toolsPanelItemProps","ConnectedToolsPanelItem"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,QAAlC;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,cAAT,QAAwD,kBAAxD;;AAGA;AACA;AACA,MAAMC,cAAc,GAAG,CACtBC,KADsB,EAEtBC,YAFsB,KAGlB;AACJ,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,OAFK;AAGLC,IAAAA,uBAHK;AAIL,OAAGC;AAJE,MAKFT,iBAAiB,CAAEI,KAAF,CALrB;;AAOA,MAAK,CAAEG,OAAP,EAAiB;AAChB,WAAOC,uBAAuB,GAC7B,cAAC,IAAD,eAAWC,mBAAX;AAAiC,MAAA,GAAG,EAAGJ;AAAvC,OAD6B,GAE1B,IAFJ;AAGA;;AAED,SACC,cAAC,IAAD,eAAWI,mBAAX;AAAiC,IAAA,GAAG,EAAGJ;AAAvC,MACGC,QADH,CADD;AAKA,CAtBD;;AAwBA,MAAMI,uBAAuB,GAAGR,cAAc,CAC7CC,cAD6C,EAE7C,gBAF6C,CAA9C;AAKA,eAAeO,uBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelItem } from './hook';\nimport { View } from '../../view';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type { ToolsPanelItemProps } from '../types';\n\n// This wraps controls to be conditionally displayed within a tools panel. It\n// prevents props being applied to HTML elements that would make them invalid.\nconst ToolsPanelItem = (\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >,\n\tforwardedRef: Ref< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\t...toolsPanelItemProps\n\t} = useToolsPanelItem( props );\n\n\tif ( ! isShown ) {\n\t\treturn shouldRenderPlaceholder ? (\n\t\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef } />\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef }>\n\t\t\t{ children }\n\t\t</View>\n\t);\n};\n\nconst ConnectedToolsPanelItem = contextConnect(\n\tToolsPanelItem,\n\t'ToolsPanelItem'\n);\n\nexport default ConnectedToolsPanelItem;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/component.tsx"],"names":["useToolsPanelItem","View","contextConnect","ToolsPanelItem","props","forwardedRef","children","isShown","shouldRenderPlaceholder","toolsPanelItemProps","ConnectedToolsPanelItem"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,QAAlC;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,cAAT,QAAwD,kBAAxD;;AAGA;AACA;AACA,MAAMC,cAAc,GAAG,CACtBC,KADsB,EAEtBC,YAFsB,KAGlB;AACJ,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,OAFK;AAGLC,IAAAA,uBAHK;AAIL,OAAGC;AAJE,MAKFT,iBAAiB,CAAEI,KAAF,CALrB;;AAOA,MAAK,CAAEG,OAAP,EAAiB;AAChB,WAAOC,uBAAuB,GAC7B,cAAC,IAAD,eAAWC,mBAAX;AAAiC,MAAA,GAAG,EAAGJ;AAAvC,OAD6B,GAE1B,IAFJ;AAGA;;AAED,SACC,cAAC,IAAD,eAAWI,mBAAX;AAAiC,IAAA,GAAG,EAAGJ;AAAvC,MACGC,QADH,CADD;AAKA,CAtBD;;AAwBA,MAAMI,uBAAuB,GAAGR,cAAc,CAC7CC,cAD6C,EAE7C,gBAF6C,CAA9C;AAKA,eAAeO,uBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelItem } from './hook';\nimport { View } from '../../view';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type { ToolsPanelItemProps } from '../types';\n\n// This wraps controls to be conditionally displayed within a tools panel. It\n// prevents props being applied to HTML elements that would make them invalid.\nconst ToolsPanelItem = (\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\t...toolsPanelItemProps\n\t} = useToolsPanelItem( props );\n\n\tif ( ! isShown ) {\n\t\treturn shouldRenderPlaceholder ? (\n\t\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef } />\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef }>\n\t\t\t{ children }\n\t\t</View>\n\t);\n};\n\nconst ConnectedToolsPanelItem = contextConnect(\n\tToolsPanelItem,\n\t'ToolsPanelItem'\n);\n\nexport default ConnectedToolsPanelItem;\n"]}
@@ -11,7 +11,7 @@ import { includes } from 'lodash';
11
11
 
12
12
  import { focus } from '@wordpress/dom';
13
13
  import { forwardRef, useCallback } from '@wordpress/element';
14
- import { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';
14
+ import { UP, DOWN, LEFT, RIGHT, HOME, END } from '@wordpress/keycodes';
15
15
  /**
16
16
  * Internal dependencies
17
17
  */
@@ -47,6 +47,7 @@ function getRowFocusables(rowElement) {
47
47
  * @param {WPElement} props.children Children to be rendered.
48
48
  * @param {Function} props.onExpandRow Callback to fire when row is expanded.
49
49
  * @param {Function} props.onCollapseRow Callback to fire when row is collapsed.
50
+ * @param {Function} props.onFocusRow Callback to fire when moving focus to a different row.
50
51
  * @param {Object} ref A ref to the underlying DOM table element.
51
52
  */
52
53
 
@@ -56,6 +57,7 @@ function TreeGrid(_ref, ref) {
56
57
  children,
57
58
  onExpandRow = () => {},
58
59
  onCollapseRow = () => {},
60
+ onFocusRow = () => {},
59
61
  ...props
60
62
  } = _ref;
61
63
  const onKeyDown = useCallback(event => {
@@ -63,12 +65,13 @@ function TreeGrid(_ref, ref) {
63
65
  keyCode,
64
66
  metaKey,
65
67
  ctrlKey,
66
- altKey,
67
- shiftKey
68
- } = event;
69
- const hasModifierKeyPressed = metaKey || ctrlKey || altKey || shiftKey;
68
+ altKey
69
+ } = event; // The shift key is intentionally absent from the following list,
70
+ // to enable shift + up/down to select items from the list.
71
+
72
+ const hasModifierKeyPressed = metaKey || ctrlKey || altKey;
70
73
 
71
- if (hasModifierKeyPressed || !includes([UP, DOWN, LEFT, RIGHT], keyCode)) {
74
+ if (hasModifierKeyPressed || !includes([UP, DOWN, LEFT, RIGHT, HOME, END], keyCode)) {
72
75
  return;
73
76
  } // The event will be handled, stop propagation.
74
77
 
@@ -199,13 +202,54 @@ function TreeGrid(_ref, ref) {
199
202
  } // Try to focus the element in the next row that's at a similar column to the activeElement.
200
203
 
201
204
 
205
+ const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
206
+ focusablesInNextRow[nextIndex].focus(); // Let consumers know the row that was originally focused,
207
+ // and the row that is now in focus.
208
+
209
+ onFocusRow(event, activeRow, rows[nextRowIndex]); // Prevent key use for anything else. This ensures Voiceover
210
+ // doesn't try to handle key navigation.
211
+
212
+ event.preventDefault();
213
+ } else if (includes([HOME, END], keyCode)) {
214
+ // Calculate the rowIndex of the next row.
215
+ const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
216
+ const currentRowIndex = rows.indexOf(activeRow);
217
+ let nextRowIndex;
218
+
219
+ if (keyCode === HOME) {
220
+ nextRowIndex = 0;
221
+ } else {
222
+ nextRowIndex = rows.length - 1;
223
+ } // Focus is either at the top or bottom edge of the grid. Do nothing.
224
+
225
+
226
+ if (nextRowIndex === currentRowIndex) {
227
+ // Prevent key use for anything else. For example, Voiceover
228
+ // will start navigating horizontally when reaching the vertical
229
+ // bounds of a table.
230
+ event.preventDefault();
231
+ return;
232
+ } // Get the focusables in the next row.
233
+
234
+
235
+ const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]); // If for some reason there are no focusables in the next row, do nothing.
236
+
237
+ if (!focusablesInNextRow || !focusablesInNextRow.length) {
238
+ // Prevent key use for anything else. For example, Voiceover
239
+ // will still focus text when using arrow keys, while this
240
+ // component should limit navigation to focusables.
241
+ event.preventDefault();
242
+ return;
243
+ } // Try to focus the element in the next row that's at a similar column to the activeElement.
244
+
245
+
202
246
  const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
203
247
  focusablesInNextRow[nextIndex].focus(); // Prevent key use for anything else. This ensures Voiceover
204
248
  // doesn't try to handle key navigation.
205
249
 
206
250
  event.preventDefault();
207
251
  }
208
- }, [onExpandRow, onCollapseRow]);
252
+ }, [onExpandRow, onCollapseRow, onFocusRow]);
209
253
  /* Disable reason: A treegrid is implemented using a table element. */
210
254
 
211
255
  /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */