@wordpress/components 19.4.1 → 19.5.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 (396) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/CONTRIBUTING.md +69 -2
  3. package/build/box-control/unit-control.js +2 -2
  4. package/build/box-control/unit-control.js.map +1 -1
  5. package/build/card/card/component.js +2 -2
  6. package/build/card/card/component.js.map +1 -1
  7. package/build/card/card-body/component.js +1 -1
  8. package/build/card/card-body/component.js.map +1 -1
  9. package/build/card/card-divider/component.js +1 -1
  10. package/build/card/card-divider/component.js.map +1 -1
  11. package/build/card/card-footer/component.js +1 -1
  12. package/build/card/card-footer/component.js.map +1 -1
  13. package/build/card/card-header/component.js +1 -1
  14. package/build/card/card-header/component.js.map +1 -1
  15. package/build/card/card-media/component.js +1 -1
  16. package/build/card/card-media/component.js.map +1 -1
  17. package/build/color-palette/index.native.js +35 -30
  18. package/build/color-palette/index.native.js.map +1 -1
  19. package/build/color-picker/component.js.map +1 -1
  20. package/build/color-picker/hex-input.js +6 -9
  21. package/build/color-picker/hex-input.js.map +1 -1
  22. package/build/confirm-dialog/component.js.map +1 -1
  23. package/build/divider/component.js.map +1 -1
  24. package/build/elevation/component.js +1 -1
  25. package/build/elevation/component.js.map +1 -1
  26. package/build/flex/flex/component.js +1 -1
  27. package/build/flex/flex/component.js.map +1 -1
  28. package/build/flex/flex-block/component.js +1 -1
  29. package/build/flex/flex-block/component.js.map +1 -1
  30. package/build/flex/flex-item/component.js +1 -1
  31. package/build/flex/flex-item/component.js.map +1 -1
  32. package/build/flyout/flyout/component.js +1 -1
  33. package/build/flyout/flyout/component.js.map +1 -1
  34. package/build/flyout/flyout-content/component.js +1 -1
  35. package/build/flyout/flyout-content/component.js.map +1 -1
  36. package/build/focal-point-picker/index.js +18 -12
  37. package/build/focal-point-picker/index.js.map +1 -1
  38. package/build/font-size-picker/index.js +0 -1
  39. package/build/font-size-picker/index.js.map +1 -1
  40. package/build/grid/component.js +1 -1
  41. package/build/grid/component.js.map +1 -1
  42. package/build/h-stack/component.js +1 -1
  43. package/build/h-stack/component.js.map +1 -1
  44. package/build/heading/component.js.map +1 -1
  45. package/build/index.js +12 -0
  46. package/build/index.js.map +1 -1
  47. package/build/index.native.js +15 -1
  48. package/build/index.native.js.map +1 -1
  49. package/build/input-control/index.js.map +1 -1
  50. package/build/input-control/input-base.js.map +1 -1
  51. package/build/input-control/input-field.js +7 -7
  52. package/build/input-control/input-field.js.map +1 -1
  53. package/build/input-control/reducer/reducer.js +3 -0
  54. package/build/input-control/reducer/reducer.js.map +1 -1
  55. package/build/item-group/item/component.js.map +1 -1
  56. package/build/item-group/item-group/component.js.map +1 -1
  57. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  58. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  59. package/build/mobile/color-settings/palette.screen.native.js +26 -9
  60. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  61. package/build/mobile/global-styles-context/utils.native.js +63 -9
  62. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  63. package/build/navigator/index.js +16 -0
  64. package/build/navigator/index.js.map +1 -1
  65. package/build/navigator/navigator-back-button/component.js +72 -0
  66. package/build/navigator/navigator-back-button/component.js.map +1 -0
  67. package/build/navigator/navigator-back-button/hook.js +49 -0
  68. package/build/navigator/navigator-back-button/hook.js.map +1 -0
  69. package/build/navigator/navigator-back-button/index.js +16 -0
  70. package/build/navigator/navigator-back-button/index.js.map +1 -0
  71. package/build/navigator/navigator-button/component.js +71 -0
  72. package/build/navigator/navigator-button/component.js.map +1 -0
  73. package/build/navigator/navigator-button/hook.js +59 -0
  74. package/build/navigator/navigator-button/hook.js.map +1 -0
  75. package/build/navigator/navigator-button/index.js +16 -0
  76. package/build/navigator/navigator-button/index.js.map +1 -0
  77. package/build/navigator/navigator-provider/component.js +11 -21
  78. package/build/navigator/navigator-provider/component.js.map +1 -1
  79. package/build/navigator/navigator-screen/component.js +14 -22
  80. package/build/navigator/navigator-screen/component.js.map +1 -1
  81. package/build/resizable-box/index.js.map +1 -1
  82. package/build/resizable-box/resize-tooltip/index.js.map +1 -1
  83. package/build/resizable-box/resize-tooltip/label.js.map +1 -1
  84. package/build/scrollable/component.js +1 -1
  85. package/build/scrollable/component.js.map +1 -1
  86. package/build/select-control/index.js.map +1 -1
  87. package/build/spacer/component.js.map +1 -1
  88. package/build/surface/component.js +1 -1
  89. package/build/surface/component.js.map +1 -1
  90. package/build/text/component.js +1 -1
  91. package/build/text/component.js.map +1 -1
  92. package/build/text-control/index.js +2 -2
  93. package/build/text-control/index.js.map +1 -1
  94. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  95. package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  96. package/build/tools-panel/tools-panel/component.js.map +1 -1
  97. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  98. package/build/tools-panel/tools-panel-item/component.js.map +1 -1
  99. package/build/tree-grid/index.js +50 -6
  100. package/build/tree-grid/index.js.map +1 -1
  101. package/build/truncate/component.js +1 -1
  102. package/build/truncate/component.js.map +1 -1
  103. package/build/ui/control-group/component.js +1 -1
  104. package/build/ui/control-group/component.js.map +1 -1
  105. package/build/ui/control-label/component.js +1 -1
  106. package/build/ui/control-label/component.js.map +1 -1
  107. package/build/ui/form-group/form-group.js +1 -1
  108. package/build/ui/form-group/form-group.js.map +1 -1
  109. package/build/ui/shortcut/component.js.map +1 -1
  110. package/build/ui/spinner/component.js +1 -1
  111. package/build/ui/spinner/component.js.map +1 -1
  112. package/build/ui/tooltip/component.js +1 -1
  113. package/build/ui/tooltip/component.js.map +1 -1
  114. package/build/ui/tooltip/content.js +1 -1
  115. package/build/ui/tooltip/content.js.map +1 -1
  116. package/build/unit-control/index.js.map +1 -1
  117. package/build/v-stack/component.js +1 -1
  118. package/build/v-stack/component.js.map +1 -1
  119. package/build/visually-hidden/component.js +1 -1
  120. package/build/visually-hidden/component.js.map +1 -1
  121. package/build/z-stack/component.js.map +1 -1
  122. package/build-module/box-control/unit-control.js +1 -1
  123. package/build-module/box-control/unit-control.js.map +1 -1
  124. package/build-module/card/card/component.js +2 -2
  125. package/build-module/card/card/component.js.map +1 -1
  126. package/build-module/card/card-body/component.js +1 -1
  127. package/build-module/card/card-body/component.js.map +1 -1
  128. package/build-module/card/card-divider/component.js +1 -1
  129. package/build-module/card/card-divider/component.js.map +1 -1
  130. package/build-module/card/card-footer/component.js +1 -1
  131. package/build-module/card/card-footer/component.js.map +1 -1
  132. package/build-module/card/card-header/component.js +1 -1
  133. package/build-module/card/card-header/component.js.map +1 -1
  134. package/build-module/card/card-media/component.js +1 -1
  135. package/build-module/card/card-media/component.js.map +1 -1
  136. package/build-module/color-palette/index.native.js +36 -31
  137. package/build-module/color-palette/index.native.js.map +1 -1
  138. package/build-module/color-picker/component.js.map +1 -1
  139. package/build-module/color-picker/hex-input.js +6 -9
  140. package/build-module/color-picker/hex-input.js.map +1 -1
  141. package/build-module/confirm-dialog/component.js.map +1 -1
  142. package/build-module/divider/component.js.map +1 -1
  143. package/build-module/elevation/component.js +1 -1
  144. package/build-module/elevation/component.js.map +1 -1
  145. package/build-module/flex/flex/component.js +1 -1
  146. package/build-module/flex/flex/component.js.map +1 -1
  147. package/build-module/flex/flex-block/component.js +1 -1
  148. package/build-module/flex/flex-block/component.js.map +1 -1
  149. package/build-module/flex/flex-item/component.js +1 -1
  150. package/build-module/flex/flex-item/component.js.map +1 -1
  151. package/build-module/flyout/flyout/component.js +1 -1
  152. package/build-module/flyout/flyout/component.js.map +1 -1
  153. package/build-module/flyout/flyout-content/component.js +1 -1
  154. package/build-module/flyout/flyout-content/component.js.map +1 -1
  155. package/build-module/focal-point-picker/index.js +18 -12
  156. package/build-module/focal-point-picker/index.js.map +1 -1
  157. package/build-module/font-size-picker/index.js +0 -1
  158. package/build-module/font-size-picker/index.js.map +1 -1
  159. package/build-module/grid/component.js +1 -1
  160. package/build-module/grid/component.js.map +1 -1
  161. package/build-module/h-stack/component.js +1 -1
  162. package/build-module/h-stack/component.js.map +1 -1
  163. package/build-module/heading/component.js.map +1 -1
  164. package/build-module/index.js +1 -1
  165. package/build-module/index.js.map +1 -1
  166. package/build-module/index.native.js +1 -1
  167. package/build-module/index.native.js.map +1 -1
  168. package/build-module/input-control/index.js.map +1 -1
  169. package/build-module/input-control/input-base.js.map +1 -1
  170. package/build-module/input-control/input-field.js +6 -6
  171. package/build-module/input-control/input-field.js.map +1 -1
  172. package/build-module/input-control/reducer/reducer.js +3 -0
  173. package/build-module/input-control/reducer/reducer.js.map +1 -1
  174. package/build-module/item-group/item/component.js.map +1 -1
  175. package/build-module/item-group/item-group/component.js.map +1 -1
  176. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  177. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  178. package/build-module/mobile/color-settings/palette.screen.native.js +27 -10
  179. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  180. package/build-module/mobile/global-styles-context/utils.native.js +60 -10
  181. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  182. package/build-module/navigator/index.js +2 -0
  183. package/build-module/navigator/index.js.map +1 -1
  184. package/build-module/navigator/navigator-back-button/component.js +59 -0
  185. package/build-module/navigator/navigator-back-button/component.js.map +1 -0
  186. package/build-module/navigator/navigator-back-button/hook.js +36 -0
  187. package/build-module/navigator/navigator-back-button/hook.js.map +1 -0
  188. package/build-module/navigator/navigator-back-button/index.js +2 -0
  189. package/build-module/navigator/navigator-back-button/index.js.map +1 -0
  190. package/build-module/navigator/navigator-button/component.js +58 -0
  191. package/build-module/navigator/navigator-button/component.js.map +1 -0
  192. package/build-module/navigator/navigator-button/hook.js +46 -0
  193. package/build-module/navigator/navigator-button/hook.js.map +1 -0
  194. package/build-module/navigator/navigator-button/index.js +2 -0
  195. package/build-module/navigator/navigator-button/index.js.map +1 -0
  196. package/build-module/navigator/navigator-provider/component.js +11 -21
  197. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  198. package/build-module/navigator/navigator-screen/component.js +13 -22
  199. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  200. package/build-module/resizable-box/index.js.map +1 -1
  201. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  202. package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
  203. package/build-module/scrollable/component.js +1 -1
  204. package/build-module/scrollable/component.js.map +1 -1
  205. package/build-module/select-control/index.js +1 -1
  206. package/build-module/select-control/index.js.map +1 -1
  207. package/build-module/spacer/component.js.map +1 -1
  208. package/build-module/surface/component.js +1 -1
  209. package/build-module/surface/component.js.map +1 -1
  210. package/build-module/text/component.js +1 -1
  211. package/build-module/text/component.js.map +1 -1
  212. package/build-module/text-control/index.js +2 -2
  213. package/build-module/text-control/index.js.map +1 -1
  214. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  215. package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  216. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  217. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  218. package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
  219. package/build-module/tree-grid/index.js +51 -7
  220. package/build-module/tree-grid/index.js.map +1 -1
  221. package/build-module/truncate/component.js +1 -1
  222. package/build-module/truncate/component.js.map +1 -1
  223. package/build-module/ui/control-group/component.js +1 -1
  224. package/build-module/ui/control-group/component.js.map +1 -1
  225. package/build-module/ui/control-label/component.js +1 -1
  226. package/build-module/ui/control-label/component.js.map +1 -1
  227. package/build-module/ui/form-group/form-group.js +1 -1
  228. package/build-module/ui/form-group/form-group.js.map +1 -1
  229. package/build-module/ui/shortcut/component.js.map +1 -1
  230. package/build-module/ui/spinner/component.js +1 -1
  231. package/build-module/ui/spinner/component.js.map +1 -1
  232. package/build-module/ui/tooltip/component.js +1 -1
  233. package/build-module/ui/tooltip/component.js.map +1 -1
  234. package/build-module/ui/tooltip/content.js +1 -1
  235. package/build-module/ui/tooltip/content.js.map +1 -1
  236. package/build-module/unit-control/index.js.map +1 -1
  237. package/build-module/v-stack/component.js +1 -1
  238. package/build-module/v-stack/component.js.map +1 -1
  239. package/build-module/visually-hidden/component.js +1 -1
  240. package/build-module/visually-hidden/component.js.map +1 -1
  241. package/build-module/z-stack/component.js.map +1 -1
  242. package/build-types/card/card-divider/hook.d.ts +0 -1
  243. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  244. package/build-types/color-picker/styles.d.ts +2 -4
  245. package/build-types/color-picker/styles.d.ts.map +1 -1
  246. package/build-types/confirm-dialog/component.d.ts +2 -6
  247. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  248. package/build-types/flyout/flyout/hook.d.ts +0 -1
  249. package/build-types/flyout/flyout/hook.d.ts.map +1 -1
  250. package/build-types/input-control/index.d.ts +3 -3
  251. package/build-types/input-control/index.d.ts.map +1 -1
  252. package/build-types/input-control/input-base.d.ts +2 -2
  253. package/build-types/input-control/input-base.d.ts.map +1 -1
  254. package/build-types/input-control/input-field.d.ts +1 -3
  255. package/build-types/input-control/input-field.d.ts.map +1 -1
  256. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  257. package/build-types/input-control/types.d.ts +1 -1
  258. package/build-types/input-control/types.d.ts.map +1 -1
  259. package/build-types/navigator/index.d.ts +2 -0
  260. package/build-types/navigator/index.d.ts.map +1 -1
  261. package/build-types/navigator/navigator-back-button/component.d.ts +38 -0
  262. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -0
  263. package/build-types/navigator/navigator-back-button/hook.d.ts +282 -0
  264. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -0
  265. package/build-types/navigator/navigator-back-button/index.d.ts +2 -0
  266. package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -0
  267. package/build-types/navigator/navigator-button/component.d.ts +37 -0
  268. package/build-types/navigator/navigator-button/component.d.ts.map +1 -0
  269. package/build-types/navigator/navigator-button/hook.d.ts +282 -0
  270. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -0
  271. package/build-types/navigator/navigator-button/index.d.ts +2 -0
  272. package/build-types/navigator/navigator-button/index.d.ts.map +1 -0
  273. package/build-types/navigator/navigator-provider/component.d.ts +10 -20
  274. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  275. package/build-types/navigator/navigator-screen/component.d.ts +10 -20
  276. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  277. package/build-types/navigator/types.d.ts +21 -0
  278. package/build-types/navigator/types.d.ts.map +1 -1
  279. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  280. package/build-types/resizable-box/index.d.ts +2 -2
  281. package/build-types/resizable-box/index.d.ts.map +1 -1
  282. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  283. package/build-types/select-control/index.d.ts +1 -3
  284. package/build-types/select-control/index.d.ts.map +1 -1
  285. package/build-types/ui/context/wordpress-component.d.ts +2 -6
  286. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  287. package/build-types/unit-control/index.d.ts +1 -3
  288. package/build-types/unit-control/index.d.ts.map +1 -1
  289. package/build-types/z-stack/component.d.ts.map +1 -1
  290. package/package.json +8 -7
  291. package/src/alignment-matrix-control/README.md +4 -0
  292. package/src/alignment-matrix-control/stories/index.js +1 -1
  293. package/src/base-control/stories/index.js +65 -22
  294. package/src/box-control/stories/index.js +4 -1
  295. package/src/box-control/unit-control.js +1 -1
  296. package/src/card/card/component.js +1 -1
  297. package/src/card/card-body/component.js +1 -1
  298. package/src/card/card-divider/component.js +1 -1
  299. package/src/card/card-footer/component.js +1 -1
  300. package/src/card/card-header/component.js +1 -1
  301. package/src/card/card-media/component.js +1 -1
  302. package/src/color-palette/index.native.js +92 -75
  303. package/src/color-palette/style.native.scss +10 -5
  304. package/src/color-picker/component.tsx +2 -2
  305. package/src/color-picker/hex-input.tsx +9 -9
  306. package/src/confirm-dialog/component.tsx +2 -2
  307. package/src/divider/component.tsx +2 -2
  308. package/src/elevation/component.js +1 -1
  309. package/src/flex/flex/component.js +1 -1
  310. package/src/flex/flex-block/component.js +1 -1
  311. package/src/flex/flex-item/component.js +1 -1
  312. package/src/flyout/flyout/component.js +1 -1
  313. package/src/flyout/flyout-content/component.js +1 -1
  314. package/src/focal-point-picker/README.md +7 -0
  315. package/src/focal-point-picker/index.js +12 -7
  316. package/src/focal-point-picker/stories/index.js +30 -0
  317. package/src/focal-point-picker/test/index.js +44 -0
  318. package/src/font-size-picker/index.js +0 -1
  319. package/src/form-file-upload/README.md +1 -1
  320. package/src/form-file-upload/stories/index.js +51 -0
  321. package/src/grid/component.js +1 -1
  322. package/src/h-stack/component.js +1 -1
  323. package/src/heading/component.tsx +2 -2
  324. package/src/index.js +2 -0
  325. package/src/index.native.js +5 -1
  326. package/src/input-control/index.tsx +2 -2
  327. package/src/input-control/input-base.tsx +2 -2
  328. package/src/input-control/input-field.tsx +4 -6
  329. package/src/input-control/reducer/reducer.ts +3 -0
  330. package/src/input-control/stories/index.js +1 -1
  331. package/src/input-control/types.ts +1 -1
  332. package/src/item-group/item/component.tsx +2 -2
  333. package/src/item-group/item-group/component.tsx +2 -2
  334. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +10 -1
  335. package/src/mobile/color-settings/palette.screen.native.js +39 -9
  336. package/src/mobile/color-settings/style.native.scss +4 -0
  337. package/src/mobile/global-styles-context/test/fixtures/theme.native.js +27 -0
  338. package/src/mobile/global-styles-context/test/utils.native.js +2 -2
  339. package/src/mobile/global-styles-context/utils.native.js +75 -6
  340. package/src/navigation/stories/index.js +1 -1
  341. package/src/navigator/index.ts +2 -0
  342. package/src/navigator/navigator-back-button/README.md +31 -0
  343. package/src/navigator/navigator-back-button/component.tsx +62 -0
  344. package/src/navigator/navigator-back-button/hook.ts +40 -0
  345. package/src/navigator/navigator-back-button/index.ts +1 -0
  346. package/src/navigator/navigator-button/README.md +38 -0
  347. package/src/navigator/navigator-button/component.tsx +61 -0
  348. package/src/navigator/navigator-button/hook.ts +55 -0
  349. package/src/navigator/navigator-button/index.ts +1 -0
  350. package/src/navigator/navigator-provider/README.md +20 -33
  351. package/src/navigator/navigator-provider/component.tsx +12 -22
  352. package/src/navigator/navigator-screen/README.md +1 -1
  353. package/src/navigator/navigator-screen/component.tsx +14 -23
  354. package/src/navigator/stories/index.js +24 -37
  355. package/src/navigator/test/index.js +89 -34
  356. package/src/navigator/types.ts +26 -0
  357. package/src/number-control/stories/index.js +1 -1
  358. package/src/radio/stories/index.js +1 -1
  359. package/src/radio-group/stories/index.js +4 -1
  360. package/src/resizable-box/index.tsx +2 -2
  361. package/src/resizable-box/resize-tooltip/index.tsx +2 -2
  362. package/src/resizable-box/resize-tooltip/label.tsx +2 -2
  363. package/src/scrollable/component.js +1 -1
  364. package/src/select-control/index.tsx +2 -3
  365. package/src/spacer/component.tsx +2 -2
  366. package/src/surface/component.js +1 -1
  367. package/src/text/component.js +1 -1
  368. package/src/text-control/index.js +2 -2
  369. package/src/toggle-group-control/stories/index.js +1 -1
  370. package/src/toggle-group-control/toggle-group-control/component.tsx +2 -2
  371. package/src/toggle-group-control/toggle-group-control-option/component.tsx +2 -2
  372. package/src/tools-panel/stories/index.js +0 -1
  373. package/src/tools-panel/tools-panel/component.tsx +2 -2
  374. package/src/tools-panel/tools-panel-header/component.tsx +2 -2
  375. package/src/tools-panel/tools-panel-item/component.tsx +2 -2
  376. package/src/tree-grid/README.md +24 -1
  377. package/src/tree-grid/index.js +66 -7
  378. package/src/tree-grid/stories/index.js +4 -1
  379. package/src/tree-grid/test/__snapshots__/index.js.snap +1 -14
  380. package/src/tree-grid/test/index.js +226 -7
  381. package/src/truncate/component.js +1 -1
  382. package/src/ui/context/wordpress-component.ts +2 -2
  383. package/src/ui/control-group/component.js +1 -1
  384. package/src/ui/control-label/component.js +1 -1
  385. package/src/ui/form-group/form-group.js +1 -1
  386. package/src/ui/shortcut/component.tsx +2 -2
  387. package/src/ui/spinner/component.js +1 -1
  388. package/src/ui/tooltip/component.js +1 -1
  389. package/src/ui/tooltip/content.js +1 -1
  390. package/src/unit-control/index.tsx +2 -2
  391. package/src/unit-control/stories/index.js +1 -1
  392. package/src/v-stack/component.js +1 -1
  393. package/src/visually-hidden/component.js +1 -1
  394. package/src/z-stack/component.tsx +2 -2
  395. package/tsconfig.tsbuildinfo +1 -1
  396. package/src/tools-panel/stories/typography-panel.js +0 -215
