@wordpress/components 23.8.0 → 24.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/CONTRIBUTING.md +65 -1
  3. package/README.md +1 -3
  4. package/build/autocomplete/autocompleter-ui.js +0 -2
  5. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  6. package/build/autocomplete/index.js +2 -0
  7. package/build/autocomplete/index.js.map +1 -1
  8. package/build/button/index.js +2 -0
  9. package/build/button/index.js.map +1 -1
  10. package/build/card/card-media/component.js +2 -1
  11. package/build/card/card-media/component.js.map +1 -1
  12. package/build/checkbox-control/index.js +2 -2
  13. package/build/checkbox-control/index.js.map +1 -1
  14. package/build/color-palette/index.native.js +12 -0
  15. package/build/color-palette/index.native.js.map +1 -1
  16. package/build/combobox-control/index.js +7 -5
  17. package/build/combobox-control/index.js.map +1 -1
  18. package/build/combobox-control/styles.js +3 -3
  19. package/build/combobox-control/styles.js.map +1 -1
  20. package/build/custom-gradient-picker/index.native.js +3 -1
  21. package/build/custom-gradient-picker/index.native.js.map +1 -1
  22. package/build/dimension-control/index.js +1 -1
  23. package/build/dimension-control/index.js.map +1 -1
  24. package/build/draggable/index.js +8 -8
  25. package/build/draggable/index.js.map +1 -1
  26. package/build/form-token-field/index.js +5 -3
  27. package/build/form-token-field/index.js.map +1 -1
  28. package/build/form-token-field/styles.js +3 -3
  29. package/build/form-token-field/styles.js.map +1 -1
  30. package/build/index.js.map +1 -1
  31. package/build/mobile/bottom-sheet/cell.native.js +6 -6
  32. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  33. package/build/mobile/color-settings/palette.screen.native.js +0 -8
  34. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  35. package/build/mobile/global-styles-context/index.native.js +13 -1
  36. package/build/mobile/global-styles-context/index.native.js.map +1 -1
  37. package/build/mobile/global-styles-context/utils.native.js +21 -4
  38. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  39. package/build/mobile/link-picker/link-picker-results.native.js +3 -1
  40. package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
  41. package/build/mobile/segmented-control/index.native.js +4 -2
  42. package/build/mobile/segmented-control/index.native.js.map +1 -1
  43. package/build/modal/index.js +2 -1
  44. package/build/modal/index.js.map +1 -1
  45. package/build/navigable-container/container.js +39 -19
  46. package/build/navigable-container/container.js.map +1 -1
  47. package/build/navigable-container/index.js.map +1 -1
  48. package/build/navigable-container/menu.js +37 -5
  49. package/build/navigable-container/menu.js.map +1 -1
  50. package/build/navigable-container/tabbable.js +45 -4
  51. package/build/navigable-container/tabbable.js.map +1 -1
  52. package/build/navigable-container/types.js +6 -0
  53. package/build/navigable-container/types.js.map +1 -0
  54. package/build/navigator/navigator-screen/component.js +1 -1
  55. package/build/navigator/navigator-screen/component.js.map +1 -1
  56. package/build/palette-edit/index.js +34 -12
  57. package/build/palette-edit/index.js.map +1 -1
  58. package/build/popover/index.js +1 -8
  59. package/build/popover/index.js.map +1 -1
  60. package/build/private-apis.js +4 -1
  61. package/build/private-apis.js.map +1 -1
  62. package/build/sandbox/index.native.js +10 -3
  63. package/build/sandbox/index.native.js.map +1 -1
  64. package/build/slot-fill/bubbles-virtually/fill.js +2 -1
  65. package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
  66. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +45 -35
  67. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  68. package/build/slot-fill/bubbles-virtually/use-slot.js +11 -26
  69. package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  70. package/build/slot-fill/fill.js +7 -31
  71. package/build/slot-fill/fill.js.map +1 -1
  72. package/build/slot-fill/index.js +20 -7
  73. package/build/slot-fill/index.js.map +1 -1
  74. package/build/slot-fill/provider.js +0 -6
  75. package/build/slot-fill/provider.js.map +1 -1
  76. package/build/slot-fill/slot.js +0 -5
  77. package/build/slot-fill/slot.js.map +1 -1
  78. package/build/spinner/styles.js +4 -4
  79. package/build/spinner/styles.js.map +1 -1
  80. package/build/tab-panel/index.js.map +1 -1
  81. package/build/theme/color-algorithms.js +1 -1
  82. package/build/theme/color-algorithms.js.map +1 -1
  83. package/build/toolbar/toolbar-button/index.js +1 -2
  84. package/build/toolbar/toolbar-button/index.js.map +1 -1
  85. package/build/toolbar/toolbar-item/index.js +4 -2
  86. package/build/toolbar/toolbar-item/index.js.map +1 -1
  87. package/build/tree-grid/index.js +3 -3
  88. package/build/tree-grid/index.js.map +1 -1
  89. package/build/utils/colors-values.js +3 -3
  90. package/build/utils/colors-values.js.map +1 -1
  91. package/build/utils/use-deprecated-props.js +35 -0
  92. package/build/utils/use-deprecated-props.js.map +1 -0
  93. package/build/view/component.js +1 -2
  94. package/build/view/component.js.map +1 -1
  95. package/build-module/autocomplete/autocompleter-ui.js +1 -3
  96. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  97. package/build-module/autocomplete/index.js +3 -3
  98. package/build-module/autocomplete/index.js.map +1 -1
  99. package/build-module/button/index.js +2 -0
  100. package/build-module/button/index.js.map +1 -1
  101. package/build-module/card/card-media/component.js +2 -1
  102. package/build-module/card/card-media/component.js.map +1 -1
  103. package/build-module/checkbox-control/index.js +2 -2
  104. package/build-module/checkbox-control/index.js.map +1 -1
  105. package/build-module/color-palette/index.native.js +13 -1
  106. package/build-module/color-palette/index.native.js.map +1 -1
  107. package/build-module/combobox-control/index.js +6 -5
  108. package/build-module/combobox-control/index.js.map +1 -1
  109. package/build-module/combobox-control/styles.js +3 -3
  110. package/build-module/combobox-control/styles.js.map +1 -1
  111. package/build-module/custom-gradient-picker/index.native.js +3 -1
  112. package/build-module/custom-gradient-picker/index.native.js.map +1 -1
  113. package/build-module/dimension-control/index.js +1 -1
  114. package/build-module/dimension-control/index.js.map +1 -1
  115. package/build-module/draggable/index.js +8 -8
  116. package/build-module/draggable/index.js.map +1 -1
  117. package/build-module/form-token-field/index.js +4 -3
  118. package/build-module/form-token-field/index.js.map +1 -1
  119. package/build-module/form-token-field/styles.js +3 -3
  120. package/build-module/form-token-field/styles.js.map +1 -1
  121. package/build-module/index.js.map +1 -1
  122. package/build-module/mobile/bottom-sheet/cell.native.js +6 -5
  123. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  124. package/build-module/mobile/color-settings/palette.screen.native.js +0 -8
  125. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  126. package/build-module/mobile/global-styles-context/index.native.js +13 -1
  127. package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
  128. package/build-module/mobile/global-styles-context/utils.native.js +21 -3
  129. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  130. package/build-module/mobile/link-picker/link-picker-results.native.js +3 -1
  131. package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
  132. package/build-module/mobile/segmented-control/index.native.js +4 -2
  133. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  134. package/build-module/modal/index.js +2 -1
  135. package/build-module/modal/index.js.map +1 -1
  136. package/build-module/navigable-container/container.js +43 -19
  137. package/build-module/navigable-container/container.js.map +1 -1
  138. package/build-module/navigable-container/index.js +0 -2
  139. package/build-module/navigable-container/index.js.map +1 -1
  140. package/build-module/navigable-container/menu.js +36 -4
  141. package/build-module/navigable-container/menu.js.map +1 -1
  142. package/build-module/navigable-container/tabbable.js +44 -3
  143. package/build-module/navigable-container/tabbable.js.map +1 -1
  144. package/build-module/navigable-container/types.js +2 -0
  145. package/build-module/navigable-container/types.js.map +1 -0
  146. package/build-module/navigator/navigator-screen/component.js +1 -1
  147. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  148. package/build-module/palette-edit/index.js +34 -13
  149. package/build-module/palette-edit/index.js.map +1 -1
  150. package/build-module/popover/index.js +1 -8
  151. package/build-module/popover/index.js.map +1 -1
  152. package/build-module/private-apis.js +3 -1
  153. package/build-module/private-apis.js.map +1 -1
  154. package/build-module/sandbox/index.native.js +10 -3
  155. package/build-module/sandbox/index.native.js.map +1 -1
  156. package/build-module/slot-fill/bubbles-virtually/fill.js +2 -1
  157. package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
  158. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +46 -36
  159. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  160. package/build-module/slot-fill/bubbles-virtually/use-slot.js +12 -27
  161. package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  162. package/build-module/slot-fill/fill.js +7 -31
  163. package/build-module/slot-fill/fill.js.map +1 -1
  164. package/build-module/slot-fill/index.js +17 -8
  165. package/build-module/slot-fill/index.js.map +1 -1
  166. package/build-module/slot-fill/provider.js +0 -6
  167. package/build-module/slot-fill/provider.js.map +1 -1
  168. package/build-module/slot-fill/slot.js +0 -5
  169. package/build-module/slot-fill/slot.js.map +1 -1
  170. package/build-module/spinner/styles.js +4 -4
  171. package/build-module/spinner/styles.js.map +1 -1
  172. package/build-module/tab-panel/index.js.map +1 -1
  173. package/build-module/theme/color-algorithms.js +1 -1
  174. package/build-module/theme/color-algorithms.js.map +1 -1
  175. package/build-module/toolbar/toolbar-button/index.js +1 -2
  176. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  177. package/build-module/toolbar/toolbar-item/index.js +5 -2
  178. package/build-module/toolbar/toolbar-item/index.js.map +1 -1
  179. package/build-module/tree-grid/index.js +3 -3
  180. package/build-module/tree-grid/index.js.map +1 -1
  181. package/build-module/utils/colors-values.js +3 -3
  182. package/build-module/utils/colors-values.js.map +1 -1
  183. package/build-module/utils/use-deprecated-props.js +25 -0
  184. package/build-module/utils/use-deprecated-props.js.map +1 -0
  185. package/build-module/view/component.js +1 -2
  186. package/build-module/view/component.js.map +1 -1
  187. package/build-style/style-rtl.css +83 -70
  188. package/build-style/style.css +83 -70
  189. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  190. package/build-types/autocomplete/index.d.ts.map +1 -1
  191. package/build-types/autocomplete/types.d.ts +2 -18
  192. package/build-types/autocomplete/types.d.ts.map +1 -1
  193. package/build-types/box-control/styles/box-control-styles.d.ts +1 -1
  194. package/build-types/button/deprecated.d.ts +12 -6
  195. package/build-types/button/deprecated.d.ts.map +1 -1
  196. package/build-types/button/index.d.ts.map +1 -1
  197. package/build-types/button/types.d.ts +7 -0
  198. package/build-types/button/types.d.ts.map +1 -1
  199. package/build-types/card/card-media/component.d.ts +2 -1
  200. package/build-types/card/card-media/component.d.ts.map +1 -1
  201. package/build-types/card/stories/index.d.ts +21 -1
  202. package/build-types/card/stories/index.d.ts.map +1 -1
  203. package/build-types/checkbox-control/index.d.ts.map +1 -1
  204. package/build-types/color-palette/styles.d.ts +1 -1
  205. package/build-types/color-picker/styles.d.ts +3 -3
  206. package/build-types/combobox-control/index.d.ts +1 -1
  207. package/build-types/combobox-control/index.d.ts.map +1 -1
  208. package/build-types/combobox-control/stories/index.d.ts.map +1 -1
  209. package/build-types/combobox-control/styles.d.ts +1 -1
  210. package/build-types/combobox-control/types.d.ts +8 -1
  211. package/build-types/combobox-control/types.d.ts.map +1 -1
  212. package/build-types/date-time/date/styles.d.ts +1 -1
  213. package/build-types/date-time/time/styles.d.ts +4 -4
  214. package/build-types/dimension-control/index.d.ts +1 -1
  215. package/build-types/draggable/index.d.ts +1 -1
  216. package/build-types/draggable/index.d.ts.map +1 -1
  217. package/build-types/draggable/stories/index.d.ts +8 -0
  218. package/build-types/draggable/stories/index.d.ts.map +1 -1
  219. package/build-types/draggable/types.d.ts +7 -0
  220. package/build-types/draggable/types.d.ts.map +1 -1
  221. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  222. package/build-types/form-token-field/index.d.ts.map +1 -1
  223. package/build-types/form-token-field/styles.d.ts +1 -1
  224. package/build-types/form-token-field/types.d.ts +8 -1
  225. package/build-types/form-token-field/types.d.ts.map +1 -1
  226. package/build-types/index.d.ts +1 -0
  227. package/build-types/index.d.ts.map +1 -1
  228. package/build-types/modal/index.d.ts.map +1 -1
  229. package/build-types/navigable-container/container.d.ts +20 -1
  230. package/build-types/navigable-container/container.d.ts.map +1 -1
  231. package/build-types/navigable-container/index.d.ts +5 -2
  232. package/build-types/navigable-container/index.d.ts.map +1 -1
  233. package/build-types/navigable-container/menu.d.ts +45 -11
  234. package/build-types/navigable-container/menu.d.ts.map +1 -1
  235. package/build-types/navigable-container/stories/navigable-menu.d.ts +12 -0
  236. package/build-types/navigable-container/stories/navigable-menu.d.ts.map +1 -0
  237. package/build-types/navigable-container/stories/tabbable-container.d.ts +12 -0
  238. package/build-types/navigable-container/stories/tabbable-container.d.ts.map +1 -0
  239. package/build-types/navigable-container/tabbable.d.ts +52 -9
  240. package/build-types/navigable-container/tabbable.d.ts.map +1 -1
  241. package/build-types/navigable-container/test/navigable-menu.d.ts +2 -0
  242. package/build-types/navigable-container/test/navigable-menu.d.ts.map +1 -0
  243. package/build-types/navigable-container/test/tababble-container.d.ts +2 -0
  244. package/build-types/navigable-container/test/tababble-container.d.ts.map +1 -0
  245. package/build-types/navigable-container/types.d.ts +61 -0
  246. package/build-types/navigable-container/types.d.ts.map +1 -0
  247. package/build-types/navigation/styles/navigation-styles.d.ts +1 -1
  248. package/build-types/navigator/navigator-back-button/component.d.ts +2 -1
  249. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  250. package/build-types/navigator/navigator-back-button/hook.d.ts +2 -1
  251. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  252. package/build-types/navigator/navigator-button/component.d.ts +2 -1
  253. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  254. package/build-types/navigator/navigator-button/hook.d.ts +2 -1
  255. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  256. package/build-types/navigator/navigator-screen/component.d.ts +1 -1
  257. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  258. package/build-types/navigator/navigator-to-parent-button/component.d.ts +2 -1
  259. package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
  260. package/build-types/number-control/index.d.ts +1 -1
  261. package/build-types/number-control/stories/index.d.ts +1 -1
  262. package/build-types/palette-edit/index.d.ts +1 -1
  263. package/build-types/palette-edit/index.d.ts.map +1 -1
  264. package/build-types/palette-edit/stories/index.d.ts.map +1 -1
  265. package/build-types/palette-edit/styles.d.ts +16 -10
  266. package/build-types/palette-edit/styles.d.ts.map +1 -1
  267. package/build-types/palette-edit/types.d.ts +8 -0
  268. package/build-types/palette-edit/types.d.ts.map +1 -1
  269. package/build-types/popover/index.d.ts +1 -1
  270. package/build-types/popover/index.d.ts.map +1 -1
  271. package/build-types/popover/stories/e2e/index.d.ts +1 -1
  272. package/build-types/private-apis.d.ts.map +1 -1
  273. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  274. package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
  275. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
  276. package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
  277. package/build-types/slot-fill/fill.d.ts +4 -2
  278. package/build-types/slot-fill/fill.d.ts.map +1 -1
  279. package/build-types/slot-fill/index.d.ts +14 -3
  280. package/build-types/slot-fill/index.d.ts.map +1 -1
  281. package/build-types/slot-fill/provider.d.ts +0 -2
  282. package/build-types/slot-fill/provider.d.ts.map +1 -1
  283. package/build-types/slot-fill/slot.d.ts.map +1 -1
  284. package/build-types/spinner/styles.d.ts.map +1 -1
  285. package/build-types/toolbar/stories/index.d.ts.map +1 -1
  286. package/build-types/toolbar/toolbar-button/index.d.ts +12 -6
  287. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  288. package/build-types/toolbar/toolbar-item/index.d.ts +6 -4
  289. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
  290. package/build-types/tree-grid/index.d.ts.map +1 -1
  291. package/build-types/tree-grid/types.d.ts +7 -0
  292. package/build-types/tree-grid/types.d.ts.map +1 -1
  293. package/build-types/ui/context/wordpress-component.d.ts +1 -1
  294. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  295. package/build-types/unit-control/index.d.ts +1 -1
  296. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  297. package/build-types/utils/use-deprecated-props.d.ts +9 -0
  298. package/build-types/utils/use-deprecated-props.d.ts.map +1 -0
  299. package/build-types/view/component.d.ts +1 -1
  300. package/build-types/view/component.d.ts.map +1 -1
  301. package/package.json +21 -22
  302. package/src/autocomplete/README.md +82 -54
  303. package/src/autocomplete/autocompleter-ui.tsx +0 -2
  304. package/src/autocomplete/index.tsx +1 -2
  305. package/src/autocomplete/types.ts +3 -19
  306. package/src/button/index.tsx +2 -0
  307. package/src/button/style.scss +13 -6
  308. package/src/button/types.ts +7 -0
  309. package/src/card/card-media/README.md +1 -1
  310. package/src/card/card-media/component.tsx +2 -1
  311. package/src/card/stories/index.tsx +47 -26
  312. package/src/checkbox-control/index.tsx +6 -2
  313. package/src/checkbox-control/style.scss +1 -4
  314. package/src/color-palette/index.native.js +20 -1
  315. package/src/color-picker/test/index.tsx +99 -99
  316. package/src/combobox-control/index.tsx +24 -18
  317. package/src/combobox-control/stories/index.tsx +0 -1
  318. package/src/combobox-control/styles.ts +4 -4
  319. package/src/combobox-control/types.ts +8 -1
  320. package/src/custom-gradient-picker/index.native.js +1 -1
  321. package/src/custom-gradient-picker/style.scss +2 -2
  322. package/src/dimension-control/README.md +1 -1
  323. package/src/dimension-control/index.tsx +1 -1
  324. package/src/draggable/README.md +8 -1
  325. package/src/draggable/index.tsx +7 -10
  326. package/src/draggable/stories/index.tsx +69 -33
  327. package/src/draggable/types.ts +7 -0
  328. package/src/form-toggle/style.scss +1 -5
  329. package/src/form-token-field/index.tsx +7 -3
  330. package/src/form-token-field/styles.ts +4 -4
  331. package/src/form-token-field/types.ts +8 -1
  332. package/src/index.ts +1 -0
  333. package/src/mobile/bottom-sheet/cell.native.js +4 -5
  334. package/src/mobile/color-settings/palette.screen.native.js +0 -7
  335. package/src/mobile/global-styles-context/index.native.js +12 -1
  336. package/src/mobile/global-styles-context/utils.native.js +18 -3
  337. package/src/mobile/link-picker/link-picker-results.native.js +3 -0
  338. package/src/mobile/segmented-control/index.native.js +2 -2
  339. package/src/modal/index.tsx +6 -1
  340. package/src/modal/style.scss +21 -13
  341. package/src/navigable-container/README.md +24 -13
  342. package/src/navigable-container/{container.js → container.tsx} +57 -27
  343. package/src/navigable-container/{index.js → index.tsx} +0 -1
  344. package/src/navigable-container/menu.tsx +100 -0
  345. package/src/navigable-container/stories/{navigable-menu.js → navigable-menu.tsx} +15 -10
  346. package/src/navigable-container/stories/{tabbable-container.js → tabbable-container.tsx} +15 -6
  347. package/src/navigable-container/tabbable.tsx +92 -0
  348. package/src/navigable-container/test/{navigable-menu.js → navigable-menu.tsx} +3 -1
  349. package/src/navigable-container/test/{tababble-container.js → tababble-container.tsx} +53 -24
  350. package/src/navigable-container/types.ts +76 -0
  351. package/src/navigator/navigator-screen/component.tsx +1 -1
  352. package/src/palette-edit/index.tsx +45 -7
  353. package/src/palette-edit/stories/index.tsx +4 -0
  354. package/src/palette-edit/types.ts +11 -0
  355. package/src/popover/index.tsx +2 -15
  356. package/src/private-apis.ts +2 -0
  357. package/src/sandbox/index.native.js +12 -1
  358. package/src/slot-fill/bubbles-virtually/fill.js +2 -1
  359. package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +46 -60
  360. package/src/slot-fill/bubbles-virtually/use-slot.js +14 -41
  361. package/src/slot-fill/fill.js +4 -26
  362. package/src/slot-fill/index.js +14 -8
  363. package/src/slot-fill/provider.js +0 -6
  364. package/src/slot-fill/slot.js +0 -5
  365. package/src/snackbar/style.scss +2 -1
  366. package/src/spinner/styles.ts +2 -0
  367. package/src/style.scss +6 -0
  368. package/src/tab-panel/index.tsx +1 -1
  369. package/src/theme/color-algorithms.ts +1 -1
  370. package/src/theme/stories/index.tsx +1 -1
  371. package/src/theme/test/color-algorithms.ts +2 -2
  372. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +4 -4
  373. package/src/toolbar/stories/index.tsx +26 -24
  374. package/src/toolbar/toolbar-button/index.tsx +10 -13
  375. package/src/toolbar/toolbar-item/{index.js → index.tsx} +12 -3
  376. package/src/tree-grid/README.md +18 -0
  377. package/src/tree-grid/index.tsx +7 -2
  378. package/src/tree-grid/types.ts +7 -0
  379. package/src/ui/context/wordpress-component.ts +1 -1
  380. package/src/utils/colors-values.js +3 -3
  381. package/src/utils/theme-variables.scss +4 -4
  382. package/src/utils/use-deprecated-props.ts +29 -0
  383. package/src/view/component.tsx +2 -2
  384. package/tsconfig.json +3 -2
  385. package/tsconfig.tsbuildinfo +1 -1
  386. package/src/CONTRIBUTING.md +0 -78
  387. package/src/README.md +0 -20
  388. package/src/navigable-container/menu.js +0 -62
  389. package/src/navigable-container/tabbable.js +0 -46
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/index.tsx"],"names":["focus","forwardRef","useCallback","UP","DOWN","LEFT","RIGHT","HOME","END","RovingTabIndexContainer","getRowFocusables","rowElement","focusablesInRow","focusable","find","sequential","filter","closest","UnforwardedTreeGrid","ref","children","onExpandRow","onCollapseRow","onFocusRow","applicationAriaLabel","props","onKeyDown","event","keyCode","metaKey","ctrlKey","altKey","hasModifierKeyPressed","includes","stopPropagation","activeElement","document","currentTarget","treeGridElement","contains","activeRow","currentColumnIndex","indexOf","canExpandCollapse","cannotFocusNextColumn","getAttribute","nextIndex","Math","max","min","length","preventDefault","level","parseInt","rows","Array","from","querySelectorAll","parentRow","currentRowIndex","i","ariaLevel","focusableItems","nextRowIndex","focusablesInNextRow","TreeGrid","default","TreeGridRow","TreeGridCell","TreeGridItem"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,gBAAtB;AACA,SAASC,UAAT,EAAqBC,WAArB,QAAwC,oBAAxC;AACA,SAASC,EAAT,EAAaC,IAAb,EAAmBC,IAAnB,EAAyBC,KAAzB,EAAgCC,IAAhC,EAAsCC,GAA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AAAA,mBAAmB,CAAElB,SAAF,CAAnB,CAAiC9C,KAAjC,GA5C+D,CA8C/D;AACA;;AACAuB,MAAAA,UAAU,CAAEI,KAAF,EAASa,SAAT,EAAoBc,IAAI,CAAES,YAAF,CAAxB,CAAV,CAhD+D,CAkD/D;AACA;;AACApC,MAAAA,KAAK,CAACwB,cAAN;AACA;AACD,GApP2B,EAqP5B,CAAE9B,WAAF,EAAeC,aAAf,EAA8BC,UAA9B,CArP4B,CAA7B;AAwPA;;AACA;;AACA,SACC,cAAC,uBAAD,QAMC;AAAK,IAAA,IAAI,EAAC,aAAV;AAAwB,kBAAaC;AAArC,KACC,oCACMC,KADN;AAEC,IAAA,IAAI,EAAC,UAFN;AAGC,IAAA,SAAS,EAAGC,SAHb;AAIC,IAAA,GAAG,EAAGP;AAJP,MAMC,6BAASC,QAAT,CAND,CADD,CAND,CADD;AAmBA;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAM6C,QAAQ,GAAGhE,UAAU,CAAEiB,mBAAF,CAA3B;AAEP,eAAe+C,QAAf;AACA,SAASC,OAAO,IAAIC,WAApB,QAAuC,OAAvC;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,QAAxC;AACA,SAASF,OAAO,IAAIG,YAApB,QAAwC,QAAxC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { forwardRef, useCallback } from '@wordpress/element';\nimport { UP, DOWN, LEFT, RIGHT, HOME, END } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport RovingTabIndexContainer from './roving-tab-index';\nimport type { TreeGridProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\n/**\n * Return focusables in a row element, excluding those from other branches\n * nested within the row.\n *\n * @param rowElement The DOM element representing the row.\n *\n * @return The array of focusables in the row.\n */\nfunction getRowFocusables( rowElement: HTMLElement ) {\n\tconst focusablesInRow = focus.focusable.find( rowElement, {\n\t\tsequential: true,\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 */\nfunction UnforwardedTreeGrid(\n\t{\n\t\tchildren,\n\t\tonExpandRow = () => {},\n\t\tonCollapseRow = () => {},\n\t\tonFocusRow = () => {},\n\t\tapplicationAriaLabel,\n\t\t...props\n\t}: WordPressComponentProps< TreeGridProps, 'table', false >,\n\t/** A ref to the underlying DOM table element. */\n\tref: React.ForwardedRef< HTMLTableElement >\n) {\n\tconst onKeyDown = useCallback(\n\t\t( event: React.KeyboardEvent< HTMLTableElement > ) => {\n\t\t\tconst { keyCode, metaKey, ctrlKey, altKey } = event;\n\n\t\t\t// The shift key is intentionally absent from the following list,\n\t\t\t// to enable shift + up/down to select items from the list.\n\t\t\tconst hasModifierKeyPressed = metaKey || ctrlKey || altKey;\n\n\t\t\tif (\n\t\t\t\thasModifierKeyPressed ||\n\t\t\t\t! ( [ UP, DOWN, LEFT, RIGHT, HOME, END ] as number[] ).includes(\n\t\t\t\t\tkeyCode\n\t\t\t\t)\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\n\t\t\tif (\n\t\t\t\t! activeElement ||\n\t\t\t\t! treeGridElement.contains( activeElement )\n\t\t\t) {\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 =\n\t\t\t\tactiveElement.closest< HTMLElement >( '[role=\"row\"]' );\n\n\t\t\tif ( ! activeRow ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst focusablesInRow = getRowFocusables( activeRow );\n\t\t\tconst currentColumnIndex = focusablesInRow.indexOf(\n\t\t\t\tactiveElement as HTMLElement\n\t\t\t);\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 ( ( [ LEFT, RIGHT ] as number[] ).includes( 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< HTMLElement >(\n\t\t\t\t\t\t\t\t'[role=\"row\"]'\n\t\t\t\t\t\t\t)\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\tconst ariaLevel =\n\t\t\t\t\t\t\t\trows[ i ].getAttribute( 'aria-level' );\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tariaLevel !== null &&\n\t\t\t\t\t\t\t\tparseInt( 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 next 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[ nextIndex ]?.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 ( ( [ UP, DOWN ] as number[] ).includes( 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< HTMLElement >(\n\t\t\t\t\t\t'[role=\"row\"]'\n\t\t\t\t\t)\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// Let consumers know the row that was originally focused,\n\t\t\t\t// and the row that is now in focus.\n\t\t\t\tonFocusRow( event, activeRow, rows[ nextRowIndex ] );\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 ( ( [ HOME, END ] as number[] ).includes( 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< HTMLElement >(\n\t\t\t\t\t\t'[role=\"row\"]'\n\t\t\t\t\t)\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 === HOME ) {\n\t\t\t\t\tnextRowIndex = 0;\n\t\t\t\t} else {\n\t\t\t\t\tnextRowIndex = rows.length - 1;\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// Let consumers know the row that was originally focused,\n\t\t\t\t// and the row that is now in focus.\n\t\t\t\tonFocusRow( event, activeRow, rows[ nextRowIndex ] );\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, onFocusRow ]\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{\n\t\t\t\t// Prevent browser mode from triggering in NVDA by wrapping List View\n\t\t\t\t// in a role=application wrapper.\n\t\t\t\t// see: https://github.com/WordPress/gutenberg/issues/43729\n\t\t\t }\n\t\t\t<div role=\"application\" aria-label={ applicationAriaLabel }>\n\t\t\t\t<table\n\t\t\t\t\t{ ...props }\n\t\t\t\t\trole=\"treegrid\"\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t\tref={ ref }\n\t\t\t\t>\n\t\t\t\t\t<tbody>{ children }</tbody>\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t</RovingTabIndexContainer>\n\t);\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\n/**\n * `TreeGrid` is used to create a tree hierarchy.\n * It is not a visually styled component, but instead helps with adding\n * keyboard navigation and roving tab index behaviors to tree grid structures.\n *\n * A tree grid is a hierarchical 2 dimensional UI component, for example it could be\n * used to implement a file system browser.\n *\n * A tree grid allows the user to navigate using arrow keys.\n * Up/down to navigate vertically across rows, and left/right to navigate horizontally\n * between focusables in a row.\n *\n * The `TreeGrid` renders both a `table` and `tbody` element, and is intended to be used\n * with `TreeGridRow` (`tr`) and `TreeGridCell` (`td`) to build out a grid.\n *\n * ```jsx\n * function TreeMenu() {\n * \treturn (\n * \t\t<TreeGrid>\n * \t\t\t<TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 2 }>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onSelect } { ...props }>Select</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onMove } { ...props }>Move</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t</TreeGridRow>\n * \t\t\t<TreeGridRow level={ 1 } positionInSet={ 2 } setSize={ 2 }>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onSelect } { ...props }>Select</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onMove } { ...props }>Move</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t</TreeGridRow>\n * \t\t\t<TreeGridRow level={ 2 } positionInSet={ 1 } setSize={ 1 }>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onSelect } { ...props }>Select</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onMove } { ...props }>Move</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t</TreeGridRow>\n * \t\t</TreeGrid>\n * \t);\n * }\n * ```\n *\n * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}\n */\nexport const TreeGrid = forwardRef( UnforwardedTreeGrid );\n\nexport default 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.tsx"],"names":["focus","forwardRef","useCallback","UP","DOWN","LEFT","RIGHT","HOME","END","RovingTabIndexContainer","getRowFocusables","rowElement","focusablesInRow","focusable","find","sequential","filter","closest","UnforwardedTreeGrid","ref","children","onExpandRow","onCollapseRow","onFocusRow","applicationAriaLabel","props","onKeyDown","event","keyCode","metaKey","ctrlKey","altKey","hasModifierKeyPressed","includes","stopPropagation","activeElement","document","currentTarget","treeGridElement","contains","activeRow","currentColumnIndex","indexOf","canExpandCollapse","cannotFocusNextColumn","getAttribute","nextIndex","Math","max","min","length","preventDefault","level","parseInt","rows","Array","from","querySelectorAll","parentRow","currentRowIndex","i","ariaLevel","focusableItems","nextRowIndex","focusablesInNextRow","TreeGrid","default","TreeGridRow","TreeGridCell","TreeGridItem"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,gBAAtB;AACA,SAASC,UAA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A1B+D,CA8B/D;;AACA,UAAK,CAAEC,mBAAF,IAAyB,CAAEA,mBAAmB,CAACd,MAApD,EAA6D;AAC5D;AACA;AACA;AACAvB,QAAAA,KAAK,CAACwB,cAAN;AACA;AACA,OArC8D,CAuC/D;;;AACA,YAAML,SAAS,GAAGC,IAAI,CAACE,GAAL,CACjBR,kBADiB,EAEjBuB,mBAAmB,CAACd,MAApB,GAA6B,CAFZ,CAAlB;AAIAc,MAAAA,mBAAmB,CAAElB,SAAF,CAAnB,CAAiC9C,KAAjC,GA5C+D,CA8C/D;AACA;;AACAuB,MAAAA,UAAU,CAAEI,KAAF,EAASa,SAAT,EAAoBc,IAAI,CAAES,YAAF,CAAxB,CAAV,CAhD+D,CAkD/D;AACA;;AACApC,MAAAA,KAAK,CAACwB,cAAN;AACA;AACD,GAzP2B,EA0P5B,CAAE9B,WAAF,EAAeC,aAAf,EAA8BC,UAA9B,CA1P4B,CAA7B;AA6PA;;AACA;;AACA,SACC,cAAC,uBAAD,QAMC;AAAK,IAAA,IAAI,EAAC,aAAV;AAAwB,kBAAaC;AAArC,KACC,oCACMC,KADN;AAEC,IAAA,IAAI,EAAC,UAFN;AAGC,IAAA,SAAS,EAAGC,SAHb;AAIC,IAAA,GAAG,EAAGP;AAJP,MAMC,6BAASC,QAAT,CAND,CADD,CAND,CADD;AAmBA;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAM6C,QAAQ,GAAGhE,UAAU,CAAEiB,mBAAF,CAA3B;AAEP,eAAe+C,QAAf;AACA,SAASC,OAAO,IAAIC,WAApB,QAAuC,OAAvC;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,QAAxC;AACA,SAASF,OAAO,IAAIG,YAApB,QAAwC,QAAxC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { forwardRef, useCallback } from '@wordpress/element';\nimport { UP, DOWN, LEFT, RIGHT, HOME, END } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport RovingTabIndexContainer from './roving-tab-index';\nimport type { TreeGridProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\n/**\n * Return focusables in a row element, excluding those from other branches\n * nested within the row.\n *\n * @param rowElement The DOM element representing the row.\n *\n * @return The array of focusables in the row.\n */\nfunction getRowFocusables( rowElement: HTMLElement ) {\n\tconst focusablesInRow = focus.focusable.find( rowElement, {\n\t\tsequential: true,\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 */\nfunction UnforwardedTreeGrid(\n\t{\n\t\tchildren,\n\t\tonExpandRow = () => {},\n\t\tonCollapseRow = () => {},\n\t\tonFocusRow = () => {},\n\t\tapplicationAriaLabel,\n\t\t...props\n\t}: WordPressComponentProps< TreeGridProps, 'table', false >,\n\t/** A ref to the underlying DOM table element. */\n\tref: React.ForwardedRef< HTMLTableElement >\n) {\n\tconst onKeyDown = useCallback(\n\t\t( event: React.KeyboardEvent< HTMLTableElement > ) => {\n\t\t\tconst { keyCode, metaKey, ctrlKey, altKey } = event;\n\n\t\t\t// The shift key is intentionally absent from the following list,\n\t\t\t// to enable shift + up/down to select items from the list.\n\t\t\tconst hasModifierKeyPressed = metaKey || ctrlKey || altKey;\n\n\t\t\tif (\n\t\t\t\thasModifierKeyPressed ||\n\t\t\t\t! ( [ UP, DOWN, LEFT, RIGHT, HOME, END ] as number[] ).includes(\n\t\t\t\t\tkeyCode\n\t\t\t\t)\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\n\t\t\tif (\n\t\t\t\t! activeElement ||\n\t\t\t\t! treeGridElement.contains( activeElement )\n\t\t\t) {\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 =\n\t\t\t\tactiveElement.closest< HTMLElement >( '[role=\"row\"]' );\n\n\t\t\tif ( ! activeRow ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst focusablesInRow = getRowFocusables( activeRow );\n\t\t\tconst currentColumnIndex = focusablesInRow.indexOf(\n\t\t\t\tactiveElement as HTMLElement\n\t\t\t);\n\t\t\tconst canExpandCollapse = 0 === currentColumnIndex;\n\t\t\tconst cannotFocusNextColumn =\n\t\t\t\tcanExpandCollapse &&\n\t\t\t\t( activeRow.getAttribute( 'data-expanded' ) === 'false' ||\n\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'false' ) &&\n\t\t\t\tkeyCode === RIGHT;\n\n\t\t\tif ( ( [ LEFT, RIGHT ] as number[] ).includes( 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( 'data-expanded' ) ===\n\t\t\t\t\t\t\t\t'true' ||\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< HTMLElement >(\n\t\t\t\t\t\t\t\t'[role=\"row\"]'\n\t\t\t\t\t\t\t)\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\tconst ariaLevel =\n\t\t\t\t\t\t\t\trows[ i ].getAttribute( 'aria-level' );\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tariaLevel !== null &&\n\t\t\t\t\t\t\t\tparseInt( 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( 'data-expanded' ) ===\n\t\t\t\t\t\t\t\t'false' ||\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) ===\n\t\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 next 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[ nextIndex ]?.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 ( ( [ UP, DOWN ] as number[] ).includes( 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< HTMLElement >(\n\t\t\t\t\t\t'[role=\"row\"]'\n\t\t\t\t\t)\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// Let consumers know the row that was originally focused,\n\t\t\t\t// and the row that is now in focus.\n\t\t\t\tonFocusRow( event, activeRow, rows[ nextRowIndex ] );\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 ( ( [ HOME, END ] as number[] ).includes( 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< HTMLElement >(\n\t\t\t\t\t\t'[role=\"row\"]'\n\t\t\t\t\t)\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 === HOME ) {\n\t\t\t\t\tnextRowIndex = 0;\n\t\t\t\t} else {\n\t\t\t\t\tnextRowIndex = rows.length - 1;\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// Let consumers know the row that was originally focused,\n\t\t\t\t// and the row that is now in focus.\n\t\t\t\tonFocusRow( event, activeRow, rows[ nextRowIndex ] );\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, onFocusRow ]\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{\n\t\t\t\t// Prevent browser mode from triggering in NVDA by wrapping List View\n\t\t\t\t// in a role=application wrapper.\n\t\t\t\t// see: https://github.com/WordPress/gutenberg/issues/43729\n\t\t\t }\n\t\t\t<div role=\"application\" aria-label={ applicationAriaLabel }>\n\t\t\t\t<table\n\t\t\t\t\t{ ...props }\n\t\t\t\t\trole=\"treegrid\"\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t\tref={ ref }\n\t\t\t\t>\n\t\t\t\t\t<tbody>{ children }</tbody>\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t</RovingTabIndexContainer>\n\t);\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\n/**\n * `TreeGrid` is used to create a tree hierarchy.\n * It is not a visually styled component, but instead helps with adding\n * keyboard navigation and roving tab index behaviors to tree grid structures.\n *\n * A tree grid is a hierarchical 2 dimensional UI component, for example it could be\n * used to implement a file system browser.\n *\n * A tree grid allows the user to navigate using arrow keys.\n * Up/down to navigate vertically across rows, and left/right to navigate horizontally\n * between focusables in a row.\n *\n * The `TreeGrid` renders both a `table` and `tbody` element, and is intended to be used\n * with `TreeGridRow` (`tr`) and `TreeGridCell` (`td`) to build out a grid.\n *\n * ```jsx\n * function TreeMenu() {\n * \treturn (\n * \t\t<TreeGrid>\n * \t\t\t<TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 2 }>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onSelect } { ...props }>Select</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onMove } { ...props }>Move</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t</TreeGridRow>\n * \t\t\t<TreeGridRow level={ 1 } positionInSet={ 2 } setSize={ 2 }>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onSelect } { ...props }>Select</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onMove } { ...props }>Move</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t</TreeGridRow>\n * \t\t\t<TreeGridRow level={ 2 } positionInSet={ 1 } setSize={ 1 }>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onSelect } { ...props }>Select</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onMove } { ...props }>Move</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t</TreeGridRow>\n * \t\t</TreeGrid>\n * \t);\n * }\n * ```\n *\n * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}\n */\nexport const TreeGrid = forwardRef( UnforwardedTreeGrid );\n\nexport default TreeGrid;\nexport { default as TreeGridRow } from './row';\nexport { default as TreeGridCell } from './cell';\nexport { default as TreeGridItem } from './item';\n"]}
@@ -29,11 +29,11 @@ const ALERT = {
29
29
  yellow: '#f0b849',
30
30
  red: '#d94f4f',
31
31
  green: '#4ab866'
32
- }; // Matches @wordpress/base-styles
32
+ }; // Matches the Modern admin scheme in @wordpress/base-styles
33
33
 
34
34
  const ADMIN = {
35
- theme: 'var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba))',
36
- themeDark10: 'var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #006ba1))'
35
+ theme: 'var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9))',
36
+ themeDark10: 'var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))'
37
37
  };
38
38
  const UI = {
39
39
  theme: ADMIN.theme,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/colors-values.js"],"names":["rgba","white","GRAY","ALERT","yellow","red","green","ADMIN","theme","themeDark10","UI","background","backgroundDisabled","border","borderHover","borderFocus","borderDisabled","textDisabled","textDark","darkGrayPlaceholder","lightGrayPlaceholder","COLORS","Object","freeze","gray","alert","ui"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,UAArB;AAEA,MAAMC,KAAK,GAAG,MAAd,C,CAEA;;AACA,MAAMC,IAAI,GAAG;AACZ,OAAK,SADO;AAEZ,OAAK,SAFO;;AAGZ;AACA,OAAK,SAJO;;AAKZ;AACA,OAAK,SANO;AAOZ,OAAK,MAPO;;AAQZ;AACA,OAAK,MATO;;AAUZ;AACA,OAAK,SAXO;;AAYZ;AACA,OAAK;AAbO,CAAb,C,CAgBA;;AACA,MAAMC,KAAK,GAAG;AACbC,EAAAA,MAAM,EAAE,SADK;AAEbC,EAAAA,GAAG,EAAE,SAFQ;AAGbC,EAAAA,KAAK,EAAE;AAHM,CAAd,C,CAMA;;AACA,MAAMC,KAAK,GAAG;AACbC,EAAAA,KAAK,EAAE,yEADM;AAEbC,EAAAA,WAAW,EACV;AAHY,CAAd;AAMA,MAAMC,EAAE,GAAG;AACVF,EAAAA,KAAK,EAAED,KAAK,CAACC,KADH;AAEVC,EAAAA,WAAW,EAAEF,KAAK,CAACE,WAFT;AAGVE,EAAAA,UAAU,EAAEV,KAHF;AAIVW,EAAAA,kBAAkB,EAAEV,IAAI,CAAE,GAAF,CAJd;AAKVW,EAAAA,MAAM,EAAEX,IAAI,CAAE,GAAF,CALF;AAMVY,EAAAA,WAAW,EAAEZ,IAAI,CAAE,GAAF,CANP;AAOVa,EAAAA,WAAW,EAAER,KAAK,CAACE,WAPT;AAQVO,EAAAA,cAAc,EAAEd,IAAI,CAAE,GAAF,CARV;AASVe,EAAAA,YAAY,EAAEf,IAAI,CAAE,GAAF,CATR;AAUVgB,EAAAA,QAAQ,EAAEjB,KAVA;AAYV;AACAkB,EAAAA,mBAAmB,EAAEnB,IAAI,CAAEE,IAAI,CAAE,GAAF,CAAN,EAAe,IAAf,CAbf;AAcVkB,EAAAA,oBAAoB,EAAEpB,IAAI,CAAEC,KAAF,EAAS,IAAT;AAdhB,CAAX;AAiBA,OAAO,MAAMoB,MAAM,GAAGC,MAAM,CAACC,MAAP,CAAe;AACpC;AACD;AACA;AACCC,EAAAA,IAAI,EAAEtB,IAJ8B;AAKpCD,EAAAA,KALoC;AAMpCwB,EAAAA,KAAK,EAAEtB,KAN6B;AAOpCuB,EAAAA,EAAE,EAAEhB;AAPgC,CAAf,CAAf;AAUP,eAAeW,MAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { rgba } from './colors';\n\nconst white = '#fff';\n\n// Matches the grays in @wordpress/base-styles\nconst GRAY = {\n\t900: '#1e1e1e',\n\t800: '#2f2f2f',\n\t/** Meets 4.6:1 text contrast against white. */\n\t700: '#757575',\n\t/** Meets 3:1 UI or large text contrast against white. */\n\t600: '#949494',\n\t400: '#ccc',\n\t/** Used for most borders. */\n\t300: '#ddd',\n\t/** Used sparingly for light borders. */\n\t200: '#e0e0e0',\n\t/** Used for light gray backgrounds. */\n\t100: '#f0f0f0',\n};\n\n// Matches @wordpress/base-styles\nconst ALERT = {\n\tyellow: '#f0b849',\n\tred: '#d94f4f',\n\tgreen: '#4ab866',\n};\n\n// Matches @wordpress/base-styles\nconst ADMIN = {\n\ttheme: 'var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba))',\n\tthemeDark10:\n\t\t'var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #006ba1))',\n};\n\nconst UI = {\n\ttheme: ADMIN.theme,\n\tthemeDark10: ADMIN.themeDark10,\n\tbackground: white,\n\tbackgroundDisabled: GRAY[ 100 ],\n\tborder: GRAY[ 600 ],\n\tborderHover: GRAY[ 700 ],\n\tborderFocus: ADMIN.themeDark10,\n\tborderDisabled: GRAY[ 400 ],\n\ttextDisabled: GRAY[ 600 ],\n\ttextDark: white,\n\n\t// Matches @wordpress/base-styles\n\tdarkGrayPlaceholder: rgba( GRAY[ 900 ], 0.62 ),\n\tlightGrayPlaceholder: rgba( white, 0.65 ),\n};\n\nexport const COLORS = Object.freeze( {\n\t/**\n\t * The main gray color object.\n\t */\n\tgray: GRAY,\n\twhite,\n\talert: ALERT,\n\tui: UI,\n} );\n\nexport default COLORS;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/utils/colors-values.js"],"names":["rgba","white","GRAY","ALERT","yellow","red","green","ADMIN","theme","themeDark10","UI","background","backgroundDisabled","border","borderHover","borderFocus","borderDisabled","textDisabled","textDark","darkGrayPlaceholder","lightGrayPlaceholder","COLORS","Object","freeze","gray","alert","ui"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,UAArB;AAEA,MAAMC,KAAK,GAAG,MAAd,C,CAEA;;AACA,MAAMC,IAAI,GAAG;AACZ,OAAK,SADO;AAEZ,OAAK,SAFO;;AAGZ;AACA,OAAK,SAJO;;AAKZ;AACA,OAAK,SANO;AAOZ,OAAK,MAPO;;AAQZ;AACA,OAAK,MATO;;AAUZ;AACA,OAAK,SAXO;;AAYZ;AACA,OAAK;AAbO,CAAb,C,CAgBA;;AACA,MAAMC,KAAK,GAAG;AACbC,EAAAA,MAAM,EAAE,SADK;AAEbC,EAAAA,GAAG,EAAE,SAFQ;AAGbC,EAAAA,KAAK,EAAE;AAHM,CAAd,C,CAMA;;AACA,MAAMC,KAAK,GAAG;AACbC,EAAAA,KAAK,EAAE,yEADM;AAEbC,EAAAA,WAAW,EACV;AAHY,CAAd;AAMA,MAAMC,EAAE,GAAG;AACVF,EAAAA,KAAK,EAAED,KAAK,CAACC,KADH;AAEVC,EAAAA,WAAW,EAAEF,KAAK,CAACE,WAFT;AAGVE,EAAAA,UAAU,EAAEV,KAHF;AAIVW,EAAAA,kBAAkB,EAAEV,IAAI,CAAE,GAAF,CAJd;AAKVW,EAAAA,MAAM,EAAEX,IAAI,CAAE,GAAF,CALF;AAMVY,EAAAA,WAAW,EAAEZ,IAAI,CAAE,GAAF,CANP;AAOVa,EAAAA,WAAW,EAAER,KAAK,CAACE,WAPT;AAQVO,EAAAA,cAAc,EAAEd,IAAI,CAAE,GAAF,CARV;AASVe,EAAAA,YAAY,EAAEf,IAAI,CAAE,GAAF,CATR;AAUVgB,EAAAA,QAAQ,EAAEjB,KAVA;AAYV;AACAkB,EAAAA,mBAAmB,EAAEnB,IAAI,CAAEE,IAAI,CAAE,GAAF,CAAN,EAAe,IAAf,CAbf;AAcVkB,EAAAA,oBAAoB,EAAEpB,IAAI,CAAEC,KAAF,EAAS,IAAT;AAdhB,CAAX;AAiBA,OAAO,MAAMoB,MAAM,GAAGC,MAAM,CAACC,MAAP,CAAe;AACpC;AACD;AACA;AACCC,EAAAA,IAAI,EAAEtB,IAJ8B;AAKpCD,EAAAA,KALoC;AAMpCwB,EAAAA,KAAK,EAAEtB,KAN6B;AAOpCuB,EAAAA,EAAE,EAAEhB;AAPgC,CAAf,CAAf;AAUP,eAAeW,MAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { rgba } from './colors';\n\nconst white = '#fff';\n\n// Matches the grays in @wordpress/base-styles\nconst GRAY = {\n\t900: '#1e1e1e',\n\t800: '#2f2f2f',\n\t/** Meets 4.6:1 text contrast against white. */\n\t700: '#757575',\n\t/** Meets 3:1 UI or large text contrast against white. */\n\t600: '#949494',\n\t400: '#ccc',\n\t/** Used for most borders. */\n\t300: '#ddd',\n\t/** Used sparingly for light borders. */\n\t200: '#e0e0e0',\n\t/** Used for light gray backgrounds. */\n\t100: '#f0f0f0',\n};\n\n// Matches @wordpress/base-styles\nconst ALERT = {\n\tyellow: '#f0b849',\n\tred: '#d94f4f',\n\tgreen: '#4ab866',\n};\n\n// Matches the Modern admin scheme in @wordpress/base-styles\nconst ADMIN = {\n\ttheme: 'var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9))',\n\tthemeDark10:\n\t\t'var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))',\n};\n\nconst UI = {\n\ttheme: ADMIN.theme,\n\tthemeDark10: ADMIN.themeDark10,\n\tbackground: white,\n\tbackgroundDisabled: GRAY[ 100 ],\n\tborder: GRAY[ 600 ],\n\tborderHover: GRAY[ 700 ],\n\tborderFocus: ADMIN.themeDark10,\n\tborderDisabled: GRAY[ 400 ],\n\ttextDisabled: GRAY[ 600 ],\n\ttextDark: white,\n\n\t// Matches @wordpress/base-styles\n\tdarkGrayPlaceholder: rgba( GRAY[ 900 ], 0.62 ),\n\tlightGrayPlaceholder: rgba( white, 0.65 ),\n};\n\nexport const COLORS = Object.freeze( {\n\t/**\n\t * The main gray color object.\n\t */\n\tgray: GRAY,\n\twhite,\n\talert: ALERT,\n\tui: UI,\n} );\n\nexport default COLORS;\n"]}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import deprecated from '@wordpress/deprecated';
5
+ export function useDeprecated36pxDefaultSizeProp(props,
6
+ /** The component identifier in dot notation, e.g. `wp.components.ComponentName`. */
7
+ componentIdentifier) {
8
+ const {
9
+ __next36pxDefaultSize,
10
+ __next40pxDefaultSize,
11
+ ...otherProps
12
+ } = props;
13
+
14
+ if (typeof __next36pxDefaultSize !== 'undefined') {
15
+ deprecated('`__next36pxDefaultSize` prop in ' + componentIdentifier, {
16
+ alternative: '`__next40pxDefaultSize`',
17
+ since: '6.3'
18
+ });
19
+ }
20
+
21
+ return { ...otherProps,
22
+ __next40pxDefaultSize: __next40pxDefaultSize !== null && __next40pxDefaultSize !== void 0 ? __next40pxDefaultSize : __next36pxDefaultSize
23
+ };
24
+ }
25
+ //# sourceMappingURL=use-deprecated-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/components/src/utils/use-deprecated-props.ts"],"names":["deprecated","useDeprecated36pxDefaultSizeProp","props","componentIdentifier","__next36pxDefaultSize","__next40pxDefaultSize","otherProps","alternative","since"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,uBAAvB;AAEA,OAAO,SAASC,gCAAT,CAMNC,KANM;AAON;AACAC,mBARM,EASL;AACD,QAAM;AAAEC,IAAAA,qBAAF;AAAyBC,IAAAA,qBAAzB;AAAgD,OAAGC;AAAnD,MACLJ,KADD;;AAEA,MAAK,OAAOE,qBAAP,KAAiC,WAAtC,EAAoD;AACnDJ,IAAAA,UAAU,CAAE,qCAAqCG,mBAAvC,EAA4D;AACrEI,MAAAA,WAAW,EAAE,yBADwD;AAErEC,MAAAA,KAAK,EAAE;AAF8D,KAA5D,CAAV;AAIA;;AAED,SAAO,EACN,GAAGF,UADG;AAEND,IAAAA,qBAAqB,EAAEA,qBAAF,aAAEA,qBAAF,cAAEA,qBAAF,GAA2BD;AAF1C,GAAP;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\nexport function useDeprecated36pxDefaultSizeProp<\n\tP extends Record< string, any > & {\n\t\t__next36pxDefaultSize?: boolean;\n\t\t__next40pxDefaultSize?: boolean;\n\t}\n>(\n\tprops: P,\n\t/** The component identifier in dot notation, e.g. `wp.components.ComponentName`. */\n\tcomponentIdentifier: string\n) {\n\tconst { __next36pxDefaultSize, __next40pxDefaultSize, ...otherProps } =\n\t\tprops;\n\tif ( typeof __next36pxDefaultSize !== 'undefined' ) {\n\t\tdeprecated( '`__next36pxDefaultSize` prop in ' + componentIdentifier, {\n\t\t\talternative: '`__next40pxDefaultSize`',\n\t\t\tsince: '6.3',\n\t\t} );\n\t}\n\n\treturn {\n\t\t...otherProps,\n\t\t__next40pxDefaultSize: __next40pxDefaultSize ?? __next36pxDefaultSize,\n\t};\n}\n"]}
@@ -21,13 +21,12 @@ import _styled from "@emotion/styled/base";
21
21
  * }
22
22
  * ```
23
23
  */
24
- // @ts-expect-error
25
24
  export const View = _styled("div", process.env.NODE_ENV === "production" ? {
26
25
  target: "e19lxcc00"
27
26
  } : {
28
27
  target: "e19lxcc00",
29
28
  label: "View"
30
- })(process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdmlldy9jb21wb25lbnQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWlDYyIsImZpbGUiOiJAd29yZHByZXNzL2NvbXBvbmVudHMvc3JjL3ZpZXcvY29tcG9uZW50LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB0eXBlIHsgUmVmQXR0cmlidXRlcyB9IGZyb20gJ3JlYWN0JztcblxuLyoqXG4gKiBJbnRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHR5cGUgeyBXb3JkUHJlc3NDb21wb25lbnQgfSBmcm9tICcuLi91aS9jb250ZXh0L3dvcmRwcmVzcy1jb21wb25lbnQnO1xuaW1wb3J0IHR5cGUgeyBWaWV3UHJvcHMgfSBmcm9tICcuL3R5cGVzJztcblxuLyoqXG4gKiBgVmlld2AgaXMgYSBjb3JlIGNvbXBvbmVudCB0aGF0IHJlbmRlcnMgZXZlcnl0aGluZyBpbiB0aGUgbGlicmFyeS5cbiAqIEl0IGlzIHRoZSBwcmluY2lwbGUgY29tcG9uZW50IGluIHRoZSBlbnRpcmUgbGlicmFyeS5cbiAqXG4gKiBAZXhhbXBsZVxuICogYGBganN4XG4gKiBpbXBvcnQgeyBWaWV3IH0gZnJvbSBgQHdvcmRwcmVzcy9jb21wb25lbnRzYDtcbiAqXG4gKiBmdW5jdGlvbiBFeGFtcGxlKCkge1xuICogXHRyZXR1cm4gKFxuICogXHRcdDxWaWV3PlxuICogXHRcdFx0IENvZGUgaXMgUG9ldHJ5XG4gKiBcdFx0PC9WaWV3PlxuICogXHQpO1xuICogfVxuICogYGBgXG4gKi9cbi8vIEB0cy1leHBlY3QtZXJyb3JcbmV4cG9ydCBjb25zdCBWaWV3OiBXb3JkUHJlc3NDb21wb25lbnQ8XG5cdCdkaXYnLFxuXHRWaWV3UHJvcHMgJiBSZWZBdHRyaWJ1dGVzPCBhbnkgPlxuPiA9IHN0eWxlZC5kaXZgYDtcblxuVmlldy5zZWxlY3RvciA9ICcuY29tcG9uZW50cy12aWV3JztcblZpZXcuZGlzcGxheU5hbWUgPSAnVmlldyc7XG5cbmV4cG9ydCBkZWZhdWx0IFZpZXc7XG4iXX0= */");
29
+ })(process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdmlldy9jb21wb25lbnQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWlDYyIsImZpbGUiOiJAd29yZHByZXNzL2NvbXBvbmVudHMvc3JjL3ZpZXcvY29tcG9uZW50LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB0eXBlIHsgUmVmQXR0cmlidXRlcyB9IGZyb20gJ3JlYWN0JztcblxuLyoqXG4gKiBJbnRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHR5cGUgeyBXb3JkUHJlc3NDb21wb25lbnQgfSBmcm9tICcuLi91aS9jb250ZXh0L3dvcmRwcmVzcy1jb21wb25lbnQnO1xuaW1wb3J0IHR5cGUgeyBWaWV3UHJvcHMgfSBmcm9tICcuL3R5cGVzJztcblxuLyoqXG4gKiBgVmlld2AgaXMgYSBjb3JlIGNvbXBvbmVudCB0aGF0IHJlbmRlcnMgZXZlcnl0aGluZyBpbiB0aGUgbGlicmFyeS5cbiAqIEl0IGlzIHRoZSBwcmluY2lwbGUgY29tcG9uZW50IGluIHRoZSBlbnRpcmUgbGlicmFyeS5cbiAqXG4gKiBAZXhhbXBsZVxuICogYGBganN4XG4gKiBpbXBvcnQgeyBWaWV3IH0gZnJvbSBgQHdvcmRwcmVzcy9jb21wb25lbnRzYDtcbiAqXG4gKiBmdW5jdGlvbiBFeGFtcGxlKCkge1xuICogXHRyZXR1cm4gKFxuICogXHRcdDxWaWV3PlxuICogXHRcdFx0IENvZGUgaXMgUG9ldHJ5XG4gKiBcdFx0PC9WaWV3PlxuICogXHQpO1xuICogfVxuICogYGBgXG4gKi9cbmV4cG9ydCBjb25zdCBWaWV3OiBXb3JkUHJlc3NDb21wb25lbnQ8XG5cdCdkaXYnLFxuXHRWaWV3UHJvcHMgJiBSZWZBdHRyaWJ1dGVzPCBhbnkgPixcblx0dHJ1ZVxuPiA9IHN0eWxlZC5kaXZgYDtcblxuVmlldy5zZWxlY3RvciA9ICcuY29tcG9uZW50cy12aWV3JztcblZpZXcuZGlzcGxheU5hbWUgPSAnVmlldyc7XG5cbmV4cG9ydCBkZWZhdWx0IFZpZXc7XG4iXX0= */");
31
30
  View.selector = '.components-view';
32
31
  View.displayName = 'View';
33
32
  export default View;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/view/component.tsx"],"names":["View","selector","displayName"],"mappings":";;AAAA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,IAGZ;AAAA;AAAA;AAAA;AAAA;AAAA,k8CAHM;AAKPA,IAAI,CAACC,QAAL,GAAgB,kBAAhB;AACAD,IAAI,CAACE,WAAL,GAAmB,MAAnB;AAEA,eAAeF,IAAf","sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\nimport type { RefAttributes } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponent } from '../ui/context/wordpress-component';\nimport type { ViewProps } from './types';\n\n/**\n * `View` is a core component that renders everything in the library.\n * It is the principle component in the entire library.\n *\n * @example\n * ```jsx\n * import { View } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<View>\n * \t\t\t Code is Poetry\n * \t\t</View>\n * \t);\n * }\n * ```\n */\n// @ts-expect-error\nexport const View: WordPressComponent<\n\t'div',\n\tViewProps & RefAttributes< any >\n> = styled.div``;\n\nView.selector = '.components-view';\nView.displayName = 'View';\n\nexport default View;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/view/component.tsx"],"names":["View","selector","displayName"],"mappings":";;AAAA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,IAIZ;AAAA;AAAA;AAAA;AAAA;AAAA,k7CAJM;AAMPA,IAAI,CAACC,QAAL,GAAgB,kBAAhB;AACAD,IAAI,CAACE,WAAL,GAAmB,MAAnB;AAEA,eAAeF,IAAf","sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\nimport type { RefAttributes } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponent } from '../ui/context/wordpress-component';\nimport type { ViewProps } from './types';\n\n/**\n * `View` is a core component that renders everything in the library.\n * It is the principle component in the entire library.\n *\n * @example\n * ```jsx\n * import { View } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<View>\n * \t\t\t Code is Poetry\n * \t\t</View>\n * \t);\n * }\n * ```\n */\nexport const View: WordPressComponent<\n\t'div',\n\tViewProps & RefAttributes< any >,\n\ttrue\n> = styled.div``;\n\nView.selector = '.components-view';\nView.displayName = 'View';\n\nexport default View;\n"]}