@wordpress/components 21.2.0 → 22.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (831) hide show
  1. package/CHANGELOG.md +99 -3
  2. package/CONTRIBUTING.md +20 -0
  3. package/build/angle-picker-control/index.js +1 -1
  4. package/build/angle-picker-control/index.js.map +1 -1
  5. package/build/autocomplete/autocompleter-ui.js +28 -2
  6. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  7. package/build/border-box-control/border-box-control/component.js +65 -15
  8. package/build/border-box-control/border-box-control/component.js.map +1 -1
  9. package/build/border-box-control/border-box-control/hook.js +11 -4
  10. package/build/border-box-control/border-box-control/hook.js.map +1 -1
  11. package/build/border-box-control/border-box-control-linked-button/hook.js +3 -3
  12. package/build/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
  13. package/build/border-box-control/border-box-control-split-controls/component.js +3 -3
  14. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  15. package/build/border-box-control/border-box-control-split-controls/hook.js +8 -11
  16. package/build/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
  17. package/build/border-box-control/border-box-control-visualizer/hook.js +3 -7
  18. package/build/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
  19. package/build/border-box-control/styles.js +34 -34
  20. package/build/border-box-control/styles.js.map +1 -1
  21. package/build/border-control/border-control/component.js +7 -4
  22. package/build/border-control/border-control/component.js.map +1 -1
  23. package/build/border-control/border-control/hook.js +12 -5
  24. package/build/border-control/border-control/hook.js.map +1 -1
  25. package/build/border-control/border-control-dropdown/hook.js +5 -5
  26. package/build/border-control/border-control-dropdown/hook.js.map +1 -1
  27. package/build/border-control/styles.js +19 -34
  28. package/build/border-control/styles.js.map +1 -1
  29. package/build/box-control/index.js +6 -2
  30. package/build/box-control/index.js.map +1 -1
  31. package/build/circular-option-picker/index.js +14 -14
  32. package/build/circular-option-picker/index.js.map +1 -1
  33. package/build/color-palette/index.js +83 -30
  34. package/build/color-palette/index.js.map +1 -1
  35. package/build/color-palette/styles.js +3 -3
  36. package/build/color-palette/styles.js.map +1 -1
  37. package/build/color-palette/types.js +6 -0
  38. package/build/color-palette/types.js.map +1 -0
  39. package/build/color-picker/input-with-slider.js +1 -1
  40. package/build/color-picker/input-with-slider.js.map +1 -1
  41. package/build/custom-gradient-picker/gradient-bar/index.js +1 -3
  42. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  43. package/build/custom-select-control/index.js +8 -4
  44. package/build/custom-select-control/index.js.map +1 -1
  45. package/build/date-time/date-time/index.js +2 -0
  46. package/build/date-time/date-time/index.js.map +1 -1
  47. package/build/date-time/time/index.js +4 -4
  48. package/build/date-time/time/index.js.map +1 -1
  49. package/build/disabled/index.js +14 -27
  50. package/build/disabled/index.js.map +1 -1
  51. package/build/external-link/index.js +13 -2
  52. package/build/external-link/index.js.map +1 -1
  53. package/build/focusable-iframe/index.js +0 -1
  54. package/build/focusable-iframe/index.js.map +1 -1
  55. package/build/font-size-picker/index.js +62 -49
  56. package/build/font-size-picker/index.js.map +1 -1
  57. package/build/font-size-picker/styles.js +5 -13
  58. package/build/font-size-picker/styles.js.map +1 -1
  59. package/build/font-size-picker/utils.js +1 -22
  60. package/build/font-size-picker/utils.js.map +1 -1
  61. package/build/form-file-upload/index.js.map +1 -1
  62. package/build/form-token-field/suggestions-list.js +5 -5
  63. package/build/form-token-field/suggestions-list.js.map +1 -1
  64. package/build/higher-order/with-fallback-styles/index.js +1 -1
  65. package/build/higher-order/with-fallback-styles/index.js.map +1 -1
  66. package/build/higher-order/with-filters/index.js +1 -7
  67. package/build/higher-order/with-filters/index.js.map +1 -1
  68. package/build/index.js +15 -7
  69. package/build/index.js.map +1 -1
  70. package/build/input-control/index.js +2 -0
  71. package/build/input-control/index.js.map +1 -1
  72. package/build/input-control/input-base.js +1 -1
  73. package/build/input-control/input-base.js.map +1 -1
  74. package/build/input-control/styles/input-control-styles.js +21 -21
  75. package/build/input-control/styles/input-control-styles.js.map +1 -1
  76. package/build/isolated-event-container/index.js +5 -9
  77. package/build/isolated-event-container/index.js.map +1 -1
  78. package/build/item-group/styles.js +10 -10
  79. package/build/item-group/styles.js.map +1 -1
  80. package/build/modal/aria-helper.js +2 -3
  81. package/build/modal/aria-helper.js.map +1 -1
  82. package/build/modal/index.js +42 -11
  83. package/build/modal/index.js.map +1 -1
  84. package/build/modal/types.js +6 -0
  85. package/build/modal/types.js.map +1 -0
  86. package/build/navigator/index.js +8 -8
  87. package/build/navigator/index.js.map +1 -1
  88. package/build/navigator/navigator-back-button/component.js +5 -4
  89. package/build/navigator/navigator-back-button/component.js.map +1 -1
  90. package/build/navigator/navigator-back-button/index.js +1 -1
  91. package/build/navigator/navigator-back-button/index.js.map +1 -1
  92. package/build/navigator/navigator-button/component.js +5 -4
  93. package/build/navigator/navigator-button/component.js.map +1 -1
  94. package/build/navigator/navigator-button/index.js +1 -1
  95. package/build/navigator/navigator-button/index.js.map +1 -1
  96. package/build/navigator/navigator-provider/component.js +10 -7
  97. package/build/navigator/navigator-provider/component.js.map +1 -1
  98. package/build/navigator/navigator-provider/index.js +1 -1
  99. package/build/navigator/navigator-provider/index.js.map +1 -1
  100. package/build/navigator/navigator-screen/component.js +11 -8
  101. package/build/navigator/navigator-screen/component.js.map +1 -1
  102. package/build/navigator/navigator-screen/index.js +1 -1
  103. package/build/navigator/navigator-screen/index.js.map +1 -1
  104. package/build/number-control/index.js +82 -22
  105. package/build/number-control/index.js.map +1 -1
  106. package/build/number-control/styles/number-control-styles.js +36 -6
  107. package/build/number-control/styles/number-control-styles.js.map +1 -1
  108. package/build/popover/index.js +15 -29
  109. package/build/popover/index.js.map +1 -1
  110. package/build/radio-group/index.js +7 -1
  111. package/build/radio-group/index.js.map +1 -1
  112. package/build/{radio → radio-group/radio}/index.js +7 -1
  113. package/build/radio-group/radio/index.js.map +1 -0
  114. package/build/{radio-context → radio-group/radio-context}/index.js +0 -0
  115. package/build/radio-group/radio-context/index.js.map +1 -0
  116. package/build/sandbox/index.js +55 -59
  117. package/build/sandbox/index.js.map +1 -1
  118. package/build/sandbox/index.native.js +63 -62
  119. package/build/sandbox/index.native.js.map +1 -1
  120. package/build/slot-fill/bubbles-virtually/fill.js +9 -5
  121. package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
  122. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
  123. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  124. package/build/slot-fill/bubbles-virtually/slot.js +13 -8
  125. package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
  126. package/build/slot-fill/bubbles-virtually/use-slot.js +15 -9
  127. package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  128. package/build/slot-fill/fill.js +12 -4
  129. package/build/slot-fill/fill.js.map +1 -1
  130. package/build/slot-fill/use-slot.js +3 -1
  131. package/build/slot-fill/use-slot.js.map +1 -1
  132. package/build/snackbar/index.js +1 -1
  133. package/build/snackbar/index.js.map +1 -1
  134. package/build/tab-panel/index.js +5 -9
  135. package/build/tab-panel/index.js.map +1 -1
  136. package/build/text-control/index.js +0 -2
  137. package/build/text-control/index.js.map +1 -1
  138. package/build/theme/index.js +62 -0
  139. package/build/theme/index.js.map +1 -0
  140. package/build/theme/styles.js +33 -0
  141. package/build/theme/styles.js.map +1 -0
  142. package/build/theme/types.js +6 -0
  143. package/build/theme/types.js.map +1 -0
  144. package/build/toggle-control/index.js +15 -3
  145. package/build/toggle-control/index.js.map +1 -1
  146. package/build/toggle-group-control/toggle-group-control/as-button-group.js +90 -0
  147. package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -0
  148. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +90 -0
  149. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -0
  150. package/build/toggle-group-control/toggle-group-control/component.js +21 -50
  151. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  152. package/build/toggle-group-control/toggle-group-control/styles.js +8 -8
  153. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  154. package/build/toggle-group-control/toggle-group-control-option-base/component.js +39 -17
  155. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  156. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +23 -23
  157. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  158. package/build/toolbar-dropdown-menu/index.js +1 -1
  159. package/build/toolbar-dropdown-menu/index.js.map +1 -1
  160. package/build/tools-panel/tools-panel/hook.js +3 -3
  161. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  162. package/build/tools-panel/tools-panel-item/hook.js +6 -6
  163. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  164. package/build/tooltip/index.js +4 -1
  165. package/build/tooltip/index.js.map +1 -1
  166. package/build/tooltip/index.native.js +17 -4
  167. package/build/tooltip/index.native.js.map +1 -1
  168. package/build/ui/context/context-system-provider.js +9 -22
  169. package/build/ui/context/context-system-provider.js.map +1 -1
  170. package/build/unit-control/index.js +7 -9
  171. package/build/unit-control/index.js.map +1 -1
  172. package/build/unit-control/styles/unit-control-styles.js +15 -25
  173. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  174. package/build/utils/config-values.js +0 -1
  175. package/build/utils/config-values.js.map +1 -1
  176. package/build/utils/hooks/use-update-effect.js +5 -1
  177. package/build/utils/hooks/use-update-effect.js.map +1 -1
  178. package/build-module/angle-picker-control/index.js +1 -1
  179. package/build-module/angle-picker-control/index.js.map +1 -1
  180. package/build-module/autocomplete/autocompleter-ui.js +29 -3
  181. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  182. package/build-module/border-box-control/border-box-control/component.js +63 -13
  183. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  184. package/build-module/border-box-control/border-box-control/hook.js +11 -4
  185. package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
  186. package/build-module/border-box-control/border-box-control-linked-button/hook.js +3 -3
  187. package/build-module/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
  188. package/build-module/border-box-control/border-box-control-split-controls/component.js +3 -3
  189. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  190. package/build-module/border-box-control/border-box-control-split-controls/hook.js +9 -10
  191. package/build-module/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
  192. package/build-module/border-box-control/border-box-control-visualizer/hook.js +4 -6
  193. package/build-module/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
  194. package/build-module/border-box-control/styles.js +26 -28
  195. package/build-module/border-box-control/styles.js.map +1 -1
  196. package/build-module/border-control/border-control/component.js +7 -4
  197. package/build-module/border-control/border-control/component.js.map +1 -1
  198. package/build-module/border-control/border-control/hook.js +12 -5
  199. package/build-module/border-control/border-control/hook.js.map +1 -1
  200. package/build-module/border-control/border-control-dropdown/hook.js +5 -5
  201. package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
  202. package/build-module/border-control/styles.js +20 -36
  203. package/build-module/border-control/styles.js.map +1 -1
  204. package/build-module/box-control/index.js +6 -2
  205. package/build-module/box-control/index.js.map +1 -1
  206. package/build-module/circular-option-picker/index.js +14 -14
  207. package/build-module/circular-option-picker/index.js.map +1 -1
  208. package/build-module/color-palette/index.js +81 -28
  209. package/build-module/color-palette/index.js.map +1 -1
  210. package/build-module/color-palette/styles.js +3 -3
  211. package/build-module/color-palette/styles.js.map +1 -1
  212. package/build-module/color-palette/types.js +2 -0
  213. package/build-module/color-palette/types.js.map +1 -0
  214. package/build-module/color-picker/input-with-slider.js +1 -1
  215. package/build-module/color-picker/input-with-slider.js.map +1 -1
  216. package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -2
  217. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  218. package/build-module/custom-select-control/index.js +8 -4
  219. package/build-module/custom-select-control/index.js.map +1 -1
  220. package/build-module/date-time/date-time/index.js +2 -0
  221. package/build-module/date-time/date-time/index.js.map +1 -1
  222. package/build-module/date-time/time/index.js +4 -4
  223. package/build-module/date-time/time/index.js.map +1 -1
  224. package/build-module/disabled/index.js +15 -27
  225. package/build-module/disabled/index.js.map +1 -1
  226. package/build-module/external-link/index.js +13 -2
  227. package/build-module/external-link/index.js.map +1 -1
  228. package/build-module/focusable-iframe/index.js +0 -1
  229. package/build-module/focusable-iframe/index.js.map +1 -1
  230. package/build-module/font-size-picker/index.js +66 -51
  231. package/build-module/font-size-picker/index.js.map +1 -1
  232. package/build-module/font-size-picker/styles.js +5 -13
  233. package/build-module/font-size-picker/styles.js.map +1 -1
  234. package/build-module/font-size-picker/utils.js +1 -20
  235. package/build-module/font-size-picker/utils.js.map +1 -1
  236. package/build-module/form-file-upload/index.js.map +1 -1
  237. package/build-module/form-token-field/suggestions-list.js +5 -5
  238. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  239. package/build-module/higher-order/with-fallback-styles/index.js +2 -2
  240. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  241. package/build-module/higher-order/with-filters/index.js +1 -6
  242. package/build-module/higher-order/with-filters/index.js.map +1 -1
  243. package/build-module/index.js +4 -3
  244. package/build-module/index.js.map +1 -1
  245. package/build-module/input-control/index.js +2 -0
  246. package/build-module/input-control/index.js.map +1 -1
  247. package/build-module/input-control/input-base.js +1 -1
  248. package/build-module/input-control/input-base.js.map +1 -1
  249. package/build-module/input-control/styles/input-control-styles.js +21 -21
  250. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  251. package/build-module/isolated-event-container/index.js +7 -9
  252. package/build-module/isolated-event-container/index.js.map +1 -1
  253. package/build-module/item-group/styles.js +10 -10
  254. package/build-module/item-group/styles.js.map +1 -1
  255. package/build-module/modal/aria-helper.js +2 -3
  256. package/build-module/modal/aria-helper.js.map +1 -1
  257. package/build-module/modal/index.js +44 -12
  258. package/build-module/modal/index.js.map +1 -1
  259. package/build-module/modal/types.js +2 -0
  260. package/build-module/modal/types.js.map +1 -0
  261. package/build-module/navigator/index.js +4 -4
  262. package/build-module/navigator/index.js.map +1 -1
  263. package/build-module/navigator/navigator-back-button/component.js +3 -3
  264. package/build-module/navigator/navigator-back-button/component.js.map +1 -1
  265. package/build-module/navigator/navigator-back-button/index.js +1 -1
  266. package/build-module/navigator/navigator-back-button/index.js.map +1 -1
  267. package/build-module/navigator/navigator-button/component.js +3 -3
  268. package/build-module/navigator/navigator-button/component.js.map +1 -1
  269. package/build-module/navigator/navigator-button/index.js +1 -1
  270. package/build-module/navigator/navigator-button/index.js.map +1 -1
  271. package/build-module/navigator/navigator-provider/component.js +8 -6
  272. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  273. package/build-module/navigator/navigator-provider/index.js +1 -1
  274. package/build-module/navigator/navigator-provider/index.js.map +1 -1
  275. package/build-module/navigator/navigator-screen/component.js +9 -7
  276. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  277. package/build-module/navigator/navigator-screen/index.js +1 -1
  278. package/build-module/navigator/navigator-screen/index.js.map +1 -1
  279. package/build-module/number-control/index.js +81 -26
  280. package/build-module/number-control/index.js.map +1 -1
  281. package/build-module/number-control/styles/number-control-styles.js +30 -4
  282. package/build-module/number-control/styles/number-control-styles.js.map +1 -1
  283. package/build-module/popover/index.js +15 -29
  284. package/build-module/popover/index.js.map +1 -1
  285. package/build-module/radio-group/index.js +6 -1
  286. package/build-module/radio-group/index.js.map +1 -1
  287. package/build-module/{radio → radio-group/radio}/index.js +6 -1
  288. package/build-module/radio-group/radio/index.js.map +1 -0
  289. package/build-module/{radio-context → radio-group/radio-context}/index.js +0 -0
  290. package/build-module/radio-group/radio-context/index.js.map +1 -0
  291. package/build-module/sandbox/index.js +56 -59
  292. package/build-module/sandbox/index.js.map +1 -1
  293. package/build-module/sandbox/index.native.js +54 -52
  294. package/build-module/sandbox/index.native.js.map +1 -1
  295. package/build-module/slot-fill/bubbles-virtually/fill.js +9 -5
  296. package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
  297. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
  298. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  299. package/build-module/slot-fill/bubbles-virtually/slot.js +13 -8
  300. package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
  301. package/build-module/slot-fill/bubbles-virtually/use-slot.js +15 -9
  302. package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  303. package/build-module/slot-fill/fill.js +12 -4
  304. package/build-module/slot-fill/fill.js.map +1 -1
  305. package/build-module/slot-fill/use-slot.js +3 -1
  306. package/build-module/slot-fill/use-slot.js.map +1 -1
  307. package/build-module/snackbar/index.js +1 -1
  308. package/build-module/snackbar/index.js.map +1 -1
  309. package/build-module/tab-panel/index.js +5 -9
  310. package/build-module/tab-panel/index.js.map +1 -1
  311. package/build-module/text-control/index.js +0 -2
  312. package/build-module/text-control/index.js.map +1 -1
  313. package/build-module/theme/index.js +52 -0
  314. package/build-module/theme/index.js.map +1 -0
  315. package/build-module/theme/styles.js +25 -0
  316. package/build-module/theme/styles.js.map +1 -0
  317. package/build-module/theme/types.js +2 -0
  318. package/build-module/theme/types.js.map +1 -0
  319. package/build-module/toggle-control/index.js +15 -3
  320. package/build-module/toggle-control/index.js.map +1 -1
  321. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js +76 -0
  322. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -0
  323. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +75 -0
  324. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -0
  325. package/build-module/toggle-group-control/toggle-group-control/component.js +19 -49
  326. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  327. package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -6
  328. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  329. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +39 -17
  330. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  331. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +21 -18
  332. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  333. package/build-module/toolbar-dropdown-menu/index.js +1 -1
  334. package/build-module/toolbar-dropdown-menu/index.js.map +1 -1
  335. package/build-module/tools-panel/tools-panel/hook.js +3 -3
  336. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  337. package/build-module/tools-panel/tools-panel-item/hook.js +6 -6
  338. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  339. package/build-module/tooltip/index.js +4 -1
  340. package/build-module/tooltip/index.js.map +1 -1
  341. package/build-module/tooltip/index.native.js +17 -4
  342. package/build-module/tooltip/index.native.js.map +1 -1
  343. package/build-module/ui/context/context-system-provider.js +6 -20
  344. package/build-module/ui/context/context-system-provider.js.map +1 -1
  345. package/build-module/unit-control/index.js +8 -10
  346. package/build-module/unit-control/index.js.map +1 -1
  347. package/build-module/unit-control/styles/unit-control-styles.js +8 -24
  348. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  349. package/build-module/utils/config-values.js +0 -1
  350. package/build-module/utils/config-values.js.map +1 -1
  351. package/build-module/utils/hooks/use-update-effect.js +5 -1
  352. package/build-module/utils/hooks/use-update-effect.js.map +1 -1
  353. package/build-style/style-rtl.css +45 -61
  354. package/build-style/style.css +43 -59
  355. package/build-types/base-field/hook.d.ts +11 -11
  356. package/build-types/border-box-control/border-box-control/component.d.ts +53 -4
  357. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  358. package/build-types/border-box-control/border-box-control/hook.d.ts +14 -12
  359. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  360. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +12 -12
  361. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  362. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +1 -1
  363. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  364. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +12 -12
  365. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  366. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +12 -12
  367. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  368. package/build-types/border-box-control/stories/index.d.ts +17 -0
  369. package/build-types/border-box-control/stories/index.d.ts.map +1 -0
  370. package/build-types/border-box-control/styles.d.ts +7 -6
  371. package/build-types/border-box-control/styles.d.ts.map +1 -1
  372. package/build-types/border-box-control/types.d.ts +12 -16
  373. package/build-types/border-box-control/types.d.ts.map +1 -1
  374. package/build-types/border-control/border-control/component.d.ts +2 -1
  375. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  376. package/build-types/border-control/border-control/hook.d.ts +14 -13
  377. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  378. package/build-types/border-control/border-control-dropdown/component.d.ts +1 -1
  379. package/build-types/border-control/border-control-dropdown/hook.d.ts +11 -11
  380. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  381. package/build-types/border-control/border-control-style-picker/hook.d.ts +11 -11
  382. package/build-types/border-control/stories/index.d.ts +12 -6
  383. package/build-types/border-control/stories/index.d.ts.map +1 -1
  384. package/build-types/border-control/styles.d.ts +3 -3
  385. package/build-types/border-control/styles.d.ts.map +1 -1
  386. package/build-types/border-control/types.d.ts +11 -9
  387. package/build-types/border-control/types.d.ts.map +1 -1
  388. package/build-types/card/card/hook.d.ts +12 -12
  389. package/build-types/card/card-body/hook.d.ts +12 -12
  390. package/build-types/card/card-divider/hook.d.ts +13 -13
  391. package/build-types/card/card-footer/hook.d.ts +12 -12
  392. package/build-types/card/card-header/hook.d.ts +12 -12
  393. package/build-types/card/card-media/hook.d.ts +12 -12
  394. package/build-types/card/stories/index.d.ts.map +1 -1
  395. package/build-types/circular-option-picker/index.d.ts +4 -24
  396. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  397. package/build-types/color-palette/index.d.ts +33 -18
  398. package/build-types/color-palette/index.d.ts.map +1 -1
  399. package/build-types/color-palette/stories/index.d.ts +21 -0
  400. package/build-types/color-palette/stories/index.d.ts.map +1 -0
  401. package/build-types/color-palette/styles.d.ts +3 -2
  402. package/build-types/color-palette/styles.d.ts.map +1 -1
  403. package/build-types/color-palette/test/index.d.ts +2 -0
  404. package/build-types/color-palette/test/index.d.ts.map +1 -0
  405. package/build-types/color-palette/types.d.ts +86 -0
  406. package/build-types/color-palette/types.d.ts.map +1 -0
  407. package/build-types/color-picker/styles.d.ts +5 -4
  408. package/build-types/color-picker/styles.d.ts.map +1 -1
  409. package/build-types/confirm-dialog/component.d.ts +4 -4
  410. package/build-types/confirm-dialog/types.d.ts +5 -1
  411. package/build-types/confirm-dialog/types.d.ts.map +1 -1
  412. package/build-types/custom-select-control/index.d.ts +1 -12
  413. package/build-types/custom-select-control/index.d.ts.map +1 -1
  414. package/build-types/custom-select-control/styles.d.ts +3 -1
  415. package/build-types/custom-select-control/styles.d.ts.map +1 -1
  416. package/build-types/date-time/date/styles.d.ts +3 -3
  417. package/build-types/date-time/date-time/index.d.ts +2 -0
  418. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  419. package/build-types/date-time/date-time/styles.d.ts +3 -3
  420. package/build-types/date-time/stories/date-time.d.ts.map +1 -1
  421. package/build-types/date-time/time/styles.d.ts +8 -4
  422. package/build-types/date-time/time/styles.d.ts.map +1 -1
  423. package/build-types/disabled/index.d.ts +8 -1
  424. package/build-types/disabled/index.d.ts.map +1 -1
  425. package/build-types/elevation/hook.d.ts +12 -12
  426. package/build-types/external-link/index.d.ts.map +1 -1
  427. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  428. package/build-types/external-link/test/index.d.ts +2 -0
  429. package/build-types/external-link/test/index.d.ts.map +1 -0
  430. package/build-types/flex/flex/hook.d.ts +12 -12
  431. package/build-types/flex/flex-block/hook.d.ts +12 -12
  432. package/build-types/flex/flex-item/hook.d.ts +12 -12
  433. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +2 -2
  434. package/build-types/focal-point-picker/styles/focal-point-style.d.ts +3 -3
  435. package/build-types/focusable-iframe/index.d.ts.map +1 -1
  436. package/build-types/font-size-picker/index.d.ts.map +1 -1
  437. package/build-types/font-size-picker/styles.d.ts.map +1 -1
  438. package/build-types/font-size-picker/types.d.ts +1 -1
  439. package/build-types/font-size-picker/utils.d.ts +0 -8
  440. package/build-types/font-size-picker/utils.d.ts.map +1 -1
  441. package/build-types/form-file-upload/index.d.ts.map +1 -1
  442. package/build-types/form-file-upload/types.d.ts +5 -4
  443. package/build-types/form-file-upload/types.d.ts.map +1 -1
  444. package/build-types/grid/hook.d.ts +12 -12
  445. package/build-types/h-stack/component.d.ts +1 -1
  446. package/build-types/h-stack/hook.d.ts +12 -12
  447. package/build-types/heading/hook.d.ts +12 -12
  448. package/build-types/input-control/index.d.ts +1 -1
  449. package/build-types/input-control/index.d.ts.map +1 -1
  450. package/build-types/input-control/input-base.d.ts +5 -2
  451. package/build-types/input-control/input-base.d.ts.map +1 -1
  452. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  453. package/build-types/input-control/types.d.ts +3 -8
  454. package/build-types/input-control/types.d.ts.map +1 -1
  455. package/build-types/input-control/utils.d.ts +1 -1
  456. package/build-types/isolated-event-container/index.d.ts +3 -2
  457. package/build-types/isolated-event-container/index.d.ts.map +1 -1
  458. package/build-types/item-group/item/hook.d.ts +13 -13
  459. package/build-types/item-group/item-group/hook.d.ts +13 -13
  460. package/build-types/modal/aria-helper.d.ts +4 -4
  461. package/build-types/modal/aria-helper.d.ts.map +1 -1
  462. package/build-types/modal/index.d.ts +35 -2
  463. package/build-types/modal/index.d.ts.map +1 -1
  464. package/build-types/modal/stories/index.d.ts +9 -0
  465. package/build-types/modal/stories/index.d.ts.map +1 -0
  466. package/build-types/modal/test/aria-helper.d.ts +2 -0
  467. package/build-types/modal/test/aria-helper.d.ts.map +1 -0
  468. package/build-types/modal/test/index.d.ts +2 -0
  469. package/build-types/modal/test/index.d.ts.map +1 -0
  470. package/build-types/modal/types.d.ts +134 -0
  471. package/build-types/modal/types.d.ts.map +1 -0
  472. package/build-types/navigator/index.d.ts +4 -4
  473. package/build-types/navigator/index.d.ts.map +1 -1
  474. package/build-types/navigator/navigator-back-button/component.d.ts +4 -2
  475. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  476. package/build-types/navigator/navigator-back-button/hook.d.ts +14 -13
  477. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  478. package/build-types/navigator/navigator-back-button/index.d.ts +1 -1
  479. package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -1
  480. package/build-types/navigator/navigator-button/component.d.ts +4 -2
  481. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  482. package/build-types/navigator/navigator-button/hook.d.ts +14 -13
  483. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  484. package/build-types/navigator/navigator-button/index.d.ts +1 -1
  485. package/build-types/navigator/navigator-button/index.d.ts.map +1 -1
  486. package/build-types/navigator/navigator-provider/component.d.ts +2 -2
  487. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  488. package/build-types/navigator/navigator-provider/index.d.ts +1 -1
  489. package/build-types/navigator/navigator-provider/index.d.ts.map +1 -1
  490. package/build-types/navigator/navigator-screen/component.d.ts +2 -2
  491. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  492. package/build-types/navigator/navigator-screen/index.d.ts +1 -1
  493. package/build-types/navigator/navigator-screen/index.d.ts.map +1 -1
  494. package/build-types/navigator/stories/index.d.ts +9 -0
  495. package/build-types/navigator/stories/index.d.ts.map +1 -0
  496. package/build-types/navigator/test/index.d.ts +2 -0
  497. package/build-types/navigator/test/index.d.ts.map +1 -0
  498. package/build-types/navigator/types.d.ts +4 -1
  499. package/build-types/navigator/types.d.ts.map +1 -1
  500. package/build-types/number-control/index.d.ts +2 -4
  501. package/build-types/number-control/index.d.ts.map +1 -1
  502. package/build-types/number-control/styles/number-control-styles.d.ts +5 -0
  503. package/build-types/number-control/styles/number-control-styles.d.ts.map +1 -1
  504. package/build-types/number-control/types.d.ts +12 -0
  505. package/build-types/number-control/types.d.ts.map +1 -1
  506. package/build-types/popover/index.d.ts +1 -1
  507. package/build-types/popover/index.d.ts.map +1 -1
  508. package/build-types/popover/stories/e2e/index.d.ts +1 -1
  509. package/build-types/popover/stories/index.d.ts +2 -0
  510. package/build-types/popover/stories/index.d.ts.map +1 -1
  511. package/build-types/popover/types.d.ts +18 -14
  512. package/build-types/popover/types.d.ts.map +1 -1
  513. package/build-types/radio-group/index.d.ts +10 -0
  514. package/build-types/radio-group/index.d.ts.map +1 -0
  515. package/build-types/radio-group/radio/index.d.ts +7 -0
  516. package/build-types/radio-group/radio/index.d.ts.map +1 -0
  517. package/build-types/{radio-context → radio-group/radio-context}/index.d.ts +0 -0
  518. package/build-types/radio-group/radio-context/index.d.ts.map +1 -0
  519. package/build-types/range-control/index.d.ts +1 -1
  520. package/build-types/range-control/styles/range-control-styles.d.ts +2 -1
  521. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  522. package/build-types/resizable-box/index.d.ts +1 -1
  523. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  524. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  525. package/build-types/scrollable/hook.d.ts +12 -12
  526. package/build-types/search-control/index.d.ts +2 -2
  527. package/build-types/search-control/stories/index.d.ts +4 -4
  528. package/build-types/select-control/stories/index.d.ts.map +1 -1
  529. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
  530. package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
  531. package/build-types/slot-fill/fill.d.ts.map +1 -1
  532. package/build-types/slot-fill/use-slot.d.ts.map +1 -1
  533. package/build-types/spacer/hook.d.ts +12 -12
  534. package/build-types/spinner/index.d.ts +1 -1
  535. package/build-types/surface/hook.d.ts +12 -12
  536. package/build-types/tab-panel/index.d.ts.map +1 -1
  537. package/build-types/text/hook.d.ts +12 -12
  538. package/build-types/text-control/index.d.ts +2 -4
  539. package/build-types/text-control/index.d.ts.map +1 -1
  540. package/build-types/text-control/stories/index.d.ts.map +1 -1
  541. package/build-types/theme/index.d.ts +31 -0
  542. package/build-types/theme/index.d.ts.map +1 -0
  543. package/build-types/theme/stories/index.d.ts +13 -0
  544. package/build-types/theme/stories/index.d.ts.map +1 -0
  545. package/build-types/theme/styles.d.ts +10 -0
  546. package/build-types/theme/styles.d.ts.map +1 -0
  547. package/build-types/theme/test/index.d.ts +2 -0
  548. package/build-types/theme/test/index.d.ts.map +1 -0
  549. package/build-types/theme/types.d.ts +21 -0
  550. package/build-types/theme/types.d.ts.map +1 -0
  551. package/build-types/toggle-control/index.d.ts.map +1 -1
  552. package/build-types/toggle-control/types.d.ts +2 -1
  553. package/build-types/toggle-control/types.d.ts.map +1 -1
  554. package/build-types/toggle-group-control/stories/index.d.ts +2 -2
  555. package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
  556. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +6 -0
  557. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -0
  558. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +6 -0
  559. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -0
  560. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +2 -2
  561. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  562. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +2 -2
  563. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  564. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  565. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +4 -7
  566. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  567. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
  568. package/build-types/toggle-group-control/types.d.ts +19 -14
  569. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  570. package/build-types/tools-panel/tools-panel/hook.d.ts +12 -12
  571. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  572. package/build-types/tools-panel/tools-panel-header/hook.d.ts +12 -12
  573. package/build-types/tools-panel/tools-panel-item/hook.d.ts +12 -12
  574. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  575. package/build-types/tooltip/index.d.ts.map +1 -1
  576. package/build-types/truncate/hook.d.ts +12 -12
  577. package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
  578. package/build-types/ui/control-group/hook.d.ts +12 -12
  579. package/build-types/ui/control-label/component.d.ts +1 -1
  580. package/build-types/ui/control-label/hook.d.ts +12 -12
  581. package/build-types/ui/form-group/form-group.d.ts +4 -4
  582. package/build-types/ui/form-group/use-form-group.d.ts +28 -28
  583. package/build-types/unit-control/index.d.ts +2 -2
  584. package/build-types/unit-control/index.d.ts.map +1 -1
  585. package/build-types/unit-control/styles/unit-control-styles.d.ts +2 -5
  586. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  587. package/build-types/unit-control/types.d.ts +3 -3
  588. package/build-types/unit-control/types.d.ts.map +1 -1
  589. package/build-types/utils/config-values.d.ts +0 -1
  590. package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
  591. package/build-types/utils/types.d.ts +0 -14
  592. package/build-types/utils/types.d.ts.map +1 -1
  593. package/build-types/v-stack/component.d.ts +2 -2
  594. package/build-types/v-stack/hook.d.ts +12 -12
  595. package/build-types/v-stack/stories/index.d.ts +2 -2
  596. package/package.json +17 -17
  597. package/src/angle-picker-control/index.js +1 -1
  598. package/src/angle-picker-control/stories/index.js +3 -0
  599. package/src/autocomplete/autocompleter-ui.js +29 -2
  600. package/src/autocomplete/test/index.js +89 -0
  601. package/src/base-field/test/index.js +4 -6
  602. package/src/border-box-control/border-box-control/README.md +8 -0
  603. package/src/border-box-control/border-box-control/component.tsx +66 -13
  604. package/src/border-box-control/border-box-control/hook.ts +11 -2
  605. package/src/border-box-control/border-box-control-linked-button/hook.ts +3 -6
  606. package/src/border-box-control/border-box-control-split-controls/component.tsx +3 -6
  607. package/src/border-box-control/border-box-control-split-controls/hook.ts +11 -14
  608. package/src/border-box-control/border-box-control-visualizer/hook.ts +4 -7
  609. package/src/border-box-control/stories/index.tsx +90 -0
  610. package/src/border-box-control/styles.ts +28 -22
  611. package/src/border-box-control/test/index.js +291 -121
  612. package/src/border-box-control/types.ts +12 -16
  613. package/src/border-control/border-control/README.md +14 -0
  614. package/src/border-control/border-control/component.tsx +6 -3
  615. package/src/border-control/border-control/hook.ts +10 -6
  616. package/src/border-control/border-control-dropdown/hook.ts +5 -7
  617. package/src/border-control/stories/index.tsx +12 -14
  618. package/src/border-control/styles.ts +20 -23
  619. package/src/border-control/test/index.js +139 -96
  620. package/src/border-control/types.ts +11 -9
  621. package/src/box-control/README.md +14 -0
  622. package/src/box-control/index.js +4 -0
  623. package/src/box-control/stories/index.js +8 -27
  624. package/src/button/README.md +2 -15
  625. package/src/button/stories/index.js +109 -178
  626. package/src/button/style.scss +40 -77
  627. package/src/button/test/index.js +3 -5
  628. package/src/card/stories/index.tsx +27 -31
  629. package/src/card/test/__snapshots__/index.tsx.snap +36 -35
  630. package/src/card/test/index.tsx +2 -6
  631. package/src/circular-option-picker/index.js +14 -20
  632. package/src/color-palette/README.md +51 -49
  633. package/src/color-palette/{index.js → index.tsx} +132 -51
  634. package/src/color-palette/stories/{index.js → index.tsx} +38 -27
  635. package/src/color-palette/style.scss +2 -2
  636. package/src/color-palette/{styles.js → styles.ts} +0 -0
  637. package/src/color-palette/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  638. package/src/color-palette/test/{index.js → index.tsx} +1 -1
  639. package/src/color-palette/types.ts +93 -0
  640. package/src/color-picker/input-with-slider.tsx +1 -1
  641. package/src/combobox-control/test/index.js +1 -1
  642. package/src/confirm-dialog/types.ts +6 -0
  643. package/src/custom-gradient-picker/gradient-bar/index.js +1 -3
  644. package/src/custom-select-control/README.md +14 -0
  645. package/src/custom-select-control/index.js +22 -15
  646. package/src/date-time/date-time/index.tsx +2 -0
  647. package/src/date-time/stories/date-time.tsx +4 -0
  648. package/src/date-time/time/index.tsx +4 -4
  649. package/src/date-time/time/test/index.tsx +2 -6
  650. package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -0
  651. package/src/disabled/README.md +2 -0
  652. package/src/disabled/index.tsx +19 -34
  653. package/src/disabled/test/index.tsx +9 -82
  654. package/src/dropdown/test/index.js +4 -3
  655. package/src/external-link/index.tsx +14 -6
  656. package/src/external-link/test/index.tsx +106 -0
  657. package/src/focusable-iframe/index.js +0 -1
  658. package/src/font-size-picker/README.md +3 -3
  659. package/src/font-size-picker/index.tsx +153 -143
  660. package/src/font-size-picker/styles.ts +3 -1
  661. package/src/font-size-picker/test/index.tsx +447 -174
  662. package/src/font-size-picker/test/utils.ts +6 -50
  663. package/src/font-size-picker/types.ts +1 -1
  664. package/src/font-size-picker/utils.ts +1 -23
  665. package/src/form-file-upload/README.md +1 -3
  666. package/src/form-file-upload/index.tsx +1 -0
  667. package/src/form-file-upload/test/index.tsx +1 -1
  668. package/src/form-file-upload/types.ts +5 -4
  669. package/src/form-toggle/test/__snapshots__/index.tsx.snap +15 -13
  670. package/src/form-toggle/test/index.tsx +1 -1
  671. package/src/form-token-field/suggestions-list.tsx +5 -5
  672. package/src/h-stack/test/__snapshots__/index.tsx.snap +36 -30
  673. package/src/h-stack/test/index.tsx +3 -3
  674. package/src/higher-order/with-fallback-styles/index.js +6 -2
  675. package/src/higher-order/with-filters/index.js +4 -9
  676. package/src/higher-order/with-focus-outside/test/index.js +44 -45
  677. package/src/higher-order/with-focus-return/test/index.js +34 -30
  678. package/src/higher-order/with-notices/test/index.js +1 -1
  679. package/src/index.js +4 -2
  680. package/src/input-control/index.tsx +2 -0
  681. package/src/input-control/input-base.tsx +3 -3
  682. package/src/input-control/styles/input-control-styles.tsx +1 -0
  683. package/src/input-control/test/index.js +2 -2
  684. package/src/input-control/types.ts +4 -11
  685. package/src/isolated-event-container/index.tsx +32 -0
  686. package/src/item-group/styles.ts +1 -1
  687. package/src/item-group/test/__snapshots__/index.js.snap +90 -85
  688. package/src/item-group/test/index.js +8 -18
  689. package/src/menu-item/test/index.js +0 -3
  690. package/src/mobile/bottom-sheet/test/range-cell.native.js +16 -14
  691. package/src/modal/README.md +53 -54
  692. package/src/modal/{aria-helper.js → aria-helper.ts} +5 -7
  693. package/src/modal/{index.js → index.tsx} +48 -12
  694. package/src/modal/stories/{index.js → index.tsx} +47 -42
  695. package/src/modal/test/{aria-helper.js → aria-helper.ts} +0 -0
  696. package/src/modal/test/{index.js → index.tsx} +13 -3
  697. package/src/modal/types.ts +144 -0
  698. package/src/navigation/test/index.js +1 -1
  699. package/src/navigator/index.ts +4 -4
  700. package/src/navigator/navigator-back-button/component.tsx +4 -4
  701. package/src/navigator/navigator-back-button/index.ts +1 -1
  702. package/src/navigator/navigator-button/component.tsx +4 -4
  703. package/src/navigator/navigator-button/index.ts +1 -1
  704. package/src/navigator/navigator-provider/component.tsx +6 -4
  705. package/src/navigator/navigator-provider/index.ts +1 -1
  706. package/src/navigator/navigator-screen/component.tsx +17 -6
  707. package/src/navigator/navigator-screen/index.ts +1 -1
  708. package/src/navigator/stories/index.tsx +210 -0
  709. package/src/navigator/test/index.tsx +509 -0
  710. package/src/navigator/types.ts +2 -0
  711. package/src/notice/test/__snapshots__/index.js.snap +39 -38
  712. package/src/notice/test/index.js +15 -36
  713. package/src/notice/test/list.js +6 -14
  714. package/src/number-control/README.md +9 -4
  715. package/src/number-control/index.tsx +100 -33
  716. package/src/number-control/styles/number-control-styles.js +26 -1
  717. package/src/number-control/test/index.js +53 -2
  718. package/src/number-control/types.ts +12 -0
  719. package/src/panel/test/body.js +2 -2
  720. package/src/placeholder/style.scss +5 -0
  721. package/src/popover/README.md +12 -7
  722. package/src/popover/index.tsx +20 -30
  723. package/src/popover/stories/index.tsx +29 -1
  724. package/src/popover/style.scss +9 -0
  725. package/src/popover/types.ts +18 -15
  726. package/src/radio-group/README.md +4 -0
  727. package/src/radio-group/index.js +6 -1
  728. package/src/{radio → radio-group/radio}/index.js +6 -1
  729. package/src/{radio-context → radio-group/radio-context}/index.js +0 -0
  730. package/src/radio-group/stories/index.js +11 -2
  731. package/src/sandbox/index.js +62 -47
  732. package/src/sandbox/index.native.js +72 -52
  733. package/src/sandbox/test/index.js +8 -11
  734. package/src/select-control/stories/index.tsx +9 -4
  735. package/src/shortcut/test/index.tsx +1 -1
  736. package/src/slot-fill/bubbles-virtually/fill.js +5 -5
  737. package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +5 -3
  738. package/src/slot-fill/bubbles-virtually/slot.js +10 -8
  739. package/src/slot-fill/bubbles-virtually/use-slot.js +15 -9
  740. package/src/slot-fill/fill.js +12 -2
  741. package/src/slot-fill/use-slot.js +3 -0
  742. package/src/snackbar/index.js +1 -1
  743. package/src/style.scss +4 -0
  744. package/src/surface/test/__snapshots__/index.tsx.snap +58 -46
  745. package/src/surface/test/index.tsx +6 -16
  746. package/src/tab-panel/index.tsx +5 -9
  747. package/src/tab-panel/test/index.tsx +78 -1
  748. package/src/text/test/__snapshots__/index.tsx.snap +19 -15
  749. package/src/text/test/index.tsx +2 -2
  750. package/src/text-control/index.tsx +0 -2
  751. package/src/text-control/stories/index.tsx +5 -6
  752. package/src/text-highlight/test/index.tsx +1 -3
  753. package/src/theme/README.md +34 -0
  754. package/src/theme/index.tsx +51 -0
  755. package/src/theme/stories/index.tsx +47 -0
  756. package/src/theme/styles.ts +28 -0
  757. package/src/theme/test/index.tsx +101 -0
  758. package/src/theme/types.ts +21 -0
  759. package/src/toggle-control/README.md +6 -4
  760. package/src/toggle-control/index.tsx +13 -2
  761. package/src/toggle-control/types.ts +2 -4
  762. package/src/toggle-group-control/stories/index.tsx +4 -4
  763. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +219 -160
  764. package/src/toggle-group-control/test/index.tsx +129 -2
  765. package/src/toggle-group-control/toggle-group-control/as-button-group.tsx +103 -0
  766. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +99 -0
  767. package/src/toggle-group-control/toggle-group-control/component.tsx +29 -74
  768. package/src/toggle-group-control/toggle-group-control/styles.ts +12 -10
  769. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +49 -25
  770. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +39 -19
  771. package/src/toggle-group-control/types.ts +75 -63
  772. package/src/toolbar/test/index.js +2 -2
  773. package/src/toolbar-dropdown-menu/index.js +1 -1
  774. package/src/toolbar-group/test/index.js +6 -10
  775. package/src/tools-panel/stories/index.js +0 -1
  776. package/src/tools-panel/stories/tools-panel-with-item-group-slot.js +0 -1
  777. package/src/tools-panel/test/index.js +4 -6
  778. package/src/tools-panel/tools-panel/hook.ts +2 -9
  779. package/src/tools-panel/tools-panel-item/hook.ts +17 -3
  780. package/src/tooltip/index.js +3 -0
  781. package/src/tooltip/index.native.js +15 -0
  782. package/src/tooltip/test/index.native.js +1 -2
  783. package/src/tree-grid/test/__snapshots__/cell.js.snap +20 -20
  784. package/src/tree-grid/test/__snapshots__/roving-tab-index-item.js.snap +17 -15
  785. package/src/tree-grid/test/__snapshots__/roving-tab-index.js.snap +3 -1
  786. package/src/tree-grid/test/__snapshots__/row.js.snap +33 -25
  787. package/src/tree-grid/test/cell.js +4 -4
  788. package/src/tree-grid/test/roving-tab-index-item.js +8 -8
  789. package/src/tree-grid/test/roving-tab-index.js +3 -3
  790. package/src/tree-grid/test/row.js +20 -16
  791. package/src/truncate/test/index.tsx +4 -4
  792. package/src/ui/context/context-system-provider.js +5 -18
  793. package/src/ui/context/test/__snapshots__/context-system-provider.js.snap +23 -17
  794. package/src/ui/context/test/context-system-provider.js +3 -3
  795. package/src/ui/control-group/test/__snapshots__/index.js.snap +18 -16
  796. package/src/ui/control-group/test/index.js +1 -1
  797. package/src/ui/control-label/test/__snapshots__/index.js.snap +27 -21
  798. package/src/ui/control-label/test/index.js +3 -3
  799. package/src/ui/form-group/test/__snapshots__/index.js.snap +34 -30
  800. package/src/ui/form-group/test/index.js +2 -2
  801. package/src/ui/shortcut/test/__snapshots__/index.js.snap +1 -1
  802. package/src/ui/shortcut/test/index.js +3 -2
  803. package/src/ui/spinner/test/__snapshots__/index.js.snap +75 -73
  804. package/src/ui/spinner/test/index.js +10 -13
  805. package/src/ui/tooltip/test/index.js +16 -14
  806. package/src/unit-control/index.tsx +29 -30
  807. package/src/unit-control/styles/unit-control-styles.ts +6 -12
  808. package/src/unit-control/test/utils.ts +43 -0
  809. package/src/unit-control/types.ts +5 -6
  810. package/src/utils/config-values.js +0 -1
  811. package/src/utils/hooks/use-update-effect.js +5 -1
  812. package/src/utils/theme-variables.scss +8 -0
  813. package/src/utils/types.ts +0 -15
  814. package/src/v-stack/test/__snapshots__/index.tsx.snap +36 -30
  815. package/src/v-stack/test/index.tsx +3 -3
  816. package/src/view/test/__snapshots__/index.js.snap +34 -24
  817. package/src/view/test/index.js +5 -5
  818. package/src/visually-hidden/README.md +4 -0
  819. package/tsconfig.json +0 -2
  820. package/tsconfig.tsbuildinfo +1 -1
  821. package/build/radio/index.js.map +0 -1
  822. package/build/radio-context/index.js.map +0 -1
  823. package/build-module/radio/index.js.map +0 -1
  824. package/build-module/radio-context/index.js.map +0 -1
  825. package/build-types/radio-context/index.d.ts.map +0 -1
  826. package/src/border-box-control/stories/index.js +0 -106
  827. package/src/form-file-upload/stories/index.js +0 -51
  828. package/src/isolated-event-container/index.js +0 -28
  829. package/src/navigator/stories/index.js +0 -194
  830. package/src/navigator/test/index.js +0 -472
  831. package/src/radio/stories/index.js +0 -20
