@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
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 19.5.0 (2022-02-23)
6
+
7
+ ### Bug Fix
8
+
9
+ - Fix spin buttons of number inputs in Safari ([#38840](https://github.com/WordPress/gutenberg/pull/38840))
10
+
11
+ ### Enhancements
12
+
13
+ - `TreeGrid`: Add tests for `onCollapseRow`, `onExpandRow`, and `onFocusRow` callback functions. ([#38942](https://github.com/WordPress/gutenberg/pull/38942)).
14
+
5
15
  ## 19.4.0 (2022-02-10)
6
16
 
7
17
  ### Bug Fix
@@ -20,10 +30,14 @@
20
30
  - Update the visual design of the `Spinner` component. ([#37551](https://github.com/WordPress/gutenberg/pull/37551))
21
31
  - `TreeGrid` accessibility enhancements around the expand/collapse functionality. ([#38358](https://github.com/WordPress/gutenberg/pull/38358))
22
32
  - `TreeGrid` accessibility: improve browser support for Left Arrow focus to parent row in child row. ([#38639](https://github.com/WordPress/gutenberg/pull/38639))
33
+ - `TreeGrid` accessibility: Add Home/End keys for better keyboard navigation. ([#38679](https://github.com/WordPress/gutenberg/pull/38679))
34
+ - Add `resolvePoint` prop to `FocalPointPicker` to allow updating the value of the picker after a user interaction ([#38247](https://github.com/WordPress/gutenberg/pull/38247))
35
+ - `TreeGrid`: Allow SHIFT key to be held, and add `onFocusRow` callback to the `TreeGrid` component, fired when focus is shifted from one row to another via Up and Down arrow keys. ([#38314](https://github.com/WordPress/gutenberg/pull/38314))
23
36
 
24
37
  ### Experimental
25
38
 
26
39
  - `Navigator`: rename `push`/`pop` to `goTo`/`goBack` ([#38582](https://github.com/WordPress/gutenberg/pull/38582))
40
+ - `Navigator`: add `NavigatorButton` and `NavigatorBackButton` components ([#38634](https://github.com/WordPress/gutenberg/pull/38634))
27
41
 
28
42
  ## 19.3.0 (2022-01-27)
29
43
 
@@ -31,10 +45,11 @@
31
45
 
32
46
  - Refine `ExternalLink` to be same size as the text, to appear more as a glyph than an icon. ([#37859](https://github.com/WordPress/gutenberg/pull/37859))
33
47
  - Updated `ToolsPanel` header icon to only show "plus" icon when all items are optional and all are currently hidden ([#38262](https://github.com/WordPress/gutenberg/pull/38262))
34
- - `TreeGrid`: Fix keyboard navigation for expand/collapse table rows in Firefox ([#37983](https://github.com/WordPress/gutenberg/pull/37983))
48
+ - `TreeGrid`: Fix keyboard navigation for expand/collapse table rows in Firefox ([#37983](https://github.com/WordPress/gutenberg/pull/37983))
35
49
 
36
50
  ### Bug Fix
37
51
 
52
+ - Update the `HexInput` component to accept a pasted value that contains a starting #
38
53
  - Update `ToggleGroupControl` background active state to use a simple background color instead of animated backdrop ([38008](https://github.com/WordPress/gutenberg/pull/38008))
39
54
  - Update label spacing for the `BoxControl`, `CustomGradientPicker`, `FormTokenField`, `InputControl`, and `ToolsPanel` components to use a bottom margin of `8px` for consistency. ([#37844](https://github.com/WordPress/gutenberg/pull/37844))
40
55
  - Add missing styles to the `BaseControl.VisualLabel` component. ([#37747](https://github.com/WordPress/gutenberg/pull/37747))
package/CONTRIBUTING.md CHANGED
@@ -32,7 +32,11 @@ In these situations, one possible approach is to "soft-deprecate" a given legacy
32
32
 
33
33
  When adding new components or new props to existing components, it's recommended to prefix them with `__unstable` or `__experimental` until they're stable enough to be exposed as part of the public API.
34
34
 
35
- Learn more on [How to preserve backward compatibility for a React Component](/docs/contributors/code/backward-compatibility.md#how-to-preserve-backward-compatibility-for-a-react-component) and [Experimental and Unstable APIs](/docs/contributors/code/coding-guidelines.md#experimental-and-unstable-apis).
35
+ ### Learn more
36
+
37
+ - [How to preserve backward compatibility for a React Component](/docs/contributors/code/backward-compatibility.md#how-to-preserve-backward-compatibility-for-a-react-component)
38
+ - [Experimental and Unstable APIs](/docs/contributors/code/coding-guidelines.md#experimental-and-unstable-apis)
39
+ - [Deprecating styles](#deprecating-styles)
36
40
 
37
41
  <!-- ## Polymorphic Components (i.e. the `as` prop)
38
42
 
@@ -141,7 +145,7 @@ function useExampleComponent( props: PolymorphicComponentProps< ExampleProps, 'd
141
145
  // in `component.tsx`
142
146
  function Example(
143
147
  props: PolymorphicComponentProps< ExampleProps, 'div' >,
144
- forwardedRef: Ref< any >
148
+ forwardedRef: React.ForwardedRef< any >
145
149
  ) {
146
150
  const exampleProps = useExampleComponent( props );
147
151
 
@@ -180,6 +184,69 @@ All new component should be styled using [Emotion](https://emotion.sh/docs/intro
180
184
 
181
185
  Note: Instead of using Emotion's standard `cx` function, the custom [`useCx` hook](/packages/components/src/utils/hooks/use-cx.ts) should be used instead.
182
186
 
187
+
188
+ ### Deprecating styles
189
+
190
+ Changing the styles of a non-experimental component must be done with care. To prevent serious breakage in third-party usage, in some cases we may want a grace period before fully removing the old styles. This can be done by temporarily placing the new styles behind a feature flag prop prefixed by `__next`, accompanied by a `deprecate()` warning in the console. The feature flag should be opt-in (false by default), and have a reasonably descriptive name (**not** `__nextHasNewStyles`). A descriptive name allows for multiple deprecations to proceed in parallel, separated by concerns or by deprecation version.
191
+
192
+ ```jsx
193
+ // component.tsx
194
+ import deprecated from '@wordpress/deprecated';
195
+ import { Wrapper } from './styles.ts';
196
+
197
+ function MyComponent({ __nextHasNoOuterMargins = false }) {
198
+ if ( ! __nextHasNoOuterMargins ) {
199
+ deprecated( 'Outer margin styles for wp.components.MyComponent', {
200
+ since: '6.0',
201
+ version: '6.2', // Set a reasonable grace period depending on impact
202
+ hint:
203
+ 'Set the `__nextHasNoOuterMargins` prop to true to start opting into the new styles, which will become the default in a future version.',
204
+ } );
205
+ }
206
+ return <Wrapper __nextHasNoOuterMargins={__nextHasNoOuterMargins} />
207
+ }
208
+ ```
209
+
210
+ Styles should be structured so the deprecated styles are cleanly encapsulated, and can be easily removed when the deprecation version arrives.
211
+
212
+ ```js
213
+ // styles.ts
214
+ const deprecatedMargins = ({ __nextHasNoOuterMargins }) => {
215
+ if ( ! __nextHasNoOuterMargins ) {
216
+ return css`
217
+ margin: 8px;
218
+ `;
219
+ }
220
+ };
221
+
222
+ export const Wrapper = styled.div`
223
+ margin: 0;
224
+
225
+ ${deprecatedMargins}
226
+ `;
227
+ ```
228
+
229
+ Once deprecated, code examples in docs/stories should include the opt-in prop set to `true` so that new consumers are encouraged to adopt it from the start.
230
+
231
+ Remember to [add a **Needs Dev Note** label](/docs/contributors/code/backward-compatibility.md##dev-notes) to the pull request so third-party developers can be informed of the deprecation.
232
+
233
+ When the grace period is over and the deprecation version arrives, the `__next*` prop, deprecation notice, and deprecated styles should all be completely removed from the codebase.
234
+
235
+ #### Criteria for putting styles changes behind a feature flag
236
+
237
+ Not all style changes justify a formal deprecation process. The main thing to look for is whether the changes could cause layouts to break in an obvious or harmful way, given that the component is being used in a standard fashion.
238
+
239
+ ##### DOES need formal deprecation
240
+
241
+ - Removing an outer margin.
242
+ - Substantial changes to width/height, such as adding or removing a size restriction.
243
+
244
+ ##### DOES NOT need formal deprecation
245
+
246
+ - Breakage only occurs in non-standard usage, such as when the consumer is overriding component internals.
247
+ - Minor layout shifts of a few pixels.
248
+ - Internal layout changes of a higher-level component.
249
+
183
250
  ## Context system
184
251
 
185
252
  The `@wordpress/components` context system is based on [React's `Context` API](https://reactjs.org/docs/context.html), and is a way for components to adapt to the "context" they're being rendered in.
@@ -13,7 +13,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
13
13
 
14
14
  var _lodash = require("lodash");
15
15
 
16
- var _reactUseGesture = require("react-use-gesture");
16
+ var _react = require("@use-gesture/react");
17
17
 
18
18
  var _tooltip = _interopRequireDefault(require("../tooltip"));
19
19
 
@@ -37,7 +37,7 @@ function BoxUnitControl(_ref) {
37
37
  value,
38
38
  ...props
39
39
  } = _ref;
40
- const bindHoverGesture = (0, _reactUseGesture.useHover)(_ref2 => {
40
+ const bindHoverGesture = (0, _react.useHover)(_ref2 => {
41
41
  let {
42
42
  event,
43
43
  ...state
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/box-control/unit-control.js"],"names":["BoxUnitControl","isFirst","isLast","isOnly","onHoverOn","noop","onHoverOff","label","value","props","bindHoverGesture","event","state","hovering","Tooltip","children","text"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,cAAT,OASX;AAAA,MAToC;AACvCC,IAAAA,OADuC;AAEvCC,IAAAA,MAFuC;AAGvCC,IAAAA,MAHuC;AAIvCC,IAAAA,SAAS,GAAGC,YAJ2B;AAKvCC,IAAAA,UAAU,GAAGD,YAL0B;AAMvCE,IAAAA,KANuC;AAOvCC,IAAAA,KAPuC;AAQvC,OAAGC;AARoC,GASpC;AACH,QAAMC,gBAAgB,GAAG,+BAAU,SAA2B;AAAA,QAAzB;AAAEC,MAAAA,KAAF;AAAS,SAAGC;AAAZ,KAAyB;;AAC7D,QAAKA,KAAK,CAACC,QAAX,EAAsB;AACrBT,MAAAA,SAAS,CAAEO,KAAF,EAASC,KAAT,CAAT;AACA,KAFD,MAEO;AACNN,MAAAA,UAAU,CAAEK,KAAF,EAASC,KAAT,CAAV;AACA;AACD,GANwB,CAAzB;AAQA,SACC,4BAAC,oCAAD,EAAyBF,gBAAgB,EAAzC,EACC,4BAAC,OAAD;AAAS,IAAA,IAAI,EAAGH;AAAhB,KACC,4BAAC,6BAAD;AACC,kBAAaA,KADd;AAEC,IAAA,SAAS,EAAC,qCAFX;AAGC,IAAA,cAAc,MAHf;AAIC,IAAA,OAAO,EAAGN,OAJX;AAKC,IAAA,MAAM,EAAGC,MALV;AAMC,IAAA,MAAM,EAAGC,MANV;AAOC,IAAA,oBAAoB,MAPrB;AAQC,IAAA,wBAAwB,EAAG,KAR5B;AASC,IAAA,KAAK,EAAGK;AATT,KAUMC,KAVN,EADD,CADD,CADD;AAkBA;;AAED,SAASK,OAAT,QAAuC;AAAA,MAArB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAqB;AACtC,MAAK,CAAEA,IAAP,EAAc,OAAOD,QAAP;AAEd;AACD;AACA;AACA;AACA;AACA;AACA;AACA;;AACC,SACC,4BAAC,gBAAD;AAAa,IAAA,IAAI,EAAGC,IAApB;AAA2B,IAAA,QAAQ,EAAC;AAApC,KACC,yCAAOD,QAAP,CADD,CADD;AAKA","sourcesContent":["/**\n * External dependencies\n */\nimport { noop } from 'lodash';\nimport { useHover } from 'react-use-gesture';\n\n/**\n * Internal dependencies\n */\nimport BaseTooltip from '../tooltip';\nimport { UnitControlWrapper, UnitControl } from './styles/box-control-styles';\n\nexport default function BoxUnitControl( {\n\tisFirst,\n\tisLast,\n\tisOnly,\n\tonHoverOn = noop,\n\tonHoverOff = noop,\n\tlabel,\n\tvalue,\n\t...props\n} ) {\n\tconst bindHoverGesture = useHover( ( { event, ...state } ) => {\n\t\tif ( state.hovering ) {\n\t\t\tonHoverOn( event, state );\n\t\t} else {\n\t\t\tonHoverOff( event, state );\n\t\t}\n\t} );\n\n\treturn (\n\t\t<UnitControlWrapper { ...bindHoverGesture() }>\n\t\t\t<Tooltip text={ label }>\n\t\t\t\t<UnitControl\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tclassName=\"component-box-control__unit-control\"\n\t\t\t\t\thideHTMLArrows\n\t\t\t\t\tisFirst={ isFirst }\n\t\t\t\t\tisLast={ isLast }\n\t\t\t\t\tisOnly={ isOnly }\n\t\t\t\t\tisPressEnterToChange\n\t\t\t\t\tisResetValueOnUnitChange={ false }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t</Tooltip>\n\t\t</UnitControlWrapper>\n\t);\n}\n\nfunction Tooltip( { children, text } ) {\n\tif ( ! text ) return children;\n\n\t/**\n\t * Wrapping the children in a `<div />` as Tooltip as it attempts\n\t * to render the <UnitControl />. Using a plain `<div />` appears to\n\t * resolve this issue.\n\t *\n\t * Originally discovered and referenced here:\n\t * https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026\n\t */\n\treturn (\n\t\t<BaseTooltip text={ text } position=\"top\">\n\t\t\t<div>{ children }</div>\n\t\t</BaseTooltip>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/box-control/unit-control.js"],"names":["BoxUnitControl","isFirst","isLast","isOnly","onHoverOn","noop","onHoverOff","label","value","props","bindHoverGesture","event","state","hovering","Tooltip","children","text"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,cAAT,OASX;AAAA,MAToC;AACvCC,IAAAA,OADuC;AAEvCC,IAAAA,MAFuC;AAGvCC,IAAAA,MAHuC;AAIvCC,IAAAA,SAAS,GAAGC,YAJ2B;AAKvCC,IAAAA,UAAU,GAAGD,YAL0B;AAMvCE,IAAAA,KANuC;AAOvCC,IAAAA,KAPuC;AAQvC,OAAGC;AARoC,GASpC;AACH,QAAMC,gBAAgB,GAAG,qBAAU,SAA2B;AAAA,QAAzB;AAAEC,MAAAA,KAAF;AAAS,SAAGC;AAAZ,KAAyB;;AAC7D,QAAKA,KAAK,CAACC,QAAX,EAAsB;AACrBT,MAAAA,SAAS,CAAEO,KAAF,EAASC,KAAT,CAAT;AACA,KAFD,MAEO;AACNN,MAAAA,UAAU,CAAEK,KAAF,EAASC,KAAT,CAAV;AACA;AACD,GANwB,CAAzB;AAQA,SACC,4BAAC,oCAAD,EAAyBF,gBAAgB,EAAzC,EACC,4BAAC,OAAD;AAAS,IAAA,IAAI,EAAGH;AAAhB,KACC,4BAAC,6BAAD;AACC,kBAAaA,KADd;AAEC,IAAA,SAAS,EAAC,qCAFX;AAGC,IAAA,cAAc,MAHf;AAIC,IAAA,OAAO,EAAGN,OAJX;AAKC,IAAA,MAAM,EAAGC,MALV;AAMC,IAAA,MAAM,EAAGC,MANV;AAOC,IAAA,oBAAoB,MAPrB;AAQC,IAAA,wBAAwB,EAAG,KAR5B;AASC,IAAA,KAAK,EAAGK;AATT,KAUMC,KAVN,EADD,CADD,CADD;AAkBA;;AAED,SAASK,OAAT,QAAuC;AAAA,MAArB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAqB;AACtC,MAAK,CAAEA,IAAP,EAAc,OAAOD,QAAP;AAEd;AACD;AACA;AACA;AACA;AACA;AACA;AACA;;AACC,SACC,4BAAC,gBAAD;AAAa,IAAA,IAAI,EAAGC,IAApB;AAA2B,IAAA,QAAQ,EAAC;AAApC,KACC,yCAAOD,QAAP,CADD,CADD;AAKA","sourcesContent":["/**\n * External dependencies\n */\nimport { noop } from 'lodash';\nimport { useHover } from '@use-gesture/react';\n\n/**\n * Internal dependencies\n */\nimport BaseTooltip from '../tooltip';\nimport { UnitControlWrapper, UnitControl } from './styles/box-control-styles';\n\nexport default function BoxUnitControl( {\n\tisFirst,\n\tisLast,\n\tisOnly,\n\tonHoverOn = noop,\n\tonHoverOff = noop,\n\tlabel,\n\tvalue,\n\t...props\n} ) {\n\tconst bindHoverGesture = useHover( ( { event, ...state } ) => {\n\t\tif ( state.hovering ) {\n\t\t\tonHoverOn( event, state );\n\t\t} else {\n\t\t\tonHoverOff( event, state );\n\t\t}\n\t} );\n\n\treturn (\n\t\t<UnitControlWrapper { ...bindHoverGesture() }>\n\t\t\t<Tooltip text={ label }>\n\t\t\t\t<UnitControl\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tclassName=\"component-box-control__unit-control\"\n\t\t\t\t\thideHTMLArrows\n\t\t\t\t\tisFirst={ isFirst }\n\t\t\t\t\tisLast={ isLast }\n\t\t\t\t\tisOnly={ isOnly }\n\t\t\t\t\tisPressEnterToChange\n\t\t\t\t\tisResetValueOnUnitChange={ false }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t</Tooltip>\n\t\t</UnitControlWrapper>\n\t);\n}\n\nfunction Tooltip( { children, text } ) {\n\tif ( ! text ) return children;\n\n\t/**\n\t * Wrapping the children in a `<div />` as Tooltip as it attempts\n\t * to render the <UnitControl />. Using a plain `<div />` appears to\n\t * resolve this issue.\n\t *\n\t * Originally discovered and referenced here:\n\t * https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026\n\t */\n\treturn (\n\t\t<BaseTooltip text={ text } position=\"top\">\n\t\t\t<div>{ children }</div>\n\t\t</BaseTooltip>\n\t);\n}\n"]}
@@ -45,7 +45,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
45
45
 
46
46
  /**
47
47
  * @param {import('../../ui/context').WordPressComponentProps<import('../types').Props, 'div'>} props
48
- * @param {import('react').Ref<any>} forwardedRef
48
+ * @param {import('react').ForwardedRef<any>} forwardedRef
49
49
  */
50
50
  function Card(props, forwardedRef) {
51
51
  const {
@@ -60,7 +60,7 @@ function Card(props, forwardedRef) {
60
60
  const cx = (0, _useCx.useCx)();
61
61
  const elevationClassName = (0, _element.useMemo)(() => cx( /*#__PURE__*/(0, _react.css)({
62
62
  borderRadius: elevationBorderRadius
63
- }, process.env.NODE_ENV === "production" ? "" : ";label:elevationClassName;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvY2FyZC9jYXJkL2NvbXBvbmVudC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF1Q1kiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy9jYXJkL2NhcmQvY29tcG9uZW50LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm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AgICAgPEhlYWRpbmcgc2l6ZT17IDQgfT5DYXJkIFRpdGxlPC9IZWFkaW5nPlxuICogICAgICAgPC9DYXJkSGVhZGVyPlxuICogICAgICAgPENhcmRCb2R5PlxuICogICAgICAgICA8VGV4dD5DYXJkIENvbnRlbnQ8L1RleHQ+XG4gKiAgICAgICA8L0NhcmRCb2R5PlxuICogICAgICAgPENhcmRGb290ZXI+XG4gKiAgICAgICAgIDxUZXh0PkNhcmQgRm9vdGVyPC9UZXh0PlxuICogICAgICAgPC9DYXJkRm9vdGVyPlxuICogICAgIDwvQ2FyZD5cbiAqICAgKTtcbiAqIH1cbiAqIGBgYFxuICovXG5jb25zdCBDb25uZWN0ZWRDYXJkID0gY29udGV4dENvbm5lY3QoIENhcmQsICdDYXJkJyApO1xuXG5leHBvcnQgZGVmYXVsdCBDb25uZWN0ZWRDYXJkO1xuIl19 */")), [cx, elevationBorderRadius]);
63
+ }, process.env.NODE_ENV === "production" ? "" : ";label:elevationClassName;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvY2FyZC9jYXJkL2NvbXBvbmVudC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF1Q1kiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy9jYXJkL2NhcmQvY29tcG9uZW50LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFdvcmRQcmVzcyBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgdXNlTWVtbyB9IGZyb20gJ0B3b3JkcHJlc3MvZWxlbWVudCc7XG5cbi8qKlxuICogSW50ZXJ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gKiAgICAgICAgIDxUZXh0PkNhcmQgRm9vdGVyPC9UZXh0PlxuICogICAgICAgPC9DYXJkRm9vdGVyPlxuICogICAgIDwvQ2FyZD5cbiAqICAgKTtcbiAqIH1cbiAqIGBgYFxuICovXG5jb25zdCBDb25uZWN0ZWRDYXJkID0gY29udGV4dENvbm5lY3QoIENhcmQsICdDYXJkJyApO1xuXG5leHBvcnQgZGVmYXVsdCBDb25uZWN0ZWRDYXJkO1xuIl19 */")), [cx, elevationBorderRadius]);
64
64
  const contextProviderValue = (0, _element.useMemo)(() => {
65
65
  const contextProps = {
66
66
  size,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/card/card/component.js"],"names":["Card","props","forwardedRef","children","elevation","isBorderless","isRounded","size","otherProps","elevationBorderRadius","CONFIG","cardBorderRadius","cx","elevationClassName","borderRadius","contextProviderValue","contextProps","CardBody","CardHeader","CardFooter","styles","Content","ConnectedCard"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA,SAASA,IAAT,CAAeC,KAAf,EAAsBC,YAAtB,EAAqC;AACpC,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,SAFK;AAGLC,IAAAA,YAHK;AAILC,IAAAA,SAJK;AAKLC,IAAAA,IALK;AAML,OAAGC;AANE,MAOF,mBAASP,KAAT,CAPJ;AAQA,QAAMQ,qBAAqB,GAAGH,SAAS,GAAGI,sBAAOC,gBAAV,GAA6B,CAApE;AAEA,QAAMC,EAAE,GAAG,mBAAX;AAEA,QAAMC,kBAAkB,GAAG,sBAC1B,MAAMD,EAAE,eAAE,gBAAK;AAAEE,IAAAA,YAAY,EAAEL;AAAhB,GAAL,olIAAF,CADkB,EAE1B,CAAEG,EAAF,EAAMH,qBAAN,CAF0B,CAA3B;AAKA,QAAMM,oBAAoB,GAAG,sBAAS,MAAM;AAC3C,UAAMC,YAAY,GAAG;AACpBT,MAAAA,IADoB;AAEpBF,MAAAA;AAFoB,KAArB;AAIA,WAAO;AACNY,MAAAA,QAAQ,EAAED,YADJ;AAENE,MAAAA,UAAU,EAAEF,YAFN;AAGNG,MAAAA,UAAU,EAAEH;AAHN,KAAP;AAKA,GAV4B,EAU1B,CAAEX,YAAF,EAAgBE,IAAhB,CAV0B,CAA7B;AAYA,SACC,4BAAC,8BAAD;AAAuB,IAAA,KAAK,EAAGQ;AAA/B,KACC,4BAAC,UAAD,6BAAWP,UAAX;AAAwB,IAAA,GAAG,EAAGN;AAA9B,MACC,4BAAC,UAAD;AAAM,IAAA,SAAS,EAAGU,EAAE,CAAEQ,MAAM,CAACC,OAAT;AAApB,KAA2ClB,QAA3C,CADD,EAEC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAGU,kBADb;AAEC,IAAA,aAAa,EAAG,KAFjB;AAGC,IAAA,KAAK,EAAGT,SAAS,GAAG,CAAH,GAAO;AAHzB,IAFD,EAOC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAGS,kBADb;AAEC,IAAA,aAAa,EAAG,KAFjB;AAGC,IAAA,KAAK,EAAGT;AAHT,IAPD,CADD,CADD;AAiBA;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,MAAMkB,aAAa,GAAG,6BAAgBtB,IAAhB,EAAsB,MAAtB,CAAtB;eAEesB,a","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, ContextSystemProvider } from '../../ui/context';\nimport { Elevation } from '../../elevation';\nimport { View } from '../../view';\nimport * as styles from '../styles';\nimport { useCard } from './hook';\nimport CONFIG from '../../utils/config-values';\nimport { useCx } from '../../utils/hooks/use-cx';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<import('../types').Props, 'div'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction Card( props, forwardedRef ) {\n\tconst {\n\t\tchildren,\n\t\televation,\n\t\tisBorderless,\n\t\tisRounded,\n\t\tsize,\n\t\t...otherProps\n\t} = useCard( props );\n\tconst elevationBorderRadius = isRounded ? CONFIG.cardBorderRadius : 0;\n\n\tconst cx = useCx();\n\n\tconst elevationClassName = useMemo(\n\t\t() => cx( css( { borderRadius: elevationBorderRadius } ) ),\n\t\t[ cx, elevationBorderRadius ]\n\t);\n\n\tconst contextProviderValue = useMemo( () => {\n\t\tconst contextProps = {\n\t\t\tsize,\n\t\t\tisBorderless,\n\t\t};\n\t\treturn {\n\t\t\tCardBody: contextProps,\n\t\t\tCardHeader: contextProps,\n\t\t\tCardFooter: contextProps,\n\t\t};\n\t}, [ isBorderless, size ] );\n\n\treturn (\n\t\t<ContextSystemProvider value={ contextProviderValue }>\n\t\t\t<View { ...otherProps } ref={ forwardedRef }>\n\t\t\t\t<View className={ cx( styles.Content ) }>{ children }</View>\n\t\t\t\t<Elevation\n\t\t\t\t\tclassName={ elevationClassName }\n\t\t\t\t\tisInteractive={ false }\n\t\t\t\t\tvalue={ elevation ? 1 : 0 }\n\t\t\t\t/>\n\t\t\t\t<Elevation\n\t\t\t\t\tclassName={ elevationClassName }\n\t\t\t\t\tisInteractive={ false }\n\t\t\t\t\tvalue={ elevation }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</ContextSystemProvider>\n\t);\n}\n\n/**\n * `Card` provides a flexible and extensible content container.\n * `Card` also provides a convenient set of sub-components such as `CardBody`,\n * `CardHeader`, `CardFooter`, and more.\n *\n * @example\n * ```jsx\n * import {\n * Card,\n * CardHeader,\n * CardBody,\n * CardFooter,\n * Text,\n * Heading,\n * } from `@wordpress/components`;\n *\n * function Example() {\n * return (\n * <Card>\n * <CardHeader>\n * <Heading size={ 4 }>Card Title</Heading>\n * </CardHeader>\n * <CardBody>\n * <Text>Card Content</Text>\n * </CardBody>\n * <CardFooter>\n * <Text>Card Footer</Text>\n * </CardFooter>\n * </Card>\n * );\n * }\n * ```\n */\nconst ConnectedCard = contextConnect( Card, 'Card' );\n\nexport default ConnectedCard;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/card/card/component.js"],"names":["Card","props","forwardedRef","children","elevation","isBorderless","isRounded","size","otherProps","elevationBorderRadius","CONFIG","cardBorderRadius","cx","elevationClassName","borderRadius","contextProviderValue","contextProps","CardBody","CardHeader","CardFooter","styles","Content","ConnectedCard"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA,SAASA,IAAT,CAAeC,KAAf,EAAsBC,YAAtB,EAAqC;AACpC,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,SAFK;AAGLC,IAAAA,YAHK;AAILC,IAAAA,SAJK;AAKLC,IAAAA,IALK;AAML,OAAGC;AANE,MAOF,mBAASP,KAAT,CAPJ;AAQA,QAAMQ,qBAAqB,GAAGH,SAAS,GAAGI,sBAAOC,gBAAV,GAA6B,CAApE;AAEA,QAAMC,EAAE,GAAG,mBAAX;AAEA,QAAMC,kBAAkB,GAAG,sBAC1B,MAAMD,EAAE,eAAE,gBAAK;AAAEE,IAAAA,YAAY,EAAEL;AAAhB,GAAL,olIAAF,CADkB,EAE1B,CAAEG,EAAF,EAAMH,qBAAN,CAF0B,CAA3B;AAKA,QAAMM,oBAAoB,GAAG,sBAAS,MAAM;AAC3C,UAAMC,YAAY,GAAG;AACpBT,MAAAA,IADoB;AAEpBF,MAAAA;AAFoB,KAArB;AAIA,WAAO;AACNY,MAAAA,QAAQ,EAAED,YADJ;AAENE,MAAAA,UAAU,EAAEF,YAFN;AAGNG,MAAAA,UAAU,EAAEH;AAHN,KAAP;AAKA,GAV4B,EAU1B,CAAEX,YAAF,EAAgBE,IAAhB,CAV0B,CAA7B;AAYA,SACC,4BAAC,8BAAD;AAAuB,IAAA,KAAK,EAAGQ;AAA/B,KACC,4BAAC,UAAD,6BAAWP,UAAX;AAAwB,IAAA,GAAG,EAAGN;AAA9B,MACC,4BAAC,UAAD;AAAM,IAAA,SAAS,EAAGU,EAAE,CAAEQ,MAAM,CAACC,OAAT;AAApB,KAA2ClB,QAA3C,CADD,EAEC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAGU,kBADb;AAEC,IAAA,aAAa,EAAG,KAFjB;AAGC,IAAA,KAAK,EAAGT,SAAS,GAAG,CAAH,GAAO;AAHzB,IAFD,EAOC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAGS,kBADb;AAEC,IAAA,aAAa,EAAG,KAFjB;AAGC,IAAA,KAAK,EAAGT;AAHT,IAPD,CADD,CADD;AAiBA;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,MAAMkB,aAAa,GAAG,6BAAgBtB,IAAhB,EAAsB,MAAtB,CAAtB;eAEesB,a","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, ContextSystemProvider } from '../../ui/context';\nimport { Elevation } from '../../elevation';\nimport { View } from '../../view';\nimport * as styles from '../styles';\nimport { useCard } from './hook';\nimport CONFIG from '../../utils/config-values';\nimport { useCx } from '../../utils/hooks/use-cx';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<import('../types').Props, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction Card( props, forwardedRef ) {\n\tconst {\n\t\tchildren,\n\t\televation,\n\t\tisBorderless,\n\t\tisRounded,\n\t\tsize,\n\t\t...otherProps\n\t} = useCard( props );\n\tconst elevationBorderRadius = isRounded ? CONFIG.cardBorderRadius : 0;\n\n\tconst cx = useCx();\n\n\tconst elevationClassName = useMemo(\n\t\t() => cx( css( { borderRadius: elevationBorderRadius } ) ),\n\t\t[ cx, elevationBorderRadius ]\n\t);\n\n\tconst contextProviderValue = useMemo( () => {\n\t\tconst contextProps = {\n\t\t\tsize,\n\t\t\tisBorderless,\n\t\t};\n\t\treturn {\n\t\t\tCardBody: contextProps,\n\t\t\tCardHeader: contextProps,\n\t\t\tCardFooter: contextProps,\n\t\t};\n\t}, [ isBorderless, size ] );\n\n\treturn (\n\t\t<ContextSystemProvider value={ contextProviderValue }>\n\t\t\t<View { ...otherProps } ref={ forwardedRef }>\n\t\t\t\t<View className={ cx( styles.Content ) }>{ children }</View>\n\t\t\t\t<Elevation\n\t\t\t\t\tclassName={ elevationClassName }\n\t\t\t\t\tisInteractive={ false }\n\t\t\t\t\tvalue={ elevation ? 1 : 0 }\n\t\t\t\t/>\n\t\t\t\t<Elevation\n\t\t\t\t\tclassName={ elevationClassName }\n\t\t\t\t\tisInteractive={ false }\n\t\t\t\t\tvalue={ elevation }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</ContextSystemProvider>\n\t);\n}\n\n/**\n * `Card` provides a flexible and extensible content container.\n * `Card` also provides a convenient set of sub-components such as `CardBody`,\n * `CardHeader`, `CardFooter`, and more.\n *\n * @example\n * ```jsx\n * import {\n * Card,\n * CardHeader,\n * CardBody,\n * CardFooter,\n * Text,\n * Heading,\n * } from `@wordpress/components`;\n *\n * function Example() {\n * return (\n * <Card>\n * <CardHeader>\n * <Heading size={ 4 }>Card Title</Heading>\n * </CardHeader>\n * <CardBody>\n * <Text>Card Content</Text>\n * </CardBody>\n * <CardFooter>\n * <Text>Card Footer</Text>\n * </CardFooter>\n * </Card>\n * );\n * }\n * ```\n */\nconst ConnectedCard = contextConnect( Card, 'Card' );\n\nexport default ConnectedCard;\n"]}
@@ -25,7 +25,7 @@ var _hook = require("./hook");
25
25
 
26
26
  /**
27
27
  * @param {import('../../ui/context').WordPressComponentProps<import('../types').BodyProps, 'div'>} props
28
- * @param {import('react').Ref<any>} forwardedRef
28
+ * @param {import('react').ForwardedRef<any>} forwardedRef
29
29
  */
30
30
  function CardBody(props, forwardedRef) {
31
31
  const {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/card/card-body/component.js"],"names":["CardBody","props","forwardedRef","isScrollable","otherProps","ConnectedCardBody"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,SAASA,QAAT,CAAmBC,KAAnB,EAA0BC,YAA1B,EAAyC;AACxC,QAAM;AAAEC,IAAAA,YAAF;AAAgB,OAAGC;AAAnB,MAAkC,uBAAaH,KAAb,CAAxC;;AAEA,MAAKE,YAAL,EAAoB;AACnB,WAAO,4BAAC,sBAAD,6BAAiBC,UAAjB;AAA8B,MAAA,GAAG,EAAGF;AAApC,OAAP;AACA;;AAED,SAAO,4BAAC,UAAD,6BAAWE,UAAX;AAAwB,IAAA,GAAG,EAAGF;AAA9B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,iBAAiB,GAAG,6BAAgBL,QAAhB,EAA0B,UAA1B,CAA1B;eAEeK,iB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../ui/context';\nimport { Scrollable } from '../../scrollable';\nimport { View } from '../../view';\nimport { useCardBody } from './hook';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<import('../types').BodyProps, 'div'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction CardBody( props, forwardedRef ) {\n\tconst { isScrollable, ...otherProps } = useCardBody( props );\n\n\tif ( isScrollable ) {\n\t\treturn <Scrollable { ...otherProps } ref={ forwardedRef } />;\n\t}\n\n\treturn <View { ...otherProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardBody` renders an optional content area for a `Card`.\n * Multiple `CardBody` components can be used within `Card` if needed.\n *\n * @example\n * ```jsx\n * import { Card, CardBody } from `@wordpress/components`;\n *\n * <Card>\n * \t<CardBody>\n * \t\t...\n * \t</CardBody>\n * </Card>\n * ```\n */\nconst ConnectedCardBody = contextConnect( CardBody, 'CardBody' );\n\nexport default ConnectedCardBody;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/card/card-body/component.js"],"names":["CardBody","props","forwardedRef","isScrollable","otherProps","ConnectedCardBody"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,SAASA,QAAT,CAAmBC,KAAnB,EAA0BC,YAA1B,EAAyC;AACxC,QAAM;AAAEC,IAAAA,YAAF;AAAgB,OAAGC;AAAnB,MAAkC,uBAAaH,KAAb,CAAxC;;AAEA,MAAKE,YAAL,EAAoB;AACnB,WAAO,4BAAC,sBAAD,6BAAiBC,UAAjB;AAA8B,MAAA,GAAG,EAAGF;AAApC,OAAP;AACA;;AAED,SAAO,4BAAC,UAAD,6BAAWE,UAAX;AAAwB,IAAA,GAAG,EAAGF;AAA9B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,iBAAiB,GAAG,6BAAgBL,QAAhB,EAA0B,UAA1B,CAA1B;eAEeK,iB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../ui/context';\nimport { Scrollable } from '../../scrollable';\nimport { View } from '../../view';\nimport { useCardBody } from './hook';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<import('../types').BodyProps, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction CardBody( props, forwardedRef ) {\n\tconst { isScrollable, ...otherProps } = useCardBody( props );\n\n\tif ( isScrollable ) {\n\t\treturn <Scrollable { ...otherProps } ref={ forwardedRef } />;\n\t}\n\n\treturn <View { ...otherProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardBody` renders an optional content area for a `Card`.\n * Multiple `CardBody` components can be used within `Card` if needed.\n *\n * @example\n * ```jsx\n * import { Card, CardBody } from `@wordpress/components`;\n *\n * <Card>\n * \t<CardBody>\n * \t\t...\n * \t</CardBody>\n * </Card>\n * ```\n */\nconst ConnectedCardBody = contextConnect( CardBody, 'CardBody' );\n\nexport default ConnectedCardBody;\n"]}
@@ -23,7 +23,7 @@ var _hook = require("./hook");
23
23
 
24
24
  /**
25
25
  * @param {import('../../ui/context').WordPressComponentProps<import('../../divider').DividerProps, 'hr', false>} props
26
- * @param {import('react').Ref<any>} forwardedRef
26
+ * @param {import('react').ForwardedRef<any>} forwardedRef
27
27
  */
28
28
  function CardDivider(props, forwardedRef) {
29
29
  const dividerProps = (0, _hook.useCardDivider)(props);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/card/card-divider/component.js"],"names":["CardDivider","props","forwardedRef","dividerProps","ConnectedCardDivider"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,SAASA,WAAT,CAAsBC,KAAtB,EAA6BC,YAA7B,EAA4C;AAC3C,QAAMC,YAAY,GAAG,0BAAgBF,KAAhB,CAArB;AAEA,SAAO,4BAAC,gBAAD,6BAAcE,YAAd;AAA6B,IAAA,GAAG,EAAGD;AAAnC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,oBAAoB,GAAG,6BAAgBJ,WAAhB,EAA6B,aAA7B,CAA7B;eAEeI,oB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../ui/context';\nimport { Divider } from '../../divider';\nimport { useCardDivider } from './hook';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<import('../../divider').DividerProps, 'hr', false>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction CardDivider( props, forwardedRef ) {\n\tconst dividerProps = useCardDivider( props );\n\n\treturn <Divider { ...dividerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardDivider` renders an optional divider within a `Card`.\n * It is typically used to divide multiple `CardBody` components from each other.\n *\n * @example\n * ```jsx\n * import { Card, CardBody, CardDivider } from `@wordpress/components`;\n *\n * <Card>\n * <CardBody>...</CardBody>\n * <CardDivider />\n * <CardBody>...</CardBody>\n * </Card>\n * ```\n */\nconst ConnectedCardDivider = contextConnect( CardDivider, 'CardDivider' );\n\nexport default ConnectedCardDivider;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/card/card-divider/component.js"],"names":["CardDivider","props","forwardedRef","dividerProps","ConnectedCardDivider"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,SAASA,WAAT,CAAsBC,KAAtB,EAA6BC,YAA7B,EAA4C;AAC3C,QAAMC,YAAY,GAAG,0BAAgBF,KAAhB,CAArB;AAEA,SAAO,4BAAC,gBAAD,6BAAcE,YAAd;AAA6B,IAAA,GAAG,EAAGD;AAAnC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,oBAAoB,GAAG,6BAAgBJ,WAAhB,EAA6B,aAA7B,CAA7B;eAEeI,oB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../ui/context';\nimport { Divider } from '../../divider';\nimport { useCardDivider } from './hook';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<import('../../divider').DividerProps, 'hr', false>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction CardDivider( props, forwardedRef ) {\n\tconst dividerProps = useCardDivider( props );\n\n\treturn <Divider { ...dividerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardDivider` renders an optional divider within a `Card`.\n * It is typically used to divide multiple `CardBody` components from each other.\n *\n * @example\n * ```jsx\n * import { Card, CardBody, CardDivider } from `@wordpress/components`;\n *\n * <Card>\n * <CardBody>...</CardBody>\n * <CardDivider />\n * <CardBody>...</CardBody>\n * </Card>\n * ```\n */\nconst ConnectedCardDivider = contextConnect( CardDivider, 'CardDivider' );\n\nexport default ConnectedCardDivider;\n"]}
@@ -23,7 +23,7 @@ var _hook = require("./hook");
23
23
 
24
24
  /**
25
25
  * @param {import('../../ui/context').WordPressComponentProps<import('../types').FooterProps, 'div'>} props
26
- * @param {import('react').Ref<any>} forwardedRef
26
+ * @param {import('react').ForwardedRef<any>} forwardedRef
27
27
  */
28
28
  function CardFooter(props, forwardedRef) {
29
29
  const footerProps = (0, _hook.useCardFooter)(props);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/card/card-footer/component.js"],"names":["CardFooter","props","forwardedRef","footerProps","ConnectedCardFooter"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,SAASA,UAAT,CAAqBC,KAArB,EAA4BC,YAA5B,EAA2C;AAC1C,QAAMC,WAAW,GAAG,yBAAeF,KAAf,CAApB;AAEA,SAAO,4BAAC,UAAD,6BAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,mBAAmB,GAAG,6BAAgBJ,UAAhB,EAA4B,YAA5B,CAA5B;eAEeI,mB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../ui/context';\nimport { Flex } from '../../flex';\nimport { useCardFooter } from './hook';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<import('../types').FooterProps, 'div'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction CardFooter( props, forwardedRef ) {\n\tconst footerProps = useCardFooter( props );\n\n\treturn <Flex { ...footerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardFooter` renders an optional footer within a `Card`.\n *\n * @example\n * ```jsx\n * import { Card, CardBody, CardFooter } from `@wordpress/components`;\n *\n * <Card>\n * \t<CardBody>...</CardBody>\n * \t<CardFooter>...</CardFooter>\n * </Card>\n * ```\n */\nconst ConnectedCardFooter = contextConnect( CardFooter, 'CardFooter' );\n\nexport default ConnectedCardFooter;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/card/card-footer/component.js"],"names":["CardFooter","props","forwardedRef","footerProps","ConnectedCardFooter"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,SAASA,UAAT,CAAqBC,KAArB,EAA4BC,YAA5B,EAA2C;AAC1C,QAAMC,WAAW,GAAG,yBAAeF,KAAf,CAApB;AAEA,SAAO,4BAAC,UAAD,6BAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,mBAAmB,GAAG,6BAAgBJ,UAAhB,EAA4B,YAA5B,CAA5B;eAEeI,mB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../ui/context';\nimport { Flex } from '../../flex';\nimport { useCardFooter } from './hook';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<import('../types').FooterProps, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction CardFooter( props, forwardedRef ) {\n\tconst footerProps = useCardFooter( props );\n\n\treturn <Flex { ...footerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardFooter` renders an optional footer within a `Card`.\n *\n * @example\n * ```jsx\n * import { Card, CardBody, CardFooter } from `@wordpress/components`;\n *\n * <Card>\n * \t<CardBody>...</CardBody>\n * \t<CardFooter>...</CardFooter>\n * </Card>\n * ```\n */\nconst ConnectedCardFooter = contextConnect( CardFooter, 'CardFooter' );\n\nexport default ConnectedCardFooter;\n"]}
@@ -23,7 +23,7 @@ var _hook = require("./hook");
23
23
 
24
24
  /**
25
25
  * @param {import('../../ui/context').WordPressComponentProps<import('../types').HeaderProps, 'div'>} props
26
- * @param {import('react').Ref<any>} forwardedRef
26
+ * @param {import('react').ForwardedRef<any>} forwardedRef
27
27
  */
28
28
  function CardHeader(props, forwardedRef) {
29
29
  const headerProps = (0, _hook.useCardHeader)(props);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/card/card-header/component.js"],"names":["CardHeader","props","forwardedRef","headerProps","ConnectedCardHeader"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,SAASA,UAAT,CAAqBC,KAArB,EAA4BC,YAA5B,EAA2C;AAC1C,QAAMC,WAAW,GAAG,yBAAeF,KAAf,CAApB;AAEA,SAAO,4BAAC,UAAD,6BAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,mBAAmB,GAAG,6BAAgBJ,UAAhB,EAA4B,YAA5B,CAA5B;eAEeI,mB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../ui/context';\nimport { Flex } from '../../flex';\nimport { useCardHeader } from './hook';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<import('../types').HeaderProps, 'div'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction CardHeader( props, forwardedRef ) {\n\tconst headerProps = useCardHeader( props );\n\n\treturn <Flex { ...headerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardHeader` renders an optional header within a `Card`.\n *\n * @example\n * ```jsx\n * import { Card, CardBody, CardHeader } from `@wordpress/components`;\n *\n * <Card>\n * \t<CardHeader>...</CardHeader>\n * \t<CardBody>...</CardBody>\n * </Card>\n * ```\n */\nconst ConnectedCardHeader = contextConnect( CardHeader, 'CardHeader' );\n\nexport default ConnectedCardHeader;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/card/card-header/component.js"],"names":["CardHeader","props","forwardedRef","headerProps","ConnectedCardHeader"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,SAASA,UAAT,CAAqBC,KAArB,EAA4BC,YAA5B,EAA2C;AAC1C,QAAMC,WAAW,GAAG,yBAAeF,KAAf,CAApB;AAEA,SAAO,4BAAC,UAAD,6BAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,mBAAmB,GAAG,6BAAgBJ,UAAhB,EAA4B,YAA5B,CAA5B;eAEeI,mB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../ui/context';\nimport { Flex } from '../../flex';\nimport { useCardHeader } from './hook';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<import('../types').HeaderProps, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction CardHeader( props, forwardedRef ) {\n\tconst headerProps = useCardHeader( props );\n\n\treturn <Flex { ...headerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardHeader` renders an optional header within a `Card`.\n *\n * @example\n * ```jsx\n * import { Card, CardBody, CardHeader } from `@wordpress/components`;\n *\n * <Card>\n * \t<CardHeader>...</CardHeader>\n * \t<CardBody>...</CardBody>\n * </Card>\n * ```\n */\nconst ConnectedCardHeader = contextConnect( CardHeader, 'CardHeader' );\n\nexport default ConnectedCardHeader;\n"]}
@@ -23,7 +23,7 @@ var _hook = require("./hook");
23
23
 
24
24
  /**
25
25
  * @param {import('../../ui/context').WordPressComponentProps<{ children: import('react').ReactNode }, 'div'>} props
26
- * @param {import('react').Ref<any>} forwardedRef
26
+ * @param {import('react').ForwardedRef<any>} forwardedRef
27
27
  */
28
28
  function CardMedia(props, forwardedRef) {
29
29
  const cardMediaProps = (0, _hook.useCardMedia)(props);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/card/card-media/component.js"],"names":["CardMedia","props","forwardedRef","cardMediaProps","ConnectedCardMedia"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,SAASA,SAAT,CAAoBC,KAApB,EAA2BC,YAA3B,EAA0C;AACzC,QAAMC,cAAc,GAAG,wBAAcF,KAAd,CAAvB;AAEA,SAAO,4BAAC,UAAD,6BAAWE,cAAX;AAA4B,IAAA,GAAG,EAAGD;AAAlC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,kBAAkB,GAAG,6BAAgBJ,SAAhB,EAA2B,WAA3B,CAA3B;eAEeI,kB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../ui/context';\nimport { View } from '../../view';\nimport { useCardMedia } from './hook';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<{ children: import('react').ReactNode }, 'div'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction CardMedia( props, forwardedRef ) {\n\tconst cardMediaProps = useCardMedia( props );\n\n\treturn <View { ...cardMediaProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardMedia` provides a container for media elements within a `Card`.\n *\n * @example\n * ```jsx\n * import { Card, CardBody, CardMedia } from '@wordpress/components';\n *\n * const Example = () => (\n * <Card>\n *\t <CardMedia>\n *\t\t <img src=\"...\" />\n * </CardMedia>\n * <CardBody>...</CardBody>\n * </Card>\n * );\n * ```\n */\nconst ConnectedCardMedia = contextConnect( CardMedia, 'CardMedia' );\n\nexport default ConnectedCardMedia;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/card/card-media/component.js"],"names":["CardMedia","props","forwardedRef","cardMediaProps","ConnectedCardMedia"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,SAASA,SAAT,CAAoBC,KAApB,EAA2BC,YAA3B,EAA0C;AACzC,QAAMC,cAAc,GAAG,wBAAcF,KAAd,CAAvB;AAEA,SAAO,4BAAC,UAAD,6BAAWE,cAAX;AAA4B,IAAA,GAAG,EAAGD;AAAlC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,kBAAkB,GAAG,6BAAgBJ,SAAhB,EAA2B,WAA3B,CAA3B;eAEeI,kB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../../ui/context';\nimport { View } from '../../view';\nimport { useCardMedia } from './hook';\n\n/**\n * @param {import('../../ui/context').WordPressComponentProps<{ children: import('react').ReactNode }, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction CardMedia( props, forwardedRef ) {\n\tconst cardMediaProps = useCardMedia( props );\n\n\treturn <View { ...cardMediaProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardMedia` provides a container for media elements within a `Card`.\n *\n * @example\n * ```jsx\n * import { Card, CardBody, CardMedia } from '@wordpress/components';\n *\n * const Example = () => (\n * <Card>\n *\t <CardMedia>\n *\t\t <img src=\"...\" />\n * </CardMedia>\n * <CardBody>...</CardBody>\n * </Card>\n * );\n * ```\n */\nconst ConnectedCardMedia = contextConnect( CardMedia, 'CardMedia' );\n\nexport default ConnectedCardMedia;\n"]}
@@ -41,6 +41,7 @@ let customIndicatorWidth = 0;
41
41
 
42
42
  function ColorPalette(_ref) {
43
43
  let {
44
+ enableCustomColor = true,
44
45
  setColor,
45
46
  activeColor,
46
47
  isGradientColor,
@@ -52,7 +53,8 @@ function ColorPalette(_ref) {
52
53
  shouldShowCustomLabel = true,
53
54
  shouldShowCustomVerticalSeparator = true,
54
55
  customColorIndicatorStyles,
55
- customIndicatorWrapperStyles
56
+ customIndicatorWrapperStyles,
57
+ label
56
58
  } = _ref;
57
59
  const customSwatchGradients = ['linear-gradient(120deg, rgba(255,0,0,.8) 0%, rgba(255,255,255,1) 70.71%)', 'linear-gradient(240deg, rgba(0,255,0,.8) 0%, rgba(0,255,0,0) 70.71%)', 'linear-gradient(360deg, rgba(0,0,255,.8) 0%, rgba(0,0,255,0) 70.71%)'];
58
60
  const scrollViewRef = (0, _element.useRef)();
@@ -61,11 +63,12 @@ function ColorPalette(_ref) {
61
63
  const scale = (0, _element.useRef)(new _reactNative.Animated.Value(1)).current;
62
64
  const opacity = (0, _element.useRef)(new _reactNative.Animated.Value(1)).current;
63
65
  const defaultColors = (0, _lodash.uniq)((0, _lodash.map)(defaultSettings.colors, 'color'));
66
+ const mergedColors = (0, _lodash.uniq)((0, _lodash.map)(defaultSettings.allColors, 'color'));
64
67
  const defaultGradientColors = (0, _lodash.uniq)((0, _lodash.map)(defaultSettings.gradients, 'gradient'));
65
68
  const colors = isGradientSegment ? defaultGradientColors : defaultColors;
66
69
  const customIndicatorColor = isGradientSegment ? activeColor : customSwatchGradients;
67
70
  const isCustomGradientColor = isGradientColor && isSelectedCustom();
68
- const shouldShowCustomIndicator = shouldShowCustomIndicatorOption && (!isGradientSegment || isCustomGradientColor);
71
+ const shouldShowCustomIndicator = enableCustomColor && shouldShowCustomIndicatorOption && (!isGradientSegment || isCustomGradientColor);
69
72
  const accessibilityHint = isGradientSegment ? (0, _i18n.__)('Navigates to customize the gradient') : (0, _i18n.__)('Navigates to custom color picker');
70
73
  const customText = (0, _i18n.__)('Custom');
71
74
  (0, _element.useEffect)(() => {
@@ -82,9 +85,9 @@ function ColorPalette(_ref) {
82
85
  }, [currentSegment]);
83
86
 
84
87
  function isSelectedCustom() {
85
- const isWithinColors = activeColor && colors && colors.includes(activeColor);
88
+ const isWithinColors = activeColor && mergedColors && mergedColors.includes(activeColor);
86
89
 
87
- if (activeColor) {
90
+ if (enableCustomColor && activeColor) {
88
91
  if (isGradientSegment) {
89
92
  return isGradientColor && !isWithinColors;
90
93
  }
@@ -191,9 +194,11 @@ function ColorPalette(_ref) {
191
194
  const verticalSeparatorStyle = (0, _compose.usePreferredColorSchemeStyle)(_style.default.verticalSeparator, _style.default.verticalSeparatorDark);
192
195
  const customTextStyle = (0, _compose.usePreferredColorSchemeStyle)([_style.default.customText, !isIOS && _style.default.customTextAndroid], _style.default.customTextDark);
193
196
  const customIndicatorWrapperStyle = [_style.default.customIndicatorWrapper, customIndicatorWrapperStyles];
194
- return (0, _element.createElement)(_reactNative.ScrollView, {
197
+ return (0, _element.createElement)(_element.Fragment, null, label && (0, _element.createElement)(_reactNative.Text, {
198
+ accessibilityRole: "header",
199
+ style: _style.default.headerText
200
+ }, label), (0, _element.createElement)(_reactNative.ScrollView, {
195
201
  contentContainerStyle: _style.default.contentContainer,
196
- style: _style.default.container,
197
202
  horizontal: true,
198
203
  showsHorizontalScrollIndicator: false,
199
204
  keyboardShouldPersistTaps: "always",
@@ -204,29 +209,8 @@ function ColorPalette(_ref) {
204
209
  onScrollBeginDrag: () => shouldEnableBottomSheetScroll(false),
205
210
  onScrollEndDrag: () => shouldEnableBottomSheetScroll(true),
206
211
  ref: scrollViewRef,
207
- testID: "color-palette"
208
- }, shouldShowCustomIndicator && (0, _element.createElement)(_reactNative.View, {
209
- style: customIndicatorWrapperStyle,
210
- onLayout: onCustomIndicatorLayout
211
- }, shouldShowCustomVerticalSeparator && (0, _element.createElement)(_reactNative.View, {
212
- style: verticalSeparatorStyle
213
- }), (0, _element.createElement)(_reactNative.TouchableWithoutFeedback, {
214
- onPress: onCustomPress,
215
- accessibilityRole: 'button',
216
- accessibilityState: {
217
- selected: isSelectedCustom()
218
- },
219
- accessibilityHint: accessibilityHint
220
- }, (0, _element.createElement)(_reactNative.View, {
221
- style: customIndicatorWrapperStyle
222
- }, (0, _element.createElement)(_colorIndicator.default, {
223
- withCustomPicker: !isGradientSegment,
224
- color: customIndicatorColor,
225
- isSelected: isSelectedCustom(),
226
- style: [_style.default.colorIndicator, customColorIndicatorStyles]
227
- }), shouldShowCustomLabel && (0, _element.createElement)(_reactNative.Text, {
228
- style: customTextStyle
229
- }, isIOS ? customText : customText.toUpperCase())))), colors.map(color => {
212
+ testID: `color-palette${label ? '-' + label : ''}`
213
+ }, colors.map(color => {
230
214
  const scaleValue = isSelected(color) ? scaleInterpolation : 1;
231
215
  return (0, _element.createElement)(_reactNative.View, {
232
216
  key: `${color}-${isSelected(color)}`
@@ -250,7 +234,28 @@ function ColorPalette(_ref) {
250
234
  opacity: opacity,
251
235
  style: [_style.default.colorIndicator, customColorIndicatorStyles]
252
236
  }))));
253
- }));
237
+ }), shouldShowCustomIndicator && (0, _element.createElement)(_reactNative.View, {
238
+ style: customIndicatorWrapperStyle,
239
+ onLayout: onCustomIndicatorLayout
240
+ }, shouldShowCustomVerticalSeparator && (0, _element.createElement)(_reactNative.View, {
241
+ style: verticalSeparatorStyle
242
+ }), (0, _element.createElement)(_reactNative.TouchableWithoutFeedback, {
243
+ onPress: onCustomPress,
244
+ accessibilityRole: 'button',
245
+ accessibilityState: {
246
+ selected: isSelectedCustom()
247
+ },
248
+ accessibilityHint: accessibilityHint
249
+ }, (0, _element.createElement)(_reactNative.View, {
250
+ style: customIndicatorWrapperStyle
251
+ }, (0, _element.createElement)(_colorIndicator.default, {
252
+ withCustomPicker: !isGradientSegment,
253
+ color: customIndicatorColor,
254
+ isSelected: isSelectedCustom(),
255
+ style: [_style.default.colorIndicator, customColorIndicatorStyles]
256
+ }), shouldShowCustomLabel && (0, _element.createElement)(_reactNative.Text, {
257
+ style: customTextStyle
258
+ }, isIOS ? customText : customText.toUpperCase()))))));
254
259
  }
255
260
 
256
261
  var _default = ColorPalette;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/color-palette/index.native.js"],"names":["ANIMATION_DURATION","contentWidth","scrollPosition","customIndicatorWidth","ColorPalette","setColor","activeColor","isGradientColor","defaultSettings","currentSegment","onCustomPress","shouldEnableBottomSheetScroll","shouldShowCustomIndicatorOption","shouldShowCustomLabel","shouldShowCustomVerticalSeparator","customColorIndicatorStyles","customIndicatorWrapperStyles","customSwatchGradients","scrollViewRef","isIOS","Platform","OS","isGradientSegment","colorsUtils","segments","scale","Animated","Value","current","opacity","defaultColors","colors","defaultGradientColors","gradients","customIndicatorColor","isCustomGradientColor","isSelectedCustom","shouldShowCustomIndicator","accessibilityHint","customText","scrollToEndWithDelay","scrollTo","x","y","isWithinColors","includes","isSelected","color","timingAnimation","property","toValue","timing","duration","easing","Easing","ease","useNativeDriver","performAnimation","setValue","parallel","start","scaleInterpolation","interpolate","inputRange","outputRange","deselectCustomGradient","width","Dimensions","get","isVisible","onColorPress","onContentSizeChange","delayedScroll","setTimeout","scrollToEnd","clearTimeout","onCustomIndicatorLayout","nativeEvent","layout","onScroll","contentOffset","verticalSeparatorStyle","styles","verticalSeparator","verticalSeparatorDark","customTextStyle","customTextAndroid","customTextDark","customIndicatorWrapperStyle","customIndicatorWrapper","contentContainer","container","selected","colorIndicator","toUpperCase","map","scaleValue","transform"],"mappings":";;;;;;;;;AAmBA;;AAhBA;;AAUA;;AAKA;;AAEA;;AAKA;;AACA;;AACA;;AA3BA;AACA;AACA;;AAaA;AACA;AACA;;AAKA;AACA;AACA;AAKA,MAAMA,kBAAkB,GAAG,GAA3B;AAEA,IAAIC,YAAY,GAAG,CAAnB;AACA,IAAIC,cAAc,GAAG,CAArB;AACA,IAAIC,oBAAoB,GAAG,CAA3B;;AAEA,SAASC,YAAT,OAaI;AAAA,MAbmB;AACtBC,IAAAA,QADsB;AAEtBC,IAAAA,WAFsB;AAGtBC,IAAAA,eAHsB;AAItBC,IAAAA,eAJsB;AAKtBC,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AAA,iBAAiB,EAAG,QAFrB;AAGC,MAAA,kBAAkB,EAAG;AACpB6C,QAAAA,QAAQ,EAAE9C,UAAU,CAAEC,KAAF;AADA,OAHtB;AAMC,MAAA,iBAAiB,EAAGA,KANrB;AAOC,MAAA,MAAM,EAAGA;AAPV,OASC,4BAAC,qBAAD,CAAU,IAAV;AACC,MAAA,KAAK,EAAG;AACPkD,QAAAA,SAAS,EAAE,CACV;AACCxE,UAAAA,KAAK,EAAEuE;AADR,SADU;AADJ;AADT,OASC,4BAAC,uBAAD;AACC,MAAA,KAAK,EAAGjD,KADT;AAEC,MAAA,UAAU,EAAGD,UAAU,CAAEC,KAAF,CAFxB;AAGC,MAAA,OAAO,EAAGlB,OAHX;AAIC,MAAA,KAAK,EAAG,CACPqD,eAAOW,cADA,EAEP9E,0BAFO;AAJT,MATD,CATD,CADD,CADD;AAiCA,GAnCC,CAlDH,CADD;AAyFA;;eAEcX,Y","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tScrollView,\n\tTouchableWithoutFeedback,\n\tView,\n\tAnimated,\n\tEasing,\n\tDimensions,\n\tPlatform,\n\tText,\n} from 'react-native';\nimport { map, uniq } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport ColorIndicator from '../color-indicator';\nimport { colorsUtils } from '../mobile/color-settings/utils';\n\nconst ANIMATION_DURATION = 200;\n\nlet contentWidth = 0;\nlet scrollPosition = 0;\nlet customIndicatorWidth = 0;\n\nfunction ColorPalette( {\n\tsetColor,\n\tactiveColor,\n\tisGradientColor,\n\tdefaultSettings,\n\tcurrentSegment,\n\tonCustomPress,\n\tshouldEnableBottomSheetScroll,\n\tshouldShowCustomIndicatorOption = true,\n\tshouldShowCustomLabel = true,\n\tshouldShowCustomVerticalSeparator = true,\n\tcustomColorIndicatorStyles,\n\tcustomIndicatorWrapperStyles,\n} ) {\n\tconst customSwatchGradients = [\n\t\t'linear-gradient(120deg, rgba(255,0,0,.8) 0%, rgba(255,255,255,1) 70.71%)',\n\t\t'linear-gradient(240deg, rgba(0,255,0,.8) 0%, rgba(0,255,0,0) 70.71%)',\n\t\t'linear-gradient(360deg, rgba(0,0,255,.8) 0%, rgba(0,0,255,0) 70.71%)',\n\t];\n\n\tconst scrollViewRef = useRef();\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst isGradientSegment = currentSegment === colorsUtils.segments[ 1 ];\n\n\tconst scale = useRef( new Animated.Value( 1 ) ).current;\n\tconst opacity = useRef( new Animated.Value( 1 ) ).current;\n\n\tconst defaultColors = uniq( map( defaultSettings.colors, 'color' ) );\n\tconst defaultGradientColors = uniq(\n\t\tmap( defaultSettings.gradients, 'gradient' )\n\t);\n\tconst colors = isGradientSegment ? defaultGradientColors : defaultColors;\n\n\tconst customIndicatorColor = isGradientSegment\n\t\t? activeColor\n\t\t: customSwatchGradients;\n\tconst isCustomGradientColor = isGradientColor && isSelectedCustom();\n\tconst shouldShowCustomIndicator =\n\t\tshouldShowCustomIndicatorOption &&\n\t\t( ! isGradientSegment || isCustomGradientColor );\n\n\tconst accessibilityHint = isGradientSegment\n\t\t? __( 'Navigates to customize the gradient' )\n\t\t: __( 'Navigates to custom color picker' );\n\tconst customText = __( 'Custom' );\n\n\tuseEffect( () => {\n\t\tif ( scrollViewRef.current ) {\n\t\t\tif ( isSelectedCustom() ) {\n\t\t\t\tscrollToEndWithDelay();\n\t\t\t} else {\n\t\t\t\tscrollViewRef.current.scrollTo( { x: 0, y: 0 } );\n\t\t\t}\n\t\t}\n\t}, [ currentSegment ] );\n\n\tfunction isSelectedCustom() {\n\t\tconst isWithinColors =\n\t\t\tactiveColor && colors && colors.includes( activeColor );\n\t\tif ( activeColor ) {\n\t\t\tif ( isGradientSegment ) {\n\t\t\t\treturn isGradientColor && ! isWithinColors;\n\t\t\t}\n\t\t\treturn ! isGradientColor && ! isWithinColors;\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction isSelected( color ) {\n\t\treturn ! isSelectedCustom() && activeColor === color;\n\t}\n\n\tfunction timingAnimation( property, toValue ) {\n\t\treturn Animated.timing( property, {\n\t\t\ttoValue,\n\t\t\tduration: ANIMATION_DURATION,\n\t\t\teasing: Easing.ease,\n\t\t\tuseNativeDriver: true,\n\t\t} );\n\t}\n\n\tfunction performAnimation( color ) {\n\t\tif ( ! isSelected( color ) ) {\n\t\t\topacity.setValue( 0 );\n\t\t}\n\n\t\tAnimated.parallel( [\n\t\t\ttimingAnimation( scale, 2 ),\n\t\t\ttimingAnimation( opacity, 1 ),\n\t\t] ).start( () => {\n\t\t\topacity.setValue( 1 );\n\t\t\tscale.setValue( 1 );\n\t\t} );\n\t}\n\n\tconst scaleInterpolation = scale.interpolate( {\n\t\tinputRange: [ 1, 1.5, 2 ],\n\t\toutputRange: [ 1, 0.7, 1 ],\n\t} );\n\n\tfunction deselectCustomGradient() {\n\t\tconst { width } = Dimensions.get( 'window' );\n\t\tconst isVisible =\n\t\t\tcontentWidth - scrollPosition - customIndicatorWidth < width;\n\n\t\tif ( isCustomGradientColor ) {\n\t\t\tif ( ! isIOS ) {\n\t\t\t\t// Scroll position on Android doesn't adjust automatically when removing the last item from the horizontal list.\n\t\t\t\t// https://github.com/facebook/react-native/issues/27504\n\t\t\t\t// Workaround: Force the scroll when deselecting custom gradient color and when custom indicator is visible on layout.\n\t\t\t\tif (\n\t\t\t\t\tisCustomGradientColor &&\n\t\t\t\t\tisVisible &&\n\t\t\t\t\tscrollViewRef.current\n\t\t\t\t) {\n\t\t\t\t\tscrollViewRef.current.scrollTo( {\n\t\t\t\t\t\tx: scrollPosition - customIndicatorWidth,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction onColorPress( color ) {\n\t\tdeselectCustomGradient();\n\t\tperformAnimation( color );\n\t\tsetColor( color );\n\t}\n\n\tfunction onContentSizeChange( width ) {\n\t\tcontentWidth = width;\n\t\tif ( isSelectedCustom() && scrollViewRef.current ) {\n\t\t\tscrollToEndWithDelay();\n\t\t}\n\t}\n\n\tfunction scrollToEndWithDelay() {\n\t\tconst delayedScroll = setTimeout( () => {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t}, ANIMATION_DURATION );\n\t\treturn () => {\n\t\t\tclearTimeout( delayedScroll );\n\t\t};\n\t}\n\n\tfunction onCustomIndicatorLayout( { nativeEvent } ) {\n\t\tconst { width } = nativeEvent.layout;\n\t\tif ( width !== customIndicatorWidth ) {\n\t\t\tcustomIndicatorWidth = width;\n\t\t}\n\t}\n\n\tfunction onScroll( { nativeEvent } ) {\n\t\tscrollPosition = nativeEvent.contentOffset.x;\n\t}\n\n\tconst verticalSeparatorStyle = usePreferredColorSchemeStyle(\n\t\tstyles.verticalSeparator,\n\t\tstyles.verticalSeparatorDark\n\t);\n\n\tconst customTextStyle = usePreferredColorSchemeStyle(\n\t\t[ styles.customText, ! isIOS && styles.customTextAndroid ],\n\t\tstyles.customTextDark\n\t);\n\n\tconst customIndicatorWrapperStyle = [\n\t\tstyles.customIndicatorWrapper,\n\t\tcustomIndicatorWrapperStyles,\n\t];\n\n\treturn (\n\t\t<ScrollView\n\t\t\tcontentContainerStyle={ styles.contentContainer }\n\t\t\tstyle={ styles.container }\n\t\t\thorizontal\n\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\tdisableScrollViewPanResponder\n\t\t\tscrollEventThrottle={ 16 }\n\t\t\tonScroll={ onScroll }\n\t\t\tonContentSizeChange={ onContentSizeChange }\n\t\t\tonScrollBeginDrag={ () => shouldEnableBottomSheetScroll( false ) }\n\t\t\tonScrollEndDrag={ () => shouldEnableBottomSheetScroll( true ) }\n\t\t\tref={ scrollViewRef }\n\t\t\ttestID=\"color-palette\"\n\t\t>\n\t\t\t{ shouldShowCustomIndicator && (\n\t\t\t\t<View\n\t\t\t\t\tstyle={ customIndicatorWrapperStyle }\n\t\t\t\t\tonLayout={ onCustomIndicatorLayout }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowCustomVerticalSeparator && (\n\t\t\t\t\t\t<View style={ verticalSeparatorStyle } />\n\t\t\t\t\t) }\n\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\tonPress={ onCustomPress }\n\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\taccessibilityState={ { selected: isSelectedCustom() } }\n\t\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ customIndicatorWrapperStyle }>\n\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\twithCustomPicker={ ! isGradientSegment }\n\t\t\t\t\t\t\t\tcolor={ customIndicatorColor }\n\t\t\t\t\t\t\t\tisSelected={ isSelectedCustom() }\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ shouldShowCustomLabel && (\n\t\t\t\t\t\t\t\t<Text style={ customTextStyle }>\n\t\t\t\t\t\t\t\t\t{ isIOS\n\t\t\t\t\t\t\t\t\t\t? customText\n\t\t\t\t\t\t\t\t\t\t: customText.toUpperCase() }\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ colors.map( ( color ) => {\n\t\t\t\tconst scaleValue = isSelected( color ) ? scaleInterpolation : 1;\n\t\t\t\treturn (\n\t\t\t\t\t<View key={ `${ color }-${ isSelected( color ) }` }>\n\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\tonPress={ () => onColorPress( color ) }\n\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\tselected: isSelected( color ),\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taccessibilityHint={ color }\n\t\t\t\t\t\t\ttestID={ color }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Animated.View\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\ttransform: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tscale: scaleValue,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\tisSelected={ isSelected( color ) }\n\t\t\t\t\t\t\t\t\topacity={ opacity }\n\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\n\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Animated.View>\n\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t</View>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ScrollView>\n\t);\n}\n\nexport default ColorPalette;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/color-palette/index.native.js"],"names":["ANIMATION_DURATION","contentWidth","scrollPosition","customIndicatorWidth","ColorPalette","enableCustomColor","setColor","activeColor","isGradientColor","defaultSettings","currentSegment","onCustomPress","shouldEnableBottomSheetScroll","shouldShowCustomIndicatorOption","shouldShowCustomLabel","shouldShowCustomVerticalSeparator","customColorIndicatorStyles","customIndicatorWrapperStyles","label","customSwatchGradients","scrollViewRef","isIOS","Platform","OS","isGradientSegment","colorsUtils","segments","scale","Animated","Value","current","opacity","defaultColors","colors","mergedColors","allColors","defaultGradientColors","gradients","customIndicatorColor","isCustomGradientColor","isSelectedCustom","shouldShowCustomIndicator","accessibilityHint","customText","scrollToEndWithDelay","scrollTo","x","y","isWithinColors","includes","isSelected","color","timingAnimation","property","toValue","timing","duration","easing","Easing","ease","useNativeDriver","performAnimation","setValue","parallel","start","scaleInterpolation","interpolate","inputRange","outputRange","deselectCustomGradient","width","Dimensions","get","isVisible","onColorPress","onContentSizeChange","delayedScroll","setTimeout","scrollToEnd","clearTimeout","onCustomIndicatorLayout","nativeEvent","layout","onScroll","contentOffset","verticalSeparatorStyle","styles","verticalSeparator","verticalSeparatorDark","customTextStyle","customTextAndroid","customTextDark","customIndicatorWrapperStyle","customIndicatorWrapper","headerText","contentContainer","map","scaleValue","selected","transform","colorIndicator","toUpperCase"],"mappings":";;;;;;;;;AAmBA;;AAhBA;;AAUA;;AAKA;;AAEA;;AAKA;;AACA;;AACA;;AA3BA;AACA;AACA;;AAaA;AACA;AACA;;AAKA;AACA;AACA;AAKA,MAAMA,kBAAkB,GAAG,GAA3B;AAEA,IAAIC,YAAY,GAAG,CAAnB;AACA,IAAIC,cAAc,GAAG,CAArB;AACA,IAAIC,oBAAoB,GAAG,CAA3B;;AAEA,SAASC,YAAT,OAeI;AAAA,MAfmB;AACtBC,IAAAA,iBAAiB,GAAG,IADE;AAEtBC,IAAAA,QAFsB;AAGtBC,IAAAA,WAHsB;AAItBC,IAAAA,eAJsB;AAKtBC,IAAAA,eALsB;AAMtBC,IAAAA,cANsB;AAOtBC,IAAAA,aAPsB;AAQtBC,IAAAA,6BARsB;AAStBC,IAAAA,+BAA+B,GAAG,IATZ;AAUtBC,IAAAA,qBAAqB,GAAG,IAVF;AAWtBC,IAAAA,iCAAiC,GAAG,IAXd;AAYtBC,IAAAA,0BAZsB;AAatBC,IAAAA,4BAbsB;AActBC,IAAAA;AAdsB,GAenB;AACH,QAAMC,qBAAqB,GAAG,CAC7B,0EA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aADX;AAEC,IAAA,iBAAiB,EAAG,QAFrB;AAGC,IAAA,kBAAkB,EAAG;AACpBuF,MAAAA,QAAQ,EAAE1D,gBAAgB;AADN,KAHtB;AAMC,IAAA,iBAAiB,EAAGE;AANrB,KAQC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGkD;AAAd,KACC,4BAAC,uBAAD;AACC,IAAA,gBAAgB,EAAG,CAAEpE,iBADtB;AAEC,IAAA,KAAK,EAAGc,oBAFT;AAGC,IAAA,UAAU,EAAGE,gBAAgB,EAH9B;AAIC,IAAA,KAAK,EAAG,CACP8C,eAAOc,cADA,EAEPpF,0BAFO;AAJT,IADD,EAUGF,qBAAqB,IACtB,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAG2E;AAAd,KACGpE,KAAK,GACJsB,UADI,GAEJA,UAAU,CAAC0D,WAAX,EAHJ,CAXF,CARD,CAPD,CAvDF,CAPD,CADD;AAsGA;;eAEcjG,Y","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tScrollView,\n\tTouchableWithoutFeedback,\n\tView,\n\tAnimated,\n\tEasing,\n\tDimensions,\n\tPlatform,\n\tText,\n} from 'react-native';\nimport { map, uniq } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport ColorIndicator from '../color-indicator';\nimport { colorsUtils } from '../mobile/color-settings/utils';\n\nconst ANIMATION_DURATION = 200;\n\nlet contentWidth = 0;\nlet scrollPosition = 0;\nlet customIndicatorWidth = 0;\n\nfunction ColorPalette( {\n\tenableCustomColor = true,\n\tsetColor,\n\tactiveColor,\n\tisGradientColor,\n\tdefaultSettings,\n\tcurrentSegment,\n\tonCustomPress,\n\tshouldEnableBottomSheetScroll,\n\tshouldShowCustomIndicatorOption = true,\n\tshouldShowCustomLabel = true,\n\tshouldShowCustomVerticalSeparator = true,\n\tcustomColorIndicatorStyles,\n\tcustomIndicatorWrapperStyles,\n\tlabel,\n} ) {\n\tconst customSwatchGradients = [\n\t\t'linear-gradient(120deg, rgba(255,0,0,.8) 0%, rgba(255,255,255,1) 70.71%)',\n\t\t'linear-gradient(240deg, rgba(0,255,0,.8) 0%, rgba(0,255,0,0) 70.71%)',\n\t\t'linear-gradient(360deg, rgba(0,0,255,.8) 0%, rgba(0,0,255,0) 70.71%)',\n\t];\n\n\tconst scrollViewRef = useRef();\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst isGradientSegment = currentSegment === colorsUtils.segments[ 1 ];\n\n\tconst scale = useRef( new Animated.Value( 1 ) ).current;\n\tconst opacity = useRef( new Animated.Value( 1 ) ).current;\n\n\tconst defaultColors = uniq( map( defaultSettings.colors, 'color' ) );\n\tconst mergedColors = uniq( map( defaultSettings.allColors, 'color' ) );\n\tconst defaultGradientColors = uniq(\n\t\tmap( defaultSettings.gradients, 'gradient' )\n\t);\n\tconst colors = isGradientSegment ? defaultGradientColors : defaultColors;\n\n\tconst customIndicatorColor = isGradientSegment\n\t\t? activeColor\n\t\t: customSwatchGradients;\n\tconst isCustomGradientColor = isGradientColor && isSelectedCustom();\n\tconst shouldShowCustomIndicator =\n\t\tenableCustomColor &&\n\t\tshouldShowCustomIndicatorOption &&\n\t\t( ! isGradientSegment || isCustomGradientColor );\n\n\tconst accessibilityHint = isGradientSegment\n\t\t? __( 'Navigates to customize the gradient' )\n\t\t: __( 'Navigates to custom color picker' );\n\tconst customText = __( 'Custom' );\n\n\tuseEffect( () => {\n\t\tif ( scrollViewRef.current ) {\n\t\t\tif ( isSelectedCustom() ) {\n\t\t\t\tscrollToEndWithDelay();\n\t\t\t} else {\n\t\t\t\tscrollViewRef.current.scrollTo( { x: 0, y: 0 } );\n\t\t\t}\n\t\t}\n\t}, [ currentSegment ] );\n\n\tfunction isSelectedCustom() {\n\t\tconst isWithinColors =\n\t\t\tactiveColor && mergedColors && mergedColors.includes( activeColor );\n\t\tif ( enableCustomColor && activeColor ) {\n\t\t\tif ( isGradientSegment ) {\n\t\t\t\treturn isGradientColor && ! isWithinColors;\n\t\t\t}\n\t\t\treturn ! isGradientColor && ! isWithinColors;\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction isSelected( color ) {\n\t\treturn ! isSelectedCustom() && activeColor === color;\n\t}\n\n\tfunction timingAnimation( property, toValue ) {\n\t\treturn Animated.timing( property, {\n\t\t\ttoValue,\n\t\t\tduration: ANIMATION_DURATION,\n\t\t\teasing: Easing.ease,\n\t\t\tuseNativeDriver: true,\n\t\t} );\n\t}\n\n\tfunction performAnimation( color ) {\n\t\tif ( ! isSelected( color ) ) {\n\t\t\topacity.setValue( 0 );\n\t\t}\n\n\t\tAnimated.parallel( [\n\t\t\ttimingAnimation( scale, 2 ),\n\t\t\ttimingAnimation( opacity, 1 ),\n\t\t] ).start( () => {\n\t\t\topacity.setValue( 1 );\n\t\t\tscale.setValue( 1 );\n\t\t} );\n\t}\n\n\tconst scaleInterpolation = scale.interpolate( {\n\t\tinputRange: [ 1, 1.5, 2 ],\n\t\toutputRange: [ 1, 0.7, 1 ],\n\t} );\n\n\tfunction deselectCustomGradient() {\n\t\tconst { width } = Dimensions.get( 'window' );\n\t\tconst isVisible =\n\t\t\tcontentWidth - scrollPosition - customIndicatorWidth < width;\n\n\t\tif ( isCustomGradientColor ) {\n\t\t\tif ( ! isIOS ) {\n\t\t\t\t// Scroll position on Android doesn't adjust automatically when removing the last item from the horizontal list.\n\t\t\t\t// https://github.com/facebook/react-native/issues/27504\n\t\t\t\t// Workaround: Force the scroll when deselecting custom gradient color and when custom indicator is visible on layout.\n\t\t\t\tif (\n\t\t\t\t\tisCustomGradientColor &&\n\t\t\t\t\tisVisible &&\n\t\t\t\t\tscrollViewRef.current\n\t\t\t\t) {\n\t\t\t\t\tscrollViewRef.current.scrollTo( {\n\t\t\t\t\t\tx: scrollPosition - customIndicatorWidth,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction onColorPress( color ) {\n\t\tdeselectCustomGradient();\n\t\tperformAnimation( color );\n\t\tsetColor( color );\n\t}\n\n\tfunction onContentSizeChange( width ) {\n\t\tcontentWidth = width;\n\t\tif ( isSelectedCustom() && scrollViewRef.current ) {\n\t\t\tscrollToEndWithDelay();\n\t\t}\n\t}\n\n\tfunction scrollToEndWithDelay() {\n\t\tconst delayedScroll = setTimeout( () => {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t}, ANIMATION_DURATION );\n\t\treturn () => {\n\t\t\tclearTimeout( delayedScroll );\n\t\t};\n\t}\n\n\tfunction onCustomIndicatorLayout( { nativeEvent } ) {\n\t\tconst { width } = nativeEvent.layout;\n\t\tif ( width !== customIndicatorWidth ) {\n\t\t\tcustomIndicatorWidth = width;\n\t\t}\n\t}\n\n\tfunction onScroll( { nativeEvent } ) {\n\t\tscrollPosition = nativeEvent.contentOffset.x;\n\t}\n\n\tconst verticalSeparatorStyle = usePreferredColorSchemeStyle(\n\t\tstyles.verticalSeparator,\n\t\tstyles.verticalSeparatorDark\n\t);\n\n\tconst customTextStyle = usePreferredColorSchemeStyle(\n\t\t[ styles.customText, ! isIOS && styles.customTextAndroid ],\n\t\tstyles.customTextDark\n\t);\n\n\tconst customIndicatorWrapperStyle = [\n\t\tstyles.customIndicatorWrapper,\n\t\tcustomIndicatorWrapperStyles,\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t{ label && (\n\t\t\t\t<Text accessibilityRole=\"header\" style={ styles.headerText }>\n\t\t\t\t\t{ label }\n\t\t\t\t</Text>\n\t\t\t) }\n\n\t\t\t<ScrollView\n\t\t\t\tcontentContainerStyle={ styles.contentContainer }\n\t\t\t\thorizontal\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\tdisableScrollViewPanResponder\n\t\t\t\tscrollEventThrottle={ 16 }\n\t\t\t\tonScroll={ onScroll }\n\t\t\t\tonContentSizeChange={ onContentSizeChange }\n\t\t\t\tonScrollBeginDrag={ () =>\n\t\t\t\t\tshouldEnableBottomSheetScroll( false )\n\t\t\t\t}\n\t\t\t\tonScrollEndDrag={ () => shouldEnableBottomSheetScroll( true ) }\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\ttestID={ `color-palette${ label ? '-' + label : '' }` }\n\t\t\t>\n\t\t\t\t{ colors.map( ( color ) => {\n\t\t\t\t\tconst scaleValue = isSelected( color )\n\t\t\t\t\t\t? scaleInterpolation\n\t\t\t\t\t\t: 1;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<View key={ `${ color }-${ isSelected( color ) }` }>\n\t\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\t\tonPress={ () => onColorPress( color ) }\n\t\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\t\tselected: isSelected( color ),\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\taccessibilityHint={ color }\n\t\t\t\t\t\t\t\ttestID={ color }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Animated.View\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\ttransform: [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tscale: scaleValue,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\tisSelected={ isSelected( color ) }\n\t\t\t\t\t\t\t\t\t\topacity={ opacity }\n\t\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\n\t\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Animated.View>\n\t\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ shouldShowCustomIndicator && (\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ customIndicatorWrapperStyle }\n\t\t\t\t\t\tonLayout={ onCustomIndicatorLayout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ shouldShowCustomVerticalSeparator && (\n\t\t\t\t\t\t\t<View style={ verticalSeparatorStyle } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\tonPress={ onCustomPress }\n\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\tselected: isSelectedCustom(),\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<View style={ customIndicatorWrapperStyle }>\n\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\twithCustomPicker={ ! isGradientSegment }\n\t\t\t\t\t\t\t\t\tcolor={ customIndicatorColor }\n\t\t\t\t\t\t\t\t\tisSelected={ isSelectedCustom() }\n\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\n\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ shouldShowCustomLabel && (\n\t\t\t\t\t\t\t\t\t<Text style={ customTextStyle }>\n\t\t\t\t\t\t\t\t\t\t{ isIOS\n\t\t\t\t\t\t\t\t\t\t\t? customText\n\t\t\t\t\t\t\t\t\t\t\t: customText.toUpperCase() }\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\t\t\t</ScrollView>\n\t\t</>\n\t);\n}\n\nexport default ColorPalette;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/color-picker/component.tsx"],"names":["namesPlugin","options","label","value","ColorPicker","props","forwardedRef","enableAlpha","color","colorProp","onChange","defaultValue","copyFormat","divProps","setColor","safeColordColor","debouncedSetColor","handleChange","nextValue","toHex","showInputs","setShowInputs","colorType","setColorType","nextColorType","settings","ConnectedColorPicker"],"mappings":";;;;;;;;;AAUA;;;;AANA;;AACA;;AAMA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAlCA;AACA;AACA;;AAKA;AACA;AACA;;AAMA;AACA;AACA;AAqBA,oBAAQ,CAAEA,cAAF,CAAR;AAUA,MAAMC,OAAO,GAAG,CACf;AAAEC,EAAAA,KAAK,EAAE,KAAT;AAAgBC,EAAAA,KAAK,EAAE;AAAvB,CADe,EAEf;AAAED,EAAAA,KAAK,EAAE,KAAT;AAAgBC,EAAAA,KAAK,EAAE;AAAvB,CAFe,EAGf;AAAED,EAAAA,KAAK,EAAE,KAAT;AAAgBC,EAAAA,KAAK,EAAE;AAAvB,CAHe,CAAhB;;AAMA,MAAMC,WAAW,GAAG,CACnBC,KADmB,EAEnBC,YAFmB,KAGf;AACJ,QAAM;AACLC,IAAAA,WAAW,GAAG,KADT;AAELC,IAAAA,KAAK,EAAEC,SAFF;AAGLC,IAAAA,QAHK;AAILC,IAAAA,YAAY,GAAG,MAJV;AAKLC,IAAAA,UALK;AAML,OAAGC;AANE,MAOF,+BAAkBR,KAAlB,EAAyB,aAAzB,CAPJ,CADI,CAUJ;;AACA,QAAM,CAAEG,KAAF,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AkBC,4BAAC,4BAAD;AACC,IAAA,OAAO,MADR;AAEC,IAAA,OAAO,EAAG,MAAMc,aAAa,CAAE,CAAED,UAAJ,CAF9B;AAGC,IAAA,IAAI,EAAGK,eAHR;AAIC,IAAA,SAAS,EAAGL,UAJb;AAKC,IAAA,KAAK,EACJA,UAAU,GACP,cAAI,sBAAJ,CADO,GAEP,cAAI,sBAAJ;AARL,IAlBD,CADD,EA+BC,4BAAC,cAAD;AAAQ,IAAA,MAAM,EAAG;AAAjB,IA/BD,EAgCGA,UAAU,IACX,4BAAC,sBAAD;AACC,IAAA,SAAS,EAAGE,SADb;AAEC,IAAA,KAAK,EAAGP,eAFT;AAGC,IAAA,QAAQ,EAAGE,YAHZ;AAIC,IAAA,WAAW,EAAGV;AAJf,IAjCF,CAND,CADD;AAkDA,CAxFD;;AA0FA,MAAMmB,oBAAoB,GAAG,6BAAgBtB,WAAhB,EAA6B,aAA7B,CAA7B;eAEesB,oB","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\nimport { colord, extend, Colord } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useState, useMemo } from '@wordpress/element';\nimport { settings } from '@wordpress/icons';\nimport { useDebounce } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tWordPressComponentProps,\n} from '../ui/context';\nimport { HStack } from '../h-stack';\nimport { Spacer } from '../spacer';\nimport {\n\tColorfulWrapper,\n\tSelectControl,\n\tAuxiliaryColorArtefactWrapper,\n\tDetailsControlButton,\n} from './styles';\nimport { ColorDisplay } from './color-display';\nimport { ColorInput } from './color-input';\nimport { Picker } from './picker';\nimport { useControlledValue } from '../utils/hooks';\n\nimport type { ColorType } from './types';\n\nextend( [ namesPlugin ] );\n\nexport interface ColorPickerProps {\n\tenableAlpha?: boolean;\n\tcolor?: string;\n\tonChange?: ( color: string ) => void;\n\tdefaultValue?: string;\n\tcopyFormat?: ColorType;\n}\n\nconst options = [\n\t{ label: 'RGB', value: 'rgb' as const },\n\t{ label: 'HSL', value: 'hsl' as const },\n\t{ label: 'Hex', value: 'hex' as const },\n];\n\nconst ColorPicker = (\n\tprops: WordPressComponentProps< ColorPickerProps, 'div', false >,\n\tforwardedRef: Ref< any >\n) => {\n\tconst {\n\t\tenableAlpha = false,\n\t\tcolor: colorProp,\n\t\tonChange,\n\t\tdefaultValue = '#fff',\n\t\tcopyFormat,\n\t\t...divProps\n\t} = useContextSystem( props, 'ColorPicker' );\n\n\t// Use a safe default value for the color and remove the possibility of `undefined`.\n\tconst [ color, setColor ] = useControlledValue( {\n\t\tonChange,\n\t\tvalue: colorProp,\n\t\tdefaultValue,\n\t} );\n\n\tconst safeColordColor = useMemo( () => {\n\t\treturn colord( color || '' );\n\t}, [ color ] );\n\n\tconst debouncedSetColor = useDebounce( setColor );\n\n\tconst handleChange = useCallback(\n\t\t( nextValue: Colord ) => {\n\t\t\tdebouncedSetColor( nextValue.toHex() );\n\t\t},\n\t\t[ debouncedSetColor ]\n\t);\n\n\tconst [ showInputs, setShowInputs ] = useState< boolean >( false );\n\tconst [ colorType, setColorType ] = useState< ColorType >(\n\t\tcopyFormat || 'hex'\n\t);\n\n\treturn (\n\t\t<ColorfulWrapper ref={ forwardedRef } { ...divProps }>\n\t\t\t<Picker\n\t\t\t\tonChange={ handleChange }\n\t\t\t\tcolor={ safeColordColor }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t\t<AuxiliaryColorArtefactWrapper>\n\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t{ showInputs ? (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ colorType }\n\t\t\t\t\t\t\tonChange={ ( nextColorType ) =>\n\t\t\t\t\t\t\t\tsetColorType( nextColorType as ColorType )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Color format' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<ColorDisplay\n\t\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\t\tcolorType={ copyFormat || colorType }\n\t\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<DetailsControlButton\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tonClick={ () => setShowInputs( ! showInputs ) }\n\t\t\t\t\t\ticon={ settings }\n\t\t\t\t\t\tisPressed={ showInputs }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tshowInputs\n\t\t\t\t\t\t\t\t? __( 'Hide detailed inputs' )\n\t\t\t\t\t\t\t\t: __( 'Show detailed inputs' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t\t<Spacer margin={ 4 } />\n\t\t\t\t{ showInputs && (\n\t\t\t\t\t<ColorInput\n\t\t\t\t\t\tcolorType={ colorType }\n\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</AuxiliaryColorArtefactWrapper>\n\t\t</ColorfulWrapper>\n\t);\n};\n\nconst ConnectedColorPicker = contextConnect( ColorPicker, 'ColorPicker' );\n\nexport default ConnectedColorPicker;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/color-picker/component.tsx"],"names":["namesPlugin","options","label","value","ColorPicker","props","forwardedRef","enableAlpha","color","colorProp","onChange","defaultValue","copyFormat","divProps","setColor","safeColordColor","debouncedSetColor","handleChange","nextValue","toHex","showInputs","setShowInputs","colorType","setColorType","nextColorType","settings","ConnectedColorPicker"],"mappings":";;;;;;;;;AAUA;;;;AANA;;AACA;;AAMA;;AACA;;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,MAAMmB,oBAAoB,GAAG,6BAAgBtB,WAAhB,EAA6B,aAA7B,CAA7B;eAEesB,oB","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport { colord, extend, Colord } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useState, useMemo } from '@wordpress/element';\nimport { settings } from '@wordpress/icons';\nimport { useDebounce } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tWordPressComponentProps,\n} from '../ui/context';\nimport { HStack } from '../h-stack';\nimport { Spacer } from '../spacer';\nimport {\n\tColorfulWrapper,\n\tSelectControl,\n\tAuxiliaryColorArtefactWrapper,\n\tDetailsControlButton,\n} from './styles';\nimport { ColorDisplay } from './color-display';\nimport { ColorInput } from './color-input';\nimport { Picker } from './picker';\nimport { useControlledValue } from '../utils/hooks';\n\nimport type { ColorType } from './types';\n\nextend( [ namesPlugin ] );\n\nexport interface ColorPickerProps {\n\tenableAlpha?: boolean;\n\tcolor?: string;\n\tonChange?: ( color: string ) => void;\n\tdefaultValue?: string;\n\tcopyFormat?: ColorType;\n}\n\nconst options = [\n\t{ label: 'RGB', value: 'rgb' as const },\n\t{ label: 'HSL', value: 'hsl' as const },\n\t{ label: 'Hex', value: 'hex' as const },\n];\n\nconst ColorPicker = (\n\tprops: WordPressComponentProps< ColorPickerProps, 'div', false >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tenableAlpha = false,\n\t\tcolor: colorProp,\n\t\tonChange,\n\t\tdefaultValue = '#fff',\n\t\tcopyFormat,\n\t\t...divProps\n\t} = useContextSystem( props, 'ColorPicker' );\n\n\t// Use a safe default value for the color and remove the possibility of `undefined`.\n\tconst [ color, setColor ] = useControlledValue( {\n\t\tonChange,\n\t\tvalue: colorProp,\n\t\tdefaultValue,\n\t} );\n\n\tconst safeColordColor = useMemo( () => {\n\t\treturn colord( color || '' );\n\t}, [ color ] );\n\n\tconst debouncedSetColor = useDebounce( setColor );\n\n\tconst handleChange = useCallback(\n\t\t( nextValue: Colord ) => {\n\t\t\tdebouncedSetColor( nextValue.toHex() );\n\t\t},\n\t\t[ debouncedSetColor ]\n\t);\n\n\tconst [ showInputs, setShowInputs ] = useState< boolean >( false );\n\tconst [ colorType, setColorType ] = useState< ColorType >(\n\t\tcopyFormat || 'hex'\n\t);\n\n\treturn (\n\t\t<ColorfulWrapper ref={ forwardedRef } { ...divProps }>\n\t\t\t<Picker\n\t\t\t\tonChange={ handleChange }\n\t\t\t\tcolor={ safeColordColor }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t\t<AuxiliaryColorArtefactWrapper>\n\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t{ showInputs ? (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ colorType }\n\t\t\t\t\t\t\tonChange={ ( nextColorType ) =>\n\t\t\t\t\t\t\t\tsetColorType( nextColorType as ColorType )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Color format' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<ColorDisplay\n\t\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\t\tcolorType={ copyFormat || colorType }\n\t\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<DetailsControlButton\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tonClick={ () => setShowInputs( ! showInputs ) }\n\t\t\t\t\t\ticon={ settings }\n\t\t\t\t\t\tisPressed={ showInputs }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tshowInputs\n\t\t\t\t\t\t\t\t? __( 'Hide detailed inputs' )\n\t\t\t\t\t\t\t\t: __( 'Show detailed inputs' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t\t<Spacer margin={ 4 } />\n\t\t\t\t{ showInputs && (\n\t\t\t\t\t<ColorInput\n\t\t\t\t\t\tcolorType={ colorType }\n\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</AuxiliaryColorArtefactWrapper>\n\t\t</ColorfulWrapper>\n\t);\n};\n\nconst ConnectedColorPicker = contextConnect( ColorPicker, 'ColorPicker' );\n\nexport default ConnectedColorPicker;\n"]}