@wordpress/components 19.1.5 → 19.2.1-next.33ec3857e2.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 (384) hide show
  1. package/CHANGELOG.md +40 -3
  2. package/build/angle-picker-control/index.js +2 -0
  3. package/build/angle-picker-control/index.js.map +1 -1
  4. package/build/button/index.native.js +13 -3
  5. package/build/button/index.native.js.map +1 -1
  6. package/build/checkbox-control/index.js +1 -1
  7. package/build/checkbox-control/index.js.map +1 -1
  8. package/build/clipboard-button/index.js +1 -2
  9. package/build/clipboard-button/index.js.map +1 -1
  10. package/build/color-palette/index.js +12 -0
  11. package/build/color-palette/index.js.map +1 -1
  12. package/build/color-picker/color-display.js +4 -2
  13. package/build/color-picker/color-display.js.map +1 -1
  14. package/build/color-picker/hex-input.js +3 -1
  15. package/build/color-picker/hex-input.js.map +1 -1
  16. package/build/color-picker/input-with-slider.js +3 -1
  17. package/build/color-picker/input-with-slider.js.map +1 -1
  18. package/build/confirm-dialog/component.js +103 -0
  19. package/build/confirm-dialog/component.js.map +1 -0
  20. package/build/confirm-dialog/index.js +16 -0
  21. package/build/confirm-dialog/index.js.map +1 -0
  22. package/build/confirm-dialog/types.js +6 -0
  23. package/build/confirm-dialog/types.js.map +1 -0
  24. package/build/custom-gradient-picker/index.js +1 -0
  25. package/build/custom-gradient-picker/index.js.map +1 -1
  26. package/build/date-time/date.js +63 -86
  27. package/build/date-time/date.js.map +1 -1
  28. package/build/date-time/utils.js +32 -0
  29. package/build/date-time/utils.js.map +1 -0
  30. package/build/divider/component.js +8 -7
  31. package/build/divider/component.js.map +1 -1
  32. package/build/divider/styles.js +38 -13
  33. package/build/divider/styles.js.map +1 -1
  34. package/build/drop-zone/index.js +14 -6
  35. package/build/drop-zone/index.js.map +1 -1
  36. package/build/drop-zone/provider.js +1 -0
  37. package/build/drop-zone/provider.js.map +1 -1
  38. package/build/flyout/styles.js +2 -2
  39. package/build/flyout/styles.js.map +1 -1
  40. package/build/focusable-iframe/index.js +1 -0
  41. package/build/focusable-iframe/index.js.map +1 -1
  42. package/build/font-size-picker/index.js +10 -9
  43. package/build/font-size-picker/index.js.map +1 -1
  44. package/build/font-size-picker/utils.js +28 -17
  45. package/build/font-size-picker/utils.js.map +1 -1
  46. package/build/higher-order/with-focus-outside/index.js +2 -0
  47. package/build/higher-order/with-focus-outside/index.js.map +1 -1
  48. package/build/index.js +8 -0
  49. package/build/index.js.map +1 -1
  50. package/build/input-control/styles/input-control-styles.js +44 -32
  51. package/build/input-control/styles/input-control-styles.js.map +1 -1
  52. package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +10 -3
  53. package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  54. package/build/mobile/color-settings/index.native.js +4 -2
  55. package/build/mobile/color-settings/index.native.js.map +1 -1
  56. package/build/mobile/color-settings/palette.screen.native.js +7 -6
  57. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  58. package/build/mobile/global-styles-context/utils.native.js +1 -1
  59. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  60. package/build/mobile/gridicons/index.native.js +3 -1
  61. package/build/mobile/gridicons/index.native.js.map +1 -1
  62. package/build/mobile/link-picker/index.native.js +45 -4
  63. package/build/mobile/link-picker/index.native.js.map +1 -1
  64. package/build/mobile/link-settings/index.native.js +10 -0
  65. package/build/mobile/link-settings/index.native.js.map +1 -1
  66. package/build/modal/aria-helper.js +2 -0
  67. package/build/modal/aria-helper.js.map +1 -1
  68. package/build/modal/index.js +17 -8
  69. package/build/modal/index.js.map +1 -1
  70. package/build/select-control/styles/select-control-styles.js +33 -9
  71. package/build/select-control/styles/select-control-styles.js.map +1 -1
  72. package/build/style-provider/index.js +2 -0
  73. package/build/style-provider/index.js.map +1 -1
  74. package/build/toggle-group-control/toggle-group-control/component.js +7 -2
  75. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  76. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +25 -14
  77. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  78. package/build/tools-panel/styles.js +12 -10
  79. package/build/tools-panel/styles.js.map +1 -1
  80. package/build/tools-panel/tools-panel/component.js +6 -8
  81. package/build/tools-panel/tools-panel/component.js.map +1 -1
  82. package/build/tools-panel/tools-panel/hook.js +48 -17
  83. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  84. package/build/tools-panel/tools-panel-item/hook.js +5 -1
  85. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  86. package/build/unit-control/styles/unit-control-styles.js +23 -41
  87. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  88. package/build/z-stack/component.js.map +1 -1
  89. package/build/z-stack/styles.js +10 -8
  90. package/build/z-stack/styles.js.map +1 -1
  91. package/build-module/angle-picker-control/index.js +2 -0
  92. package/build-module/angle-picker-control/index.js.map +1 -1
  93. package/build-module/button/index.native.js +13 -3
  94. package/build-module/button/index.native.js.map +1 -1
  95. package/build-module/checkbox-control/index.js +1 -1
  96. package/build-module/checkbox-control/index.js.map +1 -1
  97. package/build-module/clipboard-button/index.js +1 -2
  98. package/build-module/clipboard-button/index.js.map +1 -1
  99. package/build-module/color-palette/index.js +13 -1
  100. package/build-module/color-palette/index.js.map +1 -1
  101. package/build-module/color-picker/color-display.js +3 -2
  102. package/build-module/color-picker/color-display.js.map +1 -1
  103. package/build-module/color-picker/hex-input.js +2 -1
  104. package/build-module/color-picker/hex-input.js.map +1 -1
  105. package/build-module/color-picker/input-with-slider.js +2 -1
  106. package/build-module/color-picker/input-with-slider.js.map +1 -1
  107. package/build-module/confirm-dialog/component.js +84 -0
  108. package/build-module/confirm-dialog/component.js.map +1 -0
  109. package/build-module/confirm-dialog/index.js +6 -0
  110. package/build-module/confirm-dialog/index.js.map +1 -0
  111. package/build-module/confirm-dialog/types.js +2 -0
  112. package/build-module/confirm-dialog/types.js.map +1 -0
  113. package/build-module/custom-gradient-picker/index.js +1 -0
  114. package/build-module/custom-gradient-picker/index.js.map +1 -1
  115. package/build-module/date-time/date.js +63 -87
  116. package/build-module/date-time/date.js.map +1 -1
  117. package/build-module/date-time/utils.js +20 -0
  118. package/build-module/date-time/utils.js.map +1 -0
  119. package/build-module/divider/component.js +8 -7
  120. package/build-module/divider/component.js.map +1 -1
  121. package/build-module/divider/styles.js +37 -13
  122. package/build-module/divider/styles.js.map +1 -1
  123. package/build-module/drop-zone/index.js +14 -6
  124. package/build-module/drop-zone/index.js.map +1 -1
  125. package/build-module/drop-zone/provider.js +1 -0
  126. package/build-module/drop-zone/provider.js.map +1 -1
  127. package/build-module/flyout/styles.js +2 -2
  128. package/build-module/flyout/styles.js.map +1 -1
  129. package/build-module/focusable-iframe/index.js +1 -0
  130. package/build-module/focusable-iframe/index.js.map +1 -1
  131. package/build-module/font-size-picker/index.js +10 -9
  132. package/build-module/font-size-picker/index.js.map +1 -1
  133. package/build-module/font-size-picker/utils.js +28 -17
  134. package/build-module/font-size-picker/utils.js.map +1 -1
  135. package/build-module/higher-order/with-focus-outside/index.js +1 -0
  136. package/build-module/higher-order/with-focus-outside/index.js.map +1 -1
  137. package/build-module/index.js +1 -0
  138. package/build-module/index.js.map +1 -1
  139. package/build-module/input-control/styles/input-control-styles.js +44 -32
  140. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  141. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +10 -4
  142. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  143. package/build-module/mobile/color-settings/index.native.js +4 -2
  144. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  145. package/build-module/mobile/color-settings/palette.screen.native.js +7 -6
  146. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  147. package/build-module/mobile/global-styles-context/utils.native.js +1 -1
  148. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  149. package/build-module/mobile/gridicons/index.native.js +1 -0
  150. package/build-module/mobile/gridicons/index.native.js.map +1 -1
  151. package/build-module/mobile/link-picker/index.native.js +50 -8
  152. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  153. package/build-module/mobile/link-settings/index.native.js +10 -0
  154. package/build-module/mobile/link-settings/index.native.js.map +1 -1
  155. package/build-module/modal/aria-helper.js +2 -0
  156. package/build-module/modal/aria-helper.js.map +1 -1
  157. package/build-module/modal/index.js +15 -8
  158. package/build-module/modal/index.js.map +1 -1
  159. package/build-module/select-control/styles/select-control-styles.js +33 -9
  160. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  161. package/build-module/style-provider/index.js +1 -0
  162. package/build-module/style-provider/index.js.map +1 -1
  163. package/build-module/toggle-group-control/toggle-group-control/component.js +8 -3
  164. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  165. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +25 -14
  166. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  167. package/build-module/tools-panel/styles.js +12 -11
  168. package/build-module/tools-panel/styles.js.map +1 -1
  169. package/build-module/tools-panel/tools-panel/component.js +5 -8
  170. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  171. package/build-module/tools-panel/tools-panel/hook.js +48 -17
  172. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  173. package/build-module/tools-panel/tools-panel-item/hook.js +5 -1
  174. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  175. package/build-module/unit-control/styles/unit-control-styles.js +23 -41
  176. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  177. package/build-module/z-stack/component.js.map +1 -1
  178. package/build-module/z-stack/styles.js +13 -8
  179. package/build-module/z-stack/styles.js.map +1 -1
  180. package/build-style/style-rtl.css +23 -11
  181. package/build-style/style.css +23 -11
  182. package/build-types/base-field/hook.d.ts +16 -16
  183. package/build-types/card/card/hook.d.ts +16 -16
  184. package/build-types/card/card-body/hook.d.ts +16 -16
  185. package/build-types/card/card-divider/hook.d.ts +18 -18
  186. package/build-types/card/card-footer/hook.d.ts +17 -17
  187. package/build-types/card/card-header/hook.d.ts +16 -16
  188. package/build-types/card/card-media/hook.d.ts +16 -16
  189. package/build-types/divider/component.d.ts +8 -7
  190. package/build-types/divider/component.d.ts.map +1 -1
  191. package/build-types/divider/styles.d.ts +2 -2
  192. package/build-types/divider/styles.d.ts.map +1 -1
  193. package/build-types/divider/types.d.ts +5 -5
  194. package/build-types/divider/types.d.ts.map +1 -1
  195. package/build-types/elevation/hook.d.ts +15 -15
  196. package/build-types/flex/flex/hook.d.ts +16 -16
  197. package/build-types/flex/flex-block/hook.d.ts +16 -16
  198. package/build-types/flex/flex-item/hook.d.ts +16 -16
  199. package/build-types/flyout/flyout/hook.d.ts +17 -17
  200. package/build-types/flyout/styles.d.ts +7 -9
  201. package/build-types/flyout/styles.d.ts.map +1 -1
  202. package/build-types/grid/hook.d.ts +16 -16
  203. package/build-types/h-stack/hook.d.ts +16 -16
  204. package/build-types/heading/hook.d.ts +16 -16
  205. package/build-types/input-control/index.d.ts +1 -1
  206. package/build-types/input-control/index.d.ts.map +1 -1
  207. package/build-types/input-control/input-field.d.ts +1 -1
  208. package/build-types/input-control/input-field.d.ts.map +1 -1
  209. package/build-types/input-control/styles/input-control-styles.d.ts +1 -2
  210. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  211. package/build-types/input-control/types.d.ts +2 -1
  212. package/build-types/input-control/types.d.ts.map +1 -1
  213. package/build-types/item-group/item/hook.d.ts +16 -16
  214. package/build-types/item-group/item-group/hook.d.ts +16 -16
  215. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  216. package/build-types/scrollable/hook.d.ts +16 -16
  217. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  218. package/build-types/select-control/types.d.ts +1 -1
  219. package/build-types/select-control/types.d.ts.map +1 -1
  220. package/build-types/spacer/hook.d.ts +16 -16
  221. package/build-types/surface/hook.d.ts +16 -16
  222. package/build-types/text/hook.d.ts +16 -16
  223. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  224. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +1 -1
  225. package/build-types/tools-panel/styles.d.ts.map +1 -1
  226. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  227. package/build-types/tools-panel/tools-panel/hook.d.ts +16 -16
  228. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  229. package/build-types/tools-panel/tools-panel-header/hook.d.ts +16 -16
  230. package/build-types/tools-panel/tools-panel-item/hook.d.ts +16 -16
  231. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  232. package/build-types/tools-panel/types.d.ts +2 -1
  233. package/build-types/tools-panel/types.d.ts.map +1 -1
  234. package/build-types/truncate/hook.d.ts +16 -16
  235. package/build-types/ui/control-group/hook.d.ts +18 -18
  236. package/build-types/ui/control-label/hook.d.ts +16 -16
  237. package/build-types/ui/form-group/form-group.d.ts +4 -4
  238. package/build-types/ui/form-group/use-form-group.d.ts +55 -55
  239. package/build-types/unit-control/index.d.ts +1 -1
  240. package/build-types/unit-control/index.d.ts.map +1 -1
  241. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -0
  242. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  243. package/build-types/unit-control/types.d.ts +2 -2
  244. package/build-types/unit-control/types.d.ts.map +1 -1
  245. package/build-types/v-stack/hook.d.ts +16 -16
  246. package/build-types/z-stack/component.d.ts +1 -1
  247. package/build-types/z-stack/styles.d.ts.map +1 -1
  248. package/package.json +21 -23
  249. package/src/alignment-matrix-control/stories/index.js +1 -1
  250. package/src/angle-picker-control/index.js +2 -0
  251. package/src/base-control/stories/index.js +1 -1
  252. package/src/button/index.native.js +15 -1
  253. package/src/button/stories/index.js +1 -1
  254. package/src/button/style.scss +14 -0
  255. package/src/card/card/README.md +3 -3
  256. package/src/card/stories/index.js +1 -1
  257. package/src/card/test/__snapshots__/index.js.snap +6 -6
  258. package/src/checkbox-control/index.js +1 -1
  259. package/src/checkbox-control/stories/index.js +1 -1
  260. package/src/clipboard-button/index.js +1 -2
  261. package/src/color-indicator/stories/index.js +1 -1
  262. package/src/color-indicator/style.scss +5 -8
  263. package/src/color-palette/index.js +10 -1
  264. package/src/color-palette/stories/index.js +1 -1
  265. package/src/color-palette/test/__snapshots__/index.js.snap +1 -0
  266. package/src/color-picker/color-display.tsx +3 -2
  267. package/src/color-picker/hex-input.tsx +2 -1
  268. package/src/color-picker/input-with-slider.tsx +2 -1
  269. package/src/color-picker/stories/index.js +1 -1
  270. package/src/combobox-control/README.md +2 -2
  271. package/src/confirm-dialog/README.md +128 -0
  272. package/src/confirm-dialog/component.tsx +114 -0
  273. package/src/confirm-dialog/index.tsx +6 -0
  274. package/src/confirm-dialog/stories/index.js +120 -0
  275. package/src/confirm-dialog/test/index.js +302 -0
  276. package/src/confirm-dialog/types.ts +26 -0
  277. package/src/custom-gradient-picker/index.js +1 -0
  278. package/src/custom-gradient-picker/style.scss +0 -4
  279. package/src/date-time/README.md +7 -0
  280. package/src/date-time/date.js +67 -84
  281. package/src/date-time/stories/index.js +1 -1
  282. package/src/date-time/stories/time.js +1 -1
  283. package/src/date-time/test/date.js +3 -29
  284. package/src/date-time/test/utils.js +32 -0
  285. package/src/date-time/utils.js +18 -0
  286. package/src/dimension-control/README.md +1 -1
  287. package/src/divider/README.md +33 -5
  288. package/src/divider/component.tsx +8 -7
  289. package/src/divider/stories/index.js +43 -17
  290. package/src/divider/styles.ts +53 -16
  291. package/src/divider/test/__snapshots__/index.js.snap +11 -11
  292. package/src/divider/test/index.js +4 -4
  293. package/src/divider/types.ts +5 -5
  294. package/src/drop-zone/index.js +14 -6
  295. package/src/drop-zone/provider.js +1 -0
  296. package/src/dropdown-menu/stories/index.js +1 -1
  297. package/src/duotone-picker/README.md +1 -1
  298. package/src/elevation/stories/index.js +1 -1
  299. package/src/external-link/stories/index.js +1 -1
  300. package/src/flyout/styles.ts +4 -2
  301. package/src/focusable-iframe/index.js +1 -0
  302. package/src/font-size-picker/index.js +27 -13
  303. package/src/font-size-picker/stories/index.js +63 -1
  304. package/src/font-size-picker/test/index.js +87 -0
  305. package/src/font-size-picker/test/util.js +74 -0
  306. package/src/font-size-picker/utils.js +31 -17
  307. package/src/form-token-field/stories/index.js +1 -1
  308. package/src/gradient-picker/stories/index.js +1 -1
  309. package/src/grid/stories/index.js +1 -1
  310. package/src/guide/stories/index.js +1 -1
  311. package/src/higher-order/with-focus-outside/index.js +2 -0
  312. package/src/icon/stories/index.js +1 -1
  313. package/src/index.js +1 -0
  314. package/src/input-control/stories/index.js +2 -1
  315. package/src/input-control/styles/input-control-styles.tsx +16 -6
  316. package/src/input-control/types.ts +3 -1
  317. package/src/item-group/stories/index.js +84 -2
  318. package/src/menu-item/README.md +2 -2
  319. package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +6 -2
  320. package/src/mobile/color-settings/index.native.js +2 -0
  321. package/src/mobile/color-settings/palette.screen.native.js +8 -5
  322. package/src/mobile/color-settings/style.native.scss +1 -1
  323. package/src/mobile/global-styles-context/utils.native.js +1 -1
  324. package/src/mobile/gridicons/index.native.js +3 -3
  325. package/src/mobile/inserter-button/style.native.scss +1 -0
  326. package/src/mobile/link-picker/index.native.js +41 -7
  327. package/src/mobile/link-settings/index.native.js +11 -0
  328. package/src/mobile/link-settings/test/edit.native.js +432 -0
  329. package/src/modal/README.md +10 -0
  330. package/src/modal/aria-helper.js +2 -0
  331. package/src/modal/index.js +72 -55
  332. package/src/modal/stories/index.js +6 -1
  333. package/src/modal/style.scss +9 -0
  334. package/src/modal/test/index.js +11 -0
  335. package/src/navigation/README.md +0 -9
  336. package/src/notice/stories/index.js +1 -1
  337. package/src/number-control/stories/index.js +1 -1
  338. package/src/panel/stories/index.js +1 -1
  339. package/src/placeholder/stories/index.js +1 -1
  340. package/src/popover/stories/index.js +1 -1
  341. package/src/query-controls/README.md +138 -6
  342. package/src/radio-group/README.md +4 -1
  343. package/src/range-control/stories/index.js +1 -1
  344. package/src/resizable-box/stories/index.js +1 -1
  345. package/src/scrollable/stories/index.js +1 -1
  346. package/src/search-control/stories/index.js +1 -1
  347. package/src/select-control/stories/index.js +2 -1
  348. package/src/select-control/styles/select-control-styles.ts +25 -2
  349. package/src/select-control/types.ts +1 -1
  350. package/src/slot-fill/stories/index.js +1 -1
  351. package/src/snackbar/stories/index.js +1 -1
  352. package/src/spacer/stories/index.js +1 -1
  353. package/src/style-provider/index.js +2 -0
  354. package/src/surface/stories/index.js +1 -1
  355. package/src/tab-panel/stories/index.js +1 -1
  356. package/src/text-control/stories/index.js +1 -1
  357. package/src/text-highlight/stories/index.js +1 -1
  358. package/src/textarea-control/stories/index.js +1 -1
  359. package/src/tip/stories/index.js +1 -1
  360. package/src/toggle-control/stories/index.js +1 -1
  361. package/src/toggle-group-control/stories/index.js +1 -1
  362. package/src/toggle-group-control/toggle-group-control/component.tsx +7 -2
  363. package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +24 -9
  364. package/src/toolbar-button/stories/index.js +1 -1
  365. package/src/tools-panel/stories/index.js +237 -0
  366. package/src/tools-panel/styles.ts +41 -1
  367. package/src/tools-panel/test/index.js +234 -1
  368. package/src/tools-panel/tools-panel/README.md +9 -0
  369. package/src/tools-panel/tools-panel/component.tsx +2 -5
  370. package/src/tools-panel/tools-panel/hook.ts +50 -18
  371. package/src/tools-panel/tools-panel-item/hook.ts +5 -1
  372. package/src/tools-panel/types.ts +5 -1
  373. package/src/tooltip/stories/index.js +1 -1
  374. package/src/tree-select/stories/index.js +1 -1
  375. package/src/truncate/stories/index.js +1 -1
  376. package/src/unit-control/stories/index.js +19 -1
  377. package/src/unit-control/styles/unit-control-styles.ts +33 -46
  378. package/src/unit-control/types.ts +5 -2
  379. package/src/z-stack/README.md +1 -1
  380. package/src/z-stack/component.tsx +1 -1
  381. package/src/z-stack/stories/index.js +1 -1
  382. package/src/z-stack/styles.ts +7 -2
  383. package/tsconfig.json +6 -2
  384. package/tsconfig.tsbuildinfo +1 -1