@@ -31,17 +31,22 @@ function Slot(_ref, forwardedRef) {
31
31
  as: Component = 'div',
32
32
  ...props
33
33
  } = _ref;
34
- const registry = (0, _element.useContext)(_slotFillContext.default);
34
+ const {
35
+ registerSlot,
36
+ unregisterSlot,
37
+ ...registry
38
+ } = (0, _element.useContext)(_slotFillContext.default);
35
39
  const ref = (0, _element.useRef)();
36
40
  (0, _element.useLayoutEffect)(() => {
37
- registry.registerSlot(name, ref, fillProps);
41
+ registerSlot(name, ref, fillProps);
38
42
  return () => {
39
- registry.unregisterSlot(name, ref);
40
- }; // We are not including fillProps in the deps because we don't want to
41
- // unregister and register the slot whenever fillProps change, which would
42
- // cause the fill to be re-mounted. We are only considering the initial value
43
- // of fillProps.
44
- }, [registry.registerSlot, registry.unregisterSlot, name]); // fillProps may be an update that interacts with the layout, so we
43
+ unregisterSlot(name, ref);
44
+ }; // Ignore reason: We don't want to unregister and register the slot whenever
45
+ // `fillProps` change, which would cause the fill to be re-mounted. Instead,
46
+ // we can just update the slot (see hook below).
47
+ // For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973
48
+ // eslint-disable-next-line react-hooks/exhaustive-deps
49
+ }, [registerSlot, unregisterSlot, name]); // fillProps may be an update that interacts with the layout, so we
45
50
  // useLayoutEffect.
