@wordpress/components 28.10.0 → 28.12.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 (680) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/build/autocomplete/autocompleter-ui.js +2 -6
  3. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  4. package/build/autocomplete/autocompleter-ui.native.js +2 -4
  5. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  6. package/build/autocomplete/index.js +4 -5
  7. package/build/autocomplete/index.js.map +1 -1
  8. package/build/base-control/types.js.map +1 -1
  9. package/build/border-box-control/border-box-control/component.js +1 -0
  10. package/build/border-box-control/border-box-control/component.js.map +1 -1
  11. package/build/border-box-control/border-box-control/hook.js +6 -0
  12. package/build/border-box-control/border-box-control/hook.js.map +1 -1
  13. package/build/border-control/border-control/component.js +1 -0
  14. package/build/border-control/border-control/component.js.map +1 -1
  15. package/build/border-control/border-control/hook.js +6 -0
  16. package/build/border-control/border-control/hook.js.map +1 -1
  17. package/build/border-control/border-control-dropdown/component.js +13 -13
  18. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  19. package/build/color-palette/index.js +1 -1
  20. package/build/color-palette/index.js.map +1 -1
  21. package/build/color-palette/index.native.js +1 -2
  22. package/build/color-palette/index.native.js.map +1 -1
  23. package/build/color-picker/index.native.js +0 -1
  24. package/build/color-picker/index.native.js.map +1 -1
  25. package/build/composite/legacy/index.js +5 -2
  26. package/build/composite/legacy/index.js.map +1 -1
  27. package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -1
  28. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  29. package/build/date-time/date/index.js +0 -1
  30. package/build/date-time/date/index.js.map +1 -1
  31. package/build/font-size-picker/index.native.js +6 -6
  32. package/build/font-size-picker/index.native.js.map +1 -1
  33. package/build/form-file-upload/index.js +5 -1
  34. package/build/form-file-upload/index.js.map +1 -1
  35. package/build/form-token-field/index.js +0 -3
  36. package/build/form-token-field/index.js.map +1 -1
  37. package/build/form-token-field/suggestions-list.js +7 -3
  38. package/build/form-token-field/suggestions-list.js.map +1 -1
  39. package/build/form-token-field/token.js +1 -0
  40. package/build/form-token-field/token.js.map +1 -1
  41. package/build/guide/page-control.js +1 -0
  42. package/build/guide/page-control.js.map +1 -1
  43. package/build/{dropdown-menu-v2 → menu}/checkbox-item.js +8 -8
  44. package/build/menu/checkbox-item.js.map +1 -0
  45. package/build/{dropdown-menu-v2 → menu}/context.js +2 -2
  46. package/build/menu/context.js.map +1 -0
  47. package/build/{dropdown-menu-v2 → menu}/group-label.js +5 -5
  48. package/build/menu/group-label.js.map +1 -0
  49. package/build/{dropdown-menu-v2 → menu}/group.js +5 -5
  50. package/build/menu/group.js.map +1 -0
  51. package/build/{dropdown-menu-v2 → menu}/index.js +38 -38
  52. package/build/menu/index.js.map +1 -0
  53. package/build/{dropdown-menu-v2 → menu}/item-help-text.js +3 -3
  54. package/build/menu/item-help-text.js.map +1 -0
  55. package/build/{dropdown-menu-v2 → menu}/item-label.js +3 -3
  56. package/build/menu/item-label.js.map +1 -0
  57. package/build/{dropdown-menu-v2 → menu}/item.js +7 -7
  58. package/build/menu/item.js.map +1 -0
  59. package/build/{dropdown-menu-v2 → menu}/radio-item.js +8 -8
  60. package/build/menu/radio-item.js.map +1 -0
  61. package/build/{dropdown-menu-v2 → menu}/separator.js +6 -6
  62. package/build/menu/separator.js.map +1 -0
  63. package/build/menu/styles.js +150 -0
  64. package/build/menu/styles.js.map +1 -0
  65. package/build/menu/types.js.map +1 -0
  66. package/build/menu/use-temporary-focus-visible-fix.js.map +1 -0
  67. package/build/menu-item/index.js +1 -0
  68. package/build/menu-item/index.js.map +1 -1
  69. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +3 -5
  70. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  71. package/build/mobile/bottom-sheet/range-cell.native.js +1 -1
  72. package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  73. package/build/mobile/bottom-sheet/stepper-cell/index.native.js +1 -1
  74. package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  75. package/build/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
  76. package/build/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
  77. package/build/mobile/bottom-sheet-select-control/index.native.js +2 -2
  78. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  79. package/build/mobile/color-settings/index.native.js +1 -3
  80. package/build/mobile/color-settings/index.native.js.map +1 -1
  81. package/build/mobile/color-settings/picker-screen.native.js +1 -3
  82. package/build/mobile/color-settings/picker-screen.native.js.map +1 -1
  83. package/build/mobile/image/index.native.js +1 -3
  84. package/build/mobile/image/index.native.js.map +1 -1
  85. package/build/mobile/keyboard-avoiding-view/index.ios.js +1 -3
  86. package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  87. package/build/mobile/link-picker/link-picker-results.native.js +2 -5
  88. package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
  89. package/build/mobile/link-picker/link-picker-screen.native.js +1 -3
  90. package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  91. package/build/mobile/link-settings/index.native.js +6 -18
  92. package/build/mobile/link-settings/index.native.js.map +1 -1
  93. package/build/mobile/link-settings/link-settings-screen.native.js +1 -3
  94. package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  95. package/build/mobile/segmented-control/index.native.js +2 -6
  96. package/build/mobile/segmented-control/index.native.js.map +1 -1
  97. package/build/mobile/utils/use-unit-converter-to-mobile.native.js +2 -6
  98. package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  99. package/build/navigation/index.js +1 -2
  100. package/build/navigation/index.js.map +1 -1
  101. package/build/navigation/item/use-navigation-tree-item.js +2 -2
  102. package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
  103. package/build/navigation/menu/menu-title-search.js +2 -2
  104. package/build/navigation/menu/menu-title-search.js.map +1 -1
  105. package/build/navigation/menu/use-navigation-tree-menu.js +2 -2
  106. package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  107. package/build/notice/index.js +2 -0
  108. package/build/notice/index.js.map +1 -1
  109. package/build/palette-edit/index.js +9 -2
  110. package/build/palette-edit/index.js.map +1 -1
  111. package/build/palette-edit/styles.js +13 -28
  112. package/build/palette-edit/styles.js.map +1 -1
  113. package/build/panel/body.js +1 -0
  114. package/build/panel/body.js.map +1 -1
  115. package/build/popover/index.js +4 -1
  116. package/build/popover/index.js.map +1 -1
  117. package/build/private-apis.js +4 -4
  118. package/build/private-apis.js.map +1 -1
  119. package/build/radio-group/index.js +3 -1
  120. package/build/radio-group/index.js.map +1 -1
  121. package/build/radio-group/radio.js +6 -0
  122. package/build/radio-group/radio.js.map +1 -1
  123. package/build/radio-group/types.js.map +1 -1
  124. package/build/sandbox/index.js +3 -6
  125. package/build/sandbox/index.js.map +1 -1
  126. package/build/sandbox/index.native.js +1 -3
  127. package/build/sandbox/index.native.js.map +1 -1
  128. package/build/search-control/index.native.js +1 -3
  129. package/build/search-control/index.native.js.map +1 -1
  130. package/build/slot-fill/bubbles-virtually/slot.js +1 -2
  131. package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
  132. package/build/slot-fill/fill.js +3 -6
  133. package/build/slot-fill/fill.js.map +1 -1
  134. package/build/snackbar/index.js +2 -1
  135. package/build/snackbar/index.js.map +1 -1
  136. package/build/spacer/hook.js +5 -3
  137. package/build/spacer/hook.js.map +1 -1
  138. package/build/tab-panel/index.js +4 -1
  139. package/build/tab-panel/index.js.map +1 -1
  140. package/build/tabs/index.js +48 -113
  141. package/build/tabs/index.js.map +1 -1
  142. package/build/tabs/styles.js +12 -12
  143. package/build/tabs/styles.js.map +1 -1
  144. package/build/tabs/tab.js +23 -6
  145. package/build/tabs/tab.js.map +1 -1
  146. package/build/tabs/tablist.js +37 -14
  147. package/build/tabs/tablist.js.map +1 -1
  148. package/build/tabs/types.js.map +1 -1
  149. package/build/toggle-group-control/toggle-group-control/component.js +3 -2
  150. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  151. package/build/toolbar/toolbar/index.js +3 -0
  152. package/build/toolbar/toolbar/index.js.map +1 -1
  153. package/build/tools-panel/tools-panel-header/component.js +1 -1
  154. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  155. package/build/tools-panel/tools-panel-item/hook.js +0 -2
  156. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  157. package/build/tooltip/index.native.js +5 -15
  158. package/build/tooltip/index.native.js.map +1 -1
  159. package/build/unit-control/index.native.js +2 -6
  160. package/build/unit-control/index.native.js.map +1 -1
  161. package/build/utils/deprecated-36px-size.js +27 -0
  162. package/build/utils/deprecated-36px-size.js.map +1 -0
  163. package/build/utils/element-rect.js +13 -2
  164. package/build/utils/element-rect.js.map +1 -1
  165. package/build/utils/hooks/use-animated-offset-rect.js +3 -2
  166. package/build/utils/hooks/use-animated-offset-rect.js.map +1 -1
  167. package/build/utils/hooks/use-update-effect.js +0 -2
  168. package/build/utils/hooks/use-update-effect.js.map +1 -1
  169. package/build-module/autocomplete/autocompleter-ui.js +2 -6
  170. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  171. package/build-module/autocomplete/autocompleter-ui.native.js +2 -4
  172. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  173. package/build-module/autocomplete/index.js +4 -5
  174. package/build-module/autocomplete/index.js.map +1 -1
  175. package/build-module/base-control/types.js.map +1 -1
  176. package/build-module/border-box-control/border-box-control/component.js +1 -0
  177. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  178. package/build-module/border-box-control/border-box-control/hook.js +6 -0
  179. package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
  180. package/build-module/border-control/border-control/component.js +1 -0
  181. package/build-module/border-control/border-control/component.js.map +1 -1
  182. package/build-module/border-control/border-control/hook.js +7 -0
  183. package/build-module/border-control/border-control/hook.js.map +1 -1
  184. package/build-module/border-control/border-control-dropdown/component.js +13 -13
  185. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  186. package/build-module/color-palette/index.js +1 -1
  187. package/build-module/color-palette/index.js.map +1 -1
  188. package/build-module/color-palette/index.native.js +1 -2
  189. package/build-module/color-palette/index.native.js.map +1 -1
  190. package/build-module/color-picker/index.native.js +0 -1
  191. package/build-module/color-picker/index.native.js.map +1 -1
  192. package/build-module/composite/legacy/index.js +5 -2
  193. package/build-module/composite/legacy/index.js.map +1 -1
  194. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -1
  195. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  196. package/build-module/date-time/date/index.js +0 -1
  197. package/build-module/date-time/date/index.js.map +1 -1
  198. package/build-module/font-size-picker/index.native.js +7 -7
  199. package/build-module/font-size-picker/index.native.js.map +1 -1
  200. package/build-module/form-file-upload/index.js +5 -1
  201. package/build-module/form-file-upload/index.js.map +1 -1
  202. package/build-module/form-token-field/index.js +0 -3
  203. package/build-module/form-token-field/index.js.map +1 -1
  204. package/build-module/form-token-field/suggestions-list.js +7 -3
  205. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  206. package/build-module/form-token-field/token.js +1 -0
  207. package/build-module/form-token-field/token.js.map +1 -1
  208. package/build-module/guide/page-control.js +1 -0
  209. package/build-module/guide/page-control.js.map +1 -1
  210. package/build-module/{dropdown-menu-v2 → menu}/checkbox-item.js +8 -8
  211. package/build-module/menu/checkbox-item.js.map +1 -0
  212. package/build-module/{dropdown-menu-v2 → menu}/context.js +1 -1
  213. package/build-module/menu/context.js.map +1 -0
  214. package/build-module/{dropdown-menu-v2 → menu}/group-label.js +5 -5
  215. package/build-module/menu/group-label.js.map +1 -0
  216. package/build-module/menu/group.js +21 -0
  217. package/build-module/menu/group.js.map +1 -0
  218. package/build-module/{dropdown-menu-v2 → menu}/index.js +46 -46
  219. package/build-module/menu/index.js.map +1 -0
  220. package/build-module/{dropdown-menu-v2 → menu}/item-help-text.js +2 -2
  221. package/build-module/menu/item-help-text.js.map +1 -0
  222. package/build-module/{dropdown-menu-v2 → menu}/item-label.js +2 -2
  223. package/build-module/menu/item-label.js.map +1 -0
  224. package/build-module/{dropdown-menu-v2 → menu}/item.js +7 -7
  225. package/build-module/menu/item.js.map +1 -0
  226. package/build-module/{dropdown-menu-v2 → menu}/radio-item.js +8 -8
  227. package/build-module/menu/radio-item.js.map +1 -0
  228. package/build-module/menu/separator.js +22 -0
  229. package/build-module/menu/separator.js.map +1 -0
  230. package/build-module/menu/styles.js +143 -0
  231. package/build-module/menu/styles.js.map +1 -0
  232. package/build-module/menu/types.js.map +1 -0
  233. package/build-module/menu/use-temporary-focus-visible-fix.js.map +1 -0
  234. package/build-module/menu-item/index.js +1 -0
  235. package/build-module/menu-item/index.js.map +1 -1
  236. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +3 -5
  237. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  238. package/build-module/mobile/bottom-sheet/range-cell.native.js +1 -1
  239. package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  240. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js +1 -1
  241. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  242. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
  243. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
  244. package/build-module/mobile/bottom-sheet-select-control/index.native.js +2 -2
  245. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  246. package/build-module/mobile/color-settings/index.native.js +1 -3
  247. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  248. package/build-module/mobile/color-settings/picker-screen.native.js +1 -3
  249. package/build-module/mobile/color-settings/picker-screen.native.js.map +1 -1
  250. package/build-module/mobile/image/index.native.js +1 -3
  251. package/build-module/mobile/image/index.native.js.map +1 -1
  252. package/build-module/mobile/keyboard-avoiding-view/index.ios.js +1 -3
  253. package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  254. package/build-module/mobile/link-picker/link-picker-results.native.js +2 -5
  255. package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
  256. package/build-module/mobile/link-picker/link-picker-screen.native.js +1 -3
  257. package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  258. package/build-module/mobile/link-settings/index.native.js +6 -18
  259. package/build-module/mobile/link-settings/index.native.js.map +1 -1
  260. package/build-module/mobile/link-settings/link-settings-screen.native.js +1 -3
  261. package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  262. package/build-module/mobile/segmented-control/index.native.js +2 -6
  263. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  264. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js +2 -6
  265. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  266. package/build-module/navigation/index.js +1 -2
  267. package/build-module/navigation/index.js.map +1 -1
  268. package/build-module/navigation/item/use-navigation-tree-item.js +2 -2
  269. package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
  270. package/build-module/navigation/menu/menu-title-search.js +2 -2
  271. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  272. package/build-module/navigation/menu/use-navigation-tree-menu.js +2 -2
  273. package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  274. package/build-module/notice/index.js +2 -0
  275. package/build-module/notice/index.js.map +1 -1
  276. package/build-module/palette-edit/index.js +11 -4
  277. package/build-module/palette-edit/index.js.map +1 -1
  278. package/build-module/palette-edit/styles.js +13 -29
  279. package/build-module/palette-edit/styles.js.map +1 -1
  280. package/build-module/panel/body.js +1 -0
  281. package/build-module/panel/body.js.map +1 -1
  282. package/build-module/popover/index.js +4 -1
  283. package/build-module/popover/index.js.map +1 -1
  284. package/build-module/private-apis.js +3 -3
  285. package/build-module/private-apis.js.map +1 -1
  286. package/build-module/radio-group/index.js +3 -1
  287. package/build-module/radio-group/index.js.map +1 -1
  288. package/build-module/radio-group/radio.js +6 -0
  289. package/build-module/radio-group/radio.js.map +1 -1
  290. package/build-module/radio-group/types.js.map +1 -1
  291. package/build-module/sandbox/index.js +3 -6
  292. package/build-module/sandbox/index.js.map +1 -1
  293. package/build-module/sandbox/index.native.js +1 -3
  294. package/build-module/sandbox/index.native.js.map +1 -1
  295. package/build-module/search-control/index.native.js +1 -3
  296. package/build-module/search-control/index.native.js.map +1 -1
  297. package/build-module/slot-fill/bubbles-virtually/slot.js +1 -2
  298. package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
  299. package/build-module/slot-fill/fill.js +3 -6
  300. package/build-module/slot-fill/fill.js.map +1 -1
  301. package/build-module/snackbar/index.js +2 -1
  302. package/build-module/snackbar/index.js.map +1 -1
  303. package/build-module/spacer/hook.js +5 -3
  304. package/build-module/spacer/hook.js.map +1 -1
  305. package/build-module/tab-panel/index.js +4 -1
  306. package/build-module/tab-panel/index.js.map +1 -1
  307. package/build-module/tabs/index.js +47 -112
  308. package/build-module/tabs/index.js.map +1 -1
  309. package/build-module/tabs/styles.js +11 -11
  310. package/build-module/tabs/styles.js.map +1 -1
  311. package/build-module/tabs/tab.js +21 -6
  312. package/build-module/tabs/tab.js.map +1 -1
  313. package/build-module/tabs/tablist.js +37 -14
  314. package/build-module/tabs/tablist.js.map +1 -1
  315. package/build-module/tabs/types.js.map +1 -1
  316. package/build-module/toggle-group-control/toggle-group-control/component.js +3 -2
  317. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  318. package/build-module/toolbar/toolbar/index.js +3 -0
  319. package/build-module/toolbar/toolbar/index.js.map +1 -1
  320. package/build-module/tools-panel/tools-panel-header/component.js +1 -1
  321. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  322. package/build-module/tools-panel/tools-panel-item/hook.js +0 -2
  323. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  324. package/build-module/tooltip/index.native.js +5 -15
  325. package/build-module/tooltip/index.native.js.map +1 -1
  326. package/build-module/unit-control/index.native.js +2 -6
  327. package/build-module/unit-control/index.native.js.map +1 -1
  328. package/build-module/utils/deprecated-36px-size.js +19 -0
  329. package/build-module/utils/deprecated-36px-size.js.map +1 -0
  330. package/build-module/utils/element-rect.js +13 -2
  331. package/build-module/utils/element-rect.js.map +1 -1
  332. package/build-module/utils/hooks/use-animated-offset-rect.js +3 -2
  333. package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -1
  334. package/build-module/utils/hooks/use-update-effect.js +0 -2
  335. package/build-module/utils/hooks/use-update-effect.js.map +1 -1
  336. package/build-style/style-rtl.css +21 -35
  337. package/build-style/style.css +21 -35
  338. package/build-types/animate/stories/index.story.d.ts.map +1 -1
  339. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  340. package/build-types/autocomplete/index.d.ts.map +1 -1
  341. package/build-types/base-control/stories/index.story.d.ts.map +1 -1
  342. package/build-types/base-control/types.d.ts +3 -0
  343. package/build-types/base-control/types.d.ts.map +1 -1
  344. package/build-types/border-box-control/border-box-control/component.d.ts +1 -0
  345. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  346. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  347. package/build-types/border-control/border-control/component.d.ts +1 -0
  348. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  349. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  350. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  351. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  352. package/build-types/button/stories/index.story.d.ts.map +1 -1
  353. package/build-types/card/stories/index.story.d.ts.map +1 -1
  354. package/build-types/composite/legacy/index.d.ts.map +1 -1
  355. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  356. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  357. package/build-types/date-time/date/index.d.ts.map +1 -1
  358. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  359. package/build-types/draggable/stories/index.story.d.ts.map +1 -1
  360. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  361. package/build-types/external-link/stories/index.story.d.ts.map +1 -1
  362. package/build-types/form-file-upload/index.d.ts.map +1 -1
  363. package/build-types/form-token-field/index.d.ts.map +1 -1
  364. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  365. package/build-types/form-token-field/token.d.ts.map +1 -1
  366. package/build-types/guide/page-control.d.ts.map +1 -1
  367. package/build-types/heading/stories/index.story.d.ts.map +1 -1
  368. package/build-types/item-group/stories/index.story.d.ts +1 -1
  369. package/build-types/item-group/stories/index.story.d.ts.map +1 -1
  370. package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
  371. package/build-types/lock-unlock.d.ts +2 -2
  372. package/build-types/menu/checkbox-item.d.ts +3 -0
  373. package/build-types/menu/checkbox-item.d.ts.map +1 -0
  374. package/build-types/menu/context.d.ts +6 -0
  375. package/build-types/menu/context.d.ts.map +1 -0
  376. package/build-types/menu/group-label.d.ts +3 -0
  377. package/build-types/menu/group-label.d.ts.map +1 -0
  378. package/build-types/menu/group.d.ts +3 -0
  379. package/build-types/menu/group.d.ts.map +1 -0
  380. package/build-types/menu/index.d.ts +40 -0
  381. package/build-types/menu/index.d.ts.map +1 -0
  382. package/build-types/{dropdown-menu-v2 → menu}/item-help-text.d.ts +1 -1
  383. package/build-types/menu/item-help-text.d.ts.map +1 -0
  384. package/build-types/{dropdown-menu-v2 → menu}/item-label.d.ts +1 -1
  385. package/build-types/menu/item-label.d.ts.map +1 -0
  386. package/build-types/menu/item.d.ts +3 -0
  387. package/build-types/menu/item.d.ts.map +1 -0
  388. package/build-types/menu/radio-item.d.ts +3 -0
  389. package/build-types/menu/radio-item.d.ts.map +1 -0
  390. package/build-types/menu/separator.d.ts +3 -0
  391. package/build-types/menu/separator.d.ts.map +1 -0
  392. package/build-types/menu/stories/index.story.d.ts +16 -0
  393. package/build-types/menu/stories/index.story.d.ts.map +1 -0
  394. package/build-types/{dropdown-menu-v2 → menu}/styles.d.ts +13 -13
  395. package/build-types/menu/styles.d.ts.map +1 -0
  396. package/build-types/menu/test/index.d.ts.map +1 -0
  397. package/build-types/{dropdown-menu-v2 → menu}/types.d.ts +22 -21
  398. package/build-types/menu/types.d.ts.map +1 -0
  399. package/build-types/menu/use-temporary-focus-visible-fix.d.ts.map +1 -0
  400. package/build-types/menu-item/index.d.ts.map +1 -1
  401. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  402. package/build-types/navigable-container/stories/navigable-menu.story.d.ts.map +1 -1
  403. package/build-types/navigable-container/stories/tabbable-container.story.d.ts.map +1 -1
  404. package/build-types/navigation/index.d.ts.map +1 -1
  405. package/build-types/navigator/stories/index.story.d.ts.map +1 -1
  406. package/build-types/notice/index.d.ts.map +1 -1
  407. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  408. package/build-types/palette-edit/index.d.ts.map +1 -1
  409. package/build-types/palette-edit/styles.d.ts +0 -256
  410. package/build-types/palette-edit/styles.d.ts.map +1 -1
  411. package/build-types/panel/body.d.ts.map +1 -1
  412. package/build-types/panel/stories/index.story.d.ts.map +1 -1
  413. package/build-types/popover/index.d.ts.map +1 -1
  414. package/build-types/popover/stories/index.story.d.ts.map +1 -1
  415. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  416. package/build-types/radio-group/index.d.ts.map +1 -1
  417. package/build-types/radio-group/radio.d.ts +4 -2
  418. package/build-types/radio-group/radio.d.ts.map +1 -1
  419. package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
  420. package/build-types/radio-group/types.d.ts +5 -1
  421. package/build-types/radio-group/types.d.ts.map +1 -1
  422. package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
  423. package/build-types/sandbox/index.d.ts.map +1 -1
  424. package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
  425. package/build-types/scroll-lock/stories/index.story.d.ts.map +1 -1
  426. package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
  427. package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
  428. package/build-types/slot-fill/fill.d.ts.map +1 -1
  429. package/build-types/slot-fill/stories/index.story.d.ts.map +1 -1
  430. package/build-types/snackbar/index.d.ts.map +1 -1
  431. package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
  432. package/build-types/snackbar/stories/list.story.d.ts.map +1 -1
  433. package/build-types/spacer/hook.d.ts.map +1 -1
  434. package/build-types/spinner/stories/index.story.d.ts.map +1 -1
  435. package/build-types/tab-panel/index.d.ts.map +1 -1
  436. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  437. package/build-types/tabs/index.d.ts +21 -8
  438. package/build-types/tabs/index.d.ts.map +1 -1
  439. package/build-types/tabs/stories/index.story.d.ts +1 -1
  440. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  441. package/build-types/tabs/styles.d.ts +6 -3
  442. package/build-types/tabs/styles.d.ts.map +1 -1
  443. package/build-types/tabs/tab.d.ts +0 -3
  444. package/build-types/tabs/tab.d.ts.map +1 -1
  445. package/build-types/tabs/tablist.d.ts.map +1 -1
  446. package/build-types/tabs/types.d.ts +85 -48
  447. package/build-types/tabs/types.d.ts.map +1 -1
  448. package/build-types/text/stories/index.story.d.ts.map +1 -1
  449. package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
  450. package/build-types/theme/stories/index.story.d.ts.map +1 -1
  451. package/build-types/tip/stories/index.story.d.ts.map +1 -1
  452. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  453. package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
  454. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  455. package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
  456. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  457. package/build-types/truncate/stories/index.story.d.ts.map +1 -1
  458. package/build-types/utils/deprecated-36px-size.d.ts +6 -0
  459. package/build-types/utils/deprecated-36px-size.d.ts.map +1 -0
  460. package/build-types/utils/element-rect.d.ts +1 -1
  461. package/build-types/utils/element-rect.d.ts.map +1 -1
  462. package/build-types/utils/hooks/use-animated-offset-rect.d.ts +8 -1
  463. package/build-types/utils/hooks/use-animated-offset-rect.d.ts.map +1 -1
  464. package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
  465. package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
  466. package/package.json +21 -20
  467. package/src/alignment-matrix-control/README.md +1 -2
  468. package/src/angle-picker-control/README.md +1 -2
  469. package/src/animate/stories/index.story.tsx +2 -1
  470. package/src/autocomplete/autocompleter-ui.native.js +2 -4
  471. package/src/autocomplete/autocompleter-ui.tsx +2 -6
  472. package/src/autocomplete/index.tsx +4 -5
  473. package/src/base-control/README.md +58 -47
  474. package/src/base-control/docs-manifest.json +12 -0
  475. package/src/base-control/stories/index.story.tsx +4 -0
  476. package/src/base-control/types.ts +3 -0
  477. package/src/border-box-control/border-box-control/README.md +1 -0
  478. package/src/border-box-control/border-box-control/component.tsx +1 -0
  479. package/src/border-box-control/border-box-control/hook.ts +7 -0
  480. package/src/border-box-control/stories/index.story.tsx +1 -0
  481. package/src/border-box-control/test/index.tsx +1 -0
  482. package/src/border-control/border-control/README.md +1 -0
  483. package/src/border-control/border-control/component.tsx +1 -0
  484. package/src/border-control/border-control/hook.ts +7 -1
  485. package/src/border-control/border-control-dropdown/component.tsx +25 -13
  486. package/src/border-control/stories/index.story.tsx +1 -0
  487. package/src/border-control/test/index.js +1 -0
  488. package/src/button/stories/index.story.tsx +2 -1
  489. package/src/card/stories/index.story.tsx +2 -1
  490. package/src/color-palette/index.native.js +1 -2
  491. package/src/color-palette/index.tsx +1 -1
  492. package/src/color-palette/style.scss +2 -4
  493. package/src/color-picker/index.native.js +0 -1
  494. package/src/composite/legacy/index.tsx +5 -2
  495. package/src/composite/stories/index.story.tsx +2 -1
  496. package/src/confirm-dialog/stories/index.story.tsx +2 -1
  497. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +1 -1
  498. package/src/date-time/date/index.tsx +0 -1
  499. package/src/disabled/stories/index.story.tsx +2 -1
  500. package/src/draggable/stories/index.story.tsx +2 -1
  501. package/src/dropdown/stories/index.story.tsx +2 -1
  502. package/src/external-link/stories/index.story.tsx +2 -1
  503. package/src/font-size-picker/index.native.js +7 -7
  504. package/src/form-file-upload/index.tsx +7 -1
  505. package/src/form-token-field/index.tsx +0 -3
  506. package/src/form-token-field/style.scss +12 -13
  507. package/src/form-token-field/suggestions-list.tsx +6 -0
  508. package/src/form-token-field/token.tsx +1 -0
  509. package/src/guide/page-control.tsx +1 -0
  510. package/src/guide/style.scss +4 -6
  511. package/src/heading/stories/index.story.tsx +2 -1
  512. package/src/item-group/stories/index.story.tsx +8 -4
  513. package/src/keyboard-shortcuts/stories/index.story.tsx +2 -1
  514. package/src/{dropdown-menu-v2 → menu}/README.md +34 -34
  515. package/src/{dropdown-menu-v2 → menu}/checkbox-item.tsx +14 -14
  516. package/src/menu/context.tsx +13 -0
  517. package/src/{dropdown-menu-v2 → menu}/group-label.tsx +8 -8
  518. package/src/menu/group.tsx +26 -0
  519. package/src/{dropdown-menu-v2 → menu}/index.tsx +65 -70
  520. package/src/{dropdown-menu-v2 → menu}/item-help-text.tsx +3 -7
  521. package/src/{dropdown-menu-v2 → menu}/item-label.tsx +3 -7
  522. package/src/{dropdown-menu-v2 → menu}/item.tsx +13 -13
  523. package/src/{dropdown-menu-v2 → menu}/radio-item.tsx +14 -14
  524. package/src/menu/separator.tsx +27 -0
  525. package/src/menu/stories/index.story.tsx +543 -0
  526. package/src/{dropdown-menu-v2 → menu}/styles.ts +17 -17
  527. package/src/{dropdown-menu-v2 → menu}/test/index.tsx +145 -225
  528. package/src/{dropdown-menu-v2 → menu}/types.ts +24 -23
  529. package/src/menu-item/index.tsx +1 -0
  530. package/src/menu-item/test/__snapshots__/index.js.snap +4 -4
  531. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +3 -5
  532. package/src/mobile/bottom-sheet/range-cell.native.js +1 -1
  533. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +1 -1
  534. package/src/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
  535. package/src/mobile/bottom-sheet-select-control/index.native.js +2 -2
  536. package/src/mobile/color-settings/index.native.js +1 -3
  537. package/src/mobile/color-settings/picker-screen.native.js +1 -3
  538. package/src/mobile/image/index.native.js +1 -3
  539. package/src/mobile/keyboard-avoiding-view/index.ios.js +1 -3
  540. package/src/mobile/link-picker/link-picker-results.native.js +2 -5
  541. package/src/mobile/link-picker/link-picker-screen.native.js +1 -3
  542. package/src/mobile/link-settings/index.native.js +6 -18
  543. package/src/mobile/link-settings/link-settings-screen.native.js +1 -3
  544. package/src/mobile/segmented-control/index.native.js +2 -6
  545. package/src/mobile/utils/use-unit-converter-to-mobile.native.js +2 -6
  546. package/src/modal/stories/index.story.tsx +2 -1
  547. package/src/navigable-container/stories/navigable-menu.story.tsx +2 -1
  548. package/src/navigable-container/stories/tabbable-container.story.tsx +2 -1
  549. package/src/navigation/index.tsx +1 -2
  550. package/src/navigation/item/use-navigation-tree-item.tsx +2 -2
  551. package/src/navigation/menu/menu-title-search.tsx +2 -2
  552. package/src/navigation/menu/use-navigation-tree-menu.tsx +2 -2
  553. package/src/navigator/stories/index.story.tsx +2 -1
  554. package/src/notice/index.tsx +2 -0
  555. package/src/notice/stories/index.story.tsx +7 -2
  556. package/src/notice/test/__snapshots__/index.tsx.snap +4 -4
  557. package/src/palette-edit/index.tsx +9 -5
  558. package/src/palette-edit/styles.ts +1 -67
  559. package/src/panel/body.tsx +1 -0
  560. package/src/panel/stories/index.story.tsx +2 -1
  561. package/src/popover/index.tsx +3 -0
  562. package/src/popover/stories/index.story.tsx +2 -1
  563. package/src/private-apis.ts +3 -3
  564. package/src/progress-bar/stories/index.story.tsx +2 -1
  565. package/src/radio-group/README.md +8 -8
  566. package/src/radio-group/index.tsx +2 -0
  567. package/src/radio-group/radio.tsx +7 -0
  568. package/src/radio-group/stories/index.story.tsx +16 -4
  569. package/src/radio-group/types.ts +6 -1
  570. package/src/resizable-box/stories/index.story.tsx +2 -1
  571. package/src/sandbox/index.native.js +1 -3
  572. package/src/sandbox/index.tsx +3 -6
  573. package/src/sandbox/stories/index.story.tsx +2 -1
  574. package/src/scroll-lock/stories/index.story.tsx +2 -1
  575. package/src/search-control/index.native.js +1 -3
  576. package/src/shortcut/stories/index.story.tsx +2 -1
  577. package/src/slot-fill/bubbles-virtually/slot.tsx +1 -2
  578. package/src/slot-fill/fill.ts +3 -6
  579. package/src/slot-fill/stories/index.story.tsx +2 -1
  580. package/src/snackbar/index.tsx +2 -1
  581. package/src/snackbar/stories/index.story.tsx +2 -1
  582. package/src/snackbar/stories/list.story.tsx +2 -1
  583. package/src/snackbar/style.scss +7 -16
  584. package/src/spacer/hook.ts +3 -2
  585. package/src/spinner/stories/index.story.tsx +2 -1
  586. package/src/tab-panel/index.tsx +3 -0
  587. package/src/tab-panel/stories/index.story.tsx +2 -1
  588. package/src/tab-panel/style.scss +1 -3
  589. package/src/tabs/README.md +63 -21
  590. package/src/tabs/index.tsx +112 -189
  591. package/src/tabs/stories/index.story.tsx +5 -2
  592. package/src/tabs/styles.ts +13 -5
  593. package/src/tabs/tab.tsx +23 -3
  594. package/src/tabs/tablist.tsx +44 -17
  595. package/src/tabs/test/index.tsx +131 -118
  596. package/src/tabs/types.ts +89 -49
  597. package/src/text/stories/index.story.tsx +2 -1
  598. package/src/text-highlight/stories/index.story.tsx +2 -1
  599. package/src/theme/stories/index.story.tsx +2 -1
  600. package/src/tip/stories/index.story.tsx +2 -1
  601. package/src/toggle-group-control/toggle-group-control/component.tsx +2 -1
  602. package/src/toolbar/toolbar/index.tsx +3 -0
  603. package/src/tools-panel/tools-panel-header/component.tsx +1 -1
  604. package/src/tools-panel/tools-panel-item/hook.ts +0 -2
  605. package/src/tooltip/index.native.js +5 -15
  606. package/src/tooltip/stories/index.story.tsx +2 -1
  607. package/src/tree-grid/stories/index.story.tsx +2 -1
  608. package/src/truncate/stories/index.story.tsx +2 -1
  609. package/src/unit-control/index.native.js +2 -6
  610. package/src/utils/deprecated-36px-size.ts +27 -0
  611. package/src/utils/element-rect.ts +14 -2
  612. package/src/utils/hooks/use-animated-offset-rect.ts +13 -1
  613. package/src/utils/hooks/use-update-effect.js +0 -2
  614. package/src/visually-hidden/stories/index.story.tsx +2 -1
  615. package/tsconfig.tsbuildinfo +1 -1
  616. package/build/dropdown-menu-v2/checkbox-item.js.map +0 -1
  617. package/build/dropdown-menu-v2/context.js.map +0 -1
  618. package/build/dropdown-menu-v2/group-label.js.map +0 -1
  619. package/build/dropdown-menu-v2/group.js.map +0 -1
  620. package/build/dropdown-menu-v2/index.js.map +0 -1
  621. package/build/dropdown-menu-v2/item-help-text.js.map +0 -1
  622. package/build/dropdown-menu-v2/item-label.js.map +0 -1
  623. package/build/dropdown-menu-v2/item.js.map +0 -1
  624. package/build/dropdown-menu-v2/radio-item.js.map +0 -1
  625. package/build/dropdown-menu-v2/separator.js.map +0 -1
  626. package/build/dropdown-menu-v2/styles.js +0 -150
  627. package/build/dropdown-menu-v2/styles.js.map +0 -1
  628. package/build/dropdown-menu-v2/types.js.map +0 -1
  629. package/build/dropdown-menu-v2/use-temporary-focus-visible-fix.js.map +0 -1
  630. package/build-module/dropdown-menu-v2/checkbox-item.js.map +0 -1
  631. package/build-module/dropdown-menu-v2/context.js.map +0 -1
  632. package/build-module/dropdown-menu-v2/group-label.js.map +0 -1
  633. package/build-module/dropdown-menu-v2/group.js +0 -21
  634. package/build-module/dropdown-menu-v2/group.js.map +0 -1
  635. package/build-module/dropdown-menu-v2/index.js.map +0 -1
  636. package/build-module/dropdown-menu-v2/item-help-text.js.map +0 -1
  637. package/build-module/dropdown-menu-v2/item-label.js.map +0 -1
  638. package/build-module/dropdown-menu-v2/item.js.map +0 -1
  639. package/build-module/dropdown-menu-v2/radio-item.js.map +0 -1
  640. package/build-module/dropdown-menu-v2/separator.js +0 -22
  641. package/build-module/dropdown-menu-v2/separator.js.map +0 -1
  642. package/build-module/dropdown-menu-v2/styles.js +0 -143
  643. package/build-module/dropdown-menu-v2/styles.js.map +0 -1
  644. package/build-module/dropdown-menu-v2/types.js.map +0 -1
  645. package/build-module/dropdown-menu-v2/use-temporary-focus-visible-fix.js.map +0 -1
  646. package/build-types/dropdown-menu-v2/checkbox-item.d.ts +0 -3
  647. package/build-types/dropdown-menu-v2/checkbox-item.d.ts.map +0 -1
  648. package/build-types/dropdown-menu-v2/context.d.ts +0 -6
  649. package/build-types/dropdown-menu-v2/context.d.ts.map +0 -1
  650. package/build-types/dropdown-menu-v2/group-label.d.ts +0 -3
  651. package/build-types/dropdown-menu-v2/group-label.d.ts.map +0 -1
  652. package/build-types/dropdown-menu-v2/group.d.ts +0 -3
  653. package/build-types/dropdown-menu-v2/group.d.ts.map +0 -1
  654. package/build-types/dropdown-menu-v2/index.d.ts +0 -40
  655. package/build-types/dropdown-menu-v2/index.d.ts.map +0 -1
  656. package/build-types/dropdown-menu-v2/item-help-text.d.ts.map +0 -1
  657. package/build-types/dropdown-menu-v2/item-label.d.ts.map +0 -1
  658. package/build-types/dropdown-menu-v2/item.d.ts +0 -3
  659. package/build-types/dropdown-menu-v2/item.d.ts.map +0 -1
  660. package/build-types/dropdown-menu-v2/radio-item.d.ts +0 -3
  661. package/build-types/dropdown-menu-v2/radio-item.d.ts.map +0 -1
  662. package/build-types/dropdown-menu-v2/separator.d.ts +0 -3
  663. package/build-types/dropdown-menu-v2/separator.d.ts.map +0 -1
  664. package/build-types/dropdown-menu-v2/stories/index.story.d.ts +0 -16
  665. package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +0 -1
  666. package/build-types/dropdown-menu-v2/styles.d.ts.map +0 -1
  667. package/build-types/dropdown-menu-v2/test/index.d.ts.map +0 -1
  668. package/build-types/dropdown-menu-v2/types.d.ts.map +0 -1
  669. package/build-types/dropdown-menu-v2/use-temporary-focus-visible-fix.d.ts.map +0 -1
  670. package/src/dropdown-menu-v2/context.tsx +0 -13
  671. package/src/dropdown-menu-v2/group.tsx +0 -26
  672. package/src/dropdown-menu-v2/separator.tsx +0 -27
  673. package/src/dropdown-menu-v2/stories/index.story.tsx +0 -639
  674. /package/build/{dropdown-menu-v2 → menu}/types.js +0 -0
  675. /package/build/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.js +0 -0
  676. /package/build-module/{dropdown-menu-v2 → menu}/types.js +0 -0
  677. /package/build-module/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.js +0 -0
  678. /package/build-types/{dropdown-menu-v2 → menu}/test/index.d.ts +0 -0
  679. /package/build-types/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.d.ts +0 -0
  680. /package/src/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/tabs/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type * as Ariakit from '@ariakit/react';\n\nexport type TabsContextProps =\n\t| {\n\t\t\t/**\n\t\t\t * The tabStore object returned by Ariakit's `useTabStore` hook.\n\t\t\t */\n\t\t\tstore: Ariakit.TabStore;\n\t\t\t/**\n\t\t\t * The unique id string for this instance of the Tabs component.\n\t\t\t */\n\t\t\tinstanceId: string;\n\t }\n\t| undefined;\n\nexport type TabsProps = {\n\t/**\n\t * The children elements, which should be at least a\n\t * `Tabs.Tablist` component and a series of `Tabs.TabPanel`\n\t * components.\n\t */\n\tchildren: React.ReactNode;\n\t/**\n\t * When `true`, the tab will be selected when receiving focus (automatic tab\n\t * activation). When `false`, the tab will be selected only when clicked\n\t * (manual tab activation). See the official W3C docs for more info.\n\t *\n\t * @default true\n\t *\n\t * @see https://www.w3.org/WAI/ARIA/apg/patterns/tabpanel/\n\t */\n\tselectOnMove?: boolean;\n\t/**\n\t * The id of the tab to be selected upon mounting of component.\n\t * If this prop is not set, the first tab will be selected by default.\n\t * The id provided will be internally prefixed with the\n\t * `TabsContextProps.instanceId`.\n\t *\n\t * Note: this prop will be overridden by the `selectedTabId` prop if it is\n\t * provided. (Controlled Mode)\n\t */\n\tdefaultTabId?: string;\n\t/**\n\t * The function called when a tab has been selected.\n\t * It is passed the id of the newly selected tab as an argument.\n\t */\n\tonSelect?: ( selectedId: string | null | undefined ) => void;\n\n\t/**\n\t * The orientation of the tablist.\n\t *\n\t * @default `horizontal`\n\t */\n\torientation?: 'horizontal' | 'vertical';\n\t/**\n\t * The Id of the tab to display. This id is prepended with the `Tabs`\n\t * instanceId internally.\n\t *\n\t * If left `undefined`, the component assumes it is being used in\n\t * uncontrolled mode. Consequently, any value different than `undefined`\n\t * will set the component in `controlled` mode.\n\t * When in controlled mode, the `null` value will result in no tab being selected.\n\t */\n\tselectedTabId?: string | null;\n};\n\nexport type TabListProps = {\n\t/**\n\t * The children elements, which should be a series of `Tabs.TabPanel` components.\n\t */\n\tchildren?: React.ReactNode;\n};\n\nexport type TabProps = {\n\t/**\n\t * The id of the tab, which is prepended with the `Tabs` instanceId.\n\t * The value of this prop should match with the value of the `tabId` prop on\n\t * the corresponding `Tabs.TabPanel` component.\n\t */\n\ttabId: string;\n\t/**\n\t * The children elements, generally the text to display on the tab.\n\t */\n\tchildren?: React.ReactNode;\n\t/**\n\t * Determines if the tab button should be disabled.\n\t *\n\t * @default false\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * The type of component to render the tab button as. If this prop is not\n\t * provided, the tab button will be rendered as a `button` element.\n\t */\n\trender?: React.ReactElement;\n};\n\nexport type TabPanelProps = {\n\t/**\n\t * The children elements, generally the content to display on the tabpanel.\n\t */\n\tchildren?: React.ReactNode;\n\t/**\n\t * A unique identifier for the tabpanel, which is used to generate an\n\t * instanced id for the underlying element.\n\t * The value of this prop should match with the value of the `tabId` prop on\n\t * the corresponding `Tabs.Tab` component.\n\t */\n\ttabId: string;\n\t/**\n\t * Determines whether or not the tabpanel element should be focusable.\n\t * If `false`, pressing the tab key will skip over the tabpanel, and instead\n\t * focus on the first focusable element in the panel (if there is one).\n\t *\n\t * @default true\n\t */\n\tfocusable?: boolean;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/tabs/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type * as Ariakit from '@ariakit/react';\n\nexport type TabsContextProps =\n\t| {\n\t\t\t/**\n\t\t\t * The tabStore object returned by Ariakit's `useTabStore` hook.\n\t\t\t */\n\t\t\tstore: Ariakit.TabStore;\n\t\t\t/**\n\t\t\t * The unique id string for this instance of the Tabs component.\n\t\t\t */\n\t\t\tinstanceId: string;\n\t }\n\t| undefined;\n\nexport type TabsProps = {\n\t/**\n\t * The children elements, which should include one instance of the\n\t * `Tabs.Tablist` component and as many instances of the `Tabs.TabPanel`\n\t * components as there are `Tabs.Tab` components.\n\t */\n\tchildren: Ariakit.TabProps[ 'children' ];\n\t/**\n\t * Determines if the tab should be selected when it receives focus. If set to\n\t * `false`, the tab will only be selected upon clicking, not when using arrow\n\t * keys to shift focus (manual tab activation). See the official W3C docs\n\t * for more info.\n\t *\n\t * @default true\n\t *\n\t * @see https://www.w3.org/WAI/ARIA/apg/patterns/tabpanel/\n\t */\n\tselectOnMove?: Ariakit.TabStoreProps[ 'selectOnMove' ];\n\t/**\n\t * The id of the tab whose panel is currently visible.\n\t *\n\t * If left `undefined`, it will be automatically set to the first enabled\n\t * tab, and the component assumes it is being used in \"uncontrolled\" mode.\n\t *\n\t * Consequently, any value different than `undefined` will set the component\n\t * in \"controlled\" mode. When in \"controlled\" mode, the `null` value will\n\t * result in no tabs being selected, and the tablist becoming tabbable.\n\t */\n\tselectedTabId?: Ariakit.TabStoreProps[ 'selectedId' ];\n\t/**\n\t * The id of the tab whose panel is currently visible.\n\t *\n\t * If left `undefined`, it will be automatically set to the first enabled\n\t * tab. If set to `null`, no tab will be selected, and the tablist will be\n\t * tabbable.\n\t *\n\t * Note: this prop will be overridden by the `selectedTabId` prop if it is\n\t * provided (meaning the component will be used in \"controlled\" mode).\n\t */\n\tdefaultTabId?: Ariakit.TabStoreProps[ 'defaultSelectedId' ];\n\t/**\n\t * The function called when the `selectedTabId` changes.\n\t */\n\tonSelect?: Ariakit.TabStoreProps[ 'setSelectedId' ];\n\t/**\n\t * The current active tab `id`. The active tab is the tab element within the\n\t * tablist widget that has DOM focus.\n\t * - `null` represents the tablist (ie. the base composite element). Users\n\t * will be able to navigate out of it using arrow keys.\n\t * - If `activeTabId` is initially set to `null`, the base composite element\n\t * itself will have focus and users will be able to navigate to it using\n\t * arrow keys.activeTabId\n\t */\n\tactiveTabId?: Ariakit.TabStoreProps[ 'activeId' ];\n\t/**\n\t * The tab id that should be active by default when the composite widget is\n\t * rendered. If `null`, the tablist element itself will have focus\n\t * and users will be able to navigate to it using arrow keys. If `undefined`,\n\t * the first enabled item will be focused.\n\t *\n\t * Note: this prop will be overridden by the `activeTabId` prop if it is\n\t * provided.\n\t */\n\tdefaultActiveTabId?: Ariakit.TabStoreProps[ 'defaultActiveId' ];\n\t/**\n\t * A callback that gets called when the `activeTabId` state changes.\n\t */\n\tonActiveTabIdChange?: Ariakit.TabStoreProps[ 'setActiveId' ];\n\t/**\n\t * Defines the orientation of the tablist and determines which arrow keys\n\t * can be used to move focus:\n\t * - `both`: all arrow keys work.\n\t * - `horizontal`: only left and right arrow keys work.\n\t * - `vertical`: only up and down arrow keys work.\n\t *\n\t * @default \"horizontal\"\n\t */\n\torientation?: Ariakit.TabStoreProps[ 'orientation' ];\n};\n\nexport type TabListProps = {\n\t/**\n\t * The children elements, which should include one or more instances of the\n\t * `Tabs.Tab` component.\n\t */\n\tchildren: Ariakit.TabListProps[ 'children' ];\n};\n\n// TODO: consider prop name changes (tabId, selectedTabId)\n// switch to auto-generated README\n// compound technique\n\nexport type TabProps = {\n\t/**\n\t * The unique ID of the tab. It will be used to register the tab and match\n\t * it to a corresponding `Tabs.TabPanel` component.\n\t */\n\ttabId: NonNullable< Ariakit.TabProps[ 'id' ] >;\n\t/**\n\t * The contents of the tab.\n\t */\n\tchildren?: Ariakit.TabProps[ 'children' ];\n\t/**\n\t * Determines if the tab should be disabled. Note that disabled tabs can\n\t * still be accessed via the keyboard when navigating through the tablist.\n\t *\n\t * @default false\n\t */\n\tdisabled?: Ariakit.TabProps[ 'disabled' ];\n\t/**\n\t * Allows the component to be rendered as a different HTML element or React\n\t * component. The value can be a React element or a function that takes in the\n\t * original component props and gives back a React element with the props\n\t * merged.\n\t *\n\t * By default, the tab will be rendered as a `button` element.\n\t */\n\trender?: Ariakit.TabProps[ 'render' ];\n};\n\nexport type TabPanelProps = {\n\t/**\n\t * The contents of the tab panel.\n\t */\n\tchildren?: Ariakit.TabPanelProps[ 'children' ];\n\t/**\n\t * The unique `id` of the `Tabs.Tab` component controlling this panel. This\n\t * connection is used to assign the `aria-labelledby` attribute to the tab\n\t * panel and to determine if the tab panel should be visible.\n\t *\n\t * If not provided, this link is automatically established by matching the\n\t * order of `Tabs.Tab` and `Tabs.TabPanel` elements in the DOM.\n\t */\n\ttabId: NonNullable< Ariakit.TabPanelProps[ 'tabId' ] >;\n\t/**\n\t * Determines whether or not the tabpanel element should be focusable.\n\t * If `false`, pressing the tab key will skip over the tabpanel, and instead\n\t * focus on the first focusable element in the panel (if there is one).\n\t *\n\t * @default true\n\t */\n\tfocusable?: Ariakit.TabPanelProps[ 'focusable' ];\n};\n"],"mappings":"","ignoreList":[]}
@@ -43,11 +43,12 @@ function UnconnectedToggleGroupControl(props, forwardedRef) {
43
43
  const [selectedElement, setSelectedElement] = useState();
44
44
  const [controlElement, setControlElement] = useState();
45
45
  const refs = useMergeRefs([setControlElement, forwardedRef]);
46
- const selectedRect = useTrackElementOffsetRect(value ? selectedElement : undefined);
46
+ const selectedRect = useTrackElementOffsetRect(value || value === 0 ? selectedElement : undefined);
47
47
  useAnimatedOffsetRect(controlElement, selectedRect, {
48
48
  prefix: 'selected',
49
49
  dataAttribute: 'indicator-animated',
50
- transitionEndFilter: event => event.pseudoElement === '::before'
50
+ transitionEndFilter: event => event.pseudoElement === '::before',
51
+ roundRect: true
51
52
  });
52
53
  const cx = useCx();
53
54
  const classes = useMemo(() => cx(styles.toggleGroupControl({
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useState","contextConnect","useContextSystem","useCx","BaseControl","VisualLabelWrapper","styles","ToggleGroupControlAsRadioGroup","ToggleGroupControlAsButtonGroup","useTrackElementOffsetRect","useMergeRefs","useAnimatedOffsetRect","jsx","_jsx","jsxs","_jsxs","UnconnectedToggleGroupControl","props","forwardedRef","__nextHasNoMarginBottom","__next40pxDefaultSize","className","isAdaptiveWidth","isBlock","isDeselectable","label","hideLabelFromVision","help","onChange","size","value","children","otherProps","normalizedSize","selectedElement","setSelectedElement","controlElement","setControlElement","refs","selectedRect","undefined","prefix","dataAttribute","transitionEndFilter","event","pseudoElement","cx","classes","toggleGroupControl","block","MainControl","__associatedWPComponentName","VisualLabel","ref","ToggleGroupControl"],"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect, useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks';\nimport BaseControl from '../../base-control';\nimport type { ToggleGroupControlProps } from '../types';\nimport { VisualLabelWrapper } from './styles';\nimport * as styles from './styles';\nimport { ToggleGroupControlAsRadioGroup } from './as-radio-group';\nimport { ToggleGroupControlAsButtonGroup } from './as-button-group';\nimport { useTrackElementOffsetRect } from '../../utils/element-rect';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { useAnimatedOffsetRect } from '../../utils/hooks/use-animated-offset-rect';\n\nfunction UnconnectedToggleGroupControl(\n\tprops: WordPressComponentProps< ToggleGroupControlProps, 'div', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\t__next40pxDefaultSize = false,\n\t\tclassName,\n\t\tisAdaptiveWidth = false,\n\t\tisBlock = false,\n\t\tisDeselectable = false,\n\t\tlabel,\n\t\thideLabelFromVision = false,\n\t\thelp,\n\t\tonChange,\n\t\tsize = 'default',\n\t\tvalue,\n\t\tchildren,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToggleGroupControl' );\n\n\tconst normalizedSize =\n\t\t__next40pxDefaultSize && size === 'default' ? '__unstable-large' : size;\n\n\tconst [ selectedElement, setSelectedElement ] = useState< HTMLElement >();\n\tconst [ controlElement, setControlElement ] = useState< HTMLElement >();\n\tconst refs = useMergeRefs( [ setControlElement, forwardedRef ] );\n\tconst selectedRect = useTrackElementOffsetRect(\n\t\tvalue ? selectedElement : undefined\n\t);\n\tuseAnimatedOffsetRect( controlElement, selectedRect, {\n\t\tprefix: 'selected',\n\t\tdataAttribute: 'indicator-animated',\n\t\ttransitionEndFilter: ( event ) => event.pseudoElement === '::before',\n\t} );\n\n\tconst cx = useCx();\n\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.toggleGroupControl( {\n\t\t\t\t\tisBlock,\n\t\t\t\t\tisDeselectable,\n\t\t\t\t\tsize: normalizedSize,\n\t\t\t\t} ),\n\t\t\t\tisBlock && styles.block,\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx, isBlock, isDeselectable, normalizedSize ]\n\t);\n\n\tconst MainControl = isDeselectable\n\t\t? ToggleGroupControlAsButtonGroup\n\t\t: ToggleGroupControlAsRadioGroup;\n\n\treturn (\n\t\t<BaseControl\n\t\t\thelp={ help }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t__associatedWPComponentName=\"ToggleGroupControl\"\n\t\t>\n\t\t\t{ ! hideLabelFromVision && (\n\t\t\t\t<VisualLabelWrapper>\n\t\t\t\t\t<BaseControl.VisualLabel>{ label }</BaseControl.VisualLabel>\n\t\t\t\t</VisualLabelWrapper>\n\t\t\t) }\n\t\t\t<MainControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tsetSelectedElement={ setSelectedElement }\n\t\t\t\tclassName={ classes }\n\t\t\t\tisAdaptiveWidth={ isAdaptiveWidth }\n\t\t\t\tlabel={ label }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tref={ refs }\n\t\t\t\tsize={ normalizedSize }\n\t\t\t\tvalue={ value }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</MainControl>\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 * This component is intended for selecting a single persistent value from a set of options,\n * similar to a how a radio button group would work. If you simply want a toggle to switch between views,\n * use a `TabPanel` instead.\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 * ```jsx\n * import {\n * __experimentalToggleGroupControl as ToggleGroupControl,\n * __experimentalToggleGroupControlOption as ToggleGroupControlOption,\n * } from '@wordpress/components';\n *\n * function Example() {\n * return (\n * <ToggleGroupControl\n * label=\"my label\"\n * value=\"vertical\"\n * isBlock\n * __nextHasNoMarginBottom\n * >\n * <ToggleGroupControlOption value=\"horizontal\" label=\"Horizontal\" />\n * <ToggleGroupControlOption value=\"vertical\" label=\"Vertical\" />\n * </ToggleGroupControl>\n * );\n * }\n * ```\n */\nexport const ToggleGroupControl = contextConnect(\n\tUnconnectedToggleGroupControl,\n\t'ToggleGroupControl'\n);\n\nexport default ToggleGroupControl;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEtD;AACA;AACA;;AAEA,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,eAAe;AAChE,SAASC,KAAK,QAAQ,mBAAmB;AACzC,OAAOC,WAAW,MAAM,oBAAoB;AAE5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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMuB,kBAAkB,GAAGrD,cAAc,CAC/Ce,6BAA6B,EAC7B,oBACD,CAAC;AAED,eAAesC,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useState","contextConnect","useContextSystem","useCx","BaseControl","VisualLabelWrapper","styles","ToggleGroupControlAsRadioGroup","ToggleGroupControlAsButtonGroup","useTrackElementOffsetRect","useMergeRefs","useAnimatedOffsetRect","jsx","_jsx","jsxs","_jsxs","UnconnectedToggleGroupControl","props","forwardedRef","__nextHasNoMarginBottom","__next40pxDefaultSize","className","isAdaptiveWidth","isBlock","isDeselectable","label","hideLabelFromVision","help","onChange","size","value","children","otherProps","normalizedSize","selectedElement","setSelectedElement","controlElement","setControlElement","refs","selectedRect","undefined","prefix","dataAttribute","transitionEndFilter","event","pseudoElement","roundRect","cx","classes","toggleGroupControl","block","MainControl","__associatedWPComponentName","VisualLabel","ref","ToggleGroupControl"],"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect, useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks';\nimport BaseControl from '../../base-control';\nimport type { ToggleGroupControlProps } from '../types';\nimport { VisualLabelWrapper } from './styles';\nimport * as styles from './styles';\nimport { ToggleGroupControlAsRadioGroup } from './as-radio-group';\nimport { ToggleGroupControlAsButtonGroup } from './as-button-group';\nimport { useTrackElementOffsetRect } from '../../utils/element-rect';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { useAnimatedOffsetRect } from '../../utils/hooks/use-animated-offset-rect';\n\nfunction UnconnectedToggleGroupControl(\n\tprops: WordPressComponentProps< ToggleGroupControlProps, 'div', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\t__next40pxDefaultSize = false,\n\t\tclassName,\n\t\tisAdaptiveWidth = false,\n\t\tisBlock = false,\n\t\tisDeselectable = false,\n\t\tlabel,\n\t\thideLabelFromVision = false,\n\t\thelp,\n\t\tonChange,\n\t\tsize = 'default',\n\t\tvalue,\n\t\tchildren,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToggleGroupControl' );\n\n\tconst normalizedSize =\n\t\t__next40pxDefaultSize && size === 'default' ? '__unstable-large' : size;\n\n\tconst [ selectedElement, setSelectedElement ] = useState< HTMLElement >();\n\tconst [ controlElement, setControlElement ] = useState< HTMLElement >();\n\tconst refs = useMergeRefs( [ setControlElement, forwardedRef ] );\n\tconst selectedRect = useTrackElementOffsetRect(\n\t\tvalue || value === 0 ? selectedElement : undefined\n\t);\n\tuseAnimatedOffsetRect( controlElement, selectedRect, {\n\t\tprefix: 'selected',\n\t\tdataAttribute: 'indicator-animated',\n\t\ttransitionEndFilter: ( event ) => event.pseudoElement === '::before',\n\t\troundRect: true,\n\t} );\n\n\tconst cx = useCx();\n\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.toggleGroupControl( {\n\t\t\t\t\tisBlock,\n\t\t\t\t\tisDeselectable,\n\t\t\t\t\tsize: normalizedSize,\n\t\t\t\t} ),\n\t\t\t\tisBlock && styles.block,\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx, isBlock, isDeselectable, normalizedSize ]\n\t);\n\n\tconst MainControl = isDeselectable\n\t\t? ToggleGroupControlAsButtonGroup\n\t\t: ToggleGroupControlAsRadioGroup;\n\n\treturn (\n\t\t<BaseControl\n\t\t\thelp={ help }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t__associatedWPComponentName=\"ToggleGroupControl\"\n\t\t>\n\t\t\t{ ! hideLabelFromVision && (\n\t\t\t\t<VisualLabelWrapper>\n\t\t\t\t\t<BaseControl.VisualLabel>{ label }</BaseControl.VisualLabel>\n\t\t\t\t</VisualLabelWrapper>\n\t\t\t) }\n\t\t\t<MainControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tsetSelectedElement={ setSelectedElement }\n\t\t\t\tclassName={ classes }\n\t\t\t\tisAdaptiveWidth={ isAdaptiveWidth }\n\t\t\t\tlabel={ label }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tref={ refs }\n\t\t\t\tsize={ normalizedSize }\n\t\t\t\tvalue={ value }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</MainControl>\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 * This component is intended for selecting a single persistent value from a set of options,\n * similar to a how a radio button group would work. If you simply want a toggle to switch between views,\n * use a `TabPanel` instead.\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 * ```jsx\n * import {\n * __experimentalToggleGroupControl as ToggleGroupControl,\n * __experimentalToggleGroupControlOption as ToggleGroupControlOption,\n * } from '@wordpress/components';\n *\n * function Example() {\n * return (\n * <ToggleGroupControl\n * label=\"my label\"\n * value=\"vertical\"\n * isBlock\n * __nextHasNoMarginBottom\n * >\n * <ToggleGroupControlOption value=\"horizontal\" label=\"Horizontal\" />\n * <ToggleGroupControlOption value=\"vertical\" label=\"Vertical\" />\n * </ToggleGroupControl>\n * );\n * }\n * ```\n */\nexport const ToggleGroupControl = contextConnect(\n\tUnconnectedToggleGroupControl,\n\t'ToggleGroupControl'\n);\n\nexport default ToggleGroupControl;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEtD;AACA;AACA;;AAEA,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,eAAe;AAChE,SAASC,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A;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,OAAO,MAAMwB,kBAAkB,GAAGtD,cAAc,CAC/Ce,6BAA6B,EAC7B,oBACD,CAAC;AAED,eAAeuC,kBAAkB","ignoreList":[]}
@@ -32,6 +32,9 @@ function UnforwardedToolbar({
32
32
  },
33
33
  Dropdown: {
34
34
  variant: 'toolbar'
35
+ },
36
+ Menu: {
37
+ variant: 'toolbar'
35
38
  }
36
39
  };
37
40
  }, [isVariantDefined]);
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","forwardRef","useMemo","deprecated","ToolbarGroup","ToolbarContainer","ContextSystemProvider","jsx","_jsx","UnforwardedToolbar","className","label","variant","props","ref","isVariantDefined","undefined","contextSystemValue","DropdownMenu","Dropdown","since","alternative","link","title","_title","restProps","isCollapsed","finalClassName","value","children","Toolbar"],"sources":["@wordpress/components/src/toolbar/toolbar/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport ToolbarGroup from '../toolbar-group';\nimport ToolbarContainer from './toolbar-container';\nimport type { ToolbarProps } from './types';\nimport type { WordPressComponentProps } from '../../context';\nimport { ContextSystemProvider } from '../../context';\n\nfunction UnforwardedToolbar(\n\t{\n\t\tclassName,\n\t\tlabel,\n\t\tvariant,\n\t\t...props\n\t}: WordPressComponentProps< ToolbarProps, 'div', false >,\n\tref: ForwardedRef< any >\n) {\n\tconst isVariantDefined = variant !== undefined;\n\tconst contextSystemValue = useMemo( () => {\n\t\tif ( isVariantDefined ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn {\n\t\t\tDropdownMenu: {\n\t\t\t\tvariant: 'toolbar',\n\t\t\t},\n\t\t\tDropdown: {\n\t\t\t\tvariant: 'toolbar',\n\t\t\t},\n\t\t};\n\t}, [ isVariantDefined ] );\n\n\tif ( ! label ) {\n\t\tdeprecated( 'Using Toolbar without label prop', {\n\t\t\tsince: '5.6',\n\t\t\talternative: 'ToolbarGroup component',\n\t\t\tlink: 'https://developer.wordpress.org/block-editor/components/toolbar/',\n\t\t} );\n\t\t// Extracting title from `props` because `ToolbarGroup` doesn't accept it.\n\t\tconst { title: _title, ...restProps } = props;\n\t\treturn (\n\t\t\t<ToolbarGroup\n\t\t\t\tisCollapsed={ false }\n\t\t\t\t{ ...restProps }\n\t\t\t\tclassName={ className }\n\t\t\t/>\n\t\t);\n\t}\n\t// `ToolbarGroup` already uses components-toolbar for compatibility reasons.\n\tconst finalClassName = clsx(\n\t\t'components-accessible-toolbar',\n\t\tclassName,\n\t\tvariant && `is-${ variant }`\n\t);\n\n\treturn (\n\t\t<ContextSystemProvider value={ contextSystemValue }>\n\t\t\t<ToolbarContainer\n\t\t\t\tclassName={ finalClassName }\n\t\t\t\tlabel={ label }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</ContextSystemProvider>\n\t);\n}\n\n/**\n * Renders a toolbar.\n *\n * To add controls, simply pass `ToolbarButton` components as children.\n *\n * ```jsx\n * import { Toolbar, ToolbarButton } from '@wordpress/components';\n * import { formatBold, formatItalic, link } from '@wordpress/icons';\n *\n * function MyToolbar() {\n * return (\n * <Toolbar label=\"Options\">\n * <ToolbarButton icon={ formatBold } label=\"Bold\" />\n * <ToolbarButton icon={ formatItalic } label=\"Italic\" />\n * <ToolbarButton icon={ link } label=\"Link\" />\n * </Toolbar>\n * );\n * }\n * ```\n */\nexport const Toolbar = forwardRef( UnforwardedToolbar );\nexport default Toolbar;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AAGvB;AACA;AACA;AACA,SAASC,U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EAAGiB,cAAgB;MAC5BhB,KAAK,EAAGA,KAAO;MACfG,GAAG,EAAGA,GAAK;MAAA,GACND;IAAK,CACV;EAAC,CACoB,CAAC;AAE1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMiB,OAAO,GAAG7B,UAAU,CAAEQ,kBAAmB,CAAC;AACvD,eAAeqB,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["clsx","forwardRef","useMemo","deprecated","ToolbarGroup","ToolbarContainer","ContextSystemProvider","jsx","_jsx","UnforwardedToolbar","className","label","variant","props","ref","isVariantDefined","undefined","contextSystemValue","DropdownMenu","Dropdown","Menu","since","alternative","link","title","_title","restProps","isCollapsed","finalClassName","value","children","Toolbar"],"sources":["@wordpress/components/src/toolbar/toolbar/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport ToolbarGroup from '../toolbar-group';\nimport ToolbarContainer from './toolbar-container';\nimport type { ToolbarProps } from './types';\nimport type { WordPressComponentProps } from '../../context';\nimport { ContextSystemProvider } from '../../context';\n\nfunction UnforwardedToolbar(\n\t{\n\t\tclassName,\n\t\tlabel,\n\t\tvariant,\n\t\t...props\n\t}: WordPressComponentProps< ToolbarProps, 'div', false >,\n\tref: ForwardedRef< any >\n) {\n\tconst isVariantDefined = variant !== undefined;\n\tconst contextSystemValue = useMemo( () => {\n\t\tif ( isVariantDefined ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn {\n\t\t\tDropdownMenu: {\n\t\t\t\tvariant: 'toolbar',\n\t\t\t},\n\t\t\tDropdown: {\n\t\t\t\tvariant: 'toolbar',\n\t\t\t},\n\t\t\tMenu: {\n\t\t\t\tvariant: 'toolbar',\n\t\t\t},\n\t\t};\n\t}, [ isVariantDefined ] );\n\n\tif ( ! label ) {\n\t\tdeprecated( 'Using Toolbar without label prop', {\n\t\t\tsince: '5.6',\n\t\t\talternative: 'ToolbarGroup component',\n\t\t\tlink: 'https://developer.wordpress.org/block-editor/components/toolbar/',\n\t\t} );\n\t\t// Extracting title from `props` because `ToolbarGroup` doesn't accept it.\n\t\tconst { title: _title, ...restProps } = props;\n\t\treturn (\n\t\t\t<ToolbarGroup\n\t\t\t\tisCollapsed={ false }\n\t\t\t\t{ ...restProps }\n\t\t\t\tclassName={ className }\n\t\t\t/>\n\t\t);\n\t}\n\t// `ToolbarGroup` already uses components-toolbar for compatibility reasons.\n\tconst finalClassName = clsx(\n\t\t'components-accessible-toolbar',\n\t\tclassName,\n\t\tvariant && `is-${ variant }`\n\t);\n\n\treturn (\n\t\t<ContextSystemProvider value={ contextSystemValue }>\n\t\t\t<ToolbarContainer\n\t\t\t\tclassName={ finalClassName }\n\t\t\t\tlabel={ label }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</ContextSystemProvider>\n\t);\n}\n\n/**\n * Renders a toolbar.\n *\n * To add controls, simply pass `ToolbarButton` components as children.\n *\n * ```jsx\n * import { Toolbar, ToolbarButton } from '@wordpress/components';\n * import { formatBold, formatItalic, link } from '@wordpress/icons';\n *\n * function MyToolbar() {\n * return (\n * <Toolbar label=\"Options\">\n * <ToolbarButton icon={ formatBold } label=\"Bold\" />\n * <ToolbarButton icon={ formatItalic } label=\"Italic\" />\n * <ToolbarButton icon={ link } label=\"Link\" />\n * </Toolbar>\n * );\n * }\n * ```\n */\nexport const Toolbar = forwardRef( UnforwardedToolbar );\nexport default Toolbar;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AAGvB;AACA;AACA;AACA,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,OAAOC,UAAU,MAAM,uBAAu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MAC5BjB,KAAK,EAAGA,KAAO;MACfG,GAAG,EAAGA,GAAK;MAAA,GACND;IAAK,CACV;EAAC,CACoB,CAAC;AAE1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMkB,OAAO,GAAG9B,UAAU,CAAEQ,kBAAmB,CAAC;AACvD,eAAesB,OAAO","ignoreList":[]}
@@ -76,7 +76,7 @@ const OptionalControlsGroup = ({
76
76
  // translators: %s: The name of the control being hidden and reset e.g. "Padding".
77
77
  __('Hide and reset %s'), label) : sprintf(
78
78
  // translators: %s: The name of the control to display e.g. "Padding".
79
- __('Show %s'), label);
79
+ _x('Show %s', 'input control'), label);
80
80
  return /*#__PURE__*/_jsx(MenuItem, {
81
81
  icon: isSelected ? check : null,
82
82
  isSelected: isSelected,
@@ -1 +1 @@
1
- {"version":3,"names":["speak","check","moreVertical","plus","__","_x","sprintf","DropdownMenu","MenuGroup","MenuItem","HStack","Heading","useToolsPanelHeader","contextConnect","ResetLabel","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DefaultControlsGroup","itemClassName","items","toggleItem","length","resetSuffix","children","map","label","hasValue","className","role","onClick","suffix","icon","isSelected","OptionalControlsGroup","itemLabel","ToolsPanelHeader","props","forwardedRef","areAllOptionalControlsHidden","defaultControlsItemClassName","dropdownMenuClassName","hasMenuItems","headingClassName","headingLevel","labelText","menuItems","resetAll","dropdownMenuProps","headerProps","defaultItems","Object","entries","default","optionalItems","optional","dropDownMenuIcon","dropDownMenuLabelText","dropdownMenuDescriptionText","undefined","canResetAll","some","ref","level","menuProps","toggleProps","size","description","variant","ConnectedToolsPanelHeader"],"sources":["@wordpress/components/src/tools-panel/tools-panel-header/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { check, 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 type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { ResetLabel } from '../styles';\nimport type {\n\tToolsPanelControlsGroupProps,\n\tToolsPanelHeaderProps,\n} from '../types';\n\nconst DefaultControlsGroup = ( {\n\titemClassName,\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\tconst resetSuffix = <ResetLabel aria-hidden>{ __( 'Reset' ) }</ResetLabel>;\n\n\treturn (\n\t\t<>\n\t\t\t{ items.map( ( [ label, hasValue ] ) => {\n\t\t\t\tif ( hasValue ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\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\t__( 'Reset %s' ),\n\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\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\t\t\t__( '%s reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsuffix={ resetSuffix }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t);\n\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={ check }\n\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\taria-disabled\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</>\n\t);\n};\n\nconst OptionalControlsGroup = ( {\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\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 : null }\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\tif ( isSelected ) {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\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\t\t\t__( '%s hidden and reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\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\t\t\t__( '%s is now visible' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttoggleItem( label );\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</>\n\t);\n};\n\nconst ToolsPanelHeader = (\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tareAllOptionalControlsHidden,\n\t\tdefaultControlsItemClassName,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\theadingLevel = 2,\n\t\tlabel: labelText,\n\t\tmenuItems,\n\t\tresetAll,\n\t\ttoggleItem,\n\t\tdropdownMenuProps,\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 = sprintf(\n\t\t// translators: %s: The name of the tool e.g. \"Color\" or \"Typography\".\n\t\t_x( '%s options', 'Button label to reveal tool panel options' ),\n\t\tlabelText\n\t);\n\tconst dropdownMenuDescriptionText = areAllOptionalControlsHidden\n\t\t? __( 'All options are currently hidden' )\n\t\t: undefined;\n\n\tconst canResetAll = [ ...defaultItems, ...optionalItems ].some(\n\t\t( [ , isSelected ] ) => isSelected\n\t);\n\n\treturn (\n\t\t<HStack { ...headerProps } ref={ forwardedRef }>\n\t\t\t<Heading level={ headingLevel } 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\t{ ...dropdownMenuProps }\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={ {\n\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\tdescription: dropdownMenuDescriptionText,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ () => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup label={ labelText }>\n\t\t\t\t\t\t\t\t<DefaultControlsGroup\n\t\t\t\t\t\t\t\t\titems={ defaultItems }\n\t\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t\t\titemClassName={\n\t\t\t\t\t\t\t\t\t\tdefaultControlsItemClassName\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<OptionalControlsGroup\n\t\t\t\t\t\t\t\t\titems={ optionalItems }\n\t\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\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\taria-disabled={ ! canResetAll }\n\t\t\t\t\t\t\t\t\t// @ts-expect-error - TODO: If this \"tertiary\" style is something we really want to allow on MenuItem,\n\t\t\t\t\t\t\t\t\t// we should rename it and explicitly allow it as an official API. All the other Button variants\n\t\t\t\t\t\t\t\t\t// don't make sense in a MenuItem context, and should be disallowed.\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\tif ( canResetAll ) {\n\t\t\t\t\t\t\t\t\t\t\tresetAll();\n\t\t\t\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'All options reset' ),\n\t\t\t\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\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"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,iBAAiB;AACvC,SAASC,KAAK,EAAEC,YAAY,EAAEC,IAAI,QAAQ,kBAAkB;AAC5D,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA,OAAOC,YAAY,MAAM,qBAAqB;AAC9C,OAAOC,SAAS,MAAM,kBAAkB;AACxC,OAAOC,QAAQ,MAAM,iBAAiB;AACtC,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,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A,EAEDA,CAAA,kBACDP,KAAA,CAAAF,SAAA;QAAAS,QAAA,gBACCP,KAAA,CAACZ,SAAS;UAACqB,KAAK,EAAGmB,SAAW;UAAArB,QAAA,gBAC7BX,IAAA,CAACK,oBAAoB;YACpBE,KAAK,EAAG8B,YAAc;YACtB7B,UAAU,EAAGA,UAAY;YACzBF,aAAa,EACZqB;UACA,CACD,CAAC,eACF3B,IAAA,CAACqB,qBAAqB;YACrBd,KAAK,EAAGkC,aAAe;YACvBjC,UAAU,EAAGA;UAAY,CACzB,CAAC;QAAA,CACQ,CAAC,eACZR,IAAA,CAACR,SAAS;UAAAmB,QAAA,eACTX,IAAA,CAACP,QAAQ;YACR,iBAAgB,CAAEsD;YAClB;YACA;YACA;YAAA;YACAQ,OAAO,EAAC,UAAU;YAClBtC,OAAO,EAAGA,CAAA,KAAM;cACf,IAAK8B,WAAW,EAAG;gBAClBb,QAAQ,CAAC,CAAC;gBACVlD,KAAK,CACJI,EAAE,CAAE,mBAAoB,CAAC,EACzB,WACD,CAAC;cACF;YACD,CAAG;YAAAuB,QAAA,EAEDvB,EAAE,CAAE,WAAY;UAAC,CACV;QAAC,CACD,CAAC;MAAA,CACX;IACF,CACY,CACd;EAAA,CACM,CAAC;AAEX,CAAC;AAED,MAAMoE,yBAAyB,GAAG3D,cAAc,CAC/C0B,gBAAgB,EAChB,kBACD,CAAC;AAED,eAAeiC,yBAAyB","ignoreList":[]}
1
+ {"version":3,"names":["speak","check","moreVertical","plus","__","_x","sprintf","DropdownMenu","MenuGroup","MenuItem","HStack","Heading","useToolsPanelHeader","contextConnect","ResetLabel","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DefaultControlsGroup","itemClassName","items","toggleItem","length","resetSuffix","children","map","label","hasValue","className","role","onClick","suffix","icon","isSelected","OptionalControlsGroup","itemLabel","ToolsPanelHeader","props","forwardedRef","areAllOptionalControlsHidden","defaultControlsItemClassName","dropdownMenuClassName","hasMenuItems","headingClassName","headingLevel","labelText","menuItems","resetAll","dropdownMenuProps","headerProps","defaultItems","Object","entries","default","optionalItems","optional","dropDownMenuIcon","dropDownMenuLabelText","dropdownMenuDescriptionText","undefined","canResetAll","some","ref","level","menuProps","toggleProps","size","description","variant","ConnectedToolsPanelHeader"],"sources":["@wordpress/components/src/tools-panel/tools-panel-header/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { check, 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 type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { ResetLabel } from '../styles';\nimport type {\n\tToolsPanelControlsGroupProps,\n\tToolsPanelHeaderProps,\n} from '../types';\n\nconst DefaultControlsGroup = ( {\n\titemClassName,\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\tconst resetSuffix = <ResetLabel aria-hidden>{ __( 'Reset' ) }</ResetLabel>;\n\n\treturn (\n\t\t<>\n\t\t\t{ items.map( ( [ label, hasValue ] ) => {\n\t\t\t\tif ( hasValue ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\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\t__( 'Reset %s' ),\n\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\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\t\t\t__( '%s reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsuffix={ resetSuffix }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t);\n\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={ check }\n\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\taria-disabled\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</>\n\t);\n};\n\nconst OptionalControlsGroup = ( {\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\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_x( 'Show %s', 'input control' ),\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 : null }\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\tif ( isSelected ) {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\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\t\t\t__( '%s hidden and reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\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\t\t\t__( '%s is now visible' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttoggleItem( label );\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</>\n\t);\n};\n\nconst ToolsPanelHeader = (\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tareAllOptionalControlsHidden,\n\t\tdefaultControlsItemClassName,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\theadingLevel = 2,\n\t\tlabel: labelText,\n\t\tmenuItems,\n\t\tresetAll,\n\t\ttoggleItem,\n\t\tdropdownMenuProps,\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 = sprintf(\n\t\t// translators: %s: The name of the tool e.g. \"Color\" or \"Typography\".\n\t\t_x( '%s options', 'Button label to reveal tool panel options' ),\n\t\tlabelText\n\t);\n\tconst dropdownMenuDescriptionText = areAllOptionalControlsHidden\n\t\t? __( 'All options are currently hidden' )\n\t\t: undefined;\n\n\tconst canResetAll = [ ...defaultItems, ...optionalItems ].some(\n\t\t( [ , isSelected ] ) => isSelected\n\t);\n\n\treturn (\n\t\t<HStack { ...headerProps } ref={ forwardedRef }>\n\t\t\t<Heading level={ headingLevel } 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\t{ ...dropdownMenuProps }\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={ {\n\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\tdescription: dropdownMenuDescriptionText,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ () => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup label={ labelText }>\n\t\t\t\t\t\t\t\t<DefaultControlsGroup\n\t\t\t\t\t\t\t\t\titems={ defaultItems }\n\t\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t\t\titemClassName={\n\t\t\t\t\t\t\t\t\t\tdefaultControlsItemClassName\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<OptionalControlsGroup\n\t\t\t\t\t\t\t\t\titems={ optionalItems }\n\t\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\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\taria-disabled={ ! canResetAll }\n\t\t\t\t\t\t\t\t\t// @ts-expect-error - TODO: If this \"tertiary\" style is something we really want to allow on MenuItem,\n\t\t\t\t\t\t\t\t\t// we should rename it and explicitly allow it as an official API. All the other Button variants\n\t\t\t\t\t\t\t\t\t// don't make sense in a MenuItem context, and should be disallowed.\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\tif ( canResetAll ) {\n\t\t\t\t\t\t\t\t\t\t\tresetAll();\n\t\t\t\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'All options reset' ),\n\t\t\t\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\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"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,iB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+42,9 @@ export function useToolsPanelItem(props) {
42
42
 
43
43
  // hasValue is a new function on every render, so do not add it as a
44
44
  // dependency to the useCallback hook! If needed, we should use a ref.
45
- // eslint-disable-next-line react-hooks/exhaustive-deps
46
45
  const hasValueCallback = useCallback(hasValue, [panelId]);
47
46
  // resetAllFilter is a new function on every render, so do not add it as a
48
47
  // dependency to the useCallback hook! If needed, we should use a ref.
49
- // eslint-disable-next-line react-hooks/exhaustive-deps
50
48
  const resetAllFilterCallback = useCallback(resetAllFilter, [panelId]);
51
49
  const previousPanelId = usePrevious(currentPanelId);
52
50
  const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null;
@@ -1 +1 @@
1
- {"version":3,"names":["usePrevious","useCallback","useEffect","useLayoutEffect","useMemo","styles","useToolsPanelContext","useContextSystem","useCx","noop","useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","currentPanelId","menuItems","registerResetAllFilter","deregisterResetAllFilter","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","firstDisplayedItem","lastDisplayedItem","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","hasValueCallback","resetAllFilterCallback","previousPanelId","hasMatchingPanel","menuGroup","isMenuItemChecked","wasMenuItemChecked","isRegistered","undefined","isValueSet","isShown","cx","classes","shouldApplyPlaceholderStyles","firstItemStyle","lastItemStyle","ToolsPanelItem","ToolsPanelItemPlaceholder"],"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseMemo,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nconst noop = () => {};\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault = false,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter = noop,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t} = useToolsPanelContext();\n\n\t// hasValue is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst hasValueCallback = useCallback( hasValue, [ panelId ] );\n\t// resetAllFilter is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [ panelId ] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\t//\n\t// This is performed in a layout effect to ensure that the panel item\n\t// is registered before it is rendered preventing a rendering glitch.\n\t// See: https://github.com/WordPress/gutenberg/issues/56470\n\tuseLayoutEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t] );\n\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel ) {\n\t\t\tregisterResetAllFilter( resetAllFilterCallback );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( hasMatchingPanel ) {\n\t\t\t\tderegisterResetAllFilter( resetAllFilterCallback );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tresetAllFilterCallback,\n\t\thasMatchingPanel,\n\t] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\tconst isRegistered = menuItems?.[ menuGroup ]?.[ label ] !== undefined;\n\n\tconst isValueSet = hasValue();\n\t// Notify the panel when an item's value has changed except for optional\n\t// items without value because the item should not cause itself to hide.\n\tuseEffect( () => {\n\t\tif ( ! isShownByDefault && ! isValueSet ) {\n\t\t\treturn;\n\t\t}\n\n\t\tflagItemCustomization( isValueSet, label, menuGroup );\n\t}, [\n\t\tisValueSet,\n\t\tmenuGroup,\n\t\tlabel,\n\t\tflagItemCustomization,\n\t\tisShownByDefault,\n\t] );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\t// We check whether this item is currently registered as items rendered\n\t\t// via fills can persist through the parent panel being remounted.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45673\n\t\tif ( ! isRegistered || isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && isValueSet && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisRegistered,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t\tonSelect,\n\t\tonDeselect,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst shouldApplyPlaceholderStyles =\n\t\t\tshouldRenderPlaceholder && ! isShown;\n\t\tconst firstItemStyle =\n\t\t\tfirstDisplayedItem === label && __experimentalFirstVisibleItemClass;\n\t\tconst lastItemStyle =\n\t\t\tlastDisplayedItem === label && __experimentalLastVisibleItemClass;\n\t\treturn cx(\n\t\t\tstyles.ToolsPanelItem,\n\t\t\tshouldApplyPlaceholderStyles && styles.ToolsPanelItemPlaceholder,\n\t\t\t! shouldApplyPlaceholderStyles && className,\n\t\t\tfirstItemStyle,\n\t\t\tlastItemStyle\n\t\t);\n\t}, [\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName,\n\t\tcx,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\tlabel,\n\t] );\n\n\treturn {\n\t\t...otherProps,\n\t\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BAA4B,IAAIpC,SAAS,EAC3CqC,cAAc,EACdC,aACD,CAAC;EACF,CAAC,EAAE,CACFL,OAAO,EACPf,uBAAuB,EACvBlB,SAAS,EACTkC,EAAE,EACFf,kBAAkB,EAClBC,iBAAiB,EACjBC,mCAAmC,EACnCC,kCAAkC,EAClCnB,KAAK,CACJ,CAAC;EAEH,OAAO;IACN,GAAGK,UAAU;IACbyB,OAAO;IACPf,uBAAuB;IACvBlB,SAAS,EAAEmC;EACZ,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["usePrevious","useCallback","useEffect","useLayoutEffect","useMemo","styles","useToolsPanelContext","useContextSystem","useCx","noop","useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","currentPanelId","menuItems","registerResetAllFilter","deregisterResetAllFilter","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","firstDisplayedItem","lastDisplayedItem","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","hasValueCallback","resetAllFilterCallback","previousPanelId","hasMatchingPanel","menuGroup","isMenuItemChecked","wasMenuItemChecked","isRegistered","undefined","isValueSet","isShown","cx","classes","shouldApplyPlaceholderStyles","firstItemStyle","lastItemStyle","ToolsPanelItem","ToolsPanelItemPlaceholder"],"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseMemo,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nconst noop = () => {};\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault = false,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter = noop,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t} = useToolsPanelContext();\n\n\t// hasValue is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\tconst hasValueCallback = useCallback( hasValue, [ panelId ] );\n\t// resetAllFilter is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [ panelId ] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\t//\n\t// This is performed in a layout effect to ensure that the panel item\n\t// is registered before it is rendered preventing a rendering glitch.\n\t// See: https://github.com/WordPress/gutenberg/issues/56470\n\tuseLayoutEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t] );\n\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel ) {\n\t\t\tregisterResetAllFilter( resetAllFilterCallback );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( hasMatchingPanel ) {\n\t\t\t\tderegisterResetAllFilter( resetAllFilterCallback );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tresetAllFilterCallback,\n\t\thasMatchingPanel,\n\t] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\tconst isRegistered = menuItems?.[ menuGroup ]?.[ label ] !== undefined;\n\n\tconst isValueSet = hasValue();\n\t// Notify the panel when an item's value has changed except for optional\n\t// items without value because the item should not cause itself to hide.\n\tuseEffect( () => {\n\t\tif ( ! isShownByDefault && ! isValueSet ) {\n\t\t\treturn;\n\t\t}\n\n\t\tflagItemCustomization( isValueSet, label, menuGroup );\n\t}, [\n\t\tisValueSet,\n\t\tmenuGroup,\n\t\tlabel,\n\t\tflagItemCustomization,\n\t\tisShownByDefault,\n\t] );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\t// We check whether this item is currently registered as items rendered\n\t\t// via fills can persist through the parent panel being remounted.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45673\n\t\tif ( ! isRegistered || isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && isValueSet && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisRegistered,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t\tonSelect,\n\t\tonDeselect,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst shouldApplyPlaceholderStyles =\n\t\t\tshouldRenderPlaceholder && ! isShown;\n\t\tconst firstItemStyle =\n\t\t\tfirstDisplayedItem === label && __experimentalFirstVisibleItemClass;\n\t\tconst lastItemStyle =\n\t\t\tlastDisplayedItem === label && __experimentalLastVisibleItemClass;\n\t\treturn cx(\n\t\t\tstyles.ToolsPanelItem,\n\t\t\tshouldApplyPlaceholderStyles && styles.ToolsPanelItemPlaceholder,\n\t\t\t! shouldApplyPlaceholderStyles && className,\n\t\t\tfirstItemStyle,\n\t\t\tlastItemStyle\n\t\t);\n\t}, [\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName,\n\t\tcx,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\tlabel,\n\t] );\n\n\treturn {\n\t\t...otherProps,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName: classes,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,oBAAoB;AAChD,SACCC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,O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nCC,kCAAkC,EAClCnB,KAAK,CACJ,CAAC;EAEH,OAAO;IACN,GAAGK,UAAU;IACbyB,OAAO;IACPf,uBAAuB;IACvBlB,SAAS,EAAEmC;EACZ,CAAC;AACF","ignoreList":[]}
@@ -46,9 +46,7 @@ const useKeyboardVisibility = () => {
46
46
  showListener.remove();
47
47
  hideListener.remove();
48
48
  };
49
- // Disable reason: deferring this refactor to the native team.
50
- // see https://github.com/WordPress/gutenberg/pull/41166
51
- // eslint-disable-next-line react-hooks/exhaustive-deps
49
+ // See https://github.com/WordPress/gutenberg/pull/41166
52
50
  }, []);
53
51
  return keyboardVisible;
54
52
  };
@@ -89,9 +87,7 @@ const Tooltip = ({
89
87
  });
90
88
  }
91
89
  return () => onHandleScreenTouch(null);
92
- // Disable reason: deferring this refactor to the native team.
93
- // see https://github.com/WordPress/gutenberg/pull/41166
94
- // eslint-disable-next-line react-hooks/exhaustive-deps
90
+ // See https://github.com/WordPress/gutenberg/pull/41166
95
91
  }, [visible]);
96
92
 
97
93
  // Manage visibility animation.
@@ -104,9 +100,7 @@ const Tooltip = ({
104
100
  setAnimating(true);
105
101
  startAnimation();
106
102
  }
107
- // Disable reason: deferring this refactor to the native team.
108
- // see https://github.com/WordPress/gutenberg/pull/41166
109
- // eslint-disable-next-line react-hooks/exhaustive-deps
103
+ // See https://github.com/WordPress/gutenberg/pull/41166
110
104
  }, [visible]);
111
105
 
112
106
  // Manage tooltip visibility and position in relation to keyboard.
@@ -125,9 +119,7 @@ const Tooltip = ({
125
119
  setAnimating(true);
126
120
  setVisible(false);
127
121
  }
128
- // Disable reason: deferring this refactor to the native team.
129
- // see https://github.com/WordPress/gutenberg/pull/41166
130
- // eslint-disable-next-line react-hooks/exhaustive-deps
122
+ // See https://github.com/WordPress/gutenberg/pull/41166
131
123
  }, [visible, keyboardVisible]);
132
124
 
133
125
  // Manage tooltip position during keyboard frame changes.
@@ -241,9 +233,7 @@ const TooltipSlot = ({
241
233
  setHandleScreenTouch(null);
242
234
  };
243
235
  // Memoize context value to avoid unnecessary rerenders of the Provider's children
244
- // Disable reason: deferring this refactor to the native team.
245
- // see https://github.com/WordPress/gutenberg/pull/41166
246
- // eslint-disable-next-line react-hooks/exhaustive-deps
236
+ // See https://github.com/WordPress/gutenberg/pull/41166
247
237
  const value = useMemo(() => ({
248
238
  onHandleScreenTouch
249
239
  }));
@@ -1 +1 @@
1
- {"version":3,"names":["Animated","Easing","Keyboard","Platform","StyleSheet","Text","View","cloneElement","createContext","useContext","useEffect","useMemo","useRef","useState","usePrevious","createSlotFill","styles","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","RIGHT_ALIGN_ARROW_OFFSET","TOOLTIP_VERTICAL_OFFSET","TooltipContext","onHandleScreenTouch","Fill","Slot","useKeyboardVisibility","keyboardVisible","setKeyboardVisible","previousKeyboardVisible","showListener","addListener","keyboardHideEvent","select","android","ios","hideListener","remove","Tooltip","children","position","text","visible","initialVisible","referenceElementRef","animationValue","Value","current","horizontalPosition","split","setVisible","animating","setAnimating","hidden","previousVisible","referenceLayout","setReferenceLayout","height","width","x","y","tooltipLayout","setTooltipLayout","startAnimation","getReferenceElementPosition","frameListener","timing","toValue","duration","useNativeDriver","delay","easing","out","quad","start","tooltipStyles","tooltip","left","Math","floor","top","tooltipBoxStyles","tooltip__box","elevation","opacity","shadowColor","tooltip__shadow","color","shadowOffset","shadowOpacity","shadowRadius","transform","translateY","interpolate","inputRange","outputRange","arrowStyles","tooltip__arrow","requestAnimationFrame","measure","_x","_y","pageX","pageY","getTooltipLayout","nativeEvent","layout","ref","onLayout","style","tooltip__text","TooltipSlot","rest","handleScreenTouch","setHandleScreenTouch","callback","handleTouchStart","value","Provider","onTouchStart","undefined","pointerEvents","absoluteFill","testID"],"sources":["@wordpress/components/src/tooltip/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tAnimated,\n\tEasing,\n\tKeyboard,\n\tPlatform,\n\tStyleSheet,\n\tText,\n\tView,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcloneElement,\n\tcreateContext,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { createSlotFill } from '../slot-fill';\nimport styles from './style.scss';\n\nconst RIGHT_ALIGN_ARROW_OFFSET = 16;\nconst TOOLTIP_VERTICAL_OFFSET = 2;\n\nconst TooltipContext = createContext( {\n\tonHandleScreenTouch: () => {},\n} );\nconst { Fill, Slot } = createSlotFill( 'Tooltip' );\n\nconst useKeyboardVisibility = () => {\n\tconst [ keyboardVisible, setKeyboardVisible ] = useState( false );\n\tconst previousKeyboardVisible = usePrevious( keyboardVisible );\n\n\tuseEffect( () => {\n\t\tconst showListener = Keyboard.addListener( 'keyboardDidShow', () => {\n\t\t\tif ( previousKeyboardVisible !== true ) {\n\t\t\t\tsetKeyboardVisible( true );\n\t\t\t}\n\t\t} );\n\t\tconst keyboardHideEvent = Platform.select( {\n\t\t\tandroid: 'keyboardDidHide',\n\t\t\tios: 'keyboardWillHide',\n\t\t} );\n\t\tconst hideListener = Keyboard.addListener( keyboardHideEvent, () => {\n\t\t\tif ( previousKeyboardVisible !== false ) {\n\t\t\t\tsetKeyboardVisible( false );\n\t\t\t}\n\t\t} );\n\t\treturn () => {\n\t\t\tshowListener.remove();\n\t\t\thideListener.remove();\n\t\t};\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\treturn keyboardVisible;\n};\n\nconst Tooltip = ( {\n\tchildren,\n\tposition = 'top',\n\ttext,\n\tvisible: initialVisible = false,\n} ) => {\n\tconst referenceElementRef = useRef( null );\n\tconst animationValue = useRef( new Animated.Value( 0 ) ).current;\n\tconst [ , horizontalPosition = 'center' ] = position.split( ' ' );\n\tconst [ visible, setVisible ] = useState( initialVisible );\n\tconst [ animating, setAnimating ] = useState( false );\n\tconst hidden = ! visible && ! animating;\n\tconst previousVisible = usePrevious( visible );\n\tconst [ referenceLayout, setReferenceLayout ] = useState( {\n\t\theight: 0,\n\t\twidth: 0,\n\t\tx: 0,\n\t\ty: 0,\n\t} );\n\tconst [ tooltipLayout, setTooltipLayout ] = useState( {\n\t\theight: 0,\n\t\twidth: 0,\n\t} );\n\tconst { onHandleScreenTouch } = useContext( TooltipContext );\n\tconst keyboardVisible = useKeyboardVisibility();\n\n\t// Register callback to dismiss the tooltip whenever the screen is touched.\n\tuseEffect( () => {\n\t\tif ( visible ) {\n\t\t\tonHandleScreenTouch( () => {\n\t\t\t\tsetAnimating( true );\n\t\t\t\tsetVisible( false );\n\t\t\t} );\n\t\t}\n\t\treturn () => onHandleScreenTouch( null );\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ visible ] );\n\n\t// Manage visibility animation.\n\tuseEffect( () => {\n\t\tif (\n\t\t\t// Initial render and visibility enabled, animate show.\n\t\t\t( typeof previousVisible === 'undefined' && visible ) ||\n\t\t\t// Previously visible, animate hide\n\t\t\t( previousVisible && previousVisible !== visible )\n\t\t) {\n\t\t\tsetAnimating( true );\n\t\t\tstartAnimation();\n\t\t}\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ visible ] );\n\n\t// Manage tooltip visibility and position in relation to keyboard.\n\tuseEffect( () => {\n\t\tif ( ! visible ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update tooltip position if keyboard is visible.\n\t\tif ( keyboardVisible ) {\n\t\t\tgetReferenceElementPosition();\n\t\t}\n\n\t\t// Hide tooltip if keyboard hides\n\t\tif ( typeof previousVisible !== 'undefined' && ! keyboardVisible ) {\n\t\t\tsetAnimating( true );\n\t\t\tsetVisible( false );\n\t\t}\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ visible, keyboardVisible ] );\n\n\t// Manage tooltip position during keyboard frame changes.\n\tuseEffect( () => {\n\t\tconst frameListener = Keyboard.addListener(\n\t\t\t'keyboardWillChangeFrame',\n\t\t\t() => {\n\t\t\t\tif ( visible ) {\n\t\t\t\t\tgetReferenceElementPosition();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn () => {\n\t\t\tframeListener.remove();\n\t\t};\n\t}, [ visible ] );\n\n\tconst startAnimation = () => {\n\t\tAnimated.timing( animationValue, {\n\t\t\ttoValue: visible ? 1 : 0,\n\t\t\tduration: visible ? 300 : 150,\n\t\t\tuseNativeDriver: true,\n\t\t\tdelay: visible ? 500 : 0,\n\t\t\teasing: Easing.out( Easing.quad ),\n\t\t} ).start( () => {\n\t\t\tsetAnimating( false );\n\t\t} );\n\t};\n\n\tconst tooltipStyles = [\n\t\tstyles.tooltip,\n\t\t{\n\t\t\tleft:\n\t\t\t\treferenceLayout.x +\n\t\t\t\tMath.floor( referenceLayout.width / 2 ) -\n\t\t\t\t( horizontalPosition === 'right'\n\t\t\t\t\t? RIGHT_ALIGN_ARROW_OFFSET\n\t\t\t\t\t: Math.floor( tooltipLayout.width / 2 ) ),\n\t\t\ttop:\n\t\t\t\treferenceLayout.y -\n\t\t\t\ttooltipLayout.height -\n\t\t\t\tTOOLTIP_VERTICAL_OFFSET,\n\t\t},\n\t];\n\tconst tooltipBoxStyles = [\n\t\tstyles.tooltip__box,\n\t\thorizontalPosition === 'right' && styles[ 'tooltip--rightAlign' ],\n\t\t{\n\t\t\televation: 2,\n\t\t\topacity: animationValue,\n\t\t\tshadowColor: styles.tooltip__shadow?.color,\n\t\t\tshadowOffset: { height: 2, width: 0 },\n\t\t\tshadowOpacity: 0.25,\n\t\t\tshadowRadius: 2,\n\t\t\ttransform: [\n\t\t\t\t{\n\t\t\t\t\ttranslateY: animationValue.interpolate( {\n\t\t\t\t\t\tinputRange: [ 0, 1 ],\n\t\t\t\t\t\toutputRange: [ visible ? 4 : -8, -8 ],\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t];\n\tconst arrowStyles = [\n\t\tstyles.tooltip__arrow,\n\t\thorizontalPosition === 'right' &&\n\t\t\tstyles[ 'tooltip__arrow--rightAlign' ],\n\t];\n\n\tconst getReferenceElementPosition = () => {\n\t\t// rAF allows render to complete before calculating layout\n\t\t// eslint-disable-next-line no-undef\n\t\trequestAnimationFrame( () => {\n\t\t\tif ( ! referenceElementRef.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treferenceElementRef.current.measure(\n\t\t\t\t( _x, _y, width, height, pageX, pageY ) => {\n\t\t\t\t\tsetReferenceLayout( {\n\t\t\t\t\t\theight,\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\tx: pageX,\n\t\t\t\t\t\ty: pageY,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t);\n\t\t} );\n\t};\n\tconst getTooltipLayout = ( { nativeEvent } ) => {\n\t\tconst { height, width } = nativeEvent.layout;\n\t\tsetTooltipLayout( { height, width } );\n\t};\n\n\tif ( hidden ) {\n\t\treturn children;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ cloneElement( children, {\n\t\t\t\tref: referenceElementRef,\n\t\t\t\tonLayout: getReferenceElementPosition,\n\t\t\t} ) }\n\t\t\t<Fill>\n\t\t\t\t<View onLayout={ getTooltipLayout } style={ tooltipStyles }>\n\t\t\t\t\t<Animated.View style={ tooltipBoxStyles }>\n\t\t\t\t\t\t<Text style={ styles.tooltip__text }>{ text }</Text>\n\t\t\t\t\t\t<View style={ arrowStyles } />\n\t\t\t\t\t</Animated.View>\n\t\t\t\t</View>\n\t\t\t</Fill>\n\t\t</>\n\t);\n};\n\nconst TooltipSlot = ( { children, ...rest } ) => {\n\tconst [ handleScreenTouch, setHandleScreenTouch ] = useState( null );\n\tconst onHandleScreenTouch = ( callback ) => {\n\t\t// Must use function to set state below as `callback` is a function itself.\n\t\tsetHandleScreenTouch( () => callback );\n\t};\n\tconst handleTouchStart = () => {\n\t\thandleScreenTouch();\n\t\tsetHandleScreenTouch( null );\n\t};\n\t// Memoize context value to avoid unnecessary rerenders of the Provider's children\n\t// Disable reason: deferring this refactor to the native team.\n\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst value = useMemo( () => ( { onHandleScreenTouch } ) );\n\n\treturn (\n\t\t<TooltipContext.Provider value={ value }>\n\t\t\t<View\n\t\t\t\tonTouchStart={\n\t\t\t\t\ttypeof handleScreenTouch === 'function'\n\t\t\t\t\t\t? handleTouchStart\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\tstyle={ StyleSheet.absoluteFill }\n\t\t\t\ttestID=\"tooltip-overlay\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t\t<Slot { ...rest } />\n\t\t\t</View>\n\t\t</TooltipContext.Provider>\n\t);\n};\n\nTooltip.Slot = TooltipSlot;\n\nexport default Tooltip;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,IAAI,EACJC,IAAI,QACE,cAAc;;AAErB;AACA;AACA;AACA,SACCC,YAAY,EACZC,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACF,oBAAoB;AAC3B,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASC,cAAc,QAAQ,cAAc;AAC7C,OAAOC,MAAM,MAAM,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAA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AAa,CAAE,CAAC;QAAA,CAChB;MAAC,CACX;IAAC,CACF,CAAC;EAAA,CACN,CAAC;AAEL,CAAC;AAED,MAAMe,WAAW,GAAGA,CAAE;EAAExE,QAAQ;EAAE,GAAGyE;AAAK,CAAC,KAAM;EAChD,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGxG,QAAQ,CAAE,IAAK,CAAC;EACpE,MAAMa,mBAAmB,GAAK4F,QAAQ,IAAM;IAC3C;IACAD,oBAAoB,CAAE,MAAMC,QAAS,CAAC;EACvC,CAAC;EACD,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC9BH,iBAAiB,CAAC,CAAC;IACnBC,oBAAoB,CAAE,IAAK,CAAC;EAC7B,CAAC;EACD;EACA;EACA;EACA;EACA,MAAMG,KAAK,GAAG7G,OAAO,CAAE,OAAQ;IAAEe;EAAoB,CAAC,CAAG,CAAC;EAE1D,oBACCR,IAAA,CAACO,cAAc,CAACgG,QAAQ;IAACD,KAAK,EAAGA,KAAO;IAAA9E,QAAA,eACvCtB,KAAA,CAACd,IAAI;MACJoH,YAAY,EACX,OAAON,iBAAiB,KAAK,UAAU,GACpCG,gBAAgB,GAChBI,SACH;MACDC,aAAa,EAAC,UAAU;MACxBZ,KAAK,EAAG5G,UAAU,CAACyH,YAAc;MACjCC,MAAM,EAAC,iBAAiB;MAAApF,QAAA,GAEtBA,QAAQ,eACVxB,IAAA,CAACU,IAAI;QAAA,GAAMuF;MAAI,CAAI,CAAC;IAAA,CACf;EAAC,CACiB,CAAC;AAE5B,CAAC;AAED1E,OAAO,CAACb,IAAI,GAAGsF,WAAW;AAE1B,eAAezE,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["Animated","Easing","Keyboard","Platform","StyleSheet","Text","View","cloneElement","createContext","useContext","useEffect","useMemo","useRef","useState","usePrevious","createSlotFill","styles","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","RIGHT_ALIGN_ARROW_OFFSET","TOOLTIP_VERTICAL_OFFSET","TooltipContext","onHandleScreenTouch","Fill","Slot","useKeyboardVisibility","keyboardVisible","setKeyboardVisible","previousKeyboardVisible","showListener","addListener","keyboardHideEvent","select","android","ios","hideListener","remove","Tooltip","children","position","text","visible","initialVisible","referenceElementRef","animationValue","Value","current","horizontalPosition","split","setVisible","animating","setAnimating","hidden","previousVisible","referenceLayout","setReferenceLayout","height","width","x","y","tooltipLayout","setTooltipLayout","startAnimation","getReferenceElementPosition","frameListener","timing","toValue","duration","useNativeDriver","delay","easing","out","quad","start","tooltipStyles","tooltip","left","Math","floor","top","tooltipBoxStyles","tooltip__box","elevation","opacity","shadowColor","tooltip__shadow","color","shadowOffset","shadowOpacity","shadowRadius","transform","translateY","interpolate","inputRange","outputRange","arrowStyles","tooltip__arrow","requestAnimationFrame","measure","_x","_y","pageX","pageY","getTooltipLayout","nativeEvent","layout","ref","onLayout","style","tooltip__text","TooltipSlot","rest","handleScreenTouch","setHandleScreenTouch","callback","handleTouchStart","value","Provider","onTouchStart","undefined","pointerEvents","absoluteFill","testID"],"sources":["@wordpress/components/src/tooltip/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tAnimated,\n\tEasing,\n\tKeyboard,\n\tPlatform,\n\tStyleSheet,\n\tText,\n\tView,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcloneElement,\n\tcreateContext,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { createSlotFill } from '../slot-fill';\nimport styles from './style.scss';\n\nconst RIGHT_ALIGN_ARROW_OFFSET = 16;\nconst TOOLTIP_VERTICAL_OFFSET = 2;\n\nconst TooltipContext = createContext( {\n\tonHandleScreenTouch: () => {},\n} );\nconst { Fill, Slot } = createSlotFill( 'Tooltip' );\n\nconst useKeyboardVisibility = () => {\n\tconst [ keyboardVisible, setKeyboardVisible ] = useState( false );\n\tconst previousKeyboardVisible = usePrevious( keyboardVisible );\n\n\tuseEffect( () => {\n\t\tconst showListener = Keyboard.addListener( 'keyboardDidShow', () => {\n\t\t\tif ( previousKeyboardVisible !== true ) {\n\t\t\t\tsetKeyboardVisible( true );\n\t\t\t}\n\t\t} );\n\t\tconst keyboardHideEvent = Platform.select( {\n\t\t\tandroid: 'keyboardDidHide',\n\t\t\tios: 'keyboardWillHide',\n\t\t} );\n\t\tconst hideListener = Keyboard.addListener( keyboardHideEvent, () => {\n\t\t\tif ( previousKeyboardVisible !== false ) {\n\t\t\t\tsetKeyboardVisible( false );\n\t\t\t}\n\t\t} );\n\t\treturn () => {\n\t\t\tshowListener.remove();\n\t\t\thideListener.remove();\n\t\t};\n\t\t// See https://github.com/WordPress/gutenberg/pull/41166\n\t}, [] );\n\n\treturn keyboardVisible;\n};\n\nconst Tooltip = ( {\n\tchildren,\n\tposition = 'top',\n\ttext,\n\tvisible: initialVisible = false,\n} ) => {\n\tconst referenceElementRef = useRef( null );\n\tconst animationValue = useRef( new Animated.Value( 0 ) ).current;\n\tconst [ , horizontalPosition = 'center' ] = position.split( ' ' );\n\tconst [ visible, setVisible ] = useState( initialVisible );\n\tconst [ animating, setAnimating ] = useState( false );\n\tconst hidden = ! visible && ! animating;\n\tconst previousVisible = usePrevious( visible );\n\tconst [ referenceLayout, setReferenceLayout ] = useState( {\n\t\theight: 0,\n\t\twidth: 0,\n\t\tx: 0,\n\t\ty: 0,\n\t} );\n\tconst [ tooltipLayout, setTooltipLayout ] = useState( {\n\t\theight: 0,\n\t\twidth: 0,\n\t} );\n\tconst { onHandleScreenTouch } = useContext( TooltipContext );\n\tconst keyboardVisible = useKeyboardVisibility();\n\n\t// Register callback to dismiss the tooltip whenever the screen is touched.\n\tuseEffect( () => {\n\t\tif ( visible ) {\n\t\t\tonHandleScreenTouch( () => {\n\t\t\t\tsetAnimating( true );\n\t\t\t\tsetVisible( false );\n\t\t\t} );\n\t\t}\n\t\treturn () => onHandleScreenTouch( null );\n\t\t// See https://github.com/WordPress/gutenberg/pull/41166\n\t}, [ visible ] );\n\n\t// Manage visibility animation.\n\tuseEffect( () => {\n\t\tif (\n\t\t\t// Initial render and visibility enabled, animate show.\n\t\t\t( typeof previousVisible === 'undefined' && visible ) ||\n\t\t\t// Previously visible, animate hide\n\t\t\t( previousVisible && previousVisible !== visible )\n\t\t) {\n\t\t\tsetAnimating( true );\n\t\t\tstartAnimation();\n\t\t}\n\t\t// See https://github.com/WordPress/gutenberg/pull/41166\n\t}, [ visible ] );\n\n\t// Manage tooltip visibility and position in relation to keyboard.\n\tuseEffect( () => {\n\t\tif ( ! visible ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update tooltip position if keyboard is visible.\n\t\tif ( keyboardVisible ) {\n\t\t\tgetReferenceElementPosition();\n\t\t}\n\n\t\t// Hide tooltip if keyboard hides\n\t\tif ( typeof previousVisible !== 'undefined' && ! keyboardVisible ) {\n\t\t\tsetAnimating( true );\n\t\t\tsetVisible( false );\n\t\t}\n\t\t// See https://github.com/WordPress/gutenberg/pull/41166\n\t}, [ visible, keyboardVisible ] );\n\n\t// Manage tooltip position during keyboard frame changes.\n\tuseEffect( () => {\n\t\tconst frameListener = Keyboard.addListener(\n\t\t\t'keyboardWillChangeFrame',\n\t\t\t() => {\n\t\t\t\tif ( visible ) {\n\t\t\t\t\tgetReferenceElementPosition();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn () => {\n\t\t\tframeListener.remove();\n\t\t};\n\t}, [ visible ] );\n\n\tconst startAnimation = () => {\n\t\tAnimated.timing( animationValue, {\n\t\t\ttoValue: visible ? 1 : 0,\n\t\t\tduration: visible ? 300 : 150,\n\t\t\tuseNativeDriver: true,\n\t\t\tdelay: visible ? 500 : 0,\n\t\t\teasing: Easing.out( Easing.quad ),\n\t\t} ).start( () => {\n\t\t\tsetAnimating( false );\n\t\t} );\n\t};\n\n\tconst tooltipStyles = [\n\t\tstyles.tooltip,\n\t\t{\n\t\t\tleft:\n\t\t\t\treferenceLayout.x +\n\t\t\t\tMath.floor( referenceLayout.width / 2 ) -\n\t\t\t\t( horizontalPosition === 'right'\n\t\t\t\t\t? RIGHT_ALIGN_ARROW_OFFSET\n\t\t\t\t\t: Math.floor( tooltipLayout.width / 2 ) ),\n\t\t\ttop:\n\t\t\t\treferenceLayout.y -\n\t\t\t\ttooltipLayout.height -\n\t\t\t\tTOOLTIP_VERTICAL_OFFSET,\n\t\t},\n\t];\n\tconst tooltipBoxStyles = [\n\t\tstyles.tooltip__box,\n\t\thorizontalPosition === 'right' && styles[ 'tooltip--rightAlign' ],\n\t\t{\n\t\t\televation: 2,\n\t\t\topacity: animationValue,\n\t\t\tshadowColor: styles.tooltip__shadow?.color,\n\t\t\tshadowOffset: { height: 2, width: 0 },\n\t\t\tshadowOpacity: 0.25,\n\t\t\tshadowRadius: 2,\n\t\t\ttransform: [\n\t\t\t\t{\n\t\t\t\t\ttranslateY: animationValue.interpolate( {\n\t\t\t\t\t\tinputRange: [ 0, 1 ],\n\t\t\t\t\t\toutputRange: [ visible ? 4 : -8, -8 ],\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t];\n\tconst arrowStyles = [\n\t\tstyles.tooltip__arrow,\n\t\thorizontalPosition === 'right' &&\n\t\t\tstyles[ 'tooltip__arrow--rightAlign' ],\n\t];\n\n\tconst getReferenceElementPosition = () => {\n\t\t// rAF allows render to complete before calculating layout\n\t\t// eslint-disable-next-line no-undef\n\t\trequestAnimationFrame( () => {\n\t\t\tif ( ! referenceElementRef.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treferenceElementRef.current.measure(\n\t\t\t\t( _x, _y, width, height, pageX, pageY ) => {\n\t\t\t\t\tsetReferenceLayout( {\n\t\t\t\t\t\theight,\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\tx: pageX,\n\t\t\t\t\t\ty: pageY,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t);\n\t\t} );\n\t};\n\tconst getTooltipLayout = ( { nativeEvent } ) => {\n\t\tconst { height, width } = nativeEvent.layout;\n\t\tsetTooltipLayout( { height, width } );\n\t};\n\n\tif ( hidden ) {\n\t\treturn children;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ cloneElement( children, {\n\t\t\t\tref: referenceElementRef,\n\t\t\t\tonLayout: getReferenceElementPosition,\n\t\t\t} ) }\n\t\t\t<Fill>\n\t\t\t\t<View onLayout={ getTooltipLayout } style={ tooltipStyles }>\n\t\t\t\t\t<Animated.View style={ tooltipBoxStyles }>\n\t\t\t\t\t\t<Text style={ styles.tooltip__text }>{ text }</Text>\n\t\t\t\t\t\t<View style={ arrowStyles } />\n\t\t\t\t\t</Animated.View>\n\t\t\t\t</View>\n\t\t\t</Fill>\n\t\t</>\n\t);\n};\n\nconst TooltipSlot = ( { children, ...rest } ) => {\n\tconst [ handleScreenTouch, setHandleScreenTouch ] = useState( null );\n\tconst onHandleScreenTouch = ( callback ) => {\n\t\t// Must use function to set state below as `callback` is a function itself.\n\t\tsetHandleScreenTouch( () => callback );\n\t};\n\tconst handleTouchStart = () => {\n\t\thandleScreenTouch();\n\t\tsetHandleScreenTouch( null );\n\t};\n\t// Memoize context value to avoid unnecessary rerenders of the Provider's children\n\t// See https://github.com/WordPress/gutenberg/pull/41166\n\tconst value = useMemo( () => ( { onHandleScreenTouch } ) );\n\n\treturn (\n\t\t<TooltipContext.Provider value={ value }>\n\t\t\t<View\n\t\t\t\tonTouchStart={\n\t\t\t\t\ttypeof handleScreenTouch === 'function'\n\t\t\t\t\t\t? handleTouchStart\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\tstyle={ StyleSheet.absoluteFill }\n\t\t\t\ttestID=\"tooltip-overlay\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t\t<Slot { ...rest } />\n\t\t\t</View>\n\t\t</TooltipContext.Provider>\n\t);\n};\n\nTooltip.Sl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AAc;MACjCC,MAAM,EAAC,iBAAiB;MAAApF,QAAA,GAEtBA,QAAQ,eACVxB,IAAA,CAACU,IAAI;QAAA,GAAMuF;MAAI,CAAI,CAAC;IAAA,CACf;EAAC,CACiB,CAAC;AAE5B,CAAC;AAED1E,OAAO,CAACb,IAAI,GAAGsF,WAAW;AAE1B,eAAezE,OAAO","ignoreList":[]}
@@ -40,10 +40,8 @@ function UnitControl({
40
40
  if (pickerRef?.current) {
41
41
  pickerRef.current.presentPicker();
42
42
  }
43
- // Disable reason: this should be fixed by the native team.
44
- // It would be great if this could be done in the context of
43
+ // It would be great if the deps could be addressed in the context of
45
44
  // https://github.com/WordPress/gutenberg/pull/39218
46
- // eslint-disable-next-line react-hooks/exhaustive-deps
47
45
  }, [pickerRef?.current]);
48
46
  const currentInputValue = currentInput === null ? value : currentInput;
49
47
  const initialControlValue = isFinite(currentInputValue) ? currentInputValue : initialPosition;
@@ -72,10 +70,8 @@ function UnitControl({
72
70
  return unitButton;
73
71
  }, [onPickerPresent, accessibilityLabel, accessibilityHint, unitButtonTextStyle, unit, units]);
74
72
  const getAnchor = useCallback(() => anchorNodeRef?.current ? findNodeHandle(anchorNodeRef?.current) : undefined,
75
- // Disable reason: this should be fixed by the native team.
76
- // It would be great if this could be done in the context of
73
+ // It would be great if the deps could be addressed in the context of
77
74
  // https://github.com/WordPress/gutenberg/pull/39218
78
- // eslint-disable-next-line react-hooks/exhaustive-deps
79
75
  [anchorNodeRef?.current]);
80
76
  const getDecimal = step => {
81
77
  // Return the decimal offset based on the step size.
@@ -1 +1 @@
1
- {"version":3,"names":["Text","View","TouchableWithoutFeedback","Platform","findNodeHandle","RangeCell","StepperCell","Picker","styles","CSS_UNITS","hasUnits","getAccessibleLabelForUnit","useRef","useCallback","useMemo","memo","withPreferredColorScheme","__","sprintf","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","UnitControl","currentInput","label","value","onChange","onUnitChange","initialPosition","min","max","separatorType","units","unit","getStylesFromColorScheme","props","pickerRef","anchorNodeRef","onPickerPresent","current","presentPicker","currentInputValue","initialControlValue","isFinite","unitButtonTextStyle","unitButtonText","unitButtonTextDark","accessibilityLabel","accessibilityHint","OS","renderUnitButton","unitButton","style","children","length","onPress","accessibilityRole","getAnchor","undefined","getDecimal","step","stepToString","splitStep","toString","split","renderUnitPicker","unitMenu","ref","options","hideCancelButton","leftAlign","_activeUnit$step","activeUnit","find","option","decimalNum","defaultValue","shouldDisplayTextInput","openUnitPicker","unitLabel","minimumValue","maximumValue","useCustomUnits"],"sources":["@wordpress/components/src/unit-control/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tText,\n\tView,\n\tTouchableWithoutFeedback,\n\tPlatform,\n\tfindNodeHandle,\n} from 'react-native';\n\n/**\n * Internal dependencies\n */\nimport RangeCell from '../mobile/bottom-sheet/range-cell';\nimport StepperCell from '../mobile/bottom-sheet/stepper-cell';\nimport Picker from '../mobile/picker';\nimport styles from './style.scss';\nimport { CSS_UNITS, hasUnits, getAccessibleLabelForUnit } from './utils';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useCallback, useMemo, memo } from '@wordpress/element';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\n\nfunction UnitControl( {\n\tcurrentInput,\n\tlabel,\n\tvalue,\n\tonChange,\n\tonUnitChange,\n\tinitialPosition,\n\tmin,\n\tmax,\n\tseparatorType,\n\tunits = CSS_UNITS,\n\tunit,\n\tgetStylesFromColorScheme,\n\t...props\n} ) {\n\tconst pickerRef = useRef();\n\tconst anchorNodeRef = useRef();\n\n\tconst onPickerPresent = useCallback( () => {\n\t\tif ( pickerRef?.current ) {\n\t\t\tpickerRef.current.presentPicker();\n\t\t}\n\t\t// Disable reason: this should be fixed by the native team.\n\t\t// It would be great if this could be done in the context of\n\t\t// https://github.com/WordPress/gutenberg/pull/39218\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ pickerRef?.current ] );\n\n\tconst currentInputValue = currentInput === null ? value : currentInput;\n\tconst initialControlValue = isFinite( currentInputValue )\n\t\t? currentInputValue\n\t\t: initialPosition;\n\n\tconst unitButtonTextStyle = getStylesFromColorScheme(\n\t\tstyles.unitButtonText,\n\t\tstyles.unitButtonTextDark\n\t);\n\n\t/* translators: accessibility text. Inform about current unit value. %s: Current unit value. */\n\tconst accessibilityLabel = sprintf( __( 'Current unit is %s' ), unit );\n\n\tconst accessibilityHint =\n\t\tPlatform.OS === 'ios'\n\t\t\t? __( 'Double tap to open Action Sheet with available options' )\n\t\t\t: __( 'Double tap to open Bottom Sheet with available options' );\n\n\tconst renderUnitButton = useMemo( () => {\n\t\tconst unitButton = (\n\t\t\t<View style={ styles.unitButton }>\n\t\t\t\t<Text style={ unitButtonTextStyle }>{ unit }</Text>\n\t\t\t</View>\n\t\t);\n\n\t\tif ( hasUnits( units ) && units?.length > 1 ) {\n\t\t\treturn (\n\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\tonPress={ onPickerPresent }\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t>\n\t\t\t\t\t{ unitButton }\n\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t);\n\t\t}\n\n\t\treturn unitButton;\n\t}, [\n\t\tonPickerPresent,\n\t\taccessibilityLabel,\n\t\taccessibilityHint,\n\t\tunitButtonTextStyle,\n\t\tunit,\n\t\tunits,\n\t] );\n\n\tconst getAnchor = useCallback(\n\t\t() =>\n\t\t\tanchorNodeRef?.current\n\t\t\t\t? findNodeHandle( anchorNodeRef?.current )\n\t\t\t\t: undefined,\n\t\t// Disable reason: this should be fixed by the native team.\n\t\t// It would be great if this could be done in the context of\n\t\t// https://github.com/WordPress/gutenberg/pull/39218\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ anchorNodeRef?.current ]\n\t);\n\n\tconst getDecimal = ( step ) => {\n\t\t// Return the decimal offset based on the step size.\n\t\t// if step size is 0.1 we expect the offset to be 1.\n\t\t// for example 12 + 0.1 we would expect the see 12.1 (not 12.10 or 12 );\n\t\t// steps are defined in the CSS_UNITS and they vary from unit to unit.\n\t\tconst stepToString = step;\n\t\tconst splitStep = stepToString.toString().split( '.' );\n\t\treturn splitStep[ 1 ] ? splitStep[ 1 ].length : 0;\n\t};\n\n\tconst renderUnitPicker = useCallback( () => {\n\t\t// Keeping for legacy reasons, although `false` should not be a valid\n\t\t// value for the `units` prop anymore.\n\t\tif ( units === false ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<View style={ styles.unitMenu } ref={ anchorNodeRef }>\n\t\t\t\t{ renderUnitButton }\n\t\t\t\t{ hasUnits( units ) && units?.length > 1 ? (\n\t\t\t\t\t<Picker\n\t\t\t\t\t\tref={ pickerRef }\n\t\t\t\t\t\toptions={ units }\n\t\t\t\t\t\tonChange={ onUnitChange }\n\t\t\t\t\t\thideCancelButton\n\t\t\t\t\t\tleftAlign\n\t\t\t\t\t\tgetAnchor={ getAnchor }\n\t\t\t\t\t/>\n\t\t\t\t) : null }\n\t\t\t</View>\n\t\t);\n\t}, [ pickerRef, units, onUnitChange, getAnchor, renderUnitButton ] );\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\tconst decimalNum = getDecimal( step );\n\n\treturn (\n\t\t<>\n\t\t\t{ unit !== '%' ? (\n\t\t\t\t<StepperCell\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tmax={ max }\n\t\t\t\t\tmin={ min }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tseparatorType={ separatorType }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tstep={ step }\n\t\t\t\t\tdefaultValue={ initialControlValue }\n\t\t\t\t\tshouldDisplayTextInput\n\t\t\t\t\tdecimalNum={ decimalNum }\n\t\t\t\t\topenUnitPicker={ onPickerPresent }\n\t\t\t\t\tunitLabel={ getAccessibleLabelForUnit( unit ) }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ renderUnitPicker() }\n\t\t\t\t</StepperCell>\n\t\t\t) : (\n\t\t\t\t<RangeCell\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tminimumValue={ min }\n\t\t\t\t\tmaximumValue={ max }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tstep={ step }\n\t\t\t\t\tunit={ unit }\n\t\t\t\t\tdefaultValue={ initialControlValue }\n\t\t\t\t\tseparatorType={ separatorType }\n\t\t\t\t\tdecimalNum={ decimalNum }\n\t\t\t\t\topenUnitPicker={ onPickerPresent }\n\t\t\t\t\tunitLabel={ getAccessibleLabelForUnit( unit ) }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ renderUnitPicker() }\n\t\t\t\t</RangeCell>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport { useCustomUnits } from './utils';\nexport default memo( withPreferredColorScheme( UnitControl ) );\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,IAAI,EACJC,IAAI,EACJC,wBAAwB,EACxBC,QAAQ,EACRC,cAAc,QACR,cAAc;;AAErB;AACA;AACA;AACA,OAAOC,SAAS,MAAM,mCAAmC;AACzD,OAAOC,WAAW,MAAM,qCAAqC;AAC7D,OAAOC,MAAM,MAAM,kBAAkB;AACrC,OAAOC,MAAM,MAAM,cAAc;AACjC,SAASC,SAAS,EAAEC,QAAQ,EAAEC,yBAAyB,QAAQ,SAAS;;AAExE;AACA;AACA;AACA,SAASC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,IAAI,QAAQ,oBAAoB;AACvE,SAASC,wBAAwB,QAAQ,oBAAoB;A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AAU,EAAGA,UAAY;MACzBG,cAAc,EAAGxC,eAAiB;MAClCyC,SAAS,EAAGvE,yBAAyB,CAAEyB,IAAK,CAAG;MAAA,GAC1CE,KAAK;MAAAkB,QAAA,EAERY,gBAAgB,CAAC;IAAC,CACR,CAAC,gBAEdhD,IAAA,CAACf,SAAS;MACTsB,KAAK,EAAGA,KAAO;MACfE,QAAQ,EAAGA,QAAU;MACrBsD,YAAY,EAAGnD,GAAK;MACpBoD,YAAY,EAAGnD,GAAK;MACpBL,KAAK,EAAGA,KAAO;MACfmC,IAAI,EAAGA,IAAM;MACb3B,IAAI,EAAGA,IAAM;MACb2C,YAAY,EAAGlC,mBAAqB;MACpCX,aAAa,EAAGA,aAAe;MAC/B4C,UAAU,EAAGA,UAAY;MACzBG,cAAc,EAAGxC,eAAiB;MAClCyC,SAAS,EAAGvE,yBAAyB,CAAEyB,IAAK,CAAG;MAAA,GAC1CE,KAAK;MAAAkB,QAAA,EAERY,gBAAgB,CAAC;IAAC,CACV;EACX,CACA,CAAC;AAEL;AAEA,SAASiB,cAAc,QAAQ,SAAS;AACxC,eAAetE,IAAI,CAAEC,wBAAwB,CAAES,WAAY,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Text","View","TouchableWithoutFeedback","Platform","findNodeHandle","RangeCell","StepperCell","Picker","styles","CSS_UNITS","hasUnits","getAccessibleLabelForUnit","useRef","useCallback","useMemo","memo","withPreferredColorScheme","__","sprintf","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","UnitControl","currentInput","label","value","onChange","onUnitChange","initialPosition","min","max","separatorType","units","unit","getStylesFromColorScheme","props","pickerRef","anchorNodeRef","onPickerPresent","current","presentPicker","currentInputValue","initialControlValue","isFinite","unitButtonTextStyle","unitButtonText","unitButtonTextDark","accessibilityLabel","accessibilityHint","OS","renderUnitButton","unitButton","style","children","length","onPress","accessibilityRole","getAnchor","undefined","getDecimal","step","stepToString","splitStep","toString","split","renderUnitPicker","unitMenu","ref","options","hideCancelButton","leftAlign","_activeUnit$step","activeUnit","find","option","decimalNum","defaultValue","shouldDisplayTextInput","openUnitPicker","unitLabel","minimumValue","maximumValue","useCustomUnits"],"sources":["@wordpress/components/src/unit-control/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tText,\n\tView,\n\tTouchableWithoutFeedback,\n\tPlatform,\n\tfindNodeHandle,\n} from 'react-native';\n\n/**\n * Internal dependencies\n */\nimport RangeCell from '../mobile/bottom-sheet/range-cell';\nimport StepperCell from '../mobile/bottom-sheet/stepper-cell';\nimport Picker from '../mobile/picker';\nimport styles from './style.scss';\nimport { CSS_UNITS, hasUnits, getAccessibleLabelForUnit } from './utils';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useCallback, useMemo, memo } from '@wordpress/element';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\n\nfunction UnitControl( {\n\tcurrentInput,\n\tlabel,\n\tvalue,\n\tonChange,\n\tonUnitChange,\n\tinitialPosition,\n\tmin,\n\tmax,\n\tseparatorType,\n\tunits = CSS_UNITS,\n\tunit,\n\tgetStylesFromColorScheme,\n\t...props\n} ) {\n\tconst pickerRef = useRef();\n\tconst anchorNodeRef = useRef();\n\n\tconst onPickerPresent = useCallback( () => {\n\t\tif ( pickerRef?.current ) {\n\t\t\tpickerRef.current.presentPicker();\n\t\t}\n\t\t// It would be great if the deps could be addressed in the context of\n\t\t// https://github.com/WordPress/gutenberg/pull/39218\n\t}, [ pickerRef?.current ] );\n\n\tconst currentInputValue = currentInput === null ? value : currentInput;\n\tconst initialControlValue = isFinite( currentInputValue )\n\t\t? currentInputValue\n\t\t: initialPosition;\n\n\tconst unitButtonTextStyle = getStylesFromColorScheme(\n\t\tstyles.unitButtonText,\n\t\tstyles.unitButtonTextDark\n\t);\n\n\t/* translators: accessibility text. Inform about current unit value. %s: Current unit value. */\n\tconst accessibilityLabel = sprintf( __( 'Current unit is %s' ), unit );\n\n\tconst accessibilityHint =\n\t\tPlatform.OS === 'ios'\n\t\t\t? __( 'Double tap to open Action Sheet with available options' )\n\t\t\t: __( 'Double tap to open Bottom Sheet with available options' );\n\n\tconst renderUnitButton = useMemo( () => {\n\t\tconst unitButton = (\n\t\t\t<View style={ styles.unitButton }>\n\t\t\t\t<Text style={ unitButtonTextStyle }>{ unit }</Text>\n\t\t\t</View>\n\t\t);\n\n\t\tif ( hasUnits( units ) && units?.length > 1 ) {\n\t\t\treturn (\n\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\tonPress={ onPickerPresent }\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t>\n\t\t\t\t\t{ unitButton }\n\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t);\n\t\t}\n\n\t\treturn unitButton;\n\t}, [\n\t\tonPickerPresent,\n\t\taccessibilityLabel,\n\t\taccessibilityHint,\n\t\tunitButtonTextStyle,\n\t\tunit,\n\t\tunits,\n\t] );\n\n\tconst getAnchor = useCallback(\n\t\t() =>\n\t\t\tanchorNodeRef?.current\n\t\t\t\t? findNodeHandle( anchorNodeRef?.current )\n\t\t\t\t: undefined,\n\t\t// It would be great if the deps could be addressed in the context of\n\t\t// https://github.com/WordPress/gutenberg/pull/39218\n\t\t[ anchorNodeRef?.current ]\n\t);\n\n\tconst getDecimal = ( step ) => {\n\t\t// Return the decimal offset based on the step size.\n\t\t// if step size is 0.1 we expect the offset to be 1.\n\t\t// for example 12 + 0.1 we would expect the see 12.1 (not 12.10 or 12 );\n\t\t// steps are defined in the CSS_UNITS and they vary from unit to unit.\n\t\tconst stepToString = step;\n\t\tconst splitStep = stepToString.toString().split( '.' );\n\t\treturn splitStep[ 1 ] ? splitStep[ 1 ].length : 0;\n\t};\n\n\tconst renderUnitPicker = useCallback( () => {\n\t\t// Keeping for legacy reasons, although `false` should not be a valid\n\t\t// value for the `units` prop anymore.\n\t\tif ( units === false ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<View style={ styles.unitMenu } ref={ anchorNodeRef }>\n\t\t\t\t{ renderUnitButton }\n\t\t\t\t{ hasUnits( units ) && units?.length > 1 ? (\n\t\t\t\t\t<Picker\n\t\t\t\t\t\tref={ pickerRef }\n\t\t\t\t\t\toptions={ units }\n\t\t\t\t\t\tonChange={ onUnitChange }\n\t\t\t\t\t\thideCancelButton\n\t\t\t\t\t\tleftAlign\n\t\t\t\t\t\tgetAnchor={ getAnchor }\n\t\t\t\t\t/>\n\t\t\t\t) : null }\n\t\t\t</View>\n\t\t);\n\t}, [ pickerRef, units, onUnitChange, getAnchor, renderUnitButton ] );\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\tconst decimalNum = getDecimal( step );\n\n\treturn (\n\t\t<>\n\t\t\t{ unit !== '%' ? (\n\t\t\t\t<StepperCell\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tmax={ max }\n\t\t\t\t\tmin={ min }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tseparatorType={ separatorType }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tstep={ step }\n\t\t\t\t\tdefaultValue={ initialControlValue }\n\t\t\t\t\tshouldDisplayTextInput\n\t\t\t\t\tdecimalNum={ decimalNum }\n\t\t\t\t\topenUnitPicker={ onPickerPresent }\n\t\t\t\t\tunitLabel={ getAccessibleLabelForUnit( unit ) }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ renderUnitPicker() }\n\t\t\t\t</StepperCell>\n\t\t\t) : (\n\t\t\t\t<RangeCell\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tminimumValue={ min }\n\t\t\t\t\tmaximumValue={ max }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tstep={ step }\n\t\t\t\t\tunit={ unit }\n\t\t\t\t\tdefaultValue={ initialControlValue }\n\t\t\t\t\tseparatorType={ separatorType }\n\t\t\t\t\tdecimalNum={ decimalNum }\n\t\t\t\t\topenUnitPicker={ onPickerPresent }\n\t\t\t\t\tunitLabel={ getAccessibleLabelForUnit( unit ) }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ renderUnitPicker() }\n\t\t\t\t</RangeCell>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport { useCustomUnits } from './utils';\nexport default memo( withPreferredColorScheme( UnitControl ) );\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,IAAI,EACJC,IAAI,EACJC,wBAAwB,EACxBC,QAAQ,EACRC,cAAc,QACR,cAAc;;AAErB;AACA;AACA;AACA,OAAOC,SAAS,MAAM,mCAAmC;AACzD,OAAOC,WAAW,MAAM,qCAAqC;AAC7D,OAAOC,MAAM,MAAM,kBAAkB;AACrC,OAAOC,MAAM,MAAM,cAAc;AACjC,SAASC,SAAS,EAAEC,QAAQ,EAAEC,yBAAyB,QAAQ,SAAS;;AAExE;AACA;AACA;AACA,SAASC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,IAAI,QAAQ,oBAAoB;AACvE,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE9C,SAASC,WAAWA,CAAE;EACrBC,YAAY;EACZC,KAAK;EACLC,KAAK;EACLC,QAAQ;EACRC,YAAY;EACZC,eAAe;EACfC,GAAG;EACHC,GAAG;EACHC,aAAa;EACbC,KAAK,GAAG1B,SAAS;EACjB2B,IAAI;EACJC,wBAAwB;EACxB,GAAGC;AACJ,CAA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B,IAAI,EAAGA,IAAM;MACb2C,YAAY,EAAGlC,mBAAqB;MACpCX,aAAa,EAAGA,aAAe;MAC/B4C,UAAU,EAAGA,UAAY;MACzBG,cAAc,EAAGxC,eAAiB;MAClCyC,SAAS,EAAGvE,yBAAyB,CAAEyB,IAAK,CAAG;MAAA,GAC1CE,KAAK;MAAAkB,QAAA,EAERY,gBAAgB,CAAC;IAAC,CACV;EACX,CACA,CAAC;AAEL;AAEA,SAASiB,cAAc,QAAQ,SAAS;AACxC,eAAetE,IAAI,CAAEC,wBAAwB,CAAES,WAAY,CAAE,CAAC","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import deprecated from '@wordpress/deprecated';
5
+ export function maybeWarnDeprecated36pxSize({
6
+ componentName,
7
+ __next40pxDefaultSize,
8
+ size
9
+ }) {
10
+ if (__next40pxDefaultSize || size !== undefined && size !== 'default') {
11
+ return;
12
+ }
13
+ deprecated(`36px default size for wp.components.${componentName}`, {
14
+ since: '6.8',
15
+ version: '7.1',
16
+ hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.'
17
+ });
18
+ }
19
+ //# sourceMappingURL=deprecated-36px-size.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["deprecated","maybeWarnDeprecated36pxSize","componentName","__next40pxDefaultSize","size","undefined","since","version","hint"],"sources":["@wordpress/components/src/utils/deprecated-36px-size.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\nexport function maybeWarnDeprecated36pxSize( {\n\tcomponentName,\n\t__next40pxDefaultSize,\n\tsize,\n}: {\n\tcomponentName: string;\n\t__next40pxDefaultSize: boolean | undefined;\n\tsize: string | undefined;\n} ) {\n\tif (\n\t\t__next40pxDefaultSize ||\n\t\t( size !== undefined && size !== 'default' )\n\t) {\n\t\treturn;\n\t}\n\n\tdeprecated( `36px default size for wp.components.${ componentName }`, {\n\t\tsince: '6.8',\n\t\tversion: '7.1',\n\t\thint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.',\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,uBAAuB;AAE9C,OAAO,SAASC,2BAA2BA,CAAE;EAC5CC,aAAa;EACbC,qBAAqB;EACrBC;AAKD,CAAC,EAAG;EACH,IACCD,qBAAqB,IACnBC,IAAI,KAAKC,SAAS,IAAID,IAAI,KAAK,SAAW,EAC3C;IACD;EACD;EAEAJ,UAAU,CAAE,uCAAwCE,aAAa,EAAG,EAAE;IACrEI,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE,KAAK;IACdC,IAAI,EAAE;EACP,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -88,11 +88,13 @@ const POLL_RATE = 100;
88
88
  * to measure again after a frame, and if that fails, it will poll every 100
89
89
  * milliseconds until it succeeds.
90
90
  */
91
- export function useTrackElementOffsetRect(targetElement) {
91
+ export function useTrackElementOffsetRect(targetElement, deps = []) {
92
92
  const [indicatorPosition, setIndicatorPosition] = useState(NULL_ELEMENT_OFFSET_RECT);
93
93
  const intervalRef = useRef();
94
94
  const measure = useEvent(() => {
95
- if (targetElement) {
95
+ // Check that the targetElement is still attached to the DOM, in case
96
+ // it was removed since the last `measure` call.
97
+ if (targetElement && targetElement.isConnected) {
96
98
  const elementOffsetRect = getElementOffsetRect(targetElement);
97
99
  if (elementOffsetRect) {
98
100
  setIndicatorPosition(elementOffsetRect);
@@ -119,6 +121,15 @@ export function useTrackElementOffsetRect(targetElement) {
119
121
  setIndicatorPosition(NULL_ELEMENT_OFFSET_RECT);
120
122
  }
121
123
  }, [setElement, targetElement]);
124
+
125
+ // Escape hatch to force a remeasurement when something else changes rather
126
+ // than the target elements' ref or size (for example, the target element
127
+ // can change its position within the tablist).
128
+ useLayoutEffect(() => {
129
+ measure();
130
+ // `measure` is a stable function, so it's safe to omit it from the deps array.
131
+ // deps can't be statically analyzed by ESLint
132
+ }, deps);
122
133
  return indicatorPosition;
123
134
  }
124
135