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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (895) hide show
  1. package/CHANGELOG.md +68 -1
  2. package/CONTRIBUTING.md +3 -54
  3. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
  4. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  5. package/build/angle-picker-control/index.js +10 -0
  6. package/build/angle-picker-control/index.js.map +1 -1
  7. package/build/autocomplete/autocompleter-ui.js +3 -3
  8. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  9. package/build/border-box-control/border-box-control/component.js +10 -7
  10. package/build/border-box-control/border-box-control/component.js.map +1 -1
  11. package/build/border-box-control/border-box-control-linked-button/component.js +1 -2
  12. package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  13. package/build/border-box-control/border-box-control-split-controls/component.js +10 -7
  14. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  15. package/build/border-box-control/styles.js +7 -7
  16. package/build/border-box-control/styles.js.map +1 -1
  17. package/build/border-control/border-control-dropdown/component.js +2 -1
  18. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  19. package/build/box-control/linked-button.js +3 -3
  20. package/build/box-control/linked-button.js.map +1 -1
  21. package/build/card/styles.js +17 -17
  22. package/build/card/styles.js.map +1 -1
  23. package/build/checkbox-control/index.js +3 -3
  24. package/build/checkbox-control/index.js.map +1 -1
  25. package/build/color-palette/index.js +1 -1
  26. package/build/color-palette/index.js.map +1 -1
  27. package/build/color-picker/input-with-slider.js +2 -1
  28. package/build/color-picker/input-with-slider.js.map +1 -1
  29. package/build/combobox-control/index.js +1 -1
  30. package/build/combobox-control/index.js.map +1 -1
  31. package/build/custom-gradient-picker/index.js +1 -1
  32. package/build/custom-gradient-picker/index.js.map +1 -1
  33. package/build/date-time/date/index.js +1 -1
  34. package/build/date-time/date/index.js.map +1 -1
  35. package/build/date-time/time/timezone.js +1 -1
  36. package/build/date-time/time/timezone.js.map +1 -1
  37. package/build/disabled/index.js +14 -6
  38. package/build/disabled/index.js.map +1 -1
  39. package/build/disabled/styles/disabled-styles.js +8 -18
  40. package/build/disabled/styles/disabled-styles.js.map +1 -1
  41. package/build/drop-zone/index.js +44 -9
  42. package/build/drop-zone/index.js.map +1 -1
  43. package/build/drop-zone/provider.js.map +1 -1
  44. package/build/drop-zone/types.js +6 -0
  45. package/build/drop-zone/types.js.map +1 -0
  46. package/build/dropdown/index.js +11 -4
  47. package/build/dropdown/index.js.map +1 -1
  48. package/build/flex/flex/hook.js +6 -30
  49. package/build/flex/flex/hook.js.map +1 -1
  50. package/build/focal-point-picker/controls.js +10 -5
  51. package/build/focal-point-picker/controls.js.map +1 -1
  52. package/build/focal-point-picker/focal-point.js.map +1 -1
  53. package/build/focal-point-picker/grid.js.map +1 -1
  54. package/build/focal-point-picker/index.js +83 -16
  55. package/build/focal-point-picker/index.js.map +1 -1
  56. package/build/focal-point-picker/media.js +4 -0
  57. package/build/focal-point-picker/media.js.map +1 -1
  58. package/build/focal-point-picker/styles/focal-point-picker-style.js +70 -41
  59. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  60. package/build/focal-point-picker/styles/focal-point-style.js +12 -12
  61. package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
  62. package/build/focal-point-picker/types.js +6 -0
  63. package/build/focal-point-picker/types.js.map +1 -0
  64. package/build/focal-point-picker/utils.js +6 -6
  65. package/build/focal-point-picker/utils.js.map +1 -1
  66. package/build/font-size-picker/index.js +11 -0
  67. package/build/font-size-picker/index.js.map +1 -1
  68. package/build/font-size-picker/utils.js +1 -1
  69. package/build/font-size-picker/utils.js.map +1 -1
  70. package/build/form-file-upload/index.js +22 -2
  71. package/build/form-file-upload/index.js.map +1 -1
  72. package/build/form-file-upload/types.js +6 -0
  73. package/build/form-file-upload/types.js.map +1 -0
  74. package/build/form-toggle/index.js +1 -3
  75. package/build/form-toggle/index.js.map +1 -1
  76. package/build/form-token-field/index.js +4 -6
  77. package/build/form-token-field/index.js.map +1 -1
  78. package/build/form-token-field/suggestions-list.js +1 -3
  79. package/build/form-token-field/suggestions-list.js.map +1 -1
  80. package/build/gradient-picker/index.js +25 -26
  81. package/build/gradient-picker/index.js.map +1 -1
  82. package/build/icon/index.js +1 -2
  83. package/build/icon/index.js.map +1 -1
  84. package/build/input-control/input-base.js +3 -2
  85. package/build/input-control/input-base.js.map +1 -1
  86. package/build/input-control/label.js +2 -2
  87. package/build/input-control/label.js.map +1 -1
  88. package/build/input-control/styles/input-control-styles.js +41 -128
  89. package/build/input-control/styles/input-control-styles.js.map +1 -1
  90. package/build/modal/aria-helper.js +3 -10
  91. package/build/modal/aria-helper.js.map +1 -1
  92. package/build/navigable-container/container.js +5 -1
  93. package/build/navigable-container/container.js.map +1 -1
  94. package/build/navigable-container/menu.js +10 -12
  95. package/build/navigable-container/menu.js.map +1 -1
  96. package/build/navigable-container/tabbable.js +2 -4
  97. package/build/navigable-container/tabbable.js.map +1 -1
  98. package/build/navigation/menu/menu-title-search.js +2 -1
  99. package/build/navigation/menu/menu-title-search.js.map +1 -1
  100. package/build/navigation/menu/use-navigation-tree-menu.js +2 -1
  101. package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  102. package/build/navigator/navigator-button/hook.js +1 -1
  103. package/build/navigator/navigator-button/hook.js.map +1 -1
  104. package/build/navigator/navigator-screen/component.js +2 -2
  105. package/build/navigator/navigator-screen/component.js.map +1 -1
  106. package/build/number-control/index.js +29 -25
  107. package/build/number-control/index.js.map +1 -1
  108. package/build/number-control/types.js +6 -0
  109. package/build/number-control/types.js.map +1 -0
  110. package/build/placeholder/index.js +1 -3
  111. package/build/placeholder/index.js.map +1 -1
  112. package/build/popover/index.js +190 -160
  113. package/build/popover/index.js.map +1 -1
  114. package/build/popover/types.js +6 -0
  115. package/build/popover/types.js.map +1 -0
  116. package/build/popover/utils.js +125 -24
  117. package/build/popover/utils.js.map +1 -1
  118. package/build/radio-control/index.js +7 -4
  119. package/build/radio-control/index.js.map +1 -1
  120. package/build/range-control/index.js +4 -1
  121. package/build/range-control/index.js.map +1 -1
  122. package/build/range-control/styles/range-control-styles.js +33 -33
  123. package/build/range-control/styles/range-control-styles.js.map +1 -1
  124. package/build/sandbox/index.js +2 -2
  125. package/build/sandbox/index.js.map +1 -1
  126. package/build/search-control/index.js +38 -10
  127. package/build/search-control/index.js.map +1 -1
  128. package/build/search-control/types.js +6 -0
  129. package/build/search-control/types.js.map +1 -0
  130. package/build/select-control/index.native.js +2 -1
  131. package/build/select-control/index.native.js.map +1 -1
  132. package/build/tab-panel/index.js +48 -9
  133. package/build/tab-panel/index.js.map +1 -1
  134. package/build/tab-panel/types.js +6 -0
  135. package/build/tab-panel/types.js.map +1 -0
  136. package/build/text-control/index.js +2 -0
  137. package/build/text-control/index.js.map +1 -1
  138. package/build/textarea-control/index.js +3 -3
  139. package/build/textarea-control/index.js.map +1 -1
  140. package/build/toggle-control/index.js +44 -4
  141. package/build/toggle-control/index.js.map +1 -1
  142. package/build/toggle-control/types.js +6 -0
  143. package/build/toggle-control/types.js.map +1 -0
  144. package/build/toggle-group-control/toggle-group-control/component.js +2 -2
  145. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  146. package/build/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  147. package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  148. package/build/tooltip/index.js +9 -7
  149. package/build/tooltip/index.js.map +1 -1
  150. package/build/ui/context/context-connect.js +31 -22
  151. package/build/ui/context/context-connect.js.map +1 -1
  152. package/build/ui/context/context-system-provider.js +4 -3
  153. package/build/ui/context/context-system-provider.js.map +1 -1
  154. package/build/unit-control/index.js +1 -1
  155. package/build/unit-control/index.js.map +1 -1
  156. package/build/unit-control/styles/unit-control-styles.js +9 -9
  157. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  158. package/build/utils/colors-values.js +2 -30
  159. package/build/utils/colors-values.js.map +1 -1
  160. package/build/utils/math.js +4 -4
  161. package/build/utils/math.js.map +1 -1
  162. package/build/utils/values.js +62 -6
  163. package/build/utils/values.js.map +1 -1
  164. package/build/view/component.js +6 -7
  165. package/build/view/component.js.map +1 -1
  166. package/build/view/types.js +6 -0
  167. package/build/view/types.js.map +1 -0
  168. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
  169. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  170. package/build-module/angle-picker-control/index.js +9 -0
  171. package/build-module/angle-picker-control/index.js.map +1 -1
  172. package/build-module/autocomplete/autocompleter-ui.js +4 -4
  173. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  174. package/build-module/border-box-control/border-box-control/component.js +11 -8
  175. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  176. package/build-module/border-box-control/border-box-control-linked-button/component.js +1 -2
  177. package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  178. package/build-module/border-box-control/border-box-control-split-controls/component.js +11 -8
  179. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  180. package/build-module/border-box-control/styles.js +7 -7
  181. package/build-module/border-box-control/styles.js.map +1 -1
  182. package/build-module/border-control/border-control-dropdown/component.js +2 -1
  183. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  184. package/build-module/box-control/linked-button.js +3 -3
  185. package/build-module/box-control/linked-button.js.map +1 -1
  186. package/build-module/card/styles.js +17 -17
  187. package/build-module/card/styles.js.map +1 -1
  188. package/build-module/checkbox-control/index.js +3 -3
  189. package/build-module/checkbox-control/index.js.map +1 -1
  190. package/build-module/color-palette/index.js +1 -1
  191. package/build-module/color-palette/index.js.map +1 -1
  192. package/build-module/color-picker/input-with-slider.js +2 -1
  193. package/build-module/color-picker/input-with-slider.js.map +1 -1
  194. package/build-module/combobox-control/index.js +1 -1
  195. package/build-module/combobox-control/index.js.map +1 -1
  196. package/build-module/custom-gradient-picker/index.js +1 -1
  197. package/build-module/custom-gradient-picker/index.js.map +1 -1
  198. package/build-module/date-time/date/index.js +2 -3
  199. package/build-module/date-time/date/index.js.map +1 -1
  200. package/build-module/date-time/time/timezone.js +1 -1
  201. package/build-module/date-time/time/timezone.js.map +1 -1
  202. package/build-module/disabled/index.js +16 -8
  203. package/build-module/disabled/index.js.map +1 -1
  204. package/build-module/disabled/styles/disabled-styles.js +6 -12
  205. package/build-module/disabled/styles/disabled-styles.js.map +1 -1
  206. package/build-module/drop-zone/index.js +40 -9
  207. package/build-module/drop-zone/index.js.map +1 -1
  208. package/build-module/drop-zone/provider.js.map +1 -1
  209. package/build-module/drop-zone/types.js +2 -0
  210. package/build-module/drop-zone/types.js.map +1 -0
  211. package/build-module/dropdown/index.js +10 -4
  212. package/build-module/dropdown/index.js.map +1 -1
  213. package/build-module/flex/flex/hook.js +7 -29
  214. package/build-module/flex/flex/hook.js.map +1 -1
  215. package/build-module/focal-point-picker/controls.js +11 -6
  216. package/build-module/focal-point-picker/controls.js.map +1 -1
  217. package/build-module/focal-point-picker/focal-point.js.map +1 -1
  218. package/build-module/focal-point-picker/grid.js.map +1 -1
  219. package/build-module/focal-point-picker/index.js +81 -16
  220. package/build-module/focal-point-picker/index.js.map +1 -1
  221. package/build-module/focal-point-picker/media.js +4 -0
  222. package/build-module/focal-point-picker/media.js.map +1 -1
  223. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +68 -40
  224. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  225. package/build-module/focal-point-picker/styles/focal-point-style.js +12 -12
  226. package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
  227. package/build-module/focal-point-picker/types.js +2 -0
  228. package/build-module/focal-point-picker/types.js.map +1 -0
  229. package/build-module/focal-point-picker/utils.js +6 -6
  230. package/build-module/focal-point-picker/utils.js.map +1 -1
  231. package/build-module/font-size-picker/index.js +10 -0
  232. package/build-module/font-size-picker/index.js.map +1 -1
  233. package/build-module/font-size-picker/utils.js +1 -1
  234. package/build-module/font-size-picker/utils.js.map +1 -1
  235. package/build-module/form-file-upload/index.js +21 -4
  236. package/build-module/form-file-upload/index.js.map +1 -1
  237. package/build-module/form-file-upload/types.js +2 -0
  238. package/build-module/form-file-upload/types.js.map +1 -0
  239. package/build-module/form-toggle/index.js +1 -3
  240. package/build-module/form-toggle/index.js.map +1 -1
  241. package/build-module/form-token-field/index.js +4 -5
  242. package/build-module/form-token-field/index.js.map +1 -1
  243. package/build-module/form-token-field/suggestions-list.js +1 -2
  244. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  245. package/build-module/gradient-picker/index.js +25 -26
  246. package/build-module/gradient-picker/index.js.map +1 -1
  247. package/build-module/icon/index.js +1 -2
  248. package/build-module/icon/index.js.map +1 -1
  249. package/build-module/input-control/input-base.js +4 -3
  250. package/build-module/input-control/input-base.js.map +1 -1
  251. package/build-module/input-control/label.js +3 -3
  252. package/build-module/input-control/label.js.map +1 -1
  253. package/build-module/input-control/styles/input-control-styles.js +41 -127
  254. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  255. package/build-module/modal/aria-helper.js +3 -8
  256. package/build-module/modal/aria-helper.js.map +1 -1
  257. package/build-module/navigable-container/container.js +5 -1
  258. package/build-module/navigable-container/container.js.map +1 -1
  259. package/build-module/navigable-container/menu.js +10 -11
  260. package/build-module/navigable-container/menu.js.map +1 -1
  261. package/build-module/navigable-container/tabbable.js +2 -3
  262. package/build-module/navigable-container/tabbable.js.map +1 -1
  263. package/build-module/navigation/menu/menu-title-search.js +2 -1
  264. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  265. package/build-module/navigation/menu/use-navigation-tree-menu.js +2 -1
  266. package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  267. package/build-module/navigator/navigator-button/hook.js +1 -1
  268. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  269. package/build-module/navigator/navigator-screen/component.js +2 -2
  270. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  271. package/build-module/number-control/index.js +31 -23
  272. package/build-module/number-control/index.js.map +1 -1
  273. package/build-module/number-control/types.js +2 -0
  274. package/build-module/number-control/types.js.map +1 -0
  275. package/build-module/placeholder/index.js +1 -3
  276. package/build-module/placeholder/index.js.map +1 -1
  277. package/build-module/popover/index.js +192 -162
  278. package/build-module/popover/index.js.map +1 -1
  279. package/build-module/popover/types.js +2 -0
  280. package/build-module/popover/types.js.map +1 -0
  281. package/build-module/popover/utils.js +118 -23
  282. package/build-module/popover/utils.js.map +1 -1
  283. package/build-module/radio-control/index.js +7 -5
  284. package/build-module/radio-control/index.js.map +1 -1
  285. package/build-module/range-control/index.js +4 -1
  286. package/build-module/range-control/index.js.map +1 -1
  287. package/build-module/range-control/styles/range-control-styles.js +33 -33
  288. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  289. package/build-module/sandbox/index.js +2 -2
  290. package/build-module/sandbox/index.js.map +1 -1
  291. package/build-module/search-control/index.js +34 -7
  292. package/build-module/search-control/index.js.map +1 -1
  293. package/build-module/search-control/types.js +2 -0
  294. package/build-module/search-control/types.js.map +1 -0
  295. package/build-module/select-control/index.native.js +1 -1
  296. package/build-module/select-control/index.native.js.map +1 -1
  297. package/build-module/tab-panel/index.js +46 -10
  298. package/build-module/tab-panel/index.js.map +1 -1
  299. package/build-module/tab-panel/types.js +2 -0
  300. package/build-module/tab-panel/types.js.map +1 -0
  301. package/build-module/text-control/index.js +2 -0
  302. package/build-module/text-control/index.js.map +1 -1
  303. package/build-module/textarea-control/index.js +3 -3
  304. package/build-module/textarea-control/index.js.map +1 -1
  305. package/build-module/toggle-control/index.js +38 -4
  306. package/build-module/toggle-control/index.js.map +1 -1
  307. package/build-module/toggle-control/types.js +2 -0
  308. package/build-module/toggle-control/types.js.map +1 -0
  309. package/build-module/toggle-group-control/toggle-group-control/component.js +2 -2
  310. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  311. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  312. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  313. package/build-module/tooltip/index.js +10 -8
  314. package/build-module/tooltip/index.js.map +1 -1
  315. package/build-module/ui/context/context-connect.js +30 -23
  316. package/build-module/ui/context/context-connect.js.map +1 -1
  317. package/build-module/ui/context/context-system-provider.js +5 -4
  318. package/build-module/ui/context/context-system-provider.js.map +1 -1
  319. package/build-module/unit-control/index.js +1 -1
  320. package/build-module/unit-control/index.js.map +1 -1
  321. package/build-module/unit-control/styles/unit-control-styles.js +9 -9
  322. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  323. package/build-module/utils/colors-values.js +2 -30
  324. package/build-module/utils/colors-values.js.map +1 -1
  325. package/build-module/utils/math.js +4 -4
  326. package/build-module/utils/math.js.map +1 -1
  327. package/build-module/utils/values.js +48 -6
  328. package/build-module/utils/values.js.map +1 -1
  329. package/build-module/view/component.js +5 -8
  330. package/build-module/view/component.js.map +1 -1
  331. package/build-module/view/types.js +2 -0
  332. package/build-module/view/types.js.map +1 -0
  333. package/build-style/style-rtl.css +4 -31
  334. package/build-style/style.css +4 -31
  335. package/build-types/base-field/hook.d.ts +54 -55
  336. package/build-types/base-field/hook.d.ts.map +1 -1
  337. package/build-types/border-box-control/border-box-control/component.d.ts +10 -2
  338. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  339. package/build-types/border-box-control/border-box-control/hook.d.ts +56 -57
  340. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  341. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts +2 -1
  342. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  343. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +55 -56
  344. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  345. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +9 -2
  346. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  347. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +56 -57
  348. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  349. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts +2 -1
  350. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
  351. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +55 -56
  352. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  353. package/build-types/border-box-control/styles.d.ts.map +1 -1
  354. package/build-types/border-box-control/types.d.ts +5 -4
  355. package/build-types/border-box-control/types.d.ts.map +1 -1
  356. package/build-types/border-control/border-control/component.d.ts +14 -2
  357. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  358. package/build-types/border-control/border-control/hook.d.ts +56 -57
  359. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  360. package/build-types/border-control/border-control-dropdown/component.d.ts +10 -2
  361. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  362. package/build-types/border-control/border-control-dropdown/hook.d.ts +56 -57
  363. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  364. package/build-types/border-control/border-control-style-picker/component.d.ts +6 -2
  365. package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
  366. package/build-types/border-control/border-control-style-picker/hook.d.ts +55 -56
  367. package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -1
  368. package/build-types/border-control/stories/index.d.ts +74 -6
  369. package/build-types/border-control/stories/index.d.ts.map +1 -1
  370. package/build-types/border-control/types.d.ts +6 -8
  371. package/build-types/border-control/types.d.ts.map +1 -1
  372. package/build-types/button-group/index.d.ts +1 -3
  373. package/build-types/button-group/index.d.ts.map +1 -1
  374. package/build-types/card/card/component.d.ts +9 -2
  375. package/build-types/card/card/component.d.ts.map +1 -1
  376. package/build-types/card/card/hook.d.ts +55 -56
  377. package/build-types/card/card/hook.d.ts.map +1 -1
  378. package/build-types/card/card-body/component.d.ts +9 -2
  379. package/build-types/card/card-body/component.d.ts.map +1 -1
  380. package/build-types/card/card-body/hook.d.ts +55 -56
  381. package/build-types/card/card-body/hook.d.ts.map +1 -1
  382. package/build-types/card/card-divider/component.d.ts +7 -2
  383. package/build-types/card/card-divider/component.d.ts.map +1 -1
  384. package/build-types/card/card-divider/hook.d.ts +55 -55
  385. package/build-types/card/card-footer/component.d.ts +11 -2
  386. package/build-types/card/card-footer/component.d.ts.map +1 -1
  387. package/build-types/card/card-footer/hook.d.ts +55 -56
  388. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  389. package/build-types/card/card-header/component.d.ts +1 -1
  390. package/build-types/card/card-header/component.d.ts.map +1 -1
  391. package/build-types/card/card-header/hook.d.ts +55 -56
  392. package/build-types/card/card-header/hook.d.ts.map +1 -1
  393. package/build-types/card/card-media/component.d.ts +2 -1
  394. package/build-types/card/card-media/component.d.ts.map +1 -1
  395. package/build-types/card/card-media/hook.d.ts +55 -56
  396. package/build-types/card/card-media/hook.d.ts.map +1 -1
  397. package/build-types/checkbox-control/index.d.ts +1 -1
  398. package/build-types/checkbox-control/index.d.ts.map +1 -1
  399. package/build-types/checkbox-control/stories/index.d.ts.map +1 -1
  400. package/build-types/checkbox-control/types.d.ts +1 -1
  401. package/build-types/checkbox-control/types.d.ts.map +1 -1
  402. package/build-types/color-indicator/index.d.ts +1 -3
  403. package/build-types/color-indicator/index.d.ts.map +1 -1
  404. package/build-types/color-palette/styles.d.ts +1 -3
  405. package/build-types/color-palette/styles.d.ts.map +1 -1
  406. package/build-types/color-picker/component.d.ts +2 -1
  407. package/build-types/color-picker/component.d.ts.map +1 -1
  408. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  409. package/build-types/color-picker/styles.d.ts +12 -25
  410. package/build-types/color-picker/styles.d.ts.map +1 -1
  411. package/build-types/confirm-dialog/component.d.ts +4 -8
  412. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  413. package/build-types/date-time/date/styles.d.ts +4 -8
  414. package/build-types/date-time/date/styles.d.ts.map +1 -1
  415. package/build-types/date-time/date-time/styles.d.ts +4 -6
  416. package/build-types/date-time/date-time/styles.d.ts.map +1 -1
  417. package/build-types/date-time/time/styles.d.ts +21 -43
  418. package/build-types/date-time/time/styles.d.ts.map +1 -1
  419. package/build-types/disabled/index.d.ts +1 -1
  420. package/build-types/disabled/index.d.ts.map +1 -1
  421. package/build-types/disabled/styles/disabled-styles.d.ts +1 -5
  422. package/build-types/disabled/styles/disabled-styles.d.ts.map +1 -1
  423. package/build-types/divider/component.d.ts +7 -2
  424. package/build-types/divider/component.d.ts.map +1 -1
  425. package/build-types/drop-zone/index.d.ts +29 -0
  426. package/build-types/drop-zone/index.d.ts.map +1 -0
  427. package/build-types/drop-zone/provider.d.ts +5 -0
  428. package/build-types/drop-zone/provider.d.ts.map +1 -0
  429. package/build-types/drop-zone/stories/index.d.ts +12 -0
  430. package/build-types/drop-zone/stories/index.d.ts.map +1 -0
  431. package/build-types/drop-zone/types.d.ts +29 -0
  432. package/build-types/drop-zone/types.d.ts.map +1 -0
  433. package/build-types/dropdown/dropdown-content-wrapper.d.ts +2 -1
  434. package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -1
  435. package/build-types/dropdown/index.d.ts.map +1 -1
  436. package/build-types/elevation/component.d.ts +2 -1
  437. package/build-types/elevation/component.d.ts.map +1 -1
  438. package/build-types/elevation/hook.d.ts +54 -55
  439. package/build-types/elevation/hook.d.ts.map +1 -1
  440. package/build-types/external-link/index.d.ts +1 -1
  441. package/build-types/external-link/index.d.ts.map +1 -1
  442. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  443. package/build-types/flex/flex/component.d.ts +2 -1
  444. package/build-types/flex/flex/component.d.ts.map +1 -1
  445. package/build-types/flex/flex/hook.d.ts +55 -56
  446. package/build-types/flex/flex/hook.d.ts.map +1 -1
  447. package/build-types/flex/flex-block/component.d.ts +2 -1
  448. package/build-types/flex/flex-block/component.d.ts.map +1 -1
  449. package/build-types/flex/flex-block/hook.d.ts +55 -56
  450. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  451. package/build-types/flex/flex-item/component.d.ts +2 -1
  452. package/build-types/flex/flex-item/component.d.ts.map +1 -1
  453. package/build-types/flex/flex-item/hook.d.ts +55 -56
  454. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  455. package/build-types/focal-point-picker/controls.d.ts +4 -0
  456. package/build-types/focal-point-picker/controls.d.ts.map +1 -0
  457. package/build-types/focal-point-picker/focal-point.d.ts +5 -0
  458. package/build-types/focal-point-picker/focal-point.d.ts.map +1 -0
  459. package/build-types/focal-point-picker/grid.d.ts +5 -0
  460. package/build-types/focal-point-picker/grid.d.ts.map +1 -0
  461. package/build-types/focal-point-picker/index.d.ts +51 -0
  462. package/build-types/focal-point-picker/index.d.ts.map +1 -0
  463. package/build-types/focal-point-picker/media.d.ts +4 -0
  464. package/build-types/focal-point-picker/media.d.ts.map +1 -0
  465. package/build-types/focal-point-picker/stories/index.d.ts +15 -0
  466. package/build-types/focal-point-picker/stories/index.d.ts.map +1 -0
  467. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +56 -0
  468. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -0
  469. package/build-types/focal-point-picker/styles/focal-point-style.d.ts +19 -0
  470. package/build-types/focal-point-picker/styles/focal-point-style.d.ts.map +1 -0
  471. package/build-types/focal-point-picker/types.d.ts +79 -0
  472. package/build-types/focal-point-picker/types.d.ts.map +1 -0
  473. package/build-types/focal-point-picker/utils.d.ts +26 -0
  474. package/build-types/focal-point-picker/utils.d.ts.map +1 -0
  475. package/build-types/form-file-upload/index.d.ts +22 -0
  476. package/build-types/form-file-upload/index.d.ts.map +1 -0
  477. package/build-types/form-file-upload/stories/index.d.ts +23 -0
  478. package/build-types/form-file-upload/stories/index.d.ts.map +1 -0
  479. package/build-types/form-file-upload/test/index.d.ts +2 -0
  480. package/build-types/form-file-upload/test/index.d.ts.map +1 -0
  481. package/build-types/form-file-upload/types.d.ts +63 -0
  482. package/build-types/form-file-upload/types.d.ts.map +1 -0
  483. package/build-types/form-toggle/index.d.ts +1 -1
  484. package/build-types/form-toggle/index.d.ts.map +1 -1
  485. package/build-types/form-token-field/index.d.ts.map +1 -1
  486. package/build-types/form-token-field/styles.d.ts +1 -3
  487. package/build-types/form-token-field/styles.d.ts.map +1 -1
  488. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  489. package/build-types/form-token-field/token-input.d.ts +1 -3
  490. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  491. package/build-types/grid/component.d.ts +2 -1
  492. package/build-types/grid/component.d.ts.map +1 -1
  493. package/build-types/grid/hook.d.ts +55 -56
  494. package/build-types/grid/hook.d.ts.map +1 -1
  495. package/build-types/h-stack/component.d.ts +5 -2
  496. package/build-types/h-stack/component.d.ts.map +1 -1
  497. package/build-types/h-stack/hook.d.ts +55 -56
  498. package/build-types/h-stack/hook.d.ts.map +1 -1
  499. package/build-types/heading/component.d.ts +4 -2
  500. package/build-types/heading/component.d.ts.map +1 -1
  501. package/build-types/heading/hook.d.ts +54 -55
  502. package/build-types/heading/hook.d.ts.map +1 -1
  503. package/build-types/input-control/index.d.ts +1 -1
  504. package/build-types/input-control/index.d.ts.map +1 -1
  505. package/build-types/input-control/input-base.d.ts.map +1 -1
  506. package/build-types/input-control/input-field.d.ts +1 -3
  507. package/build-types/input-control/input-field.d.ts.map +1 -1
  508. package/build-types/input-control/input-prefix-wrapper.d.ts +2 -1
  509. package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -1
  510. package/build-types/input-control/input-suffix-wrapper.d.ts +2 -1
  511. package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -1
  512. package/build-types/input-control/label.d.ts.map +1 -1
  513. package/build-types/input-control/stories/index.d.ts +5 -5
  514. package/build-types/input-control/stories/index.d.ts.map +1 -1
  515. package/build-types/input-control/styles/input-control-styles.d.ts +2 -6
  516. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  517. package/build-types/input-control/types.d.ts +3 -0
  518. package/build-types/input-control/types.d.ts.map +1 -1
  519. package/build-types/item-group/item/component.d.ts +2 -1
  520. package/build-types/item-group/item/component.d.ts.map +1 -1
  521. package/build-types/item-group/item/hook.d.ts +54 -55
  522. package/build-types/item-group/item/hook.d.ts.map +1 -1
  523. package/build-types/item-group/item-group/component.d.ts +2 -1
  524. package/build-types/item-group/item-group/component.d.ts.map +1 -1
  525. package/build-types/item-group/item-group/hook.d.ts +54 -55
  526. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  527. package/build-types/modal/aria-helper.d.ts.map +1 -1
  528. package/build-types/navigable-container/menu.d.ts.map +1 -1
  529. package/build-types/navigable-container/tabbable.d.ts.map +1 -1
  530. package/build-types/navigator/navigator-back-button/component.d.ts +4 -2
  531. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  532. package/build-types/navigator/navigator-back-button/hook.d.ts +59 -60
  533. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  534. package/build-types/navigator/navigator-button/component.d.ts +7 -2
  535. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  536. package/build-types/navigator/navigator-button/hook.d.ts +59 -60
  537. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  538. package/build-types/navigator/navigator-provider/component.d.ts +2 -1
  539. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  540. package/build-types/navigator/navigator-screen/component.d.ts +1 -1
  541. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  542. package/build-types/number-control/index.d.ts +10 -28
  543. package/build-types/number-control/index.d.ts.map +1 -1
  544. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  545. package/build-types/number-control/types.d.ts +72 -0
  546. package/build-types/number-control/types.d.ts.map +1 -0
  547. package/build-types/placeholder/index.d.ts +1 -1
  548. package/build-types/placeholder/index.d.ts.map +1 -1
  549. package/build-types/popover/index.d.ts +28 -24
  550. package/build-types/popover/index.d.ts.map +1 -1
  551. package/build-types/popover/stories/index.d.ts +12 -0
  552. package/build-types/popover/stories/index.d.ts.map +1 -0
  553. package/build-types/popover/types.d.ts +179 -0
  554. package/build-types/popover/types.d.ts.map +1 -0
  555. package/build-types/popover/utils.d.ts +42 -24
  556. package/build-types/popover/utils.d.ts.map +1 -1
  557. package/build-types/radio-control/index.d.ts +1 -1
  558. package/build-types/radio-control/index.d.ts.map +1 -1
  559. package/build-types/range-control/index.d.ts +2 -4
  560. package/build-types/range-control/index.d.ts.map +1 -1
  561. package/build-types/range-control/input-range.d.ts +2 -4
  562. package/build-types/range-control/input-range.d.ts.map +1 -1
  563. package/build-types/range-control/styles/range-control-styles.d.ts +5 -10
  564. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  565. package/build-types/resizable-box/index.d.ts +1 -1
  566. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  567. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  568. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -3
  569. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  570. package/build-types/scrollable/component.d.ts +2 -1
  571. package/build-types/scrollable/component.d.ts.map +1 -1
  572. package/build-types/scrollable/hook.d.ts +55 -56
  573. package/build-types/scrollable/hook.d.ts.map +1 -1
  574. package/build-types/search-control/index.d.ts +29 -0
  575. package/build-types/search-control/index.d.ts.map +1 -0
  576. package/build-types/search-control/stories/index.d.ts +47 -0
  577. package/build-types/search-control/stories/index.d.ts.map +1 -0
  578. package/build-types/search-control/types.d.ts +39 -0
  579. package/build-types/search-control/types.d.ts.map +1 -0
  580. package/build-types/select-control/index.d.ts +1 -3
  581. package/build-types/select-control/index.d.ts.map +1 -1
  582. package/build-types/select-control/stories/index.d.ts +2 -6
  583. package/build-types/select-control/stories/index.d.ts.map +1 -1
  584. package/build-types/select-control/styles/select-control-styles.d.ts +1 -3
  585. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  586. package/build-types/spacer/component.d.ts +2 -1
  587. package/build-types/spacer/component.d.ts.map +1 -1
  588. package/build-types/spacer/hook.d.ts +55 -56
  589. package/build-types/spacer/hook.d.ts.map +1 -1
  590. package/build-types/spinner/index.d.ts +1 -3
  591. package/build-types/spinner/index.d.ts.map +1 -1
  592. package/build-types/surface/component.d.ts +2 -1
  593. package/build-types/surface/component.d.ts.map +1 -1
  594. package/build-types/surface/hook.d.ts +55 -56
  595. package/build-types/surface/hook.d.ts.map +1 -1
  596. package/build-types/tab-panel/index.d.ts +42 -0
  597. package/build-types/tab-panel/index.d.ts.map +1 -0
  598. package/build-types/tab-panel/stories/index.d.ts +12 -0
  599. package/build-types/tab-panel/stories/index.d.ts.map +1 -0
  600. package/build-types/tab-panel/test/index.d.ts +2 -0
  601. package/build-types/tab-panel/test/index.d.ts.map +1 -0
  602. package/build-types/tab-panel/types.d.ts +64 -0
  603. package/build-types/tab-panel/types.d.ts.map +1 -0
  604. package/build-types/text/component.d.ts +1 -1
  605. package/build-types/text/component.d.ts.map +1 -1
  606. package/build-types/text/hook.d.ts +55 -56
  607. package/build-types/text/hook.d.ts.map +1 -1
  608. package/build-types/text-control/index.d.ts +2 -4
  609. package/build-types/text-control/index.d.ts.map +1 -1
  610. package/build-types/text-control/types.d.ts +1 -1
  611. package/build-types/text-control/types.d.ts.map +1 -1
  612. package/build-types/textarea-control/index.d.ts +1 -1
  613. package/build-types/textarea-control/index.d.ts.map +1 -1
  614. package/build-types/textarea-control/types.d.ts +1 -1
  615. package/build-types/textarea-control/types.d.ts.map +1 -1
  616. package/build-types/toggle-control/index.d.ts +26 -0
  617. package/build-types/toggle-control/index.d.ts.map +1 -0
  618. package/build-types/toggle-control/stories/index.d.ts +13 -0
  619. package/build-types/toggle-control/stories/index.d.ts.map +1 -0
  620. package/build-types/toggle-control/test/index.d.ts +2 -0
  621. package/build-types/toggle-control/test/index.d.ts.map +1 -0
  622. package/build-types/toggle-control/types.d.ts +20 -0
  623. package/build-types/toggle-control/types.d.ts.map +1 -0
  624. package/build-types/toggle-group-control/stories/index.d.ts +4 -2
  625. package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
  626. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +12 -2
  627. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  628. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +2 -4
  629. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  630. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +2 -1
  631. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  632. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +3 -5
  633. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  634. package/build-types/toggle-group-control/types.d.ts +2 -2
  635. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  636. package/build-types/tools-panel/tools-panel/component.d.ts +2 -1
  637. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  638. package/build-types/tools-panel/tools-panel/hook.d.ts +55 -56
  639. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  640. package/build-types/tools-panel/tools-panel-header/component.d.ts +2 -1
  641. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  642. package/build-types/tools-panel/tools-panel-header/hook.d.ts +55 -56
  643. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  644. package/build-types/tools-panel/tools-panel-item/component.d.ts +6 -2
  645. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  646. package/build-types/tools-panel/tools-panel-item/hook.d.ts +55 -56
  647. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  648. package/build-types/tooltip/index.d.ts.map +1 -1
  649. package/build-types/truncate/component.d.ts +2 -1
  650. package/build-types/truncate/component.d.ts.map +1 -1
  651. package/build-types/truncate/hook.d.ts +55 -56
  652. package/build-types/truncate/hook.d.ts.map +1 -1
  653. package/build-types/ui/context/context-connect.d.ts +10 -9
  654. package/build-types/ui/context/context-connect.d.ts.map +1 -1
  655. package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
  656. package/build-types/ui/context/test/context-connect.d.ts +2 -0
  657. package/build-types/ui/context/test/context-connect.d.ts.map +1 -0
  658. package/build-types/ui/context/test/wordpress-component.d.ts +2 -0
  659. package/build-types/ui/context/test/wordpress-component.d.ts.map +1 -0
  660. package/build-types/ui/context/wordpress-component.d.ts +8 -9
  661. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  662. package/build-types/ui/control-group/component.d.ts +4 -1
  663. package/build-types/ui/control-group/component.d.ts.map +1 -1
  664. package/build-types/ui/control-group/hook.d.ts +55 -56
  665. package/build-types/ui/control-group/hook.d.ts.map +1 -1
  666. package/build-types/ui/control-label/component.d.ts +4 -1
  667. package/build-types/ui/control-label/component.d.ts.map +1 -1
  668. package/build-types/ui/control-label/hook.d.ts +55 -56
  669. package/build-types/ui/control-label/hook.d.ts.map +1 -1
  670. package/build-types/ui/form-group/form-group.d.ts +4 -8
  671. package/build-types/ui/form-group/form-group.d.ts.map +1 -1
  672. package/build-types/ui/form-group/use-form-group.d.ts +112 -114
  673. package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
  674. package/build-types/ui/shortcut/component.d.ts +2 -1
  675. package/build-types/ui/shortcut/component.d.ts.map +1 -1
  676. package/build-types/ui/spinner/component.d.ts +1 -1
  677. package/build-types/ui/tooltip/component.d.ts +11 -1
  678. package/build-types/ui/tooltip/component.d.ts.map +1 -1
  679. package/build-types/ui/tooltip/content.d.ts +7 -1
  680. package/build-types/ui/tooltip/styles.d.ts +1 -3
  681. package/build-types/ui/tooltip/styles.d.ts.map +1 -1
  682. package/build-types/unit-control/index.d.ts +2 -12
  683. package/build-types/unit-control/index.d.ts.map +1 -1
  684. package/build-types/unit-control/stories/index.d.ts.map +1 -1
  685. package/build-types/unit-control/styles/unit-control-styles.d.ts +5 -10
  686. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  687. package/build-types/unit-control/types.d.ts +3 -35
  688. package/build-types/unit-control/types.d.ts.map +1 -1
  689. package/build-types/utils/colors-values.d.ts +0 -18
  690. package/build-types/utils/colors-values.d.ts.map +1 -1
  691. package/build-types/utils/math.d.ts +6 -6
  692. package/build-types/utils/math.d.ts.map +1 -1
  693. package/build-types/utils/values.d.ts +10 -8
  694. package/build-types/utils/values.d.ts.map +1 -1
  695. package/build-types/v-stack/component.d.ts +8 -2
  696. package/build-types/v-stack/component.d.ts.map +1 -1
  697. package/build-types/v-stack/hook.d.ts +55 -56
  698. package/build-types/v-stack/hook.d.ts.map +1 -1
  699. package/build-types/v-stack/stories/index.d.ts +8 -1
  700. package/build-types/v-stack/stories/index.d.ts.map +1 -1
  701. package/build-types/view/component.d.ts +8 -6
  702. package/build-types/view/component.d.ts.map +1 -1
  703. package/build-types/view/stories/index.d.ts +12 -0
  704. package/build-types/view/stories/index.d.ts.map +1 -0
  705. package/build-types/view/types.d.ts +8 -0
  706. package/build-types/view/types.d.ts.map +1 -0
  707. package/build-types/visually-hidden/component.d.ts +2 -1
  708. package/build-types/visually-hidden/component.d.ts.map +1 -1
  709. package/build-types/z-stack/component.d.ts +2 -1
  710. package/build-types/z-stack/component.d.ts.map +1 -1
  711. package/package.json +17 -17
  712. package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +1 -1
  713. package/src/angle-picker-control/README.md +9 -1
  714. package/src/angle-picker-control/index.js +12 -0
  715. package/src/angle-picker-control/stories/index.js +3 -3
  716. package/src/autocomplete/autocompleter-ui.js +6 -3
  717. package/src/base-field/test/__snapshots__/index.js.snap +3 -5
  718. package/src/border-box-control/border-box-control/component.tsx +28 -12
  719. package/src/border-box-control/border-box-control-linked-button/component.tsx +1 -2
  720. package/src/border-box-control/border-box-control-split-controls/component.tsx +25 -11
  721. package/src/border-box-control/stories/index.js +1 -0
  722. package/src/border-box-control/styles.ts +2 -1
  723. package/src/border-box-control/types.ts +5 -4
  724. package/src/border-control/border-control-dropdown/component.tsx +3 -8
  725. package/src/border-control/types.ts +7 -9
  726. package/src/box-control/linked-button.js +3 -3
  727. package/src/box-control/test/index.js +5 -5
  728. package/src/button/style.scss +4 -3
  729. package/src/card/styles.ts +1 -1
  730. package/src/card/test/__snapshots__/index.tsx.snap +39 -51
  731. package/src/checkbox-control/index.tsx +3 -6
  732. package/src/checkbox-control/stories/index.tsx +6 -2
  733. package/src/checkbox-control/types.ts +4 -1
  734. package/src/color-palette/index.js +1 -1
  735. package/src/color-palette/test/__snapshots__/index.js.snap +67 -91
  736. package/src/color-picker/input-with-slider.tsx +1 -0
  737. package/src/combobox-control/index.js +1 -1
  738. package/src/combobox-control/test/index.js +311 -0
  739. package/src/custom-gradient-picker/index.js +1 -1
  740. package/src/date-time/date/index.tsx +2 -2
  741. package/src/date-time/time/timezone.tsx +1 -1
  742. package/src/dimension-control/test/__snapshots__/index.test.js.snap +1122 -164
  743. package/src/dimension-control/test/index.test.js +29 -38
  744. package/src/disabled/index.tsx +27 -9
  745. package/src/disabled/styles/disabled-styles.tsx +2 -2
  746. package/src/disabled/test/index.tsx +38 -0
  747. package/src/drop-zone/README.md +3 -3
  748. package/src/drop-zone/{index.js → index.tsx} +48 -13
  749. package/src/drop-zone/{provider.js → provider.ts} +5 -1
  750. package/src/drop-zone/stories/index.tsx +30 -0
  751. package/src/drop-zone/types.ts +29 -0
  752. package/src/dropdown/README.md +6 -4
  753. package/src/dropdown/index.js +15 -3
  754. package/src/dropdown/stories/index.js +1 -1
  755. package/src/flex/flex/hook.ts +5 -54
  756. package/src/flex/test/__snapshots__/index.tsx.snap +7 -15
  757. package/src/focal-point-picker/README.md +2 -2
  758. package/src/focal-point-picker/{controls.js → controls.tsx} +38 -10
  759. package/src/focal-point-picker/{focal-point.js → focal-point.tsx} +7 -1
  760. package/src/focal-point-picker/{grid.js → grid.tsx} +6 -1
  761. package/src/focal-point-picker/{index.js → index.tsx} +99 -15
  762. package/src/focal-point-picker/{media.js → media.tsx} +10 -4
  763. package/src/focal-point-picker/stories/index.tsx +93 -0
  764. package/src/focal-point-picker/styles/{focal-point-picker-style.js → focal-point-picker-style.ts} +31 -5
  765. package/src/focal-point-picker/styles/{focal-point-style.js → focal-point-style.ts} +2 -1
  766. package/src/focal-point-picker/test/index.js +27 -7
  767. package/src/focal-point-picker/types.ts +93 -0
  768. package/src/focal-point-picker/{utils.js → utils.ts} +9 -9
  769. package/src/font-size-picker/README.md +9 -0
  770. package/src/font-size-picker/index.js +9 -0
  771. package/src/font-size-picker/stories/index.js +3 -5
  772. package/src/font-size-picker/test/index.js +15 -2
  773. package/src/font-size-picker/test/utils.js +1 -2
  774. package/src/font-size-picker/utils.js +1 -1
  775. package/src/form-file-upload/README.md +6 -1
  776. package/src/form-file-upload/{index.js → index.tsx} +22 -4
  777. package/src/form-file-upload/stories/index.tsx +74 -0
  778. package/src/form-file-upload/test/{index.js → index.tsx} +7 -3
  779. package/src/form-file-upload/types.ts +63 -0
  780. package/src/form-toggle/index.tsx +1 -6
  781. package/src/form-token-field/index.tsx +4 -5
  782. package/src/form-token-field/suggestions-list.tsx +1 -2
  783. package/src/gradient-picker/index.js +41 -47
  784. package/src/gradient-picker/stories/index.js +10 -0
  785. package/src/h-stack/test/__snapshots__/index.tsx.snap +3 -12
  786. package/src/higher-order/with-filters/test/__snapshots__/index.js.snap +87 -0
  787. package/src/higher-order/with-filters/test/index.js +20 -74
  788. package/src/icon/index.tsx +1 -1
  789. package/src/icon/stories/index.js +18 -0
  790. package/src/icon/test/index.js +32 -83
  791. package/src/input-control/input-base.tsx +9 -11
  792. package/src/input-control/label.tsx +9 -4
  793. package/src/input-control/styles/input-control-styles.tsx +0 -43
  794. package/src/input-control/types.ts +3 -0
  795. package/src/isolated-event-container/test/index.js +53 -11
  796. package/src/item-group/test/__snapshots__/index.js.snap +16 -16
  797. package/src/keyboard-shortcuts/test/index.js +16 -31
  798. package/src/menu-item/test/__snapshots__/index.js.snap +60 -62
  799. package/src/menu-item/test/index.js +30 -22
  800. package/src/modal/aria-helper.js +3 -8
  801. package/src/modal/style.scss +3 -4
  802. package/src/navigable-container/README.md +2 -0
  803. package/src/navigable-container/container.js +8 -1
  804. package/src/navigable-container/menu.js +14 -11
  805. package/src/navigable-container/stories/navigable-menu.js +49 -0
  806. package/src/navigable-container/stories/tabbable-container.js +40 -0
  807. package/src/navigable-container/tabbable.js +2 -3
  808. package/src/navigable-container/test/navigable-menu.js +277 -0
  809. package/src/navigable-container/test/tababble-container.js +175 -0
  810. package/src/navigation/menu/menu-title-search.js +2 -0
  811. package/src/navigation/menu/use-navigation-tree-menu.js +2 -0
  812. package/src/navigator/navigator-button/hook.ts +1 -1
  813. package/src/navigator/navigator-screen/component.tsx +6 -1
  814. package/src/number-control/index.tsx +209 -0
  815. package/src/number-control/stories/index.js +6 -18
  816. package/src/number-control/types.ts +75 -0
  817. package/src/panel/README.md +1 -1
  818. package/src/panel/test/__snapshots__/header.js.snap +9 -0
  819. package/src/panel/test/__snapshots__/index.js.snap +17 -0
  820. package/src/panel/test/__snapshots__/row.js.snap +17 -0
  821. package/src/panel/test/header.js +30 -23
  822. package/src/panel/test/index.js +33 -25
  823. package/src/panel/test/row.js +18 -11
  824. package/src/placeholder/index.tsx +4 -5
  825. package/src/placeholder/style.scss +4 -0
  826. package/src/popover/README.md +128 -48
  827. package/src/popover/{index.js → index.tsx} +284 -182
  828. package/src/popover/stories/{index.js → index.tsx} +52 -54
  829. package/src/popover/test/index.js +7 -5
  830. package/src/popover/types.ts +192 -0
  831. package/src/popover/utils.ts +242 -0
  832. package/src/radio-control/index.tsx +28 -29
  833. package/src/radio-control/style.scss +0 -17
  834. package/src/range-control/index.tsx +4 -1
  835. package/src/range-control/styles/range-control-styles.ts +8 -8
  836. package/src/sandbox/index.js +2 -2
  837. package/src/search-control/README.md +5 -3
  838. package/src/search-control/{index.js → index.tsx} +35 -7
  839. package/src/search-control/stories/index.tsx +66 -0
  840. package/src/search-control/types.ts +43 -0
  841. package/src/select-control/index.native.js +1 -1
  842. package/src/slot-fill/test/index.js +69 -12
  843. package/src/style.scss +0 -1
  844. package/src/surface/test/__snapshots__/index.tsx.snap +10 -10
  845. package/src/tab-panel/README.md +1 -2
  846. package/src/tab-panel/{index.js → index.tsx} +58 -13
  847. package/src/tab-panel/stories/index.tsx +37 -0
  848. package/src/tab-panel/test/index.tsx +120 -0
  849. package/src/tab-panel/types.ts +65 -0
  850. package/src/text-control/index.tsx +2 -0
  851. package/src/text-control/types.ts +5 -1
  852. package/src/textarea-control/index.tsx +3 -6
  853. package/src/textarea-control/types.ts +1 -1
  854. package/src/toggle-control/index.tsx +97 -0
  855. package/src/toggle-control/stories/index.tsx +58 -0
  856. package/src/toggle-control/test/index.tsx +53 -0
  857. package/src/toggle-control/types.ts +28 -0
  858. package/src/toggle-group-control/stories/index.tsx +10 -3
  859. package/src/toggle-group-control/toggle-group-control/component.tsx +3 -3
  860. package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
  861. package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -1
  862. package/src/toggle-group-control/types.ts +2 -2
  863. package/src/tooltip/index.js +11 -7
  864. package/src/ui/context/context-connect.ts +58 -31
  865. package/src/ui/context/context-system-provider.js +5 -4
  866. package/src/ui/context/test/context-connect.tsx +55 -0
  867. package/src/ui/context/test/wordpress-component.tsx +36 -0
  868. package/src/ui/context/wordpress-component.ts +18 -12
  869. package/src/ui/control-group/test/__snapshots__/index.js.snap +1 -4
  870. package/src/unit-control/index.tsx +1 -1
  871. package/src/unit-control/stories/index.tsx +7 -16
  872. package/src/unit-control/styles/unit-control-styles.ts +2 -2
  873. package/src/unit-control/test/__snapshots__/index.tsx.snap +4 -6
  874. package/src/unit-control/types.ts +3 -44
  875. package/src/utils/colors-values.js +2 -24
  876. package/src/utils/math.js +4 -4
  877. package/src/utils/values.js +48 -6
  878. package/src/v-stack/test/__snapshots__/index.tsx.snap +3 -12
  879. package/src/view/{component.js → component.tsx} +13 -4
  880. package/src/view/stories/index.tsx +32 -0
  881. package/src/view/types.ts +6 -0
  882. package/tsconfig.json +1 -6
  883. package/tsconfig.tsbuildinfo +1 -1
  884. package/src/focal-point-picker/stories/index.js +0 -76
  885. package/src/navigable-container/test/menu.js +0 -310
  886. package/src/navigable-container/test/tabbable.js +0 -158
  887. package/src/number-control/index.js +0 -192
  888. package/src/popover/utils.js +0 -107
  889. package/src/search-control/stories/index.js +0 -39
  890. package/src/tab-panel/stories/index.js +0 -39
  891. package/src/tab-panel/test/index.js +0 -179
  892. package/src/toggle-control/index.js +0 -55
  893. package/src/toggle-control/stories/index.js +0 -64
  894. package/src/toggle-control/style.scss +0 -14
  895. package/src/toggle-control/test/index.js +0 -52