46
51
 
47
52
  (0, _element.useLayoutEffect)(() => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.js"],"names":["Slot","forwardedRef","name","fillProps","as","Component","props","registry","SlotFillContext","ref","registerSlot","unregisterSlot","updateSlot"],"mappings":";;;;;;;;;AAIA;;;;AAMA;;AAKA;;AAfA;;AACA;AACA;AACA;;AASA;AACA;AACA;AAGA,SAASA,IAAT,OAECC,YAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG,EAApB;AAAwBC,IAAAA,EAAE,EAAEC,SAAS,GAAG,KAAxC;AAA+C,OAAGC;AAAlD,GAEC;AACD,QAAMC,QAAQ,GAAG,yBAAYC,wBAAZ,CAAjB;AACA,QAAMC,GAAG,GAAG,sBAAZ;AAEA,gCAAiB,MAAM;AACtBF,IAAAA,QAAQ,CAACG,YAAT,CAAuBR,IAAvB,EAA6BO,GAA7B,EAAkCN,SAAlC;AACA,WAAO,MAAM;AACZI,MAAAA,QAAQ,CAACI,cAAT,CAAyBT,IAAzB,EAA+BO,GAA/B;AACA,KAFD,CAFsB,CAKtB;AACA;AACA;AACA;AACA,GATD,EASG,CAAEF,QAAQ,CAACG,YAAX,EAAyBH,QAAQ,CAACI,cAAlC,EAAkDT,IAAlD,CATH,EAJC,CAcD;AACA;;AACA,gCAAiB,MAAM;AACtBK,IAAAA,QAAQ,CAACK,UAAT,CAAqBV,IAArB,EAA2BC,SAA3B;AACA,GAFD;AAIA,SACC,4BAAC,SAAD;AAAW,IAAA,GAAG,EAAG,2BAAc,CAAEF,YAAF,EAAgBQ,GAAhB,CAAd;AAAjB,KAA8DH,KAA9D,EADD;AAGA;;eAEc,yBAAYN,IAAZ,C","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tuseContext,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nfunction Slot(\n\t{ name, fillProps = {}, as: Component = 'div', ...props },\n\tforwardedRef\n) {\n\tconst registry = useContext( SlotFillContext );\n\tconst ref = useRef();\n\n\tuseLayoutEffect( () => {\n\t\tregistry.registerSlot( name, ref, fillProps );\n\t\treturn () => {\n\t\t\tregistry.unregisterSlot( name, ref );\n\t\t};\n\t\t// We are not including fillProps in the deps because we don't want to\n\t\t// unregister and register the slot whenever fillProps change, which would\n\t\t// cause the fill to be re-mounted. We are only considering the initial value\n\t\t// of fillProps.\n\t}, [ registry.registerSlot, registry.unregisterSlot, name ] );\n\t// fillProps may be an update that interacts with the layout, so we\n\t// useLayoutEffect.\n\tuseLayoutEffect( () => {\n\t\tregistry.updateSlot( name, fillProps );\n\t} );\n\n\treturn (\n\t\t<Component ref={ useMergeRefs( [ forwardedRef, ref ] ) } { ...props } />\n\t);\n}\n\nexport default forwardRef( Slot );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.js"],"names":["Slot","forwardedRef","name","fillProps","as","Component","props","registerSlot","unregisterSlot","registry","SlotFillContext","ref","updateSlot"],"mappings":";;;;;;;;;AAIA;;;;AAMA;;AAKA;;AAfA;;AACA;AACA;AACA;;AASA;AACA;AACA;AAGA,SAASA,IAAT,OAECC,YAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG,EAApB;AAAwBC,IAAAA,EAAE,EAAEC,SAAS,GAAG,KAAxC;AAA+C,OAAGC;AAAlD,GAEC;AACD,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,cAAhB;AAAgC,OAAGC;AAAnC,MACL,yBAAYC,wBAAZ,CADD;AAEA,QAAMC,GAAG,GAAG,sBAAZ;AAEA,gCAAiB,MAAM;AACtBJ,IAAAA,YAAY,CAAEL,IAAF,EAAQS,GAAR,EAAaR,SAAb,CAAZ;AACA,WAAO,MAAM;AACZK,MAAAA,cAAc,CAAEN,IAAF,EAAQS,GAAR,CAAd;AACA,KAFD,CAFsB,CAKtB;AACA;AACA;AACA;AACA;AACA,GAVD,EAUG,CAAEJ,YAAF,EAAgBC,cAAhB,EAAgCN,IAAhC,CAVH,EALC,CAgBD;AACA;;AACA,gCAAiB,MAAM;AACtBO,IAAAA,QAAQ,CAACG,UAAT,CAAqBV,IAArB,EAA2BC,SAA3B;AACA,GAFD;AAIA,SACC,4BAAC,SAAD;AAAW,IAAA,GAAG,EAAG,2BAAc,CAAEF,YAAF,EAAgBU,GAAhB,CAAd;AAAjB,KAA8DL,KAA9D,EADD;AAGA;;eAEc,yBAAYN,IAAZ,C","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tuseContext,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nfunction Slot(\n\t{ name, fillProps = {}, as: Component = 'div', ...props },\n\tforwardedRef\n) {\n\tconst { registerSlot, unregisterSlot, ...registry } =\n\t\tuseContext( SlotFillContext );\n\tconst ref = useRef();\n\n\tuseLayoutEffect( () => {\n\t\tregisterSlot( name, ref, fillProps );\n\t\treturn () => {\n\t\t\tunregisterSlot( name, ref );\n\t\t};\n\t\t// Ignore reason: We don't want to unregister and register the slot whenever\n\t\t// `fillProps` change, which would cause the fill to be re-mounted. Instead,\n\t\t// we can just update the slot (see hook below).\n\t\t// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ registerSlot, unregisterSlot, name ] );\n\t// fillProps may be an update that interacts with the layout, so we\n\t// useLayoutEffect.\n\tuseLayoutEffect( () => {\n\t\tregistry.updateSlot( name, fillProps );\n\t} );\n\n\treturn (\n\t\t<Component ref={ useMergeRefs( [ forwardedRef, ref ] ) } { ...props } />\n\t);\n}\n\nexport default forwardRef( Slot );\n"]}
@@ -27,7 +27,13 @@ var _slotFillContext = _interopRequireDefault(require("./slot-fill-context"));
27
27
  * Internal dependencies
28
28
  */
29
29
  function useSlot(name) {
30
- const registry = (0, _element.useContext)(_slotFillContext.default);
30
+ const {
31
+ updateSlot: registryUpdateSlot,
32
+ unregisterSlot: registryUnregisterSlot,
33
+ registerFill: registryRegisterFill,
34
+ unregisterFill: registryUnregisterFill,
35
+ ...registry
36
+ } = (0, _element.useContext)(_slotFillContext.default);
31
37
  const slots = (0, _valtio.useSnapshot)(registry.slots, {
32
38
  sync: true
33
39
  }); // The important bit here is that this call ensures
@@ -36,17 +42,17 @@ function useSlot(name) {
36
42
 
37
43
  const slot = slots.get(name);
38
44
  const updateSlot = (0, _element.useCallback)(fillProps => {
39
- registry.updateSlot(name, fillProps);
40
- }, [name, registry.updateSlot]);
45
+ registryUpdateSlot(name, fillProps);
46
+ }, [name, registryUpdateSlot]);
41
47
  const unregisterSlot = (0, _element.useCallback)(slotRef => {
42
- registry.unregisterSlot(name, slotRef);
43
- }, [name, registry.unregisterSlot]);
48
+ registryUnregisterSlot(name, slotRef);
49
+ }, [name, registryUnregisterSlot]);
44
50
  const registerFill = (0, _element.useCallback)(fillRef => {
45
- registry.registerFill(name, fillRef);
46
- }, [name, registry.registerFill]);
51
+ registryRegisterFill(name, fillRef);
52
+ }, [name, registryRegisterFill]);
47
53
  const unregisterFill = (0, _element.useCallback)(fillRef => {
48
- registry.unregisterFill(name, fillRef);
49
- }, [name, registry.unregisterFill]);
54
+ registryUnregisterFill(name, fillRef);
55
+ }, [name, registryUnregisterFill]);
50
56
  return { ...slot,
51
57
  updateSlot,
52
58
  unregisterSlot,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.js"],"names":["useSlot","name","registry","SlotFillContext","slots","sync","slot","get","updateSlot","fillProps","unregisterSlot","slotRef","registerFill","fillRef","unregisterFill"],"mappings":";;;;;;;;;AAIA;;AAKA;;AAKA;;AAdA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,OAAT,CAAkBC,IAAlB,EAAyB;AACvC,QAAMC,QAAQ,GAAG,yBAAYC,wBAAZ,CAAjB;AACA,QAAMC,KAAK,GAAG,yBAAaF,QAAQ,CAACE,KAAtB,EAA6B;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAA7B,CAAd,CAFuC,CAGvC;AACA;AACA;;AACA,QAAMC,IAAI,GAAGF,KAAK,CAACG,GAAN,CAAWN,IAAX,CAAb;AAEA,QAAMO,UAAU,GAAG,0BAChBC,SAAF,IAAiB;AAChBP,IAAAA,QAAQ,CAACM,UAAT,CAAqBP,IAArB,EAA2BQ,SAA3B;AACA,GAHiB,EAIlB,CAAER,IAAF,EAAQC,QAAQ,CAACM,UAAjB,CAJkB,CAAnB;AAOA,QAAME,cAAc,GAAG,0BACpBC,OAAF,IAAe;AACdT,IAAAA,QAAQ,CAACQ,cAAT,CAAyBT,IAAzB,EAA+BU,OAA/B;AACA,GAHqB,EAItB,CAAEV,IAAF,EAAQC,QAAQ,CAACQ,cAAjB,CAJsB,CAAvB;AAOA,QAAME,YAAY,GAAG,0BAClBC,OAAF,IAAe;AACdX,IAAAA,QAAQ,CAACU,YAAT,CAAuBX,IAAvB,EAA6BY,OAA7B;AACA,GAHmB,EAIpB,CAAEZ,IAAF,EAAQC,QAAQ,CAACU,YAAjB,CAJoB,CAArB;AAOA,QAAME,cAAc,GAAG,0BACpBD,OAAF,IAAe;AACdX,IAAAA,QAAQ,CAACY,cAAT,CAAyBb,IAAzB,EAA+BY,OAA/B;AACA,GAHqB,EAItB,CAAEZ,IAAF,EAAQC,QAAQ,CAACY,cAAjB,CAJsB,CAAvB;AAOA,SAAO,EACN,GAAGR,IADG;AAENE,IAAAA,UAFM;AAGNE,IAAAA,cAHM;AAINE,IAAAA,YAJM;AAKNE,IAAAA;AALM,GAAP;AAOA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { useSnapshot } from 'valtio';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nexport default function useSlot( name ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst slots = useSnapshot( registry.slots, { sync: true } );\n\t// The important bit here is that this call ensures\n\t// the hook only causes a re-render if the slot\n\t// with the given name change, not any other slot.\n\tconst slot = slots.get( name );\n\n\tconst updateSlot = useCallback(\n\t\t( fillProps ) => {\n\t\t\tregistry.updateSlot( name, fillProps );\n\t\t},\n\t\t[ name, registry.updateSlot ]\n\t);\n\n\tconst unregisterSlot = useCallback(\n\t\t( slotRef ) => {\n\t\t\tregistry.unregisterSlot( name, slotRef );\n\t\t},\n\t\t[ name, registry.unregisterSlot ]\n\t);\n\n\tconst registerFill = useCallback(\n\t\t( fillRef ) => {\n\t\t\tregistry.registerFill( name, fillRef );\n\t\t},\n\t\t[ name, registry.registerFill ]\n\t);\n\n\tconst unregisterFill = useCallback(\n\t\t( fillRef ) => {\n\t\t\tregistry.unregisterFill( name, fillRef );\n\t\t},\n\t\t[ name, registry.unregisterFill ]\n\t);\n\n\treturn {\n\t\t...slot,\n\t\tupdateSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.js"],"names":["useSlot","name","updateSlot","registryUpdateSlot","unregisterSlot","registryUnregisterSlot","registerFill","registryRegisterFill","unregisterFill","registryUnregisterFill","registry","SlotFillContext","slots","sync","slot","get","fillProps","slotRef","fillRef"],"mappings":";;;;;;;;;AAIA;;AAKA;;AAKA;;AAdA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,OAAT,CAAkBC,IAAlB,EAAyB;AACvC,QAAM;AACLC,IAAAA,UAAU,EAAEC,kBADP;AAELC,IAAAA,cAAc,EAAEC,sBAFX;AAGLC,IAAAA,YAAY,EAAEC,oBAHT;AAILC,IAAAA,cAAc,EAAEC,sBAJX;AAKL,OAAGC;AALE,MAMF,yBAAYC,wBAAZ,CANJ;AAOA,QAAMC,KAAK,GAAG,yBAAaF,QAAQ,CAACE,KAAtB,EAA6B;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAA7B,CAAd,CARuC,CASvC;AACA;AACA;;AACA,QAAMC,IAAI,GAAGF,KAAK,CAACG,GAAN,CAAWd,IAAX,CAAb;AAEA,QAAMC,UAAU,GAAG,0BAChBc,SAAF,IAAiB;AAChBb,IAAAA,kBAAkB,CAAEF,IAAF,EAAQe,SAAR,CAAlB;AACA,GAHiB,EAIlB,CAAEf,IAAF,EAAQE,kBAAR,CAJkB,CAAnB;AAOA,QAAMC,cAAc,GAAG,0BACpBa,OAAF,IAAe;AACdZ,IAAAA,sBAAsB,CAAEJ,IAAF,EAAQgB,OAAR,CAAtB;AACA,GAHqB,EAItB,CAAEhB,IAAF,EAAQI,sBAAR,CAJsB,CAAvB;AAOA,QAAMC,YAAY,GAAG,0BAClBY,OAAF,IAAe;AACdX,IAAAA,oBAAoB,CAAEN,IAAF,EAAQiB,OAAR,CAApB;AACA,GAHmB,EAIpB,CAAEjB,IAAF,EAAQM,oBAAR,CAJoB,CAArB;AAOA,QAAMC,cAAc,GAAG,0BACpBU,OAAF,IAAe;AACdT,IAAAA,sBAAsB,CAAER,IAAF,EAAQiB,OAAR,CAAtB;AACA,GAHqB,EAItB,CAAEjB,IAAF,EAAQQ,sBAAR,CAJsB,CAAvB;AAOA,SAAO,EACN,GAAGK,IADG;AAENZ,IAAAA,UAFM;AAGNE,IAAAA,cAHM;AAINE,IAAAA,YAJM;AAKNE,IAAAA;AALM,GAAP;AAOA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { useSnapshot } from 'valtio';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nexport default function useSlot( name ) {\n\tconst {\n\t\tupdateSlot: registryUpdateSlot,\n\t\tunregisterSlot: registryUnregisterSlot,\n\t\tregisterFill: registryRegisterFill,\n\t\tunregisterFill: registryUnregisterFill,\n\t\t...registry\n\t} = useContext( SlotFillContext );\n\tconst slots = useSnapshot( registry.slots, { sync: true } );\n\t// The important bit here is that this call ensures\n\t// the hook only causes a re-render if the slot\n\t// with the given name change, not any other slot.\n\tconst slot = slots.get( name );\n\n\tconst updateSlot = useCallback(\n\t\t( fillProps ) => {\n\t\t\tregistryUpdateSlot( name, fillProps );\n\t\t},\n\t\t[ name, registryUpdateSlot ]\n\t);\n\n\tconst unregisterSlot = useCallback(\n\t\t( slotRef ) => {\n\t\t\tregistryUnregisterSlot( name, slotRef );\n\t\t},\n\t\t[ name, registryUnregisterSlot ]\n\t);\n\n\tconst registerFill = useCallback(\n\t\t( fillRef ) => {\n\t\t\tregistryRegisterFill( name, fillRef );\n\t\t},\n\t\t[ name, registryRegisterFill ]\n\t);\n\n\tconst unregisterFill = useCallback(\n\t\t( fillRef ) => {\n\t\t\tregistryUnregisterFill( name, fillRef );\n\t\t},\n\t\t[ name, registryUnregisterFill ]\n\t);\n\n\treturn {\n\t\t...slot,\n\t\tupdateSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t};\n}\n"]}
@@ -37,15 +37,21 @@ function FillComponent(_ref) {
37
37
  children
38
38
  });
39
39
  (0, _element.useLayoutEffect)(() => {
40
- registerFill(name, ref.current);
41
- return () => unregisterFill(name, ref.current);
40
+ const refValue = ref.current;
41
+ registerFill(name, refValue);
42
+ return () => unregisterFill(name, refValue); // Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
43
+ // We'll leave them as-is until a more detailed investigation/refactor can be performed.
44
+ // eslint-disable-next-line react-hooks/exhaustive-deps
42
45
  }, []);
43
46
  (0, _element.useLayoutEffect)(() => {
44
47
  ref.current.children = children;
45
48
 
46
49
  if (slot) {
47
50
  slot.forceUpdate();
48
- }
51
+ } // Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
52
+ // We'll leave them as-is until a more detailed investigation/refactor can be performed.
53
+ // eslint-disable-next-line react-hooks/exhaustive-deps
54
+
49
55
  }, [children]);