@@ -9,6 +9,9 @@ const fromPathData24x24 = ( pathData ) => (
9
9
  </SVG>
10
10
  );
11
11
 
12
+ export const clipboard = fromPathData24x24(
13
+ 'M16 18H8v-2h8v2zm0-6H8v2h8v-2zm2-9h-2v2h2v15H6V5h2V3H6a2 2 0 00-2 2v15a2 2 0 002 2h12a2 2 0 002-2V5a2 2 0 00-2-2zm-4 2V4a2 2 0 10-4 0v1a2 2 0 00-2 2v1h8V7a2 2 0 00-2-2z'
14
+ );
12
15
  export const posts = fromPathData24x24(
13
16
  'M16 19H3v-2h13v2zm5-10H3v2h18V9zM3 5v2h11V5H3zm14 0v2h4V5h-4zm-6 8v2h10v-2H11zm-8 0v2h5v-2H3z'
14
17
  );
@@ -21,15 +24,12 @@ export const refresh = fromPathData24x24(
21
24
  export const noticeOutline = fromPathData24x24(
22
25
  'M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 13h-2v2h2v-2zm-2-2h2l.5-6h-3l.5 6z'
23
26
  );
24
-
25
27
  export const empty = (
26
28
  <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" />
27
29
  );
28
-
29
30
  export const search = fromPathData24x24(
30
31
  'M21,19l-5.154-5.154C16.574,12.742,17,11.421,17,10c0-3.866-3.134-7-7-7s-7,3.134-7,7c0,3.866,3.134,7,7,7 c1.421,0,2.742-0.426,3.846-1.154L19,21L21,19z M5,10c0-2.757,2.243-5,5-5s5,2.243,5,5s-2.243,5-5,5S5,12.757,5,10z'
31
32
  );
32
-
33
33
  export default {
34
34
  empty,
35
35
  posts,
@@ -42,6 +42,7 @@
42
42
  padding-top: 4;
43
43
  padding-bottom: 0;
44
44
  justify-content: center;
45
+ text-align: center;
45
46
  font-size: 12;
46
47
  color: $gray-dark;
47
48
  }
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { SafeAreaView, TouchableOpacity, View } from 'react-native';
4
+ import { Clipboard, SafeAreaView, TouchableOpacity, View } from 'react-native';
5
5
  import { lowerCase, startsWith } from 'lodash';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
- import { useState } from '@wordpress/element';
11
- import { __ } from '@wordpress/i18n';
10
+ import { useEffect, useState } from '@wordpress/element';
11
+ import { __, sprintf } from '@wordpress/i18n';
12
12
  import { BottomSheet, Icon } from '@wordpress/components';
13
- import { getProtocol, prependHTTP } from '@wordpress/url';
13
+ import { getProtocol, isURL, prependHTTP } from '@wordpress/url';
14
14
  import { link, cancelCircleFilled } from '@wordpress/icons';
15
15
  import { usePreferredColorSchemeStyle } from '@wordpress/compose';
16
16
 
@@ -47,12 +47,20 @@ export const createDirectEntry = ( value ) => {
47
47
  };
48
48
  };
