@wordpress/components 19.2.3 → 19.4.1-next.f435e9e01b.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 (1000) hide show
  1. package/CHANGELOG.md +74 -5
  2. package/CONTRIBUTING.md +1 -1
  3. package/LICENSE.md +1 -1
  4. package/README.md +8 -4
  5. package/build/angle-picker-control/index.js +2 -0
  6. package/build/angle-picker-control/index.js.map +1 -1
  7. package/build/base-control/index.js +2 -3
  8. package/build/base-control/index.js.map +1 -1
  9. package/build/base-control/styles/base-control-styles.js +23 -13
  10. package/build/base-control/styles/base-control-styles.js.map +1 -1
  11. package/build/base-field/hook.js +1 -1
  12. package/build/base-field/hook.js.map +1 -1
  13. package/build/box-control/styles/box-control-styles.js +9 -9
  14. package/build/box-control/styles/box-control-styles.js.map +1 -1
  15. package/build/button/deprecated.js +2 -1
  16. package/build/button/deprecated.js.map +1 -1
  17. package/build/button/index.js +2 -1
  18. package/build/button/index.js.map +1 -1
  19. package/build/button/index.native.js +13 -3
  20. package/build/button/index.native.js.map +1 -1
  21. package/build/card/card/component.js +1 -1
  22. package/build/card/card/component.js.map +1 -1
  23. package/build/card/card/hook.js +1 -1
  24. package/build/card/card/hook.js.map +1 -1
  25. package/build/card/card-body/hook.js +1 -1
  26. package/build/card/card-body/hook.js.map +1 -1
  27. package/build/card/card-divider/hook.js +1 -1
  28. package/build/card/card-divider/hook.js.map +1 -1
  29. package/build/card/card-footer/hook.js +1 -1
  30. package/build/card/card-footer/hook.js.map +1 -1
  31. package/build/card/card-header/hook.js +1 -1
  32. package/build/card/card-header/hook.js.map +1 -1
  33. package/build/card/card-media/hook.js +1 -1
  34. package/build/card/card-media/hook.js.map +1 -1
  35. package/build/checkbox-control/index.js +1 -1
  36. package/build/checkbox-control/index.js.map +1 -1
  37. package/build/circular-option-picker/index.js +2 -0
  38. package/build/circular-option-picker/index.js.map +1 -1
  39. package/build/clipboard-button/index.js +1 -2
  40. package/build/clipboard-button/index.js.map +1 -1
  41. package/build/color-indicator/index.js +2 -0
  42. package/build/color-indicator/index.js.map +1 -1
  43. package/build/color-palette/index.js +2 -0
  44. package/build/color-palette/index.js.map +1 -1
  45. package/build/color-palette/index.native.js +4 -2
  46. package/build/color-palette/index.native.js.map +1 -1
  47. package/build/color-picker/color-display.js +4 -2
  48. package/build/color-picker/color-display.js.map +1 -1
  49. package/build/color-picker/color-input.js.map +1 -1
  50. package/build/color-picker/component.js +2 -5
  51. package/build/color-picker/component.js.map +1 -1
  52. package/build/color-picker/hex-input.js +3 -1
  53. package/build/color-picker/hex-input.js.map +1 -1
  54. package/build/color-picker/input-with-slider.js +3 -1
  55. package/build/color-picker/input-with-slider.js.map +1 -1
  56. package/build/color-picker/use-deprecated-props.js +2 -0
  57. package/build/color-picker/use-deprecated-props.js.map +1 -1
  58. package/build/confirm-dialog/component.js +107 -0
  59. package/build/confirm-dialog/component.js.map +1 -0
  60. package/build/confirm-dialog/index.js +16 -0
  61. package/build/confirm-dialog/index.js.map +1 -0
  62. package/build/confirm-dialog/styles.js +30 -0
  63. package/build/confirm-dialog/styles.js.map +1 -0
  64. package/build/confirm-dialog/types.js +6 -0
  65. package/build/confirm-dialog/types.js.map +1 -0
  66. package/build/custom-gradient-picker/index.js +1 -0
  67. package/build/custom-gradient-picker/index.js.map +1 -1
  68. package/build/date-time/date.js +63 -86
  69. package/build/date-time/date.js.map +1 -1
  70. package/build/date-time/time.js +1 -1
  71. package/build/date-time/time.js.map +1 -1
  72. package/build/date-time/utils.js +32 -0
  73. package/build/date-time/utils.js.map +1 -0
  74. package/build/divider/component.js +8 -7
  75. package/build/divider/component.js.map +1 -1
  76. package/build/divider/styles.js +38 -13
  77. package/build/divider/styles.js.map +1 -1
  78. package/build/drop-zone/index.js +14 -6
  79. package/build/drop-zone/index.js.map +1 -1
  80. package/build/drop-zone/provider.js +1 -0
  81. package/build/drop-zone/provider.js.map +1 -1
  82. package/build/dropdown/index.js +3 -3
  83. package/build/dropdown/index.js.map +1 -1
  84. package/build/elevation/hook.js +5 -5
  85. package/build/elevation/hook.js.map +1 -1
  86. package/build/external-link/styles/external-link-styles.js +5 -5
  87. package/build/external-link/styles/external-link-styles.js.map +1 -1
  88. package/build/flex/flex/hook.js +4 -4
  89. package/build/flex/flex/hook.js.map +1 -1
  90. package/build/flyout/styles.js +2 -2
  91. package/build/flyout/styles.js.map +1 -1
  92. package/build/focusable-iframe/index.js +1 -0
  93. package/build/focusable-iframe/index.js.map +1 -1
  94. package/build/form-token-field/suggestions-list.js +75 -81
  95. package/build/form-token-field/suggestions-list.js.map +1 -1
  96. package/build/grid/hook.js +2 -2
  97. package/build/grid/hook.js.map +1 -1
  98. package/build/heading/component.js +0 -1
  99. package/build/heading/component.js.map +1 -1
  100. package/build/higher-order/with-focus-outside/index.js +2 -0
  101. package/build/higher-order/with-focus-outside/index.js.map +1 -1
  102. package/build/icon/index.js +0 -1
  103. package/build/icon/index.js.map +1 -1
  104. package/build/index.js +8 -0
  105. package/build/index.js.map +1 -1
  106. package/build/input-control/index.js.map +1 -1
  107. package/build/input-control/input-base.js +0 -1
  108. package/build/input-control/input-base.js.map +1 -1
  109. package/build/input-control/input-field.js.map +1 -1
  110. package/build/input-control/reducer/actions.js +0 -1
  111. package/build/input-control/reducer/actions.js.map +1 -1
  112. package/build/input-control/reducer/reducer.js.map +1 -1
  113. package/build/input-control/reducer/state.js +0 -1
  114. package/build/input-control/reducer/state.js.map +1 -1
  115. package/build/input-control/styles/input-control-styles.js +51 -37
  116. package/build/input-control/styles/input-control-styles.js.map +1 -1
  117. package/build/item-group/item/component.js +0 -1
  118. package/build/item-group/item/component.js.map +1 -1
  119. package/build/item-group/item/hook.js +1 -2
  120. package/build/item-group/item/hook.js.map +1 -1
  121. package/build/item-group/item-group/component.js +0 -1
  122. package/build/item-group/item-group/component.js.map +1 -1
  123. package/build/mobile/bottom-sheet/bottom-sheet-context.native.js +3 -1
  124. package/build/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  125. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +4 -12
  126. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  127. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +23 -5
  128. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  129. package/build/mobile/bottom-sheet/cell.native.js +3 -5
  130. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  131. package/build/mobile/bottom-sheet/index.native.js +16 -16
  132. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  133. package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +10 -3
  134. package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  135. package/build/mobile/bottom-sheet/range-text-input.native.js +2 -3
  136. package/build/mobile/bottom-sheet/range-text-input.native.js.map +1 -1
  137. package/build/mobile/color-settings/index.native.js +6 -2
  138. package/build/mobile/color-settings/index.native.js.map +1 -1
  139. package/build/mobile/color-settings/palette.screen.native.js +12 -6
  140. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  141. package/build/mobile/color-settings/utils.native.js +9 -3
  142. package/build/mobile/color-settings/utils.native.js.map +1 -1
  143. package/build/mobile/global-styles-context/utils.native.js +1 -1
  144. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  145. package/build/mobile/gridicons/index.native.js +3 -1
  146. package/build/mobile/gridicons/index.native.js.map +1 -1
  147. package/build/mobile/keyboard-avoiding-view/index.ios.js +6 -8
  148. package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  149. package/build/mobile/link-picker/index.native.js +47 -4
  150. package/build/mobile/link-picker/index.native.js.map +1 -1
  151. package/build/mobile/link-picker/link-picker-screen.native.js +18 -5
  152. package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  153. package/build/mobile/link-settings/index.native.js +13 -1
  154. package/build/mobile/link-settings/index.native.js.map +1 -1
  155. package/build/mobile/readable-content-view/index.native.js +2 -2
  156. package/build/mobile/readable-content-view/index.native.js.map +1 -1
  157. package/build/mobile/utils/use-is-floating-keyboard.native.js +2 -2
  158. package/build/mobile/utils/use-is-floating-keyboard.native.js.map +1 -1
  159. package/build/mobile/utils/use-unit-converter-to-mobile.native.js +2 -2
  160. package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  161. package/build/modal/aria-helper.js +2 -0
  162. package/build/modal/aria-helper.js.map +1 -1
  163. package/build/modal/index.js +18 -20
  164. package/build/modal/index.js.map +1 -1
  165. package/build/navigator/context.js +5 -1
  166. package/build/navigator/context.js.map +1 -1
  167. package/build/navigator/navigator-provider/component.js +42 -22
  168. package/build/navigator/navigator-provider/component.js.map +1 -1
  169. package/build/navigator/navigator-screen/component.js +57 -29
  170. package/build/navigator/navigator-screen/component.js.map +1 -1
  171. package/build/navigator/use-navigator.js +8 -8
  172. package/build/navigator/use-navigator.js.map +1 -1
  173. package/build/notice/index.native.js +2 -2
  174. package/build/notice/index.native.js.map +1 -1
  175. package/build/palette-edit/index.js +8 -3
  176. package/build/palette-edit/index.js.map +1 -1
  177. package/build/palette-edit/styles.js +11 -13
  178. package/build/palette-edit/styles.js.map +1 -1
  179. package/build/placeholder/index.js +4 -4
  180. package/build/placeholder/index.js.map +1 -1
  181. package/build/range-control/styles/range-control-styles.js +29 -29
  182. package/build/range-control/styles/range-control-styles.js.map +1 -1
  183. package/build/resizable-box/index.js.map +1 -1
  184. package/build/resizable-box/resize-tooltip/index.js.map +1 -1
  185. package/build/resizable-box/resize-tooltip/label.js +0 -1
  186. package/build/resizable-box/resize-tooltip/label.js.map +1 -1
  187. package/build/sandbox/index.native.js +5 -5
  188. package/build/sandbox/index.native.js.map +1 -1
  189. package/build/scrollable/hook.js +1 -1
  190. package/build/scrollable/hook.js.map +1 -1
  191. package/build/select-control/styles/select-control-styles.js +33 -9
  192. package/build/select-control/styles/select-control-styles.js.map +1 -1
  193. package/build/slot-fill/bubbles-virtually/fill.js +11 -2
  194. package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
  195. package/build/spacer/component.js +0 -1
  196. package/build/spacer/component.js.map +1 -1
  197. package/build/spinner/index.js +44 -5
  198. package/build/spinner/index.js.map +1 -1
  199. package/build/spinner/index.native.js +4 -2
  200. package/build/spinner/index.native.js.map +1 -1
  201. package/build/spinner/styles.js +56 -0
  202. package/build/spinner/styles.js.map +1 -0
  203. package/build/style-provider/index.js +2 -0
  204. package/build/style-provider/index.js.map +1 -1
  205. package/build/surface/hook.js +1 -1
  206. package/build/surface/hook.js.map +1 -1
  207. package/build/text/get-line-height.js +0 -1
  208. package/build/text/get-line-height.js.map +1 -1
  209. package/build/text/hook.js +5 -5
  210. package/build/text/hook.js.map +1 -1
  211. package/build/tip/index.js +4 -8
  212. package/build/tip/index.js.map +1 -1
  213. package/build/toggle-group-control/toggle-group-control/component.js +9 -14
  214. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  215. package/build/toggle-group-control/toggle-group-control/styles.js +3 -14
  216. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  217. package/build/toggle-group-control/toggle-group-control-option/component.js +0 -1
  218. package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  219. package/build/toggle-group-control/toggle-group-control-option/styles.js +8 -8
  220. package/build/toggle-group-control/toggle-group-control-option/styles.js.map +1 -1
  221. package/build/tools-panel/styles.js +12 -10
  222. package/build/tools-panel/styles.js.map +1 -1
  223. package/build/tools-panel/tools-panel/component.js +6 -9
  224. package/build/tools-panel/tools-panel/component.js.map +1 -1
  225. package/build/tools-panel/tools-panel/hook.js +51 -44
  226. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  227. package/build/tools-panel/tools-panel-header/component.js +0 -1
  228. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  229. package/build/tools-panel/tools-panel-header/hook.js +3 -3
  230. package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
  231. package/build/tools-panel/tools-panel-item/component.js +0 -1
  232. package/build/tools-panel/tools-panel-item/component.js.map +1 -1
  233. package/build/tools-panel/tools-panel-item/hook.js +9 -3
  234. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  235. package/build/tree-grid/index.js +13 -6
  236. package/build/tree-grid/index.js.map +1 -1
  237. package/build/truncate/hook.js +2 -2
  238. package/build/truncate/hook.js.map +1 -1
  239. package/build/ui/shortcut/component.js +0 -1
  240. package/build/ui/shortcut/component.js.map +1 -1
  241. package/build/ui/utils/font-size.js +0 -1
  242. package/build/ui/utils/font-size.js.map +1 -1
  243. package/build/ui/utils/get-valid-children.js +0 -1
  244. package/build/ui/utils/get-valid-children.js.map +1 -1
  245. package/build/unit-control/index.js +0 -1
  246. package/build/unit-control/index.js.map +1 -1
  247. package/build/unit-control/styles/unit-control-styles.js +23 -41
  248. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  249. package/build/unit-control/unit-select-control.js.map +1 -1
  250. package/build/utils/colors-values.js +6 -3
  251. package/build/utils/colors-values.js.map +1 -1
  252. package/build/utils/config-values.js +1 -4
  253. package/build/utils/config-values.js.map +1 -1
  254. package/build/utils/hooks/use-combined-ref.js.map +1 -1
  255. package/build/utils/hooks/use-latest-ref.js +0 -1
  256. package/build/utils/hooks/use-latest-ref.js.map +1 -1
  257. package/build/z-stack/component.js +0 -1
  258. package/build/z-stack/component.js.map +1 -1
  259. package/build/z-stack/styles.js +10 -8
  260. package/build/z-stack/styles.js.map +1 -1
  261. package/build-module/angle-picker-control/index.js +2 -0
  262. package/build-module/angle-picker-control/index.js.map +1 -1
  263. package/build-module/base-control/index.js +3 -4
  264. package/build-module/base-control/index.js.map +1 -1
  265. package/build-module/base-control/styles/base-control-styles.js +20 -12
  266. package/build-module/base-control/styles/base-control-styles.js.map +1 -1
  267. package/build-module/base-field/hook.js +1 -1
  268. package/build-module/base-field/hook.js.map +1 -1
  269. package/build-module/box-control/styles/box-control-styles.js +9 -9
  270. package/build-module/box-control/styles/box-control-styles.js.map +1 -1
  271. package/build-module/button/deprecated.js +2 -1
  272. package/build-module/button/deprecated.js.map +1 -1
  273. package/build-module/button/index.js +2 -1
  274. package/build-module/button/index.js.map +1 -1
  275. package/build-module/button/index.native.js +13 -3
  276. package/build-module/button/index.native.js.map +1 -1
  277. package/build-module/card/card/component.js +1 -1
  278. package/build-module/card/card/component.js.map +1 -1
  279. package/build-module/card/card/hook.js +1 -1
  280. package/build-module/card/card/hook.js.map +1 -1
  281. package/build-module/card/card-body/hook.js +1 -1
  282. package/build-module/card/card-body/hook.js.map +1 -1
  283. package/build-module/card/card-divider/hook.js +1 -1
  284. package/build-module/card/card-divider/hook.js.map +1 -1
  285. package/build-module/card/card-footer/hook.js +1 -1
  286. package/build-module/card/card-footer/hook.js.map +1 -1
  287. package/build-module/card/card-header/hook.js +1 -1
  288. package/build-module/card/card-header/hook.js.map +1 -1
  289. package/build-module/card/card-media/hook.js +1 -1
  290. package/build-module/card/card-media/hook.js.map +1 -1
  291. package/build-module/checkbox-control/index.js +1 -1
  292. package/build-module/checkbox-control/index.js.map +1 -1
  293. package/build-module/circular-option-picker/index.js +1 -0
  294. package/build-module/circular-option-picker/index.js.map +1 -1
  295. package/build-module/clipboard-button/index.js +1 -2
  296. package/build-module/clipboard-button/index.js.map +1 -1
  297. package/build-module/color-indicator/index.js +1 -0
  298. package/build-module/color-indicator/index.js.map +1 -1
  299. package/build-module/color-palette/index.js +1 -0
  300. package/build-module/color-palette/index.js.map +1 -1
  301. package/build-module/color-palette/index.native.js +4 -2
  302. package/build-module/color-palette/index.native.js.map +1 -1
  303. package/build-module/color-picker/color-display.js +3 -2
  304. package/build-module/color-picker/color-display.js.map +1 -1
  305. package/build-module/color-picker/color-input.js.map +1 -1
  306. package/build-module/color-picker/component.js +2 -4
  307. package/build-module/color-picker/component.js.map +1 -1
  308. package/build-module/color-picker/hex-input.js +2 -1
  309. package/build-module/color-picker/hex-input.js.map +1 -1
  310. package/build-module/color-picker/input-with-slider.js +2 -1
  311. package/build-module/color-picker/input-with-slider.js.map +1 -1
  312. package/build-module/color-picker/use-deprecated-props.js +3 -2
  313. package/build-module/color-picker/use-deprecated-props.js.map +1 -1
  314. package/build-module/confirm-dialog/component.js +87 -0
  315. package/build-module/confirm-dialog/component.js.map +1 -0
  316. package/build-module/confirm-dialog/index.js +6 -0
  317. package/build-module/confirm-dialog/index.js.map +1 -0
  318. package/build-module/confirm-dialog/styles.js +25 -0
  319. package/build-module/confirm-dialog/styles.js.map +1 -0
  320. package/build-module/confirm-dialog/types.js +2 -0
  321. package/build-module/confirm-dialog/types.js.map +1 -0
  322. package/build-module/custom-gradient-picker/index.js +1 -0
  323. package/build-module/custom-gradient-picker/index.js.map +1 -1
  324. package/build-module/date-time/date.js +63 -87
  325. package/build-module/date-time/date.js.map +1 -1
  326. package/build-module/date-time/time.js +1 -1
  327. package/build-module/date-time/time.js.map +1 -1
  328. package/build-module/date-time/utils.js +20 -0
  329. package/build-module/date-time/utils.js.map +1 -0
  330. package/build-module/divider/component.js +9 -8
  331. package/build-module/divider/component.js.map +1 -1
  332. package/build-module/divider/styles.js +37 -13
  333. package/build-module/divider/styles.js.map +1 -1
  334. package/build-module/drop-zone/index.js +14 -6
  335. package/build-module/drop-zone/index.js.map +1 -1
  336. package/build-module/drop-zone/provider.js +1 -0
  337. package/build-module/drop-zone/provider.js.map +1 -1
  338. package/build-module/dropdown/index.js +3 -3
  339. package/build-module/dropdown/index.js.map +1 -1
  340. package/build-module/elevation/hook.js +5 -5
  341. package/build-module/elevation/hook.js.map +1 -1
  342. package/build-module/external-link/styles/external-link-styles.js +5 -5
  343. package/build-module/external-link/styles/external-link-styles.js.map +1 -1
  344. package/build-module/flex/flex/hook.js +4 -4
  345. package/build-module/flex/flex/hook.js.map +1 -1
  346. package/build-module/flyout/styles.js +2 -2
  347. package/build-module/flyout/styles.js.map +1 -1
  348. package/build-module/focusable-iframe/index.js +1 -0
  349. package/build-module/focusable-iframe/index.js.map +1 -1
  350. package/build-module/form-token-field/suggestions-list.js +73 -79
  351. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  352. package/build-module/grid/hook.js +2 -2
  353. package/build-module/grid/hook.js.map +1 -1
  354. package/build-module/heading/component.js +0 -1
  355. package/build-module/heading/component.js.map +1 -1
  356. package/build-module/higher-order/with-focus-outside/index.js +1 -0
  357. package/build-module/higher-order/with-focus-outside/index.js.map +1 -1
  358. package/build-module/icon/index.js +0 -1
  359. package/build-module/icon/index.js.map +1 -1
  360. package/build-module/index.js +1 -0
  361. package/build-module/index.js.map +1 -1
  362. package/build-module/input-control/index.js +1 -1
  363. package/build-module/input-control/index.js.map +1 -1
  364. package/build-module/input-control/input-base.js +0 -1
  365. package/build-module/input-control/input-base.js.map +1 -1
  366. package/build-module/input-control/input-field.js +1 -1
  367. package/build-module/input-control/input-field.js.map +1 -1
  368. package/build-module/input-control/reducer/actions.js +0 -1
  369. package/build-module/input-control/reducer/actions.js.map +1 -1
  370. package/build-module/input-control/reducer/reducer.js +1 -1
  371. package/build-module/input-control/reducer/reducer.js.map +1 -1
  372. package/build-module/input-control/reducer/state.js +0 -1
  373. package/build-module/input-control/reducer/state.js.map +1 -1
  374. package/build-module/input-control/styles/input-control-styles.js +51 -37
  375. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  376. package/build-module/item-group/item/component.js +0 -1
  377. package/build-module/item-group/item/component.js.map +1 -1
  378. package/build-module/item-group/item/hook.js +1 -2
  379. package/build-module/item-group/item/hook.js.map +1 -1
  380. package/build-module/item-group/item-group/component.js +0 -1
  381. package/build-module/item-group/item-group/component.js.map +1 -1
  382. package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js +3 -1
  383. package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  384. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +5 -13
  385. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  386. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +23 -5
  387. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  388. package/build-module/mobile/bottom-sheet/cell.native.js +3 -3
  389. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  390. package/build-module/mobile/bottom-sheet/index.native.js +16 -13
  391. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  392. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +10 -4
  393. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  394. package/build-module/mobile/bottom-sheet/range-text-input.native.js +2 -2
  395. package/build-module/mobile/bottom-sheet/range-text-input.native.js.map +1 -1
  396. package/build-module/mobile/color-settings/index.native.js +6 -2
  397. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  398. package/build-module/mobile/color-settings/palette.screen.native.js +12 -6
  399. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  400. package/build-module/mobile/color-settings/utils.native.js +7 -3
  401. package/build-module/mobile/color-settings/utils.native.js.map +1 -1
  402. package/build-module/mobile/global-styles-context/utils.native.js +1 -1
  403. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  404. package/build-module/mobile/gridicons/index.native.js +1 -0
  405. package/build-module/mobile/gridicons/index.native.js.map +1 -1
  406. package/build-module/mobile/keyboard-avoiding-view/index.ios.js +6 -6
  407. package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  408. package/build-module/mobile/link-picker/index.native.js +50 -7
  409. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  410. package/build-module/mobile/link-picker/link-picker-screen.native.js +13 -5
  411. package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  412. package/build-module/mobile/link-settings/index.native.js +12 -1
  413. package/build-module/mobile/link-settings/index.native.js.map +1 -1
  414. package/build-module/mobile/readable-content-view/index.native.js +2 -2
  415. package/build-module/mobile/readable-content-view/index.native.js.map +1 -1
  416. package/build-module/mobile/utils/use-is-floating-keyboard.native.js +2 -2
  417. package/build-module/mobile/utils/use-is-floating-keyboard.native.js.map +1 -1
  418. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js +2 -2
  419. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  420. package/build-module/modal/aria-helper.js +2 -0
  421. package/build-module/modal/aria-helper.js.map +1 -1
  422. package/build-module/modal/index.js +16 -19
  423. package/build-module/modal/index.js.map +1 -1
  424. package/build-module/navigator/context.js +5 -1
  425. package/build-module/navigator/context.js.map +1 -1
  426. package/build-module/navigator/navigator-provider/component.js +43 -24
  427. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  428. package/build-module/navigator/navigator-screen/component.js +57 -32
  429. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  430. package/build-module/navigator/use-navigator.js +8 -8
  431. package/build-module/navigator/use-navigator.js.map +1 -1
  432. package/build-module/notice/index.native.js +2 -2
  433. package/build-module/notice/index.native.js.map +1 -1
  434. package/build-module/palette-edit/index.js +8 -3
  435. package/build-module/palette-edit/index.js.map +1 -1
  436. package/build-module/palette-edit/styles.js +11 -12
  437. package/build-module/palette-edit/styles.js.map +1 -1
  438. package/build-module/placeholder/index.js +4 -4
  439. package/build-module/placeholder/index.js.map +1 -1
  440. package/build-module/range-control/styles/range-control-styles.js +29 -29
  441. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  442. package/build-module/resizable-box/index.js.map +1 -1
  443. package/build-module/resizable-box/resize-tooltip/index.js +3 -3
  444. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  445. package/build-module/resizable-box/resize-tooltip/label.js +0 -1
  446. package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
  447. package/build-module/sandbox/index.native.js +5 -5
  448. package/build-module/sandbox/index.native.js.map +1 -1
  449. package/build-module/scrollable/hook.js +1 -1
  450. package/build-module/scrollable/hook.js.map +1 -1
  451. package/build-module/select-control/styles/select-control-styles.js +33 -9
  452. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  453. package/build-module/slot-fill/bubbles-virtually/fill.js +11 -2
  454. package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
  455. package/build-module/spacer/component.js +0 -1
  456. package/build-module/spacer/component.js.map +1 -1
  457. package/build-module/spinner/index.js +40 -5
  458. package/build-module/spinner/index.js.map +1 -1
  459. package/build-module/spinner/index.native.js +4 -2
  460. package/build-module/spinner/index.native.js.map +1 -1
  461. package/build-module/spinner/styles.js +49 -0
  462. package/build-module/spinner/styles.js.map +1 -0
  463. package/build-module/style-provider/index.js +1 -0
  464. package/build-module/style-provider/index.js.map +1 -1
  465. package/build-module/surface/hook.js +1 -1
  466. package/build-module/surface/hook.js.map +1 -1
  467. package/build-module/text/get-line-height.js +0 -1
  468. package/build-module/text/get-line-height.js.map +1 -1
  469. package/build-module/text/hook.js +5 -5
  470. package/build-module/text/hook.js.map +1 -1
  471. package/build-module/tip/index.js +4 -8
  472. package/build-module/tip/index.js.map +1 -1
  473. package/build-module/toggle-group-control/toggle-group-control/component.js +10 -13
  474. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  475. package/build-module/toggle-group-control/toggle-group-control/styles.js +3 -11
  476. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  477. package/build-module/toggle-group-control/toggle-group-control-option/component.js +0 -1
  478. package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  479. package/build-module/toggle-group-control/toggle-group-control-option/styles.js +8 -8
  480. package/build-module/toggle-group-control/toggle-group-control-option/styles.js.map +1 -1
  481. package/build-module/tools-panel/styles.js +12 -11
  482. package/build-module/tools-panel/styles.js.map +1 -1
  483. package/build-module/tools-panel/tools-panel/component.js +5 -9
  484. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  485. package/build-module/tools-panel/tools-panel/hook.js +52 -45
  486. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  487. package/build-module/tools-panel/tools-panel-header/component.js +0 -1
  488. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  489. package/build-module/tools-panel/tools-panel-header/hook.js +3 -3
  490. package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
  491. package/build-module/tools-panel/tools-panel-item/component.js +0 -1
  492. package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
  493. package/build-module/tools-panel/tools-panel-item/hook.js +9 -3
  494. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  495. package/build-module/tree-grid/index.js +12 -6
  496. package/build-module/tree-grid/index.js.map +1 -1
  497. package/build-module/truncate/hook.js +2 -2
  498. package/build-module/truncate/hook.js.map +1 -1
  499. package/build-module/ui/shortcut/component.js +0 -1
  500. package/build-module/ui/shortcut/component.js.map +1 -1
  501. package/build-module/ui/utils/font-size.js +0 -1
  502. package/build-module/ui/utils/font-size.js.map +1 -1
  503. package/build-module/ui/utils/get-valid-children.js +0 -1
  504. package/build-module/ui/utils/get-valid-children.js.map +1 -1
  505. package/build-module/unit-control/index.js +0 -1
  506. package/build-module/unit-control/index.js.map +1 -1
  507. package/build-module/unit-control/styles/unit-control-styles.js +23 -41
  508. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  509. package/build-module/unit-control/unit-select-control.js +1 -2
  510. package/build-module/unit-control/unit-select-control.js.map +1 -1
  511. package/build-module/utils/colors-values.js +6 -3
  512. package/build-module/utils/colors-values.js.map +1 -1
  513. package/build-module/utils/config-values.js +1 -4
  514. package/build-module/utils/config-values.js.map +1 -1
  515. package/build-module/utils/hooks/use-combined-ref.js +0 -1
  516. package/build-module/utils/hooks/use-combined-ref.js.map +1 -1
  517. package/build-module/utils/hooks/use-latest-ref.js +0 -1
  518. package/build-module/utils/hooks/use-latest-ref.js.map +1 -1
  519. package/build-module/z-stack/component.js +0 -1
  520. package/build-module/z-stack/component.js.map +1 -1
  521. package/build-module/z-stack/styles.js +13 -8
  522. package/build-module/z-stack/styles.js.map +1 -1
  523. package/build-style/style-rtl.css +36 -15
  524. package/build-style/style.css +36 -15
  525. package/build-types/base-control/index.d.ts.map +1 -1
  526. package/build-types/base-control/styles/base-control-styles.d.ts +4 -0
  527. package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
  528. package/build-types/base-field/hook.d.ts +16 -16
  529. package/build-types/button/index.d.ts.map +1 -1
  530. package/build-types/card/card/hook.d.ts +16 -16
  531. package/build-types/card/card-body/hook.d.ts +16 -16
  532. package/build-types/card/card-divider/hook.d.ts +18 -18
  533. package/build-types/card/card-footer/hook.d.ts +17 -17
  534. package/build-types/card/card-header/hook.d.ts +16 -16
  535. package/build-types/card/card-media/hook.d.ts +16 -16
  536. package/build-types/card/types.d.ts.map +1 -1
  537. package/build-types/color-picker/color-display.d.ts +1 -0
  538. package/build-types/color-picker/color-display.d.ts.map +1 -1
  539. package/build-types/color-picker/color-input.d.ts +1 -0
  540. package/build-types/color-picker/color-input.d.ts.map +1 -1
  541. package/build-types/color-picker/hex-input.d.ts +1 -0
  542. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  543. package/build-types/color-picker/hsl-input.d.ts +1 -0
  544. package/build-types/color-picker/hsl-input.d.ts.map +1 -1
  545. package/build-types/color-picker/input-with-slider.d.ts +1 -0
  546. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  547. package/build-types/color-picker/legacy-adapter.d.ts +1 -0
  548. package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
  549. package/build-types/color-picker/picker.d.ts +1 -0
  550. package/build-types/color-picker/picker.d.ts.map +1 -1
  551. package/build-types/color-picker/rgb-input.d.ts +1 -0
  552. package/build-types/color-picker/rgb-input.d.ts.map +1 -1
  553. package/build-types/color-picker/styles.d.ts +1 -1
  554. package/build-types/confirm-dialog/component.d.ts +4 -4
  555. package/build-types/divider/component.d.ts +8 -7
  556. package/build-types/divider/component.d.ts.map +1 -1
  557. package/build-types/divider/styles.d.ts +2 -2
  558. package/build-types/divider/styles.d.ts.map +1 -1
  559. package/build-types/divider/types.d.ts +5 -5
  560. package/build-types/divider/types.d.ts.map +1 -1
  561. package/build-types/dropdown/index.d.ts +1 -13
  562. package/build-types/dropdown/index.d.ts.map +1 -1
  563. package/build-types/elevation/hook.d.ts +15 -15
  564. package/build-types/elevation/hook.d.ts.map +1 -1
  565. package/build-types/elevation/types.d.ts.map +1 -1
  566. package/build-types/flex/flex/hook.d.ts +16 -16
  567. package/build-types/flex/flex/hook.d.ts.map +1 -1
  568. package/build-types/flex/flex-block/hook.d.ts +16 -16
  569. package/build-types/flex/flex-item/hook.d.ts +16 -16
  570. package/build-types/flex/types.d.ts.map +1 -1
  571. package/build-types/flyout/flyout/hook.d.ts +17 -17
  572. package/build-types/flyout/styles.d.ts +7 -9
  573. package/build-types/flyout/styles.d.ts.map +1 -1
  574. package/build-types/flyout/types.d.ts.map +1 -1
  575. package/build-types/grid/hook.d.ts +16 -16
  576. package/build-types/grid/hook.d.ts.map +1 -1
  577. package/build-types/grid/types.d.ts.map +1 -1
  578. package/build-types/h-stack/hook.d.ts +17 -17
  579. package/build-types/h-stack/hook.d.ts.map +1 -1
  580. package/build-types/h-stack/types.d.ts.map +1 -1
  581. package/build-types/heading/component.d.ts.map +1 -1
  582. package/build-types/heading/hook.d.ts +16 -16
  583. package/build-types/icon/index.d.ts.map +1 -1
  584. package/build-types/input-control/index.d.ts +1 -1
  585. package/build-types/input-control/index.d.ts.map +1 -1
  586. package/build-types/input-control/input-base.d.ts.map +1 -1
  587. package/build-types/input-control/input-field.d.ts +1 -1
  588. package/build-types/input-control/input-field.d.ts.map +1 -1
  589. package/build-types/input-control/reducer/actions.d.ts.map +1 -1
  590. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  591. package/build-types/input-control/reducer/state.d.ts.map +1 -1
  592. package/build-types/input-control/styles/input-control-styles.d.ts +1 -2
  593. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  594. package/build-types/input-control/types.d.ts +2 -1
  595. package/build-types/input-control/types.d.ts.map +1 -1
  596. package/build-types/item-group/item/component.d.ts.map +1 -1
  597. package/build-types/item-group/item/hook.d.ts +16 -16
  598. package/build-types/item-group/item/hook.d.ts.map +1 -1
  599. package/build-types/item-group/item-group/component.d.ts.map +1 -1
  600. package/build-types/item-group/item-group/hook.d.ts +16 -16
  601. package/build-types/navigator/context.d.ts.map +1 -1
  602. package/build-types/navigator/navigator-provider/component.d.ts +16 -17
  603. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  604. package/build-types/navigator/navigator-screen/component.d.ts +16 -16
  605. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  606. package/build-types/navigator/types.d.ts +10 -9
  607. package/build-types/navigator/types.d.ts.map +1 -1
  608. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  609. package/build-types/resizable-box/index.d.ts +1 -1
  610. package/build-types/resizable-box/index.d.ts.map +1 -1
  611. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  612. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  613. package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
  614. package/build-types/scrollable/hook.d.ts +16 -16
  615. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  616. package/build-types/select-control/types.d.ts +1 -1
  617. package/build-types/select-control/types.d.ts.map +1 -1
  618. package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
  619. package/build-types/spacer/component.d.ts.map +1 -1
  620. package/build-types/spacer/hook.d.ts +16 -16
  621. package/build-types/spacer/types.d.ts.map +1 -1
  622. package/build-types/spinner/index.d.ts +18 -1
  623. package/build-types/spinner/index.d.ts.map +1 -1
  624. package/build-types/surface/hook.d.ts +16 -16
  625. package/build-types/surface/hook.d.ts.map +1 -1
  626. package/build-types/text/get-line-height.d.ts.map +1 -1
  627. package/build-types/text/hook.d.ts +16 -16
  628. package/build-types/text/hook.d.ts.map +1 -1
  629. package/build-types/text/types.d.ts.map +1 -1
  630. package/build-types/tip/index.d.ts.map +1 -1
  631. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  632. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +0 -5
  633. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  634. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  635. package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts.map +1 -1
  636. package/build-types/toggle-group-control/types.d.ts +1 -7
  637. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  638. package/build-types/tools-panel/styles.d.ts.map +1 -1
  639. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  640. package/build-types/tools-panel/tools-panel/hook.d.ts +24 -20
  641. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  642. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  643. package/build-types/tools-panel/tools-panel-header/hook.d.ts +16 -16
  644. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  645. package/build-types/tools-panel/tools-panel-item/hook.d.ts +16 -16
  646. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  647. package/build-types/tools-panel/types.d.ts +14 -0
  648. package/build-types/tools-panel/types.d.ts.map +1 -1
  649. package/build-types/truncate/hook.d.ts +16 -16
  650. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  651. package/build-types/ui/control-group/hook.d.ts +18 -18
  652. package/build-types/ui/control-group/types.d.ts.map +1 -1
  653. package/build-types/ui/control-label/hook.d.ts +16 -16
  654. package/build-types/ui/form-group/form-group.d.ts +4 -4
  655. package/build-types/ui/form-group/types.d.ts.map +1 -1
  656. package/build-types/ui/form-group/use-form-group.d.ts +55 -55
  657. package/build-types/ui/shortcut/component.d.ts.map +1 -1
  658. package/build-types/ui/tooltip/types.d.ts.map +1 -1
  659. package/build-types/ui/utils/font-size.d.ts.map +1 -1
  660. package/build-types/ui/utils/get-valid-children.d.ts.map +1 -1
  661. package/build-types/unit-control/index.d.ts +3 -2
  662. package/build-types/unit-control/index.d.ts.map +1 -1
  663. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -0
  664. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  665. package/build-types/unit-control/types.d.ts +4 -3
  666. package/build-types/unit-control/types.d.ts.map +1 -1
  667. package/build-types/unit-control/unit-select-control.d.ts.map +1 -1
  668. package/build-types/utils/colors-values.d.ts +1 -0
  669. package/build-types/utils/colors-values.d.ts.map +1 -1
  670. package/build-types/utils/config-values.d.ts +1 -5
  671. package/build-types/utils/config-values.d.ts.map +1 -1
  672. package/build-types/utils/hooks/use-combined-ref.d.ts.map +1 -1
  673. package/build-types/utils/hooks/use-latest-ref.d.ts.map +1 -1
  674. package/build-types/v-stack/hook.d.ts +16 -16
  675. package/build-types/v-stack/types.d.ts.map +1 -1
  676. package/build-types/z-stack/component.d.ts +1 -1
  677. package/build-types/z-stack/component.d.ts.map +1 -1
  678. package/build-types/z-stack/styles.d.ts.map +1 -1
  679. package/package.json +23 -22
  680. package/src/alignment-matrix-control/stories/index.js +1 -1
  681. package/src/angle-picker-control/index.js +2 -0
  682. package/src/base-control/index.js +11 -2
  683. package/src/base-control/stories/index.js +1 -1
  684. package/src/base-control/styles/base-control-styles.js +10 -1
  685. package/src/base-field/hook.js +1 -1
  686. package/src/box-control/styles/box-control-styles.js +1 -1
  687. package/src/button/deprecated.js +1 -0
  688. package/src/button/index.js +1 -0
  689. package/src/button/index.native.js +15 -1
  690. package/src/button/stories/index.js +1 -1
  691. package/src/button/style.scss +14 -0
  692. package/src/card/card/README.md +3 -3
  693. package/src/card/card/component.js +1 -1
  694. package/src/card/card/hook.js +1 -1
  695. package/src/card/card-body/hook.js +1 -1
  696. package/src/card/card-divider/hook.js +1 -1
  697. package/src/card/card-footer/hook.js +1 -1
  698. package/src/card/card-header/hook.js +1 -1
  699. package/src/card/card-media/hook.js +1 -1
  700. package/src/card/stories/index.js +1 -1
  701. package/src/card/test/__snapshots__/index.js.snap +6 -6
  702. package/src/card/types.ts +0 -1
  703. package/src/checkbox-control/index.js +1 -1
  704. package/src/checkbox-control/stories/index.js +1 -1
  705. package/src/circular-option-picker/index.js +1 -0
  706. package/src/clipboard-button/index.js +1 -2
  707. package/src/color-indicator/README.md +28 -0
  708. package/src/color-indicator/index.js +2 -0
  709. package/src/color-indicator/stories/index.js +1 -1
  710. package/src/color-indicator/style.scss +5 -8
  711. package/src/color-palette/index.js +1 -0
  712. package/src/color-palette/index.native.js +2 -0
  713. package/src/color-palette/stories/index.js +1 -1
  714. package/src/color-palette/test/__snapshots__/index.js.snap +1 -1
  715. package/src/color-picker/README.md +1 -1
  716. package/src/color-picker/color-display.tsx +4 -3
  717. package/src/color-picker/color-input.tsx +1 -1
  718. package/src/color-picker/component.tsx +3 -4
  719. package/src/color-picker/hex-input.tsx +2 -1
  720. package/src/color-picker/input-with-slider.tsx +2 -1
  721. package/src/color-picker/stories/index.js +1 -1
  722. package/src/color-picker/use-deprecated-props.ts +2 -1
  723. package/src/combobox-control/README.md +2 -2
  724. package/src/combobox-control/stories/index.js +6 -2
  725. package/src/combobox-control/style.scss +2 -2
  726. package/src/confirm-dialog/README.md +128 -0
  727. package/src/confirm-dialog/component.tsx +117 -0
  728. package/src/confirm-dialog/index.tsx +6 -0
  729. package/src/confirm-dialog/stories/index.js +123 -0
  730. package/src/confirm-dialog/styles.ts +18 -0
  731. package/src/confirm-dialog/test/index.js +302 -0
  732. package/src/confirm-dialog/types.ts +25 -0
  733. package/src/custom-gradient-picker/index.js +1 -0
  734. package/src/custom-gradient-picker/style.scss +0 -5
  735. package/src/custom-select-control/stories/index.js +27 -0
  736. package/src/date-time/README.md +9 -2
  737. package/src/date-time/date.js +67 -84
  738. package/src/date-time/stories/index.js +1 -1
  739. package/src/date-time/stories/time.js +1 -1
  740. package/src/date-time/test/date.js +3 -29
  741. package/src/date-time/test/time.js +2 -2
  742. package/src/date-time/test/utils.js +32 -0
  743. package/src/date-time/time.js +2 -2
  744. package/src/date-time/utils.js +18 -0
  745. package/src/dimension-control/README.md +3 -1
  746. package/src/divider/README.md +33 -5
  747. package/src/divider/component.tsx +8 -8
  748. package/src/divider/stories/index.js +43 -17
  749. package/src/divider/styles.ts +53 -16
  750. package/src/divider/test/__snapshots__/index.js.snap +11 -11
  751. package/src/divider/test/index.js +4 -4
  752. package/src/divider/types.ts +5 -5
  753. package/src/drop-zone/index.js +14 -6
  754. package/src/drop-zone/provider.js +1 -0
  755. package/src/dropdown/index.js +14 -13
  756. package/src/dropdown-menu/stories/index.js +1 -1
  757. package/src/duotone-picker/README.md +1 -1
  758. package/src/elevation/hook.js +1 -0
  759. package/src/elevation/stories/index.js +1 -1
  760. package/src/elevation/types.ts +0 -1
  761. package/src/external-link/stories/index.js +1 -1
  762. package/src/external-link/styles/external-link-styles.js +3 -3
  763. package/src/flex/flex/hook.js +1 -0
  764. package/src/flex/types.ts +0 -1
  765. package/src/flyout/styles.ts +4 -2
  766. package/src/flyout/types.ts +0 -1
  767. package/src/focusable-iframe/index.js +1 -0
  768. package/src/font-size-picker/stories/index.js +1 -1
  769. package/src/form-token-field/stories/index.js +1 -1
  770. package/src/form-token-field/style.scss +1 -1
  771. package/src/form-token-field/suggestions-list.js +109 -120
  772. package/src/form-token-field/test/index.js +4 -2
  773. package/src/gradient-picker/README.md +94 -0
  774. package/src/gradient-picker/stories/index.js +1 -1
  775. package/src/grid/hook.js +1 -0
  776. package/src/grid/stories/index.js +1 -1
  777. package/src/grid/types.ts +0 -1
  778. package/src/guide/stories/index.js +1 -1
  779. package/src/h-stack/types.ts +0 -1
  780. package/src/heading/component.tsx +0 -1
  781. package/src/higher-order/with-focus-outside/index.js +2 -0
  782. package/src/icon/index.tsx +0 -1
  783. package/src/icon/stories/index.js +1 -1
  784. package/src/index.js +1 -0
  785. package/src/input-control/index.tsx +0 -1
  786. package/src/input-control/input-base.tsx +0 -1
  787. package/src/input-control/input-field.tsx +0 -1
  788. package/src/input-control/reducer/actions.ts +0 -1
  789. package/src/input-control/reducer/reducer.ts +0 -1
  790. package/src/input-control/reducer/state.ts +0 -1
  791. package/src/input-control/stories/index.js +2 -1
  792. package/src/input-control/styles/input-control-styles.tsx +23 -13
  793. package/src/input-control/types.ts +3 -2
  794. package/src/item-group/item/component.tsx +0 -1
  795. package/src/item-group/item/hook.ts +1 -2
  796. package/src/item-group/item-group/component.tsx +0 -1
  797. package/src/item-group/stories/index.js +84 -2
  798. package/src/menu-item/README.md +2 -2
  799. package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +2 -0
  800. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +8 -14
  801. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +33 -3
  802. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +162 -0
  803. package/src/mobile/bottom-sheet/cell.native.js +8 -6
  804. package/src/mobile/bottom-sheet/index.native.js +24 -14
  805. package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +6 -2
  806. package/src/mobile/bottom-sheet/link-suggestion-styles.native.scss +3 -0
  807. package/src/mobile/bottom-sheet/range-text-input.native.js +5 -2
  808. package/src/mobile/bottom-sheet/styles.native.scss +4 -0
  809. package/src/mobile/bottom-sheet/test/index.native.js +24 -0
  810. package/src/mobile/color-settings/index.native.js +4 -0
  811. package/src/mobile/color-settings/palette.screen.native.js +13 -5
  812. package/src/mobile/color-settings/style.native.scss +1 -1
  813. package/src/mobile/color-settings/utils.native.js +8 -3
  814. package/src/mobile/global-styles-context/utils.native.js +1 -1
  815. package/src/mobile/gridicons/index.native.js +3 -3
  816. package/src/mobile/html-text-input/test/index.native.js +34 -35
  817. package/src/mobile/inserter-button/style.native.scss +1 -0
  818. package/src/mobile/keyboard-avoiding-view/index.ios.js +12 -9
  819. package/src/mobile/link-picker/index.native.js +41 -6
  820. package/src/mobile/link-picker/link-picker-screen.native.js +13 -5
  821. package/src/mobile/link-settings/index.native.js +13 -1
  822. package/src/mobile/link-settings/test/edit.native.js +368 -0
  823. package/src/mobile/link-settings/test/link-settings-navigation.native.js +97 -0
  824. package/src/mobile/readable-content-view/index.native.js +5 -2
  825. package/src/mobile/utils/use-is-floating-keyboard.native.js +2 -5
  826. package/src/mobile/utils/use-unit-converter-to-mobile.native.js +5 -2
  827. package/src/modal/README.md +10 -0
  828. package/src/modal/aria-helper.js +2 -0
  829. package/src/modal/index.js +71 -63
  830. package/src/modal/stories/index.js +6 -1
  831. package/src/modal/style.scss +9 -0
  832. package/src/modal/test/index.js +11 -0
  833. package/src/navigation/README.md +0 -9
  834. package/src/navigator/context.ts +5 -1
  835. package/src/navigator/navigator-provider/README.md +30 -20
  836. package/src/navigator/navigator-provider/component.tsx +69 -25
  837. package/src/navigator/navigator-screen/component.tsx +71 -34
  838. package/src/navigator/stories/index.js +26 -13
  839. package/src/navigator/test/index.js +167 -32
  840. package/src/navigator/types.ts +11 -11
  841. package/src/navigator/use-navigator.ts +4 -4
  842. package/src/notice/index.native.js +5 -2
  843. package/src/notice/stories/index.js +1 -1
  844. package/src/number-control/stories/index.js +1 -1
  845. package/src/palette-edit/index.js +9 -2
  846. package/src/palette-edit/styles.js +22 -3
  847. package/src/panel/stories/index.js +1 -1
  848. package/src/placeholder/index.js +8 -6
  849. package/src/placeholder/stories/index.js +1 -1
  850. package/src/placeholder/style.scss +12 -0
  851. package/src/placeholder/test/index.js +18 -1
  852. package/src/popover/stories/index.js +1 -1
  853. package/src/query-controls/README.md +138 -6
  854. package/src/radio-group/README.md +4 -1
  855. package/src/range-control/stories/index.js +1 -1
  856. package/src/range-control/styles/range-control-styles.js +1 -1
  857. package/src/resizable-box/index.tsx +0 -1
  858. package/src/resizable-box/resize-tooltip/index.tsx +1 -2
  859. package/src/resizable-box/resize-tooltip/label.tsx +0 -1
  860. package/src/resizable-box/stories/index.js +1 -1
  861. package/src/sandbox/index.native.js +8 -5
  862. package/src/scrollable/hook.js +1 -1
  863. package/src/scrollable/stories/index.js +7 -4
  864. package/src/search-control/stories/index.js +1 -1
  865. package/src/select-control/stories/index.js +2 -1
  866. package/src/select-control/styles/select-control-styles.ts +25 -2
  867. package/src/select-control/types.ts +1 -1
  868. package/src/slot-fill/bubbles-virtually/fill.js +12 -1
  869. package/src/slot-fill/stories/index.js +1 -1
  870. package/src/snackbar/stories/index.js +1 -1
  871. package/src/spacer/component.tsx +0 -1
  872. package/src/spacer/stories/index.js +1 -1
  873. package/src/spacer/types.ts +0 -1
  874. package/src/spinner/README.md +10 -10
  875. package/src/spinner/index.js +42 -3
  876. package/src/spinner/index.native.js +7 -2
  877. package/src/spinner/stories/index.js +36 -3
  878. package/src/spinner/styles.js +47 -0
  879. package/src/style-provider/index.js +2 -0
  880. package/src/surface/hook.js +1 -0
  881. package/src/surface/stories/index.js +1 -1
  882. package/src/tab-panel/stories/index.js +1 -1
  883. package/src/text/get-line-height.ts +0 -1
  884. package/src/text/hook.js +1 -0
  885. package/src/text/types.ts +0 -1
  886. package/src/text-control/stories/index.js +1 -1
  887. package/src/text-highlight/stories/index.js +1 -1
  888. package/src/textarea-control/stories/index.js +1 -1
  889. package/src/tip/index.js +2 -4
  890. package/src/tip/stories/index.js +1 -1
  891. package/src/toggle-control/stories/index.js +1 -1
  892. package/src/toggle-group-control/stories/index.js +1 -1
  893. package/src/toggle-group-control/test/__snapshots__/index.js.snap +25 -27
  894. package/src/toggle-group-control/toggle-group-control/component.tsx +8 -14
  895. package/src/toggle-group-control/toggle-group-control/styles.ts +0 -14
  896. package/src/toggle-group-control/toggle-group-control-option/component.tsx +0 -1
  897. package/src/toggle-group-control/toggle-group-control-option/styles.ts +1 -3
  898. package/src/toggle-group-control/types.ts +1 -9
  899. package/src/toolbar-button/stories/index.js +1 -1
  900. package/src/tools-panel/stories/index.js +75 -1
  901. package/src/tools-panel/stories/tools-panel-with-item-group-slot.js +244 -0
  902. package/src/tools-panel/styles.ts +40 -2
  903. package/src/tools-panel/test/__snapshots__/index.js.snap +219 -0
  904. package/src/tools-panel/test/index.js +81 -1
  905. package/src/tools-panel/tools-panel/README.md +9 -0
  906. package/src/tools-panel/tools-panel/component.tsx +2 -6
  907. package/src/tools-panel/tools-panel/hook.ts +164 -97
  908. package/src/tools-panel/tools-panel-header/component.tsx +0 -1
  909. package/src/tools-panel/tools-panel-header/hook.ts +3 -3
  910. package/src/tools-panel/tools-panel-item/component.tsx +0 -1
  911. package/src/tools-panel/tools-panel-item/hook.ts +25 -2
  912. package/src/tools-panel/types.ts +14 -1
  913. package/src/tooltip/stories/index.js +1 -1
  914. package/src/tooltip/test/index.native.js +3 -1
  915. package/src/tree-grid/index.js +19 -5
  916. package/src/tree-select/stories/index.js +1 -1
  917. package/src/truncate/hook.js +1 -1
  918. package/src/truncate/stories/index.js +1 -1
  919. package/src/ui/README.md +1 -1
  920. package/src/ui/context/wordpress-component.ts +0 -1
  921. package/src/ui/control-group/types.ts +0 -1
  922. package/src/ui/form-group/types.ts +0 -1
  923. package/src/ui/shortcut/component.tsx +0 -1
  924. package/src/ui/tooltip/types.ts +0 -1
  925. package/src/ui/utils/font-size.ts +0 -1
  926. package/src/ui/utils/get-valid-children.ts +0 -1
  927. package/src/unit-control/index.tsx +0 -1
  928. package/src/unit-control/stories/index.js +19 -1
  929. package/src/unit-control/styles/unit-control-styles.ts +33 -46
  930. package/src/unit-control/types.ts +7 -4
  931. package/src/unit-control/unit-select-control.tsx +0 -1
  932. package/src/utils/colors-values.js +4 -3
  933. package/src/utils/config-values.js +1 -5
  934. package/src/utils/hooks/stories/use-cx.js +121 -44
  935. package/src/utils/hooks/use-combined-ref.ts +0 -1
  936. package/src/utils/hooks/use-latest-ref.ts +0 -1
  937. package/src/v-stack/types.ts +0 -1
  938. package/src/z-stack/README.md +1 -1
  939. package/src/z-stack/component.tsx +1 -2
  940. package/src/z-stack/stories/index.js +1 -1
  941. package/src/z-stack/styles.ts +7 -2
  942. package/tsconfig.json +9 -2
  943. package/tsconfig.tsbuildinfo +1 -1
  944. package/build/spinner/styles/spinner-styles.js +0 -40
  945. package/build/spinner/styles/spinner-styles.js.map +0 -1
  946. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +0 -90
  947. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +0 -1
  948. package/build-module/spinner/styles/spinner-styles.js +0 -28
  949. package/build-module/spinner/styles/spinner-styles.js.map +0 -1
  950. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +0 -86
  951. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +0 -1
  952. package/build-types/spinner/styles/spinner-styles.d.ts +0 -5
  953. package/build-types/spinner/styles/spinner-styles.d.ts.map +0 -1
  954. package/build-types/toggle-group-control/component.d.ts +0 -4
  955. package/build-types/toggle-group-control/component.d.ts.map +0 -1
  956. package/build-types/toggle-group-control/styles.d.ts +0 -25
  957. package/build-types/toggle-group-control/styles.d.ts.map +0 -1
  958. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts +0 -9
  959. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +0 -1
  960. package/build-types/toggle-group-control/toggle-group-control-backdrop.d.ts +0 -9
  961. package/build-types/toggle-group-control/toggle-group-control-backdrop.d.ts.map +0 -1
  962. package/build-types/toggle-group-control/toggle-group-control-button.d.ts +0 -6
  963. package/build-types/toggle-group-control/toggle-group-control-button.d.ts.map +0 -1
  964. package/build-types/toggle-group-control/toggle-group-control-context.d.ts +0 -9
  965. package/build-types/toggle-group-control/toggle-group-control-context.d.ts.map +0 -1
  966. package/build-types/toggle-group-control/toggle-group-control-option.d.ts +0 -4
  967. package/build-types/toggle-group-control/toggle-group-control-option.d.ts.map +0 -1
  968. package/build-types/ui/color-picker/color-display.d.ts +0 -13
  969. package/build-types/ui/color-picker/color-display.d.ts.map +0 -1
  970. package/build-types/ui/color-picker/color-input.d.ts +0 -13
  971. package/build-types/ui/color-picker/color-input.d.ts.map +0 -1
  972. package/build-types/ui/color-picker/component.d.ts +0 -12
  973. package/build-types/ui/color-picker/component.d.ts.map +0 -1
  974. package/build-types/ui/color-picker/hex-input.d.ts +0 -12
  975. package/build-types/ui/color-picker/hex-input.d.ts.map +0 -1
  976. package/build-types/ui/color-picker/hsl-input.d.ts +0 -12
  977. package/build-types/ui/color-picker/hsl-input.d.ts.map +0 -1
  978. package/build-types/ui/color-picker/index.d.ts +0 -2
  979. package/build-types/ui/color-picker/index.d.ts.map +0 -1
  980. package/build-types/ui/color-picker/input-with-slider.d.ts +0 -11
  981. package/build-types/ui/color-picker/input-with-slider.d.ts.map +0 -1
  982. package/build-types/ui/color-picker/legacy-adapter.d.ts +0 -5
  983. package/build-types/ui/color-picker/legacy-adapter.d.ts.map +0 -1
  984. package/build-types/ui/color-picker/picker.d.ts +0 -12
  985. package/build-types/ui/color-picker/picker.d.ts.map +0 -1
  986. package/build-types/ui/color-picker/rgb-input.d.ts +0 -12
  987. package/build-types/ui/color-picker/rgb-input.d.ts.map +0 -1
  988. package/build-types/ui/color-picker/styles.d.ts +0 -76
  989. package/build-types/ui/color-picker/styles.d.ts.map +0 -1
  990. package/build-types/ui/color-picker/types.d.ts +0 -2
  991. package/build-types/ui/color-picker/types.d.ts.map +0 -1
  992. package/build-types/ui/color-picker/use-deprecated-props.d.ts +0 -50
  993. package/build-types/ui/color-picker/use-deprecated-props.d.ts.map +0 -1
  994. package/build-types/ui/utils/create-component.d.ts +0 -21
  995. package/build-types/ui/utils/create-component.d.ts.map +0 -1
  996. package/build-types/utils/hooks/use-jump-step.d.ts +0 -25
  997. package/build-types/utils/hooks/use-jump-step.d.ts.map +0 -1
  998. package/src/spinner/styles/spinner-styles.js +0 -47
  999. package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +0 -86
  1000. package/src/ui/visually-hidden/README.md +0 -21
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"names":["DEFAULT_COLUMNS","generateMenuItems","panelItems","shouldReset","currentMenuItems","menuItems","default","optional","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","undefined","useToolsPanel","props","className","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","otherProps","isResetting","wasResetting","current","setPanelItems","registerPanelItem","item","items","newItems","existingIndex","findIndex","oldItem","splice","deregisterPanelItem","index","setMenuItems","prevState","flagItemCustomization","newState","areAllOptionalControlsHidden","setAreAllOptionalControlsHidden","optionalItems","Object","entries","allControlsHidden","length","some","isSelected","cx","classes","hasDefaultMenuItems","keys","wrapperStyle","styles","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","currentItem","find","menuGroup","newMenuItems","getResetAllFilters","filters","resetAllFilter","push","resetAllItems","resetMenuItems","panelContext","hasMenuItems"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;;;;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAYA,MAAMA,eAAe,GAAG,CAAxB;;AAEA,MAAMC,iBAAiB,GAAG,QAIQ;AAAA,MAJN;AAC3BC,IAAAA,UAD2B;AAE3BC,IAAAA,WAF2B;AAG3BC,IAAAA;AAH2B,GAIM;AACjC,QAAMC,SAA8B,GAAG;AAAEC,IAAAA,OAAO,EAAE,EAAX;AAAeC,IAAAA,QAAQ,EAAE;AAAzB,GAAvC;AAEAL,EAAAA,UAAU,CAACM,OAAX,CAAoB,SAA6C;AAAA;;AAAA,QAA3C;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,gBAAZ;AAA8BC,MAAAA;AAA9B,KAA2C;AAChE,UAAMC,KAAK,GAAGF,gBAAgB,GAAG,SAAH,GAAe,UAA7C,CADgE,CAGhE;AACA;AACA;;AACA,UAAMG,iBAAiB,GAAGT,gBAAH,aAAGA,gBAAH,gDAAGA,gBAAgB,CAAIQ,KAAJ,CAAnB,0DAAG,sBAA+BD,KAA/B,CAA1B;AACA,UAAMG,KAAK,GACVD,iBAAiB,KAAKE,SAAtB,GAAkCF,iBAAlC,GAAsDJ,QAAQ,EAD/D;AAGAJ,IAAAA,SAAS,CAAEO,KAA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AAC8C,MAPR;AAQpBxB,IAAAA,WAAW,EAAEA,WAAW,CAACE,OARL;AASpBJ,IAAAA;AAToB,GAArB;AAYA,SAAO,EACN,GAAGC,UADG;AAENiD,IAAAA,YAFM;AAGNF,IAAAA,aAHM;AAINT,IAAAA,UAJM;AAKN3C,IAAAA,SAAS,EAAEkC;AALL,GAAP;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label already exists, do not overwrite its value.\n\t\t// This can cause default controls that have been flagged as customized to\n\t\t// lose their value.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value =\n\t\t\texistingItemValue !== undefined ? existingItemValue : hasValue();\n\n\t\tmenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\treturn menuItems;\n};\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper,\n\t\tshouldRenderPlaceholderItems,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResetting = useRef( false );\n\tconst wasResetting = isResetting.current;\n\n\t// `isResetting` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResetting.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );\n\n\tconst registerPanelItem = ( item: ToolsPanelItem ) => {\n\t\tsetPanelItems( ( items ) => {\n\t\t\tconst newItems = [ ...items ];\n\t\t\t// If an item with this label is already registered, remove it first.\n\t\t\t// This can happen when an item is moved between the default and optional\n\t\t\t// groups.\n\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t( oldItem ) => oldItem.label === item.label\n\t\t\t);\n\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t}\n\t\t\treturn [ ...newItems, item ];\n\t\t} );\n\t};\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = ( label: string ) => {\n\t\t// When switching selections between components injecting matching\n\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t// deregistration of the first panel doesn't occur until after the\n\t\t// registration of the next.\n\t\tsetPanelItems( ( items ) => {\n\t\t\tconst newItems = [ ...items ];\n\t\t\tconst index = newItems.findIndex(\n\t\t\t\t( item ) => item.label === label\n\t\t\t);\n\t\t\tif ( index !== -1 ) {\n\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t}\n\t\t\treturn newItems;\n\t\t} );\n\t};\n\n\t// Manage and share display state of menu items representing child controls.\n\tconst [ menuItems, setMenuItems ] = useState< ToolsPanelMenuItems >( {\n\t\tdefault: {},\n\t\toptional: {},\n\t} );\n\n\t// Setup menuItems state as panel items register themselves.\n\tuseEffect( () => {\n\t\tsetMenuItems( ( prevState ) => {\n\t\t\tconst items = generateMenuItems( {\n\t\t\t\tpanelItems,\n\t\t\t\tshouldReset: false,\n\t\t\t\tcurrentMenuItems: prevState,\n\t\t\t} );\n\t\t\treturn items;\n\t\t} );\n\t}, [ panelItems ] );\n\n\t// Force a menu item to be checked.\n\t// This is intended for use with default panel items. They are displayed\n\t// separately to optional items and have different display states,\n\t// we need to update that when their value is customized.\n\tconst flagItemCustomization = (\n\t\tlabel: string,\n\t\tgroup: ToolsPanelMenuItemKey = 'default'\n\t) => {\n\t\tsetMenuItems( ( items ) => {\n\t\t\tconst newState = {\n\t\t\t\t...items,\n\t\t\t\t[ group ]: {\n\t\t\t\t\t...items[ group ],\n\t\t\t\t\t[ label ]: true,\n\t\t\t\t},\n\t\t\t};\n\t\t\treturn newState;\n\t\t} );\n\t};\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst [\n\t\tareAllOptionalControlsHidden,\n\t\tsetAreAllOptionalControlsHidden,\n\t] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( menuItems.optional ) {\n\t\t\tconst optionalItems = Object.entries( menuItems.optional );\n\t\t\tconst allControlsHidden =\n\t\t\t\toptionalItems.length > 0 &&\n\t\t\t\t! optionalItems.some( ( [ , isSelected ] ) => isSelected );\n\t\t\tsetAreAllOptionalControlsHidden( allControlsHidden );\n\t\t}\n\t}, [ menuItems.optional ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst hasDefaultMenuItems =\n\t\t\tmenuItems?.default && !! Object.keys( menuItems?.default ).length;\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\t! hasDefaultMenuItems &&\n\t\t\tareAllOptionalControlsHidden &&\n\t\t\tstyles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx( styles.ToolsPanel, wrapperStyle, emptyStyle, className );\n\t}, [\n\t\tclassName,\n\t\thasInnerWrapper,\n\t\tmenuItems,\n\t\tareAllOptionalControlsHidden,\n\t] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = ( label: string ) => {\n\t\tconst currentItem = panelItems.find( ( item ) => item.label === label );\n\n\t\tif ( ! currentItem ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst menuGroup = currentItem.isShownByDefault ? 'default' : 'optional';\n\n\t\tconst newMenuItems = {\n\t\t\t...menuItems,\n\t\t\t[ menuGroup ]: {\n\t\t\t\t...menuItems[ menuGroup ],\n\t\t\t\t[ label ]: ! menuItems[ menuGroup ][ label ],\n\t\t\t},\n\t\t};\n\n\t\tsetMenuItems( newMenuItems );\n\t};\n\n\tconst getResetAllFilters = () => {\n\t\tconst filters: Array< () => void > = [];\n\n\t\tpanelItems.forEach( ( item ) => {\n\t\t\tif ( item.resetAllFilter ) {\n\t\t\t\tfilters.push( item.resetAllFilter );\n\t\t\t}\n\t\t} );\n\t\treturn filters;\n\t};\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResetting.current = true;\n\t\t\tresetAll( getResetAllFilters() );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tconst resetMenuItems = generateMenuItems( {\n\t\t\tpanelItems,\n\t\t\tshouldReset: true,\n\t\t} );\n\t\tsetMenuItems( resetMenuItems );\n\t};\n\n\tconst panelContext = {\n\t\tpanelId,\n\t\tmenuItems,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tareAllOptionalControlsHidden,\n\t\thasMenuItems: !! panelItems.length,\n\t\tisResetting: isResetting.current,\n\t\tshouldRenderPlaceholderItems,\n\t};\n\n\treturn {\n\t\t...otherProps,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\tclassName: classes,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"names":["DEFAULT_COLUMNS","generateMenuItems","panelItems","shouldReset","currentMenuItems","menuItems","default","optional","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","undefined","isMenuItemTypeEmpty","obj","Object","keys","length","useToolsPanel","props","className","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","isResetting","wasResetting","current","setPanelItems","registerPanelItem","item","items","newItems","existingIndex","findIndex","oldItem","splice","deregisterPanelItem","index","setMenuItems","prevState","flagItemCustomization","newState","areAllOptionalControlsHidden","setAreAllOptionalControlsHidden","allControlsHidden","entries","some","isSelected","cx","classes","wrapperStyle","styles","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","currentItem","find","menuGroup","newMenuItems","resetAllItems","filters","resetAllFilter","push","resetMenuItems","getFirstVisibleItemLabel","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","panelContext","hasMenuItems"],"mappings":";;;;;;;AAGA;;AAWA;;AACA;;AACA;;;;;;AAhBA;AACA;AACA;;AASA;AACA;AACA;AAYA,MAAMA,eAAe,GAAG,CAAxB;;AAEA,MAAMC,iBAAiB,GAAG,QAIQ;AAAA,MAJN;AAC3BC,IAAAA,UAD2B;AAE3BC,IAAAA,WAF2B;AAG3BC,IAAAA;AAH2B,GAIM;AACjC,QAAMC,SAA8B,GAAG;AAAEC,IAAAA,OAAO,EAAE,EAAX;AAAeC,IAAAA,QAAQ,EAAE;AAAzB,GAAvC;AAEAL,EAAAA,UAAU,CAACM,OAAX,CAAoB,SAA6C;AAAA;;AAAA,QAA3C;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,gBAAZ;AAA8BC,MAAAA;AAA9B,KAA2C;AAChE,UAAMC,KAAK,GAAGF,gBAAgB,GAAG,SAAH,GAA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oB,IAAAA,OATO;AAUPU,IAAAA,iBAVO;AAWPR,IAAAA,4BAXO;AAYPC,IAAAA,mCAZO;AAaPC,IAAAA;AAbO,GAAR,CADoB,EAgBpB,CACCoB,4BADD,EAECN,mBAFD,EAGCiC,kBAHD,EAIC7B,qBAJD,EAKChB,WAAW,CAACE,OALb,EAMC4C,iBAND,EAOCxE,SAPD,EAQCoB,OARD,EASCvB,UATD,EAUCiC,iBAVD,EAWCR,4BAXD,EAYCC,mCAZD,EAaCC,kCAbD,CAhBoB,CAArB;AAiCA,SAAO,EACN,GAAGC,UADG;AAENiD,IAAAA,YAFM;AAGNX,IAAAA,aAHM;AAINL,IAAAA,UAJM;AAKNxC,IAAAA,SAAS,EAAEiC;AALL,GAAP;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label already exists, do not overwrite its value.\n\t\t// This can cause default controls that have been flagged as customized to\n\t\t// lose their value.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value =\n\t\t\texistingItemValue !== undefined ? existingItemValue : hasValue();\n\n\t\tmenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\treturn menuItems;\n};\n\nconst isMenuItemTypeEmpty = (\n\tobj?: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => obj && Object.keys( obj ).length === 0;\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper,\n\t\tshouldRenderPlaceholderItems,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResetting = useRef( false );\n\tconst wasResetting = isResetting.current;\n\n\t// `isResetting` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResetting.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );\n\n\tconst registerPanelItem = useCallback(\n\t\t( item: ToolsPanelItem ) => {\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t\t// and optional groups.\n\t\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t\t( oldItem ) => oldItem.label === item.label\n\t\t\t\t);\n\t\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t\t}\n\t\t\t\treturn [ ...newItems, item ];\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = useCallback(\n\t\t( label: string ) => {\n\t\t\t// When switching selections between components injecting matching\n\t\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t\t// deregistration of the first panel doesn't occur until after the\n\t\t\t// registration of the next.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\tconst index = newItems.findIndex(\n\t\t\t\t\t( item ) => item.label === label\n\t\t\t\t);\n\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\t}\n\t\t\t\treturn newItems;\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\t// Manage and share display state of menu items representing child controls.\n\tconst [ menuItems, setMenuItems ] = useState< ToolsPanelMenuItems >( {\n\t\tdefault: {},\n\t\toptional: {},\n\t} );\n\n\t// Setup menuItems state as panel items register themselves.\n\tuseEffect( () => {\n\t\tsetMenuItems( ( prevState ) => {\n\t\t\tconst items = generateMenuItems( {\n\t\t\t\tpanelItems,\n\t\t\t\tshouldReset: false,\n\t\t\t\tcurrentMenuItems: prevState,\n\t\t\t} );\n\t\t\treturn items;\n\t\t} );\n\t}, [ generateMenuItems, panelItems, setMenuItems ] );\n\n\t// Force a menu item to be checked.\n\t// This is intended for use with default panel items. They are displayed\n\t// separately to optional items and have different display states,\n\t// we need to update that when their value is customized.\n\tconst flagItemCustomization = useCallback(\n\t\t( label: string, group: ToolsPanelMenuItemKey = 'default' ) => {\n\t\t\tsetMenuItems( ( items ) => {\n\t\t\t\tconst newState = {\n\t\t\t\t\t...items,\n\t\t\t\t\t[ group ]: {\n\t\t\t\t\t\t...items[ group ],\n\t\t\t\t\t\t[ label ]: true,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn newState;\n\t\t\t} );\n\t\t},\n\t\t[ setMenuItems ]\n\t);\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst [\n\t\tareAllOptionalControlsHidden,\n\t\tsetAreAllOptionalControlsHidden,\n\t] = useState( false );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems?.optional )\n\t\t) {\n\t\t\tconst allControlsHidden = ! Object.entries(\n\t\t\t\tmenuItems.optional\n\t\t\t).some( ( [ , isSelected ] ) => isSelected );\n\t\t\tsetAreAllOptionalControlsHidden( allControlsHidden );\n\t\t}\n\t}, [ menuItems, setAreAllOptionalControlsHidden ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\tareAllOptionalControlsHidden &&\n\t\t\tstyles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx( styles.ToolsPanel, wrapperStyle, emptyStyle, className );\n\t}, [\n\t\tareAllOptionalControlsHidden,\n\t\tclassName,\n\t\tcx,\n\t\thasInnerWrapper,\n\t\tmenuItems,\n\t] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = useCallback(\n\t\t( label: string ) => {\n\t\t\tconst currentItem = panelItems.find(\n\t\t\t\t( item ) => item.label === label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst menuGroup = currentItem.isShownByDefault\n\t\t\t\t? 'default'\n\t\t\t\t: 'optional';\n\n\t\t\tconst newMenuItems = {\n\t\t\t\t...menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...menuItems[ menuGroup ],\n\t\t\t\t\t[ label ]: ! menuItems[ menuGroup ][ label ],\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tsetMenuItems( newMenuItems );\n\t\t},\n\t\t[ menuItems, panelItems, setMenuItems ]\n\t);\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = useCallback( () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResetting.current = true;\n\n\t\t\t// Collect available reset filters from panel items.\n\t\t\tconst filters: Array< () => void > = [];\n\t\t\tpanelItems.forEach( ( item ) => {\n\t\t\t\tif ( item.resetAllFilter ) {\n\t\t\t\t\tfilters.push( item.resetAllFilter );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tresetAll( filters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tconst resetMenuItems = generateMenuItems( {\n\t\t\tpanelItems,\n\t\t\tshouldReset: true,\n\t\t} );\n\t\tsetMenuItems( resetMenuItems );\n\t}, [\n\t\tgenerateMenuItems,\n\t\tisResetting.current,\n\t\tpanelItems,\n\t\tresetAll,\n\t\tsetMenuItems,\n\t] );\n\n\t// Assist ItemGroup styling when there are potentially hidden placeholder\n\t// items by identifying first & last items that are toggled on for display.\n\tconst getFirstVisibleItemLabel = ( items: ToolsPanelItem[] ) => {\n\t\tconst optionalItems = menuItems.optional || {};\n\t\tconst firstItem = items.find(\n\t\t\t( item ) => item.isShownByDefault || !! optionalItems[ item.label ]\n\t\t);\n\n\t\treturn firstItem?.label;\n\t};\n\n\tconst firstDisplayedItem = getFirstVisibleItemLabel( panelItems );\n\tconst lastDisplayedItem = getFirstVisibleItemLabel(\n\t\t[ ...panelItems ].reverse()\n\t);\n\n\tconst panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems: !! panelItems.length,\n\t\t\tisResetting: isResetting.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t} ),\n\t\t[\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tisResetting.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tpanelItems,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t]\n\t);\n\n\treturn {\n\t\t...otherProps,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\tclassName: classes,\n\t};\n}\n"]}
@@ -32,7 +32,6 @@ var _context = require("../../ui/context");
32
32
  /**
33
33
  * External dependencies
34
34
  */
35
- // eslint-disable-next-line no-restricted-imports
36
35
 
37
36
  /**
38
37
  * WordPress dependencies
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-header/component.tsx"],"names":["noop","DefaultControlsGroup","items","onClose","toggleItem","length","map","label","hasValue","icon","reset","check","itemLabel","undefined","OptionalControlsGroup","isSelected","ToolsPanelHeader","props","forwardedRef","areAllOptionalControlsHidden","dropdownMenuClassName","hasMenuItems","headingClassName","labelText","menuItems","resetAll","headerProps","defaultItems","Object","entries","default","optionalItems","optional","dropDownMenuIcon","plus","moreVertical","dropDownMenuLabelText","className","isSmall","ConnectedToolsPanelHeader"],"mappings":";;;;;;;;;;;;;AASA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAaA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,oBAAoB,GAAG,QAIQ;AAAA,MAJN;AAC9BC,IAAAA,KAD8B;AAE9BC,IAAAA,OAF8B;AAG9BC,IAAAA;AAH8B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AAGI;AAAjC,KACGC,SADH,CADD,EAIGF,YAAY,IACb,4BAAC,qBAAD;AACC,IAAA,IAAI,EAAGY,gBADR;AAEC,IAAA,KAAK,EAAGG,qBAFT;AAGC,IAAA,SAAS,EAAG;AAAEC,MAAAA,SAAS,EAAEjB;AAAb,KAHb;AAIC,IAAA,WAAW,EAAG;AAAEkB,MAAAA,OAAO,EAAE;AAAX;AAJf,KAMG;AAAA,QAAE;AAAEnC,MAAAA,OAAO,GAAGH;AAAZ,KAAF;AAAA,WACD,qDACC,4BAAC,oBAAD;AACC,MAAA,KAAK,EAAG2B,YADT;AAEC,MAAA,OAAO,EAAGxB,OAFX;AAGC,MAAA,UAAU,EAAGC;AAHd,MADD,EAMC,4BAAC,qBAAD;AACC,MAAA,KAAK,EAAG2B,aADT;AAEC,MAAA,OAAO,EAAG5B,OAFX;AAGC,MAAA,UAAU,EAAGC;AAHd,MAND,EAWC,4BAAC,kBAAD,QACC,4BAAC,iBAAD;AACC,MAAA,OAAO,EAAG,UADX;AAEC,MAAA,OAAO,EAAG,MAAM;AACfqB,QAAAA,QAAQ;AACRtB,QAAAA,OAAO;AACP;AALF,OAOG,cAAI,WAAJ,CAPH,CADD,CAXD,CADC;AAAA,GANH,CALF,CADD;AAyCA,CAvED;;AAyEA,MAAMoC,yBAAyB,GAAG,6BACjCvB,gBADiC,EAEjC,kBAFiC,CAAlC;eAKeuB,yB","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport type { Ref } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { check, reset, moreVertical, plus } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DropdownMenu from '../../dropdown-menu';\nimport MenuGroup from '../../menu-group';\nimport MenuItem from '../../menu-item';\nimport { HStack } from '../../h-stack';\nimport { Heading } from '../../heading';\nimport { useToolsPanelHeader } from './hook';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type {\n\tToolsPanelControlsGroupProps,\n\tToolsPanelHeaderProps,\n} from '../types';\n\nconst noop = () => {};\n\nconst DefaultControlsGroup = ( {\n\titems,\n\tonClose,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup>\n\t\t\t{ items.map( ( [ label, hasValue ] ) => {\n\t\t\t\tconst icon = hasValue ? reset : check;\n\t\t\t\tconst itemLabel = hasValue\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: undefined;\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tisSelected={ true }\n\t\t\t\t\t\tdisabled={ ! hasValue }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst OptionalControlsGroup = ( {\n\titems,\n\tonClose,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup>\n\t\t\t{ items.map( ( [ label, isSelected ] ) => {\n\t\t\t\tconst itemLabel = isSelected\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being hidden and reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Hide and reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control to display e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Show %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ isSelected && check }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst ToolsPanelHeader = (\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >,\n\tforwardedRef: Ref< any >\n) => {\n\tconst {\n\t\tareAllOptionalControlsHidden,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\tlabel: labelText,\n\t\tmenuItems,\n\t\tresetAll,\n\t\ttoggleItem,\n\t\t...headerProps\n\t} = useToolsPanelHeader( props );\n\n\tif ( ! labelText ) {\n\t\treturn null;\n\t}\n\n\tconst defaultItems = Object.entries( menuItems?.default || {} );\n\tconst optionalItems = Object.entries( menuItems?.optional || {} );\n\tconst dropDownMenuIcon = areAllOptionalControlsHidden ? plus : moreVertical;\n\tconst dropDownMenuLabelText = areAllOptionalControlsHidden\n\t\t? _x(\n\t\t\t\t'View and add options',\n\t\t\t\t'Button label to reveal tool panel options'\n\t\t )\n\t\t: _x( 'View options', 'Button label to reveal tool panel options' );\n\n\treturn (\n\t\t<HStack { ...headerProps } ref={ forwardedRef }>\n\t\t\t<Heading level={ 2 } className={ headingClassName }>\n\t\t\t\t{ labelText }\n\t\t\t</Heading>\n\t\t\t{ hasMenuItems && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ dropDownMenuIcon }\n\t\t\t\t\tlabel={ dropDownMenuLabelText }\n\t\t\t\t\tmenuProps={ { className: dropdownMenuClassName } }\n\t\t\t\t\ttoggleProps={ { isSmall: true } }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose = noop } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<DefaultControlsGroup\n\t\t\t\t\t\t\t\titems={ defaultItems }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<OptionalControlsGroup\n\t\t\t\t\t\t\t\titems={ optionalItems }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tvariant={ 'tertiary' }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tresetAll();\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset all' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</HStack>\n\t);\n};\n\nconst ConnectedToolsPanelHeader = contextConnect(\n\tToolsPanelHeader,\n\t'ToolsPanelHeader'\n);\n\nexport default ConnectedToolsPanelHeader;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-header/component.tsx"],"names":["noop","DefaultControlsGroup","items","onClose","toggleItem","length","map","label","hasValue","icon","reset","check","itemLabel","undefined","OptionalControlsGroup","isSelected","ToolsPanelHeader","props","forwardedRef","areAllOptionalControlsHidden","dropdownMenuClassName","hasMenuItems","headingClassName","labelText","menuItems","resetAll","headerProps","defaultItems","Object","entries","default","optionalItems","optional","dropDownMenuIcon","plus","moreVertical","dropDownMenuLabelText","className","isSmall","ConnectedToolsPanelHeader"],"mappings":";;;;;;;;;;;;;AAQA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAaA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,oBAAoB,GAAG,QAIQ;AAAA,MAJN;AAC9BC,IAAAA,KAD8B;AAE9BC,IAAAA,OAF8B;AAG9BC,IAAAA;AAH8B,GAIM;;AACpC,MAAK,CAAEF,KAAK,CAACG,MAAb,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,kBAAD,QACGH,KAAK,CAACI,GAAN,CAAW,SAA2B;AAAA,QAAzB,CAAEC,KAAF,EAASC,QAAT,CAAyB;AACvC,UAAMC,IAAI,GAAGD,QAAQ,GAAGE,YAAH,GAAWC,YAAhC;AACA,UAAMC,SAAS,GAAGJ,QAAQ,GACvB,oBACA;AACA,kBAAI,UAAJ,CAFA,EAGAD,KAHA,CADuB,GAMvBM,SANH;AAQA,WACC,4BAAC,iBAAD;AACC,MAAA,GAAG,EAAGN,KADP;AAEC,MAAA,IAAI,EAAGE,IAFR;AAGC,MAAA,UAAU,EAAG,IAHd;AAIC,MAAA,QAAQ,EAAG,CAAED,QAJd;AAKC,MAAA,KAAK,EAAGI,SALT;AAMC,MAAA,OAAO,EAAG,MAAM;AACfR,QAAAA,UAAU,CAAEG,KAAF,CAAV;AACAJ,QAAAA,OAAO;AACP,OATF;AAUC,MAAA,IAAI,EAAC;AAVN,OAYGI,KAZH,CADD;AAgBA,GA1BC,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A,OAAO;AACP;AALF,OAOG,cAAI,WAAJ,CAPH,CADD,CAXD,CADC;AAAA,GANH,CALF,CADD;AAyCA,CAvED;;AAyEA,MAAMoC,yBAAyB,GAAG,6BACjCvB,gBADiC,EAEjC,kBAFiC,CAAlC;eAKeuB,yB","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { check, reset, moreVertical, plus } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DropdownMenu from '../../dropdown-menu';\nimport MenuGroup from '../../menu-group';\nimport MenuItem from '../../menu-item';\nimport { HStack } from '../../h-stack';\nimport { Heading } from '../../heading';\nimport { useToolsPanelHeader } from './hook';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type {\n\tToolsPanelControlsGroupProps,\n\tToolsPanelHeaderProps,\n} from '../types';\n\nconst noop = () => {};\n\nconst DefaultControlsGroup = ( {\n\titems,\n\tonClose,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup>\n\t\t\t{ items.map( ( [ label, hasValue ] ) => {\n\t\t\t\tconst icon = hasValue ? reset : check;\n\t\t\t\tconst itemLabel = hasValue\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: undefined;\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tisSelected={ true }\n\t\t\t\t\t\tdisabled={ ! hasValue }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst OptionalControlsGroup = ( {\n\titems,\n\tonClose,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup>\n\t\t\t{ items.map( ( [ label, isSelected ] ) => {\n\t\t\t\tconst itemLabel = isSelected\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being hidden and reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Hide and reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control to display e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Show %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ isSelected && check }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</MenuGroup>\n\t);\n};\n\nconst ToolsPanelHeader = (\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >,\n\tforwardedRef: Ref< any >\n) => {\n\tconst {\n\t\tareAllOptionalControlsHidden,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\tlabel: labelText,\n\t\tmenuItems,\n\t\tresetAll,\n\t\ttoggleItem,\n\t\t...headerProps\n\t} = useToolsPanelHeader( props );\n\n\tif ( ! labelText ) {\n\t\treturn null;\n\t}\n\n\tconst defaultItems = Object.entries( menuItems?.default || {} );\n\tconst optionalItems = Object.entries( menuItems?.optional || {} );\n\tconst dropDownMenuIcon = areAllOptionalControlsHidden ? plus : moreVertical;\n\tconst dropDownMenuLabelText = areAllOptionalControlsHidden\n\t\t? _x(\n\t\t\t\t'View and add options',\n\t\t\t\t'Button label to reveal tool panel options'\n\t\t )\n\t\t: _x( 'View options', 'Button label to reveal tool panel options' );\n\n\treturn (\n\t\t<HStack { ...headerProps } ref={ forwardedRef }>\n\t\t\t<Heading level={ 2 } className={ headingClassName }>\n\t\t\t\t{ labelText }\n\t\t\t</Heading>\n\t\t\t{ hasMenuItems && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ dropDownMenuIcon }\n\t\t\t\t\tlabel={ dropDownMenuLabelText }\n\t\t\t\t\tmenuProps={ { className: dropdownMenuClassName } }\n\t\t\t\t\ttoggleProps={ { isSmall: true } }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose = noop } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<DefaultControlsGroup\n\t\t\t\t\t\t\t\titems={ defaultItems }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<OptionalControlsGroup\n\t\t\t\t\t\t\t\titems={ optionalItems }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tvariant={ 'tertiary' }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tresetAll();\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset all' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</HStack>\n\t);\n};\n\nconst ConnectedToolsPanelHeader = contextConnect(\n\tToolsPanelHeader,\n\t'ToolsPanelHeader'\n);\n\nexport default ConnectedToolsPanelHeader;\n"]}
@@ -34,13 +34,13 @@ function useToolsPanelHeader(props) {
34
34
  const cx = (0, _useCx.useCx)();
35
35
  const classes = (0, _element.useMemo)(() => {
36
36
  return cx(styles.ToolsPanelHeader, className);
37
- }, [className]);
37
+ }, [className, cx]);
38
38
  const dropdownMenuClassName = (0, _element.useMemo)(() => {
39
39
  return cx(styles.DropdownMenu);
40
- }, []);
40
+ }, [cx]);
41
41
  const headingClassName = (0, _element.useMemo)(() => {
42
42
  return cx(styles.ToolsPanelHeading);
43
- }, []);
43
+ }, [cx]);
44
44
  const {
45
45
  menuItems,
46
46
  hasMenuItems,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-header/hook.ts"],"names":["useToolsPanelHeader","props","className","otherProps","cx","classes","styles","ToolsPanelHeader","dropdownMenuClassName","DropdownMenu","headingClassName","ToolsPanelHeading","menuItems","hasMenuItems","areAllOptionalControlsHidden"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAOO,SAASA,mBAAT,CACNC,KADM,EAEL;AACD,QAAM;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,MAA+B,gCACpCF,KADoC,EAEpC,kBAFoC,CAArC;AAKA,QAAMG,EAAE,GAAG,mBAAX;AACA,QAAMC,OAAO,GAAG,sBAAS,MAAM;AAC9B,WAAOD,EAAE,CAAEE,MAAM,CAACC,gBAAT,EAA2BL,SAA3B,CAAT;AACA,GAFe,EAEb,CAAEA,SAAF,CAFa,CAAhB;AAIA,QAAMM,qBAAqB,GAAG,sBAAS,MAAM;AAC5C,WAAOJ,EAAE,CAAEE,MAAM,CAACG,YAAT,CAAT;AACA,GAF6B,EAE3B,EAF2B,CAA9B;AAIA,QAAMC,gBAAgB,GAAG,sBAAS,MAAM;AACvC,WAAON,EAAE,CAAEE,MAAM,CAACK,iBAAT,CAAT;AACA,GAFwB,EAEtB,EAFsB,CAAzB;AAIA,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,YAFK;AAGLC,IAAAA;AAHK,MAIF,oCAJJ;AAMA,SAAO,EACN,GAAGX,UADG;AAENW,IAAAA,4BAFM;AAGNN,IAAAA,qBAHM;AAINK,IAAAA,YAJM;AAKNH,IAAAA,gBALM;AAMNE,IAAAA,SANM;AAONV,IAAAA,SAAS,EAAEG;AAPL,GAAP;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelHeaderProps } from '../types';\n\nexport function useToolsPanelHeader(\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >\n) {\n\tconst { className, ...otherProps } = useContextSystem(\n\t\tprops,\n\t\t'ToolsPanelHeader'\n\t);\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\treturn cx( styles.ToolsPanelHeader, className );\n\t}, [ className ] );\n\n\tconst dropdownMenuClassName = useMemo( () => {\n\t\treturn cx( styles.DropdownMenu );\n\t}, [] );\n\n\tconst headingClassName = useMemo( () => {\n\t\treturn cx( styles.ToolsPanelHeading );\n\t}, [] );\n\n\tconst {\n\t\tmenuItems,\n\t\thasMenuItems,\n\t\tareAllOptionalControlsHidden,\n\t} = useToolsPanelContext();\n\n\treturn {\n\t\t...otherProps,\n\t\tareAllOptionalControlsHidden,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\tmenuItems,\n\t\tclassName: classes,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-header/hook.ts"],"names":["useToolsPanelHeader","props","className","otherProps","cx","classes","styles","ToolsPanelHeader","dropdownMenuClassName","DropdownMenu","headingClassName","ToolsPanelHeading","menuItems","hasMenuItems","areAllOptionalControlsHidden"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAOO,SAASA,mBAAT,CACNC,KADM,EAEL;AACD,QAAM;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,MAA+B,gCACpCF,KADoC,EAEpC,kBAFoC,CAArC;AAKA,QAAMG,EAAE,GAAG,mBAAX;AACA,QAAMC,OAAO,GAAG,sBAAS,MAAM;AAC9B,WAAOD,EAAE,CAAEE,MAAM,CAACC,gBAAT,EAA2BL,SAA3B,CAAT;AACA,GAFe,EAEb,CAAEA,SAAF,EAAaE,EAAb,CAFa,CAAhB;AAIA,QAAMI,qBAAqB,GAAG,sBAAS,MAAM;AAC5C,WAAOJ,EAAE,CAAEE,MAAM,CAACG,YAAT,CAAT;AACA,GAF6B,EAE3B,CAAEL,EAAF,CAF2B,CAA9B;AAIA,QAAMM,gBAAgB,GAAG,sBAAS,MAAM;AACvC,WAAON,EAAE,CAAEE,MAAM,CAACK,iBAAT,CAAT;AACA,GAFwB,EAEtB,CAAEP,EAAF,CAFsB,CAAzB;AAIA,QAAM;AACLQ,IAAAA,SADK;AAELC,IAAAA,YAFK;AAGLC,IAAAA;AAHK,MAIF,oCAJJ;AAMA,SAAO,EACN,GAAGX,UADG;AAENW,IAAAA,4BAFM;AAGNN,IAAAA,qBAHM;AAINK,IAAAA,YAJM;AAKNH,IAAAA,gBALM;AAMNE,IAAAA,SANM;AAONV,IAAAA,SAAS,EAAEG;AAPL,GAAP;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelHeaderProps } from '../types';\n\nexport function useToolsPanelHeader(\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >\n) {\n\tconst { className, ...otherProps } = useContextSystem(\n\t\tprops,\n\t\t'ToolsPanelHeader'\n\t);\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\treturn cx( styles.ToolsPanelHeader, className );\n\t}, [ className, cx ] );\n\n\tconst dropdownMenuClassName = useMemo( () => {\n\t\treturn cx( styles.DropdownMenu );\n\t}, [ cx ] );\n\n\tconst headingClassName = useMemo( () => {\n\t\treturn cx( styles.ToolsPanelHeading );\n\t}, [ cx ] );\n\n\tconst {\n\t\tmenuItems,\n\t\thasMenuItems,\n\t\tareAllOptionalControlsHidden,\n\t} = useToolsPanelContext();\n\n\treturn {\n\t\t...otherProps,\n\t\tareAllOptionalControlsHidden,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\tmenuItems,\n\t\tclassName: classes,\n\t};\n}\n"]}
@@ -20,7 +20,6 @@ var _context = require("../../ui/context");
20
20
  /**
21
21
  * External dependencies
22
22
  */
23
- // eslint-disable-next-line no-restricted-imports
24
23
 
25
24
  /**
26
25
  * Internal dependencies
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/component.tsx"],"names":["ToolsPanelItem","props","forwardedRef","children","isShown","shouldRenderPlaceholder","toolsPanelItemProps","ConnectedToolsPanelItem"],"mappings":";;;;;;;;;;;;;AASA;;AACA;;AACA;;AAXA;AACA;AACA;AACA;;AAGA;AACA;AACA;AAMA;AACA;AACA,MAAMA,cAAc,GAAG,CACtBC,KADsB,EAEtBC,YAFsB,KAGlB;AACJ,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,OAFK;AAGLC,IAAAA,uBAHK;AAIL,OAAGC;AAJE,MAKF,6BAAmBL,KAAnB,CALJ;;AAOA,MAAK,CAAEG,OAAP,EAAiB;AAChB,WAAOC,uBAAuB,GAC7B,4BAAC,UAAD,6BAAWC,mBAAX;AAAiC,MAAA,GAAG,EAAGJ;AAAvC,OAD6B,GAE1B,IAFJ;AAGA;;AAED,SACC,4BAAC,UAAD,6BAAWI,mBAAX;AAAiC,IAAA,GAAG,EAAGJ;AAAvC,MACGC,QADH,CADD;AAKA,CAtBD;;AAwBA,MAAMI,uBAAuB,GAAG,6BAC/BP,cAD+B,EAE/B,gBAF+B,CAAhC;eAKeO,uB","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport type { Ref } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelItem } from './hook';\nimport { View } from '../../view';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type { ToolsPanelItemProps } from '../types';\n\n// This wraps controls to be conditionally displayed within a tools panel. It\n// prevents props being applied to HTML elements that would make them invalid.\nconst ToolsPanelItem = (\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >,\n\tforwardedRef: Ref< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\t...toolsPanelItemProps\n\t} = useToolsPanelItem( props );\n\n\tif ( ! isShown ) {\n\t\treturn shouldRenderPlaceholder ? (\n\t\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef } />\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef }>\n\t\t\t{ children }\n\t\t</View>\n\t);\n};\n\nconst ConnectedToolsPanelItem = contextConnect(\n\tToolsPanelItem,\n\t'ToolsPanelItem'\n);\n\nexport default ConnectedToolsPanelItem;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/component.tsx"],"names":["ToolsPanelItem","props","forwardedRef","children","isShown","shouldRenderPlaceholder","toolsPanelItemProps","ConnectedToolsPanelItem"],"mappings":";;;;;;;;;;;;;AAQA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAMA;AACA;AACA,MAAMA,cAAc,GAAG,CACtBC,KADsB,EAEtBC,YAFsB,KAGlB;AACJ,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,OAFK;AAGLC,IAAAA,uBAHK;AAIL,OAAGC;AAJE,MAKF,6BAAmBL,KAAnB,CALJ;;AAOA,MAAK,CAAEG,OAAP,EAAiB;AAChB,WAAOC,uBAAuB,GAC7B,4BAAC,UAAD,6BAAWC,mBAAX;AAAiC,MAAA,GAAG,EAAGJ;AAAvC,OAD6B,GAE1B,IAFJ;AAGA;;AAED,SACC,4BAAC,UAAD,6BAAWI,mBAAX;AAAiC,IAAA,GAAG,EAAGJ;AAAvC,MACGC,QADH,CADD;AAKA,CAtBD;;AAwBA,MAAMI,uBAAuB,GAAG,6BAC/BP,cAD+B,EAE/B,gBAF+B,CAAhC;eAKeO,uB","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelItem } from './hook';\nimport { View } from '../../view';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type { ToolsPanelItemProps } from '../types';\n\n// This wraps controls to be conditionally displayed within a tools panel. It\n// prevents props being applied to HTML elements that would make them invalid.\nconst ToolsPanelItem = (\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >,\n\tforwardedRef: Ref< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\t...toolsPanelItemProps\n\t} = useToolsPanelItem( props );\n\n\tif ( ! isShown ) {\n\t\treturn shouldRenderPlaceholder ? (\n\t\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef } />\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef }>\n\t\t\t{ children }\n\t\t</View>\n\t);\n};\n\nconst ConnectedToolsPanelItem = contextConnect(\n\tToolsPanelItem,\n\t'ToolsPanelItem'\n);\n\nexport default ConnectedToolsPanelItem;\n"]}
@@ -49,7 +49,11 @@ function useToolsPanelItem(props) {
49
49
  deregisterPanelItem,
50
50
  flagItemCustomization,
51
51
  isResetting,
52
- shouldRenderPlaceholderItems: shouldRenderPlaceholder
52
+ shouldRenderPlaceholderItems: shouldRenderPlaceholder,
53
+ firstDisplayedItem,
54
+ lastDisplayedItem,
55
+ __experimentalFirstVisibleItemClass,
56
+ __experimentalLastVisibleItemClass
53
57
  } = (0, _context.useToolsPanelContext)();
54
58
  const hasValueCallback = (0, _element.useCallback)(hasValue, [panelId]);
55
59
  const resetAllFilterCallback = (0, _element.useCallback)(resetAllFilter, [panelId]);
@@ -110,8 +114,10 @@ function useToolsPanelItem(props) {
110
114
  const cx = (0, _useCx.useCx)();
111
115
  const classes = (0, _element.useMemo)(() => {
112
116
  const placeholderStyle = shouldRenderPlaceholder && !isShown && styles.ToolsPanelItemPlaceholder;
113
- return cx(styles.ToolsPanelItem, placeholderStyle, className);
114
- }, [isShown, shouldRenderPlaceholder, className]);
117
+ const firstItemStyle = firstDisplayedItem === label && __experimentalFirstVisibleItemClass;
118
+ const lastItemStyle = lastDisplayedItem === label && __experimentalLastVisibleItemClass;
119
+ return cx(styles.ToolsPanelItem, placeholderStyle, className, firstItemStyle, lastItemStyle);
120
+ }, [isShown, shouldRenderPlaceholder, className, cx, firstDisplayedItem, lastDisplayedItem, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
115
121
  return { ...otherProps,
116
122
  isShown,
117
123
  shouldRenderPlaceholder,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"names":["useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","currentPanelId","menuItems","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","hasValueCallback","resetAllFilterCallback","previousPanelId","hasMatchingPanel","isValueSet","wasValueSet","menuGroup","isMenuItemChecked","wasMenuItemChecked","isShown","undefined","cx","classes","placeholderStyle","styles","ToolsPanelItemPlaceholder","ToolsPanelItem"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAZA;AACA;AACA;;AAIA;AACA;AACA;AAOO,SAASA,iBAAT,CACNC,KADM,EAEL;AAAA;;AACD,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA,KAJK;AAKLC,IAAAA,OALK;AAMLC,IAAAA,cANK;AAOLC,IAAAA,UAPK;AAQLC,IAAAA,QARK;AASL,OAAGC;AATE,MAUF,gCAAkBT,KAAlB,EAAyB,gBAAzB,CAVJ;AAYA,QAAM;AACLK,IAAAA,OAAO,EAAEK,cADJ;AAELC,IAAAA,SAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,mBAJK;AAKLC,IAAAA,qBALK;AAMLC,IAAAA,WANK;AAOLC,IAAAA,4BAA4B,EAAEC;AAPzB,MAQF,oCARJ;AAUA,QAAMC,gBAAgB,GAAG,0BAAahB,QAAb,EAAuB,CAAEG,OAAF,CAAvB,CAAzB;AACA,QAAMc,sBAAsB,GAAG,0BAAab,cAAb,EAA6B,CAAED,OAAF,CAA7B,CAA/B;AACA,QAAMe,eAAe,GAAG,0BAAaV,cAAb,CAAxB;AAEA,QAAMW,gBAAgB,GACrBX,cAAc,KAAKL,OAAnB,I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W,IAAI,CAAEM,gBAAtB,EAAyC;AACxC;AACA;;AAED,QAAKI,iBAAiB,IAAI,CAAEH,UAAvB,IAAqC,CAAEI,kBAA5C,EAAiE;AAChElB,MAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ;AACR;;AAED,QAAK,CAAEiB,iBAAF,IAAuBC,kBAA5B,EAAiD;AAChDnB,MAAAA,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU;AACV;AACD,GAZD,EAYG,CACFc,gBADE,EAEFI,iBAFE,EAGFV,WAHE,EAIFO,UAJE,EAKFI,kBALE,CAZH,EAjFC,CAqGD;AACA;AACA;;AACA,QAAMC,OAAO,GAAGxB,gBAAgB,GAC7B,CAAAQ,SAAS,SAAT,IAAAA,SAAS,WAAT,qCAAAA,SAAS,CAAIa,SAAJ,CAAT,gFAA4BpB,KAA5B,OAAwCwB,SADX,GAE7BH,iBAFH;AAIA,QAAMI,EAAE,GAAG,mBAAX;AACA,QAAMC,OAAO,GAAG,sBAAS,MAAM;AAC9B,UAAMC,gBAAgB,GACrBd,uBAAuB,IACvB,CAAEU,OADF,IAEAK,MAAM,CAACC,yBAHR;AAIA,WAAOJ,EAAE,CAAEG,MAAM,CAACE,cAAT,EAAyBH,gBAAzB,EAA2C9B,SAA3C,CAAT;AACA,GANe,EAMb,CAAE0B,OAAF,EAAWV,uBAAX,EAAoChB,SAApC,CANa,CAAhB;AAQA,SAAO,EACN,GAAGQ,UADG;AAENkB,IAAAA,OAFM;AAGNV,IAAAA,uBAHM;AAINhB,IAAAA,SAAS,EAAE6B;AAJL,GAAP;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport { useCallback, useEffect, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t} = useToolsPanelContext();\n\n\tconst hasValueCallback = useCallback( hasValue, [ panelId ] );\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [ panelId ] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tresetAllFilter: resetAllFilterCallback,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tresetAllFilterCallback,\n\t] );\n\n\tconst isValueSet = hasValue();\n\tconst wasValueSet = usePrevious( isValueSet );\n\n\t// If this item represents a default control it will need to notify the\n\t// panel when a custom value has been set.\n\tuseEffect( () => {\n\t\tif ( isShownByDefault && isValueSet && ! wasValueSet ) {\n\t\t\tflagItemCustomization( label );\n\t\t}\n\t}, [ isValueSet, wasValueSet, isShownByDefault, label ] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\tif ( isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst placeholderStyle =\n\t\t\tshouldRenderPlaceholder &&\n\t\t\t! isShown &&\n\t\t\tstyles.ToolsPanelItemPlaceholder;\n\t\treturn cx( styles.ToolsPanelItem, placeholderStyle, className );\n\t}, [ isShown, shouldRenderPlaceholder, className ] );\n\n\treturn {\n\t\t...otherProps,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName: classes,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"names":["useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","currentPanelId","menuItems","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","firstDisplayedItem","lastDisplayedItem","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","hasValueCallback","resetAllFilterCallback","previousPanelId","hasMatchingPanel","isValueSet","wasValueSet","menuGroup","isMenuItemChecked","wasMenuItemChecked","isShown","undefined","cx","classes","placeholderStyle","styles","ToolsPanelItemPlaceholder","firstItemStyle","lastItemStyle","ToolsPanelItem"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAZA;AACA;AACA;;AAIA;AACA;AACA;AAOO,SAASA,iBAAT,CACNC,KADM,EAEL;AAAA;;AACD,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA,KAJK;AAKLC,IAAAA,OALK;AAMLC,IAAAA,cANK;AAOLC,IAAAA,UAPK;AAQLC,IAAAA,QARK;AASL,OAAGC;AATE,MAUF,gCAAkBT,KAAlB,EAAyB,gBAAzB,CAVJ;AAYA,QAAM;AACLK,IAAAA,OAAO,EAAEK,cADJ;AAELC,IAAAA,SAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,mBAJK;AAKLC,IAAAA,qBALK;AAMLC,IAAAA,WANK;AAOLC,IAAAA,4BAA4B,EAAEC,uBAPzB;AAQLC,IAAAA,kBARK;AASLC,IAAAA,iBATK;AAULC,IAAAA,mCAVK;AAWLC,IAAAA;AAXK,MAYF,oCAZJ;AAcA,QAAMC,gBAAgB,GAAG,0BAAapB,QAAb,EAAuB,CAAEG,OAAF,CAAvB,CAAzB;AACA,QAAMkB,sBAAsB,GAAG,0BAAajB,cAAb,EAA6B,CAAED,OAAF,CAA7B,CAA/B;AACA,QAAMmB,eAAe,GAAG,0BAAad,cAAb,CAAxB;AAEA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AAGNd,IAAAA,uBAHM;AAINhB,IAAAA,SAAS,EAAEiC;AAJL,GAAP;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport { useCallback, useEffect, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t} = useToolsPanelContext();\n\n\tconst hasValueCallback = useCallback( hasValue, [ panelId ] );\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [ panelId ] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tresetAllFilter: resetAllFilterCallback,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tresetAllFilterCallback,\n\t] );\n\n\tconst isValueSet = hasValue();\n\tconst wasValueSet = usePrevious( isValueSet );\n\n\t// If this item represents a default control it will need to notify the\n\t// panel when a custom value has been set.\n\tuseEffect( () => {\n\t\tif ( isShownByDefault && isValueSet && ! wasValueSet ) {\n\t\t\tflagItemCustomization( label );\n\t\t}\n\t}, [ isValueSet, wasValueSet, isShownByDefault, label ] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\tif ( isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst placeholderStyle =\n\t\t\tshouldRenderPlaceholder &&\n\t\t\t! isShown &&\n\t\t\tstyles.ToolsPanelItemPlaceholder;\n\t\tconst firstItemStyle =\n\t\t\tfirstDisplayedItem === label && __experimentalFirstVisibleItemClass;\n\t\tconst lastItemStyle =\n\t\t\tlastDisplayedItem === label && __experimentalLastVisibleItemClass;\n\t\treturn cx(\n\t\t\tstyles.ToolsPanelItem,\n\t\t\tplaceholderStyle,\n\t\t\tclassName,\n\t\t\tfirstItemStyle,\n\t\t\tlastItemStyle\n\t\t);\n\t}, [\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName,\n\t\tcx,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t] );\n\n\treturn {\n\t\t...otherProps,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName: classes,\n\t};\n}\n"]}
@@ -126,6 +126,9 @@ function TreeGrid(_ref, ref) {
126
126
  const activeRow = activeElement.closest('[role="row"]');
127
127
  const focusablesInRow = getRowFocusables(activeRow);
128
128
  const currentColumnIndex = focusablesInRow.indexOf(activeElement);
129
+ const canExpandCollapse = 0 === currentColumnIndex;
130
+
131
+ const cannotFocusNextColumn = canExpandCollapse && activeRow.getAttribute('aria-expanded') === 'false' && keyCode === _keycodes.RIGHT;
129
132
 
130
133
  if ((0, _lodash.includes)([_keycodes.LEFT, _keycodes.RIGHT], keyCode)) {
131
134
  // Calculate to the next element.
@@ -135,12 +138,12 @@ function TreeGrid(_ref, ref) {
135
138
  nextIndex = Math.max(0, currentColumnIndex - 1);
136
139
  } else {
137
140
  nextIndex = Math.min(currentColumnIndex + 1, focusablesInRow.length - 1);
138
- } // Focus is either at the left or right edge of the grid.
141
+ } // Focus is at the left most column.
139
142
 
140
143
 
141
- if (nextIndex === currentColumnIndex) {
144
+ if (canExpandCollapse) {
142
145
  if (keyCode === _keycodes.LEFT) {
143
- var _activeRow$ariaLevel, _getRowFocusables, _getRowFocusables$;
146
+ var _activeRow$getAttribu, _getRowFocusables, _getRowFocusables$;
144
147
 
145
148
  // Left:
146
149
  // If a row is focused, and it is expanded, collapses the current row.
@@ -151,13 +154,13 @@ function TreeGrid(_ref, ref) {
151
154
  } // If a row is focused, and it is collapsed, moves to the parent row (if there is one).
152
155
 
153
156
 
154
- const level = Math.max(parseInt((_activeRow$ariaLevel = activeRow === null || activeRow === void 0 ? void 0 : activeRow.ariaLevel) !== null && _activeRow$ariaLevel !== void 0 ? _activeRow$ariaLevel : 1, 10) - 1, 1);
157
+ const level = Math.max(parseInt((_activeRow$getAttribu = activeRow === null || activeRow === void 0 ? void 0 : activeRow.getAttribute('aria-level')) !== null && _activeRow$getAttribu !== void 0 ? _activeRow$getAttribu : 1, 10) - 1, 1);
155
158
  const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
156
159
  let parentRow = activeRow;
157
160
  const currentRowIndex = rows.indexOf(activeRow);
158
161
 
159
162
  for (let i = currentRowIndex; i >= 0; i--) {
160
- if (parseInt(rows[i].ariaLevel, 10) === level) {
163
+ if (parseInt(rows[i].getAttribute('aria-level'), 10) === level) {
161
164
  parentRow = rows[i];
162
165
  break;
163
166
  }
@@ -190,8 +193,12 @@ function TreeGrid(_ref, ref) {
190
193
 
191
194
  event.preventDefault();
192
195
  return;
193
- } // Focus the next element.
196
+ } // Focus the next element. If at most left column and row is collapsed, moving right is not allowed as this will expand. However, if row is collapsed, moving left is allowed.
197
+
194
198
 
199
+ if (cannotFocusNextColumn) {
200
+ return;
201
+ }
195
202
 
196
203
  focusablesInRow[nextIndex].focus(); // Prevent key use for anything else. This ensures Voiceover
197
204
  // doesn't try to handle key navigation.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/index.js"],"names":["getRowFocusables","rowElement","focusablesInRow","focus","focusable","find","sequential","length","filter","closest","TreeGrid","ref","children","onExpandRow","onCollapseRow","props","onKeyDown","event","keyCode","metaKey","ctrlKey","altKey","shiftKey","hasModifierKeyPressed","UP","DOWN","LEFT","RIGHT","stopPropagation","activeElement","document","currentTarget","treeGridElement","contains","activeRow","currentColumnIndex","indexOf","nextIndex","Math","max","min","getAttribute","preventDefault","level","parseInt","ariaLevel","rows","Array","from","querySelectorAll","parentRow","currentRowIndex","i","focusableItems","nextRowIndex","focusablesInNextRow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AAKA;;AAuNA;;AACA;;AACA;;AAxOA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAT,CAA2BC,UAA3B,EAAwC;AACvC,QAAMC,eAAe,GAAGC,WAAMC,SAAN,CAAgBC,IAAhB,CAAsBJ,UAAtB,EAAkC;AACzDK,IAAAA,UAAU,EAAE;AAD6C,GAAlC,CAAxB;;AAIA,MAAK,CAAEJ,eAAF,IAAqB,CAAEA,eAAe,CAACK,MAA5C,EAAqD;AACpD;AACA;;AAED,SAAOL,eAAe,CAACM,MAAhB,CAA0BJ,SAAF,IAAiB;AAC/C,WAAOA,SAAS,CAACK,OAAV,CAAmB,cAAnB,MAAwCR,UAA/C;AACA,GAFM,CAAP;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASS,QAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,WAAW,GAAG,MAAM,CAAE,CAAlC;AAAoCC,IAAAA,aAAa,GAAG,MAAM,CAAE,CAA5D;AAA8D,OAAGC;AAAjE,GAEC;AACD,QAAMC,SAAS,GAAG,0BACfC,KAAF,IAAa;AACZ,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA,OAAX;AAAoBC,MAAAA,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AtC8C,CAwC/C;;;AACA,YAAML,SAAS,GAAGC,IAAI,CAACE,GAAL,CACjBL,kBADiB,EAEjBoB,mBAAmB,CAAChD,MAApB,GAA6B,CAFZ,CAAlB;AAIAgD,MAAAA,mBAAmB,CAAElB,SAAF,CAAnB,CAAiClC,KAAjC,GA7C+C,CA+C/C;AACA;;AACAc,MAAAA,KAAK,CAACyB,cAAN;AACA;AACD,GA3JgB,EA4JjB,CAAE7B,WAAF,EAAeC,aAAf,CA5JiB,CAAlB;AA+JA;;AACA;;AACA,SACC,4BAAC,uBAAD,QACC,gEACMC,KADN;AAEC,IAAA,IAAI,EAAC,UAFN;AAGC,IAAA,SAAS,EAAGC,SAHb;AAIC,IAAA,GAAG,EAAGL;AAJP,MAMC,2CAASC,QAAT,CAND,CADD,CADD;AAYA;AACA;;eAEc,yBAAYF,QAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport { includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { forwardRef, useCallback } from '@wordpress/element';\nimport { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport RovingTabIndexContainer from './roving-tab-index';\n\n/**\n * Return focusables in a row element, excluding those from other branches\n * nested within the row.\n *\n * @param {Element} rowElement The DOM element representing the row.\n *\n * @return {?Array} The array of focusables in the row.\n */\nfunction getRowFocusables( rowElement ) {\n\tconst focusablesInRow = focus.focusable.find( rowElement, {\n\t\tsequential: true,\n\t} );\n\n\tif ( ! focusablesInRow || ! focusablesInRow.length ) {\n\t\treturn;\n\t}\n\n\treturn focusablesInRow.filter( ( focusable ) => {\n\t\treturn focusable.closest( '[role=\"row\"]' ) === rowElement;\n\t} );\n}\n\n/**\n * Renders both a table and tbody element, used to create a tree hierarchy.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md\n * @param {Object} props Component props.\n * @param {WPElement} props.children Children to be rendered.\n * @param {Function} props.onExpandRow Callback to fire when row is expanded.\n * @param {Function} props.onCollapseRow Callback to fire when row is collapsed.\n * @param {Object} ref A ref to the underlying DOM table element.\n */\nfunction TreeGrid(\n\t{ children, onExpandRow = () => {}, onCollapseRow = () => {}, ...props },\n\tref\n) {\n\tconst onKeyDown = useCallback(\n\t\t( event ) => {\n\t\t\tconst { keyCode, metaKey, ctrlKey, altKey, shiftKey } = event;\n\n\t\t\tconst hasModifierKeyPressed =\n\t\t\t\tmetaKey || ctrlKey || altKey || shiftKey;\n\n\t\t\tif (\n\t\t\t\thasModifierKeyPressed ||\n\t\t\t\t! includes( [ UP, DOWN, LEFT, RIGHT ], keyCode )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The event will be handled, stop propagation.\n\t\t\tevent.stopPropagation();\n\n\t\t\tconst { activeElement } = document;\n\t\t\tconst { currentTarget: treeGridElement } = event;\n\t\t\tif ( ! treeGridElement.contains( activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Calculate the columnIndex of the active element.\n\t\t\tconst activeRow = activeElement.closest( '[role=\"row\"]' );\n\t\t\tconst focusablesInRow = getRowFocusables( activeRow );\n\t\t\tconst currentColumnIndex = focusablesInRow.indexOf( activeElement );\n\n\t\t\tif ( includes( [ LEFT, RIGHT ], keyCode ) ) {\n\t\t\t\t// Calculate to the next element.\n\t\t\t\tlet nextIndex;\n\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\tnextIndex = Math.max( 0, currentColumnIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextIndex = Math.min(\n\t\t\t\t\t\tcurrentColumnIndex + 1,\n\t\t\t\t\t\tfocusablesInRow.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is either at the left or right edge of the grid.\n\t\t\t\tif ( nextIndex === currentColumnIndex ) {\n\t\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\t\t// Left:\n\t\t\t\t\t\t// If a row is focused, and it is expanded, collapses the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'true'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonCollapseRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, moves to the parent row (if there is one).\n\t\t\t\t\t\tconst level = Math.max(\n\t\t\t\t\t\t\tparseInt( activeRow?.ariaLevel ?? 1, 10 ) - 1,\n\t\t\t\t\t\t\t1\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst rows = Array.from(\n\t\t\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlet parentRow = activeRow;\n\t\t\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\t\t\tfor ( let i = currentRowIndex; i >= 0; i-- ) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tparseInt( rows[ i ].ariaLevel, 10 ) === level\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tparentRow = rows[ i ];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgetRowFocusables( parentRow )?.[ 0 ]?.focus();\n\t\t\t\t\t}\n\t\t\t\t\tif ( keyCode === RIGHT ) {\n\t\t\t\t\t\t// Right:\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, expands the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) ===\n\t\t\t\t\t\t\t'false'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonExpandRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is expanded, focuses the rightmost cell in the row.\n\t\t\t\t\t\tconst focusableItems = getRowFocusables( activeRow );\n\t\t\t\t\t\tif ( focusableItems.length > 0 ) {\n\t\t\t\t\t\t\tfocusableItems[\n\t\t\t\t\t\t\t\tfocusableItems.length - 1\n\t\t\t\t\t\t\t]?.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start reading text on continued use of left/right arrow\n\t\t\t\t\t// keys.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Focus the next element.\n\t\t\t\tfocusablesInRow[ nextIndex ].focus();\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t} else if ( includes( [ UP, DOWN ], keyCode ) ) {\n\t\t\t\t// Calculate the rowIndex of the next row.\n\t\t\t\tconst rows = Array.from(\n\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t);\n\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\tlet nextRowIndex;\n\n\t\t\t\tif ( keyCode === UP ) {\n\t\t\t\t\tnextRowIndex = Math.max( 0, currentRowIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextRowIndex = Math.min(\n\t\t\t\t\t\tcurrentRowIndex + 1,\n\t\t\t\t\t\trows.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is either at the top or bottom edge of the grid. Do nothing.\n\t\t\t\tif ( nextRowIndex === currentRowIndex ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start navigating horizontally when reaching the vertical\n\t\t\t\t\t// bounds of a table.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Get the focusables in the next row.\n\t\t\t\tconst focusablesInNextRow = getRowFocusables(\n\t\t\t\t\trows[ nextRowIndex ]\n\t\t\t\t);\n\n\t\t\t\t// If for some reason there are no focusables in the next row, do nothing.\n\t\t\t\tif ( ! focusablesInNextRow || ! focusablesInNextRow.length ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will still focus text when using arrow keys, while this\n\t\t\t\t\t// component should limit navigation to focusables.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Try to focus the element in the next row that's at a similar column to the activeElement.\n\t\t\t\tconst nextIndex = Math.min(\n\t\t\t\t\tcurrentColumnIndex,\n\t\t\t\t\tfocusablesInNextRow.length - 1\n\t\t\t\t);\n\t\t\t\tfocusablesInNextRow[ nextIndex ].focus();\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ onExpandRow, onCollapseRow ]\n\t);\n\n\t/* Disable reason: A treegrid is implemented using a table element. */\n\t/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<RovingTabIndexContainer>\n\t\t\t<table\n\t\t\t\t{ ...props }\n\t\t\t\trole=\"treegrid\"\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tref={ ref }\n\t\t\t>\n\t\t\t\t<tbody>{ children }</tbody>\n\t\t\t</table>\n\t\t</RovingTabIndexContainer>\n\t);\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\nexport default forwardRef( TreeGrid );\nexport { default as TreeGridRow } from './row';\nexport { default as TreeGridCell } from './cell';\nexport { default as TreeGridItem } from './item';\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/index.js"],"names":["getRowFocusables","rowElement","focusablesInRow","focus","focusable","find","sequential","length","filter","closest","TreeGrid","ref","children","onExpandRow","onCollapseRow","props","onKeyDown","event","keyCode","metaKey","ctrlKey","altKey","shiftKey","hasModifierKeyPressed","UP","DOWN","LEFT","RIGHT","stopPropagation","activeElement","document","currentTarget","treeGridElement","contains","activeRow","currentColumnIndex","indexOf","canExpandCollapse","cannotFocusNextColumn","getAttribute","nextIndex","Math","max","min","preventDefault","level","parseInt","rows","Array","from","querySelectorAll","parentRow","currentRowIndex","i","focusableItems","nextRowIndex","focusablesInNextRow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AAKA;;AAqOA;;AACA;;AACA;;AAtPA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAT,CAA2BC,UAA3B,EAAwC;AACvC,QAAMC,eAAe,GAAGC,WAAMC,SAAN,CAAgBC,IAAhB,CAAsBJ,UAAtB,EAAkC;AACzDK,IAAAA,UAAU,EAAE;AAD6C,GAAlC,CAAxB;;AAIA,MAAK,CAAEJ,eAAF,IAAqB,CAAEA,eAAe,CAACK,MAA5C,EAAqD;AACpD;AACA;;AAED,SAAOL,eAAe,CAACM,MAAhB,CAA0BJ,SAAF,IAAiB;AAC/C,WAAOA,SAAS,CAACK,OAAV,CAAmB,cAAnB,MAAwCR,UAA/C;AACA,GAFM,CAAP;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASS,QAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,WAAW,GAAG,MAAM,CAAE,CAAlC;AAAoCC,IAAAA,aAAa,GAAG,MAAM,CAAE,CAA5D;AAA8D,OAAGC;AAAjE,GAEC;AACD,QAAMC,SAAS,GAAG,0BACfC,KAAF,IAAa;AACZ,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA,OAAX;AAAoBC,MAAAA,OAApB;AAA6BC,MAAAA,MAA7B;AAAqCC,M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AEQ,YAAF,CADuC,CAA5C,CA3B+C,CA+B/C;;AACA,UAAK,CAAEC,mBAAF,IAAyB,CAAEA,mBAAmB,CAACjD,MAApD,EAA6D;AAC5D;AACA;AACA;AACAU,QAAAA,KAAK,CAAC2B,cAAN;AACA;AACA,OAtC8C,CAwC/C;;;AACA,YAAMJ,SAAS,GAAGC,IAAI,CAACE,GAAL,CACjBR,kBADiB,EAEjBqB,mBAAmB,CAACjD,MAApB,GAA6B,CAFZ,CAAlB;AAIAiD,MAAAA,mBAAmB,CAAEhB,SAAF,CAAnB,CAAiCrC,KAAjC,GA7C+C,CA+C/C;AACA;;AACAc,MAAAA,KAAK,CAAC2B,cAAN;AACA;AACD,GAzKgB,EA0KjB,CAAE/B,WAAF,EAAeC,aAAf,CA1KiB,CAAlB;AA6KA;;AACA;;AACA,SACC,4BAAC,uBAAD,QACC,gEACMC,KADN;AAEC,IAAA,IAAI,EAAC,UAFN;AAGC,IAAA,SAAS,EAAGC,SAHb;AAIC,IAAA,GAAG,EAAGL;AAJP,MAMC,2CAASC,QAAT,CAND,CADD,CADD;AAYA;AACA;;eAEc,yBAAYF,QAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport { includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { forwardRef, useCallback } from '@wordpress/element';\nimport { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport RovingTabIndexContainer from './roving-tab-index';\n\n/**\n * Return focusables in a row element, excluding those from other branches\n * nested within the row.\n *\n * @param {Element} rowElement The DOM element representing the row.\n *\n * @return {?Array} The array of focusables in the row.\n */\nfunction getRowFocusables( rowElement ) {\n\tconst focusablesInRow = focus.focusable.find( rowElement, {\n\t\tsequential: true,\n\t} );\n\n\tif ( ! focusablesInRow || ! focusablesInRow.length ) {\n\t\treturn;\n\t}\n\n\treturn focusablesInRow.filter( ( focusable ) => {\n\t\treturn focusable.closest( '[role=\"row\"]' ) === rowElement;\n\t} );\n}\n\n/**\n * Renders both a table and tbody element, used to create a tree hierarchy.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md\n * @param {Object} props Component props.\n * @param {WPElement} props.children Children to be rendered.\n * @param {Function} props.onExpandRow Callback to fire when row is expanded.\n * @param {Function} props.onCollapseRow Callback to fire when row is collapsed.\n * @param {Object} ref A ref to the underlying DOM table element.\n */\nfunction TreeGrid(\n\t{ children, onExpandRow = () => {}, onCollapseRow = () => {}, ...props },\n\tref\n) {\n\tconst onKeyDown = useCallback(\n\t\t( event ) => {\n\t\t\tconst { keyCode, metaKey, ctrlKey, altKey, shiftKey } = event;\n\n\t\t\tconst hasModifierKeyPressed =\n\t\t\t\tmetaKey || ctrlKey || altKey || shiftKey;\n\n\t\t\tif (\n\t\t\t\thasModifierKeyPressed ||\n\t\t\t\t! includes( [ UP, DOWN, LEFT, RIGHT ], keyCode )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The event will be handled, stop propagation.\n\t\t\tevent.stopPropagation();\n\n\t\t\tconst { activeElement } = document;\n\t\t\tconst { currentTarget: treeGridElement } = event;\n\t\t\tif ( ! treeGridElement.contains( activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Calculate the columnIndex of the active element.\n\t\t\tconst activeRow = activeElement.closest( '[role=\"row\"]' );\n\t\t\tconst focusablesInRow = getRowFocusables( activeRow );\n\t\t\tconst currentColumnIndex = focusablesInRow.indexOf( activeElement );\n\t\t\tconst canExpandCollapse = 0 === currentColumnIndex;\n\t\t\tconst cannotFocusNextColumn =\n\t\t\t\tcanExpandCollapse &&\n\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'false' &&\n\t\t\t\tkeyCode === RIGHT;\n\n\t\t\tif ( includes( [ LEFT, RIGHT ], keyCode ) ) {\n\t\t\t\t// Calculate to the next element.\n\t\t\t\tlet nextIndex;\n\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\tnextIndex = Math.max( 0, currentColumnIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextIndex = Math.min(\n\t\t\t\t\t\tcurrentColumnIndex + 1,\n\t\t\t\t\t\tfocusablesInRow.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is at the left most column.\n\t\t\t\tif ( canExpandCollapse ) {\n\t\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\t\t// Left:\n\t\t\t\t\t\t// If a row is focused, and it is expanded, collapses the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'true'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonCollapseRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, moves to the parent row (if there is one).\n\t\t\t\t\t\tconst level = Math.max(\n\t\t\t\t\t\t\tparseInt(\n\t\t\t\t\t\t\t\tactiveRow?.getAttribute( 'aria-level' ) ?? 1,\n\t\t\t\t\t\t\t\t10\n\t\t\t\t\t\t\t) - 1,\n\t\t\t\t\t\t\t1\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst rows = Array.from(\n\t\t\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlet parentRow = activeRow;\n\t\t\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\t\t\tfor ( let i = currentRowIndex; i >= 0; i-- ) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tparseInt(\n\t\t\t\t\t\t\t\t\trows[ i ].getAttribute( 'aria-level' ),\n\t\t\t\t\t\t\t\t\t10\n\t\t\t\t\t\t\t\t) === level\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tparentRow = rows[ i ];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgetRowFocusables( parentRow )?.[ 0 ]?.focus();\n\t\t\t\t\t}\n\t\t\t\t\tif ( keyCode === RIGHT ) {\n\t\t\t\t\t\t// Right:\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, expands the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) ===\n\t\t\t\t\t\t\t'false'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonExpandRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is expanded, focuses the rightmost cell in the row.\n\t\t\t\t\t\tconst focusableItems = getRowFocusables( activeRow );\n\t\t\t\t\t\tif ( focusableItems.length > 0 ) {\n\t\t\t\t\t\t\tfocusableItems[\n\t\t\t\t\t\t\t\tfocusableItems.length - 1\n\t\t\t\t\t\t\t]?.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start reading text on continued use of left/right arrow\n\t\t\t\t\t// keys.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Focus the next element. If at most left column and row is collapsed, moving right is not allowed as this will expand. However, if row is collapsed, moving left is allowed.\n\t\t\t\tif ( cannotFocusNextColumn ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfocusablesInRow[ nextIndex ].focus();\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t} else if ( includes( [ UP, DOWN ], keyCode ) ) {\n\t\t\t\t// Calculate the rowIndex of the next row.\n\t\t\t\tconst rows = Array.from(\n\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t);\n\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\tlet nextRowIndex;\n\n\t\t\t\tif ( keyCode === UP ) {\n\t\t\t\t\tnextRowIndex = Math.max( 0, currentRowIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextRowIndex = Math.min(\n\t\t\t\t\t\tcurrentRowIndex + 1,\n\t\t\t\t\t\trows.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is either at the top or bottom edge of the grid. Do nothing.\n\t\t\t\tif ( nextRowIndex === currentRowIndex ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start navigating horizontally when reaching the vertical\n\t\t\t\t\t// bounds of a table.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Get the focusables in the next row.\n\t\t\t\tconst focusablesInNextRow = getRowFocusables(\n\t\t\t\t\trows[ nextRowIndex ]\n\t\t\t\t);\n\n\t\t\t\t// If for some reason there are no focusables in the next row, do nothing.\n\t\t\t\tif ( ! focusablesInNextRow || ! focusablesInNextRow.length ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will still focus text when using arrow keys, while this\n\t\t\t\t\t// component should limit navigation to focusables.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Try to focus the element in the next row that's at a similar column to the activeElement.\n\t\t\t\tconst nextIndex = Math.min(\n\t\t\t\t\tcurrentColumnIndex,\n\t\t\t\t\tfocusablesInNextRow.length - 1\n\t\t\t\t);\n\t\t\t\tfocusablesInNextRow[ nextIndex ].focus();\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ onExpandRow, onCollapseRow ]\n\t);\n\n\t/* Disable reason: A treegrid is implemented using a table element. */\n\t/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<RovingTabIndexContainer>\n\t\t\t<table\n\t\t\t\t{ ...props }\n\t\t\t\trole=\"treegrid\"\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tref={ ref }\n\t\t\t>\n\t\t\t\t<tbody>{ children }</tbody>\n\t\t\t</table>\n\t\t</RovingTabIndexContainer>\n\t);\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\nexport default forwardRef( TreeGrid );\nexport { default as TreeGridRow } from './row';\nexport { default as TreeGridCell } from './cell';\nexport { default as TreeGridItem } from './item';\n"]}
@@ -58,9 +58,9 @@ function useTruncate(props) {
58
58
  const shouldTruncate = ellipsizeMode === _utils.TRUNCATE_TYPE.auto;
59
59
  const classes = (0, _element.useMemo)(() => {
60
60
  const sx = {};
61
- sx.numberOfLines = /*#__PURE__*/(0, _react.css)("-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + (process.env.NODE_ENV === "production" ? "" : ";label:sx-numberOfLines;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpRHdCIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4g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3RyaW5nfSAqLyAoIGNoaWxkcmVuICkgOiAnJyxcblx0XHR7XG5cdFx0XHRlbGxpcHNpcyxcblx0XHRcdGVsbGlwc2l6ZU1vZGUsXG5cdFx0XHRsaW1pdCxcblx0XHRcdG51bWJlck9mTGluZXMsXG5cdFx0fVxuXHQpO1xuXG5cdGNvbnN0IHNob3VsZFRydW5jYXRlID0gZWxsaXBzaXplTW9kZSA9PT0gVFJVTkNBVEVfVFlQRS5hdXRvO1xuXG5cdGNvbnN0IGNsYXNzZXMgPSB1c2VNZW1vKCAoKSA9PiB7XG5cdFx0Y29uc3Qgc3ggPSB7fTtcblxuXHRcdHN4Lm51bWJlck9mTGluZXMgPSBjc3NgXG5cdFx0XHQtd2Via2l0LWJveC1vcmllbnQ6IHZlcnRpY2FsO1xuXHRcdFx0LXdlYmtpdC1saW5lLWNsYW1wOiAkeyBudW1iZXJPZkxpbmVzIH07XG5cdFx0XHRkaXNwbGF5OiAtd2Via2l0LWJveDtcblx0XHRcdG92ZXJmbG93OiBoaWRkZW47XG5cdFx0YDtcblxuXHRcdHJldHVybiBjeChcblx0XHRcdHNob3VsZFRydW5jYXRlICYmICEgbnVtYmVyT2ZMaW5lcyAmJiBzdHlsZXMuVHJ1bmNhdGUsXG5cdFx0XHRzaG91bGRUcnVuY2F0ZSAmJiAhISBudW1iZXJPZkxpbmVzICYmIHN4Lm51bWJlck9mTGluZXMsXG5cdFx0XHRjbGFzc05hbWVcblx0XHQpO1xuXHR9LCBbIGNsYXNzTmFtZSwgbnVtYmVyT2ZMaW5lcywgc2hvdWxkVHJ1bmNhdGUgXSApO1xuXG5cdHJldHVybiB7IC4uLm90aGVyUHJvcHMsIGNsYXNzTmFtZTogY2xhc3NlcywgY2hpbGRyZW46IHRydW5jYXRlZENvbnRlbnQgfTtcbn1cbiJdfQ== */");
61
+ sx.numberOfLines = /*#__PURE__*/(0, _react.css)("-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + (process.env.NODE_ENV === "production" ? "" : ";label:sx-numberOfLines;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpRHdCIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IHVzZU1lbW8gfSBmcm9tICdAd29yZHByZXNzL2VsZW1lbnQnO1xuXG4vKipcbiAqIEludGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyB1c2VDb250ZXh0U3lzdGVtIH0gZnJvbSAnLi4vdWkvY29udGV4dCc7XG5pbXBvcnQgKiBhcyBzdHlsZXMgZnJvbSAnLi9zdHlsZXMnO1xuaW1wb3J0IHsgVFJVTkNBVEVfRUxMSVBTSVMsIFRSVU5DQVRFX1RZUEUsIHRydW5jYXRlQ29udGVudCB9IGZyb20gJy4vdXRpbHMnO1xuaW1wb3J0IHsgdXNlQ3ggfSBmcm9tICcuLi91dGlscy9ob29rcy91c2UtY3gnO1xuXG4vKipcbiAqIEBwYXJhbSB7aW1wb3J0KCcuLi91aS9jb250ZXh0JykuV29yZFByZXNzQ29tcG9uZW50UHJvcHM8aW1wb3J0KCcuL3R5cGVzJykuUHJvcHMsICdzcGFuJz59IHByb3BzXG4gKi9cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIHVzZVRydW5jYXRlKCBwc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dHNob3VsZFRydW5jYXRlICYmICEgbnVtYmVyT2ZMaW5lcyAmJiBzdHlsZXMuVHJ1bmNhdGUsXG5cdFx0XHRzaG91bGRUcnVuY2F0ZSAmJiAhISBudW1iZXJPZkxpbmVzICYmIHN4Lm51bWJlck9mTGluZXMsXG5cdFx0XHRjbGFzc05hbWVcblx0XHQpO1xuXHR9LCBbIGNsYXNzTmFtZSwgY3gsIG51bWJlck9mTGluZXMsIHNob3VsZFRydW5jYXRlIF0gKTtcblxuXHRyZXR1cm4geyAuLi5vdGhlclByb3BzLCBjbGFzc05hbWU6IGNsYXNzZXMsIGNoaWxkcmVuOiB0cnVuY2F0ZWRDb250ZW50IH07XG59XG4iXX0= */");
62
62
  return cx(shouldTruncate && !numberOfLines && styles.Truncate, shouldTruncate && !!numberOfLines && sx.numberOfLines, className);
63
- }, [className, numberOfLines, shouldTruncate]);
63
+ }, [className, cx, numberOfLines, shouldTruncate]);
64
64
  return { ...otherProps,
65
65
  className: classes,
66
66
  children: truncatedContent
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/truncate/hook.js"],"names":["useTruncate","props","className","children","ellipsis","TRUNCATE_ELLIPSIS","ellipsizeMode","TRUNCATE_TYPE","auto","limit","numberOfLines","otherProps","cx","truncatedContent","shouldTruncate","classes","sx","css","styles","Truncate"],"mappings":";;;;;;;AAGA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACe,SAASA,WAAT,CAAsBC,KAAtB,EAA8B;AAC5C,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,QAAQ,GAAGC,wBAHN;AAILC,IAAAA,aAAa,GAAGC,qBAAcC,IAJzB;AAKLC,IAAAA,KAAK,GAAG,CALH;AAMLC,IAAAA,aAAa,GAAG,CANX;AAOL,OAAGC;AAPE,MAQF,+BAAkBV,KAAlB,EAAyB,UAAzB,CARJ;AAUA,QAAMW,EAAE,GAAG,mBAAX;AAEA,QAAMC,gBAAgB,GAAG,4BACxB,OAAOV,QAAP,KAAoB,QAApB;AAA+B;AAAwBA,EAAAA,QAAvD,GAAoE,EAD5C,EAExB;AACCC,IAAAA,QADD;AAECE,IAAAA,aAFD;AAGCG,IAAAA,KAHD;AAICC,IAAAA;AAJD,GAFwB,CAAzB;AAUA,QAAMI,cAAc,GAAGR,aAAa,KAAKC,qBAAcC,IAAvD;AAEA,QAAMO,OAAO,GAAG,sBAAS,MAAM;AAC9B,UAAMC,EAAE,GAAG,EAAX;AAEAA,IAAAA,EAAE,CAACN,aAAH,oBAAmBO,UAAnB,qDAEwBP,aAFxB;AAOA,WAAOE,EAAE,CACRE,cAAc,IAAI,CAAEJ,aAApB,IAAqCQ,MAAM,CAACC,QADpC,EAERL,cAAc,IAAI,CAAC,CAAEJ,aAArB,IAAsCM,EAAE,CAACN,aAFjC,EAGRR,SAHQ,CAAT;AAKA,GAfe,EAeb,CAAEA,SAAF,EAAaQ,aAAb,EAA4BI,cAA5B,CAfa,CAAhB;AAiBA,SAAO,EAAE,GAAGH,UAAL;AAAiBT,IAAAA,SAAS,EAAEa,OAA5B;AAAqCZ,IAAAA,QAAQ,EAAEU;AAA/C,GAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useContextSystem } from '../ui/context';\nimport * as styles from './styles';\nimport { TRUNCATE_ELLIPSIS, TRUNCATE_TYPE, truncateContent } from './utils';\nimport { useCx } from '../utils/hooks/use-cx';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props\n */\nexport default function useTruncate( props ) {\n\tconst {\n\t\tclassName,\n\t\tchildren,\n\t\tellipsis = TRUNCATE_ELLIPSIS,\n\t\tellipsizeMode = TRUNCATE_TYPE.auto,\n\t\tlimit = 0,\n\t\tnumberOfLines = 0,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Truncate' );\n\n\tconst cx = useCx();\n\n\tconst truncatedContent = truncateContent(\n\t\ttypeof children === 'string' ? /** @type {string} */ ( children ) : '',\n\t\t{\n\t\t\tellipsis,\n\t\t\tellipsizeMode,\n\t\t\tlimit,\n\t\t\tnumberOfLines,\n\t\t}\n\t);\n\n\tconst shouldTruncate = ellipsizeMode === TRUNCATE_TYPE.auto;\n\n\tconst classes = useMemo( () => {\n\t\tconst sx = {};\n\n\t\tsx.numberOfLines = css`\n\t\t\t-webkit-box-orient: vertical;\n\t\t\t-webkit-line-clamp: ${ numberOfLines };\n\t\t\tdisplay: -webkit-box;\n\t\t\toverflow: hidden;\n\t\t`;\n\n\t\treturn cx(\n\t\t\tshouldTruncate && ! numberOfLines && styles.Truncate,\n\t\t\tshouldTruncate && !! numberOfLines && sx.numberOfLines,\n\t\t\tclassName\n\t\t);\n\t}, [ className, numberOfLines, shouldTruncate ] );\n\n\treturn { ...otherProps, className: classes, children: truncatedContent };\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/truncate/hook.js"],"names":["useTruncate","props","className","children","ellipsis","TRUNCATE_ELLIPSIS","ellipsizeMode","TRUNCATE_TYPE","auto","limit","numberOfLines","otherProps","cx","truncatedContent","shouldTruncate","classes","sx","css","styles","Truncate"],"mappings":";;;;;;;AAGA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACe,SAASA,WAAT,CAAsBC,KAAtB,EAA8B;AAC5C,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,QAAQ,GAAGC,wBAHN;AAILC,IAAAA,aAAa,GAAGC,qBAAcC,IAJzB;AAKLC,IAAAA,KAAK,GAAG,CALH;AAMLC,IAAAA,aAAa,GAAG,CANX;AAOL,OAAGC;AAPE,MAQF,+BAAkBV,KAAlB,EAAyB,UAAzB,CARJ;AAUA,QAAMW,EAAE,GAAG,mBAAX;AAEA,QAAMC,gBAAgB,GAAG,4BACxB,OAAOV,QAAP,KAAoB,QAApB;AAA+B;AAAwBA,EAAAA,QAAvD,GAAoE,EAD5C,EAExB;AACCC,IAAAA,QADD;AAECE,IAAAA,aAFD;AAGCG,IAAAA,KAHD;AAICC,IAAAA;AAJD,GAFwB,CAAzB;AAUA,QAAMI,cAAc,GAAGR,aAAa,KAAKC,qBAAcC,IAAvD;AAEA,QAAMO,OAAO,GAAG,sBAAS,MAAM;AAC9B,UAAMC,EAAE,GAAG,EAAX;AAEAA,IAAAA,EAAE,CAACN,aAAH,oBAAmBO,UAAnB,qDAEwBP,aAFxB;AAOA,WAAOE,EAAE,CACRE,cAAc,IAAI,CAAEJ,aAApB,IAAqCQ,MAAM,CAACC,QADpC,EAERL,cAAc,IAAI,CAAC,CAAEJ,aAArB,IAAsCM,EAAE,CAACN,aAFjC,EAGRR,SAHQ,CAAT;AAKA,GAfe,EAeb,CAAEA,SAAF,EAAaU,EAAb,EAAiBF,aAAjB,EAAgCI,cAAhC,CAfa,CAAhB;AAiBA,SAAO,EAAE,GAAGH,UAAL;AAAiBT,IAAAA,SAAS,EAAEa,OAA5B;AAAqCZ,IAAAA,QAAQ,EAAEU;AAA/C,GAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useContextSystem } from '../ui/context';\nimport * as styles from './styles';\nimport { TRUNCATE_ELLIPSIS, TRUNCATE_TYPE, truncateContent } from './utils';\nimport { useCx } from '../utils/hooks/use-cx';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props\n */\nexport default function useTruncate( props ) {\n\tconst {\n\t\tclassName,\n\t\tchildren,\n\t\tellipsis = TRUNCATE_ELLIPSIS,\n\t\tellipsizeMode = TRUNCATE_TYPE.auto,\n\t\tlimit = 0,\n\t\tnumberOfLines = 0,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Truncate' );\n\n\tconst cx = useCx();\n\n\tconst truncatedContent = truncateContent(\n\t\ttypeof children === 'string' ? /** @type {string} */ ( children ) : '',\n\t\t{\n\t\t\tellipsis,\n\t\t\tellipsizeMode,\n\t\t\tlimit,\n\t\t\tnumberOfLines,\n\t\t}\n\t);\n\n\tconst shouldTruncate = ellipsizeMode === TRUNCATE_TYPE.auto;\n\n\tconst classes = useMemo( () => {\n\t\tconst sx = {};\n\n\t\tsx.numberOfLines = css`\n\t\t\t-webkit-box-orient: vertical;\n\t\t\t-webkit-line-clamp: ${ numberOfLines };\n\t\t\tdisplay: -webkit-box;\n\t\t\toverflow: hidden;\n\t\t`;\n\n\t\treturn cx(\n\t\t\tshouldTruncate && ! numberOfLines && styles.Truncate,\n\t\t\tshouldTruncate && !! numberOfLines && sx.numberOfLines,\n\t\t\tclassName\n\t\t);\n\t}, [ className, cx, numberOfLines, shouldTruncate ] );\n\n\treturn { ...otherProps, className: classes, children: truncatedContent };\n}\n"]}
@@ -18,7 +18,6 @@ var _view = require("../../view");
18
18
  /**
19
19
  * External dependencies
20
20
  */
21
- // eslint-disable-next-line no-restricted-imports
22
21
 
23
22
  /**
24
23
  * Internal dependencies
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/shortcut/component.tsx"],"names":["Shortcut","props","forwardedRef","as","asProp","shortcut","className","otherProps","displayText","ariaLabel","display","ConnectedShortcut"],"mappings":";;;;;;;;;;;;;AASA;;AAKA;;AAdA;AACA;AACA;AACA;;AAGA;AACA;AACA;AAkBA,SAASA,QAAT,CACCC,KADD,EAECC,YAFD,EAGsB;AACrB,QAAM;AACLC,IAAAA,EAAE,EAAEC,MAAM,GAAG,MADR;AAELC,IAAAA,QAFK;AAGLC,IAAAA,SAHK;AAIL,OAAGC;AAJE,MAKF,+BAAkBN,KAAlB,EAAyB,UAAzB,CALJ;;AAMA,MAAK,CAAEI,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,MAAIG,WAAJ;AACA,MAAIC,SAAJ;;AAEA,MAAK,OAAOJ,QAAP,KAAoB,QAAzB,EAAoC;AACnCG,IAAAA,WAAW,GAAGH,QAAd;AACA,GAFD,MAEO;AACNG,IAAAA,WAAW,GAAGH,QAAQ,CAACK,OAAvB;AACAD,IAAAA,SAAS,GAAGJ,QAAQ,CAACI,SAArB;AACA;;AAED,SACC,4BAAC,UAAD;AACC,IAAA,EAAE,EAAGL,MADN;AAEC,IAAA,SAAS,EAAGE,SAFb;AAGC,kBAAaG,SAHd;AAIC,IAAA,GAAG,EAAGP;AAJP,KAKMK,UALN,GAOGC,WAPH,CADD;AAWA;;AAED,MAAMG,iBAAiB,GAAG,6BAAgBX,QAAhB,EAA0B,UAA1B,CAA1B;eAEeW,iB","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport type { Ref } from 'react';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tWordPressComponentProps,\n} from '../context';\nimport { View } from '../../view';\n\nexport interface ShortcutDescription {\n\tdisplay: string;\n\tariaLabel: string;\n}\n\nexport interface Props {\n\tshortcut?: ShortcutDescription | string;\n\tclassName?: string;\n}\n\nfunction Shortcut(\n\tprops: WordPressComponentProps< Props, 'span' >,\n\tforwardedRef: Ref< any >\n): JSX.Element | null {\n\tconst {\n\t\tas: asProp = 'span',\n\t\tshortcut,\n\t\tclassName,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Shortcut' );\n\tif ( ! shortcut ) {\n\t\treturn null;\n\t}\n\n\tlet displayText: string;\n\tlet ariaLabel: string | undefined;\n\n\tif ( typeof shortcut === 'string' ) {\n\t\tdisplayText = shortcut;\n\t} else {\n\t\tdisplayText = shortcut.display;\n\t\tariaLabel = shortcut.ariaLabel;\n\t}\n\n\treturn (\n\t\t<View\n\t\t\tas={ asProp }\n\t\t\tclassName={ className }\n\t\t\taria-label={ ariaLabel }\n\t\t\tref={ forwardedRef }\n\t\t\t{ ...otherProps }\n\t\t>\n\t\t\t{ displayText }\n\t\t</View>\n\t);\n}\n\nconst ConnectedShortcut = contextConnect( Shortcut, 'Shortcut' );\n\nexport default ConnectedShortcut;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/shortcut/component.tsx"],"names":["Shortcut","props","forwardedRef","as","asProp","shortcut","className","otherProps","displayText","ariaLabel","display","ConnectedShortcut"],"mappings":";;;;;;;;;;;;;AAQA;;AAKA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AAkBA,SAASA,QAAT,CACCC,KADD,EAECC,YAFD,EAGsB;AACrB,QAAM;AACLC,IAAAA,EAAE,EAAEC,MAAM,GAAG,MADR;AAELC,IAAAA,QAFK;AAGLC,IAAAA,SAHK;AAIL,OAAGC;AAJE,MAKF,+BAAkBN,KAAlB,EAAyB,UAAzB,CALJ;;AAMA,MAAK,CAAEI,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,MAAIG,WAAJ;AACA,MAAIC,SAAJ;;AAEA,MAAK,OAAOJ,QAAP,KAAoB,QAAzB,EAAoC;AACnCG,IAAAA,WAAW,GAAGH,QAAd;AACA,GAFD,MAEO;AACNG,IAAAA,WAAW,GAAGH,QAAQ,CAACK,OAAvB;AACAD,IAAAA,SAAS,GAAGJ,QAAQ,CAACI,SAArB;AACA;;AAED,SACC,4BAAC,UAAD;AACC,IAAA,EAAE,EAAGL,MADN;AAEC,IAAA,SAAS,EAAGE,SAFb;AAGC,kBAAaG,SAHd;AAIC,IAAA,GAAG,EAAGP;AAJP,KAKMK,UALN,GAOGC,WAPH,CADD;AAWA;;AAED,MAAMG,iBAAiB,GAAG,6BAAgBX,QAAhB,EAA0B,UAA1B,CAA1B;eAEeW,iB","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tWordPressComponentProps,\n} from '../context';\nimport { View } from '../../view';\n\nexport interface ShortcutDescription {\n\tdisplay: string;\n\tariaLabel: string;\n}\n\nexport interface Props {\n\tshortcut?: ShortcutDescription | string;\n\tclassName?: string;\n}\n\nfunction Shortcut(\n\tprops: WordPressComponentProps< Props, 'span' >,\n\tforwardedRef: Ref< any >\n): JSX.Element | null {\n\tconst {\n\t\tas: asProp = 'span',\n\t\tshortcut,\n\t\tclassName,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Shortcut' );\n\tif ( ! shortcut ) {\n\t\treturn null;\n\t}\n\n\tlet displayText: string;\n\tlet ariaLabel: string | undefined;\n\n\tif ( typeof shortcut === 'string' ) {\n\t\tdisplayText = shortcut;\n\t} else {\n\t\tdisplayText = shortcut.display;\n\t\tariaLabel = shortcut.ariaLabel;\n\t}\n\n\treturn (\n\t\t<View\n\t\t\tas={ asProp }\n\t\t\tclassName={ className }\n\t\t\taria-label={ ariaLabel }\n\t\t\tref={ forwardedRef }\n\t\t\t{ ...otherProps }\n\t\t>\n\t\t\t{ displayText }\n\t\t</View>\n\t);\n}\n\nconst ConnectedShortcut = contextConnect( Shortcut, 'Shortcut' );\n\nexport default ConnectedShortcut;\n"]}
@@ -14,7 +14,6 @@ var _configValues = _interopRequireDefault(require("../../utils/config-values"))
14
14
  /**
15
15
  * External dependencies
16
16
  */
17
- // eslint-disable-next-line no-restricted-imports
18
17
 
19
18
  /**
20
19
  * Internal dependencies
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/utils/font-size.ts"],"names":["BASE_FONT_SIZE","PRESET_FONT_SIZES","body","caption","footnote","largeTitle","subheadline","title","HEADING_FONT_SIZES","flatMap","n","toString","getFontSize","size","parsed","parseFloat","Number","isNaN","ratio","CONFIG","fontSize","getHeadingFontSize","includes","headingSize"],"mappings":";;;;;;;;;;;AASA;;AATA;AACA;AACA;AACA;;AAGA;AACA;AACA;AAiBO,MAAMA,cAAc,GAAG,E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ependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport type { CSSProperties, ReactText } from 'react';\n\n/**\n * Internal dependencies\n */\nimport CONFIG from '../../utils/config-values';\n\nexport type HeadingSize =\n\t| 1\n\t| 2\n\t| 3\n\t| 4\n\t| 5\n\t| 6\n\t| '1'\n\t| '2'\n\t| '3'\n\t| '4'\n\t| '5'\n\t| '6';\n\nexport const BASE_FONT_SIZE = 13;\n\nexport const PRESET_FONT_SIZES = {\n\tbody: BASE_FONT_SIZE,\n\tcaption: 10,\n\tfootnote: 11,\n\tlargeTitle: 28,\n\tsubheadline: 12,\n\ttitle: 20,\n};\n\nexport const HEADING_FONT_SIZES = [ 1, 2, 3, 4, 5, 6 ].flatMap( ( n ) => [\n\tn as HeadingSize,\n\tn.toString() as HeadingSize,\n] );\n\nexport function getFontSize(\n\tsize:\n\t\t| CSSProperties[ 'fontSize' ]\n\t\t| keyof typeof PRESET_FONT_SIZES = BASE_FONT_SIZE\n): string {\n\tif ( size in PRESET_FONT_SIZES ) {\n\t\treturn getFontSize(\n\t\t\tPRESET_FONT_SIZES[ size as keyof typeof PRESET_FONT_SIZES ]\n\t\t);\n\t}\n\n\tif ( typeof size !== 'number' ) {\n\t\tconst parsed = parseFloat( size );\n\t\tif ( Number.isNaN( parsed ) ) return size;\n\t\tsize = parsed;\n\t}\n\n\tconst ratio = `(${ size } / ${ BASE_FONT_SIZE })`;\n\treturn `calc(${ ratio } * ${ CONFIG.fontSize })`;\n}\n\nexport function getHeadingFontSize( size: ReactText = 3 ): string {\n\tif ( ! HEADING_FONT_SIZES.includes( size as HeadingSize ) ) {\n\t\treturn getFontSize( size );\n\t}\n\n\tconst headingSize = `fontSizeH${ size }` as `fontSizeH${ HeadingSize }`;\n\treturn CONFIG[ headingSize ];\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/utils/font-size.ts"],"names":["BASE_FONT_SIZE","PRESET_FONT_SIZES","body","caption","footnote","largeTitle","subheadline","title","HEADING_FONT_SIZES","flatMap","n","toString","getFontSize","size","parsed","parseFloat","Number","isNaN","ratio","CONFIG","fontSize","getHeadingFontSize","includes","headingSize"],"mappings":";;;;;;;;;;;AAQA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAiBO,MAAMA,cAAc,GAAG,EAAvB;;AAEA,MAAMC,iBAAiB,GAAG;AAChCC,EAAAA,IAAI,EAAEF,cAD0B;AAEhCG,EAAAA,OAAO,EAAE,EAFuB;AAGhCC,EAAAA,QAAQ,EAAE,EAHsB;AAIhCC,EAAAA,UAAU,EAAE,EAJoB;AAKhCC,EAAAA,WAAW,EAAE,EALmB;AAMhCC,EAAAA,KAAK,EAAE;AANyB,CAA1B;;AASA,MAAMC,kBAAkB,GAAG,CAAE,CAAF,EAAK,CAAL,EAAQ,CAAR,EAAW,CAAX,EAAc,CAAd,EAAiB,CAAjB,EAAqBC,OAArB,CAAgCC,CAAF,IAAS,CACxEA,CADwE,EAExEA,CAAC,CAACC,QAAF,EAFwE,CAAvC,CAA3B;;;AAKA,SAASC,WAAT,GAIG;AAAA,MAHTC,IAGS,uEAD2Bb,cAC3B;;AACT,MAAKa,IAAI,IAAIZ,iBAAb,EAAiC;AAChC,WAAOW,WAAW,CACjBX,iBAAiB,CAAEY,IAAF,CADA,CAAlB;AAGA;;AAED,MAAK,OAAOA,IAAP,KAAgB,QAArB,EAAgC;AAC/B,UAAMC,MAAM,GAAGC,UAAU,CAAEF,IAAF,CAAzB;AACA,QAAKG,MAAM,CAACC,KAAP,CAAcH,MAAd,CAAL,EAA8B,OAAOD,IAAP;AAC9BA,IAAAA,IAAI,GAAGC,MAAP;AACA;;AAED,QAAMI,KAAK,GAAI,IAAIL,IAAM,MAAMb,cAAgB,GAA/C;AACA,SAAQ,QAAQkB,KAAO,MAAMC,sBAAOC,QAAU,GAA9C;AACA;;AAEM,SAASC,kBAAT,GAA2D;AAAA,MAA9BR,IAA8B,uEAAZ,CAAY;;AACjE,MAAK,CAAEL,kBAAkB,CAACc,QAAnB,CAA6BT,IAA7B,CAAP,EAA4D;AAC3D,WAAOD,WAAW,CAAEC,IAAF,CAAlB;AACA;;AAED,QAAMU,WAAW,GAAI,YAAYV,IAAM,EAAvC;AACA,SAAOM,sBAAQI,WAAR,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties, ReactText } from 'react';\n\n/**\n * Internal dependencies\n */\nimport CONFIG from '../../utils/config-values';\n\nexport type HeadingSize =\n\t| 1\n\t| 2\n\t| 3\n\t| 4\n\t| 5\n\t| 6\n\t| '1'\n\t| '2'\n\t| '3'\n\t| '4'\n\t| '5'\n\t| '6';\n\nexport const BASE_FONT_SIZE = 13;\n\nexport const PRESET_FONT_SIZES = {\n\tbody: BASE_FONT_SIZE,\n\tcaption: 10,\n\tfootnote: 11,\n\tlargeTitle: 28,\n\tsubheadline: 12,\n\ttitle: 20,\n};\n\nexport const HEADING_FONT_SIZES = [ 1, 2, 3, 4, 5, 6 ].flatMap( ( n ) => [\n\tn as HeadingSize,\n\tn.toString() as HeadingSize,\n] );\n\nexport function getFontSize(\n\tsize:\n\t\t| CSSProperties[ 'fontSize' ]\n\t\t| keyof typeof PRESET_FONT_SIZES = BASE_FONT_SIZE\n): string {\n\tif ( size in PRESET_FONT_SIZES ) {\n\t\treturn getFontSize(\n\t\t\tPRESET_FONT_SIZES[ size as keyof typeof PRESET_FONT_SIZES ]\n\t\t);\n\t}\n\n\tif ( typeof size !== 'number' ) {\n\t\tconst parsed = parseFloat( size );\n\t\tif ( Number.isNaN( parsed ) ) return size;\n\t\tsize = parsed;\n\t}\n\n\tconst ratio = `(${ size } / ${ BASE_FONT_SIZE })`;\n\treturn `calc(${ ratio } * ${ CONFIG.fontSize })`;\n}\n\nexport function getHeadingFontSize( size: ReactText = 3 ): string {\n\tif ( ! HEADING_FONT_SIZES.includes( size as HeadingSize ) ) {\n\t\treturn getFontSize( size );\n\t}\n\n\tconst headingSize = `fontSizeH${ size }` as `fontSizeH${ HeadingSize }`;\n\treturn CONFIG[ headingSize ];\n}\n"]}
@@ -10,7 +10,6 @@ var _element = require("@wordpress/element");
10
10
  /**
11
11
  * External dependencies
12
12
  */
13
- // eslint-disable-next-line no-restricted-imports
14
13
 
15
14
  /**
16
15
  * WordPress dependencies
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/utils/get-valid-children.ts"],"names":["getValidChildren","children","Children","toArray","filter","child"],"mappings":";;;;;;;AASA;;AATA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,QAA3B,EAAiE;AACvE,MAAK,OAAOA,QAAP,KAAoB,QAAzB,EAAoC,OAAO,CAAEA,QAAF,CAAP;AAEpC,SAAOC,kBAASC,OAAT,CAAkBF,QAAlB,EAA6BG,MAA7B,CAAuCC,KAAF,IAC3C,6BAAgBA,KAAhB,CADM,CAAP;AAGA","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport type { ReactNode, ReactNodeArray } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Children, isValidElement } from '@wordpress/element';\n\n/**\n * Gets a collection of available children elements from a React component's children prop.\n *\n * @param children\n *\n * @return An array of available children.\n */\nexport function getValidChildren( children: ReactNode ): ReactNodeArray {\n\tif ( typeof children === 'string' ) return [ children ];\n\n\treturn Children.toArray( children ).filter( ( child ) =>\n\t\tisValidElement( child )\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/utils/get-valid-children.ts"],"names":["getValidChildren","children","Children","toArray","filter","child"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,QAA3B,EAAiE;AACvE,MAAK,OAAOA,QAAP,KAAoB,QAAzB,EAAoC,OAAO,CAAEA,QAAF,CAAP;AAEpC,SAAOC,kBAASC,OAAT,CAAkBF,QAAlB,EAA6BG,MAA7B,CAAuCC,KAAF,IAC3C,6BAAgBA,KAAhB,CADM,CAAP;AAGA","sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, ReactNodeArray } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Children, isValidElement } from '@wordpress/element';\n\n/**\n * Gets a collection of available children elements from a React component's children prop.\n *\n * @param children\n *\n * @return An array of available children.\n */\nexport function getValidChildren( children: ReactNode ): ReactNodeArray {\n\tif ( typeof children === 'string' ) return [ children ];\n\n\treturn Children.toArray( children ).filter( ( child ) =>\n\t\tisValidElement( child )\n\t);\n}\n"]}
@@ -50,7 +50,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
50
50
  /**
51
51
  * External dependencies
52
52
  */
53
- // eslint-disable-next-line no-restricted-imports
54
53
 
55
54
  /**
56
55
  * WordPress dependencies
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/unit-control/index.tsx"],"names":["UnitControl","forwardedRef","__unstableStateReducer","stateReducer","state","autoComplete","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","noop","onUnitChange","size","style","unit","unitProp","units","unitsProp","CSS_UNITS","value","valueProp","props","initialUnit","setUnit","initial","fallback","refParsedValue","classes","handleOnChange","next","changeProps","join","handleOnUnitChange","data","nextValue","default","undefined","mayUpdateUnit","event","isNaN","Number","currentTarget","current","parsedValue","parsedUnit","toString","Array","isArray","find","option","handleOnBlur","handleOnKeyDown","keyCode","ENTER","unitControlStateReducer","action","type","inputControlActionTypes","COMMIT","inputSuffix","step","activeUnit","ForwardedUnitControl"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgBA;;;;AANA;;AACA;;AAMA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAMA;;;;;;AAlCA;AACA;AACA;AACA;;AAUA;AACA;AACA;AAuBA,SAASA,WAAT,OAoBCC,YApBD,EAqBE;AAAA,MApBD;AACCC,IAAAA,sBAA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B,KADD,CADD;AA2BA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAM+D,oBAAoB,GAAG,yBAAYlE,WAAZ,CAA7B;eAGekE,oB","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport type {\n\tFocusEventHandler,\n\tKeyboardEvent,\n\tRef,\n\tSyntheticEvent,\n} from 'react';\nimport { noop, omit } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useMemo, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { ENTER } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { composeStateReducers } from '../input-control/reducer/reducer';\nimport { Root, ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedValue,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\nimport type { StateReducer } from '../input-control/reducer/state';\n\nfunction UnitControl(\n\t{\n\t\t__unstableStateReducer: stateReducer = ( state ) => state,\n\t\tautoComplete = 'off',\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange = noop,\n\t\tonUnitChange = noop,\n\t\tsize = 'default',\n\t\tstyle,\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\t...props\n\t}: WordPressComponentProps< UnitControlProps, 'input', false >,\n\tforwardedRef: Ref< any >\n) {\n\tconst units = useMemo(\n\t\t() => getUnitsWithCurrentUnit( valueProp, unitProp, unitsProp ),\n\t\t[ valueProp, unitProp, unitsProp ]\n\t);\n\tconst [ value, initialUnit ] = getParsedValue( valueProp, unitProp, units );\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunitProp,\n\t\t{\n\t\t\tinitial: initialUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\t// Stores parsed value for hand-off in state reducer\n\tconst refParsedValue = useRef< string | null >( null );\n\n\tconst classes = classnames( 'components-unit-control', className );\n\n\tconst handleOnChange: UnitControlOnChangeCallback = (\n\t\tnext,\n\t\tchangeProps\n\t) => {\n\t\tif ( next === '' ) {\n\t\t\tonChange( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tnext = getValidParsedUnit( next, units, value, unit ).join( '' );\n\n\t\tonChange( next, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnext,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ value }${ next }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ next }`;\n\t\t}\n\n\t\tonChange( nextValue, changeProps );\n\t\tonUnitChange( next, changeProps );\n\n\t\tsetUnit( next );\n\t};\n\n\tconst mayUpdateUnit = ( event: SyntheticEvent< HTMLInputElement > ) => {\n\t\tif ( ! isNaN( Number( event.currentTarget.value ) ) ) {\n\t\t\trefParsedValue.current = null;\n\t\t\treturn;\n\t\t}\n\t\tconst [ parsedValue, parsedUnit ] = getValidParsedUnit(\n\t\t\tevent.currentTarget.value,\n\t\t\tunits,\n\t\t\tvalue,\n\t\t\tunit\n\t\t);\n\n\t\trefParsedValue.current = parsedValue.toString();\n\n\t\tif ( isPressEnterToChange && parsedUnit !== unit ) {\n\t\t\tconst data = Array.isArray( units )\n\t\t\t\t? units.find( ( option ) => option.value === parsedUnit )\n\t\t\t\t: undefined;\n\t\t\tconst changeProps = { event, data };\n\n\t\t\tonChange( `${ parsedValue }${ parsedUnit }`, changeProps );\n\t\t\tonUnitChange( parsedUnit, changeProps );\n\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t};\n\n\tconst handleOnBlur: FocusEventHandler< HTMLInputElement > = mayUpdateUnit;\n\n\tconst handleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\tconst { keyCode } = event;\n\t\tif ( keyCode === ENTER ) {\n\t\t\tmayUpdateUnit( event );\n\t\t}\n\t};\n\n\t/**\n\t * \"Middleware\" function that intercepts updates from InputControl.\n\t * This allows us to tap into actions to transform the (next) state for\n\t * InputControl.\n\t *\n\t * @param state State from InputControl\n\t * @param action Action triggering state change\n\t * @return The updated state to apply to InputControl\n\t */\n\tconst unitControlStateReducer: StateReducer = ( state, action ) => {\n\t\t/*\n\t\t * On commits (when pressing ENTER and on blur if\n\t\t * isPressEnterToChange is true), if a parse has been performed\n\t\t * then use that result to update the state.\n\t\t */\n\t\tif ( action.type === inputControlActionTypes.COMMIT ) {\n\t\t\tif ( refParsedValue.current !== null ) {\n\t\t\t\tstate.value = refParsedValue.current;\n\t\t\t\trefParsedValue.current = null;\n\t\t\t}\n\t\t}\n\n\t\treturn state;\n\t};\n\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={ size }\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<Root className=\"components-unit-control-wrapper\" style={ style }>\n\t\t\t<ValueInput\n\t\t\t\taria-label={ label }\n\t\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\t\t{ ...omit( props, [ 'children' ] ) }\n\t\t\t\tautoComplete={ autoComplete }\n\t\t\t\tclassName={ classes }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tdisableUnits={ disableUnits }\n\t\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\t\tlabel={ label }\n\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\t\tonChange={ handleOnChange }\n\t\t\t\tref={ forwardedRef }\n\t\t\t\tsize={ size }\n\t\t\t\tsuffix={ inputSuffix }\n\t\t\t\tvalue={ value }\n\t\t\t\tstep={ step }\n\t\t\t\t__unstableStateReducer={ composeStateReducers(\n\t\t\t\t\tunitControlStateReducer,\n\t\t\t\t\tstateReducer\n\t\t\t\t) }\n\t\t\t/>\n\t\t</Root>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a value as well as a unit (e.g. `px`).\n *\n *\n * @example\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nconst ForwardedUnitControl = forwardRef( UnitControl );\n\nexport { parseUnit, useCustomUnits } from './utils';\nexport default ForwardedUnitControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/unit-control/index.tsx"],"names":["UnitControl","forwardedRef","__unstableStateReducer","stateReducer","state","autoComplete","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","noop","onUnitChange","size","style","unit","unitProp","units","unitsProp","CSS_UNITS","value","valueProp","props","initialUnit","setUnit","initial","fallback","refParsedValue","classes","handleOnChange","next","changeProps","join","handleOnUnitChange","data","nextValue","default","undefined","mayUpdateUnit","event","isNaN","Number","currentTarget","current","parsedValue","parsedUnit","toString","Array","isArray","find","option","handleOnBlur","handleOnKeyDown","keyCode","ENTER","unitControlStateReducer","action","type","inputControlActionTypes","COMMIT","inputSuffix","step","activeUnit","ForwardedUnitControl"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA;;;;AANA;;AACA;;AAMA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAMA;;;;;;AAjCA;AACA;AACA;;AAUA;AACA;AACA;AAuBA,SAASA,WAAT,OAoBCC,YApBD,EAqBE;AAAA,MApBD;AACCC,IAAAA,sBAAsB,EAAEC,YAAY,GAAKC,KAAF,IAAaA,KADrD;AAECC,IAAAA,YAAY,GAAG,KAFhB;AAGCC,IAAAA,SAHD;AAICC,IAAAA,QAAQ,GAAG,KAJZ;AAKCC,IAAAA,YAAY,GAAG,KALhB;AAMCC,IAAAA,oBAAoB,GAAG,KANxB;AAOCC,IAAAA,wBAAwB,GAAG,KAP5B;AAQCC,IAAAA,oBAAoB,GAAG,IARxB;AASCC,IAAAA,KATD;AAUCC,IAAAA,QAAQ,GAAGC,YAVZ;AAWCC,IAAAA,YAAY,GAAGD,YAXhB;AAYCE,IAAAA,IAAI,GAAG,SAZR;AAaCC,IAAAA,KAbD;AAcCC,IAAAA,IAAI,EAAEC,QAdP;AAeCC,IAAAA,KAAK,EAAEC,SAAS,GAAGC,gBAfpB;AAgBCC,IAAAA,KAAK,EAAEC,SAhBR;AAiBC,OAAGC;AAjBJ,GAoBC;AACD,QAAML,KAAK,GAAG,sBACb,MAAM,oCAAyBI,SAAzB,EAAoCL,QAApC,EAA8CE,SAA9C,CADO,EAEb,CAAEG,SAAF,EAAaL,QAAb,EAAuBE,SAAvB,CAFa,CAAd;AAIA,QAAM,CAAEE,KAAF,EAASG,WAAT,IAAyB,2BAAgBF,SAAhB,EAA2BL,QAA3B,EAAqCC,KAArC,CAA/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Z;AAOC,IAAA,YAAY,EAAGC,YAPhB;AAQC,IAAA,oBAAoB,EAAGC,oBARxB;AASC,IAAA,KAAK,EAAGG,KATT;AAUC,IAAA,MAAM,EAAG0C,YAVV;AAWC,IAAA,SAAS,EAAGC,eAXb;AAYC,IAAA,QAAQ,EAAGvB,cAZZ;AAaC,IAAA,GAAG,EAAG/B,YAbP;AAcC,IAAA,IAAI,EAAGe,IAdR;AAeC,IAAA,MAAM,EAAG+C,WAfV;AAgBC,IAAA,KAAK,EAAGxC,KAhBT;AAiBC,IAAA,IAAI,EAAGyC,IAjBR;AAkBC,IAAA,sBAAsB,EAAG,mCACxBN,uBADwB,EAExBvD,YAFwB;AAlB1B,KADD,CADD;AA2BA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAM+D,oBAAoB,GAAG,yBAAYlE,WAAZ,CAA7B;eAGekE,oB","sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tFocusEventHandler,\n\tKeyboardEvent,\n\tRef,\n\tSyntheticEvent,\n} from 'react';\nimport { noop, omit } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useMemo, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { ENTER } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { composeStateReducers } from '../input-control/reducer/reducer';\nimport { Root, ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedValue,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\nimport type { StateReducer } from '../input-control/reducer/state';\n\nfunction UnitControl(\n\t{\n\t\t__unstableStateReducer: stateReducer = ( state ) => state,\n\t\tautoComplete = 'off',\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange = noop,\n\t\tonUnitChange = noop,\n\t\tsize = 'default',\n\t\tstyle,\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\t...props\n\t}: WordPressComponentProps< UnitControlProps, 'input', false >,\n\tforwardedRef: Ref< any >\n) {\n\tconst units = useMemo(\n\t\t() => getUnitsWithCurrentUnit( valueProp, unitProp, unitsProp ),\n\t\t[ valueProp, unitProp, unitsProp ]\n\t);\n\tconst [ value, initialUnit ] = getParsedValue( valueProp, unitProp, units );\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunitProp,\n\t\t{\n\t\t\tinitial: initialUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\t// Stores parsed value for hand-off in state reducer\n\tconst refParsedValue = useRef< string | null >( null );\n\n\tconst classes = classnames( 'components-unit-control', className );\n\n\tconst handleOnChange: UnitControlOnChangeCallback = (\n\t\tnext,\n\t\tchangeProps\n\t) => {\n\t\tif ( next === '' ) {\n\t\t\tonChange( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tnext = getValidParsedUnit( next, units, value, unit ).join( '' );\n\n\t\tonChange( next, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnext,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ value }${ next }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ next }`;\n\t\t}\n\n\t\tonChange( nextValue, changeProps );\n\t\tonUnitChange( next, changeProps );\n\n\t\tsetUnit( next );\n\t};\n\n\tconst mayUpdateUnit = ( event: SyntheticEvent< HTMLInputElement > ) => {\n\t\tif ( ! isNaN( Number( event.currentTarget.value ) ) ) {\n\t\t\trefParsedValue.current = null;\n\t\t\treturn;\n\t\t}\n\t\tconst [ parsedValue, parsedUnit ] = getValidParsedUnit(\n\t\t\tevent.currentTarget.value,\n\t\t\tunits,\n\t\t\tvalue,\n\t\t\tunit\n\t\t);\n\n\t\trefParsedValue.current = parsedValue.toString();\n\n\t\tif ( isPressEnterToChange && parsedUnit !== unit ) {\n\t\t\tconst data = Array.isArray( units )\n\t\t\t\t? units.find( ( option ) => option.value === parsedUnit )\n\t\t\t\t: undefined;\n\t\t\tconst changeProps = { event, data };\n\n\t\t\tonChange( `${ parsedValue }${ parsedUnit }`, changeProps );\n\t\t\tonUnitChange( parsedUnit, changeProps );\n\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t};\n\n\tconst handleOnBlur: FocusEventHandler< HTMLInputElement > = mayUpdateUnit;\n\n\tconst handleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\tconst { keyCode } = event;\n\t\tif ( keyCode === ENTER ) {\n\t\t\tmayUpdateUnit( event );\n\t\t}\n\t};\n\n\t/**\n\t * \"Middleware\" function that intercepts updates from InputControl.\n\t * This allows us to tap into actions to transform the (next) state for\n\t * InputControl.\n\t *\n\t * @param state State from InputControl\n\t * @param action Action triggering state change\n\t * @return The updated state to apply to InputControl\n\t */\n\tconst unitControlStateReducer: StateReducer = ( state, action ) => {\n\t\t/*\n\t\t * On commits (when pressing ENTER and on blur if\n\t\t * isPressEnterToChange is true), if a parse has been performed\n\t\t * then use that result to update the state.\n\t\t */\n\t\tif ( action.type === inputControlActionTypes.COMMIT ) {\n\t\t\tif ( refParsedValue.current !== null ) {\n\t\t\t\tstate.value = refParsedValue.current;\n\t\t\t\trefParsedValue.current = null;\n\t\t\t}\n\t\t}\n\n\t\treturn state;\n\t};\n\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={ size }\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<Root className=\"components-unit-control-wrapper\" style={ style }>\n\t\t\t<ValueInput\n\t\t\t\taria-label={ label }\n\t\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\t\t{ ...omit( props, [ 'children' ] ) }\n\t\t\t\tautoComplete={ autoComplete }\n\t\t\t\tclassName={ classes }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tdisableUnits={ disableUnits }\n\t\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\t\tlabel={ label }\n\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\t\tonChange={ handleOnChange }\n\t\t\t\tref={ forwardedRef }\n\t\t\t\tsize={ size }\n\t\t\t\tsuffix={ inputSuffix }\n\t\t\t\tvalue={ value }\n\t\t\t\tstep={ step }\n\t\t\t\t__unstableStateReducer={ composeStateReducers(\n\t\t\t\t\tunitControlStateReducer,\n\t\t\t\t\tstateReducer\n\t\t\t\t) }\n\t\t\t/>\n\t\t</Root>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a value as well as a unit (e.g. `px`).\n *\n *\n * @example\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nconst ForwardedUnitControl = forwardRef( UnitControl );\n\nexport { parseUnit, useCustomUnits } from './utils';\nexport default ForwardedUnitControl;\n"]}