@@ -134,4 +134,8 @@ export {
134
134
  withGlobalStyles,
135
135
  getMergedGlobalStyles,
136
136
  } from './mobile/global-styles-context';
137
- export { getGlobalStyles } from './mobile/global-styles-context/utils';
137
+ export {
138
+ getGlobalStyles,
139
+ getColorsAndGradients,
140
+ useMobileGlobalStylesColors,
141
+ } from './mobile/global-styles-context/utils';
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { noop } from 'lodash';
5
5
  import classNames from 'classnames';
6
- import type { Ref } from 'react';
6
+ import type { ForwardedRef } from 'react';
7
7
 
8
8
  /**
9
9
  * WordPress dependencies
@@ -45,7 +45,7 @@ export function InputControl(
45
45
  value,
46
46
  ...props
47
47
  }: InputControlProps,
48
- ref: Ref< HTMLInputElement >
48
+ ref: ForwardedRef< HTMLInputElement >
49
49
  ) {
50
50
  const [ isFocused, setIsFocused ] = useState( false );
51
51
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import type { Ref } from 'react';
4
+ import type { ForwardedRef } from 'react';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -66,7 +66,7 @@ export function InputBase(
66
66
  suffix,
67
67
  ...props
68
68
  }: InputBaseProps,
69
- ref: Ref< HTMLDivElement >
69
+ ref: ForwardedRef< HTMLDivElement >
70
70
  ) {
71
71
  const id = useUniqueId( idProp );
72
72
  const hideLabel = hideLabelFromVision || ! label;
@@ -2,14 +2,14 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { noop } from 'lodash';
5
- import { useDrag } from 'react-use-gesture';
5
+ import { useDrag } from '@use-gesture/react';
6
6
  import type {
7
7
  SyntheticEvent,
8
8
  ChangeEvent,
9
9
  KeyboardEvent,
10
10
  PointerEvent,
11
11
  FocusEvent,
12
- Ref,
12
+ ForwardedRef,
13
13
  MouseEvent,
14
14
  } from 'react';
15
15
 
@@ -53,7 +53,7 @@ function InputField(
53
53
  type,
54
54
  ...props
55
55
  }: WordPressComponentProps< InputFieldProps, 'input', false >,
56
- ref: Ref< HTMLInputElement >
56
+ ref: ForwardedRef< HTMLInputElement >
57
57
  ) {
58
58
  const {
59
59
  // State
@@ -168,9 +168,6 @@ function InputField(
168
168
  const dragGestureProps = useDrag< PointerEvent< HTMLInputElement > >(
169
169
  ( dragProps ) => {
170
170
  const { distance, dragging, event } = dragProps;
171
- // The event is persisted to prevent errors in components using this
172
- // to check if a modifier key was held while dragging.
173
- event.persist();
174
171
 
175
172
  if ( ! distance ) return;
176
173
  event.stopPropagation();
@@ -196,6 +193,7 @@ function InputField(
196
193
  {
197
194
  threshold: dragThreshold,
198
195
  enabled: isDragEnabled,
196
+ pointer: { capture: false },
199
197
  }
200
198
  );
201
199
 
@@ -50,6 +50,9 @@ export const composeStateReducers = (
50
50
  ): StateReducer => {
51
51
  return ( ...args ) => {
52
52
  return fns.reduceRight( ( state, fn ) => {
53
+ // TODO: Assess whether this can be replaced with a more standard `compose` implementation
54
+ // like wp.data.compose() (aka lodash flowRight) or Redux compose().
55
+ // The current implementation only works by functions mutating the original state object.
53
56
  const fnState = fn( ...args );
54
57
  return isEmpty( fnState ) ? state : { ...state, ...fnState };
55
58
  }, {} as InputState );
@@ -14,7 +14,7 @@ import { useState } from '@wordpress/element';
14
14
  import InputControl from '../';
15
15
 
16
16
  export default {
17
- title: 'Components/InputControl',
17
+ title: 'Components (Experimental)/InputControl',
18
18
  component: InputControl,
19
19
  parameters: {
20
20
  knobs: { disable: false },
@@ -7,7 +7,7 @@ import type {
7
7
  ChangeEvent,
8
8
  SyntheticEvent,
9
9
  } from 'react';
10
- import type { useDrag } from 'react-use-gesture';
10
+ import type { useDrag } from '@use-gesture/react';
11
11
 
12
12
  /**
13
13
  * Internal dependencies
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import type { Ref } from 'react';
4
+ import type { ForwardedRef } from 'react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -13,7 +13,7 @@ import { View } from '../../view';
13
13
 
14
14
  function Item(
15
15
  props: WordPressComponentProps< ItemProps, 'div' >,
16
- forwardedRef: Ref< any >
16
+ forwardedRef: ForwardedRef< any >
17
17
  ) {
18
18
  const { role, wrapperClassName, ...otherProps } = useItem( props );
19
19
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import type { Ref } from 'react';
4
+ import type { ForwardedRef } from 'react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -14,7 +14,7 @@ import type { ItemGroupProps } from '../types';
14
14
 
15
15
  function ItemGroup(
16
16
  props: WordPressComponentProps< ItemGroupProps, 'div' >,
17
- forwardedRef: Ref< any >
17
+ forwardedRef: ForwardedRef< any >
18
18
  ) {
19
19
  const {
20
20
  isBordered,
@@ -128,7 +128,16 @@ const BottomSheetNavigationScreen = ( {
128
128
  </TouchableHighlight>
129
129
  </ScrollView>
130
130
  );
131
- }, [ children, isFocused, safeAreaBottomInset, listProps ] );
131
+ }, [
132
+ children,
133
+ isFocused,
134
+ safeAreaBottomInset,
135
+ listProps,
136
+ name,
137
+ isScrollable,
138
+ isNested,
139
+ onLayout,
140
+ ] );
132
141
  };
133
142
 
134
143
  export default BottomSheetNavigationScreen;
@@ -13,8 +13,10 @@ import {
13
13
  ColorControl,
14
14
  PanelBody,
15
15
  BottomSheetContext,
16
+ useMobileGlobalStylesColors,
16
17
  } from '@wordpress/components';
17
18
  import { useRoute, useNavigation } from '@react-navigation/native';
19
+
18
20
  /**
19
21
  * Internal dependencies
20
22
  */