50
56
  (0, _element.useLayoutEffect)(() => {
51
57
  if (name === ref.current.name) {
@@ -55,7 +61,9 @@ function FillComponent(_ref) {
55
61
 
56
62
  unregisterFill(ref.current.name, ref.current);
57
63
  ref.current.name = name;
58
- registerFill(name, ref.current);
64
+ registerFill(name, ref.current); // Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
65
+ // We'll leave them as-is until a more detailed investigation/refactor can be performed.
66
+ // eslint-disable-next-line react-hooks/exhaustive-deps
59
67
  }, [name]);
60
68
 
61
69
  if (!slot || !slot.node) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/slot-fill/fill.js"],"names":["FillComponent","name","children","registerFill","unregisterFill","slot","ref","current","forceUpdate","node","props","fillProps","Fill"],"mappings":";;;;;;;;;AAKA;;;;AAKA;;AACA;;AAXA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,aAAT,OAA2E;AAAA,MAAnD;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,QAAR;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,GAAmD;AAC1E,QAAMC,IAAI,GAAG,sBAASJ,IAAT,CAAb;AAEA,QAAMK,GAAG,GAAG,qBAAQ;AACnBL,IAAAA,IADmB;AAEnBC,IAAAA;AAFmB,GAAR,CAAZ;AAKA,gCAAiB,MAAM;AACtBC,IAAAA,YAAY,CAAEF,IAAF,EAAQK,GAAG,CAACC,OAAZ,CAAZ;AACA,WAAO,MAAMH,cAAc,CAAEH,IAAF,EAAQK,GAAG,CAACC,OAAZ,CAA3B;AACA,GAHD,EAGG,EAHH;AAKA,gCAAiB,MAAM;AACtBD,IAAAA,GAAG,CAACC,OAAJ,CAAYL,QAAZ,GAAuBA,QAAvB;;AACA,QAAKG,IAAL,EAAY;AACXA,MAAAA,IAAI,CAACG,WAAL;AACA;AACD,GALD,EAKG,CAAEN,QAAF,CALH;AAOA,gCAAiB,MAAM;AACtB,QAAKD,IAAI,KAAKK,GAAG,CAACC,OAAJ,CAAYN,IAA1B,EAAiC;AAChC;AACA;AACA;;AACDG,IAAAA,cAAc,CAAEE,GAAG,CAACC,OAAJ,CAAYN,IAAd,EAAoBK,GAAG,CAACC,OAAxB,CAAd;AACAD,IAAAA,GAAG,CAACC,OAAJ,CAAYN,IAAZ,GAAmBA,IAAnB;AACAE,IAAAA,YAAY,CAAEF,IAAF,EAAQK,GAAG,CAACC,OAAZ,CAAZ;AACA,GARD,EAQG,CAAEN,IAAF,CARH;;AAUA,MAAK,CAAEI,IAAF,IAAU,CAAEA,IAAI,CAACI,IAAtB,EAA6B;AAC5B,WAAO,IAAP;AACA,GAhCyE,CAkC1E;;;AACA,MAAK,OAAOP,QAAP,KAAoB,UAAzB,EAAsC;AACrCA,IAAAA,QAAQ,GAAGA,QAAQ,CAAEG,IAAI,CAACK,KAAL,CAAWC,SAAb,CAAnB;AACA;;AAED,SAAO,2BAAcT,QAAd,EAAwBG,IAAI,CAACI,IAA7B,CAAP;AACA;;AAED,MAAMG,IAAI,GAAKF,KAAF,IACZ,4BAAC,gBAAD,CAAiB,QAAjB,QACG;AAAA,MAAE;AAAEP,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAAF;AAAA,SACD,4BAAC,aAAD,6BACMM,KADN;AAEC,IAAA,YAAY,EAAGP,YAFhB;AAGC,IAAA,cAAc,EAAGC;AAHlB,KADC;AAAA,CADH,CADD;;eAYeQ,I","sourcesContent":["// @ts-nocheck\n\n/**\n * WordPress dependencies\n */\nimport { createPortal, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport useSlot from './use-slot';\n\nfunction FillComponent( { name, children, registerFill, unregisterFill } ) {\n\tconst slot = useSlot( name );\n\n\tconst ref = useRef( {\n\t\tname,\n\t\tchildren,\n\t} );\n\n\tuseLayoutEffect( () => {\n\t\tregisterFill( name, ref.current );\n\t\treturn () => unregisterFill( name, ref.current );\n\t}, [] );\n\n\tuseLayoutEffect( () => {\n\t\tref.current.children = children;\n\t\tif ( slot ) {\n\t\t\tslot.forceUpdate();\n\t\t}\n\t}, [ children ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( name === ref.current.name ) {\n\t\t\t// Ignore initial effect.\n\t\t\treturn;\n\t\t}\n\t\tunregisterFill( ref.current.name, ref.current );\n\t\tref.current.name = name;\n\t\tregisterFill( name, ref.current );\n\t}, [ name ] );\n\n\tif ( ! slot || ! slot.node ) {\n\t\treturn null;\n\t}\n\n\t// If a function is passed as a child, provide it with the fillProps.\n\tif ( typeof children === 'function' ) {\n\t\tchildren = children( slot.props.fillProps );\n\t}\n\n\treturn createPortal( children, slot.node );\n}\n\nconst Fill = ( props ) => (\n\t<SlotFillContext.Consumer>\n\t\t{ ( { registerFill, unregisterFill } ) => (\n\t\t\t<FillComponent\n\t\t\t\t{ ...props }\n\t\t\t\tregisterFill={ registerFill }\n\t\t\t\tunregisterFill={ unregisterFill }\n\t\t\t/>\n\t\t) }\n\t</SlotFillContext.Consumer>\n);\n\nexport default Fill;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/slot-fill/fill.js"],"names":["FillComponent","name","children","registerFill","unregisterFill","slot","ref","refValue","current","forceUpdate","node","props","fillProps","Fill"],"mappings":";;;;;;;;;AAKA;;;;AAKA;;AACA;;AAXA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,aAAT,OAA2E;AAAA,MAAnD;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,QAAR;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,GAAmD;AAC1E,QAAMC,IAAI,GAAG,sBAASJ,IAAT,CAAb;AAEA,QAAMK,GAAG,GAAG,qBAAQ;AACnBL,IAAAA,IADmB;AAEnBC,IAAAA;AAFmB,GAAR,CAAZ;AAKA,gCAAiB,MAAM;AACtB,UAAMK,QAAQ,GAAGD,GAAG,CAACE,OAArB;AACAL,IAAAA,YAAY,CAAEF,IAAF,EAAQM,QAAR,CAAZ;AACA,WAAO,MAAMH,cAAc,CAAEH,IAAF,EAAQM,QAAR,CAA3B,CAHsB,CAItB;AACA;AACA;AACA,GAPD,EAOG,EAPH;AASA,gCAAiB,MAAM;AACtBD,IAAAA,GAAG,CAACE,OAAJ,CAAYN,QAAZ,GAAuBA,QAAvB;;AACA,QAAKG,IAAL,EAAY;AACXA,MAAAA,IAAI,CAACI,WAAL;AACA,KAJqB,CAKtB;AACA;AACA;;AACA,GARD,EAQG,CAAEP,QAAF,CARH;AAUA,gCAAiB,MAAM;AACtB,QAAKD,IAAI,KAAKK,GAAG,CAACE,OAAJ,CAAYP,IAA1B,EAAiC;AAChC;AACA;AACA;;AACDG,IAAAA,cAAc,CAAEE,GAAG,CAACE,OAAJ,CAAYP,IAAd,EAAoBK,GAAG,CAACE,OAAxB,CAAd;AACAF,IAAAA,GAAG,CAACE,OAAJ,CAAYP,IAAZ,GAAmBA,IAAnB;AACAE,IAAAA,YAAY,CAAEF,IAAF,EAAQK,GAAG,CAACE,OAAZ,CAAZ,CAPsB,CAQtB;AACA;AACA;AACA,GAXD,EAWG,CAAEP,IAAF,CAXH;;AAaA,MAAK,CAAEI,IAAF,IAAU,CAAEA,IAAI,CAACK,IAAtB,EAA6B;AAC5B,WAAO,IAAP;AACA,GA1CyE,CA4C1E;;;AACA,MAAK,OAAOR,QAAP,KAAoB,UAAzB,EAAsC;AACrCA,IAAAA,QAAQ,GAAGA,QAAQ,CAAEG,IAAI,CAACM,KAAL,CAAWC,SAAb,CAAnB;AACA;;AAED,SAAO,2BAAcV,QAAd,EAAwBG,IAAI,CAACK,IAA7B,CAAP;AACA;;AAED,MAAMG,IAAI,GAAKF,KAAF,IACZ,4BAAC,gBAAD,CAAiB,QAAjB,QACG;AAAA,MAAE;AAAER,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAAF;AAAA,SACD,4BAAC,aAAD,6BACMO,KADN;AAEC,IAAA,YAAY,EAAGR,YAFhB;AAGC,IAAA,cAAc,EAAGC;AAHlB,KADC;AAAA,CADH,CADD;;eAYeS,I","sourcesContent":["// @ts-nocheck\n\n/**\n * WordPress dependencies\n */\nimport { createPortal, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport useSlot from './use-slot';\n\nfunction FillComponent( { name, children, registerFill, unregisterFill } ) {\n\tconst slot = useSlot( name );\n\n\tconst ref = useRef( {\n\t\tname,\n\t\tchildren,\n\t} );\n\n\tuseLayoutEffect( () => {\n\t\tconst refValue = ref.current;\n\t\tregisterFill( name, refValue );\n\t\treturn () => unregisterFill( name, refValue );\n\t\t// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.\n\t\t// We'll leave them as-is until a more detailed investigation/refactor can be performed.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tuseLayoutEffect( () => {\n\t\tref.current.children = children;\n\t\tif ( slot ) {\n\t\t\tslot.forceUpdate();\n\t\t}\n\t\t// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.\n\t\t// We'll leave them as-is until a more detailed investigation/refactor can be performed.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ children ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( name === ref.current.name ) {\n\t\t\t// Ignore initial effect.\n\t\t\treturn;\n\t\t}\n\t\tunregisterFill( ref.current.name, ref.current );\n\t\tref.current.name = name;\n\t\tregisterFill( name, ref.current );\n\t\t// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.\n\t\t// We'll leave them as-is until a more detailed investigation/refactor can be performed.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ name ] );\n\n\tif ( ! slot || ! slot.node ) {\n\t\treturn null;\n\t}\n\n\t// If a function is passed as a child, provide it with the fillProps.\n\tif ( typeof children === 'function' ) {\n\t\tchildren = children( slot.props.fillProps );\n\t}\n\n\treturn createPortal( children, slot.node );\n}\n\nconst Fill = ( props ) => (\n\t<SlotFillContext.Consumer>\n\t\t{ ( { registerFill, unregisterFill } ) => (\n\t\t\t<FillComponent\n\t\t\t\t{ ...props }\n\t\t\t\tregisterFill={ registerFill }\n\t\t\t\tunregisterFill={ unregisterFill }\n\t\t\t/>\n\t\t) }\n\t</SlotFillContext.Consumer>\n);\n\nexport default Fill;\n"]}
@@ -38,7 +38,9 @@ const useSlot = name => {
38
38
  const unsubscribe = subscribe(() => {
39
39
  setSlot(getSlot(name));
40
40
  });
41
- return unsubscribe;
41
+ return unsubscribe; // Ignore reason: Modifying this dep array could introduce unexpected changes in behavior,
42
+ // so we'll leave it as=is until the hook can be properly refactored for exhaustive-deps.
43
+ // eslint-disable-next-line react-hooks/exhaustive-deps
42
44
  }, [name]);
43
45
  return slot;
44
46
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/slot-fill/use-slot.js"],"names":["useSlot","name","getSlot","subscribe","SlotFillContext","slot","setSlot","unsubscribe"],"mappings":";;;;;;;;;AAIA;;AAKA;;AATA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,OAAO,GAAKC,IAAF,IAAY;AAC3B,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAyB,yBAAYC,gBAAZ,CAA/B;AACA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,uBAAUJ,OAAO,CAAED,IAAF,CAAjB,CAA1B;AAEA,0BAAW,MAAM;AAChBK,IAAAA,OAAO,CAAEJ,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,UAAMM,WAAW,GAAGJ,SAAS,CAAE,MAAM;AACpCG,MAAAA,OAAO,CAAEJ,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,KAF4B,CAA7B;AAIA,WAAOM,WAAP;AACA,GAPD,EAOG,CAAEN,IAAF,CAPH;AASA,SAAOI,IAAP;AACA,CAdD;;eAgBeL,O","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport { useContext, useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\n\n/**\n * React hook returning the active slot given a name.\n *\n * @param {string} name Slot name.\n * @return {Object} Slot object.\n */\nconst useSlot = ( name ) => {\n\tconst { getSlot, subscribe } = useContext( SlotFillContext );\n\tconst [ slot, setSlot ] = useState( getSlot( name ) );\n\n\tuseEffect( () => {\n\t\tsetSlot( getSlot( name ) );\n\t\tconst unsubscribe = subscribe( () => {\n\t\t\tsetSlot( getSlot( name ) );\n\t\t} );\n\n\t\treturn unsubscribe;\n\t}, [ name ] );\n\n\treturn slot;\n};\n\nexport default useSlot;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/slot-fill/use-slot.js"],"names":["useSlot","name","getSlot","subscribe","SlotFillContext","slot","setSlot","unsubscribe"],"mappings":";;;;;;;;;AAIA;;AAKA;;AATA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,OAAO,GAAKC,IAAF,IAAY;AAC3B,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAyB,yBAAYC,gBAAZ,CAA/B;AACA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,uBAAUJ,OAAO,CAAED,IAAF,CAAjB,CAA1B;AAEA,0BAAW,MAAM;AAChBK,IAAAA,OAAO,CAAEJ,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,UAAMM,WAAW,GAAGJ,SAAS,CAAE,MAAM;AACpCG,MAAAA,OAAO,CAAEJ,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,KAF4B,CAA7B;AAIA,WAAOM,WAAP,CANgB,CAOhB;AACA;AACA;AACA,GAVD,EAUG,CAAEN,IAAF,CAVH;AAYA,SAAOI,IAAP;AACA,CAjBD;;eAmBeL,O","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport { useContext, useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\n\n/**\n * React hook returning the active slot given a name.\n *\n * @param {string} name Slot name.\n * @return {Object} Slot object.\n */\nconst useSlot = ( name ) => {\n\tconst { getSlot, subscribe } = useContext( SlotFillContext );\n\tconst [ slot, setSlot ] = useState( getSlot( name ) );\n\n\tuseEffect( () => {\n\t\tsetSlot( getSlot( name ) );\n\t\tconst unsubscribe = subscribe( () => {\n\t\t\tsetSlot( getSlot( name ) );\n\t\t} );\n\n\t\treturn unsubscribe;\n\t\t// Ignore reason: Modifying this dep array could introduce unexpected changes in behavior,\n\t\t// so we'll leave it as=is until the hook can be properly refactored for exhaustive-deps.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ name ] );\n\n\treturn slot;\n};\n\nexport default useSlot;\n"]}
@@ -100,7 +100,7 @@ function Snackbar(_ref, ref) {
100
100
  }
101
101
  }, NOTICE_TIMEOUT);
102
102
  return () => clearTimeout(timeoutHandle);
103
- }, [onDismiss, onRemove]);
103
+ }, [onDismiss, onRemove, explicitDismiss]);
104
104
  const classes = (0, _classnames.default)(className, 'components-snackbar', {
105
105
  'components-snackbar-explicit-dismiss': !!explicitDismiss
106
106
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/snackbar/index.js"],"names":["noop","NOTICE_TIMEOUT","useSpokenMessage","message","politeness","spokenMessage","Snackbar","ref","className","children","actions","onRemove","icon","explicitDismiss","onDismiss","listRef","dismissMe","event","preventDefault","current","focus","onActionClick","onClick","stopPropagation","timeoutHandle","setTimeout","clearTimeout","classes","length","snackbarContentClassnames","map","index","label","url"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAGA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,cAAc,GAAG,KAAvB;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,OAA3B,EAAoCC,UAApC,EAAiD;AAChD,QAAMC,aAAa,GAClB,OAAOF,OAAP,KAAmB,QAAnB,GAA8BA,OAA9B,GAAwC,6BAAgBA,OAAhB,CADzC;AAGA,0BAAW,MAAM;AAChB,QAAKE,aAAL,EAAqB;AACpB,uBAAOA,aAAP,EAAsBD,UAAtB;AACA;AACD,GAJD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AC;AAPX,OASGU,KATH,CADD;AAaA,GAdC,CALH,EAoBGnB,eAAe,IAChB;AACC,IAAA,IAAI,EAAC,QADN;AAEC,kBAAW,qBAFZ;AAGC,IAAA,QAAQ,EAAC,GAHV;AAIC,IAAA,SAAS,EAAC,qCAJX;AAKC,IAAA,OAAO,EAAGG,SALX;AAMC,IAAA,UAAU,EAAGA;AANd,cArBF,CATD,CADD;AA6CA;;eAEc,yBAAYV,QAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { useEffect, forwardRef, renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { Button } from '../';\n\nconst noop = () => {};\nconst NOTICE_TIMEOUT = 10000;\n\n/** @typedef {import('@wordpress/element').WPElement} WPElement */\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param {string|WPElement} [message] Message to announce.\n * @param {'polite'|'assertive'} politeness Politeness to announce.\n */\nfunction useSpokenMessage( message, politeness ) {\n\tconst spokenMessage =\n\t\ttypeof message === 'string' ? message : renderToString( message );\n\n\tuseEffect( () => {\n\t\tif ( spokenMessage ) {\n\t\t\tspeak( spokenMessage, politeness );\n\t\t}\n\t}, [ spokenMessage, politeness ] );\n}\n\nfunction Snackbar(\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\tspokenMessage = children,\n\t\tpoliteness = 'polite',\n\t\tactions = [],\n\t\tonRemove = noop,\n\t\ticon = null,\n\t\texplicitDismiss = false,\n\t\t// onDismiss is a callback executed when the snackbar is dismissed.\n\t\t// It is distinct from onRemove, which _looks_ like a callback but is\n\t\t// actually the function to call to remove the snackbar from the UI.\n\t\tonDismiss = noop,\n\t\tlistRef,\n\t},\n\tref\n) {\n\tonDismiss = onDismiss || noop;\n\n\tfunction dismissMe( event ) {\n\t\tif ( event && event.preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\t// Prevent focus loss by moving it to the list element.\n\t\tlistRef.current.focus();\n\n\t\tonDismiss();\n\t\tonRemove();\n\t}\n\n\tfunction onActionClick( event, onClick ) {\n\t\tevent.stopPropagation();\n\n\t\tonRemove();\n\n\t\tif ( onClick ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\tuseSpokenMessage( spokenMessage, politeness );\n\n\t// Only set up the timeout dismiss if we're not explicitly dismissing.\n\tuseEffect( () => {\n\t\tconst timeoutHandle = setTimeout( () => {\n\t\t\tif ( ! explicitDismiss ) {\n\t\t\t\tonDismiss();\n\t\t\t\tonRemove();\n\t\t\t}\n\t\t}, NOTICE_TIMEOUT );\n\n\t\treturn () => clearTimeout( timeoutHandle );\n\t}, [ onDismiss, onRemove ] );\n\n\tconst classes = classnames( className, 'components-snackbar', {\n\t\t'components-snackbar-explicit-dismiss': !! explicitDismiss,\n\t} );\n\tif ( actions && actions.length > 1 ) {\n\t\t// We need to inform developers that snackbar only accepts 1 action.\n\t\twarning(\n\t\t\t'Snackbar can only have 1 action, use Notice if your message require many messages'\n\t\t);\n\t\t// return first element only while keeping it inside an array\n\t\tactions = [ actions[ 0 ] ];\n\t}\n\n\tconst snackbarContentClassnames = classnames(\n\t\t'components-snackbar__content',\n\t\t{\n\t\t\t'components-snackbar__content-with-icon': !! icon,\n\t\t}\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ classes }\n\t\t\tonClick={ ! explicitDismiss ? dismissMe : noop }\n\t\t\ttabIndex=\"0\"\n\t\t\trole={ ! explicitDismiss ? 'button' : '' }\n\t\t\tonKeyPress={ ! explicitDismiss ? dismissMe : noop }\n\t\t\taria-label={ ! explicitDismiss ? __( 'Dismiss this notice' ) : '' }\n\t\t>\n\t\t\t<div className={ snackbarContentClassnames }>\n\t\t\t\t{ icon && (\n\t\t\t\t\t<div className=\"components-snackbar__icon\">{ icon }</div>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ actions.map( ( { label, onClick, url }, index ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\thref={ url }\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ ( event ) =>\n\t\t\t\t\t\t\t\tonActionClick( event, onClick )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"components-snackbar__action\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ explicitDismiss && (\n\t\t\t\t\t<span\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\taria-label=\"Dismiss this notice\"\n\t\t\t\t\t\ttabIndex=\"0\"\n\t\t\t\t\t\tclassName=\"components-snackbar__dismiss-button\"\n\t\t\t\t\t\tonClick={ dismissMe }\n\t\t\t\t\t\tonKeyPress={ dismissMe }\n\t\t\t\t\t>\n\t\t\t\t\t\t&#x2715;\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( Snackbar );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/snackbar/index.js"],"names":["noop","NOTICE_TIMEOUT","useSpokenMessage","message","politeness","spokenMessage","Snackbar","ref","className","children","actions","onRemove","icon","explicitDismiss","onDismiss","listRef","dismissMe","event","preventDefault","current","focus","onActionClick","onClick","stopPropagation","timeoutHandle","setTimeout","clearTimeout","classes","length","snackbarContentClassnames","map","index","label","url"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAGA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,cAAc,GAAG,KAAvB;AAEA;;AAEA;AACA;AACA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QAApC;AAAEC,MAAAA,KAAF;AAASV,MAAAA,OAAT;AAAkBW,MAAAA;AAAlB,KAAoC;AACpD,WACC,4BAAC,QAAD;AACC,MAAA,GAAG,EAAGF,KADP;AAEC,MAAA,IAAI,EAAGE,GAFR;AAGC,MAAA,OAAO,EAAC,UAHT;AAIC,MAAA,OAAO,EAAKhB,KAAF,IACTI,aAAa,CAAEJ,KAAF,EAASK,OAAT,CALf;AAOC,MAAA,SAAS,EAAC;AAPX,OASGU,KATH,CADD;AAaA,GAdC,CALH,EAoBGnB,eAAe,IAChB;AACC,IAAA,IAAI,EAAC,QADN;AAEC,kBAAW,qBAFZ;AAGC,IAAA,QAAQ,EAAC,GAHV;AAIC,IAAA,SAAS,EAAC,qCAJX;AAKC,IAAA,OAAO,EAAGG,SALX;AAMC,IAAA,UAAU,EAAGA;AANd,cArBF,CATD,CADD;AA6CA;;eAEc,yBAAYV,QAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { useEffect, forwardRef, renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { Button } from '../';\n\nconst noop = () => {};\nconst NOTICE_TIMEOUT = 10000;\n\n/** @typedef {import('@wordpress/element').WPElement} WPElement */\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param {string|WPElement} [message] Message to announce.\n * @param {'polite'|'assertive'} politeness Politeness to announce.\n */\nfunction useSpokenMessage( message, politeness ) {\n\tconst spokenMessage =\n\t\ttypeof message === 'string' ? message : renderToString( message );\n\n\tuseEffect( () => {\n\t\tif ( spokenMessage ) {\n\t\t\tspeak( spokenMessage, politeness );\n\t\t}\n\t}, [ spokenMessage, politeness ] );\n}\n\nfunction Snackbar(\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\tspokenMessage = children,\n\t\tpoliteness = 'polite',\n\t\tactions = [],\n\t\tonRemove = noop,\n\t\ticon = null,\n\t\texplicitDismiss = false,\n\t\t// onDismiss is a callback executed when the snackbar is dismissed.\n\t\t// It is distinct from onRemove, which _looks_ like a callback but is\n\t\t// actually the function to call to remove the snackbar from the UI.\n\t\tonDismiss = noop,\n\t\tlistRef,\n\t},\n\tref\n) {\n\tonDismiss = onDismiss || noop;\n\n\tfunction dismissMe( event ) {\n\t\tif ( event && event.preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\t// Prevent focus loss by moving it to the list element.\n\t\tlistRef.current.focus();\n\n\t\tonDismiss();\n\t\tonRemove();\n\t}\n\n\tfunction onActionClick( event, onClick ) {\n\t\tevent.stopPropagation();\n\n\t\tonRemove();\n\n\t\tif ( onClick ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\tuseSpokenMessage( spokenMessage, politeness );\n\n\t// Only set up the timeout dismiss if we're not explicitly dismissing.\n\tuseEffect( () => {\n\t\tconst timeoutHandle = setTimeout( () => {\n\t\t\tif ( ! explicitDismiss ) {\n\t\t\t\tonDismiss();\n\t\t\t\tonRemove();\n\t\t\t}\n\t\t}, NOTICE_TIMEOUT );\n\n\t\treturn () => clearTimeout( timeoutHandle );\n\t}, [ onDismiss, onRemove, explicitDismiss ] );\n\n\tconst classes = classnames( className, 'components-snackbar', {\n\t\t'components-snackbar-explicit-dismiss': !! explicitDismiss,\n\t} );\n\tif ( actions && actions.length > 1 ) {\n\t\t// We need to inform developers that snackbar only accepts 1 action.\n\t\twarning(\n\t\t\t'Snackbar can only have 1 action, use Notice if your message require many messages'\n\t\t);\n\t\t// return first element only while keeping it inside an array\n\t\tactions = [ actions[ 0 ] ];\n\t}\n\n\tconst snackbarContentClassnames = classnames(\n\t\t'components-snackbar__content',\n\t\t{\n\t\t\t'components-snackbar__content-with-icon': !! icon,\n\t\t}\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ classes }\n\t\t\tonClick={ ! explicitDismiss ? dismissMe : noop }\n\t\t\ttabIndex=\"0\"\n\t\t\trole={ ! explicitDismiss ? 'button' : '' }\n\t\t\tonKeyPress={ ! explicitDismiss ? dismissMe : noop }\n\t\t\taria-label={ ! explicitDismiss ? __( 'Dismiss this notice' ) : '' }\n\t\t>\n\t\t\t<div className={ snackbarContentClassnames }>\n\t\t\t\t{ icon && (\n\t\t\t\t\t<div className=\"components-snackbar__icon\">{ icon }</div>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ actions.map( ( { label, onClick, url }, index ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\thref={ url }\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ ( event ) =>\n\t\t\t\t\t\t\t\tonActionClick( event, onClick )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"components-snackbar__action\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ explicitDismiss && (\n\t\t\t\t\t<span\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\taria-label=\"Dismiss this notice\"\n\t\t\t\t\t\ttabIndex=\"0\"\n\t\t\t\t\t\tclassName=\"components-snackbar__dismiss-button\"\n\t\t\t\t\t\tonClick={ dismissMe }\n\t\t\t\t\t\tonKeyPress={ dismissMe }\n\t\t\t\t\t>\n\t\t\t\t\t\t&#x2715;\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( Snackbar );\n"]}
@@ -102,7 +102,7 @@ function TabPanel(_ref2) {
102
102
  const instanceId = (0, _compose.useInstanceId)(TabPanel, 'tab-panel');
103
103
  const [selected, setSelected] = (0, _element.useState)();
104
104
 
105
- const handleClick = tabKey => {
105
+ const handleTabSelection = tabKey => {
106
106
  setSelected(tabKey);
107
107
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(tabKey);
108
108
  };
@@ -116,14 +116,10 @@ function TabPanel(_ref2) {
116
116
  });
117
117
  const selectedId = `${instanceId}-${(_selectedTab$name = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.name) !== null && _selectedTab$name !== void 0 ? _selectedTab$name : 'none'}`;
118
118
  (0, _element.useEffect)(() => {
119
- const newSelectedTab = (0, _lodash.find)(tabs, {
120
- name: selected
121
- });
122
-
123
- if (!newSelectedTab) {
124
- setSelected(initialTabName || (tabs.length > 0 ? tabs[0].name : undefined));
119
+ if (!(selectedTab !== null && selectedTab !== void 0 && selectedTab.name) && tabs.length > 0) {
120
+ handleTabSelection(initialTabName || tabs[0].name);
125
121
  }
126
- }, [tabs]);
122
+ }, [tabs, selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.name, initialTabName]);
127
123
  return (0, _element.createElement)("div", {
128
124
  className: className
129
125
  }, (0, _element.createElement)(_navigableContainer.NavigableMenu, {
@@ -139,7 +135,7 @@ function TabPanel(_ref2) {
139
135
  "aria-controls": `${instanceId}-${tab.name}-view`,
140
136
  selected: tab.name === selected,
141
137
  key: tab.name,
142
- onClick: () => handleClick(tab.name)
138
+ onClick: () => handleTabSelection(tab.name)
143
139
  }, tab.title))), selectedTab && (0, _element.createElement)("div", {
144
140
  key: selectedId,
145
141
  "aria-labelledby": selectedId,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tab-panel/index.tsx"],"names":["TabButton","tabId","onClick","children","selected","rest","TabPanel","className","tabs","initialTabName","orientation","activeClass","onSelect","instanceId","setSelected","handleClick","tabKey","onNavigate","_childIndex","child","click","selectedTab","name","selectedId","newSelectedTab","length","undefined","map","tab","title"],"mappings":";;;;;;;;;;AASA;;;;AANA;;AACA;;AAMA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAMA,M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ANH,CADD,EA0BGR,WAAW,IACZ;AACC,IAAA,GAAG,EAAGE,UADP;AAEC,uBAAkBA,UAFnB;AAGC,IAAA,IAAI,EAAC,UAHN;AAIC,IAAA,EAAE,EAAI,GAAGA,UAAY,OAJtB;AAKC,IAAA,SAAS,EAAC;AALX,KAOGpB,QAAQ,CAAEkB,WAAF,CAPX,CA3BF,CADD;AAwCA;;eAEcf,Q","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { find } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { NavigableMenu } from '../navigable-container';\nimport Button from '../button';\nimport type { TabButtonProps, TabPanelProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst TabButton = ( {\n\ttabId,\n\tonClick,\n\tchildren,\n\tselected,\n\t...rest\n}: TabButtonProps ) => (\n\t<Button\n\t\trole=\"tab\"\n\t\ttabIndex={ selected ? null : -1 }\n\t\taria-selected={ selected }\n\t\tid={ tabId }\n\t\tonClick={ onClick }\n\t\t{ ...rest }\n\t>\n\t\t{ children }\n\t</Button>\n);\n\n/**\n * TabPanel is an ARIA-compliant tabpanel.\n *\n * TabPanels organize content across different screens, data sets, and interactions.\n * It has two sections: a list of tabs, and the view to show when tabs are chosen.\n *\n * ```jsx\n * import { TabPanel } from '@wordpress/components';\n *\n * const onSelect = ( tabName ) => {\n * console.log( 'Selecting tab', tabName );\n * };\n *\n * const MyTabPanel = () => (\n * <TabPanel\n * className=\"my-tab-panel\"\n * activeClass=\"active-tab\"\n * onSelect={ onSelect }\n * tabs={ [\n * {\n * name: 'tab1',\n * title: 'Tab 1',\n * className: 'tab-one',\n * },\n * {\n * name: 'tab2',\n * title: 'Tab 2',\n * className: 'tab-two',\n * },\n * ] }\n * >\n * { ( tab ) => <p>{ tab.title }</p> }\n * </TabPanel>\n * );\n * ```\n */\nexport function TabPanel( {\n\tclassName,\n\tchildren,\n\ttabs,\n\tinitialTabName,\n\torientation = 'horizontal',\n\tactiveClass = 'is-active',\n\tonSelect,\n}: WordPressComponentProps< TabPanelProps, 'div', false > ) {\n\tconst instanceId = useInstanceId( TabPanel, 'tab-panel' );\n\tconst [ selected, setSelected ] = useState< string >();\n\n\tconst handleClick = ( tabKey: string ) => {\n\t\tsetSelected( tabKey );\n\t\tonSelect?.( tabKey );\n\t};\n\n\tconst onNavigate = ( _childIndex: number, child: HTMLButtonElement ) => {\n\t\tchild.click();\n\t};\n\tconst selectedTab = find( tabs, { name: selected } );\n\tconst selectedId = `${ instanceId }-${ selectedTab?.name ?? 'none' }`;\n\n\tuseEffect( () => {\n\t\tconst newSelectedTab = find( tabs, { name: selected } );\n\t\tif ( ! newSelectedTab ) {\n\t\t\tsetSelected(\n\t\t\t\tinitialTabName ||\n\t\t\t\t\t( tabs.length > 0 ? tabs[ 0 ].name : undefined )\n\t\t\t);\n\t\t}\n\t}, [ tabs ] );\n\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<NavigableMenu\n\t\t\t\trole=\"tablist\"\n\t\t\t\torientation={ orientation }\n\t\t\t\tonNavigate={ onNavigate }\n\t\t\t\tclassName=\"components-tab-panel__tabs\"\n\t\t\t>\n\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t<TabButton\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'components-tab-panel__tabs-item',\n\t\t\t\t\t\t\ttab.className,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ activeClass ]: tab.name === selected,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\ttabId={ `${ instanceId }-${ tab.name }` }\n\t\t\t\t\t\taria-controls={ `${ instanceId }-${ tab.name }-view` }\n\t\t\t\t\t\tselected={ tab.name === selected }\n\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\tonClick={ () => handleClick( tab.name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t</TabButton>\n\t\t\t\t) ) }\n\t\t\t</NavigableMenu>\n\t\t\t{ selectedTab && (\n\t\t\t\t<div\n\t\t\t\t\tkey={ selectedId }\n\t\t\t\t\taria-labelledby={ selectedId }\n\t\t\t\t\trole=\"tabpanel\"\n\t\t\t\t\tid={ `${ selectedId }-view` }\n\t\t\t\t\tclassName=\"components-tab-panel__tab-content\"\n\t\t\t\t>\n\t\t\t\t\t{ children( selectedTab ) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default TabPanel;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tab-panel/index.tsx"],"names":["TabButton","tabId","onClick","children","selected","rest","TabPanel","className","tabs","initialTabName","orientation","activeClass","onSelect","instanceId","setSelected","handleTabSelection","tabKey","onNavigate","_childIndex","child","click","selectedTab","name","selectedId","length","map","tab","title"],"mappings":";;;;;;;;;;AASA;;;;AANA;;AACA;;AAMA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAMA,MAAMA,SAAS,GAAG;AAAA,MAAE;AACnBC,IAAAA,KADmB;AAEnBC,IAAAA,OAFmB;AAGnBC,IAAAA,QAHmB;AAInBC,IAAAA,QAJmB;AAKnB,OAAGC;AALgB,GAAF;AAAA,SAOjB,4BAAC,eAAD;AACC,IAAA,IAAI,EAAC,KADN;AAEC,IAAA,QAAQ,EAAGD,QAAQ,GAAG,IAAH,GAAU,CAAC,CAF/B;AAGC,qBAAgBA,QAHjB;AAIC,IAAA,EAAE,EAAGH,KAJN;AAKC,IAAA,OAAO,EAAGC;AALX,KAMMG,IANN,GAQGF,QARH,CAPiB;AAAA,CAAlB;AAmBA;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;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AAA,SAAS,EAAGF;AAAjB,KACC,4BAAC,iCAAD;AACC,IAAA,IAAI,EAAC,SADN;AAEC,IAAA,WAAW,EAAGG,WAFf;AAGC,IAAA,UAAU,EAAGO,UAHd;AAIC,IAAA,SAAS,EAAC;AAJX,KAMGT,IAAI,CAACiB,GAAL,CAAYC,GAAF,IACX,4BAAC,SAAD;AACC,IAAA,SAAS,EAAG,yBACX,iCADW,EAEXA,GAAG,CAACnB,SAFO,EAGX;AACC,OAAEI,WAAF,GAAiBe,GAAG,CAACJ,IAAJ,KAAalB;AAD/B,KAHW,CADb;AAQC,IAAA,KAAK,EAAI,GAAGS,UAAY,IAAIa,GAAG,CAACJ,IAAM,EARvC;AASC,qBAAiB,GAAGT,UAAY,IAAIa,GAAG,CAACJ,IAAM,OAT/C;AAUC,IAAA,QAAQ,EAAGI,GAAG,CAACJ,IAAJ,KAAalB,QAVzB;AAWC,IAAA,GAAG,EAAGsB,GAAG,CAACJ,IAXX;AAYC,IAAA,OAAO,EAAG,MAAMP,kBAAkB,CAAEW,GAAG,CAACJ,IAAN;AAZnC,KAcGI,GAAG,CAACC,KAdP,CADC,CANH,CADD,EA0BGN,WAAW,IACZ;AACC,IAAA,GAAG,EAAGE,UADP;AAEC,uBAAkBA,UAFnB;AAGC,IAAA,IAAI,EAAC,UAHN;AAIC,IAAA,EAAE,EAAI,GAAGA,UAAY,OAJtB;AAKC,IAAA,SAAS,EAAC;AALX,KAOGpB,QAAQ,CAAEkB,WAAF,CAPX,CA3BF,CADD;AAwCA;;eAEcf,Q","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { find } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { NavigableMenu } from '../navigable-container';\nimport Button from '../button';\nimport type { TabButtonProps, TabPanelProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst TabButton = ( {\n\ttabId,\n\tonClick,\n\tchildren,\n\tselected,\n\t...rest\n}: TabButtonProps ) => (\n\t<Button\n\t\trole=\"tab\"\n\t\ttabIndex={ selected ? null : -1 }\n\t\taria-selected={ selected }\n\t\tid={ tabId }\n\t\tonClick={ onClick }\n\t\t{ ...rest }\n\t>\n\t\t{ children }\n\t</Button>\n);\n\n/**\n * TabPanel is an ARIA-compliant tabpanel.\n *\n * TabPanels organize content across different screens, data sets, and interactions.\n * It has two sections: a list of tabs, and the view to show when tabs are chosen.\n *\n * ```jsx\n * import { TabPanel } from '@wordpress/components';\n *\n * const onSelect = ( tabName ) => {\n * console.log( 'Selecting tab', tabName );\n * };\n *\n * const MyTabPanel = () => (\n * <TabPanel\n * className=\"my-tab-panel\"\n * activeClass=\"active-tab\"\n * onSelect={ onSelect }\n * tabs={ [\n * {\n * name: 'tab1',\n * title: 'Tab 1',\n * className: 'tab-one',\n * },\n * {\n * name: 'tab2',\n * title: 'Tab 2',\n * className: 'tab-two',\n * },\n * ] }\n * >\n * { ( tab ) => <p>{ tab.title }</p> }\n * </TabPanel>\n * );\n * ```\n */\nexport function TabPanel( {\n\tclassName,\n\tchildren,\n\ttabs,\n\tinitialTabName,\n\torientation = 'horizontal',\n\tactiveClass = 'is-active',\n\tonSelect,\n}: WordPressComponentProps< TabPanelProps, 'div', false > ) {\n\tconst instanceId = useInstanceId( TabPanel, 'tab-panel' );\n\tconst [ selected, setSelected ] = useState< string >();\n\n\tconst handleTabSelection = ( tabKey: string ) => {\n\t\tsetSelected( tabKey );\n\t\tonSelect?.( tabKey );\n\t};\n\n\tconst onNavigate = ( _childIndex: number, child: HTMLButtonElement ) => {\n\t\tchild.click();\n\t};\n\tconst selectedTab = find( tabs, { name: selected } );\n\tconst selectedId = `${ instanceId }-${ selectedTab?.name ?? 'none' }`;\n\n\tuseEffect( () => {\n\t\tif ( ! selectedTab?.name && tabs.length > 0 ) {\n\t\t\thandleTabSelection( initialTabName || tabs[ 0 ].name );\n\t\t}\n\t}, [ tabs, selectedTab?.name, initialTabName ] );\n\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<NavigableMenu\n\t\t\t\trole=\"tablist\"\n\t\t\t\torientation={ orientation }\n\t\t\t\tonNavigate={ onNavigate }\n\t\t\t\tclassName=\"components-tab-panel__tabs\"\n\t\t\t>\n\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t<TabButton\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'components-tab-panel__tabs-item',\n\t\t\t\t\t\t\ttab.className,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ activeClass ]: tab.name === selected,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\ttabId={ `${ instanceId }-${ tab.name }` }\n\t\t\t\t\t\taria-controls={ `${ instanceId }-${ tab.name }-view` }\n\t\t\t\t\t\tselected={ tab.name === selected }\n\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\tonClick={ () => handleTabSelection( tab.name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t</TabButton>\n\t\t\t\t) ) }\n\t\t\t</NavigableMenu>\n\t\t\t{ selectedTab && (\n\t\t\t\t<div\n\t\t\t\t\tkey={ selectedId }\n\t\t\t\t\taria-labelledby={ selectedId }\n\t\t\t\t\trole=\"tabpanel\"\n\t\t\t\t\tid={ `${ selectedId }-view` }\n\t\t\t\t\tclassName=\"components-tab-panel__tab-content\"\n\t\t\t\t>\n\t\t\t\t\t{ children( selectedTab ) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default TabPanel;\n"]}
@@ -63,8 +63,6 @@ function UnforwardedTextControl(props, ref) {
63
63
  /**
64
64
  * TextControl components let users enter and edit text.
65
65
  *
66
- *
67
- * @example
68
66
  * ```jsx
69
67
  * import { TextControl } from '@wordpress/components';
70
68
  * import { useState } from '@wordpress/element';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/text-control/index.tsx"],"names":["UnforwardedTextControl","props","ref","__nextHasNoMarginBottom","label","hideLabelFromVision","value","help","className","onChange","type","additionalProps","instanceId","TextControl","id","onChangeValue","event","target","undefined"],"mappings":";;;;;;;;;AASA;;;;AADA;;AAMA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAKA,SAASA,sBAAT,CACCC,KADD,EAECC,GAFD,EAGE;AACD,QAAM;AACLC,IAAAA,uBADK;AAELC,IAAAA,KAFK;AAGLC,IAAAA,mBAHK;AAILC,IAAAA,KAJK;AAKLC,IAAAA,IALK;AAMLC,IAAAA,SANK;AAOLC,IAAAA,QAPK;AAQLC,IAAAA,IAAI,GAAG,MARF;AASL,OAAGC;AATE,MAUFV,KAVJ;AAWA,QAAMW,UAAU,GAAG,4BAAeC,WAAf,CAAnB;AACA,QAAMC,EAAE,GAAI,0BAA0BF,UAAY,EAAlD;;AACA,QAAMG,aAAa,GAAKC,KAAF,IACrBP,QAAQ,CAAEO,KAAK,CAACC,MAAN,CAAaX,KAAf,CADT;;AAGA,SACC,4BAAC,oBAAD;AACC,IAAA,uBAAuB,EAAGH,uBAD3B;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,EAAE,EAAGS,EAJN;AAKC,IAAA,IAAI,EAAGP,IALR;AAMC,IAAA,SAAS,EAAGC;AANb,KAQC;AACC,IAAA,SAAS,EAAC,gCADX;AAEC,IAAA,IAAI,EAAGE,IAFR;AAGC,IAAA,EAAE,EAAGI,EAHN;AAIC,IAAA,KAAK,EAAGR,KAJT;AAKC,IAAA,QAAQ,EAAGS,aALZ;AAMC,wBAAmB,CAAC,CAAER,IAAH,GAAUO,EAAE,GAAG,QAAf,GAA0BI,SAN9C;AAOC,IAAA,GAAG,EAAGhB;AAPP,KAQMS,eARN,EARD,CADD;AAqBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,WAAW,GAAG,yBAAYb,sBAAZ,CAApB;;eAEQa,W","sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { TextControlProps } from './types';\n\nfunction UnforwardedTextControl(\n\tprops: WordPressComponentProps< TextControlProps, 'input', false >,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom,\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tclassName,\n\t\tonChange,\n\t\ttype = 'text',\n\t\t...additionalProps\n\t} = props;\n\tconst instanceId = useInstanceId( TextControl );\n\tconst id = `inspector-text-control-${ instanceId }`;\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t>\n\t\t\t<input\n\t\t\t\tclassName=\"components-text-control__input\"\n\t\t\t\ttype={ type }\n\t\t\t\tid={ id }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * TextControl components let users enter and edit text.\n *\n *\n * @example\n * ```jsx\n * import { TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTextControl = () => {\n * const [ className, setClassName ] = useState( '' );\n *\n * return (\n * <TextControl\n * label=\"Additional CSS Class\"\n * value={ className }\n * onChange={ ( value ) => setClassName( value ) }\n * />\n * );\n * };\n * ```\n */\nexport const TextControl = forwardRef( UnforwardedTextControl );\n\nexport default TextControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/text-control/index.tsx"],"names":["UnforwardedTextControl","props","ref","__nextHasNoMarginBottom","label","hideLabelFromVision","value","help","className","onChange","type","additionalProps","instanceId","TextControl","id","onChangeValue","event","target","undefined"],"mappings":";;;;;;;;;AASA;;;;AADA;;AAMA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAKA,SAASA,sBAAT,CACCC,KADD,EAECC,GAFD,EAGE;AACD,QAAM;AACLC,IAAAA,uBADK;AAELC,IAAAA,KAFK;AAGLC,IAAAA,mBAHK;AAILC,IAAAA,KAJK;AAKLC,IAAAA,IALK;AAMLC,IAAAA,SANK;AAOLC,IAAAA,QAPK;AAQLC,IAAAA,IAAI,GAAG,MARF;AASL,OAAGC;AATE,MAUFV,KAVJ;AAWA,QAAMW,UAAU,GAAG,4BAAeC,WAAf,CAAnB;AACA,QAAMC,EAAE,GAAI,0BAA0BF,UAAY,EAAlD;;AACA,QAAMG,aAAa,GAAKC,KAAF,IACrBP,QAAQ,CAAEO,KAAK,CAACC,MAAN,CAAaX,KAAf,CADT;;AAGA,SACC,4BAAC,oBAAD;AACC,IAAA,uBAAuB,EAAGH,uBAD3B;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,EAAE,EAAGS,EAJN;AAKC,IAAA,IAAI,EAAGP,IALR;AAMC,IAAA,SAAS,EAAGC;AANb,KAQC;AACC,IAAA,SAAS,EAAC,gCADX;AAEC,IAAA,IAAI,EAAGE,IAFR;AAGC,IAAA,EAAE,EAAGI,EAHN;AAIC,IAAA,KAAK,EAAGR,KAJT;AAKC,IAAA,QAAQ,EAAGS,aALZ;AAMC,wBAAmB,CAAC,CAAER,IAAH,GAAUO,EAAE,GAAG,QAAf,GAA0BI,SAN9C;AAOC,IAAA,GAAG,EAAGhB;AAPP,KAQMS,eARN,EARD,CADD;AAqBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,WAAW,GAAG,yBAAYb,sBAAZ,CAApB;;eAEQa,W","sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { TextControlProps } from './types';\n\nfunction UnforwardedTextControl(\n\tprops: WordPressComponentProps< TextControlProps, 'input', false >,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom,\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tclassName,\n\t\tonChange,\n\t\ttype = 'text',\n\t\t...additionalProps\n\t} = props;\n\tconst instanceId = useInstanceId( TextControl );\n\tconst id = `inspector-text-control-${ instanceId }`;\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t>\n\t\t\t<input\n\t\t\t\tclassName=\"components-text-control__input\"\n\t\t\t\ttype={ type }\n\t\t\t\tid={ id }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * TextControl components let users enter and edit text.\n *\n * ```jsx\n * import { TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTextControl = () => {\n * const [ className, setClassName ] = useState( '' );\n *\n * return (\n * <TextControl\n * label=\"Additional CSS Class\"\n * value={ className }\n * onChange={ ( value ) => setClassName( value ) }\n * />\n * );\n * };\n * ```\n */\nexport const TextControl = forwardRef( UnforwardedTextControl );\n\nexport default TextControl;\n"]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _colord = require("colord");
13
+
14
+ var _a11y = _interopRequireDefault(require("colord/plugins/a11y"));
15
+
16
+ var _names = _interopRequireDefault(require("colord/plugins/names"));
17
+
18
+ var _styles = require("./styles");
19
+
20
+ /**
21
+ * External dependencies
22
+ */
23
+ (0, _colord.extend)([_names.default, _a11y.default]);
24
+ /**
25
+ * `Theme` allows defining theme variables for components in the `@wordpress/components` package.
26
+ *
27
+ * Multiple `Theme` components can be nested in order to override specific theme variables.
28
+ *
29
+ *
30
+ * @example
31
+ * ```jsx
32
+ * import { __experimentalTheme as Theme } from '@wordpress/components';
33
+ *
34
+ * const Example = () => {
35
+ * return (
36
+ * <Theme accent="red">
37
+ * <Button variant="primary">I'm red</Button>
38
+ * <Theme accent="blue">
39
+ * <Button variant="primary">I'm blue</Button>
40
+ * </Theme>
41
+ * </Theme>
42
+ * );
43
+ * };
44
+ * ```
45
+ */
46
+
47
+ function Theme(props) {
48
+ const {
49
+ accent
50
+ } = props;
51
+
52
+ if (accent && !(0, _colord.colord)(accent).isValid()) {
53
+ // eslint-disable-next-line no-console
54
+ console.warn(`wp.components.Theme: "${accent}" is not a valid color value for the 'accent' prop.`);
55
+ }
56
+
57
+ return (0, _element.createElement)(_styles.Wrapper, props);
58
+ }
59
+
60
+ var _default = Theme;
61
+ exports.default = _default;
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/components/src/theme/index.tsx"],"names":["namesPlugin","a11yPlugin","Theme","props","accent","isValid","console","warn"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAOA;;AAZA;AACA;AACA;AAYA,oBAAQ,CAAEA,cAAF,EAAeC,aAAf,CAAR;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,KAAT,CAAgBC,KAAhB,EAA4E;AAC3E,QAAM;AAAEC,IAAAA;AAAF,MAAaD,KAAnB;;AACA,MAAKC,MAAM,IAAI,CAAE,oBAAQA,MAAR,EAAiBC,OAAjB,EAAjB,EAA8C;AAC7C;AACAC,IAAAA,OAAO,CAACC,IAAR,CACE,yBAAyBH,MAAQ,qDADnC;AAGA;;AAED,SAAO,4BAAC,eAAD,EAAcD,KAAd,CAAP;AACA;;eAEcD,K","sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * Internal dependencies\n */\nimport type { ThemeProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport { Wrapper } from './styles';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * `Theme` allows defining theme variables for components in the `@wordpress/components` package.\n *\n * Multiple `Theme` components can be nested in order to override specific theme variables.\n *\n *\n * @example\n * ```jsx\n * import { __experimentalTheme as Theme } from '@wordpress/components';\n *\n * const Example = () => {\n * return (\n * <Theme accent=\"red\">\n * <Button variant=\"primary\">I'm red</Button>\n * <Theme accent=\"blue\">\n * <Button variant=\"primary\">I'm blue</Button>\n * </Theme>\n * </Theme>\n * );\n * };\n * ```\n */\nfunction Theme( props: WordPressComponentProps< ThemeProps, 'div', true > ) {\n\tconst { accent } = props;\n\tif ( accent && ! colord( accent ).isValid() ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t`wp.components.Theme: \"${ accent }\" is not a valid color value for the 'accent' prop.`\n\t\t);\n\t}\n\n\treturn <Wrapper { ...props } />;\n}\n\nexport default Theme;\n"]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.Wrapper = void 0;
9
+
10
+ var _base = _interopRequireDefault(require("@emotion/styled/base"));
11
+
12
+ var _colord = require("colord");
13
+
14
+ var _react = require("@emotion/react");
15
+
16
+ /**
17
+ * External dependencies
18
+ */
19
+ const accentColor = _ref => {
20
+ let {
21
+ accent
22
+ } = _ref;
23
+ return accent ? /*#__PURE__*/(0, _react.css)("--wp-components-color-accent:", accent, ";--wp-components-color-accent-darker-10:", (0, _colord.colord)(accent).darken(0.1).toHex(), ";--wp-components-color-accent-darker-20:", (0, _colord.colord)(accent).darken(0.2).toHex(), ";" + (process.env.NODE_ENV === "production" ? "" : ";label:accentColor;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdGhlbWUvc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNPIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdGhlbWUvc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgY29sb3JkIH0gZnJvbSAnY29sb3JkJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBJbnRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHR5cGUgeyBUaGVtZVByb3BzIH0gZnJvbSAnLi90eXBlcyc7XG5cbmNvbnN0IGFjY2VudENvbG9yID0gKCB7IGFjY2VudCB9OiBUaGVtZVByb3BzICkgPT5cblx0YWNjZW50XG5cdFx0PyBjc3NgXG5cdFx0XHRcdC0td3AtY29tcG9uZW50cy1jb2xvci1hY2NlbnQ6ICR7IGFjY2VudCB9O1xuXHRcdFx0XHQtLXdwLWNvbXBvbmVudHMtY29sb3ItYWNjZW50LWRhcmtlci0xMDogJHsgY29sb3JkKCBhY2NlbnQgKVxuXHRcdFx0XHRcdC5kYXJrZW4oIDAuMSApXG5cdFx0XHRcdFx0LnRvSGV4KCkgfTtcblx0XHRcdFx0LS13cC1jb21wb25lbnRzLWNvbG9yLWFjY2VudC1kYXJrZXItMjA6ICR7IGNvbG9yZCggYWNjZW50IClcblx0XHRcdFx0XHQuZGFya2VuKCAwLjIgKVxuXHRcdFx0XHRcdC50b0hleCgpIH07XG5cdFx0ICBgXG5cdFx0OiB1bmRlZmluZWQ7XG5cbmV4cG9ydCBjb25zdCBXcmFwcGVyID0gc3R5bGVkLmRpdjwgVGhlbWVQcm9wcyA+YFxuXHQkeyBhY2NlbnRDb2xvciB9XG5gO1xuIl19 */") : undefined;
24
+ };
25
+
26
+ const Wrapper = (0, _base.default)("div", process.env.NODE_ENV === "production" ? {
27
+ target: "e1krjpvb0"
28
+ } : {
29
+ target: "e1krjpvb0",
30
+ label: "Wrapper"
31
+ })(accentColor, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=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0IGNvbnN0IFdyYXBwZXIgPSBzdHlsZWQuZGl2PCBUaGVtZVByb3BzID5gXG5cdCR7IGFjY2VudENvbG9yIH1cbmA7XG4iXX0= */"));
32
+ exports.Wrapper = Wrapper;
33
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/components/src/theme/styles.ts"],"names":["accentColor","accent","css","darken","toHex","undefined","Wrapper"],"mappings":";;;;;;;;;;;AAGA;;AAEA;;AALA;AACA;AACA;AAUA,MAAMA,WAAW,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SACnBA,MAAM,oBACHC,UADG,mCAE8BD,MAF9B,8CAGwC,oBAAQA,MAAR,EACzCE,MADyC,CACjC,GADiC,EAEzCC,KAFyC,EAHxC,8CAMwC,oBAAQH,MAAR,EACzCE,MADyC,CACjC,GADiC,EAEzCC,KAFyC,EANxC,w0CAUHC,SAXgB;AAAA,CAApB;;AAaO,MAAMC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAChBN,WADgB,qwCAAb","sourcesContent":["/**\n * External dependencies\n */\nimport { colord } from 'colord';\nimport styled from '@emotion/styled';\nimport { css } from '@emotion/react';\n\n/**\n * Internal dependencies\n */\nimport type { ThemeProps } from './types';\n\nconst accentColor = ( { accent }: ThemeProps ) =>\n\taccent\n\t\t? css`\n\t\t\t\t--wp-components-color-accent: ${ accent };\n\t\t\t\t--wp-components-color-accent-darker-10: ${ colord( accent )\n\t\t\t\t\t.darken( 0.1 )\n\t\t\t\t\t.toHex() };\n\t\t\t\t--wp-components-color-accent-darker-20: ${ colord( accent )\n\t\t\t\t\t.darken( 0.2 )\n\t\t\t\t\t.toHex() };\n\t\t `\n\t\t: undefined;\n\nexport const Wrapper = styled.div< ThemeProps >`\n\t${ accentColor }\n`;\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":[]}
@@ -76,12 +76,24 @@ function ToggleControl(_ref) {
76
76
  const cx = (0, _utils.useCx)();
77
77
  const classes = cx('components-toggle-control', className, !__nextHasNoMarginBottom && /*#__PURE__*/(0, _react.css)({
78
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdG9nZ2xlLWNvbnRyb2wvaW5kZXgudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZEK0IiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy90b2dnbGUtY29udHJvbC9pbmRleC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgdHlwZSB7IENoYW5nZUV2ZW50IH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFdvcmRQcmVzcyBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgdXNlSW5zdGFuY2VJZCB9IGZyb20gJ0B3b3JkcHJlc3MvY29tcG9zZSc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBGb3JtVG9nZ2xlIGZyb20gJy4uL2Zvcm0tdG9nZ2xlJztcbmltcG9ydCBCYXNlQ29udHJvbCBmcm9tICcuLi9iYXNlLWNvbnRyb2wnO1xuaW1wb3J0IHR5cGUgeyBXb3JkUHJlc3NDb21wb25lbnRQcm9wcyB9IGZyb20gJy4uL3VpL2NvbnRleHQvd29y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cnRcIiBzcGFjaW5nPXsgMyB9PlxuXHRcdFx0XHQ8Rm9ybVRvZ2dsZVxuXHRcdFx0XHRcdGlkPXsgaWQgfVxuXHRcdFx0XHRcdGNoZWNrZWQ9eyBjaGVja2VkIH1cblx0XHRcdFx0XHRvbkNoYW5nZT17IG9uQ2hhbmdlVG9nZ2xlIH1cblx0XHRcdFx0XHRhcmlhLWRlc2NyaWJlZGJ5PXsgZGVzY3JpYmVkQnkgfVxuXHRcdFx0XHRcdGRpc2FibGVkPXsgZGlzYWJsZWQgfVxuXHRcdFx0XHQvPlxuXHRcdFx0XHQ8bGFiZWxcblx0XHRcdFx0XHRodG1sRm9yPXsgaWQgfVxuXHRcdFx0XHRcdGNsYXNzTmFtZT1cImNvbXBvbmVudHMtdG9nZ2xlLWNvbnRyb2xfX2xhYmVsXCJcblx0XHRcdFx0PlxuXHRcdFx0XHRcdHsgbGFiZWwgfVxuXHRcdFx0XHQ8L2xhYmVsPlxuXHRcdFx0PC9IU3RhY2s+XG5cdFx0PC9CYXNlQ29udHJvbD5cblx0KTtcbn1cblxuZXhwb3J0IGRlZmF1bHQgVG9nZ2xlQ29udHJvbDtcbiJdfQ== */"));
79
+ }, process.env.NODE_ENV === "production" ? "" : ";label:classes;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdG9nZ2xlLWNvbnRyb2wvaW5kZXgudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZEK0IiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy90b2dnbGUtY29udHJvbC9pbmRleC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgdHlwZSB7IENoYW5nZUV2ZW50IH0gZnJvbSAncmVhY3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UgfVxuXHRcdFx0XHRcdGFyaWEtZGVzY3JpYmVkYnk9eyBkZXNjcmliZWRCeSB9XG5cdFx0XHRcdFx0ZGlzYWJsZWQ9eyBkaXNhYmxlZCB9XG5cdFx0XHRcdC8+XG5cdFx0XHRcdDxsYWJlbFxuXHRcdFx0XHRcdGh0bWxGb3I9eyBpZCB9XG5cdFx0XHRcdFx0Y2xhc3NOYW1lPVwiY29tcG9uZW50cy10b2dnbGUtY29udHJvbF9fbGFiZWxcIlxuXHRcdFx0XHQ+XG5cdFx0XHRcdFx0eyBsYWJlbCB9XG5cdFx0XHRcdDwvbGFiZWw+XG5cdFx0XHQ8L0hTdGFjaz5cblx0XHQ8L0Jhc2VDb250cm9sPlxuXHQpO1xufVxuXG5leHBvcnQgZGVmYXVsdCBUb2dnbGVDb250cm9sO1xuIl19 */"));
80
80
  let describedBy, helpLabel;
81
81
 
82
82
  if (help) {
83
- describedBy = id + '__help';
84
- helpLabel = typeof help === 'function' ? help(checked) : help;
83
+ if (typeof help === 'function') {
84
+ // `help` as a function works only for controlled components where
85
+ // `checked` is passed down from parent component. Uncontrolled
86
+ // component can show only a static help label.
87
+ if (checked !== undefined) {
88
+ helpLabel = help(checked);
89
+ }
90
+ } else {
91
+ helpLabel = help;
92
+ }
93
+
94
+ if (helpLabel) {
95
+ describedBy = id + '__help';
96
+ }
85
97
  }
86
98
 
87
99
  return (0, _element.createElement)(_baseControl.default, {
@@ -1 +1 @@
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","describedBy","helpLabel"],"mappings":";;;;;;;;;;;;AAIA;;AAKA;;AAKA;;AACA;;AAGA;;AACA;;AACA;;AApBA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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A,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"]}
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","describedBy","helpLabel","undefined"],"mappings":";;;;;;;;;;;;AAIA;;AAKA;;AAKA;;AACA;;AAGA;;AACA;;AACA;;AApBA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,OAQ4D;AAAA,MARpC;AAC9BC,IAAAA,uBAD8B;AAE9BC,IAAAA,KAF8B;AAG9BC,IAAAA,OAH8B;AAI9BC,IAAAA,IAJ8B;AAK9BC,IAAAA,SAL8B;AAM9BC,IAAAA,QAN8B;AAO9BC,IAAAA;AAP8B,GAQoC;;AAClE,WAASC,cAAT,CAAyBC,KAAzB,EAAkE;AACjEH,IAAAA,QAAQ,CAAEG,KAAK,CAACC,MAAN,CAAaP,OAAf,CAAR;AACA;;AACD,QAAMQ,UAAU,GAAG,4BAAeX,aAAf,CAAnB;AACA,QAAMY,EAAE,GAAI,4BAA4BD,UAAY,EAApD;AAEA,QAAME,EAAE,GAAG,mBAAX;AACA,QAAMC,OAAO,GAAGD,EAAE,CACjB,2BADiB,EAEjBR,SAFiB,EAGjB,CAAEJ,uBAAF,iBAA6B,gBAAK;AAAEc,IAAAA,YAAY,EAAE,kBAAO,CAAP;AAAhB,GAAL,ilIAHZ,CAAlB;AAMA,MAAIC,WAAJ,EAAiBC,SAAjB;;AACA,MAAKb,IAAL,EAAY;AACX,QAAK,OAAOA,IAAP,KAAgB,UAArB,EAAkC;AACjC;AACA;AACA;AACA,UAAKD,OAAO,KAAKe,SAAjB,EAA6B;AAC5BD,QAAAA,SAAS,GAAGb,IAAI,CAAED,OAAF,CAAhB;AACA;AACD,KAPD,MAOO;AACNc,MAAAA,SAAS,GAAGb,IAAZ;AACA;;AACD,QAAKa,SAAL,EAAiB;AAChBD,MAAAA,WAAW,GAAGJ,EAAE,GAAG,QAAnB;AACA;AACD;;AAED,SACC,4BAAC,oBAAD;AACC,IAAA,EAAE,EAAGA,EADN;AAEC,IAAA,IAAI,EAAGK,SAFR;AAGC,IAAA,SAAS,EAAGH,OAHb;AAIC,IAAA,uBAAuB;AAJxB,KAMC,4BAAC,cAAD;AAAQ,IAAA,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\tif ( typeof help === 'function' ) {\n\t\t\t// `help` as a function works only for controlled components where\n\t\t\t// `checked` is passed down from parent component. Uncontrolled\n\t\t\t// component can show only a static help label.\n\t\t\tif ( checked !== undefined ) {\n\t\t\t\thelpLabel = help( checked );\n\t\t\t}\n\t\t} else {\n\t\t\thelpLabel = help;\n\t\t}\n\t\tif ( helpLabel ) {\n\t\t\tdescribedBy = id + '__help';\n\t\t}\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"]}