49
49
 
50
+ const getURLFromClipboard = async () => {
51
+ const text = await Clipboard.getString();
52
+ return !! text && isURL( text ) ? text : '';
53
+ };
54
+
50
55
  export const LinkPicker = ( {
51
56
  value: initialValue,
52
57
  onLinkPicked,
53
58
  onCancel: cancel,
54
59
  } ) => {
55
- const [ value, setValue ] = useState( initialValue );
60
+ const [ { value, clipboardUrl }, setValue ] = useState( {
61
+ value: initialValue,
62
+ clipboardUrl: '',
63
+ } );
56
64
  const directEntry = createDirectEntry( value );
57
65
 
58
66
  // the title of a direct entry is displayed as the raw input value, but if we
@@ -66,7 +74,7 @@ export const LinkPicker = ( {
66
74
  };
67
75
 
68
76
  const clear = () => {
69
- setValue( '' );
77
+ setValue( { value: '', clipboardUrl } );
70
78
  };
71
79
 
72
80
  const omniCellStyle = usePreferredColorSchemeStyle(
@@ -79,6 +87,14 @@ export const LinkPicker = ( {
79
87
  styles.iconDark
80
88
  );
81
89
 
90
+ useEffect( () => {
91
+ getURLFromClipboard()
92
+ .then( ( url ) => setValue( { value, clipboardUrl: url } ) )
93
+ .catch( () => setValue( { value, clipboardUrl: '' } ) );
94
+ }, [] );
95
+
96
+ // TODO: Localize the accessibility label.
97
+ // TODO: Decide on if `LinkSuggestionItemCell` with `isDirectEntry` makes sense.
82
98
  return (
83
99
  <SafeAreaView style={ styles.safeArea }>
84
100
  <NavBar>
@@ -96,7 +112,9 @@ export const LinkPicker = ( {
96
112
  autoCapitalize="none"
97
113
  autoCorrect={ false }
98
114
  keyboardType="url"
99
- onChangeValue={ setValue }
115
+ onChangeValue={ ( newValue ) => {
116
+ setValue( { value: newValue, clipboardUrl } );
117
+ } }
100
118
  onSubmit={ onSubmit }
101
119
  /* eslint-disable-next-line jsx-a11y/no-autofocus */
102
120
  autoFocus
@@ -115,6 +133,22 @@ export const LinkPicker = ( {
115
133
  </TouchableOpacity>
116
134
  ) }
117
135
  </BottomSheet.Cell>
136
+ { !! clipboardUrl && clipboardUrl !== value && (
137
+ <BottomSheet.LinkSuggestionItemCell
138
+ accessible
139
+ accessibilityLabel={ sprintf(
140
+ /* translators: Copy URL from the clipboard, https://sample.url */
141
+ __( 'Copy URL from the clipboard, %s' ),
142
+ clipboardUrl
143
+ ) }
144
+ suggestion={ {
145
+ type: 'clipboard',
146
+ url: clipboardUrl,
147
+ isDirectEntry: true,
148
+ } }
149
+ onLinkPicked={ pickLink }
150
+ />
151
+ ) }
118
152
  { !! value && (
119
153
  <LinkPickerResults
120
154
  query={ value }
@@ -93,6 +93,7 @@ function LinkSettings( {
93
93
  const [ urlInputValue, setUrlInputValue ] = useState( '' );
94
94
  const [ labelInputValue, setLabelInputValue ] = useState( '' );
95
95
  const [ linkRelInputValue, setLinkRelInputValue ] = useState( '' );
96
+ const onCloseSettingsSheetConsumed = useRef( false );
96
97
  const prevEditorSidebarOpenedRef = useRef();
97
98
 
98
99
  const { onHandleClosingBottomSheet } = useContext( BottomSheetContext );
@@ -123,6 +124,10 @@ function LinkSettings( {
123
124
 
124
125
  useEffect( () => {
125
126
  const isSettingSheetOpen = isVisible || editorSidebarOpened;
127
+ if ( isSettingSheetOpen ) {
128
+ onCloseSettingsSheetConsumed.current = false;
129
+ }
130
+
126
131
  if ( options.url.autoFill && isSettingSheetOpen && ! url ) {
127
132
  getURLFromClipboard();
128
133
  }
@@ -174,6 +179,12 @@ function LinkSettings( {
174
179
  }, [ urlInputValue, labelInputValue, linkRelInputValue, setAttributes ] );
175
180
 
176
181
  const onCloseSettingsSheet = useCallback( () => {
182
+ if ( onCloseSettingsSheetConsumed.current ) {
183
+ return;
184
+ }
185
+
186
+ onCloseSettingsSheetConsumed.current = true;
187
+
177
188
  onSetAttributes();
178
189
 
179
190
  if ( onClose ) {
@@ -0,0 +1,432 @@
1
+ // noinspection DuplicatedCode
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import { Clipboard } from 'react-native';
7
+ import { fireEvent, initializeEditor, waitFor } from 'test/helpers';
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+ import { registerCoreBlocks } from '@wordpress/block-library';
12
+ import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
13
+ import { __ } from '@wordpress/i18n';
14
+
15
+ /**
16
+ * Utility function to unregister all core block types previously registered
17
+ * when staging the Redux Store `beforeAll` integration tests start running.
18
+ *
19
+ * This should probably be extracted into a utility module for future tests.
20
+ */
21
+ const unregisterBlocks = () => {
22
+ const blocks = getBlockTypes();
23
+
24
+ blocks.forEach( ( { name } ) => unregisterBlockType( name ) );
25
+ };
26
+
27
+ /**
28
+ * ### TODO
29
+ * + Try to figure out why I can't `console.log(JSON.stringify(subject.toJSON()))` anymore.
30
+ */
31
+ describe.each( [
32
+ [
33
+ {
34
+ type: 'core/button',
35
+ initialHtml: `
36
+ <!-- wp:button {"style":{"border":{"radius":"5px"}}} -->
37
+ <div class="wp-block-button">
38
+ <a class="wp-block-button__link" style="border-radius:5px">Link</a>
39
+ </div>
40
+ <!-- /wp:button -->
41
+ `,
42
+ toJSON: () => 'core/button',
43
+ },
44
+ ],
45
+ [
46
+ {
47
+ type: 'core/image',
48
+ initialHtml: `
49
+ <!-- wp:image {"id":20,"sizeSlug":"large","linkDestination":"custom"} -->
50
+ <figure class="wp-block-image size-large">
51
+ <img class="wp-image-20" src="https://tonytahmouchtest.files.wordpress.com/2021/10/img_0111-2.jpg?w=1024" alt="" />
52
+ </figure>
53
+ <!-- /wp:image -->
54
+ `,
55
+ toJSON: () => 'core/image',
56
+ },
57
+ ],
58
+ ] )( '<LinkSettings/> from %j', ( { type, initialHtml } ) => {
59
+ beforeAll( () => {
60
+ registerCoreBlocks();
61
+ } );
62
+
63
+ afterAll( () => {
64
+ unregisterBlocks();
65
+ } );
66
+
67
+ /**
68
+ * GIVEN an EDITOR is displayed with an EDIT IMAGE BLOCK or EDIT BUTTON BLOCK;
69
+ * GIVEN the CLIPBOARD has a URL copied;
70
+ * WHEN the USER selects the SETTINGS BUTTON on the EDIT IMAGE BLOCK or EDIT BUTTON BLOCK;
71
+ */
72
+ // eslint-disable-next-line jest/no-done-callback
73
+ it( 'should display the LINK SETTINGS with an EMPTY LINK TO field.', async ( done ) => {
74
+ // Arrange
75
+ const expectation =
76
+ 'The LINK SETTINGS > LINK TO field SHOULD be displayed WITHOUT a URL from the CLIPBOARD.';
77
+ const url = 'https://tonytahmouchtest.files.wordpress.com';
78
+ const subject = await initializeEditor( { initialHtml } );
79
+ Clipboard.getString.mockReturnValue( url );
80
+
81
+ // Act
82
+ try {
83
+ const block = await waitFor( () =>
84
+ subject.getByA11yLabel(
85
+ type === 'core/image' ? /Image Block/ : /Button Block/
86
+ )
87
+ );
88
+ fireEvent.press( block );
89
+ fireEvent.press( block );
90
+ fireEvent.press(
91
+ await waitFor( () => subject.getByA11yLabel( 'Open Settings' ) )
92
+ );
93
+ } catch ( error ) {
94
+ done.fail( error );
95
+ }
96
+
97
+ // Assert
98
+ try {
99
+ await waitFor( () =>
100
+ subject.getByA11yLabel(
101
+ `Link to, ${
102
+ type === 'core/image' ? 'None' : 'Search or type URL'
103
+ }`
104
+ )
105
+ );
106
+ done();
107
+ } catch ( error ) {
108
+ done.fail( expectation );
109
+ }
110
+ } );
111
+
112
+ describe( '<LinkPicker/>', () => {
113
+ describe( 'Hide Clipboard Link Suggestion - Invalid URL in Clipboard', () => {
114
+ /**
115
+ * GIVEN a SETTINGS BOTTOM SHEET is displayed;
116
+ * GIVEN the CLIPBOARD has a NON-URL copied;
117
+ * GIVEN the STATE has NO URL;
118
+ * WHEN the USER selects the LINK TO cell;
119
+ */
120
+ // eslint-disable-next-line jest/no-done-callback
121
+ it( 'should display the LINK PICKER with NO FROM CLIPBOARD CELL.', async ( done ) => {
122
+ // Arrange
123
+ const expectation =
124
+ 'The LINK PICKER > LINK SUGGESTION SHOULD NOT suggest the URL from the CLIPBOARD.';
125
+ const url = 'tonytahmouchtest.files.wordpress.com';
126
+ const subject = await initializeEditor( { initialHtml } );
127
+ Clipboard.getString.mockReturnValue( url );
128
+
129
+ // Act
130
+ try {
131
+ const block = await waitFor( () =>
132
+ subject.getByA11yLabel(
133
+ type === 'core/image'
134
+ ? /Image Block/
135
+ : /Button Block/
136
+ )
137
+ );
138
+ fireEvent.press( block );
139
+ fireEvent.press( block );
140
+ fireEvent.press(
141
+ await waitFor( () =>
142
+ subject.getByA11yLabel( 'Open Settings' )
143
+ )
144
+ );
145
+ fireEvent.press(
146
+ await waitFor( () =>
147
+ subject.getByA11yLabel(
148
+ `Link to, ${
149
+ type === 'core/image'
150
+ ? 'None'
151
+ : 'Search or type URL'
152
+ }`
153
+ )
154
+ )
155
+ );
156
+ if ( type === 'core/image' ) {
157
+ fireEvent.press(
158
+ await waitFor( () =>
159
+ subject.getByA11yLabel( /Custom URL/ )
160
+ )
161
+ );
162
+ }
163
+ await waitFor( () => subject.getByA11yLabel( 'Apply' ) );
164
+ } catch ( error ) {
165
+ done.fail( error );
166
+ }
167
+
168
+ // Assert
169
+ waitFor(
170
+ () =>
171
+ subject.getByA11yLabel(
172
+ /Copy URL from the clipboard[,]/
173
+ ),
174
+ { timeout: 50, interval: 10 }
175
+ )
176
+ .then( () => done.fail( expectation ) )
177
+ .catch( () => done() );
178
+ } );
179
+ } );
180
+
181
+ describe( 'Hide Clipboard Link Suggestion - Valid and Same URL in Clipboard', () => {
182
+ /**
183
+ * GIVEN a SETTINGS BOTTOM SHEET is displayed;
184
+ * GIVEN the CLIPBOARD has a URL copied;
185
+ * GIVEN the STATE has the SAME URL as the CLIPBOARD;
186
+ * WHEN the USER selects the LINK TO cell;
187
+ */
188
+ // eslint-disable-next-line jest/no-done-callback
189
+ it( 'should display the LINK PICKER with NO FROM CLIPBOARD CELL.', async ( done ) => {
190
+ // Arrange
191
+ const expectation =
192
+ 'The LINK PICKER > LINK SUGGESTION SHOULD NOT suggest the URL from the CLIPBOARD.';
193
+ const url = 'https://tonytahmouchtest.files.wordpress.com';
194
+ const subject = await initializeEditor( { initialHtml } );
195
+ Clipboard.getString.mockReturnValue( url );
196
+
197
+ // Act
198
+ try {
199
+ const block = await waitFor( () =>
200
+ subject.getByA11yLabel(
201
+ type === 'core/image'
202
+ ? /Image Block/
203
+ : /Button Block/
204
+ )
205
+ );
206
+ fireEvent.press( block );
207
+ fireEvent.press( block );
208
+ fireEvent.press(
209
+ await waitFor( () =>
210
+ subject.getByA11yLabel( 'Open Settings' )
211
+ )
212
+ );
213
+ fireEvent.press(
214
+ await waitFor( () =>
215
+ subject.getByA11yLabel(
216
+ `Link to, ${
217
+ type === 'core/image'
218
+ ? 'None'
219
+ : 'Search or type URL'
220
+ }`
221
+ )
222
+ )
223
+ );
224
+ if ( type === 'core/image' ) {
225
+ fireEvent.press(
226
+ await waitFor( () =>
227
+ subject.getByA11yLabel( 'Custom URL. Empty' )
228
+ )
229
+ );
230
+ }
231
+ fireEvent.press(
232
+ await waitFor( () =>
233
+ subject.getByA11yLabel(
234
+ `Copy URL from the clipboard, ${ url }`
235
+ )
236
+ )
237
+ );
238
+ fireEvent.press(
239
+ await waitFor( () =>
240
+ subject.getByA11yLabel(
241
+ `Link to, ${
242
+ type === 'core/image' ? 'Custom URL' : url
243
+ }`
244
+ )
245
+ )
246
+ );
247
+ if ( type === 'core/image' ) {
248
+ fireEvent.press(
249
+ await waitFor( () =>
250
+ subject.getByA11yLabel( `Custom URL, ${ url }` )
251
+ )
252
+ );
253
+ }
254
+ await waitFor( () => subject.getByA11yLabel( 'Apply' ) );
255
+ } catch ( error ) {
256
+ done.fail( error );
257
+ }
258
+
259
+ // Assert
260
+ waitFor(
261
+ () =>
262
+ subject.getByA11yLabel(
263
+ /Copy URL from the clipboard[,]/
264
+ ),
265
+ { timeout: 50, interval: 10 }
266
+ )
267
+ .then( () => done.fail( expectation ) )
268
+ .catch( () => done() );
269
+ } );
270
+ } );
271
+
272
+ describe( 'Show Clipboard Link Suggestion - Valid and Different URL in Clipboard', () => {
273
+ /**
274
+ * GIVEN a SETTINGS BOTTOM SHEET is displayed;
275
+ * GIVEN the CLIPBOARD has a URL copied;
276
+ * GIVEN the STATE has NO URL;
277
+ * WHEN the USER selects the LINK TO cell;
278
+ */
279
+ it(
280
+ 'should display the LINK PICKER with the FROM CLIPBOARD CELL populated' +
281
+ ' with the URL from the CLIPBOARD.',
282
+ // eslint-disable-next-line jest/no-done-callback
283
+ async ( done ) => {
284
+ // Arrange
285
+ const url = 'https://tonytahmouchtest.files.wordpress.com';
286
+ const expectation =
287
+ 'The LINK PICKER > LINK SUGGESTION SHOULD suggest the URL from the CLIPBOARD, e.g.,' +
288
+ `
289
+ ${ url }
290
+ ${ __( 'From clipboard' ) }
291
+ `;
292
+ const subject = await initializeEditor( { initialHtml } );
293
+ Clipboard.getString.mockReturnValue( url );
294
+
295
+ // Act
296
+ try {
297
+ const block = await waitFor( () =>
298
+ subject.getByA11yLabel(
299
+ type === 'core/image'
300
+ ? /Image Block/
301
+ : /Button Block/
302
+ )
303
+ );
304
+ fireEvent.press( block );
305
+ fireEvent.press( block );
306
+ fireEvent.press(
307
+ await waitFor( () =>
308
+ subject.getByA11yLabel( 'Open Settings' )
309
+ )
310
+ );
311
+ fireEvent.press(
312
+ await waitFor( () =>
313
+ subject.getByA11yLabel(
314
+ `Link to, ${
315
+ type === 'core/image'
316
+ ? 'None'
317
+ : 'Search or type URL'
318
+ }`
319
+ )
320
+ )
321
+ );
322
+ if ( type === 'core/image' ) {
323
+ fireEvent.press(
324
+ await waitFor( () =>
325
+ subject.getByA11yLabel( /Custom URL/ )
326
+ )
327
+ );
328
+ }
329
+ await waitFor( () =>
330
+ subject.getByA11yLabel(
331
+ `Copy URL from the clipboard, ${ url }`
332
+ )
333
+ );
334
+ } catch ( error ) {
335
+ done.fail( error );
336
+ }
337
+
338
+ // Assert
339
+ try {
340
+ await waitFor( () => subject.getByText( url ) );
341
+ await waitFor( () =>
342
+ subject.getByText( __( 'From clipboard' ) )
343
+ );
344
+ done();
345
+ } catch ( error ) {
346
+ done.fail( expectation );
347
+ }
348
+ }
349
+ );
350
+ } );
351
+
352
+ describe( 'Press Clipboard Link Suggestion', () => {
353
+ /**
354
+ * GIVEN a LINK PICKER SHEET is displayed;
355
+ * GIVEN the FROM CLIPBOARD CELL is displayed;
356
+ * WHEN the FROM CLIPBOARD CELL is pressed;
357
+ */
358
+ it(
359
+ 'should display the LINK SETTINGS with the URL from the CLIPBOARD' +
360
+ ' populated in the LINK TO field.',
361
+ // eslint-disable-next-line jest/no-done-callback
362
+ async ( done ) => {
363
+ // Arrange
364
+ const expectation =
365
+ 'The LINK SETTINGS > LINK TO field SHOULD be displayed WITH a URL from the CLIPBOARD.';
366
+ const url = 'https://tonytahmouchtest.files.wordpress.com';
367
+ const subject = await initializeEditor( { initialHtml } );
368
+ Clipboard.getString.mockReturnValue( url );
369
+
370
+ // Act
371
+ try {
372
+ const block = await waitFor( () =>
373
+ subject.getByA11yLabel(
374
+ type === 'core/image'
375
+ ? /Image Block/
376
+ : /Button Block/
377
+ )
378
+ );
379
+ fireEvent.press( block );
380
+ fireEvent.press( block );
381
+ fireEvent.press(
382
+ await waitFor( () =>
383
+ subject.getByA11yLabel( 'Open Settings' )
384
+ )
385
+ );
386
+ fireEvent.press(
387
+ await waitFor( () =>
388
+ subject.getByA11yLabel(
389
+ `Link to, ${
390
+ type === 'core/image'
391
+ ? 'None'
392
+ : 'Search or type URL'
393
+ }`
394
+ )
395
+ )
396
+ );
397
+ if ( type === 'core/image' ) {
398
+ fireEvent.press(
399
+ await waitFor( () =>
400
+ subject.getByA11yLabel( /Custom URL/ )
401
+ )
402
+ );
403
+ }
404
+ fireEvent.press(
405
+ await waitFor( () =>
406
+ subject.getByA11yLabel(
407
+ `Copy URL from the clipboard, ${ url }`
408
+ )
409
+ )
410
+ );
411
+ } catch ( error ) {
412
+ done.fail( error );
413
+ }
414
+
415
+ // Assert
416
+ try {
417
+ await waitFor( () =>
418
+ subject.getByA11yLabel(
419
+ `Link to, ${
420
+ type === 'core/image' ? 'Custom URL' : url
421
+ }`
422
+ )
423
+ );
424
+ done();
425
+ } catch ( error ) {
426
+ done.fail( expectation );
427
+ }
428
+ }
429
+ );
430
+ } );
431
+ } );
432
+ } );
@@ -255,6 +255,16 @@ This property when set to `true` will render a full screen modal.
255
255
  - Required: No
256
256
  - Default: `false`
257
257
 
258
+ #### __experimentalHideHeader
259
+
260
+ When set to `true`, the Modal's header (including the icon, title and close button) will not be rendered.
261
+
262
+ *Warning*: This property is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
263
+
264
+ - Type: `boolean`
265
+ - Required: No
266
+ - Default: `false`
267
+
258
268
  ## Related components
259
269
 
260
270
  - To notify a user with a message of medium importance, use `Notice`.
@@ -1,3 +1,5 @@
1
+ //@ts-nocheck
2
+
1
3
  /**
2
4
  * External dependencies
3
5
  */