@@ -27,6 +29,7 @@ import { colorsUtils } from './utils';
27
29
  import styles from './style.scss';
28
30
 
29
31
  const HIT_SLOP = { top: 8, bottom: 8, left: 8, right: 8 };
32
+ const THEME_PALETTE_NAME = 'Theme';
30
33
 
31
34
  const PaletteScreen = () => {
32
35
  const route = useRoute();
@@ -45,10 +48,15 @@ const PaletteScreen = () => {
45
48
  const [ currentValue, setCurrentValue ] = useState( colorValue );
46
49
  const isGradientColor = isGradient( currentValue );
47
50
  const selectedSegmentIndex = isGradientColor ? 1 : 0;
51
+ const allAvailableColors = useMobileGlobalStylesColors();
48
52
 
49
53
  const [ currentSegment, setCurrentSegment ] = useState(
50
54
  segments[ selectedSegmentIndex ]
51
55
  );
56
+ const isGradientSegment = currentSegment === colorsUtils.segments[ 1 ];
57
+ const currentSegmentColors = ! isGradientSegment
58
+ ? defaultSettings.colors
59
+ : defaultSettings.gradients;
52
60
 
53
61
  const horizontalSeparatorStyle = usePreferredColorSchemeStyle(
54
62
  styles.horizontalSeparator,
@@ -176,15 +184,37 @@ const PaletteScreen = () => {
176
184
  <NavBar.Heading>{ label } </NavBar.Heading>
177
185
  </NavBar>
178
186
  ) }
179
- <ColorPalette
180
- setColor={ setColor }
181
- activeColor={ currentValue }
182
- isGradientColor={ isGradientColor }
183
- currentSegment={ currentSegment }
184
- onCustomPress={ onCustomPress }
185
- shouldEnableBottomSheetScroll={ shouldEnableBottomSheetScroll }
186
- defaultSettings={ defaultSettings }
187
- />
187
+
188
+ <View style={ styles.colorPalettes }>
189
+ { currentSegmentColors.map( ( palette, paletteKey ) => {
190
+ const paletteSettings = {
191
+ colors: palette.colors,
192
+ gradients: palette.gradients,
193
+ allColors: allAvailableColors,
194
+ };
195
+ const enableCustomColor =
196
+ ! isGradientSegment &&
197
+ palette.name === THEME_PALETTE_NAME;
198
+
199
+ return (
200
+ <ColorPalette
201
+ enableCustomColor={ enableCustomColor }
202
+ label={ palette.name }
203
+ key={ paletteKey }
204
+ setColor={ setColor }
205
+ activeColor={ currentValue }
206
+ isGradientColor={ isGradientColor }
207
+ currentSegment={ currentSegment }
208
+ onCustomPress={ onCustomPress }
209
+ shouldEnableBottomSheetScroll={
210
+ shouldEnableBottomSheetScroll
211
+ }
212
+ defaultSettings={ paletteSettings }
213
+ />
214
+ );
215
+ } ) }
216
+ </View>
217
+
188
218
  { isCustomGadientShown && (
189
219
  <>
190
220
  <View style={ horizontalSeparatorStyle } />
@@ -16,6 +16,10 @@
16
16
  padding: 12px $grid-unit-20;
17
17
  }
18
18
 
19
+ .colorPalettes {
20
+ padding: $grid-unit-10 0;
21
+ }
22
+
19
23
  .colorIndicator {
20
24
  width: 24px;
21
25
  height: 24px;
@@ -20,6 +20,11 @@ export const GLOBAL_STYLES_PALETTE = [
20
20
  color: '#D1D1E4',
21
21
  name: 'Purple',
22
22
  },
23
+ {
24
+ color: '#cf1594',
25
+ name: 'Color 2 ',
26
+ slug: 'custom-color-2',
27
+ },
23
28
  ];
24
29
 
25
30
  export const GLOBAL_STYLES_GRADIENTS = {
@@ -91,6 +96,11 @@ export const DEFAULT_GLOBAL_STYLES = {
91
96
  fontSize: 'var(--wp--preset--font-size--normal)',
92
97
  },
93
98
  },
99
+ 'core/separator': {
100
+ color: {
101
+ text: 'var:preset|color|custom-color-2',
102
+ },
103
+ },
94
104
  },
95
105
  };
96
106
 
@@ -132,6 +142,11 @@ export const PARSED_GLOBAL_STYLES = {
132
142
  fontSize: '18px',
133
143
  },
134
144
  },