@@ -5,11 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = ToggleControl;
8
+ exports.ToggleControl = ToggleControl;
9
+ exports.default = void 0;
9
10
 
10
11
  var _element = require("@wordpress/element");
11
12
 
12
- var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _react = require("@emotion/react");
13
14
 
14
15
  var _compose = require("@wordpress/compose");
15
16
 
@@ -17,6 +18,12 @@ var _formToggle = _interopRequireDefault(require("../form-toggle"));
17
18
 
18
19
  var _baseControl = _interopRequireDefault(require("../base-control"));
19
20
 
21
+ var _hStack = require("../h-stack");
22
+
23
+ var _utils = require("../utils");
24
+
25
+ var _space = require("../ui/utils/space");
26
+
20
27
  /**
21
28
  * External dependencies
22
29
  */
@@ -28,8 +35,30 @@ var _baseControl = _interopRequireDefault(require("../base-control"));
28
35
  /**
29
36
  * Internal dependencies
30
37
  */
38
+
39
+ /**
40
+ * ToggleControl is used to generate a toggle user interface.
41
+ *
42
+ * ```jsx
43
+ * import { ToggleControl } from '@wordpress/components';
44
+ * import { useState } from '@wordpress/element';
45
+ *
46
+ * const MyToggleControl = () => {
47
+ * const [ value, setValue ] = useState( false );
48
+ *
49
+ * return (
50
+ * <ToggleControl
51
+ * label="Fixed Background"
52
+ * checked={ value }
53
+ * onChange={ () => setValue( ( state ) => ! state ) }
54
+ * />
55
+ * );
56
+ * };
57
+ * ```
58
+ */
31
59
  function ToggleControl(_ref) {
32
60
  let {
61
+ __nextHasNoMarginBottom,
33
62
  label,
34
63
  checked,
35
64
  help,
@@ -44,6 +73,10 @@ function ToggleControl(_ref) {
44
73
 
45
74
  const instanceId = (0, _compose.useInstanceId)(ToggleControl);
46
75
  const id = `inspector-toggle-control-${instanceId}`;
76
+ const cx = (0, _utils.useCx)();
77
+ const classes = cx('components-toggle-control', className, !__nextHasNoMarginBottom && /*#__PURE__*/(0, _react.css)({
78
+ marginBottom: (0, _space.space)(3)
79
+ }, process.env.NODE_ENV === "production" ? "" : ";label:classes;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdG9nZ2xlLWNvbnRyb2wvaW5kZXgudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZEK0IiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy90b2dnbGUtY29udHJvbC9pbmRleC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgdHlwZSB7IENoYW5nZUV2ZW50IH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFdvcmRQcmVzcyBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgdXNlSW5zdGFuY2VJZCB9IGZyb20gJ0B3b3JkcHJlc3MvY29tcG9zZSc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWV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Fx0PEJhc2VDb250cm9sXG5cdFx0XHRpZD17IGlkIH1cblx0XHRcdGhlbHA9eyBoZWxwTGFiZWwgfVxuXHRcdFx0Y2xhc3NOYW1lPXsgY2xhc3NlcyB9XG5cdFx0XHRfX25leHRIYXNOb01hcmdpbkJvdHRvbVxuXHRcdD5cblx0XHRcdDxIU3RhY2sganVzdGlmeT1cImZsZXgtc3RhcnRcIiBzcGFjaW5nPXsgMyB9PlxuXHRcdFx0XHQ8Rm9ybVRvZ2dsZVxuXHRcdFx0XHRcdGlkPXsgaWQgfVxuXHRcdFx0XHRcdGNoZWNrZWQ9eyBjaGVja2VkIH1cblx0XHRcdFx0XHRvbkNoYW5nZT17IG9uQ2hhbmdlVG9nZ2xlIH1cblx0XHRcdFx0XHRhcmlhLWRlc2NyaWJlZGJ5PXsgZGVzY3JpYmVkQnkgfVxuXHRcdFx0XHRcdGRpc2FibGVkPXsgZGlzYWJsZWQgfVxuXHRcdFx0XHQvPlxuXHRcdFx0XHQ8bGFiZWxcblx0XHRcdFx0XHRodG1sRm9yPXsgaWQgfVxuXHRcdFx0XHRcdGNsYXNzTmFtZT1cImNvbXBvbmVudHMtdG9nZ2xlLWNvbnRyb2xfX2xhYmVsXCJcblx0XHRcdFx0PlxuXHRcdFx0XHRcdHsgbGFiZWwgfVxuXHRcdFx0XHQ8L2xhYmVsPlxuXHRcdFx0PC9IU3RhY2s+XG5cdFx0PC9CYXNlQ29udHJvbD5cblx0KTtcbn1cblxuZXhwb3J0IGRlZmF1bHQgVG9nZ2xlQ29udHJvbDtcbiJdfQ== */"));
47
80
  let describedBy, helpLabel;
48
81
 
49
82
  if (help) {
@@ -54,7 +87,11 @@ function ToggleControl(_ref) {
54
87
  return (0, _element.createElement)(_baseControl.default, {
55
88
  id: id,
56
89
  help: helpLabel,
57
- className: (0, _classnames.default)('components-toggle-control', className)
90
+ className: classes,
91
+ __nextHasNoMarginBottom: true
92
+ }, (0, _element.createElement)(_hStack.HStack, {
93
+ justify: "flex-start",
94
+ spacing: 3
58
95
  }, (0, _element.createElement)(_formToggle.default, {
59
96
  id: id,
60
97
  checked: checked,
@@ -64,6 +101,9 @@ function ToggleControl(_ref) {
64
101
  }), (0, _element.createElement)("label", {
65
102
  htmlFor: id,
66
103
  className: "components-toggle-control__label"
67
- }, label));
104
+ }, label)));
68
105
  }
106
+
107
+ var _default = ToggleControl;
108
+ exports.default = _default;
69
109
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/toggle-control/index.js"],"names":["ToggleControl","label","checked","help","className","onChange","disabled","onChangeToggle","event","target","instanceId","id","describedBy","helpLabel"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,aAAT,OAOX;AAAA,MAPmC;AACtCC,IAAAA,KADsC;AAEtCC,IAAAA,OAFsC;AAGtCC,IAAAA,IAHsC;AAItCC,IAAAA,SAJsC;AAKtCC,IAAAA,QALsC;AAMtCC,IAAAA;AANsC,GAOnC;;AACH,WAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAChCH,IAAAA,QAAQ,CAAEG,KAAK,CAACC,MAAN,CAAaP,OAAf,CAAR;AACA;;AACD,QAAMQ,UAAU,GAAG,4BAAeV,aAAf,CAAnB;AACA,QAAMW,EAAE,GAAI,4BAA4BD,UAAY,EAApD;AAEA,MAAIE,WAAJ,EAAiBC,SAAjB;;AACA,MAAKV,IAAL,EAAY;AACXS,IAAAA,WAAW,GAAGD,EAAE,GAAG,QAAnB;AACAE,IAAAA,SAAS,GAAG,OAAOV,IAAP,KAAgB,UAAhB,GAA6BA,IAAI,CAAED,OAAF,CAAjC,GAA+CC,IAA3D;AACA;;AAED,SACC,4BAAC,oBAAD;AACC,IAAA,EAAE,EAAGQ,EADN;AAEC,IAAA,IAAI,EAAGE,SAFR;AAGC,IAAA,SAAS,EAAG,yBAAY,2BAAZ,EAAyCT,SAAzC;AAHb,KAKC,4BAAC,mBAAD;AACC,IAAA,EAAE,EAAGO,EADN;AAEC,IAAA,OAAO,EAAGT,OAFX;AAGC,IAAA,QAAQ,EAAGK,cAHZ;AAIC,wBAAmBK,WAJpB;AAKC,IAAA,QAAQ,EAAGN;AALZ,IALD,EAYC;AAAO,IAAA,OAAO,EAAGK,EAAjB;AAAsB,IAAA,SAAS,EAAC;AAAhC,KACGV,KADH,CAZD,CADD;AAkBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport FormToggle from '../form-toggle';\nimport BaseControl from '../base-control';\n\nexport default function ToggleControl( {\n\tlabel,\n\tchecked,\n\thelp,\n\tclassName,\n\tonChange,\n\tdisabled,\n} ) {\n\tfunction onChangeToggle( event ) {\n\t\tonChange( event.target.checked );\n\t}\n\tconst instanceId = useInstanceId( ToggleControl );\n\tconst id = `inspector-toggle-control-${ instanceId }`;\n\n\tlet describedBy, helpLabel;\n\tif ( help ) {\n\t\tdescribedBy = id + '__help';\n\t\thelpLabel = typeof help === 'function' ? help( checked ) : help;\n\t}\n\n\treturn (\n\t\t<BaseControl\n\t\t\tid={ id }\n\t\t\thelp={ helpLabel }\n\t\t\tclassName={ classnames( 'components-toggle-control', className ) }\n\t\t>\n\t\t\t<FormToggle\n\t\t\t\tid={ id }\n\t\t\t\tchecked={ checked }\n\t\t\t\tonChange={ onChangeToggle }\n\t\t\t\taria-describedby={ describedBy }\n\t\t\t\tdisabled={ disabled }\n\t\t\t/>\n\t\t\t<label htmlFor={ id } className=\"components-toggle-control__label\">\n\t\t\t\t{ label }\n\t\t\t</label>\n\t\t</BaseControl>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/toggle-control/index.tsx"],"names":["ToggleControl","__nextHasNoMarginBottom","label","checked","help","className","onChange","disabled","onChangeToggle","event","target","instanceId","id","cx","classes","marginBottom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AAA,OAAO,EAAC,YAAhB;AAA6B,IAAA,OAAO,EAAG;AAAvC,KACC,4BAAC,mBAAD;AACC,IAAA,EAAE,EAAGF,EADN;AAEC,IAAA,OAAO,EAAGT,OAFX;AAGC,IAAA,QAAQ,EAAGK,cAHZ;AAIC,wBAAmBQ,WAJpB;AAKC,IAAA,QAAQ,EAAGT;AALZ,IADD,EAQC;AACC,IAAA,OAAO,EAAGK,EADX;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGV,KAJH,CARD,CAND,CADD;AAwBA;;eAEcF,a","sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent } from 'react';\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport FormToggle from '../form-toggle';\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../ui/context/wordpress-component';\nimport type { ToggleControlProps } from './types';\nimport { HStack } from '../h-stack';\nimport { useCx } from '../utils';\nimport { space } from '../ui/utils/space';\n\n/**\n * ToggleControl is used to generate a toggle user interface.\n *\n * ```jsx\n * import { ToggleControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyToggleControl = () => {\n * const [ value, setValue ] = useState( false );\n *\n * return (\n * <ToggleControl\n * label=\"Fixed Background\"\n * checked={ value }\n * onChange={ () => setValue( ( state ) => ! state ) }\n * />\n * );\n * };\n * ```\n */\nexport function ToggleControl( {\n\t__nextHasNoMarginBottom,\n\tlabel,\n\tchecked,\n\thelp,\n\tclassName,\n\tonChange,\n\tdisabled,\n}: WordPressComponentProps< ToggleControlProps, 'input', false > ) {\n\tfunction onChangeToggle( event: ChangeEvent< HTMLInputElement > ) {\n\t\tonChange( event.target.checked );\n\t}\n\tconst instanceId = useInstanceId( ToggleControl );\n\tconst id = `inspector-toggle-control-${ instanceId }`;\n\n\tconst cx = useCx();\n\tconst classes = cx(\n\t\t'components-toggle-control',\n\t\tclassName,\n\t\t! __nextHasNoMarginBottom && css( { marginBottom: space( 3 ) } )\n\t);\n\n\tlet describedBy, helpLabel;\n\tif ( help ) {\n\t\tdescribedBy = id + '__help';\n\t\thelpLabel = typeof help === 'function' ? help( checked ) : help;\n\t}\n\n\treturn (\n\t\t<BaseControl\n\t\t\tid={ id }\n\t\t\thelp={ helpLabel }\n\t\t\tclassName={ classes }\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t<HStack justify=\"flex-start\" spacing={ 3 }>\n\t\t\t\t<FormToggle\n\t\t\t\t\tid={ id }\n\t\t\t\t\tchecked={ checked }\n\t\t\t\t\tonChange={ onChangeToggle }\n\t\t\t\t\taria-describedby={ describedBy }\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t/>\n\t\t\t\t<label\n\t\t\t\t\thtmlFor={ id }\n\t\t\t\t\tclassName=\"components-toggle-control__label\"\n\t\t\t\t>\n\t\t\t\t\t{ label }\n\t\t\t\t</label>\n\t\t\t</HStack>\n\t\t</BaseControl>\n\t);\n}\n\nexport default ToggleControl;\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -49,7 +49,7 @@ function UnconnectedToggleGroupControl(props, forwardedRef) {
49
49
  className,
50
50
  isAdaptiveWidth = false,
51
51
  isBlock = false,
52
- __experimentalIsIconGroup = false,
52
+ __experimentalIsBorderless = false,
53
53
  label,
54
54
  hideLabelFromVision = false,
55
55
  help,
@@ -84,7 +84,7 @@ function UnconnectedToggleGroupControl(props, forwardedRef) {
84
84
  }, [value]);
85
85
  const classes = (0, _element.useMemo)(() => cx(styles.ToggleGroupControl({
86
86
  size
87
- }), !__experimentalIsIconGroup && styles.border, isBlock && styles.block, className), [className, cx, isBlock, __experimentalIsIconGroup, size]);
87
+ }), !__experimentalIsBorderless && styles.border, isBlock && styles.block, className), [className, cx, isBlock, __experimentalIsBorderless, size]);
88
88
  return (0, _element.createElement)(_baseControl.default, {
89
89
  help: help,
90
90
  __nextHasNoMarginBottom: __nextHasNoMarginBottom
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control/component.tsx"],"names":["noop","UnconnectedToggleGroupControl","props","forwardedRef","__nextHasNoMarginBottom","className","isAdaptiveWidth","isBlock","__experimentalIsIconGroup","label","hideLabelFromVision","help","onChange","size","value","children","otherProps","cx","containerRef","resizeListener","sizes","baseId","ToggleGroupControl","toString","radio","state","previousValue","setState","classes","styles","border","block","View","width"],"mappings":";;;;;;;;;AAWA;;;;AANA;;AAOA;;AAUA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;AAjCA;AACA;AACA;AAEA;;AAeA;AACA;AACA;AAeA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,6BAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AACLC,IAAAA,uBAAuB,GAAG,KADrB;AAELC,IAAAA,SAFK;AAGLC,IAAAA,eAAe,GAAG,KAHb;AAILC,IAAAA,OAAO,GAAG,KAJL;AAKLC,IAAAA,yBAAyB,GAAG,KALvB;AAMLC,IAAAA,KANK;AAOLC,IAAAA,mBAAmB,GAAG,KAPjB;AAQLC,IAAAA,IARK;AASLC,IAAAA,QAAQ,GAAGZ,IATN;AAULa,IAAAA,IAAI,GAAG,SAVF;AAWLC,IAAAA,KAXK;AAYLC,IAAAA,QAZK;AAaL,OAAGC;AAbE,MAcF,+BAAkBd,KAAlB,EAAyB,oBAAzB,CAdJ;AAeA,QAAMe,EAAE,GAAG,mBAAX;AACA,QAAMC,YAAY,GAAG,sBAArB;AACA,QAAM,CAAEC,cAAF,EAAkBC,KAAlB,IAA4B,iCAAlC;AACA,QAAMC,MAAM,GAAG,4BACdC,kBADc,EAEd,sBAFc,EAGbC,QAHa,EAAf;AA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,EAAGuB,UAHN;AAIC,IAAA,SAAS,EAAGJ;AAJb,KAKMZ,UALN;AAMC,IAAA,GAAG,EAAG,2BAAc,CAAEE,YAAF,EAAgBf,YAAhB,CAAd;AANP,MAQGgB,cARH,EASC,4BAAC,mCAAD,6BACMK,KADN;AAEC,IAAA,YAAY,EAAGN,YAFhB;AAGC,IAAA,cAAc,EAAGE,KAAK,CAACa,KAHxB;AAIC,IAAA,eAAe,EAAG3B;AAJnB,KATD,EAeGS,QAfH,CAVD,CAJD,CADD;AAmCA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMO,kBAAkB,GAAG,6BACjCrB,6BADiC,EAEjC,oBAFiC,CAA3B;;eAKQqB,kB","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport { RadioGroup, useRadioState } from 'reakit';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useMemo } from '@wordpress/element';\nimport {\n\tuseMergeRefs,\n\tuseInstanceId,\n\tusePrevious,\n\tuseResizeObserver,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../../ui/context';\nimport { useUpdateEffect, useCx } from '../../utils/hooks';\nimport { View } from '../../view';\nimport BaseControl from '../../base-control';\nimport type { ToggleGroupControlProps } from '../types';\nimport ToggleGroupControlBackdrop from './toggle-group-control-backdrop';\nimport ToggleGroupControlContext from '../context';\nimport { VisualLabelWrapper } from './styles';\nimport * as styles from './styles';\n\nconst noop = () => {};\n\nfunction UnconnectedToggleGroupControl(\n\tprops: WordPressComponentProps< ToggleGroupControlProps, 'input', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\tclassName,\n\t\tisAdaptiveWidth = false,\n\t\tisBlock = false,\n\t\t__experimentalIsIconGroup = false,\n\t\tlabel,\n\t\thideLabelFromVision = false,\n\t\thelp,\n\t\tonChange = noop,\n\t\tsize = 'default',\n\t\tvalue,\n\t\tchildren,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToggleGroupControl' );\n\tconst cx = useCx();\n\tconst containerRef = useRef();\n\tconst [ resizeListener, sizes ] = useResizeObserver();\n\tconst baseId = useInstanceId(\n\t\tToggleGroupControl,\n\t\t'toggle-group-control'\n\t).toString();\n\tconst radio = useRadioState( {\n\t\tbaseId,\n\t\tstate: value,\n\t} );\n\tconst previousValue = usePrevious( value );\n\n\t// Propagate radio.state change.\n\tuseUpdateEffect( () => {\n\t\t// Avoid calling onChange if radio state changed\n\t\t// from incoming value.\n\t\tif ( previousValue !== radio.state ) {\n\t\t\tonChange( radio.state );\n\t\t}\n\t}, [ radio.state ] );\n\n\t// Sync incoming value with radio.state.\n\tuseUpdateEffect( () => {\n\t\tif ( value !== radio.state ) {\n\t\t\tradio.setState( value );\n\t\t}\n\t}, [ value ] );\n\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.ToggleGroupControl( { size } ),\n\t\t\t\t! __experimentalIsIconGroup && styles.border,\n\t\t\t\tisBlock && styles.block,\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx, isBlock, __experimentalIsIconGroup, size ]\n\t);\n\treturn (\n\t\t<BaseControl\n\t\t\thelp={ help }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t>\n\t\t\t<ToggleGroupControlContext.Provider\n\t\t\t\tvalue={ { ...radio, isBlock: ! isAdaptiveWidth, size } }\n\t\t\t>\n\t\t\t\t{ ! hideLabelFromVision && (\n\t\t\t\t\t<VisualLabelWrapper>\n\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t</VisualLabelWrapper>\n\t\t\t\t) }\n\t\t\t\t<RadioGroup\n\t\t\t\t\t{ ...radio }\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tas={ View }\n\t\t\t\t\tclassName={ classes }\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\tref={ useMergeRefs( [ containerRef, forwardedRef ] ) }\n\t\t\t\t>\n\t\t\t\t\t{ resizeListener }\n\t\t\t\t\t<ToggleGroupControlBackdrop\n\t\t\t\t\t\t{ ...radio }\n\t\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t\t\tcontainerWidth={ sizes.width }\n\t\t\t\t\t\tisAdaptiveWidth={ isAdaptiveWidth }\n\t\t\t\t\t/>\n\t\t\t\t\t{ children }\n\t\t\t\t</RadioGroup>\n\t\t\t</ToggleGroupControlContext.Provider>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * `ToggleGroupControl` is a form component that lets users choose options\n * represented in horizontal segments. To render options for this control use\n * `ToggleGroupControlOption` component.\n *\n * 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 label=\"my label\" value=\"vertical\" isBlock>\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"]}
1
+ {"version":3,"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control/component.tsx"],"names":["noop","UnconnectedToggleGroupControl","props","forwardedRef","__nextHasNoMarginBottom","className","isAdaptiveWidth","isBlock","__experimentalIsBorderless","label","hideLabelFromVision","help","onChange","size","value","children","otherProps","cx","containerRef","resizeListener","sizes","baseId","ToggleGroupControl","toString","radio","state","previousValue","setState","classes","styles","border","block","View","width"],"mappings":";;;;;;;;;AAWA;;;;AANA;;AAOA;;AAUA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;AAjCA;AACA;AACA;AAEA;;AAeA;AACA;AACA;AAeA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,6BAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AACLC,IAAAA,uBAAuB,GAAG,KADrB;AAELC,IAAAA,SAFK;AAGLC,IAAAA,eAAe,GAAG,KAHb;AAILC,IAAAA,OAAO,GAAG,KAJL;AAKLC,IAAAA,0BAA0B,GAAG,KALxB;AAMLC,IAAAA,KANK;AAOLC,IAAAA,mBAAmB,GAAG,KAPjB;AAQLC,IAAAA,IARK;AASLC,IAAAA,QAAQ,GAAGZ,IATN;AAULa,IAAAA,IAAI,GAAG,SAVF;AAWLC,IAAAA,KAXK;AAYLC,IAAAA,QAZK;AAaL,OAAGC;AAbE,MAcF,+BAAkBd,KAAlB,EAAyB,oBAAzB,CAdJ;AAeA,QAAMe,EAAE,GAAG,mBAAX;AACA,QAAMC,YAAY,GAAG,sBAArB;AACA,QAAM,CAAEC,cAAF,EAAkBC,KAAlB,IAA4B,iCAAlC;AACA,QAAMC,MAAM,GAAG,4BACdC,kBADc,EAEd,sBAFc,EAGbC,QAHa,EAAf;AAIA,QAAMC,KAAK,GAAG,2BAAe;AAC5BH,IAAAA,MAD4B;AAE5BI,IAAAA,KAAK,EAAEX;AAFqB,GAAf,CAAd;AAIA,QAAMY,aAAa,GAAG,0BAAaZ,KAAb,CAAtB,CA3BC,CA6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CAAD,6BACMK,KADN;AAEC,IAAA,YAAY,EAAGN,YAFhB;AAGC,IAAA,cAAc,EAAGE,KAAK,CAACa,KAHxB;AAIC,IAAA,eAAe,EAAG3B;AAJnB,KATD,EAeGS,QAfH,CAVD,CAJD,CADD;AAmCA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMO,kBAAkB,GAAG,6BACjCrB,6BADiC,EAEjC,oBAFiC,CAA3B;;eAKQqB,kB","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport { RadioGroup, useRadioState } from 'reakit';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useMemo } from '@wordpress/element';\nimport {\n\tuseMergeRefs,\n\tuseInstanceId,\n\tusePrevious,\n\tuseResizeObserver,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../../ui/context';\nimport { useUpdateEffect, useCx } from '../../utils/hooks';\nimport { View } from '../../view';\nimport BaseControl from '../../base-control';\nimport type { ToggleGroupControlProps } from '../types';\nimport ToggleGroupControlBackdrop from './toggle-group-control-backdrop';\nimport ToggleGroupControlContext from '../context';\nimport { VisualLabelWrapper } from './styles';\nimport * as styles from './styles';\n\nconst noop = () => {};\n\nfunction UnconnectedToggleGroupControl(\n\tprops: WordPressComponentProps< ToggleGroupControlProps, 'input', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\tclassName,\n\t\tisAdaptiveWidth = false,\n\t\tisBlock = false,\n\t\t__experimentalIsBorderless = false,\n\t\tlabel,\n\t\thideLabelFromVision = false,\n\t\thelp,\n\t\tonChange = noop,\n\t\tsize = 'default',\n\t\tvalue,\n\t\tchildren,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToggleGroupControl' );\n\tconst cx = useCx();\n\tconst containerRef = useRef();\n\tconst [ resizeListener, sizes ] = useResizeObserver();\n\tconst baseId = useInstanceId(\n\t\tToggleGroupControl,\n\t\t'toggle-group-control'\n\t).toString();\n\tconst radio = useRadioState( {\n\t\tbaseId,\n\t\tstate: value,\n\t} );\n\tconst previousValue = usePrevious( value );\n\n\t// Propagate radio.state change.\n\tuseUpdateEffect( () => {\n\t\t// Avoid calling onChange if radio state changed\n\t\t// from incoming value.\n\t\tif ( previousValue !== radio.state ) {\n\t\t\tonChange( radio.state );\n\t\t}\n\t}, [ radio.state ] );\n\n\t// Sync incoming value with radio.state.\n\tuseUpdateEffect( () => {\n\t\tif ( value !== radio.state ) {\n\t\t\tradio.setState( value );\n\t\t}\n\t}, [ value ] );\n\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.ToggleGroupControl( { size } ),\n\t\t\t\t! __experimentalIsBorderless && styles.border,\n\t\t\t\tisBlock && styles.block,\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx, isBlock, __experimentalIsBorderless, size ]\n\t);\n\treturn (\n\t\t<BaseControl\n\t\t\thelp={ help }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t>\n\t\t\t<ToggleGroupControlContext.Provider\n\t\t\t\tvalue={ { ...radio, isBlock: ! isAdaptiveWidth, size } }\n\t\t\t>\n\t\t\t\t{ ! hideLabelFromVision && (\n\t\t\t\t\t<VisualLabelWrapper>\n\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t</VisualLabelWrapper>\n\t\t\t\t) }\n\t\t\t\t<RadioGroup\n\t\t\t\t\t{ ...radio }\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tas={ View }\n\t\t\t\t\tclassName={ classes }\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\tref={ useMergeRefs( [ containerRef, forwardedRef ] ) }\n\t\t\t\t>\n\t\t\t\t\t{ resizeListener }\n\t\t\t\t\t<ToggleGroupControlBackdrop\n\t\t\t\t\t\t{ ...radio }\n\t\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t\t\tcontainerWidth={ sizes.width }\n\t\t\t\t\t\tisAdaptiveWidth={ isAdaptiveWidth }\n\t\t\t\t\t/>\n\t\t\t\t\t{ children }\n\t\t\t\t</RadioGroup>\n\t\t\t</ToggleGroupControlContext.Provider>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * `ToggleGroupControl` is a form component that lets users choose options\n * represented in horizontal segments. To render options for this control use\n * `ToggleGroupControlOption` component.\n *\n * 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 label=\"my label\" value=\"vertical\" isBlock>\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"]}
@@ -51,7 +51,7 @@ function UnforwardedToggleGroupControlOptionIcon(props, ref) {
51
51
  *
52
52
  * function Example() {
53
53
  * return (
54
- * <ToggleGroupControl __experimentalIsIconGroup>
54
+ * <ToggleGroupControl>
55
55
  * <ToggleGroupControlOptionIcon
56
56
  * value="uppercase"
57
57
  * label="Uppercase"
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control-option-icon/component.tsx"],"names":["UnforwardedToggleGroupControlOptionIcon","props","ref","icon","label","restProps","ToggleGroupControlOptionIcon"],"mappings":";;;;;;;;;AAQA;;;;AAOA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;AAWA,SAASA,uCAAT,CACCC,KADD,EAMCC,GAND,EAOE;AACD,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,KAAR;AAAe,OAAGC;AAAlB,MAAgCJ,KAAtC;AACA,SACC,4BAAC,0DAAD,6BACMI,SADN;AAEC,IAAA,MAAM,MAFP;AAGC,kBAAaD,KAHd;AAIC,IAAA,WAAW,MAJZ;AAKC,IAAA,GAAG,EAAGF;AALP,MAOC,4BAAC,aAAD;AAAM,IAAA,IAAI,EAAGC;AAAb,IAPD,CADD;AAWA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMG,4BAA4B,GAAG,yBAC3CN,uCAD2C,CAArC;;eAIQM,4B","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../ui/context';\nimport type { ToggleGroupControlOptionIconProps } from '../types';\nimport { ToggleGroupControlOptionBase } from '../toggle-group-control-option-base';\nimport Icon from '../../icon';\n\nfunction UnforwardedToggleGroupControlOptionIcon(\n\tprops: WordPressComponentProps<\n\t\tToggleGroupControlOptionIconProps,\n\t\t'button',\n\t\tfalse\n\t>,\n\tref: ForwardedRef< any >\n) {\n\tconst { icon, label, ...restProps } = props;\n\treturn (\n\t\t<ToggleGroupControlOptionBase\n\t\t\t{ ...restProps }\n\t\t\tisIcon\n\t\t\taria-label={ label }\n\t\t\tshowTooltip\n\t\t\tref={ ref }\n\t\t>\n\t\t\t<Icon icon={ icon } />\n\t\t</ToggleGroupControlOptionBase>\n\t);\n}\n\n/**\n * `ToggleGroupControlOptionIcon` is a form component which is meant to be used as a\n * child of `ToggleGroupControl` and displays an icon.\n *\n * ```jsx\n *\n * import {\n *\t__experimentalToggleGroupControl as ToggleGroupControl,\n *\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n * from '@wordpress/components';\n * import { formatLowercase, formatUppercase } from '@wordpress/icons';\n *\n * function Example() {\n *\treturn (\n *\t\t<ToggleGroupControl __experimentalIsIconGroup>\n *\t\t\t<ToggleGroupControlOptionIcon\n *\t\t\t\tvalue=\"uppercase\"\n *\t\t\t\tlabel=\"Uppercase\"\n *\t\t\t\ticon={ formatUppercase }\n *\t\t\t/>\n *\t\t\t<ToggleGroupControlOptionIcon\n *\t\t\t\tvalue=\"lowercase\"\n *\t\t\t\tlabel=\"Lowercase\"\n *\t\t\t\ticon={ formatLowercase }\n *\t\t\t/>\n *\t\t</ToggleGroupControl>\n *\t);\n * }\n * ```\n */\nexport const ToggleGroupControlOptionIcon = forwardRef(\n\tUnforwardedToggleGroupControlOptionIcon\n);\n\nexport default ToggleGroupControlOptionIcon;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control-option-icon/component.tsx"],"names":["UnforwardedToggleGroupControlOptionIcon","props","ref","icon","label","restProps","ToggleGroupControlOptionIcon"],"mappings":";;;;;;;;;AAQA;;;;AAOA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;AAWA,SAASA,uCAAT,CACCC,KADD,EAMCC,GAND,EAOE;AACD,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,KAAR;AAAe,OAAGC;AAAlB,MAAgCJ,KAAtC;AACA,SACC,4BAAC,0DAAD,6BACMI,SADN;AAEC,IAAA,MAAM,MAFP;AAGC,kBAAaD,KAHd;AAIC,IAAA,WAAW,MAJZ;AAKC,IAAA,GAAG,EAAGF;AALP,MAOC,4BAAC,aAAD;AAAM,IAAA,IAAI,EAAGC;AAAb,IAPD,CADD;AAWA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMG,4BAA4B,GAAG,yBAC3CN,uCAD2C,CAArC;;eAIQM,4B","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../ui/context';\nimport type { ToggleGroupControlOptionIconProps } from '../types';\nimport { ToggleGroupControlOptionBase } from '../toggle-group-control-option-base';\nimport Icon from '../../icon';\n\nfunction UnforwardedToggleGroupControlOptionIcon(\n\tprops: WordPressComponentProps<\n\t\tToggleGroupControlOptionIconProps,\n\t\t'button',\n\t\tfalse\n\t>,\n\tref: ForwardedRef< any >\n) {\n\tconst { icon, label, ...restProps } = props;\n\treturn (\n\t\t<ToggleGroupControlOptionBase\n\t\t\t{ ...restProps }\n\t\t\tisIcon\n\t\t\taria-label={ label }\n\t\t\tshowTooltip\n\t\t\tref={ ref }\n\t\t>\n\t\t\t<Icon icon={ icon } />\n\t\t</ToggleGroupControlOptionBase>\n\t);\n}\n\n/**\n * `ToggleGroupControlOptionIcon` is a form component which is meant to be used as a\n * child of `ToggleGroupControl` and displays an icon.\n *\n * ```jsx\n *\n * import {\n *\t__experimentalToggleGroupControl as ToggleGroupControl,\n *\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n * from '@wordpress/components';\n * import { formatLowercase, formatUppercase } from '@wordpress/icons';\n *\n * function Example() {\n *\treturn (\n *\t\t<ToggleGroupControl>\n *\t\t\t<ToggleGroupControlOptionIcon\n *\t\t\t\tvalue=\"uppercase\"\n *\t\t\t\tlabel=\"Uppercase\"\n *\t\t\t\ticon={ formatUppercase }\n *\t\t\t/>\n *\t\t\t<ToggleGroupControlOptionIcon\n *\t\t\t\tvalue=\"lowercase\"\n *\t\t\t\tlabel=\"Lowercase\"\n *\t\t\t\ticon={ formatLowercase }\n *\t\t\t/>\n *\t\t</ToggleGroupControl>\n *\t);\n * }\n * ```\n */\nexport const ToggleGroupControlOptionIcon = forwardRef(\n\tUnforwardedToggleGroupControlOptionIcon\n);\n\nexport default ToggleGroupControlOptionIcon;\n"]}
@@ -67,7 +67,7 @@ const getRegularElement = _ref2 => {
67
67
 
68
68
  const addPopoverToGrandchildren = _ref3 => {
69
69
  let {
70
- anchorRef,
70
+ anchor,
71
71
  grandchildren,
72
72
  isOver,
73
73
  offset,
@@ -82,8 +82,8 @@ const addPopoverToGrandchildren = _ref3 => {
82
82
  "aria-hidden": "true",
83
83
  animate: false,
84
84
  offset: offset,
85
- anchorRef: anchorRef,
86
- __unstableShift: true
85
+ anchor: anchor,
86
+ shift: true
87
87
  }, text, (0, _element.createElement)(_shortcut.default, {
88
88
  className: "components-tooltip__shortcut",
89
89
  shortcut: shortcut
@@ -126,13 +126,15 @@ function Tooltip(props) {
126
126
 
127
127
  const [isMouseDown, setIsMouseDown] = (0, _element.useState)(false);
128
128
  const [isOver, setIsOver] = (0, _element.useState)(false);
129
- const delayedSetIsOver = (0, _compose.useDebounce)(setIsOver, delay); // Create a reference to the Tooltip's child, to be passed to the Popover
129
+ const delayedSetIsOver = (0, _compose.useDebounce)(setIsOver, delay); // Using internal state (instead of a ref) for the popover anchor to make sure
130
+ // that the component re-renders when the anchor updates.
131
+
132
+ const [popoverAnchor, setPopoverAnchor] = (0, _element.useState)(null); // Create a reference to the Tooltip's child, to be passed to the Popover
130
133
  // so that the Tooltip can be correctly positioned. Also, merge with the
131
134
  // existing ref for the first child, so that its ref is preserved.
132
135
 
133
- const childRef = (0, _element.useRef)(null);
134
136
  const existingChildRef = (_Children$toArray$ = _element.Children.toArray(children)[0]) === null || _Children$toArray$ === void 0 ? void 0 : _Children$toArray$.ref;
135
- const mergedChildRefs = (0, _compose.useMergeRefs)([childRef, existingChildRef]);
137
+ const mergedChildRefs = (0, _compose.useMergeRefs)([setPopoverAnchor, existingChildRef]);
136
138
 
137
139
  const createMouseDown = event => {
138
140
  // In firefox, the mouse down event is also fired when the select
@@ -255,7 +257,7 @@ function Tooltip(props) {
255
257
  } = child.props;
256
258
  const getElementWithPopover = disabled ? getDisabledElement : getRegularElement;
257
259
  const popoverData = {
258
- anchorRef: childRef,
260
+ anchor: popoverAnchor,
259
261
  isOver,
260
262
  offset: 4,
261
263
  position,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tooltip/index.js"],"names":["TOOLTIP_DELAY","eventCatcher","getDisabledElement","eventHandlers","child","childrenWithPopover","mergedRefs","children","ref","getRegularElement","addPopoverToGrandchildren","anchorRef","grandchildren","isOver","offset","position","shortcut","text","emitToChild","eventName","event","Children","count","only","props","disabled","Tooltip","delay","isMouseDown","setIsMouseDown","setIsOver","delayedSetIsOver","childRef","existingChildRef","toArray","mergedChildRefs","createMouseDown","target","tagName","document","addEventListener","cancelIsMouseDown","createMouseUp","removeEventListener","createMouseEvent","type","createToggleIsOver","isDelayed","currentTarget","cancel","_isOver","includes","clearOnUnmount","process","env","NODE_ENV","console","error","onMouseEnter","onMouseLeave","onClick","onFocus","onBlur","onMouseDown","getElementWithPopover","popoverData"],"mappings":";;;;;;;;;AAKA;;AAQA;;AAKA;;AACA;;AAnBA;;AAEA;AACA;AACA;;AAWA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GAAG,GAAtB;;AAEP,MAAMC,YAAY,GAAG;AAAK,EAAA,SAAS,EAAC;AAAf,EAArB;;AAEA,MAAMC,kBAAkB,GAAG,QAKpB;AAAA,MALsB;AAC5BC,IA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AAd;;AACA,QAAM;AAAEA,IAAAA,QAAQ,EAAEK,aAAZ;AAA2Ba,IAAAA;AAA3B,MAAwCrB,KAAK,CAACoB,KAApD;AACA,QAAMwC,qBAAqB,GAAGvC,QAAQ,GACnCvB,kBADmC,GAEnCO,iBAFH;AAIA,QAAMwD,WAAW,GAAG;AACnBtD,IAAAA,SAAS,EAAEqB,QADQ;AAEnBnB,IAAAA,MAFmB;AAGnBC,IAAAA,MAAM,EAAE,CAHW;AAInBC,IAAAA,QAJmB;AAKnBC,IAAAA,QALmB;AAMnBC,IAAAA;AANmB,GAApB;AAQA,QAAMZ,mBAAmB,GAAGK,yBAAyB,CAAE;AACtDE,IAAAA,aADsD;AAEtD,OAAGqD;AAFmD,GAAF,CAArD;AAKA,SAAOD,qBAAqB,CAAE;AAC7B5D,IAAAA,KAD6B;AAE7BD,IAAAA,aAF6B;AAG7BE,IAAAA,mBAH6B;AAI7BC,IAAAA,UAAU,EAAE6B;AAJiB,GAAF,CAA5B;AAMA;;eAEcT,O","sourcesContent":["// @ts-nocheck\n\n/**\n * WordPress dependencies\n */\nimport {\n\tChildren,\n\tcloneElement,\n\tconcatChildren,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n} from '@wordpress/element';\nimport { useDebounce, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Popover from '../popover';\nimport Shortcut from '../shortcut';\n\n/**\n * Time over children to wait before showing tooltip\n *\n * @type {number}\n */\nexport const TOOLTIP_DELAY = 700;\n\nconst eventCatcher = <div className=\"event-catcher\" />;\n\nconst getDisabledElement = ( {\n\teventHandlers,\n\tchild,\n\tchildrenWithPopover,\n\tmergedRefs,\n} ) => {\n\treturn cloneElement(\n\t\t<span className=\"disabled-element-wrapper\">\n\t\t\t{ cloneElement( eventCatcher, eventHandlers ) }\n\t\t\t{ cloneElement( child, {\n\t\t\t\tchildren: childrenWithPopover,\n\t\t\t\tref: mergedRefs,\n\t\t\t} ) }\n\t\t</span>,\n\t\t{ ...eventHandlers }\n\t);\n};\n\nconst getRegularElement = ( {\n\tchild,\n\teventHandlers,\n\tchildrenWithPopover,\n\tmergedRefs,\n} ) => {\n\treturn cloneElement( child, {\n\t\t...eventHandlers,\n\t\tchildren: childrenWithPopover,\n\t\tref: mergedRefs,\n\t} );\n};\n\nconst addPopoverToGrandchildren = ( {\n\tanchorRef,\n\tgrandchildren,\n\tisOver,\n\toffset,\n\tposition,\n\tshortcut,\n\ttext,\n} ) =>\n\tconcatChildren(\n\t\tgrandchildren,\n\t\tisOver && (\n\t\t\t<Popover\n\t\t\t\tfocusOnMount={ false }\n\t\t\t\tposition={ position }\n\t\t\t\tclassName=\"components-tooltip\"\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tanimate={ false }\n\t\t\t\toffset={ offset }\n\t\t\t\tanchorRef={ anchorRef }\n\t\t\t\t__unstableShift\n\t\t\t>\n\t\t\t\t{ text }\n\t\t\t\t<Shortcut\n\t\t\t\t\tclassName=\"components-tooltip__shortcut\"\n\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t/>\n\t\t\t</Popover>\n\t\t)\n\t);\n\nconst emitToChild = ( children, eventName, event ) => {\n\tif ( Children.count( children ) !== 1 ) {\n\t\treturn;\n\t}\n\n\tconst child = Children.only( children );\n\n\t// If the underlying element is disabled, do not emit the event.\n\tif ( child.props.disabled ) {\n\t\treturn;\n\t}\n\n\tif ( typeof child.props[ eventName ] === 'function' ) {\n\t\tchild.props[ eventName ]( event );\n\t}\n};\n\nfunction Tooltip( props ) {\n\tconst {\n\t\tchildren,\n\t\tposition = 'bottom middle',\n\t\ttext,\n\t\tshortcut,\n\t\tdelay = TOOLTIP_DELAY,\n\t} = props;\n\t/**\n\t * Whether a mouse is currently pressed, used in determining whether\n\t * to handle a focus event as displaying the tooltip immediately.\n\t *\n\t * @type {boolean}\n\t */\n\tconst [ isMouseDown, setIsMouseDown ] = useState( false );\n\tconst [ isOver, setIsOver ] = useState( false );\n\tconst delayedSetIsOver = useDebounce( setIsOver, delay );\n\n\t// Create a reference to the Tooltip's child, to be passed to the Popover\n\t// so that the Tooltip can be correctly positioned. Also, merge with the\n\t// existing ref for the first child, so that its ref is preserved.\n\tconst childRef = useRef( null );\n\tconst existingChildRef = Children.toArray( children )[ 0 ]?.ref;\n\tconst mergedChildRefs = useMergeRefs( [ childRef, existingChildRef ] );\n\n\tconst createMouseDown = ( event ) => {\n\t\t// In firefox, the mouse down event is also fired when the select\n\t\t// list is chosen.\n\t\t// Cancel further processing because re-rendering of child components\n\t\t// causes onChange to be triggered with the old value.\n\t\t// See https://github.com/WordPress/gutenberg/pull/42483\n\t\tif ( event.target.tagName === 'OPTION' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Preserve original child callback behavior.\n\t\temitToChild( children, 'onMouseDown', event );\n\n\t\t// On mouse down, the next `mouseup` should revert the value of the\n\t\t// instance property and remove its own event handler. The bind is\n\t\t// made on the document since the `mouseup` might not occur within\n\t\t// the bounds of the element.\n\t\tdocument.addEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( true );\n\t};\n\n\tconst createMouseUp = ( event ) => {\n\t\t// In firefox, the mouse up event is also fired when the select\n\t\t// list is chosen.\n\t\t// Cancel further processing because re-rendering of child components\n\t\t// causes onChange to be triggered with the old value.\n\t\t// See https://github.com/WordPress/gutenberg/pull/42483\n\t\tif ( event.target.tagName === 'OPTION' ) {\n\t\t\treturn;\n\t\t}\n\n\t\temitToChild( children, 'onMouseUp', event );\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( false );\n\t};\n\n\tconst createMouseEvent = ( type ) => {\n\t\tif ( type === 'mouseUp' ) return createMouseUp;\n\t\tif ( type === 'mouseDown' ) return createMouseDown;\n\t};\n\n\t/**\n\t * Prebound `isInMouseDown` handler, created as a constant reference to\n\t * assure ability to remove in component unmount.\n\t *\n\t * @type {Function}\n\t */\n\tconst cancelIsMouseDown = createMouseEvent( 'mouseUp' );\n\n\tconst createToggleIsOver = ( eventName, isDelayed ) => {\n\t\treturn ( event ) => {\n\t\t\t// Preserve original child callback behavior.\n\t\t\temitToChild( children, eventName, event );\n\n\t\t\t// Mouse events behave unreliably in React for disabled elements,\n\t\t\t// firing on mouseenter but not mouseleave. Further, the default\n\t\t\t// behavior for disabled elements in some browsers is to ignore\n\t\t\t// mouse events. Don't bother trying to handle them.\n\t\t\t//\n\t\t\t// See: https://github.com/facebook/react/issues/4251\n\t\t\tif ( event.currentTarget.disabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// A focus event will occur as a result of a mouse click, but it\n\t\t\t// should be disambiguated between interacting with the button and\n\t\t\t// using an explicit focus shift as a cue to display the tooltip.\n\t\t\tif ( 'focus' === event.type && isMouseDown ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Needed in case unsetting is over while delayed set pending, i.e.\n\t\t\t// quickly blur/mouseleave before delayedSetIsOver is called.\n\t\t\tdelayedSetIsOver.cancel();\n\n\t\t\tconst _isOver = [ 'focus', 'mouseenter' ].includes( event.type );\n\t\t\tif ( _isOver === isOver ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( isDelayed ) {\n\t\t\t\tdelayedSetIsOver( _isOver );\n\t\t\t} else {\n\t\t\t\tsetIsOver( _isOver );\n\t\t\t}\n\t\t};\n\t};\n\tconst clearOnUnmount = () => {\n\t\tdelayedSetIsOver.cancel();\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t};\n\n\tuseEffect( () => clearOnUnmount, [] );\n\n\tif ( Children.count( children ) !== 1 ) {\n\t\tif ( 'development' === process.env.NODE_ENV ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'Tooltip should be called with only a single child element.'\n\t\t\t);\n\t\t}\n\n\t\treturn children;\n\t}\n\n\tconst eventHandlers = {\n\t\tonMouseEnter: createToggleIsOver( 'onMouseEnter', true ),\n\t\tonMouseLeave: createToggleIsOver( 'onMouseLeave' ),\n\t\tonClick: createToggleIsOver( 'onClick' ),\n\t\tonFocus: createToggleIsOver( 'onFocus' ),\n\t\tonBlur: createToggleIsOver( 'onBlur' ),\n\t\tonMouseDown: createMouseEvent( 'mouseDown' ),\n\t};\n\n\tconst child = Children.only( children );\n\tconst { children: grandchildren, disabled } = child.props;\n\tconst getElementWithPopover = disabled\n\t\t? getDisabledElement\n\t\t: getRegularElement;\n\n\tconst popoverData = {\n\t\tanchorRef: childRef,\n\t\tisOver,\n\t\toffset: 4,\n\t\tposition,\n\t\tshortcut,\n\t\ttext,\n\t};\n\tconst childrenWithPopover = addPopoverToGrandchildren( {\n\t\tgrandchildren,\n\t\t...popoverData,\n\t} );\n\n\treturn getElementWithPopover( {\n\t\tchild,\n\t\teventHandlers,\n\t\tchildrenWithPopover,\n\t\tmergedRefs: mergedChildRefs,\n\t} );\n}\n\nexport default Tooltip;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tooltip/index.js"],"names":["TOOLTIP_DELAY","eventCatcher","getDisabledElement","eventHandlers","child","childrenWithPopover","mergedRefs","children","ref","getRegularElement","addPopoverToGrandchildren","anchor","grandchildren","isOver","offset","position","shortcut","text","emitToChild","eventName","event","Children","count","only","props","disabled","Tooltip","delay","isMouseDown","setIsMouseDown","setIsOver","delayedSetIsOver","popoverAnchor","setPopoverAnchor","existingChildRef","toArray","mergedChildRefs","createMouseDown","target","tagName","document","addEventListener","cancelIsMouseDown","createMouseUp","removeEventListener","createMouseEvent","type","createToggleIsOver","isDelayed","currentTarget","cancel","_isOver","includes","clearOnUnmount","process","env","NODE_ENV","console","error","onMouseEnter","onMouseLeave","onClick","onFocus","onBlur","onMouseDown","getElementWithPopover","popoverData"],"mappings":";;;;;;;;;AAKA;;AAOA;;AAKA;;AACA;;AAlBA;;AAEA;AACA;AACA;;AAUA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GAAG,GAAtB;;AAEP,MAAMC,YAAY,GAAG;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CAAE,QAAF,CALL;AAMrBiB,IAAAA,WAAW,EAAEnB,gBAAgB,CAAE,WAAF;AANR,GAAtB;;AASA,QAAMzC,KAAK,GAAGiB,kBAASE,IAAT,CAAehB,QAAf,CAAd;;AACA,QAAM;AAAEA,IAAAA,QAAQ,EAAEK,aAAZ;AAA2Ba,IAAAA;AAA3B,MAAwCrB,KAAK,CAACoB,KAApD;AACA,QAAMyC,qBAAqB,GAAGxC,QAAQ,GACnCvB,kBADmC,GAEnCO,iBAFH;AAIA,QAAMyD,WAAW,GAAG;AACnBvD,IAAAA,MAAM,EAAEqB,aADW;AAEnBnB,IAAAA,MAFmB;AAGnBC,IAAAA,MAAM,EAAE,CAHW;AAInBC,IAAAA,QAJmB;AAKnBC,IAAAA,QALmB;AAMnBC,IAAAA;AANmB,GAApB;AAQA,QAAMZ,mBAAmB,GAAGK,yBAAyB,CAAE;AACtDE,IAAAA,aADsD;AAEtD,OAAGsD;AAFmD,GAAF,CAArD;AAKA,SAAOD,qBAAqB,CAAE;AAC7B7D,IAAAA,KAD6B;AAE7BD,IAAAA,aAF6B;AAG7BE,IAAAA,mBAH6B;AAI7BC,IAAAA,UAAU,EAAE8B;AAJiB,GAAF,CAA5B;AAMA;;eAEcV,O","sourcesContent":["// @ts-nocheck\n\n/**\n * WordPress dependencies\n */\nimport {\n\tChildren,\n\tcloneElement,\n\tconcatChildren,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\nimport { useDebounce, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Popover from '../popover';\nimport Shortcut from '../shortcut';\n\n/**\n * Time over children to wait before showing tooltip\n *\n * @type {number}\n */\nexport const TOOLTIP_DELAY = 700;\n\nconst eventCatcher = <div className=\"event-catcher\" />;\n\nconst getDisabledElement = ( {\n\teventHandlers,\n\tchild,\n\tchildrenWithPopover,\n\tmergedRefs,\n} ) => {\n\treturn cloneElement(\n\t\t<span className=\"disabled-element-wrapper\">\n\t\t\t{ cloneElement( eventCatcher, eventHandlers ) }\n\t\t\t{ cloneElement( child, {\n\t\t\t\tchildren: childrenWithPopover,\n\t\t\t\tref: mergedRefs,\n\t\t\t} ) }\n\t\t</span>,\n\t\t{ ...eventHandlers }\n\t);\n};\n\nconst getRegularElement = ( {\n\tchild,\n\teventHandlers,\n\tchildrenWithPopover,\n\tmergedRefs,\n} ) => {\n\treturn cloneElement( child, {\n\t\t...eventHandlers,\n\t\tchildren: childrenWithPopover,\n\t\tref: mergedRefs,\n\t} );\n};\n\nconst addPopoverToGrandchildren = ( {\n\tanchor,\n\tgrandchildren,\n\tisOver,\n\toffset,\n\tposition,\n\tshortcut,\n\ttext,\n} ) =>\n\tconcatChildren(\n\t\tgrandchildren,\n\t\tisOver && (\n\t\t\t<Popover\n\t\t\t\tfocusOnMount={ false }\n\t\t\t\tposition={ position }\n\t\t\t\tclassName=\"components-tooltip\"\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tanimate={ false }\n\t\t\t\toffset={ offset }\n\t\t\t\tanchor={ anchor }\n\t\t\t\tshift\n\t\t\t>\n\t\t\t\t{ text }\n\t\t\t\t<Shortcut\n\t\t\t\t\tclassName=\"components-tooltip__shortcut\"\n\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t/>\n\t\t\t</Popover>\n\t\t)\n\t);\n\nconst emitToChild = ( children, eventName, event ) => {\n\tif ( Children.count( children ) !== 1 ) {\n\t\treturn;\n\t}\n\n\tconst child = Children.only( children );\n\n\t// If the underlying element is disabled, do not emit the event.\n\tif ( child.props.disabled ) {\n\t\treturn;\n\t}\n\n\tif ( typeof child.props[ eventName ] === 'function' ) {\n\t\tchild.props[ eventName ]( event );\n\t}\n};\n\nfunction Tooltip( props ) {\n\tconst {\n\t\tchildren,\n\t\tposition = 'bottom middle',\n\t\ttext,\n\t\tshortcut,\n\t\tdelay = TOOLTIP_DELAY,\n\t} = props;\n\t/**\n\t * Whether a mouse is currently pressed, used in determining whether\n\t * to handle a focus event as displaying the tooltip immediately.\n\t *\n\t * @type {boolean}\n\t */\n\tconst [ isMouseDown, setIsMouseDown ] = useState( false );\n\tconst [ isOver, setIsOver ] = useState( false );\n\tconst delayedSetIsOver = useDebounce( setIsOver, delay );\n\t// Using internal state (instead of a ref) for the popover anchor to make sure\n\t// that the component re-renders when the anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\t// Create a reference to the Tooltip's child, to be passed to the Popover\n\t// so that the Tooltip can be correctly positioned. Also, merge with the\n\t// existing ref for the first child, so that its ref is preserved.\n\tconst existingChildRef = Children.toArray( children )[ 0 ]?.ref;\n\tconst mergedChildRefs = useMergeRefs( [\n\t\tsetPopoverAnchor,\n\t\texistingChildRef,\n\t] );\n\n\tconst createMouseDown = ( event ) => {\n\t\t// In firefox, the mouse down event is also fired when the select\n\t\t// list is chosen.\n\t\t// Cancel further processing because re-rendering of child components\n\t\t// causes onChange to be triggered with the old value.\n\t\t// See https://github.com/WordPress/gutenberg/pull/42483\n\t\tif ( event.target.tagName === 'OPTION' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Preserve original child callback behavior.\n\t\temitToChild( children, 'onMouseDown', event );\n\n\t\t// On mouse down, the next `mouseup` should revert the value of the\n\t\t// instance property and remove its own event handler. The bind is\n\t\t// made on the document since the `mouseup` might not occur within\n\t\t// the bounds of the element.\n\t\tdocument.addEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( true );\n\t};\n\n\tconst createMouseUp = ( event ) => {\n\t\t// In firefox, the mouse up event is also fired when the select\n\t\t// list is chosen.\n\t\t// Cancel further processing because re-rendering of child components\n\t\t// causes onChange to be triggered with the old value.\n\t\t// See https://github.com/WordPress/gutenberg/pull/42483\n\t\tif ( event.target.tagName === 'OPTION' ) {\n\t\t\treturn;\n\t\t}\n\n\t\temitToChild( children, 'onMouseUp', event );\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( false );\n\t};\n\n\tconst createMouseEvent = ( type ) => {\n\t\tif ( type === 'mouseUp' ) return createMouseUp;\n\t\tif ( type === 'mouseDown' ) return createMouseDown;\n\t};\n\n\t/**\n\t * Prebound `isInMouseDown` handler, created as a constant reference to\n\t * assure ability to remove in component unmount.\n\t *\n\t * @type {Function}\n\t */\n\tconst cancelIsMouseDown = createMouseEvent( 'mouseUp' );\n\n\tconst createToggleIsOver = ( eventName, isDelayed ) => {\n\t\treturn ( event ) => {\n\t\t\t// Preserve original child callback behavior.\n\t\t\temitToChild( children, eventName, event );\n\n\t\t\t// Mouse events behave unreliably in React for disabled elements,\n\t\t\t// firing on mouseenter but not mouseleave. Further, the default\n\t\t\t// behavior for disabled elements in some browsers is to ignore\n\t\t\t// mouse events. Don't bother trying to handle them.\n\t\t\t//\n\t\t\t// See: https://github.com/facebook/react/issues/4251\n\t\t\tif ( event.currentTarget.disabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// A focus event will occur as a result of a mouse click, but it\n\t\t\t// should be disambiguated between interacting with the button and\n\t\t\t// using an explicit focus shift as a cue to display the tooltip.\n\t\t\tif ( 'focus' === event.type && isMouseDown ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Needed in case unsetting is over while delayed set pending, i.e.\n\t\t\t// quickly blur/mouseleave before delayedSetIsOver is called.\n\t\t\tdelayedSetIsOver.cancel();\n\n\t\t\tconst _isOver = [ 'focus', 'mouseenter' ].includes( event.type );\n\t\t\tif ( _isOver === isOver ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( isDelayed ) {\n\t\t\t\tdelayedSetIsOver( _isOver );\n\t\t\t} else {\n\t\t\t\tsetIsOver( _isOver );\n\t\t\t}\n\t\t};\n\t};\n\tconst clearOnUnmount = () => {\n\t\tdelayedSetIsOver.cancel();\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t};\n\n\tuseEffect( () => clearOnUnmount, [] );\n\n\tif ( Children.count( children ) !== 1 ) {\n\t\tif ( 'development' === process.env.NODE_ENV ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'Tooltip should be called with only a single child element.'\n\t\t\t);\n\t\t}\n\n\t\treturn children;\n\t}\n\n\tconst eventHandlers = {\n\t\tonMouseEnter: createToggleIsOver( 'onMouseEnter', true ),\n\t\tonMouseLeave: createToggleIsOver( 'onMouseLeave' ),\n\t\tonClick: createToggleIsOver( 'onClick' ),\n\t\tonFocus: createToggleIsOver( 'onFocus' ),\n\t\tonBlur: createToggleIsOver( 'onBlur' ),\n\t\tonMouseDown: createMouseEvent( 'mouseDown' ),\n\t};\n\n\tconst child = Children.only( children );\n\tconst { children: grandchildren, disabled } = child.props;\n\tconst getElementWithPopover = disabled\n\t\t? getDisabledElement\n\t\t: getRegularElement;\n\n\tconst popoverData = {\n\t\tanchor: popoverAnchor,\n\t\tisOver,\n\t\toffset: 4,\n\t\tposition,\n\t\tshortcut,\n\t\ttext,\n\t};\n\tconst childrenWithPopover = addPopoverToGrandchildren( {\n\t\tgrandchildren,\n\t\t...popoverData,\n\t} );\n\n\treturn getElementWithPopover( {\n\t\tchild,\n\t\teventHandlers,\n\t\tchildrenWithPopover,\n\t\tmergedRefs: mergedChildRefs,\n\t} );\n}\n\nexport default Tooltip;\n"]}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.contextConnect = contextConnect;
9
+ exports.contextConnectWithoutRef = contextConnectWithoutRef;
9
10
  exports.getConnectNamespace = getConnectNamespace;
10
11
  exports.hasConnectNamespace = hasConnectNamespace;
11
12
 
@@ -33,30 +34,38 @@ var _getStyledClassNameFromKey = require("./get-styled-class-name-from-key");
33
34
  * Forwards ref (React.ForwardRef) and "Connects" (or registers) a component
34
35
  * within the Context system under a specified namespace.
35
36
  *
36
- * This is an (experimental) evolution of the initial connect() HOC.
37
- * The hope is that we can improve render performance by removing functional
38
- * component wrappers.
39
- *
40
37
  * @param Component The component to register into the Context system.
41
38
  * @param namespace The namespace to register the component under.
42
- * @param options
43
39
  * @return The connected WordPressComponent
44
40
  */
45
41
  function contextConnect(Component, namespace) {
46
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
47
- const {
48
- memo: memoProp = false
49
- } = options;
50
- let WrappedComponent = (0, _element.forwardRef)(Component);
42
+ return _contextConnect(Component, namespace, {
43
+ forwardsRef: true
44
+ });
45
+ }
46
+ /**
47
+ * "Connects" (or registers) a component within the Context system under a specified namespace.
48
+ * Does not forward a ref.
49
+ *
50
+ * @param Component The component to register into the Context system.
51
+ * @param namespace The namespace to register the component under.
52
+ * @return The connected WordPressComponent
53
+ */
54
+
55
+
56
+ function contextConnectWithoutRef(Component, namespace) {
57
+ return _contextConnect(Component, namespace);
58
+ } // This is an (experimental) evolution of the initial connect() HOC.
59
+ // The hope is that we can improve render performance by removing functional
60
+ // component wrappers.
51
61
 
52
- if (memoProp) {
53
- // @ts-ignore
54
- WrappedComponent = (0, _element.memo)(WrappedComponent);
55
- }
62
+
63
+ function _contextConnect(Component, namespace, options) {
64
+ const WrappedComponent = options !== null && options !== void 0 && options.forwardsRef ? (0, _element.forwardRef)(Component) : Component;
56
65
 
57
66
  if (typeof namespace === 'undefined') {
58
67
  typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" ? (0, _warning.default)('contextConnect: Please provide a namespace') : void 0;
59
- } // @ts-ignore internal property
68
+ } // @ts-expect-error internal property
60
69
 
61
70
 
62
71
  let mergedNamespace = WrappedComponent[_constants.CONNECT_STATIC_NAMESPACE] || [namespace];
@@ -70,15 +79,15 @@ function contextConnect(Component, namespace) {
70
79
 
71
80
  if (typeof namespace === 'string') {
72
81
  mergedNamespace = [...mergedNamespace, namespace];
73
- }
74
-
75
- WrappedComponent.displayName = namespace; // @ts-ignore internal property
76
-
77
- WrappedComponent[_constants.CONNECT_STATIC_NAMESPACE] = [...new Set(mergedNamespace)]; // @ts-ignore WordPressComponent property
82
+ } // @ts-expect-error We can't rely on inferred types here because of the
83
+ // `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/9620bae6fef4fde7cc2b7833f416e240207cda29/packages/components/src/ui/context/wordpress-component.ts#L32-L33
78
84
 
79
- WrappedComponent.selector = `.${(0, _getStyledClassNameFromKey.getStyledClassNameFromKey)(namespace)}`; // @ts-ignore
80
85
 
81
- return WrappedComponent;
86
+ return Object.assign(WrappedComponent, {
87
+ [_constants.CONNECT_STATIC_NAMESPACE]: [...new Set(mergedNamespace)],
88
+ displayName: namespace,
89
+ selector: `.${(0, _getStyledClassNameFromKey.getStyledClassNameFromKey)(namespace)}`
90
+ });
82
91
  }
83
92
  /**
84
93
  * Attempts to retrieve the connected namespace from a component.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/context/context-connect.ts"],"names":["contextConnect","Component","namespace","options","memo","memoProp","WrappedComponent","mergedNamespace","CONNECT_STATIC_NAMESPACE","Array","isArray","displayName","Set","selector","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"mappings":";;;;;;;;;;;AAQA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAT,CACNC,SADM,EAENC,SAFM,EAI6B;AAAA,MADnCC,OACmC,uEADF,EACE;AACnC,QAAM;AAAEC,IAAAA,IAAI,EAAEC,QAAQ,GAAG;AAAnB,MAA6BF,OAAnC;AAEA,MAAIG,gBAAgB,GAAG,yBAAYL,SAAZ,CAAvB;;AACA,MAAKI,QAAL,EAAgB;AACf;AACAC,IAAAA,gBAAgB,GAAG,mBAAMA,gBAAN,CAAnB;AACA;;AAED,MAAK,OAAOJ,SAAP,KAAqB,WAA1B,EAAwC;AACvC,mHAAM,4CAAN;AACA,GAXkC,CAanC;;;AACA,MAAIK,eAAe,GAAGD,gBAAgB,CAAEE,mCAAF,CAAhB,IAAgD,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,KAAiB,QAAtB,EAAiC;AAChC,WAAOJ,mBAAmB,CAAEb,SAAF,CAAnB,CAAiCkB,QAAjC,CAA2CD,KAA3C,CAAP;AACA;;AACD,MAAKT,KAAK,CAACC,OAAN,CAAeQ,KAAf,CAAL,EAA8B;AAC7B,WAAOA,KAAK,CAACE,IAAN,CAAcC,MAAF,IAClBP,mBAAmB,CAAEb,SAAF,CAAnB,CAAiCkB,QAAjC,CAA2CE,MAA3C,CADM,CAAP;AAGA;;AAED,SAAO,KAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, ReactChild, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, memo } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport type { WordPressComponentFromProps } from '.';\n\ntype ContextConnectOptions = {\n\t/** Defaults to `false`. */\n\tmemo?: boolean;\n};\n\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * This is an (experimental) evolution of the initial connect() HOC.\n * The hope is that we can improve render performance by removing functional\n * component wrappers.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @param options\n * @return The connected WordPressComponent\n */\nexport function contextConnect< P >(\n\tComponent: ( props: P, ref: ForwardedRef< any > ) => JSX.Element | null,\n\tnamespace: string,\n\toptions: ContextConnectOptions = {}\n): WordPressComponentFromProps< P > {\n\tconst { memo: memoProp = false } = options;\n\n\tlet WrappedComponent = forwardRef( Component );\n\tif ( memoProp ) {\n\t\t// @ts-ignore\n\t\tWrappedComponent = memo( WrappedComponent );\n\t}\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-ignore internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\tWrappedComponent.displayName = namespace;\n\n\t// @ts-ignore internal property\n\tWrappedComponent[ CONNECT_STATIC_NAMESPACE ] = [\n\t\t...new Set( mergedNamespace ),\n\t];\n\n\t// @ts-ignore WordPressComponent property\n\tWrappedComponent.selector = `.${ getStyledClassNameFromKey( namespace ) }`;\n\n\t// @ts-ignore\n\treturn WrappedComponent;\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param Component The component to retrieve a namespace from.\n * @return The connected namespaces.\n */\nexport function getConnectNamespace(\n\tComponent: ReactChild | undefined | {}\n): string[] {\n\tif ( ! Component ) return [];\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param Component The component to retrieve a namespace from.\n * @param match The namespace to check.\n */\nexport function hasConnectNamespace(\n\tComponent: ReactNode,\n\tmatch: string[] | string\n): boolean {\n\tif ( ! Component ) return false;\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/context/context-connect.ts"],"names":["contextConnect","Component","namespace","_contextConnect","forwardsRef","contextConnectWithoutRef","options","WrappedComponent","mergedNamespace","CONNECT_STATIC_NAMESPACE","Array","isArray","Object","assign","Set","displayName","selector","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"mappings":";;;;;;;;;;;;AAQA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAT,CAGNC,SAHM,EAQNC,SARM,EASL;AACD,SAAOC,eAAe,CAAEF,SAAF,EAAaC,SAAb,EAAwB;AAAEE,IAAAA,WAAW,EAAE;AAAf,GAAxB,CAAtB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,wBAAT,CACNJ,SADM,EAENC,SAFM,EAGL;AACD,SAAOC,eAAe,CAAEF,SAAF,EAAaC,SAAb,CAAtB;AACA,C,CAED;AACA;AACA;;;AACA,SAASC,eAAT,CAICF,SAJD,EAKCC,SALD,EAMCI,OAND,EAUE;AACD,QAAMC,gBAAgB,GAAGD,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAEF,WAAT,GACtB,yBAAyCH,SAAzC,CADsB,GAEtBA,SAFH;;AAIA,MAAK,OAAOC,SAAP,KAAqB,WAA1B,EAAwC;AACvC,mHAAM,4CAAN;AACA,GAPA,CASD;;;AACA,MAAIM,eAAe,GAAGD,gBAAgB,CAAEE,mCAAF,CAAhB,IAAgD,CACrEP,SADqE,CAAtE;AAIA;AACD;AACA;;AACC,MAAKQ,KAAK,CAACC,OAAN,CAAeT,SAAf,CAAL,EAAkC;AACjCM,IAAAA,eAAe,GAAG,CAAE,GAAGA,eAAL,EAAsB,GAAGN,SAAzB,CAAlB;AACA;;AACD,MAAK,OAAOA,SAAP,KAAqB,QAA1B,EAA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CAAnB,CAAiCqB,QAAjC,CAA2CE,MAA3C,CADM,CAAP;AAGA;;AAED,SAAO,KAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, ReactChild, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport type { WordPressComponentFromProps } from '.';\n\ntype AcceptsTwoArgs<\n\tF extends ( ...args: any ) => any,\n\tErrorMessage = never\n> = Parameters< F >[ 'length' ] extends 2 ? {} : ErrorMessage;\n\ntype ContextConnectOptions = {\n\tforwardsRef?: boolean;\n};\n\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null\n>(\n\tComponent: C &\n\t\tAcceptsTwoArgs<\n\t\t\tC,\n\t\t\t'Warning: Your component function does not take a ref as the second argument. Did you mean to use `contextConnectWithoutRef`?'\n\t\t>,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace, { forwardsRef: true } );\n}\n\n/**\n * \"Connects\" (or registers) a component within the Context system under a specified namespace.\n * Does not forward a ref.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnectWithoutRef< P >(\n\tComponent: ( props: P ) => JSX.Element | null,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace );\n}\n\n// This is an (experimental) evolution of the initial connect() HOC.\n// The hope is that we can improve render performance by removing functional\n// component wrappers.\nfunction _contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n\tO extends ContextConnectOptions\n>(\n\tComponent: C,\n\tnamespace: string,\n\toptions?: O\n): WordPressComponentFromProps<\n\tParameters< C >[ 0 ],\n\tO[ 'forwardsRef' ] extends true ? true : false\n> {\n\tconst WrappedComponent = options?.forwardsRef\n\t\t? forwardRef< any, Parameters< C >[ 0 ] >( Component )\n\t\t: Component;\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-expect-error internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\t// @ts-expect-error We can't rely on inferred types here because of the\n\t// `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/9620bae6fef4fde7cc2b7833f416e240207cda29/packages/components/src/ui/context/wordpress-component.ts#L32-L33\n\treturn Object.assign( WrappedComponent, {\n\t\t[ CONNECT_STATIC_NAMESPACE ]: [ ...new Set( mergedNamespace ) ],\n\t\tdisplayName: namespace,\n\t\tselector: `.${ getStyledClassNameFromKey( namespace ) }`,\n\t} );\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param Component The component to retrieve a namespace from.\n * @return The connected namespaces.\n */\nexport function getConnectNamespace(\n\tComponent: ReactChild | undefined | {}\n): string[] {\n\tif ( ! Component ) return [];\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param Component The component to retrieve a namespace from.\n * @param match The namespace to check.\n */\nexport function hasConnectNamespace(\n\tComponent: ReactNode,\n\tmatch: string[] | string\n): boolean {\n\tif ( ! Component ) return false;\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"]}
@@ -73,7 +73,7 @@ function useContextSystemBridge(_ref) {
73
73
  }, [value]); // `parentContext` will always be memoized (i.e., the result of this hook itself)
74
74
  // or the default value from when the `ComponentsContext` was originally
75
75
  // initialized (which will never change, it's a static variable)
76
- // so this memoization will prevent `merge` and `cloneDeep` from rerunning unless
76
+ // so this memoization will prevent `merge` and `JSON.parse/stringify` from rerunning unless
77
77
  // the references to `value` change OR the `parentContext` has an actual material change
78
78
  // (because again, it's guaranteed to be memoized or a static reference to the empty object
79
79
  // so we know that the only changes for `parentContext` are material ones... i.e., why we
@@ -81,10 +81,11 @@ function useContextSystemBridge(_ref) {
81
81
  // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are
82
82
  // correctly warning when the `value` isn't being properly memoized. All of that to say
83
83
  // that this should be super safe to assume that `useMemo` will only run on actual
84
- // changes to the two dependencies, therefore saving us calls to `merge` and `cloneDeep`!
84
+ // changes to the two dependencies, therefore saving us calls to `merge` and `JSON.parse/stringify`!
85
85
 
86
86
  const config = (0, _element.useMemo)(() => {
87
- return (0, _lodash.merge)((0, _lodash.cloneDeep)(parentContext), value);
87
+ // Deep clone `parentContext` to avoid mutating it later.
88
+ return (0, _lodash.merge)(JSON.parse(JSON.stringify(parentContext)), value);
88
89
  }, [parentContext, value]);
89
90
  return config;
90
91
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/context/context-system-provider.js"],"names":["ComponentsContext","useComponentsContext","useUpdateEffect","effect","deps","mounted","current","undefined","useContextSystemBridge","value","parentContext","valueRef","JSON","stringify","config","BaseContextSystemProvider","children","contextValue","ContextSystemProvider"],"mappings":";;;;;;;;;AAQA;;AALA;;AAaA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;AAWO,MAAMA,iBAAiB,GAAG;AAChC;AAAqC,EADL,CAA1B;;;AAGA,MAAMC,oBAAoB,GAAG,MAAM,yBAAYD,iBAAZ,CAAnC;AAEP;AACA;AACA;AACA;AACA;AACA;;;;;AACA,SAASE,eAAT,CAA0BC,MAA1B,EAAkCC,IAAlC,EAAyC;AACxC,QAAMC,OAAO,GAAG,qBAAQ,KAAR,CAAhB;AACA,0BAAW,MAAM;AAChB,QAAKA,OAAO,CAACC,OAAb,EAAuB;AACtB,aAAOH,MAAM,EAAb;AACA;;AACDE,IAAAA,OAAO,CAACC,OAAR,GAAkB,IAAlB;AACA,WAAOC,SAAP;AACA,GAND,EAMGH,IANH;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASI,sBAAT,OAA6C;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AAC5C,QAAMC,aAAa,GAAGT,oBAAoB,EAA1C;AAEA,QAAMU,QAAQ,GAAG,qBAAQF,KAAR,CAAjB;AAEAP,EAAAA,eAAe,CAAE,MAAM;AACtB,SACC;AACA,yBAASS,QAAQ,CAACL,OAAlB,EAA2BG,KAA3B,KACA;AACAE,IAAAA,QAAQ,CAACL,OAAT,KAAqBG,KAJtB,EAKE;AACD,qHAAO,gCAAgCG,IAAI,CAACC,SAAL,CAAgBJ,KAAhB,CAAyB,EAAhE;AACA;AACD,GATc,EASZ,CAAEA,KAAF,CATY,CAAf,CAL4C,CAgB5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,QAAMK,MAAM,GAAG,sBAAS,MAAM;AAC7B,WAAO,mBAAO,uBAAWJ,aAAX,CAAP,EAAmCD,KAAnC,CAAP;AACA,GAFc,EAEZ,CAAEC,aAAF,EAAiBD,KAAjB,CAFY,CAAf;AAIA,SAAOK,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMC,yBAAyB,GAAG,SAA2B;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYP,IAAAA;AAAZ,GAAyB;AAC5D,QAAMQ,YAAY,GAAGT,sBAAsB,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAA3C;AAEA,SACC,4BAAC,iBAAD,CAAmB,QAAnB;AAA4B,IAAA,KAAK,EAAGQ;AAApC,KACGD,QADH,CADD;AAKA,CARD;;AAUO,MAAME,qBAAqB,GAAG,mBAAMH,yBAAN,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual, merge, cloneDeep } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseEffect,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\nexport const useComponentsContext = () => useContext( ComponentsContext );\n\n/**\n * Runs an effect only on update (i.e., ignores the first render)\n *\n * @param {import('react').EffectCallback} effect\n * @param {import('react').DependencyList} deps\n */\nfunction useUpdateEffect( effect, deps ) {\n\tconst mounted = useRef( false );\n\tuseEffect( () => {\n\t\tif ( mounted.current ) {\n\t\t\treturn effect();\n\t\t}\n\t\tmounted.current = true;\n\t\treturn undefined;\n\t}, deps );\n}\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// Objects are equivalent.\n\t\t\tisEqual( valueRef.current, value ) &&\n\t\t\t// But not the same reference.\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `merge` and `cloneDeep` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `merge` and `cloneDeep`!\n\tconst config = useMemo( () => {\n\t\treturn merge( cloneDeep( parentContext ), value );\n\t}, [ parentContext, value ] );\n\n\treturn config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/context/context-system-provider.js"],"names":["ComponentsContext","useComponentsContext","useUpdateEffect","effect","deps","mounted","current","undefined","useContextSystemBridge","value","parentContext","valueRef","JSON","stringify","config","parse","BaseContextSystemProvider","children","contextValue","ContextSystemProvider"],"mappings":";;;;;;;;;AAQA;;AALA;;AAaA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;AAWO,MAAMA,iBAAiB,GAAG;AAChC;AAAqC,EADL,CAA1B;;;AAGA,MAAMC,oBAAoB,GAAG,MAAM,yBAAYD,iBAAZ,CAAnC;AAEP;AACA;AACA;AACA;AACA;AACA;;;;;AACA,SAASE,eAAT,CAA0BC,MAA1B,EAAkCC,IAAlC,EAAyC;AACxC,QAAMC,OAAO,GAAG,qBAAQ,KAAR,CAAhB;AACA,0BAAW,MAAM;AAChB,QAAKA,OAAO,CAACC,OAAb,EAAuB;AACtB,aAAOH,MAAM,EAAb;AACA;;AACDE,IAAAA,OAAO,CAACC,OAAR,GAAkB,IAAlB;AACA,WAAOC,SAAP;AACA,GAND,EAMGH,IANH;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASI,sBAAT,OAA6C;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AAC5C,QAAMC,aAAa,GAAGT,oBAAoB,EAA1C;AAEA,QAAMU,QAAQ,GAAG,qBAAQF,KAAR,CAAjB;AAEAP,EAAAA,eAAe,CAAE,MAAM;AACtB,SACC;AACA,yBAASS,QAAQ,CAACL,OAAlB,EAA2BG,KAA3B,KACA;AACAE,IAAAA,QAAQ,CAACL,OAAT,KAAqBG,KAJtB,EAKE;AACD,qHAAO,gCAAgCG,IAAI,CAACC,SAAL,CAAgBJ,KAAhB,CAAyB,EAAhE;AACA;AACD,GATc,EASZ,CAAEA,KAAF,CATY,CAAf,CAL4C,CAgB5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,QAAMK,MAAM,GAAG,sBAAS,MAAM;AAC7B;AACA,WAAO,mBAAOF,IAAI,CAACG,KAAL,CAAYH,IAAI,CAACC,SAAL,CAAgBH,aAAhB,CAAZ,CAAP,EAAsDD,KAAtD,CAAP;AACA,GAHc,EAGZ,CAAEC,aAAF,EAAiBD,KAAjB,CAHY,CAAf;AAKA,SAAOK,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,yBAAyB,GAAG,SAA2B;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYR,IAAAA;AAAZ,GAAyB;AAC5D,QAAMS,YAAY,GAAGV,sBAAsB,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAA3C;AAEA,SACC,4BAAC,iBAAD,CAAmB,QAAnB;AAA4B,IAAA,KAAK,EAAGS;AAApC,KACGD,QADH,CADD;AAKA,CARD;;AAUO,MAAME,qBAAqB,GAAG,mBAAMH,yBAAN,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual, merge } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseEffect,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\nexport const useComponentsContext = () => useContext( ComponentsContext );\n\n/**\n * Runs an effect only on update (i.e., ignores the first render)\n *\n * @param {import('react').EffectCallback} effect\n * @param {import('react').DependencyList} deps\n */\nfunction useUpdateEffect( effect, deps ) {\n\tconst mounted = useRef( false );\n\tuseEffect( () => {\n\t\tif ( mounted.current ) {\n\t\t\treturn effect();\n\t\t}\n\t\tmounted.current = true;\n\t\treturn undefined;\n\t}, deps );\n}\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// Objects are equivalent.\n\t\t\tisEqual( valueRef.current, value ) &&\n\t\t\t// But not the same reference.\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `merge` and `JSON.parse/stringify` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `merge` and `JSON.parse/stringify`!\n\tconst config = useMemo( () => {\n\t\t// Deep clone `parentContext` to avoid mutating it later.\n\t\treturn merge( JSON.parse( JSON.stringify( parentContext ) ), value );\n\t}, [ parentContext, value ] );\n\n\treturn config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"]}
@@ -54,6 +54,7 @@ function UnforwardedUnitControl(unitControlProps, forwardedRef) {
54
54
  const {
55
55
  __unstableStateReducer: stateReducerProp,
56
56
  autoComplete = 'off',
57
+ // @ts-expect-error Ensure that children is omitted from restProps
57
58
  children,
58
59
  className,
59
60
  disabled = false,
@@ -233,7 +234,6 @@ function UnforwardedUnitControl(unitControlProps, forwardedRef) {
233
234
  className: "components-unit-control-wrapper",
234
235
  style: style
235
236
  }, (0, _element.createElement)(_unitControlStyles.ValueInput, (0, _extends2.default)({
236
- "aria-label": label,
237
237
  type: isPressEnterToChange ? 'text' : 'number'
238
238
  }, props, {
239
239
  autoComplete: autoComplete,