145
+ 'core/separator': {
146
+ color: {
147
+ text: '#cf1594',
148
+ },
149
+ },
135
150
  },
136
151
  };
137
152
 
@@ -172,6 +187,18 @@ export const RAW_FEATURES = {
172
187
  name: 'Purple',
173
188
  },
174
189
  ],
190
+ custom: [
191
+ {
192
+ color: '#1bf5c1',
193
+ name: 'Color 1 ',
194
+ slug: 'custom-color-1',
195
+ },
196
+ {
197
+ color: '#cf1594',
198
+ name: 'Color 2 ',
199
+ slug: 'custom-color-2',
200
+ },
201
+ ],
175
202
  },
176
203
  gradients: {
177
204
  default: [
@@ -125,14 +125,14 @@ describe( 'getGlobalStyles', () => {
125
125
 
126
126
  expect( globalStyles ).toEqual(
127
127
  expect.objectContaining( {
128
- colors: RAW_FEATURES.color,
129
- gradients,
130
128
  __experimentalFeatures: {
131
129
  color: {
132
130
  palette: RAW_FEATURES.color.palette,
133
131
  gradients,
134
132
  text: true,
135
133
  background: true,
134
+ defaultPalette: true,
135
+ defaultGradients: true,
136
136
  },
137
137
  typography: {
138
138
  fontSizes: RAW_FEATURES.typography.fontSizes,
@@ -7,7 +7,11 @@ import { Dimensions } from 'react-native';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
- import { getPxFromCssUnit } from '@wordpress/block-editor';
10
+ import {
11
+ getPxFromCssUnit,
12
+ useSetting,
13
+ useMultipleOriginColorsAndGradients,
14
+ } from '@wordpress/block-editor';
11
15
 
12
16
  export const BLOCK_STYLE_ATTRIBUTES = [
13
17
  'textColor',
@@ -186,7 +190,7 @@ export function getBlockTypography(
186
190
 
187
191
  export function parseStylesVariables( styles, mappedValues, customValues ) {
188
192
  let stylesBase = styles;
189
- const variables = [ 'preset', 'custom' ];
193
+ const variables = [ 'preset', 'custom', 'var' ];
190
194
 
191
195
  if ( ! stylesBase ) {
192
196
  return styles;
@@ -196,7 +200,9 @@ export function parseStylesVariables( styles, mappedValues, customValues ) {
196
200
  // Examples
197
201
  // var(--wp--preset--color--gray)
198
202
  // var(--wp--custom--body--typography--font-family)
203
+ // var:preset|color|custom-color-2
199
204
  const regex = new RegExp( `var\\(--wp--${ variable }--(.*?)\\)`, 'g' );
205
+ const varRegex = /\"var:preset\|color\|(.*?)\"/gm;
200
206
 
201
207
  if ( variable === 'preset' ) {
202
208
  stylesBase = stylesBase.replace( regex, ( _$1, $2 ) => {
@@ -226,6 +232,18 @@ export function parseStylesVariables( styles, mappedValues, customValues ) {
226
232
  ] );
227
233
  } );
228
234
  }
235
+
236
+ if ( variable === 'var' ) {
237
+ stylesBase = stylesBase.replace( varRegex, ( _$1, $2 ) => {
238
+ if ( mappedValues?.color ) {
239
+ const matchedValue = find( mappedValues.color?.values, {
240
+ slug: $2,
241
+ } );
242
+ return `"${ matchedValue?.color }"`;
243
+ }
244
+ return UNKNOWN_VALUE;
245
+ } );
246
+ }
229
247
  } );
230
248
 
231
249
  return JSON.parse( stylesBase );
@@ -233,7 +251,12 @@ export function parseStylesVariables( styles, mappedValues, customValues ) {
233
251
 
234
252
  export function getMappedValues( features, palette ) {
235
253
  const typography = features?.typography;
236
- const colors = { ...palette?.theme, ...palette?.custom };
254
+ const colors = [
255
+ ...( palette?.theme || [] ),
256
+ ...( palette?.custom || [] ),
257
+ ...( palette?.default || [] ),
258
+ ];
259
+
237
260
  const fontSizes = {
238
261
  ...typography?.fontSizes?.theme,
239
262
  ...typography?.fontSizes?.custom,
@@ -265,7 +288,7 @@ function normalizeFontSizes( fontSizes ) {
265
288
  const normalizedFontSizes = {};
266
289
  const dimensions = Dimensions.get( 'window' );
267
290
 
268
- [ 'default', 'theme', 'user' ].forEach( ( key ) => {
291
+ [ 'default', 'theme', 'custom' ].forEach( ( key ) => {
269
292
  if ( fontSizes[ key ] ) {
270
293
  normalizedFontSizes[ key ] = fontSizes[ key ]?.map(
271
294
  ( fontSizeObject ) => {
@@ -286,6 +309,52 @@ function normalizeFontSizes( fontSizes ) {
286
309
  return normalizedFontSizes;
287
310
  }
288
311
 
312
+ export function useMobileGlobalStylesColors( type = 'colors' ) {
313
+ const colorGradientSettings = useMultipleOriginColorsAndGradients();
314
+ const availableThemeColors = colorGradientSettings?.[ type ]?.reduce(
315
+ ( colors, origin ) => colors.concat( origin?.[ type ] ),
316
+ []
317
+ );
318
+ // Default editor colors/gradients if it's not a block-based theme.
319
+ const colorPalette =
320
+ type === 'colors' ? 'color.palette' : 'color.gradients';
321
+ const editorDefaultPalette = useSetting( colorPalette );
322
+
323
+ return availableThemeColors.length >= 1
324
+ ? availableThemeColors
325
+ : editorDefaultPalette;
326
+ }
327
+
328
+ export function getColorsAndGradients(
329
+ defaultEditorColors = [],
330
+ defaultEditorGradients = [],
331
+ rawFeatures
332
+ ) {
333
+ const features = rawFeatures ? JSON.parse( rawFeatures ) : {};
334
+
335
+ return {
336
+ __experimentalGlobalStylesBaseStyles: null,
337
+ __experimentalFeatures: {
338
+ color: {
339
+ ...( ! features?.color
340
+ ? {
341
+ text: true,
342
+ background: true,
343
+ palette: {
344
+ default: defaultEditorColors,
345
+ },
346
+ gradients: {
347
+ default: defaultEditorGradients,
348
+ },
349
+ }
350
+ : features?.color ),
351
+ defaultPalette: defaultEditorColors?.length > 0,
352
+ defaultGradients: defaultEditorGradients?.length > 0,
353
+ },
354
+ },
355
+ };
356
+ }
357
+
289
358
  export function getGlobalStyles( rawStyles, rawFeatures ) {
290
359
  const features = rawFeatures ? JSON.parse( rawFeatures ) : {};
291
360
  const mappedValues = getMappedValues( features, features?.color?.palette );
@@ -310,14 +379,14 @@ export function getGlobalStyles( rawStyles, rawFeatures ) {
310
379
  const fontSizes = normalizeFontSizes( features?.typography?.fontSizes );
311
380
 
312
381
  return {
313
- colors,
314
- gradients,
315
382
  __experimentalFeatures: {
316
383
  color: {
317
384
  palette: colors?.palette,
318
385
  gradients,
319
386
  text: features?.color?.text ?? true,
320
387
  background: features?.color?.background ?? true,
388
+ defaultPalette: features?.color?.defaultPalette ?? true,
389
+ defaultGradients: features?.color?.defaultGradients ?? true,
321
390
  },
322
391
  typography: {
323
392
  fontSizes,
@@ -15,7 +15,7 @@ import { HideIfEmptyStory } from './hide-if-empty';
15
15
  import './style.css';
16
16
 
17
17
  export default {
18
- title: 'Components/Navigation',
18
+ title: 'Components (Experimental)/Navigation',
19
19
  component: Navigation,
20
20
  subcomponents: {
21
21
  NavigationBackButton,
@@ -1,3 +1,5 @@
1
1
  export { default as NavigatorProvider } from './navigator-provider';
2
2
  export { default as NavigatorScreen } from './navigator-screen';
3
+ export { default as NavigatorButton } from './navigator-button';
4
+ export { default as NavigatorBackButton } from './navigator-back-button';
3
5
  export { default as useNavigator } from './use-navigator';
@@ -0,0 +1,31 @@
1
+ # `NavigatorBackButton`
2
+
3
+ <div class="callout callout-alert">
4
+ This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
5
+ </div>
6
+
7
+ The `NavigatorBackButton` component can be used to navigate to a screen and should be used in combination with the [`NavigatorProvider`](/packages/components/src/navigator/navigator-provider/README.md), the [`NavigatorScreen`](/packages/components/src/navigator/navigator-screen/README.md) and the [`NavigatorButton`](/packages/components/src/navigator/navigator-button/README.md) components (or the `useNavigator` hook).
8
+
9
+ ## Usage
10
+
11
+ Refer to [the `NavigatorProvider` component](/packages/components/src/navigator/navigator-provider/README.md#usage) for a usage example.
12
+
13
+ ## Props
14
+
15
+ The component accepts the following props:
16
+
17
+ ### `onClick`: `React.MouseEventHandler< HTMLElement >`
18
+
19
+ The callback called in response to a `click` event.
20
+
21
+ - Required: No
22
+
23
+ ### `path`: `string`
24
+
25
+ The path of the screen to navigate to.
26
+
27
+ - Required: Yes
28
+
29
+ ### Inherited props
30
+
31
+ `NavigatorBackButton` also inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href`.
@@ -0,0 +1,62 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ForwardedRef } from 'react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { contextConnect, WordPressComponentProps } from '../../ui/context';
10
+ import { View } from '../../view';
11
+ import { useNavigatorBackButton } from './hook';
12
+ import type { NavigatorBackButtonProps } from '../types';
13
+
14
+ function NavigatorBackButton(
15
+ props: WordPressComponentProps< NavigatorBackButtonProps, 'button' >,
16
+ forwardedRef: ForwardedRef< any >
17
+ ) {
18
+ const navigatorBackButtonProps = useNavigatorBackButton( props );
19
+
20
+ return <View ref={ forwardedRef } { ...navigatorBackButtonProps } />;
21
+ }
22
+
23
+ /**
24
+ * The `NavigatorBackButton` component can be used to navigate to a screen and
25
+ * should be used in combination with the `NavigatorProvider`, the
26
+ * `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator`
27
+ * hook).
28
+ *
29
+ * @example
30
+ * ```jsx
31
+ * import {
32
+ * __experimentalNavigatorProvider as NavigatorProvider,
33
+ * __experimentalNavigatorScreen as NavigatorScreen,
34
+ * __experimentalNavigatorButton as NavigatorButton,
35
+ * __experimentalNavigatorBackButton as NavigatorBackButton,
36
+ * } from '@wordpress/components';
37
+ *
38
+ * const MyNavigation = () => (
39
+ * <NavigatorProvider initialPath="/">
40
+ * <NavigatorScreen path="/">
41
+ * <p>This is the home screen.</p>
42
+ * <NavigatorButton path="/child">
43
+ * Navigate to child screen.
44
+ * </NavigatorButton>
45
+ * </NavigatorScreen>
46
+ *
47
+ * <NavigatorScreen path="/child">
48
+ * <p>This is the child screen.</p>
49
+ * <NavigatorBackButton>
50
+ * Go back
51
+ * </NavigatorBackButton>
52
+ * </NavigatorScreen>
53
+ * </NavigatorProvider>
54
+ * );
55
+ * ```
56
+ */
57
+ const ConnectedNavigatorBackButton = contextConnect(
58
+ NavigatorBackButton,
59
+ 'NavigatorBackButton'
60
+ );
61
+
62
+ export default ConnectedNavigatorBackButton;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useCallback } from '@wordpress/element';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import { useContextSystem, WordPressComponentProps } from '../../ui/context';
13
+ import Button from '../../button';
14
+ import useNavigator from '../use-navigator';
15
+ import type { NavigatorBackButtonProps } from '../types';
16
+
17
+ export function useNavigatorBackButton(
18
+ props: WordPressComponentProps< NavigatorBackButtonProps, 'button' >
19
+ ) {
20
+ const { onClick, as = Button, ...otherProps } = useContextSystem(
21
+ props,
22
+ 'NavigatorBackButton'
23
+ );
24
+
25
+ const { goBack } = useNavigator();
26
+ const handleClick: React.MouseEventHandler< HTMLButtonElement > = useCallback(
27
+ ( e ) => {
28
+ e.preventDefault();
29
+ goBack();
30
+ onClick?.( e );
31
+ },
32
+ [ goBack, onClick ]
33
+ );
34
+
35
+ return {
36
+ as,
37
+ onClick: handleClick,
38
+ ...otherProps,
39
+ };
40
+ }
@@ -0,0 +1 @@
1
+ export { default } from './component';
@@ -0,0 +1,38 @@
1
+ # `NavigatorButton`
2
+
3
+ <div class="callout callout-alert">
4
+ This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
5
+ </div>
6
+
7
+ The `NavigatorButton` component can be used to navigate to a screen and should be used in combination with the [`NavigatorProvider`](/packages/components/src/navigator/navigator-provider/README.md), the [`NavigatorScreen`](/packages/components/src/navigator/navigator-screen/README.md) and the [`NavigatorBackButton`](/packages/components/src/navigator/navigator-back-button/README.md) components (or the `useNavigator` hook).
8
+
9
+ ## Usage
10
+
11
+ Refer to [the `NavigatorProvider` component](/packages/components/src/navigator/navigator-provider/README.md#usage) for a usage example.
12
+
13
+ ## Props
14
+
15
+ The component accepts the following props:
16
+
17
+ ### `attributeName`: `string`
18
+
19
+ The HTML attribute used to identify the `NavigatorButton`, which is used by `Navigator` to restore focus.
20
+
21
+ - Required: No
22
+ - Default: `id`
23
+
24
+ ### `onClick`: `React.MouseEventHandler< HTMLElement >`
25
+
26
+ The callback called in response to a `click` event.
27
+
28
+ - Required: No
29
+
30
+ ### `path`: `string`
31
+
32
+ The path of the screen to navigate to. The value of this prop needs to be [a valid value for an HTML attribute](https://html.spec.whatwg.org/multipage/syntax.html#attributes-2).
33
+
34
+ - Required: Yes
35
+
36
+ ### Inherited props
37
+
38
+ `NavigatorButton` also inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href`.